[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  /******/ (function() { // webpackBootstrap
   2  /******/     var __webpack_modules__ = ({
   3  
   4  /***/ 2167:
   5  /***/ (function(module) {
   6  
   7  "use strict";
   8  
   9  
  10  function _typeof(obj) {
  11    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  12      _typeof = function (obj) {
  13        return typeof obj;
  14      };
  15    } else {
  16      _typeof = function (obj) {
  17        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  18      };
  19    }
  20  
  21    return _typeof(obj);
  22  }
  23  
  24  function _classCallCheck(instance, Constructor) {
  25    if (!(instance instanceof Constructor)) {
  26      throw new TypeError("Cannot call a class as a function");
  27    }
  28  }
  29  
  30  function _defineProperties(target, props) {
  31    for (var i = 0; i < props.length; i++) {
  32      var descriptor = props[i];
  33      descriptor.enumerable = descriptor.enumerable || false;
  34      descriptor.configurable = true;
  35      if ("value" in descriptor) descriptor.writable = true;
  36      Object.defineProperty(target, descriptor.key, descriptor);
  37    }
  38  }
  39  
  40  function _createClass(Constructor, protoProps, staticProps) {
  41    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  42    if (staticProps) _defineProperties(Constructor, staticProps);
  43    return Constructor;
  44  }
  45  
  46  /**
  47   * Given an instance of EquivalentKeyMap, returns its internal value pair tuple
  48   * for a key, if one exists. The tuple members consist of the last reference
  49   * value for the key (used in efficient subsequent lookups) and the value
  50   * assigned for the key at the leaf node.
  51   *
  52   * @param {EquivalentKeyMap} instance EquivalentKeyMap instance.
  53   * @param {*} key                     The key for which to return value pair.
  54   *
  55   * @return {?Array} Value pair, if exists.
  56   */
  57  function getValuePair(instance, key) {
  58    var _map = instance._map,
  59        _arrayTreeMap = instance._arrayTreeMap,
  60        _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the
  61    // value, which can be used to shortcut immediately to the value.
  62  
  63    if (_map.has(key)) {
  64      return _map.get(key);
  65    } // Sort keys to ensure stable retrieval from tree.
  66  
  67  
  68    var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value.
  69  
  70    var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
  71  
  72    for (var i = 0; i < properties.length; i++) {
  73      var property = properties[i];
  74      map = map.get(property);
  75  
  76      if (map === undefined) {
  77        return;
  78      }
  79  
  80      var propertyValue = key[property];
  81      map = map.get(propertyValue);
  82  
  83      if (map === undefined) {
  84        return;
  85      }
  86    }
  87  
  88    var valuePair = map.get('_ekm_value');
  89  
  90    if (!valuePair) {
  91      return;
  92    } // If reached, it implies that an object-like key was set with another
  93    // reference, so delete the reference and replace with the current.
  94  
  95  
  96    _map.delete(valuePair[0]);
  97  
  98    valuePair[0] = key;
  99    map.set('_ekm_value', valuePair);
 100  
 101    _map.set(key, valuePair);
 102  
 103    return valuePair;
 104  }
 105  /**
 106   * Variant of a Map object which enables lookup by equivalent (deeply equal)
 107   * object and array keys.
 108   */
 109  
 110  
 111  var EquivalentKeyMap =
 112  /*#__PURE__*/
 113  function () {
 114    /**
 115     * Constructs a new instance of EquivalentKeyMap.
 116     *
 117     * @param {Iterable.<*>} iterable Initial pair of key, value for map.
 118     */
 119    function EquivalentKeyMap(iterable) {
 120      _classCallCheck(this, EquivalentKeyMap);
 121  
 122      this.clear();
 123  
 124      if (iterable instanceof EquivalentKeyMap) {
 125        // Map#forEach is only means of iterating with support for IE11.
 126        var iterablePairs = [];
 127        iterable.forEach(function (value, key) {
 128          iterablePairs.push([key, value]);
 129        });
 130        iterable = iterablePairs;
 131      }
 132  
 133      if (iterable != null) {
 134        for (var i = 0; i < iterable.length; i++) {
 135          this.set(iterable[i][0], iterable[i][1]);
 136        }
 137      }
 138    }
 139    /**
 140     * Accessor property returning the number of elements.
 141     *
 142     * @return {number} Number of elements.
 143     */
 144  
 145  
 146    _createClass(EquivalentKeyMap, [{
 147      key: "set",
 148  
 149      /**
 150       * Add or update an element with a specified key and value.
 151       *
 152       * @param {*} key   The key of the element to add.
 153       * @param {*} value The value of the element to add.
 154       *
 155       * @return {EquivalentKeyMap} Map instance.
 156       */
 157      value: function set(key, value) {
 158        // Shortcut non-object-like to set on internal Map.
 159        if (key === null || _typeof(key) !== 'object') {
 160          this._map.set(key, value);
 161  
 162          return this;
 163        } // Sort keys to ensure stable assignment into tree.
 164  
 165  
 166        var properties = Object.keys(key).sort();
 167        var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value.
 168  
 169        var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
 170  
 171        for (var i = 0; i < properties.length; i++) {
 172          var property = properties[i];
 173  
 174          if (!map.has(property)) {
 175            map.set(property, new EquivalentKeyMap());
 176          }
 177  
 178          map = map.get(property);
 179          var propertyValue = key[property];
 180  
 181          if (!map.has(propertyValue)) {
 182            map.set(propertyValue, new EquivalentKeyMap());
 183          }
 184  
 185          map = map.get(propertyValue);
 186        } // If an _ekm_value exists, there was already an equivalent key. Before
 187        // overriding, ensure that the old key reference is removed from map to
 188        // avoid memory leak of accumulating equivalent keys. This is, in a
 189        // sense, a poor man's WeakMap, while still enabling iterability.
 190  
 191  
 192        var previousValuePair = map.get('_ekm_value');
 193  
 194        if (previousValuePair) {
 195          this._map.delete(previousValuePair[0]);
 196        }
 197  
 198        map.set('_ekm_value', valuePair);
 199  
 200        this._map.set(key, valuePair);
 201  
 202        return this;
 203      }
 204      /**
 205       * Returns a specified element.
 206       *
 207       * @param {*} key The key of the element to return.
 208       *
 209       * @return {?*} The element associated with the specified key or undefined
 210       *              if the key can't be found.
 211       */
 212  
 213    }, {
 214      key: "get",
 215      value: function get(key) {
 216        // Shortcut non-object-like to get from internal Map.
 217        if (key === null || _typeof(key) !== 'object') {
 218          return this._map.get(key);
 219        }
 220  
 221        var valuePair = getValuePair(this, key);
 222  
 223        if (valuePair) {
 224          return valuePair[1];
 225        }
 226      }
 227      /**
 228       * Returns a boolean indicating whether an element with the specified key
 229       * exists or not.
 230       *
 231       * @param {*} key The key of the element to test for presence.
 232       *
 233       * @return {boolean} Whether an element with the specified key exists.
 234       */
 235  
 236    }, {
 237      key: "has",
 238      value: function has(key) {
 239        if (key === null || _typeof(key) !== 'object') {
 240          return this._map.has(key);
 241        } // Test on the _presence_ of the pair, not its value, as even undefined
 242        // can be a valid member value for a key.
 243  
 244  
 245        return getValuePair(this, key) !== undefined;
 246      }
 247      /**
 248       * Removes the specified element.
 249       *
 250       * @param {*} key The key of the element to remove.
 251       *
 252       * @return {boolean} Returns true if an element existed and has been
 253       *                   removed, or false if the element does not exist.
 254       */
 255  
 256    }, {
 257      key: "delete",
 258      value: function _delete(key) {
 259        if (!this.has(key)) {
 260          return false;
 261        } // This naive implementation will leave orphaned child trees. A better
 262        // implementation should traverse and remove orphans.
 263  
 264  
 265        this.set(key, undefined);
 266        return true;
 267      }
 268      /**
 269       * Executes a provided function once per each key/value pair, in insertion
 270       * order.
 271       *
 272       * @param {Function} callback Function to execute for each element.
 273       * @param {*}        thisArg  Value to use as `this` when executing
 274       *                            `callback`.
 275       */
 276  
 277    }, {
 278      key: "forEach",
 279      value: function forEach(callback) {
 280        var _this = this;
 281  
 282        var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
 283  
 284        this._map.forEach(function (value, key) {
 285          // Unwrap value from object-like value pair.
 286          if (key !== null && _typeof(key) === 'object') {
 287            value = value[1];
 288          }
 289  
 290          callback.call(thisArg, value, key, _this);
 291        });
 292      }
 293      /**
 294       * Removes all elements.
 295       */
 296  
 297    }, {
 298      key: "clear",
 299      value: function clear() {
 300        this._map = new Map();
 301        this._arrayTreeMap = new Map();
 302        this._objectTreeMap = new Map();
 303      }
 304    }, {
 305      key: "size",
 306      get: function get() {
 307        return this._map.size;
 308      }
 309    }]);
 310  
 311    return EquivalentKeyMap;
 312  }();
 313  
 314  module.exports = EquivalentKeyMap;
 315  
 316  
 317  /***/ }),
 318  
 319  /***/ 9125:
 320  /***/ (function(module) {
 321  
 322  function combineReducers( reducers ) {
 323      var keys = Object.keys( reducers ),
 324          getNextState;
 325  
 326      getNextState = ( function() {
 327          var fn, i, key;
 328  
 329          fn = 'return {';
 330          for ( i = 0; i < keys.length; i++ ) {
 331              // Rely on Quoted escaping of JSON.stringify with guarantee that
 332              // each member of Object.keys is a string.
 333              //
 334              // "If Type(value) is String, then return the result of calling the
 335              // abstract operation Quote with argument value. [...] The abstract
 336              // operation Quote(value) wraps a String value in double quotes and
 337              // escapes characters within it."
 338              //
 339              // https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3
 340              key = JSON.stringify( keys[ i ] );
 341  
 342              fn += key + ':r[' + key + '](s[' + key + '],a),';
 343          }
 344          fn += '}';
 345  
 346          return new Function( 'r,s,a', fn );
 347      } )();
 348  
 349      return function combinedReducer( state, action ) {
 350          var nextState, i, key;
 351  
 352          // Assumed changed if initial state.
 353          if ( state === undefined ) {
 354              return getNextState( reducers, {}, action );
 355          }
 356  
 357          nextState = getNextState( reducers, state, action );
 358  
 359          // Determine whether state has changed.
 360          i = keys.length;
 361          while ( i-- ) {
 362              key = keys[ i ];
 363              if ( state[ key ] !== nextState[ key ] ) {
 364                  // Return immediately if a changed value is encountered.
 365                  return nextState;
 366              }
 367          }
 368  
 369          return state;
 370      };
 371  }
 372  
 373  module.exports = combineReducers;
 374  
 375  
 376  /***/ })
 377  
 378  /******/     });
 379  /************************************************************************/
 380  /******/     // The module cache
 381  /******/     var __webpack_module_cache__ = {};
 382  /******/     
 383  /******/     // The require function
 384  /******/ 	function __webpack_require__(moduleId) {
 385  /******/         // Check if module is in cache
 386  /******/         var cachedModule = __webpack_module_cache__[moduleId];
 387  /******/         if (cachedModule !== undefined) {
 388  /******/             return cachedModule.exports;
 389  /******/         }
 390  /******/         // Create a new module (and put it into the cache)
 391  /******/         var module = __webpack_module_cache__[moduleId] = {
 392  /******/             // no module.id needed
 393  /******/             // no module.loaded needed
 394  /******/             exports: {}
 395  /******/         };
 396  /******/     
 397  /******/         // Execute the module function
 398  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 399  /******/     
 400  /******/         // Return the exports of the module
 401  /******/         return module.exports;
 402  /******/     }
 403  /******/     
 404  /************************************************************************/
 405  /******/     /* webpack/runtime/compat get default export */
 406  /******/     !function() {
 407  /******/         // getDefaultExport function for compatibility with non-harmony modules
 408  /******/         __webpack_require__.n = function(module) {
 409  /******/             var getter = module && module.__esModule ?
 410  /******/                 function() { return module['default']; } :
 411  /******/                 function() { return module; };
 412  /******/             __webpack_require__.d(getter, { a: getter });
 413  /******/             return getter;
 414  /******/         };
 415  /******/     }();
 416  /******/     
 417  /******/     /* webpack/runtime/define property getters */
 418  /******/     !function() {
 419  /******/         // define getter functions for harmony exports
 420  /******/         __webpack_require__.d = function(exports, definition) {
 421  /******/             for(var key in definition) {
 422  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 423  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 424  /******/                 }
 425  /******/             }
 426  /******/         };
 427  /******/     }();
 428  /******/     
 429  /******/     /* webpack/runtime/hasOwnProperty shorthand */
 430  /******/     !function() {
 431  /******/         __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
 432  /******/     }();
 433  /******/     
 434  /******/     /* webpack/runtime/make namespace object */
 435  /******/     !function() {
 436  /******/         // define __esModule on exports
 437  /******/         __webpack_require__.r = function(exports) {
 438  /******/             if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 439  /******/                 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 440  /******/             }
 441  /******/             Object.defineProperty(exports, '__esModule', { value: true });
 442  /******/         };
 443  /******/     }();
 444  /******/     
 445  /************************************************************************/
 446  var __webpack_exports__ = {};
 447  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
 448  !function() {
 449  "use strict";
 450  // ESM COMPAT FLAG
 451  __webpack_require__.r(__webpack_exports__);
 452  
 453  // EXPORTS
 454  __webpack_require__.d(__webpack_exports__, {
 455    "AsyncModeProvider": function() { return /* reexport */ async_mode_provider_context; },
 456    "RegistryConsumer": function() { return /* reexport */ RegistryConsumer; },
 457    "RegistryProvider": function() { return /* reexport */ context; },
 458    "combineReducers": function() { return /* reexport */ (turbo_combine_reducers_default()); },
 459    "controls": function() { return /* reexport */ controls; },
 460    "createReduxStore": function() { return /* reexport */ createReduxStore; },
 461    "createRegistry": function() { return /* reexport */ createRegistry; },
 462    "createRegistryControl": function() { return /* reexport */ createRegistryControl; },
 463    "createRegistrySelector": function() { return /* reexport */ createRegistrySelector; },
 464    "dispatch": function() { return /* binding */ build_module_dispatch; },
 465    "plugins": function() { return /* reexport */ plugins_namespaceObject; },
 466    "register": function() { return /* binding */ register; },
 467    "registerGenericStore": function() { return /* binding */ registerGenericStore; },
 468    "registerStore": function() { return /* binding */ registerStore; },
 469    "resolveSelect": function() { return /* binding */ build_module_resolveSelect; },
 470    "select": function() { return /* binding */ build_module_select; },
 471    "subscribe": function() { return /* binding */ subscribe; },
 472    "use": function() { return /* binding */ use; },
 473    "useDispatch": function() { return /* reexport */ use_dispatch; },
 474    "useRegistry": function() { return /* reexport */ useRegistry; },
 475    "useSelect": function() { return /* reexport */ useSelect; },
 476    "withDispatch": function() { return /* reexport */ with_dispatch; },
 477    "withRegistry": function() { return /* reexport */ with_registry; },
 478    "withSelect": function() { return /* reexport */ with_select; }
 479  });
 480  
 481  // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
 482  var selectors_namespaceObject = {};
 483  __webpack_require__.r(selectors_namespaceObject);
 484  __webpack_require__.d(selectors_namespaceObject, {
 485    "getCachedResolvers": function() { return getCachedResolvers; },
 486    "getIsResolving": function() { return getIsResolving; },
 487    "getResolutionError": function() { return getResolutionError; },
 488    "getResolutionState": function() { return getResolutionState; },
 489    "hasFinishedResolution": function() { return hasFinishedResolution; },
 490    "hasResolutionFailed": function() { return hasResolutionFailed; },
 491    "hasStartedResolution": function() { return hasStartedResolution; },
 492    "isResolving": function() { return isResolving; }
 493  });
 494  
 495  // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
 496  var actions_namespaceObject = {};
 497  __webpack_require__.r(actions_namespaceObject);
 498  __webpack_require__.d(actions_namespaceObject, {
 499    "failResolution": function() { return failResolution; },
 500    "failResolutions": function() { return failResolutions; },
 501    "finishResolution": function() { return finishResolution; },
 502    "finishResolutions": function() { return finishResolutions; },
 503    "invalidateResolution": function() { return invalidateResolution; },
 504    "invalidateResolutionForStore": function() { return invalidateResolutionForStore; },
 505    "invalidateResolutionForStoreSelector": function() { return invalidateResolutionForStoreSelector; },
 506    "startResolution": function() { return startResolution; },
 507    "startResolutions": function() { return startResolutions; }
 508  });
 509  
 510  // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/plugins/index.js
 511  var plugins_namespaceObject = {};
 512  __webpack_require__.r(plugins_namespaceObject);
 513  __webpack_require__.d(plugins_namespaceObject, {
 514    "persistence": function() { return persistence; }
 515  });
 516  
 517  // EXTERNAL MODULE: ./node_modules/turbo-combine-reducers/index.js
 518  var turbo_combine_reducers = __webpack_require__(9125);
 519  var turbo_combine_reducers_default = /*#__PURE__*/__webpack_require__.n(turbo_combine_reducers);
 520  ;// CONCATENATED MODULE: external "lodash"
 521  var external_lodash_namespaceObject = window["lodash"];
 522  ;// CONCATENATED MODULE: external ["wp","deprecated"]
 523  var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
 524  var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
 525  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 526  function _defineProperty(obj, key, value) {
 527    if (key in obj) {
 528      Object.defineProperty(obj, key, {
 529        value: value,
 530        enumerable: true,
 531        configurable: true,
 532        writable: true
 533      });
 534    } else {
 535      obj[key] = value;
 536    }
 537  
 538    return obj;
 539  }
 540  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
 541  
 542  
 543  function ownKeys(object, enumerableOnly) {
 544    var keys = Object.keys(object);
 545  
 546    if (Object.getOwnPropertySymbols) {
 547      var symbols = Object.getOwnPropertySymbols(object);
 548      enumerableOnly && (symbols = symbols.filter(function (sym) {
 549        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
 550      })), keys.push.apply(keys, symbols);
 551    }
 552  
 553    return keys;
 554  }
 555  
 556  function _objectSpread2(target) {
 557    for (var i = 1; i < arguments.length; i++) {
 558      var source = null != arguments[i] ? arguments[i] : {};
 559      i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
 560        _defineProperty(target, key, source[key]);
 561      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
 562        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
 563      });
 564    }
 565  
 566    return target;
 567  }
 568  ;// CONCATENATED MODULE: ./node_modules/redux/es/redux.js
 569  
 570  
 571  /**
 572   * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
 573   *
 574   * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
 575   * during build.
 576   * @param {number} code
 577   */
 578  function formatProdErrorMessage(code) {
 579    return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
 580  }
 581  
 582  // Inlined version of the `symbol-observable` polyfill
 583  var $$observable = (function () {
 584    return typeof Symbol === 'function' && Symbol.observable || '@@observable';
 585  })();
 586  
 587  /**
 588   * These are private action types reserved by Redux.
 589   * For any unknown actions, you must return the current state.
 590   * If the current state is undefined, you must return the initial state.
 591   * Do not reference these action types directly in your code.
 592   */
 593  var randomString = function randomString() {
 594    return Math.random().toString(36).substring(7).split('').join('.');
 595  };
 596  
 597  var ActionTypes = {
 598    INIT: "@@redux/INIT" + randomString(),
 599    REPLACE: "@@redux/REPLACE" + randomString(),
 600    PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
 601      return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
 602    }
 603  };
 604  
 605  /**
 606   * @param {any} obj The object to inspect.
 607   * @returns {boolean} True if the argument appears to be a plain object.
 608   */
 609  function isPlainObject(obj) {
 610    if (typeof obj !== 'object' || obj === null) return false;
 611    var proto = obj;
 612  
 613    while (Object.getPrototypeOf(proto) !== null) {
 614      proto = Object.getPrototypeOf(proto);
 615    }
 616  
 617    return Object.getPrototypeOf(obj) === proto;
 618  }
 619  
 620  // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
 621  function miniKindOf(val) {
 622    if (val === void 0) return 'undefined';
 623    if (val === null) return 'null';
 624    var type = typeof val;
 625  
 626    switch (type) {
 627      case 'boolean':
 628      case 'string':
 629      case 'number':
 630      case 'symbol':
 631      case 'function':
 632        {
 633          return type;
 634        }
 635    }
 636  
 637    if (Array.isArray(val)) return 'array';
 638    if (isDate(val)) return 'date';
 639    if (isError(val)) return 'error';
 640    var constructorName = ctorName(val);
 641  
 642    switch (constructorName) {
 643      case 'Symbol':
 644      case 'Promise':
 645      case 'WeakMap':
 646      case 'WeakSet':
 647      case 'Map':
 648      case 'Set':
 649        return constructorName;
 650    } // other
 651  
 652  
 653    return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
 654  }
 655  
 656  function ctorName(val) {
 657    return typeof val.constructor === 'function' ? val.constructor.name : null;
 658  }
 659  
 660  function isError(val) {
 661    return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
 662  }
 663  
 664  function isDate(val) {
 665    if (val instanceof Date) return true;
 666    return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
 667  }
 668  
 669  function kindOf(val) {
 670    var typeOfVal = typeof val;
 671  
 672    if (false) {}
 673  
 674    return typeOfVal;
 675  }
 676  
 677  /**
 678   * @deprecated
 679   *
 680   * **We recommend using the `configureStore` method
 681   * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
 682   *
 683   * Redux Toolkit is our recommended approach for writing Redux logic today,
 684   * including store setup, reducers, data fetching, and more.
 685   *
 686   * **For more details, please read this Redux docs page:**
 687   * **https://redux.js.org/introduction/why-rtk-is-redux-today**
 688   *
 689   * `configureStore` from Redux Toolkit is an improved version of `createStore` that
 690   * simplifies setup and helps avoid common bugs.
 691   *
 692   * You should not be using the `redux` core package by itself today, except for learning purposes.
 693   * The `createStore` method from the core `redux` package will not be removed, but we encourage
 694   * all users to migrate to using Redux Toolkit for all Redux code.
 695   *
 696   * If you want to use `createStore` without this visual deprecation warning, use
 697   * the `legacy_createStore` import instead:
 698   *
 699   * `import { legacy_createStore as createStore} from 'redux'`
 700   *
 701   */
 702  
 703  function createStore(reducer, preloadedState, enhancer) {
 704    var _ref2;
 705  
 706    if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
 707      throw new Error( true ? formatProdErrorMessage(0) : 0);
 708    }
 709  
 710    if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
 711      enhancer = preloadedState;
 712      preloadedState = undefined;
 713    }
 714  
 715    if (typeof enhancer !== 'undefined') {
 716      if (typeof enhancer !== 'function') {
 717        throw new Error( true ? formatProdErrorMessage(1) : 0);
 718      }
 719  
 720      return enhancer(createStore)(reducer, preloadedState);
 721    }
 722  
 723    if (typeof reducer !== 'function') {
 724      throw new Error( true ? formatProdErrorMessage(2) : 0);
 725    }
 726  
 727    var currentReducer = reducer;
 728    var currentState = preloadedState;
 729    var currentListeners = [];
 730    var nextListeners = currentListeners;
 731    var isDispatching = false;
 732    /**
 733     * This makes a shallow copy of currentListeners so we can use
 734     * nextListeners as a temporary list while dispatching.
 735     *
 736     * This prevents any bugs around consumers calling
 737     * subscribe/unsubscribe in the middle of a dispatch.
 738     */
 739  
 740    function ensureCanMutateNextListeners() {
 741      if (nextListeners === currentListeners) {
 742        nextListeners = currentListeners.slice();
 743      }
 744    }
 745    /**
 746     * Reads the state tree managed by the store.
 747     *
 748     * @returns {any} The current state tree of your application.
 749     */
 750  
 751  
 752    function getState() {
 753      if (isDispatching) {
 754        throw new Error( true ? formatProdErrorMessage(3) : 0);
 755      }
 756  
 757      return currentState;
 758    }
 759    /**
 760     * Adds a change listener. It will be called any time an action is dispatched,
 761     * and some part of the state tree may potentially have changed. You may then
 762     * call `getState()` to read the current state tree inside the callback.
 763     *
 764     * You may call `dispatch()` from a change listener, with the following
 765     * caveats:
 766     *
 767     * 1. The subscriptions are snapshotted just before every `dispatch()` call.
 768     * If you subscribe or unsubscribe while the listeners are being invoked, this
 769     * will not have any effect on the `dispatch()` that is currently in progress.
 770     * However, the next `dispatch()` call, whether nested or not, will use a more
 771     * recent snapshot of the subscription list.
 772     *
 773     * 2. The listener should not expect to see all state changes, as the state
 774     * might have been updated multiple times during a nested `dispatch()` before
 775     * the listener is called. It is, however, guaranteed that all subscribers
 776     * registered before the `dispatch()` started will be called with the latest
 777     * state by the time it exits.
 778     *
 779     * @param {Function} listener A callback to be invoked on every dispatch.
 780     * @returns {Function} A function to remove this change listener.
 781     */
 782  
 783  
 784    function subscribe(listener) {
 785      if (typeof listener !== 'function') {
 786        throw new Error( true ? formatProdErrorMessage(4) : 0);
 787      }
 788  
 789      if (isDispatching) {
 790        throw new Error( true ? formatProdErrorMessage(5) : 0);
 791      }
 792  
 793      var isSubscribed = true;
 794      ensureCanMutateNextListeners();
 795      nextListeners.push(listener);
 796      return function unsubscribe() {
 797        if (!isSubscribed) {
 798          return;
 799        }
 800  
 801        if (isDispatching) {
 802          throw new Error( true ? formatProdErrorMessage(6) : 0);
 803        }
 804  
 805        isSubscribed = false;
 806        ensureCanMutateNextListeners();
 807        var index = nextListeners.indexOf(listener);
 808        nextListeners.splice(index, 1);
 809        currentListeners = null;
 810      };
 811    }
 812    /**
 813     * Dispatches an action. It is the only way to trigger a state change.
 814     *
 815     * The `reducer` function, used to create the store, will be called with the
 816     * current state tree and the given `action`. Its return value will
 817     * be considered the **next** state of the tree, and the change listeners
 818     * will be notified.
 819     *
 820     * The base implementation only supports plain object actions. If you want to
 821     * dispatch a Promise, an Observable, a thunk, or something else, you need to
 822     * wrap your store creating function into the corresponding middleware. For
 823     * example, see the documentation for the `redux-thunk` package. Even the
 824     * middleware will eventually dispatch plain object actions using this method.
 825     *
 826     * @param {Object} action A plain object representing “what changed”. It is
 827     * a good idea to keep actions serializable so you can record and replay user
 828     * sessions, or use the time travelling `redux-devtools`. An action must have
 829     * a `type` property which may not be `undefined`. It is a good idea to use
 830     * string constants for action types.
 831     *
 832     * @returns {Object} For convenience, the same action object you dispatched.
 833     *
 834     * Note that, if you use a custom middleware, it may wrap `dispatch()` to
 835     * return something else (for example, a Promise you can await).
 836     */
 837  
 838  
 839    function dispatch(action) {
 840      if (!isPlainObject(action)) {
 841        throw new Error( true ? formatProdErrorMessage(7) : 0);
 842      }
 843  
 844      if (typeof action.type === 'undefined') {
 845        throw new Error( true ? formatProdErrorMessage(8) : 0);
 846      }
 847  
 848      if (isDispatching) {
 849        throw new Error( true ? formatProdErrorMessage(9) : 0);
 850      }
 851  
 852      try {
 853        isDispatching = true;
 854        currentState = currentReducer(currentState, action);
 855      } finally {
 856        isDispatching = false;
 857      }
 858  
 859      var listeners = currentListeners = nextListeners;
 860  
 861      for (var i = 0; i < listeners.length; i++) {
 862        var listener = listeners[i];
 863        listener();
 864      }
 865  
 866      return action;
 867    }
 868    /**
 869     * Replaces the reducer currently used by the store to calculate the state.
 870     *
 871     * You might need this if your app implements code splitting and you want to
 872     * load some of the reducers dynamically. You might also need this if you
 873     * implement a hot reloading mechanism for Redux.
 874     *
 875     * @param {Function} nextReducer The reducer for the store to use instead.
 876     * @returns {void}
 877     */
 878  
 879  
 880    function replaceReducer(nextReducer) {
 881      if (typeof nextReducer !== 'function') {
 882        throw new Error( true ? formatProdErrorMessage(10) : 0);
 883      }
 884  
 885      currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
 886      // Any reducers that existed in both the new and old rootReducer
 887      // will receive the previous state. This effectively populates
 888      // the new state tree with any relevant data from the old one.
 889  
 890      dispatch({
 891        type: ActionTypes.REPLACE
 892      });
 893    }
 894    /**
 895     * Interoperability point for observable/reactive libraries.
 896     * @returns {observable} A minimal observable of state changes.
 897     * For more information, see the observable proposal:
 898     * https://github.com/tc39/proposal-observable
 899     */
 900  
 901  
 902    function observable() {
 903      var _ref;
 904  
 905      var outerSubscribe = subscribe;
 906      return _ref = {
 907        /**
 908         * The minimal observable subscription method.
 909         * @param {Object} observer Any object that can be used as an observer.
 910         * The observer object should have a `next` method.
 911         * @returns {subscription} An object with an `unsubscribe` method that can
 912         * be used to unsubscribe the observable from the store, and prevent further
 913         * emission of values from the observable.
 914         */
 915        subscribe: function subscribe(observer) {
 916          if (typeof observer !== 'object' || observer === null) {
 917            throw new Error( true ? formatProdErrorMessage(11) : 0);
 918          }
 919  
 920          function observeState() {
 921            if (observer.next) {
 922              observer.next(getState());
 923            }
 924          }
 925  
 926          observeState();
 927          var unsubscribe = outerSubscribe(observeState);
 928          return {
 929            unsubscribe: unsubscribe
 930          };
 931        }
 932      }, _ref[$$observable] = function () {
 933        return this;
 934      }, _ref;
 935    } // When a store is created, an "INIT" action is dispatched so that every
 936    // reducer returns their initial state. This effectively populates
 937    // the initial state tree.
 938  
 939  
 940    dispatch({
 941      type: ActionTypes.INIT
 942    });
 943    return _ref2 = {
 944      dispatch: dispatch,
 945      subscribe: subscribe,
 946      getState: getState,
 947      replaceReducer: replaceReducer
 948    }, _ref2[$$observable] = observable, _ref2;
 949  }
 950  /**
 951   * Creates a Redux store that holds the state tree.
 952   *
 953   * **We recommend using `configureStore` from the
 954   * `@reduxjs/toolkit` package**, which replaces `createStore`:
 955   * **https://redux.js.org/introduction/why-rtk-is-redux-today**
 956   *
 957   * The only way to change the data in the store is to call `dispatch()` on it.
 958   *
 959   * There should only be a single store in your app. To specify how different
 960   * parts of the state tree respond to actions, you may combine several reducers
 961   * into a single reducer function by using `combineReducers`.
 962   *
 963   * @param {Function} reducer A function that returns the next state tree, given
 964   * the current state tree and the action to handle.
 965   *
 966   * @param {any} [preloadedState] The initial state. You may optionally specify it
 967   * to hydrate the state from the server in universal apps, or to restore a
 968   * previously serialized user session.
 969   * If you use `combineReducers` to produce the root reducer function, this must be
 970   * an object with the same shape as `combineReducers` keys.
 971   *
 972   * @param {Function} [enhancer] The store enhancer. You may optionally specify it
 973   * to enhance the store with third-party capabilities such as middleware,
 974   * time travel, persistence, etc. The only store enhancer that ships with Redux
 975   * is `applyMiddleware()`.
 976   *
 977   * @returns {Store} A Redux store that lets you read the state, dispatch actions
 978   * and subscribe to changes.
 979   */
 980  
 981  var legacy_createStore = (/* unused pure expression or super */ null && (createStore));
 982  
 983  /**
 984   * Prints a warning in the console if it exists.
 985   *
 986   * @param {String} message The warning message.
 987   * @returns {void}
 988   */
 989  function warning(message) {
 990    /* eslint-disable no-console */
 991    if (typeof console !== 'undefined' && typeof console.error === 'function') {
 992      console.error(message);
 993    }
 994    /* eslint-enable no-console */
 995  
 996  
 997    try {
 998      // This error was thrown as a convenience so that if you enable
 999      // "break on all exceptions" in your console,
1000      // it would pause the execution at this line.
1001      throw new Error(message);
1002    } catch (e) {} // eslint-disable-line no-empty
1003  
1004  }
1005  
1006  function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
1007    var reducerKeys = Object.keys(reducers);
1008    var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
1009  
1010    if (reducerKeys.length === 0) {
1011      return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
1012    }
1013  
1014    if (!isPlainObject(inputState)) {
1015      return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
1016    }
1017  
1018    var unexpectedKeys = Object.keys(inputState).filter(function (key) {
1019      return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
1020    });
1021    unexpectedKeys.forEach(function (key) {
1022      unexpectedKeyCache[key] = true;
1023    });
1024    if (action && action.type === ActionTypes.REPLACE) return;
1025  
1026    if (unexpectedKeys.length > 0) {
1027      return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
1028    }
1029  }
1030  
1031  function assertReducerShape(reducers) {
1032    Object.keys(reducers).forEach(function (key) {
1033      var reducer = reducers[key];
1034      var initialState = reducer(undefined, {
1035        type: ActionTypes.INIT
1036      });
1037  
1038      if (typeof initialState === 'undefined') {
1039        throw new Error( true ? formatProdErrorMessage(12) : 0);
1040      }
1041  
1042      if (typeof reducer(undefined, {
1043        type: ActionTypes.PROBE_UNKNOWN_ACTION()
1044      }) === 'undefined') {
1045        throw new Error( true ? formatProdErrorMessage(13) : 0);
1046      }
1047    });
1048  }
1049  /**
1050   * Turns an object whose values are different reducer functions, into a single
1051   * reducer function. It will call every child reducer, and gather their results
1052   * into a single state object, whose keys correspond to the keys of the passed
1053   * reducer functions.
1054   *
1055   * @param {Object} reducers An object whose values correspond to different
1056   * reducer functions that need to be combined into one. One handy way to obtain
1057   * it is to use ES6 `import * as reducers` syntax. The reducers may never return
1058   * undefined for any action. Instead, they should return their initial state
1059   * if the state passed to them was undefined, and the current state for any
1060   * unrecognized action.
1061   *
1062   * @returns {Function} A reducer function that invokes every reducer inside the
1063   * passed object, and builds a state object with the same shape.
1064   */
1065  
1066  
1067  function combineReducers(reducers) {
1068    var reducerKeys = Object.keys(reducers);
1069    var finalReducers = {};
1070  
1071    for (var i = 0; i < reducerKeys.length; i++) {
1072      var key = reducerKeys[i];
1073  
1074      if (false) {}
1075  
1076      if (typeof reducers[key] === 'function') {
1077        finalReducers[key] = reducers[key];
1078      }
1079    }
1080  
1081    var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
1082    // keys multiple times.
1083  
1084    var unexpectedKeyCache;
1085  
1086    if (false) {}
1087  
1088    var shapeAssertionError;
1089  
1090    try {
1091      assertReducerShape(finalReducers);
1092    } catch (e) {
1093      shapeAssertionError = e;
1094    }
1095  
1096    return function combination(state, action) {
1097      if (state === void 0) {
1098        state = {};
1099      }
1100  
1101      if (shapeAssertionError) {
1102        throw shapeAssertionError;
1103      }
1104  
1105      if (false) { var warningMessage; }
1106  
1107      var hasChanged = false;
1108      var nextState = {};
1109  
1110      for (var _i = 0; _i < finalReducerKeys.length; _i++) {
1111        var _key = finalReducerKeys[_i];
1112        var reducer = finalReducers[_key];
1113        var previousStateForKey = state[_key];
1114        var nextStateForKey = reducer(previousStateForKey, action);
1115  
1116        if (typeof nextStateForKey === 'undefined') {
1117          var actionType = action && action.type;
1118          throw new Error( true ? formatProdErrorMessage(14) : 0);
1119        }
1120  
1121        nextState[_key] = nextStateForKey;
1122        hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
1123      }
1124  
1125      hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
1126      return hasChanged ? nextState : state;
1127    };
1128  }
1129  
1130  function bindActionCreator(actionCreator, dispatch) {
1131    return function () {
1132      return dispatch(actionCreator.apply(this, arguments));
1133    };
1134  }
1135  /**
1136   * Turns an object whose values are action creators, into an object with the
1137   * same keys, but with every function wrapped into a `dispatch` call so they
1138   * may be invoked directly. This is just a convenience method, as you can call
1139   * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
1140   *
1141   * For convenience, you can also pass an action creator as the first argument,
1142   * and get a dispatch wrapped function in return.
1143   *
1144   * @param {Function|Object} actionCreators An object whose values are action
1145   * creator functions. One handy way to obtain it is to use ES6 `import * as`
1146   * syntax. You may also pass a single function.
1147   *
1148   * @param {Function} dispatch The `dispatch` function available on your Redux
1149   * store.
1150   *
1151   * @returns {Function|Object} The object mimicking the original object, but with
1152   * every action creator wrapped into the `dispatch` call. If you passed a
1153   * function as `actionCreators`, the return value will also be a single
1154   * function.
1155   */
1156  
1157  
1158  function bindActionCreators(actionCreators, dispatch) {
1159    if (typeof actionCreators === 'function') {
1160      return bindActionCreator(actionCreators, dispatch);
1161    }
1162  
1163    if (typeof actionCreators !== 'object' || actionCreators === null) {
1164      throw new Error( true ? formatProdErrorMessage(16) : 0);
1165    }
1166  
1167    var boundActionCreators = {};
1168  
1169    for (var key in actionCreators) {
1170      var actionCreator = actionCreators[key];
1171  
1172      if (typeof actionCreator === 'function') {
1173        boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
1174      }
1175    }
1176  
1177    return boundActionCreators;
1178  }
1179  
1180  /**
1181   * Composes single-argument functions from right to left. The rightmost
1182   * function can take multiple arguments as it provides the signature for
1183   * the resulting composite function.
1184   *
1185   * @param {...Function} funcs The functions to compose.
1186   * @returns {Function} A function obtained by composing the argument functions
1187   * from right to left. For example, compose(f, g, h) is identical to doing
1188   * (...args) => f(g(h(...args))).
1189   */
1190  function compose() {
1191    for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
1192      funcs[_key] = arguments[_key];
1193    }
1194  
1195    if (funcs.length === 0) {
1196      return function (arg) {
1197        return arg;
1198      };
1199    }
1200  
1201    if (funcs.length === 1) {
1202      return funcs[0];
1203    }
1204  
1205    return funcs.reduce(function (a, b) {
1206      return function () {
1207        return a(b.apply(void 0, arguments));
1208      };
1209    });
1210  }
1211  
1212  /**
1213   * Creates a store enhancer that applies middleware to the dispatch method
1214   * of the Redux store. This is handy for a variety of tasks, such as expressing
1215   * asynchronous actions in a concise manner, or logging every action payload.
1216   *
1217   * See `redux-thunk` package as an example of the Redux middleware.
1218   *
1219   * Because middleware is potentially asynchronous, this should be the first
1220   * store enhancer in the composition chain.
1221   *
1222   * Note that each middleware will be given the `dispatch` and `getState` functions
1223   * as named arguments.
1224   *
1225   * @param {...Function} middlewares The middleware chain to be applied.
1226   * @returns {Function} A store enhancer applying the middleware.
1227   */
1228  
1229  function applyMiddleware() {
1230    for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
1231      middlewares[_key] = arguments[_key];
1232    }
1233  
1234    return function (createStore) {
1235      return function () {
1236        var store = createStore.apply(void 0, arguments);
1237  
1238        var _dispatch = function dispatch() {
1239          throw new Error( true ? formatProdErrorMessage(15) : 0);
1240        };
1241  
1242        var middlewareAPI = {
1243          getState: store.getState,
1244          dispatch: function dispatch() {
1245            return _dispatch.apply(void 0, arguments);
1246          }
1247        };
1248        var chain = middlewares.map(function (middleware) {
1249          return middleware(middlewareAPI);
1250        });
1251        _dispatch = compose.apply(void 0, chain)(store.dispatch);
1252        return _objectSpread2(_objectSpread2({}, store), {}, {
1253          dispatch: _dispatch
1254        });
1255      };
1256    };
1257  }
1258  
1259  /*
1260   * This is a dummy function to check if the function name has been altered by minification.
1261   * If the function has been minified and NODE_ENV !== 'production', warn the user.
1262   */
1263  
1264  function isCrushed() {}
1265  
1266  if (false) {}
1267  
1268  
1269  
1270  // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
1271  var equivalent_key_map = __webpack_require__(2167);
1272  var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
1273  ;// CONCATENATED MODULE: external ["wp","reduxRoutine"]
1274  var external_wp_reduxRoutine_namespaceObject = window["wp"]["reduxRoutine"];
1275  var external_wp_reduxRoutine_default = /*#__PURE__*/__webpack_require__.n(external_wp_reduxRoutine_namespaceObject);
1276  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/factory.js
1277  /**
1278   * Creates a selector function that takes additional curried argument with the
1279   * registry `select` function. While a regular selector has signature
1280   * ```js
1281   * ( state, ...selectorArgs ) => ( result )
1282   * ```
1283   * that allows to select data from the store's `state`, a registry selector
1284   * has signature:
1285   * ```js
1286   * ( select ) => ( state, ...selectorArgs ) => ( result )
1287   * ```
1288   * that supports also selecting from other registered stores.
1289   *
1290   * @example
1291   * ```js
1292   * const getCurrentPostId = createRegistrySelector( ( select ) => ( state ) => {
1293   *   return select( 'core/editor' ).getCurrentPostId();
1294   * } );
1295   *
1296   * const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
1297   *   // calling another registry selector just like any other function
1298   *   const postType = getCurrentPostType( state );
1299   *   const postId = getCurrentPostId( state );
1300   *     return select( 'core' ).getEntityRecordEdits( 'postType', postType, postId );
1301   * } );
1302   * ```
1303   *
1304   * Note how the `getCurrentPostId` selector can be called just like any other function,
1305   * (it works even inside a regular non-registry selector) and we don't need to pass the
1306   * registry as argument. The registry binding happens automatically when registering the selector
1307   * with a store.
1308   *
1309   * @param {Function} registrySelector Function receiving a registry `select`
1310   *                                    function and returning a state selector.
1311   *
1312   * @return {Function} Registry selector that can be registered with a store.
1313   */
1314  function createRegistrySelector(registrySelector) {
1315    // Create a selector function that is bound to the registry referenced by `selector.registry`
1316    // and that has the same API as a regular selector. Binding it in such a way makes it
1317    // possible to call the selector directly from another selector.
1318    const selector = function () {
1319      return registrySelector(selector.registry.select)(...arguments);
1320    };
1321    /**
1322     * Flag indicating that the selector is a registry selector that needs the correct registry
1323     * reference to be assigned to `selecto.registry` to make it work correctly.
1324     * be mapped as a registry selector.
1325     *
1326     * @type {boolean}
1327     */
1328  
1329  
1330    selector.isRegistrySelector = true;
1331    return selector;
1332  }
1333  /**
1334   * Creates a control function that takes additional curried argument with the `registry` object.
1335   * While a regular control has signature
1336   * ```js
1337   * ( action ) => ( iteratorOrPromise )
1338   * ```
1339   * where the control works with the `action` that it's bound to, a registry control has signature:
1340   * ```js
1341   * ( registry ) => ( action ) => ( iteratorOrPromise )
1342   * ```
1343   * A registry control is typically used to select data or dispatch an action to a registered
1344   * store.
1345   *
1346   * When registering a control created with `createRegistryControl` with a store, the store
1347   * knows which calling convention to use when executing the control.
1348   *
1349   * @param {Function} registryControl Function receiving a registry object and returning a control.
1350   *
1351   * @return {Function} Registry control that can be registered with a store.
1352   */
1353  
1354  function createRegistryControl(registryControl) {
1355    registryControl.isRegistryControl = true;
1356    return registryControl;
1357  }
1358  
1359  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/controls.js
1360  /**
1361   * External dependencies
1362   */
1363  
1364  /**
1365   * Internal dependencies
1366   */
1367  
1368  
1369  /** @typedef {import('./types').StoreDescriptor} StoreDescriptor */
1370  
1371  const SELECT = '@@data/SELECT';
1372  const RESOLVE_SELECT = '@@data/RESOLVE_SELECT';
1373  const DISPATCH = '@@data/DISPATCH';
1374  /**
1375   * Dispatches a control action for triggering a synchronous registry select.
1376   *
1377   * Note: This control synchronously returns the current selector value, triggering the
1378   * resolution, but not waiting for it.
1379   *
1380   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
1381   * @param {string}                 selectorName          The name of the selector.
1382   * @param {Array}                  args                  Arguments for the selector.
1383   *
1384   * @example
1385   * ```js
1386   * import { controls } from '@wordpress/data';
1387   *
1388   * // Action generator using `select`.
1389   * export function* myAction() {
1390   *   const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );
1391   *   // Do stuff with the result from the `select`.
1392   * }
1393   * ```
1394   *
1395   * @return {Object} The control descriptor.
1396   */
1397  
1398  function controls_select(storeNameOrDescriptor, selectorName) {
1399    for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1400      args[_key - 2] = arguments[_key];
1401    }
1402  
1403    return {
1404      type: SELECT,
1405      storeKey: (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor,
1406      selectorName,
1407      args
1408    };
1409  }
1410  /**
1411   * Dispatches a control action for triggering and resolving a registry select.
1412   *
1413   * Note: when this control action is handled, it automatically considers
1414   * selectors that may have a resolver. In such case, it will return a `Promise` that resolves
1415   * after the selector finishes resolving, with the final result value.
1416   *
1417   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
1418   * @param {string}                 selectorName          The name of the selector
1419   * @param {Array}                  args                  Arguments for the selector.
1420   *
1421   * @example
1422   * ```js
1423   * import { controls } from '@wordpress/data';
1424   *
1425   * // Action generator using resolveSelect
1426   * export function* myAction() {
1427   *     const isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );
1428   *     // do stuff with the result from the select.
1429   * }
1430   * ```
1431   *
1432   * @return {Object} The control descriptor.
1433   */
1434  
1435  
1436  function resolveSelect(storeNameOrDescriptor, selectorName) {
1437    for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
1438      args[_key2 - 2] = arguments[_key2];
1439    }
1440  
1441    return {
1442      type: RESOLVE_SELECT,
1443      storeKey: (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor,
1444      selectorName,
1445      args
1446    };
1447  }
1448  /**
1449   * Dispatches a control action for triggering a registry dispatch.
1450   *
1451   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
1452   * @param {string}                 actionName            The name of the action to dispatch
1453   * @param {Array}                  args                  Arguments for the dispatch action.
1454   *
1455   * @example
1456   * ```js
1457   * import { controls } from '@wordpress/data-controls';
1458   *
1459   * // Action generator using dispatch
1460   * export function* myAction() {
1461   *   yield controls.dispatch( 'core/edit-post', 'togglePublishSidebar' );
1462   *   // do some other things.
1463   * }
1464   * ```
1465   *
1466   * @return {Object}  The control descriptor.
1467   */
1468  
1469  
1470  function dispatch(storeNameOrDescriptor, actionName) {
1471    for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
1472      args[_key3 - 2] = arguments[_key3];
1473    }
1474  
1475    return {
1476      type: DISPATCH,
1477      storeKey: (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor,
1478      actionName,
1479      args
1480    };
1481  }
1482  
1483  const controls = {
1484    select: controls_select,
1485    resolveSelect,
1486    dispatch
1487  };
1488  const builtinControls = {
1489    [SELECT]: createRegistryControl(registry => _ref => {
1490      let {
1491        storeKey,
1492        selectorName,
1493        args
1494      } = _ref;
1495      return registry.select(storeKey)[selectorName](...args);
1496    }),
1497    [RESOLVE_SELECT]: createRegistryControl(registry => _ref2 => {
1498      let {
1499        storeKey,
1500        selectorName,
1501        args
1502      } = _ref2;
1503      const method = registry.select(storeKey)[selectorName].hasResolver ? 'resolveSelect' : 'select';
1504      return registry[method](storeKey)[selectorName](...args);
1505    }),
1506    [DISPATCH]: createRegistryControl(registry => _ref3 => {
1507      let {
1508        storeKey,
1509        actionName,
1510        args
1511      } = _ref3;
1512      return registry.dispatch(storeKey)[actionName](...args);
1513    })
1514  };
1515  
1516  ;// CONCATENATED MODULE: ./node_modules/is-promise/index.mjs
1517  function isPromise(obj) {
1518    return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
1519  }
1520  
1521  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/promise-middleware.js
1522  /**
1523   * External dependencies
1524   */
1525  
1526  /**
1527   * Simplest possible promise redux middleware.
1528   *
1529   * @type {import('redux').Middleware}
1530   */
1531  
1532  const promiseMiddleware = () => next => action => {
1533    if (isPromise(action)) {
1534      return action.then(resolvedAction => {
1535        if (resolvedAction) {
1536          return next(resolvedAction);
1537        }
1538      });
1539    }
1540  
1541    return next(action);
1542  };
1543  
1544  /* harmony default export */ var promise_middleware = (promiseMiddleware);
1545  
1546  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/store/index.js
1547  const coreDataStore = {
1548    name: 'core/data',
1549  
1550    instantiate(registry) {
1551      const getCoreDataSelector = selectorName => function (key) {
1552        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1553          args[_key - 1] = arguments[_key];
1554        }
1555  
1556        return registry.select(key)[selectorName](...args);
1557      };
1558  
1559      const getCoreDataAction = actionName => function (key) {
1560        for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1561          args[_key2 - 1] = arguments[_key2];
1562        }
1563  
1564        return registry.dispatch(key)[actionName](...args);
1565      };
1566  
1567      return {
1568        getSelectors() {
1569          return Object.fromEntries(['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'].map(selectorName => [selectorName, getCoreDataSelector(selectorName)]));
1570        },
1571  
1572        getActions() {
1573          return Object.fromEntries(['startResolution', 'finishResolution', 'invalidateResolution', 'invalidateResolutionForStore', 'invalidateResolutionForStoreSelector'].map(actionName => [actionName, getCoreDataAction(actionName)]));
1574        },
1575  
1576        subscribe() {
1577          // There's no reasons to trigger any listener when we subscribe to this store
1578          // because there's no state stored in this store that need to retrigger selectors
1579          // if a change happens, the corresponding store where the tracking stated live
1580          // would have already triggered a "subscribe" call.
1581          return () => () => {};
1582        }
1583  
1584      };
1585    }
1586  
1587  };
1588  /* harmony default export */ var store = (coreDataStore);
1589  
1590  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js
1591  /**
1592   * External dependencies
1593   */
1594  
1595  /**
1596   * Internal dependencies
1597   */
1598  
1599  
1600  /** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
1601  
1602  /**
1603   * Creates a middleware handling resolvers cache invalidation.
1604   *
1605   * @param {WPDataRegistry} registry   The registry reference for which to create
1606   *                                    the middleware.
1607   * @param {string}         reducerKey The namespace for which to create the
1608   *                                    middleware.
1609   *
1610   * @return {Function} Middleware function.
1611   */
1612  
1613  const createResolversCacheMiddleware = (registry, reducerKey) => () => next => action => {
1614    const resolvers = registry.select(store).getCachedResolvers(reducerKey);
1615    Object.entries(resolvers).forEach(_ref => {
1616      let [selectorName, resolversByArgs] = _ref;
1617      const resolver = (0,external_lodash_namespaceObject.get)(registry.stores, [reducerKey, 'resolvers', selectorName]);
1618  
1619      if (!resolver || !resolver.shouldInvalidate) {
1620        return;
1621      }
1622  
1623      resolversByArgs.forEach((value, args) => {
1624        // resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.
1625        // If the value is "finished" or "error" it means this resolver has finished its resolution which means we need
1626        // to invalidate it, if it's true it means it's inflight and the invalidation is not necessary.
1627        if ((value === null || value === void 0 ? void 0 : value.status) !== 'finished' && (value === null || value === void 0 ? void 0 : value.status) !== 'error' || !resolver.shouldInvalidate(action, ...args)) {
1628          return;
1629        } // Trigger cache invalidation
1630  
1631  
1632        registry.dispatch(store).invalidateResolution(reducerKey, selectorName, args);
1633      });
1634    });
1635    return next(action);
1636  };
1637  
1638  /* harmony default export */ var resolvers_cache_middleware = (createResolversCacheMiddleware);
1639  
1640  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/thunk-middleware.js
1641  function createThunkMiddleware(args) {
1642    return () => next => action => {
1643      if (typeof action === 'function') {
1644        return action(args);
1645      }
1646  
1647      return next(action);
1648    };
1649  }
1650  
1651  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/utils.js
1652  /**
1653   * External dependencies
1654   */
1655  
1656  /**
1657   * Higher-order reducer creator which creates a combined reducer object, keyed
1658   * by a property on the action object.
1659   *
1660   * @param  actionProperty Action property by which to key object.
1661   * @return Higher-order reducer.
1662   */
1663  const onSubKey = actionProperty => reducer => function () {
1664    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1665    let action = arguments.length > 1 ? arguments[1] : undefined;
1666    // Retrieve subkey from action. Do not track if undefined; useful for cases
1667    // where reducer is scoped by action shape.
1668    const key = action[actionProperty];
1669  
1670    if (key === undefined) {
1671      return state;
1672    } // Avoid updating state if unchanged. Note that this also accounts for a
1673    // reducer which returns undefined on a key which is not yet tracked.
1674  
1675  
1676    const nextKeyState = reducer(state[key], action);
1677  
1678    if (nextKeyState === state[key]) {
1679      return state;
1680    }
1681  
1682    return { ...state,
1683      [key]: nextKeyState
1684    };
1685  };
1686  /**
1687   * Normalize selector argument array by defaulting `undefined` value to an empty array
1688   * and removing trailing `undefined` values.
1689   *
1690   * @param  args Selector argument array
1691   * @return Normalized state key array
1692   */
1693  
1694  function selectorArgsToStateKey(args) {
1695    if (args === undefined || args === null) {
1696      return [];
1697    }
1698  
1699    const len = args.length;
1700    let idx = len;
1701  
1702    while (idx > 0 && args[idx - 1] === undefined) {
1703      idx--;
1704    }
1705  
1706    return idx === len ? args : args.slice(0, idx);
1707  }
1708  
1709  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/reducer.js
1710  /**
1711   * External dependencies
1712   */
1713  
1714  
1715  
1716  /**
1717   * Internal dependencies
1718   */
1719  
1720  
1721  /**
1722   * Reducer function returning next state for selector resolution of
1723   * subkeys, object form:
1724   *
1725   *  selectorName -> EquivalentKeyMap<Array,boolean>
1726   */
1727  const subKeysIsResolved = onSubKey('selectorName')(function () {
1728    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new (equivalent_key_map_default())();
1729    let action = arguments.length > 1 ? arguments[1] : undefined;
1730  
1731    switch (action.type) {
1732      case 'START_RESOLUTION':
1733        {
1734          const nextState = new (equivalent_key_map_default())(state);
1735          nextState.set(selectorArgsToStateKey(action.args), {
1736            status: 'resolving'
1737          });
1738          return nextState;
1739        }
1740  
1741      case 'FINISH_RESOLUTION':
1742        {
1743          const nextState = new (equivalent_key_map_default())(state);
1744          nextState.set(selectorArgsToStateKey(action.args), {
1745            status: 'finished'
1746          });
1747          return nextState;
1748        }
1749  
1750      case 'FAIL_RESOLUTION':
1751        {
1752          const nextState = new (equivalent_key_map_default())(state);
1753          nextState.set(selectorArgsToStateKey(action.args), {
1754            status: 'error',
1755            error: action.error
1756          });
1757          return nextState;
1758        }
1759  
1760      case 'START_RESOLUTIONS':
1761        {
1762          const nextState = new (equivalent_key_map_default())(state);
1763  
1764          for (const resolutionArgs of action.args) {
1765            nextState.set(selectorArgsToStateKey(resolutionArgs), {
1766              status: 'resolving'
1767            });
1768          }
1769  
1770          return nextState;
1771        }
1772  
1773      case 'FINISH_RESOLUTIONS':
1774        {
1775          const nextState = new (equivalent_key_map_default())(state);
1776  
1777          for (const resolutionArgs of action.args) {
1778            nextState.set(selectorArgsToStateKey(resolutionArgs), {
1779              status: 'finished'
1780            });
1781          }
1782  
1783          return nextState;
1784        }
1785  
1786      case 'FAIL_RESOLUTIONS':
1787        {
1788          const nextState = new (equivalent_key_map_default())(state);
1789          action.args.forEach((resolutionArgs, idx) => {
1790            const resolutionState = {
1791              status: 'error',
1792              error: undefined
1793            };
1794            const error = action.errors[idx];
1795  
1796            if (error) {
1797              resolutionState.error = error;
1798            }
1799  
1800            nextState.set(selectorArgsToStateKey(resolutionArgs), resolutionState);
1801          });
1802          return nextState;
1803        }
1804  
1805      case 'INVALIDATE_RESOLUTION':
1806        {
1807          const nextState = new (equivalent_key_map_default())(state);
1808          nextState.delete(selectorArgsToStateKey(action.args));
1809          return nextState;
1810        }
1811    }
1812  
1813    return state;
1814  });
1815  /**
1816   * Reducer function returning next state for selector resolution, object form:
1817   *
1818   *   selectorName -> EquivalentKeyMap<Array, boolean>
1819   *
1820   * @param  state  Current state.
1821   * @param  action Dispatched action.
1822   *
1823   * @return Next state.
1824   */
1825  
1826  const isResolved = function () {
1827    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1828    let action = arguments.length > 1 ? arguments[1] : undefined;
1829  
1830    switch (action.type) {
1831      case 'INVALIDATE_RESOLUTION_FOR_STORE':
1832        return {};
1833  
1834      case 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR':
1835        return (0,external_lodash_namespaceObject.has)(state, [action.selectorName]) ? (0,external_lodash_namespaceObject.omit)(state, [action.selectorName]) : state;
1836  
1837      case 'START_RESOLUTION':
1838      case 'FINISH_RESOLUTION':
1839      case 'FAIL_RESOLUTION':
1840      case 'START_RESOLUTIONS':
1841      case 'FINISH_RESOLUTIONS':
1842      case 'FAIL_RESOLUTIONS':
1843      case 'INVALIDATE_RESOLUTION':
1844        return subKeysIsResolved(state, action);
1845    }
1846  
1847    return state;
1848  };
1849  
1850  /* harmony default export */ var metadata_reducer = (isResolved);
1851  
1852  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
1853  /**
1854   * External dependencies
1855   */
1856  
1857  /**
1858   * Internal dependencies
1859   */
1860  
1861  
1862  /** @typedef {Record<string, import('./reducer').State>} State */
1863  
1864  /** @typedef {import('./reducer').StateValue} StateValue */
1865  
1866  /** @typedef {import('./reducer').Status} Status */
1867  
1868  /**
1869   * Returns the raw resolution state value for a given selector name,
1870   * and arguments set. May be undefined if the selector has never been resolved
1871   * or not resolved for the given set of arguments, otherwise true or false for
1872   * resolution started and completed respectively.
1873   *
1874   * @param {State}      state        Data state.
1875   * @param {string}     selectorName Selector name.
1876   * @param {unknown[]?} args         Arguments passed to selector.
1877   *
1878   * @return {StateValue|undefined} isResolving value.
1879   */
1880  
1881  function getResolutionState(state, selectorName, args) {
1882    const map = (0,external_lodash_namespaceObject.get)(state, [selectorName]);
1883  
1884    if (!map) {
1885      return;
1886    }
1887  
1888    return map.get(selectorArgsToStateKey(args));
1889  }
1890  /**
1891   * Returns the raw `isResolving` value for a given selector name,
1892   * and arguments set. May be undefined if the selector has never been resolved
1893   * or not resolved for the given set of arguments, otherwise true or false for
1894   * resolution started and completed respectively.
1895   *
1896   * @param {State}      state        Data state.
1897   * @param {string}     selectorName Selector name.
1898   * @param {unknown[]?} args         Arguments passed to selector.
1899   *
1900   * @return {boolean | undefined} isResolving value.
1901   */
1902  
1903  function getIsResolving(state, selectorName, args) {
1904    const resolutionState = getResolutionState(state, selectorName, args);
1905    return resolutionState && resolutionState.status === 'resolving';
1906  }
1907  /**
1908   * Returns true if resolution has already been triggered for a given
1909   * selector name, and arguments set.
1910   *
1911   * @param {State}      state        Data state.
1912   * @param {string}     selectorName Selector name.
1913   * @param {unknown[]?} args         Arguments passed to selector.
1914   *
1915   * @return {boolean} Whether resolution has been triggered.
1916   */
1917  
1918  function hasStartedResolution(state, selectorName, args) {
1919    return getResolutionState(state, selectorName, args) !== undefined;
1920  }
1921  /**
1922   * Returns true if resolution has completed for a given selector
1923   * name, and arguments set.
1924   *
1925   * @param {State}      state        Data state.
1926   * @param {string}     selectorName Selector name.
1927   * @param {unknown[]?} args         Arguments passed to selector.
1928   *
1929   * @return {boolean} Whether resolution has completed.
1930   */
1931  
1932  function hasFinishedResolution(state, selectorName, args) {
1933    var _getResolutionState;
1934  
1935    const status = (_getResolutionState = getResolutionState(state, selectorName, args)) === null || _getResolutionState === void 0 ? void 0 : _getResolutionState.status;
1936    return status === 'finished' || status === 'error';
1937  }
1938  /**
1939   * Returns true if resolution has failed for a given selector
1940   * name, and arguments set.
1941   *
1942   * @param {State}      state        Data state.
1943   * @param {string}     selectorName Selector name.
1944   * @param {unknown[]?} args         Arguments passed to selector.
1945   *
1946   * @return {boolean} Has resolution failed
1947   */
1948  
1949  function hasResolutionFailed(state, selectorName, args) {
1950    var _getResolutionState2;
1951  
1952    return ((_getResolutionState2 = getResolutionState(state, selectorName, args)) === null || _getResolutionState2 === void 0 ? void 0 : _getResolutionState2.status) === 'error';
1953  }
1954  /**
1955   * Returns the resolution error for a given selector name, and arguments set.
1956   * Note it may be of an Error type, but may also be null, undefined, or anything else
1957   * that can be `throw`-n.
1958   *
1959   * @param {State}      state        Data state.
1960   * @param {string}     selectorName Selector name.
1961   * @param {unknown[]?} args         Arguments passed to selector.
1962   *
1963   * @return {Error|unknown} Last resolution error
1964   */
1965  
1966  function getResolutionError(state, selectorName, args) {
1967    const resolutionState = getResolutionState(state, selectorName, args);
1968    return (resolutionState === null || resolutionState === void 0 ? void 0 : resolutionState.status) === 'error' ? resolutionState.error : null;
1969  }
1970  /**
1971   * Returns true if resolution has been triggered but has not yet completed for
1972   * a given selector name, and arguments set.
1973   *
1974   * @param {State}      state        Data state.
1975   * @param {string}     selectorName Selector name.
1976   * @param {unknown[]?} args         Arguments passed to selector.
1977   *
1978   * @return {boolean} Whether resolution is in progress.
1979   */
1980  
1981  function isResolving(state, selectorName, args) {
1982    var _getResolutionState3;
1983  
1984    return ((_getResolutionState3 = getResolutionState(state, selectorName, args)) === null || _getResolutionState3 === void 0 ? void 0 : _getResolutionState3.status) === 'resolving';
1985  }
1986  /**
1987   * Returns the list of the cached resolvers.
1988   *
1989   * @param {State} state Data state.
1990   *
1991   * @return {State} Resolvers mapped by args and selectorName.
1992   */
1993  
1994  function getCachedResolvers(state) {
1995    return state;
1996  }
1997  
1998  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
1999  /**
2000   * Returns an action object used in signalling that selector resolution has
2001   * started.
2002   *
2003   * @param {string}    selectorName Name of selector for which resolver triggered.
2004   * @param {unknown[]} args         Arguments to associate for uniqueness.
2005   *
2006   * @return {{ type: 'START_RESOLUTION', selectorName: string, args: unknown[] }} Action object.
2007   */
2008  function startResolution(selectorName, args) {
2009    return {
2010      type: 'START_RESOLUTION',
2011      selectorName,
2012      args
2013    };
2014  }
2015  /**
2016   * Returns an action object used in signalling that selector resolution has
2017   * completed.
2018   *
2019   * @param {string}    selectorName Name of selector for which resolver triggered.
2020   * @param {unknown[]} args         Arguments to associate for uniqueness.
2021   *
2022   * @return {{ type: 'FINISH_RESOLUTION', selectorName: string, args: unknown[] }} Action object.
2023   */
2024  
2025  function finishResolution(selectorName, args) {
2026    return {
2027      type: 'FINISH_RESOLUTION',
2028      selectorName,
2029      args
2030    };
2031  }
2032  /**
2033   * Returns an action object used in signalling that selector resolution has
2034   * failed.
2035   *
2036   * @param {string}        selectorName Name of selector for which resolver triggered.
2037   * @param {unknown[]}     args         Arguments to associate for uniqueness.
2038   * @param {Error|unknown} error        The error that caused the failure.
2039   *
2040   * @return {{ type: 'FAIL_RESOLUTION', selectorName: string, args: unknown[], error: Error|unknown }} Action object.
2041   */
2042  
2043  function failResolution(selectorName, args, error) {
2044    return {
2045      type: 'FAIL_RESOLUTION',
2046      selectorName,
2047      args,
2048      error
2049    };
2050  }
2051  /**
2052   * Returns an action object used in signalling that a batch of selector resolutions has
2053   * started.
2054   *
2055   * @param {string}      selectorName Name of selector for which resolver triggered.
2056   * @param {unknown[][]} args         Array of arguments to associate for uniqueness, each item
2057   *                                   is associated to a resolution.
2058   *
2059   * @return {{ type: 'START_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object.
2060   */
2061  
2062  function startResolutions(selectorName, args) {
2063    return {
2064      type: 'START_RESOLUTIONS',
2065      selectorName,
2066      args
2067    };
2068  }
2069  /**
2070   * Returns an action object used in signalling that a batch of selector resolutions has
2071   * completed.
2072   *
2073   * @param {string}      selectorName Name of selector for which resolver triggered.
2074   * @param {unknown[][]} args         Array of arguments to associate for uniqueness, each item
2075   *                                   is associated to a resolution.
2076   *
2077   * @return {{ type: 'FINISH_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object.
2078   */
2079  
2080  function finishResolutions(selectorName, args) {
2081    return {
2082      type: 'FINISH_RESOLUTIONS',
2083      selectorName,
2084      args
2085    };
2086  }
2087  /**
2088   * Returns an action object used in signalling that a batch of selector resolutions has
2089   * completed and at least one of them has failed.
2090   *
2091   * @param {string}            selectorName Name of selector for which resolver triggered.
2092   * @param {unknown[]}         args         Array of arguments to associate for uniqueness, each item
2093   *                                         is associated to a resolution.
2094   * @param {(Error|unknown)[]} errors       Array of errors to associate for uniqueness, each item
2095   *                                         is associated to a resolution.
2096   * @return {{ type: 'FAIL_RESOLUTIONS', selectorName: string, args: unknown[], errors: Array<Error|unknown> }} Action object.
2097   */
2098  
2099  function failResolutions(selectorName, args, errors) {
2100    return {
2101      type: 'FAIL_RESOLUTIONS',
2102      selectorName,
2103      args,
2104      errors
2105    };
2106  }
2107  /**
2108   * Returns an action object used in signalling that we should invalidate the resolution cache.
2109   *
2110   * @param {string}    selectorName Name of selector for which resolver should be invalidated.
2111   * @param {unknown[]} args         Arguments to associate for uniqueness.
2112   *
2113   * @return {{ type: 'INVALIDATE_RESOLUTION', selectorName: string, args: any[] }} Action object.
2114   */
2115  
2116  function invalidateResolution(selectorName, args) {
2117    return {
2118      type: 'INVALIDATE_RESOLUTION',
2119      selectorName,
2120      args
2121    };
2122  }
2123  /**
2124   * Returns an action object used in signalling that the resolution
2125   * should be invalidated.
2126   *
2127   * @return {{ type: 'INVALIDATE_RESOLUTION_FOR_STORE' }} Action object.
2128   */
2129  
2130  function invalidateResolutionForStore() {
2131    return {
2132      type: 'INVALIDATE_RESOLUTION_FOR_STORE'
2133    };
2134  }
2135  /**
2136   * Returns an action object used in signalling that the resolution cache for a
2137   * given selectorName should be invalidated.
2138   *
2139   * @param {string} selectorName Name of selector for which all resolvers should
2140   *                              be invalidated.
2141   *
2142   * @return  {{ type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR', selectorName: string }} Action object.
2143   */
2144  
2145  function invalidateResolutionForStoreSelector(selectorName) {
2146    return {
2147      type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR',
2148      selectorName
2149    };
2150  }
2151  
2152  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/index.js
2153  /**
2154   * External dependencies
2155   */
2156  
2157  
2158  
2159  
2160  /**
2161   * WordPress dependencies
2162   */
2163  
2164  
2165  /**
2166   * Internal dependencies
2167   */
2168  
2169  
2170  
2171  
2172  
2173  
2174  
2175  
2176  /** @typedef {import('../types').DataRegistry} DataRegistry */
2177  
2178  /** @typedef {import('../types').StoreDescriptor} StoreDescriptor */
2179  
2180  /** @typedef {import('../types').ReduxStoreConfig} ReduxStoreConfig */
2181  
2182  const trimUndefinedValues = array => {
2183    const result = [...array];
2184  
2185    for (let i = result.length - 1; i >= 0; i--) {
2186      if (result[i] === undefined) {
2187        result.splice(i, 1);
2188      }
2189    }
2190  
2191    return result;
2192  };
2193  /**
2194   * Create a cache to track whether resolvers started running or not.
2195   *
2196   * @return {Object} Resolvers Cache.
2197   */
2198  
2199  
2200  function createResolversCache() {
2201    const cache = {};
2202    return {
2203      isRunning(selectorName, args) {
2204        return cache[selectorName] && cache[selectorName].get(trimUndefinedValues(args));
2205      },
2206  
2207      clear(selectorName, args) {
2208        if (cache[selectorName]) {
2209          cache[selectorName].delete(trimUndefinedValues(args));
2210        }
2211      },
2212  
2213      markAsRunning(selectorName, args) {
2214        if (!cache[selectorName]) {
2215          cache[selectorName] = new (equivalent_key_map_default())();
2216        }
2217  
2218        cache[selectorName].set(trimUndefinedValues(args), true);
2219      }
2220  
2221    };
2222  }
2223  /**
2224   * Creates a data store descriptor for the provided Redux store configuration containing
2225   * properties describing reducer, actions, selectors, controls and resolvers.
2226   *
2227   * @example
2228   * ```js
2229   * import { createReduxStore } from '@wordpress/data';
2230   *
2231   * const store = createReduxStore( 'demo', {
2232   *     reducer: ( state = 'OK' ) => state,
2233   *     selectors: {
2234   *         getValue: ( state ) => state,
2235   *     },
2236   * } );
2237   * ```
2238   *
2239   * @param {string}           key     Unique namespace identifier.
2240   * @param {ReduxStoreConfig} options Registered store options, with properties
2241   *                                   describing reducer, actions, selectors,
2242   *                                   and resolvers.
2243   *
2244   * @return {StoreDescriptor} Store Object.
2245   */
2246  
2247  
2248  function createReduxStore(key, options) {
2249    return {
2250      name: key,
2251      instantiate: registry => {
2252        const reducer = options.reducer;
2253        const thunkArgs = {
2254          registry,
2255  
2256          get dispatch() {
2257            return Object.assign(action => store.dispatch(action), getActions());
2258          },
2259  
2260          get select() {
2261            return Object.assign(selector => selector(store.__unstableOriginalGetState()), getSelectors());
2262          },
2263  
2264          get resolveSelect() {
2265            return getResolveSelectors();
2266          }
2267  
2268        };
2269        const store = instantiateReduxStore(key, options, registry, thunkArgs);
2270        const resolversCache = createResolversCache();
2271        let resolvers;
2272        const actions = mapActions({ ...actions_namespaceObject,
2273          ...options.actions
2274        }, store);
2275        let selectors = mapSelectors({ ...(0,external_lodash_namespaceObject.mapValues)(selectors_namespaceObject, selector => function (state) {
2276            for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2277              args[_key - 1] = arguments[_key];
2278            }
2279  
2280            return selector(state.metadata, ...args);
2281          }),
2282          ...(0,external_lodash_namespaceObject.mapValues)(options.selectors, selector => {
2283            if (selector.isRegistrySelector) {
2284              selector.registry = registry;
2285            }
2286  
2287            return function (state) {
2288              for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2289                args[_key2 - 1] = arguments[_key2];
2290              }
2291  
2292              return selector(state.root, ...args);
2293            };
2294          })
2295        }, store);
2296  
2297        if (options.resolvers) {
2298          const result = mapResolvers(options.resolvers, selectors, store, resolversCache);
2299          resolvers = result.resolvers;
2300          selectors = result.selectors;
2301        }
2302  
2303        const resolveSelectors = mapResolveSelectors(selectors, store);
2304  
2305        const getSelectors = () => selectors;
2306  
2307        const getActions = () => actions;
2308  
2309        const getResolveSelectors = () => resolveSelectors; // We have some modules monkey-patching the store object
2310        // It's wrong to do so but until we refactor all of our effects to controls
2311        // We need to keep the same "store" instance here.
2312  
2313  
2314        store.__unstableOriginalGetState = store.getState;
2315  
2316        store.getState = () => store.__unstableOriginalGetState().root; // Customize subscribe behavior to call listeners only on effective change,
2317        // not on every dispatch.
2318  
2319  
2320        const subscribe = store && (listener => {
2321          let lastState = store.__unstableOriginalGetState();
2322  
2323          return store.subscribe(() => {
2324            const state = store.__unstableOriginalGetState();
2325  
2326            const hasChanged = state !== lastState;
2327            lastState = state;
2328  
2329            if (hasChanged) {
2330              listener();
2331            }
2332          });
2333        }); // This can be simplified to just { subscribe, getSelectors, getActions }
2334        // Once we remove the use function.
2335  
2336  
2337        return {
2338          reducer,
2339          store,
2340          actions,
2341          selectors,
2342          resolvers,
2343          getSelectors,
2344          getResolveSelectors,
2345          getActions,
2346          subscribe
2347        };
2348      }
2349    };
2350  }
2351  /**
2352   * Creates a redux store for a namespace.
2353   *
2354   * @param {string}       key       Unique namespace identifier.
2355   * @param {Object}       options   Registered store options, with properties
2356   *                                 describing reducer, actions, selectors,
2357   *                                 and resolvers.
2358   * @param {DataRegistry} registry  Registry reference.
2359   * @param {Object}       thunkArgs Argument object for the thunk middleware.
2360   * @return {Object} Newly created redux store.
2361   */
2362  
2363  function instantiateReduxStore(key, options, registry, thunkArgs) {
2364    const controls = { ...options.controls,
2365      ...builtinControls
2366    };
2367    const normalizedControls = (0,external_lodash_namespaceObject.mapValues)(controls, control => control.isRegistryControl ? control(registry) : control);
2368    const middlewares = [resolvers_cache_middleware(registry, key), promise_middleware, external_wp_reduxRoutine_default()(normalizedControls), createThunkMiddleware(thunkArgs)];
2369    const enhancers = [applyMiddleware(...middlewares)];
2370  
2371    if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
2372      enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({
2373        name: key,
2374        instanceId: key
2375      }));
2376    }
2377  
2378    const {
2379      reducer,
2380      initialState
2381    } = options;
2382    const enhancedReducer = turbo_combine_reducers_default()({
2383      metadata: metadata_reducer,
2384      root: reducer
2385    });
2386    return createStore(enhancedReducer, {
2387      root: initialState
2388    }, (0,external_lodash_namespaceObject.flowRight)(enhancers));
2389  }
2390  /**
2391   * Maps selectors to a store.
2392   *
2393   * @param {Object} selectors Selectors to register. Keys will be used as the
2394   *                           public facing API. Selectors will get passed the
2395   *                           state as first argument.
2396   * @param {Object} store     The store to which the selectors should be mapped.
2397   * @return {Object} Selectors mapped to the provided store.
2398   */
2399  
2400  
2401  function mapSelectors(selectors, store) {
2402    const createStateSelector = registrySelector => {
2403      const selector = function runSelector() {
2404        // This function is an optimized implementation of:
2405        //
2406        //   selector( store.getState(), ...arguments )
2407        //
2408        // Where the above would incur an `Array#concat` in its application,
2409        // the logic here instead efficiently constructs an arguments array via
2410        // direct assignment.
2411        const argsLength = arguments.length;
2412        const args = new Array(argsLength + 1);
2413        args[0] = store.__unstableOriginalGetState();
2414  
2415        for (let i = 0; i < argsLength; i++) {
2416          args[i + 1] = arguments[i];
2417        }
2418  
2419        return registrySelector(...args);
2420      };
2421  
2422      selector.hasResolver = false;
2423      return selector;
2424    };
2425  
2426    return (0,external_lodash_namespaceObject.mapValues)(selectors, createStateSelector);
2427  }
2428  /**
2429   * Maps actions to dispatch from a given store.
2430   *
2431   * @param {Object} actions Actions to register.
2432   * @param {Object} store   The redux store to which the actions should be mapped.
2433   *
2434   * @return {Object} Actions mapped to the redux store provided.
2435   */
2436  
2437  
2438  function mapActions(actions, store) {
2439    const createBoundAction = action => function () {
2440      return Promise.resolve(store.dispatch(action(...arguments)));
2441    };
2442  
2443    return (0,external_lodash_namespaceObject.mapValues)(actions, createBoundAction);
2444  }
2445  /**
2446   * Maps selectors to functions that return a resolution promise for them
2447   *
2448   * @param {Object} selectors Selectors to map.
2449   * @param {Object} store     The redux store the selectors select from.
2450   *
2451   * @return {Object} Selectors mapped to their resolution functions.
2452   */
2453  
2454  
2455  function mapResolveSelectors(selectors, store) {
2456    const storeSelectors = (0,external_lodash_namespaceObject.omit)(selectors, ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'hasResolutionFailed', 'isResolving', 'getCachedResolvers', 'getResolutionState', 'getResolutionError']);
2457    return (0,external_lodash_namespaceObject.mapValues)(storeSelectors, (selector, selectorName) => {
2458      // If the selector doesn't have a resolver, just convert the return value
2459      // (including exceptions) to a Promise, no additional extra behavior is needed.
2460      if (!selector.hasResolver) {
2461        return async function () {
2462          for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2463            args[_key3] = arguments[_key3];
2464          }
2465  
2466          return selector.apply(null, args);
2467        };
2468      }
2469  
2470      return function () {
2471        for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2472          args[_key4] = arguments[_key4];
2473        }
2474  
2475        return new Promise((resolve, reject) => {
2476          const hasFinished = () => selectors.hasFinishedResolution(selectorName, args);
2477  
2478          const finalize = result => {
2479            const hasFailed = selectors.hasResolutionFailed(selectorName, args);
2480  
2481            if (hasFailed) {
2482              const error = selectors.getResolutionError(selectorName, args);
2483              reject(error);
2484            } else {
2485              resolve(result);
2486            }
2487          };
2488  
2489          const getResult = () => selector.apply(null, args); // Trigger the selector (to trigger the resolver)
2490  
2491  
2492          const result = getResult();
2493  
2494          if (hasFinished()) {
2495            return finalize(result);
2496          }
2497  
2498          const unsubscribe = store.subscribe(() => {
2499            if (hasFinished()) {
2500              unsubscribe();
2501              finalize(getResult());
2502            }
2503          });
2504        });
2505      };
2506    });
2507  }
2508  /**
2509   * Returns resolvers with matched selectors for a given namespace.
2510   * Resolvers are side effects invoked once per argument set of a given selector call,
2511   * used in ensuring that the data needs for the selector are satisfied.
2512   *
2513   * @param {Object} resolvers      Resolvers to register.
2514   * @param {Object} selectors      The current selectors to be modified.
2515   * @param {Object} store          The redux store to which the resolvers should be mapped.
2516   * @param {Object} resolversCache Resolvers Cache.
2517   */
2518  
2519  
2520  function mapResolvers(resolvers, selectors, store, resolversCache) {
2521    // The `resolver` can be either a function that does the resolution, or, in more advanced
2522    // cases, an object with a `fullfill` method and other optional methods like `isFulfilled`.
2523    // Here we normalize the `resolver` function to an object with `fulfill` method.
2524    const mappedResolvers = (0,external_lodash_namespaceObject.mapValues)(resolvers, resolver => {
2525      if (resolver.fulfill) {
2526        return resolver;
2527      }
2528  
2529      return { ...resolver,
2530        // Copy the enumerable properties of the resolver function.
2531        fulfill: resolver // Add the fulfill method.
2532  
2533      };
2534    });
2535  
2536    const mapSelector = (selector, selectorName) => {
2537      const resolver = resolvers[selectorName];
2538  
2539      if (!resolver) {
2540        selector.hasResolver = false;
2541        return selector;
2542      }
2543  
2544      const selectorResolver = function () {
2545        for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
2546          args[_key5] = arguments[_key5];
2547        }
2548  
2549        async function fulfillSelector() {
2550          const state = store.getState();
2551  
2552          if (resolversCache.isRunning(selectorName, args) || typeof resolver.isFulfilled === 'function' && resolver.isFulfilled(state, ...args)) {
2553            return;
2554          }
2555  
2556          const {
2557            metadata
2558          } = store.__unstableOriginalGetState();
2559  
2560          if (hasStartedResolution(metadata, selectorName, args)) {
2561            return;
2562          }
2563  
2564          resolversCache.markAsRunning(selectorName, args);
2565          setTimeout(async () => {
2566            resolversCache.clear(selectorName, args);
2567            store.dispatch(startResolution(selectorName, args));
2568  
2569            try {
2570              await fulfillResolver(store, mappedResolvers, selectorName, ...args);
2571              store.dispatch(finishResolution(selectorName, args));
2572            } catch (error) {
2573              store.dispatch(failResolution(selectorName, args, error));
2574            }
2575          });
2576        }
2577  
2578        fulfillSelector(...args);
2579        return selector(...args);
2580      };
2581  
2582      selectorResolver.hasResolver = true;
2583      return selectorResolver;
2584    };
2585  
2586    return {
2587      resolvers: mappedResolvers,
2588      selectors: (0,external_lodash_namespaceObject.mapValues)(selectors, mapSelector)
2589    };
2590  }
2591  /**
2592   * Calls a resolver given arguments
2593   *
2594   * @param {Object} store        Store reference, for fulfilling via resolvers
2595   * @param {Object} resolvers    Store Resolvers
2596   * @param {string} selectorName Selector name to fulfill.
2597   * @param {Array}  args         Selector Arguments.
2598   */
2599  
2600  
2601  async function fulfillResolver(store, resolvers, selectorName) {
2602    const resolver = (0,external_lodash_namespaceObject.get)(resolvers, [selectorName]);
2603  
2604    if (!resolver) {
2605      return;
2606    }
2607  
2608    for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
2609      args[_key6 - 3] = arguments[_key6];
2610    }
2611  
2612    const action = resolver.fulfill(...args);
2613  
2614    if (action) {
2615      await store.dispatch(action);
2616    }
2617  }
2618  
2619  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/utils/emitter.js
2620  /**
2621   * Create an event emitter.
2622   *
2623   * @return {import("../types").DataEmitter} Emitter.
2624   */
2625  function createEmitter() {
2626    let isPaused = false;
2627    let isPending = false;
2628    const listeners = new Set();
2629  
2630    const notifyListeners = () => // We use Array.from to clone the listeners Set
2631    // This ensures that we don't run a listener
2632    // that was added as a response to another listener.
2633    Array.from(listeners).forEach(listener => listener());
2634  
2635    return {
2636      get isPaused() {
2637        return isPaused;
2638      },
2639  
2640      subscribe(listener) {
2641        listeners.add(listener);
2642        return () => listeners.delete(listener);
2643      },
2644  
2645      pause() {
2646        isPaused = true;
2647      },
2648  
2649      resume() {
2650        isPaused = false;
2651  
2652        if (isPending) {
2653          isPending = false;
2654          notifyListeners();
2655        }
2656      },
2657  
2658      emit() {
2659        if (isPaused) {
2660          isPending = true;
2661          return;
2662        }
2663  
2664        notifyListeners();
2665      }
2666  
2667    };
2668  }
2669  
2670  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/registry.js
2671  /**
2672   * External dependencies
2673   */
2674  
2675  /**
2676   * WordPress dependencies
2677   */
2678  
2679  
2680  /**
2681   * Internal dependencies
2682   */
2683  
2684  
2685  
2686  
2687  /** @typedef {import('./types').StoreDescriptor} StoreDescriptor */
2688  
2689  /**
2690   * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations.
2691   *
2692   * @property {Function} registerGenericStore Given a namespace key and settings
2693   *                                           object, registers a new generic
2694   *                                           store.
2695   * @property {Function} registerStore        Given a namespace key and settings
2696   *                                           object, registers a new namespace
2697   *                                           store.
2698   * @property {Function} subscribe            Given a function callback, invokes
2699   *                                           the callback on any change to state
2700   *                                           within any registered store.
2701   * @property {Function} select               Given a namespace key, returns an
2702   *                                           object of the  store's registered
2703   *                                           selectors.
2704   * @property {Function} dispatch             Given a namespace key, returns an
2705   *                                           object of the store's registered
2706   *                                           action dispatchers.
2707   */
2708  
2709  /**
2710   * @typedef {Object} WPDataPlugin An object of registry function overrides.
2711   *
2712   * @property {Function} registerStore registers store.
2713   */
2714  
2715  /**
2716   * Creates a new store registry, given an optional object of initial store
2717   * configurations.
2718   *
2719   * @param {Object}  storeConfigs Initial store configurations.
2720   * @param {Object?} parent       Parent registry.
2721   *
2722   * @return {WPDataRegistry} Data registry.
2723   */
2724  
2725  function createRegistry() {
2726    let storeConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2727    let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2728    const stores = {};
2729    const emitter = createEmitter();
2730    const listeningStores = new Set();
2731    /**
2732     * Global listener called for each store's update.
2733     */
2734  
2735    function globalListener() {
2736      emitter.emit();
2737    }
2738    /**
2739     * Subscribe to changes to any data.
2740     *
2741     * @param {Function} listener Listener function.
2742     *
2743     * @return {Function} Unsubscribe function.
2744     */
2745  
2746  
2747    const subscribe = listener => {
2748      return emitter.subscribe(listener);
2749    };
2750    /**
2751     * Calls a selector given the current state and extra arguments.
2752     *
2753     * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
2754     *                                                       or the store descriptor.
2755     *
2756     * @return {*} The selector's returned value.
2757     */
2758  
2759  
2760    function select(storeNameOrDescriptor) {
2761      const storeName = (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor;
2762      listeningStores.add(storeName);
2763      const store = stores[storeName];
2764  
2765      if (store) {
2766        return store.getSelectors();
2767      }
2768  
2769      return parent && parent.select(storeName);
2770    }
2771  
2772    function __unstableMarkListeningStores(callback, ref) {
2773      listeningStores.clear();
2774      const result = callback.call(this);
2775      ref.current = Array.from(listeningStores);
2776      return result;
2777    }
2778    /**
2779     * Given the name of a registered store, returns an object containing the store's
2780     * selectors pre-bound to state so that you only need to supply additional arguments,
2781     * and modified so that they return promises that resolve to their eventual values,
2782     * after any resolvers have ran.
2783     *
2784     * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
2785     *                                                       or the store descriptor.
2786     *
2787     * @return {Object} Each key of the object matches the name of a selector.
2788     */
2789  
2790  
2791    function resolveSelect(storeNameOrDescriptor) {
2792      const storeName = (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor;
2793      listeningStores.add(storeName);
2794      const store = stores[storeName];
2795  
2796      if (store) {
2797        return store.getResolveSelectors();
2798      }
2799  
2800      return parent && parent.resolveSelect(storeName);
2801    }
2802    /**
2803     * Returns the available actions for a part of the state.
2804     *
2805     * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
2806     *                                                       or the store descriptor.
2807     *
2808     * @return {*} The action's returned value.
2809     */
2810  
2811  
2812    function dispatch(storeNameOrDescriptor) {
2813      const storeName = (0,external_lodash_namespaceObject.isObject)(storeNameOrDescriptor) ? storeNameOrDescriptor.name : storeNameOrDescriptor;
2814      const store = stores[storeName];
2815  
2816      if (store) {
2817        return store.getActions();
2818      }
2819  
2820      return parent && parent.dispatch(storeName);
2821    } //
2822    // Deprecated
2823    // TODO: Remove this after `use()` is removed.
2824  
2825  
2826    function withPlugins(attributes) {
2827      return (0,external_lodash_namespaceObject.mapValues)(attributes, (attribute, key) => {
2828        if (typeof attribute !== 'function') {
2829          return attribute;
2830        }
2831  
2832        return function () {
2833          return registry[key].apply(null, arguments);
2834        };
2835      });
2836    }
2837    /**
2838     * Registers a store instance.
2839     *
2840     * @param {string} name  Store registry name.
2841     * @param {Object} store Store instance object (getSelectors, getActions, subscribe).
2842     */
2843  
2844  
2845    function registerStoreInstance(name, store) {
2846      if (typeof store.getSelectors !== 'function') {
2847        throw new TypeError('store.getSelectors must be a function');
2848      }
2849  
2850      if (typeof store.getActions !== 'function') {
2851        throw new TypeError('store.getActions must be a function');
2852      }
2853  
2854      if (typeof store.subscribe !== 'function') {
2855        throw new TypeError('store.subscribe must be a function');
2856      } // The emitter is used to keep track of active listeners when the registry
2857      // get paused, that way, when resumed we should be able to call all these
2858      // pending listeners.
2859  
2860  
2861      store.emitter = createEmitter();
2862      const currentSubscribe = store.subscribe;
2863  
2864      store.subscribe = listener => {
2865        const unsubscribeFromEmitter = store.emitter.subscribe(listener);
2866        const unsubscribeFromStore = currentSubscribe(() => {
2867          if (store.emitter.isPaused) {
2868            store.emitter.emit();
2869            return;
2870          }
2871  
2872          listener();
2873        });
2874        return () => {
2875          unsubscribeFromStore === null || unsubscribeFromStore === void 0 ? void 0 : unsubscribeFromStore();
2876          unsubscribeFromEmitter === null || unsubscribeFromEmitter === void 0 ? void 0 : unsubscribeFromEmitter();
2877        };
2878      };
2879  
2880      stores[name] = store;
2881      store.subscribe(globalListener);
2882    }
2883    /**
2884     * Registers a new store given a store descriptor.
2885     *
2886     * @param {StoreDescriptor} store Store descriptor.
2887     */
2888  
2889  
2890    function register(store) {
2891      registerStoreInstance(store.name, store.instantiate(registry));
2892    }
2893  
2894    function registerGenericStore(name, store) {
2895      external_wp_deprecated_default()('wp.data.registerGenericStore', {
2896        since: '5.9',
2897        alternative: 'wp.data.register( storeDescriptor )'
2898      });
2899      registerStoreInstance(name, store);
2900    }
2901    /**
2902     * Registers a standard `@wordpress/data` store.
2903     *
2904     * @param {string} storeName Unique namespace identifier.
2905     * @param {Object} options   Store description (reducer, actions, selectors, resolvers).
2906     *
2907     * @return {Object} Registered store object.
2908     */
2909  
2910  
2911    function registerStore(storeName, options) {
2912      if (!options.reducer) {
2913        throw new TypeError('Must specify store reducer');
2914      }
2915  
2916      const store = createReduxStore(storeName, options).instantiate(registry);
2917      registerStoreInstance(storeName, store);
2918      return store.store;
2919    }
2920    /**
2921     * Subscribe handler to a store.
2922     *
2923     * @param {string[]} storeName The store name.
2924     * @param {Function} handler   The function subscribed to the store.
2925     * @return {Function} A function to unsubscribe the handler.
2926     */
2927  
2928  
2929    function __unstableSubscribeStore(storeName, handler) {
2930      if (storeName in stores) {
2931        return stores[storeName].subscribe(handler);
2932      } // Trying to access a store that hasn't been registered,
2933      // this is a pattern rarely used but seen in some places.
2934      // We fallback to regular `subscribe` here for backward-compatibility for now.
2935      // See https://github.com/WordPress/gutenberg/pull/27466 for more info.
2936  
2937  
2938      if (!parent) {
2939        return subscribe(handler);
2940      }
2941  
2942      return parent.__unstableSubscribeStore(storeName, handler);
2943    }
2944  
2945    function batch(callback) {
2946      emitter.pause();
2947      (0,external_lodash_namespaceObject.forEach)(stores, store => store.emitter.pause());
2948      callback();
2949      emitter.resume();
2950      (0,external_lodash_namespaceObject.forEach)(stores, store => store.emitter.resume());
2951    }
2952  
2953    let registry = {
2954      batch,
2955      stores,
2956      namespaces: stores,
2957      // TODO: Deprecate/remove this.
2958      subscribe,
2959      select,
2960      resolveSelect,
2961      dispatch,
2962      use,
2963      register,
2964      registerGenericStore,
2965      registerStore,
2966      __unstableMarkListeningStores,
2967      __unstableSubscribeStore
2968    }; //
2969    // TODO:
2970    // This function will be deprecated as soon as it is no longer internally referenced.
2971  
2972    function use(plugin, options) {
2973      if (!plugin) {
2974        return;
2975      }
2976  
2977      registry = { ...registry,
2978        ...plugin(registry, options)
2979      };
2980      return registry;
2981    }
2982  
2983    registry.register(store);
2984  
2985    for (const [name, config] of Object.entries(storeConfigs)) {
2986      registry.register(createReduxStore(name, config));
2987    }
2988  
2989    if (parent) {
2990      parent.subscribe(globalListener);
2991    }
2992  
2993    return withPlugins(registry);
2994  }
2995  
2996  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/default-registry.js
2997  /**
2998   * Internal dependencies
2999   */
3000  
3001  /* harmony default export */ var default_registry = (createRegistry());
3002  
3003  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/object.js
3004  let objectStorage;
3005  const storage = {
3006    getItem(key) {
3007      if (!objectStorage || !objectStorage[key]) {
3008        return null;
3009      }
3010  
3011      return objectStorage[key];
3012    },
3013  
3014    setItem(key, value) {
3015      if (!objectStorage) {
3016        storage.clear();
3017      }
3018  
3019      objectStorage[key] = String(value);
3020    },
3021  
3022    clear() {
3023      objectStorage = Object.create(null);
3024    }
3025  
3026  };
3027  /* harmony default export */ var object = (storage);
3028  
3029  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/default.js
3030  /**
3031   * Internal dependencies
3032   */
3033  
3034  let default_storage;
3035  
3036  try {
3037    // Private Browsing in Safari 10 and earlier will throw an error when
3038    // attempting to set into localStorage. The test here is intentional in
3039    // causing a thrown error as condition for using fallback object storage.
3040    default_storage = window.localStorage;
3041    default_storage.setItem('__wpDataTestLocalStorage', '');
3042    default_storage.removeItem('__wpDataTestLocalStorage');
3043  } catch (error) {
3044    default_storage = object;
3045  }
3046  
3047  /* harmony default export */ var storage_default = (default_storage);
3048  
3049  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/index.js
3050  /**
3051   * External dependencies
3052   */
3053  
3054  /**
3055   * Internal dependencies
3056   */
3057  
3058  
3059  
3060  /** @typedef {import('../../registry').WPDataRegistry} WPDataRegistry */
3061  
3062  /** @typedef {import('../../registry').WPDataPlugin} WPDataPlugin */
3063  
3064  /**
3065   * @typedef {Object} WPDataPersistencePluginOptions Persistence plugin options.
3066   *
3067   * @property {Storage} storage    Persistent storage implementation. This must
3068   *                                at least implement `getItem` and `setItem` of
3069   *                                the Web Storage API.
3070   * @property {string}  storageKey Key on which to set in persistent storage.
3071   *
3072   */
3073  
3074  /**
3075   * Default plugin storage.
3076   *
3077   * @type {Storage}
3078   */
3079  
3080  const DEFAULT_STORAGE = storage_default;
3081  /**
3082   * Default plugin storage key.
3083   *
3084   * @type {string}
3085   */
3086  
3087  const DEFAULT_STORAGE_KEY = 'WP_DATA';
3088  /**
3089   * Higher-order reducer which invokes the original reducer only if state is
3090   * inequal from that of the action's `nextState` property, otherwise returning
3091   * the original state reference.
3092   *
3093   * @param {Function} reducer Original reducer.
3094   *
3095   * @return {Function} Enhanced reducer.
3096   */
3097  
3098  const withLazySameState = reducer => (state, action) => {
3099    if (action.nextState === state) {
3100      return state;
3101    }
3102  
3103    return reducer(state, action);
3104  };
3105  /**
3106   * Creates a persistence interface, exposing getter and setter methods (`get`
3107   * and `set` respectively).
3108   *
3109   * @param {WPDataPersistencePluginOptions} options Plugin options.
3110   *
3111   * @return {Object} Persistence interface.
3112   */
3113  
3114  function createPersistenceInterface(options) {
3115    const {
3116      storage = DEFAULT_STORAGE,
3117      storageKey = DEFAULT_STORAGE_KEY
3118    } = options;
3119    let data;
3120    /**
3121     * Returns the persisted data as an object, defaulting to an empty object.
3122     *
3123     * @return {Object} Persisted data.
3124     */
3125  
3126    function getData() {
3127      if (data === undefined) {
3128        // If unset, getItem is expected to return null. Fall back to
3129        // empty object.
3130        const persisted = storage.getItem(storageKey);
3131  
3132        if (persisted === null) {
3133          data = {};
3134        } else {
3135          try {
3136            data = JSON.parse(persisted);
3137          } catch (error) {
3138            // Similarly, should any error be thrown during parse of
3139            // the string (malformed JSON), fall back to empty object.
3140            data = {};
3141          }
3142        }
3143      }
3144  
3145      return data;
3146    }
3147    /**
3148     * Merges an updated reducer state into the persisted data.
3149     *
3150     * @param {string} key   Key to update.
3151     * @param {*}      value Updated value.
3152     */
3153  
3154  
3155    function setData(key, value) {
3156      data = { ...data,
3157        [key]: value
3158      };
3159      storage.setItem(storageKey, JSON.stringify(data));
3160    }
3161  
3162    return {
3163      get: getData,
3164      set: setData
3165    };
3166  }
3167  /**
3168   * Data plugin to persist store state into a single storage key.
3169   *
3170   * @param {WPDataRegistry}                  registry      Data registry.
3171   * @param {?WPDataPersistencePluginOptions} pluginOptions Plugin options.
3172   *
3173   * @return {WPDataPlugin} Data plugin.
3174   */
3175  
3176  function persistencePlugin(registry, pluginOptions) {
3177    const persistence = createPersistenceInterface(pluginOptions);
3178    /**
3179     * Creates an enhanced store dispatch function, triggering the state of the
3180     * given store name to be persisted when changed.
3181     *
3182     * @param {Function}       getState  Function which returns current state.
3183     * @param {string}         storeName Store name.
3184     * @param {?Array<string>} keys      Optional subset of keys to save.
3185     *
3186     * @return {Function} Enhanced dispatch function.
3187     */
3188  
3189    function createPersistOnChange(getState, storeName, keys) {
3190      let getPersistedState;
3191  
3192      if (Array.isArray(keys)) {
3193        // Given keys, the persisted state should by produced as an object
3194        // of the subset of keys. This implementation uses combineReducers
3195        // to leverage its behavior of returning the same object when none
3196        // of the property values changes. This allows a strict reference
3197        // equality to bypass a persistence set on an unchanging state.
3198        const reducers = keys.reduce((accumulator, key) => Object.assign(accumulator, {
3199          [key]: (state, action) => action.nextState[key]
3200        }), {});
3201        getPersistedState = withLazySameState(turbo_combine_reducers_default()(reducers));
3202      } else {
3203        getPersistedState = (state, action) => action.nextState;
3204      }
3205  
3206      let lastState = getPersistedState(undefined, {
3207        nextState: getState()
3208      });
3209      return () => {
3210        const state = getPersistedState(lastState, {
3211          nextState: getState()
3212        });
3213  
3214        if (state !== lastState) {
3215          persistence.set(storeName, state);
3216          lastState = state;
3217        }
3218      };
3219    }
3220  
3221    return {
3222      registerStore(storeName, options) {
3223        if (!options.persist) {
3224          return registry.registerStore(storeName, options);
3225        } // Load from persistence to use as initial state.
3226  
3227  
3228        const persistedState = persistence.get()[storeName];
3229  
3230        if (persistedState !== undefined) {
3231          let initialState = options.reducer(options.initialState, {
3232            type: '@@WP/PERSISTENCE_RESTORE'
3233          });
3234  
3235          if ((0,external_lodash_namespaceObject.isPlainObject)(initialState) && (0,external_lodash_namespaceObject.isPlainObject)(persistedState)) {
3236            // If state is an object, ensure that:
3237            // - Other keys are left intact when persisting only a
3238            //   subset of keys.
3239            // - New keys in what would otherwise be used as initial
3240            //   state are deeply merged as base for persisted value.
3241            initialState = (0,external_lodash_namespaceObject.merge)({}, initialState, persistedState);
3242          } else {
3243            // If there is a mismatch in object-likeness of default
3244            // initial or persisted state, defer to persisted value.
3245            initialState = persistedState;
3246          }
3247  
3248          options = { ...options,
3249            initialState
3250          };
3251        }
3252  
3253        const store = registry.registerStore(storeName, options);
3254        store.subscribe(createPersistOnChange(store.getState, storeName, options.persist));
3255        return store;
3256      }
3257  
3258    };
3259  }
3260  /**
3261   * Move the 'features' object in local storage from the sourceStoreName to the
3262   * preferences store.
3263   *
3264   * @param {Object} persistence     The persistence interface.
3265   * @param {string} sourceStoreName The name of the store that has persisted
3266   *                                 preferences to migrate to the preferences
3267   *                                 package.
3268   */
3269  
3270  
3271  function migrateFeaturePreferencesToPreferencesStore(persistence, sourceStoreName) {
3272    var _state$interfaceStore, _state$interfaceStore2, _state$interfaceStore3, _state$sourceStoreNam, _state$sourceStoreNam2;
3273  
3274    const preferencesStoreName = 'core/preferences';
3275    const interfaceStoreName = 'core/interface';
3276    const state = persistence.get(); // Features most recently (and briefly) lived in the interface package.
3277    // If data exists there, prioritize using that for the migration. If not
3278    // also check the original package as the user may have updated from an
3279    // older block editor version.
3280  
3281    const interfaceFeatures = (_state$interfaceStore = state[interfaceStoreName]) === null || _state$interfaceStore === void 0 ? void 0 : (_state$interfaceStore2 = _state$interfaceStore.preferences) === null || _state$interfaceStore2 === void 0 ? void 0 : (_state$interfaceStore3 = _state$interfaceStore2.features) === null || _state$interfaceStore3 === void 0 ? void 0 : _state$interfaceStore3[sourceStoreName];
3282    const sourceFeatures = (_state$sourceStoreNam = state[sourceStoreName]) === null || _state$sourceStoreNam === void 0 ? void 0 : (_state$sourceStoreNam2 = _state$sourceStoreNam.preferences) === null || _state$sourceStoreNam2 === void 0 ? void 0 : _state$sourceStoreNam2.features;
3283    const featuresToMigrate = interfaceFeatures ? interfaceFeatures : sourceFeatures;
3284  
3285    if (featuresToMigrate) {
3286      var _state$preferencesSto;
3287  
3288      const existingPreferences = (_state$preferencesSto = state[preferencesStoreName]) === null || _state$preferencesSto === void 0 ? void 0 : _state$preferencesSto.preferences; // Avoid migrating features again if they've previously been migrated.
3289  
3290      if (!(existingPreferences !== null && existingPreferences !== void 0 && existingPreferences[sourceStoreName])) {
3291        // Set the feature values in the interface store, the features
3292        // object is keyed by 'scope', which matches the store name for
3293        // the source.
3294        persistence.set(preferencesStoreName, {
3295          preferences: { ...existingPreferences,
3296            [sourceStoreName]: featuresToMigrate
3297          }
3298        }); // Remove migrated feature preferences from `interface`.
3299  
3300        if (interfaceFeatures) {
3301          var _state$interfaceStore4, _state$interfaceStore5;
3302  
3303          const otherInterfaceState = state[interfaceStoreName];
3304          const otherInterfaceScopes = (_state$interfaceStore4 = state[interfaceStoreName]) === null || _state$interfaceStore4 === void 0 ? void 0 : (_state$interfaceStore5 = _state$interfaceStore4.preferences) === null || _state$interfaceStore5 === void 0 ? void 0 : _state$interfaceStore5.features;
3305          persistence.set(interfaceStoreName, { ...otherInterfaceState,
3306            preferences: {
3307              features: { ...otherInterfaceScopes,
3308                [sourceStoreName]: undefined
3309              }
3310            }
3311          });
3312        } // Remove migrated feature preferences from the source.
3313  
3314  
3315        if (sourceFeatures) {
3316          var _state$sourceStoreNam3;
3317  
3318          const otherSourceState = state[sourceStoreName];
3319          const sourcePreferences = (_state$sourceStoreNam3 = state[sourceStoreName]) === null || _state$sourceStoreNam3 === void 0 ? void 0 : _state$sourceStoreNam3.preferences;
3320          persistence.set(sourceStoreName, { ...otherSourceState,
3321            preferences: { ...sourcePreferences,
3322              features: undefined
3323            }
3324          });
3325        }
3326      }
3327    }
3328  }
3329  /**
3330   * Migrates an individual item inside the `preferences` object for a store.
3331   *
3332   * @param {Object}    persistence   The persistence interface.
3333   * @param {Object}    migrate       An options object that contains details of the migration.
3334   * @param {string}    migrate.from  The name of the store to migrate from.
3335   * @param {string}    migrate.scope The scope in the preferences store to migrate to.
3336   * @param {string}    key           The key in the preferences object to migrate.
3337   * @param {?Function} convert       A function that converts preferences from one format to another.
3338   */
3339  
3340  function migrateIndividualPreferenceToPreferencesStore(persistence, _ref, key) {
3341    var _state$sourceStoreNam4, _state$sourceStoreNam5, _state$preferencesSto2, _state$preferencesSto3, _state$preferencesSto4, _state$preferencesSto5, _state$preferencesSto6, _state$preferencesSto7, _state$sourceStoreNam6;
3342  
3343    let {
3344      from: sourceStoreName,
3345      scope
3346    } = _ref;
3347    let convert = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : external_lodash_namespaceObject.identity;
3348    const preferencesStoreName = 'core/preferences';
3349    const state = persistence.get();
3350    const sourcePreference = (_state$sourceStoreNam4 = state[sourceStoreName]) === null || _state$sourceStoreNam4 === void 0 ? void 0 : (_state$sourceStoreNam5 = _state$sourceStoreNam4.preferences) === null || _state$sourceStoreNam5 === void 0 ? void 0 : _state$sourceStoreNam5[key]; // There's nothing to migrate, exit early.
3351  
3352    if (sourcePreference === undefined) {
3353      return;
3354    }
3355  
3356    const targetPreference = (_state$preferencesSto2 = state[preferencesStoreName]) === null || _state$preferencesSto2 === void 0 ? void 0 : (_state$preferencesSto3 = _state$preferencesSto2.preferences) === null || _state$preferencesSto3 === void 0 ? void 0 : (_state$preferencesSto4 = _state$preferencesSto3[scope]) === null || _state$preferencesSto4 === void 0 ? void 0 : _state$preferencesSto4[key]; // There's existing data at the target, so don't overwrite it, exit early.
3357  
3358    if (targetPreference) {
3359      return;
3360    }
3361  
3362    const otherScopes = (_state$preferencesSto5 = state[preferencesStoreName]) === null || _state$preferencesSto5 === void 0 ? void 0 : _state$preferencesSto5.preferences;
3363    const otherPreferences = (_state$preferencesSto6 = state[preferencesStoreName]) === null || _state$preferencesSto6 === void 0 ? void 0 : (_state$preferencesSto7 = _state$preferencesSto6.preferences) === null || _state$preferencesSto7 === void 0 ? void 0 : _state$preferencesSto7[scope]; // Pass an object with the key and value as this allows the convert
3364    // function to convert to a data structure that has different keys.
3365  
3366    const convertedPreferences = convert({
3367      [key]: sourcePreference
3368    });
3369    persistence.set(preferencesStoreName, {
3370      preferences: { ...otherScopes,
3371        [scope]: { ...otherPreferences,
3372          ...convertedPreferences
3373        }
3374      }
3375    }); // Remove migrated feature preferences from the source.
3376  
3377    const otherSourceState = state[sourceStoreName];
3378    const allSourcePreferences = (_state$sourceStoreNam6 = state[sourceStoreName]) === null || _state$sourceStoreNam6 === void 0 ? void 0 : _state$sourceStoreNam6.preferences;
3379    persistence.set(sourceStoreName, { ...otherSourceState,
3380      preferences: { ...allSourcePreferences,
3381        [key]: undefined
3382      }
3383    });
3384  }
3385  /**
3386   * Convert from:
3387   * ```
3388   * {
3389   *     panels: {
3390   *         tags: {
3391   *             enabled: true,
3392   *             opened: true,
3393   *         },
3394   *         permalinks: {
3395   *             enabled: false,
3396   *             opened: false,
3397   *         },
3398   *     },
3399   * }
3400   * ```
3401   *
3402   * to:
3403   * {
3404   *     inactivePanels: [
3405   *         'permalinks',
3406   *     ],
3407   *     openPanels: [
3408   *         'tags',
3409   *     ],
3410   * }
3411   *
3412   * @param {Object} preferences A preferences object.
3413   *
3414   * @return {Object} The converted data.
3415   */
3416  
3417  function convertEditPostPanels(preferences) {
3418    var _preferences$panels;
3419  
3420    const panels = (_preferences$panels = preferences === null || preferences === void 0 ? void 0 : preferences.panels) !== null && _preferences$panels !== void 0 ? _preferences$panels : {};
3421    return Object.keys(panels).reduce((convertedData, panelName) => {
3422      const panel = panels[panelName];
3423  
3424      if ((panel === null || panel === void 0 ? void 0 : panel.enabled) === false) {
3425        convertedData.inactivePanels.push(panelName);
3426      }
3427  
3428      if ((panel === null || panel === void 0 ? void 0 : panel.opened) === true) {
3429        convertedData.openPanels.push(panelName);
3430      }
3431  
3432      return convertedData;
3433    }, {
3434      inactivePanels: [],
3435      openPanels: []
3436    });
3437  }
3438  function migrateThirdPartyFeaturePreferencesToPreferencesStore(persistence) {
3439    var _state$interfaceStore6, _state$interfaceStore7;
3440  
3441    const interfaceStoreName = 'core/interface';
3442    const preferencesStoreName = 'core/preferences';
3443    let state = persistence.get();
3444    const interfaceScopes = (_state$interfaceStore6 = state[interfaceStoreName]) === null || _state$interfaceStore6 === void 0 ? void 0 : (_state$interfaceStore7 = _state$interfaceStore6.preferences) === null || _state$interfaceStore7 === void 0 ? void 0 : _state$interfaceStore7.features;
3445  
3446    for (const scope in interfaceScopes) {
3447      var _state$preferencesSto8, _state$interfaceStore8, _state$interfaceStore9;
3448  
3449      // Don't migrate any core 'scopes'.
3450      if (scope.startsWith('core')) {
3451        continue;
3452      } // Skip this scope if there are no features to migrate.
3453  
3454  
3455      const featuresToMigrate = interfaceScopes[scope];
3456  
3457      if (!featuresToMigrate) {
3458        continue;
3459      }
3460  
3461      const existingPreferences = (_state$preferencesSto8 = state[preferencesStoreName]) === null || _state$preferencesSto8 === void 0 ? void 0 : _state$preferencesSto8.preferences; // Add the data to the preferences store structure.
3462  
3463      persistence.set(preferencesStoreName, {
3464        preferences: { ...existingPreferences,
3465          [scope]: featuresToMigrate
3466        }
3467      }); // Remove the data from the interface store structure.
3468      // Call `persistence.get` again to make sure `state` is up-to-date with
3469      // any changes from the previous iteration of this loop.
3470  
3471      state = persistence.get();
3472      const otherInterfaceState = state[interfaceStoreName];
3473      const otherInterfaceScopes = (_state$interfaceStore8 = state[interfaceStoreName]) === null || _state$interfaceStore8 === void 0 ? void 0 : (_state$interfaceStore9 = _state$interfaceStore8.preferences) === null || _state$interfaceStore9 === void 0 ? void 0 : _state$interfaceStore9.features;
3474      persistence.set(interfaceStoreName, { ...otherInterfaceState,
3475        preferences: {
3476          features: { ...otherInterfaceScopes,
3477            [scope]: undefined
3478          }
3479        }
3480      });
3481    }
3482  }
3483  /**
3484   * Migrates interface 'enableItems' data to the preferences store.
3485   *
3486   * The interface package stores this data in this format:
3487   * ```js
3488   * {
3489   *     enableItems: {
3490   *         singleEnableItems: {
3491   *                complementaryArea: {
3492   *                 'core/edit-post': 'edit-post/document',
3493   *                 'core/edit-site': 'edit-site/global-styles',
3494   *             }
3495   *         },
3496   *         multipleEnableItems: {
3497   *             pinnedItems: {
3498   *                 'core/edit-post': {
3499   *                     'plugin-1': true,
3500   *                 },
3501   *                 'core/edit-site': {
3502   *                     'plugin-2': true,
3503   *                 },
3504   *             },
3505   *         }
3506   *     }
3507   * }
3508   * ```
3509   * and it should be migrated it to:
3510   * ```js
3511   * {
3512   *     'core/edit-post': {
3513   *         complementaryArea: 'edit-post/document',
3514   *         pinnedItems: {
3515   *             'plugin-1': true,
3516   *         },
3517   *     },
3518   *     'core/edit-site': {
3519   *         complementaryArea: 'edit-site/global-styles',
3520   *         pinnedItems: {
3521   *             'plugin-2': true,
3522   *         },
3523   *     },
3524   * }
3525   * ```
3526   *
3527   * @param {Object} persistence The persistence interface.
3528   */
3529  
3530  function migrateInterfaceEnableItemsToPreferencesStore(persistence) {
3531    var _state$interfaceStore10, _state$preferencesSto9, _state$preferencesSto10, _sourceEnableItems$si, _sourceEnableItems$si2, _sourceEnableItems$mu, _sourceEnableItems$mu2;
3532  
3533    const interfaceStoreName = 'core/interface';
3534    const preferencesStoreName = 'core/preferences';
3535    const state = persistence.get();
3536    const sourceEnableItems = (_state$interfaceStore10 = state[interfaceStoreName]) === null || _state$interfaceStore10 === void 0 ? void 0 : _state$interfaceStore10.enableItems; // There's nothing to migrate, exit early.
3537  
3538    if (!sourceEnableItems) {
3539      return;
3540    }
3541  
3542    const allPreferences = (_state$preferencesSto9 = (_state$preferencesSto10 = state[preferencesStoreName]) === null || _state$preferencesSto10 === void 0 ? void 0 : _state$preferencesSto10.preferences) !== null && _state$preferencesSto9 !== void 0 ? _state$preferencesSto9 : {}; // First convert complementaryAreas into the right format.
3543    // Use the existing preferences as the accumulator so that the data is
3544    // merged.
3545  
3546    const sourceComplementaryAreas = (_sourceEnableItems$si = sourceEnableItems === null || sourceEnableItems === void 0 ? void 0 : (_sourceEnableItems$si2 = sourceEnableItems.singleEnableItems) === null || _sourceEnableItems$si2 === void 0 ? void 0 : _sourceEnableItems$si2.complementaryArea) !== null && _sourceEnableItems$si !== void 0 ? _sourceEnableItems$si : {};
3547    const convertedComplementaryAreas = Object.keys(sourceComplementaryAreas).reduce((accumulator, scope) => {
3548      var _accumulator$scope;
3549  
3550      const data = sourceComplementaryAreas[scope]; // Don't overwrite any existing data in the preferences store.
3551  
3552      if ((_accumulator$scope = accumulator[scope]) !== null && _accumulator$scope !== void 0 && _accumulator$scope.complementaryArea) {
3553        return accumulator;
3554      }
3555  
3556      return { ...accumulator,
3557        [scope]: { ...accumulator[scope],
3558          complementaryArea: data
3559        }
3560      };
3561    }, allPreferences); // Next feed the converted complementary areas back into a reducer that
3562    // converts the pinned items, resulting in the fully migrated data.
3563  
3564    const sourcePinnedItems = (_sourceEnableItems$mu = sourceEnableItems === null || sourceEnableItems === void 0 ? void 0 : (_sourceEnableItems$mu2 = sourceEnableItems.multipleEnableItems) === null || _sourceEnableItems$mu2 === void 0 ? void 0 : _sourceEnableItems$mu2.pinnedItems) !== null && _sourceEnableItems$mu !== void 0 ? _sourceEnableItems$mu : {};
3565    const allConvertedData = Object.keys(sourcePinnedItems).reduce((accumulator, scope) => {
3566      var _accumulator$scope2;
3567  
3568      const data = sourcePinnedItems[scope]; // Don't overwrite any existing data in the preferences store.
3569  
3570      if ((_accumulator$scope2 = accumulator[scope]) !== null && _accumulator$scope2 !== void 0 && _accumulator$scope2.pinnedItems) {
3571        return accumulator;
3572      }
3573  
3574      return { ...accumulator,
3575        [scope]: { ...accumulator[scope],
3576          pinnedItems: data
3577        }
3578      };
3579    }, convertedComplementaryAreas);
3580    persistence.set(preferencesStoreName, {
3581      preferences: allConvertedData
3582    }); // Remove migrated preferences.
3583  
3584    const otherInterfaceItems = state[interfaceStoreName];
3585    persistence.set(interfaceStoreName, { ...otherInterfaceItems,
3586      enableItems: undefined
3587    });
3588  }
3589  
3590  persistencePlugin.__unstableMigrate = pluginOptions => {
3591    const persistence = createPersistenceInterface(pluginOptions); // Boolean feature preferences.
3592  
3593    migrateFeaturePreferencesToPreferencesStore(persistence, 'core/edit-widgets');
3594    migrateFeaturePreferencesToPreferencesStore(persistence, 'core/customize-widgets');
3595    migrateFeaturePreferencesToPreferencesStore(persistence, 'core/edit-post');
3596    migrateFeaturePreferencesToPreferencesStore(persistence, 'core/edit-site');
3597    migrateThirdPartyFeaturePreferencesToPreferencesStore(persistence); // Other ad-hoc preferences.
3598  
3599    migrateIndividualPreferenceToPreferencesStore(persistence, {
3600      from: 'core/edit-post',
3601      scope: 'core/edit-post'
3602    }, 'hiddenBlockTypes');
3603    migrateIndividualPreferenceToPreferencesStore(persistence, {
3604      from: 'core/edit-post',
3605      scope: 'core/edit-post'
3606    }, 'editorMode');
3607    migrateIndividualPreferenceToPreferencesStore(persistence, {
3608      from: 'core/edit-post',
3609      scope: 'core/edit-post'
3610    }, 'preferredStyleVariations');
3611    migrateIndividualPreferenceToPreferencesStore(persistence, {
3612      from: 'core/edit-post',
3613      scope: 'core/edit-post'
3614    }, 'panels', convertEditPostPanels);
3615    migrateIndividualPreferenceToPreferencesStore(persistence, {
3616      from: 'core/editor',
3617      scope: 'core/edit-post'
3618    }, 'isPublishSidebarEnabled');
3619    migrateIndividualPreferenceToPreferencesStore(persistence, {
3620      from: 'core/edit-site',
3621      scope: 'core/edit-site'
3622    }, 'editorMode');
3623    migrateInterfaceEnableItemsToPreferencesStore(persistence);
3624  };
3625  
3626  /* harmony default export */ var persistence = (persistencePlugin);
3627  
3628  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/index.js
3629  
3630  
3631  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
3632  function _extends() {
3633    _extends = Object.assign || function (target) {
3634      for (var i = 1; i < arguments.length; i++) {
3635        var source = arguments[i];
3636  
3637        for (var key in source) {
3638          if (Object.prototype.hasOwnProperty.call(source, key)) {
3639            target[key] = source[key];
3640          }
3641        }
3642      }
3643  
3644      return target;
3645    };
3646  
3647    return _extends.apply(this, arguments);
3648  }
3649  ;// CONCATENATED MODULE: external ["wp","element"]
3650  var external_wp_element_namespaceObject = window["wp"]["element"];
3651  ;// CONCATENATED MODULE: external ["wp","compose"]
3652  var external_wp_compose_namespaceObject = window["wp"]["compose"];
3653  ;// CONCATENATED MODULE: external "React"
3654  var external_React_namespaceObject = window["React"];
3655  ;// CONCATENATED MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
3656  
3657  
3658  function areInputsEqual(newInputs, lastInputs) {
3659    if (newInputs.length !== lastInputs.length) {
3660      return false;
3661    }
3662  
3663    for (var i = 0; i < newInputs.length; i++) {
3664      if (newInputs[i] !== lastInputs[i]) {
3665        return false;
3666      }
3667    }
3668  
3669    return true;
3670  }
3671  
3672  function useMemoOne(getResult, inputs) {
3673    var initial = (0,external_React_namespaceObject.useState)(function () {
3674      return {
3675        inputs: inputs,
3676        result: getResult()
3677      };
3678    })[0];
3679    var isFirstRun = (0,external_React_namespaceObject.useRef)(true);
3680    var committed = (0,external_React_namespaceObject.useRef)(initial);
3681    var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs));
3682    var cache = useCache ? committed.current : {
3683      inputs: inputs,
3684      result: getResult()
3685    };
3686    (0,external_React_namespaceObject.useEffect)(function () {
3687      isFirstRun.current = false;
3688      committed.current = cache;
3689    }, [cache]);
3690    return cache.result;
3691  }
3692  function useCallbackOne(callback, inputs) {
3693    return useMemoOne(function () {
3694      return callback;
3695    }, inputs);
3696  }
3697  var useMemo = (/* unused pure expression or super */ null && (useMemoOne));
3698  var useCallback = (/* unused pure expression or super */ null && (useCallbackOne));
3699  
3700  
3701  
3702  ;// CONCATENATED MODULE: external ["wp","priorityQueue"]
3703  var external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"];
3704  ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
3705  var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
3706  var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
3707  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/context.js
3708  /**
3709   * WordPress dependencies
3710   */
3711  
3712  /**
3713   * Internal dependencies
3714   */
3715  
3716  
3717  const Context = (0,external_wp_element_namespaceObject.createContext)(default_registry);
3718  const {
3719    Consumer,
3720    Provider
3721  } = Context;
3722  /**
3723   * A custom react Context consumer exposing the provided `registry` to
3724   * children components. Used along with the RegistryProvider.
3725   *
3726   * You can read more about the react context api here:
3727   * https://reactjs.org/docs/context.html#contextprovider
3728   *
3729   * @example
3730   * ```js
3731   * import {
3732   *   RegistryProvider,
3733   *   RegistryConsumer,
3734   *   createRegistry
3735   * } from '@wordpress/data';
3736   *
3737   * const registry = createRegistry( {} );
3738   *
3739   * const App = ( { props } ) => {
3740   *   return <RegistryProvider value={ registry }>
3741   *     <div>Hello There</div>
3742   *     <RegistryConsumer>
3743   *       { ( registry ) => (
3744   *         <ComponentUsingRegistry
3745   *                 { ...props }
3746   *               registry={ registry }
3747   *       ) }
3748   *     </RegistryConsumer>
3749   *   </RegistryProvider>
3750   * }
3751   * ```
3752   */
3753  
3754  const RegistryConsumer = Consumer;
3755  /**
3756   * A custom Context provider for exposing the provided `registry` to children
3757   * components via a consumer.
3758   *
3759   * See <a name="#RegistryConsumer">RegistryConsumer</a> documentation for
3760   * example.
3761   */
3762  
3763  /* harmony default export */ var context = (Provider);
3764  
3765  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/use-registry.js
3766  /**
3767   * WordPress dependencies
3768   */
3769  
3770  /**
3771   * Internal dependencies
3772   */
3773  
3774  
3775  /**
3776   * A custom react hook exposing the registry context for use.
3777   *
3778   * This exposes the `registry` value provided via the
3779   * <a href="#RegistryProvider">Registry Provider</a> to a component implementing
3780   * this hook.
3781   *
3782   * It acts similarly to the `useContext` react hook.
3783   *
3784   * Note: Generally speaking, `useRegistry` is a low level hook that in most cases
3785   * won't be needed for implementation. Most interactions with the `@wordpress/data`
3786   * API can be performed via the `useSelect` hook,  or the `withSelect` and
3787   * `withDispatch` higher order components.
3788   *
3789   * @example
3790   * ```js
3791   * import {
3792   *   RegistryProvider,
3793   *   createRegistry,
3794   *   useRegistry,
3795   * } from '@wordpress/data';
3796   *
3797   * const registry = createRegistry( {} );
3798   *
3799   * const SomeChildUsingRegistry = ( props ) => {
3800   *   const registry = useRegistry();
3801   *   // ...logic implementing the registry in other react hooks.
3802   * };
3803   *
3804   *
3805   * const ParentProvidingRegistry = ( props ) => {
3806   *   return <RegistryProvider value={ registry }>
3807   *     <SomeChildUsingRegistry { ...props } />
3808   *   </RegistryProvider>
3809   * };
3810   * ```
3811   *
3812   * @return {Function}  A custom react hook exposing the registry context value.
3813   */
3814  
3815  function useRegistry() {
3816    return (0,external_wp_element_namespaceObject.useContext)(Context);
3817  }
3818  
3819  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/context.js
3820  /**
3821   * WordPress dependencies
3822   */
3823  
3824  const context_Context = (0,external_wp_element_namespaceObject.createContext)(false);
3825  const {
3826    Consumer: context_Consumer,
3827    Provider: context_Provider
3828  } = context_Context;
3829  const AsyncModeConsumer = (/* unused pure expression or super */ null && (context_Consumer));
3830  /**
3831   * Context Provider Component used to switch the data module component rerendering
3832   * between Sync and Async modes.
3833   *
3834   * @example
3835   *
3836   * ```js
3837   * import { useSelect, AsyncModeProvider } from '@wordpress/data';
3838   *
3839   * function BlockCount() {
3840   *   const count = useSelect( ( select ) => {
3841   *     return select( 'core/block-editor' ).getBlockCount()
3842   *   }, [] );
3843   *
3844   *   return count;
3845   * }
3846   *
3847   * function App() {
3848   *   return (
3849   *     <AsyncModeProvider value={ true }>
3850   *       <BlockCount />
3851   *     </AsyncModeProvider>
3852   *   );
3853   * }
3854   * ```
3855   *
3856   * In this example, the BlockCount component is rerendered asynchronously.
3857   * It means if a more critical task is being performed (like typing in an input),
3858   * the rerendering is delayed until the browser becomes IDLE.
3859   * It is possible to nest multiple levels of AsyncModeProvider to fine-tune the rendering behavior.
3860   *
3861   * @param {boolean} props.value Enable Async Mode.
3862   * @return {WPComponent} The component to be rendered.
3863   */
3864  
3865  /* harmony default export */ var async_mode_provider_context = (context_Provider);
3866  
3867  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/use-async-mode.js
3868  /**
3869   * WordPress dependencies
3870   */
3871  
3872  /**
3873   * Internal dependencies
3874   */
3875  
3876  
3877  function useAsyncMode() {
3878    return (0,external_wp_element_namespaceObject.useContext)(context_Context);
3879  }
3880  
3881  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-select/index.js
3882  /**
3883   * External dependencies
3884   */
3885  
3886  /**
3887   * WordPress dependencies
3888   */
3889  
3890  
3891  
3892  
3893  
3894  /**
3895   * Internal dependencies
3896   */
3897  
3898  
3899  
3900  
3901  const noop = () => {};
3902  
3903  const renderQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)();
3904  /** @typedef {import('../../types').StoreDescriptor} StoreDescriptor */
3905  
3906  /**
3907   * Custom react hook for retrieving props from registered selectors.
3908   *
3909   * In general, this custom React hook follows the
3910   * [rules of hooks](https://reactjs.org/docs/hooks-rules.html).
3911   *
3912   * @param {Function|StoreDescriptor|string} mapSelect Function called on every state change. The
3913   *                                                    returned value is exposed to the component
3914   *                                                    implementing this hook. The function receives
3915   *                                                    the `registry.select` method on the first
3916   *                                                    argument and the `registry` on the second
3917   *                                                    argument.
3918   *                                                    When a store key is passed, all selectors for
3919   *                                                    the store will be returned. This is only meant
3920   *                                                    for usage of these selectors in event
3921   *                                                    callbacks, not for data needed to create the
3922   *                                                    element tree.
3923   * @param {Array}                           deps      If provided, this memoizes the mapSelect so the
3924   *                                                    same `mapSelect` is invoked on every state
3925   *                                                    change unless the dependencies change.
3926   *
3927   * @example
3928   * ```js
3929   * import { useSelect } from '@wordpress/data';
3930   *
3931   * function HammerPriceDisplay( { currency } ) {
3932   *   const price = useSelect( ( select ) => {
3933   *     return select( 'my-shop' ).getPrice( 'hammer', currency )
3934   *   }, [ currency ] );
3935   *   return new Intl.NumberFormat( 'en-US', {
3936   *     style: 'currency',
3937   *     currency,
3938   *   } ).format( price );
3939   * }
3940   *
3941   * // Rendered in the application:
3942   * // <HammerPriceDisplay currency="USD" />
3943   * ```
3944   *
3945   * In the above example, when `HammerPriceDisplay` is rendered into an
3946   * application, the price will be retrieved from the store state using the
3947   * `mapSelect` callback on `useSelect`. If the currency prop changes then
3948   * any price in the state for that currency is retrieved. If the currency prop
3949   * doesn't change and other props are passed in that do change, the price will
3950   * not change because the dependency is just the currency.
3951   *
3952   * When data is only used in an event callback, the data should not be retrieved
3953   * on render, so it may be useful to get the selectors function instead.
3954   *
3955   * **Don't use `useSelect` this way when calling the selectors in the render
3956   * function because your component won't re-render on a data change.**
3957   *
3958   * ```js
3959   * import { useSelect } from '@wordpress/data';
3960   *
3961   * function Paste( { children } ) {
3962   *   const { getSettings } = useSelect( 'my-shop' );
3963   *   function onPaste() {
3964   *     // Do something with the settings.
3965   *     const settings = getSettings();
3966   *   }
3967   *   return <div onPaste={ onPaste }>{ children }</div>;
3968   * }
3969   * ```
3970   *
3971   * @return {Function}  A custom react hook.
3972   */
3973  
3974  function useSelect(mapSelect, deps) {
3975    const hasMappingFunction = 'function' === typeof mapSelect; // If we're recalling a store by its name or by
3976    // its descriptor then we won't be caching the
3977    // calls to `mapSelect` because we won't be calling it.
3978  
3979    if (!hasMappingFunction) {
3980      deps = [];
3981    } // Because of the "rule of hooks" we have to call `useCallback`
3982    // on every invocation whether or not we have a real function
3983    // for `mapSelect`. we'll create this intermediate variable to
3984    // fulfill that need and then reference it with our "real"
3985    // `_mapSelect` if we can.
3986  
3987  
3988    const callbackMapper = (0,external_wp_element_namespaceObject.useCallback)(hasMappingFunction ? mapSelect : noop, deps);
3989  
3990    const _mapSelect = hasMappingFunction ? callbackMapper : null;
3991  
3992    const registry = useRegistry();
3993    const isAsync = useAsyncMode(); // React can sometimes clear the `useMemo` cache.
3994    // We use the cache-stable `useMemoOne` to avoid
3995    // losing queues.
3996  
3997    const queueContext = useMemoOne(() => ({
3998      queue: true
3999    }), [registry]);
4000    const [, forceRender] = (0,external_wp_element_namespaceObject.useReducer)(s => s + 1, 0);
4001    const latestMapSelect = (0,external_wp_element_namespaceObject.useRef)();
4002    const latestIsAsync = (0,external_wp_element_namespaceObject.useRef)(isAsync);
4003    const latestMapOutput = (0,external_wp_element_namespaceObject.useRef)();
4004    const latestMapOutputError = (0,external_wp_element_namespaceObject.useRef)();
4005    const isMountedAndNotUnsubscribing = (0,external_wp_element_namespaceObject.useRef)(); // Keep track of the stores being selected in the _mapSelect function,
4006    // and only subscribe to those stores later.
4007  
4008    const listeningStores = (0,external_wp_element_namespaceObject.useRef)([]);
4009    const wrapSelect = (0,external_wp_element_namespaceObject.useCallback)(callback => registry.__unstableMarkListeningStores(() => callback(registry.select, registry), listeningStores), [registry]); // Generate a "flag" for used in the effect dependency array.
4010    // It's different than just using `mapSelect` since deps could be undefined,
4011    // in that case, we would still want to memoize it.
4012  
4013    const depsChangedFlag = (0,external_wp_element_namespaceObject.useMemo)(() => ({}), deps || []);
4014    let mapOutput;
4015  
4016    if (_mapSelect) {
4017      mapOutput = latestMapOutput.current;
4018      const hasReplacedMapSelect = latestMapSelect.current !== _mapSelect;
4019      const lastMapSelectFailed = !!latestMapOutputError.current;
4020  
4021      if (hasReplacedMapSelect || lastMapSelectFailed) {
4022        try {
4023          mapOutput = wrapSelect(_mapSelect);
4024        } catch (error) {
4025          let errorMessage = `An error occurred while running 'mapSelect': $error.message}`;
4026  
4027          if (latestMapOutputError.current) {
4028            errorMessage += `\nThe error may be correlated with this previous error:\n`;
4029            errorMessage += `$latestMapOutputError.current.stack}\n\n`;
4030            errorMessage += 'Original stack trace:';
4031          } // eslint-disable-next-line no-console
4032  
4033  
4034          console.error(errorMessage);
4035        }
4036      }
4037    }
4038  
4039    (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => {
4040      if (!hasMappingFunction) {
4041        return;
4042      }
4043  
4044      latestMapSelect.current = _mapSelect;
4045      latestMapOutput.current = mapOutput;
4046      latestMapOutputError.current = undefined;
4047      isMountedAndNotUnsubscribing.current = true; // This has to run after the other ref updates
4048      // to avoid using stale values in the flushed
4049      // callbacks or potentially overwriting a
4050      // changed `latestMapOutput.current`.
4051  
4052      if (latestIsAsync.current !== isAsync) {
4053        latestIsAsync.current = isAsync;
4054        renderQueue.flush(queueContext);
4055      }
4056    });
4057    (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => {
4058      if (!hasMappingFunction) {
4059        return;
4060      }
4061  
4062      const onStoreChange = () => {
4063        if (isMountedAndNotUnsubscribing.current) {
4064          try {
4065            const newMapOutput = wrapSelect(latestMapSelect.current);
4066  
4067            if (external_wp_isShallowEqual_default()(latestMapOutput.current, newMapOutput)) {
4068              return;
4069            }
4070  
4071            latestMapOutput.current = newMapOutput;
4072          } catch (error) {
4073            latestMapOutputError.current = error;
4074          }
4075  
4076          forceRender();
4077        }
4078      };
4079  
4080      const onChange = () => {
4081        if (latestIsAsync.current) {
4082          renderQueue.add(queueContext, onStoreChange);
4083        } else {
4084          onStoreChange();
4085        }
4086      }; // Catch any possible state changes during mount before the subscription
4087      // could be set.
4088  
4089  
4090      onChange();
4091      const unsubscribers = listeningStores.current.map(storeName => registry.__unstableSubscribeStore(storeName, onChange));
4092      return () => {
4093        isMountedAndNotUnsubscribing.current = false; // The return value of the subscribe function could be undefined if the store is a custom generic store.
4094  
4095        unsubscribers.forEach(unsubscribe => unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe());
4096        renderQueue.flush(queueContext);
4097      }; // If you're tempted to eliminate the spread dependencies below don't do it!
4098      // We're passing these in from the calling function and want to make sure we're
4099      // examining every individual value inside the `deps` array.
4100    }, [registry, wrapSelect, hasMappingFunction, depsChangedFlag]);
4101    return hasMappingFunction ? mapOutput : registry.select(mapSelect);
4102  }
4103  
4104  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-select/index.js
4105  
4106  
4107  
4108  /**
4109   * WordPress dependencies
4110   */
4111  
4112  /**
4113   * Internal dependencies
4114   */
4115  
4116  
4117  /**
4118   * Higher-order component used to inject state-derived props using registered
4119   * selectors.
4120   *
4121   * @param {Function} mapSelectToProps Function called on every state change,
4122   *                                    expected to return object of props to
4123   *                                    merge with the component's own props.
4124   *
4125   * @example
4126   * ```js
4127   * import { withSelect } from '@wordpress/data';
4128   *
4129   * function PriceDisplay( { price, currency } ) {
4130   *     return new Intl.NumberFormat( 'en-US', {
4131   *         style: 'currency',
4132   *         currency,
4133   *     } ).format( price );
4134   * }
4135   *
4136   * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {
4137   *     const { getPrice } = select( 'my-shop' );
4138   *     const { currency } = ownProps;
4139   *
4140   *     return {
4141   *         price: getPrice( 'hammer', currency ),
4142   *     };
4143   * } )( PriceDisplay );
4144   *
4145   * // Rendered in the application:
4146   * //
4147   * //  <HammerPriceDisplay currency="USD" />
4148   * ```
4149   * In the above example, when `HammerPriceDisplay` is rendered into an
4150   * application, it will pass the price into the underlying `PriceDisplay`
4151   * component and update automatically if the price of a hammer ever changes in
4152   * the store.
4153   *
4154   * @return {WPComponent} Enhanced component with merged state data props.
4155   */
4156  
4157  const withSelect = mapSelectToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_compose_namespaceObject.pure)(ownProps => {
4158    const mapSelect = (select, registry) => mapSelectToProps(select, ownProps, registry);
4159  
4160    const mergeProps = useSelect(mapSelect);
4161    return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, ownProps, mergeProps));
4162  }), 'withSelect');
4163  
4164  /* harmony default export */ var with_select = (withSelect);
4165  
4166  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch-with-map.js
4167  /**
4168   * External dependencies
4169   */
4170  
4171  /**
4172   * WordPress dependencies
4173   */
4174  
4175  
4176  
4177  /**
4178   * Internal dependencies
4179   */
4180  
4181  
4182  /**
4183   * Custom react hook for returning aggregate dispatch actions using the provided
4184   * dispatchMap.
4185   *
4186   * Currently this is an internal api only and is implemented by `withDispatch`
4187   *
4188   * @param {Function} dispatchMap Receives the `registry.dispatch` function as
4189   *                               the first argument and the `registry` object
4190   *                               as the second argument.  Should return an
4191   *                               object mapping props to functions.
4192   * @param {Array}    deps        An array of dependencies for the hook.
4193   * @return {Object}  An object mapping props to functions created by the passed
4194   *                   in dispatchMap.
4195   */
4196  
4197  const useDispatchWithMap = (dispatchMap, deps) => {
4198    const registry = useRegistry();
4199    const currentDispatchMap = (0,external_wp_element_namespaceObject.useRef)(dispatchMap);
4200    (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => {
4201      currentDispatchMap.current = dispatchMap;
4202    });
4203    return (0,external_wp_element_namespaceObject.useMemo)(() => {
4204      const currentDispatchProps = currentDispatchMap.current(registry.dispatch, registry);
4205      return (0,external_lodash_namespaceObject.mapValues)(currentDispatchProps, (dispatcher, propName) => {
4206        if (typeof dispatcher !== 'function') {
4207          // eslint-disable-next-line no-console
4208          console.warn(`Property $propName} returned from dispatchMap in useDispatchWithMap must be a function.`);
4209        }
4210  
4211        return function () {
4212          return currentDispatchMap.current(registry.dispatch, registry)[propName](...arguments);
4213        };
4214      });
4215    }, [registry, ...deps]);
4216  };
4217  
4218  /* harmony default export */ var use_dispatch_with_map = (useDispatchWithMap);
4219  
4220  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-dispatch/index.js
4221  
4222  
4223  
4224  /**
4225   * WordPress dependencies
4226   */
4227  
4228  /**
4229   * Internal dependencies
4230   */
4231  
4232  
4233  /**
4234   * Higher-order component used to add dispatch props using registered action
4235   * creators.
4236   *
4237   * @param {Function} mapDispatchToProps A function of returning an object of
4238   *                                      prop names where value is a
4239   *                                      dispatch-bound action creator, or a
4240   *                                      function to be called with the
4241   *                                      component's props and returning an
4242   *                                      action creator.
4243   *
4244   * @example
4245   * ```jsx
4246   * function Button( { onClick, children } ) {
4247   *     return <button type="button" onClick={ onClick }>{ children }</button>;
4248   * }
4249   *
4250   * import { withDispatch } from '@wordpress/data';
4251   *
4252   * const SaleButton = withDispatch( ( dispatch, ownProps ) => {
4253   *     const { startSale } = dispatch( 'my-shop' );
4254   *     const { discountPercent } = ownProps;
4255   *
4256   *     return {
4257   *         onClick() {
4258   *             startSale( discountPercent );
4259   *         },
4260   *     };
4261   * } )( Button );
4262   *
4263   * // Rendered in the application:
4264   * //
4265   * // <SaleButton discountPercent="20">Start Sale!</SaleButton>
4266   * ```
4267   *
4268   * @example
4269   * In the majority of cases, it will be sufficient to use only two first params
4270   * passed to `mapDispatchToProps` as illustrated in the previous example.
4271   * However, there might be some very advanced use cases where using the
4272   * `registry` object might be used as a tool to optimize the performance of
4273   * your component. Using `select` function from the registry might be useful
4274   * when you need to fetch some dynamic data from the store at the time when the
4275   * event is fired, but at the same time, you never use it to render your
4276   * component. In such scenario, you can avoid using the `withSelect` higher
4277   * order component to compute such prop, which might lead to unnecessary
4278   * re-renders of your component caused by its frequent value change.
4279   * Keep in mind, that `mapDispatchToProps` must return an object with functions
4280   * only.
4281   *
4282   * ```jsx
4283   * function Button( { onClick, children } ) {
4284   *     return <button type="button" onClick={ onClick }>{ children }</button>;
4285   * }
4286   *
4287   * import { withDispatch } from '@wordpress/data';
4288   *
4289   * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => {
4290   *    // Stock number changes frequently.
4291   *    const { getStockNumber } = select( 'my-shop' );
4292   *    const { startSale } = dispatch( 'my-shop' );
4293   *    return {
4294   *        onClick() {
4295   *            const discountPercent = getStockNumber() > 50 ? 10 : 20;
4296   *            startSale( discountPercent );
4297   *        },
4298   *    };
4299   * } )( Button );
4300   *
4301   * // Rendered in the application:
4302   * //
4303   * //  <SaleButton>Start Sale!</SaleButton>
4304   * ```
4305   *
4306   * _Note:_ It is important that the `mapDispatchToProps` function always
4307   * returns an object with the same keys. For example, it should not contain
4308   * conditions under which a different value would be returned.
4309   *
4310   * @return {WPComponent} Enhanced component with merged dispatcher props.
4311   */
4312  
4313  const withDispatch = mapDispatchToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ownProps => {
4314    const mapDispatch = (dispatch, registry) => mapDispatchToProps(dispatch, ownProps, registry);
4315  
4316    const dispatchProps = use_dispatch_with_map(mapDispatch, []);
4317    return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, ownProps, dispatchProps));
4318  }, 'withDispatch');
4319  
4320  /* harmony default export */ var with_dispatch = (withDispatch);
4321  
4322  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-registry/index.js
4323  
4324  
4325  
4326  /**
4327   * WordPress dependencies
4328   */
4329  
4330  /**
4331   * Internal dependencies
4332   */
4333  
4334  
4335  /**
4336   * Higher-order component which renders the original component with the current
4337   * registry context passed as its `registry` prop.
4338   *
4339   * @param {WPComponent} OriginalComponent Original component.
4340   *
4341   * @return {WPComponent} Enhanced component.
4342   */
4343  
4344  const withRegistry = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => props => (0,external_wp_element_namespaceObject.createElement)(RegistryConsumer, null, registry => (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, _extends({}, props, {
4345    registry: registry
4346  }))), 'withRegistry');
4347  /* harmony default export */ var with_registry = (withRegistry);
4348  
4349  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch.js
4350  /**
4351   * Internal dependencies
4352   */
4353  
4354  /** @typedef {import('../../types').StoreDescriptor} StoreDescriptor */
4355  
4356  /**
4357   * A custom react hook returning the current registry dispatch actions creators.
4358   *
4359   * Note: The component using this hook must be within the context of a
4360   * RegistryProvider.
4361   *
4362   * @param {string|StoreDescriptor} [storeNameOrDescriptor] Optionally provide the name of the
4363   *                                                         store or its descriptor from which to
4364   *                                                         retrieve action creators. If not
4365   *                                                         provided, the registry.dispatch
4366   *                                                         function is returned instead.
4367   *
4368   * @example
4369   * This illustrates a pattern where you may need to retrieve dynamic data from
4370   * the server via the `useSelect` hook to use in combination with the dispatch
4371   * action.
4372   *
4373   * ```jsx
4374   * import { useDispatch, useSelect } from '@wordpress/data';
4375   * import { useCallback } from '@wordpress/element';
4376   *
4377   * function Button( { onClick, children } ) {
4378   *   return <button type="button" onClick={ onClick }>{ children }</button>
4379   * }
4380   *
4381   * const SaleButton = ( { children } ) => {
4382   *   const { stockNumber } = useSelect(
4383   *     ( select ) => select( 'my-shop' ).getStockNumber(),
4384   *     []
4385   *   );
4386   *   const { startSale } = useDispatch( 'my-shop' );
4387   *   const onClick = useCallback( () => {
4388   *     const discountPercent = stockNumber > 50 ? 10: 20;
4389   *     startSale( discountPercent );
4390   *   }, [ stockNumber ] );
4391   *   return <Button onClick={ onClick }>{ children }</Button>
4392   * }
4393   *
4394   * // Rendered somewhere in the application:
4395   * //
4396   * // <SaleButton>Start Sale!</SaleButton>
4397   * ```
4398   * @return {Function}  A custom react hook.
4399   */
4400  
4401  const useDispatch = storeNameOrDescriptor => {
4402    const {
4403      dispatch
4404    } = useRegistry();
4405    return storeNameOrDescriptor === void 0 ? dispatch : dispatch(storeNameOrDescriptor);
4406  };
4407  
4408  /* harmony default export */ var use_dispatch = (useDispatch);
4409  
4410  ;// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/index.js
4411  /**
4412   * External dependencies
4413   */
4414  
4415  /**
4416   * Internal dependencies
4417   */
4418  
4419  
4420  
4421  /** @typedef {import('./types').StoreDescriptor} StoreDescriptor */
4422  
4423  
4424  
4425  
4426  
4427  
4428  
4429  
4430  
4431  
4432  
4433  
4434  /**
4435   * Object of available plugins to use with a registry.
4436   *
4437   * @see [use](#use)
4438   *
4439   * @type {Object}
4440   */
4441  
4442  
4443  /**
4444   * The combineReducers helper function turns an object whose values are different
4445   * reducing functions into a single reducing function you can pass to registerReducer.
4446   *
4447   * @param {Object} reducers An object whose values correspond to different reducing
4448   *                          functions that need to be combined into one.
4449   *
4450   * @example
4451   * ```js
4452   * import { combineReducers, createReduxStore, register } from '@wordpress/data';
4453   *
4454   * const prices = ( state = {}, action ) => {
4455   *     return action.type === 'SET_PRICE' ?
4456   *         {
4457   *             ...state,
4458   *             [ action.item ]: action.price,
4459   *         } :
4460   *         state;
4461   * };
4462   *
4463   * const discountPercent = ( state = 0, action ) => {
4464   *     return action.type === 'START_SALE' ?
4465   *         action.discountPercent :
4466   *         state;
4467   * };
4468   *
4469   * const store = createReduxStore( 'my-shop', {
4470   *     reducer: combineReducers( {
4471   *         prices,
4472   *         discountPercent,
4473   *     } ),
4474   * } );
4475   * register( store );
4476   * ```
4477   *
4478   * @return {Function} A reducer that invokes every reducer inside the reducers
4479   *                    object, and constructs a state object with the same shape.
4480   */
4481  
4482  
4483  /**
4484   * Given the name or descriptor of a registered store, returns an object of the store's selectors.
4485   * The selector functions are been pre-bound to pass the current state automatically.
4486   * As a consumer, you need only pass arguments of the selector, if applicable.
4487   *
4488   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
4489   *                                                       or the store descriptor.
4490   *
4491   * @example
4492   * ```js
4493   * import { select } from '@wordpress/data';
4494   *
4495   * select( 'my-shop' ).getPrice( 'hammer' );
4496   * ```
4497   *
4498   * @return {Object} Object containing the store's selectors.
4499   */
4500  
4501  const build_module_select = default_registry.select;
4502  /**
4503   * Given the name of a registered store, returns an object containing the store's
4504   * selectors pre-bound to state so that you only need to supply additional arguments,
4505   * and modified so that they return promises that resolve to their eventual values,
4506   * after any resolvers have ran.
4507   *
4508   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
4509   *                                                       or the store descriptor.
4510   *
4511   * @example
4512   * ```js
4513   * import { resolveSelect } from '@wordpress/data';
4514   *
4515   * resolveSelect( 'my-shop' ).getPrice( 'hammer' ).then(console.log)
4516   * ```
4517   *
4518   * @return {Object} Object containing the store's promise-wrapped selectors.
4519   */
4520  
4521  const build_module_resolveSelect = default_registry.resolveSelect;
4522  /**
4523   * Given the name of a registered store, returns an object of the store's action creators.
4524   * Calling an action creator will cause it to be dispatched, updating the state value accordingly.
4525   *
4526   * Note: Action creators returned by the dispatch will return a promise when
4527   * they are called.
4528   *
4529   * @param {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
4530   *                                                       or the store descriptor.
4531   *
4532   * @example
4533   * ```js
4534   * import { dispatch } from '@wordpress/data';
4535   *
4536   * dispatch( 'my-shop' ).setPrice( 'hammer', 9.75 );
4537   * ```
4538   * @return {Object} Object containing the action creators.
4539   */
4540  
4541  const build_module_dispatch = default_registry.dispatch;
4542  /**
4543   * Given a listener function, the function will be called any time the state value
4544   * of one of the registered stores has changed. This function returns a `unsubscribe`
4545   * function used to stop the subscription.
4546   *
4547   * @param {Function} listener Callback function.
4548   *
4549   * @example
4550   * ```js
4551   * import { subscribe } from '@wordpress/data';
4552   *
4553   * const unsubscribe = subscribe( () => {
4554   *     // You could use this opportunity to test whether the derived result of a
4555   *     // selector has subsequently changed as the result of a state update.
4556   * } );
4557   *
4558   * // Later, if necessary...
4559   * unsubscribe();
4560   * ```
4561   */
4562  
4563  const subscribe = default_registry.subscribe;
4564  /**
4565   * Registers a generic store instance.
4566   *
4567   * @deprecated Use `register( storeDescriptor )` instead.
4568   *
4569   * @param {string} name  Store registry name.
4570   * @param {Object} store Store instance (`{ getSelectors, getActions, subscribe }`).
4571   */
4572  
4573  const registerGenericStore = default_registry.registerGenericStore;
4574  /**
4575   * Registers a standard `@wordpress/data` store.
4576   *
4577   * @deprecated Use `register` instead.
4578   *
4579   * @param {string} storeName Unique namespace identifier for the store.
4580   * @param {Object} options   Store description (reducer, actions, selectors, resolvers).
4581   *
4582   * @return {Object} Registered store object.
4583   */
4584  
4585  const registerStore = default_registry.registerStore;
4586  /**
4587   * Extends a registry to inherit functionality provided by a given plugin. A
4588   * plugin is an object with properties aligning to that of a registry, merged
4589   * to extend the default registry behavior.
4590   *
4591   * @param {Object} plugin Plugin object.
4592   */
4593  
4594  const use = default_registry.use;
4595  /**
4596   * Registers a standard `@wordpress/data` store descriptor.
4597   *
4598   * @example
4599   * ```js
4600   * import { createReduxStore, register } from '@wordpress/data';
4601   *
4602   * const store = createReduxStore( 'demo', {
4603   *     reducer: ( state = 'OK' ) => state,
4604   *     selectors: {
4605   *         getValue: ( state ) => state,
4606   *     },
4607   * } );
4608   * register( store );
4609   * ```
4610   *
4611   * @param {StoreDescriptor} store Store descriptor.
4612   */
4613  
4614  const register = default_registry.register;
4615  
4616  }();
4617  (window.wp = window.wp || {}).data = __webpack_exports__;
4618  /******/ })()
4619  ;


Generated: Sat Dec 7 01:00:02 2024 Cross-referenced by PHPXref 0.7.1