@pie-element/drag-in-the-blank 8.3.3 → 8.3.4-next.3

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