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