@hrforte/react-pivottable 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3387 @@
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, {
40
+ /******/ configurable: false,
41
+ /******/ enumerable: true,
42
+ /******/ get: getter
43
+ /******/ });
44
+ /******/ }
45
+ /******/ };
46
+ /******/
47
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
48
+ /******/ __webpack_require__.n = function(module) {
49
+ /******/ var getter = module && module.__esModule ?
50
+ /******/ function getDefault() { return module['default']; } :
51
+ /******/ function getModuleExports() { return module; };
52
+ /******/ __webpack_require__.d(getter, 'a', getter);
53
+ /******/ return getter;
54
+ /******/ };
55
+ /******/
56
+ /******/ // Object.prototype.hasOwnProperty.call
57
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58
+ /******/
59
+ /******/ // __webpack_public_path__
60
+ /******/ __webpack_require__.p = "";
61
+ /******/
62
+ /******/ // Load entry module and return exports
63
+ /******/ return __webpack_require__(__webpack_require__.s = 4);
64
+ /******/ })
65
+ /************************************************************************/
66
+ /******/ ([
67
+ /* 0 */
68
+ /***/ (function(module, exports) {
69
+
70
+ // shim for using process in browser
71
+ var process = module.exports = {};
72
+
73
+ // cached from whatever global is present so that test runners that stub it
74
+ // don't break things. But we need to wrap it in a try catch in case it is
75
+ // wrapped in strict mode code which doesn't define any globals. It's inside a
76
+ // function because try/catches deoptimize in certain engines.
77
+
78
+ var cachedSetTimeout;
79
+ var cachedClearTimeout;
80
+
81
+ function defaultSetTimout() {
82
+ throw new Error('setTimeout has not been defined');
83
+ }
84
+ function defaultClearTimeout () {
85
+ throw new Error('clearTimeout has not been defined');
86
+ }
87
+ (function () {
88
+ try {
89
+ if (typeof setTimeout === 'function') {
90
+ cachedSetTimeout = setTimeout;
91
+ } else {
92
+ cachedSetTimeout = defaultSetTimout;
93
+ }
94
+ } catch (e) {
95
+ cachedSetTimeout = defaultSetTimout;
96
+ }
97
+ try {
98
+ if (typeof clearTimeout === 'function') {
99
+ cachedClearTimeout = clearTimeout;
100
+ } else {
101
+ cachedClearTimeout = defaultClearTimeout;
102
+ }
103
+ } catch (e) {
104
+ cachedClearTimeout = defaultClearTimeout;
105
+ }
106
+ } ())
107
+ function runTimeout(fun) {
108
+ if (cachedSetTimeout === setTimeout) {
109
+ //normal enviroments in sane situations
110
+ return setTimeout(fun, 0);
111
+ }
112
+ // if setTimeout wasn't available but was latter defined
113
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
114
+ cachedSetTimeout = setTimeout;
115
+ return setTimeout(fun, 0);
116
+ }
117
+ try {
118
+ // when when somebody has screwed with setTimeout but no I.E. maddness
119
+ return cachedSetTimeout(fun, 0);
120
+ } catch(e){
121
+ try {
122
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
123
+ return cachedSetTimeout.call(null, fun, 0);
124
+ } catch(e){
125
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
126
+ return cachedSetTimeout.call(this, fun, 0);
127
+ }
128
+ }
129
+
130
+
131
+ }
132
+ function runClearTimeout(marker) {
133
+ if (cachedClearTimeout === clearTimeout) {
134
+ //normal enviroments in sane situations
135
+ return clearTimeout(marker);
136
+ }
137
+ // if clearTimeout wasn't available but was latter defined
138
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
139
+ cachedClearTimeout = clearTimeout;
140
+ return clearTimeout(marker);
141
+ }
142
+ try {
143
+ // when when somebody has screwed with setTimeout but no I.E. maddness
144
+ return cachedClearTimeout(marker);
145
+ } catch (e){
146
+ try {
147
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
148
+ return cachedClearTimeout.call(null, marker);
149
+ } catch (e){
150
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
151
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
152
+ return cachedClearTimeout.call(this, marker);
153
+ }
154
+ }
155
+
156
+
157
+
158
+ }
159
+ var queue = [];
160
+ var draining = false;
161
+ var currentQueue;
162
+ var queueIndex = -1;
163
+
164
+ function cleanUpNextTick() {
165
+ if (!draining || !currentQueue) {
166
+ return;
167
+ }
168
+ draining = false;
169
+ if (currentQueue.length) {
170
+ queue = currentQueue.concat(queue);
171
+ } else {
172
+ queueIndex = -1;
173
+ }
174
+ if (queue.length) {
175
+ drainQueue();
176
+ }
177
+ }
178
+
179
+ function drainQueue() {
180
+ if (draining) {
181
+ return;
182
+ }
183
+ var timeout = runTimeout(cleanUpNextTick);
184
+ draining = true;
185
+
186
+ var len = queue.length;
187
+ while(len) {
188
+ currentQueue = queue;
189
+ queue = [];
190
+ while (++queueIndex < len) {
191
+ if (currentQueue) {
192
+ currentQueue[queueIndex].run();
193
+ }
194
+ }
195
+ queueIndex = -1;
196
+ len = queue.length;
197
+ }
198
+ currentQueue = null;
199
+ draining = false;
200
+ runClearTimeout(timeout);
201
+ }
202
+
203
+ process.nextTick = function (fun) {
204
+ var args = new Array(arguments.length - 1);
205
+ if (arguments.length > 1) {
206
+ for (var i = 1; i < arguments.length; i++) {
207
+ args[i - 1] = arguments[i];
208
+ }
209
+ }
210
+ queue.push(new Item(fun, args));
211
+ if (queue.length === 1 && !draining) {
212
+ runTimeout(drainQueue);
213
+ }
214
+ };
215
+
216
+ // v8 likes predictible objects
217
+ function Item(fun, array) {
218
+ this.fun = fun;
219
+ this.array = array;
220
+ }
221
+ Item.prototype.run = function () {
222
+ this.fun.apply(null, this.array);
223
+ };
224
+ process.title = 'browser';
225
+ process.browser = true;
226
+ process.env = {};
227
+ process.argv = [];
228
+ process.version = ''; // empty string to avoid regexp issues
229
+ process.versions = {};
230
+
231
+ function noop() {}
232
+
233
+ process.on = noop;
234
+ process.addListener = noop;
235
+ process.once = noop;
236
+ process.off = noop;
237
+ process.removeListener = noop;
238
+ process.removeAllListeners = noop;
239
+ process.emit = noop;
240
+ process.prependListener = noop;
241
+ process.prependOnceListener = noop;
242
+
243
+ process.listeners = function (name) { return [] }
244
+
245
+ process.binding = function (name) {
246
+ throw new Error('process.binding is not supported');
247
+ };
248
+
249
+ process.cwd = function () { return '/' };
250
+ process.chdir = function (dir) {
251
+ throw new Error('process.chdir is not supported');
252
+ };
253
+ process.umask = function() { return 0; };
254
+
255
+
256
+ /***/ }),
257
+ /* 1 */
258
+ /***/ (function(module, exports, __webpack_require__) {
259
+
260
+ "use strict";
261
+ /**
262
+ * Copyright (c) 2013-present, Facebook, Inc.
263
+ *
264
+ * This source code is licensed under the MIT license found in the
265
+ * LICENSE file in the root directory of this source tree.
266
+ */
267
+
268
+
269
+
270
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
271
+
272
+ module.exports = ReactPropTypesSecret;
273
+
274
+
275
+ /***/ }),
276
+ /* 2 */
277
+ /***/ (function(module, exports, __webpack_require__) {
278
+
279
+ "use strict";
280
+ /* WEBPACK VAR INJECTION */(function(process) {
281
+
282
+ if (process.env.NODE_ENV === 'production') {
283
+ module.exports = __webpack_require__(8);
284
+ } else {
285
+ module.exports = __webpack_require__(9);
286
+ }
287
+
288
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
289
+
290
+ /***/ }),
291
+ /* 3 */
292
+ /***/ (function(module, exports) {
293
+
294
+ module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
295
+
296
+
297
+ /***/ }),
298
+ /* 4 */
299
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
300
+
301
+ "use strict";
302
+ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
303
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__pivotCompute__ = __webpack_require__(5);
304
+ /* eslint-disable valid-jsdoc */
305
+ /*
306
+ * Web Worker entry point for off-main-thread pivot computation.
307
+ *
308
+ * Message protocol (plain, structured-cloneable objects):
309
+ * main -> worker {type: 'pivot:setData', id, dataKey, data}
310
+ * main -> worker {type: 'pivot:compute', id, dataKey, config}
311
+ * worker -> main {type: 'pivot:progress', id, processed, total, phase}
312
+ * worker -> main {type: 'pivot:result', id, result}
313
+ * worker -> main {type: 'pivot:error', id, message}
314
+ *
315
+ * The materialized dataset is cached per dataKey, so repeated computations on
316
+ * the same data (e.g. dragging fields around) do not pay the cost of
317
+ * re-scanning the raw records.
318
+ */
319
+
320
+
321
+ var MAX_CACHED_DATASETS = 4;
322
+
323
+ var datasetCache = new Map();
324
+
325
+ var cacheDataset = function cacheDataset(dataKey, dataset) {
326
+ datasetCache.delete(dataKey);
327
+ datasetCache.set(dataKey, dataset);
328
+ while (datasetCache.size > MAX_CACHED_DATASETS) {
329
+ var oldestKey = datasetCache.keys().next().value;
330
+ datasetCache.delete(oldestKey);
331
+ }
332
+ return dataset;
333
+ };
334
+
335
+ var postToMain = function postToMain(message) {
336
+ self.postMessage(message);
337
+ };
338
+
339
+ var toErrorMessage = function toErrorMessage(error) {
340
+ return String(error && error.message || error);
341
+ };
342
+
343
+ self.addEventListener('message', function (event) {
344
+ var message = event.data || {};
345
+
346
+ if (message.type === 'pivot:setData') {
347
+ try {
348
+ cacheDataset(message.dataKey, Object(__WEBPACK_IMPORTED_MODULE_0__pivotCompute__["b" /* materializeData */])(message.data, {}, function (processed, total) {
349
+ postToMain({
350
+ type: 'pivot:progress',
351
+ id: message.id,
352
+ processed: processed,
353
+ total: total,
354
+ phase: 'materialize'
355
+ });
356
+ }));
357
+ } catch (error) {
358
+ postToMain({
359
+ type: 'pivot:error',
360
+ id: message.id,
361
+ message: toErrorMessage(error)
362
+ });
363
+ }
364
+ return;
365
+ }
366
+
367
+ if (message.type === 'pivot:compute') {
368
+ try {
369
+ var dataset = datasetCache.get(message.dataKey);
370
+ if (!dataset) {
371
+ throw new Error('no dataset staged for key ' + message.dataKey);
372
+ }
373
+ var result = Object(__WEBPACK_IMPORTED_MODULE_0__pivotCompute__["a" /* computePivotState */])(dataset, message.config, function (processed, total, phase) {
374
+ postToMain({
375
+ type: 'pivot:progress',
376
+ id: message.id,
377
+ processed: processed,
378
+ total: total,
379
+ phase: phase
380
+ });
381
+ });
382
+ postToMain({ type: 'pivot:result', id: message.id, result: result });
383
+ } catch (error) {
384
+ postToMain({
385
+ type: 'pivot:error',
386
+ id: message.id,
387
+ message: toErrorMessage(error)
388
+ });
389
+ }
390
+ }
391
+ });
392
+
393
+ /***/ }),
394
+ /* 5 */
395
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
396
+
397
+ "use strict";
398
+ /* unused harmony export PROGRESS_BATCH_SIZE */
399
+ /* unused harmony export DEFAULT_WORKER_THRESHOLD */
400
+ /* unused harmony export WORKER_DEBOUNCE_MS */
401
+ /* harmony export (immutable) */ __webpack_exports__["b"] = materializeData;
402
+ /* harmony export (immutable) */ __webpack_exports__["a"] = computePivotState;
403
+ /* unused harmony export serializePivotData */
404
+ /* unused harmony export sortersHaveFunctions */
405
+ /* unused harmony export sanitizeSorters */
406
+ /* unused harmony export createWorkerConfig */
407
+ /* unused harmony export createComputeSignature */
408
+ /* unused harmony export canComputeInWorker */
409
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Utilities__ = __webpack_require__(6);
410
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
411
+
412
+ /* eslint-disable valid-jsdoc */
413
+ /*
414
+ * Shared pivot-computation logic.
415
+ *
416
+ * This module contains the pure, DOM-free parts of the pivot computation so
417
+ * that the exact same code paths can run:
418
+ * - on the main thread (classic synchronous rendering path), and
419
+ * - inside a Web Worker (src/pivotWorker.js) for large datasets.
420
+ *
421
+ * It must stay free of React and of any `window`/`document` references.
422
+ */
423
+
424
+
425
+ // A progress callback fires every N processed records so the UI can render
426
+ // progress without adding measurable overhead to the per-record loop.
427
+ var PROGRESS_BATCH_SIZE = 20000;
428
+
429
+ // Datasets smaller than this are computed synchronously on the main thread;
430
+ // larger ones are handed off to the Web Worker.
431
+ var DEFAULT_WORKER_THRESHOLD = 10000;
432
+
433
+ // Trailing debounce before a worker computation is dispatched, so rapid
434
+ // interactions do not queue one full computation per single change.
435
+ var WORKER_DEBOUNCE_MS = 200;
436
+
437
+ /*
438
+ * Walks the raw input once and computes the attribute-value inventory plus a
439
+ * "materialized" copy of the records (with derived attributes applied).
440
+ * This is an exact extraction of the historical PivotTableUI behavior.
441
+ *
442
+ * onProgress receives (processed, total, phase); total is null when it is
443
+ * unknown upfront (function-based data sources).
444
+ */
445
+ function materializeData(data, derivedAttributes, onProgress) {
446
+ var attrValues = {};
447
+ var materializedInput = [];
448
+ var total = Array.isArray(data) ? data.length : null;
449
+ var recordsProcessed = 0;
450
+ __WEBPACK_IMPORTED_MODULE_0__Utilities__["a" /* PivotData */].forEachRecord(data, derivedAttributes || {}, function (record) {
451
+ materializedInput.push(record);
452
+ var _iteratorNormalCompletion = true;
453
+ var _didIteratorError = false;
454
+ var _iteratorError = undefined;
455
+
456
+ try {
457
+ for (var _iterator = Object.keys(record)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
458
+ var attr = _step.value;
459
+
460
+ if (!(attr in attrValues)) {
461
+ attrValues[attr] = {};
462
+ if (recordsProcessed > 0) {
463
+ attrValues[attr].null = recordsProcessed;
464
+ }
465
+ }
466
+ }
467
+ } catch (err) {
468
+ _didIteratorError = true;
469
+ _iteratorError = err;
470
+ } finally {
471
+ try {
472
+ if (!_iteratorNormalCompletion && _iterator.return) {
473
+ _iterator.return();
474
+ }
475
+ } finally {
476
+ if (_didIteratorError) {
477
+ throw _iteratorError;
478
+ }
479
+ }
480
+ }
481
+
482
+ for (var _attr in attrValues) {
483
+ var value = _attr in record ? record[_attr] : 'null';
484
+ if (!(value in attrValues[_attr])) {
485
+ attrValues[_attr][value] = 0;
486
+ }
487
+ attrValues[_attr][value]++;
488
+ }
489
+ recordsProcessed++;
490
+ if (onProgress && recordsProcessed % PROGRESS_BATCH_SIZE === 0) {
491
+ onProgress(recordsProcessed, total, 'materialize');
492
+ }
493
+ });
494
+ return { attrValues: attrValues, materializedInput: materializedInput, totalRecords: recordsProcessed };
495
+ }
496
+
497
+ /*
498
+ * Aggregates an already-materialized dataset into a PivotData instance and
499
+ * serializes the result into a plain (structured-cloneable) object that can
500
+ * cross the worker boundary and later hydrate PivotData on the main thread.
501
+ */
502
+ function computePivotState(materialized, config, onProgress) {
503
+ var total = materialized.totalRecords;
504
+ var pivotData = new __WEBPACK_IMPORTED_MODULE_0__Utilities__["a" /* PivotData */](Object.assign({}, config, {
505
+ data: materialized.materializedInput,
506
+ derivedAttributes: {},
507
+ onRecordProcessed: function onRecordProcessed(processed) {
508
+ if (onProgress) {
509
+ onProgress(processed, total, 'aggregate');
510
+ }
511
+ }
512
+ }));
513
+ // Force key sorting to happen while we are (possibly) inside the worker.
514
+ pivotData.getRowKeys();
515
+ pivotData.getColKeys();
516
+ return serializePivotData(pivotData, materialized);
517
+ }
518
+
519
+ /*
520
+ * Serializes a fully-built PivotData instance into plain data. Only the final
521
+ * aggregated value of every cell is kept; `value()` and `format()` behavior
522
+ * are reconstructed on the main thread by the PivotData hydration step.
523
+ */
524
+ function serializePivotData(pivotData, materialized) {
525
+ var serializeCell = function serializeCell(cell) {
526
+ var values = {};
527
+ pivotData.aggregations.forEach(function (agg) {
528
+ var instance = cell.getInstance(agg.key);
529
+ if (instance) {
530
+ values[agg.key] = instance.value();
531
+ }
532
+ });
533
+ return { values: values };
534
+ };
535
+
536
+ var tree = {};
537
+ Object.keys(pivotData.tree).forEach(function (flatRowKey) {
538
+ var rowBranch = pivotData.tree[flatRowKey];
539
+ var serializedRow = {};
540
+ Object.keys(rowBranch).forEach(function (flatColKey) {
541
+ serializedRow[flatColKey] = serializeCell(rowBranch[flatColKey]);
542
+ });
543
+ tree[flatRowKey] = serializedRow;
544
+ });
545
+
546
+ var serializeTotals = function serializeTotals(totals) {
547
+ var serialized = {};
548
+ Object.keys(totals).forEach(function (flatKey) {
549
+ serialized[flatKey] = serializeCell(totals[flatKey]);
550
+ });
551
+ return serialized;
552
+ };
553
+
554
+ return {
555
+ rowKeys: pivotData.rowKeys.map(function (key) {
556
+ return key.slice();
557
+ }),
558
+ colKeys: pivotData.colKeys.map(function (key) {
559
+ return key.slice();
560
+ }),
561
+ tree: tree,
562
+ rowTotals: serializeTotals(pivotData.rowTotals),
563
+ colTotals: serializeTotals(pivotData.colTotals),
564
+ allTotal: serializeCell(pivotData.allTotal),
565
+ aggregations: pivotData.aggregations.map(function (agg) {
566
+ return Object.assign({}, agg);
567
+ }),
568
+ attrValues: materialized.attrValues,
569
+ materializedInput: materialized.materializedInput,
570
+ totalRecords: materialized.totalRecords
571
+ };
572
+ }
573
+
574
+ /*
575
+ * Sorters containing functions cannot be structured-cloned into a worker.
576
+ * Returns true when the sorters prop itself, or any of its entries, is a
577
+ * function. In that case PivotData re-sorts on the main thread after
578
+ * hydration (distinct keys are few, so this stays cheap).
579
+ */
580
+ function sortersHaveFunctions(sorters) {
581
+ if (typeof sorters === 'function') {
582
+ return true;
583
+ }
584
+ if (!sorters || (typeof sorters === 'undefined' ? 'undefined' : _typeof(sorters)) !== 'object') {
585
+ return false;
586
+ }
587
+ return Object.keys(sorters).some(function (attr) {
588
+ return typeof sorters[attr] === 'function';
589
+ });
590
+ }
591
+
592
+ /*
593
+ * Returns a structured-cloneable subset of the sorters prop: data-type names
594
+ * and sample-value arrays survive the worker boundary, functions do not.
595
+ */
596
+ function sanitizeSorters(sorters) {
597
+ if (!sorters || (typeof sorters === 'undefined' ? 'undefined' : _typeof(sorters)) !== 'object' || typeof sorters === 'function') {
598
+ return {};
599
+ }
600
+ var clean = {};
601
+ Object.keys(sorters).forEach(function (attr) {
602
+ var sorter = sorters[attr];
603
+ if (typeof sorter === 'string' || Array.isArray(sorter)) {
604
+ clean[attr] = sorter;
605
+ }
606
+ });
607
+ return clean;
608
+ }
609
+
610
+ /*
611
+ * Extracts exactly the props PivotData needs to compute results, with
612
+ * everything non-serializable stripped, so the object can be posted to the
613
+ * worker and fed straight into PivotData.
614
+ */
615
+ function createWorkerConfig(props) {
616
+ return {
617
+ rows: props.rows,
618
+ cols: props.cols,
619
+ aggregatorName: props.aggregatorName,
620
+ aggregations: props.aggregations,
621
+ vals: props.vals,
622
+ valueFilter: props.valueFilter,
623
+ sorters: sanitizeSorters(props.sorters),
624
+ rowOrder: props.rowOrder,
625
+ colOrder: props.colOrder,
626
+ rowSorts: props.rowSorts,
627
+ colSorts: props.colSorts
628
+ };
629
+ }
630
+
631
+ /*
632
+ * Stable string signature of everything that influences a worker computation.
633
+ * Data identity is NOT part of it; callers append their own data version.
634
+ */
635
+ function createComputeSignature(props) {
636
+ return JSON.stringify(createWorkerConfig(props));
637
+ }
638
+
639
+ /*
640
+ * Decides whether the current props can be computed inside the Web Worker.
641
+ * Anything that cannot be structured-cloned (function data sources, custom
642
+ * derivedAttributes, custom aggregator maps) forces the classic path.
643
+ * Function-based sorters are allowed: they are re-applied on the main thread.
644
+ */
645
+ function canComputeInWorker(props) {
646
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
647
+
648
+ if (options.enabled === false) {
649
+ return false;
650
+ }
651
+ if (typeof Worker === 'undefined') {
652
+ return false;
653
+ }
654
+ var threshold = typeof options.threshold === 'number' ? options.threshold : DEFAULT_WORKER_THRESHOLD;
655
+ var data = props.data;
656
+ if (!Array.isArray(data) || data.length < threshold) {
657
+ return false;
658
+ }
659
+ if (props.derivedAttributes && Object.keys(props.derivedAttributes).length > 0) {
660
+ return false;
661
+ }
662
+ if (props.aggregators !== __WEBPACK_IMPORTED_MODULE_0__Utilities__["a" /* PivotData */].defaultProps.aggregators) {
663
+ return false;
664
+ }
665
+ return true;
666
+ }
667
+
668
+ /***/ }),
669
+ /* 6 */
670
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
671
+
672
+ "use strict";
673
+ /* unused harmony export aggregatorTemplates */
674
+ /* unused harmony export aggregators */
675
+ /* unused harmony export derivers */
676
+ /* unused harmony export locales */
677
+ /* unused harmony export naturalSort */
678
+ /* unused harmony export numberFormat */
679
+ /* unused harmony export getSort */
680
+ /* unused harmony export sortAs */
681
+ /* unused harmony export builtInSorters */
682
+ /* unused harmony export detectDataType */
683
+ /* unused harmony export createSorterByType */
684
+ /* unused harmony export sortersHaveFunctions */
685
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PivotData; });
686
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prop_types__ = __webpack_require__(7);
687
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_prop_types__);
688
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
689
+
690
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
691
+
692
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
693
+
694
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
695
+
696
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
697
+
698
+ /* eslint-disable no-undefined */
699
+
700
+
701
+ /*
702
+ * decaffeinate suggestions:
703
+ * DS101: Remove unnecessary use of Array.from
704
+ * DS102: Remove unnecessary code created because of implicit returns
705
+ * DS104: Avoid inline assignments
706
+ * DS201: Simplify complex destructure assignments
707
+ * DS203: Remove `|| {}` from converted for-own loops
708
+ * DS205: Consider reworking code to avoid use of IIFEs
709
+ * DS207: Consider shorter variations of null checks
710
+ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
711
+ */
712
+
713
+ var addSeparators = function addSeparators(nStr, thousandsSep, decimalSep) {
714
+ var x = String(nStr).split('.');
715
+ var x1 = x[0];
716
+ var x2 = x.length > 1 ? decimalSep + x[1] : '';
717
+ var rgx = /(\d+)(\d{3})/;
718
+ while (rgx.test(x1)) {
719
+ x1 = x1.replace(rgx, '$1' + thousandsSep + '$2');
720
+ }
721
+ return x1 + x2;
722
+ };
723
+
724
+ var numberFormat = function numberFormat(opts_in) {
725
+ var defaults = {
726
+ digitsAfterDecimal: 2,
727
+ scaler: 1,
728
+ thousandsSep: ',',
729
+ decimalSep: '.',
730
+ prefix: '',
731
+ suffix: '',
732
+ showOriginal: false
733
+ };
734
+ var opts = Object.assign({}, defaults, opts_in);
735
+ return function (x) {
736
+ if (isNaN(x) || !isFinite(x)) {
737
+ return '';
738
+ }
739
+ // Show completely original value if showOriginal is true
740
+ if (opts.showOriginal) {
741
+ return String(opts.scaler * x);
742
+ }
743
+ // When thousandsSep is empty, apply decimal formatting but skip thousand separator
744
+ if (opts.thousandsSep === '') {
745
+ var scaledValue = opts.scaler * x;
746
+ var fixedValue = scaledValue.toFixed(opts.digitsAfterDecimal);
747
+ // Apply decimal separator if needed
748
+ var _result = fixedValue.replace('.', opts.decimalSep);
749
+ return '' + opts.prefix + _result + opts.suffix;
750
+ }
751
+ // Normal formatting with thousand separator
752
+ var result = addSeparators((opts.scaler * x).toFixed(opts.digitsAfterDecimal), opts.thousandsSep, opts.decimalSep);
753
+ return '' + opts.prefix + result + opts.suffix;
754
+ };
755
+ };
756
+
757
+ var rx = /(\d+)|(\D+)/g;
758
+ var rd = /\d/;
759
+ var rz = /^0/;
760
+ var naturalSort = function naturalSort(as, bs) {
761
+ // nulls first
762
+ if (bs !== null && as === null) {
763
+ return -1;
764
+ }
765
+ if (as !== null && bs === null) {
766
+ return 1;
767
+ }
768
+
769
+ // then raw NaNs
770
+ if (typeof as === 'number' && isNaN(as)) {
771
+ return -1;
772
+ }
773
+ if (typeof bs === 'number' && isNaN(bs)) {
774
+ return 1;
775
+ }
776
+
777
+ // numbers and numbery strings group together
778
+ var nas = Number(as);
779
+ var nbs = Number(bs);
780
+ if (nas < nbs) {
781
+ return -1;
782
+ }
783
+ if (nas > nbs) {
784
+ return 1;
785
+ }
786
+
787
+ // within that, true numbers before numbery strings
788
+ if (typeof as === 'number' && typeof bs !== 'number') {
789
+ return -1;
790
+ }
791
+ if (typeof bs === 'number' && typeof as !== 'number') {
792
+ return 1;
793
+ }
794
+ if (typeof as === 'number' && typeof bs === 'number') {
795
+ return 0;
796
+ }
797
+
798
+ // 'Infinity' is a textual number, so less than 'A'
799
+ if (isNaN(nbs) && !isNaN(nas)) {
800
+ return -1;
801
+ }
802
+ if (isNaN(nas) && !isNaN(nbs)) {
803
+ return 1;
804
+ }
805
+
806
+ // finally, "smart" string sorting per http://stackoverflow.com/a/4373421/112871
807
+ var a = String(as);
808
+ var b = String(bs);
809
+ if (a === b) {
810
+ return 0;
811
+ }
812
+ if (!rd.test(a) || !rd.test(b)) {
813
+ return a > b ? 1 : -1;
814
+ }
815
+
816
+ // special treatment for strings containing digits
817
+ a = a.match(rx);
818
+ b = b.match(rx);
819
+ while (a.length && b.length) {
820
+ var a1 = a.shift();
821
+ var b1 = b.shift();
822
+ if (a1 !== b1) {
823
+ if (rd.test(a1) && rd.test(b1)) {
824
+ return a1.replace(rz, '.0') - b1.replace(rz, '.0');
825
+ }
826
+ return a1 > b1 ? 1 : -1;
827
+ }
828
+ }
829
+ return a.length - b.length;
830
+ };
831
+
832
+ var sortAs = function sortAs(order) {
833
+ var mapping = {};
834
+
835
+ // sort lowercased keys similarly
836
+ var l_mapping = {};
837
+ for (var i in order) {
838
+ var x = order[i];
839
+ mapping[x] = i;
840
+ if (typeof x === 'string') {
841
+ l_mapping[x.toLowerCase()] = i;
842
+ }
843
+ }
844
+ return function (a, b) {
845
+ if (a in mapping && b in mapping) {
846
+ return mapping[a] - mapping[b];
847
+ } else if (a in mapping) {
848
+ return -1;
849
+ } else if (b in mapping) {
850
+ return 1;
851
+ } else if (a in l_mapping && b in l_mapping) {
852
+ return l_mapping[a] - l_mapping[b];
853
+ } else if (a in l_mapping) {
854
+ return -1;
855
+ } else if (b in l_mapping) {
856
+ return 1;
857
+ }
858
+ return naturalSort(a, b);
859
+ };
860
+ };
861
+
862
+ // Built-in sort functions for different data types
863
+ var builtInSorters = {
864
+ // Number sorter - handles numeric values
865
+ number: function number(a, b) {
866
+ if (a === null || a === undefined || a === '') {
867
+ return b === null || b === undefined || b === '' ? 0 : -1;
868
+ }
869
+ if (b === null || b === undefined || b === '') {
870
+ return 1;
871
+ }
872
+ var numA = typeof a === 'number' ? a : parseFloat(a);
873
+ var numB = typeof b === 'number' ? b : parseFloat(b);
874
+ if (isNaN(numA) && isNaN(numB)) {
875
+ return 0;
876
+ }
877
+ if (isNaN(numA)) {
878
+ return -1;
879
+ }
880
+ if (isNaN(numB)) {
881
+ return 1;
882
+ }
883
+ return numA - numB;
884
+ },
885
+
886
+ // Date sorter - handles date values
887
+ date: function date(a, b) {
888
+ if (a === null || a === undefined || a === '') {
889
+ return b === null || b === undefined || b === '' ? 0 : -1;
890
+ }
891
+ if (b === null || b === undefined || b === '') {
892
+ return 1;
893
+ }
894
+ var dateA = a instanceof Date ? a : new Date(a);
895
+ var dateB = b instanceof Date ? b : new Date(b);
896
+ if (isNaN(dateA.getTime()) && isNaN(dateB.getTime())) {
897
+ return 0;
898
+ }
899
+ if (isNaN(dateA.getTime())) {
900
+ return -1;
901
+ }
902
+ if (isNaN(dateB.getTime())) {
903
+ return 1;
904
+ }
905
+ return dateA.getTime() - dateB.getTime();
906
+ },
907
+
908
+ // String sorter - case-sensitive
909
+ string: function string(a, b) {
910
+ if (a === null || a === undefined || a === '') {
911
+ return b === null || b === undefined || b === '' ? 0 : -1;
912
+ }
913
+ if (b === null || b === undefined || b === '') {
914
+ return 1;
915
+ }
916
+ var strA = String(a);
917
+ var strB = String(b);
918
+ return strA > strB ? 1 : strA < strB ? -1 : 0;
919
+ },
920
+
921
+ // String sorter - case-insensitive
922
+ stringCaseInsensitive: function stringCaseInsensitive(a, b) {
923
+ if (a === null || a === undefined || a === '') {
924
+ return b === null || b === undefined || b === '' ? 0 : -1;
925
+ }
926
+ if (b === null || b === undefined || b === '') {
927
+ return 1;
928
+ }
929
+ var strA = String(a).toLowerCase();
930
+ var strB = String(b).toLowerCase();
931
+ return strA > strB ? 1 : strA < strB ? -1 : 0;
932
+ },
933
+
934
+ // Natural sort (default)
935
+ natural: naturalSort
936
+ };
937
+
938
+ // Alias for backward compatibility
939
+ // const sorters = builtInSorters;
940
+
941
+ // Auto-detect data type from sample values
942
+ var detectDataType = function detectDataType(values) {
943
+ if (!values || values.length === 0) {
944
+ return 'natural';
945
+ }
946
+
947
+ var sampleSize = Math.min(10, values.length);
948
+ var samples = values.slice(0, sampleSize);
949
+
950
+ var numberCount = 0;
951
+ var dateCount = 0;
952
+ var stringCount = 0;
953
+
954
+ var _iteratorNormalCompletion = true;
955
+ var _didIteratorError = false;
956
+ var _iteratorError = undefined;
957
+
958
+ try {
959
+ for (var _iterator = samples[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
960
+ var val = _step.value;
961
+
962
+ if (val === null || val === undefined || val === '') {
963
+ continue;
964
+ }
965
+
966
+ // Check if it's a number
967
+ if (typeof val === 'number' || !isNaN(parseFloat(val)) && isFinite(val)) {
968
+ numberCount++;
969
+ }
970
+ // Check if it's a date
971
+ else if (val instanceof Date || !isNaN(Date.parse(val)) && String(val).match(/^\d{4}-\d{2}-\d{2}/)) {
972
+ dateCount++;
973
+ }
974
+ // Otherwise it's a string
975
+ else {
976
+ stringCount++;
977
+ }
978
+ }
979
+
980
+ // Determine the most common type
981
+ } catch (err) {
982
+ _didIteratorError = true;
983
+ _iteratorError = err;
984
+ } finally {
985
+ try {
986
+ if (!_iteratorNormalCompletion && _iterator.return) {
987
+ _iterator.return();
988
+ }
989
+ } finally {
990
+ if (_didIteratorError) {
991
+ throw _iteratorError;
992
+ }
993
+ }
994
+ }
995
+
996
+ if (numberCount > dateCount && numberCount > stringCount) {
997
+ return 'number';
998
+ } else if (dateCount > stringCount) {
999
+ return 'date';
1000
+ } else if (stringCount > 0) {
1001
+ return 'string';
1002
+ }
1003
+
1004
+ return 'natural';
1005
+ };
1006
+
1007
+ // Create a sorter based on data type
1008
+ var createSorterByType = function createSorterByType(dataType) {
1009
+ if (typeof dataType === 'function') {
1010
+ return dataType;
1011
+ }
1012
+
1013
+ if (typeof dataType === 'string' && dataType in builtInSorters) {
1014
+ return builtInSorters[dataType];
1015
+ }
1016
+
1017
+ // Auto-detect if dataType is an array of values
1018
+ if (Array.isArray(dataType)) {
1019
+ var detectedType = detectDataType(dataType);
1020
+ return builtInSorters[detectedType] || naturalSort;
1021
+ }
1022
+
1023
+ return naturalSort;
1024
+ };
1025
+
1026
+ // Get sorter for an attribute, with auto-detection support
1027
+ var getSort = function getSort(sorters, attr) {
1028
+ var attrValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1029
+
1030
+ if (sorters) {
1031
+ if (typeof sorters === 'function') {
1032
+ var sort = sorters(attr);
1033
+ if (typeof sort === 'function') {
1034
+ return sort;
1035
+ }
1036
+ } else if (attr in sorters) {
1037
+ var sorter = sorters[attr];
1038
+ // If it's a string (data type name) or array (sample values), create appropriate sorter
1039
+ if (typeof sorter === 'string' || Array.isArray(sorter)) {
1040
+ return createSorterByType(sorter);
1041
+ }
1042
+ // If it's already a function, use it
1043
+ if (typeof sorter === 'function') {
1044
+ return sorter;
1045
+ }
1046
+ }
1047
+ }
1048
+
1049
+ // Auto-detect if attrValues are provided
1050
+ if (attrValues && (typeof attrValues === 'undefined' ? 'undefined' : _typeof(attrValues)) === 'object') {
1051
+ var values = Object.keys(attrValues);
1052
+ if (values.length > 0) {
1053
+ var detectedType = detectDataType(values);
1054
+ return builtInSorters[detectedType] || naturalSort;
1055
+ }
1056
+ }
1057
+
1058
+ return naturalSort;
1059
+ };
1060
+
1061
+ // aggregator templates default to US number formatting but this is overrideable
1062
+ var usFmt = numberFormat();
1063
+ var usFmtInt = numberFormat({ digitsAfterDecimal: 0 });
1064
+ var usFmtPct = numberFormat({
1065
+ digitsAfterDecimal: 1,
1066
+ scaler: 100,
1067
+ suffix: '%'
1068
+ });
1069
+
1070
+ // Emit a progress callback every N processed records without adding
1071
+ // measurable overhead to the per-record loop.
1072
+ var RECORD_PROGRESS_BATCH_SIZE = 25000;
1073
+
1074
+ // Returns true when the sorters prop itself, or any of its entries, is a
1075
+ // function. Function-based sorters cannot be transferred to a Web Worker, so
1076
+ // PivotData re-applies them on the main thread after worker hydration.
1077
+ var sortersHaveFunctions = function sortersHaveFunctions(sorters) {
1078
+ if (typeof sorters === 'function') {
1079
+ return true;
1080
+ }
1081
+ if (!sorters || (typeof sorters === 'undefined' ? 'undefined' : _typeof(sorters)) !== 'object') {
1082
+ return false;
1083
+ }
1084
+ return Object.keys(sorters).some(function (attr) {
1085
+ return typeof sorters[attr] === 'function';
1086
+ });
1087
+ };
1088
+
1089
+ var aggregatorTemplates = {
1090
+ count: function count() {
1091
+ var formatter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : usFmtInt;
1092
+
1093
+ return function () {
1094
+ return function () {
1095
+ return {
1096
+ count: 0,
1097
+ push: function push() {
1098
+ this.count++;
1099
+ },
1100
+ value: function value() {
1101
+ return this.count;
1102
+ },
1103
+
1104
+ format: formatter
1105
+ };
1106
+ };
1107
+ };
1108
+ },
1109
+ uniques: function uniques(fn) {
1110
+ var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : usFmtInt;
1111
+
1112
+ return function (_ref) {
1113
+ var _ref2 = _slicedToArray(_ref, 1),
1114
+ attr = _ref2[0];
1115
+
1116
+ return function () {
1117
+ return {
1118
+ uniq: [],
1119
+ push: function push(record) {
1120
+ if (!Array.from(this.uniq).includes(record[attr])) {
1121
+ this.uniq.push(record[attr]);
1122
+ }
1123
+ },
1124
+ value: function value() {
1125
+ return fn(this.uniq);
1126
+ },
1127
+
1128
+ format: formatter,
1129
+ numInputs: typeof attr !== 'undefined' ? 0 : 1
1130
+ };
1131
+ };
1132
+ };
1133
+ },
1134
+ sum: function sum() {
1135
+ var formatter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : usFmt;
1136
+
1137
+ return function (_ref3) {
1138
+ var _ref4 = _slicedToArray(_ref3, 1),
1139
+ attr = _ref4[0];
1140
+
1141
+ return function () {
1142
+ return {
1143
+ sum: 0,
1144
+ push: function push(record) {
1145
+ if (!isNaN(parseFloat(record[attr]))) {
1146
+ this.sum += parseFloat(record[attr]);
1147
+ }
1148
+ },
1149
+ value: function value() {
1150
+ return this.sum;
1151
+ },
1152
+
1153
+ format: formatter,
1154
+ numInputs: typeof attr !== 'undefined' ? 0 : 1
1155
+ };
1156
+ };
1157
+ };
1158
+ },
1159
+ extremes: function extremes(mode) {
1160
+ var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : usFmt;
1161
+
1162
+ return function (_ref5) {
1163
+ var _ref6 = _slicedToArray(_ref5, 1),
1164
+ attr = _ref6[0];
1165
+
1166
+ return function (data) {
1167
+ return {
1168
+ val: null,
1169
+ sorter: getSort(typeof data !== 'undefined' ? data.sorters : null, attr),
1170
+ push: function push(record) {
1171
+ var x = record[attr];
1172
+ if (['min', 'max'].includes(mode)) {
1173
+ x = parseFloat(x);
1174
+ if (!isNaN(x)) {
1175
+ this.val = Math[mode](x, this.val !== null ? this.val : x);
1176
+ }
1177
+ }
1178
+ if (mode === 'first' && this.sorter(x, this.val !== null ? this.val : x) <= 0) {
1179
+ this.val = x;
1180
+ }
1181
+ if (mode === 'last' && this.sorter(x, this.val !== null ? this.val : x) >= 0) {
1182
+ this.val = x;
1183
+ }
1184
+ },
1185
+ value: function value() {
1186
+ return this.val;
1187
+ },
1188
+ format: function format(x) {
1189
+ if (isNaN(x)) {
1190
+ return x;
1191
+ }
1192
+ return formatter(x);
1193
+ },
1194
+
1195
+ numInputs: typeof attr !== 'undefined' ? 0 : 1
1196
+ };
1197
+ };
1198
+ };
1199
+ },
1200
+ quantile: function quantile(q) {
1201
+ var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : usFmt;
1202
+
1203
+ return function (_ref7) {
1204
+ var _ref8 = _slicedToArray(_ref7, 1),
1205
+ attr = _ref8[0];
1206
+
1207
+ return function () {
1208
+ return {
1209
+ vals: [],
1210
+ push: function push(record) {
1211
+ var x = parseFloat(record[attr]);
1212
+ if (!isNaN(x)) {
1213
+ this.vals.push(x);
1214
+ }
1215
+ },
1216
+ value: function value() {
1217
+ if (this.vals.length === 0) {
1218
+ return null;
1219
+ }
1220
+ this.vals.sort(function (a, b) {
1221
+ return a - b;
1222
+ });
1223
+ var i = (this.vals.length - 1) * q;
1224
+ return (this.vals[Math.floor(i)] + this.vals[Math.ceil(i)]) / 2.0;
1225
+ },
1226
+
1227
+ format: formatter,
1228
+ numInputs: typeof attr !== 'undefined' ? 0 : 1
1229
+ };
1230
+ };
1231
+ };
1232
+ },
1233
+ runningStat: function runningStat() {
1234
+ var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'mean';
1235
+ var ddof = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1236
+ var formatter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : usFmt;
1237
+
1238
+ return function (_ref9) {
1239
+ var _ref10 = _slicedToArray(_ref9, 1),
1240
+ attr = _ref10[0];
1241
+
1242
+ return function () {
1243
+ return {
1244
+ n: 0.0,
1245
+ m: 0.0,
1246
+ s: 0.0,
1247
+ push: function push(record) {
1248
+ var x = parseFloat(record[attr]);
1249
+ if (isNaN(x)) {
1250
+ return;
1251
+ }
1252
+ this.n += 1.0;
1253
+ if (this.n === 1.0) {
1254
+ this.m = x;
1255
+ }
1256
+ var m_new = this.m + (x - this.m) / this.n;
1257
+ this.s = this.s + (x - this.m) * (x - m_new);
1258
+ this.m = m_new;
1259
+ },
1260
+ value: function value() {
1261
+ if (mode === 'mean') {
1262
+ if (this.n === 0) {
1263
+ return 0 / 0;
1264
+ }
1265
+ return this.m;
1266
+ }
1267
+ if (this.n <= ddof) {
1268
+ return 0;
1269
+ }
1270
+ switch (mode) {
1271
+ case 'var':
1272
+ return this.s / (this.n - ddof);
1273
+ case 'stdev':
1274
+ return Math.sqrt(this.s / (this.n - ddof));
1275
+ default:
1276
+ throw new Error('unknown mode for runningStat');
1277
+ }
1278
+ },
1279
+
1280
+ format: formatter,
1281
+ numInputs: typeof attr !== 'undefined' ? 0 : 1
1282
+ };
1283
+ };
1284
+ };
1285
+ },
1286
+ sumOverSum: function sumOverSum() {
1287
+ var formatter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : usFmt;
1288
+
1289
+ return function (_ref11) {
1290
+ var _ref12 = _slicedToArray(_ref11, 2),
1291
+ num = _ref12[0],
1292
+ denom = _ref12[1];
1293
+
1294
+ return function () {
1295
+ return {
1296
+ sumNum: 0,
1297
+ sumDenom: 0,
1298
+ push: function push(record) {
1299
+ if (!isNaN(parseFloat(record[num]))) {
1300
+ this.sumNum += parseFloat(record[num]);
1301
+ }
1302
+ if (!isNaN(parseFloat(record[denom]))) {
1303
+ this.sumDenom += parseFloat(record[denom]);
1304
+ }
1305
+ },
1306
+ value: function value() {
1307
+ return this.sumNum / this.sumDenom;
1308
+ },
1309
+
1310
+ format: formatter,
1311
+ numInputs: typeof num !== 'undefined' && typeof denom !== 'undefined' ? 0 : 2
1312
+ };
1313
+ };
1314
+ };
1315
+ },
1316
+ fractionOf: function fractionOf(wrapped) {
1317
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'total';
1318
+ var formatter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : usFmtPct;
1319
+
1320
+ return function () {
1321
+ for (var _len = arguments.length, x = Array(_len), _key = 0; _key < _len; _key++) {
1322
+ x[_key] = arguments[_key];
1323
+ }
1324
+
1325
+ return function (data, rowKey, colKey) {
1326
+ return {
1327
+ selector: { total: [[], []], row: [rowKey, []], col: [[], colKey] }[type],
1328
+ inner: wrapped.apply(undefined, _toConsumableArray(Array.from(x || [])))(data, rowKey, colKey),
1329
+ push: function push(record) {
1330
+ this.inner.push(record);
1331
+ },
1332
+
1333
+ format: formatter,
1334
+ value: function value() {
1335
+ var aggregator = data.getAggregator.apply(data, _toConsumableArray(Array.from(this.selector || [])));
1336
+
1337
+ return this.inner.value() / (aggregator.inner && aggregator.inner.value() || 0);
1338
+ },
1339
+
1340
+ numInputs: wrapped.apply(undefined, _toConsumableArray(Array.from(x || [])))().numInputs
1341
+ };
1342
+ };
1343
+ };
1344
+ }
1345
+ };
1346
+
1347
+ aggregatorTemplates.countUnique = function (f) {
1348
+ return aggregatorTemplates.uniques(function (x) {
1349
+ return x.length;
1350
+ }, f);
1351
+ };
1352
+ aggregatorTemplates.listUnique = function (s) {
1353
+ return aggregatorTemplates.uniques(function (x) {
1354
+ return x.join(s);
1355
+ }, function (x) {
1356
+ return x;
1357
+ });
1358
+ };
1359
+ aggregatorTemplates.max = function (f) {
1360
+ return aggregatorTemplates.extremes('max', f);
1361
+ };
1362
+ aggregatorTemplates.min = function (f) {
1363
+ return aggregatorTemplates.extremes('min', f);
1364
+ };
1365
+ aggregatorTemplates.first = function (f) {
1366
+ return aggregatorTemplates.extremes('first', f);
1367
+ };
1368
+ aggregatorTemplates.last = function (f) {
1369
+ return aggregatorTemplates.extremes('last', f);
1370
+ };
1371
+ aggregatorTemplates.median = function (f) {
1372
+ return aggregatorTemplates.quantile(0.5, f);
1373
+ };
1374
+ aggregatorTemplates.average = function (f) {
1375
+ return aggregatorTemplates.runningStat('mean', 1, f);
1376
+ };
1377
+ aggregatorTemplates.var = function (ddof, f) {
1378
+ return aggregatorTemplates.runningStat('var', ddof, f);
1379
+ };
1380
+ aggregatorTemplates.stdev = function (ddof, f) {
1381
+ return aggregatorTemplates.runningStat('stdev', ddof, f);
1382
+ };
1383
+
1384
+ var AggregatorCell = function () {
1385
+ function AggregatorCell(instances, primaryKey) {
1386
+ _classCallCheck(this, AggregatorCell);
1387
+
1388
+ this.instances = instances;
1389
+ this.primaryKey = primaryKey;
1390
+ }
1391
+
1392
+ _createClass(AggregatorCell, [{
1393
+ key: 'push',
1394
+ value: function push(record) {
1395
+ var _this = this;
1396
+
1397
+ Object.keys(this.instances).forEach(function (key) {
1398
+ _this.instances[key].push(record);
1399
+ });
1400
+ }
1401
+ }, {
1402
+ key: 'getInstance',
1403
+ value: function getInstance(key) {
1404
+ var targetKey = key || this.primaryKey;
1405
+ if (targetKey && this.instances[targetKey]) {
1406
+ return this.instances[targetKey];
1407
+ }
1408
+ var first = this.instances[this.primaryKey] || this.instances[Object.keys(this.instances)[0]];
1409
+ return first || null;
1410
+ }
1411
+ }]);
1412
+
1413
+ return AggregatorCell;
1414
+ }();
1415
+
1416
+ // default aggregators & renderers use US naming and number formatting
1417
+
1418
+
1419
+ var aggregators = function (tpl) {
1420
+ return {
1421
+ Count: tpl.count(usFmtInt),
1422
+ 'Count Unique Values': tpl.countUnique(usFmtInt),
1423
+ 'List Unique Values': tpl.listUnique(', '),
1424
+ Sum: tpl.sum(usFmt),
1425
+ 'Integer Sum': tpl.sum(usFmtInt),
1426
+ Average: tpl.average(usFmt),
1427
+ Median: tpl.median(usFmt),
1428
+ 'Sample Variance': tpl.var(1, usFmt),
1429
+ 'Sample Standard Deviation': tpl.stdev(1, usFmt),
1430
+ Minimum: tpl.min(usFmt),
1431
+ Maximum: tpl.max(usFmt),
1432
+ First: tpl.first(usFmt),
1433
+ Last: tpl.last(usFmt),
1434
+ 'Sum over Sum': tpl.sumOverSum(usFmt),
1435
+ 'Sum as Fraction of Total': tpl.fractionOf(tpl.sum(), 'total', usFmtPct),
1436
+ 'Sum as Fraction of Rows': tpl.fractionOf(tpl.sum(), 'row', usFmtPct),
1437
+ 'Sum as Fraction of Columns': tpl.fractionOf(tpl.sum(), 'col', usFmtPct),
1438
+ 'Count as Fraction of Total': tpl.fractionOf(tpl.count(), 'total', usFmtPct),
1439
+ 'Count as Fraction of Rows': tpl.fractionOf(tpl.count(), 'row', usFmtPct),
1440
+ 'Count as Fraction of Columns': tpl.fractionOf(tpl.count(), 'col', usFmtPct)
1441
+ };
1442
+ }(aggregatorTemplates);
1443
+
1444
+ var locales = {
1445
+ en: {
1446
+ aggregators: aggregators,
1447
+ localeStrings: {
1448
+ renderError: 'An error occurred rendering the PivotTable results.',
1449
+ computeError: 'An error occurred computing the PivotTable results.',
1450
+ uiRenderError: 'An error occurred rendering the PivotTable UI.',
1451
+ selectAll: 'Select All',
1452
+ selectNone: 'Select None',
1453
+ tooMany: '(too many to list)',
1454
+ filterResults: 'Filter values',
1455
+ apply: 'Apply',
1456
+ cancel: 'Cancel',
1457
+ totals: 'Totals',
1458
+ vs: 'vs',
1459
+ by: 'by'
1460
+ }
1461
+ }
1462
+ };
1463
+
1464
+ // dateFormat deriver l10n requires month and day names to be passed in directly
1465
+ var mthNamesEn = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
1466
+ var dayNamesEn = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
1467
+ var zeroPad = function zeroPad(number) {
1468
+ return ('0' + number).substr(-2, 2);
1469
+ }; // eslint-disable-line no-magic-numbers
1470
+
1471
+ var derivers = {
1472
+ bin: function bin(col, binWidth) {
1473
+ return function (record) {
1474
+ return record[col] - record[col] % binWidth;
1475
+ };
1476
+ },
1477
+ dateFormat: function dateFormat(col, formatString) {
1478
+ var utcOutput = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1479
+ var mthNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : mthNamesEn;
1480
+ var dayNames = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : dayNamesEn;
1481
+
1482
+ var utc = utcOutput ? 'UTC' : '';
1483
+ return function (record) {
1484
+ var date = new Date(Date.parse(record[col]));
1485
+ if (isNaN(date)) {
1486
+ return '';
1487
+ }
1488
+ return formatString.replace(/%(.)/g, function (m, p) {
1489
+ switch (p) {
1490
+ case 'y':
1491
+ return date['get' + utc + 'FullYear']();
1492
+ case 'm':
1493
+ return zeroPad(date['get' + utc + 'Month']() + 1);
1494
+ case 'n':
1495
+ return mthNames[date['get' + utc + 'Month']()];
1496
+ case 'd':
1497
+ return zeroPad(date['get' + utc + 'Date']());
1498
+ case 'w':
1499
+ return dayNames[date['get' + utc + 'Day']()];
1500
+ case 'x':
1501
+ return date['get' + utc + 'Day']();
1502
+ case 'H':
1503
+ return zeroPad(date['get' + utc + 'Hours']());
1504
+ case 'M':
1505
+ return zeroPad(date['get' + utc + 'Minutes']());
1506
+ case 'S':
1507
+ return zeroPad(date['get' + utc + 'Seconds']());
1508
+ default:
1509
+ return '%' + p;
1510
+ }
1511
+ });
1512
+ };
1513
+ }
1514
+ };
1515
+
1516
+ /*
1517
+ Data Model class
1518
+ */
1519
+
1520
+ var PivotData = function () {
1521
+ function PivotData() {
1522
+ var _this2 = this;
1523
+
1524
+ var inputProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1525
+
1526
+ _classCallCheck(this, PivotData);
1527
+
1528
+ this.props = Object.assign({}, PivotData.defaultProps, inputProps);
1529
+ __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.checkPropTypes(PivotData.propTypes, this.props, 'prop', 'PivotData');
1530
+
1531
+ this.aggregations = this.normalizeAggregations();
1532
+ this.aggregationKeyLookup = {};
1533
+ this.aggregations.forEach(function (agg) {
1534
+ if (!(agg.aggregatorName in _this2.aggregationKeyLookup)) {
1535
+ _this2.aggregationKeyLookup[agg.aggregatorName] = agg.key;
1536
+ }
1537
+ });
1538
+ if (this.aggregations.length === 0) {
1539
+ throw new Error('PivotData requires at least one aggregation');
1540
+ }
1541
+ this.primaryAggregation = this.aggregations[0];
1542
+ this.primaryAggregatorName = this.primaryAggregation.aggregatorName;
1543
+
1544
+ this.aggregatorFactories = this.buildAggregatorFactories();
1545
+ this.tree = {};
1546
+ this.rowKeys = [];
1547
+ this.colKeys = [];
1548
+ this.rowTotals = {};
1549
+ this.colTotals = {};
1550
+ this.allTotal = this.createAggregatorCell([], []);
1551
+ this.sorted = false;
1552
+
1553
+ if (this.props.precomputedData) {
1554
+ // Results computed by the Web Worker (or any previous pass) are
1555
+ // hydrated instead of re-scanning every record on the main thread.
1556
+ this.hydrateFromPrecomputed(this.props.precomputedData);
1557
+ return;
1558
+ }
1559
+
1560
+ var progressHook = this.props.onRecordProcessed;
1561
+ var recordHandler = function recordHandler(record) {
1562
+ if (_this2.filter(record)) {
1563
+ _this2.processRecord(record);
1564
+ }
1565
+ };
1566
+ if (typeof progressHook === 'function') {
1567
+ var recordsProcessed = 0;
1568
+ PivotData.forEachRecord(this.props.data, this.props.derivedAttributes, function (record) {
1569
+ recordHandler(record);
1570
+ recordsProcessed++;
1571
+ if (recordsProcessed % RECORD_PROGRESS_BATCH_SIZE === 0) {
1572
+ progressHook(recordsProcessed);
1573
+ }
1574
+ });
1575
+ } else {
1576
+ PivotData.forEachRecord(this.props.data, this.props.derivedAttributes, recordHandler);
1577
+ }
1578
+ }
1579
+
1580
+ /*
1581
+ * Rebuilds tree/totals from a serialized PivotData payload (as produced by
1582
+ * `serializePivotData` inside the worker). Aggregated values are final, so
1583
+ * only lightweight stub aggregators with the correct `value()` and
1584
+ * `format()` behavior are created per cell.
1585
+ */
1586
+
1587
+
1588
+ _createClass(PivotData, [{
1589
+ key: 'hydrateFromPrecomputed',
1590
+ value: function hydrateFromPrecomputed(precomputed) {
1591
+ var _this3 = this;
1592
+
1593
+ // One real aggregator instance per aggregation provides `format()` and
1594
+ // `numInputs` for every hydrated stub cell.
1595
+ var formatSources = {};
1596
+ this.aggregations.forEach(function (agg) {
1597
+ formatSources[agg.key] = _this3.aggregatorFactories[agg.key](_this3, [], []);
1598
+ });
1599
+
1600
+ var makeCell = function makeCell(serializedCell) {
1601
+ var values = serializedCell && serializedCell.values || {};
1602
+ var instances = {};
1603
+ _this3.aggregations.forEach(function (agg) {
1604
+ var source = formatSources[agg.key];
1605
+ var _value = values[agg.key];
1606
+ instances[agg.key] = {
1607
+ push: function push() {},
1608
+ value: function value() {
1609
+ return _value;
1610
+ },
1611
+ format: function format(x) {
1612
+ return source.format(x);
1613
+ },
1614
+
1615
+ numInputs: source.numInputs,
1616
+ outlet: source.outlet
1617
+ };
1618
+ });
1619
+ return new AggregatorCell(instances, _this3.primaryAggregation.key);
1620
+ };
1621
+
1622
+ var hydrateTotals = function hydrateTotals(source, target) {
1623
+ Object.keys(source || {}).forEach(function (flatKey) {
1624
+ target[flatKey] = makeCell(source[flatKey]);
1625
+ });
1626
+ };
1627
+
1628
+ this.rowKeys = (precomputed.rowKeys || []).map(function (key) {
1629
+ return key.slice();
1630
+ });
1631
+ this.colKeys = (precomputed.colKeys || []).map(function (key) {
1632
+ return key.slice();
1633
+ });
1634
+ this.rowTotals = {};
1635
+ hydrateTotals(precomputed.rowTotals, this.rowTotals);
1636
+ this.colTotals = {};
1637
+ hydrateTotals(precomputed.colTotals, this.colTotals);
1638
+ this.tree = {};
1639
+ Object.keys(precomputed.tree || {}).forEach(function (flatRowKey) {
1640
+ _this3.tree[flatRowKey] = {};
1641
+ hydrateTotals(precomputed.tree[flatRowKey], _this3.tree[flatRowKey]);
1642
+ });
1643
+ this.allTotal = makeCell(precomputed.allTotal);
1644
+
1645
+ // Keys were already sorted inside the worker; only re-sort on the main
1646
+ // thread when a sorter could not cross the worker boundary (functions).
1647
+ this.sorted = !sortersHaveFunctions(this.props.sorters);
1648
+ }
1649
+ }, {
1650
+ key: 'filter',
1651
+ value: function filter(record) {
1652
+ for (var k in this.props.valueFilter) {
1653
+ if (record[k] in this.props.valueFilter[k]) {
1654
+ return false;
1655
+ }
1656
+ }
1657
+ return true;
1658
+ }
1659
+ }, {
1660
+ key: 'forEachMatchingRecord',
1661
+ value: function forEachMatchingRecord(criteria, callback) {
1662
+ var _this4 = this;
1663
+
1664
+ return PivotData.forEachRecord(this.props.data, this.props.derivedAttributes, function (record) {
1665
+ if (!_this4.filter(record)) {
1666
+ return;
1667
+ }
1668
+ for (var k in criteria) {
1669
+ var v = criteria[k];
1670
+ if (v !== (k in record ? record[k] : 'null')) {
1671
+ return;
1672
+ }
1673
+ }
1674
+ callback(record);
1675
+ });
1676
+ }
1677
+ }, {
1678
+ key: 'arrSort',
1679
+ value: function arrSort(attrs) {
1680
+ var _this5 = this;
1681
+
1682
+ var a = void 0;
1683
+ var sortersArr = function () {
1684
+ var result = [];
1685
+ var _iteratorNormalCompletion2 = true;
1686
+ var _didIteratorError2 = false;
1687
+ var _iteratorError2 = undefined;
1688
+
1689
+ try {
1690
+ for (var _iterator2 = Array.from(attrs)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1691
+ a = _step2.value;
1692
+
1693
+ result.push(getSort(_this5.props.sorters, a));
1694
+ }
1695
+ } catch (err) {
1696
+ _didIteratorError2 = true;
1697
+ _iteratorError2 = err;
1698
+ } finally {
1699
+ try {
1700
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
1701
+ _iterator2.return();
1702
+ }
1703
+ } finally {
1704
+ if (_didIteratorError2) {
1705
+ throw _iteratorError2;
1706
+ }
1707
+ }
1708
+ }
1709
+
1710
+ return result;
1711
+ }();
1712
+ return function (a, b) {
1713
+ var _iteratorNormalCompletion3 = true;
1714
+ var _didIteratorError3 = false;
1715
+ var _iteratorError3 = undefined;
1716
+
1717
+ try {
1718
+ for (var _iterator3 = Object.keys(sortersArr || {})[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1719
+ var i = _step3.value;
1720
+
1721
+ var sorter = sortersArr[i];
1722
+ var comparison = sorter(a[i], b[i]);
1723
+ if (comparison !== 0) {
1724
+ return comparison;
1725
+ }
1726
+ }
1727
+ } catch (err) {
1728
+ _didIteratorError3 = true;
1729
+ _iteratorError3 = err;
1730
+ } finally {
1731
+ try {
1732
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
1733
+ _iterator3.return();
1734
+ }
1735
+ } finally {
1736
+ if (_didIteratorError3) {
1737
+ throw _iteratorError3;
1738
+ }
1739
+ }
1740
+ }
1741
+
1742
+ return 0;
1743
+ };
1744
+ }
1745
+ }, {
1746
+ key: 'sortKeys',
1747
+ value: function sortKeys() {
1748
+ var _this6 = this;
1749
+
1750
+ if (!this.sorted) {
1751
+ this.sorted = true;
1752
+ var v = function v(r, c) {
1753
+ return _this6.getAggregator(r, c).value();
1754
+ };
1755
+
1756
+ // Handle per-row sorting
1757
+ if (this.props.rowSorts && Object.keys(this.props.rowSorts).length > 0) {
1758
+ var rowSorts = this.props.rowSorts;
1759
+ this.rowKeys.sort(function (a, b) {
1760
+ // First, check if any sorted attribute has a difference
1761
+ for (var i = 0; i < _this6.props.rows.length; i++) {
1762
+ var attr = _this6.props.rows[i];
1763
+ if (attr && rowSorts[attr]) {
1764
+ var sortDir = rowSorts[attr] === 'ASC' ? 1 : -1;
1765
+ var sorter = getSort(_this6.props.sorters, attr);
1766
+ var comparison = sorter(a[i] || '', b[i] || '');
1767
+ if (comparison !== 0) {
1768
+ return sortDir * comparison;
1769
+ }
1770
+ }
1771
+ }
1772
+ // If sorted attributes are equal, use default sorting for remaining attributes
1773
+ return _this6.arrSort(_this6.props.rows)(a, b);
1774
+ });
1775
+ } else {
1776
+ // Use global row order
1777
+ switch (this.props.rowOrder) {
1778
+ case 'value_a_to_z':
1779
+ this.rowKeys.sort(function (a, b) {
1780
+ return naturalSort(v(a, []), v(b, []));
1781
+ });
1782
+ break;
1783
+ case 'value_z_to_a':
1784
+ this.rowKeys.sort(function (a, b) {
1785
+ return -naturalSort(v(a, []), v(b, []));
1786
+ });
1787
+ break;
1788
+ default:
1789
+ this.rowKeys.sort(this.arrSort(this.props.rows));
1790
+ }
1791
+ }
1792
+
1793
+ // Handle per-column sorting
1794
+ if (this.props.colSorts && Object.keys(this.props.colSorts).length > 0) {
1795
+ var colSorts = this.props.colSorts;
1796
+ this.colKeys.sort(function (a, b) {
1797
+ // First, check if any sorted attribute has a difference
1798
+ for (var i = 0; i < _this6.props.cols.length; i++) {
1799
+ var attr = _this6.props.cols[i];
1800
+ if (attr && colSorts[attr]) {
1801
+ var sortDir = colSorts[attr] === 'ASC' ? 1 : -1;
1802
+ var sorter = getSort(_this6.props.sorters, attr);
1803
+ var comparison = sorter(a[i] || '', b[i] || '');
1804
+ if (comparison !== 0) {
1805
+ return sortDir * comparison;
1806
+ }
1807
+ }
1808
+ }
1809
+ // If sorted attributes are equal, use default sorting for remaining attributes
1810
+ return _this6.arrSort(_this6.props.cols)(a, b);
1811
+ });
1812
+ } else {
1813
+ // Use global col order
1814
+ switch (this.props.colOrder) {
1815
+ case 'value_a_to_z':
1816
+ this.colKeys.sort(function (a, b) {
1817
+ return naturalSort(v([], a), v([], b));
1818
+ });
1819
+ break;
1820
+ case 'value_z_to_a':
1821
+ this.colKeys.sort(function (a, b) {
1822
+ return -naturalSort(v([], a), v([], b));
1823
+ });
1824
+ break;
1825
+ default:
1826
+ this.colKeys.sort(this.arrSort(this.props.cols));
1827
+ }
1828
+ }
1829
+ }
1830
+ }
1831
+ }, {
1832
+ key: 'getColKeys',
1833
+ value: function getColKeys() {
1834
+ this.sortKeys();
1835
+ return this.colKeys;
1836
+ }
1837
+ }, {
1838
+ key: 'getRowKeys',
1839
+ value: function getRowKeys() {
1840
+ this.sortKeys();
1841
+ return this.rowKeys;
1842
+ }
1843
+ }, {
1844
+ key: 'processRecord',
1845
+ value: function processRecord(record) {
1846
+ // this code is called in a tight loop
1847
+ var colKey = [];
1848
+ var rowKey = [];
1849
+ var _iteratorNormalCompletion4 = true;
1850
+ var _didIteratorError4 = false;
1851
+ var _iteratorError4 = undefined;
1852
+
1853
+ try {
1854
+ for (var _iterator4 = Array.from(this.props.cols)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
1855
+ var x = _step4.value;
1856
+
1857
+ colKey.push(x in record ? record[x] : 'null');
1858
+ }
1859
+ } catch (err) {
1860
+ _didIteratorError4 = true;
1861
+ _iteratorError4 = err;
1862
+ } finally {
1863
+ try {
1864
+ if (!_iteratorNormalCompletion4 && _iterator4.return) {
1865
+ _iterator4.return();
1866
+ }
1867
+ } finally {
1868
+ if (_didIteratorError4) {
1869
+ throw _iteratorError4;
1870
+ }
1871
+ }
1872
+ }
1873
+
1874
+ var _iteratorNormalCompletion5 = true;
1875
+ var _didIteratorError5 = false;
1876
+ var _iteratorError5 = undefined;
1877
+
1878
+ try {
1879
+ for (var _iterator5 = Array.from(this.props.rows)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
1880
+ var _x17 = _step5.value;
1881
+
1882
+ rowKey.push(_x17 in record ? record[_x17] : 'null');
1883
+ }
1884
+ } catch (err) {
1885
+ _didIteratorError5 = true;
1886
+ _iteratorError5 = err;
1887
+ } finally {
1888
+ try {
1889
+ if (!_iteratorNormalCompletion5 && _iterator5.return) {
1890
+ _iterator5.return();
1891
+ }
1892
+ } finally {
1893
+ if (_didIteratorError5) {
1894
+ throw _iteratorError5;
1895
+ }
1896
+ }
1897
+ }
1898
+
1899
+ var flatRowKey = rowKey.join(String.fromCharCode(0));
1900
+ var flatColKey = colKey.join(String.fromCharCode(0));
1901
+
1902
+ this.allTotal.push(record);
1903
+
1904
+ if (rowKey.length !== 0) {
1905
+ if (!this.rowTotals[flatRowKey]) {
1906
+ this.rowKeys.push(rowKey);
1907
+ this.rowTotals[flatRowKey] = this.createAggregatorCell(rowKey, []);
1908
+ }
1909
+ this.rowTotals[flatRowKey].push(record);
1910
+ }
1911
+
1912
+ if (colKey.length !== 0) {
1913
+ if (!this.colTotals[flatColKey]) {
1914
+ this.colKeys.push(colKey);
1915
+ this.colTotals[flatColKey] = this.createAggregatorCell([], colKey);
1916
+ }
1917
+ this.colTotals[flatColKey].push(record);
1918
+ }
1919
+
1920
+ if (colKey.length !== 0 && rowKey.length !== 0) {
1921
+ if (!this.tree[flatRowKey]) {
1922
+ this.tree[flatRowKey] = {};
1923
+ }
1924
+ if (!this.tree[flatRowKey][flatColKey]) {
1925
+ this.tree[flatRowKey][flatColKey] = this.createAggregatorCell(rowKey, colKey);
1926
+ }
1927
+ this.tree[flatRowKey][flatColKey].push(record);
1928
+ }
1929
+ }
1930
+ }, {
1931
+ key: 'getAggregator',
1932
+ value: function getAggregator(rowKey, colKey) {
1933
+ var aggregationKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.primaryAggregation.key;
1934
+
1935
+ var resolvedKey = aggregationKey;
1936
+ if (resolvedKey && !(resolvedKey in this.aggregatorFactories) && this.aggregationKeyLookup[resolvedKey]) {
1937
+ resolvedKey = this.aggregationKeyLookup[resolvedKey];
1938
+ }
1939
+ var cell = this.getAggregatorCell(rowKey, colKey);
1940
+ if (!cell) {
1941
+ return PivotData.emptyAggregator;
1942
+ }
1943
+ return cell.getInstance(resolvedKey) || PivotData.emptyAggregator;
1944
+ }
1945
+ }, {
1946
+ key: 'getAggregatorCell',
1947
+ value: function getAggregatorCell(rowKey, colKey) {
1948
+ var cell = void 0;
1949
+ var flatRowKey = rowKey.join(String.fromCharCode(0));
1950
+ var flatColKey = colKey.join(String.fromCharCode(0));
1951
+ if (rowKey.length === 0 && colKey.length === 0) {
1952
+ cell = this.allTotal;
1953
+ } else if (rowKey.length === 0) {
1954
+ cell = this.colTotals[flatColKey];
1955
+ } else if (colKey.length === 0) {
1956
+ cell = this.rowTotals[flatRowKey];
1957
+ } else {
1958
+ cell = this.tree[flatRowKey] && this.tree[flatRowKey][flatColKey] ? this.tree[flatRowKey][flatColKey] : null;
1959
+ }
1960
+ return cell || null;
1961
+ }
1962
+ }, {
1963
+ key: 'getAggregatorNames',
1964
+ value: function getAggregatorNames() {
1965
+ return this.aggregations.map(function (agg) {
1966
+ return agg.aggregatorName;
1967
+ });
1968
+ }
1969
+ }, {
1970
+ key: 'getAggregations',
1971
+ value: function getAggregations() {
1972
+ return this.aggregations.map(function (agg) {
1973
+ return Object.assign({}, agg);
1974
+ });
1975
+ }
1976
+ }, {
1977
+ key: 'getPrimaryAggregatorName',
1978
+ value: function getPrimaryAggregatorName() {
1979
+ return this.primaryAggregatorName;
1980
+ }
1981
+ }, {
1982
+ key: 'getPrimaryAggregation',
1983
+ value: function getPrimaryAggregation() {
1984
+ return Object.assign({}, this.primaryAggregation);
1985
+ }
1986
+
1987
+ /**
1988
+ * Groups aggregations by their aggregatorName
1989
+ * @returns {Object} Object mapping aggregator names to arrays of aggregations
1990
+ * Example: { 'Count': [agg1, agg2], 'Sum': [agg3] }
1991
+ */
1992
+
1993
+ }, {
1994
+ key: 'groupAggregationsByType',
1995
+ value: function groupAggregationsByType() {
1996
+ var grouped = {};
1997
+ this.aggregations.forEach(function (agg) {
1998
+ var aggName = agg.aggregatorName;
1999
+ if (!grouped[aggName]) {
2000
+ grouped[aggName] = [];
2001
+ }
2002
+ grouped[aggName].push(agg);
2003
+ });
2004
+ return grouped;
2005
+ }
2006
+
2007
+ /**
2008
+ * Gets aggregations for a specific aggregator type
2009
+ * @param {string} aggregatorName - The aggregator name (e.g., 'Count', 'Sum')
2010
+ * @returns {Array} Array of aggregation configurations
2011
+ */
2012
+
2013
+ }, {
2014
+ key: 'getAggregationsByType',
2015
+ value: function getAggregationsByType(aggregatorName) {
2016
+ return this.aggregations.filter(function (agg) {
2017
+ return agg.aggregatorName === aggregatorName;
2018
+ });
2019
+ }
2020
+ }, {
2021
+ key: 'normalizeAggregations',
2022
+ value: function normalizeAggregations() {
2023
+ var defaultAggregatorName = Object.keys(this.props.aggregators)[0];
2024
+ var aggregationsProvided = Array.isArray(this.props.aggregations) && this.props.aggregations.length > 0;
2025
+ var legacyAggregatorName = typeof this.props.aggregatorName === 'string' ? this.props.aggregatorName : null;
2026
+ var fallbackAggregatorName = legacyAggregatorName || defaultAggregatorName;
2027
+ var fallbackVals = Array.isArray(this.props.vals) ? this.props.vals : [];
2028
+ var aggregations = [];
2029
+ if (aggregationsProvided) {
2030
+ aggregations = this.props.aggregations;
2031
+ } else {
2032
+ aggregations = [{
2033
+ aggregatorName: fallbackAggregatorName,
2034
+ vals: fallbackVals
2035
+ }];
2036
+ }
2037
+ return aggregations.map(function (agg, idx) {
2038
+ var aggregatorName = agg.aggregatorName || (aggregationsProvided ? defaultAggregatorName : fallbackAggregatorName);
2039
+ var vals = typeof agg.vals !== 'undefined' ? agg.vals : aggregationsProvided ? [] : fallbackVals.slice();
2040
+ var normalizedVals = Array.isArray(vals) ? vals : [];
2041
+ var key = agg.key || (aggregatorName || 'agg') + '-' + (normalizedVals.length ? normalizedVals.join('|') : '') + '-' + idx;
2042
+ var label = agg.label || (normalizedVals.length ? aggregatorName + ' of ' + normalizedVals.join(', ') : aggregatorName);
2043
+ return {
2044
+ key: key,
2045
+ aggregatorName: aggregatorName,
2046
+ vals: normalizedVals,
2047
+ label: label
2048
+ };
2049
+ });
2050
+ }
2051
+ }, {
2052
+ key: 'buildAggregatorFactories',
2053
+ value: function buildAggregatorFactories() {
2054
+ var _this7 = this;
2055
+
2056
+ var factories = {};
2057
+ this.aggregations.forEach(function (agg) {
2058
+ if (!(agg.aggregatorName in _this7.props.aggregators)) {
2059
+ throw new Error('unknown aggregator ' + agg.aggregatorName);
2060
+ }
2061
+ factories[agg.key] = _this7.props.aggregators[agg.aggregatorName](agg.vals);
2062
+ });
2063
+ return factories;
2064
+ }
2065
+ }, {
2066
+ key: 'createAggregatorCell',
2067
+ value: function createAggregatorCell(rowKey, colKey) {
2068
+ var _this8 = this;
2069
+
2070
+ var instances = {};
2071
+ this.aggregations.forEach(function (agg) {
2072
+ instances[agg.key] = _this8.aggregatorFactories[agg.key](_this8, rowKey, colKey);
2073
+ });
2074
+ return new AggregatorCell(instances, this.primaryAggregation.key);
2075
+ }
2076
+ }]);
2077
+
2078
+ return PivotData;
2079
+ }();
2080
+
2081
+ PivotData.emptyAggregator = {
2082
+ push: function push() {},
2083
+ value: function value() {
2084
+ return null;
2085
+ },
2086
+ format: function format() {
2087
+ return '';
2088
+ }
2089
+ };
2090
+
2091
+ // can handle arrays or jQuery selections of tables
2092
+ PivotData.forEachRecord = function (input, derivedAttributes, f) {
2093
+ var addRecord = void 0,
2094
+ record = void 0;
2095
+ if (Object.getOwnPropertyNames(derivedAttributes).length === 0) {
2096
+ addRecord = f;
2097
+ } else {
2098
+ addRecord = function addRecord(record) {
2099
+ for (var k in derivedAttributes) {
2100
+ var derived = derivedAttributes[k](record);
2101
+ if (derived !== null) {
2102
+ record[k] = derived;
2103
+ }
2104
+ }
2105
+ return f(record);
2106
+ };
2107
+ }
2108
+
2109
+ // if it's a function, have it call us back
2110
+ if (typeof input === 'function') {
2111
+ return input(addRecord);
2112
+ } else if (Array.isArray(input)) {
2113
+ if (Array.isArray(input[0])) {
2114
+ // array of arrays
2115
+ return function () {
2116
+ var result = [];
2117
+ var _iteratorNormalCompletion6 = true;
2118
+ var _didIteratorError6 = false;
2119
+ var _iteratorError6 = undefined;
2120
+
2121
+ try {
2122
+ for (var _iterator6 = Object.keys(input || {})[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
2123
+ var i = _step6.value;
2124
+
2125
+ var compactRecord = input[i];
2126
+ if (i > 0) {
2127
+ record = {};
2128
+ var _iteratorNormalCompletion7 = true;
2129
+ var _didIteratorError7 = false;
2130
+ var _iteratorError7 = undefined;
2131
+
2132
+ try {
2133
+ for (var _iterator7 = Object.keys(input[0] || {})[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
2134
+ var j = _step7.value;
2135
+
2136
+ var k = input[0][j];
2137
+ record[k] = compactRecord[j];
2138
+ }
2139
+ } catch (err) {
2140
+ _didIteratorError7 = true;
2141
+ _iteratorError7 = err;
2142
+ } finally {
2143
+ try {
2144
+ if (!_iteratorNormalCompletion7 && _iterator7.return) {
2145
+ _iterator7.return();
2146
+ }
2147
+ } finally {
2148
+ if (_didIteratorError7) {
2149
+ throw _iteratorError7;
2150
+ }
2151
+ }
2152
+ }
2153
+
2154
+ result.push(addRecord(record));
2155
+ }
2156
+ }
2157
+ } catch (err) {
2158
+ _didIteratorError6 = true;
2159
+ _iteratorError6 = err;
2160
+ } finally {
2161
+ try {
2162
+ if (!_iteratorNormalCompletion6 && _iterator6.return) {
2163
+ _iterator6.return();
2164
+ }
2165
+ } finally {
2166
+ if (_didIteratorError6) {
2167
+ throw _iteratorError6;
2168
+ }
2169
+ }
2170
+ }
2171
+
2172
+ return result;
2173
+ }();
2174
+ }
2175
+
2176
+ // array of objects
2177
+ return function () {
2178
+ var result1 = [];
2179
+ var _iteratorNormalCompletion8 = true;
2180
+ var _didIteratorError8 = false;
2181
+ var _iteratorError8 = undefined;
2182
+
2183
+ try {
2184
+ for (var _iterator8 = Array.from(input)[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
2185
+ record = _step8.value;
2186
+
2187
+ result1.push(addRecord(record));
2188
+ }
2189
+ } catch (err) {
2190
+ _didIteratorError8 = true;
2191
+ _iteratorError8 = err;
2192
+ } finally {
2193
+ try {
2194
+ if (!_iteratorNormalCompletion8 && _iterator8.return) {
2195
+ _iterator8.return();
2196
+ }
2197
+ } finally {
2198
+ if (_didIteratorError8) {
2199
+ throw _iteratorError8;
2200
+ }
2201
+ }
2202
+ }
2203
+
2204
+ return result1;
2205
+ }();
2206
+ }
2207
+ throw new Error('unknown input format');
2208
+ };
2209
+
2210
+ PivotData.defaultProps = {
2211
+ aggregators: aggregators,
2212
+ cols: [],
2213
+ rows: [],
2214
+ vals: [],
2215
+ aggregatorName: Object.keys(aggregators)[0],
2216
+ aggregations: [],
2217
+ sorters: {},
2218
+ valueFilter: {},
2219
+ rowOrder: 'key_a_to_z',
2220
+ colOrder: 'key_a_to_z',
2221
+ rowSorts: {},
2222
+ colSorts: {},
2223
+ derivedAttributes: {}
2224
+ };
2225
+
2226
+ PivotData.propTypes = {
2227
+ data: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.array, __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.object, __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func]).isRequired,
2228
+ aggregatorName: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string,
2229
+ aggregations: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.shape({
2230
+ key: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string,
2231
+ aggregatorName: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string,
2232
+ vals: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string),
2233
+ label: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string
2234
+ })),
2235
+ cols: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string),
2236
+ rows: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string),
2237
+ vals: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.arrayOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string),
2238
+ valueFilter: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.bool)),
2239
+ sorters: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func, __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func, __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.array]))]),
2240
+ derivedAttributes: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func),
2241
+ precomputedData: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.object,
2242
+ onRecordProcessed: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func,
2243
+ rowOrder: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOf(['key_a_to_z', 'value_a_to_z', 'value_z_to_a']),
2244
+ colOrder: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOf(['key_a_to_z', 'value_a_to_z', 'value_z_to_a']),
2245
+ rowSorts: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOf(['ASC', 'DESC'])),
2246
+ colSorts: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.objectOf(__WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.oneOf(['ASC', 'DESC']))
2247
+ };
2248
+
2249
+
2250
+
2251
+ /***/ }),
2252
+ /* 7 */
2253
+ /***/ (function(module, exports, __webpack_require__) {
2254
+
2255
+ /* WEBPACK VAR INJECTION */(function(process) {/**
2256
+ * Copyright (c) 2013-present, Facebook, Inc.
2257
+ *
2258
+ * This source code is licensed under the MIT license found in the
2259
+ * LICENSE file in the root directory of this source tree.
2260
+ */
2261
+
2262
+ if (process.env.NODE_ENV !== 'production') {
2263
+ var ReactIs = __webpack_require__(2);
2264
+
2265
+ // By explicitly using `prop-types` you are opting into new development behavior.
2266
+ // http://fb.me/prop-types-in-prod
2267
+ var throwOnDirectAccess = true;
2268
+ module.exports = __webpack_require__(10)(ReactIs.isElement, throwOnDirectAccess);
2269
+ } else {
2270
+ // By explicitly using `prop-types` you are opting into new production behavior.
2271
+ // http://fb.me/prop-types-in-prod
2272
+ module.exports = __webpack_require__(13)();
2273
+ }
2274
+
2275
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
2276
+
2277
+ /***/ }),
2278
+ /* 8 */
2279
+ /***/ (function(module, exports, __webpack_require__) {
2280
+
2281
+ "use strict";
2282
+ /** @license React v16.13.1
2283
+ * react-is.production.min.js
2284
+ *
2285
+ * Copyright (c) Facebook, Inc. and its affiliates.
2286
+ *
2287
+ * This source code is licensed under the MIT license found in the
2288
+ * LICENSE file in the root directory of this source tree.
2289
+ */
2290
+
2291
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
2292
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
2293
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
2294
+ exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
2295
+ exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
2296
+ exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
2297
+
2298
+
2299
+ /***/ }),
2300
+ /* 9 */
2301
+ /***/ (function(module, exports, __webpack_require__) {
2302
+
2303
+ "use strict";
2304
+ /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.13.1
2305
+ * react-is.development.js
2306
+ *
2307
+ * Copyright (c) Facebook, Inc. and its affiliates.
2308
+ *
2309
+ * This source code is licensed under the MIT license found in the
2310
+ * LICENSE file in the root directory of this source tree.
2311
+ */
2312
+
2313
+
2314
+
2315
+
2316
+
2317
+ if (process.env.NODE_ENV !== "production") {
2318
+ (function() {
2319
+ 'use strict';
2320
+
2321
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2322
+ // nor polyfill, then a plain number is used for performance.
2323
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2324
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2325
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2326
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2327
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2328
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2329
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2330
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2331
+ // (unstable) APIs that have been removed. Can we remove the symbols?
2332
+
2333
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
2334
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2335
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2336
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2337
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2338
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2339
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2340
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
2341
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
2342
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
2343
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
2344
+
2345
+ function isValidElementType(type) {
2346
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2347
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2348
+ }
2349
+
2350
+ function typeOf(object) {
2351
+ if (typeof object === 'object' && object !== null) {
2352
+ var $$typeof = object.$$typeof;
2353
+
2354
+ switch ($$typeof) {
2355
+ case REACT_ELEMENT_TYPE:
2356
+ var type = object.type;
2357
+
2358
+ switch (type) {
2359
+ case REACT_ASYNC_MODE_TYPE:
2360
+ case REACT_CONCURRENT_MODE_TYPE:
2361
+ case REACT_FRAGMENT_TYPE:
2362
+ case REACT_PROFILER_TYPE:
2363
+ case REACT_STRICT_MODE_TYPE:
2364
+ case REACT_SUSPENSE_TYPE:
2365
+ return type;
2366
+
2367
+ default:
2368
+ var $$typeofType = type && type.$$typeof;
2369
+
2370
+ switch ($$typeofType) {
2371
+ case REACT_CONTEXT_TYPE:
2372
+ case REACT_FORWARD_REF_TYPE:
2373
+ case REACT_LAZY_TYPE:
2374
+ case REACT_MEMO_TYPE:
2375
+ case REACT_PROVIDER_TYPE:
2376
+ return $$typeofType;
2377
+
2378
+ default:
2379
+ return $$typeof;
2380
+ }
2381
+
2382
+ }
2383
+
2384
+ case REACT_PORTAL_TYPE:
2385
+ return $$typeof;
2386
+ }
2387
+ }
2388
+
2389
+ return undefined;
2390
+ } // AsyncMode is deprecated along with isAsyncMode
2391
+
2392
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
2393
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2394
+ var ContextConsumer = REACT_CONTEXT_TYPE;
2395
+ var ContextProvider = REACT_PROVIDER_TYPE;
2396
+ var Element = REACT_ELEMENT_TYPE;
2397
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
2398
+ var Fragment = REACT_FRAGMENT_TYPE;
2399
+ var Lazy = REACT_LAZY_TYPE;
2400
+ var Memo = REACT_MEMO_TYPE;
2401
+ var Portal = REACT_PORTAL_TYPE;
2402
+ var Profiler = REACT_PROFILER_TYPE;
2403
+ var StrictMode = REACT_STRICT_MODE_TYPE;
2404
+ var Suspense = REACT_SUSPENSE_TYPE;
2405
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
2406
+
2407
+ function isAsyncMode(object) {
2408
+ {
2409
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2410
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
2411
+
2412
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
2413
+ }
2414
+ }
2415
+
2416
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
2417
+ }
2418
+ function isConcurrentMode(object) {
2419
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2420
+ }
2421
+ function isContextConsumer(object) {
2422
+ return typeOf(object) === REACT_CONTEXT_TYPE;
2423
+ }
2424
+ function isContextProvider(object) {
2425
+ return typeOf(object) === REACT_PROVIDER_TYPE;
2426
+ }
2427
+ function isElement(object) {
2428
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2429
+ }
2430
+ function isForwardRef(object) {
2431
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
2432
+ }
2433
+ function isFragment(object) {
2434
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
2435
+ }
2436
+ function isLazy(object) {
2437
+ return typeOf(object) === REACT_LAZY_TYPE;
2438
+ }
2439
+ function isMemo(object) {
2440
+ return typeOf(object) === REACT_MEMO_TYPE;
2441
+ }
2442
+ function isPortal(object) {
2443
+ return typeOf(object) === REACT_PORTAL_TYPE;
2444
+ }
2445
+ function isProfiler(object) {
2446
+ return typeOf(object) === REACT_PROFILER_TYPE;
2447
+ }
2448
+ function isStrictMode(object) {
2449
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
2450
+ }
2451
+ function isSuspense(object) {
2452
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
2453
+ }
2454
+
2455
+ exports.AsyncMode = AsyncMode;
2456
+ exports.ConcurrentMode = ConcurrentMode;
2457
+ exports.ContextConsumer = ContextConsumer;
2458
+ exports.ContextProvider = ContextProvider;
2459
+ exports.Element = Element;
2460
+ exports.ForwardRef = ForwardRef;
2461
+ exports.Fragment = Fragment;
2462
+ exports.Lazy = Lazy;
2463
+ exports.Memo = Memo;
2464
+ exports.Portal = Portal;
2465
+ exports.Profiler = Profiler;
2466
+ exports.StrictMode = StrictMode;
2467
+ exports.Suspense = Suspense;
2468
+ exports.isAsyncMode = isAsyncMode;
2469
+ exports.isConcurrentMode = isConcurrentMode;
2470
+ exports.isContextConsumer = isContextConsumer;
2471
+ exports.isContextProvider = isContextProvider;
2472
+ exports.isElement = isElement;
2473
+ exports.isForwardRef = isForwardRef;
2474
+ exports.isFragment = isFragment;
2475
+ exports.isLazy = isLazy;
2476
+ exports.isMemo = isMemo;
2477
+ exports.isPortal = isPortal;
2478
+ exports.isProfiler = isProfiler;
2479
+ exports.isStrictMode = isStrictMode;
2480
+ exports.isSuspense = isSuspense;
2481
+ exports.isValidElementType = isValidElementType;
2482
+ exports.typeOf = typeOf;
2483
+ })();
2484
+ }
2485
+
2486
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
2487
+
2488
+ /***/ }),
2489
+ /* 10 */
2490
+ /***/ (function(module, exports, __webpack_require__) {
2491
+
2492
+ "use strict";
2493
+ /* WEBPACK VAR INJECTION */(function(process) {/**
2494
+ * Copyright (c) 2013-present, Facebook, Inc.
2495
+ *
2496
+ * This source code is licensed under the MIT license found in the
2497
+ * LICENSE file in the root directory of this source tree.
2498
+ */
2499
+
2500
+
2501
+
2502
+ var ReactIs = __webpack_require__(2);
2503
+ var assign = __webpack_require__(11);
2504
+
2505
+ var ReactPropTypesSecret = __webpack_require__(1);
2506
+ var has = __webpack_require__(3);
2507
+ var checkPropTypes = __webpack_require__(12);
2508
+
2509
+ var printWarning = function() {};
2510
+
2511
+ if (process.env.NODE_ENV !== 'production') {
2512
+ printWarning = function(text) {
2513
+ var message = 'Warning: ' + text;
2514
+ if (typeof console !== 'undefined') {
2515
+ console.error(message);
2516
+ }
2517
+ try {
2518
+ // --- Welcome to debugging React ---
2519
+ // This error was thrown as a convenience so that you can use this stack
2520
+ // to find the callsite that caused this warning to fire.
2521
+ throw new Error(message);
2522
+ } catch (x) {}
2523
+ };
2524
+ }
2525
+
2526
+ function emptyFunctionThatReturnsNull() {
2527
+ return null;
2528
+ }
2529
+
2530
+ module.exports = function(isValidElement, throwOnDirectAccess) {
2531
+ /* global Symbol */
2532
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2533
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
2534
+
2535
+ /**
2536
+ * Returns the iterator method function contained on the iterable object.
2537
+ *
2538
+ * Be sure to invoke the function with the iterable as context:
2539
+ *
2540
+ * var iteratorFn = getIteratorFn(myIterable);
2541
+ * if (iteratorFn) {
2542
+ * var iterator = iteratorFn.call(myIterable);
2543
+ * ...
2544
+ * }
2545
+ *
2546
+ * @param {?object} maybeIterable
2547
+ * @return {?function}
2548
+ */
2549
+ function getIteratorFn(maybeIterable) {
2550
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2551
+ if (typeof iteratorFn === 'function') {
2552
+ return iteratorFn;
2553
+ }
2554
+ }
2555
+
2556
+ /**
2557
+ * Collection of methods that allow declaration and validation of props that are
2558
+ * supplied to React components. Example usage:
2559
+ *
2560
+ * var Props = require('ReactPropTypes');
2561
+ * var MyArticle = React.createClass({
2562
+ * propTypes: {
2563
+ * // An optional string prop named "description".
2564
+ * description: Props.string,
2565
+ *
2566
+ * // A required enum prop named "category".
2567
+ * category: Props.oneOf(['News','Photos']).isRequired,
2568
+ *
2569
+ * // A prop named "dialog" that requires an instance of Dialog.
2570
+ * dialog: Props.instanceOf(Dialog).isRequired
2571
+ * },
2572
+ * render: function() { ... }
2573
+ * });
2574
+ *
2575
+ * A more formal specification of how these methods are used:
2576
+ *
2577
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2578
+ * decl := ReactPropTypes.{type}(.isRequired)?
2579
+ *
2580
+ * Each and every declaration produces a function with the same signature. This
2581
+ * allows the creation of custom validation functions. For example:
2582
+ *
2583
+ * var MyLink = React.createClass({
2584
+ * propTypes: {
2585
+ * // An optional string or URI prop named "href".
2586
+ * href: function(props, propName, componentName) {
2587
+ * var propValue = props[propName];
2588
+ * if (propValue != null && typeof propValue !== 'string' &&
2589
+ * !(propValue instanceof URI)) {
2590
+ * return new Error(
2591
+ * 'Expected a string or an URI for ' + propName + ' in ' +
2592
+ * componentName
2593
+ * );
2594
+ * }
2595
+ * }
2596
+ * },
2597
+ * render: function() {...}
2598
+ * });
2599
+ *
2600
+ * @internal
2601
+ */
2602
+
2603
+ var ANONYMOUS = '<<anonymous>>';
2604
+
2605
+ // Important!
2606
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2607
+ var ReactPropTypes = {
2608
+ array: createPrimitiveTypeChecker('array'),
2609
+ bigint: createPrimitiveTypeChecker('bigint'),
2610
+ bool: createPrimitiveTypeChecker('boolean'),
2611
+ func: createPrimitiveTypeChecker('function'),
2612
+ number: createPrimitiveTypeChecker('number'),
2613
+ object: createPrimitiveTypeChecker('object'),
2614
+ string: createPrimitiveTypeChecker('string'),
2615
+ symbol: createPrimitiveTypeChecker('symbol'),
2616
+
2617
+ any: createAnyTypeChecker(),
2618
+ arrayOf: createArrayOfTypeChecker,
2619
+ element: createElementTypeChecker(),
2620
+ elementType: createElementTypeTypeChecker(),
2621
+ instanceOf: createInstanceTypeChecker,
2622
+ node: createNodeChecker(),
2623
+ objectOf: createObjectOfTypeChecker,
2624
+ oneOf: createEnumTypeChecker,
2625
+ oneOfType: createUnionTypeChecker,
2626
+ shape: createShapeTypeChecker,
2627
+ exact: createStrictShapeTypeChecker,
2628
+ };
2629
+
2630
+ /**
2631
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
2632
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2633
+ */
2634
+ /*eslint-disable no-self-compare*/
2635
+ function is(x, y) {
2636
+ // SameValue algorithm
2637
+ if (x === y) {
2638
+ // Steps 1-5, 7-10
2639
+ // Steps 6.b-6.e: +0 != -0
2640
+ return x !== 0 || 1 / x === 1 / y;
2641
+ } else {
2642
+ // Step 6.a: NaN == NaN
2643
+ return x !== x && y !== y;
2644
+ }
2645
+ }
2646
+ /*eslint-enable no-self-compare*/
2647
+
2648
+ /**
2649
+ * We use an Error-like object for backward compatibility as people may call
2650
+ * PropTypes directly and inspect their output. However, we don't use real
2651
+ * Errors anymore. We don't inspect their stack anyway, and creating them
2652
+ * is prohibitively expensive if they are created too often, such as what
2653
+ * happens in oneOfType() for any type before the one that matched.
2654
+ */
2655
+ function PropTypeError(message, data) {
2656
+ this.message = message;
2657
+ this.data = data && typeof data === 'object' ? data: {};
2658
+ this.stack = '';
2659
+ }
2660
+ // Make `instanceof Error` still work for returned errors.
2661
+ PropTypeError.prototype = Error.prototype;
2662
+
2663
+ function createChainableTypeChecker(validate) {
2664
+ if (process.env.NODE_ENV !== 'production') {
2665
+ var manualPropTypeCallCache = {};
2666
+ var manualPropTypeWarningCount = 0;
2667
+ }
2668
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2669
+ componentName = componentName || ANONYMOUS;
2670
+ propFullName = propFullName || propName;
2671
+
2672
+ if (secret !== ReactPropTypesSecret) {
2673
+ if (throwOnDirectAccess) {
2674
+ // New behavior only for users of `prop-types` package
2675
+ var err = new Error(
2676
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2677
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
2678
+ 'Read more at http://fb.me/use-check-prop-types'
2679
+ );
2680
+ err.name = 'Invariant Violation';
2681
+ throw err;
2682
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
2683
+ // Old behavior for people using React.PropTypes
2684
+ var cacheKey = componentName + ':' + propName;
2685
+ if (
2686
+ !manualPropTypeCallCache[cacheKey] &&
2687
+ // Avoid spamming the console because they are often not actionable except for lib authors
2688
+ manualPropTypeWarningCount < 3
2689
+ ) {
2690
+ printWarning(
2691
+ 'You are manually calling a React.PropTypes validation ' +
2692
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2693
+ 'and will throw in the standalone `prop-types` package. ' +
2694
+ 'You may be seeing this warning due to a third-party PropTypes ' +
2695
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
2696
+ );
2697
+ manualPropTypeCallCache[cacheKey] = true;
2698
+ manualPropTypeWarningCount++;
2699
+ }
2700
+ }
2701
+ }
2702
+ if (props[propName] == null) {
2703
+ if (isRequired) {
2704
+ if (props[propName] === null) {
2705
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2706
+ }
2707
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2708
+ }
2709
+ return null;
2710
+ } else {
2711
+ return validate(props, propName, componentName, location, propFullName);
2712
+ }
2713
+ }
2714
+
2715
+ var chainedCheckType = checkType.bind(null, false);
2716
+ chainedCheckType.isRequired = checkType.bind(null, true);
2717
+
2718
+ return chainedCheckType;
2719
+ }
2720
+
2721
+ function createPrimitiveTypeChecker(expectedType) {
2722
+ function validate(props, propName, componentName, location, propFullName, secret) {
2723
+ var propValue = props[propName];
2724
+ var propType = getPropType(propValue);
2725
+ if (propType !== expectedType) {
2726
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
2727
+ // check, but we can offer a more precise error message here rather than
2728
+ // 'of type `object`'.
2729
+ var preciseType = getPreciseType(propValue);
2730
+
2731
+ return new PropTypeError(
2732
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
2733
+ {expectedType: expectedType}
2734
+ );
2735
+ }
2736
+ return null;
2737
+ }
2738
+ return createChainableTypeChecker(validate);
2739
+ }
2740
+
2741
+ function createAnyTypeChecker() {
2742
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
2743
+ }
2744
+
2745
+ function createArrayOfTypeChecker(typeChecker) {
2746
+ function validate(props, propName, componentName, location, propFullName) {
2747
+ if (typeof typeChecker !== 'function') {
2748
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2749
+ }
2750
+ var propValue = props[propName];
2751
+ if (!Array.isArray(propValue)) {
2752
+ var propType = getPropType(propValue);
2753
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2754
+ }
2755
+ for (var i = 0; i < propValue.length; i++) {
2756
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
2757
+ if (error instanceof Error) {
2758
+ return error;
2759
+ }
2760
+ }
2761
+ return null;
2762
+ }
2763
+ return createChainableTypeChecker(validate);
2764
+ }
2765
+
2766
+ function createElementTypeChecker() {
2767
+ function validate(props, propName, componentName, location, propFullName) {
2768
+ var propValue = props[propName];
2769
+ if (!isValidElement(propValue)) {
2770
+ var propType = getPropType(propValue);
2771
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2772
+ }
2773
+ return null;
2774
+ }
2775
+ return createChainableTypeChecker(validate);
2776
+ }
2777
+
2778
+ function createElementTypeTypeChecker() {
2779
+ function validate(props, propName, componentName, location, propFullName) {
2780
+ var propValue = props[propName];
2781
+ if (!ReactIs.isValidElementType(propValue)) {
2782
+ var propType = getPropType(propValue);
2783
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
2784
+ }
2785
+ return null;
2786
+ }
2787
+ return createChainableTypeChecker(validate);
2788
+ }
2789
+
2790
+ function createInstanceTypeChecker(expectedClass) {
2791
+ function validate(props, propName, componentName, location, propFullName) {
2792
+ if (!(props[propName] instanceof expectedClass)) {
2793
+ var expectedClassName = expectedClass.name || ANONYMOUS;
2794
+ var actualClassName = getClassName(props[propName]);
2795
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2796
+ }
2797
+ return null;
2798
+ }
2799
+ return createChainableTypeChecker(validate);
2800
+ }
2801
+
2802
+ function createEnumTypeChecker(expectedValues) {
2803
+ if (!Array.isArray(expectedValues)) {
2804
+ if (process.env.NODE_ENV !== 'production') {
2805
+ if (arguments.length > 1) {
2806
+ printWarning(
2807
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
2808
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
2809
+ );
2810
+ } else {
2811
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
2812
+ }
2813
+ }
2814
+ return emptyFunctionThatReturnsNull;
2815
+ }
2816
+
2817
+ function validate(props, propName, componentName, location, propFullName) {
2818
+ var propValue = props[propName];
2819
+ for (var i = 0; i < expectedValues.length; i++) {
2820
+ if (is(propValue, expectedValues[i])) {
2821
+ return null;
2822
+ }
2823
+ }
2824
+
2825
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
2826
+ var type = getPreciseType(value);
2827
+ if (type === 'symbol') {
2828
+ return String(value);
2829
+ }
2830
+ return value;
2831
+ });
2832
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2833
+ }
2834
+ return createChainableTypeChecker(validate);
2835
+ }
2836
+
2837
+ function createObjectOfTypeChecker(typeChecker) {
2838
+ function validate(props, propName, componentName, location, propFullName) {
2839
+ if (typeof typeChecker !== 'function') {
2840
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2841
+ }
2842
+ var propValue = props[propName];
2843
+ var propType = getPropType(propValue);
2844
+ if (propType !== 'object') {
2845
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2846
+ }
2847
+ for (var key in propValue) {
2848
+ if (has(propValue, key)) {
2849
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2850
+ if (error instanceof Error) {
2851
+ return error;
2852
+ }
2853
+ }
2854
+ }
2855
+ return null;
2856
+ }
2857
+ return createChainableTypeChecker(validate);
2858
+ }
2859
+
2860
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
2861
+ if (!Array.isArray(arrayOfTypeCheckers)) {
2862
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2863
+ return emptyFunctionThatReturnsNull;
2864
+ }
2865
+
2866
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2867
+ var checker = arrayOfTypeCheckers[i];
2868
+ if (typeof checker !== 'function') {
2869
+ printWarning(
2870
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
2871
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
2872
+ );
2873
+ return emptyFunctionThatReturnsNull;
2874
+ }
2875
+ }
2876
+
2877
+ function validate(props, propName, componentName, location, propFullName) {
2878
+ var expectedTypes = [];
2879
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2880
+ var checker = arrayOfTypeCheckers[i];
2881
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
2882
+ if (checkerResult == null) {
2883
+ return null;
2884
+ }
2885
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
2886
+ expectedTypes.push(checkerResult.data.expectedType);
2887
+ }
2888
+ }
2889
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
2890
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
2891
+ }
2892
+ return createChainableTypeChecker(validate);
2893
+ }
2894
+
2895
+ function createNodeChecker() {
2896
+ function validate(props, propName, componentName, location, propFullName) {
2897
+ if (!isNode(props[propName])) {
2898
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2899
+ }
2900
+ return null;
2901
+ }
2902
+ return createChainableTypeChecker(validate);
2903
+ }
2904
+
2905
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
2906
+ return new PropTypeError(
2907
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
2908
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
2909
+ );
2910
+ }
2911
+
2912
+ function createShapeTypeChecker(shapeTypes) {
2913
+ function validate(props, propName, componentName, location, propFullName) {
2914
+ var propValue = props[propName];
2915
+ var propType = getPropType(propValue);
2916
+ if (propType !== 'object') {
2917
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2918
+ }
2919
+ for (var key in shapeTypes) {
2920
+ var checker = shapeTypes[key];
2921
+ if (typeof checker !== 'function') {
2922
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2923
+ }
2924
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2925
+ if (error) {
2926
+ return error;
2927
+ }
2928
+ }
2929
+ return null;
2930
+ }
2931
+ return createChainableTypeChecker(validate);
2932
+ }
2933
+
2934
+ function createStrictShapeTypeChecker(shapeTypes) {
2935
+ function validate(props, propName, componentName, location, propFullName) {
2936
+ var propValue = props[propName];
2937
+ var propType = getPropType(propValue);
2938
+ if (propType !== 'object') {
2939
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2940
+ }
2941
+ // We need to check all keys in case some are required but missing from props.
2942
+ var allKeys = assign({}, props[propName], shapeTypes);
2943
+ for (var key in allKeys) {
2944
+ var checker = shapeTypes[key];
2945
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
2946
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2947
+ }
2948
+ if (!checker) {
2949
+ return new PropTypeError(
2950
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
2951
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
2952
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
2953
+ );
2954
+ }
2955
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2956
+ if (error) {
2957
+ return error;
2958
+ }
2959
+ }
2960
+ return null;
2961
+ }
2962
+
2963
+ return createChainableTypeChecker(validate);
2964
+ }
2965
+
2966
+ function isNode(propValue) {
2967
+ switch (typeof propValue) {
2968
+ case 'number':
2969
+ case 'string':
2970
+ case 'undefined':
2971
+ return true;
2972
+ case 'boolean':
2973
+ return !propValue;
2974
+ case 'object':
2975
+ if (Array.isArray(propValue)) {
2976
+ return propValue.every(isNode);
2977
+ }
2978
+ if (propValue === null || isValidElement(propValue)) {
2979
+ return true;
2980
+ }
2981
+
2982
+ var iteratorFn = getIteratorFn(propValue);
2983
+ if (iteratorFn) {
2984
+ var iterator = iteratorFn.call(propValue);
2985
+ var step;
2986
+ if (iteratorFn !== propValue.entries) {
2987
+ while (!(step = iterator.next()).done) {
2988
+ if (!isNode(step.value)) {
2989
+ return false;
2990
+ }
2991
+ }
2992
+ } else {
2993
+ // Iterator will provide entry [k,v] tuples rather than values.
2994
+ while (!(step = iterator.next()).done) {
2995
+ var entry = step.value;
2996
+ if (entry) {
2997
+ if (!isNode(entry[1])) {
2998
+ return false;
2999
+ }
3000
+ }
3001
+ }
3002
+ }
3003
+ } else {
3004
+ return false;
3005
+ }
3006
+
3007
+ return true;
3008
+ default:
3009
+ return false;
3010
+ }
3011
+ }
3012
+
3013
+ function isSymbol(propType, propValue) {
3014
+ // Native Symbol.
3015
+ if (propType === 'symbol') {
3016
+ return true;
3017
+ }
3018
+
3019
+ // falsy value can't be a Symbol
3020
+ if (!propValue) {
3021
+ return false;
3022
+ }
3023
+
3024
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
3025
+ if (propValue['@@toStringTag'] === 'Symbol') {
3026
+ return true;
3027
+ }
3028
+
3029
+ // Fallback for non-spec compliant Symbols which are polyfilled.
3030
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
3031
+ return true;
3032
+ }
3033
+
3034
+ return false;
3035
+ }
3036
+
3037
+ // Equivalent of `typeof` but with special handling for array and regexp.
3038
+ function getPropType(propValue) {
3039
+ var propType = typeof propValue;
3040
+ if (Array.isArray(propValue)) {
3041
+ return 'array';
3042
+ }
3043
+ if (propValue instanceof RegExp) {
3044
+ // Old webkits (at least until Android 4.0) return 'function' rather than
3045
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
3046
+ // passes PropTypes.object.
3047
+ return 'object';
3048
+ }
3049
+ if (isSymbol(propType, propValue)) {
3050
+ return 'symbol';
3051
+ }
3052
+ return propType;
3053
+ }
3054
+
3055
+ // This handles more types than `getPropType`. Only used for error messages.
3056
+ // See `createPrimitiveTypeChecker`.
3057
+ function getPreciseType(propValue) {
3058
+ if (typeof propValue === 'undefined' || propValue === null) {
3059
+ return '' + propValue;
3060
+ }
3061
+ var propType = getPropType(propValue);
3062
+ if (propType === 'object') {
3063
+ if (propValue instanceof Date) {
3064
+ return 'date';
3065
+ } else if (propValue instanceof RegExp) {
3066
+ return 'regexp';
3067
+ }
3068
+ }
3069
+ return propType;
3070
+ }
3071
+
3072
+ // Returns a string that is postfixed to a warning about an invalid type.
3073
+ // For example, "undefined" or "of type array"
3074
+ function getPostfixForTypeWarning(value) {
3075
+ var type = getPreciseType(value);
3076
+ switch (type) {
3077
+ case 'array':
3078
+ case 'object':
3079
+ return 'an ' + type;
3080
+ case 'boolean':
3081
+ case 'date':
3082
+ case 'regexp':
3083
+ return 'a ' + type;
3084
+ default:
3085
+ return type;
3086
+ }
3087
+ }
3088
+
3089
+ // Returns class name of the object, if any.
3090
+ function getClassName(propValue) {
3091
+ if (!propValue.constructor || !propValue.constructor.name) {
3092
+ return ANONYMOUS;
3093
+ }
3094
+ return propValue.constructor.name;
3095
+ }
3096
+
3097
+ ReactPropTypes.checkPropTypes = checkPropTypes;
3098
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3099
+ ReactPropTypes.PropTypes = ReactPropTypes;
3100
+
3101
+ return ReactPropTypes;
3102
+ };
3103
+
3104
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
3105
+
3106
+ /***/ }),
3107
+ /* 11 */
3108
+ /***/ (function(module, exports, __webpack_require__) {
3109
+
3110
+ "use strict";
3111
+ /*
3112
+ object-assign
3113
+ (c) Sindre Sorhus
3114
+ @license MIT
3115
+ */
3116
+
3117
+
3118
+ /* eslint-disable no-unused-vars */
3119
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3120
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
3121
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3122
+
3123
+ function toObject(val) {
3124
+ if (val === null || val === undefined) {
3125
+ throw new TypeError('Object.assign cannot be called with null or undefined');
3126
+ }
3127
+
3128
+ return Object(val);
3129
+ }
3130
+
3131
+ function shouldUseNative() {
3132
+ try {
3133
+ if (!Object.assign) {
3134
+ return false;
3135
+ }
3136
+
3137
+ // Detect buggy property enumeration order in older V8 versions.
3138
+
3139
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3140
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3141
+ test1[5] = 'de';
3142
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
3143
+ return false;
3144
+ }
3145
+
3146
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3147
+ var test2 = {};
3148
+ for (var i = 0; i < 10; i++) {
3149
+ test2['_' + String.fromCharCode(i)] = i;
3150
+ }
3151
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3152
+ return test2[n];
3153
+ });
3154
+ if (order2.join('') !== '0123456789') {
3155
+ return false;
3156
+ }
3157
+
3158
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3159
+ var test3 = {};
3160
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3161
+ test3[letter] = letter;
3162
+ });
3163
+ if (Object.keys(Object.assign({}, test3)).join('') !==
3164
+ 'abcdefghijklmnopqrst') {
3165
+ return false;
3166
+ }
3167
+
3168
+ return true;
3169
+ } catch (err) {
3170
+ // We don't expect any of the above to throw, but better to be safe.
3171
+ return false;
3172
+ }
3173
+ }
3174
+
3175
+ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
3176
+ var from;
3177
+ var to = toObject(target);
3178
+ var symbols;
3179
+
3180
+ for (var s = 1; s < arguments.length; s++) {
3181
+ from = Object(arguments[s]);
3182
+
3183
+ for (var key in from) {
3184
+ if (hasOwnProperty.call(from, key)) {
3185
+ to[key] = from[key];
3186
+ }
3187
+ }
3188
+
3189
+ if (getOwnPropertySymbols) {
3190
+ symbols = getOwnPropertySymbols(from);
3191
+ for (var i = 0; i < symbols.length; i++) {
3192
+ if (propIsEnumerable.call(from, symbols[i])) {
3193
+ to[symbols[i]] = from[symbols[i]];
3194
+ }
3195
+ }
3196
+ }
3197
+ }
3198
+
3199
+ return to;
3200
+ };
3201
+
3202
+
3203
+ /***/ }),
3204
+ /* 12 */
3205
+ /***/ (function(module, exports, __webpack_require__) {
3206
+
3207
+ "use strict";
3208
+ /* WEBPACK VAR INJECTION */(function(process) {/**
3209
+ * Copyright (c) 2013-present, Facebook, Inc.
3210
+ *
3211
+ * This source code is licensed under the MIT license found in the
3212
+ * LICENSE file in the root directory of this source tree.
3213
+ */
3214
+
3215
+
3216
+
3217
+ var printWarning = function() {};
3218
+
3219
+ if (process.env.NODE_ENV !== 'production') {
3220
+ var ReactPropTypesSecret = __webpack_require__(1);
3221
+ var loggedTypeFailures = {};
3222
+ var has = __webpack_require__(3);
3223
+
3224
+ printWarning = function(text) {
3225
+ var message = 'Warning: ' + text;
3226
+ if (typeof console !== 'undefined') {
3227
+ console.error(message);
3228
+ }
3229
+ try {
3230
+ // --- Welcome to debugging React ---
3231
+ // This error was thrown as a convenience so that you can use this stack
3232
+ // to find the callsite that caused this warning to fire.
3233
+ throw new Error(message);
3234
+ } catch (x) { /**/ }
3235
+ };
3236
+ }
3237
+
3238
+ /**
3239
+ * Assert that the values match with the type specs.
3240
+ * Error messages are memorized and will only be shown once.
3241
+ *
3242
+ * @param {object} typeSpecs Map of name to a ReactPropType
3243
+ * @param {object} values Runtime values that need to be type-checked
3244
+ * @param {string} location e.g. "prop", "context", "child context"
3245
+ * @param {string} componentName Name of the component for error messages.
3246
+ * @param {?Function} getStack Returns the component stack.
3247
+ * @private
3248
+ */
3249
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
3250
+ if (process.env.NODE_ENV !== 'production') {
3251
+ for (var typeSpecName in typeSpecs) {
3252
+ if (has(typeSpecs, typeSpecName)) {
3253
+ var error;
3254
+ // Prop type validation may throw. In case they do, we don't want to
3255
+ // fail the render phase where it didn't fail before. So we log it.
3256
+ // After these have been cleaned up, we'll let them throw.
3257
+ try {
3258
+ // This is intentionally an invariant that gets caught. It's the same
3259
+ // behavior as without this statement except with a better message.
3260
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
3261
+ var err = Error(
3262
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
3263
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
3264
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
3265
+ );
3266
+ err.name = 'Invariant Violation';
3267
+ throw err;
3268
+ }
3269
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3270
+ } catch (ex) {
3271
+ error = ex;
3272
+ }
3273
+ if (error && !(error instanceof Error)) {
3274
+ printWarning(
3275
+ (componentName || 'React class') + ': type specification of ' +
3276
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
3277
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
3278
+ 'You may have forgotten to pass an argument to the type checker ' +
3279
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
3280
+ 'shape all require an argument).'
3281
+ );
3282
+ }
3283
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3284
+ // Only monitor this failure once because there tends to be a lot of the
3285
+ // same error.
3286
+ loggedTypeFailures[error.message] = true;
3287
+
3288
+ var stack = getStack ? getStack() : '';
3289
+
3290
+ printWarning(
3291
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
3292
+ );
3293
+ }
3294
+ }
3295
+ }
3296
+ }
3297
+ }
3298
+
3299
+ /**
3300
+ * Resets warning cache when testing.
3301
+ *
3302
+ * @private
3303
+ */
3304
+ checkPropTypes.resetWarningCache = function() {
3305
+ if (process.env.NODE_ENV !== 'production') {
3306
+ loggedTypeFailures = {};
3307
+ }
3308
+ }
3309
+
3310
+ module.exports = checkPropTypes;
3311
+
3312
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
3313
+
3314
+ /***/ }),
3315
+ /* 13 */
3316
+ /***/ (function(module, exports, __webpack_require__) {
3317
+
3318
+ "use strict";
3319
+ /**
3320
+ * Copyright (c) 2013-present, Facebook, Inc.
3321
+ *
3322
+ * This source code is licensed under the MIT license found in the
3323
+ * LICENSE file in the root directory of this source tree.
3324
+ */
3325
+
3326
+
3327
+
3328
+ var ReactPropTypesSecret = __webpack_require__(1);
3329
+
3330
+ function emptyFunction() {}
3331
+ function emptyFunctionWithReset() {}
3332
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
3333
+
3334
+ module.exports = function() {
3335
+ function shim(props, propName, componentName, location, propFullName, secret) {
3336
+ if (secret === ReactPropTypesSecret) {
3337
+ // It is still safe when called from React.
3338
+ return;
3339
+ }
3340
+ var err = new Error(
3341
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3342
+ 'Use PropTypes.checkPropTypes() to call them. ' +
3343
+ 'Read more at http://fb.me/use-check-prop-types'
3344
+ );
3345
+ err.name = 'Invariant Violation';
3346
+ throw err;
3347
+ };
3348
+ shim.isRequired = shim;
3349
+ function getShim() {
3350
+ return shim;
3351
+ };
3352
+ // Important!
3353
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3354
+ var ReactPropTypes = {
3355
+ array: shim,
3356
+ bigint: shim,
3357
+ bool: shim,
3358
+ func: shim,
3359
+ number: shim,
3360
+ object: shim,
3361
+ string: shim,
3362
+ symbol: shim,
3363
+
3364
+ any: shim,
3365
+ arrayOf: getShim,
3366
+ element: shim,
3367
+ elementType: shim,
3368
+ instanceOf: getShim,
3369
+ node: shim,
3370
+ objectOf: getShim,
3371
+ oneOf: getShim,
3372
+ oneOfType: getShim,
3373
+ shape: getShim,
3374
+ exact: getShim,
3375
+
3376
+ checkPropTypes: emptyFunctionWithReset,
3377
+ resetWarningCache: emptyFunction
3378
+ };
3379
+
3380
+ ReactPropTypes.PropTypes = ReactPropTypes;
3381
+
3382
+ return ReactPropTypes;
3383
+ };
3384
+
3385
+
3386
+ /***/ })
3387
+ /******/ ]);