[ 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 */ plugin_more_menu_item), 1514 PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), 1515 PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), 1516 PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), 1517 PluginPreviewMenuItem: () => (/* reexport */ plugin_preview_menu_item), 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 */ post_format_check), 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 PostSlug: () => (/* reexport */ PostSlug), 1550 PostSlugCheck: () => (/* reexport */ PostSlugCheck), 1551 PostSticky: () => (/* reexport */ PostSticky), 1552 PostStickyCheck: () => (/* reexport */ PostStickyCheck), 1553 PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), 1554 PostSyncStatus: () => (/* reexport */ PostSyncStatus), 1555 PostTaxonomies: () => (/* reexport */ post_taxonomies), 1556 PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), 1557 PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), 1558 PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), 1559 PostTaxonomiesPanel: () => (/* reexport */ post_taxonomies_panel), 1560 PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), 1561 PostTextEditor: () => (/* reexport */ PostTextEditor), 1562 PostTitle: () => (/* reexport */ post_title), 1563 PostTitleRaw: () => (/* reexport */ post_title_raw), 1564 PostTrash: () => (/* reexport */ PostTrash), 1565 PostTrashCheck: () => (/* reexport */ PostTrashCheck), 1566 PostTypeSupportCheck: () => (/* reexport */ post_type_support_check), 1567 PostURL: () => (/* reexport */ PostURL), 1568 PostURLCheck: () => (/* reexport */ PostURLCheck), 1569 PostURLLabel: () => (/* reexport */ PostURLLabel), 1570 PostURLPanel: () => (/* reexport */ PostURLPanel), 1571 PostVisibility: () => (/* reexport */ PostVisibility), 1572 PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), 1573 PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), 1574 RichText: () => (/* reexport */ RichText), 1575 RichTextShortcut: () => (/* reexport */ RichTextShortcut), 1576 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), 1577 ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), 1578 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), 1579 TableOfContents: () => (/* reexport */ table_of_contents), 1580 TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), 1581 ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), 1582 TimeToRead: () => (/* reexport */ TimeToRead), 1583 URLInput: () => (/* reexport */ URLInput), 1584 URLInputButton: () => (/* reexport */ URLInputButton), 1585 URLPopover: () => (/* reexport */ URLPopover), 1586 UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), 1587 VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), 1588 Warning: () => (/* reexport */ Warning), 1589 WordCount: () => (/* reexport */ WordCount), 1590 WritingFlow: () => (/* reexport */ WritingFlow), 1591 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), 1592 cleanForSlug: () => (/* reexport */ cleanForSlug), 1593 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), 1594 getColorClassName: () => (/* reexport */ getColorClassName), 1595 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), 1596 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), 1597 getFontSize: () => (/* reexport */ getFontSize), 1598 getFontSizeClass: () => (/* reexport */ getFontSizeClass), 1599 getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), 1600 mediaUpload: () => (/* reexport */ mediaUpload), 1601 privateApis: () => (/* reexport */ privateApis), 1602 registerEntityAction: () => (/* reexport */ api_registerEntityAction), 1603 store: () => (/* reexport */ store_store), 1604 storeConfig: () => (/* reexport */ storeConfig), 1605 transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), 1606 unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction), 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 trashPost: () => (trashPost), 1808 undo: () => (undo), 1809 unlockPostAutosaving: () => (unlockPostAutosaving), 1810 unlockPostSaving: () => (unlockPostSaving), 1811 updateBlock: () => (updateBlock), 1812 updateBlockAttributes: () => (updateBlockAttributes), 1813 updateBlockListSettings: () => (updateBlockListSettings), 1814 updateEditorSettings: () => (updateEditorSettings), 1815 updatePost: () => (updatePost), 1816 updatePostLock: () => (updatePostLock) 1817 }); 1818 1819 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js 1820 var store_private_actions_namespaceObject = {}; 1821 __webpack_require__.r(store_private_actions_namespaceObject); 1822 __webpack_require__.d(store_private_actions_namespaceObject, { 1823 createTemplate: () => (createTemplate), 1824 hideBlockTypes: () => (hideBlockTypes), 1825 registerEntityAction: () => (registerEntityAction), 1826 registerPostTypeActions: () => (registerPostTypeActions), 1827 removeTemplates: () => (removeTemplates), 1828 revertTemplate: () => (revertTemplate), 1829 saveDirtyEntities: () => (saveDirtyEntities), 1830 setCurrentTemplateId: () => (setCurrentTemplateId), 1831 setIsReady: () => (setIsReady), 1832 showBlockTypes: () => (showBlockTypes), 1833 unregisterEntityAction: () => (unregisterEntityAction) 1834 }); 1835 1836 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 1837 var store_private_selectors_namespaceObject = {}; 1838 __webpack_require__.r(store_private_selectors_namespaceObject); 1839 __webpack_require__.d(store_private_selectors_namespaceObject, { 1840 getEntityActions: () => (private_selectors_getEntityActions), 1841 getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), 1842 getInsertionPoint: () => (getInsertionPoint), 1843 getListViewToggleRef: () => (getListViewToggleRef), 1844 getPostBlocksByName: () => (getPostBlocksByName), 1845 getPostIcon: () => (getPostIcon), 1846 hasPostMetaChanges: () => (hasPostMetaChanges), 1847 isEntityReady: () => (private_selectors_isEntityReady) 1848 }); 1849 1850 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 1851 var store_actions_namespaceObject = {}; 1852 __webpack_require__.r(store_actions_namespaceObject); 1853 __webpack_require__.d(store_actions_namespaceObject, { 1854 closeModal: () => (closeModal), 1855 disableComplementaryArea: () => (disableComplementaryArea), 1856 enableComplementaryArea: () => (enableComplementaryArea), 1857 openModal: () => (openModal), 1858 pinItem: () => (pinItem), 1859 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 1860 setFeatureDefaults: () => (setFeatureDefaults), 1861 setFeatureValue: () => (setFeatureValue), 1862 toggleFeature: () => (toggleFeature), 1863 unpinItem: () => (unpinItem) 1864 }); 1865 1866 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1867 var store_selectors_namespaceObject = {}; 1868 __webpack_require__.r(store_selectors_namespaceObject); 1869 __webpack_require__.d(store_selectors_namespaceObject, { 1870 getActiveComplementaryArea: () => (getActiveComplementaryArea), 1871 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 1872 isFeatureActive: () => (isFeatureActive), 1873 isItemPinned: () => (isItemPinned), 1874 isModalActive: () => (isModalActive) 1875 }); 1876 1877 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js 1878 var build_module_namespaceObject = {}; 1879 __webpack_require__.r(build_module_namespaceObject); 1880 __webpack_require__.d(build_module_namespaceObject, { 1881 ActionItem: () => (action_item), 1882 ComplementaryArea: () => (complementary_area), 1883 ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), 1884 FullscreenMode: () => (fullscreen_mode), 1885 InterfaceSkeleton: () => (interface_skeleton), 1886 NavigableRegion: () => (navigable_region), 1887 PinnedItems: () => (pinned_items), 1888 store: () => (store) 1889 }); 1890 1891 ;// external ["wp","data"] 1892 const external_wp_data_namespaceObject = window["wp"]["data"]; 1893 ;// external ["wp","coreData"] 1894 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1895 ;// external ["wp","element"] 1896 const external_wp_element_namespaceObject = window["wp"]["element"]; 1897 ;// external ["wp","compose"] 1898 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 1899 ;// external ["wp","hooks"] 1900 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1901 ;// external ["wp","blockEditor"] 1902 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 1903 ;// ./node_modules/@wordpress/editor/build-module/store/defaults.js 1904 /** 1905 * WordPress dependencies 1906 */ 1907 1908 1909 /** 1910 * The default post editor settings. 1911 * 1912 * @property {boolean|Array} allowedBlockTypes Allowed block types 1913 * @property {boolean} richEditingEnabled Whether rich editing is enabled or not 1914 * @property {boolean} codeEditingEnabled Whether code editing is enabled or not 1915 * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not. 1916 * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. 1917 * true = the user has opted to show the Custom Fields panel at the bottom of the editor. 1918 * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. 1919 * 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. 1920 * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. 1921 * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. 1922 * @property {Array?} availableTemplates The available post templates 1923 * @property {boolean} disablePostFormats Whether or not the post formats are disabled 1924 * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions 1925 * @property {number} maxUploadFileSize Maximum upload file size 1926 * @property {boolean} supportsLayout Whether the editor supports layouts. 1927 */ 1928 const EDITOR_SETTINGS_DEFAULTS = { 1929 ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, 1930 richEditingEnabled: true, 1931 codeEditingEnabled: true, 1932 fontLibraryEnabled: true, 1933 enableCustomFields: undefined, 1934 defaultRenderingMode: 'post-only' 1935 }; 1936 1937 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js 1938 /** 1939 * WordPress dependencies 1940 */ 1941 1942 function isReady(state = {}, action) { 1943 switch (action.type) { 1944 case 'SET_IS_READY': 1945 return { 1946 ...state, 1947 [action.kind]: { 1948 ...state[action.kind], 1949 [action.name]: true 1950 } 1951 }; 1952 } 1953 return state; 1954 } 1955 function actions(state = {}, action) { 1956 var _state$action$kind$ac; 1957 switch (action.type) { 1958 case 'REGISTER_ENTITY_ACTION': 1959 return { 1960 ...state, 1961 [action.kind]: { 1962 ...state[action.kind], 1963 [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] 1964 } 1965 }; 1966 case 'UNREGISTER_ENTITY_ACTION': 1967 { 1968 var _state$action$kind$ac2; 1969 return { 1970 ...state, 1971 [action.kind]: { 1972 ...state[action.kind], 1973 [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) 1974 } 1975 }; 1976 } 1977 } 1978 return state; 1979 } 1980 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 1981 actions, 1982 isReady 1983 })); 1984 1985 ;// ./node_modules/@wordpress/editor/build-module/store/reducer.js 1986 /** 1987 * WordPress dependencies 1988 */ 1989 1990 1991 /** 1992 * Internal dependencies 1993 */ 1994 1995 1996 1997 /** 1998 * Returns a post attribute value, flattening nested rendered content using its 1999 * raw value in place of its original object form. 2000 * 2001 * @param {*} value Original value. 2002 * 2003 * @return {*} Raw value. 2004 */ 2005 function getPostRawValue(value) { 2006 if (value && 'object' === typeof value && 'raw' in value) { 2007 return value.raw; 2008 } 2009 return value; 2010 } 2011 2012 /** 2013 * Returns true if the two object arguments have the same keys, or false 2014 * otherwise. 2015 * 2016 * @param {Object} a First object. 2017 * @param {Object} b Second object. 2018 * 2019 * @return {boolean} Whether the two objects have the same keys. 2020 */ 2021 function hasSameKeys(a, b) { 2022 const keysA = Object.keys(a).sort(); 2023 const keysB = Object.keys(b).sort(); 2024 return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); 2025 } 2026 2027 /** 2028 * Returns true if, given the currently dispatching action and the previously 2029 * dispatched action, the two actions are editing the same post property, or 2030 * false otherwise. 2031 * 2032 * @param {Object} action Currently dispatching action. 2033 * @param {Object} previousAction Previously dispatched action. 2034 * 2035 * @return {boolean} Whether actions are updating the same post property. 2036 */ 2037 function isUpdatingSamePostProperty(action, previousAction) { 2038 return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); 2039 } 2040 2041 /** 2042 * Returns true if, given the currently dispatching action and the previously 2043 * dispatched action, the two actions are modifying the same property such that 2044 * undo history should be batched. 2045 * 2046 * @param {Object} action Currently dispatching action. 2047 * @param {Object} previousAction Previously dispatched action. 2048 * 2049 * @return {boolean} Whether to overwrite present state. 2050 */ 2051 function shouldOverwriteState(action, previousAction) { 2052 if (action.type === 'RESET_EDITOR_BLOCKS') { 2053 return !action.shouldCreateUndoLevel; 2054 } 2055 if (!previousAction || action.type !== previousAction.type) { 2056 return false; 2057 } 2058 return isUpdatingSamePostProperty(action, previousAction); 2059 } 2060 function postId(state = null, action) { 2061 switch (action.type) { 2062 case 'SET_EDITED_POST': 2063 return action.postId; 2064 } 2065 return state; 2066 } 2067 function templateId(state = null, action) { 2068 switch (action.type) { 2069 case 'SET_CURRENT_TEMPLATE_ID': 2070 return action.id; 2071 } 2072 return state; 2073 } 2074 function postType(state = null, action) { 2075 switch (action.type) { 2076 case 'SET_EDITED_POST': 2077 return action.postType; 2078 } 2079 return state; 2080 } 2081 2082 /** 2083 * Reducer returning whether the post blocks match the defined template or not. 2084 * 2085 * @param {Object} state Current state. 2086 * @param {Object} action Dispatched action. 2087 * 2088 * @return {boolean} Updated state. 2089 */ 2090 function template(state = { 2091 isValid: true 2092 }, action) { 2093 switch (action.type) { 2094 case 'SET_TEMPLATE_VALIDITY': 2095 return { 2096 ...state, 2097 isValid: action.isValid 2098 }; 2099 } 2100 return state; 2101 } 2102 2103 /** 2104 * Reducer returning current network request state (whether a request to 2105 * the WP REST API is in progress, successful, or failed). 2106 * 2107 * @param {Object} state Current state. 2108 * @param {Object} action Dispatched action. 2109 * 2110 * @return {Object} Updated state. 2111 */ 2112 function saving(state = {}, action) { 2113 switch (action.type) { 2114 case 'REQUEST_POST_UPDATE_START': 2115 case 'REQUEST_POST_UPDATE_FINISH': 2116 return { 2117 pending: action.type === 'REQUEST_POST_UPDATE_START', 2118 options: action.options || {} 2119 }; 2120 } 2121 return state; 2122 } 2123 2124 /** 2125 * Reducer returning deleting post request state. 2126 * 2127 * @param {Object} state Current state. 2128 * @param {Object} action Dispatched action. 2129 * 2130 * @return {Object} Updated state. 2131 */ 2132 function deleting(state = {}, action) { 2133 switch (action.type) { 2134 case 'REQUEST_POST_DELETE_START': 2135 case 'REQUEST_POST_DELETE_FINISH': 2136 return { 2137 pending: action.type === 'REQUEST_POST_DELETE_START' 2138 }; 2139 } 2140 return state; 2141 } 2142 2143 /** 2144 * Post Lock State. 2145 * 2146 * @typedef {Object} PostLockState 2147 * 2148 * @property {boolean} isLocked Whether the post is locked. 2149 * @property {?boolean} isTakeover Whether the post editing has been taken over. 2150 * @property {?boolean} activePostLock Active post lock value. 2151 * @property {?Object} user User that took over the post. 2152 */ 2153 2154 /** 2155 * Reducer returning the post lock status. 2156 * 2157 * @param {PostLockState} state Current state. 2158 * @param {Object} action Dispatched action. 2159 * 2160 * @return {PostLockState} Updated state. 2161 */ 2162 function postLock(state = { 2163 isLocked: false 2164 }, action) { 2165 switch (action.type) { 2166 case 'UPDATE_POST_LOCK': 2167 return action.lock; 2168 } 2169 return state; 2170 } 2171 2172 /** 2173 * Post saving lock. 2174 * 2175 * When post saving is locked, the post cannot be published or updated. 2176 * 2177 * @param {PostLockState} state Current state. 2178 * @param {Object} action Dispatched action. 2179 * 2180 * @return {PostLockState} Updated state. 2181 */ 2182 function postSavingLock(state = {}, action) { 2183 switch (action.type) { 2184 case 'LOCK_POST_SAVING': 2185 return { 2186 ...state, 2187 [action.lockName]: true 2188 }; 2189 case 'UNLOCK_POST_SAVING': 2190 { 2191 const { 2192 [action.lockName]: removedLockName, 2193 ...restState 2194 } = state; 2195 return restState; 2196 } 2197 } 2198 return state; 2199 } 2200 2201 /** 2202 * Post autosaving lock. 2203 * 2204 * When post autosaving is locked, the post will not autosave. 2205 * 2206 * @param {PostLockState} state Current state. 2207 * @param {Object} action Dispatched action. 2208 * 2209 * @return {PostLockState} Updated state. 2210 */ 2211 function postAutosavingLock(state = {}, action) { 2212 switch (action.type) { 2213 case 'LOCK_POST_AUTOSAVING': 2214 return { 2215 ...state, 2216 [action.lockName]: true 2217 }; 2218 case 'UNLOCK_POST_AUTOSAVING': 2219 { 2220 const { 2221 [action.lockName]: removedLockName, 2222 ...restState 2223 } = state; 2224 return restState; 2225 } 2226 } 2227 return state; 2228 } 2229 2230 /** 2231 * Reducer returning the post editor setting. 2232 * 2233 * @param {Object} state Current state. 2234 * @param {Object} action Dispatched action. 2235 * 2236 * @return {Object} Updated state. 2237 */ 2238 function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { 2239 switch (action.type) { 2240 case 'UPDATE_EDITOR_SETTINGS': 2241 return { 2242 ...state, 2243 ...action.settings 2244 }; 2245 } 2246 return state; 2247 } 2248 function renderingMode(state = 'post-only', action) { 2249 switch (action.type) { 2250 case 'SET_RENDERING_MODE': 2251 return action.mode; 2252 } 2253 return state; 2254 } 2255 2256 /** 2257 * Reducer returning the editing canvas device type. 2258 * 2259 * @param {Object} state Current state. 2260 * @param {Object} action Dispatched action. 2261 * 2262 * @return {Object} Updated state. 2263 */ 2264 function deviceType(state = 'Desktop', action) { 2265 switch (action.type) { 2266 case 'SET_DEVICE_TYPE': 2267 return action.deviceType; 2268 } 2269 return state; 2270 } 2271 2272 /** 2273 * Reducer storing the list of all programmatically removed panels. 2274 * 2275 * @param {Array} state Current state. 2276 * @param {Object} action Action object. 2277 * 2278 * @return {Array} Updated state. 2279 */ 2280 function removedPanels(state = [], action) { 2281 switch (action.type) { 2282 case 'REMOVE_PANEL': 2283 if (!state.includes(action.panelName)) { 2284 return [...state, action.panelName]; 2285 } 2286 } 2287 return state; 2288 } 2289 2290 /** 2291 * Reducer to set the block inserter panel open or closed. 2292 * 2293 * Note: this reducer interacts with the list view panel reducer 2294 * to make sure that only one of the two panels is open at the same time. 2295 * 2296 * @param {Object} state Current state. 2297 * @param {Object} action Dispatched action. 2298 */ 2299 function blockInserterPanel(state = false, action) { 2300 switch (action.type) { 2301 case 'SET_IS_LIST_VIEW_OPENED': 2302 return action.isOpen ? false : state; 2303 case 'SET_IS_INSERTER_OPENED': 2304 return action.value; 2305 } 2306 return state; 2307 } 2308 2309 /** 2310 * Reducer to set the list view panel open or closed. 2311 * 2312 * Note: this reducer interacts with the inserter panel reducer 2313 * to make sure that only one of the two panels is open at the same time. 2314 * 2315 * @param {Object} state Current state. 2316 * @param {Object} action Dispatched action. 2317 */ 2318 function listViewPanel(state = false, action) { 2319 switch (action.type) { 2320 case 'SET_IS_INSERTER_OPENED': 2321 return action.value ? false : state; 2322 case 'SET_IS_LIST_VIEW_OPENED': 2323 return action.isOpen; 2324 } 2325 return state; 2326 } 2327 2328 /** 2329 * This reducer does nothing aside initializing a ref to the list view toggle. 2330 * We will have a unique ref per "editor" instance. 2331 * 2332 * @param {Object} state 2333 * @return {Object} Reference to the list view toggle button. 2334 */ 2335 function listViewToggleRef(state = { 2336 current: null 2337 }) { 2338 return state; 2339 } 2340 2341 /** 2342 * This reducer does nothing aside initializing a ref to the inserter sidebar toggle. 2343 * We will have a unique ref per "editor" instance. 2344 * 2345 * @param {Object} state 2346 * @return {Object} Reference to the inserter sidebar toggle button. 2347 */ 2348 function inserterSidebarToggleRef(state = { 2349 current: null 2350 }) { 2351 return state; 2352 } 2353 function publishSidebarActive(state = false, action) { 2354 switch (action.type) { 2355 case 'OPEN_PUBLISH_SIDEBAR': 2356 return true; 2357 case 'CLOSE_PUBLISH_SIDEBAR': 2358 return false; 2359 case 'TOGGLE_PUBLISH_SIDEBAR': 2360 return !state; 2361 } 2362 return state; 2363 } 2364 /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 2365 postId, 2366 postType, 2367 templateId, 2368 saving, 2369 deleting, 2370 postLock, 2371 template, 2372 postSavingLock, 2373 editorSettings, 2374 postAutosavingLock, 2375 renderingMode, 2376 deviceType, 2377 removedPanels, 2378 blockInserterPanel, 2379 inserterSidebarToggleRef, 2380 listViewPanel, 2381 listViewToggleRef, 2382 publishSidebarActive, 2383 dataviews: reducer 2384 })); 2385 2386 ;// external ["wp","blocks"] 2387 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 2388 ;// external ["wp","date"] 2389 const external_wp_date_namespaceObject = window["wp"]["date"]; 2390 ;// external ["wp","url"] 2391 const external_wp_url_namespaceObject = window["wp"]["url"]; 2392 ;// external ["wp","deprecated"] 2393 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 2394 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 2395 ;// external ["wp","primitives"] 2396 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 2397 ;// external "ReactJSXRuntime" 2398 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 2399 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 2400 /** 2401 * WordPress dependencies 2402 */ 2403 2404 2405 const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2406 xmlns: "http://www.w3.org/2000/svg", 2407 viewBox: "0 0 24 24", 2408 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2409 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" 2410 }) 2411 }); 2412 /* harmony default export */ const library_layout = (layout); 2413 2414 ;// external ["wp","preferences"] 2415 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 2416 ;// ./node_modules/@wordpress/editor/build-module/store/constants.js 2417 /** 2418 * Set of post properties for which edits should assume a merging behavior, 2419 * assuming an object value. 2420 * 2421 * @type {Set} 2422 */ 2423 const EDIT_MERGE_PROPERTIES = new Set(['meta']); 2424 2425 /** 2426 * Constant for the store module (or reducer) key. 2427 * 2428 * @type {string} 2429 */ 2430 const STORE_NAME = 'core/editor'; 2431 const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; 2432 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; 2433 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 2434 const ONE_MINUTE_IN_MS = 60 * 1000; 2435 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; 2436 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized'; 2437 const TEMPLATE_POST_TYPE = 'wp_template'; 2438 const TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 2439 const PATTERN_POST_TYPE = 'wp_block'; 2440 const NAVIGATION_POST_TYPE = 'wp_navigation'; 2441 const TEMPLATE_ORIGINS = { 2442 custom: 'custom', 2443 theme: 'theme', 2444 plugin: 'plugin' 2445 }; 2446 const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part']; 2447 const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation']; 2448 2449 ;// ./node_modules/@wordpress/icons/build-module/library/header.js 2450 /** 2451 * WordPress dependencies 2452 */ 2453 2454 2455 const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2456 xmlns: "http://www.w3.org/2000/svg", 2457 viewBox: "0 0 24 24", 2458 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2459 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" 2460 }) 2461 }); 2462 /* harmony default export */ const library_header = (header); 2463 2464 ;// ./node_modules/@wordpress/icons/build-module/library/footer.js 2465 /** 2466 * WordPress dependencies 2467 */ 2468 2469 2470 const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2471 xmlns: "http://www.w3.org/2000/svg", 2472 viewBox: "0 0 24 24", 2473 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2474 fillRule: "evenodd", 2475 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" 2476 }) 2477 }); 2478 /* harmony default export */ const library_footer = (footer); 2479 2480 ;// ./node_modules/@wordpress/icons/build-module/library/sidebar.js 2481 /** 2482 * WordPress dependencies 2483 */ 2484 2485 2486 const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2487 xmlns: "http://www.w3.org/2000/svg", 2488 viewBox: "0 0 24 24", 2489 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2490 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" 2491 }) 2492 }); 2493 /* harmony default export */ const library_sidebar = (sidebar); 2494 2495 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 2496 /** 2497 * WordPress dependencies 2498 */ 2499 2500 2501 const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2502 xmlns: "http://www.w3.org/2000/svg", 2503 viewBox: "0 0 24 24", 2504 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2505 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" 2506 }) 2507 }); 2508 /* harmony default export */ const symbol_filled = (symbolFilled); 2509 2510 ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js 2511 /** 2512 * WordPress dependencies 2513 */ 2514 2515 /** 2516 * Helper function to retrieve the corresponding icon by name. 2517 * 2518 * @param {string} iconName The name of the icon. 2519 * 2520 * @return {Object} The corresponding icon. 2521 */ 2522 function getTemplatePartIcon(iconName) { 2523 if ('header' === iconName) { 2524 return library_header; 2525 } else if ('footer' === iconName) { 2526 return library_footer; 2527 } else if ('sidebar' === iconName) { 2528 return library_sidebar; 2529 } 2530 return symbol_filled; 2531 } 2532 2533 ;// ./node_modules/@wordpress/editor/build-module/store/selectors.js 2534 /** 2535 * WordPress dependencies 2536 */ 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 /** 2549 * Internal dependencies 2550 */ 2551 2552 2553 2554 2555 /** 2556 * Shared reference to an empty object for cases where it is important to avoid 2557 * returning a new object reference on every invocation, as in a connected or 2558 * other pure component which performs `shouldComponentUpdate` check on props. 2559 * This should be used as a last resort, since the normalized data should be 2560 * maintained by the reducer result in state. 2561 */ 2562 const EMPTY_OBJECT = {}; 2563 2564 /** 2565 * Returns true if any past editor history snapshots exist, or false otherwise. 2566 * 2567 * @param {Object} state Global application state. 2568 * 2569 * @return {boolean} Whether undo history exists. 2570 */ 2571 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2572 return select(external_wp_coreData_namespaceObject.store).hasUndo(); 2573 }); 2574 2575 /** 2576 * Returns true if any future editor history snapshots exist, or false 2577 * otherwise. 2578 * 2579 * @param {Object} state Global application state. 2580 * 2581 * @return {boolean} Whether redo history exists. 2582 */ 2583 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 2584 return select(external_wp_coreData_namespaceObject.store).hasRedo(); 2585 }); 2586 2587 /** 2588 * Returns true if the currently edited post is yet to be saved, or false if 2589 * the post has been saved. 2590 * 2591 * @param {Object} state Global application state. 2592 * 2593 * @return {boolean} Whether the post is new. 2594 */ 2595 function isEditedPostNew(state) { 2596 return getCurrentPost(state).status === 'auto-draft'; 2597 } 2598 2599 /** 2600 * Returns true if content includes unsaved changes, or false otherwise. 2601 * 2602 * @param {Object} state Editor state. 2603 * 2604 * @return {boolean} Whether content includes unsaved changes. 2605 */ 2606 function hasChangedContent(state) { 2607 const edits = getPostEdits(state); 2608 return 'content' in edits; 2609 } 2610 2611 /** 2612 * Returns true if there are unsaved values for the current edit session, or 2613 * false if the editing state matches the saved or new post. 2614 * 2615 * @param {Object} state Global application state. 2616 * 2617 * @return {boolean} Whether unsaved values exist. 2618 */ 2619 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2620 // Edits should contain only fields which differ from the saved post (reset 2621 // at initial load and save complete). Thus, a non-empty edits state can be 2622 // inferred to contain unsaved values. 2623 const postType = getCurrentPostType(state); 2624 const postId = getCurrentPostId(state); 2625 return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId); 2626 }); 2627 2628 /** 2629 * Returns true if there are unsaved edits for entities other than 2630 * the editor's post, and false otherwise. 2631 * 2632 * @param {Object} state Global application state. 2633 * 2634 * @return {boolean} Whether there are edits or not. 2635 */ 2636 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2637 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); 2638 const { 2639 type, 2640 id 2641 } = getCurrentPost(state); 2642 return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 2643 }); 2644 2645 /** 2646 * Returns true if there are no unsaved values for the current edit session and 2647 * if the currently edited post is new (has never been saved before). 2648 * 2649 * @param {Object} state Global application state. 2650 * 2651 * @return {boolean} Whether new post and unsaved values exist. 2652 */ 2653 function isCleanNewPost(state) { 2654 return !isEditedPostDirty(state) && isEditedPostNew(state); 2655 } 2656 2657 /** 2658 * Returns the post currently being edited in its last known saved state, not 2659 * including unsaved edits. Returns an object containing relevant default post 2660 * values if the post has not yet been saved. 2661 * 2662 * @param {Object} state Global application state. 2663 * 2664 * @return {Object} Post object. 2665 */ 2666 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2667 const postId = getCurrentPostId(state); 2668 const postType = getCurrentPostType(state); 2669 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); 2670 if (post) { 2671 return post; 2672 } 2673 2674 // This exists for compatibility with the previous selector behavior 2675 // which would guarantee an object return based on the editor reducer's 2676 // default empty object state. 2677 return EMPTY_OBJECT; 2678 }); 2679 2680 /** 2681 * Returns the post type of the post currently being edited. 2682 * 2683 * @param {Object} state Global application state. 2684 * 2685 * @return {string} Post type. 2686 */ 2687 function getCurrentPostType(state) { 2688 return state.postType; 2689 } 2690 2691 /** 2692 * Returns the ID of the post currently being edited, or null if the post has 2693 * not yet been saved. 2694 * 2695 * @param {Object} state Global application state. 2696 * 2697 * @return {?number} ID of current post. 2698 */ 2699 function getCurrentPostId(state) { 2700 return state.postId; 2701 } 2702 2703 /** 2704 * Returns the template ID currently being rendered/edited 2705 * 2706 * @param {Object} state Global application state. 2707 * 2708 * @return {string?} Template ID. 2709 */ 2710 function getCurrentTemplateId(state) { 2711 return state.templateId; 2712 } 2713 2714 /** 2715 * Returns the number of revisions of the post currently being edited. 2716 * 2717 * @param {Object} state Global application state. 2718 * 2719 * @return {number} Number of revisions. 2720 */ 2721 function getCurrentPostRevisionsCount(state) { 2722 var _getCurrentPost$_link; 2723 return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0; 2724 } 2725 2726 /** 2727 * Returns the last revision ID of the post currently being edited, 2728 * or null if the post has no revisions. 2729 * 2730 * @param {Object} state Global application state. 2731 * 2732 * @return {?number} ID of the last revision. 2733 */ 2734 function getCurrentPostLastRevisionId(state) { 2735 var _getCurrentPost$_link2; 2736 return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null; 2737 } 2738 2739 /** 2740 * Returns any post values which have been changed in the editor but not yet 2741 * been saved. 2742 * 2743 * @param {Object} state Global application state. 2744 * 2745 * @return {Object} Object of key value pairs comprising unsaved edits. 2746 */ 2747 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2748 const postType = getCurrentPostType(state); 2749 const postId = getCurrentPostId(state); 2750 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; 2751 }); 2752 2753 /** 2754 * Returns an attribute value of the saved post. 2755 * 2756 * @param {Object} state Global application state. 2757 * @param {string} attributeName Post attribute name. 2758 * 2759 * @return {*} Post attribute value. 2760 */ 2761 function getCurrentPostAttribute(state, attributeName) { 2762 switch (attributeName) { 2763 case 'type': 2764 return getCurrentPostType(state); 2765 case 'id': 2766 return getCurrentPostId(state); 2767 default: 2768 const post = getCurrentPost(state); 2769 if (!post.hasOwnProperty(attributeName)) { 2770 break; 2771 } 2772 return getPostRawValue(post[attributeName]); 2773 } 2774 } 2775 2776 /** 2777 * Returns a single attribute of the post being edited, preferring the unsaved 2778 * edit if one exists, but merging with the attribute value for the last known 2779 * saved state of the post (this is needed for some nested attributes like meta). 2780 * 2781 * @param {Object} state Global application state. 2782 * @param {string} attributeName Post attribute name. 2783 * 2784 * @return {*} Post attribute value. 2785 */ 2786 const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => { 2787 const edits = getPostEdits(state); 2788 if (!edits.hasOwnProperty(attributeName)) { 2789 return getCurrentPostAttribute(state, attributeName); 2790 } 2791 return { 2792 ...getCurrentPostAttribute(state, attributeName), 2793 ...edits[attributeName] 2794 }; 2795 }, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]); 2796 2797 /** 2798 * Returns a single attribute of the post being edited, preferring the unsaved 2799 * edit if one exists, but falling back to the attribute for the last known 2800 * saved state of the post. 2801 * 2802 * @param {Object} state Global application state. 2803 * @param {string} attributeName Post attribute name. 2804 * 2805 * @return {*} Post attribute value. 2806 */ 2807 function getEditedPostAttribute(state, attributeName) { 2808 // Special cases. 2809 switch (attributeName) { 2810 case 'content': 2811 return getEditedPostContent(state); 2812 } 2813 2814 // Fall back to saved post value if not edited. 2815 const edits = getPostEdits(state); 2816 if (!edits.hasOwnProperty(attributeName)) { 2817 return getCurrentPostAttribute(state, attributeName); 2818 } 2819 2820 // Merge properties are objects which contain only the patch edit in state, 2821 // and thus must be merged with the current post attribute. 2822 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2823 return getNestedEditedPostProperty(state, attributeName); 2824 } 2825 return edits[attributeName]; 2826 } 2827 2828 /** 2829 * Returns an attribute value of the current autosave revision for a post, or 2830 * null if there is no autosave for the post. 2831 * 2832 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector 2833 * from the '@wordpress/core-data' package and access properties on the returned 2834 * autosave object using getPostRawValue. 2835 * 2836 * @param {Object} state Global application state. 2837 * @param {string} attributeName Autosave attribute name. 2838 * 2839 * @return {*} Autosave attribute value. 2840 */ 2841 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { 2842 if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') { 2843 return; 2844 } 2845 const postType = getCurrentPostType(state); 2846 2847 // Currently template autosaving is not supported. 2848 if (postType === 'wp_template') { 2849 return false; 2850 } 2851 const postId = getCurrentPostId(state); 2852 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 2853 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 2854 if (autosave) { 2855 return getPostRawValue(autosave[attributeName]); 2856 } 2857 }); 2858 2859 /** 2860 * Returns the current visibility of the post being edited, preferring the 2861 * unsaved value if different than the saved post. The return value is one of 2862 * "private", "password", or "public". 2863 * 2864 * @param {Object} state Global application state. 2865 * 2866 * @return {string} Post visibility. 2867 */ 2868 function getEditedPostVisibility(state) { 2869 const status = getEditedPostAttribute(state, 'status'); 2870 if (status === 'private') { 2871 return 'private'; 2872 } 2873 const password = getEditedPostAttribute(state, 'password'); 2874 if (password) { 2875 return 'password'; 2876 } 2877 return 'public'; 2878 } 2879 2880 /** 2881 * Returns true if post is pending review. 2882 * 2883 * @param {Object} state Global application state. 2884 * 2885 * @return {boolean} Whether current post is pending review. 2886 */ 2887 function isCurrentPostPending(state) { 2888 return getCurrentPost(state).status === 'pending'; 2889 } 2890 2891 /** 2892 * Return true if the current post has already been published. 2893 * 2894 * @param {Object} state Global application state. 2895 * @param {Object?} currentPost Explicit current post for bypassing registry selector. 2896 * 2897 * @return {boolean} Whether the post has been published. 2898 */ 2899 function isCurrentPostPublished(state, currentPost) { 2900 const post = currentPost || getCurrentPost(state); 2901 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)); 2902 } 2903 2904 /** 2905 * Returns true if post is already scheduled. 2906 * 2907 * @param {Object} state Global application state. 2908 * 2909 * @return {boolean} Whether current post is scheduled to be posted. 2910 */ 2911 function isCurrentPostScheduled(state) { 2912 return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); 2913 } 2914 2915 /** 2916 * Return true if the post being edited can be published. 2917 * 2918 * @param {Object} state Global application state. 2919 * 2920 * @return {boolean} Whether the post can been published. 2921 */ 2922 function isEditedPostPublishable(state) { 2923 const post = getCurrentPost(state); 2924 2925 // TODO: Post being publishable should be superset of condition of post 2926 // being saveable. Currently this restriction is imposed at UI. 2927 // 2928 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). 2929 2930 return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; 2931 } 2932 2933 /** 2934 * Returns true if the post can be saved, or false otherwise. A post must 2935 * contain a title, an excerpt, or non-empty content to be valid for save. 2936 * 2937 * @param {Object} state Global application state. 2938 * 2939 * @return {boolean} Whether the post can be saved. 2940 */ 2941 function isEditedPostSaveable(state) { 2942 if (isSavingPost(state)) { 2943 return false; 2944 } 2945 2946 // TODO: Post should not be saveable if not dirty. Cannot be added here at 2947 // this time since posts where meta boxes are present can be saved even if 2948 // the post is not dirty. Currently this restriction is imposed at UI, but 2949 // should be moved here. 2950 // 2951 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) 2952 // See: <PostSavedState /> (`forceIsDirty` prop) 2953 // See: <PostPublishButton /> (`forceIsDirty` prop) 2954 // See: https://github.com/WordPress/gutenberg/pull/4184. 2955 2956 return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; 2957 } 2958 2959 /** 2960 * Returns true if the edited post has content. A post has content if it has at 2961 * least one saveable block or otherwise has a non-empty content property 2962 * assigned. 2963 * 2964 * @param {Object} state Global application state. 2965 * 2966 * @return {boolean} Whether post has content. 2967 */ 2968 const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 2969 // While the condition of truthy content string is sufficient to determine 2970 // emptiness, testing saveable blocks length is a trivial operation. Since 2971 // this function can be called frequently, optimize for the fast case as a 2972 // condition of the mere existence of blocks. Note that the value of edited 2973 // content takes precedent over block content, and must fall through to the 2974 // default logic. 2975 const postId = getCurrentPostId(state); 2976 const postType = getCurrentPostType(state); 2977 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 2978 if (typeof record.content !== 'function') { 2979 return !record.content; 2980 } 2981 const blocks = getEditedPostAttribute(state, 'blocks'); 2982 if (blocks.length === 0) { 2983 return true; 2984 } 2985 2986 // Pierce the abstraction of the serializer in knowing that blocks are 2987 // joined with newlines such that even if every individual block 2988 // produces an empty save result, the serialized content is non-empty. 2989 if (blocks.length > 1) { 2990 return false; 2991 } 2992 2993 // There are two conditions under which the optimization cannot be 2994 // assumed, and a fallthrough to getEditedPostContent must occur: 2995 // 2996 // 1. getBlocksForSerialization has special treatment in omitting a 2997 // single unmodified default block. 2998 // 2. Comment delimiters are omitted for a freeform or unregistered 2999 // block in its serialization. The freeform block specifically may 3000 // produce an empty string in its saved output. 3001 // 3002 // For all other content, the single block is assumed to make a post 3003 // non-empty, if only by virtue of its own comment delimiters. 3004 const blockName = blocks[0].name; 3005 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { 3006 return false; 3007 } 3008 return !getEditedPostContent(state); 3009 }); 3010 3011 /** 3012 * Returns true if the post can be autosaved, or false otherwise. 3013 * 3014 * @param {Object} state Global application state. 3015 * @param {Object} autosave A raw autosave object from the REST API. 3016 * 3017 * @return {boolean} Whether the post can be autosaved. 3018 */ 3019 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3020 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. 3021 if (!isEditedPostSaveable(state)) { 3022 return false; 3023 } 3024 3025 // A post is not autosavable when there is a post autosave lock. 3026 if (isPostAutosavingLocked(state)) { 3027 return false; 3028 } 3029 const postType = getCurrentPostType(state); 3030 3031 // Currently template autosaving is not supported. 3032 if (postType === 'wp_template') { 3033 return false; 3034 } 3035 const postId = getCurrentPostId(state); 3036 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); 3037 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 3038 3039 // Disable reason - this line causes the side-effect of fetching the autosave 3040 // via a resolver, moving below the return would result in the autosave never 3041 // being fetched. 3042 // eslint-disable-next-line @wordpress/no-unused-vars-before-return 3043 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); 3044 3045 // If any existing autosaves have not yet been fetched, this function is 3046 // unable to determine if the post is autosaveable, so return false. 3047 if (!hasFetchedAutosave) { 3048 return false; 3049 } 3050 3051 // If we don't already have an autosave, the post is autosaveable. 3052 if (!autosave) { 3053 return true; 3054 } 3055 3056 // To avoid an expensive content serialization, use the content dirtiness 3057 // flag in place of content field comparison against the known autosave. 3058 // This is not strictly accurate, and relies on a tolerance toward autosave 3059 // request failures for unnecessary saves. 3060 if (hasChangedContent(state)) { 3061 return true; 3062 } 3063 3064 // If title, excerpt, or meta have changed, the post is autosaveable. 3065 return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); 3066 }); 3067 3068 /** 3069 * Return true if the post being edited is being scheduled. Preferring the 3070 * unsaved status values. 3071 * 3072 * @param {Object} state Global application state. 3073 * 3074 * @return {boolean} Whether the post has been published. 3075 */ 3076 function isEditedPostBeingScheduled(state) { 3077 const date = getEditedPostAttribute(state, 'date'); 3078 // Offset the date by one minute (network latency). 3079 const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); 3080 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); 3081 } 3082 3083 /** 3084 * Returns whether the current post should be considered to have a "floating" 3085 * date (i.e. that it would publish "Immediately" rather than at a set time). 3086 * 3087 * Unlike in the PHP backend, the REST API returns a full date string for posts 3088 * where the 0000-00-00T00:00:00 placeholder is present in the database. To 3089 * infer that a post is set to publish "Immediately" we check whether the date 3090 * and modified date are the same. 3091 * 3092 * @param {Object} state Editor state. 3093 * 3094 * @return {boolean} Whether the edited post has a floating date value. 3095 */ 3096 function isEditedPostDateFloating(state) { 3097 const date = getEditedPostAttribute(state, 'date'); 3098 const modified = getEditedPostAttribute(state, 'modified'); 3099 3100 // This should be the status of the persisted post 3101 // It shouldn't use the "edited" status otherwise it breaks the 3102 // inferred post data floating status 3103 // See https://github.com/WordPress/gutenberg/issues/28083. 3104 const status = getCurrentPost(state).status; 3105 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { 3106 return date === modified || date === null; 3107 } 3108 return false; 3109 } 3110 3111 /** 3112 * Returns true if the post is currently being deleted, or false otherwise. 3113 * 3114 * @param {Object} state Editor state. 3115 * 3116 * @return {boolean} Whether post is being deleted. 3117 */ 3118 function isDeletingPost(state) { 3119 return !!state.deleting.pending; 3120 } 3121 3122 /** 3123 * Returns true if the post is currently being saved, or false otherwise. 3124 * 3125 * @param {Object} state Global application state. 3126 * 3127 * @return {boolean} Whether post is being saved. 3128 */ 3129 function isSavingPost(state) { 3130 return !!state.saving.pending; 3131 } 3132 3133 /** 3134 * Returns true if non-post entities are currently being saved, or false otherwise. 3135 * 3136 * @param {Object} state Global application state. 3137 * 3138 * @return {boolean} Whether non-post entities are being saved. 3139 */ 3140 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3141 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); 3142 const { 3143 type, 3144 id 3145 } = getCurrentPost(state); 3146 return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); 3147 }); 3148 3149 /** 3150 * Returns true if a previous post save was attempted successfully, or false 3151 * otherwise. 3152 * 3153 * @param {Object} state Global application state. 3154 * 3155 * @return {boolean} Whether the post was saved successfully. 3156 */ 3157 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3158 const postType = getCurrentPostType(state); 3159 const postId = getCurrentPostId(state); 3160 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3161 }); 3162 3163 /** 3164 * Returns true if a previous post save was attempted but failed, or false 3165 * otherwise. 3166 * 3167 * @param {Object} state Global application state. 3168 * 3169 * @return {boolean} Whether the post save failed. 3170 */ 3171 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3172 const postType = getCurrentPostType(state); 3173 const postId = getCurrentPostId(state); 3174 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); 3175 }); 3176 3177 /** 3178 * Returns true if the post is autosaving, or false otherwise. 3179 * 3180 * @param {Object} state Global application state. 3181 * 3182 * @return {boolean} Whether the post is autosaving. 3183 */ 3184 function isAutosavingPost(state) { 3185 return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); 3186 } 3187 3188 /** 3189 * Returns true if the post is being previewed, or false otherwise. 3190 * 3191 * @param {Object} state Global application state. 3192 * 3193 * @return {boolean} Whether the post is being previewed. 3194 */ 3195 function isPreviewingPost(state) { 3196 return isSavingPost(state) && Boolean(state.saving.options?.isPreview); 3197 } 3198 3199 /** 3200 * Returns the post preview link 3201 * 3202 * @param {Object} state Global application state. 3203 * 3204 * @return {string | undefined} Preview Link. 3205 */ 3206 function getEditedPostPreviewLink(state) { 3207 if (state.saving.pending || isSavingPost(state)) { 3208 return; 3209 } 3210 let previewLink = getAutosaveAttribute(state, 'preview_link'); 3211 // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 3212 // If the post is draft, ignore the preview link from the autosave record, 3213 // because the preview could be a stale autosave if the post was switched from 3214 // published to draft. 3215 // See: https://github.com/WordPress/gutenberg/pull/37952. 3216 if (!previewLink || 'draft' === getCurrentPost(state).status) { 3217 previewLink = getEditedPostAttribute(state, 'link'); 3218 if (previewLink) { 3219 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3220 preview: true 3221 }); 3222 } 3223 } 3224 const featuredImageId = getEditedPostAttribute(state, 'featured_media'); 3225 if (previewLink && featuredImageId) { 3226 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { 3227 _thumbnail_id: featuredImageId 3228 }); 3229 } 3230 return previewLink; 3231 } 3232 3233 /** 3234 * Returns a suggested post format for the current post, inferred only if there 3235 * is a single block within the post and it is of a type known to match a 3236 * default post format. Returns null if the format cannot be determined. 3237 * 3238 * @return {?string} Suggested post format. 3239 */ 3240 const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3241 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); 3242 if (blocks.length > 2) { 3243 return null; 3244 } 3245 let name; 3246 // If there is only one block in the content of the post grab its name 3247 // so we can derive a suitable post format from it. 3248 if (blocks.length === 1) { 3249 name = blocks[0].name; 3250 // Check for core/embed `video` and `audio` eligible suggestions. 3251 if (name === 'core/embed') { 3252 const provider = blocks[0].attributes?.providerNameSlug; 3253 if (['youtube', 'vimeo'].includes(provider)) { 3254 name = 'core/video'; 3255 } else if (['spotify', 'soundcloud'].includes(provider)) { 3256 name = 'core/audio'; 3257 } 3258 } 3259 } 3260 3261 // If there are two blocks in the content and the last one is a text blocks 3262 // grab the name of the first one to also suggest a post format from it. 3263 if (blocks.length === 2 && blocks[1].name === 'core/paragraph') { 3264 name = blocks[0].name; 3265 } 3266 3267 // We only convert to default post formats in core. 3268 switch (name) { 3269 case 'core/image': 3270 return 'image'; 3271 case 'core/quote': 3272 case 'core/pullquote': 3273 return 'quote'; 3274 case 'core/gallery': 3275 return 'gallery'; 3276 case 'core/video': 3277 return 'video'; 3278 case 'core/audio': 3279 return 'audio'; 3280 default: 3281 return null; 3282 } 3283 }); 3284 3285 /** 3286 * Returns the content of the post being edited. 3287 * 3288 * @param {Object} state Global application state. 3289 * 3290 * @return {string} Post content. 3291 */ 3292 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3293 const postId = getCurrentPostId(state); 3294 const postType = getCurrentPostType(state); 3295 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 3296 if (record) { 3297 if (typeof record.content === 'function') { 3298 return record.content(record); 3299 } else if (record.blocks) { 3300 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 3301 } else if (record.content) { 3302 return record.content; 3303 } 3304 } 3305 return ''; 3306 }); 3307 3308 /** 3309 * Returns true if the post is being published, or false otherwise. 3310 * 3311 * @param {Object} state Global application state. 3312 * 3313 * @return {boolean} Whether post is being published. 3314 */ 3315 function isPublishingPost(state) { 3316 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; 3317 } 3318 3319 /** 3320 * Returns whether the permalink is editable or not. 3321 * 3322 * @param {Object} state Editor state. 3323 * 3324 * @return {boolean} Whether or not the permalink is editable. 3325 */ 3326 function isPermalinkEditable(state) { 3327 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3328 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 3329 } 3330 3331 /** 3332 * Returns the permalink for the post. 3333 * 3334 * @param {Object} state Editor state. 3335 * 3336 * @return {?string} The permalink, or null if the post is not viewable. 3337 */ 3338 function getPermalink(state) { 3339 const permalinkParts = getPermalinkParts(state); 3340 if (!permalinkParts) { 3341 return null; 3342 } 3343 const { 3344 prefix, 3345 postName, 3346 suffix 3347 } = permalinkParts; 3348 if (isPermalinkEditable(state)) { 3349 return prefix + postName + suffix; 3350 } 3351 return prefix; 3352 } 3353 3354 /** 3355 * Returns the slug for the post being edited, preferring a manually edited 3356 * value if one exists, then a sanitized version of the current post title, and 3357 * finally the post ID. 3358 * 3359 * @param {Object} state Editor state. 3360 * 3361 * @return {string} The current slug to be displayed in the editor 3362 */ 3363 function getEditedPostSlug(state) { 3364 return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); 3365 } 3366 3367 /** 3368 * Returns the permalink for a post, split into its three parts: the prefix, 3369 * the postName, and the suffix. 3370 * 3371 * @param {Object} state Editor state. 3372 * 3373 * @return {Object} An object containing the prefix, postName, and suffix for 3374 * the permalink, or null if the post is not viewable. 3375 */ 3376 function getPermalinkParts(state) { 3377 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); 3378 if (!permalinkTemplate) { 3379 return null; 3380 } 3381 const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); 3382 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); 3383 return { 3384 prefix, 3385 postName, 3386 suffix 3387 }; 3388 } 3389 3390 /** 3391 * Returns whether the post is locked. 3392 * 3393 * @param {Object} state Global application state. 3394 * 3395 * @return {boolean} Is locked. 3396 */ 3397 function isPostLocked(state) { 3398 return state.postLock.isLocked; 3399 } 3400 3401 /** 3402 * Returns whether post saving is locked. 3403 * 3404 * @param {Object} state Global application state. 3405 * 3406 * @return {boolean} Is locked. 3407 */ 3408 function isPostSavingLocked(state) { 3409 return Object.keys(state.postSavingLock).length > 0; 3410 } 3411 3412 /** 3413 * Returns whether post autosaving is locked. 3414 * 3415 * @param {Object} state Global application state. 3416 * 3417 * @return {boolean} Is locked. 3418 */ 3419 function isPostAutosavingLocked(state) { 3420 return Object.keys(state.postAutosavingLock).length > 0; 3421 } 3422 3423 /** 3424 * Returns whether the edition of the post has been taken over. 3425 * 3426 * @param {Object} state Global application state. 3427 * 3428 * @return {boolean} Is post lock takeover. 3429 */ 3430 function isPostLockTakeover(state) { 3431 return state.postLock.isTakeover; 3432 } 3433 3434 /** 3435 * Returns details about the post lock user. 3436 * 3437 * @param {Object} state Global application state. 3438 * 3439 * @return {Object} A user object. 3440 */ 3441 function getPostLockUser(state) { 3442 return state.postLock.user; 3443 } 3444 3445 /** 3446 * Returns the active post lock. 3447 * 3448 * @param {Object} state Global application state. 3449 * 3450 * @return {Object} The lock object. 3451 */ 3452 function getActivePostLock(state) { 3453 return state.postLock.activePostLock; 3454 } 3455 3456 /** 3457 * Returns whether or not the user has the unfiltered_html capability. 3458 * 3459 * @param {Object} state Editor state. 3460 * 3461 * @return {boolean} Whether the user can or can't post unfiltered HTML. 3462 */ 3463 function canUserUseUnfilteredHTML(state) { 3464 return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html')); 3465 } 3466 3467 /** 3468 * Returns whether the pre-publish panel should be shown 3469 * or skipped when the user clicks the "publish" button. 3470 * 3471 * @return {boolean} Whether the pre-publish panel should be shown or not. 3472 */ 3473 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled')); 3474 3475 /** 3476 * Return the current block list. 3477 * 3478 * @param {Object} state 3479 * @return {Array} Block list. 3480 */ 3481 const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { 3482 return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); 3483 }, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]); 3484 3485 /** 3486 * Returns true if the given panel was programmatically removed, or false otherwise. 3487 * All panels are not removed by default. 3488 * 3489 * @param {Object} state Global application state. 3490 * @param {string} panelName A string that identifies the panel. 3491 * 3492 * @return {boolean} Whether or not the panel is removed. 3493 */ 3494 function isEditorPanelRemoved(state, panelName) { 3495 return state.removedPanels.includes(panelName); 3496 } 3497 3498 /** 3499 * Returns true if the given panel is enabled, or false otherwise. Panels are 3500 * enabled by default. 3501 * 3502 * @param {Object} state Global application state. 3503 * @param {string} panelName A string that identifies the panel. 3504 * 3505 * @return {boolean} Whether or not the panel is enabled. 3506 */ 3507 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3508 // For backward compatibility, we check edit-post 3509 // even though now this is in "editor" package. 3510 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); 3511 return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); 3512 }); 3513 3514 /** 3515 * Returns true if the given panel is open, or false otherwise. Panels are 3516 * closed by default. 3517 * 3518 * @param {Object} state Global application state. 3519 * @param {string} panelName A string that identifies the panel. 3520 * 3521 * @return {boolean} Whether or not the panel is open. 3522 */ 3523 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3524 // For backward compatibility, we check edit-post 3525 // even though now this is in "editor" package. 3526 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); 3527 return !!openPanels?.includes(panelName); 3528 }); 3529 3530 /** 3531 * A block selection object. 3532 * 3533 * @typedef {Object} WPBlockSelection 3534 * 3535 * @property {string} clientId A block client ID. 3536 * @property {string} attributeKey A block attribute key. 3537 * @property {number} offset An attribute value offset, based on the rich 3538 * text value. See `wp.richText.create`. 3539 */ 3540 3541 /** 3542 * Returns the current selection start. 3543 * 3544 * @param {Object} state 3545 * @return {WPBlockSelection} The selection start. 3546 * 3547 * @deprecated since Gutenberg 10.0.0. 3548 */ 3549 function getEditorSelectionStart(state) { 3550 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3551 since: '5.8', 3552 alternative: "select('core/editor').getEditorSelection" 3553 }); 3554 return getEditedPostAttribute(state, 'selection')?.selectionStart; 3555 } 3556 3557 /** 3558 * Returns the current selection end. 3559 * 3560 * @param {Object} state 3561 * @return {WPBlockSelection} The selection end. 3562 * 3563 * @deprecated since Gutenberg 10.0.0. 3564 */ 3565 function getEditorSelectionEnd(state) { 3566 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 3567 since: '5.8', 3568 alternative: "select('core/editor').getEditorSelection" 3569 }); 3570 return getEditedPostAttribute(state, 'selection')?.selectionEnd; 3571 } 3572 3573 /** 3574 * Returns the current selection. 3575 * 3576 * @param {Object} state 3577 * @return {WPBlockSelection} The selection end. 3578 */ 3579 function getEditorSelection(state) { 3580 return getEditedPostAttribute(state, 'selection'); 3581 } 3582 3583 /** 3584 * Is the editor ready 3585 * 3586 * @param {Object} state 3587 * @return {boolean} is Ready. 3588 */ 3589 function __unstableIsEditorReady(state) { 3590 return !!state.postId; 3591 } 3592 3593 /** 3594 * Returns the post editor settings. 3595 * 3596 * @param {Object} state Editor state. 3597 * 3598 * @return {Object} The editor settings object. 3599 */ 3600 function getEditorSettings(state) { 3601 return state.editorSettings; 3602 } 3603 3604 /** 3605 * Returns the post editor's rendering mode. 3606 * 3607 * @param {Object} state Editor state. 3608 * 3609 * @return {string} Rendering mode. 3610 */ 3611 function getRenderingMode(state) { 3612 return state.renderingMode; 3613 } 3614 3615 /** 3616 * Returns the current editing canvas device type. 3617 * 3618 * @param {Object} state Global application state. 3619 * 3620 * @return {string} Device type. 3621 */ 3622 const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 3623 const editorMode = select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode(); 3624 if (editorMode === 'zoom-out') { 3625 return 'Desktop'; 3626 } 3627 return state.deviceType; 3628 }); 3629 3630 /** 3631 * Returns true if the list view is opened. 3632 * 3633 * @param {Object} state Global application state. 3634 * 3635 * @return {boolean} Whether the list view is opened. 3636 */ 3637 function isListViewOpened(state) { 3638 return state.listViewPanel; 3639 } 3640 3641 /** 3642 * Returns true if the inserter is opened. 3643 * 3644 * @param {Object} state Global application state. 3645 * 3646 * @return {boolean} Whether the inserter is opened. 3647 */ 3648 function isInserterOpened(state) { 3649 return !!state.blockInserterPanel; 3650 } 3651 3652 /** 3653 * Returns the current editing mode. 3654 * 3655 * @param {Object} state Global application state. 3656 * 3657 * @return {string} Editing mode. 3658 */ 3659 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3660 var _select$get; 3661 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; 3662 }); 3663 3664 /* 3665 * Backward compatibility 3666 */ 3667 3668 /** 3669 * Returns state object prior to a specified optimist transaction ID, or `null` 3670 * if the transaction corresponding to the given ID cannot be found. 3671 * 3672 * @deprecated since Gutenberg 9.7.0. 3673 */ 3674 function getStateBeforeOptimisticTransaction() { 3675 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 3676 since: '5.7', 3677 hint: 'No state history is kept on this store anymore' 3678 }); 3679 return null; 3680 } 3681 /** 3682 * Returns true if an optimistic transaction is pending commit, for which the 3683 * before state satisfies the given predicate function. 3684 * 3685 * @deprecated since Gutenberg 9.7.0. 3686 */ 3687 function inSomeHistory() { 3688 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 3689 since: '5.7', 3690 hint: 'No state history is kept on this store anymore' 3691 }); 3692 return false; 3693 } 3694 function getBlockEditorSelector(name) { 3695 return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => { 3696 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { 3697 since: '5.3', 3698 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', 3699 version: '6.2' 3700 }); 3701 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); 3702 }); 3703 } 3704 3705 /** 3706 * @see getBlockName in core/block-editor store. 3707 */ 3708 const getBlockName = getBlockEditorSelector('getBlockName'); 3709 3710 /** 3711 * @see isBlockValid in core/block-editor store. 3712 */ 3713 const isBlockValid = getBlockEditorSelector('isBlockValid'); 3714 3715 /** 3716 * @see getBlockAttributes in core/block-editor store. 3717 */ 3718 const getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); 3719 3720 /** 3721 * @see getBlock in core/block-editor store. 3722 */ 3723 const getBlock = getBlockEditorSelector('getBlock'); 3724 3725 /** 3726 * @see getBlocks in core/block-editor store. 3727 */ 3728 const getBlocks = getBlockEditorSelector('getBlocks'); 3729 3730 /** 3731 * @see getClientIdsOfDescendants in core/block-editor store. 3732 */ 3733 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); 3734 3735 /** 3736 * @see getClientIdsWithDescendants in core/block-editor store. 3737 */ 3738 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); 3739 3740 /** 3741 * @see getGlobalBlockCount in core/block-editor store. 3742 */ 3743 const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); 3744 3745 /** 3746 * @see getBlocksByClientId in core/block-editor store. 3747 */ 3748 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); 3749 3750 /** 3751 * @see getBlockCount in core/block-editor store. 3752 */ 3753 const getBlockCount = getBlockEditorSelector('getBlockCount'); 3754 3755 /** 3756 * @see getBlockSelectionStart in core/block-editor store. 3757 */ 3758 const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); 3759 3760 /** 3761 * @see getBlockSelectionEnd in core/block-editor store. 3762 */ 3763 const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); 3764 3765 /** 3766 * @see getSelectedBlockCount in core/block-editor store. 3767 */ 3768 const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); 3769 3770 /** 3771 * @see hasSelectedBlock in core/block-editor store. 3772 */ 3773 const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); 3774 3775 /** 3776 * @see getSelectedBlockClientId in core/block-editor store. 3777 */ 3778 const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); 3779 3780 /** 3781 * @see getSelectedBlock in core/block-editor store. 3782 */ 3783 const getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); 3784 3785 /** 3786 * @see getBlockRootClientId in core/block-editor store. 3787 */ 3788 const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); 3789 3790 /** 3791 * @see getBlockHierarchyRootClientId in core/block-editor store. 3792 */ 3793 const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); 3794 3795 /** 3796 * @see getAdjacentBlockClientId in core/block-editor store. 3797 */ 3798 const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); 3799 3800 /** 3801 * @see getPreviousBlockClientId in core/block-editor store. 3802 */ 3803 const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); 3804 3805 /** 3806 * @see getNextBlockClientId in core/block-editor store. 3807 */ 3808 const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); 3809 3810 /** 3811 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. 3812 */ 3813 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); 3814 3815 /** 3816 * @see getMultiSelectedBlockClientIds in core/block-editor store. 3817 */ 3818 const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); 3819 3820 /** 3821 * @see getMultiSelectedBlocks in core/block-editor store. 3822 */ 3823 const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); 3824 3825 /** 3826 * @see getFirstMultiSelectedBlockClientId in core/block-editor store. 3827 */ 3828 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); 3829 3830 /** 3831 * @see getLastMultiSelectedBlockClientId in core/block-editor store. 3832 */ 3833 const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); 3834 3835 /** 3836 * @see isFirstMultiSelectedBlock in core/block-editor store. 3837 */ 3838 const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); 3839 3840 /** 3841 * @see isBlockMultiSelected in core/block-editor store. 3842 */ 3843 const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); 3844 3845 /** 3846 * @see isAncestorMultiSelected in core/block-editor store. 3847 */ 3848 const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); 3849 3850 /** 3851 * @see getMultiSelectedBlocksStartClientId in core/block-editor store. 3852 */ 3853 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); 3854 3855 /** 3856 * @see getMultiSelectedBlocksEndClientId in core/block-editor store. 3857 */ 3858 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); 3859 3860 /** 3861 * @see getBlockOrder in core/block-editor store. 3862 */ 3863 const getBlockOrder = getBlockEditorSelector('getBlockOrder'); 3864 3865 /** 3866 * @see getBlockIndex in core/block-editor store. 3867 */ 3868 const getBlockIndex = getBlockEditorSelector('getBlockIndex'); 3869 3870 /** 3871 * @see isBlockSelected in core/block-editor store. 3872 */ 3873 const isBlockSelected = getBlockEditorSelector('isBlockSelected'); 3874 3875 /** 3876 * @see hasSelectedInnerBlock in core/block-editor store. 3877 */ 3878 const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); 3879 3880 /** 3881 * @see isBlockWithinSelection in core/block-editor store. 3882 */ 3883 const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); 3884 3885 /** 3886 * @see hasMultiSelection in core/block-editor store. 3887 */ 3888 const hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); 3889 3890 /** 3891 * @see isMultiSelecting in core/block-editor store. 3892 */ 3893 const isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); 3894 3895 /** 3896 * @see isSelectionEnabled in core/block-editor store. 3897 */ 3898 const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); 3899 3900 /** 3901 * @see getBlockMode in core/block-editor store. 3902 */ 3903 const getBlockMode = getBlockEditorSelector('getBlockMode'); 3904 3905 /** 3906 * @see isTyping in core/block-editor store. 3907 */ 3908 const isTyping = getBlockEditorSelector('isTyping'); 3909 3910 /** 3911 * @see isCaretWithinFormattedText in core/block-editor store. 3912 */ 3913 const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); 3914 3915 /** 3916 * @see getBlockInsertionPoint in core/block-editor store. 3917 */ 3918 const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); 3919 3920 /** 3921 * @see isBlockInsertionPointVisible in core/block-editor store. 3922 */ 3923 const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); 3924 3925 /** 3926 * @see isValidTemplate in core/block-editor store. 3927 */ 3928 const isValidTemplate = getBlockEditorSelector('isValidTemplate'); 3929 3930 /** 3931 * @see getTemplate in core/block-editor store. 3932 */ 3933 const getTemplate = getBlockEditorSelector('getTemplate'); 3934 3935 /** 3936 * @see getTemplateLock in core/block-editor store. 3937 */ 3938 const getTemplateLock = getBlockEditorSelector('getTemplateLock'); 3939 3940 /** 3941 * @see canInsertBlockType in core/block-editor store. 3942 */ 3943 const canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); 3944 3945 /** 3946 * @see getInserterItems in core/block-editor store. 3947 */ 3948 const getInserterItems = getBlockEditorSelector('getInserterItems'); 3949 3950 /** 3951 * @see hasInserterItems in core/block-editor store. 3952 */ 3953 const hasInserterItems = getBlockEditorSelector('hasInserterItems'); 3954 3955 /** 3956 * @see getBlockListSettings in core/block-editor store. 3957 */ 3958 const getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); 3959 3960 /** 3961 * Returns the default template types. 3962 * 3963 * @param {Object} state Global application state. 3964 * 3965 * @return {Object} The template types. 3966 */ 3967 function __experimentalGetDefaultTemplateTypes(state) { 3968 return getEditorSettings(state)?.defaultTemplateTypes; 3969 } 3970 3971 /** 3972 * Returns the default template part areas. 3973 * 3974 * @param {Object} state Global application state. 3975 * 3976 * @return {Array} The template part areas. 3977 */ 3978 const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createSelector)(state => { 3979 var _getEditorSettings$de; 3980 const areas = (_getEditorSettings$de = getEditorSettings(state)?.defaultTemplatePartAreas) !== null && _getEditorSettings$de !== void 0 ? _getEditorSettings$de : []; 3981 return areas.map(item => { 3982 return { 3983 ...item, 3984 icon: getTemplatePartIcon(item.icon) 3985 }; 3986 }); 3987 }, state => [getEditorSettings(state)?.defaultTemplatePartAreas]); 3988 3989 /** 3990 * Returns a default template type searched by slug. 3991 * 3992 * @param {Object} state Global application state. 3993 * @param {string} slug The template type slug. 3994 * 3995 * @return {Object} The template type. 3996 */ 3997 const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { 3998 var _Object$values$find; 3999 const templateTypes = __experimentalGetDefaultTemplateTypes(state); 4000 if (!templateTypes) { 4001 return EMPTY_OBJECT; 4002 } 4003 return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT; 4004 }, state => [__experimentalGetDefaultTemplateTypes(state)]); 4005 4006 /** 4007 * Given a template entity, return information about it which is ready to be 4008 * rendered, such as the title, description, and icon. 4009 * 4010 * @param {Object} state Global application state. 4011 * @param {Object} template The template for which we need information. 4012 * @return {Object} Information about the template, including title, description, and icon. 4013 */ 4014 const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createSelector)((state, template) => { 4015 if (!template) { 4016 return EMPTY_OBJECT; 4017 } 4018 const { 4019 description, 4020 slug, 4021 title, 4022 area 4023 } = template; 4024 const { 4025 title: defaultTitle, 4026 description: defaultDescription 4027 } = __experimentalGetDefaultTemplateType(state, slug); 4028 const templateTitle = typeof title === 'string' ? title : title?.rendered; 4029 const templateDescription = typeof description === 'string' ? description : description?.raw; 4030 const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || library_layout; 4031 return { 4032 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 4033 description: templateDescription || defaultDescription, 4034 icon: templateIcon 4035 }; 4036 }, state => [__experimentalGetDefaultTemplateTypes(state), __experimentalGetDefaultTemplatePartAreas(state)]); 4037 4038 /** 4039 * Returns a post type label depending on the current post. 4040 * 4041 * @param {Object} state Global application state. 4042 * 4043 * @return {string|undefined} The post type label if available, otherwise undefined. 4044 */ 4045 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 4046 const currentPostType = getCurrentPostType(state); 4047 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); 4048 // Disable reason: Post type labels object is shaped like this. 4049 // eslint-disable-next-line camelcase 4050 return postType?.labels?.singular_name; 4051 }); 4052 4053 /** 4054 * Returns true if the publish sidebar is opened. 4055 * 4056 * @param {Object} state Global application state 4057 * 4058 * @return {boolean} Whether the publish sidebar is open. 4059 */ 4060 function isPublishSidebarOpened(state) { 4061 return state.publishSidebarActive; 4062 } 4063 4064 ;// external ["wp","a11y"] 4065 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 4066 ;// external ["wp","apiFetch"] 4067 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 4068 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 4069 ;// external ["wp","notices"] 4070 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 4071 ;// external ["wp","i18n"] 4072 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 4073 ;// ./node_modules/@wordpress/editor/build-module/store/local-autosave.js 4074 /** 4075 * Function returning a sessionStorage key to set or retrieve a given post's 4076 * automatic session backup. 4077 * 4078 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's 4079 * `loggedout` handler can clear sessionStorage of any user-private content. 4080 * 4081 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 4082 * 4083 * @param {string} postId Post ID. 4084 * @param {boolean} isPostNew Whether post new. 4085 * 4086 * @return {string} sessionStorage key 4087 */ 4088 function postKey(postId, isPostNew) { 4089 return `wp-autosave-block-editor-post-$isPostNew ? 'auto-draft' : postId}`; 4090 } 4091 function localAutosaveGet(postId, isPostNew) { 4092 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 4093 } 4094 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 4095 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ 4096 post_title: title, 4097 content, 4098 excerpt 4099 })); 4100 } 4101 function localAutosaveClear(postId, isPostNew) { 4102 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 4103 } 4104 4105 ;// ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 4106 /** 4107 * WordPress dependencies 4108 */ 4109 4110 4111 /** 4112 * Internal dependencies 4113 */ 4114 4115 4116 /** 4117 * Builds the arguments for a success notification dispatch. 4118 * 4119 * @param {Object} data Incoming data to build the arguments from. 4120 * 4121 * @return {Array} Arguments for dispatch. An empty array signals no 4122 * notification should be sent. 4123 */ 4124 function getNotificationArgumentsForSaveSuccess(data) { 4125 var _postType$viewable; 4126 const { 4127 previousPost, 4128 post, 4129 postType 4130 } = data; 4131 // Autosaves are neither shown a notice nor redirected. 4132 if (data.options?.isAutosave) { 4133 return []; 4134 } 4135 const publishStatus = ['publish', 'private', 'future']; 4136 const isPublished = publishStatus.includes(previousPost.status); 4137 const willPublish = publishStatus.includes(post.status); 4138 const willTrash = post.status === 'trash' && previousPost.status !== 'trash'; 4139 let noticeMessage; 4140 let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false; 4141 let isDraft; 4142 4143 // Always should a notice, which will be spoken for accessibility. 4144 if (willTrash) { 4145 noticeMessage = postType.labels.item_trashed; 4146 shouldShowLink = false; 4147 } else if (!isPublished && !willPublish) { 4148 // If saving a non-published post, don't show notice. 4149 noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); 4150 isDraft = true; 4151 } else if (isPublished && !willPublish) { 4152 // If undoing publish status, show specific notice. 4153 noticeMessage = postType.labels.item_reverted_to_draft; 4154 shouldShowLink = false; 4155 } else if (!isPublished && willPublish) { 4156 // If publishing or scheduling a post, show the corresponding 4157 // publish message. 4158 noticeMessage = { 4159 publish: postType.labels.item_published, 4160 private: postType.labels.item_published_privately, 4161 future: postType.labels.item_scheduled 4162 }[post.status]; 4163 } else { 4164 // Generic fallback notice. 4165 noticeMessage = postType.labels.item_updated; 4166 } 4167 const actions = []; 4168 if (shouldShowLink) { 4169 actions.push({ 4170 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, 4171 url: post.link 4172 }); 4173 } 4174 return [noticeMessage, { 4175 id: SAVE_POST_NOTICE_ID, 4176 type: 'snackbar', 4177 actions 4178 }]; 4179 } 4180 4181 /** 4182 * Builds the fail notification arguments for dispatch. 4183 * 4184 * @param {Object} data Incoming data to build the arguments with. 4185 * 4186 * @return {Array} Arguments for dispatch. An empty array signals no 4187 * notification should be sent. 4188 */ 4189 function getNotificationArgumentsForSaveFail(data) { 4190 const { 4191 post, 4192 edits, 4193 error 4194 } = data; 4195 if (error && 'rest_autosave_no_changes' === error.code) { 4196 // Autosave requested a new autosave, but there were no changes. This shouldn't 4197 // result in an error notice for the user. 4198 return []; 4199 } 4200 const publishStatus = ['publish', 'private', 'future']; 4201 const isPublished = publishStatus.indexOf(post.status) !== -1; 4202 // If the post was being published, we show the corresponding publish error message 4203 // Unless we publish an "updating failed" message. 4204 const messages = { 4205 publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4206 private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), 4207 future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') 4208 }; 4209 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); 4210 4211 // Check if message string contains HTML. Notice text is currently only 4212 // supported as plaintext, and stripping the tags may muddle the meaning. 4213 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 4214 noticeMessage = [noticeMessage, error.message].join(' '); 4215 } 4216 return [noticeMessage, { 4217 id: SAVE_POST_NOTICE_ID 4218 }]; 4219 } 4220 4221 /** 4222 * Builds the trash fail notification arguments for dispatch. 4223 * 4224 * @param {Object} data 4225 * 4226 * @return {Array} Arguments for dispatch. 4227 */ 4228 function getNotificationArgumentsForTrashFail(data) { 4229 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { 4230 id: TRASH_POST_NOTICE_ID 4231 }]; 4232 } 4233 4234 ;// ./node_modules/@wordpress/editor/build-module/store/actions.js 4235 /** 4236 * WordPress dependencies 4237 */ 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 /** 4250 * Internal dependencies 4251 */ 4252 4253 4254 4255 4256 /** 4257 * Returns an action generator used in signalling that editor has initialized with 4258 * the specified post object and editor settings. 4259 * 4260 * @param {Object} post Post object. 4261 * @param {Object} edits Initial edited attributes object. 4262 * @param {Array?} template Block Template. 4263 */ 4264 const setupEditor = (post, edits, template) => ({ 4265 dispatch 4266 }) => { 4267 dispatch.setEditedPost(post.type, post.id); 4268 // Apply a template for new posts only, if exists. 4269 const isNewPost = post.status === 'auto-draft'; 4270 if (isNewPost && template) { 4271 // In order to ensure maximum of a single parse during setup, edits are 4272 // included as part of editor setup action. Assume edited content as 4273 // canonical if provided, falling back to post. 4274 let content; 4275 if ('content' in edits) { 4276 content = edits.content; 4277 } else { 4278 content = post.content.raw; 4279 } 4280 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); 4281 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); 4282 dispatch.resetEditorBlocks(blocks, { 4283 __unstableShouldCreateUndoLevel: false 4284 }); 4285 } 4286 if (edits && Object.values(edits).some(([key, edit]) => { 4287 var _post$key$raw; 4288 return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); 4289 })) { 4290 dispatch.editPost(edits); 4291 } 4292 }; 4293 4294 /** 4295 * Returns an action object signalling that the editor is being destroyed and 4296 * that any necessary state or side-effect cleanup should occur. 4297 * 4298 * @deprecated 4299 * 4300 * @return {Object} Action object. 4301 */ 4302 function __experimentalTearDownEditor() { 4303 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", { 4304 since: '6.5' 4305 }); 4306 return { 4307 type: 'DO_NOTHING' 4308 }; 4309 } 4310 4311 /** 4312 * Returns an action object used in signalling that the latest version of the 4313 * post has been received, either by initialization or save. 4314 * 4315 * @deprecated Since WordPress 6.0. 4316 */ 4317 function resetPost() { 4318 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { 4319 since: '6.0', 4320 version: '6.3', 4321 alternative: 'Initialize the editor with the setupEditorState action' 4322 }); 4323 return { 4324 type: 'DO_NOTHING' 4325 }; 4326 } 4327 4328 /** 4329 * Returns an action object used in signalling that a patch of updates for the 4330 * latest version of the post have been received. 4331 * 4332 * @return {Object} Action object. 4333 * @deprecated since Gutenberg 9.7.0. 4334 */ 4335 function updatePost() { 4336 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 4337 since: '5.7', 4338 alternative: 'Use the core entities store instead' 4339 }); 4340 return { 4341 type: 'DO_NOTHING' 4342 }; 4343 } 4344 4345 /** 4346 * Setup the editor state. 4347 * 4348 * @deprecated 4349 * 4350 * @param {Object} post Post object. 4351 */ 4352 function setupEditorState(post) { 4353 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { 4354 since: '6.5', 4355 alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" 4356 }); 4357 return setEditedPost(post.type, post.id); 4358 } 4359 4360 /** 4361 * Returns an action that sets the current post Type and post ID. 4362 * 4363 * @param {string} postType Post Type. 4364 * @param {string} postId Post ID. 4365 * 4366 * @return {Object} Action object. 4367 */ 4368 function setEditedPost(postType, postId) { 4369 return { 4370 type: 'SET_EDITED_POST', 4371 postType, 4372 postId 4373 }; 4374 } 4375 4376 /** 4377 * Returns an action object used in signalling that attributes of the post have 4378 * been edited. 4379 * 4380 * @param {Object} edits Post attributes to edit. 4381 * @param {Object} options Options for the edit. 4382 */ 4383 const editPost = (edits, options) => ({ 4384 select, 4385 registry 4386 }) => { 4387 const { 4388 id, 4389 type 4390 } = select.getCurrentPost(); 4391 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); 4392 }; 4393 4394 /** 4395 * Action for saving the current post in the editor. 4396 * 4397 * @param {Object} options 4398 */ 4399 const savePost = (options = {}) => async ({ 4400 select, 4401 dispatch, 4402 registry 4403 }) => { 4404 if (!select.isEditedPostSaveable()) { 4405 return; 4406 } 4407 const content = select.getEditedPostContent(); 4408 if (!options.isAutosave) { 4409 dispatch.editPost({ 4410 content 4411 }, { 4412 undoIgnore: true 4413 }); 4414 } 4415 const previousRecord = select.getCurrentPost(); 4416 let edits = { 4417 id: previousRecord.id, 4418 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), 4419 content 4420 }; 4421 dispatch({ 4422 type: 'REQUEST_POST_UPDATE_START', 4423 options 4424 }); 4425 let error = false; 4426 try { 4427 edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)('editor.preSavePost', edits, options); 4428 } catch (err) { 4429 error = err; 4430 } 4431 if (!error) { 4432 try { 4433 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); 4434 } catch (err) { 4435 error = err.message && err.code !== 'unknown_error' ? err.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating.'); 4436 } 4437 } 4438 if (!error) { 4439 error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); 4440 } 4441 4442 // Run the hook with legacy unstable name for backward compatibility 4443 if (!error) { 4444 try { 4445 await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options); 4446 } catch (err) { 4447 error = err; 4448 } 4449 } 4450 if (!error) { 4451 try { 4452 await (0,external_wp_hooks_namespaceObject.doActionAsync)('editor.savePost', { 4453 id: previousRecord.id 4454 }, options); 4455 } catch (err) { 4456 error = err; 4457 } 4458 } 4459 dispatch({ 4460 type: 'REQUEST_POST_UPDATE_FINISH', 4461 options 4462 }); 4463 if (error) { 4464 const args = getNotificationArgumentsForSaveFail({ 4465 post: previousRecord, 4466 edits, 4467 error 4468 }); 4469 if (args.length) { 4470 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); 4471 } 4472 } else { 4473 const updatedRecord = select.getCurrentPost(); 4474 const args = getNotificationArgumentsForSaveSuccess({ 4475 previousPost: previousRecord, 4476 post: updatedRecord, 4477 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), 4478 options 4479 }); 4480 if (args.length) { 4481 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); 4482 } 4483 // Make sure that any edits after saving create an undo level and are 4484 // considered for change detection. 4485 if (!options.isAutosave) { 4486 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 4487 } 4488 } 4489 }; 4490 4491 /** 4492 * Action for refreshing the current post. 4493 * 4494 * @deprecated Since WordPress 6.0. 4495 */ 4496 function refreshPost() { 4497 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { 4498 since: '6.0', 4499 version: '6.3', 4500 alternative: 'Use the core entities store instead' 4501 }); 4502 return { 4503 type: 'DO_NOTHING' 4504 }; 4505 } 4506 4507 /** 4508 * Action for trashing the current post in the editor. 4509 */ 4510 const trashPost = () => async ({ 4511 select, 4512 dispatch, 4513 registry 4514 }) => { 4515 const postTypeSlug = select.getCurrentPostType(); 4516 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 4517 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID); 4518 const { 4519 rest_base: restBase, 4520 rest_namespace: restNamespace = 'wp/v2' 4521 } = postType; 4522 dispatch({ 4523 type: 'REQUEST_POST_DELETE_START' 4524 }); 4525 try { 4526 const post = select.getCurrentPost(); 4527 await external_wp_apiFetch_default()({ 4528 path: `/$restNamespace}/$restBase}/$post.id}`, 4529 method: 'DELETE' 4530 }); 4531 await dispatch.savePost(); 4532 } catch (error) { 4533 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ 4534 error 4535 })); 4536 } 4537 dispatch({ 4538 type: 'REQUEST_POST_DELETE_FINISH' 4539 }); 4540 }; 4541 4542 /** 4543 * Action that autosaves the current post. This 4544 * includes server-side autosaving (default) and client-side (a.k.a. local) 4545 * autosaving (e.g. on the Web, the post might be committed to Session 4546 * Storage). 4547 * 4548 * @param {Object?} options Extra flags to identify the autosave. 4549 */ 4550 const autosave = ({ 4551 local = false, 4552 ...options 4553 } = {}) => async ({ 4554 select, 4555 dispatch 4556 }) => { 4557 const post = select.getCurrentPost(); 4558 4559 // Currently template autosaving is not supported. 4560 if (post.type === 'wp_template') { 4561 return; 4562 } 4563 if (local) { 4564 const isPostNew = select.isEditedPostNew(); 4565 const title = select.getEditedPostAttribute('title'); 4566 const content = select.getEditedPostAttribute('content'); 4567 const excerpt = select.getEditedPostAttribute('excerpt'); 4568 localAutosaveSet(post.id, isPostNew, title, content, excerpt); 4569 } else { 4570 await dispatch.savePost({ 4571 isAutosave: true, 4572 ...options 4573 }); 4574 } 4575 }; 4576 const __unstableSaveForPreview = ({ 4577 forceIsAutosaveable 4578 } = {}) => async ({ 4579 select, 4580 dispatch 4581 }) => { 4582 if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { 4583 const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status')); 4584 if (isDraft) { 4585 await dispatch.savePost({ 4586 isPreview: true 4587 }); 4588 } else { 4589 await dispatch.autosave({ 4590 isPreview: true 4591 }); 4592 } 4593 } 4594 return select.getEditedPostPreviewLink(); 4595 }; 4596 4597 /** 4598 * Action that restores last popped state in undo history. 4599 */ 4600 const redo = () => ({ 4601 registry 4602 }) => { 4603 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); 4604 }; 4605 4606 /** 4607 * Action that pops a record from undo history and undoes the edit. 4608 */ 4609 const undo = () => ({ 4610 registry 4611 }) => { 4612 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); 4613 }; 4614 4615 /** 4616 * Action that creates an undo history record. 4617 * 4618 * @deprecated Since WordPress 6.0 4619 */ 4620 function createUndoLevel() { 4621 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { 4622 since: '6.0', 4623 version: '6.3', 4624 alternative: 'Use the core entities store instead' 4625 }); 4626 return { 4627 type: 'DO_NOTHING' 4628 }; 4629 } 4630 4631 /** 4632 * Action that locks the editor. 4633 * 4634 * @param {Object} lock Details about the post lock status, user, and nonce. 4635 * @return {Object} Action object. 4636 */ 4637 function updatePostLock(lock) { 4638 return { 4639 type: 'UPDATE_POST_LOCK', 4640 lock 4641 }; 4642 } 4643 4644 /** 4645 * Enable the publish sidebar. 4646 */ 4647 const enablePublishSidebar = () => ({ 4648 registry 4649 }) => { 4650 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true); 4651 }; 4652 4653 /** 4654 * Disables the publish sidebar. 4655 */ 4656 const disablePublishSidebar = () => ({ 4657 registry 4658 }) => { 4659 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false); 4660 }; 4661 4662 /** 4663 * Action that locks post saving. 4664 * 4665 * @param {string} lockName The lock name. 4666 * 4667 * @example 4668 * ``` 4669 * const { subscribe } = wp.data; 4670 * 4671 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4672 * 4673 * // Only allow publishing posts that are set to a future date. 4674 * if ( 'publish' !== initialPostStatus ) { 4675 * 4676 * // Track locking. 4677 * let locked = false; 4678 * 4679 * // Watch for the publish event. 4680 * let unssubscribe = subscribe( () => { 4681 * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); 4682 * if ( 'publish' !== currentPostStatus ) { 4683 * 4684 * // Compare the post date to the current date, lock the post if the date isn't in the future. 4685 * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); 4686 * const currentDate = new Date(); 4687 * if ( postDate.getTime() <= currentDate.getTime() ) { 4688 * if ( ! locked ) { 4689 * locked = true; 4690 * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); 4691 * } 4692 * } else { 4693 * if ( locked ) { 4694 * locked = false; 4695 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); 4696 * } 4697 * } 4698 * } 4699 * } ); 4700 * } 4701 * ``` 4702 * 4703 * @return {Object} Action object 4704 */ 4705 function lockPostSaving(lockName) { 4706 return { 4707 type: 'LOCK_POST_SAVING', 4708 lockName 4709 }; 4710 } 4711 4712 /** 4713 * Action that unlocks post saving. 4714 * 4715 * @param {string} lockName The lock name. 4716 * 4717 * @example 4718 * ``` 4719 * // Unlock post saving with the lock key `mylock`: 4720 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); 4721 * ``` 4722 * 4723 * @return {Object} Action object 4724 */ 4725 function unlockPostSaving(lockName) { 4726 return { 4727 type: 'UNLOCK_POST_SAVING', 4728 lockName 4729 }; 4730 } 4731 4732 /** 4733 * Action that locks post autosaving. 4734 * 4735 * @param {string} lockName The lock name. 4736 * 4737 * @example 4738 * ``` 4739 * // Lock post autosaving with the lock key `mylock`: 4740 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); 4741 * ``` 4742 * 4743 * @return {Object} Action object 4744 */ 4745 function lockPostAutosaving(lockName) { 4746 return { 4747 type: 'LOCK_POST_AUTOSAVING', 4748 lockName 4749 }; 4750 } 4751 4752 /** 4753 * Action that unlocks post autosaving. 4754 * 4755 * @param {string} lockName The lock name. 4756 * 4757 * @example 4758 * ``` 4759 * // Unlock post saving with the lock key `mylock`: 4760 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); 4761 * ``` 4762 * 4763 * @return {Object} Action object 4764 */ 4765 function unlockPostAutosaving(lockName) { 4766 return { 4767 type: 'UNLOCK_POST_AUTOSAVING', 4768 lockName 4769 }; 4770 } 4771 4772 /** 4773 * Returns an action object used to signal that the blocks have been updated. 4774 * 4775 * @param {Array} blocks Block Array. 4776 * @param {?Object} options Optional options. 4777 */ 4778 const resetEditorBlocks = (blocks, options = {}) => ({ 4779 select, 4780 dispatch, 4781 registry 4782 }) => { 4783 const { 4784 __unstableShouldCreateUndoLevel, 4785 selection 4786 } = options; 4787 const edits = { 4788 blocks, 4789 selection 4790 }; 4791 if (__unstableShouldCreateUndoLevel !== false) { 4792 const { 4793 id, 4794 type 4795 } = select.getCurrentPost(); 4796 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; 4797 if (noChange) { 4798 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); 4799 return; 4800 } 4801 4802 // We create a new function here on every persistent edit 4803 // to make sure the edit makes the post dirty and creates 4804 // a new undo level. 4805 edits.content = ({ 4806 blocks: blocksForSerialization = [] 4807 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 4808 } 4809 dispatch.editPost(edits); 4810 }; 4811 4812 /* 4813 * Returns an action object used in signalling that the post editor settings have been updated. 4814 * 4815 * @param {Object} settings Updated settings 4816 * 4817 * @return {Object} Action object 4818 */ 4819 function updateEditorSettings(settings) { 4820 return { 4821 type: 'UPDATE_EDITOR_SETTINGS', 4822 settings 4823 }; 4824 } 4825 4826 /** 4827 * Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes: 4828 * 4829 * - `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. 4830 * - `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. 4831 * 4832 * @param {string} mode Mode (one of 'post-only' or 'template-locked'). 4833 */ 4834 const setRenderingMode = mode => ({ 4835 dispatch, 4836 registry, 4837 select 4838 }) => { 4839 if (select.__unstableIsEditorReady()) { 4840 // We clear the block selection but we also need to clear the selection from the core store. 4841 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 4842 dispatch.editPost({ 4843 selection: undefined 4844 }, { 4845 undoIgnore: true 4846 }); 4847 } 4848 dispatch({ 4849 type: 'SET_RENDERING_MODE', 4850 mode 4851 }); 4852 }; 4853 4854 /** 4855 * Action that changes the width of the editing canvas. 4856 * 4857 * @param {string} deviceType 4858 * 4859 * @return {Object} Action object. 4860 */ 4861 function setDeviceType(deviceType) { 4862 return { 4863 type: 'SET_DEVICE_TYPE', 4864 deviceType 4865 }; 4866 } 4867 4868 /** 4869 * Returns an action object used to enable or disable a panel in the editor. 4870 * 4871 * @param {string} panelName A string that identifies the panel to enable or disable. 4872 * 4873 * @return {Object} Action object. 4874 */ 4875 const toggleEditorPanelEnabled = panelName => ({ 4876 registry 4877 }) => { 4878 var _registry$select$get; 4879 const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 4880 const isPanelInactive = !!inactivePanels?.includes(panelName); 4881 4882 // If the panel is inactive, remove it to enable it, else add it to 4883 // make it inactive. 4884 let updatedInactivePanels; 4885 if (isPanelInactive) { 4886 updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); 4887 } else { 4888 updatedInactivePanels = [...inactivePanels, panelName]; 4889 } 4890 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'inactivePanels', updatedInactivePanels); 4891 }; 4892 4893 /** 4894 * Opens a closed panel and closes an open panel. 4895 * 4896 * @param {string} panelName A string that identifies the panel to open or close. 4897 */ 4898 const toggleEditorPanelOpened = panelName => ({ 4899 registry 4900 }) => { 4901 var _registry$select$get2; 4902 const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 4903 const isPanelOpen = !!openPanels?.includes(panelName); 4904 4905 // If the panel is open, remove it to close it, else add it to 4906 // make it open. 4907 let updatedOpenPanels; 4908 if (isPanelOpen) { 4909 updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); 4910 } else { 4911 updatedOpenPanels = [...openPanels, panelName]; 4912 } 4913 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'openPanels', updatedOpenPanels); 4914 }; 4915 4916 /** 4917 * Returns an action object used to remove a panel from the editor. 4918 * 4919 * @param {string} panelName A string that identifies the panel to remove. 4920 * 4921 * @return {Object} Action object. 4922 */ 4923 function removeEditorPanel(panelName) { 4924 return { 4925 type: 'REMOVE_PANEL', 4926 panelName 4927 }; 4928 } 4929 4930 /** 4931 * Returns an action object used to open/close the inserter. 4932 * 4933 * @param {boolean|Object} value Whether the inserter should be 4934 * opened (true) or closed (false). 4935 * To specify an insertion point, 4936 * use an object. 4937 * @param {string} value.rootClientId The root client ID to insert at. 4938 * @param {number} value.insertionIndex The index to insert at. 4939 * 4940 * @return {Object} Action object. 4941 */ 4942 function setIsInserterOpened(value) { 4943 return { 4944 type: 'SET_IS_INSERTER_OPENED', 4945 value 4946 }; 4947 } 4948 4949 /** 4950 * Returns an action object used to open/close the list view. 4951 * 4952 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 4953 * @return {Object} Action object. 4954 */ 4955 function setIsListViewOpened(isOpen) { 4956 return { 4957 type: 'SET_IS_LIST_VIEW_OPENED', 4958 isOpen 4959 }; 4960 } 4961 4962 /** 4963 * Action that toggles Distraction free mode. 4964 * Distraction free mode expects there are no sidebars, as due to the 4965 * z-index values set, you can't close sidebars. 4966 */ 4967 const toggleDistractionFree = () => ({ 4968 dispatch, 4969 registry 4970 }) => { 4971 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 4972 if (isDistractionFree) { 4973 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); 4974 } 4975 if (!isDistractionFree) { 4976 registry.batch(() => { 4977 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); 4978 dispatch.setIsInserterOpened(false); 4979 dispatch.setIsListViewOpened(false); 4980 }); 4981 } 4982 registry.batch(() => { 4983 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); 4984 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), { 4985 id: 'core/editor/distraction-free-mode/notice', 4986 type: 'snackbar', 4987 actions: [{ 4988 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 4989 onClick: () => { 4990 registry.batch(() => { 4991 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false); 4992 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); 4993 }); 4994 } 4995 }] 4996 }); 4997 }); 4998 }; 4999 5000 /** 5001 * Triggers an action used to switch editor mode. 5002 * 5003 * @param {string} mode The editor mode. 5004 */ 5005 const switchEditorMode = mode => ({ 5006 dispatch, 5007 registry 5008 }) => { 5009 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); 5010 5011 // Unselect blocks when we switch to a non visual mode. 5012 if (mode !== 'visual') { 5013 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 5014 } 5015 if (mode === 'visual') { 5016 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive'); 5017 } else if (mode === 'text') { 5018 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 5019 if (isDistractionFree) { 5020 dispatch.toggleDistractionFree(); 5021 } 5022 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive'); 5023 } 5024 }; 5025 5026 /** 5027 * Returns an action object used in signalling that the user opened the publish 5028 * sidebar. 5029 * 5030 * @return {Object} Action object 5031 */ 5032 function openPublishSidebar() { 5033 return { 5034 type: 'OPEN_PUBLISH_SIDEBAR' 5035 }; 5036 } 5037 5038 /** 5039 * Returns an action object used in signalling that the user closed the 5040 * publish sidebar. 5041 * 5042 * @return {Object} Action object. 5043 */ 5044 function closePublishSidebar() { 5045 return { 5046 type: 'CLOSE_PUBLISH_SIDEBAR' 5047 }; 5048 } 5049 5050 /** 5051 * Returns an action object used in signalling that the user toggles the publish sidebar. 5052 * 5053 * @return {Object} Action object 5054 */ 5055 function togglePublishSidebar() { 5056 return { 5057 type: 'TOGGLE_PUBLISH_SIDEBAR' 5058 }; 5059 } 5060 5061 /** 5062 * Backward compatibility 5063 */ 5064 5065 const getBlockEditorAction = name => (...args) => ({ 5066 registry 5067 }) => { 5068 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { 5069 since: '5.3', 5070 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', 5071 version: '6.2' 5072 }); 5073 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); 5074 }; 5075 5076 /** 5077 * @see resetBlocks in core/block-editor store. 5078 */ 5079 const resetBlocks = getBlockEditorAction('resetBlocks'); 5080 5081 /** 5082 * @see receiveBlocks in core/block-editor store. 5083 */ 5084 const receiveBlocks = getBlockEditorAction('receiveBlocks'); 5085 5086 /** 5087 * @see updateBlock in core/block-editor store. 5088 */ 5089 const updateBlock = getBlockEditorAction('updateBlock'); 5090 5091 /** 5092 * @see updateBlockAttributes in core/block-editor store. 5093 */ 5094 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); 5095 5096 /** 5097 * @see selectBlock in core/block-editor store. 5098 */ 5099 const selectBlock = getBlockEditorAction('selectBlock'); 5100 5101 /** 5102 * @see startMultiSelect in core/block-editor store. 5103 */ 5104 const startMultiSelect = getBlockEditorAction('startMultiSelect'); 5105 5106 /** 5107 * @see stopMultiSelect in core/block-editor store. 5108 */ 5109 const stopMultiSelect = getBlockEditorAction('stopMultiSelect'); 5110 5111 /** 5112 * @see multiSelect in core/block-editor store. 5113 */ 5114 const multiSelect = getBlockEditorAction('multiSelect'); 5115 5116 /** 5117 * @see clearSelectedBlock in core/block-editor store. 5118 */ 5119 const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); 5120 5121 /** 5122 * @see toggleSelection in core/block-editor store. 5123 */ 5124 const toggleSelection = getBlockEditorAction('toggleSelection'); 5125 5126 /** 5127 * @see replaceBlocks in core/block-editor store. 5128 */ 5129 const replaceBlocks = getBlockEditorAction('replaceBlocks'); 5130 5131 /** 5132 * @see replaceBlock in core/block-editor store. 5133 */ 5134 const replaceBlock = getBlockEditorAction('replaceBlock'); 5135 5136 /** 5137 * @see moveBlocksDown in core/block-editor store. 5138 */ 5139 const moveBlocksDown = getBlockEditorAction('moveBlocksDown'); 5140 5141 /** 5142 * @see moveBlocksUp in core/block-editor store. 5143 */ 5144 const moveBlocksUp = getBlockEditorAction('moveBlocksUp'); 5145 5146 /** 5147 * @see moveBlockToPosition in core/block-editor store. 5148 */ 5149 const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition'); 5150 5151 /** 5152 * @see insertBlock in core/block-editor store. 5153 */ 5154 const insertBlock = getBlockEditorAction('insertBlock'); 5155 5156 /** 5157 * @see insertBlocks in core/block-editor store. 5158 */ 5159 const insertBlocks = getBlockEditorAction('insertBlocks'); 5160 5161 /** 5162 * @see showInsertionPoint in core/block-editor store. 5163 */ 5164 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); 5165 5166 /** 5167 * @see hideInsertionPoint in core/block-editor store. 5168 */ 5169 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); 5170 5171 /** 5172 * @see setTemplateValidity in core/block-editor store. 5173 */ 5174 const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); 5175 5176 /** 5177 * @see synchronizeTemplate in core/block-editor store. 5178 */ 5179 const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); 5180 5181 /** 5182 * @see mergeBlocks in core/block-editor store. 5183 */ 5184 const mergeBlocks = getBlockEditorAction('mergeBlocks'); 5185 5186 /** 5187 * @see removeBlocks in core/block-editor store. 5188 */ 5189 const removeBlocks = getBlockEditorAction('removeBlocks'); 5190 5191 /** 5192 * @see removeBlock in core/block-editor store. 5193 */ 5194 const removeBlock = getBlockEditorAction('removeBlock'); 5195 5196 /** 5197 * @see toggleBlockMode in core/block-editor store. 5198 */ 5199 const toggleBlockMode = getBlockEditorAction('toggleBlockMode'); 5200 5201 /** 5202 * @see startTyping in core/block-editor store. 5203 */ 5204 const startTyping = getBlockEditorAction('startTyping'); 5205 5206 /** 5207 * @see stopTyping in core/block-editor store. 5208 */ 5209 const stopTyping = getBlockEditorAction('stopTyping'); 5210 5211 /** 5212 * @see enterFormattedText in core/block-editor store. 5213 */ 5214 const enterFormattedText = getBlockEditorAction('enterFormattedText'); 5215 5216 /** 5217 * @see exitFormattedText in core/block-editor store. 5218 */ 5219 const exitFormattedText = getBlockEditorAction('exitFormattedText'); 5220 5221 /** 5222 * @see insertDefaultBlock in core/block-editor store. 5223 */ 5224 const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); 5225 5226 /** 5227 * @see updateBlockListSettings in core/block-editor store. 5228 */ 5229 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); 5230 5231 ;// external ["wp","htmlEntities"] 5232 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 5233 ;// ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js 5234 /** 5235 * Internal dependencies 5236 */ 5237 5238 5239 // Copy of the function from packages/edit-site/src/utils/is-template-revertable.js 5240 5241 /** 5242 * Check if a template or template part is revertable to its original theme-provided file. 5243 * 5244 * @param {Object} templateOrTemplatePart The entity to check. 5245 * @return {boolean} Whether the entity is revertable. 5246 */ 5247 function isTemplateRevertable(templateOrTemplatePart) { 5248 if (!templateOrTemplatePart) { 5249 return false; 5250 } 5251 return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 5252 } 5253 5254 ;// external ["wp","components"] 5255 const external_wp_components_namespaceObject = window["wp"]["components"]; 5256 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 5257 /** 5258 * WordPress dependencies 5259 */ 5260 5261 5262 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 5263 xmlns: "http://www.w3.org/2000/svg", 5264 viewBox: "0 0 24 24", 5265 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 5266 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 5267 }) 5268 }); 5269 /* harmony default export */ const library_check = (check); 5270 5271 ;// ./node_modules/tslib/tslib.es6.mjs 5272 /****************************************************************************** 5273 Copyright (c) Microsoft Corporation. 5274 5275 Permission to use, copy, modify, and/or distribute this software for any 5276 purpose with or without fee is hereby granted. 5277 5278 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 5279 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 5280 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 5281 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 5282 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 5283 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 5284 PERFORMANCE OF THIS SOFTWARE. 5285 ***************************************************************************** */ 5286 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 5287 5288 var extendStatics = function(d, b) { 5289 extendStatics = Object.setPrototypeOf || 5290 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5291 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 5292 return extendStatics(d, b); 5293 }; 5294 5295 function __extends(d, b) { 5296 if (typeof b !== "function" && b !== null) 5297 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 5298 extendStatics(d, b); 5299 function __() { this.constructor = d; } 5300 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5301 } 5302 5303 var __assign = function() { 5304 __assign = Object.assign || function __assign(t) { 5305 for (var s, i = 1, n = arguments.length; i < n; i++) { 5306 s = arguments[i]; 5307 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 5308 } 5309 return t; 5310 } 5311 return __assign.apply(this, arguments); 5312 } 5313 5314 function __rest(s, e) { 5315 var t = {}; 5316 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 5317 t[p] = s[p]; 5318 if (s != null && typeof Object.getOwnPropertySymbols === "function") 5319 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 5320 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 5321 t[p[i]] = s[p[i]]; 5322 } 5323 return t; 5324 } 5325 5326 function __decorate(decorators, target, key, desc) { 5327 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 5328 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5329 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; 5330 return c > 3 && r && Object.defineProperty(target, key, r), r; 5331 } 5332 5333 function __param(paramIndex, decorator) { 5334 return function (target, key) { decorator(target, key, paramIndex); } 5335 } 5336 5337 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 5338 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 5339 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 5340 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 5341 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 5342 var _, done = false; 5343 for (var i = decorators.length - 1; i >= 0; i--) { 5344 var context = {}; 5345 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 5346 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 5347 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 5348 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 5349 if (kind === "accessor") { 5350 if (result === void 0) continue; 5351 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 5352 if (_ = accept(result.get)) descriptor.get = _; 5353 if (_ = accept(result.set)) descriptor.set = _; 5354 if (_ = accept(result.init)) initializers.unshift(_); 5355 } 5356 else if (_ = accept(result)) { 5357 if (kind === "field") initializers.unshift(_); 5358 else descriptor[key] = _; 5359 } 5360 } 5361 if (target) Object.defineProperty(target, contextIn.name, descriptor); 5362 done = true; 5363 }; 5364 5365 function __runInitializers(thisArg, initializers, value) { 5366 var useValue = arguments.length > 2; 5367 for (var i = 0; i < initializers.length; i++) { 5368 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 5369 } 5370 return useValue ? value : void 0; 5371 }; 5372 5373 function __propKey(x) { 5374 return typeof x === "symbol" ? x : "".concat(x); 5375 }; 5376 5377 function __setFunctionName(f, name, prefix) { 5378 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 5379 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 5380 }; 5381 5382 function __metadata(metadataKey, metadataValue) { 5383 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 5384 } 5385 5386 function __awaiter(thisArg, _arguments, P, generator) { 5387 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 5388 return new (P || (P = Promise))(function (resolve, reject) { 5389 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5390 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 5391 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 5392 step((generator = generator.apply(thisArg, _arguments || [])).next()); 5393 }); 5394 } 5395 5396 function __generator(thisArg, body) { 5397 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); 5398 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 5399 function verb(n) { return function (v) { return step([n, v]); }; } 5400 function step(op) { 5401 if (f) throw new TypeError("Generator is already executing."); 5402 while (g && (g = 0, op[0] && (_ = 0)), _) try { 5403 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; 5404 if (y = 0, t) op = [op[0] & 2, t.value]; 5405 switch (op[0]) { 5406 case 0: case 1: t = op; break; 5407 case 4: _.label++; return { value: op[1], done: false }; 5408 case 5: _.label++; y = op[1]; op = [0]; continue; 5409 case 7: op = _.ops.pop(); _.trys.pop(); continue; 5410 default: 5411 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 5412 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 5413 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 5414 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 5415 if (t[2]) _.ops.pop(); 5416 _.trys.pop(); continue; 5417 } 5418 op = body.call(thisArg, _); 5419 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 5420 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 5421 } 5422 } 5423 5424 var __createBinding = Object.create ? (function(o, m, k, k2) { 5425 if (k2 === undefined) k2 = k; 5426 var desc = Object.getOwnPropertyDescriptor(m, k); 5427 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 5428 desc = { enumerable: true, get: function() { return m[k]; } }; 5429 } 5430 Object.defineProperty(o, k2, desc); 5431 }) : (function(o, m, k, k2) { 5432 if (k2 === undefined) k2 = k; 5433 o[k2] = m[k]; 5434 }); 5435 5436 function __exportStar(m, o) { 5437 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 5438 } 5439 5440 function __values(o) { 5441 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 5442 if (m) return m.call(o); 5443 if (o && typeof o.length === "number") return { 5444 next: function () { 5445 if (o && i >= o.length) o = void 0; 5446 return { value: o && o[i++], done: !o }; 5447 } 5448 }; 5449 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 5450 } 5451 5452 function __read(o, n) { 5453 var m = typeof Symbol === "function" && o[Symbol.iterator]; 5454 if (!m) return o; 5455 var i = m.call(o), r, ar = [], e; 5456 try { 5457 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 5458 } 5459 catch (error) { e = { error: error }; } 5460 finally { 5461 try { 5462 if (r && !r.done && (m = i["return"])) m.call(i); 5463 } 5464 finally { if (e) throw e.error; } 5465 } 5466 return ar; 5467 } 5468 5469 /** @deprecated */ 5470 function __spread() { 5471 for (var ar = [], i = 0; i < arguments.length; i++) 5472 ar = ar.concat(__read(arguments[i])); 5473 return ar; 5474 } 5475 5476 /** @deprecated */ 5477 function __spreadArrays() { 5478 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 5479 for (var r = Array(s), k = 0, i = 0; i < il; i++) 5480 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 5481 r[k] = a[j]; 5482 return r; 5483 } 5484 5485 function __spreadArray(to, from, pack) { 5486 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 5487 if (ar || !(i in from)) { 5488 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 5489 ar[i] = from[i]; 5490 } 5491 } 5492 return to.concat(ar || Array.prototype.slice.call(from)); 5493 } 5494 5495 function __await(v) { 5496 return this instanceof __await ? (this.v = v, this) : new __await(v); 5497 } 5498 5499 function __asyncGenerator(thisArg, _arguments, generator) { 5500 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 5501 var g = generator.apply(thisArg, _arguments || []), i, q = []; 5502 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 5503 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 5504 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]); } } 5505 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 5506 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 5507 function fulfill(value) { resume("next", value); } 5508 function reject(value) { resume("throw", value); } 5509 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 5510 } 5511 5512 function __asyncDelegator(o) { 5513 var i, p; 5514 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 5515 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; } 5516 } 5517 5518 function __asyncValues(o) { 5519 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 5520 var m = o[Symbol.asyncIterator], i; 5521 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); 5522 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); }); }; } 5523 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 5524 } 5525 5526 function __makeTemplateObject(cooked, raw) { 5527 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 5528 return cooked; 5529 }; 5530 5531 var __setModuleDefault = Object.create ? (function(o, v) { 5532 Object.defineProperty(o, "default", { enumerable: true, value: v }); 5533 }) : function(o, v) { 5534 o["default"] = v; 5535 }; 5536 5537 function __importStar(mod) { 5538 if (mod && mod.__esModule) return mod; 5539 var result = {}; 5540 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 5541 __setModuleDefault(result, mod); 5542 return result; 5543 } 5544 5545 function __importDefault(mod) { 5546 return (mod && mod.__esModule) ? mod : { default: mod }; 5547 } 5548 5549 function __classPrivateFieldGet(receiver, state, kind, f) { 5550 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 5551 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"); 5552 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 5553 } 5554 5555 function __classPrivateFieldSet(receiver, state, value, kind, f) { 5556 if (kind === "m") throw new TypeError("Private method is not writable"); 5557 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 5558 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"); 5559 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 5560 } 5561 5562 function __classPrivateFieldIn(state, receiver) { 5563 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 5564 return typeof state === "function" ? receiver === state : state.has(receiver); 5565 } 5566 5567 function __addDisposableResource(env, value, async) { 5568 if (value !== null && value !== void 0) { 5569 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 5570 var dispose, inner; 5571 if (async) { 5572 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 5573 dispose = value[Symbol.asyncDispose]; 5574 } 5575 if (dispose === void 0) { 5576 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 5577 dispose = value[Symbol.dispose]; 5578 if (async) inner = dispose; 5579 } 5580 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 5581 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 5582 env.stack.push({ value: value, dispose: dispose, async: async }); 5583 } 5584 else if (async) { 5585 env.stack.push({ async: true }); 5586 } 5587 return value; 5588 } 5589 5590 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 5591 var e = new Error(message); 5592 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 5593 }; 5594 5595 function __disposeResources(env) { 5596 function fail(e) { 5597 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 5598 env.hasError = true; 5599 } 5600 var r, s = 0; 5601 function next() { 5602 while (r = env.stack.pop()) { 5603 try { 5604 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 5605 if (r.dispose) { 5606 var result = r.dispose.call(r.value); 5607 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 5608 } 5609 else s |= 1; 5610 } 5611 catch (e) { 5612 fail(e); 5613 } 5614 } 5615 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 5616 if (env.hasError) throw env.error; 5617 } 5618 return next(); 5619 } 5620 5621 /* harmony default export */ const tslib_es6 = ({ 5622 __extends, 5623 __assign, 5624 __rest, 5625 __decorate, 5626 __param, 5627 __metadata, 5628 __awaiter, 5629 __generator, 5630 __createBinding, 5631 __exportStar, 5632 __values, 5633 __read, 5634 __spread, 5635 __spreadArrays, 5636 __spreadArray, 5637 __await, 5638 __asyncGenerator, 5639 __asyncDelegator, 5640 __asyncValues, 5641 __makeTemplateObject, 5642 __importStar, 5643 __importDefault, 5644 __classPrivateFieldGet, 5645 __classPrivateFieldSet, 5646 __classPrivateFieldIn, 5647 __addDisposableResource, 5648 __disposeResources, 5649 }); 5650 5651 ;// ./node_modules/lower-case/dist.es2015/index.js 5652 /** 5653 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 5654 */ 5655 var SUPPORTED_LOCALE = { 5656 tr: { 5657 regexp: /\u0130|\u0049|\u0049\u0307/g, 5658 map: { 5659 İ: "\u0069", 5660 I: "\u0131", 5661 İ: "\u0069", 5662 }, 5663 }, 5664 az: { 5665 regexp: /\u0130/g, 5666 map: { 5667 İ: "\u0069", 5668 I: "\u0131", 5669 İ: "\u0069", 5670 }, 5671 }, 5672 lt: { 5673 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 5674 map: { 5675 I: "\u0069\u0307", 5676 J: "\u006A\u0307", 5677 Į: "\u012F\u0307", 5678 Ì: "\u0069\u0307\u0300", 5679 Í: "\u0069\u0307\u0301", 5680 Ĩ: "\u0069\u0307\u0303", 5681 }, 5682 }, 5683 }; 5684 /** 5685 * Localized lower case. 5686 */ 5687 function localeLowerCase(str, locale) { 5688 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 5689 if (lang) 5690 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 5691 return lowerCase(str); 5692 } 5693 /** 5694 * Lower case as a function. 5695 */ 5696 function lowerCase(str) { 5697 return str.toLowerCase(); 5698 } 5699 5700 ;// ./node_modules/no-case/dist.es2015/index.js 5701 5702 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 5703 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 5704 // Remove all non-word characters. 5705 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 5706 /** 5707 * Normalize the string into something other libraries can manipulate easier. 5708 */ 5709 function noCase(input, options) { 5710 if (options === void 0) { options = {}; } 5711 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; 5712 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 5713 var start = 0; 5714 var end = result.length; 5715 // Trim the delimiter from around the output string. 5716 while (result.charAt(start) === "\0") 5717 start++; 5718 while (result.charAt(end - 1) === "\0") 5719 end--; 5720 // Transform each token independently. 5721 return result.slice(start, end).split("\0").map(transform).join(delimiter); 5722 } 5723 /** 5724 * Replace `re` in the input string with the replacement value. 5725 */ 5726 function replace(input, re, value) { 5727 if (re instanceof RegExp) 5728 return input.replace(re, value); 5729 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 5730 } 5731 5732 ;// ./node_modules/dot-case/dist.es2015/index.js 5733 5734 5735 function dotCase(input, options) { 5736 if (options === void 0) { options = {}; } 5737 return noCase(input, __assign({ delimiter: "." }, options)); 5738 } 5739 5740 ;// ./node_modules/param-case/dist.es2015/index.js 5741 5742 5743 function paramCase(input, options) { 5744 if (options === void 0) { options = {}; } 5745 return dotCase(input, __assign({ delimiter: "-" }, options)); 5746 } 5747 5748 ;// ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/utils.js 5749 /** 5750 * External dependencies 5751 */ 5752 5753 5754 /** 5755 * WordPress dependencies 5756 */ 5757 5758 5759 5760 /** 5761 * Internal dependencies 5762 */ 5763 5764 const useExistingTemplateParts = () => { 5765 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, { 5766 per_page: -1 5767 }), []); 5768 }; 5769 5770 /** 5771 * Return a unique template part title based on 5772 * the given title and existing template parts. 5773 * 5774 * @param {string} title The original template part title. 5775 * @param {Object} templateParts The array of template part entities. 5776 * @return {string} A unique template part title. 5777 */ 5778 const getUniqueTemplatePartTitle = (title, templateParts) => { 5779 const lowercaseTitle = title.toLowerCase(); 5780 const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase()); 5781 if (!existingTitles.includes(lowercaseTitle)) { 5782 return title; 5783 } 5784 let suffix = 2; 5785 while (existingTitles.includes(`$lowercaseTitle} $suffix}`)) { 5786 suffix++; 5787 } 5788 return `$title} $suffix}`; 5789 }; 5790 5791 /** 5792 * Get a valid slug for a template part. 5793 * Currently template parts only allow latin chars. 5794 * The fallback slug will receive suffix by default. 5795 * 5796 * @param {string} title The template part title. 5797 * @return {string} A valid template part slug. 5798 */ 5799 const getCleanTemplatePartSlug = title => { 5800 return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part'; 5801 }; 5802 5803 ;// ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/index.js 5804 /** 5805 * WordPress dependencies 5806 */ 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 /** 5818 * Internal dependencies 5819 */ 5820 5821 5822 5823 5824 5825 function CreateTemplatePartModal({ 5826 modalTitle, 5827 ...restProps 5828 }) { 5829 const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, []); 5830 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 5831 title: modalTitle || defaultModalTitle, 5832 onRequestClose: restProps.closeModal, 5833 overlayClassName: "editor-create-template-part-modal", 5834 focusOnMount: "firstContentElement", 5835 size: "medium", 5836 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { 5837 ...restProps 5838 }) 5839 }); 5840 } 5841 function CreateTemplatePartModalContents({ 5842 defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 5843 blocks = [], 5844 confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'), 5845 closeModal, 5846 onCreate, 5847 onError, 5848 defaultTitle = '' 5849 }) { 5850 const { 5851 createErrorNotice 5852 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5853 const { 5854 saveEntityRecord 5855 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5856 const existingTemplateParts = useExistingTemplateParts(); 5857 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); 5858 const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea); 5859 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 5860 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); 5861 const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetDefaultTemplatePartAreas(), []); 5862 async function createTemplatePart() { 5863 if (!title || isSubmitting) { 5864 return; 5865 } 5866 try { 5867 setIsSubmitting(true); 5868 const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts); 5869 const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); 5870 const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, { 5871 slug: cleanSlug, 5872 title: uniqueTitle, 5873 content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), 5874 area 5875 }, { 5876 throwOnError: true 5877 }); 5878 await onCreate(templatePart); 5879 5880 // TODO: Add a success notice? 5881 } catch (error) { 5882 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.'); 5883 createErrorNotice(errorMessage, { 5884 type: 'snackbar' 5885 }); 5886 onError?.(); 5887 } finally { 5888 setIsSubmitting(false); 5889 } 5890 } 5891 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 5892 onSubmit: async event => { 5893 event.preventDefault(); 5894 await createTemplatePart(); 5895 }, 5896 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 5897 spacing: "4", 5898 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 5899 __next40pxDefaultSize: true, 5900 __nextHasNoMarginBottom: true, 5901 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 5902 value: title, 5903 onChange: setTitle, 5904 required: true 5905 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { 5906 __nextHasNoMarginBottom: true, 5907 label: (0,external_wp_i18n_namespaceObject.__)('Area'), 5908 id: `editor-create-template-part-modal__area-selection-$instanceId}`, 5909 className: "editor-create-template-part-modal__area-base-control", 5910 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadioGroup, { 5911 label: (0,external_wp_i18n_namespaceObject.__)('Area'), 5912 className: "editor-create-template-part-modal__area-radio-group", 5913 id: `editor-create-template-part-modal__area-selection-$instanceId}`, 5914 onChange: setArea, 5915 checked: area, 5916 children: templatePartAreas.map(({ 5917 icon, 5918 label, 5919 area: value, 5920 description 5921 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadio, { 5922 value: value, 5923 className: "editor-create-template-part-modal__area-radio", 5924 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 5925 align: "start", 5926 justify: "start", 5927 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 5928 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 5929 icon: icon 5930 }) 5931 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexBlock, { 5932 className: "editor-create-template-part-modal__option-label", 5933 children: [label, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 5934 children: description 5935 })] 5936 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 5937 className: "editor-create-template-part-modal__checkbox", 5938 children: area === value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 5939 icon: library_check 5940 }) 5941 })] 5942 }) 5943 }, label)) 5944 }) 5945 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 5946 justify: "right", 5947 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 5948 __next40pxDefaultSize: true, 5949 variant: "tertiary", 5950 onClick: () => { 5951 closeModal(); 5952 }, 5953 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 5954 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 5955 __next40pxDefaultSize: true, 5956 variant: "primary", 5957 type: "submit", 5958 "aria-disabled": !title || isSubmitting, 5959 isBusy: isSubmitting, 5960 children: confirmLabel 5961 })] 5962 })] 5963 }) 5964 }); 5965 } 5966 5967 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/utils.js 5968 /** 5969 * WordPress dependencies 5970 */ 5971 5972 5973 /** 5974 * Internal dependencies 5975 */ 5976 5977 function isTemplate(post) { 5978 return post.type === TEMPLATE_POST_TYPE; 5979 } 5980 function isTemplatePart(post) { 5981 return post.type === TEMPLATE_PART_POST_TYPE; 5982 } 5983 function isTemplateOrTemplatePart(p) { 5984 return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE; 5985 } 5986 function getItemTitle(item) { 5987 if (typeof item.title === 'string') { 5988 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 5989 } 5990 if ('rendered' in item.title) { 5991 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 5992 } 5993 if ('raw' in item.title) { 5994 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 5995 } 5996 return ''; 5997 } 5998 5999 /** 6000 * Check if a template is removable. 6001 * 6002 * @param template The template entity to check. 6003 * @return Whether the template is removable. 6004 */ 6005 function isTemplateRemovable(template) { 6006 if (!template) { 6007 return false; 6008 } 6009 // In patterns list page we map the templates parts to a different object 6010 // than the one returned from the endpoint. This is why we need to check for 6011 // two props whether is custom or has a theme file. 6012 return [template.source, template.source].includes(TEMPLATE_ORIGINS.custom) && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file; 6013 } 6014 6015 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/duplicate-template-part.js 6016 /** 6017 * WordPress dependencies 6018 */ 6019 6020 6021 6022 6023 // @ts-ignore 6024 6025 /** 6026 * Internal dependencies 6027 */ 6028 6029 6030 6031 6032 const duplicateTemplatePart = { 6033 id: 'duplicate-template-part', 6034 label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6035 isEligible: item => item.type === TEMPLATE_PART_POST_TYPE, 6036 modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'), 6037 RenderModal: ({ 6038 items, 6039 closeModal 6040 }) => { 6041 const [item] = items; 6042 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 6043 var _item$blocks; 6044 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, { 6045 __unstableSkipMigrationLogs: true 6046 }); 6047 }, [item.content, item.blocks]); 6048 const { 6049 createSuccessNotice 6050 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6051 function onTemplatePartSuccess() { 6052 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 6053 // translators: %s: The new template part's title e.g. 'Call to action (copy)'. 6054 (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', 'template part'), getItemTitle(item)), { 6055 type: 'snackbar', 6056 id: 'edit-site-patterns-success' 6057 }); 6058 closeModal?.(); 6059 } 6060 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { 6061 blocks: blocks, 6062 defaultArea: item.area, 6063 defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing template part title */ 6064 (0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'template part'), getItemTitle(item)), 6065 onCreate: onTemplatePartSuccess, 6066 onError: closeModal, 6067 confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6068 closeModal: closeModal 6069 }); 6070 } 6071 }; 6072 /* harmony default export */ const duplicate_template_part = (duplicateTemplatePart); 6073 6074 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 6075 /** 6076 * WordPress dependencies 6077 */ 6078 6079 6080 const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6081 xmlns: "http://www.w3.org/2000/svg", 6082 viewBox: "0 0 24 24", 6083 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6084 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" 6085 }) 6086 }); 6087 /* harmony default export */ const library_backup = (backup); 6088 6089 ;// external ["wp","privateApis"] 6090 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 6091 ;// ./node_modules/@wordpress/editor/build-module/lock-unlock.js 6092 /** 6093 * WordPress dependencies 6094 */ 6095 6096 const { 6097 lock, 6098 unlock 6099 } = (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'); 6100 6101 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/reset-post.js 6102 /** 6103 * WordPress dependencies 6104 */ 6105 6106 6107 6108 6109 6110 6111 6112 /** 6113 * Internal dependencies 6114 */ 6115 6116 6117 6118 6119 6120 6121 const reset_post_resetPost = { 6122 id: 'reset-post', 6123 label: (0,external_wp_i18n_namespaceObject.__)('Reset'), 6124 isEligible: item => { 6125 return isTemplateOrTemplatePart(item) && item?.source === TEMPLATE_ORIGINS.custom && (Boolean(item.type === 'wp_template' && item?.plugin) || item?.has_theme_file); 6126 }, 6127 icon: library_backup, 6128 supportsBulk: true, 6129 hideModalHeader: true, 6130 RenderModal: ({ 6131 items, 6132 closeModal, 6133 onActionPerformed 6134 }) => { 6135 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 6136 const { 6137 revertTemplate 6138 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 6139 const { 6140 saveEditedEntityRecord 6141 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6142 const { 6143 createSuccessNotice, 6144 createErrorNotice 6145 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6146 const onConfirm = async () => { 6147 try { 6148 for (const template of items) { 6149 await revertTemplate(template, { 6150 allowUndo: false 6151 }); 6152 await saveEditedEntityRecord('postType', template.type, template.id); 6153 } 6154 createSuccessNotice(items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */ 6155 (0,external_wp_i18n_namespaceObject.__)('%s items reset.'), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */ 6156 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), getItemTitle(items[0])), { 6157 type: 'snackbar', 6158 id: 'revert-template-action' 6159 }); 6160 } catch (error) { 6161 let fallbackErrorMessage; 6162 if (items[0].type === TEMPLATE_POST_TYPE) { 6163 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.'); 6164 } else { 6165 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.'); 6166 } 6167 const typedError = error; 6168 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : fallbackErrorMessage; 6169 createErrorNotice(errorMessage, { 6170 type: 'snackbar' 6171 }); 6172 } 6173 }; 6174 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 6175 spacing: "5", 6176 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 6177 children: (0,external_wp_i18n_namespaceObject.__)('Reset to default and clear all customizations?') 6178 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 6179 justify: "right", 6180 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6181 __next40pxDefaultSize: true, 6182 variant: "tertiary", 6183 onClick: closeModal, 6184 disabled: isBusy, 6185 accessibleWhenDisabled: true, 6186 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 6187 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6188 __next40pxDefaultSize: true, 6189 variant: "primary", 6190 onClick: async () => { 6191 setIsBusy(true); 6192 await onConfirm(); 6193 onActionPerformed?.(items); 6194 setIsBusy(false); 6195 closeModal?.(); 6196 }, 6197 isBusy: isBusy, 6198 disabled: isBusy, 6199 accessibleWhenDisabled: true, 6200 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 6201 })] 6202 })] 6203 }); 6204 } 6205 }; 6206 /* harmony default export */ const reset_post = (reset_post_resetPost); 6207 6208 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 6209 /** 6210 * WordPress dependencies 6211 */ 6212 6213 6214 const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6215 xmlns: "http://www.w3.org/2000/svg", 6216 viewBox: "0 0 24 24", 6217 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6218 fillRule: "evenodd", 6219 clipRule: "evenodd", 6220 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" 6221 }) 6222 }); 6223 /* harmony default export */ const library_trash = (trash); 6224 6225 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/trash-post.js 6226 /** 6227 * WordPress dependencies 6228 */ 6229 6230 6231 6232 6233 6234 6235 6236 /** 6237 * Internal dependencies 6238 */ 6239 6240 6241 6242 const trash_post_trashPost = { 6243 id: 'move-to-trash', 6244 label: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), 6245 isPrimary: true, 6246 icon: library_trash, 6247 isEligible(item) { 6248 if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') { 6249 return false; 6250 } 6251 return !!item.status && !['auto-draft', 'trash'].includes(item.status) && item.permissions?.delete; 6252 }, 6253 supportsBulk: true, 6254 hideModalHeader: true, 6255 RenderModal: ({ 6256 items, 6257 closeModal, 6258 onActionPerformed 6259 }) => { 6260 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 6261 const { 6262 createSuccessNotice, 6263 createErrorNotice 6264 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6265 const { 6266 deleteEntityRecord 6267 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6268 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 6269 spacing: "5", 6270 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 6271 children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 6272 // translators: %s: The item's title. 6273 (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)( 6274 // translators: %d: The number of items (2 or more). 6275 (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) 6276 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 6277 justify: "right", 6278 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6279 __next40pxDefaultSize: true, 6280 variant: "tertiary", 6281 onClick: closeModal, 6282 disabled: isBusy, 6283 accessibleWhenDisabled: true, 6284 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 6285 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6286 __next40pxDefaultSize: true, 6287 variant: "primary", 6288 onClick: async () => { 6289 setIsBusy(true); 6290 const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id.toString(), {}, { 6291 throwOnError: true 6292 }))); 6293 // If all the promises were fulfilled with success. 6294 if (promiseResult.every(({ 6295 status 6296 }) => status === 'fulfilled')) { 6297 let successMessage; 6298 if (promiseResult.length === 1) { 6299 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The item's title. */ 6300 (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), getItemTitle(items[0])); 6301 } else { 6302 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */ 6303 (0,external_wp_i18n_namespaceObject._n)('%s item moved to the trash.', '%s items moved to the trash.', items.length), items.length); 6304 } 6305 createSuccessNotice(successMessage, { 6306 type: 'snackbar', 6307 id: 'move-to-trash-action' 6308 }); 6309 } else { 6310 // If there was at least one failure. 6311 let errorMessage; 6312 // If we were trying to delete a single item. 6313 if (promiseResult.length === 1) { 6314 const typedError = promiseResult[0]; 6315 if (typedError.reason?.message) { 6316 errorMessage = typedError.reason.message; 6317 } else { 6318 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash.'); 6319 } 6320 // If we were trying to delete multiple items. 6321 } else { 6322 const errorMessages = new Set(); 6323 const failedPromises = promiseResult.filter(({ 6324 status 6325 }) => status === 'rejected'); 6326 for (const failedPromise of failedPromises) { 6327 const typedError = failedPromise; 6328 if (typedError.reason?.message) { 6329 errorMessages.add(typedError.reason.message); 6330 } 6331 } 6332 if (errorMessages.size === 0) { 6333 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the items to the trash.'); 6334 } else if (errorMessages.size === 1) { 6335 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 6336 (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash: %s'), [...errorMessages][0]); 6337 } else { 6338 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 6339 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving the items to the trash: %s'), [...errorMessages].join(',')); 6340 } 6341 } 6342 createErrorNotice(errorMessage, { 6343 type: 'snackbar' 6344 }); 6345 } 6346 if (onActionPerformed) { 6347 onActionPerformed(items); 6348 } 6349 setIsBusy(false); 6350 closeModal?.(); 6351 }, 6352 isBusy: isBusy, 6353 disabled: isBusy, 6354 accessibleWhenDisabled: true, 6355 children: (0,external_wp_i18n_namespaceObject._x)('Trash', 'verb') 6356 })] 6357 })] 6358 }); 6359 } 6360 }; 6361 /* harmony default export */ const trash_post = (trash_post_trashPost); 6362 6363 ;// external ["wp","patterns"] 6364 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 6365 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/rename-post.js 6366 /** 6367 * WordPress dependencies 6368 */ 6369 6370 6371 6372 6373 // @ts-ignore 6374 6375 6376 6377 6378 /** 6379 * Internal dependencies 6380 */ 6381 6382 6383 6384 6385 6386 // Patterns. 6387 const { 6388 PATTERN_TYPES 6389 } = unlock(external_wp_patterns_namespaceObject.privateApis); 6390 const renamePost = { 6391 id: 'rename-post', 6392 label: (0,external_wp_i18n_namespaceObject.__)('Rename'), 6393 isEligible(post) { 6394 if (post.status === 'trash') { 6395 return false; 6396 } 6397 // Templates, template parts and patterns have special checks for renaming. 6398 if (![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, ...Object.values(PATTERN_TYPES)].includes(post.type)) { 6399 return post.permissions?.update; 6400 } 6401 6402 // In the case of templates, we can only rename custom templates. 6403 if (isTemplate(post)) { 6404 return isTemplateRemovable(post) && post.is_custom && post.permissions?.update; 6405 } 6406 if (isTemplatePart(post)) { 6407 return post.source === TEMPLATE_ORIGINS.custom && !post?.has_theme_file && post.permissions?.update; 6408 } 6409 return post.type === PATTERN_TYPES.user && post.permissions?.update; 6410 }, 6411 RenderModal: ({ 6412 items, 6413 closeModal, 6414 onActionPerformed 6415 }) => { 6416 const [item] = items; 6417 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item)); 6418 const { 6419 editEntityRecord, 6420 saveEditedEntityRecord 6421 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6422 const { 6423 createSuccessNotice, 6424 createErrorNotice 6425 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6426 async function onRename(event) { 6427 event.preventDefault(); 6428 try { 6429 await editEntityRecord('postType', item.type, item.id, { 6430 title 6431 }); 6432 // Update state before saving rerenders the list. 6433 setTitle(''); 6434 closeModal?.(); 6435 // Persist edited entity. 6436 await saveEditedEntityRecord('postType', item.type, item.id, { 6437 throwOnError: true 6438 }); 6439 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Name updated'), { 6440 type: 'snackbar' 6441 }); 6442 onActionPerformed?.(items); 6443 } catch (error) { 6444 const typedError = error; 6445 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the name'); 6446 createErrorNotice(errorMessage, { 6447 type: 'snackbar' 6448 }); 6449 } 6450 } 6451 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 6452 onSubmit: onRename, 6453 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 6454 spacing: "5", 6455 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 6456 __nextHasNoMarginBottom: true, 6457 __next40pxDefaultSize: true, 6458 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 6459 value: title, 6460 onChange: setTitle, 6461 required: true 6462 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 6463 justify: "right", 6464 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6465 __next40pxDefaultSize: true, 6466 variant: "tertiary", 6467 onClick: () => { 6468 closeModal?.(); 6469 }, 6470 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 6471 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 6472 __next40pxDefaultSize: true, 6473 variant: "primary", 6474 type: "submit", 6475 children: (0,external_wp_i18n_namespaceObject.__)('Save') 6476 })] 6477 })] 6478 }) 6479 }); 6480 } 6481 }; 6482 /* harmony default export */ const rename_post = (renamePost); 6483 6484 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/restore-post.js 6485 /** 6486 * WordPress dependencies 6487 */ 6488 6489 6490 6491 6492 /** 6493 * Internal dependencies 6494 */ 6495 6496 const restorePost = { 6497 id: 'restore', 6498 label: (0,external_wp_i18n_namespaceObject.__)('Restore'), 6499 isPrimary: true, 6500 icon: library_backup, 6501 supportsBulk: true, 6502 isEligible(item) { 6503 return !isTemplateOrTemplatePart(item) && item.type !== 'wp_block' && item.status === 'trash' && item.permissions?.update; 6504 }, 6505 async callback(posts, { 6506 registry, 6507 onActionPerformed 6508 }) { 6509 const { 6510 createSuccessNotice, 6511 createErrorNotice 6512 } = registry.dispatch(external_wp_notices_namespaceObject.store); 6513 const { 6514 editEntityRecord, 6515 saveEditedEntityRecord 6516 } = registry.dispatch(external_wp_coreData_namespaceObject.store); 6517 await Promise.allSettled(posts.map(post => { 6518 return editEntityRecord('postType', post.type, post.id, { 6519 status: 'draft' 6520 }); 6521 })); 6522 const promiseResult = await Promise.allSettled(posts.map(post => { 6523 return saveEditedEntityRecord('postType', post.type, post.id, { 6524 throwOnError: true 6525 }); 6526 })); 6527 if (promiseResult.every(({ 6528 status 6529 }) => status === 'fulfilled')) { 6530 let successMessage; 6531 if (posts.length === 1) { 6532 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */ 6533 (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0])); 6534 } else if (posts[0].type === 'page') { 6535 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */ 6536 (0,external_wp_i18n_namespaceObject.__)('%d pages have been restored.'), posts.length); 6537 } else { 6538 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */ 6539 (0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length); 6540 } 6541 createSuccessNotice(successMessage, { 6542 type: 'snackbar', 6543 id: 'restore-post-action' 6544 }); 6545 if (onActionPerformed) { 6546 onActionPerformed(posts); 6547 } 6548 } else { 6549 // If there was at lease one failure. 6550 let errorMessage; 6551 // If we were trying to move a single post to the trash. 6552 if (promiseResult.length === 1) { 6553 const typedError = promiseResult[0]; 6554 if (typedError.reason?.message) { 6555 errorMessage = typedError.reason.message; 6556 } else { 6557 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.'); 6558 } 6559 // If we were trying to move multiple posts to the trash 6560 } else { 6561 const errorMessages = new Set(); 6562 const failedPromises = promiseResult.filter(({ 6563 status 6564 }) => status === 'rejected'); 6565 for (const failedPromise of failedPromises) { 6566 const typedError = failedPromise; 6567 if (typedError.reason?.message) { 6568 errorMessages.add(typedError.reason.message); 6569 } 6570 } 6571 if (errorMessages.size === 0) { 6572 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.'); 6573 } else if (errorMessages.size === 1) { 6574 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 6575 (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]); 6576 } else { 6577 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 6578 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(',')); 6579 } 6580 } 6581 createErrorNotice(errorMessage, { 6582 type: 'snackbar' 6583 }); 6584 } 6585 } 6586 }; 6587 /* harmony default export */ const restore_post = (restorePost); 6588 6589 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 6590 /** 6591 * WordPress dependencies 6592 */ 6593 6594 6595 const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 6596 xmlns: "http://www.w3.org/2000/svg", 6597 viewBox: "0 0 24 24", 6598 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 6599 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" 6600 }) 6601 }); 6602 /* harmony default export */ const library_external = (external); 6603 6604 ;// ./node_modules/@wordpress/fields/build-module/actions/base-post/view-post.js 6605 /** 6606 * WordPress dependencies 6607 */ 6608 6609 6610 6611 /** 6612 * Internal dependencies 6613 */ 6614 6615 const viewPost = { 6616 id: 'view-post', 6617 label: (0,external_wp_i18n_namespaceObject._x)('View', 'verb'), 6618 isPrimary: true, 6619 icon: library_external, 6620 isEligible(post) { 6621 return post.status !== 'trash'; 6622 }, 6623 callback(posts, { 6624 onActionPerformed 6625 }) { 6626 const post = posts[0]; 6627 window.open(post?.link, '_blank'); 6628 if (onActionPerformed) { 6629 onActionPerformed(posts); 6630 } 6631 } 6632 }; 6633 /* harmony default export */ const view_post = (viewPost); 6634 6635 ;// ./node_modules/@wordpress/fields/build-module/actions/common/view-post-revisions.js 6636 /** 6637 * WordPress dependencies 6638 */ 6639 6640 6641 6642 /** 6643 * Internal dependencies 6644 */ 6645 6646 const viewPostRevisions = { 6647 id: 'view-post-revisions', 6648 context: 'list', 6649 label(items) { 6650 var _items$0$_links$versi; 6651 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; 6652 return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions. */ 6653 (0,external_wp_i18n_namespaceObject.__)('View revisions (%s)'), revisionsCount); 6654 }, 6655 isEligible(post) { 6656 var _post$_links$predeces, _post$_links$version; 6657 if (post.status === 'trash') { 6658 return false; 6659 } 6660 const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null; 6661 const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0; 6662 return !!lastRevisionId && revisionsCount > 1; 6663 }, 6664 callback(posts, { 6665 onActionPerformed 6666 }) { 6667 const post = posts[0]; 6668 const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 6669 revision: post?._links?.['predecessor-version']?.[0]?.id 6670 }); 6671 document.location.href = href; 6672 if (onActionPerformed) { 6673 onActionPerformed(posts); 6674 } 6675 } 6676 }; 6677 /* harmony default export */ const view_post_revisions = (viewPostRevisions); 6678 6679 ;// ./node_modules/@wordpress/fields/build-module/lock-unlock.js 6680 /** 6681 * WordPress dependencies 6682 */ 6683 6684 const { 6685 lock: lock_unlock_lock, 6686 unlock: lock_unlock_unlock 6687 } = (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'); 6688 6689 ;// ./node_modules/@wordpress/fields/build-module/actions/pattern/duplicate-pattern.js 6690 /** 6691 * WordPress dependencies 6692 */ 6693 6694 // @ts-ignore 6695 6696 /** 6697 * Internal dependencies 6698 */ 6699 6700 6701 // Patterns. 6702 const { 6703 CreatePatternModalContents, 6704 useDuplicatePatternProps 6705 } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 6706 const duplicatePattern = { 6707 id: 'duplicate-pattern', 6708 label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6709 isEligible: item => item.type !== 'wp_template_part', 6710 modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'), 6711 RenderModal: ({ 6712 items, 6713 closeModal 6714 }) => { 6715 const [item] = items; 6716 const duplicatedProps = useDuplicatePatternProps({ 6717 pattern: item, 6718 onSuccess: () => closeModal?.() 6719 }); 6720 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { 6721 onClose: closeModal, 6722 confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'), 6723 ...duplicatedProps 6724 }); 6725 } 6726 }; 6727 /* harmony default export */ const duplicate_pattern = (duplicatePattern); 6728 6729 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js 6730 /** 6731 * Internal dependencies 6732 */ 6733 6734 function sort(a, b, direction) { 6735 return direction === 'asc' ? a - b : b - a; 6736 } 6737 function isValid(value, context) { 6738 // TODO: this implicitely means the value is required. 6739 if (value === '') { 6740 return false; 6741 } 6742 if (!Number.isInteger(Number(value))) { 6743 return false; 6744 } 6745 if (context?.elements) { 6746 const validValues = context?.elements.map(f => f.value); 6747 if (!validValues.includes(Number(value))) { 6748 return false; 6749 } 6750 } 6751 return true; 6752 } 6753 /* harmony default export */ const integer = ({ 6754 sort, 6755 isValid, 6756 Edit: 'integer' 6757 }); 6758 6759 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js 6760 /** 6761 * Internal dependencies 6762 */ 6763 6764 function text_sort(valueA, valueB, direction) { 6765 return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA); 6766 } 6767 function text_isValid(value, context) { 6768 if (context?.elements) { 6769 const validValues = context?.elements?.map(f => f.value); 6770 if (!validValues.includes(value)) { 6771 return false; 6772 } 6773 } 6774 return true; 6775 } 6776 /* harmony default export */ const field_types_text = ({ 6777 sort: text_sort, 6778 isValid: text_isValid, 6779 Edit: 'text' 6780 }); 6781 6782 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js 6783 /** 6784 * Internal dependencies 6785 */ 6786 6787 function datetime_sort(a, b, direction) { 6788 const timeA = new Date(a).getTime(); 6789 const timeB = new Date(b).getTime(); 6790 return direction === 'asc' ? timeA - timeB : timeB - timeA; 6791 } 6792 function datetime_isValid(value, context) { 6793 if (context?.elements) { 6794 const validValues = context?.elements.map(f => f.value); 6795 if (!validValues.includes(value)) { 6796 return false; 6797 } 6798 } 6799 return true; 6800 } 6801 /* harmony default export */ const datetime = ({ 6802 sort: datetime_sort, 6803 isValid: datetime_isValid, 6804 Edit: 'datetime' 6805 }); 6806 6807 ;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js 6808 /** 6809 * Internal dependencies 6810 */ 6811 6812 6813 6814 6815 6816 /** 6817 * 6818 * @param {FieldType} type The field type definition to get. 6819 * 6820 * @return A field type definition. 6821 */ 6822 function getFieldTypeDefinition(type) { 6823 if ('integer' === type) { 6824 return integer; 6825 } 6826 if ('text' === type) { 6827 return field_types_text; 6828 } 6829 if ('datetime' === type) { 6830 return datetime; 6831 } 6832 return { 6833 sort: (a, b, direction) => { 6834 if (typeof a === 'number' && typeof b === 'number') { 6835 return direction === 'asc' ? a - b : b - a; 6836 } 6837 return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a); 6838 }, 6839 isValid: (value, context) => { 6840 if (context?.elements) { 6841 const validValues = context?.elements?.map(f => f.value); 6842 if (!validValues.includes(value)) { 6843 return false; 6844 } 6845 } 6846 return true; 6847 }, 6848 Edit: () => null 6849 }; 6850 } 6851 6852 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js 6853 /** 6854 * WordPress dependencies 6855 */ 6856 6857 6858 6859 /** 6860 * Internal dependencies 6861 */ 6862 6863 6864 function DateTime({ 6865 data, 6866 field, 6867 onChange, 6868 hideLabelFromVision 6869 }) { 6870 const { 6871 id, 6872 label 6873 } = field; 6874 const value = field.getValue({ 6875 item: data 6876 }); 6877 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6878 [id]: newValue 6879 }), [id, onChange]); 6880 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 6881 className: "dataviews-controls__datetime", 6882 children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 6883 as: "legend", 6884 children: label 6885 }), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 6886 as: "legend", 6887 children: label 6888 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, { 6889 currentTime: value, 6890 onChange: onChangeControl, 6891 hideLabelFromVision: true 6892 })] 6893 }); 6894 } 6895 6896 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js 6897 /** 6898 * WordPress dependencies 6899 */ 6900 6901 6902 6903 /** 6904 * Internal dependencies 6905 */ 6906 6907 function Integer({ 6908 data, 6909 field, 6910 onChange, 6911 hideLabelFromVision 6912 }) { 6913 var _field$getValue; 6914 const { 6915 id, 6916 label, 6917 description 6918 } = field; 6919 const value = (_field$getValue = field.getValue({ 6920 item: data 6921 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 6922 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6923 [id]: Number(newValue) 6924 }), [id, onChange]); 6925 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 6926 label: label, 6927 help: description, 6928 value: value, 6929 onChange: onChangeControl, 6930 __next40pxDefaultSize: true, 6931 hideLabelFromVision: hideLabelFromVision 6932 }); 6933 } 6934 6935 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js 6936 /** 6937 * WordPress dependencies 6938 */ 6939 6940 6941 6942 /** 6943 * Internal dependencies 6944 */ 6945 6946 function Radio({ 6947 data, 6948 field, 6949 onChange, 6950 hideLabelFromVision 6951 }) { 6952 const { 6953 id, 6954 label 6955 } = field; 6956 const value = field.getValue({ 6957 item: data 6958 }); 6959 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 6960 [id]: newValue 6961 }), [id, onChange]); 6962 if (field.elements) { 6963 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 6964 label: label, 6965 onChange: onChangeControl, 6966 options: field.elements, 6967 selected: value, 6968 hideLabelFromVision: hideLabelFromVision 6969 }); 6970 } 6971 return null; 6972 } 6973 6974 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js 6975 /** 6976 * WordPress dependencies 6977 */ 6978 6979 6980 6981 6982 /** 6983 * Internal dependencies 6984 */ 6985 6986 function Select({ 6987 data, 6988 field, 6989 onChange, 6990 hideLabelFromVision 6991 }) { 6992 var _field$getValue, _field$elements; 6993 const { 6994 id, 6995 label 6996 } = field; 6997 const value = (_field$getValue = field.getValue({ 6998 item: data 6999 })) !== null && _field$getValue !== void 0 ? _field$getValue : ''; 7000 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 7001 [id]: newValue 7002 }), [id, onChange]); 7003 const elements = [ 7004 /* 7005 * Value can be undefined when: 7006 * 7007 * - the field is not required 7008 * - in bulk editing 7009 * 7010 */ 7011 { 7012 label: (0,external_wp_i18n_namespaceObject.__)('Select item'), 7013 value: '' 7014 }, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])]; 7015 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 7016 label: label, 7017 value: value, 7018 options: elements, 7019 onChange: onChangeControl, 7020 __next40pxDefaultSize: true, 7021 __nextHasNoMarginBottom: true, 7022 hideLabelFromVision: hideLabelFromVision 7023 }); 7024 } 7025 7026 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js 7027 /** 7028 * WordPress dependencies 7029 */ 7030 7031 7032 7033 /** 7034 * Internal dependencies 7035 */ 7036 7037 function Text({ 7038 data, 7039 field, 7040 onChange, 7041 hideLabelFromVision 7042 }) { 7043 const { 7044 id, 7045 label, 7046 placeholder 7047 } = field; 7048 const value = field.getValue({ 7049 item: data 7050 }); 7051 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({ 7052 [id]: newValue 7053 }), [id, onChange]); 7054 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 7055 label: label, 7056 placeholder: placeholder, 7057 value: value !== null && value !== void 0 ? value : '', 7058 onChange: onChangeControl, 7059 __next40pxDefaultSize: true, 7060 __nextHasNoMarginBottom: true, 7061 hideLabelFromVision: hideLabelFromVision 7062 }); 7063 } 7064 7065 ;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js 7066 /** 7067 * External dependencies 7068 */ 7069 7070 /** 7071 * Internal dependencies 7072 */ 7073 7074 7075 7076 7077 7078 7079 const FORM_CONTROLS = { 7080 datetime: DateTime, 7081 integer: Integer, 7082 radio: Radio, 7083 select: Select, 7084 text: Text 7085 }; 7086 function getControl(field, fieldTypeDefinition) { 7087 if (typeof field.Edit === 'function') { 7088 return field.Edit; 7089 } 7090 if (typeof field.Edit === 'string') { 7091 return getControlByType(field.Edit); 7092 } 7093 if (field.elements) { 7094 return getControlByType('select'); 7095 } 7096 if (typeof fieldTypeDefinition.Edit === 'string') { 7097 return getControlByType(fieldTypeDefinition.Edit); 7098 } 7099 return fieldTypeDefinition.Edit; 7100 } 7101 function getControlByType(type) { 7102 if (Object.keys(FORM_CONTROLS).includes(type)) { 7103 return FORM_CONTROLS[type]; 7104 } 7105 throw 'Control ' + type + ' not found'; 7106 } 7107 7108 ;// ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js 7109 /** 7110 * Internal dependencies 7111 */ 7112 7113 7114 7115 /** 7116 * Apply default values and normalize the fields config. 7117 * 7118 * @param fields Fields config. 7119 * @return Normalized fields config. 7120 */ 7121 function normalizeFields(fields) { 7122 return fields.map(field => { 7123 var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting; 7124 const fieldTypeDefinition = getFieldTypeDefinition(field.type); 7125 const getValue = field.getValue || (({ 7126 item 7127 }) => item[field.id]); 7128 const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) { 7129 return fieldTypeDefinition.sort(getValue({ 7130 item: a 7131 }), getValue({ 7132 item: b 7133 }), direction); 7134 }; 7135 const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) { 7136 return fieldTypeDefinition.isValid(getValue({ 7137 item 7138 }), context); 7139 }; 7140 const Edit = getControl(field, fieldTypeDefinition); 7141 const renderFromElements = ({ 7142 item 7143 }) => { 7144 const value = getValue({ 7145 item 7146 }); 7147 return field?.elements?.find(element => element.value === value)?.label || getValue({ 7148 item 7149 }); 7150 }; 7151 const render = field.render || (field.elements ? renderFromElements : getValue); 7152 return { 7153 ...field, 7154 label: field.label || field.id, 7155 header: field.header || field.label || field.id, 7156 getValue, 7157 render, 7158 sort, 7159 isValid, 7160 Edit, 7161 enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true, 7162 enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true 7163 }; 7164 }); 7165 } 7166 7167 ;// ./node_modules/@wordpress/dataviews/build-module/validation.js 7168 /** 7169 * Internal dependencies 7170 */ 7171 7172 function isItemValid(item, fields, form) { 7173 const _fields = normalizeFields(fields.filter(({ 7174 id 7175 }) => !!form.fields?.includes(id))); 7176 return _fields.every(field => { 7177 return field.isValid(item, { 7178 elements: field.elements 7179 }); 7180 }); 7181 } 7182 7183 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js 7184 /** 7185 * WordPress dependencies 7186 */ 7187 7188 7189 7190 /** 7191 * Internal dependencies 7192 */ 7193 7194 7195 function FormRegular({ 7196 data, 7197 fields, 7198 form, 7199 onChange 7200 }) { 7201 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 7202 var _form$fields; 7203 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 7204 id 7205 }) => id === fieldId)).filter(field => !!field)); 7206 }, [fields, form.fields]); 7207 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7208 spacing: 4, 7209 children: visibleFields.map(field => { 7210 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 7211 data: data, 7212 field: field, 7213 onChange: onChange 7214 }, field.id); 7215 }) 7216 }); 7217 } 7218 7219 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 7220 /** 7221 * WordPress dependencies 7222 */ 7223 7224 7225 const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7226 xmlns: "http://www.w3.org/2000/svg", 7227 viewBox: "0 0 24 24", 7228 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7229 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" 7230 }) 7231 }); 7232 /* harmony default export */ const close_small = (closeSmall); 7233 7234 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js 7235 /** 7236 * WordPress dependencies 7237 */ 7238 7239 7240 7241 7242 7243 /** 7244 * Internal dependencies 7245 */ 7246 7247 7248 7249 7250 function DropdownHeader({ 7251 title, 7252 onClose 7253 }) { 7254 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7255 className: "dataforms-layouts-panel__dropdown-header", 7256 spacing: 4, 7257 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7258 alignment: "center", 7259 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { 7260 level: 2, 7261 size: 13, 7262 children: title 7263 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7264 label: (0,external_wp_i18n_namespaceObject.__)('Close'), 7265 icon: close_small, 7266 onClick: onClose, 7267 size: "small" 7268 })] 7269 }) 7270 }); 7271 } 7272 function FormField({ 7273 data, 7274 field, 7275 onChange 7276 }) { 7277 // Use internal state instead of a ref to make sure that the component 7278 // re-renders when the popover's anchor updates. 7279 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 7280 // Memoize popoverProps to avoid returning a new object every time. 7281 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 7282 // Anchor the popover to the middle of the entire row so that it doesn't 7283 // move around when the label changes. 7284 anchor: popoverAnchor, 7285 placement: 'left-start', 7286 offset: 36, 7287 shift: true 7288 }), [popoverAnchor]); 7289 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7290 ref: setPopoverAnchor, 7291 className: "dataforms-layouts-panel__field", 7292 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7293 className: "dataforms-layouts-panel__field-label", 7294 children: field.label 7295 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7296 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 7297 contentClassName: "dataforms-layouts-panel__field-dropdown", 7298 popoverProps: popoverProps, 7299 focusOnMount: true, 7300 toggleProps: { 7301 size: 'compact', 7302 variant: 'tertiary', 7303 tooltipPosition: 'middle left' 7304 }, 7305 renderToggle: ({ 7306 isOpen, 7307 onToggle 7308 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7309 className: "dataforms-layouts-panel__field-control", 7310 size: "compact", 7311 variant: "tertiary", 7312 "aria-expanded": isOpen, 7313 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 7314 // translators: %s: Field name. 7315 (0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), field.label), 7316 onClick: onToggle, 7317 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { 7318 item: data 7319 }) 7320 }), 7321 renderContent: ({ 7322 onClose 7323 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 7324 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { 7325 title: field.label, 7326 onClose: onClose 7327 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { 7328 data: data, 7329 field: field, 7330 onChange: onChange, 7331 hideLabelFromVision: true 7332 }, field.id)] 7333 }) 7334 }) 7335 })] 7336 }); 7337 } 7338 function FormPanel({ 7339 data, 7340 fields, 7341 form, 7342 onChange 7343 }) { 7344 const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => { 7345 var _form$fields; 7346 return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({ 7347 id 7348 }) => id === fieldId)).filter(field => !!field)); 7349 }, [fields, form.fields]); 7350 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 7351 spacing: 2, 7352 children: visibleFields.map(field => { 7353 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormField, { 7354 data: data, 7355 field: field, 7356 onChange: onChange 7357 }, field.id); 7358 }) 7359 }); 7360 } 7361 7362 ;// ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js 7363 /** 7364 * Internal dependencies 7365 */ 7366 7367 7368 const FORM_LAYOUTS = [{ 7369 type: 'regular', 7370 component: FormRegular 7371 }, { 7372 type: 'panel', 7373 component: FormPanel 7374 }]; 7375 function getFormLayout(type) { 7376 return FORM_LAYOUTS.find(layout => layout.type === type); 7377 } 7378 7379 ;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js 7380 /** 7381 * Internal dependencies 7382 */ 7383 7384 7385 7386 function DataForm({ 7387 form, 7388 ...props 7389 }) { 7390 var _form$type; 7391 const layout = getFormLayout((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : 'regular'); 7392 if (!layout) { 7393 return null; 7394 } 7395 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout.component, { 7396 form: form, 7397 ...props 7398 }); 7399 } 7400 7401 ;// ./node_modules/@wordpress/fields/build-module/fields/order/index.js 7402 /** 7403 * WordPress dependencies 7404 */ 7405 7406 7407 /** 7408 * Internal dependencies 7409 */ 7410 7411 const orderField = { 7412 type: 'integer', 7413 id: 'menu_order', 7414 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 7415 description: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages.') 7416 }; 7417 /* harmony default export */ const order = (orderField); 7418 7419 ;// ./node_modules/@wordpress/fields/build-module/actions/base-post/reorder-page.js 7420 /** 7421 * WordPress dependencies 7422 */ 7423 7424 7425 7426 7427 7428 7429 7430 7431 /** 7432 * Internal dependencies 7433 */ 7434 7435 7436 7437 7438 const fields = [order]; 7439 const formOrderAction = { 7440 fields: ['menu_order'] 7441 }; 7442 function ReorderModal({ 7443 items, 7444 closeModal, 7445 onActionPerformed 7446 }) { 7447 const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]); 7448 const orderInput = item.menu_order; 7449 const { 7450 editEntityRecord, 7451 saveEditedEntityRecord 7452 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 7453 const { 7454 createSuccessNotice, 7455 createErrorNotice 7456 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 7457 async function onOrder(event) { 7458 event.preventDefault(); 7459 if (!isItemValid(item, fields, formOrderAction)) { 7460 return; 7461 } 7462 try { 7463 await editEntityRecord('postType', item.type, item.id, { 7464 menu_order: orderInput 7465 }); 7466 closeModal?.(); 7467 // Persist edited entity. 7468 await saveEditedEntityRecord('postType', item.type, item.id, { 7469 throwOnError: true 7470 }); 7471 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Order updated.'), { 7472 type: 'snackbar' 7473 }); 7474 onActionPerformed?.(items); 7475 } catch (error) { 7476 const typedError = error; 7477 const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the order'); 7478 createErrorNotice(errorMessage, { 7479 type: 'snackbar' 7480 }); 7481 } 7482 } 7483 const isSaveDisabled = !isItemValid(item, fields, formOrderAction); 7484 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 7485 onSubmit: onOrder, 7486 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 7487 spacing: "5", 7488 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 7489 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.') 7490 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, { 7491 data: item, 7492 fields: fields, 7493 form: formOrderAction, 7494 onChange: changes => setItem({ 7495 ...item, 7496 ...changes 7497 }) 7498 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7499 justify: "right", 7500 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7501 __next40pxDefaultSize: true, 7502 variant: "tertiary", 7503 onClick: () => { 7504 closeModal?.(); 7505 }, 7506 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 7507 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7508 __next40pxDefaultSize: true, 7509 variant: "primary", 7510 type: "submit", 7511 accessibleWhenDisabled: true, 7512 disabled: isSaveDisabled, 7513 children: (0,external_wp_i18n_namespaceObject.__)('Save') 7514 })] 7515 })] 7516 }) 7517 }); 7518 } 7519 const reorderPage = { 7520 id: 'order-pages', 7521 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 7522 isEligible({ 7523 status 7524 }) { 7525 return status !== 'trash'; 7526 }, 7527 RenderModal: ReorderModal 7528 }; 7529 /* harmony default export */ const reorder_page = (reorderPage); 7530 7531 ;// ./node_modules/client-zip/index.js 7532 "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)} 7533 ;// external ["wp","blob"] 7534 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 7535 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 7536 /** 7537 * WordPress dependencies 7538 */ 7539 7540 7541 const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 7542 xmlns: "http://www.w3.org/2000/svg", 7543 viewBox: "0 0 24 24", 7544 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 7545 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" 7546 }) 7547 }); 7548 /* harmony default export */ const library_download = (download); 7549 7550 ;// ./node_modules/@wordpress/fields/build-module/actions/utils.js 7551 /** 7552 * WordPress dependencies 7553 */ 7554 7555 7556 /** 7557 * Internal dependencies 7558 */ 7559 7560 const utils_TEMPLATE_POST_TYPE = 'wp_template'; 7561 const utils_TEMPLATE_PART_POST_TYPE = 'wp_template_part'; 7562 const utils_TEMPLATE_ORIGINS = { 7563 custom: 'custom', 7564 theme: 'theme', 7565 plugin: 'plugin' 7566 }; 7567 function utils_isTemplate(post) { 7568 return post.type === utils_TEMPLATE_POST_TYPE; 7569 } 7570 function utils_isTemplatePart(post) { 7571 return post.type === utils_TEMPLATE_PART_POST_TYPE; 7572 } 7573 function utils_isTemplateOrTemplatePart(p) { 7574 return p.type === utils_TEMPLATE_POST_TYPE || p.type === utils_TEMPLATE_PART_POST_TYPE; 7575 } 7576 function utils_getItemTitle(item) { 7577 if (typeof item.title === 'string') { 7578 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 7579 } 7580 if ('rendered' in item.title) { 7581 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 7582 } 7583 if ('raw' in item.title) { 7584 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 7585 } 7586 return ''; 7587 } 7588 7589 /** 7590 * Check if a template is removable. 7591 * 7592 * @param template The template entity to check. 7593 * @return Whether the template is removable. 7594 */ 7595 function utils_isTemplateRemovable(template) { 7596 if (!template) { 7597 return false; 7598 } 7599 // In patterns list page we map the templates parts to a different object 7600 // than the one returned from the endpoint. This is why we need to check for 7601 // two props whether is custom or has a theme file. 7602 return [template.source, template.source].includes(utils_TEMPLATE_ORIGINS.custom) && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file; 7603 } 7604 7605 ;// ./node_modules/@wordpress/fields/build-module/actions/pattern/export-pattern.js 7606 /** 7607 * External dependencies 7608 */ 7609 7610 7611 7612 /** 7613 * WordPress dependencies 7614 */ 7615 7616 7617 7618 7619 /** 7620 * Internal dependencies 7621 */ 7622 7623 7624 function getJsonFromItem(item) { 7625 return JSON.stringify({ 7626 __file: item.type, 7627 title: utils_getItemTitle(item), 7628 content: typeof item.content === 'string' ? item.content : item.content?.raw, 7629 syncStatus: item.wp_pattern_sync_status 7630 }, null, 2); 7631 } 7632 const exportPattern = { 7633 id: 'export-pattern', 7634 label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'), 7635 icon: library_download, 7636 supportsBulk: true, 7637 isEligible: item => item.type === 'wp_block', 7638 callback: async items => { 7639 if (items.length === 1) { 7640 return (0,external_wp_blob_namespaceObject.downloadBlob)(`$paramCase(utils_getItemTitle(items[0]) || items[0].slug)}.json`, getJsonFromItem(items[0]), 'application/json'); 7641 } 7642 const nameCount = {}; 7643 const filesToZip = items.map(item => { 7644 const name = paramCase(utils_getItemTitle(item) || item.slug); 7645 nameCount[name] = (nameCount[name] || 0) + 1; 7646 return { 7647 name: `$name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`, 7648 lastModified: new Date(), 7649 input: getJsonFromItem(item) 7650 }; 7651 }); 7652 return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip'); 7653 } 7654 }; 7655 /* harmony default export */ const export_pattern = (exportPattern); 7656 7657 ;// ./node_modules/@wordpress/fields/build-module/actions/common/permanently-delete-post.js 7658 /** 7659 * WordPress dependencies 7660 */ 7661 7662 7663 7664 7665 7666 /** 7667 * Internal dependencies 7668 */ 7669 7670 const permanentlyDeletePost = { 7671 id: 'permanently-delete', 7672 label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'), 7673 supportsBulk: true, 7674 icon: library_trash, 7675 isEligible(item) { 7676 if (utils_isTemplateOrTemplatePart(item) || item.type === 'wp_block') { 7677 return false; 7678 } 7679 const { 7680 status, 7681 permissions 7682 } = item; 7683 return status === 'trash' && permissions?.delete; 7684 }, 7685 async callback(posts, { 7686 registry, 7687 onActionPerformed 7688 }) { 7689 const { 7690 createSuccessNotice, 7691 createErrorNotice 7692 } = registry.dispatch(external_wp_notices_namespaceObject.store); 7693 const { 7694 deleteEntityRecord 7695 } = registry.dispatch(external_wp_coreData_namespaceObject.store); 7696 const promiseResult = await Promise.allSettled(posts.map(post => { 7697 return deleteEntityRecord('postType', post.type, post.id, { 7698 force: true 7699 }, { 7700 throwOnError: true 7701 }); 7702 })); 7703 // If all the promises were fulfilled with success. 7704 if (promiseResult.every(({ 7705 status 7706 }) => status === 'fulfilled')) { 7707 let successMessage; 7708 if (promiseResult.length === 1) { 7709 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */ 7710 (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), utils_getItemTitle(posts[0])); 7711 } else { 7712 successMessage = (0,external_wp_i18n_namespaceObject.__)('The items were permanently deleted.'); 7713 } 7714 createSuccessNotice(successMessage, { 7715 type: 'snackbar', 7716 id: 'permanently-delete-post-action' 7717 }); 7718 onActionPerformed?.(posts); 7719 } else { 7720 // If there was at lease one failure. 7721 let errorMessage; 7722 // If we were trying to permanently delete a single post. 7723 if (promiseResult.length === 1) { 7724 const typedError = promiseResult[0]; 7725 if (typedError.reason?.message) { 7726 errorMessage = typedError.reason.message; 7727 } else { 7728 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the item.'); 7729 } 7730 // If we were trying to permanently delete multiple posts 7731 } else { 7732 const errorMessages = new Set(); 7733 const failedPromises = promiseResult.filter(({ 7734 status 7735 }) => status === 'rejected'); 7736 for (const failedPromise of failedPromises) { 7737 const typedError = failedPromise; 7738 if (typedError.reason?.message) { 7739 errorMessages.add(typedError.reason.message); 7740 } 7741 } 7742 if (errorMessages.size === 0) { 7743 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items.'); 7744 } else if (errorMessages.size === 1) { 7745 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 7746 (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items: %s'), [...errorMessages][0]); 7747 } else { 7748 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 7749 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the items: %s'), [...errorMessages].join(',')); 7750 } 7751 } 7752 createErrorNotice(errorMessage, { 7753 type: 'snackbar' 7754 }); 7755 } 7756 } 7757 }; 7758 /* harmony default export */ const permanently_delete_post = (permanentlyDeletePost); 7759 7760 ;// ./node_modules/@wordpress/editor/build-module/dataviews/actions/delete-post.js 7761 /** 7762 * WordPress dependencies 7763 */ 7764 7765 7766 7767 7768 7769 // @ts-ignore 7770 7771 /** 7772 * Internal dependencies 7773 */ 7774 7775 // @ts-ignore 7776 7777 7778 7779 7780 const { 7781 PATTERN_TYPES: delete_post_PATTERN_TYPES 7782 } = unlock(external_wp_patterns_namespaceObject.privateApis); 7783 7784 // This action is used for templates, patterns and template parts. 7785 // Every other post type uses the similar `trashPostAction` which 7786 // moves the post to trash. 7787 const deletePostAction = { 7788 id: 'delete-post', 7789 label: (0,external_wp_i18n_namespaceObject.__)('Delete'), 7790 isPrimary: true, 7791 icon: library_trash, 7792 isEligible(post) { 7793 if (isTemplateOrTemplatePart(post)) { 7794 return isTemplateRemovable(post); 7795 } 7796 // We can only remove user patterns. 7797 return post.type === delete_post_PATTERN_TYPES.user; 7798 }, 7799 supportsBulk: true, 7800 hideModalHeader: true, 7801 RenderModal: ({ 7802 items, 7803 closeModal, 7804 onActionPerformed 7805 }) => { 7806 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 7807 const { 7808 removeTemplates 7809 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 7810 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 7811 spacing: "5", 7812 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 7813 children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 7814 // translators: %d: number of items to delete. 7815 (0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( 7816 // translators: %s: The template or template part's title 7817 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'template part'), getItemTitle(items[0])) 7818 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 7819 justify: "right", 7820 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7821 variant: "tertiary", 7822 onClick: closeModal, 7823 disabled: isBusy, 7824 accessibleWhenDisabled: true, 7825 __next40pxDefaultSize: true, 7826 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 7827 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 7828 variant: "primary", 7829 onClick: async () => { 7830 setIsBusy(true); 7831 await removeTemplates(items, { 7832 allowUndo: false 7833 }); 7834 onActionPerformed?.(items); 7835 setIsBusy(false); 7836 closeModal?.(); 7837 }, 7838 isBusy: isBusy, 7839 disabled: isBusy, 7840 accessibleWhenDisabled: true, 7841 __next40pxDefaultSize: true, 7842 children: (0,external_wp_i18n_namespaceObject.__)('Delete') 7843 })] 7844 })] 7845 }); 7846 } 7847 }; 7848 /* harmony default export */ const delete_post = (deletePostAction); 7849 7850 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js 7851 /** 7852 * WordPress dependencies 7853 */ 7854 7855 7856 7857 /** 7858 * Internal dependencies 7859 */ 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 function registerEntityAction(kind, name, config) { 7870 return { 7871 type: 'REGISTER_ENTITY_ACTION', 7872 kind, 7873 name, 7874 config 7875 }; 7876 } 7877 function unregisterEntityAction(kind, name, actionId) { 7878 return { 7879 type: 'UNREGISTER_ENTITY_ACTION', 7880 kind, 7881 name, 7882 actionId 7883 }; 7884 } 7885 function setIsReady(kind, name) { 7886 return { 7887 type: 'SET_IS_READY', 7888 kind, 7889 name 7890 }; 7891 } 7892 const registerPostTypeActions = postType => async ({ 7893 registry 7894 }) => { 7895 const isReady = unlock(registry.select(store_store)).isEntityReady('postType', postType); 7896 if (isReady) { 7897 return; 7898 } 7899 unlock(registry.dispatch(store_store)).setIsReady('postType', postType); 7900 const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 7901 const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser('create', { 7902 kind: 'postType', 7903 name: postType 7904 }); 7905 const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); 7906 const actions = [postTypeConfig.viewable ? view_post : undefined, !!postTypeConfig?.supports?.revisions ? view_post_revisions : undefined, 7907 // @ts-ignore 7908 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, reset_post, restore_post, delete_post, trash_post, permanently_delete_post]; 7909 registry.batch(() => { 7910 actions.forEach(action => { 7911 if (!action) { 7912 return; 7913 } 7914 unlock(registry.dispatch(store_store)).registerEntityAction('postType', postType, action); 7915 }); 7916 }); 7917 (0,external_wp_hooks_namespaceObject.doAction)('core.registerPostTypeActions', postType); 7918 }; 7919 7920 ;// ./node_modules/@wordpress/editor/build-module/store/private-actions.js 7921 /** 7922 * WordPress dependencies 7923 */ 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 /** 7935 * Internal dependencies 7936 */ 7937 7938 7939 7940 /** 7941 * Returns an action object used to set which template is currently being used/edited. 7942 * 7943 * @param {string} id Template Id. 7944 * 7945 * @return {Object} Action object. 7946 */ 7947 function setCurrentTemplateId(id) { 7948 return { 7949 type: 'SET_CURRENT_TEMPLATE_ID', 7950 id 7951 }; 7952 } 7953 7954 /** 7955 * Create a block based template. 7956 * 7957 * @param {Object?} template Template to create and assign. 7958 */ 7959 const createTemplate = template => async ({ 7960 select, 7961 dispatch, 7962 registry 7963 }) => { 7964 const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); 7965 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', select.getCurrentPostType(), select.getCurrentPostId(), { 7966 template: savedTemplate.slug 7967 }); 7968 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), { 7969 type: 'snackbar', 7970 actions: [{ 7971 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 7972 onClick: () => dispatch.setRenderingMode(select.getEditorSettings().defaultRenderingMode) 7973 }] 7974 }); 7975 return savedTemplate; 7976 }; 7977 7978 /** 7979 * Update the provided block types to be visible. 7980 * 7981 * @param {string[]} blockNames Names of block types to show. 7982 */ 7983 const showBlockTypes = blockNames => ({ 7984 registry 7985 }) => { 7986 var _registry$select$get; 7987 const existingBlockNames = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; 7988 const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)); 7989 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', newBlockNames); 7990 }; 7991 7992 /** 7993 * Update the provided block types to be hidden. 7994 * 7995 * @param {string[]} blockNames Names of block types to hide. 7996 */ 7997 const hideBlockTypes = blockNames => ({ 7998 registry 7999 }) => { 8000 var _registry$select$get2; 8001 const existingBlockNames = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; 8002 const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]); 8003 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]); 8004 }; 8005 8006 /** 8007 * Save entity records marked as dirty. 8008 * 8009 * @param {Object} options Options for the action. 8010 * @param {Function} [options.onSave] Callback when saving happens. 8011 * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities. 8012 * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving. 8013 * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`. 8014 */ 8015 const saveDirtyEntities = ({ 8016 onSave, 8017 dirtyEntityRecords = [], 8018 entitiesToSkip = [], 8019 close 8020 } = {}) => ({ 8021 registry 8022 }) => { 8023 const PUBLISH_ON_SAVE_ENTITIES = [{ 8024 kind: 'postType', 8025 name: 'wp_navigation' 8026 }]; 8027 const saveNoticeId = 'site-editor-save-success'; 8028 const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 8029 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); 8030 const entitiesToSave = dirtyEntityRecords.filter(({ 8031 kind, 8032 name, 8033 key, 8034 property 8035 }) => { 8036 return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); 8037 }); 8038 close?.(entitiesToSave); 8039 const siteItemsToSave = []; 8040 const pendingSavedRecords = []; 8041 entitiesToSave.forEach(({ 8042 kind, 8043 name, 8044 key, 8045 property 8046 }) => { 8047 if ('root' === kind && 'site' === name) { 8048 siteItemsToSave.push(property); 8049 } else { 8050 if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { 8051 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { 8052 status: 'publish' 8053 }); 8054 } 8055 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key)); 8056 } 8057 }); 8058 if (siteItemsToSave.length) { 8059 pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); 8060 } 8061 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 8062 Promise.all(pendingSavedRecords).then(values => { 8063 return onSave ? onSave(values) : values; 8064 }).then(values => { 8065 if (values.some(value => typeof value === 'undefined')) { 8066 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); 8067 } else { 8068 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { 8069 type: 'snackbar', 8070 id: saveNoticeId, 8071 actions: [{ 8072 label: (0,external_wp_i18n_namespaceObject.__)('View site'), 8073 url: homeUrl 8074 }] 8075 }); 8076 } 8077 }).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} $error}`)); 8078 }; 8079 8080 /** 8081 * Reverts a template to its original theme-provided file. 8082 * 8083 * @param {Object} template The template to revert. 8084 * @param {Object} [options] 8085 * @param {boolean} [options.allowUndo] Whether to allow the user to undo 8086 * reverting the template. Default true. 8087 */ 8088 const revertTemplate = (template, { 8089 allowUndo = true 8090 } = {}) => async ({ 8091 registry 8092 }) => { 8093 const noticeId = 'edit-site-template-reverted'; 8094 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 8095 if (!isTemplateRevertable(template)) { 8096 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), { 8097 type: 'snackbar' 8098 }); 8099 return; 8100 } 8101 try { 8102 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type); 8103 if (!templateEntityConfig) { 8104 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 8105 type: 'snackbar' 8106 }); 8107 return; 8108 } 8109 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`$templateEntityConfig.baseURL}/$template.id}`, { 8110 context: 'edit', 8111 source: template.origin 8112 }); 8113 const fileTemplate = await external_wp_apiFetch_default()({ 8114 path: fileTemplatePath 8115 }); 8116 if (!fileTemplate) { 8117 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), { 8118 type: 'snackbar' 8119 }); 8120 return; 8121 } 8122 const serializeBlocks = ({ 8123 blocks: blocksForSerialization = [] 8124 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 8125 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); 8126 8127 // We are fixing up the undo level here to make sure we can undo 8128 // the revert in the header toolbar correctly. 8129 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, { 8130 content: serializeBlocks, 8131 // Required to make the `undo` behave correctly. 8132 blocks: edited.blocks, 8133 // Required to revert the blocks in the editor. 8134 source: 'custom' // required to avoid turning the editor into a dirty state 8135 }, { 8136 undoIgnore: true // Required to merge this edit with the last undo level. 8137 }); 8138 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 8139 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, { 8140 content: serializeBlocks, 8141 blocks, 8142 source: 'theme' 8143 }); 8144 if (allowUndo) { 8145 const undoRevert = () => { 8146 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, { 8147 content: serializeBlocks, 8148 blocks: edited.blocks, 8149 source: 'custom' 8150 }); 8151 }; 8152 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), { 8153 type: 'snackbar', 8154 id: noticeId, 8155 actions: [{ 8156 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 8157 onClick: undoRevert 8158 }] 8159 }); 8160 } 8161 } catch (error) { 8162 const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.'); 8163 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 8164 type: 'snackbar' 8165 }); 8166 } 8167 }; 8168 8169 /** 8170 * Action that removes an array of templates, template parts or patterns. 8171 * 8172 * @param {Array} items An array of template,template part or pattern objects to remove. 8173 */ 8174 const removeTemplates = items => async ({ 8175 registry 8176 }) => { 8177 const isResetting = items.every(item => item?.has_theme_file); 8178 const promiseResult = await Promise.allSettled(items.map(item => { 8179 return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, { 8180 force: true 8181 }, { 8182 throwOnError: true 8183 }); 8184 })); 8185 8186 // If all the promises were fulfilled with sucess. 8187 if (promiseResult.every(({ 8188 status 8189 }) => status === 'fulfilled')) { 8190 let successMessage; 8191 if (items.length === 1) { 8192 // Depending on how the entity was retrieved its title might be 8193 // an object or simple string. 8194 let title; 8195 if (typeof items[0].title === 'string') { 8196 title = items[0].title; 8197 } else if (typeof items[0].title?.rendered === 'string') { 8198 title = items[0].title?.rendered; 8199 } else if (typeof items[0].title?.raw === 'string') { 8200 title = items[0].title?.raw; 8201 } 8202 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */ 8203 (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. */ 8204 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); 8205 } else { 8206 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.'); 8207 } 8208 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { 8209 type: 'snackbar', 8210 id: 'editor-template-deleted-success' 8211 }); 8212 } else { 8213 // If there was at lease one failure. 8214 let errorMessage; 8215 // If we were trying to delete a single template. 8216 if (promiseResult.length === 1) { 8217 if (promiseResult[0].reason?.message) { 8218 errorMessage = promiseResult[0].reason.message; 8219 } else { 8220 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.'); 8221 } 8222 // If we were trying to delete a multiple templates 8223 } else { 8224 const errorMessages = new Set(); 8225 const failedPromises = promiseResult.filter(({ 8226 status 8227 }) => status === 'rejected'); 8228 for (const failedPromise of failedPromises) { 8229 if (failedPromise.reason?.message) { 8230 errorMessages.add(failedPromise.reason.message); 8231 } 8232 } 8233 if (errorMessages.size === 0) { 8234 errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.'); 8235 } else if (errorMessages.size === 1) { 8236 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */ 8237 (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 */ 8238 (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]); 8239 } else { 8240 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */ 8241 (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 */ 8242 (0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(',')); 8243 } 8244 } 8245 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 8246 type: 'snackbar' 8247 }); 8248 } 8249 }; 8250 8251 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js 8252 var fast_deep_equal = __webpack_require__(5215); 8253 var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); 8254 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 8255 /** 8256 * WordPress dependencies 8257 */ 8258 8259 8260 const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8261 xmlns: "http://www.w3.org/2000/svg", 8262 viewBox: "0 0 24 24", 8263 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8264 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" 8265 }) 8266 }); 8267 /* harmony default export */ const library_symbol = (symbol); 8268 8269 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 8270 /** 8271 * WordPress dependencies 8272 */ 8273 8274 8275 const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8276 viewBox: "0 0 24 24", 8277 xmlns: "http://www.w3.org/2000/svg", 8278 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8279 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" 8280 }) 8281 }); 8282 /* harmony default export */ const library_navigation = (navigation); 8283 8284 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 8285 /** 8286 * WordPress dependencies 8287 */ 8288 8289 8290 8291 const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 8292 xmlns: "http://www.w3.org/2000/svg", 8293 viewBox: "0 0 24 24", 8294 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8295 d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" 8296 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8297 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" 8298 })] 8299 }); 8300 /* harmony default export */ const library_page = (page); 8301 8302 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 8303 /** 8304 * WordPress dependencies 8305 */ 8306 8307 8308 const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8309 viewBox: "0 0 24 24", 8310 xmlns: "http://www.w3.org/2000/svg", 8311 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8312 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" 8313 }) 8314 }); 8315 /* harmony default export */ const library_verse = (verse); 8316 8317 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js 8318 /** 8319 * Internal dependencies 8320 */ 8321 8322 const EMPTY_ARRAY = []; 8323 function getEntityActions(state, kind, name) { 8324 var _state$actions$kind$n; 8325 return (_state$actions$kind$n = state.actions[kind]?.[name]) !== null && _state$actions$kind$n !== void 0 ? _state$actions$kind$n : EMPTY_ARRAY; 8326 } 8327 function isEntityReady(state, kind, name) { 8328 return state.isReady[kind]?.[name]; 8329 } 8330 8331 ;// ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 8332 /** 8333 * External dependencies 8334 */ 8335 8336 8337 /** 8338 * WordPress dependencies 8339 */ 8340 8341 8342 8343 8344 8345 /** 8346 * Internal dependencies 8347 */ 8348 8349 8350 const EMPTY_INSERTION_POINT = { 8351 rootClientId: undefined, 8352 insertionIndex: undefined, 8353 filterValue: undefined 8354 }; 8355 8356 /** 8357 * Get the insertion point for the inserter. 8358 * 8359 * @param {Object} state Global application state. 8360 * 8361 * @return {Object} The root client ID, index to insert at and starting filter value. 8362 */ 8363 const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { 8364 if (typeof state.blockInserterPanel === 'object') { 8365 return state.blockInserterPanel; 8366 } 8367 if (getRenderingMode(state) === 'template-locked') { 8368 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 8369 if (postContentClientId) { 8370 return { 8371 rootClientId: postContentClientId, 8372 insertionIndex: undefined, 8373 filterValue: undefined 8374 }; 8375 } 8376 } 8377 return EMPTY_INSERTION_POINT; 8378 }, state => { 8379 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content'); 8380 return [state.blockInserterPanel, getRenderingMode(state), postContentClientId]; 8381 })); 8382 function getListViewToggleRef(state) { 8383 return state.listViewToggleRef; 8384 } 8385 function getInserterSidebarToggleRef(state) { 8386 return state.inserterSidebarToggleRef; 8387 } 8388 const CARD_ICONS = { 8389 wp_block: library_symbol, 8390 wp_navigation: library_navigation, 8391 page: library_page, 8392 post: library_verse 8393 }; 8394 const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => { 8395 { 8396 if (postType === 'wp_template_part' || postType === 'wp_template') { 8397 return __experimentalGetDefaultTemplatePartAreas(state).find(item => options.area === item.area)?.icon || library_layout; 8398 } 8399 if (CARD_ICONS[postType]) { 8400 return CARD_ICONS[postType]; 8401 } 8402 const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); 8403 // `icon` is the `menu_icon` property of a post type. We 8404 // only handle `dashicons` for now, even if the `menu_icon` 8405 // also supports urls and svg as values. 8406 if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) { 8407 return postTypeEntity.icon.slice(10); 8408 } 8409 return library_page; 8410 } 8411 }); 8412 8413 /** 8414 * Returns true if there are unsaved changes to the 8415 * post's meta fields, and false otherwise. 8416 * 8417 * @param {Object} state Global application state. 8418 * @param {string} postType The post type of the post. 8419 * @param {number} postId The ID of the post. 8420 * 8421 * @return {boolean} Whether there are edits or not in the meta fields of the relevant post. 8422 */ 8423 const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { 8424 const { 8425 type: currentPostType, 8426 id: currentPostId 8427 } = getCurrentPost(state); 8428 // If no postType or postId is passed, use the current post. 8429 const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId); 8430 if (!edits?.meta) { 8431 return false; 8432 } 8433 8434 // Compare if anything apart from `footnotes` has changed. 8435 const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta; 8436 return !fast_deep_equal_default()({ 8437 ...originalPostMeta, 8438 footnotes: undefined 8439 }, { 8440 ...edits.meta, 8441 footnotes: undefined 8442 }); 8443 }); 8444 function private_selectors_getEntityActions(state, ...args) { 8445 return getEntityActions(state.dataviews, ...args); 8446 } 8447 function private_selectors_isEntityReady(state, ...args) { 8448 return isEntityReady(state.dataviews, ...args); 8449 } 8450 8451 /** 8452 * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most 8453 * blocks that aren't descendants of the query block. 8454 * 8455 * @param {Object} state Global application state. 8456 * @param {Array|string} blockNames Block names of the blocks to retrieve. 8457 * 8458 * @return {Array} Block client IDs. 8459 */ 8460 const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames) => { 8461 blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 8462 const { 8463 getBlocksByName, 8464 getBlockParents, 8465 getBlockName 8466 } = select(external_wp_blockEditor_namespaceObject.store); 8467 return getBlocksByName(blockNames).filter(clientId => getBlockParents(clientId).every(parentClientId => { 8468 const parentBlockName = getBlockName(parentClientId); 8469 return ( 8470 // Ignore descendents of the query block. 8471 parentBlockName !== 'core/query' && 8472 // Enable only the top-most block. 8473 !blockNames.includes(parentBlockName) 8474 ); 8475 })); 8476 }, () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()])); 8477 8478 ;// ./node_modules/@wordpress/editor/build-module/store/index.js 8479 /** 8480 * WordPress dependencies 8481 */ 8482 8483 8484 /** 8485 * Internal dependencies 8486 */ 8487 8488 8489 8490 8491 8492 8493 8494 8495 /** 8496 * Post editor data store configuration. 8497 * 8498 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 8499 * 8500 * @type {Object} 8501 */ 8502 const storeConfig = { 8503 reducer: store_reducer, 8504 selectors: selectors_namespaceObject, 8505 actions: actions_namespaceObject 8506 }; 8507 8508 /** 8509 * Store definition for the editor namespace. 8510 * 8511 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 8512 * 8513 * @type {Object} 8514 */ 8515 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 8516 ...storeConfig 8517 }); 8518 (0,external_wp_data_namespaceObject.register)(store_store); 8519 unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); 8520 unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); 8521 8522 ;// ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 8523 /** 8524 * WordPress dependencies 8525 */ 8526 8527 8528 8529 8530 8531 8532 /** 8533 * Internal dependencies 8534 */ 8535 8536 8537 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ 8538 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 8539 8540 /** 8541 * Object whose keys are the names of block attributes, where each value 8542 * represents the meta key to which the block attribute is intended to save. 8543 * 8544 * @see https://developer.wordpress.org/reference/functions/register_meta/ 8545 * 8546 * @typedef {Object<string,string>} WPMetaAttributeMapping 8547 */ 8548 8549 /** 8550 * Given a mapping of attribute names (meta source attributes) to their 8551 * associated meta key, returns a higher order component that overrides its 8552 * `attributes` and `setAttributes` props to sync any changes with the edited 8553 * post's meta keys. 8554 * 8555 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. 8556 * 8557 * @return {WPHigherOrderComponent} Higher-order component. 8558 */ 8559 8560 const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({ 8561 attributes, 8562 setAttributes, 8563 ...props 8564 }) => { 8565 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 8566 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); 8567 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 8568 ...attributes, 8569 ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]])) 8570 }), [attributes, meta]); 8571 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 8572 attributes: mergedAttributes, 8573 setAttributes: nextAttributes => { 8574 const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( 8575 // Filter to intersection of keys between the updated 8576 // attributes and those with an associated meta key. 8577 ([key]) => key in metaAttributes).map(([attributeKey, value]) => [ 8578 // Rename the keys to the expected meta key name. 8579 metaAttributes[attributeKey], value])); 8580 if (Object.entries(nextMeta).length) { 8581 setMeta(nextMeta); 8582 } 8583 setAttributes(nextAttributes); 8584 }, 8585 ...props 8586 }); 8587 }, 'withMetaAttributeSource'); 8588 8589 /** 8590 * Filters a registered block's settings to enhance a block's `edit` component 8591 * to upgrade meta-sourced attributes to use the post's meta entity property. 8592 * 8593 * @param {WPBlockSettings} settings Registered block settings. 8594 * 8595 * @return {WPBlockSettings} Filtered block settings. 8596 */ 8597 function shimAttributeSource(settings) { 8598 var _settings$attributes; 8599 /** @type {WPMetaAttributeMapping} */ 8600 const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, { 8601 source 8602 }]) => source === 'meta').map(([attributeKey, { 8603 meta 8604 }]) => [attributeKey, meta])); 8605 if (Object.entries(metaAttributes).length) { 8606 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); 8607 } 8608 return settings; 8609 } 8610 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); 8611 8612 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 8613 /** 8614 * WordPress dependencies 8615 */ 8616 8617 8618 8619 8620 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ 8621 8622 8623 8624 function getUserLabel(user) { 8625 const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 8626 className: "editor-autocompleters__user-avatar", 8627 alt: "", 8628 src: user.avatar_urls[24] 8629 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8630 className: "editor-autocompleters__no-avatar" 8631 }); 8632 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8633 children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8634 className: "editor-autocompleters__user-name", 8635 children: user.name 8636 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 8637 className: "editor-autocompleters__user-slug", 8638 children: user.slug 8639 })] 8640 }); 8641 } 8642 8643 /** 8644 * A user mentions completer. 8645 * 8646 * @type {WPCompleter} 8647 */ 8648 /* harmony default export */ const user = ({ 8649 name: 'users', 8650 className: 'editor-autocompleters__user', 8651 triggerPrefix: '@', 8652 useItems(filterValue) { 8653 const users = (0,external_wp_data_namespaceObject.useSelect)(select => { 8654 const { 8655 getUsers 8656 } = select(external_wp_coreData_namespaceObject.store); 8657 return getUsers({ 8658 context: 'view', 8659 search: encodeURIComponent(filterValue) 8660 }); 8661 }, [filterValue]); 8662 const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ 8663 key: `user-$user.slug}`, 8664 value: user, 8665 label: getUserLabel(user) 8666 })) : [], [users]); 8667 return [options]; 8668 }, 8669 getOptionCompletion(user) { 8670 return `@$user.slug}`; 8671 } 8672 }); 8673 8674 ;// ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 8675 /** 8676 * WordPress dependencies 8677 */ 8678 8679 8680 /** 8681 * Internal dependencies 8682 */ 8683 8684 function setDefaultCompleters(completers = []) { 8685 // Provide copies so filters may directly modify them. 8686 completers.push({ 8687 ...user 8688 }); 8689 return completers; 8690 } 8691 (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); 8692 8693 ;// external ["wp","mediaUtils"] 8694 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 8695 ;// ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js 8696 /** 8697 * WordPress dependencies 8698 */ 8699 8700 8701 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload); 8702 8703 ;// ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js 8704 /** 8705 * WordPress dependencies 8706 */ 8707 8708 8709 8710 8711 8712 8713 8714 /** 8715 * Internal dependencies 8716 */ 8717 8718 8719 8720 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ 8721 8722 8723 8724 const { 8725 PatternOverridesControls, 8726 ResetOverridesControl, 8727 PatternOverridesBlockControls, 8728 PATTERN_TYPES: pattern_overrides_PATTERN_TYPES, 8729 PARTIAL_SYNCING_SUPPORTED_BLOCKS, 8730 PATTERN_SYNC_TYPES 8731 } = unlock(external_wp_patterns_namespaceObject.privateApis); 8732 8733 /** 8734 * Override the default edit UI to include a new block inspector control for 8735 * assigning a partial syncing controls to supported blocks in the pattern editor. 8736 * Currently, only the `core/paragraph` block is supported. 8737 * 8738 * @param {Component} BlockEdit Original component. 8739 * 8740 * @return {Component} Wrapped component. 8741 */ 8742 const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { 8743 const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; 8744 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8745 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { 8746 ...props 8747 }, "edit"), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { 8748 ...props 8749 }), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})] 8750 }); 8751 }, 'withPatternOverrideControls'); 8752 8753 // Split into a separate component to avoid a store subscription 8754 // on every block. 8755 function ControlsWithStoreSubscription(props) { 8756 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 8757 const { 8758 hasPatternOverridesSource, 8759 isEditingSyncedPattern 8760 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 8761 const { 8762 getCurrentPostType, 8763 getEditedPostAttribute 8764 } = select(store_store); 8765 return { 8766 // For editing link to the site editor if the theme and user permissions support it. 8767 hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)('core/pattern-overrides'), 8768 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 8769 }; 8770 }, []); 8771 const bindings = props.attributes.metadata?.bindings; 8772 const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides'); 8773 const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default'; 8774 const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings; 8775 if (!hasPatternOverridesSource) { 8776 return null; 8777 } 8778 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 8779 children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { 8780 ...props 8781 }), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { 8782 ...props 8783 })] 8784 }); 8785 } 8786 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls); 8787 8788 ;// ./node_modules/@wordpress/editor/build-module/hooks/index.js 8789 /** 8790 * Internal dependencies 8791 */ 8792 8793 8794 8795 8796 8797 ;// external ["wp","keyboardShortcuts"] 8798 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 8799 ;// ./node_modules/clsx/dist/clsx.mjs 8800 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); 8801 ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js 8802 /** 8803 * WordPress dependencies 8804 */ 8805 8806 8807 const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8808 xmlns: "http://www.w3.org/2000/svg", 8809 viewBox: "0 0 24 24", 8810 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8811 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" 8812 }) 8813 }); 8814 /* harmony default export */ const star_filled = (starFilled); 8815 8816 ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js 8817 /** 8818 * WordPress dependencies 8819 */ 8820 8821 8822 const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 8823 xmlns: "http://www.w3.org/2000/svg", 8824 viewBox: "0 0 24 24", 8825 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 8826 fillRule: "evenodd", 8827 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", 8828 clipRule: "evenodd" 8829 }) 8830 }); 8831 /* harmony default export */ const star_empty = (starEmpty); 8832 8833 ;// external ["wp","viewport"] 8834 const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 8835 ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js 8836 /** 8837 * WordPress dependencies 8838 */ 8839 8840 function normalizeComplementaryAreaScope(scope) { 8841 if (['core/edit-post', 'core/edit-site'].includes(scope)) { 8842 external_wp_deprecated_default()(`$scope} interface scope`, { 8843 alternative: 'core interface scope', 8844 hint: 'core/edit-post and core/edit-site are merging.', 8845 version: '6.6' 8846 }); 8847 return 'core'; 8848 } 8849 return scope; 8850 } 8851 function normalizeComplementaryAreaName(scope, name) { 8852 if (scope === 'core' && name === 'edit-site/template') { 8853 external_wp_deprecated_default()(`edit-site/template sidebar`, { 8854 alternative: 'edit-post/document', 8855 version: '6.6' 8856 }); 8857 return 'edit-post/document'; 8858 } 8859 if (scope === 'core' && name === 'edit-site/block-inspector') { 8860 external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { 8861 alternative: 'edit-post/block', 8862 version: '6.6' 8863 }); 8864 return 'edit-post/block'; 8865 } 8866 return name; 8867 } 8868 8869 ;// ./node_modules/@wordpress/interface/build-module/store/actions.js 8870 /** 8871 * WordPress dependencies 8872 */ 8873 8874 8875 8876 /** 8877 * Internal dependencies 8878 */ 8879 8880 8881 /** 8882 * Set a default complementary area. 8883 * 8884 * @param {string} scope Complementary area scope. 8885 * @param {string} area Area identifier. 8886 * 8887 * @return {Object} Action object. 8888 */ 8889 const setDefaultComplementaryArea = (scope, area) => { 8890 scope = normalizeComplementaryAreaScope(scope); 8891 area = normalizeComplementaryAreaName(scope, area); 8892 return { 8893 type: 'SET_DEFAULT_COMPLEMENTARY_AREA', 8894 scope, 8895 area 8896 }; 8897 }; 8898 8899 /** 8900 * Enable the complementary area. 8901 * 8902 * @param {string} scope Complementary area scope. 8903 * @param {string} area Area identifier. 8904 */ 8905 const enableComplementaryArea = (scope, area) => ({ 8906 registry, 8907 dispatch 8908 }) => { 8909 // Return early if there's no area. 8910 if (!area) { 8911 return; 8912 } 8913 scope = normalizeComplementaryAreaScope(scope); 8914 area = normalizeComplementaryAreaName(scope, area); 8915 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 8916 if (!isComplementaryAreaVisible) { 8917 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); 8918 } 8919 dispatch({ 8920 type: 'ENABLE_COMPLEMENTARY_AREA', 8921 scope, 8922 area 8923 }); 8924 }; 8925 8926 /** 8927 * Disable the complementary area. 8928 * 8929 * @param {string} scope Complementary area scope. 8930 */ 8931 const disableComplementaryArea = scope => ({ 8932 registry 8933 }) => { 8934 scope = normalizeComplementaryAreaScope(scope); 8935 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 8936 if (isComplementaryAreaVisible) { 8937 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); 8938 } 8939 }; 8940 8941 /** 8942 * Pins an item. 8943 * 8944 * @param {string} scope Item scope. 8945 * @param {string} item Item identifier. 8946 * 8947 * @return {Object} Action object. 8948 */ 8949 const pinItem = (scope, item) => ({ 8950 registry 8951 }) => { 8952 // Return early if there's no item. 8953 if (!item) { 8954 return; 8955 } 8956 scope = normalizeComplementaryAreaScope(scope); 8957 item = normalizeComplementaryAreaName(scope, item); 8958 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 8959 8960 // The item is already pinned, there's nothing to do. 8961 if (pinnedItems?.[item] === true) { 8962 return; 8963 } 8964 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 8965 ...pinnedItems, 8966 [item]: true 8967 }); 8968 }; 8969 8970 /** 8971 * Unpins an item. 8972 * 8973 * @param {string} scope Item scope. 8974 * @param {string} item Item identifier. 8975 */ 8976 const unpinItem = (scope, item) => ({ 8977 registry 8978 }) => { 8979 // Return early if there's no item. 8980 if (!item) { 8981 return; 8982 } 8983 scope = normalizeComplementaryAreaScope(scope); 8984 item = normalizeComplementaryAreaName(scope, item); 8985 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 8986 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 8987 ...pinnedItems, 8988 [item]: false 8989 }); 8990 }; 8991 8992 /** 8993 * Returns an action object used in signalling that a feature should be toggled. 8994 * 8995 * @param {string} scope The feature scope (e.g. core/edit-post). 8996 * @param {string} featureName The feature name. 8997 */ 8998 function toggleFeature(scope, featureName) { 8999 return function ({ 9000 registry 9001 }) { 9002 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 9003 since: '6.0', 9004 alternative: `dispatch( 'core/preferences' ).toggle` 9005 }); 9006 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 9007 }; 9008 } 9009 9010 /** 9011 * Returns an action object used in signalling that a feature should be set to 9012 * a true or false value 9013 * 9014 * @param {string} scope The feature scope (e.g. core/edit-post). 9015 * @param {string} featureName The feature name. 9016 * @param {boolean} value The value to set. 9017 * 9018 * @return {Object} Action object. 9019 */ 9020 function setFeatureValue(scope, featureName, value) { 9021 return function ({ 9022 registry 9023 }) { 9024 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 9025 since: '6.0', 9026 alternative: `dispatch( 'core/preferences' ).set` 9027 }); 9028 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 9029 }; 9030 } 9031 9032 /** 9033 * Returns an action object used in signalling that defaults should be set for features. 9034 * 9035 * @param {string} scope The feature scope (e.g. core/edit-post). 9036 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 9037 * 9038 * @return {Object} Action object. 9039 */ 9040 function setFeatureDefaults(scope, defaults) { 9041 return function ({ 9042 registry 9043 }) { 9044 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 9045 since: '6.0', 9046 alternative: `dispatch( 'core/preferences' ).setDefaults` 9047 }); 9048 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 9049 }; 9050 } 9051 9052 /** 9053 * Returns an action object used in signalling that the user opened a modal. 9054 * 9055 * @param {string} name A string that uniquely identifies the modal. 9056 * 9057 * @return {Object} Action object. 9058 */ 9059 function openModal(name) { 9060 return { 9061 type: 'OPEN_MODAL', 9062 name 9063 }; 9064 } 9065 9066 /** 9067 * Returns an action object signalling that the user closed a modal. 9068 * 9069 * @return {Object} Action object. 9070 */ 9071 function closeModal() { 9072 return { 9073 type: 'CLOSE_MODAL' 9074 }; 9075 } 9076 9077 ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js 9078 /** 9079 * WordPress dependencies 9080 */ 9081 9082 9083 9084 9085 /** 9086 * Internal dependencies 9087 */ 9088 9089 9090 /** 9091 * Returns the complementary area that is active in a given scope. 9092 * 9093 * @param {Object} state Global application state. 9094 * @param {string} scope Item scope. 9095 * 9096 * @return {string | null | undefined} The complementary area that is active in the given scope. 9097 */ 9098 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 9099 scope = normalizeComplementaryAreaScope(scope); 9100 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 9101 9102 // Return `undefined` to indicate that the user has never toggled 9103 // visibility, this is the vanilla default. Other code relies on this 9104 // nuance in the return value. 9105 if (isComplementaryAreaVisible === undefined) { 9106 return undefined; 9107 } 9108 9109 // Return `null` to indicate the user hid the complementary area. 9110 if (isComplementaryAreaVisible === false) { 9111 return null; 9112 } 9113 return state?.complementaryAreas?.[scope]; 9114 }); 9115 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 9116 scope = normalizeComplementaryAreaScope(scope); 9117 const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 9118 const identifier = state?.complementaryAreas?.[scope]; 9119 return isVisible && identifier === undefined; 9120 }); 9121 9122 /** 9123 * Returns a boolean indicating if an item is pinned or not. 9124 * 9125 * @param {Object} state Global application state. 9126 * @param {string} scope Scope. 9127 * @param {string} item Item to check. 9128 * 9129 * @return {boolean} True if the item is pinned and false otherwise. 9130 */ 9131 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 9132 var _pinnedItems$item; 9133 scope = normalizeComplementaryAreaScope(scope); 9134 item = normalizeComplementaryAreaName(scope, item); 9135 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 9136 return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 9137 }); 9138 9139 /** 9140 * Returns a boolean indicating whether a feature is active for a particular 9141 * scope. 9142 * 9143 * @param {Object} state The store state. 9144 * @param {string} scope The scope of the feature (e.g. core/edit-post). 9145 * @param {string} featureName The name of the feature. 9146 * 9147 * @return {boolean} Is the feature enabled? 9148 */ 9149 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 9150 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 9151 since: '6.0', 9152 alternative: `select( 'core/preferences' ).get( scope, featureName )` 9153 }); 9154 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 9155 }); 9156 9157 /** 9158 * Returns true if a modal is active, or false otherwise. 9159 * 9160 * @param {Object} state Global application state. 9161 * @param {string} modalName A string that uniquely identifies the modal. 9162 * 9163 * @return {boolean} Whether the modal is active. 9164 */ 9165 function isModalActive(state, modalName) { 9166 return state.activeModal === modalName; 9167 } 9168 9169 ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js 9170 /** 9171 * WordPress dependencies 9172 */ 9173 9174 function complementaryAreas(state = {}, action) { 9175 switch (action.type) { 9176 case 'SET_DEFAULT_COMPLEMENTARY_AREA': 9177 { 9178 const { 9179 scope, 9180 area 9181 } = action; 9182 9183 // If there's already an area, don't overwrite it. 9184 if (state[scope]) { 9185 return state; 9186 } 9187 return { 9188 ...state, 9189 [scope]: area 9190 }; 9191 } 9192 case 'ENABLE_COMPLEMENTARY_AREA': 9193 { 9194 const { 9195 scope, 9196 area 9197 } = action; 9198 return { 9199 ...state, 9200 [scope]: area 9201 }; 9202 } 9203 } 9204 return state; 9205 } 9206 9207 /** 9208 * Reducer for storing the name of the open modal, or null if no modal is open. 9209 * 9210 * @param {Object} state Previous state. 9211 * @param {Object} action Action object containing the `name` of the modal 9212 * 9213 * @return {Object} Updated state 9214 */ 9215 function activeModal(state = null, action) { 9216 switch (action.type) { 9217 case 'OPEN_MODAL': 9218 return action.name; 9219 case 'CLOSE_MODAL': 9220 return null; 9221 } 9222 return state; 9223 } 9224 /* harmony default export */ const build_module_store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 9225 complementaryAreas, 9226 activeModal 9227 })); 9228 9229 ;// ./node_modules/@wordpress/interface/build-module/store/constants.js 9230 /** 9231 * The identifier for the data store. 9232 * 9233 * @type {string} 9234 */ 9235 const constants_STORE_NAME = 'core/interface'; 9236 9237 ;// ./node_modules/@wordpress/interface/build-module/store/index.js 9238 /** 9239 * WordPress dependencies 9240 */ 9241 9242 9243 /** 9244 * Internal dependencies 9245 */ 9246 9247 9248 9249 9250 9251 /** 9252 * Store definition for the interface namespace. 9253 * 9254 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 9255 * 9256 * @type {Object} 9257 */ 9258 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 9259 reducer: build_module_store_reducer, 9260 actions: store_actions_namespaceObject, 9261 selectors: store_selectors_namespaceObject 9262 }); 9263 9264 // Once we build a more generic persistence plugin that works across types of stores 9265 // we'd be able to replace this with a register call. 9266 (0,external_wp_data_namespaceObject.register)(store); 9267 9268 ;// external ["wp","plugins"] 9269 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 9270 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js 9271 /** 9272 * WordPress dependencies 9273 */ 9274 9275 /* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 9276 return { 9277 icon: ownProps.icon || context.icon, 9278 identifier: ownProps.identifier || `$context.name}/$ownProps.name}` 9279 }; 9280 })); 9281 9282 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 9283 /** 9284 * WordPress dependencies 9285 */ 9286 9287 9288 9289 /** 9290 * Internal dependencies 9291 */ 9292 9293 9294 9295 /** 9296 * Whether the role supports checked state. 9297 * 9298 * @param {import('react').AriaRole} role Role. 9299 * @return {boolean} Whether the role supports checked state. 9300 * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked 9301 */ 9302 9303 function roleSupportsCheckedState(role) { 9304 return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role); 9305 } 9306 function ComplementaryAreaToggle({ 9307 as = external_wp_components_namespaceObject.Button, 9308 scope, 9309 identifier, 9310 icon, 9311 selectedIcon, 9312 name, 9313 shortcut, 9314 ...props 9315 }) { 9316 const ComponentToUse = as; 9317 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); 9318 const { 9319 enableComplementaryArea, 9320 disableComplementaryArea 9321 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9322 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { 9323 icon: selectedIcon && isSelected ? selectedIcon : icon, 9324 "aria-controls": identifier.replace('/', ':') 9325 // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked 9326 , 9327 "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined, 9328 onClick: () => { 9329 if (isSelected) { 9330 disableComplementaryArea(scope); 9331 } else { 9332 enableComplementaryArea(scope, identifier); 9333 } 9334 }, 9335 shortcut: shortcut, 9336 ...props 9337 }); 9338 } 9339 /* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); 9340 9341 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 9342 /** 9343 * External dependencies 9344 */ 9345 9346 9347 /** 9348 * WordPress dependencies 9349 */ 9350 9351 9352 /** 9353 * Internal dependencies 9354 */ 9355 9356 9357 9358 9359 const ComplementaryAreaHeader = ({ 9360 smallScreenTitle, 9361 children, 9362 className, 9363 toggleButtonProps 9364 }) => { 9365 const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 9366 icon: close_small, 9367 ...toggleButtonProps 9368 }); 9369 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9370 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9371 className: "components-panel__header interface-complementary-area-header__small", 9372 children: [smallScreenTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 9373 className: "interface-complementary-area-header__small-title", 9374 children: smallScreenTitle 9375 }), toggleButton] 9376 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9377 className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className), 9378 tabIndex: -1, 9379 children: [children, toggleButton] 9380 })] 9381 }); 9382 }; 9383 /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); 9384 9385 ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 9386 /** 9387 * WordPress dependencies 9388 */ 9389 9390 9391 9392 const noop = () => {}; 9393 function ActionItemSlot({ 9394 name, 9395 as: Component = external_wp_components_namespaceObject.ButtonGroup, 9396 fillProps = {}, 9397 bubblesVirtually, 9398 ...props 9399 }) { 9400 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 9401 name: name, 9402 bubblesVirtually: bubblesVirtually, 9403 fillProps: fillProps, 9404 children: fills => { 9405 if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { 9406 return null; 9407 } 9408 9409 // Special handling exists for backward compatibility. 9410 // It ensures that menu items created by plugin authors aren't 9411 // duplicated with automatically injected menu items coming 9412 // from pinnable plugin sidebars. 9413 // @see https://github.com/WordPress/gutenberg/issues/14457 9414 const initializedByPlugins = []; 9415 external_wp_element_namespaceObject.Children.forEach(fills, ({ 9416 props: { 9417 __unstableExplicitMenuItem, 9418 __unstableTarget 9419 } 9420 }) => { 9421 if (__unstableTarget && __unstableExplicitMenuItem) { 9422 initializedByPlugins.push(__unstableTarget); 9423 } 9424 }); 9425 const children = external_wp_element_namespaceObject.Children.map(fills, child => { 9426 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { 9427 return null; 9428 } 9429 return child; 9430 }); 9431 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 9432 ...props, 9433 children: children 9434 }); 9435 } 9436 }); 9437 } 9438 function ActionItem({ 9439 name, 9440 as: Component = external_wp_components_namespaceObject.Button, 9441 onClick, 9442 ...props 9443 }) { 9444 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 9445 name: name, 9446 children: ({ 9447 onClick: fpOnClick 9448 }) => { 9449 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { 9450 onClick: onClick || fpOnClick ? (...args) => { 9451 (onClick || noop)(...args); 9452 (fpOnClick || noop)(...args); 9453 } : undefined, 9454 ...props 9455 }); 9456 } 9457 }); 9458 } 9459 ActionItem.Slot = ActionItemSlot; 9460 /* harmony default export */ const action_item = (ActionItem); 9461 9462 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 9463 /** 9464 * WordPress dependencies 9465 */ 9466 9467 9468 9469 /** 9470 * Internal dependencies 9471 */ 9472 9473 9474 9475 const PluginsMenuItem = ({ 9476 // Menu item is marked with unstable prop for backward compatibility. 9477 // They are removed so they don't leak to DOM elements. 9478 // @see https://github.com/WordPress/gutenberg/issues/14457 9479 __unstableExplicitMenuItem, 9480 __unstableTarget, 9481 ...restProps 9482 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 9483 ...restProps 9484 }); 9485 function ComplementaryAreaMoreMenuItem({ 9486 scope, 9487 target, 9488 __unstableExplicitMenuItem, 9489 ...props 9490 }) { 9491 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 9492 as: toggleProps => { 9493 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { 9494 __unstableExplicitMenuItem: __unstableExplicitMenuItem, 9495 __unstableTarget: `$scope}/$target}`, 9496 as: PluginsMenuItem, 9497 name: `$scope}/plugin-more-menu`, 9498 ...toggleProps 9499 }); 9500 }, 9501 role: "menuitemcheckbox", 9502 selectedIcon: library_check, 9503 name: target, 9504 scope: scope, 9505 ...props 9506 }); 9507 } 9508 9509 ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 9510 /** 9511 * External dependencies 9512 */ 9513 9514 9515 /** 9516 * WordPress dependencies 9517 */ 9518 9519 9520 function PinnedItems({ 9521 scope, 9522 ...props 9523 }) { 9524 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 9525 name: `PinnedItems/$scope}`, 9526 ...props 9527 }); 9528 } 9529 function PinnedItemsSlot({ 9530 scope, 9531 className, 9532 ...props 9533 }) { 9534 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 9535 name: `PinnedItems/$scope}`, 9536 ...props, 9537 children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9538 className: dist_clsx(className, 'interface-pinned-items'), 9539 children: fills 9540 }) 9541 }); 9542 } 9543 PinnedItems.Slot = PinnedItemsSlot; 9544 /* harmony default export */ const pinned_items = (PinnedItems); 9545 9546 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 9547 /** 9548 * External dependencies 9549 */ 9550 9551 9552 /** 9553 * WordPress dependencies 9554 */ 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 /** 9565 * Internal dependencies 9566 */ 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 const ANIMATION_DURATION = 0.3; 9577 function ComplementaryAreaSlot({ 9578 scope, 9579 ...props 9580 }) { 9581 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { 9582 name: `ComplementaryArea/$scope}`, 9583 ...props 9584 }); 9585 } 9586 const SIDEBAR_WIDTH = 280; 9587 const variants = { 9588 open: { 9589 width: SIDEBAR_WIDTH 9590 }, 9591 closed: { 9592 width: 0 9593 }, 9594 mobileOpen: { 9595 width: '100vw' 9596 } 9597 }; 9598 function ComplementaryAreaFill({ 9599 activeArea, 9600 isActive, 9601 scope, 9602 children, 9603 className, 9604 id 9605 }) { 9606 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9607 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 9608 // This is used to delay the exit animation to the next tick. 9609 // The reason this is done is to allow us to apply the right transition properties 9610 // When we switch from an open sidebar to another open sidebar. 9611 // we don't want to animate in this case. 9612 const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); 9613 const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); 9614 const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); 9615 (0,external_wp_element_namespaceObject.useEffect)(() => { 9616 setState({}); 9617 }, [isActive]); 9618 const transition = { 9619 type: 'tween', 9620 duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, 9621 ease: [0.6, 0, 0.4, 1] 9622 }; 9623 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { 9624 name: `ComplementaryArea/$scope}`, 9625 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 9626 initial: false, 9627 children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 9628 variants: variants, 9629 initial: "closed", 9630 animate: isMobileViewport ? 'mobileOpen' : 'open', 9631 exit: "closed", 9632 transition: transition, 9633 className: "interface-complementary-area__fill", 9634 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 9635 id: id, 9636 className: className, 9637 style: { 9638 width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH 9639 }, 9640 children: children 9641 }) 9642 }) 9643 }) 9644 }); 9645 } 9646 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 9647 const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 9648 const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 9649 const { 9650 enableComplementaryArea, 9651 disableComplementaryArea 9652 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9653 (0,external_wp_element_namespaceObject.useEffect)(() => { 9654 // If the complementary area is active and the editor is switching from 9655 // a big to a small window size. 9656 if (isActive && isSmall && !previousIsSmallRef.current) { 9657 disableComplementaryArea(scope); 9658 // Flag the complementary area to be reopened when the window size 9659 // goes from small to big. 9660 shouldOpenWhenNotSmallRef.current = true; 9661 } else if ( 9662 // If there is a flag indicating the complementary area should be 9663 // enabled when we go from small to big window size and we are going 9664 // from a small to big window size. 9665 shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) { 9666 // Remove the flag indicating the complementary area should be 9667 // enabled. 9668 shouldOpenWhenNotSmallRef.current = false; 9669 enableComplementaryArea(scope, identifier); 9670 } else if ( 9671 // If the flag is indicating the current complementary should be 9672 // reopened but another complementary area becomes active, remove 9673 // the flag. 9674 shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) { 9675 shouldOpenWhenNotSmallRef.current = false; 9676 } 9677 if (isSmall !== previousIsSmallRef.current) { 9678 previousIsSmallRef.current = isSmall; 9679 } 9680 }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); 9681 } 9682 function ComplementaryArea({ 9683 children, 9684 className, 9685 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), 9686 identifier, 9687 header, 9688 headerClassName, 9689 icon, 9690 isPinnable = true, 9691 panelClassName, 9692 scope, 9693 name, 9694 smallScreenTitle, 9695 title, 9696 toggleShortcut, 9697 isActiveByDefault 9698 }) { 9699 // This state is used to delay the rendering of the Fill 9700 // until the initial effect runs. 9701 // This prevents the animation from running on mount if 9702 // the complementary area is active by default. 9703 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); 9704 const { 9705 isLoading, 9706 isActive, 9707 isPinned, 9708 activeArea, 9709 isSmall, 9710 isLarge, 9711 showIconLabels 9712 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 9713 const { 9714 getActiveComplementaryArea, 9715 isComplementaryAreaLoading, 9716 isItemPinned 9717 } = select(store); 9718 const { 9719 get 9720 } = select(external_wp_preferences_namespaceObject.store); 9721 const _activeArea = getActiveComplementaryArea(scope); 9722 return { 9723 isLoading: isComplementaryAreaLoading(scope), 9724 isActive: _activeArea === identifier, 9725 isPinned: isItemPinned(scope, identifier), 9726 activeArea: _activeArea, 9727 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), 9728 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), 9729 showIconLabels: get('core', 'showIconLabels') 9730 }; 9731 }, [identifier, scope]); 9732 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); 9733 const { 9734 enableComplementaryArea, 9735 disableComplementaryArea, 9736 pinItem, 9737 unpinItem 9738 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9739 (0,external_wp_element_namespaceObject.useEffect)(() => { 9740 // Set initial visibility: For large screens, enable if it's active by 9741 // default. For small screens, always initially disable. 9742 if (isActiveByDefault && activeArea === undefined && !isSmall) { 9743 enableComplementaryArea(scope, identifier); 9744 } else if (activeArea === undefined && isSmall) { 9745 disableComplementaryArea(scope, identifier); 9746 } 9747 setIsReady(true); 9748 }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); 9749 if (!isReady) { 9750 return; 9751 } 9752 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9753 children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, { 9754 scope: scope, 9755 children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, { 9756 scope: scope, 9757 identifier: identifier, 9758 isPressed: isActive && (!showIconLabels || isLarge), 9759 "aria-expanded": isActive, 9760 "aria-disabled": isLoading, 9761 label: title, 9762 icon: showIconLabels ? library_check : icon, 9763 showTooltip: !showIconLabels, 9764 variant: showIconLabels ? 'tertiary' : undefined, 9765 size: "compact", 9766 shortcut: toggleShortcut 9767 }) 9768 }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { 9769 target: name, 9770 scope: scope, 9771 icon: icon, 9772 children: title 9773 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, { 9774 activeArea: activeArea, 9775 isActive: isActive, 9776 className: dist_clsx('interface-complementary-area', className), 9777 scope: scope, 9778 id: identifier.replace('/', ':'), 9779 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, { 9780 className: headerClassName, 9781 closeLabel: closeLabel, 9782 onClose: () => disableComplementaryArea(scope), 9783 smallScreenTitle: smallScreenTitle, 9784 toggleButtonProps: { 9785 label: closeLabel, 9786 size: 'small', 9787 shortcut: toggleShortcut, 9788 scope, 9789 identifier 9790 }, 9791 children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 9792 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 9793 className: "interface-complementary-area-header__title", 9794 children: title 9795 }), isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 9796 className: "interface-complementary-area__pin-unpin-item", 9797 icon: isPinned ? star_filled : star_empty, 9798 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), 9799 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), 9800 isPressed: isPinned, 9801 "aria-expanded": isPinned, 9802 size: "compact" 9803 })] 9804 }) 9805 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { 9806 className: panelClassName, 9807 children: children 9808 })] 9809 })] 9810 }); 9811 } 9812 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); 9813 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; 9814 /* harmony default export */ const complementary_area = (ComplementaryAreaWrapped); 9815 9816 ;// ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js 9817 /** 9818 * WordPress dependencies 9819 */ 9820 9821 const FullscreenMode = ({ 9822 isActive 9823 }) => { 9824 (0,external_wp_element_namespaceObject.useEffect)(() => { 9825 let isSticky = false; 9826 // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes 9827 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled 9828 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as 9829 // a consequence of the FullscreenMode setup. 9830 if (document.body.classList.contains('sticky-menu')) { 9831 isSticky = true; 9832 document.body.classList.remove('sticky-menu'); 9833 } 9834 return () => { 9835 if (isSticky) { 9836 document.body.classList.add('sticky-menu'); 9837 } 9838 }; 9839 }, []); 9840 (0,external_wp_element_namespaceObject.useEffect)(() => { 9841 if (isActive) { 9842 document.body.classList.add('is-fullscreen-mode'); 9843 } else { 9844 document.body.classList.remove('is-fullscreen-mode'); 9845 } 9846 return () => { 9847 if (isActive) { 9848 document.body.classList.remove('is-fullscreen-mode'); 9849 } 9850 }; 9851 }, [isActive]); 9852 return null; 9853 }; 9854 /* harmony default export */ const fullscreen_mode = (FullscreenMode); 9855 9856 ;// ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js 9857 /** 9858 * WordPress dependencies 9859 */ 9860 9861 9862 /** 9863 * External dependencies 9864 */ 9865 9866 9867 const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)(({ 9868 children, 9869 className, 9870 ariaLabel, 9871 as: Tag = 'div', 9872 ...props 9873 }, ref) => { 9874 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { 9875 ref: ref, 9876 className: dist_clsx('interface-navigable-region', className), 9877 "aria-label": ariaLabel, 9878 role: "region", 9879 tabIndex: "-1", 9880 ...props, 9881 children: children 9882 }); 9883 }); 9884 NavigableRegion.displayName = 'NavigableRegion'; 9885 /* harmony default export */ const navigable_region = (NavigableRegion); 9886 9887 ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 9888 /** 9889 * External dependencies 9890 */ 9891 9892 9893 /** 9894 * WordPress dependencies 9895 */ 9896 9897 9898 9899 9900 9901 /** 9902 * Internal dependencies 9903 */ 9904 9905 9906 9907 const interface_skeleton_ANIMATION_DURATION = 0.25; 9908 const commonTransition = { 9909 type: 'tween', 9910 duration: interface_skeleton_ANIMATION_DURATION, 9911 ease: [0.6, 0, 0.4, 1] 9912 }; 9913 function useHTMLClass(className) { 9914 (0,external_wp_element_namespaceObject.useEffect)(() => { 9915 const element = document && document.querySelector(`html:not(.$className})`); 9916 if (!element) { 9917 return; 9918 } 9919 element.classList.toggle(className); 9920 return () => { 9921 element.classList.toggle(className); 9922 }; 9923 }, [className]); 9924 } 9925 const headerVariants = { 9926 hidden: { 9927 opacity: 1, 9928 marginTop: -60 9929 }, 9930 visible: { 9931 opacity: 1, 9932 marginTop: 0 9933 }, 9934 distractionFreeHover: { 9935 opacity: 1, 9936 marginTop: 0, 9937 transition: { 9938 ...commonTransition, 9939 delay: 0.2, 9940 delayChildren: 0.2 9941 } 9942 }, 9943 distractionFreeHidden: { 9944 opacity: 0, 9945 marginTop: -60 9946 }, 9947 distractionFreeDisabled: { 9948 opacity: 0, 9949 marginTop: 0, 9950 transition: { 9951 ...commonTransition, 9952 delay: 0.8, 9953 delayChildren: 0.8 9954 } 9955 } 9956 }; 9957 function InterfaceSkeleton({ 9958 isDistractionFree, 9959 footer, 9960 header, 9961 editorNotices, 9962 sidebar, 9963 secondarySidebar, 9964 content, 9965 actions, 9966 labels, 9967 className 9968 }, ref) { 9969 const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 9970 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 9971 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9972 const defaultTransition = { 9973 type: 'tween', 9974 duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, 9975 ease: [0.6, 0, 0.4, 1] 9976 }; 9977 useHTMLClass('interface-interface-skeleton__html-container'); 9978 const defaultLabels = { 9979 /* translators: accessibility text for the top bar landmark region. */ 9980 header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), 9981 /* translators: accessibility text for the content landmark region. */ 9982 body: (0,external_wp_i18n_namespaceObject.__)('Content'), 9983 /* translators: accessibility text for the secondary sidebar landmark region. */ 9984 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), 9985 /* translators: accessibility text for the settings landmark region. */ 9986 sidebar: (0,external_wp_i18n_namespaceObject._x)('Settings', 'settings landmark area'), 9987 /* translators: accessibility text for the publish landmark region. */ 9988 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), 9989 /* translators: accessibility text for the footer landmark region. */ 9990 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') 9991 }; 9992 const mergedLabels = { 9993 ...defaultLabels, 9994 ...labels 9995 }; 9996 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 9997 ref: ref, 9998 className: dist_clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'), 9999 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10000 className: "interface-interface-skeleton__editor", 10001 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 10002 initial: false, 10003 children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10004 as: external_wp_components_namespaceObject.__unstableMotion.div, 10005 className: "interface-interface-skeleton__header", 10006 "aria-label": mergedLabels.header, 10007 initial: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', 10008 whileHover: isDistractionFree && !isMobileViewport ? 'distractionFreeHover' : 'visible', 10009 animate: isDistractionFree && !isMobileViewport ? 'distractionFreeDisabled' : 'visible', 10010 exit: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', 10011 variants: headerVariants, 10012 transition: defaultTransition, 10013 children: header 10014 }) 10015 }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10016 className: "interface-interface-skeleton__header", 10017 children: editorNotices 10018 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10019 className: "interface-interface-skeleton__body", 10020 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 10021 initial: false, 10022 children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10023 className: "interface-interface-skeleton__secondary-sidebar", 10024 ariaLabel: mergedLabels.secondarySidebar, 10025 as: external_wp_components_namespaceObject.__unstableMotion.div, 10026 initial: "closed", 10027 animate: "open", 10028 exit: "closed", 10029 variants: { 10030 open: { 10031 width: secondarySidebarSize.width 10032 }, 10033 closed: { 10034 width: 0 10035 } 10036 }, 10037 transition: defaultTransition, 10038 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 10039 style: { 10040 position: 'absolute', 10041 width: isMobileViewport ? '100vw' : 'fit-content', 10042 height: '100%', 10043 left: 0 10044 }, 10045 variants: { 10046 open: { 10047 x: 0 10048 }, 10049 closed: { 10050 x: '-100%' 10051 } 10052 }, 10053 transition: defaultTransition, 10054 children: [secondarySidebarResizeListener, secondarySidebar] 10055 }) 10056 }) 10057 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10058 className: "interface-interface-skeleton__content", 10059 ariaLabel: mergedLabels.body, 10060 children: content 10061 }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10062 className: "interface-interface-skeleton__sidebar", 10063 ariaLabel: mergedLabels.sidebar, 10064 children: sidebar 10065 }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10066 className: "interface-interface-skeleton__actions", 10067 ariaLabel: mergedLabels.actions, 10068 children: actions 10069 })] 10070 })] 10071 }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { 10072 className: "interface-interface-skeleton__footer", 10073 ariaLabel: mergedLabels.footer, 10074 children: footer 10075 })] 10076 }); 10077 } 10078 /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); 10079 10080 ;// ./node_modules/@wordpress/interface/build-module/components/index.js 10081 10082 10083 10084 10085 10086 10087 10088 10089 ;// ./node_modules/@wordpress/interface/build-module/index.js 10090 10091 10092 10093 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js 10094 /** 10095 * WordPress dependencies 10096 */ 10097 10098 10099 10100 10101 10102 /** 10103 * Internal dependencies 10104 */ 10105 10106 10107 /** 10108 * Handles the keyboard shortcuts for the editor. 10109 * 10110 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 10111 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 10112 * and toggling the sidebar. 10113 */ 10114 function EditorKeyboardShortcuts() { 10115 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { 10116 const { 10117 richEditingEnabled, 10118 codeEditingEnabled 10119 } = select(store_store).getEditorSettings(); 10120 return !richEditingEnabled || !codeEditingEnabled; 10121 }, []); 10122 const { 10123 getBlockSelectionStart 10124 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 10125 const { 10126 getActiveComplementaryArea 10127 } = (0,external_wp_data_namespaceObject.useSelect)(store); 10128 const { 10129 enableComplementaryArea, 10130 disableComplementaryArea 10131 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10132 const { 10133 redo, 10134 undo, 10135 savePost, 10136 setIsListViewOpened, 10137 switchEditorMode, 10138 toggleDistractionFree 10139 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 10140 const { 10141 isEditedPostDirty, 10142 isPostSavingLocked, 10143 isListViewOpened, 10144 getEditorMode 10145 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 10146 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => { 10147 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); 10148 }, { 10149 isDisabled: isModeToggleDisabled 10150 }); 10151 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => { 10152 toggleDistractionFree(); 10153 }); 10154 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { 10155 undo(); 10156 event.preventDefault(); 10157 }); 10158 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { 10159 redo(); 10160 event.preventDefault(); 10161 }); 10162 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { 10163 event.preventDefault(); 10164 10165 /** 10166 * Do not save the post if post saving is locked. 10167 */ 10168 if (isPostSavingLocked()) { 10169 return; 10170 } 10171 10172 // TODO: This should be handled in the `savePost` effect in 10173 // considering `isSaveable`. See note on `isEditedPostSaveable` 10174 // selector about dirtiness and meta-boxes. 10175 // 10176 // See: `isEditedPostSaveable` 10177 if (!isEditedPostDirty()) { 10178 return; 10179 } 10180 savePost(); 10181 }); 10182 10183 // Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar. 10184 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', event => { 10185 if (!isListViewOpened()) { 10186 event.preventDefault(); 10187 setIsListViewOpened(true); 10188 } 10189 }); 10190 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => { 10191 // This shortcut has no known clashes, but use preventDefault to prevent any 10192 // obscure shortcuts from triggering. 10193 event.preventDefault(); 10194 const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core')); 10195 if (isEditorSidebarOpened) { 10196 disableComplementaryArea('core'); 10197 } else { 10198 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; 10199 enableComplementaryArea('core', sidebarToOpen); 10200 } 10201 }); 10202 return null; 10203 } 10204 10205 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 10206 10207 10208 ;// ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 10209 /** 10210 * WordPress dependencies 10211 */ 10212 10213 10214 10215 10216 10217 /** 10218 * Internal dependencies 10219 */ 10220 10221 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { 10222 constructor(props) { 10223 super(props); 10224 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 10225 } 10226 componentDidMount() { 10227 if (!this.props.disableIntervalChecks) { 10228 this.setAutosaveTimer(); 10229 } 10230 } 10231 componentDidUpdate(prevProps) { 10232 if (this.props.disableIntervalChecks) { 10233 if (this.props.editsReference !== prevProps.editsReference) { 10234 this.props.autosave(); 10235 } 10236 return; 10237 } 10238 if (this.props.interval !== prevProps.interval) { 10239 clearTimeout(this.timerId); 10240 this.setAutosaveTimer(); 10241 } 10242 if (!this.props.isDirty) { 10243 this.needsAutosave = false; 10244 return; 10245 } 10246 if (this.props.isAutosaving && !prevProps.isAutosaving) { 10247 this.needsAutosave = false; 10248 return; 10249 } 10250 if (this.props.editsReference !== prevProps.editsReference) { 10251 this.needsAutosave = true; 10252 } 10253 } 10254 componentWillUnmount() { 10255 clearTimeout(this.timerId); 10256 } 10257 setAutosaveTimer(timeout = this.props.interval * 1000) { 10258 this.timerId = setTimeout(() => { 10259 this.autosaveTimerHandler(); 10260 }, timeout); 10261 } 10262 autosaveTimerHandler() { 10263 if (!this.props.isAutosaveable) { 10264 this.setAutosaveTimer(1000); 10265 return; 10266 } 10267 if (this.needsAutosave) { 10268 this.needsAutosave = false; 10269 this.props.autosave(); 10270 } 10271 this.setAutosaveTimer(); 10272 } 10273 render() { 10274 return null; 10275 } 10276 } 10277 10278 /** 10279 * Monitors the changes made to the edited post and triggers autosave if necessary. 10280 * 10281 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. 10282 * 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 10283 * the specific way of detecting changes. 10284 * 10285 * There are two caveats: 10286 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. 10287 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. 10288 * 10289 * @param {Object} props - The properties passed to the component. 10290 * @param {Function} props.autosave - The function to call when changes need to be saved. 10291 * @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave. 10292 * @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second. 10293 * @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`. 10294 * @param {boolean} props.isDirty - Indicates if there are unsaved changes. 10295 * 10296 * @example 10297 * ```jsx 10298 * <AutosaveMonitor interval={30000} /> 10299 * ``` 10300 */ 10301 /* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { 10302 const { 10303 getReferenceByDistinctEdits 10304 } = select(external_wp_coreData_namespaceObject.store); 10305 const { 10306 isEditedPostDirty, 10307 isEditedPostAutosaveable, 10308 isAutosavingPost, 10309 getEditorSettings 10310 } = select(store_store); 10311 const { 10312 interval = getEditorSettings().autosaveInterval 10313 } = ownProps; 10314 return { 10315 editsReference: getReferenceByDistinctEdits(), 10316 isDirty: isEditedPostDirty(), 10317 isAutosaveable: isEditedPostAutosaveable(), 10318 isAutosaving: isAutosavingPost(), 10319 interval 10320 }; 10321 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ 10322 autosave() { 10323 const { 10324 autosave = dispatch(store_store).autosave 10325 } = ownProps; 10326 autosave(); 10327 } 10328 }))])(AutosaveMonitor)); 10329 10330 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 10331 /** 10332 * WordPress dependencies 10333 */ 10334 10335 10336 const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10337 xmlns: "http://www.w3.org/2000/svg", 10338 viewBox: "0 0 24 24", 10339 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10340 d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" 10341 }) 10342 }); 10343 /* harmony default export */ const chevron_right_small = (chevronRightSmall); 10344 10345 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 10346 /** 10347 * WordPress dependencies 10348 */ 10349 10350 10351 const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10352 xmlns: "http://www.w3.org/2000/svg", 10353 viewBox: "0 0 24 24", 10354 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10355 d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" 10356 }) 10357 }); 10358 /* harmony default export */ const chevron_left_small = (chevronLeftSmall); 10359 10360 ;// external ["wp","keycodes"] 10361 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 10362 ;// external ["wp","commands"] 10363 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 10364 ;// ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js 10365 /** 10366 * External dependencies 10367 */ 10368 10369 10370 /** 10371 * WordPress dependencies 10372 */ 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 /** 10386 * Internal dependencies 10387 */ 10388 10389 10390 10391 /** @typedef {import("@wordpress/components").IconType} IconType */ 10392 10393 10394 const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button); 10395 10396 /** 10397 * This component renders a navigation bar at the top of the editor. It displays the title of the current document, 10398 * a back button (if applicable), and a command center button. It also handles different states of the document, 10399 * such as "not found" or "unsynced". 10400 * 10401 * @example 10402 * ```jsx 10403 * <DocumentBar /> 10404 * ``` 10405 * @param {Object} props The component props. 10406 * @param {string} props.title A title for the document, defaulting to the document or 10407 * template title currently being edited. 10408 * @param {IconType} props.icon An icon for the document, no default. 10409 * (A default icon indicating the document post type is no longer used.) 10410 * 10411 * @return {JSX.Element} The rendered DocumentBar component. 10412 */ 10413 function DocumentBar(props) { 10414 const { 10415 postType, 10416 postTypeLabel, 10417 documentTitle, 10418 isNotFound, 10419 isUnsyncedPattern, 10420 templateTitle, 10421 onNavigateToPreviousEntityRecord 10422 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10423 const { 10424 getCurrentPostType, 10425 getCurrentPostId, 10426 getEditorSettings, 10427 __experimentalGetTemplateInfo: getTemplateInfo 10428 } = select(store_store); 10429 const { 10430 getEditedEntityRecord, 10431 getPostType, 10432 isResolving: isResolvingSelector 10433 } = select(external_wp_coreData_namespaceObject.store); 10434 const _postType = getCurrentPostType(); 10435 const _postId = getCurrentPostId(); 10436 const _document = getEditedEntityRecord('postType', _postType, _postId); 10437 const _templateInfo = getTemplateInfo(_document); 10438 const _postTypeLabel = getPostType(_postType)?.labels?.singular_name; 10439 return { 10440 postType: _postType, 10441 postTypeLabel: _postTypeLabel, 10442 documentTitle: _document.title, 10443 isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId), 10444 isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced', 10445 templateTitle: _templateInfo.title, 10446 onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord 10447 }; 10448 }, []); 10449 const { 10450 open: openCommandCenter 10451 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 10452 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 10453 const isTemplate = TEMPLATE_POST_TYPES.includes(postType); 10454 const isGlobalEntity = GLOBAL_POST_TYPES.includes(postType); 10455 const hasBackButton = !!onNavigateToPreviousEntityRecord; 10456 const entityTitle = isTemplate ? templateTitle : documentTitle; 10457 const title = props.title || entityTitle; 10458 const icon = props.icon; 10459 const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); 10460 (0,external_wp_element_namespaceObject.useEffect)(() => { 10461 mountedRef.current = true; 10462 }, []); 10463 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10464 className: dist_clsx('editor-document-bar', { 10465 'has-back-button': hasBackButton, 10466 'is-global': isGlobalEntity && !isUnsyncedPattern 10467 }), 10468 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 10469 children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, { 10470 className: "editor-document-bar__back", 10471 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small, 10472 onClick: event => { 10473 event.stopPropagation(); 10474 onNavigateToPreviousEntityRecord(); 10475 }, 10476 size: "compact", 10477 initial: mountedRef.current ? { 10478 opacity: 0, 10479 transform: 'translateX(15%)' 10480 } : false // Don't show entry animation when DocumentBar mounts. 10481 , 10482 animate: { 10483 opacity: 1, 10484 transform: 'translateX(0%)' 10485 }, 10486 exit: { 10487 opacity: 0, 10488 transform: 'translateX(15%)' 10489 }, 10490 transition: isReducedMotion ? { 10491 duration: 0 10492 } : undefined, 10493 children: (0,external_wp_i18n_namespaceObject.__)('Back') 10494 }) 10495 }), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 10496 children: (0,external_wp_i18n_namespaceObject.__)('Document not found') 10497 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 10498 className: "editor-document-bar__command", 10499 onClick: () => openCommandCenter(), 10500 size: "compact", 10501 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 10502 className: "editor-document-bar__title" 10503 // Force entry animation when the back button is added or removed. 10504 , 10505 10506 initial: mountedRef.current ? { 10507 opacity: 0, 10508 transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)' 10509 } : false // Don't show entry animation when DocumentBar mounts. 10510 , 10511 animate: { 10512 opacity: 1, 10513 transform: 'translateX(0%)' 10514 }, 10515 transition: isReducedMotion ? { 10516 duration: 0 10517 } : undefined, 10518 children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 10519 icon: icon 10520 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { 10521 size: "body", 10522 as: "h1", 10523 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10524 className: "editor-document-bar__post-title", 10525 children: title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No title') 10526 }), postTypeLabel && !props.title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10527 className: "editor-document-bar__post-type-label", 10528 children: '· ' + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTypeLabel) 10529 })] 10530 })] 10531 }, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10532 className: "editor-document-bar__shortcut", 10533 children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k') 10534 })] 10535 })] 10536 }); 10537 } 10538 10539 ;// external ["wp","richText"] 10540 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 10541 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 10542 /** 10543 * External dependencies 10544 */ 10545 10546 10547 10548 const TableOfContentsItem = ({ 10549 children, 10550 isValid, 10551 level, 10552 href, 10553 onSelect 10554 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 10555 className: dist_clsx('document-outline__item', `is-$level.toLowerCase()}`, { 10556 'is-invalid': !isValid 10557 }), 10558 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", { 10559 href: href, 10560 className: "document-outline__button", 10561 onClick: onSelect, 10562 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10563 className: "document-outline__emdash", 10564 "aria-hidden": "true" 10565 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 10566 className: "document-outline__level", 10567 children: level 10568 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 10569 className: "document-outline__item-content", 10570 children: children 10571 })] 10572 }) 10573 }); 10574 /* harmony default export */ const document_outline_item = (TableOfContentsItem); 10575 10576 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 10577 /** 10578 * WordPress dependencies 10579 */ 10580 10581 10582 10583 10584 10585 10586 10587 /** 10588 * Internal dependencies 10589 */ 10590 10591 10592 10593 /** 10594 * Module constants 10595 */ 10596 10597 10598 const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 10599 children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)') 10600 }); 10601 const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 10602 children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)') 10603 }, "incorrect-message")]; 10604 const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 10605 children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)') 10606 }, "incorrect-message-h1")]; 10607 const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { 10608 children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)') 10609 }, "incorrect-message-multiple-h1")]; 10610 function EmptyOutlineIllustration() { 10611 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { 10612 width: "138", 10613 height: "148", 10614 viewBox: "0 0 138 148", 10615 fill: "none", 10616 xmlns: "http://www.w3.org/2000/svg", 10617 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 10618 width: "138", 10619 height: "148", 10620 rx: "4", 10621 fill: "#F0F6FC" 10622 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 10623 x1: "44", 10624 y1: "28", 10625 x2: "24", 10626 y2: "28", 10627 stroke: "#DDDDDD" 10628 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 10629 x: "48", 10630 y: "16", 10631 width: "27", 10632 height: "23", 10633 rx: "4", 10634 fill: "#DDDDDD" 10635 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 10636 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", 10637 fill: "black" 10638 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 10639 x1: "55", 10640 y1: "59", 10641 x2: "24", 10642 y2: "59", 10643 stroke: "#DDDDDD" 10644 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 10645 x: "59", 10646 y: "47", 10647 width: "29", 10648 height: "23", 10649 rx: "4", 10650 fill: "#DDDDDD" 10651 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 10652 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", 10653 fill: "black" 10654 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 10655 x1: "80", 10656 y1: "90", 10657 x2: "24", 10658 y2: "90", 10659 stroke: "#DDDDDD" 10660 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 10661 x: "84", 10662 y: "78", 10663 width: "30", 10664 height: "23", 10665 rx: "4", 10666 fill: "#F0B849" 10667 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 10668 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", 10669 fill: "black" 10670 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { 10671 x1: "66", 10672 y1: "121", 10673 x2: "24", 10674 y2: "121", 10675 stroke: "#DDDDDD" 10676 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { 10677 x: "70", 10678 y: "109", 10679 width: "29", 10680 height: "23", 10681 rx: "4", 10682 fill: "#DDDDDD" 10683 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 10684 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", 10685 fill: "black" 10686 })] 10687 }); 10688 } 10689 10690 /** 10691 * Returns an array of heading blocks enhanced with the following properties: 10692 * level - An integer with the heading level. 10693 * isEmpty - Flag indicating if the heading has no content. 10694 * 10695 * @param {?Array} blocks An array of blocks. 10696 * 10697 * @return {Array} An array of heading blocks enhanced with the properties described above. 10698 */ 10699 const computeOutlineHeadings = (blocks = []) => { 10700 return blocks.flatMap((block = {}) => { 10701 if (block.name === 'core/heading') { 10702 return { 10703 ...block, 10704 level: block.attributes.level, 10705 isEmpty: isEmptyHeading(block) 10706 }; 10707 } 10708 return computeOutlineHeadings(block.innerBlocks); 10709 }); 10710 }; 10711 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0; 10712 10713 /** 10714 * Renders a document outline component. 10715 * 10716 * @param {Object} props Props. 10717 * @param {Function} props.onSelect Function to be called when an outline item is selected. 10718 * @param {boolean} props.isTitleSupported Indicates whether the title is supported. 10719 * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled. 10720 * 10721 * @return {Component} The component to be rendered. 10722 */ 10723 function DocumentOutline({ 10724 onSelect, 10725 isTitleSupported, 10726 hasOutlineItemsDisabled 10727 }) { 10728 const { 10729 selectBlock 10730 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 10731 const { 10732 blocks, 10733 title 10734 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 10735 var _postType$supports$ti; 10736 const { 10737 getBlocks 10738 } = select(external_wp_blockEditor_namespaceObject.store); 10739 const { 10740 getEditedPostAttribute 10741 } = select(store_store); 10742 const { 10743 getPostType 10744 } = select(external_wp_coreData_namespaceObject.store); 10745 const postType = getPostType(getEditedPostAttribute('type')); 10746 return { 10747 title: getEditedPostAttribute('title'), 10748 blocks: getBlocks(), 10749 isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false 10750 }; 10751 }); 10752 const headings = computeOutlineHeadings(blocks); 10753 if (headings.length < 1) { 10754 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 10755 className: "editor-document-outline has-no-headings", 10756 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 10757 children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.') 10758 })] 10759 }); 10760 } 10761 let prevHeadingLevel = 1; 10762 10763 // Not great but it's the simplest way to locate the title right now. 10764 const titleNode = document.querySelector('.editor-post-title__input'); 10765 const hasTitle = isTitleSupported && title && titleNode; 10766 const countByLevel = headings.reduce((acc, heading) => ({ 10767 ...acc, 10768 [heading.level]: (acc[heading.level] || 0) + 1 10769 }), {}); 10770 const hasMultipleH1 = countByLevel[1] > 1; 10771 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 10772 className: "document-outline", 10773 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { 10774 children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, { 10775 level: (0,external_wp_i18n_namespaceObject.__)('Title'), 10776 isValid: true, 10777 onSelect: onSelect, 10778 href: `#$titleNode.id}`, 10779 isDisabled: hasOutlineItemsDisabled, 10780 children: title 10781 }), headings.map((item, index) => { 10782 // Headings remain the same, go up by one, or down by any amount. 10783 // Otherwise there are missing levels. 10784 const isIncorrectLevel = item.level > prevHeadingLevel + 1; 10785 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 10786 prevHeadingLevel = item.level; 10787 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, { 10788 level: `H$item.level}`, 10789 isValid: isValid, 10790 isDisabled: hasOutlineItemsDisabled, 10791 href: `#block-$item.clientId}`, 10792 onSelect: () => { 10793 selectBlock(item.clientId); 10794 onSelect?.(); 10795 }, 10796 children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ 10797 html: item.attributes.content 10798 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings] 10799 }, index); 10800 })] 10801 }) 10802 }); 10803 } 10804 10805 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 10806 /** 10807 * WordPress dependencies 10808 */ 10809 10810 10811 10812 /** 10813 * Component check if there are any headings (core/heading blocks) present in the document. 10814 * 10815 * @param {Object} props Props. 10816 * @param {Element} props.children Children to be rendered. 10817 * 10818 * @return {Component|null} The component to be rendered or null if there are headings. 10819 */ 10820 function DocumentOutlineCheck({ 10821 children 10822 }) { 10823 const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => { 10824 const { 10825 getGlobalBlockCount 10826 } = select(external_wp_blockEditor_namespaceObject.store); 10827 return getGlobalBlockCount('core/heading') > 0; 10828 }); 10829 if (hasHeadings) { 10830 return null; 10831 } 10832 return children; 10833 } 10834 10835 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 10836 /** 10837 * WordPress dependencies 10838 */ 10839 10840 10841 10842 10843 10844 10845 10846 /** 10847 * Component for registering editor keyboard shortcuts. 10848 * 10849 * @return {Element} The component to be rendered. 10850 */ 10851 10852 function EditorKeyboardShortcutsRegister() { 10853 // Registering the shortcuts. 10854 const { 10855 registerShortcut 10856 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 10857 (0,external_wp_element_namespaceObject.useEffect)(() => { 10858 registerShortcut({ 10859 name: 'core/editor/toggle-mode', 10860 category: 'global', 10861 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), 10862 keyCombination: { 10863 modifier: 'secondary', 10864 character: 'm' 10865 } 10866 }); 10867 registerShortcut({ 10868 name: 'core/editor/save', 10869 category: 'global', 10870 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), 10871 keyCombination: { 10872 modifier: 'primary', 10873 character: 's' 10874 } 10875 }); 10876 registerShortcut({ 10877 name: 'core/editor/undo', 10878 category: 'global', 10879 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), 10880 keyCombination: { 10881 modifier: 'primary', 10882 character: 'z' 10883 } 10884 }); 10885 registerShortcut({ 10886 name: 'core/editor/redo', 10887 category: 'global', 10888 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), 10889 keyCombination: { 10890 modifier: 'primaryShift', 10891 character: 'z' 10892 }, 10893 // Disable on Apple OS because it conflicts with the browser's 10894 // history shortcut. It's a fine alias for both Windows and Linux. 10895 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 10896 // Linux, we keep it as the default for consistency. 10897 aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ 10898 modifier: 'primary', 10899 character: 'y' 10900 }] 10901 }); 10902 registerShortcut({ 10903 name: 'core/editor/toggle-list-view', 10904 category: 'global', 10905 description: (0,external_wp_i18n_namespaceObject.__)('Open the List View.'), 10906 keyCombination: { 10907 modifier: 'access', 10908 character: 'o' 10909 } 10910 }); 10911 registerShortcut({ 10912 name: 'core/editor/toggle-distraction-free', 10913 category: 'global', 10914 description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'), 10915 keyCombination: { 10916 modifier: 'primaryShift', 10917 character: '\\' 10918 } 10919 }); 10920 registerShortcut({ 10921 name: 'core/editor/toggle-sidebar', 10922 category: 'global', 10923 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'), 10924 keyCombination: { 10925 modifier: 'primaryShift', 10926 character: ',' 10927 } 10928 }); 10929 registerShortcut({ 10930 name: 'core/editor/keyboard-shortcuts', 10931 category: 'main', 10932 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 10933 keyCombination: { 10934 modifier: 'access', 10935 character: 'h' 10936 } 10937 }); 10938 registerShortcut({ 10939 name: 'core/editor/next-region', 10940 category: 'global', 10941 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 10942 keyCombination: { 10943 modifier: 'ctrl', 10944 character: '`' 10945 }, 10946 aliases: [{ 10947 modifier: 'access', 10948 character: 'n' 10949 }] 10950 }); 10951 registerShortcut({ 10952 name: 'core/editor/previous-region', 10953 category: 'global', 10954 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 10955 keyCombination: { 10956 modifier: 'ctrlShift', 10957 character: '`' 10958 }, 10959 aliases: [{ 10960 modifier: 'access', 10961 character: 'p' 10962 }, { 10963 modifier: 'ctrlShift', 10964 character: '~' 10965 }] 10966 }); 10967 }, [registerShortcut]); 10968 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); 10969 } 10970 /* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister); 10971 10972 ;// ./node_modules/@wordpress/icons/build-module/library/redo.js 10973 /** 10974 * WordPress dependencies 10975 */ 10976 10977 10978 const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10979 xmlns: "http://www.w3.org/2000/svg", 10980 viewBox: "0 0 24 24", 10981 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10982 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" 10983 }) 10984 }); 10985 /* harmony default export */ const library_redo = (redo_redo); 10986 10987 ;// ./node_modules/@wordpress/icons/build-module/library/undo.js 10988 /** 10989 * WordPress dependencies 10990 */ 10991 10992 10993 const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 10994 xmlns: "http://www.w3.org/2000/svg", 10995 viewBox: "0 0 24 24", 10996 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 10997 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" 10998 }) 10999 }); 11000 /* harmony default export */ const library_undo = (undo_undo); 11001 11002 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 11003 /** 11004 * WordPress dependencies 11005 */ 11006 11007 11008 11009 11010 11011 11012 11013 /** 11014 * Internal dependencies 11015 */ 11016 11017 11018 function EditorHistoryRedo(props, ref) { 11019 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); 11020 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); 11021 const { 11022 redo 11023 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11024 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 11025 __next40pxDefaultSize: true, 11026 ...props, 11027 ref: ref, 11028 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo 11029 /* translators: button label text should, if possible, be under 16 characters. */, 11030 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), 11031 shortcut: shortcut 11032 // If there are no redo levels we don't want to actually disable this 11033 // button, because it will remove focus for keyboard users. 11034 // See: https://github.com/WordPress/gutenberg/issues/3486 11035 , 11036 "aria-disabled": !hasRedo, 11037 onClick: hasRedo ? redo : undefined, 11038 className: "editor-history__redo" 11039 }); 11040 } 11041 11042 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 11043 11044 /** 11045 * Renders the redo button for the editor history. 11046 * 11047 * @param {Object} props - Props. 11048 * @param {Ref} ref - Forwarded ref. 11049 * 11050 * @return {Component} The component to be rendered. 11051 */ 11052 /* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); 11053 11054 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 11055 /** 11056 * WordPress dependencies 11057 */ 11058 11059 11060 11061 11062 11063 11064 11065 /** 11066 * Internal dependencies 11067 */ 11068 11069 11070 function EditorHistoryUndo(props, ref) { 11071 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); 11072 const { 11073 undo 11074 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11075 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 11076 __next40pxDefaultSize: true, 11077 ...props, 11078 ref: ref, 11079 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo 11080 /* translators: button label text should, if possible, be under 16 characters. */, 11081 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 11082 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') 11083 // If there are no undo levels we don't want to actually disable this 11084 // button, because it will remove focus for keyboard users. 11085 // See: https://github.com/WordPress/gutenberg/issues/3486 11086 , 11087 "aria-disabled": !hasUndo, 11088 onClick: hasUndo ? undo : undefined, 11089 className: "editor-history__undo" 11090 }); 11091 } 11092 11093 /** @typedef {import('react').Ref<HTMLElement>} Ref */ 11094 11095 /** 11096 * Renders the undo button for the editor history. 11097 * 11098 * @param {Object} props - Props. 11099 * @param {Ref} ref - Forwarded ref. 11100 * 11101 * @return {Component} The component to be rendered. 11102 */ 11103 /* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); 11104 11105 ;// ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 11106 /** 11107 * WordPress dependencies 11108 */ 11109 11110 11111 11112 11113 11114 11115 11116 11117 function TemplateValidationNotice() { 11118 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 11119 const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => { 11120 return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); 11121 }, []); 11122 const { 11123 setTemplateValidity, 11124 synchronizeTemplate 11125 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 11126 if (isValid) { 11127 return null; 11128 } 11129 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11130 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 11131 className: "editor-template-validation-notice", 11132 isDismissible: false, 11133 status: "warning", 11134 actions: [{ 11135 label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), 11136 onClick: () => setTemplateValidity(true) 11137 }, { 11138 label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), 11139 onClick: () => setShowConfirmDialog(true) 11140 }], 11141 children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.') 11142 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 11143 isOpen: showConfirmDialog, 11144 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'), 11145 onConfirm: () => { 11146 setShowConfirmDialog(false); 11147 synchronizeTemplate(); 11148 }, 11149 onCancel: () => setShowConfirmDialog(false), 11150 size: "medium", 11151 children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?') 11152 })] 11153 }); 11154 } 11155 11156 ;// ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 11157 /** 11158 * WordPress dependencies 11159 */ 11160 11161 11162 11163 11164 /** 11165 * Internal dependencies 11166 */ 11167 11168 11169 /** 11170 * This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible 11171 * 11172 * @example 11173 * ```jsx 11174 * <EditorNotices /> 11175 * ``` 11176 * 11177 * @return {JSX.Element} The rendered EditorNotices component. 11178 */ 11179 11180 11181 11182 function EditorNotices() { 11183 const { 11184 notices 11185 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 11186 notices: select(external_wp_notices_namespaceObject.store).getNotices() 11187 }), []); 11188 const { 11189 removeNotice 11190 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 11191 const dismissibleNotices = notices.filter(({ 11192 isDismissible, 11193 type 11194 }) => isDismissible && type === 'default'); 11195 const nonDismissibleNotices = notices.filter(({ 11196 isDismissible, 11197 type 11198 }) => !isDismissible && type === 'default'); 11199 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11200 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 11201 notices: nonDismissibleNotices, 11202 className: "components-editor-notices__pinned" 11203 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { 11204 notices: dismissibleNotices, 11205 className: "components-editor-notices__dismissible", 11206 onRemove: removeNotice, 11207 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) 11208 })] 11209 }); 11210 } 11211 /* harmony default export */ const editor_notices = (EditorNotices); 11212 11213 ;// ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js 11214 /** 11215 * WordPress dependencies 11216 */ 11217 11218 11219 11220 11221 // Last three notices. Slices from the tail end of the list. 11222 11223 const MAX_VISIBLE_NOTICES = -3; 11224 11225 /** 11226 * Renders the editor snackbars component. 11227 * 11228 * @return {JSX.Element} The rendered component. 11229 */ 11230 function EditorSnackbars() { 11231 const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []); 11232 const { 11233 removeNotice 11234 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 11235 const snackbarNotices = notices.filter(({ 11236 type 11237 }) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES); 11238 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, { 11239 notices: snackbarNotices, 11240 className: "components-editor-notices__snackbar", 11241 onRemove: removeNotice 11242 }); 11243 } 11244 11245 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js 11246 /** 11247 * WordPress dependencies 11248 */ 11249 11250 11251 11252 11253 11254 11255 /** 11256 * Internal dependencies 11257 */ 11258 11259 11260 11261 11262 11263 function EntityRecordItem({ 11264 record, 11265 checked, 11266 onChange 11267 }) { 11268 const { 11269 name, 11270 kind, 11271 title, 11272 key 11273 } = record; 11274 11275 // Handle templates that might use default descriptive titles. 11276 const { 11277 entityRecordTitle, 11278 hasPostMetaChanges 11279 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11280 if ('postType' !== kind || 'wp_template' !== name) { 11281 return { 11282 entityRecordTitle: title, 11283 hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) 11284 }; 11285 } 11286 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); 11287 return { 11288 entityRecordTitle: select(store_store).__experimentalGetTemplateInfo(template).title, 11289 hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key) 11290 }; 11291 }, [name, kind, title, key]); 11292 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 11293 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 11294 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 11295 __nextHasNoMarginBottom: true, 11296 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'), 11297 checked: checked, 11298 onChange: onChange 11299 }) 11300 }), hasPostMetaChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 11301 className: "entities-saved-states__changes", 11302 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 11303 children: (0,external_wp_i18n_namespaceObject.__)('Post Meta.') 11304 }) 11305 })] 11306 }); 11307 } 11308 11309 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js 11310 /** 11311 * WordPress dependencies 11312 */ 11313 11314 11315 11316 11317 11318 11319 11320 /** 11321 * Internal dependencies 11322 */ 11323 11324 11325 11326 11327 const { 11328 getGlobalStylesChanges, 11329 GlobalStylesContext 11330 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11331 function getEntityDescription(entity, count) { 11332 switch (entity) { 11333 case 'site': 11334 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.'); 11335 case 'wp_template': 11336 return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.'); 11337 case 'page': 11338 case 'post': 11339 return (0,external_wp_i18n_namespaceObject.__)('The following has been modified.'); 11340 } 11341 } 11342 function GlobalStylesDescription({ 11343 record 11344 }) { 11345 const { 11346 user: currentEditorGlobalStyles 11347 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 11348 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]); 11349 const globalStylesChanges = getGlobalStylesChanges(currentEditorGlobalStyles, savedRecord, { 11350 maxResults: 10 11351 }); 11352 return globalStylesChanges.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 11353 className: "entities-saved-states__changes", 11354 children: globalStylesChanges.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 11355 children: change 11356 }, change)) 11357 }) : null; 11358 } 11359 function EntityDescription({ 11360 record, 11361 count 11362 }) { 11363 if ('globalStyles' === record?.name) { 11364 return null; 11365 } 11366 const description = getEntityDescription(record?.name, count); 11367 return description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 11368 children: description 11369 }) : null; 11370 } 11371 function EntityTypeList({ 11372 list, 11373 unselectedEntities, 11374 setUnselectedEntities 11375 }) { 11376 const count = list.length; 11377 const firstRecord = list[0]; 11378 const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); 11379 let entityLabel = entityConfig.label; 11380 if (firstRecord?.name === 'wp_template_part') { 11381 entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'); 11382 } 11383 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 11384 title: entityLabel, 11385 initialOpen: true, 11386 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, { 11387 record: firstRecord, 11388 count: count 11389 }), list.map(record => { 11390 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, { 11391 record: record, 11392 checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), 11393 onChange: value => setUnselectedEntities(record, value) 11394 }, record.key || record.property); 11395 }), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, { 11396 record: firstRecord 11397 })] 11398 }); 11399 } 11400 11401 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js 11402 /** 11403 * WordPress dependencies 11404 */ 11405 11406 11407 11408 11409 /** 11410 * Custom hook that determines if any entities are dirty (edited) and provides a way to manage selected/unselected entities. 11411 * 11412 * @return {Object} An object containing the following properties: 11413 * - dirtyEntityRecords: An array of dirty entity records. 11414 * - isDirty: A boolean indicating if there are any dirty entity records. 11415 * - setUnselectedEntities: A function to set the unselected entities. 11416 * - unselectedEntities: An array of unselected entities. 11417 */ 11418 const useIsDirty = () => { 11419 const { 11420 editedEntities, 11421 siteEdits, 11422 siteEntityConfig 11423 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 11424 const { 11425 __experimentalGetDirtyEntityRecords, 11426 getEntityRecordEdits, 11427 getEntityConfig 11428 } = select(external_wp_coreData_namespaceObject.store); 11429 return { 11430 editedEntities: __experimentalGetDirtyEntityRecords(), 11431 siteEdits: getEntityRecordEdits('root', 'site'), 11432 siteEntityConfig: getEntityConfig('root', 'site') 11433 }; 11434 }, []); 11435 const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { 11436 var _siteEntityConfig$met; 11437 // Remove site object and decouple into its edited pieces. 11438 const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site')); 11439 const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {}; 11440 const editedSiteEntities = []; 11441 for (const property in siteEdits) { 11442 editedSiteEntities.push({ 11443 kind: 'root', 11444 name: 'site', 11445 title: siteEntityLabels[property] || property, 11446 property 11447 }); 11448 } 11449 return [...editedEntitiesWithoutSite, ...editedSiteEntities]; 11450 }, [editedEntities, siteEdits, siteEntityConfig]); 11451 11452 // Unchecked entities to be ignored by save function. 11453 const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); 11454 const setUnselectedEntities = ({ 11455 kind, 11456 name, 11457 key, 11458 property 11459 }, checked) => { 11460 if (checked) { 11461 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); 11462 } else { 11463 _setUnselectedEntities([...unselectedEntities, { 11464 kind, 11465 name, 11466 key, 11467 property 11468 }]); 11469 } 11470 }; 11471 const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0; 11472 return { 11473 dirtyEntityRecords, 11474 isDirty, 11475 setUnselectedEntities, 11476 unselectedEntities 11477 }; 11478 }; 11479 11480 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js 11481 /** 11482 * WordPress dependencies 11483 */ 11484 11485 11486 11487 11488 11489 11490 /** 11491 * Internal dependencies 11492 */ 11493 11494 11495 11496 11497 11498 11499 function identity(values) { 11500 return values; 11501 } 11502 11503 /** 11504 * Renders the component for managing saved states of entities. 11505 * 11506 * @param {Object} props The component props. 11507 * @param {Function} props.close The function to close the dialog. 11508 * @param {Function} props.renderDialog The function to render the dialog. 11509 * 11510 * @return {JSX.Element} The rendered component. 11511 */ 11512 function EntitiesSavedStates({ 11513 close, 11514 renderDialog = undefined 11515 }) { 11516 const isDirtyProps = useIsDirty(); 11517 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, { 11518 close: close, 11519 renderDialog: renderDialog, 11520 ...isDirtyProps 11521 }); 11522 } 11523 11524 /** 11525 * Renders a panel for saving entities with dirty records. 11526 * 11527 * @param {Object} props The component props. 11528 * @param {string} props.additionalPrompt Additional prompt to display. 11529 * @param {Function} props.close Function to close the panel. 11530 * @param {Function} props.onSave Function to call when saving entities. 11531 * @param {boolean} props.saveEnabled Flag indicating if save is enabled. 11532 * @param {string} props.saveLabel Label for the save button. 11533 * @param {Function} props.renderDialog Function to render a custom dialog. 11534 * @param {Array} props.dirtyEntityRecords Array of dirty entity records. 11535 * @param {boolean} props.isDirty Flag indicating if there are dirty entities. 11536 * @param {Function} props.setUnselectedEntities Function to set unselected entities. 11537 * @param {Array} props.unselectedEntities Array of unselected entities. 11538 * 11539 * @return {JSX.Element} The rendered component. 11540 */ 11541 function EntitiesSavedStatesExtensible({ 11542 additionalPrompt = undefined, 11543 close, 11544 onSave = identity, 11545 saveEnabled: saveEnabledProp = undefined, 11546 saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'), 11547 renderDialog = undefined, 11548 dirtyEntityRecords, 11549 isDirty, 11550 setUnselectedEntities, 11551 unselectedEntities 11552 }) { 11553 const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 11554 const { 11555 saveDirtyEntities 11556 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 11557 // To group entities by type. 11558 const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => { 11559 const { 11560 name 11561 } = record; 11562 if (!acc[name]) { 11563 acc[name] = []; 11564 } 11565 acc[name].push(record); 11566 return acc; 11567 }, {}); 11568 11569 // Sort entity groups. 11570 const { 11571 site: siteSavables, 11572 wp_template: templateSavables, 11573 wp_template_part: templatePartSavables, 11574 ...contentSavables 11575 } = partitionedSavables; 11576 const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); 11577 const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty; 11578 // Explicitly define this with no argument passed. Using `close` on 11579 // its own will use the event object in place of the expected saved entities. 11580 const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); 11581 const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ 11582 onClose: () => dismissPanel() 11583 }); 11584 const dialogLabel = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'label'); 11585 const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'description'); 11586 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 11587 ref: saveDialogRef, 11588 ...saveDialogProps, 11589 className: "entities-saved-states__panel", 11590 role: renderDialog ? 'dialog' : undefined, 11591 "aria-labelledby": renderDialog ? dialogLabel : undefined, 11592 "aria-describedby": renderDialog ? dialogDescription : undefined, 11593 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 11594 className: "entities-saved-states__panel-header", 11595 gap: 2, 11596 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11597 isBlock: true, 11598 as: external_wp_components_namespaceObject.Button, 11599 variant: "secondary", 11600 size: "compact", 11601 onClick: dismissPanel, 11602 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 11603 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 11604 isBlock: true, 11605 as: external_wp_components_namespaceObject.Button, 11606 ref: saveButtonRef, 11607 variant: "primary", 11608 size: "compact", 11609 disabled: !saveEnabled, 11610 accessibleWhenDisabled: true, 11611 onClick: () => saveDirtyEntities({ 11612 onSave, 11613 dirtyEntityRecords, 11614 entitiesToSkip: unselectedEntities, 11615 close 11616 }), 11617 className: "editor-entities-saved-states__save-button", 11618 children: saveLabel 11619 })] 11620 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 11621 className: "entities-saved-states__text-prompt", 11622 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 11623 className: "entities-saved-states__text-prompt--header-wrapper", 11624 id: renderDialog ? dialogLabel : undefined, 11625 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 11626 className: "entities-saved-states__text-prompt--header", 11627 children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?') 11628 }), additionalPrompt] 11629 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 11630 id: renderDialog ? dialogDescription : undefined, 11631 children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */ 11632 (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.', sortedPartitionedSavables.length), sortedPartitionedSavables.length), { 11633 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}) 11634 }) : (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.') 11635 })] 11636 }), sortedPartitionedSavables.map(list => { 11637 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, { 11638 list: list, 11639 unselectedEntities: unselectedEntities, 11640 setUnselectedEntities: setUnselectedEntities 11641 }, list[0].name); 11642 })] 11643 }); 11644 } 11645 11646 ;// ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js 11647 /** 11648 * WordPress dependencies 11649 */ 11650 11651 11652 11653 11654 11655 11656 11657 11658 /** 11659 * Internal dependencies 11660 */ 11661 11662 11663 function getContent() { 11664 try { 11665 // While `select` in a component is generally discouraged, it is 11666 // used here because it (a) reduces the chance of data loss in the 11667 // case of additional errors by performing a direct retrieval and 11668 // (b) avoids the performance cost associated with unnecessary 11669 // content serialization throughout the lifetime of a non-erroring 11670 // application. 11671 return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); 11672 } catch (error) {} 11673 } 11674 function CopyButton({ 11675 text, 11676 children 11677 }) { 11678 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 11679 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 11680 __next40pxDefaultSize: true, 11681 variant: "secondary", 11682 ref: ref, 11683 children: children 11684 }); 11685 } 11686 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 11687 constructor() { 11688 super(...arguments); 11689 this.state = { 11690 error: null 11691 }; 11692 } 11693 componentDidCatch(error) { 11694 (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); 11695 } 11696 static getDerivedStateFromError(error) { 11697 return { 11698 error 11699 }; 11700 } 11701 render() { 11702 const { 11703 error 11704 } = this.state; 11705 if (!error) { 11706 return this.props.children; 11707 } 11708 const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { 11709 text: getContent, 11710 children: (0,external_wp_i18n_namespaceObject.__)('Copy Post Text') 11711 }, "copy-post"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { 11712 text: error.stack, 11713 children: (0,external_wp_i18n_namespaceObject.__)('Copy Error') 11714 }, "copy-error")]; 11715 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { 11716 className: "editor-error-boundary", 11717 actions: actions, 11718 children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.') 11719 }); 11720 } 11721 } 11722 11723 /** 11724 * ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI. 11725 * 11726 * It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree. 11727 * 11728 * getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information. 11729 * 11730 * @class ErrorBoundary 11731 * @augments Component 11732 */ 11733 /* harmony default export */ const error_boundary = (ErrorBoundary); 11734 11735 ;// ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js 11736 /** 11737 * WordPress dependencies 11738 */ 11739 11740 11741 11742 11743 11744 11745 11746 /** 11747 * Internal dependencies 11748 */ 11749 11750 11751 11752 11753 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; 11754 let hasStorageSupport; 11755 11756 /** 11757 * Function which returns true if the current environment supports browser 11758 * sessionStorage, or false otherwise. The result of this function is cached and 11759 * reused in subsequent invocations. 11760 */ 11761 const hasSessionStorageSupport = () => { 11762 if (hasStorageSupport !== undefined) { 11763 return hasStorageSupport; 11764 } 11765 try { 11766 // Private Browsing in Safari 10 and earlier will throw an error when 11767 // attempting to set into sessionStorage. The test here is intentional in 11768 // causing a thrown error as condition bailing from local autosave. 11769 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); 11770 window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); 11771 hasStorageSupport = true; 11772 } catch { 11773 hasStorageSupport = false; 11774 } 11775 return hasStorageSupport; 11776 }; 11777 11778 /** 11779 * Custom hook which manages the creation of a notice prompting the user to 11780 * restore a local autosave, if one exists. 11781 */ 11782 function useAutosaveNotice() { 11783 const { 11784 postId, 11785 isEditedPostNew, 11786 hasRemoteAutosave 11787 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 11788 postId: select(store_store).getCurrentPostId(), 11789 isEditedPostNew: select(store_store).isEditedPostNew(), 11790 hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave 11791 }), []); 11792 const { 11793 getEditedPostAttribute 11794 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 11795 const { 11796 createWarningNotice, 11797 removeNotice 11798 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 11799 const { 11800 editPost, 11801 resetEditorBlocks 11802 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11803 (0,external_wp_element_namespaceObject.useEffect)(() => { 11804 let localAutosave = localAutosaveGet(postId, isEditedPostNew); 11805 if (!localAutosave) { 11806 return; 11807 } 11808 try { 11809 localAutosave = JSON.parse(localAutosave); 11810 } catch { 11811 // Not usable if it can't be parsed. 11812 return; 11813 } 11814 const { 11815 post_title: title, 11816 content, 11817 excerpt 11818 } = localAutosave; 11819 const edits = { 11820 title, 11821 content, 11822 excerpt 11823 }; 11824 { 11825 // Only display a notice if there is a difference between what has been 11826 // saved and that which is stored in sessionStorage. 11827 const hasDifference = Object.keys(edits).some(key => { 11828 return edits[key] !== getEditedPostAttribute(key); 11829 }); 11830 if (!hasDifference) { 11831 // If there is no difference, it can be safely ejected from storage. 11832 localAutosaveClear(postId, isEditedPostNew); 11833 return; 11834 } 11835 } 11836 if (hasRemoteAutosave) { 11837 return; 11838 } 11839 const id = 'wpEditorAutosaveRestore'; 11840 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), { 11841 id, 11842 actions: [{ 11843 label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'), 11844 onClick() { 11845 const { 11846 content: editsContent, 11847 ...editsWithoutContent 11848 } = edits; 11849 editPost(editsWithoutContent); 11850 resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); 11851 removeNotice(id); 11852 } 11853 }] 11854 }); 11855 }, [isEditedPostNew, postId]); 11856 } 11857 11858 /** 11859 * Custom hook which ejects a local autosave after a successful save occurs. 11860 */ 11861 function useAutosavePurge() { 11862 const { 11863 postId, 11864 isEditedPostNew, 11865 isDirty, 11866 isAutosaving, 11867 didError 11868 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 11869 postId: select(store_store).getCurrentPostId(), 11870 isEditedPostNew: select(store_store).isEditedPostNew(), 11871 isDirty: select(store_store).isEditedPostDirty(), 11872 isAutosaving: select(store_store).isAutosavingPost(), 11873 didError: select(store_store).didPostSaveRequestFail() 11874 }), []); 11875 const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty); 11876 const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); 11877 (0,external_wp_element_namespaceObject.useEffect)(() => { 11878 if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) { 11879 localAutosaveClear(postId, isEditedPostNew); 11880 } 11881 lastIsDirtyRef.current = isDirty; 11882 lastIsAutosavingRef.current = isAutosaving; 11883 }, [isDirty, isAutosaving, didError]); 11884 11885 // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. 11886 const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); 11887 const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); 11888 (0,external_wp_element_namespaceObject.useEffect)(() => { 11889 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { 11890 localAutosaveClear(postId, true); 11891 } 11892 }, [isEditedPostNew, postId]); 11893 } 11894 function LocalAutosaveMonitor() { 11895 const { 11896 autosave 11897 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11898 const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { 11899 requestIdleCallback(() => autosave({ 11900 local: true 11901 })); 11902 }, []); 11903 useAutosaveNotice(); 11904 useAutosavePurge(); 11905 const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []); 11906 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, { 11907 interval: localAutosaveInterval, 11908 autosave: deferredAutosave 11909 }); 11910 } 11911 11912 /** 11913 * Monitors local autosaves of a post in the editor. 11914 * It uses several hooks and functions to manage autosave behavior: 11915 * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists. 11916 * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs. 11917 * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage. 11918 * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval. 11919 * 11920 * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that. 11921 * 11922 * @module LocalAutosaveMonitor 11923 */ 11924 /* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor)); 11925 11926 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js 11927 /** 11928 * WordPress dependencies 11929 */ 11930 11931 11932 11933 /** 11934 * Internal dependencies 11935 */ 11936 11937 11938 /** 11939 * Wrapper component that renders its children only if the post type supports page attributes. 11940 * 11941 * @param {Object} props - The component props. 11942 * @param {Element} props.children - The child components to render. 11943 * 11944 * @return {Component|null} The rendered child components or null if page attributes are not supported. 11945 */ 11946 function PageAttributesCheck({ 11947 children 11948 }) { 11949 const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => { 11950 const { 11951 getEditedPostAttribute 11952 } = select(store_store); 11953 const { 11954 getPostType 11955 } = select(external_wp_coreData_namespaceObject.store); 11956 const postType = getPostType(getEditedPostAttribute('type')); 11957 return !!postType?.supports?.['page-attributes']; 11958 }, []); 11959 11960 // Only render fields if post type supports page attributes or available templates exist. 11961 if (!supportsPageAttributes) { 11962 return null; 11963 } 11964 return children; 11965 } 11966 /* harmony default export */ const page_attributes_check = (PageAttributesCheck); 11967 11968 ;// ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js 11969 /** 11970 * WordPress dependencies 11971 */ 11972 11973 11974 11975 /** 11976 * Internal dependencies 11977 */ 11978 11979 11980 /** 11981 * A component which renders its own children only if the current editor post 11982 * type supports one of the given `supportKeys` prop. 11983 * 11984 * @param {Object} props Props. 11985 * @param {Element} props.children Children to be rendered if post 11986 * type supports. 11987 * @param {(string|string[])} props.supportKeys String or string array of keys 11988 * to test. 11989 * 11990 * @return {Component} The component to be rendered. 11991 */ 11992 function PostTypeSupportCheck({ 11993 children, 11994 supportKeys 11995 }) { 11996 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 11997 const { 11998 getEditedPostAttribute 11999 } = select(store_store); 12000 const { 12001 getPostType 12002 } = select(external_wp_coreData_namespaceObject.store); 12003 return getPostType(getEditedPostAttribute('type')); 12004 }, []); 12005 let isSupported = !!postType; 12006 if (postType) { 12007 isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]); 12008 } 12009 if (!isSupported) { 12010 return null; 12011 } 12012 return children; 12013 } 12014 /* harmony default export */ const post_type_support_check = (PostTypeSupportCheck); 12015 12016 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js 12017 /** 12018 * WordPress dependencies 12019 */ 12020 12021 12022 12023 12024 12025 /** 12026 * Internal dependencies 12027 */ 12028 12029 12030 12031 function PageAttributesOrder() { 12032 const order = (0,external_wp_data_namespaceObject.useSelect)(select => { 12033 var _select$getEditedPost; 12034 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0; 12035 }, []); 12036 const { 12037 editPost 12038 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 12039 const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); 12040 const setUpdatedOrder = value => { 12041 setOrderInput(value); 12042 const newOrder = Number(value); 12043 if (Number.isInteger(newOrder) && value.trim?.() !== '') { 12044 editPost({ 12045 menu_order: newOrder 12046 }); 12047 } 12048 }; 12049 const value = orderInput !== null && orderInput !== void 0 ? orderInput : order; 12050 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 12051 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { 12052 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 12053 __next40pxDefaultSize: true, 12054 label: (0,external_wp_i18n_namespaceObject.__)('Order'), 12055 help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'), 12056 value: value, 12057 onChange: setUpdatedOrder, 12058 hideLabelFromVision: true, 12059 onBlur: () => { 12060 setOrderInput(null); 12061 } 12062 }) 12063 }) 12064 }); 12065 } 12066 12067 /** 12068 * Renders the Page Attributes Order component. A number input in an editor interface 12069 * for setting the order of a given page. 12070 * The component is now not used in core but was kept for backward compatibility. 12071 * 12072 * @return {Component} The component to be rendered. 12073 */ 12074 function PageAttributesOrderWithChecks() { 12075 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 12076 supportKeys: "page-attributes", 12077 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {}) 12078 }); 12079 } 12080 12081 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 12082 var remove_accents = __webpack_require__(9681); 12083 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 12084 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js 12085 /** 12086 * External dependencies 12087 */ 12088 12089 12090 /** 12091 * WordPress dependencies 12092 */ 12093 12094 12095 12096 12097 const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({ 12098 className, 12099 label, 12100 children 12101 }, ref) => { 12102 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12103 className: dist_clsx('editor-post-panel__row', className), 12104 ref: ref, 12105 children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12106 className: "editor-post-panel__row-label", 12107 children: label 12108 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 12109 className: "editor-post-panel__row-control", 12110 children: children 12111 })] 12112 }); 12113 }); 12114 /* harmony default export */ const post_panel_row = (PostPanelRow); 12115 12116 ;// ./node_modules/@wordpress/editor/build-module/utils/terms.js 12117 /** 12118 * WordPress dependencies 12119 */ 12120 12121 12122 /** 12123 * Returns terms in a tree form. 12124 * 12125 * @param {Array} flatTerms Array of terms in flat format. 12126 * 12127 * @return {Array} Array of terms in tree format. 12128 */ 12129 function buildTermsTree(flatTerms) { 12130 const flatTermsWithParentAndChildren = flatTerms.map(term => { 12131 return { 12132 children: [], 12133 parent: null, 12134 ...term 12135 }; 12136 }); 12137 12138 // All terms should have a `parent` because we're about to index them by it. 12139 if (flatTermsWithParentAndChildren.some(({ 12140 parent 12141 }) => parent === null)) { 12142 return flatTermsWithParentAndChildren; 12143 } 12144 const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => { 12145 const { 12146 parent 12147 } = term; 12148 if (!acc[parent]) { 12149 acc[parent] = []; 12150 } 12151 acc[parent].push(term); 12152 return acc; 12153 }, {}); 12154 const fillWithChildren = terms => { 12155 return terms.map(term => { 12156 const children = termsByParent[term.id]; 12157 return { 12158 ...term, 12159 children: children && children.length ? fillWithChildren(children) : [] 12160 }; 12161 }); 12162 }; 12163 return fillWithChildren(termsByParent['0'] || []); 12164 } 12165 const unescapeString = arg => { 12166 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); 12167 }; 12168 12169 /** 12170 * Returns a term object with name unescaped. 12171 * 12172 * @param {Object} term The term object to unescape. 12173 * 12174 * @return {Object} Term object with name property unescaped. 12175 */ 12176 const unescapeTerm = term => { 12177 return { 12178 ...term, 12179 name: unescapeString(term.name) 12180 }; 12181 }; 12182 12183 /** 12184 * Returns an array of term objects with names unescaped. 12185 * The unescape of each term is performed using the unescapeTerm function. 12186 * 12187 * @param {Object[]} terms Array of term objects to unescape. 12188 * 12189 * @return {Object[]} Array of term objects unescaped. 12190 */ 12191 const unescapeTerms = terms => { 12192 return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm); 12193 }; 12194 12195 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js 12196 /** 12197 * External dependencies 12198 */ 12199 12200 12201 /** 12202 * WordPress dependencies 12203 */ 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 /** 12215 * Internal dependencies 12216 */ 12217 12218 12219 12220 12221 12222 function getTitle(post) { 12223 return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; 12224 } 12225 const getItemPriority = (name, searchValue) => { 12226 const normalizedName = remove_accents_default()(name || '').toLowerCase(); 12227 const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase(); 12228 if (normalizedName === normalizedSearch) { 12229 return 0; 12230 } 12231 if (normalizedName.startsWith(normalizedSearch)) { 12232 return normalizedName.length; 12233 } 12234 return Infinity; 12235 }; 12236 12237 /** 12238 * Renders the Page Attributes Parent component. A dropdown menu in an editor interface 12239 * for selecting the parent page of a given page. 12240 * 12241 * @return {Component|null} The component to be rendered. Return null if post type is not hierarchical. 12242 */ 12243 function PageAttributesParent() { 12244 const { 12245 editPost 12246 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 12247 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); 12248 const { 12249 isHierarchical, 12250 parentPostId, 12251 parentPostTitle, 12252 pageItems 12253 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12254 var _pType$hierarchical; 12255 const { 12256 getPostType, 12257 getEntityRecords, 12258 getEntityRecord 12259 } = select(external_wp_coreData_namespaceObject.store); 12260 const { 12261 getCurrentPostId, 12262 getEditedPostAttribute 12263 } = select(store_store); 12264 const postTypeSlug = getEditedPostAttribute('type'); 12265 const pageId = getEditedPostAttribute('parent'); 12266 const pType = getPostType(postTypeSlug); 12267 const postId = getCurrentPostId(); 12268 const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false; 12269 const query = { 12270 per_page: 100, 12271 exclude: postId, 12272 parent_exclude: postId, 12273 orderby: 'menu_order', 12274 order: 'asc', 12275 _fields: 'id,title,parent' 12276 }; 12277 12278 // Perform a search when the field is changed. 12279 if (!!fieldValue) { 12280 query.search = fieldValue; 12281 } 12282 const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null; 12283 return { 12284 isHierarchical: postIsHierarchical, 12285 parentPostId: pageId, 12286 parentPostTitle: parentPost ? getTitle(parentPost) : '', 12287 pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null 12288 }; 12289 }, [fieldValue]); 12290 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 12291 const getOptionsFromTree = (tree, level = 0) => { 12292 const mappedNodes = tree.map(treeNode => [{ 12293 value: treeNode.id, 12294 label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), 12295 rawName: treeNode.name 12296 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); 12297 const sortedNodes = mappedNodes.sort(([a], [b]) => { 12298 const priorityA = getItemPriority(a.rawName, fieldValue); 12299 const priorityB = getItemPriority(b.rawName, fieldValue); 12300 return priorityA >= priorityB ? 1 : -1; 12301 }); 12302 return sortedNodes.flat(); 12303 }; 12304 if (!pageItems) { 12305 return []; 12306 } 12307 let tree = pageItems.map(item => ({ 12308 id: item.id, 12309 parent: item.parent, 12310 name: getTitle(item) 12311 })); 12312 12313 // Only build a hierarchical tree when not searching. 12314 if (!fieldValue) { 12315 tree = buildTermsTree(tree); 12316 } 12317 const opts = getOptionsFromTree(tree); 12318 12319 // Ensure the current parent is in the options list. 12320 const optsHasParent = opts.find(item => item.value === parentPostId); 12321 if (parentPostTitle && !optsHasParent) { 12322 opts.unshift({ 12323 value: parentPostId, 12324 label: parentPostTitle 12325 }); 12326 } 12327 return opts; 12328 }, [pageItems, fieldValue, parentPostTitle, parentPostId]); 12329 if (!isHierarchical) { 12330 return null; 12331 } 12332 /** 12333 * Handle user input. 12334 * 12335 * @param {string} inputValue The current value of the input field. 12336 */ 12337 const handleKeydown = inputValue => { 12338 setFieldValue(inputValue); 12339 }; 12340 12341 /** 12342 * Handle author selection. 12343 * 12344 * @param {Object} selectedPostId The selected Author. 12345 */ 12346 const handleChange = selectedPostId => { 12347 editPost({ 12348 parent: selectedPostId 12349 }); 12350 }; 12351 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { 12352 __nextHasNoMarginBottom: true, 12353 __next40pxDefaultSize: true, 12354 className: "editor-page-attributes__parent", 12355 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 12356 help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'), 12357 value: parentPostId, 12358 options: parentOptions, 12359 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), 12360 onChange: handleChange, 12361 hideLabelFromVision: true 12362 }); 12363 } 12364 function PostParentToggle({ 12365 isOpen, 12366 onClick 12367 }) { 12368 const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => { 12369 const { 12370 getEditedPostAttribute 12371 } = select(store_store); 12372 const parentPostId = getEditedPostAttribute('parent'); 12373 if (!parentPostId) { 12374 return null; 12375 } 12376 const { 12377 getEntityRecord 12378 } = select(external_wp_coreData_namespaceObject.store); 12379 const postTypeSlug = getEditedPostAttribute('type'); 12380 return getEntityRecord('postType', postTypeSlug, parentPostId); 12381 }, []); 12382 const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]); 12383 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 12384 size: "compact", 12385 className: "editor-post-parent__panel-toggle", 12386 variant: "tertiary", 12387 "aria-expanded": isOpen, 12388 "aria-label": 12389 // translators: %s: Current post parent. 12390 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle), 12391 onClick: onClick, 12392 children: parentTitle 12393 }); 12394 } 12395 function ParentRow() { 12396 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => { 12397 // Site index. 12398 return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home; 12399 }, []); 12400 // Use internal state instead of a ref to make sure that the component 12401 // re-renders when the popover's anchor updates. 12402 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 12403 // Memoize popoverProps to avoid returning a new object every time. 12404 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 12405 // Anchor the popover to the middle of the entire row so that it doesn't 12406 // move around when the label changes. 12407 anchor: popoverAnchor, 12408 placement: 'left-start', 12409 offset: 36, 12410 shift: true 12411 }), [popoverAnchor]); 12412 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 12413 label: (0,external_wp_i18n_namespaceObject.__)('Parent'), 12414 ref: setPopoverAnchor, 12415 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 12416 popoverProps: popoverProps, 12417 className: "editor-post-parent__panel-dropdown", 12418 contentClassName: "editor-post-parent__panel-dialog", 12419 focusOnMount: true, 12420 renderToggle: ({ 12421 isOpen, 12422 onToggle 12423 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, { 12424 isOpen: isOpen, 12425 onClick: onToggle 12426 }), 12427 renderContent: ({ 12428 onClose 12429 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12430 className: "editor-post-parent", 12431 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 12432 title: (0,external_wp_i18n_namespaceObject.__)('Parent'), 12433 onClose: onClose 12434 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12435 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. */ 12436 (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')), { 12437 wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) 12438 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12439 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>'), { 12440 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 12441 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes') 12442 }) 12443 }) 12444 })] 12445 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, {})] 12446 }) 12447 }) 12448 }); 12449 } 12450 /* harmony default export */ const page_attributes_parent = (PageAttributesParent); 12451 12452 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js 12453 /** 12454 * WordPress dependencies 12455 */ 12456 12457 12458 /** 12459 * Internal dependencies 12460 */ 12461 12462 12463 12464 12465 const PANEL_NAME = 'page-attributes'; 12466 function AttributesPanel() { 12467 const { 12468 isEnabled, 12469 postType 12470 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12471 const { 12472 getEditedPostAttribute, 12473 isEditorPanelEnabled 12474 } = select(store_store); 12475 const { 12476 getPostType 12477 } = select(external_wp_coreData_namespaceObject.store); 12478 return { 12479 isEnabled: isEditorPanelEnabled(PANEL_NAME), 12480 postType: getPostType(getEditedPostAttribute('type')) 12481 }; 12482 }, []); 12483 if (!isEnabled || !postType) { 12484 return null; 12485 } 12486 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}); 12487 } 12488 12489 /** 12490 * Renders the Page Attributes Panel component. 12491 * 12492 * @return {Component} The component to be rendered. 12493 */ 12494 function PageAttributesPanel() { 12495 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { 12496 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {}) 12497 }); 12498 } 12499 12500 ;// ./node_modules/@wordpress/icons/build-module/library/add-template.js 12501 /** 12502 * WordPress dependencies 12503 */ 12504 12505 12506 const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 12507 viewBox: "0 0 24 24", 12508 xmlns: "http://www.w3.org/2000/svg", 12509 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 12510 fillRule: "evenodd", 12511 clipRule: "evenodd", 12512 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" 12513 }) 12514 }); 12515 /* harmony default export */ const add_template = (addTemplate); 12516 12517 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js 12518 /** 12519 * WordPress dependencies 12520 */ 12521 12522 12523 12524 12525 12526 12527 12528 /** 12529 * Internal dependencies 12530 */ 12531 12532 12533 12534 12535 const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); 12536 function CreateNewTemplateModal({ 12537 onClose 12538 }) { 12539 const { 12540 defaultBlockTemplate, 12541 onNavigateToEntityRecord 12542 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12543 const { 12544 getEditorSettings, 12545 getCurrentTemplateId 12546 } = select(store_store); 12547 return { 12548 defaultBlockTemplate: getEditorSettings().defaultBlockTemplate, 12549 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 12550 getTemplateId: getCurrentTemplateId 12551 }; 12552 }); 12553 const { 12554 createTemplate 12555 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 12556 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 12557 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 12558 const cancel = () => { 12559 setTitle(''); 12560 onClose(); 12561 }; 12562 const submit = async event => { 12563 event.preventDefault(); 12564 if (isBusy) { 12565 return; 12566 } 12567 setIsBusy(true); 12568 const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 12569 tagName: 'header', 12570 layout: { 12571 inherit: true 12572 } 12573 }, [(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', { 12574 tagName: 'main' 12575 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { 12576 layout: { 12577 inherit: true 12578 } 12579 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', { 12580 layout: { 12581 inherit: true 12582 } 12583 })])]); 12584 const newTemplate = await createTemplate({ 12585 slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE), 12586 content: newTemplateContent, 12587 title: title || DEFAULT_TITLE 12588 }); 12589 setIsBusy(false); 12590 onNavigateToEntityRecord({ 12591 postId: newTemplate.id, 12592 postType: 'wp_template' 12593 }); 12594 cancel(); 12595 }; 12596 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 12597 title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'), 12598 onRequestClose: cancel, 12599 focusOnMount: "firstContentElement", 12600 size: "small", 12601 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 12602 className: "editor-post-template__create-form", 12603 onSubmit: submit, 12604 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 12605 spacing: "3", 12606 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 12607 __next40pxDefaultSize: true, 12608 __nextHasNoMarginBottom: true, 12609 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 12610 value: title, 12611 onChange: setTitle, 12612 placeholder: DEFAULT_TITLE, 12613 disabled: isBusy, 12614 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.') 12615 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 12616 justify: "right", 12617 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 12618 __next40pxDefaultSize: true, 12619 variant: "tertiary", 12620 onClick: cancel, 12621 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 12622 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 12623 __next40pxDefaultSize: true, 12624 variant: "primary", 12625 type: "submit", 12626 isBusy: isBusy, 12627 "aria-disabled": isBusy, 12628 children: (0,external_wp_i18n_namespaceObject.__)('Create') 12629 })] 12630 })] 12631 }) 12632 }) 12633 }); 12634 } 12635 12636 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js 12637 /** 12638 * WordPress dependencies 12639 */ 12640 12641 12642 12643 12644 /** 12645 * Internal dependencies 12646 */ 12647 12648 function useEditedPostContext() { 12649 return (0,external_wp_data_namespaceObject.useSelect)(select => { 12650 const { 12651 getCurrentPostId, 12652 getCurrentPostType 12653 } = select(store_store); 12654 return { 12655 postId: getCurrentPostId(), 12656 postType: getCurrentPostType() 12657 }; 12658 }, []); 12659 } 12660 function useAllowSwitchingTemplates() { 12661 const { 12662 postType, 12663 postId 12664 } = useEditedPostContext(); 12665 return (0,external_wp_data_namespaceObject.useSelect)(select => { 12666 const { 12667 canUser, 12668 getEntityRecord, 12669 getEntityRecords 12670 } = select(external_wp_coreData_namespaceObject.store); 12671 const siteSettings = canUser('read', { 12672 kind: 'root', 12673 name: 'site' 12674 }) ? getEntityRecord('root', 'site') : undefined; 12675 const templates = getEntityRecords('postType', 'wp_template', { 12676 per_page: -1 12677 }); 12678 const isPostsPage = +postId === siteSettings?.page_for_posts; 12679 // If current page is set front page or posts page, we also need 12680 // to check if the current theme has a template for it. If not 12681 const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({ 12682 slug 12683 }) => slug === 'front-page'); 12684 return !isPostsPage && !isFrontPage; 12685 }, [postId, postType]); 12686 } 12687 function useTemplates(postType) { 12688 return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { 12689 per_page: -1, 12690 post_type: postType 12691 }), [postType]); 12692 } 12693 function useAvailableTemplates(postType) { 12694 const currentTemplateSlug = useCurrentTemplateSlug(); 12695 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 12696 const templates = useTemplates(postType); 12697 return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates. 12698 ), [templates, currentTemplateSlug, allowSwitchingTemplate]); 12699 } 12700 function useCurrentTemplateSlug() { 12701 const { 12702 postType, 12703 postId 12704 } = useEditedPostContext(); 12705 const templates = useTemplates(postType); 12706 const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => { 12707 const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 12708 return post?.template; 12709 }, [postType, postId]); 12710 if (!entityTemplate) { 12711 return; 12712 } 12713 // If a page has a `template` set and is not included in the list 12714 // of the theme's templates, do not return it, in order to resolve 12715 // to the current theme's default template. 12716 return templates?.find(template => template.slug === entityTemplate)?.slug; 12717 } 12718 12719 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js 12720 /** 12721 * WordPress dependencies 12722 */ 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 /** 12733 * Internal dependencies 12734 */ 12735 12736 12737 12738 12739 12740 const POPOVER_PROPS = { 12741 className: 'editor-post-template__dropdown', 12742 placement: 'bottom-start' 12743 }; 12744 function PostTemplateToggle({ 12745 isOpen, 12746 onClick 12747 }) { 12748 const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { 12749 const templateSlug = select(store_store).getEditedPostAttribute('template'); 12750 const { 12751 supportsTemplateMode, 12752 availableTemplates 12753 } = select(store_store).getEditorSettings(); 12754 if (!supportsTemplateMode && availableTemplates[templateSlug]) { 12755 return availableTemplates[templateSlug]; 12756 } 12757 const template = select(external_wp_coreData_namespaceObject.store).canUser('create', { 12758 kind: 'postType', 12759 name: 'wp_template' 12760 }) && select(store_store).getCurrentTemplateId(); 12761 return template?.title || template?.slug || availableTemplates?.[templateSlug]; 12762 }, []); 12763 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 12764 __next40pxDefaultSize: true, 12765 variant: "tertiary", 12766 "aria-expanded": isOpen, 12767 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'), 12768 onClick: onClick, 12769 children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template') 12770 }); 12771 } 12772 12773 /** 12774 * Renders the dropdown content for selecting a post template. 12775 * 12776 * @param {Object} props The component props. 12777 * @param {Function} props.onClose The function to close the dropdown. 12778 * 12779 * @return {JSX.Element} The rendered dropdown content. 12780 */ 12781 function PostTemplateDropdownContent({ 12782 onClose 12783 }) { 12784 var _options$find, _selectedOption$value; 12785 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 12786 const { 12787 availableTemplates, 12788 fetchedTemplates, 12789 selectedTemplateSlug, 12790 canCreate, 12791 canEdit, 12792 currentTemplateId, 12793 onNavigateToEntityRecord, 12794 getEditorSettings 12795 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 12796 const { 12797 canUser, 12798 getEntityRecords 12799 } = select(external_wp_coreData_namespaceObject.store); 12800 const editorSettings = select(store_store).getEditorSettings(); 12801 const canCreateTemplates = canUser('create', { 12802 kind: 'postType', 12803 name: 'wp_template' 12804 }); 12805 const _currentTemplateId = select(store_store).getCurrentTemplateId(); 12806 return { 12807 availableTemplates: editorSettings.availableTemplates, 12808 fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', { 12809 post_type: select(store_store).getCurrentPostType(), 12810 per_page: -1 12811 }) : undefined, 12812 selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'), 12813 canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode, 12814 canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId, 12815 currentTemplateId: _currentTemplateId, 12816 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 12817 getEditorSettings: select(store_store).getEditorSettings 12818 }; 12819 }, [allowSwitchingTemplate]); 12820 const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({ 12821 ...availableTemplates, 12822 ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({ 12823 slug, 12824 title 12825 }) => [slug, title.rendered])) 12826 }).map(([slug, title]) => ({ 12827 value: slug, 12828 label: title 12829 })), [availableTemplates, fetchedTemplates]); 12830 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. 12831 12832 const { 12833 editPost 12834 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 12835 const { 12836 createSuccessNotice 12837 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 12838 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 12839 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 12840 className: "editor-post-template__classic-theme-dropdown", 12841 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 12842 title: (0,external_wp_i18n_namespaceObject.__)('Template'), 12843 help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'), 12844 actions: canCreate ? [{ 12845 icon: add_template, 12846 label: (0,external_wp_i18n_namespaceObject.__)('Add template'), 12847 onClick: () => setIsCreateModalOpen(true) 12848 }] : [], 12849 onClose: onClose 12850 }), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 12851 status: "warning", 12852 isDismissible: false, 12853 children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.') 12854 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 12855 __next40pxDefaultSize: true, 12856 __nextHasNoMarginBottom: true, 12857 hideLabelFromVision: true, 12858 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 12859 value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '', 12860 options: options, 12861 onChange: slug => editPost({ 12862 template: slug || '' 12863 }) 12864 }), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 12865 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button 12866 // TODO: Switch to `true` (40px size) if possible 12867 , { 12868 __next40pxDefaultSize: false, 12869 variant: "link", 12870 onClick: () => { 12871 onNavigateToEntityRecord({ 12872 postId: currentTemplateId, 12873 postType: 'wp_template' 12874 }); 12875 onClose(); 12876 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { 12877 type: 'snackbar', 12878 actions: [{ 12879 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 12880 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 12881 }] 12882 }); 12883 }, 12884 children: (0,external_wp_i18n_namespaceObject.__)('Edit template') 12885 }) 12886 }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { 12887 onClose: () => setIsCreateModalOpen(false) 12888 })] 12889 }); 12890 } 12891 function ClassicThemeControl() { 12892 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 12893 popoverProps: POPOVER_PROPS, 12894 focusOnMount: true, 12895 renderToggle: ({ 12896 isOpen, 12897 onToggle 12898 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateToggle, { 12899 isOpen: isOpen, 12900 onClick: onToggle 12901 }), 12902 renderContent: ({ 12903 onClose 12904 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, { 12905 onClose: onClose 12906 }) 12907 }); 12908 } 12909 12910 /** 12911 * Provides a dropdown menu for selecting and managing post templates. 12912 * 12913 * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates. 12914 * 12915 * @return {JSX.Element} The rendered ClassicThemeControl component. 12916 */ 12917 /* harmony default export */ const classic_theme = (ClassicThemeControl); 12918 12919 ;// external ["wp","warning"] 12920 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 12921 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 12922 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js 12923 /** 12924 * WordPress dependencies 12925 */ 12926 12927 12928 12929 12930 /** 12931 * Internal dependencies 12932 */ 12933 12934 12935 const { 12936 PreferenceBaseOption 12937 } = unlock(external_wp_preferences_namespaceObject.privateApis); 12938 /* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { 12939 panelName 12940 }) => { 12941 const { 12942 isEditorPanelEnabled, 12943 isEditorPanelRemoved 12944 } = select(store_store); 12945 return { 12946 isRemoved: isEditorPanelRemoved(panelName), 12947 isChecked: isEditorPanelEnabled(panelName) 12948 }; 12949 }), (0,external_wp_compose_namespaceObject.ifCondition)(({ 12950 isRemoved 12951 }) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 12952 panelName 12953 }) => ({ 12954 onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName) 12955 })))(PreferenceBaseOption)); 12956 12957 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js 12958 /** 12959 * WordPress dependencies 12960 */ 12961 12962 12963 /** 12964 * Internal dependencies 12965 */ 12966 12967 12968 const { 12969 Fill, 12970 Slot 12971 } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption'); 12972 const EnablePluginDocumentSettingPanelOption = ({ 12973 label, 12974 panelName 12975 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { 12976 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 12977 label: label, 12978 panelName: panelName 12979 }) 12980 }); 12981 EnablePluginDocumentSettingPanelOption.Slot = Slot; 12982 /* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption); 12983 12984 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js 12985 /** 12986 * WordPress dependencies 12987 */ 12988 12989 12990 12991 12992 12993 /** 12994 * Internal dependencies 12995 */ 12996 12997 12998 12999 13000 13001 const { 13002 Fill: plugin_document_setting_panel_Fill, 13003 Slot: plugin_document_setting_panel_Slot 13004 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); 13005 13006 /** 13007 * Renders items below the Status & Availability panel in the Document Sidebar. 13008 * 13009 * @param {Object} props Component properties. 13010 * @param {string} props.name Required. A machine-friendly name for the panel. 13011 * @param {string} [props.className] An optional class name added to the row. 13012 * @param {string} [props.title] The title of the panel 13013 * @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. 13014 * @param {Element} props.children Children to be rendered 13015 * 13016 * @example 13017 * ```js 13018 * // Using ES5 syntax 13019 * var el = React.createElement; 13020 * var __ = wp.i18n.__; 13021 * var registerPlugin = wp.plugins.registerPlugin; 13022 * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel; 13023 * 13024 * function MyDocumentSettingPlugin() { 13025 * return el( 13026 * PluginDocumentSettingPanel, 13027 * { 13028 * className: 'my-document-setting-plugin', 13029 * title: 'My Panel', 13030 * name: 'my-panel', 13031 * }, 13032 * __( 'My Document Setting Panel' ) 13033 * ); 13034 * } 13035 * 13036 * registerPlugin( 'my-document-setting-plugin', { 13037 * render: MyDocumentSettingPlugin 13038 * } ); 13039 * ``` 13040 * 13041 * @example 13042 * ```jsx 13043 * // Using ESNext syntax 13044 * import { registerPlugin } from '@wordpress/plugins'; 13045 * import { PluginDocumentSettingPanel } from '@wordpress/editor'; 13046 * 13047 * const MyDocumentSettingTest = () => ( 13048 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel"> 13049 * <p>My Document Setting Panel</p> 13050 * </PluginDocumentSettingPanel> 13051 * ); 13052 * 13053 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); 13054 * ``` 13055 * 13056 * @return {Component} The component to be rendered. 13057 */ 13058 const PluginDocumentSettingPanel = ({ 13059 name, 13060 className, 13061 title, 13062 icon, 13063 children 13064 }) => { 13065 const { 13066 name: pluginName 13067 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 13068 const panelName = `$pluginName}/$name}`; 13069 const { 13070 opened, 13071 isEnabled 13072 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13073 const { 13074 isEditorPanelOpened, 13075 isEditorPanelEnabled 13076 } = select(store_store); 13077 return { 13078 opened: isEditorPanelOpened(panelName), 13079 isEnabled: isEditorPanelEnabled(panelName) 13080 }; 13081 }, [panelName]); 13082 const { 13083 toggleEditorPanelOpened 13084 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13085 if (undefined === name) { 13086 true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0; 13087 } 13088 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 13089 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel, { 13090 label: title, 13091 panelName: panelName 13092 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, { 13093 children: isEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 13094 className: className, 13095 title: title, 13096 icon: icon, 13097 opened: opened, 13098 onToggle: () => toggleEditorPanelOpened(panelName), 13099 children: children 13100 }) 13101 })] 13102 }); 13103 }; 13104 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; 13105 /* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel); 13106 13107 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js 13108 /** 13109 * WordPress dependencies 13110 */ 13111 13112 13113 13114 13115 const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0; 13116 13117 /** 13118 * Plugins may want to add an item to the menu either for every block 13119 * or only for the specific ones provided in the `allowedBlocks` component property. 13120 * 13121 * If there are multiple blocks selected the item will be rendered if every block 13122 * is of one allowed type (not necessarily the same). 13123 * 13124 * @param {string[]} selectedBlocks Array containing the names of the blocks selected 13125 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed 13126 * @return {boolean} Whether the item will be rendered or not. 13127 */ 13128 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); 13129 13130 /** 13131 * Renders a new item in the block settings menu. 13132 * 13133 * @param {Object} props Component props. 13134 * @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. 13135 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element. 13136 * @param {string} props.label The menu item text. 13137 * @param {Function} props.onClick Callback function to be executed when the user click the menu item. 13138 * @param {boolean} [props.small] Whether to render the label or not. 13139 * @param {string} [props.role] The ARIA role for the menu item. 13140 * 13141 * @example 13142 * ```js 13143 * // Using ES5 syntax 13144 * var __ = wp.i18n.__; 13145 * var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem; 13146 * 13147 * function doOnClick(){ 13148 * // To be called when the user clicks the menu item. 13149 * } 13150 * 13151 * function MyPluginBlockSettingsMenuItem() { 13152 * return React.createElement( 13153 * PluginBlockSettingsMenuItem, 13154 * { 13155 * allowedBlocks: [ 'core/paragraph' ], 13156 * icon: 'dashicon-name', 13157 * label: __( 'Menu item text' ), 13158 * onClick: doOnClick, 13159 * } 13160 * ); 13161 * } 13162 * ``` 13163 * 13164 * @example 13165 * ```jsx 13166 * // Using ESNext syntax 13167 * import { __ } from '@wordpress/i18n'; 13168 * import { PluginBlockSettingsMenuItem } from '@wordpress/editor'; 13169 * 13170 * const doOnClick = ( ) => { 13171 * // To be called when the user clicks the menu item. 13172 * }; 13173 * 13174 * const MyPluginBlockSettingsMenuItem = () => ( 13175 * <PluginBlockSettingsMenuItem 13176 * allowedBlocks={ [ 'core/paragraph' ] } 13177 * icon='dashicon-name' 13178 * label={ __( 'Menu item text' ) } 13179 * onClick={ doOnClick } /> 13180 * ); 13181 * ``` 13182 * 13183 * @return {Component} The component to be rendered. 13184 */ 13185 const PluginBlockSettingsMenuItem = ({ 13186 allowedBlocks, 13187 icon, 13188 label, 13189 onClick, 13190 small, 13191 role 13192 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 13193 children: ({ 13194 selectedBlocks, 13195 onClose 13196 }) => { 13197 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { 13198 return null; 13199 } 13200 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 13201 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), 13202 icon: icon, 13203 label: small ? label : undefined, 13204 role: role, 13205 children: !small && label 13206 }); 13207 } 13208 }); 13209 /* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); 13210 13211 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js 13212 /** 13213 * WordPress dependencies 13214 */ 13215 13216 13217 13218 13219 13220 /** 13221 * 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. 13222 * The text within the component appears as the menu item label. 13223 * 13224 * @param {Object} props Component properties. 13225 * @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. 13226 * @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. 13227 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. 13228 * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. 13229 * 13230 * @example 13231 * ```js 13232 * // Using ES5 syntax 13233 * var __ = wp.i18n.__; 13234 * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem; 13235 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. 13236 * 13237 * function onButtonClick() { 13238 * alert( 'Button clicked.' ); 13239 * } 13240 * 13241 * function MyButtonMoreMenuItem() { 13242 * return wp.element.createElement( 13243 * PluginMoreMenuItem, 13244 * { 13245 * icon: moreIcon, 13246 * onClick: onButtonClick, 13247 * }, 13248 * __( 'My button title' ) 13249 * ); 13250 * } 13251 * ``` 13252 * 13253 * @example 13254 * ```jsx 13255 * // Using ESNext syntax 13256 * import { __ } from '@wordpress/i18n'; 13257 * import { PluginMoreMenuItem } from '@wordpress/editor'; 13258 * import { more } from '@wordpress/icons'; 13259 * 13260 * function onButtonClick() { 13261 * alert( 'Button clicked.' ); 13262 * } 13263 * 13264 * const MyButtonMoreMenuItem = () => ( 13265 * <PluginMoreMenuItem 13266 * icon={ more } 13267 * onClick={ onButtonClick } 13268 * > 13269 * { __( 'My button title' ) } 13270 * </PluginMoreMenuItem> 13271 * ); 13272 * ``` 13273 * 13274 * @return {Component} The component to be rendered. 13275 */ 13276 /* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 13277 var _ownProps$as; 13278 return { 13279 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, 13280 icon: ownProps.icon || context.icon, 13281 name: 'core/plugin-more-menu' 13282 }; 13283 }))(action_item)); 13284 13285 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js 13286 /** 13287 * WordPress dependencies 13288 */ 13289 13290 13291 13292 const { 13293 Fill: plugin_post_publish_panel_Fill, 13294 Slot: plugin_post_publish_panel_Slot 13295 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel'); 13296 13297 /** 13298 * Renders provided content to the post-publish panel in the publish flow 13299 * (side panel that opens after a user publishes the post). 13300 * 13301 * @param {Object} props Component properties. 13302 * @param {string} [props.className] An optional class name added to the panel. 13303 * @param {string} [props.title] Title displayed at the top of the panel. 13304 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. 13305 * @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. 13306 * @param {Element} props.children Children to be rendered 13307 * 13308 * @example 13309 * ```jsx 13310 * // Using ESNext syntax 13311 * import { __ } from '@wordpress/i18n'; 13312 * import { PluginPostPublishPanel } from '@wordpress/editor'; 13313 * 13314 * const MyPluginPostPublishPanel = () => ( 13315 * <PluginPostPublishPanel 13316 * className="my-plugin-post-publish-panel" 13317 * title={ __( 'My panel title' ) } 13318 * initialOpen={ true } 13319 * > 13320 * { __( 'My panel content' ) } 13321 * </PluginPostPublishPanel> 13322 * ); 13323 * ``` 13324 * 13325 * @return {Component} The component to be rendered. 13326 */ 13327 const PluginPostPublishPanel = ({ 13328 children, 13329 className, 13330 title, 13331 initialOpen = false, 13332 icon 13333 }) => { 13334 const { 13335 icon: pluginIcon 13336 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 13337 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, { 13338 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 13339 className: className, 13340 initialOpen: initialOpen || !title, 13341 title: title, 13342 icon: icon !== null && icon !== void 0 ? icon : pluginIcon, 13343 children: children 13344 }) 13345 }); 13346 }; 13347 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; 13348 /* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel); 13349 13350 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js 13351 /** 13352 * Defines as extensibility slot for the Summary panel. 13353 */ 13354 13355 /** 13356 * WordPress dependencies 13357 */ 13358 13359 13360 const { 13361 Fill: plugin_post_status_info_Fill, 13362 Slot: plugin_post_status_info_Slot 13363 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo'); 13364 13365 /** 13366 * Renders a row in the Summary panel of the Document sidebar. 13367 * It should be noted that this is named and implemented around the function it serves 13368 * and not its location, which may change in future iterations. 13369 * 13370 * @param {Object} props Component properties. 13371 * @param {string} [props.className] An optional class name added to the row. 13372 * @param {Element} props.children Children to be rendered. 13373 * 13374 * @example 13375 * ```js 13376 * // Using ES5 syntax 13377 * var __ = wp.i18n.__; 13378 * var PluginPostStatusInfo = wp.editor.PluginPostStatusInfo; 13379 * 13380 * function MyPluginPostStatusInfo() { 13381 * return React.createElement( 13382 * PluginPostStatusInfo, 13383 * { 13384 * className: 'my-plugin-post-status-info', 13385 * }, 13386 * __( 'My post status info' ) 13387 * ) 13388 * } 13389 * ``` 13390 * 13391 * @example 13392 * ```jsx 13393 * // Using ESNext syntax 13394 * import { __ } from '@wordpress/i18n'; 13395 * import { PluginPostStatusInfo } from '@wordpress/editor'; 13396 * 13397 * const MyPluginPostStatusInfo = () => ( 13398 * <PluginPostStatusInfo 13399 * className="my-plugin-post-status-info" 13400 * > 13401 * { __( 'My post status info' ) } 13402 * </PluginPostStatusInfo> 13403 * ); 13404 * ``` 13405 * 13406 * @return {Component} The component to be rendered. 13407 */ 13408 const PluginPostStatusInfo = ({ 13409 children, 13410 className 13411 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, { 13412 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 13413 className: className, 13414 children: children 13415 }) 13416 }); 13417 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; 13418 /* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo); 13419 13420 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js 13421 /** 13422 * WordPress dependencies 13423 */ 13424 13425 13426 13427 const { 13428 Fill: plugin_pre_publish_panel_Fill, 13429 Slot: plugin_pre_publish_panel_Slot 13430 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel'); 13431 13432 /** 13433 * Renders provided content to the pre-publish side panel in the publish flow 13434 * (side panel that opens when a user first pushes "Publish" from the main editor). 13435 * 13436 * @param {Object} props Component props. 13437 * @param {string} [props.className] An optional class name added to the panel. 13438 * @param {string} [props.title] Title displayed at the top of the panel. 13439 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. 13440 * When no title is provided it is always opened. 13441 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) 13442 * icon slug string, or an SVG WP element, to be rendered when 13443 * the sidebar is pinned to toolbar. 13444 * @param {Element} props.children Children to be rendered 13445 * 13446 * @example 13447 * ```jsx 13448 * // Using ESNext syntax 13449 * import { __ } from '@wordpress/i18n'; 13450 * import { PluginPrePublishPanel } from '@wordpress/editor'; 13451 * 13452 * const MyPluginPrePublishPanel = () => ( 13453 * <PluginPrePublishPanel 13454 * className="my-plugin-pre-publish-panel" 13455 * title={ __( 'My panel title' ) } 13456 * initialOpen={ true } 13457 * > 13458 * { __( 'My panel content' ) } 13459 * </PluginPrePublishPanel> 13460 * ); 13461 * ``` 13462 * 13463 * @return {Component} The component to be rendered. 13464 */ 13465 const PluginPrePublishPanel = ({ 13466 children, 13467 className, 13468 title, 13469 initialOpen = false, 13470 icon 13471 }) => { 13472 const { 13473 icon: pluginIcon 13474 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 13475 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, { 13476 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 13477 className: className, 13478 initialOpen: initialOpen || !title, 13479 title: title, 13480 icon: icon !== null && icon !== void 0 ? icon : pluginIcon, 13481 children: children 13482 }) 13483 }); 13484 }; 13485 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; 13486 /* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel); 13487 13488 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js 13489 /** 13490 * WordPress dependencies 13491 */ 13492 13493 13494 13495 13496 13497 /** 13498 * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided. 13499 * The text within the component appears as the menu item label. 13500 * 13501 * @param {Object} props Component properties. 13502 * @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. 13503 * @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. 13504 * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item. 13505 * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component. 13506 * 13507 * @example 13508 * ```jsx 13509 * import { __ } from '@wordpress/i18n'; 13510 * import { PluginPreviewMenuItem } from '@wordpress/editor'; 13511 * import { external } from '@wordpress/icons'; 13512 * 13513 * function onPreviewClick() { 13514 * // Handle preview action 13515 * } 13516 * 13517 * const ExternalPreviewMenuItem = () => ( 13518 * <PreviewDropdownMenuItem 13519 * icon={ external } 13520 * onClick={ onPreviewClick } 13521 * > 13522 * { __( 'Preview in new tab' ) } 13523 * </PreviewDropdownMenuItem> 13524 * ); 13525 * registerPlugin( 'external-preview-menu-item', { 13526 * render: ExternalPreviewMenuItem, 13527 * } ); 13528 * ``` 13529 * 13530 * @return {Component} The rendered menu item component. 13531 */ 13532 /* harmony default export */ const plugin_preview_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 13533 var _ownProps$as; 13534 return { 13535 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, 13536 icon: ownProps.icon || context.icon, 13537 name: 'core/plugin-preview-menu' 13538 }; 13539 }))(action_item)); 13540 13541 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js 13542 /** 13543 * WordPress dependencies 13544 */ 13545 13546 13547 13548 13549 /** 13550 * Internal dependencies 13551 */ 13552 13553 13554 /** 13555 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. 13556 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. 13557 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: 13558 * 13559 * ```js 13560 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); 13561 * ``` 13562 * 13563 * @see PluginSidebarMoreMenuItem 13564 * 13565 * @param {Object} props Element props. 13566 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. 13567 * @param {string} [props.className] An optional class name added to the sidebar body. 13568 * @param {string} props.title Title displayed at the top of the sidebar. 13569 * @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. 13570 * @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. 13571 * 13572 * @example 13573 * ```js 13574 * // Using ES5 syntax 13575 * var __ = wp.i18n.__; 13576 * var el = React.createElement; 13577 * var PanelBody = wp.components.PanelBody; 13578 * var PluginSidebar = wp.editor.PluginSidebar; 13579 * var moreIcon = React.createElement( 'svg' ); //... svg element. 13580 * 13581 * function MyPluginSidebar() { 13582 * return el( 13583 * PluginSidebar, 13584 * { 13585 * name: 'my-sidebar', 13586 * title: 'My sidebar title', 13587 * icon: moreIcon, 13588 * }, 13589 * el( 13590 * PanelBody, 13591 * {}, 13592 * __( 'My sidebar content' ) 13593 * ) 13594 * ); 13595 * } 13596 * ``` 13597 * 13598 * @example 13599 * ```jsx 13600 * // Using ESNext syntax 13601 * import { __ } from '@wordpress/i18n'; 13602 * import { PanelBody } from '@wordpress/components'; 13603 * import { PluginSidebar } from '@wordpress/editor'; 13604 * import { more } from '@wordpress/icons'; 13605 * 13606 * const MyPluginSidebar = () => ( 13607 * <PluginSidebar 13608 * name="my-sidebar" 13609 * title="My sidebar title" 13610 * icon={ more } 13611 * > 13612 * <PanelBody> 13613 * { __( 'My sidebar content' ) } 13614 * </PanelBody> 13615 * </PluginSidebar> 13616 * ); 13617 * ``` 13618 */ 13619 13620 function PluginSidebar({ 13621 className, 13622 ...props 13623 }) { 13624 const { 13625 postTitle 13626 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13627 return { 13628 postTitle: select(store_store).getEditedPostAttribute('title') 13629 }; 13630 }, []); 13631 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, { 13632 panelClassName: className, 13633 className: "editor-sidebar", 13634 smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'), 13635 scope: "core", 13636 ...props 13637 }); 13638 } 13639 13640 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js 13641 /** 13642 * WordPress dependencies 13643 */ 13644 13645 13646 /** 13647 * Renders a menu item in `Plugins` group in `More Menu` drop down, 13648 * and can be used to activate the corresponding `PluginSidebar` component. 13649 * The text within the component appears as the menu item label. 13650 * 13651 * @param {Object} props Component props. 13652 * @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. 13653 * @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. 13654 * 13655 * @example 13656 * ```js 13657 * // Using ES5 syntax 13658 * var __ = wp.i18n.__; 13659 * var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem; 13660 * var moreIcon = React.createElement( 'svg' ); //... svg element. 13661 * 13662 * function MySidebarMoreMenuItem() { 13663 * return React.createElement( 13664 * PluginSidebarMoreMenuItem, 13665 * { 13666 * target: 'my-sidebar', 13667 * icon: moreIcon, 13668 * }, 13669 * __( 'My sidebar title' ) 13670 * ) 13671 * } 13672 * ``` 13673 * 13674 * @example 13675 * ```jsx 13676 * // Using ESNext syntax 13677 * import { __ } from '@wordpress/i18n'; 13678 * import { PluginSidebarMoreMenuItem } from '@wordpress/editor'; 13679 * import { more } from '@wordpress/icons'; 13680 * 13681 * const MySidebarMoreMenuItem = () => ( 13682 * <PluginSidebarMoreMenuItem 13683 * target="my-sidebar" 13684 * icon={ more } 13685 * > 13686 * { __( 'My sidebar title' ) } 13687 * </PluginSidebarMoreMenuItem> 13688 * ); 13689 * ``` 13690 * 13691 * @return {Component} The component to be rendered. 13692 */ 13693 13694 function PluginSidebarMoreMenuItem(props) { 13695 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem 13696 // Menu item is marked with unstable prop for backward compatibility. 13697 // @see https://github.com/WordPress/gutenberg/issues/14457 13698 , { 13699 __unstableExplicitMenuItem: true, 13700 scope: "core", 13701 ...props 13702 }); 13703 } 13704 13705 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js 13706 /** 13707 * WordPress dependencies 13708 */ 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 /** 13720 * Internal dependencies 13721 */ 13722 13723 13724 13725 13726 function SwapTemplateButton({ 13727 onClick 13728 }) { 13729 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 13730 const { 13731 postType, 13732 postId 13733 } = useEditedPostContext(); 13734 const availableTemplates = useAvailableTemplates(postType); 13735 const { 13736 editEntityRecord 13737 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 13738 if (!availableTemplates?.length) { 13739 return null; 13740 } 13741 const onTemplateSelect = async template => { 13742 editEntityRecord('postType', postType, postId, { 13743 template: template.name 13744 }, { 13745 undoIgnore: true 13746 }); 13747 setShowModal(false); // Close the template suggestions modal first. 13748 onClick(); 13749 }; 13750 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 13751 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 13752 onClick: () => setShowModal(true), 13753 children: (0,external_wp_i18n_namespaceObject.__)('Swap template') 13754 }), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 13755 title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'), 13756 onRequestClose: () => setShowModal(false), 13757 overlayClassName: "editor-post-template__swap-template-modal", 13758 isFullScreen: true, 13759 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 13760 className: "editor-post-template__swap-template-modal-content", 13761 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatesList, { 13762 postType: postType, 13763 onSelect: onTemplateSelect 13764 }) 13765 }) 13766 })] 13767 }); 13768 } 13769 function TemplatesList({ 13770 postType, 13771 onSelect 13772 }) { 13773 const availableTemplates = useAvailableTemplates(postType); 13774 const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => availableTemplates.map(template => ({ 13775 name: template.slug, 13776 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), 13777 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), 13778 id: template.id 13779 })), [availableTemplates]); 13780 const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns); 13781 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 13782 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 13783 blockPatterns: templatesAsPatterns, 13784 shownPatterns: shownTemplates, 13785 onClickPattern: onSelect 13786 }); 13787 } 13788 13789 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js 13790 /** 13791 * WordPress dependencies 13792 */ 13793 13794 13795 13796 13797 13798 /** 13799 * Internal dependencies 13800 */ 13801 13802 13803 function ResetDefaultTemplate({ 13804 onClick 13805 }) { 13806 const currentTemplateSlug = useCurrentTemplateSlug(); 13807 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 13808 const { 13809 postType, 13810 postId 13811 } = useEditedPostContext(); 13812 const { 13813 editEntityRecord 13814 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 13815 // The default template in a post is indicated by an empty string. 13816 if (!currentTemplateSlug || !allowSwitchingTemplate) { 13817 return null; 13818 } 13819 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 13820 onClick: () => { 13821 editEntityRecord('postType', postType, postId, { 13822 template: '' 13823 }, { 13824 undoIgnore: true 13825 }); 13826 onClick(); 13827 }, 13828 children: (0,external_wp_i18n_namespaceObject.__)('Use default template') 13829 }); 13830 } 13831 13832 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js 13833 /** 13834 * WordPress dependencies 13835 */ 13836 13837 13838 13839 13840 13841 13842 /** 13843 * Internal dependencies 13844 */ 13845 13846 13847 13848 13849 13850 function CreateNewTemplate({ 13851 onClick 13852 }) { 13853 const { 13854 canCreateTemplates 13855 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13856 const { 13857 canUser 13858 } = select(external_wp_coreData_namespaceObject.store); 13859 return { 13860 canCreateTemplates: canUser('create', { 13861 kind: 'postType', 13862 name: 'wp_template' 13863 }) 13864 }; 13865 }, []); 13866 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 13867 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 13868 13869 // The default template in a post is indicated by an empty string. 13870 if (!canCreateTemplates || !allowSwitchingTemplate) { 13871 return null; 13872 } 13873 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 13874 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 13875 onClick: () => { 13876 setIsCreateModalOpen(true); 13877 }, 13878 children: (0,external_wp_i18n_namespaceObject.__)('Create new template') 13879 }), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, { 13880 onClose: () => { 13881 setIsCreateModalOpen(false); 13882 onClick(); 13883 } 13884 })] 13885 }); 13886 } 13887 13888 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js 13889 /** 13890 * WordPress dependencies 13891 */ 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 /** 13902 * Internal dependencies 13903 */ 13904 13905 13906 13907 13908 13909 13910 13911 13912 const block_theme_POPOVER_PROPS = { 13913 className: 'editor-post-template__dropdown', 13914 placement: 'bottom-start' 13915 }; 13916 function BlockThemeControl({ 13917 id 13918 }) { 13919 const { 13920 isTemplateHidden, 13921 onNavigateToEntityRecord, 13922 getEditorSettings, 13923 hasGoBack 13924 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 13925 const { 13926 getRenderingMode, 13927 getEditorSettings: _getEditorSettings 13928 } = unlock(select(store_store)); 13929 const editorSettings = _getEditorSettings(); 13930 return { 13931 isTemplateHidden: getRenderingMode() === 'post-only', 13932 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 13933 getEditorSettings: _getEditorSettings, 13934 hasGoBack: editorSettings.hasOwnProperty('onNavigateToPreviousEntityRecord') 13935 }; 13936 }, []); 13937 const { 13938 get: getPreference 13939 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 13940 const { 13941 editedRecord: template, 13942 hasResolved 13943 } = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', id); 13944 const { 13945 createSuccessNotice 13946 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 13947 const { 13948 setRenderingMode 13949 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13950 const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { 13951 kind: 'postType', 13952 name: 'wp_template' 13953 }), []); 13954 if (!hasResolved) { 13955 return null; 13956 } 13957 13958 // The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing 13959 // and assigns its own backlink to focusMode pages. 13960 const notificationAction = hasGoBack ? [{ 13961 label: (0,external_wp_i18n_namespaceObject.__)('Go back'), 13962 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 13963 }] : undefined; 13964 const mayShowTemplateEditNotice = () => { 13965 if (!getPreference('core/edit-site', 'welcomeGuideTemplate')) { 13966 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), { 13967 type: 'snackbar', 13968 actions: notificationAction 13969 }); 13970 } 13971 }; 13972 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 13973 popoverProps: block_theme_POPOVER_PROPS, 13974 focusOnMount: true, 13975 toggleProps: { 13976 size: 'compact', 13977 variant: 'tertiary', 13978 tooltipPosition: 'middle left' 13979 }, 13980 label: (0,external_wp_i18n_namespaceObject.__)('Template options'), 13981 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title), 13982 icon: null, 13983 children: ({ 13984 onClose 13985 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 13986 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 13987 children: [canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 13988 onClick: () => { 13989 onNavigateToEntityRecord({ 13990 postId: template.id, 13991 postType: 'wp_template' 13992 }); 13993 onClose(); 13994 mayShowTemplateEditNotice(); 13995 }, 13996 children: (0,external_wp_i18n_namespaceObject.__)('Edit template') 13997 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, { 13998 onClick: onClose 13999 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, { 14000 onClick: onClose 14001 }), canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, { 14002 onClick: onClose 14003 })] 14004 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 14005 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 14006 icon: !isTemplateHidden ? library_check : undefined, 14007 isSelected: !isTemplateHidden, 14008 role: "menuitemcheckbox", 14009 onClick: () => { 14010 setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only'); 14011 }, 14012 children: (0,external_wp_i18n_namespaceObject.__)('Show template') 14013 }) 14014 })] 14015 }) 14016 }); 14017 } 14018 14019 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js 14020 /** 14021 * WordPress dependencies 14022 */ 14023 14024 14025 14026 14027 /** 14028 * Internal dependencies 14029 */ 14030 14031 14032 14033 14034 14035 /** 14036 * Displays the template controls based on the current editor settings and user permissions. 14037 * 14038 * @return {JSX.Element|null} The rendered PostTemplatePanel component. 14039 */ 14040 14041 function PostTemplatePanel() { 14042 const { 14043 templateId, 14044 isBlockTheme 14045 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14046 const { 14047 getCurrentTemplateId, 14048 getEditorSettings 14049 } = select(store_store); 14050 return { 14051 templateId: getCurrentTemplateId(), 14052 isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme 14053 }; 14054 }, []); 14055 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 14056 var _select$canUser; 14057 const postTypeSlug = select(store_store).getCurrentPostType(); 14058 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 14059 if (!postType?.viewable) { 14060 return false; 14061 } 14062 const settings = select(store_store).getEditorSettings(); 14063 const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; 14064 if (hasTemplates) { 14065 return true; 14066 } 14067 if (!settings.supportsTemplateMode) { 14068 return false; 14069 } 14070 const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', { 14071 kind: 'postType', 14072 name: 'wp_template' 14073 })) !== null && _select$canUser !== void 0 ? _select$canUser : false; 14074 return canCreateTemplates; 14075 }, []); 14076 const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)(select => { 14077 var _select$canUser2; 14078 return (_select$canUser2 = select(external_wp_coreData_namespaceObject.store).canUser('read', { 14079 kind: 'postType', 14080 name: 'wp_template' 14081 })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false; 14082 }, []); 14083 if ((!isBlockTheme || !canViewTemplates) && isVisible) { 14084 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 14085 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 14086 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme, {}) 14087 }); 14088 } 14089 if (isBlockTheme && !!templateId) { 14090 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 14091 label: (0,external_wp_i18n_namespaceObject.__)('Template'), 14092 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, { 14093 id: templateId 14094 }) 14095 }); 14096 } 14097 return null; 14098 } 14099 14100 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js 14101 const BASE_QUERY = { 14102 _fields: 'id,name', 14103 context: 'view' // Allows non-admins to perform requests. 14104 }; 14105 const AUTHORS_QUERY = { 14106 who: 'authors', 14107 per_page: 50, 14108 ...BASE_QUERY 14109 }; 14110 14111 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js 14112 /** 14113 * WordPress dependencies 14114 */ 14115 14116 14117 14118 14119 14120 14121 /** 14122 * Internal dependencies 14123 */ 14124 14125 14126 function useAuthorsQuery(search) { 14127 const { 14128 authorId, 14129 authors, 14130 postAuthor 14131 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14132 const { 14133 getUser, 14134 getUsers 14135 } = select(external_wp_coreData_namespaceObject.store); 14136 const { 14137 getEditedPostAttribute 14138 } = select(store_store); 14139 const _authorId = getEditedPostAttribute('author'); 14140 const query = { 14141 ...AUTHORS_QUERY 14142 }; 14143 if (search) { 14144 query.search = search; 14145 } 14146 return { 14147 authorId: _authorId, 14148 authors: getUsers(query), 14149 postAuthor: getUser(_authorId, BASE_QUERY) 14150 }; 14151 }, [search]); 14152 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 14153 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { 14154 return { 14155 value: author.id, 14156 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) 14157 }; 14158 }); 14159 14160 // Ensure the current author is included in the dropdown list. 14161 const foundAuthor = fetchedAuthors.findIndex(({ 14162 value 14163 }) => postAuthor?.id === value); 14164 let currentAuthor = []; 14165 if (foundAuthor < 0 && postAuthor) { 14166 currentAuthor = [{ 14167 value: postAuthor.id, 14168 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) 14169 }]; 14170 } else if (foundAuthor < 0 && !postAuthor) { 14171 currentAuthor = [{ 14172 value: 0, 14173 label: (0,external_wp_i18n_namespaceObject.__)('(No author)') 14174 }]; 14175 } 14176 return [...currentAuthor, ...fetchedAuthors]; 14177 }, [authors, postAuthor]); 14178 return { 14179 authorId, 14180 authorOptions, 14181 postAuthor 14182 }; 14183 } 14184 14185 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js 14186 /** 14187 * WordPress dependencies 14188 */ 14189 14190 14191 14192 14193 14194 14195 /** 14196 * Internal dependencies 14197 */ 14198 14199 14200 14201 function PostAuthorCombobox() { 14202 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); 14203 const { 14204 editPost 14205 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14206 const { 14207 authorId, 14208 authorOptions 14209 } = useAuthorsQuery(fieldValue); 14210 14211 /** 14212 * Handle author selection. 14213 * 14214 * @param {number} postAuthorId The selected Author. 14215 */ 14216 const handleSelect = postAuthorId => { 14217 if (!postAuthorId) { 14218 return; 14219 } 14220 editPost({ 14221 author: postAuthorId 14222 }); 14223 }; 14224 14225 /** 14226 * Handle user input. 14227 * 14228 * @param {string} inputValue The current value of the input field. 14229 */ 14230 const handleKeydown = inputValue => { 14231 setFieldValue(inputValue); 14232 }; 14233 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, { 14234 __nextHasNoMarginBottom: true, 14235 __next40pxDefaultSize: true, 14236 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 14237 options: authorOptions, 14238 value: authorId, 14239 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), 14240 onChange: handleSelect, 14241 allowReset: false, 14242 hideLabelFromVision: true 14243 }); 14244 } 14245 14246 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/select.js 14247 /** 14248 * WordPress dependencies 14249 */ 14250 14251 14252 14253 14254 /** 14255 * Internal dependencies 14256 */ 14257 14258 14259 14260 function PostAuthorSelect() { 14261 const { 14262 editPost 14263 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14264 const { 14265 authorId, 14266 authorOptions 14267 } = useAuthorsQuery(); 14268 const setAuthorId = value => { 14269 const author = Number(value); 14270 editPost({ 14271 author 14272 }); 14273 }; 14274 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 14275 __next40pxDefaultSize: true, 14276 __nextHasNoMarginBottom: true, 14277 className: "post-author-selector", 14278 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 14279 options: authorOptions, 14280 onChange: setAuthorId, 14281 value: authorId, 14282 hideLabelFromVision: true 14283 }); 14284 } 14285 14286 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/index.js 14287 /** 14288 * WordPress dependencies 14289 */ 14290 14291 14292 14293 /** 14294 * Internal dependencies 14295 */ 14296 14297 14298 14299 14300 const minimumUsersForCombobox = 25; 14301 14302 /** 14303 * Renders the component for selecting the post author. 14304 * 14305 * @return {Component} The component to be rendered. 14306 */ 14307 function PostAuthor() { 14308 const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => { 14309 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 14310 return authors?.length >= minimumUsersForCombobox; 14311 }, []); 14312 if (showCombobox) { 14313 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {}); 14314 } 14315 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {}); 14316 } 14317 /* harmony default export */ const post_author = (PostAuthor); 14318 14319 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/check.js 14320 /** 14321 * WordPress dependencies 14322 */ 14323 14324 14325 14326 /** 14327 * Internal dependencies 14328 */ 14329 14330 14331 14332 14333 /** 14334 * Wrapper component that renders its children only if the post type supports the author. 14335 * 14336 * @param {Object} props The component props. 14337 * @param {Element} props.children Children to be rendered. 14338 * 14339 * @return {Component|null} The component to be rendered. Return `null` if the post type doesn't 14340 * supports the author or if there are no authors available. 14341 */ 14342 14343 function PostAuthorCheck({ 14344 children 14345 }) { 14346 const { 14347 hasAssignAuthorAction, 14348 hasAuthors 14349 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14350 var _post$_links$wpActio; 14351 const post = select(store_store).getCurrentPost(); 14352 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 14353 return { 14354 hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false, 14355 hasAuthors: authors?.length >= 1 14356 }; 14357 }, []); 14358 if (!hasAssignAuthorAction || !hasAuthors) { 14359 return null; 14360 } 14361 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 14362 supportKeys: "author", 14363 children: children 14364 }); 14365 } 14366 14367 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js 14368 /** 14369 * WordPress dependencies 14370 */ 14371 14372 14373 14374 14375 14376 14377 /** 14378 * Internal dependencies 14379 */ 14380 14381 14382 14383 14384 14385 14386 function PostAuthorToggle({ 14387 isOpen, 14388 onClick 14389 }) { 14390 const { 14391 postAuthor 14392 } = useAuthorsQuery(); 14393 const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)('(No author)'); 14394 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14395 size: "compact", 14396 className: "editor-post-author__panel-toggle", 14397 variant: "tertiary", 14398 "aria-expanded": isOpen, 14399 "aria-label": 14400 // translators: %s: Author name. 14401 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change author: %s'), authorName), 14402 onClick: onClick, 14403 children: authorName 14404 }); 14405 } 14406 14407 /** 14408 * Renders the Post Author Panel component. 14409 * 14410 * @return {Component} The component to be rendered. 14411 */ 14412 function panel_PostAuthor() { 14413 // Use internal state instead of a ref to make sure that the component 14414 // re-renders when the popover's anchor updates. 14415 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 14416 // Memoize popoverProps to avoid returning a new object every time. 14417 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 14418 // Anchor the popover to the middle of the entire row so that it doesn't 14419 // move around when the label changes. 14420 anchor: popoverAnchor, 14421 placement: 'left-start', 14422 offset: 36, 14423 shift: true 14424 }), [popoverAnchor]); 14425 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, { 14426 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 14427 label: (0,external_wp_i18n_namespaceObject.__)('Author'), 14428 ref: setPopoverAnchor, 14429 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 14430 popoverProps: popoverProps, 14431 contentClassName: "editor-post-author__panel-dialog", 14432 focusOnMount: true, 14433 renderToggle: ({ 14434 isOpen, 14435 onToggle 14436 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorToggle, { 14437 isOpen: isOpen, 14438 onClick: onToggle 14439 }), 14440 renderContent: ({ 14441 onClose 14442 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14443 className: "editor-post-author", 14444 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 14445 title: (0,external_wp_i18n_namespaceObject.__)('Author'), 14446 onClose: onClose 14447 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author, { 14448 onClose: onClose 14449 })] 14450 }) 14451 }) 14452 }) 14453 }); 14454 } 14455 /* harmony default export */ const panel = (panel_PostAuthor); 14456 14457 ;// ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js 14458 /** 14459 * WordPress dependencies 14460 */ 14461 14462 14463 14464 14465 /** 14466 * Internal dependencies 14467 */ 14468 14469 14470 const COMMENT_OPTIONS = [{ 14471 label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), 14472 value: 'open', 14473 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 14474 }, { 14475 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 14476 value: 'closed', 14477 description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') 14478 }]; 14479 function PostComments() { 14480 const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { 14481 var _select$getEditedPost; 14482 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; 14483 }, []); 14484 const { 14485 editPost 14486 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14487 const handleStatus = newCommentStatus => editPost({ 14488 comment_status: newCommentStatus 14489 }); 14490 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 14491 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 14492 spacing: 4, 14493 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 14494 className: "editor-change-status__options", 14495 hideLabelFromVision: true, 14496 label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), 14497 options: COMMENT_OPTIONS, 14498 onChange: handleStatus, 14499 selected: commentStatus 14500 }) 14501 }) 14502 }); 14503 } 14504 14505 /** 14506 * A form for managing comment status. 14507 * 14508 * @return {JSX.Element} The rendered PostComments component. 14509 */ 14510 /* harmony default export */ const post_comments = (PostComments); 14511 14512 ;// ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js 14513 /** 14514 * WordPress dependencies 14515 */ 14516 14517 14518 14519 14520 /** 14521 * Internal dependencies 14522 */ 14523 14524 14525 function PostPingbacks() { 14526 const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => { 14527 var _select$getEditedPost; 14528 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('ping_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open'; 14529 }, []); 14530 const { 14531 editPost 14532 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14533 const onTogglePingback = () => editPost({ 14534 ping_status: pingStatus === 'open' ? 'closed' : 'open' 14535 }); 14536 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 14537 __nextHasNoMarginBottom: true, 14538 label: (0,external_wp_i18n_namespaceObject.__)('Enable pingbacks & trackbacks'), 14539 checked: pingStatus === 'open', 14540 onChange: onTogglePingback, 14541 help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 14542 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'), 14543 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about pingbacks & trackbacks') 14544 }) 14545 }); 14546 } 14547 14548 /** 14549 * Renders a control for enabling or disabling pingbacks and trackbacks 14550 * in a WordPress post. 14551 * 14552 * @module PostPingbacks 14553 */ 14554 /* harmony default export */ const post_pingbacks = (PostPingbacks); 14555 14556 ;// ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js 14557 /** 14558 * WordPress dependencies 14559 */ 14560 14561 14562 14563 14564 14565 14566 14567 /** 14568 * Internal dependencies 14569 */ 14570 14571 14572 14573 14574 14575 14576 14577 const panel_PANEL_NAME = 'discussion-panel'; 14578 function ModalContents({ 14579 onClose 14580 }) { 14581 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 14582 className: "editor-post-discussion", 14583 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 14584 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 14585 onClose: onClose 14586 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 14587 spacing: 4, 14588 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 14589 supportKeys: "comments", 14590 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments, {}) 14591 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 14592 supportKeys: "trackbacks", 14593 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks, {}) 14594 })] 14595 })] 14596 }); 14597 } 14598 function PostDiscussionToggle({ 14599 isOpen, 14600 onClick 14601 }) { 14602 const { 14603 commentStatus, 14604 pingStatus, 14605 commentsSupported, 14606 trackbacksSupported 14607 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14608 var _getEditedPostAttribu, _getEditedPostAttribu2; 14609 const { 14610 getEditedPostAttribute 14611 } = select(store_store); 14612 const { 14613 getPostType 14614 } = select(external_wp_coreData_namespaceObject.store); 14615 const postType = getPostType(getEditedPostAttribute('type')); 14616 return { 14617 commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open', 14618 pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open', 14619 commentsSupported: !!postType.supports.comments, 14620 trackbacksSupported: !!postType.supports.trackbacks 14621 }; 14622 }, []); 14623 let label; 14624 if (commentStatus === 'open') { 14625 if (pingStatus === 'open') { 14626 label = (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); 14627 } else { 14628 label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)('Comments only') : (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'); 14629 } 14630 } else if (pingStatus === 'open') { 14631 label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)('Pings only') : (0,external_wp_i18n_namespaceObject.__)('Pings enabled'); 14632 } else { 14633 label = (0,external_wp_i18n_namespaceObject.__)('Closed'); 14634 } 14635 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 14636 size: "compact", 14637 className: "editor-post-discussion__panel-toggle", 14638 variant: "tertiary", 14639 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion options'), 14640 "aria-expanded": isOpen, 14641 onClick: onClick, 14642 children: label 14643 }); 14644 } 14645 14646 /** 14647 * This component allows to update comment and pingback 14648 * settings for the current post. Internally there are 14649 * checks whether the current post has support for the 14650 * above and if the `discussion-panel` panel is enabled. 14651 * 14652 * @return {JSX.Element|null} The rendered PostDiscussionPanel component. 14653 */ 14654 function PostDiscussionPanel() { 14655 const { 14656 isEnabled 14657 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14658 const { 14659 isEditorPanelEnabled 14660 } = select(store_store); 14661 return { 14662 isEnabled: isEditorPanelEnabled(panel_PANEL_NAME) 14663 }; 14664 }, []); 14665 14666 // Use internal state instead of a ref to make sure that the component 14667 // re-renders when the popover's anchor updates. 14668 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 14669 // Memoize popoverProps to avoid returning a new object every time. 14670 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 14671 // Anchor the popover to the middle of the entire row so that it doesn't 14672 // move around when the label changes. 14673 anchor: popoverAnchor, 14674 placement: 'left-start', 14675 offset: 36, 14676 shift: true 14677 }), [popoverAnchor]); 14678 if (!isEnabled) { 14679 return null; 14680 } 14681 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 14682 supportKeys: ['comments', 'trackbacks'], 14683 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 14684 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 14685 ref: setPopoverAnchor, 14686 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 14687 popoverProps: popoverProps, 14688 className: "editor-post-discussion__panel-dropdown", 14689 contentClassName: "editor-post-discussion__panel-dialog", 14690 focusOnMount: true, 14691 renderToggle: ({ 14692 isOpen, 14693 onToggle 14694 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionToggle, { 14695 isOpen: isOpen, 14696 onClick: onToggle 14697 }), 14698 renderContent: ({ 14699 onClose 14700 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, { 14701 onClose: onClose 14702 }) 14703 }) 14704 }) 14705 }); 14706 } 14707 14708 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js 14709 /** 14710 * WordPress dependencies 14711 */ 14712 14713 14714 14715 14716 14717 14718 /** 14719 * Internal dependencies 14720 */ 14721 14722 14723 /** 14724 * Renders an editable textarea for the post excerpt. 14725 * Templates, template parts and patterns use the `excerpt` field as a description semantically. 14726 * Additionally templates and template parts override the `excerpt` field as `description` in 14727 * REST API. So this component handles proper labeling and updating the edited entity. 14728 * 14729 * @param {Object} props - Component props. 14730 * @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label. 14731 * @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur. 14732 */ 14733 14734 function PostExcerpt({ 14735 hideLabelFromVision = false, 14736 updateOnBlur = false 14737 }) { 14738 const { 14739 excerpt, 14740 shouldUseDescriptionLabel, 14741 usedAttribute 14742 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14743 const { 14744 getCurrentPostType, 14745 getEditedPostAttribute 14746 } = select(store_store); 14747 const postType = getCurrentPostType(); 14748 // This special case is unfortunate, but the REST API of wp_template and wp_template_part 14749 // support the excerpt field throught the "description" field rather than "excerpt". 14750 const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt'; 14751 return { 14752 excerpt: getEditedPostAttribute(_usedAttribute), 14753 // There are special cases where we want to label the excerpt as a description. 14754 shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType), 14755 usedAttribute: _usedAttribute 14756 }; 14757 }, []); 14758 const { 14759 editPost 14760 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14761 const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)); 14762 const updatePost = value => { 14763 editPost({ 14764 [usedAttribute]: value 14765 }); 14766 }; 14767 const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Write a description (optional)') : (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'); 14768 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 14769 className: "editor-post-excerpt", 14770 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 14771 __nextHasNoMarginBottom: true, 14772 label: label, 14773 hideLabelFromVision: hideLabelFromVision, 14774 className: "editor-post-excerpt__textarea", 14775 onChange: updateOnBlur ? setLocalExcerpt : updatePost, 14776 onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined, 14777 value: updateOnBlur ? localExcerpt : excerpt, 14778 help: !shouldUseDescriptionLabel ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 14779 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'), 14780 children: (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts') 14781 }) : (0,external_wp_i18n_namespaceObject.__)('Write a description') 14782 }) 14783 }); 14784 } 14785 14786 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js 14787 /** 14788 * Internal dependencies 14789 */ 14790 14791 14792 /** 14793 * Component for checking if the post type supports the excerpt field. 14794 * 14795 * @param {Object} props Props. 14796 * @param {Element} props.children Children to be rendered. 14797 * 14798 * @return {Component} The component to be rendered. 14799 */ 14800 14801 function PostExcerptCheck({ 14802 children 14803 }) { 14804 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 14805 supportKeys: "excerpt", 14806 children: children 14807 }); 14808 } 14809 /* harmony default export */ const post_excerpt_check = (PostExcerptCheck); 14810 14811 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js 14812 /** 14813 * Defines as extensibility slot for the Excerpt panel. 14814 */ 14815 14816 /** 14817 * WordPress dependencies 14818 */ 14819 14820 14821 const { 14822 Fill: plugin_Fill, 14823 Slot: plugin_Slot 14824 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostExcerpt'); 14825 14826 /** 14827 * Renders a post excerpt panel in the post sidebar. 14828 * 14829 * @param {Object} props Component properties. 14830 * @param {string} [props.className] An optional class name added to the row. 14831 * @param {Element} props.children Children to be rendered. 14832 * 14833 * @example 14834 * ```js 14835 * // Using ES5 syntax 14836 * var __ = wp.i18n.__; 14837 * var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt; 14838 * 14839 * function MyPluginPostExcerpt() { 14840 * return React.createElement( 14841 * PluginPostExcerpt, 14842 * { 14843 * className: 'my-plugin-post-excerpt', 14844 * }, 14845 * __( 'Post excerpt custom content' ) 14846 * ) 14847 * } 14848 * ``` 14849 * 14850 * @example 14851 * ```jsx 14852 * // Using ESNext syntax 14853 * import { __ } from '@wordpress/i18n'; 14854 * import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post'; 14855 * 14856 * const MyPluginPostExcerpt = () => ( 14857 * <PluginPostExcerpt className="my-plugin-post-excerpt"> 14858 * { __( 'Post excerpt custom content' ) } 14859 * </PluginPostExcerpt> 14860 * ); 14861 * ``` 14862 * 14863 * @return {Component} The component to be rendered. 14864 */ 14865 const PluginPostExcerpt = ({ 14866 children, 14867 className 14868 }) => { 14869 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, { 14870 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { 14871 className: className, 14872 children: children 14873 }) 14874 }); 14875 }; 14876 PluginPostExcerpt.Slot = plugin_Slot; 14877 /* harmony default export */ const post_excerpt_plugin = (PluginPostExcerpt); 14878 14879 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js 14880 /** 14881 * WordPress dependencies 14882 */ 14883 14884 14885 14886 14887 14888 14889 14890 14891 /** 14892 * Internal dependencies 14893 */ 14894 14895 14896 14897 14898 14899 14900 /** 14901 * Module Constants 14902 */ 14903 14904 14905 14906 const post_excerpt_panel_PANEL_NAME = 'post-excerpt'; 14907 function ExcerptPanel() { 14908 const { 14909 isOpened, 14910 isEnabled, 14911 postType 14912 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14913 const { 14914 isEditorPanelOpened, 14915 isEditorPanelEnabled, 14916 getCurrentPostType 14917 } = select(store_store); 14918 return { 14919 isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME), 14920 isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME), 14921 postType: getCurrentPostType() 14922 }; 14923 }, []); 14924 const { 14925 toggleEditorPanelOpened 14926 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14927 const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME); 14928 if (!isEnabled) { 14929 return null; 14930 } 14931 14932 // There are special cases where we want to label the excerpt as a description. 14933 const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType); 14934 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 14935 title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'), 14936 opened: isOpened, 14937 onToggle: toggleExcerptPanel, 14938 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { 14939 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 14940 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills] 14941 }) 14942 }) 14943 }); 14944 } 14945 14946 /** 14947 * Is rendered if the post type supports excerpts and allows editing the excerpt. 14948 * 14949 * @return {JSX.Element} The rendered PostExcerptPanel component. 14950 */ 14951 function PostExcerptPanel() { 14952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 14953 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {}) 14954 }); 14955 } 14956 function PrivatePostExcerptPanel() { 14957 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 14958 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {}) 14959 }); 14960 } 14961 function PrivateExcerpt() { 14962 const { 14963 shouldRender, 14964 excerpt, 14965 shouldBeUsedAsDescription, 14966 allowEditing 14967 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 14968 const { 14969 getCurrentPostType, 14970 getCurrentPostId, 14971 getEditedPostAttribute, 14972 isEditorPanelEnabled 14973 } = select(store_store); 14974 const postType = getCurrentPostType(); 14975 const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType); 14976 const isPattern = postType === 'wp_block'; 14977 // These post types use the `excerpt` field as a description semantically, so we need to 14978 // handle proper labeling and some flows where we should always render them as text. 14979 const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern; 14980 const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt'; 14981 // We need to fetch the entity in this case to check if we'll allow editing. 14982 const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId()); 14983 // For post types that use excerpt as description, we do not abide 14984 // by the `isEnabled` panel flag in order to render them as text. 14985 const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription; 14986 return { 14987 excerpt: getEditedPostAttribute(_usedAttribute), 14988 shouldRender: _shouldRender, 14989 shouldBeUsedAsDescription: _shouldBeUsedAsDescription, 14990 // If we should render, allow editing for all post types that are not used as description. 14991 // For the rest allow editing only for user generated entities. 14992 allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom) 14993 }; 14994 }, []); 14995 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 14996 const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'); 14997 // Memoize popoverProps to avoid returning a new object every time. 14998 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 14999 // Anchor the popover to the middle of the entire row so that it doesn't 15000 // move around when the label changes. 15001 anchor: popoverAnchor, 15002 'aria-label': label, 15003 headerTitle: label, 15004 placement: 'left-start', 15005 offset: 36, 15006 shift: true 15007 }), [popoverAnchor, label]); 15008 if (!shouldRender) { 15009 return false; 15010 } 15011 const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 15012 align: "left", 15013 numberOfLines: 4, 15014 truncate: allowEditing, 15015 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) 15016 }); 15017 if (!allowEditing) { 15018 return excerptText; 15019 } 15020 const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…'); 15021 const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt'); 15022 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 15023 children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 15024 className: "editor-post-excerpt__dropdown", 15025 contentClassName: "editor-post-excerpt__dropdown__content", 15026 popoverProps: popoverProps, 15027 focusOnMount: true, 15028 ref: setPopoverAnchor, 15029 renderToggle: ({ 15030 onToggle 15031 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15032 __next40pxDefaultSize: true, 15033 onClick: onToggle, 15034 variant: "link", 15035 children: excerptText ? triggerEditLabel : excerptPlaceholder 15036 }), 15037 renderContent: ({ 15038 onClose 15039 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15040 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 15041 title: label, 15042 onClose: onClose 15043 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 15044 spacing: 4, 15045 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, { 15046 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15047 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, { 15048 hideLabelFromVision: true, 15049 updateOnBlur: true 15050 }), fills] 15051 }) 15052 }) 15053 })] 15054 }) 15055 })] 15056 }); 15057 } 15058 15059 ;// ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js 15060 /** 15061 * WordPress dependencies 15062 */ 15063 15064 15065 15066 /** 15067 * Internal dependencies 15068 */ 15069 15070 15071 /** 15072 * Checks if the current theme supports specific features and renders the children if supported. 15073 * 15074 * @param {Object} props The component props. 15075 * @param {Element} props.children The children to render if the theme supports the specified features. 15076 * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check. 15077 * 15078 * @return {JSX.Element|null} The rendered children if the theme supports the specified features, otherwise null. 15079 */ 15080 function ThemeSupportCheck({ 15081 children, 15082 supportKeys 15083 }) { 15084 const { 15085 postType, 15086 themeSupports 15087 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15088 return { 15089 postType: select(store_store).getEditedPostAttribute('type'), 15090 themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports() 15091 }; 15092 }, []); 15093 const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => { 15094 var _themeSupports$key; 15095 const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; 15096 // 'post-thumbnails' can be boolean or an array of post types. 15097 // In the latter case, we need to verify `postType` exists 15098 // within `supported`. If `postType` isn't passed, then the check 15099 // should fail. 15100 if ('post-thumbnails' === key && Array.isArray(supported)) { 15101 return supported.includes(postType); 15102 } 15103 return supported; 15104 }); 15105 if (!isSupported) { 15106 return null; 15107 } 15108 return children; 15109 } 15110 15111 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js 15112 /** 15113 * Internal dependencies 15114 */ 15115 15116 15117 15118 /** 15119 * Wrapper component that renders its children only if the post type supports a featured image 15120 * and the theme supports post thumbnails. 15121 * 15122 * @param {Object} props Props. 15123 * @param {Element} props.children Children to be rendered. 15124 * 15125 * @return {Component} The component to be rendered. 15126 */ 15127 15128 function PostFeaturedImageCheck({ 15129 children 15130 }) { 15131 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, { 15132 supportKeys: "post-thumbnails", 15133 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 15134 supportKeys: "thumbnail", 15135 children: children 15136 }) 15137 }); 15138 } 15139 /* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck); 15140 15141 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js 15142 /** 15143 * WordPress dependencies 15144 */ 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 /** 15156 * Internal dependencies 15157 */ 15158 15159 15160 15161 15162 const ALLOWED_MEDIA_TYPES = ['image']; 15163 15164 // Used when labels from post type were not yet loaded or when they are not present. 15165 const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image'); 15166 const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image'); 15167 const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 15168 children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.') 15169 }); 15170 function getMediaDetails(media, postId) { 15171 var _media$media_details$, _media$media_details$2; 15172 if (!media) { 15173 return {}; 15174 } 15175 const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId); 15176 if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) { 15177 return { 15178 mediaWidth: media.media_details.sizes[defaultSize].width, 15179 mediaHeight: media.media_details.sizes[defaultSize].height, 15180 mediaSourceUrl: media.media_details.sizes[defaultSize].source_url 15181 }; 15182 } 15183 15184 // Use fallbackSize when defaultSize is not available. 15185 const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId); 15186 if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) { 15187 return { 15188 mediaWidth: media.media_details.sizes[fallbackSize].width, 15189 mediaHeight: media.media_details.sizes[fallbackSize].height, 15190 mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url 15191 }; 15192 } 15193 15194 // Use full image size when fallbackSize and defaultSize are not available. 15195 return { 15196 mediaWidth: media.media_details.width, 15197 mediaHeight: media.media_details.height, 15198 mediaSourceUrl: media.source_url 15199 }; 15200 } 15201 function PostFeaturedImage({ 15202 currentPostId, 15203 featuredImageId, 15204 onUpdateImage, 15205 onRemoveImage, 15206 media, 15207 postType, 15208 noticeUI, 15209 noticeOperations 15210 }) { 15211 const toggleRef = (0,external_wp_element_namespaceObject.useRef)(); 15212 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); 15213 const { 15214 getSettings 15215 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 15216 const { 15217 mediaSourceUrl 15218 } = getMediaDetails(media, currentPostId); 15219 function onDropFiles(filesList) { 15220 getSettings().mediaUpload({ 15221 allowedTypes: ALLOWED_MEDIA_TYPES, 15222 filesList, 15223 onFileChange([image]) { 15224 if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { 15225 setIsLoading(true); 15226 return; 15227 } 15228 if (image) { 15229 onUpdateImage(image); 15230 } 15231 setIsLoading(false); 15232 }, 15233 onError(message) { 15234 noticeOperations.removeAllNotices(); 15235 noticeOperations.createErrorNotice(message); 15236 } 15237 }); 15238 } 15239 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, { 15240 children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15241 className: "editor-post-featured-image", 15242 children: [media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15243 id: `editor-post-featured-image-$featuredImageId}-describedby`, 15244 className: "hidden", 15245 children: [media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( 15246 // Translators: %s: The selected image alt text. 15247 (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( 15248 // Translators: %s: The selected image filename. 15249 (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)] 15250 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { 15251 fallback: instructions, 15252 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, { 15253 title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 15254 onSelect: onUpdateImage, 15255 unstableFeaturedImageFlow: true, 15256 allowedTypes: ALLOWED_MEDIA_TYPES, 15257 modalClass: "editor-post-featured-image__media-modal", 15258 render: ({ 15259 open 15260 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15261 className: "editor-post-featured-image__container", 15262 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 15263 __next40pxDefaultSize: true, 15264 ref: toggleRef, 15265 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', 15266 onClick: open, 15267 "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the featured image'), 15268 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-$featuredImageId}-describedby`, 15269 "aria-haspopup": "dialog", 15270 disabled: isLoading, 15271 accessibleWhenDisabled: true, 15272 children: [!!featuredImageId && media && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 15273 className: "editor-post-featured-image__preview-image", 15274 src: mediaSourceUrl, 15275 alt: "" 15276 }), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)] 15277 }), !!featuredImageId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15278 className: "editor-post-featured-image__actions", 15279 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15280 __next40pxDefaultSize: true, 15281 className: "editor-post-featured-image__action", 15282 onClick: open, 15283 "aria-haspopup": "dialog", 15284 children: (0,external_wp_i18n_namespaceObject.__)('Replace') 15285 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15286 __next40pxDefaultSize: true, 15287 className: "editor-post-featured-image__action", 15288 onClick: () => { 15289 onRemoveImage(); 15290 toggleRef.current.focus(); 15291 }, 15292 children: (0,external_wp_i18n_namespaceObject.__)('Remove') 15293 })] 15294 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { 15295 onFilesDrop: onDropFiles 15296 })] 15297 }), 15298 value: featuredImageId 15299 }) 15300 })] 15301 })] 15302 }); 15303 } 15304 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { 15305 const { 15306 getMedia, 15307 getPostType 15308 } = select(external_wp_coreData_namespaceObject.store); 15309 const { 15310 getCurrentPostId, 15311 getEditedPostAttribute 15312 } = select(store_store); 15313 const featuredImageId = getEditedPostAttribute('featured_media'); 15314 return { 15315 media: featuredImageId ? getMedia(featuredImageId, { 15316 context: 'view' 15317 }) : null, 15318 currentPostId: getCurrentPostId(), 15319 postType: getPostType(getEditedPostAttribute('type')), 15320 featuredImageId 15321 }; 15322 }); 15323 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 15324 noticeOperations 15325 }, { 15326 select 15327 }) => { 15328 const { 15329 editPost 15330 } = dispatch(store_store); 15331 return { 15332 onUpdateImage(image) { 15333 editPost({ 15334 featured_media: image.id 15335 }); 15336 }, 15337 onDropImage(filesList) { 15338 select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ 15339 allowedTypes: ['image'], 15340 filesList, 15341 onFileChange([image]) { 15342 editPost({ 15343 featured_media: image.id 15344 }); 15345 }, 15346 onError(message) { 15347 noticeOperations.removeAllNotices(); 15348 noticeOperations.createErrorNotice(message); 15349 } 15350 }); 15351 }, 15352 onRemoveImage() { 15353 editPost({ 15354 featured_media: 0 15355 }); 15356 } 15357 }; 15358 }); 15359 15360 /** 15361 * Renders the component for managing the featured image of a post. 15362 * 15363 * @param {Object} props Props. 15364 * @param {number} props.currentPostId ID of the current post. 15365 * @param {number} props.featuredImageId ID of the featured image. 15366 * @param {Function} props.onUpdateImage Function to call when the image is updated. 15367 * @param {Function} props.onRemoveImage Function to call when the image is removed. 15368 * @param {Object} props.media The media object representing the featured image. 15369 * @param {string} props.postType Post type. 15370 * @param {Element} props.noticeUI UI for displaying notices. 15371 * @param {Object} props.noticeOperations Operations for managing notices. 15372 * 15373 * @return {Element} Component to be rendered . 15374 */ 15375 /* 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)); 15376 15377 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js 15378 /** 15379 * WordPress dependencies 15380 */ 15381 15382 15383 15384 15385 15386 /** 15387 * Internal dependencies 15388 */ 15389 15390 15391 15392 15393 const post_featured_image_panel_PANEL_NAME = 'featured-image'; 15394 15395 /** 15396 * Renders the panel for the post featured image. 15397 * 15398 * @param {Object} props Props. 15399 * @param {boolean} props.withPanelBody Whether to include the panel body. Default true. 15400 * 15401 * @return {Component|null} The component to be rendered. 15402 * Return Null if the editor panel is disabled for featured image. 15403 */ 15404 function PostFeaturedImagePanel({ 15405 withPanelBody = true 15406 }) { 15407 var _postType$labels$feat; 15408 const { 15409 postType, 15410 isEnabled, 15411 isOpened 15412 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15413 const { 15414 getEditedPostAttribute, 15415 isEditorPanelEnabled, 15416 isEditorPanelOpened 15417 } = select(store_store); 15418 const { 15419 getPostType 15420 } = select(external_wp_coreData_namespaceObject.store); 15421 return { 15422 postType: getPostType(getEditedPostAttribute('type')), 15423 isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME), 15424 isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME) 15425 }; 15426 }, []); 15427 const { 15428 toggleEditorPanelOpened 15429 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15430 if (!isEnabled) { 15431 return null; 15432 } 15433 if (!withPanelBody) { 15434 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 15435 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) 15436 }); 15437 } 15438 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 15439 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 15440 title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'), 15441 opened: isOpened, 15442 onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME), 15443 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image, {}) 15444 }) 15445 }); 15446 } 15447 15448 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/check.js 15449 /** 15450 * WordPress dependencies 15451 */ 15452 15453 15454 /** 15455 * Internal dependencies 15456 */ 15457 15458 15459 15460 function PostFormatCheck({ 15461 children 15462 }) { 15463 const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().disablePostFormats, []); 15464 if (disablePostFormats) { 15465 return null; 15466 } 15467 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 15468 supportKeys: "post-formats", 15469 children: children 15470 }); 15471 } 15472 15473 /** 15474 * Component check if there are any post formats. 15475 * 15476 * @param {Object} props The component props. 15477 * @param {Element} props.children The child elements to render. 15478 * 15479 * @return {Component|null} The rendered component or null if post formats are disabled. 15480 */ 15481 /* harmony default export */ const post_format_check = (PostFormatCheck); 15482 15483 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/index.js 15484 /** 15485 * WordPress dependencies 15486 */ 15487 15488 15489 15490 15491 15492 15493 /** 15494 * Internal dependencies 15495 */ 15496 15497 15498 15499 // All WP post formats, sorted alphabetically by translated name. 15500 15501 15502 const POST_FORMATS = [{ 15503 id: 'aside', 15504 caption: (0,external_wp_i18n_namespaceObject.__)('Aside') 15505 }, { 15506 id: 'audio', 15507 caption: (0,external_wp_i18n_namespaceObject.__)('Audio') 15508 }, { 15509 id: 'chat', 15510 caption: (0,external_wp_i18n_namespaceObject.__)('Chat') 15511 }, { 15512 id: 'gallery', 15513 caption: (0,external_wp_i18n_namespaceObject.__)('Gallery') 15514 }, { 15515 id: 'image', 15516 caption: (0,external_wp_i18n_namespaceObject.__)('Image') 15517 }, { 15518 id: 'link', 15519 caption: (0,external_wp_i18n_namespaceObject.__)('Link') 15520 }, { 15521 id: 'quote', 15522 caption: (0,external_wp_i18n_namespaceObject.__)('Quote') 15523 }, { 15524 id: 'standard', 15525 caption: (0,external_wp_i18n_namespaceObject.__)('Standard') 15526 }, { 15527 id: 'status', 15528 caption: (0,external_wp_i18n_namespaceObject.__)('Status') 15529 }, { 15530 id: 'video', 15531 caption: (0,external_wp_i18n_namespaceObject.__)('Video') 15532 }].sort((a, b) => { 15533 const normalizedA = a.caption.toUpperCase(); 15534 const normalizedB = b.caption.toUpperCase(); 15535 if (normalizedA < normalizedB) { 15536 return -1; 15537 } 15538 if (normalizedA > normalizedB) { 15539 return 1; 15540 } 15541 return 0; 15542 }); 15543 15544 /** 15545 * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post. 15546 * 15547 * @example 15548 * ```jsx 15549 * <PostFormat /> 15550 * ``` 15551 * 15552 * @return {JSX.Element} The rendered PostFormat component. 15553 */ 15554 function PostFormat() { 15555 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); 15556 const postFormatSelectorId = `post-format-selector-$instanceId}`; 15557 const { 15558 postFormat, 15559 suggestedFormat, 15560 supportedFormats 15561 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15562 const { 15563 getEditedPostAttribute, 15564 getSuggestedPostFormat 15565 } = select(store_store); 15566 const _postFormat = getEditedPostAttribute('format'); 15567 const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); 15568 return { 15569 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', 15570 suggestedFormat: getSuggestedPostFormat(), 15571 supportedFormats: themeSupports.formats 15572 }; 15573 }, []); 15574 const formats = POST_FORMATS.filter(format => { 15575 // Ensure current format is always in the set. 15576 // The current format may not be a format supported by the theme. 15577 return supportedFormats?.includes(format.id) || postFormat === format.id; 15578 }); 15579 const suggestion = formats.find(format => format.id === suggestedFormat); 15580 const { 15581 editPost 15582 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15583 const onUpdatePostFormat = format => editPost({ 15584 format 15585 }); 15586 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_check, { 15587 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15588 className: "editor-post-format", 15589 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 15590 className: "editor-post-format__options", 15591 label: (0,external_wp_i18n_namespaceObject.__)('Post Format'), 15592 selected: postFormat, 15593 onChange: format => onUpdatePostFormat(format), 15594 id: postFormatSelectorId, 15595 options: formats.map(format => ({ 15596 label: format.caption, 15597 value: format.id 15598 })), 15599 hideLabelFromVision: true 15600 }), suggestion && suggestion.id !== postFormat && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 15601 className: "editor-post-format__suggestion", 15602 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15603 __next40pxDefaultSize: true, 15604 variant: "link", 15605 onClick: () => onUpdatePostFormat(suggestion.id), 15606 children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */ 15607 (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption) 15608 }) 15609 })] 15610 }) 15611 }); 15612 } 15613 15614 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js 15615 /** 15616 * WordPress dependencies 15617 */ 15618 15619 15620 /** 15621 * Internal dependencies 15622 */ 15623 15624 15625 15626 /** 15627 * Wrapper component that renders its children if the post has more than one revision. 15628 * 15629 * @param {Object} props Props. 15630 * @param {Element} props.children Children to be rendered. 15631 * 15632 * @return {Component|null} Rendered child components if post has more than one revision, otherwise null. 15633 */ 15634 15635 function PostLastRevisionCheck({ 15636 children 15637 }) { 15638 const { 15639 lastRevisionId, 15640 revisionsCount 15641 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15642 const { 15643 getCurrentPostLastRevisionId, 15644 getCurrentPostRevisionsCount 15645 } = select(store_store); 15646 return { 15647 lastRevisionId: getCurrentPostLastRevisionId(), 15648 revisionsCount: getCurrentPostRevisionsCount() 15649 }; 15650 }, []); 15651 if (!lastRevisionId || revisionsCount < 2) { 15652 return null; 15653 } 15654 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 15655 supportKeys: "revisions", 15656 children: children 15657 }); 15658 } 15659 /* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck); 15660 15661 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js 15662 /** 15663 * WordPress dependencies 15664 */ 15665 15666 15667 15668 15669 15670 15671 /** 15672 * Internal dependencies 15673 */ 15674 15675 15676 15677 15678 function usePostLastRevisionInfo() { 15679 return (0,external_wp_data_namespaceObject.useSelect)(select => { 15680 const { 15681 getCurrentPostLastRevisionId, 15682 getCurrentPostRevisionsCount 15683 } = select(store_store); 15684 return { 15685 lastRevisionId: getCurrentPostLastRevisionId(), 15686 revisionsCount: getCurrentPostRevisionsCount() 15687 }; 15688 }, []); 15689 } 15690 15691 /** 15692 * Renders the component for displaying the last revision of a post. 15693 * 15694 * @return {Component} The component to be rendered. 15695 */ 15696 function PostLastRevision() { 15697 const { 15698 lastRevisionId, 15699 revisionsCount 15700 } = usePostLastRevisionInfo(); 15701 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 15702 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15703 __next40pxDefaultSize: true, 15704 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 15705 revision: lastRevisionId 15706 }), 15707 className: "editor-post-last-revision__title", 15708 icon: library_backup, 15709 iconPosition: "right", 15710 text: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions. */ 15711 (0,external_wp_i18n_namespaceObject.__)('Revisions (%s)'), revisionsCount) 15712 }) 15713 }); 15714 } 15715 function PrivatePostLastRevision() { 15716 const { 15717 lastRevisionId, 15718 revisionsCount 15719 } = usePostLastRevisionInfo(); 15720 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 15721 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 15722 label: (0,external_wp_i18n_namespaceObject.__)('Revisions'), 15723 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15724 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { 15725 revision: lastRevisionId 15726 }), 15727 className: "editor-private-post-last-revision__button", 15728 text: revisionsCount, 15729 variant: "tertiary", 15730 size: "compact" 15731 }) 15732 }) 15733 }); 15734 } 15735 /* harmony default export */ const post_last_revision = (PostLastRevision); 15736 15737 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js 15738 /** 15739 * WordPress dependencies 15740 */ 15741 15742 15743 /** 15744 * Internal dependencies 15745 */ 15746 15747 15748 15749 /** 15750 * Renders the panel for displaying the last revision of a post. 15751 * 15752 * @return {Component} The component to be rendered. 15753 */ 15754 15755 function PostLastRevisionPanel() { 15756 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check, { 15757 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 15758 className: "editor-post-last-revision__panel", 15759 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision, {}) 15760 }) 15761 }); 15762 } 15763 /* harmony default export */ const post_last_revision_panel = (PostLastRevisionPanel); 15764 15765 ;// ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js 15766 /** 15767 * WordPress dependencies 15768 */ 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 /** 15779 * Internal dependencies 15780 */ 15781 15782 15783 /** 15784 * A modal component that is displayed when a post is locked for editing by another user. 15785 * The modal provides information about the lock status and options to take over or exit the editor. 15786 * 15787 * @return {JSX.Element|null} The rendered PostLockedModal component. 15788 */ 15789 15790 15791 15792 function PostLockedModal() { 15793 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); 15794 const hookName = 'core/editor/post-locked-modal-' + instanceId; 15795 const { 15796 autosave, 15797 updatePostLock 15798 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15799 const { 15800 isLocked, 15801 isTakeover, 15802 user, 15803 postId, 15804 postLockUtils, 15805 activePostLock, 15806 postType, 15807 previewLink 15808 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 15809 const { 15810 isPostLocked, 15811 isPostLockTakeover, 15812 getPostLockUser, 15813 getCurrentPostId, 15814 getActivePostLock, 15815 getEditedPostAttribute, 15816 getEditedPostPreviewLink, 15817 getEditorSettings 15818 } = select(store_store); 15819 const { 15820 getPostType 15821 } = select(external_wp_coreData_namespaceObject.store); 15822 return { 15823 isLocked: isPostLocked(), 15824 isTakeover: isPostLockTakeover(), 15825 user: getPostLockUser(), 15826 postId: getCurrentPostId(), 15827 postLockUtils: getEditorSettings().postLockUtils, 15828 activePostLock: getActivePostLock(), 15829 postType: getPostType(getEditedPostAttribute('type')), 15830 previewLink: getEditedPostPreviewLink() 15831 }; 15832 }, []); 15833 (0,external_wp_element_namespaceObject.useEffect)(() => { 15834 /** 15835 * Keep the lock refreshed. 15836 * 15837 * When the user does not send a heartbeat in a heartbeat-tick 15838 * the user is no longer editing and another user can start editing. 15839 * 15840 * @param {Object} data Data to send in the heartbeat request. 15841 */ 15842 function sendPostLock(data) { 15843 if (isLocked) { 15844 return; 15845 } 15846 data['wp-refresh-post-lock'] = { 15847 lock: activePostLock, 15848 post_id: postId 15849 }; 15850 } 15851 15852 /** 15853 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. 15854 * 15855 * @param {Object} data Data received in the heartbeat request 15856 */ 15857 function receivePostLock(data) { 15858 if (!data['wp-refresh-post-lock']) { 15859 return; 15860 } 15861 const received = data['wp-refresh-post-lock']; 15862 if (received.lock_error) { 15863 // Auto save and display the takeover modal. 15864 autosave(); 15865 updatePostLock({ 15866 isLocked: true, 15867 isTakeover: true, 15868 user: { 15869 name: received.lock_error.name, 15870 avatar: received.lock_error.avatar_src_2x 15871 } 15872 }); 15873 } else if (received.new_lock) { 15874 updatePostLock({ 15875 isLocked: false, 15876 activePostLock: received.new_lock 15877 }); 15878 } 15879 } 15880 15881 /** 15882 * Unlock the post before the window is exited. 15883 */ 15884 function releasePostLock() { 15885 if (isLocked || !activePostLock) { 15886 return; 15887 } 15888 const data = new window.FormData(); 15889 data.append('action', 'wp-remove-post-lock'); 15890 data.append('_wpnonce', postLockUtils.unlockNonce); 15891 data.append('post_ID', postId); 15892 data.append('active_post_lock', activePostLock); 15893 if (window.navigator.sendBeacon) { 15894 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); 15895 } else { 15896 const xhr = new window.XMLHttpRequest(); 15897 xhr.open('POST', postLockUtils.ajaxUrl, false); 15898 xhr.send(data); 15899 } 15900 } 15901 15902 // Details on these events on the Heartbeat API docs 15903 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ 15904 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock); 15905 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock); 15906 window.addEventListener('beforeunload', releasePostLock); 15907 return () => { 15908 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName); 15909 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName); 15910 window.removeEventListener('beforeunload', releasePostLock); 15911 }; 15912 }, []); 15913 if (!isLocked) { 15914 return null; 15915 } 15916 const userDisplayName = user.name; 15917 const userAvatar = user.avatar; 15918 const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 15919 'get-post-lock': '1', 15920 lockKey: true, 15921 post: postId, 15922 action: 'edit', 15923 _wpnonce: postLockUtils.nonce 15924 }); 15925 const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 15926 post_type: postType?.slug 15927 }); 15928 const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor'); 15929 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 15930 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'), 15931 focusOnMount: true, 15932 shouldCloseOnClickOutside: false, 15933 shouldCloseOnEsc: false, 15934 isDismissible: false 15935 // Do not remove this class, as this class is used by third party plugins. 15936 , 15937 className: "editor-post-locked-modal", 15938 size: "medium", 15939 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15940 alignment: "top", 15941 spacing: 6, 15942 children: [!!userAvatar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 15943 src: userAvatar, 15944 alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'), 15945 className: "editor-post-locked-modal__avatar", 15946 width: 64, 15947 height: 64 15948 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 15949 children: [!!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 15950 children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */ 15951 (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.'), { 15952 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 15953 PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 15954 href: previewLink, 15955 children: (0,external_wp_i18n_namespaceObject.__)('preview') 15956 }) 15957 }) 15958 }), !isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 15959 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 15960 children: (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */ 15961 (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.'), { 15962 strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 15963 PreviewLink: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 15964 href: previewLink, 15965 children: (0,external_wp_i18n_namespaceObject.__)('preview') 15966 }) 15967 }) 15968 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 15969 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.') 15970 })] 15971 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 15972 className: "editor-post-locked-modal__buttons", 15973 justify: "flex-end", 15974 children: [!isTakeover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15975 __next40pxDefaultSize: true, 15976 variant: "tertiary", 15977 href: unlockUrl, 15978 children: (0,external_wp_i18n_namespaceObject.__)('Take over') 15979 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 15980 __next40pxDefaultSize: true, 15981 variant: "primary", 15982 href: allPostsUrl, 15983 children: allPostsLabel 15984 })] 15985 })] 15986 })] 15987 }) 15988 }); 15989 } 15990 15991 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js 15992 /** 15993 * WordPress dependencies 15994 */ 15995 15996 15997 /** 15998 * Internal dependencies 15999 */ 16000 16001 16002 /** 16003 * This component checks the publishing status of the current post. 16004 * If the post is already published or the user doesn't have the 16005 * capability to publish, it returns null. 16006 * 16007 * @param {Object} props Component properties. 16008 * @param {Element} props.children Children to be rendered. 16009 * 16010 * @return {JSX.Element|null} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish. 16011 */ 16012 function PostPendingStatusCheck({ 16013 children 16014 }) { 16015 const { 16016 hasPublishAction, 16017 isPublished 16018 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16019 var _getCurrentPost$_link; 16020 const { 16021 isCurrentPostPublished, 16022 getCurrentPost 16023 } = select(store_store); 16024 return { 16025 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 16026 isPublished: isCurrentPostPublished() 16027 }; 16028 }, []); 16029 if (isPublished || !hasPublishAction) { 16030 return null; 16031 } 16032 return children; 16033 } 16034 /* harmony default export */ const post_pending_status_check = (PostPendingStatusCheck); 16035 16036 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js 16037 /** 16038 * WordPress dependencies 16039 */ 16040 16041 16042 16043 16044 /** 16045 * Internal dependencies 16046 */ 16047 16048 16049 16050 /** 16051 * A component for displaying and toggling the pending status of a post. 16052 * 16053 * @return {JSX.Element} The rendered component. 16054 */ 16055 16056 function PostPendingStatus() { 16057 const status = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('status'), []); 16058 const { 16059 editPost 16060 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16061 const togglePendingStatus = () => { 16062 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; 16063 editPost({ 16064 status: updatedStatus 16065 }); 16066 }; 16067 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check, { 16068 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 16069 __nextHasNoMarginBottom: true, 16070 label: (0,external_wp_i18n_namespaceObject.__)('Pending review'), 16071 checked: status === 'pending', 16072 onChange: togglePendingStatus 16073 }) 16074 }); 16075 } 16076 /* harmony default export */ const post_pending_status = (PostPendingStatus); 16077 16078 ;// ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js 16079 /** 16080 * WordPress dependencies 16081 */ 16082 16083 16084 16085 16086 16087 16088 16089 /** 16090 * Internal dependencies 16091 */ 16092 16093 16094 16095 16096 function writeInterstitialMessage(targetDocument) { 16097 let markup = (0,external_wp_element_namespaceObject.renderToString)( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16098 className: "editor-post-preview-button__interstitial-message", 16099 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { 16100 xmlns: "http://www.w3.org/2000/svg", 16101 viewBox: "0 0 96 96", 16102 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16103 className: "outer", 16104 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", 16105 fill: "none" 16106 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 16107 className: "inner", 16108 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", 16109 fill: "none" 16110 })] 16111 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 16112 children: (0,external_wp_i18n_namespaceObject.__)('Generating preview…') 16113 })] 16114 })); 16115 markup += ` 16116 <style> 16117 body { 16118 margin: 0; 16119 } 16120 .editor-post-preview-button__interstitial-message { 16121 display: flex; 16122 flex-direction: column; 16123 align-items: center; 16124 justify-content: center; 16125 height: 100vh; 16126 width: 100vw; 16127 } 16128 @-webkit-keyframes paint { 16129 0% { 16130 stroke-dashoffset: 0; 16131 } 16132 } 16133 @-moz-keyframes paint { 16134 0% { 16135 stroke-dashoffset: 0; 16136 } 16137 } 16138 @-o-keyframes paint { 16139 0% { 16140 stroke-dashoffset: 0; 16141 } 16142 } 16143 @keyframes paint { 16144 0% { 16145 stroke-dashoffset: 0; 16146 } 16147 } 16148 .editor-post-preview-button__interstitial-message svg { 16149 width: 192px; 16150 height: 192px; 16151 stroke: #555d66; 16152 stroke-width: 0.75; 16153 } 16154 .editor-post-preview-button__interstitial-message svg .outer, 16155 .editor-post-preview-button__interstitial-message svg .inner { 16156 stroke-dasharray: 280; 16157 stroke-dashoffset: 280; 16158 -webkit-animation: paint 1.5s ease infinite alternate; 16159 -moz-animation: paint 1.5s ease infinite alternate; 16160 -o-animation: paint 1.5s ease infinite alternate; 16161 animation: paint 1.5s ease infinite alternate; 16162 } 16163 p { 16164 text-align: center; 16165 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 16166 } 16167 </style> 16168 `; 16169 16170 /** 16171 * Filters the interstitial message shown when generating previews. 16172 * 16173 * @param {string} markup The preview interstitial markup. 16174 */ 16175 markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup); 16176 targetDocument.write(markup); 16177 targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…'); 16178 targetDocument.close(); 16179 } 16180 16181 /** 16182 * Renders a button that opens a new window or tab for the preview, 16183 * writes the interstitial message to this window, and then navigates 16184 * to the actual preview link. The button is not rendered if the post 16185 * is not viewable and disabled if the post is not saveable. 16186 * 16187 * @param {Object} props The component props. 16188 * @param {string} props.className The class name for the button. 16189 * @param {string} props.textContent The text content for the button. 16190 * @param {boolean} props.forceIsAutosaveable Whether to force autosave. 16191 * @param {string} props.role The role attribute for the button. 16192 * @param {Function} props.onPreview The callback function for preview event. 16193 * 16194 * @return {JSX.Element|null} The rendered button component. 16195 */ 16196 function PostPreviewButton({ 16197 className, 16198 textContent, 16199 forceIsAutosaveable, 16200 role, 16201 onPreview 16202 }) { 16203 const { 16204 postId, 16205 currentPostLink, 16206 previewLink, 16207 isSaveable, 16208 isViewable 16209 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16210 var _postType$viewable; 16211 const editor = select(store_store); 16212 const core = select(external_wp_coreData_namespaceObject.store); 16213 const postType = core.getPostType(editor.getCurrentPostType('type')); 16214 return { 16215 postId: editor.getCurrentPostId(), 16216 currentPostLink: editor.getCurrentPostAttribute('link'), 16217 previewLink: editor.getEditedPostPreviewLink(), 16218 isSaveable: editor.isEditedPostSaveable(), 16219 isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false 16220 }; 16221 }, []); 16222 const { 16223 __unstableSaveForPreview 16224 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16225 if (!isViewable) { 16226 return null; 16227 } 16228 const targetId = `wp-preview-$postId}`; 16229 const openPreviewWindow = async event => { 16230 // Our Preview button has its 'href' and 'target' set correctly for a11y 16231 // purposes. Unfortunately, though, we can't rely on the default 'click' 16232 // handler since sometimes it incorrectly opens a new tab instead of reusing 16233 // the existing one. 16234 // https://github.com/WordPress/gutenberg/pull/8330 16235 event.preventDefault(); 16236 16237 // Open up a Preview tab if needed. This is where we'll show the preview. 16238 const previewWindow = window.open('', targetId); 16239 16240 // Focus the Preview tab. This might not do anything, depending on the browser's 16241 // and user's preferences. 16242 // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus 16243 previewWindow.focus(); 16244 writeInterstitialMessage(previewWindow.document); 16245 const link = await __unstableSaveForPreview({ 16246 forceIsAutosaveable 16247 }); 16248 previewWindow.location = link; 16249 onPreview?.(); 16250 }; 16251 16252 // Link to the `?preview=true` URL if we have it, since this lets us see 16253 // changes that were autosaved since the post was last published. Otherwise, 16254 // just link to the post's URL. 16255 const href = previewLink || currentPostLink; 16256 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 16257 variant: !className ? 'tertiary' : undefined, 16258 className: className || 'editor-post-preview', 16259 href: href, 16260 target: targetId, 16261 accessibleWhenDisabled: true, 16262 disabled: !isSaveable, 16263 onClick: openPreviewWindow, 16264 role: role, 16265 size: "compact", 16266 children: textContent || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 16267 children: [(0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 16268 as: "span", 16269 children: /* translators: accessibility text */ 16270 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 16271 })] 16272 }) 16273 }); 16274 } 16275 16276 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js 16277 /** 16278 * WordPress dependencies 16279 */ 16280 16281 16282 16283 16284 /** 16285 * Internal dependencies 16286 */ 16287 16288 16289 /** 16290 * Renders the label for the publish button. 16291 * 16292 * @return {string} The label for the publish button. 16293 */ 16294 function PublishButtonLabel() { 16295 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 16296 const { 16297 isPublished, 16298 isBeingScheduled, 16299 isSaving, 16300 isPublishing, 16301 hasPublishAction, 16302 isAutosaving, 16303 hasNonPostEntityChanges, 16304 postStatusHasChanged, 16305 postStatus 16306 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 16307 var _getCurrentPost$_link; 16308 const { 16309 isCurrentPostPublished, 16310 isEditedPostBeingScheduled, 16311 isSavingPost, 16312 isPublishingPost, 16313 getCurrentPost, 16314 getCurrentPostType, 16315 isAutosavingPost, 16316 getPostEdits, 16317 getEditedPostAttribute 16318 } = select(store_store); 16319 return { 16320 isPublished: isCurrentPostPublished(), 16321 isBeingScheduled: isEditedPostBeingScheduled(), 16322 isSaving: isSavingPost(), 16323 isPublishing: isPublishingPost(), 16324 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 16325 postType: getCurrentPostType(), 16326 isAutosaving: isAutosavingPost(), 16327 hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(), 16328 postStatusHasChanged: !!getPostEdits()?.status, 16329 postStatus: getEditedPostAttribute('status') 16330 }; 16331 }, []); 16332 if (isPublishing) { 16333 /* translators: button label text should, if possible, be under 16 characters. */ 16334 return (0,external_wp_i18n_namespaceObject.__)('Publishing…'); 16335 } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) { 16336 /* translators: button label text should, if possible, be under 16 characters. */ 16337 return (0,external_wp_i18n_namespaceObject.__)('Saving…'); 16338 } 16339 if (!hasPublishAction) { 16340 // TODO: this is because "Submit for review" string is too long in some languages. 16341 // @see https://github.com/WordPress/gutenberg/issues/10475 16342 return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)('Publish') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review'); 16343 } 16344 if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || !postStatusHasChanged && postStatus === 'future') { 16345 return (0,external_wp_i18n_namespaceObject.__)('Save'); 16346 } 16347 if (isBeingScheduled) { 16348 return (0,external_wp_i18n_namespaceObject.__)('Schedule'); 16349 } 16350 return (0,external_wp_i18n_namespaceObject.__)('Publish'); 16351 } 16352 16353 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js 16354 /** 16355 * WordPress dependencies 16356 */ 16357 16358 16359 16360 16361 16362 /** 16363 * Internal dependencies 16364 */ 16365 16366 16367 16368 16369 const post_publish_button_noop = () => {}; 16370 class PostPublishButton extends external_wp_element_namespaceObject.Component { 16371 constructor(props) { 16372 super(props); 16373 this.createOnClick = this.createOnClick.bind(this); 16374 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); 16375 this.state = { 16376 entitiesSavedStatesCallback: false 16377 }; 16378 } 16379 createOnClick(callback) { 16380 return (...args) => { 16381 const { 16382 hasNonPostEntityChanges, 16383 setEntitiesSavedStatesCallback 16384 } = this.props; 16385 // If a post with non-post entities is published, but the user 16386 // elects to not save changes to the non-post entities, those 16387 // entities will still be dirty when the Publish button is clicked. 16388 // We also need to check that the `setEntitiesSavedStatesCallback` 16389 // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383 16390 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { 16391 // The modal for multiple entity saving will open, 16392 // hold the callback for saving/publishing the post 16393 // so that we can call it if the post entity is checked. 16394 this.setState({ 16395 entitiesSavedStatesCallback: () => callback(...args) 16396 }); 16397 16398 // Open the save panel by setting its callback. 16399 // To set a function on the useState hook, we must set it 16400 // with another function (() => myFunction). Passing the 16401 // function on its own will cause an error when called. 16402 setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates); 16403 return post_publish_button_noop; 16404 } 16405 return callback(...args); 16406 }; 16407 } 16408 closeEntitiesSavedStates(savedEntities) { 16409 const { 16410 postType, 16411 postId 16412 } = this.props; 16413 const { 16414 entitiesSavedStatesCallback 16415 } = this.state; 16416 this.setState({ 16417 entitiesSavedStatesCallback: false 16418 }, () => { 16419 if (savedEntities && savedEntities.some(elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { 16420 // The post entity was checked, call the held callback from `createOnClick`. 16421 entitiesSavedStatesCallback(); 16422 } 16423 }); 16424 } 16425 render() { 16426 const { 16427 forceIsDirty, 16428 hasPublishAction, 16429 isBeingScheduled, 16430 isOpen, 16431 isPostSavingLocked, 16432 isPublishable, 16433 isPublished, 16434 isSaveable, 16435 isSaving, 16436 isAutoSaving, 16437 isToggle, 16438 savePostStatus, 16439 onSubmit = post_publish_button_noop, 16440 onToggle, 16441 visibility, 16442 hasNonPostEntityChanges, 16443 isSavingNonPostEntityChanges, 16444 postStatus, 16445 postStatusHasChanged 16446 } = this.props; 16447 const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 16448 const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 16449 16450 // If the new status has not changed explicitely, we derive it from 16451 // other factors, like having a publish action, etc.. We need to preserve 16452 // this because it affects when to show the pre and post publish panels. 16453 // If it has changed though explicitely, we need to respect that. 16454 let publishStatus = 'publish'; 16455 if (postStatusHasChanged) { 16456 publishStatus = postStatus; 16457 } else if (!hasPublishAction) { 16458 publishStatus = 'pending'; 16459 } else if (visibility === 'private') { 16460 publishStatus = 'private'; 16461 } else if (isBeingScheduled) { 16462 publishStatus = 'future'; 16463 } 16464 const onClickButton = () => { 16465 if (isButtonDisabled) { 16466 return; 16467 } 16468 onSubmit(); 16469 savePostStatus(publishStatus); 16470 }; 16471 16472 // Callback to open the publish panel. 16473 const onClickToggle = () => { 16474 if (isToggleDisabled) { 16475 return; 16476 } 16477 onToggle(); 16478 }; 16479 const buttonProps = { 16480 'aria-disabled': isButtonDisabled, 16481 className: 'editor-post-publish-button', 16482 isBusy: !isAutoSaving && isSaving, 16483 variant: 'primary', 16484 onClick: this.createOnClick(onClickButton) 16485 }; 16486 const toggleProps = { 16487 'aria-disabled': isToggleDisabled, 16488 'aria-expanded': isOpen, 16489 className: 'editor-post-publish-panel__toggle', 16490 isBusy: isSaving && isPublished, 16491 variant: 'primary', 16492 size: 'compact', 16493 onClick: this.createOnClick(onClickToggle) 16494 }; 16495 const componentProps = isToggle ? toggleProps : buttonProps; 16496 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 16497 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 16498 ...componentProps, 16499 className: `$componentProps.className} editor-post-publish-button__button`, 16500 size: "compact", 16501 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {}) 16502 }) 16503 }); 16504 } 16505 } 16506 16507 /** 16508 * Renders the publish button. 16509 */ 16510 /* harmony default export */ const post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 16511 var _getCurrentPost$_link; 16512 const { 16513 isSavingPost, 16514 isAutosavingPost, 16515 isEditedPostBeingScheduled, 16516 getEditedPostVisibility, 16517 isCurrentPostPublished, 16518 isEditedPostSaveable, 16519 isEditedPostPublishable, 16520 isPostSavingLocked, 16521 getCurrentPost, 16522 getCurrentPostType, 16523 getCurrentPostId, 16524 hasNonPostEntityChanges, 16525 isSavingNonPostEntityChanges, 16526 getEditedPostAttribute, 16527 getPostEdits 16528 } = select(store_store); 16529 return { 16530 isSaving: isSavingPost(), 16531 isAutoSaving: isAutosavingPost(), 16532 isBeingScheduled: isEditedPostBeingScheduled(), 16533 visibility: getEditedPostVisibility(), 16534 isSaveable: isEditedPostSaveable(), 16535 isPostSavingLocked: isPostSavingLocked(), 16536 isPublishable: isEditedPostPublishable(), 16537 isPublished: isCurrentPostPublished(), 16538 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 16539 postType: getCurrentPostType(), 16540 postId: getCurrentPostId(), 16541 postStatus: getEditedPostAttribute('status'), 16542 postStatusHasChanged: getPostEdits()?.status, 16543 hasNonPostEntityChanges: hasNonPostEntityChanges(), 16544 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() 16545 }; 16546 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 16547 const { 16548 editPost, 16549 savePost 16550 } = dispatch(store_store); 16551 return { 16552 savePostStatus: status => { 16553 editPost({ 16554 status 16555 }, { 16556 undoIgnore: true 16557 }); 16558 savePost(); 16559 } 16560 }; 16561 })])(PostPublishButton)); 16562 16563 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 16564 /** 16565 * WordPress dependencies 16566 */ 16567 16568 16569 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 16570 xmlns: "http://www.w3.org/2000/svg", 16571 viewBox: "-2 -2 24 24", 16572 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 16573 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" 16574 }) 16575 }); 16576 /* harmony default export */ const library_wordpress = (wordpress); 16577 16578 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js 16579 /** 16580 * WordPress dependencies 16581 */ 16582 16583 const visibilityOptions = { 16584 public: { 16585 label: (0,external_wp_i18n_namespaceObject.__)('Public'), 16586 info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 16587 }, 16588 private: { 16589 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 16590 info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 16591 }, 16592 password: { 16593 label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), 16594 info: (0,external_wp_i18n_namespaceObject.__)('Only those with the password can view this post.') 16595 } 16596 }; 16597 16598 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js 16599 /** 16600 * WordPress dependencies 16601 */ 16602 16603 16604 16605 16606 16607 16608 16609 /** 16610 * Internal dependencies 16611 */ 16612 16613 16614 16615 /** 16616 * Allows users to set the visibility of a post. 16617 * 16618 * @param {Object} props The component props. 16619 * @param {Function} props.onClose Function to call when the popover is closed. 16620 * @return {JSX.Element} The rendered component. 16621 */ 16622 16623 16624 function PostVisibility({ 16625 onClose 16626 }) { 16627 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility); 16628 const { 16629 status, 16630 visibility, 16631 password 16632 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 16633 status: select(store_store).getEditedPostAttribute('status'), 16634 visibility: select(store_store).getEditedPostVisibility(), 16635 password: select(store_store).getEditedPostAttribute('password') 16636 })); 16637 const { 16638 editPost, 16639 savePost 16640 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16641 const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 16642 const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 16643 const setPublic = () => { 16644 editPost({ 16645 status: visibility === 'private' ? 'draft' : status, 16646 password: '' 16647 }); 16648 setHasPassword(false); 16649 }; 16650 const setPrivate = () => { 16651 setShowPrivateConfirmDialog(true); 16652 }; 16653 const confirmPrivate = () => { 16654 editPost({ 16655 status: 'private', 16656 password: '' 16657 }); 16658 setHasPassword(false); 16659 setShowPrivateConfirmDialog(false); 16660 savePost(); 16661 }; 16662 const handleDialogCancel = () => { 16663 setShowPrivateConfirmDialog(false); 16664 }; 16665 const setPasswordProtected = () => { 16666 editPost({ 16667 status: visibility === 'private' ? 'draft' : status, 16668 password: password || '' 16669 }); 16670 setHasPassword(true); 16671 }; 16672 const updatePassword = event => { 16673 editPost({ 16674 password: event.target.value 16675 }); 16676 }; 16677 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16678 className: "editor-post-visibility", 16679 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 16680 title: (0,external_wp_i18n_namespaceObject.__)('Visibility'), 16681 help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'), 16682 onClose: onClose 16683 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { 16684 className: "editor-post-visibility__fieldset", 16685 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 16686 as: "legend", 16687 children: (0,external_wp_i18n_namespaceObject.__)('Visibility') 16688 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 16689 instanceId: instanceId, 16690 value: "public", 16691 label: visibilityOptions.public.label, 16692 info: visibilityOptions.public.info, 16693 checked: visibility === 'public' && !hasPassword, 16694 onChange: setPublic 16695 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 16696 instanceId: instanceId, 16697 value: "private", 16698 label: visibilityOptions.private.label, 16699 info: visibilityOptions.private.info, 16700 checked: visibility === 'private', 16701 onChange: setPrivate 16702 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityChoice, { 16703 instanceId: instanceId, 16704 value: "password", 16705 label: visibilityOptions.password.label, 16706 info: visibilityOptions.password.info, 16707 checked: hasPassword, 16708 onChange: setPasswordProtected 16709 }), hasPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16710 className: "editor-post-visibility__password", 16711 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 16712 as: "label", 16713 htmlFor: `editor-post-visibility__password-input-$instanceId}`, 16714 children: (0,external_wp_i18n_namespaceObject.__)('Create password') 16715 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 16716 className: "editor-post-visibility__password-input", 16717 id: `editor-post-visibility__password-input-$instanceId}`, 16718 type: "text", 16719 onChange: updatePassword, 16720 value: password, 16721 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password') 16722 })] 16723 })] 16724 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 16725 isOpen: showPrivateConfirmDialog, 16726 onConfirm: confirmPrivate, 16727 onCancel: handleDialogCancel, 16728 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Publish'), 16729 size: "medium", 16730 children: (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?') 16731 })] 16732 }); 16733 } 16734 function PostVisibilityChoice({ 16735 instanceId, 16736 value, 16737 label, 16738 info, 16739 ...props 16740 }) { 16741 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 16742 className: "editor-post-visibility__choice", 16743 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { 16744 type: "radio", 16745 name: `editor-post-visibility__setting-$instanceId}`, 16746 value: value, 16747 id: `editor-post-$value}-$instanceId}`, 16748 "aria-describedby": `editor-post-$value}-$instanceId}-description`, 16749 className: "editor-post-visibility__radio", 16750 ...props 16751 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { 16752 htmlFor: `editor-post-$value}-$instanceId}`, 16753 className: "editor-post-visibility__label", 16754 children: label 16755 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 16756 id: `editor-post-$value}-$instanceId}-description`, 16757 className: "editor-post-visibility__info", 16758 children: info 16759 })] 16760 }); 16761 } 16762 16763 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js 16764 /** 16765 * WordPress dependencies 16766 */ 16767 16768 16769 /** 16770 * Internal dependencies 16771 */ 16772 16773 16774 16775 /** 16776 * Returns the label for the current post visibility setting. 16777 * 16778 * @return {string} Post visibility label. 16779 */ 16780 function PostVisibilityLabel() { 16781 return usePostVisibilityLabel(); 16782 } 16783 16784 /** 16785 * Get the label for the current post visibility setting. 16786 * 16787 * @return {string} Post visibility label. 16788 */ 16789 function usePostVisibilityLabel() { 16790 const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility()); 16791 return visibilityOptions[visibility]?.label; 16792 } 16793 16794 ;// ./node_modules/date-fns/toDate.mjs 16795 /** 16796 * @name toDate 16797 * @category Common Helpers 16798 * @summary Convert the given argument to an instance of Date. 16799 * 16800 * @description 16801 * Convert the given argument to an instance of Date. 16802 * 16803 * If the argument is an instance of Date, the function returns its clone. 16804 * 16805 * If the argument is a number, it is treated as a timestamp. 16806 * 16807 * If the argument is none of the above, the function returns Invalid Date. 16808 * 16809 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. 16810 * 16811 * @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). 16812 * 16813 * @param argument - The value to convert 16814 * 16815 * @returns The parsed date in the local time zone 16816 * 16817 * @example 16818 * // Clone the date: 16819 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) 16820 * //=> Tue Feb 11 2014 11:30:30 16821 * 16822 * @example 16823 * // Convert the timestamp to date: 16824 * const result = toDate(1392098430000) 16825 * //=> Tue Feb 11 2014 11:30:30 16826 */ 16827 function toDate(argument) { 16828 const argStr = Object.prototype.toString.call(argument); 16829 16830 // Clone the date 16831 if ( 16832 argument instanceof Date || 16833 (typeof argument === "object" && argStr === "[object Date]") 16834 ) { 16835 // Prevent the date to lose the milliseconds when passed to new Date() in IE10 16836 return new argument.constructor(+argument); 16837 } else if ( 16838 typeof argument === "number" || 16839 argStr === "[object Number]" || 16840 typeof argument === "string" || 16841 argStr === "[object String]" 16842 ) { 16843 // TODO: Can we get rid of as? 16844 return new Date(argument); 16845 } else { 16846 // TODO: Can we get rid of as? 16847 return new Date(NaN); 16848 } 16849 } 16850 16851 // Fallback for modularized imports: 16852 /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); 16853 16854 ;// ./node_modules/date-fns/startOfMonth.mjs 16855 16856 16857 /** 16858 * @name startOfMonth 16859 * @category Month Helpers 16860 * @summary Return the start of a month for the given date. 16861 * 16862 * @description 16863 * Return the start of a month for the given date. 16864 * The result will be in the local timezone. 16865 * 16866 * @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). 16867 * 16868 * @param date - The original date 16869 * 16870 * @returns The start of a month 16871 * 16872 * @example 16873 * // The start of a month for 2 September 2014 11:55:00: 16874 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 16875 * //=> Mon Sep 01 2014 00:00:00 16876 */ 16877 function startOfMonth(date) { 16878 const _date = toDate(date); 16879 _date.setDate(1); 16880 _date.setHours(0, 0, 0, 0); 16881 return _date; 16882 } 16883 16884 // Fallback for modularized imports: 16885 /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); 16886 16887 ;// ./node_modules/date-fns/endOfMonth.mjs 16888 16889 16890 /** 16891 * @name endOfMonth 16892 * @category Month Helpers 16893 * @summary Return the end of a month for the given date. 16894 * 16895 * @description 16896 * Return the end of a month for the given date. 16897 * The result will be in the local timezone. 16898 * 16899 * @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). 16900 * 16901 * @param date - The original date 16902 * 16903 * @returns The end of a month 16904 * 16905 * @example 16906 * // The end of a month for 2 September 2014 11:55:00: 16907 * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 16908 * //=> Tue Sep 30 2014 23:59:59.999 16909 */ 16910 function endOfMonth(date) { 16911 const _date = toDate(date); 16912 const month = _date.getMonth(); 16913 _date.setFullYear(_date.getFullYear(), month + 1, 0); 16914 _date.setHours(23, 59, 59, 999); 16915 return _date; 16916 } 16917 16918 // Fallback for modularized imports: 16919 /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); 16920 16921 ;// ./node_modules/date-fns/constants.mjs 16922 /** 16923 * @module constants 16924 * @summary Useful constants 16925 * @description 16926 * Collection of useful date constants. 16927 * 16928 * The constants could be imported from `date-fns/constants`: 16929 * 16930 * ```ts 16931 * import { maxTime, minTime } from "./constants/date-fns/constants"; 16932 * 16933 * function isAllowedTime(time) { 16934 * return time <= maxTime && time >= minTime; 16935 * } 16936 * ``` 16937 */ 16938 16939 /** 16940 * @constant 16941 * @name daysInWeek 16942 * @summary Days in 1 week. 16943 */ 16944 const daysInWeek = 7; 16945 16946 /** 16947 * @constant 16948 * @name daysInYear 16949 * @summary Days in 1 year. 16950 * 16951 * @description 16952 * How many days in a year. 16953 * 16954 * One years equals 365.2425 days according to the formula: 16955 * 16956 * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. 16957 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days 16958 */ 16959 const daysInYear = 365.2425; 16960 16961 /** 16962 * @constant 16963 * @name maxTime 16964 * @summary Maximum allowed time. 16965 * 16966 * @example 16967 * import { maxTime } from "./constants/date-fns/constants"; 16968 * 16969 * const isValid = 8640000000000001 <= maxTime; 16970 * //=> false 16971 * 16972 * new Date(8640000000000001); 16973 * //=> Invalid Date 16974 */ 16975 const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; 16976 16977 /** 16978 * @constant 16979 * @name minTime 16980 * @summary Minimum allowed time. 16981 * 16982 * @example 16983 * import { minTime } from "./constants/date-fns/constants"; 16984 * 16985 * const isValid = -8640000000000001 >= minTime; 16986 * //=> false 16987 * 16988 * new Date(-8640000000000001) 16989 * //=> Invalid Date 16990 */ 16991 const minTime = -maxTime; 16992 16993 /** 16994 * @constant 16995 * @name millisecondsInWeek 16996 * @summary Milliseconds in 1 week. 16997 */ 16998 const millisecondsInWeek = 604800000; 16999 17000 /** 17001 * @constant 17002 * @name millisecondsInDay 17003 * @summary Milliseconds in 1 day. 17004 */ 17005 const millisecondsInDay = 86400000; 17006 17007 /** 17008 * @constant 17009 * @name millisecondsInMinute 17010 * @summary Milliseconds in 1 minute 17011 */ 17012 const millisecondsInMinute = 60000; 17013 17014 /** 17015 * @constant 17016 * @name millisecondsInHour 17017 * @summary Milliseconds in 1 hour 17018 */ 17019 const millisecondsInHour = 3600000; 17020 17021 /** 17022 * @constant 17023 * @name millisecondsInSecond 17024 * @summary Milliseconds in 1 second 17025 */ 17026 const millisecondsInSecond = 1000; 17027 17028 /** 17029 * @constant 17030 * @name minutesInYear 17031 * @summary Minutes in 1 year. 17032 */ 17033 const minutesInYear = 525600; 17034 17035 /** 17036 * @constant 17037 * @name minutesInMonth 17038 * @summary Minutes in 1 month. 17039 */ 17040 const minutesInMonth = 43200; 17041 17042 /** 17043 * @constant 17044 * @name minutesInDay 17045 * @summary Minutes in 1 day. 17046 */ 17047 const minutesInDay = 1440; 17048 17049 /** 17050 * @constant 17051 * @name minutesInHour 17052 * @summary Minutes in 1 hour. 17053 */ 17054 const minutesInHour = 60; 17055 17056 /** 17057 * @constant 17058 * @name monthsInQuarter 17059 * @summary Months in 1 quarter. 17060 */ 17061 const monthsInQuarter = 3; 17062 17063 /** 17064 * @constant 17065 * @name monthsInYear 17066 * @summary Months in 1 year. 17067 */ 17068 const monthsInYear = 12; 17069 17070 /** 17071 * @constant 17072 * @name quartersInYear 17073 * @summary Quarters in 1 year 17074 */ 17075 const quartersInYear = 4; 17076 17077 /** 17078 * @constant 17079 * @name secondsInHour 17080 * @summary Seconds in 1 hour. 17081 */ 17082 const secondsInHour = 3600; 17083 17084 /** 17085 * @constant 17086 * @name secondsInMinute 17087 * @summary Seconds in 1 minute. 17088 */ 17089 const secondsInMinute = 60; 17090 17091 /** 17092 * @constant 17093 * @name secondsInDay 17094 * @summary Seconds in 1 day. 17095 */ 17096 const secondsInDay = secondsInHour * 24; 17097 17098 /** 17099 * @constant 17100 * @name secondsInWeek 17101 * @summary Seconds in 1 week. 17102 */ 17103 const secondsInWeek = secondsInDay * 7; 17104 17105 /** 17106 * @constant 17107 * @name secondsInYear 17108 * @summary Seconds in 1 year. 17109 */ 17110 const secondsInYear = secondsInDay * daysInYear; 17111 17112 /** 17113 * @constant 17114 * @name secondsInMonth 17115 * @summary Seconds in 1 month 17116 */ 17117 const secondsInMonth = secondsInYear / 12; 17118 17119 /** 17120 * @constant 17121 * @name secondsInQuarter 17122 * @summary Seconds in 1 quarter. 17123 */ 17124 const secondsInQuarter = secondsInMonth * 3; 17125 17126 ;// ./node_modules/date-fns/parseISO.mjs 17127 17128 17129 /** 17130 * The {@link parseISO} function options. 17131 */ 17132 17133 /** 17134 * @name parseISO 17135 * @category Common Helpers 17136 * @summary Parse ISO string 17137 * 17138 * @description 17139 * Parse the given string in ISO 8601 format and return an instance of Date. 17140 * 17141 * Function accepts complete ISO 8601 formats as well as partial implementations. 17142 * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 17143 * 17144 * If the argument isn't a string, the function cannot parse the string or 17145 * the values are invalid, it returns Invalid Date. 17146 * 17147 * @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). 17148 * 17149 * @param argument - The value to convert 17150 * @param options - An object with options 17151 * 17152 * @returns The parsed date in the local time zone 17153 * 17154 * @example 17155 * // Convert string '2014-02-11T11:30:30' to date: 17156 * const result = parseISO('2014-02-11T11:30:30') 17157 * //=> Tue Feb 11 2014 11:30:30 17158 * 17159 * @example 17160 * // Convert string '+02014101' to date, 17161 * // if the additional number of digits in the extended year format is 1: 17162 * const result = parseISO('+02014101', { additionalDigits: 1 }) 17163 * //=> Fri Apr 11 2014 00:00:00 17164 */ 17165 function parseISO(argument, options) { 17166 const additionalDigits = options?.additionalDigits ?? 2; 17167 const dateStrings = splitDateString(argument); 17168 17169 let date; 17170 if (dateStrings.date) { 17171 const parseYearResult = parseYear(dateStrings.date, additionalDigits); 17172 date = parseDate(parseYearResult.restDateString, parseYearResult.year); 17173 } 17174 17175 if (!date || isNaN(date.getTime())) { 17176 return new Date(NaN); 17177 } 17178 17179 const timestamp = date.getTime(); 17180 let time = 0; 17181 let offset; 17182 17183 if (dateStrings.time) { 17184 time = parseTime(dateStrings.time); 17185 if (isNaN(time)) { 17186 return new Date(NaN); 17187 } 17188 } 17189 17190 if (dateStrings.timezone) { 17191 offset = parseTimezone(dateStrings.timezone); 17192 if (isNaN(offset)) { 17193 return new Date(NaN); 17194 } 17195 } else { 17196 const dirtyDate = new Date(timestamp + time); 17197 // JS parsed string assuming it's in UTC timezone 17198 // but we need it to be parsed in our timezone 17199 // so we use utc values to build date in our timezone. 17200 // Year values from 0 to 99 map to the years 1900 to 1999 17201 // so set year explicitly with setFullYear. 17202 const result = new Date(0); 17203 result.setFullYear( 17204 dirtyDate.getUTCFullYear(), 17205 dirtyDate.getUTCMonth(), 17206 dirtyDate.getUTCDate(), 17207 ); 17208 result.setHours( 17209 dirtyDate.getUTCHours(), 17210 dirtyDate.getUTCMinutes(), 17211 dirtyDate.getUTCSeconds(), 17212 dirtyDate.getUTCMilliseconds(), 17213 ); 17214 return result; 17215 } 17216 17217 return new Date(timestamp + time + offset); 17218 } 17219 17220 const patterns = { 17221 dateTimeDelimiter: /[T ]/, 17222 timeZoneDelimiter: /[Z ]/i, 17223 timezone: /([Z+-].*)$/, 17224 }; 17225 17226 const dateRegex = 17227 /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; 17228 const timeRegex = 17229 /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; 17230 const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; 17231 17232 function splitDateString(dateString) { 17233 const dateStrings = {}; 17234 const array = dateString.split(patterns.dateTimeDelimiter); 17235 let timeString; 17236 17237 // The regex match should only return at maximum two array elements. 17238 // [date], [time], or [date, time]. 17239 if (array.length > 2) { 17240 return dateStrings; 17241 } 17242 17243 if (/:/.test(array[0])) { 17244 timeString = array[0]; 17245 } else { 17246 dateStrings.date = array[0]; 17247 timeString = array[1]; 17248 if (patterns.timeZoneDelimiter.test(dateStrings.date)) { 17249 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; 17250 timeString = dateString.substr( 17251 dateStrings.date.length, 17252 dateString.length, 17253 ); 17254 } 17255 } 17256 17257 if (timeString) { 17258 const token = patterns.timezone.exec(timeString); 17259 if (token) { 17260 dateStrings.time = timeString.replace(token[1], ""); 17261 dateStrings.timezone = token[1]; 17262 } else { 17263 dateStrings.time = timeString; 17264 } 17265 } 17266 17267 return dateStrings; 17268 } 17269 17270 function parseYear(dateString, additionalDigits) { 17271 const regex = new RegExp( 17272 "^(?:(\\d{4}|[+-]\\d{" + 17273 (4 + additionalDigits) + 17274 "})|(\\d{2}|[+-]\\d{" + 17275 (2 + additionalDigits) + 17276 "})$)", 17277 ); 17278 17279 const captures = dateString.match(regex); 17280 // Invalid ISO-formatted year 17281 if (!captures) return { year: NaN, restDateString: "" }; 17282 17283 const year = captures[1] ? parseInt(captures[1]) : null; 17284 const century = captures[2] ? parseInt(captures[2]) : null; 17285 17286 // either year or century is null, not both 17287 return { 17288 year: century === null ? year : century * 100, 17289 restDateString: dateString.slice((captures[1] || captures[2]).length), 17290 }; 17291 } 17292 17293 function parseDate(dateString, year) { 17294 // Invalid ISO-formatted year 17295 if (year === null) return new Date(NaN); 17296 17297 const captures = dateString.match(dateRegex); 17298 // Invalid ISO-formatted string 17299 if (!captures) return new Date(NaN); 17300 17301 const isWeekDate = !!captures[4]; 17302 const dayOfYear = parseDateUnit(captures[1]); 17303 const month = parseDateUnit(captures[2]) - 1; 17304 const day = parseDateUnit(captures[3]); 17305 const week = parseDateUnit(captures[4]); 17306 const dayOfWeek = parseDateUnit(captures[5]) - 1; 17307 17308 if (isWeekDate) { 17309 if (!validateWeekDate(year, week, dayOfWeek)) { 17310 return new Date(NaN); 17311 } 17312 return dayOfISOWeekYear(year, week, dayOfWeek); 17313 } else { 17314 const date = new Date(0); 17315 if ( 17316 !validateDate(year, month, day) || 17317 !validateDayOfYearDate(year, dayOfYear) 17318 ) { 17319 return new Date(NaN); 17320 } 17321 date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); 17322 return date; 17323 } 17324 } 17325 17326 function parseDateUnit(value) { 17327 return value ? parseInt(value) : 1; 17328 } 17329 17330 function parseTime(timeString) { 17331 const captures = timeString.match(timeRegex); 17332 if (!captures) return NaN; // Invalid ISO-formatted time 17333 17334 const hours = parseTimeUnit(captures[1]); 17335 const minutes = parseTimeUnit(captures[2]); 17336 const seconds = parseTimeUnit(captures[3]); 17337 17338 if (!validateTime(hours, minutes, seconds)) { 17339 return NaN; 17340 } 17341 17342 return ( 17343 hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000 17344 ); 17345 } 17346 17347 function parseTimeUnit(value) { 17348 return (value && parseFloat(value.replace(",", "."))) || 0; 17349 } 17350 17351 function parseTimezone(timezoneString) { 17352 if (timezoneString === "Z") return 0; 17353 17354 const captures = timezoneString.match(timezoneRegex); 17355 if (!captures) return 0; 17356 17357 const sign = captures[1] === "+" ? -1 : 1; 17358 const hours = parseInt(captures[2]); 17359 const minutes = (captures[3] && parseInt(captures[3])) || 0; 17360 17361 if (!validateTimezone(hours, minutes)) { 17362 return NaN; 17363 } 17364 17365 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); 17366 } 17367 17368 function dayOfISOWeekYear(isoWeekYear, week, day) { 17369 const date = new Date(0); 17370 date.setUTCFullYear(isoWeekYear, 0, 4); 17371 const fourthOfJanuaryDay = date.getUTCDay() || 7; 17372 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; 17373 date.setUTCDate(date.getUTCDate() + diff); 17374 return date; 17375 } 17376 17377 // Validation functions 17378 17379 // February is null to handle the leap year (using ||) 17380 const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 17381 17382 function isLeapYearIndex(year) { 17383 return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); 17384 } 17385 17386 function validateDate(year, month, date) { 17387 return ( 17388 month >= 0 && 17389 month <= 11 && 17390 date >= 1 && 17391 date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) 17392 ); 17393 } 17394 17395 function validateDayOfYearDate(year, dayOfYear) { 17396 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); 17397 } 17398 17399 function validateWeekDate(_year, week, day) { 17400 return week >= 1 && week <= 53 && day >= 0 && day <= 6; 17401 } 17402 17403 function validateTime(hours, minutes, seconds) { 17404 if (hours === 24) { 17405 return minutes === 0 && seconds === 0; 17406 } 17407 17408 return ( 17409 seconds >= 0 && 17410 seconds < 60 && 17411 minutes >= 0 && 17412 minutes < 60 && 17413 hours >= 0 && 17414 hours < 25 17415 ); 17416 } 17417 17418 function validateTimezone(_hours, minutes) { 17419 return minutes >= 0 && minutes <= 59; 17420 } 17421 17422 // Fallback for modularized imports: 17423 /* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO))); 17424 17425 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js 17426 /** 17427 * External dependencies 17428 */ 17429 17430 17431 /** 17432 * WordPress dependencies 17433 */ 17434 17435 17436 17437 17438 17439 17440 17441 /** 17442 * Internal dependencies 17443 */ 17444 17445 17446 17447 const { 17448 PrivatePublishDateTimePicker 17449 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 17450 17451 /** 17452 * Renders the PostSchedule component. It allows the user to schedule a post. 17453 * 17454 * @param {Object} props Props. 17455 * @param {Function} props.onClose Function to close the component. 17456 * 17457 * @return {Component} The component to be rendered. 17458 */ 17459 function PostSchedule(props) { 17460 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { 17461 ...props, 17462 showPopoverHeaderActions: true, 17463 isCompact: false 17464 }); 17465 } 17466 function PrivatePostSchedule({ 17467 onClose, 17468 showPopoverHeaderActions, 17469 isCompact 17470 }) { 17471 const { 17472 postDate, 17473 postType 17474 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 17475 postDate: select(store_store).getEditedPostAttribute('date'), 17476 postType: select(store_store).getCurrentPostType() 17477 }), []); 17478 const { 17479 editPost 17480 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17481 const onUpdateDate = date => editPost({ 17482 date 17483 }); 17484 const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(startOfMonth(new Date(postDate))); 17485 17486 // Pick up published and schduled site posts. 17487 const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, { 17488 status: 'publish,future', 17489 after: startOfMonth(previewedMonth).toISOString(), 17490 before: endOfMonth(previewedMonth).toISOString(), 17491 exclude: [select(store_store).getCurrentPostId()], 17492 per_page: 100, 17493 _fields: 'id,date' 17494 }), [previewedMonth, postType]); 17495 const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(({ 17496 date: eventDate 17497 }) => ({ 17498 date: new Date(eventDate) 17499 })), [eventsByPostType]); 17500 const settings = (0,external_wp_date_namespaceObject.getSettings)(); 17501 17502 // To know if the current timezone is a 12 hour time with look for "a" in the time format 17503 // We also make sure this a is not escaped by a "/" 17504 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a. 17505 .replace(/\\\\/g, '') // Replace "//" with empty strings. 17506 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash. 17507 ); 17508 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, { 17509 currentDate: postDate, 17510 onChange: onUpdateDate, 17511 is12Hour: is12HourTime, 17512 dateOrder: /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */ 17513 (0,external_wp_i18n_namespaceObject._x)('dmy', 'date order'), 17514 events: events, 17515 onMonthPreviewed: date => setPreviewedMonth(parseISO(date)), 17516 onClose: onClose, 17517 isCompact: isCompact, 17518 showPopoverHeaderActions: showPopoverHeaderActions 17519 }); 17520 } 17521 17522 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js 17523 /** 17524 * WordPress dependencies 17525 */ 17526 17527 17528 17529 17530 /** 17531 * Internal dependencies 17532 */ 17533 17534 17535 /** 17536 * Renders the PostScheduleLabel component. 17537 * 17538 * @param {Object} props Props. 17539 * 17540 * @return {Component} The component to be rendered. 17541 */ 17542 function PostScheduleLabel(props) { 17543 return usePostScheduleLabel(props); 17544 } 17545 17546 /** 17547 * Custom hook to get the label for post schedule. 17548 * 17549 * @param {Object} options Options for the hook. 17550 * @param {boolean} options.full Whether to get the full label or not. Default is false. 17551 * 17552 * @return {string} The label for post schedule. 17553 */ 17554 function usePostScheduleLabel({ 17555 full = false 17556 } = {}) { 17557 const { 17558 date, 17559 isFloating 17560 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 17561 date: select(store_store).getEditedPostAttribute('date'), 17562 isFloating: select(store_store).isEditedPostDateFloating() 17563 }), []); 17564 return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { 17565 isFloating 17566 }); 17567 } 17568 function getFullPostScheduleLabel(dateAttribute) { 17569 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 17570 const timezoneAbbreviation = getTimezoneAbbreviation(); 17571 const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( 17572 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 17573 (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); 17574 return (0,external_wp_i18n_namespaceObject.isRTL)() ? `$timezoneAbbreviation} $formattedDate}` : `$formattedDate} $timezoneAbbreviation}`; 17575 } 17576 function getPostScheduleLabel(dateAttribute, { 17577 isFloating = false, 17578 now = new Date() 17579 } = {}) { 17580 if (!dateAttribute || isFloating) { 17581 return (0,external_wp_i18n_namespaceObject.__)('Immediately'); 17582 } 17583 17584 // If the user timezone does not equal the site timezone then using words 17585 // like 'tomorrow' is confusing, so show the full date. 17586 if (!isTimezoneSameAsSiteTimezone(now)) { 17587 return getFullPostScheduleLabel(dateAttribute); 17588 } 17589 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 17590 if (isSameDay(date, now)) { 17591 return (0,external_wp_i18n_namespaceObject.sprintf)( 17592 // translators: %s: Time of day the post is scheduled for. 17593 (0,external_wp_i18n_namespaceObject.__)('Today at %s'), 17594 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 17595 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); 17596 } 17597 const tomorrow = new Date(now); 17598 tomorrow.setDate(tomorrow.getDate() + 1); 17599 if (isSameDay(date, tomorrow)) { 17600 return (0,external_wp_i18n_namespaceObject.sprintf)( 17601 // translators: %s: Time of day the post is scheduled for. 17602 (0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'), 17603 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 17604 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date)); 17605 } 17606 if (date.getFullYear() === now.getFullYear()) { 17607 return (0,external_wp_date_namespaceObject.dateI18n)( 17608 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 17609 (0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date); 17610 } 17611 return (0,external_wp_date_namespaceObject.dateI18n)( 17612 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 17613 (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date); 17614 } 17615 function getTimezoneAbbreviation() { 17616 const { 17617 timezone 17618 } = (0,external_wp_date_namespaceObject.getSettings)(); 17619 if (timezone.abbr && isNaN(Number(timezone.abbr))) { 17620 return timezone.abbr; 17621 } 17622 const symbol = timezone.offset < 0 ? '' : '+'; 17623 return `UTC$symbol}$timezone.offsetFormatted}`; 17624 } 17625 function isTimezoneSameAsSiteTimezone(date) { 17626 const { 17627 timezone 17628 } = (0,external_wp_date_namespaceObject.getSettings)(); 17629 const siteOffset = Number(timezone.offset); 17630 const dateOffset = -1 * (date.getTimezoneOffset() / 60); 17631 return siteOffset === dateOffset; 17632 } 17633 function isSameDay(left, right) { 17634 return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear(); 17635 } 17636 17637 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js 17638 /** 17639 * WordPress dependencies 17640 */ 17641 17642 17643 17644 17645 /** 17646 * Internal dependencies 17647 */ 17648 17649 17650 17651 const MIN_MOST_USED_TERMS = 3; 17652 const DEFAULT_QUERY = { 17653 per_page: 10, 17654 orderby: 'count', 17655 order: 'desc', 17656 hide_empty: true, 17657 _fields: 'id,name,count', 17658 context: 'view' 17659 }; 17660 function MostUsedTerms({ 17661 onSelect, 17662 taxonomy 17663 }) { 17664 const { 17665 _terms, 17666 showTerms 17667 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17668 const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); 17669 return { 17670 _terms: mostUsedTerms, 17671 showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS 17672 }; 17673 }, [taxonomy.slug]); 17674 if (!showTerms) { 17675 return null; 17676 } 17677 const terms = unescapeTerms(_terms); 17678 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 17679 className: "editor-post-taxonomies__flat-term-most-used", 17680 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { 17681 as: "h3", 17682 className: "editor-post-taxonomies__flat-term-most-used-label", 17683 children: taxonomy.labels.most_used 17684 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 17685 role: "list", 17686 className: "editor-post-taxonomies__flat-term-most-used-list", 17687 children: terms.map(term => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 17688 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 17689 __next40pxDefaultSize: true, 17690 variant: "link", 17691 onClick: () => onSelect(term), 17692 children: term.name 17693 }) 17694 }, term.id)) 17695 })] 17696 }); 17697 } 17698 17699 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js 17700 /** 17701 * WordPress dependencies 17702 */ 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 /** 17714 * Internal dependencies 17715 */ 17716 17717 17718 17719 17720 /** 17721 * Shared reference to an empty array for cases where it is important to avoid 17722 * returning a new array reference on every invocation. 17723 * 17724 * @type {Array<any>} 17725 */ 17726 17727 17728 const flat_term_selector_EMPTY_ARRAY = []; 17729 17730 /** 17731 * How the max suggestions limit was chosen: 17732 * - Matches the `per_page` range set by the REST API. 17733 * - Can't use "unbound" query. The `FormTokenField` needs a fixed number. 17734 * - Matches default for `FormTokenField`. 17735 */ 17736 const MAX_TERMS_SUGGESTIONS = 100; 17737 const flat_term_selector_DEFAULT_QUERY = { 17738 per_page: MAX_TERMS_SUGGESTIONS, 17739 _fields: 'id,name', 17740 context: 'view' 17741 }; 17742 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); 17743 const termNamesToIds = (names, terms) => { 17744 return names.map(termName => terms.find(term => isSameTermName(term.name, termName))?.id).filter(id => id !== undefined); 17745 }; 17746 const Wrapper = ({ 17747 children, 17748 __nextHasNoMarginBottom 17749 }) => __nextHasNoMarginBottom ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 17750 spacing: 4, 17751 children: children 17752 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 17753 children: children 17754 }); 17755 17756 /** 17757 * Renders a flat term selector component. 17758 * 17759 * @param {Object} props The component props. 17760 * @param {string} props.slug The slug of the taxonomy. 17761 * @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.) 17762 * 17763 * @return {JSX.Element} The rendered flat term selector component. 17764 */ 17765 function FlatTermSelector({ 17766 slug, 17767 __nextHasNoMarginBottom 17768 }) { 17769 var _taxonomy$labels$add_, _taxonomy$labels$sing2; 17770 const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); 17771 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); 17772 const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); 17773 if (!__nextHasNoMarginBottom) { 17774 external_wp_deprecated_default()('Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector', { 17775 since: '6.7', 17776 version: '7.0', 17777 hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.' 17778 }); 17779 } 17780 const { 17781 terms, 17782 termIds, 17783 taxonomy, 17784 hasAssignAction, 17785 hasCreateAction, 17786 hasResolvedTerms 17787 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17788 var _post$_links, _post$_links2; 17789 const { 17790 getCurrentPost, 17791 getEditedPostAttribute 17792 } = select(store_store); 17793 const { 17794 getEntityRecords, 17795 getTaxonomy, 17796 hasFinishedResolution 17797 } = select(external_wp_coreData_namespaceObject.store); 17798 const post = getCurrentPost(); 17799 const _taxonomy = getTaxonomy(slug); 17800 const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; 17801 const query = { 17802 ...flat_term_selector_DEFAULT_QUERY, 17803 include: _termIds?.join(','), 17804 per_page: -1 17805 }; 17806 return { 17807 hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, 17808 hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, 17809 taxonomy: _taxonomy, 17810 termIds: _termIds, 17811 terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY, 17812 hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query]) 17813 }; 17814 }, [slug]); 17815 const { 17816 searchResults 17817 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17818 const { 17819 getEntityRecords 17820 } = select(external_wp_coreData_namespaceObject.store); 17821 return { 17822 searchResults: !!search ? getEntityRecords('taxonomy', slug, { 17823 ...flat_term_selector_DEFAULT_QUERY, 17824 search 17825 }) : flat_term_selector_EMPTY_ARRAY 17826 }; 17827 }, [search, slug]); 17828 17829 // Update terms state only after the selectors are resolved. 17830 // We're using this to avoid terms temporarily disappearing on slow networks 17831 // while core data makes REST API requests. 17832 (0,external_wp_element_namespaceObject.useEffect)(() => { 17833 if (hasResolvedTerms) { 17834 const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name)); 17835 setValues(newValues); 17836 } 17837 }, [terms, hasResolvedTerms]); 17838 const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { 17839 return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name)); 17840 }, [searchResults]); 17841 const { 17842 editPost 17843 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17844 const { 17845 saveEntityRecord 17846 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 17847 const { 17848 createErrorNotice 17849 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 17850 if (!hasAssignAction) { 17851 return null; 17852 } 17853 async function findOrCreateTerm(term) { 17854 try { 17855 const newTerm = await saveEntityRecord('taxonomy', slug, term, { 17856 throwOnError: true 17857 }); 17858 return unescapeTerm(newTerm); 17859 } catch (error) { 17860 if (error.code !== 'term_exists') { 17861 throw error; 17862 } 17863 return { 17864 id: error.data.term_id, 17865 name: term.name 17866 }; 17867 } 17868 } 17869 function onUpdateTerms(newTermIds) { 17870 editPost({ 17871 [taxonomy.rest_base]: newTermIds 17872 }); 17873 } 17874 function onChange(termNames) { 17875 const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])]; 17876 const uniqueTerms = termNames.reduce((acc, name) => { 17877 if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) { 17878 acc.push(name); 17879 } 17880 return acc; 17881 }, []); 17882 const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName))); 17883 17884 // Optimistically update term values. 17885 // The selector will always re-fetch terms later. 17886 setValues(uniqueTerms); 17887 if (newTermNames.length === 0) { 17888 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 17889 return; 17890 } 17891 if (!hasCreateAction) { 17892 return; 17893 } 17894 Promise.all(newTermNames.map(termName => findOrCreateTerm({ 17895 name: termName 17896 }))).then(newTerms => { 17897 const newAvailableTerms = availableTerms.concat(newTerms); 17898 onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms)); 17899 }).catch(error => { 17900 createErrorNotice(error.message, { 17901 type: 'snackbar' 17902 }); 17903 // In case of a failure, try assigning available terms. 17904 // This will invalidate the optimistic update. 17905 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 17906 }); 17907 } 17908 function appendTerm(newTerm) { 17909 var _taxonomy$labels$sing; 17910 if (termIds.includes(newTerm.id)) { 17911 return; 17912 } 17913 const newTermIds = [...termIds, newTerm.id]; 17914 const defaultName = slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'); 17915 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ 17916 (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); 17917 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 17918 onUpdateTerms(newTermIds); 17919 } 17920 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'); 17921 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'); 17922 const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ 17923 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName); 17924 const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ 17925 (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName); 17926 const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ 17927 (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName); 17928 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { 17929 __nextHasNoMarginBottom: __nextHasNoMarginBottom, 17930 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, { 17931 __next40pxDefaultSize: true, 17932 value: values, 17933 suggestions: suggestions, 17934 onChange: onChange, 17935 onInputChange: debouncedSearch, 17936 maxSuggestions: MAX_TERMS_SUGGESTIONS, 17937 label: newTermLabel, 17938 messages: { 17939 added: termAddedLabel, 17940 removed: termRemovedLabel, 17941 remove: removeTermLabel 17942 }, 17943 __nextHasNoMarginBottom: __nextHasNoMarginBottom 17944 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, { 17945 taxonomy: taxonomy, 17946 onSelect: appendTerm 17947 })] 17948 }); 17949 } 17950 /* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector)); 17951 17952 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js 17953 /** 17954 * WordPress dependencies 17955 */ 17956 17957 17958 17959 17960 17961 17962 /** 17963 * Internal dependencies 17964 */ 17965 17966 17967 17968 17969 const TagsPanel = () => { 17970 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 17971 className: "editor-post-publish-panel__link", 17972 children: (0,external_wp_i18n_namespaceObject.__)('Add tags') 17973 }, "label")]; 17974 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 17975 initialOpen: false, 17976 title: panelBodyTitle, 17977 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 17978 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.') 17979 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector, { 17980 slug: "post_tag", 17981 __nextHasNoMarginBottom: true 17982 })] 17983 }); 17984 }; 17985 const MaybeTagsPanel = () => { 17986 const { 17987 hasTags, 17988 isPostTypeSupported 17989 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 17990 const postType = select(store_store).getCurrentPostType(); 17991 const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag'); 17992 const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType); 17993 const areTagsFetched = tagsTaxonomy !== undefined; 17994 const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base); 17995 return { 17996 hasTags: !!tags?.length, 17997 isPostTypeSupported: areTagsFetched && _isPostTypeSupported 17998 }; 17999 }, []); 18000 const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(hasTags); 18001 if (!isPostTypeSupported) { 18002 return null; 18003 } 18004 18005 /* 18006 * We only want to show the tag panel if the post didn't have 18007 * any tags when the user hit the Publish button. 18008 * 18009 * We can't use the prop.hasTags because it'll change to true 18010 * if the user adds a new tag within the pre-publish panel. 18011 * This would force a re-render and a new prop.hasTags check, 18012 * hiding this panel and keeping the user from adding 18013 * more than one tag. 18014 */ 18015 if (!hadTagsWhenOpeningThePanel) { 18016 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {}); 18017 } 18018 return null; 18019 }; 18020 /* harmony default export */ const maybe_tags_panel = (MaybeTagsPanel); 18021 18022 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js 18023 /** 18024 * WordPress dependencies 18025 */ 18026 18027 18028 18029 18030 18031 /** 18032 * Internal dependencies 18033 */ 18034 18035 18036 18037 18038 const getSuggestion = (supportedFormats, suggestedPostFormat) => { 18039 const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id)); 18040 return formats.find(format => format.id === suggestedPostFormat); 18041 }; 18042 const PostFormatSuggestion = ({ 18043 suggestedPostFormat, 18044 suggestionText, 18045 onUpdatePostFormat 18046 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18047 __next40pxDefaultSize: true, 18048 variant: "link", 18049 onClick: () => onUpdatePostFormat(suggestedPostFormat), 18050 children: suggestionText 18051 }); 18052 function PostFormatPanel() { 18053 const { 18054 currentPostFormat, 18055 suggestion 18056 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18057 var _select$getThemeSuppo; 18058 const { 18059 getEditedPostAttribute, 18060 getSuggestedPostFormat 18061 } = select(store_store); 18062 const supportedFormats = (_select$getThemeSuppo = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats) !== null && _select$getThemeSuppo !== void 0 ? _select$getThemeSuppo : []; 18063 return { 18064 currentPostFormat: getEditedPostAttribute('format'), 18065 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) 18066 }; 18067 }, []); 18068 const { 18069 editPost 18070 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18071 const onUpdatePostFormat = format => editPost({ 18072 format 18073 }); 18074 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 18075 className: "editor-post-publish-panel__link", 18076 children: (0,external_wp_i18n_namespaceObject.__)('Use a post format') 18077 }, "label")]; 18078 if (!suggestion || suggestion.id === currentPostFormat) { 18079 return null; 18080 } 18081 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 18082 initialOpen: false, 18083 title: panelBodyTitle, 18084 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18085 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.') 18086 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18087 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatSuggestion, { 18088 onUpdatePostFormat: onUpdatePostFormat, 18089 suggestedPostFormat: suggestion.id, 18090 suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */ 18091 (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption) 18092 }) 18093 })] 18094 }); 18095 } 18096 18097 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js 18098 /** 18099 * WordPress dependencies 18100 */ 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 /** 18112 * Internal dependencies 18113 */ 18114 18115 18116 18117 /** 18118 * Module Constants 18119 */ 18120 18121 18122 const hierarchical_term_selector_DEFAULT_QUERY = { 18123 per_page: -1, 18124 orderby: 'name', 18125 order: 'asc', 18126 _fields: 'id,name,parent', 18127 context: 'view' 18128 }; 18129 const MIN_TERMS_COUNT_FOR_FILTER = 8; 18130 const hierarchical_term_selector_EMPTY_ARRAY = []; 18131 18132 /** 18133 * Sort Terms by Selected. 18134 * 18135 * @param {Object[]} termsTree Array of terms in tree format. 18136 * @param {number[]} terms Selected terms. 18137 * 18138 * @return {Object[]} Sorted array of terms. 18139 */ 18140 function sortBySelected(termsTree, terms) { 18141 const treeHasSelection = termTree => { 18142 if (terms.indexOf(termTree.id) !== -1) { 18143 return true; 18144 } 18145 if (undefined === termTree.children) { 18146 return false; 18147 } 18148 return termTree.children.map(treeHasSelection).filter(child => child).length > 0; 18149 }; 18150 const termOrChildIsSelected = (termA, termB) => { 18151 const termASelected = treeHasSelection(termA); 18152 const termBSelected = treeHasSelection(termB); 18153 if (termASelected === termBSelected) { 18154 return 0; 18155 } 18156 if (termASelected && !termBSelected) { 18157 return -1; 18158 } 18159 if (!termASelected && termBSelected) { 18160 return 1; 18161 } 18162 return 0; 18163 }; 18164 const newTermTree = [...termsTree]; 18165 newTermTree.sort(termOrChildIsSelected); 18166 return newTermTree; 18167 } 18168 18169 /** 18170 * Find term by parent id or name. 18171 * 18172 * @param {Object[]} terms Array of Terms. 18173 * @param {number|string} parent id. 18174 * @param {string} name Term name. 18175 * @return {Object} Term object. 18176 */ 18177 function findTerm(terms, parent, name) { 18178 return terms.find(term => { 18179 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); 18180 }); 18181 } 18182 18183 /** 18184 * Get filter matcher function. 18185 * 18186 * @param {string} filterValue Filter value. 18187 * @return {(function(Object): (Object|boolean))} Matcher function. 18188 */ 18189 function getFilterMatcher(filterValue) { 18190 const matchTermsForFilter = originalTerm => { 18191 if ('' === filterValue) { 18192 return originalTerm; 18193 } 18194 18195 // Shallow clone, because we'll be filtering the term's children and 18196 // don't want to modify the original term. 18197 const term = { 18198 ...originalTerm 18199 }; 18200 18201 // Map and filter the children, recursive so we deal with grandchildren 18202 // and any deeper levels. 18203 if (term.children.length > 0) { 18204 term.children = term.children.map(matchTermsForFilter).filter(child => child); 18205 } 18206 18207 // If the term's name contains the filterValue, or it has children 18208 // (i.e. some child matched at some point in the tree) then return it. 18209 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { 18210 return term; 18211 } 18212 18213 // Otherwise, return false. After mapping, the list of terms will need 18214 // to have false values filtered out. 18215 return false; 18216 }; 18217 return matchTermsForFilter; 18218 } 18219 18220 /** 18221 * Hierarchical term selector. 18222 * 18223 * @param {Object} props Component props. 18224 * @param {string} props.slug Taxonomy slug. 18225 * @return {Element} Hierarchical term selector component. 18226 */ 18227 function HierarchicalTermSelector({ 18228 slug 18229 }) { 18230 var _taxonomy$labels$sear, _taxonomy$name; 18231 const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); 18232 const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(''); 18233 /** 18234 * @type {[number|'', Function]} 18235 */ 18236 const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(''); 18237 const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); 18238 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); 18239 const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); 18240 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 18241 const { 18242 hasCreateAction, 18243 hasAssignAction, 18244 terms, 18245 loading, 18246 availableTerms, 18247 taxonomy 18248 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 18249 var _post$_links, _post$_links2; 18250 const { 18251 getCurrentPost, 18252 getEditedPostAttribute 18253 } = select(store_store); 18254 const { 18255 getTaxonomy, 18256 getEntityRecords, 18257 isResolving 18258 } = select(external_wp_coreData_namespaceObject.store); 18259 const _taxonomy = getTaxonomy(slug); 18260 const post = getCurrentPost(); 18261 return { 18262 hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false, 18263 hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false, 18264 terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, 18265 loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]), 18266 availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, 18267 taxonomy: _taxonomy 18268 }; 18269 }, [slug]); 18270 const { 18271 editPost 18272 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18273 const { 18274 saveEntityRecord 18275 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 18276 const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms), 18277 // Remove `terms` from the dependency list to avoid reordering every time 18278 // checking or unchecking a term. 18279 [availableTerms]); 18280 const { 18281 createErrorNotice 18282 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 18283 if (!hasAssignAction) { 18284 return null; 18285 } 18286 18287 /** 18288 * Append new term. 18289 * 18290 * @param {Object} term Term object. 18291 * @return {Promise} A promise that resolves to save term object. 18292 */ 18293 const addTerm = term => { 18294 return saveEntityRecord('taxonomy', slug, term, { 18295 throwOnError: true 18296 }); 18297 }; 18298 18299 /** 18300 * Update terms for post. 18301 * 18302 * @param {number[]} termIds Term ids. 18303 */ 18304 const onUpdateTerms = termIds => { 18305 editPost({ 18306 [taxonomy.rest_base]: termIds 18307 }); 18308 }; 18309 18310 /** 18311 * Handler for checking term. 18312 * 18313 * @param {number} termId 18314 */ 18315 const onChange = termId => { 18316 const hasTerm = terms.includes(termId); 18317 const newTerms = hasTerm ? terms.filter(id => id !== termId) : [...terms, termId]; 18318 onUpdateTerms(newTerms); 18319 }; 18320 const onChangeFormName = value => { 18321 setFormName(value); 18322 }; 18323 18324 /** 18325 * Handler for changing form parent. 18326 * 18327 * @param {number|''} parentId Parent post id. 18328 */ 18329 const onChangeFormParent = parentId => { 18330 setFormParent(parentId); 18331 }; 18332 const onToggleForm = () => { 18333 setShowForm(!showForm); 18334 }; 18335 const onAddTerm = async event => { 18336 var _taxonomy$labels$sing; 18337 event.preventDefault(); 18338 if (formName === '' || adding) { 18339 return; 18340 } 18341 18342 // Check if the term we are adding already exists. 18343 const existingTerm = findTerm(availableTerms, formParent, formName); 18344 if (existingTerm) { 18345 // If the term we are adding exists but is not selected select it. 18346 if (!terms.some(term => term === existingTerm.id)) { 18347 onUpdateTerms([...terms, existingTerm.id]); 18348 } 18349 setFormName(''); 18350 setFormParent(''); 18351 return; 18352 } 18353 setAdding(true); 18354 let newTerm; 18355 try { 18356 newTerm = await addTerm({ 18357 name: formName, 18358 parent: formParent ? formParent : undefined 18359 }); 18360 } catch (error) { 18361 createErrorNotice(error.message, { 18362 type: 'snackbar' 18363 }); 18364 return; 18365 } 18366 const defaultName = slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term'); 18367 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */ 18368 (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); 18369 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); 18370 setAdding(false); 18371 setFormName(''); 18372 setFormParent(''); 18373 onUpdateTerms([...terms, newTerm.id]); 18374 }; 18375 const setFilter = value => { 18376 const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term); 18377 const getResultCount = termsTree => { 18378 let count = 0; 18379 for (let i = 0; i < termsTree.length; i++) { 18380 count++; 18381 if (undefined !== termsTree[i].children) { 18382 count += getResultCount(termsTree[i].children); 18383 } 18384 } 18385 return count; 18386 }; 18387 setFilterValue(value); 18388 setFilteredTermsTree(newFilteredTermsTree); 18389 const resultCount = getResultCount(newFilteredTermsTree); 18390 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ 18391 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount); 18392 debouncedSpeak(resultsFoundMessage, 'assertive'); 18393 }; 18394 const renderTerms = renderedTerms => { 18395 return renderedTerms.map(term => { 18396 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 18397 className: "editor-post-taxonomies__hierarchical-terms-choice", 18398 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 18399 __nextHasNoMarginBottom: true, 18400 checked: terms.indexOf(term.id) !== -1, 18401 onChange: () => { 18402 const termId = parseInt(term.id, 10); 18403 onChange(termId); 18404 }, 18405 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name) 18406 }), !!term.children.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 18407 className: "editor-post-taxonomies__hierarchical-terms-subchoices", 18408 children: renderTerms(term.children) 18409 })] 18410 }, term.id); 18411 }); 18412 }; 18413 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => { 18414 var _taxonomy$labels$labe; 18415 return (_taxonomy$labels$labe = taxonomy?.labels?.[labelProperty]) !== null && _taxonomy$labels$labe !== void 0 ? _taxonomy$labels$labe : slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory; 18416 }; 18417 const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 18418 const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); 18419 const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term')); 18420 const noParentOption = `— $parentSelectLabel} —`; 18421 const newTermSubmitLabel = newTermButtonLabel; 18422 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'); 18423 const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms'); 18424 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; 18425 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 18426 direction: "column", 18427 gap: "4", 18428 children: [showFilter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 18429 __next40pxDefaultSize: true, 18430 __nextHasNoMarginBottom: true, 18431 label: filterLabel, 18432 value: filterValue, 18433 onChange: setFilter 18434 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 18435 className: "editor-post-taxonomies__hierarchical-terms-list", 18436 tabIndex: "0", 18437 role: "group", 18438 "aria-label": groupLabel, 18439 children: renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree) 18440 }), !loading && hasCreateAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 18441 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18442 __next40pxDefaultSize: true, 18443 onClick: onToggleForm, 18444 className: "editor-post-taxonomies__hierarchical-terms-add", 18445 "aria-expanded": showForm, 18446 variant: "link", 18447 children: newTermButtonLabel 18448 }) 18449 }), showForm && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 18450 onSubmit: onAddTerm, 18451 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { 18452 direction: "column", 18453 gap: "4", 18454 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 18455 __next40pxDefaultSize: true, 18456 __nextHasNoMarginBottom: true, 18457 className: "editor-post-taxonomies__hierarchical-terms-input", 18458 label: newTermLabel, 18459 value: formName, 18460 onChange: onChangeFormName, 18461 required: true 18462 }), !!availableTerms.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TreeSelect, { 18463 __next40pxDefaultSize: true, 18464 __nextHasNoMarginBottom: true, 18465 label: parentSelectLabel, 18466 noOptionLabel: noParentOption, 18467 onChange: onChangeFormParent, 18468 selectedId: formParent, 18469 tree: availableTermsTree 18470 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 18471 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18472 __next40pxDefaultSize: true, 18473 variant: "secondary", 18474 type: "submit", 18475 className: "editor-post-taxonomies__hierarchical-terms-submit", 18476 children: newTermSubmitLabel 18477 }) 18478 })] 18479 }) 18480 })] 18481 }); 18482 } 18483 /* harmony default export */ const hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector)); 18484 18485 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js 18486 /** 18487 * WordPress dependencies 18488 */ 18489 18490 18491 18492 18493 18494 18495 /** 18496 * Internal dependencies 18497 */ 18498 18499 18500 18501 18502 function MaybeCategoryPanel() { 18503 const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => { 18504 const postType = select(store_store).getCurrentPostType(); 18505 const { 18506 canUser, 18507 getEntityRecord, 18508 getTaxonomy 18509 } = select(external_wp_coreData_namespaceObject.store); 18510 const categoriesTaxonomy = getTaxonomy('category'); 18511 const defaultCategoryId = canUser('read', { 18512 kind: 'root', 18513 name: 'site' 18514 }) ? getEntityRecord('root', 'site')?.default_category : undefined; 18515 const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined; 18516 const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType); 18517 const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); 18518 18519 // This boolean should return true if everything is loaded 18520 // ( categoriesTaxonomy, defaultCategory ) 18521 // and the post has not been assigned a category different than "uncategorized". 18522 return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]); 18523 }, []); 18524 const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); 18525 (0,external_wp_element_namespaceObject.useEffect)(() => { 18526 // We use state to avoid hiding the panel if the user edits the categories 18527 // and adds one within the panel itself (while visible). 18528 if (hasNoCategory) { 18529 setShouldShowPanel(true); 18530 } 18531 }, [hasNoCategory]); 18532 if (!shouldShowPanel) { 18533 return null; 18534 } 18535 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 18536 className: "editor-post-publish-panel__link", 18537 children: (0,external_wp_i18n_namespaceObject.__)('Assign a category') 18538 }, "label")]; 18539 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 18540 initialOpen: false, 18541 title: panelBodyTitle, 18542 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18543 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.') 18544 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector, { 18545 slug: "category" 18546 })] 18547 }); 18548 } 18549 /* harmony default export */ const maybe_category_panel = (MaybeCategoryPanel); 18550 18551 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/native.js 18552 const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); 18553 /* harmony default export */ const esm_browser_native = ({ 18554 randomUUID 18555 }); 18556 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/rng.js 18557 // Unique ID creation requires a high quality random # generator. In the browser we therefore 18558 // require the crypto API and do not support built-in fallback to lower quality random number 18559 // generators (like Math.random()). 18560 let getRandomValues; 18561 const rnds8 = new Uint8Array(16); 18562 function rng() { 18563 // lazy load so that environments that need to polyfill have a chance to do so 18564 if (!getRandomValues) { 18565 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 18566 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 18567 18568 if (!getRandomValues) { 18569 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 18570 } 18571 } 18572 18573 return getRandomValues(rnds8); 18574 } 18575 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/stringify.js 18576 18577 /** 18578 * Convert array of 16 byte values to UUID string format of the form: 18579 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 18580 */ 18581 18582 const byteToHex = []; 18583 18584 for (let i = 0; i < 256; ++i) { 18585 byteToHex.push((i + 0x100).toString(16).slice(1)); 18586 } 18587 18588 function unsafeStringify(arr, offset = 0) { 18589 // Note: Be careful editing this code! It's been tuned for performance 18590 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 18591 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]]; 18592 } 18593 18594 function stringify(arr, offset = 0) { 18595 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one 18596 // of the following: 18597 // - One or more input array values don't map to a hex octet (leading to 18598 // "undefined" in the uuid) 18599 // - Invalid input values for the RFC `version` or `variant` fields 18600 18601 if (!validate(uuid)) { 18602 throw TypeError('Stringified UUID is invalid'); 18603 } 18604 18605 return uuid; 18606 } 18607 18608 /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); 18609 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/v4.js 18610 18611 18612 18613 18614 function v4(options, buf, offset) { 18615 if (esm_browser_native.randomUUID && !buf && !options) { 18616 return esm_browser_native.randomUUID(); 18617 } 18618 18619 options = options || {}; 18620 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 18621 18622 rnds[6] = rnds[6] & 0x0f | 0x40; 18623 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 18624 18625 if (buf) { 18626 offset = offset || 0; 18627 18628 for (let i = 0; i < 16; ++i) { 18629 buf[offset + i] = rnds[i]; 18630 } 18631 18632 return buf; 18633 } 18634 18635 return unsafeStringify(rnds); 18636 } 18637 18638 /* harmony default export */ const esm_browser_v4 = (v4); 18639 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/media-util.js 18640 /** 18641 * External dependencies 18642 */ 18643 18644 18645 /** 18646 * WordPress dependencies 18647 */ 18648 18649 18650 /** 18651 * Generate a list of unique basenames given a list of URLs. 18652 * 18653 * We want all basenames to be unique, since sometimes the extension 18654 * doesn't reflect the mime type, and may end up getting changed by 18655 * the server, on upload. 18656 * 18657 * @param {string[]} urls The list of URLs 18658 * @return {Record< string, string >} A URL => basename record. 18659 */ 18660 function generateUniqueBasenames(urls) { 18661 const basenames = new Set(); 18662 return Object.fromEntries(urls.map(url => { 18663 // We prefer to match the remote filename, if possible. 18664 const filename = (0,external_wp_url_namespaceObject.getFilename)(url); 18665 let basename = ''; 18666 if (filename) { 18667 const parts = filename.split('.'); 18668 if (parts.length > 1) { 18669 // Assume the last part is the extension. 18670 parts.pop(); 18671 } 18672 basename = parts.join('.'); 18673 } 18674 if (!basename) { 18675 // It looks like we don't have a basename, so let's use a UUID. 18676 basename = esm_browser_v4(); 18677 } 18678 if (basenames.has(basename)) { 18679 // Append a UUID to deduplicate the basename. 18680 // The server will try to deduplicate on its own if we don't do this, 18681 // but it may run into a race condition 18682 // (see https://github.com/WordPress/gutenberg/issues/64899). 18683 // Deduplicating the filenames before uploading is safer. 18684 basename = `$basename}-$esm_browser_v4()}`; 18685 } 18686 basenames.add(basename); 18687 return [url, basename]; 18688 })); 18689 } 18690 18691 /** 18692 * Fetch a list of URLs, turning those into promises for files with 18693 * unique filenames. 18694 * 18695 * @param {string[]} urls The list of URLs 18696 * @return {Record< string, Promise< File > >} A URL => File promise record. 18697 */ 18698 function fetchMedia(urls) { 18699 return Object.fromEntries(Object.entries(generateUniqueBasenames(urls)).map(([url, basename]) => { 18700 const filePromise = window.fetch(url.includes('?') ? url : url + '?').then(response => response.blob()).then(blob => { 18701 // The server will reject the upload if it doesn't have an extension, 18702 // even though it'll rewrite the file name to match the mime type. 18703 // Here we provide it with a safe extension to get it past that check. 18704 return new File([blob], `$basename}.png`, { 18705 type: blob.type 18706 }); 18707 }); 18708 return [url, filePromise]; 18709 })); 18710 } 18711 18712 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js 18713 /** 18714 * WordPress dependencies 18715 */ 18716 18717 18718 18719 18720 18721 18722 18723 /** 18724 * Internal dependencies 18725 */ 18726 18727 18728 18729 function flattenBlocks(blocks) { 18730 const result = []; 18731 blocks.forEach(block => { 18732 result.push(block); 18733 result.push(...flattenBlocks(block.innerBlocks)); 18734 }); 18735 return result; 18736 } 18737 18738 /** 18739 * Determine whether a block has external media. 18740 * 18741 * Different blocks use different attribute names (and potentially 18742 * different logic as well) in determining whether the media is 18743 * present, and whether it's external. 18744 * 18745 * @param {{name: string, attributes: Object}} block The block. 18746 * @return {boolean?} Whether the block has external media 18747 */ 18748 function hasExternalMedia(block) { 18749 if (block.name === 'core/image' || block.name === 'core/cover') { 18750 return block.attributes.url && !block.attributes.id; 18751 } 18752 if (block.name === 'core/media-text') { 18753 return block.attributes.mediaUrl && !block.attributes.mediaId; 18754 } 18755 return undefined; 18756 } 18757 18758 /** 18759 * Retrieve media info from a block. 18760 * 18761 * Different blocks use different attribute names, so we need this 18762 * function to normalize things into a consistent naming scheme. 18763 * 18764 * @param {{name: string, attributes: Object}} block The block. 18765 * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block. 18766 */ 18767 function getMediaInfo(block) { 18768 if (block.name === 'core/image' || block.name === 'core/cover') { 18769 const { 18770 url, 18771 alt, 18772 id 18773 } = block.attributes; 18774 return { 18775 url, 18776 alt, 18777 id 18778 }; 18779 } 18780 if (block.name === 'core/media-text') { 18781 const { 18782 mediaUrl: url, 18783 mediaAlt: alt, 18784 mediaId: id 18785 } = block.attributes; 18786 return { 18787 url, 18788 alt, 18789 id 18790 }; 18791 } 18792 return {}; 18793 } 18794 18795 // Image component to represent a single image in the upload dialog. 18796 function Image({ 18797 clientId, 18798 alt, 18799 url 18800 }) { 18801 const { 18802 selectBlock 18803 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 18804 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, { 18805 tabIndex: 0, 18806 role: "button", 18807 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select image block.'), 18808 onClick: () => { 18809 selectBlock(clientId); 18810 }, 18811 onKeyDown: event => { 18812 if (event.key === 'Enter' || event.key === ' ') { 18813 selectBlock(clientId); 18814 event.preventDefault(); 18815 } 18816 }, 18817 alt: alt, 18818 src: url, 18819 animate: { 18820 opacity: 1 18821 }, 18822 exit: { 18823 opacity: 0, 18824 scale: 0 18825 }, 18826 style: { 18827 width: '32px', 18828 height: '32px', 18829 objectFit: 'cover', 18830 borderRadius: '2px', 18831 cursor: 'pointer' 18832 }, 18833 whileHover: { 18834 scale: 1.08 18835 } 18836 }, clientId); 18837 } 18838 function MaybeUploadMediaPanel() { 18839 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 18840 const [isAnimating, setIsAnimating] = (0,external_wp_element_namespaceObject.useState)(false); 18841 const [hadUploadError, setHadUploadError] = (0,external_wp_element_namespaceObject.useState)(false); 18842 const { 18843 editorBlocks, 18844 mediaUpload 18845 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 18846 editorBlocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks(), 18847 mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload 18848 }), []); 18849 18850 // Get a list of blocks with external media. 18851 const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter(block => hasExternalMedia(block)); 18852 const { 18853 updateBlockAttributes 18854 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 18855 if (!mediaUpload || !blocksWithExternalMedia.length) { 18856 return null; 18857 } 18858 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 18859 className: "editor-post-publish-panel__link", 18860 children: (0,external_wp_i18n_namespaceObject.__)('External media') 18861 }, "label")]; 18862 18863 /** 18864 * Update an individual block to point to newly-added library media. 18865 * 18866 * Different blocks use different attribute names, so we need this 18867 * function to ensure we modify the correct attributes for each type. 18868 * 18869 * @param {{name: string, attributes: Object}} block The block. 18870 * @param {{id: number, url: string}} media Media library file info. 18871 */ 18872 function updateBlockWithUploadedMedia(block, media) { 18873 if (block.name === 'core/image' || block.name === 'core/cover') { 18874 updateBlockAttributes(block.clientId, { 18875 id: media.id, 18876 url: media.url 18877 }); 18878 } 18879 if (block.name === 'core/media-text') { 18880 updateBlockAttributes(block.clientId, { 18881 mediaId: media.id, 18882 mediaUrl: media.url 18883 }); 18884 } 18885 } 18886 18887 // Handle fetching and uploading all external media in the post. 18888 function uploadImages() { 18889 setIsUploading(true); 18890 setHadUploadError(false); 18891 18892 // Multiple blocks can be using the same URL, so we 18893 // should ensure we only fetch and upload each of them once. 18894 const mediaUrls = new Set(blocksWithExternalMedia.map(block => { 18895 const { 18896 url 18897 } = getMediaInfo(block); 18898 return url; 18899 })); 18900 18901 // Create an upload promise for each URL, that we can wait for in all 18902 // blocks that make use of that media. 18903 const uploadPromises = Object.fromEntries(Object.entries(fetchMedia([...mediaUrls])).map(([url, filePromise]) => { 18904 const uploadPromise = filePromise.then(blob => new Promise((resolve, reject) => { 18905 mediaUpload({ 18906 filesList: [blob], 18907 onFileChange: ([media]) => { 18908 if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { 18909 return; 18910 } 18911 resolve(media); 18912 }, 18913 onError() { 18914 reject(); 18915 } 18916 }); 18917 })); 18918 return [url, uploadPromise]; 18919 })); 18920 18921 // Wait for all blocks to be updated with library media. 18922 Promise.allSettled(blocksWithExternalMedia.map(block => { 18923 const { 18924 url 18925 } = getMediaInfo(block); 18926 return uploadPromises[url].then(media => updateBlockWithUploadedMedia(block, media)).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true)); 18927 })).finally(() => { 18928 setIsUploading(false); 18929 }); 18930 } 18931 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 18932 initialOpen: true, 18933 title: panelBodyTitle, 18934 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18935 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.') 18936 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 18937 style: { 18938 display: 'inline-flex', 18939 flexWrap: 'wrap', 18940 gap: '8px' 18941 }, 18942 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { 18943 onExitComplete: () => setIsAnimating(false), 18944 children: blocksWithExternalMedia.map(block => { 18945 const { 18946 url, 18947 alt 18948 } = getMediaInfo(block); 18949 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Image, { 18950 clientId: block.clientId, 18951 url: url, 18952 alt: alt 18953 }, block.clientId); 18954 }) 18955 }), isUploading || isAnimating ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 18956 size: "compact", 18957 variant: "primary", 18958 onClick: uploadImages, 18959 children: (0,external_wp_i18n_namespaceObject.__)('Upload') 18960 })] 18961 }), hadUploadError && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 18962 children: (0,external_wp_i18n_namespaceObject.__)('Upload failed, try again.') 18963 })] 18964 }); 18965 } 18966 18967 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js 18968 /** 18969 * WordPress dependencies 18970 */ 18971 18972 18973 18974 18975 18976 18977 18978 18979 /** 18980 * Internal dependencies 18981 */ 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 function PostPublishPanelPrepublish({ 18995 children 18996 }) { 18997 const { 18998 isBeingScheduled, 18999 isRequestingSiteIcon, 19000 hasPublishAction, 19001 siteIconUrl, 19002 siteTitle, 19003 siteHome 19004 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19005 var _getCurrentPost$_link; 19006 const { 19007 getCurrentPost, 19008 isEditedPostBeingScheduled 19009 } = select(store_store); 19010 const { 19011 getEntityRecord, 19012 isResolving 19013 } = select(external_wp_coreData_namespaceObject.store); 19014 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 19015 return { 19016 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 19017 isBeingScheduled: isEditedPostBeingScheduled(), 19018 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), 19019 siteIconUrl: siteData.site_icon_url, 19020 siteTitle: siteData.name, 19021 siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) 19022 }; 19023 }, []); 19024 let siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 19025 className: "components-site-icon", 19026 size: "36px", 19027 icon: library_wordpress 19028 }); 19029 if (siteIconUrl) { 19030 siteIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 19031 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 19032 className: "components-site-icon", 19033 src: siteIconUrl 19034 }); 19035 } 19036 if (isRequestingSiteIcon) { 19037 siteIcon = null; 19038 } 19039 let prePublishTitle, prePublishBodyText; 19040 if (!hasPublishAction) { 19041 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?'); 19042 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); 19043 } else if (isBeingScheduled) { 19044 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?'); 19045 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.'); 19046 } else { 19047 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?'); 19048 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.'); 19049 } 19050 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19051 className: "editor-post-publish-panel__prepublish", 19052 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19053 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 19054 children: prePublishTitle 19055 }) 19056 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 19057 children: prePublishBodyText 19058 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19059 className: "components-site-card", 19060 children: [siteIcon, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19061 className: "components-site-info", 19062 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 19063 className: "components-site-name", 19064 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)') 19065 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 19066 className: "components-site-home", 19067 children: siteHome 19068 })] 19069 })] 19070 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeUploadMediaPanel, {}), hasPublishAction && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19071 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 19072 initialOpen: false, 19073 title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 19074 className: "editor-post-publish-panel__link", 19075 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {}) 19076 }, "label")], 19077 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {}) 19078 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 19079 initialOpen: false, 19080 title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 19081 className: "editor-post-publish-panel__link", 19082 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}) 19083 }, "label")], 19084 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {}) 19085 })] 19086 }), /*#__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] 19087 }); 19088 } 19089 /* harmony default export */ const prepublish = (PostPublishPanelPrepublish); 19090 19091 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js 19092 /** 19093 * WordPress dependencies 19094 */ 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 /** 19105 * Internal dependencies 19106 */ 19107 19108 19109 19110 19111 19112 const POSTNAME = '%postname%'; 19113 const PAGENAME = '%pagename%'; 19114 19115 /** 19116 * Returns URL for a future post. 19117 * 19118 * @param {Object} post Post object. 19119 * 19120 * @return {string} PostPublish URL. 19121 */ 19122 19123 const getFuturePostUrl = post => { 19124 const { 19125 slug 19126 } = post; 19127 if (post.permalink_template.includes(POSTNAME)) { 19128 return post.permalink_template.replace(POSTNAME, slug); 19129 } 19130 if (post.permalink_template.includes(PAGENAME)) { 19131 return post.permalink_template.replace(PAGENAME, slug); 19132 } 19133 return post.permalink_template; 19134 }; 19135 function postpublish_CopyButton({ 19136 text, 19137 onCopy, 19138 children 19139 }) { 19140 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy); 19141 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19142 __next40pxDefaultSize: true, 19143 variant: "secondary", 19144 ref: ref, 19145 children: children 19146 }); 19147 } 19148 class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component { 19149 constructor() { 19150 super(...arguments); 19151 this.state = { 19152 showCopyConfirmation: false 19153 }; 19154 this.onCopy = this.onCopy.bind(this); 19155 this.onSelectInput = this.onSelectInput.bind(this); 19156 this.postLink = (0,external_wp_element_namespaceObject.createRef)(); 19157 } 19158 componentDidMount() { 19159 if (this.props.focusOnMount) { 19160 this.postLink.current.focus(); 19161 } 19162 } 19163 componentWillUnmount() { 19164 clearTimeout(this.dismissCopyConfirmation); 19165 } 19166 onCopy() { 19167 this.setState({ 19168 showCopyConfirmation: true 19169 }); 19170 clearTimeout(this.dismissCopyConfirmation); 19171 this.dismissCopyConfirmation = setTimeout(() => { 19172 this.setState({ 19173 showCopyConfirmation: false 19174 }); 19175 }, 4000); 19176 } 19177 onSelectInput(event) { 19178 event.target.select(); 19179 } 19180 render() { 19181 const { 19182 children, 19183 isScheduled, 19184 post, 19185 postType 19186 } = this.props; 19187 const postLabel = postType?.labels?.singular_name; 19188 const viewPostLabel = postType?.labels?.view_item; 19189 const addNewPostLabel = postType?.labels?.add_new_item; 19190 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; 19191 const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', { 19192 post_type: post.type 19193 }); 19194 const postPublishNonLinkHeader = isScheduled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19195 children: [(0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), "."] 19196 }) : (0,external_wp_i18n_namespaceObject.__)('is now live.'); 19197 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19198 className: "post-publish-panel__postpublish", 19199 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 19200 className: "post-publish-panel__postpublish-header", 19201 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { 19202 ref: this.postLink, 19203 href: link, 19204 children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)') 19205 }), ' ', postPublishNonLinkHeader] 19206 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { 19207 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 19208 className: "post-publish-panel__postpublish-subheader", 19209 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { 19210 children: (0,external_wp_i18n_namespaceObject.__)('What’s next?') 19211 }) 19212 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19213 className: "post-publish-panel__postpublish-post-address-container", 19214 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 19215 __next40pxDefaultSize: true, 19216 __nextHasNoMarginBottom: true, 19217 className: "post-publish-panel__postpublish-post-address", 19218 readOnly: true, 19219 label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post type singular name */ 19220 (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel), 19221 value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), 19222 onFocus: this.onSelectInput 19223 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19224 className: "post-publish-panel__postpublish-post-address__copy-button-wrap", 19225 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, { 19226 text: link, 19227 onCopy: this.onCopy, 19228 children: this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy') 19229 }) 19230 })] 19231 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19232 className: "post-publish-panel__postpublish-buttons", 19233 children: [!isScheduled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19234 variant: "primary", 19235 href: link, 19236 __next40pxDefaultSize: true, 19237 children: viewPostLabel 19238 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19239 variant: isScheduled ? 'primary' : 'secondary', 19240 __next40pxDefaultSize: true, 19241 href: addLink, 19242 children: addNewPostLabel 19243 })] 19244 })] 19245 }), children] 19246 }); 19247 } 19248 } 19249 /* harmony default export */ const postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => { 19250 const { 19251 getEditedPostAttribute, 19252 getCurrentPost, 19253 isCurrentPostScheduled 19254 } = select(store_store); 19255 const { 19256 getPostType 19257 } = select(external_wp_coreData_namespaceObject.store); 19258 return { 19259 post: getCurrentPost(), 19260 postType: getPostType(getEditedPostAttribute('type')), 19261 isScheduled: isCurrentPostScheduled() 19262 }; 19263 })(PostPublishPanelPostpublish)); 19264 19265 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js 19266 /** 19267 * WordPress dependencies 19268 */ 19269 19270 19271 19272 19273 19274 19275 19276 19277 /** 19278 * Internal dependencies 19279 */ 19280 19281 19282 19283 19284 19285 19286 19287 class PostPublishPanel extends external_wp_element_namespaceObject.Component { 19288 constructor() { 19289 super(...arguments); 19290 this.onSubmit = this.onSubmit.bind(this); 19291 this.cancelButtonNode = (0,external_wp_element_namespaceObject.createRef)(); 19292 } 19293 componentDidMount() { 19294 // This timeout is necessary to make sure the `useEffect` hook of 19295 // `useFocusReturn` gets the correct element (the button that opens the 19296 // PostPublishPanel) otherwise it will get this button. 19297 this.timeoutID = setTimeout(() => { 19298 this.cancelButtonNode.current.focus(); 19299 }, 0); 19300 } 19301 componentWillUnmount() { 19302 clearTimeout(this.timeoutID); 19303 } 19304 componentDidUpdate(prevProps) { 19305 // Automatically collapse the publish sidebar when a post 19306 // is published and the user makes an edit. 19307 if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) { 19308 this.props.onClose(); 19309 } 19310 } 19311 onSubmit() { 19312 const { 19313 onClose, 19314 hasPublishAction, 19315 isPostTypeViewable 19316 } = this.props; 19317 if (!hasPublishAction || !isPostTypeViewable) { 19318 onClose(); 19319 } 19320 } 19321 render() { 19322 const { 19323 forceIsDirty, 19324 isBeingScheduled, 19325 isPublished, 19326 isPublishSidebarEnabled, 19327 isScheduled, 19328 isSaving, 19329 isSavingNonPostEntityChanges, 19330 onClose, 19331 onTogglePublishSidebar, 19332 PostPublishExtension, 19333 PrePublishExtension, 19334 ...additionalProps 19335 } = this.props; 19336 const { 19337 hasPublishAction, 19338 isDirty, 19339 isPostTypeViewable, 19340 ...propsForPanel 19341 } = additionalProps; 19342 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; 19343 const isPrePublish = !isPublishedOrScheduled && !isSaving; 19344 const isPostPublish = isPublishedOrScheduled && !isSaving; 19345 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19346 className: "editor-post-publish-panel", 19347 ...propsForPanel, 19348 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19349 className: "editor-post-publish-panel__header", 19350 children: isPostPublish ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19351 size: "compact", 19352 onClick: onClose, 19353 icon: close_small, 19354 label: (0,external_wp_i18n_namespaceObject.__)('Close panel') 19355 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19356 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19357 className: "editor-post-publish-panel__header-cancel-button", 19358 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19359 ref: this.cancelButtonNode, 19360 accessibleWhenDisabled: true, 19361 disabled: isSavingNonPostEntityChanges, 19362 onClick: onClose, 19363 variant: "secondary", 19364 size: "compact", 19365 children: (0,external_wp_i18n_namespaceObject.__)('Cancel') 19366 }) 19367 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19368 className: "editor-post-publish-panel__header-publish-button", 19369 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { 19370 onSubmit: this.onSubmit, 19371 forceIsDirty: forceIsDirty 19372 }) 19373 })] 19374 }) 19375 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 19376 className: "editor-post-publish-panel__content", 19377 children: [isPrePublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish, { 19378 children: PrePublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {}) 19379 }), isPostPublish && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish, { 19380 focusOnMount: true, 19381 children: PostPublishExtension && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {}) 19382 }), isSaving && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] 19383 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19384 className: "editor-post-publish-panel__footer", 19385 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 19386 __nextHasNoMarginBottom: true, 19387 label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'), 19388 checked: isPublishSidebarEnabled, 19389 onChange: onTogglePublishSidebar 19390 }) 19391 })] 19392 }); 19393 } 19394 } 19395 19396 /** 19397 * Renders a panel for publishing a post. 19398 */ 19399 /* harmony default export */ const post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { 19400 var _getCurrentPost$_link; 19401 const { 19402 getPostType 19403 } = select(external_wp_coreData_namespaceObject.store); 19404 const { 19405 getCurrentPost, 19406 getEditedPostAttribute, 19407 isCurrentPostPublished, 19408 isCurrentPostScheduled, 19409 isEditedPostBeingScheduled, 19410 isEditedPostDirty, 19411 isAutosavingPost, 19412 isSavingPost, 19413 isSavingNonPostEntityChanges 19414 } = select(store_store); 19415 const { 19416 isPublishSidebarEnabled 19417 } = select(store_store); 19418 const postType = getPostType(getEditedPostAttribute('type')); 19419 return { 19420 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 19421 isPostTypeViewable: postType?.viewable, 19422 isBeingScheduled: isEditedPostBeingScheduled(), 19423 isDirty: isEditedPostDirty(), 19424 isPublished: isCurrentPostPublished(), 19425 isPublishSidebarEnabled: isPublishSidebarEnabled(), 19426 isSaving: isSavingPost() && !isAutosavingPost(), 19427 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), 19428 isScheduled: isCurrentPostScheduled() 19429 }; 19430 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 19431 isPublishSidebarEnabled 19432 }) => { 19433 const { 19434 disablePublishSidebar, 19435 enablePublishSidebar 19436 } = dispatch(store_store); 19437 return { 19438 onTogglePublishSidebar: () => { 19439 if (isPublishSidebarEnabled) { 19440 disablePublishSidebar(); 19441 } else { 19442 enablePublishSidebar(); 19443 } 19444 } 19445 }; 19446 }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel)); 19447 19448 ;// ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js 19449 /** 19450 * WordPress dependencies 19451 */ 19452 19453 19454 const cloudUpload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19455 xmlns: "http://www.w3.org/2000/svg", 19456 viewBox: "0 0 24 24", 19457 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19458 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-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.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 0 1-.8 1.8-1.7 1.8z" 19459 }) 19460 }); 19461 /* harmony default export */ const cloud_upload = (cloudUpload); 19462 19463 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 19464 /** 19465 * WordPress dependencies 19466 */ 19467 19468 19469 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 19470 19471 /** 19472 * Return an SVG icon. 19473 * 19474 * @param {IconProps} props icon is the SVG component to render 19475 * size is a number specifiying the icon size in pixels 19476 * Other props will be passed to wrapped SVG component 19477 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 19478 * 19479 * @return {JSX.Element} Icon component 19480 */ 19481 function Icon({ 19482 icon, 19483 size = 24, 19484 ...props 19485 }, ref) { 19486 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 19487 width: size, 19488 height: size, 19489 ...props, 19490 ref 19491 }); 19492 } 19493 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 19494 19495 ;// ./node_modules/@wordpress/icons/build-module/library/cloud.js 19496 /** 19497 * WordPress dependencies 19498 */ 19499 19500 19501 const cloud = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19502 xmlns: "http://www.w3.org/2000/svg", 19503 viewBox: "0 0 24 24", 19504 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19505 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" 19506 }) 19507 }); 19508 /* harmony default export */ const library_cloud = (cloud); 19509 19510 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 19511 /** 19512 * WordPress dependencies 19513 */ 19514 19515 19516 const drafts = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19517 xmlns: "http://www.w3.org/2000/svg", 19518 viewBox: "0 0 24 24", 19519 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19520 fillRule: "evenodd", 19521 clipRule: "evenodd", 19522 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" 19523 }) 19524 }); 19525 /* harmony default export */ const library_drafts = (drafts); 19526 19527 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 19528 /** 19529 * WordPress dependencies 19530 */ 19531 19532 19533 const pending = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19534 xmlns: "http://www.w3.org/2000/svg", 19535 viewBox: "0 0 24 24", 19536 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19537 fillRule: "evenodd", 19538 clipRule: "evenodd", 19539 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" 19540 }) 19541 }); 19542 /* harmony default export */ const library_pending = (pending); 19543 19544 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 19545 /** 19546 * WordPress dependencies 19547 */ 19548 19549 19550 const notAllowed = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19551 xmlns: "http://www.w3.org/2000/svg", 19552 viewBox: "0 0 24 24", 19553 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19554 fillRule: "evenodd", 19555 clipRule: "evenodd", 19556 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" 19557 }) 19558 }); 19559 /* harmony default export */ const not_allowed = (notAllowed); 19560 19561 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 19562 /** 19563 * WordPress dependencies 19564 */ 19565 19566 19567 const scheduled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19568 xmlns: "http://www.w3.org/2000/svg", 19569 viewBox: "0 0 24 24", 19570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19571 fillRule: "evenodd", 19572 clipRule: "evenodd", 19573 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" 19574 }) 19575 }); 19576 /* harmony default export */ const library_scheduled = (scheduled); 19577 19578 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 19579 /** 19580 * WordPress dependencies 19581 */ 19582 19583 19584 const published = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 19585 xmlns: "http://www.w3.org/2000/svg", 19586 viewBox: "0 0 24 24", 19587 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 19588 fillRule: "evenodd", 19589 clipRule: "evenodd", 19590 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" 19591 }) 19592 }); 19593 /* harmony default export */ const library_published = (published); 19594 19595 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js 19596 /** 19597 * WordPress dependencies 19598 */ 19599 19600 19601 /** 19602 * Internal dependencies 19603 */ 19604 19605 19606 /** 19607 * Wrapper component that renders its children only if post has a sticky action. 19608 * 19609 * @param {Object} props Props. 19610 * @param {Element} props.children Children to be rendered. 19611 * 19612 * @return {Component} The component to be rendered or null if post type is not 'post' or hasStickyAction is false. 19613 */ 19614 function PostStickyCheck({ 19615 children 19616 }) { 19617 const { 19618 hasStickyAction, 19619 postType 19620 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19621 var _post$_links$wpActio; 19622 const post = select(store_store).getCurrentPost(); 19623 return { 19624 hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false, 19625 postType: select(store_store).getCurrentPostType() 19626 }; 19627 }, []); 19628 if (postType !== 'post' || !hasStickyAction) { 19629 return null; 19630 } 19631 return children; 19632 } 19633 19634 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js 19635 /** 19636 * WordPress dependencies 19637 */ 19638 19639 19640 19641 19642 /** 19643 * Internal dependencies 19644 */ 19645 19646 19647 19648 /** 19649 * Renders the PostSticky component. It provides a checkbox control for the sticky post feature. 19650 * 19651 * @return {Component} The component to be rendered. 19652 */ 19653 19654 function PostSticky() { 19655 const postSticky = (0,external_wp_data_namespaceObject.useSelect)(select => { 19656 var _select$getEditedPost; 19657 return (_select$getEditedPost = select(store_store).getEditedPostAttribute('sticky')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : false; 19658 }, []); 19659 const { 19660 editPost 19661 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 19662 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, { 19663 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 19664 className: "editor-post-sticky__checkbox-control", 19665 label: (0,external_wp_i18n_namespaceObject.__)('Sticky'), 19666 help: (0,external_wp_i18n_namespaceObject.__)('Pin this post to the top of the blog'), 19667 checked: postSticky, 19668 onChange: () => editPost({ 19669 sticky: !postSticky 19670 }), 19671 __nextHasNoMarginBottom: true 19672 }) 19673 }); 19674 } 19675 19676 ;// ./node_modules/@wordpress/editor/build-module/components/post-status/index.js 19677 /** 19678 * WordPress dependencies 19679 */ 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 /** 19690 * Internal dependencies 19691 */ 19692 19693 19694 19695 19696 19697 19698 19699 19700 const postStatusesInfo = { 19701 'auto-draft': { 19702 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 19703 icon: library_drafts 19704 }, 19705 draft: { 19706 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 19707 icon: library_drafts 19708 }, 19709 pending: { 19710 label: (0,external_wp_i18n_namespaceObject.__)('Pending'), 19711 icon: library_pending 19712 }, 19713 private: { 19714 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 19715 icon: not_allowed 19716 }, 19717 future: { 19718 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 19719 icon: library_scheduled 19720 }, 19721 publish: { 19722 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 19723 icon: library_published 19724 } 19725 }; 19726 const STATUS_OPTIONS = [{ 19727 label: (0,external_wp_i18n_namespaceObject.__)('Draft'), 19728 value: 'draft', 19729 description: (0,external_wp_i18n_namespaceObject.__)('Not ready to publish.') 19730 }, { 19731 label: (0,external_wp_i18n_namespaceObject.__)('Pending'), 19732 value: 'pending', 19733 description: (0,external_wp_i18n_namespaceObject.__)('Waiting for review before publishing.') 19734 }, { 19735 label: (0,external_wp_i18n_namespaceObject.__)('Private'), 19736 value: 'private', 19737 description: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') 19738 }, { 19739 label: (0,external_wp_i18n_namespaceObject.__)('Scheduled'), 19740 value: 'future', 19741 description: (0,external_wp_i18n_namespaceObject.__)('Publish automatically on a chosen date.') 19742 }, { 19743 label: (0,external_wp_i18n_namespaceObject.__)('Published'), 19744 value: 'publish', 19745 description: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') 19746 }]; 19747 const DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; 19748 function PostStatus() { 19749 const { 19750 status, 19751 date, 19752 password, 19753 postId, 19754 postType, 19755 canEdit 19756 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19757 var _getCurrentPost$_link; 19758 const { 19759 getEditedPostAttribute, 19760 getCurrentPostId, 19761 getCurrentPostType, 19762 getCurrentPost 19763 } = select(store_store); 19764 return { 19765 status: getEditedPostAttribute('status'), 19766 date: getEditedPostAttribute('date'), 19767 password: getEditedPostAttribute('password'), 19768 postId: getCurrentPostId(), 19769 postType: getCurrentPostType(), 19770 canEdit: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false 19771 }; 19772 }, []); 19773 const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 19774 const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostStatus, 'editor-change-status__password-input'); 19775 const { 19776 editEntityRecord 19777 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 19778 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 19779 // Memoize popoverProps to avoid returning a new object every time. 19780 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 19781 // Anchor the popover to the middle of the entire row so that it doesn't 19782 // move around when the label changes. 19783 anchor: popoverAnchor, 19784 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 19785 headerTitle: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 19786 placement: 'left-start', 19787 offset: 36, 19788 shift: true 19789 }), [popoverAnchor]); 19790 if (DESIGN_POST_TYPES.includes(postType)) { 19791 return null; 19792 } 19793 const updatePost = ({ 19794 status: newStatus = status, 19795 password: newPassword = password, 19796 date: newDate = date 19797 }) => { 19798 editEntityRecord('postType', postType, postId, { 19799 status: newStatus, 19800 date: newDate, 19801 password: newPassword 19802 }); 19803 }; 19804 const handleTogglePassword = value => { 19805 setShowPassword(value); 19806 if (!value) { 19807 updatePost({ 19808 password: '' 19809 }); 19810 } 19811 }; 19812 const handleStatus = value => { 19813 let newDate = date; 19814 let newPassword = password; 19815 if (status === 'future' && new Date(date) > new Date()) { 19816 newDate = null; 19817 } 19818 if (value === 'private' && password) { 19819 newPassword = ''; 19820 } 19821 updatePost({ 19822 status: value, 19823 date: newDate, 19824 password: newPassword 19825 }); 19826 }; 19827 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 19828 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 19829 ref: setPopoverAnchor, 19830 children: canEdit ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 19831 className: "editor-post-status", 19832 contentClassName: "editor-change-status__content", 19833 popoverProps: popoverProps, 19834 focusOnMount: true, 19835 renderToggle: ({ 19836 onToggle, 19837 isOpen 19838 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 19839 className: "editor-post-status__toggle", 19840 variant: "tertiary", 19841 size: "compact", 19842 onClick: onToggle, 19843 icon: postStatusesInfo[status]?.icon, 19844 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 19845 // translators: %s: Current post status. 19846 (0,external_wp_i18n_namespaceObject.__)('Change status: %s'), postStatusesInfo[status]?.label), 19847 "aria-expanded": isOpen, 19848 children: postStatusesInfo[status]?.label 19849 }), 19850 renderContent: ({ 19851 onClose 19852 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 19853 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 19854 title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), 19855 onClose: onClose 19856 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 19857 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19858 spacing: 4, 19859 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 19860 className: "editor-change-status__options", 19861 hideLabelFromVision: true, 19862 label: (0,external_wp_i18n_namespaceObject.__)('Status'), 19863 options: STATUS_OPTIONS, 19864 onChange: handleStatus, 19865 selected: status === 'auto-draft' ? 'draft' : status 19866 }), status === 'future' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19867 className: "editor-change-status__publish-date-wrapper", 19868 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, { 19869 showPopoverHeaderActions: false, 19870 isCompact: true 19871 }) 19872 }), status !== 'private' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 19873 as: "fieldset", 19874 spacing: 4, 19875 className: "editor-change-status__password-fieldset", 19876 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 19877 __nextHasNoMarginBottom: true, 19878 label: (0,external_wp_i18n_namespaceObject.__)('Password protected'), 19879 help: (0,external_wp_i18n_namespaceObject.__)('Only visible to those who know the password'), 19880 checked: showPassword, 19881 onChange: handleTogglePassword 19882 }), showPassword && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19883 className: "editor-change-status__password-input", 19884 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 19885 label: (0,external_wp_i18n_namespaceObject.__)('Password'), 19886 onChange: value => updatePost({ 19887 password: value 19888 }), 19889 value: password, 19890 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password'), 19891 type: "text", 19892 id: passwordInputId, 19893 __next40pxDefaultSize: true, 19894 __nextHasNoMarginBottom: true, 19895 maxLength: 255 19896 }) 19897 })] 19898 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {})] 19899 }) 19900 })] 19901 }) 19902 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 19903 className: "editor-post-status is-read-only", 19904 children: postStatusesInfo[status]?.label 19905 }) 19906 }); 19907 } 19908 19909 ;// ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js 19910 /** 19911 * External dependencies 19912 */ 19913 19914 19915 /** 19916 * WordPress dependencies 19917 */ 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 /** 19928 * Internal dependencies 19929 */ 19930 19931 19932 19933 /** 19934 * Component showing whether the post is saved or not and providing save 19935 * buttons. 19936 * 19937 * @param {Object} props Component props. 19938 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked 19939 * as dirty. 19940 * @return {import('react').ComponentType} The component. 19941 */ 19942 19943 19944 function PostSavedState({ 19945 forceIsDirty 19946 }) { 19947 const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); 19948 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); 19949 const { 19950 isAutosaving, 19951 isDirty, 19952 isNew, 19953 isPublished, 19954 isSaveable, 19955 isSaving, 19956 isScheduled, 19957 hasPublishAction, 19958 showIconLabels, 19959 postStatus, 19960 postStatusHasChanged 19961 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 19962 var _getCurrentPost$_link; 19963 const { 19964 isEditedPostNew, 19965 isCurrentPostPublished, 19966 isCurrentPostScheduled, 19967 isEditedPostDirty, 19968 isSavingPost, 19969 isEditedPostSaveable, 19970 getCurrentPost, 19971 isAutosavingPost, 19972 getEditedPostAttribute, 19973 getPostEdits 19974 } = select(store_store); 19975 const { 19976 get 19977 } = select(external_wp_preferences_namespaceObject.store); 19978 return { 19979 isAutosaving: isAutosavingPost(), 19980 isDirty: forceIsDirty || isEditedPostDirty(), 19981 isNew: isEditedPostNew(), 19982 isPublished: isCurrentPostPublished(), 19983 isSaving: isSavingPost(), 19984 isSaveable: isEditedPostSaveable(), 19985 isScheduled: isCurrentPostScheduled(), 19986 hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, 19987 showIconLabels: get('core', 'showIconLabels'), 19988 postStatus: getEditedPostAttribute('status'), 19989 postStatusHasChanged: !!getPostEdits()?.status 19990 }; 19991 }, [forceIsDirty]); 19992 const isPending = postStatus === 'pending'; 19993 const { 19994 savePost 19995 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 19996 const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); 19997 (0,external_wp_element_namespaceObject.useEffect)(() => { 19998 let timeoutId; 19999 if (wasSaving && !isSaving) { 20000 setForceSavedMessage(true); 20001 timeoutId = setTimeout(() => { 20002 setForceSavedMessage(false); 20003 }, 1000); 20004 } 20005 return () => clearTimeout(timeoutId); 20006 }, [isSaving]); 20007 20008 // Once the post has been submitted for review this button 20009 // is not needed for the contributor role. 20010 if (!hasPublishAction && isPending) { 20011 return null; 20012 } 20013 20014 // We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft. 20015 // The reason for this is that this button handles the `save as pending` and `save draft` actions. 20016 // An exception for this is when the post has a custom status and there should be a way to save changes without 20017 // having to publish. This should be handled better in the future when custom statuses have better support. 20018 // @see https://github.com/WordPress/gutenberg/issues/3144. 20019 const isIneligibleStatus = !['pending', 'draft', 'auto-draft'].includes(postStatus) && STATUS_OPTIONS.map(({ 20020 value 20021 }) => value).includes(postStatus); 20022 if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) { 20023 return null; 20024 } 20025 20026 /* translators: button label text should, if possible, be under 16 characters. */ 20027 const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft'); 20028 20029 /* translators: button label text should, if possible, be under 16 characters. */ 20030 const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save'); 20031 const isSaved = forceSavedMessage || !isNew && !isDirty; 20032 const isSavedState = isSaving || isSaved; 20033 const isDisabled = isSaving || isSaved || !isSaveable; 20034 let text; 20035 if (isSaving) { 20036 text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving'); 20037 } else if (isSaved) { 20038 text = (0,external_wp_i18n_namespaceObject.__)('Saved'); 20039 } else if (isLargeViewport) { 20040 text = label; 20041 } else if (showIconLabels) { 20042 text = shortLabel; 20043 } 20044 20045 // Use common Button instance for all saved states so that focus is not 20046 // lost. 20047 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { 20048 className: isSaveable || isSaving ? dist_clsx({ 20049 'editor-post-save-draft': !isSavedState, 20050 'editor-post-saved-state': isSavedState, 20051 'is-saving': isSaving, 20052 'is-autosaving': isAutosaving, 20053 'is-saved': isSaved, 20054 [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ 20055 type: 'loading' 20056 })]: isSaving 20057 }) : undefined, 20058 onClick: isDisabled ? undefined : () => savePost() 20059 /* 20060 * We want the tooltip to show the keyboard shortcut only when the 20061 * button does something, i.e. when it's not disabled. 20062 */, 20063 shortcut: isDisabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s'), 20064 variant: "tertiary", 20065 size: "compact", 20066 icon: isLargeViewport ? undefined : cloud_upload, 20067 label: text || label, 20068 "aria-disabled": isDisabled, 20069 children: [isSavedState && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { 20070 icon: isSaved ? library_check : library_cloud 20071 }), text] 20072 }); 20073 } 20074 20075 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js 20076 /** 20077 * WordPress dependencies 20078 */ 20079 20080 20081 /** 20082 * Internal dependencies 20083 */ 20084 20085 20086 /** 20087 * Wrapper component that renders its children only if post has a publish action. 20088 * 20089 * @param {Object} props Props. 20090 * @param {Element} props.children Children to be rendered. 20091 * 20092 * @return {Component} - The component to be rendered or null if there is no publish action. 20093 */ 20094 function PostScheduleCheck({ 20095 children 20096 }) { 20097 const hasPublishAction = (0,external_wp_data_namespaceObject.useSelect)(select => { 20098 var _select$getCurrentPos; 20099 return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; 20100 }, []); 20101 if (!hasPublishAction) { 20102 return null; 20103 } 20104 return children; 20105 } 20106 20107 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js 20108 /** 20109 * WordPress dependencies 20110 */ 20111 20112 20113 20114 20115 20116 /** 20117 * Internal dependencies 20118 */ 20119 20120 20121 20122 20123 20124 20125 20126 const panel_DESIGN_POST_TYPES = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, NAVIGATION_POST_TYPE]; 20127 20128 /** 20129 * Renders the Post Schedule Panel component. 20130 * 20131 * @return {Component} The component to be rendered. 20132 */ 20133 function PostSchedulePanel() { 20134 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20135 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 20136 // Memoize popoverProps to avoid returning a new object every time. 20137 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 20138 // Anchor the popover to the middle of the entire row so that it doesn't 20139 // move around when the label changes. 20140 anchor: popoverAnchor, 20141 'aria-label': (0,external_wp_i18n_namespaceObject.__)('Change publish date'), 20142 placement: 'left-start', 20143 offset: 36, 20144 shift: true 20145 }), [popoverAnchor]); 20146 const label = usePostScheduleLabel(); 20147 const fullLabel = usePostScheduleLabel({ 20148 full: true 20149 }); 20150 if (panel_DESIGN_POST_TYPES.includes(postType)) { 20151 return null; 20152 } 20153 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, { 20154 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 20155 label: (0,external_wp_i18n_namespaceObject.__)('Publish'), 20156 ref: setPopoverAnchor, 20157 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 20158 popoverProps: popoverProps, 20159 focusOnMount: true, 20160 className: "editor-post-schedule__panel-dropdown", 20161 contentClassName: "editor-post-schedule__dialog", 20162 renderToggle: ({ 20163 onToggle, 20164 isOpen 20165 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20166 size: "compact", 20167 className: "editor-post-schedule__dialog-toggle", 20168 variant: "tertiary", 20169 tooltipPosition: "middle left", 20170 onClick: onToggle, 20171 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 20172 // translators: %s: Current post date. 20173 (0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label), 20174 label: fullLabel, 20175 showTooltip: label !== fullLabel, 20176 "aria-expanded": isOpen, 20177 children: label 20178 }), 20179 renderContent: ({ 20180 onClose 20181 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, { 20182 onClose: onClose 20183 }) 20184 }) 20185 }) 20186 }); 20187 } 20188 20189 ;// ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js 20190 /** 20191 * Internal dependencies 20192 */ 20193 20194 20195 /** 20196 * Wrapper component that renders its children only if the post type supports the slug. 20197 * 20198 * @param {Object} props Props. 20199 * @param {Element} props.children Children to be rendered. 20200 * 20201 * @return {Component} The component to be rendered. 20202 */ 20203 20204 function PostSlugCheck({ 20205 children 20206 }) { 20207 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20208 supportKeys: "slug", 20209 children: children 20210 }); 20211 } 20212 20213 ;// ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js 20214 /** 20215 * WordPress dependencies 20216 */ 20217 20218 20219 20220 20221 20222 20223 /** 20224 * Internal dependencies 20225 */ 20226 20227 20228 20229 function PostSlugControl() { 20230 const postSlug = (0,external_wp_data_namespaceObject.useSelect)(select => { 20231 return (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()); 20232 }, []); 20233 const { 20234 editPost 20235 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20236 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); 20237 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 20238 __next40pxDefaultSize: true, 20239 __nextHasNoMarginBottom: true, 20240 label: (0,external_wp_i18n_namespaceObject.__)('Slug'), 20241 autoComplete: "off", 20242 spellCheck: "false", 20243 value: forceEmptyField ? '' : postSlug, 20244 onChange: newValue => { 20245 editPost({ 20246 slug: newValue 20247 }); 20248 // When we delete the field the permalink gets 20249 // reverted to the original value. 20250 // The forceEmptyField logic allows the user to have 20251 // the field temporarily empty while typing. 20252 if (!newValue) { 20253 if (!forceEmptyField) { 20254 setForceEmptyField(true); 20255 } 20256 return; 20257 } 20258 if (forceEmptyField) { 20259 setForceEmptyField(false); 20260 } 20261 }, 20262 onBlur: event => { 20263 editPost({ 20264 slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value) 20265 }); 20266 if (forceEmptyField) { 20267 setForceEmptyField(false); 20268 } 20269 }, 20270 className: "editor-post-slug" 20271 }); 20272 } 20273 20274 /** 20275 * Renders the PostSlug component. It provide a control for editing the post slug. 20276 * 20277 * @return {Component} The component to be rendered. 20278 */ 20279 function PostSlug() { 20280 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSlugCheck, { 20281 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSlugControl, {}) 20282 }); 20283 } 20284 20285 ;// ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js 20286 /** 20287 * WordPress dependencies 20288 */ 20289 20290 20291 20292 20293 20294 20295 /** 20296 * Internal dependencies 20297 */ 20298 20299 20300 /** 20301 * Renders a button component that allows the user to switch a post to draft status. 20302 * 20303 * @return {JSX.Element} The rendered component. 20304 */ 20305 20306 20307 20308 function PostSwitchToDraftButton() { 20309 external_wp_deprecated_default()('wp.editor.PostSwitchToDraftButton', { 20310 since: '6.7', 20311 version: '6.9' 20312 }); 20313 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 20314 const { 20315 editPost, 20316 savePost 20317 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20318 const { 20319 isSaving, 20320 isPublished, 20321 isScheduled 20322 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20323 const { 20324 isSavingPost, 20325 isCurrentPostPublished, 20326 isCurrentPostScheduled 20327 } = select(store_store); 20328 return { 20329 isSaving: isSavingPost(), 20330 isPublished: isCurrentPostPublished(), 20331 isScheduled: isCurrentPostScheduled() 20332 }; 20333 }, []); 20334 const isDisabled = isSaving || !isPublished && !isScheduled; 20335 let alertMessage; 20336 let confirmButtonText; 20337 if (isPublished) { 20338 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?'); 20339 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unpublish'); 20340 } else if (isScheduled) { 20341 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?'); 20342 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)('Unschedule'); 20343 } 20344 const handleConfirm = () => { 20345 setShowConfirmDialog(false); 20346 editPost({ 20347 status: 'draft' 20348 }); 20349 savePost(); 20350 }; 20351 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20352 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 20353 __next40pxDefaultSize: true, 20354 className: "editor-post-switch-to-draft", 20355 onClick: () => { 20356 if (!isDisabled) { 20357 setShowConfirmDialog(true); 20358 } 20359 }, 20360 "aria-disabled": isDisabled, 20361 variant: "secondary", 20362 style: { 20363 flexGrow: '1', 20364 justifyContent: 'center' 20365 }, 20366 children: (0,external_wp_i18n_namespaceObject.__)('Switch to draft') 20367 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 20368 isOpen: showConfirmDialog, 20369 onConfirm: handleConfirm, 20370 onCancel: () => setShowConfirmDialog(false), 20371 confirmButtonText: confirmButtonText, 20372 children: alertMessage 20373 })] 20374 }); 20375 } 20376 20377 ;// ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js 20378 /** 20379 * WordPress dependencies 20380 */ 20381 20382 20383 20384 /** 20385 * Internal dependencies 20386 */ 20387 20388 20389 20390 /** 20391 * Renders the sync status of a post. 20392 * 20393 * @return {JSX.Element|null} The rendered sync status component. 20394 */ 20395 20396 function PostSyncStatus() { 20397 const { 20398 syncStatus, 20399 postType 20400 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20401 const { 20402 getEditedPostAttribute 20403 } = select(store_store); 20404 const meta = getEditedPostAttribute('meta'); 20405 20406 // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead. 20407 const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : getEditedPostAttribute('wp_pattern_sync_status'); 20408 return { 20409 syncStatus: currentSyncStatus, 20410 postType: getEditedPostAttribute('type') 20411 }; 20412 }); 20413 if (postType !== 'wp_block') { 20414 return null; 20415 } 20416 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 20417 label: (0,external_wp_i18n_namespaceObject.__)('Sync status'), 20418 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 20419 className: "editor-post-sync-status__value", 20420 children: syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject._x)('Not synced', 'pattern (singular)') : (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)') 20421 }) 20422 }); 20423 } 20424 20425 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js 20426 /** 20427 * WordPress dependencies 20428 */ 20429 20430 20431 20432 20433 /** 20434 * Internal dependencies 20435 */ 20436 20437 20438 20439 20440 const post_taxonomies_identity = x => x; 20441 function PostTaxonomies({ 20442 taxonomyWrapper = post_taxonomies_identity 20443 }) { 20444 const { 20445 postType, 20446 taxonomies 20447 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20448 return { 20449 postType: select(store_store).getCurrentPostType(), 20450 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 20451 per_page: -1 20452 }) 20453 }; 20454 }, []); 20455 const visibleTaxonomies = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(taxonomy => 20456 // In some circumstances .visibility can end up as undefined so optional chaining operator required. 20457 // https://github.com/WordPress/gutenberg/issues/40326 20458 taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui); 20459 return visibleTaxonomies.map(taxonomy => { 20460 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; 20461 const taxonomyComponentProps = { 20462 slug: taxonomy.slug, 20463 ...(taxonomy.hierarchical ? {} : { 20464 __nextHasNoMarginBottom: true 20465 }) 20466 }; 20467 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 20468 children: taxonomyWrapper( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, { 20469 ...taxonomyComponentProps 20470 }), taxonomy) 20471 }, `taxonomy-$taxonomy.slug}`); 20472 }); 20473 } 20474 20475 /** 20476 * Renders the taxonomies associated with a post. 20477 * 20478 * @param {Object} props The component props. 20479 * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component. 20480 * 20481 * @return {Array} An array of JSX elements representing the visible taxonomies. 20482 */ 20483 /* harmony default export */ const post_taxonomies = (PostTaxonomies); 20484 20485 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js 20486 /** 20487 * WordPress dependencies 20488 */ 20489 20490 20491 20492 /** 20493 * Internal dependencies 20494 */ 20495 20496 20497 /** 20498 * Renders the children components only if the current post type has taxonomies. 20499 * 20500 * @param {Object} props The component props. 20501 * @param {Element} props.children The children components to render. 20502 * 20503 * @return {Component|null} The rendered children components or null if the current post type has no taxonomies. 20504 */ 20505 function PostTaxonomiesCheck({ 20506 children 20507 }) { 20508 const hasTaxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => { 20509 const postType = select(store_store).getCurrentPostType(); 20510 const taxonomies = select(external_wp_coreData_namespaceObject.store).getTaxonomies({ 20511 per_page: -1 20512 }); 20513 return taxonomies?.some(taxonomy => taxonomy.types.includes(postType)); 20514 }, []); 20515 if (!hasTaxonomies) { 20516 return null; 20517 } 20518 return children; 20519 } 20520 20521 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js 20522 /** 20523 * WordPress dependencies 20524 */ 20525 20526 20527 20528 /** 20529 * Internal dependencies 20530 */ 20531 20532 20533 20534 20535 function TaxonomyPanel({ 20536 taxonomy, 20537 children 20538 }) { 20539 const slug = taxonomy?.slug; 20540 const panelName = slug ? `taxonomy-panel-$slug}` : ''; 20541 const { 20542 isEnabled, 20543 isOpened 20544 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20545 const { 20546 isEditorPanelEnabled, 20547 isEditorPanelOpened 20548 } = select(store_store); 20549 return { 20550 isEnabled: slug ? isEditorPanelEnabled(panelName) : false, 20551 isOpened: slug ? isEditorPanelOpened(panelName) : false 20552 }; 20553 }, [panelName, slug]); 20554 const { 20555 toggleEditorPanelOpened 20556 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20557 if (!isEnabled) { 20558 return null; 20559 } 20560 const taxonomyMenuName = taxonomy?.labels?.menu_name; 20561 if (!taxonomyMenuName) { 20562 return null; 20563 } 20564 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 20565 title: taxonomyMenuName, 20566 opened: isOpened, 20567 onToggle: () => toggleEditorPanelOpened(panelName), 20568 children: children 20569 }); 20570 } 20571 function panel_PostTaxonomies() { 20572 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, { 20573 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { 20574 taxonomyWrapper: (content, taxonomy) => { 20575 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, { 20576 taxonomy: taxonomy, 20577 children: content 20578 }); 20579 } 20580 }) 20581 }); 20582 } 20583 20584 /** 20585 * Renders a panel for a specific taxonomy. 20586 * 20587 * @param {Object} props The component props. 20588 * @param {Object} props.taxonomy The taxonomy object. 20589 * @param {Element} props.children The child components. 20590 * 20591 * @return {Component} The rendered taxonomy panel. 20592 */ 20593 /* harmony default export */ const post_taxonomies_panel = (panel_PostTaxonomies); 20594 20595 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 20596 var lib = __webpack_require__(4132); 20597 ;// ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js 20598 /** 20599 * External dependencies 20600 */ 20601 20602 20603 /** 20604 * WordPress dependencies 20605 */ 20606 20607 20608 20609 20610 20611 20612 20613 20614 /** 20615 * Internal dependencies 20616 */ 20617 20618 20619 /** 20620 * Displays the Post Text Editor along with content in Visual and Text mode. 20621 * 20622 * @return {JSX.Element|null} The rendered PostTextEditor component. 20623 */ 20624 20625 20626 20627 function PostTextEditor() { 20628 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); 20629 const { 20630 content, 20631 blocks, 20632 type, 20633 id 20634 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20635 const { 20636 getEditedEntityRecord 20637 } = select(external_wp_coreData_namespaceObject.store); 20638 const { 20639 getCurrentPostType, 20640 getCurrentPostId 20641 } = select(store_store); 20642 const _type = getCurrentPostType(); 20643 const _id = getCurrentPostId(); 20644 const editedRecord = getEditedEntityRecord('postType', _type, _id); 20645 return { 20646 content: editedRecord?.content, 20647 blocks: editedRecord?.blocks, 20648 type: _type, 20649 id: _id 20650 }; 20651 }, []); 20652 const { 20653 editEntityRecord 20654 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 20655 // Replicates the logic found in getEditedPostContent(). 20656 const value = (0,external_wp_element_namespaceObject.useMemo)(() => { 20657 if (content instanceof Function) { 20658 return content({ 20659 blocks 20660 }); 20661 } else if (blocks) { 20662 // If we have parsed blocks already, they should be our source of truth. 20663 // Parsing applies block deprecations and legacy block conversions that 20664 // unparsed content will not have. 20665 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks); 20666 } 20667 return content; 20668 }, [content, blocks]); 20669 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 20670 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 20671 as: "label", 20672 htmlFor: `post-content-$instanceId}`, 20673 children: (0,external_wp_i18n_namespaceObject.__)('Type text or HTML') 20674 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { 20675 autoComplete: "off", 20676 dir: "auto", 20677 value: value, 20678 onChange: event => { 20679 editEntityRecord('postType', type, id, { 20680 content: event.target.value, 20681 blocks: undefined, 20682 selection: undefined 20683 }); 20684 }, 20685 className: "editor-post-text-editor", 20686 id: `post-content-$instanceId}`, 20687 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') 20688 })] 20689 }); 20690 } 20691 20692 ;// external ["wp","dom"] 20693 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 20694 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/constants.js 20695 const DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text'; 20696 const REGEXP_NEWLINES = /[\r\n]+/g; 20697 20698 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title-focus.js 20699 /** 20700 * WordPress dependencies 20701 */ 20702 20703 20704 20705 /** 20706 * Internal dependencies 20707 */ 20708 20709 20710 /** 20711 * Custom hook that manages the focus behavior of the post title input field. 20712 * 20713 * @param {Element} forwardedRef - The forwarded ref for the input field. 20714 * 20715 * @return {Object} - The ref object. 20716 */ 20717 function usePostTitleFocus(forwardedRef) { 20718 const ref = (0,external_wp_element_namespaceObject.useRef)(); 20719 const { 20720 isCleanNewPost 20721 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20722 const { 20723 isCleanNewPost: _isCleanNewPost 20724 } = select(store_store); 20725 return { 20726 isCleanNewPost: _isCleanNewPost() 20727 }; 20728 }, []); 20729 (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({ 20730 focus: () => { 20731 ref?.current?.focus(); 20732 } 20733 })); 20734 (0,external_wp_element_namespaceObject.useEffect)(() => { 20735 if (!ref.current) { 20736 return; 20737 } 20738 const { 20739 defaultView 20740 } = ref.current.ownerDocument; 20741 const { 20742 name, 20743 parent 20744 } = defaultView; 20745 const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document; 20746 const { 20747 activeElement, 20748 body 20749 } = ownerDocument; 20750 20751 // Only autofocus the title when the post is entirely empty. This should 20752 // only happen for a new post, which means we focus the title on new 20753 // post so the author can start typing right away, without needing to 20754 // click anything. 20755 if (isCleanNewPost && (!activeElement || body === activeElement)) { 20756 ref.current.focus(); 20757 } 20758 }, [isCleanNewPost]); 20759 return { 20760 ref 20761 }; 20762 } 20763 20764 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title.js 20765 /** 20766 * WordPress dependencies 20767 */ 20768 20769 /** 20770 * Internal dependencies 20771 */ 20772 20773 20774 /** 20775 * Custom hook for managing the post title in the editor. 20776 * 20777 * @return {Object} An object containing the current title and a function to update the title. 20778 */ 20779 function usePostTitle() { 20780 const { 20781 editPost 20782 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20783 const { 20784 title 20785 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20786 const { 20787 getEditedPostAttribute 20788 } = select(store_store); 20789 return { 20790 title: getEditedPostAttribute('title') 20791 }; 20792 }, []); 20793 function updateTitle(newTitle) { 20794 editPost({ 20795 title: newTitle 20796 }); 20797 } 20798 return { 20799 title, 20800 setTitle: updateTitle 20801 }; 20802 } 20803 20804 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/index.js 20805 /** 20806 * External dependencies 20807 */ 20808 20809 /** 20810 * WordPress dependencies 20811 */ 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 /** 20824 * Internal dependencies 20825 */ 20826 20827 20828 20829 20830 20831 function PostTitle(_, forwardedRef) { 20832 const { 20833 placeholder 20834 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 20835 const { 20836 getSettings 20837 } = select(external_wp_blockEditor_namespaceObject.store); 20838 const { 20839 titlePlaceholder 20840 } = getSettings(); 20841 return { 20842 placeholder: titlePlaceholder 20843 }; 20844 }, []); 20845 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 20846 const { 20847 ref: focusRef 20848 } = usePostTitleFocus(forwardedRef); 20849 const { 20850 title, 20851 setTitle: onUpdate 20852 } = usePostTitle(); 20853 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); 20854 const { 20855 clearSelectedBlock, 20856 insertBlocks, 20857 insertDefaultBlock 20858 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 20859 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); 20860 const { 20861 value, 20862 onChange, 20863 ref: richTextRef 20864 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ 20865 value: title, 20866 onChange(newValue) { 20867 onUpdate(newValue.replace(REGEXP_NEWLINES, ' ')); 20868 }, 20869 placeholder: decodedPlaceholder, 20870 selectionStart: selection.start, 20871 selectionEnd: selection.end, 20872 onSelectionChange(newStart, newEnd) { 20873 setSelection(sel => { 20874 const { 20875 start, 20876 end 20877 } = sel; 20878 if (start === newStart && end === newEnd) { 20879 return sel; 20880 } 20881 return { 20882 start: newStart, 20883 end: newEnd 20884 }; 20885 }); 20886 }, 20887 __unstableDisableFormats: false 20888 }); 20889 function onInsertBlockAfter(blocks) { 20890 insertBlocks(blocks, 0); 20891 } 20892 function onSelect() { 20893 setIsSelected(true); 20894 clearSelectedBlock(); 20895 } 20896 function onUnselect() { 20897 setIsSelected(false); 20898 setSelection({}); 20899 } 20900 function onEnterPress() { 20901 insertDefaultBlock(undefined, undefined, 0); 20902 } 20903 function onKeyDown(event) { 20904 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 20905 event.preventDefault(); 20906 onEnterPress(); 20907 } 20908 } 20909 function onPaste(event) { 20910 const clipboardData = event.clipboardData; 20911 let plainText = ''; 20912 let html = ''; 20913 try { 20914 plainText = clipboardData.getData('text/plain'); 20915 html = clipboardData.getData('text/html'); 20916 } catch (error) { 20917 // Some browsers like UC Browser paste plain text by default and 20918 // don't support clipboardData at all, so allow default 20919 // behaviour. 20920 return; 20921 } 20922 20923 // Allows us to ask for this information when we get a report. 20924 window.console.log('Received HTML:\n\n', html); 20925 window.console.log('Received plain text:\n\n', plainText); 20926 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 20927 HTML: html, 20928 plainText 20929 }); 20930 event.preventDefault(); 20931 if (!content.length) { 20932 return; 20933 } 20934 if (typeof content !== 'string') { 20935 const [firstBlock] = content; 20936 if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { 20937 // Strip HTML to avoid unwanted HTML being added to the title. 20938 // In the majority of cases it is assumed that HTML in the title 20939 // is undesirable. 20940 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(firstBlock.attributes.content); 20941 onUpdate(contentNoHTML); 20942 onInsertBlockAfter(content.slice(1)); 20943 } else { 20944 onInsertBlockAfter(content); 20945 } 20946 } else { 20947 // Strip HTML to avoid unwanted HTML being added to the title. 20948 // In the majority of cases it is assumed that HTML in the title 20949 // is undesirable. 20950 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content); 20951 onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ 20952 html: contentNoHTML 20953 }))); 20954 } 20955 } 20956 20957 // The wp-block className is important for editor styles. 20958 // This same block is used in both the visual and the code editor. 20959 const className = dist_clsx(DEFAULT_CLASSNAMES, { 20960 'is-selected': isSelected 20961 }); 20962 return ( 20963 /*#__PURE__*/ 20964 /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ 20965 (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 20966 supportKeys: "title", 20967 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 20968 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]), 20969 contentEditable: true, 20970 className: className, 20971 "aria-label": decodedPlaceholder, 20972 role: "textbox", 20973 "aria-multiline": "true", 20974 onFocus: onSelect, 20975 onBlur: onUnselect, 20976 onKeyDown: onKeyDown, 20977 onPaste: onPaste 20978 }) 20979 }) 20980 /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ 20981 ); 20982 } 20983 20984 /** 20985 * Renders the `PostTitle` component. 20986 * 20987 * @param {Object} _ Unused parameter. 20988 * @param {Element} forwardedRef Forwarded ref for the component. 20989 * 20990 * @return {Component} The rendered PostTitle component. 20991 */ 20992 /* harmony default export */ const post_title = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitle)); 20993 20994 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js 20995 /** 20996 * External dependencies 20997 */ 20998 20999 21000 /** 21001 * WordPress dependencies 21002 */ 21003 21004 21005 21006 21007 21008 21009 21010 /** 21011 * Internal dependencies 21012 */ 21013 21014 21015 21016 21017 /** 21018 * Renders a raw post title input field. 21019 * 21020 * @param {Object} _ Unused parameter. 21021 * @param {Element} forwardedRef Reference to the component's DOM node. 21022 * 21023 * @return {Component} The rendered component. 21024 */ 21025 21026 function PostTitleRaw(_, forwardedRef) { 21027 const { 21028 placeholder 21029 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21030 const { 21031 getSettings 21032 } = select(external_wp_blockEditor_namespaceObject.store); 21033 const { 21034 titlePlaceholder 21035 } = getSettings(); 21036 return { 21037 placeholder: titlePlaceholder 21038 }; 21039 }, []); 21040 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 21041 const { 21042 title, 21043 setTitle: onUpdate 21044 } = usePostTitle(); 21045 const { 21046 ref: focusRef 21047 } = usePostTitleFocus(forwardedRef); 21048 function onChange(value) { 21049 onUpdate(value.replace(REGEXP_NEWLINES, ' ')); 21050 } 21051 function onSelect() { 21052 setIsSelected(true); 21053 } 21054 function onUnselect() { 21055 setIsSelected(false); 21056 } 21057 21058 // The wp-block className is important for editor styles. 21059 // This same block is used in both the visual and the code editor. 21060 const className = dist_clsx(DEFAULT_CLASSNAMES, { 21061 'is-selected': isSelected, 21062 'is-raw-text': true 21063 }); 21064 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); 21065 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 21066 ref: focusRef, 21067 value: title, 21068 onChange: onChange, 21069 onFocus: onSelect, 21070 onBlur: onUnselect, 21071 label: placeholder, 21072 className: className, 21073 placeholder: decodedPlaceholder, 21074 hideLabelFromVision: true, 21075 autoComplete: "off", 21076 dir: "auto", 21077 rows: 1, 21078 __nextHasNoMarginBottom: true 21079 }); 21080 } 21081 /* harmony default export */ const post_title_raw = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw)); 21082 21083 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js 21084 /** 21085 * WordPress dependencies 21086 */ 21087 21088 21089 21090 /** 21091 * Internal dependencies 21092 */ 21093 21094 21095 21096 /** 21097 * Wrapper component that renders its children only if the post can trashed. 21098 * 21099 * @param {Object} props - The component props. 21100 * @param {Element} props.children - The child components to render. 21101 * 21102 * @return {Component|null} The rendered child components or null if the post can not trashed. 21103 */ 21104 function PostTrashCheck({ 21105 children 21106 }) { 21107 const { 21108 canTrashPost 21109 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21110 const { 21111 isEditedPostNew, 21112 getCurrentPostId, 21113 getCurrentPostType 21114 } = select(store_store); 21115 const { 21116 canUser 21117 } = select(external_wp_coreData_namespaceObject.store); 21118 const postType = getCurrentPostType(); 21119 const postId = getCurrentPostId(); 21120 const isNew = isEditedPostNew(); 21121 const canUserDelete = !!postId ? canUser('delete', { 21122 kind: 'postType', 21123 name: postType, 21124 id: postId 21125 }) : false; 21126 return { 21127 canTrashPost: (!isNew || postId) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType) 21128 }; 21129 }, []); 21130 if (!canTrashPost) { 21131 return null; 21132 } 21133 return children; 21134 } 21135 21136 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js 21137 /** 21138 * WordPress dependencies 21139 */ 21140 21141 21142 21143 21144 21145 /** 21146 * Internal dependencies 21147 */ 21148 21149 21150 21151 /** 21152 * Displays the Post Trash Button and Confirm Dialog in the Editor. 21153 * 21154 * @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function. 21155 * @return {JSX.Element|null} The rendered PostTrash component. 21156 */ 21157 21158 21159 function PostTrash({ 21160 onActionPerformed 21161 }) { 21162 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 21163 const { 21164 isNew, 21165 isDeleting, 21166 postId, 21167 title 21168 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21169 const store = select(store_store); 21170 return { 21171 isNew: store.isEditedPostNew(), 21172 isDeleting: store.isDeletingPost(), 21173 postId: store.getCurrentPostId(), 21174 title: store.getCurrentPostAttribute('title') 21175 }; 21176 }, []); 21177 const { 21178 trashPost 21179 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21180 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 21181 if (isNew || !postId) { 21182 return null; 21183 } 21184 const handleConfirm = async () => { 21185 setShowConfirmDialog(false); 21186 await trashPost(); 21187 const item = await registry.resolveSelect(store_store).getCurrentPost(); 21188 // After the post is trashed, we want to trigger the onActionPerformed callback, so the user is redirect 21189 // to the post view depending on if the user is on post editor or site editor. 21190 onActionPerformed?.('move-to-trash', [item]); 21191 }; 21192 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PostTrashCheck, { 21193 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21194 __next40pxDefaultSize: true, 21195 className: "editor-post-trash", 21196 isDestructive: true, 21197 variant: "secondary", 21198 isBusy: isDeleting, 21199 "aria-disabled": isDeleting, 21200 onClick: isDeleting ? undefined : () => setShowConfirmDialog(true), 21201 children: (0,external_wp_i18n_namespaceObject.__)('Move to trash') 21202 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 21203 isOpen: showConfirmDialog, 21204 onConfirm: handleConfirm, 21205 onCancel: () => setShowConfirmDialog(false), 21206 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Move to trash'), 21207 size: "small", 21208 children: (0,external_wp_i18n_namespaceObject.sprintf)( 21209 // translators: %s: The item's title. 21210 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), title) 21211 })] 21212 }); 21213 } 21214 21215 ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js 21216 /** 21217 * WordPress dependencies 21218 */ 21219 21220 21221 const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 21222 xmlns: "http://www.w3.org/2000/svg", 21223 viewBox: "0 0 24 24", 21224 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 21225 fillRule: "evenodd", 21226 clipRule: "evenodd", 21227 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" 21228 }) 21229 }); 21230 /* harmony default export */ const copy_small = (copySmall); 21231 21232 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/index.js 21233 /** 21234 * WordPress dependencies 21235 */ 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 /** 21248 * Internal dependencies 21249 */ 21250 21251 21252 /** 21253 * Renders the `PostURL` component. 21254 * 21255 * @example 21256 * ```jsx 21257 * <PostURL /> 21258 * ``` 21259 * 21260 * @param {Function} onClose Callback function to be executed when the popover is closed. 21261 * 21262 * @return {Component} The rendered PostURL component. 21263 */ 21264 21265 21266 function PostURL({ 21267 onClose 21268 }) { 21269 const { 21270 isEditable, 21271 postSlug, 21272 postLink, 21273 permalinkPrefix, 21274 permalinkSuffix, 21275 permalink 21276 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21277 var _post$_links$wpActio; 21278 const post = select(store_store).getCurrentPost(); 21279 const postTypeSlug = select(store_store).getCurrentPostType(); 21280 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 21281 const permalinkParts = select(store_store).getPermalinkParts(); 21282 const hasPublishAction = (_post$_links$wpActio = post?._links?.['wp:action-publish']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false; 21283 return { 21284 isEditable: select(store_store).isPermalinkEditable() && hasPublishAction, 21285 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()), 21286 viewPostLabel: postType?.labels.view_item, 21287 postLink: post.link, 21288 permalinkPrefix: permalinkParts?.prefix, 21289 permalinkSuffix: permalinkParts?.suffix, 21290 permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getPermalink()) 21291 }; 21292 }, []); 21293 const { 21294 editPost 21295 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21296 const { 21297 createNotice 21298 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 21299 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); 21300 const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { 21301 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied URL to clipboard.'), { 21302 isDismissible: true, 21303 type: 'snackbar' 21304 }); 21305 }); 21306 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21307 className: "editor-post-url", 21308 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 21309 title: (0,external_wp_i18n_namespaceObject.__)('Link'), 21310 onClose: onClose 21311 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 21312 spacing: 3, 21313 children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21314 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Customize the last part of the URL. <a>Learn more.</a>'), { 21315 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 21316 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink') 21317 }) 21318 }) 21319 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 21320 children: [isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 21321 __next40pxDefaultSize: true, 21322 prefix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { 21323 children: "/" 21324 }), 21325 suffix: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { 21326 variant: "control", 21327 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21328 icon: copy_small, 21329 ref: copyButtonRef, 21330 size: "small", 21331 label: "Copy" 21332 }) 21333 }), 21334 label: (0,external_wp_i18n_namespaceObject.__)('Link'), 21335 hideLabelFromVision: true, 21336 value: forceEmptyField ? '' : postSlug, 21337 autoComplete: "off", 21338 spellCheck: "false", 21339 type: "text", 21340 className: "editor-post-url__input", 21341 onChange: newValue => { 21342 editPost({ 21343 slug: newValue 21344 }); 21345 // When we delete the field the permalink gets 21346 // reverted to the original value. 21347 // The forceEmptyField logic allows the user to have 21348 // the field temporarily empty while typing. 21349 if (!newValue) { 21350 if (!forceEmptyField) { 21351 setForceEmptyField(true); 21352 } 21353 return; 21354 } 21355 if (forceEmptyField) { 21356 setForceEmptyField(false); 21357 } 21358 }, 21359 onBlur: event => { 21360 editPost({ 21361 slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value) 21362 }); 21363 if (forceEmptyField) { 21364 setForceEmptyField(false); 21365 } 21366 }, 21367 help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { 21368 className: "editor-post-url__link", 21369 href: postLink, 21370 target: "_blank", 21371 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21372 className: "editor-post-url__link-prefix", 21373 children: permalinkPrefix 21374 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21375 className: "editor-post-url__link-slug", 21376 children: postSlug 21377 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21378 className: "editor-post-url__link-suffix", 21379 children: permalinkSuffix 21380 })] 21381 }) 21382 }), !isEditable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 21383 className: "editor-post-url__link", 21384 href: postLink, 21385 target: "_blank", 21386 children: postLink 21387 })] 21388 })] 21389 })] 21390 }); 21391 } 21392 21393 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/check.js 21394 /** 21395 * WordPress dependencies 21396 */ 21397 21398 21399 21400 /** 21401 * Internal dependencies 21402 */ 21403 21404 21405 /** 21406 * Check if the post URL is valid and visible. 21407 * 21408 * @param {Object} props The component props. 21409 * @param {Element} props.children The child components. 21410 * 21411 * @return {Component|null} The child components if the post URL is valid and visible, otherwise null. 21412 */ 21413 function PostURLCheck({ 21414 children 21415 }) { 21416 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { 21417 const postTypeSlug = select(store_store).getCurrentPostType(); 21418 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 21419 if (!postType?.viewable) { 21420 return false; 21421 } 21422 const post = select(store_store).getCurrentPost(); 21423 if (!post.link) { 21424 return false; 21425 } 21426 const permalinkParts = select(store_store).getPermalinkParts(); 21427 if (!permalinkParts) { 21428 return false; 21429 } 21430 return true; 21431 }, []); 21432 if (!isVisible) { 21433 return null; 21434 } 21435 return children; 21436 } 21437 21438 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/label.js 21439 /** 21440 * WordPress dependencies 21441 */ 21442 21443 21444 21445 /** 21446 * Internal dependencies 21447 */ 21448 21449 21450 /** 21451 * Represents a label component for a post URL. 21452 * 21453 * @return {Component} The PostURLLabel component. 21454 */ 21455 function PostURLLabel() { 21456 return usePostURLLabel(); 21457 } 21458 21459 /** 21460 * Custom hook to get the label for the post URL. 21461 * 21462 * @return {string} The filtered and decoded post URL label. 21463 */ 21464 function usePostURLLabel() { 21465 const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []); 21466 return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink)); 21467 } 21468 21469 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js 21470 /** 21471 * WordPress dependencies 21472 */ 21473 21474 21475 21476 21477 21478 21479 21480 /** 21481 * Internal dependencies 21482 */ 21483 21484 21485 21486 21487 21488 /** 21489 * Renders the `PostURLPanel` component. 21490 * 21491 * @return {JSX.Element} The rendered PostURLPanel component. 21492 */ 21493 21494 function PostURLPanel() { 21495 // Use internal state instead of a ref to make sure that the component 21496 // re-renders when the popover's anchor updates. 21497 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 21498 // Memoize popoverProps to avoid returning a new object every time. 21499 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 21500 // Anchor the popover to the middle of the entire row so that it doesn't 21501 // move around when the label changes. 21502 anchor: popoverAnchor, 21503 placement: 'left-start', 21504 offset: 36, 21505 shift: true 21506 }), [popoverAnchor]); 21507 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, { 21508 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 21509 label: (0,external_wp_i18n_namespaceObject.__)('Link'), 21510 ref: setPopoverAnchor, 21511 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 21512 popoverProps: popoverProps, 21513 className: "editor-post-url__panel-dropdown", 21514 contentClassName: "editor-post-url__panel-dialog", 21515 focusOnMount: true, 21516 renderToggle: ({ 21517 isOpen, 21518 onToggle 21519 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLToggle, { 21520 isOpen: isOpen, 21521 onClick: onToggle 21522 }), 21523 renderContent: ({ 21524 onClose 21525 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, { 21526 onClose: onClose 21527 }) 21528 }) 21529 }) 21530 }); 21531 } 21532 function PostURLToggle({ 21533 isOpen, 21534 onClick 21535 }) { 21536 const { 21537 slug, 21538 isFrontPage, 21539 postLink 21540 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21541 const { 21542 getCurrentPostId, 21543 getCurrentPost 21544 } = select(store_store); 21545 const { 21546 getEditedEntityRecord, 21547 canUser 21548 } = select(external_wp_coreData_namespaceObject.store); 21549 const siteSettings = canUser('read', { 21550 kind: 'root', 21551 name: 'site' 21552 }) ? getEditedEntityRecord('root', 'site') : undefined; 21553 const _id = getCurrentPostId(); 21554 return { 21555 slug: select(store_store).getEditedPostSlug(), 21556 isFrontPage: siteSettings?.page_on_front === _id, 21557 postLink: getCurrentPost()?.link 21558 }; 21559 }, []); 21560 const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug); 21561 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21562 size: "compact", 21563 className: "editor-post-url__panel-toggle", 21564 variant: "tertiary", 21565 "aria-expanded": isOpen, 21566 "aria-label": 21567 // translators: %s: Current post link. 21568 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change link: %s'), decodedSlug), 21569 onClick: onClick, 21570 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { 21571 numberOfLines: 1, 21572 children: isFrontPage ? postLink : `/$decodedSlug}` 21573 }) 21574 }); 21575 } 21576 21577 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js 21578 /** 21579 * WordPress dependencies 21580 */ 21581 21582 21583 /** 21584 * Internal dependencies 21585 */ 21586 21587 21588 /** 21589 * Determines if the current post can be edited (published) 21590 * and passes this information to the provided render function. 21591 * 21592 * @param {Object} props The component props. 21593 * @param {Function} props.render Function to render the component. 21594 * Receives an object with a `canEdit` property. 21595 * @return {JSX.Element} The rendered component. 21596 */ 21597 function PostVisibilityCheck({ 21598 render 21599 }) { 21600 const canEdit = (0,external_wp_data_namespaceObject.useSelect)(select => { 21601 var _select$getCurrentPos; 21602 return (_select$getCurrentPos = select(store_store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false; 21603 }); 21604 return render({ 21605 canEdit 21606 }); 21607 } 21608 21609 ;// ./node_modules/@wordpress/icons/build-module/library/info.js 21610 /** 21611 * WordPress dependencies 21612 */ 21613 21614 21615 const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 21616 xmlns: "http://www.w3.org/2000/svg", 21617 viewBox: "0 0 24 24", 21618 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 21619 d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" 21620 }) 21621 }); 21622 /* harmony default export */ const library_info = (info); 21623 21624 ;// external ["wp","wordcount"] 21625 const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; 21626 ;// ./node_modules/@wordpress/editor/build-module/components/word-count/index.js 21627 /** 21628 * WordPress dependencies 21629 */ 21630 21631 21632 21633 21634 /** 21635 * Internal dependencies 21636 */ 21637 21638 21639 /** 21640 * Renders the word count of the post content. 21641 * 21642 * @return {JSX.Element|null} The rendered WordCount component. 21643 */ 21644 21645 function WordCount() { 21646 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 21647 21648 /* 21649 * translators: If your word count is based on single characters (e.g. East Asian characters), 21650 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 21651 * Do not translate into your own language. 21652 */ 21653 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 21654 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21655 className: "word-count", 21656 children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) 21657 }); 21658 } 21659 21660 ;// ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js 21661 /** 21662 * WordPress dependencies 21663 */ 21664 21665 21666 21667 21668 21669 /** 21670 * Internal dependencies 21671 */ 21672 21673 21674 /** 21675 * Average reading rate - based on average taken from 21676 * https://irisreading.com/average-reading-speed-in-various-languages/ 21677 * (Characters/minute used for Chinese rather than words). 21678 * 21679 * @type {number} A rough estimate of the average reading rate across multiple languages. 21680 */ 21681 21682 const AVERAGE_READING_RATE = 189; 21683 21684 /** 21685 * Component for showing Time To Read in Content. 21686 * 21687 * @return {JSX.Element} The rendered TimeToRead component. 21688 */ 21689 function TimeToRead() { 21690 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 21691 21692 /* 21693 * translators: If your word count is based on single characters (e.g. East Asian characters), 21694 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 21695 * Do not translate into your own language. 21696 */ 21697 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 21698 const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE); 21699 const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), { 21700 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 21701 }) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the number of minutes to read the post. */ 21702 (0,external_wp_i18n_namespaceObject._n)('<span>%s</span> minute', '<span>%s</span> minutes', minutesToRead), minutesToRead), { 21703 span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 21704 }); 21705 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21706 className: "time-to-read", 21707 children: minutesToReadString 21708 }); 21709 } 21710 21711 ;// ./node_modules/@wordpress/editor/build-module/components/character-count/index.js 21712 /** 21713 * WordPress dependencies 21714 */ 21715 21716 21717 21718 /** 21719 * Internal dependencies 21720 */ 21721 21722 21723 /** 21724 * Renders the character count of the post content. 21725 * 21726 * @return {number} The character count. 21727 */ 21728 function CharacterCount() { 21729 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); 21730 return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces'); 21731 } 21732 21733 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js 21734 /** 21735 * WordPress dependencies 21736 */ 21737 21738 21739 21740 21741 /** 21742 * Internal dependencies 21743 */ 21744 21745 21746 21747 21748 21749 21750 21751 function TableOfContentsPanel({ 21752 hasOutlineItemsDisabled, 21753 onRequestClose 21754 }) { 21755 const { 21756 headingCount, 21757 paragraphCount, 21758 numberOfBlocks 21759 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 21760 const { 21761 getGlobalBlockCount 21762 } = select(external_wp_blockEditor_namespaceObject.store); 21763 return { 21764 headingCount: getGlobalBlockCount('core/heading'), 21765 paragraphCount: getGlobalBlockCount('core/paragraph'), 21766 numberOfBlocks: getGlobalBlockCount() 21767 }; 21768 }, []); 21769 return ( 21770 /*#__PURE__*/ 21771 /* 21772 * Disable reason: The `list` ARIA role is redundant but 21773 * Safari+VoiceOver won't announce the list otherwise. 21774 */ 21775 /* eslint-disable jsx-a11y/no-redundant-roles */ 21776 (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21777 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 21778 className: "table-of-contents__wrapper", 21779 role: "note", 21780 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'), 21781 tabIndex: "0", 21782 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { 21783 role: "list", 21784 className: "table-of-contents__counts", 21785 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21786 className: "table-of-contents__count", 21787 children: [(0,external_wp_i18n_namespaceObject.__)('Words'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] 21788 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21789 className: "table-of-contents__count", 21790 children: [(0,external_wp_i18n_namespaceObject.__)('Characters'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21791 className: "table-of-contents__number", 21792 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) 21793 })] 21794 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21795 className: "table-of-contents__count", 21796 children: [(0,external_wp_i18n_namespaceObject.__)('Time to read'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] 21797 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21798 className: "table-of-contents__count", 21799 children: [(0,external_wp_i18n_namespaceObject.__)('Headings'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21800 className: "table-of-contents__number", 21801 children: headingCount 21802 })] 21803 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21804 className: "table-of-contents__count", 21805 children: [(0,external_wp_i18n_namespaceObject.__)('Paragraphs'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21806 className: "table-of-contents__number", 21807 children: paragraphCount 21808 })] 21809 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 21810 className: "table-of-contents__count", 21811 children: [(0,external_wp_i18n_namespaceObject.__)('Blocks'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 21812 className: "table-of-contents__number", 21813 children: numberOfBlocks 21814 })] 21815 })] 21816 }) 21817 }), headingCount > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 21818 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 21819 className: "table-of-contents__title", 21820 children: (0,external_wp_i18n_namespaceObject.__)('Document Outline') 21821 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, { 21822 onSelect: onRequestClose, 21823 hasOutlineItemsDisabled: hasOutlineItemsDisabled 21824 })] 21825 })] 21826 }) 21827 /* eslint-enable jsx-a11y/no-redundant-roles */ 21828 ); 21829 } 21830 /* harmony default export */ const table_of_contents_panel = (TableOfContentsPanel); 21831 21832 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js 21833 /** 21834 * WordPress dependencies 21835 */ 21836 21837 21838 21839 21840 21841 21842 21843 /** 21844 * Internal dependencies 21845 */ 21846 21847 21848 function TableOfContents({ 21849 hasOutlineItemsDisabled, 21850 repositionDropdown, 21851 ...props 21852 }, ref) { 21853 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []); 21854 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 21855 popoverProps: { 21856 placement: repositionDropdown ? 'right' : 'bottom' 21857 }, 21858 className: "table-of-contents", 21859 contentClassName: "table-of-contents__popover", 21860 renderToggle: ({ 21861 isOpen, 21862 onToggle 21863 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 21864 __next40pxDefaultSize: true, 21865 ...props, 21866 ref: ref, 21867 onClick: hasBlocks ? onToggle : undefined, 21868 icon: library_info, 21869 "aria-expanded": isOpen, 21870 "aria-haspopup": "true" 21871 /* translators: button label text should, if possible, be under 16 characters. */, 21872 label: (0,external_wp_i18n_namespaceObject.__)('Details'), 21873 tooltipPosition: "bottom", 21874 "aria-disabled": !hasBlocks 21875 }), 21876 renderContent: ({ 21877 onClose 21878 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(table_of_contents_panel, { 21879 onRequestClose: onClose, 21880 hasOutlineItemsDisabled: hasOutlineItemsDisabled 21881 }) 21882 }); 21883 } 21884 21885 /** 21886 * Renders a table of contents component. 21887 * 21888 * @param {Object} props The component props. 21889 * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled. 21890 * @param {boolean} props.repositionDropdown Whether to reposition the dropdown. 21891 * @param {Element.ref} ref The component's ref. 21892 * 21893 * @return {JSX.Element} The rendered table of contents component. 21894 */ 21895 /* harmony default export */ const table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents)); 21896 21897 ;// ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js 21898 /** 21899 * WordPress dependencies 21900 */ 21901 21902 21903 21904 21905 21906 /** 21907 * Warns the user if there are unsaved changes before leaving the editor. 21908 * Compatible with Post Editor and Site Editor. 21909 * 21910 * @return {Component} The component. 21911 */ 21912 function UnsavedChangesWarning() { 21913 const { 21914 __experimentalGetDirtyEntityRecords 21915 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 21916 (0,external_wp_element_namespaceObject.useEffect)(() => { 21917 /** 21918 * Warns the user if there are unsaved changes before leaving the editor. 21919 * 21920 * @param {Event} event `beforeunload` event. 21921 * 21922 * @return {string | undefined} Warning prompt message, if unsaved changes exist. 21923 */ 21924 const warnIfUnsavedChanges = event => { 21925 // We need to call the selector directly in the listener to avoid race 21926 // conditions with `BrowserURL` where `componentDidUpdate` gets the 21927 // new value of `isEditedPostDirty` before this component does, 21928 // causing this component to incorrectly think a trashed post is still dirty. 21929 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 21930 if (dirtyEntityRecords.length > 0) { 21931 event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); 21932 return event.returnValue; 21933 } 21934 }; 21935 window.addEventListener('beforeunload', warnIfUnsavedChanges); 21936 return () => { 21937 window.removeEventListener('beforeunload', warnIfUnsavedChanges); 21938 }; 21939 }, [__experimentalGetDirtyEntityRecords]); 21940 return null; 21941 } 21942 21943 ;// ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js 21944 /** 21945 * WordPress dependencies 21946 */ 21947 21948 21949 21950 21951 21952 /** 21953 * Internal dependencies 21954 */ 21955 21956 21957 function getSubRegistry(subRegistries, registry, useSubRegistry) { 21958 if (!useSubRegistry) { 21959 return registry; 21960 } 21961 let subRegistry = subRegistries.get(registry); 21962 if (!subRegistry) { 21963 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({ 21964 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig 21965 }, registry); 21966 // Todo: The interface store should also be created per instance. 21967 subRegistry.registerStore('core/editor', storeConfig); 21968 subRegistries.set(registry, subRegistry); 21969 } 21970 return subRegistry; 21971 } 21972 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ 21973 useSubRegistry = true, 21974 ...props 21975 }) => { 21976 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 21977 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); 21978 const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry); 21979 if (subRegistry === registry) { 21980 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { 21981 registry: registry, 21982 ...props 21983 }); 21984 } 21985 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { 21986 value: subRegistry, 21987 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { 21988 registry: subRegistry, 21989 ...props 21990 }) 21991 }); 21992 }, 'withRegistryProvider'); 21993 /* harmony default export */ const with_registry_provider = (withRegistryProvider); 21994 21995 ;// ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js 21996 /* wp:polyfill */ 21997 /** 21998 * The `editor` settings here need to be in sync with the corresponding ones in `editor` package. 21999 * See `packages/editor/src/components/media-categories/index.js`. 22000 * 22001 * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`. 22002 * The rest of the settings would still need to be in sync though. 22003 */ 22004 22005 /** 22006 * WordPress dependencies 22007 */ 22008 22009 22010 22011 22012 /** 22013 * Internal dependencies 22014 */ 22015 22016 22017 /** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */ 22018 /** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */ 22019 /** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */ 22020 22021 const getExternalLink = (url, text) => `<a $getExternalLinkAttributes(url)}>$text}</a>`; 22022 const getExternalLinkAttributes = url => `href="$url}" target="_blank" rel="noreferrer noopener"`; 22023 const getOpenverseLicense = (license, licenseVersion) => { 22024 let licenseName = license.trim(); 22025 // PDM has no abbreviation 22026 if (license !== 'pdm') { 22027 licenseName = license.toUpperCase().replace('SAMPLING', 'Sampling'); 22028 } 22029 // If version is known, append version to the name. 22030 // The license has to have a version to be valid. Only 22031 // PDM (public domain mark) doesn't have a version. 22032 if (licenseVersion) { 22033 licenseName += ` $licenseVersion}`; 22034 } 22035 // For licenses other than public-domain marks, prepend 'CC' to the name. 22036 if (!['pdm', 'cc0'].includes(license)) { 22037 licenseName = `CC $licenseName}`; 22038 } 22039 return licenseName; 22040 }; 22041 const getOpenverseCaption = item => { 22042 const { 22043 title, 22044 foreign_landing_url: foreignLandingUrl, 22045 creator, 22046 creator_url: creatorUrl, 22047 license, 22048 license_version: licenseVersion, 22049 license_url: licenseUrl 22050 } = item; 22051 const fullLicense = getOpenverseLicense(license, licenseVersion); 22052 const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator); 22053 let _caption; 22054 if (_creator) { 22055 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 22056 // 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". 22057 (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)( 22058 // 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". 22059 (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); 22060 } else { 22061 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 22062 // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". 22063 (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)( 22064 // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". 22065 (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a>/ %2$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink(`$licenseUrl}?ref=openverse`, fullLicense) : fullLicense); 22066 } 22067 return _caption.replace(/\s{2}/g, ' '); 22068 }; 22069 const coreMediaFetch = async (query = {}) => { 22070 const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getMediaItems({ 22071 ...query, 22072 orderBy: !!query?.search ? 'relevance' : 'date' 22073 }); 22074 return mediaItems.map(mediaItem => ({ 22075 ...mediaItem, 22076 alt: mediaItem.alt_text, 22077 url: mediaItem.source_url, 22078 previewUrl: mediaItem.media_details?.sizes?.medium?.source_url, 22079 caption: mediaItem.caption?.raw 22080 })); 22081 }; 22082 22083 /** @type {InserterMediaCategory[]} */ 22084 const inserterMediaCategories = [{ 22085 name: 'images', 22086 labels: { 22087 name: (0,external_wp_i18n_namespaceObject.__)('Images'), 22088 search_items: (0,external_wp_i18n_namespaceObject.__)('Search images') 22089 }, 22090 mediaType: 'image', 22091 async fetch(query = {}) { 22092 return coreMediaFetch({ 22093 ...query, 22094 media_type: 'image' 22095 }); 22096 } 22097 }, { 22098 name: 'videos', 22099 labels: { 22100 name: (0,external_wp_i18n_namespaceObject.__)('Videos'), 22101 search_items: (0,external_wp_i18n_namespaceObject.__)('Search videos') 22102 }, 22103 mediaType: 'video', 22104 async fetch(query = {}) { 22105 return coreMediaFetch({ 22106 ...query, 22107 media_type: 'video' 22108 }); 22109 } 22110 }, { 22111 name: 'audio', 22112 labels: { 22113 name: (0,external_wp_i18n_namespaceObject.__)('Audio'), 22114 search_items: (0,external_wp_i18n_namespaceObject.__)('Search audio') 22115 }, 22116 mediaType: 'audio', 22117 async fetch(query = {}) { 22118 return coreMediaFetch({ 22119 ...query, 22120 media_type: 'audio' 22121 }); 22122 } 22123 }, { 22124 name: 'openverse', 22125 labels: { 22126 name: (0,external_wp_i18n_namespaceObject.__)('Openverse'), 22127 search_items: (0,external_wp_i18n_namespaceObject.__)('Search Openverse') 22128 }, 22129 mediaType: 'image', 22130 async fetch(query = {}) { 22131 const defaultArgs = { 22132 mature: false, 22133 excluded_source: 'flickr,inaturalist,wikimedia', 22134 license: 'pdm,cc0' 22135 }; 22136 const finalQuery = { 22137 ...query, 22138 ...defaultArgs 22139 }; 22140 const mapFromInserterMediaRequest = { 22141 per_page: 'page_size', 22142 search: 'q' 22143 }; 22144 const url = new URL('https://api.openverse.org/v1/images/'); 22145 Object.entries(finalQuery).forEach(([key, value]) => { 22146 const queryKey = mapFromInserterMediaRequest[key] || key; 22147 url.searchParams.set(queryKey, value); 22148 }); 22149 const response = await window.fetch(url, { 22150 headers: { 22151 'User-Agent': 'WordPress/inserter-media-fetch' 22152 } 22153 }); 22154 const jsonResponse = await response.json(); 22155 const results = jsonResponse.results; 22156 return results.map(result => ({ 22157 ...result, 22158 // This is a temp solution for better titles, until Openverse API 22159 // completes the cleaning up of some titles of their upstream data. 22160 title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title, 22161 sourceId: result.id, 22162 id: undefined, 22163 caption: getOpenverseCaption(result), 22164 previewUrl: result.thumbnail 22165 })); 22166 }, 22167 getReportUrl: ({ 22168 sourceId 22169 }) => `https://wordpress.org/openverse/image/$sourceId}/report/`, 22170 isExternalResource: true 22171 }]; 22172 /* harmony default export */ const media_categories = (inserterMediaCategories); 22173 22174 ;// ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js 22175 /** 22176 * External dependencies 22177 */ 22178 22179 22180 /** 22181 * WordPress dependencies 22182 */ 22183 22184 22185 22186 /** 22187 * Internal dependencies 22188 */ 22189 22190 const media_upload_noop = () => {}; 22191 22192 /** 22193 * Upload a media file when the file upload button is activated. 22194 * Wrapper around mediaUpload() that injects the current post ID. 22195 * 22196 * @param {Object} $0 Parameters object passed to the function. 22197 * @param {?Object} $0.additionalData Additional data to include in the request. 22198 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. 22199 * @param {Array} $0.filesList List of files. 22200 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. 22201 * @param {Function} $0.onError Function called when an error happens. 22202 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. 22203 */ 22204 function mediaUpload({ 22205 additionalData = {}, 22206 allowedTypes, 22207 filesList, 22208 maxUploadFileSize, 22209 onError = media_upload_noop, 22210 onFileChange 22211 }) { 22212 const { 22213 getCurrentPost, 22214 getEditorSettings 22215 } = (0,external_wp_data_namespaceObject.select)(store_store); 22216 const { 22217 lockPostAutosaving, 22218 unlockPostAutosaving, 22219 lockPostSaving, 22220 unlockPostSaving 22221 } = (0,external_wp_data_namespaceObject.dispatch)(store_store); 22222 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; 22223 const lockKey = `image-upload-$esm_browser_v4()}`; 22224 let imageIsUploading = false; 22225 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; 22226 const currentPost = getCurrentPost(); 22227 // Templates and template parts' numerical ID is stored in `wp_id`. 22228 const currentPostId = typeof currentPost?.id === 'number' ? currentPost.id : currentPost?.wp_id; 22229 const setSaveLock = () => { 22230 lockPostSaving(lockKey); 22231 lockPostAutosaving(lockKey); 22232 imageIsUploading = true; 22233 }; 22234 const postData = currentPostId ? { 22235 post: currentPostId 22236 } : {}; 22237 const clearSaveLock = () => { 22238 unlockPostSaving(lockKey); 22239 unlockPostAutosaving(lockKey); 22240 imageIsUploading = false; 22241 }; 22242 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 22243 allowedTypes, 22244 filesList, 22245 onFileChange: file => { 22246 if (!imageIsUploading) { 22247 setSaveLock(); 22248 } else { 22249 clearSaveLock(); 22250 } 22251 onFileChange(file); 22252 }, 22253 additionalData: { 22254 ...postData, 22255 ...additionalData 22256 }, 22257 maxUploadFileSize, 22258 onError: ({ 22259 message 22260 }) => { 22261 clearSaveLock(); 22262 onError(message); 22263 }, 22264 wpAllowedMimeTypes 22265 }); 22266 } 22267 22268 // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js 22269 var cjs = __webpack_require__(66); 22270 var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); 22271 ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs 22272 /*! 22273 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 22274 * 22275 * Copyright (c) 2014-2017, Jon Schlinkert. 22276 * Released under the MIT License. 22277 */ 22278 22279 function isObject(o) { 22280 return Object.prototype.toString.call(o) === '[object Object]'; 22281 } 22282 22283 function isPlainObject(o) { 22284 var ctor,prot; 22285 22286 if (isObject(o) === false) return false; 22287 22288 // If has modified constructor 22289 ctor = o.constructor; 22290 if (ctor === undefined) return true; 22291 22292 // If has modified prototype 22293 prot = ctor.prototype; 22294 if (isObject(prot) === false) return false; 22295 22296 // If constructor does not have an Object-specific method 22297 if (prot.hasOwnProperty('isPrototypeOf') === false) { 22298 return false; 22299 } 22300 22301 // Most likely a plain Object 22302 return true; 22303 } 22304 22305 22306 22307 ;// ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js 22308 /** 22309 * External dependencies 22310 */ 22311 22312 22313 22314 /** 22315 * WordPress dependencies 22316 */ 22317 22318 22319 22320 22321 22322 /** 22323 * Internal dependencies 22324 */ 22325 22326 22327 const { 22328 GlobalStylesContext: global_styles_provider_GlobalStylesContext, 22329 cleanEmptyObject 22330 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22331 function mergeBaseAndUserConfigs(base, user) { 22332 return cjs_default()(base, user, { 22333 /* 22334 * We only pass as arrays the presets, 22335 * in which case we want the new array of values 22336 * to override the old array (no merging). 22337 */ 22338 isMergeableObject: isPlainObject, 22339 /* 22340 * Exceptions to the above rule. 22341 * Background images should be replaced, not merged, 22342 * as they themselves are specific object definitions for the style. 22343 */ 22344 customMerge: key => { 22345 if (key === 'backgroundImage') { 22346 return (baseConfig, userConfig) => userConfig; 22347 } 22348 return undefined; 22349 } 22350 }); 22351 } 22352 function useGlobalStylesUserConfig() { 22353 const { 22354 globalStylesId, 22355 isReady, 22356 settings, 22357 styles, 22358 _links 22359 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22360 const { 22361 getEntityRecord, 22362 getEditedEntityRecord, 22363 hasFinishedResolution, 22364 canUser 22365 } = select(external_wp_coreData_namespaceObject.store); 22366 const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); 22367 let record; 22368 22369 // We want the global styles ID request to finish before triggering 22370 // the OPTIONS request for user capabilities, otherwise it will 22371 // fetch `/wp/v2/global-styles` instead of 22372 // `/wp/v2/global-styles/{id}`! 22373 // Please adjust the preloaded requests if this changes! 22374 const userCanEditGlobalStyles = _globalStylesId ? canUser('update', { 22375 kind: 'root', 22376 name: 'globalStyles', 22377 id: _globalStylesId 22378 }) : null; 22379 if (_globalStylesId && 22380 // We want the OPTIONS request for user capabilities to finish 22381 // before getting the records, otherwise we'll fetch both! 22382 typeof userCanEditGlobalStyles === 'boolean') { 22383 // Please adjust the preloaded requests if this changes! 22384 if (userCanEditGlobalStyles) { 22385 record = getEditedEntityRecord('root', 'globalStyles', _globalStylesId); 22386 } else { 22387 record = getEntityRecord('root', 'globalStyles', _globalStylesId, { 22388 context: 'view' 22389 }); 22390 } 22391 } 22392 let hasResolved = false; 22393 if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) { 22394 if (_globalStylesId) { 22395 hasResolved = userCanEditGlobalStyles ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : hasFinishedResolution('getEntityRecord', ['root', 'globalStyles', _globalStylesId, { 22396 context: 'view' 22397 }]); 22398 } else { 22399 hasResolved = true; 22400 } 22401 } 22402 return { 22403 globalStylesId: _globalStylesId, 22404 isReady: hasResolved, 22405 settings: record?.settings, 22406 styles: record?.styles, 22407 _links: record?._links 22408 }; 22409 }, []); 22410 const { 22411 getEditedEntityRecord 22412 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 22413 const { 22414 editEntityRecord 22415 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 22416 const config = (0,external_wp_element_namespaceObject.useMemo)(() => { 22417 return { 22418 settings: settings !== null && settings !== void 0 ? settings : {}, 22419 styles: styles !== null && styles !== void 0 ? styles : {}, 22420 _links: _links !== null && _links !== void 0 ? _links : {} 22421 }; 22422 }, [settings, styles, _links]); 22423 const setConfig = (0,external_wp_element_namespaceObject.useCallback)( 22424 /** 22425 * Set the global styles config. 22426 * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values. 22427 * Otherwise, overwrite the current config with the incoming object. 22428 * @param {Object} options Options for editEntityRecord Core selector. 22429 */ 22430 (callbackOrObject, options = {}) => { 22431 var _record$styles, _record$settings, _record$_links; 22432 const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId); 22433 const currentConfig = { 22434 styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {}, 22435 settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}, 22436 _links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {} 22437 }; 22438 const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject; 22439 editEntityRecord('root', 'globalStyles', globalStylesId, { 22440 styles: cleanEmptyObject(updatedConfig.styles) || {}, 22441 settings: cleanEmptyObject(updatedConfig.settings) || {}, 22442 _links: cleanEmptyObject(updatedConfig._links) || {} 22443 }, options); 22444 }, [globalStylesId, editEntityRecord, getEditedEntityRecord]); 22445 return [isReady, config, setConfig]; 22446 } 22447 function useGlobalStylesBaseConfig() { 22448 const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(), []); 22449 return [!!baseConfig, baseConfig]; 22450 } 22451 function useGlobalStylesContext() { 22452 const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); 22453 const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); 22454 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 22455 if (!baseConfig || !userConfig) { 22456 return {}; 22457 } 22458 return mergeBaseAndUserConfigs(baseConfig, userConfig); 22459 }, [userConfig, baseConfig]); 22460 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 22461 return { 22462 isReady: isUserConfigReady && isBaseConfigReady, 22463 user: userConfig, 22464 base: baseConfig, 22465 merged: mergedConfig, 22466 setUserConfig 22467 }; 22468 }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]); 22469 return context; 22470 } 22471 function GlobalStylesProvider({ 22472 children 22473 }) { 22474 const context = useGlobalStylesContext(); 22475 if (!context.isReady) { 22476 return null; 22477 } 22478 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(global_styles_provider_GlobalStylesContext.Provider, { 22479 value: context, 22480 children: children 22481 }); 22482 } 22483 22484 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js 22485 /** 22486 * WordPress dependencies 22487 */ 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 /** 22498 * Internal dependencies 22499 */ 22500 22501 22502 22503 22504 22505 const use_block_editor_settings_EMPTY_OBJECT = {}; 22506 function __experimentalReusableBlocksSelect(select) { 22507 const { 22508 getEntityRecords, 22509 hasFinishedResolution 22510 } = select(external_wp_coreData_namespaceObject.store); 22511 const reusableBlocks = getEntityRecords('postType', 'wp_block', { 22512 per_page: -1 22513 }); 22514 return hasFinishedResolution('getEntityRecords', ['postType', 'wp_block', { 22515 per_page: -1 22516 }]) ? reusableBlocks : undefined; 22517 } 22518 const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', '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', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme']; 22519 const { 22520 globalStylesDataKey, 22521 globalStylesLinksDataKey, 22522 selectBlockPatternsKey, 22523 reusableBlocksSelectKey, 22524 sectionRootClientIdKey 22525 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22526 22527 /** 22528 * React hook used to compute the block editor settings to use for the post editor. 22529 * 22530 * @param {Object} settings EditorProvider settings prop. 22531 * @param {string} postType Editor root level post type. 22532 * @param {string} postId Editor root level post ID. 22533 * @param {string} renderingMode Editor rendering mode. 22534 * 22535 * @return {Object} Block Editor Settings. 22536 */ 22537 function useBlockEditorSettings(settings, postType, postId, renderingMode) { 22538 var _mergedGlobalStyles$s, _mergedGlobalStyles$_, _settings$__experimen, _settings$__experimen2; 22539 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 22540 const { 22541 allowRightClickOverrides, 22542 blockTypes, 22543 focusMode, 22544 hasFixedToolbar, 22545 isDistractionFree, 22546 keepCaretInsideBlock, 22547 hasUploadPermissions, 22548 hiddenBlockTypes, 22549 canUseUnfilteredHTML, 22550 userCanCreatePages, 22551 pageOnFront, 22552 pageForPosts, 22553 userPatternCategories, 22554 restBlockPatternCategories, 22555 sectionRootClientId 22556 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 22557 var _canUser; 22558 const { 22559 canUser, 22560 getRawEntityRecord, 22561 getEntityRecord, 22562 getUserPatternCategories, 22563 getBlockPatternCategories 22564 } = select(external_wp_coreData_namespaceObject.store); 22565 const { 22566 get 22567 } = select(external_wp_preferences_namespaceObject.store); 22568 const { 22569 getBlockTypes 22570 } = select(external_wp_blocks_namespaceObject.store); 22571 const { 22572 getBlocksByName, 22573 getBlockAttributes 22574 } = select(external_wp_blockEditor_namespaceObject.store); 22575 const siteSettings = canUser('read', { 22576 kind: 'root', 22577 name: 'site' 22578 }) ? getEntityRecord('root', 'site') : undefined; 22579 function getSectionRootBlock() { 22580 var _getBlocksByName$find; 22581 if (renderingMode === 'template-locked') { 22582 var _getBlocksByName$; 22583 return (_getBlocksByName$ = getBlocksByName('core/post-content')?.[0]) !== null && _getBlocksByName$ !== void 0 ? _getBlocksByName$ : ''; 22584 } 22585 return (_getBlocksByName$find = getBlocksByName('core/group').find(clientId => getBlockAttributes(clientId)?.tagName === 'main')) !== null && _getBlocksByName$find !== void 0 ? _getBlocksByName$find : ''; 22586 } 22587 return { 22588 allowRightClickOverrides: get('core', 'allowRightClickOverrides'), 22589 blockTypes: getBlockTypes(), 22590 canUseUnfilteredHTML: getRawEntityRecord('postType', postType, postId)?._links?.hasOwnProperty('wp:action-unfiltered-html'), 22591 focusMode: get('core', 'focusMode'), 22592 hasFixedToolbar: get('core', 'fixedToolbar') || !isLargeViewport, 22593 hiddenBlockTypes: get('core', 'hiddenBlockTypes'), 22594 isDistractionFree: get('core', 'distractionFree'), 22595 keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'), 22596 hasUploadPermissions: (_canUser = canUser('create', { 22597 kind: 'root', 22598 name: 'media' 22599 })) !== null && _canUser !== void 0 ? _canUser : true, 22600 userCanCreatePages: canUser('create', { 22601 kind: 'postType', 22602 name: 'page' 22603 }), 22604 pageOnFront: siteSettings?.page_on_front, 22605 pageForPosts: siteSettings?.page_for_posts, 22606 userPatternCategories: getUserPatternCategories(), 22607 restBlockPatternCategories: getBlockPatternCategories(), 22608 sectionRootClientId: getSectionRootBlock() 22609 }; 22610 }, [postType, postId, isLargeViewport, renderingMode]); 22611 const { 22612 merged: mergedGlobalStyles 22613 } = useGlobalStylesContext(); 22614 const globalStylesData = (_mergedGlobalStyles$s = mergedGlobalStyles.styles) !== null && _mergedGlobalStyles$s !== void 0 ? _mergedGlobalStyles$s : use_block_editor_settings_EMPTY_OBJECT; 22615 const globalStylesLinksData = (_mergedGlobalStyles$_ = mergedGlobalStyles._links) !== null && _mergedGlobalStyles$_ !== void 0 ? _mergedGlobalStyles$_ : use_block_editor_settings_EMPTY_OBJECT; 22616 const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : 22617 // WP 6.0 22618 settings.__experimentalBlockPatterns; // WP 5.9 22619 const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 : 22620 // WP 6.0 22621 settings.__experimentalBlockPatternCategories; // WP 5.9 22622 22623 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || [])].filter(({ 22624 postTypes 22625 }) => { 22626 return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType); 22627 }), [settingsBlockPatterns, postType]); 22628 const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]); 22629 const { 22630 undo, 22631 setIsInserterOpened 22632 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22633 const { 22634 saveEntityRecord 22635 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 22636 22637 /** 22638 * Creates a Post entity. 22639 * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages. 22640 * 22641 * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord. 22642 * @return {Object} the post type object that was created. 22643 */ 22644 const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(options => { 22645 if (!userCanCreatePages) { 22646 return Promise.reject({ 22647 message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.') 22648 }); 22649 } 22650 return saveEntityRecord('postType', 'page', options); 22651 }, [saveEntityRecord, userCanCreatePages]); 22652 const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 22653 // Omit hidden block types if exists and non-empty. 22654 if (hiddenBlockTypes && hiddenBlockTypes.length > 0) { 22655 // Defer to passed setting for `allowedBlockTypes` if provided as 22656 // anything other than `true` (where `true` is equivalent to allow 22657 // all block types). 22658 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ 22659 name 22660 }) => name) : settings.allowedBlockTypes || []; 22661 return defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type)); 22662 } 22663 return settings.allowedBlockTypes; 22664 }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]); 22665 const forceDisableFocusMode = settings.focusMode === false; 22666 return (0,external_wp_element_namespaceObject.useMemo)(() => { 22667 const blockEditorSettings = { 22668 ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))), 22669 [globalStylesDataKey]: globalStylesData, 22670 [globalStylesLinksDataKey]: globalStylesLinksData, 22671 allowedBlockTypes, 22672 allowRightClickOverrides, 22673 focusMode: focusMode && !forceDisableFocusMode, 22674 hasFixedToolbar, 22675 isDistractionFree, 22676 keepCaretInsideBlock, 22677 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, 22678 __experimentalBlockPatterns: blockPatterns, 22679 [selectBlockPatternsKey]: select => { 22680 const { 22681 hasFinishedResolution, 22682 getBlockPatternsForPostType 22683 } = unlock(select(external_wp_coreData_namespaceObject.store)); 22684 const patterns = getBlockPatternsForPostType(postType); 22685 return hasFinishedResolution('getBlockPatterns') ? patterns : undefined; 22686 }, 22687 [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, 22688 __experimentalBlockPatternCategories: blockPatternCategories, 22689 __experimentalUserPatternCategories: userPatternCategories, 22690 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), 22691 inserterMediaCategories: media_categories, 22692 __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, 22693 // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited. 22694 // This might be better as a generic "canUser" selector. 22695 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, 22696 //Todo: this is only needed for native and should probably be removed. 22697 __experimentalUndo: undo, 22698 // Check whether we want all site editor frames to have outlines 22699 // including the navigation / pattern / parts editors. 22700 outlineMode: !isDistractionFree && postType === 'wp_template', 22701 // Check these two properties: they were not present in the site editor. 22702 __experimentalCreatePageEntity: createPageEntity, 22703 __experimentalUserCanCreatePages: userCanCreatePages, 22704 pageOnFront, 22705 pageForPosts, 22706 __experimentalPreferPatternsOnRoot: postType === 'wp_template', 22707 templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock, 22708 template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template, 22709 __experimentalSetIsInserterOpened: setIsInserterOpened, 22710 [sectionRootClientIdKey]: sectionRootClientId 22711 }; 22712 return blockEditorSettings; 22713 }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData]); 22714 } 22715 /* harmony default export */ const use_block_editor_settings = (useBlockEditorSettings); 22716 22717 ;// ./node_modules/@wordpress/editor/build-module/components/provider/disable-non-page-content-blocks.js 22718 /** 22719 * WordPress dependencies 22720 */ 22721 22722 22723 22724 22725 22726 /** 22727 * Internal dependencies 22728 */ 22729 22730 22731 const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; 22732 22733 /** 22734 * Component that when rendered, makes it so that the site editor allows only 22735 * page content to be edited. 22736 */ 22737 function DisableNonPageContentBlocks() { 22738 const contentOnlyBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => [...(0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', POST_CONTENT_BLOCK_TYPES), 'core/template-part'], []); 22739 22740 // Note that there are two separate subscriptions because the result for each 22741 // returns a new array. 22742 const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)(select => { 22743 const { 22744 getPostBlocksByName 22745 } = unlock(select(store_store)); 22746 return getPostBlocksByName(contentOnlyBlockTypes); 22747 }, [contentOnlyBlockTypes]); 22748 const disabledIds = (0,external_wp_data_namespaceObject.useSelect)(select => { 22749 const { 22750 getBlocksByName, 22751 getBlockOrder 22752 } = select(external_wp_blockEditor_namespaceObject.store); 22753 return getBlocksByName('core/template-part').flatMap(clientId => getBlockOrder(clientId)); 22754 }, []); 22755 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 22756 (0,external_wp_element_namespaceObject.useEffect)(() => { 22757 const { 22758 setBlockEditingMode, 22759 unsetBlockEditingMode 22760 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 22761 registry.batch(() => { 22762 setBlockEditingMode('', 'disabled'); 22763 for (const clientId of contentOnlyIds) { 22764 setBlockEditingMode(clientId, 'contentOnly'); 22765 } 22766 for (const clientId of disabledIds) { 22767 setBlockEditingMode(clientId, 'disabled'); 22768 } 22769 }); 22770 return () => { 22771 registry.batch(() => { 22772 unsetBlockEditingMode(''); 22773 for (const clientId of contentOnlyIds) { 22774 unsetBlockEditingMode(clientId); 22775 } 22776 for (const clientId of disabledIds) { 22777 unsetBlockEditingMode(clientId); 22778 } 22779 }); 22780 }; 22781 }, [contentOnlyIds, disabledIds, registry]); 22782 return null; 22783 } 22784 22785 ;// ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js 22786 /** 22787 * WordPress dependencies 22788 */ 22789 22790 22791 22792 22793 /** 22794 * For the Navigation block editor, we need to force the block editor to contentOnly for that block. 22795 * 22796 * Set block editing mode to contentOnly when entering Navigation focus mode. 22797 * this ensures that non-content controls on the block will be hidden and thus 22798 * the user can focus on editing the Navigation Menu content only. 22799 */ 22800 22801 function NavigationBlockEditingMode() { 22802 // In the navigation block editor, 22803 // the navigation block is the only root block. 22804 const blockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlockOrder()?.[0], []); 22805 const { 22806 setBlockEditingMode, 22807 unsetBlockEditingMode 22808 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 22809 (0,external_wp_element_namespaceObject.useEffect)(() => { 22810 if (!blockClientId) { 22811 return; 22812 } 22813 setBlockEditingMode(blockClientId, 'contentOnly'); 22814 return () => { 22815 unsetBlockEditingMode(blockClientId); 22816 }; 22817 }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]); 22818 } 22819 22820 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js 22821 /** 22822 * WordPress dependencies 22823 */ 22824 22825 22826 22827 // These post types are "structural" block lists. 22828 // We should be allowed to use 22829 // the post content and template parts blocks within them. 22830 const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = ['wp_block', 'wp_template', 'wp_template_part']; 22831 22832 /** 22833 * In some specific contexts, 22834 * the template part and post content blocks need to be hidden. 22835 * 22836 * @param {string} postType Post Type 22837 * @param {string} mode Rendering mode 22838 */ 22839 function useHideBlocksFromInserter(postType, mode) { 22840 (0,external_wp_element_namespaceObject.useEffect)(() => { 22841 /* 22842 * Prevent adding template part in the editor. 22843 */ 22844 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { 22845 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/template-part' && mode === 'post-only') { 22846 return false; 22847 } 22848 return canInsert; 22849 }); 22850 22851 /* 22852 * Prevent adding post content block (except in query block) in the editor. 22853 */ 22854 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { 22855 getBlockParentsByBlockName 22856 }) => { 22857 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes(postType) && blockType.name === 'core/post-content') { 22858 return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; 22859 } 22860 return canInsert; 22861 }); 22862 return () => { 22863 (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter'); 22864 (0,external_wp_hooks_namespaceObject.removeFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter'); 22865 }; 22866 }, [postType, mode]); 22867 } 22868 22869 ;// ./node_modules/@wordpress/icons/build-module/library/keyboard.js 22870 /** 22871 * WordPress dependencies 22872 */ 22873 22874 22875 22876 const keyboard = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { 22877 xmlns: "http://www.w3.org/2000/svg", 22878 viewBox: "0 0 24 24", 22879 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22880 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" 22881 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22882 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" 22883 })] 22884 }); 22885 /* harmony default export */ const library_keyboard = (keyboard); 22886 22887 ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js 22888 /** 22889 * WordPress dependencies 22890 */ 22891 22892 22893 const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22894 viewBox: "0 0 24 24", 22895 xmlns: "http://www.w3.org/2000/svg", 22896 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22897 d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" 22898 }) 22899 }); 22900 /* harmony default export */ const list_view = (listView); 22901 22902 ;// ./node_modules/@wordpress/icons/build-module/library/code.js 22903 /** 22904 * WordPress dependencies 22905 */ 22906 22907 22908 const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22909 viewBox: "0 0 24 24", 22910 xmlns: "http://www.w3.org/2000/svg", 22911 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22912 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" 22913 }) 22914 }); 22915 /* harmony default export */ const library_code = (code); 22916 22917 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js 22918 /** 22919 * WordPress dependencies 22920 */ 22921 22922 22923 const drawerLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22924 width: "24", 22925 height: "24", 22926 xmlns: "http://www.w3.org/2000/svg", 22927 viewBox: "0 0 24 24", 22928 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22929 fillRule: "evenodd", 22930 clipRule: "evenodd", 22931 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" 22932 }) 22933 }); 22934 /* harmony default export */ const drawer_left = (drawerLeft); 22935 22936 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 22937 /** 22938 * WordPress dependencies 22939 */ 22940 22941 22942 const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22943 width: "24", 22944 height: "24", 22945 xmlns: "http://www.w3.org/2000/svg", 22946 viewBox: "0 0 24 24", 22947 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22948 fillRule: "evenodd", 22949 clipRule: "evenodd", 22950 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" 22951 }) 22952 }); 22953 /* harmony default export */ const drawer_right = (drawerRight); 22954 22955 ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js 22956 /** 22957 * WordPress dependencies 22958 */ 22959 22960 22961 const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22962 xmlns: "http://www.w3.org/2000/svg", 22963 viewBox: "0 0 24 24", 22964 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22965 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" 22966 }) 22967 }); 22968 /* harmony default export */ const block_default = (blockDefault); 22969 22970 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 22971 /** 22972 * WordPress dependencies 22973 */ 22974 22975 22976 const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22977 xmlns: "http://www.w3.org/2000/svg", 22978 viewBox: "0 0 24 24", 22979 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22980 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" 22981 }) 22982 }); 22983 /* harmony default export */ const format_list_bullets = (formatListBullets); 22984 22985 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 22986 /** 22987 * WordPress dependencies 22988 */ 22989 22990 22991 const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 22992 xmlns: "http://www.w3.org/2000/svg", 22993 viewBox: "0 0 24 24", 22994 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 22995 d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" 22996 }) 22997 }); 22998 /* harmony default export */ const library_pencil = (pencil); 22999 23000 ;// ./node_modules/@wordpress/icons/build-module/library/edit.js 23001 /** 23002 * Internal dependencies 23003 */ 23004 23005 23006 /* harmony default export */ const edit = (library_pencil); 23007 23008 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js 23009 /** 23010 * WordPress dependencies 23011 */ 23012 23013 23014 23015 23016 23017 /** 23018 * Internal dependencies 23019 */ 23020 23021 23022 23023 23024 const { 23025 RenamePatternModal 23026 } = unlock(external_wp_patterns_namespaceObject.privateApis); 23027 const modalName = 'editor/pattern-rename'; 23028 function PatternRenameModal() { 23029 const { 23030 record, 23031 postType 23032 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23033 const { 23034 getCurrentPostType, 23035 getCurrentPostId 23036 } = select(store_store); 23037 const { 23038 getEditedEntityRecord 23039 } = select(external_wp_coreData_namespaceObject.store); 23040 const _postType = getCurrentPostType(); 23041 return { 23042 record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), 23043 postType: _postType 23044 }; 23045 }, []); 23046 const { 23047 closeModal 23048 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23049 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(modalName)); 23050 if (!isActive || postType !== PATTERN_POST_TYPE) { 23051 return null; 23052 } 23053 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, { 23054 onClose: closeModal, 23055 pattern: record 23056 }); 23057 } 23058 23059 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js 23060 /** 23061 * WordPress dependencies 23062 */ 23063 23064 23065 23066 23067 23068 /** 23069 * Internal dependencies 23070 */ 23071 23072 23073 23074 23075 const { 23076 DuplicatePatternModal 23077 } = unlock(external_wp_patterns_namespaceObject.privateApis); 23078 const pattern_duplicate_modal_modalName = 'editor/pattern-duplicate'; 23079 function PatternDuplicateModal() { 23080 const { 23081 record, 23082 postType 23083 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23084 const { 23085 getCurrentPostType, 23086 getCurrentPostId 23087 } = select(store_store); 23088 const { 23089 getEditedEntityRecord 23090 } = select(external_wp_coreData_namespaceObject.store); 23091 const _postType = getCurrentPostType(); 23092 return { 23093 record: getEditedEntityRecord('postType', _postType, getCurrentPostId()), 23094 postType: _postType 23095 }; 23096 }, []); 23097 const { 23098 closeModal 23099 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23100 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(pattern_duplicate_modal_modalName)); 23101 if (!isActive || postType !== PATTERN_POST_TYPE) { 23102 return null; 23103 } 23104 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DuplicatePatternModal, { 23105 onClose: closeModal, 23106 onSuccess: () => closeModal(), 23107 pattern: record 23108 }); 23109 } 23110 23111 ;// ./node_modules/@wordpress/editor/build-module/components/commands/index.js 23112 /** 23113 * WordPress dependencies 23114 */ 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 /** 23126 * Internal dependencies 23127 */ 23128 23129 23130 23131 23132 function useEditorCommandLoader() { 23133 const { 23134 editorMode, 23135 isListViewOpen, 23136 showBlockBreadcrumbs, 23137 isDistractionFree, 23138 isTopToolbar, 23139 isFocusMode, 23140 isPreviewMode, 23141 isViewable, 23142 isCodeEditingEnabled, 23143 isRichEditingEnabled, 23144 isPublishSidebarEnabled 23145 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23146 var _get, _getPostType$viewable; 23147 const { 23148 get 23149 } = select(external_wp_preferences_namespaceObject.store); 23150 const { 23151 isListViewOpened, 23152 getCurrentPostType, 23153 getEditorSettings 23154 } = select(store_store); 23155 const { 23156 getSettings 23157 } = select(external_wp_blockEditor_namespaceObject.store); 23158 const { 23159 getPostType 23160 } = select(external_wp_coreData_namespaceObject.store); 23161 return { 23162 editorMode: (_get = get('core', 'editorMode')) !== null && _get !== void 0 ? _get : 'visual', 23163 isListViewOpen: isListViewOpened(), 23164 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 23165 isDistractionFree: get('core', 'distractionFree'), 23166 isFocusMode: get('core', 'focusMode'), 23167 isTopToolbar: get('core', 'fixedToolbar'), 23168 isPreviewMode: getSettings().__unstableIsPreviewMode, 23169 isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, 23170 isCodeEditingEnabled: getEditorSettings().codeEditingEnabled, 23171 isRichEditingEnabled: getEditorSettings().richEditingEnabled, 23172 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled() 23173 }; 23174 }, []); 23175 const { 23176 getActiveComplementaryArea 23177 } = (0,external_wp_data_namespaceObject.useSelect)(store); 23178 const { 23179 toggle 23180 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 23181 const { 23182 createInfoNotice 23183 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 23184 const { 23185 __unstableSaveForPreview, 23186 setIsListViewOpened, 23187 switchEditorMode, 23188 toggleDistractionFree 23189 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23190 const { 23191 openModal, 23192 enableComplementaryArea, 23193 disableComplementaryArea 23194 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23195 const { 23196 getCurrentPostId 23197 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 23198 const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled; 23199 if (isPreviewMode) { 23200 return { 23201 commands: [], 23202 isLoading: false 23203 }; 23204 } 23205 const commands = []; 23206 commands.push({ 23207 name: 'core/open-shortcut-help', 23208 label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 23209 icon: library_keyboard, 23210 callback: ({ 23211 close 23212 }) => { 23213 close(); 23214 openModal('editor/keyboard-shortcut-help'); 23215 } 23216 }); 23217 commands.push({ 23218 name: 'core/toggle-distraction-free', 23219 label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction Free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction Free'), 23220 callback: ({ 23221 close 23222 }) => { 23223 toggleDistractionFree(); 23224 close(); 23225 } 23226 }); 23227 commands.push({ 23228 name: 'core/open-preferences', 23229 label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), 23230 callback: ({ 23231 close 23232 }) => { 23233 close(); 23234 openModal('editor/preferences'); 23235 } 23236 }); 23237 commands.push({ 23238 name: 'core/toggle-spotlight-mode', 23239 label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight'), 23240 callback: ({ 23241 close 23242 }) => { 23243 toggle('core', 'focusMode'); 23244 close(); 23245 createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight off.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight on.'), { 23246 id: 'core/editor/toggle-spotlight-mode/notice', 23247 type: 'snackbar', 23248 actions: [{ 23249 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 23250 onClick: () => { 23251 toggle('core', 'focusMode'); 23252 } 23253 }] 23254 }); 23255 } 23256 }); 23257 commands.push({ 23258 name: 'core/toggle-list-view', 23259 label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'), 23260 icon: list_view, 23261 callback: ({ 23262 close 23263 }) => { 23264 setIsListViewOpened(!isListViewOpen); 23265 close(); 23266 createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), { 23267 id: 'core/editor/toggle-list-view/notice', 23268 type: 'snackbar' 23269 }); 23270 } 23271 }); 23272 commands.push({ 23273 name: 'core/toggle-top-toolbar', 23274 label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'), 23275 callback: ({ 23276 close 23277 }) => { 23278 toggle('core', 'fixedToolbar'); 23279 if (isDistractionFree) { 23280 toggleDistractionFree(); 23281 } 23282 close(); 23283 createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar off.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar on.'), { 23284 id: 'core/editor/toggle-top-toolbar/notice', 23285 type: 'snackbar', 23286 actions: [{ 23287 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 23288 onClick: () => { 23289 toggle('core', 'fixedToolbar'); 23290 } 23291 }] 23292 }); 23293 } 23294 }); 23295 if (allowSwitchEditorMode) { 23296 commands.push({ 23297 name: 'core/toggle-code-editor', 23298 label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'), 23299 icon: library_code, 23300 callback: ({ 23301 close 23302 }) => { 23303 switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); 23304 close(); 23305 } 23306 }); 23307 } 23308 commands.push({ 23309 name: 'core/toggle-breadcrumbs', 23310 label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), 23311 callback: ({ 23312 close 23313 }) => { 23314 toggle('core', 'showBlockBreadcrumbs'); 23315 close(); 23316 createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { 23317 id: 'core/editor/toggle-breadcrumbs/notice', 23318 type: 'snackbar' 23319 }); 23320 } 23321 }); 23322 commands.push({ 23323 name: 'core/open-settings-sidebar', 23324 label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'), 23325 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 23326 callback: ({ 23327 close 23328 }) => { 23329 const activeSidebar = getActiveComplementaryArea('core'); 23330 close(); 23331 if (activeSidebar === 'edit-post/document') { 23332 disableComplementaryArea('core'); 23333 } else { 23334 enableComplementaryArea('core', 'edit-post/document'); 23335 } 23336 } 23337 }); 23338 commands.push({ 23339 name: 'core/open-block-inspector', 23340 label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'), 23341 icon: block_default, 23342 callback: ({ 23343 close 23344 }) => { 23345 const activeSidebar = getActiveComplementaryArea('core'); 23346 close(); 23347 if (activeSidebar === 'edit-post/block') { 23348 disableComplementaryArea('core'); 23349 } else { 23350 enableComplementaryArea('core', 'edit-post/block'); 23351 } 23352 } 23353 }); 23354 commands.push({ 23355 name: 'core/toggle-publish-sidebar', 23356 label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'), 23357 icon: format_list_bullets, 23358 callback: ({ 23359 close 23360 }) => { 23361 close(); 23362 toggle('core', 'isPublishSidebarEnabled'); 23363 createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), { 23364 id: 'core/editor/publish-sidebar/notice', 23365 type: 'snackbar' 23366 }); 23367 } 23368 }); 23369 if (isViewable) { 23370 commands.push({ 23371 name: 'core/preview-link', 23372 label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), 23373 icon: library_external, 23374 callback: async ({ 23375 close 23376 }) => { 23377 close(); 23378 const postId = getCurrentPostId(); 23379 const link = await __unstableSaveForPreview(); 23380 window.open(link, `wp-preview-$postId}`); 23381 } 23382 }); 23383 } 23384 return { 23385 commands, 23386 isLoading: false 23387 }; 23388 } 23389 function useEditedEntityContextualCommands() { 23390 const { 23391 postType 23392 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23393 const { 23394 getCurrentPostType 23395 } = select(store_store); 23396 return { 23397 postType: getCurrentPostType() 23398 }; 23399 }, []); 23400 const { 23401 openModal 23402 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23403 const commands = []; 23404 if (postType === PATTERN_POST_TYPE) { 23405 commands.push({ 23406 name: 'core/rename-pattern', 23407 label: (0,external_wp_i18n_namespaceObject.__)('Rename pattern'), 23408 icon: edit, 23409 callback: ({ 23410 close 23411 }) => { 23412 openModal(modalName); 23413 close(); 23414 } 23415 }); 23416 commands.push({ 23417 name: 'core/duplicate-pattern', 23418 label: (0,external_wp_i18n_namespaceObject.__)('Duplicate pattern'), 23419 icon: library_symbol, 23420 callback: ({ 23421 close 23422 }) => { 23423 openModal(pattern_duplicate_modal_modalName); 23424 close(); 23425 } 23426 }); 23427 } 23428 return { 23429 isLoading: false, 23430 commands 23431 }; 23432 } 23433 function useCommands() { 23434 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 23435 name: 'core/editor/edit-ui', 23436 hook: useEditorCommandLoader 23437 }); 23438 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 23439 name: 'core/editor/contextual-commands', 23440 hook: useEditedEntityContextualCommands, 23441 context: 'entity-edit' 23442 }); 23443 } 23444 23445 ;// ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js 23446 /** 23447 * WordPress dependencies 23448 */ 23449 23450 23451 23452 23453 23454 23455 /** 23456 * Internal dependencies 23457 */ 23458 23459 23460 23461 const { 23462 BlockRemovalWarningModal 23463 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23464 23465 // Prevent accidental removal of certain blocks, asking the user for confirmation first. 23466 const TEMPLATE_BLOCKS = ['core/post-content', 'core/post-template', 'core/query']; 23467 const BLOCK_REMOVAL_RULES = [{ 23468 // Template blocks. 23469 // The warning is only shown when a user manipulates templates or template parts. 23470 postTypes: ['wp_template', 'wp_template_part'], 23471 callback(removedBlocks) { 23472 const removedTemplateBlocks = removedBlocks.filter(({ 23473 name 23474 }) => TEMPLATE_BLOCKS.includes(name)); 23475 if (removedTemplateBlocks.length) { 23476 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); 23477 } 23478 } 23479 }, { 23480 // Pattern overrides. 23481 // The warning is only shown when the user edits a pattern. 23482 postTypes: ['wp_block'], 23483 callback(removedBlocks) { 23484 const removedBlocksWithOverrides = removedBlocks.filter(({ 23485 attributes 23486 }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some(binding => binding.source === 'core/pattern-overrides')); 23487 if (removedBlocksWithOverrides.length) { 23488 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); 23489 } 23490 } 23491 }]; 23492 function BlockRemovalWarnings() { 23493 const currentPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); 23494 const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)(() => BLOCK_REMOVAL_RULES.filter(rule => rule.postTypes.includes(currentPostType)), [currentPostType]); 23495 23496 // `BlockRemovalWarnings` is rendered in the editor provider, a shared component 23497 // across react native and web. However, `BlockRemovalWarningModal` is web only. 23498 // Check it exists before trying to render it. 23499 if (!BlockRemovalWarningModal) { 23500 return null; 23501 } 23502 if (!removalRulesForPostType) { 23503 return null; 23504 } 23505 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, { 23506 rules: removalRulesForPostType 23507 }); 23508 } 23509 23510 ;// ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js 23511 /** 23512 * WordPress dependencies 23513 */ 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 /** 23526 * Internal dependencies 23527 */ 23528 23529 23530 23531 function useStartPatterns() { 23532 // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes, 23533 // and it has no postTypes declared and the current post type is page or if 23534 // the current post type is part of the postTypes declared. 23535 const { 23536 blockPatternsWithPostContentBlockType, 23537 postType 23538 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23539 const { 23540 getPatternsByBlockTypes, 23541 getBlocksByName 23542 } = select(external_wp_blockEditor_namespaceObject.store); 23543 const { 23544 getCurrentPostType, 23545 getRenderingMode 23546 } = select(store_store); 23547 const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0]; 23548 return { 23549 blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId), 23550 postType: getCurrentPostType() 23551 }; 23552 }, []); 23553 return (0,external_wp_element_namespaceObject.useMemo)(() => { 23554 if (!blockPatternsWithPostContentBlockType?.length) { 23555 return []; 23556 } 23557 23558 /* 23559 * Filter patterns without postTypes declared if the current postType is page 23560 * or patterns that declare the current postType in its post type array. 23561 */ 23562 return blockPatternsWithPostContentBlockType.filter(pattern => { 23563 return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType); 23564 }); 23565 }, [postType, blockPatternsWithPostContentBlockType]); 23566 } 23567 function PatternSelection({ 23568 blockPatterns, 23569 onChoosePattern 23570 }) { 23571 const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns); 23572 const { 23573 editEntityRecord 23574 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 23575 const { 23576 postType, 23577 postId 23578 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23579 const { 23580 getCurrentPostType, 23581 getCurrentPostId 23582 } = select(store_store); 23583 return { 23584 postType: getCurrentPostType(), 23585 postId: getCurrentPostId() 23586 }; 23587 }, []); 23588 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 23589 blockPatterns: blockPatterns, 23590 shownPatterns: shownBlockPatterns, 23591 onClickPattern: (_pattern, blocks) => { 23592 editEntityRecord('postType', postType, postId, { 23593 blocks, 23594 content: ({ 23595 blocks: blocksForSerialization = [] 23596 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization) 23597 }); 23598 onChoosePattern(); 23599 } 23600 }); 23601 } 23602 function StartPageOptionsModal({ 23603 onClose 23604 }) { 23605 const startPatterns = useStartPatterns(); 23606 const hasStartPattern = startPatterns.length > 0; 23607 if (!hasStartPattern) { 23608 return null; 23609 } 23610 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 23611 title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), 23612 isFullScreen: true, 23613 onRequestClose: onClose, 23614 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23615 className: "editor-start-page-options__modal-content", 23616 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternSelection, { 23617 blockPatterns: startPatterns, 23618 onChoosePattern: onClose 23619 }) 23620 }) 23621 }); 23622 } 23623 function StartPageOptions() { 23624 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 23625 const shouldEnableModal = (0,external_wp_data_namespaceObject.useSelect)(select => { 23626 const { 23627 isEditedPostDirty, 23628 isEditedPostEmpty, 23629 getCurrentPostType 23630 } = select(store_store); 23631 const preferencesModalActive = select(store).isModalActive('editor/preferences'); 23632 const choosePatternModalEnabled = select(external_wp_preferences_namespaceObject.store).get('core', 'enableChoosePatternModal'); 23633 return choosePatternModalEnabled && !preferencesModalActive && !isEditedPostDirty() && isEditedPostEmpty() && TEMPLATE_POST_TYPE !== getCurrentPostType(); 23634 }, []); 23635 if (!shouldEnableModal || isClosed) { 23636 return null; 23637 } 23638 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptionsModal, { 23639 onClose: () => setIsClosed(true) 23640 }); 23641 } 23642 23643 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js 23644 /** 23645 * WordPress dependencies 23646 */ 23647 23648 const textFormattingShortcuts = [{ 23649 keyCombination: { 23650 modifier: 'primary', 23651 character: 'b' 23652 }, 23653 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') 23654 }, { 23655 keyCombination: { 23656 modifier: 'primary', 23657 character: 'i' 23658 }, 23659 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') 23660 }, { 23661 keyCombination: { 23662 modifier: 'primary', 23663 character: 'k' 23664 }, 23665 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') 23666 }, { 23667 keyCombination: { 23668 modifier: 'primaryShift', 23669 character: 'k' 23670 }, 23671 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') 23672 }, { 23673 keyCombination: { 23674 character: '[[' 23675 }, 23676 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') 23677 }, { 23678 keyCombination: { 23679 modifier: 'primary', 23680 character: 'u' 23681 }, 23682 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') 23683 }, { 23684 keyCombination: { 23685 modifier: 'access', 23686 character: 'd' 23687 }, 23688 description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') 23689 }, { 23690 keyCombination: { 23691 modifier: 'access', 23692 character: 'x' 23693 }, 23694 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') 23695 }, { 23696 keyCombination: { 23697 modifier: 'access', 23698 character: '0' 23699 }, 23700 aliases: [{ 23701 modifier: 'access', 23702 character: '7' 23703 }], 23704 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') 23705 }, { 23706 keyCombination: { 23707 modifier: 'access', 23708 character: '1-6' 23709 }, 23710 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') 23711 }, { 23712 keyCombination: { 23713 modifier: 'primaryShift', 23714 character: 'SPACE' 23715 }, 23716 description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.') 23717 }]; 23718 23719 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js 23720 /** 23721 * WordPress dependencies 23722 */ 23723 23724 23725 23726 23727 23728 function KeyCombination({ 23729 keyCombination, 23730 forceAriaLabel 23731 }) { 23732 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; 23733 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; 23734 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { 23735 className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination", 23736 "aria-label": forceAriaLabel || ariaLabel, 23737 children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { 23738 if (character === '+') { 23739 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { 23740 children: character 23741 }, index); 23742 } 23743 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { 23744 className: "editor-keyboard-shortcut-help-modal__shortcut-key", 23745 children: character 23746 }, index); 23747 }) 23748 }); 23749 } 23750 function Shortcut({ 23751 description, 23752 keyCombination, 23753 aliases = [], 23754 ariaLabel 23755 }) { 23756 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 23757 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 23758 className: "editor-keyboard-shortcut-help-modal__shortcut-description", 23759 children: description 23760 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 23761 className: "editor-keyboard-shortcut-help-modal__shortcut-term", 23762 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { 23763 keyCombination: keyCombination, 23764 forceAriaLabel: ariaLabel 23765 }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { 23766 keyCombination: alias, 23767 forceAriaLabel: ariaLabel 23768 }, index))] 23769 })] 23770 }); 23771 } 23772 /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); 23773 23774 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 23775 /** 23776 * WordPress dependencies 23777 */ 23778 23779 23780 23781 /** 23782 * Internal dependencies 23783 */ 23784 23785 23786 function DynamicShortcut({ 23787 name 23788 }) { 23789 const { 23790 keyCombination, 23791 description, 23792 aliases 23793 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23794 const { 23795 getShortcutKeyCombination, 23796 getShortcutDescription, 23797 getShortcutAliases 23798 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 23799 return { 23800 keyCombination: getShortcutKeyCombination(name), 23801 aliases: getShortcutAliases(name), 23802 description: getShortcutDescription(name) 23803 }; 23804 }, [name]); 23805 if (!keyCombination) { 23806 return null; 23807 } 23808 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { 23809 keyCombination: keyCombination, 23810 description: description, 23811 aliases: aliases 23812 }); 23813 } 23814 /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); 23815 23816 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js 23817 /** 23818 * External dependencies 23819 */ 23820 23821 23822 /** 23823 * WordPress dependencies 23824 */ 23825 23826 23827 23828 23829 23830 23831 /** 23832 * Internal dependencies 23833 */ 23834 23835 23836 23837 23838 23839 const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help'; 23840 const ShortcutList = ({ 23841 shortcuts 23842 }) => 23843 /*#__PURE__*/ 23844 /* 23845 * Disable reason: The `list` ARIA role is redundant but 23846 * Safari+VoiceOver won't announce the list otherwise. 23847 */ 23848 /* eslint-disable jsx-a11y/no-redundant-roles */ 23849 (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 23850 className: "editor-keyboard-shortcut-help-modal__shortcut-list", 23851 role: "list", 23852 children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { 23853 className: "editor-keyboard-shortcut-help-modal__shortcut", 23854 children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, { 23855 name: shortcut 23856 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { 23857 ...shortcut 23858 }) 23859 }, index)) 23860 }) 23861 /* eslint-enable jsx-a11y/no-redundant-roles */; 23862 const ShortcutSection = ({ 23863 title, 23864 shortcuts, 23865 className 23866 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { 23867 className: dist_clsx('editor-keyboard-shortcut-help-modal__section', className), 23868 children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 23869 className: "editor-keyboard-shortcut-help-modal__section-title", 23870 children: title 23871 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { 23872 shortcuts: shortcuts 23873 })] 23874 }); 23875 const ShortcutCategorySection = ({ 23876 title, 23877 categoryName, 23878 additionalShortcuts = [] 23879 }) => { 23880 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { 23881 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); 23882 }, [categoryName]); 23883 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 23884 title: title, 23885 shortcuts: categoryShortcuts.concat(additionalShortcuts) 23886 }); 23887 }; 23888 function KeyboardShortcutHelpModal() { 23889 const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME), []); 23890 const { 23891 openModal, 23892 closeModal 23893 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23894 const toggleModal = () => { 23895 if (isModalActive) { 23896 closeModal(); 23897 } else { 23898 openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); 23899 } 23900 }; 23901 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/keyboard-shortcuts', toggleModal); 23902 if (!isModalActive) { 23903 return null; 23904 } 23905 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 23906 className: "editor-keyboard-shortcut-help-modal", 23907 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 23908 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 23909 onRequestClose: toggleModal, 23910 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 23911 className: "editor-keyboard-shortcut-help-modal__main-shortcuts", 23912 shortcuts: ['core/editor/keyboard-shortcuts'] 23913 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 23914 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), 23915 categoryName: "global" 23916 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 23917 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), 23918 categoryName: "selection" 23919 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 23920 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), 23921 categoryName: "block", 23922 additionalShortcuts: [{ 23923 keyCombination: { 23924 character: '/' 23925 }, 23926 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), 23927 /* translators: The forward-slash character. e.g. '/'. */ 23928 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') 23929 }] 23930 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { 23931 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), 23932 shortcuts: textFormattingShortcuts 23933 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { 23934 title: (0,external_wp_i18n_namespaceObject.__)('List View shortcuts'), 23935 categoryName: "list-view" 23936 })] 23937 }); 23938 } 23939 /* harmony default export */ const keyboard_shortcut_help_modal = (KeyboardShortcutHelpModal); 23940 23941 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js 23942 /** 23943 * WordPress dependencies 23944 */ 23945 23946 23947 23948 23949 23950 23951 /** 23952 * Internal dependencies 23953 */ 23954 23955 23956 23957 23958 23959 function ContentOnlySettingsMenuItems({ 23960 clientId, 23961 onClose 23962 }) { 23963 const { 23964 entity, 23965 onNavigateToEntityRecord, 23966 canEditTemplates 23967 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 23968 const { 23969 getBlockEditingMode, 23970 getBlockParentsByBlockName, 23971 getSettings, 23972 getBlockAttributes 23973 } = select(external_wp_blockEditor_namespaceObject.store); 23974 const contentOnly = getBlockEditingMode(clientId) === 'contentOnly'; 23975 if (!contentOnly) { 23976 return {}; 23977 } 23978 const patternParent = getBlockParentsByBlockName(clientId, 'core/block', true)[0]; 23979 let record; 23980 if (patternParent) { 23981 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_block', getBlockAttributes(patternParent).ref); 23982 } else { 23983 const { 23984 getCurrentTemplateId, 23985 getRenderingMode 23986 } = select(store_store); 23987 const templateId = getCurrentTemplateId(); 23988 const { 23989 getContentLockingParent 23990 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 23991 if (getRenderingMode() === 'template-locked' && !getContentLockingParent(clientId) && templateId) { 23992 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId); 23993 } 23994 } 23995 const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser('create', { 23996 kind: 'postType', 23997 name: 'wp_template' 23998 }); 23999 return { 24000 canEditTemplates: _canEditTemplates, 24001 entity: record, 24002 onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord 24003 }; 24004 }, [clientId]); 24005 if (!entity) { 24006 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateLockContentOnlyMenuItems, { 24007 clientId: clientId, 24008 onClose: onClose 24009 }); 24010 } 24011 const isPattern = entity.type === 'wp_block'; 24012 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.'); 24013 if (!canEditTemplates) { 24014 helpText = (0,external_wp_i18n_namespaceObject.__)('Only users with permissions to edit the template can move or delete this block'); 24015 } 24016 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24017 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { 24018 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24019 onClick: () => { 24020 onNavigateToEntityRecord({ 24021 postId: entity.id, 24022 postType: entity.type 24023 }); 24024 }, 24025 disabled: !canEditTemplates, 24026 children: isPattern ? (0,external_wp_i18n_namespaceObject.__)('Edit pattern') : (0,external_wp_i18n_namespaceObject.__)('Edit template') 24027 }) 24028 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24029 variant: "muted", 24030 as: "p", 24031 className: "editor-content-only-settings-menu__description", 24032 children: helpText 24033 })] 24034 }); 24035 } 24036 function TemplateLockContentOnlyMenuItems({ 24037 clientId, 24038 onClose 24039 }) { 24040 const { 24041 contentLockingParent 24042 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24043 const { 24044 getContentLockingParent 24045 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 24046 return { 24047 contentLockingParent: getContentLockingParent(clientId) 24048 }; 24049 }, [clientId]); 24050 const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent); 24051 const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24052 if (!blockDisplayInformation?.title) { 24053 return null; 24054 } 24055 const { 24056 modifyContentLockBlock 24057 } = unlock(blockEditorActions); 24058 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24059 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { 24060 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24061 onClick: () => { 24062 modifyContentLockBlock(contentLockingParent); 24063 onClose(); 24064 }, 24065 children: (0,external_wp_i18n_namespaceObject._x)('Unlock', 'Unlock content locked blocks') 24066 }) 24067 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 24068 variant: "muted", 24069 as: "p", 24070 className: "editor-content-only-settings-menu__description", 24071 children: (0,external_wp_i18n_namespaceObject.__)('Temporarily unlock the parent block to edit, delete or make further changes to this block.') 24072 })] 24073 }); 24074 } 24075 function ContentOnlySettingsMenu() { 24076 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 24077 children: ({ 24078 selectedClientIds, 24079 onClose 24080 }) => selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenuItems, { 24081 clientId: selectedClientIds[0], 24082 onClose: onClose 24083 }) 24084 }); 24085 } 24086 24087 ;// ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js 24088 /** 24089 * WordPress dependencies 24090 */ 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 /** 24101 * Internal dependencies 24102 */ 24103 24104 24105 24106 24107 function useFallbackTemplateContent(slug, isCustom = false) { 24108 return (0,external_wp_data_namespaceObject.useSelect)(select => { 24109 const { 24110 getEntityRecord, 24111 getDefaultTemplateId 24112 } = select(external_wp_coreData_namespaceObject.store); 24113 const templateId = getDefaultTemplateId({ 24114 slug, 24115 is_custom: isCustom, 24116 ignore_empty: true 24117 }); 24118 return templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined; 24119 }, [slug, isCustom]); 24120 } 24121 function start_template_options_useStartPatterns(fallbackContent) { 24122 const { 24123 slug, 24124 patterns 24125 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24126 const { 24127 getCurrentPostType, 24128 getCurrentPostId 24129 } = select(store_store); 24130 const { 24131 getEntityRecord, 24132 getBlockPatterns 24133 } = select(external_wp_coreData_namespaceObject.store); 24134 const postId = getCurrentPostId(); 24135 const postType = getCurrentPostType(); 24136 const record = getEntityRecord('postType', postType, postId); 24137 return { 24138 slug: record.slug, 24139 patterns: getBlockPatterns() 24140 }; 24141 }, []); 24142 const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet); 24143 24144 // Duplicated from packages/block-library/src/pattern/edit.js. 24145 function injectThemeAttributeInBlockTemplateContent(block) { 24146 if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) { 24147 block.innerBlocks = block.innerBlocks.map(innerBlock => { 24148 if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) { 24149 innerBlock.attributes.theme = currentThemeStylesheet; 24150 } 24151 return innerBlock; 24152 }); 24153 } 24154 if (block.name === 'core/template-part' && block.attributes.theme === undefined) { 24155 block.attributes.theme = currentThemeStylesheet; 24156 } 24157 return block; 24158 } 24159 return (0,external_wp_element_namespaceObject.useMemo)(() => { 24160 // filter patterns that are supposed to be used in the current template being edited. 24161 return [{ 24162 name: 'fallback', 24163 blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent), 24164 title: (0,external_wp_i18n_namespaceObject.__)('Fallback content') 24165 }, ...patterns.filter(pattern => { 24166 return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType)); 24167 }).map(pattern => { 24168 return { 24169 ...pattern, 24170 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map(block => injectThemeAttributeInBlockTemplateContent(block)) 24171 }; 24172 })]; 24173 }, [fallbackContent, slug, patterns]); 24174 } 24175 function start_template_options_PatternSelection({ 24176 fallbackContent, 24177 onChoosePattern, 24178 postType 24179 }) { 24180 const [,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType); 24181 const blockPatterns = start_template_options_useStartPatterns(fallbackContent); 24182 const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns); 24183 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 24184 blockPatterns: blockPatterns, 24185 shownPatterns: shownBlockPatterns, 24186 onClickPattern: (pattern, blocks) => { 24187 onChange(blocks, { 24188 selection: undefined 24189 }); 24190 onChoosePattern(); 24191 } 24192 }); 24193 } 24194 function StartModal({ 24195 slug, 24196 isCustom, 24197 onClose, 24198 postType 24199 }) { 24200 const fallbackContent = useFallbackTemplateContent(slug, isCustom); 24201 if (!fallbackContent) { 24202 return null; 24203 } 24204 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { 24205 className: "editor-start-template-options__modal", 24206 title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), 24207 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'), 24208 focusOnMount: "firstElement", 24209 onRequestClose: onClose, 24210 isFullScreen: true, 24211 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 24212 className: "editor-start-template-options__modal-content", 24213 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(start_template_options_PatternSelection, { 24214 fallbackContent: fallbackContent, 24215 slug: slug, 24216 isCustom: isCustom, 24217 postType: postType, 24218 onChoosePattern: () => { 24219 onClose(); 24220 } 24221 }) 24222 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { 24223 className: "editor-start-template-options__modal__actions", 24224 justify: "flex-end", 24225 expanded: false, 24226 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { 24227 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 24228 __next40pxDefaultSize: true, 24229 variant: "tertiary", 24230 onClick: onClose, 24231 children: (0,external_wp_i18n_namespaceObject.__)('Skip') 24232 }) 24233 }) 24234 })] 24235 }); 24236 } 24237 function StartTemplateOptions() { 24238 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 24239 const { 24240 shouldOpenModal, 24241 slug, 24242 isCustom, 24243 postType, 24244 postId 24245 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24246 const { 24247 getCurrentPostType, 24248 getCurrentPostId 24249 } = select(store_store); 24250 const _postType = getCurrentPostType(); 24251 const _postId = getCurrentPostId(); 24252 const { 24253 getEditedEntityRecord, 24254 hasEditsForEntityRecord 24255 } = select(external_wp_coreData_namespaceObject.store); 24256 const templateRecord = getEditedEntityRecord('postType', _postType, _postId); 24257 const hasEdits = hasEditsForEntityRecord('postType', _postType, _postId); 24258 return { 24259 shouldOpenModal: !hasEdits && '' === templateRecord.content && TEMPLATE_POST_TYPE === _postType, 24260 slug: templateRecord.slug, 24261 isCustom: templateRecord.is_custom, 24262 postType: _postType, 24263 postId: _postId 24264 }; 24265 }, []); 24266 (0,external_wp_element_namespaceObject.useEffect)(() => { 24267 // Should reset the modal state when navigating to a new page/post. 24268 setIsClosed(false); 24269 }, [postType, postId]); 24270 if (!shouldOpenModal || isClosed) { 24271 return null; 24272 } 24273 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StartModal, { 24274 slug: slug, 24275 isCustom: isCustom, 24276 postType: postType, 24277 onClose: () => setIsClosed(true) 24278 }); 24279 } 24280 24281 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-regular.js 24282 /** 24283 * WordPress dependencies 24284 */ 24285 24286 24287 24288 24289 24290 function ConvertToRegularBlocks({ 24291 clientId, 24292 onClose 24293 }) { 24294 const { 24295 getBlocks 24296 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 24297 const { 24298 replaceBlocks 24299 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24300 const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]); 24301 if (!canRemove) { 24302 return null; 24303 } 24304 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24305 onClick: () => { 24306 replaceBlocks(clientId, getBlocks(clientId)); 24307 onClose(); 24308 }, 24309 children: (0,external_wp_i18n_namespaceObject.__)('Detach') 24310 }); 24311 } 24312 24313 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-template-part.js 24314 /** 24315 * WordPress dependencies 24316 */ 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 /** 24327 * Internal dependencies 24328 */ 24329 24330 24331 24332 24333 function ConvertToTemplatePart({ 24334 clientIds, 24335 blocks 24336 }) { 24337 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 24338 const { 24339 replaceBlocks 24340 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 24341 const { 24342 createSuccessNotice 24343 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24344 const { 24345 canCreate 24346 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24347 return { 24348 canCreate: select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType('core/template-part') 24349 }; 24350 }, []); 24351 if (!canCreate) { 24352 return null; 24353 } 24354 const onConvert = async templatePart => { 24355 replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', { 24356 slug: templatePart.slug, 24357 theme: templatePart.theme 24358 })); 24359 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), { 24360 type: 'snackbar' 24361 }); 24362 24363 // The modal and this component will be unmounted because of `replaceBlocks` above, 24364 // so no need to call `closeModal` or `onClose`. 24365 }; 24366 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24367 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 24368 icon: symbol_filled, 24369 onClick: () => { 24370 setIsModalOpen(true); 24371 }, 24372 "aria-expanded": isModalOpen, 24373 "aria-haspopup": "dialog", 24374 children: (0,external_wp_i18n_namespaceObject.__)('Create template part') 24375 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModal, { 24376 closeModal: () => { 24377 setIsModalOpen(false); 24378 }, 24379 blocks: blocks, 24380 onCreate: onConvert 24381 })] 24382 }); 24383 } 24384 24385 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/index.js 24386 /** 24387 * WordPress dependencies 24388 */ 24389 24390 24391 24392 /** 24393 * Internal dependencies 24394 */ 24395 24396 24397 24398 function TemplatePartMenuItems() { 24399 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { 24400 children: ({ 24401 selectedClientIds, 24402 onClose 24403 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartConverterMenuItem, { 24404 clientIds: selectedClientIds, 24405 onClose: onClose 24406 }) 24407 }); 24408 } 24409 function TemplatePartConverterMenuItem({ 24410 clientIds, 24411 onClose 24412 }) { 24413 const { 24414 isContentOnly, 24415 blocks 24416 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24417 const { 24418 getBlocksByClientId, 24419 getBlockEditingMode 24420 } = select(external_wp_blockEditor_namespaceObject.store); 24421 return { 24422 blocks: getBlocksByClientId(clientIds), 24423 isContentOnly: clientIds.length === 1 && getBlockEditingMode(clientIds[0]) === 'contentOnly' 24424 }; 24425 }, [clientIds]); 24426 24427 // Do not show the convert button if the block is in content-only mode. 24428 if (isContentOnly) { 24429 return null; 24430 } 24431 24432 // Allow converting a single template part to standard blocks. 24433 if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') { 24434 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToRegularBlocks, { 24435 clientId: clientIds[0], 24436 onClose: onClose 24437 }); 24438 } 24439 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, { 24440 clientIds: clientIds, 24441 blocks: blocks 24442 }); 24443 } 24444 24445 ;// ./node_modules/@wordpress/editor/build-module/components/provider/index.js 24446 /** 24447 * WordPress dependencies 24448 */ 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 /** 24459 * Internal dependencies 24460 */ 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 const { 24482 ExperimentalBlockEditorProvider 24483 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 24484 const { 24485 PatternsMenuItems 24486 } = unlock(external_wp_patterns_namespaceObject.privateApis); 24487 const provider_noop = () => {}; 24488 24489 /** 24490 * These are global entities that are only there to split blocks into logical units 24491 * They don't provide a "context" for the current post/page being rendered. 24492 * So we should not use their ids as post context. This is important to allow post blocks 24493 * (post content, post title) to be used within them without issues. 24494 */ 24495 const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_navigation', 'wp_template_part']; 24496 24497 /** 24498 * Depending on the post, template and template mode, 24499 * returns the appropriate blocks and change handlers for the block editor provider. 24500 * 24501 * @param {Array} post Block list. 24502 * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`. 24503 * @param {string} mode Rendering mode. 24504 * 24505 * @example 24506 * ```jsx 24507 * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode ); 24508 * ``` 24509 * 24510 * @return {Array} Block editor props. 24511 */ 24512 function useBlockEditorProps(post, template, mode) { 24513 const rootLevelPost = mode === 'post-only' || !template ? 'post' : 'template'; 24514 const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', post.type, { 24515 id: post.id 24516 }); 24517 const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', template?.type, { 24518 id: template?.id 24519 }); 24520 const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 24521 if (post.type === 'wp_navigation') { 24522 return [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation', { 24523 ref: post.id, 24524 // As the parent editor is locked with `templateLock`, the template locking 24525 // must be explicitly "unset" on the block itself to allow the user to modify 24526 // the block's content. 24527 templateLock: false 24528 })]; 24529 } 24530 }, [post.type, post.id]); 24531 24532 // It is important that we don't create a new instance of blocks on every change 24533 // We should only create a new instance if the blocks them selves change, not a dependency of them. 24534 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 24535 if (maybeNavigationBlocks) { 24536 return maybeNavigationBlocks; 24537 } 24538 if (rootLevelPost === 'template') { 24539 return templateBlocks; 24540 } 24541 return postBlocks; 24542 }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]); 24543 24544 // Handle fallback to postBlocks outside of the above useMemo, to ensure 24545 // that constructed block templates that call `createBlock` are not generated 24546 // too frequently. This ensures that clientIds are stable. 24547 const disableRootLevelChanges = !!template && mode === 'template-locked' || post.type === 'wp_navigation'; 24548 if (disableRootLevelChanges) { 24549 return [blocks, provider_noop, provider_noop]; 24550 } 24551 return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate]; 24552 } 24553 24554 /** 24555 * This component provides the editor context and manages the state of the block editor. 24556 * 24557 * @param {Object} props The component props. 24558 * @param {Object} props.post The post object. 24559 * @param {Object} props.settings The editor settings. 24560 * @param {boolean} props.recovery Indicates if the editor is in recovery mode. 24561 * @param {Array} props.initialEdits The initial edits for the editor. 24562 * @param {Object} props.children The child components. 24563 * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider. 24564 * @param {Object} [props.__unstableTemplate] The template object. 24565 * 24566 * @example 24567 * ```jsx 24568 * <ExperimentalEditorProvider 24569 * post={ post } 24570 * settings={ settings } 24571 * recovery={ recovery } 24572 * initialEdits={ initialEdits } 24573 * __unstableTemplate={ template } 24574 * > 24575 * { children } 24576 * </ExperimentalEditorProvider> 24577 * 24578 * @return {Object} The rendered ExperimentalEditorProvider component. 24579 */ 24580 const ExperimentalEditorProvider = with_registry_provider(({ 24581 post, 24582 settings, 24583 recovery, 24584 initialEdits, 24585 children, 24586 BlockEditorProviderComponent = ExperimentalBlockEditorProvider, 24587 __unstableTemplate: template 24588 }) => { 24589 const { 24590 editorSettings, 24591 selection, 24592 isReady, 24593 mode, 24594 postTypeEntities 24595 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 24596 const { 24597 getEditorSettings, 24598 getEditorSelection, 24599 getRenderingMode, 24600 __unstableIsEditorReady 24601 } = select(store_store); 24602 const { 24603 getEntitiesConfig 24604 } = select(external_wp_coreData_namespaceObject.store); 24605 return { 24606 editorSettings: getEditorSettings(), 24607 isReady: __unstableIsEditorReady(), 24608 mode: getRenderingMode(), 24609 selection: getEditorSelection(), 24610 postTypeEntities: post.type === 'wp_template' ? getEntitiesConfig('postType') : null 24611 }; 24612 }, [post.type]); 24613 const isZoomOut = (0,external_wp_data_namespaceObject.useSelect)(select => { 24614 const { 24615 __unstableGetEditorMode 24616 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 24617 return __unstableGetEditorMode() === 'zoom-out'; 24618 }); 24619 const shouldRenderTemplate = !!template && mode !== 'post-only'; 24620 const rootLevelPost = shouldRenderTemplate ? template : post; 24621 const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { 24622 const postContext = {}; 24623 // If it is a template, try to inherit the post type from the name. 24624 if (post.type === 'wp_template') { 24625 if (post.slug === 'page') { 24626 postContext.postType = 'page'; 24627 } else if (post.slug === 'single') { 24628 postContext.postType = 'post'; 24629 } else if (post.slug.split('-')[0] === 'single') { 24630 // If the slug is single-{postType}, infer the post type from the name. 24631 const postTypeNames = postTypeEntities?.map(entity => entity.name) || []; 24632 const match = post.slug.match(`^single-($postTypeNames.join('|')})(?:-.+)?$`); 24633 if (match) { 24634 postContext.postType = match[1]; 24635 } 24636 } 24637 } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) { 24638 postContext.postId = post.id; 24639 postContext.postType = post.type; 24640 } 24641 return { 24642 ...postContext, 24643 templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined 24644 }; 24645 }, [shouldRenderTemplate, post.id, post.type, post.slug, rootLevelPost.type, rootLevelPost.slug, postTypeEntities]); 24646 const { 24647 id, 24648 type 24649 } = rootLevelPost; 24650 const blockEditorSettings = use_block_editor_settings(editorSettings, type, id, mode); 24651 const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode); 24652 const { 24653 updatePostLock, 24654 setupEditor, 24655 updateEditorSettings, 24656 setCurrentTemplateId, 24657 setEditedPost, 24658 setRenderingMode 24659 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 24660 const { 24661 createWarningNotice 24662 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24663 24664 // Ideally this should be synced on each change and not just something you do once. 24665 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 24666 // Assume that we don't need to initialize in the case of an error recovery. 24667 if (recovery) { 24668 return; 24669 } 24670 updatePostLock(settings.postLock); 24671 setupEditor(post, initialEdits, settings.template); 24672 if (settings.autosave) { 24673 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), { 24674 id: 'autosave-exists', 24675 actions: [{ 24676 label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'), 24677 url: settings.autosave.editLink 24678 }] 24679 }); 24680 } 24681 }, []); 24682 24683 // Synchronizes the active post with the state 24684 (0,external_wp_element_namespaceObject.useEffect)(() => { 24685 setEditedPost(post.type, post.id); 24686 }, [post.type, post.id, setEditedPost]); 24687 24688 // Synchronize the editor settings as they change. 24689 (0,external_wp_element_namespaceObject.useEffect)(() => { 24690 updateEditorSettings(settings); 24691 }, [settings, updateEditorSettings]); 24692 24693 // Synchronizes the active template with the state. 24694 (0,external_wp_element_namespaceObject.useEffect)(() => { 24695 setCurrentTemplateId(template?.id); 24696 }, [template?.id, setCurrentTemplateId]); 24697 24698 // Sets the right rendering mode when loading the editor. 24699 (0,external_wp_element_namespaceObject.useEffect)(() => { 24700 var _settings$defaultRend; 24701 setRenderingMode((_settings$defaultRend = settings.defaultRenderingMode) !== null && _settings$defaultRend !== void 0 ? _settings$defaultRend : 'post-only'); 24702 }, [settings.defaultRenderingMode, setRenderingMode]); 24703 useHideBlocksFromInserter(post.type, mode); 24704 24705 // Register the editor commands. 24706 useCommands(); 24707 if (!isReady) { 24708 return null; 24709 } 24710 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { 24711 kind: "root", 24712 type: "site", 24713 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { 24714 kind: "postType", 24715 type: post.type, 24716 id: post.id, 24717 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { 24718 value: defaultBlockContext, 24719 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockEditorProviderComponent, { 24720 value: blocks, 24721 onChange: onChange, 24722 onInput: onInput, 24723 selection: selection, 24724 settings: blockEditorSettings, 24725 useSubRegistry: false, 24726 children: [children, !settings.__unstableIsPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24727 children: [!isZoomOut && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 24728 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartMenuItems, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {})] 24729 }), 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, {})] 24730 })] 24731 }) 24732 }) 24733 }) 24734 }); 24735 }); 24736 24737 /** 24738 * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor). 24739 * 24740 * It supports a large number of post types, including post, page, templates, 24741 * custom post types, patterns, template parts. 24742 * 24743 * All modification and changes are performed to the `@wordpress/core-data` store. 24744 * 24745 * @param {Object} props The component props. 24746 * @param {Object} [props.post] The post object to edit. This is required. 24747 * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post. 24748 * This is optional and can only be used when the post type supports templates (like posts and pages). 24749 * @param {Object} [props.settings] The settings object to use for the editor. 24750 * This is optional and can be used to override the default settings. 24751 * @param {Element} [props.children] Children elements for which the BlockEditorProvider context should apply. 24752 * This is optional. 24753 * 24754 * @example 24755 * ```jsx 24756 * <EditorProvider 24757 * post={ post } 24758 * settings={ settings } 24759 * __unstableTemplate={ template } 24760 * > 24761 * { children } 24762 * </EditorProvider> 24763 * ``` 24764 * 24765 * @return {JSX.Element} The rendered EditorProvider component. 24766 */ 24767 function EditorProvider(props) { 24768 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalEditorProvider, { 24769 ...props, 24770 BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider, 24771 children: props.children 24772 }); 24773 } 24774 /* harmony default export */ const provider = (EditorProvider); 24775 24776 ;// external ["wp","serverSideRender"] 24777 const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; 24778 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); 24779 ;// ./node_modules/@wordpress/editor/build-module/components/deprecated.js 24780 // Block Creation Components. 24781 /** 24782 * WordPress dependencies 24783 */ 24784 24785 24786 24787 24788 24789 function deprecateComponent(name, Wrapped, staticsToHoist = []) { 24790 const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 24791 external_wp_deprecated_default()('wp.editor.' + name, { 24792 since: '5.3', 24793 alternative: 'wp.blockEditor.' + name, 24794 version: '6.2' 24795 }); 24796 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, { 24797 ref: ref, 24798 ...props 24799 }); 24800 }); 24801 staticsToHoist.forEach(staticName => { 24802 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); 24803 }); 24804 return Component; 24805 } 24806 function deprecateFunction(name, func) { 24807 return (...args) => { 24808 external_wp_deprecated_default()('wp.editor.' + name, { 24809 since: '5.3', 24810 alternative: 'wp.blockEditor.' + name, 24811 version: '6.2' 24812 }); 24813 return func(...args); 24814 }; 24815 } 24816 24817 /** 24818 * @deprecated since 5.3, use `wp.blockEditor.RichText` instead. 24819 */ 24820 const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']); 24821 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty); 24822 24823 24824 /** 24825 * @deprecated since 5.3, use `wp.blockEditor.Autocomplete` instead. 24826 */ 24827 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete); 24828 /** 24829 * @deprecated since 5.3, use `wp.blockEditor.AlignmentToolbar` instead. 24830 */ 24831 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar); 24832 /** 24833 * @deprecated since 5.3, use `wp.blockEditor.BlockAlignmentToolbar` instead. 24834 */ 24835 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar); 24836 /** 24837 * @deprecated since 5.3, use `wp.blockEditor.BlockControls` instead. 24838 */ 24839 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']); 24840 /** 24841 * @deprecated since 5.3, use `wp.blockEditor.BlockEdit` instead. 24842 */ 24843 const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit); 24844 /** 24845 * @deprecated since 5.3, use `wp.blockEditor.BlockEditorKeyboardShortcuts` instead. 24846 */ 24847 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts); 24848 /** 24849 * @deprecated since 5.3, use `wp.blockEditor.BlockFormatControls` instead. 24850 */ 24851 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']); 24852 /** 24853 * @deprecated since 5.3, use `wp.blockEditor.BlockIcon` instead. 24854 */ 24855 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon); 24856 /** 24857 * @deprecated since 5.3, use `wp.blockEditor.BlockInspector` instead. 24858 */ 24859 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector); 24860 /** 24861 * @deprecated since 5.3, use `wp.blockEditor.BlockList` instead. 24862 */ 24863 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList); 24864 /** 24865 * @deprecated since 5.3, use `wp.blockEditor.BlockMover` instead. 24866 */ 24867 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover); 24868 /** 24869 * @deprecated since 5.3, use `wp.blockEditor.BlockNavigationDropdown` instead. 24870 */ 24871 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown); 24872 /** 24873 * @deprecated since 5.3, use `wp.blockEditor.BlockSelectionClearer` instead. 24874 */ 24875 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer); 24876 /** 24877 * @deprecated since 5.3, use `wp.blockEditor.BlockSettingsMenu` instead. 24878 */ 24879 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu); 24880 /** 24881 * @deprecated since 5.3, use `wp.blockEditor.BlockTitle` instead. 24882 */ 24883 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle); 24884 /** 24885 * @deprecated since 5.3, use `wp.blockEditor.BlockToolbar` instead. 24886 */ 24887 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar); 24888 /** 24889 * @deprecated since 5.3, use `wp.blockEditor.ColorPalette` instead. 24890 */ 24891 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette); 24892 /** 24893 * @deprecated since 5.3, use `wp.blockEditor.ContrastChecker` instead. 24894 */ 24895 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker); 24896 /** 24897 * @deprecated since 5.3, use `wp.blockEditor.CopyHandler` instead. 24898 */ 24899 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler); 24900 /** 24901 * @deprecated since 5.3, use `wp.blockEditor.DefaultBlockAppender` instead. 24902 */ 24903 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender); 24904 /** 24905 * @deprecated since 5.3, use `wp.blockEditor.FontSizePicker` instead. 24906 */ 24907 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker); 24908 /** 24909 * @deprecated since 5.3, use `wp.blockEditor.Inserter` instead. 24910 */ 24911 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter); 24912 /** 24913 * @deprecated since 5.3, use `wp.blockEditor.InnerBlocks` instead. 24914 */ 24915 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); 24916 /** 24917 * @deprecated since 5.3, use `wp.blockEditor.InspectorAdvancedControls` instead. 24918 */ 24919 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']); 24920 /** 24921 * @deprecated since 5.3, use `wp.blockEditor.InspectorControls` instead. 24922 */ 24923 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']); 24924 /** 24925 * @deprecated since 5.3, use `wp.blockEditor.PanelColorSettings` instead. 24926 */ 24927 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings); 24928 /** 24929 * @deprecated since 5.3, use `wp.blockEditor.PlainText` instead. 24930 */ 24931 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText); 24932 /** 24933 * @deprecated since 5.3, use `wp.blockEditor.RichTextShortcut` instead. 24934 */ 24935 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut); 24936 /** 24937 * @deprecated since 5.3, use `wp.blockEditor.RichTextToolbarButton` instead. 24938 */ 24939 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton); 24940 /** 24941 * @deprecated since 5.3, use `wp.blockEditor.__unstableRichTextInputEvent` instead. 24942 */ 24943 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent); 24944 /** 24945 * @deprecated since 5.3, use `wp.blockEditor.MediaPlaceholder` instead. 24946 */ 24947 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder); 24948 /** 24949 * @deprecated since 5.3, use `wp.blockEditor.MediaUpload` instead. 24950 */ 24951 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload); 24952 /** 24953 * @deprecated since 5.3, use `wp.blockEditor.MediaUploadCheck` instead. 24954 */ 24955 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck); 24956 /** 24957 * @deprecated since 5.3, use `wp.blockEditor.MultiSelectScrollIntoView` instead. 24958 */ 24959 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView); 24960 /** 24961 * @deprecated since 5.3, use `wp.blockEditor.NavigableToolbar` instead. 24962 */ 24963 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar); 24964 /** 24965 * @deprecated since 5.3, use `wp.blockEditor.ObserveTyping` instead. 24966 */ 24967 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping); 24968 /** 24969 * @deprecated since 5.3, use `wp.blockEditor.SkipToSelectedBlock` instead. 24970 */ 24971 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock); 24972 /** 24973 * @deprecated since 5.3, use `wp.blockEditor.URLInput` instead. 24974 */ 24975 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput); 24976 /** 24977 * @deprecated since 5.3, use `wp.blockEditor.URLInputButton` instead. 24978 */ 24979 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton); 24980 /** 24981 * @deprecated since 5.3, use `wp.blockEditor.URLPopover` instead. 24982 */ 24983 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover); 24984 /** 24985 * @deprecated since 5.3, use `wp.blockEditor.Warning` instead. 24986 */ 24987 const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning); 24988 /** 24989 * @deprecated since 5.3, use `wp.blockEditor.WritingFlow` instead. 24990 */ 24991 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow); 24992 24993 /** 24994 * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. 24995 */ 24996 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC); 24997 /** 24998 * @deprecated since 5.3, use `wp.blockEditor.getColorClassName` instead. 24999 */ 25000 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName); 25001 /** 25002 * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByAttributeValues` instead. 25003 */ 25004 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues); 25005 /** 25006 * @deprecated since 5.3, use `wp.blockEditor.getColorObjectByColorValue` instead. 25007 */ 25008 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue); 25009 /** 25010 * @deprecated since 5.3, use `wp.blockEditor.getFontSize` instead. 25011 */ 25012 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize); 25013 /** 25014 * @deprecated since 5.3, use `wp.blockEditor.getFontSizeClass` instead. 25015 */ 25016 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass); 25017 /** 25018 * @deprecated since 5.3, use `wp.blockEditor.createCustomColorsHOC` instead. 25019 */ 25020 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext); 25021 /** 25022 * @deprecated since 5.3, use `wp.blockEditor.withColors` instead. 25023 */ 25024 const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors); 25025 /** 25026 * @deprecated since 5.3, use `wp.blockEditor.withFontSizes` instead. 25027 */ 25028 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes); 25029 25030 ;// ./node_modules/@wordpress/editor/build-module/components/index.js 25031 /** 25032 * Internal dependencies 25033 */ 25034 25035 25036 // Block Creation Components. 25037 25038 25039 // Post Related Components. 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 // State Related Components. 25130 25131 25132 25133 /** 25134 * Handles the keyboard shortcuts for the editor. 25135 * 25136 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 25137 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 25138 * and toggling the sidebar. 25139 */ 25140 const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 25141 25142 /** 25143 * Handles the keyboard shortcuts for the editor. 25144 * 25145 * It provides functionality for various keyboard shortcuts such as toggling editor mode, 25146 * toggling distraction-free mode, undo/redo, saving the post, toggling list view, 25147 * and toggling the sidebar. 25148 */ 25149 const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 25150 25151 ;// ./node_modules/@wordpress/editor/build-module/utils/url.js 25152 /** 25153 * WordPress dependencies 25154 */ 25155 25156 25157 25158 /** 25159 * Performs some basic cleanup of a string for use as a post slug 25160 * 25161 * This replicates some of what sanitize_title() does in WordPress core, but 25162 * is only designed to approximate what the slug will be. 25163 * 25164 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. 25165 * Removes combining diacritical marks. Converts whitespace, periods, 25166 * and forward slashes to hyphens. Removes any remaining non-word characters 25167 * except hyphens and underscores. Converts remaining string to lowercase. 25168 * It does not account for octets, HTML entities, or other encoded characters. 25169 * 25170 * @param {string} string Title or slug to be processed 25171 * 25172 * @return {string} Processed string 25173 */ 25174 function cleanForSlug(string) { 25175 external_wp_deprecated_default()('wp.editor.cleanForSlug', { 25176 since: '12.7', 25177 plugin: 'Gutenberg', 25178 alternative: 'wp.url.cleanForSlug' 25179 }); 25180 return (0,external_wp_url_namespaceObject.cleanForSlug)(string); 25181 } 25182 25183 ;// ./node_modules/@wordpress/editor/build-module/utils/index.js 25184 /** 25185 * Internal dependencies 25186 */ 25187 25188 25189 25190 25191 25192 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js 25193 /** 25194 * WordPress dependencies 25195 */ 25196 25197 25198 /** 25199 * Internal dependencies 25200 */ 25201 25202 const { 25203 createPrivateSlotFill 25204 } = unlock(external_wp_components_namespaceObject.privateApis); 25205 const SLOT_FILL_NAME = 'EditCanvasContainerSlot'; 25206 const EditorContentSlotFill = createPrivateSlotFill(SLOT_FILL_NAME); 25207 /* harmony default export */ const content_slot_fill = (EditorContentSlotFill); 25208 25209 ;// ./node_modules/@wordpress/editor/build-module/components/header/back-button.js 25210 /** 25211 * WordPress dependencies 25212 */ 25213 25214 25215 // Keeping an old name for backward compatibility. 25216 25217 const slotName = '__experimentalMainDashboardButton'; 25218 const useHasBackButton = () => { 25219 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 25220 return Boolean(fills && fills.length); 25221 }; 25222 const { 25223 Fill: back_button_Fill, 25224 Slot: back_button_Slot 25225 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); 25226 const BackButton = back_button_Fill; 25227 const BackButtonSlot = () => { 25228 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 25229 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_Slot, { 25230 bubblesVirtually: true, 25231 fillProps: { 25232 length: !fills ? 0 : fills.length 25233 } 25234 }); 25235 }; 25236 BackButton.Slot = BackButtonSlot; 25237 /* harmony default export */ const back_button = (BackButton); 25238 25239 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 25240 /** 25241 * WordPress dependencies 25242 */ 25243 25244 25245 const next = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25246 xmlns: "http://www.w3.org/2000/svg", 25247 viewBox: "0 0 24 24", 25248 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25249 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" 25250 }) 25251 }); 25252 /* harmony default export */ const library_next = (next); 25253 25254 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 25255 /** 25256 * WordPress dependencies 25257 */ 25258 25259 25260 const previous = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25261 xmlns: "http://www.w3.org/2000/svg", 25262 viewBox: "0 0 24 24", 25263 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25264 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" 25265 }) 25266 }); 25267 /* harmony default export */ const library_previous = (previous); 25268 25269 ;// ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js 25270 /** 25271 * External dependencies 25272 */ 25273 25274 25275 /** 25276 * WordPress dependencies 25277 */ 25278 25279 25280 25281 25282 25283 25284 25285 /** 25286 * Internal dependencies 25287 */ 25288 25289 25290 25291 25292 const { 25293 useHasBlockToolbar 25294 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 25295 function CollapsibleBlockToolbar({ 25296 isCollapsed, 25297 onToggle 25298 }) { 25299 const { 25300 blockSelectionStart 25301 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25302 return { 25303 blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 25304 }; 25305 }, []); 25306 const hasBlockToolbar = useHasBlockToolbar(); 25307 const hasBlockSelection = !!blockSelectionStart; 25308 (0,external_wp_element_namespaceObject.useEffect)(() => { 25309 // If we have a new block selection, show the block tools 25310 if (blockSelectionStart) { 25311 onToggle(false); 25312 } 25313 }, [blockSelectionStart, onToggle]); 25314 if (!hasBlockToolbar) { 25315 return null; 25316 } 25317 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25318 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 25319 className: dist_clsx('editor-collapsible-block-toolbar', { 25320 'is-collapsed': isCollapsed || !hasBlockSelection 25321 }), 25322 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 25323 hideDragHandle: true 25324 }) 25325 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { 25326 name: "block-toolbar" 25327 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25328 className: "editor-collapsible-block-toolbar__toggle", 25329 icon: isCollapsed ? library_next : library_previous, 25330 onClick: () => { 25331 onToggle(!isCollapsed); 25332 }, 25333 label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools'), 25334 size: "compact" 25335 })] 25336 }); 25337 } 25338 25339 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 25340 /** 25341 * WordPress dependencies 25342 */ 25343 25344 25345 const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25346 xmlns: "http://www.w3.org/2000/svg", 25347 viewBox: "0 0 24 24", 25348 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25349 d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" 25350 }) 25351 }); 25352 /* harmony default export */ const library_plus = (plus); 25353 25354 ;// ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js 25355 /** 25356 * External dependencies 25357 */ 25358 25359 25360 /** 25361 * WordPress dependencies 25362 */ 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 /** 25374 * Internal dependencies 25375 */ 25376 25377 25378 25379 25380 25381 25382 25383 function DocumentTools({ 25384 className, 25385 disableBlockTools = false 25386 }) { 25387 const { 25388 setIsInserterOpened, 25389 setIsListViewOpened 25390 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25391 const { 25392 isDistractionFree, 25393 isInserterOpened, 25394 isListViewOpen, 25395 listViewShortcut, 25396 inserterSidebarToggleRef, 25397 listViewToggleRef, 25398 hasFixedToolbar, 25399 showIconLabels 25400 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25401 const { 25402 getSettings 25403 } = select(external_wp_blockEditor_namespaceObject.store); 25404 const { 25405 get 25406 } = select(external_wp_preferences_namespaceObject.store); 25407 const { 25408 isListViewOpened, 25409 getEditorMode, 25410 getInserterSidebarToggleRef, 25411 getListViewToggleRef 25412 } = unlock(select(store_store)); 25413 const { 25414 getShortcutRepresentation 25415 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 25416 const { 25417 __unstableGetEditorMode 25418 } = select(external_wp_blockEditor_namespaceObject.store); 25419 return { 25420 isInserterOpened: select(store_store).isInserterOpened(), 25421 isListViewOpen: isListViewOpened(), 25422 listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'), 25423 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 25424 listViewToggleRef: getListViewToggleRef(), 25425 hasFixedToolbar: getSettings().hasFixedToolbar, 25426 showIconLabels: get('core', 'showIconLabels'), 25427 isDistractionFree: get('core', 'distractionFree'), 25428 isVisualMode: getEditorMode() === 'visual', 25429 isZoomedOutView: __unstableGetEditorMode() === 'zoom-out' 25430 }; 25431 }, []); 25432 const preventDefault = event => { 25433 // Because the inserter behaves like a dialog, 25434 // if the inserter is opened already then when we click on the toggle button 25435 // then the initial click event will close the inserter and then be propagated 25436 // to the inserter toggle and it will open it again. 25437 // To prevent this we need to stop the propagation of the event. 25438 // This won't be necessary when the inserter no longer behaves like a dialog. 25439 25440 if (isInserterOpened) { 25441 event.preventDefault(); 25442 } 25443 }; 25444 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 25445 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide'); 25446 25447 /* translators: accessibility text for the editor toolbar */ 25448 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools'); 25449 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); 25450 const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpened), [isInserterOpened, setIsInserterOpened]); 25451 25452 /* translators: button label text should, if possible, be under 16 characters. */ 25453 const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'); 25454 const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'); 25455 return ( 25456 /*#__PURE__*/ 25457 // Some plugins expect and use the `edit-post-header-toolbar` CSS class to 25458 // find the toolbar and inject UI elements into it. This is not officially 25459 // supported, but we're keeping it in the list of class names for backwards 25460 // compatibility. 25461 (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { 25462 className: dist_clsx('editor-document-tools', 'edit-post-header-toolbar', className), 25463 "aria-label": toolbarAriaLabel, 25464 variant: "unstyled", 25465 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 25466 className: "editor-document-tools__left", 25467 children: [!isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 25468 ref: inserterSidebarToggleRef, 25469 as: external_wp_components_namespaceObject.Button, 25470 className: "editor-document-tools__inserter-toggle", 25471 variant: "primary", 25472 isPressed: isInserterOpened, 25473 onMouseDown: preventDefault, 25474 onClick: toggleInserter, 25475 disabled: disableBlockTools, 25476 icon: library_plus, 25477 label: showIconLabels ? shortLabel : longLabel, 25478 showTooltip: !showIconLabels, 25479 "aria-expanded": isInserterOpened 25480 }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25481 children: [isLargeViewport && !hasFixedToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 25482 as: external_wp_blockEditor_namespaceObject.ToolSelector, 25483 showTooltip: !showIconLabels, 25484 variant: showIconLabels ? 'tertiary' : undefined, 25485 disabled: disableBlockTools, 25486 size: "compact" 25487 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 25488 as: editor_history_undo, 25489 showTooltip: !showIconLabels, 25490 variant: showIconLabels ? 'tertiary' : undefined, 25491 size: "compact" 25492 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 25493 as: editor_history_redo, 25494 showTooltip: !showIconLabels, 25495 variant: showIconLabels ? 'tertiary' : undefined, 25496 size: "compact" 25497 }), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { 25498 as: external_wp_components_namespaceObject.Button, 25499 className: "editor-document-tools__document-overview-toggle", 25500 icon: list_view, 25501 disabled: disableBlockTools, 25502 isPressed: isListViewOpen 25503 /* translators: button label text should, if possible, be under 16 characters. */, 25504 label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'), 25505 onClick: toggleListView, 25506 shortcut: listViewShortcut, 25507 showTooltip: !showIconLabels, 25508 variant: showIconLabels ? 'tertiary' : undefined, 25509 "aria-expanded": isListViewOpen, 25510 ref: listViewToggleRef, 25511 size: "compact" 25512 })] 25513 })] 25514 }) 25515 }) 25516 ); 25517 } 25518 /* harmony default export */ const document_tools = (DocumentTools); 25519 25520 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 25521 /** 25522 * WordPress dependencies 25523 */ 25524 25525 25526 const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25527 xmlns: "http://www.w3.org/2000/svg", 25528 viewBox: "0 0 24 24", 25529 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25530 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 25531 }) 25532 }); 25533 /* harmony default export */ const more_vertical = (moreVertical); 25534 25535 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js 25536 /** 25537 * WordPress dependencies 25538 */ 25539 25540 25541 25542 25543 25544 25545 25546 25547 /** 25548 * Internal dependencies 25549 */ 25550 25551 25552 function CopyContentMenuItem() { 25553 const { 25554 createNotice 25555 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 25556 const { 25557 getCurrentPostId, 25558 getCurrentPostType 25559 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 25560 const { 25561 getEditedEntityRecord 25562 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 25563 function getText() { 25564 const record = getEditedEntityRecord('postType', getCurrentPostType(), getCurrentPostId()); 25565 if (!record) { 25566 return ''; 25567 } 25568 if (typeof record.content === 'function') { 25569 return record.content(record); 25570 } else if (record.blocks) { 25571 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 25572 } else if (record.content) { 25573 return record.content; 25574 } 25575 } 25576 function onSuccess() { 25577 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { 25578 isDismissible: true, 25579 type: 'snackbar' 25580 }); 25581 } 25582 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); 25583 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25584 ref: ref, 25585 children: (0,external_wp_i18n_namespaceObject.__)('Copy all blocks') 25586 }); 25587 } 25588 25589 ;// ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js 25590 /** 25591 * WordPress dependencies 25592 */ 25593 25594 25595 25596 25597 25598 /** 25599 * Internal dependencies 25600 */ 25601 25602 25603 /** 25604 * Set of available mode options. 25605 * 25606 * @type {Array} 25607 */ 25608 25609 const MODES = [{ 25610 value: 'visual', 25611 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') 25612 }, { 25613 value: 'text', 25614 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') 25615 }]; 25616 function ModeSwitcher() { 25617 const { 25618 shortcut, 25619 isRichEditingEnabled, 25620 isCodeEditingEnabled, 25621 mode 25622 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 25623 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-mode'), 25624 isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled, 25625 isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled, 25626 mode: select(store_store).getEditorMode() 25627 }), []); 25628 const { 25629 switchEditorMode 25630 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25631 let selectedMode = mode; 25632 if (!isRichEditingEnabled && mode === 'visual') { 25633 selectedMode = 'text'; 25634 } 25635 if (!isCodeEditingEnabled && mode === 'text') { 25636 selectedMode = 'visual'; 25637 } 25638 const choices = MODES.map(choice => { 25639 if (!isCodeEditingEnabled && choice.value === 'text') { 25640 choice = { 25641 ...choice, 25642 disabled: true 25643 }; 25644 } 25645 if (!isRichEditingEnabled && choice.value === 'visual') { 25646 choice = { 25647 ...choice, 25648 disabled: true, 25649 info: (0,external_wp_i18n_namespaceObject.__)('You can enable the visual editor in your profile settings.') 25650 }; 25651 } 25652 if (choice.value !== selectedMode && !choice.disabled) { 25653 return { 25654 ...choice, 25655 shortcut 25656 }; 25657 } 25658 return choice; 25659 }); 25660 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 25661 label: (0,external_wp_i18n_namespaceObject.__)('Editor'), 25662 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { 25663 choices: choices, 25664 value: selectedMode, 25665 onSelect: switchEditorMode 25666 }) 25667 }); 25668 } 25669 /* harmony default export */ const mode_switcher = (ModeSwitcher); 25670 25671 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js 25672 /** 25673 * WordPress dependencies 25674 */ 25675 25676 25677 const { 25678 Fill: ToolsMoreMenuGroup, 25679 Slot: tools_more_menu_group_Slot 25680 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); 25681 ToolsMoreMenuGroup.Slot = ({ 25682 fillProps 25683 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, { 25684 fillProps: fillProps 25685 }); 25686 /* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); 25687 25688 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js 25689 /** 25690 * WordPress dependencies 25691 */ 25692 25693 25694 25695 const { 25696 Fill: ViewMoreMenuGroup, 25697 Slot: view_more_menu_group_Slot 25698 } = (0,external_wp_components_namespaceObject.createSlotFill)(external_wp_element_namespaceObject.Platform.OS === 'web' ? Symbol('ViewMoreMenuGroup') : 'ViewMoreMenuGroup'); 25699 ViewMoreMenuGroup.Slot = ({ 25700 fillProps 25701 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, { 25702 fillProps: fillProps 25703 }); 25704 /* harmony default export */ const view_more_menu_group = (ViewMoreMenuGroup); 25705 25706 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js 25707 /** 25708 * WordPress dependencies 25709 */ 25710 25711 25712 25713 25714 25715 25716 25717 25718 /** 25719 * Internal dependencies 25720 */ 25721 25722 25723 25724 25725 25726 25727 25728 25729 function MoreMenu() { 25730 const { 25731 openModal 25732 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 25733 const { 25734 set: setPreference 25735 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 25736 const { 25737 toggleDistractionFree 25738 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 25739 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []); 25740 const turnOffDistractionFree = () => { 25741 setPreference('core', 'distractionFree', false); 25742 }; 25743 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25744 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 25745 icon: more_vertical, 25746 label: (0,external_wp_i18n_namespaceObject.__)('Options'), 25747 popoverProps: { 25748 placement: 'bottom-end', 25749 className: 'more-menu-dropdown__content' 25750 }, 25751 toggleProps: { 25752 showTooltip: !showIconLabels, 25753 ...(showIconLabels && { 25754 variant: 'tertiary' 25755 }), 25756 tooltipPosition: 'bottom', 25757 size: 'compact' 25758 }, 25759 children: ({ 25760 onClose 25761 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 25762 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 25763 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'), 25764 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 25765 scope: "core", 25766 name: "fixedToolbar", 25767 onToggle: turnOffDistractionFree, 25768 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 25769 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), 25770 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), 25771 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') 25772 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 25773 scope: "core", 25774 name: "distractionFree", 25775 label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), 25776 info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), 25777 handleToggling: false, 25778 onToggle: toggleDistractionFree, 25779 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'), 25780 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'), 25781 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') 25782 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 25783 scope: "core", 25784 name: "focusMode", 25785 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), 25786 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), 25787 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), 25788 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') 25789 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group.Slot, { 25790 fillProps: { 25791 onClose 25792 } 25793 })] 25794 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { 25795 name: "core/plugin-more-menu", 25796 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), 25797 as: external_wp_components_namespaceObject.MenuGroup, 25798 fillProps: { 25799 onClick: onClose 25800 } 25801 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { 25802 label: (0,external_wp_i18n_namespaceObject.__)('Tools'), 25803 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25804 onClick: () => openModal('editor/keyboard-shortcut-help'), 25805 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'), 25806 children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts') 25807 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { 25808 icon: library_external, 25809 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), 25810 target: "_blank", 25811 rel: "noopener noreferrer", 25812 children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 25813 as: "span", 25814 children: /* translators: accessibility text */ 25815 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 25816 })] 25817 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group.Slot, { 25818 fillProps: { 25819 onClose 25820 } 25821 })] 25822 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 25823 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 25824 onClick: () => openModal('editor/preferences'), 25825 children: (0,external_wp_i18n_namespaceObject.__)('Preferences') 25826 }) 25827 })] 25828 }) 25829 }) 25830 }); 25831 } 25832 25833 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js 25834 /** 25835 * WordPress dependencies 25836 */ 25837 25838 25839 25840 /** 25841 * Internal dependencies 25842 */ 25843 25844 25845 25846 function PostPublishButtonOrToggle({ 25847 forceIsDirty, 25848 hasPublishAction, 25849 isBeingScheduled, 25850 isPending, 25851 isPublished, 25852 isPublishSidebarEnabled, 25853 isPublishSidebarOpened, 25854 isScheduled, 25855 togglePublishSidebar, 25856 setEntitiesSavedStatesCallback, 25857 postStatusHasChanged, 25858 postStatus 25859 }) { 25860 const IS_TOGGLE = 'toggle'; 25861 const IS_BUTTON = 'button'; 25862 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 25863 let component; 25864 25865 /** 25866 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar): 25867 * 25868 * 1) We want to show a BUTTON when the post status is at the _final stage_ 25869 * for a particular role (see https://wordpress.org/documentation/article/post-status/): 25870 * 25871 * - is published 25872 * - post status has changed explicitely to something different than 'future' or 'publish' 25873 * - is scheduled to be published 25874 * - is pending and can't be published (but only for viewports >= medium). 25875 * Originally, we considered showing a button for pending posts that couldn't be published 25876 * (for example, for an author with the contributor role). Some languages can have 25877 * long translations for "Submit for review", so given the lack of UI real estate available 25878 * we decided to take into account the viewport in that case. 25879 * See: https://github.com/WordPress/gutenberg/issues/10475 25880 * 25881 * 2) Then, in small viewports, we'll show a TOGGLE. 25882 * 25883 * 3) Finally, we'll use the publish sidebar status to decide: 25884 * 25885 * - if it is enabled, we show a TOGGLE 25886 * - if it is disabled, we show a BUTTON 25887 */ 25888 if (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { 25889 component = IS_BUTTON; 25890 } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) { 25891 component = IS_TOGGLE; 25892 } else { 25893 component = IS_BUTTON; 25894 } 25895 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button, { 25896 forceIsDirty: forceIsDirty, 25897 isOpen: isPublishSidebarOpened, 25898 isToggle: component === IS_TOGGLE, 25899 onToggle: togglePublishSidebar, 25900 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 25901 }); 25902 } 25903 /* harmony default export */ const post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { 25904 var _select$getCurrentPos; 25905 return { 25906 hasPublishAction: (_select$getCurrentPos = select(store_store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false, 25907 isBeingScheduled: select(store_store).isEditedPostBeingScheduled(), 25908 isPending: select(store_store).isCurrentPostPending(), 25909 isPublished: select(store_store).isCurrentPostPublished(), 25910 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(), 25911 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), 25912 isScheduled: select(store_store).isCurrentPostScheduled(), 25913 postStatus: select(store_store).getEditedPostAttribute('status'), 25914 postStatusHasChanged: select(store_store).getPostEdits()?.status 25915 }; 25916 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 25917 const { 25918 togglePublishSidebar 25919 } = dispatch(store_store); 25920 return { 25921 togglePublishSidebar 25922 }; 25923 }))(PostPublishButtonOrToggle)); 25924 25925 ;// ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js 25926 /** 25927 * WordPress dependencies 25928 */ 25929 25930 25931 25932 25933 25934 25935 25936 /** 25937 * Internal dependencies 25938 */ 25939 25940 25941 function PostViewLink() { 25942 const { 25943 hasLoaded, 25944 permalink, 25945 isPublished, 25946 label, 25947 showIconLabels 25948 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 25949 // Grab post type to retrieve the view_item label. 25950 const postTypeSlug = select(store_store).getCurrentPostType(); 25951 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 25952 const { 25953 get 25954 } = select(external_wp_preferences_namespaceObject.store); 25955 return { 25956 permalink: select(store_store).getPermalink(), 25957 isPublished: select(store_store).isCurrentPostPublished(), 25958 label: postType?.labels.view_item, 25959 hasLoaded: !!postType, 25960 showIconLabels: get('core', 'showIconLabels') 25961 }; 25962 }, []); 25963 25964 // Only render the view button if the post is published and has a permalink. 25965 if (!isPublished || !permalink || !hasLoaded) { 25966 return null; 25967 } 25968 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 25969 icon: library_external, 25970 label: label || (0,external_wp_i18n_namespaceObject.__)('View post'), 25971 href: permalink, 25972 target: "_blank", 25973 showTooltip: !showIconLabels, 25974 size: "compact" 25975 }); 25976 } 25977 25978 ;// ./node_modules/@wordpress/icons/build-module/library/desktop.js 25979 /** 25980 * WordPress dependencies 25981 */ 25982 25983 25984 const desktop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 25985 xmlns: "http://www.w3.org/2000/svg", 25986 viewBox: "0 0 24 24", 25987 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 25988 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" 25989 }) 25990 }); 25991 /* harmony default export */ const library_desktop = (desktop); 25992 25993 ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js 25994 /** 25995 * WordPress dependencies 25996 */ 25997 25998 25999 const mobile = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 26000 xmlns: "http://www.w3.org/2000/svg", 26001 viewBox: "0 0 24 24", 26002 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 26003 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" 26004 }) 26005 }); 26006 /* harmony default export */ const library_mobile = (mobile); 26007 26008 ;// ./node_modules/@wordpress/icons/build-module/library/tablet.js 26009 /** 26010 * WordPress dependencies 26011 */ 26012 26013 26014 const tablet = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 26015 xmlns: "http://www.w3.org/2000/svg", 26016 viewBox: "0 0 24 24", 26017 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 26018 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" 26019 }) 26020 }); 26021 /* harmony default export */ const library_tablet = (tablet); 26022 26023 ;// ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js 26024 /** 26025 * External dependencies 26026 */ 26027 26028 26029 /** 26030 * WordPress dependencies 26031 */ 26032 26033 26034 26035 26036 26037 26038 26039 26040 26041 /** 26042 * Internal dependencies 26043 */ 26044 26045 26046 26047 26048 26049 26050 26051 function PreviewDropdown({ 26052 forceIsAutosaveable, 26053 disabled 26054 }) { 26055 const { 26056 deviceType, 26057 homeUrl, 26058 isTemplate, 26059 isViewable, 26060 showIconLabels 26061 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26062 var _getPostType$viewable; 26063 const { 26064 getDeviceType, 26065 getCurrentPostType 26066 } = select(store_store); 26067 const { 26068 getEntityRecord, 26069 getPostType 26070 } = select(external_wp_coreData_namespaceObject.store); 26071 const { 26072 get 26073 } = select(external_wp_preferences_namespaceObject.store); 26074 const _currentPostType = getCurrentPostType(); 26075 return { 26076 deviceType: getDeviceType(), 26077 homeUrl: getEntityRecord('root', '__unstableBase')?.home, 26078 isTemplate: _currentPostType === 'wp_template', 26079 isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false, 26080 showIconLabels: get('core', 'showIconLabels') 26081 }; 26082 }, []); 26083 const { 26084 setDeviceType 26085 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26086 const { 26087 __unstableSetEditorMode 26088 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 26089 const { 26090 resetZoomLevel 26091 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 26092 const handleDevicePreviewChange = newDeviceType => { 26093 setDeviceType(newDeviceType); 26094 __unstableSetEditorMode('edit'); 26095 resetZoomLevel(); 26096 }; 26097 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 26098 if (isMobile) { 26099 return null; 26100 } 26101 const popoverProps = { 26102 placement: 'bottom-end' 26103 }; 26104 const toggleProps = { 26105 className: 'editor-preview-dropdown__toggle', 26106 iconPosition: 'right', 26107 size: 'compact', 26108 showTooltip: !showIconLabels, 26109 disabled, 26110 accessibleWhenDisabled: disabled 26111 }; 26112 const menuProps = { 26113 'aria-label': (0,external_wp_i18n_namespaceObject.__)('View options') 26114 }; 26115 const deviceIcons = { 26116 desktop: library_desktop, 26117 mobile: library_mobile, 26118 tablet: library_tablet 26119 }; 26120 26121 /** 26122 * The choices for the device type. 26123 * 26124 * @type {Array} 26125 */ 26126 const choices = [{ 26127 value: 'Desktop', 26128 label: (0,external_wp_i18n_namespaceObject.__)('Desktop'), 26129 icon: library_desktop 26130 }, { 26131 value: 'Tablet', 26132 label: (0,external_wp_i18n_namespaceObject.__)('Tablet'), 26133 icon: library_tablet 26134 }, { 26135 value: 'Mobile', 26136 label: (0,external_wp_i18n_namespaceObject.__)('Mobile'), 26137 icon: library_mobile 26138 }]; 26139 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { 26140 className: dist_clsx('editor-preview-dropdown', `editor-preview-dropdown--$deviceType.toLowerCase()}`), 26141 popoverProps: popoverProps, 26142 toggleProps: toggleProps, 26143 menuProps: menuProps, 26144 icon: deviceIcons[deviceType.toLowerCase()], 26145 label: (0,external_wp_i18n_namespaceObject.__)('View'), 26146 disableOpenOnArrowDown: disabled, 26147 children: ({ 26148 onClose 26149 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26150 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 26151 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { 26152 choices: choices, 26153 value: deviceType, 26154 onSelect: handleDevicePreviewChange 26155 }) 26156 }), isTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 26157 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { 26158 href: homeUrl, 26159 target: "_blank", 26160 icon: library_external, 26161 onClick: onClose, 26162 children: [(0,external_wp_i18n_namespaceObject.__)('View site'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 26163 as: "span", 26164 children: /* translators: accessibility text */ 26165 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') 26166 })] 26167 }) 26168 }), isViewable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { 26169 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { 26170 className: "editor-preview-dropdown__button-external", 26171 role: "menuitem", 26172 forceIsAutosaveable: forceIsAutosaveable, 26173 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), 26174 textContent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26175 children: [(0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 26176 icon: library_external 26177 })] 26178 }), 26179 onPreview: onClose 26180 }) 26181 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item.Slot, { 26182 name: "core/plugin-preview-menu", 26183 as: external_wp_components_namespaceObject.MenuGroup, 26184 fillProps: { 26185 onClick: onClose 26186 } 26187 })] 26188 }) 26189 }); 26190 } 26191 26192 ;// ./node_modules/@wordpress/icons/build-module/library/square.js 26193 /** 26194 * WordPress dependencies 26195 */ 26196 26197 26198 const square = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 26199 xmlns: "http://www.w3.org/2000/svg", 26200 viewBox: "0 0 24 24", 26201 fill: "none", 26202 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 26203 fill: "none", 26204 d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", 26205 stroke: "currentColor", 26206 strokeWidth: "1.5", 26207 strokeLinecap: "square" 26208 }) 26209 }); 26210 /* harmony default export */ const library_square = (square); 26211 26212 ;// ./node_modules/@wordpress/editor/build-module/components/zoom-out-toggle/index.js 26213 /** 26214 * WordPress dependencies 26215 */ 26216 26217 26218 26219 26220 26221 26222 26223 /** 26224 * Internal dependencies 26225 */ 26226 26227 26228 const ZoomOutToggle = ({ 26229 disabled 26230 }) => { 26231 const { 26232 isZoomOut, 26233 showIconLabels 26234 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 26235 isZoomOut: unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(), 26236 showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels') 26237 })); 26238 const { 26239 resetZoomLevel, 26240 setZoomLevel, 26241 __unstableSetEditorMode 26242 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 26243 const handleZoomOut = () => { 26244 if (isZoomOut) { 26245 resetZoomLevel(); 26246 } else { 26247 setZoomLevel(50); 26248 } 26249 __unstableSetEditorMode(isZoomOut ? 'edit' : 'zoom-out'); 26250 }; 26251 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26252 accessibleWhenDisabled: true, 26253 disabled: disabled, 26254 onClick: handleZoomOut, 26255 icon: library_square, 26256 label: (0,external_wp_i18n_namespaceObject.__)('Zoom Out'), 26257 isPressed: isZoomOut, 26258 size: "compact", 26259 showTooltip: !showIconLabels 26260 }); 26261 }; 26262 /* harmony default export */ const zoom_out_toggle = (ZoomOutToggle); 26263 26264 ;// ./node_modules/@wordpress/editor/build-module/components/header/index.js 26265 /** 26266 * WordPress dependencies 26267 */ 26268 26269 26270 26271 26272 26273 26274 26275 26276 /** 26277 * Internal dependencies 26278 */ 26279 26280 26281 26282 26283 26284 26285 26286 26287 26288 26289 26290 26291 26292 26293 const toolbarVariations = { 26294 distractionFreeDisabled: { 26295 y: '-50px' 26296 }, 26297 distractionFreeHover: { 26298 y: 0 26299 }, 26300 distractionFreeHidden: { 26301 y: '-50px' 26302 }, 26303 visible: { 26304 y: 0 26305 }, 26306 hidden: { 26307 y: 0 26308 } 26309 }; 26310 const backButtonVariations = { 26311 distractionFreeDisabled: { 26312 x: '-100%' 26313 }, 26314 distractionFreeHover: { 26315 x: 0 26316 }, 26317 distractionFreeHidden: { 26318 x: '-100%' 26319 }, 26320 visible: { 26321 x: 0 26322 }, 26323 hidden: { 26324 x: 0 26325 } 26326 }; 26327 function Header({ 26328 customSaveButton, 26329 forceIsDirty, 26330 forceDisableBlockTools, 26331 setEntitiesSavedStatesCallback, 26332 title, 26333 isEditorIframed 26334 }) { 26335 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 26336 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 26337 const isTooNarrowForDocumentBar = (0,external_wp_compose_namespaceObject.useMediaQuery)('(max-width: 403px)'); 26338 const { 26339 isTextEditor, 26340 isPublishSidebarOpened, 26341 showIconLabels, 26342 hasFixedToolbar, 26343 hasBlockSelection, 26344 isNestedEntity 26345 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26346 const { 26347 get: getPreference 26348 } = select(external_wp_preferences_namespaceObject.store); 26349 const { 26350 getEditorMode, 26351 getEditorSettings, 26352 isPublishSidebarOpened: _isPublishSidebarOpened 26353 } = select(store_store); 26354 const { 26355 __unstableGetEditorMode 26356 } = select(external_wp_blockEditor_namespaceObject.store); 26357 return { 26358 isTextEditor: getEditorMode() === 'text', 26359 isPublishSidebarOpened: _isPublishSidebarOpened(), 26360 showIconLabels: getPreference('core', 'showIconLabels'), 26361 hasFixedToolbar: getPreference('core', 'fixedToolbar'), 26362 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), 26363 isNestedEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord, 26364 isZoomedOutView: __unstableGetEditorMode() === 'zoom-out' 26365 }; 26366 }, []); 26367 const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); 26368 const hasCenter = (!hasBlockSelection || isBlockToolsCollapsed) && !isTooNarrowForDocumentBar; 26369 const hasBackButton = useHasBackButton(); 26370 26371 // The edit-post-header classname is only kept for backward compatibilty 26372 // as some plugins might be relying on its presence. 26373 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26374 className: "editor-header edit-post-header", 26375 children: [hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 26376 className: "editor-header__back-button", 26377 variants: backButtonVariations, 26378 transition: { 26379 type: 'tween' 26380 }, 26381 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button.Slot, {}) 26382 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 26383 variants: toolbarVariations, 26384 className: "editor-header__toolbar", 26385 transition: { 26386 type: 'tween' 26387 }, 26388 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools, { 26389 disableBlockTools: forceDisableBlockTools || isTextEditor 26390 }), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CollapsibleBlockToolbar, { 26391 isCollapsed: isBlockToolsCollapsed, 26392 onToggle: setIsBlockToolsCollapsed 26393 })] 26394 }), hasCenter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 26395 className: "editor-header__center", 26396 variants: toolbarVariations, 26397 transition: { 26398 type: 'tween' 26399 }, 26400 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, { 26401 title: title 26402 }) 26403 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { 26404 variants: toolbarVariations, 26405 transition: { 26406 type: 'tween' 26407 }, 26408 className: "editor-header__settings", 26409 children: [!customSaveButton && !isPublishSidebarOpened && 26410 /*#__PURE__*/ 26411 // This button isn't completely hidden by the publish sidebar. 26412 // We can't hide the whole toolbar when the publish sidebar is open because 26413 // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. 26414 // We track that DOM node to return focus to the PostPublishButtonOrToggle 26415 // when the publish sidebar has been closed. 26416 (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, { 26417 forceIsDirty: forceIsDirty 26418 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewDropdown, { 26419 forceIsAutosaveable: forceIsDirty, 26420 disabled: isNestedEntity 26421 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewButton, { 26422 className: "editor-header__post-preview-button", 26423 forceIsAutosaveable: forceIsDirty 26424 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), isEditorIframed && isWideViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_toggle, { 26425 disabled: forceDisableBlockTools 26426 }), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items.Slot, { 26427 scope: "core" 26428 }), !customSaveButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_button_or_toggle, { 26429 forceIsDirty: forceIsDirty, 26430 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 26431 }), customSaveButton, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})] 26432 })] 26433 }); 26434 } 26435 /* harmony default export */ const components_header = (Header); 26436 26437 ;// ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js 26438 /** 26439 * WordPress dependencies 26440 */ 26441 26442 26443 26444 26445 26446 26447 26448 26449 /** 26450 * Internal dependencies 26451 */ 26452 26453 26454 26455 const { 26456 PrivateInserterLibrary 26457 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26458 function InserterSidebar() { 26459 const { 26460 blockSectionRootClientId, 26461 inserterSidebarToggleRef, 26462 insertionPoint, 26463 showMostUsedBlocks, 26464 sidebarIsOpened 26465 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26466 const { 26467 getInserterSidebarToggleRef, 26468 getInsertionPoint, 26469 isPublishSidebarOpened 26470 } = unlock(select(store_store)); 26471 const { 26472 getBlockRootClientId, 26473 __unstableGetEditorMode, 26474 getSectionRootClientId 26475 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 26476 const { 26477 get 26478 } = select(external_wp_preferences_namespaceObject.store); 26479 const { 26480 getActiveComplementaryArea 26481 } = select(store); 26482 const getBlockSectionRootClientId = () => { 26483 if (__unstableGetEditorMode() === 'zoom-out') { 26484 const sectionRootClientId = getSectionRootClientId(); 26485 if (sectionRootClientId) { 26486 return sectionRootClientId; 26487 } 26488 } 26489 return getBlockRootClientId(); 26490 }; 26491 return { 26492 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 26493 insertionPoint: getInsertionPoint(), 26494 showMostUsedBlocks: get('core', 'mostUsedBlocks'), 26495 blockSectionRootClientId: getBlockSectionRootClientId(), 26496 sidebarIsOpened: !!(getActiveComplementaryArea('core') || isPublishSidebarOpened()) 26497 }; 26498 }, []); 26499 const { 26500 setIsInserterOpened 26501 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26502 const { 26503 disableComplementaryArea 26504 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 26505 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 26506 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); 26507 26508 // When closing the inserter, focus should return to the toggle button. 26509 const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { 26510 setIsInserterOpened(false); 26511 inserterSidebarToggleRef.current?.focus(); 26512 }, [inserterSidebarToggleRef, setIsInserterOpened]); 26513 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { 26514 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 26515 event.preventDefault(); 26516 closeInserterSidebar(); 26517 } 26518 }, [closeInserterSidebar]); 26519 const inserterContents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26520 className: "editor-inserter-sidebar__content", 26521 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, { 26522 showMostUsedBlocks: showMostUsedBlocks, 26523 showInserterHelpPanel: true, 26524 shouldFocusBlock: isMobileViewport, 26525 rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : insertionPoint.rootClientId, 26526 __experimentalInsertionIndex: insertionPoint.insertionIndex, 26527 onSelect: insertionPoint.onSelect, 26528 __experimentalInitialTab: insertionPoint.tab, 26529 __experimentalInitialCategory: insertionPoint.category, 26530 __experimentalFilterValue: insertionPoint.filterValue, 26531 onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea('core') : undefined, 26532 ref: libraryRef, 26533 onClose: closeInserterSidebar 26534 }) 26535 }); 26536 return ( 26537 /*#__PURE__*/ 26538 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 26539 (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26540 onKeyDown: closeOnEscape, 26541 className: "editor-inserter-sidebar", 26542 children: inserterContents 26543 }) 26544 ); 26545 } 26546 26547 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js 26548 /** 26549 * WordPress dependencies 26550 */ 26551 26552 26553 26554 /** 26555 * Internal dependencies 26556 */ 26557 26558 26559 26560 26561 26562 26563 26564 function ListViewOutline() { 26565 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26566 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26567 className: "editor-list-view-sidebar__outline", 26568 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26569 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 26570 children: (0,external_wp_i18n_namespaceObject.__)('Characters:') 26571 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 26572 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) 26573 })] 26574 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26575 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 26576 children: (0,external_wp_i18n_namespaceObject.__)('Words:') 26577 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {})] 26578 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26579 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 26580 children: (0,external_wp_i18n_namespaceObject.__)('Time to read:') 26581 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {})] 26582 })] 26583 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {})] 26584 }); 26585 } 26586 26587 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js 26588 /** 26589 * WordPress dependencies 26590 */ 26591 26592 26593 26594 26595 26596 26597 26598 26599 26600 /** 26601 * Internal dependencies 26602 */ 26603 26604 26605 26606 26607 const { 26608 TabbedSidebar 26609 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 26610 function ListViewSidebar() { 26611 const { 26612 setIsListViewOpened 26613 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26614 const { 26615 getListViewToggleRef 26616 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); 26617 26618 // This hook handles focus when the sidebar first renders. 26619 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); 26620 26621 // When closing the list view, focus should return to the toggle button. 26622 const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { 26623 setIsListViewOpened(false); 26624 getListViewToggleRef().current?.focus(); 26625 }, [getListViewToggleRef, setIsListViewOpened]); 26626 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { 26627 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 26628 event.preventDefault(); 26629 closeListView(); 26630 } 26631 }, [closeListView]); 26632 26633 // Use internal state instead of a ref to make sure that the component 26634 // re-renders when the dropZoneElement updates. 26635 const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); 26636 // Tracks our current tab. 26637 const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view'); 26638 26639 // This ref refers to the sidebar as a whole. 26640 const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); 26641 // This ref refers to the tab panel. 26642 const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); 26643 // This ref refers to the list view application area. 26644 const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); 26645 26646 // Must merge the refs together so focus can be handled properly in the next function. 26647 const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]); 26648 26649 /* 26650 * Callback function to handle list view or outline focus. 26651 * 26652 * @param {string} currentTab The current tab. Either list view or outline. 26653 * 26654 * @return void 26655 */ 26656 function handleSidebarFocus(currentTab) { 26657 // Tab panel focus. 26658 const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0]; 26659 // List view tab is selected. 26660 if (currentTab === 'list-view') { 26661 // 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. 26662 const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0]; 26663 const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus; 26664 listViewFocusArea.focus(); 26665 // Outline tab is selected. 26666 } else { 26667 tabPanelFocus.focus(); 26668 } 26669 } 26670 const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { 26671 // If the sidebar has focus, it is safe to close. 26672 if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) { 26673 closeListView(); 26674 } else { 26675 // If the list view or outline does not have focus, focus should be moved to it. 26676 handleSidebarFocus(tab); 26677 } 26678 }, [closeListView, tab]); 26679 26680 // This only fires when the sidebar is open because of the conditional rendering. 26681 // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed. 26682 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut); 26683 return ( 26684 /*#__PURE__*/ 26685 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 26686 (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26687 className: "editor-list-view-sidebar", 26688 onKeyDown: closeOnEscape, 26689 ref: sidebarRef, 26690 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TabbedSidebar, { 26691 tabs: [{ 26692 name: 'list-view', 26693 title: (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview'), 26694 panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26695 className: "editor-list-view-sidebar__list-view-container", 26696 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26697 className: "editor-list-view-sidebar__list-view-panel-content", 26698 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, { 26699 dropZoneElement: dropZoneElement 26700 }) 26701 }) 26702 }), 26703 panelRef: listViewContainerRef 26704 }, { 26705 name: 'outline', 26706 title: (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview'), 26707 panel: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26708 className: "editor-list-view-sidebar__list-view-container", 26709 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {}) 26710 }) 26711 }], 26712 onClose: closeListView, 26713 onSelect: tabName => setTab(tabName), 26714 defaultTabId: "list-view", 26715 ref: tabsRef, 26716 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close') 26717 }) 26718 }) 26719 ); 26720 } 26721 26722 ;// ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js 26723 /** 26724 * WordPress dependencies 26725 */ 26726 26727 26728 26729 26730 26731 /** 26732 * Internal dependencies 26733 */ 26734 26735 26736 26737 26738 26739 26740 26741 26742 const { 26743 Fill: save_publish_panels_Fill, 26744 Slot: save_publish_panels_Slot 26745 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel'); 26746 const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill)); 26747 function SavePublishPanels({ 26748 setEntitiesSavedStatesCallback, 26749 closeEntitiesSavedStates, 26750 isEntitiesSavedStatesOpen, 26751 forceIsDirtyPublishPanel 26752 }) { 26753 const { 26754 closePublishSidebar, 26755 togglePublishSidebar 26756 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26757 const { 26758 publishSidebarOpened, 26759 isPublishable, 26760 isDirty, 26761 hasOtherEntitiesChanges 26762 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26763 const { 26764 isPublishSidebarOpened, 26765 isEditedPostPublishable, 26766 isCurrentPostPublished, 26767 isEditedPostDirty, 26768 hasNonPostEntityChanges 26769 } = select(store_store); 26770 const _hasOtherEntitiesChanges = hasNonPostEntityChanges(); 26771 return { 26772 publishSidebarOpened: isPublishSidebarOpened(), 26773 isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(), 26774 isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(), 26775 hasOtherEntitiesChanges: _hasOtherEntitiesChanges 26776 }; 26777 }, []); 26778 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); 26779 26780 // It is ok for these components to be unmounted when not in visual use. 26781 // We don't want more than one present at a time, decide which to render. 26782 let unmountableContent; 26783 if (publishSidebarOpened) { 26784 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_publish_panel, { 26785 onClose: closePublishSidebar, 26786 forceIsDirty: forceIsDirtyPublishPanel, 26787 PrePublishExtension: plugin_pre_publish_panel.Slot, 26788 PostPublishExtension: plugin_post_publish_panel.Slot 26789 }); 26790 } else if (isPublishable && !hasOtherEntitiesChanges) { 26791 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26792 className: "editor-layout__toggle-publish-panel", 26793 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26794 __next40pxDefaultSize: true, 26795 variant: "secondary", 26796 onClick: togglePublishSidebar, 26797 "aria-expanded": false, 26798 children: (0,external_wp_i18n_namespaceObject.__)('Open publish panel') 26799 }) 26800 }); 26801 } else { 26802 unmountableContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 26803 className: "editor-layout__toggle-entities-saved-states-panel", 26804 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26805 __next40pxDefaultSize: true, 26806 variant: "secondary", 26807 onClick: openEntitiesSavedStates, 26808 "aria-expanded": false, 26809 disabled: !isDirty, 26810 accessibleWhenDisabled: true, 26811 children: (0,external_wp_i18n_namespaceObject.__)('Open save panel') 26812 }) 26813 }); 26814 } 26815 26816 // Since EntitiesSavedStates controls its own panel, we can keep it 26817 // always mounted to retain its own component state (such as checkboxes). 26818 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 26819 children: [isEntitiesSavedStatesOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStates, { 26820 close: closeEntitiesSavedStates 26821 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, { 26822 bubblesVirtually: true 26823 }), !isEntitiesSavedStatesOpen && unmountableContent] 26824 }); 26825 } 26826 26827 ;// ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js 26828 /** 26829 * WordPress dependencies 26830 */ 26831 26832 26833 26834 26835 26836 26837 26838 /** 26839 * Internal dependencies 26840 */ 26841 26842 26843 26844 26845 26846 26847 function TextEditor({ 26848 autoFocus = false 26849 }) { 26850 const { 26851 switchEditorMode 26852 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 26853 const { 26854 shortcut, 26855 isRichEditingEnabled 26856 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26857 const { 26858 getEditorSettings 26859 } = select(store_store); 26860 const { 26861 getShortcutRepresentation 26862 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 26863 return { 26864 shortcut: getShortcutRepresentation('core/editor/toggle-mode'), 26865 isRichEditingEnabled: getEditorSettings().richEditingEnabled 26866 }; 26867 }, []); 26868 const { 26869 resetZoomLevel, 26870 __unstableSetEditorMode 26871 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 26872 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 26873 (0,external_wp_element_namespaceObject.useEffect)(() => { 26874 resetZoomLevel(); 26875 __unstableSetEditorMode('edit'); 26876 if (autoFocus) { 26877 return; 26878 } 26879 titleRef?.current?.focus(); 26880 }, [autoFocus, resetZoomLevel, __unstableSetEditorMode]); 26881 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26882 className: "editor-text-editor", 26883 children: [isRichEditingEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26884 className: "editor-text-editor__toolbar", 26885 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { 26886 children: (0,external_wp_i18n_namespaceObject.__)('Editing code') 26887 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 26888 __next40pxDefaultSize: true, 26889 variant: "tertiary", 26890 onClick: () => switchEditorMode('visual'), 26891 shortcut: shortcut, 26892 children: (0,external_wp_i18n_namespaceObject.__)('Exit code editor') 26893 })] 26894 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 26895 className: "editor-text-editor__body", 26896 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw, { 26897 ref: titleRef 26898 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {})] 26899 })] 26900 }); 26901 } 26902 26903 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js 26904 /** 26905 * WordPress dependencies 26906 */ 26907 26908 26909 26910 26911 26912 26913 /** 26914 * Internal dependencies 26915 */ 26916 26917 26918 /** 26919 * Component that: 26920 * 26921 * - Displays a 'Edit your template to edit this block' notification when the 26922 * user is focusing on editing page content and clicks on a disabled template 26923 * block. 26924 * - Displays a 'Edit your template to edit this block' dialog when the user 26925 * is focusing on editing page conetnt and double clicks on a disabled 26926 * template block. 26927 * 26928 * @param {Object} props 26929 * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block 26930 * editor iframe canvas. 26931 */ 26932 26933 function EditTemplateBlocksNotification({ 26934 contentRef 26935 }) { 26936 const { 26937 onNavigateToEntityRecord, 26938 templateId 26939 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 26940 const { 26941 getEditorSettings, 26942 getCurrentTemplateId 26943 } = select(store_store); 26944 return { 26945 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 26946 templateId: getCurrentTemplateId() 26947 }; 26948 }, []); 26949 const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', { 26950 kind: 'postType', 26951 name: 'wp_template' 26952 }), []); 26953 const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 26954 (0,external_wp_element_namespaceObject.useEffect)(() => { 26955 const handleDblClick = event => { 26956 if (!canEditTemplate) { 26957 return; 26958 } 26959 if (!event.target.classList.contains('is-root-container') || event.target.dataset?.type === 'core/template-part') { 26960 return; 26961 } 26962 if (!event.defaultPrevented) { 26963 event.preventDefault(); 26964 setIsDialogOpen(true); 26965 } 26966 }; 26967 const canvas = contentRef.current; 26968 canvas?.addEventListener('dblclick', handleDblClick); 26969 return () => { 26970 canvas?.removeEventListener('dblclick', handleDblClick); 26971 }; 26972 }, [contentRef, canEditTemplate]); 26973 if (!canEditTemplate) { 26974 return null; 26975 } 26976 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { 26977 isOpen: isDialogOpen, 26978 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Edit template'), 26979 onConfirm: () => { 26980 setIsDialogOpen(false); 26981 onNavigateToEntityRecord({ 26982 postId: templateId, 26983 postType: 'wp_template' 26984 }); 26985 }, 26986 onCancel: () => setIsDialogOpen(false), 26987 size: "medium", 26988 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?') 26989 }); 26990 } 26991 26992 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js 26993 /** 26994 * WordPress dependencies 26995 */ 26996 26997 26998 26999 27000 27001 27002 const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels. 27003 27004 function ResizeHandle({ 27005 direction, 27006 resizeWidthBy 27007 }) { 27008 function handleKeyDown(event) { 27009 const { 27010 keyCode 27011 } = event; 27012 if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { 27013 resizeWidthBy(DELTA_DISTANCE); 27014 } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) { 27015 resizeWidthBy(-DELTA_DISTANCE); 27016 } 27017 } 27018 const resizeHandleVariants = { 27019 active: { 27020 opacity: 1, 27021 scaleY: 1.3 27022 } 27023 }; 27024 const resizableHandleHelpId = `resizable-editor__resize-help-$direction}`; 27025 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27026 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 27027 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 27028 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.button, { 27029 className: `editor-resizable-editor__resize-handle is-$direction}`, 27030 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 27031 "aria-describedby": resizableHandleHelpId, 27032 onKeyDown: handleKeyDown, 27033 variants: resizeHandleVariants, 27034 whileFocus: "active", 27035 whileHover: "active", 27036 whileTap: "active", 27037 role: "separator", 27038 "aria-orientation": "vertical" 27039 }, "handle") 27040 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 27041 id: resizableHandleHelpId, 27042 children: (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.') 27043 })] 27044 }); 27045 } 27046 27047 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js 27048 /** 27049 * External dependencies 27050 */ 27051 27052 27053 /** 27054 * WordPress dependencies 27055 */ 27056 27057 27058 27059 /** 27060 * Internal dependencies 27061 */ 27062 27063 27064 // Removes the inline styles in the drag handles. 27065 27066 const HANDLE_STYLES_OVERRIDE = { 27067 position: undefined, 27068 userSelect: undefined, 27069 cursor: undefined, 27070 width: undefined, 27071 height: undefined, 27072 top: undefined, 27073 right: undefined, 27074 bottom: undefined, 27075 left: undefined 27076 }; 27077 function ResizableEditor({ 27078 className, 27079 enableResizing, 27080 height, 27081 children 27082 }) { 27083 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)('100%'); 27084 const resizableRef = (0,external_wp_element_namespaceObject.useRef)(); 27085 const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => { 27086 if (resizableRef.current) { 27087 setWidth(resizableRef.current.offsetWidth + deltaPixels); 27088 } 27089 }, []); 27090 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { 27091 className: dist_clsx('editor-resizable-editor', className, { 27092 'is-resizable': enableResizing 27093 }), 27094 ref: api => { 27095 resizableRef.current = api?.resizable; 27096 }, 27097 size: { 27098 width: enableResizing ? width : '100%', 27099 height: enableResizing && height ? height : '100%' 27100 }, 27101 onResizeStop: (event, direction, element) => { 27102 setWidth(element.style.width); 27103 }, 27104 minWidth: 300, 27105 maxWidth: "100%", 27106 maxHeight: "100%", 27107 enable: { 27108 left: enableResizing, 27109 right: enableResizing 27110 }, 27111 showHandle: enableResizing 27112 // The editor is centered horizontally, resizing it only 27113 // moves half the distance. Hence double the ratio to correctly 27114 // align the cursor to the resizer handle. 27115 , 27116 resizeRatio: 2, 27117 handleComponent: { 27118 left: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { 27119 direction: "left", 27120 resizeWidthBy: resizeWidthBy 27121 }), 27122 right: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizeHandle, { 27123 direction: "right", 27124 resizeWidthBy: resizeWidthBy 27125 }) 27126 }, 27127 handleClasses: undefined, 27128 handleStyles: { 27129 left: HANDLE_STYLES_OVERRIDE, 27130 right: HANDLE_STYLES_OVERRIDE 27131 }, 27132 children: children 27133 }); 27134 } 27135 /* harmony default export */ const resizable_editor = (ResizableEditor); 27136 27137 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-select-nearest-editable-block.js 27138 /** 27139 * WordPress dependencies 27140 */ 27141 27142 27143 27144 27145 /** 27146 * Internal dependencies 27147 */ 27148 27149 const DISTANCE_THRESHOLD = 500; 27150 function clamp(value, min, max) { 27151 return Math.min(Math.max(value, min), max); 27152 } 27153 function distanceFromRect(x, y, rect) { 27154 const dx = x - clamp(x, rect.left, rect.right); 27155 const dy = y - clamp(y, rect.top, rect.bottom); 27156 return Math.sqrt(dx * dx + dy * dy); 27157 } 27158 function useSelectNearestEditableBlock({ 27159 isEnabled = true 27160 } = {}) { 27161 const { 27162 getEnabledClientIdsTree, 27163 getBlockName, 27164 getBlockOrder 27165 } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); 27166 const { 27167 selectBlock 27168 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 27169 return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { 27170 if (!isEnabled) { 27171 return; 27172 } 27173 const selectNearestEditableBlock = (x, y) => { 27174 const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ 27175 clientId 27176 }) => { 27177 const blockName = getBlockName(clientId); 27178 if (blockName === 'core/template-part') { 27179 return []; 27180 } 27181 if (blockName === 'core/post-content') { 27182 const innerBlocks = getBlockOrder(clientId); 27183 if (innerBlocks.length) { 27184 return innerBlocks; 27185 } 27186 } 27187 return [clientId]; 27188 }); 27189 let nearestDistance = Infinity, 27190 nearestClientId = null; 27191 for (const clientId of editableBlockClientIds) { 27192 const block = element.querySelector(`[data-block="$clientId}"]`); 27193 if (!block) { 27194 continue; 27195 } 27196 const rect = block.getBoundingClientRect(); 27197 const distance = distanceFromRect(x, y, rect); 27198 if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) { 27199 nearestDistance = distance; 27200 nearestClientId = clientId; 27201 } 27202 } 27203 if (nearestClientId) { 27204 selectBlock(nearestClientId); 27205 } 27206 }; 27207 const handleClick = event => { 27208 const shouldSelect = event.target === element || event.target.classList.contains('is-root-container'); 27209 if (shouldSelect) { 27210 selectNearestEditableBlock(event.clientX, event.clientY); 27211 } 27212 }; 27213 element.addEventListener('click', handleClick); 27214 return () => element.removeEventListener('click', handleClick); 27215 }, [isEnabled]); 27216 } 27217 27218 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js 27219 /** 27220 * External dependencies 27221 */ 27222 27223 27224 /** 27225 * WordPress dependencies 27226 */ 27227 27228 27229 27230 27231 27232 27233 27234 /** 27235 * Internal dependencies 27236 */ 27237 27238 27239 27240 27241 27242 27243 27244 27245 27246 27247 const { 27248 LayoutStyle, 27249 useLayoutClasses, 27250 useLayoutStyles, 27251 ExperimentalBlockCanvas: BlockCanvas, 27252 useFlashEditableBlocks, 27253 useZoomOutModeExit 27254 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 27255 27256 /** 27257 * These post types have a special editor where they don't allow you to fill the title 27258 * and they don't apply the layout styles. 27259 */ 27260 const visual_editor_DESIGN_POST_TYPES = [PATTERN_POST_TYPE, TEMPLATE_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE]; 27261 27262 /** 27263 * Given an array of nested blocks, find the first Post Content 27264 * block inside it, recursing through any nesting levels, 27265 * and return its attributes. 27266 * 27267 * @param {Array} blocks A list of blocks. 27268 * 27269 * @return {Object | undefined} The Post Content block. 27270 */ 27271 function getPostContentAttributes(blocks) { 27272 for (let i = 0; i < blocks.length; i++) { 27273 if (blocks[i].name === 'core/post-content') { 27274 return blocks[i].attributes; 27275 } 27276 if (blocks[i].innerBlocks.length) { 27277 const nestedPostContent = getPostContentAttributes(blocks[i].innerBlocks); 27278 if (nestedPostContent) { 27279 return nestedPostContent; 27280 } 27281 } 27282 } 27283 } 27284 function checkForPostContentAtRootLevel(blocks) { 27285 for (let i = 0; i < blocks.length; i++) { 27286 if (blocks[i].name === 'core/post-content') { 27287 return true; 27288 } 27289 } 27290 return false; 27291 } 27292 function VisualEditor({ 27293 // Ideally as we unify post and site editors, we won't need these props. 27294 autoFocus, 27295 styles, 27296 disableIframe = false, 27297 iframeProps, 27298 contentRef, 27299 className 27300 }) { 27301 const [resizeObserver, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 27302 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); 27303 const isTabletViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 27304 const { 27305 renderingMode, 27306 postContentAttributes, 27307 editedPostTemplate = {}, 27308 wrapperBlockName, 27309 wrapperUniqueId, 27310 deviceType, 27311 isFocusedEntity, 27312 isDesignPostType, 27313 postType, 27314 isPreview 27315 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27316 const { 27317 getCurrentPostId, 27318 getCurrentPostType, 27319 getCurrentTemplateId, 27320 getEditorSettings, 27321 getRenderingMode, 27322 getDeviceType 27323 } = select(store_store); 27324 const { 27325 getPostType, 27326 getEditedEntityRecord 27327 } = select(external_wp_coreData_namespaceObject.store); 27328 const postTypeSlug = getCurrentPostType(); 27329 const _renderingMode = getRenderingMode(); 27330 let _wrapperBlockName; 27331 if (postTypeSlug === PATTERN_POST_TYPE) { 27332 _wrapperBlockName = 'core/block'; 27333 } else if (_renderingMode === 'post-only') { 27334 _wrapperBlockName = 'core/post-content'; 27335 } 27336 const editorSettings = getEditorSettings(); 27337 const supportsTemplateMode = editorSettings.supportsTemplateMode; 27338 const postTypeObject = getPostType(postTypeSlug); 27339 const currentTemplateId = getCurrentTemplateId(); 27340 const template = currentTemplateId ? getEditedEntityRecord('postType', TEMPLATE_POST_TYPE, currentTemplateId) : undefined; 27341 return { 27342 renderingMode: _renderingMode, 27343 postContentAttributes: editorSettings.postContentAttributes, 27344 isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug), 27345 // Post template fetch returns a 404 on classic themes, which 27346 // messes with e2e tests, so check it's a block theme first. 27347 editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template : undefined, 27348 wrapperBlockName: _wrapperBlockName, 27349 wrapperUniqueId: getCurrentPostId(), 27350 deviceType: getDeviceType(), 27351 isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord, 27352 postType: postTypeSlug, 27353 isPreview: editorSettings.__unstableIsPreviewMode 27354 }; 27355 }, []); 27356 const { 27357 isCleanNewPost 27358 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 27359 const { 27360 hasRootPaddingAwareAlignments, 27361 themeHasDisabledLayoutStyles, 27362 themeSupportsLayout, 27363 isZoomedOut 27364 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27365 const { 27366 getSettings, 27367 isZoomOut: _isZoomOut 27368 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 27369 const _settings = getSettings(); 27370 return { 27371 themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, 27372 themeSupportsLayout: _settings.supportsLayout, 27373 hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments, 27374 isZoomedOut: _isZoomOut() 27375 }; 27376 }, []); 27377 const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); 27378 const [globalLayoutSettings] = (0,external_wp_blockEditor_namespaceObject.useSettings)('layout'); 27379 27380 // fallbackLayout is used if there is no Post Content, 27381 // and for Post Title. 27382 const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 27383 if (renderingMode !== 'post-only' || isDesignPostType) { 27384 return { 27385 type: 'default' 27386 }; 27387 } 27388 if (themeSupportsLayout) { 27389 // We need to ensure support for wide and full alignments, 27390 // so we add the constrained type. 27391 return { 27392 ...globalLayoutSettings, 27393 type: 'constrained' 27394 }; 27395 } 27396 // Set default layout for classic themes so all alignments are supported. 27397 return { 27398 type: 'default' 27399 }; 27400 }, [renderingMode, themeSupportsLayout, globalLayoutSettings, isDesignPostType]); 27401 const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { 27402 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { 27403 return postContentAttributes; 27404 } 27405 // When in template editing mode, we can access the blocks directly. 27406 if (editedPostTemplate?.blocks) { 27407 return getPostContentAttributes(editedPostTemplate?.blocks); 27408 } 27409 // If there are no blocks, we have to parse the content string. 27410 // Best double-check it's a string otherwise the parse function gets unhappy. 27411 const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; 27412 return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; 27413 }, [editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes]); 27414 const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { 27415 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { 27416 return false; 27417 } 27418 // When in template editing mode, we can access the blocks directly. 27419 if (editedPostTemplate?.blocks) { 27420 return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); 27421 } 27422 // If there are no blocks, we have to parse the content string. 27423 // Best double-check it's a string otherwise the parse function gets unhappy. 27424 const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; 27425 return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; 27426 }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); 27427 const { 27428 layout = {}, 27429 align = '' 27430 } = newestPostContentAttributes || {}; 27431 const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content'); 27432 const blockListLayoutClass = dist_clsx({ 27433 'is-layout-flow': !themeSupportsLayout 27434 }, themeSupportsLayout && postContentLayoutClasses, align && `align$align}`); 27435 const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container'); 27436 27437 // Update type for blocks using legacy layouts. 27438 const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 27439 return layout && (layout?.type === 'constrained' || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { 27440 ...globalLayoutSettings, 27441 ...layout, 27442 type: 'constrained' 27443 } : { 27444 ...globalLayoutSettings, 27445 ...layout, 27446 type: 'default' 27447 }; 27448 }, [layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings]); 27449 27450 // If there is a Post Content block we use its layout for the block list; 27451 // if not, this must be a classic theme, in which case we use the fallback layout. 27452 const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; 27453 const postEditorLayout = blockListLayout?.type === 'default' && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; 27454 const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); 27455 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 27456 (0,external_wp_element_namespaceObject.useEffect)(() => { 27457 if (!autoFocus || !isCleanNewPost()) { 27458 return; 27459 } 27460 titleRef?.current?.focus(); 27461 }, [autoFocus, isCleanNewPost]); 27462 27463 // Add some styles for alignwide/alignfull Post Content and its children. 27464 const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} 27465 .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} 27466 .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} 27467 .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; 27468 const localRef = (0,external_wp_element_namespaceObject.useRef)(); 27469 const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(); 27470 contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([localRef, contentRef, renderingMode === 'post-only' ? typewriterRef : null, useFlashEditableBlocks({ 27471 isEnabled: renderingMode === 'template-locked' 27472 }), useSelectNearestEditableBlock({ 27473 isEnabled: renderingMode === 'template-locked' 27474 }), useZoomOutModeExit()]); 27475 const zoomOutProps = isZoomedOut && !isTabletViewport ? { 27476 scale: 'default', 27477 frameSize: '40px' 27478 } : {}; 27479 const forceFullHeight = postType === NAVIGATION_POST_TYPE; 27480 const enableResizing = [NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(postType) && 27481 // Disable in previews / view mode. 27482 !isPreview && 27483 // Disable resizing in mobile viewport. 27484 !isMobileViewport && 27485 // Dsiable resizing in zoomed-out mode. 27486 !isZoomedOut; 27487 const shouldIframe = !disableIframe || ['Tablet', 'Mobile'].includes(deviceType); 27488 const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 27489 return [...(styles !== null && styles !== void 0 ? styles : []), { 27490 // Ensures margins of children are contained so that the body background paints behind them. 27491 // Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s 27492 // important mostly for post-only views yet conceivably an issue in templated views too. 27493 css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${ 27494 // Some themes will have `min-height: 100vh` for the root container, 27495 // which isn't a requirement in auto resize mode. 27496 enableResizing ? 'min-height:0!important;' : ''}}` 27497 }]; 27498 }, [styles, enableResizing]); 27499 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 27500 className: dist_clsx('editor-visual-editor', 27501 // this class is here for backward compatibility reasons. 27502 'edit-post-visual-editor', className, { 27503 'has-padding': isFocusedEntity || enableResizing, 27504 'is-resizable': enableResizing, 27505 'is-iframed': shouldIframe 27506 }), 27507 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor, { 27508 enableResizing: enableResizing, 27509 height: sizes.height && !forceFullHeight ? sizes.height : '100%', 27510 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockCanvas, { 27511 shouldIframe: shouldIframe, 27512 contentRef: contentRef, 27513 styles: iframeStyles, 27514 height: "100%", 27515 iframeProps: { 27516 ...iframeProps, 27517 ...zoomOutProps, 27518 style: { 27519 ...iframeProps?.style, 27520 ...deviceStyles 27521 } 27522 }, 27523 children: [themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27524 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 27525 selector: ".editor-visual-editor__post-title-wrapper", 27526 layout: fallbackLayout 27527 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 27528 selector: ".block-editor-block-list__layout.is-root-container", 27529 layout: postEditorLayout 27530 }), align && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 27531 css: alignCSS 27532 }), postContentLayoutStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { 27533 layout: postContentLayout, 27534 css: postContentLayoutStyles 27535 })] 27536 }), renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 27537 className: dist_clsx('editor-visual-editor__post-title-wrapper', 27538 // The following class is only here for backward comapatibility 27539 // some themes might be using it to style the post title. 27540 'edit-post-visual-editor__post-title-wrapper', { 27541 'has-global-padding': hasRootPaddingAwareAlignments 27542 }), 27543 contentEditable: false, 27544 ref: observeTypingRef, 27545 style: { 27546 // This is using inline styles 27547 // so it's applied for both iframed and non iframed editors. 27548 marginTop: '4rem' 27549 }, 27550 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title, { 27551 ref: titleRef 27552 }) 27553 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.RecursionProvider, { 27554 blockName: wrapperBlockName, 27555 uniqueId: wrapperUniqueId, 27556 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { 27557 className: dist_clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `$blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules. 27558 ), 27559 layout: blockListLayout, 27560 dropZoneElement: 27561 // When iframed, pass in the html element of the iframe to 27562 // ensure the drop zone extends to the edges of the iframe. 27563 disableIframe ? localRef.current : localRef.current?.parentNode, 27564 __unstableDisableDropZone: 27565 // In template preview mode, disable drop zones at the root of the template. 27566 renderingMode === 'template-locked' ? true : false 27567 }), renderingMode === 'template-locked' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditTemplateBlocksNotification, { 27568 contentRef: localRef 27569 })] 27570 }), 27571 // Avoid resize listeners when not needed, 27572 // these will trigger unnecessary re-renders 27573 // when animating the iframe width. 27574 enableResizing && resizeObserver] 27575 }) 27576 }) 27577 }); 27578 } 27579 /* harmony default export */ const visual_editor = (VisualEditor); 27580 27581 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js 27582 /** 27583 * External dependencies 27584 */ 27585 27586 27587 /** 27588 * WordPress dependencies 27589 */ 27590 27591 27592 27593 27594 27595 27596 27597 27598 /** 27599 * Internal dependencies 27600 */ 27601 27602 27603 27604 27605 27606 27607 27608 27609 27610 27611 27612 27613 27614 const interfaceLabels = { 27615 /* translators: accessibility text for the editor top bar landmark region. */ 27616 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), 27617 /* translators: accessibility text for the editor content landmark region. */ 27618 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'), 27619 /* translators: accessibility text for the editor settings landmark region. */ 27620 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'), 27621 /* translators: accessibility text for the editor publish landmark region. */ 27622 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'), 27623 /* translators: accessibility text for the editor footer landmark region. */ 27624 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer') 27625 }; 27626 function EditorInterface({ 27627 className, 27628 styles, 27629 children, 27630 forceIsDirty, 27631 contentRef, 27632 disableIframe, 27633 autoFocus, 27634 customSaveButton, 27635 customSavePanel, 27636 forceDisableBlockTools, 27637 title, 27638 iframeProps 27639 }) { 27640 const { 27641 mode, 27642 isRichEditingEnabled, 27643 isInserterOpened, 27644 isListViewOpened, 27645 isDistractionFree, 27646 isPreviewMode, 27647 showBlockBreadcrumbs, 27648 documentLabel, 27649 isZoomOut 27650 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27651 const { 27652 get 27653 } = select(external_wp_preferences_namespaceObject.store); 27654 const { 27655 getEditorSettings, 27656 getPostTypeLabel 27657 } = select(store_store); 27658 const editorSettings = getEditorSettings(); 27659 const postTypeLabel = getPostTypeLabel(); 27660 const { 27661 isZoomOut: _isZoomOut 27662 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 27663 return { 27664 mode: select(store_store).getEditorMode(), 27665 isRichEditingEnabled: editorSettings.richEditingEnabled, 27666 isInserterOpened: select(store_store).isInserterOpened(), 27667 isListViewOpened: select(store_store).isListViewOpened(), 27668 isDistractionFree: get('core', 'distractionFree'), 27669 isPreviewMode: editorSettings.__unstableIsPreviewMode, 27670 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 27671 documentLabel: 27672 // translators: Default label for the Document in the Block Breadcrumb. 27673 postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, breadcrumb'), 27674 isZoomOut: _isZoomOut() 27675 }; 27676 }, []); 27677 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 27678 const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); 27679 27680 // Local state for save panel. 27681 // Note 'truthy' callback implies an open panel. 27682 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); 27683 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { 27684 if (typeof entitiesSavedStatesCallback === 'function') { 27685 entitiesSavedStatesCallback(arg); 27686 } 27687 setEntitiesSavedStatesCallback(false); 27688 }, [entitiesSavedStatesCallback]); 27689 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, { 27690 isDistractionFree: isDistractionFree, 27691 className: dist_clsx('editor-editor-interface', className, { 27692 'is-entity-save-view-open': !!entitiesSavedStatesCallback, 27693 'is-distraction-free': isDistractionFree && !isPreviewMode 27694 }), 27695 labels: { 27696 ...interfaceLabels, 27697 secondarySidebar: secondarySidebarLabel 27698 }, 27699 header: !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_header, { 27700 forceIsDirty: forceIsDirty, 27701 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, 27702 customSaveButton: customSaveButton, 27703 forceDisableBlockTools: forceDisableBlockTools, 27704 title: title, 27705 isEditorIframed: !disableIframe 27706 }), 27707 editorNotices: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), 27708 secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})), 27709 sidebar: !isPreviewMode && !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, { 27710 scope: "core" 27711 }), 27712 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27713 children: [!isDistractionFree && !isPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill.Slot, { 27714 children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27715 children: [!isPreviewMode && (mode === 'text' || !isRichEditingEnabled) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextEditor 27716 // We should auto-focus the canvas (title) on load. 27717 // eslint-disable-next-line jsx-a11y/no-autofocus 27718 , { 27719 autoFocus: autoFocus 27720 }), !isPreviewMode && !isLargeViewport && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 27721 hideDragHandle: true 27722 }), (isPreviewMode || isRichEditingEnabled && mode === 'visual') && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(visual_editor, { 27723 styles: styles, 27724 contentRef: contentRef, 27725 disableIframe: disableIframe 27726 // We should auto-focus the canvas (title) on load. 27727 // eslint-disable-next-line jsx-a11y/no-autofocus 27728 , 27729 autoFocus: autoFocus, 27730 iframeProps: iframeProps 27731 }), children] 27732 }) 27733 })] 27734 }), 27735 footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && isRichEditingEnabled && !isZoomOut && mode === 'visual' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { 27736 rootLabelText: documentLabel 27737 }), 27738 actions: !isPreviewMode ? customSavePanel || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePublishPanels, { 27739 closeEntitiesSavedStates: closeEntitiesSavedStates, 27740 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, 27741 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, 27742 forceIsDirtyPublishPanel: forceIsDirty 27743 }) : undefined 27744 }); 27745 } 27746 27747 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js 27748 /** 27749 * WordPress dependencies 27750 */ 27751 27752 27753 27754 /** 27755 * Internal dependencies 27756 */ 27757 27758 27759 27760 const { 27761 OverridesPanel 27762 } = unlock(external_wp_patterns_namespaceObject.privateApis); 27763 function PatternOverridesPanel() { 27764 const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType() === 'wp_block', []); 27765 if (!supportsPatternOverridesPanel) { 27766 return null; 27767 } 27768 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {}); 27769 } 27770 27771 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js 27772 /** 27773 * WordPress dependencies 27774 */ 27775 27776 27777 27778 /** 27779 * Internal dependencies 27780 */ 27781 27782 27783 27784 function usePostActions({ 27785 postType, 27786 onActionPerformed, 27787 context 27788 }) { 27789 const { 27790 defaultActions 27791 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27792 const { 27793 getEntityActions 27794 } = unlock(select(store_store)); 27795 return { 27796 defaultActions: getEntityActions('postType', postType) 27797 }; 27798 }, [postType]); 27799 const { 27800 registerPostTypeActions 27801 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 27802 (0,external_wp_element_namespaceObject.useEffect)(() => { 27803 registerPostTypeActions(postType); 27804 }, [registerPostTypeActions, postType]); 27805 return (0,external_wp_element_namespaceObject.useMemo)(() => { 27806 // Filter actions based on provided context. If not provided 27807 // all actions are returned. We'll have a single entry for getting the actions 27808 // and the consumer should provide the context to filter the actions, if needed. 27809 // Actions should also provide the `context` they support, if it's specific, to 27810 // compare with the provided context to get all the actions. 27811 // Right now the only supported context is `list`. 27812 const actions = defaultActions.filter(action => { 27813 if (!action.context) { 27814 return true; 27815 } 27816 return action.context === context; 27817 }); 27818 if (onActionPerformed) { 27819 for (let i = 0; i < actions.length; ++i) { 27820 if (actions[i].callback) { 27821 const existingCallback = actions[i].callback; 27822 actions[i] = { 27823 ...actions[i], 27824 callback: (items, argsObject) => { 27825 existingCallback(items, { 27826 ...argsObject, 27827 onActionPerformed: _items => { 27828 if (argsObject?.onActionPerformed) { 27829 argsObject.onActionPerformed(_items); 27830 } 27831 onActionPerformed(actions[i].id, _items); 27832 } 27833 }); 27834 } 27835 }; 27836 } 27837 if (actions[i].RenderModal) { 27838 const ExistingRenderModal = actions[i].RenderModal; 27839 actions[i] = { 27840 ...actions[i], 27841 RenderModal: props => { 27842 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExistingRenderModal, { 27843 ...props, 27844 onActionPerformed: _items => { 27845 if (props.onActionPerformed) { 27846 props.onActionPerformed(_items); 27847 } 27848 onActionPerformed(actions[i].id, _items); 27849 } 27850 }); 27851 } 27852 }; 27853 } 27854 } 27855 } 27856 return actions; 27857 }, [defaultActions, onActionPerformed, context]); 27858 } 27859 27860 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js 27861 /** 27862 * WordPress dependencies 27863 */ 27864 27865 27866 27867 27868 27869 27870 27871 /** 27872 * Internal dependencies 27873 */ 27874 27875 27876 27877 27878 27879 const { 27880 DropdownMenuV2, 27881 kebabCase 27882 } = unlock(external_wp_components_namespaceObject.privateApis); 27883 function PostActions({ 27884 postType, 27885 postId, 27886 onActionPerformed 27887 }) { 27888 const [isActionsMenuOpen, setIsActionsMenuOpen] = (0,external_wp_element_namespaceObject.useState)(false); 27889 const { 27890 item, 27891 permissions 27892 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 27893 const { 27894 getEditedEntityRecord, 27895 getEntityRecordPermissions 27896 } = unlock(select(external_wp_coreData_namespaceObject.store)); 27897 return { 27898 item: getEditedEntityRecord('postType', postType, postId), 27899 permissions: getEntityRecordPermissions('postType', postType, postId) 27900 }; 27901 }, [postId, postType]); 27902 const itemWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => { 27903 return { 27904 ...item, 27905 permissions 27906 }; 27907 }, [item, permissions]); 27908 const allActions = usePostActions({ 27909 postType, 27910 onActionPerformed 27911 }); 27912 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 27913 return allActions.filter(action => { 27914 return !action.isEligible || action.isEligible(itemWithPermissions); 27915 }); 27916 }, [allActions, itemWithPermissions]); 27917 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2, { 27918 open: isActionsMenuOpen, 27919 trigger: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 27920 size: "small", 27921 icon: more_vertical, 27922 label: (0,external_wp_i18n_namespaceObject.__)('Actions'), 27923 disabled: !actions.length, 27924 accessibleWhenDisabled: true, 27925 className: "editor-all-actions-button", 27926 onClick: () => setIsActionsMenuOpen(!isActionsMenuOpen) 27927 }), 27928 onOpenChange: setIsActionsMenuOpen, 27929 placement: "bottom-end", 27930 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsDropdownMenuGroup, { 27931 actions: actions, 27932 item: itemWithPermissions, 27933 onClose: () => { 27934 setIsActionsMenuOpen(false); 27935 } 27936 }) 27937 }); 27938 } 27939 27940 // From now on all the functions on this file are copied as from the dataviews packages, 27941 // The editor packages should not be using the dataviews packages directly, 27942 // and the dataviews package should not be using the editor packages directly, 27943 // so duplicating the code here seems like the least bad option. 27944 27945 // Copied as is from packages/dataviews/src/item-actions.js 27946 function DropdownMenuItemTrigger({ 27947 action, 27948 onClick, 27949 items 27950 }) { 27951 const label = typeof action.label === 'string' ? action.label : action.label(items); 27952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.Item, { 27953 onClick: onClick, 27954 hideOnClick: !action.RenderModal, 27955 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.ItemLabel, { 27956 children: label 27957 }) 27958 }); 27959 } 27960 27961 // Copied as is from packages/dataviews/src/item-actions.js 27962 // With an added onClose prop. 27963 function ActionWithModal({ 27964 action, 27965 item, 27966 ActionTrigger, 27967 onClose 27968 }) { 27969 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 27970 const actionTriggerProps = { 27971 action, 27972 onClick: () => setIsModalOpen(true), 27973 items: [item] 27974 }; 27975 const { 27976 RenderModal, 27977 hideModalHeader 27978 } = action; 27979 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 27980 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTrigger, { 27981 ...actionTriggerProps 27982 }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 27983 title: action.modalHeader || action.label, 27984 __experimentalHideHeader: !!hideModalHeader, 27985 onRequestClose: () => { 27986 setIsModalOpen(false); 27987 }, 27988 overlayClassName: `editor-action-modal editor-action-modal__$kebabCase(action.id)}`, 27989 focusOnMount: "firstContentElement", 27990 size: "small", 27991 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderModal, { 27992 items: [item], 27993 closeModal: () => { 27994 setIsModalOpen(false); 27995 onClose(); 27996 } 27997 }) 27998 })] 27999 }); 28000 } 28001 28002 // Copied as is from packages/dataviews/src/item-actions.js 28003 // With an added onClose prop. 28004 function ActionsDropdownMenuGroup({ 28005 actions, 28006 item, 28007 onClose 28008 }) { 28009 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuV2.Group, { 28010 children: actions.map(action => { 28011 if (action.RenderModal) { 28012 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionWithModal, { 28013 action: action, 28014 item: item, 28015 ActionTrigger: DropdownMenuItemTrigger, 28016 onClose: onClose 28017 }, action.id); 28018 } 28019 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownMenuItemTrigger, { 28020 action: action, 28021 onClick: () => action.callback([item]), 28022 items: [item] 28023 }, action.id); 28024 }) 28025 }); 28026 } 28027 28028 ;// ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js 28029 /** 28030 * External dependencies 28031 */ 28032 28033 /** 28034 * WordPress dependencies 28035 */ 28036 28037 28038 28039 28040 28041 28042 /** 28043 * Internal dependencies 28044 */ 28045 28046 28047 28048 28049 28050 28051 function PostCardPanel({ 28052 postType, 28053 postId, 28054 onActionPerformed 28055 }) { 28056 const { 28057 isFrontPage, 28058 isPostsPage, 28059 title, 28060 icon, 28061 isSync 28062 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28063 const { 28064 __experimentalGetTemplateInfo 28065 } = select(store_store); 28066 const { 28067 canUser, 28068 getEditedEntityRecord 28069 } = select(external_wp_coreData_namespaceObject.store); 28070 const siteSettings = canUser('read', { 28071 kind: 'root', 28072 name: 'site' 28073 }) ? getEditedEntityRecord('root', 'site') : undefined; 28074 const _record = getEditedEntityRecord('postType', postType, postId); 28075 const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType) && __experimentalGetTemplateInfo(_record); 28076 let _isSync = false; 28077 if (GLOBAL_POST_TYPES.includes(postType)) { 28078 if (PATTERN_POST_TYPE === postType) { 28079 // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead. 28080 const currentSyncStatus = _record?.meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : _record?.wp_pattern_sync_status; 28081 _isSync = currentSyncStatus !== 'unsynced'; 28082 } else { 28083 _isSync = true; 28084 } 28085 } 28086 return { 28087 title: _templateInfo?.title || _record?.title, 28088 icon: unlock(select(store_store)).getPostIcon(postType, { 28089 area: _record?.area 28090 }), 28091 isSync: _isSync, 28092 isFrontPage: siteSettings?.page_on_front === postId, 28093 isPostsPage: siteSettings?.page_for_posts === postId 28094 }; 28095 }, [postId, postType]); 28096 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 28097 className: "editor-post-card-panel", 28098 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { 28099 spacing: 2, 28100 className: "editor-post-card-panel__header", 28101 align: "flex-start", 28102 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 28103 className: dist_clsx('editor-post-card-panel__icon', { 28104 'is-sync': isSync 28105 }), 28106 icon: icon 28107 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { 28108 numberOfLines: 2, 28109 truncate: true, 28110 className: "editor-post-card-panel__title", 28111 weight: 500, 28112 as: "h2", 28113 lineHeight: "20px", 28114 children: [title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No title'), isFrontPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 28115 className: "editor-post-card-panel__title-badge", 28116 children: (0,external_wp_i18n_namespaceObject.__)('Homepage') 28117 }), isPostsPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 28118 className: "editor-post-card-panel__title-badge", 28119 children: (0,external_wp_i18n_namespaceObject.__)('Posts Page') 28120 })] 28121 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostActions, { 28122 postType: postType, 28123 postId: postId, 28124 onActionPerformed: onActionPerformed 28125 })] 28126 }) 28127 }); 28128 } 28129 28130 ;// ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js 28131 /** 28132 * WordPress dependencies 28133 */ 28134 28135 28136 28137 28138 28139 28140 28141 /** 28142 * Internal dependencies 28143 */ 28144 28145 28146 28147 // Taken from packages/editor/src/components/time-to-read/index.js. 28148 28149 const post_content_information_AVERAGE_READING_RATE = 189; 28150 28151 // This component renders the wordcount and reading time for the post. 28152 function PostContentInformation() { 28153 const { 28154 postContent 28155 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28156 const { 28157 getEditedPostAttribute, 28158 getCurrentPostType, 28159 getCurrentPostId 28160 } = select(store_store); 28161 const { 28162 canUser 28163 } = select(external_wp_coreData_namespaceObject.store); 28164 const { 28165 getEntityRecord 28166 } = select(external_wp_coreData_namespaceObject.store); 28167 const siteSettings = canUser('read', { 28168 kind: 'root', 28169 name: 'site' 28170 }) ? getEntityRecord('root', 'site') : undefined; 28171 const postType = getCurrentPostType(); 28172 const _id = getCurrentPostId(); 28173 const isPostsPage = +_id === siteSettings?.page_for_posts; 28174 const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType); 28175 return { 28176 postContent: showPostContentInfo && getEditedPostAttribute('content') 28177 }; 28178 }, []); 28179 28180 /* 28181 * translators: If your word count is based on single characters (e.g. East Asian characters), 28182 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 28183 * Do not translate into your own language. 28184 */ 28185 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); 28186 const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)(() => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, [postContent, wordCountType]); 28187 if (!wordsCounted) { 28188 return null; 28189 } 28190 const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE); 28191 const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)( 28192 // translators: %s: the number of words in the post. 28193 (0,external_wp_i18n_namespaceObject._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString()); 28194 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. */ 28195 (0,external_wp_i18n_namespaceObject._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString()); 28196 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 28197 className: "editor-post-content-information", 28198 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 28199 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.) */ 28200 (0,external_wp_i18n_namespaceObject.__)('%1$s, %2$s read time.'), wordsCountText, minutesText) 28201 }) 28202 }); 28203 } 28204 28205 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js 28206 /** 28207 * WordPress dependencies 28208 */ 28209 28210 28211 28212 28213 28214 28215 /** 28216 * Internal dependencies 28217 */ 28218 28219 28220 28221 28222 28223 /** 28224 * Renders the Post Author Panel component. 28225 * 28226 * @return {Component} The component to be rendered. 28227 */ 28228 28229 28230 function panel_PostFormat() { 28231 const { 28232 postFormat 28233 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28234 const { 28235 getEditedPostAttribute 28236 } = select(store_store); 28237 const _postFormat = getEditedPostAttribute('format'); 28238 return { 28239 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard' 28240 }; 28241 }, []); 28242 const activeFormat = POST_FORMATS.find(format => format.id === postFormat); 28243 28244 // Use internal state instead of a ref to make sure that the component 28245 // re-renders when the popover's anchor updates. 28246 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 28247 // Memoize popoverProps to avoid returning a new object every time. 28248 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 28249 // Anchor the popover to the middle of the entire row so that it doesn't 28250 // move around when the label changes. 28251 anchor: popoverAnchor, 28252 placement: 'left-start', 28253 offset: 36, 28254 shift: true 28255 }), [popoverAnchor]); 28256 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_check, { 28257 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 28258 label: (0,external_wp_i18n_namespaceObject.__)('Format'), 28259 ref: setPopoverAnchor, 28260 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 28261 popoverProps: popoverProps, 28262 contentClassName: "editor-post-format__dialog", 28263 focusOnMount: true, 28264 renderToggle: ({ 28265 isOpen, 28266 onToggle 28267 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28268 size: "compact", 28269 variant: "tertiary", 28270 "aria-expanded": isOpen, 28271 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 28272 // translators: %s: Current post format. 28273 (0,external_wp_i18n_namespaceObject.__)('Change format: %s'), activeFormat?.caption), 28274 onClick: onToggle, 28275 children: activeFormat?.caption 28276 }), 28277 renderContent: ({ 28278 onClose 28279 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 28280 className: "editor-post-format__dialog-content", 28281 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 28282 title: (0,external_wp_i18n_namespaceObject.__)('Format'), 28283 onClose: onClose 28284 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {})] 28285 }) 28286 }) 28287 }) 28288 }); 28289 } 28290 /* harmony default export */ const post_format_panel = (panel_PostFormat); 28291 28292 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js 28293 /** 28294 * WordPress dependencies 28295 */ 28296 28297 28298 28299 28300 28301 /** 28302 * Internal dependencies 28303 */ 28304 28305 28306 function PostLastEditedPanel() { 28307 const modified = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('modified'), []); 28308 const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)( 28309 // translators: %s: Human-readable time difference, e.g. "2 days ago". 28310 (0,external_wp_i18n_namespaceObject.__)('Last edited %s.'), (0,external_wp_date_namespaceObject.humanTimeDiff)(modified)); 28311 if (!lastEditedText) { 28312 return null; 28313 } 28314 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 28315 className: "editor-post-last-edited-panel", 28316 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 28317 children: lastEditedText 28318 }) 28319 }); 28320 } 28321 28322 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js 28323 /** 28324 * External dependencies 28325 */ 28326 28327 28328 /** 28329 * WordPress dependencies 28330 */ 28331 28332 28333 function PostPanelSection({ 28334 className, 28335 children 28336 }) { 28337 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { 28338 className: dist_clsx('editor-post-panel__section', className), 28339 children: children 28340 }); 28341 } 28342 /* harmony default export */ const post_panel_section = (PostPanelSection); 28343 28344 ;// ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js 28345 /** 28346 * WordPress dependencies 28347 */ 28348 28349 28350 28351 28352 28353 28354 28355 28356 28357 /** 28358 * Internal dependencies 28359 */ 28360 28361 28362 28363 28364 28365 28366 const blog_title_EMPTY_OBJECT = {}; 28367 function BlogTitle() { 28368 const { 28369 editEntityRecord 28370 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28371 const { 28372 postsPageTitle, 28373 postsPageId, 28374 isTemplate, 28375 postSlug 28376 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28377 const { 28378 getEntityRecord, 28379 getEditedEntityRecord, 28380 canUser 28381 } = select(external_wp_coreData_namespaceObject.store); 28382 const siteSettings = canUser('read', { 28383 kind: 'root', 28384 name: 'site' 28385 }) ? getEntityRecord('root', 'site') : undefined; 28386 const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord('postType', 'page', siteSettings?.page_for_posts) : blog_title_EMPTY_OBJECT; 28387 const { 28388 getEditedPostAttribute, 28389 getCurrentPostType 28390 } = select(store_store); 28391 return { 28392 postsPageId: _postsPageRecord?.id, 28393 postsPageTitle: _postsPageRecord?.title, 28394 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 28395 postSlug: getEditedPostAttribute('slug') 28396 }; 28397 }, []); 28398 // Use internal state instead of a ref to make sure that the component 28399 // re-renders when the popover's anchor updates. 28400 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 28401 // Memoize popoverProps to avoid returning a new object every time. 28402 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 28403 // Anchor the popover to the middle of the entire row so that it doesn't 28404 // move around when the label changes. 28405 anchor: popoverAnchor, 28406 placement: 'left-start', 28407 offset: 36, 28408 shift: true 28409 }), [popoverAnchor]); 28410 if (!isTemplate || !['home', 'index'].includes(postSlug) || !postsPageId) { 28411 return null; 28412 } 28413 const setPostsPageTitle = newValue => { 28414 editEntityRecord('postType', 'page', postsPageId, { 28415 title: newValue 28416 }); 28417 }; 28418 const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle); 28419 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 28420 label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 28421 ref: setPopoverAnchor, 28422 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 28423 popoverProps: popoverProps, 28424 contentClassName: "editor-blog-title-dropdown__content", 28425 focusOnMount: true, 28426 renderToggle: ({ 28427 isOpen, 28428 onToggle 28429 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28430 size: "compact", 28431 variant: "tertiary", 28432 "aria-expanded": isOpen, 28433 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 28434 // translators: %s: Current post link. 28435 (0,external_wp_i18n_namespaceObject.__)('Change blog title: %s'), decodedTitle), 28436 onClick: onToggle, 28437 children: decodedTitle 28438 }), 28439 renderContent: ({ 28440 onClose 28441 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28442 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 28443 title: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 28444 onClose: onClose 28445 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { 28446 placeholder: (0,external_wp_i18n_namespaceObject.__)('No title'), 28447 size: "__unstable-large", 28448 value: postsPageTitle, 28449 onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300), 28450 label: (0,external_wp_i18n_namespaceObject.__)('Blog title'), 28451 help: (0,external_wp_i18n_namespaceObject.__)('Set the Posts Page title. Appears in search results, and when the page is shared on social media.'), 28452 hideLabelFromVision: true 28453 })] 28454 }) 28455 }) 28456 }); 28457 } 28458 28459 ;// ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js 28460 /** 28461 * WordPress dependencies 28462 */ 28463 28464 28465 28466 28467 28468 28469 28470 /** 28471 * Internal dependencies 28472 */ 28473 28474 28475 28476 28477 28478 28479 function PostsPerPage() { 28480 const { 28481 editEntityRecord 28482 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28483 const { 28484 postsPerPage, 28485 isTemplate, 28486 postSlug 28487 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28488 const { 28489 getEditedPostAttribute, 28490 getCurrentPostType 28491 } = select(store_store); 28492 const { 28493 getEditedEntityRecord, 28494 canUser 28495 } = select(external_wp_coreData_namespaceObject.store); 28496 const siteSettings = canUser('read', { 28497 kind: 'root', 28498 name: 'site' 28499 }) ? getEditedEntityRecord('root', 'site') : undefined; 28500 return { 28501 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 28502 postSlug: getEditedPostAttribute('slug'), 28503 postsPerPage: siteSettings?.posts_per_page || 1 28504 }; 28505 }, []); 28506 // Use internal state instead of a ref to make sure that the component 28507 // re-renders when the popover's anchor updates. 28508 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 28509 // Memoize popoverProps to avoid returning a new object every time. 28510 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 28511 // Anchor the popover to the middle of the entire row so that it doesn't 28512 // move around when the label changes. 28513 anchor: popoverAnchor, 28514 placement: 'left-start', 28515 offset: 36, 28516 shift: true 28517 }), [popoverAnchor]); 28518 if (!isTemplate || !['home', 'index'].includes(postSlug)) { 28519 return null; 28520 } 28521 const setPostsPerPage = newValue => { 28522 editEntityRecord('root', 'site', undefined, { 28523 posts_per_page: newValue 28524 }); 28525 }; 28526 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 28527 label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 28528 ref: setPopoverAnchor, 28529 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 28530 popoverProps: popoverProps, 28531 contentClassName: "editor-posts-per-page-dropdown__content", 28532 focusOnMount: true, 28533 renderToggle: ({ 28534 isOpen, 28535 onToggle 28536 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28537 size: "compact", 28538 variant: "tertiary", 28539 "aria-expanded": isOpen, 28540 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change posts per page'), 28541 onClick: onToggle, 28542 children: postsPerPage 28543 }), 28544 renderContent: ({ 28545 onClose 28546 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28547 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 28548 title: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 28549 onClose: onClose 28550 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 28551 placeholder: 0, 28552 value: postsPerPage, 28553 size: "__unstable-large", 28554 spinControls: "custom", 28555 step: "1", 28556 min: "1", 28557 onChange: setPostsPerPage, 28558 label: (0,external_wp_i18n_namespaceObject.__)('Posts per page'), 28559 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.'), 28560 hideLabelFromVision: true 28561 })] 28562 }) 28563 }) 28564 }); 28565 } 28566 28567 ;// ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js 28568 /** 28569 * WordPress dependencies 28570 */ 28571 28572 28573 28574 28575 28576 28577 28578 /** 28579 * Internal dependencies 28580 */ 28581 28582 28583 28584 28585 28586 28587 const site_discussion_COMMENT_OPTIONS = [{ 28588 label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'), 28589 value: 'open', 28590 description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.') 28591 }, { 28592 label: (0,external_wp_i18n_namespaceObject.__)('Closed'), 28593 value: '', 28594 description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ') 28595 }]; 28596 function SiteDiscussion() { 28597 const { 28598 editEntityRecord 28599 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28600 const { 28601 allowCommentsOnNewPosts, 28602 isTemplate, 28603 postSlug 28604 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28605 const { 28606 getEditedPostAttribute, 28607 getCurrentPostType 28608 } = select(store_store); 28609 const { 28610 getEditedEntityRecord, 28611 canUser 28612 } = select(external_wp_coreData_namespaceObject.store); 28613 const siteSettings = canUser('read', { 28614 kind: 'root', 28615 name: 'site' 28616 }) ? getEditedEntityRecord('root', 'site') : undefined; 28617 return { 28618 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 28619 postSlug: getEditedPostAttribute('slug'), 28620 allowCommentsOnNewPosts: siteSettings?.default_comment_status || '' 28621 }; 28622 }, []); 28623 // Use internal state instead of a ref to make sure that the component 28624 // re-renders when the popover's anchor updates. 28625 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 28626 // Memoize popoverProps to avoid returning a new object every time. 28627 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 28628 // Anchor the popover to the middle of the entire row so that it doesn't 28629 // move around when the label changes. 28630 anchor: popoverAnchor, 28631 placement: 'left-start', 28632 offset: 36, 28633 shift: true 28634 }), [popoverAnchor]); 28635 if (!isTemplate || !['home', 'index'].includes(postSlug)) { 28636 return null; 28637 } 28638 const setAllowCommentsOnNewPosts = newValue => { 28639 editEntityRecord('root', 'site', undefined, { 28640 default_comment_status: newValue ? 'open' : null 28641 }); 28642 }; 28643 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, { 28644 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 28645 ref: setPopoverAnchor, 28646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { 28647 popoverProps: popoverProps, 28648 contentClassName: "editor-site-discussion-dropdown__content", 28649 focusOnMount: true, 28650 renderToggle: ({ 28651 isOpen, 28652 onToggle 28653 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 28654 size: "compact", 28655 variant: "tertiary", 28656 "aria-expanded": isOpen, 28657 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion settings'), 28658 onClick: onToggle, 28659 children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)('Comments open') : (0,external_wp_i18n_namespaceObject.__)('Comments closed') 28660 }), 28661 renderContent: ({ 28662 onClose 28663 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28664 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { 28665 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 28666 onClose: onClose 28667 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28668 spacing: 3, 28669 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { 28670 children: (0,external_wp_i18n_namespaceObject.__)('Changes will apply to new posts only. Individual posts may override these settings.') 28671 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { 28672 className: "editor-site-discussion__options", 28673 hideLabelFromVision: true, 28674 label: (0,external_wp_i18n_namespaceObject.__)('Comment status'), 28675 options: site_discussion_COMMENT_OPTIONS, 28676 onChange: setAllowCommentsOnNewPosts, 28677 selected: allowCommentsOnNewPosts 28678 })] 28679 })] 28680 }) 28681 }) 28682 }); 28683 } 28684 28685 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js 28686 /** 28687 * WordPress dependencies 28688 */ 28689 28690 28691 28692 /** 28693 * Internal dependencies 28694 */ 28695 28696 28697 28698 28699 28700 28701 28702 28703 28704 28705 28706 28707 28708 28709 28710 28711 28712 28713 28714 28715 28716 28717 28718 /** 28719 * Module Constants 28720 */ 28721 28722 28723 28724 const post_summary_PANEL_NAME = 'post-status'; 28725 function PostSummary({ 28726 onActionPerformed 28727 }) { 28728 const { 28729 isRemovedPostStatusPanel, 28730 postType, 28731 postId 28732 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28733 // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do 28734 // not use isEditorPanelEnabled since this panel should not be disabled through the UI. 28735 const { 28736 isEditorPanelRemoved, 28737 getCurrentPostType, 28738 getCurrentPostId 28739 } = select(store_store); 28740 return { 28741 isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME), 28742 postType: getCurrentPostType(), 28743 postId: getCurrentPostId() 28744 }; 28745 }, []); 28746 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section, { 28747 className: "editor-post-summary", 28748 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info.Slot, { 28749 children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 28750 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28751 spacing: 4, 28752 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { 28753 postType: postType, 28754 postId: postId, 28755 onActionPerformed: onActionPerformed 28756 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, { 28757 withPanelBody: false 28758 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28759 spacing: 1, 28760 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {})] 28761 }), !isRemovedPostStatusPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28762 spacing: 4, 28763 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 28764 spacing: 1, 28765 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] 28766 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTrash, { 28767 onActionPerformed: onActionPerformed 28768 })] 28769 })] 28770 }) 28771 }) 28772 }) 28773 }); 28774 } 28775 28776 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js 28777 /** 28778 * WordPress dependencies 28779 */ 28780 28781 28782 28783 28784 28785 28786 /** 28787 * Internal dependencies 28788 */ 28789 28790 28791 const { 28792 EXCLUDED_PATTERN_SOURCES, 28793 PATTERN_TYPES: hooks_PATTERN_TYPES 28794 } = unlock(external_wp_patterns_namespaceObject.privateApis); 28795 function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) { 28796 block.innerBlocks = block.innerBlocks.map(innerBlock => { 28797 return injectThemeAttributeInBlockTemplateContent(innerBlock, currentThemeStylesheet); 28798 }); 28799 if (block.name === 'core/template-part' && block.attributes.theme === undefined) { 28800 block.attributes.theme = currentThemeStylesheet; 28801 } 28802 return block; 28803 } 28804 28805 /** 28806 * Filter all patterns and return only the ones that are compatible with the current template. 28807 * 28808 * @param {Array} patterns An array of patterns. 28809 * @param {Object} template The current template. 28810 * @return {Array} Array of patterns that are compatible with the current template. 28811 */ 28812 function filterPatterns(patterns, template) { 28813 // Filter out duplicates. 28814 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name); 28815 28816 // Filter out core/directory patterns not included in theme.json. 28817 const filterOutExcludedPatternSources = pattern => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source); 28818 28819 // Looks for patterns that have the same template type as the current template, 28820 // or have a block type that matches the current template area. 28821 const filterCompatiblePatterns = pattern => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes('core/template-part/' + template.area); 28822 return patterns.filter((pattern, index, items) => { 28823 return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern); 28824 }); 28825 } 28826 function preparePatterns(patterns, currentThemeStylesheet) { 28827 return patterns.map(pattern => ({ 28828 ...pattern, 28829 keywords: pattern.keywords || [], 28830 type: hooks_PATTERN_TYPES.theme, 28831 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 28832 __unstableSkipMigrationLogs: true 28833 }).map(block => injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet)) 28834 })); 28835 } 28836 function useAvailablePatterns(template) { 28837 const { 28838 blockPatterns, 28839 restBlockPatterns, 28840 currentThemeStylesheet 28841 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28842 var _settings$__experimen; 28843 const { 28844 getEditorSettings 28845 } = select(store_store); 28846 const settings = getEditorSettings(); 28847 return { 28848 blockPatterns: (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns, 28849 restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 28850 currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet 28851 }; 28852 }, []); 28853 return (0,external_wp_element_namespaceObject.useMemo)(() => { 28854 const mergedPatterns = [...(blockPatterns || []), ...(restBlockPatterns || [])]; 28855 const filteredPatterns = filterPatterns(mergedPatterns, template); 28856 return preparePatterns(filteredPatterns, template, currentThemeStylesheet); 28857 }, [blockPatterns, restBlockPatterns, template, currentThemeStylesheet]); 28858 } 28859 28860 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js 28861 /** 28862 * WordPress dependencies 28863 */ 28864 28865 28866 28867 28868 28869 28870 28871 28872 /** 28873 * Internal dependencies 28874 */ 28875 28876 28877 28878 28879 function post_transform_panel_TemplatesList({ 28880 availableTemplates, 28881 onSelect 28882 }) { 28883 const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(availableTemplates); 28884 if (!availableTemplates || availableTemplates?.length === 0) { 28885 return null; 28886 } 28887 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 28888 label: (0,external_wp_i18n_namespaceObject.__)('Templates'), 28889 blockPatterns: availableTemplates, 28890 shownPatterns: shownTemplates, 28891 onClickPattern: onSelect, 28892 showTitlesAsTooltip: true 28893 }); 28894 } 28895 function PostTransform() { 28896 const { 28897 record, 28898 postType, 28899 postId 28900 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28901 const { 28902 getCurrentPostType, 28903 getCurrentPostId 28904 } = select(store_store); 28905 const { 28906 getEditedEntityRecord 28907 } = select(external_wp_coreData_namespaceObject.store); 28908 const type = getCurrentPostType(); 28909 const id = getCurrentPostId(); 28910 return { 28911 postType: type, 28912 postId: id, 28913 record: getEditedEntityRecord('postType', type, id) 28914 }; 28915 }, []); 28916 const { 28917 editEntityRecord 28918 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28919 const availablePatterns = useAvailablePatterns(record); 28920 const onTemplateSelect = async selectedTemplate => { 28921 await editEntityRecord('postType', postType, postId, { 28922 blocks: selectedTemplate.blocks, 28923 content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks) 28924 }); 28925 }; 28926 if (!availablePatterns?.length) { 28927 return null; 28928 } 28929 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 28930 title: (0,external_wp_i18n_namespaceObject.__)('Design'), 28931 initialOpen: record.type === TEMPLATE_PART_POST_TYPE, 28932 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_transform_panel_TemplatesList, { 28933 availableTemplates: availablePatterns, 28934 onSelect: onTemplateSelect 28935 }) 28936 }); 28937 } 28938 function PostTransformPanel() { 28939 const { 28940 postType 28941 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28942 const { 28943 getCurrentPostType 28944 } = select(store_store); 28945 return { 28946 postType: getCurrentPostType() 28947 }; 28948 }, []); 28949 if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { 28950 return null; 28951 } 28952 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {}); 28953 } 28954 28955 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js 28956 const sidebars = { 28957 document: 'edit-post/document', 28958 block: 'edit-post/block' 28959 }; 28960 28961 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js 28962 /** 28963 * WordPress dependencies 28964 */ 28965 28966 28967 28968 28969 28970 /** 28971 * Internal dependencies 28972 */ 28973 28974 28975 28976 28977 28978 const { 28979 Tabs 28980 } = unlock(external_wp_components_namespaceObject.privateApis); 28981 const SidebarHeader = (_, ref) => { 28982 const { 28983 documentLabel 28984 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 28985 const { 28986 getPostTypeLabel 28987 } = select(store_store); 28988 return { 28989 documentLabel: 28990 // translators: Default label for the Document sidebar tab, not selected. 28991 getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun, sidebar') 28992 }; 28993 }, []); 28994 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { 28995 ref: ref, 28996 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 28997 tabId: sidebars.document 28998 // Used for focus management in the SettingsSidebar component. 28999 , 29000 "data-tab-id": sidebars.document, 29001 children: documentLabel 29002 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 29003 tabId: sidebars.block 29004 // Used for focus management in the SettingsSidebar component. 29005 , 29006 "data-tab-id": sidebars.block, 29007 children: (0,external_wp_i18n_namespaceObject.__)('Block') 29008 })] 29009 }); 29010 }; 29011 /* harmony default export */ const sidebar_header = ((0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader)); 29012 29013 ;// ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js 29014 /** 29015 * WordPress dependencies 29016 */ 29017 29018 29019 29020 29021 29022 29023 29024 29025 /** 29026 * Internal dependencies 29027 */ 29028 29029 29030 29031 29032 const { 29033 BlockQuickNavigation 29034 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29035 const template_content_panel_POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content']; 29036 const TEMPLATE_PART_BLOCK = 'core/template-part'; 29037 function TemplateContentPanel() { 29038 const postContentBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_hooks_namespaceObject.applyFilters)('editor.postContentBlockTypes', template_content_panel_POST_CONTENT_BLOCK_TYPES), []); 29039 const { 29040 clientIds, 29041 postType, 29042 renderingMode 29043 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29044 const { 29045 getCurrentPostType, 29046 getPostBlocksByName, 29047 getRenderingMode 29048 } = unlock(select(store_store)); 29049 const _postType = getCurrentPostType(); 29050 return { 29051 postType: _postType, 29052 clientIds: getPostBlocksByName(TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes), 29053 renderingMode: getRenderingMode() 29054 }; 29055 }, [postContentBlockTypes]); 29056 const { 29057 enableComplementaryArea 29058 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 29059 if (renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE || clientIds.length === 0) { 29060 return null; 29061 } 29062 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 29063 title: (0,external_wp_i18n_namespaceObject.__)('Content'), 29064 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { 29065 clientIds: clientIds, 29066 onSelect: () => { 29067 enableComplementaryArea('core', 'edit-post/document'); 29068 } 29069 }) 29070 }); 29071 } 29072 29073 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-content-panel/index.js 29074 /** 29075 * WordPress dependencies 29076 */ 29077 29078 29079 29080 29081 29082 29083 29084 /** 29085 * Internal dependencies 29086 */ 29087 29088 29089 29090 29091 const { 29092 BlockQuickNavigation: template_part_content_panel_BlockQuickNavigation 29093 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29094 function TemplatePartContentPanelInner() { 29095 const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { 29096 const { 29097 getBlockTypes 29098 } = select(external_wp_blocks_namespaceObject.store); 29099 return getBlockTypes(); 29100 }, []); 29101 const themeBlockNames = (0,external_wp_element_namespaceObject.useMemo)(() => { 29102 return blockTypes.filter(blockType => { 29103 return blockType.category === 'theme'; 29104 }).map(({ 29105 name 29106 }) => name); 29107 }, [blockTypes]); 29108 const themeBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => { 29109 const { 29110 getBlocksByName 29111 } = select(external_wp_blockEditor_namespaceObject.store); 29112 return getBlocksByName(themeBlockNames); 29113 }, [themeBlockNames]); 29114 if (themeBlocks.length === 0) { 29115 return null; 29116 } 29117 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { 29118 title: (0,external_wp_i18n_namespaceObject.__)('Content'), 29119 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(template_part_content_panel_BlockQuickNavigation, { 29120 clientIds: themeBlocks 29121 }) 29122 }); 29123 } 29124 function TemplatePartContentPanel() { 29125 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { 29126 const { 29127 getCurrentPostType 29128 } = select(store_store); 29129 return getCurrentPostType(); 29130 }, []); 29131 if (postType !== TEMPLATE_PART_POST_TYPE) { 29132 return null; 29133 } 29134 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanelInner, {}); 29135 } 29136 29137 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js 29138 /** 29139 * WordPress dependencies 29140 */ 29141 29142 29143 29144 29145 29146 29147 /** 29148 * This listener hook monitors for block selection and triggers the appropriate 29149 * sidebar state. 29150 */ 29151 function useAutoSwitchEditorSidebars() { 29152 const { 29153 hasBlockSelection 29154 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29155 return { 29156 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 29157 }; 29158 }, []); 29159 const { 29160 getActiveComplementaryArea 29161 } = (0,external_wp_data_namespaceObject.useSelect)(store); 29162 const { 29163 enableComplementaryArea 29164 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 29165 const { 29166 get: getPreference 29167 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 29168 (0,external_wp_element_namespaceObject.useEffect)(() => { 29169 const activeGeneralSidebar = getActiveComplementaryArea('core'); 29170 const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 29171 const isDistractionFree = getPreference('core', 'distractionFree'); 29172 if (!isEditorSidebarOpened || isDistractionFree) { 29173 return; 29174 } 29175 if (hasBlockSelection) { 29176 enableComplementaryArea('core', 'edit-post/block'); 29177 } else { 29178 enableComplementaryArea('core', 'edit-post/document'); 29179 } 29180 }, [hasBlockSelection, getActiveComplementaryArea, enableComplementaryArea, getPreference]); 29181 } 29182 /* harmony default export */ const use_auto_switch_editor_sidebars = (useAutoSwitchEditorSidebars); 29183 29184 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js 29185 /** 29186 * WordPress dependencies 29187 */ 29188 29189 29190 29191 29192 29193 29194 29195 29196 29197 /** 29198 * Internal dependencies 29199 */ 29200 29201 29202 29203 29204 29205 29206 29207 29208 29209 29210 29211 29212 29213 29214 29215 29216 const { 29217 Tabs: sidebar_Tabs 29218 } = unlock(external_wp_components_namespaceObject.privateApis); 29219 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ 29220 web: true, 29221 native: false 29222 }); 29223 const SidebarContent = ({ 29224 tabName, 29225 keyboardShortcut, 29226 onActionPerformed, 29227 extraPanels 29228 }) => { 29229 const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); 29230 // Because `PluginSidebar` renders a `ComplementaryArea`, we 29231 // need to forward the `Tabs` context so it can be passed through the 29232 // underlying slot/fill. 29233 const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context); 29234 29235 // This effect addresses a race condition caused by tabbing from the last 29236 // block in the editor into the settings sidebar. Without this effect, the 29237 // selected tab and browser focus can become separated in an unexpected way 29238 // (e.g the "block" tab is focused, but the "post" tab is selected). 29239 (0,external_wp_element_namespaceObject.useEffect)(() => { 29240 const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []); 29241 const selectedTabElement = tabsElements.find( 29242 // We are purposefully using a custom `data-tab-id` attribute here 29243 // because we don't want rely on any assumptions about `Tabs` 29244 // component internals. 29245 element => element.getAttribute('data-tab-id') === tabName); 29246 const activeElement = selectedTabElement?.ownerDocument.activeElement; 29247 const tabsHasFocus = tabsElements.some(element => { 29248 return activeElement && activeElement.id === element.id; 29249 }); 29250 if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { 29251 selectedTabElement?.focus(); 29252 } 29253 }, [tabName]); 29254 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PluginSidebar, { 29255 identifier: tabName, 29256 header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, { 29257 value: tabsContextValue, 29258 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header, { 29259 ref: tabListRef 29260 }) 29261 }), 29262 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings') 29263 // This classname is added so we can apply a corrective negative 29264 // margin to the panel. 29265 // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049 29266 , 29267 className: "editor-sidebar__panel", 29268 headerClassName: "editor-sidebar__panel-tabs", 29269 title: /* translators: button label text should, if possible, be under 16 characters. */ 29270 (0,external_wp_i18n_namespaceObject._x)('Settings', 'sidebar button label'), 29271 toggleShortcut: keyboardShortcut, 29272 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 29273 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, 29274 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, { 29275 value: tabsContextValue, 29276 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, { 29277 tabId: sidebars.document, 29278 focusable: false, 29279 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, { 29280 onActionPerformed: onActionPerformed 29281 }), /*#__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)(post_taxonomies_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), extraPanels] 29282 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, { 29283 tabId: sidebars.block, 29284 focusable: false, 29285 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) 29286 })] 29287 }) 29288 }); 29289 }; 29290 const Sidebar = ({ 29291 extraPanels, 29292 onActionPerformed 29293 }) => { 29294 use_auto_switch_editor_sidebars(); 29295 const { 29296 tabName, 29297 keyboardShortcut, 29298 showSummary 29299 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29300 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/editor/toggle-sidebar'); 29301 const sidebar = select(store).getActiveComplementaryArea('core'); 29302 const _isEditorSidebarOpened = [sidebars.block, sidebars.document].includes(sidebar); 29303 let _tabName = sidebar; 29304 if (!_isEditorSidebarOpened) { 29305 _tabName = !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() ? sidebars.block : sidebars.document; 29306 } 29307 return { 29308 tabName: _tabName, 29309 keyboardShortcut: shortcut, 29310 showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(store_store).getCurrentPostType()) 29311 }; 29312 }, []); 29313 const { 29314 enableComplementaryArea 29315 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 29316 const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { 29317 if (!!newSelectedTabId) { 29318 enableComplementaryArea('core', newSelectedTabId); 29319 } 29320 }, [enableComplementaryArea]); 29321 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs, { 29322 selectedTabId: tabName, 29323 onSelect: onTabSelect, 29324 selectOnMove: false, 29325 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { 29326 tabName: tabName, 29327 keyboardShortcut: keyboardShortcut, 29328 showSummary: showSummary, 29329 onActionPerformed: onActionPerformed, 29330 extraPanels: extraPanels 29331 }) 29332 }); 29333 }; 29334 /* harmony default export */ const components_sidebar = (Sidebar); 29335 29336 ;// ./node_modules/@wordpress/editor/build-module/components/editor/index.js 29337 /** 29338 * WordPress dependencies 29339 */ 29340 29341 29342 29343 29344 29345 /** 29346 * Internal dependencies 29347 */ 29348 29349 29350 29351 29352 29353 29354 29355 function Editor({ 29356 postType, 29357 postId, 29358 templateId, 29359 settings, 29360 children, 29361 initialEdits, 29362 // This could be part of the settings. 29363 onActionPerformed, 29364 // The following abstractions are not ideal but necessary 29365 // to account for site editor and post editor differences for now. 29366 extraContent, 29367 extraSidebarPanels, 29368 ...props 29369 }) { 29370 const { 29371 post, 29372 template, 29373 hasLoadedPost 29374 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29375 const { 29376 getEntityRecord, 29377 hasFinishedResolution 29378 } = select(external_wp_coreData_namespaceObject.store); 29379 return { 29380 post: getEntityRecord('postType', postType, postId), 29381 template: templateId ? getEntityRecord('postType', TEMPLATE_POST_TYPE, templateId) : undefined, 29382 hasLoadedPost: hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) 29383 }; 29384 }, [postType, postId, templateId]); 29385 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29386 children: [hasLoadedPost && !post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { 29387 status: "warning", 29388 isDismissible: false, 29389 children: (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?") 29390 }), !!post && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalEditorProvider, { 29391 post: post, 29392 __unstableTemplate: template, 29393 settings: settings, 29394 initialEdits: initialEdits, 29395 useSubRegistry: false, 29396 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { 29397 ...props, 29398 children: extraContent 29399 }), children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_sidebar, { 29400 onActionPerformed: onActionPerformed, 29401 extraPanels: extraSidebarPanels 29402 })] 29403 })] 29404 }); 29405 } 29406 /* harmony default export */ const editor = (Editor); 29407 29408 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js 29409 /** 29410 * WordPress dependencies 29411 */ 29412 29413 29414 29415 29416 /** 29417 * Internal dependencies 29418 */ 29419 29420 29421 const { 29422 PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption 29423 } = unlock(external_wp_preferences_namespaceObject.privateApis); 29424 /* harmony default export */ const enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ 29425 isChecked: select(store_store).isPublishSidebarEnabled() 29426 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 29427 const { 29428 enablePublishSidebar, 29429 disablePublishSidebar 29430 } = dispatch(store_store); 29431 return { 29432 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar() 29433 }; 29434 }))(enable_publish_sidebar_PreferenceBaseOption)); 29435 29436 ;// ./node_modules/@wordpress/editor/build-module/components/block-manager/checklist.js 29437 /** 29438 * WordPress dependencies 29439 */ 29440 29441 29442 29443 29444 function BlockTypesChecklist({ 29445 blockTypes, 29446 value, 29447 onItemChange 29448 }) { 29449 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { 29450 className: "editor-block-manager__checklist", 29451 children: blockTypes.map(blockType => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { 29452 className: "editor-block-manager__checklist-item", 29453 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 29454 __nextHasNoMarginBottom: true, 29455 label: blockType.title, 29456 checked: value.includes(blockType.name), 29457 onChange: (...args) => onItemChange(blockType.name, ...args) 29458 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { 29459 icon: blockType.icon 29460 })] 29461 }, blockType.name)) 29462 }); 29463 } 29464 /* harmony default export */ const checklist = (BlockTypesChecklist); 29465 29466 ;// ./node_modules/@wordpress/editor/build-module/components/block-manager/category.js 29467 /** 29468 * WordPress dependencies 29469 */ 29470 29471 29472 29473 29474 29475 29476 /** 29477 * Internal dependencies 29478 */ 29479 29480 29481 29482 29483 29484 function BlockManagerCategory({ 29485 title, 29486 blockTypes 29487 }) { 29488 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); 29489 const { 29490 allowedBlockTypes, 29491 hiddenBlockTypes 29492 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29493 const { 29494 getEditorSettings 29495 } = select(store_store); 29496 const { 29497 get 29498 } = select(external_wp_preferences_namespaceObject.store); 29499 return { 29500 allowedBlockTypes: getEditorSettings().allowedBlockTypes, 29501 hiddenBlockTypes: get('core', 'hiddenBlockTypes') 29502 }; 29503 }, []); 29504 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 29505 if (allowedBlockTypes === true) { 29506 return blockTypes; 29507 } 29508 return blockTypes.filter(({ 29509 name 29510 }) => { 29511 return allowedBlockTypes?.includes(name); 29512 }); 29513 }, [allowedBlockTypes, blockTypes]); 29514 const { 29515 showBlockTypes, 29516 hideBlockTypes 29517 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 29518 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => { 29519 if (nextIsChecked) { 29520 showBlockTypes(blockName); 29521 } else { 29522 hideBlockTypes(blockName); 29523 } 29524 }, [showBlockTypes, hideBlockTypes]); 29525 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => { 29526 const blockNames = blockTypes.map(({ 29527 name 29528 }) => name); 29529 if (nextIsChecked) { 29530 showBlockTypes(blockNames); 29531 } else { 29532 hideBlockTypes(blockNames); 29533 } 29534 }, [blockTypes, showBlockTypes, hideBlockTypes]); 29535 if (!filteredBlockTypes.length) { 29536 return null; 29537 } 29538 const checkedBlockNames = filteredBlockTypes.map(({ 29539 name 29540 }) => name).filter(type => !(hiddenBlockTypes !== null && hiddenBlockTypes !== void 0 ? hiddenBlockTypes : []).includes(type)); 29541 const titleId = 'editor-block-manager__category-title-' + instanceId; 29542 const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length; 29543 const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0; 29544 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 29545 role: "group", 29546 "aria-labelledby": titleId, 29547 className: "editor-block-manager__category", 29548 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { 29549 __nextHasNoMarginBottom: true, 29550 checked: isAllChecked, 29551 onChange: toggleAllVisible, 29552 className: "editor-block-manager__category-title", 29553 indeterminate: isIndeterminate, 29554 label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { 29555 id: titleId, 29556 children: title 29557 }) 29558 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(checklist, { 29559 blockTypes: filteredBlockTypes, 29560 value: checkedBlockNames, 29561 onItemChange: toggleVisible 29562 })] 29563 }); 29564 } 29565 /* harmony default export */ const block_manager_category = (BlockManagerCategory); 29566 29567 ;// ./node_modules/@wordpress/editor/build-module/components/block-manager/index.js 29568 /** 29569 * WordPress dependencies 29570 */ 29571 29572 29573 29574 29575 29576 29577 29578 29579 29580 /** 29581 * Internal dependencies 29582 */ 29583 29584 29585 29586 29587 29588 function BlockManager() { 29589 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 29590 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); 29591 const { 29592 showBlockTypes 29593 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 29594 const { 29595 blockTypes, 29596 categories, 29597 hasBlockSupport, 29598 isMatchingSearchTerm, 29599 numberOfHiddenBlocks 29600 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 29601 var _select$get; 29602 // Some hidden blocks become unregistered 29603 // by removing for instance the plugin that registered them, yet 29604 // they're still remain as hidden by the user's action. 29605 // We consider "hidden", blocks which were hidden and 29606 // are still registered. 29607 const _blockTypes = select(external_wp_blocks_namespaceObject.store).getBlockTypes(); 29608 const hiddenBlockTypes = ((_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : []).filter(hiddenBlock => { 29609 return _blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock); 29610 }); 29611 return { 29612 blockTypes: _blockTypes, 29613 categories: select(external_wp_blocks_namespaceObject.store).getCategories(), 29614 hasBlockSupport: select(external_wp_blocks_namespaceObject.store).hasBlockSupport, 29615 isMatchingSearchTerm: select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm, 29616 numberOfHiddenBlocks: Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length 29617 }; 29618 }, []); 29619 function enableAllBlockTypes(newBlockTypes) { 29620 const blockNames = newBlockTypes.map(({ 29621 name 29622 }) => name); 29623 showBlockTypes(blockNames); 29624 } 29625 const filteredBlockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content'))); 29626 29627 // Announce search results on change 29628 (0,external_wp_element_namespaceObject.useEffect)(() => { 29629 if (!search) { 29630 return; 29631 } 29632 const count = filteredBlockTypes.length; 29633 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ 29634 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); 29635 debouncedSpeak(resultsFoundMessage); 29636 }, [filteredBlockTypes?.length, search, debouncedSpeak]); 29637 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 29638 className: "editor-block-manager__content", 29639 children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 29640 className: "editor-block-manager__disabled-blocks-count", 29641 children: [(0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */ 29642 (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 29643 __next40pxDefaultSize: true, 29644 variant: "link", 29645 onClick: () => enableAllBlockTypes(filteredBlockTypes), 29646 children: (0,external_wp_i18n_namespaceObject.__)('Reset') 29647 })] 29648 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { 29649 __nextHasNoMarginBottom: true, 29650 label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), 29651 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), 29652 value: search, 29653 onChange: nextSearch => setSearch(nextSearch), 29654 className: "editor-block-manager__search" 29655 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 29656 tabIndex: "0", 29657 role: "region", 29658 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'), 29659 className: "editor-block-manager__results", 29660 children: [filteredBlockTypes.length === 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 29661 className: "editor-block-manager__no-results", 29662 children: (0,external_wp_i18n_namespaceObject.__)('No blocks found.') 29663 }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, { 29664 title: category.title, 29665 blockTypes: filteredBlockTypes.filter(blockType => blockType.category === category.slug) 29666 }, category.slug)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_manager_category, { 29667 title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), 29668 blockTypes: filteredBlockTypes.filter(({ 29669 category 29670 }) => !category) 29671 })] 29672 })] 29673 }); 29674 } 29675 29676 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js 29677 /** 29678 * WordPress dependencies 29679 */ 29680 29681 29682 29683 29684 29685 29686 29687 29688 /** 29689 * Internal dependencies 29690 */ 29691 29692 29693 29694 29695 29696 29697 29698 29699 29700 29701 29702 29703 29704 29705 29706 const { 29707 PreferencesModal, 29708 PreferencesModalTabs, 29709 PreferencesModalSection, 29710 PreferenceToggleControl 29711 } = unlock(external_wp_preferences_namespaceObject.privateApis); 29712 function EditorPreferencesModal({ 29713 extraSections = {} 29714 }) { 29715 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => { 29716 return select(store).isModalActive('editor/preferences'); 29717 }, []); 29718 const { 29719 closeModal 29720 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 29721 if (!isActive) { 29722 return null; 29723 } 29724 29725 // Please wrap all contents inside PreferencesModalContents to prevent all 29726 // hooks from executing when the modal is not open. 29727 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { 29728 closeModal: closeModal, 29729 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalContents, { 29730 extraSections: extraSections 29731 }) 29732 }); 29733 } 29734 function PreferencesModalContents({ 29735 extraSections = {} 29736 }) { 29737 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 29738 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => { 29739 const { 29740 getEditorSettings 29741 } = select(store_store); 29742 const { 29743 get 29744 } = select(external_wp_preferences_namespaceObject.store); 29745 const isRichEditingEnabled = getEditorSettings().richEditingEnabled; 29746 const isDistractionFreeEnabled = get('core', 'distractionFree'); 29747 return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled; 29748 }, [isLargeViewport]); 29749 const { 29750 setIsListViewOpened, 29751 setIsInserterOpened 29752 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 29753 const { 29754 set: setPreference 29755 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 29756 const hasStarterPatterns = !!useStartPatterns().length; 29757 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ 29758 name: 'general', 29759 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), 29760 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29761 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 29762 title: (0,external_wp_i18n_namespaceObject.__)('Interface'), 29763 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29764 scope: "core", 29765 featureName: "showListViewByDefault", 29766 help: (0,external_wp_i18n_namespaceObject.__)('Opens the List View sidebar by default.'), 29767 label: (0,external_wp_i18n_namespaceObject.__)('Always open List View') 29768 }), showBlockBreadcrumbsOption && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29769 scope: "core", 29770 featureName: "showBlockBreadcrumbs", 29771 help: (0,external_wp_i18n_namespaceObject.__)('Display the block hierarchy trail at the bottom of the editor.'), 29772 label: (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs') 29773 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29774 scope: "core", 29775 featureName: "allowRightClickOverrides", 29776 help: (0,external_wp_i18n_namespaceObject.__)('Allows contextual List View menus via right-click, overriding browser defaults.'), 29777 label: (0,external_wp_i18n_namespaceObject.__)('Allow right-click contextual menus') 29778 }), hasStarterPatterns && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29779 scope: "core", 29780 featureName: "enableChoosePatternModal", 29781 help: (0,external_wp_i18n_namespaceObject.__)('Shows starter patterns when creating a new page.'), 29782 label: (0,external_wp_i18n_namespaceObject.__)('Show starter patterns') 29783 })] 29784 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 29785 title: (0,external_wp_i18n_namespaceObject.__)('Document settings'), 29786 description: (0,external_wp_i18n_namespaceObject.__)('Select what settings are shown in the document panel.'), 29787 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_taxonomies, { 29788 taxonomyWrapper: (content, taxonomy) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 29789 label: taxonomy.labels.menu_name, 29790 panelName: `taxonomy-panel-$taxonomy.slug}` 29791 }) 29792 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check, { 29793 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 29794 label: (0,external_wp_i18n_namespaceObject.__)('Featured image'), 29795 panelName: "featured-image" 29796 }) 29797 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, { 29798 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 29799 label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), 29800 panelName: "post-excerpt" 29801 }) 29802 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, { 29803 supportKeys: ['comments', 'trackbacks'], 29804 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 29805 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), 29806 panelName: "discussion-panel" 29807 }) 29808 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, { 29809 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 29810 label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'), 29811 panelName: "page-attributes" 29812 }) 29813 })] 29814 }), isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 29815 title: (0,external_wp_i18n_namespaceObject.__)('Publishing'), 29816 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_publish_sidebar, { 29817 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), 29818 label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks') 29819 }) 29820 }), extraSections?.general] 29821 }) 29822 }, { 29823 name: 'appearance', 29824 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 29825 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 29826 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), 29827 description: (0,external_wp_i18n_namespaceObject.__)('Customize the editor interface to suit your needs.'), 29828 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29829 scope: "core", 29830 featureName: "fixedToolbar", 29831 onToggle: () => setPreference('core', 'distractionFree', false), 29832 help: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place.'), 29833 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar') 29834 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29835 scope: "core", 29836 featureName: "distractionFree", 29837 onToggle: () => { 29838 setPreference('core', 'fixedToolbar', true); 29839 setIsInserterOpened(false); 29840 setIsListViewOpened(false); 29841 }, 29842 help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'), 29843 label: (0,external_wp_i18n_namespaceObject.__)('Distraction free') 29844 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29845 scope: "core", 29846 featureName: "focusMode", 29847 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), 29848 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') 29849 }), extraSections?.appearance] 29850 }) 29851 }, { 29852 name: 'accessibility', 29853 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Accessibility'), 29854 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29855 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 29856 title: (0,external_wp_i18n_namespaceObject.__)('Navigation'), 29857 description: (0,external_wp_i18n_namespaceObject.__)('Optimize the editing experience for enhanced control.'), 29858 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29859 scope: "core", 29860 featureName: "keepCaretInsideBlock", 29861 help: (0,external_wp_i18n_namespaceObject.__)('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'), 29862 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') 29863 }) 29864 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 29865 title: (0,external_wp_i18n_namespaceObject.__)('Interface'), 29866 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29867 scope: "core", 29868 featureName: "showIconLabels", 29869 label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), 29870 help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons across the interface.') 29871 }) 29872 })] 29873 }) 29874 }, { 29875 name: 'blocks', 29876 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), 29877 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29878 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 29879 title: (0,external_wp_i18n_namespaceObject.__)('Inserter'), 29880 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29881 scope: "core", 29882 featureName: "mostUsedBlocks", 29883 help: (0,external_wp_i18n_namespaceObject.__)('Adds a category with the most frequently used blocks in the inserter.'), 29884 label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks') 29885 }) 29886 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { 29887 title: (0,external_wp_i18n_namespaceObject.__)('Manage block visibility'), 29888 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."), 29889 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockManager, {}) 29890 })] 29891 }) 29892 }, window.__experimentalMediaProcessing && { 29893 name: 'media', 29894 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Media'), 29895 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 29896 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 29897 title: (0,external_wp_i18n_namespaceObject.__)('General'), 29898 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the media upload flow.'), 29899 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29900 scope: "core/media", 29901 featureName: "optimizeOnUpload", 29902 help: (0,external_wp_i18n_namespaceObject.__)('Compress media items before uploading to the server.'), 29903 label: (0,external_wp_i18n_namespaceObject.__)('Pre-upload compression') 29904 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 29905 scope: "core/media", 29906 featureName: "requireApproval", 29907 help: (0,external_wp_i18n_namespaceObject.__)('Require approval step when optimizing existing media.'), 29908 label: (0,external_wp_i18n_namespaceObject.__)('Approval step') 29909 })] 29910 }) 29911 }) 29912 }].filter(Boolean), [showBlockBreadcrumbsOption, extraSections, setIsInserterOpened, setIsListViewOpened, setPreference, isLargeViewport, hasStarterPatterns]); 29913 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, { 29914 sections: sections 29915 }); 29916 } 29917 29918 ;// ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js 29919 /** 29920 * WordPress dependencies 29921 */ 29922 29923 const CONTENT = 'content'; 29924 /* harmony default export */ const pattern_overrides = ({ 29925 name: 'core/pattern-overrides', 29926 getValues({ 29927 select, 29928 clientId, 29929 context, 29930 bindings 29931 }) { 29932 const patternOverridesContent = context['pattern/overrides']; 29933 const { 29934 getBlockAttributes 29935 } = select(external_wp_blockEditor_namespaceObject.store); 29936 const currentBlockAttributes = getBlockAttributes(clientId); 29937 const overridesValues = {}; 29938 for (const attributeName of Object.keys(bindings)) { 29939 const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; 29940 29941 // If it has not been overriden, return the original value. 29942 // Check undefined because empty string is a valid value. 29943 if (overridableValue === undefined) { 29944 overridesValues[attributeName] = currentBlockAttributes[attributeName]; 29945 continue; 29946 } else { 29947 overridesValues[attributeName] = overridableValue === '' ? undefined : overridableValue; 29948 } 29949 } 29950 return overridesValues; 29951 }, 29952 setValues({ 29953 select, 29954 dispatch, 29955 clientId, 29956 bindings 29957 }) { 29958 const { 29959 getBlockAttributes, 29960 getBlockParentsByBlockName, 29961 getBlocks 29962 } = select(external_wp_blockEditor_namespaceObject.store); 29963 const currentBlockAttributes = getBlockAttributes(clientId); 29964 const blockName = currentBlockAttributes?.metadata?.name; 29965 if (!blockName) { 29966 return; 29967 } 29968 const [patternClientId] = getBlockParentsByBlockName(clientId, 'core/block', true); 29969 29970 // Extract the updated attributes from the source bindings. 29971 const attributes = Object.entries(bindings).reduce((attrs, [key, { 29972 newValue 29973 }]) => { 29974 attrs[key] = newValue; 29975 return attrs; 29976 }, {}); 29977 29978 // If there is no pattern client ID, sync blocks with the same name and same attributes. 29979 if (!patternClientId) { 29980 const syncBlocksWithSameName = blocks => { 29981 for (const block of blocks) { 29982 if (block.attributes?.metadata?.name === blockName) { 29983 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(block.clientId, attributes); 29984 } 29985 syncBlocksWithSameName(block.innerBlocks); 29986 } 29987 }; 29988 syncBlocksWithSameName(getBlocks()); 29989 return; 29990 } 29991 const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; 29992 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { 29993 [CONTENT]: { 29994 ...currentBindingValue, 29995 [blockName]: { 29996 ...currentBindingValue?.[blockName], 29997 ...Object.entries(attributes).reduce((acc, [key, value]) => { 29998 // TODO: We need a way to represent `undefined` in the serialized overrides. 29999 // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871 30000 // We use an empty string to represent undefined for now until 30001 // we support a richer format for overrides and the block bindings API. 30002 acc[key] = value === undefined ? '' : value; 30003 return acc; 30004 }, {}) 30005 } 30006 } 30007 }); 30008 }, 30009 canUserEditValue: () => true 30010 }); 30011 30012 ;// ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js 30013 /** 30014 * WordPress dependencies 30015 */ 30016 30017 30018 /** 30019 * Internal dependencies 30020 */ 30021 30022 30023 30024 /** 30025 * Gets a list of post meta fields with their values and labels 30026 * to be consumed in the needed callbacks. 30027 * If the value is not available based on context, like in templates, 30028 * it falls back to the default value, label, or key. 30029 * 30030 * @param {Object} select The select function from the data store. 30031 * @param {Object} context The context provided. 30032 * @return {Object} List of post meta fields with their value and label. 30033 * 30034 * @example 30035 * ```js 30036 * { 30037 * field_1_key: { 30038 * label: 'Field 1 Label', 30039 * value: 'Field 1 Value', 30040 * }, 30041 * field_2_key: { 30042 * label: 'Field 2 Label', 30043 * value: 'Field 2 Value', 30044 * }, 30045 * ... 30046 * } 30047 * ``` 30048 */ 30049 function getPostMetaFields(select, context) { 30050 const { 30051 getEditedEntityRecord 30052 } = select(external_wp_coreData_namespaceObject.store); 30053 const { 30054 getRegisteredPostMeta 30055 } = unlock(select(external_wp_coreData_namespaceObject.store)); 30056 let entityMetaValues; 30057 // Try to get the current entity meta values. 30058 if (context?.postType && context?.postId) { 30059 entityMetaValues = getEditedEntityRecord('postType', context?.postType, context?.postId).meta; 30060 } 30061 const registeredFields = getRegisteredPostMeta(context?.postType); 30062 const metaFields = {}; 30063 Object.entries(registeredFields || {}).forEach(([key, props]) => { 30064 // Don't include footnotes or private fields. 30065 if (key !== 'footnotes' && key.charAt(0) !== '_') { 30066 var _entityMetaValues$key; 30067 metaFields[key] = { 30068 label: props.title || key, 30069 value: // When using the entity value, an empty string IS a valid value. 30070 (_entityMetaValues$key = entityMetaValues?.[key]) !== null && _entityMetaValues$key !== void 0 ? _entityMetaValues$key : 30071 // When using the default, an empty string IS NOT a valid value. 30072 props.default || undefined, 30073 type: props.type 30074 }; 30075 } 30076 }); 30077 if (!Object.keys(metaFields || {}).length) { 30078 return null; 30079 } 30080 return metaFields; 30081 } 30082 /* harmony default export */ const post_meta = ({ 30083 name: 'core/post-meta', 30084 getValues({ 30085 select, 30086 context, 30087 bindings 30088 }) { 30089 const metaFields = getPostMetaFields(select, context); 30090 const newValues = {}; 30091 for (const [attributeName, source] of Object.entries(bindings)) { 30092 var _ref; 30093 // Use the value, the field label, or the field key. 30094 const fieldKey = source.args.key; 30095 const { 30096 value: fieldValue, 30097 label: fieldLabel 30098 } = metaFields?.[fieldKey] || {}; 30099 newValues[attributeName] = (_ref = fieldValue !== null && fieldValue !== void 0 ? fieldValue : fieldLabel) !== null && _ref !== void 0 ? _ref : fieldKey; 30100 } 30101 return newValues; 30102 }, 30103 setValues({ 30104 dispatch, 30105 context, 30106 bindings 30107 }) { 30108 const newMeta = {}; 30109 Object.values(bindings).forEach(({ 30110 args, 30111 newValue 30112 }) => { 30113 newMeta[args.key] = newValue; 30114 }); 30115 dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', context?.postType, context?.postId, { 30116 meta: newMeta 30117 }); 30118 }, 30119 canUserEditValue({ 30120 select, 30121 context, 30122 args 30123 }) { 30124 // Lock editing in query loop. 30125 if (context?.query || context?.queryId) { 30126 return false; 30127 } 30128 const postType = context?.postType || select(store_store).getCurrentPostType(); 30129 30130 // Check that editing is happening in the post editor and not a template. 30131 if (postType === 'wp_template') { 30132 return false; 30133 } 30134 const fieldValue = getPostMetaFields(select, context)?.[args.key]?.value; 30135 // Empty string or `false` could be a valid value, so we need to check if the field value is undefined. 30136 if (fieldValue === undefined) { 30137 return false; 30138 } 30139 // Check that custom fields metabox is not enabled. 30140 const areCustomFieldsEnabled = select(store_store).getEditorSettings().enableCustomFields; 30141 if (areCustomFieldsEnabled) { 30142 return false; 30143 } 30144 30145 // Check that the user has the capability to edit post meta. 30146 const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser('update', { 30147 kind: 'postType', 30148 name: context?.postType, 30149 id: context?.postId 30150 }); 30151 if (!canUserEdit) { 30152 return false; 30153 } 30154 return true; 30155 }, 30156 getFieldsList({ 30157 select, 30158 context 30159 }) { 30160 return getPostMetaFields(select, context); 30161 } 30162 }); 30163 30164 ;// ./node_modules/@wordpress/editor/build-module/bindings/api.js 30165 /** 30166 * WordPress dependencies 30167 */ 30168 30169 30170 /** 30171 * Internal dependencies 30172 */ 30173 30174 30175 30176 /** 30177 * Function to register core block bindings sources provided by the editor. 30178 * 30179 * @example 30180 * ```js 30181 * import { registerCoreBlockBindingsSources } from '@wordpress/editor'; 30182 * 30183 * registerCoreBlockBindingsSources(); 30184 * ``` 30185 */ 30186 function registerCoreBlockBindingsSources() { 30187 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(pattern_overrides); 30188 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_meta); 30189 } 30190 30191 ;// ./node_modules/@wordpress/editor/build-module/private-apis.js 30192 /** 30193 * WordPress dependencies 30194 */ 30195 30196 30197 /** 30198 * Internal dependencies 30199 */ 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 30211 30212 30213 30214 30215 const { 30216 store: interfaceStore, 30217 ...remainingInterfaceApis 30218 } = build_module_namespaceObject; 30219 const privateApis = {}; 30220 lock(privateApis, { 30221 CreateTemplatePartModal: CreateTemplatePartModal, 30222 BackButton: back_button, 30223 EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible, 30224 Editor: editor, 30225 EditorContentSlotFill: content_slot_fill, 30226 GlobalStylesProvider: GlobalStylesProvider, 30227 mergeBaseAndUserConfigs: mergeBaseAndUserConfigs, 30228 PluginPostExcerpt: post_excerpt_plugin, 30229 PostCardPanel: PostCardPanel, 30230 PreferencesModal: EditorPreferencesModal, 30231 usePostActions: usePostActions, 30232 ToolsMoreMenuGroup: tools_more_menu_group, 30233 ViewMoreMenuGroup: view_more_menu_group, 30234 ResizableEditor: resizable_editor, 30235 registerCoreBlockBindingsSources: registerCoreBlockBindingsSources, 30236 // This is a temporary private API while we're updating the site editor to use EditorProvider. 30237 interfaceStore, 30238 ...remainingInterfaceApis 30239 }); 30240 30241 ;// ./node_modules/@wordpress/editor/build-module/dataviews/api.js 30242 /** 30243 * WordPress dependencies 30244 */ 30245 30246 30247 /** 30248 * Internal dependencies 30249 */ 30250 30251 30252 30253 /** 30254 * @typedef {import('@wordpress/dataviews').Action} Action 30255 */ 30256 30257 /** 30258 * Registers a new DataViews action. 30259 * 30260 * This is an experimental API and is subject to change. 30261 * it's only available in the Gutenberg plugin for now. 30262 * 30263 * @param {string} kind Entity kind. 30264 * @param {string} name Entity name. 30265 * @param {Action} config Action configuration. 30266 */ 30267 30268 function api_registerEntityAction(kind, name, config) { 30269 const { 30270 registerEntityAction: _registerEntityAction 30271 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 30272 if (false) {} 30273 } 30274 30275 /** 30276 * Unregisters a DataViews action. 30277 * 30278 * This is an experimental API and is subject to change. 30279 * it's only available in the Gutenberg plugin for now. 30280 * 30281 * @param {string} kind Entity kind. 30282 * @param {string} name Entity name. 30283 * @param {string} actionId Action ID. 30284 */ 30285 function api_unregisterEntityAction(kind, name, actionId) { 30286 const { 30287 unregisterEntityAction: _unregisterEntityAction 30288 } = unlock((0,external_wp_data_namespaceObject.dispatch)(store_store)); 30289 if (false) {} 30290 } 30291 30292 ;// ./node_modules/@wordpress/editor/build-module/index.js 30293 /** 30294 * Internal dependencies 30295 */ 30296 30297 30298 30299 30300 30301 30302 30303 /* 30304 * Backward compatibility 30305 */ 30306 30307 30308 })(); 30309 30310 (window.wp = window.wp || {}).editor = __webpack_exports__; 30311 /******/ })() 30312 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |