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