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