@pie-element/charting 10.3.4-next.3 → 11.0.0-beta.1

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