[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> core-data.js (source)

   1  "use strict";
   2  var wp;
   3  (wp ||= {}).coreData = (() => {
   4    var __create = Object.create;
   5    var __defProp = Object.defineProperty;
   6    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   7    var __getOwnPropNames = Object.getOwnPropertyNames;
   8    var __getProtoOf = Object.getPrototypeOf;
   9    var __hasOwnProp = Object.prototype.hasOwnProperty;
  10    var __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to, key) && key !== except)
  21            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // package-external:@wordpress/data
  36    var require_data = __commonJS({
  37      "package-external:@wordpress/data"(exports, module) {
  38        module.exports = window.wp.data;
  39      }
  40    });
  41  
  42    // node_modules/fast-deep-equal/es6/index.js
  43    var require_es6 = __commonJS({
  44      "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
  45        "use strict";
  46        module.exports = function equal(a, b) {
  47          if (a === b) return true;
  48          if (a && b && typeof a == "object" && typeof b == "object") {
  49            if (a.constructor !== b.constructor) return false;
  50            var length, i, keys;
  51            if (Array.isArray(a)) {
  52              length = a.length;
  53              if (length != b.length) return false;
  54              for (i = length; i-- !== 0; )
  55                if (!equal(a[i], b[i])) return false;
  56              return true;
  57            }
  58            if (a instanceof Map && b instanceof Map) {
  59              if (a.size !== b.size) return false;
  60              for (i of a.entries())
  61                if (!b.has(i[0])) return false;
  62              for (i of a.entries())
  63                if (!equal(i[1], b.get(i[0]))) return false;
  64              return true;
  65            }
  66            if (a instanceof Set && b instanceof Set) {
  67              if (a.size !== b.size) return false;
  68              for (i of a.entries())
  69                if (!b.has(i[0])) return false;
  70              return true;
  71            }
  72            if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
  73              length = a.length;
  74              if (length != b.length) return false;
  75              for (i = length; i-- !== 0; )
  76                if (a[i] !== b[i]) return false;
  77              return true;
  78            }
  79            if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
  80            if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
  81            if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
  82            keys = Object.keys(a);
  83            length = keys.length;
  84            if (length !== Object.keys(b).length) return false;
  85            for (i = length; i-- !== 0; )
  86              if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
  87            for (i = length; i-- !== 0; ) {
  88              var key = keys[i];
  89              if (!equal(a[key], b[key])) return false;
  90            }
  91            return true;
  92          }
  93          return a !== a && b !== b;
  94        };
  95      }
  96    });
  97  
  98    // package-external:@wordpress/compose
  99    var require_compose = __commonJS({
 100      "package-external:@wordpress/compose"(exports, module) {
 101        module.exports = window.wp.compose;
 102      }
 103    });
 104  
 105    // package-external:@wordpress/undo-manager
 106    var require_undo_manager = __commonJS({
 107      "package-external:@wordpress/undo-manager"(exports, module) {
 108        module.exports = window.wp.undoManager;
 109      }
 110    });
 111  
 112    // node_modules/equivalent-key-map/equivalent-key-map.js
 113    var require_equivalent_key_map = __commonJS({
 114      "node_modules/equivalent-key-map/equivalent-key-map.js"(exports, module) {
 115        "use strict";
 116        function _typeof(obj) {
 117          if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 118            _typeof = function(obj2) {
 119              return typeof obj2;
 120            };
 121          } else {
 122            _typeof = function(obj2) {
 123              return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
 124            };
 125          }
 126          return _typeof(obj);
 127        }
 128        function _classCallCheck(instance, Constructor) {
 129          if (!(instance instanceof Constructor)) {
 130            throw new TypeError("Cannot call a class as a function");
 131          }
 132        }
 133        function _defineProperties(target, props) {
 134          for (var i = 0; i < props.length; i++) {
 135            var descriptor = props[i];
 136            descriptor.enumerable = descriptor.enumerable || false;
 137            descriptor.configurable = true;
 138            if ("value" in descriptor) descriptor.writable = true;
 139            Object.defineProperty(target, descriptor.key, descriptor);
 140          }
 141        }
 142        function _createClass(Constructor, protoProps, staticProps) {
 143          if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 144          if (staticProps) _defineProperties(Constructor, staticProps);
 145          return Constructor;
 146        }
 147        function getValuePair(instance, key) {
 148          var _map = instance._map, _arrayTreeMap = instance._arrayTreeMap, _objectTreeMap = instance._objectTreeMap;
 149          if (_map.has(key)) {
 150            return _map.get(key);
 151          }
 152          var properties = Object.keys(key).sort();
 153          var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
 154          for (var i = 0; i < properties.length; i++) {
 155            var property = properties[i];
 156            map = map.get(property);
 157            if (map === void 0) {
 158              return;
 159            }
 160            var propertyValue = key[property];
 161            map = map.get(propertyValue);
 162            if (map === void 0) {
 163              return;
 164            }
 165          }
 166          var valuePair = map.get("_ekm_value");
 167          if (!valuePair) {
 168            return;
 169          }
 170          _map.delete(valuePair[0]);
 171          valuePair[0] = key;
 172          map.set("_ekm_value", valuePair);
 173          _map.set(key, valuePair);
 174          return valuePair;
 175        }
 176        var EquivalentKeyMap2 = /* @__PURE__ */ (function() {
 177          function EquivalentKeyMap3(iterable) {
 178            _classCallCheck(this, EquivalentKeyMap3);
 179            this.clear();
 180            if (iterable instanceof EquivalentKeyMap3) {
 181              var iterablePairs = [];
 182              iterable.forEach(function(value, key) {
 183                iterablePairs.push([key, value]);
 184              });
 185              iterable = iterablePairs;
 186            }
 187            if (iterable != null) {
 188              for (var i = 0; i < iterable.length; i++) {
 189                this.set(iterable[i][0], iterable[i][1]);
 190              }
 191            }
 192          }
 193          _createClass(EquivalentKeyMap3, [{
 194            key: "set",
 195            /**
 196             * Add or update an element with a specified key and value.
 197             *
 198             * @param {*} key   The key of the element to add.
 199             * @param {*} value The value of the element to add.
 200             *
 201             * @return {EquivalentKeyMap} Map instance.
 202             */
 203            value: function set(key, value) {
 204              if (key === null || _typeof(key) !== "object") {
 205                this._map.set(key, value);
 206                return this;
 207              }
 208              var properties = Object.keys(key).sort();
 209              var valuePair = [key, value];
 210              var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
 211              for (var i = 0; i < properties.length; i++) {
 212                var property = properties[i];
 213                if (!map.has(property)) {
 214                  map.set(property, new EquivalentKeyMap3());
 215                }
 216                map = map.get(property);
 217                var propertyValue = key[property];
 218                if (!map.has(propertyValue)) {
 219                  map.set(propertyValue, new EquivalentKeyMap3());
 220                }
 221                map = map.get(propertyValue);
 222              }
 223              var previousValuePair = map.get("_ekm_value");
 224              if (previousValuePair) {
 225                this._map.delete(previousValuePair[0]);
 226              }
 227              map.set("_ekm_value", valuePair);
 228              this._map.set(key, valuePair);
 229              return this;
 230            }
 231            /**
 232             * Returns a specified element.
 233             *
 234             * @param {*} key The key of the element to return.
 235             *
 236             * @return {?*} The element associated with the specified key or undefined
 237             *              if the key can't be found.
 238             */
 239          }, {
 240            key: "get",
 241            value: function get(key) {
 242              if (key === null || _typeof(key) !== "object") {
 243                return this._map.get(key);
 244              }
 245              var valuePair = getValuePair(this, key);
 246              if (valuePair) {
 247                return valuePair[1];
 248              }
 249            }
 250            /**
 251             * Returns a boolean indicating whether an element with the specified key
 252             * exists or not.
 253             *
 254             * @param {*} key The key of the element to test for presence.
 255             *
 256             * @return {boolean} Whether an element with the specified key exists.
 257             */
 258          }, {
 259            key: "has",
 260            value: function has(key) {
 261              if (key === null || _typeof(key) !== "object") {
 262                return this._map.has(key);
 263              }
 264              return getValuePair(this, key) !== void 0;
 265            }
 266            /**
 267             * Removes the specified element.
 268             *
 269             * @param {*} key The key of the element to remove.
 270             *
 271             * @return {boolean} Returns true if an element existed and has been
 272             *                   removed, or false if the element does not exist.
 273             */
 274          }, {
 275            key: "delete",
 276            value: function _delete(key) {
 277              if (!this.has(key)) {
 278                return false;
 279              }
 280              this.set(key, void 0);
 281              return true;
 282            }
 283            /**
 284             * Executes a provided function once per each key/value pair, in insertion
 285             * order.
 286             *
 287             * @param {Function} callback Function to execute for each element.
 288             * @param {*}        thisArg  Value to use as `this` when executing
 289             *                            `callback`.
 290             */
 291          }, {
 292            key: "forEach",
 293            value: function forEach(callback) {
 294              var _this = this;
 295              var thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this;
 296              this._map.forEach(function(value, key) {
 297                if (key !== null && _typeof(key) === "object") {
 298                  value = value[1];
 299                }
 300                callback.call(thisArg, value, key, _this);
 301              });
 302            }
 303            /**
 304             * Removes all elements.
 305             */
 306          }, {
 307            key: "clear",
 308            value: function clear() {
 309              this._map = /* @__PURE__ */ new Map();
 310              this._arrayTreeMap = /* @__PURE__ */ new Map();
 311              this._objectTreeMap = /* @__PURE__ */ new Map();
 312            }
 313          }, {
 314            key: "size",
 315            get: function get() {
 316              return this._map.size;
 317            }
 318          }]);
 319          return EquivalentKeyMap3;
 320        })();
 321        module.exports = EquivalentKeyMap2;
 322      }
 323    });
 324  
 325    // package-external:@wordpress/url
 326    var require_url = __commonJS({
 327      "package-external:@wordpress/url"(exports, module) {
 328        module.exports = window.wp.url;
 329      }
 330    });
 331  
 332    // package-external:@wordpress/api-fetch
 333    var require_api_fetch = __commonJS({
 334      "package-external:@wordpress/api-fetch"(exports, module) {
 335        module.exports = window.wp.apiFetch;
 336      }
 337    });
 338  
 339    // package-external:@wordpress/blocks
 340    var require_blocks = __commonJS({
 341      "package-external:@wordpress/blocks"(exports, module) {
 342        module.exports = window.wp.blocks;
 343      }
 344    });
 345  
 346    // package-external:@wordpress/i18n
 347    var require_i18n = __commonJS({
 348      "package-external:@wordpress/i18n"(exports, module) {
 349        module.exports = window.wp.i18n;
 350      }
 351    });
 352  
 353    // package-external:@wordpress/rich-text
 354    var require_rich_text = __commonJS({
 355      "package-external:@wordpress/rich-text"(exports, module) {
 356        module.exports = window.wp.richText;
 357      }
 358    });
 359  
 360    // package-external:@wordpress/deprecated
 361    var require_deprecated = __commonJS({
 362      "package-external:@wordpress/deprecated"(exports, module) {
 363        module.exports = window.wp.deprecated;
 364      }
 365    });
 366  
 367    // package-external:@wordpress/private-apis
 368    var require_private_apis = __commonJS({
 369      "package-external:@wordpress/private-apis"(exports, module) {
 370        module.exports = window.wp.privateApis;
 371      }
 372    });
 373  
 374    // package-external:@wordpress/html-entities
 375    var require_html_entities = __commonJS({
 376      "package-external:@wordpress/html-entities"(exports, module) {
 377        module.exports = window.wp.htmlEntities;
 378      }
 379    });
 380  
 381    // package-external:@wordpress/element
 382    var require_element = __commonJS({
 383      "package-external:@wordpress/element"(exports, module) {
 384        module.exports = window.wp.element;
 385      }
 386    });
 387  
 388    // vendor-external:react/jsx-runtime
 389    var require_jsx_runtime = __commonJS({
 390      "vendor-external:react/jsx-runtime"(exports, module) {
 391        module.exports = window.ReactJSXRuntime;
 392      }
 393    });
 394  
 395    // package-external:@wordpress/warning
 396    var require_warning = __commonJS({
 397      "package-external:@wordpress/warning"(exports, module) {
 398        module.exports = window.wp.warning;
 399      }
 400    });
 401  
 402    // package-external:@wordpress/block-editor
 403    var require_block_editor = __commonJS({
 404      "package-external:@wordpress/block-editor"(exports, module) {
 405        module.exports = window.wp.blockEditor;
 406      }
 407    });
 408  
 409    // packages/core-data/build-module/index.js
 410    var index_exports = {};
 411    __export(index_exports, {
 412      EntityProvider: () => EntityProvider,
 413      __experimentalFetchLinkSuggestions: () => fetchLinkSuggestions,
 414      __experimentalFetchUrlData: () => experimental_fetch_url_data_default,
 415      __experimentalUseEntityRecord: () => __experimentalUseEntityRecord,
 416      __experimentalUseEntityRecords: () => __experimentalUseEntityRecords,
 417      __experimentalUseResourcePermissions: () => __experimentalUseResourcePermissions,
 418      fetchBlockPatterns: () => fetchBlockPatterns,
 419      privateApis: () => privateApis,
 420      store: () => store,
 421      useEntityBlockEditor: () => useEntityBlockEditor,
 422      useEntityId: () => useEntityId,
 423      useEntityProp: () => useEntityProp,
 424      useEntityRecord: () => useEntityRecord,
 425      useEntityRecords: () => useEntityRecords,
 426      useResourcePermissions: () => use_resource_permissions_default
 427    });
 428    var import_data11 = __toESM(require_data());
 429  
 430    // packages/core-data/build-module/reducer.js
 431    var import_es62 = __toESM(require_es6());
 432    var import_compose2 = __toESM(require_compose());
 433    var import_data3 = __toESM(require_data());
 434    var import_undo_manager = __toESM(require_undo_manager());
 435  
 436    // packages/core-data/build-module/utils/conservative-map-item.js
 437    var import_es6 = __toESM(require_es6());
 438    function conservativeMapItem(item, nextItem) {
 439      if (!item) {
 440        return nextItem;
 441      }
 442      let hasChanges = false;
 443      const result = {};
 444      for (const key in nextItem) {
 445        if ((0, import_es6.default)(item[key], nextItem[key])) {
 446          result[key] = item[key];
 447        } else {
 448          hasChanges = true;
 449          result[key] = nextItem[key];
 450        }
 451      }
 452      if (!hasChanges) {
 453        return item;
 454      }
 455      for (const key in item) {
 456        if (!result.hasOwnProperty(key)) {
 457          result[key] = item[key];
 458        }
 459      }
 460      return result;
 461    }
 462  
 463    // packages/core-data/build-module/utils/get-normalized-comma-separable.js
 464    function getNormalizedCommaSeparable(value) {
 465      if (typeof value === "string") {
 466        return value.split(",");
 467      } else if (Array.isArray(value)) {
 468        return value;
 469      }
 470      return null;
 471    }
 472    var get_normalized_comma_separable_default = getNormalizedCommaSeparable;
 473  
 474    // packages/core-data/build-module/utils/if-matching-action.js
 475    var ifMatchingAction = (isMatch) => (reducer) => (state, action) => {
 476      if (state === void 0 || isMatch(action)) {
 477        return reducer(state, action);
 478      }
 479      return state;
 480    };
 481    var if_matching_action_default = ifMatchingAction;
 482  
 483    // packages/core-data/build-module/utils/forward-resolver.js
 484    var forwardResolver = (resolverName) => (...args) => async ({ resolveSelect }) => {
 485      await resolveSelect[resolverName](...args);
 486    };
 487    var forward_resolver_default = forwardResolver;
 488  
 489    // packages/core-data/build-module/utils/on-sub-key.js
 490    var onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
 491      const key = action[actionProperty];
 492      if (key === void 0) {
 493        return state;
 494      }
 495      const nextKeyState = reducer(state[key], action);
 496      if (nextKeyState === state[key]) {
 497        return state;
 498      }
 499      return {
 500        ...state,
 501        [key]: nextKeyState
 502      };
 503    };
 504    var on_sub_key_default = onSubKey;
 505  
 506    // packages/core-data/build-module/utils/replace-action.js
 507    var replaceAction = (replacer) => (reducer) => (state, action) => {
 508      return reducer(state, replacer(action));
 509    };
 510    var replace_action_default = replaceAction;
 511  
 512    // packages/core-data/build-module/utils/with-weak-map-cache.js
 513    function withWeakMapCache(fn) {
 514      const cache3 = /* @__PURE__ */ new WeakMap();
 515      return (key) => {
 516        let value;
 517        if (cache3.has(key)) {
 518          value = cache3.get(key);
 519        } else {
 520          value = fn(key);
 521          if (key !== null && typeof key === "object") {
 522            cache3.set(key, value);
 523          }
 524        }
 525        return value;
 526      };
 527    }
 528    var with_weak_map_cache_default = withWeakMapCache;
 529  
 530    // packages/core-data/build-module/utils/is-raw-attribute.js
 531    function isRawAttribute(entity2, attribute) {
 532      return (entity2.rawAttributes || []).includes(attribute);
 533    }
 534  
 535    // packages/core-data/build-module/utils/set-nested-value.js
 536    function setNestedValue(object, path, value) {
 537      if (!object || typeof object !== "object") {
 538        return object;
 539      }
 540      const normalizedPath = Array.isArray(path) ? path : path.split(".");
 541      normalizedPath.reduce((acc, key, idx) => {
 542        if (acc[key] === void 0) {
 543          if (Number.isInteger(normalizedPath[idx + 1])) {
 544            acc[key] = [];
 545          } else {
 546            acc[key] = {};
 547          }
 548        }
 549        if (idx === normalizedPath.length - 1) {
 550          acc[key] = value;
 551        }
 552        return acc[key];
 553      }, object);
 554      return object;
 555    }
 556  
 557    // packages/core-data/build-module/utils/get-nested-value.js
 558    function getNestedValue(object, path, defaultValue) {
 559      if (!object || typeof object !== "object" || typeof path !== "string" && !Array.isArray(path)) {
 560        return object;
 561      }
 562      const normalizedPath = Array.isArray(path) ? path : path.split(".");
 563      let value = object;
 564      normalizedPath.forEach((fieldName) => {
 565        value = value?.[fieldName];
 566      });
 567      return value !== void 0 ? value : defaultValue;
 568    }
 569  
 570    // packages/core-data/build-module/utils/is-numeric-id.js
 571    function isNumericID(id) {
 572      return /^\s*\d+\s*$/.test(id);
 573    }
 574  
 575    // packages/core-data/build-module/utils/user-permissions.js
 576    var ALLOWED_RESOURCE_ACTIONS = [
 577      "create",
 578      "read",
 579      "update",
 580      "delete"
 581    ];
 582    function getUserPermissionsFromAllowHeader(allowedMethods) {
 583      const permissions = {};
 584      if (!allowedMethods) {
 585        return permissions;
 586      }
 587      const methods = {
 588        create: "POST",
 589        read: "GET",
 590        update: "PUT",
 591        delete: "DELETE"
 592      };
 593      for (const [actionName, methodName] of Object.entries(methods)) {
 594        permissions[actionName] = allowedMethods.includes(methodName);
 595      }
 596      return permissions;
 597    }
 598    function getUserPermissionCacheKey(action, resource, id) {
 599      const key = (typeof resource === "object" ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join("/");
 600      return key;
 601    }
 602  
 603    // packages/core-data/build-module/utils/receive-intermediate-results.js
 604    var RECEIVE_INTERMEDIATE_RESULTS = Symbol(
 605      "RECEIVE_INTERMEDIATE_RESULTS"
 606    );
 607  
 608    // packages/core-data/build-module/queried-data/actions.js
 609    function receiveItems(items2, edits, meta) {
 610      return {
 611        type: "RECEIVE_ITEMS",
 612        items: Array.isArray(items2) ? items2 : [items2],
 613        persistedEdits: edits,
 614        meta
 615      };
 616    }
 617    function removeItems(kind, name, records, invalidateCache = false) {
 618      return {
 619        type: "REMOVE_ITEMS",
 620        itemIds: Array.isArray(records) ? records : [records],
 621        kind,
 622        name,
 623        invalidateCache
 624      };
 625    }
 626    function receiveQueriedItems(items2, query = {}, edits, meta) {
 627      return {
 628        ...receiveItems(items2, edits, meta),
 629        query
 630      };
 631    }
 632  
 633    // packages/core-data/build-module/queried-data/selectors.js
 634    var import_equivalent_key_map = __toESM(require_equivalent_key_map());
 635    var import_data = __toESM(require_data());
 636  
 637    // packages/core-data/build-module/queried-data/get-query-parts.js
 638    var import_url = __toESM(require_url());
 639    function getQueryParts(query) {
 640      const parts = {
 641        stableKey: "",
 642        page: 1,
 643        perPage: 10,
 644        fields: null,
 645        include: null,
 646        context: "default"
 647      };
 648      const keys = Object.keys(query).sort();
 649      for (let i = 0; i < keys.length; i++) {
 650        const key = keys[i];
 651        let value = query[key];
 652        switch (key) {
 653          case "page":
 654            parts[key] = Number(value);
 655            break;
 656          case "per_page":
 657            parts.perPage = Number(value);
 658            break;
 659          case "context":
 660            parts.context = value;
 661            break;
 662          default:
 663            if (key === "_fields") {
 664              parts.fields = get_normalized_comma_separable_default(value) ?? [];
 665              value = parts.fields.join();
 666            }
 667            if (key === "include") {
 668              if (typeof value === "number") {
 669                value = value.toString();
 670              }
 671              parts.include = (get_normalized_comma_separable_default(value) ?? []).map(Number);
 672              value = parts.include.join();
 673            }
 674            parts.stableKey += (parts.stableKey ? "&" : "") + (0, import_url.addQueryArgs)("", { [key]: value }).slice(1);
 675        }
 676      }
 677      return parts;
 678    }
 679    var get_query_parts_default = with_weak_map_cache_default(getQueryParts);
 680  
 681    // packages/core-data/build-module/queried-data/selectors.js
 682    var queriedItemsCacheByState = /* @__PURE__ */ new WeakMap();
 683    function getQueriedItemsUncached(state, query) {
 684      const { stableKey, page, perPage, include, fields, context } = get_query_parts_default(query);
 685      let itemIds;
 686      if (state.queries?.[context]?.[stableKey]) {
 687        itemIds = state.queries[context][stableKey].itemIds;
 688      }
 689      if (!itemIds) {
 690        return null;
 691      }
 692      const startOffset = perPage === -1 ? 0 : (page - 1) * perPage;
 693      const endOffset = perPage === -1 ? itemIds.length : Math.min(startOffset + perPage, itemIds.length);
 694      const items2 = [];
 695      for (let i = startOffset; i < endOffset; i++) {
 696        const itemId = itemIds[i];
 697        if (Array.isArray(include) && !include.includes(itemId)) {
 698          continue;
 699        }
 700        if (itemId === void 0) {
 701          continue;
 702        }
 703        if (!state.items[context]?.hasOwnProperty(itemId)) {
 704          return null;
 705        }
 706        const item = state.items[context][itemId];
 707        let filteredItem;
 708        if (Array.isArray(fields)) {
 709          filteredItem = {};
 710          for (let f = 0; f < fields.length; f++) {
 711            const field = fields[f].split(".");
 712            let value = item;
 713            field.forEach((fieldName) => {
 714              value = value?.[fieldName];
 715            });
 716            setNestedValue(filteredItem, field, value);
 717          }
 718        } else {
 719          if (!state.itemIsComplete[context]?.[itemId]) {
 720            return null;
 721          }
 722          filteredItem = item;
 723        }
 724        items2.push(filteredItem);
 725      }
 726      return items2;
 727    }
 728    var getQueriedItems = (0, import_data.createSelector)((state, query = {}) => {
 729      let queriedItemsCache = queriedItemsCacheByState.get(state);
 730      if (queriedItemsCache) {
 731        const queriedItems = queriedItemsCache.get(query);
 732        if (queriedItems !== void 0) {
 733          return queriedItems;
 734        }
 735      } else {
 736        queriedItemsCache = new import_equivalent_key_map.default();
 737        queriedItemsCacheByState.set(state, queriedItemsCache);
 738      }
 739      const items2 = getQueriedItemsUncached(state, query);
 740      queriedItemsCache.set(query, items2);
 741      return items2;
 742    });
 743    function getQueriedTotalItems(state, query = {}) {
 744      const { stableKey, context } = get_query_parts_default(query);
 745      return state.queries?.[context]?.[stableKey]?.meta?.totalItems ?? null;
 746    }
 747    function getQueriedTotalPages(state, query = {}) {
 748      const { stableKey, context } = get_query_parts_default(query);
 749      return state.queries?.[context]?.[stableKey]?.meta?.totalPages ?? null;
 750    }
 751  
 752    // packages/core-data/build-module/queried-data/reducer.js
 753    var import_data2 = __toESM(require_data());
 754    var import_compose = __toESM(require_compose());
 755  
 756    // node_modules/tslib/tslib.es6.mjs
 757    var __assign = function() {
 758      __assign = Object.assign || function __assign2(t) {
 759        for (var s, i = 1, n = arguments.length; i < n; i++) {
 760          s = arguments[i];
 761          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
 762        }
 763        return t;
 764      };
 765      return __assign.apply(this, arguments);
 766    };
 767  
 768    // node_modules/lower-case/dist.es2015/index.js
 769    function lowerCase(str) {
 770      return str.toLowerCase();
 771    }
 772  
 773    // node_modules/no-case/dist.es2015/index.js
 774    var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
 775    var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
 776    function noCase(input, options) {
 777      if (options === void 0) {
 778        options = {};
 779      }
 780      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;
 781      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
 782      var start = 0;
 783      var end = result.length;
 784      while (result.charAt(start) === "\0")
 785        start++;
 786      while (result.charAt(end - 1) === "\0")
 787        end--;
 788      return result.slice(start, end).split("\0").map(transform).join(delimiter);
 789    }
 790    function replace(input, re, value) {
 791      if (re instanceof RegExp)
 792        return input.replace(re, value);
 793      return re.reduce(function(input2, re2) {
 794        return input2.replace(re2, value);
 795      }, input);
 796    }
 797  
 798    // node_modules/pascal-case/dist.es2015/index.js
 799    function pascalCaseTransform(input, index) {
 800      var firstChar = input.charAt(0);
 801      var lowerChars = input.substr(1).toLowerCase();
 802      if (index > 0 && firstChar >= "0" && firstChar <= "9") {
 803        return "_" + firstChar + lowerChars;
 804      }
 805      return "" + firstChar.toUpperCase() + lowerChars;
 806    }
 807    function pascalCase(input, options) {
 808      if (options === void 0) {
 809        options = {};
 810      }
 811      return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
 812    }
 813  
 814    // node_modules/camel-case/dist.es2015/index.js
 815    function camelCaseTransform(input, index) {
 816      if (index === 0)
 817        return input.toLowerCase();
 818      return pascalCaseTransform(input, index);
 819    }
 820    function camelCase(input, options) {
 821      if (options === void 0) {
 822        options = {};
 823      }
 824      return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
 825    }
 826  
 827    // node_modules/upper-case-first/dist.es2015/index.js
 828    function upperCaseFirst(input) {
 829      return input.charAt(0).toUpperCase() + input.substr(1);
 830    }
 831  
 832    // node_modules/capital-case/dist.es2015/index.js
 833    function capitalCaseTransform(input) {
 834      return upperCaseFirst(input.toLowerCase());
 835    }
 836    function capitalCase(input, options) {
 837      if (options === void 0) {
 838        options = {};
 839      }
 840      return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options));
 841    }
 842  
 843    // packages/core-data/build-module/entities.js
 844    var import_api_fetch = __toESM(require_api_fetch());
 845    var import_blocks = __toESM(require_blocks());
 846    var import_i18n = __toESM(require_i18n());
 847  
 848    // node_modules/uuid/dist/esm-browser/rng.js
 849    var getRandomValues;
 850    var rnds8 = new Uint8Array(16);
 851    function rng() {
 852      if (!getRandomValues) {
 853        getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
 854        if (!getRandomValues) {
 855          throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
 856        }
 857      }
 858      return getRandomValues(rnds8);
 859    }
 860  
 861    // node_modules/uuid/dist/esm-browser/stringify.js
 862    var byteToHex = [];
 863    for (let i = 0; i < 256; ++i) {
 864      byteToHex.push((i + 256).toString(16).slice(1));
 865    }
 866    function unsafeStringify(arr, offset = 0) {
 867      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]];
 868    }
 869  
 870    // node_modules/uuid/dist/esm-browser/native.js
 871    var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
 872    var native_default = {
 873      randomUUID
 874    };
 875  
 876    // node_modules/uuid/dist/esm-browser/v4.js
 877    function v4(options, buf, offset) {
 878      if (native_default.randomUUID && !buf && !options) {
 879        return native_default.randomUUID();
 880      }
 881      options = options || {};
 882      const rnds = options.random || (options.rng || rng)();
 883      rnds[6] = rnds[6] & 15 | 64;
 884      rnds[8] = rnds[8] & 63 | 128;
 885      if (buf) {
 886        offset = offset || 0;
 887        for (let i = 0; i < 16; ++i) {
 888          buf[offset + i] = rnds[i];
 889        }
 890        return buf;
 891      }
 892      return unsafeStringify(rnds);
 893    }
 894    var v4_default = v4;
 895  
 896    // packages/core-data/build-module/entities.js
 897    var DEFAULT_ENTITY_KEY = "id";
 898    var POST_RAW_ATTRIBUTES = ["title", "excerpt", "content"];
 899    var blocksTransientEdits = {
 900      blocks: {
 901        read: (record) => (0, import_blocks.parse)(record.content?.raw ?? ""),
 902        write: (record) => ({
 903          content: (0, import_blocks.__unstableSerializeAndClean)(record.blocks)
 904        })
 905      }
 906    };
 907    var rootEntitiesConfig = [
 908      {
 909        label: (0, import_i18n.__)("Base"),
 910        kind: "root",
 911        key: false,
 912        name: "__unstableBase",
 913        baseURL: "/",
 914        baseURLParams: {
 915          // Please also change the preload path when changing this.
 916          // @see lib/compat/wordpress-6.8/preload.php
 917          _fields: [
 918            "description",
 919            "gmt_offset",
 920            "home",
 921            "name",
 922            "site_icon",
 923            "site_icon_url",
 924            "site_logo",
 925            "timezone_string",
 926            "url",
 927            "page_for_posts",
 928            "page_on_front",
 929            "show_on_front"
 930          ].join(",")
 931        },
 932        // The entity doesn't support selecting multiple records.
 933        // The property is maintained for backward compatibility.
 934        plural: "__unstableBases"
 935      },
 936      {
 937        label: (0, import_i18n.__)("Post Type"),
 938        name: "postType",
 939        kind: "root",
 940        key: "slug",
 941        baseURL: "/wp/v2/types",
 942        baseURLParams: { context: "edit" },
 943        plural: "postTypes"
 944      },
 945      {
 946        name: "media",
 947        kind: "root",
 948        baseURL: "/wp/v2/media",
 949        baseURLParams: { context: "edit" },
 950        plural: "mediaItems",
 951        label: (0, import_i18n.__)("Media"),
 952        rawAttributes: ["caption", "title", "description"],
 953        supportsPagination: true
 954      },
 955      {
 956        name: "taxonomy",
 957        kind: "root",
 958        key: "slug",
 959        baseURL: "/wp/v2/taxonomies",
 960        baseURLParams: { context: "edit" },
 961        plural: "taxonomies",
 962        label: (0, import_i18n.__)("Taxonomy")
 963      },
 964      {
 965        name: "sidebar",
 966        kind: "root",
 967        baseURL: "/wp/v2/sidebars",
 968        baseURLParams: { context: "edit" },
 969        plural: "sidebars",
 970        transientEdits: { blocks: true },
 971        label: (0, import_i18n.__)("Widget areas")
 972      },
 973      {
 974        name: "widget",
 975        kind: "root",
 976        baseURL: "/wp/v2/widgets",
 977        baseURLParams: { context: "edit" },
 978        plural: "widgets",
 979        transientEdits: { blocks: true },
 980        label: (0, import_i18n.__)("Widgets")
 981      },
 982      {
 983        name: "widgetType",
 984        kind: "root",
 985        baseURL: "/wp/v2/widget-types",
 986        baseURLParams: { context: "edit" },
 987        plural: "widgetTypes",
 988        label: (0, import_i18n.__)("Widget types")
 989      },
 990      {
 991        label: (0, import_i18n.__)("User"),
 992        name: "user",
 993        kind: "root",
 994        baseURL: "/wp/v2/users",
 995        getTitle: (record) => record?.name || record?.slug,
 996        baseURLParams: { context: "edit" },
 997        plural: "users",
 998        supportsPagination: true
 999      },
1000      {
1001        name: "comment",
1002        kind: "root",
1003        baseURL: "/wp/v2/comments",
1004        baseURLParams: { context: "edit" },
1005        plural: "comments",
1006        label: (0, import_i18n.__)("Comment"),
1007        supportsPagination: true
1008      },
1009      {
1010        name: "menu",
1011        kind: "root",
1012        baseURL: "/wp/v2/menus",
1013        baseURLParams: { context: "edit" },
1014        plural: "menus",
1015        label: (0, import_i18n.__)("Menu"),
1016        supportsPagination: true
1017      },
1018      {
1019        name: "menuItem",
1020        kind: "root",
1021        baseURL: "/wp/v2/menu-items",
1022        baseURLParams: { context: "edit" },
1023        plural: "menuItems",
1024        label: (0, import_i18n.__)("Menu Item"),
1025        rawAttributes: ["title"],
1026        supportsPagination: true
1027      },
1028      {
1029        name: "menuLocation",
1030        kind: "root",
1031        baseURL: "/wp/v2/menu-locations",
1032        baseURLParams: { context: "edit" },
1033        plural: "menuLocations",
1034        label: (0, import_i18n.__)("Menu Location"),
1035        key: "name"
1036      },
1037      {
1038        label: (0, import_i18n.__)("Global Styles"),
1039        name: "globalStyles",
1040        kind: "root",
1041        baseURL: "/wp/v2/global-styles",
1042        baseURLParams: { context: "edit" },
1043        plural: "globalStylesVariations",
1044        // Should be different from name.
1045        getTitle: () => (0, import_i18n.__)("Custom Styles"),
1046        getRevisionsUrl: (parentId, revisionId) => `/wp/v2/global-styles/$parentId}/revisions$revisionId ? "/" + revisionId : ""}`,
1047        supportsPagination: true
1048      },
1049      {
1050        label: (0, import_i18n.__)("Themes"),
1051        name: "theme",
1052        kind: "root",
1053        baseURL: "/wp/v2/themes",
1054        baseURLParams: { context: "edit" },
1055        plural: "themes",
1056        key: "stylesheet"
1057      },
1058      {
1059        label: (0, import_i18n.__)("Plugins"),
1060        name: "plugin",
1061        kind: "root",
1062        baseURL: "/wp/v2/plugins",
1063        baseURLParams: { context: "edit" },
1064        plural: "plugins",
1065        key: "plugin"
1066      },
1067      {
1068        label: (0, import_i18n.__)("Status"),
1069        name: "status",
1070        kind: "root",
1071        baseURL: "/wp/v2/statuses",
1072        baseURLParams: { context: "edit" },
1073        plural: "statuses",
1074        key: "slug"
1075      },
1076      {
1077        label: (0, import_i18n.__)("Registered Templates"),
1078        name: "registeredTemplate",
1079        kind: "root",
1080        baseURL: "/wp/v2/registered-templates",
1081        key: "id"
1082      },
1083      {
1084        label: (0, import_i18n.__)("Font Collections"),
1085        name: "fontCollection",
1086        kind: "root",
1087        baseURL: "/wp/v2/font-collections",
1088        baseURLParams: { context: "view" },
1089        plural: "fontCollections",
1090        key: "slug"
1091      }
1092    ];
1093    var deprecatedEntities = {
1094      root: {
1095        media: {
1096          since: "6.9",
1097          alternative: {
1098            kind: "postType",
1099            name: "attachment"
1100          }
1101        }
1102      }
1103    };
1104    var additionalEntityConfigLoaders = [
1105      { kind: "postType", loadEntities: loadPostTypeEntities },
1106      { kind: "taxonomy", loadEntities: loadTaxonomyEntities },
1107      {
1108        kind: "root",
1109        name: "site",
1110        plural: "sites",
1111        loadEntities: loadSiteEntity
1112      }
1113    ];
1114    var prePersistPostType = (persistedRecord, edits, name, isTemplate) => {
1115      const newEdits = {};
1116      if (!isTemplate && persistedRecord?.status === "auto-draft") {
1117        if (!edits.status && !newEdits.status) {
1118          newEdits.status = "draft";
1119        }
1120        if ((!edits.title || edits.title === "Auto Draft") && !newEdits.title && (!persistedRecord?.title || persistedRecord?.title === "Auto Draft")) {
1121          newEdits.title = "";
1122        }
1123      }
1124      if (persistedRecord && window.__experimentalEnableSync) {
1125        if (false) {
1126          const objectType = `postType/$name}`;
1127          const objectId = persistedRecord.id;
1128          const meta = getSyncManager()?.createMeta(objectType, objectId);
1129          newEdits.meta = {
1130            ...edits.meta,
1131            ...meta
1132          };
1133        }
1134      }
1135      return newEdits;
1136    };
1137    async function loadPostTypeEntities() {
1138      const postTypes = await (0, import_api_fetch.default)({
1139        path: "/wp/v2/types?context=view"
1140      });
1141      return Object.entries(postTypes ?? {}).map(([name, postType]) => {
1142        const isTemplate = ["wp_template", "wp_template_part"].includes(
1143          name
1144        );
1145        const namespace = postType?.rest_namespace ?? "wp/v2";
1146        const entity2 = {
1147          kind: "postType",
1148          baseURL: `/$namespace}/$postType.rest_base}`,
1149          baseURLParams: { context: "edit" },
1150          name,
1151          label: postType.name,
1152          transientEdits: {
1153            ...blocksTransientEdits,
1154            selection: true
1155          },
1156          mergedEdits: { meta: true },
1157          rawAttributes: POST_RAW_ATTRIBUTES,
1158          getTitle: (record) => record?.title?.rendered || record?.title || (isTemplate ? capitalCase(record.slug ?? "") : String(record.id)),
1159          __unstablePrePersist: (persistedRecord, edits) => prePersistPostType(persistedRecord, edits, name, isTemplate),
1160          __unstable_rest_base: postType.rest_base,
1161          supportsPagination: true,
1162          getRevisionsUrl: (parentId, revisionId) => `/$namespace}/$postType.rest_base}/$parentId}/revisions$revisionId ? "/" + revisionId : ""}`,
1163          revisionKey: isTemplate && !window?.__experimentalTemplateActivate ? "wp_id" : DEFAULT_ENTITY_KEY
1164        };
1165        if (window.__experimentalEnableSync) {
1166          if (false) {
1167            entity2.syncConfig = {
1168              /**
1169               * Apply changes from the local editor to the local CRDT document so
1170               * that those changes can be synced to other peers (via the provider).
1171               *
1172               * @param {import('@wordpress/sync').CRDTDoc}               crdtDoc
1173               * @param {Partial< import('@wordpress/sync').ObjectData >} changes
1174               * @return {void}
1175               */
1176              applyChangesToCRDTDoc: (crdtDoc, changes) => applyPostChangesToCRDTDoc(crdtDoc, changes, postType),
1177              /**
1178               * Extract changes from a CRDT document that can be used to update the
1179               * local editor state.
1180               *
1181               * @param {import('@wordpress/sync').CRDTDoc}    crdtDoc
1182               * @param {import('@wordpress/sync').ObjectData} editedRecord
1183               * @return {Partial< import('@wordpress/sync').ObjectData >} Changes to record
1184               */
1185              getChangesFromCRDTDoc: (crdtDoc, editedRecord) => getPostChangesFromCRDTDoc(
1186                crdtDoc,
1187                editedRecord,
1188                postType
1189              ),
1190              /**
1191               * Sync features supported by the entity.
1192               *
1193               * @type {Record< string, boolean >}
1194               */
1195              supports: {
1196                crdtPersistence: true
1197              }
1198            };
1199          }
1200        }
1201        return entity2;
1202      });
1203    }
1204    async function loadTaxonomyEntities() {
1205      const taxonomies = await (0, import_api_fetch.default)({
1206        path: "/wp/v2/taxonomies?context=view"
1207      });
1208      return Object.entries(taxonomies ?? {}).map(([name, taxonomy]) => {
1209        const namespace = taxonomy?.rest_namespace ?? "wp/v2";
1210        return {
1211          kind: "taxonomy",
1212          baseURL: `/$namespace}/$taxonomy.rest_base}`,
1213          baseURLParams: { context: "edit" },
1214          name,
1215          label: taxonomy.name,
1216          getTitle: (record) => record?.name,
1217          supportsPagination: true
1218        };
1219      });
1220    }
1221    async function loadSiteEntity() {
1222      const entity2 = {
1223        label: (0, import_i18n.__)("Site"),
1224        name: "site",
1225        kind: "root",
1226        key: false,
1227        baseURL: "/wp/v2/settings",
1228        meta: {}
1229      };
1230      if (window.__experimentalEnableSync) {
1231        if (false) {
1232          entity2.syncConfig = {
1233            applyChangesToCRDTDoc: defaultApplyChangesToCRDTDoc,
1234            getChangesFromCRDTDoc: defaultGetChangesFromCRDTDoc
1235          };
1236        }
1237      }
1238      const site = await (0, import_api_fetch.default)({
1239        path: entity2.baseURL,
1240        method: "OPTIONS"
1241      });
1242      const labels = {};
1243      Object.entries(site?.schema?.properties ?? {}).forEach(
1244        ([key, value]) => {
1245          if (typeof value === "object" && value.title) {
1246            labels[key] = value.title;
1247          }
1248        }
1249      );
1250      return [{ ...entity2, meta: { labels } }];
1251    }
1252    var getMethodName = (kind, name, prefix = "get") => {
1253      const kindPrefix = kind === "root" ? "" : pascalCase(kind);
1254      const suffix = pascalCase(name);
1255      return `$prefix}$kindPrefix}$suffix}`;
1256    };
1257  
1258    // packages/core-data/build-module/queried-data/reducer.js
1259    function getContextFromAction(action) {
1260      const { query } = action;
1261      if (!query) {
1262        return "default";
1263      }
1264      const queryParts = get_query_parts_default(query);
1265      return queryParts.context;
1266    }
1267    function getMergedItemIds(itemIds, nextItemIds, page, perPage) {
1268      const receivedAllIds = page === 1 && perPage === -1;
1269      if (receivedAllIds) {
1270        return nextItemIds;
1271      }
1272      const nextItemIdsStartIndex = (page - 1) * perPage;
1273      const size = Math.max(
1274        itemIds?.length ?? 0,
1275        nextItemIdsStartIndex + nextItemIds.length
1276      );
1277      const mergedItemIds = new Array(size);
1278      for (let i = 0; i < size; i++) {
1279        const isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;
1280        mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds?.[i];
1281      }
1282      return mergedItemIds;
1283    }
1284    function removeEntitiesById(entities2, ids) {
1285      return Object.fromEntries(
1286        Object.entries(entities2).filter(
1287          ([id]) => !ids.some((itemId) => {
1288            if (Number.isInteger(itemId)) {
1289              return itemId === +id;
1290            }
1291            return itemId === id;
1292          })
1293        )
1294      );
1295    }
1296    function items(state = {}, action) {
1297      switch (action.type) {
1298        case "RECEIVE_ITEMS": {
1299          const context = getContextFromAction(action);
1300          const key = action.key || DEFAULT_ENTITY_KEY;
1301          return {
1302            ...state,
1303            [context]: {
1304              ...state[context],
1305              ...action.items.reduce((accumulator, value) => {
1306                const itemId = value?.[key];
1307                accumulator[itemId] = conservativeMapItem(
1308                  state?.[context]?.[itemId],
1309                  value
1310                );
1311                return accumulator;
1312              }, {})
1313            }
1314          };
1315        }
1316        case "REMOVE_ITEMS":
1317          return Object.fromEntries(
1318            Object.entries(state).map(([itemId, contextState]) => [
1319              itemId,
1320              removeEntitiesById(contextState, action.itemIds)
1321            ])
1322          );
1323      }
1324      return state;
1325    }
1326    function itemIsComplete(state = {}, action) {
1327      switch (action.type) {
1328        case "RECEIVE_ITEMS": {
1329          const context = getContextFromAction(action);
1330          const { query, key = DEFAULT_ENTITY_KEY } = action;
1331          const queryParts = query ? get_query_parts_default(query) : {};
1332          const isCompleteQuery = !query || !Array.isArray(queryParts.fields);
1333          return {
1334            ...state,
1335            [context]: {
1336              ...state[context],
1337              ...action.items.reduce((result, item) => {
1338                const itemId = item?.[key];
1339                result[itemId] = state?.[context]?.[itemId] || isCompleteQuery;
1340                return result;
1341              }, {})
1342            }
1343          };
1344        }
1345        case "REMOVE_ITEMS":
1346          return Object.fromEntries(
1347            Object.entries(state).map(([itemId, contextState]) => [
1348              itemId,
1349              removeEntitiesById(contextState, action.itemIds)
1350            ])
1351          );
1352      }
1353      return state;
1354    }
1355    var receiveQueries = (0, import_compose.compose)([
1356      // Limit to matching action type so we don't attempt to replace action on
1357      // an unhandled action.
1358      if_matching_action_default((action) => "query" in action),
1359      // Inject query parts into action for use both in `onSubKey` and reducer.
1360      replace_action_default((action) => {
1361        if (action.query) {
1362          return {
1363            ...action,
1364            ...get_query_parts_default(action.query)
1365          };
1366        }
1367        return action;
1368      }),
1369      on_sub_key_default("context"),
1370      // Queries shape is shared, but keyed by query `stableKey` part. Original
1371      // reducer tracks only a single query object.
1372      on_sub_key_default("stableKey")
1373    ])((state = {}, action) => {
1374      const { type, page, perPage, key = DEFAULT_ENTITY_KEY } = action;
1375      if (type !== "RECEIVE_ITEMS") {
1376        return state;
1377      }
1378      return {
1379        itemIds: getMergedItemIds(
1380          state?.itemIds || [],
1381          action.items.map((item) => item?.[key]).filter(Boolean),
1382          page,
1383          perPage
1384        ),
1385        meta: action.meta
1386      };
1387    });
1388    var queries = (state = {}, action) => {
1389      switch (action.type) {
1390        case "RECEIVE_ITEMS":
1391          return receiveQueries(state, action);
1392        case "REMOVE_ITEMS":
1393          const removedItems = action.itemIds.reduce((result, itemId) => {
1394            result[itemId] = true;
1395            return result;
1396          }, {});
1397          return Object.fromEntries(
1398            Object.entries(state).map(
1399              ([queryGroup, contextQueries]) => [
1400                queryGroup,
1401                Object.fromEntries(
1402                  Object.entries(contextQueries).map(
1403                    ([query, queryItems]) => [
1404                      query,
1405                      {
1406                        ...queryItems,
1407                        itemIds: queryItems.itemIds.filter(
1408                          (queryId) => !removedItems[queryId]
1409                        )
1410                      }
1411                    ]
1412                  )
1413                )
1414              ]
1415            )
1416          );
1417        default:
1418          return state;
1419      }
1420    };
1421    var reducer_default = (0, import_data2.combineReducers)({
1422      items,
1423      itemIsComplete,
1424      queries
1425    });
1426  
1427    // packages/core-data/build-module/reducer.js
1428    function users(state = { byId: {}, queries: {} }, action) {
1429      switch (action.type) {
1430        case "RECEIVE_USER_QUERY":
1431          return {
1432            byId: {
1433              ...state.byId,
1434              // Key users by their ID.
1435              ...action.users.reduce(
1436                (newUsers, user) => ({
1437                  ...newUsers,
1438                  [user.id]: user
1439                }),
1440                {}
1441              )
1442            },
1443            queries: {
1444              ...state.queries,
1445              [action.queryID]: action.users.map((user) => user.id)
1446            }
1447          };
1448      }
1449      return state;
1450    }
1451    function currentUser(state = {}, action) {
1452      switch (action.type) {
1453        case "RECEIVE_CURRENT_USER":
1454          return action.currentUser;
1455      }
1456      return state;
1457    }
1458    function currentTheme(state = void 0, action) {
1459      switch (action.type) {
1460        case "RECEIVE_CURRENT_THEME":
1461          return action.currentTheme.stylesheet;
1462      }
1463      return state;
1464    }
1465    function currentGlobalStylesId(state = void 0, action) {
1466      switch (action.type) {
1467        case "RECEIVE_CURRENT_GLOBAL_STYLES_ID":
1468          return action.id;
1469      }
1470      return state;
1471    }
1472    function themeBaseGlobalStyles(state = {}, action) {
1473      switch (action.type) {
1474        case "RECEIVE_THEME_GLOBAL_STYLES":
1475          return {
1476            ...state,
1477            [action.stylesheet]: action.globalStyles
1478          };
1479      }
1480      return state;
1481    }
1482    function themeGlobalStyleVariations(state = {}, action) {
1483      switch (action.type) {
1484        case "RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS":
1485          return {
1486            ...state,
1487            [action.stylesheet]: action.variations
1488          };
1489      }
1490      return state;
1491    }
1492    var withMultiEntityRecordEdits = (reducer) => (state, action) => {
1493      if (action.type === "UNDO" || action.type === "REDO") {
1494        const { record } = action;
1495        let newState = state;
1496        record.forEach(({ id: { kind, name, recordId }, changes }) => {
1497          newState = reducer(newState, {
1498            type: "EDIT_ENTITY_RECORD",
1499            kind,
1500            name,
1501            recordId,
1502            edits: Object.entries(changes).reduce(
1503              (acc, [key, value]) => {
1504                acc[key] = action.type === "UNDO" ? value.from : value.to;
1505                return acc;
1506              },
1507              {}
1508            )
1509          });
1510        });
1511        return newState;
1512      }
1513      return reducer(state, action);
1514    };
1515    function entity(entityConfig) {
1516      return (0, import_compose2.compose)([
1517        withMultiEntityRecordEdits,
1518        // Limit to matching action type so we don't attempt to replace action on
1519        // an unhandled action.
1520        if_matching_action_default(
1521          (action) => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind
1522        ),
1523        // Inject the entity config into the action.
1524        replace_action_default((action) => {
1525          return {
1526            key: entityConfig.key || DEFAULT_ENTITY_KEY,
1527            ...action
1528          };
1529        })
1530      ])(
1531        (0, import_data3.combineReducers)({
1532          queriedData: reducer_default,
1533          edits: (state = {}, action) => {
1534            switch (action.type) {
1535              case "RECEIVE_ITEMS":
1536                const context = action?.query?.context ?? "default";
1537                if (context !== "default") {
1538                  return state;
1539                }
1540                const nextState = { ...state };
1541                for (const record of action.items) {
1542                  const recordId = record?.[action.key];
1543                  const edits = nextState[recordId];
1544                  if (!edits) {
1545                    continue;
1546                  }
1547                  const nextEdits2 = Object.keys(edits).reduce(
1548                    (acc, key) => {
1549                      if (
1550                        // Edits are the "raw" attribute values, but records may have
1551                        // objects with more properties, so we use `get` here for the
1552                        // comparison.
1553                        !(0, import_es62.default)(
1554                          edits[key],
1555                          record[key]?.raw ?? record[key]
1556                        ) && // Sometimes the server alters the sent value which means
1557                        // we need to also remove the edits before the api request.
1558                        (!action.persistedEdits || !(0, import_es62.default)(
1559                          edits[key],
1560                          action.persistedEdits[key]
1561                        ))
1562                      ) {
1563                        acc[key] = edits[key];
1564                      }
1565                      return acc;
1566                    },
1567                    {}
1568                  );
1569                  if (Object.keys(nextEdits2).length) {
1570                    nextState[recordId] = nextEdits2;
1571                  } else {
1572                    delete nextState[recordId];
1573                  }
1574                }
1575                return nextState;
1576              case "EDIT_ENTITY_RECORD":
1577                const nextEdits = {
1578                  ...state[action.recordId],
1579                  ...action.edits
1580                };
1581                Object.keys(nextEdits).forEach((key) => {
1582                  if (nextEdits[key] === void 0) {
1583                    delete nextEdits[key];
1584                  }
1585                });
1586                return {
1587                  ...state,
1588                  [action.recordId]: nextEdits
1589                };
1590            }
1591            return state;
1592          },
1593          saving: (state = {}, action) => {
1594            switch (action.type) {
1595              case "SAVE_ENTITY_RECORD_START":
1596              case "SAVE_ENTITY_RECORD_FINISH":
1597                return {
1598                  ...state,
1599                  [action.recordId]: {
1600                    pending: action.type === "SAVE_ENTITY_RECORD_START",
1601                    error: action.error,
1602                    isAutosave: action.isAutosave
1603                  }
1604                };
1605            }
1606            return state;
1607          },
1608          deleting: (state = {}, action) => {
1609            switch (action.type) {
1610              case "DELETE_ENTITY_RECORD_START":
1611              case "DELETE_ENTITY_RECORD_FINISH":
1612                return {
1613                  ...state,
1614                  [action.recordId]: {
1615                    pending: action.type === "DELETE_ENTITY_RECORD_START",
1616                    error: action.error
1617                  }
1618                };
1619            }
1620            return state;
1621          },
1622          revisions: (state = {}, action) => {
1623            if (action.type === "RECEIVE_ITEM_REVISIONS") {
1624              const recordKey = action.recordKey;
1625              delete action.recordKey;
1626              const newState = reducer_default(state[recordKey], {
1627                ...action,
1628                type: "RECEIVE_ITEMS"
1629              });
1630              return {
1631                ...state,
1632                [recordKey]: newState
1633              };
1634            }
1635            if (action.type === "REMOVE_ITEMS") {
1636              return Object.fromEntries(
1637                Object.entries(state).filter(
1638                  ([id]) => !action.itemIds.some((itemId) => {
1639                    if (Number.isInteger(itemId)) {
1640                      return itemId === +id;
1641                    }
1642                    return itemId === id;
1643                  })
1644                )
1645              );
1646            }
1647            return state;
1648          }
1649        })
1650      );
1651    }
1652    function entitiesConfig(state = rootEntitiesConfig, action) {
1653      switch (action.type) {
1654        case "ADD_ENTITIES":
1655          return [...state, ...action.entities];
1656      }
1657      return state;
1658    }
1659    var entities = (state = {}, action) => {
1660      const newConfig = entitiesConfig(state.config, action);
1661      let entitiesDataReducer = state.reducer;
1662      if (!entitiesDataReducer || newConfig !== state.config) {
1663        const entitiesByKind = newConfig.reduce((acc, record) => {
1664          const { kind } = record;
1665          if (!acc[kind]) {
1666            acc[kind] = [];
1667          }
1668          acc[kind].push(record);
1669          return acc;
1670        }, {});
1671        entitiesDataReducer = (0, import_data3.combineReducers)(
1672          Object.fromEntries(
1673            Object.entries(entitiesByKind).map(
1674              ([kind, subEntities]) => {
1675                const kindReducer = (0, import_data3.combineReducers)(
1676                  Object.fromEntries(
1677                    subEntities.map((entityConfig) => [
1678                      entityConfig.name,
1679                      entity(entityConfig)
1680                    ])
1681                  )
1682                );
1683                return [kind, kindReducer];
1684              }
1685            )
1686          )
1687        );
1688      }
1689      const newData = entitiesDataReducer(state.records, action);
1690      if (newData === state.records && newConfig === state.config && entitiesDataReducer === state.reducer) {
1691        return state;
1692      }
1693      return {
1694        reducer: entitiesDataReducer,
1695        records: newData,
1696        config: newConfig
1697      };
1698    };
1699    function undoManager(state = (0, import_undo_manager.createUndoManager)()) {
1700      return state;
1701    }
1702    function editsReference(state = {}, action) {
1703      switch (action.type) {
1704        case "EDIT_ENTITY_RECORD":
1705        case "UNDO":
1706        case "REDO":
1707          return {};
1708      }
1709      return state;
1710    }
1711    function embedPreviews(state = {}, action) {
1712      switch (action.type) {
1713        case "RECEIVE_EMBED_PREVIEW":
1714          const { url, preview } = action;
1715          return {
1716            ...state,
1717            [url]: preview
1718          };
1719      }
1720      return state;
1721    }
1722    function userPermissions(state = {}, action) {
1723      switch (action.type) {
1724        case "RECEIVE_USER_PERMISSION":
1725          return {
1726            ...state,
1727            [action.key]: action.isAllowed
1728          };
1729        case "RECEIVE_USER_PERMISSIONS":
1730          return {
1731            ...state,
1732            ...action.permissions
1733          };
1734      }
1735      return state;
1736    }
1737    function autosaves(state = {}, action) {
1738      switch (action.type) {
1739        case "RECEIVE_AUTOSAVES":
1740          const { postId, autosaves: autosavesData } = action;
1741          return {
1742            ...state,
1743            [postId]: autosavesData
1744          };
1745      }
1746      return state;
1747    }
1748    function blockPatterns(state = [], action) {
1749      switch (action.type) {
1750        case "RECEIVE_BLOCK_PATTERNS":
1751          return action.patterns;
1752      }
1753      return state;
1754    }
1755    function blockPatternCategories(state = [], action) {
1756      switch (action.type) {
1757        case "RECEIVE_BLOCK_PATTERN_CATEGORIES":
1758          return action.categories;
1759      }
1760      return state;
1761    }
1762    function userPatternCategories(state = [], action) {
1763      switch (action.type) {
1764        case "RECEIVE_USER_PATTERN_CATEGORIES":
1765          return action.patternCategories;
1766      }
1767      return state;
1768    }
1769    function navigationFallbackId(state = null, action) {
1770      switch (action.type) {
1771        case "RECEIVE_NAVIGATION_FALLBACK_ID":
1772          return action.fallbackId;
1773      }
1774      return state;
1775    }
1776    function themeGlobalStyleRevisions(state = {}, action) {
1777      switch (action.type) {
1778        case "RECEIVE_THEME_GLOBAL_STYLE_REVISIONS":
1779          return {
1780            ...state,
1781            [action.currentId]: action.revisions
1782          };
1783      }
1784      return state;
1785    }
1786    function defaultTemplates(state = {}, action) {
1787      switch (action.type) {
1788        case "RECEIVE_DEFAULT_TEMPLATE":
1789          return {
1790            ...state,
1791            [JSON.stringify(action.query)]: action.templateId
1792          };
1793      }
1794      return state;
1795    }
1796    function registeredPostMeta(state = {}, action) {
1797      switch (action.type) {
1798        case "RECEIVE_REGISTERED_POST_META":
1799          return {
1800            ...state,
1801            [action.postType]: action.registeredPostMeta
1802          };
1803      }
1804      return state;
1805    }
1806    function editorSettings(state = null, action) {
1807      switch (action.type) {
1808        case "RECEIVE_EDITOR_SETTINGS":
1809          return action.settings;
1810      }
1811      return state;
1812    }
1813    function editorAssets(state = null, action) {
1814      switch (action.type) {
1815        case "RECEIVE_EDITOR_ASSETS":
1816          return action.assets;
1817      }
1818      return state;
1819    }
1820    var reducer_default2 = (0, import_data3.combineReducers)({
1821      users,
1822      currentTheme,
1823      currentGlobalStylesId,
1824      currentUser,
1825      themeGlobalStyleVariations,
1826      themeBaseGlobalStyles,
1827      themeGlobalStyleRevisions,
1828      entities,
1829      editsReference,
1830      undoManager,
1831      embedPreviews,
1832      userPermissions,
1833      autosaves,
1834      blockPatterns,
1835      blockPatternCategories,
1836      userPatternCategories,
1837      navigationFallbackId,
1838      defaultTemplates,
1839      registeredPostMeta,
1840      editorSettings,
1841      editorAssets
1842    });
1843  
1844    // packages/core-data/build-module/selectors.js
1845    var selectors_exports = {};
1846    __export(selectors_exports, {
1847      __experimentalGetCurrentGlobalStylesId: () => __experimentalGetCurrentGlobalStylesId,
1848      __experimentalGetCurrentThemeBaseGlobalStyles: () => __experimentalGetCurrentThemeBaseGlobalStyles,
1849      __experimentalGetCurrentThemeGlobalStylesVariations: () => __experimentalGetCurrentThemeGlobalStylesVariations,
1850      __experimentalGetDirtyEntityRecords: () => __experimentalGetDirtyEntityRecords,
1851      __experimentalGetEntitiesBeingSaved: () => __experimentalGetEntitiesBeingSaved,
1852      __experimentalGetEntityRecordNoResolver: () => __experimentalGetEntityRecordNoResolver,
1853      canUser: () => canUser,
1854      canUserEditEntityRecord: () => canUserEditEntityRecord,
1855      getAuthors: () => getAuthors,
1856      getAutosave: () => getAutosave,
1857      getAutosaves: () => getAutosaves,
1858      getBlockPatternCategories: () => getBlockPatternCategories,
1859      getBlockPatterns: () => getBlockPatterns,
1860      getCurrentTheme: () => getCurrentTheme,
1861      getCurrentThemeGlobalStylesRevisions: () => getCurrentThemeGlobalStylesRevisions,
1862      getCurrentUser: () => getCurrentUser,
1863      getDefaultTemplateId: () => getDefaultTemplateId,
1864      getEditedEntityRecord: () => getEditedEntityRecord,
1865      getEmbedPreview: () => getEmbedPreview,
1866      getEntitiesByKind: () => getEntitiesByKind,
1867      getEntitiesConfig: () => getEntitiesConfig,
1868      getEntity: () => getEntity,
1869      getEntityConfig: () => getEntityConfig,
1870      getEntityRecord: () => getEntityRecord,
1871      getEntityRecordEdits: () => getEntityRecordEdits,
1872      getEntityRecordNonTransientEdits: () => getEntityRecordNonTransientEdits,
1873      getEntityRecords: () => getEntityRecords,
1874      getEntityRecordsTotalItems: () => getEntityRecordsTotalItems,
1875      getEntityRecordsTotalPages: () => getEntityRecordsTotalPages,
1876      getLastEntityDeleteError: () => getLastEntityDeleteError,
1877      getLastEntitySaveError: () => getLastEntitySaveError,
1878      getRawEntityRecord: () => getRawEntityRecord,
1879      getRedoEdit: () => getRedoEdit,
1880      getReferenceByDistinctEdits: () => getReferenceByDistinctEdits,
1881      getRevision: () => getRevision,
1882      getRevisions: () => getRevisions,
1883      getThemeSupports: () => getThemeSupports,
1884      getUndoEdit: () => getUndoEdit,
1885      getUserPatternCategories: () => getUserPatternCategories,
1886      getUserQueryResults: () => getUserQueryResults,
1887      hasEditsForEntityRecord: () => hasEditsForEntityRecord,
1888      hasEntityRecord: () => hasEntityRecord,
1889      hasEntityRecords: () => hasEntityRecords,
1890      hasFetchedAutosaves: () => hasFetchedAutosaves,
1891      hasRedo: () => hasRedo,
1892      hasUndo: () => hasUndo,
1893      isAutosavingEntityRecord: () => isAutosavingEntityRecord,
1894      isDeletingEntityRecord: () => isDeletingEntityRecord,
1895      isPreviewEmbedFallback: () => isPreviewEmbedFallback,
1896      isRequestingEmbedPreview: () => isRequestingEmbedPreview,
1897      isSavingEntityRecord: () => isSavingEntityRecord
1898    });
1899    var import_data5 = __toESM(require_data());
1900    var import_url2 = __toESM(require_url());
1901    var import_deprecated2 = __toESM(require_deprecated());
1902  
1903    // packages/core-data/build-module/name.js
1904    var STORE_NAME = "core";
1905  
1906    // packages/core-data/build-module/private-selectors.js
1907    var private_selectors_exports = {};
1908    __export(private_selectors_exports, {
1909      getBlockPatternsForPostType: () => getBlockPatternsForPostType,
1910      getEditorAssets: () => getEditorAssets,
1911      getEditorSettings: () => getEditorSettings,
1912      getEntityRecordPermissions: () => getEntityRecordPermissions,
1913      getEntityRecordsPermissions: () => getEntityRecordsPermissions,
1914      getHomePage: () => getHomePage,
1915      getNavigationFallbackId: () => getNavigationFallbackId,
1916      getPostsPageId: () => getPostsPageId,
1917      getRegisteredPostMeta: () => getRegisteredPostMeta,
1918      getTemplateId: () => getTemplateId,
1919      getUndoManager: () => getUndoManager
1920    });
1921    var import_data4 = __toESM(require_data());
1922  
1923    // packages/core-data/build-module/lock-unlock.js
1924    var import_private_apis = __toESM(require_private_apis());
1925    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
1926      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
1927      "@wordpress/core-data"
1928    );
1929  
1930    // packages/core-data/build-module/utils/log-entity-deprecation.js
1931    var import_deprecated = __toESM(require_deprecated());
1932    var loggedAlready = false;
1933    function logEntityDeprecation(kind, name, functionName, {
1934      alternativeFunctionName,
1935      isShorthandSelector = false
1936    } = {}) {
1937      const deprecation = deprecatedEntities[kind]?.[name];
1938      if (!deprecation) {
1939        return;
1940      }
1941      if (!loggedAlready) {
1942        const { alternative } = deprecation;
1943        const message = isShorthandSelector ? `'$functionName}'` : `The '$kind}', '$name}' entity (used via '$functionName}')`;
1944        let alternativeMessage = `the '$alternative.kind}', '$alternative.name}' entity`;
1945        if (alternativeFunctionName) {
1946          alternativeMessage += ` via the '$alternativeFunctionName}' function`;
1947        }
1948        (0, import_deprecated.default)(message, {
1949          ...deprecation,
1950          alternative: alternativeMessage
1951        });
1952      }
1953      loggedAlready = true;
1954      setTimeout(() => {
1955        loggedAlready = false;
1956      }, 0);
1957    }
1958  
1959    // packages/core-data/build-module/private-selectors.js
1960    function getUndoManager(state) {
1961      if (window.__experimentalEnableSync) {
1962        if (false) {
1963          return getSyncManager()?.undoManager ?? state.undoManager;
1964        }
1965      }
1966      return state.undoManager;
1967    }
1968    function getNavigationFallbackId(state) {
1969      return state.navigationFallbackId;
1970    }
1971    var getBlockPatternsForPostType = (0, import_data4.createRegistrySelector)(
1972      (select) => (0, import_data4.createSelector)(
1973        (state, postType) => select(STORE_NAME).getBlockPatterns().filter(
1974          ({ postTypes }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)
1975        ),
1976        () => [select(STORE_NAME).getBlockPatterns()]
1977      )
1978    );
1979    var getEntityRecordsPermissions = (0, import_data4.createRegistrySelector)(
1980      (select) => (0, import_data4.createSelector)(
1981        (state, kind, name, ids) => {
1982          const normalizedIds = Array.isArray(ids) ? ids : [ids];
1983          return normalizedIds.map((id) => ({
1984            delete: select(STORE_NAME).canUser("delete", {
1985              kind,
1986              name,
1987              id
1988            }),
1989            update: select(STORE_NAME).canUser("update", {
1990              kind,
1991              name,
1992              id
1993            })
1994          }));
1995        },
1996        (state) => [state.userPermissions]
1997      )
1998    );
1999    function getEntityRecordPermissions(state, kind, name, id) {
2000      logEntityDeprecation(kind, name, "getEntityRecordPermissions");
2001      return getEntityRecordsPermissions(state, kind, name, id)[0];
2002    }
2003    function getRegisteredPostMeta(state, postType) {
2004      return state.registeredPostMeta?.[postType] ?? {};
2005    }
2006    function normalizePageId(value) {
2007      if (!value || !["number", "string"].includes(typeof value)) {
2008        return null;
2009      }
2010      if (Number(value) === 0) {
2011        return null;
2012      }
2013      return value.toString();
2014    }
2015    var getHomePage = (0, import_data4.createRegistrySelector)(
2016      (select) => (0, import_data4.createSelector)(
2017        () => {
2018          const siteData = select(STORE_NAME).getEntityRecord(
2019            "root",
2020            "__unstableBase"
2021          );
2022          if (!siteData) {
2023            return null;
2024          }
2025          const homepageId = siteData?.show_on_front === "page" ? normalizePageId(siteData.page_on_front) : null;
2026          if (homepageId) {
2027            return { postType: "page", postId: homepageId };
2028          }
2029          const frontPageTemplateId = select(
2030            STORE_NAME
2031          ).getDefaultTemplateId({
2032            slug: "front-page"
2033          });
2034          if (!frontPageTemplateId) {
2035            return null;
2036          }
2037          return { postType: "wp_template", postId: frontPageTemplateId };
2038        },
2039        (state) => [
2040          // Even though getDefaultTemplateId.shouldInvalidate returns true when root/site changes,
2041          // it doesn't seem to invalidate this cache, I'm not sure why.
2042          getEntityRecord(state, "root", "site"),
2043          getEntityRecord(state, "root", "__unstableBase"),
2044          getDefaultTemplateId(state, {
2045            slug: "front-page"
2046          })
2047        ]
2048      )
2049    );
2050    var getPostsPageId = (0, import_data4.createRegistrySelector)((select) => () => {
2051      const siteData = select(STORE_NAME).getEntityRecord(
2052        "root",
2053        "__unstableBase"
2054      );
2055      return siteData?.show_on_front === "page" ? normalizePageId(siteData.page_for_posts) : null;
2056    });
2057    var getTemplateId = (0, import_data4.createRegistrySelector)(
2058      (select) => (state, postType, postId) => {
2059        const homepage = unlock(select(STORE_NAME)).getHomePage();
2060        if (!homepage) {
2061          return;
2062        }
2063        if (postType === "page" && postType === homepage?.postType && postId.toString() === homepage?.postId) {
2064          const templates = select(STORE_NAME).getEntityRecords(
2065            "postType",
2066            "wp_template",
2067            {
2068              per_page: -1
2069            }
2070          );
2071          if (!templates) {
2072            return;
2073          }
2074          const id = templates.find(({ slug }) => slug === "front-page")?.id;
2075          if (id) {
2076            return id;
2077          }
2078        }
2079        const editedEntity = select(STORE_NAME).getEditedEntityRecord(
2080          "postType",
2081          postType,
2082          postId
2083        );
2084        if (!editedEntity) {
2085          return;
2086        }
2087        const postsPageId = unlock(select(STORE_NAME)).getPostsPageId();
2088        if (postType === "page" && postsPageId === postId.toString()) {
2089          return select(STORE_NAME).getDefaultTemplateId({
2090            slug: "home"
2091          });
2092        }
2093        const currentTemplateSlug = editedEntity.template;
2094        if (currentTemplateSlug) {
2095          const currentTemplate = select(STORE_NAME).getEntityRecords("postType", "wp_template", {
2096            per_page: -1
2097          })?.find(({ slug }) => slug === currentTemplateSlug);
2098          if (currentTemplate) {
2099            return currentTemplate.id;
2100          }
2101        }
2102        let slugToCheck;
2103        if (editedEntity.slug) {
2104          slugToCheck = postType === "page" ? `$postType}-$editedEntity.slug}` : `single-$postType}-$editedEntity.slug}`;
2105        } else {
2106          slugToCheck = postType === "page" ? "page" : `single-$postType}`;
2107        }
2108        return select(STORE_NAME).getDefaultTemplateId({
2109          slug: slugToCheck
2110        });
2111      }
2112    );
2113    function getEditorSettings(state) {
2114      return state.editorSettings;
2115    }
2116    function getEditorAssets(state) {
2117      return state.editorAssets;
2118    }
2119  
2120    // packages/core-data/build-module/selectors.js
2121    var EMPTY_OBJECT = {};
2122    var isRequestingEmbedPreview = (0, import_data5.createRegistrySelector)(
2123      (select) => (state, url) => {
2124        return select(STORE_NAME).isResolving("getEmbedPreview", [
2125          url
2126        ]);
2127      }
2128    );
2129    function getAuthors(state, query) {
2130      (0, import_deprecated2.default)("select( 'core' ).getAuthors()", {
2131        since: "5.9",
2132        alternative: "select( 'core' ).getUsers({ who: 'authors' })"
2133      });
2134      const path = (0, import_url2.addQueryArgs)(
2135        "/wp/v2/users/?who=authors&per_page=100",
2136        query
2137      );
2138      return getUserQueryResults(state, path);
2139    }
2140    function getCurrentUser(state) {
2141      return state.currentUser;
2142    }
2143    var getUserQueryResults = (0, import_data5.createSelector)(
2144      (state, queryID) => {
2145        const queryResults = state.users.queries[queryID] ?? [];
2146        return queryResults.map((id) => state.users.byId[id]);
2147      },
2148      (state, queryID) => [
2149        state.users.queries[queryID],
2150        state.users.byId
2151      ]
2152    );
2153    function getEntitiesByKind(state, kind) {
2154      (0, import_deprecated2.default)("wp.data.select( 'core' ).getEntitiesByKind()", {
2155        since: "6.0",
2156        alternative: "wp.data.select( 'core' ).getEntitiesConfig()"
2157      });
2158      return getEntitiesConfig(state, kind);
2159    }
2160    var getEntitiesConfig = (0, import_data5.createSelector)(
2161      (state, kind) => state.entities.config.filter((entity2) => entity2.kind === kind),
2162      /* eslint-disable @typescript-eslint/no-unused-vars */
2163      (state, kind) => state.entities.config
2164      /* eslint-enable @typescript-eslint/no-unused-vars */
2165    );
2166    function getEntity(state, kind, name) {
2167      (0, import_deprecated2.default)("wp.data.select( 'core' ).getEntity()", {
2168        since: "6.0",
2169        alternative: "wp.data.select( 'core' ).getEntityConfig()"
2170      });
2171      return getEntityConfig(state, kind, name);
2172    }
2173    function getEntityConfig(state, kind, name) {
2174      logEntityDeprecation(kind, name, "getEntityConfig");
2175      return state.entities.config?.find(
2176        (config) => config.kind === kind && config.name === name
2177      );
2178    }
2179    var getEntityRecord = (0, import_data5.createSelector)(
2180      ((state, kind, name, key, query) => {
2181        logEntityDeprecation(kind, name, "getEntityRecord");
2182        const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2183        if (!queriedState) {
2184          return void 0;
2185        }
2186        const context = query?.context ?? "default";
2187        if (!query || !query._fields) {
2188          if (!queriedState.itemIsComplete[context]?.[key]) {
2189            return void 0;
2190          }
2191          return queriedState.items[context][key];
2192        }
2193        const item = queriedState.items[context]?.[key];
2194        if (!item) {
2195          return item;
2196        }
2197        const filteredItem = {};
2198        const fields = get_normalized_comma_separable_default(query._fields) ?? [];
2199        for (let f = 0; f < fields.length; f++) {
2200          const field = fields[f].split(".");
2201          let value = item;
2202          field.forEach((fieldName) => {
2203            value = value?.[fieldName];
2204          });
2205          setNestedValue(filteredItem, field, value);
2206        }
2207        return filteredItem;
2208      }),
2209      (state, kind, name, recordId, query) => {
2210        const context = query?.context ?? "default";
2211        const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2212        return [
2213          queriedState?.items[context]?.[recordId],
2214          queriedState?.itemIsComplete[context]?.[recordId]
2215        ];
2216      }
2217    );
2218    getEntityRecord.__unstableNormalizeArgs = (args) => {
2219      const newArgs = [...args];
2220      const recordKey = newArgs?.[2];
2221      newArgs[2] = isNumericID(recordKey) ? Number(recordKey) : recordKey;
2222      return newArgs;
2223    };
2224    function hasEntityRecord(state, kind, name, key, query) {
2225      const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2226      if (!queriedState) {
2227        return false;
2228      }
2229      const context = query?.context ?? "default";
2230      if (!query || !query._fields) {
2231        return !!queriedState.itemIsComplete[context]?.[key];
2232      }
2233      const item = queriedState.items[context]?.[key];
2234      if (!item) {
2235        return false;
2236      }
2237      const fields = get_normalized_comma_separable_default(query._fields) ?? [];
2238      for (let i = 0; i < fields.length; i++) {
2239        const path = fields[i].split(".");
2240        let value = item;
2241        for (let p = 0; p < path.length; p++) {
2242          const part = path[p];
2243          if (!value || !Object.hasOwn(value, part)) {
2244            return false;
2245          }
2246          value = value[part];
2247        }
2248      }
2249      return true;
2250    }
2251    function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
2252      return getEntityRecord(state, kind, name, key);
2253    }
2254    var getRawEntityRecord = (0, import_data5.createSelector)(
2255      (state, kind, name, key) => {
2256        logEntityDeprecation(kind, name, "getRawEntityRecord");
2257        const record = getEntityRecord(
2258          state,
2259          kind,
2260          name,
2261          key
2262        );
2263        return record && Object.keys(record).reduce((accumulator, _key) => {
2264          if (isRawAttribute(getEntityConfig(state, kind, name), _key)) {
2265            accumulator[_key] = record[_key]?.raw !== void 0 ? record[_key]?.raw : record[_key];
2266          } else {
2267            accumulator[_key] = record[_key];
2268          }
2269          return accumulator;
2270        }, {});
2271      },
2272      (state, kind, name, recordId, query) => {
2273        const context = query?.context ?? "default";
2274        return [
2275          state.entities.config,
2276          state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId],
2277          state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]
2278        ];
2279      }
2280    );
2281    function hasEntityRecords(state, kind, name, query) {
2282      logEntityDeprecation(kind, name, "hasEntityRecords");
2283      return Array.isArray(getEntityRecords(state, kind, name, query));
2284    }
2285    var getEntityRecords = ((state, kind, name, query) => {
2286      logEntityDeprecation(kind, name, "getEntityRecords");
2287      const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2288      if (!queriedState) {
2289        return null;
2290      }
2291      return getQueriedItems(queriedState, query);
2292    });
2293    var getEntityRecordsTotalItems = (state, kind, name, query) => {
2294      logEntityDeprecation(kind, name, "getEntityRecordsTotalItems");
2295      const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2296      if (!queriedState) {
2297        return null;
2298      }
2299      return getQueriedTotalItems(queriedState, query);
2300    };
2301    var getEntityRecordsTotalPages = (state, kind, name, query) => {
2302      logEntityDeprecation(kind, name, "getEntityRecordsTotalPages");
2303      const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
2304      if (!queriedState) {
2305        return null;
2306      }
2307      if (query?.per_page === -1) {
2308        return 1;
2309      }
2310      const totalItems = getQueriedTotalItems(queriedState, query);
2311      if (!totalItems) {
2312        return totalItems;
2313      }
2314      if (!query?.per_page) {
2315        return getQueriedTotalPages(queriedState, query);
2316      }
2317      return Math.ceil(totalItems / query.per_page);
2318    };
2319    var __experimentalGetDirtyEntityRecords = (0, import_data5.createSelector)(
2320      (state) => {
2321        const {
2322          entities: { records }
2323        } = state;
2324        const dirtyRecords = [];
2325        Object.keys(records).forEach((kind) => {
2326          Object.keys(records[kind]).forEach((name) => {
2327            const primaryKeys = Object.keys(records[kind][name].edits).filter(
2328              (primaryKey) => (
2329                // The entity record must exist (not be deleted),
2330                // and it must have edits.
2331                getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey)
2332              )
2333            );
2334            if (primaryKeys.length) {
2335              const entityConfig = getEntityConfig(state, kind, name);
2336              primaryKeys.forEach((primaryKey) => {
2337                const entityRecord = getEditedEntityRecord(
2338                  state,
2339                  kind,
2340                  name,
2341                  primaryKey
2342                );
2343                dirtyRecords.push({
2344                  // We avoid using primaryKey because it's transformed into a string
2345                  // when it's used as an object key.
2346                  key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : void 0,
2347                  title: entityConfig?.getTitle?.(entityRecord) || "",
2348                  name,
2349                  kind
2350                });
2351              });
2352            }
2353          });
2354        });
2355        return dirtyRecords;
2356      },
2357      (state) => [state.entities.records]
2358    );
2359    var __experimentalGetEntitiesBeingSaved = (0, import_data5.createSelector)(
2360      (state) => {
2361        const {
2362          entities: { records }
2363        } = state;
2364        const recordsBeingSaved = [];
2365        Object.keys(records).forEach((kind) => {
2366          Object.keys(records[kind]).forEach((name) => {
2367            const primaryKeys = Object.keys(records[kind][name].saving).filter(
2368              (primaryKey) => isSavingEntityRecord(state, kind, name, primaryKey)
2369            );
2370            if (primaryKeys.length) {
2371              const entityConfig = getEntityConfig(state, kind, name);
2372              primaryKeys.forEach((primaryKey) => {
2373                const entityRecord = getEditedEntityRecord(
2374                  state,
2375                  kind,
2376                  name,
2377                  primaryKey
2378                );
2379                recordsBeingSaved.push({
2380                  // We avoid using primaryKey because it's transformed into a string
2381                  // when it's used as an object key.
2382                  key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : void 0,
2383                  title: entityConfig?.getTitle?.(entityRecord) || "",
2384                  name,
2385                  kind
2386                });
2387              });
2388            }
2389          });
2390        });
2391        return recordsBeingSaved;
2392      },
2393      (state) => [state.entities.records]
2394    );
2395    function getEntityRecordEdits(state, kind, name, recordId) {
2396      logEntityDeprecation(kind, name, "getEntityRecordEdits");
2397      return state.entities.records?.[kind]?.[name]?.edits?.[recordId];
2398    }
2399    var getEntityRecordNonTransientEdits = (0, import_data5.createSelector)(
2400      (state, kind, name, recordId) => {
2401        logEntityDeprecation(kind, name, "getEntityRecordNonTransientEdits");
2402        const { transientEdits } = getEntityConfig(state, kind, name) || {};
2403        const edits = getEntityRecordEdits(state, kind, name, recordId) || {};
2404        if (!transientEdits) {
2405          return edits;
2406        }
2407        return Object.keys(edits).reduce((acc, key) => {
2408          if (!transientEdits[key]) {
2409            acc[key] = edits[key];
2410          }
2411          return acc;
2412        }, {});
2413      },
2414      (state, kind, name, recordId) => [
2415        state.entities.config,
2416        state.entities.records?.[kind]?.[name]?.edits?.[recordId]
2417      ]
2418    );
2419    function hasEditsForEntityRecord(state, kind, name, recordId) {
2420      logEntityDeprecation(kind, name, "hasEditsForEntityRecord");
2421      return isSavingEntityRecord(state, kind, name, recordId) || Object.keys(
2422        getEntityRecordNonTransientEdits(state, kind, name, recordId)
2423      ).length > 0;
2424    }
2425    var getEditedEntityRecord = (0, import_data5.createSelector)(
2426      (state, kind, name, recordId) => {
2427        logEntityDeprecation(kind, name, "getEditedEntityRecord");
2428        const raw = getRawEntityRecord(state, kind, name, recordId);
2429        const edited = getEntityRecordEdits(state, kind, name, recordId);
2430        if (!raw && !edited) {
2431          return false;
2432        }
2433        return {
2434          ...raw,
2435          ...edited
2436        };
2437      },
2438      (state, kind, name, recordId, query) => {
2439        const context = query?.context ?? "default";
2440        return [
2441          state.entities.config,
2442          state.entities.records?.[kind]?.[name]?.queriedData.items[context]?.[recordId],
2443          state.entities.records?.[kind]?.[name]?.queriedData.itemIsComplete[context]?.[recordId],
2444          state.entities.records?.[kind]?.[name]?.edits?.[recordId]
2445        ];
2446      }
2447    );
2448    function isAutosavingEntityRecord(state, kind, name, recordId) {
2449      logEntityDeprecation(kind, name, "isAutosavingEntityRecord");
2450      const { pending, isAutosave } = state.entities.records?.[kind]?.[name]?.saving?.[recordId] ?? {};
2451      return Boolean(pending && isAutosave);
2452    }
2453    function isSavingEntityRecord(state, kind, name, recordId) {
2454      logEntityDeprecation(kind, name, "isSavingEntityRecord");
2455      return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.pending ?? false;
2456    }
2457    function isDeletingEntityRecord(state, kind, name, recordId) {
2458      logEntityDeprecation(kind, name, "isDeletingEntityRecord");
2459      return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.pending ?? false;
2460    }
2461    function getLastEntitySaveError(state, kind, name, recordId) {
2462      logEntityDeprecation(kind, name, "getLastEntitySaveError");
2463      return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.error;
2464    }
2465    function getLastEntityDeleteError(state, kind, name, recordId) {
2466      logEntityDeprecation(kind, name, "getLastEntityDeleteError");
2467      return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.error;
2468    }
2469    function getUndoEdit(state) {
2470      (0, import_deprecated2.default)("select( 'core' ).getUndoEdit()", {
2471        since: "6.3"
2472      });
2473      return void 0;
2474    }
2475    function getRedoEdit(state) {
2476      (0, import_deprecated2.default)("select( 'core' ).getRedoEdit()", {
2477        since: "6.3"
2478      });
2479      return void 0;
2480    }
2481    function hasUndo(state) {
2482      return getUndoManager(state).hasUndo();
2483    }
2484    function hasRedo(state) {
2485      return getUndoManager(state).hasRedo();
2486    }
2487    function getCurrentTheme(state) {
2488      if (!state.currentTheme) {
2489        return null;
2490      }
2491      return getEntityRecord(state, "root", "theme", state.currentTheme);
2492    }
2493    function __experimentalGetCurrentGlobalStylesId(state) {
2494      return state.currentGlobalStylesId;
2495    }
2496    function getThemeSupports(state) {
2497      return getCurrentTheme(state)?.theme_supports ?? EMPTY_OBJECT;
2498    }
2499    function getEmbedPreview(state, url) {
2500      return state.embedPreviews[url];
2501    }
2502    function isPreviewEmbedFallback(state, url) {
2503      const preview = state.embedPreviews[url];
2504      const oEmbedLinkCheck = '<a href="' + url + '">' + url + "</a>";
2505      if (!preview) {
2506        return false;
2507      }
2508      return preview.html === oEmbedLinkCheck;
2509    }
2510    function canUser(state, action, resource, id) {
2511      const isEntity = typeof resource === "object";
2512      if (isEntity && (!resource.kind || !resource.name)) {
2513        return false;
2514      }
2515      if (isEntity) {
2516        logEntityDeprecation(resource.kind, resource.name, "canUser");
2517      }
2518      const key = getUserPermissionCacheKey(action, resource, id);
2519      return state.userPermissions[key];
2520    }
2521    function canUserEditEntityRecord(state, kind, name, recordId) {
2522      (0, import_deprecated2.default)(`wp.data.select( 'core' ).canUserEditEntityRecord()`, {
2523        since: "6.7",
2524        alternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )`
2525      });
2526      return canUser(state, "update", { kind, name, id: recordId });
2527    }
2528    function getAutosaves(state, postType, postId) {
2529      return state.autosaves[postId];
2530    }
2531    function getAutosave(state, postType, postId, authorId) {
2532      if (authorId === void 0) {
2533        return;
2534      }
2535      const autosaves2 = state.autosaves[postId];
2536      return autosaves2?.find(
2537        (autosave) => autosave.author === authorId
2538      );
2539    }
2540    var hasFetchedAutosaves = (0, import_data5.createRegistrySelector)(
2541      (select) => (state, postType, postId) => {
2542        return select(STORE_NAME).hasFinishedResolution("getAutosaves", [
2543          postType,
2544          postId
2545        ]);
2546      }
2547    );
2548    function getReferenceByDistinctEdits(state) {
2549      return state.editsReference;
2550    }
2551    function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
2552      const currentTheme2 = getCurrentTheme(state);
2553      if (!currentTheme2) {
2554        return null;
2555      }
2556      return state.themeBaseGlobalStyles[currentTheme2.stylesheet];
2557    }
2558    function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
2559      const currentTheme2 = getCurrentTheme(state);
2560      if (!currentTheme2) {
2561        return null;
2562      }
2563      return state.themeGlobalStyleVariations[currentTheme2.stylesheet];
2564    }
2565    function getBlockPatterns(state) {
2566      return state.blockPatterns;
2567    }
2568    function getBlockPatternCategories(state) {
2569      return state.blockPatternCategories;
2570    }
2571    function getUserPatternCategories(state) {
2572      return state.userPatternCategories;
2573    }
2574    function getCurrentThemeGlobalStylesRevisions(state) {
2575      (0, import_deprecated2.default)("select( 'core' ).getCurrentThemeGlobalStylesRevisions()", {
2576        since: "6.5.0",
2577        alternative: "select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )"
2578      });
2579      const currentGlobalStylesId2 = __experimentalGetCurrentGlobalStylesId(state);
2580      if (!currentGlobalStylesId2) {
2581        return null;
2582      }
2583      return state.themeGlobalStyleRevisions[currentGlobalStylesId2];
2584    }
2585    function getDefaultTemplateId(state, query) {
2586      return state.defaultTemplates[JSON.stringify(query)];
2587    }
2588    var getRevisions = (state, kind, name, recordKey, query) => {
2589      logEntityDeprecation(kind, name, "getRevisions");
2590      const queriedStateRevisions = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
2591      if (!queriedStateRevisions) {
2592        return null;
2593      }
2594      return getQueriedItems(queriedStateRevisions, query);
2595    };
2596    var getRevision = (0, import_data5.createSelector)(
2597      (state, kind, name, recordKey, revisionKey, query) => {
2598        logEntityDeprecation(kind, name, "getRevision");
2599        const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
2600        if (!queriedState) {
2601          return void 0;
2602        }
2603        const context = query?.context ?? "default";
2604        if (!query || !query._fields) {
2605          if (!queriedState.itemIsComplete[context]?.[revisionKey]) {
2606            return void 0;
2607          }
2608          return queriedState.items[context][revisionKey];
2609        }
2610        const item = queriedState.items[context]?.[revisionKey];
2611        if (!item) {
2612          return item;
2613        }
2614        const filteredItem = {};
2615        const fields = get_normalized_comma_separable_default(query._fields) ?? [];
2616        for (let f = 0; f < fields.length; f++) {
2617          const field = fields[f].split(".");
2618          let value = item;
2619          field.forEach((fieldName) => {
2620            value = value?.[fieldName];
2621          });
2622          setNestedValue(filteredItem, field, value);
2623        }
2624        return filteredItem;
2625      },
2626      (state, kind, name, recordKey, revisionKey, query) => {
2627        const context = query?.context ?? "default";
2628        const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
2629        return [
2630          queriedState?.items?.[context]?.[revisionKey],
2631          queriedState?.itemIsComplete?.[context]?.[revisionKey]
2632        ];
2633      }
2634    );
2635  
2636    // packages/core-data/build-module/actions.js
2637    var actions_exports = {};
2638    __export(actions_exports, {
2639      __experimentalBatch: () => __experimentalBatch,
2640      __experimentalReceiveCurrentGlobalStylesId: () => __experimentalReceiveCurrentGlobalStylesId,
2641      __experimentalReceiveThemeBaseGlobalStyles: () => __experimentalReceiveThemeBaseGlobalStyles,
2642      __experimentalReceiveThemeGlobalStyleVariations: () => __experimentalReceiveThemeGlobalStyleVariations,
2643      __experimentalSaveSpecifiedEntityEdits: () => __experimentalSaveSpecifiedEntityEdits,
2644      __unstableCreateUndoLevel: () => __unstableCreateUndoLevel,
2645      addEntities: () => addEntities,
2646      deleteEntityRecord: () => deleteEntityRecord,
2647      editEntityRecord: () => editEntityRecord,
2648      receiveAutosaves: () => receiveAutosaves,
2649      receiveCurrentTheme: () => receiveCurrentTheme,
2650      receiveCurrentUser: () => receiveCurrentUser,
2651      receiveDefaultTemplateId: () => receiveDefaultTemplateId,
2652      receiveEmbedPreview: () => receiveEmbedPreview,
2653      receiveEntityRecords: () => receiveEntityRecords,
2654      receiveNavigationFallbackId: () => receiveNavigationFallbackId,
2655      receiveRevisions: () => receiveRevisions,
2656      receiveThemeGlobalStyleRevisions: () => receiveThemeGlobalStyleRevisions,
2657      receiveThemeSupports: () => receiveThemeSupports,
2658      receiveUploadPermissions: () => receiveUploadPermissions,
2659      receiveUserPermission: () => receiveUserPermission,
2660      receiveUserPermissions: () => receiveUserPermissions,
2661      receiveUserQuery: () => receiveUserQuery,
2662      redo: () => redo,
2663      saveEditedEntityRecord: () => saveEditedEntityRecord,
2664      saveEntityRecord: () => saveEntityRecord,
2665      undo: () => undo
2666    });
2667    var import_es63 = __toESM(require_es6());
2668    var import_api_fetch3 = __toESM(require_api_fetch());
2669    var import_url3 = __toESM(require_url());
2670    var import_deprecated3 = __toESM(require_deprecated());
2671  
2672    // packages/core-data/build-module/batch/default-processor.js
2673    var import_api_fetch2 = __toESM(require_api_fetch());
2674    var maxItems = null;
2675    function chunk(arr, chunkSize) {
2676      const tmp = [...arr];
2677      const cache3 = [];
2678      while (tmp.length) {
2679        cache3.push(tmp.splice(0, chunkSize));
2680      }
2681      return cache3;
2682    }
2683    async function defaultProcessor(requests) {
2684      if (maxItems === null) {
2685        const preflightResponse = await (0, import_api_fetch2.default)({
2686          path: "/batch/v1",
2687          method: "OPTIONS"
2688        });
2689        maxItems = preflightResponse.endpoints[0].args.requests.maxItems;
2690      }
2691      const results = [];
2692      for (const batchRequests of chunk(requests, maxItems)) {
2693        const batchResponse = await (0, import_api_fetch2.default)({
2694          path: "/batch/v1",
2695          method: "POST",
2696          data: {
2697            validation: "require-all-validate",
2698            requests: batchRequests.map((request) => ({
2699              path: request.path,
2700              body: request.data,
2701              // Rename 'data' to 'body'.
2702              method: request.method,
2703              headers: request.headers
2704            }))
2705          }
2706        });
2707        let batchResults;
2708        if (batchResponse.failed) {
2709          batchResults = batchResponse.responses.map((response) => ({
2710            error: response?.body
2711          }));
2712        } else {
2713          batchResults = batchResponse.responses.map((response) => {
2714            const result = {};
2715            if (response.status >= 200 && response.status < 300) {
2716              result.output = response.body;
2717            } else {
2718              result.error = response.body;
2719            }
2720            return result;
2721          });
2722        }
2723        results.push(...batchResults);
2724      }
2725      return results;
2726    }
2727  
2728    // packages/core-data/build-module/batch/create-batch.js
2729    function createBatch(processor = defaultProcessor) {
2730      let lastId = 0;
2731      let queue = [];
2732      const pending = new ObservableSet();
2733      return {
2734        /**
2735         * Adds an input to the batch and returns a promise that is resolved or
2736         * rejected when the input is processed by `batch.run()`.
2737         *
2738         * You may also pass a thunk which allows inputs to be added
2739         * asynchronously.
2740         *
2741         * ```
2742         * // Both are allowed:
2743         * batch.add( { path: '/v1/books', ... } );
2744         * batch.add( ( add ) => add( { path: '/v1/books', ... } ) );
2745         * ```
2746         *
2747         * If a thunk is passed, `batch.run()` will pause until either:
2748         *
2749         * - The thunk calls its `add` argument, or;
2750         * - The thunk returns a promise and that promise resolves, or;
2751         * - The thunk returns a non-promise.
2752         *
2753         * @param {any|Function} inputOrThunk Input to add or thunk to execute.
2754         *
2755         * @return {Promise|any} If given an input, returns a promise that
2756         *                       is resolved or rejected when the batch is
2757         *                       processed. If given a thunk, returns the return
2758         *                       value of that thunk.
2759         */
2760        add(inputOrThunk) {
2761          const id = ++lastId;
2762          pending.add(id);
2763          const add = (input) => new Promise((resolve, reject) => {
2764            queue.push({
2765              input,
2766              resolve,
2767              reject
2768            });
2769            pending.delete(id);
2770          });
2771          if (typeof inputOrThunk === "function") {
2772            return Promise.resolve(inputOrThunk(add)).finally(() => {
2773              pending.delete(id);
2774            });
2775          }
2776          return add(inputOrThunk);
2777        },
2778        /**
2779         * Runs the batch. This calls `batchProcessor` and resolves or rejects
2780         * all promises returned by `add()`.
2781         *
2782         * @return {Promise<boolean>} A promise that resolves to a boolean that is true
2783         *                   if the processor returned no errors.
2784         */
2785        async run() {
2786          if (pending.size) {
2787            await new Promise((resolve) => {
2788              const unsubscribe = pending.subscribe(() => {
2789                if (!pending.size) {
2790                  unsubscribe();
2791                  resolve(void 0);
2792                }
2793              });
2794            });
2795          }
2796          let results;
2797          try {
2798            results = await processor(
2799              queue.map(({ input }) => input)
2800            );
2801            if (results.length !== queue.length) {
2802              throw new Error(
2803                "run: Array returned by processor must be same size as input array."
2804              );
2805            }
2806          } catch (error) {
2807            for (const { reject } of queue) {
2808              reject(error);
2809            }
2810            throw error;
2811          }
2812          let isSuccess = true;
2813          results.forEach((result, key) => {
2814            const queueItem = queue[key];
2815            if (result?.error) {
2816              queueItem?.reject(result.error);
2817              isSuccess = false;
2818            } else {
2819              queueItem?.resolve(result?.output ?? result);
2820            }
2821          });
2822          queue = [];
2823          return isSuccess;
2824        }
2825      };
2826    }
2827    var ObservableSet = class {
2828      constructor(...args) {
2829        this.set = new Set(...args);
2830        this.subscribers = /* @__PURE__ */ new Set();
2831      }
2832      get size() {
2833        return this.set.size;
2834      }
2835      add(value) {
2836        this.set.add(value);
2837        this.subscribers.forEach((subscriber) => subscriber());
2838        return this;
2839      }
2840      delete(value) {
2841        const isSuccess = this.set.delete(value);
2842        this.subscribers.forEach((subscriber) => subscriber());
2843        return isSuccess;
2844      }
2845      subscribe(subscriber) {
2846        this.subscribers.add(subscriber);
2847        return () => {
2848          this.subscribers.delete(subscriber);
2849        };
2850      }
2851    };
2852  
2853    // packages/core-data/build-module/actions.js
2854    function receiveUserQuery(queryID, users2) {
2855      return {
2856        type: "RECEIVE_USER_QUERY",
2857        users: Array.isArray(users2) ? users2 : [users2],
2858        queryID
2859      };
2860    }
2861    function receiveCurrentUser(currentUser2) {
2862      return {
2863        type: "RECEIVE_CURRENT_USER",
2864        currentUser: currentUser2
2865      };
2866    }
2867    function addEntities(entities2) {
2868      return {
2869        type: "ADD_ENTITIES",
2870        entities: entities2
2871      };
2872    }
2873    function receiveEntityRecords(kind, name, records, query = void 0, invalidateCache = false, edits = void 0, meta = void 0) {
2874      if (kind === "postType") {
2875        records = (Array.isArray(records) ? records : [records]).map(
2876          (record) => record.status === "auto-draft" ? { ...record, title: "" } : record
2877        );
2878      }
2879      let action;
2880      if (query) {
2881        action = receiveQueriedItems(records, query, edits, meta);
2882      } else {
2883        action = receiveItems(records, edits, meta);
2884      }
2885      return {
2886        ...action,
2887        kind,
2888        name,
2889        invalidateCache
2890      };
2891    }
2892    function receiveCurrentTheme(currentTheme2) {
2893      return {
2894        type: "RECEIVE_CURRENT_THEME",
2895        currentTheme: currentTheme2
2896      };
2897    }
2898    function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId2) {
2899      return {
2900        type: "RECEIVE_CURRENT_GLOBAL_STYLES_ID",
2901        id: currentGlobalStylesId2
2902      };
2903    }
2904    function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) {
2905      return {
2906        type: "RECEIVE_THEME_GLOBAL_STYLES",
2907        stylesheet,
2908        globalStyles
2909      };
2910    }
2911    function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations) {
2912      return {
2913        type: "RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS",
2914        stylesheet,
2915        variations
2916      };
2917    }
2918    function receiveThemeSupports() {
2919      (0, import_deprecated3.default)("wp.data.dispatch( 'core' ).receiveThemeSupports", {
2920        since: "5.9"
2921      });
2922      return {
2923        type: "DO_NOTHING"
2924      };
2925    }
2926    function receiveThemeGlobalStyleRevisions(currentId, revisions) {
2927      (0, import_deprecated3.default)(
2928        "wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()",
2929        {
2930          since: "6.5.0",
2931          alternative: "wp.data.dispatch( 'core' ).receiveRevisions"
2932        }
2933      );
2934      return {
2935        type: "RECEIVE_THEME_GLOBAL_STYLE_REVISIONS",
2936        currentId,
2937        revisions
2938      };
2939    }
2940    function receiveEmbedPreview(url, preview) {
2941      return {
2942        type: "RECEIVE_EMBED_PREVIEW",
2943        url,
2944        preview
2945      };
2946    }
2947    var deleteEntityRecord = (kind, name, recordId, query, { __unstableFetch = import_api_fetch3.default, throwOnError = false } = {}) => async ({ dispatch, resolveSelect }) => {
2948      logEntityDeprecation(kind, name, "deleteEntityRecord");
2949      const configs = await resolveSelect.getEntitiesConfig(kind);
2950      const entityConfig = configs.find(
2951        (config) => config.kind === kind && config.name === name
2952      );
2953      let error;
2954      let deletedRecord = false;
2955      if (!entityConfig) {
2956        return;
2957      }
2958      const lock2 = await dispatch.__unstableAcquireStoreLock(
2959        STORE_NAME,
2960        ["entities", "records", kind, name, recordId],
2961        { exclusive: true }
2962      );
2963      try {
2964        dispatch({
2965          type: "DELETE_ENTITY_RECORD_START",
2966          kind,
2967          name,
2968          recordId
2969        });
2970        let hasError = false;
2971        let { baseURL } = entityConfig;
2972        if (kind === "postType" && name === "wp_template" && (recordId && typeof recordId === "string" && !/^\d+$/.test(recordId) || !window?.__experimentalTemplateActivate)) {
2973          baseURL = baseURL.slice(0, baseURL.lastIndexOf("/")) + "/templates";
2974        }
2975        try {
2976          let path = `$baseURL}/$recordId}`;
2977          if (query) {
2978            path = (0, import_url3.addQueryArgs)(path, query);
2979          }
2980          deletedRecord = await __unstableFetch({
2981            path,
2982            method: "DELETE"
2983          });
2984          await dispatch(removeItems(kind, name, recordId, true));
2985        } catch (_error) {
2986          hasError = true;
2987          error = _error;
2988        }
2989        dispatch({
2990          type: "DELETE_ENTITY_RECORD_FINISH",
2991          kind,
2992          name,
2993          recordId,
2994          error
2995        });
2996        if (hasError && throwOnError) {
2997          throw error;
2998        }
2999        return deletedRecord;
3000      } finally {
3001        dispatch.__unstableReleaseStoreLock(lock2);
3002      }
3003    };
3004    var editEntityRecord = (kind, name, recordId, edits, options = {}) => ({ select, dispatch }) => {
3005      logEntityDeprecation(kind, name, "editEntityRecord");
3006      const entityConfig = select.getEntityConfig(kind, name);
3007      if (!entityConfig) {
3008        throw new Error(
3009          `The entity being edited ($kind}, $name}) does not have a loaded config.`
3010        );
3011      }
3012      const { mergedEdits = {} } = entityConfig;
3013      const record = select.getRawEntityRecord(kind, name, recordId);
3014      const editedRecord = select.getEditedEntityRecord(
3015        kind,
3016        name,
3017        recordId
3018      );
3019      const edit = {
3020        kind,
3021        name,
3022        recordId,
3023        // Clear edits when they are equal to their persisted counterparts
3024        // so that the property is not considered dirty.
3025        edits: Object.keys(edits).reduce((acc, key) => {
3026          const recordValue = record[key];
3027          const editedRecordValue = editedRecord[key];
3028          const value = mergedEdits[key] ? { ...editedRecordValue, ...edits[key] } : edits[key];
3029          acc[key] = (0, import_es63.default)(recordValue, value) ? void 0 : value;
3030          return acc;
3031        }, {})
3032      };
3033      if (window.__experimentalEnableSync && entityConfig.syncConfig) {
3034        if (false) {
3035          const objectType = `$kind}/$name}`;
3036          const objectId = recordId;
3037          getSyncManager()?.update(
3038            objectType,
3039            objectId,
3040            edit.edits,
3041            LOCAL_EDITOR_ORIGIN
3042          );
3043        }
3044      }
3045      if (!options.undoIgnore) {
3046        select.getUndoManager().addRecord(
3047          [
3048            {
3049              id: { kind, name, recordId },
3050              changes: Object.keys(edits).reduce((acc, key) => {
3051                acc[key] = {
3052                  from: editedRecord[key],
3053                  to: edits[key]
3054                };
3055                return acc;
3056              }, {})
3057            }
3058          ],
3059          options.isCached
3060        );
3061      }
3062      dispatch({
3063        type: "EDIT_ENTITY_RECORD",
3064        ...edit
3065      });
3066    };
3067    var undo = () => ({ select, dispatch }) => {
3068      const undoRecord = select.getUndoManager().undo();
3069      if (!undoRecord) {
3070        return;
3071      }
3072      dispatch({
3073        type: "UNDO",
3074        record: undoRecord
3075      });
3076    };
3077    var redo = () => ({ select, dispatch }) => {
3078      const redoRecord = select.getUndoManager().redo();
3079      if (!redoRecord) {
3080        return;
3081      }
3082      dispatch({
3083        type: "REDO",
3084        record: redoRecord
3085      });
3086    };
3087    var __unstableCreateUndoLevel = () => ({ select }) => {
3088      select.getUndoManager().addRecord();
3089    };
3090    var saveEntityRecord = (kind, name, record, {
3091      isAutosave = false,
3092      __unstableFetch = import_api_fetch3.default,
3093      throwOnError = false
3094    } = {}) => async ({ select, resolveSelect, dispatch }) => {
3095      logEntityDeprecation(kind, name, "saveEntityRecord");
3096      const configs = await resolveSelect.getEntitiesConfig(kind);
3097      const entityConfig = configs.find(
3098        (config) => config.kind === kind && config.name === name
3099      );
3100      if (!entityConfig) {
3101        return;
3102      }
3103      const entityIdKey = entityConfig.key ?? DEFAULT_ENTITY_KEY;
3104      const recordId = record[entityIdKey];
3105      const isNewRecord = !!entityIdKey && !recordId;
3106      const lock2 = await dispatch.__unstableAcquireStoreLock(
3107        STORE_NAME,
3108        ["entities", "records", kind, name, recordId || v4_default()],
3109        { exclusive: true }
3110      );
3111      try {
3112        for (const [key, value] of Object.entries(record)) {
3113          if (typeof value === "function") {
3114            const evaluatedValue = value(
3115              select.getEditedEntityRecord(kind, name, recordId)
3116            );
3117            dispatch.editEntityRecord(
3118              kind,
3119              name,
3120              recordId,
3121              {
3122                [key]: evaluatedValue
3123              },
3124              { undoIgnore: true }
3125            );
3126            record[key] = evaluatedValue;
3127          }
3128        }
3129        dispatch({
3130          type: "SAVE_ENTITY_RECORD_START",
3131          kind,
3132          name,
3133          recordId,
3134          isAutosave
3135        });
3136        let updatedRecord;
3137        let error;
3138        let hasError = false;
3139        let { baseURL } = entityConfig;
3140        if (kind === "postType" && name === "wp_template" && (recordId && typeof recordId === "string" && !/^\d+$/.test(recordId) || !window?.__experimentalTemplateActivate)) {
3141          baseURL = baseURL.slice(0, baseURL.lastIndexOf("/")) + "/templates";
3142        }
3143        try {
3144          const path = `$baseURL}$recordId ? "/" + recordId : ""}`;
3145          const persistedRecord = !isNewRecord ? select.getRawEntityRecord(kind, name, recordId) : {};
3146          if (isAutosave) {
3147            const currentUser2 = select.getCurrentUser();
3148            const currentUserId = currentUser2 ? currentUser2.id : void 0;
3149            const autosavePost = await resolveSelect.getAutosave(
3150              persistedRecord.type,
3151              persistedRecord.id,
3152              currentUserId
3153            );
3154            let data = {
3155              ...persistedRecord,
3156              ...autosavePost,
3157              ...record
3158            };
3159            data = Object.keys(data).reduce(
3160              (acc, key) => {
3161                if ([
3162                  "title",
3163                  "excerpt",
3164                  "content",
3165                  "meta"
3166                ].includes(key)) {
3167                  acc[key] = data[key];
3168                }
3169                return acc;
3170              },
3171              {
3172                // Do not update the `status` if we have edited it when auto saving.
3173                // It's very important to let the user explicitly save this change,
3174                // because it can lead to unexpected results. An example would be to
3175                // have a draft post and change the status to publish.
3176                status: data.status === "auto-draft" ? "draft" : void 0
3177              }
3178            );
3179            updatedRecord = await __unstableFetch({
3180              path: `$path}/autosaves`,
3181              method: "POST",
3182              data
3183            });
3184            if (persistedRecord.id === updatedRecord.id) {
3185              let newRecord = {
3186                ...persistedRecord,
3187                ...data,
3188                ...updatedRecord
3189              };
3190              newRecord = Object.keys(newRecord).reduce(
3191                (acc, key) => {
3192                  if (["title", "excerpt", "content"].includes(
3193                    key
3194                  )) {
3195                    acc[key] = newRecord[key];
3196                  } else if (key === "status") {
3197                    acc[key] = persistedRecord.status === "auto-draft" && newRecord.status === "draft" ? newRecord.status : persistedRecord.status;
3198                  } else {
3199                    acc[key] = persistedRecord[key];
3200                  }
3201                  return acc;
3202                },
3203                {}
3204              );
3205              dispatch.receiveEntityRecords(
3206                kind,
3207                name,
3208                newRecord,
3209                void 0,
3210                true
3211              );
3212            } else {
3213              dispatch.receiveAutosaves(
3214                persistedRecord.id,
3215                updatedRecord
3216              );
3217            }
3218          } else {
3219            let edits = record;
3220            if (entityConfig.__unstablePrePersist) {
3221              edits = {
3222                ...edits,
3223                ...entityConfig.__unstablePrePersist(
3224                  persistedRecord,
3225                  edits
3226                )
3227              };
3228            }
3229            updatedRecord = await __unstableFetch({
3230              path,
3231              method: recordId ? "PUT" : "POST",
3232              data: edits
3233            });
3234            dispatch.receiveEntityRecords(
3235              kind,
3236              name,
3237              updatedRecord,
3238              void 0,
3239              true,
3240              edits
3241            );
3242          }
3243        } catch (_error) {
3244          hasError = true;
3245          error = _error;
3246        }
3247        dispatch({
3248          type: "SAVE_ENTITY_RECORD_FINISH",
3249          kind,
3250          name,
3251          recordId,
3252          error,
3253          isAutosave
3254        });
3255        if (hasError && throwOnError) {
3256          throw error;
3257        }
3258        return updatedRecord;
3259      } finally {
3260        dispatch.__unstableReleaseStoreLock(lock2);
3261      }
3262    };
3263    var __experimentalBatch = (requests) => async ({ dispatch }) => {
3264      const batch = createBatch();
3265      const api = {
3266        saveEntityRecord(kind, name, record, options) {
3267          return batch.add(
3268            (add) => dispatch.saveEntityRecord(kind, name, record, {
3269              ...options,
3270              __unstableFetch: add
3271            })
3272          );
3273        },
3274        saveEditedEntityRecord(kind, name, recordId, options) {
3275          return batch.add(
3276            (add) => dispatch.saveEditedEntityRecord(kind, name, recordId, {
3277              ...options,
3278              __unstableFetch: add
3279            })
3280          );
3281        },
3282        deleteEntityRecord(kind, name, recordId, query, options) {
3283          return batch.add(
3284            (add) => dispatch.deleteEntityRecord(kind, name, recordId, query, {
3285              ...options,
3286              __unstableFetch: add
3287            })
3288          );
3289        }
3290      };
3291      const resultPromises = requests.map((request) => request(api));
3292      const [, ...results] = await Promise.all([
3293        batch.run(),
3294        ...resultPromises
3295      ]);
3296      return results;
3297    };
3298    var saveEditedEntityRecord = (kind, name, recordId, options) => async ({ select, dispatch, resolveSelect }) => {
3299      logEntityDeprecation(kind, name, "saveEditedEntityRecord");
3300      if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
3301        return;
3302      }
3303      const configs = await resolveSelect.getEntitiesConfig(kind);
3304      const entityConfig = configs.find(
3305        (config) => config.kind === kind && config.name === name
3306      );
3307      if (!entityConfig) {
3308        return;
3309      }
3310      const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;
3311      const edits = select.getEntityRecordNonTransientEdits(
3312        kind,
3313        name,
3314        recordId
3315      );
3316      const record = { [entityIdKey]: recordId, ...edits };
3317      return await dispatch.saveEntityRecord(kind, name, record, options);
3318    };
3319    var __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSave, options) => async ({ select, dispatch, resolveSelect }) => {
3320      logEntityDeprecation(
3321        kind,
3322        name,
3323        "__experimentalSaveSpecifiedEntityEdits"
3324      );
3325      if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
3326        return;
3327      }
3328      const edits = select.getEntityRecordNonTransientEdits(
3329        kind,
3330        name,
3331        recordId
3332      );
3333      const editsToSave = {};
3334      for (const item of itemsToSave) {
3335        setNestedValue(editsToSave, item, getNestedValue(edits, item));
3336      }
3337      const configs = await resolveSelect.getEntitiesConfig(kind);
3338      const entityConfig = configs.find(
3339        (config) => config.kind === kind && config.name === name
3340      );
3341      const entityIdKey = entityConfig?.key || DEFAULT_ENTITY_KEY;
3342      if (recordId) {
3343        editsToSave[entityIdKey] = recordId;
3344      }
3345      return await dispatch.saveEntityRecord(
3346        kind,
3347        name,
3348        editsToSave,
3349        options
3350      );
3351    };
3352    function receiveUploadPermissions(hasUploadPermissions) {
3353      (0, import_deprecated3.default)("wp.data.dispatch( 'core' ).receiveUploadPermissions", {
3354        since: "5.9",
3355        alternative: "receiveUserPermission"
3356      });
3357      return receiveUserPermission("create/media", hasUploadPermissions);
3358    }
3359    function receiveUserPermission(key, isAllowed) {
3360      return {
3361        type: "RECEIVE_USER_PERMISSION",
3362        key,
3363        isAllowed
3364      };
3365    }
3366    function receiveUserPermissions(permissions) {
3367      return {
3368        type: "RECEIVE_USER_PERMISSIONS",
3369        permissions
3370      };
3371    }
3372    function receiveAutosaves(postId, autosaves2) {
3373      return {
3374        type: "RECEIVE_AUTOSAVES",
3375        postId,
3376        autosaves: Array.isArray(autosaves2) ? autosaves2 : [autosaves2]
3377      };
3378    }
3379    function receiveNavigationFallbackId(fallbackId) {
3380      return {
3381        type: "RECEIVE_NAVIGATION_FALLBACK_ID",
3382        fallbackId
3383      };
3384    }
3385    function receiveDefaultTemplateId(query, templateId) {
3386      return {
3387        type: "RECEIVE_DEFAULT_TEMPLATE",
3388        query,
3389        templateId
3390      };
3391    }
3392    var receiveRevisions = (kind, name, recordKey, records, query, invalidateCache = false, meta) => async ({ dispatch, resolveSelect }) => {
3393      logEntityDeprecation(kind, name, "receiveRevisions");
3394      const configs = await resolveSelect.getEntitiesConfig(kind);
3395      const entityConfig = configs.find(
3396        (config) => config.kind === kind && config.name === name
3397      );
3398      const key = entityConfig && entityConfig?.revisionKey ? entityConfig.revisionKey : DEFAULT_ENTITY_KEY;
3399      dispatch({
3400        type: "RECEIVE_ITEM_REVISIONS",
3401        key,
3402        items: Array.isArray(records) ? records : [records],
3403        recordKey,
3404        meta,
3405        query,
3406        kind,
3407        name,
3408        invalidateCache
3409      });
3410    };
3411  
3412    // packages/core-data/build-module/private-actions.js
3413    var private_actions_exports = {};
3414    __export(private_actions_exports, {
3415      editMediaEntity: () => editMediaEntity,
3416      receiveEditorAssets: () => receiveEditorAssets,
3417      receiveEditorSettings: () => receiveEditorSettings,
3418      receiveRegisteredPostMeta: () => receiveRegisteredPostMeta
3419    });
3420    var import_api_fetch4 = __toESM(require_api_fetch());
3421    function receiveRegisteredPostMeta(postType, registeredPostMeta2) {
3422      return {
3423        type: "RECEIVE_REGISTERED_POST_META",
3424        postType,
3425        registeredPostMeta: registeredPostMeta2
3426      };
3427    }
3428    var editMediaEntity = (recordId, edits = {}, { __unstableFetch = import_api_fetch4.default, throwOnError = false } = {}) => async ({ dispatch, resolveSelect }) => {
3429      if (!recordId) {
3430        return;
3431      }
3432      const kind = "postType";
3433      const name = "attachment";
3434      const configs = await resolveSelect.getEntitiesConfig(kind);
3435      const entityConfig = configs.find(
3436        (config) => config.kind === kind && config.name === name
3437      );
3438      if (!entityConfig) {
3439        return;
3440      }
3441      const lock2 = await dispatch.__unstableAcquireStoreLock(
3442        STORE_NAME,
3443        ["entities", "records", kind, name, recordId],
3444        { exclusive: true }
3445      );
3446      let updatedRecord;
3447      let error;
3448      let hasError = false;
3449      try {
3450        dispatch({
3451          type: "SAVE_ENTITY_RECORD_START",
3452          kind,
3453          name,
3454          recordId
3455        });
3456        try {
3457          const path = `$entityConfig.baseURL}/$recordId}/edit`;
3458          const newRecord = await __unstableFetch({
3459            path,
3460            method: "POST",
3461            data: {
3462              ...edits
3463            }
3464          });
3465          if (newRecord) {
3466            dispatch.receiveEntityRecords(
3467              kind,
3468              name,
3469              [newRecord],
3470              void 0,
3471              true,
3472              void 0,
3473              void 0
3474            );
3475            updatedRecord = newRecord;
3476          }
3477        } catch (e) {
3478          error = e;
3479          hasError = true;
3480        }
3481        dispatch({
3482          type: "SAVE_ENTITY_RECORD_FINISH",
3483          kind,
3484          name,
3485          recordId,
3486          error
3487        });
3488        if (hasError && throwOnError) {
3489          throw error;
3490        }
3491        return updatedRecord;
3492      } finally {
3493        dispatch.__unstableReleaseStoreLock(lock2);
3494      }
3495    };
3496    function receiveEditorSettings(settings) {
3497      return {
3498        type: "RECEIVE_EDITOR_SETTINGS",
3499        settings
3500      };
3501    }
3502    function receiveEditorAssets(assets) {
3503      return {
3504        type: "RECEIVE_EDITOR_ASSETS",
3505        assets
3506      };
3507    }
3508  
3509    // packages/core-data/build-module/resolvers.js
3510    var resolvers_exports = {};
3511    __export(resolvers_exports, {
3512      __experimentalGetCurrentGlobalStylesId: () => __experimentalGetCurrentGlobalStylesId2,
3513      __experimentalGetCurrentThemeBaseGlobalStyles: () => __experimentalGetCurrentThemeBaseGlobalStyles2,
3514      __experimentalGetCurrentThemeGlobalStylesVariations: () => __experimentalGetCurrentThemeGlobalStylesVariations2,
3515      canUser: () => canUser2,
3516      canUserEditEntityRecord: () => canUserEditEntityRecord2,
3517      getAuthors: () => getAuthors2,
3518      getAutosave: () => getAutosave2,
3519      getAutosaves: () => getAutosaves2,
3520      getBlockPatternCategories: () => getBlockPatternCategories2,
3521      getBlockPatterns: () => getBlockPatterns2,
3522      getCurrentTheme: () => getCurrentTheme2,
3523      getCurrentThemeGlobalStylesRevisions: () => getCurrentThemeGlobalStylesRevisions2,
3524      getCurrentUser: () => getCurrentUser2,
3525      getDefaultTemplateId: () => getDefaultTemplateId2,
3526      getEditedEntityRecord: () => getEditedEntityRecord2,
3527      getEditorAssets: () => getEditorAssets2,
3528      getEditorSettings: () => getEditorSettings2,
3529      getEmbedPreview: () => getEmbedPreview2,
3530      getEntitiesConfig: () => getEntitiesConfig2,
3531      getEntityRecord: () => getEntityRecord2,
3532      getEntityRecords: () => getEntityRecords2,
3533      getEntityRecordsTotalItems: () => getEntityRecordsTotalItems2,
3534      getEntityRecordsTotalPages: () => getEntityRecordsTotalPages2,
3535      getNavigationFallbackId: () => getNavigationFallbackId2,
3536      getRawEntityRecord: () => getRawEntityRecord2,
3537      getRegisteredPostMeta: () => getRegisteredPostMeta2,
3538      getRevision: () => getRevision2,
3539      getRevisions: () => getRevisions2,
3540      getThemeSupports: () => getThemeSupports2,
3541      getUserPatternCategories: () => getUserPatternCategories2
3542    });
3543    var import_url6 = __toESM(require_url());
3544    var import_html_entities2 = __toESM(require_html_entities());
3545    var import_api_fetch8 = __toESM(require_api_fetch());
3546  
3547    // packages/core-data/build-module/fetch/index.js
3548    var import_api_fetch7 = __toESM(require_api_fetch());
3549  
3550    // packages/core-data/build-module/fetch/__experimental-fetch-link-suggestions.js
3551    var import_api_fetch5 = __toESM(require_api_fetch());
3552    var import_url4 = __toESM(require_url());
3553    var import_html_entities = __toESM(require_html_entities());
3554    var import_i18n2 = __toESM(require_i18n());
3555    async function fetchLinkSuggestions(search, searchOptions = {}, editorSettings2 = {}) {
3556      const searchOptionsToUse = searchOptions.isInitialSuggestions && searchOptions.initialSuggestionsSearchOptions ? {
3557        ...searchOptions,
3558        ...searchOptions.initialSuggestionsSearchOptions
3559      } : searchOptions;
3560      const {
3561        type,
3562        subtype,
3563        page,
3564        perPage = searchOptions.isInitialSuggestions ? 3 : 20
3565      } = searchOptionsToUse;
3566      const { disablePostFormats = false } = editorSettings2;
3567      const queries2 = [];
3568      if (!type || type === "post") {
3569        queries2.push(
3570          (0, import_api_fetch5.default)({
3571            path: (0, import_url4.addQueryArgs)("/wp/v2/search", {
3572              search,
3573              page,
3574              per_page: perPage,
3575              type: "post",
3576              subtype
3577            })
3578          }).then((results2) => {
3579            return results2.map((result) => {
3580              return {
3581                id: result.id,
3582                url: result.url,
3583                title: (0, import_html_entities.decodeEntities)(result.title || "") || (0, import_i18n2.__)("(no title)"),
3584                type: result.subtype || result.type,
3585                kind: "post-type"
3586              };
3587            });
3588          }).catch(() => [])
3589          // Fail by returning no results.
3590        );
3591      }
3592      if (!type || type === "term") {
3593        queries2.push(
3594          (0, import_api_fetch5.default)({
3595            path: (0, import_url4.addQueryArgs)("/wp/v2/search", {
3596              search,
3597              page,
3598              per_page: perPage,
3599              type: "term",
3600              subtype
3601            })
3602          }).then((results2) => {
3603            return results2.map((result) => {
3604              return {
3605                id: result.id,
3606                url: result.url,
3607                title: (0, import_html_entities.decodeEntities)(result.title || "") || (0, import_i18n2.__)("(no title)"),
3608                type: result.subtype || result.type,
3609                kind: "taxonomy"
3610              };
3611            });
3612          }).catch(() => [])
3613          // Fail by returning no results.
3614        );
3615      }
3616      if (!disablePostFormats && (!type || type === "post-format")) {
3617        queries2.push(
3618          (0, import_api_fetch5.default)({
3619            path: (0, import_url4.addQueryArgs)("/wp/v2/search", {
3620              search,
3621              page,
3622              per_page: perPage,
3623              type: "post-format",
3624              subtype
3625            })
3626          }).then((results2) => {
3627            return results2.map((result) => {
3628              return {
3629                id: result.id,
3630                url: result.url,
3631                title: (0, import_html_entities.decodeEntities)(result.title || "") || (0, import_i18n2.__)("(no title)"),
3632                type: result.subtype || result.type,
3633                kind: "taxonomy"
3634              };
3635            });
3636          }).catch(() => [])
3637          // Fail by returning no results.
3638        );
3639      }
3640      if (!type || type === "attachment") {
3641        queries2.push(
3642          (0, import_api_fetch5.default)({
3643            path: (0, import_url4.addQueryArgs)("/wp/v2/media", {
3644              search,
3645              page,
3646              per_page: perPage
3647            })
3648          }).then((results2) => {
3649            return results2.map((result) => {
3650              return {
3651                id: result.id,
3652                url: result.source_url,
3653                title: (0, import_html_entities.decodeEntities)(result.title.rendered || "") || (0, import_i18n2.__)("(no title)"),
3654                type: result.type,
3655                kind: "media"
3656              };
3657            });
3658          }).catch(() => [])
3659          // Fail by returning no results.
3660        );
3661      }
3662      const responses = await Promise.all(queries2);
3663      let results = responses.flat();
3664      results = results.filter((result) => !!result.id);
3665      results = sortResults(results, search);
3666      results = results.slice(0, perPage);
3667      return results;
3668    }
3669    function sortResults(results, search) {
3670      const searchTokens = tokenize(search);
3671      const scores = {};
3672      for (const result of results) {
3673        if (result.title) {
3674          const titleTokens = tokenize(result.title);
3675          const exactMatchingTokens = titleTokens.filter(
3676            (titleToken) => searchTokens.some(
3677              (searchToken) => titleToken === searchToken
3678            )
3679          );
3680          const subMatchingTokens = titleTokens.filter(
3681            (titleToken) => searchTokens.some(
3682              (searchToken) => titleToken !== searchToken && titleToken.includes(searchToken)
3683            )
3684          );
3685          const exactMatchScore = exactMatchingTokens.length / titleTokens.length * 10;
3686          const subMatchScore = subMatchingTokens.length / titleTokens.length;
3687          scores[result.id] = exactMatchScore + subMatchScore;
3688        } else {
3689          scores[result.id] = 0;
3690        }
3691      }
3692      return results.sort((a, b) => scores[b.id] - scores[a.id]);
3693    }
3694    function tokenize(text) {
3695      return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) || [];
3696    }
3697  
3698    // packages/core-data/build-module/fetch/__experimental-fetch-url-data.js
3699    var import_api_fetch6 = __toESM(require_api_fetch());
3700    var import_url5 = __toESM(require_url());
3701    var CACHE = /* @__PURE__ */ new Map();
3702    var fetchUrlData = async (url, options = {}) => {
3703      const endpoint = "/wp-block-editor/v1/url-details";
3704      const args = {
3705        url: (0, import_url5.prependHTTP)(url)
3706      };
3707      if (!(0, import_url5.isURL)(url)) {
3708        return Promise.reject(`$url} is not a valid URL.`);
3709      }
3710      const protocol = (0, import_url5.getProtocol)(url);
3711      if (!protocol || !(0, import_url5.isValidProtocol)(protocol) || !protocol.startsWith("http") || !/^https?:\/\/[^\/\s]/i.test(url)) {
3712        return Promise.reject(
3713          `$url} does not have a valid protocol. URLs must be "http" based`
3714        );
3715      }
3716      if (CACHE.has(url)) {
3717        return CACHE.get(url);
3718      }
3719      return (0, import_api_fetch6.default)({
3720        path: (0, import_url5.addQueryArgs)(endpoint, args),
3721        ...options
3722      }).then((res) => {
3723        CACHE.set(url, res);
3724        return res;
3725      });
3726    };
3727    var experimental_fetch_url_data_default = fetchUrlData;
3728  
3729    // packages/core-data/build-module/fetch/index.js
3730    async function fetchBlockPatterns() {
3731      const restPatterns = await (0, import_api_fetch7.default)({
3732        path: "/wp/v2/block-patterns/patterns"
3733      });
3734      if (!restPatterns) {
3735        return [];
3736      }
3737      return restPatterns.map(
3738        (pattern) => Object.fromEntries(
3739          Object.entries(pattern).map(([key, value]) => [
3740            camelCase(key),
3741            value
3742          ])
3743        )
3744      );
3745    }
3746  
3747    // packages/core-data/build-module/resolvers.js
3748    var getAuthors2 = (query) => async ({ dispatch }) => {
3749      const path = (0, import_url6.addQueryArgs)(
3750        "/wp/v2/users/?who=authors&per_page=100",
3751        query
3752      );
3753      const users2 = await (0, import_api_fetch8.default)({ path });
3754      dispatch.receiveUserQuery(path, users2);
3755    };
3756    var getCurrentUser2 = () => async ({ dispatch }) => {
3757      const currentUser2 = await (0, import_api_fetch8.default)({ path: "/wp/v2/users/me" });
3758      dispatch.receiveCurrentUser(currentUser2);
3759    };
3760    var getEntityRecord2 = (kind, name, key = "", query) => async ({ select, dispatch, registry, resolveSelect }) => {
3761      const configs = await resolveSelect.getEntitiesConfig(kind);
3762      const entityConfig = configs.find(
3763        (config) => config.name === name && config.kind === kind
3764      );
3765      if (!entityConfig) {
3766        return;
3767      }
3768      const lock2 = await dispatch.__unstableAcquireStoreLock(
3769        STORE_NAME,
3770        ["entities", "records", kind, name, key],
3771        { exclusive: false }
3772      );
3773      try {
3774        if (query !== void 0 && query._fields) {
3775          query = {
3776            ...query,
3777            _fields: [
3778              .../* @__PURE__ */ new Set([
3779                ...get_normalized_comma_separable_default(query._fields) || [],
3780                entityConfig.key || DEFAULT_ENTITY_KEY
3781              ])
3782            ].join()
3783          };
3784        }
3785        if (query !== void 0 && query._fields) {
3786          const hasRecord = select.hasEntityRecord(
3787            kind,
3788            name,
3789            key,
3790            query
3791          );
3792          if (hasRecord) {
3793            return;
3794          }
3795        }
3796        let { baseURL } = entityConfig;
3797        if (kind === "postType" && name === "wp_template" && (key && typeof key === "string" && !/^\d+$/.test(key) || !window?.__experimentalTemplateActivate)) {
3798          baseURL = baseURL.slice(0, baseURL.lastIndexOf("/")) + "/templates";
3799        }
3800        const path = (0, import_url6.addQueryArgs)(baseURL + (key ? "/" + key : ""), {
3801          ...entityConfig.baseURLParams,
3802          ...query
3803        });
3804        const response = await (0, import_api_fetch8.default)({ path, parse: false });
3805        const record = await response.json();
3806        const permissions = getUserPermissionsFromAllowHeader(
3807          response.headers?.get("allow")
3808        );
3809        const canUserResolutionsArgs = [];
3810        const receiveUserPermissionArgs = {};
3811        for (const action of ALLOWED_RESOURCE_ACTIONS) {
3812          receiveUserPermissionArgs[getUserPermissionCacheKey(action, {
3813            kind,
3814            name,
3815            id: key
3816          })] = permissions[action];
3817          canUserResolutionsArgs.push([
3818            action,
3819            { kind, name, id: key }
3820          ]);
3821        }
3822        if (window.__experimentalEnableSync && entityConfig.syncConfig && isNumericID(key) && !query) {
3823          if (false) {
3824            const objectType = `$kind}/$name}`;
3825            const objectId = key;
3826            const recordWithTransients = { ...record };
3827            Object.entries(entityConfig.transientEdits ?? {}).filter(
3828              ([propName, transientConfig]) => void 0 === recordWithTransients[propName] && transientConfig && "object" === typeof transientConfig && "read" in transientConfig && "function" === typeof transientConfig.read
3829            ).forEach(([propName, transientConfig]) => {
3830              recordWithTransients[propName] = transientConfig.read(recordWithTransients);
3831            });
3832            await getSyncManager()?.load(
3833              entityConfig.syncConfig,
3834              objectType,
3835              objectId,
3836              recordWithTransients,
3837              {
3838                // Handle edits sourced from the sync manager.
3839                editRecord: (edits) => {
3840                  if (!Object.keys(edits).length) {
3841                    return;
3842                  }
3843                  dispatch({
3844                    type: "EDIT_ENTITY_RECORD",
3845                    kind,
3846                    name,
3847                    recordId: key,
3848                    edits,
3849                    meta: {
3850                      undo: void 0
3851                    }
3852                  });
3853                },
3854                // Get the current entity record (with edits)
3855                getEditedRecord: async () => await resolveSelect.getEditedEntityRecord(
3856                  kind,
3857                  name,
3858                  key
3859                ),
3860                // Save the current entity record's unsaved edits.
3861                saveRecord: () => {
3862                  dispatch.saveEditedEntityRecord(
3863                    kind,
3864                    name,
3865                    key
3866                  );
3867                }
3868              }
3869            );
3870          }
3871        }
3872        registry.batch(() => {
3873          dispatch.receiveEntityRecords(kind, name, record, query);
3874          dispatch.receiveUserPermissions(receiveUserPermissionArgs);
3875          dispatch.finishResolutions("canUser", canUserResolutionsArgs);
3876        });
3877      } finally {
3878        dispatch.__unstableReleaseStoreLock(lock2);
3879      }
3880    };
3881    getEntityRecord2.shouldInvalidate = (action, kind, name) => {
3882      return kind === "root" && name === "site" && (action.type === "RECEIVE_ITEMS" && // Making sure persistedEdits is set seems to be the only way of
3883      // knowing whether it's an update or fetch. Only an update would
3884      // have persistedEdits.
3885      action.persistedEdits && action.persistedEdits.status !== "auto-draft" || action.type === "REMOVE_ITEMS") && action.kind === "postType" && action.name === "wp_template";
3886    };
3887    var getRawEntityRecord2 = forward_resolver_default("getEntityRecord");
3888    var getEditedEntityRecord2 = forward_resolver_default("getEntityRecord");
3889    var getEntityRecords2 = (kind, name, query = {}) => async ({ dispatch, registry, resolveSelect }) => {
3890      const configs = await resolveSelect.getEntitiesConfig(kind);
3891      const entityConfig = configs.find(
3892        (config) => config.name === name && config.kind === kind
3893      );
3894      if (!entityConfig) {
3895        return;
3896      }
3897      const lock2 = await dispatch.__unstableAcquireStoreLock(
3898        STORE_NAME,
3899        ["entities", "records", kind, name],
3900        { exclusive: false }
3901      );
3902      const rawQuery = { ...query };
3903      const key = entityConfig.key || DEFAULT_ENTITY_KEY;
3904      function getResolutionsArgs(records, recordsQuery) {
3905        const queryArgs = Object.fromEntries(
3906          Object.entries(recordsQuery).filter(([k, v]) => {
3907            return ["context", "_fields"].includes(k) && !!v;
3908          })
3909        );
3910        return records.filter((record) => record?.[key]).map((record) => [
3911          kind,
3912          name,
3913          record[key],
3914          Object.keys(queryArgs).length > 0 ? queryArgs : void 0
3915        ]);
3916      }
3917      try {
3918        if (query._fields) {
3919          query = {
3920            ...query,
3921            _fields: [
3922              .../* @__PURE__ */ new Set([
3923                ...get_normalized_comma_separable_default(query._fields) || [],
3924                key
3925              ])
3926            ].join()
3927          };
3928        }
3929        let { baseURL } = entityConfig;
3930        const { combinedTemplates = true } = query;
3931        if (kind === "postType" && name === "wp_template" && combinedTemplates) {
3932          baseURL = baseURL.slice(0, baseURL.lastIndexOf("/")) + "/templates";
3933        }
3934        const path = (0, import_url6.addQueryArgs)(baseURL, {
3935          ...entityConfig.baseURLParams,
3936          ...query
3937        });
3938        let records = [], meta;
3939        if (entityConfig.supportsPagination && query.per_page !== -1) {
3940          const response = await (0, import_api_fetch8.default)({ path, parse: false });
3941          records = Object.values(await response.json());
3942          meta = {
3943            totalItems: parseInt(
3944              response.headers.get("X-WP-Total")
3945            ),
3946            totalPages: parseInt(
3947              response.headers.get("X-WP-TotalPages")
3948            )
3949          };
3950        } else if (query.per_page === -1 && query[RECEIVE_INTERMEDIATE_RESULTS] === true) {
3951          let page = 1;
3952          let totalPages;
3953          do {
3954            const response = await (0, import_api_fetch8.default)({
3955              path: (0, import_url6.addQueryArgs)(path, { page, per_page: 100 }),
3956              parse: false
3957            });
3958            const pageRecords = Object.values(await response.json());
3959            totalPages = parseInt(
3960              response.headers.get("X-WP-TotalPages")
3961            );
3962            if (!meta) {
3963              meta = {
3964                totalItems: parseInt(
3965                  response.headers.get("X-WP-Total")
3966                ),
3967                totalPages: 1
3968              };
3969            }
3970            records.push(...pageRecords);
3971            registry.batch(() => {
3972              dispatch.receiveEntityRecords(
3973                kind,
3974                name,
3975                records,
3976                query,
3977                false,
3978                void 0,
3979                meta
3980              );
3981              dispatch.finishResolutions(
3982                "getEntityRecord",
3983                getResolutionsArgs(pageRecords, rawQuery)
3984              );
3985            });
3986            page++;
3987          } while (page <= totalPages);
3988        } else {
3989          records = Object.values(await (0, import_api_fetch8.default)({ path }));
3990          meta = {
3991            totalItems: records.length,
3992            totalPages: 1
3993          };
3994        }
3995        if (query._fields) {
3996          records = records.map((record) => {
3997            query._fields.split(",").forEach((field) => {
3998              if (!record.hasOwnProperty(field)) {
3999                record[field] = void 0;
4000              }
4001            });
4002            return record;
4003          });
4004        }
4005        registry.batch(() => {
4006          dispatch.receiveEntityRecords(
4007            kind,
4008            name,
4009            records,
4010            query,
4011            false,
4012            void 0,
4013            meta
4014          );
4015          const targetHints = records.filter(
4016            (record) => !!record?.[key] && !!record?._links?.self?.[0]?.targetHints?.allow
4017          ).map((record) => ({
4018            id: record[key],
4019            permissions: getUserPermissionsFromAllowHeader(
4020              record._links.self[0].targetHints.allow
4021            )
4022          }));
4023          const canUserResolutionsArgs = [];
4024          const receiveUserPermissionArgs = {};
4025          for (const targetHint of targetHints) {
4026            for (const action of ALLOWED_RESOURCE_ACTIONS) {
4027              canUserResolutionsArgs.push([
4028                action,
4029                { kind, name, id: targetHint.id }
4030              ]);
4031              receiveUserPermissionArgs[getUserPermissionCacheKey(action, {
4032                kind,
4033                name,
4034                id: targetHint.id
4035              })] = targetHint.permissions[action];
4036            }
4037          }
4038          if (targetHints.length > 0) {
4039            dispatch.receiveUserPermissions(
4040              receiveUserPermissionArgs
4041            );
4042            dispatch.finishResolutions(
4043              "canUser",
4044              canUserResolutionsArgs
4045            );
4046          }
4047          dispatch.finishResolutions(
4048            "getEntityRecord",
4049            getResolutionsArgs(records, rawQuery)
4050          );
4051          dispatch.__unstableReleaseStoreLock(lock2);
4052        });
4053      } catch (e) {
4054        dispatch.__unstableReleaseStoreLock(lock2);
4055      }
4056    };
4057    getEntityRecords2.shouldInvalidate = (action, kind, name) => {
4058      return (action.type === "RECEIVE_ITEMS" || action.type === "REMOVE_ITEMS") && action.invalidateCache && kind === action.kind && name === action.name;
4059    };
4060    var getEntityRecordsTotalItems2 = forward_resolver_default("getEntityRecords");
4061    var getEntityRecordsTotalPages2 = forward_resolver_default("getEntityRecords");
4062    var getCurrentTheme2 = () => async ({ dispatch, resolveSelect }) => {
4063      const activeThemes = await resolveSelect.getEntityRecords(
4064        "root",
4065        "theme",
4066        { status: "active" }
4067      );
4068      dispatch.receiveCurrentTheme(activeThemes[0]);
4069    };
4070    var getThemeSupports2 = forward_resolver_default("getCurrentTheme");
4071    var getEmbedPreview2 = (url) => async ({ dispatch }) => {
4072      try {
4073        const embedProxyResponse = await (0, import_api_fetch8.default)({
4074          path: (0, import_url6.addQueryArgs)("/oembed/1.0/proxy", { url })
4075        });
4076        dispatch.receiveEmbedPreview(url, embedProxyResponse);
4077      } catch (error) {
4078        dispatch.receiveEmbedPreview(url, false);
4079      }
4080    };
4081    var canUser2 = (requestedAction, resource, id) => async ({ dispatch, registry, resolveSelect }) => {
4082      if (!ALLOWED_RESOURCE_ACTIONS.includes(requestedAction)) {
4083        throw new Error(`'$requestedAction}' is not a valid action.`);
4084      }
4085      const { hasStartedResolution } = registry.select(STORE_NAME);
4086      for (const relatedAction of ALLOWED_RESOURCE_ACTIONS) {
4087        if (relatedAction === requestedAction) {
4088          continue;
4089        }
4090        const isAlreadyResolving = hasStartedResolution("canUser", [
4091          relatedAction,
4092          resource,
4093          id
4094        ]);
4095        if (isAlreadyResolving) {
4096          return;
4097        }
4098      }
4099      let resourcePath = null;
4100      if (typeof resource === "object") {
4101        if (!resource.kind || !resource.name) {
4102          throw new Error("The entity resource object is not valid.");
4103        }
4104        const configs = await resolveSelect.getEntitiesConfig(
4105          resource.kind
4106        );
4107        const entityConfig = configs.find(
4108          (config) => config.name === resource.name && config.kind === resource.kind
4109        );
4110        if (!entityConfig) {
4111          return;
4112        }
4113        resourcePath = entityConfig.baseURL + (resource.id ? "/" + resource.id : "");
4114      } else {
4115        resourcePath = `/wp/v2/$resource}` + (id ? "/" + id : "");
4116      }
4117      let response;
4118      try {
4119        response = await (0, import_api_fetch8.default)({
4120          path: resourcePath,
4121          method: "OPTIONS",
4122          parse: false
4123        });
4124      } catch (error) {
4125        return;
4126      }
4127      const permissions = getUserPermissionsFromAllowHeader(
4128        response.headers?.get("allow")
4129      );
4130      registry.batch(() => {
4131        for (const action of ALLOWED_RESOURCE_ACTIONS) {
4132          const key = getUserPermissionCacheKey(action, resource, id);
4133          dispatch.receiveUserPermission(key, permissions[action]);
4134          if (action !== requestedAction) {
4135            dispatch.finishResolution("canUser", [
4136              action,
4137              resource,
4138              id
4139            ]);
4140          }
4141        }
4142      });
4143    };
4144    var canUserEditEntityRecord2 = (kind, name, recordId) => async ({ dispatch }) => {
4145      await dispatch(canUser2("update", { kind, name, id: recordId }));
4146    };
4147    var getAutosaves2 = (postType, postId) => async ({ dispatch, resolveSelect }) => {
4148      const {
4149        rest_base: restBase,
4150        rest_namespace: restNamespace = "wp/v2",
4151        supports
4152      } = await resolveSelect.getPostType(postType);
4153      if (!supports?.autosave) {
4154        return;
4155      }
4156      const autosaves2 = await (0, import_api_fetch8.default)({
4157        path: `/$restNamespace}/$restBase}/$postId}/autosaves?context=edit`
4158      });
4159      if (autosaves2 && autosaves2.length) {
4160        dispatch.receiveAutosaves(postId, autosaves2);
4161      }
4162    };
4163    var getAutosave2 = (postType, postId) => async ({ resolveSelect }) => {
4164      await resolveSelect.getAutosaves(postType, postId);
4165    };
4166    var __experimentalGetCurrentGlobalStylesId2 = () => async ({ dispatch, resolveSelect }) => {
4167      const activeThemes = await resolveSelect.getEntityRecords(
4168        "root",
4169        "theme",
4170        { status: "active" }
4171      );
4172      const globalStylesURL = activeThemes?.[0]?._links?.["wp:user-global-styles"]?.[0]?.href;
4173      if (!globalStylesURL) {
4174        return;
4175      }
4176      const matches = globalStylesURL.match(/\/(\d+)(?:\?|$)/);
4177      const id = matches ? Number(matches[1]) : null;
4178      if (id) {
4179        dispatch.__experimentalReceiveCurrentGlobalStylesId(id);
4180      }
4181    };
4182    var __experimentalGetCurrentThemeBaseGlobalStyles2 = () => async ({ resolveSelect, dispatch }) => {
4183      const currentTheme2 = await resolveSelect.getCurrentTheme();
4184      const themeGlobalStyles = await (0, import_api_fetch8.default)({
4185        path: `/wp/v2/global-styles/themes/$currentTheme2.stylesheet}?context=view`
4186      });
4187      dispatch.__experimentalReceiveThemeBaseGlobalStyles(
4188        currentTheme2.stylesheet,
4189        themeGlobalStyles
4190      );
4191    };
4192    var __experimentalGetCurrentThemeGlobalStylesVariations2 = () => async ({ resolveSelect, dispatch }) => {
4193      const currentTheme2 = await resolveSelect.getCurrentTheme();
4194      const variations = await (0, import_api_fetch8.default)({
4195        path: `/wp/v2/global-styles/themes/$currentTheme2.stylesheet}/variations?context=view`
4196      });
4197      dispatch.__experimentalReceiveThemeGlobalStyleVariations(
4198        currentTheme2.stylesheet,
4199        variations
4200      );
4201    };
4202    var getCurrentThemeGlobalStylesRevisions2 = () => async ({ resolveSelect, dispatch }) => {
4203      const globalStylesId = await resolveSelect.__experimentalGetCurrentGlobalStylesId();
4204      const record = globalStylesId ? await resolveSelect.getEntityRecord(
4205        "root",
4206        "globalStyles",
4207        globalStylesId
4208      ) : void 0;
4209      const revisionsURL = record?._links?.["version-history"]?.[0]?.href;
4210      if (revisionsURL) {
4211        const resetRevisions = await (0, import_api_fetch8.default)({
4212          url: revisionsURL
4213        });
4214        const revisions = resetRevisions?.map(
4215          (revision) => Object.fromEntries(
4216            Object.entries(revision).map(([key, value]) => [
4217              camelCase(key),
4218              value
4219            ])
4220          )
4221        );
4222        dispatch.receiveThemeGlobalStyleRevisions(
4223          globalStylesId,
4224          revisions
4225        );
4226      }
4227    };
4228    getCurrentThemeGlobalStylesRevisions2.shouldInvalidate = (action) => {
4229      return action.type === "SAVE_ENTITY_RECORD_FINISH" && action.kind === "root" && !action.error && action.name === "globalStyles";
4230    };
4231    var getBlockPatterns2 = () => async ({ dispatch }) => {
4232      const patterns = await fetchBlockPatterns();
4233      dispatch({ type: "RECEIVE_BLOCK_PATTERNS", patterns });
4234    };
4235    var getBlockPatternCategories2 = () => async ({ dispatch }) => {
4236      const categories = await (0, import_api_fetch8.default)({
4237        path: "/wp/v2/block-patterns/categories"
4238      });
4239      dispatch({ type: "RECEIVE_BLOCK_PATTERN_CATEGORIES", categories });
4240    };
4241    var getUserPatternCategories2 = () => async ({ dispatch, resolveSelect }) => {
4242      const patternCategories = await resolveSelect.getEntityRecords(
4243        "taxonomy",
4244        "wp_pattern_category",
4245        {
4246          per_page: -1,
4247          _fields: "id,name,description,slug",
4248          context: "view"
4249        }
4250      );
4251      const mappedPatternCategories = patternCategories?.map((userCategory) => ({
4252        ...userCategory,
4253        label: (0, import_html_entities2.decodeEntities)(userCategory.name),
4254        name: userCategory.slug
4255      })) || [];
4256      dispatch({
4257        type: "RECEIVE_USER_PATTERN_CATEGORIES",
4258        patternCategories: mappedPatternCategories
4259      });
4260    };
4261    var getNavigationFallbackId2 = () => async ({ dispatch, select, registry }) => {
4262      const fallback = await (0, import_api_fetch8.default)({
4263        path: (0, import_url6.addQueryArgs)("/wp-block-editor/v1/navigation-fallback", {
4264          _embed: true
4265        })
4266      });
4267      const record = fallback?._embedded?.self;
4268      registry.batch(() => {
4269        dispatch.receiveNavigationFallbackId(fallback?.id);
4270        if (!record) {
4271          return;
4272        }
4273        const existingFallbackEntityRecord = select.getEntityRecord(
4274          "postType",
4275          "wp_navigation",
4276          fallback.id
4277        );
4278        const invalidateNavigationQueries = !existingFallbackEntityRecord;
4279        dispatch.receiveEntityRecords(
4280          "postType",
4281          "wp_navigation",
4282          record,
4283          void 0,
4284          invalidateNavigationQueries
4285        );
4286        dispatch.finishResolution("getEntityRecord", [
4287          "postType",
4288          "wp_navigation",
4289          fallback.id
4290        ]);
4291      });
4292    };
4293    var getDefaultTemplateId2 = (query) => async ({ dispatch, registry, resolveSelect }) => {
4294      const template = await (0, import_api_fetch8.default)({
4295        path: (0, import_url6.addQueryArgs)("/wp/v2/templates/lookup", query)
4296      });
4297      await resolveSelect.getEntitiesConfig("postType");
4298      const id = window?.__experimentalTemplateActivate ? template?.wp_id || template?.id : template?.id;
4299      if (id) {
4300        template.id = id;
4301        registry.batch(() => {
4302          dispatch.receiveDefaultTemplateId(query, id);
4303          dispatch.receiveEntityRecords("postType", template.type, [
4304            template
4305          ]);
4306          dispatch.finishResolution("getEntityRecord", [
4307            "postType",
4308            template.type,
4309            id
4310          ]);
4311        });
4312      }
4313    };
4314    getDefaultTemplateId2.shouldInvalidate = (action) => {
4315      return action.type === "RECEIVE_ITEMS" && action.kind === "root" && action.name === "site";
4316    };
4317    var getRevisions2 = (kind, name, recordKey, query = {}) => async ({ dispatch, registry, resolveSelect }) => {
4318      const configs = await resolveSelect.getEntitiesConfig(kind);
4319      const entityConfig = configs.find(
4320        (config) => config.name === name && config.kind === kind
4321      );
4322      if (!entityConfig) {
4323        return;
4324      }
4325      if (query._fields) {
4326        query = {
4327          ...query,
4328          _fields: [
4329            .../* @__PURE__ */ new Set([
4330              ...get_normalized_comma_separable_default(query._fields) || [],
4331              entityConfig.revisionKey || DEFAULT_ENTITY_KEY
4332            ])
4333          ].join()
4334        };
4335      }
4336      const path = (0, import_url6.addQueryArgs)(
4337        entityConfig.getRevisionsUrl(recordKey),
4338        query
4339      );
4340      let records, response;
4341      const meta = {};
4342      const isPaginated = entityConfig.supportsPagination && query.per_page !== -1;
4343      try {
4344        response = await (0, import_api_fetch8.default)({ path, parse: !isPaginated });
4345      } catch (error) {
4346        return;
4347      }
4348      if (response) {
4349        if (isPaginated) {
4350          records = Object.values(await response.json());
4351          meta.totalItems = parseInt(
4352            response.headers.get("X-WP-Total")
4353          );
4354        } else {
4355          records = Object.values(response);
4356        }
4357        if (query._fields) {
4358          records = records.map((record) => {
4359            query._fields.split(",").forEach((field) => {
4360              if (!record.hasOwnProperty(field)) {
4361                record[field] = void 0;
4362              }
4363            });
4364            return record;
4365          });
4366        }
4367        registry.batch(() => {
4368          dispatch.receiveRevisions(
4369            kind,
4370            name,
4371            recordKey,
4372            records,
4373            query,
4374            false,
4375            meta
4376          );
4377          if (!query?._fields && !query.context) {
4378            const key = entityConfig.key || DEFAULT_ENTITY_KEY;
4379            const resolutionsArgs = records.filter((record) => record[key]).map((record) => [
4380              kind,
4381              name,
4382              recordKey,
4383              record[key]
4384            ]);
4385            dispatch.finishResolutions(
4386              "getRevision",
4387              resolutionsArgs
4388            );
4389          }
4390        });
4391      }
4392    };
4393    getRevisions2.shouldInvalidate = (action, kind, name, recordKey) => action.type === "SAVE_ENTITY_RECORD_FINISH" && name === action.name && kind === action.kind && !action.error && recordKey === action.recordId;
4394    var getRevision2 = (kind, name, recordKey, revisionKey, query) => async ({ dispatch, resolveSelect }) => {
4395      const configs = await resolveSelect.getEntitiesConfig(kind);
4396      const entityConfig = configs.find(
4397        (config) => config.name === name && config.kind === kind
4398      );
4399      if (!entityConfig) {
4400        return;
4401      }
4402      if (query !== void 0 && query._fields) {
4403        query = {
4404          ...query,
4405          _fields: [
4406            .../* @__PURE__ */ new Set([
4407              ...get_normalized_comma_separable_default(query._fields) || [],
4408              entityConfig.revisionKey || DEFAULT_ENTITY_KEY
4409            ])
4410          ].join()
4411        };
4412      }
4413      const path = (0, import_url6.addQueryArgs)(
4414        entityConfig.getRevisionsUrl(recordKey, revisionKey),
4415        query
4416      );
4417      let record;
4418      try {
4419        record = await (0, import_api_fetch8.default)({ path });
4420      } catch (error) {
4421        return;
4422      }
4423      if (record) {
4424        dispatch.receiveRevisions(kind, name, recordKey, record, query);
4425      }
4426    };
4427    var getRegisteredPostMeta2 = (postType) => async ({ dispatch, resolveSelect }) => {
4428      let options;
4429      try {
4430        const {
4431          rest_namespace: restNamespace = "wp/v2",
4432          rest_base: restBase
4433        } = await resolveSelect.getPostType(postType) || {};
4434        options = await (0, import_api_fetch8.default)({
4435          path: `$restNamespace}/$restBase}/?context=edit`,
4436          method: "OPTIONS"
4437        });
4438      } catch (error) {
4439        return;
4440      }
4441      if (options) {
4442        dispatch.receiveRegisteredPostMeta(
4443          postType,
4444          options?.schema?.properties?.meta?.properties
4445        );
4446      }
4447    };
4448    var getEntitiesConfig2 = (kind) => async ({ dispatch }) => {
4449      const loader = additionalEntityConfigLoaders.find(
4450        (l) => l.kind === kind
4451      );
4452      if (!loader) {
4453        return;
4454      }
4455      try {
4456        const configs = await loader.loadEntities();
4457        if (!configs.length) {
4458          return;
4459        }
4460        dispatch.addEntities(configs);
4461      } catch {
4462      }
4463    };
4464    var getEditorSettings2 = () => async ({ dispatch }) => {
4465      const settings = await (0, import_api_fetch8.default)({
4466        path: "/wp-block-editor/v1/settings"
4467      });
4468      dispatch.receiveEditorSettings(settings);
4469    };
4470    var getEditorAssets2 = () => async ({ dispatch }) => {
4471      const assets = await (0, import_api_fetch8.default)({
4472        path: "/wp-block-editor/v1/assets"
4473      });
4474      dispatch.receiveEditorAssets(assets);
4475    };
4476  
4477    // packages/core-data/build-module/locks/utils.js
4478    function deepCopyLocksTreePath(tree, path) {
4479      const newTree = { ...tree };
4480      let currentNode = newTree;
4481      for (const branchName of path) {
4482        currentNode.children = {
4483          ...currentNode.children,
4484          [branchName]: {
4485            locks: [],
4486            children: {},
4487            ...currentNode.children[branchName]
4488          }
4489        };
4490        currentNode = currentNode.children[branchName];
4491      }
4492      return newTree;
4493    }
4494    function getNode(tree, path) {
4495      let currentNode = tree;
4496      for (const branchName of path) {
4497        const nextNode = currentNode.children[branchName];
4498        if (!nextNode) {
4499          return null;
4500        }
4501        currentNode = nextNode;
4502      }
4503      return currentNode;
4504    }
4505    function* iteratePath(tree, path) {
4506      let currentNode = tree;
4507      yield currentNode;
4508      for (const branchName of path) {
4509        const nextNode = currentNode.children[branchName];
4510        if (!nextNode) {
4511          break;
4512        }
4513        yield nextNode;
4514        currentNode = nextNode;
4515      }
4516    }
4517    function* iterateDescendants(node) {
4518      const stack = Object.values(node.children);
4519      while (stack.length) {
4520        const childNode = stack.pop();
4521        yield childNode;
4522        stack.push(...Object.values(childNode.children));
4523      }
4524    }
4525    function hasConflictingLock({ exclusive }, locks2) {
4526      if (exclusive && locks2.length) {
4527        return true;
4528      }
4529      if (!exclusive && locks2.filter((lock2) => lock2.exclusive).length) {
4530        return true;
4531      }
4532      return false;
4533    }
4534  
4535    // packages/core-data/build-module/locks/reducer.js
4536    var DEFAULT_STATE = {
4537      requests: [],
4538      tree: {
4539        locks: [],
4540        children: {}
4541      }
4542    };
4543    function locks(state = DEFAULT_STATE, action) {
4544      switch (action.type) {
4545        case "ENQUEUE_LOCK_REQUEST": {
4546          const { request } = action;
4547          return {
4548            ...state,
4549            requests: [request, ...state.requests]
4550          };
4551        }
4552        case "GRANT_LOCK_REQUEST": {
4553          const { lock: lock2, request } = action;
4554          const { store: store2, path } = request;
4555          const storePath = [store2, ...path];
4556          const newTree = deepCopyLocksTreePath(state.tree, storePath);
4557          const node = getNode(newTree, storePath);
4558          node.locks = [...node.locks, lock2];
4559          return {
4560            ...state,
4561            requests: state.requests.filter((r) => r !== request),
4562            tree: newTree
4563          };
4564        }
4565        case "RELEASE_LOCK": {
4566          const { lock: lock2 } = action;
4567          const storePath = [lock2.store, ...lock2.path];
4568          const newTree = deepCopyLocksTreePath(state.tree, storePath);
4569          const node = getNode(newTree, storePath);
4570          node.locks = node.locks.filter((l) => l !== lock2);
4571          return {
4572            ...state,
4573            tree: newTree
4574          };
4575        }
4576      }
4577      return state;
4578    }
4579  
4580    // packages/core-data/build-module/locks/selectors.js
4581    function getPendingLockRequests(state) {
4582      return state.requests;
4583    }
4584    function isLockAvailable(state, store2, path, { exclusive }) {
4585      const storePath = [store2, ...path];
4586      const locks2 = state.tree;
4587      for (const node2 of iteratePath(locks2, storePath)) {
4588        if (hasConflictingLock({ exclusive }, node2.locks)) {
4589          return false;
4590        }
4591      }
4592      const node = getNode(locks2, storePath);
4593      if (!node) {
4594        return true;
4595      }
4596      for (const descendant of iterateDescendants(node)) {
4597        if (hasConflictingLock({ exclusive }, descendant.locks)) {
4598          return false;
4599        }
4600      }
4601      return true;
4602    }
4603  
4604    // packages/core-data/build-module/locks/engine.js
4605    function createLocks() {
4606      let state = locks(void 0, { type: "@@INIT" });
4607      function processPendingLockRequests() {
4608        for (const request of getPendingLockRequests(state)) {
4609          const { store: store2, path, exclusive, notifyAcquired } = request;
4610          if (isLockAvailable(state, store2, path, { exclusive })) {
4611            const lock2 = { store: store2, path, exclusive };
4612            state = locks(state, {
4613              type: "GRANT_LOCK_REQUEST",
4614              lock: lock2,
4615              request
4616            });
4617            notifyAcquired(lock2);
4618          }
4619        }
4620      }
4621      function acquire(store2, path, exclusive) {
4622        return new Promise((resolve) => {
4623          state = locks(state, {
4624            type: "ENQUEUE_LOCK_REQUEST",
4625            request: { store: store2, path, exclusive, notifyAcquired: resolve }
4626          });
4627          processPendingLockRequests();
4628        });
4629      }
4630      function release(lock2) {
4631        state = locks(state, {
4632          type: "RELEASE_LOCK",
4633          lock: lock2
4634        });
4635        processPendingLockRequests();
4636      }
4637      return { acquire, release };
4638    }
4639  
4640    // packages/core-data/build-module/locks/actions.js
4641    function createLocksActions() {
4642      const locks2 = createLocks();
4643      function __unstableAcquireStoreLock(store2, path, { exclusive }) {
4644        return () => locks2.acquire(store2, path, exclusive);
4645      }
4646      function __unstableReleaseStoreLock(lock2) {
4647        return () => locks2.release(lock2);
4648      }
4649      return { __unstableAcquireStoreLock, __unstableReleaseStoreLock };
4650    }
4651  
4652    // packages/core-data/build-module/dynamic-entities.js
4653    var dynamicActions;
4654    var dynamicSelectors;
4655  
4656    // packages/core-data/build-module/entity-provider.js
4657    var import_element2 = __toESM(require_element());
4658  
4659    // packages/core-data/build-module/entity-context.js
4660    var import_element = __toESM(require_element());
4661    var EntityContext = (0, import_element.createContext)({});
4662    EntityContext.displayName = "EntityContext";
4663  
4664    // packages/core-data/build-module/entity-provider.js
4665    var import_jsx_runtime = __toESM(require_jsx_runtime());
4666    function EntityProvider({ kind, type: name, id, children }) {
4667      const parent = (0, import_element2.useContext)(EntityContext);
4668      const childContext = (0, import_element2.useMemo)(
4669        () => ({
4670          ...parent,
4671          [kind]: {
4672            ...parent?.[kind],
4673            [name]: id
4674          }
4675        }),
4676        [parent, kind, name, id]
4677      );
4678      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntityContext.Provider, { value: childContext, children });
4679    }
4680  
4681    // packages/core-data/build-module/hooks/use-entity-record.js
4682    var import_data7 = __toESM(require_data());
4683    var import_deprecated4 = __toESM(require_deprecated());
4684    var import_element3 = __toESM(require_element());
4685  
4686    // packages/core-data/build-module/hooks/use-query-select.js
4687    var import_data6 = __toESM(require_data());
4688  
4689    // node_modules/memize/dist/index.js
4690    function memize(fn, options) {
4691      var size = 0;
4692      var head;
4693      var tail;
4694      options = options || {};
4695      function memoized() {
4696        var node = head, len = arguments.length, args, i;
4697        searchCache: while (node) {
4698          if (node.args.length !== arguments.length) {
4699            node = node.next;
4700            continue;
4701          }
4702          for (i = 0; i < len; i++) {
4703            if (node.args[i] !== arguments[i]) {
4704              node = node.next;
4705              continue searchCache;
4706            }
4707          }
4708          if (node !== head) {
4709            if (node === tail) {
4710              tail = node.prev;
4711            }
4712            node.prev.next = node.next;
4713            if (node.next) {
4714              node.next.prev = node.prev;
4715            }
4716            node.next = head;
4717            node.prev = null;
4718            head.prev = node;
4719            head = node;
4720          }
4721          return node.val;
4722        }
4723        args = new Array(len);
4724        for (i = 0; i < len; i++) {
4725          args[i] = arguments[i];
4726        }
4727        node = {
4728          args,
4729          // Generate the result from original function
4730          val: fn.apply(null, args)
4731        };
4732        if (head) {
4733          head.prev = node;
4734          node.next = head;
4735        } else {
4736          tail = node;
4737        }
4738        if (size === /** @type {MemizeOptions} */
4739        options.maxSize) {
4740          tail = /** @type {MemizeCacheNode} */
4741          tail.prev;
4742          tail.next = null;
4743        } else {
4744          size++;
4745        }
4746        head = node;
4747        return node.val;
4748      }
4749      memoized.clear = function() {
4750        head = null;
4751        tail = null;
4752        size = 0;
4753      };
4754      return memoized;
4755    }
4756  
4757    // packages/core-data/build-module/hooks/memoize.js
4758    var memoize_default = memize;
4759  
4760    // packages/core-data/build-module/hooks/constants.js
4761    var Status = /* @__PURE__ */ ((Status2) => {
4762      Status2["Idle"] = "IDLE";
4763      Status2["Resolving"] = "RESOLVING";
4764      Status2["Error"] = "ERROR";
4765      Status2["Success"] = "SUCCESS";
4766      return Status2;
4767    })(Status || {});
4768  
4769    // packages/core-data/build-module/hooks/use-query-select.js
4770    var META_SELECTORS = [
4771      "getIsResolving",
4772      "hasStartedResolution",
4773      "hasFinishedResolution",
4774      "isResolving",
4775      "getCachedResolvers"
4776    ];
4777    function useQuerySelect(mapQuerySelect, deps) {
4778      return (0, import_data6.useSelect)((select, registry) => {
4779        const resolve = (store2) => enrichSelectors(select(store2));
4780        return mapQuerySelect(resolve, registry);
4781      }, deps);
4782    }
4783    var enrichSelectors = memoize_default(((selectors) => {
4784      const resolvers = {};
4785      for (const selectorName in selectors) {
4786        if (META_SELECTORS.includes(selectorName)) {
4787          continue;
4788        }
4789        Object.defineProperty(resolvers, selectorName, {
4790          get: () => (...args) => {
4791            const data = selectors[selectorName](...args);
4792            const resolutionStatus = selectors.getResolutionState(
4793              selectorName,
4794              args
4795            )?.status;
4796            let status;
4797            switch (resolutionStatus) {
4798              case "resolving":
4799                status = Status.Resolving;
4800                break;
4801              case "finished":
4802                status = Status.Success;
4803                break;
4804              case "error":
4805                status = Status.Error;
4806                break;
4807              case void 0:
4808                status = Status.Idle;
4809                break;
4810            }
4811            return {
4812              data,
4813              status,
4814              isResolving: status === Status.Resolving,
4815              hasStarted: status !== Status.Idle,
4816              hasResolved: status === Status.Success || status === Status.Error
4817            };
4818          }
4819        });
4820      }
4821      return resolvers;
4822    }));
4823  
4824    // packages/core-data/build-module/hooks/use-entity-record.js
4825    var EMPTY_OBJECT2 = {};
4826    function useEntityRecord(kind, name, recordId, options = { enabled: true }) {
4827      const { editEntityRecord: editEntityRecord2, saveEditedEntityRecord: saveEditedEntityRecord2 } = (0, import_data7.useDispatch)(store);
4828      const mutations = (0, import_element3.useMemo)(
4829        () => ({
4830          edit: (record2, editOptions = {}) => editEntityRecord2(kind, name, recordId, record2, editOptions),
4831          save: (saveOptions = {}) => saveEditedEntityRecord2(kind, name, recordId, {
4832            throwOnError: true,
4833            ...saveOptions
4834          })
4835        }),
4836        [editEntityRecord2, kind, name, recordId, saveEditedEntityRecord2]
4837      );
4838      const { editedRecord, hasEdits, edits } = (0, import_data7.useSelect)(
4839        (select) => {
4840          if (!options.enabled) {
4841            return {
4842              editedRecord: EMPTY_OBJECT2,
4843              hasEdits: false,
4844              edits: EMPTY_OBJECT2
4845            };
4846          }
4847          return {
4848            editedRecord: select(store).getEditedEntityRecord(
4849              kind,
4850              name,
4851              recordId
4852            ),
4853            hasEdits: select(store).hasEditsForEntityRecord(
4854              kind,
4855              name,
4856              recordId
4857            ),
4858            edits: select(store).getEntityRecordNonTransientEdits(
4859              kind,
4860              name,
4861              recordId
4862            )
4863          };
4864        },
4865        [kind, name, recordId, options.enabled]
4866      );
4867      const { data: record, ...querySelectRest } = useQuerySelect(
4868        (query) => {
4869          if (!options.enabled) {
4870            return {
4871              data: null
4872            };
4873          }
4874          return query(store).getEntityRecord(kind, name, recordId);
4875        },
4876        [kind, name, recordId, options.enabled]
4877      );
4878      return {
4879        record,
4880        editedRecord,
4881        hasEdits,
4882        edits,
4883        ...querySelectRest,
4884        ...mutations
4885      };
4886    }
4887    function __experimentalUseEntityRecord(kind, name, recordId, options) {
4888      (0, import_deprecated4.default)(`wp.data.__experimentalUseEntityRecord`, {
4889        alternative: "wp.data.useEntityRecord",
4890        since: "6.1"
4891      });
4892      return useEntityRecord(kind, name, recordId, options);
4893    }
4894  
4895    // packages/core-data/build-module/hooks/use-entity-records.js
4896    var import_url7 = __toESM(require_url());
4897    var import_deprecated5 = __toESM(require_deprecated());
4898    var import_data8 = __toESM(require_data());
4899    var import_element4 = __toESM(require_element());
4900    var EMPTY_ARRAY = [];
4901    function useEntityRecords(kind, name, queryArgs = {}, options = { enabled: true }) {
4902      const queryAsString = (0, import_url7.addQueryArgs)("", queryArgs);
4903      const { data: records, ...rest } = useQuerySelect(
4904        (query) => {
4905          if (!options.enabled) {
4906            return {
4907              // Avoiding returning a new reference on every execution.
4908              data: EMPTY_ARRAY
4909            };
4910          }
4911          return query(store).getEntityRecords(kind, name, queryArgs);
4912        },
4913        [kind, name, queryAsString, options.enabled]
4914      );
4915      const { totalItems, totalPages } = (0, import_data8.useSelect)(
4916        (select) => {
4917          if (!options.enabled) {
4918            return {
4919              totalItems: null,
4920              totalPages: null
4921            };
4922          }
4923          return {
4924            totalItems: select(store).getEntityRecordsTotalItems(
4925              kind,
4926              name,
4927              queryArgs
4928            ),
4929            totalPages: select(store).getEntityRecordsTotalPages(
4930              kind,
4931              name,
4932              queryArgs
4933            )
4934          };
4935        },
4936        [kind, name, queryAsString, options.enabled]
4937      );
4938      return {
4939        records,
4940        totalItems,
4941        totalPages,
4942        ...rest
4943      };
4944    }
4945    function __experimentalUseEntityRecords(kind, name, queryArgs, options) {
4946      (0, import_deprecated5.default)(`wp.data.__experimentalUseEntityRecords`, {
4947        alternative: "wp.data.useEntityRecords",
4948        since: "6.1"
4949      });
4950      return useEntityRecords(kind, name, queryArgs, options);
4951    }
4952    function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = { enabled: true }) {
4953      const entityConfig = (0, import_data8.useSelect)(
4954        (select) => select(store).getEntityConfig(kind, name),
4955        [kind, name]
4956      );
4957      const { records: data, ...ret } = useEntityRecords(
4958        kind,
4959        name,
4960        {
4961          ...queryArgs,
4962          // If _fields is provided, we need to include _links in the request for permission caching to work.
4963          ...queryArgs._fields ? {
4964            _fields: [
4965              .../* @__PURE__ */ new Set([
4966                ...get_normalized_comma_separable_default(
4967                  queryArgs._fields
4968                ) || [],
4969                "_links"
4970              ])
4971            ].join()
4972          } : {}
4973        },
4974        options
4975      );
4976      const ids = (0, import_element4.useMemo)(
4977        () => data?.map(
4978          // @ts-ignore
4979          (record) => record[entityConfig?.key ?? "id"]
4980        ) ?? [],
4981        [data, entityConfig?.key]
4982      );
4983      const permissions = (0, import_data8.useSelect)(
4984        (select) => {
4985          const { getEntityRecordsPermissions: getEntityRecordsPermissions2 } = unlock(
4986            select(store)
4987          );
4988          return getEntityRecordsPermissions2(kind, name, ids);
4989        },
4990        [ids, kind, name]
4991      );
4992      const dataWithPermissions = (0, import_element4.useMemo)(
4993        () => data?.map((record, index) => ({
4994          // @ts-ignore
4995          ...record,
4996          permissions: permissions[index]
4997        })) ?? [],
4998        [data, permissions]
4999      );
5000      return { records: dataWithPermissions, ...ret };
5001    }
5002  
5003    // packages/core-data/build-module/hooks/use-resource-permissions.js
5004    var import_deprecated6 = __toESM(require_deprecated());
5005    var import_warning = __toESM(require_warning());
5006    function useResourcePermissions(resource, id) {
5007      const isEntity = typeof resource === "object";
5008      const resourceAsString = isEntity ? JSON.stringify(resource) : resource;
5009      if (isEntity && typeof id !== "undefined") {
5010        (0, import_warning.default)(
5011          `When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`
5012        );
5013      }
5014      return useQuerySelect(
5015        (resolve) => {
5016          const hasId = isEntity ? !!resource.id : !!id;
5017          const { canUser: canUser3 } = resolve(store);
5018          const create2 = canUser3(
5019            "create",
5020            isEntity ? { kind: resource.kind, name: resource.name } : resource
5021          );
5022          if (!hasId) {
5023            const read2 = canUser3("read", resource);
5024            const isResolving2 = create2.isResolving || read2.isResolving;
5025            const hasResolved2 = create2.hasResolved && read2.hasResolved;
5026            let status2 = Status.Idle;
5027            if (isResolving2) {
5028              status2 = Status.Resolving;
5029            } else if (hasResolved2) {
5030              status2 = Status.Success;
5031            }
5032            return {
5033              status: status2,
5034              isResolving: isResolving2,
5035              hasResolved: hasResolved2,
5036              canCreate: create2.hasResolved && create2.data,
5037              canRead: read2.hasResolved && read2.data
5038            };
5039          }
5040          const read = canUser3("read", resource, id);
5041          const update = canUser3("update", resource, id);
5042          const _delete = canUser3("delete", resource, id);
5043          const isResolving = read.isResolving || create2.isResolving || update.isResolving || _delete.isResolving;
5044          const hasResolved = read.hasResolved && create2.hasResolved && update.hasResolved && _delete.hasResolved;
5045          let status = Status.Idle;
5046          if (isResolving) {
5047            status = Status.Resolving;
5048          } else if (hasResolved) {
5049            status = Status.Success;
5050          }
5051          return {
5052            status,
5053            isResolving,
5054            hasResolved,
5055            canRead: hasResolved && read.data,
5056            canCreate: hasResolved && create2.data,
5057            canUpdate: hasResolved && update.data,
5058            canDelete: hasResolved && _delete.data
5059          };
5060        },
5061        [resourceAsString, id]
5062      );
5063    }
5064    var use_resource_permissions_default = useResourcePermissions;
5065    function __experimentalUseResourcePermissions(resource, id) {
5066      (0, import_deprecated6.default)(`wp.data.__experimentalUseResourcePermissions`, {
5067        alternative: "wp.data.useResourcePermissions",
5068        since: "6.1"
5069      });
5070      return useResourcePermissions(resource, id);
5071    }
5072  
5073    // packages/core-data/build-module/hooks/use-entity-block-editor.js
5074    var import_element6 = __toESM(require_element());
5075    var import_data9 = __toESM(require_data());
5076    var import_blocks2 = __toESM(require_blocks());
5077  
5078    // packages/core-data/build-module/hooks/use-entity-id.js
5079    var import_element5 = __toESM(require_element());
5080    function useEntityId(kind, name) {
5081      const context = (0, import_element5.useContext)(EntityContext);
5082      return context?.[kind]?.[name];
5083    }
5084  
5085    // packages/core-data/build-module/footnotes/index.js
5086    var import_rich_text = __toESM(require_rich_text());
5087  
5088    // packages/core-data/build-module/footnotes/get-rich-text-values-cached.js
5089    var import_block_editor = __toESM(require_block_editor());
5090    var unlockedApis;
5091    var cache = /* @__PURE__ */ new WeakMap();
5092    function getRichTextValuesCached(block) {
5093      if (!unlockedApis) {
5094        unlockedApis = unlock(import_block_editor.privateApis);
5095      }
5096      if (!cache.has(block)) {
5097        const values = unlockedApis.getRichTextValues([block]);
5098        cache.set(block, values);
5099      }
5100      return cache.get(block);
5101    }
5102  
5103    // packages/core-data/build-module/footnotes/get-footnotes-order.js
5104    var cache2 = /* @__PURE__ */ new WeakMap();
5105    function getBlockFootnotesOrder(block) {
5106      if (!cache2.has(block)) {
5107        const order = [];
5108        for (const value of getRichTextValuesCached(block)) {
5109          if (!value) {
5110            continue;
5111          }
5112          value.replacements.forEach(({ type, attributes }) => {
5113            if (type === "core/footnote") {
5114              order.push(attributes["data-fn"]);
5115            }
5116          });
5117        }
5118        cache2.set(block, order);
5119      }
5120      return cache2.get(block);
5121    }
5122    function getFootnotesOrder(blocks) {
5123      return blocks.flatMap(getBlockFootnotesOrder);
5124    }
5125  
5126    // packages/core-data/build-module/footnotes/index.js
5127    var oldFootnotes = {};
5128    function updateFootnotesFromMeta(blocks, meta) {
5129      const output = { blocks };
5130      if (!meta) {
5131        return output;
5132      }
5133      if (meta.footnotes === void 0) {
5134        return output;
5135      }
5136      const newOrder = getFootnotesOrder(blocks);
5137      const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : [];
5138      const currentOrder = footnotes.map((fn) => fn.id);
5139      if (currentOrder.join("") === newOrder.join("")) {
5140        return output;
5141      }
5142      const newFootnotes = newOrder.map(
5143        (fnId) => footnotes.find((fn) => fn.id === fnId) || oldFootnotes[fnId] || {
5144          id: fnId,
5145          content: ""
5146        }
5147      );
5148      function updateAttributes(attributes) {
5149        if (!attributes || Array.isArray(attributes) || typeof attributes !== "object") {
5150          return attributes;
5151        }
5152        attributes = { ...attributes };
5153        for (const key in attributes) {
5154          const value = attributes[key];
5155          if (Array.isArray(value)) {
5156            attributes[key] = value.map(updateAttributes);
5157            continue;
5158          }
5159          if (typeof value !== "string" && !(value instanceof import_rich_text.RichTextData)) {
5160            continue;
5161          }
5162          const richTextValue = typeof value === "string" ? import_rich_text.RichTextData.fromHTMLString(value) : new import_rich_text.RichTextData(value);
5163          let hasFootnotes = false;
5164          richTextValue.replacements.forEach((replacement) => {
5165            if (replacement.type === "core/footnote") {
5166              const id = replacement.attributes["data-fn"];
5167              const index = newOrder.indexOf(id);
5168              const countValue = (0, import_rich_text.create)({
5169                html: replacement.innerHTML
5170              });
5171              countValue.text = String(index + 1);
5172              countValue.formats = Array.from(
5173                { length: countValue.text.length },
5174                () => countValue.formats[0]
5175              );
5176              countValue.replacements = Array.from(
5177                { length: countValue.text.length },
5178                () => countValue.replacements[0]
5179              );
5180              replacement.innerHTML = (0, import_rich_text.toHTMLString)({
5181                value: countValue
5182              });
5183              hasFootnotes = true;
5184            }
5185          });
5186          if (hasFootnotes) {
5187            attributes[key] = typeof value === "string" ? richTextValue.toHTMLString() : richTextValue;
5188          }
5189        }
5190        return attributes;
5191      }
5192      function updateBlocksAttributes(__blocks) {
5193        return __blocks.map((block) => {
5194          return {
5195            ...block,
5196            attributes: updateAttributes(block.attributes),
5197            innerBlocks: updateBlocksAttributes(block.innerBlocks)
5198          };
5199        });
5200      }
5201      const newBlocks = updateBlocksAttributes(blocks);
5202      oldFootnotes = {
5203        ...oldFootnotes,
5204        ...footnotes.reduce((acc, fn) => {
5205          if (!newOrder.includes(fn.id)) {
5206            acc[fn.id] = fn;
5207          }
5208          return acc;
5209        }, {})
5210      };
5211      return {
5212        meta: {
5213          ...meta,
5214          footnotes: JSON.stringify(newFootnotes)
5215        },
5216        blocks: newBlocks
5217      };
5218    }
5219  
5220    // packages/core-data/build-module/hooks/use-entity-block-editor.js
5221    var EMPTY_ARRAY2 = [];
5222    var parsedBlocksCache = /* @__PURE__ */ new WeakMap();
5223    function useEntityBlockEditor(kind, name, { id: _id } = {}) {
5224      const providerId = useEntityId(kind, name);
5225      const id = _id ?? providerId;
5226      const { getEntityRecord: getEntityRecord3, getEntityRecordEdits: getEntityRecordEdits2 } = (0, import_data9.useSelect)(STORE_NAME);
5227      const { content, editedBlocks, meta } = (0, import_data9.useSelect)(
5228        (select) => {
5229          if (!id) {
5230            return {};
5231          }
5232          const { getEditedEntityRecord: getEditedEntityRecord3 } = select(STORE_NAME);
5233          const editedRecord = getEditedEntityRecord3(kind, name, id);
5234          return {
5235            editedBlocks: editedRecord.blocks,
5236            content: editedRecord.content,
5237            meta: editedRecord.meta
5238          };
5239        },
5240        [kind, name, id]
5241      );
5242      const { __unstableCreateUndoLevel: __unstableCreateUndoLevel2, editEntityRecord: editEntityRecord2 } = (0, import_data9.useDispatch)(STORE_NAME);
5243      const blocks = (0, import_element6.useMemo)(() => {
5244        if (!id) {
5245          return void 0;
5246        }
5247        if (editedBlocks) {
5248          return editedBlocks;
5249        }
5250        if (!content || typeof content !== "string") {
5251          return EMPTY_ARRAY2;
5252        }
5253        const edits = getEntityRecordEdits2(kind, name, id);
5254        const isUnedited = !edits || !Object.keys(edits).length;
5255        const cackeKey = isUnedited ? getEntityRecord3(kind, name, id) : edits;
5256        let _blocks = parsedBlocksCache.get(cackeKey);
5257        if (!_blocks) {
5258          _blocks = (0, import_blocks2.parse)(content);
5259          parsedBlocksCache.set(cackeKey, _blocks);
5260        }
5261        return _blocks;
5262      }, [
5263        kind,
5264        name,
5265        id,
5266        editedBlocks,
5267        content,
5268        getEntityRecord3,
5269        getEntityRecordEdits2
5270      ]);
5271      const onChange = (0, import_element6.useCallback)(
5272        (newBlocks, options) => {
5273          const noChange = blocks === newBlocks;
5274          if (noChange) {
5275            return __unstableCreateUndoLevel2(kind, name, id);
5276          }
5277          const { selection, ...rest } = options;
5278          const edits = {
5279            selection,
5280            content: ({ blocks: blocksForSerialization = [] }) => (0, import_blocks2.__unstableSerializeAndClean)(blocksForSerialization),
5281            ...updateFootnotesFromMeta(newBlocks, meta)
5282          };
5283          editEntityRecord2(kind, name, id, edits, {
5284            isCached: false,
5285            ...rest
5286          });
5287        },
5288        [
5289          kind,
5290          name,
5291          id,
5292          blocks,
5293          meta,
5294          __unstableCreateUndoLevel2,
5295          editEntityRecord2
5296        ]
5297      );
5298      const onInput = (0, import_element6.useCallback)(
5299        (newBlocks, options) => {
5300          const { selection, ...rest } = options;
5301          const footnotesChanges = updateFootnotesFromMeta(newBlocks, meta);
5302          const edits = { selection, ...footnotesChanges };
5303          editEntityRecord2(kind, name, id, edits, {
5304            isCached: true,
5305            ...rest
5306          });
5307        },
5308        [kind, name, id, meta, editEntityRecord2]
5309      );
5310      return [blocks, onInput, onChange];
5311    }
5312  
5313    // packages/core-data/build-module/hooks/use-entity-prop.js
5314    var import_element7 = __toESM(require_element());
5315    var import_data10 = __toESM(require_data());
5316    function useEntityProp(kind, name, prop, _id) {
5317      const providerId = useEntityId(kind, name);
5318      const id = _id ?? providerId;
5319      const { value, fullValue } = (0, import_data10.useSelect)(
5320        (select) => {
5321          const { getEntityRecord: getEntityRecord3, getEditedEntityRecord: getEditedEntityRecord3 } = select(STORE_NAME);
5322          const record = getEntityRecord3(kind, name, id);
5323          const editedRecord = getEditedEntityRecord3(kind, name, id);
5324          return record && editedRecord ? {
5325            value: editedRecord[prop],
5326            fullValue: record[prop]
5327          } : {};
5328        },
5329        [kind, name, id, prop]
5330      );
5331      const { editEntityRecord: editEntityRecord2 } = (0, import_data10.useDispatch)(STORE_NAME);
5332      const setValue = (0, import_element7.useCallback)(
5333        (newValue) => {
5334          editEntityRecord2(kind, name, id, {
5335            [prop]: newValue
5336          });
5337        },
5338        [editEntityRecord2, kind, name, id, prop]
5339      );
5340      return [value, setValue, fullValue];
5341    }
5342  
5343    // packages/core-data/build-module/private-apis.js
5344    var privateApis = {};
5345    lock(privateApis, {
5346      useEntityRecordsWithPermissions,
5347      RECEIVE_INTERMEDIATE_RESULTS
5348    });
5349  
5350    // packages/core-data/build-module/index.js
5351    var entitiesConfig2 = [
5352      ...rootEntitiesConfig,
5353      ...additionalEntityConfigLoaders.filter((config) => !!config.name)
5354    ];
5355    var entitySelectors = entitiesConfig2.reduce((result, entity2) => {
5356      const { kind, name, plural } = entity2;
5357      const getEntityRecordMethodName = getMethodName(kind, name);
5358      result[getEntityRecordMethodName] = (state, key, query) => {
5359        logEntityDeprecation(kind, name, getEntityRecordMethodName, {
5360          isShorthandSelector: true,
5361          alternativeFunctionName: "getEntityRecord"
5362        });
5363        return getEntityRecord(state, kind, name, key, query);
5364      };
5365      if (plural) {
5366        const getEntityRecordsMethodName = getMethodName(kind, plural, "get");
5367        result[getEntityRecordsMethodName] = (state, query) => {
5368          logEntityDeprecation(kind, name, getEntityRecordsMethodName, {
5369            isShorthandSelector: true,
5370            alternativeFunctionName: "getEntityRecords"
5371          });
5372          return getEntityRecords(state, kind, name, query);
5373        };
5374      }
5375      return result;
5376    }, {});
5377    var entityResolvers = entitiesConfig2.reduce((result, entity2) => {
5378      const { kind, name, plural } = entity2;
5379      const getEntityRecordMethodName = getMethodName(kind, name);
5380      result[getEntityRecordMethodName] = (key, query) => {
5381        logEntityDeprecation(kind, name, getEntityRecordMethodName, {
5382          isShorthandSelector: true,
5383          alternativeFunctionName: "getEntityRecord"
5384        });
5385        return getEntityRecord2(kind, name, key, query);
5386      };
5387      if (plural) {
5388        const getEntityRecordsMethodName = getMethodName(kind, plural, "get");
5389        result[getEntityRecordsMethodName] = (...args) => {
5390          logEntityDeprecation(kind, plural, getEntityRecordsMethodName, {
5391            isShorthandSelector: true,
5392            alternativeFunctionName: "getEntityRecords"
5393          });
5394          return getEntityRecords2(kind, name, ...args);
5395        };
5396        result[getEntityRecordsMethodName].shouldInvalidate = (action) => getEntityRecords2.shouldInvalidate(action, kind, name);
5397      }
5398      return result;
5399    }, {});
5400    var entityActions = entitiesConfig2.reduce((result, entity2) => {
5401      const { kind, name } = entity2;
5402      const saveEntityRecordMethodName = getMethodName(kind, name, "save");
5403      result[saveEntityRecordMethodName] = (record, options) => {
5404        logEntityDeprecation(kind, name, saveEntityRecordMethodName, {
5405          isShorthandSelector: true,
5406          alternativeFunctionName: "saveEntityRecord"
5407        });
5408        return saveEntityRecord(kind, name, record, options);
5409      };
5410      const deleteEntityRecordMethodName = getMethodName(kind, name, "delete");
5411      result[deleteEntityRecordMethodName] = (key, query, options) => {
5412        logEntityDeprecation(kind, name, deleteEntityRecordMethodName, {
5413          isShorthandSelector: true,
5414          alternativeFunctionName: "deleteEntityRecord"
5415        });
5416        return deleteEntityRecord(kind, name, key, query, options);
5417      };
5418      return result;
5419    }, {});
5420    var storeConfig = () => ({
5421      reducer: reducer_default2,
5422      actions: {
5423        ...dynamicActions,
5424        ...actions_exports,
5425        ...entityActions,
5426        ...createLocksActions()
5427      },
5428      selectors: {
5429        ...dynamicSelectors,
5430        ...selectors_exports,
5431        ...entitySelectors
5432      },
5433      resolvers: { ...resolvers_exports, ...entityResolvers }
5434    });
5435    var store = (0, import_data11.createReduxStore)(STORE_NAME, storeConfig());
5436    unlock(store).registerPrivateSelectors(private_selectors_exports);
5437    unlock(store).registerPrivateActions(private_actions_exports);
5438    (0, import_data11.register)(store);
5439    return __toCommonJS(index_exports);
5440  })();


Generated : Mon May 4 08:20:14 2026 Cross-referenced by PHPXref