UNPKG

321 kBJavaScriptView Raw
1/**
2 * vis-data
3 * http://visjs.org/
4 *
5 * Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data.
6 *
7 * @version 7.1.2
8 * @date 2021-01-08T20:37:11.601Z
9 *
10 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
11 * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
12 *
13 * @license
14 * vis.js is dual licensed under both
15 *
16 * 1. The Apache 2.0 License
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * and
20 *
21 * 2. The MIT License
22 * http://opensource.org/licenses/MIT
23 *
24 * vis.js may be distributed under either license.
25 */
26
27var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
28
29function createCommonjsModule(fn) {
30 var module = { exports: {} };
31 return fn(module, module.exports), module.exports;
32}
33
34var check = function (it) {
35 return it && it.Math == Math && it;
36}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
37
38
39var global$1 = // eslint-disable-next-line no-undef
40check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func
41function () {
42 return this;
43}() || Function('return this')();
44
45var fails = function (exec) {
46 try {
47 return !!exec();
48 } catch (error) {
49 return true;
50 }
51};
52
53var descriptors = !fails(function () {
54 return Object.defineProperty({}, 1, {
55 get: function () {
56 return 7;
57 }
58 })[1] != 7;
59});
60
61var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
62var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
63
64var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({
65 1: 2
66}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
67// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
68
69var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
70 var descriptor = getOwnPropertyDescriptor(this, V);
71 return !!descriptor && descriptor.enumerable;
72} : nativePropertyIsEnumerable;
73var objectPropertyIsEnumerable = {
74 f: f
75};
76
77var createPropertyDescriptor = function (bitmap, value) {
78 return {
79 enumerable: !(bitmap & 1),
80 configurable: !(bitmap & 2),
81 writable: !(bitmap & 4),
82 value: value
83 };
84};
85
86var toString = {}.toString;
87
88var classofRaw = function (it) {
89 return toString.call(it).slice(8, -1);
90};
91
92var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
93
94var indexedObject = fails(function () {
95 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
96 // eslint-disable-next-line no-prototype-builtins
97 return !Object('z').propertyIsEnumerable(0);
98}) ? function (it) {
99 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
100} : Object;
101
102// `RequireObjectCoercible` abstract operation
103// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
104var requireObjectCoercible = function (it) {
105 if (it == undefined) throw TypeError("Can't call method on " + it);
106 return it;
107};
108
109var toIndexedObject = function (it) {
110 return indexedObject(requireObjectCoercible(it));
111};
112
113var isObject = function (it) {
114 return typeof it === 'object' ? it !== null : typeof it === 'function';
115};
116
117// https://tc39.github.io/ecma262/#sec-toprimitive
118// instead of the ES6 spec version, we didn't implement @@toPrimitive case
119// and the second argument - flag - preferred type is a string
120
121var toPrimitive = function (input, PREFERRED_STRING) {
122 if (!isObject(input)) return input;
123 var fn, val;
124 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
125 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
126 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
127 throw TypeError("Can't convert object to primitive value");
128};
129
130var hasOwnProperty = {}.hasOwnProperty;
131
132var has = function (it, key) {
133 return hasOwnProperty.call(it, key);
134};
135
136var document$1 = global$1.document; // typeof document.createElement is 'object' in old IE
137
138var EXISTS = isObject(document$1) && isObject(document$1.createElement);
139
140var documentCreateElement = function (it) {
141 return EXISTS ? document$1.createElement(it) : {};
142};
143
144var ie8DomDefine = !descriptors && !fails(function () {
145 return Object.defineProperty(documentCreateElement('div'), 'a', {
146 get: function () {
147 return 7;
148 }
149 }).a != 7;
150});
151
152var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
153// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
154
155var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
156 O = toIndexedObject(O);
157 P = toPrimitive(P, true);
158 if (ie8DomDefine) try {
159 return nativeGetOwnPropertyDescriptor(O, P);
160 } catch (error) {
161 /* empty */
162 }
163 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
164};
165var objectGetOwnPropertyDescriptor = {
166 f: f$1
167};
168
169var replacement = /#|\.prototype\./;
170
171var isForced = function (feature, detection) {
172 var value = data[normalize(feature)];
173 return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
174};
175
176var normalize = isForced.normalize = function (string) {
177 return String(string).replace(replacement, '.').toLowerCase();
178};
179
180var data = isForced.data = {};
181var NATIVE = isForced.NATIVE = 'N';
182var POLYFILL = isForced.POLYFILL = 'P';
183var isForced_1 = isForced;
184
185var path = {};
186
187var aFunction = function (it) {
188 if (typeof it != 'function') {
189 throw TypeError(String(it) + ' is not a function');
190 }
191
192 return it;
193};
194
195var functionBindContext = function (fn, that, length) {
196 aFunction(fn);
197 if (that === undefined) return fn;
198
199 switch (length) {
200 case 0:
201 return function () {
202 return fn.call(that);
203 };
204
205 case 1:
206 return function (a) {
207 return fn.call(that, a);
208 };
209
210 case 2:
211 return function (a, b) {
212 return fn.call(that, a, b);
213 };
214
215 case 3:
216 return function (a, b, c) {
217 return fn.call(that, a, b, c);
218 };
219 }
220
221 return function ()
222 /* ...args */
223 {
224 return fn.apply(that, arguments);
225 };
226};
227
228var anObject = function (it) {
229 if (!isObject(it)) {
230 throw TypeError(String(it) + ' is not an object');
231 }
232
233 return it;
234};
235
236var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method
237// https://tc39.github.io/ecma262/#sec-object.defineproperty
238
239var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
240 anObject(O);
241 P = toPrimitive(P, true);
242 anObject(Attributes);
243 if (ie8DomDefine) try {
244 return nativeDefineProperty(O, P, Attributes);
245 } catch (error) {
246 /* empty */
247 }
248 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
249 if ('value' in Attributes) O[P] = Attributes.value;
250 return O;
251};
252var objectDefineProperty = {
253 f: f$2
254};
255
256var createNonEnumerableProperty = descriptors ? function (object, key, value) {
257 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
258} : function (object, key, value) {
259 object[key] = value;
260 return object;
261};
262
263var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
264
265var wrapConstructor = function (NativeConstructor) {
266 var Wrapper = function (a, b, c) {
267 if (this instanceof NativeConstructor) {
268 switch (arguments.length) {
269 case 0:
270 return new NativeConstructor();
271
272 case 1:
273 return new NativeConstructor(a);
274
275 case 2:
276 return new NativeConstructor(a, b);
277 }
278
279 return new NativeConstructor(a, b, c);
280 }
281
282 return NativeConstructor.apply(this, arguments);
283 };
284
285 Wrapper.prototype = NativeConstructor.prototype;
286 return Wrapper;
287};
288/*
289 options.target - name of the target object
290 options.global - target is the global object
291 options.stat - export as static methods of target
292 options.proto - export as prototype methods of target
293 options.real - real prototype method for the `pure` version
294 options.forced - export even if the native feature is available
295 options.bind - bind methods to the target, required for the `pure` version
296 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
297 options.unsafe - use the simple assignment of property instead of delete + defineProperty
298 options.sham - add a flag to not completely full polyfills
299 options.enumerable - export as enumerable property
300 options.noTargetGet - prevent calling a getter on target
301*/
302
303
304var _export = function (options, source) {
305 var TARGET = options.target;
306 var GLOBAL = options.global;
307 var STATIC = options.stat;
308 var PROTO = options.proto;
309 var nativeSource = GLOBAL ? global$1 : STATIC ? global$1[TARGET] : (global$1[TARGET] || {}).prototype;
310 var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
311 var targetPrototype = target.prototype;
312 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
313 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
314
315 for (key in source) {
316 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native
317
318 USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key);
319 targetProperty = target[key];
320 if (USE_NATIVE) if (options.noTargetGet) {
321 descriptor = getOwnPropertyDescriptor$1(nativeSource, key);
322 nativeProperty = descriptor && descriptor.value;
323 } else nativeProperty = nativeSource[key]; // export native or implementation
324
325 sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
326 if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue; // bind timers to global for call from export context
327
328 if (options.bind && USE_NATIVE) resultProperty = functionBindContext(sourceProperty, global$1); // wrap global constructors for prevent changs in this version
329 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods
330 else if (PROTO && typeof sourceProperty == 'function') resultProperty = functionBindContext(Function.call, sourceProperty); // default case
331 else resultProperty = sourceProperty; // add a flag to not completely full polyfills
332
333 if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
334 createNonEnumerableProperty(resultProperty, 'sham', true);
335 }
336
337 target[key] = resultProperty;
338
339 if (PROTO) {
340 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
341
342 if (!has(path, VIRTUAL_PROTOTYPE)) {
343 createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
344 } // export virtual prototype methods
345
346
347 path[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods
348
349 if (options.real && targetPrototype && !targetPrototype[key]) {
350 createNonEnumerableProperty(targetPrototype, key, sourceProperty);
351 }
352 }
353 }
354};
355
356// https://tc39.github.io/ecma262/#sec-isarray
357
358var isArray = Array.isArray || function isArray(arg) {
359 return classofRaw(arg) == 'Array';
360};
361
362var ceil = Math.ceil;
363var floor = Math.floor; // `ToInteger` abstract operation
364// https://tc39.github.io/ecma262/#sec-tointeger
365
366var toInteger = function (argument) {
367 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
368};
369
370var min = Math.min; // `ToLength` abstract operation
371// https://tc39.github.io/ecma262/#sec-tolength
372
373var toLength = function (argument) {
374 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
375};
376
377// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
378
379
380var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
381 var targetIndex = start;
382 var sourceIndex = 0;
383 var mapFn = mapper ? functionBindContext(mapper, thisArg, 3) : false;
384 var element;
385
386 while (sourceIndex < sourceLen) {
387 if (sourceIndex in source) {
388 element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
389
390 if (depth > 0 && isArray(element)) {
391 targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
392 } else {
393 if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
394 target[targetIndex] = element;
395 }
396
397 targetIndex++;
398 }
399
400 sourceIndex++;
401 }
402
403 return targetIndex;
404};
405
406var flattenIntoArray_1 = flattenIntoArray;
407
408// https://tc39.github.io/ecma262/#sec-toobject
409
410var toObject = function (argument) {
411 return Object(requireObjectCoercible(argument));
412};
413
414var setGlobal = function (key, value) {
415 try {
416 createNonEnumerableProperty(global$1, key, value);
417 } catch (error) {
418 global$1[key] = value;
419 }
420
421 return value;
422};
423
424var SHARED = '__core-js_shared__';
425var store = global$1[SHARED] || setGlobal(SHARED, {});
426var sharedStore = store;
427
428var shared = createCommonjsModule(function (module) {
429 (module.exports = function (key, value) {
430 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
431 })('versions', []).push({
432 version: '3.7.0',
433 mode: 'pure' ,
434 copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
435 });
436});
437
438var id = 0;
439var postfix = Math.random();
440
441var uid = function (key) {
442 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
443};
444
445var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
446 // Chrome 38 Symbol has incorrect toString conversion
447 // eslint-disable-next-line no-undef
448 return !String(Symbol());
449});
450
451var useSymbolAsUid = nativeSymbol // eslint-disable-next-line no-undef
452&& !Symbol.sham // eslint-disable-next-line no-undef
453&& typeof Symbol.iterator == 'symbol';
454
455var WellKnownSymbolsStore = shared('wks');
456var Symbol$1 = global$1.Symbol;
457var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
458
459var wellKnownSymbol = function (name) {
460 if (!has(WellKnownSymbolsStore, name)) {
461 if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
462 }
463
464 return WellKnownSymbolsStore[name];
465};
466
467var SPECIES = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation
468// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
469
470var arraySpeciesCreate = function (originalArray, length) {
471 var C;
472
473 if (isArray(originalArray)) {
474 C = originalArray.constructor; // cross-realm fallback
475
476 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
477 C = C[SPECIES];
478 if (C === null) C = undefined;
479 }
480 }
481
482 return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
483};
484
485// https://github.com/tc39/proposal-flatMap
486
487
488_export({
489 target: 'Array',
490 proto: true
491}, {
492 flatMap: function flatMap(callbackfn
493 /* , thisArg */
494 ) {
495 var O = toObject(this);
496 var sourceLen = toLength(O.length);
497 var A;
498 aFunction(callbackfn);
499 A = arraySpeciesCreate(O, 0);
500 A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
501 return A;
502 }
503});
504
505var entryVirtual = function (CONSTRUCTOR) {
506 return path[CONSTRUCTOR + 'Prototype'];
507};
508
509var flatMap = entryVirtual('Array').flatMap;
510
511var ArrayPrototype = Array.prototype;
512
513var flatMap_1 = function (it) {
514 var own = it.flatMap;
515 return it === ArrayPrototype || it instanceof Array && own === ArrayPrototype.flatMap ? flatMap : own;
516};
517
518var flatMap$1 = flatMap_1;
519
520var flatMap$2 = flatMap$1;
521
522var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
523
524var createMethod = function (TYPE) {
525 var IS_MAP = TYPE == 1;
526 var IS_FILTER = TYPE == 2;
527 var IS_SOME = TYPE == 3;
528 var IS_EVERY = TYPE == 4;
529 var IS_FIND_INDEX = TYPE == 6;
530 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
531 return function ($this, callbackfn, that, specificCreate) {
532 var O = toObject($this);
533 var self = indexedObject(O);
534 var boundFunction = functionBindContext(callbackfn, that, 3);
535 var length = toLength(self.length);
536 var index = 0;
537 var create = specificCreate || arraySpeciesCreate;
538 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
539 var value, result;
540
541 for (; length > index; index++) if (NO_HOLES || index in self) {
542 value = self[index];
543 result = boundFunction(value, index, O);
544
545 if (TYPE) {
546 if (IS_MAP) target[index] = result; // map
547 else if (result) switch (TYPE) {
548 case 3:
549 return true;
550 // some
551
552 case 5:
553 return value;
554 // find
555
556 case 6:
557 return index;
558 // findIndex
559
560 case 2:
561 push.call(target, value);
562 // filter
563 } else if (IS_EVERY) return false; // every
564 }
565 }
566
567 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
568 };
569};
570
571var arrayIteration = {
572 // `Array.prototype.forEach` method
573 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
574 forEach: createMethod(0),
575 // `Array.prototype.map` method
576 // https://tc39.github.io/ecma262/#sec-array.prototype.map
577 map: createMethod(1),
578 // `Array.prototype.filter` method
579 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
580 filter: createMethod(2),
581 // `Array.prototype.some` method
582 // https://tc39.github.io/ecma262/#sec-array.prototype.some
583 some: createMethod(3),
584 // `Array.prototype.every` method
585 // https://tc39.github.io/ecma262/#sec-array.prototype.every
586 every: createMethod(4),
587 // `Array.prototype.find` method
588 // https://tc39.github.io/ecma262/#sec-array.prototype.find
589 find: createMethod(5),
590 // `Array.prototype.findIndex` method
591 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
592 findIndex: createMethod(6)
593};
594
595var aFunction$1 = function (variable) {
596 return typeof variable == 'function' ? variable : undefined;
597};
598
599var getBuiltIn = function (namespace, method) {
600 return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global$1[namespace]) : path[namespace] && path[namespace][method] || global$1[namespace] && global$1[namespace][method];
601};
602
603var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
604
605var process = global$1.process;
606var versions = process && process.versions;
607var v8 = versions && versions.v8;
608var match, version;
609
610if (v8) {
611 match = v8.split('.');
612 version = match[0] + match[1];
613} else if (engineUserAgent) {
614 match = engineUserAgent.match(/Edge\/(\d+)/);
615
616 if (!match || match[1] >= 74) {
617 match = engineUserAgent.match(/Chrome\/(\d+)/);
618 if (match) version = match[1];
619 }
620}
621
622var engineV8Version = version && +version;
623
624var SPECIES$1 = wellKnownSymbol('species');
625
626var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
627 // We can't use this feature detection in V8 since it causes
628 // deoptimization and serious performance degradation
629 // https://github.com/zloirock/core-js/issues/677
630 return engineV8Version >= 51 || !fails(function () {
631 var array = [];
632 var constructor = array.constructor = {};
633
634 constructor[SPECIES$1] = function () {
635 return {
636 foo: 1
637 };
638 };
639
640 return array[METHOD_NAME](Boolean).foo !== 1;
641 });
642};
643
644var defineProperty = Object.defineProperty;
645var cache = {};
646
647var thrower = function (it) {
648 throw it;
649};
650
651var arrayMethodUsesToLength = function (METHOD_NAME, options) {
652 if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
653 if (!options) options = {};
654 var method = [][METHOD_NAME];
655 var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
656 var argument0 = has(options, 0) ? options[0] : thrower;
657 var argument1 = has(options, 1) ? options[1] : undefined;
658 return cache[METHOD_NAME] = !!method && !fails(function () {
659 if (ACCESSORS && !descriptors) return true;
660 var O = {
661 length: -1
662 };
663 if (ACCESSORS) defineProperty(O, 1, {
664 enumerable: true,
665 get: thrower
666 });else O[1] = 1;
667 method.call(O, argument0, argument1);
668 });
669};
670
671var $map = arrayIteration.map;
672var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // FF49- issue
673
674var USES_TO_LENGTH = arrayMethodUsesToLength('map'); // `Array.prototype.map` method
675// https://tc39.github.io/ecma262/#sec-array.prototype.map
676// with adding support of @@species
677
678_export({
679 target: 'Array',
680 proto: true,
681 forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH
682}, {
683 map: function map(callbackfn
684 /* , thisArg */
685 ) {
686 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
687 }
688});
689
690var map = entryVirtual('Array').map;
691
692var ArrayPrototype$1 = Array.prototype;
693
694var map_1 = function (it) {
695 var own = it.map;
696 return it === ArrayPrototype$1 || it instanceof Array && own === ArrayPrototype$1.map ? map : own;
697};
698
699var map$1 = map_1;
700
701var map$2 = map$1;
702
703var $filter = arrayIteration.filter;
704var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter'); // Edge 14- issue
705
706var USES_TO_LENGTH$1 = arrayMethodUsesToLength('filter'); // `Array.prototype.filter` method
707// https://tc39.github.io/ecma262/#sec-array.prototype.filter
708// with adding support of @@species
709
710_export({
711 target: 'Array',
712 proto: true,
713 forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$1
714}, {
715 filter: function filter(callbackfn
716 /* , thisArg */
717 ) {
718 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
719 }
720});
721
722var filter = entryVirtual('Array').filter;
723
724var ArrayPrototype$2 = Array.prototype;
725
726var filter_1 = function (it) {
727 var own = it.filter;
728 return it === ArrayPrototype$2 || it instanceof Array && own === ArrayPrototype$2.filter ? filter : own;
729};
730
731var filter$1 = filter_1;
732
733var filter$2 = filter$1;
734
735var createMethod$1 = function (IS_RIGHT) {
736 return function (that, callbackfn, argumentsLength, memo) {
737 aFunction(callbackfn);
738 var O = toObject(that);
739 var self = indexedObject(O);
740 var length = toLength(O.length);
741 var index = IS_RIGHT ? length - 1 : 0;
742 var i = IS_RIGHT ? -1 : 1;
743 if (argumentsLength < 2) while (true) {
744 if (index in self) {
745 memo = self[index];
746 index += i;
747 break;
748 }
749
750 index += i;
751
752 if (IS_RIGHT ? index < 0 : length <= index) {
753 throw TypeError('Reduce of empty array with no initial value');
754 }
755 }
756
757 for (; IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
758 memo = callbackfn(memo, self[index], index, O);
759 }
760
761 return memo;
762 };
763};
764
765var arrayReduce = {
766 // `Array.prototype.reduce` method
767 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
768 left: createMethod$1(false),
769 // `Array.prototype.reduceRight` method
770 // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
771 right: createMethod$1(true)
772};
773
774var arrayMethodIsStrict = function (METHOD_NAME, argument) {
775 var method = [][METHOD_NAME];
776 return !!method && fails(function () {
777 // eslint-disable-next-line no-useless-call,no-throw-literal
778 method.call(null, argument || function () {
779 throw 1;
780 }, 1);
781 });
782};
783
784var engineIsNode = classofRaw(global$1.process) == 'process';
785
786var $reduce = arrayReduce.left;
787var STRICT_METHOD = arrayMethodIsStrict('reduce');
788var USES_TO_LENGTH$2 = arrayMethodUsesToLength('reduce', {
789 1: 0
790}); // Chrome 80-82 has a critical bug
791// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
792
793var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83; // `Array.prototype.reduce` method
794// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
795
796_export({
797 target: 'Array',
798 proto: true,
799 forced: !STRICT_METHOD || !USES_TO_LENGTH$2 || CHROME_BUG
800}, {
801 reduce: function reduce(callbackfn
802 /* , initialValue */
803 ) {
804 return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
805 }
806});
807
808var reduce = entryVirtual('Array').reduce;
809
810var ArrayPrototype$3 = Array.prototype;
811
812var reduce_1 = function (it) {
813 var own = it.reduce;
814 return it === ArrayPrototype$3 || it instanceof Array && own === ArrayPrototype$3.reduce ? reduce : own;
815};
816
817var reduce$1 = reduce_1;
818
819var reduce$2 = reduce$1;
820
821var slice = [].slice;
822var factories = {};
823
824var construct = function (C, argsLength, args) {
825 if (!(argsLength in factories)) {
826 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func
827
828
829 factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
830 }
831
832 return factories[argsLength](C, args);
833}; // `Function.prototype.bind` method implementation
834// https://tc39.github.io/ecma262/#sec-function.prototype.bind
835
836
837var functionBind = Function.bind || function bind(that
838/* , ...args */
839) {
840 var fn = aFunction(this);
841 var partArgs = slice.call(arguments, 1);
842
843 var boundFunction = function bound()
844 /* args... */
845 {
846 var args = partArgs.concat(slice.call(arguments));
847 return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
848 };
849
850 if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
851 return boundFunction;
852};
853
854// https://tc39.github.io/ecma262/#sec-function.prototype.bind
855
856_export({
857 target: 'Function',
858 proto: true
859}, {
860 bind: functionBind
861});
862
863var bind = entryVirtual('Function').bind;
864
865var FunctionPrototype = Function.prototype;
866
867var bind_1 = function (it) {
868 var own = it.bind;
869 return it === FunctionPrototype || it instanceof Function && own === FunctionPrototype.bind ? bind : own;
870};
871
872var bind$1 = bind_1;
873
874var bind$2 = bind$1;
875
876function _classCallCheck(instance, Constructor) {
877 if (!(instance instanceof Constructor)) {
878 throw new TypeError("Cannot call a class as a function");
879 }
880}
881
882var classCallCheck = _classCallCheck;
883
884// https://tc39.github.io/ecma262/#sec-object.defineproperty
885
886_export({
887 target: 'Object',
888 stat: true,
889 forced: !descriptors,
890 sham: !descriptors
891}, {
892 defineProperty: objectDefineProperty.f
893});
894
895var defineProperty_1 = createCommonjsModule(function (module) {
896 var Object = path.Object;
897
898 var defineProperty = module.exports = function defineProperty(it, key, desc) {
899 return Object.defineProperty(it, key, desc);
900 };
901
902 if (Object.defineProperty.sham) defineProperty.sham = true;
903});
904
905var defineProperty$1 = defineProperty_1;
906
907var defineProperty$2 = defineProperty$1;
908
909function _defineProperties(target, props) {
910 for (var i = 0; i < props.length; i++) {
911 var descriptor = props[i];
912 descriptor.enumerable = descriptor.enumerable || false;
913 descriptor.configurable = true;
914 if ("value" in descriptor) descriptor.writable = true;
915
916 defineProperty$2(target, descriptor.key, descriptor);
917 }
918}
919
920function _createClass(Constructor, protoProps, staticProps) {
921 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
922 if (staticProps) _defineProperties(Constructor, staticProps);
923 return Constructor;
924}
925
926var createClass = _createClass;
927
928/**
929 * Create new data pipe.
930 *
931 * @param from - The source data set or data view.
932 *
933 * @remarks
934 * Example usage:
935 * ```typescript
936 * interface AppItem {
937 * whoami: string;
938 * appData: unknown;
939 * visData: VisItem;
940 * }
941 * interface VisItem {
942 * id: number;
943 * label: string;
944 * color: string;
945 * x: number;
946 * y: number;
947 * }
948 *
949 * const ds1 = new DataSet<AppItem, "whoami">([], { fieldId: "whoami" });
950 * const ds2 = new DataSet<VisItem, "id">();
951 *
952 * const pipe = createNewDataPipeFrom(ds1)
953 * .filter((item): boolean => item.enabled === true)
954 * .map<VisItem, "id">((item): VisItem => item.visData)
955 * .to(ds2);
956 *
957 * pipe.start();
958 * ```
959 *
960 * @returns A factory whose methods can be used to configure the pipe.
961 */
962function createNewDataPipeFrom(from) {
963 return new DataPipeUnderConstruction(from);
964}
965/**
966 * Internal implementation of the pipe. This should be accessible only through
967 * `createNewDataPipeFrom` from the outside.
968 *
969 * @typeParam SI - Source item type.
970 * @typeParam SP - Source item type's id property name.
971 * @typeParam TI - Target item type.
972 * @typeParam TP - Target item type's id property name.
973 */
974
975var SimpleDataPipe = /*#__PURE__*/function () {
976 /**
977 * Create a new data pipe.
978 *
979 * @param _source - The data set or data view that will be observed.
980 * @param _transformers - An array of transforming functions to be used to
981 * filter or transform the items in the pipe.
982 * @param _target - The data set or data view that will receive the items.
983 */
984 function SimpleDataPipe(_source, _transformers, _target) {
985 var _context, _context2, _context3;
986
987 classCallCheck(this, SimpleDataPipe);
988
989 this._source = _source;
990 this._transformers = _transformers;
991 this._target = _target;
992 /**
993 * Bound listeners for use with `DataInterface['on' | 'off']`.
994 */
995
996 this._listeners = {
997 add: bind$2(_context = this._add).call(_context, this),
998 remove: bind$2(_context2 = this._remove).call(_context2, this),
999 update: bind$2(_context3 = this._update).call(_context3, this)
1000 };
1001 }
1002 /** @inheritDoc */
1003
1004
1005 createClass(SimpleDataPipe, [{
1006 key: "all",
1007 value: function all() {
1008 this._target.update(this._transformItems(this._source.get()));
1009
1010 return this;
1011 }
1012 /** @inheritDoc */
1013
1014 }, {
1015 key: "start",
1016 value: function start() {
1017 this._source.on("add", this._listeners.add);
1018
1019 this._source.on("remove", this._listeners.remove);
1020
1021 this._source.on("update", this._listeners.update);
1022
1023 return this;
1024 }
1025 /** @inheritDoc */
1026
1027 }, {
1028 key: "stop",
1029 value: function stop() {
1030 this._source.off("add", this._listeners.add);
1031
1032 this._source.off("remove", this._listeners.remove);
1033
1034 this._source.off("update", this._listeners.update);
1035
1036 return this;
1037 }
1038 /**
1039 * Apply the transformers to the items.
1040 *
1041 * @param items - The items to be transformed.
1042 *
1043 * @returns The transformed items.
1044 */
1045
1046 }, {
1047 key: "_transformItems",
1048 value: function _transformItems(items) {
1049 var _context4;
1050
1051 return reduce$2(_context4 = this._transformers).call(_context4, function (items, transform) {
1052 return transform(items);
1053 }, items);
1054 }
1055 /**
1056 * Handle an add event.
1057 *
1058 * @param _name - Ignored.
1059 * @param payload - The payload containing the ids of the added items.
1060 */
1061
1062 }, {
1063 key: "_add",
1064 value: function _add(_name, payload) {
1065 if (payload == null) {
1066 return;
1067 }
1068
1069 this._target.add(this._transformItems(this._source.get(payload.items)));
1070 }
1071 /**
1072 * Handle an update event.
1073 *
1074 * @param _name - Ignored.
1075 * @param payload - The payload containing the ids of the updated items.
1076 */
1077
1078 }, {
1079 key: "_update",
1080 value: function _update(_name, payload) {
1081 if (payload == null) {
1082 return;
1083 }
1084
1085 this._target.update(this._transformItems(this._source.get(payload.items)));
1086 }
1087 /**
1088 * Handle a remove event.
1089 *
1090 * @param _name - Ignored.
1091 * @param payload - The payload containing the data of the removed items.
1092 */
1093
1094 }, {
1095 key: "_remove",
1096 value: function _remove(_name, payload) {
1097 if (payload == null) {
1098 return;
1099 }
1100
1101 this._target.remove(this._transformItems(payload.oldData));
1102 }
1103 }]);
1104
1105 return SimpleDataPipe;
1106}();
1107/**
1108 * Internal implementation of the pipe factory. This should be accessible
1109 * only through `createNewDataPipeFrom` from the outside.
1110 *
1111 * @typeParam TI - Target item type.
1112 * @typeParam TP - Target item type's id property name.
1113 */
1114
1115
1116var DataPipeUnderConstruction = /*#__PURE__*/function () {
1117 /**
1118 * Create a new data pipe factory. This is an internal constructor that
1119 * should never be called from outside of this file.
1120 *
1121 * @param _source - The source data set or data view for this pipe.
1122 */
1123 function DataPipeUnderConstruction(_source) {
1124 classCallCheck(this, DataPipeUnderConstruction);
1125
1126 this._source = _source;
1127 /**
1128 * Array transformers used to transform items within the pipe. This is typed
1129 * as any for the sake of simplicity.
1130 */
1131
1132 this._transformers = [];
1133 }
1134 /**
1135 * Filter the items.
1136 *
1137 * @param callback - A filtering function that returns true if given item
1138 * should be piped and false if not.
1139 *
1140 * @returns This factory for further configuration.
1141 */
1142
1143
1144 createClass(DataPipeUnderConstruction, [{
1145 key: "filter",
1146 value: function filter(callback) {
1147 this._transformers.push(function (input) {
1148 return filter$2(input).call(input, callback);
1149 });
1150
1151 return this;
1152 }
1153 /**
1154 * Map each source item to a new type.
1155 *
1156 * @param callback - A mapping function that takes a source item and returns
1157 * corresponding mapped item.
1158 *
1159 * @typeParam TI - Target item type.
1160 * @typeParam TP - Target item type's id property name.
1161 *
1162 * @returns This factory for further configuration.
1163 */
1164
1165 }, {
1166 key: "map",
1167 value: function map(callback) {
1168 this._transformers.push(function (input) {
1169 return map$2(input).call(input, callback);
1170 });
1171
1172 return this;
1173 }
1174 /**
1175 * Map each source item to zero or more items of a new type.
1176 *
1177 * @param callback - A mapping function that takes a source item and returns
1178 * an array of corresponding mapped items.
1179 *
1180 * @typeParam TI - Target item type.
1181 * @typeParam TP - Target item type's id property name.
1182 *
1183 * @returns This factory for further configuration.
1184 */
1185
1186 }, {
1187 key: "flatMap",
1188 value: function flatMap(callback) {
1189 this._transformers.push(function (input) {
1190 return flatMap$2(input).call(input, callback);
1191 });
1192
1193 return this;
1194 }
1195 /**
1196 * Connect this pipe to given data set.
1197 *
1198 * @param target - The data set that will receive the items from this pipe.
1199 *
1200 * @returns The pipe connected between given data sets and performing
1201 * configured transformation on the processed items.
1202 */
1203
1204 }, {
1205 key: "to",
1206 value: function to(target) {
1207 return new SimpleDataPipe(this._source, this._transformers, target);
1208 }
1209 }]);
1210
1211 return DataPipeUnderConstruction;
1212}();
1213
1214var defineProperty$3 = defineProperty_1;
1215
1216var defineProperty$4 = defineProperty$3;
1217
1218var max = Math.max;
1219var min$1 = Math.min; // Helper for a popular repeating case of the spec:
1220// Let integer be ? ToInteger(index).
1221// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1222
1223var toAbsoluteIndex = function (index, length) {
1224 var integer = toInteger(index);
1225 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1226};
1227
1228var createMethod$2 = function (IS_INCLUDES) {
1229 return function ($this, el, fromIndex) {
1230 var O = toIndexedObject($this);
1231 var length = toLength(O.length);
1232 var index = toAbsoluteIndex(fromIndex, length);
1233 var value; // Array#includes uses SameValueZero equality algorithm
1234 // eslint-disable-next-line no-self-compare
1235
1236 if (IS_INCLUDES && el != el) while (length > index) {
1237 value = O[index++]; // eslint-disable-next-line no-self-compare
1238
1239 if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
1240 } else for (; length > index; index++) {
1241 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1242 }
1243 return !IS_INCLUDES && -1;
1244 };
1245};
1246
1247var arrayIncludes = {
1248 // `Array.prototype.includes` method
1249 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
1250 includes: createMethod$2(true),
1251 // `Array.prototype.indexOf` method
1252 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
1253 indexOf: createMethod$2(false)
1254};
1255
1256var hiddenKeys = {};
1257
1258var indexOf = arrayIncludes.indexOf;
1259
1260var objectKeysInternal = function (object, names) {
1261 var O = toIndexedObject(object);
1262 var i = 0;
1263 var result = [];
1264 var key;
1265
1266 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys
1267
1268
1269 while (names.length > i) if (has(O, key = names[i++])) {
1270 ~indexOf(result, key) || result.push(key);
1271 }
1272
1273 return result;
1274};
1275
1276// IE8- don't enum bug keys
1277var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
1278
1279// https://tc39.github.io/ecma262/#sec-object.keys
1280
1281var objectKeys = Object.keys || function keys(O) {
1282 return objectKeysInternal(O, enumBugKeys);
1283};
1284
1285// https://tc39.github.io/ecma262/#sec-object.defineproperties
1286
1287var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
1288 anObject(O);
1289 var keys = objectKeys(Properties);
1290 var length = keys.length;
1291 var index = 0;
1292 var key;
1293
1294 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
1295
1296 return O;
1297};
1298
1299// https://tc39.github.io/ecma262/#sec-object.defineproperties
1300
1301_export({
1302 target: 'Object',
1303 stat: true,
1304 forced: !descriptors,
1305 sham: !descriptors
1306}, {
1307 defineProperties: objectDefineProperties
1308});
1309
1310var defineProperties_1 = createCommonjsModule(function (module) {
1311 var Object = path.Object;
1312
1313 var defineProperties = module.exports = function defineProperties(T, D) {
1314 return Object.defineProperties(T, D);
1315 };
1316
1317 if (Object.defineProperties.sham) defineProperties.sham = true;
1318});
1319
1320var defineProperties = defineProperties_1;
1321
1322var defineProperties$1 = defineProperties;
1323
1324var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
1325// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1326
1327var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1328 return objectKeysInternal(O, hiddenKeys$1);
1329};
1330
1331var objectGetOwnPropertyNames = {
1332 f: f$3
1333};
1334
1335var f$4 = Object.getOwnPropertySymbols;
1336var objectGetOwnPropertySymbols = {
1337 f: f$4
1338};
1339
1340var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
1341 var keys = objectGetOwnPropertyNames.f(anObject(it));
1342 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1343 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
1344};
1345
1346var createProperty = function (object, key, value) {
1347 var propertyKey = toPrimitive(key);
1348 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
1349};
1350
1351// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1352
1353_export({
1354 target: 'Object',
1355 stat: true,
1356 sham: !descriptors
1357}, {
1358 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
1359 var O = toIndexedObject(object);
1360 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1361 var keys = ownKeys(O);
1362 var result = {};
1363 var index = 0;
1364 var key, descriptor;
1365
1366 while (keys.length > index) {
1367 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
1368 if (descriptor !== undefined) createProperty(result, key, descriptor);
1369 }
1370
1371 return result;
1372 }
1373});
1374
1375var getOwnPropertyDescriptors = path.Object.getOwnPropertyDescriptors;
1376
1377var getOwnPropertyDescriptors$1 = getOwnPropertyDescriptors;
1378
1379var getOwnPropertyDescriptors$2 = getOwnPropertyDescriptors$1;
1380
1381var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1382var FAILS_ON_PRIMITIVES = fails(function () {
1383 nativeGetOwnPropertyDescriptor$1(1);
1384});
1385var FORCED = !descriptors || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method
1386// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
1387
1388_export({
1389 target: 'Object',
1390 stat: true,
1391 forced: FORCED,
1392 sham: !descriptors
1393}, {
1394 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
1395 return nativeGetOwnPropertyDescriptor$1(toIndexedObject(it), key);
1396 }
1397});
1398
1399var getOwnPropertyDescriptor_1 = createCommonjsModule(function (module) {
1400 var Object = path.Object;
1401
1402 var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
1403 return Object.getOwnPropertyDescriptor(it, key);
1404 };
1405
1406 if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
1407});
1408
1409var getOwnPropertyDescriptor$2 = getOwnPropertyDescriptor_1;
1410
1411var getOwnPropertyDescriptor$3 = getOwnPropertyDescriptor$2;
1412
1413var html = getBuiltIn('document', 'documentElement');
1414
1415var keys = shared('keys');
1416
1417var sharedKey = function (key) {
1418 return keys[key] || (keys[key] = uid(key));
1419};
1420
1421var GT = '>';
1422var LT = '<';
1423var PROTOTYPE = 'prototype';
1424var SCRIPT = 'script';
1425var IE_PROTO = sharedKey('IE_PROTO');
1426
1427var EmptyConstructor = function () {
1428 /* empty */
1429};
1430
1431var scriptTag = function (content) {
1432 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1433}; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1434
1435
1436var NullProtoObjectViaActiveX = function (activeXDocument) {
1437 activeXDocument.write(scriptTag(''));
1438 activeXDocument.close();
1439 var temp = activeXDocument.parentWindow.Object;
1440 activeXDocument = null; // avoid memory leak
1441
1442 return temp;
1443}; // Create object with fake `null` prototype: use iframe Object with cleared prototype
1444
1445
1446var NullProtoObjectViaIFrame = function () {
1447 // Thrash, waste and sodomy: IE GC bug
1448 var iframe = documentCreateElement('iframe');
1449 var JS = 'java' + SCRIPT + ':';
1450 var iframeDocument;
1451 iframe.style.display = 'none';
1452 html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475
1453
1454 iframe.src = String(JS);
1455 iframeDocument = iframe.contentWindow.document;
1456 iframeDocument.open();
1457 iframeDocument.write(scriptTag('document.F=Object'));
1458 iframeDocument.close();
1459 return iframeDocument.F;
1460}; // Check for document.domain and active x support
1461// No need to use active x approach when document.domain is not set
1462// see https://github.com/es-shims/es5-shim/issues/150
1463// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1464// avoid IE GC bug
1465
1466
1467var activeXDocument;
1468
1469var NullProtoObject = function () {
1470 try {
1471 /* global ActiveXObject */
1472 activeXDocument = document.domain && new ActiveXObject('htmlfile');
1473 } catch (error) {
1474 /* ignore */
1475 }
1476
1477 NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
1478 var length = enumBugKeys.length;
1479
1480 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1481
1482 return NullProtoObject();
1483};
1484
1485hiddenKeys[IE_PROTO] = true; // `Object.create` method
1486// https://tc39.github.io/ecma262/#sec-object.create
1487
1488var objectCreate = Object.create || function create(O, Properties) {
1489 var result;
1490
1491 if (O !== null) {
1492 EmptyConstructor[PROTOTYPE] = anObject(O);
1493 result = new EmptyConstructor();
1494 EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill
1495
1496 result[IE_PROTO] = O;
1497 } else result = NullProtoObject();
1498
1499 return Properties === undefined ? result : objectDefineProperties(result, Properties);
1500};
1501
1502var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
1503var toString$1 = {}.toString;
1504var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
1505
1506var getWindowNames = function (it) {
1507 try {
1508 return nativeGetOwnPropertyNames(it);
1509 } catch (error) {
1510 return windowNames.slice();
1511 }
1512}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
1513
1514
1515var f$5 = function getOwnPropertyNames(it) {
1516 return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it));
1517};
1518
1519var objectGetOwnPropertyNamesExternal = {
1520 f: f$5
1521};
1522
1523var redefine = function (target, key, value, options) {
1524 if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty(target, key, value);
1525};
1526
1527var f$6 = wellKnownSymbol;
1528var wellKnownSymbolWrapped = {
1529 f: f$6
1530};
1531
1532var defineProperty$5 = objectDefineProperty.f;
1533
1534var defineWellKnownSymbol = function (NAME) {
1535 var Symbol = path.Symbol || (path.Symbol = {});
1536 if (!has(Symbol, NAME)) defineProperty$5(Symbol, NAME, {
1537 value: wellKnownSymbolWrapped.f(NAME)
1538 });
1539};
1540
1541var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1542var test = {};
1543test[TO_STRING_TAG] = 'z';
1544var toStringTagSupport = String(test) === '[object z]';
1545
1546var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); // ES3 wrong here
1547
1548var CORRECT_ARGUMENTS = classofRaw(function () {
1549 return arguments;
1550}()) == 'Arguments'; // fallback for IE11 Script Access Denied error
1551
1552var tryGet = function (it, key) {
1553 try {
1554 return it[key];
1555 } catch (error) {
1556 /* empty */
1557 }
1558}; // getting tag from ES6+ `Object.prototype.toString`
1559
1560
1561var classof = toStringTagSupport ? classofRaw : function (it) {
1562 var O, tag, result;
1563 return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
1564 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag // builtinTag case
1565 : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback
1566 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
1567};
1568
1569// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
1570
1571
1572var objectToString = toStringTagSupport ? {}.toString : function toString() {
1573 return '[object ' + classof(this) + ']';
1574};
1575
1576var defineProperty$6 = objectDefineProperty.f;
1577var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
1578
1579var setToStringTag = function (it, TAG, STATIC, SET_METHOD) {
1580 if (it) {
1581 var target = STATIC ? it : it.prototype;
1582
1583 if (!has(target, TO_STRING_TAG$2)) {
1584 defineProperty$6(target, TO_STRING_TAG$2, {
1585 configurable: true,
1586 value: TAG
1587 });
1588 }
1589
1590 if (SET_METHOD && !toStringTagSupport) {
1591 createNonEnumerableProperty(target, 'toString', objectToString);
1592 }
1593 }
1594};
1595
1596var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
1597
1598if (typeof sharedStore.inspectSource != 'function') {
1599 sharedStore.inspectSource = function (it) {
1600 return functionToString.call(it);
1601 };
1602}
1603
1604var inspectSource = sharedStore.inspectSource;
1605
1606var WeakMap = global$1.WeakMap;
1607var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
1608
1609var WeakMap$1 = global$1.WeakMap;
1610var set, get, has$1;
1611
1612var enforce = function (it) {
1613 return has$1(it) ? get(it) : set(it, {});
1614};
1615
1616var getterFor = function (TYPE) {
1617 return function (it) {
1618 var state;
1619
1620 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1621 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1622 }
1623
1624 return state;
1625 };
1626};
1627
1628if (nativeWeakMap) {
1629 var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1());
1630 var wmget = store$1.get;
1631 var wmhas = store$1.has;
1632 var wmset = store$1.set;
1633
1634 set = function (it, metadata) {
1635 metadata.facade = it;
1636 wmset.call(store$1, it, metadata);
1637 return metadata;
1638 };
1639
1640 get = function (it) {
1641 return wmget.call(store$1, it) || {};
1642 };
1643
1644 has$1 = function (it) {
1645 return wmhas.call(store$1, it);
1646 };
1647} else {
1648 var STATE = sharedKey('state');
1649 hiddenKeys[STATE] = true;
1650
1651 set = function (it, metadata) {
1652 metadata.facade = it;
1653 createNonEnumerableProperty(it, STATE, metadata);
1654 return metadata;
1655 };
1656
1657 get = function (it) {
1658 return has(it, STATE) ? it[STATE] : {};
1659 };
1660
1661 has$1 = function (it) {
1662 return has(it, STATE);
1663 };
1664}
1665
1666var internalState = {
1667 set: set,
1668 get: get,
1669 has: has$1,
1670 enforce: enforce,
1671 getterFor: getterFor
1672};
1673
1674var $forEach = arrayIteration.forEach;
1675var HIDDEN = sharedKey('hidden');
1676var SYMBOL = 'Symbol';
1677var PROTOTYPE$1 = 'prototype';
1678var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
1679var setInternalState = internalState.set;
1680var getInternalState = internalState.getterFor(SYMBOL);
1681var ObjectPrototype = Object[PROTOTYPE$1];
1682var $Symbol = global$1.Symbol;
1683var $stringify = getBuiltIn('JSON', 'stringify');
1684var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1685var nativeDefineProperty$1 = objectDefineProperty.f;
1686var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
1687var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
1688var AllSymbols = shared('symbols');
1689var ObjectPrototypeSymbols = shared('op-symbols');
1690var StringToSymbolRegistry = shared('string-to-symbol-registry');
1691var SymbolToStringRegistry = shared('symbol-to-string-registry');
1692var WellKnownSymbolsStore$1 = shared('wks');
1693var QObject = global$1.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
1694
1695var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
1696
1697var setSymbolDescriptor = descriptors && fails(function () {
1698 return objectCreate(nativeDefineProperty$1({}, 'a', {
1699 get: function () {
1700 return nativeDefineProperty$1(this, 'a', {
1701 value: 7
1702 }).a;
1703 }
1704 })).a != 7;
1705}) ? function (O, P, Attributes) {
1706 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2(ObjectPrototype, P);
1707 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
1708 nativeDefineProperty$1(O, P, Attributes);
1709
1710 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
1711 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
1712 }
1713} : nativeDefineProperty$1;
1714
1715var wrap = function (tag, description) {
1716 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
1717 setInternalState(symbol, {
1718 type: SYMBOL,
1719 tag: tag,
1720 description: description
1721 });
1722 if (!descriptors) symbol.description = description;
1723 return symbol;
1724};
1725
1726var isSymbol = useSymbolAsUid ? function (it) {
1727 return typeof it == 'symbol';
1728} : function (it) {
1729 return Object(it) instanceof $Symbol;
1730};
1731
1732var $defineProperty = function defineProperty(O, P, Attributes) {
1733 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
1734 anObject(O);
1735 var key = toPrimitive(P, true);
1736 anObject(Attributes);
1737
1738 if (has(AllSymbols, key)) {
1739 if (!Attributes.enumerable) {
1740 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
1741 O[HIDDEN][key] = true;
1742 } else {
1743 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
1744 Attributes = objectCreate(Attributes, {
1745 enumerable: createPropertyDescriptor(0, false)
1746 });
1747 }
1748
1749 return setSymbolDescriptor(O, key, Attributes);
1750 }
1751
1752 return nativeDefineProperty$1(O, key, Attributes);
1753};
1754
1755var $defineProperties = function defineProperties(O, Properties) {
1756 anObject(O);
1757 var properties = toIndexedObject(Properties);
1758 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
1759 $forEach(keys, function (key) {
1760 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
1761 });
1762 return O;
1763};
1764
1765var $create = function create(O, Properties) {
1766 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
1767};
1768
1769var $propertyIsEnumerable = function propertyIsEnumerable(V) {
1770 var P = toPrimitive(V, true);
1771 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
1772 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
1773 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
1774};
1775
1776var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
1777 var it = toIndexedObject(O);
1778 var key = toPrimitive(P, true);
1779 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
1780 var descriptor = nativeGetOwnPropertyDescriptor$2(it, key);
1781
1782 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
1783 descriptor.enumerable = true;
1784 }
1785
1786 return descriptor;
1787};
1788
1789var $getOwnPropertyNames = function getOwnPropertyNames(O) {
1790 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
1791 var result = [];
1792 $forEach(names, function (key) {
1793 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
1794 });
1795 return result;
1796};
1797
1798var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
1799 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
1800 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
1801 var result = [];
1802 $forEach(names, function (key) {
1803 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
1804 result.push(AllSymbols[key]);
1805 }
1806 });
1807 return result;
1808}; // `Symbol` constructor
1809// https://tc39.github.io/ecma262/#sec-symbol-constructor
1810
1811
1812if (!nativeSymbol) {
1813 $Symbol = function Symbol() {
1814 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
1815 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
1816 var tag = uid(description);
1817
1818 var setter = function (value) {
1819 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
1820 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
1821 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
1822 };
1823
1824 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {
1825 configurable: true,
1826 set: setter
1827 });
1828 return wrap(tag, description);
1829 };
1830
1831 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
1832 return getInternalState(this).tag;
1833 });
1834 redefine($Symbol, 'withoutSetter', function (description) {
1835 return wrap(uid(description), description);
1836 });
1837 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
1838 objectDefineProperty.f = $defineProperty;
1839 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
1840 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
1841 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
1842
1843 wellKnownSymbolWrapped.f = function (name) {
1844 return wrap(wellKnownSymbol(name), name);
1845 };
1846
1847 if (descriptors) {
1848 // https://github.com/tc39/proposal-Symbol-description
1849 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
1850 configurable: true,
1851 get: function description() {
1852 return getInternalState(this).description;
1853 }
1854 });
1855 }
1856}
1857
1858_export({
1859 global: true,
1860 wrap: true,
1861 forced: !nativeSymbol,
1862 sham: !nativeSymbol
1863}, {
1864 Symbol: $Symbol
1865});
1866$forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {
1867 defineWellKnownSymbol(name);
1868});
1869_export({
1870 target: SYMBOL,
1871 stat: true,
1872 forced: !nativeSymbol
1873}, {
1874 // `Symbol.for` method
1875 // https://tc39.github.io/ecma262/#sec-symbol.for
1876 'for': function (key) {
1877 var string = String(key);
1878 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
1879 var symbol = $Symbol(string);
1880 StringToSymbolRegistry[string] = symbol;
1881 SymbolToStringRegistry[symbol] = string;
1882 return symbol;
1883 },
1884 // `Symbol.keyFor` method
1885 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
1886 keyFor: function keyFor(sym) {
1887 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
1888 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
1889 },
1890 useSetter: function () {
1891 USE_SETTER = true;
1892 },
1893 useSimple: function () {
1894 USE_SETTER = false;
1895 }
1896});
1897_export({
1898 target: 'Object',
1899 stat: true,
1900 forced: !nativeSymbol,
1901 sham: !descriptors
1902}, {
1903 // `Object.create` method
1904 // https://tc39.github.io/ecma262/#sec-object.create
1905 create: $create,
1906 // `Object.defineProperty` method
1907 // https://tc39.github.io/ecma262/#sec-object.defineproperty
1908 defineProperty: $defineProperty,
1909 // `Object.defineProperties` method
1910 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1911 defineProperties: $defineProperties,
1912 // `Object.getOwnPropertyDescriptor` method
1913 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1914 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
1915});
1916_export({
1917 target: 'Object',
1918 stat: true,
1919 forced: !nativeSymbol
1920}, {
1921 // `Object.getOwnPropertyNames` method
1922 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1923 getOwnPropertyNames: $getOwnPropertyNames,
1924 // `Object.getOwnPropertySymbols` method
1925 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
1926 getOwnPropertySymbols: $getOwnPropertySymbols
1927}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
1928// https://bugs.chromium.org/p/v8/issues/detail?id=3443
1929
1930_export({
1931 target: 'Object',
1932 stat: true,
1933 forced: fails(function () {
1934 objectGetOwnPropertySymbols.f(1);
1935 })
1936}, {
1937 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
1938 return objectGetOwnPropertySymbols.f(toObject(it));
1939 }
1940}); // `JSON.stringify` method behavior with symbols
1941// https://tc39.github.io/ecma262/#sec-json.stringify
1942
1943if ($stringify) {
1944 var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
1945 var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {}
1946
1947 return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
1948 || $stringify({
1949 a: symbol
1950 }) != '{}' // V8 throws on boxed symbols
1951 || $stringify(Object(symbol)) != '{}';
1952 });
1953 _export({
1954 target: 'JSON',
1955 stat: true,
1956 forced: FORCED_JSON_STRINGIFY
1957 }, {
1958 // eslint-disable-next-line no-unused-vars
1959 stringify: function stringify(it, replacer, space) {
1960 var args = [it];
1961 var index = 1;
1962 var $replacer;
1963
1964 while (arguments.length > index) args.push(arguments[index++]);
1965
1966 $replacer = replacer;
1967 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1968
1969 if (!isArray(replacer)) replacer = function (key, value) {
1970 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1971 if (!isSymbol(value)) return value;
1972 };
1973 args[1] = replacer;
1974 return $stringify.apply(null, args);
1975 }
1976 });
1977} // `Symbol.prototype[@@toPrimitive]` method
1978// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1979
1980
1981if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
1982 createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1983} // `Symbol.prototype[@@toStringTag]` property
1984// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1985
1986
1987setToStringTag($Symbol, SYMBOL);
1988hiddenKeys[HIDDEN] = true;
1989
1990var getOwnPropertySymbols = path.Object.getOwnPropertySymbols;
1991
1992var getOwnPropertySymbols$1 = getOwnPropertySymbols;
1993
1994var getOwnPropertySymbols$2 = getOwnPropertySymbols$1;
1995
1996var iterators = {};
1997
1998var correctPrototypeGetter = !fails(function () {
1999 function F() {
2000 /* empty */
2001 }
2002
2003 F.prototype.constructor = null;
2004 return Object.getPrototypeOf(new F()) !== F.prototype;
2005});
2006
2007var IE_PROTO$1 = sharedKey('IE_PROTO');
2008var ObjectPrototype$1 = Object.prototype; // `Object.getPrototypeOf` method
2009// https://tc39.github.io/ecma262/#sec-object.getprototypeof
2010
2011var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
2012 O = toObject(O);
2013 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
2014
2015 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
2016 return O.constructor.prototype;
2017 }
2018
2019 return O instanceof Object ? ObjectPrototype$1 : null;
2020};
2021
2022var ITERATOR = wellKnownSymbol('iterator');
2023var BUGGY_SAFARI_ITERATORS = false;
2024// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
2025
2026
2027var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
2028
2029if ([].keys) {
2030 arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`
2031
2032 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {
2033 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
2034 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
2035 }
2036}
2037
2038if (IteratorPrototype == undefined) IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
2039
2040var iteratorsCore = {
2041 IteratorPrototype: IteratorPrototype,
2042 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
2043};
2044
2045var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
2046
2047var returnThis = function () {
2048 return this;
2049};
2050
2051var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
2052 var TO_STRING_TAG = NAME + ' Iterator';
2053 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
2054 next: createPropertyDescriptor(1, next)
2055 });
2056 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
2057 iterators[TO_STRING_TAG] = returnThis;
2058 return IteratorConstructor;
2059};
2060
2061var aPossiblePrototype = function (it) {
2062 if (!isObject(it) && it !== null) {
2063 throw TypeError("Can't set " + String(it) + ' as a prototype');
2064 }
2065
2066 return it;
2067};
2068
2069// https://tc39.github.io/ecma262/#sec-object.setprototypeof
2070// Works with __proto__ only. Old v8 can't work with null proto objects.
2071
2072/* eslint-disable no-proto */
2073
2074var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
2075 var CORRECT_SETTER = false;
2076 var test = {};
2077 var setter;
2078
2079 try {
2080 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
2081 setter.call(test, []);
2082 CORRECT_SETTER = test instanceof Array;
2083 } catch (error) {
2084 /* empty */
2085 }
2086
2087 return function setPrototypeOf(O, proto) {
2088 anObject(O);
2089 aPossiblePrototype(proto);
2090 if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
2091 return O;
2092 };
2093}() : undefined);
2094
2095var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
2096var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
2097var ITERATOR$1 = wellKnownSymbol('iterator');
2098var KEYS = 'keys';
2099var VALUES = 'values';
2100var ENTRIES = 'entries';
2101
2102var returnThis$1 = function () {
2103 return this;
2104};
2105
2106var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
2107 createIteratorConstructor(IteratorConstructor, NAME, next);
2108
2109 var getIterationMethod = function (KIND) {
2110 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
2111 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
2112
2113 switch (KIND) {
2114 case KEYS:
2115 return function keys() {
2116 return new IteratorConstructor(this, KIND);
2117 };
2118
2119 case VALUES:
2120 return function values() {
2121 return new IteratorConstructor(this, KIND);
2122 };
2123
2124 case ENTRIES:
2125 return function entries() {
2126 return new IteratorConstructor(this, KIND);
2127 };
2128 }
2129
2130 return function () {
2131 return new IteratorConstructor(this);
2132 };
2133 };
2134
2135 var TO_STRING_TAG = NAME + ' Iterator';
2136 var INCORRECT_VALUES_NAME = false;
2137 var IterablePrototype = Iterable.prototype;
2138 var nativeIterator = IterablePrototype[ITERATOR$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
2139 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
2140 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
2141 var CurrentIteratorPrototype, methods, KEY; // fix native
2142
2143 if (anyNativeIterator) {
2144 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
2145
2146 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
2147
2148
2149 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
2150 iterators[TO_STRING_TAG] = returnThis$1;
2151 }
2152 } // fix Array#{values, @@iterator}.name in V8 / FF
2153
2154
2155 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
2156 INCORRECT_VALUES_NAME = true;
2157
2158 defaultIterator = function values() {
2159 return nativeIterator.call(this);
2160 };
2161 } // define iterator
2162
2163
2164 if (( FORCED) && IterablePrototype[ITERATOR$1] !== defaultIterator) {
2165 createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
2166 }
2167
2168 iterators[NAME] = defaultIterator; // export additional methods
2169
2170 if (DEFAULT) {
2171 methods = {
2172 values: getIterationMethod(VALUES),
2173 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
2174 entries: getIterationMethod(ENTRIES)
2175 };
2176 if (FORCED) for (KEY in methods) {
2177 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
2178 redefine(IterablePrototype, KEY, methods[KEY]);
2179 }
2180 } else _export({
2181 target: NAME,
2182 proto: true,
2183 forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME
2184 }, methods);
2185 }
2186
2187 return methods;
2188};
2189
2190var ARRAY_ITERATOR = 'Array Iterator';
2191var setInternalState$1 = internalState.set;
2192var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method
2193// https://tc39.github.io/ecma262/#sec-array.prototype.entries
2194// `Array.prototype.keys` method
2195// https://tc39.github.io/ecma262/#sec-array.prototype.keys
2196// `Array.prototype.values` method
2197// https://tc39.github.io/ecma262/#sec-array.prototype.values
2198// `Array.prototype[@@iterator]` method
2199// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
2200// `CreateArrayIterator` internal method
2201// https://tc39.github.io/ecma262/#sec-createarrayiterator
2202
2203var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
2204 setInternalState$1(this, {
2205 type: ARRAY_ITERATOR,
2206 target: toIndexedObject(iterated),
2207 // target
2208 index: 0,
2209 // next index
2210 kind: kind // kind
2211
2212 }); // `%ArrayIteratorPrototype%.next` method
2213 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
2214}, function () {
2215 var state = getInternalState$1(this);
2216 var target = state.target;
2217 var kind = state.kind;
2218 var index = state.index++;
2219
2220 if (!target || index >= target.length) {
2221 state.target = undefined;
2222 return {
2223 value: undefined,
2224 done: true
2225 };
2226 }
2227
2228 if (kind == 'keys') return {
2229 value: index,
2230 done: false
2231 };
2232 if (kind == 'values') return {
2233 value: target[index],
2234 done: false
2235 };
2236 return {
2237 value: [index, target[index]],
2238 done: false
2239 };
2240}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
2241// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
2242// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
2243
2244iterators.Arguments = iterators.Array; // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
2245
2246// iterable DOM collections
2247// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2248var domIterables = {
2249 CSSRuleList: 0,
2250 CSSStyleDeclaration: 0,
2251 CSSValueList: 0,
2252 ClientRectList: 0,
2253 DOMRectList: 0,
2254 DOMStringList: 0,
2255 DOMTokenList: 1,
2256 DataTransferItemList: 0,
2257 FileList: 0,
2258 HTMLAllCollection: 0,
2259 HTMLCollection: 0,
2260 HTMLFormElement: 0,
2261 HTMLSelectElement: 0,
2262 MediaList: 0,
2263 MimeTypeArray: 0,
2264 NamedNodeMap: 0,
2265 NodeList: 1,
2266 PaintRequestList: 0,
2267 Plugin: 0,
2268 PluginArray: 0,
2269 SVGLengthList: 0,
2270 SVGNumberList: 0,
2271 SVGPathSegList: 0,
2272 SVGPointList: 0,
2273 SVGStringList: 0,
2274 SVGTransformList: 0,
2275 SourceBufferList: 0,
2276 StyleSheetList: 0,
2277 TextTrackCueList: 0,
2278 TextTrackList: 0,
2279 TouchList: 0
2280};
2281
2282var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
2283
2284for (var COLLECTION_NAME in domIterables) {
2285 var Collection = global$1[COLLECTION_NAME];
2286 var CollectionPrototype = Collection && Collection.prototype;
2287
2288 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG$3) {
2289 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$3, COLLECTION_NAME);
2290 }
2291
2292 iterators[COLLECTION_NAME] = iterators.Array;
2293}
2294
2295var createMethod$3 = function (CONVERT_TO_STRING) {
2296 return function ($this, pos) {
2297 var S = String(requireObjectCoercible($this));
2298 var position = toInteger(pos);
2299 var size = S.length;
2300 var first, second;
2301 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
2302 first = S.charCodeAt(position);
2303 return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
2304 };
2305};
2306
2307var stringMultibyte = {
2308 // `String.prototype.codePointAt` method
2309 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
2310 codeAt: createMethod$3(false),
2311 // `String.prototype.at` method
2312 // https://github.com/mathiasbynens/String.prototype.at
2313 charAt: createMethod$3(true)
2314};
2315
2316var charAt = stringMultibyte.charAt;
2317var STRING_ITERATOR = 'String Iterator';
2318var setInternalState$2 = internalState.set;
2319var getInternalState$2 = internalState.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method
2320// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
2321
2322defineIterator(String, 'String', function (iterated) {
2323 setInternalState$2(this, {
2324 type: STRING_ITERATOR,
2325 string: String(iterated),
2326 index: 0
2327 }); // `%StringIteratorPrototype%.next` method
2328 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
2329}, function next() {
2330 var state = getInternalState$2(this);
2331 var string = state.string;
2332 var index = state.index;
2333 var point;
2334 if (index >= string.length) return {
2335 value: undefined,
2336 done: true
2337 };
2338 point = charAt(string, index);
2339 state.index += point.length;
2340 return {
2341 value: point,
2342 done: false
2343 };
2344});
2345
2346var ITERATOR$2 = wellKnownSymbol('iterator');
2347
2348var getIteratorMethod = function (it) {
2349 if (it != undefined) return it[ITERATOR$2] || it['@@iterator'] || iterators[classof(it)];
2350};
2351
2352var getIterator = function (it) {
2353 var iteratorMethod = getIteratorMethod(it);
2354
2355 if (typeof iteratorMethod != 'function') {
2356 throw TypeError(String(it) + ' is not iterable');
2357 }
2358
2359 return anObject(iteratorMethod.call(it));
2360};
2361
2362var getIterator_1 = getIterator;
2363
2364var getIterator$1 = getIterator_1;
2365
2366var getIteratorMethod_1 = getIteratorMethod;
2367
2368var getIteratorMethod$1 = getIteratorMethod_1;
2369
2370var iteratorClose = function (iterator) {
2371 var returnMethod = iterator['return'];
2372
2373 if (returnMethod !== undefined) {
2374 return anObject(returnMethod.call(iterator)).value;
2375 }
2376};
2377
2378var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
2379 try {
2380 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
2381 } catch (error) {
2382 iteratorClose(iterator);
2383 throw error;
2384 }
2385};
2386
2387var ITERATOR$3 = wellKnownSymbol('iterator');
2388var ArrayPrototype$4 = Array.prototype; // check on default Array iterator
2389
2390var isArrayIteratorMethod = function (it) {
2391 return it !== undefined && (iterators.Array === it || ArrayPrototype$4[ITERATOR$3] === it);
2392};
2393
2394// https://tc39.github.io/ecma262/#sec-array.from
2395
2396
2397var arrayFrom = function from(arrayLike
2398/* , mapfn = undefined, thisArg = undefined */
2399) {
2400 var O = toObject(arrayLike);
2401 var C = typeof this == 'function' ? this : Array;
2402 var argumentsLength = arguments.length;
2403 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
2404 var mapping = mapfn !== undefined;
2405 var iteratorMethod = getIteratorMethod(O);
2406 var index = 0;
2407 var length, result, step, iterator, next, value;
2408 if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case
2409
2410 if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
2411 iterator = iteratorMethod.call(O);
2412 next = iterator.next;
2413 result = new C();
2414
2415 for (; !(step = next.call(iterator)).done; index++) {
2416 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
2417 createProperty(result, index, value);
2418 }
2419 } else {
2420 length = toLength(O.length);
2421 result = new C(length);
2422
2423 for (; length > index; index++) {
2424 value = mapping ? mapfn(O[index], index) : O[index];
2425 createProperty(result, index, value);
2426 }
2427 }
2428
2429 result.length = index;
2430 return result;
2431};
2432
2433var ITERATOR$4 = wellKnownSymbol('iterator');
2434var SAFE_CLOSING = false;
2435
2436try {
2437 var called = 0;
2438 var iteratorWithReturn = {
2439 next: function () {
2440 return {
2441 done: !!called++
2442 };
2443 },
2444 'return': function () {
2445 SAFE_CLOSING = true;
2446 }
2447 };
2448
2449 iteratorWithReturn[ITERATOR$4] = function () {
2450 return this;
2451 }; // eslint-disable-next-line no-throw-literal
2452
2453
2454 Array.from(iteratorWithReturn, function () {
2455 throw 2;
2456 });
2457} catch (error) {
2458 /* empty */
2459}
2460
2461var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
2462 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2463 var ITERATION_SUPPORT = false;
2464
2465 try {
2466 var object = {};
2467
2468 object[ITERATOR$4] = function () {
2469 return {
2470 next: function () {
2471 return {
2472 done: ITERATION_SUPPORT = true
2473 };
2474 }
2475 };
2476 };
2477
2478 exec(object);
2479 } catch (error) {
2480 /* empty */
2481 }
2482
2483 return ITERATION_SUPPORT;
2484};
2485
2486var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
2487 Array.from(iterable);
2488}); // `Array.from` method
2489// https://tc39.github.io/ecma262/#sec-array.from
2490
2491_export({
2492 target: 'Array',
2493 stat: true,
2494 forced: INCORRECT_ITERATION
2495}, {
2496 from: arrayFrom
2497});
2498
2499var from = path.Array.from;
2500
2501var from$1 = from;
2502
2503var from$2 = from$1;
2504
2505// https://tc39.github.io/ecma262/#sec-array.prototype.fill
2506
2507
2508var arrayFill = function fill(value
2509/* , start = 0, end = @length */
2510) {
2511 var O = toObject(this);
2512 var length = toLength(O.length);
2513 var argumentsLength = arguments.length;
2514 var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
2515 var end = argumentsLength > 2 ? arguments[2] : undefined;
2516 var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
2517
2518 while (endPos > index) O[index++] = value;
2519
2520 return O;
2521};
2522
2523// https://tc39.github.io/ecma262/#sec-array.prototype.fill
2524
2525_export({
2526 target: 'Array',
2527 proto: true
2528}, {
2529 fill: arrayFill
2530}); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
2531
2532var fill = entryVirtual('Array').fill;
2533
2534var slice$1 = [].slice;
2535var MSIE = /MSIE .\./.test(engineUserAgent); // <- dirty ie9- check
2536
2537var wrap$1 = function (scheduler) {
2538 return function (handler, timeout
2539 /* , ...arguments */
2540 ) {
2541 var boundArgs = arguments.length > 2;
2542 var args = boundArgs ? slice$1.call(arguments, 2) : undefined;
2543 return scheduler(boundArgs ? function () {
2544 // eslint-disable-next-line no-new-func
2545 (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
2546 } : handler, timeout);
2547 };
2548}; // ie9- setTimeout & setInterval additional parameters fix
2549// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
2550
2551
2552_export({
2553 global: true,
2554 bind: true,
2555 forced: MSIE
2556}, {
2557 // `setTimeout` method
2558 // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
2559 setTimeout: wrap$1(global$1.setTimeout),
2560 // `setInterval` method
2561 // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
2562 setInterval: wrap$1(global$1.setInterval)
2563});
2564
2565var setTimeout$1 = path.setTimeout;
2566
2567var setTimeout$2 = setTimeout$1;
2568
2569var $stringify$1 = getBuiltIn('JSON', 'stringify');
2570var re = /[\uD800-\uDFFF]/g;
2571var low = /^[\uD800-\uDBFF]$/;
2572var hi = /^[\uDC00-\uDFFF]$/;
2573
2574var fix = function (match, offset, string) {
2575 var prev = string.charAt(offset - 1);
2576 var next = string.charAt(offset + 1);
2577
2578 if (low.test(match) && !hi.test(next) || hi.test(match) && !low.test(prev)) {
2579 return '\\u' + match.charCodeAt(0).toString(16);
2580 }
2581
2582 return match;
2583};
2584
2585var FORCED$1 = fails(function () {
2586 return $stringify$1('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify$1('\uDEAD') !== '"\\udead"';
2587});
2588
2589if ($stringify$1) {
2590 // https://github.com/tc39/proposal-well-formed-stringify
2591 _export({
2592 target: 'JSON',
2593 stat: true,
2594 forced: FORCED$1
2595 }, {
2596 // eslint-disable-next-line no-unused-vars
2597 stringify: function stringify(it, replacer, space) {
2598 var result = $stringify$1.apply(null, arguments);
2599 return typeof result == 'string' ? result.replace(re, fix) : result;
2600 }
2601 });
2602}
2603
2604if (!path.JSON) path.JSON = {
2605 stringify: JSON.stringify
2606}; // eslint-disable-next-line no-unused-vars
2607
2608var stringify = function stringify(it, replacer, space) {
2609 return path.JSON.stringify.apply(null, arguments);
2610};
2611
2612var stringify$1 = stringify;
2613
2614var stringify$2 = stringify$1;
2615
2616// https://tc39.github.io/ecma262/#sec-object.create
2617
2618_export({
2619 target: 'Object',
2620 stat: true,
2621 sham: !descriptors
2622}, {
2623 create: objectCreate
2624});
2625
2626var Object$1 = path.Object;
2627
2628var create = function create(P, D) {
2629 return Object$1.create(P, D);
2630};
2631
2632var create$1 = create;
2633
2634var create$2 = create$1;
2635
2636function _defineProperty(obj, key, value) {
2637 if (key in obj) {
2638 defineProperty$2(obj, key, {
2639 value: value,
2640 enumerable: true,
2641 configurable: true,
2642 writable: true
2643 });
2644 } else {
2645 obj[key] = value;
2646 }
2647
2648 return obj;
2649}
2650
2651var defineProperty$7 = _defineProperty;
2652
2653// a string of all valid unicode whitespaces
2654// eslint-disable-next-line max-len
2655var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
2656
2657var whitespace = '[' + whitespaces + ']';
2658var ltrim = RegExp('^' + whitespace + whitespace + '*');
2659var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
2660
2661var createMethod$4 = function (TYPE) {
2662 return function ($this) {
2663 var string = String(requireObjectCoercible($this));
2664 if (TYPE & 1) string = string.replace(ltrim, '');
2665 if (TYPE & 2) string = string.replace(rtrim, '');
2666 return string;
2667 };
2668};
2669
2670var stringTrim = {
2671 // `String.prototype.{ trimLeft, trimStart }` methods
2672 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
2673 start: createMethod$4(1),
2674 // `String.prototype.{ trimRight, trimEnd }` methods
2675 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
2676 end: createMethod$4(2),
2677 // `String.prototype.trim` method
2678 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
2679 trim: createMethod$4(3)
2680};
2681
2682var non = '\u200B\u0085\u180E'; // check that a method works with the correct list
2683// of whitespaces and has a correct name
2684
2685var stringTrimForced = function (METHOD_NAME) {
2686 return fails(function () {
2687 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
2688 });
2689};
2690
2691var $trim = stringTrim.trim; // `String.prototype.trim` method
2692// https://tc39.github.io/ecma262/#sec-string.prototype.trim
2693
2694_export({
2695 target: 'String',
2696 proto: true,
2697 forced: stringTrimForced('trim')
2698}, {
2699 trim: function trim() {
2700 return $trim(this);
2701 }
2702});
2703
2704var trim = entryVirtual('String').trim;
2705
2706var $indexOf = arrayIncludes.indexOf;
2707var nativeIndexOf = [].indexOf;
2708var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
2709var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
2710var USES_TO_LENGTH$3 = arrayMethodUsesToLength('indexOf', {
2711 ACCESSORS: true,
2712 1: 0
2713}); // `Array.prototype.indexOf` method
2714// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
2715
2716_export({
2717 target: 'Array',
2718 proto: true,
2719 forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$3
2720}, {
2721 indexOf: function indexOf(searchElement
2722 /* , fromIndex = 0 */
2723 ) {
2724 return NEGATIVE_ZERO // convert -0 to +0
2725 ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
2726 }
2727});
2728
2729var indexOf$1 = entryVirtual('Array').indexOf;
2730
2731var trim$1 = stringTrim.trim;
2732var $parseInt = global$1.parseInt;
2733var hex = /^[+-]?0[Xx]/;
2734var FORCED$2 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; // `parseInt` method
2735// https://tc39.github.io/ecma262/#sec-parseint-string-radix
2736
2737var numberParseInt = FORCED$2 ? function parseInt(string, radix) {
2738 var S = trim$1(String(string));
2739 return $parseInt(S, radix >>> 0 || (hex.test(S) ? 16 : 10));
2740} : $parseInt;
2741
2742// https://tc39.github.io/ecma262/#sec-parseint-string-radix
2743
2744_export({
2745 global: true,
2746 forced: parseInt != numberParseInt
2747}, {
2748 parseInt: numberParseInt
2749});
2750
2751var propertyIsEnumerable = objectPropertyIsEnumerable.f; // `Object.{ entries, values }` methods implementation
2752
2753var createMethod$5 = function (TO_ENTRIES) {
2754 return function (it) {
2755 var O = toIndexedObject(it);
2756 var keys = objectKeys(O);
2757 var length = keys.length;
2758 var i = 0;
2759 var result = [];
2760 var key;
2761
2762 while (length > i) {
2763 key = keys[i++];
2764
2765 if (!descriptors || propertyIsEnumerable.call(O, key)) {
2766 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
2767 }
2768 }
2769
2770 return result;
2771 };
2772};
2773
2774var objectToArray = {
2775 // `Object.entries` method
2776 // https://tc39.github.io/ecma262/#sec-object.entries
2777 entries: createMethod$5(true),
2778 // `Object.values` method
2779 // https://tc39.github.io/ecma262/#sec-object.values
2780 values: createMethod$5(false)
2781};
2782
2783var $values = objectToArray.values; // `Object.values` method
2784// https://tc39.github.io/ecma262/#sec-object.values
2785
2786_export({
2787 target: 'Object',
2788 stat: true
2789}, {
2790 values: function values(O) {
2791 return $values(O);
2792 }
2793});
2794
2795var values = path.Object.values;
2796
2797var FAILS_ON_PRIMITIVES$1 = fails(function () {
2798 objectGetPrototypeOf(1);
2799}); // `Object.getPrototypeOf` method
2800// https://tc39.github.io/ecma262/#sec-object.getprototypeof
2801
2802_export({
2803 target: 'Object',
2804 stat: true,
2805 forced: FAILS_ON_PRIMITIVES$1,
2806 sham: !correctPrototypeGetter
2807}, {
2808 getPrototypeOf: function getPrototypeOf(it) {
2809 return objectGetPrototypeOf(toObject(it));
2810 }
2811});
2812
2813var getPrototypeOf = path.Object.getPrototypeOf;
2814
2815var $includes = arrayIncludes.includes;
2816var USES_TO_LENGTH$4 = arrayMethodUsesToLength('indexOf', {
2817 ACCESSORS: true,
2818 1: 0
2819}); // `Array.prototype.includes` method
2820// https://tc39.github.io/ecma262/#sec-array.prototype.includes
2821
2822_export({
2823 target: 'Array',
2824 proto: true,
2825 forced: !USES_TO_LENGTH$4
2826}, {
2827 includes: function includes(el
2828 /* , fromIndex = 0 */
2829 ) {
2830 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2831 }
2832}); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
2833
2834var includes = entryVirtual('Array').includes;
2835
2836var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation
2837// https://tc39.github.io/ecma262/#sec-isregexp
2838
2839var isRegexp = function (it) {
2840 var isRegExp;
2841 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
2842};
2843
2844var notARegexp = function (it) {
2845 if (isRegexp(it)) {
2846 throw TypeError("The method doesn't accept regular expressions");
2847 }
2848
2849 return it;
2850};
2851
2852var MATCH$1 = wellKnownSymbol('match');
2853
2854var correctIsRegexpLogic = function (METHOD_NAME) {
2855 var regexp = /./;
2856
2857 try {
2858 '/./'[METHOD_NAME](regexp);
2859 } catch (error1) {
2860 try {
2861 regexp[MATCH$1] = false;
2862 return '/./'[METHOD_NAME](regexp);
2863 } catch (error2) {
2864 /* empty */
2865 }
2866 }
2867
2868 return false;
2869};
2870
2871// https://tc39.github.io/ecma262/#sec-string.prototype.includes
2872
2873
2874_export({
2875 target: 'String',
2876 proto: true,
2877 forced: !correctIsRegexpLogic('includes')
2878}, {
2879 includes: function includes(searchString
2880 /* , position = 0 */
2881 ) {
2882 return !!~String(requireObjectCoercible(this)).indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
2883 }
2884});
2885
2886var includes$1 = entryVirtual('String').includes;
2887
2888var nativeAssign = Object.assign;
2889var defineProperty$8 = Object.defineProperty; // `Object.assign` method
2890// https://tc39.github.io/ecma262/#sec-object.assign
2891
2892var objectAssign = !nativeAssign || fails(function () {
2893 // should have correct order of operations (Edge bug)
2894 if (descriptors && nativeAssign({
2895 b: 1
2896 }, nativeAssign(defineProperty$8({}, 'a', {
2897 enumerable: true,
2898 get: function () {
2899 defineProperty$8(this, 'b', {
2900 value: 3,
2901 enumerable: false
2902 });
2903 }
2904 }), {
2905 b: 2
2906 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug)
2907
2908 var A = {};
2909 var B = {}; // eslint-disable-next-line no-undef
2910
2911 var symbol = Symbol();
2912 var alphabet = 'abcdefghijklmnopqrst';
2913 A[symbol] = 7;
2914 alphabet.split('').forEach(function (chr) {
2915 B[chr] = chr;
2916 });
2917 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
2918}) ? function assign(target, source) {
2919 // eslint-disable-line no-unused-vars
2920 var T = toObject(target);
2921 var argumentsLength = arguments.length;
2922 var index = 1;
2923 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
2924 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
2925
2926 while (argumentsLength > index) {
2927 var S = indexedObject(arguments[index++]);
2928 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
2929 var length = keys.length;
2930 var j = 0;
2931 var key;
2932
2933 while (length > j) {
2934 key = keys[j++];
2935 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
2936 }
2937 }
2938
2939 return T;
2940} : nativeAssign;
2941
2942// https://tc39.github.io/ecma262/#sec-object.assign
2943
2944_export({
2945 target: 'Object',
2946 stat: true,
2947 forced: Object.assign !== objectAssign
2948}, {
2949 assign: objectAssign
2950});
2951
2952var assign = path.Object.assign;
2953
2954var assign$1 = assign;
2955
2956var assign$2 = assign$1;
2957
2958var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('splice');
2959var USES_TO_LENGTH$5 = arrayMethodUsesToLength('splice', {
2960 ACCESSORS: true,
2961 0: 0,
2962 1: 2
2963});
2964var max$1 = Math.max;
2965var min$2 = Math.min;
2966var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
2967var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method
2968// https://tc39.github.io/ecma262/#sec-array.prototype.splice
2969// with adding support of @@species
2970
2971_export({
2972 target: 'Array',
2973 proto: true,
2974 forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$5
2975}, {
2976 splice: function splice(start, deleteCount
2977 /* , ...items */
2978 ) {
2979 var O = toObject(this);
2980 var len = toLength(O.length);
2981 var actualStart = toAbsoluteIndex(start, len);
2982 var argumentsLength = arguments.length;
2983 var insertCount, actualDeleteCount, A, k, from, to;
2984
2985 if (argumentsLength === 0) {
2986 insertCount = actualDeleteCount = 0;
2987 } else if (argumentsLength === 1) {
2988 insertCount = 0;
2989 actualDeleteCount = len - actualStart;
2990 } else {
2991 insertCount = argumentsLength - 2;
2992 actualDeleteCount = min$2(max$1(toInteger(deleteCount), 0), len - actualStart);
2993 }
2994
2995 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
2996 throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
2997 }
2998
2999 A = arraySpeciesCreate(O, actualDeleteCount);
3000
3001 for (k = 0; k < actualDeleteCount; k++) {
3002 from = actualStart + k;
3003 if (from in O) createProperty(A, k, O[from]);
3004 }
3005
3006 A.length = actualDeleteCount;
3007
3008 if (insertCount < actualDeleteCount) {
3009 for (k = actualStart; k < len - actualDeleteCount; k++) {
3010 from = k + actualDeleteCount;
3011 to = k + insertCount;
3012 if (from in O) O[to] = O[from];else delete O[to];
3013 }
3014
3015 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
3016 } else if (insertCount > actualDeleteCount) {
3017 for (k = len - actualDeleteCount; k > actualStart; k--) {
3018 from = k + actualDeleteCount - 1;
3019 to = k + insertCount - 1;
3020 if (from in O) O[to] = O[from];else delete O[to];
3021 }
3022 }
3023
3024 for (k = 0; k < insertCount; k++) {
3025 O[k + actualStart] = arguments[k + 2];
3026 }
3027
3028 O.length = len - actualDeleteCount + insertCount;
3029 return A;
3030 }
3031});
3032
3033var splice = entryVirtual('Array').splice;
3034
3035var ArrayPrototype$5 = Array.prototype;
3036
3037var splice_1 = function (it) {
3038 var own = it.splice;
3039 return it === ArrayPrototype$5 || it instanceof Array && own === ArrayPrototype$5.splice ? splice : own;
3040};
3041
3042var splice$1 = splice_1;
3043
3044var splice$2 = splice$1;
3045
3046var nativeReverse = [].reverse;
3047var test$1 = [1, 2]; // `Array.prototype.reverse` method
3048// https://tc39.github.io/ecma262/#sec-array.prototype.reverse
3049// fix for Safari 12.0 bug
3050// https://bugs.webkit.org/show_bug.cgi?id=188794
3051
3052_export({
3053 target: 'Array',
3054 proto: true,
3055 forced: String(test$1) === String(test$1.reverse())
3056}, {
3057 reverse: function reverse() {
3058 // eslint-disable-next-line no-self-assign
3059 if (isArray(this)) this.length = this.length;
3060 return nativeReverse.call(this);
3061 }
3062});
3063
3064var reverse = entryVirtual('Array').reverse;
3065
3066var ArrayPrototype$6 = Array.prototype;
3067
3068var reverse_1 = function (it) {
3069 var own = it.reverse;
3070 return it === ArrayPrototype$6 || it instanceof Array && own === ArrayPrototype$6.reverse ? reverse : own;
3071};
3072
3073var reverse$1 = reverse_1;
3074
3075var reverse$2 = reverse$1;
3076
3077var $forEach$1 = arrayIteration.forEach;
3078var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
3079var USES_TO_LENGTH$6 = arrayMethodUsesToLength('forEach'); // `Array.prototype.forEach` method implementation
3080// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
3081
3082var arrayForEach = !STRICT_METHOD$2 || !USES_TO_LENGTH$6 ? function forEach(callbackfn
3083/* , thisArg */
3084) {
3085 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
3086} : [].forEach;
3087
3088// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
3089
3090
3091_export({
3092 target: 'Array',
3093 proto: true,
3094 forced: [].forEach != arrayForEach
3095}, {
3096 forEach: arrayForEach
3097});
3098
3099var forEach = entryVirtual('Array').forEach;
3100
3101var forEach$1 = forEach;
3102
3103var ArrayPrototype$7 = Array.prototype;
3104var DOMIterables = {
3105 DOMTokenList: true,
3106 NodeList: true
3107};
3108
3109var forEach_1 = function (it) {
3110 var own = it.forEach;
3111 return it === ArrayPrototype$7 || it instanceof Array && own === ArrayPrototype$7.forEach // eslint-disable-next-line no-prototype-builtins
3112 || DOMIterables.hasOwnProperty(classof(it)) ? forEach$1 : own;
3113};
3114
3115var forEach$2 = forEach_1;
3116
3117// https://tc39.github.io/ecma262/#sec-array.isarray
3118
3119_export({
3120 target: 'Array',
3121 stat: true
3122}, {
3123 isArray: isArray
3124});
3125
3126var isArray$1 = path.Array.isArray;
3127
3128var isArray$2 = isArray$1;
3129
3130var isArray$3 = isArray$2;
3131
3132function _arrayWithHoles(arr) {
3133 if (isArray$3(arr)) return arr;
3134}
3135
3136var arrayWithHoles = _arrayWithHoles;
3137
3138var ITERATOR$5 = wellKnownSymbol('iterator');
3139
3140var isIterable = function (it) {
3141 var O = Object(it);
3142 return O[ITERATOR$5] !== undefined || '@@iterator' in O // eslint-disable-next-line no-prototype-builtins
3143 || iterators.hasOwnProperty(classof(O));
3144};
3145
3146var isIterable_1 = isIterable;
3147
3148var isIterable$1 = isIterable_1;
3149
3150var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
3151var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
3152var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
3153// deoptimization and serious performance degradation
3154// https://github.com/zloirock/core-js/issues/679
3155
3156var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
3157 var array = [];
3158 array[IS_CONCAT_SPREADABLE] = false;
3159 return array.concat()[0] !== array;
3160});
3161var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
3162
3163var isConcatSpreadable = function (O) {
3164 if (!isObject(O)) return false;
3165 var spreadable = O[IS_CONCAT_SPREADABLE];
3166 return spreadable !== undefined ? !!spreadable : isArray(O);
3167};
3168
3169var FORCED$3 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method
3170// https://tc39.github.io/ecma262/#sec-array.prototype.concat
3171// with adding support of @@isConcatSpreadable and @@species
3172
3173_export({
3174 target: 'Array',
3175 proto: true,
3176 forced: FORCED$3
3177}, {
3178 concat: function concat(arg) {
3179 // eslint-disable-line no-unused-vars
3180 var O = toObject(this);
3181 var A = arraySpeciesCreate(O, 0);
3182 var n = 0;
3183 var i, k, length, len, E;
3184
3185 for (i = -1, length = arguments.length; i < length; i++) {
3186 E = i === -1 ? O : arguments[i];
3187
3188 if (isConcatSpreadable(E)) {
3189 len = toLength(E.length);
3190 if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
3191
3192 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
3193 } else {
3194 if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
3195 createProperty(A, n++, E);
3196 }
3197 }
3198
3199 A.length = n;
3200 return A;
3201 }
3202});
3203
3204// https://tc39.github.io/ecma262/#sec-symbol.asynciterator
3205
3206defineWellKnownSymbol('asyncIterator');
3207
3208// https://tc39.github.io/ecma262/#sec-symbol.hasinstance
3209
3210defineWellKnownSymbol('hasInstance');
3211
3212// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable
3213
3214defineWellKnownSymbol('isConcatSpreadable');
3215
3216// https://tc39.github.io/ecma262/#sec-symbol.iterator
3217
3218defineWellKnownSymbol('iterator');
3219
3220// https://tc39.github.io/ecma262/#sec-symbol.match
3221
3222defineWellKnownSymbol('match');
3223
3224defineWellKnownSymbol('matchAll');
3225
3226// https://tc39.github.io/ecma262/#sec-symbol.replace
3227
3228defineWellKnownSymbol('replace');
3229
3230// https://tc39.github.io/ecma262/#sec-symbol.search
3231
3232defineWellKnownSymbol('search');
3233
3234// https://tc39.github.io/ecma262/#sec-symbol.species
3235
3236defineWellKnownSymbol('species');
3237
3238// https://tc39.github.io/ecma262/#sec-symbol.split
3239
3240defineWellKnownSymbol('split');
3241
3242// https://tc39.github.io/ecma262/#sec-symbol.toprimitive
3243
3244defineWellKnownSymbol('toPrimitive');
3245
3246// https://tc39.github.io/ecma262/#sec-symbol.tostringtag
3247
3248defineWellKnownSymbol('toStringTag');
3249
3250// https://tc39.github.io/ecma262/#sec-symbol.unscopables
3251
3252defineWellKnownSymbol('unscopables');
3253
3254// https://tc39.github.io/ecma262/#sec-json-@@tostringtag
3255
3256setToStringTag(global$1.JSON, 'JSON', true);
3257
3258var symbol = path.Symbol;
3259
3260// https://github.com/tc39/proposal-using-statement
3261
3262defineWellKnownSymbol('asyncDispose');
3263
3264// https://github.com/tc39/proposal-using-statement
3265
3266defineWellKnownSymbol('dispose');
3267
3268// https://github.com/tc39/proposal-observable
3269
3270defineWellKnownSymbol('observable');
3271
3272// https://github.com/tc39/proposal-pattern-matching
3273
3274defineWellKnownSymbol('patternMatch');
3275
3276defineWellKnownSymbol('replaceAll');
3277
3278var symbol$1 = symbol;
3279
3280var symbol$2 = symbol$1;
3281
3282function _iterableToArrayLimit(arr, i) {
3283 if (typeof symbol$2 === "undefined" || !isIterable$1(Object(arr))) return;
3284 var _arr = [];
3285 var _n = true;
3286 var _d = false;
3287 var _e = undefined;
3288
3289 try {
3290 for (var _i = getIterator$1(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
3291 _arr.push(_s.value);
3292
3293 if (i && _arr.length === i) break;
3294 }
3295 } catch (err) {
3296 _d = true;
3297 _e = err;
3298 } finally {
3299 try {
3300 if (!_n && _i["return"] != null) _i["return"]();
3301 } finally {
3302 if (_d) throw _e;
3303 }
3304 }
3305
3306 return _arr;
3307}
3308
3309var iterableToArrayLimit = _iterableToArrayLimit;
3310
3311var from$3 = from;
3312
3313var from$4 = from$3;
3314
3315var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('slice');
3316var USES_TO_LENGTH$7 = arrayMethodUsesToLength('slice', {
3317 ACCESSORS: true,
3318 0: 0,
3319 1: 2
3320});
3321var SPECIES$2 = wellKnownSymbol('species');
3322var nativeSlice = [].slice;
3323var max$2 = Math.max; // `Array.prototype.slice` method
3324// https://tc39.github.io/ecma262/#sec-array.prototype.slice
3325// fallback for not array-like ES3 strings and DOM objects
3326
3327_export({
3328 target: 'Array',
3329 proto: true,
3330 forced: !HAS_SPECIES_SUPPORT$3 || !USES_TO_LENGTH$7
3331}, {
3332 slice: function slice(start, end) {
3333 var O = toIndexedObject(this);
3334 var length = toLength(O.length);
3335 var k = toAbsoluteIndex(start, length);
3336 var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
3337
3338 var Constructor, result, n;
3339
3340 if (isArray(O)) {
3341 Constructor = O.constructor; // cross-realm fallback
3342
3343 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
3344 Constructor = undefined;
3345 } else if (isObject(Constructor)) {
3346 Constructor = Constructor[SPECIES$2];
3347 if (Constructor === null) Constructor = undefined;
3348 }
3349
3350 if (Constructor === Array || Constructor === undefined) {
3351 return nativeSlice.call(O, k, fin);
3352 }
3353 }
3354
3355 result = new (Constructor === undefined ? Array : Constructor)(max$2(fin - k, 0));
3356
3357 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
3358
3359 result.length = n;
3360 return result;
3361 }
3362});
3363
3364var slice$2 = entryVirtual('Array').slice;
3365
3366var ArrayPrototype$8 = Array.prototype;
3367
3368var slice_1 = function (it) {
3369 var own = it.slice;
3370 return it === ArrayPrototype$8 || it instanceof Array && own === ArrayPrototype$8.slice ? slice$2 : own;
3371};
3372
3373var slice$3 = slice_1;
3374
3375var slice$4 = slice$3;
3376
3377function _arrayLikeToArray(arr, len) {
3378 if (len == null || len > arr.length) len = arr.length;
3379
3380 for (var i = 0, arr2 = new Array(len); i < len; i++) {
3381 arr2[i] = arr[i];
3382 }
3383
3384 return arr2;
3385}
3386
3387var arrayLikeToArray = _arrayLikeToArray;
3388
3389function _unsupportedIterableToArray(o, minLen) {
3390 var _context;
3391
3392 if (!o) return;
3393 if (typeof o === "string") return arrayLikeToArray(o, minLen);
3394
3395 var n = slice$4(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
3396
3397 if (n === "Object" && o.constructor) n = o.constructor.name;
3398 if (n === "Map" || n === "Set") return from$4(o);
3399 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
3400}
3401
3402var unsupportedIterableToArray = _unsupportedIterableToArray;
3403
3404function _nonIterableRest() {
3405 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3406}
3407
3408var nonIterableRest = _nonIterableRest;
3409
3410function _slicedToArray(arr, i) {
3411 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
3412}
3413
3414var slicedToArray = _slicedToArray;
3415
3416// https://tc39.github.io/ecma262/#sec-date.now
3417
3418_export({
3419 target: 'Date',
3420 stat: true
3421}, {
3422 now: function now() {
3423 return new Date().getTime();
3424 }
3425});
3426
3427var now = path.Date.now;
3428
3429var FAILS_ON_PRIMITIVES$2 = fails(function () {
3430 objectKeys(1);
3431}); // `Object.keys` method
3432// https://tc39.github.io/ecma262/#sec-object.keys
3433
3434_export({
3435 target: 'Object',
3436 stat: true,
3437 forced: FAILS_ON_PRIMITIVES$2
3438}, {
3439 keys: function keys(it) {
3440 return objectKeys(toObject(it));
3441 }
3442});
3443
3444var keys$1 = path.Object.keys;
3445
3446var keys$2 = keys$1;
3447
3448var keys$3 = keys$2;
3449
3450var isArray$4 = isArray$1;
3451
3452var isArray$5 = isArray$4;
3453
3454var iterator = wellKnownSymbolWrapped.f('iterator');
3455
3456var iterator$1 = iterator;
3457
3458var iterator$2 = iterator$1;
3459
3460var _typeof_1 = createCommonjsModule(function (module) {
3461 function _typeof(obj) {
3462 "@babel/helpers - typeof";
3463
3464 if (typeof symbol$2 === "function" && typeof iterator$2 === "symbol") {
3465 module.exports = _typeof = function _typeof(obj) {
3466 return typeof obj;
3467 };
3468 } else {
3469 module.exports = _typeof = function _typeof(obj) {
3470 return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : typeof obj;
3471 };
3472 }
3473
3474 return _typeof(obj);
3475 }
3476
3477 module.exports = _typeof;
3478});
3479
3480// https://tc39.github.io/ecma262/#sec-reflect.ownkeys
3481
3482_export({
3483 target: 'Reflect',
3484 stat: true
3485}, {
3486 ownKeys: ownKeys
3487});
3488
3489var ownKeys$1 = path.Reflect.ownKeys;
3490
3491var ownKeys$2 = ownKeys$1;
3492
3493var ownKeys$3 = ownKeys$2;
3494
3495var slice$5 = slice_1;
3496
3497var slice$6 = slice$5;
3498
3499function _arrayWithoutHoles(arr) {
3500 if (isArray$3(arr)) return arrayLikeToArray(arr);
3501}
3502
3503var arrayWithoutHoles = _arrayWithoutHoles;
3504
3505function _iterableToArray(iter) {
3506 if (typeof symbol$2 !== "undefined" && isIterable$1(Object(iter))) return from$4(iter);
3507}
3508
3509var iterableToArray = _iterableToArray;
3510
3511function _nonIterableSpread() {
3512 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3513}
3514
3515var nonIterableSpread = _nonIterableSpread;
3516
3517function _toConsumableArray(arr) {
3518 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
3519}
3520
3521var toConsumableArray = _toConsumableArray;
3522
3523var concat = entryVirtual('Array').concat;
3524
3525var ArrayPrototype$9 = Array.prototype;
3526
3527var concat_1 = function (it) {
3528 var own = it.concat;
3529 return it === ArrayPrototype$9 || it instanceof Array && own === ArrayPrototype$9.concat ? concat : own;
3530};
3531
3532var concat$1 = concat_1;
3533
3534var concat$2 = concat$1;
3535
3536var symbol$3 = symbol;
3537
3538var symbol$4 = symbol$3;
3539
3540var componentEmitter = createCommonjsModule(function (module) {
3541 /**
3542 * Expose `Emitter`.
3543 */
3544 {
3545 module.exports = Emitter;
3546 }
3547 /**
3548 * Initialize a new `Emitter`.
3549 *
3550 * @api public
3551 */
3552
3553
3554 function Emitter(obj) {
3555 if (obj) return mixin(obj);
3556 }
3557 /**
3558 * Mixin the emitter properties.
3559 *
3560 * @param {Object} obj
3561 * @return {Object}
3562 * @api private
3563 */
3564
3565 function mixin(obj) {
3566 for (var key in Emitter.prototype) {
3567 obj[key] = Emitter.prototype[key];
3568 }
3569
3570 return obj;
3571 }
3572 /**
3573 * Listen on the given `event` with `fn`.
3574 *
3575 * @param {String} event
3576 * @param {Function} fn
3577 * @return {Emitter}
3578 * @api public
3579 */
3580
3581
3582 Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
3583 this._callbacks = this._callbacks || {};
3584 (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
3585 return this;
3586 };
3587 /**
3588 * Adds an `event` listener that will be invoked a single
3589 * time then automatically removed.
3590 *
3591 * @param {String} event
3592 * @param {Function} fn
3593 * @return {Emitter}
3594 * @api public
3595 */
3596
3597
3598 Emitter.prototype.once = function (event, fn) {
3599 function on() {
3600 this.off(event, on);
3601 fn.apply(this, arguments);
3602 }
3603
3604 on.fn = fn;
3605 this.on(event, on);
3606 return this;
3607 };
3608 /**
3609 * Remove the given callback for `event` or all
3610 * registered callbacks.
3611 *
3612 * @param {String} event
3613 * @param {Function} fn
3614 * @return {Emitter}
3615 * @api public
3616 */
3617
3618
3619 Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
3620 this._callbacks = this._callbacks || {}; // all
3621
3622 if (0 == arguments.length) {
3623 this._callbacks = {};
3624 return this;
3625 } // specific event
3626
3627
3628 var callbacks = this._callbacks['$' + event];
3629 if (!callbacks) return this; // remove all handlers
3630
3631 if (1 == arguments.length) {
3632 delete this._callbacks['$' + event];
3633 return this;
3634 } // remove specific handler
3635
3636
3637 var cb;
3638
3639 for (var i = 0; i < callbacks.length; i++) {
3640 cb = callbacks[i];
3641
3642 if (cb === fn || cb.fn === fn) {
3643 callbacks.splice(i, 1);
3644 break;
3645 }
3646 } // Remove event specific arrays for event types that no
3647 // one is subscribed for to avoid memory leak.
3648
3649
3650 if (callbacks.length === 0) {
3651 delete this._callbacks['$' + event];
3652 }
3653
3654 return this;
3655 };
3656 /**
3657 * Emit `event` with the given args.
3658 *
3659 * @param {String} event
3660 * @param {Mixed} ...
3661 * @return {Emitter}
3662 */
3663
3664
3665 Emitter.prototype.emit = function (event) {
3666 this._callbacks = this._callbacks || {};
3667 var args = new Array(arguments.length - 1),
3668 callbacks = this._callbacks['$' + event];
3669
3670 for (var i = 1; i < arguments.length; i++) {
3671 args[i - 1] = arguments[i];
3672 }
3673
3674 if (callbacks) {
3675 callbacks = callbacks.slice(0);
3676
3677 for (var i = 0, len = callbacks.length; i < len; ++i) {
3678 callbacks[i].apply(this, args);
3679 }
3680 }
3681
3682 return this;
3683 };
3684 /**
3685 * Return array of callbacks for `event`.
3686 *
3687 * @param {String} event
3688 * @return {Array}
3689 * @api public
3690 */
3691
3692
3693 Emitter.prototype.listeners = function (event) {
3694 this._callbacks = this._callbacks || {};
3695 return this._callbacks['$' + event] || [];
3696 };
3697 /**
3698 * Check if this emitter has `event` handlers.
3699 *
3700 * @param {String} event
3701 * @return {Boolean}
3702 * @api public
3703 */
3704
3705
3706 Emitter.prototype.hasListeners = function (event) {
3707 return !!this.listeners(event).length;
3708 };
3709});
3710
3711/*! Hammer.JS - v2.0.17-rc - 2019-12-16
3712 * http://naver.github.io/egjs
3713 *
3714 * Forked By Naver egjs
3715 * Copyright (c) hammerjs
3716 * Licensed under the MIT license */
3717function _extends() {
3718 _extends = Object.assign || function (target) {
3719 for (var i = 1; i < arguments.length; i++) {
3720 var source = arguments[i];
3721
3722 for (var key in source) {
3723 if (Object.prototype.hasOwnProperty.call(source, key)) {
3724 target[key] = source[key];
3725 }
3726 }
3727 }
3728
3729 return target;
3730 };
3731
3732 return _extends.apply(this, arguments);
3733}
3734
3735function _inheritsLoose(subClass, superClass) {
3736 subClass.prototype = Object.create(superClass.prototype);
3737 subClass.prototype.constructor = subClass;
3738 subClass.__proto__ = superClass;
3739}
3740
3741function _assertThisInitialized(self) {
3742 if (self === void 0) {
3743 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3744 }
3745
3746 return self;
3747}
3748/**
3749 * @private
3750 * extend object.
3751 * means that properties in dest will be overwritten by the ones in src.
3752 * @param {Object} target
3753 * @param {...Object} objects_to_assign
3754 * @returns {Object} target
3755 */
3756
3757
3758var assign$3;
3759
3760if (typeof Object.assign !== 'function') {
3761 assign$3 = function assign(target) {
3762 if (target === undefined || target === null) {
3763 throw new TypeError('Cannot convert undefined or null to object');
3764 }
3765
3766 var output = Object(target);
3767
3768 for (var index = 1; index < arguments.length; index++) {
3769 var source = arguments[index];
3770
3771 if (source !== undefined && source !== null) {
3772 for (var nextKey in source) {
3773 if (source.hasOwnProperty(nextKey)) {
3774 output[nextKey] = source[nextKey];
3775 }
3776 }
3777 }
3778 }
3779
3780 return output;
3781 };
3782} else {
3783 assign$3 = Object.assign;
3784}
3785
3786var assign$1$1 = assign$3;
3787var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
3788var TEST_ELEMENT = typeof document === "undefined" ? {
3789 style: {}
3790} : document.createElement('div');
3791var TYPE_FUNCTION = 'function';
3792var round = Math.round,
3793 abs = Math.abs;
3794var now$1 = Date.now;
3795/**
3796 * @private
3797 * get the prefixed property
3798 * @param {Object} obj
3799 * @param {String} property
3800 * @returns {String|Undefined} prefixed
3801 */
3802
3803function prefixed(obj, property) {
3804 var prefix;
3805 var prop;
3806 var camelProp = property[0].toUpperCase() + property.slice(1);
3807 var i = 0;
3808
3809 while (i < VENDOR_PREFIXES.length) {
3810 prefix = VENDOR_PREFIXES[i];
3811 prop = prefix ? prefix + camelProp : property;
3812
3813 if (prop in obj) {
3814 return prop;
3815 }
3816
3817 i++;
3818 }
3819
3820 return undefined;
3821}
3822/* eslint-disable no-new-func, no-nested-ternary */
3823
3824
3825var win;
3826
3827if (typeof window === "undefined") {
3828 // window is undefined in node.js
3829 win = {};
3830} else {
3831 win = window;
3832}
3833
3834var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
3835var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
3836
3837function getTouchActionProps() {
3838 if (!NATIVE_TOUCH_ACTION) {
3839 return false;
3840 }
3841
3842 var touchMap = {};
3843 var cssSupports = win.CSS && win.CSS.supports;
3844 ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
3845 // If css.supports is not supported but there is native touch-action assume it supports
3846 // all values. This is the case for IE 10 and 11.
3847 return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;
3848 });
3849 return touchMap;
3850}
3851
3852var TOUCH_ACTION_COMPUTE = 'compute';
3853var TOUCH_ACTION_AUTO = 'auto';
3854var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
3855
3856var TOUCH_ACTION_NONE = 'none';
3857var TOUCH_ACTION_PAN_X = 'pan-x';
3858var TOUCH_ACTION_PAN_Y = 'pan-y';
3859var TOUCH_ACTION_MAP = getTouchActionProps();
3860var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
3861var SUPPORT_TOUCH = ('ontouchstart' in win);
3862var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;
3863var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
3864var INPUT_TYPE_TOUCH = 'touch';
3865var INPUT_TYPE_PEN = 'pen';
3866var INPUT_TYPE_MOUSE = 'mouse';
3867var INPUT_TYPE_KINECT = 'kinect';
3868var COMPUTE_INTERVAL = 25;
3869var INPUT_START = 1;
3870var INPUT_MOVE = 2;
3871var INPUT_END = 4;
3872var INPUT_CANCEL = 8;
3873var DIRECTION_NONE = 1;
3874var DIRECTION_LEFT = 2;
3875var DIRECTION_RIGHT = 4;
3876var DIRECTION_UP = 8;
3877var DIRECTION_DOWN = 16;
3878var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
3879var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
3880var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
3881var PROPS_XY = ['x', 'y'];
3882var PROPS_CLIENT_XY = ['clientX', 'clientY'];
3883/**
3884 * @private
3885 * walk objects and arrays
3886 * @param {Object} obj
3887 * @param {Function} iterator
3888 * @param {Object} context
3889 */
3890
3891function each(obj, iterator, context) {
3892 var i;
3893
3894 if (!obj) {
3895 return;
3896 }
3897
3898 if (obj.forEach) {
3899 obj.forEach(iterator, context);
3900 } else if (obj.length !== undefined) {
3901 i = 0;
3902
3903 while (i < obj.length) {
3904 iterator.call(context, obj[i], i, obj);
3905 i++;
3906 }
3907 } else {
3908 for (i in obj) {
3909 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
3910 }
3911 }
3912}
3913/**
3914 * @private
3915 * let a boolean value also be a function that must return a boolean
3916 * this first item in args will be used as the context
3917 * @param {Boolean|Function} val
3918 * @param {Array} [args]
3919 * @returns {Boolean}
3920 */
3921
3922
3923function boolOrFn(val, args) {
3924 if (typeof val === TYPE_FUNCTION) {
3925 return val.apply(args ? args[0] || undefined : undefined, args);
3926 }
3927
3928 return val;
3929}
3930/**
3931 * @private
3932 * small indexOf wrapper
3933 * @param {String} str
3934 * @param {String} find
3935 * @returns {Boolean} found
3936 */
3937
3938
3939function inStr(str, find) {
3940 return str.indexOf(find) > -1;
3941}
3942/**
3943 * @private
3944 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
3945 * @param {String} actions
3946 * @returns {*}
3947 */
3948
3949
3950function cleanTouchActions(actions) {
3951 // none
3952 if (inStr(actions, TOUCH_ACTION_NONE)) {
3953 return TOUCH_ACTION_NONE;
3954 }
3955
3956 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
3957 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers
3958 // for different directions, e.g. horizontal pan but vertical swipe?)
3959 // we need none (as otherwise with pan-x pan-y combined none of these
3960 // recognizers will work, since the browser would handle all panning
3961
3962 if (hasPanX && hasPanY) {
3963 return TOUCH_ACTION_NONE;
3964 } // pan-x OR pan-y
3965
3966
3967 if (hasPanX || hasPanY) {
3968 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
3969 } // manipulation
3970
3971
3972 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
3973 return TOUCH_ACTION_MANIPULATION;
3974 }
3975
3976 return TOUCH_ACTION_AUTO;
3977}
3978/**
3979 * @private
3980 * Touch Action
3981 * sets the touchAction property or uses the js alternative
3982 * @param {Manager} manager
3983 * @param {String} value
3984 * @constructor
3985 */
3986
3987
3988var TouchAction = /*#__PURE__*/function () {
3989 function TouchAction(manager, value) {
3990 this.manager = manager;
3991 this.set(value);
3992 }
3993 /**
3994 * @private
3995 * set the touchAction value on the element or enable the polyfill
3996 * @param {String} value
3997 */
3998
3999
4000 var _proto = TouchAction.prototype;
4001
4002 _proto.set = function set(value) {
4003 // find out the touch-action by the event handlers
4004 if (value === TOUCH_ACTION_COMPUTE) {
4005 value = this.compute();
4006 }
4007
4008 if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
4009 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
4010 }
4011
4012 this.actions = value.toLowerCase().trim();
4013 };
4014 /**
4015 * @private
4016 * just re-set the touchAction value
4017 */
4018
4019
4020 _proto.update = function update() {
4021 this.set(this.manager.options.touchAction);
4022 };
4023 /**
4024 * @private
4025 * compute the value for the touchAction property based on the recognizer's settings
4026 * @returns {String} value
4027 */
4028
4029
4030 _proto.compute = function compute() {
4031 var actions = [];
4032 each(this.manager.recognizers, function (recognizer) {
4033 if (boolOrFn(recognizer.options.enable, [recognizer])) {
4034 actions = actions.concat(recognizer.getTouchAction());
4035 }
4036 });
4037 return cleanTouchActions(actions.join(' '));
4038 };
4039 /**
4040 * @private
4041 * this method is called on each input cycle and provides the preventing of the browser behavior
4042 * @param {Object} input
4043 */
4044
4045
4046 _proto.preventDefaults = function preventDefaults(input) {
4047 var srcEvent = input.srcEvent;
4048 var direction = input.offsetDirection; // if the touch action did prevented once this session
4049
4050 if (this.manager.session.prevented) {
4051 srcEvent.preventDefault();
4052 return;
4053 }
4054
4055 var actions = this.actions;
4056 var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
4057 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
4058 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
4059
4060 if (hasNone) {
4061 // do not prevent defaults if this is a tap gesture
4062 var isTapPointer = input.pointers.length === 1;
4063 var isTapMovement = input.distance < 2;
4064 var isTapTouchTime = input.deltaTime < 250;
4065
4066 if (isTapPointer && isTapMovement && isTapTouchTime) {
4067 return;
4068 }
4069 }
4070
4071 if (hasPanX && hasPanY) {
4072 // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
4073 return;
4074 }
4075
4076 if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
4077 return this.preventSrc(srcEvent);
4078 }
4079 };
4080 /**
4081 * @private
4082 * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
4083 * @param {Object} srcEvent
4084 */
4085
4086
4087 _proto.preventSrc = function preventSrc(srcEvent) {
4088 this.manager.session.prevented = true;
4089 srcEvent.preventDefault();
4090 };
4091
4092 return TouchAction;
4093}();
4094/**
4095 * @private
4096 * find if a node is in the given parent
4097 * @method hasParent
4098 * @param {HTMLElement} node
4099 * @param {HTMLElement} parent
4100 * @return {Boolean} found
4101 */
4102
4103
4104function hasParent(node, parent) {
4105 while (node) {
4106 if (node === parent) {
4107 return true;
4108 }
4109
4110 node = node.parentNode;
4111 }
4112
4113 return false;
4114}
4115/**
4116 * @private
4117 * get the center of all the pointers
4118 * @param {Array} pointers
4119 * @return {Object} center contains `x` and `y` properties
4120 */
4121
4122
4123function getCenter(pointers) {
4124 var pointersLength = pointers.length; // no need to loop when only one touch
4125
4126 if (pointersLength === 1) {
4127 return {
4128 x: round(pointers[0].clientX),
4129 y: round(pointers[0].clientY)
4130 };
4131 }
4132
4133 var x = 0;
4134 var y = 0;
4135 var i = 0;
4136
4137 while (i < pointersLength) {
4138 x += pointers[i].clientX;
4139 y += pointers[i].clientY;
4140 i++;
4141 }
4142
4143 return {
4144 x: round(x / pointersLength),
4145 y: round(y / pointersLength)
4146 };
4147}
4148/**
4149 * @private
4150 * create a simple clone from the input used for storage of firstInput and firstMultiple
4151 * @param {Object} input
4152 * @returns {Object} clonedInputData
4153 */
4154
4155
4156function simpleCloneInputData(input) {
4157 // make a simple copy of the pointers because we will get a reference if we don't
4158 // we only need clientXY for the calculations
4159 var pointers = [];
4160 var i = 0;
4161
4162 while (i < input.pointers.length) {
4163 pointers[i] = {
4164 clientX: round(input.pointers[i].clientX),
4165 clientY: round(input.pointers[i].clientY)
4166 };
4167 i++;
4168 }
4169
4170 return {
4171 timeStamp: now$1(),
4172 pointers: pointers,
4173 center: getCenter(pointers),
4174 deltaX: input.deltaX,
4175 deltaY: input.deltaY
4176 };
4177}
4178/**
4179 * @private
4180 * calculate the absolute distance between two points
4181 * @param {Object} p1 {x, y}
4182 * @param {Object} p2 {x, y}
4183 * @param {Array} [props] containing x and y keys
4184 * @return {Number} distance
4185 */
4186
4187
4188function getDistance(p1, p2, props) {
4189 if (!props) {
4190 props = PROPS_XY;
4191 }
4192
4193 var x = p2[props[0]] - p1[props[0]];
4194 var y = p2[props[1]] - p1[props[1]];
4195 return Math.sqrt(x * x + y * y);
4196}
4197/**
4198 * @private
4199 * calculate the angle between two coordinates
4200 * @param {Object} p1
4201 * @param {Object} p2
4202 * @param {Array} [props] containing x and y keys
4203 * @return {Number} angle
4204 */
4205
4206
4207function getAngle(p1, p2, props) {
4208 if (!props) {
4209 props = PROPS_XY;
4210 }
4211
4212 var x = p2[props[0]] - p1[props[0]];
4213 var y = p2[props[1]] - p1[props[1]];
4214 return Math.atan2(y, x) * 180 / Math.PI;
4215}
4216/**
4217 * @private
4218 * get the direction between two points
4219 * @param {Number} x
4220 * @param {Number} y
4221 * @return {Number} direction
4222 */
4223
4224
4225function getDirection(x, y) {
4226 if (x === y) {
4227 return DIRECTION_NONE;
4228 }
4229
4230 if (abs(x) >= abs(y)) {
4231 return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
4232 }
4233
4234 return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
4235}
4236
4237function computeDeltaXY(session, input) {
4238 var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;
4239 // jscs throwing error on defalut destructured values and without defaults tests fail
4240
4241 var offset = session.offsetDelta || {};
4242 var prevDelta = session.prevDelta || {};
4243 var prevInput = session.prevInput || {};
4244
4245 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
4246 prevDelta = session.prevDelta = {
4247 x: prevInput.deltaX || 0,
4248 y: prevInput.deltaY || 0
4249 };
4250 offset = session.offsetDelta = {
4251 x: center.x,
4252 y: center.y
4253 };
4254 }
4255
4256 input.deltaX = prevDelta.x + (center.x - offset.x);
4257 input.deltaY = prevDelta.y + (center.y - offset.y);
4258}
4259/**
4260 * @private
4261 * calculate the velocity between two points. unit is in px per ms.
4262 * @param {Number} deltaTime
4263 * @param {Number} x
4264 * @param {Number} y
4265 * @return {Object} velocity `x` and `y`
4266 */
4267
4268
4269function getVelocity(deltaTime, x, y) {
4270 return {
4271 x: x / deltaTime || 0,
4272 y: y / deltaTime || 0
4273 };
4274}
4275/**
4276 * @private
4277 * calculate the scale factor between two pointersets
4278 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
4279 * @param {Array} start array of pointers
4280 * @param {Array} end array of pointers
4281 * @return {Number} scale
4282 */
4283
4284
4285function getScale(start, end) {
4286 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
4287}
4288/**
4289 * @private
4290 * calculate the rotation degrees between two pointersets
4291 * @param {Array} start array of pointers
4292 * @param {Array} end array of pointers
4293 * @return {Number} rotation
4294 */
4295
4296
4297function getRotation(start, end) {
4298 return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
4299}
4300/**
4301 * @private
4302 * velocity is calculated every x ms
4303 * @param {Object} session
4304 * @param {Object} input
4305 */
4306
4307
4308function computeIntervalInputData(session, input) {
4309 var last = session.lastInterval || input;
4310 var deltaTime = input.timeStamp - last.timeStamp;
4311 var velocity;
4312 var velocityX;
4313 var velocityY;
4314 var direction;
4315
4316 if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
4317 var deltaX = input.deltaX - last.deltaX;
4318 var deltaY = input.deltaY - last.deltaY;
4319 var v = getVelocity(deltaTime, deltaX, deltaY);
4320 velocityX = v.x;
4321 velocityY = v.y;
4322 velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
4323 direction = getDirection(deltaX, deltaY);
4324 session.lastInterval = input;
4325 } else {
4326 // use latest velocity info if it doesn't overtake a minimum period
4327 velocity = last.velocity;
4328 velocityX = last.velocityX;
4329 velocityY = last.velocityY;
4330 direction = last.direction;
4331 }
4332
4333 input.velocity = velocity;
4334 input.velocityX = velocityX;
4335 input.velocityY = velocityY;
4336 input.direction = direction;
4337}
4338/**
4339* @private
4340 * extend the data with some usable properties like scale, rotate, velocity etc
4341 * @param {Object} manager
4342 * @param {Object} input
4343 */
4344
4345
4346function computeInputData(manager, input) {
4347 var session = manager.session;
4348 var pointers = input.pointers;
4349 var pointersLength = pointers.length; // store the first input to calculate the distance and direction
4350
4351 if (!session.firstInput) {
4352 session.firstInput = simpleCloneInputData(input);
4353 } // to compute scale and rotation we need to store the multiple touches
4354
4355
4356 if (pointersLength > 1 && !session.firstMultiple) {
4357 session.firstMultiple = simpleCloneInputData(input);
4358 } else if (pointersLength === 1) {
4359 session.firstMultiple = false;
4360 }
4361
4362 var firstInput = session.firstInput,
4363 firstMultiple = session.firstMultiple;
4364 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
4365 var center = input.center = getCenter(pointers);
4366 input.timeStamp = now$1();
4367 input.deltaTime = input.timeStamp - firstInput.timeStamp;
4368 input.angle = getAngle(offsetCenter, center);
4369 input.distance = getDistance(offsetCenter, center);
4370 computeDeltaXY(session, input);
4371 input.offsetDirection = getDirection(input.deltaX, input.deltaY);
4372 var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
4373 input.overallVelocityX = overallVelocity.x;
4374 input.overallVelocityY = overallVelocity.y;
4375 input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
4376 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
4377 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
4378 input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
4379 computeIntervalInputData(session, input); // find the correct target
4380
4381 var target = manager.element;
4382 var srcEvent = input.srcEvent;
4383 var srcEventTarget;
4384
4385 if (srcEvent.composedPath) {
4386 srcEventTarget = srcEvent.composedPath()[0];
4387 } else if (srcEvent.path) {
4388 srcEventTarget = srcEvent.path[0];
4389 } else {
4390 srcEventTarget = srcEvent.target;
4391 }
4392
4393 if (hasParent(srcEventTarget, target)) {
4394 target = srcEventTarget;
4395 }
4396
4397 input.target = target;
4398}
4399/**
4400 * @private
4401 * handle input events
4402 * @param {Manager} manager
4403 * @param {String} eventType
4404 * @param {Object} input
4405 */
4406
4407
4408function inputHandler(manager, eventType, input) {
4409 var pointersLen = input.pointers.length;
4410 var changedPointersLen = input.changedPointers.length;
4411 var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
4412 var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
4413 input.isFirst = !!isFirst;
4414 input.isFinal = !!isFinal;
4415
4416 if (isFirst) {
4417 manager.session = {};
4418 } // source event is the normalized value of the domEvents
4419 // like 'touchstart, mouseup, pointerdown'
4420
4421
4422 input.eventType = eventType; // compute scale, rotation etc
4423
4424 computeInputData(manager, input); // emit secret event
4425
4426 manager.emit('hammer.input', input);
4427 manager.recognize(input);
4428 manager.session.prevInput = input;
4429}
4430/**
4431 * @private
4432 * split string on whitespace
4433 * @param {String} str
4434 * @returns {Array} words
4435 */
4436
4437
4438function splitStr(str) {
4439 return str.trim().split(/\s+/g);
4440}
4441/**
4442 * @private
4443 * addEventListener with multiple events at once
4444 * @param {EventTarget} target
4445 * @param {String} types
4446 * @param {Function} handler
4447 */
4448
4449
4450function addEventListeners(target, types, handler) {
4451 each(splitStr(types), function (type) {
4452 target.addEventListener(type, handler, false);
4453 });
4454}
4455/**
4456 * @private
4457 * removeEventListener with multiple events at once
4458 * @param {EventTarget} target
4459 * @param {String} types
4460 * @param {Function} handler
4461 */
4462
4463
4464function removeEventListeners(target, types, handler) {
4465 each(splitStr(types), function (type) {
4466 target.removeEventListener(type, handler, false);
4467 });
4468}
4469/**
4470 * @private
4471 * get the window object of an element
4472 * @param {HTMLElement} element
4473 * @returns {DocumentView|Window}
4474 */
4475
4476
4477function getWindowForElement(element) {
4478 var doc = element.ownerDocument || element;
4479 return doc.defaultView || doc.parentWindow || window;
4480}
4481/**
4482 * @private
4483 * create new input type manager
4484 * @param {Manager} manager
4485 * @param {Function} callback
4486 * @returns {Input}
4487 * @constructor
4488 */
4489
4490
4491var Input = /*#__PURE__*/function () {
4492 function Input(manager, callback) {
4493 var self = this;
4494 this.manager = manager;
4495 this.callback = callback;
4496 this.element = manager.element;
4497 this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,
4498 // so when disabled the input events are completely bypassed.
4499
4500 this.domHandler = function (ev) {
4501 if (boolOrFn(manager.options.enable, [manager])) {
4502 self.handler(ev);
4503 }
4504 };
4505
4506 this.init();
4507 }
4508 /**
4509 * @private
4510 * should handle the inputEvent data and trigger the callback
4511 * @virtual
4512 */
4513
4514
4515 var _proto = Input.prototype;
4516
4517 _proto.handler = function handler() {};
4518 /**
4519 * @private
4520 * bind the events
4521 */
4522
4523
4524 _proto.init = function init() {
4525 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
4526 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
4527 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
4528 };
4529 /**
4530 * @private
4531 * unbind the events
4532 */
4533
4534
4535 _proto.destroy = function destroy() {
4536 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
4537 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
4538 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
4539 };
4540
4541 return Input;
4542}();
4543/**
4544 * @private
4545 * find if a array contains the object using indexOf or a simple polyFill
4546 * @param {Array} src
4547 * @param {String} find
4548 * @param {String} [findByKey]
4549 * @return {Boolean|Number} false when not found, or the index
4550 */
4551
4552
4553function inArray(src, find, findByKey) {
4554 if (src.indexOf && !findByKey) {
4555 return src.indexOf(find);
4556 } else {
4557 var i = 0;
4558
4559 while (i < src.length) {
4560 if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
4561 // do not use === here, test fails
4562 return i;
4563 }
4564
4565 i++;
4566 }
4567
4568 return -1;
4569 }
4570}
4571
4572var POINTER_INPUT_MAP = {
4573 pointerdown: INPUT_START,
4574 pointermove: INPUT_MOVE,
4575 pointerup: INPUT_END,
4576 pointercancel: INPUT_CANCEL,
4577 pointerout: INPUT_CANCEL
4578}; // in IE10 the pointer types is defined as an enum
4579
4580var IE10_POINTER_TYPE_ENUM = {
4581 2: INPUT_TYPE_TOUCH,
4582 3: INPUT_TYPE_PEN,
4583 4: INPUT_TYPE_MOUSE,
4584 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
4585
4586};
4587var POINTER_ELEMENT_EVENTS = 'pointerdown';
4588var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive
4589
4590if (win.MSPointerEvent && !win.PointerEvent) {
4591 POINTER_ELEMENT_EVENTS = 'MSPointerDown';
4592 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
4593}
4594/**
4595 * @private
4596 * Pointer events input
4597 * @constructor
4598 * @extends Input
4599 */
4600
4601
4602var PointerEventInput = /*#__PURE__*/function (_Input) {
4603 _inheritsLoose(PointerEventInput, _Input);
4604
4605 function PointerEventInput() {
4606 var _this;
4607
4608 var proto = PointerEventInput.prototype;
4609 proto.evEl = POINTER_ELEMENT_EVENTS;
4610 proto.evWin = POINTER_WINDOW_EVENTS;
4611 _this = _Input.apply(this, arguments) || this;
4612 _this.store = _this.manager.session.pointerEvents = [];
4613 return _this;
4614 }
4615 /**
4616 * @private
4617 * handle mouse events
4618 * @param {Object} ev
4619 */
4620
4621
4622 var _proto = PointerEventInput.prototype;
4623
4624 _proto.handler = function handler(ev) {
4625 var store = this.store;
4626 var removePointer = false;
4627 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
4628 var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
4629 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
4630 var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store
4631
4632 var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down
4633
4634 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
4635 if (storeIndex < 0) {
4636 store.push(ev);
4637 storeIndex = store.length - 1;
4638 }
4639 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
4640 removePointer = true;
4641 } // it not found, so the pointer hasn't been down (so it's probably a hover)
4642
4643
4644 if (storeIndex < 0) {
4645 return;
4646 } // update the event in the store
4647
4648
4649 store[storeIndex] = ev;
4650 this.callback(this.manager, eventType, {
4651 pointers: store,
4652 changedPointers: [ev],
4653 pointerType: pointerType,
4654 srcEvent: ev
4655 });
4656
4657 if (removePointer) {
4658 // remove from the store
4659 store.splice(storeIndex, 1);
4660 }
4661 };
4662
4663 return PointerEventInput;
4664}(Input);
4665/**
4666 * @private
4667 * convert array-like objects to real arrays
4668 * @param {Object} obj
4669 * @returns {Array}
4670 */
4671
4672
4673function toArray(obj) {
4674 return Array.prototype.slice.call(obj, 0);
4675}
4676/**
4677 * @private
4678 * unique array with objects based on a key (like 'id') or just by the array's value
4679 * @param {Array} src [{id:1},{id:2},{id:1}]
4680 * @param {String} [key]
4681 * @param {Boolean} [sort=False]
4682 * @returns {Array} [{id:1},{id:2}]
4683 */
4684
4685
4686function uniqueArray(src, key, sort) {
4687 var results = [];
4688 var values = [];
4689 var i = 0;
4690
4691 while (i < src.length) {
4692 var val = key ? src[i][key] : src[i];
4693
4694 if (inArray(values, val) < 0) {
4695 results.push(src[i]);
4696 }
4697
4698 values[i] = val;
4699 i++;
4700 }
4701
4702 if (sort) {
4703 if (!key) {
4704 results = results.sort();
4705 } else {
4706 results = results.sort(function (a, b) {
4707 return a[key] > b[key];
4708 });
4709 }
4710 }
4711
4712 return results;
4713}
4714
4715var TOUCH_INPUT_MAP = {
4716 touchstart: INPUT_START,
4717 touchmove: INPUT_MOVE,
4718 touchend: INPUT_END,
4719 touchcancel: INPUT_CANCEL
4720};
4721var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
4722/**
4723 * @private
4724 * Multi-user touch events input
4725 * @constructor
4726 * @extends Input
4727 */
4728
4729var TouchInput = /*#__PURE__*/function (_Input) {
4730 _inheritsLoose(TouchInput, _Input);
4731
4732 function TouchInput() {
4733 var _this;
4734
4735 TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;
4736 _this = _Input.apply(this, arguments) || this;
4737 _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;
4738
4739 return _this;
4740 }
4741
4742 var _proto = TouchInput.prototype;
4743
4744 _proto.handler = function handler(ev) {
4745 var type = TOUCH_INPUT_MAP[ev.type];
4746 var touches = getTouches.call(this, ev, type);
4747
4748 if (!touches) {
4749 return;
4750 }
4751
4752 this.callback(this.manager, type, {
4753 pointers: touches[0],
4754 changedPointers: touches[1],
4755 pointerType: INPUT_TYPE_TOUCH,
4756 srcEvent: ev
4757 });
4758 };
4759
4760 return TouchInput;
4761}(Input);
4762
4763function getTouches(ev, type) {
4764 var allTouches = toArray(ev.touches);
4765 var targetIds = this.targetIds; // when there is only one touch, the process can be simplified
4766
4767 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
4768 targetIds[allTouches[0].identifier] = true;
4769 return [allTouches, allTouches];
4770 }
4771
4772 var i;
4773 var targetTouches;
4774 var changedTouches = toArray(ev.changedTouches);
4775 var changedTargetTouches = [];
4776 var target = this.target; // get target touches from touches
4777
4778 targetTouches = allTouches.filter(function (touch) {
4779 return hasParent(touch.target, target);
4780 }); // collect touches
4781
4782 if (type === INPUT_START) {
4783 i = 0;
4784
4785 while (i < targetTouches.length) {
4786 targetIds[targetTouches[i].identifier] = true;
4787 i++;
4788 }
4789 } // filter changed touches to only contain touches that exist in the collected target ids
4790
4791
4792 i = 0;
4793
4794 while (i < changedTouches.length) {
4795 if (targetIds[changedTouches[i].identifier]) {
4796 changedTargetTouches.push(changedTouches[i]);
4797 } // cleanup removed touches
4798
4799
4800 if (type & (INPUT_END | INPUT_CANCEL)) {
4801 delete targetIds[changedTouches[i].identifier];
4802 }
4803
4804 i++;
4805 }
4806
4807 if (!changedTargetTouches.length) {
4808 return;
4809 }
4810
4811 return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
4812 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
4813}
4814
4815var MOUSE_INPUT_MAP = {
4816 mousedown: INPUT_START,
4817 mousemove: INPUT_MOVE,
4818 mouseup: INPUT_END
4819};
4820var MOUSE_ELEMENT_EVENTS = 'mousedown';
4821var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
4822/**
4823 * @private
4824 * Mouse events input
4825 * @constructor
4826 * @extends Input
4827 */
4828
4829var MouseInput = /*#__PURE__*/function (_Input) {
4830 _inheritsLoose(MouseInput, _Input);
4831
4832 function MouseInput() {
4833 var _this;
4834
4835 var proto = MouseInput.prototype;
4836 proto.evEl = MOUSE_ELEMENT_EVENTS;
4837 proto.evWin = MOUSE_WINDOW_EVENTS;
4838 _this = _Input.apply(this, arguments) || this;
4839 _this.pressed = false; // mousedown state
4840
4841 return _this;
4842 }
4843 /**
4844 * @private
4845 * handle mouse events
4846 * @param {Object} ev
4847 */
4848
4849
4850 var _proto = MouseInput.prototype;
4851
4852 _proto.handler = function handler(ev) {
4853 var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down
4854
4855 if (eventType & INPUT_START && ev.button === 0) {
4856 this.pressed = true;
4857 }
4858
4859 if (eventType & INPUT_MOVE && ev.which !== 1) {
4860 eventType = INPUT_END;
4861 } // mouse must be down
4862
4863
4864 if (!this.pressed) {
4865 return;
4866 }
4867
4868 if (eventType & INPUT_END) {
4869 this.pressed = false;
4870 }
4871
4872 this.callback(this.manager, eventType, {
4873 pointers: [ev],
4874 changedPointers: [ev],
4875 pointerType: INPUT_TYPE_MOUSE,
4876 srcEvent: ev
4877 });
4878 };
4879
4880 return MouseInput;
4881}(Input);
4882/**
4883 * @private
4884 * Combined touch and mouse input
4885 *
4886 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
4887 * This because touch devices also emit mouse events while doing a touch.
4888 *
4889 * @constructor
4890 * @extends Input
4891 */
4892
4893
4894var DEDUP_TIMEOUT = 2500;
4895var DEDUP_DISTANCE = 25;
4896
4897function setLastTouch(eventData) {
4898 var _eventData$changedPoi = eventData.changedPointers,
4899 touch = _eventData$changedPoi[0];
4900
4901 if (touch.identifier === this.primaryTouch) {
4902 var lastTouch = {
4903 x: touch.clientX,
4904 y: touch.clientY
4905 };
4906 var lts = this.lastTouches;
4907 this.lastTouches.push(lastTouch);
4908
4909 var removeLastTouch = function removeLastTouch() {
4910 var i = lts.indexOf(lastTouch);
4911
4912 if (i > -1) {
4913 lts.splice(i, 1);
4914 }
4915 };
4916
4917 setTimeout(removeLastTouch, DEDUP_TIMEOUT);
4918 }
4919}
4920
4921function recordTouches(eventType, eventData) {
4922 if (eventType & INPUT_START) {
4923 this.primaryTouch = eventData.changedPointers[0].identifier;
4924 setLastTouch.call(this, eventData);
4925 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
4926 setLastTouch.call(this, eventData);
4927 }
4928}
4929
4930function isSyntheticEvent(eventData) {
4931 var x = eventData.srcEvent.clientX;
4932 var y = eventData.srcEvent.clientY;
4933
4934 for (var i = 0; i < this.lastTouches.length; i++) {
4935 var t = this.lastTouches[i];
4936 var dx = Math.abs(x - t.x);
4937 var dy = Math.abs(y - t.y);
4938
4939 if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
4940 return true;
4941 }
4942 }
4943
4944 return false;
4945}
4946
4947var TouchMouseInput = /*#__PURE__*/function () {
4948 var TouchMouseInput = /*#__PURE__*/function (_Input) {
4949 _inheritsLoose(TouchMouseInput, _Input);
4950
4951 function TouchMouseInput(_manager, callback) {
4952 var _this;
4953
4954 _this = _Input.call(this, _manager, callback) || this;
4955
4956 _this.handler = function (manager, inputEvent, inputData) {
4957 var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;
4958 var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;
4959
4960 if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
4961 return;
4962 } // when we're in a touch event, record touches to de-dupe synthetic mouse event
4963
4964
4965 if (isTouch) {
4966 recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);
4967 } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {
4968 return;
4969 }
4970
4971 _this.callback(manager, inputEvent, inputData);
4972 };
4973
4974 _this.touch = new TouchInput(_this.manager, _this.handler);
4975 _this.mouse = new MouseInput(_this.manager, _this.handler);
4976 _this.primaryTouch = null;
4977 _this.lastTouches = [];
4978 return _this;
4979 }
4980 /**
4981 * @private
4982 * handle mouse and touch events
4983 * @param {Hammer} manager
4984 * @param {String} inputEvent
4985 * @param {Object} inputData
4986 */
4987
4988
4989 var _proto = TouchMouseInput.prototype;
4990 /**
4991 * @private
4992 * remove the event listeners
4993 */
4994
4995 _proto.destroy = function destroy() {
4996 this.touch.destroy();
4997 this.mouse.destroy();
4998 };
4999
5000 return TouchMouseInput;
5001 }(Input);
5002
5003 return TouchMouseInput;
5004}();
5005/**
5006 * @private
5007 * create new input type manager
5008 * called by the Manager constructor
5009 * @param {Hammer} manager
5010 * @returns {Input}
5011 */
5012
5013
5014function createInputInstance(manager) {
5015 var Type; // let inputClass = manager.options.inputClass;
5016
5017 var inputClass = manager.options.inputClass;
5018
5019 if (inputClass) {
5020 Type = inputClass;
5021 } else if (SUPPORT_POINTER_EVENTS) {
5022 Type = PointerEventInput;
5023 } else if (SUPPORT_ONLY_TOUCH) {
5024 Type = TouchInput;
5025 } else if (!SUPPORT_TOUCH) {
5026 Type = MouseInput;
5027 } else {
5028 Type = TouchMouseInput;
5029 }
5030
5031 return new Type(manager, inputHandler);
5032}
5033/**
5034 * @private
5035 * if the argument is an array, we want to execute the fn on each entry
5036 * if it aint an array we don't want to do a thing.
5037 * this is used by all the methods that accept a single and array argument.
5038 * @param {*|Array} arg
5039 * @param {String} fn
5040 * @param {Object} [context]
5041 * @returns {Boolean}
5042 */
5043
5044
5045function invokeArrayArg(arg, fn, context) {
5046 if (Array.isArray(arg)) {
5047 each(arg, context[fn], context);
5048 return true;
5049 }
5050
5051 return false;
5052}
5053
5054var STATE_POSSIBLE = 1;
5055var STATE_BEGAN = 2;
5056var STATE_CHANGED = 4;
5057var STATE_ENDED = 8;
5058var STATE_RECOGNIZED = STATE_ENDED;
5059var STATE_CANCELLED = 16;
5060var STATE_FAILED = 32;
5061/**
5062 * @private
5063 * get a unique id
5064 * @returns {number} uniqueId
5065 */
5066
5067var _uniqueId = 1;
5068
5069function uniqueId() {
5070 return _uniqueId++;
5071}
5072/**
5073 * @private
5074 * get a recognizer by name if it is bound to a manager
5075 * @param {Recognizer|String} otherRecognizer
5076 * @param {Recognizer} recognizer
5077 * @returns {Recognizer}
5078 */
5079
5080
5081function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
5082 var manager = recognizer.manager;
5083
5084 if (manager) {
5085 return manager.get(otherRecognizer);
5086 }
5087
5088 return otherRecognizer;
5089}
5090/**
5091 * @private
5092 * get a usable string, used as event postfix
5093 * @param {constant} state
5094 * @returns {String} state
5095 */
5096
5097
5098function stateStr(state) {
5099 if (state & STATE_CANCELLED) {
5100 return 'cancel';
5101 } else if (state & STATE_ENDED) {
5102 return 'end';
5103 } else if (state & STATE_CHANGED) {
5104 return 'move';
5105 } else if (state & STATE_BEGAN) {
5106 return 'start';
5107 }
5108
5109 return '';
5110}
5111/**
5112 * @private
5113 * Recognizer flow explained; *
5114 * All recognizers have the initial state of POSSIBLE when a input session starts.
5115 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
5116 * Example session for mouse-input: mousedown -> mousemove -> mouseup
5117 *
5118 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
5119 * which determines with state it should be.
5120 *
5121 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
5122 * POSSIBLE to give it another change on the next cycle.
5123 *
5124 * Possible
5125 * |
5126 * +-----+---------------+
5127 * | |
5128 * +-----+-----+ |
5129 * | | |
5130 * Failed Cancelled |
5131 * +-------+------+
5132 * | |
5133 * Recognized Began
5134 * |
5135 * Changed
5136 * |
5137 * Ended/Recognized
5138 */
5139
5140/**
5141 * @private
5142 * Recognizer
5143 * Every recognizer needs to extend from this class.
5144 * @constructor
5145 * @param {Object} options
5146 */
5147
5148
5149var Recognizer = /*#__PURE__*/function () {
5150 function Recognizer(options) {
5151 if (options === void 0) {
5152 options = {};
5153 }
5154
5155 this.options = _extends({
5156 enable: true
5157 }, options);
5158 this.id = uniqueId();
5159 this.manager = null; // default is enable true
5160
5161 this.state = STATE_POSSIBLE;
5162 this.simultaneous = {};
5163 this.requireFail = [];
5164 }
5165 /**
5166 * @private
5167 * set options
5168 * @param {Object} options
5169 * @return {Recognizer}
5170 */
5171
5172
5173 var _proto = Recognizer.prototype;
5174
5175 _proto.set = function set(options) {
5176 assign$1$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state
5177
5178 this.manager && this.manager.touchAction.update();
5179 return this;
5180 };
5181 /**
5182 * @private
5183 * recognize simultaneous with an other recognizer.
5184 * @param {Recognizer} otherRecognizer
5185 * @returns {Recognizer} this
5186 */
5187
5188
5189 _proto.recognizeWith = function recognizeWith(otherRecognizer) {
5190 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
5191 return this;
5192 }
5193
5194 var simultaneous = this.simultaneous;
5195 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
5196
5197 if (!simultaneous[otherRecognizer.id]) {
5198 simultaneous[otherRecognizer.id] = otherRecognizer;
5199 otherRecognizer.recognizeWith(this);
5200 }
5201
5202 return this;
5203 };
5204 /**
5205 * @private
5206 * drop the simultaneous link. it doesnt remove the link on the other recognizer.
5207 * @param {Recognizer} otherRecognizer
5208 * @returns {Recognizer} this
5209 */
5210
5211
5212 _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {
5213 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
5214 return this;
5215 }
5216
5217 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
5218 delete this.simultaneous[otherRecognizer.id];
5219 return this;
5220 };
5221 /**
5222 * @private
5223 * recognizer can only run when an other is failing
5224 * @param {Recognizer} otherRecognizer
5225 * @returns {Recognizer} this
5226 */
5227
5228
5229 _proto.requireFailure = function requireFailure(otherRecognizer) {
5230 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
5231 return this;
5232 }
5233
5234 var requireFail = this.requireFail;
5235 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
5236
5237 if (inArray(requireFail, otherRecognizer) === -1) {
5238 requireFail.push(otherRecognizer);
5239 otherRecognizer.requireFailure(this);
5240 }
5241
5242 return this;
5243 };
5244 /**
5245 * @private
5246 * drop the requireFailure link. it does not remove the link on the other recognizer.
5247 * @param {Recognizer} otherRecognizer
5248 * @returns {Recognizer} this
5249 */
5250
5251
5252 _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {
5253 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
5254 return this;
5255 }
5256
5257 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
5258 var index = inArray(this.requireFail, otherRecognizer);
5259
5260 if (index > -1) {
5261 this.requireFail.splice(index, 1);
5262 }
5263
5264 return this;
5265 };
5266 /**
5267 * @private
5268 * has require failures boolean
5269 * @returns {boolean}
5270 */
5271
5272
5273 _proto.hasRequireFailures = function hasRequireFailures() {
5274 return this.requireFail.length > 0;
5275 };
5276 /**
5277 * @private
5278 * if the recognizer can recognize simultaneous with an other recognizer
5279 * @param {Recognizer} otherRecognizer
5280 * @returns {Boolean}
5281 */
5282
5283
5284 _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {
5285 return !!this.simultaneous[otherRecognizer.id];
5286 };
5287 /**
5288 * @private
5289 * You should use `tryEmit` instead of `emit` directly to check
5290 * that all the needed recognizers has failed before emitting.
5291 * @param {Object} input
5292 */
5293
5294
5295 _proto.emit = function emit(input) {
5296 var self = this;
5297 var state = this.state;
5298
5299 function emit(event) {
5300 self.manager.emit(event, input);
5301 } // 'panstart' and 'panmove'
5302
5303
5304 if (state < STATE_ENDED) {
5305 emit(self.options.event + stateStr(state));
5306 }
5307
5308 emit(self.options.event); // simple 'eventName' events
5309
5310 if (input.additionalEvent) {
5311 // additional event(panleft, panright, pinchin, pinchout...)
5312 emit(input.additionalEvent);
5313 } // panend and pancancel
5314
5315
5316 if (state >= STATE_ENDED) {
5317 emit(self.options.event + stateStr(state));
5318 }
5319 };
5320 /**
5321 * @private
5322 * Check that all the require failure recognizers has failed,
5323 * if true, it emits a gesture event,
5324 * otherwise, setup the state to FAILED.
5325 * @param {Object} input
5326 */
5327
5328
5329 _proto.tryEmit = function tryEmit(input) {
5330 if (this.canEmit()) {
5331 return this.emit(input);
5332 } // it's failing anyway
5333
5334
5335 this.state = STATE_FAILED;
5336 };
5337 /**
5338 * @private
5339 * can we emit?
5340 * @returns {boolean}
5341 */
5342
5343
5344 _proto.canEmit = function canEmit() {
5345 var i = 0;
5346
5347 while (i < this.requireFail.length) {
5348 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
5349 return false;
5350 }
5351
5352 i++;
5353 }
5354
5355 return true;
5356 };
5357 /**
5358 * @private
5359 * update the recognizer
5360 * @param {Object} inputData
5361 */
5362
5363
5364 _proto.recognize = function recognize(inputData) {
5365 // make a new copy of the inputData
5366 // so we can change the inputData without messing up the other recognizers
5367 var inputDataClone = assign$1$1({}, inputData); // is is enabled and allow recognizing?
5368
5369 if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
5370 this.reset();
5371 this.state = STATE_FAILED;
5372 return;
5373 } // reset when we've reached the end
5374
5375
5376 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
5377 this.state = STATE_POSSIBLE;
5378 }
5379
5380 this.state = this.process(inputDataClone); // the recognizer has recognized a gesture
5381 // so trigger an event
5382
5383 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
5384 this.tryEmit(inputDataClone);
5385 }
5386 };
5387 /**
5388 * @private
5389 * return the state of the recognizer
5390 * the actual recognizing happens in this method
5391 * @virtual
5392 * @param {Object} inputData
5393 * @returns {constant} STATE
5394 */
5395
5396 /* jshint ignore:start */
5397
5398
5399 _proto.process = function process(inputData) {};
5400 /* jshint ignore:end */
5401
5402 /**
5403 * @private
5404 * return the preferred touch-action
5405 * @virtual
5406 * @returns {Array}
5407 */
5408
5409
5410 _proto.getTouchAction = function getTouchAction() {};
5411 /**
5412 * @private
5413 * called when the gesture isn't allowed to recognize
5414 * like when another is being recognized or it is disabled
5415 * @virtual
5416 */
5417
5418
5419 _proto.reset = function reset() {};
5420
5421 return Recognizer;
5422}();
5423/**
5424 * @private
5425 * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
5426 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
5427 * a single tap.
5428 *
5429 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
5430 * multi-taps being recognized.
5431 * @constructor
5432 * @extends Recognizer
5433 */
5434
5435
5436var TapRecognizer = /*#__PURE__*/function (_Recognizer) {
5437 _inheritsLoose(TapRecognizer, _Recognizer);
5438
5439 function TapRecognizer(options) {
5440 var _this;
5441
5442 if (options === void 0) {
5443 options = {};
5444 }
5445
5446 _this = _Recognizer.call(this, _extends({
5447 event: 'tap',
5448 pointers: 1,
5449 taps: 1,
5450 interval: 300,
5451 // max time between the multi-tap taps
5452 time: 250,
5453 // max time of the pointer to be down (like finger on the screen)
5454 threshold: 9,
5455 // a minimal movement is ok, but keep it low
5456 posThreshold: 10
5457 }, options)) || this; // previous time and center,
5458 // used for tap counting
5459
5460 _this.pTime = false;
5461 _this.pCenter = false;
5462 _this._timer = null;
5463 _this._input = null;
5464 _this.count = 0;
5465 return _this;
5466 }
5467
5468 var _proto = TapRecognizer.prototype;
5469
5470 _proto.getTouchAction = function getTouchAction() {
5471 return [TOUCH_ACTION_MANIPULATION];
5472 };
5473
5474 _proto.process = function process(input) {
5475 var _this2 = this;
5476
5477 var options = this.options;
5478 var validPointers = input.pointers.length === options.pointers;
5479 var validMovement = input.distance < options.threshold;
5480 var validTouchTime = input.deltaTime < options.time;
5481 this.reset();
5482
5483 if (input.eventType & INPUT_START && this.count === 0) {
5484 return this.failTimeout();
5485 } // we only allow little movement
5486 // and we've reached an end event, so a tap is possible
5487
5488
5489 if (validMovement && validTouchTime && validPointers) {
5490 if (input.eventType !== INPUT_END) {
5491 return this.failTimeout();
5492 }
5493
5494 var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
5495 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
5496 this.pTime = input.timeStamp;
5497 this.pCenter = input.center;
5498
5499 if (!validMultiTap || !validInterval) {
5500 this.count = 1;
5501 } else {
5502 this.count += 1;
5503 }
5504
5505 this._input = input; // if tap count matches we have recognized it,
5506 // else it has began recognizing...
5507
5508 var tapCount = this.count % options.taps;
5509
5510 if (tapCount === 0) {
5511 // no failing requirements, immediately trigger the tap event
5512 // or wait as long as the multitap interval to trigger
5513 if (!this.hasRequireFailures()) {
5514 return STATE_RECOGNIZED;
5515 } else {
5516 this._timer = setTimeout(function () {
5517 _this2.state = STATE_RECOGNIZED;
5518
5519 _this2.tryEmit();
5520 }, options.interval);
5521 return STATE_BEGAN;
5522 }
5523 }
5524 }
5525
5526 return STATE_FAILED;
5527 };
5528
5529 _proto.failTimeout = function failTimeout() {
5530 var _this3 = this;
5531
5532 this._timer = setTimeout(function () {
5533 _this3.state = STATE_FAILED;
5534 }, this.options.interval);
5535 return STATE_FAILED;
5536 };
5537
5538 _proto.reset = function reset() {
5539 clearTimeout(this._timer);
5540 };
5541
5542 _proto.emit = function emit() {
5543 if (this.state === STATE_RECOGNIZED) {
5544 this._input.tapCount = this.count;
5545 this.manager.emit(this.options.event, this._input);
5546 }
5547 };
5548
5549 return TapRecognizer;
5550}(Recognizer);
5551/**
5552 * @private
5553 * This recognizer is just used as a base for the simple attribute recognizers.
5554 * @constructor
5555 * @extends Recognizer
5556 */
5557
5558
5559var AttrRecognizer = /*#__PURE__*/function (_Recognizer) {
5560 _inheritsLoose(AttrRecognizer, _Recognizer);
5561
5562 function AttrRecognizer(options) {
5563 if (options === void 0) {
5564 options = {};
5565 }
5566
5567 return _Recognizer.call(this, _extends({
5568 pointers: 1
5569 }, options)) || this;
5570 }
5571 /**
5572 * @private
5573 * Used to check if it the recognizer receives valid input, like input.distance > 10.
5574 * @memberof AttrRecognizer
5575 * @param {Object} input
5576 * @returns {Boolean} recognized
5577 */
5578
5579
5580 var _proto = AttrRecognizer.prototype;
5581
5582 _proto.attrTest = function attrTest(input) {
5583 var optionPointers = this.options.pointers;
5584 return optionPointers === 0 || input.pointers.length === optionPointers;
5585 };
5586 /**
5587 * @private
5588 * Process the input and return the state for the recognizer
5589 * @memberof AttrRecognizer
5590 * @param {Object} input
5591 * @returns {*} State
5592 */
5593
5594
5595 _proto.process = function process(input) {
5596 var state = this.state;
5597 var eventType = input.eventType;
5598 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
5599 var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED
5600
5601 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
5602 return state | STATE_CANCELLED;
5603 } else if (isRecognized || isValid) {
5604 if (eventType & INPUT_END) {
5605 return state | STATE_ENDED;
5606 } else if (!(state & STATE_BEGAN)) {
5607 return STATE_BEGAN;
5608 }
5609
5610 return state | STATE_CHANGED;
5611 }
5612
5613 return STATE_FAILED;
5614 };
5615
5616 return AttrRecognizer;
5617}(Recognizer);
5618/**
5619 * @private
5620 * direction cons to string
5621 * @param {constant} direction
5622 * @returns {String}
5623 */
5624
5625
5626function directionStr(direction) {
5627 if (direction === DIRECTION_DOWN) {
5628 return 'down';
5629 } else if (direction === DIRECTION_UP) {
5630 return 'up';
5631 } else if (direction === DIRECTION_LEFT) {
5632 return 'left';
5633 } else if (direction === DIRECTION_RIGHT) {
5634 return 'right';
5635 }
5636
5637 return '';
5638}
5639/**
5640 * @private
5641 * Pan
5642 * Recognized when the pointer is down and moved in the allowed direction.
5643 * @constructor
5644 * @extends AttrRecognizer
5645 */
5646
5647
5648var PanRecognizer = /*#__PURE__*/function (_AttrRecognizer) {
5649 _inheritsLoose(PanRecognizer, _AttrRecognizer);
5650
5651 function PanRecognizer(options) {
5652 var _this;
5653
5654 if (options === void 0) {
5655 options = {};
5656 }
5657
5658 _this = _AttrRecognizer.call(this, _extends({
5659 event: 'pan',
5660 threshold: 10,
5661 pointers: 1,
5662 direction: DIRECTION_ALL
5663 }, options)) || this;
5664 _this.pX = null;
5665 _this.pY = null;
5666 return _this;
5667 }
5668
5669 var _proto = PanRecognizer.prototype;
5670
5671 _proto.getTouchAction = function getTouchAction() {
5672 var direction = this.options.direction;
5673 var actions = [];
5674
5675 if (direction & DIRECTION_HORIZONTAL) {
5676 actions.push(TOUCH_ACTION_PAN_Y);
5677 }
5678
5679 if (direction & DIRECTION_VERTICAL) {
5680 actions.push(TOUCH_ACTION_PAN_X);
5681 }
5682
5683 return actions;
5684 };
5685
5686 _proto.directionTest = function directionTest(input) {
5687 var options = this.options;
5688 var hasMoved = true;
5689 var distance = input.distance;
5690 var direction = input.direction;
5691 var x = input.deltaX;
5692 var y = input.deltaY; // lock to axis?
5693
5694 if (!(direction & options.direction)) {
5695 if (options.direction & DIRECTION_HORIZONTAL) {
5696 direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
5697 hasMoved = x !== this.pX;
5698 distance = Math.abs(input.deltaX);
5699 } else {
5700 direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
5701 hasMoved = y !== this.pY;
5702 distance = Math.abs(input.deltaY);
5703 }
5704 }
5705
5706 input.direction = direction;
5707 return hasMoved && distance > options.threshold && direction & options.direction;
5708 };
5709
5710 _proto.attrTest = function attrTest(input) {
5711 return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call
5712 this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
5713 };
5714
5715 _proto.emit = function emit(input) {
5716 this.pX = input.deltaX;
5717 this.pY = input.deltaY;
5718 var direction = directionStr(input.direction);
5719
5720 if (direction) {
5721 input.additionalEvent = this.options.event + direction;
5722 }
5723
5724 _AttrRecognizer.prototype.emit.call(this, input);
5725 };
5726
5727 return PanRecognizer;
5728}(AttrRecognizer);
5729/**
5730 * @private
5731 * Swipe
5732 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
5733 * @constructor
5734 * @extends AttrRecognizer
5735 */
5736
5737
5738var SwipeRecognizer = /*#__PURE__*/function (_AttrRecognizer) {
5739 _inheritsLoose(SwipeRecognizer, _AttrRecognizer);
5740
5741 function SwipeRecognizer(options) {
5742 if (options === void 0) {
5743 options = {};
5744 }
5745
5746 return _AttrRecognizer.call(this, _extends({
5747 event: 'swipe',
5748 threshold: 10,
5749 velocity: 0.3,
5750 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
5751 pointers: 1
5752 }, options)) || this;
5753 }
5754
5755 var _proto = SwipeRecognizer.prototype;
5756
5757 _proto.getTouchAction = function getTouchAction() {
5758 return PanRecognizer.prototype.getTouchAction.call(this);
5759 };
5760
5761 _proto.attrTest = function attrTest(input) {
5762 var direction = this.options.direction;
5763 var velocity;
5764
5765 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
5766 velocity = input.overallVelocity;
5767 } else if (direction & DIRECTION_HORIZONTAL) {
5768 velocity = input.overallVelocityX;
5769 } else if (direction & DIRECTION_VERTICAL) {
5770 velocity = input.overallVelocityY;
5771 }
5772
5773 return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
5774 };
5775
5776 _proto.emit = function emit(input) {
5777 var direction = directionStr(input.offsetDirection);
5778
5779 if (direction) {
5780 this.manager.emit(this.options.event + direction, input);
5781 }
5782
5783 this.manager.emit(this.options.event, input);
5784 };
5785
5786 return SwipeRecognizer;
5787}(AttrRecognizer);
5788/**
5789 * @private
5790 * Pinch
5791 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
5792 * @constructor
5793 * @extends AttrRecognizer
5794 */
5795
5796
5797var PinchRecognizer = /*#__PURE__*/function (_AttrRecognizer) {
5798 _inheritsLoose(PinchRecognizer, _AttrRecognizer);
5799
5800 function PinchRecognizer(options) {
5801 if (options === void 0) {
5802 options = {};
5803 }
5804
5805 return _AttrRecognizer.call(this, _extends({
5806 event: 'pinch',
5807 threshold: 0,
5808 pointers: 2
5809 }, options)) || this;
5810 }
5811
5812 var _proto = PinchRecognizer.prototype;
5813
5814 _proto.getTouchAction = function getTouchAction() {
5815 return [TOUCH_ACTION_NONE];
5816 };
5817
5818 _proto.attrTest = function attrTest(input) {
5819 return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
5820 };
5821
5822 _proto.emit = function emit(input) {
5823 if (input.scale !== 1) {
5824 var inOut = input.scale < 1 ? 'in' : 'out';
5825 input.additionalEvent = this.options.event + inOut;
5826 }
5827
5828 _AttrRecognizer.prototype.emit.call(this, input);
5829 };
5830
5831 return PinchRecognizer;
5832}(AttrRecognizer);
5833/**
5834 * @private
5835 * Rotate
5836 * Recognized when two or more pointer are moving in a circular motion.
5837 * @constructor
5838 * @extends AttrRecognizer
5839 */
5840
5841
5842var RotateRecognizer = /*#__PURE__*/function (_AttrRecognizer) {
5843 _inheritsLoose(RotateRecognizer, _AttrRecognizer);
5844
5845 function RotateRecognizer(options) {
5846 if (options === void 0) {
5847 options = {};
5848 }
5849
5850 return _AttrRecognizer.call(this, _extends({
5851 event: 'rotate',
5852 threshold: 0,
5853 pointers: 2
5854 }, options)) || this;
5855 }
5856
5857 var _proto = RotateRecognizer.prototype;
5858
5859 _proto.getTouchAction = function getTouchAction() {
5860 return [TOUCH_ACTION_NONE];
5861 };
5862
5863 _proto.attrTest = function attrTest(input) {
5864 return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
5865 };
5866
5867 return RotateRecognizer;
5868}(AttrRecognizer);
5869/**
5870 * @private
5871 * Press
5872 * Recognized when the pointer is down for x ms without any movement.
5873 * @constructor
5874 * @extends Recognizer
5875 */
5876
5877
5878var PressRecognizer = /*#__PURE__*/function (_Recognizer) {
5879 _inheritsLoose(PressRecognizer, _Recognizer);
5880
5881 function PressRecognizer(options) {
5882 var _this;
5883
5884 if (options === void 0) {
5885 options = {};
5886 }
5887
5888 _this = _Recognizer.call(this, _extends({
5889 event: 'press',
5890 pointers: 1,
5891 time: 251,
5892 // minimal time of the pointer to be pressed
5893 threshold: 9
5894 }, options)) || this;
5895 _this._timer = null;
5896 _this._input = null;
5897 return _this;
5898 }
5899
5900 var _proto = PressRecognizer.prototype;
5901
5902 _proto.getTouchAction = function getTouchAction() {
5903 return [TOUCH_ACTION_AUTO];
5904 };
5905
5906 _proto.process = function process(input) {
5907 var _this2 = this;
5908
5909 var options = this.options;
5910 var validPointers = input.pointers.length === options.pointers;
5911 var validMovement = input.distance < options.threshold;
5912 var validTime = input.deltaTime > options.time;
5913 this._input = input; // we only allow little movement
5914 // and we've reached an end event, so a tap is possible
5915
5916 if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
5917 this.reset();
5918 } else if (input.eventType & INPUT_START) {
5919 this.reset();
5920 this._timer = setTimeout(function () {
5921 _this2.state = STATE_RECOGNIZED;
5922
5923 _this2.tryEmit();
5924 }, options.time);
5925 } else if (input.eventType & INPUT_END) {
5926 return STATE_RECOGNIZED;
5927 }
5928
5929 return STATE_FAILED;
5930 };
5931
5932 _proto.reset = function reset() {
5933 clearTimeout(this._timer);
5934 };
5935
5936 _proto.emit = function emit(input) {
5937 if (this.state !== STATE_RECOGNIZED) {
5938 return;
5939 }
5940
5941 if (input && input.eventType & INPUT_END) {
5942 this.manager.emit(this.options.event + "up", input);
5943 } else {
5944 this._input.timeStamp = now$1();
5945 this.manager.emit(this.options.event, this._input);
5946 }
5947 };
5948
5949 return PressRecognizer;
5950}(Recognizer);
5951
5952var defaults = {
5953 /**
5954 * @private
5955 * set if DOM events are being triggered.
5956 * But this is slower and unused by simple implementations, so disabled by default.
5957 * @type {Boolean}
5958 * @default false
5959 */
5960 domEvents: false,
5961
5962 /**
5963 * @private
5964 * The value for the touchAction property/fallback.
5965 * When set to `compute` it will magically set the correct value based on the added recognizers.
5966 * @type {String}
5967 * @default compute
5968 */
5969 touchAction: TOUCH_ACTION_COMPUTE,
5970
5971 /**
5972 * @private
5973 * @type {Boolean}
5974 * @default true
5975 */
5976 enable: true,
5977
5978 /**
5979 * @private
5980 * EXPERIMENTAL FEATURE -- can be removed/changed
5981 * Change the parent input target element.
5982 * If Null, then it is being set the to main element.
5983 * @type {Null|EventTarget}
5984 * @default null
5985 */
5986 inputTarget: null,
5987
5988 /**
5989 * @private
5990 * force an input class
5991 * @type {Null|Function}
5992 * @default null
5993 */
5994 inputClass: null,
5995
5996 /**
5997 * @private
5998 * Some CSS properties can be used to improve the working of Hammer.
5999 * Add them to this method and they will be set when creating a new Manager.
6000 * @namespace
6001 */
6002 cssProps: {
6003 /**
6004 * @private
6005 * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
6006 * @type {String}
6007 * @default 'none'
6008 */
6009 userSelect: "none",
6010
6011 /**
6012 * @private
6013 * Disable the Windows Phone grippers when pressing an element.
6014 * @type {String}
6015 * @default 'none'
6016 */
6017 touchSelect: "none",
6018
6019 /**
6020 * @private
6021 * Disables the default callout shown when you touch and hold a touch target.
6022 * On iOS, when you touch and hold a touch target such as a link, Safari displays
6023 * a callout containing information about the link. This property allows you to disable that callout.
6024 * @type {String}
6025 * @default 'none'
6026 */
6027 touchCallout: "none",
6028
6029 /**
6030 * @private
6031 * Specifies whether zooming is enabled. Used by IE10>
6032 * @type {String}
6033 * @default 'none'
6034 */
6035 contentZooming: "none",
6036
6037 /**
6038 * @private
6039 * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
6040 * @type {String}
6041 * @default 'none'
6042 */
6043 userDrag: "none",
6044
6045 /**
6046 * @private
6047 * Overrides the highlight color shown when the user taps a link or a JavaScript
6048 * clickable element in iOS. This property obeys the alpha value, if specified.
6049 * @type {String}
6050 * @default 'rgba(0,0,0,0)'
6051 */
6052 tapHighlightColor: "rgba(0,0,0,0)"
6053 }
6054};
6055/**
6056 * @private
6057 * Default recognizer setup when calling `Hammer()`
6058 * When creating a new Manager these will be skipped.
6059 * This is separated with other defaults because of tree-shaking.
6060 * @type {Array}
6061 */
6062
6063var preset = [[RotateRecognizer, {
6064 enable: false
6065}], [PinchRecognizer, {
6066 enable: false
6067}, ['rotate']], [SwipeRecognizer, {
6068 direction: DIRECTION_HORIZONTAL
6069}], [PanRecognizer, {
6070 direction: DIRECTION_HORIZONTAL
6071}, ['swipe']], [TapRecognizer], [TapRecognizer, {
6072 event: 'doubletap',
6073 taps: 2
6074}, ['tap']], [PressRecognizer]];
6075var STOP = 1;
6076var FORCED_STOP = 2;
6077/**
6078 * @private
6079 * add/remove the css properties as defined in manager.options.cssProps
6080 * @param {Manager} manager
6081 * @param {Boolean} add
6082 */
6083
6084function toggleCssProps(manager, add) {
6085 var element = manager.element;
6086
6087 if (!element.style) {
6088 return;
6089 }
6090
6091 var prop;
6092 each(manager.options.cssProps, function (value, name) {
6093 prop = prefixed(element.style, name);
6094
6095 if (add) {
6096 manager.oldCssProps[prop] = element.style[prop];
6097 element.style[prop] = value;
6098 } else {
6099 element.style[prop] = manager.oldCssProps[prop] || "";
6100 }
6101 });
6102
6103 if (!add) {
6104 manager.oldCssProps = {};
6105 }
6106}
6107/**
6108 * @private
6109 * trigger dom event
6110 * @param {String} event
6111 * @param {Object} data
6112 */
6113
6114
6115function triggerDomEvent(event, data) {
6116 var gestureEvent = document.createEvent("Event");
6117 gestureEvent.initEvent(event, true, true);
6118 gestureEvent.gesture = data;
6119 data.target.dispatchEvent(gestureEvent);
6120}
6121/**
6122* @private
6123 * Manager
6124 * @param {HTMLElement} element
6125 * @param {Object} [options]
6126 * @constructor
6127 */
6128
6129
6130var Manager = /*#__PURE__*/function () {
6131 function Manager(element, options) {
6132 var _this = this;
6133
6134 this.options = assign$1$1({}, defaults, options || {});
6135 this.options.inputTarget = this.options.inputTarget || element;
6136 this.handlers = {};
6137 this.session = {};
6138 this.recognizers = [];
6139 this.oldCssProps = {};
6140 this.element = element;
6141 this.input = createInputInstance(this);
6142 this.touchAction = new TouchAction(this, this.options.touchAction);
6143 toggleCssProps(this, true);
6144 each(this.options.recognizers, function (item) {
6145 var recognizer = _this.add(new item[0](item[1]));
6146
6147 item[2] && recognizer.recognizeWith(item[2]);
6148 item[3] && recognizer.requireFailure(item[3]);
6149 }, this);
6150 }
6151 /**
6152 * @private
6153 * set options
6154 * @param {Object} options
6155 * @returns {Manager}
6156 */
6157
6158
6159 var _proto = Manager.prototype;
6160
6161 _proto.set = function set(options) {
6162 assign$1$1(this.options, options); // Options that need a little more setup
6163
6164 if (options.touchAction) {
6165 this.touchAction.update();
6166 }
6167
6168 if (options.inputTarget) {
6169 // Clean up existing event listeners and reinitialize
6170 this.input.destroy();
6171 this.input.target = options.inputTarget;
6172 this.input.init();
6173 }
6174
6175 return this;
6176 };
6177 /**
6178 * @private
6179 * stop recognizing for this session.
6180 * This session will be discarded, when a new [input]start event is fired.
6181 * When forced, the recognizer cycle is stopped immediately.
6182 * @param {Boolean} [force]
6183 */
6184
6185
6186 _proto.stop = function stop(force) {
6187 this.session.stopped = force ? FORCED_STOP : STOP;
6188 };
6189 /**
6190 * @private
6191 * run the recognizers!
6192 * called by the inputHandler function on every movement of the pointers (touches)
6193 * it walks through all the recognizers and tries to detect the gesture that is being made
6194 * @param {Object} inputData
6195 */
6196
6197
6198 _proto.recognize = function recognize(inputData) {
6199 var session = this.session;
6200
6201 if (session.stopped) {
6202 return;
6203 } // run the touch-action polyfill
6204
6205
6206 this.touchAction.preventDefaults(inputData);
6207 var recognizer;
6208 var recognizers = this.recognizers; // this holds the recognizer that is being recognized.
6209 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
6210 // if no recognizer is detecting a thing, it is set to `null`
6211
6212 var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized
6213 // or when we're in a new session
6214
6215 if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
6216 session.curRecognizer = null;
6217 curRecognizer = null;
6218 }
6219
6220 var i = 0;
6221
6222 while (i < recognizers.length) {
6223 recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.
6224 // 1. allow if the session is NOT forced stopped (see the .stop() method)
6225 // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
6226 // that is being recognized.
6227 // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
6228 // this can be setup with the `recognizeWith()` method on the recognizer.
6229
6230 if (session.stopped !== FORCED_STOP && ( // 1
6231 !curRecognizer || recognizer === curRecognizer || // 2
6232 recognizer.canRecognizeWith(curRecognizer))) {
6233 // 3
6234 recognizer.recognize(inputData);
6235 } else {
6236 recognizer.reset();
6237 } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
6238 // current active recognizer. but only if we don't already have an active recognizer
6239
6240
6241 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
6242 session.curRecognizer = recognizer;
6243 curRecognizer = recognizer;
6244 }
6245
6246 i++;
6247 }
6248 };
6249 /**
6250 * @private
6251 * get a recognizer by its event name.
6252 * @param {Recognizer|String} recognizer
6253 * @returns {Recognizer|Null}
6254 */
6255
6256
6257 _proto.get = function get(recognizer) {
6258 if (recognizer instanceof Recognizer) {
6259 return recognizer;
6260 }
6261
6262 var recognizers = this.recognizers;
6263
6264 for (var i = 0; i < recognizers.length; i++) {
6265 if (recognizers[i].options.event === recognizer) {
6266 return recognizers[i];
6267 }
6268 }
6269
6270 return null;
6271 };
6272 /**
6273 * @private add a recognizer to the manager
6274 * existing recognizers with the same event name will be removed
6275 * @param {Recognizer} recognizer
6276 * @returns {Recognizer|Manager}
6277 */
6278
6279
6280 _proto.add = function add(recognizer) {
6281 if (invokeArrayArg(recognizer, "add", this)) {
6282 return this;
6283 } // remove existing
6284
6285
6286 var existing = this.get(recognizer.options.event);
6287
6288 if (existing) {
6289 this.remove(existing);
6290 }
6291
6292 this.recognizers.push(recognizer);
6293 recognizer.manager = this;
6294 this.touchAction.update();
6295 return recognizer;
6296 };
6297 /**
6298 * @private
6299 * remove a recognizer by name or instance
6300 * @param {Recognizer|String} recognizer
6301 * @returns {Manager}
6302 */
6303
6304
6305 _proto.remove = function remove(recognizer) {
6306 if (invokeArrayArg(recognizer, "remove", this)) {
6307 return this;
6308 }
6309
6310 var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists
6311
6312 if (recognizer) {
6313 var recognizers = this.recognizers;
6314 var index = inArray(recognizers, targetRecognizer);
6315
6316 if (index !== -1) {
6317 recognizers.splice(index, 1);
6318 this.touchAction.update();
6319 }
6320 }
6321
6322 return this;
6323 };
6324 /**
6325 * @private
6326 * bind event
6327 * @param {String} events
6328 * @param {Function} handler
6329 * @returns {EventEmitter} this
6330 */
6331
6332
6333 _proto.on = function on(events, handler) {
6334 if (events === undefined || handler === undefined) {
6335 return this;
6336 }
6337
6338 var handlers = this.handlers;
6339 each(splitStr(events), function (event) {
6340 handlers[event] = handlers[event] || [];
6341 handlers[event].push(handler);
6342 });
6343 return this;
6344 };
6345 /**
6346 * @private unbind event, leave emit blank to remove all handlers
6347 * @param {String} events
6348 * @param {Function} [handler]
6349 * @returns {EventEmitter} this
6350 */
6351
6352
6353 _proto.off = function off(events, handler) {
6354 if (events === undefined) {
6355 return this;
6356 }
6357
6358 var handlers = this.handlers;
6359 each(splitStr(events), function (event) {
6360 if (!handler) {
6361 delete handlers[event];
6362 } else {
6363 handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
6364 }
6365 });
6366 return this;
6367 };
6368 /**
6369 * @private emit event to the listeners
6370 * @param {String} event
6371 * @param {Object} data
6372 */
6373
6374
6375 _proto.emit = function emit(event, data) {
6376 // we also want to trigger dom events
6377 if (this.options.domEvents) {
6378 triggerDomEvent(event, data);
6379 } // no handlers, so skip it all
6380
6381
6382 var handlers = this.handlers[event] && this.handlers[event].slice();
6383
6384 if (!handlers || !handlers.length) {
6385 return;
6386 }
6387
6388 data.type = event;
6389
6390 data.preventDefault = function () {
6391 data.srcEvent.preventDefault();
6392 };
6393
6394 var i = 0;
6395
6396 while (i < handlers.length) {
6397 handlers[i](data);
6398 i++;
6399 }
6400 };
6401 /**
6402 * @private
6403 * destroy the manager and unbinds all events
6404 * it doesn't unbind dom events, that is the user own responsibility
6405 */
6406
6407
6408 _proto.destroy = function destroy() {
6409 this.element && toggleCssProps(this, false);
6410 this.handlers = {};
6411 this.session = {};
6412 this.input.destroy();
6413 this.element = null;
6414 };
6415
6416 return Manager;
6417}();
6418
6419var SINGLE_TOUCH_INPUT_MAP = {
6420 touchstart: INPUT_START,
6421 touchmove: INPUT_MOVE,
6422 touchend: INPUT_END,
6423 touchcancel: INPUT_CANCEL
6424};
6425var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
6426var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
6427/**
6428 * @private
6429 * Touch events input
6430 * @constructor
6431 * @extends Input
6432 */
6433
6434var SingleTouchInput = /*#__PURE__*/function (_Input) {
6435 _inheritsLoose(SingleTouchInput, _Input);
6436
6437 function SingleTouchInput() {
6438 var _this;
6439
6440 var proto = SingleTouchInput.prototype;
6441 proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
6442 proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
6443 _this = _Input.apply(this, arguments) || this;
6444 _this.started = false;
6445 return _this;
6446 }
6447
6448 var _proto = SingleTouchInput.prototype;
6449
6450 _proto.handler = function handler(ev) {
6451 var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?
6452
6453 if (type === INPUT_START) {
6454 this.started = true;
6455 }
6456
6457 if (!this.started) {
6458 return;
6459 }
6460
6461 var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state
6462
6463 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
6464 this.started = false;
6465 }
6466
6467 this.callback(this.manager, type, {
6468 pointers: touches[0],
6469 changedPointers: touches[1],
6470 pointerType: INPUT_TYPE_TOUCH,
6471 srcEvent: ev
6472 });
6473 };
6474
6475 return SingleTouchInput;
6476}(Input);
6477
6478function normalizeSingleTouches(ev, type) {
6479 var all = toArray(ev.touches);
6480 var changed = toArray(ev.changedTouches);
6481
6482 if (type & (INPUT_END | INPUT_CANCEL)) {
6483 all = uniqueArray(all.concat(changed), 'identifier', true);
6484 }
6485
6486 return [all, changed];
6487}
6488/**
6489 * @private
6490 * wrap a method with a deprecation warning and stack trace
6491 * @param {Function} method
6492 * @param {String} name
6493 * @param {String} message
6494 * @returns {Function} A new function wrapping the supplied method.
6495 */
6496
6497
6498function deprecate(method, name, message) {
6499 var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
6500 return function () {
6501 var e = new Error('get-stack-trace');
6502 var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
6503 var log = window.console && (window.console.warn || window.console.log);
6504
6505 if (log) {
6506 log.call(window.console, deprecationMessage, stack);
6507 }
6508
6509 return method.apply(this, arguments);
6510 };
6511}
6512/**
6513 * @private
6514 * extend object.
6515 * means that properties in dest will be overwritten by the ones in src.
6516 * @param {Object} dest
6517 * @param {Object} src
6518 * @param {Boolean} [merge=false]
6519 * @returns {Object} dest
6520 */
6521
6522
6523var extend = deprecate(function (dest, src, merge) {
6524 var keys = Object.keys(src);
6525 var i = 0;
6526
6527 while (i < keys.length) {
6528 if (!merge || merge && dest[keys[i]] === undefined) {
6529 dest[keys[i]] = src[keys[i]];
6530 }
6531
6532 i++;
6533 }
6534
6535 return dest;
6536}, 'extend', 'Use `assign`.');
6537/**
6538 * @private
6539 * merge the values from src in the dest.
6540 * means that properties that exist in dest will not be overwritten by src
6541 * @param {Object} dest
6542 * @param {Object} src
6543 * @returns {Object} dest
6544 */
6545
6546var merge = deprecate(function (dest, src) {
6547 return extend(dest, src, true);
6548}, 'merge', 'Use `assign`.');
6549/**
6550 * @private
6551 * simple class inheritance
6552 * @param {Function} child
6553 * @param {Function} base
6554 * @param {Object} [properties]
6555 */
6556
6557function inherit(child, base, properties) {
6558 var baseP = base.prototype;
6559 var childP;
6560 childP = child.prototype = Object.create(baseP);
6561 childP.constructor = child;
6562 childP._super = baseP;
6563
6564 if (properties) {
6565 assign$1$1(childP, properties);
6566 }
6567}
6568/**
6569 * @private
6570 * simple function bind
6571 * @param {Function} fn
6572 * @param {Object} context
6573 * @returns {Function}
6574 */
6575
6576
6577function bindFn(fn, context) {
6578 return function boundFn() {
6579 return fn.apply(context, arguments);
6580 };
6581}
6582/**
6583 * @private
6584 * Simple way to create a manager with a default set of recognizers.
6585 * @param {HTMLElement} element
6586 * @param {Object} [options]
6587 * @constructor
6588 */
6589
6590
6591var Hammer = /*#__PURE__*/function () {
6592 var Hammer =
6593 /**
6594 * @private
6595 * @const {string}
6596 */
6597 function Hammer(element, options) {
6598 if (options === void 0) {
6599 options = {};
6600 }
6601
6602 return new Manager(element, _extends({
6603 recognizers: preset.concat()
6604 }, options));
6605 };
6606
6607 Hammer.VERSION = "2.0.17-rc";
6608 Hammer.DIRECTION_ALL = DIRECTION_ALL;
6609 Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
6610 Hammer.DIRECTION_LEFT = DIRECTION_LEFT;
6611 Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;
6612 Hammer.DIRECTION_UP = DIRECTION_UP;
6613 Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;
6614 Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;
6615 Hammer.DIRECTION_NONE = DIRECTION_NONE;
6616 Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
6617 Hammer.INPUT_START = INPUT_START;
6618 Hammer.INPUT_MOVE = INPUT_MOVE;
6619 Hammer.INPUT_END = INPUT_END;
6620 Hammer.INPUT_CANCEL = INPUT_CANCEL;
6621 Hammer.STATE_POSSIBLE = STATE_POSSIBLE;
6622 Hammer.STATE_BEGAN = STATE_BEGAN;
6623 Hammer.STATE_CHANGED = STATE_CHANGED;
6624 Hammer.STATE_ENDED = STATE_ENDED;
6625 Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;
6626 Hammer.STATE_CANCELLED = STATE_CANCELLED;
6627 Hammer.STATE_FAILED = STATE_FAILED;
6628 Hammer.Manager = Manager;
6629 Hammer.Input = Input;
6630 Hammer.TouchAction = TouchAction;
6631 Hammer.TouchInput = TouchInput;
6632 Hammer.MouseInput = MouseInput;
6633 Hammer.PointerEventInput = PointerEventInput;
6634 Hammer.TouchMouseInput = TouchMouseInput;
6635 Hammer.SingleTouchInput = SingleTouchInput;
6636 Hammer.Recognizer = Recognizer;
6637 Hammer.AttrRecognizer = AttrRecognizer;
6638 Hammer.Tap = TapRecognizer;
6639 Hammer.Pan = PanRecognizer;
6640 Hammer.Swipe = SwipeRecognizer;
6641 Hammer.Pinch = PinchRecognizer;
6642 Hammer.Rotate = RotateRecognizer;
6643 Hammer.Press = PressRecognizer;
6644 Hammer.on = addEventListeners;
6645 Hammer.off = removeEventListeners;
6646 Hammer.each = each;
6647 Hammer.merge = merge;
6648 Hammer.extend = extend;
6649 Hammer.bindFn = bindFn;
6650 Hammer.assign = assign$1$1;
6651 Hammer.inherit = inherit;
6652 Hammer.bindFn = bindFn;
6653 Hammer.prefixed = prefixed;
6654 Hammer.toArray = toArray;
6655 Hammer.inArray = inArray;
6656 Hammer.uniqueArray = uniqueArray;
6657 Hammer.splitStr = splitStr;
6658 Hammer.boolOrFn = boolOrFn;
6659 Hammer.hasParent = hasParent;
6660 Hammer.addEventListeners = addEventListeners;
6661 Hammer.removeEventListeners = removeEventListeners;
6662 Hammer.defaults = assign$1$1({}, defaults, {
6663 preset: preset
6664 });
6665 return Hammer;
6666}(); // style loader but by script tag, not by the loader.
6667
6668function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof symbol$4 === "undefined" || getIteratorMethod$1(o) == null) { if (isArray$5(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = getIterator$1(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6669
6670function _unsupportedIterableToArray$1(o, minLen) { var _context21; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = slice$6(_context21 = Object.prototype.toString.call(o)).call(_context21, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
6671
6672function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6673/**
6674 * Use this symbol to delete properies in deepObjectAssign.
6675 */
6676
6677var DELETE = symbol$4("DELETE");
6678/**
6679 * Pure version of deepObjectAssign, it doesn't modify any of it's arguments.
6680 *
6681 * @param base - The base object that fullfils the whole interface T.
6682 * @param updates - Updates that may change or delete props.
6683 *
6684 * @returns A brand new instance with all the supplied objects deeply merged.
6685 */
6686
6687
6688function pureDeepObjectAssign(base) {
6689 var _context;
6690
6691 for (var _len = arguments.length, updates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6692 updates[_key - 1] = arguments[_key];
6693 }
6694
6695 return deepObjectAssign.apply(void 0, concat$2(_context = [{}, base]).call(_context, updates));
6696}
6697/**
6698 * Deep version of object assign with additional deleting by the DELETE symbol.
6699 *
6700 * @param values - Objects to be deeply merged.
6701 *
6702 * @returns The first object from values.
6703 */
6704
6705
6706function deepObjectAssign() {
6707 var merged = deepObjectAssignNonentry.apply(void 0, arguments);
6708 stripDelete(merged);
6709 return merged;
6710}
6711/**
6712 * Deep version of object assign with additional deleting by the DELETE symbol.
6713 *
6714 * @remarks
6715 * This doesn't strip the DELETE symbols so they may end up in the final object.
6716 *
6717 * @param values - Objects to be deeply merged.
6718 *
6719 * @returns The first object from values.
6720 */
6721
6722
6723function deepObjectAssignNonentry() {
6724 for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
6725 values[_key2] = arguments[_key2];
6726 }
6727
6728 if (values.length < 2) {
6729 return values[0];
6730 } else if (values.length > 2) {
6731 var _context2;
6732
6733 return deepObjectAssignNonentry.apply(void 0, concat$2(_context2 = [deepObjectAssign(values[0], values[1])]).call(_context2, toConsumableArray(slice$6(values).call(values, 2))));
6734 }
6735
6736 var a = values[0];
6737 var b = values[1];
6738
6739 var _iterator = _createForOfIteratorHelper(ownKeys$3(b)),
6740 _step;
6741
6742 try {
6743 for (_iterator.s(); !(_step = _iterator.n()).done;) {
6744 var prop = _step.value;
6745 if (!Object.prototype.propertyIsEnumerable.call(b, prop)) ;else if (b[prop] === DELETE) {
6746 delete a[prop];
6747 } else if (a[prop] !== null && b[prop] !== null && _typeof_1(a[prop]) === "object" && _typeof_1(b[prop]) === "object" && !isArray$5(a[prop]) && !isArray$5(b[prop])) {
6748 a[prop] = deepObjectAssignNonentry(a[prop], b[prop]);
6749 } else {
6750 a[prop] = clone(b[prop]);
6751 }
6752 }
6753 } catch (err) {
6754 _iterator.e(err);
6755 } finally {
6756 _iterator.f();
6757 }
6758
6759 return a;
6760}
6761/**
6762 * Deep clone given object or array. In case of primitive simply return.
6763 *
6764 * @param a - Anything.
6765 *
6766 * @returns Deep cloned object/array or unchanged a.
6767 */
6768
6769
6770function clone(a) {
6771 if (isArray$5(a)) {
6772 return map$2(a).call(a, function (value) {
6773 return clone(value);
6774 });
6775 } else if (_typeof_1(a) === "object" && a !== null) {
6776 return deepObjectAssignNonentry({}, a);
6777 } else {
6778 return a;
6779 }
6780}
6781/**
6782 * Strip DELETE from given object.
6783 *
6784 * @param a - Object which may contain DELETE but won't after this is executed.
6785 */
6786
6787
6788function stripDelete(a) {
6789 for (var _i = 0, _Object$keys = keys$3(a); _i < _Object$keys.length; _i++) {
6790 var prop = _Object$keys[_i];
6791
6792 if (a[prop] === DELETE) {
6793 delete a[prop];
6794 } else if (_typeof_1(a[prop]) === "object" && a[prop] !== null) {
6795 stripDelete(a[prop]);
6796 }
6797 }
6798}
6799/**
6800 * Setup a mock hammer.js object, for unit testing.
6801 *
6802 * Inspiration: https://github.com/uber/deck.gl/pull/658
6803 *
6804 * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}}
6805 */
6806
6807
6808function hammerMock() {
6809 var noop = function noop() {};
6810
6811 return {
6812 on: noop,
6813 off: noop,
6814 destroy: noop,
6815 emit: noop,
6816 get: function get() {
6817 return {
6818 set: noop
6819 };
6820 }
6821 };
6822}
6823
6824var Hammer$1 = typeof window !== "undefined" ? window.Hammer || Hammer : function () {
6825 // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object.
6826 return hammerMock();
6827};
6828/**
6829 * Turn an element into an clickToUse element.
6830 * When not active, the element has a transparent overlay. When the overlay is
6831 * clicked, the mode is changed to active.
6832 * When active, the element is displayed with a blue border around it, and
6833 * the interactive contents of the element can be used. When clicked outside
6834 * the element, the elements mode is changed to inactive.
6835 *
6836 * @param {Element} container
6837 * @class Activator
6838 */
6839
6840function Activator(container) {
6841 var _this = this,
6842 _context3;
6843
6844 this._cleanupQueue = [];
6845 this.active = false;
6846 this._dom = {
6847 container: container,
6848 overlay: document.createElement("div")
6849 };
6850
6851 this._dom.overlay.classList.add("vis-overlay");
6852
6853 this._dom.container.appendChild(this._dom.overlay);
6854
6855 this._cleanupQueue.push(function () {
6856 _this._dom.overlay.parentNode.removeChild(_this._dom.overlay);
6857 });
6858
6859 var hammer = Hammer$1(this._dom.overlay);
6860 hammer.on("tap", bind$2(_context3 = this._onTapOverlay).call(_context3, this));
6861
6862 this._cleanupQueue.push(function () {
6863 hammer.destroy(); // FIXME: cleaning up hammer instances doesn't work (Timeline not removed
6864 // from memory)
6865 }); // block all touch events (except tap)
6866
6867
6868 var events = ["tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend"];
6869
6870 forEach$2(events).call(events, function (event) {
6871 hammer.on(event, function (event) {
6872 event.srcEvent.stopPropagation();
6873 });
6874 }); // attach a click event to the window, in order to deactivate when clicking outside the timeline
6875
6876
6877 if (document && document.body) {
6878 this._onClick = function (event) {
6879 if (!_hasParent(event.target, container)) {
6880 _this.deactivate();
6881 }
6882 };
6883
6884 document.body.addEventListener("click", this._onClick);
6885
6886 this._cleanupQueue.push(function () {
6887 document.body.removeEventListener("click", _this._onClick);
6888 });
6889 } // prepare escape key listener for deactivating when active
6890
6891
6892 this._escListener = function (event) {
6893 if ("key" in event ? event.key === "Escape" : event.keyCode === 27
6894 /* the keyCode is for IE11 */
6895 ) {
6896 _this.deactivate();
6897 }
6898 };
6899} // turn into an event emitter
6900
6901
6902componentEmitter(Activator.prototype); // The currently active activator
6903
6904Activator.current = null;
6905/**
6906 * Destroy the activator. Cleans up all created DOM and event listeners
6907 */
6908
6909Activator.prototype.destroy = function () {
6910 var _context4, _context5;
6911
6912 this.deactivate();
6913
6914 var _iterator2 = _createForOfIteratorHelper(reverse$2(_context4 = splice$2(_context5 = this._cleanupQueue).call(_context5, 0)).call(_context4)),
6915 _step2;
6916
6917 try {
6918 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6919 var callback = _step2.value;
6920 callback();
6921 }
6922 } catch (err) {
6923 _iterator2.e(err);
6924 } finally {
6925 _iterator2.f();
6926 }
6927};
6928/**
6929 * Activate the element
6930 * Overlay is hidden, element is decorated with a blue shadow border
6931 */
6932
6933
6934Activator.prototype.activate = function () {
6935 // we allow only one active activator at a time
6936 if (Activator.current) {
6937 Activator.current.deactivate();
6938 }
6939
6940 Activator.current = this;
6941 this.active = true;
6942 this._dom.overlay.style.display = "none";
6943
6944 this._dom.container.classList.add("vis-active");
6945
6946 this.emit("change");
6947 this.emit("activate"); // ugly hack: bind ESC after emitting the events, as the Network rebinds all
6948 // keyboard events on a 'change' event
6949
6950 document.body.addEventListener("keydown", this._escListener);
6951};
6952/**
6953 * Deactivate the element
6954 * Overlay is displayed on top of the element
6955 */
6956
6957
6958Activator.prototype.deactivate = function () {
6959 this.active = false;
6960 this._dom.overlay.style.display = "block";
6961
6962 this._dom.container.classList.remove("vis-active");
6963
6964 document.body.removeEventListener("keydown", this._escListener);
6965 this.emit("change");
6966 this.emit("deactivate");
6967};
6968/**
6969 * Handle a tap event: activate the container
6970 *
6971 * @param {Event} event The event
6972 * @private
6973 */
6974
6975
6976Activator.prototype._onTapOverlay = function (event) {
6977 // activate the container
6978 this.activate();
6979 event.srcEvent.stopPropagation();
6980};
6981/**
6982 * Test whether the element has the requested parent element somewhere in
6983 * its chain of parent nodes.
6984 *
6985 * @param {HTMLElement} element
6986 * @param {HTMLElement} parent
6987 * @returns {boolean} Returns true when the parent is found somewhere in the
6988 * chain of parent nodes.
6989 * @private
6990 */
6991
6992
6993function _hasParent(element, parent) {
6994 while (element) {
6995 if (element === parent) {
6996 return true;
6997 }
6998
6999 element = element.parentNode;
7000 }
7001
7002 return false;
7003} // utility functions
7004
7005var nativeConstruct = getBuiltIn('Reflect', 'construct'); // `Reflect.construct` method
7006// https://tc39.github.io/ecma262/#sec-reflect.construct
7007// MS Edge supports only 2 arguments and argumentsList argument is optional
7008// FF Nightly sets third argument as `new.target`, but does not create `this` from it
7009
7010var NEW_TARGET_BUG = fails(function () {
7011 function F() {
7012 /* empty */
7013 }
7014
7015 return !(nativeConstruct(function () {
7016 /* empty */
7017 }, [], F) instanceof F);
7018});
7019var ARGS_BUG = !fails(function () {
7020 nativeConstruct(function () {
7021 /* empty */
7022 });
7023});
7024var FORCED$4 = NEW_TARGET_BUG || ARGS_BUG;
7025_export({
7026 target: 'Reflect',
7027 stat: true,
7028 forced: FORCED$4,
7029 sham: FORCED$4
7030}, {
7031 construct: function construct(Target, args
7032 /* , newTarget */
7033 ) {
7034 aFunction(Target);
7035 anObject(args);
7036 var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
7037 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
7038
7039 if (Target == newTarget) {
7040 // w/o altered newTarget, optimization for 0-4 arguments
7041 switch (args.length) {
7042 case 0:
7043 return new Target();
7044
7045 case 1:
7046 return new Target(args[0]);
7047
7048 case 2:
7049 return new Target(args[0], args[1]);
7050
7051 case 3:
7052 return new Target(args[0], args[1], args[2]);
7053
7054 case 4:
7055 return new Target(args[0], args[1], args[2], args[3]);
7056 } // w/o altered newTarget, lot of arguments case
7057
7058
7059 var $args = [null];
7060 $args.push.apply($args, args);
7061 return new (functionBind.apply(Target, $args))();
7062 } // with altered newTarget, not support built-in constructors
7063
7064
7065 var proto = newTarget.prototype;
7066 var instance = objectCreate(isObject(proto) ? proto : Object.prototype);
7067 var result = Function.apply.call(Target, instance, args);
7068 return isObject(result) ? result : instance;
7069 }
7070});
7071
7072var construct$1 = path.Reflect.construct;
7073
7074var construct$2 = construct$1;
7075
7076var construct$3 = construct$2;
7077
7078var entries = entryVirtual('Array').entries;
7079
7080var entries$1 = entries;
7081
7082var ArrayPrototype$a = Array.prototype;
7083var DOMIterables$1 = {
7084 DOMTokenList: true,
7085 NodeList: true
7086};
7087
7088var entries_1 = function (it) {
7089 var own = it.entries;
7090 return it === ArrayPrototype$a || it instanceof Array && own === ArrayPrototype$a.entries // eslint-disable-next-line no-prototype-builtins
7091 || DOMIterables$1.hasOwnProperty(classof(it)) ? entries$1 : own;
7092};
7093
7094var entries$2 = entries_1;
7095
7096/**
7097 * Copyright (c) 2014-present, Facebook, Inc.
7098 *
7099 * This source code is licensed under the MIT license found in the
7100 * LICENSE file in the root directory of this source tree.
7101 */
7102var runtime_1 = createCommonjsModule(function (module) {
7103 var runtime = function (exports) {
7104
7105 var Op = Object.prototype;
7106 var hasOwn = Op.hasOwnProperty;
7107 var undefined$1; // More compressible than void 0.
7108
7109 var $Symbol = typeof Symbol === "function" ? Symbol : {};
7110 var iteratorSymbol = $Symbol.iterator || "@@iterator";
7111 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
7112 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
7113
7114 function define(obj, key, value) {
7115 Object.defineProperty(obj, key, {
7116 value: value,
7117 enumerable: true,
7118 configurable: true,
7119 writable: true
7120 });
7121 return obj[key];
7122 }
7123
7124 try {
7125 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
7126 define({}, "");
7127 } catch (err) {
7128 define = function (obj, key, value) {
7129 return obj[key] = value;
7130 };
7131 }
7132
7133 function wrap(innerFn, outerFn, self, tryLocsList) {
7134 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
7135 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
7136 var generator = Object.create(protoGenerator.prototype);
7137 var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
7138 // .throw, and .return methods.
7139
7140 generator._invoke = makeInvokeMethod(innerFn, self, context);
7141 return generator;
7142 }
7143
7144 exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
7145 // record like context.tryEntries[i].completion. This interface could
7146 // have been (and was previously) designed to take a closure to be
7147 // invoked without arguments, but in all the cases we care about we
7148 // already have an existing method we want to call, so there's no need
7149 // to create a new function object. We can even get away with assuming
7150 // the method takes exactly one argument, since that happens to be true
7151 // in every case, so we don't have to touch the arguments object. The
7152 // only additional allocation required is the completion record, which
7153 // has a stable shape and so hopefully should be cheap to allocate.
7154
7155 function tryCatch(fn, obj, arg) {
7156 try {
7157 return {
7158 type: "normal",
7159 arg: fn.call(obj, arg)
7160 };
7161 } catch (err) {
7162 return {
7163 type: "throw",
7164 arg: err
7165 };
7166 }
7167 }
7168
7169 var GenStateSuspendedStart = "suspendedStart";
7170 var GenStateSuspendedYield = "suspendedYield";
7171 var GenStateExecuting = "executing";
7172 var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
7173 // breaking out of the dispatch switch statement.
7174
7175 var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
7176 // .constructor.prototype properties for functions that return Generator
7177 // objects. For full spec compliance, you may wish to configure your
7178 // minifier not to mangle the names of these two functions.
7179
7180 function Generator() {}
7181
7182 function GeneratorFunction() {}
7183
7184 function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
7185 // don't natively support it.
7186
7187
7188 var IteratorPrototype = {};
7189
7190 IteratorPrototype[iteratorSymbol] = function () {
7191 return this;
7192 };
7193
7194 var getProto = Object.getPrototypeOf;
7195 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
7196
7197 if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
7198 // This environment has a native %IteratorPrototype%; use it instead
7199 // of the polyfill.
7200 IteratorPrototype = NativeIteratorPrototype;
7201 }
7202
7203 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
7204 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
7205 GeneratorFunctionPrototype.constructor = GeneratorFunction;
7206 GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
7207 // Iterator interface in terms of a single ._invoke method.
7208
7209 function defineIteratorMethods(prototype) {
7210 ["next", "throw", "return"].forEach(function (method) {
7211 define(prototype, method, function (arg) {
7212 return this._invoke(method, arg);
7213 });
7214 });
7215 }
7216
7217 exports.isGeneratorFunction = function (genFun) {
7218 var ctor = typeof genFun === "function" && genFun.constructor;
7219 return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
7220 // do is to check its .name property.
7221 (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
7222 };
7223
7224 exports.mark = function (genFun) {
7225 if (Object.setPrototypeOf) {
7226 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
7227 } else {
7228 genFun.__proto__ = GeneratorFunctionPrototype;
7229 define(genFun, toStringTagSymbol, "GeneratorFunction");
7230 }
7231
7232 genFun.prototype = Object.create(Gp);
7233 return genFun;
7234 }; // Within the body of any async function, `await x` is transformed to
7235 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
7236 // `hasOwn.call(value, "__await")` to determine if the yielded value is
7237 // meant to be awaited.
7238
7239
7240 exports.awrap = function (arg) {
7241 return {
7242 __await: arg
7243 };
7244 };
7245
7246 function AsyncIterator(generator, PromiseImpl) {
7247 function invoke(method, arg, resolve, reject) {
7248 var record = tryCatch(generator[method], generator, arg);
7249
7250 if (record.type === "throw") {
7251 reject(record.arg);
7252 } else {
7253 var result = record.arg;
7254 var value = result.value;
7255
7256 if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
7257 return PromiseImpl.resolve(value.__await).then(function (value) {
7258 invoke("next", value, resolve, reject);
7259 }, function (err) {
7260 invoke("throw", err, resolve, reject);
7261 });
7262 }
7263
7264 return PromiseImpl.resolve(value).then(function (unwrapped) {
7265 // When a yielded Promise is resolved, its final value becomes
7266 // the .value of the Promise<{value,done}> result for the
7267 // current iteration.
7268 result.value = unwrapped;
7269 resolve(result);
7270 }, function (error) {
7271 // If a rejected Promise was yielded, throw the rejection back
7272 // into the async generator function so it can be handled there.
7273 return invoke("throw", error, resolve, reject);
7274 });
7275 }
7276 }
7277
7278 var previousPromise;
7279
7280 function enqueue(method, arg) {
7281 function callInvokeWithMethodAndArg() {
7282 return new PromiseImpl(function (resolve, reject) {
7283 invoke(method, arg, resolve, reject);
7284 });
7285 }
7286
7287 return previousPromise = // If enqueue has been called before, then we want to wait until
7288 // all previous Promises have been resolved before calling invoke,
7289 // so that results are always delivered in the correct order. If
7290 // enqueue has not been called before, then it is important to
7291 // call invoke immediately, without waiting on a callback to fire,
7292 // so that the async generator function has the opportunity to do
7293 // any necessary setup in a predictable way. This predictability
7294 // is why the Promise constructor synchronously invokes its
7295 // executor callback, and why async functions synchronously
7296 // execute code before the first await. Since we implement simple
7297 // async functions in terms of async generators, it is especially
7298 // important to get this right, even though it requires care.
7299 previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
7300 // invocations of the iterator.
7301 callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
7302 } // Define the unified helper method that is used to implement .next,
7303 // .throw, and .return (see defineIteratorMethods).
7304
7305
7306 this._invoke = enqueue;
7307 }
7308
7309 defineIteratorMethods(AsyncIterator.prototype);
7310
7311 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
7312 return this;
7313 };
7314
7315 exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
7316 // AsyncIterator objects; they just return a Promise for the value of
7317 // the final result produced by the iterator.
7318
7319 exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
7320 if (PromiseImpl === void 0) PromiseImpl = Promise;
7321 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
7322 return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
7323 : iter.next().then(function (result) {
7324 return result.done ? result.value : iter.next();
7325 });
7326 };
7327
7328 function makeInvokeMethod(innerFn, self, context) {
7329 var state = GenStateSuspendedStart;
7330 return function invoke(method, arg) {
7331 if (state === GenStateExecuting) {
7332 throw new Error("Generator is already running");
7333 }
7334
7335 if (state === GenStateCompleted) {
7336 if (method === "throw") {
7337 throw arg;
7338 } // Be forgiving, per 25.3.3.3.3 of the spec:
7339 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
7340
7341
7342 return doneResult();
7343 }
7344
7345 context.method = method;
7346 context.arg = arg;
7347
7348 while (true) {
7349 var delegate = context.delegate;
7350
7351 if (delegate) {
7352 var delegateResult = maybeInvokeDelegate(delegate, context);
7353
7354 if (delegateResult) {
7355 if (delegateResult === ContinueSentinel) continue;
7356 return delegateResult;
7357 }
7358 }
7359
7360 if (context.method === "next") {
7361 // Setting context._sent for legacy support of Babel's
7362 // function.sent implementation.
7363 context.sent = context._sent = context.arg;
7364 } else if (context.method === "throw") {
7365 if (state === GenStateSuspendedStart) {
7366 state = GenStateCompleted;
7367 throw context.arg;
7368 }
7369
7370 context.dispatchException(context.arg);
7371 } else if (context.method === "return") {
7372 context.abrupt("return", context.arg);
7373 }
7374
7375 state = GenStateExecuting;
7376 var record = tryCatch(innerFn, self, context);
7377
7378 if (record.type === "normal") {
7379 // If an exception is thrown from innerFn, we leave state ===
7380 // GenStateExecuting and loop back for another invocation.
7381 state = context.done ? GenStateCompleted : GenStateSuspendedYield;
7382
7383 if (record.arg === ContinueSentinel) {
7384 continue;
7385 }
7386
7387 return {
7388 value: record.arg,
7389 done: context.done
7390 };
7391 } else if (record.type === "throw") {
7392 state = GenStateCompleted; // Dispatch the exception by looping back around to the
7393 // context.dispatchException(context.arg) call above.
7394
7395 context.method = "throw";
7396 context.arg = record.arg;
7397 }
7398 }
7399 };
7400 } // Call delegate.iterator[context.method](context.arg) and handle the
7401 // result, either by returning a { value, done } result from the
7402 // delegate iterator, or by modifying context.method and context.arg,
7403 // setting context.delegate to null, and returning the ContinueSentinel.
7404
7405
7406 function maybeInvokeDelegate(delegate, context) {
7407 var method = delegate.iterator[context.method];
7408
7409 if (method === undefined$1) {
7410 // A .throw or .return when the delegate iterator has no .throw
7411 // method always terminates the yield* loop.
7412 context.delegate = null;
7413
7414 if (context.method === "throw") {
7415 // Note: ["return"] must be used for ES3 parsing compatibility.
7416 if (delegate.iterator["return"]) {
7417 // If the delegate iterator has a return method, give it a
7418 // chance to clean up.
7419 context.method = "return";
7420 context.arg = undefined$1;
7421 maybeInvokeDelegate(delegate, context);
7422
7423 if (context.method === "throw") {
7424 // If maybeInvokeDelegate(context) changed context.method from
7425 // "return" to "throw", let that override the TypeError below.
7426 return ContinueSentinel;
7427 }
7428 }
7429
7430 context.method = "throw";
7431 context.arg = new TypeError("The iterator does not provide a 'throw' method");
7432 }
7433
7434 return ContinueSentinel;
7435 }
7436
7437 var record = tryCatch(method, delegate.iterator, context.arg);
7438
7439 if (record.type === "throw") {
7440 context.method = "throw";
7441 context.arg = record.arg;
7442 context.delegate = null;
7443 return ContinueSentinel;
7444 }
7445
7446 var info = record.arg;
7447
7448 if (!info) {
7449 context.method = "throw";
7450 context.arg = new TypeError("iterator result is not an object");
7451 context.delegate = null;
7452 return ContinueSentinel;
7453 }
7454
7455 if (info.done) {
7456 // Assign the result of the finished delegate to the temporary
7457 // variable specified by delegate.resultName (see delegateYield).
7458 context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
7459
7460 context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
7461 // exception, let the outer generator proceed normally. If
7462 // context.method was "next", forget context.arg since it has been
7463 // "consumed" by the delegate iterator. If context.method was
7464 // "return", allow the original .return call to continue in the
7465 // outer generator.
7466
7467 if (context.method !== "return") {
7468 context.method = "next";
7469 context.arg = undefined$1;
7470 }
7471 } else {
7472 // Re-yield the result returned by the delegate method.
7473 return info;
7474 } // The delegate iterator is finished, so forget it and continue with
7475 // the outer generator.
7476
7477
7478 context.delegate = null;
7479 return ContinueSentinel;
7480 } // Define Generator.prototype.{next,throw,return} in terms of the
7481 // unified ._invoke helper method.
7482
7483
7484 defineIteratorMethods(Gp);
7485 define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
7486 // @@iterator function is called on it. Some browsers' implementations of the
7487 // iterator prototype chain incorrectly implement this, causing the Generator
7488 // object to not be returned from this call. This ensures that doesn't happen.
7489 // See https://github.com/facebook/regenerator/issues/274 for more details.
7490
7491 Gp[iteratorSymbol] = function () {
7492 return this;
7493 };
7494
7495 Gp.toString = function () {
7496 return "[object Generator]";
7497 };
7498
7499 function pushTryEntry(locs) {
7500 var entry = {
7501 tryLoc: locs[0]
7502 };
7503
7504 if (1 in locs) {
7505 entry.catchLoc = locs[1];
7506 }
7507
7508 if (2 in locs) {
7509 entry.finallyLoc = locs[2];
7510 entry.afterLoc = locs[3];
7511 }
7512
7513 this.tryEntries.push(entry);
7514 }
7515
7516 function resetTryEntry(entry) {
7517 var record = entry.completion || {};
7518 record.type = "normal";
7519 delete record.arg;
7520 entry.completion = record;
7521 }
7522
7523 function Context(tryLocsList) {
7524 // The root entry object (effectively a try statement without a catch
7525 // or a finally block) gives us a place to store values thrown from
7526 // locations where there is no enclosing try statement.
7527 this.tryEntries = [{
7528 tryLoc: "root"
7529 }];
7530 tryLocsList.forEach(pushTryEntry, this);
7531 this.reset(true);
7532 }
7533
7534 exports.keys = function (object) {
7535 var keys = [];
7536
7537 for (var key in object) {
7538 keys.push(key);
7539 }
7540
7541 keys.reverse(); // Rather than returning an object with a next method, we keep
7542 // things simple and return the next function itself.
7543
7544 return function next() {
7545 while (keys.length) {
7546 var key = keys.pop();
7547
7548 if (key in object) {
7549 next.value = key;
7550 next.done = false;
7551 return next;
7552 }
7553 } // To avoid creating an additional object, we just hang the .value
7554 // and .done properties off the next function object itself. This
7555 // also ensures that the minifier will not anonymize the function.
7556
7557
7558 next.done = true;
7559 return next;
7560 };
7561 };
7562
7563 function values(iterable) {
7564 if (iterable) {
7565 var iteratorMethod = iterable[iteratorSymbol];
7566
7567 if (iteratorMethod) {
7568 return iteratorMethod.call(iterable);
7569 }
7570
7571 if (typeof iterable.next === "function") {
7572 return iterable;
7573 }
7574
7575 if (!isNaN(iterable.length)) {
7576 var i = -1,
7577 next = function next() {
7578 while (++i < iterable.length) {
7579 if (hasOwn.call(iterable, i)) {
7580 next.value = iterable[i];
7581 next.done = false;
7582 return next;
7583 }
7584 }
7585
7586 next.value = undefined$1;
7587 next.done = true;
7588 return next;
7589 };
7590
7591 return next.next = next;
7592 }
7593 } // Return an iterator with no values.
7594
7595
7596 return {
7597 next: doneResult
7598 };
7599 }
7600
7601 exports.values = values;
7602
7603 function doneResult() {
7604 return {
7605 value: undefined$1,
7606 done: true
7607 };
7608 }
7609
7610 Context.prototype = {
7611 constructor: Context,
7612 reset: function (skipTempReset) {
7613 this.prev = 0;
7614 this.next = 0; // Resetting context._sent for legacy support of Babel's
7615 // function.sent implementation.
7616
7617 this.sent = this._sent = undefined$1;
7618 this.done = false;
7619 this.delegate = null;
7620 this.method = "next";
7621 this.arg = undefined$1;
7622 this.tryEntries.forEach(resetTryEntry);
7623
7624 if (!skipTempReset) {
7625 for (var name in this) {
7626 // Not sure about the optimal order of these conditions:
7627 if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
7628 this[name] = undefined$1;
7629 }
7630 }
7631 }
7632 },
7633 stop: function () {
7634 this.done = true;
7635 var rootEntry = this.tryEntries[0];
7636 var rootRecord = rootEntry.completion;
7637
7638 if (rootRecord.type === "throw") {
7639 throw rootRecord.arg;
7640 }
7641
7642 return this.rval;
7643 },
7644 dispatchException: function (exception) {
7645 if (this.done) {
7646 throw exception;
7647 }
7648
7649 var context = this;
7650
7651 function handle(loc, caught) {
7652 record.type = "throw";
7653 record.arg = exception;
7654 context.next = loc;
7655
7656 if (caught) {
7657 // If the dispatched exception was caught by a catch block,
7658 // then let that catch block handle the exception normally.
7659 context.method = "next";
7660 context.arg = undefined$1;
7661 }
7662
7663 return !!caught;
7664 }
7665
7666 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
7667 var entry = this.tryEntries[i];
7668 var record = entry.completion;
7669
7670 if (entry.tryLoc === "root") {
7671 // Exception thrown outside of any try block that could handle
7672 // it, so set the completion value of the entire function to
7673 // throw the exception.
7674 return handle("end");
7675 }
7676
7677 if (entry.tryLoc <= this.prev) {
7678 var hasCatch = hasOwn.call(entry, "catchLoc");
7679 var hasFinally = hasOwn.call(entry, "finallyLoc");
7680
7681 if (hasCatch && hasFinally) {
7682 if (this.prev < entry.catchLoc) {
7683 return handle(entry.catchLoc, true);
7684 } else if (this.prev < entry.finallyLoc) {
7685 return handle(entry.finallyLoc);
7686 }
7687 } else if (hasCatch) {
7688 if (this.prev < entry.catchLoc) {
7689 return handle(entry.catchLoc, true);
7690 }
7691 } else if (hasFinally) {
7692 if (this.prev < entry.finallyLoc) {
7693 return handle(entry.finallyLoc);
7694 }
7695 } else {
7696 throw new Error("try statement without catch or finally");
7697 }
7698 }
7699 }
7700 },
7701 abrupt: function (type, arg) {
7702 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
7703 var entry = this.tryEntries[i];
7704
7705 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
7706 var finallyEntry = entry;
7707 break;
7708 }
7709 }
7710
7711 if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
7712 // Ignore the finally entry if control is not jumping to a
7713 // location outside the try/catch block.
7714 finallyEntry = null;
7715 }
7716
7717 var record = finallyEntry ? finallyEntry.completion : {};
7718 record.type = type;
7719 record.arg = arg;
7720
7721 if (finallyEntry) {
7722 this.method = "next";
7723 this.next = finallyEntry.finallyLoc;
7724 return ContinueSentinel;
7725 }
7726
7727 return this.complete(record);
7728 },
7729 complete: function (record, afterLoc) {
7730 if (record.type === "throw") {
7731 throw record.arg;
7732 }
7733
7734 if (record.type === "break" || record.type === "continue") {
7735 this.next = record.arg;
7736 } else if (record.type === "return") {
7737 this.rval = this.arg = record.arg;
7738 this.method = "return";
7739 this.next = "end";
7740 } else if (record.type === "normal" && afterLoc) {
7741 this.next = afterLoc;
7742 }
7743
7744 return ContinueSentinel;
7745 },
7746 finish: function (finallyLoc) {
7747 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
7748 var entry = this.tryEntries[i];
7749
7750 if (entry.finallyLoc === finallyLoc) {
7751 this.complete(entry.completion, entry.afterLoc);
7752 resetTryEntry(entry);
7753 return ContinueSentinel;
7754 }
7755 }
7756 },
7757 "catch": function (tryLoc) {
7758 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
7759 var entry = this.tryEntries[i];
7760
7761 if (entry.tryLoc === tryLoc) {
7762 var record = entry.completion;
7763
7764 if (record.type === "throw") {
7765 var thrown = record.arg;
7766 resetTryEntry(entry);
7767 }
7768
7769 return thrown;
7770 }
7771 } // The context.catch method must only be called with a location
7772 // argument that corresponds to a known catch block.
7773
7774
7775 throw new Error("illegal catch attempt");
7776 },
7777 delegateYield: function (iterable, resultName, nextLoc) {
7778 this.delegate = {
7779 iterator: values(iterable),
7780 resultName: resultName,
7781 nextLoc: nextLoc
7782 };
7783
7784 if (this.method === "next") {
7785 // Deliberately forget the last sent value so that we don't
7786 // accidentally pass it on to the delegate.
7787 this.arg = undefined$1;
7788 }
7789
7790 return ContinueSentinel;
7791 }
7792 }; // Regardless of whether this script is executing as a CommonJS module
7793 // or not, return the runtime object so that we can declare the variable
7794 // regeneratorRuntime in the outer scope, which allows this module to be
7795 // injected easily by `bin/regenerator --include-runtime script.js`.
7796
7797 return exports;
7798 }( // If this script is executing as a CommonJS module, use module.exports
7799 // as the regeneratorRuntime namespace. Otherwise create a new empty
7800 // object. Either way, the resulting object will be used to initialize
7801 // the regeneratorRuntime variable at the top of this file.
7802 module.exports );
7803
7804 try {
7805 regeneratorRuntime = runtime;
7806 } catch (accidentalStrictMode) {
7807 // This module should not be running in strict mode, so the above
7808 // assignment should always work unless something is misconfigured. Just
7809 // in case runtime.js accidentally runs in strict mode, we can escape
7810 // strict mode using a global Function call. This could conceivably fail
7811 // if a Content Security Policy forbids using Function, but in that case
7812 // the proper solution is to fix the accidental strict mode problem. If
7813 // you've misconfigured your bundler to force strict mode and applied a
7814 // CSP to forbid Function, and you're not willing to fix either of those
7815 // problems, please detail your unique predicament in a GitHub issue.
7816 Function("r", "regeneratorRuntime = r")(runtime);
7817 }
7818});
7819
7820var regenerator = runtime_1;
7821
7822var iterator$3 = iterator;
7823
7824var iterator$4 = iterator$3;
7825
7826var values$1 = entryVirtual('Array').values;
7827
7828var values$2 = values$1;
7829
7830var ArrayPrototype$b = Array.prototype;
7831var DOMIterables$2 = {
7832 DOMTokenList: true,
7833 NodeList: true
7834};
7835
7836var values_1 = function (it) {
7837 var own = it.values;
7838 return it === ArrayPrototype$b || it instanceof Array && own === ArrayPrototype$b.values // eslint-disable-next-line no-prototype-builtins
7839 || DOMIterables$2.hasOwnProperty(classof(it)) ? values$2 : own;
7840};
7841
7842var values$3 = values_1;
7843
7844var test$2 = [];
7845var nativeSort = test$2.sort; // IE8-
7846
7847var FAILS_ON_UNDEFINED = fails(function () {
7848 test$2.sort(undefined);
7849}); // V8 bug
7850
7851var FAILS_ON_NULL = fails(function () {
7852 test$2.sort(null);
7853}); // Old WebKit
7854
7855var STRICT_METHOD$3 = arrayMethodIsStrict('sort');
7856var FORCED$5 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$3; // `Array.prototype.sort` method
7857// https://tc39.github.io/ecma262/#sec-array.prototype.sort
7858
7859_export({
7860 target: 'Array',
7861 proto: true,
7862 forced: FORCED$5
7863}, {
7864 sort: function sort(comparefn) {
7865 return comparefn === undefined ? nativeSort.call(toObject(this)) : nativeSort.call(toObject(this), aFunction(comparefn));
7866 }
7867});
7868
7869var sort = entryVirtual('Array').sort;
7870
7871var ArrayPrototype$c = Array.prototype;
7872
7873var sort_1 = function (it) {
7874 var own = it.sort;
7875 return it === ArrayPrototype$c || it instanceof Array && own === ArrayPrototype$c.sort ? sort : own;
7876};
7877
7878var sort$1 = sort_1;
7879
7880var sort$2 = sort$1;
7881
7882var keys$4 = entryVirtual('Array').keys;
7883
7884var keys$5 = keys$4;
7885
7886var ArrayPrototype$d = Array.prototype;
7887var DOMIterables$3 = {
7888 DOMTokenList: true,
7889 NodeList: true
7890};
7891
7892var keys_1 = function (it) {
7893 var own = it.keys;
7894 return it === ArrayPrototype$d || it instanceof Array && own === ArrayPrototype$d.keys // eslint-disable-next-line no-prototype-builtins
7895 || DOMIterables$3.hasOwnProperty(classof(it)) ? keys$5 : own;
7896};
7897
7898var keys$6 = keys_1;
7899
7900var $some = arrayIteration.some;
7901var STRICT_METHOD$4 = arrayMethodIsStrict('some');
7902var USES_TO_LENGTH$8 = arrayMethodUsesToLength('some'); // `Array.prototype.some` method
7903// https://tc39.github.io/ecma262/#sec-array.prototype.some
7904
7905_export({
7906 target: 'Array',
7907 proto: true,
7908 forced: !STRICT_METHOD$4 || !USES_TO_LENGTH$8
7909}, {
7910 some: function some(callbackfn
7911 /* , thisArg */
7912 ) {
7913 return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
7914 }
7915});
7916
7917var some = entryVirtual('Array').some;
7918
7919var ArrayPrototype$e = Array.prototype;
7920
7921var some_1 = function (it) {
7922 var own = it.some;
7923 return it === ArrayPrototype$e || it instanceof Array && own === ArrayPrototype$e.some ? some : own;
7924};
7925
7926var some$1 = some_1;
7927
7928var some$2 = some$1;
7929
7930var freezing = !fails(function () {
7931 return Object.isExtensible(Object.preventExtensions({}));
7932});
7933
7934var internalMetadata = createCommonjsModule(function (module) {
7935 var defineProperty = objectDefineProperty.f;
7936 var METADATA = uid('meta');
7937 var id = 0;
7938
7939 var isExtensible = Object.isExtensible || function () {
7940 return true;
7941 };
7942
7943 var setMetadata = function (it) {
7944 defineProperty(it, METADATA, {
7945 value: {
7946 objectID: 'O' + ++id,
7947 // object ID
7948 weakData: {} // weak collections IDs
7949
7950 }
7951 });
7952 };
7953
7954 var fastKey = function (it, create) {
7955 // return a primitive with prefix
7956 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
7957
7958 if (!has(it, METADATA)) {
7959 // can't set metadata to uncaught frozen object
7960 if (!isExtensible(it)) return 'F'; // not necessary to add metadata
7961
7962 if (!create) return 'E'; // add missing metadata
7963
7964 setMetadata(it); // return object ID
7965 }
7966
7967 return it[METADATA].objectID;
7968 };
7969
7970 var getWeakData = function (it, create) {
7971 if (!has(it, METADATA)) {
7972 // can't set metadata to uncaught frozen object
7973 if (!isExtensible(it)) return true; // not necessary to add metadata
7974
7975 if (!create) return false; // add missing metadata
7976
7977 setMetadata(it); // return the store of weak collections IDs
7978 }
7979
7980 return it[METADATA].weakData;
7981 }; // add metadata on freeze-family methods calling
7982
7983
7984 var onFreeze = function (it) {
7985 if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
7986 return it;
7987 };
7988
7989 var meta = module.exports = {
7990 REQUIRED: false,
7991 fastKey: fastKey,
7992 getWeakData: getWeakData,
7993 onFreeze: onFreeze
7994 };
7995 hiddenKeys[METADATA] = true;
7996});
7997
7998var Result = function (stopped, result) {
7999 this.stopped = stopped;
8000 this.result = result;
8001};
8002
8003var iterate = function (iterable, unboundFunction, options) {
8004 var that = options && options.that;
8005 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
8006 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
8007 var INTERRUPTED = !!(options && options.INTERRUPTED);
8008 var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
8009 var iterator, iterFn, index, length, result, next, step;
8010
8011 var stop = function (condition) {
8012 if (iterator) iteratorClose(iterator);
8013 return new Result(true, condition);
8014 };
8015
8016 var callFn = function (value) {
8017 if (AS_ENTRIES) {
8018 anObject(value);
8019 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
8020 }
8021
8022 return INTERRUPTED ? fn(value, stop) : fn(value);
8023 };
8024
8025 if (IS_ITERATOR) {
8026 iterator = iterable;
8027 } else {
8028 iterFn = getIteratorMethod(iterable);
8029 if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators
8030
8031 if (isArrayIteratorMethod(iterFn)) {
8032 for (index = 0, length = toLength(iterable.length); length > index; index++) {
8033 result = callFn(iterable[index]);
8034 if (result && result instanceof Result) return result;
8035 }
8036
8037 return new Result(false);
8038 }
8039
8040 iterator = iterFn.call(iterable);
8041 }
8042
8043 next = iterator.next;
8044
8045 while (!(step = next.call(iterator)).done) {
8046 try {
8047 result = callFn(step.value);
8048 } catch (error) {
8049 iteratorClose(iterator);
8050 throw error;
8051 }
8052
8053 if (typeof result == 'object' && result && result instanceof Result) return result;
8054 }
8055
8056 return new Result(false);
8057};
8058
8059var anInstance = function (it, Constructor, name) {
8060 if (!(it instanceof Constructor)) {
8061 throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
8062 }
8063
8064 return it;
8065};
8066
8067var defineProperty$9 = objectDefineProperty.f;
8068var forEach$3 = arrayIteration.forEach;
8069var setInternalState$3 = internalState.set;
8070var internalStateGetterFor = internalState.getterFor;
8071
8072var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
8073 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
8074 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
8075 var ADDER = IS_MAP ? 'set' : 'add';
8076 var NativeConstructor = global$1[CONSTRUCTOR_NAME];
8077 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
8078 var exported = {};
8079 var Constructor;
8080
8081 if (!descriptors || typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
8082 new NativeConstructor().entries().next();
8083 }))) {
8084 // create collection constructor
8085 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
8086 internalMetadata.REQUIRED = true;
8087 } else {
8088 Constructor = wrapper(function (target, iterable) {
8089 setInternalState$3(anInstance(target, Constructor, CONSTRUCTOR_NAME), {
8090 type: CONSTRUCTOR_NAME,
8091 collection: new NativeConstructor()
8092 });
8093 if (iterable != undefined) iterate(iterable, target[ADDER], {
8094 that: target,
8095 AS_ENTRIES: IS_MAP
8096 });
8097 });
8098 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8099 forEach$3(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
8100 var IS_ADDER = KEY == 'add' || KEY == 'set';
8101
8102 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
8103 createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) {
8104 var collection = getInternalState(this).collection;
8105 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
8106 var result = collection[KEY](a === 0 ? 0 : a, b);
8107 return IS_ADDER ? this : result;
8108 });
8109 }
8110 });
8111 IS_WEAK || defineProperty$9(Constructor.prototype, 'size', {
8112 configurable: true,
8113 get: function () {
8114 return getInternalState(this).collection.size;
8115 }
8116 });
8117 }
8118
8119 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
8120 exported[CONSTRUCTOR_NAME] = Constructor;
8121 _export({
8122 global: true,
8123 forced: true
8124 }, exported);
8125 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
8126 return Constructor;
8127};
8128
8129var redefineAll = function (target, src, options) {
8130 for (var key in src) {
8131 if (options && options.unsafe && target[key]) target[key] = src[key];else redefine(target, key, src[key], options);
8132 }
8133
8134 return target;
8135};
8136
8137var SPECIES$3 = wellKnownSymbol('species');
8138
8139var setSpecies = function (CONSTRUCTOR_NAME) {
8140 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
8141 var defineProperty = objectDefineProperty.f;
8142
8143 if (descriptors && Constructor && !Constructor[SPECIES$3]) {
8144 defineProperty(Constructor, SPECIES$3, {
8145 configurable: true,
8146 get: function () {
8147 return this;
8148 }
8149 });
8150 }
8151};
8152
8153var defineProperty$a = objectDefineProperty.f;
8154var fastKey = internalMetadata.fastKey;
8155var setInternalState$4 = internalState.set;
8156var internalStateGetterFor$1 = internalState.getterFor;
8157var collectionStrong = {
8158 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
8159 var C = wrapper(function (that, iterable) {
8160 anInstance(that, C, CONSTRUCTOR_NAME);
8161 setInternalState$4(that, {
8162 type: CONSTRUCTOR_NAME,
8163 index: objectCreate(null),
8164 first: undefined,
8165 last: undefined,
8166 size: 0
8167 });
8168 if (!descriptors) that.size = 0;
8169 if (iterable != undefined) iterate(iterable, that[ADDER], {
8170 that: that,
8171 AS_ENTRIES: IS_MAP
8172 });
8173 });
8174 var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
8175
8176 var define = function (that, key, value) {
8177 var state = getInternalState(that);
8178 var entry = getEntry(that, key);
8179 var previous, index; // change existing entry
8180
8181 if (entry) {
8182 entry.value = value; // create new entry
8183 } else {
8184 state.last = entry = {
8185 index: index = fastKey(key, true),
8186 key: key,
8187 value: value,
8188 previous: previous = state.last,
8189 next: undefined,
8190 removed: false
8191 };
8192 if (!state.first) state.first = entry;
8193 if (previous) previous.next = entry;
8194 if (descriptors) state.size++;else that.size++; // add to index
8195
8196 if (index !== 'F') state.index[index] = entry;
8197 }
8198
8199 return that;
8200 };
8201
8202 var getEntry = function (that, key) {
8203 var state = getInternalState(that); // fast case
8204
8205 var index = fastKey(key);
8206 var entry;
8207 if (index !== 'F') return state.index[index]; // frozen object case
8208
8209 for (entry = state.first; entry; entry = entry.next) {
8210 if (entry.key == key) return entry;
8211 }
8212 };
8213
8214 redefineAll(C.prototype, {
8215 // 23.1.3.1 Map.prototype.clear()
8216 // 23.2.3.2 Set.prototype.clear()
8217 clear: function clear() {
8218 var that = this;
8219 var state = getInternalState(that);
8220 var data = state.index;
8221 var entry = state.first;
8222
8223 while (entry) {
8224 entry.removed = true;
8225 if (entry.previous) entry.previous = entry.previous.next = undefined;
8226 delete data[entry.index];
8227 entry = entry.next;
8228 }
8229
8230 state.first = state.last = undefined;
8231 if (descriptors) state.size = 0;else that.size = 0;
8232 },
8233 // 23.1.3.3 Map.prototype.delete(key)
8234 // 23.2.3.4 Set.prototype.delete(value)
8235 'delete': function (key) {
8236 var that = this;
8237 var state = getInternalState(that);
8238 var entry = getEntry(that, key);
8239
8240 if (entry) {
8241 var next = entry.next;
8242 var prev = entry.previous;
8243 delete state.index[entry.index];
8244 entry.removed = true;
8245 if (prev) prev.next = next;
8246 if (next) next.previous = prev;
8247 if (state.first == entry) state.first = next;
8248 if (state.last == entry) state.last = prev;
8249 if (descriptors) state.size--;else that.size--;
8250 }
8251
8252 return !!entry;
8253 },
8254 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
8255 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
8256 forEach: function forEach(callbackfn
8257 /* , that = undefined */
8258 ) {
8259 var state = getInternalState(this);
8260 var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
8261 var entry;
8262
8263 while (entry = entry ? entry.next : state.first) {
8264 boundFunction(entry.value, entry.key, this); // revert to the last existing entry
8265
8266 while (entry && entry.removed) entry = entry.previous;
8267 }
8268 },
8269 // 23.1.3.7 Map.prototype.has(key)
8270 // 23.2.3.7 Set.prototype.has(value)
8271 has: function has(key) {
8272 return !!getEntry(this, key);
8273 }
8274 });
8275 redefineAll(C.prototype, IS_MAP ? {
8276 // 23.1.3.6 Map.prototype.get(key)
8277 get: function get(key) {
8278 var entry = getEntry(this, key);
8279 return entry && entry.value;
8280 },
8281 // 23.1.3.9 Map.prototype.set(key, value)
8282 set: function set(key, value) {
8283 return define(this, key === 0 ? 0 : key, value);
8284 }
8285 } : {
8286 // 23.2.3.1 Set.prototype.add(value)
8287 add: function add(value) {
8288 return define(this, value = value === 0 ? 0 : value, value);
8289 }
8290 });
8291 if (descriptors) defineProperty$a(C.prototype, 'size', {
8292 get: function () {
8293 return getInternalState(this).size;
8294 }
8295 });
8296 return C;
8297 },
8298 setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
8299 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
8300 var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
8301 var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME); // add .keys, .values, .entries, [@@iterator]
8302 // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
8303
8304 defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
8305 setInternalState$4(this, {
8306 type: ITERATOR_NAME,
8307 target: iterated,
8308 state: getInternalCollectionState(iterated),
8309 kind: kind,
8310 last: undefined
8311 });
8312 }, function () {
8313 var state = getInternalIteratorState(this);
8314 var kind = state.kind;
8315 var entry = state.last; // revert to the last existing entry
8316
8317 while (entry && entry.removed) entry = entry.previous; // get next entry
8318
8319
8320 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
8321 // or finish the iteration
8322 state.target = undefined;
8323 return {
8324 value: undefined,
8325 done: true
8326 };
8327 } // return step by kind
8328
8329
8330 if (kind == 'keys') return {
8331 value: entry.key,
8332 done: false
8333 };
8334 if (kind == 'values') return {
8335 value: entry.value,
8336 done: false
8337 };
8338 return {
8339 value: [entry.key, entry.value],
8340 done: false
8341 };
8342 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2
8343
8344 setSpecies(CONSTRUCTOR_NAME);
8345 }
8346};
8347
8348// https://tc39.github.io/ecma262/#sec-map-objects
8349
8350
8351var es_map = collection('Map', function (init) {
8352 return function Map() {
8353 return init(this, arguments.length ? arguments[0] : undefined);
8354 };
8355}, collectionStrong);
8356
8357var map$3 = path.Map;
8358
8359var map$4 = map$3;
8360
8361var map$5 = map$4;
8362
8363var create$3 = create;
8364
8365var create$4 = create$3;
8366
8367// https://tc39.github.io/ecma262/#sec-object.setprototypeof
8368
8369_export({
8370 target: 'Object',
8371 stat: true
8372}, {
8373 setPrototypeOf: objectSetPrototypeOf
8374});
8375
8376var setPrototypeOf = path.Object.setPrototypeOf;
8377
8378var setPrototypeOf$1 = setPrototypeOf;
8379
8380var setPrototypeOf$2 = setPrototypeOf$1;
8381
8382var setPrototypeOf$3 = createCommonjsModule(function (module) {
8383 function _setPrototypeOf(o, p) {
8384 module.exports = _setPrototypeOf = setPrototypeOf$2 || function _setPrototypeOf(o, p) {
8385 o.__proto__ = p;
8386 return o;
8387 };
8388
8389 return _setPrototypeOf(o, p);
8390 }
8391
8392 module.exports = _setPrototypeOf;
8393});
8394
8395function _inherits(subClass, superClass) {
8396 if (typeof superClass !== "function" && superClass !== null) {
8397 throw new TypeError("Super expression must either be null or a function");
8398 }
8399
8400 subClass.prototype = create$4(superClass && superClass.prototype, {
8401 constructor: {
8402 value: subClass,
8403 writable: true,
8404 configurable: true
8405 }
8406 });
8407 if (superClass) setPrototypeOf$3(subClass, superClass);
8408}
8409
8410var inherits = _inherits;
8411
8412function _assertThisInitialized$1(self) {
8413 if (self === void 0) {
8414 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8415 }
8416
8417 return self;
8418}
8419
8420var assertThisInitialized = _assertThisInitialized$1;
8421
8422function _possibleConstructorReturn(self, call) {
8423 if (call && (_typeof_1(call) === "object" || typeof call === "function")) {
8424 return call;
8425 }
8426
8427 return assertThisInitialized(self);
8428}
8429
8430var possibleConstructorReturn = _possibleConstructorReturn;
8431
8432var getPrototypeOf$1 = getPrototypeOf;
8433
8434var getPrototypeOf$2 = getPrototypeOf$1;
8435
8436var getPrototypeOf$3 = createCommonjsModule(function (module) {
8437 function _getPrototypeOf(o) {
8438 module.exports = _getPrototypeOf = setPrototypeOf$2 ? getPrototypeOf$2 : function _getPrototypeOf(o) {
8439 return o.__proto__ || getPrototypeOf$2(o);
8440 };
8441 return _getPrototypeOf(o);
8442 }
8443
8444 module.exports = _getPrototypeOf;
8445});
8446
8447// Unique ID creation requires a high quality random # generator. In the browser we therefore
8448// require the crypto API and do not support built-in fallback to lower quality random number
8449// generators (like Math.random()).
8450var getRandomValues;
8451var rnds8 = new Uint8Array(16);
8452function rng() {
8453 // lazy load so that environments that need to polyfill have a chance to do so
8454 if (!getRandomValues) {
8455 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
8456 // find the complete implementation of crypto (msCrypto) on IE11.
8457 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
8458
8459 if (!getRandomValues) {
8460 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
8461 }
8462 }
8463
8464 return getRandomValues(rnds8);
8465}
8466
8467var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
8468
8469function validate(uuid) {
8470 return typeof uuid === 'string' && REGEX.test(uuid);
8471}
8472
8473/**
8474 * Convert array of 16 byte values to UUID string format of the form:
8475 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
8476 */
8477
8478var byteToHex = [];
8479
8480for (var i = 0; i < 256; ++i) {
8481 byteToHex.push((i + 0x100).toString(16).substr(1));
8482}
8483
8484function stringify$3(arr) {
8485 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; // Note: Be careful editing this code! It's been tuned for performance
8486 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
8487
8488 var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
8489 // of the following:
8490 // - One or more input array values don't map to a hex octet (leading to
8491 // "undefined" in the uuid)
8492 // - Invalid input values for the RFC `version` or `variant` fields
8493
8494 if (!validate(uuid)) {
8495 throw TypeError('Stringified UUID is invalid');
8496 }
8497
8498 return uuid;
8499}
8500
8501function v4(options, buf, offset) {
8502 options = options || {};
8503 var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
8504
8505 rnds[6] = rnds[6] & 0x0f | 0x40;
8506 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
8507
8508 if (buf) {
8509 offset = offset || 0;
8510
8511 for (var i = 0; i < 16; ++i) {
8512 buf[offset + i] = rnds[i];
8513 }
8514
8515 return buf;
8516 }
8517
8518 return stringify$3(rnds);
8519}
8520
8521/**
8522 * Determine whether a value can be used as an id.
8523 *
8524 * @param value - Input value of unknown type.
8525 *
8526 * @returns True if the value is valid id, false otherwise.
8527 */
8528function isId(value) {
8529 return typeof value === "string" || typeof value === "number";
8530}
8531
8532/**
8533 * A queue.
8534 *
8535 * @typeParam T - The type of method names to be replaced by queued versions.
8536 */
8537var Queue = /*#__PURE__*/function () {
8538 /**
8539 * Construct a new Queue.
8540 *
8541 * @param options - Queue configuration.
8542 */
8543 function Queue(options) {
8544 classCallCheck(this, Queue);
8545
8546 this._queue = [];
8547 this._timeout = null;
8548 this._extended = null; // options
8549
8550 this.delay = null;
8551 this.max = Infinity;
8552 this.setOptions(options);
8553 }
8554 /**
8555 * Update the configuration of the queue.
8556 *
8557 * @param options - Queue configuration.
8558 */
8559
8560
8561 createClass(Queue, [{
8562 key: "setOptions",
8563 value: function setOptions(options) {
8564 if (options && typeof options.delay !== "undefined") {
8565 this.delay = options.delay;
8566 }
8567
8568 if (options && typeof options.max !== "undefined") {
8569 this.max = options.max;
8570 }
8571
8572 this._flushIfNeeded();
8573 }
8574 /**
8575 * Extend an object with queuing functionality.
8576 * The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.
8577 *
8578 * @param object - The object to be extended.
8579 * @param options - Additional options.
8580 *
8581 * @returns The created queue.
8582 */
8583
8584 }, {
8585 key: "destroy",
8586
8587 /**
8588 * Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object.
8589 */
8590 value: function destroy() {
8591 this.flush();
8592
8593 if (this._extended) {
8594 var object = this._extended.object;
8595 var methods = this._extended.methods;
8596
8597 for (var i = 0; i < methods.length; i++) {
8598 var method = methods[i];
8599
8600 if (method.original) {
8601 // @TODO: better solution?
8602 object[method.name] = method.original;
8603 } else {
8604 // @TODO: better solution?
8605 delete object[method.name];
8606 }
8607 }
8608
8609 this._extended = null;
8610 }
8611 }
8612 /**
8613 * Replace a method on an object with a queued version.
8614 *
8615 * @param object - Object having the method.
8616 * @param method - The method name.
8617 */
8618
8619 }, {
8620 key: "replace",
8621 value: function replace(object, method) {
8622 /* eslint-disable-next-line @typescript-eslint/no-this-alias -- Function this is necessary in the function bellow, so class this has to be saved into a variable here. */
8623 var me = this;
8624 var original = object[method];
8625
8626 if (!original) {
8627 throw new Error("Method " + method + " undefined");
8628 }
8629
8630 object[method] = function () {
8631 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8632 args[_key] = arguments[_key];
8633 }
8634
8635 // add this call to the queue
8636 me.queue({
8637 args: args,
8638 fn: original,
8639 context: this
8640 });
8641 };
8642 }
8643 /**
8644 * Queue a call.
8645 *
8646 * @param entry - The function or entry to be queued.
8647 */
8648
8649 }, {
8650 key: "queue",
8651 value: function queue(entry) {
8652 if (typeof entry === "function") {
8653 this._queue.push({
8654 fn: entry
8655 });
8656 } else {
8657 this._queue.push(entry);
8658 }
8659
8660 this._flushIfNeeded();
8661 }
8662 /**
8663 * Check whether the queue needs to be flushed.
8664 */
8665
8666 }, {
8667 key: "_flushIfNeeded",
8668 value: function _flushIfNeeded() {
8669 var _this = this;
8670
8671 // flush when the maximum is exceeded.
8672 if (this._queue.length > this.max) {
8673 this.flush();
8674 } // flush after a period of inactivity when a delay is configured
8675
8676
8677 if (this._timeout != null) {
8678 clearTimeout(this._timeout);
8679 this._timeout = null;
8680 }
8681
8682 if (this.queue.length > 0 && typeof this.delay === "number") {
8683 this._timeout = setTimeout$2(function () {
8684 _this.flush();
8685 }, this.delay);
8686 }
8687 }
8688 /**
8689 * Flush all queued calls
8690 */
8691
8692 }, {
8693 key: "flush",
8694 value: function flush() {
8695 var _context, _context2;
8696
8697 forEach$2(_context = splice$2(_context2 = this._queue).call(_context2, 0)).call(_context, function (entry) {
8698 entry.fn.apply(entry.context || entry.fn, entry.args || []);
8699 });
8700 }
8701 }], [{
8702 key: "extend",
8703 value: function extend(object, options) {
8704 var queue = new Queue(options);
8705
8706 if (object.flush !== undefined) {
8707 throw new Error("Target object already has a property flush");
8708 }
8709
8710 object.flush = function () {
8711 queue.flush();
8712 };
8713
8714 var methods = [{
8715 name: "flush",
8716 original: undefined
8717 }];
8718
8719 if (options && options.replace) {
8720 for (var i = 0; i < options.replace.length; i++) {
8721 var name = options.replace[i];
8722 methods.push({
8723 name: name,
8724 // @TODO: better solution?
8725 original: object[name]
8726 }); // @TODO: better solution?
8727
8728 queue.replace(object, name);
8729 }
8730 }
8731
8732 queue._extended = {
8733 object: object,
8734 methods: methods
8735 };
8736 return queue;
8737 }
8738 }]);
8739
8740 return Queue;
8741}();
8742
8743/**
8744 * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
8745 *
8746 * @typeParam Item - Item type that may or may not have an id.
8747 * @typeParam IdProp - Name of the property that contains the id.
8748 */
8749var DataSetPart = /*#__PURE__*/function () {
8750 function DataSetPart() {
8751 classCallCheck(this, DataSetPart);
8752
8753 this._subscribers = {
8754 "*": [],
8755 add: [],
8756 remove: [],
8757 update: []
8758 };
8759 /**
8760 * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
8761 */
8762
8763 this.subscribe = DataSetPart.prototype.on;
8764 /**
8765 * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
8766 */
8767
8768 this.unsubscribe = DataSetPart.prototype.off;
8769 }
8770 /**
8771 * Trigger an event
8772 *
8773 * @param event - Event name.
8774 * @param payload - Event payload.
8775 * @param senderId - Id of the sender.
8776 */
8777
8778
8779 createClass(DataSetPart, [{
8780 key: "_trigger",
8781 value: function _trigger(event, payload, senderId) {
8782 var _context, _context2;
8783
8784 if (event === "*") {
8785 throw new Error("Cannot trigger event *");
8786 }
8787
8788 forEach$2(_context = concat$2(_context2 = []).call(_context2, toConsumableArray(this._subscribers[event]), toConsumableArray(this._subscribers["*"]))).call(_context, function (subscriber) {
8789 subscriber(event, payload, senderId != null ? senderId : null);
8790 });
8791 }
8792 /**
8793 * Subscribe to an event, add an event listener.
8794 *
8795 * @remarks Non-function callbacks are ignored.
8796 *
8797 * @param event - Event name.
8798 * @param callback - Callback method.
8799 */
8800
8801 }, {
8802 key: "on",
8803 value: function on(event, callback) {
8804 if (typeof callback === "function") {
8805 this._subscribers[event].push(callback);
8806 } // @TODO: Maybe throw for invalid callbacks?
8807
8808 }
8809 /**
8810 * Unsubscribe from an event, remove an event listener.
8811 *
8812 * @remarks If the same callback was subscribed more than once **all** occurences will be removed.
8813 *
8814 * @param event - Event name.
8815 * @param callback - Callback method.
8816 */
8817
8818 }, {
8819 key: "off",
8820 value: function off(event, callback) {
8821 var _context3;
8822
8823 this._subscribers[event] = filter$2(_context3 = this._subscribers[event]).call(_context3, function (subscriber) {
8824 return subscriber !== callback;
8825 });
8826 }
8827 }]);
8828
8829 return DataSetPart;
8830}();
8831
8832// https://tc39.github.io/ecma262/#sec-set-objects
8833
8834
8835var es_set = collection('Set', function (init) {
8836 return function Set() {
8837 return init(this, arguments.length ? arguments[0] : undefined);
8838 };
8839}, collectionStrong);
8840
8841var set$1 = path.Set;
8842
8843var set$2 = set$1;
8844
8845var set$3 = set$2;
8846
8847function _createForOfIteratorHelper$1(o, allowArrayLike) { var it; if (typeof symbol$4 === "undefined" || getIteratorMethod$1(o) == null) { if (isArray$5(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = getIterator$1(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8848
8849function _unsupportedIterableToArray$2(o, minLen) { var _context10; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = slice$6(_context10 = Object.prototype.toString.call(o)).call(_context10, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
8850
8851function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8852
8853/**
8854 * Data stream
8855 *
8856 * @remarks
8857 * [[DataStream]] offers an always up to date stream of items from a [[DataSet]] or [[DataView]].
8858 * That means that the stream is evaluated at the time of iteration, conversion to another data type or when [[cache]] is called, not when the [[DataStream]] was created.
8859 * Multiple invocations of for example [[toItemArray]] may yield different results (if the data source like for example [[DataSet]] gets modified).
8860 *
8861 * @typeParam Item - The item type this stream is going to work with.
8862 */
8863var DataStream = /*#__PURE__*/function () {
8864 /**
8865 * Create a new data stream.
8866 *
8867 * @param pairs - The id, item pairs.
8868 */
8869 function DataStream(pairs) {
8870 classCallCheck(this, DataStream);
8871
8872 this._pairs = pairs;
8873 }
8874 /**
8875 * Return an iterable of key, value pairs for every entry in the stream.
8876 */
8877
8878
8879 createClass(DataStream, [{
8880 key: iterator$4,
8881 value: /*#__PURE__*/regenerator.mark(function value() {
8882 var _iterator, _step, _step$value, id, item;
8883
8884 return regenerator.wrap(function value$(_context) {
8885 while (1) {
8886 switch (_context.prev = _context.next) {
8887 case 0:
8888 _iterator = _createForOfIteratorHelper$1(this._pairs);
8889 _context.prev = 1;
8890
8891 _iterator.s();
8892
8893 case 3:
8894 if ((_step = _iterator.n()).done) {
8895 _context.next = 9;
8896 break;
8897 }
8898
8899 _step$value = slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1];
8900 _context.next = 7;
8901 return [id, item];
8902
8903 case 7:
8904 _context.next = 3;
8905 break;
8906
8907 case 9:
8908 _context.next = 14;
8909 break;
8910
8911 case 11:
8912 _context.prev = 11;
8913 _context.t0 = _context["catch"](1);
8914
8915 _iterator.e(_context.t0);
8916
8917 case 14:
8918 _context.prev = 14;
8919
8920 _iterator.f();
8921
8922 return _context.finish(14);
8923
8924 case 17:
8925 case "end":
8926 return _context.stop();
8927 }
8928 }
8929 }, value, this, [[1, 11, 14, 17]]);
8930 })
8931 /**
8932 * Return an iterable of key, value pairs for every entry in the stream.
8933 */
8934
8935 }, {
8936 key: "entries",
8937 value: /*#__PURE__*/regenerator.mark(function entries() {
8938 var _iterator2, _step2, _step2$value, id, item;
8939
8940 return regenerator.wrap(function entries$(_context2) {
8941 while (1) {
8942 switch (_context2.prev = _context2.next) {
8943 case 0:
8944 _iterator2 = _createForOfIteratorHelper$1(this._pairs);
8945 _context2.prev = 1;
8946
8947 _iterator2.s();
8948
8949 case 3:
8950 if ((_step2 = _iterator2.n()).done) {
8951 _context2.next = 9;
8952 break;
8953 }
8954
8955 _step2$value = slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1];
8956 _context2.next = 7;
8957 return [id, item];
8958
8959 case 7:
8960 _context2.next = 3;
8961 break;
8962
8963 case 9:
8964 _context2.next = 14;
8965 break;
8966
8967 case 11:
8968 _context2.prev = 11;
8969 _context2.t0 = _context2["catch"](1);
8970
8971 _iterator2.e(_context2.t0);
8972
8973 case 14:
8974 _context2.prev = 14;
8975
8976 _iterator2.f();
8977
8978 return _context2.finish(14);
8979
8980 case 17:
8981 case "end":
8982 return _context2.stop();
8983 }
8984 }
8985 }, entries, this, [[1, 11, 14, 17]]);
8986 })
8987 /**
8988 * Return an iterable of keys in the stream.
8989 */
8990
8991 }, {
8992 key: "keys",
8993 value: /*#__PURE__*/regenerator.mark(function keys() {
8994 var _iterator3, _step3, _step3$value, id;
8995
8996 return regenerator.wrap(function keys$(_context3) {
8997 while (1) {
8998 switch (_context3.prev = _context3.next) {
8999 case 0:
9000 _iterator3 = _createForOfIteratorHelper$1(this._pairs);
9001 _context3.prev = 1;
9002
9003 _iterator3.s();
9004
9005 case 3:
9006 if ((_step3 = _iterator3.n()).done) {
9007 _context3.next = 9;
9008 break;
9009 }
9010
9011 _step3$value = slicedToArray(_step3.value, 1), id = _step3$value[0];
9012 _context3.next = 7;
9013 return id;
9014
9015 case 7:
9016 _context3.next = 3;
9017 break;
9018
9019 case 9:
9020 _context3.next = 14;
9021 break;
9022
9023 case 11:
9024 _context3.prev = 11;
9025 _context3.t0 = _context3["catch"](1);
9026
9027 _iterator3.e(_context3.t0);
9028
9029 case 14:
9030 _context3.prev = 14;
9031
9032 _iterator3.f();
9033
9034 return _context3.finish(14);
9035
9036 case 17:
9037 case "end":
9038 return _context3.stop();
9039 }
9040 }
9041 }, keys, this, [[1, 11, 14, 17]]);
9042 })
9043 /**
9044 * Return an iterable of values in the stream.
9045 */
9046
9047 }, {
9048 key: "values",
9049 value: /*#__PURE__*/regenerator.mark(function values() {
9050 var _iterator4, _step4, _step4$value, item;
9051
9052 return regenerator.wrap(function values$(_context4) {
9053 while (1) {
9054 switch (_context4.prev = _context4.next) {
9055 case 0:
9056 _iterator4 = _createForOfIteratorHelper$1(this._pairs);
9057 _context4.prev = 1;
9058
9059 _iterator4.s();
9060
9061 case 3:
9062 if ((_step4 = _iterator4.n()).done) {
9063 _context4.next = 9;
9064 break;
9065 }
9066
9067 _step4$value = slicedToArray(_step4.value, 2), item = _step4$value[1];
9068 _context4.next = 7;
9069 return item;
9070
9071 case 7:
9072 _context4.next = 3;
9073 break;
9074
9075 case 9:
9076 _context4.next = 14;
9077 break;
9078
9079 case 11:
9080 _context4.prev = 11;
9081 _context4.t0 = _context4["catch"](1);
9082
9083 _iterator4.e(_context4.t0);
9084
9085 case 14:
9086 _context4.prev = 14;
9087
9088 _iterator4.f();
9089
9090 return _context4.finish(14);
9091
9092 case 17:
9093 case "end":
9094 return _context4.stop();
9095 }
9096 }
9097 }, values, this, [[1, 11, 14, 17]]);
9098 })
9099 /**
9100 * Return an array containing all the ids in this stream.
9101 *
9102 * @remarks
9103 * The array may contain duplicities.
9104 *
9105 * @returns The array with all ids from this stream.
9106 */
9107
9108 }, {
9109 key: "toIdArray",
9110 value: function toIdArray() {
9111 var _context5;
9112
9113 return map$2(_context5 = toConsumableArray(this._pairs)).call(_context5, function (pair) {
9114 return pair[0];
9115 });
9116 }
9117 /**
9118 * Return an array containing all the items in this stream.
9119 *
9120 * @remarks
9121 * The array may contain duplicities.
9122 *
9123 * @returns The array with all items from this stream.
9124 */
9125
9126 }, {
9127 key: "toItemArray",
9128 value: function toItemArray() {
9129 var _context6;
9130
9131 return map$2(_context6 = toConsumableArray(this._pairs)).call(_context6, function (pair) {
9132 return pair[1];
9133 });
9134 }
9135 /**
9136 * Return an array containing all the entries in this stream.
9137 *
9138 * @remarks
9139 * The array may contain duplicities.
9140 *
9141 * @returns The array with all entries from this stream.
9142 */
9143
9144 }, {
9145 key: "toEntryArray",
9146 value: function toEntryArray() {
9147 return toConsumableArray(this._pairs);
9148 }
9149 /**
9150 * Return an object map containing all the items in this stream accessible by ids.
9151 *
9152 * @remarks
9153 * In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object.
9154 *
9155 * @returns The object map of all id → item pairs from this stream.
9156 */
9157
9158 }, {
9159 key: "toObjectMap",
9160 value: function toObjectMap() {
9161 var map = create$2(null);
9162
9163 var _iterator5 = _createForOfIteratorHelper$1(this._pairs),
9164 _step5;
9165
9166 try {
9167 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
9168 var _step5$value = slicedToArray(_step5.value, 2),
9169 id = _step5$value[0],
9170 item = _step5$value[1];
9171
9172 map[id] = item;
9173 }
9174 } catch (err) {
9175 _iterator5.e(err);
9176 } finally {
9177 _iterator5.f();
9178 }
9179
9180 return map;
9181 }
9182 /**
9183 * Return a map containing all the items in this stream accessible by ids.
9184 *
9185 * @returns The map of all id → item pairs from this stream.
9186 */
9187
9188 }, {
9189 key: "toMap",
9190 value: function toMap() {
9191 return new map$5(this._pairs);
9192 }
9193 /**
9194 * Return a set containing all the (unique) ids in this stream.
9195 *
9196 * @returns The set of all ids from this stream.
9197 */
9198
9199 }, {
9200 key: "toIdSet",
9201 value: function toIdSet() {
9202 return new set$3(this.toIdArray());
9203 }
9204 /**
9205 * Return a set containing all the (unique) items in this stream.
9206 *
9207 * @returns The set of all items from this stream.
9208 */
9209
9210 }, {
9211 key: "toItemSet",
9212 value: function toItemSet() {
9213 return new set$3(this.toItemArray());
9214 }
9215 /**
9216 * Cache the items from this stream.
9217 *
9218 * @remarks
9219 * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
9220 * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
9221 *
9222 * ## Example
9223 * ```javascript
9224 * const ds = new DataSet([…])
9225 *
9226 * const cachedStream = ds.stream()
9227 * .filter(…)
9228 * .sort(…)
9229 * .map(…)
9230 * .cached(…) // Data are fetched, processed and cached here.
9231 *
9232 * ds.clear()
9233 * chachedStream // Still has all the items.
9234 * ```
9235 *
9236 * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
9237 */
9238
9239 }, {
9240 key: "cache",
9241 value: function cache() {
9242 return new DataStream(toConsumableArray(this._pairs));
9243 }
9244 /**
9245 * Get the distinct values of given property.
9246 *
9247 * @param callback - The function that picks and possibly converts the property.
9248 *
9249 * @typeParam T - The type of the distinct value.
9250 *
9251 * @returns A set of all distinct properties.
9252 */
9253
9254 }, {
9255 key: "distinct",
9256 value: function distinct(callback) {
9257 var set = new set$3();
9258
9259 var _iterator6 = _createForOfIteratorHelper$1(this._pairs),
9260 _step6;
9261
9262 try {
9263 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
9264 var _step6$value = slicedToArray(_step6.value, 2),
9265 id = _step6$value[0],
9266 item = _step6$value[1];
9267
9268 set.add(callback(item, id));
9269 }
9270 } catch (err) {
9271 _iterator6.e(err);
9272 } finally {
9273 _iterator6.f();
9274 }
9275
9276 return set;
9277 }
9278 /**
9279 * Filter the items of the stream.
9280 *
9281 * @param callback - The function that decides whether an item will be included.
9282 *
9283 * @returns A new data stream with the filtered items.
9284 */
9285
9286 }, {
9287 key: "filter",
9288 value: function filter(callback) {
9289 var pairs = this._pairs;
9290 return new DataStream(defineProperty$7({}, iterator$4, /*#__PURE__*/regenerator.mark(function _callee() {
9291 var _iterator7, _step7, _step7$value, id, item;
9292
9293 return regenerator.wrap(function _callee$(_context7) {
9294 while (1) {
9295 switch (_context7.prev = _context7.next) {
9296 case 0:
9297 _iterator7 = _createForOfIteratorHelper$1(pairs);
9298 _context7.prev = 1;
9299
9300 _iterator7.s();
9301
9302 case 3:
9303 if ((_step7 = _iterator7.n()).done) {
9304 _context7.next = 10;
9305 break;
9306 }
9307
9308 _step7$value = slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1];
9309
9310 if (!callback(item, id)) {
9311 _context7.next = 8;
9312 break;
9313 }
9314
9315 _context7.next = 8;
9316 return [id, item];
9317
9318 case 8:
9319 _context7.next = 3;
9320 break;
9321
9322 case 10:
9323 _context7.next = 15;
9324 break;
9325
9326 case 12:
9327 _context7.prev = 12;
9328 _context7.t0 = _context7["catch"](1);
9329
9330 _iterator7.e(_context7.t0);
9331
9332 case 15:
9333 _context7.prev = 15;
9334
9335 _iterator7.f();
9336
9337 return _context7.finish(15);
9338
9339 case 18:
9340 case "end":
9341 return _context7.stop();
9342 }
9343 }
9344 }, _callee, null, [[1, 12, 15, 18]]);
9345 })));
9346 }
9347 /**
9348 * Execute a callback for each item of the stream.
9349 *
9350 * @param callback - The function that will be invoked for each item.
9351 */
9352
9353 }, {
9354 key: "forEach",
9355 value: function forEach(callback) {
9356 var _iterator8 = _createForOfIteratorHelper$1(this._pairs),
9357 _step8;
9358
9359 try {
9360 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
9361 var _step8$value = slicedToArray(_step8.value, 2),
9362 id = _step8$value[0],
9363 item = _step8$value[1];
9364
9365 callback(item, id);
9366 }
9367 } catch (err) {
9368 _iterator8.e(err);
9369 } finally {
9370 _iterator8.f();
9371 }
9372 }
9373 /**
9374 * Map the items into a different type.
9375 *
9376 * @param callback - The function that does the conversion.
9377 *
9378 * @typeParam Mapped - The type of the item after mapping.
9379 *
9380 * @returns A new data stream with the mapped items.
9381 */
9382
9383 }, {
9384 key: "map",
9385 value: function map(callback) {
9386 var pairs = this._pairs;
9387 return new DataStream(defineProperty$7({}, iterator$4, /*#__PURE__*/regenerator.mark(function _callee2() {
9388 var _iterator9, _step9, _step9$value, id, item;
9389
9390 return regenerator.wrap(function _callee2$(_context8) {
9391 while (1) {
9392 switch (_context8.prev = _context8.next) {
9393 case 0:
9394 _iterator9 = _createForOfIteratorHelper$1(pairs);
9395 _context8.prev = 1;
9396
9397 _iterator9.s();
9398
9399 case 3:
9400 if ((_step9 = _iterator9.n()).done) {
9401 _context8.next = 9;
9402 break;
9403 }
9404
9405 _step9$value = slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1];
9406 _context8.next = 7;
9407 return [id, callback(item, id)];
9408
9409 case 7:
9410 _context8.next = 3;
9411 break;
9412
9413 case 9:
9414 _context8.next = 14;
9415 break;
9416
9417 case 11:
9418 _context8.prev = 11;
9419 _context8.t0 = _context8["catch"](1);
9420
9421 _iterator9.e(_context8.t0);
9422
9423 case 14:
9424 _context8.prev = 14;
9425
9426 _iterator9.f();
9427
9428 return _context8.finish(14);
9429
9430 case 17:
9431 case "end":
9432 return _context8.stop();
9433 }
9434 }
9435 }, _callee2, null, [[1, 11, 14, 17]]);
9436 })));
9437 }
9438 /**
9439 * Get the item with the maximum value of given property.
9440 *
9441 * @param callback - The function that picks and possibly converts the property.
9442 *
9443 * @returns The item with the maximum if found otherwise null.
9444 */
9445
9446 }, {
9447 key: "max",
9448 value: function max(callback) {
9449 var iter = getIterator$1(this._pairs);
9450
9451 var curr = iter.next();
9452
9453 if (curr.done) {
9454 return null;
9455 }
9456
9457 var maxItem = curr.value[1];
9458 var maxValue = callback(curr.value[1], curr.value[0]);
9459
9460 while (!(curr = iter.next()).done) {
9461 var _curr$value = slicedToArray(curr.value, 2),
9462 id = _curr$value[0],
9463 item = _curr$value[1];
9464
9465 var _value = callback(item, id);
9466
9467 if (_value > maxValue) {
9468 maxValue = _value;
9469 maxItem = item;
9470 }
9471 }
9472
9473 return maxItem;
9474 }
9475 /**
9476 * Get the item with the minimum value of given property.
9477 *
9478 * @param callback - The function that picks and possibly converts the property.
9479 *
9480 * @returns The item with the minimum if found otherwise null.
9481 */
9482
9483 }, {
9484 key: "min",
9485 value: function min(callback) {
9486 var iter = getIterator$1(this._pairs);
9487
9488 var curr = iter.next();
9489
9490 if (curr.done) {
9491 return null;
9492 }
9493
9494 var minItem = curr.value[1];
9495 var minValue = callback(curr.value[1], curr.value[0]);
9496
9497 while (!(curr = iter.next()).done) {
9498 var _curr$value2 = slicedToArray(curr.value, 2),
9499 id = _curr$value2[0],
9500 item = _curr$value2[1];
9501
9502 var _value2 = callback(item, id);
9503
9504 if (_value2 < minValue) {
9505 minValue = _value2;
9506 minItem = item;
9507 }
9508 }
9509
9510 return minItem;
9511 }
9512 /**
9513 * Reduce the items into a single value.
9514 *
9515 * @param callback - The function that does the reduction.
9516 * @param accumulator - The initial value of the accumulator.
9517 *
9518 * @typeParam T - The type of the accumulated value.
9519 *
9520 * @returns The reduced value.
9521 */
9522
9523 }, {
9524 key: "reduce",
9525 value: function reduce(callback, accumulator) {
9526 var _iterator10 = _createForOfIteratorHelper$1(this._pairs),
9527 _step10;
9528
9529 try {
9530 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
9531 var _step10$value = slicedToArray(_step10.value, 2),
9532 id = _step10$value[0],
9533 item = _step10$value[1];
9534
9535 accumulator = callback(accumulator, item, id);
9536 }
9537 } catch (err) {
9538 _iterator10.e(err);
9539 } finally {
9540 _iterator10.f();
9541 }
9542
9543 return accumulator;
9544 }
9545 /**
9546 * Sort the items.
9547 *
9548 * @param callback - Item comparator.
9549 *
9550 * @returns A new stream with sorted items.
9551 */
9552
9553 }, {
9554 key: "sort",
9555 value: function sort(callback) {
9556 var _this = this;
9557
9558 return new DataStream(defineProperty$7({}, iterator$4, function () {
9559 var _context9;
9560
9561 return getIterator$1(sort$2(_context9 = toConsumableArray(_this._pairs)).call(_context9, function (_ref, _ref2) {
9562 var _ref3 = slicedToArray(_ref, 2),
9563 idA = _ref3[0],
9564 itemA = _ref3[1];
9565
9566 var _ref4 = slicedToArray(_ref2, 2),
9567 idB = _ref4[0],
9568 itemB = _ref4[1];
9569
9570 return callback(itemA, itemB, idA, idB);
9571 }));
9572 }));
9573 }
9574 }]);
9575
9576 return DataStream;
9577}();
9578
9579function ownKeys$4(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); if (enumerableOnly) symbols = filter$2(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
9580
9581function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context10; forEach$2(_context10 = ownKeys$4(Object(source), true)).call(_context10, function (key) { defineProperty$7(target, key, source[key]); }); } else if (getOwnPropertyDescriptors$2) { defineProperties$1(target, getOwnPropertyDescriptors$2(source)); } else { var _context11; forEach$2(_context11 = ownKeys$4(Object(source))).call(_context11, function (key) { defineProperty$4(target, key, getOwnPropertyDescriptor$3(source, key)); }); } } return target; }
9582
9583function _createForOfIteratorHelper$2(o, allowArrayLike) { var it; if (typeof symbol$4 === "undefined" || getIteratorMethod$1(o) == null) { if (isArray$5(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = getIterator$1(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9584
9585function _unsupportedIterableToArray$3(o, minLen) { var _context9; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = slice$6(_context9 = Object.prototype.toString.call(o)).call(_context9, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
9586
9587function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
9588
9589function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf$3(this).constructor; result = construct$3(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
9590
9591function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct$3) return false; if (construct$3.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(construct$3(Date, [], function () {})); return true; } catch (e) { return false; } }
9592/**
9593 * Add an id to given item if it doesn't have one already.
9594 *
9595 * @remarks
9596 * The item will be modified.
9597 *
9598 * @param item - The item that will have an id after a call to this function.
9599 * @param idProp - The key of the id property.
9600 *
9601 * @typeParam Item - Item type that may or may not have an id.
9602 * @typeParam IdProp - Name of the property that contains the id.
9603 *
9604 * @returns true
9605 */
9606
9607function ensureFullItem(item, idProp) {
9608 if (item[idProp] == null) {
9609 // generate an id
9610 item[idProp] = v4();
9611 }
9612
9613 return item;
9614}
9615/**
9616 * # DataSet
9617 *
9618 * Vis.js comes with a flexible DataSet, which can be used to hold and
9619 * manipulate unstructured data and listen for changes in the data. The DataSet
9620 * is key/value based. Data items can be added, updated and removed from the
9621 * DataSet, and one can subscribe to changes in the DataSet. The data in the
9622 * DataSet can be filtered and ordered. Data can be normalized when appending it
9623 * to the DataSet as well.
9624 *
9625 * ## Example
9626 *
9627 * The following example shows how to use a DataSet.
9628 *
9629 * ```javascript
9630 * // create a DataSet
9631 * var options = {};
9632 * var data = new vis.DataSet(options);
9633 *
9634 * // add items
9635 * // note that the data items can contain different properties and data formats
9636 * data.add([
9637 * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
9638 * {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
9639 * {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
9640 * {id: 4, text: 'item 4'}
9641 * ]);
9642 *
9643 * // subscribe to any change in the DataSet
9644 * data.on('*', function (event, properties, senderId) {
9645 * console.log('event', event, properties);
9646 * });
9647 *
9648 * // update an existing item
9649 * data.update({id: 2, group: 1});
9650 *
9651 * // remove an item
9652 * data.remove(4);
9653 *
9654 * // get all ids
9655 * var ids = data.getIds();
9656 * console.log('ids', ids);
9657 *
9658 * // get a specific item
9659 * var item1 = data.get(1);
9660 * console.log('item1', item1);
9661 *
9662 * // retrieve a filtered subset of the data
9663 * var items = data.get({
9664 * filter: function (item) {
9665 * return item.group == 1;
9666 * }
9667 * });
9668 * console.log('filtered items', items);
9669 * ```
9670 *
9671 * @typeParam Item - Item type that may or may not have an id.
9672 * @typeParam IdProp - Name of the property that contains the id.
9673 */
9674
9675
9676var DataSet = /*#__PURE__*/function (_DataSetPart) {
9677 inherits(DataSet, _DataSetPart);
9678
9679 var _super = _createSuper(DataSet);
9680
9681 /**
9682 * Construct a new DataSet.
9683 *
9684 * @param data - Initial data or options.
9685 * @param options - Options (type error if data is also options).
9686 */
9687 function DataSet(data, options) {
9688 var _this;
9689
9690 classCallCheck(this, DataSet);
9691
9692 _this = _super.call(this);
9693 _this._queue = null; // correctly read optional arguments
9694
9695 if (data && !isArray$5(data)) {
9696 options = data;
9697 data = [];
9698 }
9699
9700 _this._options = options || {};
9701 _this._data = new map$5(); // map with data indexed by id
9702
9703 _this.length = 0; // number of items in the DataSet
9704
9705 _this._idProp = _this._options.fieldId || "id"; // name of the field containing id
9706 // add initial data when provided
9707
9708 if (data && data.length) {
9709 _this.add(data);
9710 }
9711
9712 _this.setOptions(options);
9713
9714 return _this;
9715 }
9716 /** @inheritDoc */
9717
9718
9719 createClass(DataSet, [{
9720 key: "setOptions",
9721
9722 /**
9723 * Set new options.
9724 *
9725 * @param options - The new options.
9726 */
9727 value: function setOptions(options) {
9728 if (options && options.queue !== undefined) {
9729 if (options.queue === false) {
9730 // delete queue if loaded
9731 if (this._queue) {
9732 this._queue.destroy();
9733
9734 this._queue = null;
9735 }
9736 } else {
9737 // create queue and update its options
9738 if (!this._queue) {
9739 this._queue = Queue.extend(this, {
9740 replace: ["add", "update", "remove"]
9741 });
9742 }
9743
9744 if (options.queue && _typeof_1(options.queue) === "object") {
9745 this._queue.setOptions(options.queue);
9746 }
9747 }
9748 }
9749 }
9750 /**
9751 * Add a data item or an array with items.
9752 *
9753 * After the items are added to the DataSet, the DataSet will trigger an event `add`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
9754 *
9755 * ## Example
9756 *
9757 * ```javascript
9758 * // create a DataSet
9759 * const data = new vis.DataSet()
9760 *
9761 * // add items
9762 * const ids = data.add([
9763 * { id: 1, text: 'item 1' },
9764 * { id: 2, text: 'item 2' },
9765 * { text: 'item without an id' }
9766 * ])
9767 *
9768 * console.log(ids) // [1, 2, '<UUIDv4>']
9769 * ```
9770 *
9771 * @param data - Items to be added (ids will be generated if missing).
9772 * @param senderId - Sender id.
9773 *
9774 * @returns addedIds - Array with the ids (generated if not present) of the added items.
9775 *
9776 * @throws When an item with the same id as any of the added items already exists.
9777 */
9778
9779 }, {
9780 key: "add",
9781 value: function add(data, senderId) {
9782 var _this2 = this;
9783
9784 var addedIds = [];
9785 var id;
9786
9787 if (isArray$5(data)) {
9788 // Array
9789 var idsToAdd = map$2(data).call(data, function (d) {
9790 return d[_this2._idProp];
9791 });
9792
9793 if (some$2(idsToAdd).call(idsToAdd, function (id) {
9794 return _this2._data.has(id);
9795 })) {
9796 throw new Error("A duplicate id was found in the parameter array.");
9797 }
9798
9799 for (var i = 0, len = data.length; i < len; i++) {
9800 id = this._addItem(data[i]);
9801 addedIds.push(id);
9802 }
9803 } else if (data && _typeof_1(data) === "object") {
9804 // Single item
9805 id = this._addItem(data);
9806 addedIds.push(id);
9807 } else {
9808 throw new Error("Unknown dataType");
9809 }
9810
9811 if (addedIds.length) {
9812 this._trigger("add", {
9813 items: addedIds
9814 }, senderId);
9815 }
9816
9817 return addedIds;
9818 }
9819 /**
9820 * Update existing items. When an item does not exist, it will be created.
9821 *
9822 * @remarks
9823 * The provided properties will be merged in the existing item. When an item does not exist, it will be created.
9824 *
9825 * After the items are updated, the DataSet will trigger an event `add` for the added items, and an event `update`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
9826 *
9827 * ## Example
9828 *
9829 * ```javascript
9830 * // create a DataSet
9831 * const data = new vis.DataSet([
9832 * { id: 1, text: 'item 1' },
9833 * { id: 2, text: 'item 2' },
9834 * { id: 3, text: 'item 3' }
9835 * ])
9836 *
9837 * // update items
9838 * const ids = data.update([
9839 * { id: 2, text: 'item 2 (updated)' },
9840 * { id: 4, text: 'item 4 (new)' }
9841 * ])
9842 *
9843 * console.log(ids) // [2, 4]
9844 * ```
9845 *
9846 * ## Warning for TypeScript users
9847 * This method may introduce partial items into the data set. Use add or updateOnly instead for better type safety.
9848 *
9849 * @param data - Items to be updated (if the id is already present) or added (if the id is missing).
9850 * @param senderId - Sender id.
9851 *
9852 * @returns updatedIds - The ids of the added (these may be newly generated if there was no id in the item from the data) or updated items.
9853 *
9854 * @throws When the supplied data is neither an item nor an array of items.
9855 */
9856
9857 }, {
9858 key: "update",
9859 value: function update(data, senderId) {
9860 var _this3 = this;
9861
9862 var addedIds = [];
9863 var updatedIds = [];
9864 var oldData = [];
9865 var updatedData = [];
9866 var idProp = this._idProp;
9867
9868 var addOrUpdate = function addOrUpdate(item) {
9869 var origId = item[idProp];
9870
9871 if (origId != null && _this3._data.has(origId)) {
9872 var fullItem = item; // it has an id, therefore it is a fullitem
9873
9874 var oldItem = assign$2({}, _this3._data.get(origId)); // update item
9875
9876
9877 var id = _this3._updateItem(fullItem);
9878
9879 updatedIds.push(id);
9880 updatedData.push(fullItem);
9881 oldData.push(oldItem);
9882 } else {
9883 // add new item
9884 var _id = _this3._addItem(item);
9885
9886 addedIds.push(_id);
9887 }
9888 };
9889
9890 if (isArray$5(data)) {
9891 // Array
9892 for (var i = 0, len = data.length; i < len; i++) {
9893 if (data[i] && _typeof_1(data[i]) === "object") {
9894 addOrUpdate(data[i]);
9895 } else {
9896 console.warn("Ignoring input item, which is not an object at index " + i);
9897 }
9898 }
9899 } else if (data && _typeof_1(data) === "object") {
9900 // Single item
9901 addOrUpdate(data);
9902 } else {
9903 throw new Error("Unknown dataType");
9904 }
9905
9906 if (addedIds.length) {
9907 this._trigger("add", {
9908 items: addedIds
9909 }, senderId);
9910 }
9911
9912 if (updatedIds.length) {
9913 var props = {
9914 items: updatedIds,
9915 oldData: oldData,
9916 data: updatedData
9917 }; // TODO: remove deprecated property 'data' some day
9918 //Object.defineProperty(props, 'data', {
9919 // 'get': (function() {
9920 // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
9921 // return updatedData;
9922 // }).bind(this)
9923 //});
9924
9925 this._trigger("update", props, senderId);
9926 }
9927
9928 return concat$2(addedIds).call(addedIds, updatedIds);
9929 }
9930 /**
9931 * Update existing items. When an item does not exist, an error will be thrown.
9932 *
9933 * @remarks
9934 * The provided properties will be deeply merged into the existing item.
9935 * When an item does not exist (id not present in the data set or absent), an error will be thrown and nothing will be changed.
9936 *
9937 * After the items are updated, the DataSet will trigger an event `update`.
9938 * When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
9939 *
9940 * ## Example
9941 *
9942 * ```javascript
9943 * // create a DataSet
9944 * const data = new vis.DataSet([
9945 * { id: 1, text: 'item 1' },
9946 * { id: 2, text: 'item 2' },
9947 * { id: 3, text: 'item 3' },
9948 * ])
9949 *
9950 * // update items
9951 * const ids = data.update([
9952 * { id: 2, text: 'item 2 (updated)' }, // works
9953 * // { id: 4, text: 'item 4 (new)' }, // would throw
9954 * // { text: 'item 4 (new)' }, // would also throw
9955 * ])
9956 *
9957 * console.log(ids) // [2]
9958 * ```
9959 *
9960 * @param data - Updates (the id and optionally other props) to the items in this data set.
9961 * @param senderId - Sender id.
9962 *
9963 * @returns updatedIds - The ids of the updated items.
9964 *
9965 * @throws When the supplied data is neither an item nor an array of items, when the ids are missing.
9966 */
9967
9968 }, {
9969 key: "updateOnly",
9970 value: function updateOnly(data, senderId) {
9971 var _context,
9972 _this4 = this;
9973
9974 if (!isArray$5(data)) {
9975 data = [data];
9976 }
9977
9978 var updateEventData = map$2(_context = map$2(data).call(data, function (update) {
9979 var oldData = _this4._data.get(update[_this4._idProp]);
9980
9981 if (oldData == null) {
9982 throw new Error("Updating non-existent items is not allowed.");
9983 }
9984
9985 return {
9986 oldData: oldData,
9987 update: update
9988 };
9989 })).call(_context, function (_ref) {
9990 var oldData = _ref.oldData,
9991 update = _ref.update;
9992 var id = oldData[_this4._idProp];
9993 var updatedData = pureDeepObjectAssign(oldData, update);
9994
9995 _this4._data.set(id, updatedData);
9996
9997 return {
9998 id: id,
9999 oldData: oldData,
10000 updatedData: updatedData
10001 };
10002 });
10003
10004 if (updateEventData.length) {
10005 var props = {
10006 items: map$2(updateEventData).call(updateEventData, function (value) {
10007 return value.id;
10008 }),
10009 oldData: map$2(updateEventData).call(updateEventData, function (value) {
10010 return value.oldData;
10011 }),
10012 data: map$2(updateEventData).call(updateEventData, function (value) {
10013 return value.updatedData;
10014 })
10015 }; // TODO: remove deprecated property 'data' some day
10016 //Object.defineProperty(props, 'data', {
10017 // 'get': (function() {
10018 // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
10019 // return updatedData;
10020 // }).bind(this)
10021 //});
10022
10023 this._trigger("update", props, senderId);
10024
10025 return props.items;
10026 } else {
10027 return [];
10028 }
10029 }
10030 /** @inheritDoc */
10031
10032 }, {
10033 key: "get",
10034 value: function get(first, second) {
10035 // @TODO: Woudn't it be better to split this into multiple methods?
10036 // parse the arguments
10037 var id = undefined;
10038 var ids = undefined;
10039 var options = undefined;
10040
10041 if (isId(first)) {
10042 // get(id [, options])
10043 id = first;
10044 options = second;
10045 } else if (isArray$5(first)) {
10046 // get(ids [, options])
10047 ids = first;
10048 options = second;
10049 } else {
10050 // get([, options])
10051 options = first;
10052 } // determine the return type
10053
10054
10055 var returnType = options && options.returnType === "Object" ? "Object" : "Array"; // @TODO: WTF is this? Or am I missing something?
10056 // var returnType
10057 // if (options && options.returnType) {
10058 // var allowedValues = ['Array', 'Object']
10059 // returnType =
10060 // allowedValues.indexOf(options.returnType) == -1
10061 // ? 'Array'
10062 // : options.returnType
10063 // } else {
10064 // returnType = 'Array'
10065 // }
10066 // build options
10067
10068 var filter = options && filter$2(options);
10069
10070 var items = [];
10071 var item = undefined;
10072 var itemIds = undefined;
10073 var itemId = undefined; // convert items
10074
10075 if (id != null) {
10076 // return a single item
10077 item = this._data.get(id);
10078
10079 if (item && filter && !filter(item)) {
10080 item = undefined;
10081 }
10082 } else if (ids != null) {
10083 // return a subset of items
10084 for (var i = 0, len = ids.length; i < len; i++) {
10085 item = this._data.get(ids[i]);
10086
10087 if (item != null && (!filter || filter(item))) {
10088 items.push(item);
10089 }
10090 }
10091 } else {
10092 var _context2;
10093
10094 // return all items
10095 itemIds = toConsumableArray(keys$6(_context2 = this._data).call(_context2));
10096
10097 for (var _i = 0, _len = itemIds.length; _i < _len; _i++) {
10098 itemId = itemIds[_i];
10099 item = this._data.get(itemId);
10100
10101 if (item != null && (!filter || filter(item))) {
10102 items.push(item);
10103 }
10104 }
10105 } // order the results
10106
10107
10108 if (options && options.order && id == undefined) {
10109 this._sort(items, options.order);
10110 } // filter fields of the items
10111
10112
10113 if (options && options.fields) {
10114 var fields = options.fields;
10115
10116 if (id != undefined && item != null) {
10117 item = this._filterFields(item, fields);
10118 } else {
10119 for (var _i2 = 0, _len2 = items.length; _i2 < _len2; _i2++) {
10120 items[_i2] = this._filterFields(items[_i2], fields);
10121 }
10122 }
10123 } // return the results
10124
10125
10126 if (returnType == "Object") {
10127 var result = {};
10128
10129 for (var _i3 = 0, _len3 = items.length; _i3 < _len3; _i3++) {
10130 var resultant = items[_i3]; // @TODO: Shoudn't this be this._fieldId?
10131 // result[resultant.id] = resultant
10132
10133 var _id2 = resultant[this._idProp];
10134 result[_id2] = resultant;
10135 }
10136
10137 return result;
10138 } else {
10139 if (id != null) {
10140 var _item;
10141
10142 // a single item
10143 return (_item = item) !== null && _item !== void 0 ? _item : null;
10144 } else {
10145 // just return our array
10146 return items;
10147 }
10148 }
10149 }
10150 /** @inheritDoc */
10151
10152 }, {
10153 key: "getIds",
10154 value: function getIds(options) {
10155 var data = this._data;
10156
10157 var filter = options && filter$2(options);
10158
10159 var order = options && options.order;
10160
10161 var itemIds = toConsumableArray(keys$6(data).call(data));
10162
10163 var ids = [];
10164
10165 if (filter) {
10166 // get filtered items
10167 if (order) {
10168 // create ordered list
10169 var items = [];
10170
10171 for (var i = 0, len = itemIds.length; i < len; i++) {
10172 var id = itemIds[i];
10173
10174 var item = this._data.get(id);
10175
10176 if (item != null && filter(item)) {
10177 items.push(item);
10178 }
10179 }
10180
10181 this._sort(items, order);
10182
10183 for (var _i4 = 0, _len4 = items.length; _i4 < _len4; _i4++) {
10184 ids.push(items[_i4][this._idProp]);
10185 }
10186 } else {
10187 // create unordered list
10188 for (var _i5 = 0, _len5 = itemIds.length; _i5 < _len5; _i5++) {
10189 var _id3 = itemIds[_i5];
10190
10191 var _item2 = this._data.get(_id3);
10192
10193 if (_item2 != null && filter(_item2)) {
10194 ids.push(_item2[this._idProp]);
10195 }
10196 }
10197 }
10198 } else {
10199 // get all items
10200 if (order) {
10201 // create an ordered list
10202 var _items = [];
10203
10204 for (var _i6 = 0, _len6 = itemIds.length; _i6 < _len6; _i6++) {
10205 var _id4 = itemIds[_i6];
10206
10207 _items.push(data.get(_id4));
10208 }
10209
10210 this._sort(_items, order);
10211
10212 for (var _i7 = 0, _len7 = _items.length; _i7 < _len7; _i7++) {
10213 ids.push(_items[_i7][this._idProp]);
10214 }
10215 } else {
10216 // create unordered list
10217 for (var _i8 = 0, _len8 = itemIds.length; _i8 < _len8; _i8++) {
10218 var _id5 = itemIds[_i8];
10219
10220 var _item3 = data.get(_id5);
10221
10222 if (_item3 != null) {
10223 ids.push(_item3[this._idProp]);
10224 }
10225 }
10226 }
10227 }
10228
10229 return ids;
10230 }
10231 /** @inheritDoc */
10232
10233 }, {
10234 key: "getDataSet",
10235 value: function getDataSet() {
10236 return this;
10237 }
10238 /** @inheritDoc */
10239
10240 }, {
10241 key: "forEach",
10242 value: function forEach(callback, options) {
10243 var filter = options && filter$2(options);
10244
10245 var data = this._data;
10246
10247 var itemIds = toConsumableArray(keys$6(data).call(data));
10248
10249 if (options && options.order) {
10250 // execute forEach on ordered list
10251 var items = this.get(options);
10252
10253 for (var i = 0, len = items.length; i < len; i++) {
10254 var item = items[i];
10255 var id = item[this._idProp];
10256 callback(item, id);
10257 }
10258 } else {
10259 // unordered
10260 for (var _i9 = 0, _len9 = itemIds.length; _i9 < _len9; _i9++) {
10261 var _id6 = itemIds[_i9];
10262
10263 var _item4 = this._data.get(_id6);
10264
10265 if (_item4 != null && (!filter || filter(_item4))) {
10266 callback(_item4, _id6);
10267 }
10268 }
10269 }
10270 }
10271 /** @inheritDoc */
10272
10273 }, {
10274 key: "map",
10275 value: function map(callback, options) {
10276 var filter = options && filter$2(options);
10277
10278 var mappedItems = [];
10279 var data = this._data;
10280
10281 var itemIds = toConsumableArray(keys$6(data).call(data)); // convert and filter items
10282
10283
10284 for (var i = 0, len = itemIds.length; i < len; i++) {
10285 var id = itemIds[i];
10286
10287 var item = this._data.get(id);
10288
10289 if (item != null && (!filter || filter(item))) {
10290 mappedItems.push(callback(item, id));
10291 }
10292 } // order items
10293
10294
10295 if (options && options.order) {
10296 this._sort(mappedItems, options.order);
10297 }
10298
10299 return mappedItems;
10300 }
10301 /**
10302 * Filter the fields of an item.
10303 *
10304 * @param item - The item whose fields should be filtered.
10305 * @param fields - The names of the fields that will be kept.
10306 *
10307 * @typeParam K - Field name type.
10308 *
10309 * @returns The item without any additional fields.
10310 */
10311
10312 }, {
10313 key: "_filterFields",
10314 value: function _filterFields(item, fields) {
10315 var _context3;
10316
10317 if (!item) {
10318 // item is null
10319 return item;
10320 }
10321
10322 return reduce$2(_context3 = isArray$5(fields) ? // Use the supplied array
10323 fields : // Use the keys of the supplied object
10324 keys$3(fields)).call(_context3, function (filteredItem, field) {
10325 filteredItem[field] = item[field];
10326 return filteredItem;
10327 }, {});
10328 }
10329 /**
10330 * Sort the provided array with items.
10331 *
10332 * @param items - Items to be sorted in place.
10333 * @param order - A field name or custom sort function.
10334 *
10335 * @typeParam T - The type of the items in the items array.
10336 */
10337
10338 }, {
10339 key: "_sort",
10340 value: function _sort(items, order) {
10341 if (typeof order === "string") {
10342 // order by provided field name
10343 var name = order; // field name
10344
10345 sort$2(items).call(items, function (a, b) {
10346 // @TODO: How to treat missing properties?
10347 var av = a[name];
10348 var bv = b[name];
10349 return av > bv ? 1 : av < bv ? -1 : 0;
10350 });
10351 } else if (typeof order === "function") {
10352 // order by sort function
10353 sort$2(items).call(items, order);
10354 } else {
10355 // TODO: extend order by an Object {field:string, direction:string}
10356 // where direction can be 'asc' or 'desc'
10357 throw new TypeError("Order must be a function or a string");
10358 }
10359 }
10360 /**
10361 * Remove an item or multiple items by “reference” (only the id is used) or by id.
10362 *
10363 * The method ignores removal of non-existing items, and returns an array containing the ids of the items which are actually removed from the DataSet.
10364 *
10365 * After the items are removed, the DataSet will trigger an event `remove` for the removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
10366 *
10367 * ## Example
10368 * ```javascript
10369 * // create a DataSet
10370 * const data = new vis.DataSet([
10371 * { id: 1, text: 'item 1' },
10372 * { id: 2, text: 'item 2' },
10373 * { id: 3, text: 'item 3' }
10374 * ])
10375 *
10376 * // remove items
10377 * const ids = data.remove([2, { id: 3 }, 4])
10378 *
10379 * console.log(ids) // [2, 3]
10380 * ```
10381 *
10382 * @param id - One or more items or ids of items to be removed.
10383 * @param senderId - Sender id.
10384 *
10385 * @returns The ids of the removed items.
10386 */
10387
10388 }, {
10389 key: "remove",
10390 value: function remove(id, senderId) {
10391 var removedIds = [];
10392 var removedItems = []; // force everything to be an array for simplicity
10393
10394 var ids = isArray$5(id) ? id : [id];
10395
10396 for (var i = 0, len = ids.length; i < len; i++) {
10397 var item = this._remove(ids[i]);
10398
10399 if (item) {
10400 var itemId = item[this._idProp];
10401
10402 if (itemId != null) {
10403 removedIds.push(itemId);
10404 removedItems.push(item);
10405 }
10406 }
10407 }
10408
10409 if (removedIds.length) {
10410 this._trigger("remove", {
10411 items: removedIds,
10412 oldData: removedItems
10413 }, senderId);
10414 }
10415
10416 return removedIds;
10417 }
10418 /**
10419 * Remove an item by its id or reference.
10420 *
10421 * @param id - Id of an item or the item itself.
10422 *
10423 * @returns The removed item if removed, null otherwise.
10424 */
10425
10426 }, {
10427 key: "_remove",
10428 value: function _remove(id) {
10429 // @TODO: It origianlly returned the item although the docs say id.
10430 // The code expects the item, so probably an error in the docs.
10431 var ident; // confirm the id to use based on the args type
10432
10433 if (isId(id)) {
10434 ident = id;
10435 } else if (id && _typeof_1(id) === "object") {
10436 ident = id[this._idProp]; // look for the identifier field using ._idProp
10437 } // do the removing if the item is found
10438
10439
10440 if (ident != null && this._data.has(ident)) {
10441 var item = this._data.get(ident) || null;
10442
10443 this._data.delete(ident);
10444
10445 --this.length;
10446 return item;
10447 }
10448
10449 return null;
10450 }
10451 /**
10452 * Clear the entire data set.
10453 *
10454 * After the items are removed, the [[DataSet]] will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
10455 *
10456 * @param senderId - Sender id.
10457 *
10458 * @returns removedIds - The ids of all removed items.
10459 */
10460
10461 }, {
10462 key: "clear",
10463 value: function clear(senderId) {
10464 var _context4;
10465
10466 var ids = toConsumableArray(keys$6(_context4 = this._data).call(_context4));
10467
10468 var items = [];
10469
10470 for (var i = 0, len = ids.length; i < len; i++) {
10471 items.push(this._data.get(ids[i]));
10472 }
10473
10474 this._data.clear();
10475
10476 this.length = 0;
10477
10478 this._trigger("remove", {
10479 items: ids,
10480 oldData: items
10481 }, senderId);
10482
10483 return ids;
10484 }
10485 /**
10486 * Find the item with maximum value of a specified field.
10487 *
10488 * @param field - Name of the property that should be searched for max value.
10489 *
10490 * @returns Item containing max value, or null if no items.
10491 */
10492
10493 }, {
10494 key: "max",
10495 value: function max(field) {
10496 var _context5;
10497
10498 var max = null;
10499 var maxField = null;
10500
10501 var _iterator = _createForOfIteratorHelper$2(values$3(_context5 = this._data).call(_context5)),
10502 _step;
10503
10504 try {
10505 for (_iterator.s(); !(_step = _iterator.n()).done;) {
10506 var item = _step.value;
10507 var itemField = item[field];
10508
10509 if (typeof itemField === "number" && (maxField == null || itemField > maxField)) {
10510 max = item;
10511 maxField = itemField;
10512 }
10513 }
10514 } catch (err) {
10515 _iterator.e(err);
10516 } finally {
10517 _iterator.f();
10518 }
10519
10520 return max || null;
10521 }
10522 /**
10523 * Find the item with minimum value of a specified field.
10524 *
10525 * @param field - Name of the property that should be searched for min value.
10526 *
10527 * @returns Item containing min value, or null if no items.
10528 */
10529
10530 }, {
10531 key: "min",
10532 value: function min(field) {
10533 var _context6;
10534
10535 var min = null;
10536 var minField = null;
10537
10538 var _iterator2 = _createForOfIteratorHelper$2(values$3(_context6 = this._data).call(_context6)),
10539 _step2;
10540
10541 try {
10542 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
10543 var item = _step2.value;
10544 var itemField = item[field];
10545
10546 if (typeof itemField === "number" && (minField == null || itemField < minField)) {
10547 min = item;
10548 minField = itemField;
10549 }
10550 }
10551 } catch (err) {
10552 _iterator2.e(err);
10553 } finally {
10554 _iterator2.f();
10555 }
10556
10557 return min || null;
10558 }
10559 /**
10560 * Find all distinct values of a specified field
10561 *
10562 * @param prop - The property name whose distinct values should be returned.
10563 *
10564 * @returns Unordered array containing all distinct values. Items without specified property are ignored.
10565 */
10566
10567 }, {
10568 key: "distinct",
10569 value: function distinct(prop) {
10570 var data = this._data;
10571
10572 var itemIds = toConsumableArray(keys$6(data).call(data));
10573
10574 var values = [];
10575 var count = 0;
10576
10577 for (var i = 0, len = itemIds.length; i < len; i++) {
10578 var id = itemIds[i];
10579 var item = data.get(id);
10580 var value = item[prop];
10581 var exists = false;
10582
10583 for (var j = 0; j < count; j++) {
10584 if (values[j] == value) {
10585 exists = true;
10586 break;
10587 }
10588 }
10589
10590 if (!exists && value !== undefined) {
10591 values[count] = value;
10592 count++;
10593 }
10594 }
10595
10596 return values;
10597 }
10598 /**
10599 * Add a single item. Will fail when an item with the same id already exists.
10600 *
10601 * @param item - A new item to be added.
10602 *
10603 * @returns Added item's id. An id is generated when it is not present in the item.
10604 */
10605
10606 }, {
10607 key: "_addItem",
10608 value: function _addItem(item) {
10609 var fullItem = ensureFullItem(item, this._idProp);
10610 var id = fullItem[this._idProp]; // check whether this id is already taken
10611
10612 if (this._data.has(id)) {
10613 // item already exists
10614 throw new Error("Cannot add item: item with id " + id + " already exists");
10615 }
10616
10617 this._data.set(id, fullItem);
10618
10619 ++this.length;
10620 return id;
10621 }
10622 /**
10623 * Update a single item: merge with existing item.
10624 * Will fail when the item has no id, or when there does not exist an item with the same id.
10625 *
10626 * @param update - The new item
10627 *
10628 * @returns The id of the updated item.
10629 */
10630
10631 }, {
10632 key: "_updateItem",
10633 value: function _updateItem(update) {
10634 var id = update[this._idProp];
10635
10636 if (id == null) {
10637 throw new Error("Cannot update item: item has no id (item: " + stringify$2(update) + ")");
10638 }
10639
10640 var item = this._data.get(id);
10641
10642 if (!item) {
10643 // item doesn't exist
10644 throw new Error("Cannot update item: no item with id " + id + " found");
10645 }
10646
10647 this._data.set(id, _objectSpread(_objectSpread({}, item), update));
10648
10649 return id;
10650 }
10651 /** @inheritDoc */
10652
10653 }, {
10654 key: "stream",
10655 value: function stream(ids) {
10656 if (ids) {
10657 var data = this._data;
10658 return new DataStream(defineProperty$7({}, iterator$4, /*#__PURE__*/regenerator.mark(function _callee() {
10659 var _iterator3, _step3, id, item;
10660
10661 return regenerator.wrap(function _callee$(_context7) {
10662 while (1) {
10663 switch (_context7.prev = _context7.next) {
10664 case 0:
10665 _iterator3 = _createForOfIteratorHelper$2(ids);
10666 _context7.prev = 1;
10667
10668 _iterator3.s();
10669
10670 case 3:
10671 if ((_step3 = _iterator3.n()).done) {
10672 _context7.next = 11;
10673 break;
10674 }
10675
10676 id = _step3.value;
10677 item = data.get(id);
10678
10679 if (!(item != null)) {
10680 _context7.next = 9;
10681 break;
10682 }
10683
10684 _context7.next = 9;
10685 return [id, item];
10686
10687 case 9:
10688 _context7.next = 3;
10689 break;
10690
10691 case 11:
10692 _context7.next = 16;
10693 break;
10694
10695 case 13:
10696 _context7.prev = 13;
10697 _context7.t0 = _context7["catch"](1);
10698
10699 _iterator3.e(_context7.t0);
10700
10701 case 16:
10702 _context7.prev = 16;
10703
10704 _iterator3.f();
10705
10706 return _context7.finish(16);
10707
10708 case 19:
10709 case "end":
10710 return _context7.stop();
10711 }
10712 }
10713 }, _callee, null, [[1, 13, 16, 19]]);
10714 })));
10715 } else {
10716 var _context8;
10717
10718 return new DataStream(defineProperty$7({}, iterator$4, bind$2(_context8 = entries$2(this._data)).call(_context8, this._data)));
10719 }
10720 }
10721 }, {
10722 key: "idProp",
10723 get: function get() {
10724 return this._idProp;
10725 }
10726 }]);
10727
10728 return DataSet;
10729}(DataSetPart);
10730
10731function _createForOfIteratorHelper$3(o, allowArrayLike) { var it; if (typeof symbol$4 === "undefined" || getIteratorMethod$1(o) == null) { if (isArray$5(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = getIterator$1(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10732
10733function _unsupportedIterableToArray$4(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = slice$6(_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
10734
10735function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10736
10737function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf$3(this).constructor; result = construct$3(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
10738
10739function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !construct$3) return false; if (construct$3.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(construct$3(Date, [], function () {})); return true; } catch (e) { return false; } }
10740/**
10741 * DataView
10742 *
10743 * A DataView offers a filtered and/or formatted view on a DataSet. One can subscribe to changes in a DataView, and easily get filtered or formatted data without having to specify filters and field types all the time.
10744 *
10745 * ## Example
10746 * ```javascript
10747 * // create a DataSet
10748 * var data = new vis.DataSet();
10749 * data.add([
10750 * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
10751 * {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
10752 * {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
10753 * {id: 4, text: 'item 4'}
10754 * ]);
10755 *
10756 * // create a DataView
10757 * // the view will only contain items having a property group with value 1,
10758 * // and will only output fields id, text, and date.
10759 * var view = new vis.DataView(data, {
10760 * filter: function (item) {
10761 * return (item.group == 1);
10762 * },
10763 * fields: ['id', 'text', 'date']
10764 * });
10765 *
10766 * // subscribe to any change in the DataView
10767 * view.on('*', function (event, properties, senderId) {
10768 * console.log('event', event, properties);
10769 * });
10770 *
10771 * // update an item in the data set
10772 * data.update({id: 2, group: 1});
10773 *
10774 * // get all ids in the view
10775 * var ids = view.getIds();
10776 * console.log('ids', ids); // will output [1, 2]
10777 *
10778 * // get all items in the view
10779 * var items = view.get();
10780 * ```
10781 *
10782 * @typeParam Item - Item type that may or may not have an id.
10783 * @typeParam IdProp - Name of the property that contains the id.
10784 */
10785
10786var DataView = /*#__PURE__*/function (_DataSetPart) {
10787 inherits(DataView, _DataSetPart);
10788
10789 var _super = _createSuper$1(DataView);
10790
10791 /**
10792 * Create a DataView.
10793 *
10794 * @param data - The instance containing data (directly or indirectly).
10795 * @param options - Options to configure this data view.
10796 */
10797 function DataView(data, options) {
10798 var _context;
10799
10800 var _this;
10801
10802 classCallCheck(this, DataView);
10803
10804 _this = _super.call(this);
10805 /** @inheritDoc */
10806
10807 _this.length = 0;
10808 _this._ids = new set$3(); // ids of the items currently in memory (just contains a boolean true)
10809
10810 _this._options = options || {};
10811 _this._listener = bind$2(_context = _this._onEvent).call(_context, assertThisInitialized(_this));
10812
10813 _this.setData(data);
10814
10815 return _this;
10816 }
10817 /** @inheritDoc */
10818
10819
10820 createClass(DataView, [{
10821 key: "setData",
10822 // TODO: implement a function .config() to dynamically update things like configured filter
10823 // and trigger changes accordingly
10824
10825 /**
10826 * Set a data source for the view.
10827 *
10828 * @param data - The instance containing data (directly or indirectly).
10829 *
10830 * @remarks
10831 * Note that when the data view is bound to a data set it won't be garbage
10832 * collected unless the data set is too. Use `dataView.setData(null)` or
10833 * `dataView.dispose()` to enable garbage collection before you lose the last
10834 * reference.
10835 */
10836 value: function setData(data) {
10837 if (this._data) {
10838 // unsubscribe from current dataset
10839 if (this._data.off) {
10840 this._data.off("*", this._listener);
10841 } // trigger a remove of all items in memory
10842
10843
10844 var ids = this._data.getIds({
10845 filter: filter$2(this._options)
10846 });
10847
10848 var items = this._data.get(ids);
10849
10850 this._ids.clear();
10851
10852 this.length = 0;
10853
10854 this._trigger("remove", {
10855 items: ids,
10856 oldData: items
10857 });
10858 }
10859
10860 if (data != null) {
10861 this._data = data; // trigger an add of all added items
10862
10863 var _ids = this._data.getIds({
10864 filter: filter$2(this._options)
10865 });
10866
10867 for (var i = 0, len = _ids.length; i < len; i++) {
10868 var id = _ids[i];
10869
10870 this._ids.add(id);
10871 }
10872
10873 this.length = _ids.length;
10874
10875 this._trigger("add", {
10876 items: _ids
10877 });
10878 } else {
10879 this._data = new DataSet();
10880 } // subscribe to new dataset
10881
10882
10883 if (this._data.on) {
10884 this._data.on("*", this._listener);
10885 }
10886 }
10887 /**
10888 * Refresh the DataView.
10889 * Useful when the DataView has a filter function containing a variable parameter.
10890 */
10891
10892 }, {
10893 key: "refresh",
10894 value: function refresh() {
10895 var ids = this._data.getIds({
10896 filter: filter$2(this._options)
10897 });
10898
10899 var oldIds = toConsumableArray(this._ids);
10900
10901 var newIds = {};
10902 var addedIds = [];
10903 var removedIds = [];
10904 var removedItems = []; // check for additions
10905
10906 for (var i = 0, len = ids.length; i < len; i++) {
10907 var id = ids[i];
10908 newIds[id] = true;
10909
10910 if (!this._ids.has(id)) {
10911 addedIds.push(id);
10912
10913 this._ids.add(id);
10914 }
10915 } // check for removals
10916
10917
10918 for (var _i = 0, _len = oldIds.length; _i < _len; _i++) {
10919 var _id = oldIds[_i];
10920
10921 var item = this._data.get(_id);
10922
10923 if (item == null) {
10924 // @TODO: Investigate.
10925 // Doesn't happen during tests or examples.
10926 // Is it really impossible or could it eventually happen?
10927 // How to handle it if it does? The types guarantee non-nullable items.
10928 console.error("If you see this, report it please.");
10929 } else if (!newIds[_id]) {
10930 removedIds.push(_id);
10931 removedItems.push(item);
10932
10933 this._ids.delete(_id);
10934 }
10935 }
10936
10937 this.length += addedIds.length - removedIds.length; // trigger events
10938
10939 if (addedIds.length) {
10940 this._trigger("add", {
10941 items: addedIds
10942 });
10943 }
10944
10945 if (removedIds.length) {
10946 this._trigger("remove", {
10947 items: removedIds,
10948 oldData: removedItems
10949 });
10950 }
10951 }
10952 /** @inheritDoc */
10953
10954 }, {
10955 key: "get",
10956 value: function get(first, second) {
10957 if (this._data == null) {
10958 return null;
10959 } // parse the arguments
10960
10961
10962 var ids = null;
10963 var options;
10964
10965 if (isId(first) || isArray$5(first)) {
10966 ids = first;
10967 options = second;
10968 } else {
10969 options = first;
10970 } // extend the options with the default options and provided options
10971
10972
10973 var viewOptions = assign$2({}, this._options, options); // create a combined filter method when needed
10974
10975
10976 var thisFilter = filter$2(this._options);
10977
10978 var optionsFilter = options && filter$2(options);
10979
10980 if (thisFilter && optionsFilter) {
10981 viewOptions.filter = function (item) {
10982 return thisFilter(item) && optionsFilter(item);
10983 };
10984 }
10985
10986 if (ids == null) {
10987 return this._data.get(viewOptions);
10988 } else {
10989 return this._data.get(ids, viewOptions);
10990 }
10991 }
10992 /** @inheritDoc */
10993
10994 }, {
10995 key: "getIds",
10996 value: function getIds(options) {
10997 if (this._data.length) {
10998 var defaultFilter = filter$2(this._options);
10999
11000 var optionsFilter = options != null ? filter$2(options) : null;
11001 var filter;
11002
11003 if (optionsFilter) {
11004 if (defaultFilter) {
11005 filter = function filter(item) {
11006 return defaultFilter(item) && optionsFilter(item);
11007 };
11008 } else {
11009 filter = optionsFilter;
11010 }
11011 } else {
11012 filter = defaultFilter;
11013 }
11014
11015 return this._data.getIds({
11016 filter: filter,
11017 order: options && options.order
11018 });
11019 } else {
11020 return [];
11021 }
11022 }
11023 /** @inheritDoc */
11024
11025 }, {
11026 key: "forEach",
11027 value: function forEach(callback, options) {
11028 if (this._data) {
11029 var _context2;
11030
11031 var defaultFilter = filter$2(this._options);
11032
11033 var optionsFilter = options && filter$2(options);
11034
11035 var filter;
11036
11037 if (optionsFilter) {
11038 if (defaultFilter) {
11039 filter = function filter(item) {
11040 return defaultFilter(item) && optionsFilter(item);
11041 };
11042 } else {
11043 filter = optionsFilter;
11044 }
11045 } else {
11046 filter = defaultFilter;
11047 }
11048
11049 forEach$2(_context2 = this._data).call(_context2, callback, {
11050 filter: filter,
11051 order: options && options.order
11052 });
11053 }
11054 }
11055 /** @inheritDoc */
11056
11057 }, {
11058 key: "map",
11059 value: function map(callback, options) {
11060 if (this._data) {
11061 var _context3;
11062
11063 var defaultFilter = filter$2(this._options);
11064
11065 var optionsFilter = options && filter$2(options);
11066
11067 var filter;
11068
11069 if (optionsFilter) {
11070 if (defaultFilter) {
11071 filter = function filter(item) {
11072 return defaultFilter(item) && optionsFilter(item);
11073 };
11074 } else {
11075 filter = optionsFilter;
11076 }
11077 } else {
11078 filter = defaultFilter;
11079 }
11080
11081 return map$2(_context3 = this._data).call(_context3, callback, {
11082 filter: filter,
11083 order: options && options.order
11084 });
11085 } else {
11086 return [];
11087 }
11088 }
11089 /** @inheritDoc */
11090
11091 }, {
11092 key: "getDataSet",
11093 value: function getDataSet() {
11094 return this._data.getDataSet();
11095 }
11096 /** @inheritDoc */
11097
11098 }, {
11099 key: "stream",
11100 value: function stream(ids) {
11101 var _context4;
11102
11103 return this._data.stream(ids || defineProperty$7({}, iterator$4, bind$2(_context4 = keys$6(this._ids)).call(_context4, this._ids)));
11104 }
11105 /**
11106 * Render the instance unusable prior to garbage collection.
11107 *
11108 * @remarks
11109 * The intention of this method is to help discover scenarios where the data
11110 * view is being used when the programmer thinks it has been garbage collected
11111 * already. It's stricter version of `dataView.setData(null)`.
11112 */
11113
11114 }, {
11115 key: "dispose",
11116 value: function dispose() {
11117 var _this$_data;
11118
11119 if ((_this$_data = this._data) !== null && _this$_data !== void 0 && _this$_data.off) {
11120 this._data.off("*", this._listener);
11121 }
11122
11123 var message = "This data view has already been disposed of.";
11124 var replacement = {
11125 get: function get() {
11126 throw new Error(message);
11127 },
11128 set: function set() {
11129 throw new Error(message);
11130 },
11131 configurable: false
11132 };
11133
11134 var _iterator = _createForOfIteratorHelper$3(ownKeys$3(DataView.prototype)),
11135 _step;
11136
11137 try {
11138 for (_iterator.s(); !(_step = _iterator.n()).done;) {
11139 var key = _step.value;
11140
11141 defineProperty$4(this, key, replacement);
11142 }
11143 } catch (err) {
11144 _iterator.e(err);
11145 } finally {
11146 _iterator.f();
11147 }
11148 }
11149 /**
11150 * Event listener. Will propagate all events from the connected data set to the subscribers of the DataView, but will filter the items and only trigger when there are changes in the filtered data set.
11151 *
11152 * @param event - The name of the event.
11153 * @param params - Parameters of the event.
11154 * @param senderId - Id supplied by the sender.
11155 */
11156
11157 }, {
11158 key: "_onEvent",
11159 value: function _onEvent(event, params, senderId) {
11160 if (!params || !params.items || !this._data) {
11161 return;
11162 }
11163
11164 var ids = params.items;
11165 var addedIds = [];
11166 var updatedIds = [];
11167 var removedIds = [];
11168 var oldItems = [];
11169 var updatedItems = [];
11170 var removedItems = [];
11171
11172 switch (event) {
11173 case "add":
11174 // filter the ids of the added items
11175 for (var i = 0, len = ids.length; i < len; i++) {
11176 var id = ids[i];
11177 var item = this.get(id);
11178
11179 if (item) {
11180 this._ids.add(id);
11181
11182 addedIds.push(id);
11183 }
11184 }
11185
11186 break;
11187
11188 case "update":
11189 // determine the event from the views viewpoint: an updated
11190 // item can be added, updated, or removed from this view.
11191 for (var _i2 = 0, _len2 = ids.length; _i2 < _len2; _i2++) {
11192 var _id2 = ids[_i2];
11193
11194 var _item = this.get(_id2);
11195
11196 if (_item) {
11197 if (this._ids.has(_id2)) {
11198 updatedIds.push(_id2);
11199 updatedItems.push(params.data[_i2]);
11200 oldItems.push(params.oldData[_i2]);
11201 } else {
11202 this._ids.add(_id2);
11203
11204 addedIds.push(_id2);
11205 }
11206 } else {
11207 if (this._ids.has(_id2)) {
11208 this._ids.delete(_id2);
11209
11210 removedIds.push(_id2);
11211 removedItems.push(params.oldData[_i2]);
11212 }
11213 }
11214 }
11215
11216 break;
11217
11218 case "remove":
11219 // filter the ids of the removed items
11220 for (var _i3 = 0, _len3 = ids.length; _i3 < _len3; _i3++) {
11221 var _id3 = ids[_i3];
11222
11223 if (this._ids.has(_id3)) {
11224 this._ids.delete(_id3);
11225
11226 removedIds.push(_id3);
11227 removedItems.push(params.oldData[_i3]);
11228 }
11229 }
11230
11231 break;
11232 }
11233
11234 this.length += addedIds.length - removedIds.length;
11235
11236 if (addedIds.length) {
11237 this._trigger("add", {
11238 items: addedIds
11239 }, senderId);
11240 }
11241
11242 if (updatedIds.length) {
11243 this._trigger("update", {
11244 items: updatedIds,
11245 oldData: oldItems,
11246 data: updatedItems
11247 }, senderId);
11248 }
11249
11250 if (removedIds.length) {
11251 this._trigger("remove", {
11252 items: removedIds,
11253 oldData: removedItems
11254 }, senderId);
11255 }
11256 }
11257 }, {
11258 key: "idProp",
11259 get: function get() {
11260 return this.getDataSet().idProp;
11261 }
11262 }]);
11263
11264 return DataView;
11265}(DataSetPart);
11266
11267/**
11268 * Check that given value is compatible with Vis Data Set interface.
11269 *
11270 * @param idProp - The expected property to contain item id.
11271 * @param v - The value to be tested.
11272 *
11273 * @returns True if all expected values and methods match, false otherwise.
11274 */
11275function isDataSetLike(idProp, v) {
11276 return _typeof_1(v) === "object" && v !== null && idProp === v.idProp && typeof v.add === "function" && typeof v.clear === "function" && typeof v.distinct === "function" && typeof forEach$2(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$2(v) === "function" && typeof v.max === "function" && typeof v.min === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.remove === "function" && typeof v.setOptions === "function" && typeof v.stream === "function" && typeof v.update === "function" && typeof v.updateOnly === "function";
11277}
11278
11279/**
11280 * Check that given value is compatible with Vis Data View interface.
11281 *
11282 * @param idProp - The expected property to contain item id.
11283 * @param v - The value to be tested.
11284 *
11285 * @returns True if all expected values and methods match, false otherwise.
11286 */
11287
11288function isDataViewLike(idProp, v) {
11289 return _typeof_1(v) === "object" && v !== null && idProp === v.idProp && typeof forEach$2(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$2(v) === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.stream === "function" && isDataSetLike(idProp, v.getDataSet());
11290}
11291
11292export { DELETE, DataSet, DataStream, DataView, Queue, createNewDataPipeFrom, isDataSetLike, isDataViewLike };
11293//# sourceMappingURL=vis-data.js.map