UNPKG

116 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 (factory((global.ReduxTiles = global.ReduxTiles || {})));
5}(this, (function (exports) { 'use strict';
6
7var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
9
10
11
12
13function createCommonjsModule(fn, module) {
14 return module = { exports: {} }, fn(module, module.exports), module.exports;
15}
16
17/** Detect free variable `global` from Node.js. */
18var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
19
20var _freeGlobal = freeGlobal;
21
22/** Detect free variable `self`. */
23var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
24
25/** Used as a reference to the global object. */
26var root = _freeGlobal || freeSelf || Function('return this')();
27
28var _root = root;
29
30/** Built-in value references. */
31var Symbol$1 = _root.Symbol;
32
33var _Symbol = Symbol$1;
34
35/** Used for built-in method references. */
36var objectProto = Object.prototype;
37
38/** Used to check objects for own properties. */
39var hasOwnProperty = objectProto.hasOwnProperty;
40
41/**
42 * Used to resolve the
43 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44 * of values.
45 */
46var nativeObjectToString = objectProto.toString;
47
48/** Built-in value references. */
49var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
50
51/**
52 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
53 *
54 * @private
55 * @param {*} value The value to query.
56 * @returns {string} Returns the raw `toStringTag`.
57 */
58function getRawTag(value) {
59 var isOwn = hasOwnProperty.call(value, symToStringTag$1),
60 tag = value[symToStringTag$1];
61
62 try {
63 value[symToStringTag$1] = undefined;
64 var unmasked = true;
65 } catch (e) {}
66
67 var result = nativeObjectToString.call(value);
68 if (unmasked) {
69 if (isOwn) {
70 value[symToStringTag$1] = tag;
71 } else {
72 delete value[symToStringTag$1];
73 }
74 }
75 return result;
76}
77
78var _getRawTag = getRawTag;
79
80/** Used for built-in method references. */
81var objectProto$1 = Object.prototype;
82
83/**
84 * Used to resolve the
85 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
86 * of values.
87 */
88var nativeObjectToString$1 = objectProto$1.toString;
89
90/**
91 * Converts `value` to a string using `Object.prototype.toString`.
92 *
93 * @private
94 * @param {*} value The value to convert.
95 * @returns {string} Returns the converted string.
96 */
97function objectToString(value) {
98 return nativeObjectToString$1.call(value);
99}
100
101var _objectToString = objectToString;
102
103/** `Object#toString` result references. */
104var nullTag = '[object Null]';
105var undefinedTag = '[object Undefined]';
106
107/** Built-in value references. */
108var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
109
110/**
111 * The base implementation of `getTag` without fallbacks for buggy environments.
112 *
113 * @private
114 * @param {*} value The value to query.
115 * @returns {string} Returns the `toStringTag`.
116 */
117function baseGetTag(value) {
118 if (value == null) {
119 return value === undefined ? undefinedTag : nullTag;
120 }
121 return (symToStringTag && symToStringTag in Object(value))
122 ? _getRawTag(value)
123 : _objectToString(value);
124}
125
126var _baseGetTag = baseGetTag;
127
128/**
129 * Checks if `value` is classified as an `Array` object.
130 *
131 * @static
132 * @memberOf _
133 * @since 0.1.0
134 * @category Lang
135 * @param {*} value The value to check.
136 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
137 * @example
138 *
139 * _.isArray([1, 2, 3]);
140 * // => true
141 *
142 * _.isArray(document.body.children);
143 * // => false
144 *
145 * _.isArray('abc');
146 * // => false
147 *
148 * _.isArray(_.noop);
149 * // => false
150 */
151var isArray = Array.isArray;
152
153var isArray_1 = isArray;
154
155/**
156 * Checks if `value` is object-like. A value is object-like if it's not `null`
157 * and has a `typeof` result of "object".
158 *
159 * @static
160 * @memberOf _
161 * @since 4.0.0
162 * @category Lang
163 * @param {*} value The value to check.
164 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
165 * @example
166 *
167 * _.isObjectLike({});
168 * // => true
169 *
170 * _.isObjectLike([1, 2, 3]);
171 * // => true
172 *
173 * _.isObjectLike(_.noop);
174 * // => false
175 *
176 * _.isObjectLike(null);
177 * // => false
178 */
179function isObjectLike(value) {
180 return value != null && typeof value == 'object';
181}
182
183var isObjectLike_1 = isObjectLike;
184
185/** `Object#toString` result references. */
186var stringTag = '[object String]';
187
188/**
189 * Checks if `value` is classified as a `String` primitive or object.
190 *
191 * @static
192 * @since 0.1.0
193 * @memberOf _
194 * @category Lang
195 * @param {*} value The value to check.
196 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
197 * @example
198 *
199 * _.isString('abc');
200 * // => true
201 *
202 * _.isString(1);
203 * // => false
204 */
205function isString(value) {
206 return typeof value == 'string' ||
207 (!isArray_1(value) && isObjectLike_1(value) && _baseGetTag(value) == stringTag);
208}
209
210var isString_1 = isString;
211
212function ensureArray(value) {
213 return isString_1(value) ? [value] : value;
214}
215function populateHash(hash, path, value) {
216 if (isString_1(path)) {
217 return populateHash(hash, [path], value);
218 }
219 if (path.length === 1) {
220 hash[path[0]] = value;
221 return hash;
222 }
223 var property = path[0];
224 if (!hash[property]) {
225 hash[property] = {};
226 }
227 return populateHash(hash[property], path.slice(1), value);
228}
229function iterate(tiles) {
230 return isArray_1(tiles) ? tiles : Object.keys(tiles).reduce(function (arr, key) {
231 var values = tiles[key];
232 return arr.concat(values);
233 }, []);
234}
235function capitalize(str, i) {
236 if (i === 0) {
237 return str;
238 }
239 return str[0].toUpperCase() + str.slice(1);
240}
241function createType(_a) {
242 var type = _a.type,
243 path = _a.path;
244 var list = ensureArray(type).concat(path == null ? [] : path.map(String));
245 return list.map(capitalize).join('');
246}
247
248function createActions(tiles) {
249 // this storage will keep all promises
250 // so if the request is already in progress,
251 // we could still await it
252 return iterate(tiles).reduce(function (hash, tile) {
253 populateHash(hash, tile.tileName, tile.action);
254 return hash;
255 }, {});
256}
257
258/**
259 * Checks if `value` is the
260 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
261 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
262 *
263 * @static
264 * @memberOf _
265 * @since 0.1.0
266 * @category Lang
267 * @param {*} value The value to check.
268 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
269 * @example
270 *
271 * _.isObject({});
272 * // => true
273 *
274 * _.isObject([1, 2, 3]);
275 * // => true
276 *
277 * _.isObject(_.noop);
278 * // => true
279 *
280 * _.isObject(null);
281 * // => false
282 */
283function isObject(value) {
284 var type = typeof value;
285 return value != null && (type == 'object' || type == 'function');
286}
287
288var isObject_1 = isObject;
289
290/** `Object#toString` result references. */
291var asyncTag = '[object AsyncFunction]';
292var funcTag = '[object Function]';
293var genTag = '[object GeneratorFunction]';
294var proxyTag = '[object Proxy]';
295
296/**
297 * Checks if `value` is classified as a `Function` object.
298 *
299 * @static
300 * @memberOf _
301 * @since 0.1.0
302 * @category Lang
303 * @param {*} value The value to check.
304 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
305 * @example
306 *
307 * _.isFunction(_);
308 * // => true
309 *
310 * _.isFunction(/abc/);
311 * // => false
312 */
313function isFunction(value) {
314 if (!isObject_1(value)) {
315 return false;
316 }
317 // The use of `Object#toString` avoids issues with the `typeof` operator
318 // in Safari 9 which returns 'object' for typed arrays and other constructors.
319 var tag = _baseGetTag(value);
320 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
321}
322
323var isFunction_1 = isFunction;
324
325/** Detect free variable `global` from Node.js. */
326var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
327
328/** Detect free variable `self`. */
329var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
330
331/** Used as a reference to the global object. */
332var root$2 = freeGlobal$2 || freeSelf$1 || Function('return this')();
333
334/** Built-in value references. */
335var Symbol$3 = root$2.Symbol;
336
337/** Used for built-in method references. */
338var objectProto$3 = Object.prototype;
339
340/** Used to check objects for own properties. */
341var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
342
343/**
344 * Used to resolve the
345 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
346 * of values.
347 */
348var nativeObjectToString$2 = objectProto$3.toString;
349
350/** Built-in value references. */
351var symToStringTag$3 = Symbol$3 ? Symbol$3.toStringTag : undefined;
352
353/**
354 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
355 *
356 * @private
357 * @param {*} value The value to query.
358 * @returns {string} Returns the raw `toStringTag`.
359 */
360function getRawTag$2(value) {
361 var isOwn = hasOwnProperty$2.call(value, symToStringTag$3),
362 tag = value[symToStringTag$3];
363
364 try {
365 value[symToStringTag$3] = undefined;
366 var unmasked = true;
367 } catch (e) {}
368
369 var result = nativeObjectToString$2.call(value);
370 if (unmasked) {
371 if (isOwn) {
372 value[symToStringTag$3] = tag;
373 } else {
374 delete value[symToStringTag$3];
375 }
376 }
377 return result;
378}
379
380/** Used for built-in method references. */
381var objectProto$4 = Object.prototype;
382
383/**
384 * Used to resolve the
385 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
386 * of values.
387 */
388var nativeObjectToString$3 = objectProto$4.toString;
389
390/**
391 * Converts `value` to a string using `Object.prototype.toString`.
392 *
393 * @private
394 * @param {*} value The value to convert.
395 * @returns {string} Returns the converted string.
396 */
397function objectToString$2(value) {
398 return nativeObjectToString$3.call(value);
399}
400
401/** `Object#toString` result references. */
402var nullTag$1 = '[object Null]';
403var undefinedTag$1 = '[object Undefined]';
404
405/** Built-in value references. */
406var symToStringTag$2 = Symbol$3 ? Symbol$3.toStringTag : undefined;
407
408/**
409 * The base implementation of `getTag` without fallbacks for buggy environments.
410 *
411 * @private
412 * @param {*} value The value to query.
413 * @returns {string} Returns the `toStringTag`.
414 */
415function baseGetTag$2(value) {
416 if (value == null) {
417 return value === undefined ? undefinedTag$1 : nullTag$1;
418 }
419 return (symToStringTag$2 && symToStringTag$2 in Object(value))
420 ? getRawTag$2(value)
421 : objectToString$2(value);
422}
423
424/**
425 * Creates a unary function that invokes `func` with its argument transformed.
426 *
427 * @private
428 * @param {Function} func The function to wrap.
429 * @param {Function} transform The argument transform.
430 * @returns {Function} Returns the new function.
431 */
432function overArg(func, transform) {
433 return function(arg) {
434 return func(transform(arg));
435 };
436}
437
438/** Built-in value references. */
439var getPrototype = overArg(Object.getPrototypeOf, Object);
440
441/**
442 * Checks if `value` is object-like. A value is object-like if it's not `null`
443 * and has a `typeof` result of "object".
444 *
445 * @static
446 * @memberOf _
447 * @since 4.0.0
448 * @category Lang
449 * @param {*} value The value to check.
450 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
451 * @example
452 *
453 * _.isObjectLike({});
454 * // => true
455 *
456 * _.isObjectLike([1, 2, 3]);
457 * // => true
458 *
459 * _.isObjectLike(_.noop);
460 * // => false
461 *
462 * _.isObjectLike(null);
463 * // => false
464 */
465function isObjectLike$2(value) {
466 return value != null && typeof value == 'object';
467}
468
469/** `Object#toString` result references. */
470var objectTag = '[object Object]';
471
472/** Used for built-in method references. */
473var funcProto = Function.prototype;
474var objectProto$2 = Object.prototype;
475
476/** Used to resolve the decompiled source of functions. */
477var funcToString = funcProto.toString;
478
479/** Used to check objects for own properties. */
480var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
481
482/** Used to infer the `Object` constructor. */
483var objectCtorString = funcToString.call(Object);
484
485/**
486 * Checks if `value` is a plain object, that is, an object created by the
487 * `Object` constructor or one with a `[[Prototype]]` of `null`.
488 *
489 * @static
490 * @memberOf _
491 * @since 0.8.0
492 * @category Lang
493 * @param {*} value The value to check.
494 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
495 * @example
496 *
497 * function Foo() {
498 * this.a = 1;
499 * }
500 *
501 * _.isPlainObject(new Foo);
502 * // => false
503 *
504 * _.isPlainObject([1, 2, 3]);
505 * // => false
506 *
507 * _.isPlainObject({ 'x': 0, 'y': 0 });
508 * // => true
509 *
510 * _.isPlainObject(Object.create(null));
511 * // => true
512 */
513function isPlainObject(value) {
514 if (!isObjectLike$2(value) || baseGetTag$2(value) != objectTag) {
515 return false;
516 }
517 var proto = getPrototype(value);
518 if (proto === null) {
519 return true;
520 }
521 var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
522 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
523 funcToString.call(Ctor) == objectCtorString;
524}
525
526function symbolObservablePonyfill(root) {
527 var result;
528 var Symbol = root.Symbol;
529
530 if (typeof Symbol === 'function') {
531 if (Symbol.observable) {
532 result = Symbol.observable;
533 } else {
534 result = Symbol('observable');
535 Symbol.observable = result;
536 }
537 } else {
538 result = '@@observable';
539 }
540
541 return result;
542}
543
544/* global window */
545var root$4;
546
547if (typeof self !== 'undefined') {
548 root$4 = self;
549} else if (typeof window !== 'undefined') {
550 root$4 = window;
551} else if (typeof global !== 'undefined') {
552 root$4 = global;
553} else if (typeof module !== 'undefined') {
554 root$4 = module;
555} else {
556 root$4 = Function('return this')();
557}
558
559var result = symbolObservablePonyfill(root$4);
560
561/**
562 * These are private action types reserved by Redux.
563 * For any unknown actions, you must return the current state.
564 * If the current state is undefined, you must return the initial state.
565 * Do not reference these action types directly in your code.
566 */
567var ActionTypes = {
568 INIT: '@@redux/INIT'
569};
570
571/**
572 * Prints a warning in the console if it exists.
573 *
574 * @param {String} message The warning message.
575 * @returns {void}
576 */
577function warning(message) {
578 /* eslint-disable no-console */
579 if (typeof console !== 'undefined' && typeof console.error === 'function') {
580 console.error(message);
581 }
582 /* eslint-enable no-console */
583 try {
584 // This error was thrown as a convenience so that if you enable
585 // "break on all exceptions" in your console,
586 // it would pause the execution at this line.
587 throw new Error(message);
588 /* eslint-disable no-empty */
589 } catch (e) {}
590 /* eslint-enable no-empty */
591}
592
593function getUndefinedStateErrorMessage(key, action) {
594 var actionType = action && action.type;
595 var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
596
597 return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
598}
599
600function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
601 var reducerKeys = Object.keys(reducers);
602 var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
603
604 if (reducerKeys.length === 0) {
605 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
606 }
607
608 if (!isPlainObject(inputState)) {
609 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('", "') + '"');
610 }
611
612 var unexpectedKeys = Object.keys(inputState).filter(function (key) {
613 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
614 });
615
616 unexpectedKeys.forEach(function (key) {
617 unexpectedKeyCache[key] = true;
618 });
619
620 if (unexpectedKeys.length > 0) {
621 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.');
622 }
623}
624
625function assertReducerSanity(reducers) {
626 Object.keys(reducers).forEach(function (key) {
627 var reducer = reducers[key];
628 var initialState = reducer(undefined, { type: ActionTypes.INIT });
629
630 if (typeof initialState === 'undefined') {
631 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.');
632 }
633
634 var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
635 if (typeof reducer(undefined, { type: type }) === 'undefined') {
636 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.');
637 }
638 });
639}
640
641/**
642 * Turns an object whose values are different reducer functions, into a single
643 * reducer function. It will call every child reducer, and gather their results
644 * into a single state object, whose keys correspond to the keys of the passed
645 * reducer functions.
646 *
647 * @param {Object} reducers An object whose values correspond to different
648 * reducer functions that need to be combined into one. One handy way to obtain
649 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
650 * undefined for any action. Instead, they should return their initial state
651 * if the state passed to them was undefined, and the current state for any
652 * unrecognized action.
653 *
654 * @returns {Function} A reducer function that invokes every reducer inside the
655 * passed object, and builds a state object with the same shape.
656 */
657function combineReducers(reducers) {
658 var reducerKeys = Object.keys(reducers);
659 var finalReducers = {};
660 for (var i = 0; i < reducerKeys.length; i++) {
661 var key = reducerKeys[i];
662
663 {
664 if (typeof reducers[key] === 'undefined') {
665 warning('No reducer provided for key "' + key + '"');
666 }
667 }
668
669 if (typeof reducers[key] === 'function') {
670 finalReducers[key] = reducers[key];
671 }
672 }
673 var finalReducerKeys = Object.keys(finalReducers);
674
675 {
676 var unexpectedKeyCache = {};
677 }
678
679 var sanityError;
680 try {
681 assertReducerSanity(finalReducers);
682 } catch (e) {
683 sanityError = e;
684 }
685
686 return function combination() {
687 var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
688 var action = arguments[1];
689
690 if (sanityError) {
691 throw sanityError;
692 }
693
694 {
695 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
696 if (warningMessage) {
697 warning(warningMessage);
698 }
699 }
700
701 var hasChanged = false;
702 var nextState = {};
703 for (var i = 0; i < finalReducerKeys.length; i++) {
704 var key = finalReducerKeys[i];
705 var reducer = finalReducers[key];
706 var previousStateForKey = state[key];
707 var nextStateForKey = reducer(previousStateForKey, action);
708 if (typeof nextStateForKey === 'undefined') {
709 var errorMessage = getUndefinedStateErrorMessage(key, action);
710 throw new Error(errorMessage);
711 }
712 nextState[key] = nextStateForKey;
713 hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
714 }
715 return hasChanged ? nextState : state;
716 };
717}
718
719/**
720 * Composes single-argument functions from right to left. The rightmost
721 * function can take multiple arguments as it provides the signature for
722 * the resulting composite function.
723 *
724 * @param {...Function} funcs The functions to compose.
725 * @returns {Function} A function obtained by composing the argument functions
726 * from right to left. For example, compose(f, g, h) is identical to doing
727 * (...args) => f(g(h(...args))).
728 */
729
730/*
731* This is a dummy function to check if the function name has been altered by minification.
732* If the function has been minified and NODE_ENV !== 'production', warn the user.
733*/
734function isCrushed() {}
735
736if ("development" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
737 warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
738}
739
740/** `Object#toString` result references. */
741var symbolTag = '[object Symbol]';
742
743/**
744 * Checks if `value` is classified as a `Symbol` primitive or object.
745 *
746 * @static
747 * @memberOf _
748 * @since 4.0.0
749 * @category Lang
750 * @param {*} value The value to check.
751 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
752 * @example
753 *
754 * _.isSymbol(Symbol.iterator);
755 * // => true
756 *
757 * _.isSymbol('abc');
758 * // => false
759 */
760function isSymbol(value) {
761 return typeof value == 'symbol' ||
762 (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
763}
764
765var isSymbol_1 = isSymbol;
766
767/** Used to match property names within property paths. */
768var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
769var reIsPlainProp = /^\w*$/;
770
771/**
772 * Checks if `value` is a property name and not a property path.
773 *
774 * @private
775 * @param {*} value The value to check.
776 * @param {Object} [object] The object to query keys on.
777 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
778 */
779function isKey(value, object) {
780 if (isArray_1(value)) {
781 return false;
782 }
783 var type = typeof value;
784 if (type == 'number' || type == 'symbol' || type == 'boolean' ||
785 value == null || isSymbol_1(value)) {
786 return true;
787 }
788 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
789 (object != null && value in Object(object));
790}
791
792var _isKey = isKey;
793
794/** Used to detect overreaching core-js shims. */
795var coreJsData = _root['__core-js_shared__'];
796
797var _coreJsData = coreJsData;
798
799/** Used to detect methods masquerading as native. */
800var maskSrcKey = (function() {
801 var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
802 return uid ? ('Symbol(src)_1.' + uid) : '';
803}());
804
805/**
806 * Checks if `func` has its source masked.
807 *
808 * @private
809 * @param {Function} func The function to check.
810 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
811 */
812function isMasked(func) {
813 return !!maskSrcKey && (maskSrcKey in func);
814}
815
816var _isMasked = isMasked;
817
818/** Used for built-in method references. */
819var funcProto$2 = Function.prototype;
820
821/** Used to resolve the decompiled source of functions. */
822var funcToString$2 = funcProto$2.toString;
823
824/**
825 * Converts `func` to its source code.
826 *
827 * @private
828 * @param {Function} func The function to convert.
829 * @returns {string} Returns the source code.
830 */
831function toSource(func) {
832 if (func != null) {
833 try {
834 return funcToString$2.call(func);
835 } catch (e) {}
836 try {
837 return (func + '');
838 } catch (e) {}
839 }
840 return '';
841}
842
843var _toSource = toSource;
844
845/**
846 * Used to match `RegExp`
847 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
848 */
849var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
850
851/** Used to detect host constructors (Safari). */
852var reIsHostCtor = /^\[object .+?Constructor\]$/;
853
854/** Used for built-in method references. */
855var funcProto$1 = Function.prototype;
856var objectProto$5 = Object.prototype;
857
858/** Used to resolve the decompiled source of functions. */
859var funcToString$1 = funcProto$1.toString;
860
861/** Used to check objects for own properties. */
862var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
863
864/** Used to detect if a method is native. */
865var reIsNative = RegExp('^' +
866 funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar, '\\$&')
867 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
868);
869
870/**
871 * The base implementation of `_.isNative` without bad shim checks.
872 *
873 * @private
874 * @param {*} value The value to check.
875 * @returns {boolean} Returns `true` if `value` is a native function,
876 * else `false`.
877 */
878function baseIsNative(value) {
879 if (!isObject_1(value) || _isMasked(value)) {
880 return false;
881 }
882 var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
883 return pattern.test(_toSource(value));
884}
885
886var _baseIsNative = baseIsNative;
887
888/**
889 * Gets the value at `key` of `object`.
890 *
891 * @private
892 * @param {Object} [object] The object to query.
893 * @param {string} key The key of the property to get.
894 * @returns {*} Returns the property value.
895 */
896function getValue(object, key) {
897 return object == null ? undefined : object[key];
898}
899
900var _getValue = getValue;
901
902/**
903 * Gets the native function at `key` of `object`.
904 *
905 * @private
906 * @param {Object} object The object to query.
907 * @param {string} key The key of the method to get.
908 * @returns {*} Returns the function if it's native, else `undefined`.
909 */
910function getNative(object, key) {
911 var value = _getValue(object, key);
912 return _baseIsNative(value) ? value : undefined;
913}
914
915var _getNative = getNative;
916
917/* Built-in method references that are verified to be native. */
918var nativeCreate = _getNative(Object, 'create');
919
920var _nativeCreate = nativeCreate;
921
922/**
923 * Removes all key-value entries from the hash.
924 *
925 * @private
926 * @name clear
927 * @memberOf Hash
928 */
929function hashClear() {
930 this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
931 this.size = 0;
932}
933
934var _hashClear = hashClear;
935
936/**
937 * Removes `key` and its value from the hash.
938 *
939 * @private
940 * @name delete
941 * @memberOf Hash
942 * @param {Object} hash The hash to modify.
943 * @param {string} key The key of the value to remove.
944 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
945 */
946function hashDelete(key) {
947 var result = this.has(key) && delete this.__data__[key];
948 this.size -= result ? 1 : 0;
949 return result;
950}
951
952var _hashDelete = hashDelete;
953
954/** Used to stand-in for `undefined` hash values. */
955var HASH_UNDEFINED = '__lodash_hash_undefined__';
956
957/** Used for built-in method references. */
958var objectProto$6 = Object.prototype;
959
960/** Used to check objects for own properties. */
961var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
962
963/**
964 * Gets the hash value for `key`.
965 *
966 * @private
967 * @name get
968 * @memberOf Hash
969 * @param {string} key The key of the value to get.
970 * @returns {*} Returns the entry value.
971 */
972function hashGet(key) {
973 var data = this.__data__;
974 if (_nativeCreate) {
975 var result = data[key];
976 return result === HASH_UNDEFINED ? undefined : result;
977 }
978 return hasOwnProperty$4.call(data, key) ? data[key] : undefined;
979}
980
981var _hashGet = hashGet;
982
983/** Used for built-in method references. */
984var objectProto$7 = Object.prototype;
985
986/** Used to check objects for own properties. */
987var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
988
989/**
990 * Checks if a hash value for `key` exists.
991 *
992 * @private
993 * @name has
994 * @memberOf Hash
995 * @param {string} key The key of the entry to check.
996 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
997 */
998function hashHas(key) {
999 var data = this.__data__;
1000 return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
1001}
1002
1003var _hashHas = hashHas;
1004
1005/** Used to stand-in for `undefined` hash values. */
1006var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1007
1008/**
1009 * Sets the hash `key` to `value`.
1010 *
1011 * @private
1012 * @name set
1013 * @memberOf Hash
1014 * @param {string} key The key of the value to set.
1015 * @param {*} value The value to set.
1016 * @returns {Object} Returns the hash instance.
1017 */
1018function hashSet(key, value) {
1019 var data = this.__data__;
1020 this.size += this.has(key) ? 0 : 1;
1021 data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
1022 return this;
1023}
1024
1025var _hashSet = hashSet;
1026
1027/**
1028 * Creates a hash object.
1029 *
1030 * @private
1031 * @constructor
1032 * @param {Array} [entries] The key-value pairs to cache.
1033 */
1034function Hash(entries) {
1035 var index = -1,
1036 length = entries == null ? 0 : entries.length;
1037
1038 this.clear();
1039 while (++index < length) {
1040 var entry = entries[index];
1041 this.set(entry[0], entry[1]);
1042 }
1043}
1044
1045// Add methods to `Hash`.
1046Hash.prototype.clear = _hashClear;
1047Hash.prototype['delete'] = _hashDelete;
1048Hash.prototype.get = _hashGet;
1049Hash.prototype.has = _hashHas;
1050Hash.prototype.set = _hashSet;
1051
1052var _Hash = Hash;
1053
1054/**
1055 * Removes all key-value entries from the list cache.
1056 *
1057 * @private
1058 * @name clear
1059 * @memberOf ListCache
1060 */
1061function listCacheClear() {
1062 this.__data__ = [];
1063 this.size = 0;
1064}
1065
1066var _listCacheClear = listCacheClear;
1067
1068/**
1069 * Performs a
1070 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1071 * comparison between two values to determine if they are equivalent.
1072 *
1073 * @static
1074 * @memberOf _
1075 * @since 4.0.0
1076 * @category Lang
1077 * @param {*} value The value to compare.
1078 * @param {*} other The other value to compare.
1079 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1080 * @example
1081 *
1082 * var object = { 'a': 1 };
1083 * var other = { 'a': 1 };
1084 *
1085 * _.eq(object, object);
1086 * // => true
1087 *
1088 * _.eq(object, other);
1089 * // => false
1090 *
1091 * _.eq('a', 'a');
1092 * // => true
1093 *
1094 * _.eq('a', Object('a'));
1095 * // => false
1096 *
1097 * _.eq(NaN, NaN);
1098 * // => true
1099 */
1100function eq(value, other) {
1101 return value === other || (value !== value && other !== other);
1102}
1103
1104var eq_1 = eq;
1105
1106/**
1107 * Gets the index at which the `key` is found in `array` of key-value pairs.
1108 *
1109 * @private
1110 * @param {Array} array The array to inspect.
1111 * @param {*} key The key to search for.
1112 * @returns {number} Returns the index of the matched value, else `-1`.
1113 */
1114function assocIndexOf(array, key) {
1115 var length = array.length;
1116 while (length--) {
1117 if (eq_1(array[length][0], key)) {
1118 return length;
1119 }
1120 }
1121 return -1;
1122}
1123
1124var _assocIndexOf = assocIndexOf;
1125
1126/** Used for built-in method references. */
1127var arrayProto = Array.prototype;
1128
1129/** Built-in value references. */
1130var splice = arrayProto.splice;
1131
1132/**
1133 * Removes `key` and its value from the list cache.
1134 *
1135 * @private
1136 * @name delete
1137 * @memberOf ListCache
1138 * @param {string} key The key of the value to remove.
1139 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1140 */
1141function listCacheDelete(key) {
1142 var data = this.__data__,
1143 index = _assocIndexOf(data, key);
1144
1145 if (index < 0) {
1146 return false;
1147 }
1148 var lastIndex = data.length - 1;
1149 if (index == lastIndex) {
1150 data.pop();
1151 } else {
1152 splice.call(data, index, 1);
1153 }
1154 --this.size;
1155 return true;
1156}
1157
1158var _listCacheDelete = listCacheDelete;
1159
1160/**
1161 * Gets the list cache value for `key`.
1162 *
1163 * @private
1164 * @name get
1165 * @memberOf ListCache
1166 * @param {string} key The key of the value to get.
1167 * @returns {*} Returns the entry value.
1168 */
1169function listCacheGet(key) {
1170 var data = this.__data__,
1171 index = _assocIndexOf(data, key);
1172
1173 return index < 0 ? undefined : data[index][1];
1174}
1175
1176var _listCacheGet = listCacheGet;
1177
1178/**
1179 * Checks if a list cache value for `key` exists.
1180 *
1181 * @private
1182 * @name has
1183 * @memberOf ListCache
1184 * @param {string} key The key of the entry to check.
1185 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1186 */
1187function listCacheHas(key) {
1188 return _assocIndexOf(this.__data__, key) > -1;
1189}
1190
1191var _listCacheHas = listCacheHas;
1192
1193/**
1194 * Sets the list cache `key` to `value`.
1195 *
1196 * @private
1197 * @name set
1198 * @memberOf ListCache
1199 * @param {string} key The key of the value to set.
1200 * @param {*} value The value to set.
1201 * @returns {Object} Returns the list cache instance.
1202 */
1203function listCacheSet(key, value) {
1204 var data = this.__data__,
1205 index = _assocIndexOf(data, key);
1206
1207 if (index < 0) {
1208 ++this.size;
1209 data.push([key, value]);
1210 } else {
1211 data[index][1] = value;
1212 }
1213 return this;
1214}
1215
1216var _listCacheSet = listCacheSet;
1217
1218/**
1219 * Creates an list cache object.
1220 *
1221 * @private
1222 * @constructor
1223 * @param {Array} [entries] The key-value pairs to cache.
1224 */
1225function ListCache(entries) {
1226 var index = -1,
1227 length = entries == null ? 0 : entries.length;
1228
1229 this.clear();
1230 while (++index < length) {
1231 var entry = entries[index];
1232 this.set(entry[0], entry[1]);
1233 }
1234}
1235
1236// Add methods to `ListCache`.
1237ListCache.prototype.clear = _listCacheClear;
1238ListCache.prototype['delete'] = _listCacheDelete;
1239ListCache.prototype.get = _listCacheGet;
1240ListCache.prototype.has = _listCacheHas;
1241ListCache.prototype.set = _listCacheSet;
1242
1243var _ListCache = ListCache;
1244
1245/* Built-in method references that are verified to be native. */
1246var Map = _getNative(_root, 'Map');
1247
1248var _Map = Map;
1249
1250/**
1251 * Removes all key-value entries from the map.
1252 *
1253 * @private
1254 * @name clear
1255 * @memberOf MapCache
1256 */
1257function mapCacheClear() {
1258 this.size = 0;
1259 this.__data__ = {
1260 'hash': new _Hash,
1261 'map': new (_Map || _ListCache),
1262 'string': new _Hash
1263 };
1264}
1265
1266var _mapCacheClear = mapCacheClear;
1267
1268/**
1269 * Checks if `value` is suitable for use as unique object key.
1270 *
1271 * @private
1272 * @param {*} value The value to check.
1273 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1274 */
1275function isKeyable(value) {
1276 var type = typeof value;
1277 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1278 ? (value !== '__proto__')
1279 : (value === null);
1280}
1281
1282var _isKeyable = isKeyable;
1283
1284/**
1285 * Gets the data for `map`.
1286 *
1287 * @private
1288 * @param {Object} map The map to query.
1289 * @param {string} key The reference key.
1290 * @returns {*} Returns the map data.
1291 */
1292function getMapData(map, key) {
1293 var data = map.__data__;
1294 return _isKeyable(key)
1295 ? data[typeof key == 'string' ? 'string' : 'hash']
1296 : data.map;
1297}
1298
1299var _getMapData = getMapData;
1300
1301/**
1302 * Removes `key` and its value from the map.
1303 *
1304 * @private
1305 * @name delete
1306 * @memberOf MapCache
1307 * @param {string} key The key of the value to remove.
1308 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1309 */
1310function mapCacheDelete(key) {
1311 var result = _getMapData(this, key)['delete'](key);
1312 this.size -= result ? 1 : 0;
1313 return result;
1314}
1315
1316var _mapCacheDelete = mapCacheDelete;
1317
1318/**
1319 * Gets the map value for `key`.
1320 *
1321 * @private
1322 * @name get
1323 * @memberOf MapCache
1324 * @param {string} key The key of the value to get.
1325 * @returns {*} Returns the entry value.
1326 */
1327function mapCacheGet(key) {
1328 return _getMapData(this, key).get(key);
1329}
1330
1331var _mapCacheGet = mapCacheGet;
1332
1333/**
1334 * Checks if a map value for `key` exists.
1335 *
1336 * @private
1337 * @name has
1338 * @memberOf MapCache
1339 * @param {string} key The key of the entry to check.
1340 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1341 */
1342function mapCacheHas(key) {
1343 return _getMapData(this, key).has(key);
1344}
1345
1346var _mapCacheHas = mapCacheHas;
1347
1348/**
1349 * Sets the map `key` to `value`.
1350 *
1351 * @private
1352 * @name set
1353 * @memberOf MapCache
1354 * @param {string} key The key of the value to set.
1355 * @param {*} value The value to set.
1356 * @returns {Object} Returns the map cache instance.
1357 */
1358function mapCacheSet(key, value) {
1359 var data = _getMapData(this, key),
1360 size = data.size;
1361
1362 data.set(key, value);
1363 this.size += data.size == size ? 0 : 1;
1364 return this;
1365}
1366
1367var _mapCacheSet = mapCacheSet;
1368
1369/**
1370 * Creates a map cache object to store key-value pairs.
1371 *
1372 * @private
1373 * @constructor
1374 * @param {Array} [entries] The key-value pairs to cache.
1375 */
1376function MapCache(entries) {
1377 var index = -1,
1378 length = entries == null ? 0 : entries.length;
1379
1380 this.clear();
1381 while (++index < length) {
1382 var entry = entries[index];
1383 this.set(entry[0], entry[1]);
1384 }
1385}
1386
1387// Add methods to `MapCache`.
1388MapCache.prototype.clear = _mapCacheClear;
1389MapCache.prototype['delete'] = _mapCacheDelete;
1390MapCache.prototype.get = _mapCacheGet;
1391MapCache.prototype.has = _mapCacheHas;
1392MapCache.prototype.set = _mapCacheSet;
1393
1394var _MapCache = MapCache;
1395
1396/** Error message constants. */
1397var FUNC_ERROR_TEXT = 'Expected a function';
1398
1399/**
1400 * Creates a function that memoizes the result of `func`. If `resolver` is
1401 * provided, it determines the cache key for storing the result based on the
1402 * arguments provided to the memoized function. By default, the first argument
1403 * provided to the memoized function is used as the map cache key. The `func`
1404 * is invoked with the `this` binding of the memoized function.
1405 *
1406 * **Note:** The cache is exposed as the `cache` property on the memoized
1407 * function. Its creation may be customized by replacing the `_.memoize.Cache`
1408 * constructor with one whose instances implement the
1409 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
1410 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
1411 *
1412 * @static
1413 * @memberOf _
1414 * @since 0.1.0
1415 * @category Function
1416 * @param {Function} func The function to have its output memoized.
1417 * @param {Function} [resolver] The function to resolve the cache key.
1418 * @returns {Function} Returns the new memoized function.
1419 * @example
1420 *
1421 * var object = { 'a': 1, 'b': 2 };
1422 * var other = { 'c': 3, 'd': 4 };
1423 *
1424 * var values = _.memoize(_.values);
1425 * values(object);
1426 * // => [1, 2]
1427 *
1428 * values(other);
1429 * // => [3, 4]
1430 *
1431 * object.a = 2;
1432 * values(object);
1433 * // => [1, 2]
1434 *
1435 * // Modify the result cache.
1436 * values.cache.set(object, ['a', 'b']);
1437 * values(object);
1438 * // => ['a', 'b']
1439 *
1440 * // Replace `_.memoize.Cache`.
1441 * _.memoize.Cache = WeakMap;
1442 */
1443function memoize(func, resolver) {
1444 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
1445 throw new TypeError(FUNC_ERROR_TEXT);
1446 }
1447 var memoized = function() {
1448 var args = arguments,
1449 key = resolver ? resolver.apply(this, args) : args[0],
1450 cache = memoized.cache;
1451
1452 if (cache.has(key)) {
1453 return cache.get(key);
1454 }
1455 var result = func.apply(this, args);
1456 memoized.cache = cache.set(key, result) || cache;
1457 return result;
1458 };
1459 memoized.cache = new (memoize.Cache || _MapCache);
1460 return memoized;
1461}
1462
1463// Expose `MapCache`.
1464memoize.Cache = _MapCache;
1465
1466var memoize_1 = memoize;
1467
1468/** Used as the maximum memoize cache size. */
1469var MAX_MEMOIZE_SIZE = 500;
1470
1471/**
1472 * A specialized version of `_.memoize` which clears the memoized function's
1473 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
1474 *
1475 * @private
1476 * @param {Function} func The function to have its output memoized.
1477 * @returns {Function} Returns the new memoized function.
1478 */
1479function memoizeCapped(func) {
1480 var result = memoize_1(func, function(key) {
1481 if (cache.size === MAX_MEMOIZE_SIZE) {
1482 cache.clear();
1483 }
1484 return key;
1485 });
1486
1487 var cache = result.cache;
1488 return result;
1489}
1490
1491var _memoizeCapped = memoizeCapped;
1492
1493/** Used to match property names within property paths. */
1494var reLeadingDot = /^\./;
1495var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1496
1497/** Used to match backslashes in property paths. */
1498var reEscapeChar = /\\(\\)?/g;
1499
1500/**
1501 * Converts `string` to a property path array.
1502 *
1503 * @private
1504 * @param {string} string The string to convert.
1505 * @returns {Array} Returns the property path array.
1506 */
1507var stringToPath = _memoizeCapped(function(string) {
1508 var result = [];
1509 if (reLeadingDot.test(string)) {
1510 result.push('');
1511 }
1512 string.replace(rePropName, function(match, number, quote, string) {
1513 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
1514 });
1515 return result;
1516});
1517
1518var _stringToPath = stringToPath;
1519
1520/**
1521 * A specialized version of `_.map` for arrays without support for iteratee
1522 * shorthands.
1523 *
1524 * @private
1525 * @param {Array} [array] The array to iterate over.
1526 * @param {Function} iteratee The function invoked per iteration.
1527 * @returns {Array} Returns the new mapped array.
1528 */
1529function arrayMap(array, iteratee) {
1530 var index = -1,
1531 length = array == null ? 0 : array.length,
1532 result = Array(length);
1533
1534 while (++index < length) {
1535 result[index] = iteratee(array[index], index, array);
1536 }
1537 return result;
1538}
1539
1540var _arrayMap = arrayMap;
1541
1542/** Used as references for various `Number` constants. */
1543var INFINITY = 1 / 0;
1544
1545/** Used to convert symbols to primitives and strings. */
1546var symbolProto = _Symbol ? _Symbol.prototype : undefined;
1547var symbolToString = symbolProto ? symbolProto.toString : undefined;
1548
1549/**
1550 * The base implementation of `_.toString` which doesn't convert nullish
1551 * values to empty strings.
1552 *
1553 * @private
1554 * @param {*} value The value to process.
1555 * @returns {string} Returns the string.
1556 */
1557function baseToString(value) {
1558 // Exit early for strings to avoid a performance hit in some environments.
1559 if (typeof value == 'string') {
1560 return value;
1561 }
1562 if (isArray_1(value)) {
1563 // Recursively convert values (susceptible to call stack limits).
1564 return _arrayMap(value, baseToString) + '';
1565 }
1566 if (isSymbol_1(value)) {
1567 return symbolToString ? symbolToString.call(value) : '';
1568 }
1569 var result = (value + '');
1570 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1571}
1572
1573var _baseToString = baseToString;
1574
1575/**
1576 * Converts `value` to a string. An empty string is returned for `null`
1577 * and `undefined` values. The sign of `-0` is preserved.
1578 *
1579 * @static
1580 * @memberOf _
1581 * @since 4.0.0
1582 * @category Lang
1583 * @param {*} value The value to convert.
1584 * @returns {string} Returns the converted string.
1585 * @example
1586 *
1587 * _.toString(null);
1588 * // => ''
1589 *
1590 * _.toString(-0);
1591 * // => '-0'
1592 *
1593 * _.toString([1, 2, 3]);
1594 * // => '1,2,3'
1595 */
1596function toString(value) {
1597 return value == null ? '' : _baseToString(value);
1598}
1599
1600var toString_1 = toString;
1601
1602/**
1603 * Casts `value` to a path array if it's not one.
1604 *
1605 * @private
1606 * @param {*} value The value to inspect.
1607 * @param {Object} [object] The object to query keys on.
1608 * @returns {Array} Returns the cast property path array.
1609 */
1610function castPath(value, object) {
1611 if (isArray_1(value)) {
1612 return value;
1613 }
1614 return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
1615}
1616
1617var _castPath = castPath;
1618
1619/** Used as references for various `Number` constants. */
1620var INFINITY$1 = 1 / 0;
1621
1622/**
1623 * Converts `value` to a string key if it's not a string or symbol.
1624 *
1625 * @private
1626 * @param {*} value The value to inspect.
1627 * @returns {string|symbol} Returns the key.
1628 */
1629function toKey(value) {
1630 if (typeof value == 'string' || isSymbol_1(value)) {
1631 return value;
1632 }
1633 var result = (value + '');
1634 return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
1635}
1636
1637var _toKey = toKey;
1638
1639/**
1640 * The base implementation of `_.get` without support for default values.
1641 *
1642 * @private
1643 * @param {Object} object The object to query.
1644 * @param {Array|string} path The path of the property to get.
1645 * @returns {*} Returns the resolved value.
1646 */
1647function baseGet(object, path) {
1648 path = _castPath(path, object);
1649
1650 var index = 0,
1651 length = path.length;
1652
1653 while (object != null && index < length) {
1654 object = object[_toKey(path[index++])];
1655 }
1656 return (index && index == length) ? object : undefined;
1657}
1658
1659var _baseGet = baseGet;
1660
1661/**
1662 * Gets the value at `path` of `object`. If the resolved value is
1663 * `undefined`, the `defaultValue` is returned in its place.
1664 *
1665 * @static
1666 * @memberOf _
1667 * @since 3.7.0
1668 * @category Object
1669 * @param {Object} object The object to query.
1670 * @param {Array|string} path The path of the property to get.
1671 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
1672 * @returns {*} Returns the resolved value.
1673 * @example
1674 *
1675 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
1676 *
1677 * _.get(object, 'a[0].b.c');
1678 * // => 3
1679 *
1680 * _.get(object, ['a', '0', 'b', 'c']);
1681 * // => 3
1682 *
1683 * _.get(object, 'a.b.c', 'default');
1684 * // => 'default'
1685 */
1686function get(object, path, defaultValue) {
1687 var result = object == null ? undefined : _baseGet(object, path);
1688 return result === undefined ? defaultValue : result;
1689}
1690
1691var get_1 = get;
1692
1693var DEFAULT_REDUCER = '';
1694function changeDefaultReducer(newReducer) {
1695 DEFAULT_REDUCER = newReducer;
1696}
1697function checkValue(result, defaultValue) {
1698 return result === undefined || result === null ? defaultValue : result;
1699}
1700/**
1701 * @overview Deep lookup inside state
1702 * @param {Object} state – current redux state object
1703 * @param {Any} params – argument with which action was dispatched
1704 * @param {Function} nesting – function to create nested data inside store
1705 * @param {String} tileName – string to access module data
1706 * @return {Object} – stored data
1707 */
1708function lookup(_a) {
1709 var state = _a.state,
1710 params = _a.params,
1711 nesting = _a.nesting,
1712 tileName = _a.tileName,
1713 selectorFallback = _a.selectorFallback;
1714 var path = [];
1715 var topReducer = DEFAULT_REDUCER;
1716 if (nesting) {
1717 path = nesting(params);
1718 }
1719 var nestedNames = ensureArray(tileName);
1720 var topReducerArray = Boolean(topReducer) ? [topReducer] : [];
1721 return checkValue(get_1(state, topReducerArray.concat(nestedNames, path)), selectorFallback);
1722}
1723/**
1724 * @overview check passed arguments to the Selector function.
1725 * The single purpose is for readability, to throw sane error
1726 * @param {Object} state – redux state
1727 * @param {Any} params – argument with which action was dispatched
1728 * @param {String} tileName – string to access module data
1729 * @param {Function} fn – function to invoke if check was passed
1730 * @return {Any} – result of function invokation
1731 */
1732function checkArguments(_a) {
1733 var state = _a.state,
1734 params = _a.params,
1735 tileName = _a.tileName,
1736 fn = _a.fn;
1737 if (!state) {
1738 throw new Error('\n Error in Redux-Tiles Selector \u2013 you have to provide\n state as a first argument!. Error in "' + createType({ type: tileName }) + "\" tile.");
1739 }
1740 return fn(state, params);
1741}
1742/**
1743 * @overview function to create selectors for modules
1744 * @param {String} tileName – string to access module data
1745 * @param {Function} nesting – function to create nested data inside store
1746 * @return {Object} – object with selectors for all and specific data
1747 */
1748function createSelectors(_a) {
1749 var tileName = _a.tileName,
1750 nesting = _a.nesting,
1751 selectorFallback = _a.selectorFallback;
1752 var _getAll = function _getAll(state) {
1753 var topReducerArray = Boolean(DEFAULT_REDUCER) ? [DEFAULT_REDUCER] : [];
1754 return checkValue(get_1(state, topReducerArray.concat(ensureArray(tileName))));
1755 };
1756 var getSpecific = function getSpecific(state, params) {
1757 return lookup({ state: state, params: params, nesting: nesting, tileName: tileName, selectorFallback: selectorFallback });
1758 };
1759 return {
1760 getAll: function getAll(state) {
1761 return checkArguments({ state: state, tileName: tileName, fn: _getAll });
1762 },
1763 get: function get(state, params) {
1764 return checkArguments({ state: state, params: params, tileName: tileName, fn: getSpecific });
1765 }
1766 };
1767}
1768
1769function createNestedReducers(value) {
1770 return combineReducers(Object.keys(value).reduce(function (hash, key) {
1771 var elem = value[key];
1772 hash[key] = isFunction_1(elem) ? elem : createNestedReducers(elem);
1773 return hash;
1774 }, {}));
1775}
1776function createReducers(modules, topReducer) {
1777 if (topReducer === void 0) {
1778 topReducer = DEFAULT_REDUCER;
1779 }
1780 if (topReducer !== DEFAULT_REDUCER) {
1781 changeDefaultReducer(topReducer);
1782 }
1783 var nestedModules = iterate(modules).reduce(function (hash, module) {
1784 populateHash(hash, module.tileName, module.reducer);
1785 return hash;
1786 }, {});
1787 return createNestedReducers(nestedModules);
1788}
1789
1790function createSelectors$1(tiles) {
1791 return iterate(tiles).reduce(function (hash, tile) {
1792 var selector = tile.selectors.get;
1793 selector.getAll = tile.selectors.getAll;
1794 populateHash(hash, tile.tileName, selector);
1795 return hash;
1796 }, {});
1797}
1798
1799function createEntities(tiles, topReducer) {
1800 return {
1801 actions: createActions(tiles),
1802 reducer: createReducers(tiles, topReducer),
1803 selectors: createSelectors$1(tiles)
1804 };
1805}
1806
1807function waitTiles(promisesStorage) {
1808 var promises = Object.keys(promisesStorage).map(function (key) {
1809 return promisesStorage[key];
1810 }).filter(Boolean);
1811 return Promise.all(promises);
1812}
1813
1814var __assign = undefined && undefined.__assign || Object.assign || function (t) {
1815 for (var s, i = 1, n = arguments.length; i < n; i++) {
1816 s = arguments[i];
1817 for (var p in s) {
1818 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1819 }
1820 }
1821 return t;
1822};
1823function createMiddleware(paramsToInject) {
1824 if (paramsToInject === void 0) {
1825 paramsToInject = {};
1826 }
1827 var promisesStorage = {};
1828 var middleware = function middleware(_a) {
1829 var dispatch = _a.dispatch,
1830 getState = _a.getState;
1831 return function (next) {
1832 return function (action) {
1833 if (typeof action === 'function') {
1834 return action(__assign({ dispatch: dispatch, getState: getState, promisesStorage: promisesStorage }, paramsToInject));
1835 }
1836 return next(action);
1837 };
1838 };
1839 };
1840 return {
1841 middleware: middleware,
1842 waitTiles: waitTiles.bind(null, promisesStorage)
1843 };
1844}
1845
1846var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
1847 return typeof obj;
1848} : function (obj) {
1849 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1850};
1851
1852var __assign$2 = undefined && undefined.__assign || Object.assign || function (t) {
1853 for (var s, i = 1, n = arguments.length; i < n; i++) {
1854 s = arguments[i];
1855 for (var p in s) {
1856 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1857 }
1858 }
1859 return t;
1860};
1861var __rest = undefined && undefined.__rest || function (s, e) {
1862 var t = {};
1863 for (var p in s) {
1864 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1865 }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1866 if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
1867 }return t;
1868};
1869function proccessMiddleware(args) {
1870 if (args.length === 3) {
1871 // let's assume it is redux-thunk with extra argument
1872 return __assign$2({ dispatch: args[0], getState: args[1] }, args[2]);
1873 } else if (args.length === 2) {
1874 // likely it is redux-thunk
1875 return { dispatch: args[0], getState: args[1] };
1876 } else if (args.length === 1 && _typeof(args[0]) === 'object') {
1877 // our own middleware
1878 return args[0];
1879 }
1880 // no idea what it is
1881 throw new Error('Redux-Tiles expects own middleware, or redux-thunk');
1882}
1883function shouldBeFetched(_a) {
1884 var getState = _a.getState,
1885 selectors = _a.selectors,
1886 params = _a.params;
1887 var _b = selectors.get(getState(), params),
1888 isPending = _b.isPending,
1889 data = _b.data,
1890 error = _b.error;
1891 // == intentionally to check on empty objects
1892 return error == null && data == null && isPending !== true;
1893}
1894function handleMiddleware(fn) {
1895 return function (fnParams, additionalParams) {
1896 return function () {
1897 var args = [];
1898 for (var _i = 0; _i < arguments.length; _i++) {
1899 args[_i] = arguments[_i];
1900 }
1901 return fn(proccessMiddleware(args), fnParams, additionalParams);
1902 };
1903 };
1904}
1905function asyncAction(_a) {
1906 var START = _a.START,
1907 SUCCESS = _a.SUCCESS,
1908 FAILURE = _a.FAILURE,
1909 fn = _a.fn,
1910 type = _a.type,
1911 caching = _a.caching,
1912 nesting = _a.nesting,
1913 selectors = _a.selectors;
1914 return handleMiddleware(function (_a, params, _b) {
1915 var forceAsync = (_b === void 0 ? {} : _b).forceAsync;
1916 var dispatch = _a.dispatch,
1917 getState = _a.getState,
1918 _c = _a.promisesStorage,
1919 promisesStorage = _c === void 0 ? {} : _c,
1920 middlewares = __rest(_a, ["dispatch", "getState", "promisesStorage"]);
1921 var path = nesting ? nesting(params) : null;
1922 var getIdentificator = createType({ type: type, path: path });
1923 if (caching) {
1924 var activePromise = promisesStorage[getIdentificator];
1925 if (activePromise) {
1926 return activePromise;
1927 }
1928 }
1929 if (caching && !forceAsync) {
1930 var isFetchingNeeded = shouldBeFetched({ getState: getState, selectors: selectors, params: params });
1931 if (!isFetchingNeeded) {
1932 return Promise.resolve();
1933 }
1934 }
1935 dispatch({
1936 type: START,
1937 payload: { path: path }
1938 });
1939 var promise = fn(__assign$2({ params: params, dispatch: dispatch, getState: getState }, middlewares)).then(function (data) {
1940 dispatch({
1941 type: SUCCESS,
1942 payload: { path: path, data: data }
1943 });
1944 promisesStorage[getIdentificator] = undefined;
1945 }).catch(function (error) {
1946 dispatch({
1947 error: error,
1948 type: FAILURE,
1949 payload: { path: path }
1950 });
1951 promisesStorage[getIdentificator] = undefined;
1952 });
1953 promisesStorage[getIdentificator] = promise;
1954 return promise;
1955 });
1956}
1957function createResetAction(_a) {
1958 var type = _a.type;
1959 return handleMiddleware(function (_a) {
1960 var dispatch = _a.dispatch;
1961 return dispatch({ type: type });
1962 });
1963}
1964function syncAction(_a) {
1965 var SET = _a.SET,
1966 fn = _a.fn,
1967 nesting = _a.nesting;
1968 return handleMiddleware(function (_a, params) {
1969 var dispatch = _a.dispatch,
1970 getState = _a.getState,
1971 middlewares = __rest(_a, ["dispatch", "getState"]);
1972 var path = nesting ? nesting(params) : null;
1973 return dispatch({
1974 type: SET,
1975 payload: {
1976 path: path,
1977 data: fn(__assign$2({ params: params, dispatch: dispatch, getState: getState }, middlewares))
1978 }
1979 });
1980 });
1981}
1982
1983var defineProperty$1 = (function() {
1984 try {
1985 var func = _getNative(Object, 'defineProperty');
1986 func({}, '', {});
1987 return func;
1988 } catch (e) {}
1989}());
1990
1991var _defineProperty = defineProperty$1;
1992
1993/**
1994 * The base implementation of `assignValue` and `assignMergeValue` without
1995 * value checks.
1996 *
1997 * @private
1998 * @param {Object} object The object to modify.
1999 * @param {string} key The key of the property to assign.
2000 * @param {*} value The value to assign.
2001 */
2002function baseAssignValue(object, key, value) {
2003 if (key == '__proto__' && _defineProperty) {
2004 _defineProperty(object, key, {
2005 'configurable': true,
2006 'enumerable': true,
2007 'value': value,
2008 'writable': true
2009 });
2010 } else {
2011 object[key] = value;
2012 }
2013}
2014
2015var _baseAssignValue = baseAssignValue;
2016
2017/**
2018 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
2019 *
2020 * @private
2021 * @param {boolean} [fromRight] Specify iterating from right to left.
2022 * @returns {Function} Returns the new base function.
2023 */
2024function createBaseFor(fromRight) {
2025 return function(object, iteratee, keysFunc) {
2026 var index = -1,
2027 iterable = Object(object),
2028 props = keysFunc(object),
2029 length = props.length;
2030
2031 while (length--) {
2032 var key = props[fromRight ? length : ++index];
2033 if (iteratee(iterable[key], key, iterable) === false) {
2034 break;
2035 }
2036 }
2037 return object;
2038 };
2039}
2040
2041var _createBaseFor = createBaseFor;
2042
2043/**
2044 * The base implementation of `baseForOwn` which iterates over `object`
2045 * properties returned by `keysFunc` and invokes `iteratee` for each property.
2046 * Iteratee functions may exit iteration early by explicitly returning `false`.
2047 *
2048 * @private
2049 * @param {Object} object The object to iterate over.
2050 * @param {Function} iteratee The function invoked per iteration.
2051 * @param {Function} keysFunc The function to get the keys of `object`.
2052 * @returns {Object} Returns `object`.
2053 */
2054var baseFor = _createBaseFor();
2055
2056var _baseFor = baseFor;
2057
2058/**
2059 * The base implementation of `_.times` without support for iteratee shorthands
2060 * or max array length checks.
2061 *
2062 * @private
2063 * @param {number} n The number of times to invoke `iteratee`.
2064 * @param {Function} iteratee The function invoked per iteration.
2065 * @returns {Array} Returns the array of results.
2066 */
2067function baseTimes(n, iteratee) {
2068 var index = -1,
2069 result = Array(n);
2070
2071 while (++index < n) {
2072 result[index] = iteratee(index);
2073 }
2074 return result;
2075}
2076
2077var _baseTimes = baseTimes;
2078
2079/** `Object#toString` result references. */
2080var argsTag = '[object Arguments]';
2081
2082/**
2083 * The base implementation of `_.isArguments`.
2084 *
2085 * @private
2086 * @param {*} value The value to check.
2087 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2088 */
2089function baseIsArguments(value) {
2090 return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
2091}
2092
2093var _baseIsArguments = baseIsArguments;
2094
2095/** Used for built-in method references. */
2096var objectProto$9 = Object.prototype;
2097
2098/** Used to check objects for own properties. */
2099var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
2100
2101/** Built-in value references. */
2102var propertyIsEnumerable = objectProto$9.propertyIsEnumerable;
2103
2104/**
2105 * Checks if `value` is likely an `arguments` object.
2106 *
2107 * @static
2108 * @memberOf _
2109 * @since 0.1.0
2110 * @category Lang
2111 * @param {*} value The value to check.
2112 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2113 * else `false`.
2114 * @example
2115 *
2116 * _.isArguments(function() { return arguments; }());
2117 * // => true
2118 *
2119 * _.isArguments([1, 2, 3]);
2120 * // => false
2121 */
2122var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
2123 return isObjectLike_1(value) && hasOwnProperty$7.call(value, 'callee') &&
2124 !propertyIsEnumerable.call(value, 'callee');
2125};
2126
2127var isArguments_1 = isArguments;
2128
2129/**
2130 * This method returns `false`.
2131 *
2132 * @static
2133 * @memberOf _
2134 * @since 4.13.0
2135 * @category Util
2136 * @returns {boolean} Returns `false`.
2137 * @example
2138 *
2139 * _.times(2, _.stubFalse);
2140 * // => [false, false]
2141 */
2142function stubFalse() {
2143 return false;
2144}
2145
2146var stubFalse_1 = stubFalse;
2147
2148var isBuffer_1 = createCommonjsModule(function (module, exports) {
2149/** Detect free variable `exports`. */
2150var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
2151
2152/** Detect free variable `module`. */
2153var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2154
2155/** Detect the popular CommonJS extension `module.exports`. */
2156var moduleExports = freeModule && freeModule.exports === freeExports;
2157
2158/** Built-in value references. */
2159var Buffer = moduleExports ? _root.Buffer : undefined;
2160
2161/* Built-in method references for those with the same name as other `lodash` methods. */
2162var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
2163
2164/**
2165 * Checks if `value` is a buffer.
2166 *
2167 * @static
2168 * @memberOf _
2169 * @since 4.3.0
2170 * @category Lang
2171 * @param {*} value The value to check.
2172 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
2173 * @example
2174 *
2175 * _.isBuffer(new Buffer(2));
2176 * // => true
2177 *
2178 * _.isBuffer(new Uint8Array(2));
2179 * // => false
2180 */
2181var isBuffer = nativeIsBuffer || stubFalse_1;
2182
2183module.exports = isBuffer;
2184});
2185
2186/** Used as references for various `Number` constants. */
2187var MAX_SAFE_INTEGER = 9007199254740991;
2188
2189/** Used to detect unsigned integer values. */
2190var reIsUint = /^(?:0|[1-9]\d*)$/;
2191
2192/**
2193 * Checks if `value` is a valid array-like index.
2194 *
2195 * @private
2196 * @param {*} value The value to check.
2197 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2198 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2199 */
2200function isIndex(value, length) {
2201 length = length == null ? MAX_SAFE_INTEGER : length;
2202 return !!length &&
2203 (typeof value == 'number' || reIsUint.test(value)) &&
2204 (value > -1 && value % 1 == 0 && value < length);
2205}
2206
2207var _isIndex = isIndex;
2208
2209/** Used as references for various `Number` constants. */
2210var MAX_SAFE_INTEGER$1 = 9007199254740991;
2211
2212/**
2213 * Checks if `value` is a valid array-like length.
2214 *
2215 * **Note:** This method is loosely based on
2216 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2217 *
2218 * @static
2219 * @memberOf _
2220 * @since 4.0.0
2221 * @category Lang
2222 * @param {*} value The value to check.
2223 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2224 * @example
2225 *
2226 * _.isLength(3);
2227 * // => true
2228 *
2229 * _.isLength(Number.MIN_VALUE);
2230 * // => false
2231 *
2232 * _.isLength(Infinity);
2233 * // => false
2234 *
2235 * _.isLength('3');
2236 * // => false
2237 */
2238function isLength(value) {
2239 return typeof value == 'number' &&
2240 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
2241}
2242
2243var isLength_1 = isLength;
2244
2245/** `Object#toString` result references. */
2246var argsTag$1 = '[object Arguments]';
2247var arrayTag = '[object Array]';
2248var boolTag = '[object Boolean]';
2249var dateTag = '[object Date]';
2250var errorTag = '[object Error]';
2251var funcTag$1 = '[object Function]';
2252var mapTag = '[object Map]';
2253var numberTag = '[object Number]';
2254var objectTag$1 = '[object Object]';
2255var regexpTag = '[object RegExp]';
2256var setTag = '[object Set]';
2257var stringTag$1 = '[object String]';
2258var weakMapTag = '[object WeakMap]';
2259
2260var arrayBufferTag = '[object ArrayBuffer]';
2261var dataViewTag = '[object DataView]';
2262var float32Tag = '[object Float32Array]';
2263var float64Tag = '[object Float64Array]';
2264var int8Tag = '[object Int8Array]';
2265var int16Tag = '[object Int16Array]';
2266var int32Tag = '[object Int32Array]';
2267var uint8Tag = '[object Uint8Array]';
2268var uint8ClampedTag = '[object Uint8ClampedArray]';
2269var uint16Tag = '[object Uint16Array]';
2270var uint32Tag = '[object Uint32Array]';
2271
2272/** Used to identify `toStringTag` values of typed arrays. */
2273var typedArrayTags = {};
2274typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
2275typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
2276typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
2277typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
2278typedArrayTags[uint32Tag] = true;
2279typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
2280typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
2281typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
2282typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
2283typedArrayTags[mapTag] = typedArrayTags[numberTag] =
2284typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
2285typedArrayTags[setTag] = typedArrayTags[stringTag$1] =
2286typedArrayTags[weakMapTag] = false;
2287
2288/**
2289 * The base implementation of `_.isTypedArray` without Node.js optimizations.
2290 *
2291 * @private
2292 * @param {*} value The value to check.
2293 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2294 */
2295function baseIsTypedArray(value) {
2296 return isObjectLike_1(value) &&
2297 isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
2298}
2299
2300var _baseIsTypedArray = baseIsTypedArray;
2301
2302/**
2303 * The base implementation of `_.unary` without support for storing metadata.
2304 *
2305 * @private
2306 * @param {Function} func The function to cap arguments for.
2307 * @returns {Function} Returns the new capped function.
2308 */
2309function baseUnary(func) {
2310 return function(value) {
2311 return func(value);
2312 };
2313}
2314
2315var _baseUnary = baseUnary;
2316
2317var _nodeUtil = createCommonjsModule(function (module, exports) {
2318/** Detect free variable `exports`. */
2319var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
2320
2321/** Detect free variable `module`. */
2322var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2323
2324/** Detect the popular CommonJS extension `module.exports`. */
2325var moduleExports = freeModule && freeModule.exports === freeExports;
2326
2327/** Detect free variable `process` from Node.js. */
2328var freeProcess = moduleExports && _freeGlobal.process;
2329
2330/** Used to access faster Node.js helpers. */
2331var nodeUtil = (function() {
2332 try {
2333 return freeProcess && freeProcess.binding && freeProcess.binding('util');
2334 } catch (e) {}
2335}());
2336
2337module.exports = nodeUtil;
2338});
2339
2340/* Node.js helper references. */
2341var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
2342
2343/**
2344 * Checks if `value` is classified as a typed array.
2345 *
2346 * @static
2347 * @memberOf _
2348 * @since 3.0.0
2349 * @category Lang
2350 * @param {*} value The value to check.
2351 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2352 * @example
2353 *
2354 * _.isTypedArray(new Uint8Array);
2355 * // => true
2356 *
2357 * _.isTypedArray([]);
2358 * // => false
2359 */
2360var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
2361
2362var isTypedArray_1 = isTypedArray;
2363
2364/** Used for built-in method references. */
2365var objectProto$8 = Object.prototype;
2366
2367/** Used to check objects for own properties. */
2368var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
2369
2370/**
2371 * Creates an array of the enumerable property names of the array-like `value`.
2372 *
2373 * @private
2374 * @param {*} value The value to query.
2375 * @param {boolean} inherited Specify returning inherited property names.
2376 * @returns {Array} Returns the array of property names.
2377 */
2378function arrayLikeKeys(value, inherited) {
2379 var isArr = isArray_1(value),
2380 isArg = !isArr && isArguments_1(value),
2381 isBuff = !isArr && !isArg && isBuffer_1(value),
2382 isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
2383 skipIndexes = isArr || isArg || isBuff || isType,
2384 result = skipIndexes ? _baseTimes(value.length, String) : [],
2385 length = result.length;
2386
2387 for (var key in value) {
2388 if ((inherited || hasOwnProperty$6.call(value, key)) &&
2389 !(skipIndexes && (
2390 // Safari 9 has enumerable `arguments.length` in strict mode.
2391 key == 'length' ||
2392 // Node.js 0.10 has enumerable non-index properties on buffers.
2393 (isBuff && (key == 'offset' || key == 'parent')) ||
2394 // PhantomJS 2 has enumerable non-index properties on typed arrays.
2395 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2396 // Skip index properties.
2397 _isIndex(key, length)
2398 ))) {
2399 result.push(key);
2400 }
2401 }
2402 return result;
2403}
2404
2405var _arrayLikeKeys = arrayLikeKeys;
2406
2407/** Used for built-in method references. */
2408var objectProto$11 = Object.prototype;
2409
2410/**
2411 * Checks if `value` is likely a prototype object.
2412 *
2413 * @private
2414 * @param {*} value The value to check.
2415 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
2416 */
2417function isPrototype(value) {
2418 var Ctor = value && value.constructor,
2419 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$11;
2420
2421 return value === proto;
2422}
2423
2424var _isPrototype = isPrototype;
2425
2426/**
2427 * Creates a unary function that invokes `func` with its argument transformed.
2428 *
2429 * @private
2430 * @param {Function} func The function to wrap.
2431 * @param {Function} transform The argument transform.
2432 * @returns {Function} Returns the new function.
2433 */
2434function overArg$2(func, transform) {
2435 return function(arg) {
2436 return func(transform(arg));
2437 };
2438}
2439
2440var _overArg = overArg$2;
2441
2442/* Built-in method references for those with the same name as other `lodash` methods. */
2443var nativeKeys = _overArg(Object.keys, Object);
2444
2445var _nativeKeys = nativeKeys;
2446
2447/** Used for built-in method references. */
2448var objectProto$10 = Object.prototype;
2449
2450/** Used to check objects for own properties. */
2451var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
2452
2453/**
2454 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2455 *
2456 * @private
2457 * @param {Object} object The object to query.
2458 * @returns {Array} Returns the array of property names.
2459 */
2460function baseKeys(object) {
2461 if (!_isPrototype(object)) {
2462 return _nativeKeys(object);
2463 }
2464 var result = [];
2465 for (var key in Object(object)) {
2466 if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
2467 result.push(key);
2468 }
2469 }
2470 return result;
2471}
2472
2473var _baseKeys = baseKeys;
2474
2475/**
2476 * Checks if `value` is array-like. A value is considered array-like if it's
2477 * not a function and has a `value.length` that's an integer greater than or
2478 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2479 *
2480 * @static
2481 * @memberOf _
2482 * @since 4.0.0
2483 * @category Lang
2484 * @param {*} value The value to check.
2485 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2486 * @example
2487 *
2488 * _.isArrayLike([1, 2, 3]);
2489 * // => true
2490 *
2491 * _.isArrayLike(document.body.children);
2492 * // => true
2493 *
2494 * _.isArrayLike('abc');
2495 * // => true
2496 *
2497 * _.isArrayLike(_.noop);
2498 * // => false
2499 */
2500function isArrayLike(value) {
2501 return value != null && isLength_1(value.length) && !isFunction_1(value);
2502}
2503
2504var isArrayLike_1 = isArrayLike;
2505
2506/**
2507 * Creates an array of the own enumerable property names of `object`.
2508 *
2509 * **Note:** Non-object values are coerced to objects. See the
2510 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2511 * for more details.
2512 *
2513 * @static
2514 * @since 0.1.0
2515 * @memberOf _
2516 * @category Object
2517 * @param {Object} object The object to query.
2518 * @returns {Array} Returns the array of property names.
2519 * @example
2520 *
2521 * function Foo() {
2522 * this.a = 1;
2523 * this.b = 2;
2524 * }
2525 *
2526 * Foo.prototype.c = 3;
2527 *
2528 * _.keys(new Foo);
2529 * // => ['a', 'b'] (iteration order is not guaranteed)
2530 *
2531 * _.keys('hi');
2532 * // => ['0', '1']
2533 */
2534function keys(object) {
2535 return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
2536}
2537
2538var keys_1 = keys;
2539
2540/**
2541 * The base implementation of `_.forOwn` without support for iteratee shorthands.
2542 *
2543 * @private
2544 * @param {Object} object The object to iterate over.
2545 * @param {Function} iteratee The function invoked per iteration.
2546 * @returns {Object} Returns `object`.
2547 */
2548function baseForOwn(object, iteratee) {
2549 return object && _baseFor(object, iteratee, keys_1);
2550}
2551
2552var _baseForOwn = baseForOwn;
2553
2554/**
2555 * Removes all key-value entries from the stack.
2556 *
2557 * @private
2558 * @name clear
2559 * @memberOf Stack
2560 */
2561function stackClear() {
2562 this.__data__ = new _ListCache;
2563 this.size = 0;
2564}
2565
2566var _stackClear = stackClear;
2567
2568/**
2569 * Removes `key` and its value from the stack.
2570 *
2571 * @private
2572 * @name delete
2573 * @memberOf Stack
2574 * @param {string} key The key of the value to remove.
2575 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2576 */
2577function stackDelete(key) {
2578 var data = this.__data__,
2579 result = data['delete'](key);
2580
2581 this.size = data.size;
2582 return result;
2583}
2584
2585var _stackDelete = stackDelete;
2586
2587/**
2588 * Gets the stack value for `key`.
2589 *
2590 * @private
2591 * @name get
2592 * @memberOf Stack
2593 * @param {string} key The key of the value to get.
2594 * @returns {*} Returns the entry value.
2595 */
2596function stackGet(key) {
2597 return this.__data__.get(key);
2598}
2599
2600var _stackGet = stackGet;
2601
2602/**
2603 * Checks if a stack value for `key` exists.
2604 *
2605 * @private
2606 * @name has
2607 * @memberOf Stack
2608 * @param {string} key The key of the entry to check.
2609 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2610 */
2611function stackHas(key) {
2612 return this.__data__.has(key);
2613}
2614
2615var _stackHas = stackHas;
2616
2617/** Used as the size to enable large array optimizations. */
2618var LARGE_ARRAY_SIZE = 200;
2619
2620/**
2621 * Sets the stack `key` to `value`.
2622 *
2623 * @private
2624 * @name set
2625 * @memberOf Stack
2626 * @param {string} key The key of the value to set.
2627 * @param {*} value The value to set.
2628 * @returns {Object} Returns the stack cache instance.
2629 */
2630function stackSet(key, value) {
2631 var data = this.__data__;
2632 if (data instanceof _ListCache) {
2633 var pairs = data.__data__;
2634 if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2635 pairs.push([key, value]);
2636 this.size = ++data.size;
2637 return this;
2638 }
2639 data = this.__data__ = new _MapCache(pairs);
2640 }
2641 data.set(key, value);
2642 this.size = data.size;
2643 return this;
2644}
2645
2646var _stackSet = stackSet;
2647
2648/**
2649 * Creates a stack cache object to store key-value pairs.
2650 *
2651 * @private
2652 * @constructor
2653 * @param {Array} [entries] The key-value pairs to cache.
2654 */
2655function Stack(entries) {
2656 var data = this.__data__ = new _ListCache(entries);
2657 this.size = data.size;
2658}
2659
2660// Add methods to `Stack`.
2661Stack.prototype.clear = _stackClear;
2662Stack.prototype['delete'] = _stackDelete;
2663Stack.prototype.get = _stackGet;
2664Stack.prototype.has = _stackHas;
2665Stack.prototype.set = _stackSet;
2666
2667var _Stack = Stack;
2668
2669/** Used to stand-in for `undefined` hash values. */
2670var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
2671
2672/**
2673 * Adds `value` to the array cache.
2674 *
2675 * @private
2676 * @name add
2677 * @memberOf SetCache
2678 * @alias push
2679 * @param {*} value The value to cache.
2680 * @returns {Object} Returns the cache instance.
2681 */
2682function setCacheAdd(value) {
2683 this.__data__.set(value, HASH_UNDEFINED$2);
2684 return this;
2685}
2686
2687var _setCacheAdd = setCacheAdd;
2688
2689/**
2690 * Checks if `value` is in the array cache.
2691 *
2692 * @private
2693 * @name has
2694 * @memberOf SetCache
2695 * @param {*} value The value to search for.
2696 * @returns {number} Returns `true` if `value` is found, else `false`.
2697 */
2698function setCacheHas(value) {
2699 return this.__data__.has(value);
2700}
2701
2702var _setCacheHas = setCacheHas;
2703
2704/**
2705 *
2706 * Creates an array cache object to store unique values.
2707 *
2708 * @private
2709 * @constructor
2710 * @param {Array} [values] The values to cache.
2711 */
2712function SetCache(values) {
2713 var index = -1,
2714 length = values == null ? 0 : values.length;
2715
2716 this.__data__ = new _MapCache;
2717 while (++index < length) {
2718 this.add(values[index]);
2719 }
2720}
2721
2722// Add methods to `SetCache`.
2723SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
2724SetCache.prototype.has = _setCacheHas;
2725
2726var _SetCache = SetCache;
2727
2728/**
2729 * A specialized version of `_.some` for arrays without support for iteratee
2730 * shorthands.
2731 *
2732 * @private
2733 * @param {Array} [array] The array to iterate over.
2734 * @param {Function} predicate The function invoked per iteration.
2735 * @returns {boolean} Returns `true` if any element passes the predicate check,
2736 * else `false`.
2737 */
2738function arraySome(array, predicate) {
2739 var index = -1,
2740 length = array == null ? 0 : array.length;
2741
2742 while (++index < length) {
2743 if (predicate(array[index], index, array)) {
2744 return true;
2745 }
2746 }
2747 return false;
2748}
2749
2750var _arraySome = arraySome;
2751
2752/**
2753 * Checks if a `cache` value for `key` exists.
2754 *
2755 * @private
2756 * @param {Object} cache The cache to query.
2757 * @param {string} key The key of the entry to check.
2758 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2759 */
2760function cacheHas(cache, key) {
2761 return cache.has(key);
2762}
2763
2764var _cacheHas = cacheHas;
2765
2766/** Used to compose bitmasks for value comparisons. */
2767var COMPARE_PARTIAL_FLAG$2 = 1;
2768var COMPARE_UNORDERED_FLAG$1 = 2;
2769
2770/**
2771 * A specialized version of `baseIsEqualDeep` for arrays with support for
2772 * partial deep comparisons.
2773 *
2774 * @private
2775 * @param {Array} array The array to compare.
2776 * @param {Array} other The other array to compare.
2777 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2778 * @param {Function} customizer The function to customize comparisons.
2779 * @param {Function} equalFunc The function to determine equivalents of values.
2780 * @param {Object} stack Tracks traversed `array` and `other` objects.
2781 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
2782 */
2783function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
2784 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
2785 arrLength = array.length,
2786 othLength = other.length;
2787
2788 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
2789 return false;
2790 }
2791 // Assume cyclic values are equal.
2792 var stacked = stack.get(array);
2793 if (stacked && stack.get(other)) {
2794 return stacked == other;
2795 }
2796 var index = -1,
2797 result = true,
2798 seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new _SetCache : undefined;
2799
2800 stack.set(array, other);
2801 stack.set(other, array);
2802
2803 // Ignore non-index properties.
2804 while (++index < arrLength) {
2805 var arrValue = array[index],
2806 othValue = other[index];
2807
2808 if (customizer) {
2809 var compared = isPartial
2810 ? customizer(othValue, arrValue, index, other, array, stack)
2811 : customizer(arrValue, othValue, index, array, other, stack);
2812 }
2813 if (compared !== undefined) {
2814 if (compared) {
2815 continue;
2816 }
2817 result = false;
2818 break;
2819 }
2820 // Recursively compare arrays (susceptible to call stack limits).
2821 if (seen) {
2822 if (!_arraySome(other, function(othValue, othIndex) {
2823 if (!_cacheHas(seen, othIndex) &&
2824 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
2825 return seen.push(othIndex);
2826 }
2827 })) {
2828 result = false;
2829 break;
2830 }
2831 } else if (!(
2832 arrValue === othValue ||
2833 equalFunc(arrValue, othValue, bitmask, customizer, stack)
2834 )) {
2835 result = false;
2836 break;
2837 }
2838 }
2839 stack['delete'](array);
2840 stack['delete'](other);
2841 return result;
2842}
2843
2844var _equalArrays = equalArrays;
2845
2846/** Built-in value references. */
2847var Uint8Array = _root.Uint8Array;
2848
2849var _Uint8Array = Uint8Array;
2850
2851/**
2852 * Converts `map` to its key-value pairs.
2853 *
2854 * @private
2855 * @param {Object} map The map to convert.
2856 * @returns {Array} Returns the key-value pairs.
2857 */
2858function mapToArray(map) {
2859 var index = -1,
2860 result = Array(map.size);
2861
2862 map.forEach(function(value, key) {
2863 result[++index] = [key, value];
2864 });
2865 return result;
2866}
2867
2868var _mapToArray = mapToArray;
2869
2870/**
2871 * Converts `set` to an array of its values.
2872 *
2873 * @private
2874 * @param {Object} set The set to convert.
2875 * @returns {Array} Returns the values.
2876 */
2877function setToArray(set) {
2878 var index = -1,
2879 result = Array(set.size);
2880
2881 set.forEach(function(value) {
2882 result[++index] = value;
2883 });
2884 return result;
2885}
2886
2887var _setToArray = setToArray;
2888
2889/** Used to compose bitmasks for value comparisons. */
2890var COMPARE_PARTIAL_FLAG$3 = 1;
2891var COMPARE_UNORDERED_FLAG$2 = 2;
2892
2893/** `Object#toString` result references. */
2894var boolTag$1 = '[object Boolean]';
2895var dateTag$1 = '[object Date]';
2896var errorTag$1 = '[object Error]';
2897var mapTag$1 = '[object Map]';
2898var numberTag$1 = '[object Number]';
2899var regexpTag$1 = '[object RegExp]';
2900var setTag$1 = '[object Set]';
2901var stringTag$2 = '[object String]';
2902var symbolTag$1 = '[object Symbol]';
2903
2904var arrayBufferTag$1 = '[object ArrayBuffer]';
2905var dataViewTag$1 = '[object DataView]';
2906
2907/** Used to convert symbols to primitives and strings. */
2908var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined;
2909var symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
2910
2911/**
2912 * A specialized version of `baseIsEqualDeep` for comparing objects of
2913 * the same `toStringTag`.
2914 *
2915 * **Note:** This function only supports comparing values with tags of
2916 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
2917 *
2918 * @private
2919 * @param {Object} object The object to compare.
2920 * @param {Object} other The other object to compare.
2921 * @param {string} tag The `toStringTag` of the objects to compare.
2922 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2923 * @param {Function} customizer The function to customize comparisons.
2924 * @param {Function} equalFunc The function to determine equivalents of values.
2925 * @param {Object} stack Tracks traversed `object` and `other` objects.
2926 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2927 */
2928function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
2929 switch (tag) {
2930 case dataViewTag$1:
2931 if ((object.byteLength != other.byteLength) ||
2932 (object.byteOffset != other.byteOffset)) {
2933 return false;
2934 }
2935 object = object.buffer;
2936 other = other.buffer;
2937
2938 case arrayBufferTag$1:
2939 if ((object.byteLength != other.byteLength) ||
2940 !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
2941 return false;
2942 }
2943 return true;
2944
2945 case boolTag$1:
2946 case dateTag$1:
2947 case numberTag$1:
2948 // Coerce booleans to `1` or `0` and dates to milliseconds.
2949 // Invalid dates are coerced to `NaN`.
2950 return eq_1(+object, +other);
2951
2952 case errorTag$1:
2953 return object.name == other.name && object.message == other.message;
2954
2955 case regexpTag$1:
2956 case stringTag$2:
2957 // Coerce regexes to strings and treat strings, primitives and objects,
2958 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
2959 // for more details.
2960 return object == (other + '');
2961
2962 case mapTag$1:
2963 var convert = _mapToArray;
2964
2965 case setTag$1:
2966 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3;
2967 convert || (convert = _setToArray);
2968
2969 if (object.size != other.size && !isPartial) {
2970 return false;
2971 }
2972 // Assume cyclic values are equal.
2973 var stacked = stack.get(object);
2974 if (stacked) {
2975 return stacked == other;
2976 }
2977 bitmask |= COMPARE_UNORDERED_FLAG$2;
2978
2979 // Recursively compare objects (susceptible to call stack limits).
2980 stack.set(object, other);
2981 var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
2982 stack['delete'](object);
2983 return result;
2984
2985 case symbolTag$1:
2986 if (symbolValueOf) {
2987 return symbolValueOf.call(object) == symbolValueOf.call(other);
2988 }
2989 }
2990 return false;
2991}
2992
2993var _equalByTag = equalByTag;
2994
2995/**
2996 * Appends the elements of `values` to `array`.
2997 *
2998 * @private
2999 * @param {Array} array The array to modify.
3000 * @param {Array} values The values to append.
3001 * @returns {Array} Returns `array`.
3002 */
3003function arrayPush(array, values) {
3004 var index = -1,
3005 length = values.length,
3006 offset = array.length;
3007
3008 while (++index < length) {
3009 array[offset + index] = values[index];
3010 }
3011 return array;
3012}
3013
3014var _arrayPush = arrayPush;
3015
3016/**
3017 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
3018 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
3019 * symbols of `object`.
3020 *
3021 * @private
3022 * @param {Object} object The object to query.
3023 * @param {Function} keysFunc The function to get the keys of `object`.
3024 * @param {Function} symbolsFunc The function to get the symbols of `object`.
3025 * @returns {Array} Returns the array of property names and symbols.
3026 */
3027function baseGetAllKeys(object, keysFunc, symbolsFunc) {
3028 var result = keysFunc(object);
3029 return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
3030}
3031
3032var _baseGetAllKeys = baseGetAllKeys;
3033
3034/**
3035 * A specialized version of `_.filter` for arrays without support for
3036 * iteratee shorthands.
3037 *
3038 * @private
3039 * @param {Array} [array] The array to iterate over.
3040 * @param {Function} predicate The function invoked per iteration.
3041 * @returns {Array} Returns the new filtered array.
3042 */
3043function arrayFilter(array, predicate) {
3044 var index = -1,
3045 length = array == null ? 0 : array.length,
3046 resIndex = 0,
3047 result = [];
3048
3049 while (++index < length) {
3050 var value = array[index];
3051 if (predicate(value, index, array)) {
3052 result[resIndex++] = value;
3053 }
3054 }
3055 return result;
3056}
3057
3058var _arrayFilter = arrayFilter;
3059
3060/**
3061 * This method returns a new empty array.
3062 *
3063 * @static
3064 * @memberOf _
3065 * @since 4.13.0
3066 * @category Util
3067 * @returns {Array} Returns the new empty array.
3068 * @example
3069 *
3070 * var arrays = _.times(2, _.stubArray);
3071 *
3072 * console.log(arrays);
3073 * // => [[], []]
3074 *
3075 * console.log(arrays[0] === arrays[1]);
3076 * // => false
3077 */
3078function stubArray() {
3079 return [];
3080}
3081
3082var stubArray_1 = stubArray;
3083
3084/** Used for built-in method references. */
3085var objectProto$14 = Object.prototype;
3086
3087/** Built-in value references. */
3088var propertyIsEnumerable$1 = objectProto$14.propertyIsEnumerable;
3089
3090/* Built-in method references for those with the same name as other `lodash` methods. */
3091var nativeGetSymbols = Object.getOwnPropertySymbols;
3092
3093/**
3094 * Creates an array of the own enumerable symbols of `object`.
3095 *
3096 * @private
3097 * @param {Object} object The object to query.
3098 * @returns {Array} Returns the array of symbols.
3099 */
3100var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
3101 if (object == null) {
3102 return [];
3103 }
3104 object = Object(object);
3105 return _arrayFilter(nativeGetSymbols(object), function(symbol) {
3106 return propertyIsEnumerable$1.call(object, symbol);
3107 });
3108};
3109
3110var _getSymbols = getSymbols;
3111
3112/**
3113 * Creates an array of own enumerable property names and symbols of `object`.
3114 *
3115 * @private
3116 * @param {Object} object The object to query.
3117 * @returns {Array} Returns the array of property names and symbols.
3118 */
3119function getAllKeys(object) {
3120 return _baseGetAllKeys(object, keys_1, _getSymbols);
3121}
3122
3123var _getAllKeys = getAllKeys;
3124
3125/** Used to compose bitmasks for value comparisons. */
3126var COMPARE_PARTIAL_FLAG$4 = 1;
3127
3128/** Used for built-in method references. */
3129var objectProto$13 = Object.prototype;
3130
3131/** Used to check objects for own properties. */
3132var hasOwnProperty$10 = objectProto$13.hasOwnProperty;
3133
3134/**
3135 * A specialized version of `baseIsEqualDeep` for objects with support for
3136 * partial deep comparisons.
3137 *
3138 * @private
3139 * @param {Object} object The object to compare.
3140 * @param {Object} other The other object to compare.
3141 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3142 * @param {Function} customizer The function to customize comparisons.
3143 * @param {Function} equalFunc The function to determine equivalents of values.
3144 * @param {Object} stack Tracks traversed `object` and `other` objects.
3145 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3146 */
3147function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
3148 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4,
3149 objProps = _getAllKeys(object),
3150 objLength = objProps.length,
3151 othProps = _getAllKeys(other),
3152 othLength = othProps.length;
3153
3154 if (objLength != othLength && !isPartial) {
3155 return false;
3156 }
3157 var index = objLength;
3158 while (index--) {
3159 var key = objProps[index];
3160 if (!(isPartial ? key in other : hasOwnProperty$10.call(other, key))) {
3161 return false;
3162 }
3163 }
3164 // Assume cyclic values are equal.
3165 var stacked = stack.get(object);
3166 if (stacked && stack.get(other)) {
3167 return stacked == other;
3168 }
3169 var result = true;
3170 stack.set(object, other);
3171 stack.set(other, object);
3172
3173 var skipCtor = isPartial;
3174 while (++index < objLength) {
3175 key = objProps[index];
3176 var objValue = object[key],
3177 othValue = other[key];
3178
3179 if (customizer) {
3180 var compared = isPartial
3181 ? customizer(othValue, objValue, key, other, object, stack)
3182 : customizer(objValue, othValue, key, object, other, stack);
3183 }
3184 // Recursively compare objects (susceptible to call stack limits).
3185 if (!(compared === undefined
3186 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
3187 : compared
3188 )) {
3189 result = false;
3190 break;
3191 }
3192 skipCtor || (skipCtor = key == 'constructor');
3193 }
3194 if (result && !skipCtor) {
3195 var objCtor = object.constructor,
3196 othCtor = other.constructor;
3197
3198 // Non `Object` object instances with different constructors are not equal.
3199 if (objCtor != othCtor &&
3200 ('constructor' in object && 'constructor' in other) &&
3201 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
3202 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
3203 result = false;
3204 }
3205 }
3206 stack['delete'](object);
3207 stack['delete'](other);
3208 return result;
3209}
3210
3211var _equalObjects = equalObjects;
3212
3213/* Built-in method references that are verified to be native. */
3214var DataView = _getNative(_root, 'DataView');
3215
3216var _DataView = DataView;
3217
3218/* Built-in method references that are verified to be native. */
3219var Promise$1 = _getNative(_root, 'Promise');
3220
3221var _Promise = Promise$1;
3222
3223/* Built-in method references that are verified to be native. */
3224var Set = _getNative(_root, 'Set');
3225
3226var _Set = Set;
3227
3228/* Built-in method references that are verified to be native. */
3229var WeakMap = _getNative(_root, 'WeakMap');
3230
3231var _WeakMap = WeakMap;
3232
3233/** `Object#toString` result references. */
3234var mapTag$2 = '[object Map]';
3235var objectTag$3 = '[object Object]';
3236var promiseTag = '[object Promise]';
3237var setTag$2 = '[object Set]';
3238var weakMapTag$1 = '[object WeakMap]';
3239
3240var dataViewTag$2 = '[object DataView]';
3241
3242/** Used to detect maps, sets, and weakmaps. */
3243var dataViewCtorString = _toSource(_DataView);
3244var mapCtorString = _toSource(_Map);
3245var promiseCtorString = _toSource(_Promise);
3246var setCtorString = _toSource(_Set);
3247var weakMapCtorString = _toSource(_WeakMap);
3248
3249/**
3250 * Gets the `toStringTag` of `value`.
3251 *
3252 * @private
3253 * @param {*} value The value to query.
3254 * @returns {string} Returns the `toStringTag`.
3255 */
3256var getTag = _baseGetTag;
3257
3258// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
3259if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
3260 (_Map && getTag(new _Map) != mapTag$2) ||
3261 (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
3262 (_Set && getTag(new _Set) != setTag$2) ||
3263 (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
3264 getTag = function(value) {
3265 var result = _baseGetTag(value),
3266 Ctor = result == objectTag$3 ? value.constructor : undefined,
3267 ctorString = Ctor ? _toSource(Ctor) : '';
3268
3269 if (ctorString) {
3270 switch (ctorString) {
3271 case dataViewCtorString: return dataViewTag$2;
3272 case mapCtorString: return mapTag$2;
3273 case promiseCtorString: return promiseTag;
3274 case setCtorString: return setTag$2;
3275 case weakMapCtorString: return weakMapTag$1;
3276 }
3277 }
3278 return result;
3279 };
3280}
3281
3282var _getTag = getTag;
3283
3284/** Used to compose bitmasks for value comparisons. */
3285var COMPARE_PARTIAL_FLAG$1 = 1;
3286
3287/** `Object#toString` result references. */
3288var argsTag$2 = '[object Arguments]';
3289var arrayTag$1 = '[object Array]';
3290var objectTag$2 = '[object Object]';
3291
3292/** Used for built-in method references. */
3293var objectProto$12 = Object.prototype;
3294
3295/** Used to check objects for own properties. */
3296var hasOwnProperty$9 = objectProto$12.hasOwnProperty;
3297
3298/**
3299 * A specialized version of `baseIsEqual` for arrays and objects which performs
3300 * deep comparisons and tracks traversed objects enabling objects with circular
3301 * references to be compared.
3302 *
3303 * @private
3304 * @param {Object} object The object to compare.
3305 * @param {Object} other The other object to compare.
3306 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3307 * @param {Function} customizer The function to customize comparisons.
3308 * @param {Function} equalFunc The function to determine equivalents of values.
3309 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3310 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3311 */
3312function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3313 var objIsArr = isArray_1(object),
3314 othIsArr = isArray_1(other),
3315 objTag = objIsArr ? arrayTag$1 : _getTag(object),
3316 othTag = othIsArr ? arrayTag$1 : _getTag(other);
3317
3318 objTag = objTag == argsTag$2 ? objectTag$2 : objTag;
3319 othTag = othTag == argsTag$2 ? objectTag$2 : othTag;
3320
3321 var objIsObj = objTag == objectTag$2,
3322 othIsObj = othTag == objectTag$2,
3323 isSameTag = objTag == othTag;
3324
3325 if (isSameTag && isBuffer_1(object)) {
3326 if (!isBuffer_1(other)) {
3327 return false;
3328 }
3329 objIsArr = true;
3330 objIsObj = false;
3331 }
3332 if (isSameTag && !objIsObj) {
3333 stack || (stack = new _Stack);
3334 return (objIsArr || isTypedArray_1(object))
3335 ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3336 : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3337 }
3338 if (!(bitmask & COMPARE_PARTIAL_FLAG$1)) {
3339 var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, '__wrapped__'),
3340 othIsWrapped = othIsObj && hasOwnProperty$9.call(other, '__wrapped__');
3341
3342 if (objIsWrapped || othIsWrapped) {
3343 var objUnwrapped = objIsWrapped ? object.value() : object,
3344 othUnwrapped = othIsWrapped ? other.value() : other;
3345
3346 stack || (stack = new _Stack);
3347 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3348 }
3349 }
3350 if (!isSameTag) {
3351 return false;
3352 }
3353 stack || (stack = new _Stack);
3354 return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3355}
3356
3357var _baseIsEqualDeep = baseIsEqualDeep;
3358
3359/**
3360 * The base implementation of `_.isEqual` which supports partial comparisons
3361 * and tracks traversed objects.
3362 *
3363 * @private
3364 * @param {*} value The value to compare.
3365 * @param {*} other The other value to compare.
3366 * @param {boolean} bitmask The bitmask flags.
3367 * 1 - Unordered comparison
3368 * 2 - Partial comparison
3369 * @param {Function} [customizer] The function to customize comparisons.
3370 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3371 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3372 */
3373function baseIsEqual(value, other, bitmask, customizer, stack) {
3374 if (value === other) {
3375 return true;
3376 }
3377 if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
3378 return value !== value && other !== other;
3379 }
3380 return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
3381}
3382
3383var _baseIsEqual = baseIsEqual;
3384
3385/** Used to compose bitmasks for value comparisons. */
3386var COMPARE_PARTIAL_FLAG = 1;
3387var COMPARE_UNORDERED_FLAG = 2;
3388
3389/**
3390 * The base implementation of `_.isMatch` without support for iteratee shorthands.
3391 *
3392 * @private
3393 * @param {Object} object The object to inspect.
3394 * @param {Object} source The object of property values to match.
3395 * @param {Array} matchData The property names, values, and compare flags to match.
3396 * @param {Function} [customizer] The function to customize comparisons.
3397 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3398 */
3399function baseIsMatch(object, source, matchData, customizer) {
3400 var index = matchData.length,
3401 length = index,
3402 noCustomizer = !customizer;
3403
3404 if (object == null) {
3405 return !length;
3406 }
3407 object = Object(object);
3408 while (index--) {
3409 var data = matchData[index];
3410 if ((noCustomizer && data[2])
3411 ? data[1] !== object[data[0]]
3412 : !(data[0] in object)
3413 ) {
3414 return false;
3415 }
3416 }
3417 while (++index < length) {
3418 data = matchData[index];
3419 var key = data[0],
3420 objValue = object[key],
3421 srcValue = data[1];
3422
3423 if (noCustomizer && data[2]) {
3424 if (objValue === undefined && !(key in object)) {
3425 return false;
3426 }
3427 } else {
3428 var stack = new _Stack;
3429 if (customizer) {
3430 var result = customizer(objValue, srcValue, key, object, source, stack);
3431 }
3432 if (!(result === undefined
3433 ? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
3434 : result
3435 )) {
3436 return false;
3437 }
3438 }
3439 }
3440 return true;
3441}
3442
3443var _baseIsMatch = baseIsMatch;
3444
3445/**
3446 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
3447 *
3448 * @private
3449 * @param {*} value The value to check.
3450 * @returns {boolean} Returns `true` if `value` if suitable for strict
3451 * equality comparisons, else `false`.
3452 */
3453function isStrictComparable(value) {
3454 return value === value && !isObject_1(value);
3455}
3456
3457var _isStrictComparable = isStrictComparable;
3458
3459/**
3460 * Gets the property names, values, and compare flags of `object`.
3461 *
3462 * @private
3463 * @param {Object} object The object to query.
3464 * @returns {Array} Returns the match data of `object`.
3465 */
3466function getMatchData(object) {
3467 var result = keys_1(object),
3468 length = result.length;
3469
3470 while (length--) {
3471 var key = result[length],
3472 value = object[key];
3473
3474 result[length] = [key, value, _isStrictComparable(value)];
3475 }
3476 return result;
3477}
3478
3479var _getMatchData = getMatchData;
3480
3481/**
3482 * A specialized version of `matchesProperty` for source values suitable
3483 * for strict equality comparisons, i.e. `===`.
3484 *
3485 * @private
3486 * @param {string} key The key of the property to get.
3487 * @param {*} srcValue The value to match.
3488 * @returns {Function} Returns the new spec function.
3489 */
3490function matchesStrictComparable(key, srcValue) {
3491 return function(object) {
3492 if (object == null) {
3493 return false;
3494 }
3495 return object[key] === srcValue &&
3496 (srcValue !== undefined || (key in Object(object)));
3497 };
3498}
3499
3500var _matchesStrictComparable = matchesStrictComparable;
3501
3502/**
3503 * The base implementation of `_.matches` which doesn't clone `source`.
3504 *
3505 * @private
3506 * @param {Object} source The object of property values to match.
3507 * @returns {Function} Returns the new spec function.
3508 */
3509function baseMatches(source) {
3510 var matchData = _getMatchData(source);
3511 if (matchData.length == 1 && matchData[0][2]) {
3512 return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
3513 }
3514 return function(object) {
3515 return object === source || _baseIsMatch(object, source, matchData);
3516 };
3517}
3518
3519var _baseMatches = baseMatches;
3520
3521/**
3522 * The base implementation of `_.hasIn` without support for deep paths.
3523 *
3524 * @private
3525 * @param {Object} [object] The object to query.
3526 * @param {Array|string} key The key to check.
3527 * @returns {boolean} Returns `true` if `key` exists, else `false`.
3528 */
3529function baseHasIn(object, key) {
3530 return object != null && key in Object(object);
3531}
3532
3533var _baseHasIn = baseHasIn;
3534
3535/**
3536 * Checks if `path` exists on `object`.
3537 *
3538 * @private
3539 * @param {Object} object The object to query.
3540 * @param {Array|string} path The path to check.
3541 * @param {Function} hasFunc The function to check properties.
3542 * @returns {boolean} Returns `true` if `path` exists, else `false`.
3543 */
3544function hasPath(object, path, hasFunc) {
3545 path = _castPath(path, object);
3546
3547 var index = -1,
3548 length = path.length,
3549 result = false;
3550
3551 while (++index < length) {
3552 var key = _toKey(path[index]);
3553 if (!(result = object != null && hasFunc(object, key))) {
3554 break;
3555 }
3556 object = object[key];
3557 }
3558 if (result || ++index != length) {
3559 return result;
3560 }
3561 length = object == null ? 0 : object.length;
3562 return !!length && isLength_1(length) && _isIndex(key, length) &&
3563 (isArray_1(object) || isArguments_1(object));
3564}
3565
3566var _hasPath = hasPath;
3567
3568/**
3569 * Checks if `path` is a direct or inherited property of `object`.
3570 *
3571 * @static
3572 * @memberOf _
3573 * @since 4.0.0
3574 * @category Object
3575 * @param {Object} object The object to query.
3576 * @param {Array|string} path The path to check.
3577 * @returns {boolean} Returns `true` if `path` exists, else `false`.
3578 * @example
3579 *
3580 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
3581 *
3582 * _.hasIn(object, 'a');
3583 * // => true
3584 *
3585 * _.hasIn(object, 'a.b');
3586 * // => true
3587 *
3588 * _.hasIn(object, ['a', 'b']);
3589 * // => true
3590 *
3591 * _.hasIn(object, 'b');
3592 * // => false
3593 */
3594function hasIn(object, path) {
3595 return object != null && _hasPath(object, path, _baseHasIn);
3596}
3597
3598var hasIn_1 = hasIn;
3599
3600/** Used to compose bitmasks for value comparisons. */
3601var COMPARE_PARTIAL_FLAG$5 = 1;
3602var COMPARE_UNORDERED_FLAG$3 = 2;
3603
3604/**
3605 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
3606 *
3607 * @private
3608 * @param {string} path The path of the property to get.
3609 * @param {*} srcValue The value to match.
3610 * @returns {Function} Returns the new spec function.
3611 */
3612function baseMatchesProperty(path, srcValue) {
3613 if (_isKey(path) && _isStrictComparable(srcValue)) {
3614 return _matchesStrictComparable(_toKey(path), srcValue);
3615 }
3616 return function(object) {
3617 var objValue = get_1(object, path);
3618 return (objValue === undefined && objValue === srcValue)
3619 ? hasIn_1(object, path)
3620 : _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3);
3621 };
3622}
3623
3624var _baseMatchesProperty = baseMatchesProperty;
3625
3626/**
3627 * This method returns the first argument it receives.
3628 *
3629 * @static
3630 * @since 0.1.0
3631 * @memberOf _
3632 * @category Util
3633 * @param {*} value Any value.
3634 * @returns {*} Returns `value`.
3635 * @example
3636 *
3637 * var object = { 'a': 1 };
3638 *
3639 * console.log(_.identity(object) === object);
3640 * // => true
3641 */
3642function identity(value) {
3643 return value;
3644}
3645
3646var identity_1 = identity;
3647
3648/**
3649 * The base implementation of `_.property` without support for deep paths.
3650 *
3651 * @private
3652 * @param {string} key The key of the property to get.
3653 * @returns {Function} Returns the new accessor function.
3654 */
3655function baseProperty(key) {
3656 return function(object) {
3657 return object == null ? undefined : object[key];
3658 };
3659}
3660
3661var _baseProperty = baseProperty;
3662
3663/**
3664 * A specialized version of `baseProperty` which supports deep paths.
3665 *
3666 * @private
3667 * @param {Array|string} path The path of the property to get.
3668 * @returns {Function} Returns the new accessor function.
3669 */
3670function basePropertyDeep(path) {
3671 return function(object) {
3672 return _baseGet(object, path);
3673 };
3674}
3675
3676var _basePropertyDeep = basePropertyDeep;
3677
3678/**
3679 * Creates a function that returns the value at `path` of a given object.
3680 *
3681 * @static
3682 * @memberOf _
3683 * @since 2.4.0
3684 * @category Util
3685 * @param {Array|string} path The path of the property to get.
3686 * @returns {Function} Returns the new accessor function.
3687 * @example
3688 *
3689 * var objects = [
3690 * { 'a': { 'b': 2 } },
3691 * { 'a': { 'b': 1 } }
3692 * ];
3693 *
3694 * _.map(objects, _.property('a.b'));
3695 * // => [2, 1]
3696 *
3697 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
3698 * // => [1, 2]
3699 */
3700function property(path) {
3701 return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
3702}
3703
3704var property_1 = property;
3705
3706/**
3707 * The base implementation of `_.iteratee`.
3708 *
3709 * @private
3710 * @param {*} [value=_.identity] The value to convert to an iteratee.
3711 * @returns {Function} Returns the iteratee.
3712 */
3713function baseIteratee(value) {
3714 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3715 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3716 if (typeof value == 'function') {
3717 return value;
3718 }
3719 if (value == null) {
3720 return identity_1;
3721 }
3722 if (typeof value == 'object') {
3723 return isArray_1(value)
3724 ? _baseMatchesProperty(value[0], value[1])
3725 : _baseMatches(value);
3726 }
3727 return property_1(value);
3728}
3729
3730var _baseIteratee = baseIteratee;
3731
3732/**
3733 * Creates an object with the same keys as `object` and values generated
3734 * by running each own enumerable string keyed property of `object` thru
3735 * `iteratee`. The iteratee is invoked with three arguments:
3736 * (value, key, object).
3737 *
3738 * @static
3739 * @memberOf _
3740 * @since 2.4.0
3741 * @category Object
3742 * @param {Object} object The object to iterate over.
3743 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
3744 * @returns {Object} Returns the new mapped object.
3745 * @see _.mapKeys
3746 * @example
3747 *
3748 * var users = {
3749 * 'fred': { 'user': 'fred', 'age': 40 },
3750 * 'pebbles': { 'user': 'pebbles', 'age': 1 }
3751 * };
3752 *
3753 * _.mapValues(users, function(o) { return o.age; });
3754 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
3755 *
3756 * // The `_.property` iteratee shorthand.
3757 * _.mapValues(users, 'age');
3758 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
3759 */
3760function mapValues(object, iteratee) {
3761 var result = {};
3762 iteratee = _baseIteratee(iteratee, 3);
3763
3764 _baseForOwn(object, function(value, key, object) {
3765 _baseAssignValue(result, key, iteratee(value, key, object));
3766 });
3767 return result;
3768}
3769
3770var mapValues_1 = mapValues;
3771
3772/**
3773 * A specialized version of `_.forEachRight` for arrays without support for
3774 * iteratee shorthands.
3775 *
3776 * @private
3777 * @param {Array} [array] The array to iterate over.
3778 * @param {Function} iteratee The function invoked per iteration.
3779 * @returns {Array} Returns `array`.
3780 */
3781function arrayEachRight(array, iteratee) {
3782 var length = array == null ? 0 : array.length;
3783
3784 while (length--) {
3785 if (iteratee(array[length], length, array) === false) {
3786 break;
3787 }
3788 }
3789 return array;
3790}
3791
3792var _arrayEachRight = arrayEachRight;
3793
3794/**
3795 * This function is like `baseFor` except that it iterates over properties
3796 * in the opposite order.
3797 *
3798 * @private
3799 * @param {Object} object The object to iterate over.
3800 * @param {Function} iteratee The function invoked per iteration.
3801 * @param {Function} keysFunc The function to get the keys of `object`.
3802 * @returns {Object} Returns `object`.
3803 */
3804var baseForRight = _createBaseFor(true);
3805
3806var _baseForRight = baseForRight;
3807
3808/**
3809 * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
3810 *
3811 * @private
3812 * @param {Object} object The object to iterate over.
3813 * @param {Function} iteratee The function invoked per iteration.
3814 * @returns {Object} Returns `object`.
3815 */
3816function baseForOwnRight(object, iteratee) {
3817 return object && _baseForRight(object, iteratee, keys_1);
3818}
3819
3820var _baseForOwnRight = baseForOwnRight;
3821
3822/**
3823 * Creates a `baseEach` or `baseEachRight` function.
3824 *
3825 * @private
3826 * @param {Function} eachFunc The function to iterate over a collection.
3827 * @param {boolean} [fromRight] Specify iterating from right to left.
3828 * @returns {Function} Returns the new base function.
3829 */
3830function createBaseEach(eachFunc, fromRight) {
3831 return function(collection, iteratee) {
3832 if (collection == null) {
3833 return collection;
3834 }
3835 if (!isArrayLike_1(collection)) {
3836 return eachFunc(collection, iteratee);
3837 }
3838 var length = collection.length,
3839 index = fromRight ? length : -1,
3840 iterable = Object(collection);
3841
3842 while ((fromRight ? index-- : ++index < length)) {
3843 if (iteratee(iterable[index], index, iterable) === false) {
3844 break;
3845 }
3846 }
3847 return collection;
3848 };
3849}
3850
3851var _createBaseEach = createBaseEach;
3852
3853/**
3854 * The base implementation of `_.forEachRight` without support for iteratee shorthands.
3855 *
3856 * @private
3857 * @param {Array|Object} collection The collection to iterate over.
3858 * @param {Function} iteratee The function invoked per iteration.
3859 * @returns {Array|Object} Returns `collection`.
3860 */
3861var baseEachRight = _createBaseEach(_baseForOwnRight, true);
3862
3863var _baseEachRight = baseEachRight;
3864
3865/**
3866 * Casts `value` to `identity` if it's not a function.
3867 *
3868 * @private
3869 * @param {*} value The value to inspect.
3870 * @returns {Function} Returns cast function.
3871 */
3872function castFunction(value) {
3873 return typeof value == 'function' ? value : identity_1;
3874}
3875
3876var _castFunction = castFunction;
3877
3878/**
3879 * This method is like `_.forEach` except that it iterates over elements of
3880 * `collection` from right to left.
3881 *
3882 * @static
3883 * @memberOf _
3884 * @since 2.0.0
3885 * @alias eachRight
3886 * @category Collection
3887 * @param {Array|Object} collection The collection to iterate over.
3888 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
3889 * @returns {Array|Object} Returns `collection`.
3890 * @see _.forEach
3891 * @example
3892 *
3893 * _.forEachRight([1, 2], function(value) {
3894 * console.log(value);
3895 * });
3896 * // => Logs `2` then `1`.
3897 */
3898function forEachRight(collection, iteratee) {
3899 var func = isArray_1(collection) ? _arrayEachRight : _baseEachRight;
3900 return func(collection, _castFunction(iteratee));
3901}
3902
3903var forEachRight_1 = forEachRight;
3904
3905var __assign$3 = undefined && undefined.__assign || Object.assign || function (t) {
3906 for (var s, i = 1, n = arguments.length; i < n; i++) {
3907 s = arguments[i];
3908 for (var p in s) {
3909 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3910 }
3911 }
3912 return t;
3913};
3914
3915/**
3916 * @overview create reducer function from the object
3917 * @param {Any} initialState – initial state of this part of the store
3918 * @param {Object} handlers – object with keys as action types, and
3919 * reduce functions to change store as values
3920 * @return {Function} – function to act as a reducer
3921 */
3922function createReducerFromObject(initialState, handlers) {
3923 return function reducer(state, action) {
3924 if (state === void 0) {
3925 state = initialState;
3926 }
3927 var handler = handlers[action.type];
3928 return typeof handler === 'function' ? handler(state, action) : state;
3929 };
3930}
3931/**
3932 * @overview create reducer from the object, with creating reducing functions
3933 * @param {Any} initialState – initial state of this part of the store
3934 * @param {Object} handlers – object with keys as action types, and
3935 * newValues to set at store as values
3936 * @return {Function} – function to act as a reducer
3937 */
3938function createReducer(initialState, handlers) {
3939 return createReducerFromObject(initialState, mapValues_1(handlers, function (value) {
3940 return function (state, action) {
3941 return reducerCreator({
3942 state: state,
3943 action: action,
3944 newValue: isFunction_1(value) ? value(state, action) : value
3945 });
3946 };
3947 }));
3948}
3949/**
3950 * @overview reducer function, which changes the state with new values
3951 * @param {Object} action – reducer action object, with type and payload
3952 * @param {Object} state – previous redux state in this branch
3953 * @param {Any} newValue – new value to set up in state in corresponding path
3954 * @return {Object} – changed reducer
3955 */
3956function reducerCreator(_a) {
3957 var action = _a.action,
3958 state = _a.state,
3959 newValue = _a.newValue;
3960 var path = action.payload.path;
3961 var hasNoNestInStore = !path;
3962 if (hasNoNestInStore) {
3963 return newValue;
3964 }
3965 var result = {};
3966 var lookupPath;
3967 // index stays as it was in original array, so the first
3968 // element in the iteration has `i` of the last element!
3969 forEachRight_1(path, function (el, i) {
3970 var isLastItem = i === path.length - 1;
3971 var newNestedResult = (_a = {}, _a[el] = isLastItem ? newValue : result, _a);
3972 lookupPath = path.slice(0, i);
3973 var oldState = get_1(state, lookupPath) || {};
3974 result = __assign$3({}, oldState, newNestedResult);
3975 var _a;
3976 });
3977 return __assign$3({}, state, result);
3978}
3979
3980var __assign$1 = undefined && undefined.__assign || Object.assign || function (t) {
3981 for (var s, i = 1, n = arguments.length; i < n; i++) {
3982 s = arguments[i];
3983 for (var p in s) {
3984 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3985 }
3986 }
3987 return t;
3988};
3989var prefix = 'Redux_Tiles_';
3990function createTile(params) {
3991 var type = params.type,
3992 fn = params.fn,
3993 caching = params.caching,
3994 nesting = params.nesting,
3995 _a = params.selectorFallback,
3996 selectorFallback = _a === void 0 ? null : _a;
3997 // initial state is equal to empty object, because of possible nesting
3998 // basically every object should contain default properties, so we handle
3999 // this situation using selectors
4000 var initialState = nesting ? {} : null;
4001 var identificator = createType({ type: type });
4002 var types = {
4003 START: "" + prefix + identificator + "_START",
4004 SUCCESS: "" + prefix + identificator + "_SUCCESS",
4005 FAILURE: "" + prefix + identificator + "_FAILURE",
4006 RESET: "" + prefix + identificator + "_RESET"
4007 };
4008 var selectorParams = {
4009 selectorFallback: {
4010 isPending: false,
4011 error: null,
4012 data: selectorFallback
4013 },
4014 tileName: type,
4015 nesting: nesting
4016 };
4017 var selectors = createSelectors(selectorParams);
4018 var actionParams = {
4019 START: types.START,
4020 SUCCESS: types.SUCCESS,
4021 FAILURE: types.FAILURE,
4022 fn: fn,
4023 type: type,
4024 caching: caching,
4025 nesting: nesting,
4026 selectors: selectors
4027 };
4028 var action = asyncAction(actionParams);
4029 action.reset = createResetAction({ type: types.RESET });
4030 var reducerObject = (_b = {}, _b[types.START] = {
4031 data: null,
4032 isPending: true,
4033 error: null
4034 }, _b[types.FAILURE] = function (_storeState, storeAction) {
4035 return {
4036 data: null,
4037 isPending: false,
4038 error: storeAction.error
4039 };
4040 }, _b[types.SUCCESS] = function (_storeState, storeAction) {
4041 return {
4042 error: null,
4043 isPending: false,
4044 data: storeAction.payload && storeAction.payload.data
4045 };
4046 }, _b[types.RESET] = initialState, _b);
4047 var reducer = createReducer(initialState, reducerObject);
4048 return { action: action, reducer: reducer, selectors: selectors, tileName: type, constants: types, reflect: params };
4049 var _b;
4050}
4051function createSyncTile(params) {
4052 var type = params.type,
4053 nesting = params.nesting,
4054 _a = params.fn,
4055 fn = _a === void 0 ? function (fnParams) {
4056 return fnParams.params;
4057 } : _a,
4058 fns = params.fns,
4059
4060 // we have default state as an object because of the possible nesting
4061 _b = params.initialState,
4062
4063 // we have default state as an object because of the possible nesting
4064 initialState = _b === void 0 ? nesting ? {} : null : _b,
4065 selectorFallback = params.selectorFallback;
4066 var identificator = createType({ type: type });
4067 var types = {
4068 SET: "" + prefix + identificator + "_SET",
4069 RESET: "" + prefix + identificator + "_RESET"
4070 };
4071 var selectorParams = {
4072 selectorFallback: selectorFallback,
4073 tileName: type,
4074 nesting: nesting
4075 };
4076 var selectors = createSelectors(selectorParams);
4077 var actionParams = {
4078 SET: types.SET,
4079 nesting: nesting,
4080 fn: fn
4081 };
4082 var action = syncAction(actionParams);
4083 action.reset = createResetAction({ type: types.RESET });
4084 if (fns) {
4085 Object.keys(fns).forEach(function (methodName) {
4086 var method = fns[methodName];
4087 var customActionParams = __assign$1({}, actionParams, { fn: method });
4088 action[methodName] = syncAction(customActionParams);
4089 });
4090 }
4091 var reducerObject = (_c = {}, _c[types.SET] = function (_storeState, storeAction) {
4092 return storeAction.payload && storeAction.payload.data;
4093 }, _c[types.RESET] = initialState, _c);
4094 var reducer = createReducer(initialState, reducerObject);
4095 return { action: action, selectors: selectors, reducer: reducer, tileName: type, constants: types, reflect: params };
4096 var _c;
4097}
4098
4099exports.createTile = createTile;
4100exports.createSyncTile = createSyncTile;
4101exports.createReducers = createReducers;
4102exports.createActions = createActions;
4103exports.createSelectors = createSelectors$1;
4104exports.createMiddleware = createMiddleware;
4105exports.createEntities = createEntities;
4106
4107Object.defineProperty(exports, '__esModule', { value: true });
4108
4109})));