[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 4306: 5 /***/ (function(module, exports) { 6 7 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8 autosize 4.0.4 9 license: MIT 10 http://www.jacklmoore.com/autosize 11 */ 12 (function (global, factory) { 13 if (true) { 14 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 15 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 16 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 17 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 18 } else { var mod; } 19 })(this, function (module, exports) { 20 'use strict'; 21 22 var map = typeof Map === "function" ? new Map() : function () { 23 var keys = []; 24 var values = []; 25 26 return { 27 has: function has(key) { 28 return keys.indexOf(key) > -1; 29 }, 30 get: function get(key) { 31 return values[keys.indexOf(key)]; 32 }, 33 set: function set(key, value) { 34 if (keys.indexOf(key) === -1) { 35 keys.push(key); 36 values.push(value); 37 } 38 }, 39 delete: function _delete(key) { 40 var index = keys.indexOf(key); 41 if (index > -1) { 42 keys.splice(index, 1); 43 values.splice(index, 1); 44 } 45 } 46 }; 47 }(); 48 49 var createEvent = function createEvent(name) { 50 return new Event(name, { bubbles: true }); 51 }; 52 try { 53 new Event('test'); 54 } catch (e) { 55 // IE does not support `new Event()` 56 createEvent = function createEvent(name) { 57 var evt = document.createEvent('Event'); 58 evt.initEvent(name, true, false); 59 return evt; 60 }; 61 } 62 63 function assign(ta) { 64 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 65 66 var heightOffset = null; 67 var clientWidth = null; 68 var cachedHeight = null; 69 70 function init() { 71 var style = window.getComputedStyle(ta, null); 72 73 if (style.resize === 'vertical') { 74 ta.style.resize = 'none'; 75 } else if (style.resize === 'both') { 76 ta.style.resize = 'horizontal'; 77 } 78 79 if (style.boxSizing === 'content-box') { 80 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 81 } else { 82 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 83 } 84 // Fix when a textarea is not on document body and heightOffset is Not a Number 85 if (isNaN(heightOffset)) { 86 heightOffset = 0; 87 } 88 89 update(); 90 } 91 92 function changeOverflow(value) { 93 { 94 // Chrome/Safari-specific fix: 95 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 96 // made available by removing the scrollbar. The following forces the necessary text reflow. 97 var width = ta.style.width; 98 ta.style.width = '0px'; 99 // Force reflow: 100 /* jshint ignore:start */ 101 ta.offsetWidth; 102 /* jshint ignore:end */ 103 ta.style.width = width; 104 } 105 106 ta.style.overflowY = value; 107 } 108 109 function getParentOverflows(el) { 110 var arr = []; 111 112 while (el && el.parentNode && el.parentNode instanceof Element) { 113 if (el.parentNode.scrollTop) { 114 arr.push({ 115 node: el.parentNode, 116 scrollTop: el.parentNode.scrollTop 117 }); 118 } 119 el = el.parentNode; 120 } 121 122 return arr; 123 } 124 125 function resize() { 126 if (ta.scrollHeight === 0) { 127 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 128 return; 129 } 130 131 var overflows = getParentOverflows(ta); 132 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 133 134 ta.style.height = ''; 135 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 136 137 // used to check if an update is actually necessary on window.resize 138 clientWidth = ta.clientWidth; 139 140 // prevents scroll-position jumping 141 overflows.forEach(function (el) { 142 el.node.scrollTop = el.scrollTop; 143 }); 144 145 if (docTop) { 146 document.documentElement.scrollTop = docTop; 147 } 148 } 149 150 function update() { 151 resize(); 152 153 var styleHeight = Math.round(parseFloat(ta.style.height)); 154 var computed = window.getComputedStyle(ta, null); 155 156 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 157 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 158 159 // The actual height not matching the style height (set via the resize method) indicates that 160 // the max-height has been exceeded, in which case the overflow should be allowed. 161 if (actualHeight < styleHeight) { 162 if (computed.overflowY === 'hidden') { 163 changeOverflow('scroll'); 164 resize(); 165 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 166 } 167 } else { 168 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 169 if (computed.overflowY !== 'hidden') { 170 changeOverflow('hidden'); 171 resize(); 172 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 173 } 174 } 175 176 if (cachedHeight !== actualHeight) { 177 cachedHeight = actualHeight; 178 var evt = createEvent('autosize:resized'); 179 try { 180 ta.dispatchEvent(evt); 181 } catch (err) { 182 // Firefox will throw an error on dispatchEvent for a detached element 183 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 184 } 185 } 186 } 187 188 var pageResize = function pageResize() { 189 if (ta.clientWidth !== clientWidth) { 190 update(); 191 } 192 }; 193 194 var destroy = function (style) { 195 window.removeEventListener('resize', pageResize, false); 196 ta.removeEventListener('input', update, false); 197 ta.removeEventListener('keyup', update, false); 198 ta.removeEventListener('autosize:destroy', destroy, false); 199 ta.removeEventListener('autosize:update', update, false); 200 201 Object.keys(style).forEach(function (key) { 202 ta.style[key] = style[key]; 203 }); 204 205 map.delete(ta); 206 }.bind(ta, { 207 height: ta.style.height, 208 resize: ta.style.resize, 209 overflowY: ta.style.overflowY, 210 overflowX: ta.style.overflowX, 211 wordWrap: ta.style.wordWrap 212 }); 213 214 ta.addEventListener('autosize:destroy', destroy, false); 215 216 // IE9 does not fire onpropertychange or oninput for deletions, 217 // so binding to onkeyup to catch most of those events. 218 // There is no way that I know of to detect something like 'cut' in IE9. 219 if ('onpropertychange' in ta && 'oninput' in ta) { 220 ta.addEventListener('keyup', update, false); 221 } 222 223 window.addEventListener('resize', pageResize, false); 224 ta.addEventListener('input', update, false); 225 ta.addEventListener('autosize:update', update, false); 226 ta.style.overflowX = 'hidden'; 227 ta.style.wordWrap = 'break-word'; 228 229 map.set(ta, { 230 destroy: destroy, 231 update: update 232 }); 233 234 init(); 235 } 236 237 function destroy(ta) { 238 var methods = map.get(ta); 239 if (methods) { 240 methods.destroy(); 241 } 242 } 243 244 function update(ta) { 245 var methods = map.get(ta); 246 if (methods) { 247 methods.update(); 248 } 249 } 250 251 var autosize = null; 252 253 // Do nothing in Node.js environment and IE8 (or lower) 254 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 255 autosize = function autosize(el) { 256 return el; 257 }; 258 autosize.destroy = function (el) { 259 return el; 260 }; 261 autosize.update = function (el) { 262 return el; 263 }; 264 } else { 265 autosize = function autosize(el, options) { 266 if (el) { 267 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 268 return assign(x, options); 269 }); 270 } 271 return el; 272 }; 273 autosize.destroy = function (el) { 274 if (el) { 275 Array.prototype.forEach.call(el.length ? el : [el], destroy); 276 } 277 return el; 278 }; 279 autosize.update = function (el) { 280 if (el) { 281 Array.prototype.forEach.call(el.length ? el : [el], update); 282 } 283 return el; 284 }; 285 } 286 287 exports.default = autosize; 288 module.exports = exports['default']; 289 }); 290 291 /***/ }), 292 293 /***/ 6109: 294 /***/ ((module) => { 295 296 // This code has been refactored for 140 bytes 297 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 298 var computedStyle = function (el, prop, getComputedStyle) { 299 getComputedStyle = window.getComputedStyle; 300 301 // In one fell swoop 302 return ( 303 // If we have getComputedStyle 304 getComputedStyle ? 305 // Query it 306 // TODO: From CSS-Query notes, we might need (node, null) for FF 307 getComputedStyle(el) : 308 309 // Otherwise, we are in IE and use currentStyle 310 el.currentStyle 311 )[ 312 // Switch to camelCase for CSSOM 313 // DEV: Grabbed from jQuery 314 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 315 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 316 prop.replace(/-(\w)/gi, function (word, letter) { 317 return letter.toUpperCase(); 318 }) 319 ]; 320 }; 321 322 module.exports = computedStyle; 323 324 325 /***/ }), 326 327 /***/ 66: 328 /***/ ((module) => { 329 330 "use strict"; 331 332 333 var isMergeableObject = function isMergeableObject(value) { 334 return isNonNullObject(value) 335 && !isSpecial(value) 336 }; 337 338 function isNonNullObject(value) { 339 return !!value && typeof value === 'object' 340 } 341 342 function isSpecial(value) { 343 var stringValue = Object.prototype.toString.call(value); 344 345 return stringValue === '[object RegExp]' 346 || stringValue === '[object Date]' 347 || isReactElement(value) 348 } 349 350 // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 351 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 352 var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 353 354 function isReactElement(value) { 355 return value.$$typeof === REACT_ELEMENT_TYPE 356 } 357 358 function emptyTarget(val) { 359 return Array.isArray(val) ? [] : {} 360 } 361 362 function cloneUnlessOtherwiseSpecified(value, options) { 363 return (options.clone !== false && options.isMergeableObject(value)) 364 ? deepmerge(emptyTarget(value), value, options) 365 : value 366 } 367 368 function defaultArrayMerge(target, source, options) { 369 return target.concat(source).map(function(element) { 370 return cloneUnlessOtherwiseSpecified(element, options) 371 }) 372 } 373 374 function getMergeFunction(key, options) { 375 if (!options.customMerge) { 376 return deepmerge 377 } 378 var customMerge = options.customMerge(key); 379 return typeof customMerge === 'function' ? customMerge : deepmerge 380 } 381 382 function getEnumerableOwnPropertySymbols(target) { 383 return Object.getOwnPropertySymbols 384 ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 385 return Object.propertyIsEnumerable.call(target, symbol) 386 }) 387 : [] 388 } 389 390 function getKeys(target) { 391 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) 392 } 393 394 function propertyIsOnObject(object, property) { 395 try { 396 return property in object 397 } catch(_) { 398 return false 399 } 400 } 401 402 // Protects from prototype poisoning and unexpected merging up the prototype chain. 403 function propertyIsUnsafe(target, key) { 404 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 405 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 406 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. 407 } 408 409 function mergeObject(target, source, options) { 410 var destination = {}; 411 if (options.isMergeableObject(target)) { 412 getKeys(target).forEach(function(key) { 413 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 414 }); 415 } 416 getKeys(source).forEach(function(key) { 417 if (propertyIsUnsafe(target, key)) { 418 return 419 } 420 421 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 422 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 423 } else { 424 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 425 } 426 }); 427 return destination 428 } 429 430 function deepmerge(target, source, options) { 431 options = options || {}; 432 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 433 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 434 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 435 // implementations can use it. The caller may not replace it. 436 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 437 438 var sourceIsArray = Array.isArray(source); 439 var targetIsArray = Array.isArray(target); 440 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 441 442 if (!sourceAndTargetTypesMatch) { 443 return cloneUnlessOtherwiseSpecified(source, options) 444 } else if (sourceIsArray) { 445 return options.arrayMerge(target, source, options) 446 } else { 447 return mergeObject(target, source, options) 448 } 449 } 450 451 deepmerge.all = function deepmergeAll(array, options) { 452 if (!Array.isArray(array)) { 453 throw new Error('first argument should be an array') 454 } 455 456 return array.reduce(function(prev, next) { 457 return deepmerge(prev, next, options) 458 }, {}) 459 }; 460 461 var deepmerge_1 = deepmerge; 462 463 module.exports = deepmerge_1; 464 465 466 /***/ }), 467 468 /***/ 5215: 469 /***/ ((module) => { 470 471 "use strict"; 472 473 474 // do not edit .js files directly - edit src/index.jst 475 476 477 478 module.exports = function equal(a, b) { 479 if (a === b) return true; 480 481 if (a && b && typeof a == 'object' && typeof b == 'object') { 482 if (a.constructor !== b.constructor) return false; 483 484 var length, i, keys; 485 if (Array.isArray(a)) { 486 length = a.length; 487 if (length != b.length) return false; 488 for (i = length; i-- !== 0;) 489 if (!equal(a[i], b[i])) return false; 490 return true; 491 } 492 493 494 495 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 496 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 497 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 498 499 keys = Object.keys(a); 500 length = keys.length; 501 if (length !== Object.keys(b).length) return false; 502 503 for (i = length; i-- !== 0;) 504 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 505 506 for (i = length; i-- !== 0;) { 507 var key = keys[i]; 508 509 if (!equal(a[key], b[key])) return false; 510 } 511 512 return true; 513 } 514 515 // true if both NaN, false otherwise 516 return a!==a && b!==b; 517 }; 518 519 520 /***/ }), 521 522 /***/ 461: 523 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 524 525 // Load in dependencies 526 var computedStyle = __webpack_require__(6109); 527 528 /** 529 * Calculate the `line-height` of a given node 530 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 531 * @returns {Number} `line-height` of the element in pixels 532 */ 533 function lineHeight(node) { 534 // Grab the line-height via style 535 var lnHeightStr = computedStyle(node, 'line-height'); 536 var lnHeight = parseFloat(lnHeightStr, 10); 537 538 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 539 if (lnHeightStr === lnHeight + '') { 540 // Save the old lineHeight style and update the em unit to the element 541 var _lnHeightStyle = node.style.lineHeight; 542 node.style.lineHeight = lnHeightStr + 'em'; 543 544 // Calculate the em based height 545 lnHeightStr = computedStyle(node, 'line-height'); 546 lnHeight = parseFloat(lnHeightStr, 10); 547 548 // Revert the lineHeight style 549 if (_lnHeightStyle) { 550 node.style.lineHeight = _lnHeightStyle; 551 } else { 552 delete node.style.lineHeight; 553 } 554 } 555 556 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 557 // DEV: `em` units are converted to `pt` in IE6 558 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 559 if (lnHeightStr.indexOf('pt') !== -1) { 560 lnHeight *= 4; 561 lnHeight /= 3; 562 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 563 } else if (lnHeightStr.indexOf('mm') !== -1) { 564 lnHeight *= 96; 565 lnHeight /= 25.4; 566 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 567 } else if (lnHeightStr.indexOf('cm') !== -1) { 568 lnHeight *= 96; 569 lnHeight /= 2.54; 570 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 571 } else if (lnHeightStr.indexOf('in') !== -1) { 572 lnHeight *= 96; 573 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 574 } else if (lnHeightStr.indexOf('pc') !== -1) { 575 lnHeight *= 16; 576 } 577 578 // Continue our computation 579 lnHeight = Math.round(lnHeight); 580 581 // If the line-height is "normal", calculate by font-size 582 if (lnHeightStr === 'normal') { 583 // Create a temporary node 584 var nodeName = node.nodeName; 585 var _node = document.createElement(nodeName); 586 _node.innerHTML = ' '; 587 588 // If we have a text area, reset it to only 1 row 589 // https://github.com/twolfson/line-height/issues/4 590 if (nodeName.toUpperCase() === 'TEXTAREA') { 591 _node.setAttribute('rows', '1'); 592 } 593 594 // Set the font-size of the element 595 var fontSizeStr = computedStyle(node, 'font-size'); 596 _node.style.fontSize = fontSizeStr; 597 598 // Remove default padding/border which can affect offset height 599 // https://github.com/twolfson/line-height/issues/4 600 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 601 _node.style.padding = '0px'; 602 _node.style.border = '0px'; 603 604 // Append it to the body 605 var body = document.body; 606 body.appendChild(_node); 607 608 // Assume the line height of the element is the height 609 var height = _node.offsetHeight; 610 lnHeight = height; 611 612 // Remove our child from the DOM 613 body.removeChild(_node); 614 } 615 616 // Return the calculated height 617 return lnHeight; 618 } 619 620 // Export lineHeight 621 module.exports = lineHeight; 622 623 624 /***/ }), 625 626 /***/ 628: 627 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 628 629 "use strict"; 630 /** 631 * Copyright (c) 2013-present, Facebook, Inc. 632 * 633 * This source code is licensed under the MIT license found in the 634 * LICENSE file in the root directory of this source tree. 635 */ 636 637 638 639 var ReactPropTypesSecret = __webpack_require__(4067); 640 641 function emptyFunction() {} 642 function emptyFunctionWithReset() {} 643 emptyFunctionWithReset.resetWarningCache = emptyFunction; 644 645 module.exports = function() { 646 function shim(props, propName, componentName, location, propFullName, secret) { 647 if (secret === ReactPropTypesSecret) { 648 // It is still safe when called from React. 649 return; 650 } 651 var err = new Error( 652 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 653 'Use PropTypes.checkPropTypes() to call them. ' + 654 'Read more at http://fb.me/use-check-prop-types' 655 ); 656 err.name = 'Invariant Violation'; 657 throw err; 658 }; 659 shim.isRequired = shim; 660 function getShim() { 661 return shim; 662 }; 663 // Important! 664 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 665 var ReactPropTypes = { 666 array: shim, 667 bigint: shim, 668 bool: shim, 669 func: shim, 670 number: shim, 671 object: shim, 672 string: shim, 673 symbol: shim, 674 675 any: shim, 676 arrayOf: getShim, 677 element: shim, 678 elementType: shim, 679 instanceOf: getShim, 680 node: shim, 681 objectOf: getShim, 682 oneOf: getShim, 683 oneOfType: getShim, 684 shape: getShim, 685 exact: getShim, 686 687 checkPropTypes: emptyFunctionWithReset, 688 resetWarningCache: emptyFunction 689 }; 690 691 ReactPropTypes.PropTypes = ReactPropTypes; 692 693 return ReactPropTypes; 694 }; 695 696 697 /***/ }), 698 699 /***/ 5826: 700 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 701 702 /** 703 * Copyright (c) 2013-present, Facebook, Inc. 704 * 705 * This source code is licensed under the MIT license found in the 706 * LICENSE file in the root directory of this source tree. 707 */ 708 709 if (false) { var throwOnDirectAccess, ReactIs; } else { 710 // By explicitly using `prop-types` you are opting into new production behavior. 711 // http://fb.me/prop-types-in-prod 712 module.exports = __webpack_require__(628)(); 713 } 714 715 716 /***/ }), 717 718 /***/ 4067: 719 /***/ ((module) => { 720 721 "use strict"; 722 /** 723 * Copyright (c) 2013-present, Facebook, Inc. 724 * 725 * This source code is licensed under the MIT license found in the 726 * LICENSE file in the root directory of this source tree. 727 */ 728 729 730 731 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 732 733 module.exports = ReactPropTypesSecret; 734 735 736 /***/ }), 737 738 /***/ 4462: 739 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 740 741 "use strict"; 742 743 var __extends = (this && this.__extends) || (function () { 744 var extendStatics = Object.setPrototypeOf || 745 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 746 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 747 return function (d, b) { 748 extendStatics(d, b); 749 function __() { this.constructor = d; } 750 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 751 }; 752 })(); 753 var __assign = (this && this.__assign) || Object.assign || function(t) { 754 for (var s, i = 1, n = arguments.length; i < n; i++) { 755 s = arguments[i]; 756 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 757 t[p] = s[p]; 758 } 759 return t; 760 }; 761 var __rest = (this && this.__rest) || function (s, e) { 762 var t = {}; 763 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 764 t[p] = s[p]; 765 if (s != null && typeof Object.getOwnPropertySymbols === "function") 766 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 767 t[p[i]] = s[p[i]]; 768 return t; 769 }; 770 exports.__esModule = true; 771 var React = __webpack_require__(1609); 772 var PropTypes = __webpack_require__(5826); 773 var autosize = __webpack_require__(4306); 774 var _getLineHeight = __webpack_require__(461); 775 var getLineHeight = _getLineHeight; 776 var RESIZED = "autosize:resized"; 777 /** 778 * A light replacement for built-in textarea component 779 * which automaticaly adjusts its height to match the content 780 */ 781 var TextareaAutosizeClass = /** @class */ (function (_super) { 782 __extends(TextareaAutosizeClass, _super); 783 function TextareaAutosizeClass() { 784 var _this = _super !== null && _super.apply(this, arguments) || this; 785 _this.state = { 786 lineHeight: null 787 }; 788 _this.textarea = null; 789 _this.onResize = function (e) { 790 if (_this.props.onResize) { 791 _this.props.onResize(e); 792 } 793 }; 794 _this.updateLineHeight = function () { 795 if (_this.textarea) { 796 _this.setState({ 797 lineHeight: getLineHeight(_this.textarea) 798 }); 799 } 800 }; 801 _this.onChange = function (e) { 802 var onChange = _this.props.onChange; 803 _this.currentValue = e.currentTarget.value; 804 onChange && onChange(e); 805 }; 806 return _this; 807 } 808 TextareaAutosizeClass.prototype.componentDidMount = function () { 809 var _this = this; 810 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 811 if (typeof maxRows === "number") { 812 this.updateLineHeight(); 813 } 814 if (typeof maxRows === "number" || async) { 815 /* 816 the defer is needed to: 817 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 818 - support StyledComponents (see #71) 819 */ 820 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 821 } 822 else { 823 this.textarea && autosize(this.textarea); 824 } 825 if (this.textarea) { 826 this.textarea.addEventListener(RESIZED, this.onResize); 827 } 828 }; 829 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 830 if (this.textarea) { 831 this.textarea.removeEventListener(RESIZED, this.onResize); 832 autosize.destroy(this.textarea); 833 } 834 }; 835 TextareaAutosizeClass.prototype.render = function () { 836 var _this = this; 837 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; 838 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 839 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 840 _this.textarea = element; 841 if (typeof _this.props.innerRef === 'function') { 842 _this.props.innerRef(element); 843 } 844 else if (_this.props.innerRef) { 845 _this.props.innerRef.current = element; 846 } 847 } }), children)); 848 }; 849 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 850 this.textarea && autosize.update(this.textarea); 851 }; 852 TextareaAutosizeClass.defaultProps = { 853 rows: 1, 854 async: false 855 }; 856 TextareaAutosizeClass.propTypes = { 857 rows: PropTypes.number, 858 maxRows: PropTypes.number, 859 onResize: PropTypes.func, 860 innerRef: PropTypes.any, 861 async: PropTypes.bool 862 }; 863 return TextareaAutosizeClass; 864 }(React.Component)); 865 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 866 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 867 }); 868 869 870 /***/ }), 871 872 /***/ 4132: 873 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 874 875 "use strict"; 876 var __webpack_unused_export__; 877 878 __webpack_unused_export__ = true; 879 var TextareaAutosize_1 = __webpack_require__(4462); 880 exports.A = TextareaAutosize_1.TextareaAutosize; 881 882 883 /***/ }), 884 885 /***/ 9681: 886 /***/ ((module) => { 887 888 var characterMap = { 889 "À": "A", 890 "Á": "A", 891 "Â": "A", 892 "Ã": "A", 893 "Ä": "A", 894 "Å": "A", 895 "Ấ": "A", 896 "Ắ": "A", 897 "Ẳ": "A", 898 "Ẵ": "A", 899 "Ặ": "A", 900 "Æ": "AE", 901 "Ầ": "A", 902 "Ằ": "A", 903 "Ȃ": "A", 904 "Ả": "A", 905 "Ạ": "A", 906 "Ẩ": "A", 907 "Ẫ": "A", 908 "Ậ": "A", 909 "Ç": "C", 910 "Ḉ": "C", 911 "È": "E", 912 "É": "E", 913 "Ê": "E", 914 "Ë": "E", 915 "Ế": "E", 916 "Ḗ": "E", 917 "Ề": "E", 918 "Ḕ": "E", 919 "Ḝ": "E", 920 "Ȇ": "E", 921 "Ẻ": "E", 922 "Ẽ": "E", 923 "Ẹ": "E", 924 "Ể": "E", 925 "Ễ": "E", 926 "Ệ": "E", 927 "Ì": "I", 928 "Í": "I", 929 "Î": "I", 930 "Ï": "I", 931 "Ḯ": "I", 932 "Ȋ": "I", 933 "Ỉ": "I", 934 "Ị": "I", 935 "Ð": "D", 936 "Ñ": "N", 937 "Ò": "O", 938 "Ó": "O", 939 "Ô": "O", 940 "Õ": "O", 941 "Ö": "O", 942 "Ø": "O", 943 "Ố": "O", 944 "Ṍ": "O", 945 "Ṓ": "O", 946 "Ȏ": "O", 947 "Ỏ": "O", 948 "Ọ": "O", 949 "Ổ": "O", 950 "Ỗ": "O", 951 "Ộ": "O", 952 "Ờ": "O", 953 "Ở": "O", 954 "Ỡ": "O", 955 "Ớ": "O", 956 "Ợ": "O", 957 "Ù": "U", 958 "Ú": "U", 959 "Û": "U", 960 "Ü": "U", 961 "Ủ": "U", 962 "Ụ": "U", 963 "Ử": "U", 964 "Ữ": "U", 965 "Ự": "U", 966 "Ý": "Y", 967 "à": "a", 968 "á": "a", 969 "â": "a", 970 "ã": "a", 971 "ä": "a", 972 "å": "a", 973 "ấ": "a", 974 "ắ": "a", 975 "ẳ": "a", 976 "ẵ": "a", 977 "ặ": "a", 978 "æ": "ae", 979 "ầ": "a", 980 "ằ": "a", 981 "ȃ": "a", 982 "ả": "a", 983 "ạ": "a", 984 "ẩ": "a", 985 "ẫ": "a", 986 "ậ": "a", 987 "ç": "c", 988 "ḉ": "c", 989 "è": "e", 990 "é": "e", 991 "ê": "e", 992 "ë": "e", 993 "ế": "e", 994 "ḗ": "e", 995 "ề": "e", 996 "ḕ": "e", 997 "ḝ": "e", 998 "ȇ": "e", 999 "ẻ": "e", 1000 "ẽ": "e", 1001 "ẹ": "e", 1002 "ể": "e", 1003 "ễ": "e", 1004 "ệ": "e", 1005 "ì": "i", 1006 "í": "i", 1007 "î": "i", 1008 "ï": "i", 1009 "ḯ": "i", 1010 "ȋ": "i", 1011 "ỉ": "i", 1012 "ị": "i", 1013 "ð": "d", 1014 "ñ": "n", 1015 "ò": "o", 1016 "ó": "o", 1017 "ô": "o", 1018 "õ": "o", 1019 "ö": "o", 1020 "ø": "o", 1021 "ố": "o", 1022 "ṍ": "o", 1023 "ṓ": "o", 1024 "ȏ": "o", 1025 "ỏ": "o", 1026 "ọ": "o", 1027 "ổ": "o", 1028 "ỗ": "o", 1029 "ộ": "o", 1030 "ờ": "o", 1031 "ở": "o", 1032 "ỡ": "o", 1033 "ớ": "o", 1034 "ợ": "o", 1035 "ù": "u", 1036 "ú": "u", 1037 "û": "u", 1038 "ü": "u", 1039 "ủ": "u", 1040 "ụ": "u", 1041 "ử": "u", 1042 "ữ": "u", 1043 "ự": "u", 1044 "ý": "y", 1045 "ÿ": "y", 1046 "Ā": "A", 1047 "ā": "a", 1048 "Ă": "A", 1049 "ă": "a", 1050 "Ą": "A", 1051 "ą": "a", 1052 "Ć": "C", 1053 "ć": "c", 1054 "Ĉ": "C", 1055 "ĉ": "c", 1056 "Ċ": "C", 1057 "ċ": "c", 1058 "Č": "C", 1059 "č": "c", 1060 "C̆": "C", 1061 "c̆": "c", 1062 "Ď": "D", 1063 "ď": "d", 1064 "Đ": "D", 1065 "đ": "d", 1066 "Ē": "E", 1067 "ē": "e", 1068 "Ĕ": "E", 1069 "ĕ": "e", 1070 "Ė": "E", 1071 "ė": "e", 1072 "Ę": "E", 1073 "ę": "e", 1074 "Ě": "E", 1075 "ě": "e", 1076 "Ĝ": "G", 1077 "Ǵ": "G", 1078 "ĝ": "g", 1079 "ǵ": "g", 1080 "Ğ": "G", 1081 "ğ": "g", 1082 "Ġ": "G", 1083 "ġ": "g", 1084 "Ģ": "G", 1085 "ģ": "g", 1086 "Ĥ": "H", 1087 "ĥ": "h", 1088 "Ħ": "H", 1089 "ħ": "h", 1090 "Ḫ": "H", 1091 "ḫ": "h", 1092 "Ĩ": "I", 1093 "ĩ": "i", 1094 "Ī": "I", 1095 "ī": "i", 1096 "Ĭ": "I", 1097 "ĭ": "i", 1098 "Į": "I", 1099 "į": "i", 1100 "İ": "I", 1101 "ı": "i", 1102 "IJ": "IJ", 1103 "ij": "ij", 1104 "Ĵ": "J", 1105 "ĵ": "j", 1106 "Ķ": "K", 1107 "ķ": "k", 1108 "Ḱ": "K", 1109 "ḱ": "k", 1110 "K̆": "K", 1111 "k̆": "k", 1112 "Ĺ": "L", 1113 "ĺ": "l", 1114 "Ļ": "L", 1115 "ļ": "l", 1116 "Ľ": "L", 1117 "ľ": "l", 1118 "Ŀ": "L", 1119 "ŀ": "l", 1120 "Ł": "l", 1121 "ł": "l", 1122 "Ḿ": "M", 1123 "ḿ": "m", 1124 "M̆": "M", 1125 "m̆": "m", 1126 "Ń": "N", 1127 "ń": "n", 1128 "Ņ": "N", 1129 "ņ": "n", 1130 "Ň": "N", 1131 "ň": "n", 1132 "ʼn": "n", 1133 "N̆": "N", 1134 "n̆": "n", 1135 "Ō": "O", 1136 "ō": "o", 1137 "Ŏ": "O", 1138 "ŏ": "o", 1139 "Ő": "O", 1140 "ő": "o", 1141 "Œ": "OE", 1142 "œ": "oe", 1143 "P̆": "P", 1144 "p̆": "p", 1145 "Ŕ": "R", 1146 "ŕ": "r", 1147 "Ŗ": "R", 1148 "ŗ": "r", 1149 "Ř": "R", 1150 "ř": "r", 1151 "R̆": "R", 1152 "r̆": "r", 1153 "Ȓ": "R", 1154 "ȓ": "r", 1155 "Ś": "S", 1156 "ś": "s", 1157 "Ŝ": "S", 1158 "ŝ": "s", 1159 "Ş": "S", 1160 "Ș": "S", 1161 "ș": "s", 1162 "ş": "s", 1163 "Š": "S", 1164 "š": "s", 1165 "Ţ": "T", 1166 "ţ": "t", 1167 "ț": "t", 1168 "Ț": "T", 1169 "Ť": "T", 1170 "ť": "t", 1171 "Ŧ": "T", 1172 "ŧ": "t", 1173 "T̆": "T", 1174 "t̆": "t", 1175 "Ũ": "U", 1176 "ũ": "u", 1177 "Ū": "U", 1178 "ū": "u", 1179 "Ŭ": "U", 1180 "ŭ": "u", 1181 "Ů": "U", 1182 "ů": "u", 1183 "Ű": "U", 1184 "ű": "u", 1185 "Ų": "U", 1186 "ų": "u", 1187 "Ȗ": "U", 1188 "ȗ": "u", 1189 "V̆": "V", 1190 "v̆": "v", 1191 "Ŵ": "W", 1192 "ŵ": "w", 1193 "Ẃ": "W", 1194 "ẃ": "w", 1195 "X̆": "X", 1196 "x̆": "x", 1197 "Ŷ": "Y", 1198 "ŷ": "y", 1199 "Ÿ": "Y", 1200 "Y̆": "Y", 1201 "y̆": "y", 1202 "Ź": "Z", 1203 "ź": "z", 1204 "Ż": "Z", 1205 "ż": "z", 1206 "Ž": "Z", 1207 "ž": "z", 1208 "ſ": "s", 1209 "ƒ": "f", 1210 "Ơ": "O", 1211 "ơ": "o", 1212 "Ư": "U", 1213 "ư": "u", 1214 "Ǎ": "A", 1215 "ǎ": "a", 1216 "Ǐ": "I", 1217 "ǐ": "i", 1218 "Ǒ": "O", 1219 "ǒ": "o", 1220 "Ǔ": "U", 1221 "ǔ": "u", 1222 "Ǖ": "U", 1223 "ǖ": "u", 1224 "Ǘ": "U", 1225 "ǘ": "u", 1226 "Ǚ": "U", 1227 "ǚ": "u", 1228 "Ǜ": "U", 1229 "ǜ": "u", 1230 "Ứ": "U", 1231 "ứ": "u", 1232 "Ṹ": "U", 1233 "ṹ": "u", 1234 "Ǻ": "A", 1235 "ǻ": "a", 1236 "Ǽ": "AE", 1237 "ǽ": "ae", 1238 "Ǿ": "O", 1239 "ǿ": "o", 1240 "Þ": "TH", 1241 "þ": "th", 1242 "Ṕ": "P", 1243 "ṕ": "p", 1244 "Ṥ": "S", 1245 "ṥ": "s", 1246 "X́": "X", 1247 "x́": "x", 1248 "Ѓ": "Г", 1249 "ѓ": "г", 1250 "Ќ": "К", 1251 "ќ": "к", 1252 "A̋": "A", 1253 "a̋": "a", 1254 "E̋": "E", 1255 "e̋": "e", 1256 "I̋": "I", 1257 "i̋": "i", 1258 "Ǹ": "N", 1259 "ǹ": "n", 1260 "Ồ": "O", 1261 "ồ": "o", 1262 "Ṑ": "O", 1263 "ṑ": "o", 1264 "Ừ": "U", 1265 "ừ": "u", 1266 "Ẁ": "W", 1267 "ẁ": "w", 1268 "Ỳ": "Y", 1269 "ỳ": "y", 1270 "Ȁ": "A", 1271 "ȁ": "a", 1272 "Ȅ": "E", 1273 "ȅ": "e", 1274 "Ȉ": "I", 1275 "ȉ": "i", 1276 "Ȍ": "O", 1277 "ȍ": "o", 1278 "Ȑ": "R", 1279 "ȑ": "r", 1280 "Ȕ": "U", 1281 "ȕ": "u", 1282 "B̌": "B", 1283 "b̌": "b", 1284 "Č̣": "C", 1285 "č̣": "c", 1286 "Ê̌": "E", 1287 "ê̌": "e", 1288 "F̌": "F", 1289 "f̌": "f", 1290 "Ǧ": "G", 1291 "ǧ": "g", 1292 "Ȟ": "H", 1293 "ȟ": "h", 1294 "J̌": "J", 1295 "ǰ": "j", 1296 "Ǩ": "K", 1297 "ǩ": "k", 1298 "M̌": "M", 1299 "m̌": "m", 1300 "P̌": "P", 1301 "p̌": "p", 1302 "Q̌": "Q", 1303 "q̌": "q", 1304 "Ř̩": "R", 1305 "ř̩": "r", 1306 "Ṧ": "S", 1307 "ṧ": "s", 1308 "V̌": "V", 1309 "v̌": "v", 1310 "W̌": "W", 1311 "w̌": "w", 1312 "X̌": "X", 1313 "x̌": "x", 1314 "Y̌": "Y", 1315 "y̌": "y", 1316 "A̧": "A", 1317 "a̧": "a", 1318 "B̧": "B", 1319 "b̧": "b", 1320 "Ḑ": "D", 1321 "ḑ": "d", 1322 "Ȩ": "E", 1323 "ȩ": "e", 1324 "Ɛ̧": "E", 1325 "ɛ̧": "e", 1326 "Ḩ": "H", 1327 "ḩ": "h", 1328 "I̧": "I", 1329 "i̧": "i", 1330 "Ɨ̧": "I", 1331 "ɨ̧": "i", 1332 "M̧": "M", 1333 "m̧": "m", 1334 "O̧": "O", 1335 "o̧": "o", 1336 "Q̧": "Q", 1337 "q̧": "q", 1338 "U̧": "U", 1339 "u̧": "u", 1340 "X̧": "X", 1341 "x̧": "x", 1342 "Z̧": "Z", 1343 "z̧": "z", 1344 "й":"и", 1345 "Й":"И", 1346 "ё":"е", 1347 "Ё":"Е", 1348 }; 1349 1350 var chars = Object.keys(characterMap).join('|'); 1351 var allAccents = new RegExp(chars, 'g'); 1352 var firstAccent = new RegExp(chars, ''); 1353 1354 function matcher(match) { 1355 return characterMap[match]; 1356 } 1357 1358 var removeAccents = function(string) { 1359 return string.replace(allAccents, matcher); 1360 }; 1361 1362 var hasAccents = function(string) { 1363 return !!string.match(firstAccent); 1364 }; 1365 1366 module.exports = removeAccents; 1367 module.exports.has = hasAccents; 1368 module.exports.remove = removeAccents; 1369 1370 1371 /***/ }), 1372 1373 /***/ 1609: 1374 /***/ ((module) => { 1375 1376 "use strict"; 1377 module.exports = window["React"]; 1378 1379 /***/ }) 1380 1381 /******/ }); 1382 /************************************************************************/ 1383 /******/ // The module cache 1384 /******/ var __webpack_module_cache__ = {}; 1385 /******/ 1386 /******/ // The require function 1387 /******/ function __webpack_require__(moduleId) { 1388 /******/ // Check if module is in cache 1389 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 1390 /******/ if (cachedModule !== undefined) { 1391 /******/ return cachedModule.exports; 1392 /******/ } 1393 /******/ // Create a new module (and put it into the cache) 1394 /******/ var module = __webpack_module_cache__[moduleId] = { 1395 /******/ // no module.id needed 1396 /******/ // no module.loaded needed 1397 /******/ exports: {} 1398 /******/ }; 1399 /******/ 1400 /******/ // Execute the module function 1401 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1402 /******/ 1403 /******/ // Return the exports of the module 1404 /******/ return module.exports; 1405 /******/ } 1406 /******/ 1407 /************************************************************************/ 1408 /******/ /* webpack/runtime/compat get default export */ 1409 /******/ (() => { 1410 /******/ // getDefaultExport function for compatibility with non-harmony modules 1411 /******/ __webpack_require__.n = (module) => { 1412 /******/ var getter = module && module.__esModule ? 1413 /******/ () => (module['default']) : 1414 /******/ () => (module); 1415 /******/ __webpack_require__.d(getter, { a: getter }); 1416 /******/ return getter; 1417 /******/ }; 1418 /******/ })(); 1419 /******/ 1420 /******/ /* webpack/runtime/define property getters */ 1421 /******/ (() => { 1422 /******/ // define getter functions for harmony exports 1423 /******/ __webpack_require__.d = (exports, definition) => { 1424 /******/ for(var key in definition) { 1425 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1426 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1427 /******/ } 1428 /******/ } 1429 /******/ }; 1430 /******/ })(); 1431 /******/ 1432 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 1433 /******/ (() => { 1434 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 1435 /******/ })(); 1436 /******/ 1437 /******/ /* webpack/runtime/make namespace object */ 1438 /******/ (() => { 1439 /******/ // define __esModule on exports 1440 /******/ __webpack_require__.r = (exports) => { 1441 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1442 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1443 /******/ } 1444 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 1445 /******/ }; 1446 /******/ })(); 1447 /******/ 1448 /************************************************************************/ 1449 var __webpack_exports__ = {}; 1450 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 1451 (() => { 1452 "use strict"; 1453 // ESM COMPAT FLAG 1454 __webpack_require__.r(__webpack_exports__); 1455 1456 // EXPORTS 1457 __webpack_require__.d(__webpack_exports__, { 1458 AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), 1459 Autocomplete: () => (/* reexport */ Autocomplete), 1460 AutosaveMonitor: () => (/* reexport */ autosave_monitor), 1461 BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), 1462 BlockControls: () => (/* reexport */ BlockControls), 1463 BlockEdit: () => (/* reexport */ BlockEdit), 1464 BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts), 1465 BlockFormatControls: () => (/* reexport */ BlockFormatControls), 1466 BlockIcon: () => (/* reexport */ BlockIcon), 1467 BlockInspector: () => (/* reexport */ BlockInspector), 1468 BlockList: () => (/* reexport */ BlockList), 1469 BlockMover: () => (/* reexport */ BlockMover), 1470 BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown), 1471 BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), 1472 BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu), 1473 BlockTitle: () => (/* reexport */ BlockTitle), 1474 BlockToolbar: () => (/* reexport */ BlockToolbar), 1475 CharacterCount: () => (/* reexport */ CharacterCount), 1476 ColorPalette: () => (/* reexport */ ColorPalette), 1477 ContrastChecker: () => (/* reexport */ ContrastChecker), 1478 CopyHandler: () => (/* reexport */ CopyHandler), 1479 DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), 1480 DocumentBar: () => (/* reexport */ DocumentBar), 1481 DocumentOutline: () => (/* reexport */ DocumentOutline), 1482 DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck), 1483 EditorHistoryRedo: () => (/* reexport */ editor_history_redo), 1484 EditorHistoryUndo: () => (/* reexport */ editor_history_undo), 1485 EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts), 1486 EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts), 1487 EditorNotices: () => (/* reexport */ editor_notices), 1488 EditorProvider: () => (/* reexport */ provider), 1489 EditorSnackbars: () => (/* reexport */ EditorSnackbars), 1490 EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates), 1491 ErrorBoundary: () => (/* reexport */ error_boundary), 1492 FontSizePicker: () => (/* reexport */ FontSizePicker), 1493 InnerBlocks: () => (/* reexport */ InnerBlocks), 1494 Inserter: () => (/* reexport */ Inserter), 1495 InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), 1496 InspectorControls: () => (/* reexport */ InspectorControls), 1497 LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor), 1498 MediaPlaceholder: () => (/* reexport */ MediaPlaceholder), 1499 MediaUpload: () => (/* reexport */ MediaUpload), 1500 MediaUploadCheck: () => (/* reexport */ MediaUploadCheck), 1501 MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), 1502 NavigableToolbar: () => (/* reexport */ NavigableToolbar), 1503 ObserveTyping: () => (/* reexport */ ObserveTyping), 1504 PageAttributesCheck: () => (/* reexport */ page_attributes_check), 1505 PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks), 1506 PageAttributesPanel: () => (/* reexport */ PageAttributesPanel), 1507 PageAttributesParent: () => (/* reexport */ page_attributes_parent), 1508 PageTemplate: () => (/* reexport */ classic_theme), 1509 PanelColorSettings: () => (/* reexport */ PanelColorSettings), 1510 PlainText: () => (/* reexport */ PlainText), 1511 PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item), 1512 PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel), 1513 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 1514 PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), 1515 PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), 1516 PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), 1517 PluginPreviewMenuItem: () => (/* reexport */ PluginPreviewMenuItem), 1518 PluginSidebar: () => (/* reexport */ PluginSidebar), 1519 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 1520 PostAuthor: () => (/* reexport */ post_author), 1521 PostAuthorCheck: () => (/* reexport */ PostAuthorCheck), 1522 PostAuthorPanel: () => (/* reexport */ panel), 1523 PostComments: () => (/* reexport */ post_comments), 1524 PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel), 1525 PostExcerpt: () => (/* reexport */ PostExcerpt), 1526 PostExcerptCheck: () => (/* reexport */ post_excerpt_check), 1527 PostExcerptPanel: () => (/* reexport */ PostExcerptPanel), 1528 PostFeaturedImage: () => (/* reexport */ post_featured_image), 1529 PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check), 1530 PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel), 1531 PostFormat: () => (/* reexport */ PostFormat), 1532 PostFormatCheck: () => (/* reexport */ PostFormatCheck), 1533 PostLastRevision: () => (/* reexport */ post_last_revision), 1534 PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check), 1535 PostLastRevisionPanel: () => (/* reexport */ post_last_revision_panel), 1536 PostLockedModal: () => (/* reexport */ PostLockedModal), 1537 PostPendingStatus: () => (/* reexport */ post_pending_status), 1538 PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check), 1539 PostPingbacks: () => (/* reexport */ post_pingbacks), 1540 PostPreviewButton: () => (/* reexport */ PostPreviewButton), 1541 PostPublishButton: () => (/* reexport */ post_publish_button), 1542 PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel), 1543 PostPublishPanel: () => (/* reexport */ post_publish_panel), 1544 PostSavedState: () => (/* reexport */ PostSavedState), 1545 PostSchedule: () => (/* reexport */ PostSchedule), 1546 PostScheduleCheck: () => (/* reexport */ PostScheduleCheck), 1547 PostScheduleLabel: () => (/* reexport */ PostScheduleLabel), 1548 PostSchedulePanel: () => (/* reexport */ PostSchedulePanel), 1549 PostSticky: () => (/* reexport */ PostSticky), 1550 PostStickyCheck: () => (/* reexport */ PostStickyCheck), 1551 PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), 1552 PostSyncStatus: () => (/* reexport */ PostSyncStatus), 1553 PostTaxonomies: () => (/* reexport */ post_taxonomies), 1554 PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), 1555 PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), 1556 PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), 1557 PostTaxonomiesPanel: () => (/* reexport */ panel_PostTaxonomies), 1558 PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), 1559 PostTextEditor: () => (/* reexport */ PostTextEditor), 1560 PostTitle: () => (/* reexport */ post_title), 1561 PostTitleRaw: () => (/* reexport */ post_title_raw), 1562 PostTrash: () => (/* reexport */ PostTrash), 1563 PostTrashCheck: () => (/* reexport */ PostTrashCheck), 1564 PostTypeSupportCheck: () => (/* reexport */ post_type_support_check), 1565 PostURL: () => (/* reexport */ PostURL), 1566 PostURLCheck: () => (/* reexport */ PostURLCheck), 1567 PostURLLabel: () => (/* reexport */ PostURLLabel), 1568 PostURLPanel: () => (/* reexport */ PostURLPanel), 1569 PostVisibility: () => (/* reexport */ PostVisibility), 1570 PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), 1571 PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), 1572 RichText: () => (/* reexport */ RichText), 1573 RichTextShortcut: () => (/* reexport */ RichTextShortcut), 1574 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), 1575 ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), 1576 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), 1577 TableOfContents: () => (/* reexport */ table_of_contents), 1578 TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), 1579 ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), 1580 TimeToRead: () => (/* reexport */ TimeToRead), 1581 URLInput: () => (/* reexport */ URLInput), 1582 URLInputButton: () => (/* reexport */ URLInputButton), 1583 URLPopover: () => (/* reexport */ URLPopover), 1584 UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), 1585 VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), 1586 Warning: () => (/* reexport */ Warning), 1587 WordCount: () => (/* reexport */ WordCount), 1588 WritingFlow: () => (/* reexport */ WritingFlow), 1589 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), 1590 cleanForSlug: () => (/* reexport */ cleanForSlug), 1591 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), 1592 getColorClassName: () => (/* reexport */ getColorClassName), 1593 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), 1594 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), 1595 getFontSize: () => (/* reexport */ getFontSize), 1596 getFontSizeClass: () => (/* reexport */ getFontSizeClass), 1597 getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), 1598 mediaUpload: () => (/* reexport */ mediaUpload), 1599 privateApis: () => (/* reexport */ privateApis), 1600 registerEntityAction: () => (/* reexport */ api_registerEntityAction), 1601 registerEntityField: () => (/* reexport */ api_registerEntityField), 1602 store: () => (/* reexport */ store_store), 1603 storeConfig: () => (/* reexport */ storeConfig), 1604 transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), 1605 unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction), 1606 unregisterEntityField: () => (/* reexport */ api_unregisterEntityField), 1607 useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty), 1608 usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel), 1609 usePostURLLabel: () => (/* reexport */ usePostURLLabel), 1610 usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel), 1611 userAutocompleter: () => (/* reexport */ user), 1612 withColorContext: () => (/* reexport */ withColorContext), 1613 withColors: () => (/* reexport */ withColors), 1614 withFontSizes: () => (/* reexport */ withFontSizes) 1615 }); 1616 1617 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js 1618 var selectors_namespaceObject = {}; 1619 __webpack_require__.r(selectors_namespaceObject); 1620 __webpack_require__.d(selectors_namespaceObject, { 1621 __experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas), 1622 __experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType), 1623 __experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes), 1624 __experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo), 1625 __unstableIsEditorReady: () => (__unstableIsEditorReady), 1626 canInsertBlockType: () => (canInsertBlockType), 1627 canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML), 1628 didPostSaveRequestFail: () => (didPostSaveRequestFail), 1629 didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed), 1630 getActivePostLock: () => (getActivePostLock), 1631 getAdjacentBlockClientId: () => (getAdjacentBlockClientId), 1632 getAutosaveAttribute: () => (getAutosaveAttribute), 1633 getBlock: () => (getBlock), 1634 getBlockAttributes: () => (getBlockAttributes), 1635 getBlockCount: () => (getBlockCount), 1636 getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), 1637 getBlockIndex: () => (getBlockIndex), 1638 getBlockInsertionPoint: () => (getBlockInsertionPoint), 1639 getBlockListSettings: () => (getBlockListSettings), 1640 getBlockMode: () => (getBlockMode), 1641 getBlockName: () => (getBlockName), 1642 getBlockOrder: () => (getBlockOrder), 1643 getBlockRootClientId: () => (getBlockRootClientId), 1644 getBlockSelectionEnd: () => (getBlockSelectionEnd), 1645 getBlockSelectionStart: () => (getBlockSelectionStart), 1646 getBlocks: () => (getBlocks), 1647 getBlocksByClientId: () => (getBlocksByClientId), 1648 getClientIdsOfDescendants: () => (getClientIdsOfDescendants), 1649 getClientIdsWithDescendants: () => (getClientIdsWithDescendants), 1650 getCurrentPost: () => (getCurrentPost), 1651 getCurrentPostAttribute: () => (getCurrentPostAttribute), 1652 getCurrentPostId: () => (getCurrentPostId), 1653 getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId), 1654 getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount), 1655 getCurrentPostType: () => (getCurrentPostType), 1656 getCurrentTemplateId: () => (getCurrentTemplateId), 1657 getDeviceType: () => (getDeviceType), 1658 getEditedPostAttribute: () => (getEditedPostAttribute), 1659 getEditedPostContent: () => (getEditedPostContent), 1660 getEditedPostPreviewLink: () => (getEditedPostPreviewLink), 1661 getEditedPostSlug: () => (getEditedPostSlug), 1662 getEditedPostVisibility: () => (getEditedPostVisibility), 1663 getEditorBlocks: () => (getEditorBlocks), 1664 getEditorMode: () => (getEditorMode), 1665 getEditorSelection: () => (getEditorSelection), 1666 getEditorSelectionEnd: () => (getEditorSelectionEnd), 1667 getEditorSelectionStart: () => (getEditorSelectionStart), 1668 getEditorSettings: () => (getEditorSettings), 1669 getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), 1670 getGlobalBlockCount: () => (getGlobalBlockCount), 1671 getInserterItems: () => (getInserterItems), 1672 getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), 1673 getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), 1674 getMultiSelectedBlocks: () => (getMultiSelectedBlocks), 1675 getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), 1676 getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), 1677 getNextBlockClientId: () => (getNextBlockClientId), 1678 getPermalink: () => (getPermalink), 1679 getPermalinkParts: () => (getPermalinkParts), 1680 getPostEdits: () => (getPostEdits), 1681 getPostLockUser: () => (getPostLockUser), 1682 getPostTypeLabel: () => (getPostTypeLabel), 1683 getPreviousBlockClientId: () => (getPreviousBlockClientId), 1684 getRenderingMode: () => (getRenderingMode), 1685 getSelectedBlock: () => (getSelectedBlock), 1686 getSelectedBlockClientId: () => (getSelectedBlockClientId), 1687 getSelectedBlockCount: () => (getSelectedBlockCount), 1688 getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), 1689 getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction), 1690 getSuggestedPostFormat: () => (getSuggestedPostFormat), 1691 getTemplate: () => (getTemplate), 1692 getTemplateLock: () => (getTemplateLock), 1693 hasChangedContent: () => (hasChangedContent), 1694 hasEditorRedo: () => (hasEditorRedo), 1695 hasEditorUndo: () => (hasEditorUndo), 1696 hasInserterItems: () => (hasInserterItems), 1697 hasMultiSelection: () => (hasMultiSelection), 1698 hasNonPostEntityChanges: () => (hasNonPostEntityChanges), 1699 hasSelectedBlock: () => (hasSelectedBlock), 1700 hasSelectedInnerBlock: () => (hasSelectedInnerBlock), 1701 inSomeHistory: () => (inSomeHistory), 1702 isAncestorMultiSelected: () => (isAncestorMultiSelected), 1703 isAutosavingPost: () => (isAutosavingPost), 1704 isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), 1705 isBlockMultiSelected: () => (isBlockMultiSelected), 1706 isBlockSelected: () => (isBlockSelected), 1707 isBlockValid: () => (isBlockValid), 1708 isBlockWithinSelection: () => (isBlockWithinSelection), 1709 isCaretWithinFormattedText: () => (isCaretWithinFormattedText), 1710 isCleanNewPost: () => (isCleanNewPost), 1711 isCurrentPostPending: () => (isCurrentPostPending), 1712 isCurrentPostPublished: () => (isCurrentPostPublished), 1713 isCurrentPostScheduled: () => (isCurrentPostScheduled), 1714 isDeletingPost: () => (isDeletingPost), 1715 isEditedPostAutosaveable: () => (isEditedPostAutosaveable), 1716 isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled), 1717 isEditedPostDateFloating: () => (isEditedPostDateFloating), 1718 isEditedPostDirty: () => (isEditedPostDirty), 1719 isEditedPostEmpty: () => (isEditedPostEmpty), 1720 isEditedPostNew: () => (isEditedPostNew), 1721 isEditedPostPublishable: () => (isEditedPostPublishable), 1722 isEditedPostSaveable: () => (isEditedPostSaveable), 1723 isEditorPanelEnabled: () => (isEditorPanelEnabled), 1724 isEditorPanelOpened: () => (isEditorPanelOpened), 1725 isEditorPanelRemoved: () => (isEditorPanelRemoved), 1726 isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), 1727 isInserterOpened: () => (isInserterOpened), 1728 isListViewOpened: () => (isListViewOpened), 1729 isMultiSelecting: () => (isMultiSelecting), 1730 isPermalinkEditable: () => (isPermalinkEditable), 1731 isPostAutosavingLocked: () => (isPostAutosavingLocked), 1732 isPostLockTakeover: () => (isPostLockTakeover), 1733 isPostLocked: () => (isPostLocked), 1734 isPostSavingLocked: () => (isPostSavingLocked), 1735 isPreviewingPost: () => (isPreviewingPost), 1736 isPublishSidebarEnabled: () => (isPublishSidebarEnabled), 1737 isPublishSidebarOpened: () => (isPublishSidebarOpened), 1738 isPublishingPost: () => (isPublishingPost), 1739 isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges), 1740 isSavingPost: () => (isSavingPost), 1741 isSelectionEnabled: () => (isSelectionEnabled), 1742 isTyping: () => (isTyping), 1743 isValidTemplate: () => (isValidTemplate) 1744 }); 1745 1746 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js 1747 var actions_namespaceObject = {}; 1748 __webpack_require__.r(actions_namespaceObject); 1749 __webpack_require__.d(actions_namespaceObject, { 1750 __experimentalTearDownEditor: () => (__experimentalTearDownEditor), 1751 __unstableSaveForPreview: () => (__unstableSaveForPreview), 1752 autosave: () => (autosave), 1753 clearSelectedBlock: () => (clearSelectedBlock), 1754 closePublishSidebar: () => (closePublishSidebar), 1755 createUndoLevel: () => (createUndoLevel), 1756 disablePublishSidebar: () => (disablePublishSidebar), 1757 editPost: () => (editPost), 1758 enablePublishSidebar: () => (enablePublishSidebar), 1759 enterFormattedText: () => (enterFormattedText), 1760 exitFormattedText: () => (exitFormattedText), 1761 hideInsertionPoint: () => (hideInsertionPoint), 1762 insertBlock: () => (insertBlock), 1763 insertBlocks: () => (insertBlocks), 1764 insertDefaultBlock: () => (insertDefaultBlock), 1765 lockPostAutosaving: () => (lockPostAutosaving), 1766 lockPostSaving: () => (lockPostSaving), 1767 mergeBlocks: () => (mergeBlocks), 1768 moveBlockToPosition: () => (moveBlockToPosition), 1769 moveBlocksDown: () => (moveBlocksDown), 1770 moveBlocksUp: () => (moveBlocksUp), 1771 multiSelect: () => (multiSelect), 1772 openPublishSidebar: () => (openPublishSidebar), 1773 receiveBlocks: () => (receiveBlocks), 1774 redo: () => (redo), 1775 refreshPost: () => (refreshPost), 1776 removeBlock: () => (removeBlock), 1777 removeBlocks: () => (removeBlocks), 1778 removeEditorPanel: () => (removeEditorPanel), 1779 replaceBlock: () => (replaceBlock), 1780 replaceBlocks: () => (replaceBlocks), 1781 resetBlocks: () => (resetBlocks), 1782 resetEditorBlocks: () => (resetEditorBlocks), 1783 resetPost: () => (resetPost), 1784 savePost: () => (savePost), 1785 selectBlock: () => (selectBlock), 1786 setDeviceType: () => (setDeviceType), 1787 setEditedPost: () => (setEditedPost), 1788 setIsInserterOpened: () => (setIsInserterOpened), 1789 setIsListViewOpened: () => (setIsListViewOpened), 1790 setRenderingMode: () => (setRenderingMode), 1791 setTemplateValidity: () => (setTemplateValidity), 1792 setupEditor: () => (setupEditor), 1793 setupEditorState: () => (setupEditorState), 1794 showInsertionPoint: () => (showInsertionPoint), 1795 startMultiSelect: () => (startMultiSelect), 1796 startTyping: () => (startTyping), 1797 stopMultiSelect: () => (stopMultiSelect), 1798 stopTyping: () => (stopTyping), 1799 switchEditorMode: () => (switchEditorMode), 1800 synchronizeTemplate: () => (synchronizeTemplate), 1801 toggleBlockMode: () => (toggleBlockMode), 1802 toggleDistractionFree: () => (toggleDistractionFree), 1803 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), 1804 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), 1805 togglePublishSidebar: () => (togglePublishSidebar), 1806 toggleSelection: () => (toggleSelection), 1807 toggleSpotlightMode: () => (toggleSpotlightMode), 1808 toggleTopToolbar: () => (toggleTopToolbar), 1809 trashPost: () => (trashPost), 1810 undo: () => (undo), 1811 unlockPostAutosaving: () => (unlockPostAutosaving), 1812 unlockPostSaving: () => (unlockPostSaving), 1813 updateBlock: () => (updateBlock), 1814 updateBlockAttributes: () => (updateBlockAttributes), 1815 updateBlockListSettings: () => (updateBlockListSettings), 1816 updateEditorSettings: () => (updateEditorSettings), 1817 updatePost: () => (updatePost), 1818 updatePostLock: () => (updatePostLock) 1819 }); 1820 1821 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 1822 var store_actions_namespaceObject = {}; 1823 __webpack_require__.r(store_actions_namespaceObject); 1824 __webpack_require__.d(store_actions_namespaceObject, { 1825 closeModal: () => (closeModal), 1826 disableComplementaryArea: () => (disableComplementaryArea), 1827 enableComplementaryArea: () => (enableComplementaryArea), 1828 openModal: () => (openModal), 1829 pinItem: () => (pinItem), 1830 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 1831 setFeatureDefaults: () => (setFeatureDefaults), 1832 setFeatureValue: () => (setFeatureValue), 1833 toggleFeature: () => (toggleFeature), 1834 unpinItem: () => (unpinItem) 1835 }); 1836 1837 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1838 var store_selectors_namespaceObject = {}; 1839 __webpack_require__.r(store_selectors_namespaceObject); 1840 __webpack_require__.d(store_selectors_namespaceObject, { 1841 getActiveComplementaryArea: () => (getActiveComplementaryArea), 1842 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 1843 isFeatureActive: () => (isFeatureActive), 1844 isItemPinned: () => (isItemPinned), 1845 isModalActive: () => (isModalActive) 1846 }); 1847 1848 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js 1849 var build_module_namespaceObject = {}; 1850 __webpack_require__.r(build_module_namespaceObject); 1851 __webpack_require__.d(build_module_namespaceObject, { 1852 ActionItem: () => (action_item), 1853 ComplementaryArea: () => (complementary_area), 1854 ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), 1855 FullscreenMode: () => (fullscreen_mode), 1856 InterfaceSkeleton: () => (interface_skeleton), 1857 NavigableRegion: () => (navigable_region), 1858 PinnedItems: () => (pinned_items), 1859 store: () => (store) 1860 }); 1861 1862 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js 1863 var store_private_actions_namespaceObject = {}; 1864 __webpack_require__.r(store_private_actions_namespaceObject); 1865 __webpack_require__.d(store_private_actions_namespaceObject, { 1866 createTemplate: () => (createTemplate), 1867 hideBlockTypes: () => (hideBlockTypes), 1868 registerEntityAction: () => (registerEntityAction), 1869 registerEntityField: () => (registerEntityField), 1870 registerPostTypeSchema: () => (registerPostTypeSchema), 1871 removeTemplates: () => (removeTemplates), 1872 revertTemplate: () => (private_actions_revertTemplate), 1873 saveDirtyEntities: () => (saveDirtyEntities), 1874 setCurrentTemplateId: () => (setCurrentTemplateId), 1875 setIsReady: () => (setIsReady), 1876 showBlockTypes: () => (showBlockTypes), 1877 unregisterEntityAction: () => (unregisterEntityAction), 1878 unregisterEntityField: () => (unregisterEntityField) 1879 }); 1880 1881 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 1882 var store_private_selectors_namespaceObject = {}; 1883 __webpack_require__.r(store_private_selectors_namespaceObject); 1884 __webpack_require__.d(store_private_selectors_namespaceObject, { 1885 getEntityActions: () => (private_selectors_getEntityActions), 1886 getEntityFields: () => (private_selectors_getEntityFields), 1887 getInserter: () => (getInserter), 1888 getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), 1889 getListViewToggleRef: () => (getListViewToggleRef), 1890 getPostBlocksByName: () => (getPostBlocksByName), 1891 getPostIcon: () => (getPostIcon), 1892 hasPostMetaChanges: () => (hasPostMetaChanges), 1893 isEntityReady: () => (private_selectors_isEntityReady) 1894 }); 1895 1896 ;// external ["wp","data"] 1897 const external_wp_data_namespaceObject = window["wp"]["data"]; 1898 ;// external ["wp","coreData"] 1899 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1900 ;// external ["wp","element"] 1901 const external_wp_element_namespaceObject = window["wp"]["element"]; 1902 ;// external ["wp","compose"] 1903 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 1904 ;// external ["wp","hooks"] 1905 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1906 ;// external ["wp","blockEditor"] 1907 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 1908 ;// ./node_modules/@wordpress/editor/build-module/store/defaults.js 1909 /** 1910 * WordPress dependencies 1911 */ 1912 1913 1914 /** 1915 * The default post editor settings. 1916 * 1917 * @property {boolean|Array} allowedBlockTypes Allowed block types 1918 * @property {boolean} richEditingEnabled Whether rich editing is enabled or not 1919 * @property {boolean} codeEditingEnabled Whether code editing is enabled or not 1920 * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not. 1921 * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. 1922 * true = the user has opted to show the Custom Fields panel at the bottom of the editor. 1923 * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. 1924 * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed. 1925 * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. 1926 * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. 1927 * @property {Array?} availableTemplates The available post templates 1928 * @property {boolean} disablePostFormats Whether or not the post formats are disabled 1929 * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions 1930 * @property {number} maxUploadFileSize Maximum upload file size 1931 * @property {boolean} supportsLayout Whether the editor supports layouts. 1932 */ 1933 const EDITOR_SETTINGS_DEFAULTS = { 1934 ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, 1935 richEditingEnabled: true, 1936 codeEditingEnabled: true, 1937 fontLibraryEnabled: true, 1938 enableCustomFields: undefined, 1939 defaultRenderingMode: 'post-only' 1940 }; 1941 1942 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js 1943 /* wp:polyfill */ 1944 /** 1945 * WordPress dependencies 1946 */ 1947 1948 function isReady(state = {}, action) { 1949 switch (action.type) { 1950 case 'SET_IS_READY': 1951 return { 1952 ...state, 1953 [action.kind]: { 1954 ...state[action.kind], 1955 [action.name]: true 1956 } 1957 }; 1958 } 1959 return state; 1960 } 1961 function actions(state = {}, action) { 1962 var _state$action$kind$ac; 1963 switch (action.type) { 1964 case 'REGISTER_ENTITY_ACTION': 1965 return { 1966 ...state, 1967 [action.kind]: { 1968 ...state[action.kind], 1969 [action.name]: [...((_state$action$kind$ac = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac !== void 0 ? _state$action$kind$ac : []).filter(_action => _action.id !== action.config.id), action.config] 1970 } 1971 }; 1972 case 'UNREGISTER_ENTITY_ACTION': 1973 { 1974 var _state$action$kind$ac2; 1975 return { 1976 ...state, 1977 [action.kind]: { 1978 ...state[action.kind], 1979 [action.name]: ((_state$action$kind$ac2 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac2 !== void 0 ? _state$action$kind$ac2 : []).filter(_action => _action.id !== action.actionId) 1980 } 1981 }; 1982 } 1983 } 1984 return state; 1985 } 1986 function fields(state = {}, action) { 1987 var _state$action$kind$ac3, _state$action$kind$ac4; 1988 switch (action.type) { 1989 case 'REGISTER_ENTITY_FIELD': 1990 return { 1991 ...state, 1992 [action.kind]: { 1993 ...state[action.kind], 1994 [action.name]: [...((_state$action$kind$ac3 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac3 !== void 0 ? _state$action$kind$ac3 : []).filter(_field => _field.id !== action.config.id), action.config] 1995 } 1996 }; 1997 case 'UNREGISTER_ENTITY_FIELD': 1998 return { 1999 ...state, 2000 [action.kind]: { 2001 ...state[action.kind], 2002 [action.name]: ((_state$action$kind$ac4 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac4 !== void 0 ? _state$action$kind$ac4 : []).filter(_field => _field.id !== action.fieldId) 2003 } 2004 }; 2005 } 2006 return state; 2007 } 2008 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 2009 actions, 2010 fields, 2011 isReady 2012 })); 2013 2014 ;// ./node_modules/@wordpress/editor/build-module/store/reducer.js 2015 /* wp:polyfill */ 2016 /** 2017 * WordPress dependencies 2018 */ 2019 2020 2021 /** 2022 * Internal dependencies 2023 */ 2024 2025 2026 2027 /** 2028 * Returns a post attribute value, flattening nested rendered content using its 2029 * raw value in place of its original object form. 2030 * 2031 * @param {*} value Original value. 2032 * 2033 * @return {*} Raw value. 2034 */ 2035 function getPostRawValue(value) { 2036 if (value && 'object' === typeof value && 'raw' in value) { 2037 return value.raw; 2038 } 2039 return value; 2040 } 2041 2042 /** 2043 * Returns true if the two object arguments have the same keys, or false 2044 * otherwise. 2045 * 2046 * @param {Object} a First object. 2047 * @param {Object} b Second object. 2048 * 2049 * @return {boolean} Whether the two objects have the same keys. 2050 */ 2051 function hasSameKeys(a, b) { 2052 const keysA = Object.keys(a).sort(); 2053 const keysB = Object.keys(b).sort(); 2054 return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); 2055 } 2056 2057 /** 2058 * Returns true if, given the currently dispatching action and the previously 2059 * dispatched action, the two actions are editing the same post property, or 2060 * false otherwise. 2061 * 2062 * @param {Object} action Currently dispatching action. 2063 * @param {Object} previousAction Previously dispatched action. 2064 * 2065 * @return {boolean} Whether actions are updating the same post property. 2066 */ 2067 function isUpdatingSamePostProperty(action, previousAction) { 2068 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); 2069 } 2070 2071 /** 2072 * Returns true if, given the currently dispatching action and the previously 2073 * dispatched action, the two actions are modifying the same property such that 2074 * undo history should be batched. 2075 * 2076 * @param {Object} action Currently dispatching action. 2077 * @param {Object} previousAction Previously dispatched action. 2078 * 2079 * @return {boolean} Whether to overwrite present state. 2080 */ 2081 function shouldOverwriteState(action, previousAction) { 2082 if (action.type === 'RESET_EDITOR_BLOCKS') { 2083 return !action.shouldCreateUndoLevel; 2084 } 2085 if (!previousAction || action.type !== previousAction.type) { 2086 return false; 2087 } 2088 return isUpdatingSamePostProperty(action, previousAction); 2089 } 2090 function postId(state = null, action) { 2091 switch (action.type) { 2092 case 'SET_EDITED_POST': 2093 return action.postId; 2094 } 2095 return state; 2096 } 2097 function templateId(state = null, action) { 2098 switch (action.type) { 2099 case 'SET_CURRENT_TEMPLATE_ID': 2100 return action.id; 2101 } 2102 return state; 2103 } 2104 function postType(state = null, action) { 2105 switch (action.type) { 2106 case 'SET_EDITED_POST': 2107 return action.postType; 2108 } 2109 return state; 2110 } 2111 2112 /** 2113 * Reducer returning whether the post blocks match the defined template or not. 2114 * 2115 * @param {Object} state Current state. 2116 * @param {Object} action Dispatched action. 2117 * 2118 * @return {boolean} Updated state. 2119 */ 2120 function template(state = { 2121 isValid: true 2122 }, action) { 2123 switch (action.type) { 2124 case 'SET_TEMPLATE_VALIDITY': 2125 return { 2126 ...state, 2127 isValid: action.isValid 2128 }; 2129 } 2130 return state; 2131 } 2132 2133 /** 2134 * Reducer returning current network request state (whether a request to 2135 * the WP REST API is in progress, successful, or failed). 2136 * 2137 * @param {Object} state Current state. 2138 * @param {Object} action Dispatched action. 2139 * 2140 * @return {Object} Updated state. 2141 */ 2142 function saving(state = {}, action) { 2143 switch (action.type) { 2144 case 'REQUEST_POST_UPDATE_START': 2145 case 'REQUEST_POST_UPDATE_FINISH': 2146 return { 2147 pending: action.type === 'REQUEST_POST_UPDATE_START', 2148 options: action.options || {} 2149 }; 2150 } 2151 return state; 2152 } 2153 2154 /** 2155 * Reducer returning deleting post request state. 2156 * 2157 * @param {Object} state Current state. 2158 * @param {Object} action Dispatched action. 2159 * 2160 * @return {Object} Updated state. 2161 */ 2162 function deleting(state = {}, action) { 2163 switch (action.type) { 2164 case 'REQUEST_POST_DELETE_START': 2165 case 'REQUEST_POST_DELETE_FINISH': 2166 return { 2167 pending: action.type === 'REQUEST_POST_DELETE_START' 2168 }; 2169 } 2170 return state; 2171 } 2172 2173 /** 2174 * Post Lock State. 2175 * 2176 * @typedef {Object} PostLockState 2177 * 2178 * @property {boolean} isLocked Whether the post is locked. 2179 * @property {?boolean} isTakeover Whether the post editing has been taken over. 2180 * @property {?boolean} activePostLock Active post lock value. 2181 * @property {?Object} user User that took over the post. 2182 */ 2183 2184 /** 2185 * Reducer returning the post lock status. 2186 * 2187 * @param {PostLockState} state Current state. 2188 * @param {Object} action Dispatched action. 2189 * 2190 * @return {PostLockState} Updated state. 2191 */ 2192 function postLock(state = { 2193 isLocked: false 2194 }, action) { 2195 switch (action.type) { 2196 case 'UPDATE_POST_LOCK': 2197 return action.lock; 2198 } 2199 return state; 2200 } 2201 2202 /** 2203 * Post saving lock. 2204 * 2205 * When post saving is locked, the post cannot be published or updated. 2206 * 2207 * @param {PostLockState} state Current state. 2208 * @param {Object} action Dispatched action. 2209 * 2210 * @return {PostLockState} Updated state. 2211 */ 2212 function postSavingLock(state = {}, action) { 2213 switch (action.type) { 2214 case 'LOCK_POST_SAVING': 2215 return { 2216 ...state, 2217 [action.lockName]: true 2218 }; 2219 case 'UNLOCK_POST_SAVING': 2220 { 2221 const { 2222 [action.lockName]: removedLockName, 2223 ...restState 2224 } = state; 2225 return restState; 2226 } 2227 } 2228 return state; 2229 } 2230 2231 /** 2232 * Post autosaving lock. 2233 * 2234 * When post autosaving is locked, the post will not autosave. 2235 * 2236 * @param {PostLockState} state Current state. 2237 * @param {Object} action Dispatched action. 2238 * 2239 * @return {PostLockState} Updated state. 2240 */ 2241 function postAutosavingLock(state = {}, action) { 2242 switch (action.type) { 2243 case 'LOCK_POST_AUTOSAVING': 2244 return { 2245 ...state, 2246 [action.lockName]: true 2247 }; 2248 case 'UNLOCK_POST_AUTOSAVING': 2249 { 2250 const { 2251 [action.lockName]: removedLockName, 2252 ...restState 2253 } = state; 2254 return restState; 2255 } 2256 } 2257 return state; 2258 } 2259 2260 /** 2261 * Reducer returning the post editor setting. 2262 * 2263 * @param {Object} state Current state. 2264 * @param {Object} action Dispatched action. 2265 * 2266 * @return {Object} Updated state. 2267 */ 2268 function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { 2269 switch (action.type) { 2270 case 'UPDATE_EDITOR_SETTINGS': 2271 return { 2272 ...state, 2273 ...action.settings 2274 }; 2275 } 2276 return state; 2277 } 2278 function renderingMode(state = 'post-only', action) { 2279 switch (action.type) { 2280 case 'SET_RENDERING_MODE': 2281 return action.mode; 2282 } 2283 return state; 2284 } 2285 2286 /** 2287 * Reducer returning the editing canvas device type. 2288 * 2289 * @param {Object} state Current state. 2290 * @param {Object} action Dispatched action. 2291 * 2292 * @return {Object} Updated state. 2293 */ 2294 function deviceType(state = 'Desktop', action) { 2295 switch (action.type) { 2296 case 'SET_DEVICE_TYPE': 2297 return action.deviceType; 2298 } 2299 return state; 2300 } 2301 2302 /** 2303 * Reducer storing the list of all programmatically removed panels. 2304 * 2305 * @param {Array} state Current state. 2306 * @param {Object} action Action object. 2307 * 2308 * @return {Array} Updated state. 2309 */ 2310 function removedPanels(state = [], action) { 2311 switch (action.type) { 2312 case 'REMOVE_PANEL': 2313 if (!state.includes(action.panelName)) { 2314 return [...state, action.panelName]; 2315 } 2316 } 2317 return state; 2318 } 2319 2320 /** 2321 * Reducer to set the block inserter panel open or closed. 2322 * 2323 * Note: this reducer interacts with the list view panel reducer 2324 * to make sure that only one of the two panels is open at the same time. 2325 * 2326 * @param {Object} state Current state. 2327 * @param {Object} action Dispatched action. 2328 */ 2329 function blockInserterPanel(state = false, action) { 2330 switch (action.type) { 2331 case 'SET_IS_LIST_VIEW_OPENED': 2332 return action.isOpen ? false : state; 2333 case 'SET_IS_INSERTER_OPENED': 2334 return action.value; 2335 } 2336 return state; 2337 } 2338 2339 /** 2340 * Reducer to set the list view panel open or closed. 2341 * 2342 * Note: this reducer interacts with the inserter panel reducer 2343 * to make sure that only one of the two panels is open at the same time. 2344 * 2345 * @param {Object} state Current state. 2346 * @param {Object} action Dispatched action. 2347 */ 2348 function listViewPanel(state = false, action) { 2349 switch (action.type) { 2350 case 'SET_IS_INSERTER_OPENED': 2351 return action.value ? false : state; 2352 case 'SET_IS_LIST_VIEW_OPENED': 2353 return action.isOpen; 2354 } 2355 return state; 2356 } 2357 2358 /** 2359 * This reducer does nothing aside initializing a ref to the list view toggle. 2360 * We will have a unique ref per "editor" instance. 2361 * 2362 * @param {Object} state 2363 * @return {Object} Reference to the list view toggle button. 2364 */ 2365 function listViewToggleRef(state = { 2366 current: null 2367 }) { 2368 return state; 2369 } 2370 2371 /** 2372 * This reducer does nothing aside initializing a ref to the inserter sidebar toggle. 2373 * We will have a unique ref per "editor" instance. 2374 * 2375 * @param {Object} state 2376 * @return {Object} Reference to the inserter sidebar toggle button. 2377 */ 2378 function inserterSidebarToggleRef(state = { 2379 current: null 2380 }) { 2381 return state; 2382 } 2383 function publishSidebarActive(state = false, action) { 2384 switch (action.type) { 2385 case 'OPEN_PUBLISH_SIDEBAR': 2386 return true; 2387 case 'CLOSE_PUBLISH_SIDEBAR': 2388 return false; 2389 case 'TOGGLE_PUBLISH_SIDEBAR': 2390 return !state; 2391 } 2392 return state; 2393 } 2394 /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 2395 postId, 2396 postType, 2397 templateId, 2398 saving, 2399 deleting, 2400 postLock, 2401 template, 2402 postSavingLock, 2403 editorSettings, 2404 postAutosavingLock, 2405 renderingMode, 2406 deviceType, 2407 removedPanels, 2408 blockInserterPanel, 2409 inserterSidebarToggleRef, 2410 listViewPanel, 2411 listViewToggleRef, 2412 publishSidebarActive, 2413 dataviews: reducer 2414 })); 2415 2416 ;// external ["wp","blocks"] 2417 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 2418 ;// external ["wp","date"] 2419 const external_wp_date_namespaceObject = window["wp"]["date"]; 2420 ;// external ["wp","url"] 2421 const external_wp_url_namespaceObject = window["wp"]["url"]; 2422 ;// external ["wp","deprecated"] 2423 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 2424 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 2425 ;// external ["wp","preferences"] 2426 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 2427 ;// ./node_modules/@wordpress/editor/build-module/store/constants.js 2428 /** 2429 * Set of post properties for which edits should assume a merging behavior, 2430 * assuming an object value. 2431 * 2432 * @type {Set} 2433 */ 2434 const EDIT_MERGE_PROPERTIES = new Set(['meta']); 2435 2436 /** 2437 * Constant for the store module (or reducer) key. 2438 */ 2439 const STORE_NAME = 'core/editor'; 2440 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 2441 const ONE_MINUTE_IN_MS = 60 * 1000; 2442 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; 2443 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 2444 const TEMPLATE_POST_TYPE = 'wp_template'; 2445 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 2446 const PATTERN_POST_TYPE = 'wp_block'; 2447 const NAVIGATION_POST_TYPE = 'wp_navigation'; 2448 const TEMPLATE_ORIGINS = { 2449 custom: 'custom', 2450 theme: 'theme', 2451 plugin: 'plugin' 2452 }; 2453 const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part']; 2454 const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation']; 2455 2456 ;// external ["wp","primitives"] 2457 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 2458 ;// external "ReactJSXRuntime" 2459 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 2460 ;// ./node_modules/@wordpress/icons/build-module/library/header.js 2461 /** 2462 * WordPress dependencies 2463 */ 2464 2465 2466 const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2467 xmlns: "http://www.w3.org/2000/svg", 2468 viewBox: "0 0 24 24", 2469 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2470 d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 2471 }) 2472 }); 2473 /* harmony default export */ const library_header = (header); 2474 2475 ;// ./node_modules/@wordpress/icons/build-module/library/footer.js 2476 /** 2477 * WordPress dependencies 2478 */ 2479 2480 2481 const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2482 xmlns: "http://www.w3.org/2000/svg", 2483 viewBox: "0 0 24 24", 2484 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2485 fillRule: "evenodd", 2486 d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 2487 }) 2488 }); 2489 /* harmony default export */ const library_footer = (footer); 2490 2491 ;// ./node_modules/@wordpress/icons/build-module/library/sidebar.js 2492 /** 2493 * WordPress dependencies 2494 */ 2495 2496 2497 const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2498 xmlns: "http://www.w3.org/2000/svg", 2499 viewBox: "0 0 24 24", 2500 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2501 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 2502 }) 2503 }); 2504 /* harmony default export */ const library_sidebar = (sidebar); 2505 2506 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 2507 /** 2508 * WordPress dependencies 2509 */ 2510 2511 2512 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2513 xmlns: "http://www.w3.org/2000/svg", 2514 viewBox: "0 0 24 24", 2515 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2516 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 2517 }) 2518 }); 2519 /* harmony default export */ const symbol_filled = (symbolFilled); 2520 2521 ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js 2522 /** 2523 * WordPress dependencies 2524 */ 2525 2526 /** 2527 * Helper function to retrieve the corresponding icon by name. 2528 * 2529 * @param {string} iconName The name of the icon. 2530 * 2531 * @return {Object} The corresponding icon. 2532 */ 2533 function getTemplatePartIcon(iconName) { 2534 if ('header' === iconName) { 2535 return library_header; 2536 } else if ('footer' === iconName) { 2537 return library_footer; 2538 } else if ('sidebar' === iconName) { 2539 return library_sidebar; 2540 } 2541 return symbol_filled; 2542 } 2543 2544 ;// external ["wp","privateApis"] 2545 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 2546 ;// ./node_modules/@wordpress/editor/build-module/lock-unlock.js 2547 /** 2548 * WordPress dependencies 2549 */ 2550 2551 const { 2552 lock, 2553 unlock 2554 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/editor'); 2555 2556 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 2557 /** 2558 * WordPress dependencies 2559 */ 2560 2561 2562 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2563 xmlns: "http://www.w3.org/2000/svg", 2564 viewBox: "0 0 24 24", 2565 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2566 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" 2567 }) 2568 }); 2569 /* harmony default export */ const library_layout = (layout); 2570 2571 ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-info.js 2572 /* wp:polyfill */ 2573 /** 2574 * WordPress dependencies 2575 */ 2576 2577 /** 2578 * Internal dependencies 2579 */ 2580 2581 const EMPTY_OBJECT = {}; 2582 2583 /** 2584 * Helper function to retrieve the corresponding template info for a given template. 2585 * @param {Object} params 2586 * @param {Array} params.templateTypes 2587 * @param {Array} [params.templateAreas] 2588 * @param {Object} params.template 2589 */ 2590 const getTemplateInfo = params => { 2591 var _Object$values$find; 2592 if (!params) { 2593 return EMPTY_OBJECT; 2594 } 2595 const { 2596 templateTypes, 2597 templateAreas, 2598 template 2599 } = params; 2600 const { 2601 description, 2602 slug, 2603 title, 2604 area 2605 } = template; 2606 const { 2607 title: defaultTitle, 2608 description: defaultDescription 2609 } = (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT; 2610 const templateTitle = typeof title === 'string' ? title : title?.rendered; 2611 const templateDescription = typeof description === 'string' ? description : description?.raw; 2612 const templateAreasWithIcon = templateAreas?.map(item => ({ 2613 ...item, 2614 icon: getTemplatePartIcon(item.icon) 2615 })); 2616 const templateIcon = templateAreasWithIcon?.find(item => area === item.area)?.icon || library_layout; 2617 return { 2618 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 2619 description: templateDescription || defaultDescription, 2620 icon: templateIcon 2621 }; 2622 }; 2623 2624 ;// ./node_modules/@wordpress/editor/build-module/store/selectors.js 2625 /* wp:polyfill */ 2626 /** 2627 * WordPress dependencies 2628 */ 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 /** 2640 * Internal dependencies 2641 */ 2642 2643 2644 2645 2646 2647 2648 /** 2649 * Shared reference to an empty object for cases where it is important to avoid 2650 * returning a new object reference on every invocation, as in a connected or 2651 * other pure component which performs `shouldComponentUpdate` check on props. 2652 * This should be used as a last resort, since the normalized data should be 2653 * maintained by the reducer result in state. 2654 */ 2655 const selectors_EMPTY_OBJECT = {}; 2656 2657 /** 2658 * Returns true if any past editor history snapshots exist, or false otherwise. 2659 * 2660 * @param {Object} state Global application state. 2661 * 2662 * @return {boolean} Whether undo history exists. 2663 */ 2664 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2665 return select(external_wp_coreData_namespaceObject.store).hasUndo(); 2666 }); 2667 2668 /** 2669 * Returns true if any future editor history snapshots exist, or false 2670 * otherwise. 2671 * 2672 * @param {Object} state Global application state. 2673 * 2674 * @return {boolean} Whether redo history exists. 2675 */ 2676 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2677 return select(external_wp_coreData_namespaceObject.store).hasRedo(); 2678 }); 2679 2680 /** 2681 * Returns true if the currently edited post is yet to be saved, or false if 2682 * the post has been saved. 2683 * 2684 * @param {Object} state Global application state. 2685 * 2686 * @return {boolean} Whether the post is new. 2687 */ 2688 function isEditedPostNew(state) { 2689 return getCurrentPost(state).status === 'auto-draft'; 2690 } 2691 2692 /** 2693 * Returns true if content includes unsaved changes, or false otherwise. 2694 * 2695 * @param {Object} state Editor state. 2696 * 2697 * @return {boolean} Whether content includes unsaved changes. 2698 */ 2699 function hasChangedContent(state) { 2700 const edits = getPostEdits(state); 2701 return 'content' in edits; 2702 } 2703 2704 /** 2705 * Returns true if there are unsaved values for the current edit session, or 2706 * false if the editing state matches the saved or new post. 2707 * 2708 * @param {Object} state Global application state. 2709 * 2710 * @return {boolean} Whether unsaved values exist. 2711 */ 2712 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2713 // Edits should contain only fields which differ from the saved post (reset 2714 // at initial load and save complete). Thus, a non-empty edits state can be 2715 // inferred to contain unsaved values. 2716 const postType = getCurrentPostType(state); 2717 const postId = getCurrentPostId(state); 2718 return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId); 2719 }); 2720 2721 /** 2722 * Returns true if there are unsaved edits for entities other than 2723 * the editor's post, and false otherwise. 2724 * 2725 * @param {Object} state Global application state. 2726 * 2727 * @return {boolean} Whether there are edits or not. 2728 */ 2729 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2730 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); 2731 const { 2732 type, 2733 id 2734 } = getCurrentPost(state); 2735 return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 2736 }); 2737 2738 /** 2739 * Returns true if there are no unsaved values for the current edit session and 2740 * if the currently edited post is new (has never been saved before). 2741 * 2742 * @param {Object} state Global application state. 2743 * 2744 * @return {boolean} Whether new post and unsaved values exist. 2745 */ 2746 function isCleanNewPost(state) { 2747 return !isEditedPostDirty(state) && isEditedPostNew(state); 2748 } 2749 2750 /** 2751 * Returns the post currently being edited in its last known saved state, not 2752 * including unsaved edits. Returns an object containing relevant default post 2753 * values if the post has not yet been saved. 2754 * 2755 * @param {Object} state Global application state. 2756 * 2757 * @return {Object} Post object. 2758 */ 2759 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2760 const postId = getCurrentPostId(state); 2761 const postType = getCurrentPostType(state); 2762 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); 2763 if (post) { 2764 return post; 2765 } 2766 2767 // This exists for compatibility with the previous selector behavior 2768 // which would guarantee an object return based on the editor reducer's 2769 // default empty object state. 2770 return selectors_EMPTY_OBJECT; 2771 }); 2772 2773 /** 2774 * Returns the post type of the post currently being edited. 2775 * 2776 * @param {Object} state Global application state. 2777 * 2778 * @example 2779 * 2780 *```js 2781 * const currentPostType = wp.data.select( 'core/editor' ).getCurrentPostType(); 2782 *``` 2783 * @return {string} Post type. 2784 */ 2785 function getCurrentPostType(state) { 2786 return state.postType; 2787 } 2788 2789 /** 2790 * Returns the ID of the post currently being edited, or null if the post has 2791 * not yet been saved. 2792 * 2793 * @param {Object} state Global application state. 2794 * 2795 * @return {?number} ID of current post. 2796 */ 2797 function getCurrentPostId(state) { 2798 return state.postId; 2799 } 2800 2801 /** 2802 * Returns the template ID currently being rendered/edited 2803 * 2804 * @param {Object} state Global application state. 2805 * 2806 * @return {?string} Template ID. 2807 */ 2808 function getCurrentTemplateId(state) { 2809 return state.templateId; 2810 } 2811 2812 /** 2813 * Returns the number of revisions of the post currently being edited. 2814 * 2815 * @param {Object} state Global application state. 2816 * 2817 * @return {number} Number of revisions. 2818 */ 2819 function getCurrentPostRevisionsCount(state) { 2820 var _getCurrentPost$_link; 2821 return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0; 2822 } 2823 2824 /** 2825 * Returns the last revision ID of the post currently being edited, 2826 * or null if the post has no revisions. 2827 * 2828 * @param {Object} state Global application state. 2829 * 2830 * @return {?number} ID of the last revision. 2831 */ 2832 function getCurrentPostLastRevisionId(state) { 2833 var _getCurrentPost$_link2; 2834 return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null; 2835 } 2836 2837 /** 2838 * Returns any post values which have been changed in the editor but not yet 2839 * been saved. 2840 * 2841 * @param {Object} state Global application state. 2842 * 2843 * @return {Object} Object of key value pairs comprising unsaved edits. 2844 */ 2845 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2846 const postType = getCurrentPostType(state); 2847 const postId = getCurrentPostId(state); 2848 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || selectors_EMPTY_OBJECT; 2849 }); 2850 2851 /** 2852 * Returns an attribute value of the saved post. 2853 * 2854 * @param {Object} state Global application state. 2855 * @param {string} attributeName Post attribute name. 2856 * 2857 * @return {*} Post attribute value. 2858 */ 2859 function getCurrentPostAttribute(state, attributeName) { 2860 switch (attributeName) { 2861 case 'type': 2862 return getCurrentPostType(state); 2863 case 'id': 2864 return getCurrentPostId(state); 2865 default: 2866 const post = getCurrentPost(state); 2867 if (!post.hasOwnProperty(attributeName)) { 2868 break; 2869 } 2870 return getPostRawValue(post[attributeName]); 2871 } 2872 } 2873 2874 /** 2875 * Returns a single attribute of the post being edited, preferring the unsaved 2876 * edit if one exists, but merging with the attribute value for the last known 2877 * saved state of the post (this is needed for some nested attributes like meta). 2878 * 2879 * @param {Object} state Global application state. 2880 * @param {string} attributeName Post attribute name. 2881 * 2882 * @return {*} Post attribute value. 2883 */ 2884 const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => { 2885 const edits = getPostEdits(state); 2886 if (!edits.hasOwnProperty(attributeName)) { 2887 return getCurrentPostAttribute(state, attributeName); 2888 } 2889 return { 2890 ...getCurrentPostAttribute(state, attributeName), 2891 ...edits[attributeName] 2892 }; 2893 }, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]); 2894 2895 /** 2896 * Returns a single attribute of the post being edited, preferring the unsaved 2897 * edit if one exists, but falling back to the attribute for the last known 2898 * saved state of the post. 2899 * 2900 * @param {Object} state Global application state. 2901 * @param {string} attributeName Post attribute name. 2902 * 2903 * @example 2904 * 2905 *```js 2906 * // Get specific media size based on the featured media ID 2907 * // Note: change sizes?.large for any registered size 2908 * const getFeaturedMediaUrl = useSelect( ( select ) => { 2909 * const getFeaturedMediaId = 2910 * select( 'core/editor' ).getEditedPostAttribute( 'featured_media' ); 2911 * const getMedia = select( 'core' ).getMedia( getFeaturedMediaId ); 2912 * 2913 * return ( 2914 * getMedia?.media_details?.sizes?.large?.source_url || getMedia?.source_url || '' 2915 * ); 2916 * }, [] ); 2917 *``` 2918 * 2919 * @return {*} Post attribute value. 2920 */ 2921 function getEditedPostAttribute(state, attributeName) { 2922 // Special cases. 2923 switch (attributeName) { 2924 case 'content': 2925 return getEditedPostContent(state); 2926 } 2927 2928 // Fall back to saved post value if not edited. 2929 const edits = getPostEdits(state); 2930 if (!edits.hasOwnProperty(attributeName)) { 2931 return getCurrentPostAttribute(state, attributeName); 2932 } 2933 2934 // Merge properties are objects which contain only the patch edit in state, 2935 // and thus must be merged with the current post attribute. 2936 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2937 return getNestedEditedPostProperty(state, attributeName); 2938 } 2939 return edits[attributeName]; 2940 } 2941 2942 /** 2943 * Returns an attribute value of the current autosave revision for a post, or 2944 * null if there is no autosave for the post. 2945 * 2946 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2947 * from the '@wordpress/core-data' package and access properties on the returned 2948 * autosave object using getPostRawValue. 2949 * 2950 * @param {Object} state Global application state. 2951 * @param {string} attributeName Autosave attribute name. 2952 * 2953 * @return {*} Autosave attribute value. 2954 */ 2955 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { 2956 if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') { 2957 return; 2958 } 2959 const postType = getCurrentPostType(state); 2960 2961 // Currently template autosaving is not supported. 2962 if (postType === 'wp_template') { 2963 return false; 2964 } 2965 const postId = getCurrentPostId(state); 2966 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 2967 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 2968 if (autosave) { 2969 return getPostRawValue(autosave[attributeName]); 2970 } 2971 }); 2972 2973 /** 2974 * Returns the current visibility of the post being edited, preferring the 2975 * unsaved value if different than the saved post. The return value is one of 2976 * "private", "password", or "public". 2977 * 2978 * @param {Object} state Global application state. 2979 * 2980 * @return {string} Post visibility. 2981 */ 2982 function getEditedPostVisibility(state) { 2983 const status = getEditedPostAttribute(state, 'status'); 2984 if (status === 'private') { 2985 return 'private'; 2986 } 2987 const password = getEditedPostAttribute(state, 'password'); 2988 if (password) { 2989 return 'password'; 2990 } 2991 return 'public'; 2992 } 2993 2994 /** 2995 * Returns true if post is pending review. 2996 * 2997 * @param {Object} state Global application state. 2998 * 2999 * @return {boolean} Whether current post is pending review. 3000 */ 3001 function isCurrentPostPending(state) { 3002 return getCurrentPost(state).status === 'pending'; 3003 } 3004 3005 /** 3006 * Return true if the current post has already been published. 3007 * 3008 * @param {Object} state Global application state. 3009 * @param {Object} [currentPost] Explicit current post for bypassing registry selector. 3010 * 3011 * @return {boolean} Whether the post has been published. 3012 */ 3013 function isCurrentPostPublished(state, currentPost) { 3014 const post = currentPost || getCurrentPost(state); 3015 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS)); 3016 } 3017 3018 /** 3019 * Returns true if post is already scheduled. 3020 * 3021 * @param {Object} state Global application state. 3022 * 3023 * @return {boolean} Whether current post is scheduled to be posted. 3024 */ 3025 function isCurrentPostScheduled(state) { 3026 return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); 3027 } 3028 3029 /** 3030 * Return true if the post being edited can be published. 3031 * 3032 * @param {Object} state Global application state. 3033 * 3034 * @return {boolean} Whether the post can been published. 3035 */ 3036 function isEditedPostPublishable(state) { 3037 const post = getCurrentPost(state); 3038 3039 // TODO: Post being publishable should be superset of condition of post 3040 // being saveable. Currently this restriction is imposed at UI. 3041 // 3042 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). 3043 3044 return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; 3045 } 3046 3047 /** 3048 * Returns true if the post can be saved, or false otherwise. A post must 3049 * contain a title, an excerpt, or non-empty content to be valid for save. 3050 * 3051 * @param {Object} state Global application state. 3052 * 3053 * @return {boolean} Whether the post can be saved. 3054 */ 3055 function isEditedPostSaveable(state) { 3056 if (isSavingPost(state)) { 3057 return false; 3058 } 3059 3060 // TODO: Post should not be saveable if not dirty. Cannot be added here at 3061 // this time since posts where meta boxes are present can be saved even if 3062 // the post is not dirty. Currently this restriction is imposed at UI, but 3063 // should be moved here. 3064 // 3065 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) 3066 // See: <PostSavedState /> (`forceIsDirty` prop) 3067 // See: <PostPublishButton /> (`forceIsDirty` prop) 3068 // See: https://github.com/WordPress/gutenberg/pull/4184. 3069 3070 return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; 3071 } 3072 3073 /** 3074 * Returns true if the edited post has content. A post has content if it has at 3075 * least one saveable block or otherwise has a non-empty content property 3076 * assigned. 3077 * 3078 * @param {Object} state Global application state. 3079 * 3080 * @return {boolean} Whether post has content. 3081 */ 3082 const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3083 // While the condition of truthy content string is sufficient to determine 3084 // emptiness, testing saveable blocks length is a trivial operation. Since 3085 // this function can be called frequently, optimize for the fast case as a 3086 // condition of the mere existence of blocks. Note that the value of edited 3087 // content takes precedent over block content, and must fall through to the 3088 // default logic. 3089 const postId = getCurrentPostId(state); 3090 const postType = getCurrentPostType(state); 3091 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 3092 if (typeof record.content !== 'function') { 3093 return !record.content; 3094 } 3095 const blocks = getEditedPostAttribute(state, 'blocks'); 3096 if (blocks.length === 0) { 3097 return true; 3098 } 3099 3100 // Pierce the abstraction of the serializer in knowing that blocks are 3101 // joined with newlines such that even if every individual block 3102 // produces an empty save result, the serialized content is non-empty. 3103 if (blocks.length > 1) { 3104 return false; 3105 } 3106 3107 // There are two conditions under which the optimization cannot be 3108 // assumed, and a fallthrough to getEditedPostContent must occur: 3109 // 3110 // 1. getBlocksForSerialization has special treatment in omitting a 3111 // single unmodified default block. 3112 // 2. Comment delimiters are omitted for a freeform or unregistered 3113 // block in its serialization. The freeform block specifically may 3114 // produce an empty string in its saved output. 3115 // 3116 // For all other content, the single block is assumed to make a post 3117 // non-empty, if only by virtue of its own comment delimiters. 3118 const blockName = blocks[0].name; 3119 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { 3120 return false; 3121 } 3122 return !getEditedPostContent(state); 3123 }); 3124 3125 /** 3126 * Returns true if the post can be autosaved, or false otherwise. 3127 * 3128 * @param {Object} state Global application state. 3129 * @param {Object} autosave A raw autosave object from the REST API. 3130 * 3131 * @return {boolean} Whether the post can be autosaved. 3132 */ 3133 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3134 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. 3135 if (!isEditedPostSaveable(state)) { 3136 return false; 3137 } 3138 3139 // A post is not autosavable when there is a post autosave lock. 3140 if (isPostAutosavingLocked(state)) { 3141 return false; 3142 } 3143 const postType = getCurrentPostType(state); 3144 3145 // Currently template autosaving is not supported. 3146 if (postType === 'wp_template') { 3147 return false; 3148 } 3149 const postId = getCurrentPostId(state); 3150 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); 3151 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 3152 3153 // Disable reason - this line causes the side-effect of fetching the autosave 3154 // via a resolver, moving below the return would result in the autosave never 3155 // being fetched. 3156 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 3157 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 3158 3159 // If any existing autosaves have not yet been fetched, this function is 3160 // unable to determine if the post is autosaveable, so return false. 3161 if (!hasFetchedAutosave) { 3162 return false; 3163 } 3164 3165 // If we don't already have an autosave, the post is autosaveable. 3166 if (!autosave) { 3167 return true; 3168 } 3169 3170 // To avoid an expensive content serialization, use the content dirtiness 3171 // flag in place of content field comparison against the known autosave. 3172 // This is not strictly accurate, and relies on a tolerance toward autosave 3173 // request failures for unnecessary saves. 3174 if (hasChangedContent(state)) { 3175 return true; 3176 } 3177 3178 // If title, excerpt, or meta have changed, the post is autosaveable. 3179 return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); 3180 }); 3181 3182 /** 3183 * Return true if the post being edited is being scheduled. Preferring the 3184 * unsaved status values. 3185 * 3186 * @param {Object} state Global application state. 3187 * 3188 * @return {boolean} Whether the post has been published. 3189 */ 3190 function isEditedPostBeingScheduled(state) { 3191 const date = getEditedPostAttribute(state, 'date'); 3192 // Offset the date by one minute (network latency). 3193 const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); 3194 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); 3195 } 3196 3197 /** 3198 * Returns whether the current post should be considered to have a "floating" 3199 * date (i.e. that it would publish "Immediately" rather than at a set time). 3200 * 3201 * Unlike in the PHP backend, the REST API returns a full date string for posts 3202 * where the 0000-00-00T00:00:00 placeholder is present in the database. To 3203 * infer that a post is set to publish "Immediately" we check whether the date 3204 * and modified date are the same. 3205 * 3206 * @param {Object} state Editor state. 3207 * 3208 * @return {boolean} Whether the edited post has a floating date value. 3209 */ 3210 function isEditedPostDateFloating(state) { 3211 const date = getEditedPostAttribute(state, 'date'); 3212 const modified = getEditedPostAttribute(state, 'modified'); 3213 3214 // This should be the status of the persisted post 3215 // It shouldn't use the "edited" status otherwise it breaks the 3216 // inferred post data floating status 3217 // See https://github.com/WordPress/gutenberg/issues/28083. 3218 const status = getCurrentPost(state).status; 3219 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { 3220 return date === modified || date === null; 3221 } 3222 return false; 3223 } 3224 3225 /** 3226 * Returns true if the post is currently being deleted, or false otherwise. 3227 * 3228 * @param {Object} state Editor state. 3229 * 3230 * @return {boolean} Whether post is being deleted. 3231 */ 3232 function isDeletingPost(state) { 3233 return !!state.deleting.pending; 3234 } 3235 3236 /** 3237 * Returns true if the post is currently being saved, or false otherwise. 3238 * 3239 * @param {Object} state Global application state. 3240 * 3241 * @return {boolean} Whether post is being saved. 3242 */ 3243 function isSavingPost(state) { 3244 return !!state.saving.pending; 3245 } 3246 3247 /** 3248 * Returns true if non-post entities are currently being saved, or false otherwise. 3249 * 3250 * @param {Object} state Global application state. 3251 * 3252 * @return {boolean} Whether non-post entities are being saved. 3253 */ 3254 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3255 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); 3256 const { 3257 type, 3258 id 3259 } = getCurrentPost(state); 3260 return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 3261 }); 3262 3263 /** 3264 * Returns true if a previous post save was attempted successfully, or false 3265 * otherwise. 3266 * 3267 * @param {Object} state Global application state. 3268 * 3269 * @return {boolean} Whether the post was saved successfully. 3270 */ 3271 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3272 const postType = getCurrentPostType(state); 3273 const postId = getCurrentPostId(state); 3274 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3275 }); 3276 3277 /** 3278 * Returns true if a previous post save was attempted but failed, or false 3279 * otherwise. 3280 * 3281 * @param {Object} state Global application state. 3282 * 3283 * @return {boolean} Whether the post save failed. 3284 */ 3285 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3286 const postType = getCurrentPostType(state); 3287 const postId = getCurrentPostId(state); 3288 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3289 }); 3290 3291 /** 3292 * Returns true if the post is autosaving, or false otherwise. 3293 * 3294 * @param {Object} state Global application state. 3295 * 3296 * @return {boolean} Whether the post is autosaving. 3297 */ 3298 function isAutosavingPost(state) { 3299 return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); 3300 } 3301 3302 /** 3303 * Returns true if the post is being previewed, or false otherwise. 3304 * 3305 * @param {Object} state Global application state. 3306 * 3307 * @return {boolean} Whether the post is being previewed. 3308 */ 3309 function isPreviewingPost(state) { 3310 return isSavingPost(state) && Boolean(state.saving.options?.isPreview); 3311 } 3312 3313 /** 3314 * Returns the post preview link 3315 * 3316 * @param {Object} state Global application state. 3317 * 3318 * @return {string | undefined} Preview Link. 3319 */ 3320 function getEditedPostPreviewLink(state) { 3321 if (state.saving.pending || isSavingPost(state)) { 3322 return; 3323 } 3324 let previewLink = getAutosaveAttribute(state, 'preview_link'); 3325 // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 3326 // If the post is draft, ignore the preview link from the autosave record, 3327 // because the preview could be a stale autosave if the post was switched from 3328 // published to draft. 3329 // See: https://github.com/WordPress/gutenberg/pull/37952. 3330 if (!previewLink || 'draft' === getCurrentPost(state).status) { 3331 previewLink = getEditedPostAttribute(state, 'link'); 3332 if (previewLink) { 3333 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3334 preview: true 3335 }); 3336 } 3337 } 3338 const featuredImageId = getEditedPostAttribute(state, 'featured_media'); 3339 if (previewLink && featuredImageId) { 3340 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3341 _thumbnail_id: featuredImageId 3342 }); 3343 } 3344 return previewLink; 3345 } 3346 3347 /** 3348 * Returns a suggested post format for the current post, inferred only if there 3349 * is a single block within the post and it is of a type known to match a 3350 * default post format. Returns null if the format cannot be determined. 3351 * 3352 * @return {?string} Suggested post format. 3353 */ 3354 const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3355 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); 3356 if (blocks.length > 2) { 3357 return null; 3358 } 3359 let name; 3360 // If there is only one block in the content of the post grab its name 3361 // so we can derive a suitable post format from it. 3362 if (blocks.length === 1) { 3363 name = blocks[0].name; 3364 // Check for core/embed `video` and `audio` eligible suggestions. 3365 if (name === 'core/embed') { 3366 const provider = blocks[0].attributes?.providerNameSlug; 3367 if (['youtube', 'vimeo'].includes(provider)) { 3368 name = 'core/video'; 3369 } else if (['spotify', 'soundcloud'].includes(provider)) { 3370 name = 'core/audio'; 3371 } 3372 } 3373 } 3374 3375 // If there are two blocks in the content and the last one is a text blocks 3376 // grab the name of the first one to also suggest a post format from it. 3377 if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { 3378 name = blocks[0].name; 3379 } 3380 3381 // We only convert to default post formats in core. 3382 switch (name) { 3383 case 'core/image': 3384 return 'image'; 3385 case 'core/quote': 3386 case 'core/pullquote': 3387 return 'quote'; 3388 case 'core/gallery': 3389 return 'gallery'; 3390 case 'core/video': 3391 return 'video'; 3392 case 'core/audio': 3393 return 'audio'; 3394 default: 3395 return null; 3396 } 3397 }); 3398 3399 /** 3400 * Returns the content of the post being edited. 3401 * 3402 * @param {Object} state Global application state. 3403 * 3404 * @return {string} Post content. 3405 */ 3406 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3407 const postId = getCurrentPostId(state); 3408 const postType = getCurrentPostType(state); 3409 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 3410 if (record) { 3411 if (typeof record.content === 'function') { 3412 return record.content(record); 3413 } else if (record.blocks) { 3414 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 3415 } else if (record.content) { 3416 return record.content; 3417 } 3418 } 3419 return ''; 3420 }); 3421 3422 /** 3423 * Returns true if the post is being published, or false otherwise. 3424 * 3425 * @param {Object} state Global application state. 3426 * 3427 * @return {boolean} Whether post is being published. 3428 */ 3429 function isPublishingPost(state) { 3430 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; 3431 } 3432 3433 /** 3434 * Returns whether the permalink is editable or not. 3435 * 3436 * @param {Object} state Editor state. 3437 * 3438 * @return {boolean} Whether or not the permalink is editable. 3439 */ 3440 function isPermalinkEditable(state) { 3441 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3442 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 3443 } 3444 3445 /** 3446 * Returns the permalink for the post. 3447 * 3448 * @param {Object} state Editor state. 3449 * 3450 * @return {?string} The permalink, or null if the post is not viewable. 3451 */ 3452 function getPermalink(state) { 3453 const permalinkParts = getPermalinkParts(state); 3454 if (!permalinkParts) { 3455 return null; 3456 } 3457 const { 3458 prefix, 3459 postName, 3460 suffix 3461 } = permalinkParts; 3462 if (isPermalinkEditable(state)) { 3463 return prefix + postName + suffix; 3464 } 3465 return prefix; 3466 } 3467 3468 /** 3469 * Returns the slug for the post being edited, preferring a manually edited 3470 * value if one exists, then a sanitized version of the current post title, and 3471 * finally the post ID. 3472 * 3473 * @param {Object} state Editor state. 3474 * 3475 * @return {string} The current slug to be displayed in the editor 3476 */ 3477 function getEditedPostSlug(state) { 3478 return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); 3479 } 3480 3481 /** 3482 * Returns the permalink for a post, split into its three parts: the prefix, 3483 * the postName, and the suffix. 3484 * 3485 * @param {Object} state Editor state. 3486 * 3487 * @return {Object} An object containing the prefix, postName, and suffix for 3488 * the permalink, or null if the post is not viewable. 3489 */ 3490 function getPermalinkParts(state) { 3491 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3492 if (!permalinkTemplate) { 3493 return null; 3494 } 3495 const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); 3496 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 3497 return { 3498 prefix, 3499 postName, 3500 suffix 3501 }; 3502 } 3503 3504 /** 3505 * Returns whether the post is locked. 3506 * 3507 * @param {Object} state Global application state. 3508 * 3509 * @return {boolean} Is locked. 3510 */ 3511 function isPostLocked(state) { 3512 return state.postLock.isLocked; 3513 } 3514 3515 /** 3516 * Returns whether post saving is locked. 3517 * 3518 * @param {Object} state Global application state. 3519 * 3520 * @return {boolean} Is locked. 3521 */ 3522 function isPostSavingLocked(state) { 3523 return Object.keys(state.postSavingLock).length > 0; 3524 } 3525 3526 /** 3527 * Returns whether post autosaving is locked. 3528 * 3529 * @param {Object} state Global application state. 3530 * 3531 * @return {boolean} Is locked. 3532 */ 3533 function isPostAutosavingLocked(state) { 3534 return Object.keys(state.postAutosavingLock).length > 0; 3535 } 3536 3537 /** 3538 * Returns whether the edition of the post has been taken over. 3539 * 3540 * @param {Object} state Global application state. 3541 * 3542 * @return {boolean} Is post lock takeover. 3543 */ 3544 function isPostLockTakeover(state) { 3545 return state.postLock.isTakeover; 3546 } 3547 3548 /** 3549 * Returns details about the post lock user. 3550 * 3551 * @param {Object} state Global application state. 3552 * 3553 * @return {Object} A user object. 3554 */ 3555 function getPostLockUser(state) { 3556 return state.postLock.user; 3557 } 3558 3559 /** 3560 * Returns the active post lock. 3561 * 3562 * @param {Object} state Global application state. 3563 * 3564 * @return {Object} The lock object. 3565 */ 3566 function getActivePostLock(state) { 3567 return state.postLock.activePostLock; 3568 } 3569 3570 /** 3571 * Returns whether or not the user has the unfiltered_html capability. 3572 * 3573 * @param {Object} state Editor state. 3574 * 3575 * @return {boolean} Whether the user can or can't post unfiltered HTML. 3576 */ 3577 function canUserUseUnfilteredHTML(state) { 3578 return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html')); 3579 } 3580 3581 /** 3582 * Returns whether the pre-publish panel should be shown 3583 * or skipped when the user clicks the "publish" button. 3584 * 3585 * @return {boolean} Whether the pre-publish panel should be shown or not. 3586 */ 3587 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled')); 3588 3589 /** 3590 * Return the current block list. 3591 * 3592 * @param {Object} state 3593 * @return {Array} Block list. 3594 */ 3595 const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { 3596 return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); 3597 }, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]); 3598 3599 /** 3600 * Returns true if the given panel was programmatically removed, or false otherwise. 3601 * All panels are not removed by default. 3602 * 3603 * @param {Object} state Global application state. 3604 * @param {string} panelName A string that identifies the panel. 3605 * 3606 * @return {boolean} Whether or not the panel is removed. 3607 */ 3608 function isEditorPanelRemoved(state, panelName) { 3609 return state.removedPanels.includes(panelName); 3610 } 3611 3612 /** 3613 * Returns true if the given panel is enabled, or false otherwise. Panels are 3614 * enabled by default. 3615 * 3616 * @param {Object} state Global application state. 3617 * @param {string} panelName A string that identifies the panel. 3618 * 3619 * @return {boolean} Whether or not the panel is enabled. 3620 */ 3621 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3622 // For backward compatibility, we check edit-post 3623 // even though now this is in "editor" package. 3624 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); 3625 return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); 3626 }); 3627 3628 /** 3629 * Returns true if the given panel is open, or false otherwise. Panels are 3630 * closed by default. 3631 * 3632 * @param {Object} state Global application state. 3633 * @param {string} panelName A string that identifies the panel. 3634 * 3635 * @return {boolean} Whether or not the panel is open. 3636 */ 3637 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3638 // For backward compatibility, we check edit-post 3639 // even though now this is in "editor" package. 3640 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); 3641 return !!openPanels?.includes(panelName); 3642 }); 3643 3644 /** 3645 * A block selection object. 3646 * 3647 * @typedef {Object} WPBlockSelection 3648 * 3649 * @property {string} clientId A block client ID. 3650 * @property {string} attributeKey A block attribute key. 3651 * @property {number} offset An attribute value offset, based on the rich 3652 * text value. See `wp.richText.create`. 3653 */ 3654 3655 /** 3656 * Returns the current selection start. 3657 * 3658 * @deprecated since Gutenberg 10.0.0. 3659 * 3660 * @param {Object} state 3661 * @return {WPBlockSelection} The selection start. 3662 */ 3663 function getEditorSelectionStart(state) { 3664 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3665 since: '5.8', 3666 alternative: "select('core/editor').getEditorSelection" 3667 }); 3668 return getEditedPostAttribute(state, 'selection')?.selectionStart; 3669 } 3670 3671 /** 3672 * Returns the current selection end. 3673 * 3674 * @deprecated since Gutenberg 10.0.0. 3675 * 3676 * @param {Object} state 3677 * @return {WPBlockSelection} The selection end. 3678 */ 3679 function getEditorSelectionEnd(state) { 3680 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3681 since: '5.8', 3682 alternative: "select('core/editor').getEditorSelection" 3683 }); 3684 return getEditedPostAttribute(state, 'selection')?.selectionEnd; 3685 } 3686 3687 /** 3688 * Returns the current selection. 3689 * 3690 * @param {Object} state 3691 * @return {WPBlockSelection} The selection end. 3692 */ 3693 function getEditorSelection(state) { 3694 return getEditedPostAttribute(state, 'selection'); 3695 } 3696 3697 /** 3698 * Is the editor ready 3699 * 3700 * @param {Object} state 3701 * @return {boolean} is Ready. 3702 */ 3703 function __unstableIsEditorReady(state) { 3704 return !!state.postId; 3705 } 3706 3707 /** 3708 * Returns the post editor settings. 3709 * 3710 * @param {Object} state Editor state. 3711 * 3712 * @return {Object} The editor settings object. 3713 */ 3714 function getEditorSettings(state) { 3715 return state.editorSettings; 3716 } 3717 3718 /** 3719 * Returns the post editor's rendering mode. 3720 * 3721 * @param {Object} state Editor state. 3722 * 3723 * @return {string} Rendering mode. 3724 */ 3725 function getRenderingMode(state) { 3726 return state.renderingMode; 3727 } 3728 3729 /** 3730 * Returns the current editing canvas device type. 3731 * 3732 * @param {Object} state Global application state. 3733 * 3734 * @return {string} Device type. 3735 */ 3736 const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3737 const isZoomOut = unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(); 3738 if (isZoomOut) { 3739 return 'Desktop'; 3740 } 3741 return state.deviceType; 3742 }); 3743 3744 /** 3745 * Returns true if the list view is opened. 3746 * 3747 * @param {Object} state Global application state. 3748 * 3749 * @return {boolean} Whether the list view is opened. 3750 */ 3751 function isListViewOpened(state) { 3752 return state.listViewPanel; 3753 } 3754 3755 /** 3756 * Returns true if the inserter is opened. 3757 * 3758 * @param {Object} state Global application state. 3759 * 3760 * @return {boolean} Whether the inserter is opened. 3761 */ 3762 function isInserterOpened(state) { 3763 return !!state.blockInserterPanel; 3764 } 3765 3766 /** 3767 * Returns the current editing mode. 3768 * 3769 * @param {Object} state Global application state. 3770 * 3771 * @return {string} Editing mode. 3772 */ 3773 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3774 var _select$get; 3775 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; 3776 }); 3777 3778 /* 3779 * Backward compatibility 3780 */ 3781 3782 /** 3783 * Returns state object prior to a specified optimist transaction ID, or `null` 3784 * if the transaction corresponding to the given ID cannot be found. 3785 * 3786 * @deprecated since Gutenberg 9.7.0. 3787 */ 3788 function getStateBeforeOptimisticTransaction() { 3789 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 3790 since: '5.7', 3791 hint: 'No state history is kept on this store anymore' 3792 }); 3793 return null; 3794 } 3795 /** 3796 * Returns true if an optimistic transaction is pending commit, for which the 3797 * before state satisfies the given predicate function. 3798 * 3799 * @deprecated since Gutenberg 9.7.0. 3800 */ 3801 function inSomeHistory() { 3802 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 3803 since: '5.7', 3804 hint: 'No state history is kept on this store anymore' 3805 }); 3806 return false; 3807 } 3808 function getBlockEditorSelector(name) { 3809 return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => { 3810 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { 3811 since: '5.3', 3812 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', 3813 version: '6.2' 3814 }); 3815 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); 3816 }); 3817 } 3818 3819 /** 3820 * @see getBlockName in core/block-editor store. 3821 */ 3822 const getBlockName = getBlockEditorSelector('getBlockName'); 3823 3824 /** 3825 * @see isBlockValid in core/block-editor store. 3826 */ 3827 const isBlockValid = getBlockEditorSelector('isBlockValid'); 3828 3829 /** 3830 * @see getBlockAttributes in core/block-editor store. 3831 */ 3832 const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); 3833 3834 /** 3835 * @see getBlock in core/block-editor store. 3836 */ 3837 const getBlock = getBlockEditorSelector('getBlock'); 3838 3839 /** 3840 * @see getBlocks in core/block-editor store. 3841 */ 3842 const getBlocks = getBlockEditorSelector('getBlocks'); 3843 3844 /** 3845 * @see getClientIdsOfDescendants in core/block-editor store. 3846 */ 3847 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); 3848 3849 /** 3850 * @see getClientIdsWithDescendants in core/block-editor store. 3851 */ 3852 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); 3853 3854 /** 3855 * @see getGlobalBlockCount in core/block-editor store. 3856 */ 3857 const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); 3858 3859 /** 3860 * @see getBlocksByClientId in core/block-editor store. 3861 */ 3862 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); 3863 3864 /** 3865 * @see getBlockCount in core/block-editor store. 3866 */ 3867 const getBlockCount = getBlockEditorSelector('getBlockCount'); 3868 3869 /** 3870 * @see getBlockSelectionStart in core/block-editor store. 3871 */ 3872 const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); 3873 3874 /** 3875 * @see getBlockSelectionEnd in core/block-editor store. 3876 */ 3877 const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); 3878 3879 /** 3880 * @see getSelectedBlockCount in core/block-editor store. 3881 */ 3882 const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); 3883 3884 /** 3885 * @see hasSelectedBlock in core/block-editor store. 3886 */ 3887 const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); 3888 3889 /** 3890 * @see getSelectedBlockClientId in core/block-editor store. 3891 */ 3892 const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); 3893 3894 /** 3895 * @see getSelectedBlock in core/block-editor store. 3896 */ 3897 const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); 3898 3899 /** 3900 * @see getBlockRootClientId in core/block-editor store. 3901 */ 3902 const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); 3903 3904 /** 3905 * @see getBlockHierarchyRootClientId in core/block-editor store. 3906 */ 3907 const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); 3908 3909 /** 3910 * @see getAdjacentBlockClientId in core/block-editor store. 3911 */ 3912 const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); 3913 3914 /** 3915 * @see getPreviousBlockClientId in core/block-editor store. 3916 */ 3917 const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); 3918 3919 /** 3920 * @see getNextBlockClientId in core/block-editor store. 3921 */ 3922 const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); 3923 3924 /** 3925 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. 3926 */ 3927 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); 3928 3929 /** 3930 * @see getMultiSelectedBlockClientIds in core/block-editor store. 3931 */ 3932 const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); 3933 3934 /** 3935 * @see getMultiSelectedBlocks in core/block-editor store. 3936 */ 3937 const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); 3938 3939 /** 3940 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. 3941 */ 3942 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); 3943 3944 /** 3945 * @see getLastMultiSelectedBlockClientId in core/block-editor store. 3946 */ 3947 const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); 3948 3949 /** 3950 * @see isFirstMultiSelectedBlock in core/block-editor store. 3951 */ 3952 const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); 3953 3954 /** 3955 * @see isBlockMultiSelected in core/block-editor store. 3956 */ 3957 const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); 3958 3959 /** 3960 * @see isAncestorMultiSelected in core/block-editor store. 3961 */ 3962 const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); 3963 3964 /** 3965 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. 3966 */ 3967 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); 3968 3969 /** 3970 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. 3971 */ 3972 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); 3973 3974 /** 3975 * @see getBlockOrder in core/block-editor store. 3976 */ 3977 const getBlockOrder = getBlockEditorSelector('getBlockOrder'); 3978 3979 /** 3980 * @see getBlockIndex in core/block-editor store. 3981 */ 3982 const getBlockIndex = getBlockEditorSelector('getBlockIndex'); 3983 3984 /** 3985 * @see isBlockSelected in core/block-editor store. 3986 */ 3987 const isBlockSelected = getBlockEditorSelector('isBlockSelected'); 3988 3989 /** 3990 * @see hasSelectedInnerBlock in core/block-editor store. 3991 */ 3992 const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); 3993 3994 /** 3995 * @see isBlockWithinSelection in core/block-editor store. 3996 */ 3997 const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); 3998 3999 /** 4000 * @see hasMultiSelection in core/block-editor store. 4001 */ 4002 const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); 4003 4004 /** 4005 * @see isMultiSelecting in core/block-editor store. 4006 */ 4007 const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); 4008 4009 /** 4010 * @see isSelectionEnabled in core/block-editor store. 4011 */ 4012 const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); 4013 4014 /** 4015 * @see getBlockMode in core/block-editor store. 4016 */ 4017 const getBlockMode = getBlockEditorSelector('getBlockMode'); 4018 4019 /** 4020 * @see isTyping in core/block-editor store. 4021 */ 4022 const isTyping = getBlockEditorSelector('isTyping'); 4023 4024 /** 4025 * @see isCaretWithinFormattedText in core/block-editor store. 4026 */ 4027 const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); 4028 4029 /** 4030 * @see getBlockInsertionPoint in core/block-editor store. 4031 */ 4032 const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); 4033 4034 /** 4035 * @see isBlockInsertionPointVisible in core/block-editor store. 4036 */ 4037 const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); 4038 4039 /** 4040 * @see isValidTemplate in core/block-editor store. 4041 */ 4042 const isValidTemplate = getBlockEditorSelector('isValidTemplate'); 4043 4044 /** 4045 * @see getTemplate in core/block-editor store. 4046 */ 4047 const getTemplate = getBlockEditorSelector('getTemplate'); 4048 4049 /** 4050 * @see getTemplateLock in core/block-editor store. 4051 */ 4052 const getTemplateLock = getBlockEditorSelector('getTemplateLock'); 4053 4054 /** 4055 * @see canInsertBlockType in core/block-editor store. 4056 */ 4057 const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); 4058 4059 /** 4060 * @see getInserterItems in core/block-editor store. 4061 */ 4062 const getInserterItems = getBlockEditorSelector('getInserterItems'); 4063 4064 /** 4065 * @see hasInserterItems in core/block-editor store. 4066 */ 4067 const hasInserterItems = getBlockEditorSelector('hasInserterItems'); 4068 4069 /** 4070 * @see getBlockListSettings in core/block-editor store. 4071 */ 4072 const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); 4073 const __experimentalGetDefaultTemplateTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 4074 external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplateTypes", { 4075 since: '6.8', 4076 alternative: "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_types" 4077 }); 4078 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_types; 4079 }); 4080 4081 /** 4082 * Returns the default template part areas. 4083 * 4084 * @param {Object} state Global application state. 4085 * 4086 * @return {Array} The template part areas. 4087 */ 4088 const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { 4089 external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplatePartAreas", { 4090 since: '6.8', 4091 alternative: "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_part_areas" 4092 }); 4093 const areas = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || []; 4094 return areas.map(item => { 4095 return { 4096 ...item, 4097 icon: getTemplatePartIcon(item.icon) 4098 }; 4099 }); 4100 })); 4101 4102 /** 4103 * Returns a default template type searched by slug. 4104 * 4105 * @param {Object} state Global application state. 4106 * @param {string} slug The template type slug. 4107 * 4108 * @return {Object} The template type. 4109 */ 4110 const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { 4111 var _Object$values$find; 4112 external_wp_deprecated_default()("select('core/editor').__experimentalGetDefaultTemplateType", { 4113 since: '6.8' 4114 }); 4115 const templateTypes = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_types; 4116 if (!templateTypes) { 4117 return selectors_EMPTY_OBJECT; 4118 } 4119 return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : selectors_EMPTY_OBJECT; 4120 })); 4121 4122 /** 4123 * Given a template entity, return information about it which is ready to be 4124 * rendered, such as the title, description, and icon. 4125 * 4126 * @param {Object} state Global application state. 4127 * @param {Object} template The template for which we need information. 4128 * @return {Object} Information about the template, including title, description, and icon. 4129 */ 4130 const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, template) => { 4131 external_wp_deprecated_default()("select('core/editor').__experimentalGetTemplateInfo", { 4132 since: '6.8' 4133 }); 4134 if (!template) { 4135 return selectors_EMPTY_OBJECT; 4136 } 4137 const templateTypes = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_types || []; 4138 const templateAreas = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || []; 4139 return getTemplateInfo({ 4140 template, 4141 templateAreas, 4142 templateTypes 4143 }); 4144 })); 4145 4146 /** 4147 * Returns a post type label depending on the current post. 4148 * 4149 * @param {Object} state Global application state. 4150 * 4151 * @return {string|undefined} The post type label if available, otherwise undefined. 4152 */ 4153 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 4154 const currentPostType = getCurrentPostType(state); 4155 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); 4156 // Disable reason: Post type labels object is shaped like this. 4157 // eslint-disable-next-line camelcase 4158 return postType?.labels?.singular_name; 4159 }); 4160 4161 /** 4162 * Returns true if the publish sidebar is opened. 4163 * 4164 * @param {Object} state Global application state 4165 * 4166 * @return {boolean} Whether the publish sidebar is open. 4167 */ 4168 function isPublishSidebarOpened(state) { 4169 return state.publishSidebarActive; 4170 } 4171 4172 ;// external ["wp","a11y"] 4173 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 4174 ;// external ["wp","apiFetch"] 4175 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 4176 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 4177 ;// external ["wp","notices"] 4178 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 4179 ;// external ["wp","i18n"] 4180 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 4181 ;// ./node_modules/@wordpress/editor/build-module/store/local-autosave.js 4182 /** 4183 * Function returning a sessionStorage key to set or retrieve a given post's 4184 * automatic session backup. 4185 * 4186 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's 4187 * `loggedout` handler can clear sessionStorage of any user-private content. 4188 * 4189 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 4190 * 4191 * @param {string} postId Post ID. 4192 * @param {boolean} isPostNew Whether post new. 4193 * 4194 * @return {string} sessionStorage key 4195 */ 4196 function postKey(postId, isPostNew) { 4197 return `wp-autosave-block-editor-post-$isPostNew ? 'auto-draft' : postId}`; 4198 } 4199 function localAutosaveGet(postId, isPostNew) { 4200 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 4201 } 4202 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 4203 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ 4204 post_title: title, 4205 content, 4206 excerpt 4207 })); 4208 } 4209 function localAutosaveClear(postId, isPostNew) { 4210 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 4211 } 4212 4213 ;// ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 4214 /** 4215 * WordPress dependencies 4216 */ 4217 4218 4219 /** 4220 * Builds the arguments for a success notification dispatch. 4221 * 4222 * @param {Object} data Incoming data to build the arguments from. 4223 * 4224 * @return {Array} Arguments for dispatch. An empty array signals no 4225 * notification should be sent. 4226 */ 4227 function getNotificationArgumentsForSaveSuccess(data) { 4228 var _postType$viewable; 4229 const { 4230 previousPost, 4231 post, 4232 postType 4233 } = data; 4234 // Autosaves are neither shown a notice nor redirected. 4235 if (data.options?.isAutosave) { 4236 return []; 4237 } 4238 const publishStatus = ['publish', 'private', 'future']; 4239 const isPublished = publishStatus.includes(previousPost.status); 4240 const willPublish = publishStatus.includes(post.status); 4241 const willTrash = post.status === 'trash' && previousPost.status !== 'trash'; 4242 let noticeMessage; 4243 let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; 4244 let isDraft; 4245 4246 // Always should a notice, which will be spoken for accessibility. 4247 if (willTrash) { 4248 noticeMessage = postType.labels.item_trashed; 4249 shouldShowLink = false; 4250 } else if (!isPublished && !willPublish) { 4251 // If saving a non-published post, don't show notice. 4252 noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); 4253 isDraft = true; 4254 } else if (isPublished && !willPublish) { 4255 // If undoing publish status, show specific notice. 4256 noticeMessage = postType.labels.item_reverted_to_draft; 4257 shouldShowLink = false; 4258 } else if (!isPublished && willPublish) { 4259 // If publishing or scheduling a post, show the corresponding 4260 // publish message. 4261 noticeMessage = { 4262 publish: postType.labels.item_published, 4263 private: postType.labels.item_published_privately, 4264 future: postType.labels.item_scheduled 4265 }[post.status]; 4266 } else { 4267 // Generic fallback notice. 4268 noticeMessage = postType.labels.item_updated; 4269 } 4270 const actions = []; 4271 if (shouldShowLink) { 4272 actions.push({ 4273 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, 4274 url: post.link 4275 }); 4276 } 4277 return [noticeMessage, { 4278 id: 'editor-save', 4279 type: 'snackbar', 4280 actions 4281 }]; 4282 } 4283 4284 /** 4285 * Builds the fail notification arguments for dispatch. 4286 * 4287 * @param {Object} data Incoming data to build the arguments with. 4288 * 4289 * @return {Array} Arguments for dispatch. An empty array signals no 4290 * notification should be sent. 4291 */ 4292 function getNotificationArgumentsForSaveFail(data) { 4293 const { 4294 post, 4295 edits, 4296 error 4297 } = data; 4298 if (error && 'rest_autosave_no_changes' === error.code) { 4299 // Autosave requested a new autosave, but there were no changes. This shouldn't 4300 // result in an error notice for the user. 4301 return []; 4302 } 4303 const publishStatus = ['publish', 'private', 'future']; 4304 const isPublished = publishStatus.indexOf(post.status) !== -1; 4305 // If the post was being published, we show the corresponding publish error message 4306 // Unless we publish an "updating failed" message. 4307 const messages = { 4308 publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4309 private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4310 future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') 4311 }; 4312 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); 4313 4314 // Check if message string contains HTML. Notice text is currently only 4315 // supported as plaintext, and stripping the tags may muddle the meaning. 4316 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 4317 noticeMessage = [noticeMessage, error.message].join(' '); 4318 } 4319 return [noticeMessage, { 4320 id: 'editor-save' 4321 }]; 4322 } 4323 4324 /** 4325 * Builds the trash fail notification arguments for dispatch. 4326 * 4327 * @param {Object} data 4328 * 4329 * @return {Array} Arguments for dispatch. 4330 */ 4331 function getNotificationArgumentsForTrashFail(data) { 4332 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { 4333 id: 'editor-trash-fail' 4334 }]; 4335 } 4336 4337 ;// ./node_modules/@wordpress/editor/build-module/store/actions.js 4338 /* wp:polyfill */ 4339 /** 4340 * WordPress dependencies 4341 */ 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 /** 4354 * Internal dependencies 4355 */ 4356 4357 4358 4359 /** 4360 * Returns an action generator used in signalling that editor has initialized with 4361 * the specified post object and editor settings. 4362 * 4363 * @param {Object} post Post object. 4364 * @param {Object} edits Initial edited attributes object. 4365 * @param {Array} [template] Block Template. 4366 */ 4367 const setupEditor = (post, edits, template) => ({ 4368 dispatch 4369 }) => { 4370 dispatch.setEditedPost(post.type, post.id); 4371 // Apply a template for new posts only, if exists. 4372 const isNewPost = post.status === 'auto-draft'; 4373 if (isNewPost && template) { 4374 // In order to ensure maximum of a single parse during setup, edits are 4375 // included as part of editor setup action. Assume edited content as 4376 // canonical if provided, falling back to post. 4377 let content; 4378 if ('content' in edits) { 4379 content = edits.content; 4380 } else { 4381 content = post.content.raw; 4382 } 4383 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); 4384 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); 4385 dispatch.resetEditorBlocks(blocks, { 4386 __unstableShouldCreateUndoLevel: false 4387 }); 4388 } 4389 if (edits && Object.values(edits).some(([key, edit]) => { 4390 var _post$key$raw; 4391 return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); 4392 })) { 4393 dispatch.editPost(edits); 4394 } 4395 }; 4396 4397 /** 4398 * Returns an action object signalling that the editor is being destroyed and 4399 * that any necessary state or side-effect cleanup should occur. 4400 * 4401 * @deprecated 4402 * 4403 * @return {Object} Action object. 4404 */ 4405 function __experimentalTearDownEditor() { 4406 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", { 4407 since: '6.5' 4408 }); 4409 return { 4410 type: 'DO_NOTHING' 4411 }; 4412 } 4413 4414 /** 4415 * Returns an action object used in signalling that the latest version of the 4416 * post has been received, either by initialization or save. 4417 * 4418 * @deprecated Since WordPress 6.0. 4419 */ 4420 function resetPost() { 4421 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { 4422 since: '6.0', 4423 version: '6.3', 4424 alternative: 'Initialize the editor with the setupEditorState action' 4425 }); 4426 return { 4427 type: 'DO_NOTHING' 4428 }; 4429 } 4430 4431 /** 4432 * Returns an action object used in signalling that a patch of updates for the 4433 * latest version of the post have been received. 4434 * 4435 * @return {Object} Action object. 4436 * @deprecated since Gutenberg 9.7.0. 4437 */ 4438 function updatePost() { 4439 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 4440 since: '5.7', 4441 alternative: 'Use the core entities store instead' 4442 }); 4443 return { 4444 type: 'DO_NOTHING' 4445 }; 4446 } 4447 4448 /** 4449 * Setup the editor state. 4450 * 4451 * @deprecated 4452 * 4453 * @param {Object} post Post object. 4454 */ 4455 function setupEditorState(post) { 4456 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { 4457 since: '6.5', 4458 alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" 4459 }); 4460 return setEditedPost(post.type, post.id); 4461 } 4462 4463 /** 4464 * Returns an action that sets the current post Type and post ID. 4465 * 4466 * @param {string} postType Post Type. 4467 * @param {string} postId Post ID. 4468 * 4469 * @return {Object} Action object. 4470 */ 4471 function setEditedPost(postType, postId) { 4472 return { 4473 type: 'SET_EDITED_POST', 4474 postType, 4475 postId 4476 }; 4477 } 4478 4479 /** 4480 * Returns an action object used in signalling that attributes of the post have 4481 * been edited. 4482 * 4483 * @param {Object} edits Post attributes to edit. 4484 * @param {Object} [options] Options for the edit. 4485 * 4486 * @example 4487 * ```js 4488 * // Update the post title 4489 * wp.data.dispatch( 'core/editor' ).editPost( { title: `${ newTitle }` } ); 4490 * ``` 4491 * 4492 * @example 4493 *```js 4494 * // Get specific media size based on the featured media ID 4495 * // Note: change sizes?.large for any registered size 4496 * const getFeaturedMediaUrl = useSelect( ( select ) => { 4497 * const getFeaturedMediaId = 4498 * select( 'core/editor' ).getEditedPostAttribute( 'featured_media' ); 4499 * const getMedia = select( 'core' ).getMedia( getFeaturedMediaId ); 4500 * 4501 * return ( 4502 * getMedia?.media_details?.sizes?.large?.source_url || getMedia?.source_url || '' 4503 * ); 4504 * }, [] ); 4505 * ``` 4506 * 4507 * @return {Object} Action object 4508 */ 4509 const editPost = (edits, options) => ({ 4510 select, 4511 registry 4512 }) => { 4513 const { 4514 id, 4515 type 4516 } = select.getCurrentPost(); 4517 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); 4518 }; 4519 4520 /** 4521 * Action for saving the current post in the editor. 4522 * 4523 * @param {Object} [options] 4524 */ 4525 const savePost = (options = {}) => async ({ 4526 select, 4527 dispatch, 4528 registry 4529 }) => { 4530 if (!select.isEditedPostSaveable()) { 4531 return; 4532 } 4533 const content = select.getEditedPostContent(); 4534 if (!options.isAutosave) { 4535 dispatch.editPost({ 4536 content 4537 }, { 4538 undoIgnore: true 4539 }); 4540 } 4541 const previousRecord = select.getCurrentPost(); 4542 let edits = { 4543 id: previousRecord.id, 4544 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), 4545 content 4546 }; 4547 dispatch({ 4548 type: 'REQUEST_POST_UPDATE_START', 4549 options 4550 }); 4551 let error = false; 4552 try { 4553 edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)('editor.preSavePost', edits, options); 4554 } catch (err) { 4555 error = err; 4556 } 4557 if (!error) { 4558 try { 4559 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); 4560 } catch (err) { 4561 error = err.message && err.code !== 'unknown_error' ? err.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating.'); 4562 } 4563 } 4564 if (!error) { 4565 error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); 4566 } 4567 4568 // Run the hook with legacy unstable name for backward compatibility 4569 if (!error) { 4570 try { 4571 await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options); 4572 } catch (err) { 4573 error = err; 4574 } 4575 } 4576 if (!error) { 4577 try { 4578 await (0,external_wp_hooks_namespaceObject.doActionAsync)('editor.savePost', { 4579 id: previousRecord.id 4580 }, options); 4581 } catch (err) { 4582 error = err; 4583 } 4584 } 4585 dispatch({ 4586 type: 'REQUEST_POST_UPDATE_FINISH', 4587 options 4588 }); 4589 if (error) { 4590 const args = getNotificationArgumentsForSaveFail({ 4591 post: previousRecord, 4592 edits, 4593 error 4594 }); 4595 if (args.length) { 4596 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); 4597 } 4598 } else { 4599 const updatedRecord = select.getCurrentPost(); 4600 const args = getNotificationArgumentsForSaveSuccess({ 4601 previousPost: previousRecord, 4602 post: updatedRecord, 4603 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), 4604 options 4605 }); 4606 if (args.length) { 4607 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); 4608 } 4609 // Make sure that any edits after saving create an undo level and are 4610 // considered for change detection. 4611 if (!options.isAutosave) { 4612 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 4613 } 4614 } 4615 }; 4616 4617 /** 4618 * Action for refreshing the current post. 4619 * 4620 * @deprecated Since WordPress 6.0. 4621 */ 4622 function refreshPost() { 4623 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { 4624 since: '6.0', 4625 version: '6.3', 4626 alternative: 'Use the core entities store instead' 4627 }); 4628 return { 4629 type: 'DO_NOTHING' 4630 }; 4631 } 4632 4633 /** 4634 * Action for trashing the current post in the editor. 4635 */ 4636 const trashPost = () => async ({ 4637 select, 4638 dispatch, 4639 registry 4640 }) => { 4641 const postTypeSlug = select.getCurrentPostType(); 4642 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 4643 const { 4644 rest_base: restBase, 4645 rest_namespace: restNamespace = 'wp/v2' 4646 } = postType; 4647 dispatch({ 4648 type: 'REQUEST_POST_DELETE_START' 4649 }); 4650 try { 4651 const post = select.getCurrentPost(); 4652 await external_wp_apiFetch_default()({ 4653 path: `/$restNamespace}/$restBase}/$post.id}`, 4654 method: 'DELETE' 4655 }); 4656 await dispatch.savePost(); 4657 } catch (error) { 4658 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ 4659 error 4660 })); 4661 } 4662 dispatch({ 4663 type: 'REQUEST_POST_DELETE_FINISH' 4664 }); 4665 }; 4666 4667 /** 4668 * Action that autosaves the current post. This 4669 * includes server-side autosaving (default) and client-side (a.k.a. local) 4670 * autosaving (e.g. on the Web, the post might be committed to Session 4671 * Storage). 4672 * 4673 * @param {Object} [options] Extra flags to identify the autosave. 4674 * @param {boolean} [options.local] Whether to perform a local autosave. 4675 */ 4676 const autosave = ({ 4677 local = false, 4678 ...options 4679 } = {}) => async ({ 4680 select, 4681 dispatch 4682 }) => { 4683 const post = select.getCurrentPost(); 4684 4685 // Currently template autosaving is not supported. 4686 if (post.type === 'wp_template') { 4687 return; 4688 } 4689 if (local) { 4690 const isPostNew = select.isEditedPostNew(); 4691 const title = select.getEditedPostAttribute('title'); 4692 const content = select.getEditedPostAttribute('content'); 4693 const excerpt = select.getEditedPostAttribute('excerpt'); 4694 localAutosaveSet(post.id, isPostNew, title, content, excerpt); 4695 } else { 4696 await dispatch.savePost({ 4697 isAutosave: true, 4698 ...options 4699 }); 4700 } 4701 }; 4702 const __unstableSaveForPreview = ({ 4703 forceIsAutosaveable 4704 } = {}) => async ({ 4705 select, 4706 dispatch 4707 }) => { 4708 if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { 4709 const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status')); 4710 if (isDraft) { 4711 await dispatch.savePost({ 4712 isPreview: true 4713 }); 4714 } else { 4715 await dispatch.autosave({ 4716 isPreview: true 4717 }); 4718 } 4719 } 4720 return select.getEditedPostPreviewLink(); 4721 }; 4722 4723 /** 4724 * Action that restores last popped state in undo history. 4725 */ 4726 const redo = () => ({ 4727 registry 4728 }) => { 4729 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); 4730 }; 4731 4732 /** 4733 * Action that pops a record from undo history and undoes the edit. 4734 */ 4735 const undo = () => ({ 4736 registry 4737 }) => { 4738 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); 4739 }; 4740 4741 /** 4742 * Action that creates an undo history record. 4743 * 4744 * @deprecated Since WordPress 6.0 4745 */ 4746 function createUndoLevel() { 4747 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { 4748 since: '6.0', 4749 version: '6.3', 4750 alternative: 'Use the core entities store instead' 4751 }); 4752 return { 4753 type: 'DO_NOTHING' 4754 }; 4755 } 4756 4757 /** 4758 * Action that locks the editor. 4759 * 4760 * @param {Object} lock Details about the post lock status, user, and nonce. 4761 * @return {Object} Action object. 4762 */ 4763 function updatePostLock(lock) { 4764 return { 4765 type: 'UPDATE_POST_LOCK', 4766 lock 4767 }; 4768 } 4769 4770 /** 4771 * Enable the publish sidebar. 4772 */ 4773 const enablePublishSidebar = () => ({ 4774 registry 4775 }) => { 4776 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true); 4777 }; 4778 4779 /** 4780 * Disables the publish sidebar. 4781 */ 4782 const disablePublishSidebar = () => ({ 4783 registry 4784 }) => { 4785 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false); 4786 }; 4787 4788 /** 4789 * Action that locks post saving. 4790 * 4791 * @param {string} lockName The lock name. 4792 * 4793 * @example 4794 * ``` 4795 * const { subscribe } = wp.data; 4796 * 4797 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4798 * 4799 * // Only allow publishing posts that are set to a future date. 4800 * if ( 'publish' !== initialPostStatus ) { 4801 * 4802 * // Track locking. 4803 * let locked = false; 4804 * 4805 * // Watch for the publish event. 4806 * let unssubscribe = subscribe( () => { 4807 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4808 * if ( 'publish' !== currentPostStatus ) { 4809 * 4810 * // Compare the post date to the current date, lock the post if the date isn't in the future. 4811 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); 4812 * const currentDate = new Date(); 4813 * if ( postDate.getTime() <= currentDate.getTime() ) { 4814 * if ( ! locked ) { 4815 * locked = true; 4816 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); 4817 * } 4818 * } else { 4819 * if ( locked ) { 4820 * locked = false; 4821 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); 4822 * } 4823 * } 4824 * } 4825 * } ); 4826 * } 4827 * ``` 4828 * 4829 * @return {Object} Action object 4830 */ 4831 function lockPostSaving(lockName) { 4832 return { 4833 type: 'LOCK_POST_SAVING', 4834 lockName 4835 }; 4836 } 4837 4838 /** 4839 * Action that unlocks post saving. 4840 * 4841 * @param {string} lockName The lock name. 4842 * 4843 * @example 4844 * ``` 4845 * // Unlock post saving with the lock key `mylock`: 4846 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); 4847 * ``` 4848 * 4849 * @return {Object} Action object 4850 */ 4851 function unlockPostSaving(lockName) { 4852 return { 4853 type: 'UNLOCK_POST_SAVING', 4854 lockName 4855 }; 4856 } 4857 4858 /** 4859 * Action that locks post autosaving. 4860 * 4861 * @param {string} lockName The lock name. 4862 * 4863 * @example 4864 * ``` 4865 * // Lock post autosaving with the lock key `mylock`: 4866 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); 4867 * ``` 4868 * 4869 * @return {Object} Action object 4870 */ 4871 function lockPostAutosaving(lockName) { 4872 return { 4873 type: 'LOCK_POST_AUTOSAVING', 4874 lockName 4875 }; 4876 } 4877 4878 /** 4879 * Action that unlocks post autosaving. 4880 * 4881 * @param {string} lockName The lock name. 4882 * 4883 * @example 4884 * ``` 4885 * // Unlock post saving with the lock key `mylock`: 4886 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); 4887 * ``` 4888 * 4889 * @return {Object} Action object 4890 */ 4891 function unlockPostAutosaving(lockName) { 4892 return { 4893 type: 'UNLOCK_POST_AUTOSAVING', 4894 lockName 4895 }; 4896 } 4897 4898 /** 4899 * Returns an action object used to signal that the blocks have been updated. 4900 * 4901 * @param {Array} blocks Block Array. 4902 * @param {Object} [options] Optional options. 4903 */ 4904 const resetEditorBlocks = (blocks, options = {}) => ({ 4905 select, 4906 dispatch, 4907 registry 4908 }) => { 4909 const { 4910 __unstableShouldCreateUndoLevel, 4911 selection 4912 } = options; 4913 const edits = { 4914 blocks, 4915 selection 4916 }; 4917 if (__unstableShouldCreateUndoLevel !== false) { 4918 const { 4919 id, 4920 type 4921 } = select.getCurrentPost(); 4922 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; 4923 if (noChange) { 4924 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); 4925 return; 4926 } 4927 4928 // We create a new function here on every persistent edit 4929 // to make sure the edit makes the post dirty and creates 4930 // a new undo level. 4931 edits.content = ({ 4932 blocks: blocksForSerialization = [] 4933 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 4934 } 4935 dispatch.editPost(edits); 4936 }; 4937 4938 /* 4939 * Returns an action object used in signalling that the post editor settings have been updated. 4940 * 4941 * @param {Object} settings Updated settings 4942 * 4943 * @return {Object} Action object 4944 */ 4945 function updateEditorSettings(settings) { 4946 return { 4947 type: 'UPDATE_EDITOR_SETTINGS', 4948 settings 4949 }; 4950 } 4951 4952 /** 4953 * Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes: 4954 * 4955 * - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template. 4956 * - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable. 4957 * 4958 * @param {string} mode Mode (one of 'post-only' or 'template-locked'). 4959 */ 4960 const setRenderingMode = mode => ({ 4961 dispatch, 4962 registry, 4963 select 4964 }) => { 4965 if (select.__unstableIsEditorReady()) { 4966 // We clear the block selection but we also need to clear the selection from the core store. 4967 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 4968 dispatch.editPost({ 4969 selection: undefined 4970 }, { 4971 undoIgnore: true 4972 }); 4973 } 4974 dispatch({ 4975 type: 'SET_RENDERING_MODE', 4976 mode 4977 }); 4978 }; 4979 4980 /** 4981 * Action that changes the width of the editing canvas. 4982 * 4983 * @param {string} deviceType 4984 * 4985 * @return {Object} Action object. 4986 */ 4987 function setDeviceType(deviceType) { 4988 return { 4989 type: 'SET_DEVICE_TYPE', 4990 deviceType 4991 }; 4992 } 4993 4994 /** 4995 * Returns an action object used to enable or disable a panel in the editor. 4996 * 4997 * @param {string} panelName A string that identifies the panel to enable or disable. 4998 * 4999 * @return {Object} Action object. 5000 */ 5001 const toggleEditorPanelEnabled = panelName => ({ 5002 registry 5003 }) => { 5004 var _registry$select$get; 5005 const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 5006 const isPanelInactive = !!inactivePanels?.includes(panelName); 5007 5008 // If the panel is inactive, remove it to enable it, else add it to 5009 // make it inactive. 5010 let updatedInactivePanels; 5011 if (isPanelInactive) { 5012 updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); 5013 } else { 5014 updatedInactivePanels = [...inactivePanels, panelName]; 5015 } 5016 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'inactivePanels', updatedInactivePanels); 5017 }; 5018 5019 /** 5020 * Opens a closed panel and closes an open panel. 5021 * 5022 * @param {string} panelName A string that identifies the panel to open or close. 5023 */ 5024 const toggleEditorPanelOpened = panelName => ({ 5025 registry 5026 }) => { 5027 var _registry$select$get2; 5028 const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 5029 const isPanelOpen = !!openPanels?.includes(panelName); 5030 5031 // If the panel is open, remove it to close it, else add it to 5032 // make it open. 5033 let updatedOpenPanels; 5034 if (isPanelOpen) { 5035 updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); 5036 } else { 5037 updatedOpenPanels = [...openPanels, panelName]; 5038 } 5039 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'openPanels', updatedOpenPanels); 5040 }; 5041 5042 /** 5043 * Returns an action object used to remove a panel from the editor. 5044 * 5045 * @param {string} panelName A string that identifies the panel to remove. 5046 * 5047 * @return {Object} Action object. 5048 */ 5049 function removeEditorPanel(panelName) { 5050 return { 5051 type: 'REMOVE_PANEL', 5052 panelName 5053 }; 5054 } 5055 5056 /** 5057 * Returns an action object used to open/close the inserter. 5058 * 5059 * @param {boolean|Object} value Whether the inserter should be 5060 * opened (true) or closed (false). 5061 * To specify an insertion point, 5062 * use an object. 5063 * @param {string} value.rootClientId The root client ID to insert at. 5064 * @param {number} value.insertionIndex The index to insert at. 5065 * @param {string} value.filterValue A query to filter the inserter results. 5066 * @param {Function} value.onSelect A callback when an item is selected. 5067 * @param {string} value.tab The tab to open in the inserter. 5068 * @param {string} value.category The category to initialize in the inserter. 5069 * 5070 * @return {Object} Action object. 5071 */ 5072 const setIsInserterOpened = value => ({ 5073 dispatch, 5074 registry 5075 }) => { 5076 if (typeof value === 'object' && value.hasOwnProperty('rootClientId') && value.hasOwnProperty('insertionIndex')) { 5077 unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).setInsertionPoint({ 5078 rootClientId: value.rootClientId, 5079 index: value.insertionIndex 5080 }); 5081 } 5082 dispatch({ 5083 type: 'SET_IS_INSERTER_OPENED', 5084 value 5085 }); 5086 }; 5087 5088 /** 5089 * Returns an action object used to open/close the list view. 5090 * 5091 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 5092 * @return {Object} Action object. 5093 */ 5094 function setIsListViewOpened(isOpen) { 5095 return { 5096 type: 'SET_IS_LIST_VIEW_OPENED', 5097 isOpen 5098 }; 5099 } 5100 5101 /** 5102 * Action that toggles Distraction free mode. 5103 * Distraction free mode expects there are no sidebars, as due to the 5104 * z-index values set, you can't close sidebars. 5105 * 5106 * @param {Object} [options={}] Optional configuration object 5107 * @param {boolean} [options.createNotice=true] Whether to create a notice 5108 */ 5109 const toggleDistractionFree = ({ 5110 createNotice = true 5111 } = {}) => ({ 5112 dispatch, 5113 registry 5114 }) => { 5115 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 5116 if (isDistractionFree) { 5117 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); 5118 } 5119 if (!isDistractionFree) { 5120 registry.batch(() => { 5121 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); 5122 dispatch.setIsInserterOpened(false); 5123 dispatch.setIsListViewOpened(false); 5124 unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); 5125 }); 5126 } 5127 registry.batch(() => { 5128 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); 5129 if (createNotice) { 5130 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated.'), { 5131 id: 'core/editor/distraction-free-mode/notice', 5132 type: 'snackbar', 5133 actions: [{ 5134 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5135 onClick: () => { 5136 registry.batch(() => { 5137 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree); 5138 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); 5139 }); 5140 } 5141 }] 5142 }); 5143 } 5144 }); 5145 }; 5146 5147 /** 5148 * Action that toggles the Spotlight Mode view option. 5149 */ 5150 const toggleSpotlightMode = () => ({ 5151 registry 5152 }) => { 5153 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'focusMode'); 5154 const isFocusMode = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'focusMode'); 5155 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated.'), { 5156 id: 'core/editor/toggle-spotlight-mode/notice', 5157 type: 'snackbar', 5158 actions: [{ 5159 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5160 onClick: () => { 5161 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'focusMode'); 5162 } 5163 }] 5164 }); 5165 }; 5166 5167 /** 5168 * Action that toggles the Top Toolbar view option. 5169 */ 5170 const toggleTopToolbar = () => ({ 5171 registry 5172 }) => { 5173 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'fixedToolbar'); 5174 const isTopToolbar = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'fixedToolbar'); 5175 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated.'), { 5176 id: 'core/editor/toggle-top-toolbar/notice', 5177 type: 'snackbar', 5178 actions: [{ 5179 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 5180 onClick: () => { 5181 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'fixedToolbar'); 5182 } 5183 }] 5184 }); 5185 }; 5186 5187 /** 5188 * Triggers an action used to switch editor mode. 5189 * 5190 * @param {string} mode The editor mode. 5191 */ 5192 const switchEditorMode = mode => ({ 5193 dispatch, 5194 registry 5195 }) => { 5196 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); 5197 if (mode !== 'visual') { 5198 // Unselect blocks when we switch to a non visual mode. 5199 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 5200 // Exit zoom out state when switching to a non visual mode. 5201 unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); 5202 } 5203 if (mode === 'visual') { 5204 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); 5205 } else if (mode === 'text') { 5206 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 5207 if (isDistractionFree) { 5208 dispatch.toggleDistractionFree(); 5209 } 5210 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive'); 5211 } 5212 }; 5213 5214 /** 5215 * Returns an action object used in signalling that the user opened the publish 5216 * sidebar. 5217 * 5218 * @return {Object} Action object 5219 */ 5220 function openPublishSidebar() { 5221 return { 5222 type: 'OPEN_PUBLISH_SIDEBAR' 5223 }; 5224 } 5225 5226 /** 5227 * Returns an action object used in signalling that the user closed the 5228 * publish sidebar. 5229 * 5230 * @return {Object} Action object. 5231 */ 5232 function closePublishSidebar() { 5233 return { 5234 type: 'CLOSE_PUBLISH_SIDEBAR' 5235 }; 5236 } 5237 5238 /** 5239 * Returns an action object used in signalling that the user toggles the publish sidebar. 5240 * 5241 * @return {Object} Action object 5242 */ 5243 function togglePublishSidebar() { 5244 return { 5245 type: 'TOGGLE_PUBLISH_SIDEBAR' 5246 }; 5247 } 5248 5249 /** 5250 * Backward compatibility 5251 */ 5252 5253 const getBlockEditorAction = name => (...args) => ({ 5254 registry 5255 }) => { 5256 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { 5257 since: '5.3', 5258 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', 5259 version: '6.2' 5260 }); 5261 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); 5262 }; 5263 5264 /** 5265 * @see resetBlocks in core/block-editor store. 5266 */ 5267 const resetBlocks = getBlockEditorAction('resetBlocks'); 5268 5269 /** 5270 * @see receiveBlocks in core/block-editor store. 5271 */ 5272 const receiveBlocks = getBlockEditorAction('receiveBlocks'); 5273 5274 /** 5275 * @see updateBlock in core/block-editor store. 5276 */ 5277 const updateBlock = getBlockEditorAction('updateBlock'); 5278 5279 /** 5280 * @see updateBlockAttributes in core/block-editor store. 5281 */ 5282 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); 5283 5284 /** 5285 * @see selectBlock in core/block-editor store. 5286 */ 5287 const selectBlock = getBlockEditorAction('selectBlock'); 5288 5289 /** 5290 * @see startMultiSelect in core/block-editor store. 5291 */ 5292 const startMultiSelect = getBlockEditorAction('startMultiSelect'); 5293 5294 /** 5295 * @see stopMultiSelect in core/block-editor store. 5296 */ 5297 const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); 5298 5299 /** 5300 * @see multiSelect in core/block-editor store. 5301 */ 5302 const multiSelect = getBlockEditorAction('multiSelect'); 5303 5304 /** 5305 * @see clearSelectedBlock in core/block-editor store. 5306 */ 5307 const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); 5308 5309 /** 5310 * @see toggleSelection in core/block-editor store. 5311 */ 5312 const toggleSelection = getBlockEditorAction('toggleSelection'); 5313 5314 /** 5315 * @see replaceBlocks in core/block-editor store. 5316 */ 5317 const replaceBlocks = getBlockEditorAction('replaceBlocks'); 5318 5319 /** 5320 * @see replaceBlock in core/block-editor store. 5321 */ 5322 const replaceBlock = getBlockEditorAction('replaceBlock'); 5323 5324 /** 5325 * @see moveBlocksDown in core/block-editor store. 5326 */ 5327 const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); 5328 5329 /** 5330 * @see moveBlocksUp in core/block-editor store. 5331 */ 5332 const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); 5333 5334 /** 5335 * @see moveBlockToPosition in core/block-editor store. 5336 */ 5337 const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); 5338 5339 /** 5340 * @see insertBlock in core/block-editor store. 5341 */ 5342 const insertBlock = getBlockEditorAction('insertBlock'); 5343 5344 /** 5345 * @see insertBlocks in core/block-editor store. 5346 */ 5347 const insertBlocks = getBlockEditorAction('insertBlocks'); 5348 5349 /** 5350 * @see showInsertionPoint in core/block-editor store. 5351 */ 5352 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); 5353 5354 /** 5355 * @see hideInsertionPoint in core/block-editor store. 5356 */ 5357 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); 5358 5359 /** 5360 * @see setTemplateValidity in core/block-editor store. 5361 */ 5362 const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); 5363 5364 /** 5365 * @see synchronizeTemplate in core/block-editor store. 5366 */ 5367 const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); 5368 5369 /** 5370 * @see mergeBlocks in core/block-editor store. 5371 */ 5372 const mergeBlocks = getBlockEditorAction('mergeBlocks'); 5373 5374 /** 5375 * @see removeBlocks in core/block-editor store. 5376 */ 5377 const removeBlocks = getBlockEditorAction('removeBlocks'); 5378 5379 /** 5380 * @see removeBlock in core/block-editor store. 5381 */ 5382 const removeBlock = getBlockEditorAction('removeBlock'); 5383 5384 /** 5385 * @see toggleBlockMode in core/block-editor store. 5386 */ 5387 const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); 5388 5389 /** 5390 * @see startTyping in core/block-editor store. 5391 */ 5392 const startTyping = getBlockEditorAction('startTyping'); 5393 5394 /** 5395 * @see stopTyping in core/block-editor store. 5396 */ 5397 const stopTyping = getBlockEditorAction('stopTyping'); 5398 5399 /** 5400 * @see enterFormattedText in core/block-editor store. 5401 */ 5402 const enterFormattedText = getBlockEditorAction('enterFormattedText'); 5403 5404 /** 5405 * @see exitFormattedText in core/block-editor store. 5406 */ 5407 const exitFormattedText = getBlockEditorAction('exitFormattedText'); 5408 5409 /** 5410 * @see insertDefaultBlock in core/block-editor store. 5411 */ 5412 const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); 5413 5414 /** 5415 * @see updateBlockListSettings in core/block-editor store. 5416 */ 5417 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); 5418 5419 ;// external ["wp","htmlEntities"] 5420 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 5421 ;// ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js 5422 /** 5423 * Internal dependencies 5424 */ 5425 5426 5427 // Copy of the function from packages/edit-site/src/utils/is-template-revertable.js 5428 5429 /** 5430 * Check if a template or template part is revertable to its original theme-provided file. 5431 * 5432 * @param {Object} templateOrTemplatePart The entity to check. 5433 * @return {boolean} Whether the entity is revertable. 5434 */ 5435 function isTemplateRevertable(templateOrTemplatePart) { 5436 if (!templateOrTemplatePart) { 5437 return false; 5438 } 5439 return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 5440 } 5441 5442 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 5443 /** 5444 * WordPress dependencies 5445 */ 5446 5447 5448 const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5449 xmlns: "http://www.w3.org/2000/svg", 5450 viewBox: "0 0 24 24", 5451 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5452 d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" 5453 }) 5454 }); 5455 /* harmony default export */ const library_external = (external); 5456 5457 ;// ./node_modules/@wordpress/fields/build-module/actions/view-post.js 5458 /** 5459 * WordPress dependencies 5460 */ 5461 5462 5463 5464 /** 5465 * Internal dependencies 5466 */ 5467 5468 const viewPost = { 5469 id: 'view-post', 5470 label: (0,external_wp_i18n_namespaceObject._x)('View', 'verb'), 5471 isPrimary: true, 5472 icon: library_external, 5473 isEligible(post) { 5474 return post.status !== 'trash'; 5475 }, 5476 callback(posts, { 5477 onActionPerformed 5478 }) { 5479 const post = posts[0]; 5480 window.open(post?.link, '_blank'); 5481 if (onActionPerformed) { 5482 onActionPerformed(posts); 5483 } 5484 } 5485 }; 5486 5487 /** 5488 * View post action for BasePost. 5489 */ 5490 /* harmony default export */ const view_post = (viewPost); 5491 5492 ;// ./node_modules/@wordpress/fields/build-module/actions/view-post-revisions.js 5493 /** 5494 * WordPress dependencies 5495 */ 5496 5497 5498 5499 /** 5500 * Internal dependencies 5501 */ 5502 5503 const viewPostRevisions = { 5504 id: 'view-post-revisions', 5505 context: 'list', 5506 label(items) { 5507 var _items$0$_links$versi; 5508 const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0; 5509 return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of revisions. */ 5510 (0,external_wp_i18n_namespaceObject.__)('View revisions (%s)'), revisionsCount); 5511 }, 5512 isEligible(post) { 5513 var _post$_links$predeces, _post$_links$version; 5514 if (post.status === 'trash') { 5515 return false; 5516 } 5517 const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null; 5518 const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0; 5519 return !!lastRevisionId && revisionsCount > 1; 5520 }, 5521 callback(posts, { 5522 onActionPerformed 5523 }) { 5524 const post = posts[0]; 5525 const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 5526 revision: post?._links?.['predecessor-version']?.[0]?.id 5527 }); 5528 document.location.href = href; 5529 if (onActionPerformed) { 5530 onActionPerformed(posts); 5531 } 5532 } 5533 }; 5534 5535 /** 5536 * View post revisions action for Post. 5537 */ 5538 /* harmony default export */ const view_post_revisions = (viewPostRevisions); 5539 5540 ;// external ["wp","components"] 5541 const external_wp_components_namespaceObject = window["wp"]["components"]; 5542 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 5543 /** 5544 * WordPress dependencies 5545 */ 5546 5547 5548 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5549 xmlns: "http://www.w3.org/2000/svg", 5550 viewBox: "0 0 24 24", 5551 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5552 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 5553 }) 5554 }); 5555 /* harmony default export */ const library_check = (check); 5556 5557 ;// ./node_modules/tslib/tslib.es6.mjs 5558 /****************************************************************************** 5559 Copyright (c) Microsoft Corporation. 5560 5561 Permission to use, copy, modify, and/or distribute this software for any 5562 purpose with or without fee is hereby granted. 5563 5564 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 5565 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 5566 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 5567 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 5568 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 5569 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 5570 PERFORMANCE OF THIS SOFTWARE. 5571 ***************************************************************************** */ 5572 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 5573 5574 var extendStatics = function(d, b) { 5575 extendStatics = Object.setPrototypeOf || 5576 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5577 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 5578 return extendStatics(d, b); 5579 }; 5580 5581 function __extends(d, b) { 5582 if (typeof b !== "function" && b !== null) 5583 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 5584 extendStatics(d, b); 5585 function __() { this.constructor = d; } 5586 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5587 } 5588 5589 var __assign = function() { 5590 __assign = Object.assign || function __assign(t) { 5591 for (var s, i = 1, n = arguments.length; i < n; i++) { 5592 s = arguments[i]; 5593 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 5594 } 5595 return t; 5596 } 5597 return __assign.apply(this, arguments); 5598 } 5599 5600 function __rest(s, e) { 5601 var t = {}; 5602 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 5603 t[p] = s[p]; 5604 if (s != null && typeof Object.getOwnPropertySymbols === "function") 5605 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 5606 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 5607 t[p[i]] = s[p[i]]; 5608 } 5609 return t; 5610 } 5611 5612 function __decorate(decorators, target, key, desc) { 5613 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 5614 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5615 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 5616 return c > 3 && r && Object.defineProperty(target, key, r), r; 5617 } 5618 5619 function __param(paramIndex, decorator) { 5620 return function (target, key) { decorator(target, key, paramIndex); } 5621 } 5622 5623 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 5624 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 5625 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 5626 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 5627 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 5628 var _, done = false; 5629 for (var i = decorators.length - 1; i >= 0; i--) { 5630 var context = {}; 5631 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 5632 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 5633 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 5634 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 5635 if (kind === "accessor") { 5636 if (result === void 0) continue; 5637 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 5638 if (_ = accept(result.get)) descriptor.get = _; 5639 if (_ = accept(result.set)) descriptor.set = _; 5640 if (_ = accept(result.init)) initializers.unshift(_); 5641 } 5642 else if (_ = accept(result)) { 5643 if (kind === "field") initializers.unshift(_); 5644 else descriptor[key] = _; 5645 } 5646 } 5647 if (target) Object.defineProperty(target, contextIn.name, descriptor); 5648 done = true; 5649 }; 5650 5651 function __runInitializers(thisArg, initializers, value) { 5652 var useValue = arguments.length > 2; 5653 for (var i = 0; i < initializers.length; i++) { 5654 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 5655 } 5656 return useValue ? value : void 0; 5657 }; 5658 5659 function __propKey(x) { 5660 return typeof x === "symbol" ? x : "".concat(x); 5661 }; 5662 5663 function __setFunctionName(f, name, prefix) { 5664 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 5665 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 5666 }; 5667 5668 function __metadata(metadataKey, metadataValue) { 5669 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 5670 } 5671 5672 function __awaiter(thisArg, _arguments, P, generator) { 5673 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 5674 return new (P || (P = Promise))(function (resolve, reject) { 5675 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5676 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 5677 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 5678 step((generator = generator.apply(thisArg, _arguments || [])).next()); 5679 }); 5680 } 5681 5682 function __generator(thisArg, body) { 5683 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 5684 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 5685 function verb(n) { return function (v) { return step([n, v]); }; } 5686 function step(op) { 5687 if (f) throw new TypeError("Generator is already executing."); 5688 while (g && (g = 0, op[0] && (_ = 0)), _) try { 5689 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 5690 if (y = 0, t) op = [op[0] & 2, t.value]; 5691 switch (op[0]) { 5692 case 0: case 1: t = op; break; 5693 case 4: _.label++; return { value: op[1], done: false }; 5694 case 5: _.label++; y = op[1]; op = [0]; continue; 5695 case 7: op = _.ops.pop(); _.trys.pop(); continue; 5696 default: 5697 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 5698 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 5699 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 5700 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 5701 if (t[2]) _.ops.pop(); 5702 _.trys.pop(); continue; 5703 } 5704 op = body.call(thisArg, _); 5705 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 5706 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 5707 } 5708 } 5709 5710 var __createBinding = Object.create ? (function(o, m, k, k2) { 5711 if (k2 === undefined) k2 = k; 5712 var desc = Object.getOwnPropertyDescriptor(m, k); 5713 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 5714 desc = { enumerable: true, get: function() { return m[k]; } }; 5715 } 5716 Object.defineProperty(o, k2, desc); 5717 }) : (function(o, m, k, k2) { 5718 if (k2 === undefined) k2 = k; 5719 o[k2] = m[k]; 5720 }); 5721 5722 function __exportStar(m, o) { 5723 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 5724 } 5725 5726 function __values(o) { 5727 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 5728 if (m) return m.call(o); 5729 if (o && typeof o.length === "number") return { 5730 next: function () { 5731 if (o && i >= o.length) o = void 0; 5732 return { value: o && o[i++], done: !o }; 5733 } 5734 }; 5735 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 5736 } 5737 5738 function __read(o, n) { 5739 var m = typeof Symbol === "function" && o[Symbol.iterator]; 5740 if (!m) return o; 5741 var i = m.call(o), r, ar = [], e; 5742 try { 5743 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 5744 } 5745 catch (error) { e = { error: error }; } 5746 finally { 5747 try { 5748 if (r && !r.done && (m = i["return"])) m.call(i); 5749 } 5750 finally { if (e) throw e.error; } 5751 } 5752 return ar; 5753 } 5754 5755 /** @deprecated */ 5756 function __spread() { 5757 for (var ar = [], i = 0; i < arguments.length; i++) 5758 ar = ar.concat(__read(arguments[i])); 5759 return ar; 5760 } 5761 5762 /** @deprecated */ 5763 function __spreadArrays() { 5764 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 5765 for (var r = Array(s), k = 0, i = 0; i < il; i++) 5766 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 5767 r[k] = a[j]; 5768 return r; 5769 } 5770 5771 function __spreadArray(to, from, pack) { 5772 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 5773 if (ar || !(i in from)) { 5774 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 5775 ar[i] = from[i]; 5776 } 5777 } 5778 return to.concat(ar || Array.prototype.slice.call(from)); 5779 } 5780 5781 function __await(v) { 5782 return this instanceof __await ? (this.v = v, this) : new __await(v); 5783 } 5784 5785 function __asyncGenerator(thisArg, _arguments, generator) { 5786 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 5787 var g = generator.apply(thisArg, _arguments || []), i, q = []; 5788 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 5789 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 5790 function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } 5791 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 5792 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 5793 function fulfill(value) { resume("next", value); } 5794 function reject(value) { resume("throw", value); } 5795 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 5796 } 5797 5798 function __asyncDelegator(o) { 5799 var i, p; 5800 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 5801 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } 5802 } 5803 5804 function __asyncValues(o) { 5805 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 5806 var m = o[Symbol.asyncIterator], i; 5807 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 5808 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 5809 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 5810 } 5811 5812 function __makeTemplateObject(cooked, raw) { 5813 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 5814 return cooked; 5815 }; 5816 5817 var __setModuleDefault = Object.create ? (function(o, v) { 5818 Object.defineProperty(o, "default", { enumerable: true, value: v }); 5819 }) : function(o, v) { 5820 o["default"] = v; 5821 }; 5822 5823 var ownKeys = function(o) { 5824 ownKeys = Object.getOwnPropertyNames || function (o) { 5825 var ar = []; 5826 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 5827 return ar; 5828 }; 5829 return ownKeys(o); 5830 }; 5831 5832 function __importStar(mod) { 5833 if (mod && mod.__esModule) return mod; 5834 var result = {}; 5835 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 5836 __setModuleDefault(result, mod); 5837 return result; 5838 } 5839 5840 function __importDefault(mod) { 5841 return (mod && mod.__esModule) ? mod : { default: mod }; 5842 } 5843 5844 function __classPrivateFieldGet(receiver, state, kind, f) { 5845 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 5846 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 5847 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 5848 } 5849 5850 function __classPrivateFieldSet(receiver, state, value, kind, f) { 5851 if (kind === "m") throw new TypeError("Private method is not writable"); 5852 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 5853 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 5854 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 5855 } 5856 5857 function __classPrivateFieldIn(state, receiver) { 5858 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 5859 return typeof state === "function" ? receiver === state : state.has(receiver); 5860 } 5861 5862 function __addDisposableResource(env, value, async) { 5863 if (value !== null && value !== void 0) { 5864 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 5865 var dispose, inner; 5866 if (async) { 5867 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 5868 dispose = value[Symbol.asyncDispose]; 5869 } 5870 if (dispose === void 0) { 5871 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 5872 dispose = value[Symbol.dispose]; 5873 if (async) inner = dispose; 5874 } 5875 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 5876 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 5877 env.stack.push({ value: value, dispose: dispose, async: async }); 5878 } 5879 else if (async) { 5880 env.stack.push({ async: true }); 5881 } 5882 return value; 5883 } 5884 5885 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 5886 var e = new Error(message); 5887 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 5888 }; 5889 5890 function __disposeResources(env) { 5891 function fail(e) { 5892 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 5893 env.hasError = true; 5894 } 5895 var r, s = 0; 5896 function next() { 5897 while (r = env.stack.pop()) { 5898 try { 5899 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 5900 if (r.dispose) { 5901 var result = r.dispose.call(r.value); 5902 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 5903 } 5904 else s |= 1; 5905 } 5906 catch (e) { 5907 fail(e); 5908 } 5909 } 5910 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 5911 if (env.hasError) throw env.error; 5912 } 5913 return next(); 5914 } 5915 5916 function __rewriteRelativeImportExtension(path, preserveJsx) { 5917 if (typeof path === "string" && /^\.\.?\//.test(path)) { 5918 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 5919 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 5920 }); 5921 } 5922 return path; 5923 } 5924 5925 /* harmony default export */ const tslib_es6 = ({ 5926 __extends, 5927 __assign, 5928 __rest, 5929 __decorate, 5930 __param, 5931 __esDecorate, 5932 __runInitializers, 5933 __propKey, 5934 __setFunctionName, 5935 __metadata, 5936 __awaiter, 5937 __generator, 5938 __createBinding, 5939 __exportStar, 5940 __values, 5941 __read, 5942 __spread, 5943 __spreadArrays, 5944 __spreadArray, 5945 __await, 5946 __asyncGenerator, 5947 __asyncDelegator, 5948 __asyncValues, 5949 __makeTemplateObject, 5950 __importStar, 5951 __importDefault, 5952 __classPrivateFieldGet, 5953 __classPrivateFieldSet, 5954 __classPrivateFieldIn, 5955 __addDisposableResource, 5956 __disposeResources, 5957 __rewriteRelativeImportExtension, 5958 }); 5959 5960 ;// ./node_modules/lower-case/dist.es2015/index.js 5961 /** 5962 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 5963 */ 5964 var SUPPORTED_LOCALE = { 5965 tr: { 5966 regexp: /\u0130|\u0049|\u0049\u0307/g, 5967 map: { 5968 İ: "\u0069", 5969 I: "\u0131", 5970 İ: "\u0069", 5971 }, 5972 }, 5973 az: { 5974 regexp: /\u0130/g, 5975 map: { 5976 İ: "\u0069", 5977 I: "\u0131", 5978 İ: "\u0069", 5979 }, 5980 }, 5981 lt: { 5982 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 5983 map: { 5984 I: "\u0069\u0307", 5985 J: "\u006A\u0307", 5986 Į: "\u012F\u0307", 5987 Ì: "\u0069\u0307\u0300", 5988 Í: "\u0069\u0307\u0301", 5989 Ĩ: "\u0069\u0307\u0303", 5990 }, 5991 }, 5992 }; 5993 /** 5994 * Localized lower case. 5995 */ 5996 function localeLowerCase(str, locale) { 5997 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 5998 if (lang) 5999 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 6000 return lowerCase(str); 6001 } 6002 /** 6003 * Lower case as a function. 6004 */ 6005 function lowerCase(str) { 6006 return str.toLowerCase(); 6007 } 6008 6009 ;// ./node_modules/no-case/dist.es2015/index.js 6010 6011 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 6012 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 6013 // Remove all non-word characters. 6014 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 6015 /** 6016 * Normalize the string into something other libraries can manipulate easier. 6017 */ 6018 function noCase(input, options) { 6019 if (options === void 0) { options = {}; } 6020 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 6021 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 6022 var start = 0; 6023 var end = result.length; 6024 // Trim the delimiter from around the output string. 6025 while (result.charAt(start) === "\0") 6026 start++; 6027 while (result.charAt(end - 1) === "\0") 6028 end--; 6029 // Transform each token independently. 6030 return result.slice(start, end).split("\0").map(transform).join(delimiter); 6031 } 6032 /** 6033 * Replace `re` in the input string with the replacement value. 6034 */ 6035 function replace(input, re, value) { 6036 if (re instanceof RegExp) 6037 return input.replace(re, value); 6038 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 6039 } 6040 6041 ;// ./node_modules/dot-case/dist.es2015/index.js 6042 6043 6044 function dotCase(input, options) { 6045 if (options === void 0) { options = {}; } 6046 return noCase(input, __assign({ delimiter: "." }, options)); 6047 } 6048 6049 ;// ./node_modules/param-case/dist.es2015/index.js 6050 6051 6052 function paramCase(input, options) { 6053 if (options === void 0) { options = {}; } 6054 return dotCase(input, __assign({ delimiter: "-" }, options)); 6055 } 6056 6057 ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/utils.js 6058 /* wp:polyfill */ 6059 /** 6060 * External dependencies 6061 */ 6062 6063 6064 /** 6065 * WordPress dependencies 6066 */ 6067 6068 6069 6070 /** 6071 * Internal dependencies 6072 */ 6073 6074 const useExistingTemplateParts = () => { 6075 var _useSelect; 6076 return (_useSelect = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', { 6077 per_page: -1 6078 }), [])) !== null && _useSelect !== void 0 ? _useSelect : []; 6079 }; 6080 6081 /** 6082 * Return a unique template part title based on 6083 * the given title and existing template parts. 6084 * 6085 * @param {string} title The original template part title. 6086 * @param {Object} templateParts The array of template part entities. 6087 * @return {string} A unique template part title. 6088 */ 6089 const getUniqueTemplatePartTitle = (title, templateParts) => { 6090 const lowercaseTitle = title.toLowerCase(); 6091 const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase()); 6092 if (!existingTitles.includes(lowercaseTitle)) { 6093 return title; 6094 } 6095 let suffix = 2; 6096 while (existingTitles.includes(`$lowercaseTitle} $suffix}`)) { 6097 suffix++; 6098 } 6099 return `$title} $suffix}`; 6100 }; 6101 6102 /** 6103 * Get a valid slug for a template part. 6104 * Currently template parts only allow latin chars. 6105 * The fallback slug will receive suffix by default. 6106 * 6107 * @param {string} title The template part title. 6108 * @return {string} A valid template part slug. 6109 */ 6110 const getCleanTemplatePartSlug = title => { 6111 return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; 6112 }; 6113 6114 ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/index.js 6115 /* wp:polyfill */ 6116 /** 6117 * WordPress dependencies 6118 */ 6119 6120 6121 6122 6123 6124 6125 6126 6127 // @ts-expect-error serialize is not typed 6128 6129 6130 /** 6131 * Internal dependencies 6132 */ 6133 6134 6135 function getAreaRadioId(value, instanceId) { 6136 return `fields-create-template-part-modal__area-option-$value}-$instanceId}`; 6137 } 6138 function getAreaRadioDescriptionId(value, instanceId) { 6139 return `fields-create-template-part-modal__area-option-description-$value}-$instanceId}`; 6140 } 6141 /** 6142 * A React component that renders a modal for creating a template part. The modal displays a title and the contents for creating the template part. 6143 * This component should not live in this package, it should be moved to a dedicated package responsible for managing template. 6144 * @param {Object} props The component props. 6145 * @param props.modalTitle 6146 */ 6147 function CreateTemplatePartModal({ 6148 modalTitle, 6149 ...restProps 6150 }) { 6151 const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType('wp_template_part')?.labels?.add_new_item, []); 6152 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 6153 title: modalTitle || defaultModalTitle, 6154 onRequestClose: restProps.closeModal, 6155 overlayClassName: "fields-create-template-part-modal", 6156 focusOnMount: "firstContentElement", 6157 size: "medium", 6158 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { 6159 ...restProps 6160 }) 6161 }); 6162 } 6163 const create_template_part_modal_getTemplatePartIcon = iconName => { 6164 if ('header' === iconName) { 6165 return library_header; 6166 } else if ('footer' === iconName) { 6167 return library_footer; 6168 } else if ('sidebar' === iconName) { 6169 return library_sidebar; 6170 } 6171 return symbol_filled; 6172 }; 6173 6174 /** 6175 * A React component that renders the content of a model for creating a template part. 6176 * This component should not live in this package; it should be moved to a dedicated package responsible for managing template. 6177 * 6178 * @param {Object} props - The component props. 6179 * @param {string} [props.defaultArea=uncategorized] - The default area for the template part. 6180 * @param {Array} [props.blocks=[]] - The blocks to be included in the template part. 6181 * @param {string} [props.confirmLabel='Add'] - The label for the confirm button. 6182 * @param {Function} props.closeModal - Function to close the modal. 6183 * @param {Function} props.onCreate - Function to call when the template part is successfully created. 6184 * @param {Function} [props.onError] - Function to call when there is an error creating the template part. 6185 * @param {string} [props.defaultTitle=''] - The default title for the template part. 6186 */ 6187 function CreateTemplatePartModalContents({ 6188 defaultArea = 'uncategorized', 6189 blocks = [], 6190 confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'), 6191 closeModal, 6192 onCreate, 6193 onError, 6194 defaultTitle = '' 6195 }) { 6196 const { 6197 createErrorNotice 6198 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6199 const { 6200 saveEntityRecord 6201 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6202 const existingTemplateParts = useExistingTemplateParts(); 6203 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); 6204 const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea); 6205 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 6206 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); 6207 const defaultTemplatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas, []); 6208 async function createTemplatePart() { 6209 if (!title || isSubmitting) { 6210 return; 6211 } 6212 try { 6213 setIsSubmitting(true); 6214 const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts); 6215 const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); 6216 const templatePart = await saveEntityRecord('postType', 'wp_template_part', { 6217 slug: cleanSlug, 6218 title: uniqueTitle, 6219 content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), 6220 area 6221 }, { 6222 throwOnError: true 6223 }); 6224 await onCreate(templatePart); 6225 6226 // TODO: Add a success notice? 6227 } catch (error) { 6228 const errorMessage = error instanceof Error && 'code' in error && error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); 6229 createErrorNotice(errorMessage, { 6230 type: 'snackbar' 6231 }); 6232 onError?.(); 6233 } finally { 6234 setIsSubmitting(false); 6235 } 6236 } 6237 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 6238 onSubmit: async event => { 6239 event.preventDefault(); 6240 await createTemplatePart(); 6241 }, 6242 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 6243 spacing: "4", 6244 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 6245 __next40pxDefaultSize: true, 6246 __nextHasNoMarginBottom: true, 6247 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 6248 value: title, 6249 onChange: setTitle, 6250 required: true 6251 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 6252 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6253 as: "legend", 6254 children: (0,external_wp_i18n_namespaceObject.__)('Area') 6255 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 6256 className: "fields-create-template-part-modal__area-radio-group", 6257 children: (defaultTemplatePartAreas !== null && defaultTemplatePartAreas !== void 0 ? defaultTemplatePartAreas : []).map(item => { 6258 const icon = create_template_part_modal_getTemplatePartIcon(item.icon); 6259 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 6260 className: "fields-create-template-part-modal__area-radio-wrapper", 6261 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 6262 type: "radio", 6263 id: getAreaRadioId(item.area, instanceId), 6264 name: `fields-create-template-part-modal__area-$instanceId}`, 6265 value: item.area, 6266 checked: area === item.area, 6267 onChange: () => { 6268 setArea(item.area); 6269 }, 6270 "aria-describedby": getAreaRadioDescriptionId(item.area, instanceId) 6271 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 6272 icon: icon, 6273 className: "fields-create-template-part-modal__area-radio-icon" 6274 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 6275 htmlFor: getAreaRadioId(item.area, instanceId), 6276 className: "fields-create-template-part-modal__area-radio-label", 6277 children: item.label 6278 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 6279 icon: library_check, 6280 className: "fields-create-template-part-modal__area-radio-checkmark" 6281 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 6282 className: "fields-create-template-part-modal__area-radio-description", 6283 id: getAreaRadioDescriptionId(item.area, instanceId), 6284 children: item.description 6285 })] 6286 }, item.area); 6287 }) 6288 })] 6289 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 6290 justify: "right", 6291 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6292 __next40pxDefaultSize: true, 6293 variant: "tertiary", 6294 onClick: () => { 6295 closeModal(); 6296 }, 6297 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 6298 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6299 __next40pxDefaultSize: true, 6300 variant: "primary", 6301 type: "submit", 6302 "aria-disabled": !title || isSubmitting, 6303 isBusy: isSubmitting, 6304 children: confirmLabel 6305 })] 6306 })] 6307 }) 6308 }); 6309 } 6310 6311 ;// ./node_modules/@wordpress/fields/build-module/actions/utils.js 6312 /** 6313 * WordPress dependencies 6314 */ 6315 6316 6317 /** 6318 * Internal dependencies 6319 */ 6320 6321 function isTemplate(post) { 6322 return post.type === 'wp_template'; 6323 } 6324 function isTemplatePart(post) { 6325 return post.type === 'wp_template_part'; 6326 } 6327 function isTemplateOrTemplatePart(p) { 6328 return p.type === 'wp_template' || p.type === 'wp_template_part'; 6329 } 6330 function getItemTitle(item) { 6331 if (typeof item.title === 'string') { 6332 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 6333 } 6334 if (item.title && 'rendered' in item.title) { 6335 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 6336 } 6337 if (item.title && 'raw' in item.title) { 6338 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 6339 } 6340 return ''; 6341 } 6342 6343 /** 6344 * Check if a template is removable. 6345 * 6346 * @param template The template entity to check. 6347 * @return Whether the template is removable. 6348 */ 6349 function isTemplateRemovable(template) { 6350 if (!template) { 6351 return false; 6352 } 6353 // In patterns list page we map the templates parts to a different object 6354 // than the one returned from the endpoint. This is why we need to check for 6355 // two props whether is custom or has a theme file. 6356 return [template.source, template.source].includes('custom') && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file; 6357 } 6358 6359 ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-template-part.js 6360 /** 6361 * WordPress dependencies 6362 */ 6363 6364 6365 6366 6367 // @ts-ignore 6368 6369 6370 /** 6371 * Internal dependencies 6372 */ 6373 6374 6375 6376 6377 /** 6378 * This action is used to duplicate a template part. 6379 */ 6380 6381 const duplicateTemplatePart = { 6382 id: 'duplicate-template-part', 6383 label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6384 isEligible: item => item.type === 'wp_template_part', 6385 modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'), 6386 RenderModal: ({ 6387 items, 6388 closeModal 6389 }) => { 6390 const [item] = items; 6391 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 6392 var _item$blocks; 6393 return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(typeof item.content === 'string' ? item.content : item.content.raw, { 6394 __unstableSkipMigrationLogs: true 6395 }); 6396 }, [item.content, item.blocks]); 6397 const { 6398 createSuccessNotice 6399 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6400 function onTemplatePartSuccess(templatePart) { 6401 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 6402 // translators: %s: The new template part's title e.g. 'Call to action (copy)'. 6403 (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', 'template part'), getItemTitle(templatePart)), { 6404 type: 'snackbar', 6405 id: 'edit-site-patterns-success' 6406 }); 6407 closeModal?.(); 6408 } 6409 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { 6410 blocks: blocks, 6411 defaultArea: item.area, 6412 defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Existing template part title */ 6413 (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'template part'), getItemTitle(item)), 6414 onCreate: onTemplatePartSuccess, 6415 onError: closeModal, 6416 confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6417 closeModal: closeModal !== null && closeModal !== void 0 ? closeModal : () => {} 6418 }); 6419 } 6420 }; 6421 /** 6422 * Duplicate action for TemplatePart. 6423 */ 6424 /* harmony default export */ const duplicate_template_part = (duplicateTemplatePart); 6425 6426 ;// external ["wp","patterns"] 6427 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6428 ;// ./node_modules/@wordpress/fields/build-module/lock-unlock.js 6429 /** 6430 * WordPress dependencies 6431 */ 6432 6433 const { 6434 lock: lock_unlock_lock, 6435 unlock: lock_unlock_unlock 6436 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/fields'); 6437 6438 ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-pattern.js 6439 /** 6440 * WordPress dependencies 6441 */ 6442 6443 // @ts-ignore 6444 6445 /** 6446 * Internal dependencies 6447 */ 6448 6449 6450 // Patterns. 6451 const { 6452 CreatePatternModalContents, 6453 useDuplicatePatternProps 6454 } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 6455 const duplicatePattern = { 6456 id: 'duplicate-pattern', 6457 label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6458 isEligible: item => item.type !== 'wp_template_part', 6459 modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'), 6460 RenderModal: ({ 6461 items, 6462 closeModal 6463 }) => { 6464 const [item] = items; 6465 const duplicatedProps = useDuplicatePatternProps({ 6466 pattern: item, 6467 onSuccess: () => closeModal?.() 6468 }); 6469 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { 6470 onClose: closeModal, 6471 confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6472 ...duplicatedProps 6473 }); 6474 } 6475 }; 6476 6477 /** 6478 * Duplicate action for Pattern. 6479 */ 6480 /* harmony default export */ const duplicate_pattern = (duplicatePattern); 6481 6482 ;// ./node_modules/@wordpress/fields/build-module/actions/rename-post.js 6483 /** 6484 * WordPress dependencies 6485 */ 6486 6487 6488 6489 6490 // @ts-ignore 6491 6492 6493 6494 6495 /** 6496 * Internal dependencies 6497 */ 6498 6499 6500 6501 6502 // Patterns. 6503 const { 6504 PATTERN_TYPES 6505 } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 6506 const renamePost = { 6507 id: 'rename-post', 6508 label: (0,external_wp_i18n_namespaceObject.__)('Rename'), 6509 isEligible(post) { 6510 if (post.status === 'trash') { 6511 return false; 6512 } 6513 // Templates, template parts and patterns have special checks for renaming. 6514 if (!['wp_template', 'wp_template_part', ...Object.values(PATTERN_TYPES)].includes(post.type)) { 6515 return post.permissions?.update; 6516 } 6517 6518 // In the case of templates, we can only rename custom templates. 6519 if (isTemplate(post)) { 6520 return isTemplateRemovable(post) && post.is_custom && post.permissions?.update; 6521 } 6522 if (isTemplatePart(post)) { 6523 return post.source === 'custom' && !post?.has_theme_file && post.permissions?.update; 6524 } 6525 return post.type === PATTERN_TYPES.user && post.permissions?.update; 6526 }, 6527 RenderModal: ({ 6528 items, 6529 closeModal, 6530 onActionPerformed 6531 }) => { 6532 const [item] = items; 6533 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item)); 6534 const { 6535 editEntityRecord, 6536 saveEditedEntityRecord 6537 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6538 const { 6539 createSuccessNotice, 6540 createErrorNotice 6541 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6542 async function onRename(event) { 6543 event.preventDefault(); 6544 try { 6545 await editEntityRecord('postType', item.type, item.id, { 6546 title 6547 }); 6548 // Update state before saving rerenders the list. 6549 setTitle(''); 6550 closeModal?.(); 6551 // Persist edited entity. 6552 await saveEditedEntityRecord('postType', item.type, item.id, { 6553 throwOnError: true 6554 }); 6555 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Name updated'), { 6556 type: 'snackbar' 6557 }); 6558 onActionPerformed?.(items); 6559 } catch (error) { 6560 const typedError = error; 6561 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the name'); 6562 createErrorNotice(errorMessage, { 6563 type: 'snackbar' 6564 }); 6565 } 6566 } 6567 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 6568 onSubmit: onRename, 6569 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 6570 spacing: "5", 6571 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 6572 __nextHasNoMarginBottom: true, 6573 __next40pxDefaultSize: true, 6574 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 6575 value: title, 6576 onChange: setTitle, 6577 required: true 6578 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 6579 justify: "right", 6580 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6581 __next40pxDefaultSize: true, 6582 variant: "tertiary", 6583 onClick: () => { 6584 closeModal?.(); 6585 }, 6586 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 6587 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6588 __next40pxDefaultSize: true, 6589 variant: "primary", 6590 type: "submit", 6591 children: (0,external_wp_i18n_namespaceObject.__)('Save') 6592 })] 6593 })] 6594 }) 6595 }); 6596 } 6597 }; 6598 6599 /** 6600 * Rename action for PostWithPermissions. 6601 */ 6602 /* harmony default export */ const rename_post = (renamePost); 6603 6604 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 6605 /** 6606 * Internal dependencies 6607 */ 6608 6609 function sort(a, b, direction) { 6610 return direction === 'asc' ? a - b : b - a; 6611 } 6612 function isValid(value, context) { 6613 // TODO: this implicitly means the value is required. 6614 if (value === '') { 6615 return false; 6616 } 6617 if (!Number.isInteger(Number(value))) { 6618 return false; 6619 } 6620 if (context?.elements) { 6621 const validValues = context?.elements.map(f => f.value); 6622 if (!validValues.includes(Number(value))) { 6623 return false; 6624 } 6625 } 6626 return true; 6627 } 6628 /* harmony default export */ const integer = ({ 6629 sort, 6630 isValid, 6631 Edit: 'integer' 6632 }); 6633 6634 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 6635 /** 6636 * Internal dependencies 6637 */ 6638 6639 function text_sort(valueA, valueB, direction) { 6640 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 6641 } 6642 function text_isValid(value, context) { 6643 if (context?.elements) { 6644 const validValues = context?.elements?.map(f => f.value); 6645 if (!validValues.includes(value)) { 6646 return false; 6647 } 6648 } 6649 return true; 6650 } 6651 /* harmony default export */ const field_types_text = ({ 6652 sort: text_sort, 6653 isValid: text_isValid, 6654 Edit: 'text' 6655 }); 6656 6657 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 6658 /** 6659 * Internal dependencies 6660 */ 6661 6662 function datetime_sort(a, b, direction) { 6663 const timeA = new Date(a).getTime(); 6664 const timeB = new Date(b).getTime(); 6665 return direction === 'asc' ? timeA - timeB : timeB - timeA; 6666 } 6667 function datetime_isValid(value, context) { 6668 if (context?.elements) { 6669 const validValues = context?.elements.map(f => f.value); 6670 if (!validValues.includes(value)) { 6671 return false; 6672 } 6673 } 6674 return true; 6675 } 6676 /* harmony default export */ const datetime = ({ 6677 sort: datetime_sort, 6678 isValid: datetime_isValid, 6679 Edit: 'datetime' 6680 }); 6681 6682 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 6683 /** 6684 * Internal dependencies 6685 */ 6686 6687 6688 6689 6690 6691 /** 6692 * 6693 * @param {FieldType} type The field type definition to get. 6694 * 6695 * @return A field type definition. 6696 */ 6697 function getFieldTypeDefinition(type) { 6698 if ('integer' === type) { 6699 return integer; 6700 } 6701 if ('text' === type) { 6702 return field_types_text; 6703 } 6704 if ('datetime' === type) { 6705 return datetime; 6706 } 6707 return { 6708 sort: (a, b, direction) => { 6709 if (typeof a === 'number' && typeof b === 'number') { 6710 return direction === 'asc' ? a - b : b - a; 6711 } 6712 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 6713 }, 6714 isValid: (value, context) => { 6715 if (context?.elements) { 6716 const validValues = context?.elements?.map(f => f.value); 6717 if (!validValues.includes(value)) { 6718 return false; 6719 } 6720 } 6721 return true; 6722 }, 6723 Edit: () => null 6724 }; 6725 } 6726 6727 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 6728 /** 6729 * WordPress dependencies 6730 */ 6731 6732 6733 6734 /** 6735 * Internal dependencies 6736 */ 6737 6738 function DateTime({ 6739 data, 6740 field, 6741 onChange, 6742 hideLabelFromVision 6743 }) { 6744 const { 6745 id, 6746 label 6747 } = field; 6748 const value = field.getValue({ 6749 item: data 6750 }); 6751 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6752 [id]: newValue 6753 }), [id, onChange]); 6754 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 6755 className: "dataviews-controls__datetime", 6756 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6757 as: "legend", 6758 children: label 6759 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 6760 as: "legend", 6761 children: label 6762 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 6763 currentTime: value, 6764 onChange: onChangeControl, 6765 hideLabelFromVision: true 6766 })] 6767 }); 6768 } 6769 6770 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 6771 /** 6772 * WordPress dependencies 6773 */ 6774 6775 6776 6777 /** 6778 * Internal dependencies 6779 */ 6780 6781 function Integer({ 6782 data, 6783 field, 6784 onChange, 6785 hideLabelFromVision 6786 }) { 6787 var _field$getValue; 6788 const { 6789 id, 6790 label, 6791 description 6792 } = field; 6793 const value = (_field$getValue = field.getValue({ 6794 item: data 6795 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 6796 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6797 [id]: Number(newValue) 6798 }), [id, onChange]); 6799 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 6800 label: label, 6801 help: description, 6802 value: value, 6803 onChange: onChangeControl, 6804 __next40pxDefaultSize: true, 6805 hideLabelFromVision: hideLabelFromVision 6806 }); 6807 } 6808 6809 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 6810 /** 6811 * WordPress dependencies 6812 */ 6813 6814 6815 6816 /** 6817 * Internal dependencies 6818 */ 6819 6820 function Radio({ 6821 data, 6822 field, 6823 onChange, 6824 hideLabelFromVision 6825 }) { 6826 const { 6827 id, 6828 label 6829 } = field; 6830 const value = field.getValue({ 6831 item: data 6832 }); 6833 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6834 [id]: newValue 6835 }), [id, onChange]); 6836 if (field.elements) { 6837 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 6838 label: label, 6839 onChange: onChangeControl, 6840 options: field.elements, 6841 selected: value, 6842 hideLabelFromVision: hideLabelFromVision 6843 }); 6844 } 6845 return null; 6846 } 6847 6848 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 6849 /** 6850 * WordPress dependencies 6851 */ 6852 6853 6854 6855 6856 /** 6857 * Internal dependencies 6858 */ 6859 6860 function Select({ 6861 data, 6862 field, 6863 onChange, 6864 hideLabelFromVision 6865 }) { 6866 var _field$getValue, _field$elements; 6867 const { 6868 id, 6869 label 6870 } = field; 6871 const value = (_field$getValue = field.getValue({ 6872 item: data 6873 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 6874 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6875 [id]: newValue 6876 }), [id, onChange]); 6877 const elements = [ 6878 /* 6879 * Value can be undefined when: 6880 * 6881 * - the field is not required 6882 * - in bulk editing 6883 * 6884 */ 6885 { 6886 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 6887 value: '' 6888 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 6889 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 6890 label: label, 6891 value: value, 6892 options: elements, 6893 onChange: onChangeControl, 6894 __next40pxDefaultSize: true, 6895 __nextHasNoMarginBottom: true, 6896 hideLabelFromVision: hideLabelFromVision 6897 }); 6898 } 6899 6900 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 6901 /** 6902 * WordPress dependencies 6903 */ 6904 6905 6906 6907 /** 6908 * Internal dependencies 6909 */ 6910 6911 function Text({ 6912 data, 6913 field, 6914 onChange, 6915 hideLabelFromVision 6916 }) { 6917 const { 6918 id, 6919 label, 6920 placeholder 6921 } = field; 6922 const value = field.getValue({ 6923 item: data 6924 }); 6925 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6926 [id]: newValue 6927 }), [id, onChange]); 6928 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 6929 label: label, 6930 placeholder: placeholder, 6931 value: value !== null && value !== void 0 ? value : '', 6932 onChange: onChangeControl, 6933 __next40pxDefaultSize: true, 6934 __nextHasNoMarginBottom: true, 6935 hideLabelFromVision: hideLabelFromVision 6936 }); 6937 } 6938 6939 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 6940 /** 6941 * External dependencies 6942 */ 6943 6944 /** 6945 * Internal dependencies 6946 */ 6947 6948 6949 6950 6951 6952 6953 const FORM_CONTROLS = { 6954 datetime: DateTime, 6955 integer: Integer, 6956 radio: Radio, 6957 select: Select, 6958 text: Text 6959 }; 6960 function getControl(field, fieldTypeDefinition) { 6961 if (typeof field.Edit === 'function') { 6962 return field.Edit; 6963 } 6964 if (typeof field.Edit === 'string') { 6965 return getControlByType(field.Edit); 6966 } 6967 if (field.elements) { 6968 return getControlByType('select'); 6969 } 6970 if (typeof fieldTypeDefinition.Edit === 'string') { 6971 return getControlByType(fieldTypeDefinition.Edit); 6972 } 6973 return fieldTypeDefinition.Edit; 6974 } 6975 function getControlByType(type) { 6976 if (Object.keys(FORM_CONTROLS).includes(type)) { 6977 return FORM_CONTROLS[type]; 6978 } 6979 throw 'Control ' + type + ' not found'; 6980 } 6981 6982 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 6983 /* wp:polyfill */ 6984 /** 6985 * Internal dependencies 6986 */ 6987 6988 6989 const getValueFromId = id => ({ 6990 item 6991 }) => { 6992 const path = id.split('.'); 6993 let value = item; 6994 for (const segment of path) { 6995 if (value.hasOwnProperty(segment)) { 6996 value = value[segment]; 6997 } else { 6998 value = undefined; 6999 } 7000 } 7001 return value; 7002 }; 7003 7004 /** 7005 * Apply default values and normalize the fields config. 7006 * 7007 * @param fields Fields config. 7008 * @return Normalized fields config. 7009 */ 7010 function normalizeFields(fields) { 7011 return fields.map(field => { 7012 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 7013 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 7014 const getValue = field.getValue || getValueFromId(field.id); 7015 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 7016 return fieldTypeDefinition.sort(getValue({ 7017 item: a 7018 }), getValue({ 7019 item: b 7020 }), direction); 7021 }; 7022 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 7023 return fieldTypeDefinition.isValid(getValue({ 7024 item 7025 }), context); 7026 }; 7027 const Edit = getControl(field, fieldTypeDefinition); 7028 const renderFromElements = ({ 7029 item 7030 }) => { 7031 const value = getValue({ 7032 item 7033 }); 7034 return field?.elements?.find(element => element.value === value)?.label || getValue({ 7035 item 7036 }); 7037 }; 7038 const render = field.render || (field.elements ? renderFromElements : getValue); 7039 return { 7040 ...field, 7041 label: field.label || field.id, 7042 header: field.header || field.label || field.id, 7043 getValue, 7044 render, 7045 sort, 7046 isValid, 7047 Edit, 7048 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 7049 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 7050 }; 7051 }); 7052 } 7053 7054 ;// ./node_modules/@wordpress/dataviews/build-module/validation.js 7055 /* wp:polyfill */ 7056 /** 7057 * Internal dependencies 7058 */ 7059 7060 /** 7061 * Whether or not the given item's value is valid according to the fields and form config. 7062 * 7063 * @param item The item to validate. 7064 * @param fields Fields config. 7065 * @param form Form config. 7066 * 7067 * @return A boolean indicating if the item is valid (true) or not (false). 7068 */ 7069 function isItemValid(item, fields, form) { 7070 const _fields = normalizeFields(fields.filter(({ 7071 id 7072 }) => !!form.fields?.includes(id))); 7073 return _fields.every(field => { 7074 return field.isValid(item, { 7075 elements: field.elements 7076 }); 7077 }); 7078 } 7079 7080 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js 7081 /** 7082 * WordPress dependencies 7083 */ 7084 7085 7086 /** 7087 * Internal dependencies 7088 */ 7089 7090 const DataFormContext = (0,external_wp_element_namespaceObject.createContext)({ 7091 fields: [] 7092 }); 7093 function DataFormProvider({ 7094 fields, 7095 children 7096 }) { 7097 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { 7098 value: { 7099 fields 7100 }, 7101 children: children 7102 }); 7103 } 7104 /* harmony default export */ const dataform_context = (DataFormContext); 7105 7106 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/is-combined-field.js 7107 /** 7108 * Internal dependencies 7109 */ 7110 7111 function isCombinedField(field) { 7112 return field.children !== undefined; 7113 } 7114 7115 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 7116 /* wp:polyfill */ 7117 /** 7118 * WordPress dependencies 7119 */ 7120 7121 7122 7123 /** 7124 * Internal dependencies 7125 */ 7126 7127 7128 7129 7130 7131 function Header({ 7132 title 7133 }) { 7134 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7135 className: "dataforms-layouts-regular__header", 7136 spacing: 4, 7137 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7138 alignment: "center", 7139 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 7140 level: 2, 7141 size: 13, 7142 children: title 7143 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})] 7144 }) 7145 }); 7146 } 7147 function FormRegularField({ 7148 data, 7149 field, 7150 onChange, 7151 hideLabelFromVision 7152 }) { 7153 var _field$labelPosition; 7154 const { 7155 fields 7156 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 7157 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 7158 if (isCombinedField(field)) { 7159 return { 7160 fields: field.children.map(child => { 7161 if (typeof child === 'string') { 7162 return { 7163 id: child 7164 }; 7165 } 7166 return child; 7167 }), 7168 type: 'regular' 7169 }; 7170 } 7171 return { 7172 type: 'regular', 7173 fields: [] 7174 }; 7175 }, [field]); 7176 if (isCombinedField(field)) { 7177 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7178 children: [!hideLabelFromVision && field.label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Header, { 7179 title: field.label 7180 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 7181 data: data, 7182 form: form, 7183 onChange: onChange 7184 })] 7185 }); 7186 } 7187 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'top'; 7188 const fieldDefinition = fields.find(fieldDef => fieldDef.id === field.id); 7189 if (!fieldDefinition) { 7190 return null; 7191 } 7192 if (labelPosition === 'side') { 7193 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7194 className: "dataforms-layouts-regular__field", 7195 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7196 className: "dataforms-layouts-regular__field-label", 7197 children: fieldDefinition.label 7198 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7199 className: "dataforms-layouts-regular__field-control", 7200 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 7201 data: data, 7202 field: fieldDefinition, 7203 onChange: onChange, 7204 hideLabelFromVision: true 7205 }, fieldDefinition.id) 7206 })] 7207 }); 7208 } 7209 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7210 className: "dataforms-layouts-regular__field", 7211 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.Edit, { 7212 data: data, 7213 field: fieldDefinition, 7214 onChange: onChange, 7215 hideLabelFromVision: labelPosition === 'none' ? true : hideLabelFromVision 7216 }) 7217 }); 7218 } 7219 7220 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 7221 /** 7222 * WordPress dependencies 7223 */ 7224 7225 7226 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7227 xmlns: "http://www.w3.org/2000/svg", 7228 viewBox: "0 0 24 24", 7229 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7230 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" 7231 }) 7232 }); 7233 /* harmony default export */ const close_small = (closeSmall); 7234 7235 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 7236 /* wp:polyfill */ 7237 /** 7238 * WordPress dependencies 7239 */ 7240 7241 7242 7243 7244 7245 /** 7246 * Internal dependencies 7247 */ 7248 7249 7250 7251 7252 7253 function DropdownHeader({ 7254 title, 7255 onClose 7256 }) { 7257 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7258 className: "dataforms-layouts-panel__dropdown-header", 7259 spacing: 4, 7260 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7261 alignment: "center", 7262 children: [title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 7263 level: 2, 7264 size: 13, 7265 children: title 7266 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7267 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 7268 icon: close_small, 7269 onClick: onClose, 7270 size: "small" 7271 })] 7272 }) 7273 }); 7274 } 7275 function PanelDropdown({ 7276 fieldDefinition, 7277 popoverAnchor, 7278 labelPosition = 'side', 7279 data, 7280 onChange, 7281 field 7282 }) { 7283 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 7284 const form = (0,external_wp_element_namespaceObject.useMemo)(() => { 7285 if (isCombinedField(field)) { 7286 return { 7287 type: 'regular', 7288 fields: field.children.map(child => { 7289 if (typeof child === 'string') { 7290 return { 7291 id: child 7292 }; 7293 } 7294 return child; 7295 }) 7296 }; 7297 } 7298 // If not explicit children return the field id itself. 7299 return { 7300 type: 'regular', 7301 fields: [{ 7302 id: field.id 7303 }] 7304 }; 7305 }, [field]); 7306 7307 // Memoize popoverProps to avoid returning a new object every time. 7308 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 7309 // Anchor the popover to the middle of the entire row so that it doesn't 7310 // move around when the label changes. 7311 anchor: popoverAnchor, 7312 placement: 'left-start', 7313 offset: 36, 7314 shift: true 7315 }), [popoverAnchor]); 7316 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 7317 contentClassName: "dataforms-layouts-panel__field-dropdown", 7318 popoverProps: popoverProps, 7319 focusOnMount: true, 7320 toggleProps: { 7321 size: 'compact', 7322 variant: 'tertiary', 7323 tooltipPosition: 'middle left' 7324 }, 7325 renderToggle: ({ 7326 isOpen, 7327 onToggle 7328 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7329 className: "dataforms-layouts-panel__field-control", 7330 size: "compact", 7331 variant: ['none', 'top'].includes(labelPosition) ? 'link' : 'tertiary', 7332 "aria-expanded": isOpen, 7333 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 7334 // translators: %s: Field name. 7335 (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), fieldLabel), 7336 onClick: onToggle, 7337 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fieldDefinition.render, { 7338 item: data 7339 }) 7340 }), 7341 renderContent: ({ 7342 onClose 7343 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7344 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 7345 title: fieldLabel, 7346 onClose: onClose 7347 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 7348 data: data, 7349 form: form, 7350 onChange: onChange, 7351 children: (FieldLayout, nestedField) => { 7352 var _form$fields; 7353 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 7354 data: data, 7355 field: nestedField, 7356 onChange: onChange, 7357 hideLabelFromVision: ((_form$fields = form?.fields) !== null && _form$fields !== void 0 ? _form$fields : []).length < 2 7358 }, nestedField.id); 7359 } 7360 })] 7361 }) 7362 }); 7363 } 7364 function FormPanelField({ 7365 data, 7366 field, 7367 onChange 7368 }) { 7369 var _field$labelPosition; 7370 const { 7371 fields 7372 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 7373 const fieldDefinition = fields.find(fieldDef => { 7374 // Default to the first child if it is a combined field. 7375 if (isCombinedField(field)) { 7376 const children = field.children.filter(child => typeof child === 'string' || !isCombinedField(child)); 7377 const firstChildFieldId = typeof children[0] === 'string' ? children[0] : children[0].id; 7378 return fieldDef.id === firstChildFieldId; 7379 } 7380 return fieldDef.id === field.id; 7381 }); 7382 const labelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : 'side'; 7383 7384 // Use internal state instead of a ref to make sure that the component 7385 // re-renders when the popover's anchor updates. 7386 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 7387 if (!fieldDefinition) { 7388 return null; 7389 } 7390 const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label; 7391 if (labelPosition === 'top') { 7392 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 7393 className: "dataforms-layouts-panel__field", 7394 spacing: 0, 7395 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7396 className: "dataforms-layouts-panel__field-label", 7397 style: { 7398 paddingBottom: 0 7399 }, 7400 children: fieldLabel 7401 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7402 className: "dataforms-layouts-panel__field-control", 7403 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 7404 field: field, 7405 popoverAnchor: popoverAnchor, 7406 fieldDefinition: fieldDefinition, 7407 data: data, 7408 onChange: onChange, 7409 labelPosition: labelPosition 7410 }) 7411 })] 7412 }); 7413 } 7414 if (labelPosition === 'none') { 7415 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7416 className: "dataforms-layouts-panel__field", 7417 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 7418 field: field, 7419 popoverAnchor: popoverAnchor, 7420 fieldDefinition: fieldDefinition, 7421 data: data, 7422 onChange: onChange, 7423 labelPosition: labelPosition 7424 }) 7425 }); 7426 } 7427 7428 // Defaults to label position side. 7429 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7430 ref: setPopoverAnchor, 7431 className: "dataforms-layouts-panel__field", 7432 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7433 className: "dataforms-layouts-panel__field-label", 7434 children: fieldLabel 7435 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7436 className: "dataforms-layouts-panel__field-control", 7437 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelDropdown, { 7438 field: field, 7439 popoverAnchor: popoverAnchor, 7440 fieldDefinition: fieldDefinition, 7441 data: data, 7442 onChange: onChange, 7443 labelPosition: labelPosition 7444 }) 7445 })] 7446 }); 7447 } 7448 7449 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 7450 /* wp:polyfill */ 7451 /** 7452 * Internal dependencies 7453 */ 7454 7455 7456 const FORM_FIELD_LAYOUTS = [{ 7457 type: 'regular', 7458 component: FormRegularField 7459 }, { 7460 type: 'panel', 7461 component: FormPanelField 7462 }]; 7463 function getFormFieldLayout(type) { 7464 return FORM_FIELD_LAYOUTS.find(layout => layout.type === type); 7465 } 7466 7467 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-form-fields.js 7468 /* wp:polyfill */ 7469 /** 7470 * Internal dependencies 7471 */ 7472 7473 function normalizeFormFields(form) { 7474 var _form$type, _form$labelPosition, _form$fields; 7475 let layout = 'regular'; 7476 if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) { 7477 layout = form.type; 7478 } 7479 const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side'; 7480 return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => { 7481 var _field$layout, _field$labelPosition; 7482 if (typeof field === 'string') { 7483 return { 7484 id: field, 7485 layout, 7486 labelPosition 7487 }; 7488 } 7489 const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout; 7490 const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side'; 7491 return { 7492 ...field, 7493 layout: fieldLayout, 7494 labelPosition: fieldLabelPosition 7495 }; 7496 }); 7497 } 7498 7499 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/data-form-layout.js 7500 /* wp:polyfill */ 7501 /** 7502 * WordPress dependencies 7503 */ 7504 7505 7506 7507 /** 7508 * Internal dependencies 7509 */ 7510 7511 7512 7513 7514 7515 7516 function DataFormLayout({ 7517 data, 7518 form, 7519 onChange, 7520 children 7521 }) { 7522 const { 7523 fields: fieldDefinitions 7524 } = (0,external_wp_element_namespaceObject.useContext)(dataform_context); 7525 function getFieldDefinition(field) { 7526 const fieldId = typeof field === 'string' ? field : field.id; 7527 return fieldDefinitions.find(fieldDefinition => fieldDefinition.id === fieldId); 7528 } 7529 const normalizedFormFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFormFields(form), [form]); 7530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7531 spacing: 2, 7532 children: normalizedFormFields.map(formField => { 7533 const FieldLayout = getFormFieldLayout(formField.layout)?.component; 7534 if (!FieldLayout) { 7535 return null; 7536 } 7537 const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : undefined; 7538 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 7539 return null; 7540 } 7541 if (children) { 7542 return children(FieldLayout, formField); 7543 } 7544 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldLayout, { 7545 data: data, 7546 field: formField, 7547 onChange: onChange 7548 }, formField.id); 7549 }) 7550 }); 7551 } 7552 7553 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 7554 /** 7555 * WordPress dependencies 7556 */ 7557 7558 7559 /** 7560 * Internal dependencies 7561 */ 7562 7563 7564 7565 7566 7567 function DataForm({ 7568 data, 7569 form, 7570 fields, 7571 onChange 7572 }) { 7573 const normalizedFields = (0,external_wp_element_namespaceObject.useMemo)(() => normalizeFields(fields), [fields]); 7574 if (!form.fields) { 7575 return null; 7576 } 7577 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { 7578 fields: normalizedFields, 7579 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormLayout, { 7580 data: data, 7581 form: form, 7582 onChange: onChange 7583 }) 7584 }); 7585 } 7586 7587 ;// ./node_modules/@wordpress/fields/build-module/fields/order/index.js 7588 /** 7589 * WordPress dependencies 7590 */ 7591 7592 7593 7594 /** 7595 * Internal dependencies 7596 */ 7597 7598 const orderField = { 7599 id: 'menu_order', 7600 type: 'integer', 7601 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 7602 description: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages.') 7603 }; 7604 7605 /** 7606 * Order field for BasePost. 7607 */ 7608 /* harmony default export */ const order = (orderField); 7609 7610 ;// ./node_modules/@wordpress/fields/build-module/actions/reorder-page.js 7611 /** 7612 * WordPress dependencies 7613 */ 7614 7615 7616 7617 7618 7619 7620 7621 7622 /** 7623 * Internal dependencies 7624 */ 7625 7626 7627 7628 const reorder_page_fields = [order]; 7629 const formOrderAction = { 7630 fields: ['menu_order'] 7631 }; 7632 function ReorderModal({ 7633 items, 7634 closeModal, 7635 onActionPerformed 7636 }) { 7637 const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]); 7638 const orderInput = item.menu_order; 7639 const { 7640 editEntityRecord, 7641 saveEditedEntityRecord 7642 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 7643 const { 7644 createSuccessNotice, 7645 createErrorNotice 7646 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 7647 async function onOrder(event) { 7648 event.preventDefault(); 7649 if (!isItemValid(item, reorder_page_fields, formOrderAction)) { 7650 return; 7651 } 7652 try { 7653 await editEntityRecord('postType', item.type, item.id, { 7654 menu_order: orderInput 7655 }); 7656 closeModal?.(); 7657 // Persist edited entity. 7658 await saveEditedEntityRecord('postType', item.type, item.id, { 7659 throwOnError: true 7660 }); 7661 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Order updated.'), { 7662 type: 'snackbar' 7663 }); 7664 onActionPerformed?.(items); 7665 } catch (error) { 7666 const typedError = error; 7667 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the order'); 7668 createErrorNotice(errorMessage, { 7669 type: 'snackbar' 7670 }); 7671 } 7672 } 7673 const isSaveDisabled = !isItemValid(item, reorder_page_fields, formOrderAction); 7674 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 7675 onSubmit: onOrder, 7676 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 7677 spacing: "5", 7678 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7679 children: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.') 7680 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 7681 data: item, 7682 fields: reorder_page_fields, 7683 form: formOrderAction, 7684 onChange: changes => setItem({ 7685 ...item, 7686 ...changes 7687 }) 7688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7689 justify: "right", 7690 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7691 __next40pxDefaultSize: true, 7692 variant: "tertiary", 7693 onClick: () => { 7694 closeModal?.(); 7695 }, 7696 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 7697 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7698 __next40pxDefaultSize: true, 7699 variant: "primary", 7700 type: "submit", 7701 accessibleWhenDisabled: true, 7702 disabled: isSaveDisabled, 7703 children: (0,external_wp_i18n_namespaceObject.__)('Save') 7704 })] 7705 })] 7706 }) 7707 }); 7708 } 7709 const reorderPage = { 7710 id: 'order-pages', 7711 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 7712 isEligible({ 7713 status 7714 }) { 7715 return status !== 'trash'; 7716 }, 7717 RenderModal: ReorderModal 7718 }; 7719 7720 /** 7721 * Reorder action for BasePost. 7722 */ 7723 /* harmony default export */ const reorder_page = (reorderPage); 7724 7725 ;// ./node_modules/client-zip/index.js 7726 "stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function f(e,i){if(void 0===i||i instanceof Date||(i=new Date(i)),e instanceof File)return{isFile:1,t:i||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:i};if("string"==typeof e)return{isFile:1,t:i,i:t(e)};if(e instanceof Blob)return{isFile:1,t:i,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:i,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:i,i:n(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:i,i:o(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function o(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[f,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{o:d(f||t(e.name)),u:BigInt(e.size),l:o};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{o:d(f||t(s)),u:BigInt(u),l:o}}return f=d(f,void 0!==e||void 0!==r),"string"==typeof e?{o:f,u:BigInt(t(e).length),l:o}:e instanceof Blob?{o:f,u:BigInt(e.size),l:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:f,u:BigInt(e.byteLength),l:o}:{o:f,u:u(e,r),l:o}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n^=-1;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return(-1^n)>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({o:e,l:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.o.length,1),n(r)}async function*g(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=y(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.m=y(n,e.m),e.u+=BigInt(n.length),yield n}}}function I(t,r){const f=e(16+(r?8:0));return f.setUint32(0,1347094280),f.setUint32(4,t.isFile?t.m:0,1),r?(f.setBigUint64(8,t.u,1),f.setBigUint64(16,t.u,1)):(f.setUint32(8,i(t.u),1),f.setUint32(12,i(t.u),1)),n(f)}function v(t,r,f=0,o=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|f),w(t.t,a,12),a.setUint32(16,t.isFile?t.m:0,1),a.setUint32(20,i(t.u),1),a.setUint32(24,i(t.u),1),a.setUint16(28,t.o.length,1),a.setUint16(30,o,1),a.setUint16(40,t.isFile?33204:16893,1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const f=e(r);return f.setUint16(0,1,1),f.setUint16(2,r-4,1),16&r&&(f.setBigUint64(4,t.u,1),f.setBigUint64(12,t.u,1)),f.setBigUint64(r-8,i,1),n(f)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.o)throw new Error("Every file must have a non-empty name.");if(void 0===r.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.o)}".`);const e=r.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+r.o.length+(e&&8))+r.u,n+=BigInt(r.o.length+46+(12*f|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(f(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return o(async function*(t,f){const o=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,f.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.o),e.isFile&&(yield*g(e));const t=e.u>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),o.push(v(e,a,n,i)),o.push(e.o),i&&o.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.o.length)+e.u,u||(u=t)}let d=0n;for(const e of o)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)} 7727 ;// external ["wp","blob"] 7728 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 7729 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 7730 /** 7731 * WordPress dependencies 7732 */ 7733 7734 7735 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7736 xmlns: "http://www.w3.org/2000/svg", 7737 viewBox: "0 0 24 24", 7738 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7739 d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" 7740 }) 7741 }); 7742 /* harmony default export */ const library_download = (download); 7743 7744 ;// ./node_modules/@wordpress/fields/build-module/actions/export-pattern.js 7745 /* wp:polyfill */ 7746 /** 7747 * External dependencies 7748 */ 7749 7750 7751 7752 /** 7753 * WordPress dependencies 7754 */ 7755 7756 7757 7758 7759 /** 7760 * Internal dependencies 7761 */ 7762 7763 7764 function getJsonFromItem(item) { 7765 return JSON.stringify({ 7766 __file: item.type, 7767 title: getItemTitle(item), 7768 content: typeof item.content === 'string' ? item.content : item.content?.raw, 7769 syncStatus: item.wp_pattern_sync_status 7770 }, null, 2); 7771 } 7772 const exportPattern = { 7773 id: 'export-pattern', 7774 label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'), 7775 icon: library_download, 7776 supportsBulk: true, 7777 isEligible: item => item.type === 'wp_block', 7778 callback: async items => { 7779 if (items.length === 1) { 7780 return (0,external_wp_blob_namespaceObject.downloadBlob)(`$paramCase(getItemTitle(items[0]) || items[0].slug)}.json`, getJsonFromItem(items[0]), 'application/json'); 7781 } 7782 const nameCount = {}; 7783 const filesToZip = items.map(item => { 7784 const name = paramCase(getItemTitle(item) || item.slug); 7785 nameCount[name] = (nameCount[name] || 0) + 1; 7786 return { 7787 name: `$name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`, 7788 lastModified: new Date(), 7789 input: getJsonFromItem(item) 7790 }; 7791 }); 7792 return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip'); 7793 } 7794 }; 7795 7796 /** 7797 * Export action as JSON for Pattern. 7798 */ 7799 /* harmony default export */ const export_pattern = (exportPattern); 7800 7801 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 7802 /** 7803 * WordPress dependencies 7804 */ 7805 7806 7807 const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7808 xmlns: "http://www.w3.org/2000/svg", 7809 viewBox: "0 0 24 24", 7810 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7811 d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" 7812 }) 7813 }); 7814 /* harmony default export */ const library_backup = (backup); 7815 7816 ;// ./node_modules/@wordpress/fields/build-module/actions/restore-post.js 7817 /* wp:polyfill */ 7818 /** 7819 * WordPress dependencies 7820 */ 7821 7822 7823 7824 7825 /** 7826 * Internal dependencies 7827 */ 7828 7829 const restorePost = { 7830 id: 'restore', 7831 label: (0,external_wp_i18n_namespaceObject.__)('Restore'), 7832 isPrimary: true, 7833 icon: library_backup, 7834 supportsBulk: true, 7835 isEligible(item) { 7836 return !isTemplateOrTemplatePart(item) && item.type !== 'wp_block' && item.status === 'trash' && item.permissions?.update; 7837 }, 7838 async callback(posts, { 7839 registry, 7840 onActionPerformed 7841 }) { 7842 const { 7843 createSuccessNotice, 7844 createErrorNotice 7845 } = registry.dispatch(external_wp_notices_namespaceObject.store); 7846 const { 7847 editEntityRecord, 7848 saveEditedEntityRecord 7849 } = registry.dispatch(external_wp_coreData_namespaceObject.store); 7850 await Promise.allSettled(posts.map(post => { 7851 return editEntityRecord('postType', post.type, post.id, { 7852 status: 'draft' 7853 }); 7854 })); 7855 const promiseResult = await Promise.allSettled(posts.map(post => { 7856 return saveEditedEntityRecord('postType', post.type, post.id, { 7857 throwOnError: true 7858 }); 7859 })); 7860 if (promiseResult.every(({ 7861 status 7862 }) => status === 'fulfilled')) { 7863 let successMessage; 7864 if (posts.length === 1) { 7865 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ 7866 (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0])); 7867 } else if (posts[0].type === 'page') { 7868 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ 7869 (0,external_wp_i18n_namespaceObject.__)('%d pages have been restored.'), posts.length); 7870 } else { 7871 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of posts. */ 7872 (0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length); 7873 } 7874 createSuccessNotice(successMessage, { 7875 type: 'snackbar', 7876 id: 'restore-post-action' 7877 }); 7878 if (onActionPerformed) { 7879 onActionPerformed(posts); 7880 } 7881 } else { 7882 // If there was at lease one failure. 7883 let errorMessage; 7884 // If we were trying to move a single post to the trash. 7885 if (promiseResult.length === 1) { 7886 const typedError = promiseResult[0]; 7887 if (typedError.reason?.message) { 7888 errorMessage = typedError.reason.message; 7889 } else { 7890 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.'); 7891 } 7892 // If we were trying to move multiple posts to the trash 7893 } else { 7894 const errorMessages = new Set(); 7895 const failedPromises = promiseResult.filter(({ 7896 status 7897 }) => status === 'rejected'); 7898 for (const failedPromise of failedPromises) { 7899 const typedError = failedPromise; 7900 if (typedError.reason?.message) { 7901 errorMessages.add(typedError.reason.message); 7902 } 7903 } 7904 if (errorMessages.size === 0) { 7905 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.'); 7906 } else if (errorMessages.size === 1) { 7907 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 7908 (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]); 7909 } else { 7910 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 7911 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(',')); 7912 } 7913 } 7914 createErrorNotice(errorMessage, { 7915 type: 'snackbar' 7916 }); 7917 } 7918 } 7919 }; 7920 7921 /** 7922 * Restore action for PostWithPermissions. 7923 */ 7924 /* harmony default export */ const restore_post = (restorePost); 7925 7926 ;// ./node_modules/@wordpress/fields/build-module/actions/reset-post.js 7927 /** 7928 * WordPress dependencies 7929 */ 7930 7931 7932 7933 7934 7935 7936 // @ts-ignore 7937 7938 7939 7940 7941 7942 /** 7943 * Internal dependencies 7944 */ 7945 7946 7947 const reset_post_isTemplateRevertable = templateOrTemplatePart => { 7948 if (!templateOrTemplatePart) { 7949 return false; 7950 } 7951 return templateOrTemplatePart.source === 'custom' && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 7952 }; 7953 7954 /** 7955 * Copied - pasted from https://github.com/WordPress/gutenberg/blob/bf1462ad37d4637ebbf63270b9c244b23c69e2a8/packages/editor/src/store/private-actions.js#L233-L365 7956 * 7957 * @param {Object} template The template to revert. 7958 * @param {Object} [options] 7959 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 7960 * reverting the template. Default true. 7961 */ 7962 const revertTemplate = async (template, { 7963 allowUndo = true 7964 } = {}) => { 7965 const noticeId = 'edit-site-template-reverted'; 7966 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 7967 if (!reset_post_isTemplateRevertable(template)) { 7968 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { 7969 type: 'snackbar' 7970 }); 7971 return; 7972 } 7973 try { 7974 const templateEntityConfig = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); 7975 if (!templateEntityConfig) { 7976 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 7977 type: 'snackbar' 7978 }); 7979 return; 7980 } 7981 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`$templateEntityConfig.baseURL}/$template.id}`, { 7982 context: 'edit', 7983 source: template.origin 7984 }); 7985 const fileTemplate = await external_wp_apiFetch_default()({ 7986 path: fileTemplatePath 7987 }); 7988 if (!fileTemplate) { 7989 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 7990 type: 'snackbar' 7991 }); 7992 return; 7993 } 7994 const serializeBlocks = ({ 7995 blocks: blocksForSerialization = [] 7996 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 7997 const edited = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); 7998 7999 // We are fixing up the undo level here to make sure we can undo 8000 // the revert in the header toolbar correctly. 8001 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { 8002 content: serializeBlocks, 8003 // Required to make the `undo` behave correctly. 8004 blocks: edited.blocks, 8005 // Required to revert the blocks in the editor. 8006 source: 'custom' // required to avoid turning the editor into a dirty state 8007 }, { 8008 undoIgnore: true // Required to merge this edit with the last undo level. 8009 }); 8010 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 8011 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { 8012 content: serializeBlocks, 8013 blocks, 8014 source: 'theme' 8015 }); 8016 if (allowUndo) { 8017 const undoRevert = () => { 8018 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { 8019 content: serializeBlocks, 8020 blocks: edited.blocks, 8021 source: 'custom' 8022 }); 8023 }; 8024 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { 8025 type: 'snackbar', 8026 id: noticeId, 8027 actions: [{ 8028 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 8029 onClick: undoRevert 8030 }] 8031 }); 8032 } 8033 } catch (error) { 8034 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); 8035 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 8036 type: 'snackbar' 8037 }); 8038 } 8039 }; 8040 const resetPostAction = { 8041 id: 'reset-post', 8042 label: (0,external_wp_i18n_namespaceObject.__)('Reset'), 8043 isEligible: item => { 8044 return isTemplateOrTemplatePart(item) && item?.source === 'custom' && (Boolean(item.type === 'wp_template' && item?.plugin) || item?.has_theme_file); 8045 }, 8046 icon: library_backup, 8047 supportsBulk: true, 8048 hideModalHeader: true, 8049 RenderModal: ({ 8050 items, 8051 closeModal, 8052 onActionPerformed 8053 }) => { 8054 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 8055 const { 8056 saveEditedEntityRecord 8057 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8058 const { 8059 createSuccessNotice, 8060 createErrorNotice 8061 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 8062 const onConfirm = async () => { 8063 try { 8064 for (const template of items) { 8065 await revertTemplate(template, { 8066 allowUndo: false 8067 }); 8068 await saveEditedEntityRecord('postType', template.type, template.id); 8069 } 8070 createSuccessNotice(items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of items. */ 8071 (0,external_wp_i18n_namespaceObject.__)('%s items reset.'), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ 8072 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), getItemTitle(items[0])), { 8073 type: 'snackbar', 8074 id: 'revert-template-action' 8075 }); 8076 } catch (error) { 8077 let fallbackErrorMessage; 8078 if (items[0].type === 'wp_template') { 8079 fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the templates.'); 8080 } else { 8081 fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template parts.'); 8082 } 8083 const typedError = error; 8084 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : fallbackErrorMessage; 8085 createErrorNotice(errorMessage, { 8086 type: 'snackbar' 8087 }); 8088 } 8089 }; 8090 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 8091 spacing: "5", 8092 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8093 children: (0,external_wp_i18n_namespaceObject.__)('Reset to default and clear all customizations?') 8094 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8095 justify: "right", 8096 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8097 __next40pxDefaultSize: true, 8098 variant: "tertiary", 8099 onClick: closeModal, 8100 disabled: isBusy, 8101 accessibleWhenDisabled: true, 8102 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 8103 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8104 __next40pxDefaultSize: true, 8105 variant: "primary", 8106 onClick: async () => { 8107 setIsBusy(true); 8108 await onConfirm(); 8109 onActionPerformed?.(items); 8110 setIsBusy(false); 8111 closeModal?.(); 8112 }, 8113 isBusy: isBusy, 8114 disabled: isBusy, 8115 accessibleWhenDisabled: true, 8116 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 8117 })] 8118 })] 8119 }); 8120 } 8121 }; 8122 8123 /** 8124 * Reset action for Template and TemplatePart. 8125 */ 8126 /* harmony default export */ const reset_post = (resetPostAction); 8127 8128 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 8129 /** 8130 * WordPress dependencies 8131 */ 8132 8133 8134 const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8135 xmlns: "http://www.w3.org/2000/svg", 8136 viewBox: "0 0 24 24", 8137 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8138 fillRule: "evenodd", 8139 clipRule: "evenodd", 8140 d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" 8141 }) 8142 }); 8143 /* harmony default export */ const library_trash = (trash); 8144 8145 ;// ./node_modules/@wordpress/fields/build-module/mutation/index.js 8146 /* wp:polyfill */ 8147 /** 8148 * WordPress dependencies 8149 */ 8150 8151 8152 8153 8154 /** 8155 * Internal dependencies 8156 */ 8157 8158 function getErrorMessagesFromPromises(allSettledResults) { 8159 const errorMessages = new Set(); 8160 // If there was at lease one failure. 8161 if (allSettledResults.length === 1) { 8162 const typedError = allSettledResults[0]; 8163 if (typedError.reason?.message) { 8164 errorMessages.add(typedError.reason.message); 8165 } 8166 } else { 8167 const failedPromises = allSettledResults.filter(({ 8168 status 8169 }) => status === 'rejected'); 8170 for (const failedPromise of failedPromises) { 8171 const typedError = failedPromise; 8172 if (typedError.reason?.message) { 8173 errorMessages.add(typedError.reason.message); 8174 } 8175 } 8176 } 8177 return errorMessages; 8178 } 8179 const deletePostWithNotices = async (posts, notice, callbacks) => { 8180 const { 8181 createSuccessNotice, 8182 createErrorNotice 8183 } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store); 8184 const { 8185 deleteEntityRecord 8186 } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); 8187 const allSettledResults = await Promise.allSettled(posts.map(post => { 8188 return deleteEntityRecord('postType', post.type, post.id, { 8189 force: true 8190 }, { 8191 throwOnError: true 8192 }); 8193 })); 8194 // If all the promises were fulfilled with success. 8195 if (allSettledResults.every(({ 8196 status 8197 }) => status === 'fulfilled')) { 8198 var _notice$success$type; 8199 let successMessage; 8200 if (allSettledResults.length === 1) { 8201 successMessage = notice.success.messages.getMessage(posts[0]); 8202 } else { 8203 successMessage = notice.success.messages.getBatchMessage(posts); 8204 } 8205 createSuccessNotice(successMessage, { 8206 type: (_notice$success$type = notice.success.type) !== null && _notice$success$type !== void 0 ? _notice$success$type : 'snackbar', 8207 id: notice.success.id 8208 }); 8209 callbacks.onActionPerformed?.(posts); 8210 } else { 8211 var _notice$error$type; 8212 const errorMessages = getErrorMessagesFromPromises(allSettledResults); 8213 let errorMessage = ''; 8214 if (allSettledResults.length === 1) { 8215 errorMessage = notice.error.messages.getMessage(errorMessages); 8216 } else { 8217 errorMessage = notice.error.messages.getBatchMessage(errorMessages); 8218 } 8219 createErrorNotice(errorMessage, { 8220 type: (_notice$error$type = notice.error.type) !== null && _notice$error$type !== void 0 ? _notice$error$type : 'snackbar', 8221 id: notice.error.id 8222 }); 8223 callbacks.onActionError?.(); 8224 } 8225 }; 8226 const editPostWithNotices = async (postsWithUpdates, notice, callbacks) => { 8227 const { 8228 createSuccessNotice, 8229 createErrorNotice 8230 } = dispatch(noticesStore); 8231 const { 8232 editEntityRecord, 8233 saveEditedEntityRecord 8234 } = dispatch(coreStore); 8235 await Promise.allSettled(postsWithUpdates.map(post => { 8236 return editEntityRecord('postType', post.originalPost.type, post.originalPost.id, { 8237 ...post.changes 8238 }); 8239 })); 8240 const allSettledResults = await Promise.allSettled(postsWithUpdates.map(post => { 8241 return saveEditedEntityRecord('postType', post.originalPost.type, post.originalPost.id, { 8242 throwOnError: true 8243 }); 8244 })); 8245 // If all the promises were fulfilled with success. 8246 if (allSettledResults.every(({ 8247 status 8248 }) => status === 'fulfilled')) { 8249 var _notice$success$type2; 8250 let successMessage; 8251 if (allSettledResults.length === 1) { 8252 successMessage = notice.success.messages.getMessage(postsWithUpdates[0].originalPost); 8253 } else { 8254 successMessage = notice.success.messages.getBatchMessage(postsWithUpdates.map(post => post.originalPost)); 8255 } 8256 createSuccessNotice(successMessage, { 8257 type: (_notice$success$type2 = notice.success.type) !== null && _notice$success$type2 !== void 0 ? _notice$success$type2 : 'snackbar', 8258 id: notice.success.id 8259 }); 8260 callbacks.onActionPerformed?.(postsWithUpdates.map(post => post.originalPost)); 8261 } else { 8262 var _notice$error$type2; 8263 const errorMessages = getErrorMessagesFromPromises(allSettledResults); 8264 let errorMessage = ''; 8265 if (allSettledResults.length === 1) { 8266 errorMessage = notice.error.messages.getMessage(errorMessages); 8267 } else { 8268 errorMessage = notice.error.messages.getBatchMessage(errorMessages); 8269 } 8270 createErrorNotice(errorMessage, { 8271 type: (_notice$error$type2 = notice.error.type) !== null && _notice$error$type2 !== void 0 ? _notice$error$type2 : 'snackbar', 8272 id: notice.error.id 8273 }); 8274 callbacks.onActionError?.(); 8275 } 8276 }; 8277 8278 ;// ./node_modules/@wordpress/fields/build-module/actions/delete-post.js 8279 /* wp:polyfill */ 8280 /** 8281 * WordPress dependencies 8282 */ 8283 8284 8285 8286 8287 // @ts-ignore 8288 8289 8290 8291 /** 8292 * Internal dependencies 8293 */ 8294 8295 8296 8297 8298 const { 8299 PATTERN_TYPES: delete_post_PATTERN_TYPES 8300 } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 8301 8302 // This action is used for templates, patterns and template parts. 8303 // Every other post type uses the similar `trashPostAction` which 8304 // moves the post to trash. 8305 const deletePostAction = { 8306 id: 'delete-post', 8307 label: (0,external_wp_i18n_namespaceObject.__)('Delete'), 8308 isPrimary: true, 8309 icon: library_trash, 8310 isEligible(post) { 8311 if (isTemplateOrTemplatePart(post)) { 8312 return isTemplateRemovable(post); 8313 } 8314 // We can only remove user patterns. 8315 return post.type === delete_post_PATTERN_TYPES.user; 8316 }, 8317 supportsBulk: true, 8318 hideModalHeader: true, 8319 RenderModal: ({ 8320 items, 8321 closeModal, 8322 onActionPerformed 8323 }) => { 8324 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 8325 const isResetting = items.every(item => isTemplateOrTemplatePart(item) && item?.has_theme_file); 8326 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 8327 spacing: "5", 8328 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8329 children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 8330 // translators: %d: number of items to delete. 8331 (0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( 8332 // translators: %s: The template or template part's title 8333 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'template part'), getItemTitle(items[0])) 8334 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8335 justify: "right", 8336 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8337 variant: "tertiary", 8338 onClick: closeModal, 8339 disabled: isBusy, 8340 accessibleWhenDisabled: true, 8341 __next40pxDefaultSize: true, 8342 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 8343 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8344 variant: "primary", 8345 onClick: async () => { 8346 setIsBusy(true); 8347 const notice = { 8348 success: { 8349 messages: { 8350 getMessage: item => { 8351 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ 8352 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(item))) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The template/part's name. */ 8353 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(item))); 8354 }, 8355 getBatchMessage: () => { 8356 return isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); 8357 } 8358 } 8359 }, 8360 error: { 8361 messages: { 8362 getMessage: error => { 8363 if (error.size === 1) { 8364 return [...error][0]; 8365 } 8366 return isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.'); 8367 }, 8368 getBatchMessage: errors => { 8369 if (errors.size === 0) { 8370 return isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); 8371 } 8372 if (errors.size === 1) { 8373 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 8374 (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errors][0]) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 8375 (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errors][0]); 8376 } 8377 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 8378 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errors].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 8379 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errors].join(',')); 8380 } 8381 } 8382 } 8383 }; 8384 await deletePostWithNotices(items, notice, { 8385 onActionPerformed 8386 }); 8387 setIsBusy(false); 8388 closeModal?.(); 8389 }, 8390 isBusy: isBusy, 8391 disabled: isBusy, 8392 accessibleWhenDisabled: true, 8393 __next40pxDefaultSize: true, 8394 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 8395 })] 8396 })] 8397 }); 8398 } 8399 }; 8400 8401 /** 8402 * Delete action for Templates, Patterns and Template Parts. 8403 */ 8404 /* harmony default export */ const delete_post = (deletePostAction); 8405 8406 ;// ./node_modules/@wordpress/fields/build-module/actions/trash-post.js 8407 /* wp:polyfill */ 8408 /** 8409 * WordPress dependencies 8410 */ 8411 8412 8413 8414 8415 8416 8417 8418 /** 8419 * Internal dependencies 8420 */ 8421 8422 8423 const trash_post_trashPost = { 8424 id: 'move-to-trash', 8425 label: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), 8426 isPrimary: true, 8427 icon: library_trash, 8428 isEligible(item) { 8429 if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') { 8430 return false; 8431 } 8432 return !!item.status && !['auto-draft', 'trash'].includes(item.status) && item.permissions?.delete; 8433 }, 8434 supportsBulk: true, 8435 hideModalHeader: true, 8436 RenderModal: ({ 8437 items, 8438 closeModal, 8439 onActionPerformed 8440 }) => { 8441 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 8442 const { 8443 createSuccessNotice, 8444 createErrorNotice 8445 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 8446 const { 8447 deleteEntityRecord 8448 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8449 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 8450 spacing: "5", 8451 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8452 children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 8453 // translators: %s: The item's title. 8454 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), getItemTitle(items[0])) : (0,external_wp_i18n_namespaceObject.sprintf)( 8455 // translators: %d: The number of items (2 or more). 8456 (0,external_wp_i18n_namespaceObject._n)('Are you sure you want to move %d item to the trash ?', 'Are you sure you want to move %d items to the trash ?', items.length), items.length) 8457 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8458 justify: "right", 8459 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8460 __next40pxDefaultSize: true, 8461 variant: "tertiary", 8462 onClick: closeModal, 8463 disabled: isBusy, 8464 accessibleWhenDisabled: true, 8465 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 8466 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8467 __next40pxDefaultSize: true, 8468 variant: "primary", 8469 onClick: async () => { 8470 setIsBusy(true); 8471 const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id.toString(), {}, { 8472 throwOnError: true 8473 }))); 8474 // If all the promises were fulfilled with success. 8475 if (promiseResult.every(({ 8476 status 8477 }) => status === 'fulfilled')) { 8478 let successMessage; 8479 if (promiseResult.length === 1) { 8480 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The item's title. */ 8481 (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), getItemTitle(items[0])); 8482 } else { 8483 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The number of items. */ 8484 (0,external_wp_i18n_namespaceObject._n)('%s item moved to the trash.', '%s items moved to the trash.', items.length), items.length); 8485 } 8486 createSuccessNotice(successMessage, { 8487 type: 'snackbar', 8488 id: 'move-to-trash-action' 8489 }); 8490 } else { 8491 // If there was at least one failure. 8492 let errorMessage; 8493 // If we were trying to delete a single item. 8494 if (promiseResult.length === 1) { 8495 const typedError = promiseResult[0]; 8496 if (typedError.reason?.message) { 8497 errorMessage = typedError.reason.message; 8498 } else { 8499 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash.'); 8500 } 8501 // If we were trying to delete multiple items. 8502 } else { 8503 const errorMessages = new Set(); 8504 const failedPromises = promiseResult.filter(({ 8505 status 8506 }) => status === 'rejected'); 8507 for (const failedPromise of failedPromises) { 8508 const typedError = failedPromise; 8509 if (typedError.reason?.message) { 8510 errorMessages.add(typedError.reason.message); 8511 } 8512 } 8513 if (errorMessages.size === 0) { 8514 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the items to the trash.'); 8515 } else if (errorMessages.size === 1) { 8516 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 8517 (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash: %s'), [...errorMessages][0]); 8518 } else { 8519 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 8520 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving the items to the trash: %s'), [...errorMessages].join(',')); 8521 } 8522 } 8523 createErrorNotice(errorMessage, { 8524 type: 'snackbar' 8525 }); 8526 } 8527 if (onActionPerformed) { 8528 onActionPerformed(items); 8529 } 8530 setIsBusy(false); 8531 closeModal?.(); 8532 }, 8533 isBusy: isBusy, 8534 disabled: isBusy, 8535 accessibleWhenDisabled: true, 8536 children: (0,external_wp_i18n_namespaceObject._x)('Trash', 'verb') 8537 })] 8538 })] 8539 }); 8540 } 8541 }; 8542 8543 /** 8544 * Trash action for PostWithPermissions. 8545 */ 8546 /* harmony default export */ const trash_post = (trash_post_trashPost); 8547 8548 ;// ./node_modules/@wordpress/fields/build-module/actions/permanently-delete-post.js 8549 /* wp:polyfill */ 8550 /** 8551 * WordPress dependencies 8552 */ 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 /** 8563 * Internal dependencies 8564 */ 8565 8566 8567 const permanentlyDeletePost = { 8568 id: 'permanently-delete', 8569 label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'), 8570 supportsBulk: true, 8571 icon: library_trash, 8572 isEligible(item) { 8573 if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') { 8574 return false; 8575 } 8576 const { 8577 status, 8578 permissions 8579 } = item; 8580 return status === 'trash' && permissions?.delete; 8581 }, 8582 hideModalHeader: true, 8583 RenderModal: ({ 8584 items, 8585 closeModal, 8586 onActionPerformed 8587 }) => { 8588 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 8589 const { 8590 createSuccessNotice, 8591 createErrorNotice 8592 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 8593 const { 8594 deleteEntityRecord 8595 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8596 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 8597 spacing: "5", 8598 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 8599 children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 8600 // translators: %d: number of items to delete. 8601 (0,external_wp_i18n_namespaceObject._n)('Are you sure you want to permanently delete %d item?', 'Are you sure you want to permanently delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( 8602 // translators: %s: The post's title 8603 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to permanently delete "%s"?'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(items[0]))) 8604 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8605 justify: "right", 8606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8607 variant: "tertiary", 8608 onClick: closeModal, 8609 disabled: isBusy, 8610 accessibleWhenDisabled: true, 8611 __next40pxDefaultSize: true, 8612 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 8613 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8614 variant: "primary", 8615 onClick: async () => { 8616 setIsBusy(true); 8617 const promiseResult = await Promise.allSettled(items.map(post => deleteEntityRecord('postType', post.type, post.id, { 8618 force: true 8619 }, { 8620 throwOnError: true 8621 }))); 8622 8623 // If all the promises were fulfilled with success. 8624 if (promiseResult.every(({ 8625 status 8626 }) => status === 'fulfilled')) { 8627 let successMessage; 8628 if (promiseResult.length === 1) { 8629 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The posts's title. */ 8630 (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), getItemTitle(items[0])); 8631 } else { 8632 successMessage = (0,external_wp_i18n_namespaceObject.__)('The items were permanently deleted.'); 8633 } 8634 createSuccessNotice(successMessage, { 8635 type: 'snackbar', 8636 id: 'permanently-delete-post-action' 8637 }); 8638 onActionPerformed?.(items); 8639 } else { 8640 // If there was at lease one failure. 8641 let errorMessage; 8642 // If we were trying to permanently delete a single post. 8643 if (promiseResult.length === 1) { 8644 const typedError = promiseResult[0]; 8645 if (typedError.reason?.message) { 8646 errorMessage = typedError.reason.message; 8647 } else { 8648 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the item.'); 8649 } 8650 // If we were trying to permanently delete multiple posts 8651 } else { 8652 const errorMessages = new Set(); 8653 const failedPromises = promiseResult.filter(({ 8654 status 8655 }) => status === 'rejected'); 8656 for (const failedPromise of failedPromises) { 8657 const typedError = failedPromise; 8658 if (typedError.reason?.message) { 8659 errorMessages.add(typedError.reason.message); 8660 } 8661 } 8662 if (errorMessages.size === 0) { 8663 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items.'); 8664 } else if (errorMessages.size === 1) { 8665 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 8666 (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items: %s'), [...errorMessages][0]); 8667 } else { 8668 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 8669 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the items: %s'), [...errorMessages].join(',')); 8670 } 8671 } 8672 createErrorNotice(errorMessage, { 8673 type: 'snackbar' 8674 }); 8675 } 8676 setIsBusy(false); 8677 closeModal?.(); 8678 }, 8679 isBusy: isBusy, 8680 disabled: isBusy, 8681 accessibleWhenDisabled: true, 8682 __next40pxDefaultSize: true, 8683 children: (0,external_wp_i18n_namespaceObject.__)('Delete permanently') 8684 })] 8685 })] 8686 }); 8687 } 8688 }; 8689 8690 /** 8691 * Delete action for PostWithPermissions. 8692 */ 8693 /* harmony default export */ const permanently_delete_post = (permanentlyDeletePost); 8694 8695 ;// external ["wp","mediaUtils"] 8696 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 8697 ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js 8698 /** 8699 * WordPress dependencies 8700 */ 8701 8702 8703 const lineSolid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8704 xmlns: "http://www.w3.org/2000/svg", 8705 viewBox: "0 0 24 24", 8706 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8707 d: "M5 11.25h14v1.5H5z" 8708 }) 8709 }); 8710 /* harmony default export */ const line_solid = (lineSolid); 8711 8712 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-edit.js 8713 /** 8714 * WordPress dependencies 8715 */ 8716 8717 8718 8719 // @ts-ignore 8720 8721 8722 8723 8724 8725 /** 8726 * Internal dependencies 8727 */ 8728 8729 const FeaturedImageEdit = ({ 8730 data, 8731 field, 8732 onChange 8733 }) => { 8734 const { 8735 id 8736 } = field; 8737 const value = field.getValue({ 8738 item: data 8739 }); 8740 const media = (0,external_wp_data_namespaceObject.useSelect)(select => { 8741 const { 8742 getEntityRecord 8743 } = select(external_wp_coreData_namespaceObject.store); 8744 return getEntityRecord('root', 'media', value); 8745 }, [value]); 8746 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 8747 [id]: newValue 8748 }), [id, onChange]); 8749 const url = media?.source_url; 8750 const title = media?.title?.rendered; 8751 const ref = (0,external_wp_element_namespaceObject.useRef)(null); 8752 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { 8753 className: "fields-controls__featured-image", 8754 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8755 className: "fields-controls__featured-image-container", 8756 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_mediaUtils_namespaceObject.MediaUpload, { 8757 onSelect: selectedMedia => { 8758 onChangeControl(selectedMedia.id); 8759 }, 8760 allowedTypes: ['image'], 8761 render: ({ 8762 open 8763 }) => { 8764 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8765 ref: ref, 8766 role: "button", 8767 tabIndex: -1, 8768 onClick: () => { 8769 open(); 8770 }, 8771 onKeyDown: open, 8772 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { 8773 rowGap: 0, 8774 columnGap: 8, 8775 templateColumns: "24px 1fr 24px", 8776 children: [url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8777 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 8778 className: "fields-controls__featured-image-image", 8779 alt: "", 8780 width: 24, 8781 height: 24, 8782 src: url 8783 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8784 className: "fields-controls__featured-image-title", 8785 children: title 8786 })] 8787 }), !url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8788 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8789 className: "fields-controls__featured-image-placeholder", 8790 style: { 8791 width: '24px', 8792 height: '24px' 8793 } 8794 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8795 className: "fields-controls__featured-image-title", 8796 children: (0,external_wp_i18n_namespaceObject.__)('Choose an image…') 8797 })] 8798 }), url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8799 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 8800 size: "small", 8801 className: "fields-controls__featured-image-remove-button", 8802 icon: line_solid, 8803 onClick: event => { 8804 event.stopPropagation(); 8805 onChangeControl(0); 8806 } 8807 }) 8808 })] 8809 }) 8810 }); 8811 } 8812 }) 8813 }) 8814 }); 8815 }; 8816 8817 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-view.js 8818 /** 8819 * WordPress dependencies 8820 */ 8821 8822 8823 8824 /** 8825 * Internal dependencies 8826 */ 8827 8828 const FeaturedImageView = ({ 8829 item 8830 }) => { 8831 const mediaId = item.featured_media; 8832 const media = (0,external_wp_data_namespaceObject.useSelect)(select => { 8833 const { 8834 getEntityRecord 8835 } = select(external_wp_coreData_namespaceObject.store); 8836 return mediaId ? getEntityRecord('root', 'media', mediaId) : null; 8837 }, [mediaId]); 8838 const url = media?.source_url; 8839 if (url) { 8840 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 8841 className: "fields-controls__featured-image-image", 8842 src: url, 8843 alt: "" 8844 }); 8845 } 8846 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8847 className: "fields-controls__featured-image-placeholder" 8848 }); 8849 }; 8850 8851 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/index.js 8852 /** 8853 * WordPress dependencies 8854 */ 8855 8856 8857 8858 /** 8859 * Internal dependencies 8860 */ 8861 8862 8863 8864 const featuredImageField = { 8865 id: 'featured_media', 8866 type: 'media', 8867 label: (0,external_wp_i18n_namespaceObject.__)('Featured Image'), 8868 Edit: FeaturedImageEdit, 8869 render: FeaturedImageView, 8870 enableSorting: false 8871 }; 8872 8873 /** 8874 * Featured Image field for BasePost. 8875 */ 8876 /* harmony default export */ const featured_image = (featuredImageField); 8877 8878 ;// ./node_modules/clsx/dist/clsx.mjs 8879 function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 8880 ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 8881 /** 8882 * WordPress dependencies 8883 */ 8884 8885 8886 const commentAuthorAvatar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8887 xmlns: "http://www.w3.org/2000/svg", 8888 viewBox: "0 0 24 24", 8889 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8890 fillRule: "evenodd", 8891 d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", 8892 clipRule: "evenodd" 8893 }) 8894 }); 8895 /* harmony default export */ const comment_author_avatar = (commentAuthorAvatar); 8896 8897 ;// ./node_modules/@wordpress/fields/build-module/fields/author/author-view.js 8898 /** 8899 * External dependencies 8900 */ 8901 8902 8903 /** 8904 * WordPress dependencies 8905 */ 8906 8907 8908 8909 8910 8911 8912 8913 /** 8914 * Internal dependencies 8915 */ 8916 8917 function AuthorView({ 8918 item 8919 }) { 8920 const { 8921 text, 8922 imageUrl 8923 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8924 const { 8925 getEntityRecord 8926 } = select(external_wp_coreData_namespaceObject.store); 8927 let user; 8928 if (!!item.author) { 8929 user = getEntityRecord('root', 'user', item.author); 8930 } 8931 return { 8932 imageUrl: user?.avatar_urls?.[48], 8933 text: user?.name 8934 }; 8935 }, [item]); 8936 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 8937 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 8938 alignment: "left", 8939 spacing: 0, 8940 children: [!!imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8941 className: dist_clsx('page-templates-author-field__avatar', { 8942 'is-loaded': isImageLoaded 8943 }), 8944 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 8945 onLoad: () => setIsImageLoaded(true), 8946 alt: (0,external_wp_i18n_namespaceObject.__)('Author avatar'), 8947 src: imageUrl 8948 }) 8949 }), !imageUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 8950 className: "page-templates-author-field__icon", 8951 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 8952 icon: comment_author_avatar 8953 }) 8954 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8955 className: "page-templates-author-field__name", 8956 children: text 8957 })] 8958 }); 8959 } 8960 /* harmony default export */ const author_view = (AuthorView); 8961 8962 ;// ./node_modules/@wordpress/fields/build-module/fields/author/index.js 8963 /** 8964 * WordPress dependencies 8965 */ 8966 8967 8968 8969 /** 8970 * Internal dependencies 8971 */ 8972 8973 8974 const authorField = { 8975 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 8976 id: 'author', 8977 type: 'integer', 8978 elements: [], 8979 render: author_view, 8980 sort: (a, b, direction) => { 8981 const nameA = a._embedded?.author?.[0]?.name || ''; 8982 const nameB = b._embedded?.author?.[0]?.name || ''; 8983 return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 8984 } 8985 }; 8986 8987 /** 8988 * Author field for BasePost. 8989 */ 8990 /* harmony default export */ const author = (authorField); 8991 8992 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 8993 /** 8994 * WordPress dependencies 8995 */ 8996 8997 8998 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8999 xmlns: "http://www.w3.org/2000/svg", 9000 viewBox: "0 0 24 24", 9001 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9002 fillRule: "evenodd", 9003 clipRule: "evenodd", 9004 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" 9005 }) 9006 }); 9007 /* harmony default export */ const library_drafts = (drafts); 9008 9009 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 9010 /** 9011 * WordPress dependencies 9012 */ 9013 9014 9015 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9016 xmlns: "http://www.w3.org/2000/svg", 9017 viewBox: "0 0 24 24", 9018 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9019 fillRule: "evenodd", 9020 clipRule: "evenodd", 9021 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" 9022 }) 9023 }); 9024 /* harmony default export */ const library_scheduled = (scheduled); 9025 9026 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 9027 /** 9028 * WordPress dependencies 9029 */ 9030 9031 9032 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9033 xmlns: "http://www.w3.org/2000/svg", 9034 viewBox: "0 0 24 24", 9035 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9036 fillRule: "evenodd", 9037 clipRule: "evenodd", 9038 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" 9039 }) 9040 }); 9041 /* harmony default export */ const library_pending = (pending); 9042 9043 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 9044 /** 9045 * WordPress dependencies 9046 */ 9047 9048 9049 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9050 xmlns: "http://www.w3.org/2000/svg", 9051 viewBox: "0 0 24 24", 9052 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9053 fillRule: "evenodd", 9054 clipRule: "evenodd", 9055 d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" 9056 }) 9057 }); 9058 /* harmony default export */ const not_allowed = (notAllowed); 9059 9060 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 9061 /** 9062 * WordPress dependencies 9063 */ 9064 9065 9066 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9067 xmlns: "http://www.w3.org/2000/svg", 9068 viewBox: "0 0 24 24", 9069 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9070 fillRule: "evenodd", 9071 clipRule: "evenodd", 9072 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" 9073 }) 9074 }); 9075 /* harmony default export */ const library_published = (published); 9076 9077 ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-elements.js 9078 /** 9079 * WordPress dependencies 9080 */ 9081 9082 9083 9084 // See https://github.com/WordPress/gutenberg/issues/55886 9085 // We do not support custom statutes at the moment. 9086 const STATUSES = [{ 9087 value: 'draft', 9088 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 9089 icon: library_drafts, 9090 description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') 9091 }, { 9092 value: 'future', 9093 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 9094 icon: library_scheduled, 9095 description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') 9096 }, { 9097 value: 'pending', 9098 label: (0,external_wp_i18n_namespaceObject.__)('Pending Review'), 9099 icon: library_pending, 9100 description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') 9101 }, { 9102 value: 'private', 9103 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 9104 icon: not_allowed, 9105 description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 9106 }, { 9107 value: 'publish', 9108 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 9109 icon: library_published, 9110 description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 9111 }, { 9112 value: 'trash', 9113 label: (0,external_wp_i18n_namespaceObject.__)('Trash'), 9114 icon: library_trash 9115 }]; 9116 /* harmony default export */ const status_elements = (STATUSES); 9117 9118 ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-view.js 9119 /* wp:polyfill */ 9120 /** 9121 * WordPress dependencies 9122 */ 9123 9124 9125 /** 9126 * Internal dependencies 9127 */ 9128 9129 9130 9131 function StatusView({ 9132 item 9133 }) { 9134 const status = status_elements.find(({ 9135 value 9136 }) => value === item.status); 9137 const label = status?.label || item.status; 9138 const icon = status?.icon; 9139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 9140 alignment: "left", 9141 spacing: 0, 9142 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9143 className: "edit-site-post-list__status-icon", 9144 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 9145 icon: icon 9146 }) 9147 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9148 children: label 9149 })] 9150 }); 9151 } 9152 /* harmony default export */ const status_view = (StatusView); 9153 9154 ;// ./node_modules/@wordpress/fields/build-module/fields/status/index.js 9155 /** 9156 * WordPress dependencies 9157 */ 9158 9159 9160 9161 /** 9162 * Internal dependencies 9163 */ 9164 9165 9166 9167 const OPERATOR_IS_ANY = 'isAny'; 9168 const statusField = { 9169 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 9170 id: 'status', 9171 type: 'text', 9172 elements: status_elements, 9173 render: status_view, 9174 Edit: 'radio', 9175 enableSorting: false, 9176 filterBy: { 9177 operators: [OPERATOR_IS_ANY] 9178 } 9179 }; 9180 9181 /** 9182 * Status field for BasePost. 9183 */ 9184 /* harmony default export */ const fields_status = (statusField); 9185 9186 ;// ./node_modules/@wordpress/fields/build-module/fields/date/date-view.js 9187 /** 9188 * WordPress dependencies 9189 */ 9190 9191 9192 9193 9194 /** 9195 * Internal dependencies 9196 */ 9197 9198 const getFormattedDate = dateToDisplay => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay)); 9199 const DateView = ({ 9200 item 9201 }) => { 9202 var _item$status, _item$modified, _item$date4, _item$date5; 9203 const isDraftOrPrivate = ['draft', 'private'].includes((_item$status = item.status) !== null && _item$status !== void 0 ? _item$status : ''); 9204 if (isDraftOrPrivate) { 9205 var _item$date; 9206 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation or modification date. */ 9207 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate((_item$date = item.date) !== null && _item$date !== void 0 ? _item$date : null)), { 9208 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 9209 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 9210 }); 9211 } 9212 const isScheduled = item.status === 'future'; 9213 if (isScheduled) { 9214 var _item$date2; 9215 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation date */ 9216 (0,external_wp_i18n_namespaceObject.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate((_item$date2 = item.date) !== null && _item$date2 !== void 0 ? _item$date2 : null)), { 9217 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 9218 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 9219 }); 9220 } 9221 const isPublished = item.status === 'publish'; 9222 if (isPublished) { 9223 var _item$date3; 9224 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation time */ 9225 (0,external_wp_i18n_namespaceObject.__)('<span>Published: <time>%s</time></span>'), getFormattedDate((_item$date3 = item.date) !== null && _item$date3 !== void 0 ? _item$date3 : null)), { 9226 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 9227 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 9228 }); 9229 } 9230 9231 // Pending posts show the modified date if it's newer. 9232 const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)((_item$modified = item.modified) !== null && _item$modified !== void 0 ? _item$modified : null) > (0,external_wp_date_namespaceObject.getDate)((_item$date4 = item.date) !== null && _item$date4 !== void 0 ? _item$date4 : null) ? item.modified : item.date; 9233 const isPending = item.status === 'pending'; 9234 if (isPending) { 9235 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: page creation or modification date. */ 9236 (0,external_wp_i18n_namespaceObject.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay !== null && dateToDisplay !== void 0 ? dateToDisplay : null)), { 9237 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 9238 time: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 9239 }); 9240 } 9241 9242 // Unknow status. 9243 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 9244 children: getFormattedDate((_item$date5 = item.date) !== null && _item$date5 !== void 0 ? _item$date5 : null) 9245 }); 9246 }; 9247 /* harmony default export */ const date_view = (DateView); 9248 9249 ;// ./node_modules/@wordpress/fields/build-module/fields/date/index.js 9250 /** 9251 * WordPress dependencies 9252 */ 9253 9254 9255 9256 /** 9257 * Internal dependencies 9258 */ 9259 9260 9261 const dateField = { 9262 id: 'date', 9263 type: 'datetime', 9264 label: (0,external_wp_i18n_namespaceObject.__)('Date'), 9265 render: date_view 9266 }; 9267 9268 /** 9269 * Date field for BasePost. 9270 */ 9271 /* harmony default export */ const date = (dateField); 9272 9273 ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js 9274 /** 9275 * WordPress dependencies 9276 */ 9277 9278 9279 const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 9280 xmlns: "http://www.w3.org/2000/svg", 9281 viewBox: "0 0 24 24", 9282 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 9283 fillRule: "evenodd", 9284 clipRule: "evenodd", 9285 d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" 9286 }) 9287 }); 9288 /* harmony default export */ const copy_small = (copySmall); 9289 9290 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/utils.js 9291 /** 9292 * WordPress dependencies 9293 */ 9294 9295 /** 9296 * Internal dependencies 9297 */ 9298 9299 9300 const getSlug = item => { 9301 if (typeof item !== 'object') { 9302 return ''; 9303 } 9304 return item.slug || (0,external_wp_url_namespaceObject.cleanForSlug)(getItemTitle(item)) || item.id.toString(); 9305 }; 9306 9307 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-edit.js 9308 /** 9309 * WordPress dependencies 9310 */ 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 /** 9321 * Internal dependencies 9322 */ 9323 9324 9325 9326 const SlugEdit = ({ 9327 field, 9328 onChange, 9329 data 9330 }) => { 9331 const { 9332 id 9333 } = field; 9334 const slug = field.getValue({ 9335 item: data 9336 }) || getSlug(data); 9337 const permalinkTemplate = data.permalink_template || ''; 9338 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 9339 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 9340 const permalinkPrefix = prefix; 9341 const permalinkSuffix = suffix; 9342 const isEditable = PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 9343 const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); 9344 const slugToDisplay = slug || originalSlugRef.current; 9345 const permalink = isEditable ? `$permalinkPrefix}$slugToDisplay}$permalinkSuffix}` : (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(data.link || ''); 9346 (0,external_wp_element_namespaceObject.useEffect)(() => { 9347 if (slug && originalSlugRef.current === undefined) { 9348 originalSlugRef.current = slug; 9349 } 9350 }, [slug]); 9351 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 9352 [id]: newValue 9353 }), [id, onChange]); 9354 const { 9355 createNotice 9356 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 9357 const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { 9358 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied Permalink to clipboard.'), { 9359 isDismissible: true, 9360 type: 'snackbar' 9361 }); 9362 }); 9363 const postUrlSlugDescriptionId = 'editor-post-url__slug-description-' + (0,external_wp_compose_namespaceObject.useInstanceId)(SlugEdit); 9364 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 9365 className: "fields-controls__slug", 9366 children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 9367 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 9368 spacing: "0px", 9369 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9370 children: (0,external_wp_i18n_namespaceObject.__)('Customize the last part of the Permalink.') 9371 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 9372 href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", 9373 children: (0,external_wp_i18n_namespaceObject.__)('Learn more') 9374 })] 9375 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 9376 __next40pxDefaultSize: true, 9377 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { 9378 children: "/" 9379 }), 9380 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9381 __next40pxDefaultSize: true, 9382 icon: copy_small, 9383 ref: copyButtonRef, 9384 label: (0,external_wp_i18n_namespaceObject.__)('Copy') 9385 }), 9386 label: (0,external_wp_i18n_namespaceObject.__)('Link'), 9387 hideLabelFromVision: true, 9388 value: slug, 9389 autoComplete: "off", 9390 spellCheck: "false", 9391 type: "text", 9392 className: "fields-controls__slug-input", 9393 onChange: newValue => { 9394 onChangeControl(newValue); 9395 }, 9396 onBlur: () => { 9397 if (slug === '') { 9398 onChangeControl(originalSlugRef.current); 9399 } 9400 }, 9401 "aria-describedby": postUrlSlugDescriptionId 9402 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9403 className: "fields-controls__slug-help", 9404 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9405 className: "fields-controls__slug-help-visual-label", 9406 children: (0,external_wp_i18n_namespaceObject.__)('Permalink:') 9407 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { 9408 className: "fields-controls__slug-help-link", 9409 href: permalink, 9410 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9411 className: "fields-controls__slug-help-prefix", 9412 children: permalinkPrefix 9413 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9414 className: "fields-controls__slug-help-slug", 9415 children: slugToDisplay 9416 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 9417 className: "fields-controls__slug-help-suffix", 9418 children: permalinkSuffix 9419 })] 9420 })] 9421 })] 9422 }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 9423 className: "fields-controls__slug-help", 9424 href: permalink, 9425 children: permalink 9426 })] 9427 }); 9428 }; 9429 /* harmony default export */ const slug_edit = (SlugEdit); 9430 9431 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-view.js 9432 /** 9433 * WordPress dependencies 9434 */ 9435 9436 9437 /** 9438 * Internal dependencies 9439 */ 9440 9441 9442 const SlugView = ({ 9443 item 9444 }) => { 9445 const slug = getSlug(item); 9446 const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); 9447 (0,external_wp_element_namespaceObject.useEffect)(() => { 9448 if (slug && originalSlugRef.current === undefined) { 9449 originalSlugRef.current = slug; 9450 } 9451 }, [slug]); 9452 const slugToDisplay = slug || originalSlugRef.current; 9453 return `$slugToDisplay}`; 9454 }; 9455 /* harmony default export */ const slug_view = (SlugView); 9456 9457 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/index.js 9458 /** 9459 * WordPress dependencies 9460 */ 9461 9462 9463 9464 /** 9465 * Internal dependencies 9466 */ 9467 9468 9469 9470 const slugField = { 9471 id: 'slug', 9472 type: 'text', 9473 label: (0,external_wp_i18n_namespaceObject.__)('Slug'), 9474 Edit: slug_edit, 9475 render: slug_view 9476 }; 9477 9478 /** 9479 * Slug field for BasePost. 9480 */ 9481 /* harmony default export */ const slug = (slugField); 9482 9483 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 9484 var remove_accents = __webpack_require__(9681); 9485 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 9486 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/utils.js 9487 /** 9488 * WordPress dependencies 9489 */ 9490 9491 9492 9493 /** 9494 * Internal dependencies 9495 */ 9496 9497 function getTitleWithFallbackName(post) { 9498 return typeof post.title === 'object' && 'rendered' in post.title && post.title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post?.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; 9499 } 9500 9501 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-edit.js 9502 /* wp:polyfill */ 9503 /** 9504 * External dependencies 9505 */ 9506 9507 9508 /** 9509 * WordPress dependencies 9510 */ 9511 9512 9513 9514 // @ts-ignore 9515 9516 9517 9518 9519 9520 9521 /** 9522 * Internal dependencies 9523 */ 9524 9525 9526 9527 function buildTermsTree(flatTerms) { 9528 const flatTermsWithParentAndChildren = flatTerms.map(term => { 9529 return { 9530 children: [], 9531 ...term 9532 }; 9533 }); 9534 9535 // All terms should have a `parent` because we're about to index them by it. 9536 if (flatTermsWithParentAndChildren.some(({ 9537 parent 9538 }) => parent === null || parent === undefined)) { 9539 return flatTermsWithParentAndChildren; 9540 } 9541 const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { 9542 const { 9543 parent 9544 } = term; 9545 if (!acc[parent]) { 9546 acc[parent] = []; 9547 } 9548 acc[parent].push(term); 9549 return acc; 9550 }, {}); 9551 const fillWithChildren = terms => { 9552 return terms.map(term => { 9553 const children = termsByParent[term.id]; 9554 return { 9555 ...term, 9556 children: children && children.length ? fillWithChildren(children) : [] 9557 }; 9558 }); 9559 }; 9560 return fillWithChildren(termsByParent['0'] || []); 9561 } 9562 const getItemPriority = (name, searchValue) => { 9563 const normalizedName = remove_accents_default()(name || '').toLowerCase(); 9564 const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase(); 9565 if (normalizedName === normalizedSearch) { 9566 return 0; 9567 } 9568 if (normalizedName.startsWith(normalizedSearch)) { 9569 return normalizedName.length; 9570 } 9571 return Infinity; 9572 }; 9573 function PageAttributesParent({ 9574 data, 9575 onChangeControl 9576 }) { 9577 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(null); 9578 const pageId = data.parent; 9579 const postId = data.id; 9580 const postTypeSlug = data.type; 9581 const { 9582 parentPostTitle, 9583 pageItems, 9584 isHierarchical 9585 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9586 const { 9587 getEntityRecord, 9588 getEntityRecords, 9589 getPostType 9590 } = select(external_wp_coreData_namespaceObject.store); 9591 const postTypeInfo = getPostType(postTypeSlug); 9592 const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable; 9593 const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null; 9594 const query = { 9595 per_page: 100, 9596 exclude: postId, 9597 parent_exclude: postId, 9598 orderby: 'menu_order', 9599 order: 'asc', 9600 _fields: 'id,title,parent', 9601 ...(fieldValue !== null && { 9602 search: fieldValue 9603 }) 9604 }; 9605 return { 9606 isHierarchical: postIsHierarchical, 9607 parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : '', 9608 pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null 9609 }; 9610 }, [fieldValue, pageId, postId, postTypeSlug]); 9611 9612 /** 9613 * This logic has been copied from https://github.com/WordPress/gutenberg/blob/0249771b519d5646171fb9fae422006c8ab773f2/packages/editor/src/components/page-attributes/parent.js#L106. 9614 */ 9615 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 9616 const getOptionsFromTree = (tree, level = 0) => { 9617 const mappedNodes = tree.map(treeNode => [{ 9618 value: treeNode.id, 9619 label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), 9620 rawName: treeNode.name 9621 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); 9622 const sortedNodes = mappedNodes.sort(([a], [b]) => { 9623 const priorityA = getItemPriority(a.rawName, fieldValue !== null && fieldValue !== void 0 ? fieldValue : ''); 9624 const priorityB = getItemPriority(b.rawName, fieldValue !== null && fieldValue !== void 0 ? fieldValue : ''); 9625 return priorityA >= priorityB ? 1 : -1; 9626 }); 9627 return sortedNodes.flat(); 9628 }; 9629 if (!pageItems) { 9630 return []; 9631 } 9632 let tree = pageItems.map(item => { 9633 var _item$parent; 9634 return { 9635 id: item.id, 9636 parent: (_item$parent = item.parent) !== null && _item$parent !== void 0 ? _item$parent : null, 9637 name: getTitleWithFallbackName(item) 9638 }; 9639 }); 9640 9641 // Only build a hierarchical tree when not searching. 9642 if (!fieldValue) { 9643 tree = buildTermsTree(tree); 9644 } 9645 const opts = getOptionsFromTree(tree); 9646 9647 // Ensure the current parent is in the options list. 9648 const optsHasParent = opts.find(item => item.value === pageId); 9649 if (pageId && parentPostTitle && !optsHasParent) { 9650 opts.unshift({ 9651 value: pageId, 9652 label: parentPostTitle, 9653 rawName: '' 9654 }); 9655 } 9656 return opts.map(option => ({ 9657 ...option, 9658 value: option.value.toString() 9659 })); 9660 }, [pageItems, fieldValue, parentPostTitle, pageId]); 9661 if (!isHierarchical) { 9662 return null; 9663 } 9664 9665 /** 9666 * Handle user input. 9667 * 9668 * @param {string} inputValue The current value of the input field. 9669 */ 9670 const handleKeydown = inputValue => { 9671 setFieldValue(inputValue); 9672 }; 9673 9674 /** 9675 * Handle author selection. 9676 * 9677 * @param {Object} selectedPostId The selected Author. 9678 */ 9679 const handleChange = selectedPostId => { 9680 if (selectedPostId) { 9681 var _parseInt; 9682 return onChangeControl((_parseInt = parseInt(selectedPostId, 10)) !== null && _parseInt !== void 0 ? _parseInt : 0); 9683 } 9684 onChangeControl(0); 9685 }; 9686 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { 9687 __nextHasNoMarginBottom: true, 9688 __next40pxDefaultSize: true, 9689 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 9690 help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'), 9691 value: pageId?.toString(), 9692 options: parentOptions, 9693 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(value => handleKeydown(value), 300), 9694 onChange: handleChange, 9695 hideLabelFromVision: true 9696 }); 9697 } 9698 const ParentEdit = ({ 9699 data, 9700 field, 9701 onChange 9702 }) => { 9703 const { 9704 id 9705 } = field; 9706 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 9707 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 9708 }, []); 9709 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 9710 [id]: newValue 9711 }), [id, onChange]); 9712 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { 9713 className: "fields-controls__parent", 9714 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9715 children: [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %1$s The home URL of the WordPress installation without the scheme. */ 9716 (0,external_wp_i18n_namespaceObject.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.'), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), { 9717 wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) 9718 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 9719 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), { 9720 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 9721 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'), 9722 children: undefined 9723 }) 9724 }) 9725 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, { 9726 data: data, 9727 onChangeControl: onChangeControl 9728 })] 9729 }) 9730 }); 9731 }; 9732 9733 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-view.js 9734 /** 9735 * WordPress dependencies 9736 */ 9737 9738 9739 9740 9741 /** 9742 * Internal dependencies 9743 */ 9744 9745 9746 9747 const ParentView = ({ 9748 item 9749 }) => { 9750 const parent = (0,external_wp_data_namespaceObject.useSelect)(select => { 9751 const { 9752 getEntityRecord 9753 } = select(external_wp_coreData_namespaceObject.store); 9754 return item?.parent ? getEntityRecord('postType', item.type, item.parent) : null; 9755 }, [item.parent, item.type]); 9756 if (parent) { 9757 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9758 children: getTitleWithFallbackName(parent) 9759 }); 9760 } 9761 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9762 children: (0,external_wp_i18n_namespaceObject.__)('None') 9763 }); 9764 }; 9765 9766 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/index.js 9767 /** 9768 * WordPress dependencies 9769 */ 9770 9771 9772 9773 /** 9774 * Internal dependencies 9775 */ 9776 9777 9778 9779 const parentField = { 9780 id: 'parent', 9781 type: 'text', 9782 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 9783 Edit: ParentEdit, 9784 render: ParentView, 9785 enableSorting: true 9786 }; 9787 9788 /** 9789 * Parent field for BasePost. 9790 */ 9791 /* harmony default export */ const fields_parent = (parentField); 9792 9793 ;// ./node_modules/@wordpress/fields/build-module/fields/comment-status/index.js 9794 /** 9795 * WordPress dependencies 9796 */ 9797 9798 9799 9800 /** 9801 * Internal dependencies 9802 */ 9803 9804 const commentStatusField = { 9805 id: 'comment_status', 9806 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 9807 type: 'text', 9808 Edit: 'radio', 9809 enableSorting: false, 9810 filterBy: { 9811 operators: [] 9812 }, 9813 elements: [{ 9814 value: 'open', 9815 label: (0,external_wp_i18n_namespaceObject.__)('Open'), 9816 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 9817 }, { 9818 value: 'closed', 9819 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 9820 description: (0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies. Existing comments remain visible.') 9821 }] 9822 }; 9823 9824 /** 9825 * Comment status field for BasePost. 9826 */ 9827 /* harmony default export */ const comment_status = (commentStatusField); 9828 9829 ;// ./node_modules/@wordpress/fields/build-module/fields/template/template-edit.js 9830 /* wp:polyfill */ 9831 /** 9832 * WordPress dependencies 9833 */ 9834 9835 // @ts-ignore 9836 9837 9838 /** 9839 * Internal dependencies 9840 */ 9841 // @ts-expect-error block-editor is not typed correctly. 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 const TemplateEdit = ({ 9852 data, 9853 field, 9854 onChange 9855 }) => { 9856 const { 9857 id 9858 } = field; 9859 const postType = data.type; 9860 const postId = typeof data.id === 'number' ? data.id : parseInt(data.id, 10); 9861 const slug = data.slug; 9862 const { 9863 availableTemplates, 9864 templates 9865 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9866 var _select$getEntityReco; 9867 const allTemplates = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { 9868 per_page: -1, 9869 post_type: postType 9870 })) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : []; 9871 const { 9872 getHomePage, 9873 getPostsPageId 9874 } = lock_unlock_unlock(select(external_wp_coreData_namespaceObject.store)); 9875 const isPostsPage = getPostsPageId() === +postId; 9876 const isFrontPage = postType === 'page' && getHomePage()?.postId === +postId; 9877 const allowSwitchingTemplate = !isPostsPage && !isFrontPage; 9878 return { 9879 templates: allTemplates, 9880 availableTemplates: allowSwitchingTemplate ? allTemplates.filter(template => template.is_custom && template.slug !== data.template && !!template.content.raw // Skip empty templates. 9881 ) : [] 9882 }; 9883 }, [data.template, postId, postType]); 9884 const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => availableTemplates.map(template => ({ 9885 name: template.slug, 9886 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), 9887 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), 9888 id: template.id 9889 })), [availableTemplates]); 9890 const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns); 9891 const value = field.getValue({ 9892 item: data 9893 }); 9894 const currentTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => { 9895 const foundTemplate = templates?.find(template => template.slug === value); 9896 if (foundTemplate) { 9897 return foundTemplate; 9898 } 9899 let slugToCheck; 9900 // In `draft` status we might not have a slug available, so we use the `single` 9901 // post type templates slug(ex page, single-post, single-product etc..). 9902 // Pages do not need the `single` prefix in the slug to be prioritized 9903 // through template hierarchy. 9904 if (slug) { 9905 slugToCheck = postType === 'page' ? `$postType}-$slug}` : `single-$postType}-$slug}`; 9906 } else { 9907 slugToCheck = postType === 'page' ? 'page' : `single-$postType}`; 9908 } 9909 if (postType) { 9910 const templateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ 9911 slug: slugToCheck 9912 }); 9913 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId); 9914 } 9915 }, [postType, slug, templates, value]); 9916 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 9917 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 9918 [id]: newValue 9919 }), [id, onChange]); 9920 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 9921 className: "fields-controls__template", 9922 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 9923 popoverProps: { 9924 placement: 'bottom-start' 9925 }, 9926 renderToggle: ({ 9927 onToggle 9928 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9929 __next40pxDefaultSize: true, 9930 variant: "tertiary", 9931 size: "compact", 9932 onClick: onToggle, 9933 children: currentTemplate ? getItemTitle(currentTemplate) : '' 9934 }), 9935 renderContent: ({ 9936 onToggle 9937 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 9938 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 9939 onClick: () => { 9940 setShowModal(true); 9941 onToggle(); 9942 }, 9943 children: (0,external_wp_i18n_namespaceObject.__)('Change template') 9944 }), 9945 // The default template in a post is indicated by an empty string 9946 value !== '' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 9947 onClick: () => { 9948 onChangeControl(''); 9949 onToggle(); 9950 }, 9951 children: (0,external_wp_i18n_namespaceObject.__)('Use default template') 9952 })] 9953 }) 9954 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 9955 title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'), 9956 onRequestClose: () => setShowModal(false), 9957 overlayClassName: "fields-controls__template-modal", 9958 isFullScreen: true, 9959 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9960 className: "fields-controls__template-content", 9961 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 9962 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 9963 blockPatterns: templatesAsPatterns, 9964 shownPatterns: shownTemplates, 9965 onClickPattern: template => { 9966 onChangeControl(template.name); 9967 setShowModal(false); 9968 } 9969 }) 9970 }) 9971 })] 9972 }); 9973 }; 9974 9975 ;// ./node_modules/@wordpress/fields/build-module/fields/template/index.js 9976 /** 9977 * WordPress dependencies 9978 */ 9979 9980 /** 9981 * Internal dependencies 9982 */ 9983 9984 9985 const templateField = { 9986 id: 'template', 9987 type: 'text', 9988 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 9989 Edit: TemplateEdit, 9990 enableSorting: false 9991 }; 9992 9993 /** 9994 * Template field for BasePost. 9995 */ 9996 /* harmony default export */ const fields_template = (templateField); 9997 9998 ;// ./node_modules/@wordpress/fields/build-module/fields/password/edit.js 9999 /** 10000 * WordPress dependencies 10001 */ 10002 10003 10004 10005 10006 /** 10007 * Internal dependencies 10008 */ 10009 10010 function PasswordEdit({ 10011 data, 10012 onChange, 10013 field 10014 }) { 10015 const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!field.getValue({ 10016 item: data 10017 })); 10018 const handleTogglePassword = value => { 10019 setShowPassword(value); 10020 if (!value) { 10021 onChange({ 10022 password: '' 10023 }); 10024 } 10025 }; 10026 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 10027 as: "fieldset", 10028 spacing: 4, 10029 className: "fields-controls__password", 10030 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 10031 __nextHasNoMarginBottom: true, 10032 label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), 10033 help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'), 10034 checked: showPassword, 10035 onChange: handleTogglePassword 10036 }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10037 className: "fields-controls__password-input", 10038 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 10039 label: (0,external_wp_i18n_namespaceObject.__)('Password'), 10040 onChange: value => onChange({ 10041 password: value 10042 }), 10043 value: field.getValue({ 10044 item: data 10045 }) || '', 10046 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'), 10047 type: "text", 10048 __next40pxDefaultSize: true, 10049 __nextHasNoMarginBottom: true, 10050 maxLength: 255 10051 }) 10052 })] 10053 }); 10054 } 10055 /* harmony default export */ const edit = (PasswordEdit); 10056 10057 ;// ./node_modules/@wordpress/fields/build-module/fields/password/index.js 10058 /** 10059 * WordPress dependencies 10060 */ 10061 10062 /** 10063 * Internal dependencies 10064 */ 10065 10066 10067 const passwordField = { 10068 id: 'password', 10069 type: 'text', 10070 Edit: edit, 10071 enableSorting: false, 10072 enableHiding: false, 10073 isVisible: item => item.status !== 'private' 10074 }; 10075 10076 /** 10077 * Password field for BasePost. 10078 */ 10079 /* harmony default export */ const fields_password = (passwordField); 10080 10081 ;// ./node_modules/@wordpress/fields/build-module/fields/title/view.js 10082 /** 10083 * External dependencies 10084 */ 10085 10086 /** 10087 * WordPress dependencies 10088 */ 10089 10090 10091 10092 /** 10093 * Internal dependencies 10094 */ 10095 10096 10097 10098 function BaseTitleView({ 10099 item, 10100 className, 10101 children 10102 }) { 10103 const renderedTitle = getItemTitle(item); 10104 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 10105 className: dist_clsx('fields-field__title', className), 10106 alignment: "center", 10107 justify: "flex-start", 10108 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10109 children: renderedTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)') 10110 }), children] 10111 }); 10112 } 10113 function TitleView({ 10114 item 10115 }) { 10116 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { 10117 item: item 10118 }); 10119 } 10120 10121 ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/view.js 10122 /** 10123 * WordPress dependencies 10124 */ 10125 10126 10127 10128 10129 10130 /** 10131 * Internal dependencies 10132 */ 10133 10134 10135 10136 10137 const { 10138 Badge 10139 } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 10140 function PageTitleView({ 10141 item 10142 }) { 10143 const { 10144 frontPageId, 10145 postsPageId 10146 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10147 const { 10148 getEntityRecord 10149 } = select(external_wp_coreData_namespaceObject.store); 10150 const siteSettings = getEntityRecord('root', 'site'); 10151 return { 10152 frontPageId: siteSettings?.page_on_front, 10153 postsPageId: siteSettings?.page_for_posts 10154 }; 10155 }, []); 10156 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { 10157 item: item, 10158 className: "fields-field__page-title", 10159 children: [frontPageId, postsPageId].includes(item.id) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { 10160 children: item.id === frontPageId ? (0,external_wp_i18n_namespaceObject.__)('Homepage') : (0,external_wp_i18n_namespaceObject.__)('Posts Page') 10161 }) 10162 }); 10163 } 10164 10165 ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/index.js 10166 /** 10167 * WordPress dependencies 10168 */ 10169 10170 10171 10172 /** 10173 * Internal dependencies 10174 */ 10175 10176 10177 10178 const pageTitleField = { 10179 type: 'text', 10180 id: 'title', 10181 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 10182 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 10183 getValue: ({ 10184 item 10185 }) => getItemTitle(item), 10186 render: PageTitleView, 10187 enableHiding: false, 10188 enableGlobalSearch: true 10189 }; 10190 10191 /** 10192 * Title for the page entity. 10193 */ 10194 /* harmony default export */ const page_title = (pageTitleField); 10195 10196 ;// ./node_modules/@wordpress/fields/build-module/fields/template-title/index.js 10197 /** 10198 * WordPress dependencies 10199 */ 10200 10201 10202 10203 /** 10204 * Internal dependencies 10205 */ 10206 10207 10208 10209 const templateTitleField = { 10210 type: 'text', 10211 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 10212 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 10213 id: 'title', 10214 getValue: ({ 10215 item 10216 }) => getItemTitle(item), 10217 render: TitleView, 10218 enableHiding: false, 10219 enableGlobalSearch: true 10220 }; 10221 10222 /** 10223 * Title for the template entity. 10224 */ 10225 /* harmony default export */ const template_title = (templateTitleField); 10226 10227 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 10228 /** 10229 * WordPress dependencies 10230 */ 10231 10232 10233 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 10234 10235 /** 10236 * Return an SVG icon. 10237 * 10238 * @param {IconProps} props icon is the SVG component to render 10239 * size is a number specifying the icon size in pixels 10240 * Other props will be passed to wrapped SVG component 10241 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 10242 * 10243 * @return {JSX.Element} Icon component 10244 */ 10245 function Icon({ 10246 icon, 10247 size = 24, 10248 ...props 10249 }, ref) { 10250 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 10251 width: size, 10252 height: size, 10253 ...props, 10254 ref 10255 }); 10256 } 10257 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 10258 10259 ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js 10260 /** 10261 * WordPress dependencies 10262 */ 10263 10264 10265 const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10266 viewBox: "0 0 24 24", 10267 xmlns: "http://www.w3.org/2000/svg", 10268 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10269 fillRule: "evenodd", 10270 clipRule: "evenodd", 10271 d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" 10272 }) 10273 }); 10274 /* harmony default export */ const lock_small = (lockSmall); 10275 10276 ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/view.js 10277 /** 10278 * WordPress dependencies 10279 */ 10280 10281 10282 10283 // @ts-ignore 10284 10285 10286 /** 10287 * Internal dependencies 10288 */ 10289 10290 10291 10292 10293 const { 10294 PATTERN_TYPES: view_PATTERN_TYPES 10295 } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 10296 function PatternTitleView({ 10297 item 10298 }) { 10299 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { 10300 item: item, 10301 className: "fields-field__pattern-title", 10302 children: item.type === view_PATTERN_TYPES.theme && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 10303 placement: "top", 10304 text: (0,external_wp_i18n_namespaceObject.__)('This pattern cannot be edited.'), 10305 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { 10306 icon: lock_small, 10307 size: 24 10308 }) 10309 }) 10310 }); 10311 } 10312 10313 ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/index.js 10314 /** 10315 * WordPress dependencies 10316 */ 10317 10318 10319 10320 /** 10321 * Internal dependencies 10322 */ 10323 10324 10325 10326 const patternTitleField = { 10327 type: 'text', 10328 id: 'title', 10329 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 10330 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 10331 getValue: ({ 10332 item 10333 }) => getItemTitle(item), 10334 render: PatternTitleView, 10335 enableHiding: false, 10336 enableGlobalSearch: true 10337 }; 10338 10339 /** 10340 * Title for the pattern entity. 10341 */ 10342 /* harmony default export */ const pattern_title = (patternTitleField); 10343 10344 ;// ./node_modules/@wordpress/fields/build-module/fields/title/index.js 10345 /** 10346 * WordPress dependencies 10347 */ 10348 10349 10350 10351 /** 10352 * Internal dependencies 10353 */ 10354 10355 10356 10357 const titleField = { 10358 type: 'text', 10359 id: 'title', 10360 label: (0,external_wp_i18n_namespaceObject.__)('Title'), 10361 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 10362 getValue: ({ 10363 item 10364 }) => getItemTitle(item), 10365 render: TitleView, 10366 enableHiding: false, 10367 enableGlobalSearch: true 10368 }; 10369 10370 /** 10371 * Title for the any entity with a `title` property. 10372 * For patterns, pages or templates you should use the respective field 10373 * because there are some differences in the rendering, labels, etc. 10374 */ 10375 /* harmony default export */ const title = (titleField); 10376 10377 ;// ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js 10378 /** 10379 * WordPress dependencies 10380 */ 10381 10382 10383 10384 10385 10386 /** 10387 * Internal dependencies 10388 */ 10389 10390 10391 function getSubRegistry(subRegistries, registry, useSubRegistry) { 10392 if (!useSubRegistry) { 10393 return registry; 10394 } 10395 let subRegistry = subRegistries.get(registry); 10396 if (!subRegistry) { 10397 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({ 10398 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig 10399 }, registry); 10400 // Todo: The interface store should also be created per instance. 10401 subRegistry.registerStore('core/editor', storeConfig); 10402 subRegistries.set(registry, subRegistry); 10403 } 10404 return subRegistry; 10405 } 10406 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ 10407 useSubRegistry = true, 10408 ...props 10409 }) => { 10410 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 10411 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); 10412 const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry); 10413 if (subRegistry === registry) { 10414 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { 10415 registry: registry, 10416 ...props 10417 }); 10418 } 10419 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { 10420 value: subRegistry, 10421 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { 10422 registry: subRegistry, 10423 ...props 10424 }) 10425 }); 10426 }, 'withRegistryProvider'); 10427 /* harmony default export */ const with_registry_provider = (withRegistryProvider); 10428 10429 ;// ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js 10430 /* wp:polyfill */ 10431 /** 10432 * The `editor` settings here need to be in sync with the corresponding ones in `editor` package. 10433 * See `packages/editor/src/components/media-categories/index.js`. 10434 * 10435 * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`. 10436 * The rest of the settings would still need to be in sync though. 10437 */ 10438 10439 /** 10440 * WordPress dependencies 10441 */ 10442 10443 10444 10445 10446 /** 10447 * Internal dependencies 10448 */ 10449 10450 10451 /** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */ 10452 /** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */ 10453 /** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */ 10454 10455 const getExternalLink = (url, text) => `<a $getExternalLinkAttributes(url)}>$text}</a>`; 10456 const getExternalLinkAttributes = url => `href="$url}" target="_blank" rel="noreferrer noopener"`; 10457 const getOpenverseLicense = (license, licenseVersion) => { 10458 let licenseName = license.trim(); 10459 // PDM has no abbreviation 10460 if (license !== 'pdm') { 10461 licenseName = license.toUpperCase().replace('SAMPLING', 'Sampling'); 10462 } 10463 // If version is known, append version to the name. 10464 // The license has to have a version to be valid. Only 10465 // PDM (public domain mark) doesn't have a version. 10466 if (licenseVersion) { 10467 licenseName += ` $licenseVersion}`; 10468 } 10469 // For licenses other than public-domain marks, prepend 'CC' to the name. 10470 if (!['pdm', 'cc0'].includes(license)) { 10471 licenseName = `CC $licenseName}`; 10472 } 10473 return licenseName; 10474 }; 10475 const getOpenverseCaption = item => { 10476 const { 10477 title, 10478 foreign_landing_url: foreignLandingUrl, 10479 creator, 10480 creator_url: creatorUrl, 10481 license, 10482 license_version: licenseVersion, 10483 license_url: licenseUrl 10484 } = item; 10485 const fullLicense = getOpenverseLicense(license, licenseVersion); 10486 const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator); 10487 let _caption; 10488 if (_creator) { 10489 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 10490 // translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0". 10491 (0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`$licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)( 10492 // translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0". 10493 (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a> by %2$s/ %3$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`$licenseUrl}?ref=openverse`, fullLicense) : fullLicense); 10494 } else { 10495 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 10496 // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". 10497 (0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), licenseUrl ? getExternalLink(`$licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)( 10498 // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". 10499 (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a>/ %2$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink(`$licenseUrl}?ref=openverse`, fullLicense) : fullLicense); 10500 } 10501 return _caption.replace(/\s{2}/g, ' '); 10502 }; 10503 const coreMediaFetch = async (query = {}) => { 10504 const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getMediaItems({ 10505 ...query, 10506 orderBy: !!query?.search ? 'relevance' : 'date' 10507 }); 10508 return mediaItems.map(mediaItem => ({ 10509 ...mediaItem, 10510 alt: mediaItem.alt_text, 10511 url: mediaItem.source_url, 10512 previewUrl: mediaItem.media_details?.sizes?.medium?.source_url, 10513 caption: mediaItem.caption?.raw 10514 })); 10515 }; 10516 10517 /** @type {InserterMediaCategory[]} */ 10518 const inserterMediaCategories = [{ 10519 name: 'images', 10520 labels: { 10521 name: (0,external_wp_i18n_namespaceObject.__)('Images'), 10522 search_items: (0,external_wp_i18n_namespaceObject.__)('Search images') 10523 }, 10524 mediaType: 'image', 10525 async fetch(query = {}) { 10526 return coreMediaFetch({ 10527 ...query, 10528 media_type: 'image' 10529 }); 10530 } 10531 }, { 10532 name: 'videos', 10533 labels: { 10534 name: (0,external_wp_i18n_namespaceObject.__)('Videos'), 10535 search_items: (0,external_wp_i18n_namespaceObject.__)('Search videos') 10536 }, 10537 mediaType: 'video', 10538 async fetch(query = {}) { 10539 return coreMediaFetch({ 10540 ...query, 10541 media_type: 'video' 10542 }); 10543 } 10544 }, { 10545 name: 'audio', 10546 labels: { 10547 name: (0,external_wp_i18n_namespaceObject.__)('Audio'), 10548 search_items: (0,external_wp_i18n_namespaceObject.__)('Search audio') 10549 }, 10550 mediaType: 'audio', 10551 async fetch(query = {}) { 10552 return coreMediaFetch({ 10553 ...query, 10554 media_type: 'audio' 10555 }); 10556 } 10557 }, { 10558 name: 'openverse', 10559 labels: { 10560 name: (0,external_wp_i18n_namespaceObject.__)('Openverse'), 10561 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Openverse') 10562 }, 10563 mediaType: 'image', 10564 async fetch(query = {}) { 10565 const defaultArgs = { 10566 mature: false, 10567 excluded_source: 'flickr,inaturalist,wikimedia', 10568 license: 'pdm,cc0' 10569 }; 10570 const finalQuery = { 10571 ...query, 10572 ...defaultArgs 10573 }; 10574 const mapFromInserterMediaRequest = { 10575 per_page: 'page_size', 10576 search: 'q' 10577 }; 10578 const url = new URL('https://api.openverse.org/v1/images/'); 10579 Object.entries(finalQuery).forEach(([key, value]) => { 10580 const queryKey = mapFromInserterMediaRequest[key] || key; 10581 url.searchParams.set(queryKey, value); 10582 }); 10583 const response = await window.fetch(url, { 10584 headers: { 10585 'User-Agent': 'WordPress/inserter-media-fetch' 10586 } 10587 }); 10588 const jsonResponse = await response.json(); 10589 const results = jsonResponse.results; 10590 return results.map(result => ({ 10591 ...result, 10592 // This is a temp solution for better titles, until Openverse API 10593 // completes the cleaning up of some titles of their upstream data. 10594 title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title, 10595 sourceId: result.id, 10596 id: undefined, 10597 caption: getOpenverseCaption(result), 10598 previewUrl: result.thumbnail 10599 })); 10600 }, 10601 getReportUrl: ({ 10602 sourceId 10603 }) => `https://wordpress.org/openverse/image/$sourceId}/report/`, 10604 isExternalResource: true 10605 }]; 10606 /* harmony default export */ const media_categories = (inserterMediaCategories); 10607 10608 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/native.js 10609 const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); 10610 /* harmony default export */ const esm_browser_native = ({ 10611 randomUUID 10612 }); 10613 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/rng.js 10614 // Unique ID creation requires a high quality random # generator. In the browser we therefore 10615 // require the crypto API and do not support built-in fallback to lower quality random number 10616 // generators (like Math.random()). 10617 let getRandomValues; 10618 const rnds8 = new Uint8Array(16); 10619 function rng() { 10620 // lazy load so that environments that need to polyfill have a chance to do so 10621 if (!getRandomValues) { 10622 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 10623 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 10624 10625 if (!getRandomValues) { 10626 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 10627 } 10628 } 10629 10630 return getRandomValues(rnds8); 10631 } 10632 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/stringify.js 10633 10634 /** 10635 * Convert array of 16 byte values to UUID string format of the form: 10636 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 10637 */ 10638 10639 const byteToHex = []; 10640 10641 for (let i = 0; i < 256; ++i) { 10642 byteToHex.push((i + 0x100).toString(16).slice(1)); 10643 } 10644 10645 function unsafeStringify(arr, offset = 0) { 10646 // Note: Be careful editing this code! It's been tuned for performance 10647 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 10648 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; 10649 } 10650 10651 function stringify(arr, offset = 0) { 10652 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one 10653 // of the following: 10654 // - One or more input array values don't map to a hex octet (leading to 10655 // "undefined" in the uuid) 10656 // - Invalid input values for the RFC `version` or `variant` fields 10657 10658 if (!validate(uuid)) { 10659 throw TypeError('Stringified UUID is invalid'); 10660 } 10661 10662 return uuid; 10663 } 10664 10665 /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); 10666 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/v4.js 10667 10668 10669 10670 10671 function v4(options, buf, offset) { 10672 if (esm_browser_native.randomUUID && !buf && !options) { 10673 return esm_browser_native.randomUUID(); 10674 } 10675 10676 options = options || {}; 10677 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 10678 10679 rnds[6] = rnds[6] & 0x0f | 0x40; 10680 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 10681 10682 if (buf) { 10683 offset = offset || 0; 10684 10685 for (let i = 0; i < 16; ++i) { 10686 buf[offset + i] = rnds[i]; 10687 } 10688 10689 return buf; 10690 } 10691 10692 return unsafeStringify(rnds); 10693 } 10694 10695 /* harmony default export */ const esm_browser_v4 = (v4); 10696 ;// ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js 10697 /** 10698 * External dependencies 10699 */ 10700 10701 10702 /** 10703 * WordPress dependencies 10704 */ 10705 10706 10707 10708 /** 10709 * Internal dependencies 10710 */ 10711 10712 const noop = () => {}; 10713 10714 /** 10715 * Upload a media file when the file upload button is activated. 10716 * Wrapper around mediaUpload() that injects the current post ID. 10717 * 10718 * @param {Object} $0 Parameters object passed to the function. 10719 * @param {?Object} $0.additionalData Additional data to include in the request. 10720 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. 10721 * @param {Array} $0.filesList List of files. 10722 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. 10723 * @param {Function} $0.onError Function called when an error happens. 10724 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. 10725 * @param {Function} $0.onSuccess Function called after the final representation of the file is available. 10726 */ 10727 function mediaUpload({ 10728 additionalData = {}, 10729 allowedTypes, 10730 filesList, 10731 maxUploadFileSize, 10732 onError = noop, 10733 onFileChange, 10734 onSuccess 10735 }) { 10736 const { 10737 getCurrentPost, 10738 getEditorSettings 10739 } = (0,external_wp_data_namespaceObject.select)(store_store); 10740 const { 10741 lockPostAutosaving, 10742 unlockPostAutosaving, 10743 lockPostSaving, 10744 unlockPostSaving 10745 } = (0,external_wp_data_namespaceObject.dispatch)(store_store); 10746 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; 10747 const lockKey = `image-upload-$esm_browser_v4()}`; 10748 let imageIsUploading = false; 10749 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; 10750 const currentPost = getCurrentPost(); 10751 // Templates and template parts' numerical ID is stored in `wp_id`. 10752 const currentPostId = typeof currentPost?.id === 'number' ? currentPost.id : currentPost?.wp_id; 10753 const setSaveLock = () => { 10754 lockPostSaving(lockKey); 10755 lockPostAutosaving(lockKey); 10756 imageIsUploading = true; 10757 }; 10758 const postData = currentPostId ? { 10759 post: currentPostId 10760 } : {}; 10761 const clearSaveLock = () => { 10762 unlockPostSaving(lockKey); 10763 unlockPostAutosaving(lockKey); 10764 imageIsUploading = false; 10765 }; 10766 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 10767 allowedTypes, 10768 filesList, 10769 onFileChange: file => { 10770 if (!imageIsUploading) { 10771 setSaveLock(); 10772 } else { 10773 clearSaveLock(); 10774 } 10775 onFileChange?.(file); 10776 }, 10777 onSuccess, 10778 additionalData: { 10779 ...postData, 10780 ...additionalData 10781 }, 10782 maxUploadFileSize, 10783 onError: ({ 10784 message 10785 }) => { 10786 clearSaveLock(); 10787 onError(message); 10788 }, 10789 wpAllowedMimeTypes 10790 }); 10791 } 10792 10793 ;// ./node_modules/@wordpress/editor/build-module/utils/media-sideload/index.js 10794 /** 10795 * WordPress dependencies 10796 */ 10797 10798 10799 /** 10800 * Internal dependencies 10801 */ 10802 10803 const { 10804 sideloadMedia: mediaSideload 10805 } = unlock(external_wp_mediaUtils_namespaceObject.privateApis); 10806 /* harmony default export */ const media_sideload = (mediaSideload); 10807 10808 // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js 10809 var cjs = __webpack_require__(66); 10810 var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); 10811 ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs 10812 /*! 10813 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 10814 * 10815 * Copyright (c) 2014-2017, Jon Schlinkert. 10816 * Released under the MIT License. 10817 */ 10818 10819 function isObject(o) { 10820 return Object.prototype.toString.call(o) === '[object Object]'; 10821 } 10822 10823 function isPlainObject(o) { 10824 var ctor,prot; 10825 10826 if (isObject(o) === false) return false; 10827 10828 // If has modified constructor 10829 ctor = o.constructor; 10830 if (ctor === undefined) return true; 10831 10832 // If has modified prototype 10833 prot = ctor.prototype; 10834 if (isObject(prot) === false) return false; 10835 10836 // If constructor does not have an Object-specific method 10837 if (prot.hasOwnProperty('isPrototypeOf') === false) { 10838 return false; 10839 } 10840 10841 // Most likely a plain Object 10842 return true; 10843 } 10844 10845 10846 10847 ;// ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js 10848 /** 10849 * External dependencies 10850 */ 10851 10852 10853 10854 /** 10855 * WordPress dependencies 10856 */ 10857 10858 10859 10860 10861 10862 /** 10863 * Internal dependencies 10864 */ 10865 10866 10867 const { 10868 GlobalStylesContext, 10869 cleanEmptyObject 10870 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10871 function mergeBaseAndUserConfigs(base, user) { 10872 return cjs_default()(base, user, { 10873 /* 10874 * We only pass as arrays the presets, 10875 * in which case we want the new array of values 10876 * to override the old array (no merging). 10877 */ 10878 isMergeableObject: isPlainObject, 10879 /* 10880 * Exceptions to the above rule. 10881 * Background images should be replaced, not merged, 10882 * as they themselves are specific object definitions for the style. 10883 */ 10884 customMerge: key => { 10885 if (key === 'backgroundImage') { 10886 return (baseConfig, userConfig) => userConfig; 10887 } 10888 return undefined; 10889 } 10890 }); 10891 } 10892 function useGlobalStylesUserConfig() { 10893 const { 10894 globalStylesId, 10895 isReady, 10896 settings, 10897 styles, 10898 _links 10899 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10900 const { 10901 getEntityRecord, 10902 getEditedEntityRecord, 10903 hasFinishedResolution, 10904 canUser 10905 } = select(external_wp_coreData_namespaceObject.store); 10906 const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); 10907 let record; 10908 10909 /* 10910 * Ensure that the global styles ID request is complete by testing `_globalStylesId`, 10911 * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will 10912 * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`. 10913 * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`, 10914 * or set using the `block_editor_rest_api_preload_paths` filter, if this changes. 10915 */ 10916 const userCanEditGlobalStyles = _globalStylesId ? canUser('update', { 10917 kind: 'root', 10918 name: 'globalStyles', 10919 id: _globalStylesId 10920 }) : null; 10921 if (_globalStylesId && 10922 /* 10923 * Test that the OPTIONS request for user capabilities is complete 10924 * before fetching the global styles entity record. 10925 * This is to avoid fetching the global styles entity unnecessarily. 10926 */ 10927 typeof userCanEditGlobalStyles === 'boolean') { 10928 /* 10929 * Fetch the global styles entity record based on the user's capabilities. 10930 * The default context is `edit` for users who can edit global styles. 10931 * Otherwise, the context is `view`. 10932 * NOTE: There is an equivalent conditional check using `current_user_can()` in the backend 10933 * to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`, 10934 * or set using `block_editor_rest_api_preload_paths` filter, if this changes. 10935 */ 10936 if (userCanEditGlobalStyles) { 10937 record = getEditedEntityRecord('root', 'globalStyles', _globalStylesId); 10938 } else { 10939 record = getEntityRecord('root', 'globalStyles', _globalStylesId, { 10940 context: 'view' 10941 }); 10942 } 10943 } 10944 let hasResolved = false; 10945 if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) { 10946 if (_globalStylesId) { 10947 hasResolved = userCanEditGlobalStyles ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : hasFinishedResolution('getEntityRecord', ['root', 'globalStyles', _globalStylesId, { 10948 context: 'view' 10949 }]); 10950 } else { 10951 hasResolved = true; 10952 } 10953 } 10954 return { 10955 globalStylesId: _globalStylesId, 10956 isReady: hasResolved, 10957 settings: record?.settings, 10958 styles: record?.styles, 10959 _links: record?._links 10960 }; 10961 }, []); 10962 const { 10963 getEditedEntityRecord 10964 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 10965 const { 10966 editEntityRecord 10967 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 10968 const config = (0,external_wp_element_namespaceObject.useMemo)(() => { 10969 return { 10970 settings: settings !== null && settings !== void 0 ? settings : {}, 10971 styles: styles !== null && styles !== void 0 ? styles : {}, 10972 _links: _links !== null && _links !== void 0 ? _links : {} 10973 }; 10974 }, [settings, styles, _links]); 10975 const setConfig = (0,external_wp_element_namespaceObject.useCallback)( 10976 /** 10977 * Set the global styles config. 10978 * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values. 10979 * Otherwise, overwrite the current config with the incoming object. 10980 * @param {Object} options Options for editEntityRecord Core selector. 10981 */ 10982 (callbackOrObject, options = {}) => { 10983 var _record$styles, _record$settings, _record$_links; 10984 const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); 10985 const currentConfig = { 10986 styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, 10987 settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}, 10988 _links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {} 10989 }; 10990 const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject; 10991 editEntityRecord('root', 'globalStyles', globalStylesId, { 10992 styles: cleanEmptyObject(updatedConfig.styles) || {}, 10993 settings: cleanEmptyObject(updatedConfig.settings) || {}, 10994 _links: cleanEmptyObject(updatedConfig._links) || {} 10995 }, options); 10996 }, [globalStylesId, editEntityRecord, getEditedEntityRecord]); 10997 return [isReady, config, setConfig]; 10998 } 10999 function useGlobalStylesBaseConfig() { 11000 const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(), []); 11001 return [!!baseConfig, baseConfig]; 11002 } 11003 function useGlobalStylesContext() { 11004 const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); 11005 const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); 11006 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 11007 if (!baseConfig || !userConfig) { 11008 return {}; 11009 } 11010 return mergeBaseAndUserConfigs(baseConfig, userConfig); 11011 }, [userConfig, baseConfig]); 11012 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 11013 return { 11014 isReady: isUserConfigReady && isBaseConfigReady, 11015 user: userConfig, 11016 base: baseConfig, 11017 merged: mergedConfig, 11018 setUserConfig 11019 }; 11020 }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); 11021 return context; 11022 } 11023 function GlobalStylesProvider({ 11024 children 11025 }) { 11026 const context = useGlobalStylesContext(); 11027 if (!context.isReady) { 11028 return null; 11029 } 11030 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesContext.Provider, { 11031 value: context, 11032 children: children 11033 }); 11034 } 11035 11036 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js 11037 /* wp:polyfill */ 11038 /** 11039 * WordPress dependencies 11040 */ 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 /** 11051 * Internal dependencies 11052 */ 11053 11054 11055 11056 11057 11058 11059 const use_block_editor_settings_EMPTY_OBJECT = {}; 11060 function __experimentalReusableBlocksSelect(select) { 11061 const { 11062 RECEIVE_INTERMEDIATE_RESULTS 11063 } = unlock(external_wp_coreData_namespaceObject.privateApis); 11064 const { 11065 getEntityRecords 11066 } = select(external_wp_coreData_namespaceObject.store); 11067 return getEntityRecords('postType', 'wp_block', { 11068 per_page: -1, 11069 [RECEIVE_INTERMEDIATE_RESULTS]: true 11070 }); 11071 } 11072 const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'maxUploadFileSize', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'canUpdateBlockBindings', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isPreviewMode', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme']; 11073 const { 11074 globalStylesDataKey, 11075 globalStylesLinksDataKey, 11076 selectBlockPatternsKey, 11077 reusableBlocksSelectKey, 11078 sectionRootClientIdKey 11079 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11080 11081 /** 11082 * React hook used to compute the block editor settings to use for the post editor. 11083 * 11084 * @param {Object} settings EditorProvider settings prop. 11085 * @param {string} postType Editor root level post type. 11086 * @param {string} postId Editor root level post ID. 11087 * @param {string} renderingMode Editor rendering mode. 11088 * 11089 * @return {Object} Block Editor Settings. 11090 */ 11091 function useBlockEditorSettings(settings, postType, postId, renderingMode) { 11092 var _mergedGlobalStyles$s, _mergedGlobalStyles$_, _settings$__experimen, _settings$__experimen2; 11093 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 11094 const { 11095 allowRightClickOverrides, 11096 blockTypes, 11097 focusMode, 11098 hasFixedToolbar, 11099 isDistractionFree, 11100 keepCaretInsideBlock, 11101 hasUploadPermissions, 11102 hiddenBlockTypes, 11103 canUseUnfilteredHTML, 11104 userCanCreatePages, 11105 pageOnFront, 11106 pageForPosts, 11107 userPatternCategories, 11108 restBlockPatternCategories, 11109 sectionRootClientId 11110 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11111 var _canUser; 11112 const { 11113 canUser, 11114 getRawEntityRecord, 11115 getEntityRecord, 11116 getUserPatternCategories, 11117 getBlockPatternCategories 11118 } = select(external_wp_coreData_namespaceObject.store); 11119 const { 11120 get 11121 } = select(external_wp_preferences_namespaceObject.store); 11122 const { 11123 getBlockTypes 11124 } = select(external_wp_blocks_namespaceObject.store); 11125 const { 11126 getBlocksByName, 11127 getBlockAttributes 11128 } = select(external_wp_blockEditor_namespaceObject.store); 11129 const siteSettings = canUser('read', { 11130 kind: 'root', 11131 name: 'site' 11132 }) ? getEntityRecord('root', 'site') : undefined; 11133 function getSectionRootBlock() { 11134 var _getBlocksByName$find; 11135 if (renderingMode === 'template-locked') { 11136 var _getBlocksByName$; 11137 return (_getBlocksByName$ = getBlocksByName('core/post-content')?.[0]) !== null && _getBlocksByName$ !== void 0 ? _getBlocksByName$ : ''; 11138 } 11139 return (_getBlocksByName$find = getBlocksByName('core/group').find(clientId => getBlockAttributes(clientId)?.tagName === 'main')) !== null && _getBlocksByName$find !== void 0 ? _getBlocksByName$find : ''; 11140 } 11141 return { 11142 allowRightClickOverrides: get('core', 'allowRightClickOverrides'), 11143 blockTypes: getBlockTypes(), 11144 canUseUnfilteredHTML: getRawEntityRecord('postType', postType, postId)?._links?.hasOwnProperty('wp:action-unfiltered-html'), 11145 focusMode: get('core', 'focusMode'), 11146 hasFixedToolbar: get('core', 'fixedToolbar') || !isLargeViewport, 11147 hiddenBlockTypes: get('core', 'hiddenBlockTypes'), 11148 isDistractionFree: get('core', 'distractionFree'), 11149 keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'), 11150 hasUploadPermissions: (_canUser = canUser('create', { 11151 kind: 'root', 11152 name: 'media' 11153 })) !== null && _canUser !== void 0 ? _canUser : true, 11154 userCanCreatePages: canUser('create', { 11155 kind: 'postType', 11156 name: 'page' 11157 }), 11158 pageOnFront: siteSettings?.page_on_front, 11159 pageForPosts: siteSettings?.page_for_posts, 11160 userPatternCategories: getUserPatternCategories(), 11161 restBlockPatternCategories: getBlockPatternCategories(), 11162 sectionRootClientId: getSectionRootBlock() 11163 }; 11164 }, [postType, postId, isLargeViewport, renderingMode]); 11165 const { 11166 merged: mergedGlobalStyles 11167 } = useGlobalStylesContext(); 11168 const globalStylesData = (_mergedGlobalStyles$s = mergedGlobalStyles.styles) !== null && _mergedGlobalStyles$s !== void 0 ? _mergedGlobalStyles$s : use_block_editor_settings_EMPTY_OBJECT; 11169 const globalStylesLinksData = (_mergedGlobalStyles$_ = mergedGlobalStyles._links) !== null && _mergedGlobalStyles$_ !== void 0 ? _mergedGlobalStyles$_ : use_block_editor_settings_EMPTY_OBJECT; 11170 const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : 11171 // WP 6.0 11172 settings.__experimentalBlockPatterns; // WP 5.9 11173 const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 : 11174 // WP 6.0 11175 settings.__experimentalBlockPatternCategories; // WP 5.9 11176 11177 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || [])].filter(({ 11178 postTypes 11179 }) => { 11180 return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType); 11181 }), [settingsBlockPatterns, postType]); 11182 const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]); 11183 const { 11184 undo, 11185 setIsInserterOpened 11186 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11187 const { 11188 saveEntityRecord 11189 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 11190 11191 /** 11192 * Creates a Post entity. 11193 * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages. 11194 * 11195 * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord. 11196 * @return {Object} the post type object that was created. 11197 */ 11198 const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(options => { 11199 if (!userCanCreatePages) { 11200 return Promise.reject({ 11201 message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.') 11202 }); 11203 } 11204 return saveEntityRecord('postType', 'page', options); 11205 }, [saveEntityRecord, userCanCreatePages]); 11206 const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 11207 // Omit hidden block types if exists and non-empty. 11208 if (hiddenBlockTypes && hiddenBlockTypes.length > 0) { 11209 // Defer to passed setting for `allowedBlockTypes` if provided as 11210 // anything other than `true` (where `true` is equivalent to allow 11211 // all block types). 11212 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ 11213 name 11214 }) => name) : settings.allowedBlockTypes || []; 11215 return defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type)); 11216 } 11217 return settings.allowedBlockTypes; 11218 }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]); 11219 const forceDisableFocusMode = settings.focusMode === false; 11220 return (0,external_wp_element_namespaceObject.useMemo)(() => { 11221 const blockEditorSettings = { 11222 ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))), 11223 [globalStylesDataKey]: globalStylesData, 11224 [globalStylesLinksDataKey]: globalStylesLinksData, 11225 allowedBlockTypes, 11226 allowRightClickOverrides, 11227 focusMode: focusMode && !forceDisableFocusMode, 11228 hasFixedToolbar, 11229 isDistractionFree, 11230 keepCaretInsideBlock, 11231 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, 11232 mediaSideload: hasUploadPermissions ? media_sideload : undefined, 11233 __experimentalBlockPatterns: blockPatterns, 11234 [selectBlockPatternsKey]: select => { 11235 const { 11236 hasFinishedResolution, 11237 getBlockPatternsForPostType 11238 } = unlock(select(external_wp_coreData_namespaceObject.store)); 11239 const patterns = getBlockPatternsForPostType(postType); 11240 return hasFinishedResolution('getBlockPatterns') ? patterns : undefined; 11241 }, 11242 [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, 11243 __experimentalBlockPatternCategories: blockPatternCategories, 11244 __experimentalUserPatternCategories: userPatternCategories, 11245 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), 11246 inserterMediaCategories: media_categories, 11247 __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, 11248 // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited. 11249 // This might be better as a generic "canUser" selector. 11250 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, 11251 //Todo: this is only needed for native and should probably be removed. 11252 __experimentalUndo: undo, 11253 // Check whether we want all site editor frames to have outlines 11254 // including the navigation / pattern / parts editors. 11255 outlineMode: !isDistractionFree && postType === 'wp_template', 11256 // Check these two properties: they were not present in the site editor. 11257 __experimentalCreatePageEntity: createPageEntity, 11258 __experimentalUserCanCreatePages: userCanCreatePages, 11259 pageOnFront, 11260 pageForPosts, 11261 __experimentalPreferPatternsOnRoot: postType === 'wp_template', 11262 templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock, 11263 template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template, 11264 __experimentalSetIsInserterOpened: setIsInserterOpened, 11265 [sectionRootClientIdKey]: sectionRootClientId, 11266 editorTool: renderingMode === 'post-only' && postType !== 'wp_template' ? 'edit' : undefined 11267 }; 11268 return blockEditorSettings; 11269 }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData, renderingMode]); 11270 } 11271 /* harmony default export */ const use_block_editor_settings = (useBlockEditorSettings); 11272 11273 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-post-content-blocks.js 11274 /** 11275 * WordPress dependencies 11276 */ 11277 11278 11279 11280 11281 /** 11282 * Internal dependencies 11283 */ 11284 11285 11286 const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; 11287 function usePostContentBlocks() { 11288 const contentOnlyBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => [...(0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', POST_CONTENT_BLOCK_TYPES)], []); 11289 11290 // Note that there are two separate subscriptions because the result for each 11291 // returns a new array. 11292 const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)(select => { 11293 const { 11294 getPostBlocksByName 11295 } = unlock(select(store_store)); 11296 return getPostBlocksByName(contentOnlyBlockTypes); 11297 }, [contentOnlyBlockTypes]); 11298 return contentOnlyIds; 11299 } 11300 11301 ;// ./node_modules/@wordpress/editor/build-module/components/provider/disable-non-page-content-blocks.js 11302 /* wp:polyfill */ 11303 /** 11304 * WordPress dependencies 11305 */ 11306 11307 11308 11309 11310 /** 11311 * Internal dependencies 11312 */ 11313 11314 11315 /** 11316 * Component that when rendered, makes it so that the site editor allows only 11317 * page content to be edited. 11318 */ 11319 function DisableNonPageContentBlocks() { 11320 const contentOnlyIds = usePostContentBlocks(); 11321 const { 11322 templateParts, 11323 isNavigationMode 11324 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11325 const { 11326 getBlocksByName, 11327 isNavigationMode: _isNavigationMode 11328 } = select(external_wp_blockEditor_namespaceObject.store); 11329 return { 11330 templateParts: getBlocksByName('core/template-part'), 11331 isNavigationMode: _isNavigationMode() 11332 }; 11333 }, []); 11334 const disabledIds = (0,external_wp_data_namespaceObject.useSelect)(select => { 11335 const { 11336 getBlockOrder 11337 } = select(external_wp_blockEditor_namespaceObject.store); 11338 return templateParts.flatMap(clientId => getBlockOrder(clientId)); 11339 }, [templateParts]); 11340 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 11341 11342 // The code here is split into multiple `useEffects` calls. 11343 // This is done to avoid setting/unsetting block editing modes multiple times unnecessarily. 11344 // 11345 // For example, the block editing mode of the root block (clientId: '') only 11346 // needs to be set once, not when `contentOnlyIds` or `disabledIds` change. 11347 // 11348 // It's also unlikely that these different types of blocks are being inserted 11349 // or removed at the same time, so using different effects reflects that. 11350 (0,external_wp_element_namespaceObject.useEffect)(() => { 11351 const { 11352 setBlockEditingMode, 11353 unsetBlockEditingMode 11354 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 11355 setBlockEditingMode('', 'disabled'); 11356 return () => { 11357 unsetBlockEditingMode(''); 11358 }; 11359 }, [registry]); 11360 (0,external_wp_element_namespaceObject.useEffect)(() => { 11361 const { 11362 setBlockEditingMode, 11363 unsetBlockEditingMode 11364 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 11365 registry.batch(() => { 11366 for (const clientId of contentOnlyIds) { 11367 setBlockEditingMode(clientId, 'contentOnly'); 11368 } 11369 }); 11370 return () => { 11371 registry.batch(() => { 11372 for (const clientId of contentOnlyIds) { 11373 unsetBlockEditingMode(clientId); 11374 } 11375 }); 11376 }; 11377 }, [contentOnlyIds, registry]); 11378 (0,external_wp_element_namespaceObject.useEffect)(() => { 11379 const { 11380 setBlockEditingMode, 11381 unsetBlockEditingMode 11382 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 11383 registry.batch(() => { 11384 if (!isNavigationMode) { 11385 for (const clientId of templateParts) { 11386 setBlockEditingMode(clientId, 'contentOnly'); 11387 } 11388 } 11389 }); 11390 return () => { 11391 registry.batch(() => { 11392 if (!isNavigationMode) { 11393 for (const clientId of templateParts) { 11394 unsetBlockEditingMode(clientId); 11395 } 11396 } 11397 }); 11398 }; 11399 }, [templateParts, isNavigationMode, registry]); 11400 (0,external_wp_element_namespaceObject.useEffect)(() => { 11401 const { 11402 setBlockEditingMode, 11403 unsetBlockEditingMode 11404 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 11405 registry.batch(() => { 11406 for (const clientId of disabledIds) { 11407 setBlockEditingMode(clientId, 'disabled'); 11408 } 11409 }); 11410 return () => { 11411 registry.batch(() => { 11412 for (const clientId of disabledIds) { 11413 unsetBlockEditingMode(clientId); 11414 } 11415 }); 11416 }; 11417 }, [disabledIds, registry]); 11418 return null; 11419 } 11420 11421 ;// ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js 11422 /** 11423 * WordPress dependencies 11424 */ 11425 11426 11427 11428 11429 /** 11430 * For the Navigation block editor, we need to force the block editor to contentOnly for that block. 11431 * 11432 * Set block editing mode to contentOnly when entering Navigation focus mode. 11433 * this ensures that non-content controls on the block will be hidden and thus 11434 * the user can focus on editing the Navigation Menu content only. 11435 */ 11436 11437 function NavigationBlockEditingMode() { 11438 // In the navigation block editor, 11439 // the navigation block is the only root block. 11440 const blockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockOrder()?.[0], []); 11441 const { 11442 setBlockEditingMode, 11443 unsetBlockEditingMode 11444 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 11445 (0,external_wp_element_namespaceObject.useEffect)(() => { 11446 if (!blockClientId) { 11447 return; 11448 } 11449 setBlockEditingMode(blockClientId, 'contentOnly'); 11450 return () => { 11451 unsetBlockEditingMode(blockClientId); 11452 }; 11453 }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]); 11454 } 11455 11456 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js 11457 /** 11458 * WordPress dependencies 11459 */ 11460 11461 11462 11463 // These post types are "structural" block lists. 11464 // We should be allowed to use 11465 // the post content and template parts blocks within them. 11466 const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = ['wp_block', 'wp_template', 'wp_template_part']; 11467 11468 /** 11469 * In some specific contexts, 11470 * the template part and post content blocks need to be hidden. 11471 * 11472 * @param {string} postType Post Type 11473 * @param {string} mode Rendering mode 11474 */ 11475 function useHideBlocksFromInserter(postType, mode) { 11476 (0,external_wp_element_namespaceObject.useEffect)(() => { 11477 /* 11478 * Prevent adding template part in the editor. 11479 */ 11480 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { 11481 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/template-part' && mode === 'post-only') { 11482 return false; 11483 } 11484 return canInsert; 11485 }); 11486 11487 /* 11488 * Prevent adding post content block (except in query block) in the editor. 11489 */ 11490 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { 11491 getBlockParentsByBlockName 11492 }) => { 11493 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/post-content') { 11494 return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; 11495 } 11496 return canInsert; 11497 }); 11498 return () => { 11499 (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter'); 11500 (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter'); 11501 }; 11502 }, [postType, mode]); 11503 } 11504 11505 ;// ./node_modules/@wordpress/icons/build-module/library/keyboard.js 11506 /** 11507 * WordPress dependencies 11508 */ 11509 11510 11511 const keyboard = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 11512 xmlns: "http://www.w3.org/2000/svg", 11513 viewBox: "0 0 24 24", 11514 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11515 d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" 11516 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11517 d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" 11518 })] 11519 }); 11520 /* harmony default export */ const library_keyboard = (keyboard); 11521 11522 ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js 11523 /** 11524 * WordPress dependencies 11525 */ 11526 11527 11528 const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11529 viewBox: "0 0 24 24", 11530 xmlns: "http://www.w3.org/2000/svg", 11531 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11532 d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" 11533 }) 11534 }); 11535 /* harmony default export */ const list_view = (listView); 11536 11537 ;// ./node_modules/@wordpress/icons/build-module/library/code.js 11538 /** 11539 * WordPress dependencies 11540 */ 11541 11542 11543 const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11544 viewBox: "0 0 24 24", 11545 xmlns: "http://www.w3.org/2000/svg", 11546 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11547 d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" 11548 }) 11549 }); 11550 /* harmony default export */ const library_code = (code); 11551 11552 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js 11553 /** 11554 * WordPress dependencies 11555 */ 11556 11557 11558 const drawerLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11559 width: "24", 11560 height: "24", 11561 xmlns: "http://www.w3.org/2000/svg", 11562 viewBox: "0 0 24 24", 11563 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11564 fillRule: "evenodd", 11565 clipRule: "evenodd", 11566 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" 11567 }) 11568 }); 11569 /* harmony default export */ const drawer_left = (drawerLeft); 11570 11571 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 11572 /** 11573 * WordPress dependencies 11574 */ 11575 11576 11577 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11578 width: "24", 11579 height: "24", 11580 xmlns: "http://www.w3.org/2000/svg", 11581 viewBox: "0 0 24 24", 11582 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11583 fillRule: "evenodd", 11584 clipRule: "evenodd", 11585 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" 11586 }) 11587 }); 11588 /* harmony default export */ const drawer_right = (drawerRight); 11589 11590 ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js 11591 /** 11592 * WordPress dependencies 11593 */ 11594 11595 11596 const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11597 xmlns: "http://www.w3.org/2000/svg", 11598 viewBox: "0 0 24 24", 11599 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11600 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" 11601 }) 11602 }); 11603 /* harmony default export */ const block_default = (blockDefault); 11604 11605 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 11606 /** 11607 * WordPress dependencies 11608 */ 11609 11610 11611 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11612 xmlns: "http://www.w3.org/2000/svg", 11613 viewBox: "0 0 24 24", 11614 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11615 d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" 11616 }) 11617 }); 11618 /* harmony default export */ const format_list_bullets = (formatListBullets); 11619 11620 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 11621 /** 11622 * WordPress dependencies 11623 */ 11624 11625 11626 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11627 xmlns: "http://www.w3.org/2000/svg", 11628 viewBox: "0 0 24 24", 11629 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11630 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 11631 }) 11632 }); 11633 /* harmony default export */ const library_pencil = (pencil); 11634 11635 ;// ./node_modules/@wordpress/icons/build-module/library/edit.js 11636 /** 11637 * Internal dependencies 11638 */ 11639 11640 11641 /* harmony default export */ const library_edit = (library_pencil); 11642 11643 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 11644 /** 11645 * WordPress dependencies 11646 */ 11647 11648 11649 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11650 xmlns: "http://www.w3.org/2000/svg", 11651 viewBox: "0 0 24 24", 11652 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11653 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" 11654 }) 11655 }); 11656 /* harmony default export */ const library_symbol = (symbol); 11657 11658 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 11659 /** 11660 * WordPress dependencies 11661 */ 11662 11663 11664 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 11665 xmlns: "http://www.w3.org/2000/svg", 11666 viewBox: "0 0 24 24", 11667 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11668 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 11669 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11670 d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" 11671 })] 11672 }); 11673 /* harmony default export */ const library_page = (page); 11674 11675 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 11676 /** 11677 * WordPress dependencies 11678 */ 11679 11680 11681 const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11682 xmlns: "http://www.w3.org/2000/svg", 11683 viewBox: "0 0 24 24", 11684 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11685 d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" 11686 }) 11687 }); 11688 /* harmony default export */ const rotate_right = (rotateRight); 11689 11690 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 11691 /** 11692 * WordPress dependencies 11693 */ 11694 11695 11696 const rotateLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11697 xmlns: "http://www.w3.org/2000/svg", 11698 viewBox: "0 0 24 24", 11699 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11700 d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" 11701 }) 11702 }); 11703 /* harmony default export */ const rotate_left = (rotateLeft); 11704 11705 ;// external ["wp","commands"] 11706 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 11707 ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js 11708 /** 11709 * WordPress dependencies 11710 */ 11711 11712 11713 const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11714 xmlns: "http://www.w3.org/2000/svg", 11715 viewBox: "0 0 24 24", 11716 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11717 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" 11718 }) 11719 }); 11720 /* harmony default export */ const star_filled = (starFilled); 11721 11722 ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js 11723 /** 11724 * WordPress dependencies 11725 */ 11726 11727 11728 const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 11729 xmlns: "http://www.w3.org/2000/svg", 11730 viewBox: "0 0 24 24", 11731 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 11732 fillRule: "evenodd", 11733 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", 11734 clipRule: "evenodd" 11735 }) 11736 }); 11737 /* harmony default export */ const star_empty = (starEmpty); 11738 11739 ;// external ["wp","viewport"] 11740 const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 11741 ;// external ["wp","plugins"] 11742 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 11743 ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js 11744 /** 11745 * WordPress dependencies 11746 */ 11747 11748 function normalizeComplementaryAreaScope(scope) { 11749 if (['core/edit-post', 'core/edit-site'].includes(scope)) { 11750 external_wp_deprecated_default()(`$scope} interface scope`, { 11751 alternative: 'core interface scope', 11752 hint: 'core/edit-post and core/edit-site are merging.', 11753 version: '6.6' 11754 }); 11755 return 'core'; 11756 } 11757 return scope; 11758 } 11759 function normalizeComplementaryAreaName(scope, name) { 11760 if (scope === 'core' && name === 'edit-site/template') { 11761 external_wp_deprecated_default()(`edit-site/template sidebar`, { 11762 alternative: 'edit-post/document', 11763 version: '6.6' 11764 }); 11765 return 'edit-post/document'; 11766 } 11767 if (scope === 'core' && name === 'edit-site/block-inspector') { 11768 external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { 11769 alternative: 'edit-post/block', 11770 version: '6.6' 11771 }); 11772 return 'edit-post/block'; 11773 } 11774 return name; 11775 } 11776 11777 ;// ./node_modules/@wordpress/interface/build-module/store/actions.js 11778 /** 11779 * WordPress dependencies 11780 */ 11781 11782 11783 11784 /** 11785 * Internal dependencies 11786 */ 11787 11788 11789 /** 11790 * Set a default complementary area. 11791 * 11792 * @param {string} scope Complementary area scope. 11793 * @param {string} area Area identifier. 11794 * 11795 * @return {Object} Action object. 11796 */ 11797 const setDefaultComplementaryArea = (scope, area) => { 11798 scope = normalizeComplementaryAreaScope(scope); 11799 area = normalizeComplementaryAreaName(scope, area); 11800 return { 11801 type: 'SET_DEFAULT_COMPLEMENTARY_AREA', 11802 scope, 11803 area 11804 }; 11805 }; 11806 11807 /** 11808 * Enable the complementary area. 11809 * 11810 * @param {string} scope Complementary area scope. 11811 * @param {string} area Area identifier. 11812 */ 11813 const enableComplementaryArea = (scope, area) => ({ 11814 registry, 11815 dispatch 11816 }) => { 11817 // Return early if there's no area. 11818 if (!area) { 11819 return; 11820 } 11821 scope = normalizeComplementaryAreaScope(scope); 11822 area = normalizeComplementaryAreaName(scope, area); 11823 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 11824 if (!isComplementaryAreaVisible) { 11825 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); 11826 } 11827 dispatch({ 11828 type: 'ENABLE_COMPLEMENTARY_AREA', 11829 scope, 11830 area 11831 }); 11832 }; 11833 11834 /** 11835 * Disable the complementary area. 11836 * 11837 * @param {string} scope Complementary area scope. 11838 */ 11839 const disableComplementaryArea = scope => ({ 11840 registry 11841 }) => { 11842 scope = normalizeComplementaryAreaScope(scope); 11843 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 11844 if (isComplementaryAreaVisible) { 11845 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); 11846 } 11847 }; 11848 11849 /** 11850 * Pins an item. 11851 * 11852 * @param {string} scope Item scope. 11853 * @param {string} item Item identifier. 11854 * 11855 * @return {Object} Action object. 11856 */ 11857 const pinItem = (scope, item) => ({ 11858 registry 11859 }) => { 11860 // Return early if there's no item. 11861 if (!item) { 11862 return; 11863 } 11864 scope = normalizeComplementaryAreaScope(scope); 11865 item = normalizeComplementaryAreaName(scope, item); 11866 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 11867 11868 // The item is already pinned, there's nothing to do. 11869 if (pinnedItems?.[item] === true) { 11870 return; 11871 } 11872 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 11873 ...pinnedItems, 11874 [item]: true 11875 }); 11876 }; 11877 11878 /** 11879 * Unpins an item. 11880 * 11881 * @param {string} scope Item scope. 11882 * @param {string} item Item identifier. 11883 */ 11884 const unpinItem = (scope, item) => ({ 11885 registry 11886 }) => { 11887 // Return early if there's no item. 11888 if (!item) { 11889 return; 11890 } 11891 scope = normalizeComplementaryAreaScope(scope); 11892 item = normalizeComplementaryAreaName(scope, item); 11893 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 11894 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 11895 ...pinnedItems, 11896 [item]: false 11897 }); 11898 }; 11899 11900 /** 11901 * Returns an action object used in signalling that a feature should be toggled. 11902 * 11903 * @param {string} scope The feature scope (e.g. core/edit-post). 11904 * @param {string} featureName The feature name. 11905 */ 11906 function toggleFeature(scope, featureName) { 11907 return function ({ 11908 registry 11909 }) { 11910 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 11911 since: '6.0', 11912 alternative: `dispatch( 'core/preferences' ).toggle` 11913 }); 11914 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 11915 }; 11916 } 11917 11918 /** 11919 * Returns an action object used in signalling that a feature should be set to 11920 * a true or false value 11921 * 11922 * @param {string} scope The feature scope (e.g. core/edit-post). 11923 * @param {string} featureName The feature name. 11924 * @param {boolean} value The value to set. 11925 * 11926 * @return {Object} Action object. 11927 */ 11928 function setFeatureValue(scope, featureName, value) { 11929 return function ({ 11930 registry 11931 }) { 11932 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 11933 since: '6.0', 11934 alternative: `dispatch( 'core/preferences' ).set` 11935 }); 11936 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 11937 }; 11938 } 11939 11940 /** 11941 * Returns an action object used in signalling that defaults should be set for features. 11942 * 11943 * @param {string} scope The feature scope (e.g. core/edit-post). 11944 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 11945 * 11946 * @return {Object} Action object. 11947 */ 11948 function setFeatureDefaults(scope, defaults) { 11949 return function ({ 11950 registry 11951 }) { 11952 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 11953 since: '6.0', 11954 alternative: `dispatch( 'core/preferences' ).setDefaults` 11955 }); 11956 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 11957 }; 11958 } 11959 11960 /** 11961 * Returns an action object used in signalling that the user opened a modal. 11962 * 11963 * @param {string} name A string that uniquely identifies the modal. 11964 * 11965 * @return {Object} Action object. 11966 */ 11967 function openModal(name) { 11968 return { 11969 type: 'OPEN_MODAL', 11970 name 11971 }; 11972 } 11973 11974 /** 11975 * Returns an action object signalling that the user closed a modal. 11976 * 11977 * @return {Object} Action object. 11978 */ 11979 function closeModal() { 11980 return { 11981 type: 'CLOSE_MODAL' 11982 }; 11983 } 11984 11985 ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js 11986 /** 11987 * WordPress dependencies 11988 */ 11989 11990 11991 11992 11993 /** 11994 * Internal dependencies 11995 */ 11996 11997 11998 /** 11999 * Returns the complementary area that is active in a given scope. 12000 * 12001 * @param {Object} state Global application state. 12002 * @param {string} scope Item scope. 12003 * 12004 * @return {string | null | undefined} The complementary area that is active in the given scope. 12005 */ 12006 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 12007 scope = normalizeComplementaryAreaScope(scope); 12008 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 12009 12010 // Return `undefined` to indicate that the user has never toggled 12011 // visibility, this is the vanilla default. Other code relies on this 12012 // nuance in the return value. 12013 if (isComplementaryAreaVisible === undefined) { 12014 return undefined; 12015 } 12016 12017 // Return `null` to indicate the user hid the complementary area. 12018 if (isComplementaryAreaVisible === false) { 12019 return null; 12020 } 12021 return state?.complementaryAreas?.[scope]; 12022 }); 12023 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 12024 scope = normalizeComplementaryAreaScope(scope); 12025 const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 12026 const identifier = state?.complementaryAreas?.[scope]; 12027 return isVisible && identifier === undefined; 12028 }); 12029 12030 /** 12031 * Returns a boolean indicating if an item is pinned or not. 12032 * 12033 * @param {Object} state Global application state. 12034 * @param {string} scope Scope. 12035 * @param {string} item Item to check. 12036 * 12037 * @return {boolean} True if the item is pinned and false otherwise. 12038 */ 12039 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 12040 var _pinnedItems$item; 12041 scope = normalizeComplementaryAreaScope(scope); 12042 item = normalizeComplementaryAreaName(scope, item); 12043 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 12044 return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 12045 }); 12046 12047 /** 12048 * Returns a boolean indicating whether a feature is active for a particular 12049 * scope. 12050 * 12051 * @param {Object} state The store state. 12052 * @param {string} scope The scope of the feature (e.g. core/edit-post). 12053 * @param {string} featureName The name of the feature. 12054 * 12055 * @return {boolean} Is the feature enabled? 12056 */ 12057 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 12058 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 12059 since: '6.0', 12060 alternative: `select( 'core/preferences' ).get( scope, featureName )` 12061 }); 12062 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 12063 }); 12064 12065 /** 12066 * Returns true if a modal is active, or false otherwise. 12067 * 12068 * @param {Object} state Global application state. 12069 * @param {string} modalName A string that uniquely identifies the modal. 12070 * 12071 * @return {boolean} Whether the modal is active. 12072 */ 12073 function isModalActive(state, modalName) { 12074 return state.activeModal === modalName; 12075 } 12076 12077 ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js 12078 /** 12079 * WordPress dependencies 12080 */ 12081 12082 function complementaryAreas(state = {}, action) { 12083 switch (action.type) { 12084 case 'SET_DEFAULT_COMPLEMENTARY_AREA': 12085 { 12086 const { 12087 scope, 12088 area 12089 } = action; 12090 12091 // If there's already an area, don't overwrite it. 12092 if (state[scope]) { 12093 return state; 12094 } 12095 return { 12096 ...state, 12097 [scope]: area 12098 }; 12099 } 12100 case 'ENABLE_COMPLEMENTARY_AREA': 12101 { 12102 const { 12103 scope, 12104 area 12105 } = action; 12106 return { 12107 ...state, 12108 [scope]: area 12109 }; 12110 } 12111 } 12112 return state; 12113 } 12114 12115 /** 12116 * Reducer for storing the name of the open modal, or null if no modal is open. 12117 * 12118 * @param {Object} state Previous state. 12119 * @param {Object} action Action object containing the `name` of the modal 12120 * 12121 * @return {Object} Updated state 12122 */ 12123 function activeModal(state = null, action) { 12124 switch (action.type) { 12125 case 'OPEN_MODAL': 12126 return action.name; 12127 case 'CLOSE_MODAL': 12128 return null; 12129 } 12130 return state; 12131 } 12132 /* harmony default export */ const build_module_store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 12133 complementaryAreas, 12134 activeModal 12135 })); 12136 12137 ;// ./node_modules/@wordpress/interface/build-module/store/constants.js 12138 /** 12139 * The identifier for the data store. 12140 * 12141 * @type {string} 12142 */ 12143 const constants_STORE_NAME = 'core/interface'; 12144 12145 ;// ./node_modules/@wordpress/interface/build-module/store/index.js 12146 /** 12147 * WordPress dependencies 12148 */ 12149 12150 12151 /** 12152 * Internal dependencies 12153 */ 12154 12155 12156 12157 12158 12159 /** 12160 * Store definition for the interface namespace. 12161 * 12162 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 12163 * 12164 * @type {Object} 12165 */ 12166 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 12167 reducer: build_module_store_reducer, 12168 actions: store_actions_namespaceObject, 12169 selectors: store_selectors_namespaceObject 12170 }); 12171 12172 // Once we build a more generic persistence plugin that works across types of stores 12173 // we'd be able to replace this with a register call. 12174 (0,external_wp_data_namespaceObject.register)(store); 12175 12176 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 12177 /** 12178 * WordPress dependencies 12179 */ 12180 12181 12182 12183 12184 /** 12185 * Internal dependencies 12186 */ 12187 12188 12189 /** 12190 * Whether the role supports checked state. 12191 * 12192 * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked 12193 * @param {import('react').AriaRole} role Role. 12194 * @return {boolean} Whether the role supports checked state. 12195 */ 12196 12197 function roleSupportsCheckedState(role) { 12198 return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role); 12199 } 12200 function ComplementaryAreaToggle({ 12201 as = external_wp_components_namespaceObject.Button, 12202 scope, 12203 identifier: identifierProp, 12204 icon: iconProp, 12205 selectedIcon, 12206 name, 12207 shortcut, 12208 ...props 12209 }) { 12210 const ComponentToUse = as; 12211 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 12212 const icon = iconProp || context.icon; 12213 const identifier = identifierProp || `$context.name}/$name}`; 12214 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); 12215 const { 12216 enableComplementaryArea, 12217 disableComplementaryArea 12218 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 12219 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { 12220 icon: selectedIcon && isSelected ? selectedIcon : icon, 12221 "aria-controls": identifier.replace('/', ':') 12222 // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked 12223 , 12224 "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined, 12225 onClick: () => { 12226 if (isSelected) { 12227 disableComplementaryArea(scope); 12228 } else { 12229 enableComplementaryArea(scope, identifier); 12230 } 12231 }, 12232 shortcut: shortcut, 12233 ...props 12234 }); 12235 } 12236 12237 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 12238 /** 12239 * External dependencies 12240 */ 12241 12242 12243 /** 12244 * WordPress dependencies 12245 */ 12246 12247 12248 /** 12249 * Internal dependencies 12250 */ 12251 12252 12253 const ComplementaryAreaHeader = ({ 12254 children, 12255 className, 12256 toggleButtonProps 12257 }) => { 12258 const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { 12259 icon: close_small, 12260 ...toggleButtonProps 12261 }); 12262 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12263 className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className), 12264 tabIndex: -1, 12265 children: [children, toggleButton] 12266 }); 12267 }; 12268 /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); 12269 12270 ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 12271 /* wp:polyfill */ 12272 /** 12273 * WordPress dependencies 12274 */ 12275 12276 12277 12278 const action_item_noop = () => {}; 12279 function ActionItemSlot({ 12280 name, 12281 as: Component = external_wp_components_namespaceObject.MenuGroup, 12282 fillProps = {}, 12283 bubblesVirtually, 12284 ...props 12285 }) { 12286 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 12287 name: name, 12288 bubblesVirtually: bubblesVirtually, 12289 fillProps: fillProps, 12290 children: fills => { 12291 if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { 12292 return null; 12293 } 12294 12295 // Special handling exists for backward compatibility. 12296 // It ensures that menu items created by plugin authors aren't 12297 // duplicated with automatically injected menu items coming 12298 // from pinnable plugin sidebars. 12299 // @see https://github.com/WordPress/gutenberg/issues/14457 12300 const initializedByPlugins = []; 12301 external_wp_element_namespaceObject.Children.forEach(fills, ({ 12302 props: { 12303 __unstableExplicitMenuItem, 12304 __unstableTarget 12305 } 12306 }) => { 12307 if (__unstableTarget && __unstableExplicitMenuItem) { 12308 initializedByPlugins.push(__unstableTarget); 12309 } 12310 }); 12311 const children = external_wp_element_namespaceObject.Children.map(fills, child => { 12312 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { 12313 return null; 12314 } 12315 return child; 12316 }); 12317 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 12318 ...props, 12319 children: children 12320 }); 12321 } 12322 }); 12323 } 12324 function ActionItem({ 12325 name, 12326 as: Component = external_wp_components_namespaceObject.Button, 12327 onClick, 12328 ...props 12329 }) { 12330 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 12331 name: name, 12332 children: ({ 12333 onClick: fpOnClick 12334 }) => { 12335 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 12336 onClick: onClick || fpOnClick ? (...args) => { 12337 (onClick || action_item_noop)(...args); 12338 (fpOnClick || action_item_noop)(...args); 12339 } : undefined, 12340 ...props 12341 }); 12342 } 12343 }); 12344 } 12345 ActionItem.Slot = ActionItemSlot; 12346 /* harmony default export */ const action_item = (ActionItem); 12347 12348 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 12349 /** 12350 * WordPress dependencies 12351 */ 12352 12353 12354 12355 /** 12356 * Internal dependencies 12357 */ 12358 12359 12360 12361 const PluginsMenuItem = ({ 12362 // Menu item is marked with unstable prop for backward compatibility. 12363 // They are removed so they don't leak to DOM elements. 12364 // @see https://github.com/WordPress/gutenberg/issues/14457 12365 __unstableExplicitMenuItem, 12366 __unstableTarget, 12367 ...restProps 12368 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 12369 ...restProps 12370 }); 12371 function ComplementaryAreaMoreMenuItem({ 12372 scope, 12373 target, 12374 __unstableExplicitMenuItem, 12375 ...props 12376 }) { 12377 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { 12378 as: toggleProps => { 12379 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { 12380 __unstableExplicitMenuItem: __unstableExplicitMenuItem, 12381 __unstableTarget: `$scope}/$target}`, 12382 as: PluginsMenuItem, 12383 name: `$scope}/plugin-more-menu`, 12384 ...toggleProps 12385 }); 12386 }, 12387 role: "menuitemcheckbox", 12388 selectedIcon: library_check, 12389 name: target, 12390 scope: scope, 12391 ...props 12392 }); 12393 } 12394 12395 ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 12396 /** 12397 * External dependencies 12398 */ 12399 12400 12401 /** 12402 * WordPress dependencies 12403 */ 12404 12405 12406 function PinnedItems({ 12407 scope, 12408 ...props 12409 }) { 12410 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 12411 name: `PinnedItems/$scope}`, 12412 ...props 12413 }); 12414 } 12415 function PinnedItemsSlot({ 12416 scope, 12417 className, 12418 ...props 12419 }) { 12420 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 12421 name: `PinnedItems/$scope}`, 12422 ...props, 12423 children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12424 className: dist_clsx(className, 'interface-pinned-items'), 12425 children: fills 12426 }) 12427 }); 12428 } 12429 PinnedItems.Slot = PinnedItemsSlot; 12430 /* harmony default export */ const pinned_items = (PinnedItems); 12431 12432 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 12433 /** 12434 * External dependencies 12435 */ 12436 12437 12438 /** 12439 * WordPress dependencies 12440 */ 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 /** 12452 * Internal dependencies 12453 */ 12454 12455 12456 12457 12458 12459 12460 const ANIMATION_DURATION = 0.3; 12461 function ComplementaryAreaSlot({ 12462 scope, 12463 ...props 12464 }) { 12465 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 12466 name: `ComplementaryArea/$scope}`, 12467 ...props 12468 }); 12469 } 12470 const SIDEBAR_WIDTH = 280; 12471 const variants = { 12472 open: { 12473 width: SIDEBAR_WIDTH 12474 }, 12475 closed: { 12476 width: 0 12477 }, 12478 mobileOpen: { 12479 width: '100vw' 12480 } 12481 }; 12482 function ComplementaryAreaFill({ 12483 activeArea, 12484 isActive, 12485 scope, 12486 children, 12487 className, 12488 id 12489 }) { 12490 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 12491 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 12492 // This is used to delay the exit animation to the next tick. 12493 // The reason this is done is to allow us to apply the right transition properties 12494 // When we switch from an open sidebar to another open sidebar. 12495 // we don't want to animate in this case. 12496 const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); 12497 const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); 12498 const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); 12499 (0,external_wp_element_namespaceObject.useEffect)(() => { 12500 setState({}); 12501 }, [isActive]); 12502 const transition = { 12503 type: 'tween', 12504 duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, 12505 ease: [0.6, 0, 0.4, 1] 12506 }; 12507 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 12508 name: `ComplementaryArea/$scope}`, 12509 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 12510 initial: false, 12511 children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 12512 variants: variants, 12513 initial: "closed", 12514 animate: isMobileViewport ? 'mobileOpen' : 'open', 12515 exit: "closed", 12516 transition: transition, 12517 className: "interface-complementary-area__fill", 12518 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12519 id: id, 12520 className: className, 12521 style: { 12522 width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH 12523 }, 12524 children: children 12525 }) 12526 }) 12527 }) 12528 }); 12529 } 12530 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 12531 const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 12532 const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 12533 const { 12534 enableComplementaryArea, 12535 disableComplementaryArea 12536 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 12537 (0,external_wp_element_namespaceObject.useEffect)(() => { 12538 // If the complementary area is active and the editor is switching from 12539 // a big to a small window size. 12540 if (isActive && isSmall && !previousIsSmallRef.current) { 12541 disableComplementaryArea(scope); 12542 // Flag the complementary area to be reopened when the window size 12543 // goes from small to big. 12544 shouldOpenWhenNotSmallRef.current = true; 12545 } else if ( 12546 // If there is a flag indicating the complementary area should be 12547 // enabled when we go from small to big window size and we are going 12548 // from a small to big window size. 12549 shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) { 12550 // Remove the flag indicating the complementary area should be 12551 // enabled. 12552 shouldOpenWhenNotSmallRef.current = false; 12553 enableComplementaryArea(scope, identifier); 12554 } else if ( 12555 // If the flag is indicating the current complementary should be 12556 // reopened but another complementary area becomes active, remove 12557 // the flag. 12558 shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) { 12559 shouldOpenWhenNotSmallRef.current = false; 12560 } 12561 if (isSmall !== previousIsSmallRef.current) { 12562 previousIsSmallRef.current = isSmall; 12563 } 12564 }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); 12565 } 12566 function ComplementaryArea({ 12567 children, 12568 className, 12569 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), 12570 identifier: identifierProp, 12571 header, 12572 headerClassName, 12573 icon: iconProp, 12574 isPinnable = true, 12575 panelClassName, 12576 scope, 12577 name, 12578 title, 12579 toggleShortcut, 12580 isActiveByDefault 12581 }) { 12582 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 12583 const icon = iconProp || context.icon; 12584 const identifier = identifierProp || `$context.name}/$name}`; 12585 12586 // This state is used to delay the rendering of the Fill 12587 // until the initial effect runs. 12588 // This prevents the animation from running on mount if 12589 // the complementary area is active by default. 12590 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); 12591 const { 12592 isLoading, 12593 isActive, 12594 isPinned, 12595 activeArea, 12596 isSmall, 12597 isLarge, 12598 showIconLabels 12599 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12600 const { 12601 getActiveComplementaryArea, 12602 isComplementaryAreaLoading, 12603 isItemPinned 12604 } = select(store); 12605 const { 12606 get 12607 } = select(external_wp_preferences_namespaceObject.store); 12608 const _activeArea = getActiveComplementaryArea(scope); 12609 return { 12610 isLoading: isComplementaryAreaLoading(scope), 12611 isActive: _activeArea === identifier, 12612 isPinned: isItemPinned(scope, identifier), 12613 activeArea: _activeArea, 12614 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), 12615 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), 12616 showIconLabels: get('core', 'showIconLabels') 12617 }; 12618 }, [identifier, scope]); 12619 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 12620 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); 12621 const { 12622 enableComplementaryArea, 12623 disableComplementaryArea, 12624 pinItem, 12625 unpinItem 12626 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 12627 (0,external_wp_element_namespaceObject.useEffect)(() => { 12628 // Set initial visibility: For large screens, enable if it's active by 12629 // default. For small screens, always initially disable. 12630 if (isActiveByDefault && activeArea === undefined && !isSmall) { 12631 enableComplementaryArea(scope, identifier); 12632 } else if (activeArea === undefined && isSmall) { 12633 disableComplementaryArea(scope, identifier); 12634 } 12635 setIsReady(true); 12636 }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); 12637 if (!isReady) { 12638 return; 12639 } 12640 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12641 children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, { 12642 scope: scope, 12643 children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { 12644 scope: scope, 12645 identifier: identifier, 12646 isPressed: isActive && (!showIconLabels || isLarge), 12647 "aria-expanded": isActive, 12648 "aria-disabled": isLoading, 12649 label: title, 12650 icon: showIconLabels ? library_check : icon, 12651 showTooltip: !showIconLabels, 12652 variant: showIconLabels ? 'tertiary' : undefined, 12653 size: "compact", 12654 shortcut: toggleShortcut 12655 }) 12656 }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 12657 target: name, 12658 scope: scope, 12659 icon: icon, 12660 children: title 12661 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, { 12662 activeArea: activeArea, 12663 isActive: isActive, 12664 className: dist_clsx('interface-complementary-area', className), 12665 scope: scope, 12666 id: identifier.replace('/', ':'), 12667 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, { 12668 className: headerClassName, 12669 closeLabel: closeLabel, 12670 onClose: () => disableComplementaryArea(scope), 12671 toggleButtonProps: { 12672 label: closeLabel, 12673 size: 'compact', 12674 shortcut: toggleShortcut, 12675 scope, 12676 identifier 12677 }, 12678 children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 12679 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 12680 className: "interface-complementary-area-header__title", 12681 children: title 12682 }), isPinnable && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 12683 className: "interface-complementary-area__pin-unpin-item", 12684 icon: isPinned ? star_filled : star_empty, 12685 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), 12686 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), 12687 isPressed: isPinned, 12688 "aria-expanded": isPinned, 12689 size: "compact" 12690 })] 12691 }) 12692 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { 12693 className: panelClassName, 12694 children: children 12695 })] 12696 })] 12697 }); 12698 } 12699 ComplementaryArea.Slot = ComplementaryAreaSlot; 12700 /* harmony default export */ const complementary_area = (ComplementaryArea); 12701 12702 ;// ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js 12703 /** 12704 * WordPress dependencies 12705 */ 12706 12707 const FullscreenMode = ({ 12708 isActive 12709 }) => { 12710 (0,external_wp_element_namespaceObject.useEffect)(() => { 12711 let isSticky = false; 12712 // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes 12713 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled 12714 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as 12715 // a consequence of the FullscreenMode setup. 12716 if (document.body.classList.contains('sticky-menu')) { 12717 isSticky = true; 12718 document.body.classList.remove('sticky-menu'); 12719 } 12720 return () => { 12721 if (isSticky) { 12722 document.body.classList.add('sticky-menu'); 12723 } 12724 }; 12725 }, []); 12726 (0,external_wp_element_namespaceObject.useEffect)(() => { 12727 if (isActive) { 12728 document.body.classList.add('is-fullscreen-mode'); 12729 } else { 12730 document.body.classList.remove('is-fullscreen-mode'); 12731 } 12732 return () => { 12733 if (isActive) { 12734 document.body.classList.remove('is-fullscreen-mode'); 12735 } 12736 }; 12737 }, [isActive]); 12738 return null; 12739 }; 12740 /* harmony default export */ const fullscreen_mode = (FullscreenMode); 12741 12742 ;// ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js 12743 /** 12744 * WordPress dependencies 12745 */ 12746 12747 12748 /** 12749 * External dependencies 12750 */ 12751 12752 12753 const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)(({ 12754 children, 12755 className, 12756 ariaLabel, 12757 as: Tag = 'div', 12758 ...props 12759 }, ref) => { 12760 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { 12761 ref: ref, 12762 className: dist_clsx('interface-navigable-region', className), 12763 "aria-label": ariaLabel, 12764 role: "region", 12765 tabIndex: "-1", 12766 ...props, 12767 children: children 12768 }); 12769 }); 12770 NavigableRegion.displayName = 'NavigableRegion'; 12771 /* harmony default export */ const navigable_region = (NavigableRegion); 12772 12773 ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 12774 /** 12775 * External dependencies 12776 */ 12777 12778 12779 /** 12780 * WordPress dependencies 12781 */ 12782 12783 12784 12785 12786 12787 /** 12788 * Internal dependencies 12789 */ 12790 12791 12792 const interface_skeleton_ANIMATION_DURATION = 0.25; 12793 const commonTransition = { 12794 type: 'tween', 12795 duration: interface_skeleton_ANIMATION_DURATION, 12796 ease: [0.6, 0, 0.4, 1] 12797 }; 12798 function useHTMLClass(className) { 12799 (0,external_wp_element_namespaceObject.useEffect)(() => { 12800 const element = document && document.querySelector(`html:not(.$className})`); 12801 if (!element) { 12802 return; 12803 } 12804 element.classList.toggle(className); 12805 return () => { 12806 element.classList.toggle(className); 12807 }; 12808 }, [className]); 12809 } 12810 const headerVariants = { 12811 hidden: { 12812 opacity: 1, 12813 marginTop: -60 12814 }, 12815 visible: { 12816 opacity: 1, 12817 marginTop: 0 12818 }, 12819 distractionFreeHover: { 12820 opacity: 1, 12821 marginTop: 0, 12822 transition: { 12823 ...commonTransition, 12824 delay: 0.2, 12825 delayChildren: 0.2 12826 } 12827 }, 12828 distractionFreeHidden: { 12829 opacity: 0, 12830 marginTop: -60 12831 }, 12832 distractionFreeDisabled: { 12833 opacity: 0, 12834 marginTop: 0, 12835 transition: { 12836 ...commonTransition, 12837 delay: 0.8, 12838 delayChildren: 0.8 12839 } 12840 } 12841 }; 12842 function InterfaceSkeleton({ 12843 isDistractionFree, 12844 footer, 12845 header, 12846 editorNotices, 12847 sidebar, 12848 secondarySidebar, 12849 content, 12850 actions, 12851 labels, 12852 className 12853 }, ref) { 12854 const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 12855 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 12856 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 12857 const defaultTransition = { 12858 type: 'tween', 12859 duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, 12860 ease: [0.6, 0, 0.4, 1] 12861 }; 12862 useHTMLClass('interface-interface-skeleton__html-container'); 12863 const defaultLabels = { 12864 /* translators: accessibility text for the top bar landmark region. */ 12865 header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), 12866 /* translators: accessibility text for the content landmark region. */ 12867 body: (0,external_wp_i18n_namespaceObject.__)('Content'), 12868 /* translators: accessibility text for the secondary sidebar landmark region. */ 12869 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), 12870 /* translators: accessibility text for the settings landmark region. */ 12871 sidebar: (0,external_wp_i18n_namespaceObject._x)('Settings', 'settings landmark area'), 12872 /* translators: accessibility text for the publish landmark region. */ 12873 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), 12874 /* translators: accessibility text for the footer landmark region. */ 12875 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') 12876 }; 12877 const mergedLabels = { 12878 ...defaultLabels, 12879 ...labels 12880 }; 12881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12882 ref: ref, 12883 className: dist_clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'), 12884 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12885 className: "interface-interface-skeleton__editor", 12886 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 12887 initial: false, 12888 children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12889 as: external_wp_components_namespaceObject.__unstableMotion.div, 12890 className: "interface-interface-skeleton__header", 12891 "aria-label": mergedLabels.header, 12892 initial: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', 12893 whileHover: isDistractionFree && !isMobileViewport ? 'distractionFreeHover' : 'visible', 12894 animate: isDistractionFree && !isMobileViewport ? 'distractionFreeDisabled' : 'visible', 12895 exit: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', 12896 variants: headerVariants, 12897 transition: defaultTransition, 12898 children: header 12899 }) 12900 }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12901 className: "interface-interface-skeleton__header", 12902 children: editorNotices 12903 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12904 className: "interface-interface-skeleton__body", 12905 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 12906 initial: false, 12907 children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12908 className: "interface-interface-skeleton__secondary-sidebar", 12909 ariaLabel: mergedLabels.secondarySidebar, 12910 as: external_wp_components_namespaceObject.__unstableMotion.div, 12911 initial: "closed", 12912 animate: "open", 12913 exit: "closed", 12914 variants: { 12915 open: { 12916 width: secondarySidebarSize.width 12917 }, 12918 closed: { 12919 width: 0 12920 } 12921 }, 12922 transition: defaultTransition, 12923 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 12924 style: { 12925 position: 'absolute', 12926 width: isMobileViewport ? '100vw' : 'fit-content', 12927 height: '100%', 12928 left: 0 12929 }, 12930 variants: { 12931 open: { 12932 x: 0 12933 }, 12934 closed: { 12935 x: '-100%' 12936 } 12937 }, 12938 transition: defaultTransition, 12939 children: [secondarySidebarResizeListener, secondarySidebar] 12940 }) 12941 }) 12942 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12943 className: "interface-interface-skeleton__content", 12944 ariaLabel: mergedLabels.body, 12945 children: content 12946 }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12947 className: "interface-interface-skeleton__sidebar", 12948 ariaLabel: mergedLabels.sidebar, 12949 children: sidebar 12950 }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12951 className: "interface-interface-skeleton__actions", 12952 ariaLabel: mergedLabels.actions, 12953 children: actions 12954 })] 12955 })] 12956 }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 12957 className: "interface-interface-skeleton__footer", 12958 ariaLabel: mergedLabels.footer, 12959 children: footer 12960 })] 12961 }); 12962 } 12963 /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); 12964 12965 ;// ./node_modules/@wordpress/interface/build-module/components/index.js 12966 12967 12968 12969 12970 12971 12972 12973 12974 ;// ./node_modules/@wordpress/interface/build-module/index.js 12975 12976 12977 12978 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js 12979 /** 12980 * WordPress dependencies 12981 */ 12982 12983 12984 12985 12986 12987 /** 12988 * Internal dependencies 12989 */ 12990 12991 12992 12993 12994 const { 12995 RenamePatternModal 12996 } = unlock(external_wp_patterns_namespaceObject.privateApis); 12997 const modalName = 'editor/pattern-rename'; 12998 function PatternRenameModal() { 12999 const { 13000 record, 13001 postType 13002 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13003 const { 13004 getCurrentPostType, 13005 getCurrentPostId 13006 } = select(store_store); 13007 const { 13008 getEditedEntityRecord 13009 } = select(external_wp_coreData_namespaceObject.store); 13010 const _postType = getCurrentPostType(); 13011 return { 13012 record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), 13013 postType: _postType 13014 }; 13015 }, []); 13016 const { 13017 closeModal 13018 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 13019 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(modalName)); 13020 if (!isActive || postType !== PATTERN_POST_TYPE) { 13021 return null; 13022 } 13023 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, { 13024 onClose: closeModal, 13025 pattern: record 13026 }); 13027 } 13028 13029 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js 13030 /** 13031 * WordPress dependencies 13032 */ 13033 13034 13035 13036 13037 13038 /** 13039 * Internal dependencies 13040 */ 13041 13042 13043 13044 13045 const { 13046 DuplicatePatternModal 13047 } = unlock(external_wp_patterns_namespaceObject.privateApis); 13048 const pattern_duplicate_modal_modalName = 'editor/pattern-duplicate'; 13049 function PatternDuplicateModal() { 13050 const { 13051 record, 13052 postType 13053 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13054 const { 13055 getCurrentPostType, 13056 getCurrentPostId 13057 } = select(store_store); 13058 const { 13059 getEditedEntityRecord 13060 } = select(external_wp_coreData_namespaceObject.store); 13061 const _postType = getCurrentPostType(); 13062 return { 13063 record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), 13064 postType: _postType 13065 }; 13066 }, []); 13067 const { 13068 closeModal 13069 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 13070 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(pattern_duplicate_modal_modalName)); 13071 if (!isActive || postType !== PATTERN_POST_TYPE) { 13072 return null; 13073 } 13074 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DuplicatePatternModal, { 13075 onClose: closeModal, 13076 onSuccess: () => closeModal(), 13077 pattern: record 13078 }); 13079 } 13080 13081 ;// ./node_modules/@wordpress/editor/build-module/components/commands/index.js 13082 /** 13083 * WordPress dependencies 13084 */ 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 /** 13098 * Internal dependencies 13099 */ 13100 13101 13102 13103 13104 13105 13106 const getEditorCommandLoader = () => function useEditorCommandLoader() { 13107 const { 13108 editorMode, 13109 isListViewOpen, 13110 showBlockBreadcrumbs, 13111 isDistractionFree, 13112 isFocusMode, 13113 isPreviewMode, 13114 isViewable, 13115 isCodeEditingEnabled, 13116 isRichEditingEnabled, 13117 isPublishSidebarEnabled 13118 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13119 var _get, _getPostType$viewable; 13120 const { 13121 get 13122 } = select(external_wp_preferences_namespaceObject.store); 13123 const { 13124 isListViewOpened, 13125 getCurrentPostType, 13126 getEditorSettings 13127 } = select(store_store); 13128 const { 13129 getSettings 13130 } = select(external_wp_blockEditor_namespaceObject.store); 13131 const { 13132 getPostType 13133 } = select(external_wp_coreData_namespaceObject.store); 13134 return { 13135 editorMode: (_get = get('core', 'editorMode')) !== null && _get !== void 0 ? _get : 'visual', 13136 isListViewOpen: isListViewOpened(), 13137 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 13138 isDistractionFree: get('core', 'distractionFree'), 13139 isFocusMode: get('core', 'focusMode'), 13140 isPreviewMode: getSettings().isPreviewMode, 13141 isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, 13142 isCodeEditingEnabled: getEditorSettings().codeEditingEnabled, 13143 isRichEditingEnabled: getEditorSettings().richEditingEnabled, 13144 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled() 13145 }; 13146 }, []); 13147 const { 13148 getActiveComplementaryArea 13149 } = (0,external_wp_data_namespaceObject.useSelect)(store); 13150 const { 13151 toggle 13152 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 13153 const { 13154 createInfoNotice 13155 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 13156 const { 13157 __unstableSaveForPreview, 13158 setIsListViewOpened, 13159 switchEditorMode, 13160 toggleDistractionFree, 13161 toggleSpotlightMode, 13162 toggleTopToolbar 13163 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13164 const { 13165 openModal, 13166 enableComplementaryArea, 13167 disableComplementaryArea 13168 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 13169 const { 13170 getCurrentPostId 13171 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 13172 const { 13173 isBlockBasedTheme, 13174 canCreateTemplate 13175 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13176 return { 13177 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 13178 canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { 13179 kind: 'postType', 13180 name: 'wp_template' 13181 }) 13182 }; 13183 }, []); 13184 const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled; 13185 if (isPreviewMode) { 13186 return { 13187 commands: [], 13188 isLoading: false 13189 }; 13190 } 13191 const commands = []; 13192 commands.push({ 13193 name: 'core/open-shortcut-help', 13194 label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 13195 icon: library_keyboard, 13196 callback: ({ 13197 close 13198 }) => { 13199 close(); 13200 openModal('editor/keyboard-shortcut-help'); 13201 } 13202 }); 13203 commands.push({ 13204 name: 'core/toggle-distraction-free', 13205 label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction free'), 13206 callback: ({ 13207 close 13208 }) => { 13209 toggleDistractionFree(); 13210 close(); 13211 } 13212 }); 13213 commands.push({ 13214 name: 'core/open-preferences', 13215 label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), 13216 callback: ({ 13217 close 13218 }) => { 13219 close(); 13220 openModal('editor/preferences'); 13221 } 13222 }); 13223 commands.push({ 13224 name: 'core/toggle-spotlight-mode', 13225 label: isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Exit Spotlight mode') : (0,external_wp_i18n_namespaceObject.__)('Enter Spotlight mode'), 13226 callback: ({ 13227 close 13228 }) => { 13229 toggleSpotlightMode(); 13230 close(); 13231 } 13232 }); 13233 commands.push({ 13234 name: 'core/toggle-list-view', 13235 label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'), 13236 icon: list_view, 13237 callback: ({ 13238 close 13239 }) => { 13240 setIsListViewOpened(!isListViewOpen); 13241 close(); 13242 createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), { 13243 id: 'core/editor/toggle-list-view/notice', 13244 type: 'snackbar' 13245 }); 13246 } 13247 }); 13248 commands.push({ 13249 name: 'core/toggle-top-toolbar', 13250 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 13251 callback: ({ 13252 close 13253 }) => { 13254 toggleTopToolbar(); 13255 close(); 13256 } 13257 }); 13258 if (allowSwitchEditorMode) { 13259 commands.push({ 13260 name: 'core/toggle-code-editor', 13261 label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'), 13262 icon: library_code, 13263 callback: ({ 13264 close 13265 }) => { 13266 switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); 13267 close(); 13268 } 13269 }); 13270 } 13271 commands.push({ 13272 name: 'core/toggle-breadcrumbs', 13273 label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), 13274 callback: ({ 13275 close 13276 }) => { 13277 toggle('core', 'showBlockBreadcrumbs'); 13278 close(); 13279 createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { 13280 id: 'core/editor/toggle-breadcrumbs/notice', 13281 type: 'snackbar' 13282 }); 13283 } 13284 }); 13285 commands.push({ 13286 name: 'core/open-settings-sidebar', 13287 label: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings panel.'), 13288 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 13289 callback: ({ 13290 close 13291 }) => { 13292 const activeSidebar = getActiveComplementaryArea('core'); 13293 close(); 13294 if (activeSidebar === 'edit-post/document') { 13295 disableComplementaryArea('core'); 13296 } else { 13297 enableComplementaryArea('core', 'edit-post/document'); 13298 } 13299 } 13300 }); 13301 commands.push({ 13302 name: 'core/open-block-inspector', 13303 label: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Block settings panel'), 13304 icon: block_default, 13305 callback: ({ 13306 close 13307 }) => { 13308 const activeSidebar = getActiveComplementaryArea('core'); 13309 close(); 13310 if (activeSidebar === 'edit-post/block') { 13311 disableComplementaryArea('core'); 13312 } else { 13313 enableComplementaryArea('core', 'edit-post/block'); 13314 } 13315 } 13316 }); 13317 commands.push({ 13318 name: 'core/toggle-publish-sidebar', 13319 label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'), 13320 icon: format_list_bullets, 13321 callback: ({ 13322 close 13323 }) => { 13324 close(); 13325 toggle('core', 'isPublishSidebarEnabled'); 13326 createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), { 13327 id: 'core/editor/publish-sidebar/notice', 13328 type: 'snackbar' 13329 }); 13330 } 13331 }); 13332 if (isViewable) { 13333 commands.push({ 13334 name: 'core/preview-link', 13335 label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), 13336 icon: library_external, 13337 callback: async ({ 13338 close 13339 }) => { 13340 close(); 13341 const postId = getCurrentPostId(); 13342 const link = await __unstableSaveForPreview(); 13343 window.open(link, `wp-preview-$postId}`); 13344 } 13345 }); 13346 } 13347 if (canCreateTemplate && isBlockBasedTheme) { 13348 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 13349 if (!isSiteEditor) { 13350 commands.push({ 13351 name: 'core/go-to-site-editor', 13352 label: (0,external_wp_i18n_namespaceObject.__)('Open Site Editor'), 13353 callback: ({ 13354 close 13355 }) => { 13356 close(); 13357 document.location = 'site-editor.php'; 13358 } 13359 }); 13360 } 13361 } 13362 return { 13363 commands, 13364 isLoading: false 13365 }; 13366 }; 13367 const getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() { 13368 const { 13369 postType 13370 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13371 const { 13372 getCurrentPostType 13373 } = select(store_store); 13374 return { 13375 postType: getCurrentPostType() 13376 }; 13377 }, []); 13378 const { 13379 openModal 13380 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 13381 const commands = []; 13382 if (postType === PATTERN_POST_TYPE) { 13383 commands.push({ 13384 name: 'core/rename-pattern', 13385 label: (0,external_wp_i18n_namespaceObject.__)('Rename pattern'), 13386 icon: library_edit, 13387 callback: ({ 13388 close 13389 }) => { 13390 openModal(modalName); 13391 close(); 13392 } 13393 }); 13394 commands.push({ 13395 name: 'core/duplicate-pattern', 13396 label: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'), 13397 icon: library_symbol, 13398 callback: ({ 13399 close 13400 }) => { 13401 openModal(pattern_duplicate_modal_modalName); 13402 close(); 13403 } 13404 }); 13405 } 13406 return { 13407 isLoading: false, 13408 commands 13409 }; 13410 }; 13411 const getPageContentFocusCommands = () => function usePageContentFocusCommands() { 13412 const { 13413 onNavigateToEntityRecord, 13414 goBack, 13415 templateId, 13416 isPreviewMode 13417 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13418 const { 13419 getRenderingMode, 13420 getEditorSettings: _getEditorSettings, 13421 getCurrentTemplateId 13422 } = unlock(select(store_store)); 13423 const editorSettings = _getEditorSettings(); 13424 return { 13425 isTemplateHidden: getRenderingMode() === 'post-only', 13426 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 13427 getEditorSettings: _getEditorSettings, 13428 goBack: editorSettings.onNavigateToPreviousEntityRecord, 13429 templateId: getCurrentTemplateId(), 13430 isPreviewMode: editorSettings.isPreviewMode 13431 }; 13432 }, []); 13433 const { 13434 editedRecord: template, 13435 hasResolved 13436 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', templateId); 13437 if (isPreviewMode) { 13438 return { 13439 isLoading: false, 13440 commands: [] 13441 }; 13442 } 13443 const commands = []; 13444 if (templateId && hasResolved) { 13445 commands.push({ 13446 name: 'core/switch-to-template-focus', 13447 label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template title */ 13448 (0,external_wp_i18n_namespaceObject.__)('Edit template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)), 13449 icon: library_layout, 13450 callback: ({ 13451 close 13452 }) => { 13453 onNavigateToEntityRecord({ 13454 postId: templateId, 13455 postType: 'wp_template' 13456 }); 13457 close(); 13458 } 13459 }); 13460 } 13461 if (!!goBack) { 13462 commands.push({ 13463 name: 'core/switch-to-previous-entity', 13464 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 13465 icon: library_page, 13466 callback: ({ 13467 close 13468 }) => { 13469 goBack(); 13470 close(); 13471 } 13472 }); 13473 } 13474 return { 13475 isLoading: false, 13476 commands 13477 }; 13478 }; 13479 const getManipulateDocumentCommands = () => function useManipulateDocumentCommands() { 13480 const { 13481 postType, 13482 postId 13483 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13484 const { 13485 getCurrentPostId, 13486 getCurrentPostType 13487 } = select(store_store); 13488 return { 13489 postType: getCurrentPostType(), 13490 postId: getCurrentPostId() 13491 }; 13492 }, []); 13493 const { 13494 editedRecord: template, 13495 hasResolved 13496 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', postType, postId); 13497 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 13498 const { 13499 revertTemplate 13500 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 13501 if (!hasResolved || ![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { 13502 return { 13503 isLoading: true, 13504 commands: [] 13505 }; 13506 } 13507 const commands = []; 13508 if (isTemplateRevertable(template)) { 13509 const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template title */ 13510 (0,external_wp_i18n_namespaceObject.__)('Reset template: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: template part title */ 13511 (0,external_wp_i18n_namespaceObject.__)('Reset template part: %s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title)); 13512 commands.push({ 13513 name: 'core/reset-template', 13514 label, 13515 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right : rotate_left, 13516 callback: ({ 13517 close 13518 }) => { 13519 revertTemplate(template); 13520 close(); 13521 } 13522 }); 13523 } 13524 return { 13525 isLoading: !hasResolved, 13526 commands 13527 }; 13528 }; 13529 function useCommands() { 13530 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 13531 name: 'core/editor/edit-ui', 13532 hook: getEditorCommandLoader() 13533 }); 13534 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 13535 name: 'core/editor/contextual-commands', 13536 hook: getEditedEntityContextualCommands(), 13537 context: 'entity-edit' 13538 }); 13539 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 13540 name: 'core/editor/page-content-focus', 13541 hook: getPageContentFocusCommands(), 13542 context: 'entity-edit' 13543 }); 13544 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 13545 name: 'core/edit-site/manipulate-document', 13546 hook: getManipulateDocumentCommands() 13547 }); 13548 } 13549 13550 ;// ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js 13551 /* wp:polyfill */ 13552 /** 13553 * WordPress dependencies 13554 */ 13555 13556 13557 13558 13559 13560 13561 /** 13562 * Internal dependencies 13563 */ 13564 13565 13566 13567 const { 13568 BlockRemovalWarningModal 13569 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 13570 13571 // Prevent accidental removal of certain blocks, asking the user for confirmation first. 13572 const TEMPLATE_BLOCKS = ['core/post-content', 'core/post-template', 'core/query']; 13573 const BLOCK_REMOVAL_RULES = [{ 13574 // Template blocks. 13575 // The warning is only shown when a user manipulates templates or template parts. 13576 postTypes: ['wp_template', 'wp_template_part'], 13577 callback(removedBlocks) { 13578 const removedTemplateBlocks = removedBlocks.filter(({ 13579 name 13580 }) => TEMPLATE_BLOCKS.includes(name)); 13581 if (removedTemplateBlocks.length) { 13582 return (0,external_wp_i18n_namespaceObject._n)('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.', removedBlocks.length); 13583 } 13584 } 13585 }, { 13586 // Pattern overrides. 13587 // The warning is only shown when the user edits a pattern. 13588 postTypes: ['wp_block'], 13589 callback(removedBlocks) { 13590 const removedBlocksWithOverrides = removedBlocks.filter(({ 13591 attributes 13592 }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some(binding => binding.source === 'core/pattern-overrides')); 13593 if (removedBlocksWithOverrides.length) { 13594 return (0,external_wp_i18n_namespaceObject._n)('The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?', 'Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?', removedBlocks.length); 13595 } 13596 } 13597 }]; 13598 function BlockRemovalWarnings() { 13599 const currentPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 13600 const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)(() => BLOCK_REMOVAL_RULES.filter(rule => rule.postTypes.includes(currentPostType)), [currentPostType]); 13601 13602 // `BlockRemovalWarnings` is rendered in the editor provider, a shared component 13603 // across react native and web. However, `BlockRemovalWarningModal` is web only. 13604 // Check it exists before trying to render it. 13605 if (!BlockRemovalWarningModal) { 13606 return null; 13607 } 13608 if (!removalRulesForPostType) { 13609 return null; 13610 } 13611 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, { 13612 rules: removalRulesForPostType 13613 }); 13614 } 13615 13616 ;// ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js 13617 /** 13618 * WordPress dependencies 13619 */ 13620 13621 13622 13623 13624 13625 /** 13626 * Internal dependencies 13627 */ 13628 13629 function StartPageOptions() { 13630 const { 13631 postId, 13632 enabled 13633 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13634 const { 13635 getCurrentPostId, 13636 getCurrentPostType 13637 } = select(store_store); 13638 const preferencesModalActive = select(store).isModalActive('editor/preferences'); 13639 const choosePatternModalEnabled = select(external_wp_preferences_namespaceObject.store).get('core', 'enableChoosePatternModal'); 13640 return { 13641 postId: getCurrentPostId(), 13642 enabled: choosePatternModalEnabled && !preferencesModalActive && 'page' === getCurrentPostType() 13643 }; 13644 }, []); 13645 const { 13646 isEditedPostDirty, 13647 isEditedPostEmpty 13648 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 13649 const { 13650 setIsInserterOpened 13651 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13652 (0,external_wp_element_namespaceObject.useEffect)(() => { 13653 if (!enabled) { 13654 return; 13655 } 13656 const isFreshPage = !isEditedPostDirty() && isEditedPostEmpty(); 13657 if (isFreshPage) { 13658 setIsInserterOpened({ 13659 tab: 'patterns', 13660 category: 'core/starter-content' 13661 }); 13662 } 13663 13664 // Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component. 13665 // Examples: changing pages in the List View, creating a new page via Command Palette. 13666 }, [postId, enabled, setIsInserterOpened, isEditedPostDirty, isEditedPostEmpty]); 13667 return null; 13668 } 13669 13670 ;// external ["wp","keyboardShortcuts"] 13671 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 13672 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js 13673 /** 13674 * WordPress dependencies 13675 */ 13676 13677 const textFormattingShortcuts = [{ 13678 keyCombination: { 13679 modifier: 'primary', 13680 character: 'b' 13681 }, 13682 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') 13683 }, { 13684 keyCombination: { 13685 modifier: 'primary', 13686 character: 'i' 13687 }, 13688 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') 13689 }, { 13690 keyCombination: { 13691 modifier: 'primary', 13692 character: 'k' 13693 }, 13694 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') 13695 }, { 13696 keyCombination: { 13697 modifier: 'primaryShift', 13698 character: 'k' 13699 }, 13700 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') 13701 }, { 13702 keyCombination: { 13703 character: '[[' 13704 }, 13705 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') 13706 }, { 13707 keyCombination: { 13708 modifier: 'primary', 13709 character: 'u' 13710 }, 13711 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') 13712 }, { 13713 keyCombination: { 13714 modifier: 'access', 13715 character: 'd' 13716 }, 13717 description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') 13718 }, { 13719 keyCombination: { 13720 modifier: 'access', 13721 character: 'x' 13722 }, 13723 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') 13724 }, { 13725 keyCombination: { 13726 modifier: 'access', 13727 character: '0' 13728 }, 13729 aliases: [{ 13730 modifier: 'access', 13731 character: '7' 13732 }], 13733 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') 13734 }, { 13735 keyCombination: { 13736 modifier: 'access', 13737 character: '1-6' 13738 }, 13739 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') 13740 }, { 13741 keyCombination: { 13742 modifier: 'primaryShift', 13743 character: 'SPACE' 13744 }, 13745 description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.') 13746 }]; 13747 13748 ;// external ["wp","keycodes"] 13749 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 13750 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js 13751 /* wp:polyfill */ 13752 /** 13753 * WordPress dependencies 13754 */ 13755 13756 13757 13758 function KeyCombination({ 13759 keyCombination, 13760 forceAriaLabel 13761 }) { 13762 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; 13763 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; 13764 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { 13765 className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination", 13766 "aria-label": forceAriaLabel || ariaLabel, 13767 children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { 13768 if (character === '+') { 13769 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 13770 children: character 13771 }, index); 13772 } 13773 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { 13774 className: "editor-keyboard-shortcut-help-modal__shortcut-key", 13775 children: character 13776 }, index); 13777 }) 13778 }); 13779 } 13780 function Shortcut({ 13781 description, 13782 keyCombination, 13783 aliases = [], 13784 ariaLabel 13785 }) { 13786 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 13787 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13788 className: "editor-keyboard-shortcut-help-modal__shortcut-description", 13789 children: description 13790 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 13791 className: "editor-keyboard-shortcut-help-modal__shortcut-term", 13792 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { 13793 keyCombination: keyCombination, 13794 forceAriaLabel: ariaLabel 13795 }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { 13796 keyCombination: alias, 13797 forceAriaLabel: ariaLabel 13798 }, index))] 13799 })] 13800 }); 13801 } 13802 /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); 13803 13804 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 13805 /** 13806 * WordPress dependencies 13807 */ 13808 13809 13810 13811 /** 13812 * Internal dependencies 13813 */ 13814 13815 13816 function DynamicShortcut({ 13817 name 13818 }) { 13819 const { 13820 keyCombination, 13821 description, 13822 aliases 13823 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13824 const { 13825 getShortcutKeyCombination, 13826 getShortcutDescription, 13827 getShortcutAliases 13828 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 13829 return { 13830 keyCombination: getShortcutKeyCombination(name), 13831 aliases: getShortcutAliases(name), 13832 description: getShortcutDescription(name) 13833 }; 13834 }, [name]); 13835 if (!keyCombination) { 13836 return null; 13837 } 13838 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { 13839 keyCombination: keyCombination, 13840 description: description, 13841 aliases: aliases 13842 }); 13843 } 13844 /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); 13845 13846 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js 13847 /* wp:polyfill */ 13848 /** 13849 * External dependencies 13850 */ 13851 13852 13853 /** 13854 * WordPress dependencies 13855 */ 13856 13857 13858 13859 13860 13861 13862 /** 13863 * Internal dependencies 13864 */ 13865 13866 13867 13868 13869 const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help'; 13870 const ShortcutList = ({ 13871 shortcuts 13872 }) => 13873 /*#__PURE__*/ 13874 /* 13875 * Disable reason: The `list` ARIA role is redundant but 13876 * Safari+VoiceOver won't announce the list otherwise. 13877 */ 13878 /* eslint-disable jsx-a11y/no-redundant-roles */ 13879 (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 13880 className: "editor-keyboard-shortcut-help-modal__shortcut-list", 13881 role: "list", 13882 children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 13883 className: "editor-keyboard-shortcut-help-modal__shortcut", 13884 children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, { 13885 name: shortcut 13886 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { 13887 ...shortcut 13888 }) 13889 }, index)) 13890 }) 13891 /* eslint-enable jsx-a11y/no-redundant-roles */; 13892 const ShortcutSection = ({ 13893 title, 13894 shortcuts, 13895 className 13896 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 13897 className: dist_clsx('editor-keyboard-shortcut-help-modal__section', className), 13898 children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 13899 className: "editor-keyboard-shortcut-help-modal__section-title", 13900 children: title 13901 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { 13902 shortcuts: shortcuts 13903 })] 13904 }); 13905 const ShortcutCategorySection = ({ 13906 title, 13907 categoryName, 13908 additionalShortcuts = [] 13909 }) => { 13910 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { 13911 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); 13912 }, [categoryName]); 13913 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 13914 title: title, 13915 shortcuts: categoryShortcuts.concat(additionalShortcuts) 13916 }); 13917 }; 13918 function KeyboardShortcutHelpModal() { 13919 const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME), []); 13920 const { 13921 openModal, 13922 closeModal 13923 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 13924 const toggleModal = () => { 13925 if (isModalActive) { 13926 closeModal(); 13927 } else { 13928 openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); 13929 } 13930 }; 13931 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/keyboard-shortcuts', toggleModal); 13932 if (!isModalActive) { 13933 return null; 13934 } 13935 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 13936 className: "editor-keyboard-shortcut-help-modal", 13937 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 13938 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 13939 onRequestClose: toggleModal, 13940 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 13941 className: "editor-keyboard-shortcut-help-modal__main-shortcuts", 13942 shortcuts: ['core/editor/keyboard-shortcuts'] 13943 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 13944 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), 13945 categoryName: "global" 13946 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 13947 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), 13948 categoryName: "selection" 13949 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 13950 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), 13951 categoryName: "block", 13952 additionalShortcuts: [{ 13953 keyCombination: { 13954 character: '/' 13955 }, 13956 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), 13957 /* translators: The forward-slash character. e.g. '/'. */ 13958 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') 13959 }] 13960 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 13961 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), 13962 shortcuts: textFormattingShortcuts 13963 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 13964 title: (0,external_wp_i18n_namespaceObject.__)('List View shortcuts'), 13965 categoryName: "list-view" 13966 })] 13967 }); 13968 } 13969 /* harmony default export */ const keyboard_shortcut_help_modal = (KeyboardShortcutHelpModal); 13970 13971 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js 13972 /* wp:polyfill */ 13973 /** 13974 * WordPress dependencies 13975 */ 13976 13977 13978 13979 13980 13981 13982 /** 13983 * Internal dependencies 13984 */ 13985 13986 13987 13988 13989 function ContentOnlySettingsMenuItems({ 13990 clientId, 13991 onClose 13992 }) { 13993 const postContentBlocks = usePostContentBlocks(); 13994 const { 13995 entity, 13996 onNavigateToEntityRecord, 13997 canEditTemplates 13998 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13999 const { 14000 getBlockParentsByBlockName, 14001 getSettings, 14002 getBlockAttributes, 14003 getBlockParents 14004 } = select(external_wp_blockEditor_namespaceObject.store); 14005 const { 14006 getCurrentTemplateId, 14007 getRenderingMode 14008 } = select(store_store); 14009 const patternParent = getBlockParentsByBlockName(clientId, 'core/block', true)[0]; 14010 let record; 14011 if (patternParent) { 14012 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', getBlockAttributes(patternParent).ref); 14013 } else if (getRenderingMode() === 'template-locked' && !getBlockParents(clientId).some(parent => postContentBlocks.includes(parent))) { 14014 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', getCurrentTemplateId()); 14015 } 14016 if (!record) { 14017 return {}; 14018 } 14019 const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser('create', { 14020 kind: 'postType', 14021 name: 'wp_template' 14022 }); 14023 return { 14024 canEditTemplates: _canEditTemplates, 14025 entity: record, 14026 onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord 14027 }; 14028 }, [clientId, postContentBlocks]); 14029 if (!entity) { 14030 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateLockContentOnlyMenuItems, { 14031 clientId: clientId, 14032 onClose: onClose 14033 }); 14034 } 14035 const isPattern = entity.type === 'wp_block'; 14036 let helpText = isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit the pattern to move, delete, or make further changes to this block.') : (0,external_wp_i18n_namespaceObject.__)('Edit the template to move, delete, or make further changes to this block.'); 14037 if (!canEditTemplates) { 14038 helpText = (0,external_wp_i18n_namespaceObject.__)('Only users with permissions to edit the template can move or delete this block'); 14039 } 14040 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14041 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { 14042 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 14043 onClick: () => { 14044 onNavigateToEntityRecord({ 14045 postId: entity.id, 14046 postType: entity.type 14047 }); 14048 }, 14049 disabled: !canEditTemplates, 14050 children: isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit pattern') : (0,external_wp_i18n_namespaceObject.__)('Edit template') 14051 }) 14052 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14053 variant: "muted", 14054 as: "p", 14055 className: "editor-content-only-settings-menu__description", 14056 children: helpText 14057 })] 14058 }); 14059 } 14060 function TemplateLockContentOnlyMenuItems({ 14061 clientId, 14062 onClose 14063 }) { 14064 const { 14065 contentLockingParent 14066 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14067 const { 14068 getContentLockingParent 14069 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 14070 return { 14071 contentLockingParent: getContentLockingParent(clientId) 14072 }; 14073 }, [clientId]); 14074 const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent); 14075 const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 14076 if (!blockDisplayInformation?.title) { 14077 return null; 14078 } 14079 const { 14080 modifyContentLockBlock 14081 } = unlock(blockEditorActions); 14082 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14083 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { 14084 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 14085 onClick: () => { 14086 modifyContentLockBlock(contentLockingParent); 14087 onClose(); 14088 }, 14089 children: (0,external_wp_i18n_namespaceObject._x)('Unlock', 'Unlock content locked blocks') 14090 }) 14091 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 14092 variant: "muted", 14093 as: "p", 14094 className: "editor-content-only-settings-menu__description", 14095 children: (0,external_wp_i18n_namespaceObject.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.') 14096 })] 14097 }); 14098 } 14099 function ContentOnlySettingsMenu() { 14100 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 14101 children: ({ 14102 selectedClientIds, 14103 onClose 14104 }) => selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenuItems, { 14105 clientId: selectedClientIds[0], 14106 onClose: onClose 14107 }) 14108 }); 14109 } 14110 14111 ;// ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js 14112 /* wp:polyfill */ 14113 /** 14114 * WordPress dependencies 14115 */ 14116 14117 14118 14119 14120 14121 14122 14123 14124 /** 14125 * Internal dependencies 14126 */ 14127 14128 14129 14130 function useFallbackTemplateContent(slug, isCustom = false) { 14131 return (0,external_wp_data_namespaceObject.useSelect)(select => { 14132 const { 14133 getEntityRecord, 14134 getDefaultTemplateId 14135 } = select(external_wp_coreData_namespaceObject.store); 14136 const templateId = getDefaultTemplateId({ 14137 slug, 14138 is_custom: isCustom, 14139 ignore_empty: true 14140 }); 14141 return templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined; 14142 }, [slug, isCustom]); 14143 } 14144 function useStartPatterns(fallbackContent) { 14145 const { 14146 slug, 14147 patterns 14148 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14149 const { 14150 getCurrentPostType, 14151 getCurrentPostId 14152 } = select(store_store); 14153 const { 14154 getEntityRecord, 14155 getBlockPatterns 14156 } = select(external_wp_coreData_namespaceObject.store); 14157 const postId = getCurrentPostId(); 14158 const postType = getCurrentPostType(); 14159 const record = getEntityRecord('postType', postType, postId); 14160 return { 14161 slug: record.slug, 14162 patterns: getBlockPatterns() 14163 }; 14164 }, []); 14165 const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet); 14166 14167 // Duplicated from packages/block-library/src/pattern/edit.js. 14168 function injectThemeAttributeInBlockTemplateContent(block) { 14169 if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) { 14170 block.innerBlocks = block.innerBlocks.map(innerBlock => { 14171 if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) { 14172 innerBlock.attributes.theme = currentThemeStylesheet; 14173 } 14174 return innerBlock; 14175 }); 14176 } 14177 if (block.name === 'core/template-part' && block.attributes.theme === undefined) { 14178 block.attributes.theme = currentThemeStylesheet; 14179 } 14180 return block; 14181 } 14182 return (0,external_wp_element_namespaceObject.useMemo)(() => { 14183 // filter patterns that are supposed to be used in the current template being edited. 14184 return [{ 14185 name: 'fallback', 14186 blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent), 14187 title: (0,external_wp_i18n_namespaceObject.__)('Fallback content') 14188 }, ...patterns.filter(pattern => { 14189 return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType)); 14190 }).map(pattern => { 14191 return { 14192 ...pattern, 14193 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block)) 14194 }; 14195 })]; 14196 }, [fallbackContent, slug, patterns]); 14197 } 14198 function PatternSelection({ 14199 fallbackContent, 14200 onChoosePattern, 14201 postType 14202 }) { 14203 const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType); 14204 const blockPatterns = useStartPatterns(fallbackContent); 14205 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 14206 blockPatterns: blockPatterns, 14207 onClickPattern: (pattern, blocks) => { 14208 onChange(blocks, { 14209 selection: undefined 14210 }); 14211 onChoosePattern(); 14212 } 14213 }); 14214 } 14215 function StartModal({ 14216 slug, 14217 isCustom, 14218 onClose, 14219 postType 14220 }) { 14221 const fallbackContent = useFallbackTemplateContent(slug, isCustom); 14222 if (!fallbackContent) { 14223 return null; 14224 } 14225 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 14226 className: "editor-start-template-options__modal", 14227 title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), 14228 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 14229 focusOnMount: "firstElement", 14230 onRequestClose: onClose, 14231 isFullScreen: true, 14232 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14233 className: "editor-start-template-options__modal-content", 14234 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternSelection, { 14235 fallbackContent: fallbackContent, 14236 slug: slug, 14237 isCustom: isCustom, 14238 postType: postType, 14239 onChoosePattern: () => { 14240 onClose(); 14241 } 14242 }) 14243 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 14244 className: "editor-start-template-options__modal__actions", 14245 justify: "flex-end", 14246 expanded: false, 14247 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 14248 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14249 __next40pxDefaultSize: true, 14250 variant: "tertiary", 14251 onClick: onClose, 14252 children: (0,external_wp_i18n_namespaceObject.__)('Skip') 14253 }) 14254 }) 14255 })] 14256 }); 14257 } 14258 function StartTemplateOptions() { 14259 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 14260 const { 14261 shouldOpenModal, 14262 slug, 14263 isCustom, 14264 postType, 14265 postId 14266 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14267 const { 14268 getCurrentPostType, 14269 getCurrentPostId 14270 } = select(store_store); 14271 const _postType = getCurrentPostType(); 14272 const _postId = getCurrentPostId(); 14273 const { 14274 getEditedEntityRecord, 14275 hasEditsForEntityRecord 14276 } = select(external_wp_coreData_namespaceObject.store); 14277 const templateRecord = getEditedEntityRecord('postType', _postType, _postId); 14278 const hasEdits = hasEditsForEntityRecord('postType', _postType, _postId); 14279 return { 14280 shouldOpenModal: !hasEdits && '' === templateRecord.content && TEMPLATE_POST_TYPE === _postType, 14281 slug: templateRecord.slug, 14282 isCustom: templateRecord.is_custom, 14283 postType: _postType, 14284 postId: _postId 14285 }; 14286 }, []); 14287 (0,external_wp_element_namespaceObject.useEffect)(() => { 14288 // Should reset the modal state when navigating to a new page/post. 14289 setIsClosed(false); 14290 }, [postType, postId]); 14291 if (!shouldOpenModal || isClosed) { 14292 return null; 14293 } 14294 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartModal, { 14295 slug: slug, 14296 isCustom: isCustom, 14297 postType: postType, 14298 onClose: () => setIsClosed(true) 14299 }); 14300 } 14301 14302 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js 14303 /** 14304 * WordPress dependencies 14305 */ 14306 14307 14308 14309 14310 14311 /** 14312 * Internal dependencies 14313 */ 14314 14315 14316 /** 14317 * Handles the keyboard shortcuts for the editor. 14318 * 14319 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 14320 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 14321 * and toggling the sidebar. 14322 */ 14323 function EditorKeyboardShortcuts() { 14324 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { 14325 const { 14326 richEditingEnabled, 14327 codeEditingEnabled 14328 } = select(store_store).getEditorSettings(); 14329 return !richEditingEnabled || !codeEditingEnabled; 14330 }, []); 14331 const { 14332 getBlockSelectionStart 14333 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 14334 const { 14335 getActiveComplementaryArea 14336 } = (0,external_wp_data_namespaceObject.useSelect)(store); 14337 const { 14338 enableComplementaryArea, 14339 disableComplementaryArea 14340 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 14341 const { 14342 redo, 14343 undo, 14344 savePost, 14345 setIsListViewOpened, 14346 switchEditorMode, 14347 toggleDistractionFree 14348 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14349 const { 14350 isEditedPostDirty, 14351 isPostSavingLocked, 14352 isListViewOpened, 14353 getEditorMode 14354 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 14355 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => { 14356 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); 14357 }, { 14358 isDisabled: isModeToggleDisabled 14359 }); 14360 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => { 14361 toggleDistractionFree(); 14362 }); 14363 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { 14364 undo(); 14365 event.preventDefault(); 14366 }); 14367 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { 14368 redo(); 14369 event.preventDefault(); 14370 }); 14371 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { 14372 event.preventDefault(); 14373 14374 /** 14375 * Do not save the post if post saving is locked. 14376 */ 14377 if (isPostSavingLocked()) { 14378 return; 14379 } 14380 14381 // TODO: This should be handled in the `savePost` effect in 14382 // considering `isSaveable`. See note on `isEditedPostSaveable` 14383 // selector about dirtiness and meta-boxes. 14384 // 14385 // See: `isEditedPostSaveable` 14386 if (!isEditedPostDirty()) { 14387 return; 14388 } 14389 savePost(); 14390 }); 14391 14392 // Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar. 14393 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', event => { 14394 if (!isListViewOpened()) { 14395 event.preventDefault(); 14396 setIsListViewOpened(true); 14397 } 14398 }); 14399 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => { 14400 // This shortcut has no known clashes, but use preventDefault to prevent any 14401 // obscure shortcuts from triggering. 14402 event.preventDefault(); 14403 const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core')); 14404 if (isEditorSidebarOpened) { 14405 disableComplementaryArea('core'); 14406 } else { 14407 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; 14408 enableComplementaryArea('core', sidebarToOpen); 14409 } 14410 }); 14411 return null; 14412 } 14413 14414 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-regular.js 14415 /** 14416 * WordPress dependencies 14417 */ 14418 14419 14420 14421 14422 14423 function ConvertToRegularBlocks({ 14424 clientId, 14425 onClose 14426 }) { 14427 const { 14428 getBlocks 14429 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 14430 const { 14431 replaceBlocks 14432 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 14433 const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]); 14434 if (!canRemove) { 14435 return null; 14436 } 14437 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 14438 onClick: () => { 14439 replaceBlocks(clientId, getBlocks(clientId)); 14440 onClose(); 14441 }, 14442 children: (0,external_wp_i18n_namespaceObject.__)('Detach') 14443 }); 14444 } 14445 14446 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-template-part.js 14447 /** 14448 * WordPress dependencies 14449 */ 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 /** 14460 * Internal dependencies 14461 */ 14462 14463 14464 function ConvertToTemplatePart({ 14465 clientIds, 14466 blocks 14467 }) { 14468 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 14469 const { 14470 replaceBlocks 14471 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 14472 const { 14473 createSuccessNotice 14474 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 14475 const { 14476 canCreate 14477 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14478 return { 14479 canCreate: select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType('core/template-part') 14480 }; 14481 }, []); 14482 if (!canCreate) { 14483 return null; 14484 } 14485 const onConvert = async templatePart => { 14486 replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { 14487 slug: templatePart.slug, 14488 theme: templatePart.theme 14489 })); 14490 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { 14491 type: 'snackbar' 14492 }); 14493 14494 // The modal and this component will be unmounted because of `replaceBlocks` above, 14495 // so no need to call `closeModal` or `onClose`. 14496 }; 14497 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14498 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 14499 icon: symbol_filled, 14500 onClick: () => { 14501 setIsModalOpen(true); 14502 }, 14503 "aria-expanded": isModalOpen, 14504 "aria-haspopup": "dialog", 14505 children: (0,external_wp_i18n_namespaceObject.__)('Create template part') 14506 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 14507 closeModal: () => { 14508 setIsModalOpen(false); 14509 }, 14510 blocks: blocks, 14511 onCreate: onConvert 14512 })] 14513 }); 14514 } 14515 14516 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/index.js 14517 /** 14518 * WordPress dependencies 14519 */ 14520 14521 14522 14523 /** 14524 * Internal dependencies 14525 */ 14526 14527 14528 14529 function TemplatePartMenuItems() { 14530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 14531 children: ({ 14532 selectedClientIds, 14533 onClose 14534 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartConverterMenuItem, { 14535 clientIds: selectedClientIds, 14536 onClose: onClose 14537 }) 14538 }); 14539 } 14540 function TemplatePartConverterMenuItem({ 14541 clientIds, 14542 onClose 14543 }) { 14544 const { 14545 blocks 14546 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14547 const { 14548 getBlocksByClientId 14549 } = select(external_wp_blockEditor_namespaceObject.store); 14550 return { 14551 blocks: getBlocksByClientId(clientIds) 14552 }; 14553 }, [clientIds]); 14554 14555 // Allow converting a single template part to standard blocks. 14556 if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') { 14557 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToRegularBlocks, { 14558 clientId: clientIds[0], 14559 onClose: onClose 14560 }); 14561 } 14562 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, { 14563 clientIds: clientIds, 14564 blocks: blocks 14565 }); 14566 } 14567 14568 ;// ./node_modules/@wordpress/editor/build-module/components/provider/index.js 14569 /* wp:polyfill */ 14570 /** 14571 * WordPress dependencies 14572 */ 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 /** 14583 * Internal dependencies 14584 */ 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 const { 14604 ExperimentalBlockEditorProvider 14605 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 14606 const { 14607 PatternsMenuItems 14608 } = unlock(external_wp_patterns_namespaceObject.privateApis); 14609 const provider_noop = () => {}; 14610 14611 /** 14612 * These are global entities that are only there to split blocks into logical units 14613 * They don't provide a "context" for the current post/page being rendered. 14614 * So we should not use their ids as post context. This is important to allow post blocks 14615 * (post content, post title) to be used within them without issues. 14616 */ 14617 const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_navigation', 'wp_template_part']; 14618 14619 /** 14620 * These are rendering modes that the editor supports. 14621 */ 14622 const RENDERING_MODES = ['post-only', 'template-locked']; 14623 14624 /** 14625 * Depending on the post, template and template mode, 14626 * returns the appropriate blocks and change handlers for the block editor provider. 14627 * 14628 * @param {Array} post Block list. 14629 * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`. 14630 * @param {string} mode Rendering mode. 14631 * 14632 * @example 14633 * ```jsx 14634 * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode ); 14635 * ``` 14636 * 14637 * @return {Array} Block editor props. 14638 */ 14639 function useBlockEditorProps(post, template, mode) { 14640 const rootLevelPost = mode === 'template-locked' ? 'template' : 'post'; 14641 const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, { 14642 id: post.id 14643 }); 14644 const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, { 14645 id: template?.id 14646 }); 14647 const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 14648 if (post.type === 'wp_navigation') { 14649 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 14650 ref: post.id, 14651 // As the parent editor is locked with `templateLock`, the template locking 14652 // must be explicitly "unset" on the block itself to allow the user to modify 14653 // the block's content. 14654 templateLock: false 14655 })]; 14656 } 14657 }, [post.type, post.id]); 14658 14659 // It is important that we don't create a new instance of blocks on every change 14660 // We should only create a new instance if the blocks them selves change, not a dependency of them. 14661 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 14662 if (maybeNavigationBlocks) { 14663 return maybeNavigationBlocks; 14664 } 14665 if (rootLevelPost === 'template') { 14666 return templateBlocks; 14667 } 14668 return postBlocks; 14669 }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]); 14670 14671 // Handle fallback to postBlocks outside of the above useMemo, to ensure 14672 // that constructed block templates that call `createBlock` are not generated 14673 // too frequently. This ensures that clientIds are stable. 14674 const disableRootLevelChanges = !!template && mode === 'template-locked' || post.type === 'wp_navigation'; 14675 if (disableRootLevelChanges) { 14676 return [blocks, provider_noop, provider_noop]; 14677 } 14678 return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate]; 14679 } 14680 14681 /** 14682 * This component provides the editor context and manages the state of the block editor. 14683 * 14684 * @param {Object} props The component props. 14685 * @param {Object} props.post The post object. 14686 * @param {Object} props.settings The editor settings. 14687 * @param {boolean} props.recovery Indicates if the editor is in recovery mode. 14688 * @param {Array} props.initialEdits The initial edits for the editor. 14689 * @param {Object} props.children The child components. 14690 * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider. 14691 * @param {Object} [props.__unstableTemplate] The template object. 14692 * 14693 * @example 14694 * ```jsx 14695 * <ExperimentalEditorProvider 14696 * post={ post } 14697 * settings={ settings } 14698 * recovery={ recovery } 14699 * initialEdits={ initialEdits } 14700 * __unstableTemplate={ template } 14701 * > 14702 * { children } 14703 * </ExperimentalEditorProvider> 14704 * 14705 * @return {Object} The rendered ExperimentalEditorProvider component. 14706 */ 14707 const ExperimentalEditorProvider = with_registry_provider(({ 14708 post, 14709 settings, 14710 recovery, 14711 initialEdits, 14712 children, 14713 BlockEditorProviderComponent = ExperimentalBlockEditorProvider, 14714 __unstableTemplate: template 14715 }) => { 14716 const hasTemplate = !!template; 14717 const { 14718 editorSettings, 14719 selection, 14720 isReady, 14721 mode, 14722 defaultMode, 14723 postTypeEntities 14724 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14725 const { 14726 getEditorSettings, 14727 getEditorSelection, 14728 getRenderingMode, 14729 __unstableIsEditorReady 14730 } = select(store_store); 14731 const { 14732 getEntitiesConfig, 14733 getPostType, 14734 hasFinishedResolution 14735 } = select(external_wp_coreData_namespaceObject.store); 14736 const postTypeSupports = getPostType(post.type)?.supports; 14737 const hasLoadedPostObject = hasFinishedResolution('getPostType', [post.type]); 14738 const _defaultMode = Array.isArray(postTypeSupports?.editor) ? postTypeSupports.editor.find(features => 'default-mode' in features)?.['default-mode'] : undefined; 14739 const hasDefaultMode = RENDERING_MODES.includes(_defaultMode); 14740 return { 14741 editorSettings: getEditorSettings(), 14742 isReady: __unstableIsEditorReady() && hasLoadedPostObject, 14743 mode: getRenderingMode(), 14744 defaultMode: hasTemplate && hasDefaultMode ? _defaultMode : 'post-only', 14745 selection: getEditorSelection(), 14746 postTypeEntities: post.type === 'wp_template' ? getEntitiesConfig('postType') : null 14747 }; 14748 }, [post.type, hasTemplate]); 14749 const shouldRenderTemplate = !!template && mode !== 'post-only'; 14750 const rootLevelPost = shouldRenderTemplate ? template : post; 14751 const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { 14752 const postContext = {}; 14753 // If it is a template, try to inherit the post type from the name. 14754 if (post.type === 'wp_template') { 14755 if (post.slug === 'page') { 14756 postContext.postType = 'page'; 14757 } else if (post.slug === 'single') { 14758 postContext.postType = 'post'; 14759 } else if (post.slug.split('-')[0] === 'single') { 14760 // If the slug is single-{postType}, infer the post type from the name. 14761 const postTypeNames = postTypeEntities?.map(entity => entity.name) || []; 14762 const match = post.slug.match(`^single-($postTypeNames.join('|')})(?:-.+)?$`); 14763 if (match) { 14764 postContext.postType = match[1]; 14765 } 14766 } 14767 } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) { 14768 postContext.postId = post.id; 14769 postContext.postType = post.type; 14770 } 14771 return { 14772 ...postContext, 14773 templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined 14774 }; 14775 }, [shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug, postTypeEntities]); 14776 const { 14777 id, 14778 type 14779 } = rootLevelPost; 14780 const blockEditorSettings = use_block_editor_settings(editorSettings, type, id, mode); 14781 const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode); 14782 const { 14783 updatePostLock, 14784 setupEditor, 14785 updateEditorSettings, 14786 setCurrentTemplateId, 14787 setEditedPost, 14788 setRenderingMode 14789 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 14790 const { 14791 createWarningNotice 14792 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 14793 14794 // Ideally this should be synced on each change and not just something you do once. 14795 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 14796 // Assume that we don't need to initialize in the case of an error recovery. 14797 if (recovery) { 14798 return; 14799 } 14800 updatePostLock(settings.postLock); 14801 setupEditor(post, initialEdits, settings.template); 14802 if (settings.autosave) { 14803 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), { 14804 id: 'autosave-exists', 14805 actions: [{ 14806 label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'), 14807 url: settings.autosave.editLink 14808 }] 14809 }); 14810 } 14811 14812 // The dependencies of the hook are omitted deliberately 14813 // We only want to run setupEditor (with initialEdits) only once per post. 14814 // A better solution in the future would be to split this effect into multiple ones. 14815 }, []); 14816 14817 // Synchronizes the active post with the state 14818 (0,external_wp_element_namespaceObject.useEffect)(() => { 14819 setEditedPost(post.type, post.id); 14820 }, [post.type, post.id, setEditedPost]); 14821 14822 // Synchronize the editor settings as they change. 14823 (0,external_wp_element_namespaceObject.useEffect)(() => { 14824 updateEditorSettings(settings); 14825 }, [settings, updateEditorSettings]); 14826 14827 // Synchronizes the active template with the state. 14828 (0,external_wp_element_namespaceObject.useEffect)(() => { 14829 setCurrentTemplateId(template?.id); 14830 }, [template?.id, setCurrentTemplateId]); 14831 14832 // Sets the right rendering mode when loading the editor. 14833 (0,external_wp_element_namespaceObject.useEffect)(() => { 14834 setRenderingMode(defaultMode); 14835 }, [defaultMode, setRenderingMode]); 14836 useHideBlocksFromInserter(post.type, mode); 14837 14838 // Register the editor commands. 14839 useCommands(); 14840 if (!isReady || !mode) { 14841 return null; 14842 } 14843 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { 14844 kind: "root", 14845 type: "site", 14846 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { 14847 kind: "postType", 14848 type: post.type, 14849 id: post.id, 14850 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { 14851 value: defaultBlockContext, 14852 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockEditorProviderComponent, { 14853 value: blocks, 14854 onChange: onChange, 14855 onInput: onInput, 14856 selection: selection, 14857 settings: blockEditorSettings, 14858 useSubRegistry: false, 14859 children: [children, !settings.isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14860 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), mode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), type === 'wp_navigation' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {})] 14861 })] 14862 }) 14863 }) 14864 }) 14865 }); 14866 }); 14867 14868 /** 14869 * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor). 14870 * 14871 * It supports a large number of post types, including post, page, templates, 14872 * custom post types, patterns, template parts. 14873 * 14874 * All modification and changes are performed to the `@wordpress/core-data` store. 14875 * 14876 * @param {Object} props The component props. 14877 * @param {Object} [props.post] The post object to edit. This is required. 14878 * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post. 14879 * This is optional and can only be used when the post type supports templates (like posts and pages). 14880 * @param {Object} [props.settings] The settings object to use for the editor. 14881 * This is optional and can be used to override the default settings. 14882 * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply. 14883 * This is optional. 14884 * 14885 * @example 14886 * ```jsx 14887 * <EditorProvider 14888 * post={ post } 14889 * settings={ settings } 14890 * __unstableTemplate={ template } 14891 * > 14892 * { children } 14893 * </EditorProvider> 14894 * ``` 14895 * 14896 * @return {React.ReactNode} The rendered EditorProvider component. 14897 */ 14898 function EditorProvider(props) { 14899 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalEditorProvider, { 14900 ...props, 14901 BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider, 14902 children: props.children 14903 }); 14904 } 14905 /* harmony default export */ const provider = (EditorProvider); 14906 14907 ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/content-preview-view.js 14908 /** 14909 * WordPress dependencies 14910 */ 14911 14912 14913 14914 14915 14916 /** 14917 * Internal dependencies 14918 */ 14919 14920 14921 // @ts-ignore 14922 14923 14924 const { 14925 useGlobalStyle 14926 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 14927 function PostPreviewContainer({ 14928 template, 14929 post 14930 }) { 14931 const [backgroundColor = 'white'] = useGlobalStyle('color.background'); 14932 const [postBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, { 14933 id: post.id 14934 }); 14935 const [templateBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, { 14936 id: template?.id 14937 }); 14938 const blocks = template && templateBlocks ? templateBlocks : postBlocks; 14939 const isEmpty = !blocks?.length; 14940 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14941 className: "editor-fields-content-preview", 14942 style: { 14943 backgroundColor 14944 }, 14945 children: [isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 14946 className: "editor-fields-content-preview__empty", 14947 children: (0,external_wp_i18n_namespaceObject.__)('Empty content') 14948 }), !isEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { 14949 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { 14950 blocks: blocks 14951 }) 14952 })] 14953 }); 14954 } 14955 function PostPreviewView({ 14956 item 14957 }) { 14958 const { 14959 settings, 14960 template 14961 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14962 var _getPostType$viewable; 14963 const { 14964 canUser, 14965 getPostType, 14966 getTemplateId, 14967 getEntityRecord 14968 } = unlock(select(external_wp_coreData_namespaceObject.store)); 14969 const canViewTemplate = canUser('read', { 14970 kind: 'postType', 14971 name: 'wp_template' 14972 }); 14973 const _settings = select(store_store).getEditorSettings(); 14974 // @ts-ignore 14975 const supportsTemplateMode = _settings.supportsTemplateMode; 14976 const isViewable = (_getPostType$viewable = getPostType(item.type)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; 14977 const templateId = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null; 14978 return { 14979 settings: _settings, 14980 template: templateId ? getEntityRecord('postType', 'wp_template', templateId) : undefined 14981 }; 14982 }, [item.type, item.id]); 14983 // Wrap everything in a block editor provider to ensure 'styles' that are needed 14984 // for the previews are synced between the site editor store and the block editor store. 14985 // Additionally we need to have the `__experimentalBlockPatterns` setting in order to 14986 // render patterns inside the previews. 14987 // TODO: Same approach is used in the patterns list and it becomes obvious that some of 14988 // the block editor settings are needed in context where we don't have the block editor. 14989 // Explore how we can solve this in a better way. 14990 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorProvider, { 14991 post: item, 14992 settings: settings, 14993 __unstableTemplate: template, 14994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewContainer, { 14995 template: template, 14996 post: item 14997 }) 14998 }); 14999 } 15000 15001 ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/index.js 15002 /** 15003 * WordPress dependencies 15004 */ 15005 15006 15007 15008 /** 15009 * Internal dependencies 15010 */ 15011 15012 const postPreviewField = { 15013 type: 'media', 15014 id: 'content-preview', 15015 label: (0,external_wp_i18n_namespaceObject.__)('Content preview'), 15016 render: PostPreviewView, 15017 enableSorting: false 15018 }; 15019 /* harmony default export */ const content_preview = (postPreviewField); 15020 15021 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js 15022 /* wp:polyfill */ 15023 /** 15024 * WordPress dependencies 15025 */ 15026 15027 15028 15029 15030 /** 15031 * Internal dependencies 15032 */ 15033 15034 15035 15036 function registerEntityAction(kind, name, config) { 15037 return { 15038 type: 'REGISTER_ENTITY_ACTION', 15039 kind, 15040 name, 15041 config 15042 }; 15043 } 15044 function unregisterEntityAction(kind, name, actionId) { 15045 return { 15046 type: 'UNREGISTER_ENTITY_ACTION', 15047 kind, 15048 name, 15049 actionId 15050 }; 15051 } 15052 function registerEntityField(kind, name, config) { 15053 return { 15054 type: 'REGISTER_ENTITY_FIELD', 15055 kind, 15056 name, 15057 config 15058 }; 15059 } 15060 function unregisterEntityField(kind, name, fieldId) { 15061 return { 15062 type: 'UNREGISTER_ENTITY_FIELD', 15063 kind, 15064 name, 15065 fieldId 15066 }; 15067 } 15068 function setIsReady(kind, name) { 15069 return { 15070 type: 'SET_IS_READY', 15071 kind, 15072 name 15073 }; 15074 } 15075 const registerPostTypeSchema = postType => async ({ 15076 registry 15077 }) => { 15078 const isReady = unlock(registry.select(store_store)).isEntityReady('postType', postType); 15079 if (isReady) { 15080 return; 15081 } 15082 unlock(registry.dispatch(store_store)).setIsReady('postType', postType); 15083 const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 15084 const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser('create', { 15085 kind: 'postType', 15086 name: postType 15087 }); 15088 const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); 15089 const actions = [postTypeConfig.viewable ? view_post : undefined, !!postTypeConfig.supports?.revisions ? view_post_revisions : undefined, 15090 // @ts-ignore 15091 false ? 0 : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? duplicate_template_part : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? duplicate_pattern : undefined, postTypeConfig.supports?.title ? rename_post : undefined, postTypeConfig.supports?.['page-attributes'] ? reorder_page : undefined, postTypeConfig.slug === 'wp_block' ? export_pattern : undefined, restore_post, reset_post, delete_post, trash_post, permanently_delete_post].filter(Boolean); 15092 const fields = [postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.['post-thumbnails'] && featured_image, postTypeConfig.supports?.author && author, fields_status, date, slug, postTypeConfig.supports?.['page-attributes'] && fields_parent, postTypeConfig.supports?.comments && comment_status, fields_template, fields_password, postTypeConfig.supports?.editor && postTypeConfig.viewable && content_preview].filter(Boolean); 15093 if (postTypeConfig.supports?.title) { 15094 let _titleField; 15095 if (postType === 'page') { 15096 _titleField = page_title; 15097 } else if (postType === 'wp_template') { 15098 _titleField = template_title; 15099 } else if (postType === 'wp_block') { 15100 _titleField = pattern_title; 15101 } else { 15102 _titleField = title; 15103 } 15104 fields.push(_titleField); 15105 } 15106 registry.batch(() => { 15107 actions.forEach(action => { 15108 unlock(registry.dispatch(store_store)).registerEntityAction('postType', postType, action); 15109 }); 15110 fields.forEach(field => { 15111 unlock(registry.dispatch(store_store)).registerEntityField('postType', postType, field); 15112 }); 15113 }); 15114 (0,external_wp_hooks_namespaceObject.doAction)('core.registerPostTypeSchema', postType); 15115 }; 15116 15117 ;// ./node_modules/@wordpress/editor/build-module/store/private-actions.js 15118 /* wp:polyfill */ 15119 /** 15120 * WordPress dependencies 15121 */ 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 /** 15133 * Internal dependencies 15134 */ 15135 15136 15137 15138 /** 15139 * Returns an action object used to set which template is currently being used/edited. 15140 * 15141 * @param {string} id Template Id. 15142 * 15143 * @return {Object} Action object. 15144 */ 15145 function setCurrentTemplateId(id) { 15146 return { 15147 type: 'SET_CURRENT_TEMPLATE_ID', 15148 id 15149 }; 15150 } 15151 15152 /** 15153 * Create a block based template. 15154 * 15155 * @param {?Object} template Template to create and assign. 15156 */ 15157 const createTemplate = template => async ({ 15158 select, 15159 dispatch, 15160 registry 15161 }) => { 15162 const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); 15163 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', select.getCurrentPostType(), select.getCurrentPostId(), { 15164 template: savedTemplate.slug 15165 }); 15166 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), { 15167 type: 'snackbar', 15168 actions: [{ 15169 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 15170 onClick: () => dispatch.setRenderingMode(select.getEditorSettings().defaultRenderingMode) 15171 }] 15172 }); 15173 return savedTemplate; 15174 }; 15175 15176 /** 15177 * Update the provided block types to be visible. 15178 * 15179 * @param {string[]} blockNames Names of block types to show. 15180 */ 15181 const showBlockTypes = blockNames => ({ 15182 registry 15183 }) => { 15184 var _registry$select$get; 15185 const existingBlockNames = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 15186 const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)); 15187 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', newBlockNames); 15188 }; 15189 15190 /** 15191 * Update the provided block types to be hidden. 15192 * 15193 * @param {string[]} blockNames Names of block types to hide. 15194 */ 15195 const hideBlockTypes = blockNames => ({ 15196 registry 15197 }) => { 15198 var _registry$select$get2; 15199 const existingBlockNames = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 15200 const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]); 15201 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]); 15202 }; 15203 15204 /** 15205 * Save entity records marked as dirty. 15206 * 15207 * @param {Object} options Options for the action. 15208 * @param {Function} [options.onSave] Callback when saving happens. 15209 * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities. 15210 * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving. 15211 * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`. 15212 */ 15213 const saveDirtyEntities = ({ 15214 onSave, 15215 dirtyEntityRecords = [], 15216 entitiesToSkip = [], 15217 close 15218 } = {}) => ({ 15219 registry 15220 }) => { 15221 const PUBLISH_ON_SAVE_ENTITIES = [{ 15222 kind: 'postType', 15223 name: 'wp_navigation' 15224 }]; 15225 const saveNoticeId = 'site-editor-save-success'; 15226 const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 15227 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); 15228 const entitiesToSave = dirtyEntityRecords.filter(({ 15229 kind, 15230 name, 15231 key, 15232 property 15233 }) => { 15234 return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); 15235 }); 15236 close?.(entitiesToSave); 15237 const siteItemsToSave = []; 15238 const pendingSavedRecords = []; 15239 entitiesToSave.forEach(({ 15240 kind, 15241 name, 15242 key, 15243 property 15244 }) => { 15245 if ('root' === kind && 'site' === name) { 15246 siteItemsToSave.push(property); 15247 } else { 15248 if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { 15249 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { 15250 status: 'publish' 15251 }); 15252 } 15253 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key)); 15254 } 15255 }); 15256 if (siteItemsToSave.length) { 15257 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); 15258 } 15259 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 15260 Promise.all(pendingSavedRecords).then(values => { 15261 return onSave ? onSave(values) : values; 15262 }).then(values => { 15263 if (values.some(value => typeof value === 'undefined')) { 15264 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); 15265 } else { 15266 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { 15267 type: 'snackbar', 15268 id: saveNoticeId, 15269 actions: [{ 15270 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 15271 url: homeUrl 15272 }] 15273 }); 15274 } 15275 }).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} $error}`)); 15276 }; 15277 15278 /** 15279 * Reverts a template to its original theme-provided file. 15280 * 15281 * @param {Object} template The template to revert. 15282 * @param {Object} [options] 15283 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 15284 * reverting the template. Default true. 15285 */ 15286 const private_actions_revertTemplate = (template, { 15287 allowUndo = true 15288 } = {}) => async ({ 15289 registry 15290 }) => { 15291 const noticeId = 'edit-site-template-reverted'; 15292 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 15293 if (!isTemplateRevertable(template)) { 15294 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { 15295 type: 'snackbar' 15296 }); 15297 return; 15298 } 15299 try { 15300 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); 15301 if (!templateEntityConfig) { 15302 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 15303 type: 'snackbar' 15304 }); 15305 return; 15306 } 15307 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`$templateEntityConfig.baseURL}/$template.id}`, { 15308 context: 'edit', 15309 source: template.origin 15310 }); 15311 const fileTemplate = await external_wp_apiFetch_default()({ 15312 path: fileTemplatePath 15313 }); 15314 if (!fileTemplate) { 15315 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 15316 type: 'snackbar' 15317 }); 15318 return; 15319 } 15320 const serializeBlocks = ({ 15321 blocks: blocksForSerialization = [] 15322 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 15323 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); 15324 15325 // We are fixing up the undo level here to make sure we can undo 15326 // the revert in the header toolbar correctly. 15327 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { 15328 content: serializeBlocks, 15329 // Required to make the `undo` behave correctly. 15330 blocks: edited.blocks, 15331 // Required to revert the blocks in the editor. 15332 source: 'custom' // required to avoid turning the editor into a dirty state 15333 }, { 15334 undoIgnore: true // Required to merge this edit with the last undo level. 15335 }); 15336 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 15337 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { 15338 content: serializeBlocks, 15339 blocks, 15340 source: 'theme' 15341 }); 15342 if (allowUndo) { 15343 const undoRevert = () => { 15344 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { 15345 content: serializeBlocks, 15346 blocks: edited.blocks, 15347 source: 'custom' 15348 }); 15349 }; 15350 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { 15351 type: 'snackbar', 15352 id: noticeId, 15353 actions: [{ 15354 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 15355 onClick: undoRevert 15356 }] 15357 }); 15358 } 15359 } catch (error) { 15360 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); 15361 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 15362 type: 'snackbar' 15363 }); 15364 } 15365 }; 15366 15367 /** 15368 * Action that removes an array of templates, template parts or patterns. 15369 * 15370 * @param {Array} items An array of template,template part or pattern objects to remove. 15371 */ 15372 const removeTemplates = items => async ({ 15373 registry 15374 }) => { 15375 const isResetting = items.every(item => item?.has_theme_file); 15376 const promiseResult = await Promise.allSettled(items.map(item => { 15377 return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, { 15378 force: true 15379 }, { 15380 throwOnError: true 15381 }); 15382 })); 15383 15384 // If all the promises were fulfilled with success. 15385 if (promiseResult.every(({ 15386 status 15387 }) => status === 'fulfilled')) { 15388 let successMessage; 15389 if (items.length === 1) { 15390 // Depending on how the entity was retrieved its title might be 15391 // an object or simple string. 15392 let title; 15393 if (typeof items[0].title === 'string') { 15394 title = items[0].title; 15395 } else if (typeof items[0].title?.rendered === 'string') { 15396 title = items[0].title?.rendered; 15397 } else if (typeof items[0].title?.raw === 'string') { 15398 title = items[0].title?.raw; 15399 } 15400 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: The template/part's name. */ 15401 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The template/part's name. */ 15402 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); 15403 } else { 15404 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); 15405 } 15406 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { 15407 type: 'snackbar', 15408 id: 'editor-template-deleted-success' 15409 }); 15410 } else { 15411 // If there was at lease one failure. 15412 let errorMessage; 15413 // If we were trying to delete a single template. 15414 if (promiseResult.length === 1) { 15415 if (promiseResult[0].reason?.message) { 15416 errorMessage = promiseResult[0].reason.message; 15417 } else { 15418 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.'); 15419 } 15420 // If we were trying to delete a multiple templates 15421 } else { 15422 const errorMessages = new Set(); 15423 const failedPromises = promiseResult.filter(({ 15424 status 15425 }) => status === 'rejected'); 15426 for (const failedPromise of failedPromises) { 15427 if (failedPromise.reason?.message) { 15428 errorMessages.add(failedPromise.reason.message); 15429 } 15430 } 15431 if (errorMessages.size === 0) { 15432 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); 15433 } else if (errorMessages.size === 1) { 15434 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 15435 (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: an error message */ 15436 (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]); 15437 } else { 15438 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 15439 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: a list of comma separated error messages */ 15440 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(',')); 15441 } 15442 } 15443 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 15444 type: 'snackbar' 15445 }); 15446 } 15447 }; 15448 15449 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js 15450 var fast_deep_equal = __webpack_require__(5215); 15451 var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); 15452 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 15453 /** 15454 * WordPress dependencies 15455 */ 15456 15457 15458 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 15459 viewBox: "0 0 24 24", 15460 xmlns: "http://www.w3.org/2000/svg", 15461 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 15462 d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" 15463 }) 15464 }); 15465 /* harmony default export */ const library_navigation = (navigation); 15466 15467 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 15468 /** 15469 * WordPress dependencies 15470 */ 15471 15472 15473 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 15474 viewBox: "0 0 24 24", 15475 xmlns: "http://www.w3.org/2000/svg", 15476 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 15477 d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" 15478 }) 15479 }); 15480 /* harmony default export */ const library_verse = (verse); 15481 15482 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js 15483 /** 15484 * Internal dependencies 15485 */ 15486 15487 const EMPTY_ARRAY = []; 15488 function getEntityActions(state, kind, name) { 15489 var _state$actions$kind$n; 15490 return (_state$actions$kind$n = state.actions[kind]?.[name]) !== null && _state$actions$kind$n !== void 0 ? _state$actions$kind$n : EMPTY_ARRAY; 15491 } 15492 function getEntityFields(state, kind, name) { 15493 var _state$fields$kind$na; 15494 return (_state$fields$kind$na = state.fields[kind]?.[name]) !== null && _state$fields$kind$na !== void 0 ? _state$fields$kind$na : EMPTY_ARRAY; 15495 } 15496 function isEntityReady(state, kind, name) { 15497 return state.isReady[kind]?.[name]; 15498 } 15499 15500 ;// ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 15501 /* wp:polyfill */ 15502 /** 15503 * External dependencies 15504 */ 15505 15506 15507 /** 15508 * WordPress dependencies 15509 */ 15510 15511 15512 15513 15514 15515 /** 15516 * Internal dependencies 15517 */ 15518 15519 15520 15521 const EMPTY_INSERTION_POINT = { 15522 rootClientId: undefined, 15523 insertionIndex: undefined, 15524 filterValue: undefined 15525 }; 15526 15527 /** 15528 * Get the inserter. 15529 * 15530 * @param {Object} state Global application state. 15531 * 15532 * @return {Object} The root client ID, index to insert at and starting filter value. 15533 */ 15534 const getInserter = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { 15535 if (typeof state.blockInserterPanel === 'object') { 15536 return state.blockInserterPanel; 15537 } 15538 if (getRenderingMode(state) === 'template-locked') { 15539 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 15540 if (postContentClientId) { 15541 return { 15542 rootClientId: postContentClientId, 15543 insertionIndex: undefined, 15544 filterValue: undefined 15545 }; 15546 } 15547 } 15548 return EMPTY_INSERTION_POINT; 15549 }, state => { 15550 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 15551 return [state.blockInserterPanel, getRenderingMode(state), postContentClientId]; 15552 })); 15553 function getListViewToggleRef(state) { 15554 return state.listViewToggleRef; 15555 } 15556 function getInserterSidebarToggleRef(state) { 15557 return state.inserterSidebarToggleRef; 15558 } 15559 const CARD_ICONS = { 15560 wp_block: library_symbol, 15561 wp_navigation: library_navigation, 15562 page: library_page, 15563 post: library_verse 15564 }; 15565 const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => { 15566 { 15567 if (postType === 'wp_template_part' || postType === 'wp_template') { 15568 const templateAreas = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || []; 15569 const areaData = templateAreas.find(item => options.area === item.area); 15570 if (areaData?.icon) { 15571 return getTemplatePartIcon(areaData.icon); 15572 } 15573 return library_layout; 15574 } 15575 if (CARD_ICONS[postType]) { 15576 return CARD_ICONS[postType]; 15577 } 15578 const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); 15579 // `icon` is the `menu_icon` property of a post type. We 15580 // only handle `dashicons` for now, even if the `menu_icon` 15581 // also supports urls and svg as values. 15582 if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) { 15583 return postTypeEntity.icon.slice(10); 15584 } 15585 return library_page; 15586 } 15587 }); 15588 15589 /** 15590 * Returns true if there are unsaved changes to the 15591 * post's meta fields, and false otherwise. 15592 * 15593 * @param {Object} state Global application state. 15594 * @param {string} postType The post type of the post. 15595 * @param {number} postId The ID of the post. 15596 * 15597 * @return {boolean} Whether there are edits or not in the meta fields of the relevant post. 15598 */ 15599 const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { 15600 const { 15601 type: currentPostType, 15602 id: currentPostId 15603 } = getCurrentPost(state); 15604 // If no postType or postId is passed, use the current post. 15605 const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId); 15606 if (!edits?.meta) { 15607 return false; 15608 } 15609 15610 // Compare if anything apart from `footnotes` has changed. 15611 const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta; 15612 return !fast_deep_equal_default()({ 15613 ...originalPostMeta, 15614 footnotes: undefined 15615 }, { 15616 ...edits.meta, 15617 footnotes: undefined 15618 }); 15619 }); 15620 function private_selectors_getEntityActions(state, ...args) { 15621 return getEntityActions(state.dataviews, ...args); 15622 } 15623 function private_selectors_isEntityReady(state, ...args) { 15624 return isEntityReady(state.dataviews, ...args); 15625 } 15626 function private_selectors_getEntityFields(state, ...args) { 15627 return getEntityFields(state.dataviews, ...args); 15628 } 15629 15630 /** 15631 * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most 15632 * blocks that aren't descendants of the query block. 15633 * 15634 * @param {Object} state Global application state. 15635 * @param {Array|string} blockNames Block names of the blocks to retrieve. 15636 * 15637 * @return {Array} Block client IDs. 15638 */ 15639 const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames) => { 15640 blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 15641 const { 15642 getBlocksByName, 15643 getBlockParents, 15644 getBlockName 15645 } = select(external_wp_blockEditor_namespaceObject.store); 15646 return getBlocksByName(blockNames).filter(clientId => getBlockParents(clientId).every(parentClientId => { 15647 const parentBlockName = getBlockName(parentClientId); 15648 return ( 15649 // Ignore descendents of the query block. 15650 parentBlockName !== 'core/query' && 15651 // Enable only the top-most block. 15652 !blockNames.includes(parentBlockName) 15653 ); 15654 })); 15655 }, () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()])); 15656 15657 ;// ./node_modules/@wordpress/editor/build-module/store/index.js 15658 /** 15659 * WordPress dependencies 15660 */ 15661 15662 15663 /** 15664 * Internal dependencies 15665 */ 15666 15667 15668 15669 15670 15671 15672 15673 15674 /** 15675 * Post editor data store configuration. 15676 * 15677 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 15678 */ 15679 const storeConfig = { 15680 reducer: store_reducer, 15681 selectors: selectors_namespaceObject, 15682 actions: actions_namespaceObject 15683 }; 15684 15685 /** 15686 * Store definition for the editor namespace. 15687 * 15688 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 15689 */ 15690 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 15691 ...storeConfig 15692 }); 15693 (0,external_wp_data_namespaceObject.register)(store_store); 15694 unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); 15695 unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); 15696 15697 ;// ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 15698 /* wp:polyfill */ 15699 /** 15700 * WordPress dependencies 15701 */ 15702 15703 15704 15705 15706 15707 15708 /** 15709 * Internal dependencies 15710 */ 15711 15712 15713 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ 15714 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 15715 15716 /** 15717 * Object whose keys are the names of block attributes, where each value 15718 * represents the meta key to which the block attribute is intended to save. 15719 * 15720 * @see https://developer.wordpress.org/reference/functions/register_meta/ 15721 * 15722 * @typedef {Object<string,string>} WPMetaAttributeMapping 15723 */ 15724 15725 /** 15726 * Given a mapping of attribute names (meta source attributes) to their 15727 * associated meta key, returns a higher order component that overrides its 15728 * `attributes` and `setAttributes` props to sync any changes with the edited 15729 * post's meta keys. 15730 * 15731 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. 15732 * 15733 * @return {WPHigherOrderComponent} Higher-order component. 15734 */ 15735 15736 const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({ 15737 attributes, 15738 setAttributes, 15739 ...props 15740 }) => { 15741 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 15742 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); 15743 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 15744 ...attributes, 15745 ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]])) 15746 }), [attributes, meta]); 15747 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 15748 attributes: mergedAttributes, 15749 setAttributes: nextAttributes => { 15750 const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( 15751 // Filter to intersection of keys between the updated 15752 // attributes and those with an associated meta key. 15753 ([key]) => key in metaAttributes).map(([attributeKey, value]) => [ 15754 // Rename the keys to the expected meta key name. 15755 metaAttributes[attributeKey], value])); 15756 if (Object.entries(nextMeta).length) { 15757 setMeta(nextMeta); 15758 } 15759 setAttributes(nextAttributes); 15760 }, 15761 ...props 15762 }); 15763 }, 'withMetaAttributeSource'); 15764 15765 /** 15766 * Filters a registered block's settings to enhance a block's `edit` component 15767 * to upgrade meta-sourced attributes to use the post's meta entity property. 15768 * 15769 * @param {WPBlockSettings} settings Registered block settings. 15770 * 15771 * @return {WPBlockSettings} Filtered block settings. 15772 */ 15773 function shimAttributeSource(settings) { 15774 var _settings$attributes; 15775 /** @type {WPMetaAttributeMapping} */ 15776 const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, { 15777 source 15778 }]) => source === 'meta').map(([attributeKey, { 15779 meta 15780 }]) => [attributeKey, meta])); 15781 if (Object.entries(metaAttributes).length) { 15782 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); 15783 } 15784 return settings; 15785 } 15786 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); 15787 15788 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 15789 /* wp:polyfill */ 15790 /** 15791 * WordPress dependencies 15792 */ 15793 15794 15795 15796 15797 function getUserLabel(user) { 15798 const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 15799 className: "editor-autocompleters__user-avatar", 15800 alt: "", 15801 src: user.avatar_urls[24] 15802 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 15803 className: "editor-autocompleters__no-avatar" 15804 }); 15805 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15806 children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 15807 className: "editor-autocompleters__user-name", 15808 children: user.name 15809 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 15810 className: "editor-autocompleters__user-slug", 15811 children: user.slug 15812 })] 15813 }); 15814 } 15815 15816 /** 15817 * A user mentions completer. 15818 * 15819 * @type {Object} 15820 */ 15821 /* harmony default export */ const user = ({ 15822 name: 'users', 15823 className: 'editor-autocompleters__user', 15824 triggerPrefix: '@', 15825 useItems(filterValue) { 15826 const users = (0,external_wp_data_namespaceObject.useSelect)(select => { 15827 const { 15828 getUsers 15829 } = select(external_wp_coreData_namespaceObject.store); 15830 return getUsers({ 15831 context: 'view', 15832 search: encodeURIComponent(filterValue) 15833 }); 15834 }, [filterValue]); 15835 const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ 15836 key: `user-$user.slug}`, 15837 value: user, 15838 label: getUserLabel(user) 15839 })) : [], [users]); 15840 return [options]; 15841 }, 15842 getOptionCompletion(user) { 15843 return `@$user.slug}`; 15844 } 15845 }); 15846 15847 ;// ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 15848 /** 15849 * WordPress dependencies 15850 */ 15851 15852 15853 /** 15854 * Internal dependencies 15855 */ 15856 15857 function setDefaultCompleters(completers = []) { 15858 // Provide copies so filters may directly modify them. 15859 completers.push({ 15860 ...user 15861 }); 15862 return completers; 15863 } 15864 (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); 15865 15866 ;// ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js 15867 /** 15868 * WordPress dependencies 15869 */ 15870 15871 15872 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); 15873 15874 ;// ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js 15875 /* wp:polyfill */ 15876 /** 15877 * WordPress dependencies 15878 */ 15879 15880 15881 15882 15883 15884 15885 15886 /** 15887 * Internal dependencies 15888 */ 15889 15890 15891 15892 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 15893 15894 const { 15895 PatternOverridesControls, 15896 ResetOverridesControl, 15897 PatternOverridesBlockControls, 15898 PATTERN_TYPES: pattern_overrides_PATTERN_TYPES, 15899 PARTIAL_SYNCING_SUPPORTED_BLOCKS, 15900 PATTERN_SYNC_TYPES 15901 } = unlock(external_wp_patterns_namespaceObject.privateApis); 15902 15903 /** 15904 * Override the default edit UI to include a new block inspector control for 15905 * assigning a partial syncing controls to supported blocks in the pattern editor. 15906 * Currently, only the `core/paragraph` block is supported. 15907 * 15908 * @param {Component} BlockEdit Original component. 15909 * 15910 * @return {Component} Wrapped component. 15911 */ 15912 const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { 15913 const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; 15914 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15915 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 15916 ...props 15917 }, "edit"), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { 15918 ...props 15919 }), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})] 15920 }); 15921 }, 'withPatternOverrideControls'); 15922 15923 // Split into a separate component to avoid a store subscription 15924 // on every block. 15925 function ControlsWithStoreSubscription(props) { 15926 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 15927 const { 15928 hasPatternOverridesSource, 15929 isEditingSyncedPattern 15930 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15931 const { 15932 getCurrentPostType, 15933 getEditedPostAttribute 15934 } = select(store_store); 15935 return { 15936 // For editing link to the site editor if the theme and user permissions support it. 15937 hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)('core/pattern-overrides'), 15938 isEditingSyncedPattern: getCurrentPostType() === pattern_overrides_PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced 15939 }; 15940 }, []); 15941 const bindings = props.attributes.metadata?.bindings; 15942 const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides'); 15943 const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default'; 15944 const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings; 15945 if (!hasPatternOverridesSource) { 15946 return null; 15947 } 15948 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15949 children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { 15950 ...props 15951 }), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { 15952 ...props 15953 })] 15954 }); 15955 } 15956 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls); 15957 15958 ;// ./node_modules/@wordpress/editor/build-module/hooks/index.js 15959 /** 15960 * Internal dependencies 15961 */ 15962 15963 15964 15965 15966 15967 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 15968 15969 15970 ;// ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 15971 /** 15972 * WordPress dependencies 15973 */ 15974 15975 15976 15977 15978 15979 /** 15980 * Internal dependencies 15981 */ 15982 15983 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { 15984 constructor(props) { 15985 super(props); 15986 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 15987 } 15988 componentDidMount() { 15989 if (!this.props.disableIntervalChecks) { 15990 this.setAutosaveTimer(); 15991 } 15992 } 15993 componentDidUpdate(prevProps) { 15994 if (this.props.disableIntervalChecks) { 15995 if (this.props.editsReference !== prevProps.editsReference) { 15996 this.props.autosave(); 15997 } 15998 return; 15999 } 16000 if (this.props.interval !== prevProps.interval) { 16001 clearTimeout(this.timerId); 16002 this.setAutosaveTimer(); 16003 } 16004 if (!this.props.isDirty) { 16005 this.needsAutosave = false; 16006 return; 16007 } 16008 if (this.props.isAutosaving && !prevProps.isAutosaving) { 16009 this.needsAutosave = false; 16010 return; 16011 } 16012 if (this.props.editsReference !== prevProps.editsReference) { 16013 this.needsAutosave = true; 16014 } 16015 } 16016 componentWillUnmount() { 16017 clearTimeout(this.timerId); 16018 } 16019 setAutosaveTimer(timeout = this.props.interval * 1000) { 16020 this.timerId = setTimeout(() => { 16021 this.autosaveTimerHandler(); 16022 }, timeout); 16023 } 16024 autosaveTimerHandler() { 16025 if (!this.props.isAutosaveable) { 16026 this.setAutosaveTimer(1000); 16027 return; 16028 } 16029 if (this.needsAutosave) { 16030 this.needsAutosave = false; 16031 this.props.autosave(); 16032 } 16033 this.setAutosaveTimer(); 16034 } 16035 render() { 16036 return null; 16037 } 16038 } 16039 16040 /** 16041 * Monitors the changes made to the edited post and triggers autosave if necessary. 16042 * 16043 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. 16044 * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as 16045 * the specific way of detecting changes. 16046 * 16047 * There are two caveats: 16048 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. 16049 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. 16050 * 16051 * @param {Object} props - The properties passed to the component. 16052 * @param {Function} props.autosave - The function to call when changes need to be saved. 16053 * @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave. 16054 * @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second. 16055 * @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`. 16056 * @param {boolean} props.isDirty - Indicates if there are unsaved changes. 16057 * 16058 * @example 16059 * ```jsx 16060 * <AutosaveMonitor interval={30000} /> 16061 * ``` 16062 */ 16063 /* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { 16064 const { 16065 getReferenceByDistinctEdits 16066 } = select(external_wp_coreData_namespaceObject.store); 16067 const { 16068 isEditedPostDirty, 16069 isEditedPostAutosaveable, 16070 isAutosavingPost, 16071 getEditorSettings 16072 } = select(store_store); 16073 const { 16074 interval = getEditorSettings().autosaveInterval 16075 } = ownProps; 16076 return { 16077 editsReference: getReferenceByDistinctEdits(), 16078 isDirty: isEditedPostDirty(), 16079 isAutosaveable: isEditedPostAutosaveable(), 16080 isAutosaving: isAutosavingPost(), 16081 interval 16082 }; 16083 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ 16084 autosave() { 16085 const { 16086 autosave = dispatch(store_store).autosave 16087 } = ownProps; 16088 autosave(); 16089 } 16090 }))])(AutosaveMonitor)); 16091 16092 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 16093 /** 16094 * WordPress dependencies 16095 */ 16096 16097 16098 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 16099 xmlns: "http://www.w3.org/2000/svg", 16100 viewBox: "0 0 24 24", 16101 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 16102 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 16103 }) 16104 }); 16105 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 16106 16107 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 16108 /** 16109 * WordPress dependencies 16110 */ 16111 16112 16113 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 16114 xmlns: "http://www.w3.org/2000/svg", 16115 viewBox: "0 0 24 24", 16116 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 16117 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 16118 }) 16119 }); 16120 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 16121 16122 ;// external ["wp","dom"] 16123 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 16124 ;// ./node_modules/@wordpress/editor/build-module/utils/pageTypeBadge.js 16125 /** 16126 * WordPress dependencies 16127 */ 16128 16129 16130 16131 16132 /** 16133 * Custom hook to get the page type badge for the current post on edit site view. 16134 * 16135 * @param {number|string} postId postId of the current post being edited. 16136 */ 16137 function usePageTypeBadge(postId) { 16138 const { 16139 isFrontPage, 16140 isPostsPage 16141 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16142 const { 16143 canUser, 16144 getEditedEntityRecord 16145 } = select(external_wp_coreData_namespaceObject.store); 16146 const siteSettings = canUser('read', { 16147 kind: 'root', 16148 name: 'site' 16149 }) ? getEditedEntityRecord('root', 'site') : undefined; 16150 const _postId = parseInt(postId, 10); 16151 return { 16152 isFrontPage: siteSettings?.page_on_front === _postId, 16153 isPostsPage: siteSettings?.page_for_posts === _postId 16154 }; 16155 }); 16156 if (isFrontPage) { 16157 return (0,external_wp_i18n_namespaceObject.__)('Homepage'); 16158 } else if (isPostsPage) { 16159 return (0,external_wp_i18n_namespaceObject.__)('Posts Page'); 16160 } 16161 return false; 16162 } 16163 16164 ;// ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js 16165 /** 16166 * External dependencies 16167 */ 16168 16169 16170 /** 16171 * WordPress dependencies 16172 */ 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 /** 16187 * Internal dependencies 16188 */ 16189 16190 16191 16192 16193 16194 /** @typedef {import("@wordpress/components").IconType} IconType */ 16195 16196 const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button); 16197 16198 /** 16199 * This component renders a navigation bar at the top of the editor. It displays the title of the current document, 16200 * a back button (if applicable), and a command center button. It also handles different states of the document, 16201 * such as "not found" or "unsynced". 16202 * 16203 * @example 16204 * ```jsx 16205 * <DocumentBar /> 16206 * ``` 16207 * @param {Object} props The component props. 16208 * @param {string} props.title A title for the document, defaulting to the document or 16209 * template title currently being edited. 16210 * @param {IconType} props.icon An icon for the document, no default. 16211 * (A default icon indicating the document post type is no longer used.) 16212 * 16213 * @return {React.ReactNode} The rendered DocumentBar component. 16214 */ 16215 function DocumentBar(props) { 16216 const { 16217 postId, 16218 postType, 16219 postTypeLabel, 16220 documentTitle, 16221 isNotFound, 16222 templateTitle, 16223 onNavigateToPreviousEntityRecord, 16224 isTemplatePreview 16225 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16226 var _select$getEntityReco; 16227 const { 16228 getCurrentPostType, 16229 getCurrentPostId, 16230 getEditorSettings, 16231 getRenderingMode 16232 } = select(store_store); 16233 const { 16234 getEditedEntityRecord, 16235 getPostType, 16236 isResolving: isResolvingSelector 16237 } = select(external_wp_coreData_namespaceObject.store); 16238 const _postType = getCurrentPostType(); 16239 const _postId = getCurrentPostId(); 16240 const _document = getEditedEntityRecord('postType', _postType, _postId); 16241 const { 16242 default_template_types: templateTypes = [] 16243 } = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {}; 16244 const _templateInfo = getTemplateInfo({ 16245 templateTypes, 16246 template: _document 16247 }); 16248 const _postTypeLabel = getPostType(_postType)?.labels?.singular_name; 16249 return { 16250 postId: _postId, 16251 postType: _postType, 16252 postTypeLabel: _postTypeLabel, 16253 documentTitle: _document.title, 16254 isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId), 16255 templateTitle: _templateInfo.title, 16256 onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord, 16257 isTemplatePreview: getRenderingMode() === 'template-locked' 16258 }; 16259 }, []); 16260 const { 16261 open: openCommandCenter 16262 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 16263 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 16264 const isTemplate = TEMPLATE_POST_TYPES.includes(postType); 16265 const hasBackButton = !!onNavigateToPreviousEntityRecord; 16266 const entityTitle = isTemplate ? templateTitle : documentTitle; 16267 const title = props.title || entityTitle; 16268 const icon = props.icon; 16269 const pageTypeBadge = usePageTypeBadge(postId); 16270 const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); 16271 (0,external_wp_element_namespaceObject.useEffect)(() => { 16272 mountedRef.current = true; 16273 }, []); 16274 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16275 className: dist_clsx('editor-document-bar', { 16276 'has-back-button': hasBackButton 16277 }), 16278 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 16279 children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, { 16280 className: "editor-document-bar__back", 16281 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small, 16282 onClick: event => { 16283 event.stopPropagation(); 16284 onNavigateToPreviousEntityRecord(); 16285 }, 16286 size: "compact", 16287 initial: mountedRef.current ? { 16288 opacity: 0, 16289 transform: 'translateX(15%)' 16290 } : false // Don't show entry animation when DocumentBar mounts. 16291 , 16292 animate: { 16293 opacity: 1, 16294 transform: 'translateX(0%)' 16295 }, 16296 exit: { 16297 opacity: 0, 16298 transform: 'translateX(15%)' 16299 }, 16300 transition: isReducedMotion ? { 16301 duration: 0 16302 } : undefined, 16303 children: (0,external_wp_i18n_namespaceObject.__)('Back') 16304 }) 16305 }), !isTemplate && isTemplatePreview && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 16306 icon: library_layout, 16307 className: "editor-document-bar__icon-layout" 16308 }), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 16309 children: (0,external_wp_i18n_namespaceObject.__)('Document not found') 16310 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 16311 className: "editor-document-bar__command", 16312 onClick: () => openCommandCenter(), 16313 size: "compact", 16314 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 16315 className: "editor-document-bar__title" 16316 // Force entry animation when the back button is added or removed. 16317 , 16318 16319 initial: mountedRef.current ? { 16320 opacity: 0, 16321 transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)' 16322 } : false // Don't show entry animation when DocumentBar mounts. 16323 , 16324 animate: { 16325 opacity: 1, 16326 transform: 'translateX(0%)' 16327 }, 16328 transition: isReducedMotion ? { 16329 duration: 0 16330 } : undefined, 16331 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 16332 icon: icon 16333 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { 16334 size: "body", 16335 as: "h1", 16336 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16337 className: "editor-document-bar__post-title", 16338 children: title ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(title) : (0,external_wp_i18n_namespaceObject.__)('No title') 16339 }), pageTypeBadge && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16340 className: "editor-document-bar__post-type-label", 16341 children: `· $pageTypeBadge}` 16342 }), postTypeLabel && !props.title && !pageTypeBadge && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16343 className: "editor-document-bar__post-type-label", 16344 children: `· ${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTypeLabel)}` 16345 })] 16346 })] 16347 }, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16348 className: "editor-document-bar__shortcut", 16349 children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 16350 })] 16351 })] 16352 }); 16353 } 16354 16355 ;// external ["wp","richText"] 16356 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 16357 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 16358 /** 16359 * External dependencies 16360 */ 16361 16362 16363 const TableOfContentsItem = ({ 16364 children, 16365 isValid, 16366 level, 16367 href, 16368 onSelect 16369 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 16370 className: dist_clsx('document-outline__item', `is-$level.toLowerCase()}`, { 16371 'is-invalid': !isValid 16372 }), 16373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { 16374 href: href, 16375 className: "document-outline__button", 16376 onClick: onSelect, 16377 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16378 className: "document-outline__emdash", 16379 "aria-hidden": "true" 16380 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 16381 className: "document-outline__level", 16382 children: level 16383 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 16384 className: "document-outline__item-content", 16385 children: children 16386 })] 16387 }) 16388 }); 16389 /* harmony default export */ const document_outline_item = (TableOfContentsItem); 16390 16391 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 16392 /* wp:polyfill */ 16393 /** 16394 * WordPress dependencies 16395 */ 16396 16397 16398 16399 16400 16401 16402 16403 16404 /** 16405 * Internal dependencies 16406 */ 16407 16408 16409 16410 /** 16411 * Module constants 16412 */ 16413 16414 const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 16415 children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)') 16416 }); 16417 const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 16418 children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)') 16419 }, "incorrect-message")]; 16420 const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 16421 children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)') 16422 }, "incorrect-message-h1")]; 16423 const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 16424 children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)') 16425 }, "incorrect-message-multiple-h1")]; 16426 function EmptyOutlineIllustration() { 16427 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { 16428 width: "138", 16429 height: "148", 16430 viewBox: "0 0 138 148", 16431 fill: "none", 16432 xmlns: "http://www.w3.org/2000/svg", 16433 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 16434 width: "138", 16435 height: "148", 16436 rx: "4", 16437 fill: "#F0F6FC" 16438 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 16439 x1: "44", 16440 y1: "28", 16441 x2: "24", 16442 y2: "28", 16443 stroke: "#DDDDDD" 16444 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 16445 x: "48", 16446 y: "16", 16447 width: "27", 16448 height: "23", 16449 rx: "4", 16450 fill: "#DDDDDD" 16451 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16452 d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", 16453 fill: "black" 16454 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 16455 x1: "55", 16456 y1: "59", 16457 x2: "24", 16458 y2: "59", 16459 stroke: "#DDDDDD" 16460 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 16461 x: "59", 16462 y: "47", 16463 width: "29", 16464 height: "23", 16465 rx: "4", 16466 fill: "#DDDDDD" 16467 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16468 d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", 16469 fill: "black" 16470 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 16471 x1: "80", 16472 y1: "90", 16473 x2: "24", 16474 y2: "90", 16475 stroke: "#DDDDDD" 16476 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 16477 x: "84", 16478 y: "78", 16479 width: "30", 16480 height: "23", 16481 rx: "4", 16482 fill: "#F0B849" 16483 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16484 d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", 16485 fill: "black" 16486 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 16487 x1: "66", 16488 y1: "121", 16489 x2: "24", 16490 y2: "121", 16491 stroke: "#DDDDDD" 16492 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 16493 x: "70", 16494 y: "109", 16495 width: "29", 16496 height: "23", 16497 rx: "4", 16498 fill: "#DDDDDD" 16499 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16500 d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", 16501 fill: "black" 16502 })] 16503 }); 16504 } 16505 16506 /** 16507 * Returns an array of heading blocks enhanced with the following properties: 16508 * level - An integer with the heading level. 16509 * isEmpty - Flag indicating if the heading has no content. 16510 * 16511 * @param {?Array} blocks An array of blocks. 16512 * 16513 * @return {Array} An array of heading blocks enhanced with the properties described above. 16514 */ 16515 const computeOutlineHeadings = (blocks = []) => { 16516 return blocks.flatMap((block = {}) => { 16517 if (block.name === 'core/heading') { 16518 return { 16519 ...block, 16520 level: block.attributes.level, 16521 isEmpty: isEmptyHeading(block) 16522 }; 16523 } 16524 return computeOutlineHeadings(block.innerBlocks); 16525 }); 16526 }; 16527 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0; 16528 16529 /** 16530 * Renders a document outline component. 16531 * 16532 * @param {Object} props Props. 16533 * @param {Function} props.onSelect Function to be called when an outline item is selected 16534 * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled. 16535 * 16536 * @return {React.ReactNode} The rendered component. 16537 */ 16538 function DocumentOutline({ 16539 onSelect, 16540 hasOutlineItemsDisabled 16541 }) { 16542 const { 16543 selectBlock 16544 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 16545 const { 16546 blocks, 16547 title, 16548 isTitleSupported 16549 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16550 var _postType$supports$ti; 16551 const { 16552 getBlocks 16553 } = select(external_wp_blockEditor_namespaceObject.store); 16554 const { 16555 getEditedPostAttribute 16556 } = select(store_store); 16557 const { 16558 getPostType 16559 } = select(external_wp_coreData_namespaceObject.store); 16560 const postType = getPostType(getEditedPostAttribute('type')); 16561 return { 16562 title: getEditedPostAttribute('title'), 16563 blocks: getBlocks(), 16564 isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false 16565 }; 16566 }); 16567 const prevHeadingLevelRef = (0,external_wp_element_namespaceObject.useRef)(1); 16568 const headings = computeOutlineHeadings(blocks); 16569 if (headings.length < 1) { 16570 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16571 className: "editor-document-outline has-no-headings", 16572 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 16573 children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.') 16574 })] 16575 }); 16576 } 16577 16578 // Not great but it's the simplest way to locate the title right now. 16579 const titleNode = document.querySelector('.editor-post-title__input'); 16580 const hasTitle = isTitleSupported && title && titleNode; 16581 const countByLevel = headings.reduce((acc, heading) => ({ 16582 ...acc, 16583 [heading.level]: (acc[heading.level] || 0) + 1 16584 }), {}); 16585 const hasMultipleH1 = countByLevel[1] > 1; 16586 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 16587 className: "document-outline", 16588 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { 16589 children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, { 16590 level: (0,external_wp_i18n_namespaceObject.__)('Title'), 16591 isValid: true, 16592 onSelect: onSelect, 16593 href: `#$titleNode.id}`, 16594 isDisabled: hasOutlineItemsDisabled, 16595 children: title 16596 }), headings.map(item => { 16597 // Headings remain the same, go up by one, or down by any amount. 16598 // Otherwise there are missing levels. 16599 const isIncorrectLevel = item.level > prevHeadingLevelRef.current + 1; 16600 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 16601 prevHeadingLevelRef.current = item.level; 16602 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, { 16603 level: `H$item.level}`, 16604 isValid: isValid, 16605 isDisabled: hasOutlineItemsDisabled, 16606 href: `#block-$item.clientId}`, 16607 onSelect: () => { 16608 selectBlock(item.clientId); 16609 onSelect?.(); 16610 }, 16611 children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ 16612 html: item.attributes.content 16613 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings] 16614 }, item.clientId); 16615 })] 16616 }) 16617 }); 16618 } 16619 16620 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 16621 /** 16622 * WordPress dependencies 16623 */ 16624 16625 16626 16627 /** 16628 * Component check if there are any headings (core/heading blocks) present in the document. 16629 * 16630 * @param {Object} props Props. 16631 * @param {React.ReactNode} props.children Children to be rendered. 16632 * 16633 * @return {React.ReactNode} The component to be rendered or null if there are headings. 16634 */ 16635 function DocumentOutlineCheck({ 16636 children 16637 }) { 16638 const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => { 16639 const { 16640 getGlobalBlockCount 16641 } = select(external_wp_blockEditor_namespaceObject.store); 16642 return getGlobalBlockCount('core/heading') > 0; 16643 }); 16644 if (!hasHeadings) { 16645 return null; 16646 } 16647 return children; 16648 } 16649 16650 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 16651 /** 16652 * WordPress dependencies 16653 */ 16654 16655 16656 16657 16658 16659 16660 16661 /** 16662 * Component for registering editor keyboard shortcuts. 16663 * 16664 * @return {Element} The component to be rendered. 16665 */ 16666 16667 function EditorKeyboardShortcutsRegister() { 16668 // Registering the shortcuts. 16669 const { 16670 registerShortcut 16671 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 16672 (0,external_wp_element_namespaceObject.useEffect)(() => { 16673 registerShortcut({ 16674 name: 'core/editor/toggle-mode', 16675 category: 'global', 16676 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), 16677 keyCombination: { 16678 modifier: 'secondary', 16679 character: 'm' 16680 } 16681 }); 16682 registerShortcut({ 16683 name: 'core/editor/save', 16684 category: 'global', 16685 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 16686 keyCombination: { 16687 modifier: 'primary', 16688 character: 's' 16689 } 16690 }); 16691 registerShortcut({ 16692 name: 'core/editor/undo', 16693 category: 'global', 16694 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 16695 keyCombination: { 16696 modifier: 'primary', 16697 character: 'z' 16698 } 16699 }); 16700 registerShortcut({ 16701 name: 'core/editor/redo', 16702 category: 'global', 16703 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 16704 keyCombination: { 16705 modifier: 'primaryShift', 16706 character: 'z' 16707 }, 16708 // Disable on Apple OS because it conflicts with the browser's 16709 // history shortcut. It's a fine alias for both Windows and Linux. 16710 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 16711 // Linux, we keep it as the default for consistency. 16712 aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ 16713 modifier: 'primary', 16714 character: 'y' 16715 }] 16716 }); 16717 registerShortcut({ 16718 name: 'core/editor/toggle-list-view', 16719 category: 'global', 16720 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the List View.'), 16721 keyCombination: { 16722 modifier: 'access', 16723 character: 'o' 16724 } 16725 }); 16726 registerShortcut({ 16727 name: 'core/editor/toggle-distraction-free', 16728 category: 'global', 16729 description: (0,external_wp_i18n_namespaceObject.__)('Enter or exit distraction free mode.'), 16730 keyCombination: { 16731 modifier: 'primaryShift', 16732 character: '\\' 16733 } 16734 }); 16735 registerShortcut({ 16736 name: 'core/editor/toggle-sidebar', 16737 category: 'global', 16738 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings panel.'), 16739 keyCombination: { 16740 modifier: 'primaryShift', 16741 character: ',' 16742 } 16743 }); 16744 registerShortcut({ 16745 name: 'core/editor/keyboard-shortcuts', 16746 category: 'main', 16747 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 16748 keyCombination: { 16749 modifier: 'access', 16750 character: 'h' 16751 } 16752 }); 16753 registerShortcut({ 16754 name: 'core/editor/next-region', 16755 category: 'global', 16756 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 16757 keyCombination: { 16758 modifier: 'ctrl', 16759 character: '`' 16760 }, 16761 aliases: [{ 16762 modifier: 'access', 16763 character: 'n' 16764 }] 16765 }); 16766 registerShortcut({ 16767 name: 'core/editor/previous-region', 16768 category: 'global', 16769 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 16770 keyCombination: { 16771 modifier: 'ctrlShift', 16772 character: '`' 16773 }, 16774 aliases: [{ 16775 modifier: 'access', 16776 character: 'p' 16777 }, { 16778 modifier: 'ctrlShift', 16779 character: '~' 16780 }] 16781 }); 16782 }, [registerShortcut]); 16783 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); 16784 } 16785 /* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister); 16786 16787 ;// ./node_modules/@wordpress/icons/build-module/library/redo.js 16788 /** 16789 * WordPress dependencies 16790 */ 16791 16792 16793 const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 16794 xmlns: "http://www.w3.org/2000/svg", 16795 viewBox: "0 0 24 24", 16796 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 16797 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" 16798 }) 16799 }); 16800 /* harmony default export */ const library_redo = (redo_redo); 16801 16802 ;// ./node_modules/@wordpress/icons/build-module/library/undo.js 16803 /** 16804 * WordPress dependencies 16805 */ 16806 16807 16808 const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 16809 xmlns: "http://www.w3.org/2000/svg", 16810 viewBox: "0 0 24 24", 16811 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 16812 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" 16813 }) 16814 }); 16815 /* harmony default export */ const library_undo = (undo_undo); 16816 16817 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 16818 /** 16819 * WordPress dependencies 16820 */ 16821 16822 16823 16824 16825 16826 16827 16828 /** 16829 * Internal dependencies 16830 */ 16831 16832 16833 function EditorHistoryRedo(props, ref) { 16834 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); 16835 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); 16836 const { 16837 redo 16838 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16839 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 16840 __next40pxDefaultSize: true, 16841 ...props, 16842 ref: ref, 16843 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo 16844 /* translators: button label text should, if possible, be under 16 characters. */, 16845 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 16846 shortcut: shortcut 16847 // If there are no redo levels we don't want to actually disable this 16848 // button, because it will remove focus for keyboard users. 16849 // See: https://github.com/WordPress/gutenberg/issues/3486 16850 , 16851 "aria-disabled": !hasRedo, 16852 onClick: hasRedo ? redo : undefined, 16853 className: "editor-history__redo" 16854 }); 16855 } 16856 16857 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 16858 16859 /** 16860 * Renders the redo button for the editor history. 16861 * 16862 * @param {Object} props - Props. 16863 * @param {Ref} ref - Forwarded ref. 16864 * 16865 * @return {React.ReactNode} The rendered component. 16866 */ 16867 /* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); 16868 16869 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 16870 /** 16871 * WordPress dependencies 16872 */ 16873 16874 16875 16876 16877 16878 16879 16880 /** 16881 * Internal dependencies 16882 */ 16883 16884 16885 function EditorHistoryUndo(props, ref) { 16886 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); 16887 const { 16888 undo 16889 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16890 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 16891 __next40pxDefaultSize: true, 16892 ...props, 16893 ref: ref, 16894 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo 16895 /* translators: button label text should, if possible, be under 16 characters. */, 16896 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 16897 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') 16898 // If there are no undo levels we don't want to actually disable this 16899 // button, because it will remove focus for keyboard users. 16900 // See: https://github.com/WordPress/gutenberg/issues/3486 16901 , 16902 "aria-disabled": !hasUndo, 16903 onClick: hasUndo ? undo : undefined, 16904 className: "editor-history__undo" 16905 }); 16906 } 16907 16908 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 16909 16910 /** 16911 * Renders the undo button for the editor history. 16912 * 16913 * @param {Object} props - Props. 16914 * @param {Ref} ref - Forwarded ref. 16915 * 16916 * @return {React.ReactNode} The rendered component. 16917 */ 16918 /* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); 16919 16920 ;// ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 16921 /** 16922 * WordPress dependencies 16923 */ 16924 16925 16926 16927 16928 16929 16930 function TemplateValidationNotice() { 16931 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 16932 const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => { 16933 return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); 16934 }, []); 16935 const { 16936 setTemplateValidity, 16937 synchronizeTemplate 16938 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 16939 if (isValid) { 16940 return null; 16941 } 16942 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 16943 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 16944 className: "editor-template-validation-notice", 16945 isDismissible: false, 16946 status: "warning", 16947 actions: [{ 16948 label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), 16949 onClick: () => setTemplateValidity(true) 16950 }, { 16951 label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), 16952 onClick: () => setShowConfirmDialog(true) 16953 }], 16954 children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.') 16955 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 16956 isOpen: showConfirmDialog, 16957 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'), 16958 onConfirm: () => { 16959 setShowConfirmDialog(false); 16960 synchronizeTemplate(); 16961 }, 16962 onCancel: () => setShowConfirmDialog(false), 16963 size: "medium", 16964 children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?') 16965 })] 16966 }); 16967 } 16968 16969 ;// ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 16970 /* wp:polyfill */ 16971 /** 16972 * WordPress dependencies 16973 */ 16974 16975 16976 16977 16978 /** 16979 * Internal dependencies 16980 */ 16981 16982 16983 /** 16984 * This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible 16985 * 16986 * @example 16987 * ```jsx 16988 * <EditorNotices /> 16989 * ``` 16990 * 16991 * @return {React.ReactNode} The rendered EditorNotices component. 16992 */ 16993 16994 function EditorNotices() { 16995 const { 16996 notices 16997 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 16998 notices: select(external_wp_notices_namespaceObject.store).getNotices() 16999 }), []); 17000 const { 17001 removeNotice 17002 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 17003 const dismissibleNotices = notices.filter(({ 17004 isDismissible, 17005 type 17006 }) => isDismissible && type === 'default'); 17007 const nonDismissibleNotices = notices.filter(({ 17008 isDismissible, 17009 type 17010 }) => !isDismissible && type === 'default'); 17011 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 17012 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 17013 notices: nonDismissibleNotices, 17014 className: "components-editor-notices__pinned" 17015 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 17016 notices: dismissibleNotices, 17017 className: "components-editor-notices__dismissible", 17018 onRemove: removeNotice, 17019 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) 17020 })] 17021 }); 17022 } 17023 /* harmony default export */ const editor_notices = (EditorNotices); 17024 17025 ;// ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js 17026 /* wp:polyfill */ 17027 /** 17028 * WordPress dependencies 17029 */ 17030 17031 17032 17033 17034 // Last three notices. Slices from the tail end of the list. 17035 17036 const MAX_VISIBLE_NOTICES = -3; 17037 17038 /** 17039 * Renders the editor snackbars component. 17040 * 17041 * @return {React.ReactNode} The rendered component. 17042 */ 17043 function EditorSnackbars() { 17044 const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []); 17045 const { 17046 removeNotice 17047 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 17048 const snackbarNotices = notices.filter(({ 17049 type 17050 }) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES); 17051 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, { 17052 notices: snackbarNotices, 17053 className: "components-editor-notices__snackbar", 17054 onRemove: removeNotice 17055 }); 17056 } 17057 17058 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js 17059 /** 17060 * WordPress dependencies 17061 */ 17062 17063 17064 17065 17066 17067 17068 /** 17069 * Internal dependencies 17070 */ 17071 17072 17073 17074 17075 function EntityRecordItem({ 17076 record, 17077 checked, 17078 onChange 17079 }) { 17080 const { 17081 name, 17082 kind, 17083 title, 17084 key 17085 } = record; 17086 17087 // Handle templates that might use default descriptive titles. 17088 const { 17089 entityRecordTitle, 17090 hasPostMetaChanges 17091 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17092 var _select$getEntityReco; 17093 if ('postType' !== kind || 'wp_template' !== name) { 17094 return { 17095 entityRecordTitle: title, 17096 hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) 17097 }; 17098 } 17099 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); 17100 const { 17101 default_template_types: templateTypes = [] 17102 } = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {}; 17103 return { 17104 entityRecordTitle: getTemplateInfo({ 17105 template, 17106 templateTypes 17107 }).title, 17108 hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) 17109 }; 17110 }, [name, kind, title, key]); 17111 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 17112 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 17113 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 17114 __nextHasNoMarginBottom: true, 17115 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'), 17116 checked: checked, 17117 onChange: onChange 17118 }) 17119 }), hasPostMetaChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 17120 className: "entities-saved-states__changes", 17121 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 17122 children: (0,external_wp_i18n_namespaceObject.__)('Post Meta.') 17123 }) 17124 })] 17125 }); 17126 } 17127 17128 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js 17129 /* wp:polyfill */ 17130 /** 17131 * WordPress dependencies 17132 */ 17133 17134 17135 17136 17137 17138 17139 17140 /** 17141 * Internal dependencies 17142 */ 17143 17144 17145 17146 const { 17147 getGlobalStylesChanges, 17148 GlobalStylesContext: entity_type_list_GlobalStylesContext 17149 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 17150 function getEntityDescription(entity, count) { 17151 switch (entity) { 17152 case 'site': 17153 return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.'); 17154 case 'wp_template': 17155 return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.'); 17156 case 'page': 17157 case 'post': 17158 return (0,external_wp_i18n_namespaceObject.__)('The following has been modified.'); 17159 } 17160 } 17161 function GlobalStylesDescription({ 17162 record 17163 }) { 17164 const { 17165 user: currentEditorGlobalStyles 17166 } = (0,external_wp_element_namespaceObject.useContext)(entity_type_list_GlobalStylesContext); 17167 const savedRecord = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord(record.kind, record.name, record.key), [record.kind, record.name, record.key]); 17168 const globalStylesChanges = getGlobalStylesChanges(currentEditorGlobalStyles, savedRecord, { 17169 maxResults: 10 17170 }); 17171 return globalStylesChanges.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 17172 className: "entities-saved-states__changes", 17173 children: globalStylesChanges.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 17174 children: change 17175 }, change)) 17176 }) : null; 17177 } 17178 function EntityDescription({ 17179 record, 17180 count 17181 }) { 17182 if ('globalStyles' === record?.name) { 17183 return null; 17184 } 17185 const description = getEntityDescription(record?.name, count); 17186 return description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 17187 children: description 17188 }) : null; 17189 } 17190 function EntityTypeList({ 17191 list, 17192 unselectedEntities, 17193 setUnselectedEntities 17194 }) { 17195 const count = list.length; 17196 const firstRecord = list[0]; 17197 const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); 17198 let entityLabel = entityConfig.label; 17199 if (firstRecord?.name === 'wp_template_part') { 17200 entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'); 17201 } 17202 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 17203 title: entityLabel, 17204 initialOpen: true, 17205 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, { 17206 record: firstRecord, 17207 count: count 17208 }), list.map(record => { 17209 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, { 17210 record: record, 17211 checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), 17212 onChange: value => setUnselectedEntities(record, value) 17213 }, record.key || record.property); 17214 }), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, { 17215 record: firstRecord 17216 })] 17217 }); 17218 } 17219 17220 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js 17221 /* wp:polyfill */ 17222 /** 17223 * WordPress dependencies 17224 */ 17225 17226 17227 17228 17229 /** 17230 * Custom hook that determines if any entities are dirty (edited) and provides a way to manage selected/unselected entities. 17231 * 17232 * @return {Object} An object containing the following properties: 17233 * - dirtyEntityRecords: An array of dirty entity records. 17234 * - isDirty: A boolean indicating if there are any dirty entity records. 17235 * - setUnselectedEntities: A function to set the unselected entities. 17236 * - unselectedEntities: An array of unselected entities. 17237 */ 17238 const useIsDirty = () => { 17239 const { 17240 editedEntities, 17241 siteEdits, 17242 siteEntityConfig 17243 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17244 const { 17245 __experimentalGetDirtyEntityRecords, 17246 getEntityRecordEdits, 17247 getEntityConfig 17248 } = select(external_wp_coreData_namespaceObject.store); 17249 return { 17250 editedEntities: __experimentalGetDirtyEntityRecords(), 17251 siteEdits: getEntityRecordEdits('root', 'site'), 17252 siteEntityConfig: getEntityConfig('root', 'site') 17253 }; 17254 }, []); 17255 const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { 17256 var _siteEntityConfig$met; 17257 // Remove site object and decouple into its edited pieces. 17258 const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site')); 17259 const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {}; 17260 const editedSiteEntities = []; 17261 for (const property in siteEdits) { 17262 editedSiteEntities.push({ 17263 kind: 'root', 17264 name: 'site', 17265 title: siteEntityLabels[property] || property, 17266 property 17267 }); 17268 } 17269 return [...editedEntitiesWithoutSite, ...editedSiteEntities]; 17270 }, [editedEntities, siteEdits, siteEntityConfig]); 17271 17272 // Unchecked entities to be ignored by save function. 17273 const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); 17274 const setUnselectedEntities = ({ 17275 kind, 17276 name, 17277 key, 17278 property 17279 }, checked) => { 17280 if (checked) { 17281 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); 17282 } else { 17283 _setUnselectedEntities([...unselectedEntities, { 17284 kind, 17285 name, 17286 key, 17287 property 17288 }]); 17289 } 17290 }; 17291 const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0; 17292 return { 17293 dirtyEntityRecords, 17294 isDirty, 17295 setUnselectedEntities, 17296 unselectedEntities 17297 }; 17298 }; 17299 17300 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js 17301 /* wp:polyfill */ 17302 /** 17303 * WordPress dependencies 17304 */ 17305 17306 17307 17308 17309 17310 17311 /** 17312 * Internal dependencies 17313 */ 17314 17315 17316 17317 17318 17319 function identity(values) { 17320 return values; 17321 } 17322 17323 /** 17324 * Renders the component for managing saved states of entities. 17325 * 17326 * @param {Object} props The component props. 17327 * @param {Function} props.close The function to close the dialog. 17328 * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior. 17329 * 17330 * @return {React.ReactNode} The rendered component. 17331 */ 17332 function EntitiesSavedStates({ 17333 close, 17334 renderDialog 17335 }) { 17336 const isDirtyProps = useIsDirty(); 17337 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { 17338 close: close, 17339 renderDialog: renderDialog, 17340 ...isDirtyProps 17341 }); 17342 } 17343 17344 /** 17345 * Renders a panel for saving entities with dirty records. 17346 * 17347 * @param {Object} props The component props. 17348 * @param {string} props.additionalPrompt Additional prompt to display. 17349 * @param {Function} props.close Function to close the panel. 17350 * @param {Function} props.onSave Function to call when saving entities. 17351 * @param {boolean} props.saveEnabled Flag indicating if save is enabled. 17352 * @param {string} props.saveLabel Label for the save button. 17353 * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior. 17354 * @param {Array} props.dirtyEntityRecords Array of dirty entity records. 17355 * @param {boolean} props.isDirty Flag indicating if there are dirty entities. 17356 * @param {Function} props.setUnselectedEntities Function to set unselected entities. 17357 * @param {Array} props.unselectedEntities Array of unselected entities. 17358 * 17359 * @return {React.ReactNode} The rendered component. 17360 */ 17361 function EntitiesSavedStatesExtensible({ 17362 additionalPrompt = undefined, 17363 close, 17364 onSave = identity, 17365 saveEnabled: saveEnabledProp = undefined, 17366 saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'), 17367 renderDialog, 17368 dirtyEntityRecords, 17369 isDirty, 17370 setUnselectedEntities, 17371 unselectedEntities 17372 }) { 17373 const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 17374 const { 17375 saveDirtyEntities 17376 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 17377 // To group entities by type. 17378 const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => { 17379 const { 17380 name 17381 } = record; 17382 if (!acc[name]) { 17383 acc[name] = []; 17384 } 17385 acc[name].push(record); 17386 return acc; 17387 }, {}); 17388 17389 // Sort entity groups. 17390 const { 17391 site: siteSavables, 17392 wp_template: templateSavables, 17393 wp_template_part: templatePartSavables, 17394 ...contentSavables 17395 } = partitionedSavables; 17396 const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); 17397 const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty; 17398 // Explicitly define this with no argument passed. Using `close` on 17399 // its own will use the event object in place of the expected saved entities. 17400 const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); 17401 const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ 17402 onClose: () => dismissPanel() 17403 }); 17404 const dialogLabel = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'label'); 17405 const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'description'); 17406 const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.') : undefined; 17407 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 17408 ref: renderDialog ? saveDialogRef : undefined, 17409 ...(renderDialog && saveDialogProps), 17410 className: "entities-saved-states__panel", 17411 role: renderDialog ? 'dialog' : undefined, 17412 "aria-labelledby": renderDialog ? dialogLabel : undefined, 17413 "aria-describedby": renderDialog ? dialogDescription : undefined, 17414 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 17415 className: "entities-saved-states__panel-header", 17416 gap: 2, 17417 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 17418 isBlock: true, 17419 as: external_wp_components_namespaceObject.Button, 17420 variant: "secondary", 17421 size: "compact", 17422 onClick: dismissPanel, 17423 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 17424 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 17425 isBlock: true, 17426 as: external_wp_components_namespaceObject.Button, 17427 ref: saveButtonRef, 17428 variant: "primary", 17429 size: "compact", 17430 disabled: !saveEnabled, 17431 accessibleWhenDisabled: true, 17432 onClick: () => saveDirtyEntities({ 17433 onSave, 17434 dirtyEntityRecords, 17435 entitiesToSkip: unselectedEntities, 17436 close 17437 }), 17438 className: "editor-entities-saved-states__save-button", 17439 children: saveLabel 17440 })] 17441 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 17442 className: "entities-saved-states__text-prompt", 17443 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 17444 className: "entities-saved-states__text-prompt--header-wrapper", 17445 id: renderDialog ? dialogLabel : undefined, 17446 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 17447 className: "entities-saved-states__text-prompt--header", 17448 children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?') 17449 }), additionalPrompt] 17450 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 17451 id: renderDialog ? dialogDescription : undefined, 17452 children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of site changes waiting to be saved. */ 17453 (0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', dirtyEntityRecords.length), dirtyEntityRecords.length), { 17454 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}) 17455 }) : selectItemsToSaveDescription 17456 })] 17457 }), sortedPartitionedSavables.map(list => { 17458 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, { 17459 list: list, 17460 unselectedEntities: unselectedEntities, 17461 setUnselectedEntities: setUnselectedEntities 17462 }, list[0].name); 17463 })] 17464 }); 17465 } 17466 17467 ;// ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js 17468 /** 17469 * WordPress dependencies 17470 */ 17471 17472 17473 17474 17475 17476 17477 17478 /** 17479 * Internal dependencies 17480 */ 17481 17482 17483 function getContent() { 17484 try { 17485 // While `select` in a component is generally discouraged, it is 17486 // used here because it (a) reduces the chance of data loss in the 17487 // case of additional errors by performing a direct retrieval and 17488 // (b) avoids the performance cost associated with unnecessary 17489 // content serialization throughout the lifetime of a non-erroring 17490 // application. 17491 return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); 17492 } catch (error) {} 17493 } 17494 function CopyButton({ 17495 text, 17496 children, 17497 variant = 'secondary' 17498 }) { 17499 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 17500 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 17501 __next40pxDefaultSize: true, 17502 variant: variant, 17503 ref: ref, 17504 children: children 17505 }); 17506 } 17507 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 17508 constructor() { 17509 super(...arguments); 17510 this.state = { 17511 error: null 17512 }; 17513 } 17514 componentDidCatch(error) { 17515 (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); 17516 } 17517 static getDerivedStateFromError(error) { 17518 return { 17519 error 17520 }; 17521 } 17522 render() { 17523 const { 17524 error 17525 } = this.state; 17526 const { 17527 canCopyContent = false 17528 } = this.props; 17529 if (!error) { 17530 return this.props.children; 17531 } 17532 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 17533 className: "editor-error-boundary", 17534 alignment: "baseline", 17535 spacing: 4, 17536 justify: "space-between", 17537 expanded: false, 17538 wrap: true, 17539 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 17540 as: "p", 17541 children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.') 17542 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 17543 expanded: false, 17544 children: [canCopyContent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { 17545 text: getContent, 17546 children: (0,external_wp_i18n_namespaceObject.__)('Copy contents') 17547 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { 17548 variant: "primary", 17549 text: error?.stack, 17550 children: (0,external_wp_i18n_namespaceObject.__)('Copy error') 17551 })] 17552 })] 17553 }); 17554 } 17555 } 17556 17557 /** 17558 * ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI. 17559 * 17560 * It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree. 17561 * 17562 * getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information. 17563 * 17564 * @class ErrorBoundary 17565 * @augments Component 17566 */ 17567 /* harmony default export */ const error_boundary = (ErrorBoundary); 17568 17569 ;// ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js 17570 /* wp:polyfill */ 17571 /** 17572 * WordPress dependencies 17573 */ 17574 17575 17576 17577 17578 17579 17580 17581 /** 17582 * Internal dependencies 17583 */ 17584 17585 17586 17587 17588 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; 17589 let hasStorageSupport; 17590 17591 /** 17592 * Function which returns true if the current environment supports browser 17593 * sessionStorage, or false otherwise. The result of this function is cached and 17594 * reused in subsequent invocations. 17595 */ 17596 const hasSessionStorageSupport = () => { 17597 if (hasStorageSupport !== undefined) { 17598 return hasStorageSupport; 17599 } 17600 try { 17601 // Private Browsing in Safari 10 and earlier will throw an error when 17602 // attempting to set into sessionStorage. The test here is intentional in 17603 // causing a thrown error as condition bailing from local autosave. 17604 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); 17605 window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); 17606 hasStorageSupport = true; 17607 } catch { 17608 hasStorageSupport = false; 17609 } 17610 return hasStorageSupport; 17611 }; 17612 17613 /** 17614 * Custom hook which manages the creation of a notice prompting the user to 17615 * restore a local autosave, if one exists. 17616 */ 17617 function useAutosaveNotice() { 17618 const { 17619 postId, 17620 isEditedPostNew, 17621 hasRemoteAutosave 17622 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 17623 postId: select(store_store).getCurrentPostId(), 17624 isEditedPostNew: select(store_store).isEditedPostNew(), 17625 hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave 17626 }), []); 17627 const { 17628 getEditedPostAttribute 17629 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 17630 const { 17631 createWarningNotice, 17632 removeNotice 17633 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 17634 const { 17635 editPost, 17636 resetEditorBlocks 17637 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17638 (0,external_wp_element_namespaceObject.useEffect)(() => { 17639 let localAutosave = localAutosaveGet(postId, isEditedPostNew); 17640 if (!localAutosave) { 17641 return; 17642 } 17643 try { 17644 localAutosave = JSON.parse(localAutosave); 17645 } catch { 17646 // Not usable if it can't be parsed. 17647 return; 17648 } 17649 const { 17650 post_title: title, 17651 content, 17652 excerpt 17653 } = localAutosave; 17654 const edits = { 17655 title, 17656 content, 17657 excerpt 17658 }; 17659 { 17660 // Only display a notice if there is a difference between what has been 17661 // saved and that which is stored in sessionStorage. 17662 const hasDifference = Object.keys(edits).some(key => { 17663 return edits[key] !== getEditedPostAttribute(key); 17664 }); 17665 if (!hasDifference) { 17666 // If there is no difference, it can be safely ejected from storage. 17667 localAutosaveClear(postId, isEditedPostNew); 17668 return; 17669 } 17670 } 17671 if (hasRemoteAutosave) { 17672 return; 17673 } 17674 const id = 'wpEditorAutosaveRestore'; 17675 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), { 17676 id, 17677 actions: [{ 17678 label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'), 17679 onClick() { 17680 const { 17681 content: editsContent, 17682 ...editsWithoutContent 17683 } = edits; 17684 editPost(editsWithoutContent); 17685 resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); 17686 removeNotice(id); 17687 } 17688 }] 17689 }); 17690 }, [isEditedPostNew, postId]); 17691 } 17692 17693 /** 17694 * Custom hook which ejects a local autosave after a successful save occurs. 17695 */ 17696 function useAutosavePurge() { 17697 const { 17698 postId, 17699 isEditedPostNew, 17700 isDirty, 17701 isAutosaving, 17702 didError 17703 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 17704 postId: select(store_store).getCurrentPostId(), 17705 isEditedPostNew: select(store_store).isEditedPostNew(), 17706 isDirty: select(store_store).isEditedPostDirty(), 17707 isAutosaving: select(store_store).isAutosavingPost(), 17708 didError: select(store_store).didPostSaveRequestFail() 17709 }), []); 17710 const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty); 17711 const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); 17712 (0,external_wp_element_namespaceObject.useEffect)(() => { 17713 if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) { 17714 localAutosaveClear(postId, isEditedPostNew); 17715 } 17716 lastIsDirtyRef.current = isDirty; 17717 lastIsAutosavingRef.current = isAutosaving; 17718 }, [isDirty, isAutosaving, didError]); 17719 17720 // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. 17721 const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); 17722 const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); 17723 (0,external_wp_element_namespaceObject.useEffect)(() => { 17724 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { 17725 localAutosaveClear(postId, true); 17726 } 17727 }, [isEditedPostNew, postId]); 17728 } 17729 function LocalAutosaveMonitor() { 17730 const { 17731 autosave 17732 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17733 const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { 17734 requestIdleCallback(() => autosave({ 17735 local: true 17736 })); 17737 }, []); 17738 useAutosaveNotice(); 17739 useAutosavePurge(); 17740 const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []); 17741 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, { 17742 interval: localAutosaveInterval, 17743 autosave: deferredAutosave 17744 }); 17745 } 17746 17747 /** 17748 * Monitors local autosaves of a post in the editor. 17749 * It uses several hooks and functions to manage autosave behavior: 17750 * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists. 17751 * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs. 17752 * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage. 17753 * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval. 17754 * 17755 * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that. 17756 * 17757 * @module LocalAutosaveMonitor 17758 */ 17759 /* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor)); 17760 17761 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js 17762 /** 17763 * WordPress dependencies 17764 */ 17765 17766 17767 17768 /** 17769 * Internal dependencies 17770 */ 17771 17772 17773 /** 17774 * Wrapper component that renders its children only if the post type supports page attributes. 17775 * 17776 * @param {Object} props - The component props. 17777 * @param {React.ReactNode} props.children - The child components to render. 17778 * 17779 * @return {React.ReactNode} The rendered child components or null if page attributes are not supported. 17780 */ 17781 function PageAttributesCheck({ 17782 children 17783 }) { 17784 const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => { 17785 const { 17786 getEditedPostAttribute 17787 } = select(store_store); 17788 const { 17789 getPostType 17790 } = select(external_wp_coreData_namespaceObject.store); 17791 const postType = getPostType(getEditedPostAttribute('type')); 17792 return !!postType?.supports?.['page-attributes']; 17793 }, []); 17794 17795 // Only render fields if post type supports page attributes or available templates exist. 17796 if (!supportsPageAttributes) { 17797 return null; 17798 } 17799 return children; 17800 } 17801 /* harmony default export */ const page_attributes_check = (PageAttributesCheck); 17802 17803 ;// ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js 17804 /* wp:polyfill */ 17805 /** 17806 * WordPress dependencies 17807 */ 17808 17809 17810 17811 /** 17812 * Internal dependencies 17813 */ 17814 17815 17816 /** 17817 * A component which renders its own children only if the current editor post 17818 * type supports one of the given `supportKeys` prop. 17819 * 17820 * @param {Object} props Props. 17821 * @param {React.ReactNode} props.children Children to be rendered if post 17822 * type supports. 17823 * @param {(string|string[])} props.supportKeys String or string array of keys 17824 * to test. 17825 * 17826 * @return {React.ReactNode} The component to be rendered. 17827 */ 17828 function PostTypeSupportCheck({ 17829 children, 17830 supportKeys 17831 }) { 17832 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 17833 const { 17834 getEditedPostAttribute 17835 } = select(store_store); 17836 const { 17837 getPostType 17838 } = select(external_wp_coreData_namespaceObject.store); 17839 return getPostType(getEditedPostAttribute('type')); 17840 }, []); 17841 let isSupported = !!postType; 17842 if (postType) { 17843 isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]); 17844 } 17845 if (!isSupported) { 17846 return null; 17847 } 17848 return children; 17849 } 17850 /* harmony default export */ const post_type_support_check = (PostTypeSupportCheck); 17851 17852 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js 17853 /** 17854 * WordPress dependencies 17855 */ 17856 17857 17858 17859 17860 17861 /** 17862 * Internal dependencies 17863 */ 17864 17865 17866 17867 function PageAttributesOrder() { 17868 const order = (0,external_wp_data_namespaceObject.useSelect)(select => { 17869 var _select$getEditedPost; 17870 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0; 17871 }, []); 17872 const { 17873 editPost 17874 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17875 const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); 17876 const setUpdatedOrder = value => { 17877 setOrderInput(value); 17878 const newOrder = Number(value); 17879 if (Number.isInteger(newOrder) && value.trim?.() !== '') { 17880 editPost({ 17881 menu_order: newOrder 17882 }); 17883 } 17884 }; 17885 const value = orderInput !== null && orderInput !== void 0 ? orderInput : order; 17886 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 17887 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 17888 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 17889 __next40pxDefaultSize: true, 17890 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 17891 help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'), 17892 value: value, 17893 onChange: setUpdatedOrder, 17894 hideLabelFromVision: true, 17895 onBlur: () => { 17896 setOrderInput(null); 17897 } 17898 }) 17899 }) 17900 }); 17901 } 17902 17903 /** 17904 * Renders the Page Attributes Order component. A number input in an editor interface 17905 * for setting the order of a given page. 17906 * The component is now not used in core but was kept for backward compatibility. 17907 * 17908 * @return {React.ReactNode} The rendered component. 17909 */ 17910 function PageAttributesOrderWithChecks() { 17911 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 17912 supportKeys: "page-attributes", 17913 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {}) 17914 }); 17915 } 17916 17917 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js 17918 /** 17919 * External dependencies 17920 */ 17921 17922 17923 /** 17924 * WordPress dependencies 17925 */ 17926 17927 17928 17929 const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({ 17930 className, 17931 label, 17932 children 17933 }, ref) => { 17934 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 17935 className: dist_clsx('editor-post-panel__row', className), 17936 ref: ref, 17937 children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 17938 className: "editor-post-panel__row-label", 17939 children: label 17940 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 17941 className: "editor-post-panel__row-control", 17942 children: children 17943 })] 17944 }); 17945 }); 17946 /* harmony default export */ const post_panel_row = (PostPanelRow); 17947 17948 ;// ./node_modules/@wordpress/editor/build-module/utils/terms.js 17949 /* wp:polyfill */ 17950 /** 17951 * WordPress dependencies 17952 */ 17953 17954 17955 /** 17956 * Returns terms in a tree form. 17957 * 17958 * @param {Array} flatTerms Array of terms in flat format. 17959 * 17960 * @return {Array} Array of terms in tree format. 17961 */ 17962 function terms_buildTermsTree(flatTerms) { 17963 const flatTermsWithParentAndChildren = flatTerms.map(term => { 17964 return { 17965 children: [], 17966 parent: undefined, 17967 ...term 17968 }; 17969 }); 17970 17971 // All terms should have a `parent` because we're about to index them by it. 17972 if (flatTermsWithParentAndChildren.some(({ 17973 parent 17974 }) => parent === undefined)) { 17975 return flatTermsWithParentAndChildren; 17976 } 17977 const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { 17978 const { 17979 parent 17980 } = term; 17981 if (!acc[parent]) { 17982 acc[parent] = []; 17983 } 17984 acc[parent].push(term); 17985 return acc; 17986 }, {}); 17987 const fillWithChildren = terms => { 17988 return terms.map(term => { 17989 const children = termsByParent[term.id]; 17990 return { 17991 ...term, 17992 children: children && children.length ? fillWithChildren(children) : [] 17993 }; 17994 }); 17995 }; 17996 return fillWithChildren(termsByParent['0'] || []); 17997 } 17998 const unescapeString = arg => { 17999 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); 18000 }; 18001 18002 /** 18003 * Returns a term object with name unescaped. 18004 * 18005 * @param {Object} term The term object to unescape. 18006 * 18007 * @return {Object} Term object with name property unescaped. 18008 */ 18009 const unescapeTerm = term => { 18010 return { 18011 ...term, 18012 name: unescapeString(term.name) 18013 }; 18014 }; 18015 18016 /** 18017 * Returns an array of term objects with names unescaped. 18018 * The unescape of each term is performed using the unescapeTerm function. 18019 * 18020 * @param {Object[]} terms Array of term objects to unescape. 18021 * 18022 * @return {Object[]} Array of term objects unescaped. 18023 */ 18024 const unescapeTerms = terms => { 18025 return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm); 18026 }; 18027 18028 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js 18029 /* wp:polyfill */ 18030 /** 18031 * External dependencies 18032 */ 18033 18034 18035 /** 18036 * WordPress dependencies 18037 */ 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 /** 18049 * Internal dependencies 18050 */ 18051 18052 18053 18054 18055 function getTitle(post) { 18056 return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; 18057 } 18058 const parent_getItemPriority = (name, searchValue) => { 18059 const normalizedName = remove_accents_default()(name || '').toLowerCase(); 18060 const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase(); 18061 if (normalizedName === normalizedSearch) { 18062 return 0; 18063 } 18064 if (normalizedName.startsWith(normalizedSearch)) { 18065 return normalizedName.length; 18066 } 18067 return Infinity; 18068 }; 18069 18070 /** 18071 * Renders the Page Attributes Parent component. A dropdown menu in an editor interface 18072 * for selecting the parent page of a given page. 18073 * 18074 * @return {React.ReactNode} The component to be rendered. Return null if post type is not hierarchical. 18075 */ 18076 function parent_PageAttributesParent() { 18077 const { 18078 editPost 18079 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18080 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); 18081 const { 18082 isHierarchical, 18083 parentPostId, 18084 parentPostTitle, 18085 pageItems 18086 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18087 var _pType$hierarchical; 18088 const { 18089 getPostType, 18090 getEntityRecords, 18091 getEntityRecord 18092 } = select(external_wp_coreData_namespaceObject.store); 18093 const { 18094 getCurrentPostId, 18095 getEditedPostAttribute 18096 } = select(store_store); 18097 const postTypeSlug = getEditedPostAttribute('type'); 18098 const pageId = getEditedPostAttribute('parent'); 18099 const pType = getPostType(postTypeSlug); 18100 const postId = getCurrentPostId(); 18101 const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false; 18102 const query = { 18103 per_page: 100, 18104 exclude: postId, 18105 parent_exclude: postId, 18106 orderby: 'menu_order', 18107 order: 'asc', 18108 _fields: 'id,title,parent' 18109 }; 18110 18111 // Perform a search when the field is changed. 18112 if (!!fieldValue) { 18113 query.search = fieldValue; 18114 } 18115 const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null; 18116 return { 18117 isHierarchical: postIsHierarchical, 18118 parentPostId: pageId, 18119 parentPostTitle: parentPost ? getTitle(parentPost) : '', 18120 pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null 18121 }; 18122 }, [fieldValue]); 18123 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 18124 const getOptionsFromTree = (tree, level = 0) => { 18125 const mappedNodes = tree.map(treeNode => [{ 18126 value: treeNode.id, 18127 label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), 18128 rawName: treeNode.name 18129 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); 18130 const sortedNodes = mappedNodes.sort(([a], [b]) => { 18131 const priorityA = parent_getItemPriority(a.rawName, fieldValue); 18132 const priorityB = parent_getItemPriority(b.rawName, fieldValue); 18133 return priorityA >= priorityB ? 1 : -1; 18134 }); 18135 return sortedNodes.flat(); 18136 }; 18137 if (!pageItems) { 18138 return []; 18139 } 18140 let tree = pageItems.map(item => ({ 18141 id: item.id, 18142 parent: item.parent, 18143 name: getTitle(item) 18144 })); 18145 18146 // Only build a hierarchical tree when not searching. 18147 if (!fieldValue) { 18148 tree = terms_buildTermsTree(tree); 18149 } 18150 const opts = getOptionsFromTree(tree); 18151 18152 // Ensure the current parent is in the options list. 18153 const optsHasParent = opts.find(item => item.value === parentPostId); 18154 if (parentPostTitle && !optsHasParent) { 18155 opts.unshift({ 18156 value: parentPostId, 18157 label: parentPostTitle 18158 }); 18159 } 18160 return opts; 18161 }, [pageItems, fieldValue, parentPostTitle, parentPostId]); 18162 if (!isHierarchical) { 18163 return null; 18164 } 18165 /** 18166 * Handle user input. 18167 * 18168 * @param {string} inputValue The current value of the input field. 18169 */ 18170 const handleKeydown = inputValue => { 18171 setFieldValue(inputValue); 18172 }; 18173 18174 /** 18175 * Handle author selection. 18176 * 18177 * @param {Object} selectedPostId The selected Author. 18178 */ 18179 const handleChange = selectedPostId => { 18180 editPost({ 18181 parent: selectedPostId 18182 }); 18183 }; 18184 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { 18185 __nextHasNoMarginBottom: true, 18186 __next40pxDefaultSize: true, 18187 className: "editor-page-attributes__parent", 18188 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 18189 help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'), 18190 value: parentPostId, 18191 options: parentOptions, 18192 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), 18193 onChange: handleChange, 18194 hideLabelFromVision: true 18195 }); 18196 } 18197 function PostParentToggle({ 18198 isOpen, 18199 onClick 18200 }) { 18201 const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => { 18202 const { 18203 getEditedPostAttribute 18204 } = select(store_store); 18205 const parentPostId = getEditedPostAttribute('parent'); 18206 if (!parentPostId) { 18207 return null; 18208 } 18209 const { 18210 getEntityRecord 18211 } = select(external_wp_coreData_namespaceObject.store); 18212 const postTypeSlug = getEditedPostAttribute('type'); 18213 return getEntityRecord('postType', postTypeSlug, parentPostId); 18214 }, []); 18215 const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]); 18216 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18217 size: "compact", 18218 className: "editor-post-parent__panel-toggle", 18219 variant: "tertiary", 18220 "aria-expanded": isOpen, 18221 "aria-label": 18222 // translators: %s: Current post parent. 18223 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle), 18224 onClick: onClick, 18225 children: parentTitle 18226 }); 18227 } 18228 function ParentRow() { 18229 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 18230 // Site index. 18231 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 18232 }, []); 18233 // Use internal state instead of a ref to make sure that the component 18234 // re-renders when the popover's anchor updates. 18235 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 18236 // Memoize popoverProps to avoid returning a new object every time. 18237 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 18238 // Anchor the popover to the middle of the entire row so that it doesn't 18239 // move around when the label changes. 18240 anchor: popoverAnchor, 18241 placement: 'left-start', 18242 offset: 36, 18243 shift: true 18244 }), [popoverAnchor]); 18245 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 18246 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 18247 ref: setPopoverAnchor, 18248 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 18249 popoverProps: popoverProps, 18250 className: "editor-post-parent__panel-dropdown", 18251 contentClassName: "editor-post-parent__panel-dialog", 18252 focusOnMount: true, 18253 renderToggle: ({ 18254 isOpen, 18255 onToggle 18256 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, { 18257 isOpen: isOpen, 18258 onClick: onToggle 18259 }), 18260 renderContent: ({ 18261 onClose 18262 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 18263 className: "editor-post-parent", 18264 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 18265 title: (0,external_wp_i18n_namespaceObject.__)('Parent'), 18266 onClose: onClose 18267 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 18268 children: [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: The home URL of the WordPress installation without the scheme. */ 18269 (0,external_wp_i18n_namespaceObject.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.'), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), { 18270 wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) 18271 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18272 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), { 18273 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 18274 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes') 18275 }) 18276 }) 18277 })] 18278 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(parent_PageAttributesParent, {})] 18279 }) 18280 }) 18281 }); 18282 } 18283 /* harmony default export */ const page_attributes_parent = (parent_PageAttributesParent); 18284 18285 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js 18286 /** 18287 * WordPress dependencies 18288 */ 18289 18290 18291 /** 18292 * Internal dependencies 18293 */ 18294 18295 18296 18297 18298 const PANEL_NAME = 'page-attributes'; 18299 function AttributesPanel() { 18300 const { 18301 isEnabled, 18302 postType 18303 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18304 const { 18305 getEditedPostAttribute, 18306 isEditorPanelEnabled 18307 } = select(store_store); 18308 const { 18309 getPostType 18310 } = select(external_wp_coreData_namespaceObject.store); 18311 return { 18312 isEnabled: isEditorPanelEnabled(PANEL_NAME), 18313 postType: getPostType(getEditedPostAttribute('type')) 18314 }; 18315 }, []); 18316 if (!isEnabled || !postType) { 18317 return null; 18318 } 18319 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}); 18320 } 18321 18322 /** 18323 * Renders the Page Attributes Panel component. 18324 * 18325 * @return {React.ReactNode} The rendered component. 18326 */ 18327 function PageAttributesPanel() { 18328 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { 18329 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {}) 18330 }); 18331 } 18332 18333 ;// ./node_modules/@wordpress/icons/build-module/library/add-template.js 18334 /** 18335 * WordPress dependencies 18336 */ 18337 18338 18339 const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 18340 viewBox: "0 0 24 24", 18341 xmlns: "http://www.w3.org/2000/svg", 18342 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 18343 fillRule: "evenodd", 18344 clipRule: "evenodd", 18345 d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" 18346 }) 18347 }); 18348 /* harmony default export */ const add_template = (addTemplate); 18349 18350 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js 18351 /** 18352 * WordPress dependencies 18353 */ 18354 18355 18356 18357 18358 18359 18360 18361 /** 18362 * Internal dependencies 18363 */ 18364 18365 18366 18367 const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 18368 function CreateNewTemplateModal({ 18369 onClose 18370 }) { 18371 const { 18372 defaultBlockTemplate, 18373 onNavigateToEntityRecord 18374 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18375 const { 18376 getEditorSettings, 18377 getCurrentTemplateId 18378 } = select(store_store); 18379 return { 18380 defaultBlockTemplate: getEditorSettings().defaultBlockTemplate, 18381 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 18382 getTemplateId: getCurrentTemplateId 18383 }; 18384 }); 18385 const { 18386 createTemplate 18387 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 18388 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 18389 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 18390 const cancel = () => { 18391 setTitle(''); 18392 onClose(); 18393 }; 18394 const submit = async event => { 18395 event.preventDefault(); 18396 if (isBusy) { 18397 return; 18398 } 18399 setIsBusy(true); 18400 const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 18401 tagName: 'header', 18402 layout: { 18403 inherit: true 18404 } 18405 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 18406 tagName: 'main' 18407 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 18408 layout: { 18409 inherit: true 18410 } 18411 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', { 18412 layout: { 18413 inherit: true 18414 } 18415 })])]); 18416 const newTemplate = await createTemplate({ 18417 slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE), 18418 content: newTemplateContent, 18419 title: title || DEFAULT_TITLE 18420 }); 18421 setIsBusy(false); 18422 onNavigateToEntityRecord({ 18423 postId: newTemplate.id, 18424 postType: 'wp_template' 18425 }); 18426 cancel(); 18427 }; 18428 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 18429 title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'), 18430 onRequestClose: cancel, 18431 focusOnMount: "firstContentElement", 18432 size: "small", 18433 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 18434 className: "editor-post-template__create-form", 18435 onSubmit: submit, 18436 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 18437 spacing: "3", 18438 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 18439 __next40pxDefaultSize: true, 18440 __nextHasNoMarginBottom: true, 18441 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 18442 value: title, 18443 onChange: setTitle, 18444 placeholder: DEFAULT_TITLE, 18445 disabled: isBusy, 18446 help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') 18447 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 18448 justify: "right", 18449 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18450 __next40pxDefaultSize: true, 18451 variant: "tertiary", 18452 onClick: cancel, 18453 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 18454 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18455 __next40pxDefaultSize: true, 18456 variant: "primary", 18457 type: "submit", 18458 isBusy: isBusy, 18459 "aria-disabled": isBusy, 18460 children: (0,external_wp_i18n_namespaceObject.__)('Create') 18461 })] 18462 })] 18463 }) 18464 }) 18465 }); 18466 } 18467 18468 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js 18469 /** 18470 * WordPress dependencies 18471 */ 18472 18473 18474 18475 18476 /** 18477 * Internal dependencies 18478 */ 18479 18480 function useEditedPostContext() { 18481 return (0,external_wp_data_namespaceObject.useSelect)(select => { 18482 const { 18483 getCurrentPostId, 18484 getCurrentPostType 18485 } = select(store_store); 18486 return { 18487 postId: getCurrentPostId(), 18488 postType: getCurrentPostType() 18489 }; 18490 }, []); 18491 } 18492 function useAllowSwitchingTemplates() { 18493 const { 18494 postType, 18495 postId 18496 } = useEditedPostContext(); 18497 return (0,external_wp_data_namespaceObject.useSelect)(select => { 18498 const { 18499 canUser, 18500 getEntityRecord, 18501 getEntityRecords 18502 } = select(external_wp_coreData_namespaceObject.store); 18503 const siteSettings = canUser('read', { 18504 kind: 'root', 18505 name: 'site' 18506 }) ? getEntityRecord('root', 'site') : undefined; 18507 const templates = getEntityRecords('postType', 'wp_template', { 18508 per_page: -1 18509 }); 18510 const isPostsPage = +postId === siteSettings?.page_for_posts; 18511 // If current page is set front page or posts page, we also need 18512 // to check if the current theme has a template for it. If not 18513 const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({ 18514 slug 18515 }) => slug === 'front-page'); 18516 return !isPostsPage && !isFrontPage; 18517 }, [postId, postType]); 18518 } 18519 function useTemplates(postType) { 18520 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { 18521 per_page: -1, 18522 post_type: postType 18523 }), [postType]); 18524 } 18525 function useAvailableTemplates(postType) { 18526 const currentTemplateSlug = useCurrentTemplateSlug(); 18527 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 18528 const templates = useTemplates(postType); 18529 return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates. 18530 ), [templates, currentTemplateSlug, allowSwitchingTemplate]); 18531 } 18532 function useCurrentTemplateSlug() { 18533 const { 18534 postType, 18535 postId 18536 } = useEditedPostContext(); 18537 const templates = useTemplates(postType); 18538 const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => { 18539 const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 18540 return post?.template; 18541 }, [postType, postId]); 18542 if (!entityTemplate) { 18543 return; 18544 } 18545 // If a page has a `template` set and is not included in the list 18546 // of the theme's templates, do not return it, in order to resolve 18547 // to the current theme's default template. 18548 return templates?.find(template => template.slug === entityTemplate)?.slug; 18549 } 18550 18551 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js 18552 /* wp:polyfill */ 18553 /** 18554 * WordPress dependencies 18555 */ 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 /** 18566 * Internal dependencies 18567 */ 18568 18569 18570 18571 18572 const POPOVER_PROPS = { 18573 className: 'editor-post-template__dropdown', 18574 placement: 'bottom-start' 18575 }; 18576 function PostTemplateToggle({ 18577 isOpen, 18578 onClick 18579 }) { 18580 const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { 18581 const templateSlug = select(store_store).getEditedPostAttribute('template'); 18582 const { 18583 supportsTemplateMode, 18584 availableTemplates 18585 } = select(store_store).getEditorSettings(); 18586 if (!supportsTemplateMode && availableTemplates[templateSlug]) { 18587 return availableTemplates[templateSlug]; 18588 } 18589 const template = select(external_wp_coreData_namespaceObject.store).canUser('create', { 18590 kind: 'postType', 18591 name: 'wp_template' 18592 }) && select(store_store).getCurrentTemplateId(); 18593 return template?.title || template?.slug || availableTemplates?.[templateSlug]; 18594 }, []); 18595 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18596 __next40pxDefaultSize: true, 18597 variant: "tertiary", 18598 "aria-expanded": isOpen, 18599 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'), 18600 onClick: onClick, 18601 children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template') 18602 }); 18603 } 18604 18605 /** 18606 * Renders the dropdown content for selecting a post template. 18607 * 18608 * @param {Object} props The component props. 18609 * @param {Function} props.onClose The function to close the dropdown. 18610 * 18611 * @return {React.ReactNode} The rendered dropdown content. 18612 */ 18613 function PostTemplateDropdownContent({ 18614 onClose 18615 }) { 18616 var _options$find, _selectedOption$value; 18617 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 18618 const { 18619 availableTemplates, 18620 fetchedTemplates, 18621 selectedTemplateSlug, 18622 canCreate, 18623 canEdit, 18624 currentTemplateId, 18625 onNavigateToEntityRecord, 18626 getEditorSettings 18627 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18628 const { 18629 canUser, 18630 getEntityRecords 18631 } = select(external_wp_coreData_namespaceObject.store); 18632 const editorSettings = select(store_store).getEditorSettings(); 18633 const canCreateTemplates = canUser('create', { 18634 kind: 'postType', 18635 name: 'wp_template' 18636 }); 18637 const _currentTemplateId = select(store_store).getCurrentTemplateId(); 18638 return { 18639 availableTemplates: editorSettings.availableTemplates, 18640 fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', { 18641 post_type: select(store_store).getCurrentPostType(), 18642 per_page: -1 18643 }) : undefined, 18644 selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'), 18645 canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode, 18646 canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId, 18647 currentTemplateId: _currentTemplateId, 18648 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 18649 getEditorSettings: select(store_store).getEditorSettings 18650 }; 18651 }, [allowSwitchingTemplate]); 18652 const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({ 18653 ...availableTemplates, 18654 ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({ 18655 slug, 18656 title 18657 }) => [slug, title.rendered])) 18658 }).map(([slug, title]) => ({ 18659 value: slug, 18660 label: title 18661 })), [availableTemplates, fetchedTemplates]); 18662 const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value. 18663 18664 const { 18665 editPost 18666 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18667 const { 18668 createSuccessNotice 18669 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 18670 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 18671 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 18672 className: "editor-post-template__classic-theme-dropdown", 18673 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 18674 title: (0,external_wp_i18n_namespaceObject.__)('Template'), 18675 help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'), 18676 actions: canCreate ? [{ 18677 icon: add_template, 18678 label: (0,external_wp_i18n_namespaceObject.__)('Add template'), 18679 onClick: () => setIsCreateModalOpen(true) 18680 }] : [], 18681 onClose: onClose 18682 }), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 18683 status: "warning", 18684 isDismissible: false, 18685 children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.') 18686 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 18687 __next40pxDefaultSize: true, 18688 __nextHasNoMarginBottom: true, 18689 hideLabelFromVision: true, 18690 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 18691 value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '', 18692 options: options, 18693 onChange: slug => editPost({ 18694 template: slug || '' 18695 }) 18696 }), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18697 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18698 __next40pxDefaultSize: true, 18699 variant: "link", 18700 onClick: () => { 18701 onNavigateToEntityRecord({ 18702 postId: currentTemplateId, 18703 postType: 'wp_template' 18704 }); 18705 onClose(); 18706 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { 18707 type: 'snackbar', 18708 actions: [{ 18709 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 18710 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 18711 }] 18712 }); 18713 }, 18714 children: (0,external_wp_i18n_namespaceObject.__)('Edit template') 18715 }) 18716 }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { 18717 onClose: () => setIsCreateModalOpen(false) 18718 })] 18719 }); 18720 } 18721 function ClassicThemeControl() { 18722 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 18723 popoverProps: POPOVER_PROPS, 18724 focusOnMount: true, 18725 renderToggle: ({ 18726 isOpen, 18727 onToggle 18728 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateToggle, { 18729 isOpen: isOpen, 18730 onClick: onToggle 18731 }), 18732 renderContent: ({ 18733 onClose 18734 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, { 18735 onClose: onClose 18736 }) 18737 }); 18738 } 18739 18740 /** 18741 * Provides a dropdown menu for selecting and managing post templates. 18742 * 18743 * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates. 18744 * 18745 * @return {React.ReactNode} The rendered ClassicThemeControl component. 18746 */ 18747 /* harmony default export */ const classic_theme = (ClassicThemeControl); 18748 18749 ;// external ["wp","warning"] 18750 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 18751 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 18752 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js 18753 /** 18754 * WordPress dependencies 18755 */ 18756 18757 18758 18759 /** 18760 * Internal dependencies 18761 */ 18762 18763 18764 18765 const { 18766 PreferenceBaseOption 18767 } = unlock(external_wp_preferences_namespaceObject.privateApis); 18768 function EnablePanelOption(props) { 18769 const { 18770 toggleEditorPanelEnabled 18771 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18772 const { 18773 isChecked, 18774 isRemoved 18775 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18776 const { 18777 isEditorPanelEnabled, 18778 isEditorPanelRemoved 18779 } = select(store_store); 18780 return { 18781 isChecked: isEditorPanelEnabled(props.panelName), 18782 isRemoved: isEditorPanelRemoved(props.panelName) 18783 }; 18784 }, [props.panelName]); 18785 if (isRemoved) { 18786 return null; 18787 } 18788 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceBaseOption, { 18789 isChecked: isChecked, 18790 onChange: () => toggleEditorPanelEnabled(props.panelName), 18791 ...props 18792 }); 18793 } 18794 18795 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js 18796 /** 18797 * WordPress dependencies 18798 */ 18799 18800 18801 /** 18802 * Internal dependencies 18803 */ 18804 18805 18806 const { 18807 Fill, 18808 Slot 18809 } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption'); 18810 const EnablePluginDocumentSettingPanelOption = ({ 18811 label, 18812 panelName 18813 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { 18814 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 18815 label: label, 18816 panelName: panelName 18817 }) 18818 }); 18819 EnablePluginDocumentSettingPanelOption.Slot = Slot; 18820 /* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption); 18821 18822 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js 18823 /** 18824 * WordPress dependencies 18825 */ 18826 18827 18828 18829 18830 18831 /** 18832 * Internal dependencies 18833 */ 18834 18835 18836 18837 const { 18838 Fill: plugin_document_setting_panel_Fill, 18839 Slot: plugin_document_setting_panel_Slot 18840 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); 18841 18842 /** 18843 * Renders items below the Status & Availability panel in the Document Sidebar. 18844 * 18845 * @param {Object} props Component properties. 18846 * @param {string} props.name Required. A machine-friendly name for the panel. 18847 * @param {string} [props.className] An optional class name added to the row. 18848 * @param {string} [props.title] The title of the panel 18849 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. 18850 * @param {React.ReactNode} props.children Children to be rendered 18851 * 18852 * @example 18853 * ```js 18854 * // Using ES5 syntax 18855 * var el = React.createElement; 18856 * var __ = wp.i18n.__; 18857 * var registerPlugin = wp.plugins.registerPlugin; 18858 * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel; 18859 * 18860 * function MyDocumentSettingPlugin() { 18861 * return el( 18862 * PluginDocumentSettingPanel, 18863 * { 18864 * className: 'my-document-setting-plugin', 18865 * title: 'My Panel', 18866 * name: 'my-panel', 18867 * }, 18868 * __( 'My Document Setting Panel' ) 18869 * ); 18870 * } 18871 * 18872 * registerPlugin( 'my-document-setting-plugin', { 18873 * render: MyDocumentSettingPlugin 18874 * } ); 18875 * ``` 18876 * 18877 * @example 18878 * ```jsx 18879 * // Using ESNext syntax 18880 * import { registerPlugin } from '@wordpress/plugins'; 18881 * import { PluginDocumentSettingPanel } from '@wordpress/editor'; 18882 * 18883 * const MyDocumentSettingTest = () => ( 18884 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel"> 18885 * <p>My Document Setting Panel</p> 18886 * </PluginDocumentSettingPanel> 18887 * ); 18888 * 18889 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); 18890 * ``` 18891 * 18892 * @return {React.ReactNode} The component to be rendered. 18893 */ 18894 const PluginDocumentSettingPanel = ({ 18895 name, 18896 className, 18897 title, 18898 icon, 18899 children 18900 }) => { 18901 const { 18902 name: pluginName 18903 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 18904 const panelName = `$pluginName}/$name}`; 18905 const { 18906 opened, 18907 isEnabled 18908 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18909 const { 18910 isEditorPanelOpened, 18911 isEditorPanelEnabled 18912 } = select(store_store); 18913 return { 18914 opened: isEditorPanelOpened(panelName), 18915 isEnabled: isEditorPanelEnabled(panelName) 18916 }; 18917 }, [panelName]); 18918 const { 18919 toggleEditorPanelOpened 18920 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18921 if (undefined === name) { 18922 true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0; 18923 } 18924 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 18925 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel, { 18926 label: title, 18927 panelName: panelName 18928 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, { 18929 children: isEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 18930 className: className, 18931 title: title, 18932 icon: icon, 18933 opened: opened, 18934 onToggle: () => toggleEditorPanelOpened(panelName), 18935 children: children 18936 }) 18937 })] 18938 }); 18939 }; 18940 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; 18941 /* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel); 18942 18943 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js 18944 /* wp:polyfill */ 18945 /** 18946 * WordPress dependencies 18947 */ 18948 18949 18950 18951 18952 const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0; 18953 18954 /** 18955 * Plugins may want to add an item to the menu either for every block 18956 * or only for the specific ones provided in the `allowedBlocks` component property. 18957 * 18958 * If there are multiple blocks selected the item will be rendered if every block 18959 * is of one allowed type (not necessarily the same). 18960 * 18961 * @param {string[]} selectedBlocks Array containing the names of the blocks selected 18962 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed 18963 * @return {boolean} Whether the item will be rendered or not. 18964 */ 18965 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); 18966 18967 /** 18968 * Renders a new item in the block settings menu. 18969 * 18970 * @param {Object} props Component props. 18971 * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list. 18972 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element. 18973 * @param {string} props.label The menu item text. 18974 * @param {Function} props.onClick Callback function to be executed when the user click the menu item. 18975 * @param {boolean} [props.small] Whether to render the label or not. 18976 * @param {string} [props.role] The ARIA role for the menu item. 18977 * 18978 * @example 18979 * ```js 18980 * // Using ES5 syntax 18981 * var __ = wp.i18n.__; 18982 * var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem; 18983 * 18984 * function doOnClick(){ 18985 * // To be called when the user clicks the menu item. 18986 * } 18987 * 18988 * function MyPluginBlockSettingsMenuItem() { 18989 * return React.createElement( 18990 * PluginBlockSettingsMenuItem, 18991 * { 18992 * allowedBlocks: [ 'core/paragraph' ], 18993 * icon: 'dashicon-name', 18994 * label: __( 'Menu item text' ), 18995 * onClick: doOnClick, 18996 * } 18997 * ); 18998 * } 18999 * ``` 19000 * 19001 * @example 19002 * ```jsx 19003 * // Using ESNext syntax 19004 * import { __ } from '@wordpress/i18n'; 19005 * import { PluginBlockSettingsMenuItem } from '@wordpress/editor'; 19006 * 19007 * const doOnClick = ( ) => { 19008 * // To be called when the user clicks the menu item. 19009 * }; 19010 * 19011 * const MyPluginBlockSettingsMenuItem = () => ( 19012 * <PluginBlockSettingsMenuItem 19013 * allowedBlocks={ [ 'core/paragraph' ] } 19014 * icon='dashicon-name' 19015 * label={ __( 'Menu item text' ) } 19016 * onClick={ doOnClick } /> 19017 * ); 19018 * ``` 19019 * 19020 * @return {React.ReactNode} The rendered component. 19021 */ 19022 const PluginBlockSettingsMenuItem = ({ 19023 allowedBlocks, 19024 icon, 19025 label, 19026 onClick, 19027 small, 19028 role 19029 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 19030 children: ({ 19031 selectedBlocks, 19032 onClose 19033 }) => { 19034 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { 19035 return null; 19036 } 19037 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19038 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), 19039 icon: icon, 19040 label: small ? label : undefined, 19041 role: role, 19042 children: !small && label 19043 }); 19044 } 19045 }); 19046 /* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); 19047 19048 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js 19049 /** 19050 * WordPress dependencies 19051 */ 19052 19053 19054 19055 19056 /** 19057 * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. 19058 * The text within the component appears as the menu item label. 19059 * 19060 * @param {Object} props Component properties. 19061 * @param {React.ReactNode} [props.children] Children to be rendered. 19062 * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. 19063 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. 19064 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. 19065 * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. 19066 * 19067 * @example 19068 * ```js 19069 * // Using ES5 syntax 19070 * var __ = wp.i18n.__; 19071 * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem; 19072 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 19073 * 19074 * function onButtonClick() { 19075 * alert( 'Button clicked.' ); 19076 * } 19077 * 19078 * function MyButtonMoreMenuItem() { 19079 * return wp.element.createElement( 19080 * PluginMoreMenuItem, 19081 * { 19082 * icon: moreIcon, 19083 * onClick: onButtonClick, 19084 * }, 19085 * __( 'My button title' ) 19086 * ); 19087 * } 19088 * ``` 19089 * 19090 * @example 19091 * ```jsx 19092 * // Using ESNext syntax 19093 * import { __ } from '@wordpress/i18n'; 19094 * import { PluginMoreMenuItem } from '@wordpress/editor'; 19095 * import { more } from '@wordpress/icons'; 19096 * 19097 * function onButtonClick() { 19098 * alert( 'Button clicked.' ); 19099 * } 19100 * 19101 * const MyButtonMoreMenuItem = () => ( 19102 * <PluginMoreMenuItem 19103 * icon={ more } 19104 * onClick={ onButtonClick } 19105 * > 19106 * { __( 'My button title' ) } 19107 * </PluginMoreMenuItem> 19108 * ); 19109 * ``` 19110 * 19111 * @return {React.ReactNode} The rendered component. 19112 */ 19113 19114 function PluginMoreMenuItem(props) { 19115 var _props$as; 19116 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 19117 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { 19118 name: "core/plugin-more-menu", 19119 as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : external_wp_components_namespaceObject.MenuItem, 19120 icon: props.icon || context.icon, 19121 ...props 19122 }); 19123 } 19124 19125 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js 19126 /** 19127 * WordPress dependencies 19128 */ 19129 19130 19131 19132 const { 19133 Fill: plugin_post_publish_panel_Fill, 19134 Slot: plugin_post_publish_panel_Slot 19135 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel'); 19136 19137 /** 19138 * Renders provided content to the post-publish panel in the publish flow 19139 * (side panel that opens after a user publishes the post). 19140 * 19141 * @param {Object} props Component properties. 19142 * @param {string} [props.className] An optional class name added to the panel. 19143 * @param {string} [props.title] Title displayed at the top of the panel. 19144 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. 19145 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. 19146 * @param {React.ReactNode} props.children Children to be rendered 19147 * 19148 * @example 19149 * ```jsx 19150 * // Using ESNext syntax 19151 * import { __ } from '@wordpress/i18n'; 19152 * import { PluginPostPublishPanel } from '@wordpress/editor'; 19153 * 19154 * const MyPluginPostPublishPanel = () => ( 19155 * <PluginPostPublishPanel 19156 * className="my-plugin-post-publish-panel" 19157 * title={ __( 'My panel title' ) } 19158 * initialOpen={ true } 19159 * > 19160 * { __( 'My panel content' ) } 19161 * </PluginPostPublishPanel> 19162 * ); 19163 * ``` 19164 * 19165 * @return {React.ReactNode} The rendered component. 19166 */ 19167 const PluginPostPublishPanel = ({ 19168 children, 19169 className, 19170 title, 19171 initialOpen = false, 19172 icon 19173 }) => { 19174 const { 19175 icon: pluginIcon 19176 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 19177 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, { 19178 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 19179 className: className, 19180 initialOpen: initialOpen || !title, 19181 title: title, 19182 icon: icon !== null && icon !== void 0 ? icon : pluginIcon, 19183 children: children 19184 }) 19185 }); 19186 }; 19187 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; 19188 /* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel); 19189 19190 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js 19191 /** 19192 * Defines as extensibility slot for the Summary panel. 19193 */ 19194 19195 /** 19196 * WordPress dependencies 19197 */ 19198 19199 19200 const { 19201 Fill: plugin_post_status_info_Fill, 19202 Slot: plugin_post_status_info_Slot 19203 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo'); 19204 19205 /** 19206 * Renders a row in the Summary panel of the Document sidebar. 19207 * It should be noted that this is named and implemented around the function it serves 19208 * and not its location, which may change in future iterations. 19209 * 19210 * @param {Object} props Component properties. 19211 * @param {string} [props.className] An optional class name added to the row. 19212 * @param {React.ReactNode} props.children Children to be rendered. 19213 * 19214 * @example 19215 * ```js 19216 * // Using ES5 syntax 19217 * var __ = wp.i18n.__; 19218 * var PluginPostStatusInfo = wp.editor.PluginPostStatusInfo; 19219 * 19220 * function MyPluginPostStatusInfo() { 19221 * return React.createElement( 19222 * PluginPostStatusInfo, 19223 * { 19224 * className: 'my-plugin-post-status-info', 19225 * }, 19226 * __( 'My post status info' ) 19227 * ) 19228 * } 19229 * ``` 19230 * 19231 * @example 19232 * ```jsx 19233 * // Using ESNext syntax 19234 * import { __ } from '@wordpress/i18n'; 19235 * import { PluginPostStatusInfo } from '@wordpress/editor'; 19236 * 19237 * const MyPluginPostStatusInfo = () => ( 19238 * <PluginPostStatusInfo 19239 * className="my-plugin-post-status-info" 19240 * > 19241 * { __( 'My post status info' ) } 19242 * </PluginPostStatusInfo> 19243 * ); 19244 * ``` 19245 * 19246 * @return {React.ReactNode} The rendered component. 19247 */ 19248 const PluginPostStatusInfo = ({ 19249 children, 19250 className 19251 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, { 19252 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 19253 className: className, 19254 children: children 19255 }) 19256 }); 19257 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; 19258 /* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo); 19259 19260 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js 19261 /** 19262 * WordPress dependencies 19263 */ 19264 19265 19266 19267 const { 19268 Fill: plugin_pre_publish_panel_Fill, 19269 Slot: plugin_pre_publish_panel_Slot 19270 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel'); 19271 19272 /** 19273 * Renders provided content to the pre-publish side panel in the publish flow 19274 * (side panel that opens when a user first pushes "Publish" from the main editor). 19275 * 19276 * @param {Object} props Component props. 19277 * @param {string} [props.className] An optional class name added to the panel. 19278 * @param {string} [props.title] Title displayed at the top of the panel. 19279 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. 19280 * When no title is provided it is always opened. 19281 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) 19282 * icon slug string, or an SVG WP element, to be rendered when 19283 * the sidebar is pinned to toolbar. 19284 * @param {React.ReactNode} props.children Children to be rendered 19285 * 19286 * @example 19287 * ```jsx 19288 * // Using ESNext syntax 19289 * import { __ } from '@wordpress/i18n'; 19290 * import { PluginPrePublishPanel } from '@wordpress/editor'; 19291 * 19292 * const MyPluginPrePublishPanel = () => ( 19293 * <PluginPrePublishPanel 19294 * className="my-plugin-pre-publish-panel" 19295 * title={ __( 'My panel title' ) } 19296 * initialOpen={ true } 19297 * > 19298 * { __( 'My panel content' ) } 19299 * </PluginPrePublishPanel> 19300 * ); 19301 * ``` 19302 * 19303 * @return {React.ReactNode} The rendered component. 19304 */ 19305 const PluginPrePublishPanel = ({ 19306 children, 19307 className, 19308 title, 19309 initialOpen = false, 19310 icon 19311 }) => { 19312 const { 19313 icon: pluginIcon 19314 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 19315 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, { 19316 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 19317 className: className, 19318 initialOpen: initialOpen || !title, 19319 title: title, 19320 icon: icon !== null && icon !== void 0 ? icon : pluginIcon, 19321 children: children 19322 }) 19323 }); 19324 }; 19325 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; 19326 /* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel); 19327 19328 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js 19329 /** 19330 * WordPress dependencies 19331 */ 19332 19333 19334 19335 19336 /** 19337 * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided. 19338 * The text within the component appears as the menu item label. 19339 * 19340 * @param {Object} props Component properties. 19341 * @param {React.ReactNode} [props.children] Children to be rendered. 19342 * @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor. 19343 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element. 19344 * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item. 19345 * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component. 19346 * 19347 * @example 19348 * ```jsx 19349 * import { __ } from '@wordpress/i18n'; 19350 * import { PluginPreviewMenuItem } from '@wordpress/editor'; 19351 * import { external } from '@wordpress/icons'; 19352 * 19353 * function onPreviewClick() { 19354 * // Handle preview action 19355 * } 19356 * 19357 * const ExternalPreviewMenuItem = () => ( 19358 * <PluginPreviewMenuItem 19359 * icon={ external } 19360 * onClick={ onPreviewClick } 19361 * > 19362 * { __( 'Preview in new tab' ) } 19363 * </PluginPreviewMenuItem> 19364 * ); 19365 * registerPlugin( 'external-preview-menu-item', { 19366 * render: ExternalPreviewMenuItem, 19367 * } ); 19368 * ``` 19369 * 19370 * @return {React.ReactNode} The rendered menu item component. 19371 */ 19372 19373 function PluginPreviewMenuItem(props) { 19374 var _props$as; 19375 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 19376 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { 19377 name: "core/plugin-preview-menu", 19378 as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : external_wp_components_namespaceObject.MenuItem, 19379 icon: props.icon || context.icon, 19380 ...props 19381 }); 19382 } 19383 19384 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js 19385 /** 19386 * WordPress dependencies 19387 */ 19388 19389 19390 /** 19391 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. 19392 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. 19393 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: 19394 * 19395 * ```js 19396 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); 19397 * ``` 19398 * 19399 * @see PluginSidebarMoreMenuItem 19400 * 19401 * @param {Object} props Element props. 19402 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. 19403 * @param {React.ReactNode} [props.children] Children to be rendered. 19404 * @param {string} [props.className] An optional class name added to the sidebar body. 19405 * @param {string} props.title Title displayed at the top of the sidebar. 19406 * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. 19407 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. 19408 * 19409 * @example 19410 * ```js 19411 * // Using ES5 syntax 19412 * var __ = wp.i18n.__; 19413 * var el = React.createElement; 19414 * var PanelBody = wp.components.PanelBody; 19415 * var PluginSidebar = wp.editor.PluginSidebar; 19416 * var moreIcon = React.createElement( 'svg' ); //... svg element. 19417 * 19418 * function MyPluginSidebar() { 19419 * return el( 19420 * PluginSidebar, 19421 * { 19422 * name: 'my-sidebar', 19423 * title: 'My sidebar title', 19424 * icon: moreIcon, 19425 * }, 19426 * el( 19427 * PanelBody, 19428 * {}, 19429 * __( 'My sidebar content' ) 19430 * ) 19431 * ); 19432 * } 19433 * ``` 19434 * 19435 * @example 19436 * ```jsx 19437 * // Using ESNext syntax 19438 * import { __ } from '@wordpress/i18n'; 19439 * import { PanelBody } from '@wordpress/components'; 19440 * import { PluginSidebar } from '@wordpress/editor'; 19441 * import { more } from '@wordpress/icons'; 19442 * 19443 * const MyPluginSidebar = () => ( 19444 * <PluginSidebar 19445 * name="my-sidebar" 19446 * title="My sidebar title" 19447 * icon={ more } 19448 * > 19449 * <PanelBody> 19450 * { __( 'My sidebar content' ) } 19451 * </PanelBody> 19452 * </PluginSidebar> 19453 * ); 19454 * ``` 19455 */ 19456 19457 function PluginSidebar({ 19458 className, 19459 ...props 19460 }) { 19461 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, { 19462 panelClassName: className, 19463 className: "editor-sidebar", 19464 scope: "core", 19465 ...props 19466 }); 19467 } 19468 19469 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js 19470 /** 19471 * WordPress dependencies 19472 */ 19473 19474 19475 /** 19476 * Renders a menu item in `Plugins` group in `More Menu` drop down, 19477 * and can be used to activate the corresponding `PluginSidebar` component. 19478 * The text within the component appears as the menu item label. 19479 * 19480 * @param {Object} props Component props. 19481 * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. 19482 * @param {React.ReactNode} [props.children] Children to be rendered. 19483 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. 19484 * 19485 * @example 19486 * ```js 19487 * // Using ES5 syntax 19488 * var __ = wp.i18n.__; 19489 * var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem; 19490 * var moreIcon = React.createElement( 'svg' ); //... svg element. 19491 * 19492 * function MySidebarMoreMenuItem() { 19493 * return React.createElement( 19494 * PluginSidebarMoreMenuItem, 19495 * { 19496 * target: 'my-sidebar', 19497 * icon: moreIcon, 19498 * }, 19499 * __( 'My sidebar title' ) 19500 * ) 19501 * } 19502 * ``` 19503 * 19504 * @example 19505 * ```jsx 19506 * // Using ESNext syntax 19507 * import { __ } from '@wordpress/i18n'; 19508 * import { PluginSidebarMoreMenuItem } from '@wordpress/editor'; 19509 * import { more } from '@wordpress/icons'; 19510 * 19511 * const MySidebarMoreMenuItem = () => ( 19512 * <PluginSidebarMoreMenuItem 19513 * target="my-sidebar" 19514 * icon={ more } 19515 * > 19516 * { __( 'My sidebar title' ) } 19517 * </PluginSidebarMoreMenuItem> 19518 * ); 19519 * ``` 19520 * 19521 * @return {React.ReactNode} The rendered component. 19522 */ 19523 19524 function PluginSidebarMoreMenuItem(props) { 19525 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem 19526 // Menu item is marked with unstable prop for backward compatibility. 19527 // @see https://github.com/WordPress/gutenberg/issues/14457 19528 , { 19529 __unstableExplicitMenuItem: true, 19530 scope: "core", 19531 ...props 19532 }); 19533 } 19534 19535 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js 19536 /* wp:polyfill */ 19537 /** 19538 * WordPress dependencies 19539 */ 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 /** 19550 * Internal dependencies 19551 */ 19552 19553 19554 function SwapTemplateButton({ 19555 onClick 19556 }) { 19557 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 19558 const { 19559 postType, 19560 postId 19561 } = useEditedPostContext(); 19562 const availableTemplates = useAvailableTemplates(postType); 19563 const { 19564 editEntityRecord 19565 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 19566 if (!availableTemplates?.length) { 19567 return null; 19568 } 19569 const onTemplateSelect = async template => { 19570 editEntityRecord('postType', postType, postId, { 19571 template: template.name 19572 }, { 19573 undoIgnore: true 19574 }); 19575 setShowModal(false); // Close the template suggestions modal first. 19576 onClick(); 19577 }; 19578 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19579 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19580 onClick: () => setShowModal(true), 19581 children: (0,external_wp_i18n_namespaceObject.__)('Change template') 19582 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 19583 title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'), 19584 onRequestClose: () => setShowModal(false), 19585 overlayClassName: "editor-post-template__swap-template-modal", 19586 isFullScreen: true, 19587 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19588 className: "editor-post-template__swap-template-modal-content", 19589 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatesList, { 19590 postType: postType, 19591 onSelect: onTemplateSelect 19592 }) 19593 }) 19594 })] 19595 }); 19596 } 19597 function TemplatesList({ 19598 postType, 19599 onSelect 19600 }) { 19601 const availableTemplates = useAvailableTemplates(postType); 19602 const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => availableTemplates.map(template => ({ 19603 name: template.slug, 19604 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), 19605 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), 19606 id: template.id 19607 })), [availableTemplates]); 19608 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 19609 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 19610 blockPatterns: templatesAsPatterns, 19611 onClickPattern: onSelect 19612 }); 19613 } 19614 19615 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js 19616 /** 19617 * WordPress dependencies 19618 */ 19619 19620 19621 19622 19623 19624 /** 19625 * Internal dependencies 19626 */ 19627 19628 19629 function ResetDefaultTemplate({ 19630 onClick 19631 }) { 19632 const currentTemplateSlug = useCurrentTemplateSlug(); 19633 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 19634 const { 19635 postType, 19636 postId 19637 } = useEditedPostContext(); 19638 const { 19639 editEntityRecord 19640 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 19641 // The default template in a post is indicated by an empty string. 19642 if (!currentTemplateSlug || !allowSwitchingTemplate) { 19643 return null; 19644 } 19645 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19646 onClick: () => { 19647 editEntityRecord('postType', postType, postId, { 19648 template: '' 19649 }, { 19650 undoIgnore: true 19651 }); 19652 onClick(); 19653 }, 19654 children: (0,external_wp_i18n_namespaceObject.__)('Use default template') 19655 }); 19656 } 19657 19658 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js 19659 /** 19660 * WordPress dependencies 19661 */ 19662 19663 19664 19665 19666 19667 19668 /** 19669 * Internal dependencies 19670 */ 19671 19672 19673 19674 function CreateNewTemplate({ 19675 onClick 19676 }) { 19677 const { 19678 canCreateTemplates 19679 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19680 const { 19681 canUser 19682 } = select(external_wp_coreData_namespaceObject.store); 19683 return { 19684 canCreateTemplates: canUser('create', { 19685 kind: 'postType', 19686 name: 'wp_template' 19687 }) 19688 }; 19689 }, []); 19690 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 19691 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 19692 19693 // The default template in a post is indicated by an empty string. 19694 if (!canCreateTemplates || !allowSwitchingTemplate) { 19695 return null; 19696 } 19697 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19698 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19699 onClick: () => { 19700 setIsCreateModalOpen(true); 19701 }, 19702 children: (0,external_wp_i18n_namespaceObject.__)('Create new template') 19703 }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { 19704 onClose: () => { 19705 setIsCreateModalOpen(false); 19706 onClick(); 19707 } 19708 })] 19709 }); 19710 } 19711 19712 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js 19713 /** 19714 * WordPress dependencies 19715 */ 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 /** 19726 * Internal dependencies 19727 */ 19728 19729 19730 19731 19732 19733 19734 const block_theme_POPOVER_PROPS = { 19735 className: 'editor-post-template__dropdown', 19736 placement: 'bottom-start' 19737 }; 19738 function BlockThemeControl({ 19739 id 19740 }) { 19741 const { 19742 isTemplateHidden, 19743 onNavigateToEntityRecord, 19744 getEditorSettings, 19745 hasGoBack 19746 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19747 const { 19748 getRenderingMode, 19749 getEditorSettings: _getEditorSettings 19750 } = unlock(select(store_store)); 19751 const editorSettings = _getEditorSettings(); 19752 return { 19753 isTemplateHidden: getRenderingMode() === 'post-only', 19754 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 19755 getEditorSettings: _getEditorSettings, 19756 hasGoBack: editorSettings.hasOwnProperty('onNavigateToPreviousEntityRecord') 19757 }; 19758 }, []); 19759 const { 19760 get: getPreference 19761 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 19762 const { 19763 editedRecord: template, 19764 hasResolved 19765 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', id); 19766 const { 19767 createSuccessNotice 19768 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 19769 const { 19770 setRenderingMode 19771 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 19772 const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { 19773 kind: 'postType', 19774 name: 'wp_template' 19775 }), []); 19776 if (!hasResolved) { 19777 return null; 19778 } 19779 19780 // The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing 19781 // and assigns its own backlink to focusMode pages. 19782 const notificationAction = hasGoBack ? [{ 19783 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 19784 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 19785 }] : undefined; 19786 const mayShowTemplateEditNotice = () => { 19787 if (!getPreference('core/edit-site', 'welcomeGuideTemplate')) { 19788 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { 19789 type: 'snackbar', 19790 actions: notificationAction 19791 }); 19792 } 19793 }; 19794 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 19795 popoverProps: block_theme_POPOVER_PROPS, 19796 focusOnMount: true, 19797 toggleProps: { 19798 size: 'compact', 19799 variant: 'tertiary', 19800 tooltipPosition: 'middle left' 19801 }, 19802 label: (0,external_wp_i18n_namespaceObject.__)('Template options'), 19803 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title), 19804 icon: null, 19805 children: ({ 19806 onClose 19807 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19808 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 19809 children: [canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19810 onClick: () => { 19811 onNavigateToEntityRecord({ 19812 postId: template.id, 19813 postType: 'wp_template' 19814 }); 19815 onClose(); 19816 mayShowTemplateEditNotice(); 19817 }, 19818 children: (0,external_wp_i18n_namespaceObject.__)('Edit template') 19819 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, { 19820 onClick: onClose 19821 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, { 19822 onClick: onClose 19823 }), canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, { 19824 onClick: onClose 19825 })] 19826 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 19827 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 19828 icon: !isTemplateHidden ? library_check : undefined, 19829 isSelected: !isTemplateHidden, 19830 role: "menuitemcheckbox", 19831 onClick: () => { 19832 setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only'); 19833 }, 19834 children: (0,external_wp_i18n_namespaceObject.__)('Show template') 19835 }) 19836 })] 19837 }) 19838 }); 19839 } 19840 19841 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js 19842 /** 19843 * WordPress dependencies 19844 */ 19845 19846 19847 19848 19849 /** 19850 * Internal dependencies 19851 */ 19852 19853 19854 19855 19856 19857 /** 19858 * Displays the template controls based on the current editor settings and user permissions. 19859 * 19860 * @return {React.ReactNode} The rendered PostTemplatePanel component. 19861 */ 19862 19863 function PostTemplatePanel() { 19864 const { 19865 templateId, 19866 isBlockTheme 19867 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19868 const { 19869 getCurrentTemplateId, 19870 getEditorSettings 19871 } = select(store_store); 19872 return { 19873 templateId: getCurrentTemplateId(), 19874 isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme 19875 }; 19876 }, []); 19877 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 19878 var _select$canUser; 19879 const postTypeSlug = select(store_store).getCurrentPostType(); 19880 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 19881 if (!postType?.viewable) { 19882 return false; 19883 } 19884 const settings = select(store_store).getEditorSettings(); 19885 const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; 19886 if (hasTemplates) { 19887 return true; 19888 } 19889 if (!settings.supportsTemplateMode) { 19890 return false; 19891 } 19892 const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', { 19893 kind: 'postType', 19894 name: 'wp_template' 19895 })) !== null && _select$canUser !== void 0 ? _select$canUser : false; 19896 return canCreateTemplates; 19897 }, []); 19898 const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)(select => { 19899 var _select$canUser2; 19900 return (_select$canUser2 = select(external_wp_coreData_namespaceObject.store).canUser('read', { 19901 kind: 'postType', 19902 name: 'wp_template' 19903 })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false; 19904 }, []); 19905 if ((!isBlockTheme || !canViewTemplates) && isVisible) { 19906 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 19907 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 19908 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme, {}) 19909 }); 19910 } 19911 if (isBlockTheme && !!templateId) { 19912 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 19913 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 19914 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, { 19915 id: templateId 19916 }) 19917 }); 19918 } 19919 return null; 19920 } 19921 19922 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js 19923 const BASE_QUERY = { 19924 _fields: 'id,name', 19925 context: 'view' // Allows non-admins to perform requests. 19926 }; 19927 const AUTHORS_QUERY = { 19928 who: 'authors', 19929 per_page: 100, 19930 ...BASE_QUERY 19931 }; 19932 19933 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js 19934 /* wp:polyfill */ 19935 /** 19936 * WordPress dependencies 19937 */ 19938 19939 19940 19941 19942 19943 19944 /** 19945 * Internal dependencies 19946 */ 19947 19948 19949 function useAuthorsQuery(search) { 19950 const { 19951 authorId, 19952 authors, 19953 postAuthor 19954 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19955 const { 19956 getUser, 19957 getUsers 19958 } = select(external_wp_coreData_namespaceObject.store); 19959 const { 19960 getEditedPostAttribute 19961 } = select(store_store); 19962 const _authorId = getEditedPostAttribute('author'); 19963 const query = { 19964 ...AUTHORS_QUERY 19965 }; 19966 if (search) { 19967 query.search = search; 19968 query.search_columns = ['name']; 19969 } 19970 return { 19971 authorId: _authorId, 19972 authors: getUsers(query), 19973 postAuthor: getUser(_authorId, BASE_QUERY) 19974 }; 19975 }, [search]); 19976 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 19977 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { 19978 return { 19979 value: author.id, 19980 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) 19981 }; 19982 }); 19983 19984 // Ensure the current author is included in the dropdown list. 19985 const foundAuthor = fetchedAuthors.findIndex(({ 19986 value 19987 }) => postAuthor?.id === value); 19988 let currentAuthor = []; 19989 if (foundAuthor < 0 && postAuthor) { 19990 currentAuthor = [{ 19991 value: postAuthor.id, 19992 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) 19993 }]; 19994 } else if (foundAuthor < 0 && !postAuthor) { 19995 currentAuthor = [{ 19996 value: 0, 19997 label: (0,external_wp_i18n_namespaceObject.__)('(No author)') 19998 }]; 19999 } 20000 return [...currentAuthor, ...fetchedAuthors]; 20001 }, [authors, postAuthor]); 20002 return { 20003 authorId, 20004 authorOptions, 20005 postAuthor 20006 }; 20007 } 20008 20009 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js 20010 /** 20011 * WordPress dependencies 20012 */ 20013 20014 20015 20016 20017 20018 20019 /** 20020 * Internal dependencies 20021 */ 20022 20023 20024 20025 function PostAuthorCombobox() { 20026 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); 20027 const { 20028 editPost 20029 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20030 const { 20031 authorId, 20032 authorOptions 20033 } = useAuthorsQuery(fieldValue); 20034 20035 /** 20036 * Handle author selection. 20037 * 20038 * @param {number} postAuthorId The selected Author. 20039 */ 20040 const handleSelect = postAuthorId => { 20041 if (!postAuthorId) { 20042 return; 20043 } 20044 editPost({ 20045 author: postAuthorId 20046 }); 20047 }; 20048 20049 /** 20050 * Handle user input. 20051 * 20052 * @param {string} inputValue The current value of the input field. 20053 */ 20054 const handleKeydown = inputValue => { 20055 setFieldValue(inputValue); 20056 }; 20057 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { 20058 __nextHasNoMarginBottom: true, 20059 __next40pxDefaultSize: true, 20060 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 20061 options: authorOptions, 20062 value: authorId, 20063 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), 20064 onChange: handleSelect, 20065 allowReset: false, 20066 hideLabelFromVision: true 20067 }); 20068 } 20069 20070 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/select.js 20071 /** 20072 * WordPress dependencies 20073 */ 20074 20075 20076 20077 20078 /** 20079 * Internal dependencies 20080 */ 20081 20082 20083 20084 function PostAuthorSelect() { 20085 const { 20086 editPost 20087 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20088 const { 20089 authorId, 20090 authorOptions 20091 } = useAuthorsQuery(); 20092 const setAuthorId = value => { 20093 const author = Number(value); 20094 editPost({ 20095 author 20096 }); 20097 }; 20098 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 20099 __next40pxDefaultSize: true, 20100 __nextHasNoMarginBottom: true, 20101 className: "post-author-selector", 20102 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 20103 options: authorOptions, 20104 onChange: setAuthorId, 20105 value: authorId, 20106 hideLabelFromVision: true 20107 }); 20108 } 20109 20110 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/index.js 20111 /** 20112 * WordPress dependencies 20113 */ 20114 20115 20116 20117 /** 20118 * Internal dependencies 20119 */ 20120 20121 20122 20123 20124 const minimumUsersForCombobox = 25; 20125 20126 /** 20127 * Renders the component for selecting the post author. 20128 * 20129 * @return {React.ReactNode} The rendered component. 20130 */ 20131 function PostAuthor() { 20132 const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => { 20133 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 20134 return authors?.length >= minimumUsersForCombobox; 20135 }, []); 20136 if (showCombobox) { 20137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {}); 20138 } 20139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {}); 20140 } 20141 /* harmony default export */ const post_author = (PostAuthor); 20142 20143 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/check.js 20144 /** 20145 * WordPress dependencies 20146 */ 20147 20148 20149 20150 /** 20151 * Internal dependencies 20152 */ 20153 20154 20155 20156 20157 /** 20158 * Wrapper component that renders its children only if the post type supports the author. 20159 * 20160 * @param {Object} props The component props. 20161 * @param {React.ReactNode} props.children Children to be rendered. 20162 * 20163 * @return {React.ReactNode} The component to be rendered. Return `null` if the post type doesn't 20164 * supports the author or if there are no authors available. 20165 */ 20166 20167 function PostAuthorCheck({ 20168 children 20169 }) { 20170 const { 20171 hasAssignAuthorAction, 20172 hasAuthors 20173 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20174 var _post$_links$wpActio; 20175 const post = select(store_store).getCurrentPost(); 20176 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 20177 return { 20178 hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false, 20179 hasAuthors: authors?.length >= 1 20180 }; 20181 }, []); 20182 if (!hasAssignAuthorAction || !hasAuthors) { 20183 return null; 20184 } 20185 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20186 supportKeys: "author", 20187 children: children 20188 }); 20189 } 20190 20191 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js 20192 /** 20193 * WordPress dependencies 20194 */ 20195 20196 20197 20198 20199 20200 20201 /** 20202 * Internal dependencies 20203 */ 20204 20205 20206 20207 20208 20209 function PostAuthorToggle({ 20210 isOpen, 20211 onClick 20212 }) { 20213 const { 20214 postAuthor 20215 } = useAuthorsQuery(); 20216 const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)('(No author)'); 20217 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20218 size: "compact", 20219 className: "editor-post-author__panel-toggle", 20220 variant: "tertiary", 20221 "aria-expanded": isOpen, 20222 "aria-label": 20223 // translators: %s: Author name. 20224 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change author: %s'), authorName), 20225 onClick: onClick, 20226 children: authorName 20227 }); 20228 } 20229 20230 /** 20231 * Renders the Post Author Panel component. 20232 * 20233 * @return {React.ReactNode} The rendered component. 20234 */ 20235 function panel_PostAuthor() { 20236 // Use internal state instead of a ref to make sure that the component 20237 // re-renders when the popover's anchor updates. 20238 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20239 // Memoize popoverProps to avoid returning a new object every time. 20240 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 20241 // Anchor the popover to the middle of the entire row so that it doesn't 20242 // move around when the label changes. 20243 anchor: popoverAnchor, 20244 placement: 'left-start', 20245 offset: 36, 20246 shift: true 20247 }), [popoverAnchor]); 20248 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, { 20249 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 20250 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 20251 ref: setPopoverAnchor, 20252 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 20253 popoverProps: popoverProps, 20254 contentClassName: "editor-post-author__panel-dialog", 20255 focusOnMount: true, 20256 renderToggle: ({ 20257 isOpen, 20258 onToggle 20259 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorToggle, { 20260 isOpen: isOpen, 20261 onClick: onToggle 20262 }), 20263 renderContent: ({ 20264 onClose 20265 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 20266 className: "editor-post-author", 20267 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 20268 title: (0,external_wp_i18n_namespaceObject.__)('Author'), 20269 onClose: onClose 20270 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author, { 20271 onClose: onClose 20272 })] 20273 }) 20274 }) 20275 }) 20276 }); 20277 } 20278 /* harmony default export */ const panel = (panel_PostAuthor); 20279 20280 ;// ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js 20281 /** 20282 * WordPress dependencies 20283 */ 20284 20285 20286 20287 20288 /** 20289 * Internal dependencies 20290 */ 20291 20292 20293 const COMMENT_OPTIONS = [{ 20294 label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), 20295 value: 'open', 20296 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 20297 }, { 20298 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 20299 value: 'closed', 20300 description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') 20301 }]; 20302 function PostComments() { 20303 const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { 20304 var _select$getEditedPost; 20305 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; 20306 }, []); 20307 const { 20308 editPost 20309 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20310 const handleStatus = newCommentStatus => editPost({ 20311 comment_status: newCommentStatus 20312 }); 20313 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 20314 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 20315 spacing: 4, 20316 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 20317 className: "editor-change-status__options", 20318 hideLabelFromVision: true, 20319 label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), 20320 options: COMMENT_OPTIONS, 20321 onChange: handleStatus, 20322 selected: commentStatus 20323 }) 20324 }) 20325 }); 20326 } 20327 20328 /** 20329 * A form for managing comment status. 20330 * 20331 * @return {React.ReactNode} The rendered PostComments component. 20332 */ 20333 /* harmony default export */ const post_comments = (PostComments); 20334 20335 ;// ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js 20336 /** 20337 * WordPress dependencies 20338 */ 20339 20340 20341 20342 20343 /** 20344 * Internal dependencies 20345 */ 20346 20347 20348 function PostPingbacks() { 20349 const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { 20350 var _select$getEditedPost; 20351 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('ping_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; 20352 }, []); 20353 const { 20354 editPost 20355 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20356 const onTogglePingback = () => editPost({ 20357 ping_status: pingStatus === 'open' ? 'closed' : 'open' 20358 }); 20359 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 20360 __nextHasNoMarginBottom: true, 20361 label: (0,external_wp_i18n_namespaceObject.__)('Enable pingbacks & trackbacks'), 20362 checked: pingStatus === 'open', 20363 onChange: onTogglePingback, 20364 help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 20365 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'), 20366 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about pingbacks & trackbacks') 20367 }) 20368 }); 20369 } 20370 20371 /** 20372 * Renders a control for enabling or disabling pingbacks and trackbacks 20373 * in a WordPress post. 20374 * 20375 * @module PostPingbacks 20376 */ 20377 /* harmony default export */ const post_pingbacks = (PostPingbacks); 20378 20379 ;// ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js 20380 /** 20381 * WordPress dependencies 20382 */ 20383 20384 20385 20386 20387 20388 20389 20390 /** 20391 * Internal dependencies 20392 */ 20393 20394 20395 20396 20397 20398 20399 const panel_PANEL_NAME = 'discussion-panel'; 20400 function ModalContents({ 20401 onClose 20402 }) { 20403 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 20404 className: "editor-post-discussion", 20405 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 20406 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 20407 onClose: onClose 20408 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20409 spacing: 4, 20410 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20411 supportKeys: "comments", 20412 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments, {}) 20413 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20414 supportKeys: "trackbacks", 20415 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks, {}) 20416 })] 20417 })] 20418 }); 20419 } 20420 function PostDiscussionToggle({ 20421 isOpen, 20422 onClick 20423 }) { 20424 const { 20425 commentStatus, 20426 pingStatus, 20427 commentsSupported, 20428 trackbacksSupported 20429 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20430 var _getEditedPostAttribu, _getEditedPostAttribu2; 20431 const { 20432 getEditedPostAttribute 20433 } = select(store_store); 20434 const { 20435 getPostType 20436 } = select(external_wp_coreData_namespaceObject.store); 20437 const postType = getPostType(getEditedPostAttribute('type')); 20438 return { 20439 commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open', 20440 pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open', 20441 commentsSupported: !!postType.supports.comments, 20442 trackbacksSupported: !!postType.supports.trackbacks 20443 }; 20444 }, []); 20445 let label; 20446 if (commentStatus === 'open') { 20447 if (pingStatus === 'open') { 20448 label = (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); 20449 } else { 20450 label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)('Comments only') : (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); 20451 } 20452 } else if (pingStatus === 'open') { 20453 label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)('Pings only') : (0,external_wp_i18n_namespaceObject.__)('Pings enabled'); 20454 } else { 20455 label = (0,external_wp_i18n_namespaceObject.__)('Closed'); 20456 } 20457 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20458 size: "compact", 20459 className: "editor-post-discussion__panel-toggle", 20460 variant: "tertiary", 20461 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion options'), 20462 "aria-expanded": isOpen, 20463 onClick: onClick, 20464 children: label 20465 }); 20466 } 20467 20468 /** 20469 * This component allows to update comment and pingback 20470 * settings for the current post. Internally there are 20471 * checks whether the current post has support for the 20472 * above and if the `discussion-panel` panel is enabled. 20473 * 20474 * @return {React.ReactNode} The rendered PostDiscussionPanel component. 20475 */ 20476 function PostDiscussionPanel() { 20477 const { 20478 isEnabled 20479 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20480 const { 20481 isEditorPanelEnabled 20482 } = select(store_store); 20483 return { 20484 isEnabled: isEditorPanelEnabled(panel_PANEL_NAME) 20485 }; 20486 }, []); 20487 20488 // Use internal state instead of a ref to make sure that the component 20489 // re-renders when the popover's anchor updates. 20490 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20491 // Memoize popoverProps to avoid returning a new object every time. 20492 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 20493 // Anchor the popover to the middle of the entire row so that it doesn't 20494 // move around when the label changes. 20495 anchor: popoverAnchor, 20496 placement: 'left-start', 20497 offset: 36, 20498 shift: true 20499 }), [popoverAnchor]); 20500 if (!isEnabled) { 20501 return null; 20502 } 20503 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20504 supportKeys: ['comments', 'trackbacks'], 20505 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 20506 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 20507 ref: setPopoverAnchor, 20508 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 20509 popoverProps: popoverProps, 20510 className: "editor-post-discussion__panel-dropdown", 20511 contentClassName: "editor-post-discussion__panel-dialog", 20512 focusOnMount: true, 20513 renderToggle: ({ 20514 isOpen, 20515 onToggle 20516 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionToggle, { 20517 isOpen: isOpen, 20518 onClick: onToggle 20519 }), 20520 renderContent: ({ 20521 onClose 20522 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, { 20523 onClose: onClose 20524 }) 20525 }) 20526 }) 20527 }); 20528 } 20529 20530 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js 20531 /** 20532 * WordPress dependencies 20533 */ 20534 20535 20536 20537 20538 20539 20540 /** 20541 * Internal dependencies 20542 */ 20543 20544 20545 /** 20546 * Renders an editable textarea for the post excerpt. 20547 * Templates, template parts and patterns use the `excerpt` field as a description semantically. 20548 * Additionally templates and template parts override the `excerpt` field as `description` in 20549 * REST API. So this component handles proper labeling and updating the edited entity. 20550 * 20551 * @param {Object} props - Component props. 20552 * @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label. 20553 * @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur. 20554 */ 20555 20556 function PostExcerpt({ 20557 hideLabelFromVision = false, 20558 updateOnBlur = false 20559 }) { 20560 const { 20561 excerpt, 20562 shouldUseDescriptionLabel, 20563 usedAttribute 20564 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20565 const { 20566 getCurrentPostType, 20567 getEditedPostAttribute 20568 } = select(store_store); 20569 const postType = getCurrentPostType(); 20570 // This special case is unfortunate, but the REST API of wp_template and wp_template_part 20571 // support the excerpt field through the "description" field rather than "excerpt". 20572 const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt'; 20573 return { 20574 excerpt: getEditedPostAttribute(_usedAttribute), 20575 // There are special cases where we want to label the excerpt as a description. 20576 shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType), 20577 usedAttribute: _usedAttribute 20578 }; 20579 }, []); 20580 const { 20581 editPost 20582 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20583 const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)); 20584 const updatePost = value => { 20585 editPost({ 20586 [usedAttribute]: value 20587 }); 20588 }; 20589 const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Write a description (optional)') : (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'); 20590 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20591 className: "editor-post-excerpt", 20592 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 20593 __nextHasNoMarginBottom: true, 20594 label: label, 20595 hideLabelFromVision: hideLabelFromVision, 20596 className: "editor-post-excerpt__textarea", 20597 onChange: updateOnBlur ? setLocalExcerpt : updatePost, 20598 onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined, 20599 value: updateOnBlur ? localExcerpt : excerpt, 20600 help: !shouldUseDescriptionLabel ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 20601 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'), 20602 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts') 20603 }) : (0,external_wp_i18n_namespaceObject.__)('Write a description') 20604 }) 20605 }); 20606 } 20607 20608 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js 20609 /** 20610 * Internal dependencies 20611 */ 20612 20613 20614 /** 20615 * Component for checking if the post type supports the excerpt field. 20616 * 20617 * @param {Object} props Props. 20618 * @param {React.ReactNode} props.children Children to be rendered. 20619 * 20620 * @return {React.ReactNode} The rendered component. 20621 */ 20622 20623 function PostExcerptCheck({ 20624 children 20625 }) { 20626 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20627 supportKeys: "excerpt", 20628 children: children 20629 }); 20630 } 20631 /* harmony default export */ const post_excerpt_check = (PostExcerptCheck); 20632 20633 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js 20634 /** 20635 * Defines as extensibility slot for the Excerpt panel. 20636 */ 20637 20638 /** 20639 * WordPress dependencies 20640 */ 20641 20642 20643 const { 20644 Fill: plugin_Fill, 20645 Slot: plugin_Slot 20646 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostExcerpt'); 20647 20648 /** 20649 * Renders a post excerpt panel in the post sidebar. 20650 * 20651 * @param {Object} props Component properties. 20652 * @param {string} [props.className] An optional class name added to the row. 20653 * @param {React.ReactNode} props.children Children to be rendered. 20654 * 20655 * @example 20656 * ```js 20657 * // Using ES5 syntax 20658 * var __ = wp.i18n.__; 20659 * var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt; 20660 * 20661 * function MyPluginPostExcerpt() { 20662 * return React.createElement( 20663 * PluginPostExcerpt, 20664 * { 20665 * className: 'my-plugin-post-excerpt', 20666 * }, 20667 * __( 'Post excerpt custom content' ) 20668 * ) 20669 * } 20670 * ``` 20671 * 20672 * @example 20673 * ```jsx 20674 * // Using ESNext syntax 20675 * import { __ } from '@wordpress/i18n'; 20676 * import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post'; 20677 * 20678 * const MyPluginPostExcerpt = () => ( 20679 * <PluginPostExcerpt className="my-plugin-post-excerpt"> 20680 * { __( 'Post excerpt custom content' ) } 20681 * </PluginPostExcerpt> 20682 * ); 20683 * ``` 20684 * 20685 * @return {React.ReactNode} The rendered component. 20686 */ 20687 const PluginPostExcerpt = ({ 20688 children, 20689 className 20690 }) => { 20691 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, { 20692 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 20693 className: className, 20694 children: children 20695 }) 20696 }); 20697 }; 20698 PluginPostExcerpt.Slot = plugin_Slot; 20699 /* harmony default export */ const post_excerpt_plugin = (PluginPostExcerpt); 20700 20701 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js 20702 /** 20703 * WordPress dependencies 20704 */ 20705 20706 20707 20708 20709 20710 20711 20712 20713 /** 20714 * Internal dependencies 20715 */ 20716 20717 20718 20719 20720 20721 20722 /** 20723 * Module Constants 20724 */ 20725 20726 const post_excerpt_panel_PANEL_NAME = 'post-excerpt'; 20727 function ExcerptPanel() { 20728 const { 20729 isOpened, 20730 isEnabled, 20731 postType 20732 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20733 const { 20734 isEditorPanelOpened, 20735 isEditorPanelEnabled, 20736 getCurrentPostType 20737 } = select(store_store); 20738 return { 20739 isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME), 20740 isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME), 20741 postType: getCurrentPostType() 20742 }; 20743 }, []); 20744 const { 20745 toggleEditorPanelOpened 20746 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20747 const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME); 20748 if (!isEnabled) { 20749 return null; 20750 } 20751 20752 // There are special cases where we want to label the excerpt as a description. 20753 const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType); 20754 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 20755 title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'), 20756 opened: isOpened, 20757 onToggle: toggleExcerptPanel, 20758 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { 20759 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20760 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills] 20761 }) 20762 }) 20763 }); 20764 } 20765 20766 /** 20767 * Is rendered if the post type supports excerpts and allows editing the excerpt. 20768 * 20769 * @return {React.ReactNode} The rendered PostExcerptPanel component. 20770 */ 20771 function PostExcerptPanel() { 20772 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 20773 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {}) 20774 }); 20775 } 20776 function PrivatePostExcerptPanel() { 20777 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 20778 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {}) 20779 }); 20780 } 20781 function PrivateExcerpt() { 20782 const { 20783 shouldRender, 20784 excerpt, 20785 shouldBeUsedAsDescription, 20786 allowEditing 20787 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20788 const { 20789 getCurrentPostType, 20790 getCurrentPostId, 20791 getEditedPostAttribute, 20792 isEditorPanelEnabled 20793 } = select(store_store); 20794 const postType = getCurrentPostType(); 20795 const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType); 20796 const isPattern = postType === 'wp_block'; 20797 // These post types use the `excerpt` field as a description semantically, so we need to 20798 // handle proper labeling and some flows where we should always render them as text. 20799 const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern; 20800 const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt'; 20801 // We need to fetch the entity in this case to check if we'll allow editing. 20802 const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId()); 20803 // For post types that use excerpt as description, we do not abide 20804 // by the `isEnabled` panel flag in order to render them as text. 20805 const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription; 20806 return { 20807 excerpt: getEditedPostAttribute(_usedAttribute), 20808 shouldRender: _shouldRender, 20809 shouldBeUsedAsDescription: _shouldBeUsedAsDescription, 20810 // If we should render, allow editing for all post types that are not used as description. 20811 // For the rest allow editing only for user generated entities. 20812 allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom) 20813 }; 20814 }, []); 20815 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20816 const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'); 20817 // Memoize popoverProps to avoid returning a new object every time. 20818 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 20819 // Anchor the popover to the middle of the entire row so that it doesn't 20820 // move around when the label changes. 20821 anchor: popoverAnchor, 20822 'aria-label': label, 20823 headerTitle: label, 20824 placement: 'left-start', 20825 offset: 36, 20826 shift: true 20827 }), [popoverAnchor, label]); 20828 if (!shouldRender) { 20829 return false; 20830 } 20831 const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 20832 align: "left", 20833 numberOfLines: 4, 20834 truncate: allowEditing, 20835 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) 20836 }); 20837 if (!allowEditing) { 20838 return excerptText; 20839 } 20840 const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…'); 20841 const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt'); 20842 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 20843 children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 20844 className: "editor-post-excerpt__dropdown", 20845 contentClassName: "editor-post-excerpt__dropdown__content", 20846 popoverProps: popoverProps, 20847 focusOnMount: true, 20848 ref: setPopoverAnchor, 20849 renderToggle: ({ 20850 onToggle 20851 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20852 __next40pxDefaultSize: true, 20853 onClick: onToggle, 20854 variant: "link", 20855 children: excerptText ? triggerEditLabel : excerptPlaceholder 20856 }), 20857 renderContent: ({ 20858 onClose 20859 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20860 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 20861 title: label, 20862 onClose: onClose 20863 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 20864 spacing: 4, 20865 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { 20866 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20867 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, { 20868 hideLabelFromVision: true, 20869 updateOnBlur: true 20870 }), fills] 20871 }) 20872 }) 20873 })] 20874 }) 20875 })] 20876 }); 20877 } 20878 20879 ;// ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js 20880 /* wp:polyfill */ 20881 /** 20882 * WordPress dependencies 20883 */ 20884 20885 20886 20887 /** 20888 * Internal dependencies 20889 */ 20890 20891 20892 /** 20893 * Checks if the current theme supports specific features and renders the children if supported. 20894 * 20895 * @param {Object} props The component props. 20896 * @param {React.ReactNode} props.children The children to render if the theme supports the specified features. 20897 * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check. 20898 * 20899 * @return {React.ReactNode} The rendered children if the theme supports the specified features, otherwise null. 20900 */ 20901 function ThemeSupportCheck({ 20902 children, 20903 supportKeys 20904 }) { 20905 const { 20906 postType, 20907 themeSupports 20908 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20909 return { 20910 postType: select(store_store).getEditedPostAttribute('type'), 20911 themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports() 20912 }; 20913 }, []); 20914 const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => { 20915 var _themeSupports$key; 20916 const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; 20917 // 'post-thumbnails' can be boolean or an array of post types. 20918 // In the latter case, we need to verify `postType` exists 20919 // within `supported`. If `postType` isn't passed, then the check 20920 // should fail. 20921 if ('post-thumbnails' === key && Array.isArray(supported)) { 20922 return supported.includes(postType); 20923 } 20924 return supported; 20925 }); 20926 if (!isSupported) { 20927 return null; 20928 } 20929 return children; 20930 } 20931 20932 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js 20933 /** 20934 * Internal dependencies 20935 */ 20936 20937 20938 20939 /** 20940 * Wrapper component that renders its children only if the post type supports a featured image 20941 * and the theme supports post thumbnails. 20942 * 20943 * @param {Object} props Props. 20944 * @param {React.ReactNode} props.children Children to be rendered. 20945 * 20946 * @return {React.ReactNode} The rendered component. 20947 */ 20948 20949 function PostFeaturedImageCheck({ 20950 children 20951 }) { 20952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, { 20953 supportKeys: "post-thumbnails", 20954 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20955 supportKeys: "thumbnail", 20956 children: children 20957 }) 20958 }); 20959 } 20960 /* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck); 20961 20962 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js 20963 /** 20964 * External dependencies 20965 */ 20966 20967 20968 /** 20969 * WordPress dependencies 20970 */ 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 /** 20982 * Internal dependencies 20983 */ 20984 20985 20986 20987 const ALLOWED_MEDIA_TYPES = ['image']; 20988 20989 // Used when labels from post type were not yet loaded or when they are not present. 20990 const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image'); 20991 const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image'); 20992 const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 20993 children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.') 20994 }); 20995 function getMediaDetails(media, postId) { 20996 var _media$media_details$, _media$media_details$2; 20997 if (!media) { 20998 return {}; 20999 } 21000 const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId); 21001 if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) { 21002 return { 21003 mediaWidth: media.media_details.sizes[defaultSize].width, 21004 mediaHeight: media.media_details.sizes[defaultSize].height, 21005 mediaSourceUrl: media.media_details.sizes[defaultSize].source_url 21006 }; 21007 } 21008 21009 // Use fallbackSize when defaultSize is not available. 21010 const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId); 21011 if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) { 21012 return { 21013 mediaWidth: media.media_details.sizes[fallbackSize].width, 21014 mediaHeight: media.media_details.sizes[fallbackSize].height, 21015 mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url 21016 }; 21017 } 21018 21019 // Use full image size when fallbackSize and defaultSize are not available. 21020 return { 21021 mediaWidth: media.media_details.width, 21022 mediaHeight: media.media_details.height, 21023 mediaSourceUrl: media.source_url 21024 }; 21025 } 21026 function PostFeaturedImage({ 21027 currentPostId, 21028 featuredImageId, 21029 onUpdateImage, 21030 onRemoveImage, 21031 media, 21032 postType, 21033 noticeUI, 21034 noticeOperations, 21035 isRequestingFeaturedImageMedia 21036 }) { 21037 const returnsFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); 21038 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); 21039 const { 21040 getSettings 21041 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 21042 const { 21043 mediaSourceUrl 21044 } = getMediaDetails(media, currentPostId); 21045 function onDropFiles(filesList) { 21046 getSettings().mediaUpload({ 21047 allowedTypes: ALLOWED_MEDIA_TYPES, 21048 filesList, 21049 onFileChange([image]) { 21050 if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { 21051 setIsLoading(true); 21052 return; 21053 } 21054 if (image) { 21055 onUpdateImage(image); 21056 } 21057 setIsLoading(false); 21058 }, 21059 onError(message) { 21060 noticeOperations.removeAllNotices(); 21061 noticeOperations.createErrorNotice(message); 21062 } 21063 }); 21064 } 21065 21066 /** 21067 * Generates the featured image alt text for this editing context. 21068 * 21069 * @param {Object} imageMedia The image media object. 21070 * @param {string} imageMedia.alt_text The alternative text of the image. 21071 * @param {Object} imageMedia.media_details The media details of the image. 21072 * @param {Object} imageMedia.media_details.sizes The sizes of the image. 21073 * @param {Object} imageMedia.media_details.sizes.full The full size details of the image. 21074 * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image. 21075 * @param {string} imageMedia.slug The slug of the image. 21076 * @return {string} The featured image alt text. 21077 */ 21078 function getImageDescription(imageMedia) { 21079 if (imageMedia.alt_text) { 21080 return (0,external_wp_i18n_namespaceObject.sprintf)( 21081 // Translators: %s: The selected image alt text. 21082 (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), imageMedia.alt_text); 21083 } 21084 return (0,external_wp_i18n_namespaceObject.sprintf)( 21085 // Translators: %s: The selected image filename. 21086 (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), imageMedia.media_details.sizes?.full?.file || imageMedia.slug); 21087 } 21088 function returnFocus(node) { 21089 if (returnsFocusRef.current && node) { 21090 node.focus(); 21091 returnsFocusRef.current = false; 21092 } 21093 } 21094 const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media; 21095 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, { 21096 children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21097 className: "editor-post-featured-image", 21098 children: [media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21099 id: `editor-post-featured-image-$featuredImageId}-describedby`, 21100 className: "hidden", 21101 children: getImageDescription(media) 21102 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { 21103 fallback: instructions, 21104 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, { 21105 title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 21106 onSelect: onUpdateImage, 21107 unstableFeaturedImageFlow: true, 21108 allowedTypes: ALLOWED_MEDIA_TYPES, 21109 modalClass: "editor-post-featured-image__media-modal", 21110 render: ({ 21111 open 21112 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21113 className: "editor-post-featured-image__container", 21114 children: [isMissingMedia ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 21115 status: "warning", 21116 isDismissible: false, 21117 children: (0,external_wp_i18n_namespaceObject.__)('Could not retrieve the featured image data.') 21118 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 21119 __next40pxDefaultSize: true, 21120 ref: returnFocus, 21121 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', 21122 onClick: open, 21123 "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the featured image'), 21124 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-$featuredImageId}-describedby`, 21125 "aria-haspopup": "dialog", 21126 disabled: isLoading, 21127 accessibleWhenDisabled: true, 21128 children: [!!featuredImageId && media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 21129 className: "editor-post-featured-image__preview-image", 21130 src: mediaSourceUrl, 21131 alt: getImageDescription(media) 21132 }), (isLoading || isRequestingFeaturedImageMedia) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)] 21133 }), !!featuredImageId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21134 className: dist_clsx('editor-post-featured-image__actions', { 21135 'editor-post-featured-image__actions-missing-image': isMissingMedia, 21136 'editor-post-featured-image__actions-is-requesting-image': isRequestingFeaturedImageMedia 21137 }), 21138 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21139 __next40pxDefaultSize: true, 21140 className: "editor-post-featured-image__action", 21141 onClick: open, 21142 "aria-haspopup": "dialog", 21143 variant: isMissingMedia ? 'secondary' : undefined, 21144 children: (0,external_wp_i18n_namespaceObject.__)('Replace') 21145 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21146 __next40pxDefaultSize: true, 21147 className: "editor-post-featured-image__action", 21148 onClick: () => { 21149 onRemoveImage(); 21150 // Signal that the toggle button should be focused, 21151 // when it is rendered. Can't focus it directly here 21152 // because it's rendered conditionally. 21153 returnsFocusRef.current = true; 21154 }, 21155 variant: isMissingMedia ? 'secondary' : undefined, 21156 isDestructive: isMissingMedia, 21157 children: (0,external_wp_i18n_namespaceObject.__)('Remove') 21158 })] 21159 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { 21160 onFilesDrop: onDropFiles 21161 })] 21162 }), 21163 value: featuredImageId 21164 }) 21165 })] 21166 })] 21167 }); 21168 } 21169 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { 21170 const { 21171 getMedia, 21172 getPostType, 21173 hasFinishedResolution 21174 } = select(external_wp_coreData_namespaceObject.store); 21175 const { 21176 getCurrentPostId, 21177 getEditedPostAttribute 21178 } = select(store_store); 21179 const featuredImageId = getEditedPostAttribute('featured_media'); 21180 return { 21181 media: featuredImageId ? getMedia(featuredImageId, { 21182 context: 'view' 21183 }) : null, 21184 currentPostId: getCurrentPostId(), 21185 postType: getPostType(getEditedPostAttribute('type')), 21186 featuredImageId, 21187 isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution('getMedia', [featuredImageId, { 21188 context: 'view' 21189 }]) 21190 }; 21191 }); 21192 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 21193 noticeOperations 21194 }, { 21195 select 21196 }) => { 21197 const { 21198 editPost 21199 } = dispatch(store_store); 21200 return { 21201 onUpdateImage(image) { 21202 editPost({ 21203 featured_media: image.id 21204 }); 21205 }, 21206 onDropImage(filesList) { 21207 select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ 21208 allowedTypes: ['image'], 21209 filesList, 21210 onFileChange([image]) { 21211 editPost({ 21212 featured_media: image.id 21213 }); 21214 }, 21215 onError(message) { 21216 noticeOperations.removeAllNotices(); 21217 noticeOperations.createErrorNotice(message); 21218 } 21219 }); 21220 }, 21221 onRemoveImage() { 21222 editPost({ 21223 featured_media: 0 21224 }); 21225 } 21226 }; 21227 }); 21228 21229 /** 21230 * Renders the component for managing the featured image of a post. 21231 * 21232 * @param {Object} props Props. 21233 * @param {number} props.currentPostId ID of the current post. 21234 * @param {number} props.featuredImageId ID of the featured image. 21235 * @param {Function} props.onUpdateImage Function to call when the image is updated. 21236 * @param {Function} props.onRemoveImage Function to call when the image is removed. 21237 * @param {Object} props.media The media object representing the featured image. 21238 * @param {string} props.postType Post type. 21239 * @param {Element} props.noticeUI UI for displaying notices. 21240 * @param {Object} props.noticeOperations Operations for managing notices. 21241 * 21242 * @return {Element} Component to be rendered . 21243 */ 21244 /* harmony default export */ const post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage)); 21245 21246 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js 21247 /** 21248 * WordPress dependencies 21249 */ 21250 21251 21252 21253 21254 21255 /** 21256 * Internal dependencies 21257 */ 21258 21259 21260 21261 21262 const post_featured_image_panel_PANEL_NAME = 'featured-image'; 21263 21264 /** 21265 * Renders the panel for the post featured image. 21266 * 21267 * @param {Object} props Props. 21268 * @param {boolean} props.withPanelBody Whether to include the panel body. Default true. 21269 * 21270 * @return {React.ReactNode} The component to be rendered. 21271 * Return Null if the editor panel is disabled for featured image. 21272 */ 21273 function PostFeaturedImagePanel({ 21274 withPanelBody = true 21275 }) { 21276 var _postType$labels$feat; 21277 const { 21278 postType, 21279 isEnabled, 21280 isOpened 21281 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21282 const { 21283 getEditedPostAttribute, 21284 isEditorPanelEnabled, 21285 isEditorPanelOpened 21286 } = select(store_store); 21287 const { 21288 getPostType 21289 } = select(external_wp_coreData_namespaceObject.store); 21290 return { 21291 postType: getPostType(getEditedPostAttribute('type')), 21292 isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME), 21293 isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME) 21294 }; 21295 }, []); 21296 const { 21297 toggleEditorPanelOpened 21298 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21299 if (!isEnabled) { 21300 return null; 21301 } 21302 if (!withPanelBody) { 21303 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 21304 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) 21305 }); 21306 } 21307 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 21308 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 21309 title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'), 21310 opened: isOpened, 21311 onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME), 21312 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) 21313 }) 21314 }); 21315 } 21316 21317 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/check.js 21318 /** 21319 * WordPress dependencies 21320 */ 21321 21322 21323 /** 21324 * Internal dependencies 21325 */ 21326 21327 21328 21329 /** 21330 * Component check if there are any post formats. 21331 * 21332 * @param {Object} props The component props. 21333 * @param {React.ReactNode} props.children The child elements to render. 21334 * 21335 * @return {React.ReactNode} The rendered component or null if post formats are disabled. 21336 */ 21337 21338 function PostFormatCheck({ 21339 children 21340 }) { 21341 const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().disablePostFormats, []); 21342 if (disablePostFormats) { 21343 return null; 21344 } 21345 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 21346 supportKeys: "post-formats", 21347 children: children 21348 }); 21349 } 21350 21351 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/index.js 21352 /* wp:polyfill */ 21353 /** 21354 * WordPress dependencies 21355 */ 21356 21357 21358 21359 21360 21361 21362 /** 21363 * Internal dependencies 21364 */ 21365 21366 21367 21368 // All WP post formats, sorted alphabetically by translated name. 21369 21370 const POST_FORMATS = [{ 21371 id: 'aside', 21372 caption: (0,external_wp_i18n_namespaceObject.__)('Aside') 21373 }, { 21374 id: 'audio', 21375 caption: (0,external_wp_i18n_namespaceObject.__)('Audio') 21376 }, { 21377 id: 'chat', 21378 caption: (0,external_wp_i18n_namespaceObject.__)('Chat') 21379 }, { 21380 id: 'gallery', 21381 caption: (0,external_wp_i18n_namespaceObject.__)('Gallery') 21382 }, { 21383 id: 'image', 21384 caption: (0,external_wp_i18n_namespaceObject.__)('Image') 21385 }, { 21386 id: 'link', 21387 caption: (0,external_wp_i18n_namespaceObject.__)('Link') 21388 }, { 21389 id: 'quote', 21390 caption: (0,external_wp_i18n_namespaceObject.__)('Quote') 21391 }, { 21392 id: 'standard', 21393 caption: (0,external_wp_i18n_namespaceObject.__)('Standard') 21394 }, { 21395 id: 'status', 21396 caption: (0,external_wp_i18n_namespaceObject.__)('Status') 21397 }, { 21398 id: 'video', 21399 caption: (0,external_wp_i18n_namespaceObject.__)('Video') 21400 }].sort((a, b) => { 21401 const normalizedA = a.caption.toUpperCase(); 21402 const normalizedB = b.caption.toUpperCase(); 21403 if (normalizedA < normalizedB) { 21404 return -1; 21405 } 21406 if (normalizedA > normalizedB) { 21407 return 1; 21408 } 21409 return 0; 21410 }); 21411 21412 /** 21413 * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post. 21414 * 21415 * @example 21416 * ```jsx 21417 * <PostFormat /> 21418 * ``` 21419 * 21420 * @return {React.ReactNode} The rendered PostFormat component. 21421 */ 21422 function PostFormat() { 21423 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); 21424 const postFormatSelectorId = `post-format-selector-$instanceId}`; 21425 const { 21426 postFormat, 21427 suggestedFormat, 21428 supportedFormats 21429 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21430 const { 21431 getEditedPostAttribute, 21432 getSuggestedPostFormat 21433 } = select(store_store); 21434 const _postFormat = getEditedPostAttribute('format'); 21435 const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); 21436 return { 21437 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', 21438 suggestedFormat: getSuggestedPostFormat(), 21439 supportedFormats: themeSupports.formats 21440 }; 21441 }, []); 21442 const formats = POST_FORMATS.filter(format => { 21443 // Ensure current format is always in the set. 21444 // The current format may not be a format supported by the theme. 21445 return supportedFormats?.includes(format.id) || postFormat === format.id; 21446 }); 21447 const suggestion = formats.find(format => format.id === suggestedFormat); 21448 const { 21449 editPost 21450 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21451 const onUpdatePostFormat = format => editPost({ 21452 format 21453 }); 21454 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { 21455 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21456 className: "editor-post-format", 21457 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 21458 className: "editor-post-format__options", 21459 label: (0,external_wp_i18n_namespaceObject.__)('Post Format'), 21460 selected: postFormat, 21461 onChange: format => onUpdatePostFormat(format), 21462 id: postFormatSelectorId, 21463 options: formats.map(format => ({ 21464 label: format.caption, 21465 value: format.id 21466 })), 21467 hideLabelFromVision: true 21468 }), suggestion && suggestion.id !== postFormat && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 21469 className: "editor-post-format__suggestion", 21470 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21471 __next40pxDefaultSize: true, 21472 variant: "link", 21473 onClick: () => onUpdatePostFormat(suggestion.id), 21474 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post format */ 21475 (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption) 21476 }) 21477 })] 21478 }) 21479 }); 21480 } 21481 21482 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js 21483 /** 21484 * WordPress dependencies 21485 */ 21486 21487 21488 /** 21489 * Internal dependencies 21490 */ 21491 21492 21493 21494 /** 21495 * Wrapper component that renders its children if the post has more than one revision. 21496 * 21497 * @param {Object} props Props. 21498 * @param {React.ReactNode} props.children Children to be rendered. 21499 * 21500 * @return {React.ReactNode} Rendered child components if post has more than one revision, otherwise null. 21501 */ 21502 21503 function PostLastRevisionCheck({ 21504 children 21505 }) { 21506 const { 21507 lastRevisionId, 21508 revisionsCount 21509 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21510 const { 21511 getCurrentPostLastRevisionId, 21512 getCurrentPostRevisionsCount 21513 } = select(store_store); 21514 return { 21515 lastRevisionId: getCurrentPostLastRevisionId(), 21516 revisionsCount: getCurrentPostRevisionsCount() 21517 }; 21518 }, []); 21519 if (!lastRevisionId || revisionsCount < 2) { 21520 return null; 21521 } 21522 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 21523 supportKeys: "revisions", 21524 children: children 21525 }); 21526 } 21527 /* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck); 21528 21529 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js 21530 /** 21531 * WordPress dependencies 21532 */ 21533 21534 21535 21536 21537 21538 21539 /** 21540 * Internal dependencies 21541 */ 21542 21543 21544 21545 21546 function usePostLastRevisionInfo() { 21547 return (0,external_wp_data_namespaceObject.useSelect)(select => { 21548 const { 21549 getCurrentPostLastRevisionId, 21550 getCurrentPostRevisionsCount 21551 } = select(store_store); 21552 return { 21553 lastRevisionId: getCurrentPostLastRevisionId(), 21554 revisionsCount: getCurrentPostRevisionsCount() 21555 }; 21556 }, []); 21557 } 21558 21559 /** 21560 * Renders the component for displaying the last revision of a post. 21561 * 21562 * @return {React.ReactNode} The rendered component. 21563 */ 21564 function PostLastRevision() { 21565 const { 21566 lastRevisionId, 21567 revisionsCount 21568 } = usePostLastRevisionInfo(); 21569 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 21570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21571 __next40pxDefaultSize: true, 21572 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 21573 revision: lastRevisionId 21574 }), 21575 className: "editor-post-last-revision__title", 21576 icon: library_backup, 21577 iconPosition: "right", 21578 text: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of revisions. */ 21579 (0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount) 21580 }) 21581 }); 21582 } 21583 function PrivatePostLastRevision() { 21584 const { 21585 lastRevisionId, 21586 revisionsCount 21587 } = usePostLastRevisionInfo(); 21588 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 21589 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 21590 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 21591 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21592 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 21593 revision: lastRevisionId 21594 }), 21595 className: "editor-private-post-last-revision__button", 21596 text: revisionsCount, 21597 variant: "tertiary", 21598 size: "compact" 21599 }) 21600 }) 21601 }); 21602 } 21603 /* harmony default export */ const post_last_revision = (PostLastRevision); 21604 21605 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js 21606 /** 21607 * WordPress dependencies 21608 */ 21609 21610 21611 /** 21612 * Internal dependencies 21613 */ 21614 21615 21616 21617 /** 21618 * Renders the panel for displaying the last revision of a post. 21619 * 21620 * @return {React.ReactNode} The rendered component. 21621 */ 21622 21623 function PostLastRevisionPanel() { 21624 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 21625 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 21626 className: "editor-post-last-revision__panel", 21627 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision, {}) 21628 }) 21629 }); 21630 } 21631 /* harmony default export */ const post_last_revision_panel = (PostLastRevisionPanel); 21632 21633 ;// ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js 21634 /** 21635 * WordPress dependencies 21636 */ 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 /** 21647 * Internal dependencies 21648 */ 21649 21650 21651 /** 21652 * A modal component that is displayed when a post is locked for editing by another user. 21653 * The modal provides information about the lock status and options to take over or exit the editor. 21654 * 21655 * @return {React.ReactNode} The rendered PostLockedModal component. 21656 */ 21657 21658 function PostLockedModal() { 21659 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); 21660 const hookName = 'core/editor/post-locked-modal-' + instanceId; 21661 const { 21662 autosave, 21663 updatePostLock 21664 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21665 const { 21666 isLocked, 21667 isTakeover, 21668 user, 21669 postId, 21670 postLockUtils, 21671 activePostLock, 21672 postType, 21673 previewLink 21674 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21675 const { 21676 isPostLocked, 21677 isPostLockTakeover, 21678 getPostLockUser, 21679 getCurrentPostId, 21680 getActivePostLock, 21681 getEditedPostAttribute, 21682 getEditedPostPreviewLink, 21683 getEditorSettings 21684 } = select(store_store); 21685 const { 21686 getPostType 21687 } = select(external_wp_coreData_namespaceObject.store); 21688 return { 21689 isLocked: isPostLocked(), 21690 isTakeover: isPostLockTakeover(), 21691 user: getPostLockUser(), 21692 postId: getCurrentPostId(), 21693 postLockUtils: getEditorSettings().postLockUtils, 21694 activePostLock: getActivePostLock(), 21695 postType: getPostType(getEditedPostAttribute('type')), 21696 previewLink: getEditedPostPreviewLink() 21697 }; 21698 }, []); 21699 (0,external_wp_element_namespaceObject.useEffect)(() => { 21700 /** 21701 * Keep the lock refreshed. 21702 * 21703 * When the user does not send a heartbeat in a heartbeat-tick 21704 * the user is no longer editing and another user can start editing. 21705 * 21706 * @param {Object} data Data to send in the heartbeat request. 21707 */ 21708 function sendPostLock(data) { 21709 if (isLocked) { 21710 return; 21711 } 21712 data['wp-refresh-post-lock'] = { 21713 lock: activePostLock, 21714 post_id: postId 21715 }; 21716 } 21717 21718 /** 21719 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. 21720 * 21721 * @param {Object} data Data received in the heartbeat request 21722 */ 21723 function receivePostLock(data) { 21724 if (!data['wp-refresh-post-lock']) { 21725 return; 21726 } 21727 const received = data['wp-refresh-post-lock']; 21728 if (received.lock_error) { 21729 // Auto save and display the takeover modal. 21730 autosave(); 21731 updatePostLock({ 21732 isLocked: true, 21733 isTakeover: true, 21734 user: { 21735 name: received.lock_error.name, 21736 avatar: received.lock_error.avatar_src_2x 21737 } 21738 }); 21739 } else if (received.new_lock) { 21740 updatePostLock({ 21741 isLocked: false, 21742 activePostLock: received.new_lock 21743 }); 21744 } 21745 } 21746 21747 /** 21748 * Unlock the post before the window is exited. 21749 */ 21750 function releasePostLock() { 21751 if (isLocked || !activePostLock) { 21752 return; 21753 } 21754 const data = new window.FormData(); 21755 data.append('action', 'wp-remove-post-lock'); 21756 data.append('_wpnonce', postLockUtils.unlockNonce); 21757 data.append('post_ID', postId); 21758 data.append('active_post_lock', activePostLock); 21759 if (window.navigator.sendBeacon) { 21760 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); 21761 } else { 21762 const xhr = new window.XMLHttpRequest(); 21763 xhr.open('POST', postLockUtils.ajaxUrl, false); 21764 xhr.send(data); 21765 } 21766 } 21767 21768 // Details on these events on the Heartbeat API docs 21769 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ 21770 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock); 21771 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock); 21772 window.addEventListener('beforeunload', releasePostLock); 21773 return () => { 21774 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName); 21775 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName); 21776 window.removeEventListener('beforeunload', releasePostLock); 21777 }; 21778 }, []); 21779 if (!isLocked) { 21780 return null; 21781 } 21782 const userDisplayName = user.name; 21783 const userAvatar = user.avatar; 21784 const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 21785 'get-post-lock': '1', 21786 lockKey: true, 21787 post: postId, 21788 action: 'edit', 21789 _wpnonce: postLockUtils.nonce 21790 }); 21791 const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 21792 post_type: postType?.slug 21793 }); 21794 const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor'); 21795 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 21796 title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'), 21797 focusOnMount: true, 21798 shouldCloseOnClickOutside: false, 21799 shouldCloseOnEsc: false, 21800 isDismissible: false 21801 // Do not remove this class, as this class is used by third party plugins. 21802 , 21803 className: "editor-post-locked-modal", 21804 size: "medium", 21805 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21806 alignment: "top", 21807 spacing: 6, 21808 children: [!!userAvatar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 21809 src: userAvatar, 21810 alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'), 21811 className: "editor-post-locked-modal__avatar", 21812 width: 64, 21813 height: 64 21814 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21815 children: [!!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 21816 children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: user's display name */ 21817 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), { 21818 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 21819 PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 21820 href: previewLink, 21821 children: (0,external_wp_i18n_namespaceObject.__)('preview') 21822 }) 21823 }) 21824 }), !isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21825 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 21826 children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: user's display name */ 21827 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), { 21828 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 21829 PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 21830 href: previewLink, 21831 children: (0,external_wp_i18n_namespaceObject.__)('preview') 21832 }) 21833 }) 21834 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 21835 children: (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.') 21836 })] 21837 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 21838 className: "editor-post-locked-modal__buttons", 21839 justify: "flex-end", 21840 children: [!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21841 __next40pxDefaultSize: true, 21842 variant: "tertiary", 21843 href: unlockUrl, 21844 children: (0,external_wp_i18n_namespaceObject.__)('Take over') 21845 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21846 __next40pxDefaultSize: true, 21847 variant: "primary", 21848 href: allPostsUrl, 21849 children: allPostsLabel 21850 })] 21851 })] 21852 })] 21853 }) 21854 }); 21855 } 21856 21857 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js 21858 /** 21859 * WordPress dependencies 21860 */ 21861 21862 21863 /** 21864 * Internal dependencies 21865 */ 21866 21867 21868 /** 21869 * This component checks the publishing status of the current post. 21870 * If the post is already published or the user doesn't have the 21871 * capability to publish, it returns null. 21872 * 21873 * @param {Object} props Component properties. 21874 * @param {React.ReactNode} props.children Children to be rendered. 21875 * 21876 * @return {React.ReactNode} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish. 21877 */ 21878 function PostPendingStatusCheck({ 21879 children 21880 }) { 21881 const { 21882 hasPublishAction, 21883 isPublished 21884 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21885 var _getCurrentPost$_link; 21886 const { 21887 isCurrentPostPublished, 21888 getCurrentPost 21889 } = select(store_store); 21890 return { 21891 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 21892 isPublished: isCurrentPostPublished() 21893 }; 21894 }, []); 21895 if (isPublished || !hasPublishAction) { 21896 return null; 21897 } 21898 return children; 21899 } 21900 /* harmony default export */ const post_pending_status_check = (PostPendingStatusCheck); 21901 21902 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js 21903 /** 21904 * WordPress dependencies 21905 */ 21906 21907 21908 21909 21910 /** 21911 * Internal dependencies 21912 */ 21913 21914 21915 21916 /** 21917 * A component for displaying and toggling the pending status of a post. 21918 * 21919 * @return {React.ReactNode} The rendered component. 21920 */ 21921 21922 function PostPendingStatus() { 21923 const status = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('status'), []); 21924 const { 21925 editPost 21926 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21927 const togglePendingStatus = () => { 21928 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; 21929 editPost({ 21930 status: updatedStatus 21931 }); 21932 }; 21933 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check, { 21934 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 21935 __nextHasNoMarginBottom: true, 21936 label: (0,external_wp_i18n_namespaceObject.__)('Pending review'), 21937 checked: status === 'pending', 21938 onChange: togglePendingStatus 21939 }) 21940 }); 21941 } 21942 /* harmony default export */ const post_pending_status = (PostPendingStatus); 21943 21944 ;// ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js 21945 /** 21946 * WordPress dependencies 21947 */ 21948 21949 21950 21951 21952 21953 21954 21955 /** 21956 * Internal dependencies 21957 */ 21958 21959 21960 function writeInterstitialMessage(targetDocument) { 21961 let markup = (0,external_wp_element_namespaceObject.renderToString)(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21962 className: "editor-post-preview-button__interstitial-message", 21963 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { 21964 xmlns: "http://www.w3.org/2000/svg", 21965 viewBox: "0 0 96 96", 21966 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 21967 className: "outer", 21968 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", 21969 fill: "none" 21970 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 21971 className: "inner", 21972 d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", 21973 fill: "none" 21974 })] 21975 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 21976 children: (0,external_wp_i18n_namespaceObject.__)('Generating preview…') 21977 })] 21978 })); 21979 markup += ` 21980 <style> 21981 body { 21982 margin: 0; 21983 } 21984 .editor-post-preview-button__interstitial-message { 21985 display: flex; 21986 flex-direction: column; 21987 align-items: center; 21988 justify-content: center; 21989 height: 100vh; 21990 width: 100vw; 21991 } 21992 @-webkit-keyframes paint { 21993 0% { 21994 stroke-dashoffset: 0; 21995 } 21996 } 21997 @-moz-keyframes paint { 21998 0% { 21999 stroke-dashoffset: 0; 22000 } 22001 } 22002 @-o-keyframes paint { 22003 0% { 22004 stroke-dashoffset: 0; 22005 } 22006 } 22007 @keyframes paint { 22008 0% { 22009 stroke-dashoffset: 0; 22010 } 22011 } 22012 .editor-post-preview-button__interstitial-message svg { 22013 width: 192px; 22014 height: 192px; 22015 stroke: #555d66; 22016 stroke-width: 0.75; 22017 } 22018 .editor-post-preview-button__interstitial-message svg .outer, 22019 .editor-post-preview-button__interstitial-message svg .inner { 22020 stroke-dasharray: 280; 22021 stroke-dashoffset: 280; 22022 -webkit-animation: paint 1.5s ease infinite alternate; 22023 -moz-animation: paint 1.5s ease infinite alternate; 22024 -o-animation: paint 1.5s ease infinite alternate; 22025 animation: paint 1.5s ease infinite alternate; 22026 } 22027 p { 22028 text-align: center; 22029 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 22030 } 22031 </style> 22032 `; 22033 22034 /** 22035 * Filters the interstitial message shown when generating previews. 22036 * 22037 * @param {string} markup The preview interstitial markup. 22038 */ 22039 markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup); 22040 targetDocument.write(markup); 22041 targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…'); 22042 targetDocument.close(); 22043 } 22044 22045 /** 22046 * Renders a button that opens a new window or tab for the preview, 22047 * writes the interstitial message to this window, and then navigates 22048 * to the actual preview link. The button is not rendered if the post 22049 * is not viewable and disabled if the post is not saveable. 22050 * 22051 * @param {Object} props The component props. 22052 * @param {string} props.className The class name for the button. 22053 * @param {string} props.textContent The text content for the button. 22054 * @param {boolean} props.forceIsAutosaveable Whether to force autosave. 22055 * @param {string} props.role The role attribute for the button. 22056 * @param {Function} props.onPreview The callback function for preview event. 22057 * 22058 * @return {React.ReactNode} The rendered button component. 22059 */ 22060 function PostPreviewButton({ 22061 className, 22062 textContent, 22063 forceIsAutosaveable, 22064 role, 22065 onPreview 22066 }) { 22067 const { 22068 postId, 22069 currentPostLink, 22070 previewLink, 22071 isSaveable, 22072 isViewable 22073 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22074 var _postType$viewable; 22075 const editor = select(store_store); 22076 const core = select(external_wp_coreData_namespaceObject.store); 22077 const postType = core.getPostType(editor.getCurrentPostType('type')); 22078 const canView = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; 22079 if (!canView) { 22080 return { 22081 isViewable: canView 22082 }; 22083 } 22084 return { 22085 postId: editor.getCurrentPostId(), 22086 currentPostLink: editor.getCurrentPostAttribute('link'), 22087 previewLink: editor.getEditedPostPreviewLink(), 22088 isSaveable: editor.isEditedPostSaveable(), 22089 isViewable: canView 22090 }; 22091 }, []); 22092 const { 22093 __unstableSaveForPreview 22094 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22095 if (!isViewable) { 22096 return null; 22097 } 22098 const targetId = `wp-preview-$postId}`; 22099 const openPreviewWindow = async event => { 22100 // Our Preview button has its 'href' and 'target' set correctly for a11y 22101 // purposes. Unfortunately, though, we can't rely on the default 'click' 22102 // handler since sometimes it incorrectly opens a new tab instead of reusing 22103 // the existing one. 22104 // https://github.com/WordPress/gutenberg/pull/8330 22105 event.preventDefault(); 22106 22107 // Open up a Preview tab if needed. This is where we'll show the preview. 22108 const previewWindow = window.open('', targetId); 22109 22110 // Focus the Preview tab. This might not do anything, depending on the browser's 22111 // and user's preferences. 22112 // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus 22113 previewWindow.focus(); 22114 writeInterstitialMessage(previewWindow.document); 22115 const link = await __unstableSaveForPreview({ 22116 forceIsAutosaveable 22117 }); 22118 previewWindow.location = link; 22119 onPreview?.(); 22120 }; 22121 22122 // Link to the `?preview=true` URL if we have it, since this lets us see 22123 // changes that were autosaved since the post was last published. Otherwise, 22124 // just link to the post's URL. 22125 const href = previewLink || currentPostLink; 22126 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 22127 variant: !className ? 'tertiary' : undefined, 22128 className: className || 'editor-post-preview', 22129 href: href, 22130 target: targetId, 22131 accessibleWhenDisabled: true, 22132 disabled: !isSaveable, 22133 onClick: openPreviewWindow, 22134 role: role, 22135 size: "compact", 22136 children: textContent || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22137 children: [(0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 22138 as: "span", 22139 children: /* translators: accessibility text */ 22140 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 22141 })] 22142 }) 22143 }); 22144 } 22145 22146 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js 22147 /** 22148 * WordPress dependencies 22149 */ 22150 22151 22152 22153 22154 /** 22155 * Internal dependencies 22156 */ 22157 22158 22159 /** 22160 * Renders the label for the publish button. 22161 * 22162 * @return {string} The label for the publish button. 22163 */ 22164 function PublishButtonLabel() { 22165 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 22166 const { 22167 isPublished, 22168 isBeingScheduled, 22169 isSaving, 22170 isPublishing, 22171 hasPublishAction, 22172 isAutosaving, 22173 hasNonPostEntityChanges, 22174 postStatusHasChanged, 22175 postStatus 22176 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22177 var _getCurrentPost$_link; 22178 const { 22179 isCurrentPostPublished, 22180 isEditedPostBeingScheduled, 22181 isSavingPost, 22182 isPublishingPost, 22183 getCurrentPost, 22184 getCurrentPostType, 22185 isAutosavingPost, 22186 getPostEdits, 22187 getEditedPostAttribute 22188 } = select(store_store); 22189 return { 22190 isPublished: isCurrentPostPublished(), 22191 isBeingScheduled: isEditedPostBeingScheduled(), 22192 isSaving: isSavingPost(), 22193 isPublishing: isPublishingPost(), 22194 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 22195 postType: getCurrentPostType(), 22196 isAutosaving: isAutosavingPost(), 22197 hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(), 22198 postStatusHasChanged: !!getPostEdits()?.status, 22199 postStatus: getEditedPostAttribute('status') 22200 }; 22201 }, []); 22202 if (isPublishing) { 22203 /* translators: button label text should, if possible, be under 16 characters. */ 22204 return (0,external_wp_i18n_namespaceObject.__)('Publishing…'); 22205 } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) { 22206 /* translators: button label text should, if possible, be under 16 characters. */ 22207 return (0,external_wp_i18n_namespaceObject.__)('Saving…'); 22208 } 22209 if (!hasPublishAction) { 22210 // TODO: this is because "Submit for review" string is too long in some languages. 22211 // @see https://github.com/WordPress/gutenberg/issues/10475 22212 return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)('Publish') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review'); 22213 } 22214 if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || !postStatusHasChanged && postStatus === 'future') { 22215 return (0,external_wp_i18n_namespaceObject.__)('Save'); 22216 } 22217 if (isBeingScheduled) { 22218 return (0,external_wp_i18n_namespaceObject.__)('Schedule'); 22219 } 22220 return (0,external_wp_i18n_namespaceObject.__)('Publish'); 22221 } 22222 22223 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js 22224 /* wp:polyfill */ 22225 /** 22226 * WordPress dependencies 22227 */ 22228 22229 22230 22231 22232 22233 /** 22234 * Internal dependencies 22235 */ 22236 22237 22238 22239 const post_publish_button_noop = () => {}; 22240 class PostPublishButton extends external_wp_element_namespaceObject.Component { 22241 constructor(props) { 22242 super(props); 22243 this.createOnClick = this.createOnClick.bind(this); 22244 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); 22245 this.state = { 22246 entitiesSavedStatesCallback: false 22247 }; 22248 } 22249 createOnClick(callback) { 22250 return (...args) => { 22251 const { 22252 hasNonPostEntityChanges, 22253 setEntitiesSavedStatesCallback 22254 } = this.props; 22255 // If a post with non-post entities is published, but the user 22256 // elects to not save changes to the non-post entities, those 22257 // entities will still be dirty when the Publish button is clicked. 22258 // We also need to check that the `setEntitiesSavedStatesCallback` 22259 // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383 22260 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { 22261 // The modal for multiple entity saving will open, 22262 // hold the callback for saving/publishing the post 22263 // so that we can call it if the post entity is checked. 22264 this.setState({ 22265 entitiesSavedStatesCallback: () => callback(...args) 22266 }); 22267 22268 // Open the save panel by setting its callback. 22269 // To set a function on the useState hook, we must set it 22270 // with another function (() => myFunction). Passing the 22271 // function on its own will cause an error when called. 22272 setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates); 22273 return post_publish_button_noop; 22274 } 22275 return callback(...args); 22276 }; 22277 } 22278 closeEntitiesSavedStates(savedEntities) { 22279 const { 22280 postType, 22281 postId 22282 } = this.props; 22283 const { 22284 entitiesSavedStatesCallback 22285 } = this.state; 22286 this.setState({ 22287 entitiesSavedStatesCallback: false 22288 }, () => { 22289 if (savedEntities && savedEntities.some(elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { 22290 // The post entity was checked, call the held callback from `createOnClick`. 22291 entitiesSavedStatesCallback(); 22292 } 22293 }); 22294 } 22295 render() { 22296 const { 22297 forceIsDirty, 22298 hasPublishAction, 22299 isBeingScheduled, 22300 isOpen, 22301 isPostSavingLocked, 22302 isPublishable, 22303 isPublished, 22304 isSaveable, 22305 isSaving, 22306 isAutoSaving, 22307 isToggle, 22308 savePostStatus, 22309 onSubmit = post_publish_button_noop, 22310 onToggle, 22311 visibility, 22312 hasNonPostEntityChanges, 22313 isSavingNonPostEntityChanges, 22314 postStatus, 22315 postStatusHasChanged 22316 } = this.props; 22317 const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 22318 const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 22319 22320 // If the new status has not changed explicitly, we derive it from 22321 // other factors, like having a publish action, etc.. We need to preserve 22322 // this because it affects when to show the pre and post publish panels. 22323 // If it has changed though explicitly, we need to respect that. 22324 let publishStatus = 'publish'; 22325 if (postStatusHasChanged) { 22326 publishStatus = postStatus; 22327 } else if (!hasPublishAction) { 22328 publishStatus = 'pending'; 22329 } else if (visibility === 'private') { 22330 publishStatus = 'private'; 22331 } else if (isBeingScheduled) { 22332 publishStatus = 'future'; 22333 } 22334 const onClickButton = () => { 22335 if (isButtonDisabled) { 22336 return; 22337 } 22338 onSubmit(); 22339 savePostStatus(publishStatus); 22340 }; 22341 22342 // Callback to open the publish panel. 22343 const onClickToggle = () => { 22344 if (isToggleDisabled) { 22345 return; 22346 } 22347 onToggle(); 22348 }; 22349 const buttonProps = { 22350 'aria-disabled': isButtonDisabled, 22351 className: 'editor-post-publish-button', 22352 isBusy: !isAutoSaving && isSaving, 22353 variant: 'primary', 22354 onClick: this.createOnClick(onClickButton), 22355 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined 22356 }; 22357 const toggleProps = { 22358 'aria-disabled': isToggleDisabled, 22359 'aria-expanded': isOpen, 22360 className: 'editor-post-publish-panel__toggle', 22361 isBusy: isSaving && isPublished, 22362 variant: 'primary', 22363 size: 'compact', 22364 onClick: this.createOnClick(onClickToggle), 22365 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined 22366 }; 22367 const componentProps = isToggle ? toggleProps : buttonProps; 22368 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 22369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 22370 ...componentProps, 22371 className: `$componentProps.className} editor-post-publish-button__button`, 22372 size: "compact", 22373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {}) 22374 }) 22375 }); 22376 } 22377 } 22378 22379 /** 22380 * Renders the publish button. 22381 */ 22382 /* harmony default export */ const post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 22383 var _getCurrentPost$_link; 22384 const { 22385 isSavingPost, 22386 isAutosavingPost, 22387 isEditedPostBeingScheduled, 22388 getEditedPostVisibility, 22389 isCurrentPostPublished, 22390 isEditedPostSaveable, 22391 isEditedPostPublishable, 22392 isPostSavingLocked, 22393 getCurrentPost, 22394 getCurrentPostType, 22395 getCurrentPostId, 22396 hasNonPostEntityChanges, 22397 isSavingNonPostEntityChanges, 22398 getEditedPostAttribute, 22399 getPostEdits 22400 } = select(store_store); 22401 return { 22402 isSaving: isSavingPost(), 22403 isAutoSaving: isAutosavingPost(), 22404 isBeingScheduled: isEditedPostBeingScheduled(), 22405 visibility: getEditedPostVisibility(), 22406 isSaveable: isEditedPostSaveable(), 22407 isPostSavingLocked: isPostSavingLocked(), 22408 isPublishable: isEditedPostPublishable(), 22409 isPublished: isCurrentPostPublished(), 22410 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 22411 postType: getCurrentPostType(), 22412 postId: getCurrentPostId(), 22413 postStatus: getEditedPostAttribute('status'), 22414 postStatusHasChanged: getPostEdits()?.status, 22415 hasNonPostEntityChanges: hasNonPostEntityChanges(), 22416 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() 22417 }; 22418 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 22419 const { 22420 editPost, 22421 savePost 22422 } = dispatch(store_store); 22423 return { 22424 savePostStatus: status => { 22425 editPost({ 22426 status 22427 }, { 22428 undoIgnore: true 22429 }); 22430 savePost(); 22431 } 22432 }; 22433 })])(PostPublishButton)); 22434 22435 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 22436 /** 22437 * WordPress dependencies 22438 */ 22439 22440 22441 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22442 xmlns: "http://www.w3.org/2000/svg", 22443 viewBox: "-2 -2 24 24", 22444 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22445 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" 22446 }) 22447 }); 22448 /* harmony default export */ const library_wordpress = (wordpress); 22449 22450 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js 22451 /** 22452 * WordPress dependencies 22453 */ 22454 22455 const visibilityOptions = { 22456 public: { 22457 label: (0,external_wp_i18n_namespaceObject.__)('Public'), 22458 info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 22459 }, 22460 private: { 22461 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 22462 info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 22463 }, 22464 password: { 22465 label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), 22466 info: (0,external_wp_i18n_namespaceObject.__)('Only those with the password can view this post.') 22467 } 22468 }; 22469 22470 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js 22471 /** 22472 * WordPress dependencies 22473 */ 22474 22475 22476 22477 22478 22479 22480 22481 /** 22482 * Internal dependencies 22483 */ 22484 22485 22486 22487 /** 22488 * Allows users to set the visibility of a post. 22489 * 22490 * @param {Object} props The component props. 22491 * @param {Function} props.onClose Function to call when the popover is closed. 22492 * @return {React.ReactNode} The rendered component. 22493 */ 22494 22495 function PostVisibility({ 22496 onClose 22497 }) { 22498 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility); 22499 const { 22500 status, 22501 visibility, 22502 password 22503 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 22504 status: select(store_store).getEditedPostAttribute('status'), 22505 visibility: select(store_store).getEditedPostVisibility(), 22506 password: select(store_store).getEditedPostAttribute('password') 22507 })); 22508 const { 22509 editPost, 22510 savePost 22511 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22512 const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 22513 const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 22514 const setPublic = () => { 22515 editPost({ 22516 status: visibility === 'private' ? 'draft' : status, 22517 password: '' 22518 }); 22519 setHasPassword(false); 22520 }; 22521 const setPrivate = () => { 22522 setShowPrivateConfirmDialog(true); 22523 }; 22524 const confirmPrivate = () => { 22525 editPost({ 22526 status: 'private', 22527 password: '' 22528 }); 22529 setHasPassword(false); 22530 setShowPrivateConfirmDialog(false); 22531 savePost(); 22532 }; 22533 const handleDialogCancel = () => { 22534 setShowPrivateConfirmDialog(false); 22535 }; 22536 const setPasswordProtected = () => { 22537 editPost({ 22538 status: visibility === 'private' ? 'draft' : status, 22539 password: password || '' 22540 }); 22541 setHasPassword(true); 22542 }; 22543 const updatePassword = event => { 22544 editPost({ 22545 password: event.target.value 22546 }); 22547 }; 22548 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 22549 className: "editor-post-visibility", 22550 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 22551 title: (0,external_wp_i18n_namespaceObject.__)('Visibility'), 22552 help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'), 22553 onClose: onClose 22554 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 22555 className: "editor-post-visibility__fieldset", 22556 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 22557 as: "legend", 22558 children: (0,external_wp_i18n_namespaceObject.__)('Visibility') 22559 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 22560 instanceId: instanceId, 22561 value: "public", 22562 label: visibilityOptions.public.label, 22563 info: visibilityOptions.public.info, 22564 checked: visibility === 'public' && !hasPassword, 22565 onChange: setPublic 22566 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 22567 instanceId: instanceId, 22568 value: "private", 22569 label: visibilityOptions.private.label, 22570 info: visibilityOptions.private.info, 22571 checked: visibility === 'private', 22572 onChange: setPrivate 22573 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 22574 instanceId: instanceId, 22575 value: "password", 22576 label: visibilityOptions.password.label, 22577 info: visibilityOptions.password.info, 22578 checked: hasPassword, 22579 onChange: setPasswordProtected 22580 }), hasPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 22581 className: "editor-post-visibility__password", 22582 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 22583 as: "label", 22584 htmlFor: `editor-post-visibility__password-input-$instanceId}`, 22585 children: (0,external_wp_i18n_namespaceObject.__)('Create password') 22586 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 22587 className: "editor-post-visibility__password-input", 22588 id: `editor-post-visibility__password-input-$instanceId}`, 22589 type: "text", 22590 onChange: updatePassword, 22591 value: password, 22592 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password') 22593 })] 22594 })] 22595 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 22596 isOpen: showPrivateConfirmDialog, 22597 onConfirm: confirmPrivate, 22598 onCancel: handleDialogCancel, 22599 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Publish'), 22600 size: "medium", 22601 children: (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?') 22602 })] 22603 }); 22604 } 22605 function PostVisibilityChoice({ 22606 instanceId, 22607 value, 22608 label, 22609 info, 22610 ...props 22611 }) { 22612 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 22613 className: "editor-post-visibility__choice", 22614 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 22615 type: "radio", 22616 name: `editor-post-visibility__setting-$instanceId}`, 22617 value: value, 22618 id: `editor-post-$value}-$instanceId}`, 22619 "aria-describedby": `editor-post-$value}-$instanceId}-description`, 22620 className: "editor-post-visibility__radio", 22621 ...props 22622 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 22623 htmlFor: `editor-post-$value}-$instanceId}`, 22624 className: "editor-post-visibility__label", 22625 children: label 22626 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 22627 id: `editor-post-$value}-$instanceId}-description`, 22628 className: "editor-post-visibility__info", 22629 children: info 22630 })] 22631 }); 22632 } 22633 22634 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js 22635 /** 22636 * WordPress dependencies 22637 */ 22638 22639 22640 /** 22641 * Internal dependencies 22642 */ 22643 22644 22645 22646 /** 22647 * Returns the label for the current post visibility setting. 22648 * 22649 * @return {string} Post visibility label. 22650 */ 22651 function PostVisibilityLabel() { 22652 return usePostVisibilityLabel(); 22653 } 22654 22655 /** 22656 * Get the label for the current post visibility setting. 22657 * 22658 * @return {string} Post visibility label. 22659 */ 22660 function usePostVisibilityLabel() { 22661 const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility()); 22662 return visibilityOptions[visibility]?.label; 22663 } 22664 22665 ;// ./node_modules/date-fns/toDate.mjs 22666 /** 22667 * @name toDate 22668 * @category Common Helpers 22669 * @summary Convert the given argument to an instance of Date. 22670 * 22671 * @description 22672 * Convert the given argument to an instance of Date. 22673 * 22674 * If the argument is an instance of Date, the function returns its clone. 22675 * 22676 * If the argument is a number, it is treated as a timestamp. 22677 * 22678 * If the argument is none of the above, the function returns Invalid Date. 22679 * 22680 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. 22681 * 22682 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 22683 * 22684 * @param argument - The value to convert 22685 * 22686 * @returns The parsed date in the local time zone 22687 * 22688 * @example 22689 * // Clone the date: 22690 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) 22691 * //=> Tue Feb 11 2014 11:30:30 22692 * 22693 * @example 22694 * // Convert the timestamp to date: 22695 * const result = toDate(1392098430000) 22696 * //=> Tue Feb 11 2014 11:30:30 22697 */ 22698 function toDate(argument) { 22699 const argStr = Object.prototype.toString.call(argument); 22700 22701 // Clone the date 22702 if ( 22703 argument instanceof Date || 22704 (typeof argument === "object" && argStr === "[object Date]") 22705 ) { 22706 // Prevent the date to lose the milliseconds when passed to new Date() in IE10 22707 return new argument.constructor(+argument); 22708 } else if ( 22709 typeof argument === "number" || 22710 argStr === "[object Number]" || 22711 typeof argument === "string" || 22712 argStr === "[object String]" 22713 ) { 22714 // TODO: Can we get rid of as? 22715 return new Date(argument); 22716 } else { 22717 // TODO: Can we get rid of as? 22718 return new Date(NaN); 22719 } 22720 } 22721 22722 // Fallback for modularized imports: 22723 /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); 22724 22725 ;// ./node_modules/date-fns/startOfMonth.mjs 22726 22727 22728 /** 22729 * @name startOfMonth 22730 * @category Month Helpers 22731 * @summary Return the start of a month for the given date. 22732 * 22733 * @description 22734 * Return the start of a month for the given date. 22735 * The result will be in the local timezone. 22736 * 22737 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 22738 * 22739 * @param date - The original date 22740 * 22741 * @returns The start of a month 22742 * 22743 * @example 22744 * // The start of a month for 2 September 2014 11:55:00: 22745 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 22746 * //=> Mon Sep 01 2014 00:00:00 22747 */ 22748 function startOfMonth(date) { 22749 const _date = toDate(date); 22750 _date.setDate(1); 22751 _date.setHours(0, 0, 0, 0); 22752 return _date; 22753 } 22754 22755 // Fallback for modularized imports: 22756 /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); 22757 22758 ;// ./node_modules/date-fns/endOfMonth.mjs 22759 22760 22761 /** 22762 * @name endOfMonth 22763 * @category Month Helpers 22764 * @summary Return the end of a month for the given date. 22765 * 22766 * @description 22767 * Return the end of a month for the given date. 22768 * The result will be in the local timezone. 22769 * 22770 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 22771 * 22772 * @param date - The original date 22773 * 22774 * @returns The end of a month 22775 * 22776 * @example 22777 * // The end of a month for 2 September 2014 11:55:00: 22778 * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 22779 * //=> Tue Sep 30 2014 23:59:59.999 22780 */ 22781 function endOfMonth(date) { 22782 const _date = toDate(date); 22783 const month = _date.getMonth(); 22784 _date.setFullYear(_date.getFullYear(), month + 1, 0); 22785 _date.setHours(23, 59, 59, 999); 22786 return _date; 22787 } 22788 22789 // Fallback for modularized imports: 22790 /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); 22791 22792 ;// ./node_modules/date-fns/constants.mjs 22793 /** 22794 * @module constants 22795 * @summary Useful constants 22796 * @description 22797 * Collection of useful date constants. 22798 * 22799 * The constants could be imported from `date-fns/constants`: 22800 * 22801 * ```ts 22802 * import { maxTime, minTime } from "./constants/date-fns/constants"; 22803 * 22804 * function isAllowedTime(time) { 22805 * return time <= maxTime && time >= minTime; 22806 * } 22807 * ``` 22808 */ 22809 22810 /** 22811 * @constant 22812 * @name daysInWeek 22813 * @summary Days in 1 week. 22814 */ 22815 const daysInWeek = 7; 22816 22817 /** 22818 * @constant 22819 * @name daysInYear 22820 * @summary Days in 1 year. 22821 * 22822 * @description 22823 * How many days in a year. 22824 * 22825 * One years equals 365.2425 days according to the formula: 22826 * 22827 * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. 22828 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days 22829 */ 22830 const daysInYear = 365.2425; 22831 22832 /** 22833 * @constant 22834 * @name maxTime 22835 * @summary Maximum allowed time. 22836 * 22837 * @example 22838 * import { maxTime } from "./constants/date-fns/constants"; 22839 * 22840 * const isValid = 8640000000000001 <= maxTime; 22841 * //=> false 22842 * 22843 * new Date(8640000000000001); 22844 * //=> Invalid Date 22845 */ 22846 const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; 22847 22848 /** 22849 * @constant 22850 * @name minTime 22851 * @summary Minimum allowed time. 22852 * 22853 * @example 22854 * import { minTime } from "./constants/date-fns/constants"; 22855 * 22856 * const isValid = -8640000000000001 >= minTime; 22857 * //=> false 22858 * 22859 * new Date(-8640000000000001) 22860 * //=> Invalid Date 22861 */ 22862 const minTime = -maxTime; 22863 22864 /** 22865 * @constant 22866 * @name millisecondsInWeek 22867 * @summary Milliseconds in 1 week. 22868 */ 22869 const millisecondsInWeek = 604800000; 22870 22871 /** 22872 * @constant 22873 * @name millisecondsInDay 22874 * @summary Milliseconds in 1 day. 22875 */ 22876 const millisecondsInDay = 86400000; 22877 22878 /** 22879 * @constant 22880 * @name millisecondsInMinute 22881 * @summary Milliseconds in 1 minute 22882 */ 22883 const millisecondsInMinute = 60000; 22884 22885 /** 22886 * @constant 22887 * @name millisecondsInHour 22888 * @summary Milliseconds in 1 hour 22889 */ 22890 const millisecondsInHour = 3600000; 22891 22892 /** 22893 * @constant 22894 * @name millisecondsInSecond 22895 * @summary Milliseconds in 1 second 22896 */ 22897 const millisecondsInSecond = 1000; 22898 22899 /** 22900 * @constant 22901 * @name minutesInYear 22902 * @summary Minutes in 1 year. 22903 */ 22904 const minutesInYear = 525600; 22905 22906 /** 22907 * @constant 22908 * @name minutesInMonth 22909 * @summary Minutes in 1 month. 22910 */ 22911 const minutesInMonth = 43200; 22912 22913 /** 22914 * @constant 22915 * @name minutesInDay 22916 * @summary Minutes in 1 day. 22917 */ 22918 const minutesInDay = 1440; 22919 22920 /** 22921 * @constant 22922 * @name minutesInHour 22923 * @summary Minutes in 1 hour. 22924 */ 22925 const minutesInHour = 60; 22926 22927 /** 22928 * @constant 22929 * @name monthsInQuarter 22930 * @summary Months in 1 quarter. 22931 */ 22932 const monthsInQuarter = 3; 22933 22934 /** 22935 * @constant 22936 * @name monthsInYear 22937 * @summary Months in 1 year. 22938 */ 22939 const monthsInYear = 12; 22940 22941 /** 22942 * @constant 22943 * @name quartersInYear 22944 * @summary Quarters in 1 year 22945 */ 22946 const quartersInYear = 4; 22947 22948 /** 22949 * @constant 22950 * @name secondsInHour 22951 * @summary Seconds in 1 hour. 22952 */ 22953 const secondsInHour = 3600; 22954 22955 /** 22956 * @constant 22957 * @name secondsInMinute 22958 * @summary Seconds in 1 minute. 22959 */ 22960 const secondsInMinute = 60; 22961 22962 /** 22963 * @constant 22964 * @name secondsInDay 22965 * @summary Seconds in 1 day. 22966 */ 22967 const secondsInDay = secondsInHour * 24; 22968 22969 /** 22970 * @constant 22971 * @name secondsInWeek 22972 * @summary Seconds in 1 week. 22973 */ 22974 const secondsInWeek = secondsInDay * 7; 22975 22976 /** 22977 * @constant 22978 * @name secondsInYear 22979 * @summary Seconds in 1 year. 22980 */ 22981 const secondsInYear = secondsInDay * daysInYear; 22982 22983 /** 22984 * @constant 22985 * @name secondsInMonth 22986 * @summary Seconds in 1 month 22987 */ 22988 const secondsInMonth = secondsInYear / 12; 22989 22990 /** 22991 * @constant 22992 * @name secondsInQuarter 22993 * @summary Seconds in 1 quarter. 22994 */ 22995 const secondsInQuarter = secondsInMonth * 3; 22996 22997 ;// ./node_modules/date-fns/parseISO.mjs 22998 22999 23000 /** 23001 * The {@link parseISO} function options. 23002 */ 23003 23004 /** 23005 * @name parseISO 23006 * @category Common Helpers 23007 * @summary Parse ISO string 23008 * 23009 * @description 23010 * Parse the given string in ISO 8601 format and return an instance of Date. 23011 * 23012 * Function accepts complete ISO 8601 formats as well as partial implementations. 23013 * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 23014 * 23015 * If the argument isn't a string, the function cannot parse the string or 23016 * the values are invalid, it returns Invalid Date. 23017 * 23018 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 23019 * 23020 * @param argument - The value to convert 23021 * @param options - An object with options 23022 * 23023 * @returns The parsed date in the local time zone 23024 * 23025 * @example 23026 * // Convert string '2014-02-11T11:30:30' to date: 23027 * const result = parseISO('2014-02-11T11:30:30') 23028 * //=> Tue Feb 11 2014 11:30:30 23029 * 23030 * @example 23031 * // Convert string '+02014101' to date, 23032 * // if the additional number of digits in the extended year format is 1: 23033 * const result = parseISO('+02014101', { additionalDigits: 1 }) 23034 * //=> Fri Apr 11 2014 00:00:00 23035 */ 23036 function parseISO(argument, options) { 23037 const additionalDigits = options?.additionalDigits ?? 2; 23038 const dateStrings = splitDateString(argument); 23039 23040 let date; 23041 if (dateStrings.date) { 23042 const parseYearResult = parseYear(dateStrings.date, additionalDigits); 23043 date = parseDate(parseYearResult.restDateString, parseYearResult.year); 23044 } 23045 23046 if (!date || isNaN(date.getTime())) { 23047 return new Date(NaN); 23048 } 23049 23050 const timestamp = date.getTime(); 23051 let time = 0; 23052 let offset; 23053 23054 if (dateStrings.time) { 23055 time = parseTime(dateStrings.time); 23056 if (isNaN(time)) { 23057 return new Date(NaN); 23058 } 23059 } 23060 23061 if (dateStrings.timezone) { 23062 offset = parseTimezone(dateStrings.timezone); 23063 if (isNaN(offset)) { 23064 return new Date(NaN); 23065 } 23066 } else { 23067 const dirtyDate = new Date(timestamp + time); 23068 // JS parsed string assuming it's in UTC timezone 23069 // but we need it to be parsed in our timezone 23070 // so we use utc values to build date in our timezone. 23071 // Year values from 0 to 99 map to the years 1900 to 1999 23072 // so set year explicitly with setFullYear. 23073 const result = new Date(0); 23074 result.setFullYear( 23075 dirtyDate.getUTCFullYear(), 23076 dirtyDate.getUTCMonth(), 23077 dirtyDate.getUTCDate(), 23078 ); 23079 result.setHours( 23080 dirtyDate.getUTCHours(), 23081 dirtyDate.getUTCMinutes(), 23082 dirtyDate.getUTCSeconds(), 23083 dirtyDate.getUTCMilliseconds(), 23084 ); 23085 return result; 23086 } 23087 23088 return new Date(timestamp + time + offset); 23089 } 23090 23091 const patterns = { 23092 dateTimeDelimiter: /[T ]/, 23093 timeZoneDelimiter: /[Z ]/i, 23094 timezone: /([Z+-].*)$/, 23095 }; 23096 23097 const dateRegex = 23098 /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; 23099 const timeRegex = 23100 /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; 23101 const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; 23102 23103 function splitDateString(dateString) { 23104 const dateStrings = {}; 23105 const array = dateString.split(patterns.dateTimeDelimiter); 23106 let timeString; 23107 23108 // The regex match should only return at maximum two array elements. 23109 // [date], [time], or [date, time]. 23110 if (array.length > 2) { 23111 return dateStrings; 23112 } 23113 23114 if (/:/.test(array[0])) { 23115 timeString = array[0]; 23116 } else { 23117 dateStrings.date = array[0]; 23118 timeString = array[1]; 23119 if (patterns.timeZoneDelimiter.test(dateStrings.date)) { 23120 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; 23121 timeString = dateString.substr( 23122 dateStrings.date.length, 23123 dateString.length, 23124 ); 23125 } 23126 } 23127 23128 if (timeString) { 23129 const token = patterns.timezone.exec(timeString); 23130 if (token) { 23131 dateStrings.time = timeString.replace(token[1], ""); 23132 dateStrings.timezone = token[1]; 23133 } else { 23134 dateStrings.time = timeString; 23135 } 23136 } 23137 23138 return dateStrings; 23139 } 23140 23141 function parseYear(dateString, additionalDigits) { 23142 const regex = new RegExp( 23143 "^(?:(\\d{4}|[+-]\\d{" + 23144 (4 + additionalDigits) + 23145 "})|(\\d{2}|[+-]\\d{" + 23146 (2 + additionalDigits) + 23147 "})$)", 23148 ); 23149 23150 const captures = dateString.match(regex); 23151 // Invalid ISO-formatted year 23152 if (!captures) return { year: NaN, restDateString: "" }; 23153 23154 const year = captures[1] ? parseInt(captures[1]) : null; 23155 const century = captures[2] ? parseInt(captures[2]) : null; 23156 23157 // either year or century is null, not both 23158 return { 23159 year: century === null ? year : century * 100, 23160 restDateString: dateString.slice((captures[1] || captures[2]).length), 23161 }; 23162 } 23163 23164 function parseDate(dateString, year) { 23165 // Invalid ISO-formatted year 23166 if (year === null) return new Date(NaN); 23167 23168 const captures = dateString.match(dateRegex); 23169 // Invalid ISO-formatted string 23170 if (!captures) return new Date(NaN); 23171 23172 const isWeekDate = !!captures[4]; 23173 const dayOfYear = parseDateUnit(captures[1]); 23174 const month = parseDateUnit(captures[2]) - 1; 23175 const day = parseDateUnit(captures[3]); 23176 const week = parseDateUnit(captures[4]); 23177 const dayOfWeek = parseDateUnit(captures[5]) - 1; 23178 23179 if (isWeekDate) { 23180 if (!validateWeekDate(year, week, dayOfWeek)) { 23181 return new Date(NaN); 23182 } 23183 return dayOfISOWeekYear(year, week, dayOfWeek); 23184 } else { 23185 const date = new Date(0); 23186 if ( 23187 !validateDate(year, month, day) || 23188 !validateDayOfYearDate(year, dayOfYear) 23189 ) { 23190 return new Date(NaN); 23191 } 23192 date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); 23193 return date; 23194 } 23195 } 23196 23197 function parseDateUnit(value) { 23198 return value ? parseInt(value) : 1; 23199 } 23200 23201 function parseTime(timeString) { 23202 const captures = timeString.match(timeRegex); 23203 if (!captures) return NaN; // Invalid ISO-formatted time 23204 23205 const hours = parseTimeUnit(captures[1]); 23206 const minutes = parseTimeUnit(captures[2]); 23207 const seconds = parseTimeUnit(captures[3]); 23208 23209 if (!validateTime(hours, minutes, seconds)) { 23210 return NaN; 23211 } 23212 23213 return ( 23214 hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000 23215 ); 23216 } 23217 23218 function parseTimeUnit(value) { 23219 return (value && parseFloat(value.replace(",", "."))) || 0; 23220 } 23221 23222 function parseTimezone(timezoneString) { 23223 if (timezoneString === "Z") return 0; 23224 23225 const captures = timezoneString.match(timezoneRegex); 23226 if (!captures) return 0; 23227 23228 const sign = captures[1] === "+" ? -1 : 1; 23229 const hours = parseInt(captures[2]); 23230 const minutes = (captures[3] && parseInt(captures[3])) || 0; 23231 23232 if (!validateTimezone(hours, minutes)) { 23233 return NaN; 23234 } 23235 23236 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); 23237 } 23238 23239 function dayOfISOWeekYear(isoWeekYear, week, day) { 23240 const date = new Date(0); 23241 date.setUTCFullYear(isoWeekYear, 0, 4); 23242 const fourthOfJanuaryDay = date.getUTCDay() || 7; 23243 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; 23244 date.setUTCDate(date.getUTCDate() + diff); 23245 return date; 23246 } 23247 23248 // Validation functions 23249 23250 // February is null to handle the leap year (using ||) 23251 const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 23252 23253 function isLeapYearIndex(year) { 23254 return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); 23255 } 23256 23257 function validateDate(year, month, date) { 23258 return ( 23259 month >= 0 && 23260 month <= 11 && 23261 date >= 1 && 23262 date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) 23263 ); 23264 } 23265 23266 function validateDayOfYearDate(year, dayOfYear) { 23267 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); 23268 } 23269 23270 function validateWeekDate(_year, week, day) { 23271 return week >= 1 && week <= 53 && day >= 0 && day <= 6; 23272 } 23273 23274 function validateTime(hours, minutes, seconds) { 23275 if (hours === 24) { 23276 return minutes === 0 && seconds === 0; 23277 } 23278 23279 return ( 23280 seconds >= 0 && 23281 seconds < 60 && 23282 minutes >= 0 && 23283 minutes < 60 && 23284 hours >= 0 && 23285 hours < 25 23286 ); 23287 } 23288 23289 function validateTimezone(_hours, minutes) { 23290 return minutes >= 0 && minutes <= 59; 23291 } 23292 23293 // Fallback for modularized imports: 23294 /* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO))); 23295 23296 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js 23297 /* wp:polyfill */ 23298 /** 23299 * External dependencies 23300 */ 23301 23302 23303 /** 23304 * WordPress dependencies 23305 */ 23306 23307 23308 23309 23310 23311 23312 23313 /** 23314 * Internal dependencies 23315 */ 23316 23317 23318 23319 const { 23320 PrivatePublishDateTimePicker 23321 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23322 23323 /** 23324 * Renders the PostSchedule component. It allows the user to schedule a post. 23325 * 23326 * @param {Object} props Props. 23327 * @param {Function} props.onClose Function to close the component. 23328 * 23329 * @return {React.ReactNode} The rendered component. 23330 */ 23331 function PostSchedule(props) { 23332 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { 23333 ...props, 23334 showPopoverHeaderActions: true, 23335 isCompact: false 23336 }); 23337 } 23338 function PrivatePostSchedule({ 23339 onClose, 23340 showPopoverHeaderActions, 23341 isCompact 23342 }) { 23343 const { 23344 postDate, 23345 postType 23346 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 23347 postDate: select(store_store).getEditedPostAttribute('date'), 23348 postType: select(store_store).getCurrentPostType() 23349 }), []); 23350 const { 23351 editPost 23352 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23353 const onUpdateDate = date => editPost({ 23354 date 23355 }); 23356 const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(startOfMonth(new Date(postDate))); 23357 23358 // Pick up published and scheduled site posts. 23359 const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, { 23360 status: 'publish,future', 23361 after: startOfMonth(previewedMonth).toISOString(), 23362 before: endOfMonth(previewedMonth).toISOString(), 23363 exclude: [select(store_store).getCurrentPostId()], 23364 per_page: 100, 23365 _fields: 'id,date' 23366 }), [previewedMonth, postType]); 23367 const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(({ 23368 date: eventDate 23369 }) => ({ 23370 date: new Date(eventDate) 23371 })), [eventsByPostType]); 23372 const settings = (0,external_wp_date_namespaceObject.getSettings)(); 23373 23374 // To know if the current timezone is a 12 hour time with look for "a" in the time format 23375 // We also make sure this a is not escaped by a "/" 23376 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a. 23377 .replace(/\\\\/g, '') // Replace "//" with empty strings. 23378 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash. 23379 ); 23380 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, { 23381 currentDate: postDate, 23382 onChange: onUpdateDate, 23383 is12Hour: is12HourTime, 23384 dateOrder: /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */ 23385 (0,external_wp_i18n_namespaceObject._x)('dmy', 'date order'), 23386 events: events, 23387 onMonthPreviewed: date => setPreviewedMonth(parseISO(date)), 23388 onClose: onClose, 23389 isCompact: isCompact, 23390 showPopoverHeaderActions: showPopoverHeaderActions 23391 }); 23392 } 23393 23394 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js 23395 /** 23396 * WordPress dependencies 23397 */ 23398 23399 23400 23401 23402 /** 23403 * Internal dependencies 23404 */ 23405 23406 23407 /** 23408 * Renders the PostScheduleLabel component. 23409 * 23410 * @param {Object} props Props. 23411 * 23412 * @return {React.ReactNode} The rendered component. 23413 */ 23414 function PostScheduleLabel(props) { 23415 return usePostScheduleLabel(props); 23416 } 23417 23418 /** 23419 * Custom hook to get the label for post schedule. 23420 * 23421 * @param {Object} options Options for the hook. 23422 * @param {boolean} options.full Whether to get the full label or not. Default is false. 23423 * 23424 * @return {string} The label for post schedule. 23425 */ 23426 function usePostScheduleLabel({ 23427 full = false 23428 } = {}) { 23429 const { 23430 date, 23431 isFloating 23432 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 23433 date: select(store_store).getEditedPostAttribute('date'), 23434 isFloating: select(store_store).isEditedPostDateFloating() 23435 }), []); 23436 return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { 23437 isFloating 23438 }); 23439 } 23440 function getFullPostScheduleLabel(dateAttribute) { 23441 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 23442 const timezoneAbbreviation = getTimezoneAbbreviation(); 23443 const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( 23444 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 23445 (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); 23446 return (0,external_wp_i18n_namespaceObject.isRTL)() ? `$timezoneAbbreviation} $formattedDate}` : `$formattedDate} $timezoneAbbreviation}`; 23447 } 23448 function getPostScheduleLabel(dateAttribute, { 23449 isFloating = false, 23450 now = new Date() 23451 } = {}) { 23452 if (!dateAttribute || isFloating) { 23453 return (0,external_wp_i18n_namespaceObject.__)('Immediately'); 23454 } 23455 23456 // If the user timezone does not equal the site timezone then using words 23457 // like 'tomorrow' is confusing, so show the full date. 23458 if (!isTimezoneSameAsSiteTimezone(now)) { 23459 return getFullPostScheduleLabel(dateAttribute); 23460 } 23461 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 23462 if (isSameDay(date, now)) { 23463 return (0,external_wp_i18n_namespaceObject.sprintf)( 23464 // translators: %s: Time of day the post is scheduled for. 23465 (0,external_wp_i18n_namespaceObject.__)('Today at %s'), 23466 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 23467 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); 23468 } 23469 const tomorrow = new Date(now); 23470 tomorrow.setDate(tomorrow.getDate() + 1); 23471 if (isSameDay(date, tomorrow)) { 23472 return (0,external_wp_i18n_namespaceObject.sprintf)( 23473 // translators: %s: Time of day the post is scheduled for. 23474 (0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'), 23475 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 23476 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); 23477 } 23478 if (date.getFullYear() === now.getFullYear()) { 23479 return (0,external_wp_date_namespaceObject.dateI18n)( 23480 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 23481 (0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date); 23482 } 23483 return (0,external_wp_date_namespaceObject.dateI18n)( 23484 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 23485 (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); 23486 } 23487 function getTimezoneAbbreviation() { 23488 const { 23489 timezone 23490 } = (0,external_wp_date_namespaceObject.getSettings)(); 23491 if (timezone.abbr && isNaN(Number(timezone.abbr))) { 23492 return timezone.abbr; 23493 } 23494 const symbol = timezone.offset < 0 ? '' : '+'; 23495 return `UTC$symbol}$timezone.offsetFormatted}`; 23496 } 23497 function isTimezoneSameAsSiteTimezone(date) { 23498 const { 23499 timezone 23500 } = (0,external_wp_date_namespaceObject.getSettings)(); 23501 const siteOffset = Number(timezone.offset); 23502 const dateOffset = -1 * (date.getTimezoneOffset() / 60); 23503 return siteOffset === dateOffset; 23504 } 23505 function isSameDay(left, right) { 23506 return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear(); 23507 } 23508 23509 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js 23510 /* wp:polyfill */ 23511 /** 23512 * WordPress dependencies 23513 */ 23514 23515 23516 23517 23518 /** 23519 * Internal dependencies 23520 */ 23521 23522 23523 const MIN_MOST_USED_TERMS = 3; 23524 const DEFAULT_QUERY = { 23525 per_page: 10, 23526 orderby: 'count', 23527 order: 'desc', 23528 hide_empty: true, 23529 _fields: 'id,name,count', 23530 context: 'view' 23531 }; 23532 function MostUsedTerms({ 23533 onSelect, 23534 taxonomy 23535 }) { 23536 const { 23537 _terms, 23538 showTerms 23539 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23540 const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); 23541 return { 23542 _terms: mostUsedTerms, 23543 showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS 23544 }; 23545 }, [taxonomy.slug]); 23546 if (!showTerms) { 23547 return null; 23548 } 23549 const terms = unescapeTerms(_terms); 23550 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23551 className: "editor-post-taxonomies__flat-term-most-used", 23552 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 23553 as: "h3", 23554 className: "editor-post-taxonomies__flat-term-most-used-label", 23555 children: taxonomy.labels.most_used 23556 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 23557 role: "list", 23558 className: "editor-post-taxonomies__flat-term-most-used-list", 23559 children: terms.map(term => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 23560 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23561 __next40pxDefaultSize: true, 23562 variant: "link", 23563 onClick: () => onSelect(term), 23564 children: term.name 23565 }) 23566 }, term.id)) 23567 })] 23568 }); 23569 } 23570 23571 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js 23572 /* wp:polyfill */ 23573 /** 23574 * WordPress dependencies 23575 */ 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 /** 23587 * Internal dependencies 23588 */ 23589 23590 23591 23592 23593 /** 23594 * Shared reference to an empty array for cases where it is important to avoid 23595 * returning a new array reference on every invocation. 23596 * 23597 * @type {Array<any>} 23598 */ 23599 23600 const flat_term_selector_EMPTY_ARRAY = []; 23601 23602 /** 23603 * How the max suggestions limit was chosen: 23604 * - Matches the `per_page` range set by the REST API. 23605 * - Can't use "unbound" query. The `FormTokenField` needs a fixed number. 23606 * - Matches default for `FormTokenField`. 23607 */ 23608 const MAX_TERMS_SUGGESTIONS = 100; 23609 const flat_term_selector_DEFAULT_QUERY = { 23610 per_page: MAX_TERMS_SUGGESTIONS, 23611 _fields: 'id,name', 23612 context: 'view' 23613 }; 23614 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); 23615 const termNamesToIds = (names, terms) => { 23616 return names.map(termName => terms.find(term => isSameTermName(term.name, termName))?.id).filter(id => id !== undefined); 23617 }; 23618 const Wrapper = ({ 23619 children, 23620 __nextHasNoMarginBottom 23621 }) => __nextHasNoMarginBottom ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 23622 spacing: 4, 23623 children: children 23624 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 23625 children: children 23626 }); 23627 23628 /** 23629 * Renders a flat term selector component. 23630 * 23631 * @param {Object} props The component props. 23632 * @param {string} props.slug The slug of the taxonomy. 23633 * @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.) 23634 * 23635 * @return {React.ReactNode} The rendered flat term selector component. 23636 */ 23637 function FlatTermSelector({ 23638 slug, 23639 __nextHasNoMarginBottom 23640 }) { 23641 var _taxonomy$labels$add_, _taxonomy$labels$sing2; 23642 const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); 23643 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); 23644 const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); 23645 if (!__nextHasNoMarginBottom) { 23646 external_wp_deprecated_default()('Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector', { 23647 since: '6.7', 23648 version: '7.0', 23649 hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' 23650 }); 23651 } 23652 const { 23653 terms, 23654 termIds, 23655 taxonomy, 23656 hasAssignAction, 23657 hasCreateAction, 23658 hasResolvedTerms 23659 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23660 var _post$_links, _post$_links2; 23661 const { 23662 getCurrentPost, 23663 getEditedPostAttribute 23664 } = select(store_store); 23665 const { 23666 getEntityRecords, 23667 getTaxonomy, 23668 hasFinishedResolution 23669 } = select(external_wp_coreData_namespaceObject.store); 23670 const post = getCurrentPost(); 23671 const _taxonomy = getTaxonomy(slug); 23672 const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; 23673 const query = { 23674 ...flat_term_selector_DEFAULT_QUERY, 23675 include: _termIds?.join(','), 23676 per_page: -1 23677 }; 23678 return { 23679 hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, 23680 hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, 23681 taxonomy: _taxonomy, 23682 termIds: _termIds, 23683 terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY, 23684 hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query]) 23685 }; 23686 }, [slug]); 23687 const { 23688 searchResults 23689 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23690 const { 23691 getEntityRecords 23692 } = select(external_wp_coreData_namespaceObject.store); 23693 return { 23694 searchResults: !!search ? getEntityRecords('taxonomy', slug, { 23695 ...flat_term_selector_DEFAULT_QUERY, 23696 search 23697 }) : flat_term_selector_EMPTY_ARRAY 23698 }; 23699 }, [search, slug]); 23700 23701 // Update terms state only after the selectors are resolved. 23702 // We're using this to avoid terms temporarily disappearing on slow networks 23703 // while core data makes REST API requests. 23704 (0,external_wp_element_namespaceObject.useEffect)(() => { 23705 if (hasResolvedTerms) { 23706 const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name)); 23707 setValues(newValues); 23708 } 23709 }, [terms, hasResolvedTerms]); 23710 const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { 23711 return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name)); 23712 }, [searchResults]); 23713 const { 23714 editPost 23715 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23716 const { 23717 saveEntityRecord 23718 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 23719 const { 23720 createErrorNotice 23721 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 23722 if (!hasAssignAction) { 23723 return null; 23724 } 23725 async function findOrCreateTerm(term) { 23726 try { 23727 const newTerm = await saveEntityRecord('taxonomy', slug, term, { 23728 throwOnError: true 23729 }); 23730 return unescapeTerm(newTerm); 23731 } catch (error) { 23732 if (error.code !== 'term_exists') { 23733 throw error; 23734 } 23735 return { 23736 id: error.data.term_id, 23737 name: term.name 23738 }; 23739 } 23740 } 23741 function onUpdateTerms(newTermIds) { 23742 editPost({ 23743 [taxonomy.rest_base]: newTermIds 23744 }); 23745 } 23746 function onChange(termNames) { 23747 const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])]; 23748 const uniqueTerms = termNames.reduce((acc, name) => { 23749 if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) { 23750 acc.push(name); 23751 } 23752 return acc; 23753 }, []); 23754 const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName))); 23755 23756 // Optimistically update term values. 23757 // The selector will always re-fetch terms later. 23758 setValues(uniqueTerms); 23759 if (newTermNames.length === 0) { 23760 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 23761 return; 23762 } 23763 if (!hasCreateAction) { 23764 return; 23765 } 23766 Promise.all(newTermNames.map(termName => findOrCreateTerm({ 23767 name: termName 23768 }))).then(newTerms => { 23769 const newAvailableTerms = availableTerms.concat(newTerms); 23770 onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms)); 23771 }).catch(error => { 23772 createErrorNotice(error.message, { 23773 type: 'snackbar' 23774 }); 23775 // In case of a failure, try assigning available terms. 23776 // This will invalidate the optimistic update. 23777 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 23778 }); 23779 } 23780 function appendTerm(newTerm) { 23781 var _taxonomy$labels$sing; 23782 if (termIds.includes(newTerm.id)) { 23783 return; 23784 } 23785 const newTermIds = [...termIds, newTerm.id]; 23786 const defaultName = slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'); 23787 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ 23788 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName); 23789 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 23790 onUpdateTerms(newTermIds); 23791 } 23792 const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term'); 23793 const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'); 23794 const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ 23795 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName); 23796 const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ 23797 (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName); 23798 const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ 23799 (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName); 23800 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { 23801 __nextHasNoMarginBottom: __nextHasNoMarginBottom, 23802 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, { 23803 __next40pxDefaultSize: true, 23804 value: values, 23805 suggestions: suggestions, 23806 onChange: onChange, 23807 onInputChange: debouncedSearch, 23808 maxSuggestions: MAX_TERMS_SUGGESTIONS, 23809 label: newTermLabel, 23810 messages: { 23811 added: termAddedLabel, 23812 removed: termRemovedLabel, 23813 remove: removeTermLabel 23814 }, 23815 __nextHasNoMarginBottom: __nextHasNoMarginBottom 23816 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, { 23817 taxonomy: taxonomy, 23818 onSelect: appendTerm 23819 })] 23820 }); 23821 } 23822 /* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector)); 23823 23824 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js 23825 /** 23826 * WordPress dependencies 23827 */ 23828 23829 23830 23831 23832 23833 23834 /** 23835 * Internal dependencies 23836 */ 23837 23838 23839 23840 const TagsPanel = () => { 23841 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23842 className: "editor-post-publish-panel__link", 23843 children: (0,external_wp_i18n_namespaceObject.__)('Add tags') 23844 }, "label")]; 23845 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 23846 initialOpen: false, 23847 title: panelBodyTitle, 23848 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23849 children: (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.') 23850 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector, { 23851 slug: "post_tag", 23852 __nextHasNoMarginBottom: true 23853 })] 23854 }); 23855 }; 23856 const MaybeTagsPanel = () => { 23857 const { 23858 hasTags, 23859 isPostTypeSupported 23860 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23861 const postType = select(store_store).getCurrentPostType(); 23862 const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag'); 23863 const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType); 23864 const areTagsFetched = tagsTaxonomy !== undefined; 23865 const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base); 23866 return { 23867 hasTags: !!tags?.length, 23868 isPostTypeSupported: areTagsFetched && _isPostTypeSupported 23869 }; 23870 }, []); 23871 const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(hasTags); 23872 if (!isPostTypeSupported) { 23873 return null; 23874 } 23875 23876 /* 23877 * We only want to show the tag panel if the post didn't have 23878 * any tags when the user hit the Publish button. 23879 * 23880 * We can't use the prop.hasTags because it'll change to true 23881 * if the user adds a new tag within the pre-publish panel. 23882 * This would force a re-render and a new prop.hasTags check, 23883 * hiding this panel and keeping the user from adding 23884 * more than one tag. 23885 */ 23886 if (!hadTagsWhenOpeningThePanel) { 23887 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {}); 23888 } 23889 return null; 23890 }; 23891 /* harmony default export */ const maybe_tags_panel = (MaybeTagsPanel); 23892 23893 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js 23894 /* wp:polyfill */ 23895 /** 23896 * WordPress dependencies 23897 */ 23898 23899 23900 23901 23902 23903 /** 23904 * Internal dependencies 23905 */ 23906 23907 23908 23909 const getSuggestion = (supportedFormats, suggestedPostFormat) => { 23910 const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id)); 23911 return formats.find(format => format.id === suggestedPostFormat); 23912 }; 23913 const PostFormatSuggestion = ({ 23914 suggestedPostFormat, 23915 suggestionText, 23916 onUpdatePostFormat 23917 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 23918 __next40pxDefaultSize: true, 23919 variant: "link", 23920 onClick: () => onUpdatePostFormat(suggestedPostFormat), 23921 children: suggestionText 23922 }); 23923 function PostFormatPanel() { 23924 const { 23925 currentPostFormat, 23926 suggestion 23927 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23928 var _select$getThemeSuppo; 23929 const { 23930 getEditedPostAttribute, 23931 getSuggestedPostFormat 23932 } = select(store_store); 23933 const supportedFormats = (_select$getThemeSuppo = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats) !== null && _select$getThemeSuppo !== void 0 ? _select$getThemeSuppo : []; 23934 return { 23935 currentPostFormat: getEditedPostAttribute('format'), 23936 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) 23937 }; 23938 }, []); 23939 const { 23940 editPost 23941 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23942 const onUpdatePostFormat = format => editPost({ 23943 format 23944 }); 23945 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 23946 className: "editor-post-publish-panel__link", 23947 children: (0,external_wp_i18n_namespaceObject.__)('Use a post format') 23948 }, "label")]; 23949 if (!suggestion || suggestion.id === currentPostFormat) { 23950 return null; 23951 } 23952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 23953 initialOpen: false, 23954 title: panelBodyTitle, 23955 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23956 children: (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.') 23957 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 23958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatSuggestion, { 23959 onUpdatePostFormat: onUpdatePostFormat, 23960 suggestedPostFormat: suggestion.id, 23961 suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post format */ 23962 (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption) 23963 }) 23964 })] 23965 }); 23966 } 23967 23968 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js 23969 /* wp:polyfill */ 23970 /** 23971 * WordPress dependencies 23972 */ 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 /** 23984 * Internal dependencies 23985 */ 23986 23987 23988 23989 /** 23990 * Module Constants 23991 */ 23992 23993 const hierarchical_term_selector_DEFAULT_QUERY = { 23994 per_page: -1, 23995 orderby: 'name', 23996 order: 'asc', 23997 _fields: 'id,name,parent', 23998 context: 'view' 23999 }; 24000 const MIN_TERMS_COUNT_FOR_FILTER = 8; 24001 const hierarchical_term_selector_EMPTY_ARRAY = []; 24002 24003 /** 24004 * Sort Terms by Selected. 24005 * 24006 * @param {Object[]} termsTree Array of terms in tree format. 24007 * @param {number[]} terms Selected terms. 24008 * 24009 * @return {Object[]} Sorted array of terms. 24010 */ 24011 function sortBySelected(termsTree, terms) { 24012 const treeHasSelection = termTree => { 24013 if (terms.indexOf(termTree.id) !== -1) { 24014 return true; 24015 } 24016 if (undefined === termTree.children) { 24017 return false; 24018 } 24019 return termTree.children.map(treeHasSelection).filter(child => child).length > 0; 24020 }; 24021 const termOrChildIsSelected = (termA, termB) => { 24022 const termASelected = treeHasSelection(termA); 24023 const termBSelected = treeHasSelection(termB); 24024 if (termASelected === termBSelected) { 24025 return 0; 24026 } 24027 if (termASelected && !termBSelected) { 24028 return -1; 24029 } 24030 if (!termASelected && termBSelected) { 24031 return 1; 24032 } 24033 return 0; 24034 }; 24035 const newTermTree = [...termsTree]; 24036 newTermTree.sort(termOrChildIsSelected); 24037 return newTermTree; 24038 } 24039 24040 /** 24041 * Find term by parent id or name. 24042 * 24043 * @param {Object[]} terms Array of Terms. 24044 * @param {number|string} parent id. 24045 * @param {string} name Term name. 24046 * @return {Object} Term object. 24047 */ 24048 function findTerm(terms, parent, name) { 24049 return terms.find(term => { 24050 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); 24051 }); 24052 } 24053 24054 /** 24055 * Get filter matcher function. 24056 * 24057 * @param {string} filterValue Filter value. 24058 * @return {(function(Object): (Object|boolean))} Matcher function. 24059 */ 24060 function getFilterMatcher(filterValue) { 24061 const matchTermsForFilter = originalTerm => { 24062 if ('' === filterValue) { 24063 return originalTerm; 24064 } 24065 24066 // Shallow clone, because we'll be filtering the term's children and 24067 // don't want to modify the original term. 24068 const term = { 24069 ...originalTerm 24070 }; 24071 24072 // Map and filter the children, recursive so we deal with grandchildren 24073 // and any deeper levels. 24074 if (term.children.length > 0) { 24075 term.children = term.children.map(matchTermsForFilter).filter(child => child); 24076 } 24077 24078 // If the term's name contains the filterValue, or it has children 24079 // (i.e. some child matched at some point in the tree) then return it. 24080 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { 24081 return term; 24082 } 24083 24084 // Otherwise, return false. After mapping, the list of terms will need 24085 // to have false values filtered out. 24086 return false; 24087 }; 24088 return matchTermsForFilter; 24089 } 24090 24091 /** 24092 * Hierarchical term selector. 24093 * 24094 * @param {Object} props Component props. 24095 * @param {string} props.slug Taxonomy slug. 24096 * @return {Element} Hierarchical term selector component. 24097 */ 24098 function HierarchicalTermSelector({ 24099 slug 24100 }) { 24101 var _taxonomy$labels$sear, _taxonomy$name; 24102 const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); 24103 const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(''); 24104 /** 24105 * @type {[number|'', Function]} 24106 */ 24107 const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(''); 24108 const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); 24109 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 24110 const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); 24111 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 24112 const { 24113 hasCreateAction, 24114 hasAssignAction, 24115 terms, 24116 loading, 24117 availableTerms, 24118 taxonomy 24119 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24120 var _post$_links, _post$_links2; 24121 const { 24122 getCurrentPost, 24123 getEditedPostAttribute 24124 } = select(store_store); 24125 const { 24126 getTaxonomy, 24127 getEntityRecords, 24128 isResolving 24129 } = select(external_wp_coreData_namespaceObject.store); 24130 const _taxonomy = getTaxonomy(slug); 24131 const post = getCurrentPost(); 24132 return { 24133 hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, 24134 hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, 24135 terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, 24136 loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]), 24137 availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, 24138 taxonomy: _taxonomy 24139 }; 24140 }, [slug]); 24141 const { 24142 editPost 24143 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 24144 const { 24145 saveEntityRecord 24146 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 24147 const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(terms_buildTermsTree(availableTerms), terms), 24148 // Remove `terms` from the dependency list to avoid reordering every time 24149 // checking or unchecking a term. 24150 [availableTerms]); 24151 const { 24152 createErrorNotice 24153 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24154 if (!hasAssignAction) { 24155 return null; 24156 } 24157 24158 /** 24159 * Append new term. 24160 * 24161 * @param {Object} term Term object. 24162 * @return {Promise} A promise that resolves to save term object. 24163 */ 24164 const addTerm = term => { 24165 return saveEntityRecord('taxonomy', slug, term, { 24166 throwOnError: true 24167 }); 24168 }; 24169 24170 /** 24171 * Update terms for post. 24172 * 24173 * @param {number[]} termIds Term ids. 24174 */ 24175 const onUpdateTerms = termIds => { 24176 editPost({ 24177 [taxonomy.rest_base]: termIds 24178 }); 24179 }; 24180 24181 /** 24182 * Handler for checking term. 24183 * 24184 * @param {number} termId 24185 */ 24186 const onChange = termId => { 24187 const hasTerm = terms.includes(termId); 24188 const newTerms = hasTerm ? terms.filter(id => id !== termId) : [...terms, termId]; 24189 onUpdateTerms(newTerms); 24190 }; 24191 const onChangeFormName = value => { 24192 setFormName(value); 24193 }; 24194 24195 /** 24196 * Handler for changing form parent. 24197 * 24198 * @param {number|''} parentId Parent post id. 24199 */ 24200 const onChangeFormParent = parentId => { 24201 setFormParent(parentId); 24202 }; 24203 const onToggleForm = () => { 24204 setShowForm(!showForm); 24205 }; 24206 const onAddTerm = async event => { 24207 var _taxonomy$labels$sing; 24208 event.preventDefault(); 24209 if (formName === '' || adding) { 24210 return; 24211 } 24212 24213 // Check if the term we are adding already exists. 24214 const existingTerm = findTerm(availableTerms, formParent, formName); 24215 if (existingTerm) { 24216 // If the term we are adding exists but is not selected select it. 24217 if (!terms.some(term => term === existingTerm.id)) { 24218 onUpdateTerms([...terms, existingTerm.id]); 24219 } 24220 setFormName(''); 24221 setFormParent(''); 24222 return; 24223 } 24224 setAdding(true); 24225 let newTerm; 24226 try { 24227 newTerm = await addTerm({ 24228 name: formName, 24229 parent: formParent ? formParent : undefined 24230 }); 24231 } catch (error) { 24232 createErrorNotice(error.message, { 24233 type: 'snackbar' 24234 }); 24235 return; 24236 } 24237 const defaultName = slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term'); 24238 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: term name. */ 24239 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName); 24240 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 24241 setAdding(false); 24242 setFormName(''); 24243 setFormParent(''); 24244 onUpdateTerms([...terms, newTerm.id]); 24245 }; 24246 const setFilter = value => { 24247 const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term); 24248 const getResultCount = termsTree => { 24249 let count = 0; 24250 for (let i = 0; i < termsTree.length; i++) { 24251 count++; 24252 if (undefined !== termsTree[i].children) { 24253 count += getResultCount(termsTree[i].children); 24254 } 24255 } 24256 return count; 24257 }; 24258 setFilterValue(value); 24259 setFilteredTermsTree(newFilteredTermsTree); 24260 const resultCount = getResultCount(newFilteredTermsTree); 24261 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of results. */ 24262 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount); 24263 debouncedSpeak(resultsFoundMessage, 'assertive'); 24264 }; 24265 const renderTerms = renderedTerms => { 24266 return renderedTerms.map(term => { 24267 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24268 className: "editor-post-taxonomies__hierarchical-terms-choice", 24269 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 24270 __nextHasNoMarginBottom: true, 24271 checked: terms.indexOf(term.id) !== -1, 24272 onChange: () => { 24273 const termId = parseInt(term.id, 10); 24274 onChange(termId); 24275 }, 24276 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name) 24277 }), !!term.children.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24278 className: "editor-post-taxonomies__hierarchical-terms-subchoices", 24279 children: renderTerms(term.children) 24280 })] 24281 }, term.id); 24282 }); 24283 }; 24284 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => { 24285 var _taxonomy$labels$labe; 24286 return (_taxonomy$labels$labe = taxonomy?.labels?.[labelProperty]) !== null && _taxonomy$labels$labe !== void 0 ? _taxonomy$labels$labe : slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory; 24287 }; 24288 const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 24289 const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 24290 const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term')); 24291 const noParentOption = `— $parentSelectLabel} —`; 24292 const newTermSubmitLabel = newTermButtonLabel; 24293 const filterLabel = (_taxonomy$labels$sear = taxonomy?.labels?.search_items) !== null && _taxonomy$labels$sear !== void 0 ? _taxonomy$labels$sear : (0,external_wp_i18n_namespaceObject.__)('Search Terms'); 24294 const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms'); 24295 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; 24296 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24297 direction: "column", 24298 gap: "4", 24299 children: [showFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 24300 __next40pxDefaultSize: true, 24301 __nextHasNoMarginBottom: true, 24302 label: filterLabel, 24303 placeholder: filterLabel, 24304 value: filterValue, 24305 onChange: setFilter 24306 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24307 className: "editor-post-taxonomies__hierarchical-terms-list", 24308 tabIndex: "0", 24309 role: "group", 24310 "aria-label": groupLabel, 24311 children: renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree) 24312 }), !loading && hasCreateAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24313 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24314 __next40pxDefaultSize: true, 24315 onClick: onToggleForm, 24316 className: "editor-post-taxonomies__hierarchical-terms-add", 24317 "aria-expanded": showForm, 24318 variant: "link", 24319 children: newTermButtonLabel 24320 }) 24321 }), showForm && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 24322 onSubmit: onAddTerm, 24323 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 24324 direction: "column", 24325 gap: "4", 24326 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 24327 __next40pxDefaultSize: true, 24328 __nextHasNoMarginBottom: true, 24329 className: "editor-post-taxonomies__hierarchical-terms-input", 24330 label: newTermLabel, 24331 value: formName, 24332 onChange: onChangeFormName, 24333 required: true 24334 }), !!availableTerms.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TreeSelect, { 24335 __next40pxDefaultSize: true, 24336 __nextHasNoMarginBottom: true, 24337 label: parentSelectLabel, 24338 noOptionLabel: noParentOption, 24339 onChange: onChangeFormParent, 24340 selectedId: formParent, 24341 tree: availableTermsTree 24342 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24344 __next40pxDefaultSize: true, 24345 variant: "secondary", 24346 type: "submit", 24347 className: "editor-post-taxonomies__hierarchical-terms-submit", 24348 children: newTermSubmitLabel 24349 }) 24350 })] 24351 }) 24352 })] 24353 }); 24354 } 24355 /* harmony default export */ const hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector)); 24356 24357 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js 24358 /* wp:polyfill */ 24359 /** 24360 * WordPress dependencies 24361 */ 24362 24363 24364 24365 24366 24367 24368 /** 24369 * Internal dependencies 24370 */ 24371 24372 24373 24374 function MaybeCategoryPanel() { 24375 const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => { 24376 const postType = select(store_store).getCurrentPostType(); 24377 const { 24378 canUser, 24379 getEntityRecord, 24380 getTaxonomy 24381 } = select(external_wp_coreData_namespaceObject.store); 24382 const categoriesTaxonomy = getTaxonomy('category'); 24383 const defaultCategoryId = canUser('read', { 24384 kind: 'root', 24385 name: 'site' 24386 }) ? getEntityRecord('root', 'site')?.default_category : undefined; 24387 const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined; 24388 const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType); 24389 const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); 24390 24391 // This boolean should return true if everything is loaded 24392 // ( categoriesTaxonomy, defaultCategory ) 24393 // and the post has not been assigned a category different than "uncategorized". 24394 return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]); 24395 }, []); 24396 const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); 24397 (0,external_wp_element_namespaceObject.useEffect)(() => { 24398 // We use state to avoid hiding the panel if the user edits the categories 24399 // and adds one within the panel itself (while visible). 24400 if (hasNoCategory) { 24401 setShouldShowPanel(true); 24402 } 24403 }, [hasNoCategory]); 24404 if (!shouldShowPanel) { 24405 return null; 24406 } 24407 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24408 className: "editor-post-publish-panel__link", 24409 children: (0,external_wp_i18n_namespaceObject.__)('Assign a category') 24410 }, "label")]; 24411 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 24412 initialOpen: false, 24413 title: panelBodyTitle, 24414 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 24415 children: (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.') 24416 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector, { 24417 slug: "category" 24418 })] 24419 }); 24420 } 24421 /* harmony default export */ const maybe_category_panel = (MaybeCategoryPanel); 24422 24423 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/media-util.js 24424 /* wp:polyfill */ 24425 /** 24426 * External dependencies 24427 */ 24428 24429 24430 /** 24431 * WordPress dependencies 24432 */ 24433 24434 24435 /** 24436 * Generate a list of unique basenames given a list of URLs. 24437 * 24438 * We want all basenames to be unique, since sometimes the extension 24439 * doesn't reflect the mime type, and may end up getting changed by 24440 * the server, on upload. 24441 * 24442 * @param {string[]} urls The list of URLs 24443 * @return {Record< string, string >} A URL => basename record. 24444 */ 24445 function generateUniqueBasenames(urls) { 24446 const basenames = new Set(); 24447 return Object.fromEntries(urls.map(url => { 24448 // We prefer to match the remote filename, if possible. 24449 const filename = (0,external_wp_url_namespaceObject.getFilename)(url); 24450 let basename = ''; 24451 if (filename) { 24452 const parts = filename.split('.'); 24453 if (parts.length > 1) { 24454 // Assume the last part is the extension. 24455 parts.pop(); 24456 } 24457 basename = parts.join('.'); 24458 } 24459 if (!basename) { 24460 // It looks like we don't have a basename, so let's use a UUID. 24461 basename = esm_browser_v4(); 24462 } 24463 if (basenames.has(basename)) { 24464 // Append a UUID to deduplicate the basename. 24465 // The server will try to deduplicate on its own if we don't do this, 24466 // but it may run into a race condition 24467 // (see https://github.com/WordPress/gutenberg/issues/64899). 24468 // Deduplicating the filenames before uploading is safer. 24469 basename = `$basename}-$esm_browser_v4()}`; 24470 } 24471 basenames.add(basename); 24472 return [url, basename]; 24473 })); 24474 } 24475 24476 /** 24477 * Fetch a list of URLs, turning those into promises for files with 24478 * unique filenames. 24479 * 24480 * @param {string[]} urls The list of URLs 24481 * @return {Record< string, Promise< File > >} A URL => File promise record. 24482 */ 24483 function fetchMedia(urls) { 24484 return Object.fromEntries(Object.entries(generateUniqueBasenames(urls)).map(([url, basename]) => { 24485 const filePromise = window.fetch(url.includes('?') ? url : url + '?').then(response => response.blob()).then(blob => { 24486 // The server will reject the upload if it doesn't have an extension, 24487 // even though it'll rewrite the file name to match the mime type. 24488 // Here we provide it with a safe extension to get it past that check. 24489 return new File([blob], `$basename}.png`, { 24490 type: blob.type 24491 }); 24492 }); 24493 return [url, filePromise]; 24494 })); 24495 } 24496 24497 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js 24498 /* wp:polyfill */ 24499 /** 24500 * WordPress dependencies 24501 */ 24502 24503 24504 24505 24506 24507 24508 24509 /** 24510 * Internal dependencies 24511 */ 24512 24513 24514 function flattenBlocks(blocks) { 24515 const result = []; 24516 blocks.forEach(block => { 24517 result.push(block); 24518 result.push(...flattenBlocks(block.innerBlocks)); 24519 }); 24520 return result; 24521 } 24522 24523 /** 24524 * Determine whether a block has external media. 24525 * 24526 * Different blocks use different attribute names (and potentially 24527 * different logic as well) in determining whether the media is 24528 * present, and whether it's external. 24529 * 24530 * @param {{name: string, attributes: Object}} block The block. 24531 * @return {boolean?} Whether the block has external media 24532 */ 24533 function hasExternalMedia(block) { 24534 if (block.name === 'core/image' || block.name === 'core/cover') { 24535 return block.attributes.url && !block.attributes.id; 24536 } 24537 if (block.name === 'core/media-text') { 24538 return block.attributes.mediaUrl && !block.attributes.mediaId; 24539 } 24540 return undefined; 24541 } 24542 24543 /** 24544 * Retrieve media info from a block. 24545 * 24546 * Different blocks use different attribute names, so we need this 24547 * function to normalize things into a consistent naming scheme. 24548 * 24549 * @param {{name: string, attributes: Object}} block The block. 24550 * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block. 24551 */ 24552 function getMediaInfo(block) { 24553 if (block.name === 'core/image' || block.name === 'core/cover') { 24554 const { 24555 url, 24556 alt, 24557 id 24558 } = block.attributes; 24559 return { 24560 url, 24561 alt, 24562 id 24563 }; 24564 } 24565 if (block.name === 'core/media-text') { 24566 const { 24567 mediaUrl: url, 24568 mediaAlt: alt, 24569 mediaId: id 24570 } = block.attributes; 24571 return { 24572 url, 24573 alt, 24574 id 24575 }; 24576 } 24577 return {}; 24578 } 24579 24580 // Image component to represent a single image in the upload dialog. 24581 function Image({ 24582 clientId, 24583 alt, 24584 url 24585 }) { 24586 const { 24587 selectBlock 24588 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24589 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, { 24590 tabIndex: 0, 24591 role: "button", 24592 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select image block.'), 24593 onClick: () => { 24594 selectBlock(clientId); 24595 }, 24596 onKeyDown: event => { 24597 if (event.key === 'Enter' || event.key === ' ') { 24598 selectBlock(clientId); 24599 event.preventDefault(); 24600 } 24601 }, 24602 alt: alt, 24603 src: url, 24604 animate: { 24605 opacity: 1 24606 }, 24607 exit: { 24608 opacity: 0, 24609 scale: 0 24610 }, 24611 style: { 24612 width: '32px', 24613 height: '32px', 24614 objectFit: 'cover', 24615 borderRadius: '2px', 24616 cursor: 'pointer' 24617 }, 24618 whileHover: { 24619 scale: 1.08 24620 } 24621 }, clientId); 24622 } 24623 function MaybeUploadMediaPanel() { 24624 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 24625 const [isAnimating, setIsAnimating] = (0,external_wp_element_namespaceObject.useState)(false); 24626 const [hadUploadError, setHadUploadError] = (0,external_wp_element_namespaceObject.useState)(false); 24627 const { 24628 editorBlocks, 24629 mediaUpload 24630 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 24631 editorBlocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks(), 24632 mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload 24633 }), []); 24634 24635 // Get a list of blocks with external media. 24636 const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter(block => hasExternalMedia(block)); 24637 const { 24638 updateBlockAttributes 24639 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24640 if (!mediaUpload || !blocksWithExternalMedia.length) { 24641 return null; 24642 } 24643 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24644 className: "editor-post-publish-panel__link", 24645 children: (0,external_wp_i18n_namespaceObject.__)('External media') 24646 }, "label")]; 24647 24648 /** 24649 * Update an individual block to point to newly-added library media. 24650 * 24651 * Different blocks use different attribute names, so we need this 24652 * function to ensure we modify the correct attributes for each type. 24653 * 24654 * @param {{name: string, attributes: Object}} block The block. 24655 * @param {{id: number, url: string}} media Media library file info. 24656 */ 24657 function updateBlockWithUploadedMedia(block, media) { 24658 if (block.name === 'core/image' || block.name === 'core/cover') { 24659 updateBlockAttributes(block.clientId, { 24660 id: media.id, 24661 url: media.url 24662 }); 24663 } 24664 if (block.name === 'core/media-text') { 24665 updateBlockAttributes(block.clientId, { 24666 mediaId: media.id, 24667 mediaUrl: media.url 24668 }); 24669 } 24670 } 24671 24672 // Handle fetching and uploading all external media in the post. 24673 function uploadImages() { 24674 setIsUploading(true); 24675 setHadUploadError(false); 24676 24677 // Multiple blocks can be using the same URL, so we 24678 // should ensure we only fetch and upload each of them once. 24679 const mediaUrls = new Set(blocksWithExternalMedia.map(block => { 24680 const { 24681 url 24682 } = getMediaInfo(block); 24683 return url; 24684 })); 24685 24686 // Create an upload promise for each URL, that we can wait for in all 24687 // blocks that make use of that media. 24688 const uploadPromises = Object.fromEntries(Object.entries(fetchMedia([...mediaUrls])).map(([url, filePromise]) => { 24689 const uploadPromise = filePromise.then(blob => new Promise((resolve, reject) => { 24690 mediaUpload({ 24691 filesList: [blob], 24692 onFileChange: ([media]) => { 24693 if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { 24694 return; 24695 } 24696 resolve(media); 24697 }, 24698 onError() { 24699 reject(); 24700 } 24701 }); 24702 })); 24703 return [url, uploadPromise]; 24704 })); 24705 24706 // Wait for all blocks to be updated with library media. 24707 Promise.allSettled(blocksWithExternalMedia.map(block => { 24708 const { 24709 url 24710 } = getMediaInfo(block); 24711 return uploadPromises[url].then(media => updateBlockWithUploadedMedia(block, media)).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true)); 24712 })).finally(() => { 24713 setIsUploading(false); 24714 }); 24715 } 24716 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 24717 initialOpen: true, 24718 title: panelBodyTitle, 24719 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 24720 children: (0,external_wp_i18n_namespaceObject.__)('Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.') 24721 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24722 style: { 24723 display: 'inline-flex', 24724 flexWrap: 'wrap', 24725 gap: '8px' 24726 }, 24727 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 24728 onExitComplete: () => setIsAnimating(false), 24729 children: blocksWithExternalMedia.map(block => { 24730 const { 24731 url, 24732 alt 24733 } = getMediaInfo(block); 24734 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Image, { 24735 clientId: block.clientId, 24736 url: url, 24737 alt: alt 24738 }, block.clientId); 24739 }) 24740 }), isUploading || isAnimating ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24741 size: "compact", 24742 variant: "primary", 24743 onClick: uploadImages, 24744 children: (0,external_wp_i18n_namespaceObject._x)('Upload', 'verb') 24745 })] 24746 }), hadUploadError && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 24747 children: (0,external_wp_i18n_namespaceObject.__)('Upload failed, try again.') 24748 })] 24749 }); 24750 } 24751 24752 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js 24753 /** 24754 * WordPress dependencies 24755 */ 24756 24757 24758 24759 24760 24761 24762 24763 24764 /** 24765 * Internal dependencies 24766 */ 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 function PostPublishPanelPrepublish({ 24778 children 24779 }) { 24780 const { 24781 isBeingScheduled, 24782 isRequestingSiteIcon, 24783 hasPublishAction, 24784 siteIconUrl, 24785 siteTitle, 24786 siteHome 24787 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24788 var _getCurrentPost$_link; 24789 const { 24790 getCurrentPost, 24791 isEditedPostBeingScheduled 24792 } = select(store_store); 24793 const { 24794 getEntityRecord, 24795 isResolving 24796 } = select(external_wp_coreData_namespaceObject.store); 24797 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 24798 return { 24799 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 24800 isBeingScheduled: isEditedPostBeingScheduled(), 24801 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), 24802 siteIconUrl: siteData.site_icon_url, 24803 siteTitle: siteData.name, 24804 siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) 24805 }; 24806 }, []); 24807 let siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 24808 className: "components-site-icon", 24809 size: "36px", 24810 icon: library_wordpress 24811 }); 24812 if (siteIconUrl) { 24813 siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 24814 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 24815 className: "components-site-icon", 24816 src: siteIconUrl 24817 }); 24818 } 24819 if (isRequestingSiteIcon) { 24820 siteIcon = null; 24821 } 24822 let prePublishTitle, prePublishBodyText; 24823 if (!hasPublishAction) { 24824 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?'); 24825 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be reviewed and then approved.'); 24826 } else if (isBeingScheduled) { 24827 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?'); 24828 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.'); 24829 } else { 24830 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?'); 24831 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.'); 24832 } 24833 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24834 className: "editor-post-publish-panel__prepublish", 24835 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24836 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 24837 children: prePublishTitle 24838 }) 24839 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 24840 children: prePublishBodyText 24841 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24842 className: "components-site-card", 24843 children: [siteIcon, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24844 className: "components-site-info", 24845 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24846 className: "components-site-name", 24847 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)') 24848 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24849 className: "components-site-home", 24850 children: siteHome 24851 })] 24852 })] 24853 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeUploadMediaPanel, {}), hasPublishAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24854 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 24855 initialOpen: false, 24856 title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24857 className: "editor-post-publish-panel__link", 24858 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {}) 24859 }, "label")], 24860 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {}) 24861 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 24862 initialOpen: false, 24863 title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 24864 className: "editor-post-publish-panel__link", 24865 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}) 24866 }, "label")], 24867 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {}) 24868 })] 24869 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_tags_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_category_panel, {}), children] 24870 }); 24871 } 24872 /* harmony default export */ const prepublish = (PostPublishPanelPrepublish); 24873 24874 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js 24875 /** 24876 * WordPress dependencies 24877 */ 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 /** 24888 * Internal dependencies 24889 */ 24890 24891 24892 24893 const POSTNAME = '%postname%'; 24894 const PAGENAME = '%pagename%'; 24895 24896 /** 24897 * Returns URL for a future post. 24898 * 24899 * @param {Object} post Post object. 24900 * 24901 * @return {string} PostPublish URL. 24902 */ 24903 24904 const getFuturePostUrl = post => { 24905 const { 24906 slug 24907 } = post; 24908 if (post.permalink_template.includes(POSTNAME)) { 24909 return post.permalink_template.replace(POSTNAME, slug); 24910 } 24911 if (post.permalink_template.includes(PAGENAME)) { 24912 return post.permalink_template.replace(PAGENAME, slug); 24913 } 24914 return post.permalink_template; 24915 }; 24916 function postpublish_CopyButton({ 24917 text 24918 }) { 24919 const [showCopyConfirmation, setShowCopyConfirmation] = (0,external_wp_element_namespaceObject.useState)(false); 24920 const timeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); 24921 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => { 24922 setShowCopyConfirmation(true); 24923 if (timeoutIdRef.current) { 24924 clearTimeout(timeoutIdRef.current); 24925 } 24926 timeoutIdRef.current = setTimeout(() => { 24927 setShowCopyConfirmation(false); 24928 }, 4000); 24929 }); 24930 (0,external_wp_element_namespaceObject.useEffect)(() => { 24931 return () => { 24932 if (timeoutIdRef.current) { 24933 clearTimeout(timeoutIdRef.current); 24934 } 24935 }; 24936 }, []); 24937 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24938 __next40pxDefaultSize: true, 24939 variant: "secondary", 24940 ref: ref, 24941 children: showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy') 24942 }); 24943 } 24944 function PostPublishPanelPostpublish({ 24945 focusOnMount, 24946 children 24947 }) { 24948 const { 24949 post, 24950 postType, 24951 isScheduled 24952 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24953 const { 24954 getEditedPostAttribute, 24955 getCurrentPost, 24956 isCurrentPostScheduled 24957 } = select(store_store); 24958 const { 24959 getPostType 24960 } = select(external_wp_coreData_namespaceObject.store); 24961 return { 24962 post: getCurrentPost(), 24963 postType: getPostType(getEditedPostAttribute('type')), 24964 isScheduled: isCurrentPostScheduled() 24965 }; 24966 }, []); 24967 const postLabel = postType?.labels?.singular_name; 24968 const viewPostLabel = postType?.labels?.view_item; 24969 const addNewPostLabel = postType?.labels?.add_new_item; 24970 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; 24971 const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', { 24972 post_type: post.type 24973 }); 24974 const postLinkRef = (0,external_wp_element_namespaceObject.useCallback)(node => { 24975 if (focusOnMount && node) { 24976 node.focus(); 24977 } 24978 }, [focusOnMount]); 24979 const postPublishNonLinkHeader = isScheduled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24980 children: [(0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), "."] 24981 }) : (0,external_wp_i18n_namespaceObject.__)('is now live.'); 24982 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24983 className: "post-publish-panel__postpublish", 24984 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 24985 className: "post-publish-panel__postpublish-header", 24986 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { 24987 ref: postLinkRef, 24988 href: link, 24989 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 24990 }), ' ', postPublishNonLinkHeader] 24991 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 24992 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 24993 className: "post-publish-panel__postpublish-subheader", 24994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 24995 children: (0,external_wp_i18n_namespaceObject.__)('What’s next?') 24996 }) 24997 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 24998 className: "post-publish-panel__postpublish-post-address-container", 24999 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 25000 __next40pxDefaultSize: true, 25001 __nextHasNoMarginBottom: true, 25002 className: "post-publish-panel__postpublish-post-address", 25003 readOnly: true, 25004 label: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: post type singular name */ 25005 (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel), 25006 value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), 25007 onFocus: event => event.target.select() 25008 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25009 className: "post-publish-panel__postpublish-post-address__copy-button-wrap", 25010 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, { 25011 text: link 25012 }) 25013 })] 25014 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 25015 className: "post-publish-panel__postpublish-buttons", 25016 children: [!isScheduled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25017 variant: "primary", 25018 href: link, 25019 __next40pxDefaultSize: true, 25020 children: viewPostLabel 25021 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25022 variant: isScheduled ? 'primary' : 'secondary', 25023 __next40pxDefaultSize: true, 25024 href: addLink, 25025 children: addNewPostLabel 25026 })] 25027 })] 25028 }), children] 25029 }); 25030 } 25031 25032 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js 25033 /** 25034 * WordPress dependencies 25035 */ 25036 25037 25038 25039 25040 25041 25042 25043 25044 /** 25045 * Internal dependencies 25046 */ 25047 25048 25049 25050 25051 25052 class PostPublishPanel extends external_wp_element_namespaceObject.Component { 25053 constructor() { 25054 super(...arguments); 25055 this.onSubmit = this.onSubmit.bind(this); 25056 this.cancelButtonNode = (0,external_wp_element_namespaceObject.createRef)(); 25057 } 25058 componentDidMount() { 25059 // This timeout is necessary to make sure the `useEffect` hook of 25060 // `useFocusReturn` gets the correct element (the button that opens the 25061 // PostPublishPanel) otherwise it will get this button. 25062 this.timeoutID = setTimeout(() => { 25063 this.cancelButtonNode.current.focus(); 25064 }, 0); 25065 } 25066 componentWillUnmount() { 25067 clearTimeout(this.timeoutID); 25068 } 25069 componentDidUpdate(prevProps) { 25070 // Automatically collapse the publish sidebar when a post 25071 // is published and the user makes an edit. 25072 if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty || this.props.currentPostId !== prevProps.currentPostId) { 25073 this.props.onClose(); 25074 } 25075 } 25076 onSubmit() { 25077 const { 25078 onClose, 25079 hasPublishAction, 25080 isPostTypeViewable 25081 } = this.props; 25082 if (!hasPublishAction || !isPostTypeViewable) { 25083 onClose(); 25084 } 25085 } 25086 render() { 25087 const { 25088 forceIsDirty, 25089 isBeingScheduled, 25090 isPublished, 25091 isPublishSidebarEnabled, 25092 isScheduled, 25093 isSaving, 25094 isSavingNonPostEntityChanges, 25095 onClose, 25096 onTogglePublishSidebar, 25097 PostPublishExtension, 25098 PrePublishExtension, 25099 currentPostId, 25100 ...additionalProps 25101 } = this.props; 25102 const { 25103 hasPublishAction, 25104 isDirty, 25105 isPostTypeViewable, 25106 ...propsForPanel 25107 } = additionalProps; 25108 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; 25109 const isPrePublish = !isPublishedOrScheduled && !isSaving; 25110 const isPostPublish = isPublishedOrScheduled && !isSaving; 25111 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 25112 className: "editor-post-publish-panel", 25113 ...propsForPanel, 25114 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25115 className: "editor-post-publish-panel__header", 25116 children: isPostPublish ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25117 size: "compact", 25118 onClick: onClose, 25119 icon: close_small, 25120 label: (0,external_wp_i18n_namespaceObject.__)('Close panel') 25121 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25122 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25123 className: "editor-post-publish-panel__header-cancel-button", 25124 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25125 ref: this.cancelButtonNode, 25126 accessibleWhenDisabled: true, 25127 disabled: isSavingNonPostEntityChanges, 25128 onClick: onClose, 25129 variant: "secondary", 25130 size: "compact", 25131 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 25132 }) 25133 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25134 className: "editor-post-publish-panel__header-publish-button", 25135 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { 25136 onSubmit: this.onSubmit, 25137 forceIsDirty: forceIsDirty 25138 }) 25139 })] 25140 }) 25141 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 25142 className: "editor-post-publish-panel__content", 25143 children: [isPrePublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish, { 25144 children: PrePublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {}) 25145 }), isPostPublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishPanelPostpublish, { 25146 focusOnMount: true, 25147 children: PostPublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {}) 25148 }), isSaving && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] 25149 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25150 className: "editor-post-publish-panel__footer", 25151 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 25152 __nextHasNoMarginBottom: true, 25153 label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'), 25154 checked: isPublishSidebarEnabled, 25155 onChange: onTogglePublishSidebar 25156 }) 25157 })] 25158 }); 25159 } 25160 } 25161 25162 /** 25163 * Renders a panel for publishing a post. 25164 */ 25165 /* harmony default export */ const post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 25166 var _getCurrentPost$_link; 25167 const { 25168 getPostType 25169 } = select(external_wp_coreData_namespaceObject.store); 25170 const { 25171 getCurrentPost, 25172 getCurrentPostId, 25173 getEditedPostAttribute, 25174 isCurrentPostPublished, 25175 isCurrentPostScheduled, 25176 isEditedPostBeingScheduled, 25177 isEditedPostDirty, 25178 isAutosavingPost, 25179 isSavingPost, 25180 isSavingNonPostEntityChanges 25181 } = select(store_store); 25182 const { 25183 isPublishSidebarEnabled 25184 } = select(store_store); 25185 const postType = getPostType(getEditedPostAttribute('type')); 25186 return { 25187 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 25188 isPostTypeViewable: postType?.viewable, 25189 isBeingScheduled: isEditedPostBeingScheduled(), 25190 isDirty: isEditedPostDirty(), 25191 isPublished: isCurrentPostPublished(), 25192 isPublishSidebarEnabled: isPublishSidebarEnabled(), 25193 isSaving: isSavingPost() && !isAutosavingPost(), 25194 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), 25195 isScheduled: isCurrentPostScheduled(), 25196 currentPostId: getCurrentPostId() 25197 }; 25198 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 25199 isPublishSidebarEnabled 25200 }) => { 25201 const { 25202 disablePublishSidebar, 25203 enablePublishSidebar 25204 } = dispatch(store_store); 25205 return { 25206 onTogglePublishSidebar: () => { 25207 if (isPublishSidebarEnabled) { 25208 disablePublishSidebar(); 25209 } else { 25210 enablePublishSidebar(); 25211 } 25212 } 25213 }; 25214 }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel)); 25215 25216 ;// ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js 25217 /** 25218 * WordPress dependencies 25219 */ 25220 25221 25222 const cloudUpload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25223 xmlns: "http://www.w3.org/2000/svg", 25224 viewBox: "0 0 24 24", 25225 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25226 d: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" 25227 }) 25228 }); 25229 /* harmony default export */ const cloud_upload = (cloudUpload); 25230 25231 ;// ./node_modules/@wordpress/icons/build-module/library/cloud.js 25232 /** 25233 * WordPress dependencies 25234 */ 25235 25236 25237 const cloud = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25238 xmlns: "http://www.w3.org/2000/svg", 25239 viewBox: "0 0 24 24", 25240 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25241 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" 25242 }) 25243 }); 25244 /* harmony default export */ const library_cloud = (cloud); 25245 25246 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js 25247 /** 25248 * WordPress dependencies 25249 */ 25250 25251 25252 /** 25253 * Internal dependencies 25254 */ 25255 25256 25257 /** 25258 * Wrapper component that renders its children only if post has a sticky action. 25259 * 25260 * @param {Object} props Props. 25261 * @param {React.ReactNode} props.children Children to be rendered. 25262 * 25263 * @return {React.ReactNode} The component to be rendered or null if post type is not 'post' or hasStickyAction is false. 25264 */ 25265 function PostStickyCheck({ 25266 children 25267 }) { 25268 const { 25269 hasStickyAction, 25270 postType 25271 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25272 var _post$_links$wpActio; 25273 const post = select(store_store).getCurrentPost(); 25274 return { 25275 hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false, 25276 postType: select(store_store).getCurrentPostType() 25277 }; 25278 }, []); 25279 if (postType !== 'post' || !hasStickyAction) { 25280 return null; 25281 } 25282 return children; 25283 } 25284 25285 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js 25286 /** 25287 * WordPress dependencies 25288 */ 25289 25290 25291 25292 25293 /** 25294 * Internal dependencies 25295 */ 25296 25297 25298 25299 /** 25300 * Renders the PostSticky component. It provides a checkbox control for the sticky post feature. 25301 * 25302 * @return {React.ReactNode} The rendered component. 25303 */ 25304 25305 function PostSticky() { 25306 const postSticky = (0,external_wp_data_namespaceObject.useSelect)(select => { 25307 var _select$getEditedPost; 25308 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('sticky')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : false; 25309 }, []); 25310 const { 25311 editPost 25312 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25313 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, { 25314 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 25315 className: "editor-post-sticky__checkbox-control", 25316 label: (0,external_wp_i18n_namespaceObject.__)('Sticky'), 25317 help: (0,external_wp_i18n_namespaceObject.__)('Pin this post to the top of the blog'), 25318 checked: postSticky, 25319 onChange: () => editPost({ 25320 sticky: !postSticky 25321 }), 25322 __nextHasNoMarginBottom: true 25323 }) 25324 }); 25325 } 25326 25327 ;// ./node_modules/@wordpress/editor/build-module/components/post-status/index.js 25328 /** 25329 * WordPress dependencies 25330 */ 25331 25332 25333 25334 25335 25336 25337 25338 25339 25340 /** 25341 * Internal dependencies 25342 */ 25343 25344 25345 25346 25347 25348 25349 const postStatusesInfo = { 25350 'auto-draft': { 25351 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 25352 icon: library_drafts 25353 }, 25354 draft: { 25355 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 25356 icon: library_drafts 25357 }, 25358 pending: { 25359 label: (0,external_wp_i18n_namespaceObject.__)('Pending'), 25360 icon: library_pending 25361 }, 25362 private: { 25363 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 25364 icon: not_allowed 25365 }, 25366 future: { 25367 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 25368 icon: library_scheduled 25369 }, 25370 publish: { 25371 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 25372 icon: library_published 25373 } 25374 }; 25375 const STATUS_OPTIONS = [{ 25376 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 25377 value: 'draft', 25378 description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') 25379 }, { 25380 label: (0,external_wp_i18n_namespaceObject.__)('Pending'), 25381 value: 'pending', 25382 description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') 25383 }, { 25384 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 25385 value: 'private', 25386 description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 25387 }, { 25388 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 25389 value: 'future', 25390 description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') 25391 }, { 25392 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 25393 value: 'publish', 25394 description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 25395 }]; 25396 const DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; 25397 function PostStatus() { 25398 const { 25399 status, 25400 date, 25401 password, 25402 postId, 25403 postType, 25404 canEdit 25405 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25406 var _getCurrentPost$_link; 25407 const { 25408 getEditedPostAttribute, 25409 getCurrentPostId, 25410 getCurrentPostType, 25411 getCurrentPost 25412 } = select(store_store); 25413 return { 25414 status: getEditedPostAttribute('status'), 25415 date: getEditedPostAttribute('date'), 25416 password: getEditedPostAttribute('password'), 25417 postId: getCurrentPostId(), 25418 postType: getCurrentPostType(), 25419 canEdit: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false 25420 }; 25421 }, []); 25422 const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 25423 const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostStatus, 'editor-change-status__password-input'); 25424 const { 25425 editEntityRecord 25426 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 25427 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25428 // Memoize popoverProps to avoid returning a new object every time. 25429 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 25430 // Anchor the popover to the middle of the entire row so that it doesn't 25431 // move around when the label changes. 25432 anchor: popoverAnchor, 25433 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 25434 headerTitle: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 25435 placement: 'left-start', 25436 offset: 36, 25437 shift: true 25438 }), [popoverAnchor]); 25439 if (DESIGN_POST_TYPES.includes(postType)) { 25440 return null; 25441 } 25442 const updatePost = ({ 25443 status: newStatus = status, 25444 password: newPassword = password, 25445 date: newDate = date 25446 }) => { 25447 editEntityRecord('postType', postType, postId, { 25448 status: newStatus, 25449 date: newDate, 25450 password: newPassword 25451 }); 25452 }; 25453 const handleTogglePassword = value => { 25454 setShowPassword(value); 25455 if (!value) { 25456 updatePost({ 25457 password: '' 25458 }); 25459 } 25460 }; 25461 const handleStatus = value => { 25462 let newDate = date; 25463 let newPassword = password; 25464 if (status === 'future' && new Date(date) > new Date()) { 25465 newDate = null; 25466 } 25467 if (value === 'private' && password) { 25468 newPassword = ''; 25469 } 25470 updatePost({ 25471 status: value, 25472 date: newDate, 25473 password: newPassword 25474 }); 25475 }; 25476 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 25477 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 25478 ref: setPopoverAnchor, 25479 children: canEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 25480 className: "editor-post-status", 25481 contentClassName: "editor-change-status__content", 25482 popoverProps: popoverProps, 25483 focusOnMount: true, 25484 renderToggle: ({ 25485 onToggle, 25486 isOpen 25487 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25488 className: "editor-post-status__toggle", 25489 variant: "tertiary", 25490 size: "compact", 25491 onClick: onToggle, 25492 icon: postStatusesInfo[status]?.icon, 25493 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 25494 // translators: %s: Current post status. 25495 (0,external_wp_i18n_namespaceObject.__)('Change status: %s'), postStatusesInfo[status]?.label), 25496 "aria-expanded": isOpen, 25497 children: postStatusesInfo[status]?.label 25498 }), 25499 renderContent: ({ 25500 onClose 25501 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25502 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 25503 title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 25504 onClose: onClose 25505 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 25506 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 25507 spacing: 4, 25508 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 25509 className: "editor-change-status__options", 25510 hideLabelFromVision: true, 25511 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 25512 options: STATUS_OPTIONS, 25513 onChange: handleStatus, 25514 selected: status === 'auto-draft' ? 'draft' : status 25515 }), status === 'future' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25516 className: "editor-change-status__publish-date-wrapper", 25517 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { 25518 showPopoverHeaderActions: false, 25519 isCompact: true 25520 }) 25521 }), status !== 'private' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 25522 as: "fieldset", 25523 spacing: 4, 25524 className: "editor-change-status__password-fieldset", 25525 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 25526 __nextHasNoMarginBottom: true, 25527 label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), 25528 help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'), 25529 checked: showPassword, 25530 onChange: handleTogglePassword 25531 }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25532 className: "editor-change-status__password-input", 25533 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 25534 label: (0,external_wp_i18n_namespaceObject.__)('Password'), 25535 onChange: value => updatePost({ 25536 password: value 25537 }), 25538 value: password, 25539 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'), 25540 type: "text", 25541 id: passwordInputId, 25542 __next40pxDefaultSize: true, 25543 __nextHasNoMarginBottom: true, 25544 maxLength: 255 25545 }) 25546 })] 25547 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {})] 25548 }) 25549 })] 25550 }) 25551 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25552 className: "editor-post-status is-read-only", 25553 children: postStatusesInfo[status]?.label 25554 }) 25555 }); 25556 } 25557 25558 ;// ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js 25559 /* wp:polyfill */ 25560 /** 25561 * External dependencies 25562 */ 25563 25564 25565 /** 25566 * WordPress dependencies 25567 */ 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 /** 25578 * Internal dependencies 25579 */ 25580 25581 25582 25583 /** 25584 * Component showing whether the post is saved or not and providing save 25585 * buttons. 25586 * 25587 * @param {Object} props Component props. 25588 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked 25589 * as dirty. 25590 * @return {import('react').ComponentType} The component. 25591 */ 25592 25593 function PostSavedState({ 25594 forceIsDirty 25595 }) { 25596 const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); 25597 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); 25598 const { 25599 isAutosaving, 25600 isDirty, 25601 isNew, 25602 isPublished, 25603 isSaveable, 25604 isSaving, 25605 isScheduled, 25606 hasPublishAction, 25607 showIconLabels, 25608 postStatus, 25609 postStatusHasChanged 25610 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25611 var _getCurrentPost$_link; 25612 const { 25613 isEditedPostNew, 25614 isCurrentPostPublished, 25615 isCurrentPostScheduled, 25616 isEditedPostDirty, 25617 isSavingPost, 25618 isEditedPostSaveable, 25619 getCurrentPost, 25620 isAutosavingPost, 25621 getEditedPostAttribute, 25622 getPostEdits 25623 } = select(store_store); 25624 const { 25625 get 25626 } = select(external_wp_preferences_namespaceObject.store); 25627 return { 25628 isAutosaving: isAutosavingPost(), 25629 isDirty: forceIsDirty || isEditedPostDirty(), 25630 isNew: isEditedPostNew(), 25631 isPublished: isCurrentPostPublished(), 25632 isSaving: isSavingPost(), 25633 isSaveable: isEditedPostSaveable(), 25634 isScheduled: isCurrentPostScheduled(), 25635 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 25636 showIconLabels: get('core', 'showIconLabels'), 25637 postStatus: getEditedPostAttribute('status'), 25638 postStatusHasChanged: !!getPostEdits()?.status 25639 }; 25640 }, [forceIsDirty]); 25641 const isPending = postStatus === 'pending'; 25642 const { 25643 savePost 25644 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25645 const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); 25646 (0,external_wp_element_namespaceObject.useEffect)(() => { 25647 let timeoutId; 25648 if (wasSaving && !isSaving) { 25649 setForceSavedMessage(true); 25650 timeoutId = setTimeout(() => { 25651 setForceSavedMessage(false); 25652 }, 1000); 25653 } 25654 return () => clearTimeout(timeoutId); 25655 }, [isSaving]); 25656 25657 // Once the post has been submitted for review this button 25658 // is not needed for the contributor role. 25659 if (!hasPublishAction && isPending) { 25660 return null; 25661 } 25662 25663 // We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft. 25664 // The reason for this is that this button handles the `save as pending` and `save draft` actions. 25665 // An exception for this is when the post has a custom status and there should be a way to save changes without 25666 // having to publish. This should be handled better in the future when custom statuses have better support. 25667 // @see https://github.com/WordPress/gutenberg/issues/3144. 25668 const isIneligibleStatus = !['pending', 'draft', 'auto-draft'].includes(postStatus) && STATUS_OPTIONS.map(({ 25669 value 25670 }) => value).includes(postStatus); 25671 if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) { 25672 return null; 25673 } 25674 25675 /* translators: button label text should, if possible, be under 16 characters. */ 25676 const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft'); 25677 25678 /* translators: button label text should, if possible, be under 16 characters. */ 25679 const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save'); 25680 const isSaved = forceSavedMessage || !isNew && !isDirty; 25681 const isSavedState = isSaving || isSaved; 25682 const isDisabled = isSaving || isSaved || !isSaveable; 25683 let text; 25684 if (isSaving) { 25685 text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving'); 25686 } else if (isSaved) { 25687 text = (0,external_wp_i18n_namespaceObject.__)('Saved'); 25688 } else if (isLargeViewport) { 25689 text = label; 25690 } else if (showIconLabels) { 25691 text = shortLabel; 25692 } 25693 25694 // Use common Button instance for all saved states so that focus is not 25695 // lost. 25696 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 25697 className: isSaveable || isSaving ? dist_clsx({ 25698 'editor-post-save-draft': !isSavedState, 25699 'editor-post-saved-state': isSavedState, 25700 'is-saving': isSaving, 25701 'is-autosaving': isAutosaving, 25702 'is-saved': isSaved, 25703 [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ 25704 type: 'loading' 25705 })]: isSaving 25706 }) : undefined, 25707 onClick: isDisabled ? undefined : () => savePost() 25708 /* 25709 * We want the tooltip to show the keyboard shortcut only when the 25710 * button does something, i.e. when it's not disabled. 25711 */, 25712 shortcut: isDisabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s'), 25713 variant: "tertiary", 25714 size: "compact", 25715 icon: isLargeViewport ? undefined : cloud_upload, 25716 label: text || label, 25717 "aria-disabled": isDisabled, 25718 children: [isSavedState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { 25719 icon: isSaved ? library_check : library_cloud 25720 }), text] 25721 }); 25722 } 25723 25724 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js 25725 /** 25726 * WordPress dependencies 25727 */ 25728 25729 25730 /** 25731 * Internal dependencies 25732 */ 25733 25734 25735 /** 25736 * Wrapper component that renders its children only if post has a publish action. 25737 * 25738 * @param {Object} props Props. 25739 * @param {React.ReactNode} props.children Children to be rendered. 25740 * 25741 * @return {React.ReactNode} - The component to be rendered or null if there is no publish action. 25742 */ 25743 function PostScheduleCheck({ 25744 children 25745 }) { 25746 const hasPublishAction = (0,external_wp_data_namespaceObject.useSelect)(select => { 25747 var _select$getCurrentPos; 25748 return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; 25749 }, []); 25750 if (!hasPublishAction) { 25751 return null; 25752 } 25753 return children; 25754 } 25755 25756 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js 25757 /** 25758 * WordPress dependencies 25759 */ 25760 25761 25762 25763 25764 25765 /** 25766 * Internal dependencies 25767 */ 25768 25769 25770 25771 25772 25773 25774 25775 const panel_DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; 25776 25777 /** 25778 * Renders the Post Schedule Panel component. 25779 * 25780 * @return {React.ReactNode} The rendered component. 25781 */ 25782 function PostSchedulePanel() { 25783 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25784 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 25785 // Memoize popoverProps to avoid returning a new object every time. 25786 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 25787 // Anchor the popover to the middle of the entire row so that it doesn't 25788 // move around when the label changes. 25789 anchor: popoverAnchor, 25790 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Change publish date'), 25791 placement: 'left-start', 25792 offset: 36, 25793 shift: true 25794 }), [popoverAnchor]); 25795 const label = usePostScheduleLabel(); 25796 const fullLabel = usePostScheduleLabel({ 25797 full: true 25798 }); 25799 if (panel_DESIGN_POST_TYPES.includes(postType)) { 25800 return null; 25801 } 25802 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, { 25803 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 25804 label: (0,external_wp_i18n_namespaceObject.__)('Publish'), 25805 ref: setPopoverAnchor, 25806 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 25807 popoverProps: popoverProps, 25808 focusOnMount: true, 25809 className: "editor-post-schedule__panel-dropdown", 25810 contentClassName: "editor-post-schedule__dialog", 25811 renderToggle: ({ 25812 onToggle, 25813 isOpen 25814 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25815 size: "compact", 25816 className: "editor-post-schedule__dialog-toggle", 25817 variant: "tertiary", 25818 tooltipPosition: "middle left", 25819 onClick: onToggle, 25820 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 25821 // translators: %s: Current post date. 25822 (0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label), 25823 label: fullLabel, 25824 showTooltip: label !== fullLabel, 25825 "aria-expanded": isOpen, 25826 children: label 25827 }), 25828 renderContent: ({ 25829 onClose 25830 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, { 25831 onClose: onClose 25832 }) 25833 }) 25834 }) 25835 }); 25836 } 25837 25838 ;// ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js 25839 /** 25840 * WordPress dependencies 25841 */ 25842 25843 25844 25845 25846 25847 25848 /** 25849 * Internal dependencies 25850 */ 25851 25852 25853 /** 25854 * Renders a button component that allows the user to switch a post to draft status. 25855 * 25856 * @return {React.ReactNode} The rendered component. 25857 */ 25858 25859 function PostSwitchToDraftButton() { 25860 external_wp_deprecated_default()('wp.editor.PostSwitchToDraftButton', { 25861 since: '6.7', 25862 version: '6.9' 25863 }); 25864 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 25865 const { 25866 editPost, 25867 savePost 25868 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25869 const { 25870 isSaving, 25871 isPublished, 25872 isScheduled 25873 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25874 const { 25875 isSavingPost, 25876 isCurrentPostPublished, 25877 isCurrentPostScheduled 25878 } = select(store_store); 25879 return { 25880 isSaving: isSavingPost(), 25881 isPublished: isCurrentPostPublished(), 25882 isScheduled: isCurrentPostScheduled() 25883 }; 25884 }, []); 25885 const isDisabled = isSaving || !isPublished && !isScheduled; 25886 let alertMessage; 25887 let confirmButtonText; 25888 if (isPublished) { 25889 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?'); 25890 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unpublish'); 25891 } else if (isScheduled) { 25892 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?'); 25893 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unschedule'); 25894 } 25895 const handleConfirm = () => { 25896 setShowConfirmDialog(false); 25897 editPost({ 25898 status: 'draft' 25899 }); 25900 savePost(); 25901 }; 25902 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25903 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25904 __next40pxDefaultSize: true, 25905 className: "editor-post-switch-to-draft", 25906 onClick: () => { 25907 if (!isDisabled) { 25908 setShowConfirmDialog(true); 25909 } 25910 }, 25911 "aria-disabled": isDisabled, 25912 variant: "secondary", 25913 style: { 25914 flexGrow: '1', 25915 justifyContent: 'center' 25916 }, 25917 children: (0,external_wp_i18n_namespaceObject.__)('Switch to draft') 25918 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 25919 isOpen: showConfirmDialog, 25920 onConfirm: handleConfirm, 25921 onCancel: () => setShowConfirmDialog(false), 25922 confirmButtonText: confirmButtonText, 25923 children: alertMessage 25924 })] 25925 }); 25926 } 25927 25928 ;// ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js 25929 /** 25930 * WordPress dependencies 25931 */ 25932 25933 25934 25935 /** 25936 * Internal dependencies 25937 */ 25938 25939 25940 25941 /** 25942 * Renders the sync status of a post. 25943 * 25944 * @return {React.ReactNode} The rendered sync status component. 25945 */ 25946 25947 function PostSyncStatus() { 25948 const { 25949 syncStatus, 25950 postType 25951 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25952 const { 25953 getEditedPostAttribute 25954 } = select(store_store); 25955 const meta = getEditedPostAttribute('meta'); 25956 25957 // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead. 25958 const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : getEditedPostAttribute('wp_pattern_sync_status'); 25959 return { 25960 syncStatus: currentSyncStatus, 25961 postType: getEditedPostAttribute('type') 25962 }; 25963 }); 25964 if (postType !== 'wp_block') { 25965 return null; 25966 } 25967 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 25968 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 25969 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25970 className: "editor-post-sync-status__value", 25971 children: syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)') 25972 }) 25973 }); 25974 } 25975 25976 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js 25977 /* wp:polyfill */ 25978 /** 25979 * WordPress dependencies 25980 */ 25981 25982 25983 25984 25985 /** 25986 * Internal dependencies 25987 */ 25988 25989 25990 25991 25992 const post_taxonomies_identity = x => x; 25993 function PostTaxonomies({ 25994 taxonomyWrapper = post_taxonomies_identity 25995 }) { 25996 const { 25997 postType, 25998 taxonomies 25999 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26000 return { 26001 postType: select(store_store).getCurrentPostType(), 26002 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 26003 per_page: -1 26004 }) 26005 }; 26006 }, []); 26007 const visibleTaxonomies = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(taxonomy => 26008 // In some circumstances .visibility can end up as undefined so optional chaining operator required. 26009 // https://github.com/WordPress/gutenberg/issues/40326 26010 taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui); 26011 return visibleTaxonomies.map(taxonomy => { 26012 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; 26013 const taxonomyComponentProps = { 26014 slug: taxonomy.slug, 26015 ...(taxonomy.hierarchical ? {} : { 26016 __nextHasNoMarginBottom: true 26017 }) 26018 }; 26019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 26020 children: taxonomyWrapper(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, { 26021 ...taxonomyComponentProps 26022 }), taxonomy) 26023 }, `taxonomy-$taxonomy.slug}`); 26024 }); 26025 } 26026 26027 /** 26028 * Renders the taxonomies associated with a post. 26029 * 26030 * @param {Object} props The component props. 26031 * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component. 26032 * 26033 * @return {Array} An array of JSX elements representing the visible taxonomies. 26034 */ 26035 /* harmony default export */ const post_taxonomies = (PostTaxonomies); 26036 26037 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js 26038 /** 26039 * WordPress dependencies 26040 */ 26041 26042 26043 26044 /** 26045 * Internal dependencies 26046 */ 26047 26048 26049 /** 26050 * Renders the children components only if the current post type has taxonomies. 26051 * 26052 * @param {Object} props The component props. 26053 * @param {React.ReactNode} props.children The children components to render. 26054 * 26055 * @return {React.ReactNode} The rendered children components or null if the current post type has no taxonomies. 26056 */ 26057 function PostTaxonomiesCheck({ 26058 children 26059 }) { 26060 const hasTaxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => { 26061 const postType = select(store_store).getCurrentPostType(); 26062 const taxonomies = select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 26063 per_page: -1 26064 }); 26065 return taxonomies?.some(taxonomy => taxonomy.types.includes(postType)); 26066 }, []); 26067 if (!hasTaxonomies) { 26068 return null; 26069 } 26070 return children; 26071 } 26072 26073 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js 26074 /** 26075 * WordPress dependencies 26076 */ 26077 26078 26079 26080 /** 26081 * Internal dependencies 26082 */ 26083 26084 26085 26086 26087 /** 26088 * Renders a panel for a specific taxonomy. 26089 * 26090 * @param {Object} props The component props. 26091 * @param {Object} props.taxonomy The taxonomy object. 26092 * @param {React.ReactNode} props.children The child components. 26093 * 26094 * @return {React.ReactNode} The rendered taxonomy panel. 26095 */ 26096 26097 function TaxonomyPanel({ 26098 taxonomy, 26099 children 26100 }) { 26101 const slug = taxonomy?.slug; 26102 const panelName = slug ? `taxonomy-panel-$slug}` : ''; 26103 const { 26104 isEnabled, 26105 isOpened 26106 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26107 const { 26108 isEditorPanelEnabled, 26109 isEditorPanelOpened 26110 } = select(store_store); 26111 return { 26112 isEnabled: slug ? isEditorPanelEnabled(panelName) : false, 26113 isOpened: slug ? isEditorPanelOpened(panelName) : false 26114 }; 26115 }, [panelName, slug]); 26116 const { 26117 toggleEditorPanelOpened 26118 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26119 if (!isEnabled) { 26120 return null; 26121 } 26122 const taxonomyMenuName = taxonomy?.labels?.menu_name; 26123 if (!taxonomyMenuName) { 26124 return null; 26125 } 26126 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 26127 title: taxonomyMenuName, 26128 opened: isOpened, 26129 onToggle: () => toggleEditorPanelOpened(panelName), 26130 children: children 26131 }); 26132 } 26133 26134 /** 26135 * Component that renders the post taxonomies panel. 26136 * 26137 * @return {React.ReactNode} The rendered component. 26138 */ 26139 function panel_PostTaxonomies() { 26140 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, { 26141 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { 26142 taxonomyWrapper: (content, taxonomy) => { 26143 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, { 26144 taxonomy: taxonomy, 26145 children: content 26146 }); 26147 } 26148 }) 26149 }); 26150 } 26151 26152 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 26153 var lib = __webpack_require__(4132); 26154 ;// ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js 26155 /** 26156 * External dependencies 26157 */ 26158 26159 26160 /** 26161 * WordPress dependencies 26162 */ 26163 26164 26165 26166 26167 26168 26169 26170 26171 /** 26172 * Internal dependencies 26173 */ 26174 26175 26176 /** 26177 * Displays the Post Text Editor along with content in Visual and Text mode. 26178 * 26179 * @return {React.ReactNode} The rendered PostTextEditor component. 26180 */ 26181 26182 function PostTextEditor() { 26183 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); 26184 const { 26185 content, 26186 blocks, 26187 type, 26188 id 26189 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26190 const { 26191 getEditedEntityRecord 26192 } = select(external_wp_coreData_namespaceObject.store); 26193 const { 26194 getCurrentPostType, 26195 getCurrentPostId 26196 } = select(store_store); 26197 const _type = getCurrentPostType(); 26198 const _id = getCurrentPostId(); 26199 const editedRecord = getEditedEntityRecord('postType', _type, _id); 26200 return { 26201 content: editedRecord?.content, 26202 blocks: editedRecord?.blocks, 26203 type: _type, 26204 id: _id 26205 }; 26206 }, []); 26207 const { 26208 editEntityRecord 26209 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 26210 // Replicates the logic found in getEditedPostContent(). 26211 const value = (0,external_wp_element_namespaceObject.useMemo)(() => { 26212 if (content instanceof Function) { 26213 return content({ 26214 blocks 26215 }); 26216 } else if (blocks) { 26217 // If we have parsed blocks already, they should be our source of truth. 26218 // Parsing applies block deprecations and legacy block conversions that 26219 // unparsed content will not have. 26220 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks); 26221 } 26222 return content; 26223 }, [content, blocks]); 26224 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26225 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 26226 as: "label", 26227 htmlFor: `post-content-$instanceId}`, 26228 children: (0,external_wp_i18n_namespaceObject.__)('Type text or HTML') 26229 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { 26230 autoComplete: "off", 26231 dir: "auto", 26232 value: value, 26233 onChange: event => { 26234 editEntityRecord('postType', type, id, { 26235 content: event.target.value, 26236 blocks: undefined, 26237 selection: undefined 26238 }); 26239 }, 26240 className: "editor-post-text-editor", 26241 id: `post-content-$instanceId}`, 26242 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') 26243 })] 26244 }); 26245 } 26246 26247 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/constants.js 26248 const DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text'; 26249 const REGEXP_NEWLINES = /[\r\n]+/g; 26250 26251 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title-focus.js 26252 /** 26253 * WordPress dependencies 26254 */ 26255 26256 26257 26258 /** 26259 * Internal dependencies 26260 */ 26261 26262 26263 /** 26264 * Custom hook that manages the focus behavior of the post title input field. 26265 * 26266 * @param {Element} forwardedRef - The forwarded ref for the input field. 26267 * 26268 * @return {Object} - The ref object. 26269 */ 26270 function usePostTitleFocus(forwardedRef) { 26271 const ref = (0,external_wp_element_namespaceObject.useRef)(); 26272 const { 26273 isCleanNewPost 26274 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26275 const { 26276 isCleanNewPost: _isCleanNewPost 26277 } = select(store_store); 26278 return { 26279 isCleanNewPost: _isCleanNewPost() 26280 }; 26281 }, []); 26282 (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({ 26283 focus: () => { 26284 ref?.current?.focus(); 26285 } 26286 })); 26287 (0,external_wp_element_namespaceObject.useEffect)(() => { 26288 if (!ref.current) { 26289 return; 26290 } 26291 const { 26292 defaultView 26293 } = ref.current.ownerDocument; 26294 const { 26295 name, 26296 parent 26297 } = defaultView; 26298 const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document; 26299 const { 26300 activeElement, 26301 body 26302 } = ownerDocument; 26303 26304 // Only autofocus the title when the post is entirely empty. This should 26305 // only happen for a new post, which means we focus the title on new 26306 // post so the author can start typing right away, without needing to 26307 // click anything. 26308 if (isCleanNewPost && (!activeElement || body === activeElement)) { 26309 ref.current.focus(); 26310 } 26311 }, [isCleanNewPost]); 26312 return { 26313 ref 26314 }; 26315 } 26316 26317 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title.js 26318 /** 26319 * WordPress dependencies 26320 */ 26321 26322 /** 26323 * Internal dependencies 26324 */ 26325 26326 26327 /** 26328 * Custom hook for managing the post title in the editor. 26329 * 26330 * @return {Object} An object containing the current title and a function to update the title. 26331 */ 26332 function usePostTitle() { 26333 const { 26334 editPost 26335 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26336 const { 26337 title 26338 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26339 const { 26340 getEditedPostAttribute 26341 } = select(store_store); 26342 return { 26343 title: getEditedPostAttribute('title') 26344 }; 26345 }, []); 26346 function updateTitle(newTitle) { 26347 editPost({ 26348 title: newTitle 26349 }); 26350 } 26351 return { 26352 title, 26353 setTitle: updateTitle 26354 }; 26355 } 26356 26357 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/index.js 26358 /** 26359 * External dependencies 26360 */ 26361 26362 /** 26363 * WordPress dependencies 26364 */ 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 /** 26377 * Internal dependencies 26378 */ 26379 26380 26381 26382 26383 26384 const PostTitle = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => { 26385 const { 26386 placeholder 26387 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26388 const { 26389 getSettings 26390 } = select(external_wp_blockEditor_namespaceObject.store); 26391 const { 26392 titlePlaceholder 26393 } = getSettings(); 26394 return { 26395 placeholder: titlePlaceholder 26396 }; 26397 }, []); 26398 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 26399 const { 26400 ref: focusRef 26401 } = usePostTitleFocus(forwardedRef); 26402 const { 26403 title, 26404 setTitle: onUpdate 26405 } = usePostTitle(); 26406 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); 26407 const { 26408 clearSelectedBlock, 26409 insertBlocks, 26410 insertDefaultBlock 26411 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26412 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); 26413 const { 26414 value, 26415 onChange, 26416 ref: richTextRef 26417 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ 26418 value: title, 26419 onChange(newValue) { 26420 onUpdate(newValue.replace(REGEXP_NEWLINES, ' ')); 26421 }, 26422 placeholder: decodedPlaceholder, 26423 selectionStart: selection.start, 26424 selectionEnd: selection.end, 26425 onSelectionChange(newStart, newEnd) { 26426 setSelection(sel => { 26427 const { 26428 start, 26429 end 26430 } = sel; 26431 if (start === newStart && end === newEnd) { 26432 return sel; 26433 } 26434 return { 26435 start: newStart, 26436 end: newEnd 26437 }; 26438 }); 26439 }, 26440 __unstableDisableFormats: false 26441 }); 26442 function onInsertBlockAfter(blocks) { 26443 insertBlocks(blocks, 0); 26444 } 26445 function onSelect() { 26446 setIsSelected(true); 26447 clearSelectedBlock(); 26448 } 26449 function onUnselect() { 26450 setIsSelected(false); 26451 setSelection({}); 26452 } 26453 function onEnterPress() { 26454 insertDefaultBlock(undefined, undefined, 0); 26455 } 26456 function onKeyDown(event) { 26457 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 26458 event.preventDefault(); 26459 onEnterPress(); 26460 } 26461 } 26462 function onPaste(event) { 26463 const clipboardData = event.clipboardData; 26464 let plainText = ''; 26465 let html = ''; 26466 try { 26467 plainText = clipboardData.getData('text/plain'); 26468 html = clipboardData.getData('text/html'); 26469 } catch (error) { 26470 // Some browsers like UC Browser paste plain text by default and 26471 // don't support clipboardData at all, so allow default 26472 // behaviour. 26473 return; 26474 } 26475 26476 // Allows us to ask for this information when we get a report. 26477 window.console.log('Received HTML:\n\n', html); 26478 window.console.log('Received plain text:\n\n', plainText); 26479 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 26480 HTML: html, 26481 plainText 26482 }); 26483 event.preventDefault(); 26484 if (!content.length) { 26485 return; 26486 } 26487 if (typeof content !== 'string') { 26488 const [firstBlock] = content; 26489 if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { 26490 // Strip HTML to avoid unwanted HTML being added to the title. 26491 // In the majority of cases it is assumed that HTML in the title 26492 // is undesirable. 26493 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(firstBlock.attributes.content); 26494 onUpdate(contentNoHTML); 26495 onInsertBlockAfter(content.slice(1)); 26496 } else { 26497 onInsertBlockAfter(content); 26498 } 26499 } else { 26500 // Strip HTML to avoid unwanted HTML being added to the title. 26501 // In the majority of cases it is assumed that HTML in the title 26502 // is undesirable. 26503 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content); 26504 onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ 26505 html: contentNoHTML 26506 }))); 26507 } 26508 } 26509 26510 // The wp-block className is important for editor styles. 26511 // This same block is used in both the visual and the code editor. 26512 const className = dist_clsx(DEFAULT_CLASSNAMES, { 26513 'is-selected': isSelected 26514 }); 26515 return /*#__PURE__*/ /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 26516 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]), 26517 contentEditable: true, 26518 className: className, 26519 "aria-label": decodedPlaceholder, 26520 role: "textbox", 26521 "aria-multiline": "true", 26522 onFocus: onSelect, 26523 onBlur: onUnselect, 26524 onKeyDown: onKeyDown, 26525 onPaste: onPaste 26526 }) 26527 /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */; 26528 }); 26529 26530 /** 26531 * Renders the `PostTitle` component. 26532 * 26533 * @param {Object} _ Unused parameter. 26534 * @param {Element} forwardedRef Forwarded ref for the component. 26535 * 26536 * @return {React.ReactNode} The rendered PostTitle component. 26537 */ 26538 /* harmony default export */ const post_title = ((0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 26539 supportKeys: "title", 26540 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTitle, { 26541 ref: forwardedRef 26542 }) 26543 }))); 26544 26545 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js 26546 /** 26547 * External dependencies 26548 */ 26549 26550 26551 /** 26552 * WordPress dependencies 26553 */ 26554 26555 26556 26557 26558 26559 26560 26561 /** 26562 * Internal dependencies 26563 */ 26564 26565 26566 26567 26568 /** 26569 * Renders a raw post title input field. 26570 * 26571 * @param {Object} _ Unused parameter. 26572 * @param {Element} forwardedRef Reference to the component's DOM node. 26573 * 26574 * @return {React.ReactNode} The rendered component. 26575 */ 26576 26577 function PostTitleRaw(_, forwardedRef) { 26578 const { 26579 placeholder 26580 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26581 const { 26582 getSettings 26583 } = select(external_wp_blockEditor_namespaceObject.store); 26584 const { 26585 titlePlaceholder 26586 } = getSettings(); 26587 return { 26588 placeholder: titlePlaceholder 26589 }; 26590 }, []); 26591 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 26592 const { 26593 title, 26594 setTitle: onUpdate 26595 } = usePostTitle(); 26596 const { 26597 ref: focusRef 26598 } = usePostTitleFocus(forwardedRef); 26599 function onChange(value) { 26600 onUpdate(value.replace(REGEXP_NEWLINES, ' ')); 26601 } 26602 function onSelect() { 26603 setIsSelected(true); 26604 } 26605 function onUnselect() { 26606 setIsSelected(false); 26607 } 26608 26609 // The wp-block className is important for editor styles. 26610 // This same block is used in both the visual and the code editor. 26611 const className = dist_clsx(DEFAULT_CLASSNAMES, { 26612 'is-selected': isSelected, 26613 'is-raw-text': true 26614 }); 26615 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); 26616 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 26617 ref: focusRef, 26618 value: title, 26619 onChange: onChange, 26620 onFocus: onSelect, 26621 onBlur: onUnselect, 26622 label: placeholder, 26623 className: className, 26624 placeholder: decodedPlaceholder, 26625 hideLabelFromVision: true, 26626 autoComplete: "off", 26627 dir: "auto", 26628 rows: 1, 26629 __nextHasNoMarginBottom: true 26630 }); 26631 } 26632 /* harmony default export */ const post_title_raw = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw)); 26633 26634 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js 26635 /** 26636 * WordPress dependencies 26637 */ 26638 26639 26640 26641 /** 26642 * Internal dependencies 26643 */ 26644 26645 26646 26647 /** 26648 * Wrapper component that renders its children only if the post can be trashed. 26649 * 26650 * @param {Object} props The component props. 26651 * @param {React.ReactNode} props.children The child components. 26652 * 26653 * @return {React.ReactNode} The rendered child components or null if the post can't be trashed. 26654 */ 26655 function PostTrashCheck({ 26656 children 26657 }) { 26658 const { 26659 canTrashPost 26660 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26661 const { 26662 isEditedPostNew, 26663 getCurrentPostId, 26664 getCurrentPostType 26665 } = select(store_store); 26666 const { 26667 canUser 26668 } = select(external_wp_coreData_namespaceObject.store); 26669 const postType = getCurrentPostType(); 26670 const postId = getCurrentPostId(); 26671 const isNew = isEditedPostNew(); 26672 const canUserDelete = !!postId ? canUser('delete', { 26673 kind: 'postType', 26674 name: postType, 26675 id: postId 26676 }) : false; 26677 return { 26678 canTrashPost: (!isNew || postId) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType) 26679 }; 26680 }, []); 26681 if (!canTrashPost) { 26682 return null; 26683 } 26684 return children; 26685 } 26686 26687 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js 26688 /** 26689 * WordPress dependencies 26690 */ 26691 26692 26693 26694 26695 26696 /** 26697 * Internal dependencies 26698 */ 26699 26700 26701 26702 /** 26703 * Displays the Post Trash Button and Confirm Dialog in the Editor. 26704 * 26705 * @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function. 26706 * @return {React.ReactNode} The rendered PostTrash component. 26707 */ 26708 26709 function PostTrash({ 26710 onActionPerformed 26711 }) { 26712 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 26713 const { 26714 isNew, 26715 isDeleting, 26716 postId, 26717 title 26718 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26719 const store = select(store_store); 26720 return { 26721 isNew: store.isEditedPostNew(), 26722 isDeleting: store.isDeletingPost(), 26723 postId: store.getCurrentPostId(), 26724 title: store.getCurrentPostAttribute('title') 26725 }; 26726 }, []); 26727 const { 26728 trashPost 26729 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26730 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 26731 if (isNew || !postId) { 26732 return null; 26733 } 26734 const handleConfirm = async () => { 26735 setShowConfirmDialog(false); 26736 await trashPost(); 26737 const item = await registry.resolveSelect(store_store).getCurrentPost(); 26738 // After the post is trashed, we want to trigger the onActionPerformed callback, so the user is redirect 26739 // to the post view depending on if the user is on post editor or site editor. 26740 onActionPerformed?.('move-to-trash', [item]); 26741 }; 26742 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PostTrashCheck, { 26743 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26744 __next40pxDefaultSize: true, 26745 className: "editor-post-trash", 26746 isDestructive: true, 26747 variant: "secondary", 26748 isBusy: isDeleting, 26749 "aria-disabled": isDeleting, 26750 onClick: isDeleting ? undefined : () => setShowConfirmDialog(true), 26751 children: (0,external_wp_i18n_namespaceObject.__)('Move to trash') 26752 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 26753 isOpen: showConfirmDialog, 26754 onConfirm: handleConfirm, 26755 onCancel: () => setShowConfirmDialog(false), 26756 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), 26757 size: "small", 26758 children: (0,external_wp_i18n_namespaceObject.sprintf)( 26759 // translators: %s: The item's title. 26760 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), title) 26761 })] 26762 }); 26763 } 26764 26765 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/index.js 26766 /** 26767 * WordPress dependencies 26768 */ 26769 26770 26771 26772 26773 26774 26775 26776 26777 26778 26779 26780 /** 26781 * Internal dependencies 26782 */ 26783 26784 26785 /** 26786 * Renders the `PostURL` component. 26787 * 26788 * @example 26789 * ```jsx 26790 * <PostURL /> 26791 * ``` 26792 * 26793 * @param {{ onClose: () => void }} props The props for the component. 26794 * @param {() => void} props.onClose Callback function to be executed when the popover is closed. 26795 * 26796 * @return {React.ReactNode} The rendered PostURL component. 26797 */ 26798 26799 function PostURL({ 26800 onClose 26801 }) { 26802 const { 26803 isEditable, 26804 postSlug, 26805 postLink, 26806 permalinkPrefix, 26807 permalinkSuffix, 26808 permalink 26809 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26810 var _post$_links$wpActio; 26811 const post = select(store_store).getCurrentPost(); 26812 const postTypeSlug = select(store_store).getCurrentPostType(); 26813 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 26814 const permalinkParts = select(store_store).getPermalinkParts(); 26815 const hasPublishAction = (_post$_links$wpActio = post?._links?.['wp:action-publish']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false; 26816 return { 26817 isEditable: select(store_store).isPermalinkEditable() && hasPublishAction, 26818 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()), 26819 viewPostLabel: postType?.labels.view_item, 26820 postLink: post.link, 26821 permalinkPrefix: permalinkParts?.prefix, 26822 permalinkSuffix: permalinkParts?.suffix, 26823 permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getPermalink()) 26824 }; 26825 }, []); 26826 const { 26827 editPost 26828 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26829 const { 26830 createNotice 26831 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 26832 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); 26833 const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { 26834 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied Permalink to clipboard.'), { 26835 isDismissible: true, 26836 type: 'snackbar' 26837 }); 26838 }); 26839 const postUrlSlugDescriptionId = 'editor-post-url__slug-description-' + (0,external_wp_compose_namespaceObject.useInstanceId)(PostURL); 26840 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26841 className: "editor-post-url", 26842 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 26843 title: (0,external_wp_i18n_namespaceObject.__)('Slug'), 26844 onClose: onClose 26845 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 26846 spacing: 3, 26847 children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 26848 className: "editor-post-url__intro", 26849 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'), { 26850 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26851 id: postUrlSlugDescriptionId 26852 }), 26853 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 26854 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink') 26855 }) 26856 }) 26857 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26858 children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26859 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 26860 __next40pxDefaultSize: true, 26861 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { 26862 children: "/" 26863 }), 26864 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { 26865 variant: "control", 26866 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26867 icon: copy_small, 26868 ref: copyButtonRef, 26869 size: "small", 26870 label: "Copy" 26871 }) 26872 }), 26873 label: (0,external_wp_i18n_namespaceObject.__)('Slug'), 26874 hideLabelFromVision: true, 26875 value: forceEmptyField ? '' : postSlug, 26876 autoComplete: "off", 26877 spellCheck: "false", 26878 type: "text", 26879 className: "editor-post-url__input", 26880 onChange: newValue => { 26881 editPost({ 26882 slug: newValue 26883 }); 26884 // When we delete the field the permalink gets 26885 // reverted to the original value. 26886 // The forceEmptyField logic allows the user to have 26887 // the field temporarily empty while typing. 26888 if (!newValue) { 26889 if (!forceEmptyField) { 26890 setForceEmptyField(true); 26891 } 26892 return; 26893 } 26894 if (forceEmptyField) { 26895 setForceEmptyField(false); 26896 } 26897 }, 26898 onBlur: event => { 26899 editPost({ 26900 slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value) 26901 }); 26902 if (forceEmptyField) { 26903 setForceEmptyField(false); 26904 } 26905 }, 26906 "aria-describedby": postUrlSlugDescriptionId 26907 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { 26908 className: "editor-post-url__permalink", 26909 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26910 className: "editor-post-url__permalink-visual-label", 26911 children: (0,external_wp_i18n_namespaceObject.__)('Permalink:') 26912 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { 26913 className: "editor-post-url__link", 26914 href: postLink, 26915 target: "_blank", 26916 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26917 className: "editor-post-url__link-prefix", 26918 children: permalinkPrefix 26919 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26920 className: "editor-post-url__link-slug", 26921 children: postSlug 26922 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 26923 className: "editor-post-url__link-suffix", 26924 children: permalinkSuffix 26925 })] 26926 })] 26927 })] 26928 }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 26929 className: "editor-post-url__link", 26930 href: postLink, 26931 target: "_blank", 26932 children: postLink 26933 })] 26934 })] 26935 })] 26936 }); 26937 } 26938 26939 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/check.js 26940 /** 26941 * WordPress dependencies 26942 */ 26943 26944 26945 26946 /** 26947 * Internal dependencies 26948 */ 26949 26950 26951 /** 26952 * Check if the post URL is valid and visible. 26953 * 26954 * @param {Object} props The component props. 26955 * @param {React.ReactNode} props.children The child components. 26956 * 26957 * @return {React.ReactNode} The child components if the post URL is valid and visible, otherwise null. 26958 */ 26959 function PostURLCheck({ 26960 children 26961 }) { 26962 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 26963 const postTypeSlug = select(store_store).getCurrentPostType(); 26964 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 26965 if (!postType?.viewable) { 26966 return false; 26967 } 26968 const post = select(store_store).getCurrentPost(); 26969 if (!post.link) { 26970 return false; 26971 } 26972 const permalinkParts = select(store_store).getPermalinkParts(); 26973 if (!permalinkParts) { 26974 return false; 26975 } 26976 return true; 26977 }, []); 26978 if (!isVisible) { 26979 return null; 26980 } 26981 return children; 26982 } 26983 26984 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/label.js 26985 /** 26986 * WordPress dependencies 26987 */ 26988 26989 26990 26991 /** 26992 * Internal dependencies 26993 */ 26994 26995 26996 /** 26997 * Represents a label component for a post URL. 26998 * 26999 * @return {React.ReactNode} The PostURLLabel component. 27000 */ 27001 function PostURLLabel() { 27002 return usePostURLLabel(); 27003 } 27004 27005 /** 27006 * Custom hook to get the label for the post URL. 27007 * 27008 * @return {string} The filtered and decoded post URL label. 27009 */ 27010 function usePostURLLabel() { 27011 const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []); 27012 return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink)); 27013 } 27014 27015 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js 27016 /** 27017 * WordPress dependencies 27018 */ 27019 27020 27021 27022 27023 27024 27025 27026 /** 27027 * Internal dependencies 27028 */ 27029 27030 27031 27032 27033 27034 /** 27035 * Renders the `PostURLPanel` component. 27036 * 27037 * @return {React.ReactNode} The rendered PostURLPanel component. 27038 */ 27039 27040 function PostURLPanel() { 27041 const { 27042 isFrontPage 27043 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27044 const { 27045 getCurrentPostId 27046 } = select(store_store); 27047 const { 27048 getEditedEntityRecord, 27049 canUser 27050 } = select(external_wp_coreData_namespaceObject.store); 27051 const siteSettings = canUser('read', { 27052 kind: 'root', 27053 name: 'site' 27054 }) ? getEditedEntityRecord('root', 'site') : undefined; 27055 const _id = getCurrentPostId(); 27056 return { 27057 isFrontPage: siteSettings?.page_on_front === _id 27058 }; 27059 }, []); 27060 // Use internal state instead of a ref to make sure that the component 27061 // re-renders when the popover's anchor updates. 27062 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 27063 // Memoize popoverProps to avoid returning a new object every time. 27064 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 27065 // Anchor the popover to the middle of the entire row so that it doesn't 27066 // move around when the label changes. 27067 anchor: popoverAnchor, 27068 placement: 'left-start', 27069 offset: 36, 27070 shift: true 27071 }), [popoverAnchor]); 27072 const label = isFrontPage ? (0,external_wp_i18n_namespaceObject.__)('Link') : (0,external_wp_i18n_namespaceObject.__)('Slug'); 27073 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, { 27074 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_panel_row, { 27075 label: label, 27076 ref: setPopoverAnchor, 27077 children: [!isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 27078 popoverProps: popoverProps, 27079 className: "editor-post-url__panel-dropdown", 27080 contentClassName: "editor-post-url__panel-dialog", 27081 focusOnMount: true, 27082 renderToggle: ({ 27083 isOpen, 27084 onToggle 27085 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLToggle, { 27086 isOpen: isOpen, 27087 onClick: onToggle 27088 }), 27089 renderContent: ({ 27090 onClose 27091 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, { 27092 onClose: onClose 27093 }) 27094 }), isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FrontPageLink, {})] 27095 }) 27096 }); 27097 } 27098 function PostURLToggle({ 27099 isOpen, 27100 onClick 27101 }) { 27102 const { 27103 slug 27104 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27105 return { 27106 slug: select(store_store).getEditedPostSlug() 27107 }; 27108 }, []); 27109 const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug); 27110 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 27111 size: "compact", 27112 className: "editor-post-url__panel-toggle", 27113 variant: "tertiary", 27114 "aria-expanded": isOpen, 27115 "aria-label": 27116 // translators: %s: Current post link. 27117 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change link: %s'), decodedSlug), 27118 onClick: onClick, 27119 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27120 children: decodedSlug 27121 }) 27122 }); 27123 } 27124 function FrontPageLink() { 27125 const { 27126 postLink 27127 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27128 const { 27129 getCurrentPost 27130 } = select(store_store); 27131 return { 27132 postLink: getCurrentPost()?.link 27133 }; 27134 }, []); 27135 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 27136 className: "editor-post-url__front-page-link", 27137 href: postLink, 27138 target: "_blank", 27139 children: postLink 27140 }); 27141 } 27142 27143 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js 27144 /** 27145 * WordPress dependencies 27146 */ 27147 27148 27149 /** 27150 * Internal dependencies 27151 */ 27152 27153 27154 /** 27155 * Determines if the current post can be edited (published) 27156 * and passes this information to the provided render function. 27157 * 27158 * @param {Object} props The component props. 27159 * @param {Function} props.render Function to render the component. 27160 * Receives an object with a `canEdit` property. 27161 * @return {React.ReactNode} The rendered component. 27162 */ 27163 function PostVisibilityCheck({ 27164 render 27165 }) { 27166 const canEdit = (0,external_wp_data_namespaceObject.useSelect)(select => { 27167 var _select$getCurrentPos; 27168 return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; 27169 }); 27170 return render({ 27171 canEdit 27172 }); 27173 } 27174 27175 ;// ./node_modules/@wordpress/icons/build-module/library/info.js 27176 /** 27177 * WordPress dependencies 27178 */ 27179 27180 27181 const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27182 viewBox: "0 0 24 24", 27183 xmlns: "http://www.w3.org/2000/svg", 27184 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27185 fillRule: "evenodd", 27186 clipRule: "evenodd", 27187 d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" 27188 }) 27189 }); 27190 /* harmony default export */ const library_info = (info); 27191 27192 ;// external ["wp","wordcount"] 27193 const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; 27194 ;// ./node_modules/@wordpress/editor/build-module/components/word-count/index.js 27195 /** 27196 * WordPress dependencies 27197 */ 27198 27199 27200 27201 27202 /** 27203 * Internal dependencies 27204 */ 27205 27206 27207 /** 27208 * Renders the word count of the post content. 27209 * 27210 * @return {React.ReactNode} The rendered WordCount component. 27211 */ 27212 27213 function WordCount() { 27214 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 27215 27216 /* 27217 * translators: If your word count is based on single characters (e.g. East Asian characters), 27218 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 27219 * Do not translate into your own language. 27220 */ 27221 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 27222 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27223 className: "word-count", 27224 children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) 27225 }); 27226 } 27227 27228 ;// ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js 27229 /** 27230 * WordPress dependencies 27231 */ 27232 27233 27234 27235 27236 27237 /** 27238 * Internal dependencies 27239 */ 27240 27241 27242 /** 27243 * Average reading rate - based on average taken from 27244 * https://irisreading.com/average-reading-speed-in-various-languages/ 27245 * (Characters/minute used for Chinese rather than words). 27246 * 27247 * @type {number} A rough estimate of the average reading rate across multiple languages. 27248 */ 27249 27250 const AVERAGE_READING_RATE = 189; 27251 27252 /** 27253 * Component for showing Time To Read in Content. 27254 * 27255 * @return {React.ReactNode} The rendered TimeToRead component. 27256 */ 27257 function TimeToRead() { 27258 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 27259 27260 /* 27261 * translators: If your word count is based on single characters (e.g. East Asian characters), 27262 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 27263 * Do not translate into your own language. 27264 */ 27265 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 27266 const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE); 27267 const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), { 27268 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 27269 }) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the number of minutes to read the post. */ 27270 (0,external_wp_i18n_namespaceObject._n)('<span>%s</span> minute', '<span>%s</span> minutes', minutesToRead), minutesToRead), { 27271 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 27272 }); 27273 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27274 className: "time-to-read", 27275 children: minutesToReadString 27276 }); 27277 } 27278 27279 ;// ./node_modules/@wordpress/editor/build-module/components/character-count/index.js 27280 /** 27281 * WordPress dependencies 27282 */ 27283 27284 27285 27286 /** 27287 * Internal dependencies 27288 */ 27289 27290 27291 /** 27292 * Renders the character count of the post content. 27293 * 27294 * @return {number} The character count. 27295 */ 27296 function CharacterCount() { 27297 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 27298 return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces'); 27299 } 27300 27301 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js 27302 /** 27303 * WordPress dependencies 27304 */ 27305 27306 27307 27308 27309 /** 27310 * Internal dependencies 27311 */ 27312 27313 27314 27315 27316 27317 function TableOfContentsPanel({ 27318 hasOutlineItemsDisabled, 27319 onRequestClose 27320 }) { 27321 const { 27322 headingCount, 27323 paragraphCount, 27324 numberOfBlocks 27325 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27326 const { 27327 getGlobalBlockCount 27328 } = select(external_wp_blockEditor_namespaceObject.store); 27329 return { 27330 headingCount: getGlobalBlockCount('core/heading'), 27331 paragraphCount: getGlobalBlockCount('core/paragraph'), 27332 numberOfBlocks: getGlobalBlockCount() 27333 }; 27334 }, []); 27335 return ( 27336 /*#__PURE__*/ 27337 /* 27338 * Disable reason: The `list` ARIA role is redundant but 27339 * Safari+VoiceOver won't announce the list otherwise. 27340 */ 27341 /* eslint-disable jsx-a11y/no-redundant-roles */ 27342 (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27343 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 27344 className: "table-of-contents__wrapper", 27345 role: "note", 27346 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'), 27347 tabIndex: "0", 27348 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { 27349 role: "list", 27350 className: "table-of-contents__counts", 27351 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27352 className: "table-of-contents__count", 27353 children: [(0,external_wp_i18n_namespaceObject.__)('Words'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] 27354 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27355 className: "table-of-contents__count", 27356 children: [(0,external_wp_i18n_namespaceObject.__)('Characters'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27357 className: "table-of-contents__number", 27358 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) 27359 })] 27360 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27361 className: "table-of-contents__count", 27362 children: [(0,external_wp_i18n_namespaceObject.__)('Time to read'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] 27363 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27364 className: "table-of-contents__count", 27365 children: [(0,external_wp_i18n_namespaceObject.__)('Headings'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27366 className: "table-of-contents__number", 27367 children: headingCount 27368 })] 27369 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27370 className: "table-of-contents__count", 27371 children: [(0,external_wp_i18n_namespaceObject.__)('Paragraphs'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27372 className: "table-of-contents__number", 27373 children: paragraphCount 27374 })] 27375 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 27376 className: "table-of-contents__count", 27377 children: [(0,external_wp_i18n_namespaceObject.__)('Blocks'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 27378 className: "table-of-contents__number", 27379 children: numberOfBlocks 27380 })] 27381 })] 27382 }) 27383 }), headingCount > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27384 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 27385 className: "table-of-contents__title", 27386 children: (0,external_wp_i18n_namespaceObject.__)('Document Outline') 27387 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, { 27388 onSelect: onRequestClose, 27389 hasOutlineItemsDisabled: hasOutlineItemsDisabled 27390 })] 27391 })] 27392 }) 27393 /* eslint-enable jsx-a11y/no-redundant-roles */ 27394 ); 27395 } 27396 /* harmony default export */ const table_of_contents_panel = (TableOfContentsPanel); 27397 27398 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js 27399 /** 27400 * WordPress dependencies 27401 */ 27402 27403 27404 27405 27406 27407 27408 27409 /** 27410 * Internal dependencies 27411 */ 27412 27413 27414 function TableOfContents({ 27415 hasOutlineItemsDisabled, 27416 repositionDropdown, 27417 ...props 27418 }, ref) { 27419 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []); 27420 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 27421 popoverProps: { 27422 placement: repositionDropdown ? 'right' : 'bottom' 27423 }, 27424 className: "table-of-contents", 27425 contentClassName: "table-of-contents__popover", 27426 renderToggle: ({ 27427 isOpen, 27428 onToggle 27429 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 27430 __next40pxDefaultSize: true, 27431 ...props, 27432 ref: ref, 27433 onClick: hasBlocks ? onToggle : undefined, 27434 icon: library_info, 27435 "aria-expanded": isOpen, 27436 "aria-haspopup": "true" 27437 /* translators: button label text should, if possible, be under 16 characters. */, 27438 label: (0,external_wp_i18n_namespaceObject.__)('Details'), 27439 tooltipPosition: "bottom", 27440 "aria-disabled": !hasBlocks 27441 }), 27442 renderContent: ({ 27443 onClose 27444 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(table_of_contents_panel, { 27445 onRequestClose: onClose, 27446 hasOutlineItemsDisabled: hasOutlineItemsDisabled 27447 }) 27448 }); 27449 } 27450 27451 /** 27452 * Renders a table of contents component. 27453 * 27454 * @param {Object} props The component props. 27455 * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled. 27456 * @param {boolean} props.repositionDropdown Whether to reposition the dropdown. 27457 * @param {Element.ref} ref The component's ref. 27458 * 27459 * @return {React.ReactNode} The rendered table of contents component. 27460 */ 27461 /* harmony default export */ const table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents)); 27462 27463 ;// ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js 27464 /** 27465 * WordPress dependencies 27466 */ 27467 27468 27469 27470 27471 27472 /** 27473 * Warns the user if there are unsaved changes before leaving the editor. 27474 * Compatible with Post Editor and Site Editor. 27475 * 27476 * @return {React.ReactNode} The component. 27477 */ 27478 function UnsavedChangesWarning() { 27479 const { 27480 __experimentalGetDirtyEntityRecords 27481 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 27482 (0,external_wp_element_namespaceObject.useEffect)(() => { 27483 /** 27484 * Warns the user if there are unsaved changes before leaving the editor. 27485 * 27486 * @param {Event} event `beforeunload` event. 27487 * 27488 * @return {string | undefined} Warning prompt message, if unsaved changes exist. 27489 */ 27490 const warnIfUnsavedChanges = event => { 27491 // We need to call the selector directly in the listener to avoid race 27492 // conditions with `BrowserURL` where `componentDidUpdate` gets the 27493 // new value of `isEditedPostDirty` before this component does, 27494 // causing this component to incorrectly think a trashed post is still dirty. 27495 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 27496 if (dirtyEntityRecords.length > 0) { 27497 event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); 27498 return event.returnValue; 27499 } 27500 }; 27501 window.addEventListener('beforeunload', warnIfUnsavedChanges); 27502 return () => { 27503 window.removeEventListener('beforeunload', warnIfUnsavedChanges); 27504 }; 27505 }, [__experimentalGetDirtyEntityRecords]); 27506 return null; 27507 } 27508 27509 ;// external ["wp","serverSideRender"] 27510 const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; 27511 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); 27512 ;// ./node_modules/@wordpress/editor/build-module/components/deprecated.js 27513 /* wp:polyfill */ 27514 // Block Creation Components. 27515 /** 27516 * WordPress dependencies 27517 */ 27518 27519 27520 27521 27522 27523 function deprecateComponent(name, Wrapped, staticsToHoist = []) { 27524 const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 27525 external_wp_deprecated_default()('wp.editor.' + name, { 27526 since: '5.3', 27527 alternative: 'wp.blockEditor.' + name, 27528 version: '6.2' 27529 }); 27530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, { 27531 ref: ref, 27532 ...props 27533 }); 27534 }); 27535 staticsToHoist.forEach(staticName => { 27536 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); 27537 }); 27538 return Component; 27539 } 27540 function deprecateFunction(name, func) { 27541 return (...args) => { 27542 external_wp_deprecated_default()('wp.editor.' + name, { 27543 since: '5.3', 27544 alternative: 'wp.blockEditor.' + name, 27545 version: '6.2' 27546 }); 27547 return func(...args); 27548 }; 27549 } 27550 27551 /** 27552 * @deprecated since 5.3, use `wp.blockEditor.RichText` instead. 27553 */ 27554 const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']); 27555 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty); 27556 27557 27558 /** 27559 * @deprecated since 5.3, use `wp.blockEditor.Autocomplete` instead. 27560 */ 27561 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete); 27562 /** 27563 * @deprecated since 5.3, use `wp.blockEditor.AlignmentToolbar` instead. 27564 */ 27565 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar); 27566 /** 27567 * @deprecated since 5.3, use `wp.blockEditor.BlockAlignmentToolbar` instead. 27568 */ 27569 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar); 27570 /** 27571 * @deprecated since 5.3, use `wp.blockEditor.BlockControls` instead. 27572 */ 27573 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']); 27574 /** 27575 * @deprecated since 5.3, use `wp.blockEditor.BlockEdit` instead. 27576 */ 27577 const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit); 27578 /** 27579 * @deprecated since 5.3, use `wp.blockEditor.BlockEditorKeyboardShortcuts` instead. 27580 */ 27581 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts); 27582 /** 27583 * @deprecated since 5.3, use `wp.blockEditor.BlockFormatControls` instead. 27584 */ 27585 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']); 27586 /** 27587 * @deprecated since 5.3, use `wp.blockEditor.BlockIcon` instead. 27588 */ 27589 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon); 27590 /** 27591 * @deprecated since 5.3, use `wp.blockEditor.BlockInspector` instead. 27592 */ 27593 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector); 27594 /** 27595 * @deprecated since 5.3, use `wp.blockEditor.BlockList` instead. 27596 */ 27597 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList); 27598 /** 27599 * @deprecated since 5.3, use `wp.blockEditor.BlockMover` instead. 27600 */ 27601 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover); 27602 /** 27603 * @deprecated since 5.3, use `wp.blockEditor.BlockNavigationDropdown` instead. 27604 */ 27605 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown); 27606 /** 27607 * @deprecated since 5.3, use `wp.blockEditor.BlockSelectionClearer` instead. 27608 */ 27609 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer); 27610 /** 27611 * @deprecated since 5.3, use `wp.blockEditor.BlockSettingsMenu` instead. 27612 */ 27613 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu); 27614 /** 27615 * @deprecated since 5.3, use `wp.blockEditor.BlockTitle` instead. 27616 */ 27617 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle); 27618 /** 27619 * @deprecated since 5.3, use `wp.blockEditor.BlockToolbar` instead. 27620 */ 27621 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar); 27622 /** 27623 * @deprecated since 5.3, use `wp.blockEditor.ColorPalette` instead. 27624 */ 27625 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette); 27626 /** 27627 * @deprecated since 5.3, use `wp.blockEditor.ContrastChecker` instead. 27628 */ 27629 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker); 27630 /** 27631 * @deprecated since 5.3, use `wp.blockEditor.CopyHandler` instead. 27632 */ 27633 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler); 27634 /** 27635 * @deprecated since 5.3, use `wp.blockEditor.DefaultBlockAppender` instead. 27636 */ 27637 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender); 27638 /** 27639 * @deprecated since 5.3, use `wp.blockEditor.FontSizePicker` instead. 27640 */ 27641 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker); 27642 /** 27643 * @deprecated since 5.3, use `wp.blockEditor.Inserter` instead. 27644 */ 27645 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter); 27646 /** 27647 * @deprecated since 5.3, use `wp.blockEditor.InnerBlocks` instead. 27648 */ 27649 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); 27650 /** 27651 * @deprecated since 5.3, use `wp.blockEditor.InspectorAdvancedControls` instead. 27652 */ 27653 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']); 27654 /** 27655 * @deprecated since 5.3, use `wp.blockEditor.InspectorControls` instead. 27656 */ 27657 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']); 27658 /** 27659 * @deprecated since 5.3, use `wp.blockEditor.PanelColorSettings` instead. 27660 */ 27661 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings); 27662 /** 27663 * @deprecated since 5.3, use `wp.blockEditor.PlainText` instead. 27664 */ 27665 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText); 27666 /** 27667 * @deprecated since 5.3, use `wp.blockEditor.RichTextShortcut` instead. 27668 */ 27669 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut); 27670 /** 27671 * @deprecated since 5.3, use `wp.blockEditor.RichTextToolbarButton` instead. 27672 */ 27673 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton); 27674 /** 27675 * @deprecated since 5.3, use `wp.blockEditor.__unstableRichTextInputEvent` instead. 27676 */ 27677 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent); 27678 /** 27679 * @deprecated since 5.3, use `wp.blockEditor.MediaPlaceholder` instead. 27680 */ 27681 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder); 27682 /** 27683 * @deprecated since 5.3, use `wp.blockEditor.MediaUpload` instead. 27684 */ 27685 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload); 27686 /** 27687 * @deprecated since 5.3, use `wp.blockEditor.MediaUploadCheck` instead. 27688 */ 27689 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck); 27690 /** 27691 * @deprecated since 5.3, use `wp.blockEditor.MultiSelectScrollIntoView` instead. 27692 */ 27693 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView); 27694 /** 27695 * @deprecated since 5.3, use `wp.blockEditor.NavigableToolbar` instead. 27696 */ 27697 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar); 27698 /** 27699 * @deprecated since 5.3, use `wp.blockEditor.ObserveTyping` instead. 27700 */ 27701 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping); 27702 /** 27703 * @deprecated since 5.3, use `wp.blockEditor.SkipToSelectedBlock` instead. 27704 */ 27705 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock); 27706 /** 27707 * @deprecated since 5.3, use `wp.blockEditor.URLInput` instead. 27708 */ 27709 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput); 27710 /** 27711 * @deprecated since 5.3, use `wp.blockEditor.URLInputButton` instead. 27712 */ 27713 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton); 27714 /** 27715 * @deprecated since 5.3, use `wp.blockEditor.URLPopover` instead. 27716 */ 27717 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover); 27718 /** 27719 * @deprecated since 5.3, use `wp.blockEditor.Warning` instead. 27720 */ 27721 const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning); 27722 /** 27723 * @deprecated since 5.3, use `wp.blockEditor.WritingFlow` instead. 27724 */ 27725 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow); 27726 27727 /** 27728 * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. 27729 */ 27730 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC); 27731 /** 27732 * @deprecated since 5.3, use `wp.blockEditor.getColorClassName` instead. 27733 */ 27734 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName); 27735 /** 27736 * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByAttributeValues` instead. 27737 */ 27738 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues); 27739 /** 27740 * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByColorValue` instead. 27741 */ 27742 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue); 27743 /** 27744 * @deprecated since 5.3, use `wp.blockEditor.getFontSize` instead. 27745 */ 27746 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize); 27747 /** 27748 * @deprecated since 5.3, use `wp.blockEditor.getFontSizeClass` instead. 27749 */ 27750 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass); 27751 /** 27752 * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. 27753 */ 27754 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext); 27755 /** 27756 * @deprecated since 5.3, use `wp.blockEditor.withColors` instead. 27757 */ 27758 const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors); 27759 /** 27760 * @deprecated since 5.3, use `wp.blockEditor.withFontSizes` instead. 27761 */ 27762 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes); 27763 27764 ;// ./node_modules/@wordpress/editor/build-module/components/index.js 27765 /** 27766 * Internal dependencies 27767 */ 27768 27769 27770 // Block Creation Components. 27771 27772 27773 // Post Related Components. 27774 27775 27776 27777 27778 27779 27780 27781 27782 27783 27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 27847 27848 27849 27850 27851 27852 27853 27854 27855 27856 27857 27858 27859 27860 27861 // State Related Components. 27862 27863 27864 27865 /** 27866 * Handles the keyboard shortcuts for the editor. 27867 * 27868 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 27869 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 27870 * and toggling the sidebar. 27871 */ 27872 const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 27873 27874 /** 27875 * Handles the keyboard shortcuts for the editor. 27876 * 27877 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 27878 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 27879 * and toggling the sidebar. 27880 */ 27881 const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 27882 27883 ;// ./node_modules/@wordpress/editor/build-module/utils/url.js 27884 /** 27885 * WordPress dependencies 27886 */ 27887 27888 27889 27890 /** 27891 * Performs some basic cleanup of a string for use as a post slug 27892 * 27893 * This replicates some of what sanitize_title() does in WordPress core, but 27894 * is only designed to approximate what the slug will be. 27895 * 27896 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. 27897 * Removes combining diacritical marks. Converts whitespace, periods, 27898 * and forward slashes to hyphens. Removes any remaining non-word characters 27899 * except hyphens and underscores. Converts remaining string to lowercase. 27900 * It does not account for octets, HTML entities, or other encoded characters. 27901 * 27902 * @param {string} string Title or slug to be processed 27903 * 27904 * @return {string} Processed string 27905 */ 27906 function cleanForSlug(string) { 27907 external_wp_deprecated_default()('wp.editor.cleanForSlug', { 27908 since: '12.7', 27909 plugin: 'Gutenberg', 27910 alternative: 'wp.url.cleanForSlug' 27911 }); 27912 return (0,external_wp_url_namespaceObject.cleanForSlug)(string); 27913 } 27914 27915 ;// ./node_modules/@wordpress/editor/build-module/utils/index.js 27916 /** 27917 * Internal dependencies 27918 */ 27919 27920 27921 27922 27923 27924 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js 27925 /** 27926 * WordPress dependencies 27927 */ 27928 27929 const EditorContentSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol('EditCanvasContainerSlot')); 27930 /* harmony default export */ const content_slot_fill = (EditorContentSlotFill); 27931 27932 ;// ./node_modules/@wordpress/editor/build-module/components/header/back-button.js 27933 /** 27934 * WordPress dependencies 27935 */ 27936 27937 27938 // Keeping an old name for backward compatibility. 27939 27940 const slotName = '__experimentalMainDashboardButton'; 27941 const useHasBackButton = () => { 27942 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 27943 return Boolean(fills && fills.length); 27944 }; 27945 const { 27946 Fill: back_button_Fill, 27947 Slot: back_button_Slot 27948 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); 27949 const BackButton = back_button_Fill; 27950 const BackButtonSlot = () => { 27951 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 27952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_Slot, { 27953 bubblesVirtually: true, 27954 fillProps: { 27955 length: !fills ? 0 : fills.length 27956 } 27957 }); 27958 }; 27959 BackButton.Slot = BackButtonSlot; 27960 /* harmony default export */ const back_button = (BackButton); 27961 27962 ;// ./node_modules/@wordpress/icons/build-module/library/comment.js 27963 /** 27964 * WordPress dependencies 27965 */ 27966 27967 27968 const comment = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27969 viewBox: "0 0 24 24", 27970 xmlns: "http://www.w3.org/2000/svg", 27971 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27972 d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" 27973 }) 27974 }); 27975 /* harmony default export */ const library_comment = (comment); 27976 27977 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/constants.js 27978 const collabHistorySidebarName = 'edit-post/collab-history-sidebar'; 27979 const collabSidebarName = 'edit-post/collab-sidebar'; 27980 27981 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 27982 /** 27983 * WordPress dependencies 27984 */ 27985 27986 27987 const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 27988 xmlns: "http://www.w3.org/2000/svg", 27989 viewBox: "0 0 24 24", 27990 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 27991 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 27992 }) 27993 }); 27994 /* harmony default export */ const more_vertical = (moreVertical); 27995 27996 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-author-info.js 27997 /** 27998 * WordPress dependencies 27999 */ 28000 28001 28002 28003 28004 28005 28006 28007 /** 28008 * Render author information for a comment. 28009 * 28010 * @param {Object} props - Component properties. 28011 * @param {string} props.avatar - URL of the author's avatar. 28012 * @param {string} props.name - Name of the author. 28013 * @param {string} props.date - Date of the comment. 28014 * 28015 * @return {React.ReactNode} The JSX element representing the author's information. 28016 */ 28017 28018 function CommentAuthorInfo({ 28019 avatar, 28020 name, 28021 date 28022 }) { 28023 const dateSettings = (0,external_wp_date_namespaceObject.getSettings)(); 28024 const [dateTimeFormat = dateSettings.formats.time] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'time_format'); 28025 const { 28026 currentUserAvatar, 28027 currentUserName 28028 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28029 var _userData$avatar_urls; 28030 const userData = select(external_wp_coreData_namespaceObject.store).getCurrentUser(); 28031 const { 28032 getSettings 28033 } = select(external_wp_blockEditor_namespaceObject.store); 28034 const { 28035 __experimentalDiscussionSettings 28036 } = getSettings(); 28037 const defaultAvatar = __experimentalDiscussionSettings?.avatarURL; 28038 return { 28039 currentUserAvatar: (_userData$avatar_urls = userData?.avatar_urls[48]) !== null && _userData$avatar_urls !== void 0 ? _userData$avatar_urls : defaultAvatar, 28040 currentUserName: userData?.name 28041 }; 28042 }, []); 28043 const currentDate = new Date(); 28044 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28045 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 28046 src: avatar !== null && avatar !== void 0 ? avatar : currentUserAvatar, 28047 className: "editor-collab-sidebar-panel__user-avatar" 28048 // translators: alt text for user avatar image 28049 , 28050 alt: (0,external_wp_i18n_namespaceObject.__)('User avatar'), 28051 width: 32, 28052 height: 32 28053 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28054 spacing: "0", 28055 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 28056 className: "editor-collab-sidebar-panel__user-name", 28057 children: name !== null && name !== void 0 ? name : currentUserName 28058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { 28059 dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date !== null && date !== void 0 ? date : currentDate), 28060 className: "editor-collab-sidebar-panel__user-time", 28061 children: (0,external_wp_date_namespaceObject.dateI18n)(dateTimeFormat, date !== null && date !== void 0 ? date : currentDate) 28062 })] 28063 })] 28064 }); 28065 } 28066 /* harmony default export */ const comment_author_info = (CommentAuthorInfo); 28067 28068 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/utils.js 28069 /* wp:polyfill */ 28070 /** 28071 * Sanitizes a comment string by removing non-printable ASCII characters. 28072 * 28073 * @param {string} str - The comment string to sanitize. 28074 * @return {string} - The sanitized comment string. 28075 */ 28076 function sanitizeCommentString(str) { 28077 return str.trim(); 28078 } 28079 28080 /** 28081 * Extracts comment IDs from an array of blocks. 28082 * 28083 * This function recursively traverses the blocks and their inner blocks to 28084 * collect all comment IDs found in the block attributes. 28085 * 28086 * @param {Array} blocks - The array of blocks to extract comment IDs from. 28087 * @return {Array} An array of comment IDs extracted from the blocks. 28088 */ 28089 function getCommentIdsFromBlocks(blocks) { 28090 // Recursive function to extract comment IDs from blocks 28091 const extractCommentIds = items => { 28092 return items.reduce((commentIds, block) => { 28093 // Check for comment IDs in the current block's attributes 28094 if (block.attributes && block.attributes.blockCommentId && !commentIds.includes(block.attributes.blockCommentId)) { 28095 commentIds.push(block.attributes.blockCommentId); 28096 } 28097 28098 // Recursively check inner blocks 28099 if (block.innerBlocks && block.innerBlocks.length > 0) { 28100 const innerCommentIds = extractCommentIds(block.innerBlocks); 28101 commentIds.push(...innerCommentIds); 28102 } 28103 return commentIds; 28104 }, []); 28105 }; 28106 28107 // Extract all comment IDs recursively 28108 return extractCommentIds(blocks); 28109 } 28110 28111 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-form.js 28112 /** 28113 * WordPress dependencies 28114 */ 28115 28116 28117 28118 28119 /** 28120 * Internal dependencies 28121 */ 28122 28123 28124 /** 28125 * EditComment component. 28126 * 28127 * @param {Object} props - The component props. 28128 * @param {Function} props.onSubmit - The function to call when updating the comment. 28129 * @param {Function} props.onCancel - The function to call when canceling the comment update. 28130 * @param {Object} props.thread - The comment thread object. 28131 * @param {string} props.submitButtonText - The text to display on the submit button. 28132 * @return {React.ReactNode} The CommentForm component. 28133 */ 28134 28135 function CommentForm({ 28136 onSubmit, 28137 onCancel, 28138 thread, 28139 submitButtonText 28140 }) { 28141 var _thread$content$raw; 28142 const [inputComment, setInputComment] = (0,external_wp_element_namespaceObject.useState)((_thread$content$raw = thread?.content?.raw) !== null && _thread$content$raw !== void 0 ? _thread$content$raw : ''); 28143 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28144 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 28145 __next40pxDefaultSize: true, 28146 __nextHasNoMarginBottom: true, 28147 value: inputComment !== null && inputComment !== void 0 ? inputComment : '', 28148 onChange: setInputComment 28149 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 28150 alignment: "left", 28151 spacing: "3", 28152 justify: "flex-start", 28153 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28154 __next40pxDefaultSize: true, 28155 accessibleWhenDisabled: true, 28156 variant: "primary", 28157 onClick: () => { 28158 onSubmit(inputComment); 28159 setInputComment(''); 28160 }, 28161 disabled: 0 === sanitizeCommentString(inputComment).length, 28162 text: submitButtonText 28163 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28164 __next40pxDefaultSize: true, 28165 variant: "tertiary", 28166 onClick: onCancel, 28167 text: (0,external_wp_i18n_namespaceObject._x)('Cancel', 'Cancel comment button') 28168 })] 28169 })] 28170 }); 28171 } 28172 /* harmony default export */ const comment_form = (CommentForm); 28173 28174 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comments.js 28175 /* wp:polyfill */ 28176 /** 28177 * External dependencies 28178 */ 28179 28180 28181 /** 28182 * WordPress dependencies 28183 */ 28184 28185 28186 28187 28188 28189 28190 28191 /** 28192 * Internal dependencies 28193 */ 28194 28195 28196 28197 /** 28198 * Renders the Comments component. 28199 * 28200 * @param {Object} props - The component props. 28201 * @param {Array} props.threads - The array of comment threads. 28202 * @param {Function} props.onEditComment - The function to handle comment editing. 28203 * @param {Function} props.onAddReply - The function to add a reply to a comment. 28204 * @param {Function} props.onCommentDelete - The function to delete a comment. 28205 * @param {Function} props.onCommentResolve - The function to mark a comment as resolved. 28206 * @param {boolean} props.showCommentBoard - Whether to show the comment board. 28207 * @param {Function} props.setShowCommentBoard - The function to set the comment board visibility. 28208 * @return {React.ReactNode} The rendered Comments component. 28209 */ 28210 28211 function Comments({ 28212 threads, 28213 onEditComment, 28214 onAddReply, 28215 onCommentDelete, 28216 onCommentResolve, 28217 showCommentBoard, 28218 setShowCommentBoard 28219 }) { 28220 const { 28221 blockCommentId 28222 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28223 const { 28224 getBlockAttributes, 28225 getSelectedBlockClientId 28226 } = select(external_wp_blockEditor_namespaceObject.store); 28227 const _clientId = getSelectedBlockClientId(); 28228 return { 28229 blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null 28230 }; 28231 }, []); 28232 const [focusThread, setFocusThread] = (0,external_wp_element_namespaceObject.useState)(showCommentBoard && blockCommentId ? blockCommentId : null); 28233 const clearThreadFocus = () => { 28234 setFocusThread(null); 28235 setShowCommentBoard(false); 28236 }; 28237 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28238 children: [ 28239 // If there are no comments, show a message indicating no comments are available. 28240 (!Array.isArray(threads) || threads.length === 0) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 28241 alignment: "left", 28242 className: "editor-collab-sidebar-panel__thread", 28243 justify: "flex-start", 28244 spacing: "3", 28245 children: 28246 // translators: message displayed when there are no comments available 28247 (0,external_wp_i18n_namespaceObject.__)('No comments available') 28248 }), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 28249 className: dist_clsx('editor-collab-sidebar-panel__thread', { 28250 'editor-collab-sidebar-panel__active-thread': blockCommentId && blockCommentId === thread.id, 28251 'editor-collab-sidebar-panel__focus-thread': focusThread && focusThread === thread.id 28252 }), 28253 id: thread.id, 28254 spacing: "3", 28255 onClick: () => setFocusThread(thread.id), 28256 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Thread, { 28257 thread: thread, 28258 onAddReply: onAddReply, 28259 onCommentDelete: onCommentDelete, 28260 onCommentResolve: onCommentResolve, 28261 onEditComment: onEditComment, 28262 isFocused: focusThread === thread.id, 28263 clearThreadFocus: clearThreadFocus 28264 }) 28265 }, thread.id))] 28266 }); 28267 } 28268 function Thread({ 28269 thread, 28270 onEditComment, 28271 onAddReply, 28272 onCommentDelete, 28273 onCommentResolve, 28274 isFocused, 28275 clearThreadFocus 28276 }) { 28277 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28278 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { 28279 thread: thread, 28280 onResolve: onCommentResolve, 28281 onEdit: onEditComment, 28282 onDelete: onCommentDelete, 28283 status: thread.status 28284 }), 0 < thread?.reply?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28285 children: [!isFocused && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 28286 className: "editor-collab-sidebar-panel__show-more-reply", 28287 children: (0,external_wp_i18n_namespaceObject.sprintf)( 28288 // translators: 1: number of replies. 28289 (0,external_wp_i18n_namespaceObject._x)('%s more replies..', 'Show replies button'), thread?.reply?.length) 28290 }), isFocused && thread.reply.map(reply => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28291 className: "editor-collab-sidebar-panel__child-thread", 28292 id: reply.id, 28293 spacing: "2", 28294 children: ['approved' !== thread.status && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { 28295 thread: reply, 28296 onEdit: onEditComment, 28297 onDelete: onCommentDelete 28298 }), 'approved' === thread.status && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentBoard, { 28299 thread: reply 28300 })] 28301 }, reply.id))] 28302 }), 'approved' !== thread.status && isFocused && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28303 className: "editor-collab-sidebar-panel__child-thread", 28304 spacing: "2", 28305 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 28306 alignment: "left", 28307 spacing: "3", 28308 justify: "flex-start", 28309 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, {}) 28310 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 28311 spacing: "3", 28312 className: "editor-collab-sidebar-panel__comment-field", 28313 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { 28314 onSubmit: inputComment => { 28315 onAddReply(inputComment, thread.id); 28316 }, 28317 onCancel: event => { 28318 event.stopPropagation(); // Prevent the parent onClick from being triggered 28319 clearThreadFocus(); 28320 }, 28321 submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Reply', 'Add reply comment') 28322 }) 28323 })] 28324 })] 28325 }); 28326 } 28327 const CommentBoard = ({ 28328 thread, 28329 onResolve, 28330 onEdit, 28331 onDelete, 28332 status 28333 }) => { 28334 const [actionState, setActionState] = (0,external_wp_element_namespaceObject.useState)(false); 28335 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 28336 const handleConfirmDelete = () => { 28337 onDelete(thread.id); 28338 setActionState(false); 28339 setShowConfirmDialog(false); 28340 }; 28341 const handleConfirmResolve = () => { 28342 onResolve(thread.id); 28343 setActionState(false); 28344 setShowConfirmDialog(false); 28345 }; 28346 const handleCancel = () => { 28347 setActionState(false); 28348 setShowConfirmDialog(false); 28349 }; 28350 const actions = [onEdit && { 28351 title: (0,external_wp_i18n_namespaceObject._x)('Edit', 'Edit comment'), 28352 onClick: () => { 28353 setActionState('edit'); 28354 } 28355 }, onDelete && { 28356 title: (0,external_wp_i18n_namespaceObject._x)('Delete', 'Delete comment'), 28357 onClick: () => { 28358 setActionState('delete'); 28359 setShowConfirmDialog(true); 28360 } 28361 }]; 28362 const moreActions = actions.filter(item => item?.onClick); 28363 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28364 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 28365 alignment: "left", 28366 spacing: "3", 28367 justify: "flex-start", 28368 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, { 28369 avatar: thread?.author_avatar_urls?.[48], 28370 name: thread?.author_name, 28371 date: thread?.date 28372 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { 28373 className: "editor-collab-sidebar-panel__comment-status", 28374 children: [status !== 'approved' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 28375 alignment: "right", 28376 justify: "flex-end", 28377 spacing: "0", 28378 children: [0 === thread?.parent && onResolve && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28379 label: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'Mark comment as resolved'), 28380 __next40pxDefaultSize: true, 28381 icon: library_published, 28382 onClick: () => { 28383 setActionState('resolve'); 28384 setShowConfirmDialog(true); 28385 }, 28386 showTooltip: true 28387 }), 0 < moreActions.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 28388 icon: more_vertical, 28389 label: (0,external_wp_i18n_namespaceObject._x)('Select an action', 'Select comment action'), 28390 className: "editor-collab-sidebar-panel__comment-dropdown-menu", 28391 controls: moreActions 28392 })] 28393 }), status === 'approved' && 28394 /*#__PURE__*/ 28395 // translators: tooltip for resolved comment 28396 (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 28397 text: (0,external_wp_i18n_namespaceObject.__)('Resolved'), 28398 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { 28399 icon: library_check 28400 }) 28401 })] 28402 })] 28403 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 28404 alignment: "left", 28405 spacing: "3", 28406 justify: "flex-start", 28407 className: "editor-collab-sidebar-panel__user-comment", 28408 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28409 spacing: "3", 28410 className: "editor-collab-sidebar-panel__comment-field", 28411 children: ['edit' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { 28412 onSubmit: value => { 28413 onEdit(thread.id, value); 28414 setActionState(false); 28415 }, 28416 onCancel: () => handleCancel(), 28417 thread: thread, 28418 submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Update', 'verb') 28419 }), 'edit' !== actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { 28420 children: thread?.content?.raw 28421 })] 28422 }) 28423 }), 'resolve' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 28424 isOpen: showConfirmDialog, 28425 onConfirm: handleConfirmResolve, 28426 onCancel: handleCancel, 28427 confirmButtonText: "Yes", 28428 cancelButtonText: "No", 28429 children: 28430 // translators: message displayed when confirming an action 28431 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to mark this comment as resolved?') 28432 }), 'delete' === actionState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 28433 isOpen: showConfirmDialog, 28434 onConfirm: handleConfirmDelete, 28435 onCancel: handleCancel, 28436 confirmButtonText: "Yes", 28437 cancelButtonText: "No", 28438 children: 28439 // translators: message displayed when confirming an action 28440 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this comment?') 28441 })] 28442 }); 28443 }; 28444 28445 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/add-comment.js 28446 /** 28447 * WordPress dependencies 28448 */ 28449 28450 28451 28452 28453 28454 /** 28455 * Internal dependencies 28456 */ 28457 28458 28459 28460 /** 28461 * Renders the UI for adding a comment in the Gutenberg editor's collaboration sidebar. 28462 * 28463 * @param {Object} props - The component props. 28464 * @param {Function} props.onSubmit - A callback function to be called when the user submits a comment. 28465 * @param {boolean} props.showCommentBoard - The function to edit the comment. 28466 * @param {Function} props.setShowCommentBoard - The function to delete the comment. 28467 * @return {React.ReactNode} The rendered comment input UI. 28468 */ 28469 28470 function AddComment({ 28471 onSubmit, 28472 showCommentBoard, 28473 setShowCommentBoard 28474 }) { 28475 const { 28476 clientId, 28477 blockCommentId 28478 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28479 const { 28480 getSelectedBlock 28481 } = select(external_wp_blockEditor_namespaceObject.store); 28482 const selectedBlock = getSelectedBlock(); 28483 return { 28484 clientId: selectedBlock?.clientId, 28485 blockCommentId: selectedBlock?.attributes?.blockCommentId 28486 }; 28487 }); 28488 if (!showCommentBoard || !clientId || undefined !== blockCommentId) { 28489 return null; 28490 } 28491 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28492 spacing: "3", 28493 className: "editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread editor-collab-sidebar-panel__focus-thread", 28494 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 28495 alignment: "left", 28496 spacing: "3", 28497 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info, {}) 28498 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_form, { 28499 onSubmit: inputComment => { 28500 onSubmit(inputComment); 28501 }, 28502 onCancel: () => { 28503 setShowCommentBoard(false); 28504 }, 28505 submitButtonText: (0,external_wp_i18n_namespaceObject._x)('Comment', 'Add comment button') 28506 })] 28507 }); 28508 } 28509 28510 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-button.js 28511 /** 28512 * WordPress dependencies 28513 */ 28514 28515 28516 28517 28518 28519 /** 28520 * Internal dependencies 28521 */ 28522 28523 28524 const { 28525 CommentIconSlotFill 28526 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 28527 const AddCommentButton = ({ 28528 onClick 28529 }) => { 28530 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconSlotFill.Fill, { 28531 children: ({ 28532 onClose 28533 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 28534 icon: library_comment, 28535 onClick: () => { 28536 onClick(); 28537 onClose(); 28538 }, 28539 "aria-haspopup": "dialog", 28540 children: (0,external_wp_i18n_namespaceObject._x)('Comment', 'Add comment button') 28541 }) 28542 }); 28543 }; 28544 /* harmony default export */ const comment_button = (AddCommentButton); 28545 28546 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-button-toolbar.js 28547 /** 28548 * WordPress dependencies 28549 */ 28550 28551 28552 28553 28554 28555 /** 28556 * Internal dependencies 28557 */ 28558 28559 28560 const { 28561 CommentIconToolbarSlotFill 28562 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 28563 const AddCommentToolbarButton = ({ 28564 onClick 28565 }) => { 28566 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconToolbarSlotFill.Fill, { 28567 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { 28568 accessibleWhenDisabled: true, 28569 icon: library_comment, 28570 label: (0,external_wp_i18n_namespaceObject._x)('Comment', 'View comment'), 28571 onClick: onClick 28572 }) 28573 }); 28574 }; 28575 /* harmony default export */ const comment_button_toolbar = (AddCommentToolbarButton); 28576 28577 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/index.js 28578 /* wp:polyfill */ 28579 /** 28580 * WordPress dependencies 28581 */ 28582 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 /** 28593 * Internal dependencies 28594 */ 28595 28596 28597 28598 28599 28600 28601 28602 28603 28604 28605 const modifyBlockCommentAttributes = settings => { 28606 if (!settings.attributes.blockCommentId) { 28607 settings.attributes = { 28608 ...settings.attributes, 28609 blockCommentId: { 28610 type: 'number' 28611 } 28612 }; 28613 } 28614 return settings; 28615 }; 28616 28617 // Apply the filter to all core blocks 28618 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-comment/modify-core-block-attributes', modifyBlockCommentAttributes); 28619 function CollabSidebarContent({ 28620 showCommentBoard, 28621 setShowCommentBoard, 28622 styles, 28623 comments 28624 }) { 28625 const { 28626 createNotice 28627 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 28628 const { 28629 saveEntityRecord, 28630 deleteEntityRecord 28631 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28632 const { 28633 getEntityRecord 28634 } = (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store); 28635 const { 28636 postId 28637 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28638 const { 28639 getCurrentPostId 28640 } = select(store_store); 28641 const _postId = getCurrentPostId(); 28642 return { 28643 postId: _postId 28644 }; 28645 }, []); 28646 const { 28647 getSelectedBlockClientId 28648 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 28649 const { 28650 updateBlockAttributes 28651 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 28652 28653 // Function to save the comment. 28654 const addNewComment = async (comment, parentCommentId) => { 28655 const args = { 28656 post: postId, 28657 content: comment, 28658 comment_type: 'block_comment', 28659 comment_approved: 0 28660 }; 28661 28662 // Create a new object, conditionally including the parent property 28663 const updatedArgs = { 28664 ...args, 28665 ...(parentCommentId ? { 28666 parent: parentCommentId 28667 } : {}) 28668 }; 28669 const savedRecord = await saveEntityRecord('root', 'comment', updatedArgs); 28670 if (savedRecord) { 28671 // If it's a main comment, update the block attributes with the comment id. 28672 if (!parentCommentId) { 28673 updateBlockAttributes(getSelectedBlockClientId(), { 28674 blockCommentId: savedRecord?.id 28675 }); 28676 } 28677 createNotice('snackbar', parentCommentId ? 28678 // translators: Reply added successfully 28679 (0,external_wp_i18n_namespaceObject.__)('Reply added successfully.') : 28680 // translators: Comment added successfully 28681 (0,external_wp_i18n_namespaceObject.__)('Comment added successfully.'), { 28682 type: 'snackbar', 28683 isDismissible: true 28684 }); 28685 } else { 28686 onError(); 28687 } 28688 }; 28689 const onCommentResolve = async commentId => { 28690 const savedRecord = await saveEntityRecord('root', 'comment', { 28691 id: commentId, 28692 status: 'approved' 28693 }); 28694 if (savedRecord) { 28695 // translators: Comment resolved successfully 28696 createNotice('snackbar', (0,external_wp_i18n_namespaceObject.__)('Comment marked as resolved.'), { 28697 type: 'snackbar', 28698 isDismissible: true 28699 }); 28700 } else { 28701 onError(); 28702 } 28703 }; 28704 const onEditComment = async (commentId, comment) => { 28705 const savedRecord = await saveEntityRecord('root', 'comment', { 28706 id: commentId, 28707 content: comment 28708 }); 28709 if (savedRecord) { 28710 createNotice('snackbar', 28711 // translators: Comment edited successfully 28712 (0,external_wp_i18n_namespaceObject.__)('Comment edited successfully.'), { 28713 type: 'snackbar', 28714 isDismissible: true 28715 }); 28716 } else { 28717 onError(); 28718 } 28719 }; 28720 const onError = () => { 28721 createNotice('error', 28722 // translators: Error message when comment submission fails 28723 (0,external_wp_i18n_namespaceObject.__)('Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'), { 28724 isDismissible: true 28725 }); 28726 }; 28727 const onCommentDelete = async commentId => { 28728 const childComment = await getEntityRecord('root', 'comment', commentId); 28729 await deleteEntityRecord('root', 'comment', commentId); 28730 if (childComment && !childComment.parent) { 28731 updateBlockAttributes(getSelectedBlockClientId(), { 28732 blockCommentId: undefined 28733 }); 28734 } 28735 createNotice('snackbar', 28736 // translators: Comment deleted successfully 28737 (0,external_wp_i18n_namespaceObject.__)('Comment deleted successfully.'), { 28738 type: 'snackbar', 28739 isDismissible: true 28740 }); 28741 }; 28742 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 28743 className: "editor-collab-sidebar-panel", 28744 style: styles, 28745 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddComment, { 28746 onSubmit: addNewComment, 28747 showCommentBoard: showCommentBoard, 28748 setShowCommentBoard: setShowCommentBoard 28749 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Comments, { 28750 threads: comments, 28751 onEditComment: onEditComment, 28752 onAddReply: addNewComment, 28753 onCommentDelete: onCommentDelete, 28754 onCommentResolve: onCommentResolve, 28755 showCommentBoard: showCommentBoard, 28756 setShowCommentBoard: setShowCommentBoard 28757 }, getSelectedBlockClientId())] 28758 }); 28759 } 28760 28761 /** 28762 * Renders the Collab sidebar. 28763 */ 28764 function CollabSidebar() { 28765 const [showCommentBoard, setShowCommentBoard] = (0,external_wp_element_namespaceObject.useState)(false); 28766 const { 28767 enableComplementaryArea 28768 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 28769 const { 28770 getActiveComplementaryArea 28771 } = (0,external_wp_data_namespaceObject.useSelect)(store); 28772 const { 28773 postId, 28774 postType, 28775 postStatus, 28776 threads 28777 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28778 const { 28779 getCurrentPostId, 28780 getCurrentPostType 28781 } = select(store_store); 28782 const _postId = getCurrentPostId(); 28783 const data = !!_postId && typeof _postId === 'number' ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'comment', { 28784 post: _postId, 28785 type: 'block_comment', 28786 status: 'any', 28787 per_page: 100 28788 }) : null; 28789 return { 28790 postId: _postId, 28791 postType: getCurrentPostType(), 28792 postStatus: select(store_store).getEditedPostAttribute('status'), 28793 threads: data 28794 }; 28795 }, []); 28796 const { 28797 blockCommentId 28798 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28799 const { 28800 getBlockAttributes, 28801 getSelectedBlockClientId 28802 } = select(external_wp_blockEditor_namespaceObject.store); 28803 const _clientId = getSelectedBlockClientId(); 28804 return { 28805 blockCommentId: _clientId ? getBlockAttributes(_clientId)?.blockCommentId : null 28806 }; 28807 }, []); 28808 const openCollabBoard = () => { 28809 setShowCommentBoard(true); 28810 enableComplementaryArea('core', 'edit-post/collab-sidebar'); 28811 }; 28812 const [blocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, { 28813 id: postId 28814 }); 28815 28816 // Process comments to build the tree structure 28817 const { 28818 resultComments, 28819 sortedThreads 28820 } = (0,external_wp_element_namespaceObject.useMemo)(() => { 28821 // Create a compare to store the references to all objects by id 28822 const compare = {}; 28823 const result = []; 28824 const filteredComments = (threads !== null && threads !== void 0 ? threads : []).filter(comment => comment.status !== 'trash'); 28825 28826 // Initialize each object with an empty `reply` array 28827 filteredComments.forEach(item => { 28828 compare[item.id] = { 28829 ...item, 28830 reply: [] 28831 }; 28832 }); 28833 28834 // Iterate over the data to build the tree structure 28835 filteredComments.forEach(item => { 28836 if (item.parent === 0) { 28837 // If parent is 0, it's a root item, push it to the result array 28838 result.push(compare[item.id]); 28839 } else if (compare[item.parent]) { 28840 // Otherwise, find its parent and push it to the parent's `reply` array 28841 compare[item.parent].reply.push(compare[item.id]); 28842 } 28843 }); 28844 if (0 === result?.length) { 28845 return { 28846 resultComments: [], 28847 sortedThreads: [] 28848 }; 28849 } 28850 const updatedResult = result.map(item => ({ 28851 ...item, 28852 reply: [...item.reply].reverse() 28853 })); 28854 const blockCommentIds = getCommentIdsFromBlocks(blocks); 28855 const threadIdMap = new Map(updatedResult.map(thread => [thread.id, thread])); 28856 const sortedComments = blockCommentIds.map(id => threadIdMap.get(id)).filter(thread => thread !== undefined); 28857 return { 28858 resultComments: updatedResult, 28859 sortedThreads: sortedComments 28860 }; 28861 }, [threads, blocks]); 28862 28863 // Get the global styles to set the background color of the sidebar. 28864 const { 28865 merged: GlobalStyles 28866 } = useGlobalStylesContext(); 28867 const backgroundColor = GlobalStyles?.styles?.color?.background; 28868 if (0 < resultComments.length) { 28869 const unsubscribe = (0,external_wp_data_namespaceObject.subscribe)(() => { 28870 const activeSidebar = getActiveComplementaryArea('core'); 28871 if (!activeSidebar) { 28872 enableComplementaryArea('core', collabSidebarName); 28873 unsubscribe(); 28874 } 28875 }); 28876 } 28877 if (postStatus === 'publish') { 28878 return null; // or maybe return some message indicating no threads are available. 28879 } 28880 const AddCommentComponent = blockCommentId ? comment_button_toolbar : comment_button; 28881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28882 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AddCommentComponent, { 28883 onClick: openCollabBoard 28884 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { 28885 identifier: collabHistorySidebarName 28886 // translators: Comments sidebar title 28887 , 28888 title: (0,external_wp_i18n_namespaceObject.__)('Comments'), 28889 icon: library_comment, 28890 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebarContent, { 28891 comments: resultComments, 28892 showCommentBoard: showCommentBoard, 28893 setShowCommentBoard: setShowCommentBoard 28894 }) 28895 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { 28896 isPinnable: false, 28897 header: false, 28898 identifier: collabSidebarName, 28899 className: "editor-collab-sidebar", 28900 headerClassName: "editor-collab-sidebar__header", 28901 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebarContent, { 28902 comments: sortedThreads, 28903 showCommentBoard: showCommentBoard, 28904 setShowCommentBoard: setShowCommentBoard, 28905 styles: { 28906 backgroundColor 28907 } 28908 }) 28909 })] 28910 }); 28911 } 28912 28913 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 28914 /** 28915 * WordPress dependencies 28916 */ 28917 28918 28919 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 28920 xmlns: "http://www.w3.org/2000/svg", 28921 viewBox: "0 0 24 24", 28922 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 28923 d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" 28924 }) 28925 }); 28926 /* harmony default export */ const library_next = (next); 28927 28928 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 28929 /** 28930 * WordPress dependencies 28931 */ 28932 28933 28934 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 28935 xmlns: "http://www.w3.org/2000/svg", 28936 viewBox: "0 0 24 24", 28937 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 28938 d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" 28939 }) 28940 }); 28941 /* harmony default export */ const library_previous = (previous); 28942 28943 ;// ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js 28944 /** 28945 * External dependencies 28946 */ 28947 28948 28949 /** 28950 * WordPress dependencies 28951 */ 28952 28953 28954 28955 28956 28957 28958 28959 /** 28960 * Internal dependencies 28961 */ 28962 28963 28964 const { 28965 useHasBlockToolbar 28966 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 28967 function CollapsibleBlockToolbar({ 28968 isCollapsed, 28969 onToggle 28970 }) { 28971 const { 28972 blockSelectionStart 28973 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28974 return { 28975 blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 28976 }; 28977 }, []); 28978 const hasBlockToolbar = useHasBlockToolbar(); 28979 const hasBlockSelection = !!blockSelectionStart; 28980 (0,external_wp_element_namespaceObject.useEffect)(() => { 28981 // If we have a new block selection, show the block tools 28982 if (blockSelectionStart) { 28983 onToggle(false); 28984 } 28985 }, [blockSelectionStart, onToggle]); 28986 if (!hasBlockToolbar) { 28987 return null; 28988 } 28989 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28990 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 28991 className: dist_clsx('editor-collapsible-block-toolbar', { 28992 'is-collapsed': isCollapsed || !hasBlockSelection 28993 }), 28994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 28995 hideDragHandle: true 28996 }) 28997 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { 28998 name: "block-toolbar" 28999 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 29000 className: "editor-collapsible-block-toolbar__toggle", 29001 icon: isCollapsed ? library_next : library_previous, 29002 onClick: () => { 29003 onToggle(!isCollapsed); 29004 }, 29005 label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools'), 29006 size: "compact" 29007 })] 29008 }); 29009 } 29010 29011 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 29012 /** 29013 * WordPress dependencies 29014 */ 29015 29016 29017 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29018 xmlns: "http://www.w3.org/2000/svg", 29019 viewBox: "0 0 24 24", 29020 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 29021 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 29022 }) 29023 }); 29024 /* harmony default export */ const library_plus = (plus); 29025 29026 ;// ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js 29027 /** 29028 * External dependencies 29029 */ 29030 29031 29032 /** 29033 * WordPress dependencies 29034 */ 29035 29036 29037 29038 29039 29040 29041 29042 29043 29044 29045 /** 29046 * Internal dependencies 29047 */ 29048 29049 29050 29051 29052 29053 function DocumentTools({ 29054 className, 29055 disableBlockTools = false 29056 }) { 29057 const { 29058 setIsInserterOpened, 29059 setIsListViewOpened 29060 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29061 const { 29062 isDistractionFree, 29063 isInserterOpened, 29064 isListViewOpen, 29065 listViewShortcut, 29066 inserterSidebarToggleRef, 29067 listViewToggleRef, 29068 showIconLabels, 29069 showTools 29070 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29071 const { 29072 get 29073 } = select(external_wp_preferences_namespaceObject.store); 29074 const { 29075 isListViewOpened, 29076 getEditorMode, 29077 getInserterSidebarToggleRef, 29078 getListViewToggleRef, 29079 getRenderingMode, 29080 getCurrentPostType 29081 } = unlock(select(store_store)); 29082 const { 29083 getShortcutRepresentation 29084 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 29085 return { 29086 isInserterOpened: select(store_store).isInserterOpened(), 29087 isListViewOpen: isListViewOpened(), 29088 listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'), 29089 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 29090 listViewToggleRef: getListViewToggleRef(), 29091 showIconLabels: get('core', 'showIconLabels'), 29092 isDistractionFree: get('core', 'distractionFree'), 29093 isVisualMode: getEditorMode() === 'visual', 29094 showTools: !!window?.__experimentalEditorWriteMode && (getRenderingMode() !== 'post-only' || getCurrentPostType() === 'wp_template') 29095 }; 29096 }, []); 29097 const preventDefault = event => { 29098 // Because the inserter behaves like a dialog, 29099 // if the inserter is opened already then when we click on the toggle button 29100 // then the initial click event will close the inserter and then be propagated 29101 // to the inserter toggle and it will open it again. 29102 // To prevent this we need to stop the propagation of the event. 29103 // This won't be necessary when the inserter no longer behaves like a dialog. 29104 29105 if (isInserterOpened) { 29106 event.preventDefault(); 29107 } 29108 }; 29109 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 29110 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide'); 29111 29112 /* translators: accessibility text for the editor toolbar */ 29113 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools'); 29114 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); 29115 const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]); 29116 29117 /* translators: button label text should, if possible, be under 16 characters. */ 29118 const longLabel = (0,external_wp_i18n_namespaceObject._x)('Block Inserter', 'Generic label for block inserter button'); 29119 const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'); 29120 return ( 29121 /*#__PURE__*/ 29122 // Some plugins expect and use the `edit-post-header-toolbar` CSS class to 29123 // find the toolbar and inject UI elements into it. This is not officially 29124 // supported, but we're keeping it in the list of class names for backwards 29125 // compatibility. 29126 (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { 29127 className: dist_clsx('editor-document-tools', 'edit-post-header-toolbar', className), 29128 "aria-label": toolbarAriaLabel, 29129 variant: "unstyled", 29130 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 29131 className: "editor-document-tools__left", 29132 children: [!isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { 29133 ref: inserterSidebarToggleRef, 29134 className: "editor-document-tools__inserter-toggle", 29135 variant: "primary", 29136 isPressed: isInserterOpened, 29137 onMouseDown: preventDefault, 29138 onClick: toggleInserter, 29139 disabled: disableBlockTools, 29140 icon: library_plus, 29141 label: showIconLabels ? shortLabel : longLabel, 29142 showTooltip: !showIconLabels, 29143 "aria-expanded": isInserterOpened 29144 }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29145 children: [showTools && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 29146 as: external_wp_blockEditor_namespaceObject.ToolSelector, 29147 showTooltip: !showIconLabels, 29148 variant: showIconLabels ? 'tertiary' : undefined, 29149 disabled: disableBlockTools, 29150 size: "compact" 29151 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 29152 as: editor_history_undo, 29153 showTooltip: !showIconLabels, 29154 variant: showIconLabels ? 'tertiary' : undefined, 29155 size: "compact" 29156 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 29157 as: editor_history_redo, 29158 showTooltip: !showIconLabels, 29159 variant: showIconLabels ? 'tertiary' : undefined, 29160 size: "compact" 29161 }), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { 29162 className: "editor-document-tools__document-overview-toggle", 29163 icon: list_view, 29164 disabled: disableBlockTools, 29165 isPressed: isListViewOpen 29166 /* translators: button label text should, if possible, be under 16 characters. */, 29167 label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'), 29168 onClick: toggleListView, 29169 shortcut: listViewShortcut, 29170 showTooltip: !showIconLabels, 29171 variant: showIconLabels ? 'tertiary' : undefined, 29172 "aria-expanded": isListViewOpen, 29173 ref: listViewToggleRef 29174 })] 29175 })] 29176 }) 29177 }) 29178 ); 29179 } 29180 /* harmony default export */ const document_tools = (DocumentTools); 29181 29182 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js 29183 /** 29184 * WordPress dependencies 29185 */ 29186 29187 29188 29189 29190 29191 29192 29193 29194 /** 29195 * Internal dependencies 29196 */ 29197 29198 29199 function CopyContentMenuItem() { 29200 const { 29201 createNotice 29202 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 29203 const { 29204 getCurrentPostId, 29205 getCurrentPostType 29206 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 29207 const { 29208 getEditedEntityRecord 29209 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 29210 function getText() { 29211 const record = getEditedEntityRecord('postType', getCurrentPostType(), getCurrentPostId()); 29212 if (!record) { 29213 return ''; 29214 } 29215 if (typeof record.content === 'function') { 29216 return record.content(record); 29217 } else if (record.blocks) { 29218 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 29219 } else if (record.content) { 29220 return record.content; 29221 } 29222 } 29223 function onSuccess() { 29224 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { 29225 isDismissible: true, 29226 type: 'snackbar' 29227 }); 29228 } 29229 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); 29230 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 29231 ref: ref, 29232 children: (0,external_wp_i18n_namespaceObject.__)('Copy all blocks') 29233 }); 29234 } 29235 29236 ;// ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js 29237 /* wp:polyfill */ 29238 /** 29239 * WordPress dependencies 29240 */ 29241 29242 29243 29244 29245 29246 /** 29247 * Internal dependencies 29248 */ 29249 29250 29251 /** 29252 * Set of available mode options. 29253 * 29254 * @type {Array} 29255 */ 29256 29257 const MODES = [{ 29258 value: 'visual', 29259 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') 29260 }, { 29261 value: 'text', 29262 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') 29263 }]; 29264 function ModeSwitcher() { 29265 const { 29266 shortcut, 29267 isRichEditingEnabled, 29268 isCodeEditingEnabled, 29269 mode 29270 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 29271 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-mode'), 29272 isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled, 29273 isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled, 29274 mode: select(store_store).getEditorMode() 29275 }), []); 29276 const { 29277 switchEditorMode 29278 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29279 let selectedMode = mode; 29280 if (!isRichEditingEnabled && mode === 'visual') { 29281 selectedMode = 'text'; 29282 } 29283 if (!isCodeEditingEnabled && mode === 'text') { 29284 selectedMode = 'visual'; 29285 } 29286 const choices = MODES.map(choice => { 29287 if (!isCodeEditingEnabled && choice.value === 'text') { 29288 choice = { 29289 ...choice, 29290 disabled: true 29291 }; 29292 } 29293 if (!isRichEditingEnabled && choice.value === 'visual') { 29294 choice = { 29295 ...choice, 29296 disabled: true, 29297 info: (0,external_wp_i18n_namespaceObject.__)('You can enable the visual editor in your profile settings.') 29298 }; 29299 } 29300 if (choice.value !== selectedMode && !choice.disabled) { 29301 return { 29302 ...choice, 29303 shortcut 29304 }; 29305 } 29306 return choice; 29307 }); 29308 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29309 label: (0,external_wp_i18n_namespaceObject.__)('Editor'), 29310 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { 29311 choices: choices, 29312 value: selectedMode, 29313 onSelect: switchEditorMode 29314 }) 29315 }); 29316 } 29317 /* harmony default export */ const mode_switcher = (ModeSwitcher); 29318 29319 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js 29320 /** 29321 * WordPress dependencies 29322 */ 29323 29324 29325 const { 29326 Fill: ToolsMoreMenuGroup, 29327 Slot: tools_more_menu_group_Slot 29328 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); 29329 ToolsMoreMenuGroup.Slot = ({ 29330 fillProps 29331 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, { 29332 fillProps: fillProps 29333 }); 29334 /* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); 29335 29336 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js 29337 /** 29338 * WordPress dependencies 29339 */ 29340 29341 29342 29343 const { 29344 Fill: ViewMoreMenuGroup, 29345 Slot: view_more_menu_group_Slot 29346 } = (0,external_wp_components_namespaceObject.createSlotFill)(external_wp_element_namespaceObject.Platform.OS === 'web' ? Symbol('ViewMoreMenuGroup') : 'ViewMoreMenuGroup'); 29347 ViewMoreMenuGroup.Slot = ({ 29348 fillProps 29349 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, { 29350 fillProps: fillProps 29351 }); 29352 /* harmony default export */ const view_more_menu_group = (ViewMoreMenuGroup); 29353 29354 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js 29355 /** 29356 * WordPress dependencies 29357 */ 29358 29359 29360 29361 29362 29363 29364 29365 29366 /** 29367 * Internal dependencies 29368 */ 29369 29370 29371 29372 29373 29374 29375 function MoreMenu() { 29376 const { 29377 openModal 29378 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 29379 const { 29380 set: setPreference 29381 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 29382 const { 29383 toggleDistractionFree 29384 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29385 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []); 29386 const turnOffDistractionFree = () => { 29387 setPreference('core', 'distractionFree', false); 29388 }; 29389 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29390 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 29391 icon: more_vertical, 29392 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 29393 popoverProps: { 29394 placement: 'bottom-end', 29395 className: 'more-menu-dropdown__content' 29396 }, 29397 toggleProps: { 29398 showTooltip: !showIconLabels, 29399 ...(showIconLabels && { 29400 variant: 'tertiary' 29401 }), 29402 tooltipPosition: 'bottom', 29403 size: 'compact' 29404 }, 29405 children: ({ 29406 onClose 29407 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29408 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 29409 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'), 29410 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 29411 scope: "core", 29412 name: "fixedToolbar", 29413 onToggle: turnOffDistractionFree, 29414 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 29415 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), 29416 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated.'), 29417 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated.') 29418 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 29419 scope: "core", 29420 name: "distractionFree", 29421 label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), 29422 info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), 29423 handleToggling: false, 29424 onToggle: () => toggleDistractionFree({ 29425 createNotice: false 29426 }), 29427 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated.'), 29428 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated.'), 29429 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') 29430 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 29431 scope: "core", 29432 name: "focusMode", 29433 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), 29434 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), 29435 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated.'), 29436 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated.') 29437 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group.Slot, { 29438 fillProps: { 29439 onClose 29440 } 29441 })] 29442 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { 29443 name: "core/plugin-more-menu", 29444 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), 29445 fillProps: { 29446 onClick: onClose 29447 } 29448 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 29449 label: (0,external_wp_i18n_namespaceObject.__)('Tools'), 29450 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 29451 onClick: () => openModal('editor/keyboard-shortcut-help'), 29452 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'), 29453 children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts') 29454 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { 29455 icon: library_external, 29456 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), 29457 target: "_blank", 29458 rel: "noopener noreferrer", 29459 children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 29460 as: "span", 29461 children: /* translators: accessibility text */ 29462 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 29463 })] 29464 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group.Slot, { 29465 fillProps: { 29466 onClose 29467 } 29468 })] 29469 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29470 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 29471 onClick: () => openModal('editor/preferences'), 29472 children: (0,external_wp_i18n_namespaceObject.__)('Preferences') 29473 }) 29474 })] 29475 }) 29476 }) 29477 }); 29478 } 29479 29480 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js 29481 /** 29482 * WordPress dependencies 29483 */ 29484 29485 29486 29487 /** 29488 * Internal dependencies 29489 */ 29490 29491 29492 29493 const IS_TOGGLE = 'toggle'; 29494 const IS_BUTTON = 'button'; 29495 function PostPublishButtonOrToggle({ 29496 forceIsDirty, 29497 setEntitiesSavedStatesCallback 29498 }) { 29499 let component; 29500 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 29501 const { 29502 togglePublishSidebar 29503 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29504 const { 29505 hasPublishAction, 29506 isBeingScheduled, 29507 isPending, 29508 isPublished, 29509 isPublishSidebarEnabled, 29510 isPublishSidebarOpened, 29511 isScheduled, 29512 postStatus, 29513 postStatusHasChanged 29514 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29515 var _select$getCurrentPos; 29516 return { 29517 hasPublishAction: (_select$getCurrentPos = !!select(store_store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false, 29518 isBeingScheduled: select(store_store).isEditedPostBeingScheduled(), 29519 isPending: select(store_store).isCurrentPostPending(), 29520 isPublished: select(store_store).isCurrentPostPublished(), 29521 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(), 29522 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), 29523 isScheduled: select(store_store).isCurrentPostScheduled(), 29524 postStatus: select(store_store).getEditedPostAttribute('status'), 29525 postStatusHasChanged: select(store_store).getPostEdits()?.status 29526 }; 29527 }, []); 29528 29529 /** 29530 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar): 29531 * 29532 * 1) We want to show a BUTTON when the post status is at the _final stage_ 29533 * for a particular role (see https://wordpress.org/documentation/article/post-status/): 29534 * 29535 * - is published 29536 * - post status has changed explicitly to something different than 'future' or 'publish' 29537 * - is scheduled to be published 29538 * - is pending and can't be published (but only for viewports >= medium). 29539 * Originally, we considered showing a button for pending posts that couldn't be published 29540 * (for example, for an author with the contributor role). Some languages can have 29541 * long translations for "Submit for review", so given the lack of UI real estate available 29542 * we decided to take into account the viewport in that case. 29543 * See: https://github.com/WordPress/gutenberg/issues/10475 29544 * 29545 * 2) Then, in small viewports, we'll show a TOGGLE. 29546 * 29547 * 3) Finally, we'll use the publish sidebar status to decide: 29548 * 29549 * - if it is enabled, we show a TOGGLE 29550 * - if it is disabled, we show a BUTTON 29551 */ 29552 if (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { 29553 component = IS_BUTTON; 29554 } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) { 29555 component = IS_TOGGLE; 29556 } else { 29557 component = IS_BUTTON; 29558 } 29559 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { 29560 forceIsDirty: forceIsDirty, 29561 isOpen: isPublishSidebarOpened, 29562 isToggle: component === IS_TOGGLE, 29563 onToggle: togglePublishSidebar, 29564 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 29565 }); 29566 } 29567 29568 ;// ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js 29569 /** 29570 * WordPress dependencies 29571 */ 29572 29573 29574 29575 29576 29577 29578 29579 /** 29580 * Internal dependencies 29581 */ 29582 29583 29584 function PostViewLink() { 29585 const { 29586 hasLoaded, 29587 permalink, 29588 isPublished, 29589 label, 29590 showIconLabels 29591 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29592 // Grab post type to retrieve the view_item label. 29593 const postTypeSlug = select(store_store).getCurrentPostType(); 29594 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 29595 const { 29596 get 29597 } = select(external_wp_preferences_namespaceObject.store); 29598 return { 29599 permalink: select(store_store).getPermalink(), 29600 isPublished: select(store_store).isCurrentPostPublished(), 29601 label: postType?.labels.view_item, 29602 hasLoaded: !!postType, 29603 showIconLabels: get('core', 'showIconLabels') 29604 }; 29605 }, []); 29606 29607 // Only render the view button if the post is published and has a permalink. 29608 if (!isPublished || !permalink || !hasLoaded) { 29609 return null; 29610 } 29611 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 29612 icon: library_external, 29613 label: label || (0,external_wp_i18n_namespaceObject.__)('View post'), 29614 href: permalink, 29615 target: "_blank", 29616 showTooltip: !showIconLabels, 29617 size: "compact" 29618 }); 29619 } 29620 29621 ;// ./node_modules/@wordpress/icons/build-module/library/desktop.js 29622 /** 29623 * WordPress dependencies 29624 */ 29625 29626 29627 const desktop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29628 xmlns: "http://www.w3.org/2000/svg", 29629 viewBox: "0 0 24 24", 29630 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 29631 d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" 29632 }) 29633 }); 29634 /* harmony default export */ const library_desktop = (desktop); 29635 29636 ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js 29637 /** 29638 * WordPress dependencies 29639 */ 29640 29641 29642 const mobile = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29643 xmlns: "http://www.w3.org/2000/svg", 29644 viewBox: "0 0 24 24", 29645 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 29646 d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" 29647 }) 29648 }); 29649 /* harmony default export */ const library_mobile = (mobile); 29650 29651 ;// ./node_modules/@wordpress/icons/build-module/library/tablet.js 29652 /** 29653 * WordPress dependencies 29654 */ 29655 29656 29657 const tablet = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29658 xmlns: "http://www.w3.org/2000/svg", 29659 viewBox: "0 0 24 24", 29660 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 29661 d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" 29662 }) 29663 }); 29664 /* harmony default export */ const library_tablet = (tablet); 29665 29666 ;// ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js 29667 /** 29668 * External dependencies 29669 */ 29670 29671 29672 /** 29673 * WordPress dependencies 29674 */ 29675 29676 29677 29678 29679 29680 29681 29682 29683 29684 /** 29685 * Internal dependencies 29686 */ 29687 29688 29689 29690 29691 29692 function PreviewDropdown({ 29693 forceIsAutosaveable, 29694 disabled 29695 }) { 29696 const { 29697 deviceType, 29698 homeUrl, 29699 isTemplate, 29700 isViewable, 29701 showIconLabels, 29702 isTemplateHidden, 29703 templateId 29704 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29705 var _getPostType$viewable; 29706 const { 29707 getDeviceType, 29708 getCurrentPostType, 29709 getCurrentTemplateId 29710 } = select(store_store); 29711 const { 29712 getRenderingMode 29713 } = unlock(select(store_store)); 29714 const { 29715 getEntityRecord, 29716 getPostType 29717 } = select(external_wp_coreData_namespaceObject.store); 29718 const { 29719 get 29720 } = select(external_wp_preferences_namespaceObject.store); 29721 const _currentPostType = getCurrentPostType(); 29722 return { 29723 deviceType: getDeviceType(), 29724 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 29725 isTemplate: _currentPostType === 'wp_template', 29726 isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, 29727 showIconLabels: get('core', 'showIconLabels'), 29728 isTemplateHidden: getRenderingMode() === 'post-only', 29729 templateId: getCurrentTemplateId() 29730 }; 29731 }, []); 29732 const { 29733 setDeviceType, 29734 setRenderingMode 29735 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29736 const { 29737 resetZoomLevel 29738 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 29739 const handleDevicePreviewChange = newDeviceType => { 29740 setDeviceType(newDeviceType); 29741 resetZoomLevel(); 29742 }; 29743 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 29744 if (isMobile) { 29745 return null; 29746 } 29747 const popoverProps = { 29748 placement: 'bottom-end' 29749 }; 29750 const toggleProps = { 29751 className: 'editor-preview-dropdown__toggle', 29752 iconPosition: 'right', 29753 size: 'compact', 29754 showTooltip: !showIconLabels, 29755 disabled, 29756 accessibleWhenDisabled: disabled 29757 }; 29758 const menuProps = { 29759 'aria-label': (0,external_wp_i18n_namespaceObject.__)('View options') 29760 }; 29761 const deviceIcons = { 29762 desktop: library_desktop, 29763 mobile: library_mobile, 29764 tablet: library_tablet 29765 }; 29766 29767 /** 29768 * The choices for the device type. 29769 * 29770 * @type {Array} 29771 */ 29772 const choices = [{ 29773 value: 'Desktop', 29774 label: (0,external_wp_i18n_namespaceObject.__)('Desktop'), 29775 icon: library_desktop 29776 }, { 29777 value: 'Tablet', 29778 label: (0,external_wp_i18n_namespaceObject.__)('Tablet'), 29779 icon: library_tablet 29780 }, { 29781 value: 'Mobile', 29782 label: (0,external_wp_i18n_namespaceObject.__)('Mobile'), 29783 icon: library_mobile 29784 }]; 29785 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 29786 className: dist_clsx('editor-preview-dropdown', `editor-preview-dropdown--$deviceType.toLowerCase()}`), 29787 popoverProps: popoverProps, 29788 toggleProps: toggleProps, 29789 menuProps: menuProps, 29790 icon: deviceIcons[deviceType.toLowerCase()], 29791 label: (0,external_wp_i18n_namespaceObject.__)('View'), 29792 disableOpenOnArrowDown: disabled, 29793 children: ({ 29794 onClose 29795 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29796 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29797 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { 29798 choices: choices, 29799 value: deviceType, 29800 onSelect: handleDevicePreviewChange 29801 }) 29802 }), isTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29803 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { 29804 href: homeUrl, 29805 target: "_blank", 29806 icon: library_external, 29807 onClick: onClose, 29808 children: [(0,external_wp_i18n_namespaceObject.__)('View site'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 29809 as: "span", 29810 children: /* translators: accessibility text */ 29811 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 29812 })] 29813 }) 29814 }), !isTemplate && !!templateId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29815 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 29816 icon: !isTemplateHidden ? library_check : undefined, 29817 isSelected: !isTemplateHidden, 29818 role: "menuitemcheckbox", 29819 onClick: () => { 29820 setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only'); 29821 }, 29822 children: (0,external_wp_i18n_namespaceObject.__)('Show template') 29823 }) 29824 }), isViewable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 29825 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { 29826 className: "editor-preview-dropdown__button-external", 29827 role: "menuitem", 29828 forceIsAutosaveable: forceIsAutosaveable, 29829 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), 29830 textContent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29831 children: [(0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 29832 icon: library_external 29833 })] 29834 }), 29835 onPreview: onClose 29836 }) 29837 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { 29838 name: "core/plugin-preview-menu", 29839 fillProps: { 29840 onClick: onClose 29841 } 29842 })] 29843 }) 29844 }); 29845 } 29846 29847 ;// ./node_modules/@wordpress/icons/build-module/library/square.js 29848 /** 29849 * WordPress dependencies 29850 */ 29851 29852 29853 const square = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 29854 xmlns: "http://www.w3.org/2000/svg", 29855 viewBox: "0 0 24 24", 29856 fill: "none", 29857 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 29858 fill: "none", 29859 d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", 29860 stroke: "currentColor", 29861 strokeWidth: "1.5", 29862 strokeLinecap: "square" 29863 }) 29864 }); 29865 /* harmony default export */ const library_square = (square); 29866 29867 ;// ./node_modules/@wordpress/editor/build-module/components/zoom-out-toggle/index.js 29868 /** 29869 * WordPress dependencies 29870 */ 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 /** 29882 * Internal dependencies 29883 */ 29884 29885 29886 const ZoomOutToggle = ({ 29887 disabled 29888 }) => { 29889 const { 29890 isZoomOut, 29891 showIconLabels, 29892 isDistractionFree 29893 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 29894 isZoomOut: unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(), 29895 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), 29896 isDistractionFree: select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree') 29897 })); 29898 const { 29899 resetZoomLevel, 29900 setZoomLevel 29901 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 29902 const { 29903 registerShortcut, 29904 unregisterShortcut 29905 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 29906 (0,external_wp_element_namespaceObject.useEffect)(() => { 29907 registerShortcut({ 29908 name: 'core/editor/zoom', 29909 category: 'global', 29910 description: (0,external_wp_i18n_namespaceObject.__)('Enter or exit zoom out.'), 29911 keyCombination: { 29912 // `primaryShift+0` (`ctrl+shift+0`) is the shortcut for switching 29913 // to input mode in Windows, so apply a different key combination. 29914 modifier: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? 'primaryShift' : 'secondary', 29915 character: '0' 29916 } 29917 }); 29918 return () => { 29919 unregisterShortcut('core/editor/zoom'); 29920 }; 29921 }, [registerShortcut, unregisterShortcut]); 29922 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/zoom', () => { 29923 if (isZoomOut) { 29924 resetZoomLevel(); 29925 } else { 29926 setZoomLevel('auto-scaled'); 29927 } 29928 }, { 29929 isDisabled: isDistractionFree 29930 }); 29931 const handleZoomOut = () => { 29932 if (isZoomOut) { 29933 resetZoomLevel(); 29934 } else { 29935 setZoomLevel('auto-scaled'); 29936 } 29937 }; 29938 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 29939 accessibleWhenDisabled: true, 29940 disabled: disabled, 29941 onClick: handleZoomOut, 29942 icon: library_square, 29943 label: (0,external_wp_i18n_namespaceObject.__)('Zoom Out'), 29944 isPressed: isZoomOut, 29945 size: "compact", 29946 showTooltip: !showIconLabels, 29947 className: "editor-zoom-out-toggle" 29948 }); 29949 }; 29950 /* harmony default export */ const zoom_out_toggle = (ZoomOutToggle); 29951 29952 ;// ./node_modules/@wordpress/editor/build-module/components/header/index.js 29953 /** 29954 * WordPress dependencies 29955 */ 29956 29957 29958 29959 29960 29961 29962 29963 29964 /** 29965 * Internal dependencies 29966 */ 29967 29968 29969 29970 29971 29972 29973 29974 29975 29976 29977 29978 29979 29980 29981 29982 29983 const isBlockCommentExperimentEnabled = window?.__experimentalEnableBlockComment; 29984 const toolbarVariations = { 29985 distractionFreeDisabled: { 29986 y: '-50px' 29987 }, 29988 distractionFreeHover: { 29989 y: 0 29990 }, 29991 distractionFreeHidden: { 29992 y: '-50px' 29993 }, 29994 visible: { 29995 y: 0 29996 }, 29997 hidden: { 29998 y: 0 29999 } 30000 }; 30001 const backButtonVariations = { 30002 distractionFreeDisabled: { 30003 x: '-100%' 30004 }, 30005 distractionFreeHover: { 30006 x: 0 30007 }, 30008 distractionFreeHidden: { 30009 x: '-100%' 30010 }, 30011 visible: { 30012 x: 0 30013 }, 30014 hidden: { 30015 x: 0 30016 } 30017 }; 30018 function header_Header({ 30019 customSaveButton, 30020 forceIsDirty, 30021 forceDisableBlockTools, 30022 setEntitiesSavedStatesCallback, 30023 title 30024 }) { 30025 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 30026 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 30027 const isTooNarrowForDocumentBar = (0,external_wp_compose_namespaceObject.useMediaQuery)('(max-width: 403px)'); 30028 const { 30029 postType, 30030 isTextEditor, 30031 isPublishSidebarOpened, 30032 showIconLabels, 30033 hasFixedToolbar, 30034 hasBlockSelection, 30035 hasSectionRootClientId 30036 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 30037 const { 30038 get: getPreference 30039 } = select(external_wp_preferences_namespaceObject.store); 30040 const { 30041 getEditorMode, 30042 getCurrentPostType, 30043 isPublishSidebarOpened: _isPublishSidebarOpened 30044 } = select(store_store); 30045 const { 30046 getBlockSelectionStart, 30047 getSectionRootClientId 30048 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 30049 return { 30050 postType: getCurrentPostType(), 30051 isTextEditor: getEditorMode() === 'text', 30052 isPublishSidebarOpened: _isPublishSidebarOpened(), 30053 showIconLabels: getPreference('core', 'showIconLabels'), 30054 hasFixedToolbar: getPreference('core', 'fixedToolbar'), 30055 hasBlockSelection: !!getBlockSelectionStart(), 30056 hasSectionRootClientId: !!getSectionRootClientId() 30057 }; 30058 }, []); 30059 const canBeZoomedOut = ['post', 'page', 'wp_template'].includes(postType) && hasSectionRootClientId; 30060 const disablePreviewOption = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) || forceDisableBlockTools; 30061 const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); 30062 const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed)); 30063 const hasBackButton = useHasBackButton(); 30064 30065 /* 30066 * The edit-post-header classname is only kept for backward compatibility 30067 * as some plugins might be relying on its presence. 30068 */ 30069 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30070 className: "editor-header edit-post-header", 30071 children: [hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 30072 className: "editor-header__back-button", 30073 variants: backButtonVariations, 30074 transition: { 30075 type: 'tween' 30076 }, 30077 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button.Slot, {}) 30078 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 30079 variants: toolbarVariations, 30080 className: "editor-header__toolbar", 30081 transition: { 30082 type: 'tween' 30083 }, 30084 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools, { 30085 disableBlockTools: forceDisableBlockTools || isTextEditor 30086 }), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollapsibleBlockToolbar, { 30087 isCollapsed: isBlockToolsCollapsed, 30088 onToggle: setIsBlockToolsCollapsed 30089 })] 30090 }), hasCenter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 30091 className: "editor-header__center", 30092 variants: toolbarVariations, 30093 transition: { 30094 type: 'tween' 30095 }, 30096 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, { 30097 title: title 30098 }) 30099 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 30100 variants: toolbarVariations, 30101 transition: { 30102 type: 'tween' 30103 }, 30104 className: "editor-header__settings", 30105 children: [!customSaveButton && !isPublishSidebarOpened && 30106 /*#__PURE__*/ 30107 /* 30108 * This button isn't completely hidden by the publish sidebar. 30109 * We can't hide the whole toolbar when the publish sidebar is open because 30110 * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. 30111 * We track that DOM node to return focus to the PostPublishButtonOrToggle 30112 * when the publish sidebar has been closed. 30113 */ 30114 (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, { 30115 forceIsDirty: forceIsDirty 30116 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewDropdown, { 30117 forceIsAutosaveable: forceIsDirty, 30118 disabled: disablePreviewOption 30119 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { 30120 className: "editor-header__post-preview-button", 30121 forceIsAutosaveable: forceIsDirty 30122 }), isWideViewport && canBeZoomedOut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_toggle, { 30123 disabled: forceDisableBlockTools 30124 }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items.Slot, { 30125 scope: "core" 30126 }), !customSaveButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishButtonOrToggle, { 30127 forceIsDirty: forceIsDirty, 30128 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 30129 }), isBlockCommentExperimentEnabled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollabSidebar, {}) : undefined, customSaveButton, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})] 30130 })] 30131 }); 30132 } 30133 /* harmony default export */ const components_header = (header_Header); 30134 30135 ;// ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js 30136 /** 30137 * WordPress dependencies 30138 */ 30139 30140 30141 30142 30143 30144 30145 30146 30147 /** 30148 * Internal dependencies 30149 */ 30150 30151 30152 30153 const { 30154 PrivateInserterLibrary 30155 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 30156 function InserterSidebar() { 30157 const { 30158 blockSectionRootClientId, 30159 inserterSidebarToggleRef, 30160 inserter, 30161 showMostUsedBlocks, 30162 sidebarIsOpened 30163 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 30164 const { 30165 getInserterSidebarToggleRef, 30166 getInserter, 30167 isPublishSidebarOpened 30168 } = unlock(select(store_store)); 30169 const { 30170 getBlockRootClientId, 30171 isZoomOut, 30172 getSectionRootClientId 30173 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 30174 const { 30175 get 30176 } = select(external_wp_preferences_namespaceObject.store); 30177 const { 30178 getActiveComplementaryArea 30179 } = select(store); 30180 const getBlockSectionRootClientId = () => { 30181 if (isZoomOut()) { 30182 const sectionRootClientId = getSectionRootClientId(); 30183 if (sectionRootClientId) { 30184 return sectionRootClientId; 30185 } 30186 } 30187 return getBlockRootClientId(); 30188 }; 30189 return { 30190 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 30191 inserter: getInserter(), 30192 showMostUsedBlocks: get('core', 'mostUsedBlocks'), 30193 blockSectionRootClientId: getBlockSectionRootClientId(), 30194 sidebarIsOpened: !!(getActiveComplementaryArea('core') || isPublishSidebarOpened()) 30195 }; 30196 }, []); 30197 const { 30198 setIsInserterOpened 30199 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30200 const { 30201 disableComplementaryArea 30202 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 30203 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 30204 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); 30205 30206 // When closing the inserter, focus should return to the toggle button. 30207 const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { 30208 setIsInserterOpened(false); 30209 inserterSidebarToggleRef.current?.focus(); 30210 }, [inserterSidebarToggleRef, setIsInserterOpened]); 30211 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { 30212 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 30213 event.preventDefault(); 30214 closeInserterSidebar(); 30215 } 30216 }, [closeInserterSidebar]); 30217 const inserterContents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30218 className: "editor-inserter-sidebar__content", 30219 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, { 30220 showMostUsedBlocks: showMostUsedBlocks, 30221 showInserterHelpPanel: true, 30222 shouldFocusBlock: isMobileViewport, 30223 rootClientId: blockSectionRootClientId, 30224 onSelect: inserter.onSelect, 30225 __experimentalInitialTab: inserter.tab, 30226 __experimentalInitialCategory: inserter.category, 30227 __experimentalFilterValue: inserter.filterValue, 30228 onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea('core') : undefined, 30229 ref: libraryRef, 30230 onClose: closeInserterSidebar 30231 }) 30232 }); 30233 return ( 30234 /*#__PURE__*/ 30235 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 30236 (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30237 onKeyDown: closeOnEscape, 30238 className: "editor-inserter-sidebar", 30239 children: inserterContents 30240 }) 30241 ); 30242 } 30243 30244 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js 30245 /** 30246 * WordPress dependencies 30247 */ 30248 30249 30250 30251 /** 30252 * Internal dependencies 30253 */ 30254 30255 30256 30257 30258 30259 function ListViewOutline() { 30260 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 30261 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30262 className: "editor-list-view-sidebar__outline", 30263 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30264 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 30265 children: (0,external_wp_i18n_namespaceObject.__)('Characters:') 30266 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 30267 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) 30268 })] 30269 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30270 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 30271 children: (0,external_wp_i18n_namespaceObject.__)('Words:') 30272 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] 30273 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30274 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 30275 children: (0,external_wp_i18n_namespaceObject.__)('Time to read:') 30276 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] 30277 })] 30278 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {})] 30279 }); 30280 } 30281 30282 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js 30283 /* wp:polyfill */ 30284 /** 30285 * WordPress dependencies 30286 */ 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 /** 30297 * Internal dependencies 30298 */ 30299 30300 30301 30302 30303 const { 30304 TabbedSidebar 30305 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 30306 function ListViewSidebar() { 30307 const { 30308 setIsListViewOpened 30309 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30310 const { 30311 getListViewToggleRef 30312 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); 30313 30314 // This hook handles focus when the sidebar first renders. 30315 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 30316 30317 // When closing the list view, focus should return to the toggle button. 30318 const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { 30319 setIsListViewOpened(false); 30320 getListViewToggleRef().current?.focus(); 30321 }, [getListViewToggleRef, setIsListViewOpened]); 30322 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { 30323 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 30324 event.preventDefault(); 30325 closeListView(); 30326 } 30327 }, [closeListView]); 30328 30329 // Use internal state instead of a ref to make sure that the component 30330 // re-renders when the dropZoneElement updates. 30331 const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); 30332 // Tracks our current tab. 30333 const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view'); 30334 30335 // This ref refers to the sidebar as a whole. 30336 const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); 30337 // This ref refers to the tab panel. 30338 const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); 30339 // This ref refers to the list view application area. 30340 const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); 30341 30342 // Must merge the refs together so focus can be handled properly in the next function. 30343 const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]); 30344 30345 /* 30346 * Callback function to handle list view or outline focus. 30347 * 30348 * @param {string} currentTab The current tab. Either list view or outline. 30349 * 30350 * @return void 30351 */ 30352 function handleSidebarFocus(currentTab) { 30353 // Tab panel focus. 30354 const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0]; 30355 // List view tab is selected. 30356 if (currentTab === 'list-view') { 30357 // Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks. 30358 const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0]; 30359 const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus; 30360 listViewFocusArea.focus(); 30361 // Outline tab is selected. 30362 } else { 30363 tabPanelFocus.focus(); 30364 } 30365 } 30366 const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { 30367 // If the sidebar has focus, it is safe to close. 30368 if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) { 30369 closeListView(); 30370 } else { 30371 // If the list view or outline does not have focus, focus should be moved to it. 30372 handleSidebarFocus(tab); 30373 } 30374 }, [closeListView, tab]); 30375 30376 // This only fires when the sidebar is open because of the conditional rendering. 30377 // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed. 30378 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut); 30379 return ( 30380 /*#__PURE__*/ 30381 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 30382 (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30383 className: "editor-list-view-sidebar", 30384 onKeyDown: closeOnEscape, 30385 ref: sidebarRef, 30386 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabbedSidebar, { 30387 tabs: [{ 30388 name: 'list-view', 30389 title: (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview'), 30390 panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30391 className: "editor-list-view-sidebar__list-view-container", 30392 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30393 className: "editor-list-view-sidebar__list-view-panel-content", 30394 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, { 30395 dropZoneElement: dropZoneElement 30396 }) 30397 }) 30398 }), 30399 panelRef: listViewContainerRef 30400 }, { 30401 name: 'outline', 30402 title: (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview'), 30403 panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30404 className: "editor-list-view-sidebar__list-view-container", 30405 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {}) 30406 }) 30407 }], 30408 onClose: closeListView, 30409 onSelect: tabName => setTab(tabName), 30410 defaultTabId: "list-view", 30411 ref: tabsRef, 30412 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close') 30413 }) 30414 }) 30415 ); 30416 } 30417 30418 ;// ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js 30419 /** 30420 * WordPress dependencies 30421 */ 30422 30423 30424 30425 30426 30427 /** 30428 * Internal dependencies 30429 */ 30430 30431 30432 30433 30434 30435 30436 const { 30437 Fill: save_publish_panels_Fill, 30438 Slot: save_publish_panels_Slot 30439 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel'); 30440 const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill)); 30441 function SavePublishPanels({ 30442 setEntitiesSavedStatesCallback, 30443 closeEntitiesSavedStates, 30444 isEntitiesSavedStatesOpen, 30445 forceIsDirtyPublishPanel 30446 }) { 30447 const { 30448 closePublishSidebar, 30449 togglePublishSidebar 30450 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30451 const { 30452 publishSidebarOpened, 30453 isPublishable, 30454 isDirty, 30455 hasOtherEntitiesChanges 30456 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 30457 const { 30458 isPublishSidebarOpened, 30459 isEditedPostPublishable, 30460 isCurrentPostPublished, 30461 isEditedPostDirty, 30462 hasNonPostEntityChanges 30463 } = select(store_store); 30464 const _hasOtherEntitiesChanges = hasNonPostEntityChanges(); 30465 return { 30466 publishSidebarOpened: isPublishSidebarOpened(), 30467 isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(), 30468 isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(), 30469 hasOtherEntitiesChanges: _hasOtherEntitiesChanges 30470 }; 30471 }, []); 30472 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); 30473 30474 // It is ok for these components to be unmounted when not in visual use. 30475 // We don't want more than one present at a time, decide which to render. 30476 let unmountableContent; 30477 if (publishSidebarOpened) { 30478 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_panel, { 30479 onClose: closePublishSidebar, 30480 forceIsDirty: forceIsDirtyPublishPanel, 30481 PrePublishExtension: plugin_pre_publish_panel.Slot, 30482 PostPublishExtension: plugin_post_publish_panel.Slot 30483 }); 30484 } else if (isPublishable && !hasOtherEntitiesChanges) { 30485 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30486 className: "editor-layout__toggle-publish-panel", 30487 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30488 __next40pxDefaultSize: true, 30489 variant: "secondary", 30490 onClick: togglePublishSidebar, 30491 "aria-expanded": false, 30492 children: (0,external_wp_i18n_namespaceObject.__)('Open publish panel') 30493 }) 30494 }); 30495 } else { 30496 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 30497 className: "editor-layout__toggle-entities-saved-states-panel", 30498 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30499 __next40pxDefaultSize: true, 30500 variant: "secondary", 30501 onClick: openEntitiesSavedStates, 30502 "aria-expanded": false, 30503 "aria-haspopup": "dialog", 30504 disabled: !isDirty, 30505 accessibleWhenDisabled: true, 30506 children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') 30507 }) 30508 }); 30509 } 30510 30511 // Since EntitiesSavedStates controls its own panel, we can keep it 30512 // always mounted to retain its own component state (such as checkboxes). 30513 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 30514 children: [isEntitiesSavedStatesOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStates, { 30515 close: closeEntitiesSavedStates, 30516 renderDialog: true 30517 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, { 30518 bubblesVirtually: true 30519 }), !isEntitiesSavedStatesOpen && unmountableContent] 30520 }); 30521 } 30522 30523 ;// ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js 30524 /** 30525 * WordPress dependencies 30526 */ 30527 30528 30529 30530 30531 30532 30533 /** 30534 * Internal dependencies 30535 */ 30536 30537 30538 30539 30540 function TextEditor({ 30541 autoFocus = false 30542 }) { 30543 const { 30544 switchEditorMode 30545 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30546 const { 30547 shortcut, 30548 isRichEditingEnabled 30549 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 30550 const { 30551 getEditorSettings 30552 } = select(store_store); 30553 const { 30554 getShortcutRepresentation 30555 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 30556 return { 30557 shortcut: getShortcutRepresentation('core/editor/toggle-mode'), 30558 isRichEditingEnabled: getEditorSettings().richEditingEnabled 30559 }; 30560 }, []); 30561 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 30562 (0,external_wp_element_namespaceObject.useEffect)(() => { 30563 if (autoFocus) { 30564 return; 30565 } 30566 titleRef?.current?.focus(); 30567 }, [autoFocus]); 30568 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30569 className: "editor-text-editor", 30570 children: [isRichEditingEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30571 className: "editor-text-editor__toolbar", 30572 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 30573 children: (0,external_wp_i18n_namespaceObject.__)('Editing code') 30574 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 30575 __next40pxDefaultSize: true, 30576 variant: "tertiary", 30577 onClick: () => switchEditorMode('visual'), 30578 shortcut: shortcut, 30579 children: (0,external_wp_i18n_namespaceObject.__)('Exit code editor') 30580 })] 30581 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 30582 className: "editor-text-editor__body", 30583 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw, { 30584 ref: titleRef 30585 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {})] 30586 })] 30587 }); 30588 } 30589 30590 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js 30591 /** 30592 * WordPress dependencies 30593 */ 30594 30595 30596 30597 30598 30599 30600 /** 30601 * Internal dependencies 30602 */ 30603 30604 30605 /** 30606 * Component that: 30607 * 30608 * - Displays a 'Edit your template to edit this block' notification when the 30609 * user is focusing on editing page content and clicks on a disabled template 30610 * block. 30611 * - Displays a 'Edit your template to edit this block' dialog when the user 30612 * is focusing on editing page content and double clicks on a disabled 30613 * template block. 30614 * 30615 * @param {Object} props 30616 * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block 30617 * editor iframe canvas. 30618 */ 30619 30620 function EditTemplateBlocksNotification({ 30621 contentRef 30622 }) { 30623 const { 30624 onNavigateToEntityRecord, 30625 templateId 30626 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 30627 const { 30628 getEditorSettings, 30629 getCurrentTemplateId 30630 } = select(store_store); 30631 return { 30632 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 30633 templateId: getCurrentTemplateId() 30634 }; 30635 }, []); 30636 const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { 30637 kind: 'postType', 30638 name: 'wp_template' 30639 }), []); 30640 const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 30641 (0,external_wp_element_namespaceObject.useEffect)(() => { 30642 const handleDblClick = event => { 30643 if (!canEditTemplate) { 30644 return; 30645 } 30646 if (!event.target.classList.contains('is-root-container') || event.target.dataset?.type === 'core/template-part') { 30647 return; 30648 } 30649 if (!event.defaultPrevented) { 30650 event.preventDefault(); 30651 setIsDialogOpen(true); 30652 } 30653 }; 30654 const canvas = contentRef.current; 30655 canvas?.addEventListener('dblclick', handleDblClick); 30656 return () => { 30657 canvas?.removeEventListener('dblclick', handleDblClick); 30658 }; 30659 }, [contentRef, canEditTemplate]); 30660 if (!canEditTemplate) { 30661 return null; 30662 } 30663 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 30664 isOpen: isDialogOpen, 30665 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Edit template'), 30666 onConfirm: () => { 30667 setIsDialogOpen(false); 30668 onNavigateToEntityRecord({ 30669 postId: templateId, 30670 postType: 'wp_template' 30671 }); 30672 }, 30673 onCancel: () => setIsDialogOpen(false), 30674 size: "medium", 30675 children: (0,external_wp_i18n_namespaceObject.__)('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?') 30676 }); 30677 } 30678 30679 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js 30680 /** 30681 * WordPress dependencies 30682 */ 30683 30684 30685 30686 30687 const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. 30688 30689 function ResizeHandle({ 30690 direction, 30691 resizeWidthBy 30692 }) { 30693 function handleKeyDown(event) { 30694 const { 30695 keyCode 30696 } = event; 30697 if (keyCode !== external_wp_keycodes_namespaceObject.LEFT && keyCode !== external_wp_keycodes_namespaceObject.RIGHT) { 30698 return; 30699 } 30700 event.preventDefault(); 30701 if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { 30702 resizeWidthBy(DELTA_DISTANCE); 30703 } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { 30704 resizeWidthBy(-DELTA_DISTANCE); 30705 } 30706 } 30707 const resizeHandleVariants = { 30708 active: { 30709 opacity: 1, 30710 scaleY: 1.3 30711 } 30712 }; 30713 const resizableHandleHelpId = `resizable-editor__resize-help-$direction}`; 30714 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 30715 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 30716 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 30717 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { 30718 className: `editor-resizable-editor__resize-handle is-$direction}`, 30719 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 30720 "aria-describedby": resizableHandleHelpId, 30721 onKeyDown: handleKeyDown, 30722 variants: resizeHandleVariants, 30723 whileFocus: "active", 30724 whileHover: "active", 30725 whileTap: "active", 30726 role: "separator", 30727 "aria-orientation": "vertical" 30728 }, "handle") 30729 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 30730 id: resizableHandleHelpId, 30731 children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.') 30732 })] 30733 }); 30734 } 30735 30736 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js 30737 /** 30738 * External dependencies 30739 */ 30740 30741 30742 /** 30743 * WordPress dependencies 30744 */ 30745 30746 30747 30748 /** 30749 * Internal dependencies 30750 */ 30751 30752 30753 // Removes the inline styles in the drag handles. 30754 30755 const HANDLE_STYLES_OVERRIDE = { 30756 position: undefined, 30757 userSelect: undefined, 30758 cursor: undefined, 30759 width: undefined, 30760 height: undefined, 30761 top: undefined, 30762 right: undefined, 30763 bottom: undefined, 30764 left: undefined 30765 }; 30766 function ResizableEditor({ 30767 className, 30768 enableResizing, 30769 height, 30770 children 30771 }) { 30772 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)('100%'); 30773 const resizableRef = (0,external_wp_element_namespaceObject.useRef)(); 30774 const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { 30775 if (resizableRef.current) { 30776 setWidth(resizableRef.current.offsetWidth + deltaPixels); 30777 } 30778 }, []); 30779 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { 30780 className: dist_clsx('editor-resizable-editor', className, { 30781 'is-resizable': enableResizing 30782 }), 30783 ref: api => { 30784 resizableRef.current = api?.resizable; 30785 }, 30786 size: { 30787 width: enableResizing ? width : '100%', 30788 height: enableResizing && height ? height : '100%' 30789 }, 30790 onResizeStop: (event, direction, element) => { 30791 setWidth(element.style.width); 30792 }, 30793 minWidth: 300, 30794 maxWidth: "100%", 30795 maxHeight: "100%", 30796 enable: { 30797 left: enableResizing, 30798 right: enableResizing 30799 }, 30800 showHandle: enableResizing 30801 // The editor is centered horizontally, resizing it only 30802 // moves half the distance. Hence double the ratio to correctly 30803 // align the cursor to the resizer handle. 30804 , 30805 resizeRatio: 2, 30806 handleComponent: { 30807 left: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { 30808 direction: "left", 30809 resizeWidthBy: resizeWidthBy 30810 }), 30811 right: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { 30812 direction: "right", 30813 resizeWidthBy: resizeWidthBy 30814 }) 30815 }, 30816 handleClasses: undefined, 30817 handleStyles: { 30818 left: HANDLE_STYLES_OVERRIDE, 30819 right: HANDLE_STYLES_OVERRIDE 30820 }, 30821 children: children 30822 }); 30823 } 30824 /* harmony default export */ const resizable_editor = (ResizableEditor); 30825 30826 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-select-nearest-editable-block.js 30827 /* wp:polyfill */ 30828 /** 30829 * WordPress dependencies 30830 */ 30831 30832 30833 30834 30835 /** 30836 * Internal dependencies 30837 */ 30838 30839 const DISTANCE_THRESHOLD = 500; 30840 function clamp(value, min, max) { 30841 return Math.min(Math.max(value, min), max); 30842 } 30843 function distanceFromRect(x, y, rect) { 30844 const dx = x - clamp(x, rect.left, rect.right); 30845 const dy = y - clamp(y, rect.top, rect.bottom); 30846 return Math.sqrt(dx * dx + dy * dy); 30847 } 30848 function useSelectNearestEditableBlock({ 30849 isEnabled = true 30850 } = {}) { 30851 const { 30852 getEnabledClientIdsTree, 30853 getBlockName, 30854 getBlockOrder 30855 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); 30856 const { 30857 selectBlock 30858 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 30859 return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { 30860 if (!isEnabled) { 30861 return; 30862 } 30863 const selectNearestEditableBlock = (x, y) => { 30864 const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ 30865 clientId 30866 }) => { 30867 const blockName = getBlockName(clientId); 30868 if (blockName === 'core/template-part') { 30869 return []; 30870 } 30871 if (blockName === 'core/post-content') { 30872 const innerBlocks = getBlockOrder(clientId); 30873 if (innerBlocks.length) { 30874 return innerBlocks; 30875 } 30876 } 30877 return [clientId]; 30878 }); 30879 let nearestDistance = Infinity, 30880 nearestClientId = null; 30881 for (const clientId of editableBlockClientIds) { 30882 const block = element.querySelector(`[data-block="$clientId}"]`); 30883 if (!block) { 30884 continue; 30885 } 30886 const rect = block.getBoundingClientRect(); 30887 const distance = distanceFromRect(x, y, rect); 30888 if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) { 30889 nearestDistance = distance; 30890 nearestClientId = clientId; 30891 } 30892 } 30893 if (nearestClientId) { 30894 selectBlock(nearestClientId); 30895 } 30896 }; 30897 const handleClick = event => { 30898 const shouldSelect = event.target === element || event.target.classList.contains('is-root-container'); 30899 if (shouldSelect) { 30900 selectNearestEditableBlock(event.clientX, event.clientY); 30901 } 30902 }; 30903 element.addEventListener('click', handleClick); 30904 return () => element.removeEventListener('click', handleClick); 30905 }, [isEnabled]); 30906 } 30907 30908 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-zoom-out-mode-exit.js 30909 /** 30910 * WordPress dependencies 30911 */ 30912 30913 30914 30915 30916 /** 30917 * Internal dependencies 30918 */ 30919 30920 30921 /** 30922 * Allows Zoom Out mode to be exited by double clicking in the selected block. 30923 */ 30924 function useZoomOutModeExit() { 30925 const { 30926 getSettings, 30927 isZoomOut 30928 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); 30929 const { 30930 resetZoomLevel 30931 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 30932 return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { 30933 function onDoubleClick(event) { 30934 if (!isZoomOut()) { 30935 return; 30936 } 30937 if (!event.defaultPrevented) { 30938 event.preventDefault(); 30939 const { 30940 __experimentalSetIsInserterOpened 30941 } = getSettings(); 30942 if (typeof __experimentalSetIsInserterOpened === 'function') { 30943 __experimentalSetIsInserterOpened(false); 30944 } 30945 resetZoomLevel(); 30946 } 30947 } 30948 node.addEventListener('dblclick', onDoubleClick); 30949 return () => { 30950 node.removeEventListener('dblclick', onDoubleClick); 30951 }; 30952 }, [getSettings, isZoomOut, resetZoomLevel]); 30953 } 30954 30955 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js 30956 /** 30957 * External dependencies 30958 */ 30959 30960 30961 /** 30962 * WordPress dependencies 30963 */ 30964 30965 30966 30967 30968 30969 30970 30971 /** 30972 * Internal dependencies 30973 */ 30974 30975 30976 30977 30978 30979 30980 30981 30982 30983 const { 30984 LayoutStyle, 30985 useLayoutClasses, 30986 useLayoutStyles, 30987 ExperimentalBlockCanvas: BlockCanvas, 30988 useFlashEditableBlocks 30989 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 30990 30991 /** 30992 * These post types have a special editor where they don't allow you to fill the title 30993 * and they don't apply the layout styles. 30994 */ 30995 const visual_editor_DESIGN_POST_TYPES = [PATTERN_POST_TYPE, TEMPLATE_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE]; 30996 30997 /** 30998 * Given an array of nested blocks, find the first Post Content 30999 * block inside it, recursing through any nesting levels, 31000 * and return its attributes. 31001 * 31002 * @param {Array} blocks A list of blocks. 31003 * 31004 * @return {Object | undefined} The Post Content block. 31005 */ 31006 function getPostContentAttributes(blocks) { 31007 for (let i = 0; i < blocks.length; i++) { 31008 if (blocks[i].name === 'core/post-content') { 31009 return blocks[i].attributes; 31010 } 31011 if (blocks[i].innerBlocks.length) { 31012 const nestedPostContent = getPostContentAttributes(blocks[i].innerBlocks); 31013 if (nestedPostContent) { 31014 return nestedPostContent; 31015 } 31016 } 31017 } 31018 } 31019 function checkForPostContentAtRootLevel(blocks) { 31020 for (let i = 0; i < blocks.length; i++) { 31021 if (blocks[i].name === 'core/post-content') { 31022 return true; 31023 } 31024 } 31025 return false; 31026 } 31027 function VisualEditor({ 31028 // Ideally as we unify post and site editors, we won't need these props. 31029 autoFocus, 31030 styles, 31031 disableIframe = false, 31032 iframeProps, 31033 contentRef, 31034 className 31035 }) { 31036 const [contentHeight, setContentHeight] = (0,external_wp_element_namespaceObject.useState)(''); 31037 const effectContentHeight = (0,external_wp_compose_namespaceObject.useResizeObserver)(([entry]) => { 31038 setContentHeight(entry.borderBoxSize[0].blockSize); 31039 }); 31040 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 31041 const { 31042 renderingMode, 31043 postContentAttributes, 31044 editedPostTemplate = {}, 31045 wrapperBlockName, 31046 wrapperUniqueId, 31047 deviceType, 31048 isFocusedEntity, 31049 isDesignPostType, 31050 postType, 31051 isPreview 31052 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31053 const { 31054 getCurrentPostId, 31055 getCurrentPostType, 31056 getCurrentTemplateId, 31057 getEditorSettings, 31058 getRenderingMode, 31059 getDeviceType 31060 } = select(store_store); 31061 const { 31062 getPostType, 31063 getEditedEntityRecord 31064 } = select(external_wp_coreData_namespaceObject.store); 31065 const postTypeSlug = getCurrentPostType(); 31066 const _renderingMode = getRenderingMode(); 31067 let _wrapperBlockName; 31068 if (postTypeSlug === PATTERN_POST_TYPE) { 31069 _wrapperBlockName = 'core/block'; 31070 } else if (_renderingMode === 'post-only') { 31071 _wrapperBlockName = 'core/post-content'; 31072 } 31073 const editorSettings = getEditorSettings(); 31074 const supportsTemplateMode = editorSettings.supportsTemplateMode; 31075 const postTypeObject = getPostType(postTypeSlug); 31076 const currentTemplateId = getCurrentTemplateId(); 31077 const template = currentTemplateId ? getEditedEntityRecord('postType', TEMPLATE_POST_TYPE, currentTemplateId) : undefined; 31078 return { 31079 renderingMode: _renderingMode, 31080 postContentAttributes: editorSettings.postContentAttributes, 31081 isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug), 31082 // Post template fetch returns a 404 on classic themes, which 31083 // messes with e2e tests, so check it's a block theme first. 31084 editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template : undefined, 31085 wrapperBlockName: _wrapperBlockName, 31086 wrapperUniqueId: getCurrentPostId(), 31087 deviceType: getDeviceType(), 31088 isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord, 31089 postType: postTypeSlug, 31090 isPreview: editorSettings.isPreviewMode 31091 }; 31092 }, []); 31093 const { 31094 isCleanNewPost 31095 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 31096 const { 31097 hasRootPaddingAwareAlignments, 31098 themeHasDisabledLayoutStyles, 31099 themeSupportsLayout, 31100 isZoomedOut 31101 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31102 const { 31103 getSettings, 31104 isZoomOut: _isZoomOut 31105 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 31106 const _settings = getSettings(); 31107 return { 31108 themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, 31109 themeSupportsLayout: _settings.supportsLayout, 31110 hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments, 31111 isZoomedOut: _isZoomOut() 31112 }; 31113 }, []); 31114 const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); 31115 const [globalLayoutSettings] = (0,external_wp_blockEditor_namespaceObject.useSettings)('layout'); 31116 31117 // fallbackLayout is used if there is no Post Content, 31118 // and for Post Title. 31119 const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 31120 if (renderingMode !== 'post-only' || isDesignPostType) { 31121 return { 31122 type: 'default' 31123 }; 31124 } 31125 if (themeSupportsLayout) { 31126 // We need to ensure support for wide and full alignments, 31127 // so we add the constrained type. 31128 return { 31129 ...globalLayoutSettings, 31130 type: 'constrained' 31131 }; 31132 } 31133 // Set default layout for classic themes so all alignments are supported. 31134 return { 31135 type: 'default' 31136 }; 31137 }, [renderingMode, themeSupportsLayout, globalLayoutSettings, isDesignPostType]); 31138 const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { 31139 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { 31140 return postContentAttributes; 31141 } 31142 // When in template editing mode, we can access the blocks directly. 31143 if (editedPostTemplate?.blocks) { 31144 return getPostContentAttributes(editedPostTemplate?.blocks); 31145 } 31146 // If there are no blocks, we have to parse the content string. 31147 // Best double-check it's a string otherwise the parse function gets unhappy. 31148 const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; 31149 return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; 31150 }, [editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes]); 31151 const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { 31152 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { 31153 return false; 31154 } 31155 // When in template editing mode, we can access the blocks directly. 31156 if (editedPostTemplate?.blocks) { 31157 return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); 31158 } 31159 // If there are no blocks, we have to parse the content string. 31160 // Best double-check it's a string otherwise the parse function gets unhappy. 31161 const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; 31162 return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; 31163 }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); 31164 const { 31165 layout = {}, 31166 align = '' 31167 } = newestPostContentAttributes || {}; 31168 const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content'); 31169 const blockListLayoutClass = dist_clsx({ 31170 'is-layout-flow': !themeSupportsLayout 31171 }, themeSupportsLayout && postContentLayoutClasses, align && `align$align}`); 31172 const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container'); 31173 31174 // Update type for blocks using legacy layouts. 31175 const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 31176 return layout && (layout?.type === 'constrained' || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { 31177 ...globalLayoutSettings, 31178 ...layout, 31179 type: 'constrained' 31180 } : { 31181 ...globalLayoutSettings, 31182 ...layout, 31183 type: 'default' 31184 }; 31185 }, [layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings]); 31186 31187 // If there is a Post Content block we use its layout for the block list; 31188 // if not, this must be a classic theme, in which case we use the fallback layout. 31189 const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; 31190 const postEditorLayout = blockListLayout?.type === 'default' && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; 31191 const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); 31192 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 31193 (0,external_wp_element_namespaceObject.useEffect)(() => { 31194 if (!autoFocus || !isCleanNewPost()) { 31195 return; 31196 } 31197 titleRef?.current?.focus(); 31198 }, [autoFocus, isCleanNewPost]); 31199 31200 // Add some styles for alignwide/alignfull Post Content and its children. 31201 const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} 31202 .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} 31203 .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} 31204 .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; 31205 const forceFullHeight = postType === NAVIGATION_POST_TYPE; 31206 const enableResizing = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) && 31207 // Disable in previews / view mode. 31208 !isPreview && 31209 // Disable resizing in mobile viewport. 31210 !isMobileViewport && 31211 // Disable resizing in zoomed-out mode. 31212 !isZoomedOut; 31213 const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 31214 return [...(styles !== null && styles !== void 0 ? styles : []), { 31215 // Ensures margins of children are contained so that the body background paints behind them. 31216 // Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s 31217 // important mostly for post-only views yet conceivably an issue in templated views too. 31218 css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${ 31219 // Some themes will have `min-height: 100vh` for the root container, 31220 // which isn't a requirement in auto resize mode. 31221 enableResizing ? 'min-height:0!important;' : ''}}` 31222 }]; 31223 }, [styles, enableResizing]); 31224 const localRef = (0,external_wp_element_namespaceObject.useRef)(); 31225 const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(); 31226 contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([localRef, contentRef, renderingMode === 'post-only' ? typewriterRef : null, useFlashEditableBlocks({ 31227 isEnabled: renderingMode === 'template-locked' 31228 }), useSelectNearestEditableBlock({ 31229 isEnabled: renderingMode === 'template-locked' 31230 }), useZoomOutModeExit(), 31231 // Avoid resize listeners when not needed, these will trigger 31232 // unnecessary re-renders when animating the iframe width. 31233 enableResizing ? effectContentHeight : null]); 31234 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31235 className: dist_clsx('editor-visual-editor', 31236 // this class is here for backward compatibility reasons. 31237 'edit-post-visual-editor', className, { 31238 'has-padding': isFocusedEntity || enableResizing, 31239 'is-resizable': enableResizing, 31240 'is-iframed': !disableIframe, 31241 'is-scrollable': disableIframe || deviceType !== 'Desktop' 31242 }), 31243 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor, { 31244 enableResizing: enableResizing, 31245 height: contentHeight && !forceFullHeight ? contentHeight : '100%', 31246 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockCanvas, { 31247 shouldIframe: !disableIframe, 31248 contentRef: contentRef, 31249 styles: iframeStyles, 31250 height: "100%", 31251 iframeProps: { 31252 ...iframeProps, 31253 style: { 31254 ...iframeProps?.style, 31255 ...deviceStyles 31256 } 31257 }, 31258 children: [themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31259 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 31260 selector: ".editor-visual-editor__post-title-wrapper", 31261 layout: fallbackLayout 31262 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 31263 selector: ".block-editor-block-list__layout.is-root-container", 31264 layout: postEditorLayout 31265 }), align && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 31266 css: alignCSS 31267 }), postContentLayoutStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 31268 layout: postContentLayout, 31269 css: postContentLayoutStyles 31270 })] 31271 }), renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 31272 className: dist_clsx('editor-visual-editor__post-title-wrapper', 31273 // The following class is only here for backward compatibility 31274 // some themes might be using it to style the post title. 31275 'edit-post-visual-editor__post-title-wrapper', { 31276 'has-global-padding': hasRootPaddingAwareAlignments 31277 }), 31278 contentEditable: false, 31279 ref: observeTypingRef, 31280 style: { 31281 // This is using inline styles 31282 // so it's applied for both iframed and non iframed editors. 31283 marginTop: '4rem' 31284 }, 31285 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title, { 31286 ref: titleRef 31287 }) 31288 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.RecursionProvider, { 31289 blockName: wrapperBlockName, 31290 uniqueId: wrapperUniqueId, 31291 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 31292 className: dist_clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `$blockListLayoutClass} wp-block-post-content`, 31293 // Ensure root level blocks receive default/flow blockGap styling rules. 31294 { 31295 'has-global-padding': renderingMode === 'post-only' && !isDesignPostType && hasRootPaddingAwareAlignments 31296 }), 31297 layout: blockListLayout, 31298 dropZoneElement: 31299 // When iframed, pass in the html element of the iframe to 31300 // ensure the drop zone extends to the edges of the iframe. 31301 disableIframe ? localRef.current : localRef.current?.parentNode, 31302 __unstableDisableDropZone: 31303 // In template preview mode, disable drop zones at the root of the template. 31304 renderingMode === 'template-locked' ? true : false 31305 }), renderingMode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditTemplateBlocksNotification, { 31306 contentRef: localRef 31307 })] 31308 })] 31309 }) 31310 }) 31311 }); 31312 } 31313 /* harmony default export */ const visual_editor = (VisualEditor); 31314 31315 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js 31316 /** 31317 * External dependencies 31318 */ 31319 31320 31321 /** 31322 * WordPress dependencies 31323 */ 31324 31325 31326 31327 31328 31329 31330 31331 31332 /** 31333 * Internal dependencies 31334 */ 31335 31336 31337 31338 31339 31340 31341 31342 31343 31344 31345 const interfaceLabels = { 31346 /* translators: accessibility text for the editor top bar landmark region. */ 31347 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), 31348 /* translators: accessibility text for the editor content landmark region. */ 31349 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'), 31350 /* translators: accessibility text for the editor settings landmark region. */ 31351 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'), 31352 /* translators: accessibility text for the editor publish landmark region. */ 31353 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'), 31354 /* translators: accessibility text for the editor footer landmark region. */ 31355 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer') 31356 }; 31357 function EditorInterface({ 31358 className, 31359 styles, 31360 children, 31361 forceIsDirty, 31362 contentRef, 31363 disableIframe, 31364 autoFocus, 31365 customSaveButton, 31366 customSavePanel, 31367 forceDisableBlockTools, 31368 title, 31369 iframeProps 31370 }) { 31371 const { 31372 mode, 31373 isRichEditingEnabled, 31374 isInserterOpened, 31375 isListViewOpened, 31376 isDistractionFree, 31377 isPreviewMode, 31378 showBlockBreadcrumbs, 31379 documentLabel 31380 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31381 const { 31382 get 31383 } = select(external_wp_preferences_namespaceObject.store); 31384 const { 31385 getEditorSettings, 31386 getPostTypeLabel 31387 } = select(store_store); 31388 const editorSettings = getEditorSettings(); 31389 const postTypeLabel = getPostTypeLabel(); 31390 return { 31391 mode: select(store_store).getEditorMode(), 31392 isRichEditingEnabled: editorSettings.richEditingEnabled, 31393 isInserterOpened: select(store_store).isInserterOpened(), 31394 isListViewOpened: select(store_store).isListViewOpened(), 31395 isDistractionFree: get('core', 'distractionFree'), 31396 isPreviewMode: editorSettings.isPreviewMode, 31397 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 31398 documentLabel: 31399 // translators: Default label for the Document in the Block Breadcrumb. 31400 postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, breadcrumb') 31401 }; 31402 }, []); 31403 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 31404 const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); 31405 31406 // Local state for save panel. 31407 // Note 'truthy' callback implies an open panel. 31408 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); 31409 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { 31410 if (typeof entitiesSavedStatesCallback === 'function') { 31411 entitiesSavedStatesCallback(arg); 31412 } 31413 setEntitiesSavedStatesCallback(false); 31414 }, [entitiesSavedStatesCallback]); 31415 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, { 31416 isDistractionFree: isDistractionFree, 31417 className: dist_clsx('editor-editor-interface', className, { 31418 'is-entity-save-view-open': !!entitiesSavedStatesCallback, 31419 'is-distraction-free': isDistractionFree && !isPreviewMode 31420 }), 31421 labels: { 31422 ...interfaceLabels, 31423 secondarySidebar: secondarySidebarLabel 31424 }, 31425 header: !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_header, { 31426 forceIsDirty: forceIsDirty, 31427 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, 31428 customSaveButton: customSaveButton, 31429 forceDisableBlockTools: forceDisableBlockTools, 31430 title: title 31431 }), 31432 editorNotices: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), 31433 secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})), 31434 sidebar: !isPreviewMode && !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, { 31435 scope: "core" 31436 }), 31437 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31438 children: [!isDistractionFree && !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill.Slot, { 31439 children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 31440 children: [!isPreviewMode && (mode === 'text' || !isRichEditingEnabled) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextEditor 31441 // We should auto-focus the canvas (title) on load. 31442 // eslint-disable-next-line jsx-a11y/no-autofocus 31443 , { 31444 autoFocus: autoFocus 31445 }), !isPreviewMode && !isLargeViewport && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 31446 hideDragHandle: true 31447 }), (isPreviewMode || isRichEditingEnabled && mode === 'visual') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visual_editor, { 31448 styles: styles, 31449 contentRef: contentRef, 31450 disableIframe: disableIframe 31451 // We should auto-focus the canvas (title) on load. 31452 // eslint-disable-next-line jsx-a11y/no-autofocus 31453 , 31454 autoFocus: autoFocus, 31455 iframeProps: iframeProps 31456 }), children] 31457 }) 31458 })] 31459 }), 31460 footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { 31461 rootLabelText: documentLabel 31462 }), 31463 actions: !isPreviewMode ? customSavePanel || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePublishPanels, { 31464 closeEntitiesSavedStates: closeEntitiesSavedStates, 31465 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, 31466 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, 31467 forceIsDirtyPublishPanel: forceIsDirty 31468 }) : undefined 31469 }); 31470 } 31471 31472 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js 31473 /** 31474 * WordPress dependencies 31475 */ 31476 31477 31478 31479 /** 31480 * Internal dependencies 31481 */ 31482 31483 31484 31485 const { 31486 OverridesPanel 31487 } = unlock(external_wp_patterns_namespaceObject.privateApis); 31488 function PatternOverridesPanel() { 31489 const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === 'wp_block', []); 31490 if (!supportsPatternOverridesPanel) { 31491 return null; 31492 } 31493 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {}); 31494 } 31495 31496 ;// ./node_modules/@wordpress/editor/build-module/utils/get-item-title.js 31497 /** 31498 * WordPress dependencies 31499 */ 31500 31501 31502 /** 31503 * Helper function to get the title of a post item. 31504 * This is duplicated from the `@wordpress/fields` package. 31505 * `packages/fields/src/actions/utils.ts` 31506 * 31507 * @param {Object} item The post item. 31508 * @return {string} The title of the item, or an empty string if the title is not found. 31509 */ 31510 function get_item_title_getItemTitle(item) { 31511 if (typeof item.title === 'string') { 31512 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 31513 } 31514 if (item.title && 'rendered' in item.title) { 31515 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 31516 } 31517 if (item.title && 'raw' in item.title) { 31518 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 31519 } 31520 return ''; 31521 } 31522 31523 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-homepage.js 31524 /** 31525 * WordPress dependencies 31526 */ 31527 31528 31529 31530 31531 31532 31533 31534 /** 31535 * Internal dependencies 31536 */ 31537 31538 31539 const SetAsHomepageModal = ({ 31540 items, 31541 closeModal 31542 }) => { 31543 const [item] = items; 31544 const pageTitle = get_item_title_getItemTitle(item); 31545 const { 31546 showOnFront, 31547 currentHomePage, 31548 isSaving 31549 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31550 const { 31551 getEntityRecord, 31552 isSavingEntityRecord 31553 } = select(external_wp_coreData_namespaceObject.store); 31554 const siteSettings = getEntityRecord('root', 'site'); 31555 const currentHomePageItem = getEntityRecord('postType', 'page', siteSettings?.page_on_front); 31556 return { 31557 showOnFront: siteSettings?.show_on_front, 31558 currentHomePage: currentHomePageItem, 31559 isSaving: isSavingEntityRecord('root', 'site') 31560 }; 31561 }); 31562 const { 31563 saveEntityRecord 31564 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 31565 const { 31566 createSuccessNotice, 31567 createErrorNotice 31568 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 31569 async function onSetPageAsHomepage(event) { 31570 event.preventDefault(); 31571 try { 31572 await saveEntityRecord('root', 'site', { 31573 page_on_front: item.id, 31574 show_on_front: 'page' 31575 }); 31576 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Homepage updated.'), { 31577 type: 'snackbar' 31578 }); 31579 } catch (error) { 31580 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while setting the homepage.'); 31581 createErrorNotice(errorMessage, { 31582 type: 'snackbar' 31583 }); 31584 } finally { 31585 closeModal?.(); 31586 } 31587 } 31588 let modalWarning = ''; 31589 if ('posts' === showOnFront) { 31590 modalWarning = (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage which is set to display latest posts.'); 31591 } else if (currentHomePage) { 31592 modalWarning = (0,external_wp_i18n_namespaceObject.sprintf)( 31593 // translators: %s: title of the current home page. 31594 (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage: "%s"'), get_item_title_getItemTitle(currentHomePage)); 31595 } 31596 const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( 31597 // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message. 31598 (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the site homepage? %2$s'), pageTitle, modalWarning).trim(); 31599 31600 // translators: Button label to confirm setting the specified page as the homepage. 31601 const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)('Set homepage'); 31602 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 31603 onSubmit: onSetPageAsHomepage, 31604 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 31605 spacing: "5", 31606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 31607 children: modalText 31608 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31609 justify: "right", 31610 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31611 __next40pxDefaultSize: true, 31612 variant: "tertiary", 31613 onClick: () => { 31614 closeModal?.(); 31615 }, 31616 disabled: isSaving, 31617 accessibleWhenDisabled: true, 31618 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 31619 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31620 __next40pxDefaultSize: true, 31621 variant: "primary", 31622 type: "submit", 31623 disabled: isSaving, 31624 accessibleWhenDisabled: true, 31625 children: modalButtonLabel 31626 })] 31627 })] 31628 }) 31629 }); 31630 }; 31631 const useSetAsHomepageAction = () => { 31632 const { 31633 pageOnFront, 31634 pageForPosts 31635 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31636 const { 31637 getEntityRecord, 31638 canUser 31639 } = select(external_wp_coreData_namespaceObject.store); 31640 const siteSettings = canUser('read', { 31641 kind: 'root', 31642 name: 'site' 31643 }) ? getEntityRecord('root', 'site') : undefined; 31644 return { 31645 pageOnFront: siteSettings?.page_on_front, 31646 pageForPosts: siteSettings?.page_for_posts 31647 }; 31648 }); 31649 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 31650 id: 'set-as-homepage', 31651 label: (0,external_wp_i18n_namespaceObject.__)('Set as homepage'), 31652 isEligible(post) { 31653 if (post.status !== 'publish') { 31654 return false; 31655 } 31656 if (post.type !== 'page') { 31657 return false; 31658 } 31659 31660 // Don't show the action if the page is already set as the homepage. 31661 if (pageOnFront === post.id) { 31662 return false; 31663 } 31664 31665 // Don't show the action if the page is already set as the page for posts. 31666 if (pageForPosts === post.id) { 31667 return false; 31668 } 31669 return true; 31670 }, 31671 RenderModal: SetAsHomepageModal 31672 }), [pageForPosts, pageOnFront]); 31673 }; 31674 31675 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-posts-page.js 31676 /** 31677 * WordPress dependencies 31678 */ 31679 31680 31681 31682 31683 31684 31685 31686 /** 31687 * Internal dependencies 31688 */ 31689 31690 31691 const SetAsPostsPageModal = ({ 31692 items, 31693 closeModal 31694 }) => { 31695 const [item] = items; 31696 const pageTitle = get_item_title_getItemTitle(item); 31697 const { 31698 currentPostsPage, 31699 isPageForPostsSet, 31700 isSaving 31701 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31702 const { 31703 getEntityRecord, 31704 isSavingEntityRecord 31705 } = select(external_wp_coreData_namespaceObject.store); 31706 const siteSettings = getEntityRecord('root', 'site'); 31707 const currentPostsPageItem = getEntityRecord('postType', 'page', siteSettings?.page_for_posts); 31708 return { 31709 currentPostsPage: currentPostsPageItem, 31710 isPageForPostsSet: siteSettings?.page_for_posts !== 0, 31711 isSaving: isSavingEntityRecord('root', 'site') 31712 }; 31713 }); 31714 const { 31715 saveEntityRecord 31716 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 31717 const { 31718 createSuccessNotice, 31719 createErrorNotice 31720 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 31721 async function onSetPageAsPostsPage(event) { 31722 event.preventDefault(); 31723 try { 31724 await saveEntityRecord('root', 'site', { 31725 page_for_posts: item.id, 31726 show_on_front: 'page' 31727 }); 31728 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Posts page updated.'), { 31729 type: 'snackbar' 31730 }); 31731 } catch (error) { 31732 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while setting the posts page.'); 31733 createErrorNotice(errorMessage, { 31734 type: 'snackbar' 31735 }); 31736 } finally { 31737 closeModal?.(); 31738 } 31739 } 31740 const modalWarning = isPageForPostsSet && currentPostsPage ? (0,external_wp_i18n_namespaceObject.sprintf)( 31741 // translators: %s: title of the current posts page. 31742 (0,external_wp_i18n_namespaceObject.__)('This will replace the current posts page: "%s"'), get_item_title_getItemTitle(currentPostsPage)) : (0,external_wp_i18n_namespaceObject.__)('This page will show the latest posts.'); 31743 const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( 31744 // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message. 31745 (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the posts page? %2$s'), pageTitle, modalWarning); 31746 31747 // translators: Button label to confirm setting the specified page as the posts page. 31748 const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)('Set posts page'); 31749 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 31750 onSubmit: onSetPageAsPostsPage, 31751 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 31752 spacing: "5", 31753 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 31754 children: modalText 31755 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 31756 justify: "right", 31757 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31758 __next40pxDefaultSize: true, 31759 variant: "tertiary", 31760 onClick: () => { 31761 closeModal?.(); 31762 }, 31763 disabled: isSaving, 31764 accessibleWhenDisabled: true, 31765 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 31766 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 31767 __next40pxDefaultSize: true, 31768 variant: "primary", 31769 type: "submit", 31770 disabled: isSaving, 31771 accessibleWhenDisabled: true, 31772 children: modalButtonLabel 31773 })] 31774 })] 31775 }) 31776 }); 31777 }; 31778 const useSetAsPostsPageAction = () => { 31779 const { 31780 pageOnFront, 31781 pageForPosts 31782 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31783 const { 31784 getEntityRecord, 31785 canUser 31786 } = select(external_wp_coreData_namespaceObject.store); 31787 const siteSettings = canUser('read', { 31788 kind: 'root', 31789 name: 'site' 31790 }) ? getEntityRecord('root', 'site') : undefined; 31791 return { 31792 pageOnFront: siteSettings?.page_on_front, 31793 pageForPosts: siteSettings?.page_for_posts 31794 }; 31795 }); 31796 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ 31797 id: 'set-as-posts-page', 31798 label: (0,external_wp_i18n_namespaceObject.__)('Set as posts page'), 31799 isEligible(post) { 31800 if (post.status !== 'publish') { 31801 return false; 31802 } 31803 if (post.type !== 'page') { 31804 return false; 31805 } 31806 31807 // Don't show the action if the page is already set as the homepage. 31808 if (pageOnFront === post.id) { 31809 return false; 31810 } 31811 31812 // Don't show the action if the page is already set as the page for posts. 31813 if (pageForPosts === post.id) { 31814 return false; 31815 } 31816 return true; 31817 }, 31818 RenderModal: SetAsPostsPageModal 31819 }), [pageForPosts, pageOnFront]); 31820 }; 31821 31822 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js 31823 /* wp:polyfill */ 31824 /** 31825 * WordPress dependencies 31826 */ 31827 31828 31829 31830 31831 /** 31832 * Internal dependencies 31833 */ 31834 31835 31836 31837 31838 31839 function usePostActions({ 31840 postType, 31841 onActionPerformed, 31842 context 31843 }) { 31844 const { 31845 defaultActions 31846 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31847 const { 31848 getEntityActions 31849 } = unlock(select(store_store)); 31850 return { 31851 defaultActions: getEntityActions('postType', postType) 31852 }; 31853 }, [postType]); 31854 const { 31855 canManageOptions, 31856 hasFrontPageTemplate 31857 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31858 const { 31859 getEntityRecords 31860 } = select(external_wp_coreData_namespaceObject.store); 31861 const templates = getEntityRecords('postType', 'wp_template', { 31862 per_page: -1 31863 }); 31864 return { 31865 canManageOptions: select(external_wp_coreData_namespaceObject.store).canUser('update', { 31866 kind: 'root', 31867 name: 'site' 31868 }), 31869 hasFrontPageTemplate: !!templates?.find(template => template?.slug === 'front-page') 31870 }; 31871 }); 31872 const setAsHomepageAction = useSetAsHomepageAction(); 31873 const setAsPostsPageAction = useSetAsPostsPageAction(); 31874 const shouldShowHomepageActions = canManageOptions && !hasFrontPageTemplate; 31875 const { 31876 registerPostTypeSchema 31877 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 31878 (0,external_wp_element_namespaceObject.useEffect)(() => { 31879 registerPostTypeSchema(postType); 31880 }, [registerPostTypeSchema, postType]); 31881 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31882 let actions = [...defaultActions]; 31883 if (shouldShowHomepageActions) { 31884 actions.push(setAsHomepageAction, setAsPostsPageAction); 31885 } 31886 31887 // Ensure "Move to trash" is always the last action. 31888 actions = actions.sort((a, b) => b.id === 'move-to-trash' ? -1 : 0); 31889 31890 // Filter actions based on provided context. If not provided 31891 // all actions are returned. We'll have a single entry for getting the actions 31892 // and the consumer should provide the context to filter the actions, if needed. 31893 // Actions should also provide the `context` they support, if it's specific, to 31894 // compare with the provided context to get all the actions. 31895 // Right now the only supported context is `list`. 31896 actions = actions.filter(action => { 31897 if (!action.context) { 31898 return true; 31899 } 31900 return action.context === context; 31901 }); 31902 if (onActionPerformed) { 31903 for (let i = 0; i < actions.length; ++i) { 31904 if (actions[i].callback) { 31905 const existingCallback = actions[i].callback; 31906 actions[i] = { 31907 ...actions[i], 31908 callback: (items, argsObject) => { 31909 existingCallback(items, { 31910 ...argsObject, 31911 onActionPerformed: _items => { 31912 if (argsObject?.onActionPerformed) { 31913 argsObject.onActionPerformed(_items); 31914 } 31915 onActionPerformed(actions[i].id, _items); 31916 } 31917 }); 31918 } 31919 }; 31920 } 31921 if (actions[i].RenderModal) { 31922 const ExistingRenderModal = actions[i].RenderModal; 31923 actions[i] = { 31924 ...actions[i], 31925 RenderModal: props => { 31926 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExistingRenderModal, { 31927 ...props, 31928 onActionPerformed: _items => { 31929 if (props.onActionPerformed) { 31930 props.onActionPerformed(_items); 31931 } 31932 onActionPerformed(actions[i].id, _items); 31933 } 31934 }); 31935 } 31936 }; 31937 } 31938 } 31939 } 31940 return actions; 31941 }, [context, defaultActions, onActionPerformed, setAsHomepageAction, setAsPostsPageAction, shouldShowHomepageActions]); 31942 } 31943 31944 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js 31945 /* wp:polyfill */ 31946 /** 31947 * WordPress dependencies 31948 */ 31949 31950 31951 31952 31953 31954 31955 31956 /** 31957 * Internal dependencies 31958 */ 31959 31960 31961 31962 const { 31963 Menu, 31964 kebabCase 31965 } = unlock(external_wp_components_namespaceObject.privateApis); 31966 function useEditedEntityRecordsWithPermissions(postType, postIds) { 31967 const { 31968 items, 31969 permissions 31970 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 31971 const { 31972 getEditedEntityRecord, 31973 getEntityRecordPermissions 31974 } = unlock(select(external_wp_coreData_namespaceObject.store)); 31975 return { 31976 items: postIds.map(postId => getEditedEntityRecord('postType', postType, postId)), 31977 permissions: postIds.map(postId => getEntityRecordPermissions('postType', postType, postId)) 31978 }; 31979 }, [postIds, postType]); 31980 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31981 return items.map((item, index) => ({ 31982 ...item, 31983 permissions: permissions[index] 31984 })); 31985 }, [items, permissions]); 31986 } 31987 function PostActions({ 31988 postType, 31989 postId, 31990 onActionPerformed 31991 }) { 31992 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 31993 const _postIds = (0,external_wp_element_namespaceObject.useMemo)(() => { 31994 if (Array.isArray(postId)) { 31995 return postId; 31996 } 31997 return postId ? [postId] : []; 31998 }, [postId]); 31999 const itemsWithPermissions = useEditedEntityRecordsWithPermissions(postType, _postIds); 32000 const allActions = usePostActions({ 32001 postType, 32002 onActionPerformed 32003 }); 32004 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 32005 return allActions.filter(action => { 32006 return (!action.isEligible || itemsWithPermissions.some(itemWithPermissions => action.isEligible(itemWithPermissions))) && (itemsWithPermissions.length < 2 || action.supportsBulk); 32007 }); 32008 }, [allActions, itemsWithPermissions]); 32009 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 32010 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { 32011 placement: "bottom-end", 32012 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { 32013 render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32014 size: "small", 32015 icon: more_vertical, 32016 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 32017 disabled: !actions.length, 32018 accessibleWhenDisabled: true, 32019 className: "editor-all-actions-button" 32020 }) 32021 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { 32022 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 32023 actions: actions, 32024 items: itemsWithPermissions, 32025 setActiveModalAction: setActiveModalAction 32026 }) 32027 })] 32028 }), !!activeModalAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionModal, { 32029 action: activeModalAction, 32030 items: itemsWithPermissions, 32031 closeModal: () => setActiveModalAction(null) 32032 })] 32033 }); 32034 } 32035 32036 // From now on all the functions on this file are copied as from the dataviews packages, 32037 // The editor packages should not be using the dataviews packages directly, 32038 // and the dataviews package should not be using the editor packages directly, 32039 // so duplicating the code here seems like the least bad option. 32040 32041 function DropdownMenuItemTrigger({ 32042 action, 32043 onClick, 32044 items 32045 }) { 32046 const label = typeof action.label === 'string' ? action.label : action.label(items); 32047 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { 32048 onClick: onClick, 32049 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { 32050 children: label 32051 }) 32052 }); 32053 } 32054 function ActionModal({ 32055 action, 32056 items, 32057 closeModal 32058 }) { 32059 const label = typeof action.label === 'string' ? action.label : action.label(items); 32060 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 32061 title: action.modalHeader || label, 32062 __experimentalHideHeader: !!action.hideModalHeader, 32063 onRequestClose: closeModal !== null && closeModal !== void 0 ? closeModal : () => {}, 32064 focusOnMount: "firstContentElement", 32065 size: "medium", 32066 overlayClassName: `editor-action-modal editor-action-modal__$kebabCase(action.id)}`, 32067 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { 32068 items: items, 32069 closeModal: closeModal 32070 }) 32071 }); 32072 } 32073 function ActionsDropdownMenuGroup({ 32074 actions, 32075 items, 32076 setActiveModalAction 32077 }) { 32078 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 32079 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { 32080 children: actions.map(action => { 32081 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, { 32082 action: action, 32083 onClick: () => { 32084 if ('RenderModal' in action) { 32085 setActiveModalAction(action); 32086 return; 32087 } 32088 action.callback(items, { 32089 registry 32090 }); 32091 }, 32092 items: items 32093 }, action.id); 32094 }) 32095 }); 32096 } 32097 32098 ;// ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js 32099 /** 32100 * WordPress dependencies 32101 */ 32102 32103 32104 32105 32106 32107 32108 32109 /** 32110 * Internal dependencies 32111 */ 32112 32113 32114 32115 32116 32117 32118 32119 const { 32120 Badge: post_card_panel_Badge 32121 } = unlock(external_wp_components_namespaceObject.privateApis); 32122 32123 /** 32124 * Renders a title of the post type and the available quick actions available within a 3-dot dropdown. 32125 * 32126 * @param {Object} props - Component props. 32127 * @param {string} [props.postType] - The post type string. 32128 * @param {string|string[]} [props.postId] - The post id or list of post ids. 32129 * @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed. 32130 * @return {React.ReactNode} The rendered component. 32131 */ 32132 function PostCardPanel({ 32133 postType, 32134 postId, 32135 onActionPerformed 32136 }) { 32137 const postIds = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(postId) ? postId : [postId], [postId]); 32138 const { 32139 postTitle, 32140 icon, 32141 labels 32142 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32143 const { 32144 getEditedEntityRecord, 32145 getEntityRecord, 32146 getPostType 32147 } = select(external_wp_coreData_namespaceObject.store); 32148 const { 32149 getPostIcon 32150 } = unlock(select(store_store)); 32151 let _title = ''; 32152 const _record = getEditedEntityRecord('postType', postType, postIds[0]); 32153 if (postIds.length === 1) { 32154 var _getEntityRecord; 32155 const { 32156 default_template_types: templateTypes = [] 32157 } = (_getEntityRecord = getEntityRecord('root', '__unstableBase')) !== null && _getEntityRecord !== void 0 ? _getEntityRecord : {}; 32158 const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType) ? getTemplateInfo({ 32159 template: _record, 32160 templateTypes 32161 }) : {}; 32162 _title = _templateInfo?.title || _record?.title; 32163 } 32164 return { 32165 postTitle: _title, 32166 icon: getPostIcon(postType, { 32167 area: _record?.area 32168 }), 32169 labels: getPostType(postType)?.labels 32170 }; 32171 }, [postIds, postType]); 32172 const pageTypeBadge = usePageTypeBadge(postId); 32173 let title = (0,external_wp_i18n_namespaceObject.__)('No title'); 32174 if (labels?.name && postIds.length > 1) { 32175 title = (0,external_wp_i18n_namespaceObject.sprintf)( 32176 // translators: %i number of selected items %s: Name of the plural post type e.g: "Posts". 32177 (0,external_wp_i18n_namespaceObject.__)('%i %s'), postId.length, labels?.name); 32178 } else if (postTitle) { 32179 title = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(postTitle); 32180 } 32181 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32182 spacing: 1, 32183 className: "editor-post-card-panel", 32184 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 32185 spacing: 2, 32186 className: "editor-post-card-panel__header", 32187 align: "flex-start", 32188 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 32189 className: "editor-post-card-panel__icon", 32190 icon: icon 32191 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { 32192 numberOfLines: 2, 32193 truncate: true, 32194 className: "editor-post-card-panel__title", 32195 as: "h2", 32196 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 32197 className: "editor-post-card-panel__title-name", 32198 children: title 32199 }), pageTypeBadge && postIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_card_panel_Badge, { 32200 children: pageTypeBadge 32201 })] 32202 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostActions, { 32203 postType: postType, 32204 postId: postId, 32205 onActionPerformed: onActionPerformed 32206 })] 32207 }), postIds.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 32208 className: "editor-post-card-panel__description", 32209 children: (0,external_wp_i18n_namespaceObject.sprintf)( 32210 // translators: %s: Name of the plural post type e.g: "Posts". 32211 (0,external_wp_i18n_namespaceObject.__)('Changes will be applied to all selected %s.'), labels?.name.toLowerCase()) 32212 })] 32213 }); 32214 } 32215 32216 ;// ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js 32217 /** 32218 * WordPress dependencies 32219 */ 32220 32221 32222 32223 32224 32225 32226 32227 /** 32228 * Internal dependencies 32229 */ 32230 32231 32232 32233 // Taken from packages/editor/src/components/time-to-read/index.js. 32234 32235 const post_content_information_AVERAGE_READING_RATE = 189; 32236 32237 // This component renders the wordcount and reading time for the post. 32238 function PostContentInformation() { 32239 const { 32240 postContent 32241 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32242 const { 32243 getEditedPostAttribute, 32244 getCurrentPostType, 32245 getCurrentPostId 32246 } = select(store_store); 32247 const { 32248 canUser 32249 } = select(external_wp_coreData_namespaceObject.store); 32250 const { 32251 getEntityRecord 32252 } = select(external_wp_coreData_namespaceObject.store); 32253 const siteSettings = canUser('read', { 32254 kind: 'root', 32255 name: 'site' 32256 }) ? getEntityRecord('root', 'site') : undefined; 32257 const postType = getCurrentPostType(); 32258 const _id = getCurrentPostId(); 32259 const isPostsPage = +_id === siteSettings?.page_for_posts; 32260 const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType); 32261 return { 32262 postContent: showPostContentInfo && getEditedPostAttribute('content') 32263 }; 32264 }, []); 32265 32266 /* 32267 * translators: If your word count is based on single characters (e.g. East Asian characters), 32268 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 32269 * Do not translate into your own language. 32270 */ 32271 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 32272 const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)(() => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, [postContent, wordCountType]); 32273 if (!wordsCounted) { 32274 return null; 32275 } 32276 const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE); 32277 const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)( 32278 // translators: %s: the number of words in the post. 32279 (0,external_wp_i18n_namespaceObject._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString()); 32280 const minutesText = readingTime <= 1 ? (0,external_wp_i18n_namespaceObject.__)('1 minute') : (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: the number of minutes to read the post. */ 32281 (0,external_wp_i18n_namespaceObject._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString()); 32282 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32283 className: "editor-post-content-information", 32284 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 32285 children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */ 32286 (0,external_wp_i18n_namespaceObject.__)('%1$s, %2$s read time.'), wordsCountText, minutesText) 32287 }) 32288 }); 32289 } 32290 32291 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js 32292 /* wp:polyfill */ 32293 /** 32294 * WordPress dependencies 32295 */ 32296 32297 32298 32299 32300 32301 32302 /** 32303 * Internal dependencies 32304 */ 32305 32306 32307 32308 32309 32310 /** 32311 * Renders the Post Author Panel component. 32312 * 32313 * @return {React.ReactNode} The rendered component. 32314 */ 32315 32316 function panel_PostFormat() { 32317 const { 32318 postFormat 32319 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32320 const { 32321 getEditedPostAttribute 32322 } = select(store_store); 32323 const _postFormat = getEditedPostAttribute('format'); 32324 return { 32325 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard' 32326 }; 32327 }, []); 32328 const activeFormat = POST_FORMATS.find(format => format.id === postFormat); 32329 32330 // Use internal state instead of a ref to make sure that the component 32331 // re-renders when the popover's anchor updates. 32332 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 32333 // Memoize popoverProps to avoid returning a new object every time. 32334 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 32335 // Anchor the popover to the middle of the entire row so that it doesn't 32336 // move around when the label changes. 32337 anchor: popoverAnchor, 32338 placement: 'left-start', 32339 offset: 36, 32340 shift: true 32341 }), [popoverAnchor]); 32342 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { 32343 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 32344 label: (0,external_wp_i18n_namespaceObject.__)('Format'), 32345 ref: setPopoverAnchor, 32346 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 32347 popoverProps: popoverProps, 32348 contentClassName: "editor-post-format__dialog", 32349 focusOnMount: true, 32350 renderToggle: ({ 32351 isOpen, 32352 onToggle 32353 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32354 size: "compact", 32355 variant: "tertiary", 32356 "aria-expanded": isOpen, 32357 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 32358 // translators: %s: Current post format. 32359 (0,external_wp_i18n_namespaceObject.__)('Change format: %s'), activeFormat?.caption), 32360 onClick: onToggle, 32361 children: activeFormat?.caption 32362 }), 32363 renderContent: ({ 32364 onClose 32365 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 32366 className: "editor-post-format__dialog-content", 32367 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 32368 title: (0,external_wp_i18n_namespaceObject.__)('Format'), 32369 onClose: onClose 32370 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {})] 32371 }) 32372 }) 32373 }) 32374 }); 32375 } 32376 /* harmony default export */ const post_format_panel = (panel_PostFormat); 32377 32378 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js 32379 /** 32380 * WordPress dependencies 32381 */ 32382 32383 32384 32385 32386 32387 /** 32388 * Internal dependencies 32389 */ 32390 32391 32392 function PostLastEditedPanel() { 32393 const modified = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('modified'), []); 32394 const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)( 32395 // translators: %s: Human-readable time difference, e.g. "2 days ago". 32396 (0,external_wp_i18n_namespaceObject.__)('Last edited %s.'), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified)); 32397 if (!lastEditedText) { 32398 return null; 32399 } 32400 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 32401 className: "editor-post-last-edited-panel", 32402 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 32403 children: lastEditedText 32404 }) 32405 }); 32406 } 32407 32408 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js 32409 /** 32410 * External dependencies 32411 */ 32412 32413 32414 /** 32415 * WordPress dependencies 32416 */ 32417 32418 32419 function PostPanelSection({ 32420 className, 32421 children 32422 }) { 32423 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 32424 className: dist_clsx('editor-post-panel__section', className), 32425 children: children 32426 }); 32427 } 32428 /* harmony default export */ const post_panel_section = (PostPanelSection); 32429 32430 ;// ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js 32431 /** 32432 * WordPress dependencies 32433 */ 32434 32435 32436 32437 32438 32439 32440 32441 32442 32443 /** 32444 * Internal dependencies 32445 */ 32446 32447 32448 32449 32450 const blog_title_EMPTY_OBJECT = {}; 32451 function BlogTitle() { 32452 const { 32453 editEntityRecord 32454 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 32455 const { 32456 postsPageTitle, 32457 postsPageId, 32458 isTemplate, 32459 postSlug 32460 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32461 const { 32462 getEntityRecord, 32463 getEditedEntityRecord, 32464 canUser 32465 } = select(external_wp_coreData_namespaceObject.store); 32466 const siteSettings = canUser('read', { 32467 kind: 'root', 32468 name: 'site' 32469 }) ? getEntityRecord('root', 'site') : undefined; 32470 const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord('postType', 'page', siteSettings?.page_for_posts) : blog_title_EMPTY_OBJECT; 32471 const { 32472 getEditedPostAttribute, 32473 getCurrentPostType 32474 } = select(store_store); 32475 return { 32476 postsPageId: _postsPageRecord?.id, 32477 postsPageTitle: _postsPageRecord?.title, 32478 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 32479 postSlug: getEditedPostAttribute('slug') 32480 }; 32481 }, []); 32482 // Use internal state instead of a ref to make sure that the component 32483 // re-renders when the popover's anchor updates. 32484 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 32485 // Memoize popoverProps to avoid returning a new object every time. 32486 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 32487 // Anchor the popover to the middle of the entire row so that it doesn't 32488 // move around when the label changes. 32489 anchor: popoverAnchor, 32490 placement: 'left-start', 32491 offset: 36, 32492 shift: true 32493 }), [popoverAnchor]); 32494 if (!isTemplate || !['home', 'index'].includes(postSlug) || !postsPageId) { 32495 return null; 32496 } 32497 const setPostsPageTitle = newValue => { 32498 editEntityRecord('postType', 'page', postsPageId, { 32499 title: newValue 32500 }); 32501 }; 32502 const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle); 32503 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 32504 label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 32505 ref: setPopoverAnchor, 32506 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 32507 popoverProps: popoverProps, 32508 contentClassName: "editor-blog-title-dropdown__content", 32509 focusOnMount: true, 32510 renderToggle: ({ 32511 isOpen, 32512 onToggle 32513 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32514 size: "compact", 32515 variant: "tertiary", 32516 "aria-expanded": isOpen, 32517 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 32518 // translators: %s: Current post link. 32519 (0,external_wp_i18n_namespaceObject.__)('Change blog title: %s'), decodedTitle), 32520 onClick: onToggle, 32521 children: decodedTitle 32522 }), 32523 renderContent: ({ 32524 onClose 32525 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 32526 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 32527 title: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 32528 onClose: onClose 32529 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 32530 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 32531 size: "__unstable-large", 32532 value: postsPageTitle, 32533 onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300), 32534 label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 32535 help: (0,external_wp_i18n_namespaceObject.__)('Set the Posts Page title. Appears in search results, and when the page is shared on social media.'), 32536 hideLabelFromVision: true 32537 })] 32538 }) 32539 }) 32540 }); 32541 } 32542 32543 ;// ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js 32544 /** 32545 * WordPress dependencies 32546 */ 32547 32548 32549 32550 32551 32552 32553 32554 /** 32555 * Internal dependencies 32556 */ 32557 32558 32559 32560 32561 function PostsPerPage() { 32562 const { 32563 editEntityRecord 32564 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 32565 const { 32566 postsPerPage, 32567 isTemplate, 32568 postSlug 32569 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32570 const { 32571 getEditedPostAttribute, 32572 getCurrentPostType 32573 } = select(store_store); 32574 const { 32575 getEditedEntityRecord, 32576 canUser 32577 } = select(external_wp_coreData_namespaceObject.store); 32578 const siteSettings = canUser('read', { 32579 kind: 'root', 32580 name: 'site' 32581 }) ? getEditedEntityRecord('root', 'site') : undefined; 32582 return { 32583 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 32584 postSlug: getEditedPostAttribute('slug'), 32585 postsPerPage: siteSettings?.posts_per_page || 1 32586 }; 32587 }, []); 32588 // Use internal state instead of a ref to make sure that the component 32589 // re-renders when the popover's anchor updates. 32590 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 32591 // Memoize popoverProps to avoid returning a new object every time. 32592 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 32593 // Anchor the popover to the middle of the entire row so that it doesn't 32594 // move around when the label changes. 32595 anchor: popoverAnchor, 32596 placement: 'left-start', 32597 offset: 36, 32598 shift: true 32599 }), [popoverAnchor]); 32600 if (!isTemplate || !['home', 'index'].includes(postSlug)) { 32601 return null; 32602 } 32603 const setPostsPerPage = newValue => { 32604 editEntityRecord('root', 'site', undefined, { 32605 posts_per_page: newValue 32606 }); 32607 }; 32608 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 32609 label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 32610 ref: setPopoverAnchor, 32611 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 32612 popoverProps: popoverProps, 32613 contentClassName: "editor-posts-per-page-dropdown__content", 32614 focusOnMount: true, 32615 renderToggle: ({ 32616 isOpen, 32617 onToggle 32618 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32619 size: "compact", 32620 variant: "tertiary", 32621 "aria-expanded": isOpen, 32622 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change posts per page'), 32623 onClick: onToggle, 32624 children: postsPerPage 32625 }), 32626 renderContent: ({ 32627 onClose 32628 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 32629 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 32630 title: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 32631 onClose: onClose 32632 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 32633 placeholder: 0, 32634 value: postsPerPage, 32635 size: "__unstable-large", 32636 spinControls: "custom", 32637 step: "1", 32638 min: "1", 32639 onChange: setPostsPerPage, 32640 label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 32641 help: (0,external_wp_i18n_namespaceObject.__)('Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'), 32642 hideLabelFromVision: true 32643 })] 32644 }) 32645 }) 32646 }); 32647 } 32648 32649 ;// ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js 32650 /** 32651 * WordPress dependencies 32652 */ 32653 32654 32655 32656 32657 32658 32659 32660 /** 32661 * Internal dependencies 32662 */ 32663 32664 32665 32666 32667 const site_discussion_COMMENT_OPTIONS = [{ 32668 label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), 32669 value: 'open', 32670 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 32671 }, { 32672 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 32673 value: '', 32674 description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') 32675 }]; 32676 function SiteDiscussion() { 32677 const { 32678 editEntityRecord 32679 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 32680 const { 32681 allowCommentsOnNewPosts, 32682 isTemplate, 32683 postSlug 32684 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32685 const { 32686 getEditedPostAttribute, 32687 getCurrentPostType 32688 } = select(store_store); 32689 const { 32690 getEditedEntityRecord, 32691 canUser 32692 } = select(external_wp_coreData_namespaceObject.store); 32693 const siteSettings = canUser('read', { 32694 kind: 'root', 32695 name: 'site' 32696 }) ? getEditedEntityRecord('root', 'site') : undefined; 32697 return { 32698 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 32699 postSlug: getEditedPostAttribute('slug'), 32700 allowCommentsOnNewPosts: siteSettings?.default_comment_status || '' 32701 }; 32702 }, []); 32703 // Use internal state instead of a ref to make sure that the component 32704 // re-renders when the popover's anchor updates. 32705 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 32706 // Memoize popoverProps to avoid returning a new object every time. 32707 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 32708 // Anchor the popover to the middle of the entire row so that it doesn't 32709 // move around when the label changes. 32710 anchor: popoverAnchor, 32711 placement: 'left-start', 32712 offset: 36, 32713 shift: true 32714 }), [popoverAnchor]); 32715 if (!isTemplate || !['home', 'index'].includes(postSlug)) { 32716 return null; 32717 } 32718 const setAllowCommentsOnNewPosts = newValue => { 32719 editEntityRecord('root', 'site', undefined, { 32720 default_comment_status: newValue ? 'open' : null 32721 }); 32722 }; 32723 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 32724 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 32725 ref: setPopoverAnchor, 32726 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 32727 popoverProps: popoverProps, 32728 contentClassName: "editor-site-discussion-dropdown__content", 32729 focusOnMount: true, 32730 renderToggle: ({ 32731 isOpen, 32732 onToggle 32733 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 32734 size: "compact", 32735 variant: "tertiary", 32736 "aria-expanded": isOpen, 32737 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion settings'), 32738 onClick: onToggle, 32739 children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)('Comments open') : (0,external_wp_i18n_namespaceObject.__)('Comments closed') 32740 }), 32741 renderContent: ({ 32742 onClose 32743 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 32744 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 32745 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 32746 onClose: onClose 32747 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32748 spacing: 3, 32749 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 32750 children: (0,external_wp_i18n_namespaceObject.__)('Changes will apply to new posts only. Individual posts may override these settings.') 32751 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 32752 className: "editor-site-discussion__options", 32753 hideLabelFromVision: true, 32754 label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), 32755 options: site_discussion_COMMENT_OPTIONS, 32756 onChange: setAllowCommentsOnNewPosts, 32757 selected: allowCommentsOnNewPosts 32758 })] 32759 })] 32760 }) 32761 }) 32762 }); 32763 } 32764 32765 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js 32766 /** 32767 * WordPress dependencies 32768 */ 32769 32770 32771 32772 /** 32773 * Internal dependencies 32774 */ 32775 32776 32777 32778 32779 32780 32781 32782 32783 32784 32785 32786 32787 32788 32789 32790 32791 32792 32793 32794 32795 32796 32797 32798 /** 32799 * Module Constants 32800 */ 32801 32802 const post_summary_PANEL_NAME = 'post-status'; 32803 function PostSummary({ 32804 onActionPerformed 32805 }) { 32806 const { 32807 isRemovedPostStatusPanel, 32808 postType, 32809 postId 32810 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32811 // We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do 32812 // not use isEditorPanelEnabled since this panel should not be disabled through the UI. 32813 const { 32814 isEditorPanelRemoved, 32815 getCurrentPostType, 32816 getCurrentPostId 32817 } = select(store_store); 32818 return { 32819 isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME), 32820 postType: getCurrentPostType(), 32821 postId: getCurrentPostId() 32822 }; 32823 }, []); 32824 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section, { 32825 className: "editor-post-summary", 32826 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info.Slot, { 32827 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 32828 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32829 spacing: 4, 32830 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 32831 postType: postType, 32832 postId: postId, 32833 onActionPerformed: onActionPerformed 32834 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, { 32835 withPanelBody: false 32836 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32837 spacing: 1, 32838 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {})] 32839 }), !isRemovedPostStatusPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32840 spacing: 4, 32841 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 32842 spacing: 1, 32843 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedulePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplatePanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostLastRevision, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSyncStatus, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlogTitle, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsPerPage, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteDiscussion, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_panel, {}), fills] 32844 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTrash, { 32845 onActionPerformed: onActionPerformed 32846 })] 32847 })] 32848 }) 32849 }) 32850 }) 32851 }); 32852 } 32853 32854 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js 32855 /* wp:polyfill */ 32856 /** 32857 * WordPress dependencies 32858 */ 32859 32860 32861 32862 32863 32864 32865 /** 32866 * Internal dependencies 32867 */ 32868 32869 32870 const { 32871 EXCLUDED_PATTERN_SOURCES, 32872 PATTERN_TYPES: hooks_PATTERN_TYPES 32873 } = unlock(external_wp_patterns_namespaceObject.privateApis); 32874 function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) { 32875 block.innerBlocks = block.innerBlocks.map(innerBlock => { 32876 return injectThemeAttributeInBlockTemplateContent(innerBlock, currentThemeStylesheet); 32877 }); 32878 if (block.name === 'core/template-part' && block.attributes.theme === undefined) { 32879 block.attributes.theme = currentThemeStylesheet; 32880 } 32881 return block; 32882 } 32883 32884 /** 32885 * Filter all patterns and return only the ones that are compatible with the current template. 32886 * 32887 * @param {Array} patterns An array of patterns. 32888 * @param {Object} template The current template. 32889 * @return {Array} Array of patterns that are compatible with the current template. 32890 */ 32891 function filterPatterns(patterns, template) { 32892 // Filter out duplicates. 32893 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 32894 32895 // Filter out core/directory patterns not included in theme.json. 32896 const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source); 32897 32898 // Looks for patterns that have the same template type as the current template, 32899 // or have a block type that matches the current template area. 32900 const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes('core/template-part/' + template.area); 32901 return patterns.filter((pattern, index, items) => { 32902 return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern); 32903 }); 32904 } 32905 function preparePatterns(patterns, currentThemeStylesheet) { 32906 return patterns.map(pattern => ({ 32907 ...pattern, 32908 keywords: pattern.keywords || [], 32909 type: hooks_PATTERN_TYPES.theme, 32910 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 32911 __unstableSkipMigrationLogs: true 32912 }).map(block => injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet)) 32913 })); 32914 } 32915 function useAvailablePatterns(template) { 32916 const { 32917 blockPatterns, 32918 restBlockPatterns, 32919 currentThemeStylesheet 32920 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32921 var _settings$__experimen; 32922 const { 32923 getEditorSettings 32924 } = select(store_store); 32925 const settings = getEditorSettings(); 32926 return { 32927 blockPatterns: (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns, 32928 restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 32929 currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet 32930 }; 32931 }, []); 32932 return (0,external_wp_element_namespaceObject.useMemo)(() => { 32933 const mergedPatterns = [...(blockPatterns || []), ...(restBlockPatterns || [])]; 32934 const filteredPatterns = filterPatterns(mergedPatterns, template); 32935 return preparePatterns(filteredPatterns, template, currentThemeStylesheet); 32936 }, [blockPatterns, restBlockPatterns, template, currentThemeStylesheet]); 32937 } 32938 32939 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js 32940 /** 32941 * WordPress dependencies 32942 */ 32943 32944 32945 32946 32947 32948 32949 32950 /** 32951 * Internal dependencies 32952 */ 32953 32954 32955 32956 32957 function post_transform_panel_TemplatesList({ 32958 availableTemplates, 32959 onSelect 32960 }) { 32961 if (!availableTemplates || availableTemplates?.length === 0) { 32962 return null; 32963 } 32964 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 32965 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 32966 blockPatterns: availableTemplates, 32967 onClickPattern: onSelect, 32968 showTitlesAsTooltip: true 32969 }); 32970 } 32971 function PostTransform() { 32972 const { 32973 record, 32974 postType, 32975 postId 32976 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 32977 const { 32978 getCurrentPostType, 32979 getCurrentPostId 32980 } = select(store_store); 32981 const { 32982 getEditedEntityRecord 32983 } = select(external_wp_coreData_namespaceObject.store); 32984 const type = getCurrentPostType(); 32985 const id = getCurrentPostId(); 32986 return { 32987 postType: type, 32988 postId: id, 32989 record: getEditedEntityRecord('postType', type, id) 32990 }; 32991 }, []); 32992 const { 32993 editEntityRecord 32994 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 32995 const availablePatterns = useAvailablePatterns(record); 32996 const onTemplateSelect = async selectedTemplate => { 32997 await editEntityRecord('postType', postType, postId, { 32998 blocks: selectedTemplate.blocks, 32999 content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks) 33000 }); 33001 }; 33002 if (!availablePatterns?.length) { 33003 return null; 33004 } 33005 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 33006 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 33007 initialOpen: record.type === TEMPLATE_PART_POST_TYPE, 33008 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_transform_panel_TemplatesList, { 33009 availableTemplates: availablePatterns, 33010 onSelect: onTemplateSelect 33011 }) 33012 }); 33013 } 33014 function PostTransformPanel() { 33015 const { 33016 postType 33017 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33018 const { 33019 getCurrentPostType 33020 } = select(store_store); 33021 return { 33022 postType: getCurrentPostType() 33023 }; 33024 }, []); 33025 if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { 33026 return null; 33027 } 33028 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {}); 33029 } 33030 33031 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js 33032 const sidebars = { 33033 document: 'edit-post/document', 33034 block: 'edit-post/block' 33035 }; 33036 33037 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js 33038 /** 33039 * WordPress dependencies 33040 */ 33041 33042 33043 33044 33045 33046 /** 33047 * Internal dependencies 33048 */ 33049 33050 33051 33052 33053 const { 33054 Tabs 33055 } = unlock(external_wp_components_namespaceObject.privateApis); 33056 const SidebarHeader = (_, ref) => { 33057 const { 33058 documentLabel 33059 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33060 const { 33061 getPostTypeLabel 33062 } = select(store_store); 33063 return { 33064 documentLabel: 33065 // translators: Default label for the Document sidebar tab, not selected. 33066 getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, sidebar') 33067 }; 33068 }, []); 33069 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { 33070 ref: ref, 33071 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 33072 tabId: sidebars.document 33073 // Used for focus management in the SettingsSidebar component. 33074 , 33075 "data-tab-id": sidebars.document, 33076 children: documentLabel 33077 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 33078 tabId: sidebars.block 33079 // Used for focus management in the SettingsSidebar component. 33080 , 33081 "data-tab-id": sidebars.block, 33082 children: (0,external_wp_i18n_namespaceObject.__)('Block') 33083 })] 33084 }); 33085 }; 33086 /* harmony default export */ const sidebar_header = ((0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader)); 33087 33088 ;// ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js 33089 /** 33090 * WordPress dependencies 33091 */ 33092 33093 33094 33095 33096 33097 33098 33099 33100 /** 33101 * Internal dependencies 33102 */ 33103 33104 33105 33106 33107 const { 33108 BlockQuickNavigation 33109 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 33110 const template_content_panel_POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; 33111 const TEMPLATE_PART_BLOCK = 'core/template-part'; 33112 function TemplateContentPanel() { 33113 const postContentBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', template_content_panel_POST_CONTENT_BLOCK_TYPES), []); 33114 const { 33115 clientIds, 33116 postType, 33117 renderingMode 33118 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33119 const { 33120 getCurrentPostType, 33121 getPostBlocksByName, 33122 getRenderingMode 33123 } = unlock(select(store_store)); 33124 const _postType = getCurrentPostType(); 33125 return { 33126 postType: _postType, 33127 clientIds: getPostBlocksByName(TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes), 33128 renderingMode: getRenderingMode() 33129 }; 33130 }, [postContentBlockTypes]); 33131 const { 33132 enableComplementaryArea 33133 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 33134 if (renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE || clientIds.length === 0) { 33135 return null; 33136 } 33137 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 33138 title: (0,external_wp_i18n_namespaceObject.__)('Content'), 33139 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { 33140 clientIds: clientIds, 33141 onSelect: () => { 33142 enableComplementaryArea('core', 'edit-post/document'); 33143 } 33144 }) 33145 }); 33146 } 33147 33148 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-content-panel/index.js 33149 /* wp:polyfill */ 33150 /** 33151 * WordPress dependencies 33152 */ 33153 33154 33155 33156 33157 33158 33159 33160 /** 33161 * Internal dependencies 33162 */ 33163 33164 33165 33166 33167 const { 33168 BlockQuickNavigation: template_part_content_panel_BlockQuickNavigation 33169 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 33170 function TemplatePartContentPanelInner() { 33171 const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { 33172 const { 33173 getBlockTypes 33174 } = select(external_wp_blocks_namespaceObject.store); 33175 return getBlockTypes(); 33176 }, []); 33177 const themeBlockNames = (0,external_wp_element_namespaceObject.useMemo)(() => { 33178 return blockTypes.filter(blockType => { 33179 return blockType.category === 'theme'; 33180 }).map(({ 33181 name 33182 }) => name); 33183 }, [blockTypes]); 33184 const themeBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => { 33185 const { 33186 getBlocksByName 33187 } = select(external_wp_blockEditor_namespaceObject.store); 33188 return getBlocksByName(themeBlockNames); 33189 }, [themeBlockNames]); 33190 if (themeBlocks.length === 0) { 33191 return null; 33192 } 33193 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 33194 title: (0,external_wp_i18n_namespaceObject.__)('Content'), 33195 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(template_part_content_panel_BlockQuickNavigation, { 33196 clientIds: themeBlocks 33197 }) 33198 }); 33199 } 33200 function TemplatePartContentPanel() { 33201 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 33202 const { 33203 getCurrentPostType 33204 } = select(store_store); 33205 return getCurrentPostType(); 33206 }, []); 33207 if (postType !== TEMPLATE_PART_POST_TYPE) { 33208 return null; 33209 } 33210 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanelInner, {}); 33211 } 33212 33213 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js 33214 /** 33215 * WordPress dependencies 33216 */ 33217 33218 33219 33220 33221 33222 33223 /** 33224 * This listener hook monitors for block selection and triggers the appropriate 33225 * sidebar state. 33226 */ 33227 function useAutoSwitchEditorSidebars() { 33228 const { 33229 hasBlockSelection 33230 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33231 return { 33232 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 33233 }; 33234 }, []); 33235 const { 33236 getActiveComplementaryArea 33237 } = (0,external_wp_data_namespaceObject.useSelect)(store); 33238 const { 33239 enableComplementaryArea 33240 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 33241 const { 33242 get: getPreference 33243 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 33244 (0,external_wp_element_namespaceObject.useEffect)(() => { 33245 const activeGeneralSidebar = getActiveComplementaryArea('core'); 33246 const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 33247 const isDistractionFree = getPreference('core', 'distractionFree'); 33248 if (!isEditorSidebarOpened || isDistractionFree) { 33249 return; 33250 } 33251 if (hasBlockSelection) { 33252 enableComplementaryArea('core', 'edit-post/block'); 33253 } else { 33254 enableComplementaryArea('core', 'edit-post/document'); 33255 } 33256 }, [hasBlockSelection, getActiveComplementaryArea, enableComplementaryArea, getPreference]); 33257 } 33258 /* harmony default export */ const use_auto_switch_editor_sidebars = (useAutoSwitchEditorSidebars); 33259 33260 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js 33261 /* wp:polyfill */ 33262 /** 33263 * WordPress dependencies 33264 */ 33265 33266 33267 33268 33269 33270 33271 33272 33273 33274 /** 33275 * Internal dependencies 33276 */ 33277 33278 33279 33280 33281 33282 33283 33284 33285 33286 33287 33288 33289 33290 33291 33292 const { 33293 Tabs: sidebar_Tabs 33294 } = unlock(external_wp_components_namespaceObject.privateApis); 33295 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ 33296 web: true, 33297 native: false 33298 }); 33299 const SidebarContent = ({ 33300 tabName, 33301 keyboardShortcut, 33302 onActionPerformed, 33303 extraPanels 33304 }) => { 33305 const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); 33306 // Because `PluginSidebar` renders a `ComplementaryArea`, we 33307 // need to forward the `Tabs` context so it can be passed through the 33308 // underlying slot/fill. 33309 const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context); 33310 33311 // This effect addresses a race condition caused by tabbing from the last 33312 // block in the editor into the settings sidebar. Without this effect, the 33313 // selected tab and browser focus can become separated in an unexpected way 33314 // (e.g the "block" tab is focused, but the "post" tab is selected). 33315 (0,external_wp_element_namespaceObject.useEffect)(() => { 33316 const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []); 33317 const selectedTabElement = tabsElements.find( 33318 // We are purposefully using a custom `data-tab-id` attribute here 33319 // because we don't want rely on any assumptions about `Tabs` 33320 // component internals. 33321 element => element.getAttribute('data-tab-id') === tabName); 33322 const activeElement = selectedTabElement?.ownerDocument.activeElement; 33323 const tabsHasFocus = tabsElements.some(element => { 33324 return activeElement && activeElement.id === element.id; 33325 }); 33326 if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { 33327 selectedTabElement?.focus(); 33328 } 33329 }, [tabName]); 33330 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { 33331 identifier: tabName, 33332 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, { 33333 value: tabsContextValue, 33334 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header, { 33335 ref: tabListRef 33336 }) 33337 }), 33338 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings') 33339 // This classname is added so we can apply a corrective negative 33340 // margin to the panel. 33341 // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049 33342 , 33343 className: "editor-sidebar__panel", 33344 headerClassName: "editor-sidebar__panel-tabs", 33345 title: /* translators: button label text should, if possible, be under 16 characters. */ 33346 (0,external_wp_i18n_namespaceObject._x)('Settings', 'sidebar button label'), 33347 toggleShortcut: keyboardShortcut, 33348 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 33349 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, 33350 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, { 33351 value: tabsContextValue, 33352 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, { 33353 tabId: sidebars.document, 33354 focusable: false, 33355 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, { 33356 onActionPerformed: onActionPerformed 33357 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateContentPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransformPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_PostTaxonomies, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), extraPanels] 33358 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, { 33359 tabId: sidebars.block, 33360 focusable: false, 33361 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) 33362 })] 33363 }) 33364 }); 33365 }; 33366 const Sidebar = ({ 33367 extraPanels, 33368 onActionPerformed 33369 }) => { 33370 use_auto_switch_editor_sidebars(); 33371 const { 33372 tabName, 33373 keyboardShortcut, 33374 showSummary 33375 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33376 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-sidebar'); 33377 const sidebar = select(store).getActiveComplementaryArea('core'); 33378 const _isEditorSidebarOpened = [sidebars.block, sidebars.document].includes(sidebar); 33379 let _tabName = sidebar; 33380 if (!_isEditorSidebarOpened) { 33381 _tabName = !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() ? sidebars.block : sidebars.document; 33382 } 33383 return { 33384 tabName: _tabName, 33385 keyboardShortcut: shortcut, 33386 showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(store_store).getCurrentPostType()) 33387 }; 33388 }, []); 33389 const { 33390 enableComplementaryArea 33391 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 33392 const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { 33393 if (!!newSelectedTabId) { 33394 enableComplementaryArea('core', newSelectedTabId); 33395 } 33396 }, [enableComplementaryArea]); 33397 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs, { 33398 selectedTabId: tabName, 33399 onSelect: onTabSelect, 33400 selectOnMove: false, 33401 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 33402 tabName: tabName, 33403 keyboardShortcut: keyboardShortcut, 33404 showSummary: showSummary, 33405 onActionPerformed: onActionPerformed, 33406 extraPanels: extraPanels 33407 }) 33408 }); 33409 }; 33410 /* harmony default export */ const components_sidebar = (Sidebar); 33411 33412 ;// ./node_modules/@wordpress/editor/build-module/components/editor/index.js 33413 /** 33414 * WordPress dependencies 33415 */ 33416 33417 33418 33419 33420 33421 /** 33422 * Internal dependencies 33423 */ 33424 33425 33426 33427 33428 33429 function Editor({ 33430 postType, 33431 postId, 33432 templateId, 33433 settings, 33434 children, 33435 initialEdits, 33436 // This could be part of the settings. 33437 onActionPerformed, 33438 // The following abstractions are not ideal but necessary 33439 // to account for site editor and post editor differences for now. 33440 extraContent, 33441 extraSidebarPanels, 33442 ...props 33443 }) { 33444 const { 33445 post, 33446 template, 33447 hasLoadedPost 33448 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33449 const { 33450 getEntityRecord, 33451 hasFinishedResolution 33452 } = select(external_wp_coreData_namespaceObject.store); 33453 return { 33454 post: getEntityRecord('postType', postType, postId), 33455 template: templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId) : undefined, 33456 hasLoadedPost: hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) 33457 }; 33458 }, [postType, postId, templateId]); 33459 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33460 children: [hasLoadedPost && !post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 33461 status: "warning", 33462 isDismissible: false, 33463 children: (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?") 33464 }), !!post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalEditorProvider, { 33465 post: post, 33466 __unstableTemplate: template, 33467 settings: settings, 33468 initialEdits: initialEdits, 33469 useSubRegistry: false, 33470 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { 33471 ...props, 33472 children: extraContent 33473 }), children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_sidebar, { 33474 onActionPerformed: onActionPerformed, 33475 extraPanels: extraSidebarPanels 33476 })] 33477 })] 33478 }); 33479 } 33480 /* harmony default export */ const editor = (Editor); 33481 33482 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js 33483 /** 33484 * WordPress dependencies 33485 */ 33486 33487 33488 33489 /** 33490 * Internal dependencies 33491 */ 33492 33493 33494 33495 const { 33496 PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption 33497 } = unlock(external_wp_preferences_namespaceObject.privateApis); 33498 function EnablePublishSidebarOption(props) { 33499 const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => { 33500 return select(store_store).isPublishSidebarEnabled(); 33501 }, []); 33502 const { 33503 enablePublishSidebar, 33504 disablePublishSidebar 33505 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 33506 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_publish_sidebar_PreferenceBaseOption, { 33507 isChecked: isChecked, 33508 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar(), 33509 ...props 33510 }); 33511 } 33512 33513 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/block-visibility.js 33514 /* wp:polyfill */ 33515 /** 33516 * WordPress dependencies 33517 */ 33518 33519 33520 33521 33522 33523 33524 /** 33525 * Internal dependencies 33526 */ 33527 33528 33529 33530 const { 33531 BlockManager 33532 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 33533 function BlockVisibility() { 33534 const { 33535 showBlockTypes, 33536 hideBlockTypes 33537 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 33538 const { 33539 blockTypes, 33540 allowedBlockTypes: _allowedBlockTypes, 33541 hiddenBlockTypes: _hiddenBlockTypes 33542 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33543 var _select$get; 33544 return { 33545 blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), 33546 allowedBlockTypes: select(store_store).getEditorSettings().allowedBlockTypes, 33547 hiddenBlockTypes: (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : [] 33548 }; 33549 }, []); 33550 const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 33551 if (_allowedBlockTypes === true) { 33552 return blockTypes; 33553 } 33554 return blockTypes.filter(({ 33555 name 33556 }) => { 33557 return _allowedBlockTypes?.includes(name); 33558 }); 33559 }, [_allowedBlockTypes, blockTypes]); 33560 const filteredBlockTypes = allowedBlockTypes.filter(blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true) && (!blockType.parent || blockType.parent.includes('core/post-content'))); 33561 33562 // Some hidden blocks become unregistered 33563 // by removing for instance the plugin that registered them, yet 33564 // they're still remain as hidden by the user's action. 33565 // We consider "hidden", blocks which were hidden and 33566 // are still registered. 33567 const hiddenBlockTypes = _hiddenBlockTypes.filter(hiddenBlock => { 33568 return filteredBlockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock); 33569 }); 33570 const selectedBlockTypes = filteredBlockTypes.filter(blockType => !hiddenBlockTypes.includes(blockType.name)); 33571 const onChangeSelectedBlockTypes = newSelectedBlockTypes => { 33572 if (selectedBlockTypes.length > newSelectedBlockTypes.length) { 33573 const blockTypesToHide = selectedBlockTypes.filter(blockType => !newSelectedBlockTypes.find(({ 33574 name 33575 }) => name === blockType.name)); 33576 hideBlockTypes(blockTypesToHide.map(({ 33577 name 33578 }) => name)); 33579 } else if (selectedBlockTypes.length < newSelectedBlockTypes.length) { 33580 const blockTypesToShow = newSelectedBlockTypes.filter(blockType => !selectedBlockTypes.find(({ 33581 name 33582 }) => name === blockType.name)); 33583 showBlockTypes(blockTypesToShow.map(({ 33584 name 33585 }) => name)); 33586 } 33587 }; 33588 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockManager, { 33589 blockTypes: filteredBlockTypes, 33590 selectedBlockTypes: selectedBlockTypes, 33591 onChange: onChangeSelectedBlockTypes 33592 }); 33593 } 33594 33595 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js 33596 /* wp:polyfill */ 33597 /** 33598 * WordPress dependencies 33599 */ 33600 33601 33602 33603 33604 33605 33606 33607 33608 /** 33609 * Internal dependencies 33610 */ 33611 33612 33613 33614 33615 33616 33617 33618 33619 33620 33621 33622 33623 const { 33624 PreferencesModal, 33625 PreferencesModalTabs, 33626 PreferencesModalSection, 33627 PreferenceToggleControl 33628 } = unlock(external_wp_preferences_namespaceObject.privateApis); 33629 function EditorPreferencesModal({ 33630 extraSections = {} 33631 }) { 33632 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => { 33633 return select(store).isModalActive('editor/preferences'); 33634 }, []); 33635 const { 33636 closeModal 33637 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 33638 if (!isActive) { 33639 return null; 33640 } 33641 33642 // Please wrap all contents inside PreferencesModalContents to prevent all 33643 // hooks from executing when the modal is not open. 33644 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { 33645 closeModal: closeModal, 33646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalContents, { 33647 extraSections: extraSections 33648 }) 33649 }); 33650 } 33651 function PreferencesModalContents({ 33652 extraSections = {} 33653 }) { 33654 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 33655 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => { 33656 const { 33657 getEditorSettings 33658 } = select(store_store); 33659 const { 33660 get 33661 } = select(external_wp_preferences_namespaceObject.store); 33662 const isRichEditingEnabled = getEditorSettings().richEditingEnabled; 33663 const isDistractionFreeEnabled = get('core', 'distractionFree'); 33664 return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled; 33665 }, [isLargeViewport]); 33666 const { 33667 setIsListViewOpened, 33668 setIsInserterOpened 33669 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 33670 const { 33671 set: setPreference 33672 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 33673 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ 33674 name: 'general', 33675 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), 33676 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33677 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 33678 title: (0,external_wp_i18n_namespaceObject.__)('Interface'), 33679 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33680 scope: "core", 33681 featureName: "showListViewByDefault", 33682 help: (0,external_wp_i18n_namespaceObject.__)('Opens the List View sidebar by default.'), 33683 label: (0,external_wp_i18n_namespaceObject.__)('Always open List View') 33684 }), showBlockBreadcrumbsOption && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33685 scope: "core", 33686 featureName: "showBlockBreadcrumbs", 33687 help: (0,external_wp_i18n_namespaceObject.__)('Display the block hierarchy trail at the bottom of the editor.'), 33688 label: (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs') 33689 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33690 scope: "core", 33691 featureName: "allowRightClickOverrides", 33692 help: (0,external_wp_i18n_namespaceObject.__)('Allows contextual List View menus via right-click, overriding browser defaults.'), 33693 label: (0,external_wp_i18n_namespaceObject.__)('Allow right-click contextual menus') 33694 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33695 scope: "core", 33696 featureName: "enableChoosePatternModal", 33697 help: (0,external_wp_i18n_namespaceObject.__)('Shows starter patterns when creating a new page.'), 33698 label: (0,external_wp_i18n_namespaceObject.__)('Show starter patterns') 33699 })] 33700 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 33701 title: (0,external_wp_i18n_namespaceObject.__)('Document settings'), 33702 description: (0,external_wp_i18n_namespaceObject.__)('Select what settings are shown in the document panel.'), 33703 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { 33704 taxonomyWrapper: (content, taxonomy) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 33705 label: taxonomy.labels.menu_name, 33706 panelName: `taxonomy-panel-$taxonomy.slug}` 33707 }) 33708 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 33709 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 33710 label: (0,external_wp_i18n_namespaceObject.__)('Featured image'), 33711 panelName: "featured-image" 33712 }) 33713 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 33714 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 33715 label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), 33716 panelName: "post-excerpt" 33717 }) 33718 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 33719 supportKeys: ['comments', 'trackbacks'], 33720 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 33721 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 33722 panelName: "discussion-panel" 33723 }) 33724 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { 33725 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { 33726 label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'), 33727 panelName: "page-attributes" 33728 }) 33729 })] 33730 }), isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 33731 title: (0,external_wp_i18n_namespaceObject.__)('Publishing'), 33732 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePublishSidebarOption, { 33733 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), 33734 label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks') 33735 }) 33736 }), extraSections?.general] 33737 }) 33738 }, { 33739 name: 'appearance', 33740 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 33741 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 33742 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 33743 description: (0,external_wp_i18n_namespaceObject.__)('Customize the editor interface to suit your needs.'), 33744 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33745 scope: "core", 33746 featureName: "fixedToolbar", 33747 onToggle: () => setPreference('core', 'distractionFree', false), 33748 help: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place.'), 33749 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar') 33750 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33751 scope: "core", 33752 featureName: "distractionFree", 33753 onToggle: () => { 33754 setPreference('core', 'fixedToolbar', true); 33755 setIsInserterOpened(false); 33756 setIsListViewOpened(false); 33757 }, 33758 help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'), 33759 label: (0,external_wp_i18n_namespaceObject.__)('Distraction free') 33760 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33761 scope: "core", 33762 featureName: "focusMode", 33763 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), 33764 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') 33765 }), extraSections?.appearance] 33766 }) 33767 }, { 33768 name: 'accessibility', 33769 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Accessibility'), 33770 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33771 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 33772 title: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 33773 description: (0,external_wp_i18n_namespaceObject.__)('Optimize the editing experience for enhanced control.'), 33774 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33775 scope: "core", 33776 featureName: "keepCaretInsideBlock", 33777 help: (0,external_wp_i18n_namespaceObject.__)('Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users.'), 33778 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') 33779 }) 33780 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 33781 title: (0,external_wp_i18n_namespaceObject.__)('Interface'), 33782 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33783 scope: "core", 33784 featureName: "showIconLabels", 33785 label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), 33786 help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons across the interface.') 33787 }) 33788 })] 33789 }) 33790 }, { 33791 name: 'blocks', 33792 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 33793 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33794 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 33795 title: (0,external_wp_i18n_namespaceObject.__)('Inserter'), 33796 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33797 scope: "core", 33798 featureName: "mostUsedBlocks", 33799 help: (0,external_wp_i18n_namespaceObject.__)('Adds a category with the most frequently used blocks in the inserter.'), 33800 label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks') 33801 }) 33802 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 33803 title: (0,external_wp_i18n_namespaceObject.__)('Manage block visibility'), 33804 description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."), 33805 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVisibility, {}) 33806 })] 33807 }) 33808 }, window.__experimentalMediaProcessing && { 33809 name: 'media', 33810 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Media'), 33811 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 33812 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 33813 title: (0,external_wp_i18n_namespaceObject.__)('General'), 33814 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the media upload flow.'), 33815 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33816 scope: "core/media", 33817 featureName: "optimizeOnUpload", 33818 help: (0,external_wp_i18n_namespaceObject.__)('Compress media items before uploading to the server.'), 33819 label: (0,external_wp_i18n_namespaceObject.__)('Pre-upload compression') 33820 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 33821 scope: "core/media", 33822 featureName: "requireApproval", 33823 help: (0,external_wp_i18n_namespaceObject.__)('Require approval step when optimizing existing media.'), 33824 label: (0,external_wp_i18n_namespaceObject.__)('Approval step') 33825 })] 33826 }) 33827 }) 33828 }].filter(Boolean), [showBlockBreadcrumbsOption, extraSections, setIsInserterOpened, setIsListViewOpened, setPreference, isLargeViewport]); 33829 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, { 33830 sections: sections 33831 }); 33832 } 33833 33834 ;// ./node_modules/@wordpress/editor/build-module/components/post-fields/index.js 33835 /* wp:polyfill */ 33836 /** 33837 * WordPress dependencies 33838 */ 33839 33840 33841 33842 /** 33843 * Internal dependencies 33844 */ 33845 33846 33847 function usePostFields({ 33848 postType 33849 }) { 33850 const { 33851 registerPostTypeSchema 33852 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 33853 (0,external_wp_element_namespaceObject.useEffect)(() => { 33854 registerPostTypeSchema(postType); 33855 }, [registerPostTypeSchema, postType]); 33856 const { 33857 defaultFields 33858 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 33859 const { 33860 getEntityFields 33861 } = unlock(select(store_store)); 33862 return { 33863 defaultFields: getEntityFields('postType', postType) 33864 }; 33865 }, [postType]); 33866 const { 33867 records: authors, 33868 isResolving: isLoadingAuthors 33869 } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'user', { 33870 per_page: -1 33871 }); 33872 const fields = (0,external_wp_element_namespaceObject.useMemo)(() => defaultFields.map(field => { 33873 if (field.id === 'author') { 33874 return { 33875 ...field, 33876 elements: authors?.map(({ 33877 id, 33878 name 33879 }) => ({ 33880 value: id, 33881 label: name 33882 })) 33883 }; 33884 } 33885 return field; 33886 }), [authors, defaultFields]); 33887 return { 33888 isLoading: isLoadingAuthors, 33889 fields 33890 }; 33891 } 33892 33893 /** 33894 * Hook to get the fields for a post (BasePost or BasePostWithEmbeddedAuthor). 33895 */ 33896 /* harmony default export */ const post_fields = (usePostFields); 33897 33898 ;// ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js 33899 /* wp:polyfill */ 33900 /** 33901 * WordPress dependencies 33902 */ 33903 33904 const CONTENT = 'content'; 33905 /* harmony default export */ const pattern_overrides = ({ 33906 name: 'core/pattern-overrides', 33907 getValues({ 33908 select, 33909 clientId, 33910 context, 33911 bindings 33912 }) { 33913 const patternOverridesContent = context['pattern/overrides']; 33914 const { 33915 getBlockAttributes 33916 } = select(external_wp_blockEditor_namespaceObject.store); 33917 const currentBlockAttributes = getBlockAttributes(clientId); 33918 const overridesValues = {}; 33919 for (const attributeName of Object.keys(bindings)) { 33920 const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; 33921 33922 // If it has not been overridden, return the original value. 33923 // Check undefined because empty string is a valid value. 33924 if (overridableValue === undefined) { 33925 overridesValues[attributeName] = currentBlockAttributes[attributeName]; 33926 continue; 33927 } else { 33928 overridesValues[attributeName] = overridableValue === '' ? undefined : overridableValue; 33929 } 33930 } 33931 return overridesValues; 33932 }, 33933 setValues({ 33934 select, 33935 dispatch, 33936 clientId, 33937 bindings 33938 }) { 33939 const { 33940 getBlockAttributes, 33941 getBlockParentsByBlockName, 33942 getBlocks 33943 } = select(external_wp_blockEditor_namespaceObject.store); 33944 const currentBlockAttributes = getBlockAttributes(clientId); 33945 const blockName = currentBlockAttributes?.metadata?.name; 33946 if (!blockName) { 33947 return; 33948 } 33949 const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true); 33950 33951 // Extract the updated attributes from the source bindings. 33952 const attributes = Object.entries(bindings).reduce((attrs, [key, { 33953 newValue 33954 }]) => { 33955 attrs[key] = newValue; 33956 return attrs; 33957 }, {}); 33958 33959 // If there is no pattern client ID, sync blocks with the same name and same attributes. 33960 if (!patternClientId) { 33961 const syncBlocksWithSameName = blocks => { 33962 for (const block of blocks) { 33963 if (block.attributes?.metadata?.name === blockName) { 33964 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(block.clientId, attributes); 33965 } 33966 syncBlocksWithSameName(block.innerBlocks); 33967 } 33968 }; 33969 syncBlocksWithSameName(getBlocks()); 33970 return; 33971 } 33972 const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; 33973 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { 33974 [CONTENT]: { 33975 ...currentBindingValue, 33976 [blockName]: { 33977 ...currentBindingValue?.[blockName], 33978 ...Object.entries(attributes).reduce((acc, [key, value]) => { 33979 // TODO: We need a way to represent `undefined` in the serialized overrides. 33980 // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871 33981 // We use an empty string to represent undefined for now until 33982 // we support a richer format for overrides and the block bindings API. 33983 acc[key] = value === undefined ? '' : value; 33984 return acc; 33985 }, {}) 33986 } 33987 } 33988 }); 33989 }, 33990 canUserEditValue: () => true 33991 }); 33992 33993 ;// ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js 33994 /* wp:polyfill */ 33995 /** 33996 * WordPress dependencies 33997 */ 33998 33999 34000 /** 34001 * Internal dependencies 34002 */ 34003 34004 34005 34006 /** 34007 * Gets a list of post meta fields with their values and labels 34008 * to be consumed in the needed callbacks. 34009 * If the value is not available based on context, like in templates, 34010 * it falls back to the default value, label, or key. 34011 * 34012 * @param {Object} select The select function from the data store. 34013 * @param {Object} context The context provided. 34014 * @return {Object} List of post meta fields with their value and label. 34015 * 34016 * @example 34017 * ```js 34018 * { 34019 * field_1_key: { 34020 * label: 'Field 1 Label', 34021 * value: 'Field 1 Value', 34022 * }, 34023 * field_2_key: { 34024 * label: 'Field 2 Label', 34025 * value: 'Field 2 Value', 34026 * }, 34027 * ... 34028 * } 34029 * ``` 34030 */ 34031 function getPostMetaFields(select, context) { 34032 const { 34033 getEditedEntityRecord 34034 } = select(external_wp_coreData_namespaceObject.store); 34035 const { 34036 getRegisteredPostMeta 34037 } = unlock(select(external_wp_coreData_namespaceObject.store)); 34038 let entityMetaValues; 34039 // Try to get the current entity meta values. 34040 if (context?.postType && context?.postId) { 34041 entityMetaValues = getEditedEntityRecord('postType', context?.postType, context?.postId).meta; 34042 } 34043 const registeredFields = getRegisteredPostMeta(context?.postType); 34044 const metaFields = {}; 34045 Object.entries(registeredFields || {}).forEach(([key, props]) => { 34046 // Don't include footnotes or private fields. 34047 if (key !== 'footnotes' && key.charAt(0) !== '_') { 34048 var _entityMetaValues$key; 34049 metaFields[key] = { 34050 label: props.title || key, 34051 value: // When using the entity value, an empty string IS a valid value. 34052 (_entityMetaValues$key = entityMetaValues?.[key]) !== null && _entityMetaValues$key !== void 0 ? _entityMetaValues$key : 34053 // When using the default, an empty string IS NOT a valid value. 34054 props.default || undefined, 34055 type: props.type 34056 }; 34057 } 34058 }); 34059 if (!Object.keys(metaFields || {}).length) { 34060 return null; 34061 } 34062 return metaFields; 34063 } 34064 /* harmony default export */ const post_meta = ({ 34065 name: 'core/post-meta', 34066 getValues({ 34067 select, 34068 context, 34069 bindings 34070 }) { 34071 const metaFields = getPostMetaFields(select, context); 34072 const newValues = {}; 34073 for (const [attributeName, source] of Object.entries(bindings)) { 34074 var _ref; 34075 // Use the value, the field label, or the field key. 34076 const fieldKey = source.args.key; 34077 const { 34078 value: fieldValue, 34079 label: fieldLabel 34080 } = metaFields?.[fieldKey] || {}; 34081 newValues[attributeName] = (_ref = fieldValue !== null && fieldValue !== void 0 ? fieldValue : fieldLabel) !== null && _ref !== void 0 ? _ref : fieldKey; 34082 } 34083 return newValues; 34084 }, 34085 setValues({ 34086 dispatch, 34087 context, 34088 bindings 34089 }) { 34090 const newMeta = {}; 34091 Object.values(bindings).forEach(({ 34092 args, 34093 newValue 34094 }) => { 34095 newMeta[args.key] = newValue; 34096 }); 34097 dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', context?.postType, context?.postId, { 34098 meta: newMeta 34099 }); 34100 }, 34101 canUserEditValue({ 34102 select, 34103 context, 34104 args 34105 }) { 34106 // Lock editing in query loop. 34107 if (context?.query || context?.queryId) { 34108 return false; 34109 } 34110 34111 // Lock editing when `postType` is not defined. 34112 if (!context?.postType) { 34113 return false; 34114 } 34115 const fieldValue = getPostMetaFields(select, context)?.[args.key]?.value; 34116 // Empty string or `false` could be a valid value, so we need to check if the field value is undefined. 34117 if (fieldValue === undefined) { 34118 return false; 34119 } 34120 // Check that custom fields metabox is not enabled. 34121 const areCustomFieldsEnabled = select(store_store).getEditorSettings().enableCustomFields; 34122 if (areCustomFieldsEnabled) { 34123 return false; 34124 } 34125 34126 // Check that the user has the capability to edit post meta. 34127 const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser('update', { 34128 kind: 'postType', 34129 name: context?.postType, 34130 id: context?.postId 34131 }); 34132 if (!canUserEdit) { 34133 return false; 34134 } 34135 return true; 34136 }, 34137 getFieldsList({ 34138 select, 34139 context 34140 }) { 34141 return getPostMetaFields(select, context); 34142 } 34143 }); 34144 34145 ;// ./node_modules/@wordpress/editor/build-module/bindings/api.js 34146 /** 34147 * WordPress dependencies 34148 */ 34149 34150 34151 /** 34152 * Internal dependencies 34153 */ 34154 34155 34156 34157 /** 34158 * Function to register core block bindings sources provided by the editor. 34159 * 34160 * @example 34161 * ```js 34162 * import { registerCoreBlockBindingsSources } from '@wordpress/editor'; 34163 * 34164 * registerCoreBlockBindingsSources(); 34165 * ``` 34166 */ 34167 function registerCoreBlockBindingsSources() { 34168 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(pattern_overrides); 34169 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_meta); 34170 } 34171 34172 ;// ./node_modules/@wordpress/editor/build-module/private-apis.js 34173 /** 34174 * WordPress dependencies 34175 */ 34176 34177 34178 /** 34179 * Internal dependencies 34180 */ 34181 34182 34183 34184 34185 34186 34187 34188 34189 34190 34191 34192 34193 34194 34195 34196 34197 34198 const { 34199 store: interfaceStore, 34200 ...remainingInterfaceApis 34201 } = build_module_namespaceObject; 34202 const privateApis = {}; 34203 lock(privateApis, { 34204 CreateTemplatePartModal: CreateTemplatePartModal, 34205 patternTitleField: pattern_title, 34206 templateTitleField: template_title, 34207 BackButton: back_button, 34208 EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible, 34209 Editor: editor, 34210 EditorContentSlotFill: content_slot_fill, 34211 GlobalStylesProvider: GlobalStylesProvider, 34212 mergeBaseAndUserConfigs: mergeBaseAndUserConfigs, 34213 PluginPostExcerpt: post_excerpt_plugin, 34214 PostCardPanel: PostCardPanel, 34215 PreferencesModal: EditorPreferencesModal, 34216 usePostActions: usePostActions, 34217 usePostFields: post_fields, 34218 ToolsMoreMenuGroup: tools_more_menu_group, 34219 ViewMoreMenuGroup: view_more_menu_group, 34220 ResizableEditor: resizable_editor, 34221 registerCoreBlockBindingsSources: registerCoreBlockBindingsSources, 34222 getTemplateInfo: getTemplateInfo, 34223 // This is a temporary private API while we're updating the site editor to use EditorProvider. 34224 interfaceStore, 34225 ...remainingInterfaceApis 34226 }); 34227 34228 ;// ./node_modules/@wordpress/editor/build-module/dataviews/api.js 34229 /** 34230 * WordPress dependencies 34231 */ 34232 34233 34234 /** 34235 * Internal dependencies 34236 */ 34237 34238 34239 34240 /** 34241 * @typedef {import('@wordpress/dataviews').Action} Action 34242 * @typedef {import('@wordpress/dataviews').Field} Field 34243 */ 34244 34245 /** 34246 * Registers a new DataViews action. 34247 * 34248 * This is an experimental API and is subject to change. 34249 * it's only available in the Gutenberg plugin for now. 34250 * 34251 * @param {string} kind Entity kind. 34252 * @param {string} name Entity name. 34253 * @param {Action} config Action configuration. 34254 */ 34255 34256 function api_registerEntityAction(kind, name, config) { 34257 const { 34258 registerEntityAction: _registerEntityAction 34259 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 34260 if (false) {} 34261 } 34262 34263 /** 34264 * Unregisters a DataViews action. 34265 * 34266 * This is an experimental API and is subject to change. 34267 * it's only available in the Gutenberg plugin for now. 34268 * 34269 * @param {string} kind Entity kind. 34270 * @param {string} name Entity name. 34271 * @param {string} actionId Action ID. 34272 */ 34273 function api_unregisterEntityAction(kind, name, actionId) { 34274 const { 34275 unregisterEntityAction: _unregisterEntityAction 34276 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 34277 if (false) {} 34278 } 34279 34280 /** 34281 * Registers a new DataViews field. 34282 * 34283 * This is an experimental API and is subject to change. 34284 * it's only available in the Gutenberg plugin for now. 34285 * 34286 * @param {string} kind Entity kind. 34287 * @param {string} name Entity name. 34288 * @param {Field} config Field configuration. 34289 */ 34290 function api_registerEntityField(kind, name, config) { 34291 const { 34292 registerEntityField: _registerEntityField 34293 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 34294 if (false) {} 34295 } 34296 34297 /** 34298 * Unregisters a DataViews field. 34299 * 34300 * This is an experimental API and is subject to change. 34301 * it's only available in the Gutenberg plugin for now. 34302 * 34303 * @param {string} kind Entity kind. 34304 * @param {string} name Entity name. 34305 * @param {string} fieldId Field ID. 34306 */ 34307 function api_unregisterEntityField(kind, name, fieldId) { 34308 const { 34309 unregisterEntityField: _unregisterEntityField 34310 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 34311 if (false) {} 34312 } 34313 34314 ;// ./node_modules/@wordpress/editor/build-module/index.js 34315 /** 34316 * Internal dependencies 34317 */ 34318 34319 34320 34321 34322 34323 34324 34325 /* 34326 * Backward compatibility 34327 */ 34328 34329 34330 })(); 34331 34332 (window.wp = window.wp || {}).editor = __webpack_exports__; 34333 /******/ })() 34334 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Feb 21 08:20:01 2025 | Cross-referenced by PHPXref |