UNPKG

958 kBJavaScriptView Raw
1/**
2 * vis-graph3d - data
3 * http://visjs.org/
4 *
5 * Create interactive, animated 3d graphs. Surfaces, lines, dots and block styling out of the box.
6 *
7 * @version 5.3.5
8 * @date 2019-11-28T20:28:48Z
9 *
10 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
11 * @copyright (c) 2018-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, module) {
30 return module = {
31 exports: {}
32 }, fn(module, module.exports), module.exports;
33}
34
35var check = function (it) {
36 return it && it.Math == Math && it;
37}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
38
39
40var global_1 = // eslint-disable-next-line no-undef
41check(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
42Function('return this')();
43
44var fails = function (exec) {
45 try {
46 return !!exec();
47 } catch (error) {
48 return true;
49 }
50}; // Thank's IE8 for his funny defineProperty
51
52
53var descriptors = !fails(function () {
54 return Object.defineProperty({}, 'a', {
55 get: function () {
56 return 7;
57 }
58 }).a != 7;
59});
60var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
61var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
62
63var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({
64 1: 2
65}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
66// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
67
68var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
69 var descriptor = getOwnPropertyDescriptor(this, V);
70 return !!descriptor && descriptor.enumerable;
71} : nativePropertyIsEnumerable;
72var objectPropertyIsEnumerable = {
73 f: f
74};
75
76var createPropertyDescriptor = function (bitmap, value) {
77 return {
78 enumerable: !(bitmap & 1),
79 configurable: !(bitmap & 2),
80 writable: !(bitmap & 4),
81 value: value
82 };
83};
84
85var toString = {}.toString;
86
87var classofRaw = function (it) {
88 return toString.call(it).slice(8, -1);
89};
90
91var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
92
93var indexedObject = fails(function () {
94 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
95 // eslint-disable-next-line no-prototype-builtins
96 return !Object('z').propertyIsEnumerable(0);
97}) ? function (it) {
98 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
99} : Object; // `RequireObjectCoercible` abstract operation
100// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
101
102var requireObjectCoercible = function (it) {
103 if (it == undefined) throw TypeError("Can't call method on " + it);
104 return it;
105}; // toObject with fallback for non-array-like ES3 strings
106
107
108var toIndexedObject = function (it) {
109 return indexedObject(requireObjectCoercible(it));
110};
111
112var isObject = function (it) {
113 return typeof it === 'object' ? it !== null : typeof it === 'function';
114}; // `ToPrimitive` abstract operation
115// https://tc39.github.io/ecma262/#sec-toprimitive
116// instead of the ES6 spec version, we didn't implement @@toPrimitive case
117// and the second argument - flag - preferred type is a string
118
119
120var toPrimitive = function (input, PREFERRED_STRING) {
121 if (!isObject(input)) return input;
122 var fn, val;
123 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
124 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
125 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
126 throw TypeError("Can't convert object to primitive value");
127};
128
129var hasOwnProperty = {}.hasOwnProperty;
130
131var has = function (it, key) {
132 return hasOwnProperty.call(it, key);
133};
134
135var document$1 = global_1.document; // typeof document.createElement is 'object' in old IE
136
137var EXISTS = isObject(document$1) && isObject(document$1.createElement);
138
139var documentCreateElement = function (it) {
140 return EXISTS ? document$1.createElement(it) : {};
141}; // Thank's IE8 for his funny defineProperty
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});
151var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
152// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
153
154var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
155 O = toIndexedObject(O);
156 P = toPrimitive(P, true);
157 if (ie8DomDefine) try {
158 return nativeGetOwnPropertyDescriptor(O, P);
159 } catch (error) {
160 /* empty */
161 }
162 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
163};
164var objectGetOwnPropertyDescriptor = {
165 f: f$1
166};
167var replacement = /#|\.prototype\./;
168
169var isForced = function (feature, detection) {
170 var value = data[normalize(feature)];
171 return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
172};
173
174var normalize = isForced.normalize = function (string) {
175 return String(string).replace(replacement, '.').toLowerCase();
176};
177
178var data = isForced.data = {};
179var NATIVE = isForced.NATIVE = 'N';
180var POLYFILL = isForced.POLYFILL = 'P';
181var isForced_1 = isForced;
182var path = {};
183
184var aFunction = function (it) {
185 if (typeof it != 'function') {
186 throw TypeError(String(it) + ' is not a function');
187 }
188
189 return it;
190}; // optional / simple context binding
191
192
193var bindContext = function (fn, that, length) {
194 aFunction(fn);
195 if (that === undefined) return fn;
196
197 switch (length) {
198 case 0:
199 return function () {
200 return fn.call(that);
201 };
202
203 case 1:
204 return function (a) {
205 return fn.call(that, a);
206 };
207
208 case 2:
209 return function (a, b) {
210 return fn.call(that, a, b);
211 };
212
213 case 3:
214 return function (a, b, c) {
215 return fn.call(that, a, b, c);
216 };
217 }
218
219 return function ()
220 /* ...args */
221 {
222 return fn.apply(that, arguments);
223 };
224};
225
226var anObject = function (it) {
227 if (!isObject(it)) {
228 throw TypeError(String(it) + ' is not an object');
229 }
230
231 return it;
232};
233
234var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method
235// https://tc39.github.io/ecma262/#sec-object.defineproperty
236
237var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
238 anObject(O);
239 P = toPrimitive(P, true);
240 anObject(Attributes);
241 if (ie8DomDefine) try {
242 return nativeDefineProperty(O, P, Attributes);
243 } catch (error) {
244 /* empty */
245 }
246 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
247 if ('value' in Attributes) O[P] = Attributes.value;
248 return O;
249};
250var objectDefineProperty = {
251 f: f$2
252};
253var createNonEnumerableProperty = descriptors ? function (object, key, value) {
254 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
255} : function (object, key, value) {
256 object[key] = value;
257 return object;
258};
259var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
260
261var wrapConstructor = function (NativeConstructor) {
262 var Wrapper = function (a, b, c) {
263 if (this instanceof NativeConstructor) {
264 switch (arguments.length) {
265 case 0:
266 return new NativeConstructor();
267
268 case 1:
269 return new NativeConstructor(a);
270
271 case 2:
272 return new NativeConstructor(a, b);
273 }
274
275 return new NativeConstructor(a, b, c);
276 }
277
278 return NativeConstructor.apply(this, arguments);
279 };
280
281 Wrapper.prototype = NativeConstructor.prototype;
282 return Wrapper;
283};
284/*
285 options.target - name of the target object
286 options.global - target is the global object
287 options.stat - export as static methods of target
288 options.proto - export as prototype methods of target
289 options.real - real prototype method for the `pure` version
290 options.forced - export even if the native feature is available
291 options.bind - bind methods to the target, required for the `pure` version
292 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
293 options.unsafe - use the simple assignment of property instead of delete + defineProperty
294 options.sham - add a flag to not completely full polyfills
295 options.enumerable - export as enumerable property
296 options.noTargetGet - prevent calling a getter on target
297*/
298
299
300var _export = function (options, source) {
301 var TARGET = options.target;
302 var GLOBAL = options.global;
303 var STATIC = options.stat;
304 var PROTO = options.proto;
305 var nativeSource = GLOBAL ? global_1 : STATIC ? global_1[TARGET] : (global_1[TARGET] || {}).prototype;
306 var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
307 var targetPrototype = target.prototype;
308 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
309 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
310
311 for (key in source) {
312 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native
313
314 USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key);
315 targetProperty = target[key];
316 if (USE_NATIVE) if (options.noTargetGet) {
317 descriptor = getOwnPropertyDescriptor$1(nativeSource, key);
318 nativeProperty = descriptor && descriptor.value;
319 } else nativeProperty = nativeSource[key]; // export native or implementation
320
321 sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
322 if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue; // bind timers to global for call from export context
323
324 if (options.bind && USE_NATIVE) resultProperty = bindContext(sourceProperty, global_1); // wrap global constructors for prevent changs in this version
325 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods
326 else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext(Function.call, sourceProperty); // default case
327 else resultProperty = sourceProperty; // add a flag to not completely full polyfills
328
329 if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
330 createNonEnumerableProperty(resultProperty, 'sham', true);
331 }
332
333 target[key] = resultProperty;
334
335 if (PROTO) {
336 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
337
338 if (!has(path, VIRTUAL_PROTOTYPE)) {
339 createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
340 } // export virtual prototype methods
341
342
343 path[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods
344
345 if (options.real && targetPrototype && !targetPrototype[key]) {
346 createNonEnumerableProperty(targetPrototype, key, sourceProperty);
347 }
348 }
349 }
350}; // `Object.defineProperty` method
351// https://tc39.github.io/ecma262/#sec-object.defineproperty
352
353
354_export({
355 target: 'Object',
356 stat: true,
357 forced: !descriptors,
358 sham: !descriptors
359}, {
360 defineProperty: objectDefineProperty.f
361});
362
363var defineProperty_1 = createCommonjsModule(function (module) {
364 var Object = path.Object;
365
366 var defineProperty = module.exports = function defineProperty(it, key, desc) {
367 return Object.defineProperty(it, key, desc);
368 };
369
370 if (Object.defineProperty.sham) defineProperty.sham = true;
371});
372var defineProperty = defineProperty_1;
373var defineProperty$1 = defineProperty;
374var ceil = Math.ceil;
375var floor = Math.floor; // `ToInteger` abstract operation
376// https://tc39.github.io/ecma262/#sec-tointeger
377
378var toInteger = function (argument) {
379 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
380};
381
382var min = Math.min; // `ToLength` abstract operation
383// https://tc39.github.io/ecma262/#sec-tolength
384
385var toLength = function (argument) {
386 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
387};
388
389var max = Math.max;
390var min$1 = Math.min; // Helper for a popular repeating case of the spec:
391// Let integer be ? ToInteger(index).
392// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
393
394var toAbsoluteIndex = function (index, length) {
395 var integer = toInteger(index);
396 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
397}; // `Array.prototype.{ indexOf, includes }` methods implementation
398
399
400var createMethod = function (IS_INCLUDES) {
401 return function ($this, el, fromIndex) {
402 var O = toIndexedObject($this);
403 var length = toLength(O.length);
404 var index = toAbsoluteIndex(fromIndex, length);
405 var value; // Array#includes uses SameValueZero equality algorithm
406 // eslint-disable-next-line no-self-compare
407
408 if (IS_INCLUDES && el != el) while (length > index) {
409 value = O[index++]; // eslint-disable-next-line no-self-compare
410
411 if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
412 } else for (; length > index; index++) {
413 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
414 }
415 return !IS_INCLUDES && -1;
416 };
417};
418
419var arrayIncludes = {
420 // `Array.prototype.includes` method
421 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
422 includes: createMethod(true),
423 // `Array.prototype.indexOf` method
424 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
425 indexOf: createMethod(false)
426};
427var hiddenKeys = {};
428var indexOf = arrayIncludes.indexOf;
429
430var objectKeysInternal = function (object, names) {
431 var O = toIndexedObject(object);
432 var i = 0;
433 var result = [];
434 var key;
435
436 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys
437
438
439 while (names.length > i) if (has(O, key = names[i++])) {
440 ~indexOf(result, key) || result.push(key);
441 }
442
443 return result;
444}; // IE8- don't enum bug keys
445
446
447var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; // `Object.keys` method
448// https://tc39.github.io/ecma262/#sec-object.keys
449
450var objectKeys = Object.keys || function keys(O) {
451 return objectKeysInternal(O, enumBugKeys);
452}; // `Object.defineProperties` method
453// https://tc39.github.io/ecma262/#sec-object.defineproperties
454
455
456var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
457 anObject(O);
458 var keys = objectKeys(Properties);
459 var length = keys.length;
460 var index = 0;
461 var key;
462
463 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
464
465 return O;
466}; // `Object.defineProperties` method
467// https://tc39.github.io/ecma262/#sec-object.defineproperties
468
469_export({
470 target: 'Object',
471 stat: true,
472 forced: !descriptors,
473 sham: !descriptors
474}, {
475 defineProperties: objectDefineProperties
476});
477
478var defineProperties_1 = createCommonjsModule(function (module) {
479 var Object = path.Object;
480
481 var defineProperties = module.exports = function defineProperties(T, D) {
482 return Object.defineProperties(T, D);
483 };
484
485 if (Object.defineProperties.sham) defineProperties.sham = true;
486});
487var defineProperties = defineProperties_1;
488var defineProperties$1 = defineProperties;
489
490var aFunction$1 = function (variable) {
491 return typeof variable == 'function' ? variable : undefined;
492};
493
494var getBuiltIn = function (namespace, method) {
495 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];
496};
497
498var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
499// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
500
501var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
502 return objectKeysInternal(O, hiddenKeys$1);
503};
504
505var objectGetOwnPropertyNames = {
506 f: f$3
507};
508var f$4 = Object.getOwnPropertySymbols;
509var objectGetOwnPropertySymbols = {
510 f: f$4
511}; // all object keys, includes non-enumerable and symbols
512
513var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
514 var keys = objectGetOwnPropertyNames.f(anObject(it));
515 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
516 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
517};
518
519var createProperty = function (object, key, value) {
520 var propertyKey = toPrimitive(key);
521 if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
522}; // `Object.getOwnPropertyDescriptors` method
523// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
524
525
526_export({
527 target: 'Object',
528 stat: true,
529 sham: !descriptors
530}, {
531 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
532 var O = toIndexedObject(object);
533 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
534 var keys = ownKeys(O);
535 var result = {};
536 var index = 0;
537 var key, descriptor;
538
539 while (keys.length > index) {
540 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
541 if (descriptor !== undefined) createProperty(result, key, descriptor);
542 }
543
544 return result;
545 }
546});
547
548var getOwnPropertyDescriptors = path.Object.getOwnPropertyDescriptors;
549var getOwnPropertyDescriptors$1 = getOwnPropertyDescriptors;
550var getOwnPropertyDescriptors$2 = getOwnPropertyDescriptors$1;
551var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
552var FAILS_ON_PRIMITIVES = fails(function () {
553 nativeGetOwnPropertyDescriptor$1(1);
554});
555var FORCED = !descriptors || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method
556// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
557
558_export({
559 target: 'Object',
560 stat: true,
561 forced: FORCED,
562 sham: !descriptors
563}, {
564 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
565 return nativeGetOwnPropertyDescriptor$1(toIndexedObject(it), key);
566 }
567});
568
569var getOwnPropertyDescriptor_1 = createCommonjsModule(function (module) {
570 var Object = path.Object;
571
572 var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
573 return Object.getOwnPropertyDescriptor(it, key);
574 };
575
576 if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
577});
578var getOwnPropertyDescriptor$2 = getOwnPropertyDescriptor_1;
579var getOwnPropertyDescriptor$3 = getOwnPropertyDescriptor$2;
580var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
581 // Chrome 38 Symbol has incorrect toString conversion
582 // eslint-disable-next-line no-undef
583 return !String(Symbol());
584}); // `IsArray` abstract operation
585// https://tc39.github.io/ecma262/#sec-isarray
586
587var isArray = Array.isArray || function isArray(arg) {
588 return classofRaw(arg) == 'Array';
589}; // `ToObject` abstract operation
590// https://tc39.github.io/ecma262/#sec-toobject
591
592
593var toObject = function (argument) {
594 return Object(requireObjectCoercible(argument));
595};
596
597var html = getBuiltIn('document', 'documentElement');
598
599var setGlobal = function (key, value) {
600 try {
601 createNonEnumerableProperty(global_1, key, value);
602 } catch (error) {
603 global_1[key] = value;
604 }
605
606 return value;
607};
608
609var SHARED = '__core-js_shared__';
610var store = global_1[SHARED] || setGlobal(SHARED, {});
611var sharedStore = store;
612var shared = createCommonjsModule(function (module) {
613 (module.exports = function (key, value) {
614 return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
615 })('versions', []).push({
616 version: '3.4.1',
617 mode: 'pure',
618 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
619 });
620});
621var id = 0;
622var postfix = Math.random();
623
624var uid = function (key) {
625 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
626};
627
628var keys = shared('keys');
629
630var sharedKey = function (key) {
631 return keys[key] || (keys[key] = uid(key));
632};
633
634var IE_PROTO = sharedKey('IE_PROTO');
635var PROTOTYPE = 'prototype';
636
637var Empty = function () {
638 /* empty */
639}; // Create object with fake `null` prototype: use iframe Object with cleared prototype
640
641
642var createDict = function () {
643 // Thrash, waste and sodomy: IE GC bug
644 var iframe = documentCreateElement('iframe');
645 var length = enumBugKeys.length;
646 var lt = '<';
647 var script = 'script';
648 var gt = '>';
649 var js = 'java' + script + ':';
650 var iframeDocument;
651 iframe.style.display = 'none';
652 html.appendChild(iframe);
653 iframe.src = String(js);
654 iframeDocument = iframe.contentWindow.document;
655 iframeDocument.open();
656 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
657 iframeDocument.close();
658 createDict = iframeDocument.F;
659
660 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
661
662 return createDict();
663}; // `Object.create` method
664// https://tc39.github.io/ecma262/#sec-object.create
665
666
667var objectCreate = Object.create || function create(O, Properties) {
668 var result;
669
670 if (O !== null) {
671 Empty[PROTOTYPE] = anObject(O);
672 result = new Empty();
673 Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill
674
675 result[IE_PROTO] = O;
676 } else result = createDict();
677
678 return Properties === undefined ? result : objectDefineProperties(result, Properties);
679};
680
681hiddenKeys[IE_PROTO] = true;
682var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
683var toString$1 = {}.toString;
684var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
685
686var getWindowNames = function (it) {
687 try {
688 return nativeGetOwnPropertyNames(it);
689 } catch (error) {
690 return windowNames.slice();
691 }
692}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
693
694
695var f$5 = function getOwnPropertyNames(it) {
696 return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it));
697};
698
699var objectGetOwnPropertyNamesExternal = {
700 f: f$5
701};
702
703var redefine = function (target, key, value, options) {
704 if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty(target, key, value);
705};
706
707var Symbol$1 = global_1.Symbol;
708var store$1 = shared('wks');
709
710var wellKnownSymbol = function (name) {
711 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name] || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
712};
713
714var f$6 = wellKnownSymbol;
715var wrappedWellKnownSymbol = {
716 f: f$6
717};
718var defineProperty$2 = objectDefineProperty.f;
719
720var defineWellKnownSymbol = function (NAME) {
721 var Symbol = path.Symbol || (path.Symbol = {});
722 if (!has(Symbol, NAME)) defineProperty$2(Symbol, NAME, {
723 value: wrappedWellKnownSymbol.f(NAME)
724 });
725};
726
727var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here
728
729var CORRECT_ARGUMENTS = classofRaw(function () {
730 return arguments;
731}()) == 'Arguments'; // fallback for IE11 Script Access Denied error
732
733var tryGet = function (it, key) {
734 try {
735 return it[key];
736 } catch (error) {
737 /* empty */
738 }
739}; // getting tag from ES6+ `Object.prototype.toString`
740
741
742var classof = function (it) {
743 var O, tag, result;
744 return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
745 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case
746 : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback
747 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
748};
749
750var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
751var test = {};
752test[TO_STRING_TAG$1] = 'z'; // `Object.prototype.toString` method implementation
753// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
754
755var objectToString = String(test) !== '[object z]' ? function toString() {
756 return '[object ' + classof(this) + ']';
757} : test.toString;
758var defineProperty$3 = objectDefineProperty.f;
759var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
760var METHOD_REQUIRED = objectToString !== {}.toString;
761
762var setToStringTag = function (it, TAG, STATIC, SET_METHOD) {
763 if (it) {
764 var target = STATIC ? it : it.prototype;
765
766 if (!has(target, TO_STRING_TAG$2)) {
767 defineProperty$3(target, TO_STRING_TAG$2, {
768 configurable: true,
769 value: TAG
770 });
771 }
772
773 if (SET_METHOD && METHOD_REQUIRED) {
774 createNonEnumerableProperty(target, 'toString', objectToString);
775 }
776 }
777};
778
779var functionToString = shared('native-function-to-string', Function.toString);
780var WeakMap = global_1.WeakMap;
781var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
782var WeakMap$1 = global_1.WeakMap;
783var set, get, has$1;
784
785var enforce = function (it) {
786 return has$1(it) ? get(it) : set(it, {});
787};
788
789var getterFor = function (TYPE) {
790 return function (it) {
791 var state;
792
793 if (!isObject(it) || (state = get(it)).type !== TYPE) {
794 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
795 }
796
797 return state;
798 };
799};
800
801if (nativeWeakMap) {
802 var store$2 = new WeakMap$1();
803 var wmget = store$2.get;
804 var wmhas = store$2.has;
805 var wmset = store$2.set;
806
807 set = function (it, metadata) {
808 wmset.call(store$2, it, metadata);
809 return metadata;
810 };
811
812 get = function (it) {
813 return wmget.call(store$2, it) || {};
814 };
815
816 has$1 = function (it) {
817 return wmhas.call(store$2, it);
818 };
819} else {
820 var STATE = sharedKey('state');
821 hiddenKeys[STATE] = true;
822
823 set = function (it, metadata) {
824 createNonEnumerableProperty(it, STATE, metadata);
825 return metadata;
826 };
827
828 get = function (it) {
829 return has(it, STATE) ? it[STATE] : {};
830 };
831
832 has$1 = function (it) {
833 return has(it, STATE);
834 };
835}
836
837var internalState = {
838 set: set,
839 get: get,
840 has: has$1,
841 enforce: enforce,
842 getterFor: getterFor
843};
844var SPECIES = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation
845// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
846
847var arraySpeciesCreate = function (originalArray, length) {
848 var C;
849
850 if (isArray(originalArray)) {
851 C = originalArray.constructor; // cross-realm fallback
852
853 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
854 C = C[SPECIES];
855 if (C === null) C = undefined;
856 }
857 }
858
859 return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
860};
861
862var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
863
864var createMethod$1 = function (TYPE) {
865 var IS_MAP = TYPE == 1;
866 var IS_FILTER = TYPE == 2;
867 var IS_SOME = TYPE == 3;
868 var IS_EVERY = TYPE == 4;
869 var IS_FIND_INDEX = TYPE == 6;
870 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
871 return function ($this, callbackfn, that, specificCreate) {
872 var O = toObject($this);
873 var self = indexedObject(O);
874 var boundFunction = bindContext(callbackfn, that, 3);
875 var length = toLength(self.length);
876 var index = 0;
877 var create = specificCreate || arraySpeciesCreate;
878 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
879 var value, result;
880
881 for (; length > index; index++) if (NO_HOLES || index in self) {
882 value = self[index];
883 result = boundFunction(value, index, O);
884
885 if (TYPE) {
886 if (IS_MAP) target[index] = result; // map
887 else if (result) switch (TYPE) {
888 case 3:
889 return true;
890 // some
891
892 case 5:
893 return value;
894 // find
895
896 case 6:
897 return index;
898 // findIndex
899
900 case 2:
901 push.call(target, value);
902 // filter
903 } else if (IS_EVERY) return false; // every
904 }
905 }
906
907 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
908 };
909};
910
911var arrayIteration = {
912 // `Array.prototype.forEach` method
913 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
914 forEach: createMethod$1(0),
915 // `Array.prototype.map` method
916 // https://tc39.github.io/ecma262/#sec-array.prototype.map
917 map: createMethod$1(1),
918 // `Array.prototype.filter` method
919 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
920 filter: createMethod$1(2),
921 // `Array.prototype.some` method
922 // https://tc39.github.io/ecma262/#sec-array.prototype.some
923 some: createMethod$1(3),
924 // `Array.prototype.every` method
925 // https://tc39.github.io/ecma262/#sec-array.prototype.every
926 every: createMethod$1(4),
927 // `Array.prototype.find` method
928 // https://tc39.github.io/ecma262/#sec-array.prototype.find
929 find: createMethod$1(5),
930 // `Array.prototype.findIndex` method
931 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
932 findIndex: createMethod$1(6)
933};
934var $forEach = arrayIteration.forEach;
935var HIDDEN = sharedKey('hidden');
936var SYMBOL = 'Symbol';
937var PROTOTYPE$1 = 'prototype';
938var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
939var setInternalState = internalState.set;
940var getInternalState = internalState.getterFor(SYMBOL);
941var ObjectPrototype = Object[PROTOTYPE$1];
942var $Symbol = global_1.Symbol;
943var $stringify = getBuiltIn('JSON', 'stringify');
944var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
945var nativeDefineProperty$1 = objectDefineProperty.f;
946var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
947var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
948var AllSymbols = shared('symbols');
949var ObjectPrototypeSymbols = shared('op-symbols');
950var StringToSymbolRegistry = shared('string-to-symbol-registry');
951var SymbolToStringRegistry = shared('symbol-to-string-registry');
952var WellKnownSymbolsStore = shared('wks');
953var QObject = global_1.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
954
955var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
956
957var setSymbolDescriptor = descriptors && fails(function () {
958 return objectCreate(nativeDefineProperty$1({}, 'a', {
959 get: function () {
960 return nativeDefineProperty$1(this, 'a', {
961 value: 7
962 }).a;
963 }
964 })).a != 7;
965}) ? function (O, P, Attributes) {
966 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2(ObjectPrototype, P);
967 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
968 nativeDefineProperty$1(O, P, Attributes);
969
970 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
971 nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
972 }
973} : nativeDefineProperty$1;
974
975var wrap = function (tag, description) {
976 var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
977 setInternalState(symbol, {
978 type: SYMBOL,
979 tag: tag,
980 description: description
981 });
982 if (!descriptors) symbol.description = description;
983 return symbol;
984};
985
986var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
987 return typeof it == 'symbol';
988} : function (it) {
989 return Object(it) instanceof $Symbol;
990};
991
992var $defineProperty = function defineProperty(O, P, Attributes) {
993 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
994 anObject(O);
995 var key = toPrimitive(P, true);
996 anObject(Attributes);
997
998 if (has(AllSymbols, key)) {
999 if (!Attributes.enumerable) {
1000 if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
1001 O[HIDDEN][key] = true;
1002 } else {
1003 if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
1004 Attributes = objectCreate(Attributes, {
1005 enumerable: createPropertyDescriptor(0, false)
1006 });
1007 }
1008
1009 return setSymbolDescriptor(O, key, Attributes);
1010 }
1011
1012 return nativeDefineProperty$1(O, key, Attributes);
1013};
1014
1015var $defineProperties = function defineProperties(O, Properties) {
1016 anObject(O);
1017 var properties = toIndexedObject(Properties);
1018 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
1019 $forEach(keys, function (key) {
1020 if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
1021 });
1022 return O;
1023};
1024
1025var $create = function create(O, Properties) {
1026 return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
1027};
1028
1029var $propertyIsEnumerable = function propertyIsEnumerable(V) {
1030 var P = toPrimitive(V, true);
1031 var enumerable = nativePropertyIsEnumerable$1.call(this, P);
1032 if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
1033 return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
1034};
1035
1036var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
1037 var it = toIndexedObject(O);
1038 var key = toPrimitive(P, true);
1039 if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
1040 var descriptor = nativeGetOwnPropertyDescriptor$2(it, key);
1041
1042 if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
1043 descriptor.enumerable = true;
1044 }
1045
1046 return descriptor;
1047};
1048
1049var $getOwnPropertyNames = function getOwnPropertyNames(O) {
1050 var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
1051 var result = [];
1052 $forEach(names, function (key) {
1053 if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
1054 });
1055 return result;
1056};
1057
1058var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
1059 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
1060 var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
1061 var result = [];
1062 $forEach(names, function (key) {
1063 if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
1064 result.push(AllSymbols[key]);
1065 }
1066 });
1067 return result;
1068}; // `Symbol` constructor
1069// https://tc39.github.io/ecma262/#sec-symbol-constructor
1070
1071
1072if (!nativeSymbol) {
1073 $Symbol = function Symbol() {
1074 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
1075 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
1076 var tag = uid(description);
1077
1078 var setter = function (value) {
1079 if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
1080 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
1081 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
1082 };
1083
1084 if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {
1085 configurable: true,
1086 set: setter
1087 });
1088 return wrap(tag, description);
1089 };
1090
1091 redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
1092 return getInternalState(this).tag;
1093 });
1094 objectPropertyIsEnumerable.f = $propertyIsEnumerable;
1095 objectDefineProperty.f = $defineProperty;
1096 objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
1097 objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
1098 objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
1099
1100 if (descriptors) {
1101 // https://github.com/tc39/proposal-Symbol-description
1102 nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
1103 configurable: true,
1104 get: function description() {
1105 return getInternalState(this).description;
1106 }
1107 });
1108 }
1109
1110 wrappedWellKnownSymbol.f = function (name) {
1111 return wrap(wellKnownSymbol(name), name);
1112 };
1113}
1114
1115_export({
1116 global: true,
1117 wrap: true,
1118 forced: !nativeSymbol,
1119 sham: !nativeSymbol
1120}, {
1121 Symbol: $Symbol
1122});
1123
1124$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
1125 defineWellKnownSymbol(name);
1126});
1127
1128_export({
1129 target: SYMBOL,
1130 stat: true,
1131 forced: !nativeSymbol
1132}, {
1133 // `Symbol.for` method
1134 // https://tc39.github.io/ecma262/#sec-symbol.for
1135 'for': function (key) {
1136 var string = String(key);
1137 if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
1138 var symbol = $Symbol(string);
1139 StringToSymbolRegistry[string] = symbol;
1140 SymbolToStringRegistry[symbol] = string;
1141 return symbol;
1142 },
1143 // `Symbol.keyFor` method
1144 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
1145 keyFor: function keyFor(sym) {
1146 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
1147 if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
1148 },
1149 useSetter: function () {
1150 USE_SETTER = true;
1151 },
1152 useSimple: function () {
1153 USE_SETTER = false;
1154 }
1155});
1156
1157_export({
1158 target: 'Object',
1159 stat: true,
1160 forced: !nativeSymbol,
1161 sham: !descriptors
1162}, {
1163 // `Object.create` method
1164 // https://tc39.github.io/ecma262/#sec-object.create
1165 create: $create,
1166 // `Object.defineProperty` method
1167 // https://tc39.github.io/ecma262/#sec-object.defineproperty
1168 defineProperty: $defineProperty,
1169 // `Object.defineProperties` method
1170 // https://tc39.github.io/ecma262/#sec-object.defineproperties
1171 defineProperties: $defineProperties,
1172 // `Object.getOwnPropertyDescriptor` method
1173 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
1174 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
1175});
1176
1177_export({
1178 target: 'Object',
1179 stat: true,
1180 forced: !nativeSymbol
1181}, {
1182 // `Object.getOwnPropertyNames` method
1183 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1184 getOwnPropertyNames: $getOwnPropertyNames,
1185 // `Object.getOwnPropertySymbols` method
1186 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
1187 getOwnPropertySymbols: $getOwnPropertySymbols
1188}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
1189// https://bugs.chromium.org/p/v8/issues/detail?id=3443
1190
1191
1192_export({
1193 target: 'Object',
1194 stat: true,
1195 forced: fails(function () {
1196 objectGetOwnPropertySymbols.f(1);
1197 })
1198}, {
1199 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
1200 return objectGetOwnPropertySymbols.f(toObject(it));
1201 }
1202}); // `JSON.stringify` method behavior with symbols
1203// https://tc39.github.io/ecma262/#sec-json.stringify
1204
1205
1206if ($stringify) {
1207 var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
1208 var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {}
1209
1210 return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
1211 || $stringify({
1212 a: symbol
1213 }) != '{}' // V8 throws on boxed symbols
1214 || $stringify(Object(symbol)) != '{}';
1215 });
1216
1217 _export({
1218 target: 'JSON',
1219 stat: true,
1220 forced: FORCED_JSON_STRINGIFY
1221 }, {
1222 // eslint-disable-next-line no-unused-vars
1223 stringify: function stringify(it, replacer, space) {
1224 var args = [it];
1225 var index = 1;
1226 var $replacer;
1227
1228 while (arguments.length > index) args.push(arguments[index++]);
1229
1230 $replacer = replacer;
1231 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
1232
1233 if (!isArray(replacer)) replacer = function (key, value) {
1234 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
1235 if (!isSymbol(value)) return value;
1236 };
1237 args[1] = replacer;
1238 return $stringify.apply(null, args);
1239 }
1240 });
1241} // `Symbol.prototype[@@toPrimitive]` method
1242// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
1243
1244
1245if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
1246 createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
1247} // `Symbol.prototype[@@toStringTag]` property
1248// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
1249
1250
1251setToStringTag($Symbol, SYMBOL);
1252hiddenKeys[HIDDEN] = true;
1253var getOwnPropertySymbols = path.Object.getOwnPropertySymbols;
1254var getOwnPropertySymbols$1 = getOwnPropertySymbols;
1255var getOwnPropertySymbols$2 = getOwnPropertySymbols$1;
1256var iterators = {};
1257var correctPrototypeGetter = !fails(function () {
1258 function F() {
1259 /* empty */
1260 }
1261
1262 F.prototype.constructor = null;
1263 return Object.getPrototypeOf(new F()) !== F.prototype;
1264});
1265var IE_PROTO$1 = sharedKey('IE_PROTO');
1266var ObjectPrototype$1 = Object.prototype; // `Object.getPrototypeOf` method
1267// https://tc39.github.io/ecma262/#sec-object.getprototypeof
1268
1269var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1270 O = toObject(O);
1271 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1272
1273 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1274 return O.constructor.prototype;
1275 }
1276
1277 return O instanceof Object ? ObjectPrototype$1 : null;
1278};
1279var ITERATOR = wellKnownSymbol('iterator');
1280var BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object
1281// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1282
1283var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1284
1285if ([].keys) {
1286 arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`
1287
1288 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {
1289 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1290 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1291 }
1292}
1293
1294if (IteratorPrototype == undefined) IteratorPrototype = {};
1295var iteratorsCore = {
1296 IteratorPrototype: IteratorPrototype,
1297 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1298};
1299var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1300
1301var returnThis = function () {
1302 return this;
1303};
1304
1305var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1306 var TO_STRING_TAG = NAME + ' Iterator';
1307 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
1308 next: createPropertyDescriptor(1, next)
1309 });
1310 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
1311 iterators[TO_STRING_TAG] = returnThis;
1312 return IteratorConstructor;
1313};
1314
1315var aPossiblePrototype = function (it) {
1316 if (!isObject(it) && it !== null) {
1317 throw TypeError("Can't set " + String(it) + ' as a prototype');
1318 }
1319
1320 return it;
1321}; // `Object.setPrototypeOf` method
1322// https://tc39.github.io/ecma262/#sec-object.setprototypeof
1323// Works with __proto__ only. Old v8 can't work with null proto objects.
1324
1325/* eslint-disable no-proto */
1326
1327
1328var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1329 var CORRECT_SETTER = false;
1330 var test = {};
1331 var setter;
1332
1333 try {
1334 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1335 setter.call(test, []);
1336 CORRECT_SETTER = test instanceof Array;
1337 } catch (error) {
1338 /* empty */
1339 }
1340
1341 return function setPrototypeOf(O, proto) {
1342 anObject(O);
1343 aPossiblePrototype(proto);
1344 if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
1345 return O;
1346 };
1347}() : undefined);
1348var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1349var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1350var ITERATOR$1 = wellKnownSymbol('iterator');
1351var KEYS = 'keys';
1352var VALUES = 'values';
1353var ENTRIES = 'entries';
1354
1355var returnThis$1 = function () {
1356 return this;
1357};
1358
1359var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1360 createIteratorConstructor(IteratorConstructor, NAME, next);
1361
1362 var getIterationMethod = function (KIND) {
1363 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1364 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1365
1366 switch (KIND) {
1367 case KEYS:
1368 return function keys() {
1369 return new IteratorConstructor(this, KIND);
1370 };
1371
1372 case VALUES:
1373 return function values() {
1374 return new IteratorConstructor(this, KIND);
1375 };
1376
1377 case ENTRIES:
1378 return function entries() {
1379 return new IteratorConstructor(this, KIND);
1380 };
1381 }
1382
1383 return function () {
1384 return new IteratorConstructor(this);
1385 };
1386 };
1387
1388 var TO_STRING_TAG = NAME + ' Iterator';
1389 var INCORRECT_VALUES_NAME = false;
1390 var IterablePrototype = Iterable.prototype;
1391 var nativeIterator = IterablePrototype[ITERATOR$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
1392 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1393 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1394 var CurrentIteratorPrototype, methods, KEY; // fix native
1395
1396 if (anyNativeIterator) {
1397 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1398
1399 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1400 // Set @@toStringTag to native iterators
1401 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
1402 iterators[TO_STRING_TAG] = returnThis$1;
1403 }
1404 } // fix Array#{values, @@iterator}.name in V8 / FF
1405
1406
1407 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1408 INCORRECT_VALUES_NAME = true;
1409
1410 defaultIterator = function values() {
1411 return nativeIterator.call(this);
1412 };
1413 } // define iterator
1414
1415
1416 if (FORCED && IterablePrototype[ITERATOR$1] !== defaultIterator) {
1417 createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
1418 }
1419
1420 iterators[NAME] = defaultIterator; // export additional methods
1421
1422 if (DEFAULT) {
1423 methods = {
1424 values: getIterationMethod(VALUES),
1425 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1426 entries: getIterationMethod(ENTRIES)
1427 };
1428 if (FORCED) for (KEY in methods) {
1429 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1430 redefine(IterablePrototype, KEY, methods[KEY]);
1431 }
1432 } else _export({
1433 target: NAME,
1434 proto: true,
1435 forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME
1436 }, methods);
1437 }
1438
1439 return methods;
1440};
1441
1442var ARRAY_ITERATOR = 'Array Iterator';
1443var setInternalState$1 = internalState.set;
1444var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method
1445// https://tc39.github.io/ecma262/#sec-array.prototype.entries
1446// `Array.prototype.keys` method
1447// https://tc39.github.io/ecma262/#sec-array.prototype.keys
1448// `Array.prototype.values` method
1449// https://tc39.github.io/ecma262/#sec-array.prototype.values
1450// `Array.prototype[@@iterator]` method
1451// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1452// `CreateArrayIterator` internal method
1453// https://tc39.github.io/ecma262/#sec-createarrayiterator
1454
1455var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1456 setInternalState$1(this, {
1457 type: ARRAY_ITERATOR,
1458 target: toIndexedObject(iterated),
1459 // target
1460 index: 0,
1461 // next index
1462 kind: kind // kind
1463
1464 }); // `%ArrayIteratorPrototype%.next` method
1465 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1466}, function () {
1467 var state = getInternalState$1(this);
1468 var target = state.target;
1469 var kind = state.kind;
1470 var index = state.index++;
1471
1472 if (!target || index >= target.length) {
1473 state.target = undefined;
1474 return {
1475 value: undefined,
1476 done: true
1477 };
1478 }
1479
1480 if (kind == 'keys') return {
1481 value: index,
1482 done: false
1483 };
1484 if (kind == 'values') return {
1485 value: target[index],
1486 done: false
1487 };
1488 return {
1489 value: [index, target[index]],
1490 done: false
1491 };
1492}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
1493// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
1494// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
1495
1496iterators.Arguments = iterators.Array; // iterable DOM collections
1497// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1498
1499var domIterables = {
1500 CSSRuleList: 0,
1501 CSSStyleDeclaration: 0,
1502 CSSValueList: 0,
1503 ClientRectList: 0,
1504 DOMRectList: 0,
1505 DOMStringList: 0,
1506 DOMTokenList: 1,
1507 DataTransferItemList: 0,
1508 FileList: 0,
1509 HTMLAllCollection: 0,
1510 HTMLCollection: 0,
1511 HTMLFormElement: 0,
1512 HTMLSelectElement: 0,
1513 MediaList: 0,
1514 MimeTypeArray: 0,
1515 NamedNodeMap: 0,
1516 NodeList: 1,
1517 PaintRequestList: 0,
1518 Plugin: 0,
1519 PluginArray: 0,
1520 SVGLengthList: 0,
1521 SVGNumberList: 0,
1522 SVGPathSegList: 0,
1523 SVGPointList: 0,
1524 SVGStringList: 0,
1525 SVGTransformList: 0,
1526 SourceBufferList: 0,
1527 StyleSheetList: 0,
1528 TextTrackCueList: 0,
1529 TextTrackList: 0,
1530 TouchList: 0
1531};
1532var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
1533
1534for (var COLLECTION_NAME in domIterables) {
1535 var Collection = global_1[COLLECTION_NAME];
1536 var CollectionPrototype = Collection && Collection.prototype;
1537
1538 if (CollectionPrototype && !CollectionPrototype[TO_STRING_TAG$3]) {
1539 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$3, COLLECTION_NAME);
1540 }
1541
1542 iterators[COLLECTION_NAME] = iterators.Array;
1543} // `String.prototype.{ codePointAt, at }` methods implementation
1544
1545
1546var createMethod$2 = function (CONVERT_TO_STRING) {
1547 return function ($this, pos) {
1548 var S = String(requireObjectCoercible($this));
1549 var position = toInteger(pos);
1550 var size = S.length;
1551 var first, second;
1552 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1553 first = S.charCodeAt(position);
1554 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;
1555 };
1556};
1557
1558var stringMultibyte = {
1559 // `String.prototype.codePointAt` method
1560 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
1561 codeAt: createMethod$2(false),
1562 // `String.prototype.at` method
1563 // https://github.com/mathiasbynens/String.prototype.at
1564 charAt: createMethod$2(true)
1565};
1566var charAt = stringMultibyte.charAt;
1567var STRING_ITERATOR = 'String Iterator';
1568var setInternalState$2 = internalState.set;
1569var getInternalState$2 = internalState.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method
1570// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
1571
1572defineIterator(String, 'String', function (iterated) {
1573 setInternalState$2(this, {
1574 type: STRING_ITERATOR,
1575 string: String(iterated),
1576 index: 0
1577 }); // `%StringIteratorPrototype%.next` method
1578 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
1579}, function next() {
1580 var state = getInternalState$2(this);
1581 var string = state.string;
1582 var index = state.index;
1583 var point;
1584 if (index >= string.length) return {
1585 value: undefined,
1586 done: true
1587 };
1588 point = charAt(string, index);
1589 state.index += point.length;
1590 return {
1591 value: point,
1592 done: false
1593 };
1594});
1595var ITERATOR$2 = wellKnownSymbol('iterator');
1596
1597var getIteratorMethod = function (it) {
1598 if (it != undefined) return it[ITERATOR$2] || it['@@iterator'] || iterators[classof(it)];
1599};
1600
1601var getIterator = function (it) {
1602 var iteratorMethod = getIteratorMethod(it);
1603
1604 if (typeof iteratorMethod != 'function') {
1605 throw TypeError(String(it) + ' is not iterable');
1606 }
1607
1608 return anObject(iteratorMethod.call(it));
1609};
1610
1611var getIterator$1 = getIterator;
1612var getIterator$2 = getIterator$1; // `Object.create` method
1613// https://tc39.github.io/ecma262/#sec-object.create
1614
1615_export({
1616 target: 'Object',
1617 stat: true,
1618 sham: !descriptors
1619}, {
1620 create: objectCreate
1621});
1622
1623var Object$1 = path.Object;
1624
1625var create = function create(P, D) {
1626 return Object$1.create(P, D);
1627};
1628
1629var create$1 = create;
1630var create$2 = create$1;
1631var defineProperty$4 = defineProperty_1;
1632var defineProperty$5 = defineProperty$4;
1633
1634function _defineProperty(obj, key, value) {
1635 if (key in obj) {
1636 defineProperty$5(obj, key, {
1637 value: value,
1638 enumerable: true,
1639 configurable: true,
1640 writable: true
1641 });
1642 } else {
1643 obj[key] = value;
1644 }
1645
1646 return obj;
1647}
1648
1649var defineProperty$6 = _defineProperty;
1650var FAILS_ON_PRIMITIVES$1 = fails(function () {
1651 objectKeys(1);
1652}); // `Object.keys` method
1653// https://tc39.github.io/ecma262/#sec-object.keys
1654
1655_export({
1656 target: 'Object',
1657 stat: true,
1658 forced: FAILS_ON_PRIMITIVES$1
1659}, {
1660 keys: function keys(it) {
1661 return objectKeys(toObject(it));
1662 }
1663});
1664
1665var keys$1 = path.Object.keys;
1666var keys$2 = keys$1;
1667var keys$3 = keys$2; // a string of all valid unicode whitespaces
1668// eslint-disable-next-line max-len
1669
1670var 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';
1671var whitespace = '[' + whitespaces + ']';
1672var ltrim = RegExp('^' + whitespace + whitespace + '*');
1673var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1674
1675var createMethod$3 = function (TYPE) {
1676 return function ($this) {
1677 var string = String(requireObjectCoercible($this));
1678 if (TYPE & 1) string = string.replace(ltrim, '');
1679 if (TYPE & 2) string = string.replace(rtrim, '');
1680 return string;
1681 };
1682};
1683
1684var stringTrim = {
1685 // `String.prototype.{ trimLeft, trimStart }` methods
1686 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
1687 start: createMethod$3(1),
1688 // `String.prototype.{ trimRight, trimEnd }` methods
1689 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
1690 end: createMethod$3(2),
1691 // `String.prototype.trim` method
1692 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
1693 trim: createMethod$3(3)
1694};
1695var non = '\u200B\u0085\u180E'; // check that a method works with the correct list
1696// of whitespaces and has a correct name
1697
1698var forcedStringTrimMethod = function (METHOD_NAME) {
1699 return fails(function () {
1700 return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
1701 });
1702};
1703
1704var $trim = stringTrim.trim; // `String.prototype.trim` method
1705// https://tc39.github.io/ecma262/#sec-string.prototype.trim
1706
1707_export({
1708 target: 'String',
1709 proto: true,
1710 forced: forcedStringTrimMethod('trim')
1711}, {
1712 trim: function trim() {
1713 return $trim(this);
1714 }
1715});
1716
1717var entryVirtual = function (CONSTRUCTOR) {
1718 return path[CONSTRUCTOR + 'Prototype'];
1719};
1720
1721var trim = entryVirtual('String').trim;
1722var StringPrototype = String.prototype;
1723
1724var trim_1 = function (it) {
1725 var own = it.trim;
1726 return typeof it === 'string' || it === StringPrototype || it instanceof String && own === StringPrototype.trim ? trim : own;
1727};
1728
1729var trim$1 = trim_1;
1730var trim$2 = trim$1;
1731
1732var sloppyArrayMethod = function (METHOD_NAME, argument) {
1733 var method = [][METHOD_NAME];
1734 return !method || !fails(function () {
1735 // eslint-disable-next-line no-useless-call,no-throw-literal
1736 method.call(null, argument || function () {
1737 throw 1;
1738 }, 1);
1739 });
1740};
1741
1742var $forEach$1 = arrayIteration.forEach; // `Array.prototype.forEach` method implementation
1743// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1744
1745var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn
1746/* , thisArg */
1747) {
1748 return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1749} : [].forEach; // `Array.prototype.forEach` method
1750// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
1751
1752_export({
1753 target: 'Array',
1754 proto: true,
1755 forced: [].forEach != arrayForEach
1756}, {
1757 forEach: arrayForEach
1758});
1759
1760var forEach = entryVirtual('Array').forEach;
1761var forEach$1 = forEach;
1762var ArrayPrototype = Array.prototype;
1763var DOMIterables = {
1764 DOMTokenList: true,
1765 NodeList: true
1766};
1767
1768var forEach_1 = function (it) {
1769 var own = it.forEach;
1770 return it === ArrayPrototype || it instanceof Array && own === ArrayPrototype.forEach // eslint-disable-next-line no-prototype-builtins
1771 || DOMIterables.hasOwnProperty(classof(it)) ? forEach$1 : own;
1772};
1773
1774var forEach$2 = forEach_1;
1775var userAgent = getBuiltIn('navigator', 'userAgent') || '';
1776var process = global_1.process;
1777var versions = process && process.versions;
1778var v8 = versions && versions.v8;
1779var match, version;
1780
1781if (v8) {
1782 match = v8.split('.');
1783 version = match[0] + match[1];
1784} else if (userAgent) {
1785 match = userAgent.match(/Edge\/(\d+)/);
1786
1787 if (!match || match[1] >= 74) {
1788 match = userAgent.match(/Chrome\/(\d+)/);
1789 if (match) version = match[1];
1790 }
1791}
1792
1793var v8Version = version && +version;
1794var SPECIES$1 = wellKnownSymbol('species');
1795
1796var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1797 // We can't use this feature detection in V8 since it causes
1798 // deoptimization and serious performance degradation
1799 // https://github.com/zloirock/core-js/issues/677
1800 return v8Version >= 51 || !fails(function () {
1801 var array = [];
1802 var constructor = array.constructor = {};
1803
1804 constructor[SPECIES$1] = function () {
1805 return {
1806 foo: 1
1807 };
1808 };
1809
1810 return array[METHOD_NAME](Boolean).foo !== 1;
1811 });
1812};
1813
1814var $map = arrayIteration.map; // `Array.prototype.map` method
1815// https://tc39.github.io/ecma262/#sec-array.prototype.map
1816// with adding support of @@species
1817
1818_export({
1819 target: 'Array',
1820 proto: true,
1821 forced: !arrayMethodHasSpeciesSupport('map')
1822}, {
1823 map: function map(callbackfn
1824 /* , thisArg */
1825 ) {
1826 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1827 }
1828});
1829
1830var map = entryVirtual('Array').map;
1831var ArrayPrototype$1 = Array.prototype;
1832
1833var map_1 = function (it) {
1834 var own = it.map;
1835 return it === ArrayPrototype$1 || it instanceof Array && own === ArrayPrototype$1.map ? map : own;
1836};
1837
1838var map$1 = map_1;
1839var map$2 = map$1;
1840var trim$3 = stringTrim.trim;
1841var nativeParseInt = global_1.parseInt;
1842var hex = /^[+-]?0[Xx]/;
1843var FORCED$1 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22; // `parseInt` method
1844// https://tc39.github.io/ecma262/#sec-parseint-string-radix
1845
1846var _parseInt = FORCED$1 ? function parseInt(string, radix) {
1847 var S = trim$3(String(string));
1848 return nativeParseInt(S, radix >>> 0 || (hex.test(S) ? 16 : 10));
1849} : nativeParseInt; // `parseInt` method
1850// https://tc39.github.io/ecma262/#sec-parseint-string-radix
1851
1852
1853_export({
1854 global: true,
1855 forced: parseInt != _parseInt
1856}, {
1857 parseInt: _parseInt
1858});
1859
1860var _parseInt$1 = path.parseInt;
1861var _parseInt$2 = _parseInt$1;
1862var _parseInt$3 = _parseInt$2;
1863var propertyIsEnumerable = objectPropertyIsEnumerable.f; // `Object.{ entries, values }` methods implementation
1864
1865var createMethod$4 = function (TO_ENTRIES) {
1866 return function (it) {
1867 var O = toIndexedObject(it);
1868 var keys = objectKeys(O);
1869 var length = keys.length;
1870 var i = 0;
1871 var result = [];
1872 var key;
1873
1874 while (length > i) {
1875 key = keys[i++];
1876
1877 if (!descriptors || propertyIsEnumerable.call(O, key)) {
1878 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
1879 }
1880 }
1881
1882 return result;
1883 };
1884};
1885
1886var objectToArray = {
1887 // `Object.entries` method
1888 // https://tc39.github.io/ecma262/#sec-object.entries
1889 entries: createMethod$4(true),
1890 // `Object.values` method
1891 // https://tc39.github.io/ecma262/#sec-object.values
1892 values: createMethod$4(false)
1893};
1894var $values = objectToArray.values; // `Object.values` method
1895// https://tc39.github.io/ecma262/#sec-object.values
1896
1897_export({
1898 target: 'Object',
1899 stat: true
1900}, {
1901 values: function values(O) {
1902 return $values(O);
1903 }
1904});
1905
1906var values = path.Object.values;
1907var values$1 = values;
1908var values$2 = values$1;
1909var $filter = arrayIteration.filter; // `Array.prototype.filter` method
1910// https://tc39.github.io/ecma262/#sec-array.prototype.filter
1911// with adding support of @@species
1912
1913_export({
1914 target: 'Array',
1915 proto: true,
1916 forced: !arrayMethodHasSpeciesSupport('filter')
1917}, {
1918 filter: function filter(callbackfn
1919 /* , thisArg */
1920 ) {
1921 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
1922 }
1923});
1924
1925var filter = entryVirtual('Array').filter;
1926var ArrayPrototype$2 = Array.prototype;
1927
1928var filter_1 = function (it) {
1929 var own = it.filter;
1930 return it === ArrayPrototype$2 || it instanceof Array && own === ArrayPrototype$2.filter ? filter : own;
1931};
1932
1933var filter$1 = filter_1;
1934var filter$2 = filter$1;
1935var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1936var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1937var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
1938// deoptimization and serious performance degradation
1939// https://github.com/zloirock/core-js/issues/679
1940
1941var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
1942 var array = [];
1943 array[IS_CONCAT_SPREADABLE] = false;
1944 return array.concat()[0] !== array;
1945});
1946var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1947
1948var isConcatSpreadable = function (O) {
1949 if (!isObject(O)) return false;
1950 var spreadable = O[IS_CONCAT_SPREADABLE];
1951 return spreadable !== undefined ? !!spreadable : isArray(O);
1952};
1953
1954var FORCED$2 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method
1955// https://tc39.github.io/ecma262/#sec-array.prototype.concat
1956// with adding support of @@isConcatSpreadable and @@species
1957
1958_export({
1959 target: 'Array',
1960 proto: true,
1961 forced: FORCED$2
1962}, {
1963 concat: function concat(arg) {
1964 // eslint-disable-line no-unused-vars
1965 var O = toObject(this);
1966 var A = arraySpeciesCreate(O, 0);
1967 var n = 0;
1968 var i, k, length, len, E;
1969
1970 for (i = -1, length = arguments.length; i < length; i++) {
1971 E = i === -1 ? O : arguments[i];
1972
1973 if (isConcatSpreadable(E)) {
1974 len = toLength(E.length);
1975 if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1976
1977 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1978 } else {
1979 if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1980 createProperty(A, n++, E);
1981 }
1982 }
1983
1984 A.length = n;
1985 return A;
1986 }
1987});
1988
1989var concat = entryVirtual('Array').concat;
1990var ArrayPrototype$3 = Array.prototype;
1991
1992var concat_1 = function (it) {
1993 var own = it.concat;
1994 return it === ArrayPrototype$3 || it instanceof Array && own === ArrayPrototype$3.concat ? concat : own;
1995};
1996
1997var concat$1 = concat_1;
1998var concat$2 = concat$1; // `Array.isArray` method
1999// https://tc39.github.io/ecma262/#sec-array.isarray
2000
2001_export({
2002 target: 'Array',
2003 stat: true
2004}, {
2005 isArray: isArray
2006});
2007
2008var isArray$1 = path.Array.isArray;
2009var isArray$2 = isArray$1;
2010var isArray$3 = isArray$2;
2011
2012function _arrayWithoutHoles(arr) {
2013 if (isArray$3(arr)) {
2014 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
2015 arr2[i] = arr[i];
2016 }
2017
2018 return arr2;
2019 }
2020}
2021
2022var arrayWithoutHoles = _arrayWithoutHoles; // call something on iterator step with safe closing on error
2023
2024var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
2025 try {
2026 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
2027 } catch (error) {
2028 var returnMethod = iterator['return'];
2029 if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
2030 throw error;
2031 }
2032};
2033
2034var ITERATOR$3 = wellKnownSymbol('iterator');
2035var ArrayPrototype$4 = Array.prototype; // check on default Array iterator
2036
2037var isArrayIteratorMethod = function (it) {
2038 return it !== undefined && (iterators.Array === it || ArrayPrototype$4[ITERATOR$3] === it);
2039}; // `Array.from` method implementation
2040// https://tc39.github.io/ecma262/#sec-array.from
2041
2042
2043var arrayFrom = function from(arrayLike
2044/* , mapfn = undefined, thisArg = undefined */
2045) {
2046 var O = toObject(arrayLike);
2047 var C = typeof this == 'function' ? this : Array;
2048 var argumentsLength = arguments.length;
2049 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
2050 var mapping = mapfn !== undefined;
2051 var index = 0;
2052 var iteratorMethod = getIteratorMethod(O);
2053 var length, result, step, iterator, next;
2054 if (mapping) mapfn = bindContext(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
2055
2056 if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
2057 iterator = iteratorMethod.call(O);
2058 next = iterator.next;
2059 result = new C();
2060
2061 for (; !(step = next.call(iterator)).done; index++) {
2062 createProperty(result, index, mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value);
2063 }
2064 } else {
2065 length = toLength(O.length);
2066 result = new C(length);
2067
2068 for (; length > index; index++) {
2069 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
2070 }
2071 }
2072
2073 result.length = index;
2074 return result;
2075};
2076
2077var ITERATOR$4 = wellKnownSymbol('iterator');
2078var SAFE_CLOSING = false;
2079
2080try {
2081 var called = 0;
2082 var iteratorWithReturn = {
2083 next: function () {
2084 return {
2085 done: !!called++
2086 };
2087 },
2088 'return': function () {
2089 SAFE_CLOSING = true;
2090 }
2091 };
2092
2093 iteratorWithReturn[ITERATOR$4] = function () {
2094 return this;
2095 }; // eslint-disable-next-line no-throw-literal
2096
2097
2098 Array.from(iteratorWithReturn, function () {
2099 throw 2;
2100 });
2101} catch (error) {
2102 /* empty */
2103}
2104
2105var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
2106 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2107 var ITERATION_SUPPORT = false;
2108
2109 try {
2110 var object = {};
2111
2112 object[ITERATOR$4] = function () {
2113 return {
2114 next: function () {
2115 return {
2116 done: ITERATION_SUPPORT = true
2117 };
2118 }
2119 };
2120 };
2121
2122 exec(object);
2123 } catch (error) {
2124 /* empty */
2125 }
2126
2127 return ITERATION_SUPPORT;
2128};
2129
2130var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
2131 Array.from(iterable);
2132}); // `Array.from` method
2133// https://tc39.github.io/ecma262/#sec-array.from
2134
2135_export({
2136 target: 'Array',
2137 stat: true,
2138 forced: INCORRECT_ITERATION
2139}, {
2140 from: arrayFrom
2141});
2142
2143var from_1 = path.Array.from;
2144var from_1$1 = from_1;
2145var from_1$2 = from_1$1;
2146var ITERATOR$5 = wellKnownSymbol('iterator');
2147
2148var isIterable = function (it) {
2149 var O = Object(it);
2150 return O[ITERATOR$5] !== undefined || '@@iterator' in O // eslint-disable-next-line no-prototype-builtins
2151 || iterators.hasOwnProperty(classof(O));
2152};
2153
2154var isIterable$1 = isIterable;
2155var isIterable$2 = isIterable$1;
2156
2157function _iterableToArray(iter) {
2158 if (isIterable$2(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return from_1$2(iter);
2159}
2160
2161var iterableToArray = _iterableToArray;
2162
2163function _nonIterableSpread() {
2164 throw new TypeError("Invalid attempt to spread non-iterable instance");
2165}
2166
2167var nonIterableSpread = _nonIterableSpread;
2168
2169function _toConsumableArray(arr) {
2170 return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
2171}
2172
2173var toConsumableArray = _toConsumableArray;
2174var SPECIES$2 = wellKnownSymbol('species');
2175var nativeSlice = [].slice;
2176var max$1 = Math.max; // `Array.prototype.slice` method
2177// https://tc39.github.io/ecma262/#sec-array.prototype.slice
2178// fallback for not array-like ES3 strings and DOM objects
2179
2180_export({
2181 target: 'Array',
2182 proto: true,
2183 forced: !arrayMethodHasSpeciesSupport('slice')
2184}, {
2185 slice: function slice(start, end) {
2186 var O = toIndexedObject(this);
2187 var length = toLength(O.length);
2188 var k = toAbsoluteIndex(start, length);
2189 var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
2190
2191 var Constructor, result, n;
2192
2193 if (isArray(O)) {
2194 Constructor = O.constructor; // cross-realm fallback
2195
2196 if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
2197 Constructor = undefined;
2198 } else if (isObject(Constructor)) {
2199 Constructor = Constructor[SPECIES$2];
2200 if (Constructor === null) Constructor = undefined;
2201 }
2202
2203 if (Constructor === Array || Constructor === undefined) {
2204 return nativeSlice.call(O, k, fin);
2205 }
2206 }
2207
2208 result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
2209
2210 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
2211
2212 result.length = n;
2213 return result;
2214 }
2215});
2216
2217var slice = entryVirtual('Array').slice;
2218var ArrayPrototype$5 = Array.prototype;
2219
2220var slice_1 = function (it) {
2221 var own = it.slice;
2222 return it === ArrayPrototype$5 || it instanceof Array && own === ArrayPrototype$5.slice ? slice : own;
2223};
2224
2225var slice$1 = slice_1;
2226var slice$2 = slice$1;
2227var FAILS_ON_PRIMITIVES$2 = fails(function () {
2228 objectGetPrototypeOf(1);
2229}); // `Object.getPrototypeOf` method
2230// https://tc39.github.io/ecma262/#sec-object.getprototypeof
2231
2232_export({
2233 target: 'Object',
2234 stat: true,
2235 forced: FAILS_ON_PRIMITIVES$2,
2236 sham: !correctPrototypeGetter
2237}, {
2238 getPrototypeOf: function getPrototypeOf(it) {
2239 return objectGetPrototypeOf(toObject(it));
2240 }
2241});
2242
2243var getPrototypeOf = path.Object.getPrototypeOf;
2244var getPrototypeOf$1 = getPrototypeOf;
2245var getPrototypeOf$2 = getPrototypeOf$1;
2246var $indexOf = arrayIncludes.indexOf;
2247var nativeIndexOf = [].indexOf;
2248var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
2249var SLOPPY_METHOD = sloppyArrayMethod('indexOf'); // `Array.prototype.indexOf` method
2250// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
2251
2252_export({
2253 target: 'Array',
2254 proto: true,
2255 forced: NEGATIVE_ZERO || SLOPPY_METHOD
2256}, {
2257 indexOf: function indexOf(searchElement
2258 /* , fromIndex = 0 */
2259 ) {
2260 return NEGATIVE_ZERO // convert -0 to +0
2261 ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
2262 }
2263});
2264
2265var indexOf$1 = entryVirtual('Array').indexOf;
2266var ArrayPrototype$6 = Array.prototype;
2267
2268var indexOf_1 = function (it) {
2269 var own = it.indexOf;
2270 return it === ArrayPrototype$6 || it instanceof Array && own === ArrayPrototype$6.indexOf ? indexOf$1 : own;
2271};
2272
2273var indexOf$2 = indexOf_1;
2274var indexOf$3 = indexOf$2;
2275var isArray$4 = isArray$1;
2276var isArray$5 = isArray$4;
2277var nativeAssign = Object.assign; // `Object.assign` method
2278// https://tc39.github.io/ecma262/#sec-object.assign
2279// should work with symbols and should have deterministic property order (V8 bug)
2280
2281var objectAssign = !nativeAssign || fails(function () {
2282 var A = {};
2283 var B = {}; // eslint-disable-next-line no-undef
2284
2285 var symbol = Symbol();
2286 var alphabet = 'abcdefghijklmnopqrst';
2287 A[symbol] = 7;
2288 alphabet.split('').forEach(function (chr) {
2289 B[chr] = chr;
2290 });
2291 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
2292}) ? function assign(target, source) {
2293 // eslint-disable-line no-unused-vars
2294 var T = toObject(target);
2295 var argumentsLength = arguments.length;
2296 var index = 1;
2297 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
2298 var propertyIsEnumerable = objectPropertyIsEnumerable.f;
2299
2300 while (argumentsLength > index) {
2301 var S = indexedObject(arguments[index++]);
2302 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
2303 var length = keys.length;
2304 var j = 0;
2305 var key;
2306
2307 while (length > j) {
2308 key = keys[j++];
2309 if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
2310 }
2311 }
2312
2313 return T;
2314} : nativeAssign; // `Object.assign` method
2315// https://tc39.github.io/ecma262/#sec-object.assign
2316
2317_export({
2318 target: 'Object',
2319 stat: true,
2320 forced: Object.assign !== objectAssign
2321}, {
2322 assign: objectAssign
2323});
2324
2325var assign = path.Object.assign;
2326var assign$1 = assign;
2327var assign$2 = assign$1; // `Symbol.iterator` well-known symbol
2328// https://tc39.github.io/ecma262/#sec-symbol.iterator
2329
2330defineWellKnownSymbol('iterator');
2331var iterator = wrappedWellKnownSymbol.f('iterator');
2332var iterator$1 = iterator;
2333var iterator$2 = iterator$1; // `Symbol.asyncIterator` well-known symbol
2334// https://tc39.github.io/ecma262/#sec-symbol.asynciterator
2335
2336defineWellKnownSymbol('asyncIterator'); // `Symbol.hasInstance` well-known symbol
2337// https://tc39.github.io/ecma262/#sec-symbol.hasinstance
2338
2339defineWellKnownSymbol('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol
2340// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable
2341
2342defineWellKnownSymbol('isConcatSpreadable'); // `Symbol.match` well-known symbol
2343// https://tc39.github.io/ecma262/#sec-symbol.match
2344
2345defineWellKnownSymbol('match'); // `Symbol.matchAll` well-known symbol
2346
2347defineWellKnownSymbol('matchAll'); // `Symbol.replace` well-known symbol
2348// https://tc39.github.io/ecma262/#sec-symbol.replace
2349
2350defineWellKnownSymbol('replace'); // `Symbol.search` well-known symbol
2351// https://tc39.github.io/ecma262/#sec-symbol.search
2352
2353defineWellKnownSymbol('search'); // `Symbol.species` well-known symbol
2354// https://tc39.github.io/ecma262/#sec-symbol.species
2355
2356defineWellKnownSymbol('species'); // `Symbol.split` well-known symbol
2357// https://tc39.github.io/ecma262/#sec-symbol.split
2358
2359defineWellKnownSymbol('split'); // `Symbol.toPrimitive` well-known symbol
2360// https://tc39.github.io/ecma262/#sec-symbol.toprimitive
2361
2362defineWellKnownSymbol('toPrimitive'); // `Symbol.toStringTag` well-known symbol
2363// https://tc39.github.io/ecma262/#sec-symbol.tostringtag
2364
2365defineWellKnownSymbol('toStringTag'); // `Symbol.unscopables` well-known symbol
2366// https://tc39.github.io/ecma262/#sec-symbol.unscopables
2367
2368defineWellKnownSymbol('unscopables'); // Math[@@toStringTag] property
2369// https://tc39.github.io/ecma262/#sec-math-@@tostringtag
2370
2371setToStringTag(Math, 'Math', true); // JSON[@@toStringTag] property
2372// https://tc39.github.io/ecma262/#sec-json-@@tostringtag
2373
2374setToStringTag(global_1.JSON, 'JSON', true);
2375var symbol = path.Symbol; // `Symbol.asyncDispose` well-known symbol
2376// https://github.com/tc39/proposal-using-statement
2377
2378defineWellKnownSymbol('asyncDispose'); // `Symbol.dispose` well-known symbol
2379// https://github.com/tc39/proposal-using-statement
2380
2381defineWellKnownSymbol('dispose'); // `Symbol.observable` well-known symbol
2382// https://github.com/tc39/proposal-observable
2383
2384defineWellKnownSymbol('observable'); // `Symbol.patternMatch` well-known symbol
2385// https://github.com/tc39/proposal-pattern-matching
2386
2387defineWellKnownSymbol('patternMatch'); // TODO: remove from `core-js@4`
2388
2389defineWellKnownSymbol('replaceAll');
2390var symbol$1 = symbol;
2391var symbol$2 = symbol$1;
2392
2393var _typeof_1 = createCommonjsModule(function (module) {
2394 function _typeof2(obj) {
2395 if (typeof symbol$2 === "function" && typeof iterator$2 === "symbol") {
2396 _typeof2 = function _typeof2(obj) {
2397 return typeof obj;
2398 };
2399 } else {
2400 _typeof2 = function _typeof2(obj) {
2401 return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : typeof obj;
2402 };
2403 }
2404
2405 return _typeof2(obj);
2406 }
2407
2408 function _typeof(obj) {
2409 if (typeof symbol$2 === "function" && _typeof2(iterator$2) === "symbol") {
2410 module.exports = _typeof = function _typeof(obj) {
2411 return _typeof2(obj);
2412 };
2413 } else {
2414 module.exports = _typeof = function _typeof(obj) {
2415 return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : _typeof2(obj);
2416 };
2417 }
2418
2419 return _typeof(obj);
2420 }
2421
2422 module.exports = _typeof;
2423}); // Maps for number <-> hex string conversion
2424
2425
2426var byteToHex = [];
2427
2428for (var i = 0; i < 256; i++) {
2429 byteToHex[i] = (i + 0x100).toString(16).substr(1);
2430}
2431/**
2432 * Represent binary UUID into it's string representation.
2433 *
2434 * @param buf - Buffer containing UUID bytes.
2435 * @param offset - Offset from the start of the buffer where the UUID is saved (not needed if the buffer starts with the UUID).
2436 *
2437 * @returns String representation of the UUID.
2438 */
2439
2440
2441function stringifyUUID(buf, offset) {
2442 var i = offset || 0;
2443 var bth = byteToHex;
2444 return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]];
2445}
2446/**
2447 * Generate 16 random bytes to be used as a base for UUID.
2448 *
2449 * @ignore
2450 */
2451
2452
2453var random = function () {
2454 if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
2455 // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
2456 // Moderately fast, high quality
2457 var _rnds8 = new Uint8Array(16);
2458
2459 return function whatwgRNG() {
2460 crypto.getRandomValues(_rnds8);
2461 return _rnds8;
2462 };
2463 } // Math.random()-based (RNG)
2464 //
2465 // If all else fails, use Math.random().
2466 // It's fast, but is of unspecified quality.
2467
2468
2469 var _rnds = new Array(16);
2470
2471 return function () {
2472 for (var i = 0, r; i < 16; i++) {
2473 if ((i & 0x03) === 0) {
2474 r = Math.random() * 0x100000000;
2475 }
2476
2477 _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
2478 }
2479
2480 return _rnds;
2481 }; // uuid.js
2482 //
2483 // Copyright (c) 2010-2012 Robert Kieffer
2484 // MIT License - http://opensource.org/licenses/mit-license.php
2485 // Unique ID creation requires a high quality random # generator. We feature
2486 // detect to determine the best RNG source, normalizing to a function that
2487 // returns 128-bits of randomness, since that's what's usually required
2488 // return require('./rng');
2489}();
2490
2491var byteToHex$1 = [];
2492
2493for (var i$1 = 0; i$1 < 256; i$1++) {
2494 byteToHex$1[i$1] = (i$1 + 0x100).toString(16).substr(1);
2495} // **`v1()` - Generate time-based UUID**
2496//
2497// Inspired by https://github.com/LiosK/UUID.js
2498// and http://docs.python.org/library/uuid.html
2499// random #'s we need to init node and clockseq
2500
2501
2502var seedBytes = random(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
2503
2504var defaultNodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; // Per 4.2.2, randomize (14 bit) clockseq
2505
2506var defaultClockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; // Previous uuid creation time
2507
2508/**
2509 * UUIDv4 options.
2510 */
2511
2512/**
2513 * Generate UUIDv4
2514 *
2515 * @param options - Options to be used instead of default generated values.
2516 * String 'binary' is a shorthand for uuid4({}, new Array(16)).
2517 * @param buf - If present the buffer will be filled with the generated UUID.
2518 * @param offset - Offset of the UUID from the start of the buffer.
2519 *
2520 * @returns UUIDv4
2521 */
2522
2523function uuid4() {
2524 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2525 var buf = arguments.length > 1 ? arguments[1] : undefined;
2526 var offset = arguments.length > 2 ? arguments[2] : undefined; // Deprecated - 'format' argument, as supported in v1.2
2527
2528 var i = buf && offset || 0;
2529
2530 if (typeof options === 'string') {
2531 buf = options === 'binary' ? new Array(16) : undefined;
2532 options = {};
2533 }
2534
2535 var rnds = options.random || (options.rng || random)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2536
2537 rnds[6] = rnds[6] & 0x0f | 0x40;
2538 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
2539
2540 if (buf) {
2541 for (var ii = 0; ii < 16; ii++) {
2542 buf[i + ii] = rnds[ii];
2543 }
2544 }
2545
2546 return buf || stringifyUUID(rnds);
2547}
2548
2549function ownKeys$1(object, enumerableOnly) {
2550 var keys = keys$3(object);
2551
2552 if (getOwnPropertySymbols$2) {
2553 var symbols = getOwnPropertySymbols$2(object);
2554 if (enumerableOnly) symbols = filter$2(symbols).call(symbols, function (sym) {
2555 return getOwnPropertyDescriptor$3(object, sym).enumerable;
2556 });
2557 keys.push.apply(keys, symbols);
2558 }
2559
2560 return keys;
2561}
2562
2563function _objectSpread(target) {
2564 for (var i = 1; i < arguments.length; i++) {
2565 var source = arguments[i] != null ? arguments[i] : {};
2566
2567 if (i % 2) {
2568 var _context11;
2569
2570 forEach$2(_context11 = ownKeys$1(source, true)).call(_context11, function (key) {
2571 defineProperty$6(target, key, source[key]);
2572 });
2573 } else if (getOwnPropertyDescriptors$2) {
2574 defineProperties$1(target, getOwnPropertyDescriptors$2(source));
2575 } else {
2576 var _context12;
2577
2578 forEach$2(_context12 = ownKeys$1(source)).call(_context12, function (key) {
2579 defineProperty$1(target, key, getOwnPropertyDescriptor$3(source, key));
2580 });
2581 }
2582 }
2583
2584 return target;
2585} // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/'
2586// code from http://momentjs.com/
2587
2588
2589var ASPDateRegex = /^\/?Date\((-?\d+)/i; // Color REs
2590
2591var fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
2592var shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
2593var rgbRE = /^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i;
2594var rgbaRE = /^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;
2595/**
2596 * Hue, Saturation, Value.
2597 */
2598
2599/**
2600 * Test whether given object is a number
2601 *
2602 * @param value - Input value of unknown type.
2603 *
2604 * @returns True if number, false otherwise.
2605 */
2606
2607function isNumber(value) {
2608 return value instanceof Number || typeof value === "number";
2609}
2610/**
2611 * Remove everything in the DOM object
2612 *
2613 * @param DOMobject - Node whose child nodes will be recursively deleted.
2614 */
2615
2616
2617function recursiveDOMDelete(DOMobject) {
2618 if (DOMobject) {
2619 while (DOMobject.hasChildNodes() === true) {
2620 var child = DOMobject.firstChild;
2621
2622 if (child) {
2623 recursiveDOMDelete(child);
2624 DOMobject.removeChild(child);
2625 }
2626 }
2627 }
2628}
2629/**
2630 * Test whether given object is a string
2631 *
2632 * @param value - Input value of unknown type.
2633 *
2634 * @returns True if string, false otherwise.
2635 */
2636
2637
2638function isString(value) {
2639 return value instanceof String || typeof value === "string";
2640}
2641/**
2642 * Test whether given object is a object (not primitive or null).
2643 *
2644 * @param value - Input value of unknown type.
2645 *
2646 * @returns True if not null object, false otherwise.
2647 */
2648
2649
2650function isObject$1(value) {
2651 return _typeof_1(value) === "object" && value !== null;
2652}
2653/**
2654 * Test whether given object is a Date, or a String containing a Date
2655 *
2656 * @param value - Input value of unknown type.
2657 *
2658 * @returns True if Date instance or string date representation, false otherwise.
2659 */
2660
2661
2662function isDate(value) {
2663 if (value instanceof Date) {
2664 return true;
2665 } else if (isString(value)) {
2666 // test whether this string contains a date
2667 var match = ASPDateRegex.exec(value);
2668
2669 if (match) {
2670 return true;
2671 } else if (!isNaN(Date.parse(value))) {
2672 return true;
2673 }
2674 }
2675
2676 return false;
2677}
2678/**
2679 * Copy property from b to a if property present in a.
2680 * If property in b explicitly set to null, delete it if `allowDeletion` set.
2681 *
2682 * Internal helper routine, should not be exported. Not added to `exports` for that reason.
2683 *
2684 * @param a - Target object.
2685 * @param b - Source object.
2686 * @param prop - Name of property to copy from b to a.
2687 * @param allowDeletion if true, delete property in a if explicitly set to null in b
2688 */
2689
2690
2691function copyOrDelete(a, b, prop, allowDeletion) {
2692 var doDeletion = false;
2693
2694 if (allowDeletion === true) {
2695 doDeletion = b[prop] === null && a[prop] !== undefined;
2696 }
2697
2698 if (doDeletion) {
2699 delete a[prop];
2700 } else {
2701 a[prop] = b[prop]; // Remember, this is a reference copy!
2702 }
2703}
2704/**
2705 * Fill an object with a possibly partially defined other object.
2706 *
2707 * Only copies values for the properties already present in a.
2708 * That means an object is not created on a property if only the b object has it.
2709 *
2710 * @param a - The object that will have it's properties updated.
2711 * @param b - The object with property updates.
2712 * @param allowDeletion - if true, delete properties in a that are explicitly set to null in b
2713 */
2714
2715
2716function fillIfDefined(a, b) {
2717 var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // NOTE: iteration of properties of a
2718 // NOTE: prototype properties iterated over as well
2719
2720 for (var prop in a) {
2721 if (b[prop] !== undefined) {
2722 if (b[prop] === null || _typeof_1(b[prop]) !== "object") {
2723 // Note: typeof null === 'object'
2724 copyOrDelete(a, b, prop, allowDeletion);
2725 } else {
2726 var aProp = a[prop];
2727 var bProp = b[prop];
2728
2729 if (isObject$1(aProp) && isObject$1(bProp)) {
2730 fillIfDefined(aProp, bProp, allowDeletion);
2731 }
2732 }
2733 }
2734 }
2735}
2736/**
2737 * Copy the values of all of the enumerable own properties from one or more source objects to a
2738 * target object. Returns the target object.
2739 *
2740 * @param target - The target object to copy to.
2741 * @param source - The source object from which to copy properties.
2742 *
2743 * @return The target object.
2744 */
2745
2746
2747var extend = assign$2;
2748/**
2749 * Extend object a with selected properties of object b or a series of objects
2750 * Only properties with defined values are copied
2751 *
2752 * @param props - Properties to be copied to a.
2753 * @param a - The target.
2754 * @param others - The sources.
2755 *
2756 * @returns Argument a.
2757 */
2758
2759function selectiveExtend(props, a) {
2760 if (!isArray$5(props)) {
2761 throw new Error("Array with property names expected as first argument");
2762 }
2763
2764 for (var _len = arguments.length, others = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2765 others[_key - 2] = arguments[_key];
2766 }
2767
2768 for (var _i = 0, _others = others; _i < _others.length; _i++) {
2769 var other = _others[_i];
2770
2771 for (var p = 0; p < props.length; p++) {
2772 var prop = props[p];
2773
2774 if (other && Object.prototype.hasOwnProperty.call(other, prop)) {
2775 a[prop] = other[prop];
2776 }
2777 }
2778 }
2779
2780 return a;
2781}
2782/**
2783 * Extend object a with selected properties of object b.
2784 * Only properties with defined values are copied.
2785 *
2786 * **Note:** Previous version of this routine implied that multiple source objects
2787 * could be used; however, the implementation was **wrong**.
2788 * Since multiple (>1) sources weren't used anywhere in the `vis.js` code,
2789 * this has been removed
2790 *
2791 * @param props - Names of first-level properties to copy over.
2792 * @param a - Target object.
2793 * @param b - Source object.
2794 * @param allowDeletion - If true, delete property in a if explicitly set to null in b.
2795 *
2796 * @returns Argument a.
2797 */
2798
2799
2800function selectiveDeepExtend(props, a, b) {
2801 var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // TODO: add support for Arrays to deepExtend
2802
2803 if (isArray$5(b)) {
2804 throw new TypeError("Arrays are not supported by deepExtend");
2805 }
2806
2807 for (var p = 0; p < props.length; p++) {
2808 var prop = props[p];
2809
2810 if (Object.prototype.hasOwnProperty.call(b, prop)) {
2811 if (b[prop] && b[prop].constructor === Object) {
2812 if (a[prop] === undefined) {
2813 a[prop] = {};
2814 }
2815
2816 if (a[prop].constructor === Object) {
2817 deepExtend(a[prop], b[prop], false, allowDeletion);
2818 } else {
2819 copyOrDelete(a, b, prop, allowDeletion);
2820 }
2821 } else if (isArray$5(b[prop])) {
2822 throw new TypeError("Arrays are not supported by deepExtend");
2823 } else {
2824 copyOrDelete(a, b, prop, allowDeletion);
2825 }
2826 }
2827 }
2828
2829 return a;
2830}
2831/**
2832 * Extend object `a` with properties of object `b`, ignoring properties which are explicitly
2833 * specified to be excluded.
2834 *
2835 * The properties of `b` are considered for copying.
2836 * Properties which are themselves objects are are also extended.
2837 * Only properties with defined values are copied
2838 *
2839 * @param propsToExclude - Names of properties which should *not* be copied.
2840 * @param a - Object to extend.
2841 * @param b - Object to take properties from for extension.
2842 * @param allowDeletion - If true, delete properties in a that are explicitly set to null in b.
2843 *
2844 * @returns Argument a.
2845 */
2846
2847
2848function selectiveNotDeepExtend(propsToExclude, a, b) {
2849 var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // TODO: add support for Arrays to deepExtend
2850 // NOTE: array properties have an else-below; apparently, there is a problem here.
2851
2852 if (isArray$5(b)) {
2853 throw new TypeError("Arrays are not supported by deepExtend");
2854 }
2855
2856 for (var prop in b) {
2857 if (!Object.prototype.hasOwnProperty.call(b, prop)) {
2858 continue;
2859 } // Handle local properties only
2860
2861
2862 if (indexOf$3(propsToExclude).call(propsToExclude, prop) !== -1) {
2863 continue;
2864 } // In exclusion list, skip
2865
2866
2867 if (b[prop] && b[prop].constructor === Object) {
2868 if (a[prop] === undefined) {
2869 a[prop] = {};
2870 }
2871
2872 if (a[prop].constructor === Object) {
2873 deepExtend(a[prop], b[prop]); // NOTE: allowDeletion not propagated!
2874 } else {
2875 copyOrDelete(a, b, prop, allowDeletion);
2876 }
2877 } else if (isArray$5(b[prop])) {
2878 a[prop] = [];
2879
2880 for (var i = 0; i < b[prop].length; i++) {
2881 a[prop].push(b[prop][i]);
2882 }
2883 } else {
2884 copyOrDelete(a, b, prop, allowDeletion);
2885 }
2886 }
2887
2888 return a;
2889}
2890/**
2891 * Deep extend an object a with the properties of object b
2892 *
2893 * @param a - Target object.
2894 * @param b - Source object.
2895 * @param protoExtend - If true, the prototype values will also be extended
2896 * (ie. the options objects that inherit from others will also get the inherited options).
2897 * @param allowDeletion - If true, the values of fields that are null will be deleted.
2898 *
2899 * @returns Argument a.
2900 */
2901
2902
2903function deepExtend(a, b) {
2904 var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2905 var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2906
2907 for (var prop in b) {
2908 if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
2909 if (_typeof_1(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$2(b[prop]) === Object.prototype) {
2910 if (a[prop] === undefined) {
2911 a[prop] = deepExtend({}, b[prop], protoExtend); // NOTE: allowDeletion not propagated!
2912 } else if (_typeof_1(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$2(a[prop]) === Object.prototype) {
2913 deepExtend(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated!
2914 } else {
2915 copyOrDelete(a, b, prop, allowDeletion);
2916 }
2917 } else if (isArray$5(b[prop])) {
2918 var _context;
2919
2920 a[prop] = slice$2(_context = b[prop]).call(_context);
2921 } else {
2922 copyOrDelete(a, b, prop, allowDeletion);
2923 }
2924 }
2925 }
2926
2927 return a;
2928}
2929/**
2930 * Test whether all elements in two arrays are equal.
2931 *
2932 * @param a - First array.
2933 * @param b - Second array.
2934 *
2935 * @returns True if both arrays have the same length and same elements (1 = '1').
2936 */
2937
2938
2939function equalArray(a, b) {
2940 if (a.length !== b.length) {
2941 return false;
2942 }
2943
2944 for (var i = 0, len = a.length; i < len; i++) {
2945 if (a[i] != b[i]) {
2946 return false;
2947 }
2948 }
2949
2950 return true;
2951}
2952/**
2953 * Get the type of an object, for example exports.getType([]) returns 'Array'
2954 *
2955 * @param object - Input value of unknown type.
2956 *
2957 * @returns Detected type.
2958 */
2959
2960
2961function getType(object) {
2962 var type = _typeof_1(object);
2963
2964 if (type === "object") {
2965 if (object === null) {
2966 return "null";
2967 }
2968
2969 if (object instanceof Boolean) {
2970 return "Boolean";
2971 }
2972
2973 if (object instanceof Number) {
2974 return "Number";
2975 }
2976
2977 if (object instanceof String) {
2978 return "String";
2979 }
2980
2981 if (isArray$5(object)) {
2982 return "Array";
2983 }
2984
2985 if (object instanceof Date) {
2986 return "Date";
2987 }
2988
2989 return "Object";
2990 }
2991
2992 if (type === "number") {
2993 return "Number";
2994 }
2995
2996 if (type === "boolean") {
2997 return "Boolean";
2998 }
2999
3000 if (type === "string") {
3001 return "String";
3002 }
3003
3004 if (type === undefined) {
3005 return "undefined";
3006 }
3007
3008 return type;
3009}
3010/**
3011 * Used to extend an array and copy it. This is used to propagate paths recursively.
3012 *
3013 * @param arr - First part.
3014 * @param newValue - The value to be aadded into the array.
3015 *
3016 * @returns A new array with all items from arr and newValue (which is last).
3017 */
3018
3019
3020function copyAndExtendArray(arr, newValue) {
3021 var _context2;
3022
3023 return concat$2(_context2 = []).call(_context2, toConsumableArray(arr), [newValue]);
3024}
3025/**
3026 * Used to extend an array and copy it. This is used to propagate paths recursively.
3027 *
3028 * @param arr - The array to be copied.
3029 *
3030 * @returns Shallow copy of arr.
3031 */
3032
3033
3034function copyArray(arr) {
3035 return slice$2(arr).call(arr);
3036}
3037/**
3038 * Retrieve the absolute left value of a DOM element
3039 *
3040 * @param elem - A dom element, for example a div.
3041 *
3042 * @returns The absolute left position of this element in the browser page.
3043 */
3044
3045
3046function getAbsoluteLeft(elem) {
3047 return elem.getBoundingClientRect().left;
3048}
3049/**
3050 * Retrieve the absolute right value of a DOM element
3051 *
3052 * @param elem - A dom element, for example a div.
3053 *
3054 * @returns The absolute right position of this element in the browser page.
3055 */
3056
3057
3058function getAbsoluteRight(elem) {
3059 return elem.getBoundingClientRect().right;
3060}
3061/**
3062 * Retrieve the absolute top value of a DOM element
3063 *
3064 * @param elem - A dom element, for example a div.
3065 *
3066 * @returns The absolute top position of this element in the browser page.
3067 */
3068
3069
3070function getAbsoluteTop(elem) {
3071 return elem.getBoundingClientRect().top;
3072}
3073/**
3074 * Add a className to the given elements style.
3075 *
3076 * @param elem - The element to which the classes will be added.
3077 * @param classNames - Space separated list of classes.
3078 */
3079
3080
3081function addClassName(elem, classNames) {
3082 var classes = elem.className.split(" ");
3083 var newClasses = classNames.split(" ");
3084 classes = concat$2(classes).call(classes, filter$2(newClasses).call(newClasses, function (className) {
3085 return indexOf$3(classes).call(classes, className) < 0;
3086 }));
3087 elem.className = classes.join(" ");
3088}
3089/**
3090 * Remove a className from the given elements style.
3091 *
3092 * @param elem - The element from which the classes will be removed.
3093 * @param classNames - Space separated list of classes.
3094 */
3095
3096
3097function removeClassName(elem, classNames) {
3098 var classes = elem.className.split(" ");
3099 var oldClasses = classNames.split(" ");
3100 classes = filter$2(classes).call(classes, function (className) {
3101 return indexOf$3(oldClasses).call(oldClasses, className) < 0;
3102 });
3103 elem.className = classes.join(" ");
3104}
3105/**
3106 * For each method for both arrays and objects.
3107 * In case of an array, the built-in Array.forEach() is applied (**No, it's not!**).
3108 * In case of an Object, the method loops over all properties of the object.
3109 *
3110 * @param object - An Object or Array to be iterated over.
3111 * @param callback - Array.forEach-like callback.
3112 */
3113
3114
3115function forEach$3(object, callback) {
3116 if (isArray$5(object)) {
3117 // array
3118 var len = object.length;
3119
3120 for (var i = 0; i < len; i++) {
3121 callback(object[i], i, object);
3122 }
3123 } else {
3124 // object
3125 for (var _key2 in object) {
3126 if (Object.prototype.hasOwnProperty.call(object, _key2)) {
3127 callback(object[_key2], _key2, object);
3128 }
3129 }
3130 }
3131}
3132/**
3133 * Convert an object into an array: all objects properties are put into the array. The resulting array is unordered.
3134 *
3135 * @param o - Object that contains the properties and methods.
3136 *
3137 * @returns An array of unordered values.
3138 */
3139
3140
3141var toArray = values$2;
3142/**
3143 * Update a property in an object
3144 *
3145 * @param object - The object whose property will be updated.
3146 * @param key - Name of the property to be updated.
3147 * @param value - The new value to be assigned.
3148 *
3149 * @returns Whether the value was updated (true) or already strictly the same in the original object (false).
3150 */
3151
3152function updateProperty(object, key, value) {
3153 if (object[key] !== value) {
3154 object[key] = value;
3155 return true;
3156 } else {
3157 return false;
3158 }
3159}
3160/**
3161 * Throttle the given function to be only executed once per animation frame.
3162 *
3163 * @param fn - The original function.
3164 *
3165 * @returns The throttled function.
3166 */
3167
3168
3169function throttle(fn) {
3170 var scheduled = false;
3171 return function () {
3172 if (!scheduled) {
3173 scheduled = true;
3174 requestAnimationFrame(function () {
3175 scheduled = false;
3176 fn();
3177 });
3178 }
3179 };
3180}
3181/**
3182 * Add and event listener. Works for all browsers.
3183 *
3184 * @param element - The element to bind the event listener to.
3185 * @param action - Same as Element.addEventListener(action, —, —).
3186 * @param listener - Same as Element.addEventListener(—, listener, —).
3187 * @param useCapture - Same as Element.addEventListener(—, —, useCapture).
3188 */
3189
3190
3191function addEventListener(element, action, listener, useCapture) {
3192 if (element.addEventListener) {
3193 var _context3;
3194
3195 if (useCapture === undefined) {
3196 useCapture = false;
3197 }
3198
3199 if (action === "mousewheel" && indexOf$3(_context3 = navigator.userAgent).call(_context3, "Firefox") >= 0) {
3200 action = "DOMMouseScroll"; // For Firefox
3201 }
3202
3203 element.addEventListener(action, listener, useCapture);
3204 } else {
3205 // @TODO: IE types? Does anyone care?
3206 element.attachEvent("on" + action, listener); // IE browsers
3207 }
3208}
3209/**
3210 * Remove an event listener from an element
3211 *
3212 * @param element - The element to bind the event listener to.
3213 * @param action - Same as Element.removeEventListener(action, —, —).
3214 * @param listener - Same as Element.removeEventListener(—, listener, —).
3215 * @param useCapture - Same as Element.removeEventListener(—, —, useCapture).
3216 */
3217
3218
3219function removeEventListener(element, action, listener, useCapture) {
3220 if (element.removeEventListener) {
3221 var _context4; // non-IE browsers
3222
3223
3224 if (useCapture === undefined) {
3225 useCapture = false;
3226 }
3227
3228 if (action === "mousewheel" && indexOf$3(_context4 = navigator.userAgent).call(_context4, "Firefox") >= 0) {
3229 action = "DOMMouseScroll"; // For Firefox
3230 }
3231
3232 element.removeEventListener(action, listener, useCapture);
3233 } else {
3234 // @TODO: IE types? Does anyone care?
3235 element.detachEvent("on" + action, listener); // IE browsers
3236 }
3237}
3238/**
3239 * Cancels the event's default action if it is cancelable, without stopping further propagation of the event.
3240 *
3241 * @param event - The event whose default action should be prevented.
3242 */
3243
3244
3245function preventDefault(event) {
3246 if (!event) {
3247 event = window.event;
3248 }
3249
3250 if (!event) ;else if (event.preventDefault) {
3251 event.preventDefault(); // non-IE browsers
3252 } else {
3253 // @TODO: IE types? Does anyone care?
3254 event.returnValue = false; // IE browsers
3255 }
3256}
3257/**
3258 * Get HTML element which is the target of the event.
3259 *
3260 * @param event - The event.
3261 *
3262 * @returns The element or null if not obtainable.
3263 */
3264
3265
3266function getTarget() {
3267 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event; // code from http://www.quirksmode.org/js/events_properties.html
3268 // @TODO: EventTarget can be almost anything, is it okay to return only Elements?
3269
3270 var target = null;
3271 if (!event) ;else if (event.target) {
3272 target = event.target;
3273 } else if (event.srcElement) {
3274 target = event.srcElement;
3275 }
3276
3277 if (!(target instanceof Element)) {
3278 return null;
3279 }
3280
3281 if (target.nodeType != null && target.nodeType == 3) {
3282 // defeat Safari bug
3283 target = target.parentNode;
3284
3285 if (!(target instanceof Element)) {
3286 return null;
3287 }
3288 }
3289
3290 return target;
3291}
3292/**
3293 * Check if given element contains given parent somewhere in the DOM tree
3294 *
3295 * @param element - The element to be tested.
3296 * @param parent - The ancestor (not necessarily parent) of the element.
3297 *
3298 * @returns True if parent is an ancestor of the element, false otherwise.
3299 */
3300
3301
3302function hasParent(element, parent) {
3303 var elem = element;
3304
3305 while (elem) {
3306 if (elem === parent) {
3307 return true;
3308 } else if (elem.parentNode) {
3309 elem = elem.parentNode;
3310 } else {
3311 return false;
3312 }
3313 }
3314
3315 return false;
3316}
3317
3318var option = {
3319 /**
3320 * Convert a value into a boolean.
3321 *
3322 * @param value - Value to be converted intoboolean, a function will be executed as (() => unknown).
3323 * @param defaultValue - If the value or the return value of the function == null then this will be returned.
3324 *
3325 * @returns Corresponding boolean value, if none then the default value, if none then null.
3326 */
3327 asBoolean: function asBoolean(value, defaultValue) {
3328 if (typeof value == "function") {
3329 value = value();
3330 }
3331
3332 if (value != null) {
3333 return value != false;
3334 }
3335
3336 return defaultValue || null;
3337 },
3338
3339 /**
3340 * Convert a value into a number.
3341 *
3342 * @param value - Value to be converted intonumber, a function will be executed as (() => unknown).
3343 * @param defaultValue - If the value or the return value of the function == null then this will be returned.
3344 *
3345 * @returns Corresponding **boxed** number value, if none then the default value, if none then null.
3346 */
3347 asNumber: function asNumber(value, defaultValue) {
3348 if (typeof value == "function") {
3349 value = value();
3350 }
3351
3352 if (value != null) {
3353 return Number(value) || defaultValue || null;
3354 }
3355
3356 return defaultValue || null;
3357 },
3358
3359 /**
3360 * Convert a value into a string.
3361 *
3362 * @param value - Value to be converted intostring, a function will be executed as (() => unknown).
3363 * @param defaultValue - If the value or the return value of the function == null then this will be returned.
3364 *
3365 * @returns Corresponding **boxed** string value, if none then the default value, if none then null.
3366 */
3367 asString: function asString(value, defaultValue) {
3368 if (typeof value == "function") {
3369 value = value();
3370 }
3371
3372 if (value != null) {
3373 return String(value);
3374 }
3375
3376 return defaultValue || null;
3377 },
3378
3379 /**
3380 * Convert a value into a size.
3381 *
3382 * @param value - Value to be converted intosize, a function will be executed as (() => unknown).
3383 * @param defaultValue - If the value or the return value of the function == null then this will be returned.
3384 *
3385 * @returns Corresponding string value (number + 'px'), if none then the default value, if none then null.
3386 */
3387 asSize: function asSize(value, defaultValue) {
3388 if (typeof value == "function") {
3389 value = value();
3390 }
3391
3392 if (isString(value)) {
3393 return value;
3394 } else if (isNumber(value)) {
3395 return value + "px";
3396 } else {
3397 return defaultValue || null;
3398 }
3399 },
3400
3401 /**
3402 * Convert a value into a DOM Element.
3403 *
3404 * @param value - Value to be converted into DOM Element, a function will be executed as (() => unknown).
3405 * @param defaultValue - If the value or the return value of the function == null then this will be returned.
3406 *
3407 * @returns The DOM Element, if none then the default value, if none then null.
3408 */
3409 asElement: function asElement(value, defaultValue) {
3410 if (typeof value == "function") {
3411 value = value();
3412 }
3413
3414 return value || defaultValue || null;
3415 }
3416};
3417/**
3418 * Convert hex color string into RGB color object.
3419 * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
3420 *
3421 * @param hex - Hex color string (3 or 6 digits, with or without #).
3422 *
3423 * @returns RGB color object.
3424 */
3425
3426function hexToRGB(hex) {
3427 var result;
3428
3429 switch (hex.length) {
3430 case 3:
3431 case 4:
3432 result = shortHexRE.exec(hex);
3433 return result ? {
3434 r: _parseInt$3(result[1] + result[1], 16),
3435 g: _parseInt$3(result[2] + result[2], 16),
3436 b: _parseInt$3(result[3] + result[3], 16)
3437 } : null;
3438
3439 case 6:
3440 case 7:
3441 result = fullHexRE.exec(hex);
3442 return result ? {
3443 r: _parseInt$3(result[1], 16),
3444 g: _parseInt$3(result[2], 16),
3445 b: _parseInt$3(result[3], 16)
3446 } : null;
3447
3448 default:
3449 return null;
3450 }
3451}
3452/**
3453 * This function takes string color in hex or RGB format and adds the opacity, RGBA is passed through unchanged.
3454 *
3455 * @param color - The color string (hex, RGB, RGBA).
3456 * @param opacity - The new opacity.
3457 *
3458 * @returns RGBA string, for example 'rgba(255, 0, 127, 0.3)'.
3459 */
3460
3461
3462function overrideOpacity(color, opacity) {
3463 if (indexOf$3(color).call(color, "rgba") !== -1) {
3464 return color;
3465 } else if (indexOf$3(color).call(color, "rgb") !== -1) {
3466 var rgb = color.substr(indexOf$3(color).call(color, "(") + 1).replace(")", "").split(",");
3467 return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")";
3468 } else {
3469 var _rgb = hexToRGB(color);
3470
3471 if (_rgb == null) {
3472 return color;
3473 } else {
3474 return "rgba(" + _rgb.r + "," + _rgb.g + "," + _rgb.b + "," + opacity + ")";
3475 }
3476 }
3477}
3478/**
3479 * Convert RGB <0, 255> into hex color string.
3480 *
3481 * @param red - Red channel.
3482 * @param green - Green channel.
3483 * @param blue - Blue channel.
3484 *
3485 * @returns Hex color string (for example: '#0acdc0').
3486 */
3487
3488
3489function RGBToHex(red, green, blue) {
3490 var _context5;
3491
3492 return "#" + slice$2(_context5 = ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16)).call(_context5, 1);
3493}
3494/**
3495 * Parse a color property into an object with border, background, and highlight colors
3496 *
3497 * @param inputColor - Shorthand color string or input color object.
3498 * @param defaultColor - Full color object to fill in missing values in inputColor.
3499 *
3500 * @returns Color object.
3501 */
3502
3503
3504function parseColor(inputColor, defaultColor) {
3505 if (isString(inputColor)) {
3506 var colorStr = inputColor;
3507
3508 if (isValidRGB(colorStr)) {
3509 var _context6;
3510
3511 var rgb = map$2(_context6 = colorStr.substr(4).substr(0, colorStr.length - 5).split(",")).call(_context6, function (value) {
3512 return _parseInt$3(value);
3513 });
3514 colorStr = RGBToHex(rgb[0], rgb[1], rgb[2]);
3515 }
3516
3517 if (isValidHex(colorStr) === true) {
3518 var hsv = hexToHSV(colorStr);
3519 var lighterColorHSV = {
3520 h: hsv.h,
3521 s: hsv.s * 0.8,
3522 v: Math.min(1, hsv.v * 1.02)
3523 };
3524 var darkerColorHSV = {
3525 h: hsv.h,
3526 s: Math.min(1, hsv.s * 1.25),
3527 v: hsv.v * 0.8
3528 };
3529 var darkerColorHex = HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v);
3530 var lighterColorHex = HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v);
3531 return {
3532 background: colorStr,
3533 border: darkerColorHex,
3534 highlight: {
3535 background: lighterColorHex,
3536 border: darkerColorHex
3537 },
3538 hover: {
3539 background: lighterColorHex,
3540 border: darkerColorHex
3541 }
3542 };
3543 } else {
3544 return {
3545 background: colorStr,
3546 border: colorStr,
3547 highlight: {
3548 background: colorStr,
3549 border: colorStr
3550 },
3551 hover: {
3552 background: colorStr,
3553 border: colorStr
3554 }
3555 };
3556 }
3557 } else {
3558 if (defaultColor) {
3559 var color = {
3560 background: inputColor.background || defaultColor.background,
3561 border: inputColor.border || defaultColor.border,
3562 highlight: isString(inputColor.highlight) ? {
3563 border: inputColor.highlight,
3564 background: inputColor.highlight
3565 } : {
3566 background: inputColor.highlight && inputColor.highlight.background || defaultColor.highlight.background,
3567 border: inputColor.highlight && inputColor.highlight.border || defaultColor.highlight.border
3568 },
3569 hover: isString(inputColor.hover) ? {
3570 border: inputColor.hover,
3571 background: inputColor.hover
3572 } : {
3573 border: inputColor.hover && inputColor.hover.border || defaultColor.hover.border,
3574 background: inputColor.hover && inputColor.hover.background || defaultColor.hover.background
3575 }
3576 };
3577 return color;
3578 } else {
3579 var _color = {
3580 background: inputColor.background || undefined,
3581 border: inputColor.border || undefined,
3582 highlight: isString(inputColor.highlight) ? {
3583 border: inputColor.highlight,
3584 background: inputColor.highlight
3585 } : {
3586 background: inputColor.highlight && inputColor.highlight.background || undefined,
3587 border: inputColor.highlight && inputColor.highlight.border || undefined
3588 },
3589 hover: isString(inputColor.hover) ? {
3590 border: inputColor.hover,
3591 background: inputColor.hover
3592 } : {
3593 border: inputColor.hover && inputColor.hover.border || undefined,
3594 background: inputColor.hover && inputColor.hover.background || undefined
3595 }
3596 };
3597 return _color;
3598 }
3599 }
3600}
3601/**
3602 * Convert RGB <0, 255> into HSV object.
3603 * http://www.javascripter.net/faq/rgb2hsv.htm
3604 *
3605 * @param red - Red channel.
3606 * @param green - Green channel.
3607 * @param blue - Blue channel.
3608 *
3609 * @returns HSV color object.
3610 */
3611
3612
3613function RGBToHSV(red, green, blue) {
3614 red = red / 255;
3615 green = green / 255;
3616 blue = blue / 255;
3617 var minRGB = Math.min(red, Math.min(green, blue));
3618 var maxRGB = Math.max(red, Math.max(green, blue)); // Black-gray-white
3619
3620 if (minRGB === maxRGB) {
3621 return {
3622 h: 0,
3623 s: 0,
3624 v: minRGB
3625 };
3626 } // Colors other than black-gray-white:
3627
3628
3629 var d = red === minRGB ? green - blue : blue === minRGB ? red - green : blue - red;
3630 var h = red === minRGB ? 3 : blue === minRGB ? 1 : 5;
3631 var hue = 60 * (h - d / (maxRGB - minRGB)) / 360;
3632 var saturation = (maxRGB - minRGB) / maxRGB;
3633 var value = maxRGB;
3634 return {
3635 h: hue,
3636 s: saturation,
3637 v: value
3638 };
3639}
3640
3641var cssUtil = {
3642 // split a string with css styles into an object with key/values
3643 split: function split(cssText) {
3644 var _context7;
3645
3646 var styles = {};
3647 forEach$2(_context7 = cssText.split(";")).call(_context7, function (style) {
3648 if (trim$2(style).call(style) != "") {
3649 var _context8, _context9;
3650
3651 var parts = style.split(":");
3652
3653 var _key3 = trim$2(_context8 = parts[0]).call(_context8);
3654
3655 var _value = trim$2(_context9 = parts[1]).call(_context9);
3656
3657 styles[_key3] = _value;
3658 }
3659 });
3660 return styles;
3661 },
3662 // build a css text string from an object with key/values
3663 join: function join(styles) {
3664 var _context10;
3665
3666 return map$2(_context10 = keys$3(styles)).call(_context10, function (key) {
3667 return key + ": " + styles[key];
3668 }).join("; ");
3669 }
3670};
3671/**
3672 * Append a string with css styles to an element
3673 *
3674 * @param element - The element that will receive new styles.
3675 * @param cssText - The styles to be appended.
3676 */
3677
3678function addCssText(element, cssText) {
3679 var currentStyles = cssUtil.split(element.style.cssText);
3680 var newStyles = cssUtil.split(cssText);
3681
3682 var styles = _objectSpread({}, currentStyles, {}, newStyles);
3683
3684 element.style.cssText = cssUtil.join(styles);
3685}
3686/**
3687 * Remove a string with css styles from an element
3688 *
3689 * @param element - The element from which styles should be removed.
3690 * @param cssText - The styles to be removed.
3691 */
3692
3693
3694function removeCssText(element, cssText) {
3695 var styles = cssUtil.split(element.style.cssText);
3696 var removeStyles = cssUtil.split(cssText);
3697
3698 for (var _key4 in removeStyles) {
3699 if (Object.prototype.hasOwnProperty.call(removeStyles, _key4)) {
3700 delete styles[_key4];
3701 }
3702 }
3703
3704 element.style.cssText = cssUtil.join(styles);
3705}
3706/**
3707 * Convert HSV <0, 1> into RGB color object.
3708 * https://gist.github.com/mjijackson/5311256
3709 *
3710 * @param h - Hue
3711 * @param s - Saturation
3712 * @param v - Value
3713 *
3714 * @returns RGB color object.
3715 */
3716
3717
3718function HSVToRGB(h, s, v) {
3719 var r;
3720 var g;
3721 var b;
3722 var i = Math.floor(h * 6);
3723 var f = h * 6 - i;
3724 var p = v * (1 - s);
3725 var q = v * (1 - f * s);
3726 var t = v * (1 - (1 - f) * s);
3727
3728 switch (i % 6) {
3729 case 0:
3730 r = v, g = t, b = p;
3731 break;
3732
3733 case 1:
3734 r = q, g = v, b = p;
3735 break;
3736
3737 case 2:
3738 r = p, g = v, b = t;
3739 break;
3740
3741 case 3:
3742 r = p, g = q, b = v;
3743 break;
3744
3745 case 4:
3746 r = t, g = p, b = v;
3747 break;
3748
3749 case 5:
3750 r = v, g = p, b = q;
3751 break;
3752 }
3753
3754 return {
3755 r: Math.floor(r * 255),
3756 g: Math.floor(g * 255),
3757 b: Math.floor(b * 255)
3758 };
3759}
3760/**
3761 * Convert HSV <0, 1> into hex color string.
3762 *
3763 * @param h - Hue
3764 * @param s - Saturation
3765 * @param v - Value
3766 *
3767 * @returns Hex color string.
3768 */
3769
3770
3771function HSVToHex(h, s, v) {
3772 var rgb = HSVToRGB(h, s, v);
3773 return RGBToHex(rgb.r, rgb.g, rgb.b);
3774}
3775/**
3776 * Convert hex color string into HSV <0, 1>.
3777 *
3778 * @param hex - Hex color string.
3779 *
3780 * @returns HSV color object.
3781 */
3782
3783
3784function hexToHSV(hex) {
3785 var rgb = hexToRGB(hex);
3786
3787 if (!rgb) {
3788 throw new TypeError("'".concat(hex, "' is not a valid color."));
3789 }
3790
3791 return RGBToHSV(rgb.r, rgb.g, rgb.b);
3792}
3793/**
3794 * Validate hex color string.
3795 *
3796 * @param hex - Unknown string that may contain a color.
3797 *
3798 * @returns True if the string is valid, false otherwise.
3799 */
3800
3801
3802function isValidHex(hex) {
3803 var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
3804 return isOk;
3805}
3806/**
3807 * Validate RGB color string.
3808 *
3809 * @param rgb - Unknown string that may contain a color.
3810 *
3811 * @returns True if the string is valid, false otherwise.
3812 */
3813
3814
3815function isValidRGB(rgb) {
3816 return rgbRE.test(rgb);
3817}
3818/**
3819 * Validate RGBA color string.
3820 *
3821 * @param rgba - Unknown string that may contain a color.
3822 *
3823 * @returns True if the string is valid, false otherwise.
3824 */
3825
3826
3827function isValidRGBA(rgba) {
3828 return rgbaRE.test(rgba);
3829}
3830/**
3831 * This recursively redirects the prototype of JSON objects to the referenceObject.
3832 * This is used for default options.
3833 *
3834 * @param fields - Names of properties to be bridged.
3835 * @param referenceObject - The original object.
3836 *
3837 * @returns A new object inheriting from the referenceObject.
3838 */
3839
3840
3841function selectiveBridgeObject(fields, referenceObject) {
3842 if (referenceObject !== null && _typeof_1(referenceObject) === "object") {
3843 // !!! typeof null === 'object'
3844 var objectTo = create$2(referenceObject);
3845
3846 for (var i = 0; i < fields.length; i++) {
3847 if (Object.prototype.hasOwnProperty.call(referenceObject, fields[i])) {
3848 if (_typeof_1(referenceObject[fields[i]]) == "object") {
3849 objectTo[fields[i]] = bridgeObject(referenceObject[fields[i]]);
3850 }
3851 }
3852 }
3853
3854 return objectTo;
3855 } else {
3856 return null;
3857 }
3858}
3859/**
3860 * This recursively redirects the prototype of JSON objects to the referenceObject.
3861 * This is used for default options.
3862 *
3863 * @param referenceObject - The original object.
3864 *
3865 * @returns The Element if the referenceObject is an Element, or a new object inheriting from the referenceObject.
3866 */
3867
3868
3869function bridgeObject(referenceObject) {
3870 if (referenceObject === null || _typeof_1(referenceObject) !== "object") {
3871 return null;
3872 }
3873
3874 if (referenceObject instanceof Element) {
3875 // Avoid bridging DOM objects
3876 return referenceObject;
3877 }
3878
3879 var objectTo = create$2(referenceObject);
3880
3881 for (var i in referenceObject) {
3882 if (Object.prototype.hasOwnProperty.call(referenceObject, i)) {
3883 if (_typeof_1(referenceObject[i]) == "object") {
3884 objectTo[i] = bridgeObject(referenceObject[i]);
3885 }
3886 }
3887 }
3888
3889 return objectTo;
3890}
3891/**
3892 * This method provides a stable sort implementation, very fast for presorted data.
3893 *
3894 * @param a - The array to be sorted (in-place).
3895 * @param compare - An order comparator.
3896 *
3897 * @returns The argument a.
3898 */
3899
3900
3901function insertSort(a, compare) {
3902 for (var i = 0; i < a.length; i++) {
3903 var k = a[i];
3904 var j = void 0;
3905
3906 for (j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) {
3907 a[j] = a[j - 1];
3908 }
3909
3910 a[j] = k;
3911 }
3912
3913 return a;
3914}
3915/**
3916 * This is used to set the options of subobjects in the options object.
3917 *
3918 * A requirement of these subobjects is that they have an 'enabled' element
3919 * which is optional for the user but mandatory for the program.
3920 *
3921 * The added value here of the merge is that option 'enabled' is set as required.
3922 *
3923 * @param mergeTarget - Either this.options or the options used for the groups.
3924 * @param options - Options.
3925 * @param option - Option key in the options argument.
3926 * @param globalOptions - Global options, passed in to determine value of option 'enabled'.
3927 */
3928
3929
3930function mergeOptions(mergeTarget, options, option) {
3931 var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Local helpers
3932
3933 var isPresent = function isPresent(obj) {
3934 return obj !== null && obj !== undefined;
3935 };
3936
3937 var isObject = function isObject(obj) {
3938 return obj !== null && _typeof_1(obj) === "object";
3939 }; // https://stackoverflow.com/a/34491287/1223531
3940
3941
3942 var isEmpty = function isEmpty(obj) {
3943 for (var x in obj) {
3944 if (Object.prototype.hasOwnProperty.call(obj, x)) {
3945 return false;
3946 }
3947 }
3948
3949 return true;
3950 }; // Guards
3951
3952
3953 if (!isObject(mergeTarget)) {
3954 throw new Error("Parameter mergeTarget must be an object");
3955 }
3956
3957 if (!isObject(options)) {
3958 throw new Error("Parameter options must be an object");
3959 }
3960
3961 if (!isPresent(option)) {
3962 throw new Error("Parameter option must have a value");
3963 }
3964
3965 if (!isObject(globalOptions)) {
3966 throw new Error("Parameter globalOptions must be an object");
3967 } //
3968 // Actual merge routine, separated from main logic
3969 // Only a single level of options is merged. Deeper levels are ref'd. This may actually be an issue.
3970 //
3971
3972
3973 var doMerge = function doMerge(target, options, option) {
3974 if (!isObject(target[option])) {
3975 target[option] = {};
3976 }
3977
3978 var src = options[option];
3979 var dst = target[option];
3980
3981 for (var prop in src) {
3982 if (Object.prototype.hasOwnProperty.call(src, prop)) {
3983 dst[prop] = src[prop];
3984 }
3985 }
3986 }; // Local initialization
3987
3988
3989 var srcOption = options[option];
3990 var globalPassed = isObject(globalOptions) && !isEmpty(globalOptions);
3991 var globalOption = globalPassed ? globalOptions[option] : undefined;
3992 var globalEnabled = globalOption ? globalOption.enabled : undefined; /////////////////////////////////////////
3993 // Main routine
3994 /////////////////////////////////////////
3995
3996 if (srcOption === undefined) {
3997 return; // Nothing to do
3998 }
3999
4000 if (typeof srcOption === "boolean") {
4001 if (!isObject(mergeTarget[option])) {
4002 mergeTarget[option] = {};
4003 }
4004
4005 mergeTarget[option].enabled = srcOption;
4006 return;
4007 }
4008
4009 if (srcOption === null && !isObject(mergeTarget[option])) {
4010 // If possible, explicit copy from globals
4011 if (isPresent(globalOption)) {
4012 mergeTarget[option] = create$2(globalOption);
4013 } else {
4014 return; // Nothing to do
4015 }
4016 }
4017
4018 if (!isObject(srcOption)) {
4019 return;
4020 } //
4021 // Ensure that 'enabled' is properly set. It is required internally
4022 // Note that the value from options will always overwrite the existing value
4023 //
4024
4025
4026 var enabled = true; // default value
4027
4028 if (srcOption.enabled !== undefined) {
4029 enabled = srcOption.enabled;
4030 } else {
4031 // Take from globals, if present
4032 if (globalEnabled !== undefined) {
4033 enabled = globalOption.enabled;
4034 }
4035 }
4036
4037 doMerge(mergeTarget, options, option);
4038 mergeTarget[option].enabled = enabled;
4039}
4040/**
4041 * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses
4042 * this function will then iterate in both directions over this sorted list to find all visible items.
4043 *
4044 * @param orderedItems - Items ordered by start
4045 * @param comparator - -1 is lower, 0 is equal, 1 is higher
4046 * @param field - Property name on an item (i.e. item[field]).
4047 * @param field2 - Second property name on an item (i.e. item[field][field2]).
4048 *
4049 * @returns Index of the found item or -1 if nothing was found.
4050 */
4051
4052
4053function binarySearchCustom(orderedItems, comparator, field, field2) {
4054 var maxIterations = 10000;
4055 var iteration = 0;
4056 var low = 0;
4057 var high = orderedItems.length - 1;
4058
4059 while (low <= high && iteration < maxIterations) {
4060 var middle = Math.floor((low + high) / 2);
4061 var item = orderedItems[middle];
4062
4063 var _value2 = field2 === undefined ? item[field] : item[field][field2];
4064
4065 var searchResult = comparator(_value2);
4066
4067 if (searchResult == 0) {
4068 // jihaa, found a visible item!
4069 return middle;
4070 } else if (searchResult == -1) {
4071 // it is too small --> increase low
4072 low = middle + 1;
4073 } else {
4074 // it is too big --> decrease high
4075 high = middle - 1;
4076 }
4077
4078 iteration++;
4079 }
4080
4081 return -1;
4082}
4083/**
4084 * This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of
4085 * two values, we return either the one before or the one after, depending on user input
4086 * If it is found, we return the index, else -1.
4087 *
4088 * @param orderedItems - Sorted array.
4089 * @param target - The searched value.
4090 * @param field - Name of the property in items to be searched.
4091 * @param sidePreference - If the target is between two values, should the index of the before or the after be returned?
4092 * @param comparator - An optional comparator, returning -1, 0, 1 for <, ===, >.
4093 *
4094 * @returns The index of found value or -1 if nothing was found.
4095 */
4096
4097
4098function binarySearchValue(orderedItems, target, field, sidePreference, comparator) {
4099 var maxIterations = 10000;
4100 var iteration = 0;
4101 var low = 0;
4102 var high = orderedItems.length - 1;
4103 var prevValue;
4104 var value;
4105 var nextValue;
4106 var middle;
4107 comparator = comparator != undefined ? comparator : function (a, b) {
4108 return a == b ? 0 : a < b ? -1 : 1;
4109 };
4110
4111 while (low <= high && iteration < maxIterations) {
4112 // get a new guess
4113 middle = Math.floor(0.5 * (high + low));
4114 prevValue = orderedItems[Math.max(0, middle - 1)][field];
4115 value = orderedItems[middle][field];
4116 nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field];
4117
4118 if (comparator(value, target) == 0) {
4119 // we found the target
4120 return middle;
4121 } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) {
4122 // target is in between of the previous and the current
4123 return sidePreference == "before" ? Math.max(0, middle - 1) : middle;
4124 } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) {
4125 // target is in between of the current and the next
4126 return sidePreference == "before" ? middle : Math.min(orderedItems.length - 1, middle + 1);
4127 } else {
4128 // didnt find the target, we need to change our boundaries.
4129 if (comparator(value, target) < 0) {
4130 // it is too small --> increase low
4131 low = middle + 1;
4132 } else {
4133 // it is too big --> decrease high
4134 high = middle - 1;
4135 }
4136 }
4137
4138 iteration++;
4139 } // didnt find anything. Return -1.
4140
4141
4142 return -1;
4143}
4144/*
4145 * Easing Functions.
4146 * Only considering the t value for the range [0, 1] => [0, 1].
4147 *
4148 * Inspiration: from http://gizma.com/easing/
4149 * https://gist.github.com/gre/1650294
4150 */
4151
4152
4153var easingFunctions = {
4154 /**
4155 * no easing, no acceleration
4156 *
4157 * @param t - Time.
4158 *
4159 * @returns Value at time t.
4160 */
4161 linear: function linear(t) {
4162 return t;
4163 },
4164
4165 /**
4166 * accelerating from zero velocity
4167 *
4168 * @param t - Time.
4169 *
4170 * @returns Value at time t.
4171 */
4172 easeInQuad: function easeInQuad(t) {
4173 return t * t;
4174 },
4175
4176 /**
4177 * decelerating to zero velocity
4178 *
4179 * @param t - Time.
4180 *
4181 * @returns Value at time t.
4182 */
4183 easeOutQuad: function easeOutQuad(t) {
4184 return t * (2 - t);
4185 },
4186
4187 /**
4188 * acceleration until halfway, then deceleration
4189 *
4190 * @param t - Time.
4191 *
4192 * @returns Value at time t.
4193 */
4194 easeInOutQuad: function easeInOutQuad(t) {
4195 return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
4196 },
4197
4198 /**
4199 * accelerating from zero velocity
4200 *
4201 * @param t - Time.
4202 *
4203 * @returns Value at time t.
4204 */
4205 easeInCubic: function easeInCubic(t) {
4206 return t * t * t;
4207 },
4208
4209 /**
4210 * decelerating to zero velocity
4211 *
4212 * @param t - Time.
4213 *
4214 * @returns Value at time t.
4215 */
4216 easeOutCubic: function easeOutCubic(t) {
4217 return --t * t * t + 1;
4218 },
4219
4220 /**
4221 * acceleration until halfway, then deceleration
4222 *
4223 * @param t - Time.
4224 *
4225 * @returns Value at time t.
4226 */
4227 easeInOutCubic: function easeInOutCubic(t) {
4228 return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
4229 },
4230
4231 /**
4232 * accelerating from zero velocity
4233 *
4234 * @param t - Time.
4235 *
4236 * @returns Value at time t.
4237 */
4238 easeInQuart: function easeInQuart(t) {
4239 return t * t * t * t;
4240 },
4241
4242 /**
4243 * decelerating to zero velocity
4244 *
4245 * @param t - Time.
4246 *
4247 * @returns Value at time t.
4248 */
4249 easeOutQuart: function easeOutQuart(t) {
4250 return 1 - --t * t * t * t;
4251 },
4252
4253 /**
4254 * acceleration until halfway, then deceleration
4255 *
4256 * @param t - Time.
4257 *
4258 * @returns Value at time t.
4259 */
4260 easeInOutQuart: function easeInOutQuart(t) {
4261 return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
4262 },
4263
4264 /**
4265 * accelerating from zero velocity
4266 *
4267 * @param t - Time.
4268 *
4269 * @returns Value at time t.
4270 */
4271 easeInQuint: function easeInQuint(t) {
4272 return t * t * t * t * t;
4273 },
4274
4275 /**
4276 * decelerating to zero velocity
4277 *
4278 * @param t - Time.
4279 *
4280 * @returns Value at time t.
4281 */
4282 easeOutQuint: function easeOutQuint(t) {
4283 return 1 + --t * t * t * t * t;
4284 },
4285
4286 /**
4287 * acceleration until halfway, then deceleration
4288 *
4289 * @param t - Time.
4290 *
4291 * @returns Value at time t.
4292 */
4293 easeInOutQuint: function easeInOutQuint(t) {
4294 return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
4295 }
4296};
4297/**
4298 * Experimentaly compute the width of the scrollbar for this browser.
4299 *
4300 * @returns The width in pixels.
4301 */
4302
4303function getScrollBarWidth() {
4304 var inner = document.createElement("p");
4305 inner.style.width = "100%";
4306 inner.style.height = "200px";
4307 var outer = document.createElement("div");
4308 outer.style.position = "absolute";
4309 outer.style.top = "0px";
4310 outer.style.left = "0px";
4311 outer.style.visibility = "hidden";
4312 outer.style.width = "200px";
4313 outer.style.height = "150px";
4314 outer.style.overflow = "hidden";
4315 outer.appendChild(inner);
4316 document.body.appendChild(outer);
4317 var w1 = inner.offsetWidth;
4318 outer.style.overflow = "scroll";
4319 var w2 = inner.offsetWidth;
4320
4321 if (w1 == w2) {
4322 w2 = outer.clientWidth;
4323 }
4324
4325 document.body.removeChild(outer);
4326 return w1 - w2;
4327} // @TODO: This doesn't work properly.
4328// It works only for single property objects,
4329// otherwise it combines all of the types in a union.
4330// export function topMost<K1 extends string, V1> (
4331// pile: Record<K1, undefined | V1>[],
4332// accessors: K1 | [K1]
4333// ): undefined | V1
4334// export function topMost<K1 extends string, K2 extends string, V1, V2> (
4335// pile: Record<K1, undefined | V1 | Record<K2, undefined | V2>>[],
4336// accessors: [K1, K2]
4337// ): undefined | V1 | V2
4338// export function topMost<K1 extends string, K2 extends string, K3 extends string, V1, V2, V3> (
4339// pile: Record<K1, undefined | V1 | Record<K2, undefined | V2 | Record<K3, undefined | V3>>>[],
4340// accessors: [K1, K2, K3]
4341// ): undefined | V1 | V2 | V3
4342
4343/**
4344 * Get the top most property value from a pile of objects.
4345 *
4346 * @param pile - Array of objects, no required format.
4347 * @param accessors - Array of property names (e.g. object['foo']['bar'] → ['foo', 'bar']).
4348 *
4349 * @returns Value of the property with given accessors path from the first pile item where it's not undefined.
4350 */
4351
4352
4353function topMost(pile, accessors) {
4354 var candidate;
4355
4356 if (!isArray$5(accessors)) {
4357 accessors = [accessors];
4358 }
4359
4360 var _iteratorNormalCompletion = true;
4361 var _didIteratorError = false;
4362 var _iteratorError = undefined;
4363
4364 try {
4365 for (var _iterator = getIterator$2(pile), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
4366 var member = _step.value;
4367
4368 if (member) {
4369 candidate = member[accessors[0]];
4370
4371 for (var i = 1; i < accessors.length; i++) {
4372 if (candidate) {
4373 candidate = candidate[accessors[i]];
4374 }
4375 }
4376
4377 if (typeof candidate !== "undefined") {
4378 break;
4379 }
4380 }
4381 }
4382 } catch (err) {
4383 _didIteratorError = true;
4384 _iteratorError = err;
4385 } finally {
4386 try {
4387 if (!_iteratorNormalCompletion && _iterator.return != null) {
4388 _iterator.return();
4389 }
4390 } finally {
4391 if (_didIteratorError) {
4392 throw _iteratorError;
4393 }
4394 }
4395 }
4396
4397 return candidate;
4398}
4399
4400var util =
4401/*#__PURE__*/
4402Object.freeze({
4403 __proto__: null,
4404 isNumber: isNumber,
4405 recursiveDOMDelete: recursiveDOMDelete,
4406 isString: isString,
4407 isObject: isObject$1,
4408 isDate: isDate,
4409 fillIfDefined: fillIfDefined,
4410 extend: extend,
4411 selectiveExtend: selectiveExtend,
4412 selectiveDeepExtend: selectiveDeepExtend,
4413 selectiveNotDeepExtend: selectiveNotDeepExtend,
4414 deepExtend: deepExtend,
4415 equalArray: equalArray,
4416 getType: getType,
4417 copyAndExtendArray: copyAndExtendArray,
4418 copyArray: copyArray,
4419 getAbsoluteLeft: getAbsoluteLeft,
4420 getAbsoluteRight: getAbsoluteRight,
4421 getAbsoluteTop: getAbsoluteTop,
4422 addClassName: addClassName,
4423 removeClassName: removeClassName,
4424 forEach: forEach$3,
4425 toArray: toArray,
4426 updateProperty: updateProperty,
4427 throttle: throttle,
4428 addEventListener: addEventListener,
4429 removeEventListener: removeEventListener,
4430 preventDefault: preventDefault,
4431 getTarget: getTarget,
4432 hasParent: hasParent,
4433 option: option,
4434 hexToRGB: hexToRGB,
4435 overrideOpacity: overrideOpacity,
4436 RGBToHex: RGBToHex,
4437 parseColor: parseColor,
4438 RGBToHSV: RGBToHSV,
4439 addCssText: addCssText,
4440 removeCssText: removeCssText,
4441 HSVToRGB: HSVToRGB,
4442 HSVToHex: HSVToHex,
4443 hexToHSV: hexToHSV,
4444 isValidHex: isValidHex,
4445 isValidRGB: isValidRGB,
4446 isValidRGBA: isValidRGBA,
4447 selectiveBridgeObject: selectiveBridgeObject,
4448 bridgeObject: bridgeObject,
4449 insertSort: insertSort,
4450 mergeOptions: mergeOptions,
4451 binarySearchCustom: binarySearchCustom,
4452 binarySearchValue: binarySearchValue,
4453 easingFunctions: easingFunctions,
4454 getScrollBarWidth: getScrollBarWidth,
4455 topMost: topMost,
4456 randomUUID: uuid4
4457}); // New API (tree shakeable).
4458
4459var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4460
4461function commonjsRequire () {
4462 throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
4463}
4464
4465function createCommonjsModule$1(fn, module) {
4466 return module = { exports: {} }, fn(module, module.exports), module.exports;
4467}
4468
4469var DOMutil = createCommonjsModule$1(function (module, exports) {
4470 // DOM utility methods
4471
4472 /**
4473 * this prepares the JSON container for allocating SVG elements
4474 * @param {Object} JSONcontainer
4475 * @private
4476 */
4477 exports.prepareElements = function (JSONcontainer) {
4478 // cleanup the redundant svgElements;
4479 for (var elementType in JSONcontainer) {
4480 if (JSONcontainer.hasOwnProperty(elementType)) {
4481 JSONcontainer[elementType].redundant = JSONcontainer[elementType].used;
4482 JSONcontainer[elementType].used = [];
4483 }
4484 }
4485 };
4486 /**
4487 * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from
4488 * which to remove the redundant elements.
4489 *
4490 * @param {Object} JSONcontainer
4491 * @private
4492 */
4493
4494
4495 exports.cleanupElements = function (JSONcontainer) {
4496 // cleanup the redundant svgElements;
4497 for (var elementType in JSONcontainer) {
4498 if (JSONcontainer.hasOwnProperty(elementType)) {
4499 if (JSONcontainer[elementType].redundant) {
4500 for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) {
4501 JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]);
4502 }
4503
4504 JSONcontainer[elementType].redundant = [];
4505 }
4506 }
4507 }
4508 };
4509 /**
4510 * Ensures that all elements are removed first up so they can be recreated cleanly
4511 * @param {Object} JSONcontainer
4512 */
4513
4514
4515 exports.resetElements = function (JSONcontainer) {
4516 exports.prepareElements(JSONcontainer);
4517 exports.cleanupElements(JSONcontainer);
4518 exports.prepareElements(JSONcontainer);
4519 };
4520 /**
4521 * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
4522 * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
4523 *
4524 * @param {string} elementType
4525 * @param {Object} JSONcontainer
4526 * @param {Object} svgContainer
4527 * @returns {Element}
4528 * @private
4529 */
4530
4531
4532 exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) {
4533 var element; // allocate SVG element, if it doesnt yet exist, create one.
4534
4535 if (JSONcontainer.hasOwnProperty(elementType)) {
4536 // this element has been created before
4537 // check if there is an redundant element
4538 if (JSONcontainer[elementType].redundant.length > 0) {
4539 element = JSONcontainer[elementType].redundant[0];
4540 JSONcontainer[elementType].redundant.shift();
4541 } else {
4542 // create a new element and add it to the SVG
4543 element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
4544 svgContainer.appendChild(element);
4545 }
4546 } else {
4547 // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it.
4548 element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
4549 JSONcontainer[elementType] = {
4550 used: [],
4551 redundant: []
4552 };
4553 svgContainer.appendChild(element);
4554 }
4555
4556 JSONcontainer[elementType].used.push(element);
4557 return element;
4558 };
4559 /**
4560 * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
4561 * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
4562 *
4563 * @param {string} elementType
4564 * @param {Object} JSONcontainer
4565 * @param {Element} DOMContainer
4566 * @param {Element} insertBefore
4567 * @returns {*}
4568 */
4569
4570
4571 exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) {
4572 var element; // allocate DOM element, if it doesnt yet exist, create one.
4573
4574 if (JSONcontainer.hasOwnProperty(elementType)) {
4575 // this element has been created before
4576 // check if there is an redundant element
4577 if (JSONcontainer[elementType].redundant.length > 0) {
4578 element = JSONcontainer[elementType].redundant[0];
4579 JSONcontainer[elementType].redundant.shift();
4580 } else {
4581 // create a new element and add it to the SVG
4582 element = document.createElement(elementType);
4583
4584 if (insertBefore !== undefined) {
4585 DOMContainer.insertBefore(element, insertBefore);
4586 } else {
4587 DOMContainer.appendChild(element);
4588 }
4589 }
4590 } else {
4591 // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it.
4592 element = document.createElement(elementType);
4593 JSONcontainer[elementType] = {
4594 used: [],
4595 redundant: []
4596 };
4597
4598 if (insertBefore !== undefined) {
4599 DOMContainer.insertBefore(element, insertBefore);
4600 } else {
4601 DOMContainer.appendChild(element);
4602 }
4603 }
4604
4605 JSONcontainer[elementType].used.push(element);
4606 return element;
4607 };
4608 /**
4609 * Draw a point object. This is a separate function because it can also be called by the legend.
4610 * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions
4611 * as well.
4612 *
4613 * @param {number} x
4614 * @param {number} y
4615 * @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' }
4616 * @param {Object} JSONcontainer
4617 * @param {Object} svgContainer
4618 * @param {Object} labelObj
4619 * @returns {vis.PointItem}
4620 */
4621
4622
4623 exports.drawPoint = function (x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
4624 var point;
4625
4626 if (groupTemplate.style == 'circle') {
4627 point = exports.getSVGElement('circle', JSONcontainer, svgContainer);
4628 point.setAttributeNS(null, "cx", x);
4629 point.setAttributeNS(null, "cy", y);
4630 point.setAttributeNS(null, "r", 0.5 * groupTemplate.size);
4631 } else {
4632 point = exports.getSVGElement('rect', JSONcontainer, svgContainer);
4633 point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size);
4634 point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size);
4635 point.setAttributeNS(null, "width", groupTemplate.size);
4636 point.setAttributeNS(null, "height", groupTemplate.size);
4637 }
4638
4639 if (groupTemplate.styles !== undefined) {
4640 point.setAttributeNS(null, "style", groupTemplate.styles);
4641 }
4642
4643 point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); //handle label
4644
4645 if (labelObj) {
4646 var label = exports.getSVGElement('text', JSONcontainer, svgContainer);
4647
4648 if (labelObj.xOffset) {
4649 x = x + labelObj.xOffset;
4650 }
4651
4652 if (labelObj.yOffset) {
4653 y = y + labelObj.yOffset;
4654 }
4655
4656 if (labelObj.content) {
4657 label.textContent = labelObj.content;
4658 }
4659
4660 if (labelObj.className) {
4661 label.setAttributeNS(null, "class", labelObj.className + " vis-label");
4662 }
4663
4664 label.setAttributeNS(null, "x", x);
4665 label.setAttributeNS(null, "y", y);
4666 }
4667
4668 return point;
4669 };
4670 /**
4671 * draw a bar SVG element centered on the X coordinate
4672 *
4673 * @param {number} x
4674 * @param {number} y
4675 * @param {number} width
4676 * @param {number} height
4677 * @param {string} className
4678 * @param {Object} JSONcontainer
4679 * @param {Object} svgContainer
4680 * @param {string} style
4681 */
4682
4683
4684 exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) {
4685 if (height != 0) {
4686 if (height < 0) {
4687 height *= -1;
4688 y -= height;
4689 }
4690
4691 var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer);
4692 rect.setAttributeNS(null, "x", x - 0.5 * width);
4693 rect.setAttributeNS(null, "y", y);
4694 rect.setAttributeNS(null, "width", width);
4695 rect.setAttributeNS(null, "height", height);
4696 rect.setAttributeNS(null, "class", className);
4697
4698 if (style) {
4699 rect.setAttributeNS(null, "style", style);
4700 }
4701 }
4702 };
4703});
4704var DOMutil_1 = DOMutil.prepareElements;
4705var DOMutil_2 = DOMutil.cleanupElements;
4706var DOMutil_3 = DOMutil.resetElements;
4707var DOMutil_4 = DOMutil.getSVGElement;
4708var DOMutil_5 = DOMutil.getDOMElement;
4709var DOMutil_6 = DOMutil.drawPoint;
4710var DOMutil_7 = DOMutil.drawBar;
4711
4712/**
4713 * vis-data - data
4714 * http://visjs.org/
4715 *
4716 * Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data.
4717 *
4718 * @version 6.2.4
4719 * @date 2019-11-28T17:58:58Z
4720 *
4721 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
4722 * @copyright (c) 2018-2019 visjs contributors, https://github.com/visjs
4723 *
4724 * @license
4725 * vis.js is dual licensed under both
4726 *
4727 * 1. The Apache 2.0 License
4728 * http://www.apache.org/licenses/LICENSE-2.0
4729 *
4730 * and
4731 *
4732 * 2. The MIT License
4733 * http://opensource.org/licenses/MIT
4734 *
4735 * vis.js may be distributed under either license.
4736 */
4737var commonjsGlobal$2 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4738
4739function createCommonjsModule$2(fn, module) {
4740 return module = {
4741 exports: {}
4742 }, fn(module, module.exports), module.exports;
4743}
4744
4745var check$1 = function (it) {
4746 return it && it.Math == Math && it;
4747}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
4748
4749
4750var global_1$1 = // eslint-disable-next-line no-undef
4751check$1(typeof globalThis == 'object' && globalThis) || check$1(typeof window == 'object' && window) || check$1(typeof self == 'object' && self) || check$1(typeof commonjsGlobal$2 == 'object' && commonjsGlobal$2) || // eslint-disable-next-line no-new-func
4752Function('return this')();
4753
4754var fails$1 = function (exec) {
4755 try {
4756 return !!exec();
4757 } catch (error) {
4758 return true;
4759 }
4760};
4761
4762var descriptors$1 = !fails$1(function () {
4763 return Object.defineProperty({}, 'a', {
4764 get: function () {
4765 return 7;
4766 }
4767 }).a != 7;
4768});
4769var nativePropertyIsEnumerable$2 = {}.propertyIsEnumerable;
4770var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
4771
4772var NASHORN_BUG$1 = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable$2.call({
4773 1: 2
4774}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
4775// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
4776
4777var f$7 = NASHORN_BUG$1 ? function propertyIsEnumerable(V) {
4778 var descriptor = getOwnPropertyDescriptor$4(this, V);
4779 return !!descriptor && descriptor.enumerable;
4780} : nativePropertyIsEnumerable$2;
4781var objectPropertyIsEnumerable$1 = {
4782 f: f$7
4783};
4784
4785var createPropertyDescriptor$1 = function (bitmap, value) {
4786 return {
4787 enumerable: !(bitmap & 1),
4788 configurable: !(bitmap & 2),
4789 writable: !(bitmap & 4),
4790 value: value
4791 };
4792};
4793
4794var toString$2 = {}.toString;
4795
4796var classofRaw$1 = function (it) {
4797 return toString$2.call(it).slice(8, -1);
4798};
4799
4800var split$1 = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
4801
4802var indexedObject$1 = fails$1(function () {
4803 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
4804 // eslint-disable-next-line no-prototype-builtins
4805 return !Object('z').propertyIsEnumerable(0);
4806}) ? function (it) {
4807 return classofRaw$1(it) == 'String' ? split$1.call(it, '') : Object(it);
4808} : Object; // `RequireObjectCoercible` abstract operation
4809// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
4810
4811var requireObjectCoercible$1 = function (it) {
4812 if (it == undefined) throw TypeError("Can't call method on " + it);
4813 return it;
4814};
4815
4816var toIndexedObject$1 = function (it) {
4817 return indexedObject$1(requireObjectCoercible$1(it));
4818};
4819
4820var isObject$2 = function (it) {
4821 return typeof it === 'object' ? it !== null : typeof it === 'function';
4822}; // https://tc39.github.io/ecma262/#sec-toprimitive
4823// instead of the ES6 spec version, we didn't implement @@toPrimitive case
4824// and the second argument - flag - preferred type is a string
4825
4826
4827var toPrimitive$1 = function (input, PREFERRED_STRING) {
4828 if (!isObject$2(input)) return input;
4829 var fn, val;
4830 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$2(val = fn.call(input))) return val;
4831 if (typeof (fn = input.valueOf) == 'function' && !isObject$2(val = fn.call(input))) return val;
4832 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$2(val = fn.call(input))) return val;
4833 throw TypeError("Can't convert object to primitive value");
4834};
4835
4836var hasOwnProperty$1 = {}.hasOwnProperty;
4837
4838var has$2 = function (it, key) {
4839 return hasOwnProperty$1.call(it, key);
4840};
4841
4842var document$2 = global_1$1.document; // typeof document.createElement is 'object' in old IE
4843
4844var EXISTS$1 = isObject$2(document$2) && isObject$2(document$2.createElement);
4845
4846var documentCreateElement$1 = function (it) {
4847 return EXISTS$1 ? document$2.createElement(it) : {};
4848};
4849
4850var ie8DomDefine$1 = !descriptors$1 && !fails$1(function () {
4851 return Object.defineProperty(documentCreateElement$1('div'), 'a', {
4852 get: function () {
4853 return 7;
4854 }
4855 }).a != 7;
4856});
4857var nativeGetOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
4858// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
4859
4860var f$1$1 = descriptors$1 ? nativeGetOwnPropertyDescriptor$3 : function getOwnPropertyDescriptor(O, P) {
4861 O = toIndexedObject$1(O);
4862 P = toPrimitive$1(P, true);
4863 if (ie8DomDefine$1) try {
4864 return nativeGetOwnPropertyDescriptor$3(O, P);
4865 } catch (error) {
4866 /* empty */
4867 }
4868 if (has$2(O, P)) return createPropertyDescriptor$1(!objectPropertyIsEnumerable$1.f.call(O, P), O[P]);
4869};
4870var objectGetOwnPropertyDescriptor$1 = {
4871 f: f$1$1
4872};
4873var replacement$1 = /#|\.prototype\./;
4874
4875var isForced$1 = function (feature, detection) {
4876 var value = data$1[normalize$1(feature)];
4877 return value == POLYFILL$1 ? true : value == NATIVE$1 ? false : typeof detection == 'function' ? fails$1(detection) : !!detection;
4878};
4879
4880var normalize$1 = isForced$1.normalize = function (string) {
4881 return String(string).replace(replacement$1, '.').toLowerCase();
4882};
4883
4884var data$1 = isForced$1.data = {};
4885var NATIVE$1 = isForced$1.NATIVE = 'N';
4886var POLYFILL$1 = isForced$1.POLYFILL = 'P';
4887var isForced_1$1 = isForced$1;
4888var path$1 = {};
4889
4890var aFunction$2 = function (it) {
4891 if (typeof it != 'function') {
4892 throw TypeError(String(it) + ' is not a function');
4893 }
4894
4895 return it;
4896};
4897
4898var bindContext$1 = function (fn, that, length) {
4899 aFunction$2(fn);
4900 if (that === undefined) return fn;
4901
4902 switch (length) {
4903 case 0:
4904 return function () {
4905 return fn.call(that);
4906 };
4907
4908 case 1:
4909 return function (a) {
4910 return fn.call(that, a);
4911 };
4912
4913 case 2:
4914 return function (a, b) {
4915 return fn.call(that, a, b);
4916 };
4917
4918 case 3:
4919 return function (a, b, c) {
4920 return fn.call(that, a, b, c);
4921 };
4922 }
4923
4924 return function ()
4925 /* ...args */
4926 {
4927 return fn.apply(that, arguments);
4928 };
4929};
4930
4931var anObject$1 = function (it) {
4932 if (!isObject$2(it)) {
4933 throw TypeError(String(it) + ' is not an object');
4934 }
4935
4936 return it;
4937};
4938
4939var nativeDefineProperty$2 = Object.defineProperty; // `Object.defineProperty` method
4940// https://tc39.github.io/ecma262/#sec-object.defineproperty
4941
4942var f$2$1 = descriptors$1 ? nativeDefineProperty$2 : function defineProperty(O, P, Attributes) {
4943 anObject$1(O);
4944 P = toPrimitive$1(P, true);
4945 anObject$1(Attributes);
4946 if (ie8DomDefine$1) try {
4947 return nativeDefineProperty$2(O, P, Attributes);
4948 } catch (error) {
4949 /* empty */
4950 }
4951 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
4952 if ('value' in Attributes) O[P] = Attributes.value;
4953 return O;
4954};
4955var objectDefineProperty$1 = {
4956 f: f$2$1
4957};
4958var createNonEnumerableProperty$1 = descriptors$1 ? function (object, key, value) {
4959 return objectDefineProperty$1.f(object, key, createPropertyDescriptor$1(1, value));
4960} : function (object, key, value) {
4961 object[key] = value;
4962 return object;
4963};
4964var getOwnPropertyDescriptor$1$1 = objectGetOwnPropertyDescriptor$1.f;
4965
4966var wrapConstructor$1 = function (NativeConstructor) {
4967 var Wrapper = function (a, b, c) {
4968 if (this instanceof NativeConstructor) {
4969 switch (arguments.length) {
4970 case 0:
4971 return new NativeConstructor();
4972
4973 case 1:
4974 return new NativeConstructor(a);
4975
4976 case 2:
4977 return new NativeConstructor(a, b);
4978 }
4979
4980 return new NativeConstructor(a, b, c);
4981 }
4982
4983 return NativeConstructor.apply(this, arguments);
4984 };
4985
4986 Wrapper.prototype = NativeConstructor.prototype;
4987 return Wrapper;
4988};
4989/*
4990 options.target - name of the target object
4991 options.global - target is the global object
4992 options.stat - export as static methods of target
4993 options.proto - export as prototype methods of target
4994 options.real - real prototype method for the `pure` version
4995 options.forced - export even if the native feature is available
4996 options.bind - bind methods to the target, required for the `pure` version
4997 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
4998 options.unsafe - use the simple assignment of property instead of delete + defineProperty
4999 options.sham - add a flag to not completely full polyfills
5000 options.enumerable - export as enumerable property
5001 options.noTargetGet - prevent calling a getter on target
5002*/
5003
5004
5005var _export$1 = function (options, source) {
5006 var TARGET = options.target;
5007 var GLOBAL = options.global;
5008 var STATIC = options.stat;
5009 var PROTO = options.proto;
5010 var nativeSource = GLOBAL ? global_1$1 : STATIC ? global_1$1[TARGET] : (global_1$1[TARGET] || {}).prototype;
5011 var target = GLOBAL ? path$1 : path$1[TARGET] || (path$1[TARGET] = {});
5012 var targetPrototype = target.prototype;
5013 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
5014 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
5015
5016 for (key in source) {
5017 FORCED = isForced_1$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native
5018
5019 USE_NATIVE = !FORCED && nativeSource && has$2(nativeSource, key);
5020 targetProperty = target[key];
5021 if (USE_NATIVE) if (options.noTargetGet) {
5022 descriptor = getOwnPropertyDescriptor$1$1(nativeSource, key);
5023 nativeProperty = descriptor && descriptor.value;
5024 } else nativeProperty = nativeSource[key]; // export native or implementation
5025
5026 sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
5027 if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue; // bind timers to global for call from export context
5028
5029 if (options.bind && USE_NATIVE) resultProperty = bindContext$1(sourceProperty, global_1$1); // wrap global constructors for prevent changs in this version
5030 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor$1(sourceProperty); // make static versions for prototype methods
5031 else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext$1(Function.call, sourceProperty); // default case
5032 else resultProperty = sourceProperty; // add a flag to not completely full polyfills
5033
5034 if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
5035 createNonEnumerableProperty$1(resultProperty, 'sham', true);
5036 }
5037
5038 target[key] = resultProperty;
5039
5040 if (PROTO) {
5041 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
5042
5043 if (!has$2(path$1, VIRTUAL_PROTOTYPE)) {
5044 createNonEnumerableProperty$1(path$1, VIRTUAL_PROTOTYPE, {});
5045 } // export virtual prototype methods
5046
5047
5048 path$1[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods
5049
5050 if (options.real && targetPrototype && !targetPrototype[key]) {
5051 createNonEnumerableProperty$1(targetPrototype, key, sourceProperty);
5052 }
5053 }
5054 }
5055}; // https://tc39.github.io/ecma262/#sec-object.defineproperty
5056
5057
5058_export$1({
5059 target: 'Object',
5060 stat: true,
5061 forced: !descriptors$1,
5062 sham: !descriptors$1
5063}, {
5064 defineProperty: objectDefineProperty$1.f
5065});
5066
5067var defineProperty_1$1 = createCommonjsModule$2(function (module) {
5068 var Object = path$1.Object;
5069
5070 var defineProperty = module.exports = function defineProperty(it, key, desc) {
5071 return Object.defineProperty(it, key, desc);
5072 };
5073
5074 if (Object.defineProperty.sham) defineProperty.sham = true;
5075});
5076var defineProperty$7 = defineProperty_1$1;
5077var defineProperty$1$1 = defineProperty$7;
5078var ceil$1 = Math.ceil;
5079var floor$1 = Math.floor; // `ToInteger` abstract operation
5080// https://tc39.github.io/ecma262/#sec-tointeger
5081
5082var toInteger$1 = function (argument) {
5083 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil$1)(argument);
5084};
5085
5086var min$2 = Math.min; // `ToLength` abstract operation
5087// https://tc39.github.io/ecma262/#sec-tolength
5088
5089var toLength$1 = function (argument) {
5090 return argument > 0 ? min$2(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
5091};
5092
5093var max$2 = Math.max;
5094var min$1$1 = Math.min; // Helper for a popular repeating case of the spec:
5095// Let integer be ? ToInteger(index).
5096// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
5097
5098var toAbsoluteIndex$1 = function (index, length) {
5099 var integer = toInteger$1(index);
5100 return integer < 0 ? max$2(integer + length, 0) : min$1$1(integer, length);
5101};
5102
5103var createMethod$5 = function (IS_INCLUDES) {
5104 return function ($this, el, fromIndex) {
5105 var O = toIndexedObject$1($this);
5106 var length = toLength$1(O.length);
5107 var index = toAbsoluteIndex$1(fromIndex, length);
5108 var value; // Array#includes uses SameValueZero equality algorithm
5109 // eslint-disable-next-line no-self-compare
5110
5111 if (IS_INCLUDES && el != el) while (length > index) {
5112 value = O[index++]; // eslint-disable-next-line no-self-compare
5113
5114 if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
5115 } else for (; length > index; index++) {
5116 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
5117 }
5118 return !IS_INCLUDES && -1;
5119 };
5120};
5121
5122var arrayIncludes$1 = {
5123 // `Array.prototype.includes` method
5124 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
5125 includes: createMethod$5(true),
5126 // `Array.prototype.indexOf` method
5127 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
5128 indexOf: createMethod$5(false)
5129};
5130var hiddenKeys$2 = {};
5131var indexOf$4 = arrayIncludes$1.indexOf;
5132
5133var objectKeysInternal$1 = function (object, names) {
5134 var O = toIndexedObject$1(object);
5135 var i = 0;
5136 var result = [];
5137 var key;
5138
5139 for (key in O) !has$2(hiddenKeys$2, key) && has$2(O, key) && result.push(key); // Don't enum bug & hidden keys
5140
5141
5142 while (names.length > i) if (has$2(O, key = names[i++])) {
5143 ~indexOf$4(result, key) || result.push(key);
5144 }
5145
5146 return result;
5147}; // IE8- don't enum bug keys
5148
5149
5150var enumBugKeys$1 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; // https://tc39.github.io/ecma262/#sec-object.keys
5151
5152var objectKeys$1 = Object.keys || function keys(O) {
5153 return objectKeysInternal$1(O, enumBugKeys$1);
5154}; // https://tc39.github.io/ecma262/#sec-object.defineproperties
5155
5156
5157var objectDefineProperties$1 = descriptors$1 ? Object.defineProperties : function defineProperties(O, Properties) {
5158 anObject$1(O);
5159 var keys = objectKeys$1(Properties);
5160 var length = keys.length;
5161 var index = 0;
5162 var key;
5163
5164 while (length > index) objectDefineProperty$1.f(O, key = keys[index++], Properties[key]);
5165
5166 return O;
5167}; // https://tc39.github.io/ecma262/#sec-object.defineproperties
5168
5169_export$1({
5170 target: 'Object',
5171 stat: true,
5172 forced: !descriptors$1,
5173 sham: !descriptors$1
5174}, {
5175 defineProperties: objectDefineProperties$1
5176});
5177
5178var defineProperties_1$1 = createCommonjsModule$2(function (module) {
5179 var Object = path$1.Object;
5180
5181 var defineProperties = module.exports = function defineProperties(T, D) {
5182 return Object.defineProperties(T, D);
5183 };
5184
5185 if (Object.defineProperties.sham) defineProperties.sham = true;
5186});
5187var defineProperties$2 = defineProperties_1$1;
5188var defineProperties$1$1 = defineProperties$2;
5189
5190var aFunction$1$1 = function (variable) {
5191 return typeof variable == 'function' ? variable : undefined;
5192};
5193
5194var getBuiltIn$1 = function (namespace, method) {
5195 return arguments.length < 2 ? aFunction$1$1(path$1[namespace]) || aFunction$1$1(global_1$1[namespace]) : path$1[namespace] && path$1[namespace][method] || global_1$1[namespace] && global_1$1[namespace][method];
5196};
5197
5198var hiddenKeys$1$1 = enumBugKeys$1.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
5199// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
5200
5201var f$3$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
5202 return objectKeysInternal$1(O, hiddenKeys$1$1);
5203};
5204
5205var objectGetOwnPropertyNames$1 = {
5206 f: f$3$1
5207};
5208var f$4$1 = Object.getOwnPropertySymbols;
5209var objectGetOwnPropertySymbols$1 = {
5210 f: f$4$1
5211};
5212
5213var ownKeys$2 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
5214 var keys = objectGetOwnPropertyNames$1.f(anObject$1(it));
5215 var getOwnPropertySymbols = objectGetOwnPropertySymbols$1.f;
5216 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
5217};
5218
5219var createProperty$1 = function (object, key, value) {
5220 var propertyKey = toPrimitive$1(key);
5221 if (propertyKey in object) objectDefineProperty$1.f(object, propertyKey, createPropertyDescriptor$1(0, value));else object[propertyKey] = value;
5222}; // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
5223
5224
5225_export$1({
5226 target: 'Object',
5227 stat: true,
5228 sham: !descriptors$1
5229}, {
5230 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
5231 var O = toIndexedObject$1(object);
5232 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor$1.f;
5233 var keys = ownKeys$2(O);
5234 var result = {};
5235 var index = 0;
5236 var key, descriptor;
5237
5238 while (keys.length > index) {
5239 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
5240 if (descriptor !== undefined) createProperty$1(result, key, descriptor);
5241 }
5242
5243 return result;
5244 }
5245});
5246
5247var getOwnPropertyDescriptors$3 = path$1.Object.getOwnPropertyDescriptors;
5248var getOwnPropertyDescriptors$1$1 = getOwnPropertyDescriptors$3;
5249var getOwnPropertyDescriptors$2$1 = getOwnPropertyDescriptors$1$1;
5250var iterators$1 = {};
5251
5252var setGlobal$1 = function (key, value) {
5253 try {
5254 createNonEnumerableProperty$1(global_1$1, key, value);
5255 } catch (error) {
5256 global_1$1[key] = value;
5257 }
5258
5259 return value;
5260};
5261
5262var SHARED$1 = '__core-js_shared__';
5263var store$3 = global_1$1[SHARED$1] || setGlobal$1(SHARED$1, {});
5264var sharedStore$1 = store$3;
5265var shared$1 = createCommonjsModule$2(function (module) {
5266 (module.exports = function (key, value) {
5267 return sharedStore$1[key] || (sharedStore$1[key] = value !== undefined ? value : {});
5268 })('versions', []).push({
5269 version: '3.4.0',
5270 mode: 'pure',
5271 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
5272 });
5273});
5274var functionToString$1 = shared$1('native-function-to-string', Function.toString);
5275var WeakMap$2 = global_1$1.WeakMap;
5276var nativeWeakMap$1 = typeof WeakMap$2 === 'function' && /native code/.test(functionToString$1.call(WeakMap$2));
5277var id$1 = 0;
5278var postfix$1 = Math.random();
5279
5280var uid$1 = function (key) {
5281 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1 + postfix$1).toString(36);
5282};
5283
5284var keys$4 = shared$1('keys');
5285
5286var sharedKey$1 = function (key) {
5287 return keys$4[key] || (keys$4[key] = uid$1(key));
5288};
5289
5290var WeakMap$1$1 = global_1$1.WeakMap;
5291var set$1, get$1, has$1$1;
5292
5293var enforce$1 = function (it) {
5294 return has$1$1(it) ? get$1(it) : set$1(it, {});
5295};
5296
5297var getterFor$1 = function (TYPE) {
5298 return function (it) {
5299 var state;
5300
5301 if (!isObject$2(it) || (state = get$1(it)).type !== TYPE) {
5302 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
5303 }
5304
5305 return state;
5306 };
5307};
5308
5309if (nativeWeakMap$1) {
5310 var store$1$1 = new WeakMap$1$1();
5311 var wmget$1 = store$1$1.get;
5312 var wmhas$1 = store$1$1.has;
5313 var wmset$1 = store$1$1.set;
5314
5315 set$1 = function (it, metadata) {
5316 wmset$1.call(store$1$1, it, metadata);
5317 return metadata;
5318 };
5319
5320 get$1 = function (it) {
5321 return wmget$1.call(store$1$1, it) || {};
5322 };
5323
5324 has$1$1 = function (it) {
5325 return wmhas$1.call(store$1$1, it);
5326 };
5327} else {
5328 var STATE$1 = sharedKey$1('state');
5329 hiddenKeys$2[STATE$1] = true;
5330
5331 set$1 = function (it, metadata) {
5332 createNonEnumerableProperty$1(it, STATE$1, metadata);
5333 return metadata;
5334 };
5335
5336 get$1 = function (it) {
5337 return has$2(it, STATE$1) ? it[STATE$1] : {};
5338 };
5339
5340 has$1$1 = function (it) {
5341 return has$2(it, STATE$1);
5342 };
5343}
5344
5345var internalState$1 = {
5346 set: set$1,
5347 get: get$1,
5348 has: has$1$1,
5349 enforce: enforce$1,
5350 getterFor: getterFor$1
5351}; // https://tc39.github.io/ecma262/#sec-toobject
5352
5353var toObject$1 = function (argument) {
5354 return Object(requireObjectCoercible$1(argument));
5355};
5356
5357var correctPrototypeGetter$1 = !fails$1(function () {
5358 function F() {
5359 /* empty */
5360 }
5361
5362 F.prototype.constructor = null;
5363 return Object.getPrototypeOf(new F()) !== F.prototype;
5364});
5365var IE_PROTO$2 = sharedKey$1('IE_PROTO');
5366var ObjectPrototype$2 = Object.prototype; // `Object.getPrototypeOf` method
5367// https://tc39.github.io/ecma262/#sec-object.getprototypeof
5368
5369var objectGetPrototypeOf$1 = correctPrototypeGetter$1 ? Object.getPrototypeOf : function (O) {
5370 O = toObject$1(O);
5371 if (has$2(O, IE_PROTO$2)) return O[IE_PROTO$2];
5372
5373 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
5374 return O.constructor.prototype;
5375 }
5376
5377 return O instanceof Object ? ObjectPrototype$2 : null;
5378};
5379var nativeSymbol$1 = !!Object.getOwnPropertySymbols && !fails$1(function () {
5380 // Chrome 38 Symbol has incorrect toString conversion
5381 // eslint-disable-next-line no-undef
5382 return !String(Symbol());
5383});
5384var Symbol$1$1 = global_1$1.Symbol;
5385var store$2$1 = shared$1('wks');
5386
5387var wellKnownSymbol$1 = function (name) {
5388 return store$2$1[name] || (store$2$1[name] = nativeSymbol$1 && Symbol$1$1[name] || (nativeSymbol$1 ? Symbol$1$1 : uid$1)('Symbol.' + name));
5389};
5390
5391var ITERATOR$6 = wellKnownSymbol$1('iterator');
5392var BUGGY_SAFARI_ITERATORS$2 = false; // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
5393
5394var IteratorPrototype$3, PrototypeOfArrayIteratorPrototype$1, arrayIterator$1;
5395
5396if ([].keys) {
5397 arrayIterator$1 = [].keys(); // Safari 8 has buggy iterators w/o `next`
5398
5399 if (!('next' in arrayIterator$1)) BUGGY_SAFARI_ITERATORS$2 = true;else {
5400 PrototypeOfArrayIteratorPrototype$1 = objectGetPrototypeOf$1(objectGetPrototypeOf$1(arrayIterator$1));
5401 if (PrototypeOfArrayIteratorPrototype$1 !== Object.prototype) IteratorPrototype$3 = PrototypeOfArrayIteratorPrototype$1;
5402 }
5403}
5404
5405if (IteratorPrototype$3 == undefined) IteratorPrototype$3 = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
5406
5407var iteratorsCore$1 = {
5408 IteratorPrototype: IteratorPrototype$3,
5409 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$2
5410};
5411var html$1 = getBuiltIn$1('document', 'documentElement');
5412var IE_PROTO$1$1 = sharedKey$1('IE_PROTO');
5413var PROTOTYPE$2 = 'prototype';
5414
5415var Empty$1 = function () {
5416 /* empty */
5417}; // Create object with fake `null` prototype: use iframe Object with cleared prototype
5418
5419
5420var createDict$1 = function () {
5421 // Thrash, waste and sodomy: IE GC bug
5422 var iframe = documentCreateElement$1('iframe');
5423 var length = enumBugKeys$1.length;
5424 var lt = '<';
5425 var script = 'script';
5426 var gt = '>';
5427 var js = 'java' + script + ':';
5428 var iframeDocument;
5429 iframe.style.display = 'none';
5430 html$1.appendChild(iframe);
5431 iframe.src = String(js);
5432 iframeDocument = iframe.contentWindow.document;
5433 iframeDocument.open();
5434 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
5435 iframeDocument.close();
5436 createDict$1 = iframeDocument.F;
5437
5438 while (length--) delete createDict$1[PROTOTYPE$2][enumBugKeys$1[length]];
5439
5440 return createDict$1();
5441}; // `Object.create` method
5442// https://tc39.github.io/ecma262/#sec-object.create
5443
5444
5445var objectCreate$1 = Object.create || function create(O, Properties) {
5446 var result;
5447
5448 if (O !== null) {
5449 Empty$1[PROTOTYPE$2] = anObject$1(O);
5450 result = new Empty$1();
5451 Empty$1[PROTOTYPE$2] = null; // add "__proto__" for Object.getPrototypeOf polyfill
5452
5453 result[IE_PROTO$1$1] = O;
5454 } else result = createDict$1();
5455
5456 return Properties === undefined ? result : objectDefineProperties$1(result, Properties);
5457};
5458
5459hiddenKeys$2[IE_PROTO$1$1] = true;
5460var TO_STRING_TAG$4 = wellKnownSymbol$1('toStringTag'); // ES3 wrong here
5461
5462var CORRECT_ARGUMENTS$1 = classofRaw$1(function () {
5463 return arguments;
5464}()) == 'Arguments'; // fallback for IE11 Script Access Denied error
5465
5466var tryGet$1 = function (it, key) {
5467 try {
5468 return it[key];
5469 } catch (error) {
5470 /* empty */
5471 }
5472}; // getting tag from ES6+ `Object.prototype.toString`
5473
5474
5475var classof$1 = function (it) {
5476 var O, tag, result;
5477 return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
5478 : typeof (tag = tryGet$1(O = Object(it), TO_STRING_TAG$4)) == 'string' ? tag // builtinTag case
5479 : CORRECT_ARGUMENTS$1 ? classofRaw$1(O) // ES3 arguments fallback
5480 : (result = classofRaw$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
5481};
5482
5483var TO_STRING_TAG$1$1 = wellKnownSymbol$1('toStringTag');
5484var test$1 = {};
5485test$1[TO_STRING_TAG$1$1] = 'z'; // `Object.prototype.toString` method implementation
5486// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
5487
5488var objectToString$1 = String(test$1) !== '[object z]' ? function toString() {
5489 return '[object ' + classof$1(this) + ']';
5490} : test$1.toString;
5491var defineProperty$2$1 = objectDefineProperty$1.f;
5492var TO_STRING_TAG$2$1 = wellKnownSymbol$1('toStringTag');
5493var METHOD_REQUIRED$1 = objectToString$1 !== {}.toString;
5494
5495var setToStringTag$1 = function (it, TAG, STATIC, SET_METHOD) {
5496 if (it) {
5497 var target = STATIC ? it : it.prototype;
5498
5499 if (!has$2(target, TO_STRING_TAG$2$1)) {
5500 defineProperty$2$1(target, TO_STRING_TAG$2$1, {
5501 configurable: true,
5502 value: TAG
5503 });
5504 }
5505
5506 if (SET_METHOD && METHOD_REQUIRED$1) {
5507 createNonEnumerableProperty$1(target, 'toString', objectToString$1);
5508 }
5509 }
5510};
5511
5512var IteratorPrototype$1$1 = iteratorsCore$1.IteratorPrototype;
5513
5514var returnThis$2 = function () {
5515 return this;
5516};
5517
5518var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next) {
5519 var TO_STRING_TAG = NAME + ' Iterator';
5520 IteratorConstructor.prototype = objectCreate$1(IteratorPrototype$1$1, {
5521 next: createPropertyDescriptor$1(1, next)
5522 });
5523 setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false, true);
5524 iterators$1[TO_STRING_TAG] = returnThis$2;
5525 return IteratorConstructor;
5526};
5527
5528var aPossiblePrototype$1 = function (it) {
5529 if (!isObject$2(it) && it !== null) {
5530 throw TypeError("Can't set " + String(it) + ' as a prototype');
5531 }
5532
5533 return it;
5534}; // https://tc39.github.io/ecma262/#sec-object.setprototypeof
5535// Works with __proto__ only. Old v8 can't work with null proto objects.
5536
5537/* eslint-disable no-proto */
5538
5539
5540var objectSetPrototypeOf$1 = Object.setPrototypeOf || ('__proto__' in {} ? function () {
5541 var CORRECT_SETTER = false;
5542 var test = {};
5543 var setter;
5544
5545 try {
5546 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
5547 setter.call(test, []);
5548 CORRECT_SETTER = test instanceof Array;
5549 } catch (error) {
5550 /* empty */
5551 }
5552
5553 return function setPrototypeOf(O, proto) {
5554 anObject$1(O);
5555 aPossiblePrototype$1(proto);
5556 if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
5557 return O;
5558 };
5559}() : undefined);
5560
5561var redefine$1 = function (target, key, value, options) {
5562 if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty$1(target, key, value);
5563};
5564
5565var IteratorPrototype$2$1 = iteratorsCore$1.IteratorPrototype;
5566var BUGGY_SAFARI_ITERATORS$1$1 = iteratorsCore$1.BUGGY_SAFARI_ITERATORS;
5567var ITERATOR$1$1 = wellKnownSymbol$1('iterator');
5568var KEYS$1 = 'keys';
5569var VALUES$1 = 'values';
5570var ENTRIES$1 = 'entries';
5571
5572var returnThis$1$1 = function () {
5573 return this;
5574};
5575
5576var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
5577 createIteratorConstructor$1(IteratorConstructor, NAME, next);
5578
5579 var getIterationMethod = function (KIND) {
5580 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
5581 if (!BUGGY_SAFARI_ITERATORS$1$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
5582
5583 switch (KIND) {
5584 case KEYS$1:
5585 return function keys() {
5586 return new IteratorConstructor(this, KIND);
5587 };
5588
5589 case VALUES$1:
5590 return function values() {
5591 return new IteratorConstructor(this, KIND);
5592 };
5593
5594 case ENTRIES$1:
5595 return function entries() {
5596 return new IteratorConstructor(this, KIND);
5597 };
5598 }
5599
5600 return function () {
5601 return new IteratorConstructor(this);
5602 };
5603 };
5604
5605 var TO_STRING_TAG = NAME + ' Iterator';
5606 var INCORRECT_VALUES_NAME = false;
5607 var IterablePrototype = Iterable.prototype;
5608 var nativeIterator = IterablePrototype[ITERATOR$1$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
5609 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1$1 && nativeIterator || getIterationMethod(DEFAULT);
5610 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
5611 var CurrentIteratorPrototype, methods, KEY; // fix native
5612
5613 if (anyNativeIterator) {
5614 CurrentIteratorPrototype = objectGetPrototypeOf$1(anyNativeIterator.call(new Iterable()));
5615
5616 if (IteratorPrototype$2$1 !== Object.prototype && CurrentIteratorPrototype.next) {
5617 setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
5618 iterators$1[TO_STRING_TAG] = returnThis$1$1;
5619 }
5620 } // fix Array#{values, @@iterator}.name in V8 / FF
5621
5622
5623 if (DEFAULT == VALUES$1 && nativeIterator && nativeIterator.name !== VALUES$1) {
5624 INCORRECT_VALUES_NAME = true;
5625
5626 defaultIterator = function values() {
5627 return nativeIterator.call(this);
5628 };
5629 } // define iterator
5630
5631
5632 if (FORCED && IterablePrototype[ITERATOR$1$1] !== defaultIterator) {
5633 createNonEnumerableProperty$1(IterablePrototype, ITERATOR$1$1, defaultIterator);
5634 }
5635
5636 iterators$1[NAME] = defaultIterator; // export additional methods
5637
5638 if (DEFAULT) {
5639 methods = {
5640 values: getIterationMethod(VALUES$1),
5641 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS$1),
5642 entries: getIterationMethod(ENTRIES$1)
5643 };
5644 if (FORCED) for (KEY in methods) {
5645 if (BUGGY_SAFARI_ITERATORS$1$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
5646 redefine$1(IterablePrototype, KEY, methods[KEY]);
5647 }
5648 } else _export$1({
5649 target: NAME,
5650 proto: true,
5651 forced: BUGGY_SAFARI_ITERATORS$1$1 || INCORRECT_VALUES_NAME
5652 }, methods);
5653 }
5654
5655 return methods;
5656};
5657
5658var ARRAY_ITERATOR$1 = 'Array Iterator';
5659var setInternalState$3 = internalState$1.set;
5660var getInternalState$3 = internalState$1.getterFor(ARRAY_ITERATOR$1); // `Array.prototype.entries` method
5661// https://tc39.github.io/ecma262/#sec-array.prototype.entries
5662// `Array.prototype.keys` method
5663// https://tc39.github.io/ecma262/#sec-array.prototype.keys
5664// `Array.prototype.values` method
5665// https://tc39.github.io/ecma262/#sec-array.prototype.values
5666// `Array.prototype[@@iterator]` method
5667// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
5668// `CreateArrayIterator` internal method
5669// https://tc39.github.io/ecma262/#sec-createarrayiterator
5670
5671var es_array_iterator$1 = defineIterator$1(Array, 'Array', function (iterated, kind) {
5672 setInternalState$3(this, {
5673 type: ARRAY_ITERATOR$1,
5674 target: toIndexedObject$1(iterated),
5675 // target
5676 index: 0,
5677 // next index
5678 kind: kind // kind
5679
5680 }); // `%ArrayIteratorPrototype%.next` method
5681 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
5682}, function () {
5683 var state = getInternalState$3(this);
5684 var target = state.target;
5685 var kind = state.kind;
5686 var index = state.index++;
5687
5688 if (!target || index >= target.length) {
5689 state.target = undefined;
5690 return {
5691 value: undefined,
5692 done: true
5693 };
5694 }
5695
5696 if (kind == 'keys') return {
5697 value: index,
5698 done: false
5699 };
5700 if (kind == 'values') return {
5701 value: target[index],
5702 done: false
5703 };
5704 return {
5705 value: [index, target[index]],
5706 done: false
5707 };
5708}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
5709// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
5710// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
5711
5712iterators$1.Arguments = iterators$1.Array; // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
5713// iterable DOM collections
5714// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
5715
5716var domIterables$1 = {
5717 CSSRuleList: 0,
5718 CSSStyleDeclaration: 0,
5719 CSSValueList: 0,
5720 ClientRectList: 0,
5721 DOMRectList: 0,
5722 DOMStringList: 0,
5723 DOMTokenList: 1,
5724 DataTransferItemList: 0,
5725 FileList: 0,
5726 HTMLAllCollection: 0,
5727 HTMLCollection: 0,
5728 HTMLFormElement: 0,
5729 HTMLSelectElement: 0,
5730 MediaList: 0,
5731 MimeTypeArray: 0,
5732 NamedNodeMap: 0,
5733 NodeList: 1,
5734 PaintRequestList: 0,
5735 Plugin: 0,
5736 PluginArray: 0,
5737 SVGLengthList: 0,
5738 SVGNumberList: 0,
5739 SVGPathSegList: 0,
5740 SVGPointList: 0,
5741 SVGStringList: 0,
5742 SVGTransformList: 0,
5743 SourceBufferList: 0,
5744 StyleSheetList: 0,
5745 TextTrackCueList: 0,
5746 TextTrackList: 0,
5747 TouchList: 0
5748};
5749var TO_STRING_TAG$3$1 = wellKnownSymbol$1('toStringTag');
5750
5751for (var COLLECTION_NAME$1 in domIterables$1) {
5752 var Collection$1 = global_1$1[COLLECTION_NAME$1];
5753 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
5754
5755 if (CollectionPrototype$1 && !CollectionPrototype$1[TO_STRING_TAG$3$1]) {
5756 createNonEnumerableProperty$1(CollectionPrototype$1, TO_STRING_TAG$3$1, COLLECTION_NAME$1);
5757 }
5758
5759 iterators$1[COLLECTION_NAME$1] = iterators$1.Array;
5760} // https://tc39.github.io/ecma262/#sec-isarray
5761
5762
5763var isArray$6 = Array.isArray || function isArray(arg) {
5764 return classofRaw$1(arg) == 'Array';
5765};
5766
5767var SPECIES$3 = wellKnownSymbol$1('species'); // `ArraySpeciesCreate` abstract operation
5768// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
5769
5770var arraySpeciesCreate$1 = function (originalArray, length) {
5771 var C;
5772
5773 if (isArray$6(originalArray)) {
5774 C = originalArray.constructor; // cross-realm fallback
5775
5776 if (typeof C == 'function' && (C === Array || isArray$6(C.prototype))) C = undefined;else if (isObject$2(C)) {
5777 C = C[SPECIES$3];
5778 if (C === null) C = undefined;
5779 }
5780 }
5781
5782 return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
5783};
5784
5785var push$1 = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
5786
5787var createMethod$1$1 = function (TYPE) {
5788 var IS_MAP = TYPE == 1;
5789 var IS_FILTER = TYPE == 2;
5790 var IS_SOME = TYPE == 3;
5791 var IS_EVERY = TYPE == 4;
5792 var IS_FIND_INDEX = TYPE == 6;
5793 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
5794 return function ($this, callbackfn, that, specificCreate) {
5795 var O = toObject$1($this);
5796 var self = indexedObject$1(O);
5797 var boundFunction = bindContext$1(callbackfn, that, 3);
5798 var length = toLength$1(self.length);
5799 var index = 0;
5800 var create = specificCreate || arraySpeciesCreate$1;
5801 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
5802 var value, result;
5803
5804 for (; length > index; index++) if (NO_HOLES || index in self) {
5805 value = self[index];
5806 result = boundFunction(value, index, O);
5807
5808 if (TYPE) {
5809 if (IS_MAP) target[index] = result; // map
5810 else if (result) switch (TYPE) {
5811 case 3:
5812 return true;
5813 // some
5814
5815 case 5:
5816 return value;
5817 // find
5818
5819 case 6:
5820 return index;
5821 // findIndex
5822
5823 case 2:
5824 push$1.call(target, value);
5825 // filter
5826 } else if (IS_EVERY) return false; // every
5827 }
5828 }
5829
5830 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
5831 };
5832};
5833
5834var arrayIteration$1 = {
5835 // `Array.prototype.forEach` method
5836 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
5837 forEach: createMethod$1$1(0),
5838 // `Array.prototype.map` method
5839 // https://tc39.github.io/ecma262/#sec-array.prototype.map
5840 map: createMethod$1$1(1),
5841 // `Array.prototype.filter` method
5842 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
5843 filter: createMethod$1$1(2),
5844 // `Array.prototype.some` method
5845 // https://tc39.github.io/ecma262/#sec-array.prototype.some
5846 some: createMethod$1$1(3),
5847 // `Array.prototype.every` method
5848 // https://tc39.github.io/ecma262/#sec-array.prototype.every
5849 every: createMethod$1$1(4),
5850 // `Array.prototype.find` method
5851 // https://tc39.github.io/ecma262/#sec-array.prototype.find
5852 find: createMethod$1$1(5),
5853 // `Array.prototype.findIndex` method
5854 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
5855 findIndex: createMethod$1$1(6)
5856};
5857
5858var sloppyArrayMethod$1 = function (METHOD_NAME, argument) {
5859 var method = [][METHOD_NAME];
5860 return !method || !fails$1(function () {
5861 // eslint-disable-next-line no-useless-call,no-throw-literal
5862 method.call(null, argument || function () {
5863 throw 1;
5864 }, 1);
5865 });
5866};
5867
5868var $forEach$2 = arrayIteration$1.forEach; // `Array.prototype.forEach` method implementation
5869// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
5870
5871var arrayForEach$1 = sloppyArrayMethod$1('forEach') ? function forEach(callbackfn
5872/* , thisArg */
5873) {
5874 return $forEach$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
5875} : [].forEach; // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
5876
5877_export$1({
5878 target: 'Array',
5879 proto: true,
5880 forced: [].forEach != arrayForEach$1
5881}, {
5882 forEach: arrayForEach$1
5883});
5884
5885var entryVirtual$1 = function (CONSTRUCTOR) {
5886 return path$1[CONSTRUCTOR + 'Prototype'];
5887};
5888
5889var forEach$4 = entryVirtual$1('Array').forEach;
5890var forEach$1$1 = forEach$4;
5891var ArrayPrototype$7 = Array.prototype;
5892var DOMIterables$1 = {
5893 DOMTokenList: true,
5894 NodeList: true
5895};
5896
5897var forEach_1$1 = function (it) {
5898 var own = it.forEach;
5899 return it === ArrayPrototype$7 || it instanceof Array && own === ArrayPrototype$7.forEach // eslint-disable-next-line no-prototype-builtins
5900 || DOMIterables$1.hasOwnProperty(classof$1(it)) ? forEach$1$1 : own;
5901};
5902
5903var forEach$2$1 = forEach_1$1;
5904var nativeGetOwnPropertyDescriptor$1$1 = objectGetOwnPropertyDescriptor$1.f;
5905var FAILS_ON_PRIMITIVES$3 = fails$1(function () {
5906 nativeGetOwnPropertyDescriptor$1$1(1);
5907});
5908var FORCED$3 = !descriptors$1 || FAILS_ON_PRIMITIVES$3; // `Object.getOwnPropertyDescriptor` method
5909// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
5910
5911_export$1({
5912 target: 'Object',
5913 stat: true,
5914 forced: FORCED$3,
5915 sham: !descriptors$1
5916}, {
5917 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
5918 return nativeGetOwnPropertyDescriptor$1$1(toIndexedObject$1(it), key);
5919 }
5920});
5921
5922var getOwnPropertyDescriptor_1$1 = createCommonjsModule$2(function (module) {
5923 var Object = path$1.Object;
5924
5925 var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
5926 return Object.getOwnPropertyDescriptor(it, key);
5927 };
5928
5929 if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
5930});
5931var getOwnPropertyDescriptor$2$1 = getOwnPropertyDescriptor_1$1;
5932var getOwnPropertyDescriptor$3$1 = getOwnPropertyDescriptor$2$1;
5933var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNames$1.f;
5934var toString$1$1 = {}.toString;
5935var windowNames$1 = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
5936
5937var getWindowNames$1 = function (it) {
5938 try {
5939 return nativeGetOwnPropertyNames$2(it);
5940 } catch (error) {
5941 return windowNames$1.slice();
5942 }
5943}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
5944
5945
5946var f$5$1 = function getOwnPropertyNames(it) {
5947 return windowNames$1 && toString$1$1.call(it) == '[object Window]' ? getWindowNames$1(it) : nativeGetOwnPropertyNames$2(toIndexedObject$1(it));
5948};
5949
5950var objectGetOwnPropertyNamesExternal$1 = {
5951 f: f$5$1
5952};
5953var f$6$1 = wellKnownSymbol$1;
5954var wrappedWellKnownSymbol$1 = {
5955 f: f$6$1
5956};
5957var defineProperty$3$1 = objectDefineProperty$1.f;
5958
5959var defineWellKnownSymbol$1 = function (NAME) {
5960 var Symbol = path$1.Symbol || (path$1.Symbol = {});
5961 if (!has$2(Symbol, NAME)) defineProperty$3$1(Symbol, NAME, {
5962 value: wrappedWellKnownSymbol$1.f(NAME)
5963 });
5964};
5965
5966var $forEach$1$1 = arrayIteration$1.forEach;
5967var HIDDEN$1 = sharedKey$1('hidden');
5968var SYMBOL$1 = 'Symbol';
5969var PROTOTYPE$1$1 = 'prototype';
5970var TO_PRIMITIVE$1 = wellKnownSymbol$1('toPrimitive');
5971var setInternalState$1$1 = internalState$1.set;
5972var getInternalState$1$1 = internalState$1.getterFor(SYMBOL$1);
5973var ObjectPrototype$1$1 = Object[PROTOTYPE$1$1];
5974var $Symbol$1 = global_1$1.Symbol;
5975var $stringify$1 = getBuiltIn$1('JSON', 'stringify');
5976var nativeGetOwnPropertyDescriptor$2$1 = objectGetOwnPropertyDescriptor$1.f;
5977var nativeDefineProperty$1$1 = objectDefineProperty$1.f;
5978var nativeGetOwnPropertyNames$1$1 = objectGetOwnPropertyNamesExternal$1.f;
5979var nativePropertyIsEnumerable$1$1 = objectPropertyIsEnumerable$1.f;
5980var AllSymbols$1 = shared$1('symbols');
5981var ObjectPrototypeSymbols$1 = shared$1('op-symbols');
5982var StringToSymbolRegistry$1 = shared$1('string-to-symbol-registry');
5983var SymbolToStringRegistry$1 = shared$1('symbol-to-string-registry');
5984var WellKnownSymbolsStore$1 = shared$1('wks');
5985var QObject$1 = global_1$1.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
5986
5987var USE_SETTER$1 = !QObject$1 || !QObject$1[PROTOTYPE$1$1] || !QObject$1[PROTOTYPE$1$1].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
5988
5989var setSymbolDescriptor$1 = descriptors$1 && fails$1(function () {
5990 return objectCreate$1(nativeDefineProperty$1$1({}, 'a', {
5991 get: function () {
5992 return nativeDefineProperty$1$1(this, 'a', {
5993 value: 7
5994 }).a;
5995 }
5996 })).a != 7;
5997}) ? function (O, P, Attributes) {
5998 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2$1(ObjectPrototype$1$1, P);
5999 if (ObjectPrototypeDescriptor) delete ObjectPrototype$1$1[P];
6000 nativeDefineProperty$1$1(O, P, Attributes);
6001
6002 if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1$1) {
6003 nativeDefineProperty$1$1(ObjectPrototype$1$1, P, ObjectPrototypeDescriptor);
6004 }
6005} : nativeDefineProperty$1$1;
6006
6007var wrap$1 = function (tag, description) {
6008 var symbol = AllSymbols$1[tag] = objectCreate$1($Symbol$1[PROTOTYPE$1$1]);
6009 setInternalState$1$1(symbol, {
6010 type: SYMBOL$1,
6011 tag: tag,
6012 description: description
6013 });
6014 if (!descriptors$1) symbol.description = description;
6015 return symbol;
6016};
6017
6018var isSymbol$1 = nativeSymbol$1 && typeof $Symbol$1.iterator == 'symbol' ? function (it) {
6019 return typeof it == 'symbol';
6020} : function (it) {
6021 return Object(it) instanceof $Symbol$1;
6022};
6023
6024var $defineProperty$1 = function defineProperty(O, P, Attributes) {
6025 if (O === ObjectPrototype$1$1) $defineProperty$1(ObjectPrototypeSymbols$1, P, Attributes);
6026 anObject$1(O);
6027 var key = toPrimitive$1(P, true);
6028 anObject$1(Attributes);
6029
6030 if (has$2(AllSymbols$1, key)) {
6031 if (!Attributes.enumerable) {
6032 if (!has$2(O, HIDDEN$1)) nativeDefineProperty$1$1(O, HIDDEN$1, createPropertyDescriptor$1(1, {}));
6033 O[HIDDEN$1][key] = true;
6034 } else {
6035 if (has$2(O, HIDDEN$1) && O[HIDDEN$1][key]) O[HIDDEN$1][key] = false;
6036 Attributes = objectCreate$1(Attributes, {
6037 enumerable: createPropertyDescriptor$1(0, false)
6038 });
6039 }
6040
6041 return setSymbolDescriptor$1(O, key, Attributes);
6042 }
6043
6044 return nativeDefineProperty$1$1(O, key, Attributes);
6045};
6046
6047var $defineProperties$1 = function defineProperties(O, Properties) {
6048 anObject$1(O);
6049 var properties = toIndexedObject$1(Properties);
6050 var keys = objectKeys$1(properties).concat($getOwnPropertySymbols$1(properties));
6051 $forEach$1$1(keys, function (key) {
6052 if (!descriptors$1 || $propertyIsEnumerable$1.call(properties, key)) $defineProperty$1(O, key, properties[key]);
6053 });
6054 return O;
6055};
6056
6057var $create$1 = function create(O, Properties) {
6058 return Properties === undefined ? objectCreate$1(O) : $defineProperties$1(objectCreate$1(O), Properties);
6059};
6060
6061var $propertyIsEnumerable$1 = function propertyIsEnumerable(V) {
6062 var P = toPrimitive$1(V, true);
6063 var enumerable = nativePropertyIsEnumerable$1$1.call(this, P);
6064 if (this === ObjectPrototype$1$1 && has$2(AllSymbols$1, P) && !has$2(ObjectPrototypeSymbols$1, P)) return false;
6065 return enumerable || !has$2(this, P) || !has$2(AllSymbols$1, P) || has$2(this, HIDDEN$1) && this[HIDDEN$1][P] ? enumerable : true;
6066};
6067
6068var $getOwnPropertyDescriptor$1 = function getOwnPropertyDescriptor(O, P) {
6069 var it = toIndexedObject$1(O);
6070 var key = toPrimitive$1(P, true);
6071 if (it === ObjectPrototype$1$1 && has$2(AllSymbols$1, key) && !has$2(ObjectPrototypeSymbols$1, key)) return;
6072 var descriptor = nativeGetOwnPropertyDescriptor$2$1(it, key);
6073
6074 if (descriptor && has$2(AllSymbols$1, key) && !(has$2(it, HIDDEN$1) && it[HIDDEN$1][key])) {
6075 descriptor.enumerable = true;
6076 }
6077
6078 return descriptor;
6079};
6080
6081var $getOwnPropertyNames$1 = function getOwnPropertyNames(O) {
6082 var names = nativeGetOwnPropertyNames$1$1(toIndexedObject$1(O));
6083 var result = [];
6084 $forEach$1$1(names, function (key) {
6085 if (!has$2(AllSymbols$1, key) && !has$2(hiddenKeys$2, key)) result.push(key);
6086 });
6087 return result;
6088};
6089
6090var $getOwnPropertySymbols$1 = function getOwnPropertySymbols(O) {
6091 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1$1;
6092 var names = nativeGetOwnPropertyNames$1$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols$1 : toIndexedObject$1(O));
6093 var result = [];
6094 $forEach$1$1(names, function (key) {
6095 if (has$2(AllSymbols$1, key) && (!IS_OBJECT_PROTOTYPE || has$2(ObjectPrototype$1$1, key))) {
6096 result.push(AllSymbols$1[key]);
6097 }
6098 });
6099 return result;
6100}; // `Symbol` constructor
6101// https://tc39.github.io/ecma262/#sec-symbol-constructor
6102
6103
6104if (!nativeSymbol$1) {
6105 $Symbol$1 = function Symbol() {
6106 if (this instanceof $Symbol$1) throw TypeError('Symbol is not a constructor');
6107 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
6108 var tag = uid$1(description);
6109
6110 var setter = function (value) {
6111 if (this === ObjectPrototype$1$1) setter.call(ObjectPrototypeSymbols$1, value);
6112 if (has$2(this, HIDDEN$1) && has$2(this[HIDDEN$1], tag)) this[HIDDEN$1][tag] = false;
6113 setSymbolDescriptor$1(this, tag, createPropertyDescriptor$1(1, value));
6114 };
6115
6116 if (descriptors$1 && USE_SETTER$1) setSymbolDescriptor$1(ObjectPrototype$1$1, tag, {
6117 configurable: true,
6118 set: setter
6119 });
6120 return wrap$1(tag, description);
6121 };
6122
6123 redefine$1($Symbol$1[PROTOTYPE$1$1], 'toString', function toString() {
6124 return getInternalState$1$1(this).tag;
6125 });
6126 objectPropertyIsEnumerable$1.f = $propertyIsEnumerable$1;
6127 objectDefineProperty$1.f = $defineProperty$1;
6128 objectGetOwnPropertyDescriptor$1.f = $getOwnPropertyDescriptor$1;
6129 objectGetOwnPropertyNames$1.f = objectGetOwnPropertyNamesExternal$1.f = $getOwnPropertyNames$1;
6130 objectGetOwnPropertySymbols$1.f = $getOwnPropertySymbols$1;
6131
6132 if (descriptors$1) {
6133 // https://github.com/tc39/proposal-Symbol-description
6134 nativeDefineProperty$1$1($Symbol$1[PROTOTYPE$1$1], 'description', {
6135 configurable: true,
6136 get: function description() {
6137 return getInternalState$1$1(this).description;
6138 }
6139 });
6140 }
6141
6142 wrappedWellKnownSymbol$1.f = function (name) {
6143 return wrap$1(wellKnownSymbol$1(name), name);
6144 };
6145}
6146
6147_export$1({
6148 global: true,
6149 wrap: true,
6150 forced: !nativeSymbol$1,
6151 sham: !nativeSymbol$1
6152}, {
6153 Symbol: $Symbol$1
6154});
6155
6156$forEach$1$1(objectKeys$1(WellKnownSymbolsStore$1), function (name) {
6157 defineWellKnownSymbol$1(name);
6158});
6159
6160_export$1({
6161 target: SYMBOL$1,
6162 stat: true,
6163 forced: !nativeSymbol$1
6164}, {
6165 // `Symbol.for` method
6166 // https://tc39.github.io/ecma262/#sec-symbol.for
6167 'for': function (key) {
6168 var string = String(key);
6169 if (has$2(StringToSymbolRegistry$1, string)) return StringToSymbolRegistry$1[string];
6170 var symbol = $Symbol$1(string);
6171 StringToSymbolRegistry$1[string] = symbol;
6172 SymbolToStringRegistry$1[symbol] = string;
6173 return symbol;
6174 },
6175 // `Symbol.keyFor` method
6176 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
6177 keyFor: function keyFor(sym) {
6178 if (!isSymbol$1(sym)) throw TypeError(sym + ' is not a symbol');
6179 if (has$2(SymbolToStringRegistry$1, sym)) return SymbolToStringRegistry$1[sym];
6180 },
6181 useSetter: function () {
6182 USE_SETTER$1 = true;
6183 },
6184 useSimple: function () {
6185 USE_SETTER$1 = false;
6186 }
6187});
6188
6189_export$1({
6190 target: 'Object',
6191 stat: true,
6192 forced: !nativeSymbol$1,
6193 sham: !descriptors$1
6194}, {
6195 // `Object.create` method
6196 // https://tc39.github.io/ecma262/#sec-object.create
6197 create: $create$1,
6198 // `Object.defineProperty` method
6199 // https://tc39.github.io/ecma262/#sec-object.defineproperty
6200 defineProperty: $defineProperty$1,
6201 // `Object.defineProperties` method
6202 // https://tc39.github.io/ecma262/#sec-object.defineproperties
6203 defineProperties: $defineProperties$1,
6204 // `Object.getOwnPropertyDescriptor` method
6205 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
6206 getOwnPropertyDescriptor: $getOwnPropertyDescriptor$1
6207});
6208
6209_export$1({
6210 target: 'Object',
6211 stat: true,
6212 forced: !nativeSymbol$1
6213}, {
6214 // `Object.getOwnPropertyNames` method
6215 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
6216 getOwnPropertyNames: $getOwnPropertyNames$1,
6217 // `Object.getOwnPropertySymbols` method
6218 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
6219 getOwnPropertySymbols: $getOwnPropertySymbols$1
6220}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
6221// https://bugs.chromium.org/p/v8/issues/detail?id=3443
6222
6223
6224_export$1({
6225 target: 'Object',
6226 stat: true,
6227 forced: fails$1(function () {
6228 objectGetOwnPropertySymbols$1.f(1);
6229 })
6230}, {
6231 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
6232 return objectGetOwnPropertySymbols$1.f(toObject$1(it));
6233 }
6234}); // `JSON.stringify` method behavior with symbols
6235// https://tc39.github.io/ecma262/#sec-json.stringify
6236
6237
6238if ($stringify$1) {
6239 var FORCED_JSON_STRINGIFY$1 = !nativeSymbol$1 || fails$1(function () {
6240 var symbol = $Symbol$1(); // MS Edge converts symbol values to JSON as {}
6241
6242 return $stringify$1([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
6243 || $stringify$1({
6244 a: symbol
6245 }) != '{}' // V8 throws on boxed symbols
6246 || $stringify$1(Object(symbol)) != '{}';
6247 });
6248
6249 _export$1({
6250 target: 'JSON',
6251 stat: true,
6252 forced: FORCED_JSON_STRINGIFY$1
6253 }, {
6254 // eslint-disable-next-line no-unused-vars
6255 stringify: function stringify(it, replacer, space) {
6256 var args = [it];
6257 var index = 1;
6258 var $replacer;
6259
6260 while (arguments.length > index) args.push(arguments[index++]);
6261
6262 $replacer = replacer;
6263 if (!isObject$2(replacer) && it === undefined || isSymbol$1(it)) return; // IE8 returns string on undefined
6264
6265 if (!isArray$6(replacer)) replacer = function (key, value) {
6266 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
6267 if (!isSymbol$1(value)) return value;
6268 };
6269 args[1] = replacer;
6270 return $stringify$1.apply(null, args);
6271 }
6272 });
6273} // `Symbol.prototype[@@toPrimitive]` method
6274// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
6275
6276
6277if (!$Symbol$1[PROTOTYPE$1$1][TO_PRIMITIVE$1]) {
6278 createNonEnumerableProperty$1($Symbol$1[PROTOTYPE$1$1], TO_PRIMITIVE$1, $Symbol$1[PROTOTYPE$1$1].valueOf);
6279} // `Symbol.prototype[@@toStringTag]` property
6280// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
6281
6282
6283setToStringTag$1($Symbol$1, SYMBOL$1);
6284hiddenKeys$2[HIDDEN$1] = true;
6285var getOwnPropertySymbols$3 = path$1.Object.getOwnPropertySymbols;
6286var getOwnPropertySymbols$1$1 = getOwnPropertySymbols$3;
6287var getOwnPropertySymbols$2$1 = getOwnPropertySymbols$1$1;
6288var entries = entryVirtual$1('Array').entries;
6289var entries$1 = entries;
6290var ArrayPrototype$1$1 = Array.prototype;
6291var DOMIterables$1$1 = {
6292 DOMTokenList: true,
6293 NodeList: true
6294};
6295
6296var entries_1 = function (it) {
6297 var own = it.entries;
6298 return it === ArrayPrototype$1$1 || it instanceof Array && own === ArrayPrototype$1$1.entries // eslint-disable-next-line no-prototype-builtins
6299 || DOMIterables$1$1.hasOwnProperty(classof$1(it)) ? entries$1 : own;
6300};
6301
6302var entries$2 = entries_1;
6303var slice$3 = [].slice;
6304var factories = {};
6305
6306var construct = function (C, argsLength, args) {
6307 if (!(argsLength in factories)) {
6308 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func
6309
6310
6311 factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
6312 }
6313
6314 return factories[argsLength](C, args);
6315}; // `Function.prototype.bind` method implementation
6316// https://tc39.github.io/ecma262/#sec-function.prototype.bind
6317
6318
6319var functionBind = Function.bind || function bind(that
6320/* , ...args */
6321) {
6322 var fn = aFunction$2(this);
6323 var partArgs = slice$3.call(arguments, 1);
6324
6325 var boundFunction = function bound()
6326 /* args... */
6327 {
6328 var args = partArgs.concat(slice$3.call(arguments));
6329 return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
6330 };
6331
6332 if (isObject$2(fn.prototype)) boundFunction.prototype = fn.prototype;
6333 return boundFunction;
6334}; // https://tc39.github.io/ecma262/#sec-function.prototype.bind
6335
6336
6337_export$1({
6338 target: 'Function',
6339 proto: true
6340}, {
6341 bind: functionBind
6342});
6343
6344var bind = entryVirtual$1('Function').bind;
6345var FunctionPrototype = Function.prototype;
6346
6347var bind_1 = function (it) {
6348 var own = it.bind;
6349 return it === FunctionPrototype || it instanceof Function && own === FunctionPrototype.bind ? bind : own;
6350};
6351
6352var bind$1 = bind_1;
6353var bind$2 = bind$1;
6354var runtime_1 = createCommonjsModule$2(function (module) {
6355 /**
6356 * Copyright (c) 2014-present, Facebook, Inc.
6357 *
6358 * This source code is licensed under the MIT license found in the
6359 * LICENSE file in the root directory of this source tree.
6360 */
6361 var runtime = function (exports) {
6362 var Op = Object.prototype;
6363 var hasOwn = Op.hasOwnProperty;
6364 var undefined$1; // More compressible than void 0.
6365
6366 var $Symbol = typeof Symbol === "function" ? Symbol : {};
6367 var iteratorSymbol = $Symbol.iterator || "@@iterator";
6368 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
6369 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
6370
6371 function wrap(innerFn, outerFn, self, tryLocsList) {
6372 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
6373 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
6374 var generator = Object.create(protoGenerator.prototype);
6375 var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
6376 // .throw, and .return methods.
6377
6378 generator._invoke = makeInvokeMethod(innerFn, self, context);
6379 return generator;
6380 }
6381
6382 exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
6383 // record like context.tryEntries[i].completion. This interface could
6384 // have been (and was previously) designed to take a closure to be
6385 // invoked without arguments, but in all the cases we care about we
6386 // already have an existing method we want to call, so there's no need
6387 // to create a new function object. We can even get away with assuming
6388 // the method takes exactly one argument, since that happens to be true
6389 // in every case, so we don't have to touch the arguments object. The
6390 // only additional allocation required is the completion record, which
6391 // has a stable shape and so hopefully should be cheap to allocate.
6392
6393 function tryCatch(fn, obj, arg) {
6394 try {
6395 return {
6396 type: "normal",
6397 arg: fn.call(obj, arg)
6398 };
6399 } catch (err) {
6400 return {
6401 type: "throw",
6402 arg: err
6403 };
6404 }
6405 }
6406
6407 var GenStateSuspendedStart = "suspendedStart";
6408 var GenStateSuspendedYield = "suspendedYield";
6409 var GenStateExecuting = "executing";
6410 var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
6411 // breaking out of the dispatch switch statement.
6412
6413 var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
6414 // .constructor.prototype properties for functions that return Generator
6415 // objects. For full spec compliance, you may wish to configure your
6416 // minifier not to mangle the names of these two functions.
6417
6418 function Generator() {}
6419
6420 function GeneratorFunction() {}
6421
6422 function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
6423 // don't natively support it.
6424
6425
6426 var IteratorPrototype = {};
6427
6428 IteratorPrototype[iteratorSymbol] = function () {
6429 return this;
6430 };
6431
6432 var getProto = Object.getPrototypeOf;
6433 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
6434
6435 if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
6436 // This environment has a native %IteratorPrototype%; use it instead
6437 // of the polyfill.
6438 IteratorPrototype = NativeIteratorPrototype;
6439 }
6440
6441 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
6442 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
6443 GeneratorFunctionPrototype.constructor = GeneratorFunction;
6444 GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
6445 // Iterator interface in terms of a single ._invoke method.
6446
6447 function defineIteratorMethods(prototype) {
6448 ["next", "throw", "return"].forEach(function (method) {
6449 prototype[method] = function (arg) {
6450 return this._invoke(method, arg);
6451 };
6452 });
6453 }
6454
6455 exports.isGeneratorFunction = function (genFun) {
6456 var ctor = typeof genFun === "function" && genFun.constructor;
6457 return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
6458 // do is to check its .name property.
6459 (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
6460 };
6461
6462 exports.mark = function (genFun) {
6463 if (Object.setPrototypeOf) {
6464 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
6465 } else {
6466 genFun.__proto__ = GeneratorFunctionPrototype;
6467
6468 if (!(toStringTagSymbol in genFun)) {
6469 genFun[toStringTagSymbol] = "GeneratorFunction";
6470 }
6471 }
6472
6473 genFun.prototype = Object.create(Gp);
6474 return genFun;
6475 }; // Within the body of any async function, `await x` is transformed to
6476 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
6477 // `hasOwn.call(value, "__await")` to determine if the yielded value is
6478 // meant to be awaited.
6479
6480
6481 exports.awrap = function (arg) {
6482 return {
6483 __await: arg
6484 };
6485 };
6486
6487 function AsyncIterator(generator) {
6488 function invoke(method, arg, resolve, reject) {
6489 var record = tryCatch(generator[method], generator, arg);
6490
6491 if (record.type === "throw") {
6492 reject(record.arg);
6493 } else {
6494 var result = record.arg;
6495 var value = result.value;
6496
6497 if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
6498 return Promise.resolve(value.__await).then(function (value) {
6499 invoke("next", value, resolve, reject);
6500 }, function (err) {
6501 invoke("throw", err, resolve, reject);
6502 });
6503 }
6504
6505 return Promise.resolve(value).then(function (unwrapped) {
6506 // When a yielded Promise is resolved, its final value becomes
6507 // the .value of the Promise<{value,done}> result for the
6508 // current iteration.
6509 result.value = unwrapped;
6510 resolve(result);
6511 }, function (error) {
6512 // If a rejected Promise was yielded, throw the rejection back
6513 // into the async generator function so it can be handled there.
6514 return invoke("throw", error, resolve, reject);
6515 });
6516 }
6517 }
6518
6519 var previousPromise;
6520
6521 function enqueue(method, arg) {
6522 function callInvokeWithMethodAndArg() {
6523 return new Promise(function (resolve, reject) {
6524 invoke(method, arg, resolve, reject);
6525 });
6526 }
6527
6528 return previousPromise = // If enqueue has been called before, then we want to wait until
6529 // all previous Promises have been resolved before calling invoke,
6530 // so that results are always delivered in the correct order. If
6531 // enqueue has not been called before, then it is important to
6532 // call invoke immediately, without waiting on a callback to fire,
6533 // so that the async generator function has the opportunity to do
6534 // any necessary setup in a predictable way. This predictability
6535 // is why the Promise constructor synchronously invokes its
6536 // executor callback, and why async functions synchronously
6537 // execute code before the first await. Since we implement simple
6538 // async functions in terms of async generators, it is especially
6539 // important to get this right, even though it requires care.
6540 previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
6541 // invocations of the iterator.
6542 callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
6543 } // Define the unified helper method that is used to implement .next,
6544 // .throw, and .return (see defineIteratorMethods).
6545
6546
6547 this._invoke = enqueue;
6548 }
6549
6550 defineIteratorMethods(AsyncIterator.prototype);
6551
6552 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
6553 return this;
6554 };
6555
6556 exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
6557 // AsyncIterator objects; they just return a Promise for the value of
6558 // the final result produced by the iterator.
6559
6560 exports.async = function (innerFn, outerFn, self, tryLocsList) {
6561 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
6562 return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
6563 : iter.next().then(function (result) {
6564 return result.done ? result.value : iter.next();
6565 });
6566 };
6567
6568 function makeInvokeMethod(innerFn, self, context) {
6569 var state = GenStateSuspendedStart;
6570 return function invoke(method, arg) {
6571 if (state === GenStateExecuting) {
6572 throw new Error("Generator is already running");
6573 }
6574
6575 if (state === GenStateCompleted) {
6576 if (method === "throw") {
6577 throw arg;
6578 } // Be forgiving, per 25.3.3.3.3 of the spec:
6579 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
6580
6581
6582 return doneResult();
6583 }
6584
6585 context.method = method;
6586 context.arg = arg;
6587
6588 while (true) {
6589 var delegate = context.delegate;
6590
6591 if (delegate) {
6592 var delegateResult = maybeInvokeDelegate(delegate, context);
6593
6594 if (delegateResult) {
6595 if (delegateResult === ContinueSentinel) continue;
6596 return delegateResult;
6597 }
6598 }
6599
6600 if (context.method === "next") {
6601 // Setting context._sent for legacy support of Babel's
6602 // function.sent implementation.
6603 context.sent = context._sent = context.arg;
6604 } else if (context.method === "throw") {
6605 if (state === GenStateSuspendedStart) {
6606 state = GenStateCompleted;
6607 throw context.arg;
6608 }
6609
6610 context.dispatchException(context.arg);
6611 } else if (context.method === "return") {
6612 context.abrupt("return", context.arg);
6613 }
6614
6615 state = GenStateExecuting;
6616 var record = tryCatch(innerFn, self, context);
6617
6618 if (record.type === "normal") {
6619 // If an exception is thrown from innerFn, we leave state ===
6620 // GenStateExecuting and loop back for another invocation.
6621 state = context.done ? GenStateCompleted : GenStateSuspendedYield;
6622
6623 if (record.arg === ContinueSentinel) {
6624 continue;
6625 }
6626
6627 return {
6628 value: record.arg,
6629 done: context.done
6630 };
6631 } else if (record.type === "throw") {
6632 state = GenStateCompleted; // Dispatch the exception by looping back around to the
6633 // context.dispatchException(context.arg) call above.
6634
6635 context.method = "throw";
6636 context.arg = record.arg;
6637 }
6638 }
6639 };
6640 } // Call delegate.iterator[context.method](context.arg) and handle the
6641 // result, either by returning a { value, done } result from the
6642 // delegate iterator, or by modifying context.method and context.arg,
6643 // setting context.delegate to null, and returning the ContinueSentinel.
6644
6645
6646 function maybeInvokeDelegate(delegate, context) {
6647 var method = delegate.iterator[context.method];
6648
6649 if (method === undefined$1) {
6650 // A .throw or .return when the delegate iterator has no .throw
6651 // method always terminates the yield* loop.
6652 context.delegate = null;
6653
6654 if (context.method === "throw") {
6655 // Note: ["return"] must be used for ES3 parsing compatibility.
6656 if (delegate.iterator["return"]) {
6657 // If the delegate iterator has a return method, give it a
6658 // chance to clean up.
6659 context.method = "return";
6660 context.arg = undefined$1;
6661 maybeInvokeDelegate(delegate, context);
6662
6663 if (context.method === "throw") {
6664 // If maybeInvokeDelegate(context) changed context.method from
6665 // "return" to "throw", let that override the TypeError below.
6666 return ContinueSentinel;
6667 }
6668 }
6669
6670 context.method = "throw";
6671 context.arg = new TypeError("The iterator does not provide a 'throw' method");
6672 }
6673
6674 return ContinueSentinel;
6675 }
6676
6677 var record = tryCatch(method, delegate.iterator, context.arg);
6678
6679 if (record.type === "throw") {
6680 context.method = "throw";
6681 context.arg = record.arg;
6682 context.delegate = null;
6683 return ContinueSentinel;
6684 }
6685
6686 var info = record.arg;
6687
6688 if (!info) {
6689 context.method = "throw";
6690 context.arg = new TypeError("iterator result is not an object");
6691 context.delegate = null;
6692 return ContinueSentinel;
6693 }
6694
6695 if (info.done) {
6696 // Assign the result of the finished delegate to the temporary
6697 // variable specified by delegate.resultName (see delegateYield).
6698 context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
6699
6700 context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
6701 // exception, let the outer generator proceed normally. If
6702 // context.method was "next", forget context.arg since it has been
6703 // "consumed" by the delegate iterator. If context.method was
6704 // "return", allow the original .return call to continue in the
6705 // outer generator.
6706
6707 if (context.method !== "return") {
6708 context.method = "next";
6709 context.arg = undefined$1;
6710 }
6711 } else {
6712 // Re-yield the result returned by the delegate method.
6713 return info;
6714 } // The delegate iterator is finished, so forget it and continue with
6715 // the outer generator.
6716
6717
6718 context.delegate = null;
6719 return ContinueSentinel;
6720 } // Define Generator.prototype.{next,throw,return} in terms of the
6721 // unified ._invoke helper method.
6722
6723
6724 defineIteratorMethods(Gp);
6725 Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
6726 // @@iterator function is called on it. Some browsers' implementations of the
6727 // iterator prototype chain incorrectly implement this, causing the Generator
6728 // object to not be returned from this call. This ensures that doesn't happen.
6729 // See https://github.com/facebook/regenerator/issues/274 for more details.
6730
6731 Gp[iteratorSymbol] = function () {
6732 return this;
6733 };
6734
6735 Gp.toString = function () {
6736 return "[object Generator]";
6737 };
6738
6739 function pushTryEntry(locs) {
6740 var entry = {
6741 tryLoc: locs[0]
6742 };
6743
6744 if (1 in locs) {
6745 entry.catchLoc = locs[1];
6746 }
6747
6748 if (2 in locs) {
6749 entry.finallyLoc = locs[2];
6750 entry.afterLoc = locs[3];
6751 }
6752
6753 this.tryEntries.push(entry);
6754 }
6755
6756 function resetTryEntry(entry) {
6757 var record = entry.completion || {};
6758 record.type = "normal";
6759 delete record.arg;
6760 entry.completion = record;
6761 }
6762
6763 function Context(tryLocsList) {
6764 // The root entry object (effectively a try statement without a catch
6765 // or a finally block) gives us a place to store values thrown from
6766 // locations where there is no enclosing try statement.
6767 this.tryEntries = [{
6768 tryLoc: "root"
6769 }];
6770 tryLocsList.forEach(pushTryEntry, this);
6771 this.reset(true);
6772 }
6773
6774 exports.keys = function (object) {
6775 var keys = [];
6776
6777 for (var key in object) {
6778 keys.push(key);
6779 }
6780
6781 keys.reverse(); // Rather than returning an object with a next method, we keep
6782 // things simple and return the next function itself.
6783
6784 return function next() {
6785 while (keys.length) {
6786 var key = keys.pop();
6787
6788 if (key in object) {
6789 next.value = key;
6790 next.done = false;
6791 return next;
6792 }
6793 } // To avoid creating an additional object, we just hang the .value
6794 // and .done properties off the next function object itself. This
6795 // also ensures that the minifier will not anonymize the function.
6796
6797
6798 next.done = true;
6799 return next;
6800 };
6801 };
6802
6803 function values(iterable) {
6804 if (iterable) {
6805 var iteratorMethod = iterable[iteratorSymbol];
6806
6807 if (iteratorMethod) {
6808 return iteratorMethod.call(iterable);
6809 }
6810
6811 if (typeof iterable.next === "function") {
6812 return iterable;
6813 }
6814
6815 if (!isNaN(iterable.length)) {
6816 var i = -1,
6817 next = function next() {
6818 while (++i < iterable.length) {
6819 if (hasOwn.call(iterable, i)) {
6820 next.value = iterable[i];
6821 next.done = false;
6822 return next;
6823 }
6824 }
6825
6826 next.value = undefined$1;
6827 next.done = true;
6828 return next;
6829 };
6830
6831 return next.next = next;
6832 }
6833 } // Return an iterator with no values.
6834
6835
6836 return {
6837 next: doneResult
6838 };
6839 }
6840
6841 exports.values = values;
6842
6843 function doneResult() {
6844 return {
6845 value: undefined$1,
6846 done: true
6847 };
6848 }
6849
6850 Context.prototype = {
6851 constructor: Context,
6852 reset: function (skipTempReset) {
6853 this.prev = 0;
6854 this.next = 0; // Resetting context._sent for legacy support of Babel's
6855 // function.sent implementation.
6856
6857 this.sent = this._sent = undefined$1;
6858 this.done = false;
6859 this.delegate = null;
6860 this.method = "next";
6861 this.arg = undefined$1;
6862 this.tryEntries.forEach(resetTryEntry);
6863
6864 if (!skipTempReset) {
6865 for (var name in this) {
6866 // Not sure about the optimal order of these conditions:
6867 if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
6868 this[name] = undefined$1;
6869 }
6870 }
6871 }
6872 },
6873 stop: function () {
6874 this.done = true;
6875 var rootEntry = this.tryEntries[0];
6876 var rootRecord = rootEntry.completion;
6877
6878 if (rootRecord.type === "throw") {
6879 throw rootRecord.arg;
6880 }
6881
6882 return this.rval;
6883 },
6884 dispatchException: function (exception) {
6885 if (this.done) {
6886 throw exception;
6887 }
6888
6889 var context = this;
6890
6891 function handle(loc, caught) {
6892 record.type = "throw";
6893 record.arg = exception;
6894 context.next = loc;
6895
6896 if (caught) {
6897 // If the dispatched exception was caught by a catch block,
6898 // then let that catch block handle the exception normally.
6899 context.method = "next";
6900 context.arg = undefined$1;
6901 }
6902
6903 return !!caught;
6904 }
6905
6906 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6907 var entry = this.tryEntries[i];
6908 var record = entry.completion;
6909
6910 if (entry.tryLoc === "root") {
6911 // Exception thrown outside of any try block that could handle
6912 // it, so set the completion value of the entire function to
6913 // throw the exception.
6914 return handle("end");
6915 }
6916
6917 if (entry.tryLoc <= this.prev) {
6918 var hasCatch = hasOwn.call(entry, "catchLoc");
6919 var hasFinally = hasOwn.call(entry, "finallyLoc");
6920
6921 if (hasCatch && hasFinally) {
6922 if (this.prev < entry.catchLoc) {
6923 return handle(entry.catchLoc, true);
6924 } else if (this.prev < entry.finallyLoc) {
6925 return handle(entry.finallyLoc);
6926 }
6927 } else if (hasCatch) {
6928 if (this.prev < entry.catchLoc) {
6929 return handle(entry.catchLoc, true);
6930 }
6931 } else if (hasFinally) {
6932 if (this.prev < entry.finallyLoc) {
6933 return handle(entry.finallyLoc);
6934 }
6935 } else {
6936 throw new Error("try statement without catch or finally");
6937 }
6938 }
6939 }
6940 },
6941 abrupt: function (type, arg) {
6942 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6943 var entry = this.tryEntries[i];
6944
6945 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
6946 var finallyEntry = entry;
6947 break;
6948 }
6949 }
6950
6951 if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
6952 // Ignore the finally entry if control is not jumping to a
6953 // location outside the try/catch block.
6954 finallyEntry = null;
6955 }
6956
6957 var record = finallyEntry ? finallyEntry.completion : {};
6958 record.type = type;
6959 record.arg = arg;
6960
6961 if (finallyEntry) {
6962 this.method = "next";
6963 this.next = finallyEntry.finallyLoc;
6964 return ContinueSentinel;
6965 }
6966
6967 return this.complete(record);
6968 },
6969 complete: function (record, afterLoc) {
6970 if (record.type === "throw") {
6971 throw record.arg;
6972 }
6973
6974 if (record.type === "break" || record.type === "continue") {
6975 this.next = record.arg;
6976 } else if (record.type === "return") {
6977 this.rval = this.arg = record.arg;
6978 this.method = "return";
6979 this.next = "end";
6980 } else if (record.type === "normal" && afterLoc) {
6981 this.next = afterLoc;
6982 }
6983
6984 return ContinueSentinel;
6985 },
6986 finish: function (finallyLoc) {
6987 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6988 var entry = this.tryEntries[i];
6989
6990 if (entry.finallyLoc === finallyLoc) {
6991 this.complete(entry.completion, entry.afterLoc);
6992 resetTryEntry(entry);
6993 return ContinueSentinel;
6994 }
6995 }
6996 },
6997 "catch": function (tryLoc) {
6998 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
6999 var entry = this.tryEntries[i];
7000
7001 if (entry.tryLoc === tryLoc) {
7002 var record = entry.completion;
7003
7004 if (record.type === "throw") {
7005 var thrown = record.arg;
7006 resetTryEntry(entry);
7007 }
7008
7009 return thrown;
7010 }
7011 } // The context.catch method must only be called with a location
7012 // argument that corresponds to a known catch block.
7013
7014
7015 throw new Error("illegal catch attempt");
7016 },
7017 delegateYield: function (iterable, resultName, nextLoc) {
7018 this.delegate = {
7019 iterator: values(iterable),
7020 resultName: resultName,
7021 nextLoc: nextLoc
7022 };
7023
7024 if (this.method === "next") {
7025 // Deliberately forget the last sent value so that we don't
7026 // accidentally pass it on to the delegate.
7027 this.arg = undefined$1;
7028 }
7029
7030 return ContinueSentinel;
7031 }
7032 }; // Regardless of whether this script is executing as a CommonJS module
7033 // or not, return the runtime object so that we can declare the variable
7034 // regeneratorRuntime in the outer scope, which allows this module to be
7035 // injected easily by `bin/regenerator --include-runtime script.js`.
7036
7037 return exports;
7038 }( // If this script is executing as a CommonJS module, use module.exports
7039 // as the regeneratorRuntime namespace. Otherwise create a new empty
7040 // object. Either way, the resulting object will be used to initialize
7041 // the regeneratorRuntime variable at the top of this file.
7042 module.exports);
7043
7044 try {
7045 regeneratorRuntime = runtime;
7046 } catch (accidentalStrictMode) {
7047 // This module should not be running in strict mode, so the above
7048 // assignment should always work unless something is misconfigured. Just
7049 // in case runtime.js accidentally runs in strict mode, we can escape
7050 // strict mode using a global Function call. This could conceivably fail
7051 // if a Content Security Policy forbids using Function, but in that case
7052 // the proper solution is to fix the accidental strict mode problem. If
7053 // you've misconfigured your bundler to force strict mode and applied a
7054 // CSP to forbid Function, and you're not willing to fix either of those
7055 // problems, please detail your unique predicament in a GitHub issue.
7056 Function("r", "regeneratorRuntime = r")(runtime);
7057 }
7058});
7059var regenerator = runtime_1; // https://tc39.github.io/ecma262/#sec-symbol.iterator
7060
7061defineWellKnownSymbol$1('iterator');
7062
7063var createMethod$2$1 = function (CONVERT_TO_STRING) {
7064 return function ($this, pos) {
7065 var S = String(requireObjectCoercible$1($this));
7066 var position = toInteger$1(pos);
7067 var size = S.length;
7068 var first, second;
7069 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
7070 first = S.charCodeAt(position);
7071 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;
7072 };
7073};
7074
7075var stringMultibyte$1 = {
7076 // `String.prototype.codePointAt` method
7077 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
7078 codeAt: createMethod$2$1(false),
7079 // `String.prototype.at` method
7080 // https://github.com/mathiasbynens/String.prototype.at
7081 charAt: createMethod$2$1(true)
7082};
7083var charAt$1 = stringMultibyte$1.charAt;
7084var STRING_ITERATOR$1 = 'String Iterator';
7085var setInternalState$2$1 = internalState$1.set;
7086var getInternalState$2$1 = internalState$1.getterFor(STRING_ITERATOR$1); // `String.prototype[@@iterator]` method
7087// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
7088
7089defineIterator$1(String, 'String', function (iterated) {
7090 setInternalState$2$1(this, {
7091 type: STRING_ITERATOR$1,
7092 string: String(iterated),
7093 index: 0
7094 }); // `%StringIteratorPrototype%.next` method
7095 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
7096}, function next() {
7097 var state = getInternalState$2$1(this);
7098 var string = state.string;
7099 var index = state.index;
7100 var point;
7101 if (index >= string.length) return {
7102 value: undefined,
7103 done: true
7104 };
7105 point = charAt$1(string, index);
7106 state.index += point.length;
7107 return {
7108 value: point,
7109 done: false
7110 };
7111});
7112var iterator$3 = wrappedWellKnownSymbol$1.f('iterator');
7113var iterator$1$1 = iterator$3;
7114var iterator$2$1 = iterator$1$1;
7115var $stringify$1$1 = getBuiltIn$1('JSON', 'stringify');
7116var re = /[\uD800-\uDFFF]/g;
7117var low = /^[\uD800-\uDBFF]$/;
7118var hi = /^[\uDC00-\uDFFF]$/;
7119
7120var fix = function (match, offset, string) {
7121 var prev = string.charAt(offset - 1);
7122 var next = string.charAt(offset + 1);
7123
7124 if (low.test(match) && !hi.test(next) || hi.test(match) && !low.test(prev)) {
7125 return '\\u' + match.charCodeAt(0).toString(16);
7126 }
7127
7128 return match;
7129};
7130
7131var FORCED$1$1 = fails$1(function () {
7132 return $stringify$1$1('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify$1$1('\uDEAD') !== '"\\udead"';
7133});
7134
7135if ($stringify$1$1) {
7136 // https://github.com/tc39/proposal-well-formed-stringify
7137 _export$1({
7138 target: 'JSON',
7139 stat: true,
7140 forced: FORCED$1$1
7141 }, {
7142 // eslint-disable-next-line no-unused-vars
7143 stringify: function stringify(it, replacer, space) {
7144 var result = $stringify$1$1.apply(null, arguments);
7145 return typeof result == 'string' ? result.replace(re, fix) : result;
7146 }
7147 });
7148}
7149
7150if (!path$1.JSON) path$1.JSON = {
7151 stringify: JSON.stringify
7152}; // eslint-disable-next-line no-unused-vars
7153
7154var stringify = function stringify(it, replacer, space) {
7155 return path$1.JSON.stringify.apply(null, arguments);
7156};
7157
7158var stringify$1 = stringify;
7159var stringify$2 = stringify$1;
7160var defineProperty$4$1 = defineProperty_1$1;
7161var defineProperty$5$1 = defineProperty$4$1;
7162
7163function _defineProperty$1(obj, key, value) {
7164 if (key in obj) {
7165 defineProperty$5$1(obj, key, {
7166 value: value,
7167 enumerable: true,
7168 configurable: true,
7169 writable: true
7170 });
7171 } else {
7172 obj[key] = value;
7173 }
7174
7175 return obj;
7176}
7177
7178var defineProperty$6$1 = _defineProperty$1;
7179var values$3 = entryVirtual$1('Array').values;
7180var values$1$1 = values$3;
7181var ArrayPrototype$2$1 = Array.prototype;
7182var DOMIterables$2 = {
7183 DOMTokenList: true,
7184 NodeList: true
7185};
7186
7187var values_1 = function (it) {
7188 var own = it.values;
7189 return it === ArrayPrototype$2$1 || it instanceof Array && own === ArrayPrototype$2$1.values // eslint-disable-next-line no-prototype-builtins
7190 || DOMIterables$2.hasOwnProperty(classof$1(it)) ? values$1$1 : own;
7191};
7192
7193var values$2$1 = values_1;
7194var ITERATOR$2$1 = wellKnownSymbol$1('iterator');
7195
7196var getIteratorMethod$1 = function (it) {
7197 if (it != undefined) return it[ITERATOR$2$1] || it['@@iterator'] || iterators$1[classof$1(it)];
7198};
7199
7200var getIterator$3 = function (it) {
7201 var iteratorMethod = getIteratorMethod$1(it);
7202
7203 if (typeof iteratorMethod != 'function') {
7204 throw TypeError(String(it) + ' is not iterable');
7205 }
7206
7207 return anObject$1(iteratorMethod.call(it));
7208};
7209
7210var getIterator$1$1 = getIterator$3;
7211var getIterator$2$1 = getIterator$1$1;
7212var nativeSort = [].sort;
7213var test$1$1 = [1, 2, 3]; // IE8-
7214
7215var FAILS_ON_UNDEFINED = fails$1(function () {
7216 test$1$1.sort(undefined);
7217}); // V8 bug
7218
7219var FAILS_ON_NULL = fails$1(function () {
7220 test$1$1.sort(null);
7221}); // Old WebKit
7222
7223var SLOPPY_METHOD$1 = sloppyArrayMethod$1('sort');
7224var FORCED$2$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$1; // `Array.prototype.sort` method
7225// https://tc39.github.io/ecma262/#sec-array.prototype.sort
7226
7227_export$1({
7228 target: 'Array',
7229 proto: true,
7230 forced: FORCED$2$1
7231}, {
7232 sort: function sort(comparefn) {
7233 return comparefn === undefined ? nativeSort.call(toObject$1(this)) : nativeSort.call(toObject$1(this), aFunction$2(comparefn));
7234 }
7235});
7236
7237var sort = entryVirtual$1('Array').sort;
7238var ArrayPrototype$3$1 = Array.prototype;
7239
7240var sort_1 = function (it) {
7241 var own = it.sort;
7242 return it === ArrayPrototype$3$1 || it instanceof Array && own === ArrayPrototype$3$1.sort ? sort : own;
7243};
7244
7245var sort$1 = sort_1;
7246var sort$2 = sort$1;
7247
7248var createMethod$3$1 = function (IS_RIGHT) {
7249 return function (that, callbackfn, argumentsLength, memo) {
7250 aFunction$2(callbackfn);
7251 var O = toObject$1(that);
7252 var self = indexedObject$1(O);
7253 var length = toLength$1(O.length);
7254 var index = IS_RIGHT ? length - 1 : 0;
7255 var i = IS_RIGHT ? -1 : 1;
7256 if (argumentsLength < 2) while (true) {
7257 if (index in self) {
7258 memo = self[index];
7259 index += i;
7260 break;
7261 }
7262
7263 index += i;
7264
7265 if (IS_RIGHT ? index < 0 : length <= index) {
7266 throw TypeError('Reduce of empty array with no initial value');
7267 }
7268 }
7269
7270 for (; IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
7271 memo = callbackfn(memo, self[index], index, O);
7272 }
7273
7274 return memo;
7275 };
7276};
7277
7278var arrayReduce = {
7279 // `Array.prototype.reduce` method
7280 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
7281 left: createMethod$3$1(false),
7282 // `Array.prototype.reduceRight` method
7283 // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
7284 right: createMethod$3$1(true)
7285};
7286var $reduce = arrayReduce.left; // `Array.prototype.reduce` method
7287// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
7288
7289_export$1({
7290 target: 'Array',
7291 proto: true,
7292 forced: sloppyArrayMethod$1('reduce')
7293}, {
7294 reduce: function reduce(callbackfn
7295 /* , initialValue */
7296 ) {
7297 return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
7298 }
7299});
7300
7301var reduce = entryVirtual$1('Array').reduce;
7302var ArrayPrototype$4$1 = Array.prototype;
7303
7304var reduce_1 = function (it) {
7305 var own = it.reduce;
7306 return it === ArrayPrototype$4$1 || it instanceof Array && own === ArrayPrototype$4$1.reduce ? reduce : own;
7307};
7308
7309var reduce$1 = reduce_1;
7310var reduce$2 = reduce$1;
7311var keys$1$1 = entryVirtual$1('Array').keys;
7312var keys$2$1 = keys$1$1;
7313var ArrayPrototype$5$1 = Array.prototype;
7314var DOMIterables$3 = {
7315 DOMTokenList: true,
7316 NodeList: true
7317};
7318
7319var keys_1 = function (it) {
7320 var own = it.keys;
7321 return it === ArrayPrototype$5$1 || it instanceof Array && own === ArrayPrototype$5$1.keys // eslint-disable-next-line no-prototype-builtins
7322 || DOMIterables$3.hasOwnProperty(classof$1(it)) ? keys$2$1 : own;
7323};
7324
7325var keys$3$1 = keys_1; // https://tc39.github.io/ecma262/#sec-array.isarray
7326
7327_export$1({
7328 target: 'Array',
7329 stat: true
7330}, {
7331 isArray: isArray$6
7332});
7333
7334var isArray$1$1 = path$1.Array.isArray;
7335var isArray$2$1 = isArray$1$1;
7336var isArray$3$1 = isArray$2$1;
7337
7338function _arrayWithoutHoles$1(arr) {
7339 if (isArray$3$1(arr)) {
7340 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
7341 arr2[i] = arr[i];
7342 }
7343
7344 return arr2;
7345 }
7346}
7347
7348var arrayWithoutHoles$1 = _arrayWithoutHoles$1;
7349
7350var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
7351 try {
7352 return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
7353 } catch (error) {
7354 var returnMethod = iterator['return'];
7355 if (returnMethod !== undefined) anObject$1(returnMethod.call(iterator));
7356 throw error;
7357 }
7358};
7359
7360var ITERATOR$3$1 = wellKnownSymbol$1('iterator');
7361var ArrayPrototype$6$1 = Array.prototype; // check on default Array iterator
7362
7363var isArrayIteratorMethod$1 = function (it) {
7364 return it !== undefined && (iterators$1.Array === it || ArrayPrototype$6$1[ITERATOR$3$1] === it);
7365}; // https://tc39.github.io/ecma262/#sec-array.from
7366
7367
7368var arrayFrom$1 = function from(arrayLike
7369/* , mapfn = undefined, thisArg = undefined */
7370) {
7371 var O = toObject$1(arrayLike);
7372 var C = typeof this == 'function' ? this : Array;
7373 var argumentsLength = arguments.length;
7374 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
7375 var mapping = mapfn !== undefined;
7376 var index = 0;
7377 var iteratorMethod = getIteratorMethod$1(O);
7378 var length, result, step, iterator, next;
7379 if (mapping) mapfn = bindContext$1(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
7380
7381 if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod$1(iteratorMethod))) {
7382 iterator = iteratorMethod.call(O);
7383 next = iterator.next;
7384 result = new C();
7385
7386 for (; !(step = next.call(iterator)).done; index++) {
7387 createProperty$1(result, index, mapping ? callWithSafeIterationClosing$1(iterator, mapfn, [step.value, index], true) : step.value);
7388 }
7389 } else {
7390 length = toLength$1(O.length);
7391 result = new C(length);
7392
7393 for (; length > index; index++) {
7394 createProperty$1(result, index, mapping ? mapfn(O[index], index) : O[index]);
7395 }
7396 }
7397
7398 result.length = index;
7399 return result;
7400};
7401
7402var ITERATOR$4$1 = wellKnownSymbol$1('iterator');
7403var SAFE_CLOSING$1 = false;
7404
7405try {
7406 var called$1 = 0;
7407 var iteratorWithReturn$1 = {
7408 next: function () {
7409 return {
7410 done: !!called$1++
7411 };
7412 },
7413 'return': function () {
7414 SAFE_CLOSING$1 = true;
7415 }
7416 };
7417
7418 iteratorWithReturn$1[ITERATOR$4$1] = function () {
7419 return this;
7420 }; // eslint-disable-next-line no-throw-literal
7421
7422
7423 Array.from(iteratorWithReturn$1, function () {
7424 throw 2;
7425 });
7426} catch (error) {
7427 /* empty */
7428}
7429
7430var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
7431 if (!SKIP_CLOSING && !SAFE_CLOSING$1) return false;
7432 var ITERATION_SUPPORT = false;
7433
7434 try {
7435 var object = {};
7436
7437 object[ITERATOR$4$1] = function () {
7438 return {
7439 next: function () {
7440 return {
7441 done: ITERATION_SUPPORT = true
7442 };
7443 }
7444 };
7445 };
7446
7447 exec(object);
7448 } catch (error) {
7449 /* empty */
7450 }
7451
7452 return ITERATION_SUPPORT;
7453};
7454
7455var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration$1(function (iterable) {
7456 Array.from(iterable);
7457}); // `Array.from` method
7458// https://tc39.github.io/ecma262/#sec-array.from
7459
7460_export$1({
7461 target: 'Array',
7462 stat: true,
7463 forced: INCORRECT_ITERATION$1
7464}, {
7465 from: arrayFrom$1
7466});
7467
7468var from_1$3 = path$1.Array.from;
7469var from_1$1$1 = from_1$3;
7470var from_1$2$1 = from_1$1$1;
7471var ITERATOR$5$1 = wellKnownSymbol$1('iterator');
7472
7473var isIterable$3 = function (it) {
7474 var O = Object(it);
7475 return O[ITERATOR$5$1] !== undefined || '@@iterator' in O // eslint-disable-next-line no-prototype-builtins
7476 || iterators$1.hasOwnProperty(classof$1(O));
7477};
7478
7479var isIterable$1$1 = isIterable$3;
7480var isIterable$2$1 = isIterable$1$1;
7481
7482function _iterableToArray$1(iter) {
7483 if (isIterable$2$1(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return from_1$2$1(iter);
7484}
7485
7486var iterableToArray$1 = _iterableToArray$1;
7487
7488function _nonIterableSpread$1() {
7489 throw new TypeError("Invalid attempt to spread non-iterable instance");
7490}
7491
7492var nonIterableSpread$1 = _nonIterableSpread$1;
7493
7494function _toConsumableArray$1(arr) {
7495 return arrayWithoutHoles$1(arr) || iterableToArray$1(arr) || nonIterableSpread$1();
7496}
7497
7498var toConsumableArray$1 = _toConsumableArray$1;
7499var userAgent$1 = getBuiltIn$1('navigator', 'userAgent') || '';
7500var process$1 = global_1$1.process;
7501var versions$1 = process$1 && process$1.versions;
7502var v8$1 = versions$1 && versions$1.v8;
7503var match$1, version$1;
7504
7505if (v8$1) {
7506 match$1 = v8$1.split('.');
7507 version$1 = match$1[0] + match$1[1];
7508} else if (userAgent$1) {
7509 match$1 = userAgent$1.match(/Edge\/(\d+)/);
7510
7511 if (!match$1 || match$1[1] >= 74) {
7512 match$1 = userAgent$1.match(/Chrome\/(\d+)/);
7513 if (match$1) version$1 = match$1[1];
7514 }
7515}
7516
7517var v8Version$1 = version$1 && +version$1;
7518var SPECIES$1$1 = wellKnownSymbol$1('species');
7519
7520var arrayMethodHasSpeciesSupport$1 = function (METHOD_NAME) {
7521 // We can't use this feature detection in V8 since it causes
7522 // deoptimization and serious performance degradation
7523 // https://github.com/zloirock/core-js/issues/677
7524 return v8Version$1 >= 51 || !fails$1(function () {
7525 var array = [];
7526 var constructor = array.constructor = {};
7527
7528 constructor[SPECIES$1$1] = function () {
7529 return {
7530 foo: 1
7531 };
7532 };
7533
7534 return array[METHOD_NAME](Boolean).foo !== 1;
7535 });
7536};
7537
7538var $filter$1 = arrayIteration$1.filter; // `Array.prototype.filter` method
7539// https://tc39.github.io/ecma262/#sec-array.prototype.filter
7540// with adding support of @@species
7541
7542_export$1({
7543 target: 'Array',
7544 proto: true,
7545 forced: !arrayMethodHasSpeciesSupport$1('filter')
7546}, {
7547 filter: function filter(callbackfn
7548 /* , thisArg */
7549 ) {
7550 return $filter$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
7551 }
7552});
7553
7554var filter$3 = entryVirtual$1('Array').filter;
7555var ArrayPrototype$7$1 = Array.prototype;
7556
7557var filter_1$1 = function (it) {
7558 var own = it.filter;
7559 return it === ArrayPrototype$7$1 || it instanceof Array && own === ArrayPrototype$7$1.filter ? filter$3 : own;
7560};
7561
7562var filter$1$1 = filter_1$1;
7563var filter$2$1 = filter$1$1;
7564var IS_CONCAT_SPREADABLE$1 = wellKnownSymbol$1('isConcatSpreadable');
7565var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
7566var MAXIMUM_ALLOWED_INDEX_EXCEEDED$1 = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
7567// deoptimization and serious performance degradation
7568// https://github.com/zloirock/core-js/issues/679
7569
7570var IS_CONCAT_SPREADABLE_SUPPORT$1 = v8Version$1 >= 51 || !fails$1(function () {
7571 var array = [];
7572 array[IS_CONCAT_SPREADABLE$1] = false;
7573 return array.concat()[0] !== array;
7574});
7575var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('concat');
7576
7577var isConcatSpreadable$1 = function (O) {
7578 if (!isObject$2(O)) return false;
7579 var spreadable = O[IS_CONCAT_SPREADABLE$1];
7580 return spreadable !== undefined ? !!spreadable : isArray$6(O);
7581};
7582
7583var FORCED$3$1 = !IS_CONCAT_SPREADABLE_SUPPORT$1 || !SPECIES_SUPPORT$1; // `Array.prototype.concat` method
7584// https://tc39.github.io/ecma262/#sec-array.prototype.concat
7585// with adding support of @@isConcatSpreadable and @@species
7586
7587_export$1({
7588 target: 'Array',
7589 proto: true,
7590 forced: FORCED$3$1
7591}, {
7592 concat: function concat(arg) {
7593 // eslint-disable-line no-unused-vars
7594 var O = toObject$1(this);
7595 var A = arraySpeciesCreate$1(O, 0);
7596 var n = 0;
7597 var i, k, length, len, E;
7598
7599 for (i = -1, length = arguments.length; i < length; i++) {
7600 E = i === -1 ? O : arguments[i];
7601
7602 if (isConcatSpreadable$1(E)) {
7603 len = toLength$1(E.length);
7604 if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1);
7605
7606 for (k = 0; k < len; k++, n++) if (k in E) createProperty$1(A, n, E[k]);
7607 } else {
7608 if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1);
7609 createProperty$1(A, n++, E);
7610 }
7611 }
7612
7613 A.length = n;
7614 return A;
7615 }
7616});
7617
7618var concat$3 = entryVirtual$1('Array').concat;
7619var ArrayPrototype$8 = Array.prototype;
7620
7621var concat_1$1 = function (it) {
7622 var own = it.concat;
7623 return it === ArrayPrototype$8 || it instanceof Array && own === ArrayPrototype$8.concat ? concat$3 : own;
7624};
7625
7626var concat$1$1 = concat_1$1;
7627var concat$2$1 = concat$1$1;
7628var nativeAssign$1 = Object.assign; // `Object.assign` method
7629// https://tc39.github.io/ecma262/#sec-object.assign
7630// should work with symbols and should have deterministic property order (V8 bug)
7631
7632var objectAssign$1 = !nativeAssign$1 || fails$1(function () {
7633 var A = {};
7634 var B = {}; // eslint-disable-next-line no-undef
7635
7636 var symbol = Symbol();
7637 var alphabet = 'abcdefghijklmnopqrst';
7638 A[symbol] = 7;
7639 alphabet.split('').forEach(function (chr) {
7640 B[chr] = chr;
7641 });
7642 return nativeAssign$1({}, A)[symbol] != 7 || objectKeys$1(nativeAssign$1({}, B)).join('') != alphabet;
7643}) ? function assign(target, source) {
7644 // eslint-disable-line no-unused-vars
7645 var T = toObject$1(target);
7646 var argumentsLength = arguments.length;
7647 var index = 1;
7648 var getOwnPropertySymbols = objectGetOwnPropertySymbols$1.f;
7649 var propertyIsEnumerable = objectPropertyIsEnumerable$1.f;
7650
7651 while (argumentsLength > index) {
7652 var S = indexedObject$1(arguments[index++]);
7653 var keys = getOwnPropertySymbols ? objectKeys$1(S).concat(getOwnPropertySymbols(S)) : objectKeys$1(S);
7654 var length = keys.length;
7655 var j = 0;
7656 var key;
7657
7658 while (length > j) {
7659 key = keys[j++];
7660 if (!descriptors$1 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
7661 }
7662 }
7663
7664 return T;
7665} : nativeAssign$1; // https://tc39.github.io/ecma262/#sec-object.assign
7666
7667_export$1({
7668 target: 'Object',
7669 stat: true,
7670 forced: Object.assign !== objectAssign$1
7671}, {
7672 assign: objectAssign$1
7673});
7674
7675var assign$3 = path$1.Object.assign;
7676var assign$1$1 = assign$3;
7677var assign$2$1 = assign$1$1;
7678var $some = arrayIteration$1.some; // `Array.prototype.some` method
7679// https://tc39.github.io/ecma262/#sec-array.prototype.some
7680
7681_export$1({
7682 target: 'Array',
7683 proto: true,
7684 forced: sloppyArrayMethod$1('some')
7685}, {
7686 some: function some(callbackfn
7687 /* , thisArg */
7688 ) {
7689 return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
7690 }
7691});
7692
7693var some = entryVirtual$1('Array').some;
7694var ArrayPrototype$9 = Array.prototype;
7695
7696var some_1 = function (it) {
7697 var own = it.some;
7698 return it === ArrayPrototype$9 || it instanceof Array && own === ArrayPrototype$9.some ? some : own;
7699};
7700
7701var some$1 = some_1;
7702var some$2 = some$1;
7703var $map$1 = arrayIteration$1.map; // `Array.prototype.map` method
7704// https://tc39.github.io/ecma262/#sec-array.prototype.map
7705// with adding support of @@species
7706
7707_export$1({
7708 target: 'Array',
7709 proto: true,
7710 forced: !arrayMethodHasSpeciesSupport$1('map')
7711}, {
7712 map: function map(callbackfn
7713 /* , thisArg */
7714 ) {
7715 return $map$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
7716 }
7717});
7718
7719var map$3 = entryVirtual$1('Array').map;
7720var ArrayPrototype$a = Array.prototype;
7721
7722var map_1$1 = function (it) {
7723 var own = it.map;
7724 return it === ArrayPrototype$a || it instanceof Array && own === ArrayPrototype$a.map ? map$3 : own;
7725};
7726
7727var map$1$1 = map_1$1;
7728var map$2$1 = map$1$1;
7729var iterator$3$1 = iterator$3;
7730var iterator$4 = iterator$3$1; // https://tc39.github.io/ecma262/#sec-symbol.asynciterator
7731
7732defineWellKnownSymbol$1('asyncIterator'); // https://tc39.github.io/ecma262/#sec-symbol.hasinstance
7733
7734defineWellKnownSymbol$1('hasInstance'); // https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable
7735
7736defineWellKnownSymbol$1('isConcatSpreadable'); // https://tc39.github.io/ecma262/#sec-symbol.match
7737
7738defineWellKnownSymbol$1('match');
7739defineWellKnownSymbol$1('matchAll'); // https://tc39.github.io/ecma262/#sec-symbol.replace
7740
7741defineWellKnownSymbol$1('replace'); // https://tc39.github.io/ecma262/#sec-symbol.search
7742
7743defineWellKnownSymbol$1('search'); // https://tc39.github.io/ecma262/#sec-symbol.species
7744
7745defineWellKnownSymbol$1('species'); // https://tc39.github.io/ecma262/#sec-symbol.split
7746
7747defineWellKnownSymbol$1('split'); // https://tc39.github.io/ecma262/#sec-symbol.toprimitive
7748
7749defineWellKnownSymbol$1('toPrimitive'); // https://tc39.github.io/ecma262/#sec-symbol.tostringtag
7750
7751defineWellKnownSymbol$1('toStringTag'); // https://tc39.github.io/ecma262/#sec-symbol.unscopables
7752
7753defineWellKnownSymbol$1('unscopables'); // https://tc39.github.io/ecma262/#sec-math-@@tostringtag
7754
7755setToStringTag$1(Math, 'Math', true); // https://tc39.github.io/ecma262/#sec-json-@@tostringtag
7756
7757setToStringTag$1(global_1$1.JSON, 'JSON', true);
7758var symbol$3 = path$1.Symbol; // https://github.com/tc39/proposal-using-statement
7759
7760defineWellKnownSymbol$1('asyncDispose'); // https://github.com/tc39/proposal-using-statement
7761
7762defineWellKnownSymbol$1('dispose'); // https://github.com/tc39/proposal-observable
7763
7764defineWellKnownSymbol$1('observable'); // https://github.com/tc39/proposal-pattern-matching
7765
7766defineWellKnownSymbol$1('patternMatch');
7767defineWellKnownSymbol$1('replaceAll');
7768var symbol$1$1 = symbol$3; // TODO: Remove from `core-js@4`
7769
7770var symbol$2$1 = symbol$1$1;
7771
7772var _typeof_1$1 = createCommonjsModule$2(function (module) {
7773 function _typeof2(obj) {
7774 if (typeof symbol$2$1 === "function" && typeof iterator$4 === "symbol") {
7775 _typeof2 = function _typeof2(obj) {
7776 return typeof obj;
7777 };
7778 } else {
7779 _typeof2 = function _typeof2(obj) {
7780 return obj && typeof symbol$2$1 === "function" && obj.constructor === symbol$2$1 && obj !== symbol$2$1.prototype ? "symbol" : typeof obj;
7781 };
7782 }
7783
7784 return _typeof2(obj);
7785 }
7786
7787 function _typeof(obj) {
7788 if (typeof symbol$2$1 === "function" && _typeof2(iterator$4) === "symbol") {
7789 module.exports = _typeof = function _typeof(obj) {
7790 return _typeof2(obj);
7791 };
7792 } else {
7793 module.exports = _typeof = function _typeof(obj) {
7794 return obj && typeof symbol$2$1 === "function" && obj.constructor === symbol$2$1 && obj !== symbol$2$1.prototype ? "symbol" : _typeof2(obj);
7795 };
7796 }
7797
7798 return _typeof(obj);
7799 }
7800
7801 module.exports = _typeof;
7802});
7803
7804var FAILS_ON_PRIMITIVES$1$1 = fails$1(function () {
7805 objectKeys$1(1);
7806}); // `Object.keys` method
7807// https://tc39.github.io/ecma262/#sec-object.keys
7808
7809_export$1({
7810 target: 'Object',
7811 stat: true,
7812 forced: FAILS_ON_PRIMITIVES$1$1
7813}, {
7814 keys: function keys(it) {
7815 return objectKeys$1(toObject$1(it));
7816 }
7817});
7818
7819var keys$4$1 = path$1.Object.keys;
7820var keys$5 = keys$4$1;
7821var keys$6 = keys$5;
7822var freezing = !fails$1(function () {
7823 return Object.isExtensible(Object.preventExtensions({}));
7824});
7825var internalMetadata = createCommonjsModule$2(function (module) {
7826 var defineProperty = objectDefineProperty$1.f;
7827 var METADATA = uid$1('meta');
7828 var id = 0;
7829
7830 var isExtensible = Object.isExtensible || function () {
7831 return true;
7832 };
7833
7834 var setMetadata = function (it) {
7835 defineProperty(it, METADATA, {
7836 value: {
7837 objectID: 'O' + ++id,
7838 // object ID
7839 weakData: {} // weak collections IDs
7840
7841 }
7842 });
7843 };
7844
7845 var fastKey = function (it, create) {
7846 // return a primitive with prefix
7847 if (!isObject$2(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
7848
7849 if (!has$2(it, METADATA)) {
7850 // can't set metadata to uncaught frozen object
7851 if (!isExtensible(it)) return 'F'; // not necessary to add metadata
7852
7853 if (!create) return 'E'; // add missing metadata
7854
7855 setMetadata(it); // return object ID
7856 }
7857
7858 return it[METADATA].objectID;
7859 };
7860
7861 var getWeakData = function (it, create) {
7862 if (!has$2(it, METADATA)) {
7863 // can't set metadata to uncaught frozen object
7864 if (!isExtensible(it)) return true; // not necessary to add metadata
7865
7866 if (!create) return false; // add missing metadata
7867
7868 setMetadata(it); // return the store of weak collections IDs
7869 }
7870
7871 return it[METADATA].weakData;
7872 }; // add metadata on freeze-family methods calling
7873
7874
7875 var onFreeze = function (it) {
7876 if (freezing && meta.REQUIRED && isExtensible(it) && !has$2(it, METADATA)) setMetadata(it);
7877 return it;
7878 };
7879
7880 var meta = module.exports = {
7881 REQUIRED: false,
7882 fastKey: fastKey,
7883 getWeakData: getWeakData,
7884 onFreeze: onFreeze
7885 };
7886 hiddenKeys$2[METADATA] = true;
7887});
7888var internalMetadata_1 = internalMetadata.REQUIRED;
7889var internalMetadata_2 = internalMetadata.fastKey;
7890var internalMetadata_3 = internalMetadata.getWeakData;
7891var internalMetadata_4 = internalMetadata.onFreeze;
7892var iterate_1 = createCommonjsModule$2(function (module) {
7893 var Result = function (stopped, result) {
7894 this.stopped = stopped;
7895 this.result = result;
7896 };
7897
7898 var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
7899 var boundFunction = bindContext$1(fn, that, AS_ENTRIES ? 2 : 1);
7900 var iterator, iterFn, index, length, result, next, step;
7901
7902 if (IS_ITERATOR) {
7903 iterator = iterable;
7904 } else {
7905 iterFn = getIteratorMethod$1(iterable);
7906 if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators
7907
7908 if (isArrayIteratorMethod$1(iterFn)) {
7909 for (index = 0, length = toLength$1(iterable.length); length > index; index++) {
7910 result = AS_ENTRIES ? boundFunction(anObject$1(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
7911 if (result && result instanceof Result) return result;
7912 }
7913
7914 return new Result(false);
7915 }
7916
7917 iterator = iterFn.call(iterable);
7918 }
7919
7920 next = iterator.next;
7921
7922 while (!(step = next.call(iterator)).done) {
7923 result = callWithSafeIterationClosing$1(iterator, boundFunction, step.value, AS_ENTRIES);
7924 if (typeof result == 'object' && result && result instanceof Result) return result;
7925 }
7926
7927 return new Result(false);
7928 };
7929
7930 iterate.stop = function (result) {
7931 return new Result(true, result);
7932 };
7933});
7934
7935var anInstance = function (it, Constructor, name) {
7936 if (!(it instanceof Constructor)) {
7937 throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
7938 }
7939
7940 return it;
7941};
7942
7943var defineProperty$7$1 = objectDefineProperty$1.f;
7944var forEach$3$1 = arrayIteration$1.forEach;
7945var setInternalState$3$1 = internalState$1.set;
7946var internalStateGetterFor = internalState$1.getterFor;
7947
7948var collection = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
7949 var NativeConstructor = global_1$1[CONSTRUCTOR_NAME];
7950 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
7951 var ADDER = IS_MAP ? 'set' : 'add';
7952 var exported = {};
7953 var Constructor;
7954
7955 if (!descriptors$1 || typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails$1(function () {
7956 new NativeConstructor().entries().next();
7957 }))) {
7958 // create collection constructor
7959 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
7960 internalMetadata.REQUIRED = true;
7961 } else {
7962 Constructor = wrapper(function (target, iterable) {
7963 setInternalState$3$1(anInstance(target, Constructor, CONSTRUCTOR_NAME), {
7964 type: CONSTRUCTOR_NAME,
7965 collection: new NativeConstructor()
7966 });
7967 if (iterable != undefined) iterate_1(iterable, target[ADDER], target, IS_MAP);
7968 });
7969 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
7970 forEach$3$1(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
7971 var IS_ADDER = KEY == 'add' || KEY == 'set';
7972
7973 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
7974 createNonEnumerableProperty$1(Constructor.prototype, KEY, function (a, b) {
7975 var collection = getInternalState(this).collection;
7976 if (!IS_ADDER && IS_WEAK && !isObject$2(a)) return KEY == 'get' ? undefined : false;
7977 var result = collection[KEY](a === 0 ? 0 : a, b);
7978 return IS_ADDER ? this : result;
7979 });
7980 }
7981 });
7982 IS_WEAK || defineProperty$7$1(Constructor.prototype, 'size', {
7983 get: function () {
7984 return getInternalState(this).collection.size;
7985 }
7986 });
7987 }
7988
7989 setToStringTag$1(Constructor, CONSTRUCTOR_NAME, false, true);
7990 exported[CONSTRUCTOR_NAME] = Constructor;
7991
7992 _export$1({
7993 global: true,
7994 forced: true
7995 }, exported);
7996
7997 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
7998 return Constructor;
7999};
8000
8001var redefineAll = function (target, src, options) {
8002 for (var key in src) {
8003 if (options && options.unsafe && target[key]) target[key] = src[key];else redefine$1(target, key, src[key], options);
8004 }
8005
8006 return target;
8007};
8008
8009var SPECIES$2$1 = wellKnownSymbol$1('species');
8010
8011var setSpecies = function (CONSTRUCTOR_NAME) {
8012 var Constructor = getBuiltIn$1(CONSTRUCTOR_NAME);
8013 var defineProperty = objectDefineProperty$1.f;
8014
8015 if (descriptors$1 && Constructor && !Constructor[SPECIES$2$1]) {
8016 defineProperty(Constructor, SPECIES$2$1, {
8017 configurable: true,
8018 get: function () {
8019 return this;
8020 }
8021 });
8022 }
8023};
8024
8025var defineProperty$8 = objectDefineProperty$1.f;
8026var fastKey = internalMetadata.fastKey;
8027var setInternalState$4 = internalState$1.set;
8028var internalStateGetterFor$1 = internalState$1.getterFor;
8029var collectionStrong = {
8030 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
8031 var C = wrapper(function (that, iterable) {
8032 anInstance(that, C, CONSTRUCTOR_NAME);
8033 setInternalState$4(that, {
8034 type: CONSTRUCTOR_NAME,
8035 index: objectCreate$1(null),
8036 first: undefined,
8037 last: undefined,
8038 size: 0
8039 });
8040 if (!descriptors$1) that.size = 0;
8041 if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
8042 });
8043 var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
8044
8045 var define = function (that, key, value) {
8046 var state = getInternalState(that);
8047 var entry = getEntry(that, key);
8048 var previous, index; // change existing entry
8049
8050 if (entry) {
8051 entry.value = value; // create new entry
8052 } else {
8053 state.last = entry = {
8054 index: index = fastKey(key, true),
8055 key: key,
8056 value: value,
8057 previous: previous = state.last,
8058 next: undefined,
8059 removed: false
8060 };
8061 if (!state.first) state.first = entry;
8062 if (previous) previous.next = entry;
8063 if (descriptors$1) state.size++;else that.size++; // add to index
8064
8065 if (index !== 'F') state.index[index] = entry;
8066 }
8067
8068 return that;
8069 };
8070
8071 var getEntry = function (that, key) {
8072 var state = getInternalState(that); // fast case
8073
8074 var index = fastKey(key);
8075 var entry;
8076 if (index !== 'F') return state.index[index]; // frozen object case
8077
8078 for (entry = state.first; entry; entry = entry.next) {
8079 if (entry.key == key) return entry;
8080 }
8081 };
8082
8083 redefineAll(C.prototype, {
8084 // 23.1.3.1 Map.prototype.clear()
8085 // 23.2.3.2 Set.prototype.clear()
8086 clear: function clear() {
8087 var that = this;
8088 var state = getInternalState(that);
8089 var data = state.index;
8090 var entry = state.first;
8091
8092 while (entry) {
8093 entry.removed = true;
8094 if (entry.previous) entry.previous = entry.previous.next = undefined;
8095 delete data[entry.index];
8096 entry = entry.next;
8097 }
8098
8099 state.first = state.last = undefined;
8100 if (descriptors$1) state.size = 0;else that.size = 0;
8101 },
8102 // 23.1.3.3 Map.prototype.delete(key)
8103 // 23.2.3.4 Set.prototype.delete(value)
8104 'delete': function (key) {
8105 var that = this;
8106 var state = getInternalState(that);
8107 var entry = getEntry(that, key);
8108
8109 if (entry) {
8110 var next = entry.next;
8111 var prev = entry.previous;
8112 delete state.index[entry.index];
8113 entry.removed = true;
8114 if (prev) prev.next = next;
8115 if (next) next.previous = prev;
8116 if (state.first == entry) state.first = next;
8117 if (state.last == entry) state.last = prev;
8118 if (descriptors$1) state.size--;else that.size--;
8119 }
8120
8121 return !!entry;
8122 },
8123 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
8124 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
8125 forEach: function forEach(callbackfn
8126 /* , that = undefined */
8127 ) {
8128 var state = getInternalState(this);
8129 var boundFunction = bindContext$1(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
8130 var entry;
8131
8132 while (entry = entry ? entry.next : state.first) {
8133 boundFunction(entry.value, entry.key, this); // revert to the last existing entry
8134
8135 while (entry && entry.removed) entry = entry.previous;
8136 }
8137 },
8138 // 23.1.3.7 Map.prototype.has(key)
8139 // 23.2.3.7 Set.prototype.has(value)
8140 has: function has(key) {
8141 return !!getEntry(this, key);
8142 }
8143 });
8144 redefineAll(C.prototype, IS_MAP ? {
8145 // 23.1.3.6 Map.prototype.get(key)
8146 get: function get(key) {
8147 var entry = getEntry(this, key);
8148 return entry && entry.value;
8149 },
8150 // 23.1.3.9 Map.prototype.set(key, value)
8151 set: function set(key, value) {
8152 return define(this, key === 0 ? 0 : key, value);
8153 }
8154 } : {
8155 // 23.2.3.1 Set.prototype.add(value)
8156 add: function add(value) {
8157 return define(this, value = value === 0 ? 0 : value, value);
8158 }
8159 });
8160 if (descriptors$1) defineProperty$8(C.prototype, 'size', {
8161 get: function () {
8162 return getInternalState(this).size;
8163 }
8164 });
8165 return C;
8166 },
8167 setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
8168 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
8169 var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
8170 var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME); // add .keys, .values, .entries, [@@iterator]
8171 // 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
8172
8173 defineIterator$1(C, CONSTRUCTOR_NAME, function (iterated, kind) {
8174 setInternalState$4(this, {
8175 type: ITERATOR_NAME,
8176 target: iterated,
8177 state: getInternalCollectionState(iterated),
8178 kind: kind,
8179 last: undefined
8180 });
8181 }, function () {
8182 var state = getInternalIteratorState(this);
8183 var kind = state.kind;
8184 var entry = state.last; // revert to the last existing entry
8185
8186 while (entry && entry.removed) entry = entry.previous; // get next entry
8187
8188
8189 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
8190 // or finish the iteration
8191 state.target = undefined;
8192 return {
8193 value: undefined,
8194 done: true
8195 };
8196 } // return step by kind
8197
8198
8199 if (kind == 'keys') return {
8200 value: entry.key,
8201 done: false
8202 };
8203 if (kind == 'values') return {
8204 value: entry.value,
8205 done: false
8206 };
8207 return {
8208 value: [entry.key, entry.value],
8209 done: false
8210 };
8211 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2
8212
8213 setSpecies(CONSTRUCTOR_NAME);
8214 }
8215}; // https://tc39.github.io/ecma262/#sec-map-objects
8216
8217var es_map = collection('Map', function (get) {
8218 return function Map() {
8219 return get(this, arguments.length ? arguments[0] : undefined);
8220 };
8221}, collectionStrong, true);
8222var map$3$1 = path$1.Map;
8223var map$4 = map$3$1;
8224var map$5 = map$4;
8225var isArray$4$1 = isArray$1$1;
8226var isArray$5$1 = isArray$4$1;
8227
8228function _classCallCheck(instance, Constructor) {
8229 if (!(instance instanceof Constructor)) {
8230 throw new TypeError("Cannot call a class as a function");
8231 }
8232}
8233
8234var classCallCheck = _classCallCheck;
8235
8236function _defineProperties(target, props) {
8237 for (var i = 0; i < props.length; i++) {
8238 var descriptor = props[i];
8239 descriptor.enumerable = descriptor.enumerable || false;
8240 descriptor.configurable = true;
8241 if ("value" in descriptor) descriptor.writable = true;
8242 defineProperty$5$1(target, descriptor.key, descriptor);
8243 }
8244}
8245
8246function _createClass(Constructor, protoProps, staticProps) {
8247 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
8248 if (staticProps) _defineProperties(Constructor, staticProps);
8249 return Constructor;
8250}
8251
8252var createClass = _createClass;
8253
8254function _assertThisInitialized(self) {
8255 if (self === void 0) {
8256 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8257 }
8258
8259 return self;
8260}
8261
8262var assertThisInitialized = _assertThisInitialized;
8263
8264function _possibleConstructorReturn(self, call) {
8265 if (call && (_typeof_1$1(call) === "object" || typeof call === "function")) {
8266 return call;
8267 }
8268
8269 return assertThisInitialized(self);
8270}
8271
8272var possibleConstructorReturn = _possibleConstructorReturn;
8273var FAILS_ON_PRIMITIVES$2$1 = fails$1(function () {
8274 objectGetPrototypeOf$1(1);
8275}); // `Object.getPrototypeOf` method
8276// https://tc39.github.io/ecma262/#sec-object.getprototypeof
8277
8278_export$1({
8279 target: 'Object',
8280 stat: true,
8281 forced: FAILS_ON_PRIMITIVES$2$1,
8282 sham: !correctPrototypeGetter$1
8283}, {
8284 getPrototypeOf: function getPrototypeOf(it) {
8285 return objectGetPrototypeOf$1(toObject$1(it));
8286 }
8287});
8288
8289var getPrototypeOf$3 = path$1.Object.getPrototypeOf;
8290var getPrototypeOf$1$1 = getPrototypeOf$3;
8291var getPrototypeOf$2$1 = getPrototypeOf$1$1; // https://tc39.github.io/ecma262/#sec-object.setprototypeof
8292
8293_export$1({
8294 target: 'Object',
8295 stat: true
8296}, {
8297 setPrototypeOf: objectSetPrototypeOf$1
8298});
8299
8300var setPrototypeOf = path$1.Object.setPrototypeOf;
8301var setPrototypeOf$1 = setPrototypeOf;
8302var setPrototypeOf$2 = setPrototypeOf$1;
8303var getPrototypeOf$3$1 = createCommonjsModule$2(function (module) {
8304 function _getPrototypeOf(o) {
8305 module.exports = _getPrototypeOf = setPrototypeOf$2 ? getPrototypeOf$2$1 : function _getPrototypeOf(o) {
8306 return o.__proto__ || getPrototypeOf$2$1(o);
8307 };
8308 return _getPrototypeOf(o);
8309 }
8310
8311 module.exports = _getPrototypeOf;
8312}); // https://tc39.github.io/ecma262/#sec-object.create
8313
8314_export$1({
8315 target: 'Object',
8316 stat: true,
8317 sham: !descriptors$1
8318}, {
8319 create: objectCreate$1
8320});
8321
8322var Object$1$1 = path$1.Object;
8323
8324var create$3 = function create(P, D) {
8325 return Object$1$1.create(P, D);
8326};
8327
8328var create$1$1 = create$3;
8329var create$2$1 = create$1$1;
8330var setPrototypeOf$3 = createCommonjsModule$2(function (module) {
8331 function _setPrototypeOf(o, p) {
8332 module.exports = _setPrototypeOf = setPrototypeOf$2 || function _setPrototypeOf(o, p) {
8333 o.__proto__ = p;
8334 return o;
8335 };
8336
8337 return _setPrototypeOf(o, p);
8338 }
8339
8340 module.exports = _setPrototypeOf;
8341});
8342
8343function _inherits(subClass, superClass) {
8344 if (typeof superClass !== "function" && superClass !== null) {
8345 throw new TypeError("Super expression must either be null or a function");
8346 }
8347
8348 subClass.prototype = create$2$1(superClass && superClass.prototype, {
8349 constructor: {
8350 value: subClass,
8351 writable: true,
8352 configurable: true
8353 }
8354 });
8355 if (superClass) setPrototypeOf$3(subClass, superClass);
8356}
8357
8358var inherits = _inherits; // Maps for number <-> hex string conversion
8359
8360var byteToHex$2 = [];
8361
8362for (var i$2 = 0; i$2 < 256; i$2++) {
8363 byteToHex$2[i$2] = (i$2 + 0x100).toString(16).substr(1);
8364}
8365/**
8366 * Represent binary UUID into it's string representation.
8367 *
8368 * @param buf - Buffer containing UUID bytes.
8369 * @param offset - Offset from the start of the buffer where the UUID is saved (not needed if the buffer starts with the UUID).
8370 *
8371 * @returns String representation of the UUID.
8372 */
8373
8374
8375function stringifyUUID$1(buf, offset) {
8376 var i = offset || 0;
8377 var bth = byteToHex$2;
8378 return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]];
8379}
8380/**
8381 * Generate 16 random bytes to be used as a base for UUID.
8382 *
8383 * @ignore
8384 */
8385
8386
8387var random$1 = function () {
8388 if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
8389 // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
8390 // Moderately fast, high quality
8391 var _rnds8 = new Uint8Array(16);
8392
8393 return function whatwgRNG() {
8394 crypto.getRandomValues(_rnds8);
8395 return _rnds8;
8396 };
8397 } // Math.random()-based (RNG)
8398 //
8399 // If all else fails, use Math.random().
8400 // It's fast, but is of unspecified quality.
8401
8402
8403 var _rnds = new Array(16);
8404
8405 return function () {
8406 for (var i = 0, r; i < 16; i++) {
8407 if ((i & 0x03) === 0) {
8408 r = Math.random() * 0x100000000;
8409 }
8410
8411 _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
8412 }
8413
8414 return _rnds;
8415 }; // uuid.js
8416 //
8417 // Copyright (c) 2010-2012 Robert Kieffer
8418 // MIT License - http://opensource.org/licenses/mit-license.php
8419 // Unique ID creation requires a high quality random # generator. We feature
8420 // detect to determine the best RNG source, normalizing to a function that
8421 // returns 128-bits of randomness, since that's what's usually required
8422 // return require('./rng');
8423}();
8424
8425var byteToHex$1$1 = [];
8426
8427for (var i$1$1 = 0; i$1$1 < 256; i$1$1++) {
8428 byteToHex$1$1[i$1$1] = (i$1$1 + 0x100).toString(16).substr(1);
8429} // **`v1()` - Generate time-based UUID**
8430//
8431// Inspired by https://github.com/LiosK/UUID.js
8432// and http://docs.python.org/library/uuid.html
8433// random #'s we need to init node and clockseq
8434
8435
8436var seedBytes$1 = random$1(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
8437
8438var defaultNodeId$1 = [seedBytes$1[0] | 0x01, seedBytes$1[1], seedBytes$1[2], seedBytes$1[3], seedBytes$1[4], seedBytes$1[5]]; // Per 4.2.2, randomize (14 bit) clockseq
8439
8440var defaultClockseq$1 = (seedBytes$1[6] << 8 | seedBytes$1[7]) & 0x3fff; // Previous uuid creation time
8441
8442/**
8443 * UUIDv4 options.
8444 */
8445
8446/**
8447 * Generate UUIDv4
8448 *
8449 * @param options - Options to be used instead of default generated values.
8450 * String 'binary' is a shorthand for uuid4({}, new Array(16)).
8451 * @param buf - If present the buffer will be filled with the generated UUID.
8452 * @param offset - Offset of the UUID from the start of the buffer.
8453 *
8454 * @returns UUIDv4
8455 */
8456
8457function uuid4$1() {
8458 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8459 var buf = arguments.length > 1 ? arguments[1] : undefined;
8460 var offset = arguments.length > 2 ? arguments[2] : undefined; // Deprecated - 'format' argument, as supported in v1.2
8461
8462 var i = buf && offset || 0;
8463
8464 if (typeof options === 'string') {
8465 buf = options === 'binary' ? new Array(16) : undefined;
8466 options = {};
8467 }
8468
8469 var rnds = options.random || (options.rng || random$1)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
8470
8471 rnds[6] = rnds[6] & 0x0f | 0x40;
8472 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
8473
8474 if (buf) {
8475 for (var ii = 0; ii < 16; ii++) {
8476 buf[i + ii] = rnds[ii];
8477 }
8478 }
8479
8480 return buf || stringifyUUID$1(rnds);
8481} // Rollup will complain about mixing default and named exports in UMD build,
8482
8483
8484var commonjsGlobal$1$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8485
8486function commonjsRequire$1() {
8487 throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
8488}
8489
8490function createCommonjsModule$1$1(fn, module) {
8491 return module = {
8492 exports: {}
8493 }, fn(module, module.exports), module.exports;
8494}
8495
8496var check$1$1 = function (it) {
8497 return it && it.Math == Math && it;
8498}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
8499
8500
8501var global_1$1$1 = // eslint-disable-next-line no-undef
8502check$1$1(typeof globalThis == 'object' && globalThis) || check$1$1(typeof window == 'object' && window) || check$1$1(typeof self == 'object' && self) || check$1$1(typeof commonjsGlobal$1$1 == 'object' && commonjsGlobal$1$1) || // eslint-disable-next-line no-new-func
8503Function('return this')();
8504
8505var fails$1$1 = function (exec) {
8506 try {
8507 return !!exec();
8508 } catch (error) {
8509 return true;
8510 }
8511}; // Thank's IE8 for his funny defineProperty
8512
8513
8514var descriptors$1$1 = !fails$1$1(function () {
8515 return Object.defineProperty({}, 'a', {
8516 get: function () {
8517 return 7;
8518 }
8519 }).a != 7;
8520});
8521var nativePropertyIsEnumerable$2$1 = {}.propertyIsEnumerable;
8522var getOwnPropertyDescriptor$4$1 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
8523
8524var NASHORN_BUG$1$1 = getOwnPropertyDescriptor$4$1 && !nativePropertyIsEnumerable$2$1.call({
8525 1: 2
8526}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
8527// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
8528
8529var f$7$1 = NASHORN_BUG$1$1 ? function propertyIsEnumerable(V) {
8530 var descriptor = getOwnPropertyDescriptor$4$1(this, V);
8531 return !!descriptor && descriptor.enumerable;
8532} : nativePropertyIsEnumerable$2$1;
8533var objectPropertyIsEnumerable$1$1 = {
8534 f: f$7$1
8535};
8536
8537var createPropertyDescriptor$1$1 = function (bitmap, value) {
8538 return {
8539 enumerable: !(bitmap & 1),
8540 configurable: !(bitmap & 2),
8541 writable: !(bitmap & 4),
8542 value: value
8543 };
8544};
8545
8546var toString$2$1 = {}.toString;
8547
8548var classofRaw$1$1 = function (it) {
8549 return toString$2$1.call(it).slice(8, -1);
8550};
8551
8552var split$1$1 = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
8553
8554var indexedObject$1$1 = fails$1$1(function () {
8555 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
8556 // eslint-disable-next-line no-prototype-builtins
8557 return !Object('z').propertyIsEnumerable(0);
8558}) ? function (it) {
8559 return classofRaw$1$1(it) == 'String' ? split$1$1.call(it, '') : Object(it);
8560} : Object; // `RequireObjectCoercible` abstract operation
8561// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
8562
8563var requireObjectCoercible$1$1 = function (it) {
8564 if (it == undefined) throw TypeError("Can't call method on " + it);
8565 return it;
8566}; // toObject with fallback for non-array-like ES3 strings
8567
8568
8569var toIndexedObject$1$1 = function (it) {
8570 return indexedObject$1$1(requireObjectCoercible$1$1(it));
8571};
8572
8573var isObject$1$1 = function (it) {
8574 return typeof it === 'object' ? it !== null : typeof it === 'function';
8575}; // `ToPrimitive` abstract operation
8576// https://tc39.github.io/ecma262/#sec-toprimitive
8577// instead of the ES6 spec version, we didn't implement @@toPrimitive case
8578// and the second argument - flag - preferred type is a string
8579
8580
8581var toPrimitive$1$1 = function (input, PREFERRED_STRING) {
8582 if (!isObject$1$1(input)) return input;
8583 var fn, val;
8584 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1$1(val = fn.call(input))) return val;
8585 if (typeof (fn = input.valueOf) == 'function' && !isObject$1$1(val = fn.call(input))) return val;
8586 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1$1(val = fn.call(input))) return val;
8587 throw TypeError("Can't convert object to primitive value");
8588};
8589
8590var hasOwnProperty$1$1 = {}.hasOwnProperty;
8591
8592var has$2$1 = function (it, key) {
8593 return hasOwnProperty$1$1.call(it, key);
8594};
8595
8596var document$1$1 = global_1$1$1.document; // typeof document.createElement is 'object' in old IE
8597
8598var EXISTS$1$1 = isObject$1$1(document$1$1) && isObject$1$1(document$1$1.createElement);
8599
8600var documentCreateElement$1$1 = function (it) {
8601 return EXISTS$1$1 ? document$1$1.createElement(it) : {};
8602}; // Thank's IE8 for his funny defineProperty
8603
8604
8605var ie8DomDefine$1$1 = !descriptors$1$1 && !fails$1$1(function () {
8606 return Object.defineProperty(documentCreateElement$1$1('div'), 'a', {
8607 get: function () {
8608 return 7;
8609 }
8610 }).a != 7;
8611});
8612var nativeGetOwnPropertyDescriptor$3$1 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
8613// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
8614
8615var f$1$1$1 = descriptors$1$1 ? nativeGetOwnPropertyDescriptor$3$1 : function getOwnPropertyDescriptor(O, P) {
8616 O = toIndexedObject$1$1(O);
8617 P = toPrimitive$1$1(P, true);
8618 if (ie8DomDefine$1$1) try {
8619 return nativeGetOwnPropertyDescriptor$3$1(O, P);
8620 } catch (error) {
8621 /* empty */
8622 }
8623 if (has$2$1(O, P)) return createPropertyDescriptor$1$1(!objectPropertyIsEnumerable$1$1.f.call(O, P), O[P]);
8624};
8625var objectGetOwnPropertyDescriptor$1$1 = {
8626 f: f$1$1$1
8627};
8628var replacement$1$1 = /#|\.prototype\./;
8629
8630var isForced$1$1 = function (feature, detection) {
8631 var value = data$1$1[normalize$1$1(feature)];
8632 return value == POLYFILL$1$1 ? true : value == NATIVE$1$1 ? false : typeof detection == 'function' ? fails$1$1(detection) : !!detection;
8633};
8634
8635var normalize$1$1 = isForced$1$1.normalize = function (string) {
8636 return String(string).replace(replacement$1$1, '.').toLowerCase();
8637};
8638
8639var data$1$1 = isForced$1$1.data = {};
8640var NATIVE$1$1 = isForced$1$1.NATIVE = 'N';
8641var POLYFILL$1$1 = isForced$1$1.POLYFILL = 'P';
8642var isForced_1$1$1 = isForced$1$1;
8643var path$1$1 = {};
8644
8645var aFunction$2$1 = function (it) {
8646 if (typeof it != 'function') {
8647 throw TypeError(String(it) + ' is not a function');
8648 }
8649
8650 return it;
8651}; // optional / simple context binding
8652
8653
8654var bindContext$1$1 = function (fn, that, length) {
8655 aFunction$2$1(fn);
8656 if (that === undefined) return fn;
8657
8658 switch (length) {
8659 case 0:
8660 return function () {
8661 return fn.call(that);
8662 };
8663
8664 case 1:
8665 return function (a) {
8666 return fn.call(that, a);
8667 };
8668
8669 case 2:
8670 return function (a, b) {
8671 return fn.call(that, a, b);
8672 };
8673
8674 case 3:
8675 return function (a, b, c) {
8676 return fn.call(that, a, b, c);
8677 };
8678 }
8679
8680 return function ()
8681 /* ...args */
8682 {
8683 return fn.apply(that, arguments);
8684 };
8685};
8686
8687var anObject$1$1 = function (it) {
8688 if (!isObject$1$1(it)) {
8689 throw TypeError(String(it) + ' is not an object');
8690 }
8691
8692 return it;
8693};
8694
8695var nativeDefineProperty$2$1 = Object.defineProperty; // `Object.defineProperty` method
8696// https://tc39.github.io/ecma262/#sec-object.defineproperty
8697
8698var f$2$1$1 = descriptors$1$1 ? nativeDefineProperty$2$1 : function defineProperty(O, P, Attributes) {
8699 anObject$1$1(O);
8700 P = toPrimitive$1$1(P, true);
8701 anObject$1$1(Attributes);
8702 if (ie8DomDefine$1$1) try {
8703 return nativeDefineProperty$2$1(O, P, Attributes);
8704 } catch (error) {
8705 /* empty */
8706 }
8707 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
8708 if ('value' in Attributes) O[P] = Attributes.value;
8709 return O;
8710};
8711var objectDefineProperty$1$1 = {
8712 f: f$2$1$1
8713};
8714var createNonEnumerableProperty$1$1 = descriptors$1$1 ? function (object, key, value) {
8715 return objectDefineProperty$1$1.f(object, key, createPropertyDescriptor$1$1(1, value));
8716} : function (object, key, value) {
8717 object[key] = value;
8718 return object;
8719};
8720var getOwnPropertyDescriptor$1$1$1 = objectGetOwnPropertyDescriptor$1$1.f;
8721
8722var wrapConstructor$1$1 = function (NativeConstructor) {
8723 var Wrapper = function (a, b, c) {
8724 if (this instanceof NativeConstructor) {
8725 switch (arguments.length) {
8726 case 0:
8727 return new NativeConstructor();
8728
8729 case 1:
8730 return new NativeConstructor(a);
8731
8732 case 2:
8733 return new NativeConstructor(a, b);
8734 }
8735
8736 return new NativeConstructor(a, b, c);
8737 }
8738
8739 return NativeConstructor.apply(this, arguments);
8740 };
8741
8742 Wrapper.prototype = NativeConstructor.prototype;
8743 return Wrapper;
8744};
8745/*
8746 options.target - name of the target object
8747 options.global - target is the global object
8748 options.stat - export as static methods of target
8749 options.proto - export as prototype methods of target
8750 options.real - real prototype method for the `pure` version
8751 options.forced - export even if the native feature is available
8752 options.bind - bind methods to the target, required for the `pure` version
8753 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
8754 options.unsafe - use the simple assignment of property instead of delete + defineProperty
8755 options.sham - add a flag to not completely full polyfills
8756 options.enumerable - export as enumerable property
8757 options.noTargetGet - prevent calling a getter on target
8758*/
8759
8760
8761var _export$1$1 = function (options, source) {
8762 var TARGET = options.target;
8763 var GLOBAL = options.global;
8764 var STATIC = options.stat;
8765 var PROTO = options.proto;
8766 var nativeSource = GLOBAL ? global_1$1$1 : STATIC ? global_1$1$1[TARGET] : (global_1$1$1[TARGET] || {}).prototype;
8767 var target = GLOBAL ? path$1$1 : path$1$1[TARGET] || (path$1$1[TARGET] = {});
8768 var targetPrototype = target.prototype;
8769 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
8770 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
8771
8772 for (key in source) {
8773 FORCED = isForced_1$1$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native
8774
8775 USE_NATIVE = !FORCED && nativeSource && has$2$1(nativeSource, key);
8776 targetProperty = target[key];
8777 if (USE_NATIVE) if (options.noTargetGet) {
8778 descriptor = getOwnPropertyDescriptor$1$1$1(nativeSource, key);
8779 nativeProperty = descriptor && descriptor.value;
8780 } else nativeProperty = nativeSource[key]; // export native or implementation
8781
8782 sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
8783 if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue; // bind timers to global for call from export context
8784
8785 if (options.bind && USE_NATIVE) resultProperty = bindContext$1$1(sourceProperty, global_1$1$1); // wrap global constructors for prevent changs in this version
8786 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor$1$1(sourceProperty); // make static versions for prototype methods
8787 else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext$1$1(Function.call, sourceProperty); // default case
8788 else resultProperty = sourceProperty; // add a flag to not completely full polyfills
8789
8790 if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
8791 createNonEnumerableProperty$1$1(resultProperty, 'sham', true);
8792 }
8793
8794 target[key] = resultProperty;
8795
8796 if (PROTO) {
8797 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
8798
8799 if (!has$2$1(path$1$1, VIRTUAL_PROTOTYPE)) {
8800 createNonEnumerableProperty$1$1(path$1$1, VIRTUAL_PROTOTYPE, {});
8801 } // export virtual prototype methods
8802
8803
8804 path$1$1[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods
8805
8806 if (options.real && targetPrototype && !targetPrototype[key]) {
8807 createNonEnumerableProperty$1$1(targetPrototype, key, sourceProperty);
8808 }
8809 }
8810 }
8811}; // `Object.defineProperty` method
8812// https://tc39.github.io/ecma262/#sec-object.defineproperty
8813
8814
8815_export$1$1({
8816 target: 'Object',
8817 stat: true,
8818 forced: !descriptors$1$1,
8819 sham: !descriptors$1$1
8820}, {
8821 defineProperty: objectDefineProperty$1$1.f
8822});
8823
8824var defineProperty_1$1$1 = createCommonjsModule$1$1(function (module) {
8825 var Object = path$1$1.Object;
8826
8827 var defineProperty = module.exports = function defineProperty(it, key, desc) {
8828 return Object.defineProperty(it, key, desc);
8829 };
8830
8831 if (Object.defineProperty.sham) defineProperty.sham = true;
8832});
8833var ceil$1$1 = Math.ceil;
8834var floor$1$1 = Math.floor; // `ToInteger` abstract operation
8835// https://tc39.github.io/ecma262/#sec-tointeger
8836
8837var toInteger$1$1 = function (argument) {
8838 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1$1 : ceil$1$1)(argument);
8839};
8840
8841var min$2$1 = Math.min; // `ToLength` abstract operation
8842// https://tc39.github.io/ecma262/#sec-tolength
8843
8844var toLength$1$1 = function (argument) {
8845 return argument > 0 ? min$2$1(toInteger$1$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
8846};
8847
8848var max$1$1 = Math.max;
8849var min$1$1$1 = Math.min; // Helper for a popular repeating case of the spec:
8850// Let integer be ? ToInteger(index).
8851// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
8852
8853var toAbsoluteIndex$1$1 = function (index, length) {
8854 var integer = toInteger$1$1(index);
8855 return integer < 0 ? max$1$1(integer + length, 0) : min$1$1$1(integer, length);
8856}; // `Array.prototype.{ indexOf, includes }` methods implementation
8857
8858
8859var createMethod$4$1 = function (IS_INCLUDES) {
8860 return function ($this, el, fromIndex) {
8861 var O = toIndexedObject$1$1($this);
8862 var length = toLength$1$1(O.length);
8863 var index = toAbsoluteIndex$1$1(fromIndex, length);
8864 var value; // Array#includes uses SameValueZero equality algorithm
8865 // eslint-disable-next-line no-self-compare
8866
8867 if (IS_INCLUDES && el != el) while (length > index) {
8868 value = O[index++]; // eslint-disable-next-line no-self-compare
8869
8870 if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
8871 } else for (; length > index; index++) {
8872 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
8873 }
8874 return !IS_INCLUDES && -1;
8875 };
8876};
8877
8878var arrayIncludes$1$1 = {
8879 // `Array.prototype.includes` method
8880 // https://tc39.github.io/ecma262/#sec-array.prototype.includes
8881 includes: createMethod$4$1(true),
8882 // `Array.prototype.indexOf` method
8883 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
8884 indexOf: createMethod$4$1(false)
8885};
8886var hiddenKeys$2$1 = {};
8887var indexOf$1$1 = arrayIncludes$1$1.indexOf;
8888
8889var objectKeysInternal$1$1 = function (object, names) {
8890 var O = toIndexedObject$1$1(object);
8891 var i = 0;
8892 var result = [];
8893 var key;
8894
8895 for (key in O) !has$2$1(hiddenKeys$2$1, key) && has$2$1(O, key) && result.push(key); // Don't enum bug & hidden keys
8896
8897
8898 while (names.length > i) if (has$2$1(O, key = names[i++])) {
8899 ~indexOf$1$1(result, key) || result.push(key);
8900 }
8901
8902 return result;
8903}; // IE8- don't enum bug keys
8904
8905
8906var enumBugKeys$1$1 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; // `Object.keys` method
8907// https://tc39.github.io/ecma262/#sec-object.keys
8908
8909var objectKeys$1$1 = Object.keys || function keys(O) {
8910 return objectKeysInternal$1$1(O, enumBugKeys$1$1);
8911}; // `Object.defineProperties` method
8912// https://tc39.github.io/ecma262/#sec-object.defineproperties
8913
8914
8915var objectDefineProperties$1$1 = descriptors$1$1 ? Object.defineProperties : function defineProperties(O, Properties) {
8916 anObject$1$1(O);
8917 var keys = objectKeys$1$1(Properties);
8918 var length = keys.length;
8919 var index = 0;
8920 var key;
8921
8922 while (length > index) objectDefineProperty$1$1.f(O, key = keys[index++], Properties[key]);
8923
8924 return O;
8925}; // `Object.defineProperties` method
8926// https://tc39.github.io/ecma262/#sec-object.defineproperties
8927
8928_export$1$1({
8929 target: 'Object',
8930 stat: true,
8931 forced: !descriptors$1$1,
8932 sham: !descriptors$1$1
8933}, {
8934 defineProperties: objectDefineProperties$1$1
8935});
8936
8937var defineProperties_1$1$1 = createCommonjsModule$1$1(function (module) {
8938 var Object = path$1$1.Object;
8939
8940 var defineProperties = module.exports = function defineProperties(T, D) {
8941 return Object.defineProperties(T, D);
8942 };
8943
8944 if (Object.defineProperties.sham) defineProperties.sham = true;
8945});
8946
8947var aFunction$1$1$1 = function (variable) {
8948 return typeof variable == 'function' ? variable : undefined;
8949};
8950
8951var getBuiltIn$1$1 = function (namespace, method) {
8952 return arguments.length < 2 ? aFunction$1$1$1(path$1$1[namespace]) || aFunction$1$1$1(global_1$1$1[namespace]) : path$1$1[namespace] && path$1$1[namespace][method] || global_1$1$1[namespace] && global_1$1$1[namespace][method];
8953};
8954
8955var hiddenKeys$1$1$1 = enumBugKeys$1$1.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
8956// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
8957
8958var f$3$1$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
8959 return objectKeysInternal$1$1(O, hiddenKeys$1$1$1);
8960};
8961
8962var objectGetOwnPropertyNames$1$1 = {
8963 f: f$3$1$1
8964};
8965var f$4$1$1 = Object.getOwnPropertySymbols;
8966var objectGetOwnPropertySymbols$1$1 = {
8967 f: f$4$1$1
8968}; // all object keys, includes non-enumerable and symbols
8969
8970var ownKeys$1$1 = getBuiltIn$1$1('Reflect', 'ownKeys') || function ownKeys(it) {
8971 var keys = objectGetOwnPropertyNames$1$1.f(anObject$1$1(it));
8972 var getOwnPropertySymbols = objectGetOwnPropertySymbols$1$1.f;
8973 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
8974};
8975
8976var createProperty$1$1 = function (object, key, value) {
8977 var propertyKey = toPrimitive$1$1(key);
8978 if (propertyKey in object) objectDefineProperty$1$1.f(object, propertyKey, createPropertyDescriptor$1$1(0, value));else object[propertyKey] = value;
8979}; // `Object.getOwnPropertyDescriptors` method
8980// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
8981
8982
8983_export$1$1({
8984 target: 'Object',
8985 stat: true,
8986 sham: !descriptors$1$1
8987}, {
8988 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
8989 var O = toIndexedObject$1$1(object);
8990 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor$1$1.f;
8991 var keys = ownKeys$1$1(O);
8992 var result = {};
8993 var index = 0;
8994 var key, descriptor;
8995
8996 while (keys.length > index) {
8997 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
8998 if (descriptor !== undefined) createProperty$1$1(result, key, descriptor);
8999 }
9000
9001 return result;
9002 }
9003});
9004
9005var getOwnPropertyDescriptors$3$1 = path$1$1.Object.getOwnPropertyDescriptors;
9006var nativeGetOwnPropertyDescriptor$1$1$1 = objectGetOwnPropertyDescriptor$1$1.f;
9007var FAILS_ON_PRIMITIVES$3$1 = fails$1$1(function () {
9008 nativeGetOwnPropertyDescriptor$1$1$1(1);
9009});
9010var FORCED$4 = !descriptors$1$1 || FAILS_ON_PRIMITIVES$3$1; // `Object.getOwnPropertyDescriptor` method
9011// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
9012
9013_export$1$1({
9014 target: 'Object',
9015 stat: true,
9016 forced: FORCED$4,
9017 sham: !descriptors$1$1
9018}, {
9019 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
9020 return nativeGetOwnPropertyDescriptor$1$1$1(toIndexedObject$1$1(it), key);
9021 }
9022});
9023
9024var getOwnPropertyDescriptor_1$1$1 = createCommonjsModule$1$1(function (module) {
9025 var Object = path$1$1.Object;
9026
9027 var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
9028 return Object.getOwnPropertyDescriptor(it, key);
9029 };
9030
9031 if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
9032});
9033var nativeSymbol$1$1 = !!Object.getOwnPropertySymbols && !fails$1$1(function () {
9034 // Chrome 38 Symbol has incorrect toString conversion
9035 // eslint-disable-next-line no-undef
9036 return !String(Symbol());
9037}); // `IsArray` abstract operation
9038// https://tc39.github.io/ecma262/#sec-isarray
9039
9040var isArray$6$1 = Array.isArray || function isArray(arg) {
9041 return classofRaw$1$1(arg) == 'Array';
9042}; // `ToObject` abstract operation
9043// https://tc39.github.io/ecma262/#sec-toobject
9044
9045
9046var toObject$1$1 = function (argument) {
9047 return Object(requireObjectCoercible$1$1(argument));
9048};
9049
9050var html$1$1 = getBuiltIn$1$1('document', 'documentElement');
9051
9052var setGlobal$1$1 = function (key, value) {
9053 try {
9054 createNonEnumerableProperty$1$1(global_1$1$1, key, value);
9055 } catch (error) {
9056 global_1$1$1[key] = value;
9057 }
9058
9059 return value;
9060};
9061
9062var SHARED$1$1 = '__core-js_shared__';
9063var store$3$1 = global_1$1$1[SHARED$1$1] || setGlobal$1$1(SHARED$1$1, {});
9064var sharedStore$1$1 = store$3$1;
9065var shared$1$1 = createCommonjsModule$1$1(function (module) {
9066 (module.exports = function (key, value) {
9067 return sharedStore$1$1[key] || (sharedStore$1$1[key] = value !== undefined ? value : {});
9068 })('versions', []).push({
9069 version: '3.4.1',
9070 mode: 'pure',
9071 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
9072 });
9073});
9074var id$1$1 = 0;
9075var postfix$1$1 = Math.random();
9076
9077var uid$1$1 = function (key) {
9078 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1$1 + postfix$1$1).toString(36);
9079};
9080
9081var keys$7 = shared$1$1('keys');
9082
9083var sharedKey$1$1 = function (key) {
9084 return keys$7[key] || (keys$7[key] = uid$1$1(key));
9085};
9086
9087var IE_PROTO$2$1 = sharedKey$1$1('IE_PROTO');
9088var PROTOTYPE$2$1 = 'prototype';
9089
9090var Empty$1$1 = function () {
9091 /* empty */
9092}; // Create object with fake `null` prototype: use iframe Object with cleared prototype
9093
9094
9095var createDict$1$1 = function () {
9096 // Thrash, waste and sodomy: IE GC bug
9097 var iframe = documentCreateElement$1$1('iframe');
9098 var length = enumBugKeys$1$1.length;
9099 var lt = '<';
9100 var script = 'script';
9101 var gt = '>';
9102 var js = 'java' + script + ':';
9103 var iframeDocument;
9104 iframe.style.display = 'none';
9105 html$1$1.appendChild(iframe);
9106 iframe.src = String(js);
9107 iframeDocument = iframe.contentWindow.document;
9108 iframeDocument.open();
9109 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
9110 iframeDocument.close();
9111 createDict$1$1 = iframeDocument.F;
9112
9113 while (length--) delete createDict$1$1[PROTOTYPE$2$1][enumBugKeys$1$1[length]];
9114
9115 return createDict$1$1();
9116}; // `Object.create` method
9117// https://tc39.github.io/ecma262/#sec-object.create
9118
9119
9120var objectCreate$1$1 = Object.create || function create(O, Properties) {
9121 var result;
9122
9123 if (O !== null) {
9124 Empty$1$1[PROTOTYPE$2$1] = anObject$1$1(O);
9125 result = new Empty$1$1();
9126 Empty$1$1[PROTOTYPE$2$1] = null; // add "__proto__" for Object.getPrototypeOf polyfill
9127
9128 result[IE_PROTO$2$1] = O;
9129 } else result = createDict$1$1();
9130
9131 return Properties === undefined ? result : objectDefineProperties$1$1(result, Properties);
9132};
9133
9134hiddenKeys$2$1[IE_PROTO$2$1] = true;
9135var nativeGetOwnPropertyNames$2$1 = objectGetOwnPropertyNames$1$1.f;
9136var toString$1$1$1 = {}.toString;
9137var windowNames$1$1 = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
9138
9139var getWindowNames$1$1 = function (it) {
9140 try {
9141 return nativeGetOwnPropertyNames$2$1(it);
9142 } catch (error) {
9143 return windowNames$1$1.slice();
9144 }
9145}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
9146
9147
9148var f$5$1$1 = function getOwnPropertyNames(it) {
9149 return windowNames$1$1 && toString$1$1$1.call(it) == '[object Window]' ? getWindowNames$1$1(it) : nativeGetOwnPropertyNames$2$1(toIndexedObject$1$1(it));
9150};
9151
9152var objectGetOwnPropertyNamesExternal$1$1 = {
9153 f: f$5$1$1
9154};
9155
9156var redefine$1$1 = function (target, key, value, options) {
9157 if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty$1$1(target, key, value);
9158};
9159
9160var Symbol$1$1$1 = global_1$1$1.Symbol;
9161var store$1$1$1 = shared$1$1('wks');
9162
9163var wellKnownSymbol$1$1 = function (name) {
9164 return store$1$1$1[name] || (store$1$1$1[name] = nativeSymbol$1$1 && Symbol$1$1$1[name] || (nativeSymbol$1$1 ? Symbol$1$1$1 : uid$1$1)('Symbol.' + name));
9165};
9166
9167var f$6$1$1 = wellKnownSymbol$1$1;
9168var wrappedWellKnownSymbol$1$1 = {
9169 f: f$6$1$1
9170};
9171var defineProperty$2$1$1 = objectDefineProperty$1$1.f;
9172
9173var defineWellKnownSymbol$1$1 = function (NAME) {
9174 var Symbol = path$1$1.Symbol || (path$1$1.Symbol = {});
9175 if (!has$2$1(Symbol, NAME)) defineProperty$2$1$1(Symbol, NAME, {
9176 value: wrappedWellKnownSymbol$1$1.f(NAME)
9177 });
9178};
9179
9180var TO_STRING_TAG$4$1 = wellKnownSymbol$1$1('toStringTag'); // ES3 wrong here
9181
9182var CORRECT_ARGUMENTS$1$1 = classofRaw$1$1(function () {
9183 return arguments;
9184}()) == 'Arguments'; // fallback for IE11 Script Access Denied error
9185
9186var tryGet$1$1 = function (it, key) {
9187 try {
9188 return it[key];
9189 } catch (error) {
9190 /* empty */
9191 }
9192}; // getting tag from ES6+ `Object.prototype.toString`
9193
9194
9195var classof$1$1 = function (it) {
9196 var O, tag, result;
9197 return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
9198 : typeof (tag = tryGet$1$1(O = Object(it), TO_STRING_TAG$4$1)) == 'string' ? tag // builtinTag case
9199 : CORRECT_ARGUMENTS$1$1 ? classofRaw$1$1(O) // ES3 arguments fallback
9200 : (result = classofRaw$1$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
9201};
9202
9203var TO_STRING_TAG$1$1$1 = wellKnownSymbol$1$1('toStringTag');
9204var test$2 = {};
9205test$2[TO_STRING_TAG$1$1$1] = 'z'; // `Object.prototype.toString` method implementation
9206// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
9207
9208var objectToString$1$1 = String(test$2) !== '[object z]' ? function toString() {
9209 return '[object ' + classof$1$1(this) + ']';
9210} : test$2.toString;
9211var defineProperty$3$1$1 = objectDefineProperty$1$1.f;
9212var TO_STRING_TAG$2$1$1 = wellKnownSymbol$1$1('toStringTag');
9213var METHOD_REQUIRED$1$1 = objectToString$1$1 !== {}.toString;
9214
9215var setToStringTag$1$1 = function (it, TAG, STATIC, SET_METHOD) {
9216 if (it) {
9217 var target = STATIC ? it : it.prototype;
9218
9219 if (!has$2$1(target, TO_STRING_TAG$2$1$1)) {
9220 defineProperty$3$1$1(target, TO_STRING_TAG$2$1$1, {
9221 configurable: true,
9222 value: TAG
9223 });
9224 }
9225
9226 if (SET_METHOD && METHOD_REQUIRED$1$1) {
9227 createNonEnumerableProperty$1$1(target, 'toString', objectToString$1$1);
9228 }
9229 }
9230};
9231
9232var functionToString$1$1 = shared$1$1('native-function-to-string', Function.toString);
9233var WeakMap$2$1 = global_1$1$1.WeakMap;
9234var nativeWeakMap$1$1 = typeof WeakMap$2$1 === 'function' && /native code/.test(functionToString$1$1.call(WeakMap$2$1));
9235var WeakMap$1$1$1 = global_1$1$1.WeakMap;
9236var set$1$1, get$1$1, has$1$1$1;
9237
9238var enforce$1$1 = function (it) {
9239 return has$1$1$1(it) ? get$1$1(it) : set$1$1(it, {});
9240};
9241
9242var getterFor$1$1 = function (TYPE) {
9243 return function (it) {
9244 var state;
9245
9246 if (!isObject$1$1(it) || (state = get$1$1(it)).type !== TYPE) {
9247 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
9248 }
9249
9250 return state;
9251 };
9252};
9253
9254if (nativeWeakMap$1$1) {
9255 var store$2$1$1 = new WeakMap$1$1$1();
9256 var wmget$1$1 = store$2$1$1.get;
9257 var wmhas$1$1 = store$2$1$1.has;
9258 var wmset$1$1 = store$2$1$1.set;
9259
9260 set$1$1 = function (it, metadata) {
9261 wmset$1$1.call(store$2$1$1, it, metadata);
9262 return metadata;
9263 };
9264
9265 get$1$1 = function (it) {
9266 return wmget$1$1.call(store$2$1$1, it) || {};
9267 };
9268
9269 has$1$1$1 = function (it) {
9270 return wmhas$1$1.call(store$2$1$1, it);
9271 };
9272} else {
9273 var STATE$1$1 = sharedKey$1$1('state');
9274 hiddenKeys$2$1[STATE$1$1] = true;
9275
9276 set$1$1 = function (it, metadata) {
9277 createNonEnumerableProperty$1$1(it, STATE$1$1, metadata);
9278 return metadata;
9279 };
9280
9281 get$1$1 = function (it) {
9282 return has$2$1(it, STATE$1$1) ? it[STATE$1$1] : {};
9283 };
9284
9285 has$1$1$1 = function (it) {
9286 return has$2$1(it, STATE$1$1);
9287 };
9288}
9289
9290var internalState$1$1 = {
9291 set: set$1$1,
9292 get: get$1$1,
9293 has: has$1$1$1,
9294 enforce: enforce$1$1,
9295 getterFor: getterFor$1$1
9296};
9297var SPECIES$3$1 = wellKnownSymbol$1$1('species'); // `ArraySpeciesCreate` abstract operation
9298// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
9299
9300var arraySpeciesCreate$1$1 = function (originalArray, length) {
9301 var C;
9302
9303 if (isArray$6$1(originalArray)) {
9304 C = originalArray.constructor; // cross-realm fallback
9305
9306 if (typeof C == 'function' && (C === Array || isArray$6$1(C.prototype))) C = undefined;else if (isObject$1$1(C)) {
9307 C = C[SPECIES$3$1];
9308 if (C === null) C = undefined;
9309 }
9310 }
9311
9312 return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
9313};
9314
9315var push$1$1 = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
9316
9317var createMethod$1$1$1 = function (TYPE) {
9318 var IS_MAP = TYPE == 1;
9319 var IS_FILTER = TYPE == 2;
9320 var IS_SOME = TYPE == 3;
9321 var IS_EVERY = TYPE == 4;
9322 var IS_FIND_INDEX = TYPE == 6;
9323 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
9324 return function ($this, callbackfn, that, specificCreate) {
9325 var O = toObject$1$1($this);
9326 var self = indexedObject$1$1(O);
9327 var boundFunction = bindContext$1$1(callbackfn, that, 3);
9328 var length = toLength$1$1(self.length);
9329 var index = 0;
9330 var create = specificCreate || arraySpeciesCreate$1$1;
9331 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
9332 var value, result;
9333
9334 for (; length > index; index++) if (NO_HOLES || index in self) {
9335 value = self[index];
9336 result = boundFunction(value, index, O);
9337
9338 if (TYPE) {
9339 if (IS_MAP) target[index] = result; // map
9340 else if (result) switch (TYPE) {
9341 case 3:
9342 return true;
9343 // some
9344
9345 case 5:
9346 return value;
9347 // find
9348
9349 case 6:
9350 return index;
9351 // findIndex
9352
9353 case 2:
9354 push$1$1.call(target, value);
9355 // filter
9356 } else if (IS_EVERY) return false; // every
9357 }
9358 }
9359
9360 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
9361 };
9362};
9363
9364var arrayIteration$1$1 = {
9365 // `Array.prototype.forEach` method
9366 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
9367 forEach: createMethod$1$1$1(0),
9368 // `Array.prototype.map` method
9369 // https://tc39.github.io/ecma262/#sec-array.prototype.map
9370 map: createMethod$1$1$1(1),
9371 // `Array.prototype.filter` method
9372 // https://tc39.github.io/ecma262/#sec-array.prototype.filter
9373 filter: createMethod$1$1$1(2),
9374 // `Array.prototype.some` method
9375 // https://tc39.github.io/ecma262/#sec-array.prototype.some
9376 some: createMethod$1$1$1(3),
9377 // `Array.prototype.every` method
9378 // https://tc39.github.io/ecma262/#sec-array.prototype.every
9379 every: createMethod$1$1$1(4),
9380 // `Array.prototype.find` method
9381 // https://tc39.github.io/ecma262/#sec-array.prototype.find
9382 find: createMethod$1$1$1(5),
9383 // `Array.prototype.findIndex` method
9384 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
9385 findIndex: createMethod$1$1$1(6)
9386};
9387var $forEach$2$1 = arrayIteration$1$1.forEach;
9388var HIDDEN$1$1 = sharedKey$1$1('hidden');
9389var SYMBOL$1$1 = 'Symbol';
9390var PROTOTYPE$1$1$1 = 'prototype';
9391var TO_PRIMITIVE$1$1 = wellKnownSymbol$1$1('toPrimitive');
9392var setInternalState$5 = internalState$1$1.set;
9393var getInternalState$3$1 = internalState$1$1.getterFor(SYMBOL$1$1);
9394var ObjectPrototype$2$1 = Object[PROTOTYPE$1$1$1];
9395var $Symbol$1$1 = global_1$1$1.Symbol;
9396var $stringify$2 = getBuiltIn$1$1('JSON', 'stringify');
9397var nativeGetOwnPropertyDescriptor$2$1$1 = objectGetOwnPropertyDescriptor$1$1.f;
9398var nativeDefineProperty$1$1$1 = objectDefineProperty$1$1.f;
9399var nativeGetOwnPropertyNames$1$1$1 = objectGetOwnPropertyNamesExternal$1$1.f;
9400var nativePropertyIsEnumerable$1$1$1 = objectPropertyIsEnumerable$1$1.f;
9401var AllSymbols$1$1 = shared$1$1('symbols');
9402var ObjectPrototypeSymbols$1$1 = shared$1$1('op-symbols');
9403var StringToSymbolRegistry$1$1 = shared$1$1('string-to-symbol-registry');
9404var SymbolToStringRegistry$1$1 = shared$1$1('symbol-to-string-registry');
9405var WellKnownSymbolsStore$1$1 = shared$1$1('wks');
9406var QObject$1$1 = global_1$1$1.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
9407
9408var USE_SETTER$1$1 = !QObject$1$1 || !QObject$1$1[PROTOTYPE$1$1$1] || !QObject$1$1[PROTOTYPE$1$1$1].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
9409
9410var setSymbolDescriptor$1$1 = descriptors$1$1 && fails$1$1(function () {
9411 return objectCreate$1$1(nativeDefineProperty$1$1$1({}, 'a', {
9412 get: function () {
9413 return nativeDefineProperty$1$1$1(this, 'a', {
9414 value: 7
9415 }).a;
9416 }
9417 })).a != 7;
9418}) ? function (O, P, Attributes) {
9419 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2$1$1(ObjectPrototype$2$1, P);
9420 if (ObjectPrototypeDescriptor) delete ObjectPrototype$2$1[P];
9421 nativeDefineProperty$1$1$1(O, P, Attributes);
9422
9423 if (ObjectPrototypeDescriptor && O !== ObjectPrototype$2$1) {
9424 nativeDefineProperty$1$1$1(ObjectPrototype$2$1, P, ObjectPrototypeDescriptor);
9425 }
9426} : nativeDefineProperty$1$1$1;
9427
9428var wrap$1$1 = function (tag, description) {
9429 var symbol = AllSymbols$1$1[tag] = objectCreate$1$1($Symbol$1$1[PROTOTYPE$1$1$1]);
9430 setInternalState$5(symbol, {
9431 type: SYMBOL$1$1,
9432 tag: tag,
9433 description: description
9434 });
9435 if (!descriptors$1$1) symbol.description = description;
9436 return symbol;
9437};
9438
9439var isSymbol$1$1 = nativeSymbol$1$1 && typeof $Symbol$1$1.iterator == 'symbol' ? function (it) {
9440 return typeof it == 'symbol';
9441} : function (it) {
9442 return Object(it) instanceof $Symbol$1$1;
9443};
9444
9445var $defineProperty$1$1 = function defineProperty(O, P, Attributes) {
9446 if (O === ObjectPrototype$2$1) $defineProperty$1$1(ObjectPrototypeSymbols$1$1, P, Attributes);
9447 anObject$1$1(O);
9448 var key = toPrimitive$1$1(P, true);
9449 anObject$1$1(Attributes);
9450
9451 if (has$2$1(AllSymbols$1$1, key)) {
9452 if (!Attributes.enumerable) {
9453 if (!has$2$1(O, HIDDEN$1$1)) nativeDefineProperty$1$1$1(O, HIDDEN$1$1, createPropertyDescriptor$1$1(1, {}));
9454 O[HIDDEN$1$1][key] = true;
9455 } else {
9456 if (has$2$1(O, HIDDEN$1$1) && O[HIDDEN$1$1][key]) O[HIDDEN$1$1][key] = false;
9457 Attributes = objectCreate$1$1(Attributes, {
9458 enumerable: createPropertyDescriptor$1$1(0, false)
9459 });
9460 }
9461
9462 return setSymbolDescriptor$1$1(O, key, Attributes);
9463 }
9464
9465 return nativeDefineProperty$1$1$1(O, key, Attributes);
9466};
9467
9468var $defineProperties$1$1 = function defineProperties(O, Properties) {
9469 anObject$1$1(O);
9470 var properties = toIndexedObject$1$1(Properties);
9471 var keys = objectKeys$1$1(properties).concat($getOwnPropertySymbols$1$1(properties));
9472 $forEach$2$1(keys, function (key) {
9473 if (!descriptors$1$1 || $propertyIsEnumerable$1$1.call(properties, key)) $defineProperty$1$1(O, key, properties[key]);
9474 });
9475 return O;
9476};
9477
9478var $create$1$1 = function create(O, Properties) {
9479 return Properties === undefined ? objectCreate$1$1(O) : $defineProperties$1$1(objectCreate$1$1(O), Properties);
9480};
9481
9482var $propertyIsEnumerable$1$1 = function propertyIsEnumerable(V) {
9483 var P = toPrimitive$1$1(V, true);
9484 var enumerable = nativePropertyIsEnumerable$1$1$1.call(this, P);
9485 if (this === ObjectPrototype$2$1 && has$2$1(AllSymbols$1$1, P) && !has$2$1(ObjectPrototypeSymbols$1$1, P)) return false;
9486 return enumerable || !has$2$1(this, P) || !has$2$1(AllSymbols$1$1, P) || has$2$1(this, HIDDEN$1$1) && this[HIDDEN$1$1][P] ? enumerable : true;
9487};
9488
9489var $getOwnPropertyDescriptor$1$1 = function getOwnPropertyDescriptor(O, P) {
9490 var it = toIndexedObject$1$1(O);
9491 var key = toPrimitive$1$1(P, true);
9492 if (it === ObjectPrototype$2$1 && has$2$1(AllSymbols$1$1, key) && !has$2$1(ObjectPrototypeSymbols$1$1, key)) return;
9493 var descriptor = nativeGetOwnPropertyDescriptor$2$1$1(it, key);
9494
9495 if (descriptor && has$2$1(AllSymbols$1$1, key) && !(has$2$1(it, HIDDEN$1$1) && it[HIDDEN$1$1][key])) {
9496 descriptor.enumerable = true;
9497 }
9498
9499 return descriptor;
9500};
9501
9502var $getOwnPropertyNames$1$1 = function getOwnPropertyNames(O) {
9503 var names = nativeGetOwnPropertyNames$1$1$1(toIndexedObject$1$1(O));
9504 var result = [];
9505 $forEach$2$1(names, function (key) {
9506 if (!has$2$1(AllSymbols$1$1, key) && !has$2$1(hiddenKeys$2$1, key)) result.push(key);
9507 });
9508 return result;
9509};
9510
9511var $getOwnPropertySymbols$1$1 = function getOwnPropertySymbols(O) {
9512 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$2$1;
9513 var names = nativeGetOwnPropertyNames$1$1$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols$1$1 : toIndexedObject$1$1(O));
9514 var result = [];
9515 $forEach$2$1(names, function (key) {
9516 if (has$2$1(AllSymbols$1$1, key) && (!IS_OBJECT_PROTOTYPE || has$2$1(ObjectPrototype$2$1, key))) {
9517 result.push(AllSymbols$1$1[key]);
9518 }
9519 });
9520 return result;
9521}; // `Symbol` constructor
9522// https://tc39.github.io/ecma262/#sec-symbol-constructor
9523
9524
9525if (!nativeSymbol$1$1) {
9526 $Symbol$1$1 = function Symbol() {
9527 if (this instanceof $Symbol$1$1) throw TypeError('Symbol is not a constructor');
9528 var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
9529 var tag = uid$1$1(description);
9530
9531 var setter = function (value) {
9532 if (this === ObjectPrototype$2$1) setter.call(ObjectPrototypeSymbols$1$1, value);
9533 if (has$2$1(this, HIDDEN$1$1) && has$2$1(this[HIDDEN$1$1], tag)) this[HIDDEN$1$1][tag] = false;
9534 setSymbolDescriptor$1$1(this, tag, createPropertyDescriptor$1$1(1, value));
9535 };
9536
9537 if (descriptors$1$1 && USE_SETTER$1$1) setSymbolDescriptor$1$1(ObjectPrototype$2$1, tag, {
9538 configurable: true,
9539 set: setter
9540 });
9541 return wrap$1$1(tag, description);
9542 };
9543
9544 redefine$1$1($Symbol$1$1[PROTOTYPE$1$1$1], 'toString', function toString() {
9545 return getInternalState$3$1(this).tag;
9546 });
9547 objectPropertyIsEnumerable$1$1.f = $propertyIsEnumerable$1$1;
9548 objectDefineProperty$1$1.f = $defineProperty$1$1;
9549 objectGetOwnPropertyDescriptor$1$1.f = $getOwnPropertyDescriptor$1$1;
9550 objectGetOwnPropertyNames$1$1.f = objectGetOwnPropertyNamesExternal$1$1.f = $getOwnPropertyNames$1$1;
9551 objectGetOwnPropertySymbols$1$1.f = $getOwnPropertySymbols$1$1;
9552
9553 if (descriptors$1$1) {
9554 // https://github.com/tc39/proposal-Symbol-description
9555 nativeDefineProperty$1$1$1($Symbol$1$1[PROTOTYPE$1$1$1], 'description', {
9556 configurable: true,
9557 get: function description() {
9558 return getInternalState$3$1(this).description;
9559 }
9560 });
9561 }
9562
9563 wrappedWellKnownSymbol$1$1.f = function (name) {
9564 return wrap$1$1(wellKnownSymbol$1$1(name), name);
9565 };
9566}
9567
9568_export$1$1({
9569 global: true,
9570 wrap: true,
9571 forced: !nativeSymbol$1$1,
9572 sham: !nativeSymbol$1$1
9573}, {
9574 Symbol: $Symbol$1$1
9575});
9576
9577$forEach$2$1(objectKeys$1$1(WellKnownSymbolsStore$1$1), function (name) {
9578 defineWellKnownSymbol$1$1(name);
9579});
9580
9581_export$1$1({
9582 target: SYMBOL$1$1,
9583 stat: true,
9584 forced: !nativeSymbol$1$1
9585}, {
9586 // `Symbol.for` method
9587 // https://tc39.github.io/ecma262/#sec-symbol.for
9588 'for': function (key) {
9589 var string = String(key);
9590 if (has$2$1(StringToSymbolRegistry$1$1, string)) return StringToSymbolRegistry$1$1[string];
9591 var symbol = $Symbol$1$1(string);
9592 StringToSymbolRegistry$1$1[string] = symbol;
9593 SymbolToStringRegistry$1$1[symbol] = string;
9594 return symbol;
9595 },
9596 // `Symbol.keyFor` method
9597 // https://tc39.github.io/ecma262/#sec-symbol.keyfor
9598 keyFor: function keyFor(sym) {
9599 if (!isSymbol$1$1(sym)) throw TypeError(sym + ' is not a symbol');
9600 if (has$2$1(SymbolToStringRegistry$1$1, sym)) return SymbolToStringRegistry$1$1[sym];
9601 },
9602 useSetter: function () {
9603 USE_SETTER$1$1 = true;
9604 },
9605 useSimple: function () {
9606 USE_SETTER$1$1 = false;
9607 }
9608});
9609
9610_export$1$1({
9611 target: 'Object',
9612 stat: true,
9613 forced: !nativeSymbol$1$1,
9614 sham: !descriptors$1$1
9615}, {
9616 // `Object.create` method
9617 // https://tc39.github.io/ecma262/#sec-object.create
9618 create: $create$1$1,
9619 // `Object.defineProperty` method
9620 // https://tc39.github.io/ecma262/#sec-object.defineproperty
9621 defineProperty: $defineProperty$1$1,
9622 // `Object.defineProperties` method
9623 // https://tc39.github.io/ecma262/#sec-object.defineproperties
9624 defineProperties: $defineProperties$1$1,
9625 // `Object.getOwnPropertyDescriptor` method
9626 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
9627 getOwnPropertyDescriptor: $getOwnPropertyDescriptor$1$1
9628});
9629
9630_export$1$1({
9631 target: 'Object',
9632 stat: true,
9633 forced: !nativeSymbol$1$1
9634}, {
9635 // `Object.getOwnPropertyNames` method
9636 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
9637 getOwnPropertyNames: $getOwnPropertyNames$1$1,
9638 // `Object.getOwnPropertySymbols` method
9639 // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
9640 getOwnPropertySymbols: $getOwnPropertySymbols$1$1
9641}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
9642// https://bugs.chromium.org/p/v8/issues/detail?id=3443
9643
9644
9645_export$1$1({
9646 target: 'Object',
9647 stat: true,
9648 forced: fails$1$1(function () {
9649 objectGetOwnPropertySymbols$1$1.f(1);
9650 })
9651}, {
9652 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
9653 return objectGetOwnPropertySymbols$1$1.f(toObject$1$1(it));
9654 }
9655}); // `JSON.stringify` method behavior with symbols
9656// https://tc39.github.io/ecma262/#sec-json.stringify
9657
9658
9659if ($stringify$2) {
9660 var FORCED_JSON_STRINGIFY$1$1 = !nativeSymbol$1$1 || fails$1$1(function () {
9661 var symbol = $Symbol$1$1(); // MS Edge converts symbol values to JSON as {}
9662
9663 return $stringify$2([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
9664 || $stringify$2({
9665 a: symbol
9666 }) != '{}' // V8 throws on boxed symbols
9667 || $stringify$2(Object(symbol)) != '{}';
9668 });
9669
9670 _export$1$1({
9671 target: 'JSON',
9672 stat: true,
9673 forced: FORCED_JSON_STRINGIFY$1$1
9674 }, {
9675 // eslint-disable-next-line no-unused-vars
9676 stringify: function stringify(it, replacer, space) {
9677 var args = [it];
9678 var index = 1;
9679 var $replacer;
9680
9681 while (arguments.length > index) args.push(arguments[index++]);
9682
9683 $replacer = replacer;
9684 if (!isObject$1$1(replacer) && it === undefined || isSymbol$1$1(it)) return; // IE8 returns string on undefined
9685
9686 if (!isArray$6$1(replacer)) replacer = function (key, value) {
9687 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
9688 if (!isSymbol$1$1(value)) return value;
9689 };
9690 args[1] = replacer;
9691 return $stringify$2.apply(null, args);
9692 }
9693 });
9694} // `Symbol.prototype[@@toPrimitive]` method
9695// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
9696
9697
9698if (!$Symbol$1$1[PROTOTYPE$1$1$1][TO_PRIMITIVE$1$1]) {
9699 createNonEnumerableProperty$1$1($Symbol$1$1[PROTOTYPE$1$1$1], TO_PRIMITIVE$1$1, $Symbol$1$1[PROTOTYPE$1$1$1].valueOf);
9700} // `Symbol.prototype[@@toStringTag]` property
9701// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
9702
9703
9704setToStringTag$1$1($Symbol$1$1, SYMBOL$1$1);
9705hiddenKeys$2$1[HIDDEN$1$1] = true;
9706var getOwnPropertySymbols$3$1 = path$1$1.Object.getOwnPropertySymbols;
9707var iterators$1$1 = {};
9708var correctPrototypeGetter$1$1 = !fails$1$1(function () {
9709 function F() {
9710 /* empty */
9711 }
9712
9713 F.prototype.constructor = null;
9714 return Object.getPrototypeOf(new F()) !== F.prototype;
9715});
9716var IE_PROTO$1$1$1 = sharedKey$1$1('IE_PROTO');
9717var ObjectPrototype$1$1$1 = Object.prototype; // `Object.getPrototypeOf` method
9718// https://tc39.github.io/ecma262/#sec-object.getprototypeof
9719
9720var objectGetPrototypeOf$1$1 = correctPrototypeGetter$1$1 ? Object.getPrototypeOf : function (O) {
9721 O = toObject$1$1(O);
9722 if (has$2$1(O, IE_PROTO$1$1$1)) return O[IE_PROTO$1$1$1];
9723
9724 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
9725 return O.constructor.prototype;
9726 }
9727
9728 return O instanceof Object ? ObjectPrototype$1$1$1 : null;
9729};
9730var ITERATOR$6$1 = wellKnownSymbol$1$1('iterator');
9731var BUGGY_SAFARI_ITERATORS$2$1 = false; // `%IteratorPrototype%` object
9732// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
9733
9734var IteratorPrototype$3$1, PrototypeOfArrayIteratorPrototype$1$1, arrayIterator$1$1;
9735
9736if ([].keys) {
9737 arrayIterator$1$1 = [].keys(); // Safari 8 has buggy iterators w/o `next`
9738
9739 if (!('next' in arrayIterator$1$1)) BUGGY_SAFARI_ITERATORS$2$1 = true;else {
9740 PrototypeOfArrayIteratorPrototype$1$1 = objectGetPrototypeOf$1$1(objectGetPrototypeOf$1$1(arrayIterator$1$1));
9741 if (PrototypeOfArrayIteratorPrototype$1$1 !== Object.prototype) IteratorPrototype$3$1 = PrototypeOfArrayIteratorPrototype$1$1;
9742 }
9743}
9744
9745if (IteratorPrototype$3$1 == undefined) IteratorPrototype$3$1 = {};
9746var iteratorsCore$1$1 = {
9747 IteratorPrototype: IteratorPrototype$3$1,
9748 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$2$1
9749};
9750var IteratorPrototype$1$1$1 = iteratorsCore$1$1.IteratorPrototype;
9751
9752var returnThis$2$1 = function () {
9753 return this;
9754};
9755
9756var createIteratorConstructor$1$1 = function (IteratorConstructor, NAME, next) {
9757 var TO_STRING_TAG = NAME + ' Iterator';
9758 IteratorConstructor.prototype = objectCreate$1$1(IteratorPrototype$1$1$1, {
9759 next: createPropertyDescriptor$1$1(1, next)
9760 });
9761 setToStringTag$1$1(IteratorConstructor, TO_STRING_TAG, false, true);
9762 iterators$1$1[TO_STRING_TAG] = returnThis$2$1;
9763 return IteratorConstructor;
9764};
9765
9766var aPossiblePrototype$1$1 = function (it) {
9767 if (!isObject$1$1(it) && it !== null) {
9768 throw TypeError("Can't set " + String(it) + ' as a prototype');
9769 }
9770
9771 return it;
9772}; // `Object.setPrototypeOf` method
9773// https://tc39.github.io/ecma262/#sec-object.setprototypeof
9774// Works with __proto__ only. Old v8 can't work with null proto objects.
9775
9776/* eslint-disable no-proto */
9777
9778
9779var objectSetPrototypeOf$1$1 = Object.setPrototypeOf || ('__proto__' in {} ? function () {
9780 var CORRECT_SETTER = false;
9781 var test = {};
9782 var setter;
9783
9784 try {
9785 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
9786 setter.call(test, []);
9787 CORRECT_SETTER = test instanceof Array;
9788 } catch (error) {
9789 /* empty */
9790 }
9791
9792 return function setPrototypeOf(O, proto) {
9793 anObject$1$1(O);
9794 aPossiblePrototype$1$1(proto);
9795 if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
9796 return O;
9797 };
9798}() : undefined);
9799var IteratorPrototype$2$1$1 = iteratorsCore$1$1.IteratorPrototype;
9800var BUGGY_SAFARI_ITERATORS$1$1$1 = iteratorsCore$1$1.BUGGY_SAFARI_ITERATORS;
9801var ITERATOR$1$1$1 = wellKnownSymbol$1$1('iterator');
9802var KEYS$1$1 = 'keys';
9803var VALUES$1$1 = 'values';
9804var ENTRIES$1$1 = 'entries';
9805
9806var returnThis$1$1$1 = function () {
9807 return this;
9808};
9809
9810var defineIterator$1$1 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
9811 createIteratorConstructor$1$1(IteratorConstructor, NAME, next);
9812
9813 var getIterationMethod = function (KIND) {
9814 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
9815 if (!BUGGY_SAFARI_ITERATORS$1$1$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
9816
9817 switch (KIND) {
9818 case KEYS$1$1:
9819 return function keys() {
9820 return new IteratorConstructor(this, KIND);
9821 };
9822
9823 case VALUES$1$1:
9824 return function values() {
9825 return new IteratorConstructor(this, KIND);
9826 };
9827
9828 case ENTRIES$1$1:
9829 return function entries() {
9830 return new IteratorConstructor(this, KIND);
9831 };
9832 }
9833
9834 return function () {
9835 return new IteratorConstructor(this);
9836 };
9837 };
9838
9839 var TO_STRING_TAG = NAME + ' Iterator';
9840 var INCORRECT_VALUES_NAME = false;
9841 var IterablePrototype = Iterable.prototype;
9842 var nativeIterator = IterablePrototype[ITERATOR$1$1$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
9843 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1$1$1 && nativeIterator || getIterationMethod(DEFAULT);
9844 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
9845 var CurrentIteratorPrototype, methods, KEY; // fix native
9846
9847 if (anyNativeIterator) {
9848 CurrentIteratorPrototype = objectGetPrototypeOf$1$1(anyNativeIterator.call(new Iterable()));
9849
9850 if (IteratorPrototype$2$1$1 !== Object.prototype && CurrentIteratorPrototype.next) {
9851 // Set @@toStringTag to native iterators
9852 setToStringTag$1$1(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
9853 iterators$1$1[TO_STRING_TAG] = returnThis$1$1$1;
9854 }
9855 } // fix Array#{values, @@iterator}.name in V8 / FF
9856
9857
9858 if (DEFAULT == VALUES$1$1 && nativeIterator && nativeIterator.name !== VALUES$1$1) {
9859 INCORRECT_VALUES_NAME = true;
9860
9861 defaultIterator = function values() {
9862 return nativeIterator.call(this);
9863 };
9864 } // define iterator
9865
9866
9867 if (FORCED && IterablePrototype[ITERATOR$1$1$1] !== defaultIterator) {
9868 createNonEnumerableProperty$1$1(IterablePrototype, ITERATOR$1$1$1, defaultIterator);
9869 }
9870
9871 iterators$1$1[NAME] = defaultIterator; // export additional methods
9872
9873 if (DEFAULT) {
9874 methods = {
9875 values: getIterationMethod(VALUES$1$1),
9876 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS$1$1),
9877 entries: getIterationMethod(ENTRIES$1$1)
9878 };
9879 if (FORCED) for (KEY in methods) {
9880 if (BUGGY_SAFARI_ITERATORS$1$1$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
9881 redefine$1$1(IterablePrototype, KEY, methods[KEY]);
9882 }
9883 } else _export$1$1({
9884 target: NAME,
9885 proto: true,
9886 forced: BUGGY_SAFARI_ITERATORS$1$1$1 || INCORRECT_VALUES_NAME
9887 }, methods);
9888 }
9889
9890 return methods;
9891};
9892
9893var ARRAY_ITERATOR$1$1 = 'Array Iterator';
9894var setInternalState$1$1$1 = internalState$1$1.set;
9895var getInternalState$1$1$1 = internalState$1$1.getterFor(ARRAY_ITERATOR$1$1); // `Array.prototype.entries` method
9896// https://tc39.github.io/ecma262/#sec-array.prototype.entries
9897// `Array.prototype.keys` method
9898// https://tc39.github.io/ecma262/#sec-array.prototype.keys
9899// `Array.prototype.values` method
9900// https://tc39.github.io/ecma262/#sec-array.prototype.values
9901// `Array.prototype[@@iterator]` method
9902// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
9903// `CreateArrayIterator` internal method
9904// https://tc39.github.io/ecma262/#sec-createarrayiterator
9905
9906var es_array_iterator$1$1 = defineIterator$1$1(Array, 'Array', function (iterated, kind) {
9907 setInternalState$1$1$1(this, {
9908 type: ARRAY_ITERATOR$1$1,
9909 target: toIndexedObject$1$1(iterated),
9910 // target
9911 index: 0,
9912 // next index
9913 kind: kind // kind
9914
9915 }); // `%ArrayIteratorPrototype%.next` method
9916 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
9917}, function () {
9918 var state = getInternalState$1$1$1(this);
9919 var target = state.target;
9920 var kind = state.kind;
9921 var index = state.index++;
9922
9923 if (!target || index >= target.length) {
9924 state.target = undefined;
9925 return {
9926 value: undefined,
9927 done: true
9928 };
9929 }
9930
9931 if (kind == 'keys') return {
9932 value: index,
9933 done: false
9934 };
9935 if (kind == 'values') return {
9936 value: target[index],
9937 done: false
9938 };
9939 return {
9940 value: [index, target[index]],
9941 done: false
9942 };
9943}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
9944// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
9945// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
9946
9947iterators$1$1.Arguments = iterators$1$1.Array; // iterable DOM collections
9948// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
9949
9950var domIterables$1$1 = {
9951 CSSRuleList: 0,
9952 CSSStyleDeclaration: 0,
9953 CSSValueList: 0,
9954 ClientRectList: 0,
9955 DOMRectList: 0,
9956 DOMStringList: 0,
9957 DOMTokenList: 1,
9958 DataTransferItemList: 0,
9959 FileList: 0,
9960 HTMLAllCollection: 0,
9961 HTMLCollection: 0,
9962 HTMLFormElement: 0,
9963 HTMLSelectElement: 0,
9964 MediaList: 0,
9965 MimeTypeArray: 0,
9966 NamedNodeMap: 0,
9967 NodeList: 1,
9968 PaintRequestList: 0,
9969 Plugin: 0,
9970 PluginArray: 0,
9971 SVGLengthList: 0,
9972 SVGNumberList: 0,
9973 SVGPathSegList: 0,
9974 SVGPointList: 0,
9975 SVGStringList: 0,
9976 SVGTransformList: 0,
9977 SourceBufferList: 0,
9978 StyleSheetList: 0,
9979 TextTrackCueList: 0,
9980 TextTrackList: 0,
9981 TouchList: 0
9982};
9983var TO_STRING_TAG$3$1$1 = wellKnownSymbol$1$1('toStringTag');
9984
9985for (var COLLECTION_NAME$1$1 in domIterables$1$1) {
9986 var Collection$1$1 = global_1$1$1[COLLECTION_NAME$1$1];
9987 var CollectionPrototype$1$1 = Collection$1$1 && Collection$1$1.prototype;
9988
9989 if (CollectionPrototype$1$1 && !CollectionPrototype$1$1[TO_STRING_TAG$3$1$1]) {
9990 createNonEnumerableProperty$1$1(CollectionPrototype$1$1, TO_STRING_TAG$3$1$1, COLLECTION_NAME$1$1);
9991 }
9992
9993 iterators$1$1[COLLECTION_NAME$1$1] = iterators$1$1.Array;
9994} // `String.prototype.{ codePointAt, at }` methods implementation
9995
9996
9997var createMethod$2$1$1 = function (CONVERT_TO_STRING) {
9998 return function ($this, pos) {
9999 var S = String(requireObjectCoercible$1$1($this));
10000 var position = toInteger$1$1(pos);
10001 var size = S.length;
10002 var first, second;
10003 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10004 first = S.charCodeAt(position);
10005 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;
10006 };
10007};
10008
10009var stringMultibyte$1$1 = {
10010 // `String.prototype.codePointAt` method
10011 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
10012 codeAt: createMethod$2$1$1(false),
10013 // `String.prototype.at` method
10014 // https://github.com/mathiasbynens/String.prototype.at
10015 charAt: createMethod$2$1$1(true)
10016};
10017var charAt$1$1 = stringMultibyte$1$1.charAt;
10018var STRING_ITERATOR$1$1 = 'String Iterator';
10019var setInternalState$2$1$1 = internalState$1$1.set;
10020var getInternalState$2$1$1 = internalState$1$1.getterFor(STRING_ITERATOR$1$1); // `String.prototype[@@iterator]` method
10021// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
10022
10023defineIterator$1$1(String, 'String', function (iterated) {
10024 setInternalState$2$1$1(this, {
10025 type: STRING_ITERATOR$1$1,
10026 string: String(iterated),
10027 index: 0
10028 }); // `%StringIteratorPrototype%.next` method
10029 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
10030}, function next() {
10031 var state = getInternalState$2$1$1(this);
10032 var string = state.string;
10033 var index = state.index;
10034 var point;
10035 if (index >= string.length) return {
10036 value: undefined,
10037 done: true
10038 };
10039 point = charAt$1$1(string, index);
10040 state.index += point.length;
10041 return {
10042 value: point,
10043 done: false
10044 };
10045});
10046var ITERATOR$2$1$1 = wellKnownSymbol$1$1('iterator');
10047
10048var getIteratorMethod$1$1 = function (it) {
10049 if (it != undefined) return it[ITERATOR$2$1$1] || it['@@iterator'] || iterators$1$1[classof$1$1(it)];
10050}; // https://tc39.github.io/ecma262/#sec-object.create
10051
10052
10053_export$1$1({
10054 target: 'Object',
10055 stat: true,
10056 sham: !descriptors$1$1
10057}, {
10058 create: objectCreate$1$1
10059});
10060
10061var FAILS_ON_PRIMITIVES$1$1$1 = fails$1$1(function () {
10062 objectKeys$1$1(1);
10063}); // `Object.keys` method
10064// https://tc39.github.io/ecma262/#sec-object.keys
10065
10066_export$1$1({
10067 target: 'Object',
10068 stat: true,
10069 forced: FAILS_ON_PRIMITIVES$1$1$1
10070}, {
10071 keys: function keys(it) {
10072 return objectKeys$1$1(toObject$1$1(it));
10073 }
10074});
10075
10076var keys$1$1$1 = path$1$1.Object.keys;
10077var keys$2$1$1 = keys$1$1$1;
10078var keys$3$1$1 = keys$2$1$1; // a string of all valid unicode whitespaces
10079// eslint-disable-next-line max-len
10080
10081var whitespaces$1 = '\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';
10082var whitespace$1 = '[' + whitespaces$1 + ']';
10083var ltrim$1 = RegExp('^' + whitespace$1 + whitespace$1 + '*');
10084var rtrim$1 = RegExp(whitespace$1 + whitespace$1 + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
10085
10086var createMethod$3$1$1 = function (TYPE) {
10087 return function ($this) {
10088 var string = String(requireObjectCoercible$1$1($this));
10089 if (TYPE & 1) string = string.replace(ltrim$1, '');
10090 if (TYPE & 2) string = string.replace(rtrim$1, '');
10091 return string;
10092 };
10093};
10094
10095var stringTrim$1 = {
10096 // `String.prototype.{ trimLeft, trimStart }` methods
10097 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
10098 start: createMethod$3$1$1(1),
10099 // `String.prototype.{ trimRight, trimEnd }` methods
10100 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
10101 end: createMethod$3$1$1(2),
10102 // `String.prototype.trim` method
10103 // https://tc39.github.io/ecma262/#sec-string.prototype.trim
10104 trim: createMethod$3$1$1(3)
10105};
10106var non$1 = '\u200B\u0085\u180E'; // check that a method works with the correct list
10107// of whitespaces and has a correct name
10108
10109var forcedStringTrimMethod$1 = function (METHOD_NAME) {
10110 return fails$1$1(function () {
10111 return !!whitespaces$1[METHOD_NAME]() || non$1[METHOD_NAME]() != non$1 || whitespaces$1[METHOD_NAME].name !== METHOD_NAME;
10112 });
10113};
10114
10115var $trim$1 = stringTrim$1.trim; // `String.prototype.trim` method
10116// https://tc39.github.io/ecma262/#sec-string.prototype.trim
10117
10118_export$1$1({
10119 target: 'String',
10120 proto: true,
10121 forced: forcedStringTrimMethod$1('trim')
10122}, {
10123 trim: function trim() {
10124 return $trim$1(this);
10125 }
10126});
10127
10128var entryVirtual$1$1 = function (CONSTRUCTOR) {
10129 return path$1$1[CONSTRUCTOR + 'Prototype'];
10130};
10131
10132var trim$4 = entryVirtual$1$1('String').trim;
10133
10134var sloppyArrayMethod$1$1 = function (METHOD_NAME, argument) {
10135 var method = [][METHOD_NAME];
10136 return !method || !fails$1$1(function () {
10137 // eslint-disable-next-line no-useless-call,no-throw-literal
10138 method.call(null, argument || function () {
10139 throw 1;
10140 }, 1);
10141 });
10142};
10143
10144var $forEach$1$1$1 = arrayIteration$1$1.forEach; // `Array.prototype.forEach` method implementation
10145// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
10146
10147var arrayForEach$1$1 = sloppyArrayMethod$1$1('forEach') ? function forEach(callbackfn
10148/* , thisArg */
10149) {
10150 return $forEach$1$1$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
10151} : [].forEach; // `Array.prototype.forEach` method
10152// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
10153
10154_export$1$1({
10155 target: 'Array',
10156 proto: true,
10157 forced: [].forEach != arrayForEach$1$1
10158}, {
10159 forEach: arrayForEach$1$1
10160});
10161
10162var forEach$4$1 = entryVirtual$1$1('Array').forEach;
10163var forEach$1$1$1 = forEach$4$1;
10164var ArrayPrototype$b = Array.prototype;
10165var DOMIterables$4 = {
10166 DOMTokenList: true,
10167 NodeList: true
10168};
10169
10170var forEach_1$1$1 = function (it) {
10171 var own = it.forEach;
10172 return it === ArrayPrototype$b || it instanceof Array && own === ArrayPrototype$b.forEach // eslint-disable-next-line no-prototype-builtins
10173 || DOMIterables$4.hasOwnProperty(classof$1$1(it)) ? forEach$1$1$1 : own;
10174};
10175
10176var forEach$2$1$1 = forEach_1$1$1;
10177var userAgent$1$1 = getBuiltIn$1$1('navigator', 'userAgent') || '';
10178var process$1$1 = global_1$1$1.process;
10179var versions$1$1 = process$1$1 && process$1$1.versions;
10180var v8$1$1 = versions$1$1 && versions$1$1.v8;
10181var match$1$1, version$1$1;
10182
10183if (v8$1$1) {
10184 match$1$1 = v8$1$1.split('.');
10185 version$1$1 = match$1$1[0] + match$1$1[1];
10186} else if (userAgent$1$1) {
10187 match$1$1 = userAgent$1$1.match(/Edge\/(\d+)/);
10188
10189 if (!match$1$1 || match$1$1[1] >= 74) {
10190 match$1$1 = userAgent$1$1.match(/Chrome\/(\d+)/);
10191 if (match$1$1) version$1$1 = match$1$1[1];
10192 }
10193}
10194
10195var v8Version$1$1 = version$1$1 && +version$1$1;
10196var SPECIES$1$1$1 = wellKnownSymbol$1$1('species');
10197
10198var arrayMethodHasSpeciesSupport$1$1 = function (METHOD_NAME) {
10199 // We can't use this feature detection in V8 since it causes
10200 // deoptimization and serious performance degradation
10201 // https://github.com/zloirock/core-js/issues/677
10202 return v8Version$1$1 >= 51 || !fails$1$1(function () {
10203 var array = [];
10204 var constructor = array.constructor = {};
10205
10206 constructor[SPECIES$1$1$1] = function () {
10207 return {
10208 foo: 1
10209 };
10210 };
10211
10212 return array[METHOD_NAME](Boolean).foo !== 1;
10213 });
10214};
10215
10216var $map$1$1 = arrayIteration$1$1.map; // `Array.prototype.map` method
10217// https://tc39.github.io/ecma262/#sec-array.prototype.map
10218// with adding support of @@species
10219
10220_export$1$1({
10221 target: 'Array',
10222 proto: true,
10223 forced: !arrayMethodHasSpeciesSupport$1$1('map')
10224}, {
10225 map: function map(callbackfn
10226 /* , thisArg */
10227 ) {
10228 return $map$1$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
10229 }
10230});
10231
10232var map$6 = entryVirtual$1$1('Array').map;
10233var trim$3$1 = stringTrim$1.trim;
10234var nativeParseInt$1 = global_1$1$1.parseInt;
10235var hex$1 = /^[+-]?0[Xx]/;
10236var FORCED$1$1$1 = nativeParseInt$1(whitespaces$1 + '08') !== 8 || nativeParseInt$1(whitespaces$1 + '0x16') !== 22; // `parseInt` method
10237// https://tc39.github.io/ecma262/#sec-parseint-string-radix
10238
10239var _parseInt$4 = FORCED$1$1$1 ? function parseInt(string, radix) {
10240 var S = trim$3$1(String(string));
10241 return nativeParseInt$1(S, radix >>> 0 || (hex$1.test(S) ? 16 : 10));
10242} : nativeParseInt$1; // `parseInt` method
10243// https://tc39.github.io/ecma262/#sec-parseint-string-radix
10244
10245
10246_export$1$1({
10247 global: true,
10248 forced: parseInt != _parseInt$4
10249}, {
10250 parseInt: _parseInt$4
10251});
10252
10253var _parseInt$1$1 = path$1$1.parseInt;
10254var _parseInt$2$1 = _parseInt$1$1;
10255var _parseInt$3$1 = _parseInt$2$1;
10256var propertyIsEnumerable$1 = objectPropertyIsEnumerable$1$1.f; // `Object.{ entries, values }` methods implementation
10257
10258var createMethod$4$1$1 = function (TO_ENTRIES) {
10259 return function (it) {
10260 var O = toIndexedObject$1$1(it);
10261 var keys = objectKeys$1$1(O);
10262 var length = keys.length;
10263 var i = 0;
10264 var result = [];
10265 var key;
10266
10267 while (length > i) {
10268 key = keys[i++];
10269
10270 if (!descriptors$1$1 || propertyIsEnumerable$1.call(O, key)) {
10271 result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
10272 }
10273 }
10274
10275 return result;
10276 };
10277};
10278
10279var objectToArray$1 = {
10280 // `Object.entries` method
10281 // https://tc39.github.io/ecma262/#sec-object.entries
10282 entries: createMethod$4$1$1(true),
10283 // `Object.values` method
10284 // https://tc39.github.io/ecma262/#sec-object.values
10285 values: createMethod$4$1$1(false)
10286};
10287var $values$1 = objectToArray$1.values; // `Object.values` method
10288// https://tc39.github.io/ecma262/#sec-object.values
10289
10290_export$1$1({
10291 target: 'Object',
10292 stat: true
10293}, {
10294 values: function values(O) {
10295 return $values$1(O);
10296 }
10297});
10298
10299var values$3$1 = path$1$1.Object.values;
10300var $filter$1$1 = arrayIteration$1$1.filter; // `Array.prototype.filter` method
10301// https://tc39.github.io/ecma262/#sec-array.prototype.filter
10302// with adding support of @@species
10303
10304_export$1$1({
10305 target: 'Array',
10306 proto: true,
10307 forced: !arrayMethodHasSpeciesSupport$1$1('filter')
10308}, {
10309 filter: function filter(callbackfn
10310 /* , thisArg */
10311 ) {
10312 return $filter$1$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
10313 }
10314});
10315
10316var filter$3$1 = entryVirtual$1$1('Array').filter;
10317var IS_CONCAT_SPREADABLE$1$1 = wellKnownSymbol$1$1('isConcatSpreadable');
10318var MAX_SAFE_INTEGER$1$1 = 0x1FFFFFFFFFFFFF;
10319var MAXIMUM_ALLOWED_INDEX_EXCEEDED$1$1 = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
10320// deoptimization and serious performance degradation
10321// https://github.com/zloirock/core-js/issues/679
10322
10323var IS_CONCAT_SPREADABLE_SUPPORT$1$1 = v8Version$1$1 >= 51 || !fails$1$1(function () {
10324 var array = [];
10325 array[IS_CONCAT_SPREADABLE$1$1] = false;
10326 return array.concat()[0] !== array;
10327});
10328var SPECIES_SUPPORT$1$1 = arrayMethodHasSpeciesSupport$1$1('concat');
10329
10330var isConcatSpreadable$1$1 = function (O) {
10331 if (!isObject$1$1(O)) return false;
10332 var spreadable = O[IS_CONCAT_SPREADABLE$1$1];
10333 return spreadable !== undefined ? !!spreadable : isArray$6$1(O);
10334};
10335
10336var FORCED$2$1$1 = !IS_CONCAT_SPREADABLE_SUPPORT$1$1 || !SPECIES_SUPPORT$1$1; // `Array.prototype.concat` method
10337// https://tc39.github.io/ecma262/#sec-array.prototype.concat
10338// with adding support of @@isConcatSpreadable and @@species
10339
10340_export$1$1({
10341 target: 'Array',
10342 proto: true,
10343 forced: FORCED$2$1$1
10344}, {
10345 concat: function concat(arg) {
10346 // eslint-disable-line no-unused-vars
10347 var O = toObject$1$1(this);
10348 var A = arraySpeciesCreate$1$1(O, 0);
10349 var n = 0;
10350 var i, k, length, len, E;
10351
10352 for (i = -1, length = arguments.length; i < length; i++) {
10353 E = i === -1 ? O : arguments[i];
10354
10355 if (isConcatSpreadable$1$1(E)) {
10356 len = toLength$1$1(E.length);
10357 if (n + len > MAX_SAFE_INTEGER$1$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1$1);
10358
10359 for (k = 0; k < len; k++, n++) if (k in E) createProperty$1$1(A, n, E[k]);
10360 } else {
10361 if (n >= MAX_SAFE_INTEGER$1$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1$1);
10362 createProperty$1$1(A, n++, E);
10363 }
10364 }
10365
10366 A.length = n;
10367 return A;
10368 }
10369});
10370
10371var concat$3$1 = entryVirtual$1$1('Array').concat;
10372var ArrayPrototype$3$1$1 = Array.prototype;
10373
10374var concat_1$1$1 = function (it) {
10375 var own = it.concat;
10376 return it === ArrayPrototype$3$1$1 || it instanceof Array && own === ArrayPrototype$3$1$1.concat ? concat$3$1 : own;
10377};
10378
10379var concat$1$1$1 = concat_1$1$1;
10380var concat$2$1$1 = concat$1$1$1; // `Array.isArray` method
10381// https://tc39.github.io/ecma262/#sec-array.isarray
10382
10383_export$1$1({
10384 target: 'Array',
10385 stat: true
10386}, {
10387 isArray: isArray$6$1
10388});
10389
10390var isArray$1$1$1 = path$1$1.Array.isArray;
10391
10392var callWithSafeIterationClosing$1$1 = function (iterator, fn, value, ENTRIES) {
10393 try {
10394 return ENTRIES ? fn(anObject$1$1(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
10395 } catch (error) {
10396 var returnMethod = iterator['return'];
10397 if (returnMethod !== undefined) anObject$1$1(returnMethod.call(iterator));
10398 throw error;
10399 }
10400};
10401
10402var ITERATOR$3$1$1 = wellKnownSymbol$1$1('iterator');
10403var ArrayPrototype$4$1$1 = Array.prototype; // check on default Array iterator
10404
10405var isArrayIteratorMethod$1$1 = function (it) {
10406 return it !== undefined && (iterators$1$1.Array === it || ArrayPrototype$4$1$1[ITERATOR$3$1$1] === it);
10407}; // `Array.from` method implementation
10408// https://tc39.github.io/ecma262/#sec-array.from
10409
10410
10411var arrayFrom$1$1 = function from(arrayLike
10412/* , mapfn = undefined, thisArg = undefined */
10413) {
10414 var O = toObject$1$1(arrayLike);
10415 var C = typeof this == 'function' ? this : Array;
10416 var argumentsLength = arguments.length;
10417 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
10418 var mapping = mapfn !== undefined;
10419 var index = 0;
10420 var iteratorMethod = getIteratorMethod$1$1(O);
10421 var length, result, step, iterator, next;
10422 if (mapping) mapfn = bindContext$1$1(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
10423
10424 if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod$1$1(iteratorMethod))) {
10425 iterator = iteratorMethod.call(O);
10426 next = iterator.next;
10427 result = new C();
10428
10429 for (; !(step = next.call(iterator)).done; index++) {
10430 createProperty$1$1(result, index, mapping ? callWithSafeIterationClosing$1$1(iterator, mapfn, [step.value, index], true) : step.value);
10431 }
10432 } else {
10433 length = toLength$1$1(O.length);
10434 result = new C(length);
10435
10436 for (; length > index; index++) {
10437 createProperty$1$1(result, index, mapping ? mapfn(O[index], index) : O[index]);
10438 }
10439 }
10440
10441 result.length = index;
10442 return result;
10443};
10444
10445var ITERATOR$4$1$1 = wellKnownSymbol$1$1('iterator');
10446var SAFE_CLOSING$1$1 = false;
10447
10448try {
10449 var called$1$1 = 0;
10450 var iteratorWithReturn$1$1 = {
10451 next: function () {
10452 return {
10453 done: !!called$1$1++
10454 };
10455 },
10456 'return': function () {
10457 SAFE_CLOSING$1$1 = true;
10458 }
10459 };
10460
10461 iteratorWithReturn$1$1[ITERATOR$4$1$1] = function () {
10462 return this;
10463 }; // eslint-disable-next-line no-throw-literal
10464
10465
10466 Array.from(iteratorWithReturn$1$1, function () {
10467 throw 2;
10468 });
10469} catch (error) {
10470 /* empty */
10471}
10472
10473var checkCorrectnessOfIteration$1$1 = function (exec, SKIP_CLOSING) {
10474 if (!SKIP_CLOSING && !SAFE_CLOSING$1$1) return false;
10475 var ITERATION_SUPPORT = false;
10476
10477 try {
10478 var object = {};
10479
10480 object[ITERATOR$4$1$1] = function () {
10481 return {
10482 next: function () {
10483 return {
10484 done: ITERATION_SUPPORT = true
10485 };
10486 }
10487 };
10488 };
10489
10490 exec(object);
10491 } catch (error) {
10492 /* empty */
10493 }
10494
10495 return ITERATION_SUPPORT;
10496};
10497
10498var INCORRECT_ITERATION$1$1 = !checkCorrectnessOfIteration$1$1(function (iterable) {
10499 Array.from(iterable);
10500}); // `Array.from` method
10501// https://tc39.github.io/ecma262/#sec-array.from
10502
10503_export$1$1({
10504 target: 'Array',
10505 stat: true,
10506 forced: INCORRECT_ITERATION$1$1
10507}, {
10508 from: arrayFrom$1$1
10509});
10510
10511var from_1$3$1 = path$1$1.Array.from;
10512var ITERATOR$5$1$1 = wellKnownSymbol$1$1('iterator');
10513var SPECIES$2$1$1 = wellKnownSymbol$1$1('species');
10514var nativeSlice$1 = [].slice;
10515var max$1$1$1 = Math.max; // `Array.prototype.slice` method
10516// https://tc39.github.io/ecma262/#sec-array.prototype.slice
10517// fallback for not array-like ES3 strings and DOM objects
10518
10519_export$1$1({
10520 target: 'Array',
10521 proto: true,
10522 forced: !arrayMethodHasSpeciesSupport$1$1('slice')
10523}, {
10524 slice: function slice(start, end) {
10525 var O = toIndexedObject$1$1(this);
10526 var length = toLength$1$1(O.length);
10527 var k = toAbsoluteIndex$1$1(start, length);
10528 var fin = toAbsoluteIndex$1$1(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
10529
10530 var Constructor, result, n;
10531
10532 if (isArray$6$1(O)) {
10533 Constructor = O.constructor; // cross-realm fallback
10534
10535 if (typeof Constructor == 'function' && (Constructor === Array || isArray$6$1(Constructor.prototype))) {
10536 Constructor = undefined;
10537 } else if (isObject$1$1(Constructor)) {
10538 Constructor = Constructor[SPECIES$2$1$1];
10539 if (Constructor === null) Constructor = undefined;
10540 }
10541
10542 if (Constructor === Array || Constructor === undefined) {
10543 return nativeSlice$1.call(O, k, fin);
10544 }
10545 }
10546
10547 result = new (Constructor === undefined ? Array : Constructor)(max$1$1$1(fin - k, 0));
10548
10549 for (n = 0; k < fin; k++, n++) if (k in O) createProperty$1$1(result, n, O[k]);
10550
10551 result.length = n;
10552 return result;
10553 }
10554});
10555
10556var slice$1$1 = entryVirtual$1$1('Array').slice;
10557var ArrayPrototype$5$1$1 = Array.prototype;
10558
10559var slice_1$1 = function (it) {
10560 var own = it.slice;
10561 return it === ArrayPrototype$5$1$1 || it instanceof Array && own === ArrayPrototype$5$1$1.slice ? slice$1$1 : own;
10562};
10563
10564var slice$1$1$1 = slice_1$1;
10565var slice$2$1 = slice$1$1$1;
10566var FAILS_ON_PRIMITIVES$2$1$1 = fails$1$1(function () {
10567 objectGetPrototypeOf$1$1(1);
10568}); // `Object.getPrototypeOf` method
10569// https://tc39.github.io/ecma262/#sec-object.getprototypeof
10570
10571_export$1$1({
10572 target: 'Object',
10573 stat: true,
10574 forced: FAILS_ON_PRIMITIVES$2$1$1,
10575 sham: !correctPrototypeGetter$1$1
10576}, {
10577 getPrototypeOf: function getPrototypeOf(it) {
10578 return objectGetPrototypeOf$1$1(toObject$1$1(it));
10579 }
10580});
10581
10582var getPrototypeOf$4 = path$1$1.Object.getPrototypeOf;
10583var getPrototypeOf$1$1$1 = getPrototypeOf$4;
10584var getPrototypeOf$2$1$1 = getPrototypeOf$1$1$1;
10585var $indexOf$1 = arrayIncludes$1$1.indexOf;
10586var nativeIndexOf$1 = [].indexOf;
10587var NEGATIVE_ZERO$1 = !!nativeIndexOf$1 && 1 / [1].indexOf(1, -0) < 0;
10588var SLOPPY_METHOD$1$1 = sloppyArrayMethod$1$1('indexOf'); // `Array.prototype.indexOf` method
10589// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
10590
10591_export$1$1({
10592 target: 'Array',
10593 proto: true,
10594 forced: NEGATIVE_ZERO$1 || SLOPPY_METHOD$1$1
10595}, {
10596 indexOf: function indexOf(searchElement
10597 /* , fromIndex = 0 */
10598 ) {
10599 return NEGATIVE_ZERO$1 // convert -0 to +0
10600 ? nativeIndexOf$1.apply(this, arguments) || 0 : $indexOf$1(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
10601 }
10602});
10603
10604var indexOf$1$1$1 = entryVirtual$1$1('Array').indexOf;
10605var ArrayPrototype$6$1$1 = Array.prototype;
10606
10607var indexOf_1$1 = function (it) {
10608 var own = it.indexOf;
10609 return it === ArrayPrototype$6$1$1 || it instanceof Array && own === ArrayPrototype$6$1$1.indexOf ? indexOf$1$1$1 : own;
10610};
10611
10612var indexOf$2$1 = indexOf_1$1;
10613var indexOf$3$1 = indexOf$2$1;
10614var isArray$4$1$1 = isArray$1$1$1;
10615var isArray$5$1$1 = isArray$4$1$1;
10616var nativeAssign$1$1 = Object.assign; // `Object.assign` method
10617// https://tc39.github.io/ecma262/#sec-object.assign
10618// should work with symbols and should have deterministic property order (V8 bug)
10619
10620var objectAssign$1$1 = !nativeAssign$1$1 || fails$1$1(function () {
10621 var A = {};
10622 var B = {}; // eslint-disable-next-line no-undef
10623
10624 var symbol = Symbol();
10625 var alphabet = 'abcdefghijklmnopqrst';
10626 A[symbol] = 7;
10627 alphabet.split('').forEach(function (chr) {
10628 B[chr] = chr;
10629 });
10630 return nativeAssign$1$1({}, A)[symbol] != 7 || objectKeys$1$1(nativeAssign$1$1({}, B)).join('') != alphabet;
10631}) ? function assign(target, source) {
10632 // eslint-disable-line no-unused-vars
10633 var T = toObject$1$1(target);
10634 var argumentsLength = arguments.length;
10635 var index = 1;
10636 var getOwnPropertySymbols = objectGetOwnPropertySymbols$1$1.f;
10637 var propertyIsEnumerable = objectPropertyIsEnumerable$1$1.f;
10638
10639 while (argumentsLength > index) {
10640 var S = indexedObject$1$1(arguments[index++]);
10641 var keys = getOwnPropertySymbols ? objectKeys$1$1(S).concat(getOwnPropertySymbols(S)) : objectKeys$1$1(S);
10642 var length = keys.length;
10643 var j = 0;
10644 var key;
10645
10646 while (length > j) {
10647 key = keys[j++];
10648 if (!descriptors$1$1 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
10649 }
10650 }
10651
10652 return T;
10653} : nativeAssign$1$1; // `Object.assign` method
10654// https://tc39.github.io/ecma262/#sec-object.assign
10655
10656_export$1$1({
10657 target: 'Object',
10658 stat: true,
10659 forced: Object.assign !== objectAssign$1$1
10660}, {
10661 assign: objectAssign$1$1
10662});
10663
10664var assign$3$1 = path$1$1.Object.assign; // https://tc39.github.io/ecma262/#sec-symbol.iterator
10665
10666defineWellKnownSymbol$1$1('iterator');
10667var iterator$5 = wrappedWellKnownSymbol$1$1.f('iterator');
10668var iterator$1$1$1 = iterator$5;
10669var iterator$2$1$1 = iterator$1$1$1; // `Symbol.asyncIterator` well-known symbol
10670// https://tc39.github.io/ecma262/#sec-symbol.asynciterator
10671
10672defineWellKnownSymbol$1$1('asyncIterator'); // `Symbol.hasInstance` well-known symbol
10673// https://tc39.github.io/ecma262/#sec-symbol.hasinstance
10674
10675defineWellKnownSymbol$1$1('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol
10676// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable
10677
10678defineWellKnownSymbol$1$1('isConcatSpreadable'); // `Symbol.match` well-known symbol
10679// https://tc39.github.io/ecma262/#sec-symbol.match
10680
10681defineWellKnownSymbol$1$1('match'); // `Symbol.matchAll` well-known symbol
10682
10683defineWellKnownSymbol$1$1('matchAll'); // `Symbol.replace` well-known symbol
10684// https://tc39.github.io/ecma262/#sec-symbol.replace
10685
10686defineWellKnownSymbol$1$1('replace'); // `Symbol.search` well-known symbol
10687// https://tc39.github.io/ecma262/#sec-symbol.search
10688
10689defineWellKnownSymbol$1$1('search'); // `Symbol.species` well-known symbol
10690// https://tc39.github.io/ecma262/#sec-symbol.species
10691
10692defineWellKnownSymbol$1$1('species'); // `Symbol.split` well-known symbol
10693// https://tc39.github.io/ecma262/#sec-symbol.split
10694
10695defineWellKnownSymbol$1$1('split'); // `Symbol.toPrimitive` well-known symbol
10696// https://tc39.github.io/ecma262/#sec-symbol.toprimitive
10697
10698defineWellKnownSymbol$1$1('toPrimitive'); // `Symbol.toStringTag` well-known symbol
10699// https://tc39.github.io/ecma262/#sec-symbol.tostringtag
10700
10701defineWellKnownSymbol$1$1('toStringTag'); // `Symbol.unscopables` well-known symbol
10702// https://tc39.github.io/ecma262/#sec-symbol.unscopables
10703
10704defineWellKnownSymbol$1$1('unscopables'); // Math[@@toStringTag] property
10705// https://tc39.github.io/ecma262/#sec-math-@@tostringtag
10706
10707setToStringTag$1$1(Math, 'Math', true); // JSON[@@toStringTag] property
10708// https://tc39.github.io/ecma262/#sec-json-@@tostringtag
10709
10710setToStringTag$1$1(global_1$1$1.JSON, 'JSON', true);
10711var symbol$3$1 = path$1$1.Symbol; // `Symbol.asyncDispose` well-known symbol
10712// https://github.com/tc39/proposal-using-statement
10713
10714defineWellKnownSymbol$1$1('asyncDispose'); // `Symbol.dispose` well-known symbol
10715// https://github.com/tc39/proposal-using-statement
10716
10717defineWellKnownSymbol$1$1('dispose'); // `Symbol.observable` well-known symbol
10718// https://github.com/tc39/proposal-observable
10719
10720defineWellKnownSymbol$1$1('observable'); // `Symbol.patternMatch` well-known symbol
10721// https://github.com/tc39/proposal-pattern-matching
10722
10723defineWellKnownSymbol$1$1('patternMatch'); // TODO: remove from `core-js@4`
10724
10725defineWellKnownSymbol$1$1('replaceAll');
10726var symbol$1$1$1 = symbol$3$1;
10727var symbol$2$1$1 = symbol$1$1$1;
10728
10729var _typeof_1$1$1 = createCommonjsModule$1$1(function (module) {
10730 function _typeof2(obj) {
10731 if (typeof symbol$2$1$1 === "function" && typeof iterator$2$1$1 === "symbol") {
10732 _typeof2 = function _typeof2(obj) {
10733 return typeof obj;
10734 };
10735 } else {
10736 _typeof2 = function _typeof2(obj) {
10737 return obj && typeof symbol$2$1$1 === "function" && obj.constructor === symbol$2$1$1 && obj !== symbol$2$1$1.prototype ? "symbol" : typeof obj;
10738 };
10739 }
10740
10741 return _typeof2(obj);
10742 }
10743
10744 function _typeof(obj) {
10745 if (typeof symbol$2$1$1 === "function" && _typeof2(iterator$2$1$1) === "symbol") {
10746 module.exports = _typeof = function _typeof(obj) {
10747 return _typeof2(obj);
10748 };
10749 } else {
10750 module.exports = _typeof = function _typeof(obj) {
10751 return obj && typeof symbol$2$1$1 === "function" && obj.constructor === symbol$2$1$1 && obj !== symbol$2$1$1.prototype ? "symbol" : _typeof2(obj);
10752 };
10753 }
10754
10755 return _typeof(obj);
10756 }
10757
10758 module.exports = _typeof;
10759});
10760
10761var trim$4$1 = stringTrim$1.trim;
10762var nativeParseFloat = global_1$1$1.parseFloat;
10763var FORCED$3$1$1 = 1 / nativeParseFloat(whitespaces$1 + '-0') !== -Infinity; // `parseFloat` method
10764// https://tc39.github.io/ecma262/#sec-parsefloat-string
10765
10766var _parseFloat = FORCED$3$1$1 ? function parseFloat(string) {
10767 var trimmedString = trim$4$1(String(string));
10768 var result = nativeParseFloat(trimmedString);
10769 return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
10770} : nativeParseFloat; // `parseFloat` method
10771// https://tc39.github.io/ecma262/#sec-parsefloat-string
10772
10773
10774_export$1$1({
10775 global: true,
10776 forced: parseFloat != _parseFloat
10777}, {
10778 parseFloat: _parseFloat
10779});
10780
10781var _parseFloat$1 = path$1$1.parseFloat;
10782var _parseFloat$2 = _parseFloat$1;
10783var _parseFloat$3 = _parseFloat$2; // `Date.now` method
10784// https://tc39.github.io/ecma262/#sec-date.now
10785
10786_export$1$1({
10787 target: 'Date',
10788 stat: true
10789}, {
10790 now: function now() {
10791 return new Date().getTime();
10792 }
10793});
10794
10795var now = path$1$1.Date.now;
10796var now$1 = now;
10797var now$2 = now$1;
10798var test$1$1$1 = [];
10799var nativeSort$1 = test$1$1$1.sort; // IE8-
10800
10801var FAILS_ON_UNDEFINED$1 = fails$1$1(function () {
10802 test$1$1$1.sort(undefined);
10803}); // V8 bug
10804
10805var FAILS_ON_NULL$1 = fails$1$1(function () {
10806 test$1$1$1.sort(null);
10807}); // Old WebKit
10808
10809var SLOPPY_METHOD$1$1$1 = sloppyArrayMethod$1$1('sort');
10810var FORCED$4$1 = FAILS_ON_UNDEFINED$1 || !FAILS_ON_NULL$1 || SLOPPY_METHOD$1$1$1; // `Array.prototype.sort` method
10811// https://tc39.github.io/ecma262/#sec-array.prototype.sort
10812
10813_export$1$1({
10814 target: 'Array',
10815 proto: true,
10816 forced: FORCED$4$1
10817}, {
10818 sort: function sort(comparefn) {
10819 return comparefn === undefined ? nativeSort$1.call(toObject$1$1(this)) : nativeSort$1.call(toObject$1$1(this), aFunction$2$1(comparefn));
10820 }
10821});
10822
10823var sort$3 = entryVirtual$1$1('Array').sort;
10824var ArrayPrototype$7$1$1 = Array.prototype;
10825
10826var sort_1$1 = function (it) {
10827 var own = it.sort;
10828 return it === ArrayPrototype$7$1$1 || it instanceof Array && own === ArrayPrototype$7$1$1.sort ? sort$3 : own;
10829};
10830
10831var sort$1$1 = sort_1$1;
10832var sort$2$1 = sort$1$1;
10833var nativeIsFrozen = Object.isFrozen;
10834var FAILS_ON_PRIMITIVES$3$1$1 = fails$1$1(function () {
10835 nativeIsFrozen(1);
10836}); // `Object.isFrozen` method
10837// https://tc39.github.io/ecma262/#sec-object.isfrozen
10838
10839_export$1$1({
10840 target: 'Object',
10841 stat: true,
10842 forced: FAILS_ON_PRIMITIVES$3$1$1
10843}, {
10844 isFrozen: function isFrozen(it) {
10845 return isObject$1$1(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true;
10846 }
10847});
10848
10849var isFrozen = path$1$1.Object.isFrozen;
10850var isFrozen$1 = isFrozen;
10851var isFrozen$2 = isFrozen$1;
10852var $some$1 = arrayIteration$1$1.some; // `Array.prototype.some` method
10853// https://tc39.github.io/ecma262/#sec-array.prototype.some
10854
10855_export$1$1({
10856 target: 'Array',
10857 proto: true,
10858 forced: sloppyArrayMethod$1$1('some')
10859}, {
10860 some: function some(callbackfn
10861 /* , thisArg */
10862 ) {
10863 return $some$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
10864 }
10865});
10866
10867var some$3 = entryVirtual$1$1('Array').some;
10868var ArrayPrototype$8$1 = Array.prototype;
10869
10870var some_1$1 = function (it) {
10871 var own = it.some;
10872 return it === ArrayPrototype$8$1 || it instanceof Array && own === ArrayPrototype$8$1.some ? some$3 : own;
10873};
10874
10875var some$1$1 = some_1$1;
10876var some$2$1 = some$1$1;
10877var nativeGetOwnPropertyNames$2$1$1 = objectGetOwnPropertyNamesExternal$1$1.f;
10878var FAILS_ON_PRIMITIVES$4 = fails$1$1(function () {
10879 return !Object.getOwnPropertyNames(1);
10880}); // `Object.getOwnPropertyNames` method
10881// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
10882
10883_export$1$1({
10884 target: 'Object',
10885 stat: true,
10886 forced: FAILS_ON_PRIMITIVES$4
10887}, {
10888 getOwnPropertyNames: nativeGetOwnPropertyNames$2$1$1
10889});
10890
10891var Object$2 = path$1$1.Object;
10892
10893var getOwnPropertyNames = function getOwnPropertyNames(it) {
10894 return Object$2.getOwnPropertyNames(it);
10895};
10896
10897var getOwnPropertyNames$1 = getOwnPropertyNames;
10898var getOwnPropertyNames$2 = getOwnPropertyNames$1;
10899var moment = createCommonjsModule$1$1(function (module, exports) {
10900 (function (global, factory) {
10901 module.exports = factory();
10902 })(commonjsGlobal$1$1, function () {
10903 var hookCallback;
10904
10905 function hooks() {
10906 return hookCallback.apply(null, arguments);
10907 } // This is done to register the method called with moment()
10908 // without creating circular dependencies.
10909
10910
10911 function setHookCallback(callback) {
10912 hookCallback = callback;
10913 }
10914
10915 function isArray(input) {
10916 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
10917 }
10918
10919 function isObject(input) {
10920 // IE8 will treat undefined and null as object if it wasn't for
10921 // input != null
10922 return input != null && Object.prototype.toString.call(input) === '[object Object]';
10923 }
10924
10925 function isObjectEmpty(obj) {
10926 if (getOwnPropertyNames$2) {
10927 return getOwnPropertyNames$2(obj).length === 0;
10928 } else {
10929 var k;
10930
10931 for (k in obj) {
10932 if (obj.hasOwnProperty(k)) {
10933 return false;
10934 }
10935 }
10936
10937 return true;
10938 }
10939 }
10940
10941 function isUndefined(input) {
10942 return input === void 0;
10943 }
10944
10945 function isNumber(input) {
10946 return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
10947 }
10948
10949 function isDate(input) {
10950 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
10951 }
10952
10953 function map(arr, fn) {
10954 var res = [],
10955 i;
10956
10957 for (i = 0; i < arr.length; ++i) {
10958 res.push(fn(arr[i], i));
10959 }
10960
10961 return res;
10962 }
10963
10964 function hasOwnProp(a, b) {
10965 return Object.prototype.hasOwnProperty.call(a, b);
10966 }
10967
10968 function extend(a, b) {
10969 for (var i in b) {
10970 if (hasOwnProp(b, i)) {
10971 a[i] = b[i];
10972 }
10973 }
10974
10975 if (hasOwnProp(b, 'toString')) {
10976 a.toString = b.toString;
10977 }
10978
10979 if (hasOwnProp(b, 'valueOf')) {
10980 a.valueOf = b.valueOf;
10981 }
10982
10983 return a;
10984 }
10985
10986 function createUTC(input, format, locale, strict) {
10987 return createLocalOrUTC(input, format, locale, strict, true).utc();
10988 }
10989
10990 function defaultParsingFlags() {
10991 // We need to deep clone this object.
10992 return {
10993 empty: false,
10994 unusedTokens: [],
10995 unusedInput: [],
10996 overflow: -2,
10997 charsLeftOver: 0,
10998 nullInput: false,
10999 invalidMonth: null,
11000 invalidFormat: false,
11001 userInvalidated: false,
11002 iso: false,
11003 parsedDateParts: [],
11004 meridiem: null,
11005 rfc2822: false,
11006 weekdayMismatch: false
11007 };
11008 }
11009
11010 function getParsingFlags(m) {
11011 if (m._pf == null) {
11012 m._pf = defaultParsingFlags();
11013 }
11014
11015 return m._pf;
11016 }
11017
11018 var some;
11019
11020 if (some$2$1(Array.prototype)) {
11021 some = some$2$1(Array.prototype);
11022 } else {
11023 some = function some(fun) {
11024 var t = Object(this);
11025 var len = t.length >>> 0;
11026
11027 for (var i = 0; i < len; i++) {
11028 if (i in t && fun.call(this, t[i], i, t)) {
11029 return true;
11030 }
11031 }
11032
11033 return false;
11034 };
11035 }
11036
11037 function isValid(m) {
11038 if (m._isValid == null) {
11039 var flags = getParsingFlags(m);
11040 var parsedParts = some.call(flags.parsedDateParts, function (i) {
11041 return i != null;
11042 });
11043 var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
11044
11045 if (m._strict) {
11046 isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined;
11047 }
11048
11049 if (isFrozen$2 == null || !isFrozen$2(m)) {
11050 m._isValid = isNowValid;
11051 } else {
11052 return isNowValid;
11053 }
11054 }
11055
11056 return m._isValid;
11057 }
11058
11059 function createInvalid(flags) {
11060 var m = createUTC(NaN);
11061
11062 if (flags != null) {
11063 extend(getParsingFlags(m), flags);
11064 } else {
11065 getParsingFlags(m).userInvalidated = true;
11066 }
11067
11068 return m;
11069 } // Plugins that add properties should also add the key here (null value),
11070 // so we can properly clone ourselves.
11071
11072
11073 var momentProperties = hooks.momentProperties = [];
11074
11075 function copyConfig(to, from) {
11076 var i, prop, val;
11077
11078 if (!isUndefined(from._isAMomentObject)) {
11079 to._isAMomentObject = from._isAMomentObject;
11080 }
11081
11082 if (!isUndefined(from._i)) {
11083 to._i = from._i;
11084 }
11085
11086 if (!isUndefined(from._f)) {
11087 to._f = from._f;
11088 }
11089
11090 if (!isUndefined(from._l)) {
11091 to._l = from._l;
11092 }
11093
11094 if (!isUndefined(from._strict)) {
11095 to._strict = from._strict;
11096 }
11097
11098 if (!isUndefined(from._tzm)) {
11099 to._tzm = from._tzm;
11100 }
11101
11102 if (!isUndefined(from._isUTC)) {
11103 to._isUTC = from._isUTC;
11104 }
11105
11106 if (!isUndefined(from._offset)) {
11107 to._offset = from._offset;
11108 }
11109
11110 if (!isUndefined(from._pf)) {
11111 to._pf = getParsingFlags(from);
11112 }
11113
11114 if (!isUndefined(from._locale)) {
11115 to._locale = from._locale;
11116 }
11117
11118 if (momentProperties.length > 0) {
11119 for (i = 0; i < momentProperties.length; i++) {
11120 prop = momentProperties[i];
11121 val = from[prop];
11122
11123 if (!isUndefined(val)) {
11124 to[prop] = val;
11125 }
11126 }
11127 }
11128
11129 return to;
11130 }
11131
11132 var updateInProgress = false; // Moment prototype object
11133
11134 function Moment(config) {
11135 copyConfig(this, config);
11136 this._d = new Date(config._d != null ? config._d.getTime() : NaN);
11137
11138 if (!this.isValid()) {
11139 this._d = new Date(NaN);
11140 } // Prevent infinite loop in case updateOffset creates new moment
11141 // objects.
11142
11143
11144 if (updateInProgress === false) {
11145 updateInProgress = true;
11146 hooks.updateOffset(this);
11147 updateInProgress = false;
11148 }
11149 }
11150
11151 function isMoment(obj) {
11152 return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
11153 }
11154
11155 function absFloor(number) {
11156 if (number < 0) {
11157 // -0 -> 0
11158 return Math.ceil(number) || 0;
11159 } else {
11160 return Math.floor(number);
11161 }
11162 }
11163
11164 function toInt(argumentForCoercion) {
11165 var coercedNumber = +argumentForCoercion,
11166 value = 0;
11167
11168 if (coercedNumber !== 0 && isFinite(coercedNumber)) {
11169 value = absFloor(coercedNumber);
11170 }
11171
11172 return value;
11173 } // compare two arrays, return the number of differences
11174
11175
11176 function compareArrays(array1, array2, dontConvert) {
11177 var len = Math.min(array1.length, array2.length),
11178 lengthDiff = Math.abs(array1.length - array2.length),
11179 diffs = 0,
11180 i;
11181
11182 for (i = 0; i < len; i++) {
11183 if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
11184 diffs++;
11185 }
11186 }
11187
11188 return diffs + lengthDiff;
11189 }
11190
11191 function warn(msg) {
11192 if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
11193 console.warn('Deprecation warning: ' + msg);
11194 }
11195 }
11196
11197 function deprecate(msg, fn) {
11198 var firstTime = true;
11199 return extend(function () {
11200 if (hooks.deprecationHandler != null) {
11201 hooks.deprecationHandler(null, msg);
11202 }
11203
11204 if (firstTime) {
11205 var args = [];
11206 var arg;
11207
11208 for (var i = 0; i < arguments.length; i++) {
11209 arg = '';
11210
11211 if (_typeof_1$1$1(arguments[i]) === 'object') {
11212 arg += '\n[' + i + '] ';
11213
11214 for (var key in arguments[0]) {
11215 arg += key + ': ' + arguments[0][key] + ', ';
11216 }
11217
11218 arg = slice$2$1(arg).call(arg, 0, -2); // Remove trailing comma and space
11219 } else {
11220 arg = arguments[i];
11221 }
11222
11223 args.push(arg);
11224 }
11225
11226 warn(msg + '\nArguments: ' + slice$2$1(Array.prototype).call(args).join('') + '\n' + new Error().stack);
11227 firstTime = false;
11228 }
11229
11230 return fn.apply(this, arguments);
11231 }, fn);
11232 }
11233
11234 var deprecations = {};
11235
11236 function deprecateSimple(name, msg) {
11237 if (hooks.deprecationHandler != null) {
11238 hooks.deprecationHandler(name, msg);
11239 }
11240
11241 if (!deprecations[name]) {
11242 warn(msg);
11243 deprecations[name] = true;
11244 }
11245 }
11246
11247 hooks.suppressDeprecationWarnings = false;
11248 hooks.deprecationHandler = null;
11249
11250 function isFunction(input) {
11251 return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
11252 }
11253
11254 function set(config) {
11255 var prop, i;
11256
11257 for (i in config) {
11258 prop = config[i];
11259
11260 if (isFunction(prop)) {
11261 this[i] = prop;
11262 } else {
11263 this['_' + i] = prop;
11264 }
11265 }
11266
11267 this._config = config; // Lenient ordinal parsing accepts just a number in addition to
11268 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
11269 // TODO: Remove "ordinalParse" fallback in next major release.
11270
11271 this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source);
11272 }
11273
11274 function mergeConfigs(parentConfig, childConfig) {
11275 var res = extend({}, parentConfig),
11276 prop;
11277
11278 for (prop in childConfig) {
11279 if (hasOwnProp(childConfig, prop)) {
11280 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
11281 res[prop] = {};
11282 extend(res[prop], parentConfig[prop]);
11283 extend(res[prop], childConfig[prop]);
11284 } else if (childConfig[prop] != null) {
11285 res[prop] = childConfig[prop];
11286 } else {
11287 delete res[prop];
11288 }
11289 }
11290 }
11291
11292 for (prop in parentConfig) {
11293 if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
11294 // make sure changes to properties don't modify parent config
11295 res[prop] = extend({}, res[prop]);
11296 }
11297 }
11298
11299 return res;
11300 }
11301
11302 function Locale(config) {
11303 if (config != null) {
11304 this.set(config);
11305 }
11306 }
11307
11308 var keys;
11309
11310 if (keys$3$1$1) {
11311 keys = keys$3$1$1;
11312 } else {
11313 keys = function keys(obj) {
11314 var i,
11315 res = [];
11316
11317 for (i in obj) {
11318 if (hasOwnProp(obj, i)) {
11319 res.push(i);
11320 }
11321 }
11322
11323 return res;
11324 };
11325 }
11326
11327 var defaultCalendar = {
11328 sameDay: '[Today at] LT',
11329 nextDay: '[Tomorrow at] LT',
11330 nextWeek: 'dddd [at] LT',
11331 lastDay: '[Yesterday at] LT',
11332 lastWeek: '[Last] dddd [at] LT',
11333 sameElse: 'L'
11334 };
11335
11336 function calendar(key, mom, now) {
11337 var output = this._calendar[key] || this._calendar['sameElse'];
11338 return isFunction(output) ? output.call(mom, now) : output;
11339 }
11340
11341 var defaultLongDateFormat = {
11342 LTS: 'h:mm:ss A',
11343 LT: 'h:mm A',
11344 L: 'MM/DD/YYYY',
11345 LL: 'MMMM D, YYYY',
11346 LLL: 'MMMM D, YYYY h:mm A',
11347 LLLL: 'dddd, MMMM D, YYYY h:mm A'
11348 };
11349
11350 function longDateFormat(key) {
11351 var format = this._longDateFormat[key],
11352 formatUpper = this._longDateFormat[key.toUpperCase()];
11353
11354 if (format || !formatUpper) {
11355 return format;
11356 }
11357
11358 this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
11359 return slice$2$1(val).call(val, 1);
11360 });
11361 return this._longDateFormat[key];
11362 }
11363
11364 var defaultInvalidDate = 'Invalid date';
11365
11366 function invalidDate() {
11367 return this._invalidDate;
11368 }
11369
11370 var defaultOrdinal = '%d';
11371 var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
11372
11373 function ordinal(number) {
11374 return this._ordinal.replace('%d', number);
11375 }
11376
11377 var defaultRelativeTime = {
11378 future: 'in %s',
11379 past: '%s ago',
11380 s: 'a few seconds',
11381 ss: '%d seconds',
11382 m: 'a minute',
11383 mm: '%d minutes',
11384 h: 'an hour',
11385 hh: '%d hours',
11386 d: 'a day',
11387 dd: '%d days',
11388 M: 'a month',
11389 MM: '%d months',
11390 y: 'a year',
11391 yy: '%d years'
11392 };
11393
11394 function relativeTime(number, withoutSuffix, string, isFuture) {
11395 var output = this._relativeTime[string];
11396 return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
11397 }
11398
11399 function pastFuture(diff, output) {
11400 var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
11401 return isFunction(format) ? format(output) : format.replace(/%s/i, output);
11402 }
11403
11404 var aliases = {};
11405
11406 function addUnitAlias(unit, shorthand) {
11407 var lowerCase = unit.toLowerCase();
11408 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
11409 }
11410
11411 function normalizeUnits(units) {
11412 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
11413 }
11414
11415 function normalizeObjectUnits(inputObject) {
11416 var normalizedInput = {},
11417 normalizedProp,
11418 prop;
11419
11420 for (prop in inputObject) {
11421 if (hasOwnProp(inputObject, prop)) {
11422 normalizedProp = normalizeUnits(prop);
11423
11424 if (normalizedProp) {
11425 normalizedInput[normalizedProp] = inputObject[prop];
11426 }
11427 }
11428 }
11429
11430 return normalizedInput;
11431 }
11432
11433 var priorities = {};
11434
11435 function addUnitPriority(unit, priority) {
11436 priorities[unit] = priority;
11437 }
11438
11439 function getPrioritizedUnits(unitsObj) {
11440 var units = [];
11441
11442 for (var u in unitsObj) {
11443 units.push({
11444 unit: u,
11445 priority: priorities[u]
11446 });
11447 }
11448
11449 sort$2$1(units).call(units, function (a, b) {
11450 return a.priority - b.priority;
11451 });
11452 return units;
11453 }
11454
11455 function zeroFill(number, targetLength, forceSign) {
11456 var absNumber = '' + Math.abs(number),
11457 zerosToFill = targetLength - absNumber.length,
11458 sign = number >= 0;
11459 return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
11460 }
11461
11462 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
11463 var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
11464 var formatFunctions = {};
11465 var formatTokenFunctions = {}; // token: 'M'
11466 // padded: ['MM', 2]
11467 // ordinal: 'Mo'
11468 // callback: function () { this.month() + 1 }
11469
11470 function addFormatToken(token, padded, ordinal, callback) {
11471 var func = callback;
11472
11473 if (typeof callback === 'string') {
11474 func = function func() {
11475 return this[callback]();
11476 };
11477 }
11478
11479 if (token) {
11480 formatTokenFunctions[token] = func;
11481 }
11482
11483 if (padded) {
11484 formatTokenFunctions[padded[0]] = function () {
11485 return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
11486 };
11487 }
11488
11489 if (ordinal) {
11490 formatTokenFunctions[ordinal] = function () {
11491 return this.localeData().ordinal(func.apply(this, arguments), token);
11492 };
11493 }
11494 }
11495
11496 function removeFormattingTokens(input) {
11497 if (input.match(/\[[\s\S]/)) {
11498 return input.replace(/^\[|\]$/g, '');
11499 }
11500
11501 return input.replace(/\\/g, '');
11502 }
11503
11504 function makeFormatFunction(format) {
11505 var array = format.match(formattingTokens),
11506 i,
11507 length;
11508
11509 for (i = 0, length = array.length; i < length; i++) {
11510 if (formatTokenFunctions[array[i]]) {
11511 array[i] = formatTokenFunctions[array[i]];
11512 } else {
11513 array[i] = removeFormattingTokens(array[i]);
11514 }
11515 }
11516
11517 return function (mom) {
11518 var output = '',
11519 i;
11520
11521 for (i = 0; i < length; i++) {
11522 output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
11523 }
11524
11525 return output;
11526 };
11527 } // format date using native date object
11528
11529
11530 function formatMoment(m, format) {
11531 if (!m.isValid()) {
11532 return m.localeData().invalidDate();
11533 }
11534
11535 format = expandFormat(format, m.localeData());
11536 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
11537 return formatFunctions[format](m);
11538 }
11539
11540 function expandFormat(format, locale) {
11541 var i = 5;
11542
11543 function replaceLongDateFormatTokens(input) {
11544 return locale.longDateFormat(input) || input;
11545 }
11546
11547 localFormattingTokens.lastIndex = 0;
11548
11549 while (i >= 0 && localFormattingTokens.test(format)) {
11550 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
11551 localFormattingTokens.lastIndex = 0;
11552 i -= 1;
11553 }
11554
11555 return format;
11556 }
11557
11558 var match1 = /\d/; // 0 - 9
11559
11560 var match2 = /\d\d/; // 00 - 99
11561
11562 var match3 = /\d{3}/; // 000 - 999
11563
11564 var match4 = /\d{4}/; // 0000 - 9999
11565
11566 var match6 = /[+-]?\d{6}/; // -999999 - 999999
11567
11568 var match1to2 = /\d\d?/; // 0 - 99
11569
11570 var match3to4 = /\d\d\d\d?/; // 999 - 9999
11571
11572 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
11573
11574 var match1to3 = /\d{1,3}/; // 0 - 999
11575
11576 var match1to4 = /\d{1,4}/; // 0 - 9999
11577
11578 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
11579
11580 var matchUnsigned = /\d+/; // 0 - inf
11581
11582 var matchSigned = /[+-]?\d+/; // -inf - inf
11583
11584 var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
11585
11586 var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
11587
11588 var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
11589 // any word (or two) characters or numbers including two/three word month in arabic.
11590 // includes scottish gaelic two word and hyphenated months
11591
11592 var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
11593 var regexes = {};
11594
11595 function addRegexToken(token, regex, strictRegex) {
11596 regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
11597 return isStrict && strictRegex ? strictRegex : regex;
11598 };
11599 }
11600
11601 function getParseRegexForToken(token, config) {
11602 if (!hasOwnProp(regexes, token)) {
11603 return new RegExp(unescapeFormat(token));
11604 }
11605
11606 return regexes[token](config._strict, config._locale);
11607 } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
11608
11609
11610 function unescapeFormat(s) {
11611 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
11612 return p1 || p2 || p3 || p4;
11613 }));
11614 }
11615
11616 function regexEscape(s) {
11617 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
11618 }
11619
11620 var tokens = {};
11621
11622 function addParseToken(token, callback) {
11623 var i,
11624 func = callback;
11625
11626 if (typeof token === 'string') {
11627 token = [token];
11628 }
11629
11630 if (isNumber(callback)) {
11631 func = function func(input, array) {
11632 array[callback] = toInt(input);
11633 };
11634 }
11635
11636 for (i = 0; i < token.length; i++) {
11637 tokens[token[i]] = func;
11638 }
11639 }
11640
11641 function addWeekParseToken(token, callback) {
11642 addParseToken(token, function (input, array, config, token) {
11643 config._w = config._w || {};
11644 callback(input, config._w, config, token);
11645 });
11646 }
11647
11648 function addTimeToArrayFromToken(token, input, config) {
11649 if (input != null && hasOwnProp(tokens, token)) {
11650 tokens[token](input, config._a, config, token);
11651 }
11652 }
11653
11654 var YEAR = 0;
11655 var MONTH = 1;
11656 var DATE = 2;
11657 var HOUR = 3;
11658 var MINUTE = 4;
11659 var SECOND = 5;
11660 var MILLISECOND = 6;
11661 var WEEK = 7;
11662 var WEEKDAY = 8; // FORMATTING
11663
11664 addFormatToken('Y', 0, 0, function () {
11665 var y = this.year();
11666 return y <= 9999 ? '' + y : '+' + y;
11667 });
11668 addFormatToken(0, ['YY', 2], 0, function () {
11669 return this.year() % 100;
11670 });
11671 addFormatToken(0, ['YYYY', 4], 0, 'year');
11672 addFormatToken(0, ['YYYYY', 5], 0, 'year');
11673 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES
11674
11675 addUnitAlias('year', 'y'); // PRIORITIES
11676
11677 addUnitPriority('year', 1); // PARSING
11678
11679 addRegexToken('Y', matchSigned);
11680 addRegexToken('YY', match1to2, match2);
11681 addRegexToken('YYYY', match1to4, match4);
11682 addRegexToken('YYYYY', match1to6, match6);
11683 addRegexToken('YYYYYY', match1to6, match6);
11684 addParseToken(['YYYYY', 'YYYYYY'], YEAR);
11685 addParseToken('YYYY', function (input, array) {
11686 array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
11687 });
11688 addParseToken('YY', function (input, array) {
11689 array[YEAR] = hooks.parseTwoDigitYear(input);
11690 });
11691 addParseToken('Y', function (input, array) {
11692 array[YEAR] = _parseInt$3$1(input, 10);
11693 }); // HELPERS
11694
11695 function daysInYear(year) {
11696 return isLeapYear(year) ? 366 : 365;
11697 }
11698
11699 function isLeapYear(year) {
11700 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
11701 } // HOOKS
11702
11703
11704 hooks.parseTwoDigitYear = function (input) {
11705 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
11706 }; // MOMENTS
11707
11708
11709 var getSetYear = makeGetSet('FullYear', true);
11710
11711 function getIsLeapYear() {
11712 return isLeapYear(this.year());
11713 }
11714
11715 function makeGetSet(unit, keepTime) {
11716 return function (value) {
11717 if (value != null) {
11718 set$1(this, unit, value);
11719 hooks.updateOffset(this, keepTime);
11720 return this;
11721 } else {
11722 return get(this, unit);
11723 }
11724 };
11725 }
11726
11727 function get(mom, unit) {
11728 return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
11729 }
11730
11731 function set$1(mom, unit, value) {
11732 if (mom.isValid() && !isNaN(value)) {
11733 if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
11734 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
11735 } else {
11736 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
11737 }
11738 }
11739 } // MOMENTS
11740
11741
11742 function stringGet(units) {
11743 units = normalizeUnits(units);
11744
11745 if (isFunction(this[units])) {
11746 return this[units]();
11747 }
11748
11749 return this;
11750 }
11751
11752 function stringSet(units, value) {
11753 if (_typeof_1$1$1(units) === 'object') {
11754 units = normalizeObjectUnits(units);
11755 var prioritized = getPrioritizedUnits(units);
11756
11757 for (var i = 0; i < prioritized.length; i++) {
11758 this[prioritized[i].unit](units[prioritized[i].unit]);
11759 }
11760 } else {
11761 units = normalizeUnits(units);
11762
11763 if (isFunction(this[units])) {
11764 return this[units](value);
11765 }
11766 }
11767
11768 return this;
11769 }
11770
11771 function mod(n, x) {
11772 return (n % x + x) % x;
11773 }
11774
11775 var indexOf;
11776
11777 if (indexOf$3$1(Array.prototype)) {
11778 indexOf = indexOf$3$1(Array.prototype);
11779 } else {
11780 indexOf = function indexOf(o) {
11781 // I know
11782 var i;
11783
11784 for (i = 0; i < this.length; ++i) {
11785 if (this[i] === o) {
11786 return i;
11787 }
11788 }
11789
11790 return -1;
11791 };
11792 }
11793
11794 function daysInMonth(year, month) {
11795 if (isNaN(year) || isNaN(month)) {
11796 return NaN;
11797 }
11798
11799 var modMonth = mod(month, 12);
11800 year += (month - modMonth) / 12;
11801 return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
11802 } // FORMATTING
11803
11804
11805 addFormatToken('M', ['MM', 2], 'Mo', function () {
11806 return this.month() + 1;
11807 });
11808 addFormatToken('MMM', 0, 0, function (format) {
11809 return this.localeData().monthsShort(this, format);
11810 });
11811 addFormatToken('MMMM', 0, 0, function (format) {
11812 return this.localeData().months(this, format);
11813 }); // ALIASES
11814
11815 addUnitAlias('month', 'M'); // PRIORITY
11816
11817 addUnitPriority('month', 8); // PARSING
11818
11819 addRegexToken('M', match1to2);
11820 addRegexToken('MM', match1to2, match2);
11821 addRegexToken('MMM', function (isStrict, locale) {
11822 return locale.monthsShortRegex(isStrict);
11823 });
11824 addRegexToken('MMMM', function (isStrict, locale) {
11825 return locale.monthsRegex(isStrict);
11826 });
11827 addParseToken(['M', 'MM'], function (input, array) {
11828 array[MONTH] = toInt(input) - 1;
11829 });
11830 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
11831 var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid.
11832
11833
11834 if (month != null) {
11835 array[MONTH] = month;
11836 } else {
11837 getParsingFlags(config).invalidMonth = input;
11838 }
11839 }); // LOCALES
11840
11841 var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
11842 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
11843
11844 function localeMonths(m, format) {
11845 if (!m) {
11846 return isArray(this._months) ? this._months : this._months['standalone'];
11847 }
11848
11849 return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
11850 }
11851
11852 var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
11853
11854 function localeMonthsShort(m, format) {
11855 if (!m) {
11856 return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone'];
11857 }
11858
11859 return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
11860 }
11861
11862 function handleStrictParse(monthName, format, strict) {
11863 var i,
11864 ii,
11865 mom,
11866 llc = monthName.toLocaleLowerCase();
11867
11868 if (!this._monthsParse) {
11869 // this is not used
11870 this._monthsParse = [];
11871 this._longMonthsParse = [];
11872 this._shortMonthsParse = [];
11873
11874 for (i = 0; i < 12; ++i) {
11875 mom = createUTC([2000, i]);
11876 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
11877 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
11878 }
11879 }
11880
11881 if (strict) {
11882 if (format === 'MMM') {
11883 ii = indexOf.call(this._shortMonthsParse, llc);
11884 return ii !== -1 ? ii : null;
11885 } else {
11886 ii = indexOf.call(this._longMonthsParse, llc);
11887 return ii !== -1 ? ii : null;
11888 }
11889 } else {
11890 if (format === 'MMM') {
11891 ii = indexOf.call(this._shortMonthsParse, llc);
11892
11893 if (ii !== -1) {
11894 return ii;
11895 }
11896
11897 ii = indexOf.call(this._longMonthsParse, llc);
11898 return ii !== -1 ? ii : null;
11899 } else {
11900 ii = indexOf.call(this._longMonthsParse, llc);
11901
11902 if (ii !== -1) {
11903 return ii;
11904 }
11905
11906 ii = indexOf.call(this._shortMonthsParse, llc);
11907 return ii !== -1 ? ii : null;
11908 }
11909 }
11910 }
11911
11912 function localeMonthsParse(monthName, format, strict) {
11913 var i, mom, regex;
11914
11915 if (this._monthsParseExact) {
11916 return handleStrictParse.call(this, monthName, format, strict);
11917 }
11918
11919 if (!this._monthsParse) {
11920 this._monthsParse = [];
11921 this._longMonthsParse = [];
11922 this._shortMonthsParse = [];
11923 } // TODO: add sorting
11924 // Sorting makes sure if one month (or abbr) is a prefix of another
11925 // see sorting in computeMonthsParse
11926
11927
11928 for (i = 0; i < 12; i++) {
11929 // make the regex if we don't have it already
11930 mom = createUTC([2000, i]);
11931
11932 if (strict && !this._longMonthsParse[i]) {
11933 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
11934 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
11935 }
11936
11937 if (!strict && !this._monthsParse[i]) {
11938 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
11939 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
11940 } // test the regex
11941
11942
11943 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
11944 return i;
11945 } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
11946 return i;
11947 } else if (!strict && this._monthsParse[i].test(monthName)) {
11948 return i;
11949 }
11950 }
11951 } // MOMENTS
11952
11953
11954 function setMonth(mom, value) {
11955 var dayOfMonth;
11956
11957 if (!mom.isValid()) {
11958 // No op
11959 return mom;
11960 }
11961
11962 if (typeof value === 'string') {
11963 if (/^\d+$/.test(value)) {
11964 value = toInt(value);
11965 } else {
11966 value = mom.localeData().monthsParse(value); // TODO: Another silent failure?
11967
11968 if (!isNumber(value)) {
11969 return mom;
11970 }
11971 }
11972 }
11973
11974 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
11975
11976 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
11977
11978 return mom;
11979 }
11980
11981 function getSetMonth(value) {
11982 if (value != null) {
11983 setMonth(this, value);
11984 hooks.updateOffset(this, true);
11985 return this;
11986 } else {
11987 return get(this, 'Month');
11988 }
11989 }
11990
11991 function getDaysInMonth() {
11992 return daysInMonth(this.year(), this.month());
11993 }
11994
11995 var defaultMonthsShortRegex = matchWord;
11996
11997 function monthsShortRegex(isStrict) {
11998 if (this._monthsParseExact) {
11999 if (!hasOwnProp(this, '_monthsRegex')) {
12000 computeMonthsParse.call(this);
12001 }
12002
12003 if (isStrict) {
12004 return this._monthsShortStrictRegex;
12005 } else {
12006 return this._monthsShortRegex;
12007 }
12008 } else {
12009 if (!hasOwnProp(this, '_monthsShortRegex')) {
12010 this._monthsShortRegex = defaultMonthsShortRegex;
12011 }
12012
12013 return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
12014 }
12015 }
12016
12017 var defaultMonthsRegex = matchWord;
12018
12019 function monthsRegex(isStrict) {
12020 if (this._monthsParseExact) {
12021 if (!hasOwnProp(this, '_monthsRegex')) {
12022 computeMonthsParse.call(this);
12023 }
12024
12025 if (isStrict) {
12026 return this._monthsStrictRegex;
12027 } else {
12028 return this._monthsRegex;
12029 }
12030 } else {
12031 if (!hasOwnProp(this, '_monthsRegex')) {
12032 this._monthsRegex = defaultMonthsRegex;
12033 }
12034
12035 return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
12036 }
12037 }
12038
12039 function computeMonthsParse() {
12040 function cmpLenRev(a, b) {
12041 return b.length - a.length;
12042 }
12043
12044 var shortPieces = [],
12045 longPieces = [],
12046 mixedPieces = [],
12047 i,
12048 mom;
12049
12050 for (i = 0; i < 12; i++) {
12051 // make the regex if we don't have it already
12052 mom = createUTC([2000, i]);
12053 shortPieces.push(this.monthsShort(mom, ''));
12054 longPieces.push(this.months(mom, ''));
12055 mixedPieces.push(this.months(mom, ''));
12056 mixedPieces.push(this.monthsShort(mom, ''));
12057 } // Sorting makes sure if one month (or abbr) is a prefix of another it
12058 // will match the longer piece.
12059
12060
12061 sort$2$1(shortPieces).call(shortPieces, cmpLenRev);
12062 sort$2$1(longPieces).call(longPieces, cmpLenRev);
12063 sort$2$1(mixedPieces).call(mixedPieces, cmpLenRev);
12064
12065 for (i = 0; i < 12; i++) {
12066 shortPieces[i] = regexEscape(shortPieces[i]);
12067 longPieces[i] = regexEscape(longPieces[i]);
12068 }
12069
12070 for (i = 0; i < 24; i++) {
12071 mixedPieces[i] = regexEscape(mixedPieces[i]);
12072 }
12073
12074 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
12075 this._monthsShortRegex = this._monthsRegex;
12076 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
12077 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
12078 }
12079
12080 function createDate(y, m, d, h, M, s, ms) {
12081 // can't just apply() to create a date:
12082 // https://stackoverflow.com/q/181348
12083 var date; // the date constructor remaps years 0-99 to 1900-1999
12084
12085 if (y < 100 && y >= 0) {
12086 // preserve leap years using a full 400 year cycle, then reset
12087 date = new Date(y + 400, m, d, h, M, s, ms);
12088
12089 if (isFinite(date.getFullYear())) {
12090 date.setFullYear(y);
12091 }
12092 } else {
12093 date = new Date(y, m, d, h, M, s, ms);
12094 }
12095
12096 return date;
12097 }
12098
12099 function createUTCDate(y) {
12100 var date; // the Date.UTC function remaps years 0-99 to 1900-1999
12101
12102 if (y < 100 && y >= 0) {
12103 var args = slice$2$1(Array.prototype).call(arguments); // preserve leap years using a full 400 year cycle, then reset
12104
12105 args[0] = y + 400;
12106 date = new Date(Date.UTC.apply(null, args));
12107
12108 if (isFinite(date.getUTCFullYear())) {
12109 date.setUTCFullYear(y);
12110 }
12111 } else {
12112 date = new Date(Date.UTC.apply(null, arguments));
12113 }
12114
12115 return date;
12116 } // start-of-first-week - start-of-year
12117
12118
12119 function firstWeekOffset(year, dow, doy) {
12120 var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
12121 fwd = 7 + dow - doy,
12122 // first-week day local weekday -- which local weekday is fwd
12123 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
12124 return -fwdlw + fwd - 1;
12125 } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
12126
12127
12128 function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
12129 var localWeekday = (7 + weekday - dow) % 7,
12130 weekOffset = firstWeekOffset(year, dow, doy),
12131 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
12132 resYear,
12133 resDayOfYear;
12134
12135 if (dayOfYear <= 0) {
12136 resYear = year - 1;
12137 resDayOfYear = daysInYear(resYear) + dayOfYear;
12138 } else if (dayOfYear > daysInYear(year)) {
12139 resYear = year + 1;
12140 resDayOfYear = dayOfYear - daysInYear(year);
12141 } else {
12142 resYear = year;
12143 resDayOfYear = dayOfYear;
12144 }
12145
12146 return {
12147 year: resYear,
12148 dayOfYear: resDayOfYear
12149 };
12150 }
12151
12152 function weekOfYear(mom, dow, doy) {
12153 var weekOffset = firstWeekOffset(mom.year(), dow, doy),
12154 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
12155 resWeek,
12156 resYear;
12157
12158 if (week < 1) {
12159 resYear = mom.year() - 1;
12160 resWeek = week + weeksInYear(resYear, dow, doy);
12161 } else if (week > weeksInYear(mom.year(), dow, doy)) {
12162 resWeek = week - weeksInYear(mom.year(), dow, doy);
12163 resYear = mom.year() + 1;
12164 } else {
12165 resYear = mom.year();
12166 resWeek = week;
12167 }
12168
12169 return {
12170 week: resWeek,
12171 year: resYear
12172 };
12173 }
12174
12175 function weeksInYear(year, dow, doy) {
12176 var weekOffset = firstWeekOffset(year, dow, doy),
12177 weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
12178 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
12179 } // FORMATTING
12180
12181
12182 addFormatToken('w', ['ww', 2], 'wo', 'week');
12183 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES
12184
12185 addUnitAlias('week', 'w');
12186 addUnitAlias('isoWeek', 'W'); // PRIORITIES
12187
12188 addUnitPriority('week', 5);
12189 addUnitPriority('isoWeek', 5); // PARSING
12190
12191 addRegexToken('w', match1to2);
12192 addRegexToken('ww', match1to2, match2);
12193 addRegexToken('W', match1to2);
12194 addRegexToken('WW', match1to2, match2);
12195 addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
12196 week[token.substr(0, 1)] = toInt(input);
12197 }); // HELPERS
12198 // LOCALES
12199
12200 function localeWeek(mom) {
12201 return weekOfYear(mom, this._week.dow, this._week.doy).week;
12202 }
12203
12204 var defaultLocaleWeek = {
12205 dow: 0,
12206 // Sunday is the first day of the week.
12207 doy: 6 // The week that contains Jan 6th is the first week of the year.
12208
12209 };
12210
12211 function localeFirstDayOfWeek() {
12212 return this._week.dow;
12213 }
12214
12215 function localeFirstDayOfYear() {
12216 return this._week.doy;
12217 } // MOMENTS
12218
12219
12220 function getSetWeek(input) {
12221 var week = this.localeData().week(this);
12222 return input == null ? week : this.add((input - week) * 7, 'd');
12223 }
12224
12225 function getSetISOWeek(input) {
12226 var week = weekOfYear(this, 1, 4).week;
12227 return input == null ? week : this.add((input - week) * 7, 'd');
12228 } // FORMATTING
12229
12230
12231 addFormatToken('d', 0, 'do', 'day');
12232 addFormatToken('dd', 0, 0, function (format) {
12233 return this.localeData().weekdaysMin(this, format);
12234 });
12235 addFormatToken('ddd', 0, 0, function (format) {
12236 return this.localeData().weekdaysShort(this, format);
12237 });
12238 addFormatToken('dddd', 0, 0, function (format) {
12239 return this.localeData().weekdays(this, format);
12240 });
12241 addFormatToken('e', 0, 0, 'weekday');
12242 addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES
12243
12244 addUnitAlias('day', 'd');
12245 addUnitAlias('weekday', 'e');
12246 addUnitAlias('isoWeekday', 'E'); // PRIORITY
12247
12248 addUnitPriority('day', 11);
12249 addUnitPriority('weekday', 11);
12250 addUnitPriority('isoWeekday', 11); // PARSING
12251
12252 addRegexToken('d', match1to2);
12253 addRegexToken('e', match1to2);
12254 addRegexToken('E', match1to2);
12255 addRegexToken('dd', function (isStrict, locale) {
12256 return locale.weekdaysMinRegex(isStrict);
12257 });
12258 addRegexToken('ddd', function (isStrict, locale) {
12259 return locale.weekdaysShortRegex(isStrict);
12260 });
12261 addRegexToken('dddd', function (isStrict, locale) {
12262 return locale.weekdaysRegex(isStrict);
12263 });
12264 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
12265 var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid
12266
12267
12268 if (weekday != null) {
12269 week.d = weekday;
12270 } else {
12271 getParsingFlags(config).invalidWeekday = input;
12272 }
12273 });
12274 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
12275 week[token] = toInt(input);
12276 }); // HELPERS
12277
12278 function parseWeekday(input, locale) {
12279 if (typeof input !== 'string') {
12280 return input;
12281 }
12282
12283 if (!isNaN(input)) {
12284 return _parseInt$3$1(input, 10);
12285 }
12286
12287 input = locale.weekdaysParse(input);
12288
12289 if (typeof input === 'number') {
12290 return input;
12291 }
12292
12293 return null;
12294 }
12295
12296 function parseIsoWeekday(input, locale) {
12297 if (typeof input === 'string') {
12298 return locale.weekdaysParse(input) % 7 || 7;
12299 }
12300
12301 return isNaN(input) ? null : input;
12302 } // LOCALES
12303
12304
12305 function shiftWeekdays(ws, n) {
12306 var _context;
12307
12308 return concat$2$1$1(_context = slice$2$1(ws).call(ws, n, 7)).call(_context, slice$2$1(ws).call(ws, 0, n));
12309 }
12310
12311 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
12312
12313 function localeWeekdays(m, format) {
12314 var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone'];
12315 return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
12316 }
12317
12318 var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
12319
12320 function localeWeekdaysShort(m) {
12321 return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
12322 }
12323
12324 var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
12325
12326 function localeWeekdaysMin(m) {
12327 return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
12328 }
12329
12330 function handleStrictParse$1(weekdayName, format, strict) {
12331 var i,
12332 ii,
12333 mom,
12334 llc = weekdayName.toLocaleLowerCase();
12335
12336 if (!this._weekdaysParse) {
12337 this._weekdaysParse = [];
12338 this._shortWeekdaysParse = [];
12339 this._minWeekdaysParse = [];
12340
12341 for (i = 0; i < 7; ++i) {
12342 mom = createUTC([2000, 1]).day(i);
12343 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
12344 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
12345 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
12346 }
12347 }
12348
12349 if (strict) {
12350 if (format === 'dddd') {
12351 ii = indexOf.call(this._weekdaysParse, llc);
12352 return ii !== -1 ? ii : null;
12353 } else if (format === 'ddd') {
12354 ii = indexOf.call(this._shortWeekdaysParse, llc);
12355 return ii !== -1 ? ii : null;
12356 } else {
12357 ii = indexOf.call(this._minWeekdaysParse, llc);
12358 return ii !== -1 ? ii : null;
12359 }
12360 } else {
12361 if (format === 'dddd') {
12362 ii = indexOf.call(this._weekdaysParse, llc);
12363
12364 if (ii !== -1) {
12365 return ii;
12366 }
12367
12368 ii = indexOf.call(this._shortWeekdaysParse, llc);
12369
12370 if (ii !== -1) {
12371 return ii;
12372 }
12373
12374 ii = indexOf.call(this._minWeekdaysParse, llc);
12375 return ii !== -1 ? ii : null;
12376 } else if (format === 'ddd') {
12377 ii = indexOf.call(this._shortWeekdaysParse, llc);
12378
12379 if (ii !== -1) {
12380 return ii;
12381 }
12382
12383 ii = indexOf.call(this._weekdaysParse, llc);
12384
12385 if (ii !== -1) {
12386 return ii;
12387 }
12388
12389 ii = indexOf.call(this._minWeekdaysParse, llc);
12390 return ii !== -1 ? ii : null;
12391 } else {
12392 ii = indexOf.call(this._minWeekdaysParse, llc);
12393
12394 if (ii !== -1) {
12395 return ii;
12396 }
12397
12398 ii = indexOf.call(this._weekdaysParse, llc);
12399
12400 if (ii !== -1) {
12401 return ii;
12402 }
12403
12404 ii = indexOf.call(this._shortWeekdaysParse, llc);
12405 return ii !== -1 ? ii : null;
12406 }
12407 }
12408 }
12409
12410 function localeWeekdaysParse(weekdayName, format, strict) {
12411 var i, mom, regex;
12412
12413 if (this._weekdaysParseExact) {
12414 return handleStrictParse$1.call(this, weekdayName, format, strict);
12415 }
12416
12417 if (!this._weekdaysParse) {
12418 this._weekdaysParse = [];
12419 this._minWeekdaysParse = [];
12420 this._shortWeekdaysParse = [];
12421 this._fullWeekdaysParse = [];
12422 }
12423
12424 for (i = 0; i < 7; i++) {
12425 // make the regex if we don't have it already
12426 mom = createUTC([2000, 1]).day(i);
12427
12428 if (strict && !this._fullWeekdaysParse[i]) {
12429 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
12430 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
12431 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
12432 }
12433
12434 if (!this._weekdaysParse[i]) {
12435 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
12436 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
12437 } // test the regex
12438
12439
12440 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
12441 return i;
12442 } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
12443 return i;
12444 } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
12445 return i;
12446 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
12447 return i;
12448 }
12449 }
12450 } // MOMENTS
12451
12452
12453 function getSetDayOfWeek(input) {
12454 if (!this.isValid()) {
12455 return input != null ? this : NaN;
12456 }
12457
12458 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
12459
12460 if (input != null) {
12461 input = parseWeekday(input, this.localeData());
12462 return this.add(input - day, 'd');
12463 } else {
12464 return day;
12465 }
12466 }
12467
12468 function getSetLocaleDayOfWeek(input) {
12469 if (!this.isValid()) {
12470 return input != null ? this : NaN;
12471 }
12472
12473 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
12474 return input == null ? weekday : this.add(input - weekday, 'd');
12475 }
12476
12477 function getSetISODayOfWeek(input) {
12478 if (!this.isValid()) {
12479 return input != null ? this : NaN;
12480 } // behaves the same as moment#day except
12481 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
12482 // as a setter, sunday should belong to the previous week.
12483
12484
12485 if (input != null) {
12486 var weekday = parseIsoWeekday(input, this.localeData());
12487 return this.day(this.day() % 7 ? weekday : weekday - 7);
12488 } else {
12489 return this.day() || 7;
12490 }
12491 }
12492
12493 var defaultWeekdaysRegex = matchWord;
12494
12495 function weekdaysRegex(isStrict) {
12496 if (this._weekdaysParseExact) {
12497 if (!hasOwnProp(this, '_weekdaysRegex')) {
12498 computeWeekdaysParse.call(this);
12499 }
12500
12501 if (isStrict) {
12502 return this._weekdaysStrictRegex;
12503 } else {
12504 return this._weekdaysRegex;
12505 }
12506 } else {
12507 if (!hasOwnProp(this, '_weekdaysRegex')) {
12508 this._weekdaysRegex = defaultWeekdaysRegex;
12509 }
12510
12511 return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
12512 }
12513 }
12514
12515 var defaultWeekdaysShortRegex = matchWord;
12516
12517 function weekdaysShortRegex(isStrict) {
12518 if (this._weekdaysParseExact) {
12519 if (!hasOwnProp(this, '_weekdaysRegex')) {
12520 computeWeekdaysParse.call(this);
12521 }
12522
12523 if (isStrict) {
12524 return this._weekdaysShortStrictRegex;
12525 } else {
12526 return this._weekdaysShortRegex;
12527 }
12528 } else {
12529 if (!hasOwnProp(this, '_weekdaysShortRegex')) {
12530 this._weekdaysShortRegex = defaultWeekdaysShortRegex;
12531 }
12532
12533 return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
12534 }
12535 }
12536
12537 var defaultWeekdaysMinRegex = matchWord;
12538
12539 function weekdaysMinRegex(isStrict) {
12540 if (this._weekdaysParseExact) {
12541 if (!hasOwnProp(this, '_weekdaysRegex')) {
12542 computeWeekdaysParse.call(this);
12543 }
12544
12545 if (isStrict) {
12546 return this._weekdaysMinStrictRegex;
12547 } else {
12548 return this._weekdaysMinRegex;
12549 }
12550 } else {
12551 if (!hasOwnProp(this, '_weekdaysMinRegex')) {
12552 this._weekdaysMinRegex = defaultWeekdaysMinRegex;
12553 }
12554
12555 return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
12556 }
12557 }
12558
12559 function computeWeekdaysParse() {
12560 function cmpLenRev(a, b) {
12561 return b.length - a.length;
12562 }
12563
12564 var minPieces = [],
12565 shortPieces = [],
12566 longPieces = [],
12567 mixedPieces = [],
12568 i,
12569 mom,
12570 minp,
12571 shortp,
12572 longp;
12573
12574 for (i = 0; i < 7; i++) {
12575 // make the regex if we don't have it already
12576 mom = createUTC([2000, 1]).day(i);
12577 minp = this.weekdaysMin(mom, '');
12578 shortp = this.weekdaysShort(mom, '');
12579 longp = this.weekdays(mom, '');
12580 minPieces.push(minp);
12581 shortPieces.push(shortp);
12582 longPieces.push(longp);
12583 mixedPieces.push(minp);
12584 mixedPieces.push(shortp);
12585 mixedPieces.push(longp);
12586 } // Sorting makes sure if one weekday (or abbr) is a prefix of another it
12587 // will match the longer piece.
12588
12589
12590 sort$2$1(minPieces).call(minPieces, cmpLenRev);
12591 sort$2$1(shortPieces).call(shortPieces, cmpLenRev);
12592 sort$2$1(longPieces).call(longPieces, cmpLenRev);
12593 sort$2$1(mixedPieces).call(mixedPieces, cmpLenRev);
12594
12595 for (i = 0; i < 7; i++) {
12596 shortPieces[i] = regexEscape(shortPieces[i]);
12597 longPieces[i] = regexEscape(longPieces[i]);
12598 mixedPieces[i] = regexEscape(mixedPieces[i]);
12599 }
12600
12601 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
12602 this._weekdaysShortRegex = this._weekdaysRegex;
12603 this._weekdaysMinRegex = this._weekdaysRegex;
12604 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
12605 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
12606 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
12607 } // FORMATTING
12608
12609
12610 function hFormat() {
12611 return this.hours() % 12 || 12;
12612 }
12613
12614 function kFormat() {
12615 return this.hours() || 24;
12616 }
12617
12618 addFormatToken('H', ['HH', 2], 0, 'hour');
12619 addFormatToken('h', ['hh', 2], 0, hFormat);
12620 addFormatToken('k', ['kk', 2], 0, kFormat);
12621 addFormatToken('hmm', 0, 0, function () {
12622 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
12623 });
12624 addFormatToken('hmmss', 0, 0, function () {
12625 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
12626 });
12627 addFormatToken('Hmm', 0, 0, function () {
12628 return '' + this.hours() + zeroFill(this.minutes(), 2);
12629 });
12630 addFormatToken('Hmmss', 0, 0, function () {
12631 return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
12632 });
12633
12634 function meridiem(token, lowercase) {
12635 addFormatToken(token, 0, 0, function () {
12636 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
12637 });
12638 }
12639
12640 meridiem('a', true);
12641 meridiem('A', false); // ALIASES
12642
12643 addUnitAlias('hour', 'h'); // PRIORITY
12644
12645 addUnitPriority('hour', 13); // PARSING
12646
12647 function matchMeridiem(isStrict, locale) {
12648 return locale._meridiemParse;
12649 }
12650
12651 addRegexToken('a', matchMeridiem);
12652 addRegexToken('A', matchMeridiem);
12653 addRegexToken('H', match1to2);
12654 addRegexToken('h', match1to2);
12655 addRegexToken('k', match1to2);
12656 addRegexToken('HH', match1to2, match2);
12657 addRegexToken('hh', match1to2, match2);
12658 addRegexToken('kk', match1to2, match2);
12659 addRegexToken('hmm', match3to4);
12660 addRegexToken('hmmss', match5to6);
12661 addRegexToken('Hmm', match3to4);
12662 addRegexToken('Hmmss', match5to6);
12663 addParseToken(['H', 'HH'], HOUR);
12664 addParseToken(['k', 'kk'], function (input, array, config) {
12665 var kInput = toInt(input);
12666 array[HOUR] = kInput === 24 ? 0 : kInput;
12667 });
12668 addParseToken(['a', 'A'], function (input, array, config) {
12669 config._isPm = config._locale.isPM(input);
12670 config._meridiem = input;
12671 });
12672 addParseToken(['h', 'hh'], function (input, array, config) {
12673 array[HOUR] = toInt(input);
12674 getParsingFlags(config).bigHour = true;
12675 });
12676 addParseToken('hmm', function (input, array, config) {
12677 var pos = input.length - 2;
12678 array[HOUR] = toInt(input.substr(0, pos));
12679 array[MINUTE] = toInt(input.substr(pos));
12680 getParsingFlags(config).bigHour = true;
12681 });
12682 addParseToken('hmmss', function (input, array, config) {
12683 var pos1 = input.length - 4;
12684 var pos2 = input.length - 2;
12685 array[HOUR] = toInt(input.substr(0, pos1));
12686 array[MINUTE] = toInt(input.substr(pos1, 2));
12687 array[SECOND] = toInt(input.substr(pos2));
12688 getParsingFlags(config).bigHour = true;
12689 });
12690 addParseToken('Hmm', function (input, array, config) {
12691 var pos = input.length - 2;
12692 array[HOUR] = toInt(input.substr(0, pos));
12693 array[MINUTE] = toInt(input.substr(pos));
12694 });
12695 addParseToken('Hmmss', function (input, array, config) {
12696 var pos1 = input.length - 4;
12697 var pos2 = input.length - 2;
12698 array[HOUR] = toInt(input.substr(0, pos1));
12699 array[MINUTE] = toInt(input.substr(pos1, 2));
12700 array[SECOND] = toInt(input.substr(pos2));
12701 }); // LOCALES
12702
12703 function localeIsPM(input) {
12704 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
12705 // Using charAt should be more compatible.
12706 return (input + '').toLowerCase().charAt(0) === 'p';
12707 }
12708
12709 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
12710
12711 function localeMeridiem(hours, minutes, isLower) {
12712 if (hours > 11) {
12713 return isLower ? 'pm' : 'PM';
12714 } else {
12715 return isLower ? 'am' : 'AM';
12716 }
12717 } // MOMENTS
12718 // Setting the hour should keep the time, because the user explicitly
12719 // specified which hour they want. So trying to maintain the same hour (in
12720 // a new timezone) makes sense. Adding/subtracting hours does not follow
12721 // this rule.
12722
12723
12724 var getSetHour = makeGetSet('Hours', true);
12725 var baseConfig = {
12726 calendar: defaultCalendar,
12727 longDateFormat: defaultLongDateFormat,
12728 invalidDate: defaultInvalidDate,
12729 ordinal: defaultOrdinal,
12730 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
12731 relativeTime: defaultRelativeTime,
12732 months: defaultLocaleMonths,
12733 monthsShort: defaultLocaleMonthsShort,
12734 week: defaultLocaleWeek,
12735 weekdays: defaultLocaleWeekdays,
12736 weekdaysMin: defaultLocaleWeekdaysMin,
12737 weekdaysShort: defaultLocaleWeekdaysShort,
12738 meridiemParse: defaultLocaleMeridiemParse
12739 }; // internal storage for locale config files
12740
12741 var locales = {};
12742 var localeFamilies = {};
12743 var globalLocale;
12744
12745 function normalizeLocale(key) {
12746 return key ? key.toLowerCase().replace('_', '-') : key;
12747 } // pick the locale from the array
12748 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
12749 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
12750
12751
12752 function chooseLocale(names) {
12753 var i = 0,
12754 j,
12755 next,
12756 locale,
12757 split;
12758
12759 while (i < names.length) {
12760 split = normalizeLocale(names[i]).split('-');
12761 j = split.length;
12762 next = normalizeLocale(names[i + 1]);
12763 next = next ? next.split('-') : null;
12764
12765 while (j > 0) {
12766 locale = loadLocale(slice$2$1(split).call(split, 0, j).join('-'));
12767
12768 if (locale) {
12769 return locale;
12770 }
12771
12772 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
12773 //the next array item is better than a shallower substring of this one
12774 break;
12775 }
12776
12777 j--;
12778 }
12779
12780 i++;
12781 }
12782
12783 return globalLocale;
12784 }
12785
12786 function loadLocale(name) {
12787 var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node
12788
12789 if (!locales[name] && 'object' !== 'undefined' && module && module.exports) {
12790 try {
12791 oldLocale = globalLocale._abbr;
12792 var aliasedRequire = commonjsRequire$1;
12793 aliasedRequire('./locale/' + name);
12794 getSetGlobalLocale(oldLocale);
12795 } catch (e) {}
12796 }
12797
12798 return locales[name];
12799 } // This function will load locale and then set the global locale. If
12800 // no arguments are passed in, it will simply return the current global
12801 // locale key.
12802
12803
12804 function getSetGlobalLocale(key, values) {
12805 var data;
12806
12807 if (key) {
12808 if (isUndefined(values)) {
12809 data = getLocale(key);
12810 } else {
12811 data = defineLocale(key, values);
12812 }
12813
12814 if (data) {
12815 // moment.duration._locale = moment._locale = data;
12816 globalLocale = data;
12817 } else {
12818 if (typeof console !== 'undefined' && console.warn) {
12819 //warn user if arguments are passed but the locale could not be set
12820 console.warn('Locale ' + key + ' not found. Did you forget to load it?');
12821 }
12822 }
12823 }
12824
12825 return globalLocale._abbr;
12826 }
12827
12828 function defineLocale(name, config) {
12829 if (config !== null) {
12830 var locale,
12831 parentConfig = baseConfig;
12832 config.abbr = name;
12833
12834 if (locales[name] != null) {
12835 deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
12836 parentConfig = locales[name]._config;
12837 } else if (config.parentLocale != null) {
12838 if (locales[config.parentLocale] != null) {
12839 parentConfig = locales[config.parentLocale]._config;
12840 } else {
12841 locale = loadLocale(config.parentLocale);
12842
12843 if (locale != null) {
12844 parentConfig = locale._config;
12845 } else {
12846 if (!localeFamilies[config.parentLocale]) {
12847 localeFamilies[config.parentLocale] = [];
12848 }
12849
12850 localeFamilies[config.parentLocale].push({
12851 name: name,
12852 config: config
12853 });
12854 return null;
12855 }
12856 }
12857 }
12858
12859 locales[name] = new Locale(mergeConfigs(parentConfig, config));
12860
12861 if (localeFamilies[name]) {
12862 var _context2;
12863
12864 forEach$2$1$1(_context2 = localeFamilies[name]).call(_context2, function (x) {
12865 defineLocale(x.name, x.config);
12866 });
12867 } // backwards compat for now: also set the locale
12868 // make sure we set the locale AFTER all child locales have been
12869 // created, so we won't end up with the child locale set.
12870
12871
12872 getSetGlobalLocale(name);
12873 return locales[name];
12874 } else {
12875 // useful for testing
12876 delete locales[name];
12877 return null;
12878 }
12879 }
12880
12881 function updateLocale(name, config) {
12882 if (config != null) {
12883 var locale,
12884 tmpLocale,
12885 parentConfig = baseConfig; // MERGE
12886
12887 tmpLocale = loadLocale(name);
12888
12889 if (tmpLocale != null) {
12890 parentConfig = tmpLocale._config;
12891 }
12892
12893 config = mergeConfigs(parentConfig, config);
12894 locale = new Locale(config);
12895 locale.parentLocale = locales[name];
12896 locales[name] = locale; // backwards compat for now: also set the locale
12897
12898 getSetGlobalLocale(name);
12899 } else {
12900 // pass null for config to unupdate, useful for tests
12901 if (locales[name] != null) {
12902 if (locales[name].parentLocale != null) {
12903 locales[name] = locales[name].parentLocale;
12904 } else if (locales[name] != null) {
12905 delete locales[name];
12906 }
12907 }
12908 }
12909
12910 return locales[name];
12911 } // returns locale data
12912
12913
12914 function getLocale(key) {
12915 var locale;
12916
12917 if (key && key._locale && key._locale._abbr) {
12918 key = key._locale._abbr;
12919 }
12920
12921 if (!key) {
12922 return globalLocale;
12923 }
12924
12925 if (!isArray(key)) {
12926 //short-circuit everything else
12927 locale = loadLocale(key);
12928
12929 if (locale) {
12930 return locale;
12931 }
12932
12933 key = [key];
12934 }
12935
12936 return chooseLocale(key);
12937 }
12938
12939 function listLocales() {
12940 return keys(locales);
12941 }
12942
12943 function checkOverflow(m) {
12944 var overflow;
12945 var a = m._a;
12946
12947 if (a && getParsingFlags(m).overflow === -2) {
12948 overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
12949
12950 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
12951 overflow = DATE;
12952 }
12953
12954 if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
12955 overflow = WEEK;
12956 }
12957
12958 if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
12959 overflow = WEEKDAY;
12960 }
12961
12962 getParsingFlags(m).overflow = overflow;
12963 }
12964
12965 return m;
12966 } // Pick the first defined of two or three arguments.
12967
12968
12969 function defaults(a, b, c) {
12970 if (a != null) {
12971 return a;
12972 }
12973
12974 if (b != null) {
12975 return b;
12976 }
12977
12978 return c;
12979 }
12980
12981 function currentDateArray(config) {
12982 // hooks is actually the exported moment object
12983 var nowValue = new Date(hooks.now());
12984
12985 if (config._useUTC) {
12986 return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
12987 }
12988
12989 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
12990 } // convert an array to a date.
12991 // the array should mirror the parameters below
12992 // note: all values past the year are optional and will default to the lowest possible value.
12993 // [year, month, day , hour, minute, second, millisecond]
12994
12995
12996 function configFromArray(config) {
12997 var i,
12998 date,
12999 input = [],
13000 currentDate,
13001 expectedWeekday,
13002 yearToUse;
13003
13004 if (config._d) {
13005 return;
13006 }
13007
13008 currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays
13009
13010 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
13011 dayOfYearFromWeekInfo(config);
13012 } //if the day of the year is set, figure out what it is
13013
13014
13015 if (config._dayOfYear != null) {
13016 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
13017
13018 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
13019 getParsingFlags(config)._overflowDayOfYear = true;
13020 }
13021
13022 date = createUTCDate(yearToUse, 0, config._dayOfYear);
13023 config._a[MONTH] = date.getUTCMonth();
13024 config._a[DATE] = date.getUTCDate();
13025 } // Default to current date.
13026 // * if no year, month, day of month are given, default to today
13027 // * if day of month is given, default month and year
13028 // * if month is given, default only year
13029 // * if year is given, don't default anything
13030
13031
13032 for (i = 0; i < 3 && config._a[i] == null; ++i) {
13033 config._a[i] = input[i] = currentDate[i];
13034 } // Zero out whatever was not defaulted, including time
13035
13036
13037 for (; i < 7; i++) {
13038 config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
13039 } // Check for 24:00:00.000
13040
13041
13042 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
13043 config._nextDay = true;
13044 config._a[HOUR] = 0;
13045 }
13046
13047 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
13048 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed
13049 // with parseZone.
13050
13051 if (config._tzm != null) {
13052 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
13053 }
13054
13055 if (config._nextDay) {
13056 config._a[HOUR] = 24;
13057 } // check for mismatching day of week
13058
13059
13060 if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
13061 getParsingFlags(config).weekdayMismatch = true;
13062 }
13063 }
13064
13065 function dayOfYearFromWeekInfo(config) {
13066 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
13067 w = config._w;
13068
13069 if (w.GG != null || w.W != null || w.E != null) {
13070 dow = 1;
13071 doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on
13072 // how we interpret now (local, utc, fixed offset). So create
13073 // a now version of current config (take local/utc/offset flags, and
13074 // create now).
13075
13076 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
13077 week = defaults(w.W, 1);
13078 weekday = defaults(w.E, 1);
13079
13080 if (weekday < 1 || weekday > 7) {
13081 weekdayOverflow = true;
13082 }
13083 } else {
13084 dow = config._locale._week.dow;
13085 doy = config._locale._week.doy;
13086 var curWeek = weekOfYear(createLocal(), dow, doy);
13087 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week.
13088
13089 week = defaults(w.w, curWeek.week);
13090
13091 if (w.d != null) {
13092 // weekday -- low day numbers are considered next week
13093 weekday = w.d;
13094
13095 if (weekday < 0 || weekday > 6) {
13096 weekdayOverflow = true;
13097 }
13098 } else if (w.e != null) {
13099 // local weekday -- counting starts from beginning of week
13100 weekday = w.e + dow;
13101
13102 if (w.e < 0 || w.e > 6) {
13103 weekdayOverflow = true;
13104 }
13105 } else {
13106 // default to beginning of week
13107 weekday = dow;
13108 }
13109 }
13110
13111 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
13112 getParsingFlags(config)._overflowWeeks = true;
13113 } else if (weekdayOverflow != null) {
13114 getParsingFlags(config)._overflowWeekday = true;
13115 } else {
13116 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
13117 config._a[YEAR] = temp.year;
13118 config._dayOfYear = temp.dayOfYear;
13119 }
13120 } // iso 8601 regex
13121 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
13122
13123
13124 var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
13125 var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
13126 var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
13127 var isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard
13128 ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/]]; // iso time formats and regexes
13129
13130 var isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]];
13131 var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format
13132
13133 function configFromISO(config) {
13134 var i,
13135 l,
13136 string = config._i,
13137 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
13138 allowTime,
13139 dateFormat,
13140 timeFormat,
13141 tzFormat;
13142
13143 if (match) {
13144 getParsingFlags(config).iso = true;
13145
13146 for (i = 0, l = isoDates.length; i < l; i++) {
13147 if (isoDates[i][1].exec(match[1])) {
13148 dateFormat = isoDates[i][0];
13149 allowTime = isoDates[i][2] !== false;
13150 break;
13151 }
13152 }
13153
13154 if (dateFormat == null) {
13155 config._isValid = false;
13156 return;
13157 }
13158
13159 if (match[3]) {
13160 for (i = 0, l = isoTimes.length; i < l; i++) {
13161 if (isoTimes[i][1].exec(match[3])) {
13162 // match[2] should be 'T' or space
13163 timeFormat = (match[2] || ' ') + isoTimes[i][0];
13164 break;
13165 }
13166 }
13167
13168 if (timeFormat == null) {
13169 config._isValid = false;
13170 return;
13171 }
13172 }
13173
13174 if (!allowTime && timeFormat != null) {
13175 config._isValid = false;
13176 return;
13177 }
13178
13179 if (match[4]) {
13180 if (tzRegex.exec(match[4])) {
13181 tzFormat = 'Z';
13182 } else {
13183 config._isValid = false;
13184 return;
13185 }
13186 }
13187
13188 config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
13189 configFromStringAndFormat(config);
13190 } else {
13191 config._isValid = false;
13192 }
13193 } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
13194
13195
13196 var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
13197
13198 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
13199 var result = [untruncateYear(yearStr), indexOf$3$1(defaultLocaleMonthsShort).call(defaultLocaleMonthsShort, monthStr), _parseInt$3$1(dayStr, 10), _parseInt$3$1(hourStr, 10), _parseInt$3$1(minuteStr, 10)];
13200
13201 if (secondStr) {
13202 result.push(_parseInt$3$1(secondStr, 10));
13203 }
13204
13205 return result;
13206 }
13207
13208 function untruncateYear(yearStr) {
13209 var year = _parseInt$3$1(yearStr, 10);
13210
13211 if (year <= 49) {
13212 return 2000 + year;
13213 } else if (year <= 999) {
13214 return 1900 + year;
13215 }
13216
13217 return year;
13218 }
13219
13220 function preprocessRFC2822(s) {
13221 // Remove comments and folding whitespace and replace multiple-spaces with a single space
13222 return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
13223 }
13224
13225 function checkWeekday(weekdayStr, parsedInput, config) {
13226 if (weekdayStr) {
13227 // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
13228 var weekdayProvided = indexOf$3$1(defaultLocaleWeekdaysShort).call(defaultLocaleWeekdaysShort, weekdayStr),
13229 weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
13230
13231 if (weekdayProvided !== weekdayActual) {
13232 getParsingFlags(config).weekdayMismatch = true;
13233 config._isValid = false;
13234 return false;
13235 }
13236 }
13237
13238 return true;
13239 }
13240
13241 var obsOffsets = {
13242 UT: 0,
13243 GMT: 0,
13244 EDT: -4 * 60,
13245 EST: -5 * 60,
13246 CDT: -5 * 60,
13247 CST: -6 * 60,
13248 MDT: -6 * 60,
13249 MST: -7 * 60,
13250 PDT: -7 * 60,
13251 PST: -8 * 60
13252 };
13253
13254 function calculateOffset(obsOffset, militaryOffset, numOffset) {
13255 if (obsOffset) {
13256 return obsOffsets[obsOffset];
13257 } else if (militaryOffset) {
13258 // the only allowed military tz is Z
13259 return 0;
13260 } else {
13261 var hm = _parseInt$3$1(numOffset, 10);
13262
13263 var m = hm % 100,
13264 h = (hm - m) / 100;
13265 return h * 60 + m;
13266 }
13267 } // date and time from ref 2822 format
13268
13269
13270 function configFromRFC2822(config) {
13271 var match = rfc2822.exec(preprocessRFC2822(config._i));
13272
13273 if (match) {
13274 var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
13275
13276 if (!checkWeekday(match[1], parsedArray, config)) {
13277 return;
13278 }
13279
13280 config._a = parsedArray;
13281 config._tzm = calculateOffset(match[8], match[9], match[10]);
13282 config._d = createUTCDate.apply(null, config._a);
13283
13284 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
13285
13286 getParsingFlags(config).rfc2822 = true;
13287 } else {
13288 config._isValid = false;
13289 }
13290 } // date from iso format or fallback
13291
13292
13293 function configFromString(config) {
13294 var matched = aspNetJsonRegex.exec(config._i);
13295
13296 if (matched !== null) {
13297 config._d = new Date(+matched[1]);
13298 return;
13299 }
13300
13301 configFromISO(config);
13302
13303 if (config._isValid === false) {
13304 delete config._isValid;
13305 } else {
13306 return;
13307 }
13308
13309 configFromRFC2822(config);
13310
13311 if (config._isValid === false) {
13312 delete config._isValid;
13313 } else {
13314 return;
13315 } // Final attempt, use Input Fallback
13316
13317
13318 hooks.createFromInputFallback(config);
13319 }
13320
13321 hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) {
13322 config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
13323 }); // constant that refers to the ISO standard
13324
13325 hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form
13326
13327
13328 hooks.RFC_2822 = function () {}; // date from string and format string
13329
13330
13331 function configFromStringAndFormat(config) {
13332 var _context3; // TODO: Move this to another part of the creation flow to prevent circular deps
13333
13334
13335 if (config._f === hooks.ISO_8601) {
13336 configFromISO(config);
13337 return;
13338 }
13339
13340 if (config._f === hooks.RFC_2822) {
13341 configFromRFC2822(config);
13342 return;
13343 }
13344
13345 config._a = [];
13346 getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC`
13347
13348 var string = '' + config._i,
13349 i,
13350 parsedInput,
13351 tokens,
13352 token,
13353 skipped,
13354 stringLength = string.length,
13355 totalParsedInputLength = 0;
13356 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
13357
13358 for (i = 0; i < tokens.length; i++) {
13359 token = tokens[i];
13360 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput,
13361 // 'regex', getParseRegexForToken(token, config));
13362
13363 if (parsedInput) {
13364 skipped = string.substr(0, indexOf$3$1(string).call(string, parsedInput));
13365
13366 if (skipped.length > 0) {
13367 getParsingFlags(config).unusedInput.push(skipped);
13368 }
13369
13370 string = slice$2$1(string).call(string, indexOf$3$1(string).call(string, parsedInput) + parsedInput.length);
13371 totalParsedInputLength += parsedInput.length;
13372 } // don't parse if it's not a known token
13373
13374
13375 if (formatTokenFunctions[token]) {
13376 if (parsedInput) {
13377 getParsingFlags(config).empty = false;
13378 } else {
13379 getParsingFlags(config).unusedTokens.push(token);
13380 }
13381
13382 addTimeToArrayFromToken(token, parsedInput, config);
13383 } else if (config._strict && !parsedInput) {
13384 getParsingFlags(config).unusedTokens.push(token);
13385 }
13386 } // add remaining unparsed input length to the string
13387
13388
13389 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
13390
13391 if (string.length > 0) {
13392 getParsingFlags(config).unusedInput.push(string);
13393 } // clear _12h flag if hour is <= 12
13394
13395
13396 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
13397 getParsingFlags(config).bigHour = undefined;
13398 }
13399
13400 getParsingFlags(config).parsedDateParts = slice$2$1(_context3 = config._a).call(_context3, 0);
13401 getParsingFlags(config).meridiem = config._meridiem; // handle meridiem
13402
13403 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
13404 configFromArray(config);
13405 checkOverflow(config);
13406 }
13407
13408 function meridiemFixWrap(locale, hour, meridiem) {
13409 var isPm;
13410
13411 if (meridiem == null) {
13412 // nothing to do
13413 return hour;
13414 }
13415
13416 if (locale.meridiemHour != null) {
13417 return locale.meridiemHour(hour, meridiem);
13418 } else if (locale.isPM != null) {
13419 // Fallback
13420 isPm = locale.isPM(meridiem);
13421
13422 if (isPm && hour < 12) {
13423 hour += 12;
13424 }
13425
13426 if (!isPm && hour === 12) {
13427 hour = 0;
13428 }
13429
13430 return hour;
13431 } else {
13432 // this is not supposed to happen
13433 return hour;
13434 }
13435 } // date from string and array of format strings
13436
13437
13438 function configFromStringAndArray(config) {
13439 var tempConfig, bestMoment, scoreToBeat, i, currentScore;
13440
13441 if (config._f.length === 0) {
13442 getParsingFlags(config).invalidFormat = true;
13443 config._d = new Date(NaN);
13444 return;
13445 }
13446
13447 for (i = 0; i < config._f.length; i++) {
13448 currentScore = 0;
13449 tempConfig = copyConfig({}, config);
13450
13451 if (config._useUTC != null) {
13452 tempConfig._useUTC = config._useUTC;
13453 }
13454
13455 tempConfig._f = config._f[i];
13456 configFromStringAndFormat(tempConfig);
13457
13458 if (!isValid(tempConfig)) {
13459 continue;
13460 } // if there is any input that was not parsed add a penalty for that format
13461
13462
13463 currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens
13464
13465 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
13466 getParsingFlags(tempConfig).score = currentScore;
13467
13468 if (scoreToBeat == null || currentScore < scoreToBeat) {
13469 scoreToBeat = currentScore;
13470 bestMoment = tempConfig;
13471 }
13472 }
13473
13474 extend(config, bestMoment || tempConfig);
13475 }
13476
13477 function configFromObject(config) {
13478 if (config._d) {
13479 return;
13480 }
13481
13482 var i = normalizeObjectUnits(config._i);
13483 config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
13484 return obj && _parseInt$3$1(obj, 10);
13485 });
13486 configFromArray(config);
13487 }
13488
13489 function createFromConfig(config) {
13490 var res = new Moment(checkOverflow(prepareConfig(config)));
13491
13492 if (res._nextDay) {
13493 // Adding is smart enough around DST
13494 res.add(1, 'd');
13495 res._nextDay = undefined;
13496 }
13497
13498 return res;
13499 }
13500
13501 function prepareConfig(config) {
13502 var input = config._i,
13503 format = config._f;
13504 config._locale = config._locale || getLocale(config._l);
13505
13506 if (input === null || format === undefined && input === '') {
13507 return createInvalid({
13508 nullInput: true
13509 });
13510 }
13511
13512 if (typeof input === 'string') {
13513 config._i = input = config._locale.preparse(input);
13514 }
13515
13516 if (isMoment(input)) {
13517 return new Moment(checkOverflow(input));
13518 } else if (isDate(input)) {
13519 config._d = input;
13520 } else if (isArray(format)) {
13521 configFromStringAndArray(config);
13522 } else if (format) {
13523 configFromStringAndFormat(config);
13524 } else {
13525 configFromInput(config);
13526 }
13527
13528 if (!isValid(config)) {
13529 config._d = null;
13530 }
13531
13532 return config;
13533 }
13534
13535 function configFromInput(config) {
13536 var input = config._i;
13537
13538 if (isUndefined(input)) {
13539 config._d = new Date(hooks.now());
13540 } else if (isDate(input)) {
13541 config._d = new Date(input.valueOf());
13542 } else if (typeof input === 'string') {
13543 configFromString(config);
13544 } else if (isArray(input)) {
13545 config._a = map(slice$2$1(input).call(input, 0), function (obj) {
13546 return _parseInt$3$1(obj, 10);
13547 });
13548 configFromArray(config);
13549 } else if (isObject(input)) {
13550 configFromObject(config);
13551 } else if (isNumber(input)) {
13552 // from milliseconds
13553 config._d = new Date(input);
13554 } else {
13555 hooks.createFromInputFallback(config);
13556 }
13557 }
13558
13559 function createLocalOrUTC(input, format, locale, strict, isUTC) {
13560 var c = {};
13561
13562 if (locale === true || locale === false) {
13563 strict = locale;
13564 locale = undefined;
13565 }
13566
13567 if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
13568 input = undefined;
13569 } // object construction must be done this way.
13570 // https://github.com/moment/moment/issues/1423
13571
13572
13573 c._isAMomentObject = true;
13574 c._useUTC = c._isUTC = isUTC;
13575 c._l = locale;
13576 c._i = input;
13577 c._f = format;
13578 c._strict = strict;
13579 return createFromConfig(c);
13580 }
13581
13582 function createLocal(input, format, locale, strict) {
13583 return createLocalOrUTC(input, format, locale, strict, false);
13584 }
13585
13586 var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
13587 var other = createLocal.apply(null, arguments);
13588
13589 if (this.isValid() && other.isValid()) {
13590 return other < this ? this : other;
13591 } else {
13592 return createInvalid();
13593 }
13594 });
13595 var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
13596 var other = createLocal.apply(null, arguments);
13597
13598 if (this.isValid() && other.isValid()) {
13599 return other > this ? this : other;
13600 } else {
13601 return createInvalid();
13602 }
13603 }); // Pick a moment m from moments so that m[fn](other) is true for all
13604 // other. This relies on the function fn to be transitive.
13605 //
13606 // moments should either be an array of moment objects or an array, whose
13607 // first element is an array of moment objects.
13608
13609 function pickBy(fn, moments) {
13610 var res, i;
13611
13612 if (moments.length === 1 && isArray(moments[0])) {
13613 moments = moments[0];
13614 }
13615
13616 if (!moments.length) {
13617 return createLocal();
13618 }
13619
13620 res = moments[0];
13621
13622 for (i = 1; i < moments.length; ++i) {
13623 if (!moments[i].isValid() || moments[i][fn](res)) {
13624 res = moments[i];
13625 }
13626 }
13627
13628 return res;
13629 } // TODO: Use [].sort instead?
13630
13631
13632 function min() {
13633 var args = slice$2$1([]).call(arguments, 0);
13634 return pickBy('isBefore', args);
13635 }
13636
13637 function max() {
13638 var args = slice$2$1([]).call(arguments, 0);
13639 return pickBy('isAfter', args);
13640 }
13641
13642 var now = function now() {
13643 return now$2 ? now$2() : +new Date();
13644 };
13645
13646 var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
13647
13648 function isDurationValid(m) {
13649 for (var key in m) {
13650 if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
13651 return false;
13652 }
13653 }
13654
13655 var unitHasDecimal = false;
13656
13657 for (var i = 0; i < ordering.length; ++i) {
13658 if (m[ordering[i]]) {
13659 if (unitHasDecimal) {
13660 return false; // only allow non-integers for smallest unit
13661 }
13662
13663 if (_parseFloat$3(m[ordering[i]]) !== toInt(m[ordering[i]])) {
13664 unitHasDecimal = true;
13665 }
13666 }
13667 }
13668
13669 return true;
13670 }
13671
13672 function isValid$1() {
13673 return this._isValid;
13674 }
13675
13676 function createInvalid$1() {
13677 return createDuration(NaN);
13678 }
13679
13680 function Duration(duration) {
13681 var normalizedInput = normalizeObjectUnits(duration),
13682 years = normalizedInput.year || 0,
13683 quarters = normalizedInput.quarter || 0,
13684 months = normalizedInput.month || 0,
13685 weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
13686 days = normalizedInput.day || 0,
13687 hours = normalizedInput.hour || 0,
13688 minutes = normalizedInput.minute || 0,
13689 seconds = normalizedInput.second || 0,
13690 milliseconds = normalizedInput.millisecond || 0;
13691 this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove
13692
13693 this._milliseconds = +milliseconds + seconds * 1e3 + // 1000
13694 minutes * 6e4 + // 1000 * 60
13695 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
13696 // Because of dateAddRemove treats 24 hours as different from a
13697 // day when working around DST, we need to store them separately
13698
13699 this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing
13700 // which months you are are talking about, so we have to store
13701 // it separately.
13702
13703 this._months = +months + quarters * 3 + years * 12;
13704 this._data = {};
13705 this._locale = getLocale();
13706
13707 this._bubble();
13708 }
13709
13710 function isDuration(obj) {
13711 return obj instanceof Duration;
13712 }
13713
13714 function absRound(number) {
13715 if (number < 0) {
13716 return Math.round(-1 * number) * -1;
13717 } else {
13718 return Math.round(number);
13719 }
13720 } // FORMATTING
13721
13722
13723 function offset(token, separator) {
13724 addFormatToken(token, 0, 0, function () {
13725 var offset = this.utcOffset();
13726 var sign = '+';
13727
13728 if (offset < 0) {
13729 offset = -offset;
13730 sign = '-';
13731 }
13732
13733 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);
13734 });
13735 }
13736
13737 offset('Z', ':');
13738 offset('ZZ', ''); // PARSING
13739
13740 addRegexToken('Z', matchShortOffset);
13741 addRegexToken('ZZ', matchShortOffset);
13742 addParseToken(['Z', 'ZZ'], function (input, array, config) {
13743 config._useUTC = true;
13744 config._tzm = offsetFromString(matchShortOffset, input);
13745 }); // HELPERS
13746 // timezone chunker
13747 // '+10:00' > ['10', '00']
13748 // '-1530' > ['-15', '30']
13749
13750 var chunkOffset = /([\+\-]|\d\d)/gi;
13751
13752 function offsetFromString(matcher, string) {
13753 var matches = (string || '').match(matcher);
13754
13755 if (matches === null) {
13756 return null;
13757 }
13758
13759 var chunk = matches[matches.length - 1] || [];
13760 var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
13761 var minutes = +(parts[1] * 60) + toInt(parts[2]);
13762 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
13763 } // Return a moment from input, that is local/utc/zone equivalent to model.
13764
13765
13766 function cloneWithOffset(input, model) {
13767 var res, diff;
13768
13769 if (model._isUTC) {
13770 res = model.clone();
13771 diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api.
13772
13773 res._d.setTime(res._d.valueOf() + diff);
13774
13775 hooks.updateOffset(res, false);
13776 return res;
13777 } else {
13778 return createLocal(input).local();
13779 }
13780 }
13781
13782 function getDateOffset(m) {
13783 // On Firefox.24 Date#getTimezoneOffset returns a floating point.
13784 // https://github.com/moment/moment/pull/1871
13785 return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
13786 } // HOOKS
13787 // This function will be called whenever a moment is mutated.
13788 // It is intended to keep the offset in sync with the timezone.
13789
13790
13791 hooks.updateOffset = function () {}; // MOMENTS
13792 // keepLocalTime = true means only change the timezone, without
13793 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
13794 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
13795 // +0200, so we adjust the time as needed, to be valid.
13796 //
13797 // Keeping the time actually adds/subtracts (one hour)
13798 // from the actual represented time. That is why we call updateOffset
13799 // a second time. In case it wants us to change the offset again
13800 // _changeInProgress == true case, then we have to adjust, because
13801 // there is no such time in the given timezone.
13802
13803
13804 function getSetOffset(input, keepLocalTime, keepMinutes) {
13805 var offset = this._offset || 0,
13806 localAdjust;
13807
13808 if (!this.isValid()) {
13809 return input != null ? this : NaN;
13810 }
13811
13812 if (input != null) {
13813 if (typeof input === 'string') {
13814 input = offsetFromString(matchShortOffset, input);
13815
13816 if (input === null) {
13817 return this;
13818 }
13819 } else if (Math.abs(input) < 16 && !keepMinutes) {
13820 input = input * 60;
13821 }
13822
13823 if (!this._isUTC && keepLocalTime) {
13824 localAdjust = getDateOffset(this);
13825 }
13826
13827 this._offset = input;
13828 this._isUTC = true;
13829
13830 if (localAdjust != null) {
13831 this.add(localAdjust, 'm');
13832 }
13833
13834 if (offset !== input) {
13835 if (!keepLocalTime || this._changeInProgress) {
13836 addSubtract(this, createDuration(input - offset, 'm'), 1, false);
13837 } else if (!this._changeInProgress) {
13838 this._changeInProgress = true;
13839 hooks.updateOffset(this, true);
13840 this._changeInProgress = null;
13841 }
13842 }
13843
13844 return this;
13845 } else {
13846 return this._isUTC ? offset : getDateOffset(this);
13847 }
13848 }
13849
13850 function getSetZone(input, keepLocalTime) {
13851 if (input != null) {
13852 if (typeof input !== 'string') {
13853 input = -input;
13854 }
13855
13856 this.utcOffset(input, keepLocalTime);
13857 return this;
13858 } else {
13859 return -this.utcOffset();
13860 }
13861 }
13862
13863 function setOffsetToUTC(keepLocalTime) {
13864 return this.utcOffset(0, keepLocalTime);
13865 }
13866
13867 function setOffsetToLocal(keepLocalTime) {
13868 if (this._isUTC) {
13869 this.utcOffset(0, keepLocalTime);
13870 this._isUTC = false;
13871
13872 if (keepLocalTime) {
13873 this.subtract(getDateOffset(this), 'm');
13874 }
13875 }
13876
13877 return this;
13878 }
13879
13880 function setOffsetToParsedOffset() {
13881 if (this._tzm != null) {
13882 this.utcOffset(this._tzm, false, true);
13883 } else if (typeof this._i === 'string') {
13884 var tZone = offsetFromString(matchOffset, this._i);
13885
13886 if (tZone != null) {
13887 this.utcOffset(tZone);
13888 } else {
13889 this.utcOffset(0, true);
13890 }
13891 }
13892
13893 return this;
13894 }
13895
13896 function hasAlignedHourOffset(input) {
13897 if (!this.isValid()) {
13898 return false;
13899 }
13900
13901 input = input ? createLocal(input).utcOffset() : 0;
13902 return (this.utcOffset() - input) % 60 === 0;
13903 }
13904
13905 function isDaylightSavingTime() {
13906 return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
13907 }
13908
13909 function isDaylightSavingTimeShifted() {
13910 if (!isUndefined(this._isDSTShifted)) {
13911 return this._isDSTShifted;
13912 }
13913
13914 var c = {};
13915 copyConfig(c, this);
13916 c = prepareConfig(c);
13917
13918 if (c._a) {
13919 var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
13920 this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
13921 } else {
13922 this._isDSTShifted = false;
13923 }
13924
13925 return this._isDSTShifted;
13926 }
13927
13928 function isLocal() {
13929 return this.isValid() ? !this._isUTC : false;
13930 }
13931
13932 function isUtcOffset() {
13933 return this.isValid() ? this._isUTC : false;
13934 }
13935
13936 function isUtc() {
13937 return this.isValid() ? this._isUTC && this._offset === 0 : false;
13938 } // ASP.NET json date format regex
13939
13940
13941 var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
13942 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
13943 // and further modified to allow for strings containing both week and day
13944
13945 var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
13946
13947 function createDuration(input, key) {
13948 var duration = input,
13949 // matching against regexp is expensive, do it on demand
13950 match = null,
13951 sign,
13952 ret,
13953 diffRes;
13954
13955 if (isDuration(input)) {
13956 duration = {
13957 ms: input._milliseconds,
13958 d: input._days,
13959 M: input._months
13960 };
13961 } else if (isNumber(input)) {
13962 duration = {};
13963
13964 if (key) {
13965 duration[key] = input;
13966 } else {
13967 duration.milliseconds = input;
13968 }
13969 } else if (!!(match = aspNetRegex.exec(input))) {
13970 sign = match[1] === '-' ? -1 : 1;
13971 duration = {
13972 y: 0,
13973 d: toInt(match[DATE]) * sign,
13974 h: toInt(match[HOUR]) * sign,
13975 m: toInt(match[MINUTE]) * sign,
13976 s: toInt(match[SECOND]) * sign,
13977 ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
13978
13979 };
13980 } else if (!!(match = isoRegex.exec(input))) {
13981 sign = match[1] === '-' ? -1 : 1;
13982 duration = {
13983 y: parseIso(match[2], sign),
13984 M: parseIso(match[3], sign),
13985 w: parseIso(match[4], sign),
13986 d: parseIso(match[5], sign),
13987 h: parseIso(match[6], sign),
13988 m: parseIso(match[7], sign),
13989 s: parseIso(match[8], sign)
13990 };
13991 } else if (duration == null) {
13992 // checks for null or undefined
13993 duration = {};
13994 } else if (_typeof_1$1$1(duration) === 'object' && ('from' in duration || 'to' in duration)) {
13995 diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
13996 duration = {};
13997 duration.ms = diffRes.milliseconds;
13998 duration.M = diffRes.months;
13999 }
14000
14001 ret = new Duration(duration);
14002
14003 if (isDuration(input) && hasOwnProp(input, '_locale')) {
14004 ret._locale = input._locale;
14005 }
14006
14007 return ret;
14008 }
14009
14010 createDuration.fn = Duration.prototype;
14011 createDuration.invalid = createInvalid$1;
14012
14013 function parseIso(inp, sign) {
14014 // We'd normally use ~~inp for this, but unfortunately it also
14015 // converts floats to ints.
14016 // inp may be undefined, so careful calling replace on it.
14017 var res = inp && _parseFloat$3(inp.replace(',', '.')); // apply sign while we're at it
14018
14019
14020 return (isNaN(res) ? 0 : res) * sign;
14021 }
14022
14023 function positiveMomentsDifference(base, other) {
14024 var res = {};
14025 res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
14026
14027 if (base.clone().add(res.months, 'M').isAfter(other)) {
14028 --res.months;
14029 }
14030
14031 res.milliseconds = +other - +base.clone().add(res.months, 'M');
14032 return res;
14033 }
14034
14035 function momentsDifference(base, other) {
14036 var res;
14037
14038 if (!(base.isValid() && other.isValid())) {
14039 return {
14040 milliseconds: 0,
14041 months: 0
14042 };
14043 }
14044
14045 other = cloneWithOffset(other, base);
14046
14047 if (base.isBefore(other)) {
14048 res = positiveMomentsDifference(base, other);
14049 } else {
14050 res = positiveMomentsDifference(other, base);
14051 res.milliseconds = -res.milliseconds;
14052 res.months = -res.months;
14053 }
14054
14055 return res;
14056 } // TODO: remove 'name' arg after deprecation is removed
14057
14058
14059 function createAdder(direction, name) {
14060 return function (val, period) {
14061 var dur, tmp; //invert the arguments, but complain about it
14062
14063 if (period !== null && !isNaN(+period)) {
14064 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
14065 tmp = val;
14066 val = period;
14067 period = tmp;
14068 }
14069
14070 val = typeof val === 'string' ? +val : val;
14071 dur = createDuration(val, period);
14072 addSubtract(this, dur, direction);
14073 return this;
14074 };
14075 }
14076
14077 function addSubtract(mom, duration, isAdding, updateOffset) {
14078 var milliseconds = duration._milliseconds,
14079 days = absRound(duration._days),
14080 months = absRound(duration._months);
14081
14082 if (!mom.isValid()) {
14083 // No op
14084 return;
14085 }
14086
14087 updateOffset = updateOffset == null ? true : updateOffset;
14088
14089 if (months) {
14090 setMonth(mom, get(mom, 'Month') + months * isAdding);
14091 }
14092
14093 if (days) {
14094 set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
14095 }
14096
14097 if (milliseconds) {
14098 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
14099 }
14100
14101 if (updateOffset) {
14102 hooks.updateOffset(mom, days || months);
14103 }
14104 }
14105
14106 var add = createAdder(1, 'add');
14107 var subtract = createAdder(-1, 'subtract');
14108
14109 function getCalendarFormat(myMoment, now) {
14110 var diff = myMoment.diff(now, 'days', true);
14111 return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse';
14112 }
14113
14114 function calendar$1(time, formats) {
14115 // We want to compare the start of today, vs this.
14116 // Getting start-of-today depends on whether we're local/utc/offset or not.
14117 var now = time || createLocal(),
14118 sod = cloneWithOffset(now, this).startOf('day'),
14119 format = hooks.calendarFormat(this, sod) || 'sameElse';
14120 var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
14121 return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
14122 }
14123
14124 function clone() {
14125 return new Moment(this);
14126 }
14127
14128 function isAfter(input, units) {
14129 var localInput = isMoment(input) ? input : createLocal(input);
14130
14131 if (!(this.isValid() && localInput.isValid())) {
14132 return false;
14133 }
14134
14135 units = normalizeUnits(units) || 'millisecond';
14136
14137 if (units === 'millisecond') {
14138 return this.valueOf() > localInput.valueOf();
14139 } else {
14140 return localInput.valueOf() < this.clone().startOf(units).valueOf();
14141 }
14142 }
14143
14144 function isBefore(input, units) {
14145 var localInput = isMoment(input) ? input : createLocal(input);
14146
14147 if (!(this.isValid() && localInput.isValid())) {
14148 return false;
14149 }
14150
14151 units = normalizeUnits(units) || 'millisecond';
14152
14153 if (units === 'millisecond') {
14154 return this.valueOf() < localInput.valueOf();
14155 } else {
14156 return this.clone().endOf(units).valueOf() < localInput.valueOf();
14157 }
14158 }
14159
14160 function isBetween(from, to, units, inclusivity) {
14161 var localFrom = isMoment(from) ? from : createLocal(from),
14162 localTo = isMoment(to) ? to : createLocal(to);
14163
14164 if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
14165 return false;
14166 }
14167
14168 inclusivity = inclusivity || '()';
14169 return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
14170 }
14171
14172 function isSame(input, units) {
14173 var localInput = isMoment(input) ? input : createLocal(input),
14174 inputMs;
14175
14176 if (!(this.isValid() && localInput.isValid())) {
14177 return false;
14178 }
14179
14180 units = normalizeUnits(units) || 'millisecond';
14181
14182 if (units === 'millisecond') {
14183 return this.valueOf() === localInput.valueOf();
14184 } else {
14185 inputMs = localInput.valueOf();
14186 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
14187 }
14188 }
14189
14190 function isSameOrAfter(input, units) {
14191 return this.isSame(input, units) || this.isAfter(input, units);
14192 }
14193
14194 function isSameOrBefore(input, units) {
14195 return this.isSame(input, units) || this.isBefore(input, units);
14196 }
14197
14198 function diff(input, units, asFloat) {
14199 var that, zoneDelta, output;
14200
14201 if (!this.isValid()) {
14202 return NaN;
14203 }
14204
14205 that = cloneWithOffset(input, this);
14206
14207 if (!that.isValid()) {
14208 return NaN;
14209 }
14210
14211 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
14212 units = normalizeUnits(units);
14213
14214 switch (units) {
14215 case 'year':
14216 output = monthDiff(this, that) / 12;
14217 break;
14218
14219 case 'month':
14220 output = monthDiff(this, that);
14221 break;
14222
14223 case 'quarter':
14224 output = monthDiff(this, that) / 3;
14225 break;
14226
14227 case 'second':
14228 output = (this - that) / 1e3;
14229 break;
14230 // 1000
14231
14232 case 'minute':
14233 output = (this - that) / 6e4;
14234 break;
14235 // 1000 * 60
14236
14237 case 'hour':
14238 output = (this - that) / 36e5;
14239 break;
14240 // 1000 * 60 * 60
14241
14242 case 'day':
14243 output = (this - that - zoneDelta) / 864e5;
14244 break;
14245 // 1000 * 60 * 60 * 24, negate dst
14246
14247 case 'week':
14248 output = (this - that - zoneDelta) / 6048e5;
14249 break;
14250 // 1000 * 60 * 60 * 24 * 7, negate dst
14251
14252 default:
14253 output = this - that;
14254 }
14255
14256 return asFloat ? output : absFloor(output);
14257 }
14258
14259 function monthDiff(a, b) {
14260 // difference in months
14261 var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
14262 // b is in (anchor - 1 month, anchor + 1 month)
14263 anchor = a.clone().add(wholeMonthDiff, 'months'),
14264 anchor2,
14265 adjust;
14266
14267 if (b - anchor < 0) {
14268 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month
14269
14270 adjust = (b - anchor) / (anchor - anchor2);
14271 } else {
14272 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month
14273
14274 adjust = (b - anchor) / (anchor2 - anchor);
14275 } //check for negative zero, return zero if negative zero
14276
14277
14278 return -(wholeMonthDiff + adjust) || 0;
14279 }
14280
14281 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
14282 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
14283
14284 function toString() {
14285 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
14286 }
14287
14288 function toISOString(keepOffset) {
14289 if (!this.isValid()) {
14290 return null;
14291 }
14292
14293 var utc = keepOffset !== true;
14294 var m = utc ? this.clone().utc() : this;
14295
14296 if (m.year() < 0 || m.year() > 9999) {
14297 return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
14298 }
14299
14300 if (isFunction(Date.prototype.toISOString)) {
14301 // native implementation is ~50x faster, use it when we can
14302 if (utc) {
14303 return this.toDate().toISOString();
14304 } else {
14305 return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
14306 }
14307 }
14308
14309 return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
14310 }
14311 /**
14312 * Return a human readable representation of a moment that can
14313 * also be evaluated to get a new moment which is the same
14314 *
14315 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
14316 */
14317
14318
14319 function inspect() {
14320 if (!this.isValid()) {
14321 return 'moment.invalid(/* ' + this._i + ' */)';
14322 }
14323
14324 var func = 'moment';
14325 var zone = '';
14326
14327 if (!this.isLocal()) {
14328 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
14329 zone = 'Z';
14330 }
14331
14332 var prefix = '[' + func + '("]';
14333 var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
14334 var datetime = '-MM-DD[T]HH:mm:ss.SSS';
14335 var suffix = zone + '[")]';
14336 return this.format(prefix + year + datetime + suffix);
14337 }
14338
14339 function format(inputString) {
14340 if (!inputString) {
14341 inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
14342 }
14343
14344 var output = formatMoment(this, inputString);
14345 return this.localeData().postformat(output);
14346 }
14347
14348 function from(time, withoutSuffix) {
14349 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
14350 return createDuration({
14351 to: this,
14352 from: time
14353 }).locale(this.locale()).humanize(!withoutSuffix);
14354 } else {
14355 return this.localeData().invalidDate();
14356 }
14357 }
14358
14359 function fromNow(withoutSuffix) {
14360 return this.from(createLocal(), withoutSuffix);
14361 }
14362
14363 function to(time, withoutSuffix) {
14364 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
14365 return createDuration({
14366 from: this,
14367 to: time
14368 }).locale(this.locale()).humanize(!withoutSuffix);
14369 } else {
14370 return this.localeData().invalidDate();
14371 }
14372 }
14373
14374 function toNow(withoutSuffix) {
14375 return this.to(createLocal(), withoutSuffix);
14376 } // If passed a locale key, it will set the locale for this
14377 // instance. Otherwise, it will return the locale configuration
14378 // variables for this instance.
14379
14380
14381 function locale(key) {
14382 var newLocaleData;
14383
14384 if (key === undefined) {
14385 return this._locale._abbr;
14386 } else {
14387 newLocaleData = getLocale(key);
14388
14389 if (newLocaleData != null) {
14390 this._locale = newLocaleData;
14391 }
14392
14393 return this;
14394 }
14395 }
14396
14397 var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) {
14398 if (key === undefined) {
14399 return this.localeData();
14400 } else {
14401 return this.locale(key);
14402 }
14403 });
14404
14405 function localeData() {
14406 return this._locale;
14407 }
14408
14409 var MS_PER_SECOND = 1000;
14410 var MS_PER_MINUTE = 60 * MS_PER_SECOND;
14411 var MS_PER_HOUR = 60 * MS_PER_MINUTE;
14412 var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970):
14413
14414 function mod$1(dividend, divisor) {
14415 return (dividend % divisor + divisor) % divisor;
14416 }
14417
14418 function localStartOfDate(y, m, d) {
14419 // the date constructor remaps years 0-99 to 1900-1999
14420 if (y < 100 && y >= 0) {
14421 // preserve leap years using a full 400 year cycle, then reset
14422 return new Date(y + 400, m, d) - MS_PER_400_YEARS;
14423 } else {
14424 return new Date(y, m, d).valueOf();
14425 }
14426 }
14427
14428 function utcStartOfDate(y, m, d) {
14429 // Date.UTC remaps years 0-99 to 1900-1999
14430 if (y < 100 && y >= 0) {
14431 // preserve leap years using a full 400 year cycle, then reset
14432 return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
14433 } else {
14434 return Date.UTC(y, m, d);
14435 }
14436 }
14437
14438 function startOf(units) {
14439 var time;
14440 units = normalizeUnits(units);
14441
14442 if (units === undefined || units === 'millisecond' || !this.isValid()) {
14443 return this;
14444 }
14445
14446 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
14447
14448 switch (units) {
14449 case 'year':
14450 time = startOfDate(this.year(), 0, 1);
14451 break;
14452
14453 case 'quarter':
14454 time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
14455 break;
14456
14457 case 'month':
14458 time = startOfDate(this.year(), this.month(), 1);
14459 break;
14460
14461 case 'week':
14462 time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
14463 break;
14464
14465 case 'isoWeek':
14466 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
14467 break;
14468
14469 case 'day':
14470 case 'date':
14471 time = startOfDate(this.year(), this.month(), this.date());
14472 break;
14473
14474 case 'hour':
14475 time = this._d.valueOf();
14476 time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
14477 break;
14478
14479 case 'minute':
14480 time = this._d.valueOf();
14481 time -= mod$1(time, MS_PER_MINUTE);
14482 break;
14483
14484 case 'second':
14485 time = this._d.valueOf();
14486 time -= mod$1(time, MS_PER_SECOND);
14487 break;
14488 }
14489
14490 this._d.setTime(time);
14491
14492 hooks.updateOffset(this, true);
14493 return this;
14494 }
14495
14496 function endOf(units) {
14497 var time;
14498 units = normalizeUnits(units);
14499
14500 if (units === undefined || units === 'millisecond' || !this.isValid()) {
14501 return this;
14502 }
14503
14504 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
14505
14506 switch (units) {
14507 case 'year':
14508 time = startOfDate(this.year() + 1, 0, 1) - 1;
14509 break;
14510
14511 case 'quarter':
14512 time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
14513 break;
14514
14515 case 'month':
14516 time = startOfDate(this.year(), this.month() + 1, 1) - 1;
14517 break;
14518
14519 case 'week':
14520 time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
14521 break;
14522
14523 case 'isoWeek':
14524 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
14525 break;
14526
14527 case 'day':
14528 case 'date':
14529 time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
14530 break;
14531
14532 case 'hour':
14533 time = this._d.valueOf();
14534 time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
14535 break;
14536
14537 case 'minute':
14538 time = this._d.valueOf();
14539 time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
14540 break;
14541
14542 case 'second':
14543 time = this._d.valueOf();
14544 time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
14545 break;
14546 }
14547
14548 this._d.setTime(time);
14549
14550 hooks.updateOffset(this, true);
14551 return this;
14552 }
14553
14554 function valueOf() {
14555 return this._d.valueOf() - (this._offset || 0) * 60000;
14556 }
14557
14558 function unix() {
14559 return Math.floor(this.valueOf() / 1000);
14560 }
14561
14562 function toDate() {
14563 return new Date(this.valueOf());
14564 }
14565
14566 function toArray() {
14567 var m = this;
14568 return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
14569 }
14570
14571 function toObject() {
14572 var m = this;
14573 return {
14574 years: m.year(),
14575 months: m.month(),
14576 date: m.date(),
14577 hours: m.hours(),
14578 minutes: m.minutes(),
14579 seconds: m.seconds(),
14580 milliseconds: m.milliseconds()
14581 };
14582 }
14583
14584 function toJSON() {
14585 // new Date(NaN).toJSON() === null
14586 return this.isValid() ? this.toISOString() : null;
14587 }
14588
14589 function isValid$2() {
14590 return isValid(this);
14591 }
14592
14593 function parsingFlags() {
14594 return extend({}, getParsingFlags(this));
14595 }
14596
14597 function invalidAt() {
14598 return getParsingFlags(this).overflow;
14599 }
14600
14601 function creationData() {
14602 return {
14603 input: this._i,
14604 format: this._f,
14605 locale: this._locale,
14606 isUTC: this._isUTC,
14607 strict: this._strict
14608 };
14609 } // FORMATTING
14610
14611
14612 addFormatToken(0, ['gg', 2], 0, function () {
14613 return this.weekYear() % 100;
14614 });
14615 addFormatToken(0, ['GG', 2], 0, function () {
14616 return this.isoWeekYear() % 100;
14617 });
14618
14619 function addWeekYearFormatToken(token, getter) {
14620 addFormatToken(0, [token, token.length], 0, getter);
14621 }
14622
14623 addWeekYearFormatToken('gggg', 'weekYear');
14624 addWeekYearFormatToken('ggggg', 'weekYear');
14625 addWeekYearFormatToken('GGGG', 'isoWeekYear');
14626 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES
14627
14628 addUnitAlias('weekYear', 'gg');
14629 addUnitAlias('isoWeekYear', 'GG'); // PRIORITY
14630
14631 addUnitPriority('weekYear', 1);
14632 addUnitPriority('isoWeekYear', 1); // PARSING
14633
14634 addRegexToken('G', matchSigned);
14635 addRegexToken('g', matchSigned);
14636 addRegexToken('GG', match1to2, match2);
14637 addRegexToken('gg', match1to2, match2);
14638 addRegexToken('GGGG', match1to4, match4);
14639 addRegexToken('gggg', match1to4, match4);
14640 addRegexToken('GGGGG', match1to6, match6);
14641 addRegexToken('ggggg', match1to6, match6);
14642 addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
14643 week[token.substr(0, 2)] = toInt(input);
14644 });
14645 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
14646 week[token] = hooks.parseTwoDigitYear(input);
14647 }); // MOMENTS
14648
14649 function getSetWeekYear(input) {
14650 return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy);
14651 }
14652
14653 function getSetISOWeekYear(input) {
14654 return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
14655 }
14656
14657 function getISOWeeksInYear() {
14658 return weeksInYear(this.year(), 1, 4);
14659 }
14660
14661 function getWeeksInYear() {
14662 var weekInfo = this.localeData()._week;
14663
14664 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
14665 }
14666
14667 function getSetWeekYearHelper(input, week, weekday, dow, doy) {
14668 var weeksTarget;
14669
14670 if (input == null) {
14671 return weekOfYear(this, dow, doy).year;
14672 } else {
14673 weeksTarget = weeksInYear(input, dow, doy);
14674
14675 if (week > weeksTarget) {
14676 week = weeksTarget;
14677 }
14678
14679 return setWeekAll.call(this, input, week, weekday, dow, doy);
14680 }
14681 }
14682
14683 function setWeekAll(weekYear, week, weekday, dow, doy) {
14684 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
14685 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
14686 this.year(date.getUTCFullYear());
14687 this.month(date.getUTCMonth());
14688 this.date(date.getUTCDate());
14689 return this;
14690 } // FORMATTING
14691
14692
14693 addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES
14694
14695 addUnitAlias('quarter', 'Q'); // PRIORITY
14696
14697 addUnitPriority('quarter', 7); // PARSING
14698
14699 addRegexToken('Q', match1);
14700 addParseToken('Q', function (input, array) {
14701 array[MONTH] = (toInt(input) - 1) * 3;
14702 }); // MOMENTS
14703
14704 function getSetQuarter(input) {
14705 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
14706 } // FORMATTING
14707
14708
14709 addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES
14710
14711 addUnitAlias('date', 'D'); // PRIORITY
14712
14713 addUnitPriority('date', 9); // PARSING
14714
14715 addRegexToken('D', match1to2);
14716 addRegexToken('DD', match1to2, match2);
14717 addRegexToken('Do', function (isStrict, locale) {
14718 // TODO: Remove "ordinalParse" fallback in next major release.
14719 return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient;
14720 });
14721 addParseToken(['D', 'DD'], DATE);
14722 addParseToken('Do', function (input, array) {
14723 array[DATE] = toInt(input.match(match1to2)[0]);
14724 }); // MOMENTS
14725
14726 var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING
14727
14728 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES
14729
14730 addUnitAlias('dayOfYear', 'DDD'); // PRIORITY
14731
14732 addUnitPriority('dayOfYear', 4); // PARSING
14733
14734 addRegexToken('DDD', match1to3);
14735 addRegexToken('DDDD', match3);
14736 addParseToken(['DDD', 'DDDD'], function (input, array, config) {
14737 config._dayOfYear = toInt(input);
14738 }); // HELPERS
14739 // MOMENTS
14740
14741 function getSetDayOfYear(input) {
14742 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
14743 return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
14744 } // FORMATTING
14745
14746
14747 addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES
14748
14749 addUnitAlias('minute', 'm'); // PRIORITY
14750
14751 addUnitPriority('minute', 14); // PARSING
14752
14753 addRegexToken('m', match1to2);
14754 addRegexToken('mm', match1to2, match2);
14755 addParseToken(['m', 'mm'], MINUTE); // MOMENTS
14756
14757 var getSetMinute = makeGetSet('Minutes', false); // FORMATTING
14758
14759 addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES
14760
14761 addUnitAlias('second', 's'); // PRIORITY
14762
14763 addUnitPriority('second', 15); // PARSING
14764
14765 addRegexToken('s', match1to2);
14766 addRegexToken('ss', match1to2, match2);
14767 addParseToken(['s', 'ss'], SECOND); // MOMENTS
14768
14769 var getSetSecond = makeGetSet('Seconds', false); // FORMATTING
14770
14771 addFormatToken('S', 0, 0, function () {
14772 return ~~(this.millisecond() / 100);
14773 });
14774 addFormatToken(0, ['SS', 2], 0, function () {
14775 return ~~(this.millisecond() / 10);
14776 });
14777 addFormatToken(0, ['SSS', 3], 0, 'millisecond');
14778 addFormatToken(0, ['SSSS', 4], 0, function () {
14779 return this.millisecond() * 10;
14780 });
14781 addFormatToken(0, ['SSSSS', 5], 0, function () {
14782 return this.millisecond() * 100;
14783 });
14784 addFormatToken(0, ['SSSSSS', 6], 0, function () {
14785 return this.millisecond() * 1000;
14786 });
14787 addFormatToken(0, ['SSSSSSS', 7], 0, function () {
14788 return this.millisecond() * 10000;
14789 });
14790 addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
14791 return this.millisecond() * 100000;
14792 });
14793 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
14794 return this.millisecond() * 1000000;
14795 }); // ALIASES
14796
14797 addUnitAlias('millisecond', 'ms'); // PRIORITY
14798
14799 addUnitPriority('millisecond', 16); // PARSING
14800
14801 addRegexToken('S', match1to3, match1);
14802 addRegexToken('SS', match1to3, match2);
14803 addRegexToken('SSS', match1to3, match3);
14804 var token;
14805
14806 for (token = 'SSSS'; token.length <= 9; token += 'S') {
14807 addRegexToken(token, matchUnsigned);
14808 }
14809
14810 function parseMs(input, array) {
14811 array[MILLISECOND] = toInt(('0.' + input) * 1000);
14812 }
14813
14814 for (token = 'S'; token.length <= 9; token += 'S') {
14815 addParseToken(token, parseMs);
14816 } // MOMENTS
14817
14818
14819 var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING
14820
14821 addFormatToken('z', 0, 0, 'zoneAbbr');
14822 addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS
14823
14824 function getZoneAbbr() {
14825 return this._isUTC ? 'UTC' : '';
14826 }
14827
14828 function getZoneName() {
14829 return this._isUTC ? 'Coordinated Universal Time' : '';
14830 }
14831
14832 var proto = Moment.prototype;
14833 proto.add = add;
14834 proto.calendar = calendar$1;
14835 proto.clone = clone;
14836 proto.diff = diff;
14837 proto.endOf = endOf;
14838 proto.format = format;
14839 proto.from = from;
14840 proto.fromNow = fromNow;
14841 proto.to = to;
14842 proto.toNow = toNow;
14843 proto.get = stringGet;
14844 proto.invalidAt = invalidAt;
14845 proto.isAfter = isAfter;
14846 proto.isBefore = isBefore;
14847 proto.isBetween = isBetween;
14848 proto.isSame = isSame;
14849 proto.isSameOrAfter = isSameOrAfter;
14850 proto.isSameOrBefore = isSameOrBefore;
14851 proto.isValid = isValid$2;
14852 proto.lang = lang;
14853 proto.locale = locale;
14854 proto.localeData = localeData;
14855 proto.max = prototypeMax;
14856 proto.min = prototypeMin;
14857 proto.parsingFlags = parsingFlags;
14858 proto.set = stringSet;
14859 proto.startOf = startOf;
14860 proto.subtract = subtract;
14861 proto.toArray = toArray;
14862 proto.toObject = toObject;
14863 proto.toDate = toDate;
14864 proto.toISOString = toISOString;
14865 proto.inspect = inspect;
14866 proto.toJSON = toJSON;
14867 proto.toString = toString;
14868 proto.unix = unix;
14869 proto.valueOf = valueOf;
14870 proto.creationData = creationData;
14871 proto.year = getSetYear;
14872 proto.isLeapYear = getIsLeapYear;
14873 proto.weekYear = getSetWeekYear;
14874 proto.isoWeekYear = getSetISOWeekYear;
14875 proto.quarter = proto.quarters = getSetQuarter;
14876 proto.month = getSetMonth;
14877 proto.daysInMonth = getDaysInMonth;
14878 proto.week = proto.weeks = getSetWeek;
14879 proto.isoWeek = proto.isoWeeks = getSetISOWeek;
14880 proto.weeksInYear = getWeeksInYear;
14881 proto.isoWeeksInYear = getISOWeeksInYear;
14882 proto.date = getSetDayOfMonth;
14883 proto.day = proto.days = getSetDayOfWeek;
14884 proto.weekday = getSetLocaleDayOfWeek;
14885 proto.isoWeekday = getSetISODayOfWeek;
14886 proto.dayOfYear = getSetDayOfYear;
14887 proto.hour = proto.hours = getSetHour;
14888 proto.minute = proto.minutes = getSetMinute;
14889 proto.second = proto.seconds = getSetSecond;
14890 proto.millisecond = proto.milliseconds = getSetMillisecond;
14891 proto.utcOffset = getSetOffset;
14892 proto.utc = setOffsetToUTC;
14893 proto.local = setOffsetToLocal;
14894 proto.parseZone = setOffsetToParsedOffset;
14895 proto.hasAlignedHourOffset = hasAlignedHourOffset;
14896 proto.isDST = isDaylightSavingTime;
14897 proto.isLocal = isLocal;
14898 proto.isUtcOffset = isUtcOffset;
14899 proto.isUtc = isUtc;
14900 proto.isUTC = isUtc;
14901 proto.zoneAbbr = getZoneAbbr;
14902 proto.zoneName = getZoneName;
14903 proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
14904 proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
14905 proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
14906 proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
14907 proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
14908
14909 function createUnix(input) {
14910 return createLocal(input * 1000);
14911 }
14912
14913 function createInZone() {
14914 return createLocal.apply(null, arguments).parseZone();
14915 }
14916
14917 function preParsePostFormat(string) {
14918 return string;
14919 }
14920
14921 var proto$1 = Locale.prototype;
14922 proto$1.calendar = calendar;
14923 proto$1.longDateFormat = longDateFormat;
14924 proto$1.invalidDate = invalidDate;
14925 proto$1.ordinal = ordinal;
14926 proto$1.preparse = preParsePostFormat;
14927 proto$1.postformat = preParsePostFormat;
14928 proto$1.relativeTime = relativeTime;
14929 proto$1.pastFuture = pastFuture;
14930 proto$1.set = set;
14931 proto$1.months = localeMonths;
14932 proto$1.monthsShort = localeMonthsShort;
14933 proto$1.monthsParse = localeMonthsParse;
14934 proto$1.monthsRegex = monthsRegex;
14935 proto$1.monthsShortRegex = monthsShortRegex;
14936 proto$1.week = localeWeek;
14937 proto$1.firstDayOfYear = localeFirstDayOfYear;
14938 proto$1.firstDayOfWeek = localeFirstDayOfWeek;
14939 proto$1.weekdays = localeWeekdays;
14940 proto$1.weekdaysMin = localeWeekdaysMin;
14941 proto$1.weekdaysShort = localeWeekdaysShort;
14942 proto$1.weekdaysParse = localeWeekdaysParse;
14943 proto$1.weekdaysRegex = weekdaysRegex;
14944 proto$1.weekdaysShortRegex = weekdaysShortRegex;
14945 proto$1.weekdaysMinRegex = weekdaysMinRegex;
14946 proto$1.isPM = localeIsPM;
14947 proto$1.meridiem = localeMeridiem;
14948
14949 function get$1(format, index, field, setter) {
14950 var locale = getLocale();
14951 var utc = createUTC().set(setter, index);
14952 return locale[field](utc, format);
14953 }
14954
14955 function listMonthsImpl(format, index, field) {
14956 if (isNumber(format)) {
14957 index = format;
14958 format = undefined;
14959 }
14960
14961 format = format || '';
14962
14963 if (index != null) {
14964 return get$1(format, index, field, 'month');
14965 }
14966
14967 var i;
14968 var out = [];
14969
14970 for (i = 0; i < 12; i++) {
14971 out[i] = get$1(format, i, field, 'month');
14972 }
14973
14974 return out;
14975 } // ()
14976 // (5)
14977 // (fmt, 5)
14978 // (fmt)
14979 // (true)
14980 // (true, 5)
14981 // (true, fmt, 5)
14982 // (true, fmt)
14983
14984
14985 function listWeekdaysImpl(localeSorted, format, index, field) {
14986 if (typeof localeSorted === 'boolean') {
14987 if (isNumber(format)) {
14988 index = format;
14989 format = undefined;
14990 }
14991
14992 format = format || '';
14993 } else {
14994 format = localeSorted;
14995 index = format;
14996 localeSorted = false;
14997
14998 if (isNumber(format)) {
14999 index = format;
15000 format = undefined;
15001 }
15002
15003 format = format || '';
15004 }
15005
15006 var locale = getLocale(),
15007 shift = localeSorted ? locale._week.dow : 0;
15008
15009 if (index != null) {
15010 return get$1(format, (index + shift) % 7, field, 'day');
15011 }
15012
15013 var i;
15014 var out = [];
15015
15016 for (i = 0; i < 7; i++) {
15017 out[i] = get$1(format, (i + shift) % 7, field, 'day');
15018 }
15019
15020 return out;
15021 }
15022
15023 function listMonths(format, index) {
15024 return listMonthsImpl(format, index, 'months');
15025 }
15026
15027 function listMonthsShort(format, index) {
15028 return listMonthsImpl(format, index, 'monthsShort');
15029 }
15030
15031 function listWeekdays(localeSorted, format, index) {
15032 return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
15033 }
15034
15035 function listWeekdaysShort(localeSorted, format, index) {
15036 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
15037 }
15038
15039 function listWeekdaysMin(localeSorted, format, index) {
15040 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
15041 }
15042
15043 getSetGlobalLocale('en', {
15044 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
15045 ordinal: function ordinal(number) {
15046 var b = number % 10,
15047 output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th';
15048 return number + output;
15049 }
15050 }); // Side effect imports
15051
15052 hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
15053 hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
15054 var mathAbs = Math.abs;
15055
15056 function abs() {
15057 var data = this._data;
15058 this._milliseconds = mathAbs(this._milliseconds);
15059 this._days = mathAbs(this._days);
15060 this._months = mathAbs(this._months);
15061 data.milliseconds = mathAbs(data.milliseconds);
15062 data.seconds = mathAbs(data.seconds);
15063 data.minutes = mathAbs(data.minutes);
15064 data.hours = mathAbs(data.hours);
15065 data.months = mathAbs(data.months);
15066 data.years = mathAbs(data.years);
15067 return this;
15068 }
15069
15070 function addSubtract$1(duration, input, value, direction) {
15071 var other = createDuration(input, value);
15072 duration._milliseconds += direction * other._milliseconds;
15073 duration._days += direction * other._days;
15074 duration._months += direction * other._months;
15075 return duration._bubble();
15076 } // supports only 2.0-style add(1, 's') or add(duration)
15077
15078
15079 function add$1(input, value) {
15080 return addSubtract$1(this, input, value, 1);
15081 } // supports only 2.0-style subtract(1, 's') or subtract(duration)
15082
15083
15084 function subtract$1(input, value) {
15085 return addSubtract$1(this, input, value, -1);
15086 }
15087
15088 function absCeil(number) {
15089 if (number < 0) {
15090 return Math.floor(number);
15091 } else {
15092 return Math.ceil(number);
15093 }
15094 }
15095
15096 function bubble() {
15097 var milliseconds = this._milliseconds;
15098 var days = this._days;
15099 var months = this._months;
15100 var data = this._data;
15101 var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first
15102 // check: https://github.com/moment/moment/issues/2166
15103
15104 if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) {
15105 milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
15106 days = 0;
15107 months = 0;
15108 } // The following code bubbles up values, see the tests for
15109 // examples of what that means.
15110
15111
15112 data.milliseconds = milliseconds % 1000;
15113 seconds = absFloor(milliseconds / 1000);
15114 data.seconds = seconds % 60;
15115 minutes = absFloor(seconds / 60);
15116 data.minutes = minutes % 60;
15117 hours = absFloor(minutes / 60);
15118 data.hours = hours % 24;
15119 days += absFloor(hours / 24); // convert days to months
15120
15121 monthsFromDays = absFloor(daysToMonths(days));
15122 months += monthsFromDays;
15123 days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year
15124
15125 years = absFloor(months / 12);
15126 months %= 12;
15127 data.days = days;
15128 data.months = months;
15129 data.years = years;
15130 return this;
15131 }
15132
15133 function daysToMonths(days) {
15134 // 400 years have 146097 days (taking into account leap year rules)
15135 // 400 years have 12 months === 4800
15136 return days * 4800 / 146097;
15137 }
15138
15139 function monthsToDays(months) {
15140 // the reverse of daysToMonths
15141 return months * 146097 / 4800;
15142 }
15143
15144 function as(units) {
15145 if (!this.isValid()) {
15146 return NaN;
15147 }
15148
15149 var days;
15150 var months;
15151 var milliseconds = this._milliseconds;
15152 units = normalizeUnits(units);
15153
15154 if (units === 'month' || units === 'quarter' || units === 'year') {
15155 days = this._days + milliseconds / 864e5;
15156 months = this._months + daysToMonths(days);
15157
15158 switch (units) {
15159 case 'month':
15160 return months;
15161
15162 case 'quarter':
15163 return months / 3;
15164
15165 case 'year':
15166 return months / 12;
15167 }
15168 } else {
15169 // handle milliseconds separately because of floating point math errors (issue #1867)
15170 days = this._days + Math.round(monthsToDays(this._months));
15171
15172 switch (units) {
15173 case 'week':
15174 return days / 7 + milliseconds / 6048e5;
15175
15176 case 'day':
15177 return days + milliseconds / 864e5;
15178
15179 case 'hour':
15180 return days * 24 + milliseconds / 36e5;
15181
15182 case 'minute':
15183 return days * 1440 + milliseconds / 6e4;
15184
15185 case 'second':
15186 return days * 86400 + milliseconds / 1000;
15187 // Math.floor prevents floating point math errors here
15188
15189 case 'millisecond':
15190 return Math.floor(days * 864e5) + milliseconds;
15191
15192 default:
15193 throw new Error('Unknown unit ' + units);
15194 }
15195 }
15196 } // TODO: Use this.as('ms')?
15197
15198
15199 function valueOf$1() {
15200 if (!this.isValid()) {
15201 return NaN;
15202 }
15203
15204 return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6;
15205 }
15206
15207 function makeAs(alias) {
15208 return function () {
15209 return this.as(alias);
15210 };
15211 }
15212
15213 var asMilliseconds = makeAs('ms');
15214 var asSeconds = makeAs('s');
15215 var asMinutes = makeAs('m');
15216 var asHours = makeAs('h');
15217 var asDays = makeAs('d');
15218 var asWeeks = makeAs('w');
15219 var asMonths = makeAs('M');
15220 var asQuarters = makeAs('Q');
15221 var asYears = makeAs('y');
15222
15223 function clone$1() {
15224 return createDuration(this);
15225 }
15226
15227 function get$2(units) {
15228 units = normalizeUnits(units);
15229 return this.isValid() ? this[units + 's']() : NaN;
15230 }
15231
15232 function makeGetter(name) {
15233 return function () {
15234 return this.isValid() ? this._data[name] : NaN;
15235 };
15236 }
15237
15238 var milliseconds = makeGetter('milliseconds');
15239 var seconds = makeGetter('seconds');
15240 var minutes = makeGetter('minutes');
15241 var hours = makeGetter('hours');
15242 var days = makeGetter('days');
15243 var months = makeGetter('months');
15244 var years = makeGetter('years');
15245
15246 function weeks() {
15247 return absFloor(this.days() / 7);
15248 }
15249
15250 var round = Math.round;
15251 var thresholds = {
15252 ss: 44,
15253 // a few seconds to seconds
15254 s: 45,
15255 // seconds to minute
15256 m: 45,
15257 // minutes to hour
15258 h: 22,
15259 // hours to day
15260 d: 26,
15261 // days to month
15262 M: 11 // months to year
15263
15264 }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
15265
15266 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
15267 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
15268 }
15269
15270 function relativeTime$1(posNegDuration, withoutSuffix, locale) {
15271 var duration = createDuration(posNegDuration).abs();
15272 var seconds = round(duration.as('s'));
15273 var minutes = round(duration.as('m'));
15274 var hours = round(duration.as('h'));
15275 var days = round(duration.as('d'));
15276 var months = round(duration.as('M'));
15277 var years = round(duration.as('y'));
15278 var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years];
15279 a[2] = withoutSuffix;
15280 a[3] = +posNegDuration > 0;
15281 a[4] = locale;
15282 return substituteTimeAgo.apply(null, a);
15283 } // This function allows you to set the rounding function for relative time strings
15284
15285
15286 function getSetRelativeTimeRounding(roundingFunction) {
15287 if (roundingFunction === undefined) {
15288 return round;
15289 }
15290
15291 if (typeof roundingFunction === 'function') {
15292 round = roundingFunction;
15293 return true;
15294 }
15295
15296 return false;
15297 } // This function allows you to set a threshold for relative time strings
15298
15299
15300 function getSetRelativeTimeThreshold(threshold, limit) {
15301 if (thresholds[threshold] === undefined) {
15302 return false;
15303 }
15304
15305 if (limit === undefined) {
15306 return thresholds[threshold];
15307 }
15308
15309 thresholds[threshold] = limit;
15310
15311 if (threshold === 's') {
15312 thresholds.ss = limit - 1;
15313 }
15314
15315 return true;
15316 }
15317
15318 function humanize(withSuffix) {
15319 if (!this.isValid()) {
15320 return this.localeData().invalidDate();
15321 }
15322
15323 var locale = this.localeData();
15324 var output = relativeTime$1(this, !withSuffix, locale);
15325
15326 if (withSuffix) {
15327 output = locale.pastFuture(+this, output);
15328 }
15329
15330 return locale.postformat(output);
15331 }
15332
15333 var abs$1 = Math.abs;
15334
15335 function sign(x) {
15336 return (x > 0) - (x < 0) || +x;
15337 }
15338
15339 function toISOString$1() {
15340 // for ISO strings we do not use the normal bubbling rules:
15341 // * milliseconds bubble up until they become hours
15342 // * days do not bubble at all
15343 // * months bubble up until they become years
15344 // This is because there is no context-free conversion between hours and days
15345 // (think of clock changes)
15346 // and also not between days and months (28-31 days per month)
15347 if (!this.isValid()) {
15348 return this.localeData().invalidDate();
15349 }
15350
15351 var seconds = abs$1(this._milliseconds) / 1000;
15352 var days = abs$1(this._days);
15353 var months = abs$1(this._months);
15354 var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour
15355
15356 minutes = absFloor(seconds / 60);
15357 hours = absFloor(minutes / 60);
15358 seconds %= 60;
15359 minutes %= 60; // 12 months -> 1 year
15360
15361 years = absFloor(months / 12);
15362 months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
15363
15364 var Y = years;
15365 var M = months;
15366 var D = days;
15367 var h = hours;
15368 var m = minutes;
15369 var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
15370 var total = this.asSeconds();
15371
15372 if (!total) {
15373 // this is the same as C#'s (Noda) and python (isodate)...
15374 // but not other JS (goog.date)
15375 return 'P0D';
15376 }
15377
15378 var totalSign = total < 0 ? '-' : '';
15379 var ymSign = sign(this._months) !== sign(total) ? '-' : '';
15380 var daysSign = sign(this._days) !== sign(total) ? '-' : '';
15381 var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
15382 return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : '');
15383 }
15384
15385 var proto$2 = Duration.prototype;
15386 proto$2.isValid = isValid$1;
15387 proto$2.abs = abs;
15388 proto$2.add = add$1;
15389 proto$2.subtract = subtract$1;
15390 proto$2.as = as;
15391 proto$2.asMilliseconds = asMilliseconds;
15392 proto$2.asSeconds = asSeconds;
15393 proto$2.asMinutes = asMinutes;
15394 proto$2.asHours = asHours;
15395 proto$2.asDays = asDays;
15396 proto$2.asWeeks = asWeeks;
15397 proto$2.asMonths = asMonths;
15398 proto$2.asQuarters = asQuarters;
15399 proto$2.asYears = asYears;
15400 proto$2.valueOf = valueOf$1;
15401 proto$2._bubble = bubble;
15402 proto$2.clone = clone$1;
15403 proto$2.get = get$2;
15404 proto$2.milliseconds = milliseconds;
15405 proto$2.seconds = seconds;
15406 proto$2.minutes = minutes;
15407 proto$2.hours = hours;
15408 proto$2.days = days;
15409 proto$2.weeks = weeks;
15410 proto$2.months = months;
15411 proto$2.years = years;
15412 proto$2.humanize = humanize;
15413 proto$2.toISOString = toISOString$1;
15414 proto$2.toString = toISOString$1;
15415 proto$2.toJSON = toISOString$1;
15416 proto$2.locale = locale;
15417 proto$2.localeData = localeData;
15418 proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
15419 proto$2.lang = lang; // Side effect imports
15420 // FORMATTING
15421
15422 addFormatToken('X', 0, 0, 'unix');
15423 addFormatToken('x', 0, 0, 'valueOf'); // PARSING
15424
15425 addRegexToken('x', matchSigned);
15426 addRegexToken('X', matchTimestamp);
15427 addParseToken('X', function (input, array, config) {
15428 config._d = new Date(_parseFloat$3(input, 10) * 1000);
15429 });
15430 addParseToken('x', function (input, array, config) {
15431 config._d = new Date(toInt(input));
15432 }); // Side effect imports
15433
15434 hooks.version = '2.24.0';
15435 setHookCallback(createLocal);
15436 hooks.fn = proto;
15437 hooks.min = min;
15438 hooks.max = max;
15439 hooks.now = now;
15440 hooks.utc = createUTC;
15441 hooks.unix = createUnix;
15442 hooks.months = listMonths;
15443 hooks.isDate = isDate;
15444 hooks.locale = getSetGlobalLocale;
15445 hooks.invalid = createInvalid;
15446 hooks.duration = createDuration;
15447 hooks.isMoment = isMoment;
15448 hooks.weekdays = listWeekdays;
15449 hooks.parseZone = createInZone;
15450 hooks.localeData = getLocale;
15451 hooks.isDuration = isDuration;
15452 hooks.monthsShort = listMonthsShort;
15453 hooks.weekdaysMin = listWeekdaysMin;
15454 hooks.defineLocale = defineLocale;
15455 hooks.updateLocale = updateLocale;
15456 hooks.locales = listLocales;
15457 hooks.weekdaysShort = listWeekdaysShort;
15458 hooks.normalizeUnits = normalizeUnits;
15459 hooks.relativeTimeRounding = getSetRelativeTimeRounding;
15460 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
15461 hooks.calendarFormat = getCalendarFormat;
15462 hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats
15463
15464 hooks.HTML5_FMT = {
15465 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',
15466 // <input type="datetime-local" />
15467 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',
15468 // <input type="datetime-local" step="1" />
15469 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',
15470 // <input type="datetime-local" step="0.001" />
15471 DATE: 'YYYY-MM-DD',
15472 // <input type="date" />
15473 TIME: 'HH:mm',
15474 // <input type="time" />
15475 TIME_SECONDS: 'HH:mm:ss',
15476 // <input type="time" step="1" />
15477 TIME_MS: 'HH:mm:ss.SSS',
15478 // <input type="time" step="0.001" />
15479 WEEK: 'GGGG-[W]WW',
15480 // <input type="week" />
15481 MONTH: 'YYYY-MM' // <input type="month" />
15482
15483 };
15484 return hooks;
15485 });
15486}); // Maps for number <-> hex string conversion
15487
15488var byteToHex$2$1 = [];
15489
15490for (var i$2$1 = 0; i$2$1 < 256; i$2$1++) {
15491 byteToHex$2$1[i$2$1] = (i$2$1 + 0x100).toString(16).substr(1);
15492}
15493/**
15494 * Generate 16 random bytes to be used as a base for UUID.
15495 *
15496 * @ignore
15497 */
15498
15499
15500var random$1$1 = function () {
15501 if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
15502 // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
15503 // Moderately fast, high quality
15504 var _rnds8 = new Uint8Array(16);
15505
15506 return function whatwgRNG() {
15507 crypto.getRandomValues(_rnds8);
15508 return _rnds8;
15509 };
15510 } // Math.random()-based (RNG)
15511 //
15512 // If all else fails, use Math.random().
15513 // It's fast, but is of unspecified quality.
15514
15515
15516 var _rnds = new Array(16);
15517
15518 return function () {
15519 for (var i = 0, r; i < 16; i++) {
15520 if ((i & 0x03) === 0) {
15521 r = Math.random() * 0x100000000;
15522 }
15523
15524 _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
15525 }
15526
15527 return _rnds;
15528 }; // uuid.js
15529 //
15530 // Copyright (c) 2010-2012 Robert Kieffer
15531 // MIT License - http://opensource.org/licenses/mit-license.php
15532 // Unique ID creation requires a high quality random # generator. We feature
15533 // detect to determine the best RNG source, normalizing to a function that
15534 // returns 128-bits of randomness, since that's what's usually required
15535 // return require('./rng');
15536}();
15537
15538var byteToHex$1$1$1 = [];
15539
15540for (var i$1$1$1 = 0; i$1$1$1 < 256; i$1$1$1++) {
15541 byteToHex$1$1$1[i$1$1$1] = (i$1$1$1 + 0x100).toString(16).substr(1);
15542} // **`v1()` - Generate time-based UUID**
15543//
15544// Inspired by https://github.com/LiosK/UUID.js
15545// and http://docs.python.org/library/uuid.html
15546// random #'s we need to init node and clockseq
15547
15548
15549var seedBytes$1$1 = random$1$1(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
15550
15551var defaultNodeId$1$1 = [seedBytes$1$1[0] | 0x01, seedBytes$1$1[1], seedBytes$1$1[2], seedBytes$1$1[3], seedBytes$1$1[4], seedBytes$1$1[5]]; // Per 4.2.2, randomize (14 bit) clockseq
15552
15553var defaultClockseq$1$1 = (seedBytes$1$1[6] << 8 | seedBytes$1$1[7]) & 0x3fff; // Previous uuid creation time
15554// code from http://momentjs.com/
15555
15556var ASPDateRegex$1 = /^\/?Date\((-?\d+)/i; // Color REs
15557
15558/**
15559 * Hue, Saturation, Value.
15560 */
15561
15562/**
15563 * Test whether given object is a number
15564 *
15565 * @param value - Input value of unknown type.
15566 *
15567 * @returns True if number, false otherwise.
15568 */
15569
15570function isNumber$1(value) {
15571 return value instanceof Number || typeof value === "number";
15572}
15573/**
15574 * Test whether given object is a string
15575 *
15576 * @param value - Input value of unknown type.
15577 *
15578 * @returns True if string, false otherwise.
15579 */
15580
15581
15582function isString$1(value) {
15583 return value instanceof String || typeof value === "string";
15584}
15585/**
15586 * Test whether given object is a Moment date.
15587 * @TODO: This is basically a workaround, if Moment was imported property it wouldn't necessary as moment.isMoment is a TS type guard.
15588 *
15589 * @param value - Input value of unknown type.
15590 *
15591 * @returns True if Moment instance, false otherwise.
15592 */
15593
15594
15595function isMoment(value) {
15596 return moment.isMoment(value);
15597}
15598/**
15599 * Copy property from b to a if property present in a.
15600 * If property in b explicitly set to null, delete it if `allowDeletion` set.
15601 *
15602 * Internal helper routine, should not be exported. Not added to `exports` for that reason.
15603 *
15604 * @param a - Target object.
15605 * @param b - Source object.
15606 * @param prop - Name of property to copy from b to a.
15607 * @param allowDeletion if true, delete property in a if explicitly set to null in b
15608 */
15609
15610
15611function copyOrDelete$1(a, b, prop, allowDeletion) {
15612 var doDeletion = false;
15613
15614 if (allowDeletion === true) {
15615 doDeletion = b[prop] === null && a[prop] !== undefined;
15616 }
15617
15618 if (doDeletion) {
15619 delete a[prop];
15620 } else {
15621 a[prop] = b[prop]; // Remember, this is a reference copy!
15622 }
15623}
15624/**
15625 * Deep extend an object a with the properties of object b
15626 *
15627 * @param a - Target object.
15628 * @param b - Source object.
15629 * @param protoExtend - If true, the prototype values will also be extended
15630 * (ie. the options objects that inherit from others will also get the inherited options).
15631 * @param allowDeletion - If true, the values of fields that are null will be deleted.
15632 *
15633 * @returns Argument a.
15634 */
15635
15636
15637function deepExtend$1(a, b) {
15638 var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15639 var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
15640
15641 for (var prop in b) {
15642 if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
15643 if (_typeof_1$1$1(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$2$1$1(b[prop]) === Object.prototype) {
15644 if (a[prop] === undefined) {
15645 a[prop] = deepExtend$1({}, b[prop], protoExtend); // NOTE: allowDeletion not propagated!
15646 } else if (_typeof_1$1$1(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$2$1$1(a[prop]) === Object.prototype) {
15647 deepExtend$1(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated!
15648 } else {
15649 copyOrDelete$1(a, b, prop, allowDeletion);
15650 }
15651 } else if (isArray$5$1$1(b[prop])) {
15652 var _context;
15653
15654 a[prop] = slice$2$1(_context = b[prop]).call(_context);
15655 } else {
15656 copyOrDelete$1(a, b, prop, allowDeletion);
15657 }
15658 }
15659 }
15660
15661 return a;
15662}
15663/**
15664 * Convert an object into another type
15665 *
15666 * @param object - Value of unknown type.
15667 * @param type - Name of the desired type.
15668 *
15669 * @returns Object in the desired type.
15670 * @throws Error
15671 */
15672
15673
15674function convert(object, type) {
15675 var match;
15676
15677 if (object === undefined) {
15678 return undefined;
15679 }
15680
15681 if (object === null) {
15682 return null;
15683 }
15684
15685 if (!type) {
15686 return object;
15687 }
15688
15689 if (!(typeof type === "string") && !(type instanceof String)) {
15690 throw new Error("Type must be a string");
15691 } //noinspection FallthroughInSwitchStatementJS
15692
15693
15694 switch (type) {
15695 case "boolean":
15696 case "Boolean":
15697 return Boolean(object);
15698
15699 case "number":
15700 case "Number":
15701 if (isString$1(object) && !isNaN(Date.parse(object))) {
15702 return moment(object).valueOf();
15703 } else {
15704 // @TODO: I don't think that Number and String constructors are a good idea.
15705 // This could also fail if the object doesn't have valueOf method or if it's redefined.
15706 // For example: Object.create(null) or { valueOf: 7 }.
15707 return Number(object.valueOf());
15708 }
15709
15710 case "string":
15711 case "String":
15712 return String(object);
15713
15714 case "Date":
15715 if (isNumber$1(object)) {
15716 return new Date(object);
15717 }
15718
15719 if (object instanceof Date) {
15720 return new Date(object.valueOf());
15721 } else if (isMoment(object)) {
15722 return new Date(object.valueOf());
15723 }
15724
15725 if (isString$1(object)) {
15726 match = ASPDateRegex$1.exec(object);
15727
15728 if (match) {
15729 // object is an ASP date
15730 return new Date(Number(match[1])); // parse number
15731 } else {
15732 return moment(new Date(object)).toDate(); // parse string
15733 }
15734 } else {
15735 throw new Error("Cannot convert object of type " + getType$1(object) + " to type Date");
15736 }
15737
15738 case "Moment":
15739 if (isNumber$1(object)) {
15740 return moment(object);
15741 }
15742
15743 if (object instanceof Date) {
15744 return moment(object.valueOf());
15745 } else if (isMoment(object)) {
15746 return moment(object);
15747 }
15748
15749 if (isString$1(object)) {
15750 match = ASPDateRegex$1.exec(object);
15751
15752 if (match) {
15753 // object is an ASP date
15754 return moment(Number(match[1])); // parse number
15755 } else {
15756 return moment(object); // parse string
15757 }
15758 } else {
15759 throw new Error("Cannot convert object of type " + getType$1(object) + " to type Date");
15760 }
15761
15762 case "ISODate":
15763 if (isNumber$1(object)) {
15764 return new Date(object);
15765 } else if (object instanceof Date) {
15766 return object.toISOString();
15767 } else if (isMoment(object)) {
15768 return object.toDate().toISOString();
15769 } else if (isString$1(object)) {
15770 match = ASPDateRegex$1.exec(object);
15771
15772 if (match) {
15773 // object is an ASP date
15774 return new Date(Number(match[1])).toISOString(); // parse number
15775 } else {
15776 return moment(object).format(); // ISO 8601
15777 }
15778 } else {
15779 throw new Error("Cannot convert object of type " + getType$1(object) + " to type ISODate");
15780 }
15781
15782 case "ASPDate":
15783 if (isNumber$1(object)) {
15784 return "/Date(" + object + ")/";
15785 } else if (object instanceof Date || isMoment(object)) {
15786 return "/Date(" + object.valueOf() + ")/";
15787 } else if (isString$1(object)) {
15788 match = ASPDateRegex$1.exec(object);
15789
15790 var _value;
15791
15792 if (match) {
15793 // object is an ASP date
15794 _value = new Date(Number(match[1])).valueOf(); // parse number
15795 } else {
15796 _value = new Date(object).valueOf(); // parse string
15797 }
15798
15799 return "/Date(" + _value + ")/";
15800 } else {
15801 throw new Error("Cannot convert object of type " + getType$1(object) + " to type ASPDate");
15802 }
15803
15804 default:
15805 var never = type;
15806 throw new Error("Unknown type ".concat(never));
15807 }
15808}
15809/**
15810 * Get the type of an object, for example exports.getType([]) returns 'Array'
15811 *
15812 * @param object - Input value of unknown type.
15813 *
15814 * @returns Detected type.
15815 */
15816
15817
15818function getType$1(object) {
15819 var type = _typeof_1$1$1(object);
15820
15821 if (type === "object") {
15822 if (object === null) {
15823 return "null";
15824 }
15825
15826 if (object instanceof Boolean) {
15827 return "Boolean";
15828 }
15829
15830 if (object instanceof Number) {
15831 return "Number";
15832 }
15833
15834 if (object instanceof String) {
15835 return "String";
15836 }
15837
15838 if (isArray$5$1$1(object)) {
15839 return "Array";
15840 }
15841
15842 if (object instanceof Date) {
15843 return "Date";
15844 }
15845
15846 return "Object";
15847 }
15848
15849 if (type === "number") {
15850 return "Number";
15851 }
15852
15853 if (type === "boolean") {
15854 return "Boolean";
15855 }
15856
15857 if (type === "string") {
15858 return "String";
15859 }
15860
15861 if (type === undefined) {
15862 return "undefined";
15863 }
15864
15865 return type;
15866}
15867/**
15868 * Determine whether a value can be used as an id.
15869 *
15870 * @param value - Input value of unknown type.
15871 *
15872 * @returns True if the value is valid id, false otherwise.
15873 */
15874
15875
15876function isId(value) {
15877 return typeof value === "string" || typeof value === "number";
15878}
15879
15880var max$2$1 = Math.max;
15881var min$3 = Math.min;
15882var MAX_SAFE_INTEGER$2 = 0x1FFFFFFFFFFFFF;
15883var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method
15884// https://tc39.github.io/ecma262/#sec-array.prototype.splice
15885// with adding support of @@species
15886
15887_export$1({
15888 target: 'Array',
15889 proto: true,
15890 forced: !arrayMethodHasSpeciesSupport$1('splice')
15891}, {
15892 splice: function splice(start, deleteCount
15893 /* , ...items */
15894 ) {
15895 var O = toObject$1(this);
15896 var len = toLength$1(O.length);
15897 var actualStart = toAbsoluteIndex$1(start, len);
15898 var argumentsLength = arguments.length;
15899 var insertCount, actualDeleteCount, A, k, from, to;
15900
15901 if (argumentsLength === 0) {
15902 insertCount = actualDeleteCount = 0;
15903 } else if (argumentsLength === 1) {
15904 insertCount = 0;
15905 actualDeleteCount = len - actualStart;
15906 } else {
15907 insertCount = argumentsLength - 2;
15908 actualDeleteCount = min$3(max$2$1(toInteger$1(deleteCount), 0), len - actualStart);
15909 }
15910
15911 if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$2) {
15912 throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
15913 }
15914
15915 A = arraySpeciesCreate$1(O, actualDeleteCount);
15916
15917 for (k = 0; k < actualDeleteCount; k++) {
15918 from = actualStart + k;
15919 if (from in O) createProperty$1(A, k, O[from]);
15920 }
15921
15922 A.length = actualDeleteCount;
15923
15924 if (insertCount < actualDeleteCount) {
15925 for (k = actualStart; k < len - actualDeleteCount; k++) {
15926 from = k + actualDeleteCount;
15927 to = k + insertCount;
15928 if (from in O) O[to] = O[from];else delete O[to];
15929 }
15930
15931 for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
15932 } else if (insertCount > actualDeleteCount) {
15933 for (k = len - actualDeleteCount; k > actualStart; k--) {
15934 from = k + actualDeleteCount - 1;
15935 to = k + insertCount - 1;
15936 if (from in O) O[to] = O[from];else delete O[to];
15937 }
15938 }
15939
15940 for (k = 0; k < insertCount; k++) {
15941 O[k + actualStart] = arguments[k + 2];
15942 }
15943
15944 O.length = len - actualDeleteCount + insertCount;
15945 return A;
15946 }
15947});
15948
15949var splice = entryVirtual$1('Array').splice;
15950var ArrayPrototype$c = Array.prototype;
15951
15952var splice_1 = function (it) {
15953 var own = it.splice;
15954 return it === ArrayPrototype$c || it instanceof Array && own === ArrayPrototype$c.splice ? splice : own;
15955};
15956
15957var splice$1 = splice_1;
15958var splice$2 = splice$1;
15959var slice$3$1 = [].slice;
15960var MSIE = /MSIE .\./.test(userAgent$1); // <- dirty ie9- check
15961
15962var wrap$2 = function (scheduler) {
15963 return function (handler, timeout
15964 /* , ...arguments */
15965 ) {
15966 var boundArgs = arguments.length > 2;
15967 var args = boundArgs ? slice$3$1.call(arguments, 2) : undefined;
15968 return scheduler(boundArgs ? function () {
15969 // eslint-disable-next-line no-new-func
15970 (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
15971 } : handler, timeout);
15972 };
15973}; // ie9- setTimeout & setInterval additional parameters fix
15974// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
15975
15976
15977_export$1({
15978 global: true,
15979 bind: true,
15980 forced: MSIE
15981}, {
15982 // `setTimeout` method
15983 // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
15984 setTimeout: wrap$2(global_1$1.setTimeout),
15985 // `setInterval` method
15986 // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
15987 setInterval: wrap$2(global_1$1.setInterval)
15988});
15989
15990var setTimeout$1 = path$1.setTimeout;
15991var setTimeout$1$1 = setTimeout$1;
15992/* eslint @typescript-eslint/member-ordering: ["error", { "classes": ["field", "constructor", "method"] }] */
15993
15994/**
15995 * A queue.
15996 *
15997 * @typeParam T - The type of method names to be replaced by queued versions.
15998 */
15999
16000var Queue =
16001/*#__PURE__*/
16002function () {
16003 /**
16004 * Construct a new Queue.
16005 *
16006 * @param options - Queue configuration.
16007 */
16008 function Queue(options) {
16009 classCallCheck(this, Queue);
16010 this._queue = [];
16011 this._timeout = null;
16012 this._extended = null; // options
16013
16014 this.delay = null;
16015 this.max = Infinity;
16016 this.setOptions(options);
16017 }
16018 /**
16019 * Update the configuration of the queue.
16020 *
16021 * @param options - Queue configuration.
16022 */
16023
16024
16025 createClass(Queue, [{
16026 key: "setOptions",
16027 value: function setOptions(options) {
16028 if (options && typeof options.delay !== "undefined") {
16029 this.delay = options.delay;
16030 }
16031
16032 if (options && typeof options.max !== "undefined") {
16033 this.max = options.max;
16034 }
16035
16036 this._flushIfNeeded();
16037 }
16038 /**
16039 * Extend an object with queuing functionality.
16040 * The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.
16041 *
16042 * @param object - The object to be extended.
16043 * @param options - Additional options.
16044 *
16045 * @returns The created queue.
16046 */
16047
16048 }, {
16049 key: "destroy",
16050
16051 /**
16052 * Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object.
16053 */
16054 value: function destroy() {
16055 this.flush();
16056
16057 if (this._extended) {
16058 var object = this._extended.object;
16059 var methods = this._extended.methods;
16060
16061 for (var i = 0; i < methods.length; i++) {
16062 var method = methods[i];
16063
16064 if (method.original) {
16065 // @TODO: better solution?
16066 object[method.name] = method.original;
16067 } else {
16068 // @TODO: better solution?
16069 delete object[method.name];
16070 }
16071 }
16072
16073 this._extended = null;
16074 }
16075 }
16076 /**
16077 * Replace a method on an object with a queued version.
16078 *
16079 * @param object - Object having the method.
16080 * @param method - The method name.
16081 */
16082
16083 }, {
16084 key: "replace",
16085 value: function replace(object, method) {
16086 /* eslint-disable-next-line @typescript-eslint/no-this-alias */
16087 var me = this;
16088 var original = object[method];
16089
16090 if (!original) {
16091 throw new Error("Method " + method + " undefined");
16092 }
16093
16094 object[method] = function () {
16095 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16096 args[_key] = arguments[_key];
16097 } // add this call to the queue
16098
16099
16100 me.queue({
16101 args: args,
16102 fn: original,
16103 context: this
16104 });
16105 };
16106 }
16107 /**
16108 * Queue a call.
16109 *
16110 * @param entry - The function or entry to be queued.
16111 */
16112
16113 }, {
16114 key: "queue",
16115 value: function queue(entry) {
16116 if (typeof entry === "function") {
16117 this._queue.push({
16118 fn: entry
16119 });
16120 } else {
16121 this._queue.push(entry);
16122 }
16123
16124 this._flushIfNeeded();
16125 }
16126 /**
16127 * Check whether the queue needs to be flushed.
16128 */
16129
16130 }, {
16131 key: "_flushIfNeeded",
16132 value: function _flushIfNeeded() {
16133 var _this = this; // flush when the maximum is exceeded.
16134
16135
16136 if (this._queue.length > this.max) {
16137 this.flush();
16138 } // flush after a period of inactivity when a delay is configured
16139
16140
16141 if (this._timeout != null) {
16142 clearTimeout(this._timeout);
16143 this._timeout = null;
16144 }
16145
16146 if (this.queue.length > 0 && typeof this.delay === "number") {
16147 this._timeout = setTimeout$1$1(function () {
16148 _this.flush();
16149 }, this.delay);
16150 }
16151 }
16152 /**
16153 * Flush all queued calls
16154 */
16155
16156 }, {
16157 key: "flush",
16158 value: function flush() {
16159 var _context, _context2;
16160
16161 forEach$2$1(_context = splice$2(_context2 = this._queue).call(_context2, 0)).call(_context, function (entry) {
16162 entry.fn.apply(entry.context || entry.fn, entry.args || []);
16163 });
16164 }
16165 }], [{
16166 key: "extend",
16167 value: function extend(object, options) {
16168 var queue = new Queue(options);
16169
16170 if (object.flush !== undefined) {
16171 throw new Error("Target object already has a property flush");
16172 }
16173
16174 object.flush = function () {
16175 queue.flush();
16176 };
16177
16178 var methods = [{
16179 name: "flush",
16180 original: undefined
16181 }];
16182
16183 if (options && options.replace) {
16184 for (var i = 0; i < options.replace.length; i++) {
16185 var name = options.replace[i];
16186 methods.push({
16187 name: name,
16188 // @TODO: better solution?
16189 original: object[name]
16190 }); // @TODO: better solution?
16191
16192 queue.replace(object, name);
16193 }
16194 }
16195
16196 queue._extended = {
16197 object: object,
16198 methods: methods
16199 };
16200 return queue;
16201 }
16202 }]);
16203 return Queue;
16204}();
16205/* eslint-disable @typescript-eslint/member-ordering */
16206
16207/**
16208 * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
16209 *
16210 * @typeParam Item - Item type that may or may not have an id.
16211 * @typeParam IdProp - Name of the property that contains the id.
16212 */
16213
16214
16215var DataSetPart =
16216/*#__PURE__*/
16217function () {
16218 function DataSetPart() {
16219 classCallCheck(this, DataSetPart);
16220 this._subscribers = {
16221 "*": [],
16222 add: [],
16223 remove: [],
16224 update: []
16225 };
16226 /**
16227 * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
16228 */
16229
16230 this.subscribe = DataSetPart.prototype.on;
16231 /**
16232 * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
16233 */
16234
16235 this.unsubscribe = DataSetPart.prototype.off;
16236 }
16237 /**
16238 * Trigger an event
16239 *
16240 * @param event - Event name.
16241 * @param payload - Event payload.
16242 * @param senderId - Id of the sender.
16243 */
16244
16245
16246 createClass(DataSetPart, [{
16247 key: "_trigger",
16248 value: function _trigger(event, payload, senderId) {
16249 var _context, _context2;
16250
16251 if (event === "*") {
16252 throw new Error("Cannot trigger event *");
16253 }
16254
16255 forEach$2$1(_context = concat$2$1(_context2 = []).call(_context2, toConsumableArray$1(this._subscribers[event]), toConsumableArray$1(this._subscribers["*"]))).call(_context, function (subscriber) {
16256 subscriber(event, payload, senderId != null ? senderId : null);
16257 });
16258 }
16259 /**
16260 * Subscribe to an event, add an event listener.
16261 *
16262 * @remarks Non-function callbacks are ignored.
16263 *
16264 * @param event - Event name.
16265 * @param callback - Callback method.
16266 */
16267
16268 }, {
16269 key: "on",
16270 value: function on(event, callback) {
16271 if (typeof callback === "function") {
16272 this._subscribers[event].push(callback);
16273 } // @TODO: Maybe throw for invalid callbacks?
16274
16275 }
16276 /**
16277 * Unsubscribe from an event, remove an event listener.
16278 *
16279 * @remarks If the same callback was subscribed more than once **all** occurences will be removed.
16280 *
16281 * @param event - Event name.
16282 * @param callback - Callback method.
16283 */
16284
16285 }, {
16286 key: "off",
16287 value: function off(event, callback) {
16288 var _context3;
16289
16290 this._subscribers[event] = filter$2$1(_context3 = this._subscribers[event]).call(_context3, function (subscriber) {
16291 return subscriber !== callback;
16292 });
16293 }
16294 }]);
16295 return DataSetPart;
16296}(); // https://tc39.github.io/ecma262/#sec-set-objects
16297
16298
16299var es_set = collection('Set', function (get) {
16300 return function Set() {
16301 return get(this, arguments.length ? arguments[0] : undefined);
16302 };
16303}, collectionStrong);
16304var set$2 = path$1.Set;
16305var set$3 = set$2;
16306var set$4 = set$3;
16307var create$3$1 = create$3;
16308var create$4 = create$3$1;
16309
16310function _arrayWithHoles(arr) {
16311 if (isArray$3$1(arr)) return arr;
16312}
16313
16314var arrayWithHoles = _arrayWithHoles;
16315
16316function _iterableToArrayLimit(arr, i) {
16317 if (!(isIterable$2$1(Object(arr)) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
16318 return;
16319 }
16320
16321 var _arr = [];
16322 var _n = true;
16323 var _d = false;
16324 var _e = undefined;
16325
16326 try {
16327 for (var _i = getIterator$2$1(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
16328 _arr.push(_s.value);
16329
16330 if (i && _arr.length === i) break;
16331 }
16332 } catch (err) {
16333 _d = true;
16334 _e = err;
16335 } finally {
16336 try {
16337 if (!_n && _i["return"] != null) _i["return"]();
16338 } finally {
16339 if (_d) throw _e;
16340 }
16341 }
16342
16343 return _arr;
16344}
16345
16346var iterableToArrayLimit = _iterableToArrayLimit;
16347
16348function _nonIterableRest() {
16349 throw new TypeError("Invalid attempt to destructure non-iterable instance");
16350}
16351
16352var nonIterableRest = _nonIterableRest;
16353
16354function _slicedToArray(arr, i) {
16355 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
16356}
16357
16358var slicedToArray = _slicedToArray;
16359/**
16360 * Data stream
16361 *
16362 * @remarks
16363 * [[DataStream]] offers an always up to date stream of items from a [[DataSet]] or [[DataView]].
16364 * 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.
16365 * Multiple invocations of for example [[toItemArray]] may yield different results (if the data source like for example [[DataSet]] gets modified).
16366 *
16367 * @typeparam Item - The item type this stream is going to work with.
16368 */
16369
16370var DataStream =
16371/*#__PURE__*/
16372function () {
16373 /**
16374 * Create a new data stream.
16375 *
16376 * @param _pairs - The id, item pairs.
16377 */
16378 function DataStream(_pairs) {
16379 classCallCheck(this, DataStream);
16380 this._pairs = _pairs;
16381 }
16382 /**
16383 * Return an iterable of key, value pairs for every entry in the stream.
16384 */
16385
16386
16387 createClass(DataStream, [{
16388 key: iterator$2$1,
16389 value:
16390 /*#__PURE__*/
16391 regenerator.mark(function value() {
16392 var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, id, item;
16393
16394 return regenerator.wrap(function value$(_context) {
16395 while (1) {
16396 switch (_context.prev = _context.next) {
16397 case 0:
16398 _iteratorNormalCompletion = true;
16399 _didIteratorError = false;
16400 _iteratorError = undefined;
16401 _context.prev = 3;
16402 _iterator = getIterator$2$1(this._pairs);
16403
16404 case 5:
16405 if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
16406 _context.next = 12;
16407 break;
16408 }
16409
16410 _step$value = slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1];
16411 _context.next = 9;
16412 return [id, item];
16413
16414 case 9:
16415 _iteratorNormalCompletion = true;
16416 _context.next = 5;
16417 break;
16418
16419 case 12:
16420 _context.next = 18;
16421 break;
16422
16423 case 14:
16424 _context.prev = 14;
16425 _context.t0 = _context["catch"](3);
16426 _didIteratorError = true;
16427 _iteratorError = _context.t0;
16428
16429 case 18:
16430 _context.prev = 18;
16431 _context.prev = 19;
16432
16433 if (!_iteratorNormalCompletion && _iterator.return != null) {
16434 _iterator.return();
16435 }
16436
16437 case 21:
16438 _context.prev = 21;
16439
16440 if (!_didIteratorError) {
16441 _context.next = 24;
16442 break;
16443 }
16444
16445 throw _iteratorError;
16446
16447 case 24:
16448 return _context.finish(21);
16449
16450 case 25:
16451 return _context.finish(18);
16452
16453 case 26:
16454 case "end":
16455 return _context.stop();
16456 }
16457 }
16458 }, value, this, [[3, 14, 18, 26], [19,, 21, 25]]);
16459 })
16460 /**
16461 * Return an iterable of key, value pairs for every entry in the stream.
16462 */
16463
16464 }, {
16465 key: "entries",
16466 value:
16467 /*#__PURE__*/
16468 regenerator.mark(function entries() {
16469 var _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step2$value, id, item;
16470
16471 return regenerator.wrap(function entries$(_context2) {
16472 while (1) {
16473 switch (_context2.prev = _context2.next) {
16474 case 0:
16475 _iteratorNormalCompletion2 = true;
16476 _didIteratorError2 = false;
16477 _iteratorError2 = undefined;
16478 _context2.prev = 3;
16479 _iterator2 = getIterator$2$1(this._pairs);
16480
16481 case 5:
16482 if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
16483 _context2.next = 12;
16484 break;
16485 }
16486
16487 _step2$value = slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1];
16488 _context2.next = 9;
16489 return [id, item];
16490
16491 case 9:
16492 _iteratorNormalCompletion2 = true;
16493 _context2.next = 5;
16494 break;
16495
16496 case 12:
16497 _context2.next = 18;
16498 break;
16499
16500 case 14:
16501 _context2.prev = 14;
16502 _context2.t0 = _context2["catch"](3);
16503 _didIteratorError2 = true;
16504 _iteratorError2 = _context2.t0;
16505
16506 case 18:
16507 _context2.prev = 18;
16508 _context2.prev = 19;
16509
16510 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
16511 _iterator2.return();
16512 }
16513
16514 case 21:
16515 _context2.prev = 21;
16516
16517 if (!_didIteratorError2) {
16518 _context2.next = 24;
16519 break;
16520 }
16521
16522 throw _iteratorError2;
16523
16524 case 24:
16525 return _context2.finish(21);
16526
16527 case 25:
16528 return _context2.finish(18);
16529
16530 case 26:
16531 case "end":
16532 return _context2.stop();
16533 }
16534 }
16535 }, entries, this, [[3, 14, 18, 26], [19,, 21, 25]]);
16536 })
16537 /**
16538 * Return an iterable of keys in the stream.
16539 */
16540
16541 }, {
16542 key: "keys",
16543 value:
16544 /*#__PURE__*/
16545 regenerator.mark(function keys() {
16546 var _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _step3$value, id;
16547
16548 return regenerator.wrap(function keys$(_context3) {
16549 while (1) {
16550 switch (_context3.prev = _context3.next) {
16551 case 0:
16552 _iteratorNormalCompletion3 = true;
16553 _didIteratorError3 = false;
16554 _iteratorError3 = undefined;
16555 _context3.prev = 3;
16556 _iterator3 = getIterator$2$1(this._pairs);
16557
16558 case 5:
16559 if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) {
16560 _context3.next = 12;
16561 break;
16562 }
16563
16564 _step3$value = slicedToArray(_step3.value, 1), id = _step3$value[0];
16565 _context3.next = 9;
16566 return id;
16567
16568 case 9:
16569 _iteratorNormalCompletion3 = true;
16570 _context3.next = 5;
16571 break;
16572
16573 case 12:
16574 _context3.next = 18;
16575 break;
16576
16577 case 14:
16578 _context3.prev = 14;
16579 _context3.t0 = _context3["catch"](3);
16580 _didIteratorError3 = true;
16581 _iteratorError3 = _context3.t0;
16582
16583 case 18:
16584 _context3.prev = 18;
16585 _context3.prev = 19;
16586
16587 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
16588 _iterator3.return();
16589 }
16590
16591 case 21:
16592 _context3.prev = 21;
16593
16594 if (!_didIteratorError3) {
16595 _context3.next = 24;
16596 break;
16597 }
16598
16599 throw _iteratorError3;
16600
16601 case 24:
16602 return _context3.finish(21);
16603
16604 case 25:
16605 return _context3.finish(18);
16606
16607 case 26:
16608 case "end":
16609 return _context3.stop();
16610 }
16611 }
16612 }, keys, this, [[3, 14, 18, 26], [19,, 21, 25]]);
16613 })
16614 /**
16615 * Return an iterable of values in the stream.
16616 */
16617
16618 }, {
16619 key: "values",
16620 value:
16621 /*#__PURE__*/
16622 regenerator.mark(function values() {
16623 var _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _step4$value, item;
16624
16625 return regenerator.wrap(function values$(_context4) {
16626 while (1) {
16627 switch (_context4.prev = _context4.next) {
16628 case 0:
16629 _iteratorNormalCompletion4 = true;
16630 _didIteratorError4 = false;
16631 _iteratorError4 = undefined;
16632 _context4.prev = 3;
16633 _iterator4 = getIterator$2$1(this._pairs);
16634
16635 case 5:
16636 if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) {
16637 _context4.next = 12;
16638 break;
16639 }
16640
16641 _step4$value = slicedToArray(_step4.value, 2), item = _step4$value[1];
16642 _context4.next = 9;
16643 return item;
16644
16645 case 9:
16646 _iteratorNormalCompletion4 = true;
16647 _context4.next = 5;
16648 break;
16649
16650 case 12:
16651 _context4.next = 18;
16652 break;
16653
16654 case 14:
16655 _context4.prev = 14;
16656 _context4.t0 = _context4["catch"](3);
16657 _didIteratorError4 = true;
16658 _iteratorError4 = _context4.t0;
16659
16660 case 18:
16661 _context4.prev = 18;
16662 _context4.prev = 19;
16663
16664 if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
16665 _iterator4.return();
16666 }
16667
16668 case 21:
16669 _context4.prev = 21;
16670
16671 if (!_didIteratorError4) {
16672 _context4.next = 24;
16673 break;
16674 }
16675
16676 throw _iteratorError4;
16677
16678 case 24:
16679 return _context4.finish(21);
16680
16681 case 25:
16682 return _context4.finish(18);
16683
16684 case 26:
16685 case "end":
16686 return _context4.stop();
16687 }
16688 }
16689 }, values, this, [[3, 14, 18, 26], [19,, 21, 25]]);
16690 })
16691 /**
16692 * Return an array containing all the ids in this stream.
16693 *
16694 * @remarks
16695 * The array may contain duplicities.
16696 *
16697 * @returns The array with all ids from this stream.
16698 */
16699
16700 }, {
16701 key: "toIdArray",
16702 value: function toIdArray() {
16703 var _context5;
16704
16705 return map$2$1(_context5 = toConsumableArray$1(this._pairs)).call(_context5, function (pair) {
16706 return pair[0];
16707 });
16708 }
16709 /**
16710 * Return an array containing all the items in this stream.
16711 *
16712 * @remarks
16713 * The array may contain duplicities.
16714 *
16715 * @returns The array with all items from this stream.
16716 */
16717
16718 }, {
16719 key: "toItemArray",
16720 value: function toItemArray() {
16721 var _context6;
16722
16723 return map$2$1(_context6 = toConsumableArray$1(this._pairs)).call(_context6, function (pair) {
16724 return pair[1];
16725 });
16726 }
16727 /**
16728 * Return an array containing all the entries in this stream.
16729 *
16730 * @remarks
16731 * The array may contain duplicities.
16732 *
16733 * @returns The array with all entries from this stream.
16734 */
16735
16736 }, {
16737 key: "toEntryArray",
16738 value: function toEntryArray() {
16739 return toConsumableArray$1(this._pairs);
16740 }
16741 /**
16742 * Return an object map containing all the items in this stream accessible by ids.
16743 *
16744 * @remarks
16745 * In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object.
16746 *
16747 * @returns The object map of all id → item pairs from this stream.
16748 */
16749
16750 }, {
16751 key: "toObjectMap",
16752 value: function toObjectMap() {
16753 var map = create$4(null);
16754 var _iteratorNormalCompletion5 = true;
16755 var _didIteratorError5 = false;
16756 var _iteratorError5 = undefined;
16757
16758 try {
16759 for (var _iterator5 = getIterator$2$1(this._pairs), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
16760 var _step5$value = slicedToArray(_step5.value, 2),
16761 id = _step5$value[0],
16762 item = _step5$value[1];
16763
16764 map[id] = item;
16765 }
16766 } catch (err) {
16767 _didIteratorError5 = true;
16768 _iteratorError5 = err;
16769 } finally {
16770 try {
16771 if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
16772 _iterator5.return();
16773 }
16774 } finally {
16775 if (_didIteratorError5) {
16776 throw _iteratorError5;
16777 }
16778 }
16779 }
16780
16781 return map;
16782 }
16783 /**
16784 * Return a map containing all the items in this stream accessible by ids.
16785 *
16786 * @returns The map of all id → item pairs from this stream.
16787 */
16788
16789 }, {
16790 key: "toMap",
16791 value: function toMap() {
16792 return new map$5(this._pairs);
16793 }
16794 /**
16795 * Return a set containing all the (unique) ids in this stream.
16796 *
16797 * @returns The set of all ids from this stream.
16798 */
16799
16800 }, {
16801 key: "toIdSet",
16802 value: function toIdSet() {
16803 return new set$4(this.toIdArray());
16804 }
16805 /**
16806 * Return a set containing all the (unique) items in this stream.
16807 *
16808 * @returns The set of all items from this stream.
16809 */
16810
16811 }, {
16812 key: "toItemSet",
16813 value: function toItemSet() {
16814 return new set$4(this.toItemArray());
16815 }
16816 /**
16817 * Cache the items from this stream.
16818 *
16819 * @remarks
16820 * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
16821 * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
16822 *
16823 * ## Example
16824 * ```javascript
16825 * const ds = new DataSet([…])
16826 *
16827 * const cachedStream = ds.stream()
16828 * .filter(…)
16829 * .sort(…)
16830 * .map(…)
16831 * .cached(…) // Data are fetched, processed and cached here.
16832 *
16833 * ds.clear()
16834 * chachedStream // Still has all the items.
16835 * ```
16836 *
16837 * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
16838 */
16839
16840 }, {
16841 key: "cache",
16842 value: function cache() {
16843 return new DataStream(toConsumableArray$1(this._pairs));
16844 }
16845 /**
16846 * Get the distinct values of given property.
16847 *
16848 * @param callback - The function that picks and possibly converts the property.
16849 *
16850 * @typeparam T - The type of the distinct value.
16851 *
16852 * @returns A set of all distinct properties.
16853 */
16854
16855 }, {
16856 key: "distinct",
16857 value: function distinct(callback) {
16858 var set = new set$4();
16859 var _iteratorNormalCompletion6 = true;
16860 var _didIteratorError6 = false;
16861 var _iteratorError6 = undefined;
16862
16863 try {
16864 for (var _iterator6 = getIterator$2$1(this._pairs), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
16865 var _step6$value = slicedToArray(_step6.value, 2),
16866 id = _step6$value[0],
16867 item = _step6$value[1];
16868
16869 set.add(callback(item, id));
16870 }
16871 } catch (err) {
16872 _didIteratorError6 = true;
16873 _iteratorError6 = err;
16874 } finally {
16875 try {
16876 if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
16877 _iterator6.return();
16878 }
16879 } finally {
16880 if (_didIteratorError6) {
16881 throw _iteratorError6;
16882 }
16883 }
16884 }
16885
16886 return set;
16887 }
16888 /**
16889 * Filter the items of the stream.
16890 *
16891 * @param callback - The function that decides whether an item will be included.
16892 *
16893 * @returns A new data stream with the filtered items.
16894 */
16895
16896 }, {
16897 key: "filter",
16898 value: function filter(callback) {
16899 var pairs = this._pairs;
16900 return new DataStream(defineProperty$6$1({}, iterator$2$1,
16901 /*#__PURE__*/
16902 regenerator.mark(function _callee() {
16903 var _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, _step7$value, id, item;
16904
16905 return regenerator.wrap(function _callee$(_context7) {
16906 while (1) {
16907 switch (_context7.prev = _context7.next) {
16908 case 0:
16909 _iteratorNormalCompletion7 = true;
16910 _didIteratorError7 = false;
16911 _iteratorError7 = undefined;
16912 _context7.prev = 3;
16913 _iterator7 = getIterator$2$1(pairs);
16914
16915 case 5:
16916 if (_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done) {
16917 _context7.next = 13;
16918 break;
16919 }
16920
16921 _step7$value = slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1];
16922
16923 if (!callback(item, id)) {
16924 _context7.next = 10;
16925 break;
16926 }
16927
16928 _context7.next = 10;
16929 return [id, item];
16930
16931 case 10:
16932 _iteratorNormalCompletion7 = true;
16933 _context7.next = 5;
16934 break;
16935
16936 case 13:
16937 _context7.next = 19;
16938 break;
16939
16940 case 15:
16941 _context7.prev = 15;
16942 _context7.t0 = _context7["catch"](3);
16943 _didIteratorError7 = true;
16944 _iteratorError7 = _context7.t0;
16945
16946 case 19:
16947 _context7.prev = 19;
16948 _context7.prev = 20;
16949
16950 if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
16951 _iterator7.return();
16952 }
16953
16954 case 22:
16955 _context7.prev = 22;
16956
16957 if (!_didIteratorError7) {
16958 _context7.next = 25;
16959 break;
16960 }
16961
16962 throw _iteratorError7;
16963
16964 case 25:
16965 return _context7.finish(22);
16966
16967 case 26:
16968 return _context7.finish(19);
16969
16970 case 27:
16971 case "end":
16972 return _context7.stop();
16973 }
16974 }
16975 }, _callee, null, [[3, 15, 19, 27], [20,, 22, 26]]);
16976 })));
16977 }
16978 /**
16979 * Execute a callback for each item of the stream.
16980 *
16981 * @param callback - The function that will be invoked for each item.
16982 */
16983
16984 }, {
16985 key: "forEach",
16986 value: function forEach(callback) {
16987 var _iteratorNormalCompletion8 = true;
16988 var _didIteratorError8 = false;
16989 var _iteratorError8 = undefined;
16990
16991 try {
16992 for (var _iterator8 = getIterator$2$1(this._pairs), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
16993 var _step8$value = slicedToArray(_step8.value, 2),
16994 id = _step8$value[0],
16995 item = _step8$value[1];
16996
16997 callback(item, id);
16998 }
16999 } catch (err) {
17000 _didIteratorError8 = true;
17001 _iteratorError8 = err;
17002 } finally {
17003 try {
17004 if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
17005 _iterator8.return();
17006 }
17007 } finally {
17008 if (_didIteratorError8) {
17009 throw _iteratorError8;
17010 }
17011 }
17012 }
17013 }
17014 /**
17015 * Map the items into a different type.
17016 *
17017 * @param callback - The function that does the conversion.
17018 *
17019 * @typeparam Mapped - The type of the item after mapping.
17020 *
17021 * @returns A new data stream with the mapped items.
17022 */
17023
17024 }, {
17025 key: "map",
17026 value: function map(callback) {
17027 var pairs = this._pairs;
17028 return new DataStream(defineProperty$6$1({}, iterator$2$1,
17029 /*#__PURE__*/
17030 regenerator.mark(function _callee2() {
17031 var _iteratorNormalCompletion9, _didIteratorError9, _iteratorError9, _iterator9, _step9, _step9$value, id, item;
17032
17033 return regenerator.wrap(function _callee2$(_context8) {
17034 while (1) {
17035 switch (_context8.prev = _context8.next) {
17036 case 0:
17037 _iteratorNormalCompletion9 = true;
17038 _didIteratorError9 = false;
17039 _iteratorError9 = undefined;
17040 _context8.prev = 3;
17041 _iterator9 = getIterator$2$1(pairs);
17042
17043 case 5:
17044 if (_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done) {
17045 _context8.next = 12;
17046 break;
17047 }
17048
17049 _step9$value = slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1];
17050 _context8.next = 9;
17051 return [id, callback(item, id)];
17052
17053 case 9:
17054 _iteratorNormalCompletion9 = true;
17055 _context8.next = 5;
17056 break;
17057
17058 case 12:
17059 _context8.next = 18;
17060 break;
17061
17062 case 14:
17063 _context8.prev = 14;
17064 _context8.t0 = _context8["catch"](3);
17065 _didIteratorError9 = true;
17066 _iteratorError9 = _context8.t0;
17067
17068 case 18:
17069 _context8.prev = 18;
17070 _context8.prev = 19;
17071
17072 if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
17073 _iterator9.return();
17074 }
17075
17076 case 21:
17077 _context8.prev = 21;
17078
17079 if (!_didIteratorError9) {
17080 _context8.next = 24;
17081 break;
17082 }
17083
17084 throw _iteratorError9;
17085
17086 case 24:
17087 return _context8.finish(21);
17088
17089 case 25:
17090 return _context8.finish(18);
17091
17092 case 26:
17093 case "end":
17094 return _context8.stop();
17095 }
17096 }
17097 }, _callee2, null, [[3, 14, 18, 26], [19,, 21, 25]]);
17098 })));
17099 }
17100 /**
17101 * Get the item with the maximum value of given property.
17102 *
17103 * @param callback - The function that picks and possibly converts the property.
17104 *
17105 * @returns The item with the maximum if found otherwise null.
17106 */
17107
17108 }, {
17109 key: "max",
17110 value: function max(callback) {
17111 var iter = getIterator$2$1(this._pairs);
17112 var curr = iter.next();
17113
17114 if (curr.done) {
17115 return null;
17116 }
17117
17118 var maxItem = curr.value[1];
17119 var maxValue = callback(curr.value[1], curr.value[0]);
17120
17121 while (!(curr = iter.next()).done) {
17122 var _curr$value = slicedToArray(curr.value, 2),
17123 id = _curr$value[0],
17124 item = _curr$value[1];
17125
17126 var _value = callback(item, id);
17127
17128 if (_value > maxValue) {
17129 maxValue = _value;
17130 maxItem = item;
17131 }
17132 }
17133
17134 return maxItem;
17135 }
17136 /**
17137 * Get the item with the minimum value of given property.
17138 *
17139 * @param callback - The function that picks and possibly converts the property.
17140 *
17141 * @returns The item with the minimum if found otherwise null.
17142 */
17143
17144 }, {
17145 key: "min",
17146 value: function min(callback) {
17147 var iter = getIterator$2$1(this._pairs);
17148 var curr = iter.next();
17149
17150 if (curr.done) {
17151 return null;
17152 }
17153
17154 var minItem = curr.value[1];
17155 var minValue = callback(curr.value[1], curr.value[0]);
17156
17157 while (!(curr = iter.next()).done) {
17158 var _curr$value2 = slicedToArray(curr.value, 2),
17159 id = _curr$value2[0],
17160 item = _curr$value2[1];
17161
17162 var _value2 = callback(item, id);
17163
17164 if (_value2 < minValue) {
17165 minValue = _value2;
17166 minItem = item;
17167 }
17168 }
17169
17170 return minItem;
17171 }
17172 /**
17173 * Reduce the items into a single value.
17174 *
17175 * @param callback - The function that does the reduction.
17176 * @param accumulator - The initial value of the accumulator.
17177 *
17178 * @typeparam T - The type of the accumulated value.
17179 *
17180 * @returns The reduced value.
17181 */
17182
17183 }, {
17184 key: "reduce",
17185 value: function reduce(callback, accumulator) {
17186 var _iteratorNormalCompletion10 = true;
17187 var _didIteratorError10 = false;
17188 var _iteratorError10 = undefined;
17189
17190 try {
17191 for (var _iterator10 = getIterator$2$1(this._pairs), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
17192 var _step10$value = slicedToArray(_step10.value, 2),
17193 id = _step10$value[0],
17194 item = _step10$value[1];
17195
17196 accumulator = callback(accumulator, item, id);
17197 }
17198 } catch (err) {
17199 _didIteratorError10 = true;
17200 _iteratorError10 = err;
17201 } finally {
17202 try {
17203 if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
17204 _iterator10.return();
17205 }
17206 } finally {
17207 if (_didIteratorError10) {
17208 throw _iteratorError10;
17209 }
17210 }
17211 }
17212
17213 return accumulator;
17214 }
17215 /**
17216 * Sort the items.
17217 *
17218 * @param callback - Item comparator.
17219 *
17220 * @returns A new stream with sorted items.
17221 */
17222
17223 }, {
17224 key: "sort",
17225 value: function sort(callback) {
17226 var _this = this;
17227
17228 return new DataStream(defineProperty$6$1({}, iterator$2$1, function () {
17229 var _context9;
17230
17231 return getIterator$2$1(sort$2(_context9 = toConsumableArray$1(_this._pairs)).call(_context9, function (_ref3, _ref4) {
17232 var _ref5 = slicedToArray(_ref3, 2),
17233 idA = _ref5[0],
17234 itemA = _ref5[1];
17235
17236 var _ref6 = slicedToArray(_ref4, 2),
17237 idB = _ref6[0],
17238 itemB = _ref6[1];
17239
17240 return callback(itemA, itemB, idA, idB);
17241 }));
17242 }));
17243 }
17244 }]);
17245 return DataStream;
17246}();
17247
17248function ownKeys$2$1(object, enumerableOnly) {
17249 var keys = keys$6(object);
17250
17251 if (getOwnPropertySymbols$2$1) {
17252 var symbols = getOwnPropertySymbols$2$1(object);
17253 if (enumerableOnly) symbols = filter$2$1(symbols).call(symbols, function (sym) {
17254 return getOwnPropertyDescriptor$3$1(object, sym).enumerable;
17255 });
17256 keys.push.apply(keys, symbols);
17257 }
17258
17259 return keys;
17260}
17261
17262function _objectSpread$1(target) {
17263 for (var i = 1; i < arguments.length; i++) {
17264 var source = arguments[i] != null ? arguments[i] : {};
17265
17266 if (i % 2) {
17267 var _context9;
17268
17269 forEach$2$1(_context9 = ownKeys$2$1(source, true)).call(_context9, function (key) {
17270 defineProperty$6$1(target, key, source[key]);
17271 });
17272 } else if (getOwnPropertyDescriptors$2$1) {
17273 defineProperties$1$1(target, getOwnPropertyDescriptors$2$1(source));
17274 } else {
17275 var _context10;
17276
17277 forEach$2$1(_context10 = ownKeys$2$1(source)).call(_context10, function (key) {
17278 defineProperty$1$1(target, key, getOwnPropertyDescriptor$3$1(source, key));
17279 });
17280 }
17281 }
17282
17283 return target;
17284}
17285/**
17286 * # DataSet
17287 *
17288 * Vis.js comes with a flexible DataSet, which can be used to hold and manipulate unstructured data and listen for changes in the data. The DataSet is key/value based. Data items can be added, updated and removed from the DataSet, and one can subscribe to changes in the DataSet. The data in the DataSet can be filtered and ordered, and fields (like dates) can be converted to a specific type. Data can be normalized when appending it to the DataSet as well.
17289 *
17290 * ## Example
17291 *
17292 * The following example shows how to use a DataSet.
17293 *
17294 * ```javascript
17295 * // create a DataSet
17296 * var options = {};
17297 * var data = new vis.DataSet(options);
17298 *
17299 * // add items
17300 * // note that the data items can contain different properties and data formats
17301 * data.add([
17302 * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
17303 * {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
17304 * {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
17305 * {id: 4, text: 'item 4'}
17306 * ]);
17307 *
17308 * // subscribe to any change in the DataSet
17309 * data.on('*', function (event, properties, senderId) {
17310 * console.log('event', event, properties);
17311 * });
17312 *
17313 * // update an existing item
17314 * data.update({id: 2, group: 1});
17315 *
17316 * // remove an item
17317 * data.remove(4);
17318 *
17319 * // get all ids
17320 * var ids = data.getIds();
17321 * console.log('ids', ids);
17322 *
17323 * // get a specific item
17324 * var item1 = data.get(1);
17325 * console.log('item1', item1);
17326 *
17327 * // retrieve a filtered subset of the data
17328 * var items = data.get({
17329 * filter: function (item) {
17330 * return item.group == 1;
17331 * }
17332 * });
17333 * console.log('filtered items', items);
17334 *
17335 * // retrieve formatted items
17336 * var items = data.get({
17337 * fields: ['id', 'date'],
17338 * type: {
17339 * date: 'ISODate'
17340 * }
17341 * });
17342 * console.log('formatted items', items);
17343 * ```
17344 *
17345 * @typeParam Item - Item type that may or may not have an id.
17346 * @typeParam IdProp - Name of the property that contains the id.
17347 */
17348
17349
17350var DataSet =
17351/*#__PURE__*/
17352function (_DataSetPart) {
17353 inherits(DataSet, _DataSetPart);
17354 /**
17355 * Construct a new DataSet.
17356 *
17357 * @param data - Initial data or options.
17358 * @param options - Options (type error if data is also options).
17359 */
17360
17361 function DataSet(data, options) {
17362 var _this;
17363
17364 classCallCheck(this, DataSet);
17365 _this = possibleConstructorReturn(this, getPrototypeOf$3$1(DataSet).call(this)); // correctly read optional arguments
17366
17367 if (data && !isArray$5$1(data)) {
17368 options = data;
17369 data = [];
17370 }
17371
17372 _this._options = options || {};
17373 _this._data = new map$5(); // map with data indexed by id
17374
17375 _this.length = 0; // number of items in the DataSet
17376
17377 _this._idProp = _this._options.fieldId || "id"; // name of the field containing id
17378
17379 _this._type = {}; // internal field types (NOTE: this can differ from this._options.type)
17380 // all variants of a Date are internally stored as Date, so we can convert
17381 // from everything to everything (also from ISODate to Number for example)
17382
17383 if (_this._options.type) {
17384 var fields = keys$6(_this._options.type);
17385
17386 for (var i = 0, len = fields.length; i < len; i++) {
17387 var field = fields[i];
17388 var value = _this._options.type[field];
17389
17390 if (value == "Date" || value == "ISODate" || value == "ASPDate") {
17391 _this._type[field] = "Date";
17392 } else {
17393 _this._type[field] = value;
17394 }
17395 }
17396 } // add initial data when provided
17397
17398
17399 if (data && data.length) {
17400 _this.add(data);
17401 }
17402
17403 _this.setOptions(options);
17404
17405 return _this;
17406 }
17407 /**
17408 * Set new options.
17409 *
17410 * @param options - The new options.
17411 */
17412
17413
17414 createClass(DataSet, [{
17415 key: "setOptions",
17416 value: function setOptions(options) {
17417 if (options && options.queue !== undefined) {
17418 if (options.queue === false) {
17419 // delete queue if loaded
17420 if (this._queue) {
17421 this._queue.destroy();
17422
17423 delete this._queue;
17424 }
17425 } else {
17426 // create queue and update its options
17427 if (!this._queue) {
17428 this._queue = Queue.extend(this, {
17429 replace: ["add", "update", "remove"]
17430 });
17431 }
17432
17433 if (options.queue && _typeof_1$1(options.queue) === "object") {
17434 this._queue.setOptions(options.queue);
17435 }
17436 }
17437 }
17438 }
17439 /**
17440 * Add a data item or an array with items.
17441 *
17442 * 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.
17443 *
17444 * ## Example
17445 *
17446 * ```javascript
17447 * // create a DataSet
17448 * const data = new vis.DataSet()
17449 *
17450 * // add items
17451 * const ids = data.add([
17452 * { id: 1, text: 'item 1' },
17453 * { id: 2, text: 'item 2' },
17454 * { text: 'item without an id' }
17455 * ])
17456 *
17457 * console.log(ids) // [1, 2, '<UUIDv4>']
17458 * ```
17459 *
17460 * @param data - Items to be added (ids will be generated if missing).
17461 * @param senderId - Sender id.
17462 *
17463 * @returns addedIds - Array with the ids (generated if not present) of the added items.
17464 *
17465 * @throws When an item with the same id as any of the added items already exists.
17466 */
17467
17468 }, {
17469 key: "add",
17470 value: function add(data, senderId) {
17471 var _this2 = this;
17472
17473 var addedIds = [];
17474 var id;
17475
17476 if (isArray$5$1(data)) {
17477 // Array
17478 var idsToAdd = map$2$1(data).call(data, function (d) {
17479 return d[_this2._idProp];
17480 });
17481
17482 if (some$2(idsToAdd).call(idsToAdd, function (id) {
17483 return _this2._data.has(id);
17484 })) {
17485 throw new Error("A duplicate id was found in the parameter array.");
17486 }
17487
17488 for (var i = 0, len = data.length; i < len; i++) {
17489 id = this._addItem(data[i]);
17490 addedIds.push(id);
17491 }
17492 } else if (data && _typeof_1$1(data) === "object") {
17493 // Single item
17494 id = this._addItem(data);
17495 addedIds.push(id);
17496 } else {
17497 throw new Error("Unknown dataType");
17498 }
17499
17500 if (addedIds.length) {
17501 this._trigger("add", {
17502 items: addedIds
17503 }, senderId);
17504 }
17505
17506 return addedIds;
17507 }
17508 /**
17509 * Update existing items. When an item does not exist, it will be created.
17510 *
17511 * @remarks
17512 * The provided properties will be merged in the existing item. When an item does not exist, it will be created.
17513 *
17514 * 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.
17515 *
17516 * ## Example
17517 *
17518 * ```javascript
17519 * // create a DataSet
17520 * const data = new vis.DataSet([
17521 * { id: 1, text: 'item 1' },
17522 * { id: 2, text: 'item 2' },
17523 * { id: 3, text: 'item 3' }
17524 * ])
17525 *
17526 * // update items
17527 * const ids = data.update([
17528 * { id: 2, text: 'item 2 (updated)' },
17529 * { id: 4, text: 'item 4 (new)' }
17530 * ])
17531 *
17532 * console.log(ids) // [2, 4]
17533 * ```
17534 *
17535 * ## Warning for TypeScript users
17536 * This method may introduce partial items into the data set. Use add or updateOnly instead for better type safety.
17537 *
17538 * @param data - Items to be updated (if the id is already present) or added (if the id is missing).
17539 * @param senderId - Sender id.
17540 *
17541 * @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.
17542 *
17543 * @throws When the supplied data is neither an item nor an array of items.
17544 */
17545
17546 }, {
17547 key: "update",
17548 value: function update(data, senderId) {
17549 var _this3 = this;
17550
17551 var addedIds = [];
17552 var updatedIds = [];
17553 var oldData = [];
17554 var updatedData = [];
17555 var idProp = this._idProp;
17556
17557 var addOrUpdate = function addOrUpdate(item) {
17558 var origId = item[idProp];
17559
17560 if (origId != null && _this3._data.has(origId)) {
17561 var fullItem = item; // it has an id, therefore it is a fullitem
17562
17563 var oldItem = assign$2$1({}, _this3._data.get(origId)); // update item
17564
17565 var id = _this3._updateItem(fullItem);
17566
17567 updatedIds.push(id);
17568 updatedData.push(fullItem);
17569 oldData.push(oldItem);
17570 } else {
17571 // add new item
17572 var _id = _this3._addItem(item);
17573
17574 addedIds.push(_id);
17575 }
17576 };
17577
17578 if (isArray$5$1(data)) {
17579 // Array
17580 for (var i = 0, len = data.length; i < len; i++) {
17581 if (data[i] && _typeof_1$1(data[i]) === "object") {
17582 addOrUpdate(data[i]);
17583 } else {
17584 console.warn("Ignoring input item, which is not an object at index " + i);
17585 }
17586 }
17587 } else if (data && _typeof_1$1(data) === "object") {
17588 // Single item
17589 addOrUpdate(data);
17590 } else {
17591 throw new Error("Unknown dataType");
17592 }
17593
17594 if (addedIds.length) {
17595 this._trigger("add", {
17596 items: addedIds
17597 }, senderId);
17598 }
17599
17600 if (updatedIds.length) {
17601 var props = {
17602 items: updatedIds,
17603 oldData: oldData,
17604 data: updatedData
17605 }; // TODO: remove deprecated property 'data' some day
17606 //Object.defineProperty(props, 'data', {
17607 // 'get': (function() {
17608 // 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');
17609 // return updatedData;
17610 // }).bind(this)
17611 //});
17612
17613 this._trigger("update", props, senderId);
17614 }
17615
17616 return concat$2$1(addedIds).call(addedIds, updatedIds);
17617 }
17618 /**
17619 * Update existing items. When an item does not exist, an error will be thrown.
17620 *
17621 * @remarks
17622 * The provided properties will be deeply merged into the existing item.
17623 * 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.
17624 *
17625 * After the items are updated, the DataSet will trigger an event `update`.
17626 * When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
17627 *
17628 * ## Example
17629 *
17630 * ```javascript
17631 * // create a DataSet
17632 * const data = new vis.DataSet([
17633 * { id: 1, text: 'item 1' },
17634 * { id: 2, text: 'item 2' },
17635 * { id: 3, text: 'item 3' },
17636 * ])
17637 *
17638 * // update items
17639 * const ids = data.update([
17640 * { id: 2, text: 'item 2 (updated)' }, // works
17641 * // { id: 4, text: 'item 4 (new)' }, // would throw
17642 * // { text: 'item 4 (new)' }, // would also throw
17643 * ])
17644 *
17645 * console.log(ids) // [2]
17646 * ```
17647 *
17648 * @param data - Updates (the id and optionally other props) to the items in this data set.
17649 * @param senderId - Sender id.
17650 *
17651 * @returns updatedIds - The ids of the updated items.
17652 *
17653 * @throws When the supplied data is neither an item nor an array of items, when the ids are missing.
17654 */
17655
17656 }, {
17657 key: "updateOnly",
17658 value: function updateOnly(data, senderId) {
17659 var _context,
17660 _this4 = this;
17661
17662 if (!isArray$5$1(data)) {
17663 data = [data];
17664 }
17665
17666 var updateEventData = map$2$1(_context = map$2$1(data).call(data, function (update) {
17667 var oldData = _this4._data.get(update[_this4._idProp]);
17668
17669 if (oldData == null) {
17670 throw new Error("Updating non-existent items is not allowed.");
17671 }
17672
17673 return {
17674 oldData: oldData,
17675 update: update
17676 };
17677 })).call(_context, function (_ref) {
17678 var oldData = _ref.oldData,
17679 update = _ref.update;
17680 var id = oldData[_this4._idProp];
17681 var updatedData = deepExtend$1(deepExtend$1({}, oldData), update);
17682
17683 _this4._data.set(id, updatedData);
17684
17685 return {
17686 id: id,
17687 oldData: oldData,
17688 updatedData: updatedData
17689 };
17690 });
17691
17692 if (updateEventData.length) {
17693 var props = {
17694 items: map$2$1(updateEventData).call(updateEventData, function (value) {
17695 return value.id;
17696 }),
17697 oldData: map$2$1(updateEventData).call(updateEventData, function (value) {
17698 return value.oldData;
17699 }),
17700 data: map$2$1(updateEventData).call(updateEventData, function (value) {
17701 return value.updatedData;
17702 })
17703 }; // TODO: remove deprecated property 'data' some day
17704 //Object.defineProperty(props, 'data', {
17705 // 'get': (function() {
17706 // 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');
17707 // return updatedData;
17708 // }).bind(this)
17709 //});
17710
17711 this._trigger("update", props, senderId);
17712
17713 return props.items;
17714 } else {
17715 return [];
17716 }
17717 }
17718 /** @inheritdoc */
17719
17720 }, {
17721 key: "get",
17722 value: function get(first, second) {
17723 // @TODO: Woudn't it be better to split this into multiple methods?
17724 // parse the arguments
17725 var id = undefined;
17726 var ids = undefined;
17727 var options = undefined;
17728
17729 if (isId(first)) {
17730 // get(id [, options])
17731 id = first;
17732 options = second;
17733 } else if (isArray$5$1(first)) {
17734 // get(ids [, options])
17735 ids = first;
17736 options = second;
17737 } else {
17738 // get([, options])
17739 options = first;
17740 } // determine the return type
17741
17742
17743 var returnType = options && options.returnType === "Object" ? "Object" : "Array"; // @TODO: WTF is this? Or am I missing something?
17744 // var returnType
17745 // if (options && options.returnType) {
17746 // var allowedValues = ['Array', 'Object']
17747 // returnType =
17748 // allowedValues.indexOf(options.returnType) == -1
17749 // ? 'Array'
17750 // : options.returnType
17751 // } else {
17752 // returnType = 'Array'
17753 // }
17754 // build options
17755
17756 var type = options && options.type || this._options.type;
17757 var filter = options && filter$2$1(options);
17758 var items = [];
17759 var item = null;
17760 var itemIds = null;
17761 var itemId = null; // convert items
17762
17763 if (id != null) {
17764 // return a single item
17765 item = this._getItem(id, type);
17766
17767 if (item && filter && !filter(item)) {
17768 item = null;
17769 }
17770 } else if (ids != null) {
17771 // return a subset of items
17772 for (var i = 0, len = ids.length; i < len; i++) {
17773 item = this._getItem(ids[i], type);
17774
17775 if (item != null && (!filter || filter(item))) {
17776 items.push(item);
17777 }
17778 }
17779 } else {
17780 var _context2; // return all items
17781
17782
17783 itemIds = toConsumableArray$1(keys$3$1(_context2 = this._data).call(_context2));
17784
17785 for (var _i = 0, _len = itemIds.length; _i < _len; _i++) {
17786 itemId = itemIds[_i];
17787 item = this._getItem(itemId, type);
17788
17789 if (item != null && (!filter || filter(item))) {
17790 items.push(item);
17791 }
17792 }
17793 } // order the results
17794
17795
17796 if (options && options.order && id == undefined) {
17797 this._sort(items, options.order);
17798 } // filter fields of the items
17799
17800
17801 if (options && options.fields) {
17802 var fields = options.fields;
17803
17804 if (id != undefined && item != null) {
17805 item = this._filterFields(item, fields);
17806 } else {
17807 for (var _i2 = 0, _len2 = items.length; _i2 < _len2; _i2++) {
17808 items[_i2] = this._filterFields(items[_i2], fields);
17809 }
17810 }
17811 } // return the results
17812
17813
17814 if (returnType == "Object") {
17815 var result = {};
17816
17817 for (var _i3 = 0, _len3 = items.length; _i3 < _len3; _i3++) {
17818 var resultant = items[_i3]; // @TODO: Shoudn't this be this._fieldId?
17819 // result[resultant.id] = resultant
17820
17821 var _id2 = resultant[this._idProp];
17822 result[_id2] = resultant;
17823 }
17824
17825 return result;
17826 } else {
17827 if (id != null) {
17828 // a single item
17829 return item;
17830 } else {
17831 // just return our array
17832 return items;
17833 }
17834 }
17835 }
17836 /** @inheritdoc */
17837
17838 }, {
17839 key: "getIds",
17840 value: function getIds(options) {
17841 var data = this._data;
17842 var filter = options && filter$2$1(options);
17843 var order = options && options.order;
17844 var type = options && options.type || this._options.type;
17845 var itemIds = toConsumableArray$1(keys$3$1(data).call(data));
17846 var ids = [];
17847 var item;
17848 var items;
17849
17850 if (filter) {
17851 // get filtered items
17852 if (order) {
17853 // create ordered list
17854 items = [];
17855
17856 for (var i = 0, len = itemIds.length; i < len; i++) {
17857 var id = itemIds[i];
17858 item = this._getItem(id, type);
17859
17860 if (filter(item)) {
17861 items.push(item);
17862 }
17863 }
17864
17865 this._sort(items, order);
17866
17867 for (var _i4 = 0, _len4 = items.length; _i4 < _len4; _i4++) {
17868 ids.push(items[_i4][this._idProp]);
17869 }
17870 } else {
17871 // create unordered list
17872 for (var _i5 = 0, _len5 = itemIds.length; _i5 < _len5; _i5++) {
17873 var _id3 = itemIds[_i5];
17874 item = this._getItem(_id3, type);
17875
17876 if (filter(item)) {
17877 ids.push(item[this._idProp]);
17878 }
17879 }
17880 }
17881 } else {
17882 // get all items
17883 if (order) {
17884 // create an ordered list
17885 items = [];
17886
17887 for (var _i6 = 0, _len6 = itemIds.length; _i6 < _len6; _i6++) {
17888 var _id4 = itemIds[_i6];
17889 items.push(data.get(_id4));
17890 }
17891
17892 this._sort(items, order);
17893
17894 for (var _i7 = 0, _len7 = items.length; _i7 < _len7; _i7++) {
17895 ids.push(items[_i7][this._idProp]);
17896 }
17897 } else {
17898 // create unordered list
17899 for (var _i8 = 0, _len8 = itemIds.length; _i8 < _len8; _i8++) {
17900 var _id5 = itemIds[_i8];
17901 item = data.get(_id5);
17902 ids.push(item[this._idProp]);
17903 }
17904 }
17905 }
17906
17907 return ids;
17908 }
17909 /** @inheritdoc */
17910
17911 }, {
17912 key: "getDataSet",
17913 value: function getDataSet() {
17914 return this;
17915 }
17916 /** @inheritdoc */
17917
17918 }, {
17919 key: "forEach",
17920 value: function forEach(callback, options) {
17921 var filter = options && filter$2$1(options);
17922 var type = options && options.type || this._options.type;
17923 var data = this._data;
17924 var itemIds = toConsumableArray$1(keys$3$1(data).call(data));
17925
17926 if (options && options.order) {
17927 // execute forEach on ordered list
17928 var items = this.get(options);
17929
17930 for (var i = 0, len = items.length; i < len; i++) {
17931 var item = items[i];
17932 var id = item[this._idProp];
17933 callback(item, id);
17934 }
17935 } else {
17936 // unordered
17937 for (var _i9 = 0, _len9 = itemIds.length; _i9 < _len9; _i9++) {
17938 var _id6 = itemIds[_i9];
17939
17940 var _item = this._getItem(_id6, type);
17941
17942 if (!filter || filter(_item)) {
17943 callback(_item, _id6);
17944 }
17945 }
17946 }
17947 }
17948 /** @inheritdoc */
17949
17950 }, {
17951 key: "map",
17952 value: function map(callback, options) {
17953 var filter = options && filter$2$1(options);
17954 var type = options && options.type || this._options.type;
17955 var mappedItems = [];
17956 var data = this._data;
17957 var itemIds = toConsumableArray$1(keys$3$1(data).call(data)); // convert and filter items
17958
17959 for (var i = 0, len = itemIds.length; i < len; i++) {
17960 var id = itemIds[i];
17961
17962 var item = this._getItem(id, type);
17963
17964 if (!filter || filter(item)) {
17965 mappedItems.push(callback(item, id));
17966 }
17967 } // order items
17968
17969
17970 if (options && options.order) {
17971 this._sort(mappedItems, options.order);
17972 }
17973
17974 return mappedItems;
17975 }
17976 /**
17977 * Filter the fields of an item.
17978 *
17979 * @param item - The item whose fields should be filtered.
17980 * @param fields - The names of the fields that will be kept.
17981 *
17982 * @typeParam K - Field name type.
17983 *
17984 * @returns The item without any additional fields.
17985 */
17986
17987 }, {
17988 key: "_filterFields",
17989 value: function _filterFields(item, fields) {
17990 var _context3;
17991
17992 if (!item) {
17993 // item is null
17994 return item;
17995 }
17996
17997 return reduce$2(_context3 = isArray$5$1(fields) ? // Use the supplied array
17998 fields : // Use the keys of the supplied object
17999 keys$6(fields)).call(_context3, function (filteredItem, field) {
18000 filteredItem[field] = item[field];
18001 return filteredItem;
18002 }, {});
18003 }
18004 /**
18005 * Sort the provided array with items.
18006 *
18007 * @param items - Items to be sorted in place.
18008 * @param order - A field name or custom sort function.
18009 *
18010 * @typeParam T - The type of the items in the items array.
18011 */
18012
18013 }, {
18014 key: "_sort",
18015 value: function _sort(items, order) {
18016 if (typeof order === "string") {
18017 // order by provided field name
18018 var name = order; // field name
18019
18020 sort$2(items).call(items, function (a, b) {
18021 // @TODO: How to treat missing properties?
18022 var av = a[name];
18023 var bv = b[name];
18024 return av > bv ? 1 : av < bv ? -1 : 0;
18025 });
18026 } else if (typeof order === "function") {
18027 // order by sort function
18028 sort$2(items).call(items, order);
18029 } else {
18030 // TODO: extend order by an Object {field:string, direction:string}
18031 // where direction can be 'asc' or 'desc'
18032 throw new TypeError("Order must be a function or a string");
18033 }
18034 }
18035 /**
18036 * Remove an item or multiple items by “reference” (only the id is used) or by id.
18037 *
18038 * 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.
18039 *
18040 * 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.
18041 *
18042 * ## Example
18043 * ```javascript
18044 * // create a DataSet
18045 * const data = new vis.DataSet([
18046 * { id: 1, text: 'item 1' },
18047 * { id: 2, text: 'item 2' },
18048 * { id: 3, text: 'item 3' }
18049 * ])
18050 *
18051 * // remove items
18052 * const ids = data.remove([2, { id: 3 }, 4])
18053 *
18054 * console.log(ids) // [2, 3]
18055 * ```
18056 *
18057 * @param id - One or more items or ids of items to be removed.
18058 * @param senderId - Sender id.
18059 *
18060 * @returns The ids of the removed items.
18061 */
18062
18063 }, {
18064 key: "remove",
18065 value: function remove(id, senderId) {
18066 var removedIds = [];
18067 var removedItems = []; // force everything to be an array for simplicity
18068
18069 var ids = isArray$5$1(id) ? id : [id];
18070
18071 for (var i = 0, len = ids.length; i < len; i++) {
18072 var item = this._remove(ids[i]);
18073
18074 if (item) {
18075 var itemId = item[this._idProp];
18076
18077 if (itemId != null) {
18078 removedIds.push(itemId);
18079 removedItems.push(item);
18080 }
18081 }
18082 }
18083
18084 if (removedIds.length) {
18085 this._trigger("remove", {
18086 items: removedIds,
18087 oldData: removedItems
18088 }, senderId);
18089 }
18090
18091 return removedIds;
18092 }
18093 /**
18094 * Remove an item by its id or reference.
18095 *
18096 * @param id - Id of an item or the item itself.
18097 *
18098 * @returns The removed item if removed, null otherwise.
18099 */
18100
18101 }, {
18102 key: "_remove",
18103 value: function _remove(id) {
18104 // @TODO: It origianlly returned the item although the docs say id.
18105 // The code expects the item, so probably an error in the docs.
18106 var ident; // confirm the id to use based on the args type
18107
18108 if (isId(id)) {
18109 ident = id;
18110 } else if (id && _typeof_1$1(id) === "object") {
18111 ident = id[this._idProp]; // look for the identifier field using ._idProp
18112 } // do the removing if the item is found
18113
18114
18115 if (ident != null && this._data.has(ident)) {
18116 var item = this._data.get(ident) || null;
18117
18118 this._data.delete(ident);
18119
18120 --this.length;
18121 return item;
18122 }
18123
18124 return null;
18125 }
18126 /**
18127 * Clear the entire data set.
18128 *
18129 * 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.
18130 *
18131 * @param senderId - Sender id.
18132 *
18133 * @returns removedIds - The ids of all removed items.
18134 */
18135
18136 }, {
18137 key: "clear",
18138 value: function clear(senderId) {
18139 var _context4;
18140
18141 var ids = toConsumableArray$1(keys$3$1(_context4 = this._data).call(_context4));
18142 var items = [];
18143
18144 for (var i = 0, len = ids.length; i < len; i++) {
18145 items.push(this._data.get(ids[i]));
18146 }
18147
18148 this._data.clear();
18149
18150 this.length = 0;
18151
18152 this._trigger("remove", {
18153 items: ids,
18154 oldData: items
18155 }, senderId);
18156
18157 return ids;
18158 }
18159 /**
18160 * Find the item with maximum value of a specified field.
18161 *
18162 * @param field - Name of the property that should be searched for max value.
18163 *
18164 * @returns Item containing max value, or null if no items.
18165 */
18166
18167 }, {
18168 key: "max",
18169 value: function max(field) {
18170 var max = null;
18171 var maxField = null;
18172 var _iteratorNormalCompletion = true;
18173 var _didIteratorError = false;
18174 var _iteratorError = undefined;
18175
18176 try {
18177 for (var _iterator = getIterator$2$1(values$2$1(_context5 = this._data).call(_context5)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
18178 var _context5;
18179
18180 var item = _step.value;
18181 var itemField = item[field];
18182
18183 if (typeof itemField === "number" && (maxField == null || itemField > maxField)) {
18184 max = item;
18185 maxField = itemField;
18186 }
18187 }
18188 } catch (err) {
18189 _didIteratorError = true;
18190 _iteratorError = err;
18191 } finally {
18192 try {
18193 if (!_iteratorNormalCompletion && _iterator.return != null) {
18194 _iterator.return();
18195 }
18196 } finally {
18197 if (_didIteratorError) {
18198 throw _iteratorError;
18199 }
18200 }
18201 }
18202
18203 return max || null;
18204 }
18205 /**
18206 * Find the item with minimum value of a specified field.
18207 *
18208 * @param field - Name of the property that should be searched for min value.
18209 *
18210 * @returns Item containing min value, or null if no items.
18211 */
18212
18213 }, {
18214 key: "min",
18215 value: function min(field) {
18216 var min = null;
18217 var minField = null;
18218 var _iteratorNormalCompletion2 = true;
18219 var _didIteratorError2 = false;
18220 var _iteratorError2 = undefined;
18221
18222 try {
18223 for (var _iterator2 = getIterator$2$1(values$2$1(_context6 = this._data).call(_context6)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
18224 var _context6;
18225
18226 var item = _step2.value;
18227 var itemField = item[field];
18228
18229 if (typeof itemField === "number" && (minField == null || itemField < minField)) {
18230 min = item;
18231 minField = itemField;
18232 }
18233 }
18234 } catch (err) {
18235 _didIteratorError2 = true;
18236 _iteratorError2 = err;
18237 } finally {
18238 try {
18239 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
18240 _iterator2.return();
18241 }
18242 } finally {
18243 if (_didIteratorError2) {
18244 throw _iteratorError2;
18245 }
18246 }
18247 }
18248
18249 return min || null;
18250 }
18251 /**
18252 * Find all distinct values of a specified field
18253 *
18254 * @param prop - The property name whose distinct values should be returned.
18255 *
18256 * @returns Unordered array containing all distinct values. Items without specified property are ignored.
18257 */
18258
18259 }, {
18260 key: "distinct",
18261 value: function distinct(prop) {
18262 var data = this._data;
18263 var itemIds = toConsumableArray$1(keys$3$1(data).call(data));
18264 var values = [];
18265 var fieldType = this._options.type && this._options.type[prop] || null;
18266 var count = 0;
18267
18268 for (var i = 0, len = itemIds.length; i < len; i++) {
18269 var id = itemIds[i];
18270 var item = data.get(id);
18271 var value = item[prop];
18272 var exists = false;
18273
18274 for (var j = 0; j < count; j++) {
18275 if (values[j] == value) {
18276 exists = true;
18277 break;
18278 }
18279 }
18280
18281 if (!exists && value !== undefined) {
18282 values[count] = value;
18283 count++;
18284 }
18285 }
18286
18287 if (fieldType) {
18288 for (var _i10 = 0, _len10 = values.length; _i10 < _len10; _i10++) {
18289 values[_i10] = convert(values[_i10], fieldType);
18290 }
18291 }
18292
18293 return values;
18294 }
18295 /**
18296 * Add a single item. Will fail when an item with the same id already exists.
18297 *
18298 * @param item - A new item to be added.
18299 *
18300 * @returns Added item's id. An id is generated when it is not present in the item.
18301 */
18302
18303 }, {
18304 key: "_addItem",
18305 value: function _addItem(item) {
18306 var id = item[this._idProp];
18307
18308 if (id != null) {
18309 // check whether this id is already taken
18310 if (this._data.has(id)) {
18311 // item already exists
18312 throw new Error("Cannot add item: item with id " + id + " already exists");
18313 }
18314 } else {
18315 // generate an id
18316 id = uuid4$1();
18317 item[this._idProp] = id;
18318 }
18319
18320 var d = {};
18321 var fields = keys$6(item);
18322
18323 for (var i = 0, len = fields.length; i < len; i++) {
18324 var field = fields[i];
18325 var fieldType = this._type[field]; // type may be undefined
18326
18327 d[field] = convert(item[field], fieldType);
18328 }
18329
18330 this._data.set(id, d);
18331
18332 ++this.length;
18333 return id;
18334 }
18335 /**
18336 * Get an item. Fields can be converted to a specific type
18337 *
18338 * @param id - Id of the requested item.
18339 * @param types - Property name to type name object map of type converstions.
18340 *
18341 * @returns The item, optionally after type conversion.
18342 */
18343
18344 }, {
18345 key: "_getItem",
18346 value: function _getItem(id, types) {
18347 // @TODO: I have no idea how to type this.
18348 // get the item from the dataset
18349 var raw = this._data.get(id);
18350
18351 if (!raw) {
18352 return null;
18353 } // convert the items field types
18354
18355
18356 var converted;
18357 var fields = keys$6(raw);
18358
18359 if (types) {
18360 converted = {};
18361
18362 for (var i = 0, len = fields.length; i < len; i++) {
18363 var field = fields[i];
18364 var value = raw[field];
18365 converted[field] = convert(value, types[field]);
18366 }
18367 } else {
18368 // no field types specified, no converting needed
18369 converted = _objectSpread$1({}, raw);
18370 }
18371
18372 if (converted[this._idProp] == null) {
18373 converted[this._idProp] = raw.id;
18374 }
18375
18376 return converted;
18377 }
18378 /**
18379 * Update a single item: merge with existing item.
18380 * Will fail when the item has no id, or when there does not exist an item with the same id.
18381 *
18382 * @param item - The new item
18383 *
18384 * @returns The id of the updated item.
18385 */
18386
18387 }, {
18388 key: "_updateItem",
18389 value: function _updateItem(item) {
18390 var id = item[this._idProp];
18391
18392 if (id == null) {
18393 throw new Error("Cannot update item: item has no id (item: " + stringify$2(item) + ")");
18394 }
18395
18396 var d = this._data.get(id);
18397
18398 if (!d) {
18399 // item doesn't exist
18400 throw new Error("Cannot update item: no item with id " + id + " found");
18401 } // merge with current item
18402
18403
18404 var fields = keys$6(item);
18405
18406 for (var i = 0, len = fields.length; i < len; i++) {
18407 var field = fields[i];
18408 var fieldType = this._type[field]; // type may be undefined
18409
18410 d[field] = convert(item[field], fieldType);
18411 }
18412
18413 return id;
18414 }
18415 /** @inheritdoc */
18416
18417 }, {
18418 key: "stream",
18419 value: function stream(ids) {
18420 if (ids) {
18421 var data = this._data;
18422 return new DataStream(defineProperty$6$1({}, iterator$2$1,
18423 /*#__PURE__*/
18424 regenerator.mark(function _callee() {
18425 var _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, id, item;
18426
18427 return regenerator.wrap(function _callee$(_context7) {
18428 while (1) {
18429 switch (_context7.prev = _context7.next) {
18430 case 0:
18431 _iteratorNormalCompletion3 = true;
18432 _didIteratorError3 = false;
18433 _iteratorError3 = undefined;
18434 _context7.prev = 3;
18435 _iterator3 = getIterator$2$1(ids);
18436
18437 case 5:
18438 if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) {
18439 _context7.next = 14;
18440 break;
18441 }
18442
18443 id = _step3.value;
18444 item = data.get(id);
18445
18446 if (!(item != null)) {
18447 _context7.next = 11;
18448 break;
18449 }
18450
18451 _context7.next = 11;
18452 return [id, item];
18453
18454 case 11:
18455 _iteratorNormalCompletion3 = true;
18456 _context7.next = 5;
18457 break;
18458
18459 case 14:
18460 _context7.next = 20;
18461 break;
18462
18463 case 16:
18464 _context7.prev = 16;
18465 _context7.t0 = _context7["catch"](3);
18466 _didIteratorError3 = true;
18467 _iteratorError3 = _context7.t0;
18468
18469 case 20:
18470 _context7.prev = 20;
18471 _context7.prev = 21;
18472
18473 if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
18474 _iterator3.return();
18475 }
18476
18477 case 23:
18478 _context7.prev = 23;
18479
18480 if (!_didIteratorError3) {
18481 _context7.next = 26;
18482 break;
18483 }
18484
18485 throw _iteratorError3;
18486
18487 case 26:
18488 return _context7.finish(23);
18489
18490 case 27:
18491 return _context7.finish(20);
18492
18493 case 28:
18494 case "end":
18495 return _context7.stop();
18496 }
18497 }
18498 }, _callee, null, [[3, 16, 20, 28], [21,, 23, 27]]);
18499 })));
18500 } else {
18501 var _context8;
18502
18503 return new DataStream(defineProperty$6$1({}, iterator$2$1, bind$2(_context8 = entries$2(this._data)).call(_context8, this._data)));
18504 }
18505 }
18506 }]);
18507 return DataSet;
18508}(DataSetPart);
18509/**
18510 * DataView
18511 *
18512 * 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.
18513 *
18514 * ## Example
18515 * ```javascript
18516 * // create a DataSet
18517 * var data = new vis.DataSet();
18518 * data.add([
18519 * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
18520 * {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
18521 * {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
18522 * {id: 4, text: 'item 4'}
18523 * ]);
18524 *
18525 * // create a DataView
18526 * // the view will only contain items having a property group with value 1,
18527 * // and will only output fields id, text, and date.
18528 * var view = new vis.DataView(data, {
18529 * filter: function (item) {
18530 * return (item.group == 1);
18531 * },
18532 * fields: ['id', 'text', 'date']
18533 * });
18534 *
18535 * // subscribe to any change in the DataView
18536 * view.on('*', function (event, properties, senderId) {
18537 * console.log('event', event, properties);
18538 * });
18539 *
18540 * // update an item in the data set
18541 * data.update({id: 2, group: 1});
18542 *
18543 * // get all ids in the view
18544 * var ids = view.getIds();
18545 * console.log('ids', ids); // will output [1, 2]
18546 *
18547 * // get all items in the view
18548 * var items = view.get();
18549 * ```
18550 *
18551 * @typeParam Item - Item type that may or may not have an id.
18552 * @typeParam IdProp - Name of the property that contains the id.
18553 */
18554
18555
18556var DataView =
18557/*#__PURE__*/
18558function (_DataSetPart) {
18559 inherits(DataView, _DataSetPart);
18560 /**
18561 * Create a DataView.
18562 *
18563 * @param data - The instance containing data (directly or indirectly).
18564 * @param options - Options to configure this data view.
18565 */
18566
18567 function DataView(data, options) {
18568 var _context;
18569
18570 var _this;
18571
18572 classCallCheck(this, DataView);
18573 _this = possibleConstructorReturn(this, getPrototypeOf$3$1(DataView).call(this));
18574 /** @inheritdoc */
18575
18576 _this.length = 0;
18577 _this._ids = new set$4(); // ids of the items currently in memory (just contains a boolean true)
18578
18579 _this._options = options || {};
18580 _this._listener = bind$2(_context = _this._onEvent).call(_context, assertThisInitialized(_this));
18581
18582 _this.setData(data);
18583
18584 return _this;
18585 } // TODO: implement a function .config() to dynamically update things like configured filter
18586 // and trigger changes accordingly
18587
18588 /**
18589 * Set a data source for the view.
18590 *
18591 * @param data - The instance containing data (directly or indirectly).
18592 */
18593
18594
18595 createClass(DataView, [{
18596 key: "setData",
18597 value: function setData(data) {
18598 if (this._data) {
18599 // unsubscribe from current dataset
18600 if (this._data.off) {
18601 this._data.off("*", this._listener);
18602 } // trigger a remove of all items in memory
18603
18604
18605 var ids = this._data.getIds({
18606 filter: filter$2$1(this._options)
18607 });
18608
18609 var items = this._data.get(ids);
18610
18611 this._ids.clear();
18612
18613 this.length = 0;
18614
18615 this._trigger("remove", {
18616 items: ids,
18617 oldData: items
18618 });
18619 }
18620
18621 if (data != null) {
18622 this._data = data; // trigger an add of all added items
18623
18624 var _ids = this._data.getIds({
18625 filter: filter$2$1(this._options)
18626 });
18627
18628 for (var i = 0, len = _ids.length; i < len; i++) {
18629 var id = _ids[i];
18630
18631 this._ids.add(id);
18632 }
18633
18634 this.length = _ids.length;
18635
18636 this._trigger("add", {
18637 items: _ids
18638 });
18639 } else {
18640 this._data = new DataSet();
18641 } // subscribe to new dataset
18642
18643
18644 if (this._data.on) {
18645 this._data.on("*", this._listener);
18646 }
18647 }
18648 /**
18649 * Refresh the DataView.
18650 * Useful when the DataView has a filter function containing a variable parameter.
18651 */
18652
18653 }, {
18654 key: "refresh",
18655 value: function refresh() {
18656 var ids = this._data.getIds({
18657 filter: filter$2$1(this._options)
18658 });
18659
18660 var oldIds = toConsumableArray$1(this._ids);
18661 var newIds = {};
18662 var addedIds = [];
18663 var removedIds = [];
18664 var removedItems = []; // check for additions
18665
18666 for (var i = 0, len = ids.length; i < len; i++) {
18667 var id = ids[i];
18668 newIds[id] = true;
18669
18670 if (!this._ids.has(id)) {
18671 addedIds.push(id);
18672
18673 this._ids.add(id);
18674 }
18675 } // check for removals
18676
18677
18678 for (var _i = 0, _len = oldIds.length; _i < _len; _i++) {
18679 var _id = oldIds[_i];
18680
18681 var item = this._data.get(_id);
18682
18683 if (item == null) {
18684 // @TODO: Investigate.
18685 // Doesn't happen during tests or examples.
18686 // Is it really impossible or could it eventually happen?
18687 // How to handle it if it does? The types guarantee non-nullable items.
18688 console.error("If you see this, report it please.");
18689 } else if (!newIds[_id]) {
18690 removedIds.push(_id);
18691 removedItems.push(item);
18692
18693 this._ids.delete(_id);
18694 }
18695 }
18696
18697 this.length += addedIds.length - removedIds.length; // trigger events
18698
18699 if (addedIds.length) {
18700 this._trigger("add", {
18701 items: addedIds
18702 });
18703 }
18704
18705 if (removedIds.length) {
18706 this._trigger("remove", {
18707 items: removedIds,
18708 oldData: removedItems
18709 });
18710 }
18711 }
18712 /** @inheritdoc */
18713
18714 }, {
18715 key: "get",
18716 value: function get(first, second) {
18717 if (this._data == null) {
18718 return null;
18719 } // parse the arguments
18720
18721
18722 var ids = null;
18723 var options;
18724
18725 if (isId(first) || isArray$5$1(first)) {
18726 ids = first;
18727 options = second;
18728 } else {
18729 options = first;
18730 } // extend the options with the default options and provided options
18731
18732
18733 var viewOptions = assign$2$1({}, this._options, options); // create a combined filter method when needed
18734
18735 var thisFilter = filter$2$1(this._options);
18736 var optionsFilter = options && filter$2$1(options);
18737
18738 if (thisFilter && optionsFilter) {
18739 viewOptions.filter = function (item) {
18740 return thisFilter(item) && optionsFilter(item);
18741 };
18742 }
18743
18744 if (ids == null) {
18745 return this._data.get(viewOptions);
18746 } else {
18747 return this._data.get(ids, viewOptions);
18748 }
18749 }
18750 /** @inheritdoc */
18751
18752 }, {
18753 key: "getIds",
18754 value: function getIds(options) {
18755 if (this._data.length) {
18756 var defaultFilter = filter$2$1(this._options);
18757 var optionsFilter = options != null ? filter$2$1(options) : null;
18758 var filter;
18759
18760 if (optionsFilter) {
18761 if (defaultFilter) {
18762 filter = function filter(item) {
18763 return defaultFilter(item) && optionsFilter(item);
18764 };
18765 } else {
18766 filter = optionsFilter;
18767 }
18768 } else {
18769 filter = defaultFilter;
18770 }
18771
18772 return this._data.getIds({
18773 filter: filter,
18774 order: options && options.order
18775 });
18776 } else {
18777 return [];
18778 }
18779 }
18780 /** @inheritdoc */
18781
18782 }, {
18783 key: "forEach",
18784 value: function forEach(callback, options) {
18785 if (this._data) {
18786 var _context2;
18787
18788 var defaultFilter = filter$2$1(this._options);
18789 var optionsFilter = options && filter$2$1(options);
18790 var filter;
18791
18792 if (optionsFilter) {
18793 if (defaultFilter) {
18794 filter = function filter(item) {
18795 return defaultFilter(item) && optionsFilter(item);
18796 };
18797 } else {
18798 filter = optionsFilter;
18799 }
18800 } else {
18801 filter = defaultFilter;
18802 }
18803
18804 forEach$2$1(_context2 = this._data).call(_context2, callback, {
18805 filter: filter,
18806 order: options && options.order
18807 });
18808 }
18809 }
18810 /** @inheritdoc */
18811
18812 }, {
18813 key: "map",
18814 value: function map(callback, options) {
18815 if (this._data) {
18816 var _context3;
18817
18818 var defaultFilter = filter$2$1(this._options);
18819 var optionsFilter = options && filter$2$1(options);
18820 var filter;
18821
18822 if (optionsFilter) {
18823 if (defaultFilter) {
18824 filter = function filter(item) {
18825 return defaultFilter(item) && optionsFilter(item);
18826 };
18827 } else {
18828 filter = optionsFilter;
18829 }
18830 } else {
18831 filter = defaultFilter;
18832 }
18833
18834 return map$2$1(_context3 = this._data).call(_context3, callback, {
18835 filter: filter,
18836 order: options && options.order
18837 });
18838 } else {
18839 return [];
18840 }
18841 }
18842 /** @inheritdoc */
18843
18844 }, {
18845 key: "getDataSet",
18846 value: function getDataSet() {
18847 return this._data.getDataSet();
18848 }
18849 /** @inheritdoc */
18850
18851 }, {
18852 key: "stream",
18853 value: function stream(ids) {
18854 var _context4;
18855
18856 return this._data.stream(ids || defineProperty$6$1({}, iterator$2$1, bind$2(_context4 = keys$3$1(this._ids)).call(_context4, this._ids)));
18857 }
18858 /**
18859 * 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.
18860 *
18861 * @param event - The name of the event.
18862 * @param params - Parameters of the event.
18863 * @param senderId - Id supplied by the sender.
18864 */
18865
18866 }, {
18867 key: "_onEvent",
18868 value: function _onEvent(event, params, senderId) {
18869 if (!params || !params.items || !this._data) {
18870 return;
18871 }
18872
18873 var ids = params.items;
18874 var addedIds = [];
18875 var updatedIds = [];
18876 var removedIds = [];
18877 var oldItems = [];
18878 var updatedItems = [];
18879 var removedItems = [];
18880
18881 switch (event) {
18882 case "add":
18883 // filter the ids of the added items
18884 for (var i = 0, len = ids.length; i < len; i++) {
18885 var id = ids[i];
18886 var item = this.get(id);
18887
18888 if (item) {
18889 this._ids.add(id);
18890
18891 addedIds.push(id);
18892 }
18893 }
18894
18895 break;
18896
18897 case "update":
18898 // determine the event from the views viewpoint: an updated
18899 // item can be added, updated, or removed from this view.
18900 for (var _i2 = 0, _len2 = ids.length; _i2 < _len2; _i2++) {
18901 var _id2 = ids[_i2];
18902
18903 var _item = this.get(_id2);
18904
18905 if (_item) {
18906 if (this._ids.has(_id2)) {
18907 updatedIds.push(_id2);
18908 updatedItems.push(params.data[_i2]);
18909 oldItems.push(params.oldData[_i2]);
18910 } else {
18911 this._ids.add(_id2);
18912
18913 addedIds.push(_id2);
18914 }
18915 } else {
18916 if (this._ids.has(_id2)) {
18917 this._ids.delete(_id2);
18918
18919 removedIds.push(_id2);
18920 removedItems.push(params.oldData[_i2]);
18921 }
18922 }
18923 }
18924
18925 break;
18926
18927 case "remove":
18928 // filter the ids of the removed items
18929 for (var _i3 = 0, _len3 = ids.length; _i3 < _len3; _i3++) {
18930 var _id3 = ids[_i3];
18931
18932 if (this._ids.has(_id3)) {
18933 this._ids.delete(_id3);
18934
18935 removedIds.push(_id3);
18936 removedItems.push(params.oldData[_i3]);
18937 }
18938 }
18939
18940 break;
18941 }
18942
18943 this.length += addedIds.length - removedIds.length;
18944
18945 if (addedIds.length) {
18946 this._trigger("add", {
18947 items: addedIds
18948 }, senderId);
18949 }
18950
18951 if (updatedIds.length) {
18952 this._trigger("update", {
18953 items: updatedIds,
18954 oldData: oldItems,
18955 data: updatedItems
18956 }, senderId);
18957 }
18958
18959 if (removedIds.length) {
18960 this._trigger("remove", {
18961 items: removedIds,
18962 oldData: removedItems
18963 }, senderId);
18964 }
18965 }
18966 }]);
18967 return DataView;
18968}(DataSetPart);
18969
18970var index = {
18971 DataSet: DataSet,
18972 DataView: DataView,
18973 Queue: Queue
18974};
18975
18976function _typeof(obj) {
18977 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
18978 _typeof = function (obj) {
18979 return typeof obj;
18980 };
18981 } else {
18982 _typeof = function (obj) {
18983 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18984 };
18985 }
18986
18987 return _typeof(obj);
18988}
18989
18990function _classCallCheck$1(instance, Constructor) {
18991 if (!(instance instanceof Constructor)) {
18992 throw new TypeError("Cannot call a class as a function");
18993 }
18994}
18995
18996function _defineProperties$1(target, props) {
18997 for (var i = 0; i < props.length; i++) {
18998 var descriptor = props[i];
18999 descriptor.enumerable = descriptor.enumerable || false;
19000 descriptor.configurable = true;
19001 if ("value" in descriptor) descriptor.writable = true;
19002 Object.defineProperty(target, descriptor.key, descriptor);
19003 }
19004}
19005
19006function _createClass$1(Constructor, protoProps, staticProps) {
19007 if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
19008 if (staticProps) _defineProperties$1(Constructor, staticProps);
19009 return Constructor;
19010}
19011
19012/**
19013 * Expose `Emitter`.
19014 */
19015var emitterComponent = Emitter;
19016/**
19017 * Initialize a new `Emitter`.
19018 *
19019 * @api public
19020 */
19021
19022function Emitter(obj) {
19023 if (obj) return mixin(obj);
19024}
19025/**
19026 * Mixin the emitter properties.
19027 *
19028 * @param {Object} obj
19029 * @return {Object}
19030 * @api private
19031 */
19032
19033function mixin(obj) {
19034 for (var key in Emitter.prototype) {
19035 obj[key] = Emitter.prototype[key];
19036 }
19037
19038 return obj;
19039}
19040/**
19041 * Listen on the given `event` with `fn`.
19042 *
19043 * @param {String} event
19044 * @param {Function} fn
19045 * @return {Emitter}
19046 * @api public
19047 */
19048
19049
19050Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
19051 this._callbacks = this._callbacks || {};
19052 (this._callbacks[event] = this._callbacks[event] || []).push(fn);
19053 return this;
19054};
19055/**
19056 * Adds an `event` listener that will be invoked a single
19057 * time then automatically removed.
19058 *
19059 * @param {String} event
19060 * @param {Function} fn
19061 * @return {Emitter}
19062 * @api public
19063 */
19064
19065
19066Emitter.prototype.once = function (event, fn) {
19067 var self = this;
19068 this._callbacks = this._callbacks || {};
19069
19070 function on() {
19071 self.off(event, on);
19072 fn.apply(this, arguments);
19073 }
19074
19075 on.fn = fn;
19076 this.on(event, on);
19077 return this;
19078};
19079/**
19080 * Remove the given callback for `event` or all
19081 * registered callbacks.
19082 *
19083 * @param {String} event
19084 * @param {Function} fn
19085 * @return {Emitter}
19086 * @api public
19087 */
19088
19089
19090Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
19091 this._callbacks = this._callbacks || {}; // all
19092
19093 if (0 == arguments.length) {
19094 this._callbacks = {};
19095 return this;
19096 } // specific event
19097
19098
19099 var callbacks = this._callbacks[event];
19100 if (!callbacks) return this; // remove all handlers
19101
19102 if (1 == arguments.length) {
19103 delete this._callbacks[event];
19104 return this;
19105 } // remove specific handler
19106
19107
19108 var cb;
19109
19110 for (var i = 0; i < callbacks.length; i++) {
19111 cb = callbacks[i];
19112
19113 if (cb === fn || cb.fn === fn) {
19114 callbacks.splice(i, 1);
19115 break;
19116 }
19117 }
19118
19119 return this;
19120};
19121/**
19122 * Emit `event` with the given args.
19123 *
19124 * @param {String} event
19125 * @param {Mixed} ...
19126 * @return {Emitter}
19127 */
19128
19129
19130Emitter.prototype.emit = function (event) {
19131 this._callbacks = this._callbacks || {};
19132 var args = [].slice.call(arguments, 1),
19133 callbacks = this._callbacks[event];
19134
19135 if (callbacks) {
19136 callbacks = callbacks.slice(0);
19137
19138 for (var i = 0, len = callbacks.length; i < len; ++i) {
19139 callbacks[i].apply(this, args);
19140 }
19141 }
19142
19143 return this;
19144};
19145/**
19146 * Return array of callbacks for `event`.
19147 *
19148 * @param {String} event
19149 * @return {Array}
19150 * @api public
19151 */
19152
19153
19154Emitter.prototype.listeners = function (event) {
19155 this._callbacks = this._callbacks || {};
19156 return this._callbacks[event] || [];
19157};
19158/**
19159 * Check if this emitter has `event` handlers.
19160 *
19161 * @param {String} event
19162 * @return {Boolean}
19163 * @api public
19164 */
19165
19166
19167Emitter.prototype.hasListeners = function (event) {
19168 return !!this.listeners(event).length;
19169};
19170
19171/**
19172 * @prototype Point3d
19173 * @param {number} [x]
19174 * @param {number} [y]
19175 * @param {number} [z]
19176 */
19177function Point3d(x, y, z) {
19178 this.x = x !== undefined ? x : 0;
19179 this.y = y !== undefined ? y : 0;
19180 this.z = z !== undefined ? z : 0;
19181}
19182/**
19183 * Subtract the two provided points, returns a-b
19184 * @param {Point3d} a
19185 * @param {Point3d} b
19186 * @return {Point3d} a-b
19187 */
19188
19189
19190Point3d.subtract = function (a, b) {
19191 var sub = new Point3d();
19192 sub.x = a.x - b.x;
19193 sub.y = a.y - b.y;
19194 sub.z = a.z - b.z;
19195 return sub;
19196};
19197/**
19198 * Add the two provided points, returns a+b
19199 * @param {Point3d} a
19200 * @param {Point3d} b
19201 * @return {Point3d} a+b
19202 */
19203
19204
19205Point3d.add = function (a, b) {
19206 var sum = new Point3d();
19207 sum.x = a.x + b.x;
19208 sum.y = a.y + b.y;
19209 sum.z = a.z + b.z;
19210 return sum;
19211};
19212/**
19213 * Calculate the average of two 3d points
19214 * @param {Point3d} a
19215 * @param {Point3d} b
19216 * @return {Point3d} The average, (a+b)/2
19217 */
19218
19219
19220Point3d.avg = function (a, b) {
19221 return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2);
19222};
19223/**
19224 * Calculate the cross product of the two provided points, returns axb
19225 * Documentation: http://en.wikipedia.org/wiki/Cross_product
19226 * @param {Point3d} a
19227 * @param {Point3d} b
19228 * @return {Point3d} cross product axb
19229 */
19230
19231
19232Point3d.crossProduct = function (a, b) {
19233 var crossproduct = new Point3d();
19234 crossproduct.x = a.y * b.z - a.z * b.y;
19235 crossproduct.y = a.z * b.x - a.x * b.z;
19236 crossproduct.z = a.x * b.y - a.y * b.x;
19237 return crossproduct;
19238};
19239/**
19240 * Rtrieve the length of the vector (or the distance from this point to the origin
19241 * @return {number} length
19242 */
19243
19244
19245Point3d.prototype.length = function () {
19246 return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
19247};
19248
19249var Point3d_1 = Point3d;
19250
19251/**
19252 * @prototype Point2d
19253 * @param {number} [x]
19254 * @param {number} [y]
19255 */
19256function Point2d(x, y) {
19257 this.x = x !== undefined ? x : 0;
19258 this.y = y !== undefined ? y : 0;
19259}
19260
19261var Point2d_1 = Point2d;
19262
19263/**
19264 * An html slider control with start/stop/prev/next buttons
19265 *
19266 * @constructor Slider
19267 * @param {Element} container The element where the slider will be created
19268 * @param {Object} options Available options:
19269 * {boolean} visible If true (default) the
19270 * slider is visible.
19271 */
19272
19273function Slider(container, options) {
19274 if (container === undefined) {
19275 throw new Error('No container element defined');
19276 }
19277
19278 this.container = container;
19279 this.visible = options && options.visible != undefined ? options.visible : true;
19280
19281 if (this.visible) {
19282 this.frame = document.createElement('DIV'); //this.frame.style.backgroundColor = '#E5E5E5';
19283
19284 this.frame.style.width = '100%';
19285 this.frame.style.position = 'relative';
19286 this.container.appendChild(this.frame);
19287 this.frame.prev = document.createElement('INPUT');
19288 this.frame.prev.type = 'BUTTON';
19289 this.frame.prev.value = 'Prev';
19290 this.frame.appendChild(this.frame.prev);
19291 this.frame.play = document.createElement('INPUT');
19292 this.frame.play.type = 'BUTTON';
19293 this.frame.play.value = 'Play';
19294 this.frame.appendChild(this.frame.play);
19295 this.frame.next = document.createElement('INPUT');
19296 this.frame.next.type = 'BUTTON';
19297 this.frame.next.value = 'Next';
19298 this.frame.appendChild(this.frame.next);
19299 this.frame.bar = document.createElement('INPUT');
19300 this.frame.bar.type = 'BUTTON';
19301 this.frame.bar.style.position = 'absolute';
19302 this.frame.bar.style.border = '1px solid red';
19303 this.frame.bar.style.width = '100px';
19304 this.frame.bar.style.height = '6px';
19305 this.frame.bar.style.borderRadius = '2px';
19306 this.frame.bar.style.MozBorderRadius = '2px';
19307 this.frame.bar.style.border = '1px solid #7F7F7F';
19308 this.frame.bar.style.backgroundColor = '#E5E5E5';
19309 this.frame.appendChild(this.frame.bar);
19310 this.frame.slide = document.createElement('INPUT');
19311 this.frame.slide.type = 'BUTTON';
19312 this.frame.slide.style.margin = '0px';
19313 this.frame.slide.value = ' ';
19314 this.frame.slide.style.position = 'relative';
19315 this.frame.slide.style.left = '-100px';
19316 this.frame.appendChild(this.frame.slide); // create events
19317
19318 var me = this;
19319
19320 this.frame.slide.onmousedown = function (event) {
19321 me._onMouseDown(event);
19322 };
19323
19324 this.frame.prev.onclick = function (event) {
19325 me.prev(event);
19326 };
19327
19328 this.frame.play.onclick = function (event) {
19329 me.togglePlay(event);
19330 };
19331
19332 this.frame.next.onclick = function (event) {
19333 me.next(event);
19334 };
19335 }
19336
19337 this.onChangeCallback = undefined;
19338 this.values = [];
19339 this.index = undefined;
19340 this.playTimeout = undefined;
19341 this.playInterval = 1000; // milliseconds
19342
19343 this.playLoop = true;
19344}
19345/**
19346 * Select the previous index
19347 */
19348
19349
19350Slider.prototype.prev = function () {
19351 var index = this.getIndex();
19352
19353 if (index > 0) {
19354 index--;
19355 this.setIndex(index);
19356 }
19357};
19358/**
19359 * Select the next index
19360 */
19361
19362
19363Slider.prototype.next = function () {
19364 var index = this.getIndex();
19365
19366 if (index < this.values.length - 1) {
19367 index++;
19368 this.setIndex(index);
19369 }
19370};
19371/**
19372 * Select the next index
19373 */
19374
19375
19376Slider.prototype.playNext = function () {
19377 var start = new Date();
19378 var index = this.getIndex();
19379
19380 if (index < this.values.length - 1) {
19381 index++;
19382 this.setIndex(index);
19383 } else if (this.playLoop) {
19384 // jump to the start
19385 index = 0;
19386 this.setIndex(index);
19387 }
19388
19389 var end = new Date();
19390 var diff = end - start; // calculate how much time it to to set the index and to execute the callback
19391 // function.
19392
19393 var interval = Math.max(this.playInterval - diff, 0); // document.title = diff // TODO: cleanup
19394
19395 var me = this;
19396 this.playTimeout = setTimeout(function () {
19397 me.playNext();
19398 }, interval);
19399};
19400/**
19401 * Toggle start or stop playing
19402 */
19403
19404
19405Slider.prototype.togglePlay = function () {
19406 if (this.playTimeout === undefined) {
19407 this.play();
19408 } else {
19409 this.stop();
19410 }
19411};
19412/**
19413 * Start playing
19414 */
19415
19416
19417Slider.prototype.play = function () {
19418 // Test whether already playing
19419 if (this.playTimeout) return;
19420 this.playNext();
19421
19422 if (this.frame) {
19423 this.frame.play.value = 'Stop';
19424 }
19425};
19426/**
19427 * Stop playing
19428 */
19429
19430
19431Slider.prototype.stop = function () {
19432 clearInterval(this.playTimeout);
19433 this.playTimeout = undefined;
19434
19435 if (this.frame) {
19436 this.frame.play.value = 'Play';
19437 }
19438};
19439/**
19440 * Set a callback function which will be triggered when the value of the
19441 * slider bar has changed.
19442 *
19443 * @param {function} callback
19444 */
19445
19446
19447Slider.prototype.setOnChangeCallback = function (callback) {
19448 this.onChangeCallback = callback;
19449};
19450/**
19451 * Set the interval for playing the list
19452 * @param {number} interval The interval in milliseconds
19453 */
19454
19455
19456Slider.prototype.setPlayInterval = function (interval) {
19457 this.playInterval = interval;
19458};
19459/**
19460 * Retrieve the current play interval
19461 * @return {number} interval The interval in milliseconds
19462 */
19463
19464
19465Slider.prototype.getPlayInterval = function () {
19466 return this.playInterval;
19467};
19468/**
19469 * Set looping on or off
19470 * @param {boolean} doLoop If true, the slider will jump to the start when
19471 * the end is passed, and will jump to the end
19472 * when the start is passed.
19473 *
19474 */
19475
19476
19477Slider.prototype.setPlayLoop = function (doLoop) {
19478 this.playLoop = doLoop;
19479};
19480/**
19481 * Execute the onchange callback function
19482 */
19483
19484
19485Slider.prototype.onChange = function () {
19486 if (this.onChangeCallback !== undefined) {
19487 this.onChangeCallback();
19488 }
19489};
19490/**
19491 * redraw the slider on the correct place
19492 */
19493
19494
19495Slider.prototype.redraw = function () {
19496 if (this.frame) {
19497 // resize the bar
19498 this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px';
19499 this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px'; // position the slider button
19500
19501 var left = this.indexToLeft(this.index);
19502 this.frame.slide.style.left = left + 'px';
19503 }
19504};
19505/**
19506 * Set the list with values for the slider
19507 * @param {Array} values A javascript array with values (any type)
19508 */
19509
19510
19511Slider.prototype.setValues = function (values) {
19512 this.values = values;
19513 if (this.values.length > 0) this.setIndex(0);else this.index = undefined;
19514};
19515/**
19516 * Select a value by its index
19517 * @param {number} index
19518 */
19519
19520
19521Slider.prototype.setIndex = function (index) {
19522 if (index < this.values.length) {
19523 this.index = index;
19524 this.redraw();
19525 this.onChange();
19526 } else {
19527 throw new Error('Index out of range');
19528 }
19529};
19530/**
19531 * retrieve the index of the currently selected vaue
19532 * @return {number} index
19533 */
19534
19535
19536Slider.prototype.getIndex = function () {
19537 return this.index;
19538};
19539/**
19540 * retrieve the currently selected value
19541 * @return {*} value
19542 */
19543
19544
19545Slider.prototype.get = function () {
19546 return this.values[this.index];
19547};
19548
19549Slider.prototype._onMouseDown = function (event) {
19550 // only react on left mouse button down
19551 var leftButtonDown = event.which ? event.which === 1 : event.button === 1;
19552 if (!leftButtonDown) return;
19553 this.startClientX = event.clientX;
19554 this.startSlideX = parseFloat(this.frame.slide.style.left);
19555 this.frame.style.cursor = 'move'; // add event listeners to handle moving the contents
19556 // we store the function onmousemove and onmouseup in the graph, so we can
19557 // remove the eventlisteners lateron in the function mouseUp()
19558
19559 var me = this;
19560
19561 this.onmousemove = function (event) {
19562 me._onMouseMove(event);
19563 };
19564
19565 this.onmouseup = function (event) {
19566 me._onMouseUp(event);
19567 };
19568
19569 util.addEventListener(document, 'mousemove', this.onmousemove);
19570 util.addEventListener(document, 'mouseup', this.onmouseup);
19571 util.preventDefault(event);
19572};
19573
19574Slider.prototype.leftToIndex = function (left) {
19575 var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
19576 var x = left - 3;
19577 var index = Math.round(x / width * (this.values.length - 1));
19578 if (index < 0) index = 0;
19579 if (index > this.values.length - 1) index = this.values.length - 1;
19580 return index;
19581};
19582
19583Slider.prototype.indexToLeft = function (index) {
19584 var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
19585 var x = index / (this.values.length - 1) * width;
19586 var left = x + 3;
19587 return left;
19588};
19589
19590Slider.prototype._onMouseMove = function (event) {
19591 var diff = event.clientX - this.startClientX;
19592 var x = this.startSlideX + diff;
19593 var index = this.leftToIndex(x);
19594 this.setIndex(index);
19595 util.preventDefault();
19596};
19597
19598Slider.prototype._onMouseUp = function (event) {
19599 // eslint-disable-line no-unused-vars
19600 this.frame.style.cursor = 'auto'; // remove event listeners
19601
19602 util.removeEventListener(document, 'mousemove', this.onmousemove);
19603 util.removeEventListener(document, 'mouseup', this.onmouseup);
19604 util.preventDefault();
19605};
19606
19607var Slider_1 = Slider;
19608
19609/**
19610 * @prototype StepNumber
19611 * The class StepNumber is an iterator for Numbers. You provide a start and end
19612 * value, and a best step size. StepNumber itself rounds to fixed values and
19613 * a finds the step that best fits the provided step.
19614 *
19615 * If prettyStep is true, the step size is chosen as close as possible to the
19616 * provided step, but being a round value like 1, 2, 5, 10, 20, 50, ....
19617 *
19618 * Example usage:
19619 * var step = new StepNumber(0, 10, 2.5, true);
19620 * step.start();
19621 * while (!step.end()) {
19622 * alert(step.getCurrent());
19623 * step.next();
19624 * }
19625 *
19626 * Version: 1.0
19627 *
19628 * @param {number} start The start value
19629 * @param {number} end The end value
19630 * @param {number} step Optional. Step size. Must be a positive value.
19631 * @param {boolean} prettyStep Optional. If true, the step size is rounded
19632 * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
19633 */
19634function StepNumber(start, end, step, prettyStep) {
19635 // set default values
19636 this._start = 0;
19637 this._end = 0;
19638 this._step = 1;
19639 this.prettyStep = true;
19640 this.precision = 5;
19641 this._current = 0;
19642 this.setRange(start, end, step, prettyStep);
19643}
19644/**
19645 * Check for input values, to prevent disasters from happening
19646 *
19647 * Source: http://stackoverflow.com/a/1830844
19648 *
19649 * @param {string} n
19650 * @returns {boolean}
19651 */
19652
19653
19654StepNumber.prototype.isNumeric = function (n) {
19655 return !isNaN(parseFloat(n)) && isFinite(n);
19656};
19657/**
19658 * Set a new range: start, end and step.
19659 *
19660 * @param {number} start The start value
19661 * @param {number} end The end value
19662 * @param {number} step Optional. Step size. Must be a positive value.
19663 * @param {boolean} prettyStep Optional. If true, the step size is rounded
19664 * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
19665 */
19666
19667
19668StepNumber.prototype.setRange = function (start, end, step, prettyStep) {
19669 if (!this.isNumeric(start)) {
19670 throw new Error('Parameter \'start\' is not numeric; value: ' + start);
19671 }
19672
19673 if (!this.isNumeric(end)) {
19674 throw new Error('Parameter \'end\' is not numeric; value: ' + start);
19675 }
19676
19677 if (!this.isNumeric(step)) {
19678 throw new Error('Parameter \'step\' is not numeric; value: ' + start);
19679 }
19680
19681 this._start = start ? start : 0;
19682 this._end = end ? end : 0;
19683 this.setStep(step, prettyStep);
19684};
19685/**
19686 * Set a new step size
19687 * @param {number} step New step size. Must be a positive value
19688 * @param {boolean} prettyStep Optional. If true, the provided step is rounded
19689 * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
19690 */
19691
19692
19693StepNumber.prototype.setStep = function (step, prettyStep) {
19694 if (step === undefined || step <= 0) return;
19695 if (prettyStep !== undefined) this.prettyStep = prettyStep;
19696 if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step;
19697};
19698/**
19699 * Calculate a nice step size, closest to the desired step size.
19700 * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an
19701 * integer Number. For example 1, 2, 5, 10, 20, 50, etc...
19702 * @param {number} step Desired step size
19703 * @return {number} Nice step size
19704 */
19705
19706
19707StepNumber.calculatePrettyStep = function (step) {
19708 var log10 = function log10(x) {
19709 return Math.log(x) / Math.LN10;
19710 }; // try three steps (multiple of 1, 2, or 5
19711
19712
19713 var step1 = Math.pow(10, Math.round(log10(step))),
19714 step2 = 2 * Math.pow(10, Math.round(log10(step / 2))),
19715 step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); // choose the best step (closest to minimum step)
19716
19717 var prettyStep = step1;
19718 if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2;
19719 if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; // for safety
19720
19721 if (prettyStep <= 0) {
19722 prettyStep = 1;
19723 }
19724
19725 return prettyStep;
19726};
19727/**
19728 * returns the current value of the step
19729 * @return {number} current value
19730 */
19731
19732
19733StepNumber.prototype.getCurrent = function () {
19734 return parseFloat(this._current.toPrecision(this.precision));
19735};
19736/**
19737 * returns the current step size
19738 * @return {number} current step size
19739 */
19740
19741
19742StepNumber.prototype.getStep = function () {
19743 return this._step;
19744};
19745/**
19746 * Set the current to its starting value.
19747 *
19748 * By default, this will be the largest value smaller than start, which
19749 * is a multiple of the step size.
19750 *
19751 * Parameters checkFirst is optional, default false.
19752 * If set to true, move the current value one step if smaller than start.
19753 *
19754 * @param {boolean} [checkFirst=false]
19755 */
19756
19757
19758StepNumber.prototype.start = function (checkFirst) {
19759 if (checkFirst === undefined) {
19760 checkFirst = false;
19761 }
19762
19763 this._current = this._start - this._start % this._step;
19764
19765 if (checkFirst) {
19766 if (this.getCurrent() < this._start) {
19767 this.next();
19768 }
19769 }
19770};
19771/**
19772 * Do a step, add the step size to the current value
19773 */
19774
19775
19776StepNumber.prototype.next = function () {
19777 this._current += this._step;
19778};
19779/**
19780 * Returns true whether the end is reached
19781 * @return {boolean} True if the current value has passed the end value.
19782 */
19783
19784
19785StepNumber.prototype.end = function () {
19786 return this._current > this._end;
19787};
19788
19789var StepNumber_1 = StepNumber;
19790
19791/**
19792 * The camera is mounted on a (virtual) camera arm. The camera arm can rotate
19793 * The camera is always looking in the direction of the origin of the arm.
19794 * This way, the camera always rotates around one fixed point, the location
19795 * of the camera arm.
19796 *
19797 * Documentation:
19798 * http://en.wikipedia.org/wiki/3D_projection
19799 * @class Camera
19800 */
19801
19802function Camera() {
19803 this.armLocation = new Point3d_1();
19804 this.armRotation = {};
19805 this.armRotation.horizontal = 0;
19806 this.armRotation.vertical = 0;
19807 this.armLength = 1.7;
19808 this.cameraOffset = new Point3d_1();
19809 this.offsetMultiplier = 0.6;
19810 this.cameraLocation = new Point3d_1();
19811 this.cameraRotation = new Point3d_1(0.5 * Math.PI, 0, 0);
19812 this.calculateCameraOrientation();
19813}
19814/**
19815 * Set offset camera in camera coordinates
19816 * @param {number} x offset by camera horisontal
19817 * @param {number} y offset by camera vertical
19818 */
19819
19820
19821Camera.prototype.setOffset = function (x, y) {
19822 var abs = Math.abs,
19823 sign = Math.sign,
19824 mul = this.offsetMultiplier,
19825 border = this.armLength * mul;
19826
19827 if (abs(x) > border) {
19828 x = sign(x) * border;
19829 }
19830
19831 if (abs(y) > border) {
19832 y = sign(y) * border;
19833 }
19834
19835 this.cameraOffset.x = x;
19836 this.cameraOffset.y = y;
19837 this.calculateCameraOrientation();
19838};
19839/**
19840 * Get camera offset by horizontal and vertical
19841 * @returns {number}
19842 */
19843
19844
19845Camera.prototype.getOffset = function () {
19846 return this.cameraOffset;
19847};
19848/**
19849 * Set the location (origin) of the arm
19850 * @param {number} x Normalized value of x
19851 * @param {number} y Normalized value of y
19852 * @param {number} z Normalized value of z
19853 */
19854
19855
19856Camera.prototype.setArmLocation = function (x, y, z) {
19857 this.armLocation.x = x;
19858 this.armLocation.y = y;
19859 this.armLocation.z = z;
19860 this.calculateCameraOrientation();
19861};
19862/**
19863 * Set the rotation of the camera arm
19864 * @param {number} horizontal The horizontal rotation, between 0 and 2*PI.
19865 * Optional, can be left undefined.
19866 * @param {number} vertical The vertical rotation, between 0 and 0.5*PI
19867 * if vertical=0.5*PI, the graph is shown from the
19868 * top. Optional, can be left undefined.
19869 */
19870
19871
19872Camera.prototype.setArmRotation = function (horizontal, vertical) {
19873 if (horizontal !== undefined) {
19874 this.armRotation.horizontal = horizontal;
19875 }
19876
19877 if (vertical !== undefined) {
19878 this.armRotation.vertical = vertical;
19879 if (this.armRotation.vertical < 0) this.armRotation.vertical = 0;
19880 if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI;
19881 }
19882
19883 if (horizontal !== undefined || vertical !== undefined) {
19884 this.calculateCameraOrientation();
19885 }
19886};
19887/**
19888 * Retrieve the current arm rotation
19889 * @return {object} An object with parameters horizontal and vertical
19890 */
19891
19892
19893Camera.prototype.getArmRotation = function () {
19894 var rot = {};
19895 rot.horizontal = this.armRotation.horizontal;
19896 rot.vertical = this.armRotation.vertical;
19897 return rot;
19898};
19899/**
19900 * Set the (normalized) length of the camera arm.
19901 * @param {number} length A length between 0.71 and 5.0
19902 */
19903
19904
19905Camera.prototype.setArmLength = function (length) {
19906 if (length === undefined) return;
19907 this.armLength = length; // Radius must be larger than the corner of the graph,
19908 // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the
19909 // graph
19910
19911 if (this.armLength < 0.71) this.armLength = 0.71;
19912 if (this.armLength > 5.0) this.armLength = 5.0;
19913 this.setOffset(this.cameraOffset.x, this.cameraOffset.y);
19914 this.calculateCameraOrientation();
19915};
19916/**
19917 * Retrieve the arm length
19918 * @return {number} length
19919 */
19920
19921
19922Camera.prototype.getArmLength = function () {
19923 return this.armLength;
19924};
19925/**
19926 * Retrieve the camera location
19927 * @return {Point3d} cameraLocation
19928 */
19929
19930
19931Camera.prototype.getCameraLocation = function () {
19932 return this.cameraLocation;
19933};
19934/**
19935 * Retrieve the camera rotation
19936 * @return {Point3d} cameraRotation
19937 */
19938
19939
19940Camera.prototype.getCameraRotation = function () {
19941 return this.cameraRotation;
19942};
19943/**
19944 * Calculate the location and rotation of the camera based on the
19945 * position and orientation of the camera arm
19946 */
19947
19948
19949Camera.prototype.calculateCameraOrientation = function () {
19950 // calculate location of the camera
19951 this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
19952 this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
19953 this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); // calculate rotation of the camera
19954
19955 this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical;
19956 this.cameraRotation.y = 0;
19957 this.cameraRotation.z = -this.armRotation.horizontal;
19958 var xa = this.cameraRotation.x;
19959 var za = this.cameraRotation.z;
19960 var dx = this.cameraOffset.x;
19961 var dy = this.cameraOffset.y;
19962 var sin = Math.sin,
19963 cos = Math.cos;
19964 this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa);
19965 this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa);
19966 this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa);
19967};
19968
19969var Camera_1 = Camera;
19970
19971// This modules handles the options for Graph3d.
19972//
19973////////////////////////////////////////////////////////////////////////////////
19974// enumerate the available styles
19975
19976var STYLE = {
19977 BAR: 0,
19978 BARCOLOR: 1,
19979 BARSIZE: 2,
19980 DOT: 3,
19981 DOTLINE: 4,
19982 DOTCOLOR: 5,
19983 DOTSIZE: 6,
19984 GRID: 7,
19985 LINE: 8,
19986 SURFACE: 9
19987}; // The string representations of the styles
19988
19989var STYLENAME = {
19990 'dot': STYLE.DOT,
19991 'dot-line': STYLE.DOTLINE,
19992 'dot-color': STYLE.DOTCOLOR,
19993 'dot-size': STYLE.DOTSIZE,
19994 'line': STYLE.LINE,
19995 'grid': STYLE.GRID,
19996 'surface': STYLE.SURFACE,
19997 'bar': STYLE.BAR,
19998 'bar-color': STYLE.BARCOLOR,
19999 'bar-size': STYLE.BARSIZE
20000};
20001/**
20002 * Field names in the options hash which are of relevance to the user.
20003 *
20004 * Specifically, these are the fields which require no special handling,
20005 * and can be directly copied over.
20006 */
20007
20008var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showXAxis', 'showYAxis', 'showZAxis', 'showGrid', 'showPerspective', 'showShadow', 'keepAspectRatio', 'rotateAxisLabels', 'verticalRatio', 'dotSizeRatio', 'dotSizeMinFraction', 'dotSizeMaxFraction', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'axisFontSize', 'axisFontType', 'gridColor', 'xCenter', 'yCenter', 'zoomable', 'tooltipDelay', 'ctrlToZoom'];
20009/**
20010 * Field names in the options hash which are of relevance to the user.
20011 *
20012 * Same as OPTIONKEYS, but internally these fields are stored with
20013 * prefix 'default' in the name.
20014 */
20015
20016var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep']; // Placeholder for DEFAULTS reference
20017
20018var DEFAULTS = undefined;
20019/**
20020 * Check if given hash is empty.
20021 *
20022 * Source: http://stackoverflow.com/a/679937
20023 *
20024 * @param {object} obj
20025 * @returns {boolean}
20026 */
20027
20028function isEmpty(obj) {
20029 for (var prop in obj) {
20030 if (obj.hasOwnProperty(prop)) return false;
20031 }
20032
20033 return true;
20034}
20035/**
20036 * Make first letter of parameter upper case.
20037 *
20038 * Source: http://stackoverflow.com/a/1026087
20039 *
20040 * @param {string} str
20041 * @returns {string}
20042 */
20043
20044
20045function capitalize(str) {
20046 if (str === undefined || str === "" || typeof str != "string") {
20047 return str;
20048 }
20049
20050 return str.charAt(0).toUpperCase() + str.slice(1);
20051}
20052/**
20053 * Add a prefix to a field name, taking style guide into account
20054 *
20055 * @param {string} prefix
20056 * @param {string} fieldName
20057 * @returns {string}
20058 */
20059
20060
20061function prefixFieldName(prefix, fieldName) {
20062 if (prefix === undefined || prefix === "") {
20063 return fieldName;
20064 }
20065
20066 return prefix + capitalize(fieldName);
20067}
20068/**
20069 * Forcibly copy fields from src to dst in a controlled manner.
20070 *
20071 * A given field in dst will always be overwitten. If this field
20072 * is undefined or not present in src, the field in dst will
20073 * be explicitly set to undefined.
20074 *
20075 * The intention here is to be able to reset all option fields.
20076 *
20077 * Only the fields mentioned in array 'fields' will be handled.
20078 *
20079 * @param {object} src
20080 * @param {object} dst
20081 * @param {array<string>} fields array with names of fields to copy
20082 * @param {string} [prefix] prefix to use for the target fields.
20083 */
20084
20085
20086function forceCopy(src, dst, fields, prefix) {
20087 var srcKey;
20088 var dstKey;
20089
20090 for (var i = 0; i < fields.length; ++i) {
20091 srcKey = fields[i];
20092 dstKey = prefixFieldName(prefix, srcKey);
20093 dst[dstKey] = src[srcKey];
20094 }
20095}
20096/**
20097 * Copy fields from src to dst in a safe and controlled manner.
20098 *
20099 * Only the fields mentioned in array 'fields' will be copied over,
20100 * and only if these are actually defined.
20101 *
20102 * @param {object} src
20103 * @param {object} dst
20104 * @param {array<string>} fields array with names of fields to copy
20105 * @param {string} [prefix] prefix to use for the target fields.
20106 */
20107
20108
20109function safeCopy(src, dst, fields, prefix) {
20110 var srcKey;
20111 var dstKey;
20112
20113 for (var i = 0; i < fields.length; ++i) {
20114 srcKey = fields[i];
20115 if (src[srcKey] === undefined) continue;
20116 dstKey = prefixFieldName(prefix, srcKey);
20117 dst[dstKey] = src[srcKey];
20118 }
20119}
20120/**
20121 * Initialize dst with the values in src.
20122 *
20123 * src is the hash with the default values.
20124 * A reference DEFAULTS to this hash is stored locally for
20125 * further handling.
20126 *
20127 * For now, dst is assumed to be a Graph3d instance.
20128 * @param {object} src
20129 * @param {object} dst
20130 */
20131
20132
20133function setDefaults(src, dst) {
20134 if (src === undefined || isEmpty(src)) {
20135 throw new Error('No DEFAULTS passed');
20136 }
20137
20138 if (dst === undefined) {
20139 throw new Error('No dst passed');
20140 } // Remember defaults for future reference
20141
20142
20143 DEFAULTS = src; // Handle the defaults which can be simply copied over
20144
20145 forceCopy(src, dst, OPTIONKEYS);
20146 forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default'); // Handle the more complex ('special') fields
20147
20148 setSpecialSettings(src, dst); // Following are internal fields, not part of the user settings
20149
20150 dst.margin = 10; // px
20151
20152 dst.showGrayBottom = false; // TODO: this does not work correctly
20153
20154 dst.showTooltip = false;
20155 dst.onclick_callback = null;
20156 dst.eye = new Point3d_1(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window?
20157}
20158/**
20159 *
20160 * @param {object} options
20161 * @param {object} dst
20162 */
20163
20164
20165function setOptions(options, dst) {
20166 if (options === undefined) {
20167 return;
20168 }
20169
20170 if (dst === undefined) {
20171 throw new Error('No dst passed');
20172 }
20173
20174 if (DEFAULTS === undefined || isEmpty(DEFAULTS)) {
20175 throw new Error('DEFAULTS not set for module Settings');
20176 } // Handle the parameters which can be simply copied over
20177
20178
20179 safeCopy(options, dst, OPTIONKEYS);
20180 safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default'); // Handle the more complex ('special') fields
20181
20182 setSpecialSettings(options, dst);
20183}
20184/**
20185 * Special handling for certain parameters
20186 *
20187 * 'Special' here means: setting requires more than a simple copy
20188 *
20189 * @param {object} src
20190 * @param {object} dst
20191 */
20192
20193
20194function setSpecialSettings(src, dst) {
20195 if (src.backgroundColor !== undefined) {
20196 setBackgroundColor(src.backgroundColor, dst);
20197 }
20198
20199 setDataColor(src.dataColor, dst);
20200 setStyle(src.style, dst);
20201 setShowLegend(src.showLegend, dst);
20202 setCameraPosition(src.cameraPosition, dst); // As special fields go, this is an easy one; just a translation of the name.
20203 // Can't use this.tooltip directly, because that field exists internally
20204
20205 if (src.tooltip !== undefined) {
20206 dst.showTooltip = src.tooltip;
20207 }
20208
20209 if (src.onclick != undefined) {
20210 dst.onclick_callback = src.onclick;
20211 }
20212
20213 if (src.tooltipStyle !== undefined) {
20214 util.selectiveDeepExtend(['tooltipStyle'], dst, src);
20215 }
20216}
20217/**
20218 * Set the value of setting 'showLegend'
20219 *
20220 * This depends on the value of the style fields, so it must be called
20221 * after the style field has been initialized.
20222 *
20223 * @param {boolean} showLegend
20224 * @param {object} dst
20225 */
20226
20227
20228function setShowLegend(showLegend, dst) {
20229 if (showLegend === undefined) {
20230 // If the default was auto, make a choice for this field
20231 var isAutoByDefault = DEFAULTS.showLegend === undefined;
20232
20233 if (isAutoByDefault) {
20234 // these styles default to having legends
20235 var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;
20236 dst.showLegend = isLegendGraphStyle;
20237 }
20238 } else {
20239 dst.showLegend = showLegend;
20240 }
20241}
20242/**
20243 * Retrieve the style index from given styleName
20244 * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line'
20245 * @return {number} styleNumber Enumeration value representing the style, or -1
20246 * when not found
20247 */
20248
20249
20250function getStyleNumberByName(styleName) {
20251 var number = STYLENAME[styleName];
20252
20253 if (number === undefined) {
20254 return -1;
20255 }
20256
20257 return number;
20258}
20259/**
20260 * Check if given number is a valid style number.
20261 *
20262 * @param {string | number} style
20263 * @return {boolean} true if valid, false otherwise
20264 */
20265
20266
20267function checkStyleNumber(style) {
20268 var valid = false;
20269
20270 for (var n in STYLE) {
20271 if (STYLE[n] === style) {
20272 valid = true;
20273 break;
20274 }
20275 }
20276
20277 return valid;
20278}
20279/**
20280 *
20281 * @param {string | number} style
20282 * @param {Object} dst
20283 */
20284
20285
20286function setStyle(style, dst) {
20287 if (style === undefined) {
20288 return; // Nothing to do
20289 }
20290
20291 var styleNumber;
20292
20293 if (typeof style === 'string') {
20294 styleNumber = getStyleNumberByName(style);
20295
20296 if (styleNumber === -1) {
20297 throw new Error('Style \'' + style + '\' is invalid');
20298 }
20299 } else {
20300 // Do a pedantic check on style number value
20301 if (!checkStyleNumber(style)) {
20302 throw new Error('Style \'' + style + '\' is invalid');
20303 }
20304
20305 styleNumber = style;
20306 }
20307
20308 dst.style = styleNumber;
20309}
20310/**
20311 * Set the background styling for the graph
20312 * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor
20313 * @param {Object} dst
20314 */
20315
20316
20317function setBackgroundColor(backgroundColor, dst) {
20318 var fill = 'white';
20319 var stroke = 'gray';
20320 var strokeWidth = 1;
20321
20322 if (typeof backgroundColor === 'string') {
20323 fill = backgroundColor;
20324 stroke = 'none';
20325 strokeWidth = 0;
20326 } else if (_typeof(backgroundColor) === 'object') {
20327 if (backgroundColor.fill !== undefined) fill = backgroundColor.fill;
20328 if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke;
20329 if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth;
20330 } else {
20331 throw new Error('Unsupported type of backgroundColor');
20332 }
20333
20334 dst.frame.style.backgroundColor = fill;
20335 dst.frame.style.borderColor = stroke;
20336 dst.frame.style.borderWidth = strokeWidth + 'px';
20337 dst.frame.style.borderStyle = 'solid';
20338}
20339/**
20340 *
20341 * @param {string | Object} dataColor
20342 * @param {Object} dst
20343 */
20344
20345
20346function setDataColor(dataColor, dst) {
20347 if (dataColor === undefined) {
20348 return; // Nothing to do
20349 }
20350
20351 if (dst.dataColor === undefined) {
20352 dst.dataColor = {};
20353 }
20354
20355 if (typeof dataColor === 'string') {
20356 dst.dataColor.fill = dataColor;
20357 dst.dataColor.stroke = dataColor;
20358 } else {
20359 if (dataColor.fill) {
20360 dst.dataColor.fill = dataColor.fill;
20361 }
20362
20363 if (dataColor.stroke) {
20364 dst.dataColor.stroke = dataColor.stroke;
20365 }
20366
20367 if (dataColor.strokeWidth !== undefined) {
20368 dst.dataColor.strokeWidth = dataColor.strokeWidth;
20369 }
20370 }
20371}
20372/**
20373 *
20374 * @param {Object} cameraPosition
20375 * @param {Object} dst
20376 */
20377
20378
20379function setCameraPosition(cameraPosition, dst) {
20380 var camPos = cameraPosition;
20381
20382 if (camPos === undefined) {
20383 return;
20384 }
20385
20386 if (dst.camera === undefined) {
20387 dst.camera = new Camera_1();
20388 }
20389
20390 dst.camera.setArmRotation(camPos.horizontal, camPos.vertical);
20391 dst.camera.setArmLength(camPos.distance);
20392}
20393
20394var STYLE_1 = STYLE;
20395var setDefaults_1 = setDefaults;
20396var setOptions_1 = setOptions;
20397var setCameraPosition_1 = setCameraPosition;
20398var Settings = {
20399 STYLE: STYLE_1,
20400 setDefaults: setDefaults_1,
20401 setOptions: setOptions_1,
20402 setCameraPosition: setCameraPosition_1
20403};
20404
20405var errorFound = false;
20406var allOptions;
20407var printStyle = 'background: #FFeeee; color: #dd0000';
20408/**
20409 * Used to validate options.
20410 */
20411
20412var Validator =
20413/*#__PURE__*/
20414function () {
20415 /**
20416 * @ignore
20417 */
20418 function Validator() {
20419 _classCallCheck$1(this, Validator);
20420 }
20421 /**
20422 * Main function to be called
20423 * @param {Object} options
20424 * @param {Object} referenceOptions
20425 * @param {Object} subObject
20426 * @returns {boolean}
20427 * @static
20428 */
20429
20430
20431 _createClass$1(Validator, null, [{
20432 key: "validate",
20433 value: function validate(options, referenceOptions, subObject) {
20434 errorFound = false;
20435 allOptions = referenceOptions;
20436 var usedOptions = referenceOptions;
20437
20438 if (subObject !== undefined) {
20439 usedOptions = referenceOptions[subObject];
20440 }
20441
20442 Validator.parse(options, usedOptions, []);
20443 return errorFound;
20444 }
20445 /**
20446 * Will traverse an object recursively and check every value
20447 * @param {Object} options
20448 * @param {Object} referenceOptions
20449 * @param {array} path | where to look for the actual option
20450 * @static
20451 */
20452
20453 }, {
20454 key: "parse",
20455 value: function parse(options, referenceOptions, path) {
20456 for (var option in options) {
20457 if (options.hasOwnProperty(option)) {
20458 Validator.check(option, options, referenceOptions, path);
20459 }
20460 }
20461 }
20462 /**
20463 * Check every value. If the value is an object, call the parse function on that object.
20464 * @param {string} option
20465 * @param {Object} options
20466 * @param {Object} referenceOptions
20467 * @param {array} path | where to look for the actual option
20468 * @static
20469 */
20470
20471 }, {
20472 key: "check",
20473 value: function check(option, options, referenceOptions, path) {
20474 if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) {
20475 Validator.getSuggestion(option, referenceOptions, path);
20476 return;
20477 }
20478
20479 var referenceOption = option;
20480 var is_object = true;
20481
20482 if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
20483 // NOTE: This only triggers if the __any__ is in the top level of the options object.
20484 // THAT'S A REALLY BAD PLACE TO ALLOW IT!!!!
20485 // TODO: Examine if needed, remove if possible
20486 // __any__ is a wildcard. Any value is accepted and will be further analysed by reference.
20487 referenceOption = '__any__'; // if the any-subgroup is not a predefined object in the configurator,
20488 // we do not look deeper into the object.
20489
20490 is_object = Validator.getType(options[option]) === 'object';
20491 }
20492
20493 var refOptionObj = referenceOptions[referenceOption];
20494
20495 if (is_object && refOptionObj.__type__ !== undefined) {
20496 refOptionObj = refOptionObj.__type__;
20497 }
20498
20499 Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path);
20500 }
20501 /**
20502 *
20503 * @param {string} option | the option property
20504 * @param {Object} options | The supplied options object
20505 * @param {Object} referenceOptions | The reference options containing all options and their allowed formats
20506 * @param {string} referenceOption | Usually this is the same as option, except when handling an __any__ tag.
20507 * @param {string} refOptionObj | This is the type object from the reference options
20508 * @param {Array} path | where in the object is the option
20509 * @static
20510 */
20511
20512 }, {
20513 key: "checkFields",
20514 value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) {
20515 var log = function log(message) {
20516 console.log('%c' + message + Validator.printLocation(path, option), printStyle);
20517 };
20518
20519 var optionType = Validator.getType(options[option]);
20520 var refOptionType = refOptionObj[optionType];
20521
20522 if (refOptionType !== undefined) {
20523 // if the type is correct, we check if it is supposed to be one of a few select values
20524 if (Validator.getType(refOptionType) === 'array' && refOptionType.indexOf(options[option]) === -1) {
20525 log('Invalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ');
20526 errorFound = true;
20527 } else if (optionType === 'object' && referenceOption !== "__any__") {
20528 path = util.copyAndExtendArray(path, option);
20529 Validator.parse(options[option], referenceOptions[referenceOption], path);
20530 }
20531 } else if (refOptionObj['any'] === undefined) {
20532 // type of the field is incorrect and the field cannot be any
20533 log('Invalid type received for "' + option + '". Expected: ' + Validator.print(Object.keys(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"');
20534 errorFound = true;
20535 }
20536 }
20537 /**
20538 *
20539 * @param {Object|boolean|number|string|Array.<number>|Date|Node|Moment|undefined|null} object
20540 * @returns {string}
20541 * @static
20542 */
20543
20544 }, {
20545 key: "getType",
20546 value: function getType(object) {
20547 var type = _typeof(object);
20548
20549 if (type === 'object') {
20550 if (object === null) {
20551 return 'null';
20552 }
20553
20554 if (object instanceof Boolean) {
20555 return 'boolean';
20556 }
20557
20558 if (object instanceof Number) {
20559 return 'number';
20560 }
20561
20562 if (object instanceof String) {
20563 return 'string';
20564 }
20565
20566 if (Array.isArray(object)) {
20567 return 'array';
20568 }
20569
20570 if (object instanceof Date) {
20571 return 'date';
20572 }
20573
20574 if (object.nodeType !== undefined) {
20575 return 'dom';
20576 }
20577
20578 if (object._isAMomentObject === true) {
20579 return 'moment';
20580 }
20581
20582 return 'object';
20583 } else if (type === 'number') {
20584 return 'number';
20585 } else if (type === 'boolean') {
20586 return 'boolean';
20587 } else if (type === 'string') {
20588 return 'string';
20589 } else if (type === undefined) {
20590 return 'undefined';
20591 }
20592
20593 return type;
20594 }
20595 /**
20596 * @param {string} option
20597 * @param {Object} options
20598 * @param {Array.<string>} path
20599 * @static
20600 */
20601
20602 }, {
20603 key: "getSuggestion",
20604 value: function getSuggestion(option, options, path) {
20605 var localSearch = Validator.findInOptions(option, options, path, false);
20606 var globalSearch = Validator.findInOptions(option, allOptions, [], true);
20607 var localSearchThreshold = 8;
20608 var globalSearchThreshold = 4;
20609 var msg;
20610
20611 if (localSearch.indexMatch !== undefined) {
20612 msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n';
20613 } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) {
20614 msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, '');
20615 } else if (localSearch.distance <= localSearchThreshold) {
20616 msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option);
20617 } else {
20618 msg = '. Did you mean one of these: ' + Validator.print(Object.keys(options)) + Validator.printLocation(path, option);
20619 }
20620
20621 console.log('%cUnknown option detected: "' + option + '"' + msg, printStyle);
20622 errorFound = true;
20623 }
20624 /**
20625 * traverse the options in search for a match.
20626 * @param {string} option
20627 * @param {Object} options
20628 * @param {Array} path | where to look for the actual option
20629 * @param {boolean} [recursive=false]
20630 * @returns {{closestMatch: string, path: Array, distance: number}}
20631 * @static
20632 */
20633
20634 }, {
20635 key: "findInOptions",
20636 value: function findInOptions(option, options, path) {
20637 var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
20638 var min = 1e9;
20639 var closestMatch = '';
20640 var closestMatchPath = [];
20641 var lowerCaseOption = option.toLowerCase();
20642 var indexMatch = undefined;
20643
20644 for (var op in options) {
20645 // eslint-disable-line guard-for-in
20646 var distance = void 0;
20647
20648 if (options[op].__type__ !== undefined && recursive === true) {
20649 var result = Validator.findInOptions(option, options[op], util.copyAndExtendArray(path, op));
20650
20651 if (min > result.distance) {
20652 closestMatch = result.closestMatch;
20653 closestMatchPath = result.path;
20654 min = result.distance;
20655 indexMatch = result.indexMatch;
20656 }
20657 } else {
20658 if (op.toLowerCase().indexOf(lowerCaseOption) !== -1) {
20659 indexMatch = op;
20660 }
20661
20662 distance = Validator.levenshteinDistance(option, op);
20663
20664 if (min > distance) {
20665 closestMatch = op;
20666 closestMatchPath = util.copyArray(path);
20667 min = distance;
20668 }
20669 }
20670 }
20671
20672 return {
20673 closestMatch: closestMatch,
20674 path: closestMatchPath,
20675 distance: min,
20676 indexMatch: indexMatch
20677 };
20678 }
20679 /**
20680 * @param {Array.<string>} path
20681 * @param {Object} option
20682 * @param {string} prefix
20683 * @returns {String}
20684 * @static
20685 */
20686
20687 }, {
20688 key: "printLocation",
20689 value: function printLocation(path, option) {
20690 var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n';
20691 var str = '\n\n' + prefix + 'options = {\n';
20692
20693 for (var i = 0; i < path.length; i++) {
20694 for (var j = 0; j < i + 1; j++) {
20695 str += ' ';
20696 }
20697
20698 str += path[i] + ': {\n';
20699 }
20700
20701 for (var _j = 0; _j < path.length + 1; _j++) {
20702 str += ' ';
20703 }
20704
20705 str += option + '\n';
20706
20707 for (var _i = 0; _i < path.length + 1; _i++) {
20708 for (var _j2 = 0; _j2 < path.length - _i; _j2++) {
20709 str += ' ';
20710 }
20711
20712 str += '}\n';
20713 }
20714
20715 return str + '\n\n';
20716 }
20717 /**
20718 * @param {Object} options
20719 * @returns {String}
20720 * @static
20721 */
20722
20723 }, {
20724 key: "print",
20725 value: function print(options) {
20726 return JSON.stringify(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', ');
20727 }
20728 /**
20729 * Compute the edit distance between the two given strings
20730 * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript
20731 *
20732 * Copyright (c) 2011 Andrei Mackenzie
20733 *
20734 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20735 *
20736 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20737 *
20738 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20739 *
20740 * @param {string} a
20741 * @param {string} b
20742 * @returns {Array.<Array.<number>>}}
20743 * @static
20744 */
20745
20746 }, {
20747 key: "levenshteinDistance",
20748 value: function levenshteinDistance(a, b) {
20749 if (a.length === 0) return b.length;
20750 if (b.length === 0) return a.length;
20751 var matrix = []; // increment along the first column of each row
20752
20753 var i;
20754
20755 for (i = 0; i <= b.length; i++) {
20756 matrix[i] = [i];
20757 } // increment each column in the first row
20758
20759
20760 var j;
20761
20762 for (j = 0; j <= a.length; j++) {
20763 matrix[0][j] = j;
20764 } // Fill in the rest of the matrix
20765
20766
20767 for (i = 1; i <= b.length; i++) {
20768 for (j = 1; j <= a.length; j++) {
20769 if (b.charAt(i - 1) == a.charAt(j - 1)) {
20770 matrix[i][j] = matrix[i - 1][j - 1];
20771 } else {
20772 matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
20773 Math.min(matrix[i][j - 1] + 1, // insertion
20774 matrix[i - 1][j] + 1)); // deletion
20775 }
20776 }
20777 }
20778
20779 return matrix[b.length][a.length];
20780 }
20781 }]);
20782
20783 return Validator;
20784}();
20785
20786var Validator$1 = /*#__PURE__*/Object.freeze({
20787 Validator: Validator,
20788 printStyle: printStyle
20789});
20790
20791/**
20792 * This object contains all possible options. It will check if the types are correct, if required if the option is one
20793 * of the allowed values.
20794 *
20795 * __any__ means that the name of the property does not matter.
20796 * __type__ is a required field for all objects and contains the allowed types of all objects
20797 */
20798var string = 'string';
20799var bool = 'boolean';
20800var number = 'number';
20801var object = 'object'; // should only be in a __type__ property
20802// Following not used here, but useful for reference
20803//let array = 'array';
20804//let dom = 'dom';
20805//let any = 'any';
20806
20807var colorOptions = {
20808 fill: {
20809 string: string
20810 },
20811 stroke: {
20812 string: string
20813 },
20814 strokeWidth: {
20815 number: number
20816 },
20817 __type__: {
20818 string: string,
20819 object: object,
20820 'undefined': 'undefined'
20821 }
20822};
20823/**
20824 * Order attempted to be alphabetical.
20825 * - x/y/z-prefixes ignored in sorting
20826 * - __type__ always at end
20827 * - globals at end
20828 */
20829
20830var allOptions$1 = {
20831 animationAutoStart: {
20832 boolean: bool,
20833 'undefined': 'undefined'
20834 },
20835 animationInterval: {
20836 number: number
20837 },
20838 animationPreload: {
20839 boolean: bool
20840 },
20841 axisColor: {
20842 string: string
20843 },
20844 axisFontSize: {
20845 number: number
20846 },
20847 axisFontType: {
20848 string: string
20849 },
20850 backgroundColor: colorOptions,
20851 xBarWidth: {
20852 number: number,
20853 'undefined': 'undefined'
20854 },
20855 yBarWidth: {
20856 number: number,
20857 'undefined': 'undefined'
20858 },
20859 cameraPosition: {
20860 distance: {
20861 number: number
20862 },
20863 horizontal: {
20864 number: number
20865 },
20866 vertical: {
20867 number: number
20868 },
20869 __type__: {
20870 object: object
20871 }
20872 },
20873 zoomable: {
20874 boolean: bool
20875 },
20876 ctrlToZoom: {
20877 boolean: bool
20878 },
20879 xCenter: {
20880 string: string
20881 },
20882 yCenter: {
20883 string: string
20884 },
20885 dataColor: colorOptions,
20886 dotSizeMinFraction: {
20887 number: number
20888 },
20889 dotSizeMaxFraction: {
20890 number: number
20891 },
20892 dotSizeRatio: {
20893 number: number
20894 },
20895 filterLabel: {
20896 string: string
20897 },
20898 gridColor: {
20899 string: string
20900 },
20901 onclick: {
20902 'function': 'function'
20903 },
20904 keepAspectRatio: {
20905 boolean: bool
20906 },
20907 xLabel: {
20908 string: string
20909 },
20910 yLabel: {
20911 string: string
20912 },
20913 zLabel: {
20914 string: string
20915 },
20916 legendLabel: {
20917 string: string
20918 },
20919 xMin: {
20920 number: number,
20921 'undefined': 'undefined'
20922 },
20923 yMin: {
20924 number: number,
20925 'undefined': 'undefined'
20926 },
20927 zMin: {
20928 number: number,
20929 'undefined': 'undefined'
20930 },
20931 xMax: {
20932 number: number,
20933 'undefined': 'undefined'
20934 },
20935 yMax: {
20936 number: number,
20937 'undefined': 'undefined'
20938 },
20939 zMax: {
20940 number: number,
20941 'undefined': 'undefined'
20942 },
20943 showAnimationControls: {
20944 boolean: bool,
20945 'undefined': 'undefined'
20946 },
20947 showGrid: {
20948 boolean: bool
20949 },
20950 showLegend: {
20951 boolean: bool,
20952 'undefined': 'undefined'
20953 },
20954 showPerspective: {
20955 boolean: bool
20956 },
20957 showShadow: {
20958 boolean: bool
20959 },
20960 showXAxis: {
20961 boolean: bool
20962 },
20963 showYAxis: {
20964 boolean: bool
20965 },
20966 showZAxis: {
20967 boolean: bool
20968 },
20969 rotateAxisLabels: {
20970 boolean: bool
20971 },
20972 xStep: {
20973 number: number,
20974 'undefined': 'undefined'
20975 },
20976 yStep: {
20977 number: number,
20978 'undefined': 'undefined'
20979 },
20980 zStep: {
20981 number: number,
20982 'undefined': 'undefined'
20983 },
20984 style: {
20985 number: number,
20986 // TODO: either Graph3d.DEFAULT has string, or number allowed in documentation
20987 string: ['bar', 'bar-color', 'bar-size', 'dot', 'dot-line', 'dot-color', 'dot-size', 'line', 'grid', 'surface']
20988 },
20989 tooltip: {
20990 boolean: bool,
20991 'function': 'function'
20992 },
20993 tooltipDelay: {
20994 number: number
20995 },
20996 tooltipStyle: {
20997 content: {
20998 color: {
20999 string: string
21000 },
21001 background: {
21002 string: string
21003 },
21004 border: {
21005 string: string
21006 },
21007 borderRadius: {
21008 string: string
21009 },
21010 boxShadow: {
21011 string: string
21012 },
21013 padding: {
21014 string: string
21015 },
21016 __type__: {
21017 object: object
21018 }
21019 },
21020 line: {
21021 borderLeft: {
21022 string: string
21023 },
21024 height: {
21025 string: string
21026 },
21027 width: {
21028 string: string
21029 },
21030 pointerEvents: {
21031 string: string
21032 },
21033 __type__: {
21034 object: object
21035 }
21036 },
21037 dot: {
21038 border: {
21039 string: string
21040 },
21041 borderRadius: {
21042 string: string
21043 },
21044 height: {
21045 string: string
21046 },
21047 width: {
21048 string: string
21049 },
21050 pointerEvents: {
21051 string: string
21052 },
21053 __type__: {
21054 object: object
21055 }
21056 },
21057 __type__: {
21058 object: object
21059 }
21060 },
21061 xValueLabel: {
21062 'function': 'function'
21063 },
21064 yValueLabel: {
21065 'function': 'function'
21066 },
21067 zValueLabel: {
21068 'function': 'function'
21069 },
21070 valueMax: {
21071 number: number,
21072 'undefined': 'undefined'
21073 },
21074 valueMin: {
21075 number: number,
21076 'undefined': 'undefined'
21077 },
21078 verticalRatio: {
21079 number: number
21080 },
21081 //globals :
21082 height: {
21083 string: string
21084 },
21085 width: {
21086 string: string
21087 },
21088 __type__: {
21089 object: object
21090 }
21091};
21092
21093var options = /*#__PURE__*/Object.freeze({
21094 allOptions: allOptions$1
21095});
21096
21097/**
21098 * @prototype Range
21099 *
21100 * Helper class to make working with related min and max values easier.
21101 *
21102 * The range is inclusive; a given value is considered part of the range if:
21103 *
21104 * this.min <= value <= this.max
21105 */
21106function Range() {
21107 this.min = undefined;
21108 this.max = undefined;
21109}
21110/**
21111 * Adjust the range so that the passed value fits in it.
21112 *
21113 * If the value is outside of the current extremes, adjust
21114 * the min or max so that the value is within the range.
21115 *
21116 * @param {number} value Numeric value to fit in range
21117 */
21118
21119
21120Range.prototype.adjust = function (value) {
21121 if (value === undefined) return;
21122
21123 if (this.min === undefined || this.min > value) {
21124 this.min = value;
21125 }
21126
21127 if (this.max === undefined || this.max < value) {
21128 this.max = value;
21129 }
21130};
21131/**
21132 * Adjust the current range so that the passed range fits in it.
21133 *
21134 * @param {Range} range Range instance to fit in current instance
21135 */
21136
21137
21138Range.prototype.combine = function (range) {
21139 this.add(range.min);
21140 this.add(range.max);
21141};
21142/**
21143 * Expand the range by the given value
21144 *
21145 * min will be lowered by given value;
21146 * max will be raised by given value
21147 *
21148 * Shrinking by passing a negative value is allowed.
21149 *
21150 * @param {number} val Amount by which to expand or shrink current range with
21151 */
21152
21153
21154Range.prototype.expand = function (val) {
21155 if (val === undefined) {
21156 return;
21157 }
21158
21159 var newMin = this.min - val;
21160 var newMax = this.max + val; // Note that following allows newMin === newMax.
21161 // This should be OK, since method expand() allows this also.
21162
21163 if (newMin > newMax) {
21164 throw new Error('Passed expansion value makes range invalid');
21165 }
21166
21167 this.min = newMin;
21168 this.max = newMax;
21169};
21170/**
21171 * Determine the full range width of current instance.
21172 *
21173 * @returns {num} The calculated width of this range
21174 */
21175
21176
21177Range.prototype.range = function () {
21178 return this.max - this.min;
21179};
21180/**
21181 * Determine the central point of current instance.
21182 *
21183 * @returns {number} the value in the middle of min and max
21184 */
21185
21186
21187Range.prototype.center = function () {
21188 return (this.min + this.max) / 2;
21189};
21190
21191var Range_1 = Range;
21192
21193var DataView$1 = index.DataView;
21194/**
21195 * @class Filter
21196 *
21197 * @param {DataGroup} dataGroup the data group
21198 * @param {number} column The index of the column to be filtered
21199 * @param {Graph3d} graph The graph
21200 */
21201
21202function Filter(dataGroup, column, graph) {
21203 this.dataGroup = dataGroup;
21204 this.column = column;
21205 this.graph = graph; // the parent graph
21206
21207 this.index = undefined;
21208 this.value = undefined; // read all distinct values and select the first one
21209
21210 this.values = dataGroup.getDistinctValues(this.column);
21211
21212 if (this.values.length > 0) {
21213 this.selectValue(0);
21214 } // create an array with the filtered datapoints. this will be loaded afterwards
21215
21216
21217 this.dataPoints = [];
21218 this.loaded = false;
21219 this.onLoadCallback = undefined;
21220
21221 if (graph.animationPreload) {
21222 this.loaded = false;
21223 this.loadInBackground();
21224 } else {
21225 this.loaded = true;
21226 }
21227}
21228/**
21229 * Return the label
21230 * @return {string} label
21231 */
21232
21233
21234Filter.prototype.isLoaded = function () {
21235 return this.loaded;
21236};
21237/**
21238 * Return the loaded progress
21239 * @return {number} percentage between 0 and 100
21240 */
21241
21242
21243Filter.prototype.getLoadedProgress = function () {
21244 var len = this.values.length;
21245 var i = 0;
21246
21247 while (this.dataPoints[i]) {
21248 i++;
21249 }
21250
21251 return Math.round(i / len * 100);
21252};
21253/**
21254 * Return the label
21255 * @return {string} label
21256 */
21257
21258
21259Filter.prototype.getLabel = function () {
21260 return this.graph.filterLabel;
21261};
21262/**
21263 * Return the columnIndex of the filter
21264 * @return {number} columnIndex
21265 */
21266
21267
21268Filter.prototype.getColumn = function () {
21269 return this.column;
21270};
21271/**
21272 * Return the currently selected value. Returns undefined if there is no selection
21273 * @return {*} value
21274 */
21275
21276
21277Filter.prototype.getSelectedValue = function () {
21278 if (this.index === undefined) return undefined;
21279 return this.values[this.index];
21280};
21281/**
21282 * Retrieve all values of the filter
21283 * @return {Array} values
21284 */
21285
21286
21287Filter.prototype.getValues = function () {
21288 return this.values;
21289};
21290/**
21291 * Retrieve one value of the filter
21292 * @param {number} index
21293 * @return {*} value
21294 */
21295
21296
21297Filter.prototype.getValue = function (index) {
21298 if (index >= this.values.length) throw new Error('Index out of range');
21299 return this.values[index];
21300};
21301/**
21302 * Retrieve the (filtered) dataPoints for the currently selected filter index
21303 * @param {number} [index] (optional)
21304 * @return {Array} dataPoints
21305 */
21306
21307
21308Filter.prototype._getDataPoints = function (index) {
21309 if (index === undefined) index = this.index;
21310 if (index === undefined) return [];
21311 var dataPoints;
21312
21313 if (this.dataPoints[index]) {
21314 dataPoints = this.dataPoints[index];
21315 } else {
21316 var f = {};
21317 f.column = this.column;
21318 f.value = this.values[index];
21319 var dataView = new DataView$1(this.dataGroup.getDataSet(), {
21320 filter: function filter(item) {
21321 return item[f.column] == f.value;
21322 }
21323 }).get();
21324 dataPoints = this.dataGroup._getDataPoints(dataView);
21325 this.dataPoints[index] = dataPoints;
21326 }
21327
21328 return dataPoints;
21329};
21330/**
21331 * Set a callback function when the filter is fully loaded.
21332 *
21333 * @param {function} callback
21334 */
21335
21336
21337Filter.prototype.setOnLoadCallback = function (callback) {
21338 this.onLoadCallback = callback;
21339};
21340/**
21341 * Add a value to the list with available values for this filter
21342 * No double entries will be created.
21343 * @param {number} index
21344 */
21345
21346
21347Filter.prototype.selectValue = function (index) {
21348 if (index >= this.values.length) throw new Error('Index out of range');
21349 this.index = index;
21350 this.value = this.values[index];
21351};
21352/**
21353 * Load all filtered rows in the background one by one
21354 * Start this method without providing an index!
21355 *
21356 * @param {number} [index=0]
21357 */
21358
21359
21360Filter.prototype.loadInBackground = function (index) {
21361 if (index === undefined) index = 0;
21362 var frame = this.graph.frame;
21363
21364 if (index < this.values.length) {
21365 // create a progress box
21366 if (frame.progress === undefined) {
21367 frame.progress = document.createElement('DIV');
21368 frame.progress.style.position = 'absolute';
21369 frame.progress.style.color = 'gray';
21370 frame.appendChild(frame.progress);
21371 }
21372
21373 var progress = this.getLoadedProgress();
21374 frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; // TODO: this is no nice solution...
21375
21376 frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider
21377
21378 frame.progress.style.left = 10 + 'px';
21379 var me = this;
21380 setTimeout(function () {
21381 me.loadInBackground(index + 1);
21382 }, 10);
21383 this.loaded = false;
21384 } else {
21385 this.loaded = true; // remove the progress box
21386
21387 if (frame.progress !== undefined) {
21388 frame.removeChild(frame.progress);
21389 frame.progress = undefined;
21390 }
21391
21392 if (this.onLoadCallback) this.onLoadCallback();
21393 }
21394};
21395
21396var Filter_1 = Filter;
21397
21398var DataSet$1 = index.DataSet;
21399var DataView$2 = index.DataView;
21400/**
21401 * Creates a container for all data of one specific 3D-graph.
21402 *
21403 * On construction, the container is totally empty; the data
21404 * needs to be initialized with method initializeData().
21405 * Failure to do so will result in the following exception begin thrown
21406 * on instantiation of Graph3D:
21407 *
21408 * Error: Array, DataSet, or DataView expected
21409 *
21410 * @constructor DataGroup
21411 */
21412
21413function DataGroup() {
21414 this.dataTable = null; // The original data table
21415}
21416/**
21417 * Initializes the instance from the passed data.
21418 *
21419 * Calculates minimum and maximum values and column index values.
21420 *
21421 * The graph3d instance is used internally to access the settings for
21422 * the given instance.
21423 * TODO: Pass settings only instead.
21424 *
21425 * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance.
21426 * @param {Array | DataSet | DataView} rawData The data containing the items for
21427 * the Graph.
21428 * @param {number} style Style Number
21429 * @returns {Array.<Object>}
21430 */
21431
21432
21433DataGroup.prototype.initializeData = function (graph3d, rawData, style) {
21434 if (rawData === undefined) return;
21435
21436 if (Array.isArray(rawData)) {
21437 rawData = new DataSet$1(rawData);
21438 }
21439
21440 var data;
21441
21442 if (rawData instanceof DataSet$1 || rawData instanceof DataView$2) {
21443 data = rawData.get();
21444 } else {
21445 throw new Error('Array, DataSet, or DataView expected');
21446 }
21447
21448 if (data.length == 0) return;
21449 this.style = style; // unsubscribe from the dataTable
21450
21451 if (this.dataSet) {
21452 this.dataSet.off('*', this._onChange);
21453 }
21454
21455 this.dataSet = rawData;
21456 this.dataTable = data; // subscribe to changes in the dataset
21457
21458 var me = this;
21459
21460 this._onChange = function () {
21461 graph3d.setData(me.dataSet);
21462 };
21463
21464 this.dataSet.on('*', this._onChange); // determine the location of x,y,z,value,filter columns
21465
21466 this.colX = 'x';
21467 this.colY = 'y';
21468 this.colZ = 'z';
21469 var withBars = graph3d.hasBars(style); // determine barWidth from data
21470
21471 if (withBars) {
21472 if (graph3d.defaultXBarWidth !== undefined) {
21473 this.xBarWidth = graph3d.defaultXBarWidth;
21474 } else {
21475 this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1;
21476 }
21477
21478 if (graph3d.defaultYBarWidth !== undefined) {
21479 this.yBarWidth = graph3d.defaultYBarWidth;
21480 } else {
21481 this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1;
21482 }
21483 } // calculate minima and maxima
21484
21485
21486 this._initializeRange(data, this.colX, graph3d, withBars);
21487
21488 this._initializeRange(data, this.colY, graph3d, withBars);
21489
21490 this._initializeRange(data, this.colZ, graph3d, false);
21491
21492 if (data[0].hasOwnProperty('style')) {
21493 this.colValue = 'style';
21494 var valueRange = this.getColumnRange(data, this.colValue);
21495
21496 this._setRangeDefaults(valueRange, graph3d.defaultValueMin, graph3d.defaultValueMax);
21497
21498 this.valueRange = valueRange;
21499 } // Initialize data filter if a filter column is provided
21500
21501
21502 var table = this.getDataTable();
21503
21504 if (table[0].hasOwnProperty('filter')) {
21505 if (this.dataFilter === undefined) {
21506 this.dataFilter = new Filter_1(this, 'filter', graph3d);
21507 this.dataFilter.setOnLoadCallback(function () {
21508 graph3d.redraw();
21509 });
21510 }
21511 }
21512
21513 var dataPoints;
21514
21515 if (this.dataFilter) {
21516 // apply filtering
21517 dataPoints = this.dataFilter._getDataPoints();
21518 } else {
21519 // no filtering. load all data
21520 dataPoints = this._getDataPoints(this.getDataTable());
21521 }
21522
21523 return dataPoints;
21524};
21525/**
21526 * Collect the range settings for the given data column.
21527 *
21528 * This internal method is intended to make the range
21529 * initalization more generic.
21530 *
21531 * TODO: if/when combined settings per axis defined, get rid of this.
21532 *
21533 * @private
21534 *
21535 * @param {'x'|'y'|'z'} column The data column to process
21536 * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance;
21537 * required for access to settings
21538 * @returns {Object}
21539 */
21540
21541
21542DataGroup.prototype._collectRangeSettings = function (column, graph3d) {
21543 var index = ['x', 'y', 'z'].indexOf(column);
21544
21545 if (index == -1) {
21546 throw new Error('Column \'' + column + '\' invalid');
21547 }
21548
21549 var upper = column.toUpperCase();
21550 return {
21551 barWidth: this[column + 'BarWidth'],
21552 min: graph3d['default' + upper + 'Min'],
21553 max: graph3d['default' + upper + 'Max'],
21554 step: graph3d['default' + upper + 'Step'],
21555 range_label: column + 'Range',
21556 // Name of instance field to write to
21557 step_label: column + 'Step' // Name of instance field to write to
21558
21559 };
21560};
21561/**
21562 * Initializes the settings per given column.
21563 *
21564 * TODO: if/when combined settings per axis defined, rewrite this.
21565 *
21566 * @private
21567 *
21568 * @param {DataSet | DataView} data The data containing the items for the Graph
21569 * @param {'x'|'y'|'z'} column The data column to process
21570 * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance;
21571 * required for access to settings
21572 * @param {boolean} withBars True if initializing for bar graph
21573 */
21574
21575
21576DataGroup.prototype._initializeRange = function (data, column, graph3d, withBars) {
21577 var NUMSTEPS = 5;
21578
21579 var settings = this._collectRangeSettings(column, graph3d);
21580
21581 var range = this.getColumnRange(data, column);
21582
21583 if (withBars && column != 'z') {
21584 // Safeguard for 'z'; it doesn't have a bar width
21585 range.expand(settings.barWidth / 2);
21586 }
21587
21588 this._setRangeDefaults(range, settings.min, settings.max);
21589
21590 this[settings.range_label] = range;
21591 this[settings.step_label] = settings.step !== undefined ? settings.step : range.range() / NUMSTEPS;
21592};
21593/**
21594 * Creates a list with all the different values in the data for the given column.
21595 *
21596 * If no data passed, use the internal data of this instance.
21597 *
21598 * @param {'x'|'y'|'z'} column The data column to process
21599 * @param {DataSet|DataView|undefined} data The data containing the items for the Graph
21600 *
21601 * @returns {Array} All distinct values in the given column data, sorted ascending.
21602 */
21603
21604
21605DataGroup.prototype.getDistinctValues = function (column, data) {
21606 if (data === undefined) {
21607 data = this.dataTable;
21608 }
21609
21610 var values = [];
21611
21612 for (var i = 0; i < data.length; i++) {
21613 var value = data[i][column] || 0;
21614
21615 if (values.indexOf(value) === -1) {
21616 values.push(value);
21617 }
21618 }
21619
21620 return values.sort(function (a, b) {
21621 return a - b;
21622 });
21623};
21624/**
21625 * Determine the smallest difference between the values for given
21626 * column in the passed data set.
21627 *
21628 * @param {DataSet|DataView|undefined} data The data containing the items for the Graph
21629 * @param {'x'|'y'|'z'} column The data column to process
21630 *
21631 * @returns {number|null} Smallest difference value or
21632 * null, if it can't be determined.
21633 */
21634
21635
21636DataGroup.prototype.getSmallestDifference = function (data, column) {
21637 var values = this.getDistinctValues(data, column); // Get all the distinct diffs
21638 // Array values is assumed to be sorted here
21639
21640 var smallest_diff = null;
21641
21642 for (var i = 1; i < values.length; i++) {
21643 var diff = values[i] - values[i - 1];
21644
21645 if (smallest_diff == null || smallest_diff > diff) {
21646 smallest_diff = diff;
21647 }
21648 }
21649
21650 return smallest_diff;
21651};
21652/**
21653 * Get the absolute min/max values for the passed data column.
21654 *
21655 * @param {DataSet|DataView|undefined} data The data containing the items for the Graph
21656 * @param {'x'|'y'|'z'} column The data column to process
21657 *
21658 * @returns {Range} A Range instance with min/max members properly set.
21659 */
21660
21661
21662DataGroup.prototype.getColumnRange = function (data, column) {
21663 var range = new Range_1(); // Adjust the range so that it covers all values in the passed data elements.
21664
21665 for (var i = 0; i < data.length; i++) {
21666 var item = data[i][column];
21667 range.adjust(item);
21668 }
21669
21670 return range;
21671};
21672/**
21673 * Determines the number of rows in the current data.
21674 *
21675 * @returns {number}
21676 */
21677
21678
21679DataGroup.prototype.getNumberOfRows = function () {
21680 return this.dataTable.length;
21681};
21682/**
21683 * Set default values for range
21684 *
21685 * The default values override the range values, if defined.
21686 *
21687 * Because it's possible that only defaultMin or defaultMax is set, it's better
21688 * to pass in a range already set with the min/max set from the data. Otherwise,
21689 * it's quite hard to process the min/max properly.
21690 *
21691 * @param {vis.Range} range
21692 * @param {number} [defaultMin=range.min]
21693 * @param {number} [defaultMax=range.max]
21694 * @private
21695 */
21696
21697
21698DataGroup.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) {
21699 if (defaultMin !== undefined) {
21700 range.min = defaultMin;
21701 }
21702
21703 if (defaultMax !== undefined) {
21704 range.max = defaultMax;
21705 } // This is the original way that the default min/max values were adjusted.
21706 // TODO: Perhaps it's better if an error is thrown if the values do not agree.
21707 // But this will change the behaviour.
21708
21709
21710 if (range.max <= range.min) range.max = range.min + 1;
21711};
21712
21713DataGroup.prototype.getDataTable = function () {
21714 return this.dataTable;
21715};
21716
21717DataGroup.prototype.getDataSet = function () {
21718 return this.dataSet;
21719};
21720/**
21721 * Return all data values as a list of Point3d objects
21722 * @param {Array.<Object>} data
21723 * @returns {Array.<Object>}
21724 */
21725
21726
21727DataGroup.prototype.getDataPoints = function (data) {
21728 var dataPoints = [];
21729
21730 for (var i = 0; i < data.length; i++) {
21731 var point = new Point3d_1();
21732 point.x = data[i][this.colX] || 0;
21733 point.y = data[i][this.colY] || 0;
21734 point.z = data[i][this.colZ] || 0;
21735 point.data = data[i];
21736
21737 if (this.colValue !== undefined) {
21738 point.value = data[i][this.colValue] || 0;
21739 }
21740
21741 var obj = {};
21742 obj.point = point;
21743 obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
21744 obj.trans = undefined;
21745 obj.screen = undefined;
21746 dataPoints.push(obj);
21747 }
21748
21749 return dataPoints;
21750};
21751/**
21752 * Copy all values from the data table to a matrix.
21753 *
21754 * The provided values are supposed to form a grid of (x,y) positions.
21755 * @param {Array.<Object>} data
21756 * @returns {Array.<Object>}
21757 * @private
21758 */
21759
21760
21761DataGroup.prototype.initDataAsMatrix = function (data) {
21762 // TODO: store the created matrix dataPoints in the filters instead of
21763 // reloading each time.
21764 var x, y, i, obj; // create two lists with all present x and y values
21765
21766 var dataX = this.getDistinctValues(this.colX, data);
21767 var dataY = this.getDistinctValues(this.colY, data);
21768 var dataPoints = this.getDataPoints(data); // create a grid, a 2d matrix, with all values.
21769
21770 var dataMatrix = []; // temporary data matrix
21771
21772 for (i = 0; i < dataPoints.length; i++) {
21773 obj = dataPoints[i]; // TODO: implement Array().indexOf() for Internet Explorer
21774
21775 var xIndex = dataX.indexOf(obj.point.x);
21776 var yIndex = dataY.indexOf(obj.point.y);
21777
21778 if (dataMatrix[xIndex] === undefined) {
21779 dataMatrix[xIndex] = [];
21780 }
21781
21782 dataMatrix[xIndex][yIndex] = obj;
21783 } // fill in the pointers to the neighbors.
21784
21785
21786 for (x = 0; x < dataMatrix.length; x++) {
21787 for (y = 0; y < dataMatrix[x].length; y++) {
21788 if (dataMatrix[x][y]) {
21789 dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
21790 dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
21791 dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
21792 }
21793 }
21794 }
21795
21796 return dataPoints;
21797};
21798/**
21799 * Return common information, if present
21800 *
21801 * @returns {string}
21802 */
21803
21804
21805DataGroup.prototype.getInfo = function () {
21806 var dataFilter = this.dataFilter;
21807 if (!dataFilter) return undefined;
21808 return dataFilter.getLabel() + ': ' + dataFilter.getSelectedValue();
21809};
21810/**
21811 * Reload the data
21812 */
21813
21814
21815DataGroup.prototype.reload = function () {
21816 if (this.dataTable) {
21817 this.setData(this.dataTable);
21818 }
21819};
21820/**
21821 * Filter the data based on the current filter
21822 *
21823 * @param {Array} data
21824 * @returns {Array} dataPoints Array with point objects which can be drawn on
21825 * screen
21826 */
21827
21828
21829DataGroup.prototype._getDataPoints = function (data) {
21830 var dataPoints = [];
21831
21832 if (this.style === Settings.STYLE.GRID || this.style === Settings.STYLE.SURFACE) {
21833 dataPoints = this.initDataAsMatrix(data);
21834 } else {
21835 // 'dot', 'dot-line', etc.
21836 this._checkValueField(data);
21837
21838 dataPoints = this.getDataPoints(data);
21839
21840 if (this.style === Settings.STYLE.LINE) {
21841 // Add next member points for line drawing
21842 for (var i = 0; i < dataPoints.length; i++) {
21843 if (i > 0) {
21844 dataPoints[i - 1].pointNext = dataPoints[i];
21845 }
21846 }
21847 }
21848 }
21849
21850 return dataPoints;
21851};
21852/**
21853 * Check if the state is consistent for the use of the value field.
21854 *
21855 * Throws if a problem is detected.
21856 *
21857 * @param {Array.<Object>} data
21858 * @private
21859 */
21860
21861
21862DataGroup.prototype._checkValueField = function (data) {
21863 var hasValueField = this.style === Settings.STYLE.BARCOLOR || this.style === Settings.STYLE.BARSIZE || this.style === Settings.STYLE.DOTCOLOR || this.style === Settings.STYLE.DOTSIZE;
21864
21865 if (!hasValueField) {
21866 return; // No need to check further
21867 } // Following field must be present for the current graph style
21868
21869
21870 if (this.colValue === undefined) {
21871 throw new Error('Expected data to have ' + ' field \'style\' ' + ' for graph style \'' + this.style + '\'');
21872 } // The data must also contain this field.
21873 // Note that only first data element is checked.
21874
21875
21876 if (data[0][this.colValue] === undefined) {
21877 throw new Error('Expected data to have ' + ' field \'' + this.colValue + '\' ' + ' for graph style \'' + this.style + '\'');
21878 }
21879};
21880
21881var DataGroup_1 = DataGroup;
21882
21883var Validator$2 = Validator$1.Validator;
21884var printStyle$1 = Validator$1.printStyle;
21885var allOptions$2 = options.allOptions; /// enumerate the available styles
21886
21887Graph3d.STYLE = Settings.STYLE;
21888/**
21889 * Following label is used in the settings to describe values which should be
21890 * determined by the code while running, from the current data and graph style.
21891 *
21892 * Using 'undefined' directly achieves the same thing, but this is more
21893 * descriptive by describing the intent.
21894 */
21895
21896var autoByDefault = undefined;
21897/**
21898 * Default values for option settings.
21899 *
21900 * These are the values used when a Graph3d instance is initialized without
21901 * custom settings.
21902 *
21903 * If a field is not in this list, a default value of 'autoByDefault' is assumed,
21904 * which is just an alias for 'undefined'.
21905 */
21906
21907Graph3d.DEFAULTS = {
21908 width: '400px',
21909 height: '400px',
21910 filterLabel: 'time',
21911 legendLabel: 'value',
21912 xLabel: 'x',
21913 yLabel: 'y',
21914 zLabel: 'z',
21915 xValueLabel: function xValueLabel(v) {
21916 return v;
21917 },
21918 yValueLabel: function yValueLabel(v) {
21919 return v;
21920 },
21921 zValueLabel: function zValueLabel(v) {
21922 return v;
21923 },
21924 showXAxis: true,
21925 showYAxis: true,
21926 showZAxis: true,
21927 showGrid: true,
21928 showPerspective: true,
21929 showShadow: false,
21930 keepAspectRatio: true,
21931 rotateAxisLabels: true,
21932 verticalRatio: 0.5,
21933 // 0.1 to 1.0, where 1.0 results in a 'cube'
21934 dotSizeRatio: 0.02,
21935 // size of the dots as a fraction of the graph width
21936 dotSizeMinFraction: 0.5,
21937 // size of min-value dot as a fraction of dotSizeRatio
21938 dotSizeMaxFraction: 2.5,
21939 // size of max-value dot as a fraction of dotSizeRatio
21940 showAnimationControls: autoByDefault,
21941 animationInterval: 1000,
21942 // milliseconds
21943 animationPreload: false,
21944 animationAutoStart: autoByDefault,
21945 axisFontSize: 14,
21946 axisFontType: 'arial',
21947 axisColor: '#4D4D4D',
21948 gridColor: '#D3D3D3',
21949 xCenter: '55%',
21950 yCenter: '50%',
21951 style: Graph3d.STYLE.DOT,
21952 tooltip: false,
21953 tooltipDelay: 300,
21954 // milliseconds
21955 tooltipStyle: {
21956 content: {
21957 padding: '10px',
21958 border: '1px solid #4d4d4d',
21959 color: '#1a1a1a',
21960 background: 'rgba(255,255,255,0.7)',
21961 borderRadius: '2px',
21962 boxShadow: '5px 5px 10px rgba(128,128,128,0.5)'
21963 },
21964 line: {
21965 height: '40px',
21966 width: '0',
21967 borderLeft: '1px solid #4d4d4d',
21968 pointerEvents: 'none'
21969 },
21970 dot: {
21971 height: '0',
21972 width: '0',
21973 border: '5px solid #4d4d4d',
21974 borderRadius: '5px',
21975 pointerEvents: 'none'
21976 }
21977 },
21978 dataColor: {
21979 fill: '#7DC1FF',
21980 stroke: '#3267D2',
21981 strokeWidth: 1 // px
21982
21983 },
21984 cameraPosition: {
21985 horizontal: 1.0,
21986 vertical: 0.5,
21987 distance: 1.7
21988 },
21989 zoomable: true,
21990 ctrlToZoom: false,
21991
21992 /*
21993 The following fields are 'auto by default', see above.
21994 */
21995 showLegend: autoByDefault,
21996 // determined by graph style
21997 backgroundColor: autoByDefault,
21998 xBarWidth: autoByDefault,
21999 yBarWidth: autoByDefault,
22000 valueMin: autoByDefault,
22001 valueMax: autoByDefault,
22002 xMin: autoByDefault,
22003 xMax: autoByDefault,
22004 xStep: autoByDefault,
22005 yMin: autoByDefault,
22006 yMax: autoByDefault,
22007 yStep: autoByDefault,
22008 zMin: autoByDefault,
22009 zMax: autoByDefault,
22010 zStep: autoByDefault
22011}; // -----------------------------------------------------------------------------
22012// Class Graph3d
22013// -----------------------------------------------------------------------------
22014
22015/**
22016 * Graph3d displays data in 3d.
22017 *
22018 * Graph3d is developed in javascript as a Google Visualization Chart.
22019 *
22020 * @constructor Graph3d
22021 * @param {Element} container The DOM element in which the Graph3d will
22022 * be created. Normally a div element.
22023 * @param {DataSet | DataView | Array} [data]
22024 * @param {Object} [options]
22025 */
22026
22027function Graph3d(container, data, options) {
22028 if (!(this instanceof Graph3d)) {
22029 throw new SyntaxError('Constructor must be called with the new operator');
22030 } // create variables and set default values
22031
22032
22033 this.containerElement = container;
22034 this.dataGroup = new DataGroup_1();
22035 this.dataPoints = null; // The table with point objects
22036 // create a frame and canvas
22037
22038 this.create();
22039 Settings.setDefaults(Graph3d.DEFAULTS, this); // the column indexes
22040
22041 this.colX = undefined;
22042 this.colY = undefined;
22043 this.colZ = undefined;
22044 this.colValue = undefined; // TODO: customize axis range
22045 // apply options (also when undefined)
22046
22047 this.setOptions(options); // apply data
22048
22049 this.setData(data);
22050} // Extend Graph3d with an Emitter mixin
22051
22052
22053emitterComponent(Graph3d.prototype);
22054/**
22055 * Calculate the scaling values, dependent on the range in x, y, and z direction
22056 */
22057
22058Graph3d.prototype._setScale = function () {
22059 this.scale = new Point3d_1(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range()); // keep aspect ration between x and y scale if desired
22060
22061 if (this.keepAspectRatio) {
22062 if (this.scale.x < this.scale.y) {
22063 //noinspection JSSuspiciousNameCombination
22064 this.scale.y = this.scale.x;
22065 } else {
22066 //noinspection JSSuspiciousNameCombination
22067 this.scale.x = this.scale.y;
22068 }
22069 } // scale the vertical axis
22070
22071
22072 this.scale.z *= this.verticalRatio; // TODO: can this be automated? verticalRatio?
22073 // determine scale for (optional) value
22074
22075 if (this.valueRange !== undefined) {
22076 this.scale.value = 1 / this.valueRange.range();
22077 } // position the camera arm
22078
22079
22080 var xCenter = this.xRange.center() * this.scale.x;
22081 var yCenter = this.yRange.center() * this.scale.y;
22082 var zCenter = this.zRange.center() * this.scale.z;
22083 this.camera.setArmLocation(xCenter, yCenter, zCenter);
22084};
22085/**
22086 * Convert a 3D location to a 2D location on screen
22087 * Source: ttp://en.wikipedia.org/wiki/3D_projection
22088 *
22089 * @param {Point3d} point3d A 3D point with parameters x, y, z
22090 * @returns {Point2d} point2d A 2D point with parameters x, y
22091 */
22092
22093
22094Graph3d.prototype._convert3Dto2D = function (point3d) {
22095 var translation = this._convertPointToTranslation(point3d);
22096
22097 return this._convertTranslationToScreen(translation);
22098};
22099/**
22100 * Convert a 3D location its translation seen from the camera
22101 * Source: http://en.wikipedia.org/wiki/3D_projection
22102 *
22103 * @param {Point3d} point3d A 3D point with parameters x, y, z
22104 * @returns {Point3d} translation A 3D point with parameters x, y, z This is
22105 * the translation of the point, seen from the
22106 * camera.
22107 */
22108
22109
22110Graph3d.prototype._convertPointToTranslation = function (point3d) {
22111 var cameraLocation = this.camera.getCameraLocation(),
22112 cameraRotation = this.camera.getCameraRotation(),
22113 ax = point3d.x * this.scale.x,
22114 ay = point3d.y * this.scale.y,
22115 az = point3d.z * this.scale.z,
22116 cx = cameraLocation.x,
22117 cy = cameraLocation.y,
22118 cz = cameraLocation.z,
22119 // calculate angles
22120 sinTx = Math.sin(cameraRotation.x),
22121 cosTx = Math.cos(cameraRotation.x),
22122 sinTy = Math.sin(cameraRotation.y),
22123 cosTy = Math.cos(cameraRotation.y),
22124 sinTz = Math.sin(cameraRotation.z),
22125 cosTz = Math.cos(cameraRotation.z),
22126 // calculate translation
22127 dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz),
22128 dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)),
22129 dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx));
22130 return new Point3d_1(dx, dy, dz);
22131};
22132/**
22133 * Convert a translation point to a point on the screen
22134 *
22135 * @param {Point3d} translation A 3D point with parameters x, y, z This is
22136 * the translation of the point, seen from the
22137 * camera.
22138 * @returns {Point2d} point2d A 2D point with parameters x, y
22139 */
22140
22141
22142Graph3d.prototype._convertTranslationToScreen = function (translation) {
22143 var ex = this.eye.x,
22144 ey = this.eye.y,
22145 ez = this.eye.z,
22146 dx = translation.x,
22147 dy = translation.y,
22148 dz = translation.z; // calculate position on screen from translation
22149
22150 var bx;
22151 var by;
22152
22153 if (this.showPerspective) {
22154 bx = (dx - ex) * (ez / dz);
22155 by = (dy - ey) * (ez / dz);
22156 } else {
22157 bx = dx * -(ez / this.camera.getArmLength());
22158 by = dy * -(ez / this.camera.getArmLength());
22159 } // shift and scale the point to the center of the screen
22160 // use the width of the graph to scale both horizontally and vertically.
22161
22162
22163 return new Point2d_1(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth);
22164};
22165/**
22166 * Calculate the translations and screen positions of all points
22167 *
22168 * @param {Array.<Point3d>} points
22169 * @private
22170 */
22171
22172
22173Graph3d.prototype._calcTranslations = function (points) {
22174 for (var i = 0; i < points.length; i++) {
22175 var point = points[i];
22176 point.trans = this._convertPointToTranslation(point.point);
22177 point.screen = this._convertTranslationToScreen(point.trans); // calculate the translation of the point at the bottom (needed for sorting)
22178
22179 var transBottom = this._convertPointToTranslation(point.bottom);
22180
22181 point.dist = this.showPerspective ? transBottom.length() : -transBottom.z;
22182 } // sort the points on depth of their (x,y) position (not on z)
22183
22184
22185 var sortDepth = function sortDepth(a, b) {
22186 return b.dist - a.dist;
22187 };
22188
22189 points.sort(sortDepth);
22190};
22191/**
22192 * Transfer min/max values to the Graph3d instance.
22193 */
22194
22195
22196Graph3d.prototype._initializeRanges = function () {
22197 // TODO: later on, all min/maxes of all datagroups will be combined here
22198 var dg = this.dataGroup;
22199 this.xRange = dg.xRange;
22200 this.yRange = dg.yRange;
22201 this.zRange = dg.zRange;
22202 this.valueRange = dg.valueRange; // Values currently needed but which need to be sorted out for
22203 // the multiple graph case.
22204
22205 this.xStep = dg.xStep;
22206 this.yStep = dg.yStep;
22207 this.zStep = dg.zStep;
22208 this.xBarWidth = dg.xBarWidth;
22209 this.yBarWidth = dg.yBarWidth;
22210 this.colX = dg.colX;
22211 this.colY = dg.colY;
22212 this.colZ = dg.colZ;
22213 this.colValue = dg.colValue; // set the scale dependent on the ranges.
22214
22215 this._setScale();
22216};
22217/**
22218 * Return all data values as a list of Point3d objects
22219 *
22220 * @param {vis.DataSet} data
22221 * @returns {Array.<Object>}
22222 */
22223
22224
22225Graph3d.prototype.getDataPoints = function (data) {
22226 var dataPoints = [];
22227
22228 for (var i = 0; i < data.length; i++) {
22229 var point = new Point3d_1();
22230 point.x = data[i][this.colX] || 0;
22231 point.y = data[i][this.colY] || 0;
22232 point.z = data[i][this.colZ] || 0;
22233 point.data = data[i];
22234
22235 if (this.colValue !== undefined) {
22236 point.value = data[i][this.colValue] || 0;
22237 }
22238
22239 var obj = {};
22240 obj.point = point;
22241 obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
22242 obj.trans = undefined;
22243 obj.screen = undefined;
22244 dataPoints.push(obj);
22245 }
22246
22247 return dataPoints;
22248};
22249/**
22250 * Filter the data based on the current filter
22251 *
22252 * @param {Array} data
22253 * @returns {Array} dataPoints Array with point objects which can be drawn on
22254 * screen
22255 */
22256
22257
22258Graph3d.prototype._getDataPoints = function (data) {
22259 // TODO: store the created matrix dataPoints in the filters instead of
22260 // reloading each time.
22261 var x, y, i, obj;
22262 var dataPoints = [];
22263
22264 if (this.style === Graph3d.STYLE.GRID || this.style === Graph3d.STYLE.SURFACE) {
22265 // copy all values from the data table to a matrix
22266 // the provided values are supposed to form a grid of (x,y) positions
22267 // create two lists with all present x and y values
22268 var dataX = this.dataGroup.getDistinctValues(this.colX, data);
22269 var dataY = this.dataGroup.getDistinctValues(this.colY, data);
22270 dataPoints = this.getDataPoints(data); // create a grid, a 2d matrix, with all values.
22271
22272 var dataMatrix = []; // temporary data matrix
22273
22274 for (i = 0; i < dataPoints.length; i++) {
22275 obj = dataPoints[i]; // TODO: implement Array().indexOf() for Internet Explorer
22276
22277 var xIndex = dataX.indexOf(obj.point.x);
22278 var yIndex = dataY.indexOf(obj.point.y);
22279
22280 if (dataMatrix[xIndex] === undefined) {
22281 dataMatrix[xIndex] = [];
22282 }
22283
22284 dataMatrix[xIndex][yIndex] = obj;
22285 } // fill in the pointers to the neighbors.
22286
22287
22288 for (x = 0; x < dataMatrix.length; x++) {
22289 for (y = 0; y < dataMatrix[x].length; y++) {
22290 if (dataMatrix[x][y]) {
22291 dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
22292 dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
22293 dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
22294 }
22295 }
22296 }
22297 } else {
22298 // 'dot', 'dot-line', etc.
22299 this._checkValueField(data);
22300
22301 dataPoints = this.getDataPoints(data);
22302
22303 if (this.style === Graph3d.STYLE.LINE) {
22304 // Add next member points for line drawing
22305 for (i = 0; i < dataPoints.length; i++) {
22306 if (i > 0) {
22307 dataPoints[i - 1].pointNext = dataPoints[i];
22308 }
22309 }
22310 }
22311 }
22312
22313 return dataPoints;
22314};
22315/**
22316 * Create the main frame for the Graph3d.
22317 *
22318 * This function is executed once when a Graph3d object is created. The frame
22319 * contains a canvas, and this canvas contains all objects like the axis and
22320 * nodes.
22321 */
22322
22323
22324Graph3d.prototype.create = function () {
22325 // remove all elements from the container element.
22326 while (this.containerElement.hasChildNodes()) {
22327 this.containerElement.removeChild(this.containerElement.firstChild);
22328 }
22329
22330 this.frame = document.createElement('div');
22331 this.frame.style.position = 'relative';
22332 this.frame.style.overflow = 'hidden'; // create the graph canvas (HTML canvas element)
22333
22334 this.frame.canvas = document.createElement('canvas');
22335 this.frame.canvas.style.position = 'relative';
22336 this.frame.appendChild(this.frame.canvas); //if (!this.frame.canvas.getContext) {
22337
22338 {
22339 var noCanvas = document.createElement('DIV');
22340 noCanvas.style.color = 'red';
22341 noCanvas.style.fontWeight = 'bold';
22342 noCanvas.style.padding = '10px';
22343 noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
22344 this.frame.canvas.appendChild(noCanvas);
22345 }
22346 this.frame.filter = document.createElement('div');
22347 this.frame.filter.style.position = 'absolute';
22348 this.frame.filter.style.bottom = '0px';
22349 this.frame.filter.style.left = '0px';
22350 this.frame.filter.style.width = '100%';
22351 this.frame.appendChild(this.frame.filter); // add event listeners to handle moving and zooming the contents
22352
22353 var me = this;
22354
22355 var onmousedown = function onmousedown(event) {
22356 me._onMouseDown(event);
22357 };
22358
22359 var ontouchstart = function ontouchstart(event) {
22360 me._onTouchStart(event);
22361 };
22362
22363 var onmousewheel = function onmousewheel(event) {
22364 me._onWheel(event);
22365 };
22366
22367 var ontooltip = function ontooltip(event) {
22368 me._onTooltip(event);
22369 };
22370
22371 var onclick = function onclick(event) {
22372 me._onClick(event);
22373 }; // TODO: these events are never cleaned up... can give a 'memory leakage'
22374
22375
22376 util.addEventListener(this.frame.canvas, 'mousedown', onmousedown);
22377 util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart);
22378 util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel);
22379 util.addEventListener(this.frame.canvas, 'mousemove', ontooltip);
22380 util.addEventListener(this.frame.canvas, 'click', onclick); // add the new graph to the container element
22381
22382 this.containerElement.appendChild(this.frame);
22383};
22384/**
22385 * Set a new size for the graph
22386 *
22387 * @param {number} width
22388 * @param {number} height
22389 * @private
22390 */
22391
22392
22393Graph3d.prototype._setSize = function (width, height) {
22394 this.frame.style.width = width;
22395 this.frame.style.height = height;
22396
22397 this._resizeCanvas();
22398};
22399/**
22400 * Resize the canvas to the current size of the frame
22401 */
22402
22403
22404Graph3d.prototype._resizeCanvas = function () {
22405 this.frame.canvas.style.width = '100%';
22406 this.frame.canvas.style.height = '100%';
22407 this.frame.canvas.width = this.frame.canvas.clientWidth;
22408 this.frame.canvas.height = this.frame.canvas.clientHeight; // adjust with for margin
22409
22410 this.frame.filter.style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px';
22411};
22412/**
22413 * Start playing the animation, if requested and filter present. Only applicable
22414 * when animation data is available.
22415 */
22416
22417
22418Graph3d.prototype.animationStart = function () {
22419 // start animation when option is true
22420 if (!this.animationAutoStart || !this.dataGroup.dataFilter) return;
22421 if (!this.frame.filter || !this.frame.filter.slider) throw new Error('No animation available');
22422 this.frame.filter.slider.play();
22423};
22424/**
22425 * Stop animation
22426 */
22427
22428
22429Graph3d.prototype.animationStop = function () {
22430 if (!this.frame.filter || !this.frame.filter.slider) return;
22431 this.frame.filter.slider.stop();
22432};
22433/**
22434 * Resize the center position based on the current values in this.xCenter
22435 * and this.yCenter (which are strings with a percentage or a value
22436 * in pixels). The center positions are the variables this.currentXCenter
22437 * and this.currentYCenter
22438 */
22439
22440
22441Graph3d.prototype._resizeCenter = function () {
22442 // calculate the horizontal center position
22443 if (this.xCenter.charAt(this.xCenter.length - 1) === '%') {
22444 this.currentXCenter = parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth;
22445 } else {
22446 this.currentXCenter = parseFloat(this.xCenter); // supposed to be in px
22447 } // calculate the vertical center position
22448
22449
22450 if (this.yCenter.charAt(this.yCenter.length - 1) === '%') {
22451 this.currentYCenter = parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - this.frame.filter.clientHeight);
22452 } else {
22453 this.currentYCenter = parseFloat(this.yCenter); // supposed to be in px
22454 }
22455};
22456/**
22457 * Retrieve the current camera rotation
22458 *
22459 * @returns {object} An object with parameters horizontal, vertical, and
22460 * distance
22461 */
22462
22463
22464Graph3d.prototype.getCameraPosition = function () {
22465 var pos = this.camera.getArmRotation();
22466 pos.distance = this.camera.getArmLength();
22467 return pos;
22468};
22469/**
22470 * Load data into the 3D Graph
22471 *
22472 * @param {vis.DataSet} data
22473 * @private
22474 */
22475
22476
22477Graph3d.prototype._readData = function (data) {
22478 // read the data
22479 this.dataPoints = this.dataGroup.initializeData(this, data, this.style);
22480
22481 this._initializeRanges();
22482
22483 this._redrawFilter();
22484};
22485/**
22486 * Replace the dataset of the Graph3d
22487 *
22488 * @param {Array | DataSet | DataView} data
22489 */
22490
22491
22492Graph3d.prototype.setData = function (data) {
22493 if (data === undefined || data === null) return;
22494
22495 this._readData(data);
22496
22497 this.redraw();
22498 this.animationStart();
22499};
22500/**
22501 * Update the options. Options will be merged with current options
22502 *
22503 * @param {Object} options
22504 */
22505
22506
22507Graph3d.prototype.setOptions = function (options) {
22508 if (options === undefined) return;
22509 var errorFound = Validator$2.validate(options, allOptions$2);
22510
22511 if (errorFound === true) {
22512 console.log('%cErrors have been found in the supplied options object.', printStyle$1);
22513 }
22514
22515 this.animationStop();
22516 Settings.setOptions(options, this);
22517 this.setPointDrawingMethod();
22518
22519 this._setSize(this.width, this.height);
22520
22521 this.setAxisLabelMethod();
22522 this.setData(this.dataGroup.getDataTable());
22523 this.animationStart();
22524};
22525/**
22526 * Determine which point drawing method to use for the current graph style.
22527 */
22528
22529
22530Graph3d.prototype.setPointDrawingMethod = function () {
22531 var method = undefined;
22532
22533 switch (this.style) {
22534 case Graph3d.STYLE.BAR:
22535 method = Graph3d.prototype._redrawBarGraphPoint;
22536 break;
22537
22538 case Graph3d.STYLE.BARCOLOR:
22539 method = Graph3d.prototype._redrawBarColorGraphPoint;
22540 break;
22541
22542 case Graph3d.STYLE.BARSIZE:
22543 method = Graph3d.prototype._redrawBarSizeGraphPoint;
22544 break;
22545
22546 case Graph3d.STYLE.DOT:
22547 method = Graph3d.prototype._redrawDotGraphPoint;
22548 break;
22549
22550 case Graph3d.STYLE.DOTLINE:
22551 method = Graph3d.prototype._redrawDotLineGraphPoint;
22552 break;
22553
22554 case Graph3d.STYLE.DOTCOLOR:
22555 method = Graph3d.prototype._redrawDotColorGraphPoint;
22556 break;
22557
22558 case Graph3d.STYLE.DOTSIZE:
22559 method = Graph3d.prototype._redrawDotSizeGraphPoint;
22560 break;
22561
22562 case Graph3d.STYLE.SURFACE:
22563 method = Graph3d.prototype._redrawSurfaceGraphPoint;
22564 break;
22565
22566 case Graph3d.STYLE.GRID:
22567 method = Graph3d.prototype._redrawGridGraphPoint;
22568 break;
22569
22570 case Graph3d.STYLE.LINE:
22571 method = Graph3d.prototype._redrawLineGraphPoint;
22572 break;
22573
22574 default:
22575 throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\'');
22576 }
22577
22578 this._pointDrawingMethod = method;
22579};
22580/**
22581 * Determine which functions to use to draw axis labels.
22582 */
22583
22584
22585Graph3d.prototype.setAxisLabelMethod = function () {
22586 var method_x, method_y, method_z;
22587 method_x = method_y = method_z = undefined;
22588
22589 if (this.rotateAxisLabels == true) {
22590 method_x = Graph3d.prototype.drawAxisLabelXRotate;
22591 method_y = Graph3d.prototype.drawAxisLabelYRotate;
22592 method_z = Graph3d.prototype.drawAxisLabelZRotate;
22593 } else {
22594 method_x = Graph3d.prototype.drawAxisLabelX;
22595 method_y = Graph3d.prototype.drawAxisLabelY;
22596 method_z = Graph3d.prototype.drawAxisLabelZ;
22597 }
22598
22599 this._drawAxisLabelX = method_x;
22600 this._drawAxisLabelY = method_y;
22601 this._drawAxisLabelZ = method_z;
22602};
22603/**
22604 * Redraw the Graph.
22605 */
22606
22607
22608Graph3d.prototype.redraw = function () {
22609 if (this.dataPoints === undefined) {
22610 throw new Error('Graph data not initialized');
22611 }
22612
22613 this._resizeCanvas();
22614
22615 this._resizeCenter();
22616
22617 this._redrawSlider();
22618
22619 this._redrawClear();
22620
22621 this._redrawAxis();
22622
22623 this._redrawDataGraph();
22624
22625 this._redrawInfo();
22626
22627 this._redrawLegend();
22628};
22629/**
22630 * Get drawing context without exposing canvas
22631 *
22632 * @returns {CanvasRenderingContext2D}
22633 * @private
22634 */
22635
22636
22637Graph3d.prototype._getContext = function () {
22638 var canvas = this.frame.canvas;
22639 var ctx = canvas.getContext('2d');
22640 ctx.lineJoin = 'round';
22641 ctx.lineCap = 'round';
22642 return ctx;
22643};
22644/**
22645 * Clear the canvas before redrawing
22646 */
22647
22648
22649Graph3d.prototype._redrawClear = function () {
22650 var canvas = this.frame.canvas;
22651 var ctx = canvas.getContext('2d');
22652 ctx.clearRect(0, 0, canvas.width, canvas.height);
22653};
22654
22655Graph3d.prototype._dotSize = function () {
22656 return this.frame.clientWidth * this.dotSizeRatio;
22657};
22658/**
22659 * Get legend width
22660 *
22661 * @returns {*}
22662 * @private
22663 */
22664
22665
22666Graph3d.prototype._getLegendWidth = function () {
22667 var width;
22668
22669 if (this.style === Graph3d.STYLE.DOTSIZE) {
22670 var dotSize = this._dotSize(); //width = dotSize / 2 + dotSize * 2;
22671
22672
22673 width = dotSize * this.dotSizeMaxFraction;
22674 } else if (this.style === Graph3d.STYLE.BARSIZE) {
22675 width = this.xBarWidth;
22676 } else {
22677 width = 20;
22678 }
22679
22680 return width;
22681};
22682/**
22683 * Redraw the legend based on size, dot color, or surface height
22684 */
22685
22686
22687Graph3d.prototype._redrawLegend = function () {
22688 //Return without drawing anything, if no legend is specified
22689 if (this.showLegend !== true) {
22690 return;
22691 } // Do not draw legend when graph style does not support
22692
22693
22694 if (this.style === Graph3d.STYLE.LINE || this.style === Graph3d.STYLE.BARSIZE //TODO add legend support for BARSIZE
22695 ) {
22696 return;
22697 } // Legend types - size and color. Determine if size legend.
22698
22699
22700 var isSizeLegend = this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTSIZE; // Legend is either tracking z values or style values. This flag if false means use z values.
22701
22702 var isValueLegend = this.style === Graph3d.STYLE.DOTSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.BARCOLOR;
22703 var height = Math.max(this.frame.clientHeight * 0.25, 100);
22704 var top = this.margin;
22705
22706 var width = this._getLegendWidth(); // px - overwritten by size legend
22707
22708
22709 var right = this.frame.clientWidth - this.margin;
22710 var left = right - width;
22711 var bottom = top + height;
22712
22713 var ctx = this._getContext();
22714
22715 ctx.lineWidth = 1;
22716 ctx.font = '14px arial'; // TODO: put in options
22717
22718 if (isSizeLegend === false) {
22719 // draw the color bar
22720 var ymin = 0;
22721 var ymax = height; // Todo: make height customizable
22722
22723 var y;
22724
22725 for (y = ymin; y < ymax; y++) {
22726 var f = (y - ymin) / (ymax - ymin);
22727 var hue = f * 240;
22728
22729 var color = this._hsv2rgb(hue, 1, 1);
22730
22731 ctx.strokeStyle = color;
22732 ctx.beginPath();
22733 ctx.moveTo(left, top + y);
22734 ctx.lineTo(right, top + y);
22735 ctx.stroke();
22736 }
22737
22738 ctx.strokeStyle = this.axisColor;
22739 ctx.strokeRect(left, top, width, height);
22740 } else {
22741 // draw the size legend box
22742 var widthMin;
22743
22744 if (this.style === Graph3d.STYLE.DOTSIZE) {
22745 // Get the proportion to max and min right
22746 widthMin = width * (this.dotSizeMinFraction / this.dotSizeMaxFraction);
22747 } else if (this.style === Graph3d.STYLE.BARSIZE) ;
22748
22749 ctx.strokeStyle = this.axisColor;
22750 ctx.fillStyle = this.dataColor.fill;
22751 ctx.beginPath();
22752 ctx.moveTo(left, top);
22753 ctx.lineTo(right, top);
22754 ctx.lineTo(left + widthMin, bottom);
22755 ctx.lineTo(left, bottom);
22756 ctx.closePath();
22757 ctx.fill();
22758 ctx.stroke();
22759 } // print value text along the legend edge
22760
22761
22762 var gridLineLen = 5; // px
22763
22764 var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min;
22765 var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max;
22766 var step = new StepNumber_1(legendMin, legendMax, (legendMax - legendMin) / 5, true);
22767 step.start(true);
22768 var from;
22769 var to;
22770
22771 while (!step.end()) {
22772 y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height;
22773 from = new Point2d_1(left - gridLineLen, y);
22774 to = new Point2d_1(left, y);
22775
22776 this._line(ctx, from, to);
22777
22778 ctx.textAlign = 'right';
22779 ctx.textBaseline = 'middle';
22780 ctx.fillStyle = this.axisColor;
22781 ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y);
22782 step.next();
22783 }
22784
22785 ctx.textAlign = 'right';
22786 ctx.textBaseline = 'top';
22787 var label = this.legendLabel;
22788 ctx.fillText(label, right, bottom + this.margin);
22789};
22790/**
22791 * Redraw the filter
22792 */
22793
22794
22795Graph3d.prototype._redrawFilter = function () {
22796 var dataFilter = this.dataGroup.dataFilter;
22797 var filter = this.frame.filter;
22798 filter.innerHTML = '';
22799
22800 if (!dataFilter) {
22801 filter.slider = undefined;
22802 return;
22803 }
22804
22805 var options = {
22806 'visible': this.showAnimationControls
22807 };
22808 var slider = new Slider_1(filter, options);
22809 filter.slider = slider; // TODO: css here is not nice here...
22810
22811 filter.style.padding = '10px'; //this.frame.filter.style.backgroundColor = '#EFEFEF';
22812
22813 slider.setValues(dataFilter.values);
22814 slider.setPlayInterval(this.animationInterval); // create an event handler
22815
22816 var me = this;
22817
22818 var onchange = function onchange() {
22819 var dataFilter = me.dataGroup.dataFilter;
22820 var index = slider.getIndex();
22821 dataFilter.selectValue(index);
22822 me.dataPoints = dataFilter._getDataPoints();
22823 me.redraw();
22824 };
22825
22826 slider.setOnChangeCallback(onchange);
22827};
22828/**
22829 * Redraw the slider
22830 */
22831
22832
22833Graph3d.prototype._redrawSlider = function () {
22834 if (this.frame.filter.slider !== undefined) {
22835 this.frame.filter.slider.redraw();
22836 }
22837};
22838/**
22839 * Redraw common information
22840 */
22841
22842
22843Graph3d.prototype._redrawInfo = function () {
22844 var info = this.dataGroup.getInfo();
22845 if (info === undefined) return;
22846
22847 var ctx = this._getContext();
22848
22849 ctx.font = '14px arial'; // TODO: put in options
22850
22851 ctx.lineStyle = 'gray';
22852 ctx.fillStyle = 'gray';
22853 ctx.textAlign = 'left';
22854 ctx.textBaseline = 'top';
22855 var x = this.margin;
22856 var y = this.margin;
22857 ctx.fillText(info, x, y);
22858};
22859/**
22860 * Draw a line between 2d points 'from' and 'to'.
22861 *
22862 * If stroke style specified, set that as well.
22863 *
22864 * @param {CanvasRenderingContext2D} ctx
22865 * @param {vis.Point2d} from
22866 * @param {vis.Point2d} to
22867 * @param {string} [strokeStyle]
22868 * @private
22869 */
22870
22871
22872Graph3d.prototype._line = function (ctx, from, to, strokeStyle) {
22873 if (strokeStyle !== undefined) {
22874 ctx.strokeStyle = strokeStyle;
22875 }
22876
22877 ctx.beginPath();
22878 ctx.moveTo(from.x, from.y);
22879 ctx.lineTo(to.x, to.y);
22880 ctx.stroke();
22881};
22882/**
22883 *
22884 * @param {CanvasRenderingContext2D} ctx
22885 * @param {vis.Point3d} point3d
22886 * @param {string} text
22887 * @param {number} armAngle
22888 * @param {number} [yMargin=0]
22889 */
22890
22891
22892Graph3d.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) {
22893 if (yMargin === undefined) {
22894 yMargin = 0;
22895 }
22896
22897 var point2d = this._convert3Dto2D(point3d);
22898
22899 if (Math.cos(armAngle * 2) > 0) {
22900 ctx.textAlign = 'center';
22901 ctx.textBaseline = 'top';
22902 point2d.y += yMargin;
22903 } else if (Math.sin(armAngle * 2) < 0) {
22904 ctx.textAlign = 'right';
22905 ctx.textBaseline = 'middle';
22906 } else {
22907 ctx.textAlign = 'left';
22908 ctx.textBaseline = 'middle';
22909 }
22910
22911 ctx.fillStyle = this.axisColor;
22912 ctx.fillText(text, point2d.x, point2d.y);
22913};
22914/**
22915 *
22916 * @param {CanvasRenderingContext2D} ctx
22917 * @param {vis.Point3d} point3d
22918 * @param {string} text
22919 * @param {number} armAngle
22920 * @param {number} [yMargin=0]
22921 */
22922
22923
22924Graph3d.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) {
22925 if (yMargin === undefined) {
22926 yMargin = 0;
22927 }
22928
22929 var point2d = this._convert3Dto2D(point3d);
22930
22931 if (Math.cos(armAngle * 2) < 0) {
22932 ctx.textAlign = 'center';
22933 ctx.textBaseline = 'top';
22934 point2d.y += yMargin;
22935 } else if (Math.sin(armAngle * 2) > 0) {
22936 ctx.textAlign = 'right';
22937 ctx.textBaseline = 'middle';
22938 } else {
22939 ctx.textAlign = 'left';
22940 ctx.textBaseline = 'middle';
22941 }
22942
22943 ctx.fillStyle = this.axisColor;
22944 ctx.fillText(text, point2d.x, point2d.y);
22945};
22946/**
22947 *
22948 * @param {CanvasRenderingContext2D} ctx
22949 * @param {vis.Point3d} point3d
22950 * @param {string} text
22951 * @param {number} [offset=0]
22952 */
22953
22954
22955Graph3d.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) {
22956 if (offset === undefined) {
22957 offset = 0;
22958 }
22959
22960 var point2d = this._convert3Dto2D(point3d);
22961
22962 ctx.textAlign = 'right';
22963 ctx.textBaseline = 'middle';
22964 ctx.fillStyle = this.axisColor;
22965 ctx.fillText(text, point2d.x - offset, point2d.y);
22966};
22967/**
22968 *
22969 * @param {CanvasRenderingContext2D} ctx
22970 * @param {vis.Point3d} point3d
22971 * @param {string} text
22972 * @param {number} armAngle
22973 * @param {number} [yMargin=0]
22974 */
22975
22976
22977Graph3d.prototype.drawAxisLabelXRotate = function (ctx, point3d, text, armAngle, yMargin) {
22978 if (yMargin === undefined) {
22979 yMargin = 0;
22980 }
22981
22982 var point2d = this._convert3Dto2D(point3d);
22983
22984 if (Math.cos(armAngle * 2) > 0) {
22985 ctx.save();
22986 ctx.get;
22987 ctx.translate(point2d.x, point2d.y);
22988 ctx.rotate(Math.PI / 2);
22989 ctx.fillText(text, point2d.x / 100, point2d.y / 100);
22990 ctx.textAlign = 'center';
22991 ctx.textBaseline = 'top';
22992 point2d.y += yMargin;
22993 ctx.restore();
22994 } else if (Math.sin(armAngle * 2) < 0) {
22995 ctx.textAlign = 'right';
22996 ctx.textBaseline = 'middle';
22997 ctx.fillStyle = this.axisColor;
22998 ctx.fillText(text, point2d.x, point2d.y);
22999 } else {
23000 ctx.textAlign = 'left';
23001 ctx.textBaseline = 'middle';
23002 ctx.fillStyle = this.axisColor;
23003 ctx.fillText(text, point2d.x, point2d.y);
23004 }
23005};
23006/**
23007 *
23008 * @param {CanvasRenderingContext2D} ctx
23009 * @param {vis.Point3d} point3d
23010 * @param {string} text
23011 * @param {number} armAngle
23012 * @param {number} [yMargin=0]
23013 */
23014
23015
23016Graph3d.prototype.drawAxisLabelYRotate = function (ctx, point3d, text, armAngle, yMargin) {
23017 if (yMargin === undefined) {
23018 yMargin = 0;
23019 }
23020
23021 var point2d = this._convert3Dto2D(point3d);
23022
23023 if (Math.cos(armAngle * 2) < 0 && Math.sin(armAngle * 2) < 0) {
23024 ctx.save();
23025 ctx.get;
23026 ctx.translate(point2d.x, point2d.y);
23027 ctx.rotate(Math.PI / 2 * -1);
23028 ctx.fillText(text, point2d.x / 100, point2d.y / 100);
23029 ctx.textAlign = 'center';
23030 ctx.textBaseline = 'top';
23031 point2d.y += yMargin;
23032 ctx.restore();
23033 } else if (Math.cos(armAngle * 2) < 0) {
23034 ctx.save();
23035 ctx.get;
23036 ctx.translate(point2d.x, point2d.y);
23037 ctx.rotate(Math.PI / 2);
23038 ctx.fillText(text, point2d.x / 100, point2d.y / 100);
23039 ctx.textAlign = 'center';
23040 ctx.textBaseline = 'top';
23041 point2d.y += yMargin;
23042 ctx.restore();
23043 } else if (Math.sin(armAngle * 2) > 0) {
23044 ctx.textAlign = 'right';
23045 ctx.textBaseline = 'middle';
23046 ctx.fillStyle = this.axisColor;
23047 ctx.fillText(text, point2d.x, point2d.y);
23048 } else {
23049 ctx.textAlign = 'left';
23050 ctx.textBaseline = 'middle';
23051 ctx.fillStyle = this.axisColor;
23052 ctx.fillText(text, point2d.x, point2d.y);
23053 }
23054};
23055/**
23056 *
23057 * @param {CanvasRenderingContext2D} ctx
23058 * @param {vis.Point3d} point3d
23059 * @param {string} text
23060 * @param {number} [offset=0]
23061 */
23062
23063
23064Graph3d.prototype.drawAxisLabelZRotate = function (ctx, point3d, text, offset) {
23065 if (offset === undefined) {
23066 offset = 0;
23067 }
23068
23069 var point2d = this._convert3Dto2D(point3d);
23070
23071 ctx.textAlign = 'right';
23072 ctx.textBaseline = 'middle';
23073 ctx.fillStyle = this.axisColor;
23074 ctx.fillText(text, point2d.x - offset, point2d.y);
23075};
23076/**
23077
23078
23079/**
23080 * Draw a line between 2d points 'from' and 'to'.
23081 *
23082 * If stroke style specified, set that as well.
23083 *
23084 * @param {CanvasRenderingContext2D} ctx
23085 * @param {vis.Point2d} from
23086 * @param {vis.Point2d} to
23087 * @param {string} [strokeStyle]
23088 * @private
23089 */
23090
23091
23092Graph3d.prototype._line3d = function (ctx, from, to, strokeStyle) {
23093 var from2d = this._convert3Dto2D(from);
23094
23095 var to2d = this._convert3Dto2D(to);
23096
23097 this._line(ctx, from2d, to2d, strokeStyle);
23098};
23099/**
23100 * Redraw the axis
23101 */
23102
23103
23104Graph3d.prototype._redrawAxis = function () {
23105 var ctx = this._getContext(),
23106 from,
23107 to,
23108 step,
23109 prettyStep,
23110 text,
23111 xText,
23112 yText,
23113 zText,
23114 offset,
23115 xOffset,
23116 yOffset; // TODO: get the actual rendered style of the containerElement
23117 //ctx.font = this.containerElement.style.font;
23118 //ctx.font = 24 / this.camera.getArmLength() + 'px arial';
23119
23120
23121 ctx.font = this.axisFontSize / this.camera.getArmLength() + 'px ' + this.axisFontType; // calculate the length for the short grid lines
23122
23123 var gridLenX = 0.025 / this.scale.x;
23124 var gridLenY = 0.025 / this.scale.y;
23125 var textMargin = 5 / this.camera.getArmLength(); // px
23126
23127 var armAngle = this.camera.getArmRotation().horizontal;
23128 var armVector = new Point2d_1(Math.cos(armAngle), Math.sin(armAngle));
23129 var xRange = this.xRange;
23130 var yRange = this.yRange;
23131 var zRange = this.zRange;
23132 var point3d; // draw x-grid lines
23133
23134 ctx.lineWidth = 1;
23135 prettyStep = this.defaultXStep === undefined;
23136 step = new StepNumber_1(xRange.min, xRange.max, this.xStep, prettyStep);
23137 step.start(true);
23138
23139 while (!step.end()) {
23140 var x = step.getCurrent();
23141
23142 if (this.showGrid) {
23143 from = new Point3d_1(x, yRange.min, zRange.min);
23144 to = new Point3d_1(x, yRange.max, zRange.min);
23145
23146 this._line3d(ctx, from, to, this.gridColor);
23147 } else if (this.showXAxis) {
23148 from = new Point3d_1(x, yRange.min, zRange.min);
23149 to = new Point3d_1(x, yRange.min + gridLenX, zRange.min);
23150
23151 this._line3d(ctx, from, to, this.axisColor);
23152
23153 from = new Point3d_1(x, yRange.max, zRange.min);
23154 to = new Point3d_1(x, yRange.max - gridLenX, zRange.min);
23155
23156 this._line3d(ctx, from, to, this.axisColor);
23157 }
23158
23159 if (this.showXAxis) {
23160 yText = armVector.x > 0 ? yRange.min : yRange.max;
23161 point3d = new Point3d_1(x, yText, zRange.min);
23162 var msg = ' ' + this.xValueLabel(x) + ' ';
23163
23164 this._drawAxisLabelX.call(this, ctx, point3d, msg, armAngle, textMargin);
23165 }
23166
23167 step.next();
23168 } // draw y-grid lines
23169
23170
23171 ctx.lineWidth = 1;
23172 prettyStep = this.defaultYStep === undefined;
23173 step = new StepNumber_1(yRange.min, yRange.max, this.yStep, prettyStep);
23174 step.start(true);
23175
23176 while (!step.end()) {
23177 var y = step.getCurrent();
23178
23179 if (this.showGrid) {
23180 from = new Point3d_1(xRange.min, y, zRange.min);
23181 to = new Point3d_1(xRange.max, y, zRange.min);
23182
23183 this._line3d(ctx, from, to, this.gridColor);
23184 } else if (this.showYAxis) {
23185 from = new Point3d_1(xRange.min, y, zRange.min);
23186 to = new Point3d_1(xRange.min + gridLenY, y, zRange.min);
23187
23188 this._line3d(ctx, from, to, this.axisColor);
23189
23190 from = new Point3d_1(xRange.max, y, zRange.min);
23191 to = new Point3d_1(xRange.max - gridLenY, y, zRange.min);
23192
23193 this._line3d(ctx, from, to, this.axisColor);
23194 }
23195
23196 if (this.showYAxis) {
23197 xText = armVector.y > 0 ? xRange.min : xRange.max;
23198 point3d = new Point3d_1(xText, y, zRange.min);
23199
23200 var _msg = ' ' + this.yValueLabel(y) + ' ';
23201
23202 this._drawAxisLabelY.call(this, ctx, point3d, _msg, armAngle, textMargin);
23203 }
23204
23205 step.next();
23206 } // draw z-grid lines and axis
23207
23208
23209 if (this.showZAxis) {
23210 ctx.lineWidth = 1;
23211 prettyStep = this.defaultZStep === undefined;
23212 step = new StepNumber_1(zRange.min, zRange.max, this.zStep, prettyStep);
23213 step.start(true);
23214 xText = armVector.x > 0 ? xRange.min : xRange.max;
23215 yText = armVector.y < 0 ? yRange.min : yRange.max;
23216
23217 while (!step.end()) {
23218 var z = step.getCurrent(); // TODO: make z-grid lines really 3d?
23219
23220 var from3d = new Point3d_1(xText, yText, z);
23221
23222 var from2d = this._convert3Dto2D(from3d);
23223
23224 to = new Point2d_1(from2d.x - textMargin, from2d.y);
23225
23226 this._line(ctx, from2d, to, this.axisColor);
23227
23228 var _msg2 = this.zValueLabel(z) + ' ';
23229
23230 this._drawAxisLabelZ.call(this, ctx, from3d, _msg2, 5);
23231
23232 step.next();
23233 }
23234
23235 ctx.lineWidth = 1;
23236 from = new Point3d_1(xText, yText, zRange.min);
23237 to = new Point3d_1(xText, yText, zRange.max);
23238
23239 this._line3d(ctx, from, to, this.axisColor);
23240 } // draw x-axis
23241
23242
23243 if (this.showXAxis) {
23244 var xMin2d;
23245 var xMax2d;
23246 ctx.lineWidth = 1; // line at yMin
23247
23248 xMin2d = new Point3d_1(xRange.min, yRange.min, zRange.min);
23249 xMax2d = new Point3d_1(xRange.max, yRange.min, zRange.min);
23250
23251 this._line3d(ctx, xMin2d, xMax2d, this.axisColor); // line at ymax
23252
23253
23254 xMin2d = new Point3d_1(xRange.min, yRange.max, zRange.min);
23255 xMax2d = new Point3d_1(xRange.max, yRange.max, zRange.min);
23256
23257 this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
23258 } // draw y-axis
23259
23260
23261 if (this.showYAxis) {
23262 ctx.lineWidth = 1; // line at xMin
23263
23264 from = new Point3d_1(xRange.min, yRange.min, zRange.min);
23265 to = new Point3d_1(xRange.min, yRange.max, zRange.min);
23266
23267 this._line3d(ctx, from, to, this.axisColor); // line at xMax
23268
23269
23270 from = new Point3d_1(xRange.max, yRange.min, zRange.min);
23271 to = new Point3d_1(xRange.max, yRange.max, zRange.min);
23272
23273 this._line3d(ctx, from, to, this.axisColor);
23274 } // draw x-label
23275
23276
23277 var xLabel = this.xLabel;
23278
23279 if (xLabel.length > 0 && this.showXAxis) {
23280 yOffset = 0.1 / this.scale.y;
23281 xText = (xRange.max + 3 * xRange.min) / 4;
23282 yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset;
23283 text = new Point3d_1(xText, yText, zRange.min);
23284 this.drawAxisLabelX(ctx, text, xLabel, armAngle);
23285 } // draw y-label
23286
23287
23288 var yLabel = this.yLabel;
23289
23290 if (yLabel.length > 0 && this.showYAxis) {
23291 xOffset = 0.1 / this.scale.x;
23292 xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset;
23293 yText = (yRange.max + 3 * yRange.min) / 4;
23294 text = new Point3d_1(xText, yText, zRange.min);
23295 this.drawAxisLabelY(ctx, text, yLabel, armAngle);
23296 } // draw z-label
23297
23298
23299 var zLabel = this.zLabel;
23300
23301 if (zLabel.length > 0 && this.showZAxis) {
23302 offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis?
23303
23304 xText = armVector.x > 0 ? xRange.min : xRange.max;
23305 yText = armVector.y < 0 ? yRange.min : yRange.max;
23306 zText = (zRange.max + 3 * zRange.min) / 4;
23307 text = new Point3d_1(xText, yText, zText);
23308 this.drawAxisLabelZ(ctx, text, zLabel, offset);
23309 }
23310};
23311/**
23312 * Calculate the color based on the given value.
23313 * @param {number} H Hue, a value be between 0 and 360
23314 * @param {number} S Saturation, a value between 0 and 1
23315 * @param {number} V Value, a value between 0 and 1
23316 * @returns {string}
23317 * @private
23318 */
23319
23320
23321Graph3d.prototype._hsv2rgb = function (H, S, V) {
23322 var R, G, B, C, Hi, X;
23323 C = V * S;
23324 Hi = Math.floor(H / 60); // hi = 0,1,2,3,4,5
23325
23326 X = C * (1 - Math.abs(H / 60 % 2 - 1));
23327
23328 switch (Hi) {
23329 case 0:
23330 R = C;
23331 G = X;
23332 B = 0;
23333 break;
23334
23335 case 1:
23336 R = X;
23337 G = C;
23338 B = 0;
23339 break;
23340
23341 case 2:
23342 R = 0;
23343 G = C;
23344 B = X;
23345 break;
23346
23347 case 3:
23348 R = 0;
23349 G = X;
23350 B = C;
23351 break;
23352
23353 case 4:
23354 R = X;
23355 G = 0;
23356 B = C;
23357 break;
23358
23359 case 5:
23360 R = C;
23361 G = 0;
23362 B = X;
23363 break;
23364
23365 default:
23366 R = 0;
23367 G = 0;
23368 B = 0;
23369 break;
23370 }
23371
23372 return 'RGB(' + parseInt(R * 255) + ',' + parseInt(G * 255) + ',' + parseInt(B * 255) + ')';
23373};
23374/**
23375 *
23376 * @param {vis.Point3d} point
23377 * @returns {*}
23378 * @private
23379 */
23380
23381
23382Graph3d.prototype._getStrokeWidth = function (point) {
23383 if (point !== undefined) {
23384 if (this.showPerspective) {
23385 return 1 / -point.trans.z * this.dataColor.strokeWidth;
23386 } else {
23387 return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth;
23388 }
23389 }
23390
23391 return this.dataColor.strokeWidth;
23392}; // -----------------------------------------------------------------------------
23393// Drawing primitives for the graphs
23394// -----------------------------------------------------------------------------
23395
23396/**
23397 * Draw a bar element in the view with the given properties.
23398 *
23399 * @param {CanvasRenderingContext2D} ctx
23400 * @param {Object} point
23401 * @param {number} xWidth
23402 * @param {number} yWidth
23403 * @param {string} color
23404 * @param {string} borderColor
23405 * @private
23406 */
23407
23408
23409Graph3d.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) {
23410 var surface; // calculate all corner points
23411
23412 var me = this;
23413 var point3d = point.point;
23414 var zMin = this.zRange.min;
23415 var top = [{
23416 point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, point3d.z)
23417 }, {
23418 point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, point3d.z)
23419 }, {
23420 point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, point3d.z)
23421 }, {
23422 point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, point3d.z)
23423 }];
23424 var bottom = [{
23425 point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, zMin)
23426 }, {
23427 point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, zMin)
23428 }, {
23429 point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, zMin)
23430 }, {
23431 point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, zMin)
23432 }]; // calculate screen location of the points
23433
23434 top.forEach(function (obj) {
23435 obj.screen = me._convert3Dto2D(obj.point);
23436 });
23437 bottom.forEach(function (obj) {
23438 obj.screen = me._convert3Dto2D(obj.point);
23439 }); // create five sides, calculate both corner points and center points
23440
23441 var surfaces = [{
23442 corners: top,
23443 center: Point3d_1.avg(bottom[0].point, bottom[2].point)
23444 }, {
23445 corners: [top[0], top[1], bottom[1], bottom[0]],
23446 center: Point3d_1.avg(bottom[1].point, bottom[0].point)
23447 }, {
23448 corners: [top[1], top[2], bottom[2], bottom[1]],
23449 center: Point3d_1.avg(bottom[2].point, bottom[1].point)
23450 }, {
23451 corners: [top[2], top[3], bottom[3], bottom[2]],
23452 center: Point3d_1.avg(bottom[3].point, bottom[2].point)
23453 }, {
23454 corners: [top[3], top[0], bottom[0], bottom[3]],
23455 center: Point3d_1.avg(bottom[0].point, bottom[3].point)
23456 }];
23457 point.surfaces = surfaces; // calculate the distance of each of the surface centers to the camera
23458
23459 for (var j = 0; j < surfaces.length; j++) {
23460 surface = surfaces[j];
23461
23462 var transCenter = this._convertPointToTranslation(surface.center);
23463
23464 surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; // TODO: this dept calculation doesn't work 100% of the cases due to perspective,
23465 // but the current solution is fast/simple and works in 99.9% of all cases
23466 // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9})
23467 } // order the surfaces by their (translated) depth
23468
23469
23470 surfaces.sort(function (a, b) {
23471 var diff = b.dist - a.dist;
23472 if (diff) return diff; // if equal depth, sort the top surface last
23473
23474 if (a.corners === top) return 1;
23475 if (b.corners === top) return -1; // both are equal
23476
23477 return 0;
23478 }); // draw the ordered surfaces
23479
23480 ctx.lineWidth = this._getStrokeWidth(point);
23481 ctx.strokeStyle = borderColor;
23482 ctx.fillStyle = color; // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside
23483
23484 for (var _j = 2; _j < surfaces.length; _j++) {
23485 surface = surfaces[_j];
23486
23487 this._polygon(ctx, surface.corners);
23488 }
23489};
23490/**
23491 * Draw a polygon using the passed points and fill it with the passed style and stroke.
23492 *
23493 * @param {CanvasRenderingContext2D} ctx
23494 * @param {Array.<vis.Point3d>} points an array of points.
23495 * @param {string} [fillStyle] the fill style to set
23496 * @param {string} [strokeStyle] the stroke style to set
23497 */
23498
23499
23500Graph3d.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) {
23501 if (points.length < 2) {
23502 return;
23503 }
23504
23505 if (fillStyle !== undefined) {
23506 ctx.fillStyle = fillStyle;
23507 }
23508
23509 if (strokeStyle !== undefined) {
23510 ctx.strokeStyle = strokeStyle;
23511 }
23512
23513 ctx.beginPath();
23514 ctx.moveTo(points[0].screen.x, points[0].screen.y);
23515
23516 for (var i = 1; i < points.length; ++i) {
23517 var point = points[i];
23518 ctx.lineTo(point.screen.x, point.screen.y);
23519 }
23520
23521 ctx.closePath();
23522 ctx.fill();
23523 ctx.stroke(); // TODO: only draw stroke when strokeWidth > 0
23524};
23525/**
23526 * @param {CanvasRenderingContext2D} ctx
23527 * @param {object} point
23528 * @param {string} color
23529 * @param {string} borderColor
23530 * @param {number} [size=this._dotSize()]
23531 * @private
23532 */
23533
23534
23535Graph3d.prototype._drawCircle = function (ctx, point, color, borderColor, size) {
23536 var radius = this._calcRadius(point, size);
23537
23538 ctx.lineWidth = this._getStrokeWidth(point);
23539 ctx.strokeStyle = borderColor;
23540 ctx.fillStyle = color;
23541 ctx.beginPath();
23542 ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true);
23543 ctx.fill();
23544 ctx.stroke();
23545};
23546/**
23547 * Determine the colors for the 'regular' graph styles.
23548 *
23549 * @param {object} point
23550 * @returns {{fill, border}}
23551 * @private
23552 */
23553
23554
23555Graph3d.prototype._getColorsRegular = function (point) {
23556 // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
23557 var hue = (1 - (point.point.z - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
23558
23559 var color = this._hsv2rgb(hue, 1, 1);
23560
23561 var borderColor = this._hsv2rgb(hue, 1, 0.8);
23562
23563 return {
23564 fill: color,
23565 border: borderColor
23566 };
23567};
23568/**
23569 * Get the colors for the 'color' graph styles.
23570 * These styles are currently: 'bar-color' and 'dot-color'
23571 * Color may be set as a string representation of HTML color, like #ff00ff,
23572 * or calculated from a number, for example, distance from this point
23573 * The first option is useful when we have some pre-given legend, to which we have to adjust ourselves
23574 * The second option is useful when we are interested in automatically setting the color, from some value,
23575 * using some color scale
23576 * @param {object} point
23577 * @returns {{fill: *, border: *}}
23578 * @private
23579 */
23580
23581
23582Graph3d.prototype._getColorsColor = function (point) {
23583 // calculate the color based on the value
23584 var color, borderColor, pointStyle;
23585
23586 if (point && point.point && point.point.data && point.point.data.style) {
23587 pointStyle = point.point.data.style;
23588 }
23589
23590 if (pointStyle && _typeof(pointStyle) === 'object' && pointStyle.fill && pointStyle.stroke) {
23591 return {
23592 fill: pointStyle.fill,
23593 border: pointStyle.stroke
23594 };
23595 }
23596
23597 if (typeof point.point.value === "string") {
23598 color = point.point.value;
23599 borderColor = point.point.value;
23600 } else {
23601 var hue = (1 - (point.point.value - this.valueRange.min) * this.scale.value) * 240;
23602 color = this._hsv2rgb(hue, 1, 1);
23603 borderColor = this._hsv2rgb(hue, 1, 0.8);
23604 }
23605
23606 return {
23607 fill: color,
23608 border: borderColor
23609 };
23610};
23611/**
23612 * Get the colors for the 'size' graph styles.
23613 * These styles are currently: 'bar-size' and 'dot-size'
23614 *
23615 * @returns {{fill: *, border: (string|colorOptions.stroke|{string, undefined}|string|colorOptions.stroke|{string}|*)}}
23616 * @private
23617 */
23618
23619
23620Graph3d.prototype._getColorsSize = function () {
23621 return {
23622 fill: this.dataColor.fill,
23623 border: this.dataColor.stroke
23624 };
23625};
23626/**
23627 * Determine the size of a point on-screen, as determined by the
23628 * distance to the camera.
23629 *
23630 * @param {Object} point
23631 * @param {number} [size=this._dotSize()] the size that needs to be translated to screen coordinates.
23632 * optional; if not passed, use the default point size.
23633 * @returns {number}
23634 * @private
23635 */
23636
23637
23638Graph3d.prototype._calcRadius = function (point, size) {
23639 if (size === undefined) {
23640 size = this._dotSize();
23641 }
23642
23643 var radius;
23644
23645 if (this.showPerspective) {
23646 radius = size / -point.trans.z;
23647 } else {
23648 radius = size * -(this.eye.z / this.camera.getArmLength());
23649 }
23650
23651 if (radius < 0) {
23652 radius = 0;
23653 }
23654
23655 return radius;
23656}; // -----------------------------------------------------------------------------
23657// Methods for drawing points per graph style.
23658// -----------------------------------------------------------------------------
23659
23660/**
23661 * Draw single datapoint for graph style 'bar'.
23662 *
23663 * @param {CanvasRenderingContext2D} ctx
23664 * @param {Object} point
23665 * @private
23666 */
23667
23668
23669Graph3d.prototype._redrawBarGraphPoint = function (ctx, point) {
23670 var xWidth = this.xBarWidth / 2;
23671 var yWidth = this.yBarWidth / 2;
23672
23673 var colors = this._getColorsRegular(point);
23674
23675 this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
23676};
23677/**
23678 * Draw single datapoint for graph style 'bar-color'.
23679 *
23680 * @param {CanvasRenderingContext2D} ctx
23681 * @param {Object} point
23682 * @private
23683 */
23684
23685
23686Graph3d.prototype._redrawBarColorGraphPoint = function (ctx, point) {
23687 var xWidth = this.xBarWidth / 2;
23688 var yWidth = this.yBarWidth / 2;
23689
23690 var colors = this._getColorsColor(point);
23691
23692 this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
23693};
23694/**
23695 * Draw single datapoint for graph style 'bar-size'.
23696 *
23697 * @param {CanvasRenderingContext2D} ctx
23698 * @param {Object} point
23699 * @private
23700 */
23701
23702
23703Graph3d.prototype._redrawBarSizeGraphPoint = function (ctx, point) {
23704 // calculate size for the bar
23705 var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
23706 var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2);
23707 var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2);
23708
23709 var colors = this._getColorsSize();
23710
23711 this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
23712};
23713/**
23714 * Draw single datapoint for graph style 'dot'.
23715 *
23716 * @param {CanvasRenderingContext2D} ctx
23717 * @param {Object} point
23718 * @private
23719 */
23720
23721
23722Graph3d.prototype._redrawDotGraphPoint = function (ctx, point) {
23723 var colors = this._getColorsRegular(point);
23724
23725 this._drawCircle(ctx, point, colors.fill, colors.border);
23726};
23727/**
23728 * Draw single datapoint for graph style 'dot-line'.
23729 *
23730 * @param {CanvasRenderingContext2D} ctx
23731 * @param {Object} point
23732 * @private
23733 */
23734
23735
23736Graph3d.prototype._redrawDotLineGraphPoint = function (ctx, point) {
23737 // draw a vertical line from the XY-plane to the graph value
23738 var from = this._convert3Dto2D(point.bottom);
23739
23740 ctx.lineWidth = 1;
23741
23742 this._line(ctx, from, point.screen, this.gridColor);
23743
23744 this._redrawDotGraphPoint(ctx, point);
23745};
23746/**
23747 * Draw single datapoint for graph style 'dot-color'.
23748 *
23749 * @param {CanvasRenderingContext2D} ctx
23750 * @param {Object} point
23751 * @private
23752 */
23753
23754
23755Graph3d.prototype._redrawDotColorGraphPoint = function (ctx, point) {
23756 var colors = this._getColorsColor(point);
23757
23758 this._drawCircle(ctx, point, colors.fill, colors.border);
23759};
23760/**
23761 * Draw single datapoint for graph style 'dot-size'.
23762 *
23763 * @param {CanvasRenderingContext2D} ctx
23764 * @param {Object} point
23765 * @private
23766 */
23767
23768
23769Graph3d.prototype._redrawDotSizeGraphPoint = function (ctx, point) {
23770 var dotSize = this._dotSize();
23771
23772 var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
23773 var sizeMin = dotSize * this.dotSizeMinFraction;
23774 var sizeRange = dotSize * this.dotSizeMaxFraction - sizeMin;
23775 var size = sizeMin + sizeRange * fraction;
23776
23777 var colors = this._getColorsSize();
23778
23779 this._drawCircle(ctx, point, colors.fill, colors.border, size);
23780};
23781/**
23782 * Draw single datapoint for graph style 'surface'.
23783 *
23784 * @param {CanvasRenderingContext2D} ctx
23785 * @param {Object} point
23786 * @private
23787 */
23788
23789
23790Graph3d.prototype._redrawSurfaceGraphPoint = function (ctx, point) {
23791 var right = point.pointRight;
23792 var top = point.pointTop;
23793 var cross = point.pointCross;
23794
23795 if (point === undefined || right === undefined || top === undefined || cross === undefined) {
23796 return;
23797 }
23798
23799 var topSideVisible = true;
23800 var fillStyle;
23801 var strokeStyle;
23802
23803 if (this.showGrayBottom || this.showShadow) {
23804 // calculate the cross product of the two vectors from center
23805 // to left and right, in order to know whether we are looking at the
23806 // bottom or at the top side. We can also use the cross product
23807 // for calculating light intensity
23808 var aDiff = Point3d_1.subtract(cross.trans, point.trans);
23809 var bDiff = Point3d_1.subtract(top.trans, right.trans);
23810 var crossproduct = Point3d_1.crossProduct(aDiff, bDiff);
23811 var len = crossproduct.length(); // FIXME: there is a bug with determining the surface side (shadow or colored)
23812
23813 topSideVisible = crossproduct.z > 0;
23814 }
23815
23816 if (topSideVisible) {
23817 // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
23818 var zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4;
23819 var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
23820 var s = 1; // saturation
23821
23822 var v;
23823
23824 if (this.showShadow) {
23825 v = Math.min(1 + crossproduct.x / len / 2, 1); // value. TODO: scale
23826
23827 fillStyle = this._hsv2rgb(h, s, v);
23828 strokeStyle = fillStyle;
23829 } else {
23830 v = 1;
23831 fillStyle = this._hsv2rgb(h, s, v);
23832 strokeStyle = this.axisColor; // TODO: should be customizable
23833 }
23834 } else {
23835 fillStyle = 'gray';
23836 strokeStyle = this.axisColor;
23837 }
23838
23839 ctx.lineWidth = this._getStrokeWidth(point); // TODO: only draw stroke when strokeWidth > 0
23840
23841 var points = [point, right, cross, top];
23842
23843 this._polygon(ctx, points, fillStyle, strokeStyle);
23844};
23845/**
23846 * Helper method for _redrawGridGraphPoint()
23847 *
23848 * @param {CanvasRenderingContext2D} ctx
23849 * @param {Object} from
23850 * @param {Object} to
23851 * @private
23852 */
23853
23854
23855Graph3d.prototype._drawGridLine = function (ctx, from, to) {
23856 if (from === undefined || to === undefined) {
23857 return;
23858 } // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
23859
23860
23861 var zAvg = (from.point.z + to.point.z) / 2;
23862 var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
23863 ctx.lineWidth = this._getStrokeWidth(from) * 2;
23864 ctx.strokeStyle = this._hsv2rgb(h, 1, 1);
23865
23866 this._line(ctx, from.screen, to.screen);
23867};
23868/**
23869 * Draw single datapoint for graph style 'Grid'.
23870 *
23871 * @param {CanvasRenderingContext2D} ctx
23872 * @param {Object} point
23873 * @private
23874 */
23875
23876
23877Graph3d.prototype._redrawGridGraphPoint = function (ctx, point) {
23878 this._drawGridLine(ctx, point, point.pointRight);
23879
23880 this._drawGridLine(ctx, point, point.pointTop);
23881};
23882/**
23883 * Draw single datapoint for graph style 'line'.
23884 *
23885 * @param {CanvasRenderingContext2D} ctx
23886 * @param {Object} point
23887 * @private
23888 */
23889
23890
23891Graph3d.prototype._redrawLineGraphPoint = function (ctx, point) {
23892 if (point.pointNext === undefined) {
23893 return;
23894 }
23895
23896 ctx.lineWidth = this._getStrokeWidth(point);
23897 ctx.strokeStyle = this.dataColor.stroke;
23898
23899 this._line(ctx, point.screen, point.pointNext.screen);
23900};
23901/**
23902 * Draw all datapoints for currently selected graph style.
23903 *
23904 */
23905
23906
23907Graph3d.prototype._redrawDataGraph = function () {
23908 var ctx = this._getContext();
23909
23910 var i;
23911 if (this.dataPoints === undefined || this.dataPoints.length <= 0) return; // TODO: throw exception?
23912
23913 this._calcTranslations(this.dataPoints);
23914
23915 for (i = 0; i < this.dataPoints.length; i++) {
23916 var point = this.dataPoints[i]; // Using call() ensures that the correct context is used
23917
23918 this._pointDrawingMethod.call(this, ctx, point);
23919 }
23920}; // -----------------------------------------------------------------------------
23921// End methods for drawing points per graph style.
23922// -----------------------------------------------------------------------------
23923
23924/**
23925 * Store startX, startY and startOffset for mouse operations
23926 *
23927 * @param {Event} event The event that occurred
23928 */
23929
23930
23931Graph3d.prototype._storeMousePosition = function (event) {
23932 // get mouse position (different code for IE and all other browsers)
23933 this.startMouseX = getMouseX(event);
23934 this.startMouseY = getMouseY(event);
23935 this._startCameraOffset = this.camera.getOffset();
23936};
23937/**
23938 * Start a moving operation inside the provided parent element
23939 * @param {Event} event The event that occurred (required for
23940 * retrieving the mouse position)
23941 */
23942
23943
23944Graph3d.prototype._onMouseDown = function (event) {
23945 event = event || window.event; // check if mouse is still down (may be up when focus is lost for example
23946 // in an iframe)
23947
23948 if (this.leftButtonDown) {
23949 this._onMouseUp(event);
23950 } // only react on left mouse button down
23951
23952
23953 this.leftButtonDown = event.which ? event.which === 1 : event.button === 1;
23954 if (!this.leftButtonDown && !this.touchDown) return;
23955
23956 this._storeMousePosition(event);
23957
23958 this.startStart = new Date(this.start);
23959 this.startEnd = new Date(this.end);
23960 this.startArmRotation = this.camera.getArmRotation();
23961 this.frame.style.cursor = 'move'; // add event listeners to handle moving the contents
23962 // we store the function onmousemove and onmouseup in the graph, so we can
23963 // remove the eventlisteners lateron in the function mouseUp()
23964
23965 var me = this;
23966
23967 this.onmousemove = function (event) {
23968 me._onMouseMove(event);
23969 };
23970
23971 this.onmouseup = function (event) {
23972 me._onMouseUp(event);
23973 };
23974
23975 util.addEventListener(document, 'mousemove', me.onmousemove);
23976 util.addEventListener(document, 'mouseup', me.onmouseup);
23977 util.preventDefault(event);
23978};
23979/**
23980 * Perform moving operating.
23981 * This function activated from within the funcion Graph.mouseDown().
23982 * @param {Event} event Well, eehh, the event
23983 */
23984
23985
23986Graph3d.prototype._onMouseMove = function (event) {
23987 this.moving = true;
23988 event = event || window.event; // calculate change in mouse position
23989
23990 var diffX = parseFloat(getMouseX(event)) - this.startMouseX;
23991 var diffY = parseFloat(getMouseY(event)) - this.startMouseY; // move with ctrl or rotate by other
23992
23993 if (event && event.ctrlKey === true) {
23994 // calculate change in mouse position
23995 var scaleX = this.frame.clientWidth * 0.5;
23996 var scaleY = this.frame.clientHeight * 0.5;
23997 var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8;
23998 var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8;
23999 this.camera.setOffset(offXNew, offYNew);
24000
24001 this._storeMousePosition(event);
24002 } else {
24003 var horizontalNew = this.startArmRotation.horizontal + diffX / 200;
24004 var verticalNew = this.startArmRotation.vertical + diffY / 200;
24005 var snapAngle = 4; // degrees
24006
24007 var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc...
24008 // the -0.001 is to take care that the vertical axis is always drawn at the left front corner
24009
24010 if (Math.abs(Math.sin(horizontalNew)) < snapValue) {
24011 horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001;
24012 }
24013
24014 if (Math.abs(Math.cos(horizontalNew)) < snapValue) {
24015 horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001;
24016 } // snap vertically to nice angles
24017
24018
24019 if (Math.abs(Math.sin(verticalNew)) < snapValue) {
24020 verticalNew = Math.round(verticalNew / Math.PI) * Math.PI;
24021 }
24022
24023 if (Math.abs(Math.cos(verticalNew)) < snapValue) {
24024 verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI;
24025 }
24026
24027 this.camera.setArmRotation(horizontalNew, verticalNew);
24028 }
24029
24030 this.redraw(); // fire a cameraPositionChange event
24031
24032 var parameters = this.getCameraPosition();
24033 this.emit('cameraPositionChange', parameters);
24034 util.preventDefault(event);
24035};
24036/**
24037 * Stop moving operating.
24038 * This function activated from within the funcion Graph.mouseDown().
24039 * @param {Event} event The event
24040 */
24041
24042
24043Graph3d.prototype._onMouseUp = function (event) {
24044 this.frame.style.cursor = 'auto';
24045 this.leftButtonDown = false; // remove event listeners here
24046
24047 util.removeEventListener(document, 'mousemove', this.onmousemove);
24048 util.removeEventListener(document, 'mouseup', this.onmouseup);
24049 util.preventDefault(event);
24050};
24051/**
24052 * @param {Event} event The event
24053 */
24054
24055
24056Graph3d.prototype._onClick = function (event) {
24057 if (!this.onclick_callback) return;
24058
24059 if (!this.moving) {
24060 var boundingRect = this.frame.getBoundingClientRect();
24061 var mouseX = getMouseX(event) - boundingRect.left;
24062 var mouseY = getMouseY(event) - boundingRect.top;
24063
24064 var dataPoint = this._dataPointFromXY(mouseX, mouseY);
24065
24066 if (dataPoint) this.onclick_callback(dataPoint.point.data);
24067 } else {
24068 // disable onclick callback, if it came immediately after rotate/pan
24069 this.moving = false;
24070 }
24071
24072 util.preventDefault(event);
24073};
24074/**
24075 * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point
24076 * @param {Event} event A mouse move event
24077 */
24078
24079
24080Graph3d.prototype._onTooltip = function (event) {
24081 var delay = this.tooltipDelay; // ms
24082
24083 var boundingRect = this.frame.getBoundingClientRect();
24084 var mouseX = getMouseX(event) - boundingRect.left;
24085 var mouseY = getMouseY(event) - boundingRect.top;
24086
24087 if (!this.showTooltip) {
24088 return;
24089 }
24090
24091 if (this.tooltipTimeout) {
24092 clearTimeout(this.tooltipTimeout);
24093 } // (delayed) display of a tooltip only if no mouse button is down
24094
24095
24096 if (this.leftButtonDown) {
24097 this._hideTooltip();
24098
24099 return;
24100 }
24101
24102 if (this.tooltip && this.tooltip.dataPoint) {
24103 // tooltip is currently visible
24104 var dataPoint = this._dataPointFromXY(mouseX, mouseY);
24105
24106 if (dataPoint !== this.tooltip.dataPoint) {
24107 // datapoint changed
24108 if (dataPoint) {
24109 this._showTooltip(dataPoint);
24110 } else {
24111 this._hideTooltip();
24112 }
24113 }
24114 } else {
24115 // tooltip is currently not visible
24116 var me = this;
24117 this.tooltipTimeout = setTimeout(function () {
24118 me.tooltipTimeout = null; // show a tooltip if we have a data point
24119
24120 var dataPoint = me._dataPointFromXY(mouseX, mouseY);
24121
24122 if (dataPoint) {
24123 me._showTooltip(dataPoint);
24124 }
24125 }, delay);
24126 }
24127};
24128/**
24129 * Event handler for touchstart event on mobile devices
24130 * @param {Event} event The event
24131 */
24132
24133
24134Graph3d.prototype._onTouchStart = function (event) {
24135 this.touchDown = true;
24136 var me = this;
24137
24138 this.ontouchmove = function (event) {
24139 me._onTouchMove(event);
24140 };
24141
24142 this.ontouchend = function (event) {
24143 me._onTouchEnd(event);
24144 };
24145
24146 util.addEventListener(document, 'touchmove', me.ontouchmove);
24147 util.addEventListener(document, 'touchend', me.ontouchend);
24148
24149 this._onMouseDown(event);
24150};
24151/**
24152 * Event handler for touchmove event on mobile devices
24153 * @param {Event} event The event
24154 */
24155
24156
24157Graph3d.prototype._onTouchMove = function (event) {
24158 this._onMouseMove(event);
24159};
24160/**
24161 * Event handler for touchend event on mobile devices
24162 * @param {Event} event The event
24163 */
24164
24165
24166Graph3d.prototype._onTouchEnd = function (event) {
24167 this.touchDown = false;
24168 util.removeEventListener(document, 'touchmove', this.ontouchmove);
24169 util.removeEventListener(document, 'touchend', this.ontouchend);
24170
24171 this._onMouseUp(event);
24172};
24173/**
24174 * Event handler for mouse wheel event, used to zoom the graph
24175 * Code from http://adomas.org/javascript-mouse-wheel/
24176 * @param {Event} event The event
24177 */
24178
24179
24180Graph3d.prototype._onWheel = function (event) {
24181 if (!event)
24182 /* For IE. */
24183 event = window.event;
24184
24185 if (this.zoomable && (!this.ctrlToZoom || event.ctrlKey)) {
24186 // retrieve delta
24187 var delta = 0;
24188
24189 if (event.wheelDelta) {
24190 /* IE/Opera. */
24191 delta = event.wheelDelta / 120;
24192 } else if (event.detail) {
24193 /* Mozilla case. */
24194 // In Mozilla, sign of delta is different than in IE.
24195 // Also, delta is multiple of 3.
24196 delta = -event.detail / 3;
24197 } // If delta is nonzero, handle it.
24198 // Basically, delta is now positive if wheel was scrolled up,
24199 // and negative, if wheel was scrolled down.
24200
24201
24202 if (delta) {
24203 var oldLength = this.camera.getArmLength();
24204 var newLength = oldLength * (1 - delta / 10);
24205 this.camera.setArmLength(newLength);
24206 this.redraw();
24207
24208 this._hideTooltip();
24209 } // fire a cameraPositionChange event
24210
24211
24212 var parameters = this.getCameraPosition();
24213 this.emit('cameraPositionChange', parameters); // Prevent default actions caused by mouse wheel.
24214 // That might be ugly, but we handle scrolls somehow
24215 // anyway, so don't bother here..
24216
24217 util.preventDefault(event);
24218 }
24219};
24220/**
24221 * Test whether a point lies inside given 2D triangle
24222 *
24223 * @param {vis.Point2d} point
24224 * @param {vis.Point2d[]} triangle
24225 * @returns {boolean} true if given point lies inside or on the edge of the
24226 * triangle, false otherwise
24227 * @private
24228 */
24229
24230
24231Graph3d.prototype._insideTriangle = function (point, triangle) {
24232 var a = triangle[0],
24233 b = triangle[1],
24234 c = triangle[2];
24235 /**
24236 *
24237 * @param {number} x
24238 * @returns {number}
24239 */
24240
24241 function sign(x) {
24242 return x > 0 ? 1 : x < 0 ? -1 : 0;
24243 }
24244
24245 var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x));
24246 var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x));
24247 var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); // each of the three signs must be either equal to each other or zero
24248
24249 return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs);
24250};
24251/**
24252 * Find a data point close to given screen position (x, y)
24253 *
24254 * @param {number} x
24255 * @param {number} y
24256 * @returns {Object | null} The closest data point or null if not close to any
24257 * data point
24258 * @private
24259 */
24260
24261
24262Graph3d.prototype._dataPointFromXY = function (x, y) {
24263 var i,
24264 distMax = 100,
24265 // px
24266 dataPoint = null,
24267 closestDataPoint = null,
24268 closestDist = null,
24269 center = new Point2d_1(x, y);
24270
24271 if (this.style === Graph3d.STYLE.BAR || this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE) {
24272 // the data points are ordered from far away to closest
24273 for (i = this.dataPoints.length - 1; i >= 0; i--) {
24274 dataPoint = this.dataPoints[i];
24275 var surfaces = dataPoint.surfaces;
24276
24277 if (surfaces) {
24278 for (var s = surfaces.length - 1; s >= 0; s--) {
24279 // split each surface in two triangles, and see if the center point is inside one of these
24280 var surface = surfaces[s];
24281 var corners = surface.corners;
24282 var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen];
24283 var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen];
24284
24285 if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) {
24286 // return immediately at the first hit
24287 return dataPoint;
24288 }
24289 }
24290 }
24291 }
24292 } else {
24293 // find the closest data point, using distance to the center of the point on 2d screen
24294 for (i = 0; i < this.dataPoints.length; i++) {
24295 dataPoint = this.dataPoints[i];
24296 var point = dataPoint.screen;
24297
24298 if (point) {
24299 var distX = Math.abs(x - point.x);
24300 var distY = Math.abs(y - point.y);
24301 var dist = Math.sqrt(distX * distX + distY * distY);
24302
24303 if ((closestDist === null || dist < closestDist) && dist < distMax) {
24304 closestDist = dist;
24305 closestDataPoint = dataPoint;
24306 }
24307 }
24308 }
24309 }
24310
24311 return closestDataPoint;
24312};
24313/**
24314 * Determine if the given style has bars
24315 *
24316 * @param {number} style the style to check
24317 * @returns {boolean} true if bar style, false otherwise
24318 */
24319
24320
24321Graph3d.prototype.hasBars = function (style) {
24322 return style == Graph3d.STYLE.BAR || style == Graph3d.STYLE.BARCOLOR || style == Graph3d.STYLE.BARSIZE;
24323};
24324/**
24325 * Display a tooltip for given data point
24326 * @param {Object} dataPoint
24327 * @private
24328 */
24329
24330
24331Graph3d.prototype._showTooltip = function (dataPoint) {
24332 var content, line, dot;
24333
24334 if (!this.tooltip) {
24335 content = document.createElement('div');
24336 Object.assign(content.style, {}, this.tooltipStyle.content);
24337 content.style.position = 'absolute';
24338 line = document.createElement('div');
24339 Object.assign(line.style, {}, this.tooltipStyle.line);
24340 line.style.position = 'absolute';
24341 dot = document.createElement('div');
24342 Object.assign(dot.style, {}, this.tooltipStyle.dot);
24343 dot.style.position = 'absolute';
24344 this.tooltip = {
24345 dataPoint: null,
24346 dom: {
24347 content: content,
24348 line: line,
24349 dot: dot
24350 }
24351 };
24352 } else {
24353 content = this.tooltip.dom.content;
24354 line = this.tooltip.dom.line;
24355 dot = this.tooltip.dom.dot;
24356 }
24357
24358 this._hideTooltip();
24359
24360 this.tooltip.dataPoint = dataPoint;
24361
24362 if (typeof this.showTooltip === 'function') {
24363 content.innerHTML = this.showTooltip(dataPoint.point);
24364 } else {
24365 content.innerHTML = '<table>' + '<tr><td>' + this.xLabel + ':</td><td>' + dataPoint.point.x + '</td></tr>' + '<tr><td>' + this.yLabel + ':</td><td>' + dataPoint.point.y + '</td></tr>' + '<tr><td>' + this.zLabel + ':</td><td>' + dataPoint.point.z + '</td></tr>' + '</table>';
24366 }
24367
24368 content.style.left = '0';
24369 content.style.top = '0';
24370 this.frame.appendChild(content);
24371 this.frame.appendChild(line);
24372 this.frame.appendChild(dot); // calculate sizes
24373
24374 var contentWidth = content.offsetWidth;
24375 var contentHeight = content.offsetHeight;
24376 var lineHeight = line.offsetHeight;
24377 var dotWidth = dot.offsetWidth;
24378 var dotHeight = dot.offsetHeight;
24379 var left = dataPoint.screen.x - contentWidth / 2;
24380 left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth);
24381 line.style.left = dataPoint.screen.x + 'px';
24382 line.style.top = dataPoint.screen.y - lineHeight + 'px';
24383 content.style.left = left + 'px';
24384 content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px';
24385 dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px';
24386 dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px';
24387};
24388/**
24389 * Hide the tooltip when displayed
24390 * @private
24391 */
24392
24393
24394Graph3d.prototype._hideTooltip = function () {
24395 if (this.tooltip) {
24396 this.tooltip.dataPoint = null;
24397
24398 for (var prop in this.tooltip.dom) {
24399 if (this.tooltip.dom.hasOwnProperty(prop)) {
24400 var elem = this.tooltip.dom[prop];
24401
24402 if (elem && elem.parentNode) {
24403 elem.parentNode.removeChild(elem);
24404 }
24405 }
24406 }
24407 }
24408};
24409/**--------------------------------------------------------------------------**/
24410
24411/**
24412 * Get the horizontal mouse position from a mouse event
24413 *
24414 * @param {Event} event
24415 * @returns {number} mouse x
24416 */
24417
24418
24419function getMouseX(event) {
24420 if ('clientX' in event) return event.clientX;
24421 return event.targetTouches[0] && event.targetTouches[0].clientX || 0;
24422}
24423/**
24424 * Get the vertical mouse position from a mouse event
24425 *
24426 * @param {Event} event
24427 * @returns {number} mouse y
24428 */
24429
24430
24431function getMouseY(event) {
24432 if ('clientY' in event) return event.clientY;
24433 return event.targetTouches[0] && event.targetTouches[0].clientY || 0;
24434} // -----------------------------------------------------------------------------
24435// Public methods for specific settings
24436// -----------------------------------------------------------------------------
24437
24438/**
24439 * Set the rotation and distance of the camera
24440 *
24441 * @param {Object} pos An object with the camera position
24442 * @param {number} [pos.horizontal] The horizontal rotation, between 0 and 2*PI.
24443 * Optional, can be left undefined.
24444 * @param {number} [pos.vertical] The vertical rotation, between 0 and 0.5*PI.
24445 * if vertical=0.5*PI, the graph is shown from
24446 * the top. Optional, can be left undefined.
24447 * @param {number} [pos.distance] The (normalized) distance of the camera to the
24448 * center of the graph, a value between 0.71 and
24449 * 5.0. Optional, can be left undefined.
24450 */
24451
24452
24453Graph3d.prototype.setCameraPosition = function (pos) {
24454 Settings.setCameraPosition(pos, this);
24455 this.redraw();
24456};
24457/**
24458 * Set a new size for the graph
24459 *
24460 * @param {string} width Width in pixels or percentage (for example '800px'
24461 * or '50%')
24462 * @param {string} height Height in pixels or percentage (for example '400px'
24463 * or '30%')
24464 */
24465
24466
24467Graph3d.prototype.setSize = function (width, height) {
24468 this._setSize(width, height);
24469
24470 this.redraw();
24471}; // -----------------------------------------------------------------------------
24472// End public methods for specific settings
24473// -----------------------------------------------------------------------------
24474
24475
24476var Graph3d_1 = Graph3d;
24477
24478var moment$1 = createCommonjsModule$1(function (module, exports) {
24479
24480 (function (global, factory) {
24481 module.exports = factory() ;
24482 })(commonjsGlobal$1, function () {
24483
24484 var hookCallback;
24485
24486 function hooks() {
24487 return hookCallback.apply(null, arguments);
24488 } // This is done to register the method called with moment()
24489 // without creating circular dependencies.
24490
24491
24492 function setHookCallback(callback) {
24493 hookCallback = callback;
24494 }
24495
24496 function isArray(input) {
24497 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
24498 }
24499
24500 function isObject(input) {
24501 // IE8 will treat undefined and null as object if it wasn't for
24502 // input != null
24503 return input != null && Object.prototype.toString.call(input) === '[object Object]';
24504 }
24505
24506 function isObjectEmpty(obj) {
24507 if (Object.getOwnPropertyNames) {
24508 return Object.getOwnPropertyNames(obj).length === 0;
24509 } else {
24510 var k;
24511
24512 for (k in obj) {
24513 if (obj.hasOwnProperty(k)) {
24514 return false;
24515 }
24516 }
24517
24518 return true;
24519 }
24520 }
24521
24522 function isUndefined(input) {
24523 return input === void 0;
24524 }
24525
24526 function isNumber(input) {
24527 return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
24528 }
24529
24530 function isDate(input) {
24531 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
24532 }
24533
24534 function map(arr, fn) {
24535 var res = [],
24536 i;
24537
24538 for (i = 0; i < arr.length; ++i) {
24539 res.push(fn(arr[i], i));
24540 }
24541
24542 return res;
24543 }
24544
24545 function hasOwnProp(a, b) {
24546 return Object.prototype.hasOwnProperty.call(a, b);
24547 }
24548
24549 function extend(a, b) {
24550 for (var i in b) {
24551 if (hasOwnProp(b, i)) {
24552 a[i] = b[i];
24553 }
24554 }
24555
24556 if (hasOwnProp(b, 'toString')) {
24557 a.toString = b.toString;
24558 }
24559
24560 if (hasOwnProp(b, 'valueOf')) {
24561 a.valueOf = b.valueOf;
24562 }
24563
24564 return a;
24565 }
24566
24567 function createUTC(input, format, locale, strict) {
24568 return createLocalOrUTC(input, format, locale, strict, true).utc();
24569 }
24570
24571 function defaultParsingFlags() {
24572 // We need to deep clone this object.
24573 return {
24574 empty: false,
24575 unusedTokens: [],
24576 unusedInput: [],
24577 overflow: -2,
24578 charsLeftOver: 0,
24579 nullInput: false,
24580 invalidMonth: null,
24581 invalidFormat: false,
24582 userInvalidated: false,
24583 iso: false,
24584 parsedDateParts: [],
24585 meridiem: null,
24586 rfc2822: false,
24587 weekdayMismatch: false
24588 };
24589 }
24590
24591 function getParsingFlags(m) {
24592 if (m._pf == null) {
24593 m._pf = defaultParsingFlags();
24594 }
24595
24596 return m._pf;
24597 }
24598
24599 var some;
24600
24601 if (Array.prototype.some) {
24602 some = Array.prototype.some;
24603 } else {
24604 some = function (fun) {
24605 var t = Object(this);
24606 var len = t.length >>> 0;
24607
24608 for (var i = 0; i < len; i++) {
24609 if (i in t && fun.call(this, t[i], i, t)) {
24610 return true;
24611 }
24612 }
24613
24614 return false;
24615 };
24616 }
24617
24618 function isValid(m) {
24619 if (m._isValid == null) {
24620 var flags = getParsingFlags(m);
24621 var parsedParts = some.call(flags.parsedDateParts, function (i) {
24622 return i != null;
24623 });
24624 var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
24625
24626 if (m._strict) {
24627 isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined;
24628 }
24629
24630 if (Object.isFrozen == null || !Object.isFrozen(m)) {
24631 m._isValid = isNowValid;
24632 } else {
24633 return isNowValid;
24634 }
24635 }
24636
24637 return m._isValid;
24638 }
24639
24640 function createInvalid(flags) {
24641 var m = createUTC(NaN);
24642
24643 if (flags != null) {
24644 extend(getParsingFlags(m), flags);
24645 } else {
24646 getParsingFlags(m).userInvalidated = true;
24647 }
24648
24649 return m;
24650 } // Plugins that add properties should also add the key here (null value),
24651 // so we can properly clone ourselves.
24652
24653
24654 var momentProperties = hooks.momentProperties = [];
24655
24656 function copyConfig(to, from) {
24657 var i, prop, val;
24658
24659 if (!isUndefined(from._isAMomentObject)) {
24660 to._isAMomentObject = from._isAMomentObject;
24661 }
24662
24663 if (!isUndefined(from._i)) {
24664 to._i = from._i;
24665 }
24666
24667 if (!isUndefined(from._f)) {
24668 to._f = from._f;
24669 }
24670
24671 if (!isUndefined(from._l)) {
24672 to._l = from._l;
24673 }
24674
24675 if (!isUndefined(from._strict)) {
24676 to._strict = from._strict;
24677 }
24678
24679 if (!isUndefined(from._tzm)) {
24680 to._tzm = from._tzm;
24681 }
24682
24683 if (!isUndefined(from._isUTC)) {
24684 to._isUTC = from._isUTC;
24685 }
24686
24687 if (!isUndefined(from._offset)) {
24688 to._offset = from._offset;
24689 }
24690
24691 if (!isUndefined(from._pf)) {
24692 to._pf = getParsingFlags(from);
24693 }
24694
24695 if (!isUndefined(from._locale)) {
24696 to._locale = from._locale;
24697 }
24698
24699 if (momentProperties.length > 0) {
24700 for (i = 0; i < momentProperties.length; i++) {
24701 prop = momentProperties[i];
24702 val = from[prop];
24703
24704 if (!isUndefined(val)) {
24705 to[prop] = val;
24706 }
24707 }
24708 }
24709
24710 return to;
24711 }
24712
24713 var updateInProgress = false; // Moment prototype object
24714
24715 function Moment(config) {
24716 copyConfig(this, config);
24717 this._d = new Date(config._d != null ? config._d.getTime() : NaN);
24718
24719 if (!this.isValid()) {
24720 this._d = new Date(NaN);
24721 } // Prevent infinite loop in case updateOffset creates new moment
24722 // objects.
24723
24724
24725 if (updateInProgress === false) {
24726 updateInProgress = true;
24727 hooks.updateOffset(this);
24728 updateInProgress = false;
24729 }
24730 }
24731
24732 function isMoment(obj) {
24733 return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
24734 }
24735
24736 function absFloor(number) {
24737 if (number < 0) {
24738 // -0 -> 0
24739 return Math.ceil(number) || 0;
24740 } else {
24741 return Math.floor(number);
24742 }
24743 }
24744
24745 function toInt(argumentForCoercion) {
24746 var coercedNumber = +argumentForCoercion,
24747 value = 0;
24748
24749 if (coercedNumber !== 0 && isFinite(coercedNumber)) {
24750 value = absFloor(coercedNumber);
24751 }
24752
24753 return value;
24754 } // compare two arrays, return the number of differences
24755
24756
24757 function compareArrays(array1, array2, dontConvert) {
24758 var len = Math.min(array1.length, array2.length),
24759 lengthDiff = Math.abs(array1.length - array2.length),
24760 diffs = 0,
24761 i;
24762
24763 for (i = 0; i < len; i++) {
24764 if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
24765 diffs++;
24766 }
24767 }
24768
24769 return diffs + lengthDiff;
24770 }
24771
24772 function warn(msg) {
24773 if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
24774 console.warn('Deprecation warning: ' + msg);
24775 }
24776 }
24777
24778 function deprecate(msg, fn) {
24779 var firstTime = true;
24780 return extend(function () {
24781 if (hooks.deprecationHandler != null) {
24782 hooks.deprecationHandler(null, msg);
24783 }
24784
24785 if (firstTime) {
24786 var args = [];
24787 var arg;
24788
24789 for (var i = 0; i < arguments.length; i++) {
24790 arg = '';
24791
24792 if (typeof arguments[i] === 'object') {
24793 arg += '\n[' + i + '] ';
24794
24795 for (var key in arguments[0]) {
24796 arg += key + ': ' + arguments[0][key] + ', ';
24797 }
24798
24799 arg = arg.slice(0, -2); // Remove trailing comma and space
24800 } else {
24801 arg = arguments[i];
24802 }
24803
24804 args.push(arg);
24805 }
24806
24807 warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack);
24808 firstTime = false;
24809 }
24810
24811 return fn.apply(this, arguments);
24812 }, fn);
24813 }
24814
24815 var deprecations = {};
24816
24817 function deprecateSimple(name, msg) {
24818 if (hooks.deprecationHandler != null) {
24819 hooks.deprecationHandler(name, msg);
24820 }
24821
24822 if (!deprecations[name]) {
24823 warn(msg);
24824 deprecations[name] = true;
24825 }
24826 }
24827
24828 hooks.suppressDeprecationWarnings = false;
24829 hooks.deprecationHandler = null;
24830
24831 function isFunction(input) {
24832 return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
24833 }
24834
24835 function set(config) {
24836 var prop, i;
24837
24838 for (i in config) {
24839 prop = config[i];
24840
24841 if (isFunction(prop)) {
24842 this[i] = prop;
24843 } else {
24844 this['_' + i] = prop;
24845 }
24846 }
24847
24848 this._config = config; // Lenient ordinal parsing accepts just a number in addition to
24849 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
24850 // TODO: Remove "ordinalParse" fallback in next major release.
24851
24852 this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source);
24853 }
24854
24855 function mergeConfigs(parentConfig, childConfig) {
24856 var res = extend({}, parentConfig),
24857 prop;
24858
24859 for (prop in childConfig) {
24860 if (hasOwnProp(childConfig, prop)) {
24861 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
24862 res[prop] = {};
24863 extend(res[prop], parentConfig[prop]);
24864 extend(res[prop], childConfig[prop]);
24865 } else if (childConfig[prop] != null) {
24866 res[prop] = childConfig[prop];
24867 } else {
24868 delete res[prop];
24869 }
24870 }
24871 }
24872
24873 for (prop in parentConfig) {
24874 if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
24875 // make sure changes to properties don't modify parent config
24876 res[prop] = extend({}, res[prop]);
24877 }
24878 }
24879
24880 return res;
24881 }
24882
24883 function Locale(config) {
24884 if (config != null) {
24885 this.set(config);
24886 }
24887 }
24888
24889 var keys;
24890
24891 if (Object.keys) {
24892 keys = Object.keys;
24893 } else {
24894 keys = function (obj) {
24895 var i,
24896 res = [];
24897
24898 for (i in obj) {
24899 if (hasOwnProp(obj, i)) {
24900 res.push(i);
24901 }
24902 }
24903
24904 return res;
24905 };
24906 }
24907
24908 var defaultCalendar = {
24909 sameDay: '[Today at] LT',
24910 nextDay: '[Tomorrow at] LT',
24911 nextWeek: 'dddd [at] LT',
24912 lastDay: '[Yesterday at] LT',
24913 lastWeek: '[Last] dddd [at] LT',
24914 sameElse: 'L'
24915 };
24916
24917 function calendar(key, mom, now) {
24918 var output = this._calendar[key] || this._calendar['sameElse'];
24919 return isFunction(output) ? output.call(mom, now) : output;
24920 }
24921
24922 var defaultLongDateFormat = {
24923 LTS: 'h:mm:ss A',
24924 LT: 'h:mm A',
24925 L: 'MM/DD/YYYY',
24926 LL: 'MMMM D, YYYY',
24927 LLL: 'MMMM D, YYYY h:mm A',
24928 LLLL: 'dddd, MMMM D, YYYY h:mm A'
24929 };
24930
24931 function longDateFormat(key) {
24932 var format = this._longDateFormat[key],
24933 formatUpper = this._longDateFormat[key.toUpperCase()];
24934
24935 if (format || !formatUpper) {
24936 return format;
24937 }
24938
24939 this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
24940 return val.slice(1);
24941 });
24942 return this._longDateFormat[key];
24943 }
24944
24945 var defaultInvalidDate = 'Invalid date';
24946
24947 function invalidDate() {
24948 return this._invalidDate;
24949 }
24950
24951 var defaultOrdinal = '%d';
24952 var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
24953
24954 function ordinal(number) {
24955 return this._ordinal.replace('%d', number);
24956 }
24957
24958 var defaultRelativeTime = {
24959 future: 'in %s',
24960 past: '%s ago',
24961 s: 'a few seconds',
24962 ss: '%d seconds',
24963 m: 'a minute',
24964 mm: '%d minutes',
24965 h: 'an hour',
24966 hh: '%d hours',
24967 d: 'a day',
24968 dd: '%d days',
24969 M: 'a month',
24970 MM: '%d months',
24971 y: 'a year',
24972 yy: '%d years'
24973 };
24974
24975 function relativeTime(number, withoutSuffix, string, isFuture) {
24976 var output = this._relativeTime[string];
24977 return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
24978 }
24979
24980 function pastFuture(diff, output) {
24981 var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
24982 return isFunction(format) ? format(output) : format.replace(/%s/i, output);
24983 }
24984
24985 var aliases = {};
24986
24987 function addUnitAlias(unit, shorthand) {
24988 var lowerCase = unit.toLowerCase();
24989 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
24990 }
24991
24992 function normalizeUnits(units) {
24993 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
24994 }
24995
24996 function normalizeObjectUnits(inputObject) {
24997 var normalizedInput = {},
24998 normalizedProp,
24999 prop;
25000
25001 for (prop in inputObject) {
25002 if (hasOwnProp(inputObject, prop)) {
25003 normalizedProp = normalizeUnits(prop);
25004
25005 if (normalizedProp) {
25006 normalizedInput[normalizedProp] = inputObject[prop];
25007 }
25008 }
25009 }
25010
25011 return normalizedInput;
25012 }
25013
25014 var priorities = {};
25015
25016 function addUnitPriority(unit, priority) {
25017 priorities[unit] = priority;
25018 }
25019
25020 function getPrioritizedUnits(unitsObj) {
25021 var units = [];
25022
25023 for (var u in unitsObj) {
25024 units.push({
25025 unit: u,
25026 priority: priorities[u]
25027 });
25028 }
25029
25030 units.sort(function (a, b) {
25031 return a.priority - b.priority;
25032 });
25033 return units;
25034 }
25035
25036 function zeroFill(number, targetLength, forceSign) {
25037 var absNumber = '' + Math.abs(number),
25038 zerosToFill = targetLength - absNumber.length,
25039 sign = number >= 0;
25040 return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
25041 }
25042
25043 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
25044 var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
25045 var formatFunctions = {};
25046 var formatTokenFunctions = {}; // token: 'M'
25047 // padded: ['MM', 2]
25048 // ordinal: 'Mo'
25049 // callback: function () { this.month() + 1 }
25050
25051 function addFormatToken(token, padded, ordinal, callback) {
25052 var func = callback;
25053
25054 if (typeof callback === 'string') {
25055 func = function () {
25056 return this[callback]();
25057 };
25058 }
25059
25060 if (token) {
25061 formatTokenFunctions[token] = func;
25062 }
25063
25064 if (padded) {
25065 formatTokenFunctions[padded[0]] = function () {
25066 return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
25067 };
25068 }
25069
25070 if (ordinal) {
25071 formatTokenFunctions[ordinal] = function () {
25072 return this.localeData().ordinal(func.apply(this, arguments), token);
25073 };
25074 }
25075 }
25076
25077 function removeFormattingTokens(input) {
25078 if (input.match(/\[[\s\S]/)) {
25079 return input.replace(/^\[|\]$/g, '');
25080 }
25081
25082 return input.replace(/\\/g, '');
25083 }
25084
25085 function makeFormatFunction(format) {
25086 var array = format.match(formattingTokens),
25087 i,
25088 length;
25089
25090 for (i = 0, length = array.length; i < length; i++) {
25091 if (formatTokenFunctions[array[i]]) {
25092 array[i] = formatTokenFunctions[array[i]];
25093 } else {
25094 array[i] = removeFormattingTokens(array[i]);
25095 }
25096 }
25097
25098 return function (mom) {
25099 var output = '',
25100 i;
25101
25102 for (i = 0; i < length; i++) {
25103 output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
25104 }
25105
25106 return output;
25107 };
25108 } // format date using native date object
25109
25110
25111 function formatMoment(m, format) {
25112 if (!m.isValid()) {
25113 return m.localeData().invalidDate();
25114 }
25115
25116 format = expandFormat(format, m.localeData());
25117 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
25118 return formatFunctions[format](m);
25119 }
25120
25121 function expandFormat(format, locale) {
25122 var i = 5;
25123
25124 function replaceLongDateFormatTokens(input) {
25125 return locale.longDateFormat(input) || input;
25126 }
25127
25128 localFormattingTokens.lastIndex = 0;
25129
25130 while (i >= 0 && localFormattingTokens.test(format)) {
25131 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
25132 localFormattingTokens.lastIndex = 0;
25133 i -= 1;
25134 }
25135
25136 return format;
25137 }
25138
25139 var match1 = /\d/; // 0 - 9
25140
25141 var match2 = /\d\d/; // 00 - 99
25142
25143 var match3 = /\d{3}/; // 000 - 999
25144
25145 var match4 = /\d{4}/; // 0000 - 9999
25146
25147 var match6 = /[+-]?\d{6}/; // -999999 - 999999
25148
25149 var match1to2 = /\d\d?/; // 0 - 99
25150
25151 var match3to4 = /\d\d\d\d?/; // 999 - 9999
25152
25153 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
25154
25155 var match1to3 = /\d{1,3}/; // 0 - 999
25156
25157 var match1to4 = /\d{1,4}/; // 0 - 9999
25158
25159 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
25160
25161 var matchUnsigned = /\d+/; // 0 - inf
25162
25163 var matchSigned = /[+-]?\d+/; // -inf - inf
25164
25165 var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
25166
25167 var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
25168
25169 var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
25170 // any word (or two) characters or numbers including two/three word month in arabic.
25171 // includes scottish gaelic two word and hyphenated months
25172
25173 var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
25174 var regexes = {};
25175
25176 function addRegexToken(token, regex, strictRegex) {
25177 regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
25178 return isStrict && strictRegex ? strictRegex : regex;
25179 };
25180 }
25181
25182 function getParseRegexForToken(token, config) {
25183 if (!hasOwnProp(regexes, token)) {
25184 return new RegExp(unescapeFormat(token));
25185 }
25186
25187 return regexes[token](config._strict, config._locale);
25188 } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
25189
25190
25191 function unescapeFormat(s) {
25192 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
25193 return p1 || p2 || p3 || p4;
25194 }));
25195 }
25196
25197 function regexEscape(s) {
25198 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
25199 }
25200
25201 var tokens = {};
25202
25203 function addParseToken(token, callback) {
25204 var i,
25205 func = callback;
25206
25207 if (typeof token === 'string') {
25208 token = [token];
25209 }
25210
25211 if (isNumber(callback)) {
25212 func = function (input, array) {
25213 array[callback] = toInt(input);
25214 };
25215 }
25216
25217 for (i = 0; i < token.length; i++) {
25218 tokens[token[i]] = func;
25219 }
25220 }
25221
25222 function addWeekParseToken(token, callback) {
25223 addParseToken(token, function (input, array, config, token) {
25224 config._w = config._w || {};
25225 callback(input, config._w, config, token);
25226 });
25227 }
25228
25229 function addTimeToArrayFromToken(token, input, config) {
25230 if (input != null && hasOwnProp(tokens, token)) {
25231 tokens[token](input, config._a, config, token);
25232 }
25233 }
25234
25235 var YEAR = 0;
25236 var MONTH = 1;
25237 var DATE = 2;
25238 var HOUR = 3;
25239 var MINUTE = 4;
25240 var SECOND = 5;
25241 var MILLISECOND = 6;
25242 var WEEK = 7;
25243 var WEEKDAY = 8; // FORMATTING
25244
25245 addFormatToken('Y', 0, 0, function () {
25246 var y = this.year();
25247 return y <= 9999 ? '' + y : '+' + y;
25248 });
25249 addFormatToken(0, ['YY', 2], 0, function () {
25250 return this.year() % 100;
25251 });
25252 addFormatToken(0, ['YYYY', 4], 0, 'year');
25253 addFormatToken(0, ['YYYYY', 5], 0, 'year');
25254 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES
25255
25256 addUnitAlias('year', 'y'); // PRIORITIES
25257
25258 addUnitPriority('year', 1); // PARSING
25259
25260 addRegexToken('Y', matchSigned);
25261 addRegexToken('YY', match1to2, match2);
25262 addRegexToken('YYYY', match1to4, match4);
25263 addRegexToken('YYYYY', match1to6, match6);
25264 addRegexToken('YYYYYY', match1to6, match6);
25265 addParseToken(['YYYYY', 'YYYYYY'], YEAR);
25266 addParseToken('YYYY', function (input, array) {
25267 array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
25268 });
25269 addParseToken('YY', function (input, array) {
25270 array[YEAR] = hooks.parseTwoDigitYear(input);
25271 });
25272 addParseToken('Y', function (input, array) {
25273 array[YEAR] = parseInt(input, 10);
25274 }); // HELPERS
25275
25276 function daysInYear(year) {
25277 return isLeapYear(year) ? 366 : 365;
25278 }
25279
25280 function isLeapYear(year) {
25281 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
25282 } // HOOKS
25283
25284
25285 hooks.parseTwoDigitYear = function (input) {
25286 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
25287 }; // MOMENTS
25288
25289
25290 var getSetYear = makeGetSet('FullYear', true);
25291
25292 function getIsLeapYear() {
25293 return isLeapYear(this.year());
25294 }
25295
25296 function makeGetSet(unit, keepTime) {
25297 return function (value) {
25298 if (value != null) {
25299 set$1(this, unit, value);
25300 hooks.updateOffset(this, keepTime);
25301 return this;
25302 } else {
25303 return get(this, unit);
25304 }
25305 };
25306 }
25307
25308 function get(mom, unit) {
25309 return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
25310 }
25311
25312 function set$1(mom, unit, value) {
25313 if (mom.isValid() && !isNaN(value)) {
25314 if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
25315 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
25316 } else {
25317 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
25318 }
25319 }
25320 } // MOMENTS
25321
25322
25323 function stringGet(units) {
25324 units = normalizeUnits(units);
25325
25326 if (isFunction(this[units])) {
25327 return this[units]();
25328 }
25329
25330 return this;
25331 }
25332
25333 function stringSet(units, value) {
25334 if (typeof units === 'object') {
25335 units = normalizeObjectUnits(units);
25336 var prioritized = getPrioritizedUnits(units);
25337
25338 for (var i = 0; i < prioritized.length; i++) {
25339 this[prioritized[i].unit](units[prioritized[i].unit]);
25340 }
25341 } else {
25342 units = normalizeUnits(units);
25343
25344 if (isFunction(this[units])) {
25345 return this[units](value);
25346 }
25347 }
25348
25349 return this;
25350 }
25351
25352 function mod(n, x) {
25353 return (n % x + x) % x;
25354 }
25355
25356 var indexOf;
25357
25358 if (Array.prototype.indexOf) {
25359 indexOf = Array.prototype.indexOf;
25360 } else {
25361 indexOf = function (o) {
25362 // I know
25363 var i;
25364
25365 for (i = 0; i < this.length; ++i) {
25366 if (this[i] === o) {
25367 return i;
25368 }
25369 }
25370
25371 return -1;
25372 };
25373 }
25374
25375 function daysInMonth(year, month) {
25376 if (isNaN(year) || isNaN(month)) {
25377 return NaN;
25378 }
25379
25380 var modMonth = mod(month, 12);
25381 year += (month - modMonth) / 12;
25382 return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
25383 } // FORMATTING
25384
25385
25386 addFormatToken('M', ['MM', 2], 'Mo', function () {
25387 return this.month() + 1;
25388 });
25389 addFormatToken('MMM', 0, 0, function (format) {
25390 return this.localeData().monthsShort(this, format);
25391 });
25392 addFormatToken('MMMM', 0, 0, function (format) {
25393 return this.localeData().months(this, format);
25394 }); // ALIASES
25395
25396 addUnitAlias('month', 'M'); // PRIORITY
25397
25398 addUnitPriority('month', 8); // PARSING
25399
25400 addRegexToken('M', match1to2);
25401 addRegexToken('MM', match1to2, match2);
25402 addRegexToken('MMM', function (isStrict, locale) {
25403 return locale.monthsShortRegex(isStrict);
25404 });
25405 addRegexToken('MMMM', function (isStrict, locale) {
25406 return locale.monthsRegex(isStrict);
25407 });
25408 addParseToken(['M', 'MM'], function (input, array) {
25409 array[MONTH] = toInt(input) - 1;
25410 });
25411 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
25412 var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid.
25413
25414
25415 if (month != null) {
25416 array[MONTH] = month;
25417 } else {
25418 getParsingFlags(config).invalidMonth = input;
25419 }
25420 }); // LOCALES
25421
25422 var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
25423 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
25424
25425 function localeMonths(m, format) {
25426 if (!m) {
25427 return isArray(this._months) ? this._months : this._months['standalone'];
25428 }
25429
25430 return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
25431 }
25432
25433 var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
25434
25435 function localeMonthsShort(m, format) {
25436 if (!m) {
25437 return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone'];
25438 }
25439
25440 return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
25441 }
25442
25443 function handleStrictParse(monthName, format, strict) {
25444 var i,
25445 ii,
25446 mom,
25447 llc = monthName.toLocaleLowerCase();
25448
25449 if (!this._monthsParse) {
25450 // this is not used
25451 this._monthsParse = [];
25452 this._longMonthsParse = [];
25453 this._shortMonthsParse = [];
25454
25455 for (i = 0; i < 12; ++i) {
25456 mom = createUTC([2000, i]);
25457 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
25458 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
25459 }
25460 }
25461
25462 if (strict) {
25463 if (format === 'MMM') {
25464 ii = indexOf.call(this._shortMonthsParse, llc);
25465 return ii !== -1 ? ii : null;
25466 } else {
25467 ii = indexOf.call(this._longMonthsParse, llc);
25468 return ii !== -1 ? ii : null;
25469 }
25470 } else {
25471 if (format === 'MMM') {
25472 ii = indexOf.call(this._shortMonthsParse, llc);
25473
25474 if (ii !== -1) {
25475 return ii;
25476 }
25477
25478 ii = indexOf.call(this._longMonthsParse, llc);
25479 return ii !== -1 ? ii : null;
25480 } else {
25481 ii = indexOf.call(this._longMonthsParse, llc);
25482
25483 if (ii !== -1) {
25484 return ii;
25485 }
25486
25487 ii = indexOf.call(this._shortMonthsParse, llc);
25488 return ii !== -1 ? ii : null;
25489 }
25490 }
25491 }
25492
25493 function localeMonthsParse(monthName, format, strict) {
25494 var i, mom, regex;
25495
25496 if (this._monthsParseExact) {
25497 return handleStrictParse.call(this, monthName, format, strict);
25498 }
25499
25500 if (!this._monthsParse) {
25501 this._monthsParse = [];
25502 this._longMonthsParse = [];
25503 this._shortMonthsParse = [];
25504 } // TODO: add sorting
25505 // Sorting makes sure if one month (or abbr) is a prefix of another
25506 // see sorting in computeMonthsParse
25507
25508
25509 for (i = 0; i < 12; i++) {
25510 // make the regex if we don't have it already
25511 mom = createUTC([2000, i]);
25512
25513 if (strict && !this._longMonthsParse[i]) {
25514 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
25515 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
25516 }
25517
25518 if (!strict && !this._monthsParse[i]) {
25519 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
25520 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
25521 } // test the regex
25522
25523
25524 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
25525 return i;
25526 } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
25527 return i;
25528 } else if (!strict && this._monthsParse[i].test(monthName)) {
25529 return i;
25530 }
25531 }
25532 } // MOMENTS
25533
25534
25535 function setMonth(mom, value) {
25536 var dayOfMonth;
25537
25538 if (!mom.isValid()) {
25539 // No op
25540 return mom;
25541 }
25542
25543 if (typeof value === 'string') {
25544 if (/^\d+$/.test(value)) {
25545 value = toInt(value);
25546 } else {
25547 value = mom.localeData().monthsParse(value); // TODO: Another silent failure?
25548
25549 if (!isNumber(value)) {
25550 return mom;
25551 }
25552 }
25553 }
25554
25555 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
25556
25557 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
25558
25559 return mom;
25560 }
25561
25562 function getSetMonth(value) {
25563 if (value != null) {
25564 setMonth(this, value);
25565 hooks.updateOffset(this, true);
25566 return this;
25567 } else {
25568 return get(this, 'Month');
25569 }
25570 }
25571
25572 function getDaysInMonth() {
25573 return daysInMonth(this.year(), this.month());
25574 }
25575
25576 var defaultMonthsShortRegex = matchWord;
25577
25578 function monthsShortRegex(isStrict) {
25579 if (this._monthsParseExact) {
25580 if (!hasOwnProp(this, '_monthsRegex')) {
25581 computeMonthsParse.call(this);
25582 }
25583
25584 if (isStrict) {
25585 return this._monthsShortStrictRegex;
25586 } else {
25587 return this._monthsShortRegex;
25588 }
25589 } else {
25590 if (!hasOwnProp(this, '_monthsShortRegex')) {
25591 this._monthsShortRegex = defaultMonthsShortRegex;
25592 }
25593
25594 return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
25595 }
25596 }
25597
25598 var defaultMonthsRegex = matchWord;
25599
25600 function monthsRegex(isStrict) {
25601 if (this._monthsParseExact) {
25602 if (!hasOwnProp(this, '_monthsRegex')) {
25603 computeMonthsParse.call(this);
25604 }
25605
25606 if (isStrict) {
25607 return this._monthsStrictRegex;
25608 } else {
25609 return this._monthsRegex;
25610 }
25611 } else {
25612 if (!hasOwnProp(this, '_monthsRegex')) {
25613 this._monthsRegex = defaultMonthsRegex;
25614 }
25615
25616 return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
25617 }
25618 }
25619
25620 function computeMonthsParse() {
25621 function cmpLenRev(a, b) {
25622 return b.length - a.length;
25623 }
25624
25625 var shortPieces = [],
25626 longPieces = [],
25627 mixedPieces = [],
25628 i,
25629 mom;
25630
25631 for (i = 0; i < 12; i++) {
25632 // make the regex if we don't have it already
25633 mom = createUTC([2000, i]);
25634 shortPieces.push(this.monthsShort(mom, ''));
25635 longPieces.push(this.months(mom, ''));
25636 mixedPieces.push(this.months(mom, ''));
25637 mixedPieces.push(this.monthsShort(mom, ''));
25638 } // Sorting makes sure if one month (or abbr) is a prefix of another it
25639 // will match the longer piece.
25640
25641
25642 shortPieces.sort(cmpLenRev);
25643 longPieces.sort(cmpLenRev);
25644 mixedPieces.sort(cmpLenRev);
25645
25646 for (i = 0; i < 12; i++) {
25647 shortPieces[i] = regexEscape(shortPieces[i]);
25648 longPieces[i] = regexEscape(longPieces[i]);
25649 }
25650
25651 for (i = 0; i < 24; i++) {
25652 mixedPieces[i] = regexEscape(mixedPieces[i]);
25653 }
25654
25655 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
25656 this._monthsShortRegex = this._monthsRegex;
25657 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
25658 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
25659 }
25660
25661 function createDate(y, m, d, h, M, s, ms) {
25662 // can't just apply() to create a date:
25663 // https://stackoverflow.com/q/181348
25664 var date; // the date constructor remaps years 0-99 to 1900-1999
25665
25666 if (y < 100 && y >= 0) {
25667 // preserve leap years using a full 400 year cycle, then reset
25668 date = new Date(y + 400, m, d, h, M, s, ms);
25669
25670 if (isFinite(date.getFullYear())) {
25671 date.setFullYear(y);
25672 }
25673 } else {
25674 date = new Date(y, m, d, h, M, s, ms);
25675 }
25676
25677 return date;
25678 }
25679
25680 function createUTCDate(y) {
25681 var date; // the Date.UTC function remaps years 0-99 to 1900-1999
25682
25683 if (y < 100 && y >= 0) {
25684 var args = Array.prototype.slice.call(arguments); // preserve leap years using a full 400 year cycle, then reset
25685
25686 args[0] = y + 400;
25687 date = new Date(Date.UTC.apply(null, args));
25688
25689 if (isFinite(date.getUTCFullYear())) {
25690 date.setUTCFullYear(y);
25691 }
25692 } else {
25693 date = new Date(Date.UTC.apply(null, arguments));
25694 }
25695
25696 return date;
25697 } // start-of-first-week - start-of-year
25698
25699
25700 function firstWeekOffset(year, dow, doy) {
25701 var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
25702 fwd = 7 + dow - doy,
25703 // first-week day local weekday -- which local weekday is fwd
25704 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
25705 return -fwdlw + fwd - 1;
25706 } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
25707
25708
25709 function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
25710 var localWeekday = (7 + weekday - dow) % 7,
25711 weekOffset = firstWeekOffset(year, dow, doy),
25712 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
25713 resYear,
25714 resDayOfYear;
25715
25716 if (dayOfYear <= 0) {
25717 resYear = year - 1;
25718 resDayOfYear = daysInYear(resYear) + dayOfYear;
25719 } else if (dayOfYear > daysInYear(year)) {
25720 resYear = year + 1;
25721 resDayOfYear = dayOfYear - daysInYear(year);
25722 } else {
25723 resYear = year;
25724 resDayOfYear = dayOfYear;
25725 }
25726
25727 return {
25728 year: resYear,
25729 dayOfYear: resDayOfYear
25730 };
25731 }
25732
25733 function weekOfYear(mom, dow, doy) {
25734 var weekOffset = firstWeekOffset(mom.year(), dow, doy),
25735 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
25736 resWeek,
25737 resYear;
25738
25739 if (week < 1) {
25740 resYear = mom.year() - 1;
25741 resWeek = week + weeksInYear(resYear, dow, doy);
25742 } else if (week > weeksInYear(mom.year(), dow, doy)) {
25743 resWeek = week - weeksInYear(mom.year(), dow, doy);
25744 resYear = mom.year() + 1;
25745 } else {
25746 resYear = mom.year();
25747 resWeek = week;
25748 }
25749
25750 return {
25751 week: resWeek,
25752 year: resYear
25753 };
25754 }
25755
25756 function weeksInYear(year, dow, doy) {
25757 var weekOffset = firstWeekOffset(year, dow, doy),
25758 weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
25759 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
25760 } // FORMATTING
25761
25762
25763 addFormatToken('w', ['ww', 2], 'wo', 'week');
25764 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES
25765
25766 addUnitAlias('week', 'w');
25767 addUnitAlias('isoWeek', 'W'); // PRIORITIES
25768
25769 addUnitPriority('week', 5);
25770 addUnitPriority('isoWeek', 5); // PARSING
25771
25772 addRegexToken('w', match1to2);
25773 addRegexToken('ww', match1to2, match2);
25774 addRegexToken('W', match1to2);
25775 addRegexToken('WW', match1to2, match2);
25776 addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
25777 week[token.substr(0, 1)] = toInt(input);
25778 }); // HELPERS
25779 // LOCALES
25780
25781 function localeWeek(mom) {
25782 return weekOfYear(mom, this._week.dow, this._week.doy).week;
25783 }
25784
25785 var defaultLocaleWeek = {
25786 dow: 0,
25787 // Sunday is the first day of the week.
25788 doy: 6 // The week that contains Jan 6th is the first week of the year.
25789
25790 };
25791
25792 function localeFirstDayOfWeek() {
25793 return this._week.dow;
25794 }
25795
25796 function localeFirstDayOfYear() {
25797 return this._week.doy;
25798 } // MOMENTS
25799
25800
25801 function getSetWeek(input) {
25802 var week = this.localeData().week(this);
25803 return input == null ? week : this.add((input - week) * 7, 'd');
25804 }
25805
25806 function getSetISOWeek(input) {
25807 var week = weekOfYear(this, 1, 4).week;
25808 return input == null ? week : this.add((input - week) * 7, 'd');
25809 } // FORMATTING
25810
25811
25812 addFormatToken('d', 0, 'do', 'day');
25813 addFormatToken('dd', 0, 0, function (format) {
25814 return this.localeData().weekdaysMin(this, format);
25815 });
25816 addFormatToken('ddd', 0, 0, function (format) {
25817 return this.localeData().weekdaysShort(this, format);
25818 });
25819 addFormatToken('dddd', 0, 0, function (format) {
25820 return this.localeData().weekdays(this, format);
25821 });
25822 addFormatToken('e', 0, 0, 'weekday');
25823 addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES
25824
25825 addUnitAlias('day', 'd');
25826 addUnitAlias('weekday', 'e');
25827 addUnitAlias('isoWeekday', 'E'); // PRIORITY
25828
25829 addUnitPriority('day', 11);
25830 addUnitPriority('weekday', 11);
25831 addUnitPriority('isoWeekday', 11); // PARSING
25832
25833 addRegexToken('d', match1to2);
25834 addRegexToken('e', match1to2);
25835 addRegexToken('E', match1to2);
25836 addRegexToken('dd', function (isStrict, locale) {
25837 return locale.weekdaysMinRegex(isStrict);
25838 });
25839 addRegexToken('ddd', function (isStrict, locale) {
25840 return locale.weekdaysShortRegex(isStrict);
25841 });
25842 addRegexToken('dddd', function (isStrict, locale) {
25843 return locale.weekdaysRegex(isStrict);
25844 });
25845 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
25846 var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid
25847
25848
25849 if (weekday != null) {
25850 week.d = weekday;
25851 } else {
25852 getParsingFlags(config).invalidWeekday = input;
25853 }
25854 });
25855 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
25856 week[token] = toInt(input);
25857 }); // HELPERS
25858
25859 function parseWeekday(input, locale) {
25860 if (typeof input !== 'string') {
25861 return input;
25862 }
25863
25864 if (!isNaN(input)) {
25865 return parseInt(input, 10);
25866 }
25867
25868 input = locale.weekdaysParse(input);
25869
25870 if (typeof input === 'number') {
25871 return input;
25872 }
25873
25874 return null;
25875 }
25876
25877 function parseIsoWeekday(input, locale) {
25878 if (typeof input === 'string') {
25879 return locale.weekdaysParse(input) % 7 || 7;
25880 }
25881
25882 return isNaN(input) ? null : input;
25883 } // LOCALES
25884
25885
25886 function shiftWeekdays(ws, n) {
25887 return ws.slice(n, 7).concat(ws.slice(0, n));
25888 }
25889
25890 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
25891
25892 function localeWeekdays(m, format) {
25893 var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone'];
25894 return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
25895 }
25896
25897 var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
25898
25899 function localeWeekdaysShort(m) {
25900 return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
25901 }
25902
25903 var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
25904
25905 function localeWeekdaysMin(m) {
25906 return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
25907 }
25908
25909 function handleStrictParse$1(weekdayName, format, strict) {
25910 var i,
25911 ii,
25912 mom,
25913 llc = weekdayName.toLocaleLowerCase();
25914
25915 if (!this._weekdaysParse) {
25916 this._weekdaysParse = [];
25917 this._shortWeekdaysParse = [];
25918 this._minWeekdaysParse = [];
25919
25920 for (i = 0; i < 7; ++i) {
25921 mom = createUTC([2000, 1]).day(i);
25922 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
25923 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
25924 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
25925 }
25926 }
25927
25928 if (strict) {
25929 if (format === 'dddd') {
25930 ii = indexOf.call(this._weekdaysParse, llc);
25931 return ii !== -1 ? ii : null;
25932 } else if (format === 'ddd') {
25933 ii = indexOf.call(this._shortWeekdaysParse, llc);
25934 return ii !== -1 ? ii : null;
25935 } else {
25936 ii = indexOf.call(this._minWeekdaysParse, llc);
25937 return ii !== -1 ? ii : null;
25938 }
25939 } else {
25940 if (format === 'dddd') {
25941 ii = indexOf.call(this._weekdaysParse, llc);
25942
25943 if (ii !== -1) {
25944 return ii;
25945 }
25946
25947 ii = indexOf.call(this._shortWeekdaysParse, llc);
25948
25949 if (ii !== -1) {
25950 return ii;
25951 }
25952
25953 ii = indexOf.call(this._minWeekdaysParse, llc);
25954 return ii !== -1 ? ii : null;
25955 } else if (format === 'ddd') {
25956 ii = indexOf.call(this._shortWeekdaysParse, llc);
25957
25958 if (ii !== -1) {
25959 return ii;
25960 }
25961
25962 ii = indexOf.call(this._weekdaysParse, llc);
25963
25964 if (ii !== -1) {
25965 return ii;
25966 }
25967
25968 ii = indexOf.call(this._minWeekdaysParse, llc);
25969 return ii !== -1 ? ii : null;
25970 } else {
25971 ii = indexOf.call(this._minWeekdaysParse, llc);
25972
25973 if (ii !== -1) {
25974 return ii;
25975 }
25976
25977 ii = indexOf.call(this._weekdaysParse, llc);
25978
25979 if (ii !== -1) {
25980 return ii;
25981 }
25982
25983 ii = indexOf.call(this._shortWeekdaysParse, llc);
25984 return ii !== -1 ? ii : null;
25985 }
25986 }
25987 }
25988
25989 function localeWeekdaysParse(weekdayName, format, strict) {
25990 var i, mom, regex;
25991
25992 if (this._weekdaysParseExact) {
25993 return handleStrictParse$1.call(this, weekdayName, format, strict);
25994 }
25995
25996 if (!this._weekdaysParse) {
25997 this._weekdaysParse = [];
25998 this._minWeekdaysParse = [];
25999 this._shortWeekdaysParse = [];
26000 this._fullWeekdaysParse = [];
26001 }
26002
26003 for (i = 0; i < 7; i++) {
26004 // make the regex if we don't have it already
26005 mom = createUTC([2000, 1]).day(i);
26006
26007 if (strict && !this._fullWeekdaysParse[i]) {
26008 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
26009 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
26010 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
26011 }
26012
26013 if (!this._weekdaysParse[i]) {
26014 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
26015 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
26016 } // test the regex
26017
26018
26019 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
26020 return i;
26021 } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
26022 return i;
26023 } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
26024 return i;
26025 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
26026 return i;
26027 }
26028 }
26029 } // MOMENTS
26030
26031
26032 function getSetDayOfWeek(input) {
26033 if (!this.isValid()) {
26034 return input != null ? this : NaN;
26035 }
26036
26037 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
26038
26039 if (input != null) {
26040 input = parseWeekday(input, this.localeData());
26041 return this.add(input - day, 'd');
26042 } else {
26043 return day;
26044 }
26045 }
26046
26047 function getSetLocaleDayOfWeek(input) {
26048 if (!this.isValid()) {
26049 return input != null ? this : NaN;
26050 }
26051
26052 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
26053 return input == null ? weekday : this.add(input - weekday, 'd');
26054 }
26055
26056 function getSetISODayOfWeek(input) {
26057 if (!this.isValid()) {
26058 return input != null ? this : NaN;
26059 } // behaves the same as moment#day except
26060 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
26061 // as a setter, sunday should belong to the previous week.
26062
26063
26064 if (input != null) {
26065 var weekday = parseIsoWeekday(input, this.localeData());
26066 return this.day(this.day() % 7 ? weekday : weekday - 7);
26067 } else {
26068 return this.day() || 7;
26069 }
26070 }
26071
26072 var defaultWeekdaysRegex = matchWord;
26073
26074 function weekdaysRegex(isStrict) {
26075 if (this._weekdaysParseExact) {
26076 if (!hasOwnProp(this, '_weekdaysRegex')) {
26077 computeWeekdaysParse.call(this);
26078 }
26079
26080 if (isStrict) {
26081 return this._weekdaysStrictRegex;
26082 } else {
26083 return this._weekdaysRegex;
26084 }
26085 } else {
26086 if (!hasOwnProp(this, '_weekdaysRegex')) {
26087 this._weekdaysRegex = defaultWeekdaysRegex;
26088 }
26089
26090 return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
26091 }
26092 }
26093
26094 var defaultWeekdaysShortRegex = matchWord;
26095
26096 function weekdaysShortRegex(isStrict) {
26097 if (this._weekdaysParseExact) {
26098 if (!hasOwnProp(this, '_weekdaysRegex')) {
26099 computeWeekdaysParse.call(this);
26100 }
26101
26102 if (isStrict) {
26103 return this._weekdaysShortStrictRegex;
26104 } else {
26105 return this._weekdaysShortRegex;
26106 }
26107 } else {
26108 if (!hasOwnProp(this, '_weekdaysShortRegex')) {
26109 this._weekdaysShortRegex = defaultWeekdaysShortRegex;
26110 }
26111
26112 return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
26113 }
26114 }
26115
26116 var defaultWeekdaysMinRegex = matchWord;
26117
26118 function weekdaysMinRegex(isStrict) {
26119 if (this._weekdaysParseExact) {
26120 if (!hasOwnProp(this, '_weekdaysRegex')) {
26121 computeWeekdaysParse.call(this);
26122 }
26123
26124 if (isStrict) {
26125 return this._weekdaysMinStrictRegex;
26126 } else {
26127 return this._weekdaysMinRegex;
26128 }
26129 } else {
26130 if (!hasOwnProp(this, '_weekdaysMinRegex')) {
26131 this._weekdaysMinRegex = defaultWeekdaysMinRegex;
26132 }
26133
26134 return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
26135 }
26136 }
26137
26138 function computeWeekdaysParse() {
26139 function cmpLenRev(a, b) {
26140 return b.length - a.length;
26141 }
26142
26143 var minPieces = [],
26144 shortPieces = [],
26145 longPieces = [],
26146 mixedPieces = [],
26147 i,
26148 mom,
26149 minp,
26150 shortp,
26151 longp;
26152
26153 for (i = 0; i < 7; i++) {
26154 // make the regex if we don't have it already
26155 mom = createUTC([2000, 1]).day(i);
26156 minp = this.weekdaysMin(mom, '');
26157 shortp = this.weekdaysShort(mom, '');
26158 longp = this.weekdays(mom, '');
26159 minPieces.push(minp);
26160 shortPieces.push(shortp);
26161 longPieces.push(longp);
26162 mixedPieces.push(minp);
26163 mixedPieces.push(shortp);
26164 mixedPieces.push(longp);
26165 } // Sorting makes sure if one weekday (or abbr) is a prefix of another it
26166 // will match the longer piece.
26167
26168
26169 minPieces.sort(cmpLenRev);
26170 shortPieces.sort(cmpLenRev);
26171 longPieces.sort(cmpLenRev);
26172 mixedPieces.sort(cmpLenRev);
26173
26174 for (i = 0; i < 7; i++) {
26175 shortPieces[i] = regexEscape(shortPieces[i]);
26176 longPieces[i] = regexEscape(longPieces[i]);
26177 mixedPieces[i] = regexEscape(mixedPieces[i]);
26178 }
26179
26180 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
26181 this._weekdaysShortRegex = this._weekdaysRegex;
26182 this._weekdaysMinRegex = this._weekdaysRegex;
26183 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
26184 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
26185 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
26186 } // FORMATTING
26187
26188
26189 function hFormat() {
26190 return this.hours() % 12 || 12;
26191 }
26192
26193 function kFormat() {
26194 return this.hours() || 24;
26195 }
26196
26197 addFormatToken('H', ['HH', 2], 0, 'hour');
26198 addFormatToken('h', ['hh', 2], 0, hFormat);
26199 addFormatToken('k', ['kk', 2], 0, kFormat);
26200 addFormatToken('hmm', 0, 0, function () {
26201 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
26202 });
26203 addFormatToken('hmmss', 0, 0, function () {
26204 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
26205 });
26206 addFormatToken('Hmm', 0, 0, function () {
26207 return '' + this.hours() + zeroFill(this.minutes(), 2);
26208 });
26209 addFormatToken('Hmmss', 0, 0, function () {
26210 return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
26211 });
26212
26213 function meridiem(token, lowercase) {
26214 addFormatToken(token, 0, 0, function () {
26215 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
26216 });
26217 }
26218
26219 meridiem('a', true);
26220 meridiem('A', false); // ALIASES
26221
26222 addUnitAlias('hour', 'h'); // PRIORITY
26223
26224 addUnitPriority('hour', 13); // PARSING
26225
26226 function matchMeridiem(isStrict, locale) {
26227 return locale._meridiemParse;
26228 }
26229
26230 addRegexToken('a', matchMeridiem);
26231 addRegexToken('A', matchMeridiem);
26232 addRegexToken('H', match1to2);
26233 addRegexToken('h', match1to2);
26234 addRegexToken('k', match1to2);
26235 addRegexToken('HH', match1to2, match2);
26236 addRegexToken('hh', match1to2, match2);
26237 addRegexToken('kk', match1to2, match2);
26238 addRegexToken('hmm', match3to4);
26239 addRegexToken('hmmss', match5to6);
26240 addRegexToken('Hmm', match3to4);
26241 addRegexToken('Hmmss', match5to6);
26242 addParseToken(['H', 'HH'], HOUR);
26243 addParseToken(['k', 'kk'], function (input, array, config) {
26244 var kInput = toInt(input);
26245 array[HOUR] = kInput === 24 ? 0 : kInput;
26246 });
26247 addParseToken(['a', 'A'], function (input, array, config) {
26248 config._isPm = config._locale.isPM(input);
26249 config._meridiem = input;
26250 });
26251 addParseToken(['h', 'hh'], function (input, array, config) {
26252 array[HOUR] = toInt(input);
26253 getParsingFlags(config).bigHour = true;
26254 });
26255 addParseToken('hmm', function (input, array, config) {
26256 var pos = input.length - 2;
26257 array[HOUR] = toInt(input.substr(0, pos));
26258 array[MINUTE] = toInt(input.substr(pos));
26259 getParsingFlags(config).bigHour = true;
26260 });
26261 addParseToken('hmmss', function (input, array, config) {
26262 var pos1 = input.length - 4;
26263 var pos2 = input.length - 2;
26264 array[HOUR] = toInt(input.substr(0, pos1));
26265 array[MINUTE] = toInt(input.substr(pos1, 2));
26266 array[SECOND] = toInt(input.substr(pos2));
26267 getParsingFlags(config).bigHour = true;
26268 });
26269 addParseToken('Hmm', function (input, array, config) {
26270 var pos = input.length - 2;
26271 array[HOUR] = toInt(input.substr(0, pos));
26272 array[MINUTE] = toInt(input.substr(pos));
26273 });
26274 addParseToken('Hmmss', function (input, array, config) {
26275 var pos1 = input.length - 4;
26276 var pos2 = input.length - 2;
26277 array[HOUR] = toInt(input.substr(0, pos1));
26278 array[MINUTE] = toInt(input.substr(pos1, 2));
26279 array[SECOND] = toInt(input.substr(pos2));
26280 }); // LOCALES
26281
26282 function localeIsPM(input) {
26283 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
26284 // Using charAt should be more compatible.
26285 return (input + '').toLowerCase().charAt(0) === 'p';
26286 }
26287
26288 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
26289
26290 function localeMeridiem(hours, minutes, isLower) {
26291 if (hours > 11) {
26292 return isLower ? 'pm' : 'PM';
26293 } else {
26294 return isLower ? 'am' : 'AM';
26295 }
26296 } // MOMENTS
26297 // Setting the hour should keep the time, because the user explicitly
26298 // specified which hour they want. So trying to maintain the same hour (in
26299 // a new timezone) makes sense. Adding/subtracting hours does not follow
26300 // this rule.
26301
26302
26303 var getSetHour = makeGetSet('Hours', true);
26304 var baseConfig = {
26305 calendar: defaultCalendar,
26306 longDateFormat: defaultLongDateFormat,
26307 invalidDate: defaultInvalidDate,
26308 ordinal: defaultOrdinal,
26309 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
26310 relativeTime: defaultRelativeTime,
26311 months: defaultLocaleMonths,
26312 monthsShort: defaultLocaleMonthsShort,
26313 week: defaultLocaleWeek,
26314 weekdays: defaultLocaleWeekdays,
26315 weekdaysMin: defaultLocaleWeekdaysMin,
26316 weekdaysShort: defaultLocaleWeekdaysShort,
26317 meridiemParse: defaultLocaleMeridiemParse
26318 }; // internal storage for locale config files
26319
26320 var locales = {};
26321 var localeFamilies = {};
26322 var globalLocale;
26323
26324 function normalizeLocale(key) {
26325 return key ? key.toLowerCase().replace('_', '-') : key;
26326 } // pick the locale from the array
26327 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
26328 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
26329
26330
26331 function chooseLocale(names) {
26332 var i = 0,
26333 j,
26334 next,
26335 locale,
26336 split;
26337
26338 while (i < names.length) {
26339 split = normalizeLocale(names[i]).split('-');
26340 j = split.length;
26341 next = normalizeLocale(names[i + 1]);
26342 next = next ? next.split('-') : null;
26343
26344 while (j > 0) {
26345 locale = loadLocale(split.slice(0, j).join('-'));
26346
26347 if (locale) {
26348 return locale;
26349 }
26350
26351 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
26352 //the next array item is better than a shallower substring of this one
26353 break;
26354 }
26355
26356 j--;
26357 }
26358
26359 i++;
26360 }
26361
26362 return globalLocale;
26363 }
26364
26365 function loadLocale(name) {
26366 var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node
26367
26368 if (!locales[name] && 'object' !== 'undefined' && module && module.exports) {
26369 try {
26370 oldLocale = globalLocale._abbr;
26371 var aliasedRequire = commonjsRequire;
26372 aliasedRequire('./locale/' + name);
26373 getSetGlobalLocale(oldLocale);
26374 } catch (e) {}
26375 }
26376
26377 return locales[name];
26378 } // This function will load locale and then set the global locale. If
26379 // no arguments are passed in, it will simply return the current global
26380 // locale key.
26381
26382
26383 function getSetGlobalLocale(key, values) {
26384 var data;
26385
26386 if (key) {
26387 if (isUndefined(values)) {
26388 data = getLocale(key);
26389 } else {
26390 data = defineLocale(key, values);
26391 }
26392
26393 if (data) {
26394 // moment.duration._locale = moment._locale = data;
26395 globalLocale = data;
26396 } else {
26397 if (typeof console !== 'undefined' && console.warn) {
26398 //warn user if arguments are passed but the locale could not be set
26399 console.warn('Locale ' + key + ' not found. Did you forget to load it?');
26400 }
26401 }
26402 }
26403
26404 return globalLocale._abbr;
26405 }
26406
26407 function defineLocale(name, config) {
26408 if (config !== null) {
26409 var locale,
26410 parentConfig = baseConfig;
26411 config.abbr = name;
26412
26413 if (locales[name] != null) {
26414 deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
26415 parentConfig = locales[name]._config;
26416 } else if (config.parentLocale != null) {
26417 if (locales[config.parentLocale] != null) {
26418 parentConfig = locales[config.parentLocale]._config;
26419 } else {
26420 locale = loadLocale(config.parentLocale);
26421
26422 if (locale != null) {
26423 parentConfig = locale._config;
26424 } else {
26425 if (!localeFamilies[config.parentLocale]) {
26426 localeFamilies[config.parentLocale] = [];
26427 }
26428
26429 localeFamilies[config.parentLocale].push({
26430 name: name,
26431 config: config
26432 });
26433 return null;
26434 }
26435 }
26436 }
26437
26438 locales[name] = new Locale(mergeConfigs(parentConfig, config));
26439
26440 if (localeFamilies[name]) {
26441 localeFamilies[name].forEach(function (x) {
26442 defineLocale(x.name, x.config);
26443 });
26444 } // backwards compat for now: also set the locale
26445 // make sure we set the locale AFTER all child locales have been
26446 // created, so we won't end up with the child locale set.
26447
26448
26449 getSetGlobalLocale(name);
26450 return locales[name];
26451 } else {
26452 // useful for testing
26453 delete locales[name];
26454 return null;
26455 }
26456 }
26457
26458 function updateLocale(name, config) {
26459 if (config != null) {
26460 var locale,
26461 tmpLocale,
26462 parentConfig = baseConfig; // MERGE
26463
26464 tmpLocale = loadLocale(name);
26465
26466 if (tmpLocale != null) {
26467 parentConfig = tmpLocale._config;
26468 }
26469
26470 config = mergeConfigs(parentConfig, config);
26471 locale = new Locale(config);
26472 locale.parentLocale = locales[name];
26473 locales[name] = locale; // backwards compat for now: also set the locale
26474
26475 getSetGlobalLocale(name);
26476 } else {
26477 // pass null for config to unupdate, useful for tests
26478 if (locales[name] != null) {
26479 if (locales[name].parentLocale != null) {
26480 locales[name] = locales[name].parentLocale;
26481 } else if (locales[name] != null) {
26482 delete locales[name];
26483 }
26484 }
26485 }
26486
26487 return locales[name];
26488 } // returns locale data
26489
26490
26491 function getLocale(key) {
26492 var locale;
26493
26494 if (key && key._locale && key._locale._abbr) {
26495 key = key._locale._abbr;
26496 }
26497
26498 if (!key) {
26499 return globalLocale;
26500 }
26501
26502 if (!isArray(key)) {
26503 //short-circuit everything else
26504 locale = loadLocale(key);
26505
26506 if (locale) {
26507 return locale;
26508 }
26509
26510 key = [key];
26511 }
26512
26513 return chooseLocale(key);
26514 }
26515
26516 function listLocales() {
26517 return keys(locales);
26518 }
26519
26520 function checkOverflow(m) {
26521 var overflow;
26522 var a = m._a;
26523
26524 if (a && getParsingFlags(m).overflow === -2) {
26525 overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
26526
26527 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
26528 overflow = DATE;
26529 }
26530
26531 if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
26532 overflow = WEEK;
26533 }
26534
26535 if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
26536 overflow = WEEKDAY;
26537 }
26538
26539 getParsingFlags(m).overflow = overflow;
26540 }
26541
26542 return m;
26543 } // Pick the first defined of two or three arguments.
26544
26545
26546 function defaults(a, b, c) {
26547 if (a != null) {
26548 return a;
26549 }
26550
26551 if (b != null) {
26552 return b;
26553 }
26554
26555 return c;
26556 }
26557
26558 function currentDateArray(config) {
26559 // hooks is actually the exported moment object
26560 var nowValue = new Date(hooks.now());
26561
26562 if (config._useUTC) {
26563 return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
26564 }
26565
26566 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
26567 } // convert an array to a date.
26568 // the array should mirror the parameters below
26569 // note: all values past the year are optional and will default to the lowest possible value.
26570 // [year, month, day , hour, minute, second, millisecond]
26571
26572
26573 function configFromArray(config) {
26574 var i,
26575 date,
26576 input = [],
26577 currentDate,
26578 expectedWeekday,
26579 yearToUse;
26580
26581 if (config._d) {
26582 return;
26583 }
26584
26585 currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays
26586
26587 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
26588 dayOfYearFromWeekInfo(config);
26589 } //if the day of the year is set, figure out what it is
26590
26591
26592 if (config._dayOfYear != null) {
26593 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
26594
26595 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
26596 getParsingFlags(config)._overflowDayOfYear = true;
26597 }
26598
26599 date = createUTCDate(yearToUse, 0, config._dayOfYear);
26600 config._a[MONTH] = date.getUTCMonth();
26601 config._a[DATE] = date.getUTCDate();
26602 } // Default to current date.
26603 // * if no year, month, day of month are given, default to today
26604 // * if day of month is given, default month and year
26605 // * if month is given, default only year
26606 // * if year is given, don't default anything
26607
26608
26609 for (i = 0; i < 3 && config._a[i] == null; ++i) {
26610 config._a[i] = input[i] = currentDate[i];
26611 } // Zero out whatever was not defaulted, including time
26612
26613
26614 for (; i < 7; i++) {
26615 config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
26616 } // Check for 24:00:00.000
26617
26618
26619 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
26620 config._nextDay = true;
26621 config._a[HOUR] = 0;
26622 }
26623
26624 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
26625 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed
26626 // with parseZone.
26627
26628 if (config._tzm != null) {
26629 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
26630 }
26631
26632 if (config._nextDay) {
26633 config._a[HOUR] = 24;
26634 } // check for mismatching day of week
26635
26636
26637 if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
26638 getParsingFlags(config).weekdayMismatch = true;
26639 }
26640 }
26641
26642 function dayOfYearFromWeekInfo(config) {
26643 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
26644 w = config._w;
26645
26646 if (w.GG != null || w.W != null || w.E != null) {
26647 dow = 1;
26648 doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on
26649 // how we interpret now (local, utc, fixed offset). So create
26650 // a now version of current config (take local/utc/offset flags, and
26651 // create now).
26652
26653 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
26654 week = defaults(w.W, 1);
26655 weekday = defaults(w.E, 1);
26656
26657 if (weekday < 1 || weekday > 7) {
26658 weekdayOverflow = true;
26659 }
26660 } else {
26661 dow = config._locale._week.dow;
26662 doy = config._locale._week.doy;
26663 var curWeek = weekOfYear(createLocal(), dow, doy);
26664 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week.
26665
26666 week = defaults(w.w, curWeek.week);
26667
26668 if (w.d != null) {
26669 // weekday -- low day numbers are considered next week
26670 weekday = w.d;
26671
26672 if (weekday < 0 || weekday > 6) {
26673 weekdayOverflow = true;
26674 }
26675 } else if (w.e != null) {
26676 // local weekday -- counting starts from beginning of week
26677 weekday = w.e + dow;
26678
26679 if (w.e < 0 || w.e > 6) {
26680 weekdayOverflow = true;
26681 }
26682 } else {
26683 // default to beginning of week
26684 weekday = dow;
26685 }
26686 }
26687
26688 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
26689 getParsingFlags(config)._overflowWeeks = true;
26690 } else if (weekdayOverflow != null) {
26691 getParsingFlags(config)._overflowWeekday = true;
26692 } else {
26693 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
26694 config._a[YEAR] = temp.year;
26695 config._dayOfYear = temp.dayOfYear;
26696 }
26697 } // iso 8601 regex
26698 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
26699
26700
26701 var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
26702 var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
26703 var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
26704 var isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard
26705 ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/]]; // iso time formats and regexes
26706
26707 var isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]];
26708 var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format
26709
26710 function configFromISO(config) {
26711 var i,
26712 l,
26713 string = config._i,
26714 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
26715 allowTime,
26716 dateFormat,
26717 timeFormat,
26718 tzFormat;
26719
26720 if (match) {
26721 getParsingFlags(config).iso = true;
26722
26723 for (i = 0, l = isoDates.length; i < l; i++) {
26724 if (isoDates[i][1].exec(match[1])) {
26725 dateFormat = isoDates[i][0];
26726 allowTime = isoDates[i][2] !== false;
26727 break;
26728 }
26729 }
26730
26731 if (dateFormat == null) {
26732 config._isValid = false;
26733 return;
26734 }
26735
26736 if (match[3]) {
26737 for (i = 0, l = isoTimes.length; i < l; i++) {
26738 if (isoTimes[i][1].exec(match[3])) {
26739 // match[2] should be 'T' or space
26740 timeFormat = (match[2] || ' ') + isoTimes[i][0];
26741 break;
26742 }
26743 }
26744
26745 if (timeFormat == null) {
26746 config._isValid = false;
26747 return;
26748 }
26749 }
26750
26751 if (!allowTime && timeFormat != null) {
26752 config._isValid = false;
26753 return;
26754 }
26755
26756 if (match[4]) {
26757 if (tzRegex.exec(match[4])) {
26758 tzFormat = 'Z';
26759 } else {
26760 config._isValid = false;
26761 return;
26762 }
26763 }
26764
26765 config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
26766 configFromStringAndFormat(config);
26767 } else {
26768 config._isValid = false;
26769 }
26770 } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
26771
26772
26773 var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
26774
26775 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
26776 var result = [untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10)];
26777
26778 if (secondStr) {
26779 result.push(parseInt(secondStr, 10));
26780 }
26781
26782 return result;
26783 }
26784
26785 function untruncateYear(yearStr) {
26786 var year = parseInt(yearStr, 10);
26787
26788 if (year <= 49) {
26789 return 2000 + year;
26790 } else if (year <= 999) {
26791 return 1900 + year;
26792 }
26793
26794 return year;
26795 }
26796
26797 function preprocessRFC2822(s) {
26798 // Remove comments and folding whitespace and replace multiple-spaces with a single space
26799 return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
26800 }
26801
26802 function checkWeekday(weekdayStr, parsedInput, config) {
26803 if (weekdayStr) {
26804 // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
26805 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
26806 weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
26807
26808 if (weekdayProvided !== weekdayActual) {
26809 getParsingFlags(config).weekdayMismatch = true;
26810 config._isValid = false;
26811 return false;
26812 }
26813 }
26814
26815 return true;
26816 }
26817
26818 var obsOffsets = {
26819 UT: 0,
26820 GMT: 0,
26821 EDT: -4 * 60,
26822 EST: -5 * 60,
26823 CDT: -5 * 60,
26824 CST: -6 * 60,
26825 MDT: -6 * 60,
26826 MST: -7 * 60,
26827 PDT: -7 * 60,
26828 PST: -8 * 60
26829 };
26830
26831 function calculateOffset(obsOffset, militaryOffset, numOffset) {
26832 if (obsOffset) {
26833 return obsOffsets[obsOffset];
26834 } else if (militaryOffset) {
26835 // the only allowed military tz is Z
26836 return 0;
26837 } else {
26838 var hm = parseInt(numOffset, 10);
26839 var m = hm % 100,
26840 h = (hm - m) / 100;
26841 return h * 60 + m;
26842 }
26843 } // date and time from ref 2822 format
26844
26845
26846 function configFromRFC2822(config) {
26847 var match = rfc2822.exec(preprocessRFC2822(config._i));
26848
26849 if (match) {
26850 var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
26851
26852 if (!checkWeekday(match[1], parsedArray, config)) {
26853 return;
26854 }
26855
26856 config._a = parsedArray;
26857 config._tzm = calculateOffset(match[8], match[9], match[10]);
26858 config._d = createUTCDate.apply(null, config._a);
26859
26860 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
26861
26862 getParsingFlags(config).rfc2822 = true;
26863 } else {
26864 config._isValid = false;
26865 }
26866 } // date from iso format or fallback
26867
26868
26869 function configFromString(config) {
26870 var matched = aspNetJsonRegex.exec(config._i);
26871
26872 if (matched !== null) {
26873 config._d = new Date(+matched[1]);
26874 return;
26875 }
26876
26877 configFromISO(config);
26878
26879 if (config._isValid === false) {
26880 delete config._isValid;
26881 } else {
26882 return;
26883 }
26884
26885 configFromRFC2822(config);
26886
26887 if (config._isValid === false) {
26888 delete config._isValid;
26889 } else {
26890 return;
26891 } // Final attempt, use Input Fallback
26892
26893
26894 hooks.createFromInputFallback(config);
26895 }
26896
26897 hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) {
26898 config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
26899 }); // constant that refers to the ISO standard
26900
26901 hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form
26902
26903
26904 hooks.RFC_2822 = function () {}; // date from string and format string
26905
26906
26907 function configFromStringAndFormat(config) {
26908 // TODO: Move this to another part of the creation flow to prevent circular deps
26909 if (config._f === hooks.ISO_8601) {
26910 configFromISO(config);
26911 return;
26912 }
26913
26914 if (config._f === hooks.RFC_2822) {
26915 configFromRFC2822(config);
26916 return;
26917 }
26918
26919 config._a = [];
26920 getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC`
26921
26922 var string = '' + config._i,
26923 i,
26924 parsedInput,
26925 tokens,
26926 token,
26927 skipped,
26928 stringLength = string.length,
26929 totalParsedInputLength = 0;
26930 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
26931
26932 for (i = 0; i < tokens.length; i++) {
26933 token = tokens[i];
26934 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput,
26935 // 'regex', getParseRegexForToken(token, config));
26936
26937 if (parsedInput) {
26938 skipped = string.substr(0, string.indexOf(parsedInput));
26939
26940 if (skipped.length > 0) {
26941 getParsingFlags(config).unusedInput.push(skipped);
26942 }
26943
26944 string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
26945 totalParsedInputLength += parsedInput.length;
26946 } // don't parse if it's not a known token
26947
26948
26949 if (formatTokenFunctions[token]) {
26950 if (parsedInput) {
26951 getParsingFlags(config).empty = false;
26952 } else {
26953 getParsingFlags(config).unusedTokens.push(token);
26954 }
26955
26956 addTimeToArrayFromToken(token, parsedInput, config);
26957 } else if (config._strict && !parsedInput) {
26958 getParsingFlags(config).unusedTokens.push(token);
26959 }
26960 } // add remaining unparsed input length to the string
26961
26962
26963 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
26964
26965 if (string.length > 0) {
26966 getParsingFlags(config).unusedInput.push(string);
26967 } // clear _12h flag if hour is <= 12
26968
26969
26970 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
26971 getParsingFlags(config).bigHour = undefined;
26972 }
26973
26974 getParsingFlags(config).parsedDateParts = config._a.slice(0);
26975 getParsingFlags(config).meridiem = config._meridiem; // handle meridiem
26976
26977 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
26978 configFromArray(config);
26979 checkOverflow(config);
26980 }
26981
26982 function meridiemFixWrap(locale, hour, meridiem) {
26983 var isPm;
26984
26985 if (meridiem == null) {
26986 // nothing to do
26987 return hour;
26988 }
26989
26990 if (locale.meridiemHour != null) {
26991 return locale.meridiemHour(hour, meridiem);
26992 } else if (locale.isPM != null) {
26993 // Fallback
26994 isPm = locale.isPM(meridiem);
26995
26996 if (isPm && hour < 12) {
26997 hour += 12;
26998 }
26999
27000 if (!isPm && hour === 12) {
27001 hour = 0;
27002 }
27003
27004 return hour;
27005 } else {
27006 // this is not supposed to happen
27007 return hour;
27008 }
27009 } // date from string and array of format strings
27010
27011
27012 function configFromStringAndArray(config) {
27013 var tempConfig, bestMoment, scoreToBeat, i, currentScore;
27014
27015 if (config._f.length === 0) {
27016 getParsingFlags(config).invalidFormat = true;
27017 config._d = new Date(NaN);
27018 return;
27019 }
27020
27021 for (i = 0; i < config._f.length; i++) {
27022 currentScore = 0;
27023 tempConfig = copyConfig({}, config);
27024
27025 if (config._useUTC != null) {
27026 tempConfig._useUTC = config._useUTC;
27027 }
27028
27029 tempConfig._f = config._f[i];
27030 configFromStringAndFormat(tempConfig);
27031
27032 if (!isValid(tempConfig)) {
27033 continue;
27034 } // if there is any input that was not parsed add a penalty for that format
27035
27036
27037 currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens
27038
27039 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
27040 getParsingFlags(tempConfig).score = currentScore;
27041
27042 if (scoreToBeat == null || currentScore < scoreToBeat) {
27043 scoreToBeat = currentScore;
27044 bestMoment = tempConfig;
27045 }
27046 }
27047
27048 extend(config, bestMoment || tempConfig);
27049 }
27050
27051 function configFromObject(config) {
27052 if (config._d) {
27053 return;
27054 }
27055
27056 var i = normalizeObjectUnits(config._i);
27057 config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
27058 return obj && parseInt(obj, 10);
27059 });
27060 configFromArray(config);
27061 }
27062
27063 function createFromConfig(config) {
27064 var res = new Moment(checkOverflow(prepareConfig(config)));
27065
27066 if (res._nextDay) {
27067 // Adding is smart enough around DST
27068 res.add(1, 'd');
27069 res._nextDay = undefined;
27070 }
27071
27072 return res;
27073 }
27074
27075 function prepareConfig(config) {
27076 var input = config._i,
27077 format = config._f;
27078 config._locale = config._locale || getLocale(config._l);
27079
27080 if (input === null || format === undefined && input === '') {
27081 return createInvalid({
27082 nullInput: true
27083 });
27084 }
27085
27086 if (typeof input === 'string') {
27087 config._i = input = config._locale.preparse(input);
27088 }
27089
27090 if (isMoment(input)) {
27091 return new Moment(checkOverflow(input));
27092 } else if (isDate(input)) {
27093 config._d = input;
27094 } else if (isArray(format)) {
27095 configFromStringAndArray(config);
27096 } else if (format) {
27097 configFromStringAndFormat(config);
27098 } else {
27099 configFromInput(config);
27100 }
27101
27102 if (!isValid(config)) {
27103 config._d = null;
27104 }
27105
27106 return config;
27107 }
27108
27109 function configFromInput(config) {
27110 var input = config._i;
27111
27112 if (isUndefined(input)) {
27113 config._d = new Date(hooks.now());
27114 } else if (isDate(input)) {
27115 config._d = new Date(input.valueOf());
27116 } else if (typeof input === 'string') {
27117 configFromString(config);
27118 } else if (isArray(input)) {
27119 config._a = map(input.slice(0), function (obj) {
27120 return parseInt(obj, 10);
27121 });
27122 configFromArray(config);
27123 } else if (isObject(input)) {
27124 configFromObject(config);
27125 } else if (isNumber(input)) {
27126 // from milliseconds
27127 config._d = new Date(input);
27128 } else {
27129 hooks.createFromInputFallback(config);
27130 }
27131 }
27132
27133 function createLocalOrUTC(input, format, locale, strict, isUTC) {
27134 var c = {};
27135
27136 if (locale === true || locale === false) {
27137 strict = locale;
27138 locale = undefined;
27139 }
27140
27141 if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
27142 input = undefined;
27143 } // object construction must be done this way.
27144 // https://github.com/moment/moment/issues/1423
27145
27146
27147 c._isAMomentObject = true;
27148 c._useUTC = c._isUTC = isUTC;
27149 c._l = locale;
27150 c._i = input;
27151 c._f = format;
27152 c._strict = strict;
27153 return createFromConfig(c);
27154 }
27155
27156 function createLocal(input, format, locale, strict) {
27157 return createLocalOrUTC(input, format, locale, strict, false);
27158 }
27159
27160 var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
27161 var other = createLocal.apply(null, arguments);
27162
27163 if (this.isValid() && other.isValid()) {
27164 return other < this ? this : other;
27165 } else {
27166 return createInvalid();
27167 }
27168 });
27169 var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
27170 var other = createLocal.apply(null, arguments);
27171
27172 if (this.isValid() && other.isValid()) {
27173 return other > this ? this : other;
27174 } else {
27175 return createInvalid();
27176 }
27177 }); // Pick a moment m from moments so that m[fn](other) is true for all
27178 // other. This relies on the function fn to be transitive.
27179 //
27180 // moments should either be an array of moment objects or an array, whose
27181 // first element is an array of moment objects.
27182
27183 function pickBy(fn, moments) {
27184 var res, i;
27185
27186 if (moments.length === 1 && isArray(moments[0])) {
27187 moments = moments[0];
27188 }
27189
27190 if (!moments.length) {
27191 return createLocal();
27192 }
27193
27194 res = moments[0];
27195
27196 for (i = 1; i < moments.length; ++i) {
27197 if (!moments[i].isValid() || moments[i][fn](res)) {
27198 res = moments[i];
27199 }
27200 }
27201
27202 return res;
27203 } // TODO: Use [].sort instead?
27204
27205
27206 function min() {
27207 var args = [].slice.call(arguments, 0);
27208 return pickBy('isBefore', args);
27209 }
27210
27211 function max() {
27212 var args = [].slice.call(arguments, 0);
27213 return pickBy('isAfter', args);
27214 }
27215
27216 var now = function () {
27217 return Date.now ? Date.now() : +new Date();
27218 };
27219
27220 var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
27221
27222 function isDurationValid(m) {
27223 for (var key in m) {
27224 if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
27225 return false;
27226 }
27227 }
27228
27229 var unitHasDecimal = false;
27230
27231 for (var i = 0; i < ordering.length; ++i) {
27232 if (m[ordering[i]]) {
27233 if (unitHasDecimal) {
27234 return false; // only allow non-integers for smallest unit
27235 }
27236
27237 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
27238 unitHasDecimal = true;
27239 }
27240 }
27241 }
27242
27243 return true;
27244 }
27245
27246 function isValid$1() {
27247 return this._isValid;
27248 }
27249
27250 function createInvalid$1() {
27251 return createDuration(NaN);
27252 }
27253
27254 function Duration(duration) {
27255 var normalizedInput = normalizeObjectUnits(duration),
27256 years = normalizedInput.year || 0,
27257 quarters = normalizedInput.quarter || 0,
27258 months = normalizedInput.month || 0,
27259 weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
27260 days = normalizedInput.day || 0,
27261 hours = normalizedInput.hour || 0,
27262 minutes = normalizedInput.minute || 0,
27263 seconds = normalizedInput.second || 0,
27264 milliseconds = normalizedInput.millisecond || 0;
27265 this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove
27266
27267 this._milliseconds = +milliseconds + seconds * 1e3 + // 1000
27268 minutes * 6e4 + // 1000 * 60
27269 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
27270 // Because of dateAddRemove treats 24 hours as different from a
27271 // day when working around DST, we need to store them separately
27272
27273 this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing
27274 // which months you are are talking about, so we have to store
27275 // it separately.
27276
27277 this._months = +months + quarters * 3 + years * 12;
27278 this._data = {};
27279 this._locale = getLocale();
27280
27281 this._bubble();
27282 }
27283
27284 function isDuration(obj) {
27285 return obj instanceof Duration;
27286 }
27287
27288 function absRound(number) {
27289 if (number < 0) {
27290 return Math.round(-1 * number) * -1;
27291 } else {
27292 return Math.round(number);
27293 }
27294 } // FORMATTING
27295
27296
27297 function offset(token, separator) {
27298 addFormatToken(token, 0, 0, function () {
27299 var offset = this.utcOffset();
27300 var sign = '+';
27301
27302 if (offset < 0) {
27303 offset = -offset;
27304 sign = '-';
27305 }
27306
27307 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);
27308 });
27309 }
27310
27311 offset('Z', ':');
27312 offset('ZZ', ''); // PARSING
27313
27314 addRegexToken('Z', matchShortOffset);
27315 addRegexToken('ZZ', matchShortOffset);
27316 addParseToken(['Z', 'ZZ'], function (input, array, config) {
27317 config._useUTC = true;
27318 config._tzm = offsetFromString(matchShortOffset, input);
27319 }); // HELPERS
27320 // timezone chunker
27321 // '+10:00' > ['10', '00']
27322 // '-1530' > ['-15', '30']
27323
27324 var chunkOffset = /([\+\-]|\d\d)/gi;
27325
27326 function offsetFromString(matcher, string) {
27327 var matches = (string || '').match(matcher);
27328
27329 if (matches === null) {
27330 return null;
27331 }
27332
27333 var chunk = matches[matches.length - 1] || [];
27334 var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
27335 var minutes = +(parts[1] * 60) + toInt(parts[2]);
27336 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
27337 } // Return a moment from input, that is local/utc/zone equivalent to model.
27338
27339
27340 function cloneWithOffset(input, model) {
27341 var res, diff;
27342
27343 if (model._isUTC) {
27344 res = model.clone();
27345 diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api.
27346
27347 res._d.setTime(res._d.valueOf() + diff);
27348
27349 hooks.updateOffset(res, false);
27350 return res;
27351 } else {
27352 return createLocal(input).local();
27353 }
27354 }
27355
27356 function getDateOffset(m) {
27357 // On Firefox.24 Date#getTimezoneOffset returns a floating point.
27358 // https://github.com/moment/moment/pull/1871
27359 return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
27360 } // HOOKS
27361 // This function will be called whenever a moment is mutated.
27362 // It is intended to keep the offset in sync with the timezone.
27363
27364
27365 hooks.updateOffset = function () {}; // MOMENTS
27366 // keepLocalTime = true means only change the timezone, without
27367 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
27368 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
27369 // +0200, so we adjust the time as needed, to be valid.
27370 //
27371 // Keeping the time actually adds/subtracts (one hour)
27372 // from the actual represented time. That is why we call updateOffset
27373 // a second time. In case it wants us to change the offset again
27374 // _changeInProgress == true case, then we have to adjust, because
27375 // there is no such time in the given timezone.
27376
27377
27378 function getSetOffset(input, keepLocalTime, keepMinutes) {
27379 var offset = this._offset || 0,
27380 localAdjust;
27381
27382 if (!this.isValid()) {
27383 return input != null ? this : NaN;
27384 }
27385
27386 if (input != null) {
27387 if (typeof input === 'string') {
27388 input = offsetFromString(matchShortOffset, input);
27389
27390 if (input === null) {
27391 return this;
27392 }
27393 } else if (Math.abs(input) < 16 && !keepMinutes) {
27394 input = input * 60;
27395 }
27396
27397 if (!this._isUTC && keepLocalTime) {
27398 localAdjust = getDateOffset(this);
27399 }
27400
27401 this._offset = input;
27402 this._isUTC = true;
27403
27404 if (localAdjust != null) {
27405 this.add(localAdjust, 'm');
27406 }
27407
27408 if (offset !== input) {
27409 if (!keepLocalTime || this._changeInProgress) {
27410 addSubtract(this, createDuration(input - offset, 'm'), 1, false);
27411 } else if (!this._changeInProgress) {
27412 this._changeInProgress = true;
27413 hooks.updateOffset(this, true);
27414 this._changeInProgress = null;
27415 }
27416 }
27417
27418 return this;
27419 } else {
27420 return this._isUTC ? offset : getDateOffset(this);
27421 }
27422 }
27423
27424 function getSetZone(input, keepLocalTime) {
27425 if (input != null) {
27426 if (typeof input !== 'string') {
27427 input = -input;
27428 }
27429
27430 this.utcOffset(input, keepLocalTime);
27431 return this;
27432 } else {
27433 return -this.utcOffset();
27434 }
27435 }
27436
27437 function setOffsetToUTC(keepLocalTime) {
27438 return this.utcOffset(0, keepLocalTime);
27439 }
27440
27441 function setOffsetToLocal(keepLocalTime) {
27442 if (this._isUTC) {
27443 this.utcOffset(0, keepLocalTime);
27444 this._isUTC = false;
27445
27446 if (keepLocalTime) {
27447 this.subtract(getDateOffset(this), 'm');
27448 }
27449 }
27450
27451 return this;
27452 }
27453
27454 function setOffsetToParsedOffset() {
27455 if (this._tzm != null) {
27456 this.utcOffset(this._tzm, false, true);
27457 } else if (typeof this._i === 'string') {
27458 var tZone = offsetFromString(matchOffset, this._i);
27459
27460 if (tZone != null) {
27461 this.utcOffset(tZone);
27462 } else {
27463 this.utcOffset(0, true);
27464 }
27465 }
27466
27467 return this;
27468 }
27469
27470 function hasAlignedHourOffset(input) {
27471 if (!this.isValid()) {
27472 return false;
27473 }
27474
27475 input = input ? createLocal(input).utcOffset() : 0;
27476 return (this.utcOffset() - input) % 60 === 0;
27477 }
27478
27479 function isDaylightSavingTime() {
27480 return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
27481 }
27482
27483 function isDaylightSavingTimeShifted() {
27484 if (!isUndefined(this._isDSTShifted)) {
27485 return this._isDSTShifted;
27486 }
27487
27488 var c = {};
27489 copyConfig(c, this);
27490 c = prepareConfig(c);
27491
27492 if (c._a) {
27493 var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
27494 this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
27495 } else {
27496 this._isDSTShifted = false;
27497 }
27498
27499 return this._isDSTShifted;
27500 }
27501
27502 function isLocal() {
27503 return this.isValid() ? !this._isUTC : false;
27504 }
27505
27506 function isUtcOffset() {
27507 return this.isValid() ? this._isUTC : false;
27508 }
27509
27510 function isUtc() {
27511 return this.isValid() ? this._isUTC && this._offset === 0 : false;
27512 } // ASP.NET json date format regex
27513
27514
27515 var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
27516 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
27517 // and further modified to allow for strings containing both week and day
27518
27519 var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
27520
27521 function createDuration(input, key) {
27522 var duration = input,
27523 // matching against regexp is expensive, do it on demand
27524 match = null,
27525 sign,
27526 ret,
27527 diffRes;
27528
27529 if (isDuration(input)) {
27530 duration = {
27531 ms: input._milliseconds,
27532 d: input._days,
27533 M: input._months
27534 };
27535 } else if (isNumber(input)) {
27536 duration = {};
27537
27538 if (key) {
27539 duration[key] = input;
27540 } else {
27541 duration.milliseconds = input;
27542 }
27543 } else if (!!(match = aspNetRegex.exec(input))) {
27544 sign = match[1] === '-' ? -1 : 1;
27545 duration = {
27546 y: 0,
27547 d: toInt(match[DATE]) * sign,
27548 h: toInt(match[HOUR]) * sign,
27549 m: toInt(match[MINUTE]) * sign,
27550 s: toInt(match[SECOND]) * sign,
27551 ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
27552
27553 };
27554 } else if (!!(match = isoRegex.exec(input))) {
27555 sign = match[1] === '-' ? -1 : 1;
27556 duration = {
27557 y: parseIso(match[2], sign),
27558 M: parseIso(match[3], sign),
27559 w: parseIso(match[4], sign),
27560 d: parseIso(match[5], sign),
27561 h: parseIso(match[6], sign),
27562 m: parseIso(match[7], sign),
27563 s: parseIso(match[8], sign)
27564 };
27565 } else if (duration == null) {
27566 // checks for null or undefined
27567 duration = {};
27568 } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
27569 diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
27570 duration = {};
27571 duration.ms = diffRes.milliseconds;
27572 duration.M = diffRes.months;
27573 }
27574
27575 ret = new Duration(duration);
27576
27577 if (isDuration(input) && hasOwnProp(input, '_locale')) {
27578 ret._locale = input._locale;
27579 }
27580
27581 return ret;
27582 }
27583
27584 createDuration.fn = Duration.prototype;
27585 createDuration.invalid = createInvalid$1;
27586
27587 function parseIso(inp, sign) {
27588 // We'd normally use ~~inp for this, but unfortunately it also
27589 // converts floats to ints.
27590 // inp may be undefined, so careful calling replace on it.
27591 var res = inp && parseFloat(inp.replace(',', '.')); // apply sign while we're at it
27592
27593 return (isNaN(res) ? 0 : res) * sign;
27594 }
27595
27596 function positiveMomentsDifference(base, other) {
27597 var res = {};
27598 res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
27599
27600 if (base.clone().add(res.months, 'M').isAfter(other)) {
27601 --res.months;
27602 }
27603
27604 res.milliseconds = +other - +base.clone().add(res.months, 'M');
27605 return res;
27606 }
27607
27608 function momentsDifference(base, other) {
27609 var res;
27610
27611 if (!(base.isValid() && other.isValid())) {
27612 return {
27613 milliseconds: 0,
27614 months: 0
27615 };
27616 }
27617
27618 other = cloneWithOffset(other, base);
27619
27620 if (base.isBefore(other)) {
27621 res = positiveMomentsDifference(base, other);
27622 } else {
27623 res = positiveMomentsDifference(other, base);
27624 res.milliseconds = -res.milliseconds;
27625 res.months = -res.months;
27626 }
27627
27628 return res;
27629 } // TODO: remove 'name' arg after deprecation is removed
27630
27631
27632 function createAdder(direction, name) {
27633 return function (val, period) {
27634 var dur, tmp; //invert the arguments, but complain about it
27635
27636 if (period !== null && !isNaN(+period)) {
27637 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
27638 tmp = val;
27639 val = period;
27640 period = tmp;
27641 }
27642
27643 val = typeof val === 'string' ? +val : val;
27644 dur = createDuration(val, period);
27645 addSubtract(this, dur, direction);
27646 return this;
27647 };
27648 }
27649
27650 function addSubtract(mom, duration, isAdding, updateOffset) {
27651 var milliseconds = duration._milliseconds,
27652 days = absRound(duration._days),
27653 months = absRound(duration._months);
27654
27655 if (!mom.isValid()) {
27656 // No op
27657 return;
27658 }
27659
27660 updateOffset = updateOffset == null ? true : updateOffset;
27661
27662 if (months) {
27663 setMonth(mom, get(mom, 'Month') + months * isAdding);
27664 }
27665
27666 if (days) {
27667 set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
27668 }
27669
27670 if (milliseconds) {
27671 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
27672 }
27673
27674 if (updateOffset) {
27675 hooks.updateOffset(mom, days || months);
27676 }
27677 }
27678
27679 var add = createAdder(1, 'add');
27680 var subtract = createAdder(-1, 'subtract');
27681
27682 function getCalendarFormat(myMoment, now) {
27683 var diff = myMoment.diff(now, 'days', true);
27684 return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse';
27685 }
27686
27687 function calendar$1(time, formats) {
27688 // We want to compare the start of today, vs this.
27689 // Getting start-of-today depends on whether we're local/utc/offset or not.
27690 var now = time || createLocal(),
27691 sod = cloneWithOffset(now, this).startOf('day'),
27692 format = hooks.calendarFormat(this, sod) || 'sameElse';
27693 var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
27694 return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
27695 }
27696
27697 function clone() {
27698 return new Moment(this);
27699 }
27700
27701 function isAfter(input, units) {
27702 var localInput = isMoment(input) ? input : createLocal(input);
27703
27704 if (!(this.isValid() && localInput.isValid())) {
27705 return false;
27706 }
27707
27708 units = normalizeUnits(units) || 'millisecond';
27709
27710 if (units === 'millisecond') {
27711 return this.valueOf() > localInput.valueOf();
27712 } else {
27713 return localInput.valueOf() < this.clone().startOf(units).valueOf();
27714 }
27715 }
27716
27717 function isBefore(input, units) {
27718 var localInput = isMoment(input) ? input : createLocal(input);
27719
27720 if (!(this.isValid() && localInput.isValid())) {
27721 return false;
27722 }
27723
27724 units = normalizeUnits(units) || 'millisecond';
27725
27726 if (units === 'millisecond') {
27727 return this.valueOf() < localInput.valueOf();
27728 } else {
27729 return this.clone().endOf(units).valueOf() < localInput.valueOf();
27730 }
27731 }
27732
27733 function isBetween(from, to, units, inclusivity) {
27734 var localFrom = isMoment(from) ? from : createLocal(from),
27735 localTo = isMoment(to) ? to : createLocal(to);
27736
27737 if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
27738 return false;
27739 }
27740
27741 inclusivity = inclusivity || '()';
27742 return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
27743 }
27744
27745 function isSame(input, units) {
27746 var localInput = isMoment(input) ? input : createLocal(input),
27747 inputMs;
27748
27749 if (!(this.isValid() && localInput.isValid())) {
27750 return false;
27751 }
27752
27753 units = normalizeUnits(units) || 'millisecond';
27754
27755 if (units === 'millisecond') {
27756 return this.valueOf() === localInput.valueOf();
27757 } else {
27758 inputMs = localInput.valueOf();
27759 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
27760 }
27761 }
27762
27763 function isSameOrAfter(input, units) {
27764 return this.isSame(input, units) || this.isAfter(input, units);
27765 }
27766
27767 function isSameOrBefore(input, units) {
27768 return this.isSame(input, units) || this.isBefore(input, units);
27769 }
27770
27771 function diff(input, units, asFloat) {
27772 var that, zoneDelta, output;
27773
27774 if (!this.isValid()) {
27775 return NaN;
27776 }
27777
27778 that = cloneWithOffset(input, this);
27779
27780 if (!that.isValid()) {
27781 return NaN;
27782 }
27783
27784 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
27785 units = normalizeUnits(units);
27786
27787 switch (units) {
27788 case 'year':
27789 output = monthDiff(this, that) / 12;
27790 break;
27791
27792 case 'month':
27793 output = monthDiff(this, that);
27794 break;
27795
27796 case 'quarter':
27797 output = monthDiff(this, that) / 3;
27798 break;
27799
27800 case 'second':
27801 output = (this - that) / 1e3;
27802 break;
27803 // 1000
27804
27805 case 'minute':
27806 output = (this - that) / 6e4;
27807 break;
27808 // 1000 * 60
27809
27810 case 'hour':
27811 output = (this - that) / 36e5;
27812 break;
27813 // 1000 * 60 * 60
27814
27815 case 'day':
27816 output = (this - that - zoneDelta) / 864e5;
27817 break;
27818 // 1000 * 60 * 60 * 24, negate dst
27819
27820 case 'week':
27821 output = (this - that - zoneDelta) / 6048e5;
27822 break;
27823 // 1000 * 60 * 60 * 24 * 7, negate dst
27824
27825 default:
27826 output = this - that;
27827 }
27828
27829 return asFloat ? output : absFloor(output);
27830 }
27831
27832 function monthDiff(a, b) {
27833 // difference in months
27834 var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
27835 // b is in (anchor - 1 month, anchor + 1 month)
27836 anchor = a.clone().add(wholeMonthDiff, 'months'),
27837 anchor2,
27838 adjust;
27839
27840 if (b - anchor < 0) {
27841 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month
27842
27843 adjust = (b - anchor) / (anchor - anchor2);
27844 } else {
27845 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month
27846
27847 adjust = (b - anchor) / (anchor2 - anchor);
27848 } //check for negative zero, return zero if negative zero
27849
27850
27851 return -(wholeMonthDiff + adjust) || 0;
27852 }
27853
27854 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
27855 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
27856
27857 function toString() {
27858 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
27859 }
27860
27861 function toISOString(keepOffset) {
27862 if (!this.isValid()) {
27863 return null;
27864 }
27865
27866 var utc = keepOffset !== true;
27867 var m = utc ? this.clone().utc() : this;
27868
27869 if (m.year() < 0 || m.year() > 9999) {
27870 return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
27871 }
27872
27873 if (isFunction(Date.prototype.toISOString)) {
27874 // native implementation is ~50x faster, use it when we can
27875 if (utc) {
27876 return this.toDate().toISOString();
27877 } else {
27878 return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
27879 }
27880 }
27881
27882 return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
27883 }
27884 /**
27885 * Return a human readable representation of a moment that can
27886 * also be evaluated to get a new moment which is the same
27887 *
27888 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
27889 */
27890
27891
27892 function inspect() {
27893 if (!this.isValid()) {
27894 return 'moment.invalid(/* ' + this._i + ' */)';
27895 }
27896
27897 var func = 'moment';
27898 var zone = '';
27899
27900 if (!this.isLocal()) {
27901 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
27902 zone = 'Z';
27903 }
27904
27905 var prefix = '[' + func + '("]';
27906 var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
27907 var datetime = '-MM-DD[T]HH:mm:ss.SSS';
27908 var suffix = zone + '[")]';
27909 return this.format(prefix + year + datetime + suffix);
27910 }
27911
27912 function format(inputString) {
27913 if (!inputString) {
27914 inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
27915 }
27916
27917 var output = formatMoment(this, inputString);
27918 return this.localeData().postformat(output);
27919 }
27920
27921 function from(time, withoutSuffix) {
27922 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
27923 return createDuration({
27924 to: this,
27925 from: time
27926 }).locale(this.locale()).humanize(!withoutSuffix);
27927 } else {
27928 return this.localeData().invalidDate();
27929 }
27930 }
27931
27932 function fromNow(withoutSuffix) {
27933 return this.from(createLocal(), withoutSuffix);
27934 }
27935
27936 function to(time, withoutSuffix) {
27937 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
27938 return createDuration({
27939 from: this,
27940 to: time
27941 }).locale(this.locale()).humanize(!withoutSuffix);
27942 } else {
27943 return this.localeData().invalidDate();
27944 }
27945 }
27946
27947 function toNow(withoutSuffix) {
27948 return this.to(createLocal(), withoutSuffix);
27949 } // If passed a locale key, it will set the locale for this
27950 // instance. Otherwise, it will return the locale configuration
27951 // variables for this instance.
27952
27953
27954 function locale(key) {
27955 var newLocaleData;
27956
27957 if (key === undefined) {
27958 return this._locale._abbr;
27959 } else {
27960 newLocaleData = getLocale(key);
27961
27962 if (newLocaleData != null) {
27963 this._locale = newLocaleData;
27964 }
27965
27966 return this;
27967 }
27968 }
27969
27970 var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) {
27971 if (key === undefined) {
27972 return this.localeData();
27973 } else {
27974 return this.locale(key);
27975 }
27976 });
27977
27978 function localeData() {
27979 return this._locale;
27980 }
27981
27982 var MS_PER_SECOND = 1000;
27983 var MS_PER_MINUTE = 60 * MS_PER_SECOND;
27984 var MS_PER_HOUR = 60 * MS_PER_MINUTE;
27985 var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970):
27986
27987 function mod$1(dividend, divisor) {
27988 return (dividend % divisor + divisor) % divisor;
27989 }
27990
27991 function localStartOfDate(y, m, d) {
27992 // the date constructor remaps years 0-99 to 1900-1999
27993 if (y < 100 && y >= 0) {
27994 // preserve leap years using a full 400 year cycle, then reset
27995 return new Date(y + 400, m, d) - MS_PER_400_YEARS;
27996 } else {
27997 return new Date(y, m, d).valueOf();
27998 }
27999 }
28000
28001 function utcStartOfDate(y, m, d) {
28002 // Date.UTC remaps years 0-99 to 1900-1999
28003 if (y < 100 && y >= 0) {
28004 // preserve leap years using a full 400 year cycle, then reset
28005 return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
28006 } else {
28007 return Date.UTC(y, m, d);
28008 }
28009 }
28010
28011 function startOf(units) {
28012 var time;
28013 units = normalizeUnits(units);
28014
28015 if (units === undefined || units === 'millisecond' || !this.isValid()) {
28016 return this;
28017 }
28018
28019 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
28020
28021 switch (units) {
28022 case 'year':
28023 time = startOfDate(this.year(), 0, 1);
28024 break;
28025
28026 case 'quarter':
28027 time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
28028 break;
28029
28030 case 'month':
28031 time = startOfDate(this.year(), this.month(), 1);
28032 break;
28033
28034 case 'week':
28035 time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
28036 break;
28037
28038 case 'isoWeek':
28039 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
28040 break;
28041
28042 case 'day':
28043 case 'date':
28044 time = startOfDate(this.year(), this.month(), this.date());
28045 break;
28046
28047 case 'hour':
28048 time = this._d.valueOf();
28049 time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
28050 break;
28051
28052 case 'minute':
28053 time = this._d.valueOf();
28054 time -= mod$1(time, MS_PER_MINUTE);
28055 break;
28056
28057 case 'second':
28058 time = this._d.valueOf();
28059 time -= mod$1(time, MS_PER_SECOND);
28060 break;
28061 }
28062
28063 this._d.setTime(time);
28064
28065 hooks.updateOffset(this, true);
28066 return this;
28067 }
28068
28069 function endOf(units) {
28070 var time;
28071 units = normalizeUnits(units);
28072
28073 if (units === undefined || units === 'millisecond' || !this.isValid()) {
28074 return this;
28075 }
28076
28077 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
28078
28079 switch (units) {
28080 case 'year':
28081 time = startOfDate(this.year() + 1, 0, 1) - 1;
28082 break;
28083
28084 case 'quarter':
28085 time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
28086 break;
28087
28088 case 'month':
28089 time = startOfDate(this.year(), this.month() + 1, 1) - 1;
28090 break;
28091
28092 case 'week':
28093 time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
28094 break;
28095
28096 case 'isoWeek':
28097 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
28098 break;
28099
28100 case 'day':
28101 case 'date':
28102 time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
28103 break;
28104
28105 case 'hour':
28106 time = this._d.valueOf();
28107 time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
28108 break;
28109
28110 case 'minute':
28111 time = this._d.valueOf();
28112 time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
28113 break;
28114
28115 case 'second':
28116 time = this._d.valueOf();
28117 time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
28118 break;
28119 }
28120
28121 this._d.setTime(time);
28122
28123 hooks.updateOffset(this, true);
28124 return this;
28125 }
28126
28127 function valueOf() {
28128 return this._d.valueOf() - (this._offset || 0) * 60000;
28129 }
28130
28131 function unix() {
28132 return Math.floor(this.valueOf() / 1000);
28133 }
28134
28135 function toDate() {
28136 return new Date(this.valueOf());
28137 }
28138
28139 function toArray() {
28140 var m = this;
28141 return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
28142 }
28143
28144 function toObject() {
28145 var m = this;
28146 return {
28147 years: m.year(),
28148 months: m.month(),
28149 date: m.date(),
28150 hours: m.hours(),
28151 minutes: m.minutes(),
28152 seconds: m.seconds(),
28153 milliseconds: m.milliseconds()
28154 };
28155 }
28156
28157 function toJSON() {
28158 // new Date(NaN).toJSON() === null
28159 return this.isValid() ? this.toISOString() : null;
28160 }
28161
28162 function isValid$2() {
28163 return isValid(this);
28164 }
28165
28166 function parsingFlags() {
28167 return extend({}, getParsingFlags(this));
28168 }
28169
28170 function invalidAt() {
28171 return getParsingFlags(this).overflow;
28172 }
28173
28174 function creationData() {
28175 return {
28176 input: this._i,
28177 format: this._f,
28178 locale: this._locale,
28179 isUTC: this._isUTC,
28180 strict: this._strict
28181 };
28182 } // FORMATTING
28183
28184
28185 addFormatToken(0, ['gg', 2], 0, function () {
28186 return this.weekYear() % 100;
28187 });
28188 addFormatToken(0, ['GG', 2], 0, function () {
28189 return this.isoWeekYear() % 100;
28190 });
28191
28192 function addWeekYearFormatToken(token, getter) {
28193 addFormatToken(0, [token, token.length], 0, getter);
28194 }
28195
28196 addWeekYearFormatToken('gggg', 'weekYear');
28197 addWeekYearFormatToken('ggggg', 'weekYear');
28198 addWeekYearFormatToken('GGGG', 'isoWeekYear');
28199 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES
28200
28201 addUnitAlias('weekYear', 'gg');
28202 addUnitAlias('isoWeekYear', 'GG'); // PRIORITY
28203
28204 addUnitPriority('weekYear', 1);
28205 addUnitPriority('isoWeekYear', 1); // PARSING
28206
28207 addRegexToken('G', matchSigned);
28208 addRegexToken('g', matchSigned);
28209 addRegexToken('GG', match1to2, match2);
28210 addRegexToken('gg', match1to2, match2);
28211 addRegexToken('GGGG', match1to4, match4);
28212 addRegexToken('gggg', match1to4, match4);
28213 addRegexToken('GGGGG', match1to6, match6);
28214 addRegexToken('ggggg', match1to6, match6);
28215 addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
28216 week[token.substr(0, 2)] = toInt(input);
28217 });
28218 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
28219 week[token] = hooks.parseTwoDigitYear(input);
28220 }); // MOMENTS
28221
28222 function getSetWeekYear(input) {
28223 return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy);
28224 }
28225
28226 function getSetISOWeekYear(input) {
28227 return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
28228 }
28229
28230 function getISOWeeksInYear() {
28231 return weeksInYear(this.year(), 1, 4);
28232 }
28233
28234 function getWeeksInYear() {
28235 var weekInfo = this.localeData()._week;
28236
28237 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
28238 }
28239
28240 function getSetWeekYearHelper(input, week, weekday, dow, doy) {
28241 var weeksTarget;
28242
28243 if (input == null) {
28244 return weekOfYear(this, dow, doy).year;
28245 } else {
28246 weeksTarget = weeksInYear(input, dow, doy);
28247
28248 if (week > weeksTarget) {
28249 week = weeksTarget;
28250 }
28251
28252 return setWeekAll.call(this, input, week, weekday, dow, doy);
28253 }
28254 }
28255
28256 function setWeekAll(weekYear, week, weekday, dow, doy) {
28257 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
28258 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
28259 this.year(date.getUTCFullYear());
28260 this.month(date.getUTCMonth());
28261 this.date(date.getUTCDate());
28262 return this;
28263 } // FORMATTING
28264
28265
28266 addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES
28267
28268 addUnitAlias('quarter', 'Q'); // PRIORITY
28269
28270 addUnitPriority('quarter', 7); // PARSING
28271
28272 addRegexToken('Q', match1);
28273 addParseToken('Q', function (input, array) {
28274 array[MONTH] = (toInt(input) - 1) * 3;
28275 }); // MOMENTS
28276
28277 function getSetQuarter(input) {
28278 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
28279 } // FORMATTING
28280
28281
28282 addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES
28283
28284 addUnitAlias('date', 'D'); // PRIORITY
28285
28286 addUnitPriority('date', 9); // PARSING
28287
28288 addRegexToken('D', match1to2);
28289 addRegexToken('DD', match1to2, match2);
28290 addRegexToken('Do', function (isStrict, locale) {
28291 // TODO: Remove "ordinalParse" fallback in next major release.
28292 return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient;
28293 });
28294 addParseToken(['D', 'DD'], DATE);
28295 addParseToken('Do', function (input, array) {
28296 array[DATE] = toInt(input.match(match1to2)[0]);
28297 }); // MOMENTS
28298
28299 var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING
28300
28301 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES
28302
28303 addUnitAlias('dayOfYear', 'DDD'); // PRIORITY
28304
28305 addUnitPriority('dayOfYear', 4); // PARSING
28306
28307 addRegexToken('DDD', match1to3);
28308 addRegexToken('DDDD', match3);
28309 addParseToken(['DDD', 'DDDD'], function (input, array, config) {
28310 config._dayOfYear = toInt(input);
28311 }); // HELPERS
28312 // MOMENTS
28313
28314 function getSetDayOfYear(input) {
28315 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
28316 return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
28317 } // FORMATTING
28318
28319
28320 addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES
28321
28322 addUnitAlias('minute', 'm'); // PRIORITY
28323
28324 addUnitPriority('minute', 14); // PARSING
28325
28326 addRegexToken('m', match1to2);
28327 addRegexToken('mm', match1to2, match2);
28328 addParseToken(['m', 'mm'], MINUTE); // MOMENTS
28329
28330 var getSetMinute = makeGetSet('Minutes', false); // FORMATTING
28331
28332 addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES
28333
28334 addUnitAlias('second', 's'); // PRIORITY
28335
28336 addUnitPriority('second', 15); // PARSING
28337
28338 addRegexToken('s', match1to2);
28339 addRegexToken('ss', match1to2, match2);
28340 addParseToken(['s', 'ss'], SECOND); // MOMENTS
28341
28342 var getSetSecond = makeGetSet('Seconds', false); // FORMATTING
28343
28344 addFormatToken('S', 0, 0, function () {
28345 return ~~(this.millisecond() / 100);
28346 });
28347 addFormatToken(0, ['SS', 2], 0, function () {
28348 return ~~(this.millisecond() / 10);
28349 });
28350 addFormatToken(0, ['SSS', 3], 0, 'millisecond');
28351 addFormatToken(0, ['SSSS', 4], 0, function () {
28352 return this.millisecond() * 10;
28353 });
28354 addFormatToken(0, ['SSSSS', 5], 0, function () {
28355 return this.millisecond() * 100;
28356 });
28357 addFormatToken(0, ['SSSSSS', 6], 0, function () {
28358 return this.millisecond() * 1000;
28359 });
28360 addFormatToken(0, ['SSSSSSS', 7], 0, function () {
28361 return this.millisecond() * 10000;
28362 });
28363 addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
28364 return this.millisecond() * 100000;
28365 });
28366 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
28367 return this.millisecond() * 1000000;
28368 }); // ALIASES
28369
28370 addUnitAlias('millisecond', 'ms'); // PRIORITY
28371
28372 addUnitPriority('millisecond', 16); // PARSING
28373
28374 addRegexToken('S', match1to3, match1);
28375 addRegexToken('SS', match1to3, match2);
28376 addRegexToken('SSS', match1to3, match3);
28377 var token;
28378
28379 for (token = 'SSSS'; token.length <= 9; token += 'S') {
28380 addRegexToken(token, matchUnsigned);
28381 }
28382
28383 function parseMs(input, array) {
28384 array[MILLISECOND] = toInt(('0.' + input) * 1000);
28385 }
28386
28387 for (token = 'S'; token.length <= 9; token += 'S') {
28388 addParseToken(token, parseMs);
28389 } // MOMENTS
28390
28391
28392 var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING
28393
28394 addFormatToken('z', 0, 0, 'zoneAbbr');
28395 addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS
28396
28397 function getZoneAbbr() {
28398 return this._isUTC ? 'UTC' : '';
28399 }
28400
28401 function getZoneName() {
28402 return this._isUTC ? 'Coordinated Universal Time' : '';
28403 }
28404
28405 var proto = Moment.prototype;
28406 proto.add = add;
28407 proto.calendar = calendar$1;
28408 proto.clone = clone;
28409 proto.diff = diff;
28410 proto.endOf = endOf;
28411 proto.format = format;
28412 proto.from = from;
28413 proto.fromNow = fromNow;
28414 proto.to = to;
28415 proto.toNow = toNow;
28416 proto.get = stringGet;
28417 proto.invalidAt = invalidAt;
28418 proto.isAfter = isAfter;
28419 proto.isBefore = isBefore;
28420 proto.isBetween = isBetween;
28421 proto.isSame = isSame;
28422 proto.isSameOrAfter = isSameOrAfter;
28423 proto.isSameOrBefore = isSameOrBefore;
28424 proto.isValid = isValid$2;
28425 proto.lang = lang;
28426 proto.locale = locale;
28427 proto.localeData = localeData;
28428 proto.max = prototypeMax;
28429 proto.min = prototypeMin;
28430 proto.parsingFlags = parsingFlags;
28431 proto.set = stringSet;
28432 proto.startOf = startOf;
28433 proto.subtract = subtract;
28434 proto.toArray = toArray;
28435 proto.toObject = toObject;
28436 proto.toDate = toDate;
28437 proto.toISOString = toISOString;
28438 proto.inspect = inspect;
28439 proto.toJSON = toJSON;
28440 proto.toString = toString;
28441 proto.unix = unix;
28442 proto.valueOf = valueOf;
28443 proto.creationData = creationData;
28444 proto.year = getSetYear;
28445 proto.isLeapYear = getIsLeapYear;
28446 proto.weekYear = getSetWeekYear;
28447 proto.isoWeekYear = getSetISOWeekYear;
28448 proto.quarter = proto.quarters = getSetQuarter;
28449 proto.month = getSetMonth;
28450 proto.daysInMonth = getDaysInMonth;
28451 proto.week = proto.weeks = getSetWeek;
28452 proto.isoWeek = proto.isoWeeks = getSetISOWeek;
28453 proto.weeksInYear = getWeeksInYear;
28454 proto.isoWeeksInYear = getISOWeeksInYear;
28455 proto.date = getSetDayOfMonth;
28456 proto.day = proto.days = getSetDayOfWeek;
28457 proto.weekday = getSetLocaleDayOfWeek;
28458 proto.isoWeekday = getSetISODayOfWeek;
28459 proto.dayOfYear = getSetDayOfYear;
28460 proto.hour = proto.hours = getSetHour;
28461 proto.minute = proto.minutes = getSetMinute;
28462 proto.second = proto.seconds = getSetSecond;
28463 proto.millisecond = proto.milliseconds = getSetMillisecond;
28464 proto.utcOffset = getSetOffset;
28465 proto.utc = setOffsetToUTC;
28466 proto.local = setOffsetToLocal;
28467 proto.parseZone = setOffsetToParsedOffset;
28468 proto.hasAlignedHourOffset = hasAlignedHourOffset;
28469 proto.isDST = isDaylightSavingTime;
28470 proto.isLocal = isLocal;
28471 proto.isUtcOffset = isUtcOffset;
28472 proto.isUtc = isUtc;
28473 proto.isUTC = isUtc;
28474 proto.zoneAbbr = getZoneAbbr;
28475 proto.zoneName = getZoneName;
28476 proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
28477 proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
28478 proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
28479 proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
28480 proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
28481
28482 function createUnix(input) {
28483 return createLocal(input * 1000);
28484 }
28485
28486 function createInZone() {
28487 return createLocal.apply(null, arguments).parseZone();
28488 }
28489
28490 function preParsePostFormat(string) {
28491 return string;
28492 }
28493
28494 var proto$1 = Locale.prototype;
28495 proto$1.calendar = calendar;
28496 proto$1.longDateFormat = longDateFormat;
28497 proto$1.invalidDate = invalidDate;
28498 proto$1.ordinal = ordinal;
28499 proto$1.preparse = preParsePostFormat;
28500 proto$1.postformat = preParsePostFormat;
28501 proto$1.relativeTime = relativeTime;
28502 proto$1.pastFuture = pastFuture;
28503 proto$1.set = set;
28504 proto$1.months = localeMonths;
28505 proto$1.monthsShort = localeMonthsShort;
28506 proto$1.monthsParse = localeMonthsParse;
28507 proto$1.monthsRegex = monthsRegex;
28508 proto$1.monthsShortRegex = monthsShortRegex;
28509 proto$1.week = localeWeek;
28510 proto$1.firstDayOfYear = localeFirstDayOfYear;
28511 proto$1.firstDayOfWeek = localeFirstDayOfWeek;
28512 proto$1.weekdays = localeWeekdays;
28513 proto$1.weekdaysMin = localeWeekdaysMin;
28514 proto$1.weekdaysShort = localeWeekdaysShort;
28515 proto$1.weekdaysParse = localeWeekdaysParse;
28516 proto$1.weekdaysRegex = weekdaysRegex;
28517 proto$1.weekdaysShortRegex = weekdaysShortRegex;
28518 proto$1.weekdaysMinRegex = weekdaysMinRegex;
28519 proto$1.isPM = localeIsPM;
28520 proto$1.meridiem = localeMeridiem;
28521
28522 function get$1(format, index, field, setter) {
28523 var locale = getLocale();
28524 var utc = createUTC().set(setter, index);
28525 return locale[field](utc, format);
28526 }
28527
28528 function listMonthsImpl(format, index, field) {
28529 if (isNumber(format)) {
28530 index = format;
28531 format = undefined;
28532 }
28533
28534 format = format || '';
28535
28536 if (index != null) {
28537 return get$1(format, index, field, 'month');
28538 }
28539
28540 var i;
28541 var out = [];
28542
28543 for (i = 0; i < 12; i++) {
28544 out[i] = get$1(format, i, field, 'month');
28545 }
28546
28547 return out;
28548 } // ()
28549 // (5)
28550 // (fmt, 5)
28551 // (fmt)
28552 // (true)
28553 // (true, 5)
28554 // (true, fmt, 5)
28555 // (true, fmt)
28556
28557
28558 function listWeekdaysImpl(localeSorted, format, index, field) {
28559 if (typeof localeSorted === 'boolean') {
28560 if (isNumber(format)) {
28561 index = format;
28562 format = undefined;
28563 }
28564
28565 format = format || '';
28566 } else {
28567 format = localeSorted;
28568 index = format;
28569 localeSorted = false;
28570
28571 if (isNumber(format)) {
28572 index = format;
28573 format = undefined;
28574 }
28575
28576 format = format || '';
28577 }
28578
28579 var locale = getLocale(),
28580 shift = localeSorted ? locale._week.dow : 0;
28581
28582 if (index != null) {
28583 return get$1(format, (index + shift) % 7, field, 'day');
28584 }
28585
28586 var i;
28587 var out = [];
28588
28589 for (i = 0; i < 7; i++) {
28590 out[i] = get$1(format, (i + shift) % 7, field, 'day');
28591 }
28592
28593 return out;
28594 }
28595
28596 function listMonths(format, index) {
28597 return listMonthsImpl(format, index, 'months');
28598 }
28599
28600 function listMonthsShort(format, index) {
28601 return listMonthsImpl(format, index, 'monthsShort');
28602 }
28603
28604 function listWeekdays(localeSorted, format, index) {
28605 return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
28606 }
28607
28608 function listWeekdaysShort(localeSorted, format, index) {
28609 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
28610 }
28611
28612 function listWeekdaysMin(localeSorted, format, index) {
28613 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
28614 }
28615
28616 getSetGlobalLocale('en', {
28617 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
28618 ordinal: function (number) {
28619 var b = number % 10,
28620 output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th';
28621 return number + output;
28622 }
28623 }); // Side effect imports
28624
28625 hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
28626 hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
28627 var mathAbs = Math.abs;
28628
28629 function abs() {
28630 var data = this._data;
28631 this._milliseconds = mathAbs(this._milliseconds);
28632 this._days = mathAbs(this._days);
28633 this._months = mathAbs(this._months);
28634 data.milliseconds = mathAbs(data.milliseconds);
28635 data.seconds = mathAbs(data.seconds);
28636 data.minutes = mathAbs(data.minutes);
28637 data.hours = mathAbs(data.hours);
28638 data.months = mathAbs(data.months);
28639 data.years = mathAbs(data.years);
28640 return this;
28641 }
28642
28643 function addSubtract$1(duration, input, value, direction) {
28644 var other = createDuration(input, value);
28645 duration._milliseconds += direction * other._milliseconds;
28646 duration._days += direction * other._days;
28647 duration._months += direction * other._months;
28648 return duration._bubble();
28649 } // supports only 2.0-style add(1, 's') or add(duration)
28650
28651
28652 function add$1(input, value) {
28653 return addSubtract$1(this, input, value, 1);
28654 } // supports only 2.0-style subtract(1, 's') or subtract(duration)
28655
28656
28657 function subtract$1(input, value) {
28658 return addSubtract$1(this, input, value, -1);
28659 }
28660
28661 function absCeil(number) {
28662 if (number < 0) {
28663 return Math.floor(number);
28664 } else {
28665 return Math.ceil(number);
28666 }
28667 }
28668
28669 function bubble() {
28670 var milliseconds = this._milliseconds;
28671 var days = this._days;
28672 var months = this._months;
28673 var data = this._data;
28674 var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first
28675 // check: https://github.com/moment/moment/issues/2166
28676
28677 if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) {
28678 milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
28679 days = 0;
28680 months = 0;
28681 } // The following code bubbles up values, see the tests for
28682 // examples of what that means.
28683
28684
28685 data.milliseconds = milliseconds % 1000;
28686 seconds = absFloor(milliseconds / 1000);
28687 data.seconds = seconds % 60;
28688 minutes = absFloor(seconds / 60);
28689 data.minutes = minutes % 60;
28690 hours = absFloor(minutes / 60);
28691 data.hours = hours % 24;
28692 days += absFloor(hours / 24); // convert days to months
28693
28694 monthsFromDays = absFloor(daysToMonths(days));
28695 months += monthsFromDays;
28696 days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year
28697
28698 years = absFloor(months / 12);
28699 months %= 12;
28700 data.days = days;
28701 data.months = months;
28702 data.years = years;
28703 return this;
28704 }
28705
28706 function daysToMonths(days) {
28707 // 400 years have 146097 days (taking into account leap year rules)
28708 // 400 years have 12 months === 4800
28709 return days * 4800 / 146097;
28710 }
28711
28712 function monthsToDays(months) {
28713 // the reverse of daysToMonths
28714 return months * 146097 / 4800;
28715 }
28716
28717 function as(units) {
28718 if (!this.isValid()) {
28719 return NaN;
28720 }
28721
28722 var days;
28723 var months;
28724 var milliseconds = this._milliseconds;
28725 units = normalizeUnits(units);
28726
28727 if (units === 'month' || units === 'quarter' || units === 'year') {
28728 days = this._days + milliseconds / 864e5;
28729 months = this._months + daysToMonths(days);
28730
28731 switch (units) {
28732 case 'month':
28733 return months;
28734
28735 case 'quarter':
28736 return months / 3;
28737
28738 case 'year':
28739 return months / 12;
28740 }
28741 } else {
28742 // handle milliseconds separately because of floating point math errors (issue #1867)
28743 days = this._days + Math.round(monthsToDays(this._months));
28744
28745 switch (units) {
28746 case 'week':
28747 return days / 7 + milliseconds / 6048e5;
28748
28749 case 'day':
28750 return days + milliseconds / 864e5;
28751
28752 case 'hour':
28753 return days * 24 + milliseconds / 36e5;
28754
28755 case 'minute':
28756 return days * 1440 + milliseconds / 6e4;
28757
28758 case 'second':
28759 return days * 86400 + milliseconds / 1000;
28760 // Math.floor prevents floating point math errors here
28761
28762 case 'millisecond':
28763 return Math.floor(days * 864e5) + milliseconds;
28764
28765 default:
28766 throw new Error('Unknown unit ' + units);
28767 }
28768 }
28769 } // TODO: Use this.as('ms')?
28770
28771
28772 function valueOf$1() {
28773 if (!this.isValid()) {
28774 return NaN;
28775 }
28776
28777 return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6;
28778 }
28779
28780 function makeAs(alias) {
28781 return function () {
28782 return this.as(alias);
28783 };
28784 }
28785
28786 var asMilliseconds = makeAs('ms');
28787 var asSeconds = makeAs('s');
28788 var asMinutes = makeAs('m');
28789 var asHours = makeAs('h');
28790 var asDays = makeAs('d');
28791 var asWeeks = makeAs('w');
28792 var asMonths = makeAs('M');
28793 var asQuarters = makeAs('Q');
28794 var asYears = makeAs('y');
28795
28796 function clone$1() {
28797 return createDuration(this);
28798 }
28799
28800 function get$2(units) {
28801 units = normalizeUnits(units);
28802 return this.isValid() ? this[units + 's']() : NaN;
28803 }
28804
28805 function makeGetter(name) {
28806 return function () {
28807 return this.isValid() ? this._data[name] : NaN;
28808 };
28809 }
28810
28811 var milliseconds = makeGetter('milliseconds');
28812 var seconds = makeGetter('seconds');
28813 var minutes = makeGetter('minutes');
28814 var hours = makeGetter('hours');
28815 var days = makeGetter('days');
28816 var months = makeGetter('months');
28817 var years = makeGetter('years');
28818
28819 function weeks() {
28820 return absFloor(this.days() / 7);
28821 }
28822
28823 var round = Math.round;
28824 var thresholds = {
28825 ss: 44,
28826 // a few seconds to seconds
28827 s: 45,
28828 // seconds to minute
28829 m: 45,
28830 // minutes to hour
28831 h: 22,
28832 // hours to day
28833 d: 26,
28834 // days to month
28835 M: 11 // months to year
28836
28837 }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
28838
28839 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
28840 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
28841 }
28842
28843 function relativeTime$1(posNegDuration, withoutSuffix, locale) {
28844 var duration = createDuration(posNegDuration).abs();
28845 var seconds = round(duration.as('s'));
28846 var minutes = round(duration.as('m'));
28847 var hours = round(duration.as('h'));
28848 var days = round(duration.as('d'));
28849 var months = round(duration.as('M'));
28850 var years = round(duration.as('y'));
28851 var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years];
28852 a[2] = withoutSuffix;
28853 a[3] = +posNegDuration > 0;
28854 a[4] = locale;
28855 return substituteTimeAgo.apply(null, a);
28856 } // This function allows you to set the rounding function for relative time strings
28857
28858
28859 function getSetRelativeTimeRounding(roundingFunction) {
28860 if (roundingFunction === undefined) {
28861 return round;
28862 }
28863
28864 if (typeof roundingFunction === 'function') {
28865 round = roundingFunction;
28866 return true;
28867 }
28868
28869 return false;
28870 } // This function allows you to set a threshold for relative time strings
28871
28872
28873 function getSetRelativeTimeThreshold(threshold, limit) {
28874 if (thresholds[threshold] === undefined) {
28875 return false;
28876 }
28877
28878 if (limit === undefined) {
28879 return thresholds[threshold];
28880 }
28881
28882 thresholds[threshold] = limit;
28883
28884 if (threshold === 's') {
28885 thresholds.ss = limit - 1;
28886 }
28887
28888 return true;
28889 }
28890
28891 function humanize(withSuffix) {
28892 if (!this.isValid()) {
28893 return this.localeData().invalidDate();
28894 }
28895
28896 var locale = this.localeData();
28897 var output = relativeTime$1(this, !withSuffix, locale);
28898
28899 if (withSuffix) {
28900 output = locale.pastFuture(+this, output);
28901 }
28902
28903 return locale.postformat(output);
28904 }
28905
28906 var abs$1 = Math.abs;
28907
28908 function sign(x) {
28909 return (x > 0) - (x < 0) || +x;
28910 }
28911
28912 function toISOString$1() {
28913 // for ISO strings we do not use the normal bubbling rules:
28914 // * milliseconds bubble up until they become hours
28915 // * days do not bubble at all
28916 // * months bubble up until they become years
28917 // This is because there is no context-free conversion between hours and days
28918 // (think of clock changes)
28919 // and also not between days and months (28-31 days per month)
28920 if (!this.isValid()) {
28921 return this.localeData().invalidDate();
28922 }
28923
28924 var seconds = abs$1(this._milliseconds) / 1000;
28925 var days = abs$1(this._days);
28926 var months = abs$1(this._months);
28927 var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour
28928
28929 minutes = absFloor(seconds / 60);
28930 hours = absFloor(minutes / 60);
28931 seconds %= 60;
28932 minutes %= 60; // 12 months -> 1 year
28933
28934 years = absFloor(months / 12);
28935 months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
28936
28937 var Y = years;
28938 var M = months;
28939 var D = days;
28940 var h = hours;
28941 var m = minutes;
28942 var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
28943 var total = this.asSeconds();
28944
28945 if (!total) {
28946 // this is the same as C#'s (Noda) and python (isodate)...
28947 // but not other JS (goog.date)
28948 return 'P0D';
28949 }
28950
28951 var totalSign = total < 0 ? '-' : '';
28952 var ymSign = sign(this._months) !== sign(total) ? '-' : '';
28953 var daysSign = sign(this._days) !== sign(total) ? '-' : '';
28954 var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
28955 return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : '');
28956 }
28957
28958 var proto$2 = Duration.prototype;
28959 proto$2.isValid = isValid$1;
28960 proto$2.abs = abs;
28961 proto$2.add = add$1;
28962 proto$2.subtract = subtract$1;
28963 proto$2.as = as;
28964 proto$2.asMilliseconds = asMilliseconds;
28965 proto$2.asSeconds = asSeconds;
28966 proto$2.asMinutes = asMinutes;
28967 proto$2.asHours = asHours;
28968 proto$2.asDays = asDays;
28969 proto$2.asWeeks = asWeeks;
28970 proto$2.asMonths = asMonths;
28971 proto$2.asQuarters = asQuarters;
28972 proto$2.asYears = asYears;
28973 proto$2.valueOf = valueOf$1;
28974 proto$2._bubble = bubble;
28975 proto$2.clone = clone$1;
28976 proto$2.get = get$2;
28977 proto$2.milliseconds = milliseconds;
28978 proto$2.seconds = seconds;
28979 proto$2.minutes = minutes;
28980 proto$2.hours = hours;
28981 proto$2.days = days;
28982 proto$2.weeks = weeks;
28983 proto$2.months = months;
28984 proto$2.years = years;
28985 proto$2.humanize = humanize;
28986 proto$2.toISOString = toISOString$1;
28987 proto$2.toString = toISOString$1;
28988 proto$2.toJSON = toISOString$1;
28989 proto$2.locale = locale;
28990 proto$2.localeData = localeData;
28991 proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
28992 proto$2.lang = lang; // Side effect imports
28993 // FORMATTING
28994
28995 addFormatToken('X', 0, 0, 'unix');
28996 addFormatToken('x', 0, 0, 'valueOf'); // PARSING
28997
28998 addRegexToken('x', matchSigned);
28999 addRegexToken('X', matchTimestamp);
29000 addParseToken('X', function (input, array, config) {
29001 config._d = new Date(parseFloat(input, 10) * 1000);
29002 });
29003 addParseToken('x', function (input, array, config) {
29004 config._d = new Date(toInt(input));
29005 }); // Side effect imports
29006
29007 hooks.version = '2.24.0';
29008 setHookCallback(createLocal);
29009 hooks.fn = proto;
29010 hooks.min = min;
29011 hooks.max = max;
29012 hooks.now = now;
29013 hooks.utc = createUTC;
29014 hooks.unix = createUnix;
29015 hooks.months = listMonths;
29016 hooks.isDate = isDate;
29017 hooks.locale = getSetGlobalLocale;
29018 hooks.invalid = createInvalid;
29019 hooks.duration = createDuration;
29020 hooks.isMoment = isMoment;
29021 hooks.weekdays = listWeekdays;
29022 hooks.parseZone = createInZone;
29023 hooks.localeData = getLocale;
29024 hooks.isDuration = isDuration;
29025 hooks.monthsShort = listMonthsShort;
29026 hooks.weekdaysMin = listWeekdaysMin;
29027 hooks.defineLocale = defineLocale;
29028 hooks.updateLocale = updateLocale;
29029 hooks.locales = listLocales;
29030 hooks.weekdaysShort = listWeekdaysShort;
29031 hooks.normalizeUnits = normalizeUnits;
29032 hooks.relativeTimeRounding = getSetRelativeTimeRounding;
29033 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
29034 hooks.calendarFormat = getCalendarFormat;
29035 hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats
29036
29037 hooks.HTML5_FMT = {
29038 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',
29039 // <input type="datetime-local" />
29040 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',
29041 // <input type="datetime-local" step="1" />
29042 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',
29043 // <input type="datetime-local" step="0.001" />
29044 DATE: 'YYYY-MM-DD',
29045 // <input type="date" />
29046 TIME: 'HH:mm',
29047 // <input type="time" />
29048 TIME_SECONDS: 'HH:mm:ss',
29049 // <input type="time" step="1" />
29050 TIME_MS: 'HH:mm:ss.SSS',
29051 // <input type="time" step="0.001" />
29052 WEEK: 'GGGG-[W]WW',
29053 // <input type="week" />
29054 MONTH: 'YYYY-MM' // <input type="month" />
29055
29056 };
29057 return hooks;
29058 });
29059});
29060
29061// use this instance. Else, load via commonjs.
29062
29063var moment$2 = typeof window !== 'undefined' && window['moment'] || moment$1;
29064
29065var propagating = createCommonjsModule$1(function (module, exports) {
29066
29067 (function (factory) {
29068 {
29069 // Node. Does not work with strict CommonJS, but
29070 // only CommonJS-like environments that support module.exports,
29071 // like Node.
29072 module.exports = factory();
29073 }
29074 })(function () {
29075 var _firstTarget = null; // singleton, will contain the target element where the touch event started
29076
29077 /**
29078 * Extend an Hammer.js instance with event propagation.
29079 *
29080 * Features:
29081 * - Events emitted by hammer will propagate in order from child to parent
29082 * elements.
29083 * - Events are extended with a function `event.stopPropagation()` to stop
29084 * propagation to parent elements.
29085 * - An option `preventDefault` to stop all default browser behavior.
29086 *
29087 * Usage:
29088 * var hammer = propagatingHammer(new Hammer(element));
29089 * var hammer = propagatingHammer(new Hammer(element), {preventDefault: true});
29090 *
29091 * @param {Hammer.Manager} hammer An hammer instance.
29092 * @param {Object} [options] Available options:
29093 * - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`.
29094 * Enforce preventing the default browser behavior.
29095 * Cannot be set to `false`.
29096 * @return {Hammer.Manager} Returns the same hammer instance with extended
29097 * functionality
29098 */
29099
29100 return function propagating(hammer, options) {
29101 var _options = options || {
29102 preventDefault: false
29103 };
29104
29105 if (hammer.Manager) {
29106 // This looks like the Hammer constructor.
29107 // Overload the constructors with our own.
29108 var Hammer = hammer;
29109
29110 var PropagatingHammer = function (element, options) {
29111 var o = Object.create(_options);
29112 if (options) Hammer.assign(o, options);
29113 return propagating(new Hammer(element, o), o);
29114 };
29115
29116 Hammer.assign(PropagatingHammer, Hammer);
29117
29118 PropagatingHammer.Manager = function (element, options) {
29119 var o = Object.create(_options);
29120 if (options) Hammer.assign(o, options);
29121 return propagating(new Hammer.Manager(element, o), o);
29122 };
29123
29124 return PropagatingHammer;
29125 } // create a wrapper object which will override the functions
29126 // `on`, `off`, `destroy`, and `emit` of the hammer instance
29127
29128
29129 var wrapper = Object.create(hammer); // attach to DOM element
29130
29131 var element = hammer.element;
29132 if (!element.hammer) element.hammer = [];
29133 element.hammer.push(wrapper); // register an event to catch the start of a gesture and store the
29134 // target in a singleton
29135
29136 hammer.on('hammer.input', function (event) {
29137 if (_options.preventDefault === true || _options.preventDefault === event.pointerType) {
29138 event.preventDefault();
29139 }
29140
29141 if (event.isFirst) {
29142 _firstTarget = event.target;
29143 }
29144 });
29145 /** @type {Object.<String, Array.<function>>} */
29146
29147 wrapper._handlers = {};
29148 /**
29149 * Register a handler for one or multiple events
29150 * @param {String} events A space separated string with events
29151 * @param {function} handler A callback function, called as handler(event)
29152 * @returns {Hammer.Manager} Returns the hammer instance
29153 */
29154
29155 wrapper.on = function (events, handler) {
29156 // register the handler
29157 split(events).forEach(function (event) {
29158 var _handlers = wrapper._handlers[event];
29159
29160 if (!_handlers) {
29161 wrapper._handlers[event] = _handlers = []; // register the static, propagated handler
29162
29163 hammer.on(event, propagatedHandler);
29164 }
29165
29166 _handlers.push(handler);
29167 });
29168 return wrapper;
29169 };
29170 /**
29171 * Unregister a handler for one or multiple events
29172 * @param {String} events A space separated string with events
29173 * @param {function} [handler] Optional. The registered handler. If not
29174 * provided, all handlers for given events
29175 * are removed.
29176 * @returns {Hammer.Manager} Returns the hammer instance
29177 */
29178
29179
29180 wrapper.off = function (events, handler) {
29181 // unregister the handler
29182 split(events).forEach(function (event) {
29183 var _handlers = wrapper._handlers[event];
29184
29185 if (_handlers) {
29186 _handlers = handler ? _handlers.filter(function (h) {
29187 return h !== handler;
29188 }) : [];
29189
29190 if (_handlers.length > 0) {
29191 wrapper._handlers[event] = _handlers;
29192 } else {
29193 // remove static, propagated handler
29194 hammer.off(event, propagatedHandler);
29195 delete wrapper._handlers[event];
29196 }
29197 }
29198 });
29199 return wrapper;
29200 };
29201 /**
29202 * Emit to the event listeners
29203 * @param {string} eventType
29204 * @param {Event} event
29205 */
29206
29207
29208 wrapper.emit = function (eventType, event) {
29209 _firstTarget = event.target;
29210 hammer.emit(eventType, event);
29211 };
29212
29213 wrapper.destroy = function () {
29214 // Detach from DOM element
29215 var hammers = hammer.element.hammer;
29216 var idx = hammers.indexOf(wrapper);
29217 if (idx !== -1) hammers.splice(idx, 1);
29218 if (!hammers.length) delete hammer.element.hammer; // clear all handlers
29219
29220 wrapper._handlers = {}; // call original hammer destroy
29221
29222 hammer.destroy();
29223 }; // split a string with space separated words
29224
29225
29226 function split(events) {
29227 return events.match(/[^ ]+/g);
29228 }
29229 /**
29230 * A static event handler, applying event propagation.
29231 * @param {Object} event
29232 */
29233
29234
29235 function propagatedHandler(event) {
29236 // let only a single hammer instance handle this event
29237 if (event.type !== 'hammer.input') {
29238 // it is possible that the same srcEvent is used with multiple hammer events,
29239 // we keep track on which events are handled in an object _handled
29240 if (!event.srcEvent._handled) {
29241 event.srcEvent._handled = {};
29242 }
29243
29244 if (event.srcEvent._handled[event.type]) {
29245 return;
29246 } else {
29247 event.srcEvent._handled[event.type] = true;
29248 }
29249 } // attach a stopPropagation function to the event
29250
29251
29252 var stopped = false;
29253
29254 event.stopPropagation = function () {
29255 stopped = true;
29256 }; //wrap the srcEvent's stopPropagation to also stop hammer propagation:
29257
29258
29259 var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent);
29260
29261 if (typeof srcStop == "function") {
29262 event.srcEvent.stopPropagation = function () {
29263 srcStop();
29264 event.stopPropagation();
29265 };
29266 } // attach firstTarget property to the event
29267
29268
29269 event.firstTarget = _firstTarget; // propagate over all elements (until stopped)
29270
29271 var elem = _firstTarget;
29272
29273 while (elem && !stopped) {
29274 var elemHammer = elem.hammer;
29275
29276 if (elemHammer) {
29277 var _handlers;
29278
29279 for (var k = 0; k < elemHammer.length; k++) {
29280 _handlers = elemHammer[k]._handlers[event.type];
29281 if (_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) {
29282 _handlers[i](event);
29283 }
29284 }
29285 }
29286
29287 elem = elem.parentNode;
29288 }
29289 }
29290
29291 return wrapper;
29292 };
29293 });
29294});
29295
29296var hammer = createCommonjsModule$1(function (module) {
29297 /*! Hammer.JS - v2.0.7 - 2016-04-22
29298 * http://hammerjs.github.io/
29299 *
29300 * Copyright (c) 2016 Jorik Tangelder;
29301 * Licensed under the MIT license */
29302 (function (window, document, exportName, undefined$1) {
29303
29304 var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
29305 var TEST_ELEMENT = document.createElement('div');
29306 var TYPE_FUNCTION = 'function';
29307 var round = Math.round;
29308 var abs = Math.abs;
29309 var now = Date.now;
29310 /**
29311 * set a timeout with a given scope
29312 * @param {Function} fn
29313 * @param {Number} timeout
29314 * @param {Object} context
29315 * @returns {number}
29316 */
29317
29318 function setTimeoutContext(fn, timeout, context) {
29319 return setTimeout(bindFn(fn, context), timeout);
29320 }
29321 /**
29322 * if the argument is an array, we want to execute the fn on each entry
29323 * if it aint an array we don't want to do a thing.
29324 * this is used by all the methods that accept a single and array argument.
29325 * @param {*|Array} arg
29326 * @param {String} fn
29327 * @param {Object} [context]
29328 * @returns {Boolean}
29329 */
29330
29331
29332 function invokeArrayArg(arg, fn, context) {
29333 if (Array.isArray(arg)) {
29334 each(arg, context[fn], context);
29335 return true;
29336 }
29337
29338 return false;
29339 }
29340 /**
29341 * walk objects and arrays
29342 * @param {Object} obj
29343 * @param {Function} iterator
29344 * @param {Object} context
29345 */
29346
29347
29348 function each(obj, iterator, context) {
29349 var i;
29350
29351 if (!obj) {
29352 return;
29353 }
29354
29355 if (obj.forEach) {
29356 obj.forEach(iterator, context);
29357 } else if (obj.length !== undefined$1) {
29358 i = 0;
29359
29360 while (i < obj.length) {
29361 iterator.call(context, obj[i], i, obj);
29362 i++;
29363 }
29364 } else {
29365 for (i in obj) {
29366 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
29367 }
29368 }
29369 }
29370 /**
29371 * wrap a method with a deprecation warning and stack trace
29372 * @param {Function} method
29373 * @param {String} name
29374 * @param {String} message
29375 * @returns {Function} A new function wrapping the supplied method.
29376 */
29377
29378
29379 function deprecate(method, name, message) {
29380 var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
29381 return function () {
29382 var e = new Error('get-stack-trace');
29383 var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
29384 var log = window.console && (window.console.warn || window.console.log);
29385
29386 if (log) {
29387 log.call(window.console, deprecationMessage, stack);
29388 }
29389
29390 return method.apply(this, arguments);
29391 };
29392 }
29393 /**
29394 * extend object.
29395 * means that properties in dest will be overwritten by the ones in src.
29396 * @param {Object} target
29397 * @param {...Object} objects_to_assign
29398 * @returns {Object} target
29399 */
29400
29401
29402 var assign;
29403
29404 if (typeof Object.assign !== 'function') {
29405 assign = function assign(target) {
29406 if (target === undefined$1 || target === null) {
29407 throw new TypeError('Cannot convert undefined or null to object');
29408 }
29409
29410 var output = Object(target);
29411
29412 for (var index = 1; index < arguments.length; index++) {
29413 var source = arguments[index];
29414
29415 if (source !== undefined$1 && source !== null) {
29416 for (var nextKey in source) {
29417 if (source.hasOwnProperty(nextKey)) {
29418 output[nextKey] = source[nextKey];
29419 }
29420 }
29421 }
29422 }
29423
29424 return output;
29425 };
29426 } else {
29427 assign = Object.assign;
29428 }
29429 /**
29430 * extend object.
29431 * means that properties in dest will be overwritten by the ones in src.
29432 * @param {Object} dest
29433 * @param {Object} src
29434 * @param {Boolean} [merge=false]
29435 * @returns {Object} dest
29436 */
29437
29438
29439 var extend = deprecate(function extend(dest, src, merge) {
29440 var keys = Object.keys(src);
29441 var i = 0;
29442
29443 while (i < keys.length) {
29444 if (!merge || merge && dest[keys[i]] === undefined$1) {
29445 dest[keys[i]] = src[keys[i]];
29446 }
29447
29448 i++;
29449 }
29450
29451 return dest;
29452 }, 'extend', 'Use `assign`.');
29453 /**
29454 * merge the values from src in the dest.
29455 * means that properties that exist in dest will not be overwritten by src
29456 * @param {Object} dest
29457 * @param {Object} src
29458 * @returns {Object} dest
29459 */
29460
29461 var merge = deprecate(function merge(dest, src) {
29462 return extend(dest, src, true);
29463 }, 'merge', 'Use `assign`.');
29464 /**
29465 * simple class inheritance
29466 * @param {Function} child
29467 * @param {Function} base
29468 * @param {Object} [properties]
29469 */
29470
29471 function inherit(child, base, properties) {
29472 var baseP = base.prototype,
29473 childP;
29474 childP = child.prototype = Object.create(baseP);
29475 childP.constructor = child;
29476 childP._super = baseP;
29477
29478 if (properties) {
29479 assign(childP, properties);
29480 }
29481 }
29482 /**
29483 * simple function bind
29484 * @param {Function} fn
29485 * @param {Object} context
29486 * @returns {Function}
29487 */
29488
29489
29490 function bindFn(fn, context) {
29491 return function boundFn() {
29492 return fn.apply(context, arguments);
29493 };
29494 }
29495 /**
29496 * let a boolean value also be a function that must return a boolean
29497 * this first item in args will be used as the context
29498 * @param {Boolean|Function} val
29499 * @param {Array} [args]
29500 * @returns {Boolean}
29501 */
29502
29503
29504 function boolOrFn(val, args) {
29505 if (typeof val == TYPE_FUNCTION) {
29506 return val.apply(args ? args[0] || undefined$1 : undefined$1, args);
29507 }
29508
29509 return val;
29510 }
29511 /**
29512 * use the val2 when val1 is undefined
29513 * @param {*} val1
29514 * @param {*} val2
29515 * @returns {*}
29516 */
29517
29518
29519 function ifUndefined(val1, val2) {
29520 return val1 === undefined$1 ? val2 : val1;
29521 }
29522 /**
29523 * addEventListener with multiple events at once
29524 * @param {EventTarget} target
29525 * @param {String} types
29526 * @param {Function} handler
29527 */
29528
29529
29530 function addEventListeners(target, types, handler) {
29531 each(splitStr(types), function (type) {
29532 target.addEventListener(type, handler, false);
29533 });
29534 }
29535 /**
29536 * removeEventListener with multiple events at once
29537 * @param {EventTarget} target
29538 * @param {String} types
29539 * @param {Function} handler
29540 */
29541
29542
29543 function removeEventListeners(target, types, handler) {
29544 each(splitStr(types), function (type) {
29545 target.removeEventListener(type, handler, false);
29546 });
29547 }
29548 /**
29549 * find if a node is in the given parent
29550 * @method hasParent
29551 * @param {HTMLElement} node
29552 * @param {HTMLElement} parent
29553 * @return {Boolean} found
29554 */
29555
29556
29557 function hasParent(node, parent) {
29558 while (node) {
29559 if (node == parent) {
29560 return true;
29561 }
29562
29563 node = node.parentNode;
29564 }
29565
29566 return false;
29567 }
29568 /**
29569 * small indexOf wrapper
29570 * @param {String} str
29571 * @param {String} find
29572 * @returns {Boolean} found
29573 */
29574
29575
29576 function inStr(str, find) {
29577 return str.indexOf(find) > -1;
29578 }
29579 /**
29580 * split string on whitespace
29581 * @param {String} str
29582 * @returns {Array} words
29583 */
29584
29585
29586 function splitStr(str) {
29587 return str.trim().split(/\s+/g);
29588 }
29589 /**
29590 * find if a array contains the object using indexOf or a simple polyFill
29591 * @param {Array} src
29592 * @param {String} find
29593 * @param {String} [findByKey]
29594 * @return {Boolean|Number} false when not found, or the index
29595 */
29596
29597
29598 function inArray(src, find, findByKey) {
29599 if (src.indexOf && !findByKey) {
29600 return src.indexOf(find);
29601 } else {
29602 var i = 0;
29603
29604 while (i < src.length) {
29605 if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
29606 return i;
29607 }
29608
29609 i++;
29610 }
29611
29612 return -1;
29613 }
29614 }
29615 /**
29616 * convert array-like objects to real arrays
29617 * @param {Object} obj
29618 * @returns {Array}
29619 */
29620
29621
29622 function toArray(obj) {
29623 return Array.prototype.slice.call(obj, 0);
29624 }
29625 /**
29626 * unique array with objects based on a key (like 'id') or just by the array's value
29627 * @param {Array} src [{id:1},{id:2},{id:1}]
29628 * @param {String} [key]
29629 * @param {Boolean} [sort=False]
29630 * @returns {Array} [{id:1},{id:2}]
29631 */
29632
29633
29634 function uniqueArray(src, key, sort) {
29635 var results = [];
29636 var values = [];
29637 var i = 0;
29638
29639 while (i < src.length) {
29640 var val = key ? src[i][key] : src[i];
29641
29642 if (inArray(values, val) < 0) {
29643 results.push(src[i]);
29644 }
29645
29646 values[i] = val;
29647 i++;
29648 }
29649
29650 if (sort) {
29651 if (!key) {
29652 results = results.sort();
29653 } else {
29654 results = results.sort(function sortUniqueArray(a, b) {
29655 return a[key] > b[key];
29656 });
29657 }
29658 }
29659
29660 return results;
29661 }
29662 /**
29663 * get the prefixed property
29664 * @param {Object} obj
29665 * @param {String} property
29666 * @returns {String|Undefined} prefixed
29667 */
29668
29669
29670 function prefixed(obj, property) {
29671 var prefix, prop;
29672 var camelProp = property[0].toUpperCase() + property.slice(1);
29673 var i = 0;
29674
29675 while (i < VENDOR_PREFIXES.length) {
29676 prefix = VENDOR_PREFIXES[i];
29677 prop = prefix ? prefix + camelProp : property;
29678
29679 if (prop in obj) {
29680 return prop;
29681 }
29682
29683 i++;
29684 }
29685
29686 return undefined$1;
29687 }
29688 /**
29689 * get a unique id
29690 * @returns {number} uniqueId
29691 */
29692
29693
29694 var _uniqueId = 1;
29695
29696 function uniqueId() {
29697 return _uniqueId++;
29698 }
29699 /**
29700 * get the window object of an element
29701 * @param {HTMLElement} element
29702 * @returns {DocumentView|Window}
29703 */
29704
29705
29706 function getWindowForElement(element) {
29707 var doc = element.ownerDocument || element;
29708 return doc.defaultView || doc.parentWindow || window;
29709 }
29710
29711 var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
29712 var SUPPORT_TOUCH = 'ontouchstart' in window;
29713 var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined$1;
29714 var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
29715 var INPUT_TYPE_TOUCH = 'touch';
29716 var INPUT_TYPE_PEN = 'pen';
29717 var INPUT_TYPE_MOUSE = 'mouse';
29718 var INPUT_TYPE_KINECT = 'kinect';
29719 var COMPUTE_INTERVAL = 25;
29720 var INPUT_START = 1;
29721 var INPUT_MOVE = 2;
29722 var INPUT_END = 4;
29723 var INPUT_CANCEL = 8;
29724 var DIRECTION_NONE = 1;
29725 var DIRECTION_LEFT = 2;
29726 var DIRECTION_RIGHT = 4;
29727 var DIRECTION_UP = 8;
29728 var DIRECTION_DOWN = 16;
29729 var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
29730 var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
29731 var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
29732 var PROPS_XY = ['x', 'y'];
29733 var PROPS_CLIENT_XY = ['clientX', 'clientY'];
29734 /**
29735 * create new input type manager
29736 * @param {Manager} manager
29737 * @param {Function} callback
29738 * @returns {Input}
29739 * @constructor
29740 */
29741
29742 function Input(manager, callback) {
29743 var self = this;
29744 this.manager = manager;
29745 this.callback = callback;
29746 this.element = manager.element;
29747 this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,
29748 // so when disabled the input events are completely bypassed.
29749
29750 this.domHandler = function (ev) {
29751 if (boolOrFn(manager.options.enable, [manager])) {
29752 self.handler(ev);
29753 }
29754 };
29755
29756 this.init();
29757 }
29758
29759 Input.prototype = {
29760 /**
29761 * should handle the inputEvent data and trigger the callback
29762 * @virtual
29763 */
29764 handler: function () {},
29765
29766 /**
29767 * bind the events
29768 */
29769 init: function () {
29770 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
29771 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
29772 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
29773 },
29774
29775 /**
29776 * unbind the events
29777 */
29778 destroy: function () {
29779 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
29780 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
29781 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
29782 }
29783 };
29784 /**
29785 * create new input type manager
29786 * called by the Manager constructor
29787 * @param {Hammer} manager
29788 * @returns {Input}
29789 */
29790
29791 function createInputInstance(manager) {
29792 var Type;
29793 var inputClass = manager.options.inputClass;
29794
29795 if (inputClass) {
29796 Type = inputClass;
29797 } else if (SUPPORT_POINTER_EVENTS) {
29798 Type = PointerEventInput;
29799 } else if (SUPPORT_ONLY_TOUCH) {
29800 Type = TouchInput;
29801 } else if (!SUPPORT_TOUCH) {
29802 Type = MouseInput;
29803 } else {
29804 Type = TouchMouseInput;
29805 }
29806
29807 return new Type(manager, inputHandler);
29808 }
29809 /**
29810 * handle input events
29811 * @param {Manager} manager
29812 * @param {String} eventType
29813 * @param {Object} input
29814 */
29815
29816
29817 function inputHandler(manager, eventType, input) {
29818 var pointersLen = input.pointers.length;
29819 var changedPointersLen = input.changedPointers.length;
29820 var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
29821 var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
29822 input.isFirst = !!isFirst;
29823 input.isFinal = !!isFinal;
29824
29825 if (isFirst) {
29826 manager.session = {};
29827 } // source event is the normalized value of the domEvents
29828 // like 'touchstart, mouseup, pointerdown'
29829
29830
29831 input.eventType = eventType; // compute scale, rotation etc
29832
29833 computeInputData(manager, input); // emit secret event
29834
29835 manager.emit('hammer.input', input);
29836 manager.recognize(input);
29837 manager.session.prevInput = input;
29838 }
29839 /**
29840 * extend the data with some usable properties like scale, rotate, velocity etc
29841 * @param {Object} manager
29842 * @param {Object} input
29843 */
29844
29845
29846 function computeInputData(manager, input) {
29847 var session = manager.session;
29848 var pointers = input.pointers;
29849 var pointersLength = pointers.length; // store the first input to calculate the distance and direction
29850
29851 if (!session.firstInput) {
29852 session.firstInput = simpleCloneInputData(input);
29853 } // to compute scale and rotation we need to store the multiple touches
29854
29855
29856 if (pointersLength > 1 && !session.firstMultiple) {
29857 session.firstMultiple = simpleCloneInputData(input);
29858 } else if (pointersLength === 1) {
29859 session.firstMultiple = false;
29860 }
29861
29862 var firstInput = session.firstInput;
29863 var firstMultiple = session.firstMultiple;
29864 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
29865 var center = input.center = getCenter(pointers);
29866 input.timeStamp = now();
29867 input.deltaTime = input.timeStamp - firstInput.timeStamp;
29868 input.angle = getAngle(offsetCenter, center);
29869 input.distance = getDistance(offsetCenter, center);
29870 computeDeltaXY(session, input);
29871 input.offsetDirection = getDirection(input.deltaX, input.deltaY);
29872 var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
29873 input.overallVelocityX = overallVelocity.x;
29874 input.overallVelocityY = overallVelocity.y;
29875 input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
29876 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
29877 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
29878 input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
29879 computeIntervalInputData(session, input); // find the correct target
29880
29881 var target = manager.element;
29882
29883 if (hasParent(input.srcEvent.target, target)) {
29884 target = input.srcEvent.target;
29885 }
29886
29887 input.target = target;
29888 }
29889
29890 function computeDeltaXY(session, input) {
29891 var center = input.center;
29892 var offset = session.offsetDelta || {};
29893 var prevDelta = session.prevDelta || {};
29894 var prevInput = session.prevInput || {};
29895
29896 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
29897 prevDelta = session.prevDelta = {
29898 x: prevInput.deltaX || 0,
29899 y: prevInput.deltaY || 0
29900 };
29901 offset = session.offsetDelta = {
29902 x: center.x,
29903 y: center.y
29904 };
29905 }
29906
29907 input.deltaX = prevDelta.x + (center.x - offset.x);
29908 input.deltaY = prevDelta.y + (center.y - offset.y);
29909 }
29910 /**
29911 * velocity is calculated every x ms
29912 * @param {Object} session
29913 * @param {Object} input
29914 */
29915
29916
29917 function computeIntervalInputData(session, input) {
29918 var last = session.lastInterval || input,
29919 deltaTime = input.timeStamp - last.timeStamp,
29920 velocity,
29921 velocityX,
29922 velocityY,
29923 direction;
29924
29925 if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined$1)) {
29926 var deltaX = input.deltaX - last.deltaX;
29927 var deltaY = input.deltaY - last.deltaY;
29928 var v = getVelocity(deltaTime, deltaX, deltaY);
29929 velocityX = v.x;
29930 velocityY = v.y;
29931 velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
29932 direction = getDirection(deltaX, deltaY);
29933 session.lastInterval = input;
29934 } else {
29935 // use latest velocity info if it doesn't overtake a minimum period
29936 velocity = last.velocity;
29937 velocityX = last.velocityX;
29938 velocityY = last.velocityY;
29939 direction = last.direction;
29940 }
29941
29942 input.velocity = velocity;
29943 input.velocityX = velocityX;
29944 input.velocityY = velocityY;
29945 input.direction = direction;
29946 }
29947 /**
29948 * create a simple clone from the input used for storage of firstInput and firstMultiple
29949 * @param {Object} input
29950 * @returns {Object} clonedInputData
29951 */
29952
29953
29954 function simpleCloneInputData(input) {
29955 // make a simple copy of the pointers because we will get a reference if we don't
29956 // we only need clientXY for the calculations
29957 var pointers = [];
29958 var i = 0;
29959
29960 while (i < input.pointers.length) {
29961 pointers[i] = {
29962 clientX: round(input.pointers[i].clientX),
29963 clientY: round(input.pointers[i].clientY)
29964 };
29965 i++;
29966 }
29967
29968 return {
29969 timeStamp: now(),
29970 pointers: pointers,
29971 center: getCenter(pointers),
29972 deltaX: input.deltaX,
29973 deltaY: input.deltaY
29974 };
29975 }
29976 /**
29977 * get the center of all the pointers
29978 * @param {Array} pointers
29979 * @return {Object} center contains `x` and `y` properties
29980 */
29981
29982
29983 function getCenter(pointers) {
29984 var pointersLength = pointers.length; // no need to loop when only one touch
29985
29986 if (pointersLength === 1) {
29987 return {
29988 x: round(pointers[0].clientX),
29989 y: round(pointers[0].clientY)
29990 };
29991 }
29992
29993 var x = 0,
29994 y = 0,
29995 i = 0;
29996
29997 while (i < pointersLength) {
29998 x += pointers[i].clientX;
29999 y += pointers[i].clientY;
30000 i++;
30001 }
30002
30003 return {
30004 x: round(x / pointersLength),
30005 y: round(y / pointersLength)
30006 };
30007 }
30008 /**
30009 * calculate the velocity between two points. unit is in px per ms.
30010 * @param {Number} deltaTime
30011 * @param {Number} x
30012 * @param {Number} y
30013 * @return {Object} velocity `x` and `y`
30014 */
30015
30016
30017 function getVelocity(deltaTime, x, y) {
30018 return {
30019 x: x / deltaTime || 0,
30020 y: y / deltaTime || 0
30021 };
30022 }
30023 /**
30024 * get the direction between two points
30025 * @param {Number} x
30026 * @param {Number} y
30027 * @return {Number} direction
30028 */
30029
30030
30031 function getDirection(x, y) {
30032 if (x === y) {
30033 return DIRECTION_NONE;
30034 }
30035
30036 if (abs(x) >= abs(y)) {
30037 return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
30038 }
30039
30040 return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
30041 }
30042 /**
30043 * calculate the absolute distance between two points
30044 * @param {Object} p1 {x, y}
30045 * @param {Object} p2 {x, y}
30046 * @param {Array} [props] containing x and y keys
30047 * @return {Number} distance
30048 */
30049
30050
30051 function getDistance(p1, p2, props) {
30052 if (!props) {
30053 props = PROPS_XY;
30054 }
30055
30056 var x = p2[props[0]] - p1[props[0]],
30057 y = p2[props[1]] - p1[props[1]];
30058 return Math.sqrt(x * x + y * y);
30059 }
30060 /**
30061 * calculate the angle between two coordinates
30062 * @param {Object} p1
30063 * @param {Object} p2
30064 * @param {Array} [props] containing x and y keys
30065 * @return {Number} angle
30066 */
30067
30068
30069 function getAngle(p1, p2, props) {
30070 if (!props) {
30071 props = PROPS_XY;
30072 }
30073
30074 var x = p2[props[0]] - p1[props[0]],
30075 y = p2[props[1]] - p1[props[1]];
30076 return Math.atan2(y, x) * 180 / Math.PI;
30077 }
30078 /**
30079 * calculate the rotation degrees between two pointersets
30080 * @param {Array} start array of pointers
30081 * @param {Array} end array of pointers
30082 * @return {Number} rotation
30083 */
30084
30085
30086 function getRotation(start, end) {
30087 return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
30088 }
30089 /**
30090 * calculate the scale factor between two pointersets
30091 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
30092 * @param {Array} start array of pointers
30093 * @param {Array} end array of pointers
30094 * @return {Number} scale
30095 */
30096
30097
30098 function getScale(start, end) {
30099 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
30100 }
30101
30102 var MOUSE_INPUT_MAP = {
30103 mousedown: INPUT_START,
30104 mousemove: INPUT_MOVE,
30105 mouseup: INPUT_END
30106 };
30107 var MOUSE_ELEMENT_EVENTS = 'mousedown';
30108 var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
30109 /**
30110 * Mouse events input
30111 * @constructor
30112 * @extends Input
30113 */
30114
30115 function MouseInput() {
30116 this.evEl = MOUSE_ELEMENT_EVENTS;
30117 this.evWin = MOUSE_WINDOW_EVENTS;
30118 this.pressed = false; // mousedown state
30119
30120 Input.apply(this, arguments);
30121 }
30122
30123 inherit(MouseInput, Input, {
30124 /**
30125 * handle mouse events
30126 * @param {Object} ev
30127 */
30128 handler: function MEhandler(ev) {
30129 var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down
30130
30131 if (eventType & INPUT_START && ev.button === 0) {
30132 this.pressed = true;
30133 }
30134
30135 if (eventType & INPUT_MOVE && ev.which !== 1) {
30136 eventType = INPUT_END;
30137 } // mouse must be down
30138
30139
30140 if (!this.pressed) {
30141 return;
30142 }
30143
30144 if (eventType & INPUT_END) {
30145 this.pressed = false;
30146 }
30147
30148 this.callback(this.manager, eventType, {
30149 pointers: [ev],
30150 changedPointers: [ev],
30151 pointerType: INPUT_TYPE_MOUSE,
30152 srcEvent: ev
30153 });
30154 }
30155 });
30156 var POINTER_INPUT_MAP = {
30157 pointerdown: INPUT_START,
30158 pointermove: INPUT_MOVE,
30159 pointerup: INPUT_END,
30160 pointercancel: INPUT_CANCEL,
30161 pointerout: INPUT_CANCEL
30162 }; // in IE10 the pointer types is defined as an enum
30163
30164 var IE10_POINTER_TYPE_ENUM = {
30165 2: INPUT_TYPE_TOUCH,
30166 3: INPUT_TYPE_PEN,
30167 4: INPUT_TYPE_MOUSE,
30168 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
30169
30170 };
30171 var POINTER_ELEMENT_EVENTS = 'pointerdown';
30172 var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive
30173
30174 if (window.MSPointerEvent && !window.PointerEvent) {
30175 POINTER_ELEMENT_EVENTS = 'MSPointerDown';
30176 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
30177 }
30178 /**
30179 * Pointer events input
30180 * @constructor
30181 * @extends Input
30182 */
30183
30184
30185 function PointerEventInput() {
30186 this.evEl = POINTER_ELEMENT_EVENTS;
30187 this.evWin = POINTER_WINDOW_EVENTS;
30188 Input.apply(this, arguments);
30189 this.store = this.manager.session.pointerEvents = [];
30190 }
30191
30192 inherit(PointerEventInput, Input, {
30193 /**
30194 * handle mouse events
30195 * @param {Object} ev
30196 */
30197 handler: function PEhandler(ev) {
30198 var store = this.store;
30199 var removePointer = false;
30200 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
30201 var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
30202 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
30203 var isTouch = pointerType == INPUT_TYPE_TOUCH; // get index of the event in the store
30204
30205 var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down
30206
30207 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
30208 if (storeIndex < 0) {
30209 store.push(ev);
30210 storeIndex = store.length - 1;
30211 }
30212 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
30213 removePointer = true;
30214 } // it not found, so the pointer hasn't been down (so it's probably a hover)
30215
30216
30217 if (storeIndex < 0) {
30218 return;
30219 } // update the event in the store
30220
30221
30222 store[storeIndex] = ev;
30223 this.callback(this.manager, eventType, {
30224 pointers: store,
30225 changedPointers: [ev],
30226 pointerType: pointerType,
30227 srcEvent: ev
30228 });
30229
30230 if (removePointer) {
30231 // remove from the store
30232 store.splice(storeIndex, 1);
30233 }
30234 }
30235 });
30236 var SINGLE_TOUCH_INPUT_MAP = {
30237 touchstart: INPUT_START,
30238 touchmove: INPUT_MOVE,
30239 touchend: INPUT_END,
30240 touchcancel: INPUT_CANCEL
30241 };
30242 var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
30243 var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
30244 /**
30245 * Touch events input
30246 * @constructor
30247 * @extends Input
30248 */
30249
30250 function SingleTouchInput() {
30251 this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
30252 this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
30253 this.started = false;
30254 Input.apply(this, arguments);
30255 }
30256
30257 inherit(SingleTouchInput, Input, {
30258 handler: function TEhandler(ev) {
30259 var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?
30260
30261 if (type === INPUT_START) {
30262 this.started = true;
30263 }
30264
30265 if (!this.started) {
30266 return;
30267 }
30268
30269 var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state
30270
30271 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
30272 this.started = false;
30273 }
30274
30275 this.callback(this.manager, type, {
30276 pointers: touches[0],
30277 changedPointers: touches[1],
30278 pointerType: INPUT_TYPE_TOUCH,
30279 srcEvent: ev
30280 });
30281 }
30282 });
30283 /**
30284 * @this {TouchInput}
30285 * @param {Object} ev
30286 * @param {Number} type flag
30287 * @returns {undefined|Array} [all, changed]
30288 */
30289
30290 function normalizeSingleTouches(ev, type) {
30291 var all = toArray(ev.touches);
30292 var changed = toArray(ev.changedTouches);
30293
30294 if (type & (INPUT_END | INPUT_CANCEL)) {
30295 all = uniqueArray(all.concat(changed), 'identifier', true);
30296 }
30297
30298 return [all, changed];
30299 }
30300
30301 var TOUCH_INPUT_MAP = {
30302 touchstart: INPUT_START,
30303 touchmove: INPUT_MOVE,
30304 touchend: INPUT_END,
30305 touchcancel: INPUT_CANCEL
30306 };
30307 var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
30308 /**
30309 * Multi-user touch events input
30310 * @constructor
30311 * @extends Input
30312 */
30313
30314 function TouchInput() {
30315 this.evTarget = TOUCH_TARGET_EVENTS;
30316 this.targetIds = {};
30317 Input.apply(this, arguments);
30318 }
30319
30320 inherit(TouchInput, Input, {
30321 handler: function MTEhandler(ev) {
30322 var type = TOUCH_INPUT_MAP[ev.type];
30323 var touches = getTouches.call(this, ev, type);
30324
30325 if (!touches) {
30326 return;
30327 }
30328
30329 this.callback(this.manager, type, {
30330 pointers: touches[0],
30331 changedPointers: touches[1],
30332 pointerType: INPUT_TYPE_TOUCH,
30333 srcEvent: ev
30334 });
30335 }
30336 });
30337 /**
30338 * @this {TouchInput}
30339 * @param {Object} ev
30340 * @param {Number} type flag
30341 * @returns {undefined|Array} [all, changed]
30342 */
30343
30344 function getTouches(ev, type) {
30345 var allTouches = toArray(ev.touches);
30346 var targetIds = this.targetIds; // when there is only one touch, the process can be simplified
30347
30348 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
30349 targetIds[allTouches[0].identifier] = true;
30350 return [allTouches, allTouches];
30351 }
30352
30353 var i,
30354 targetTouches,
30355 changedTouches = toArray(ev.changedTouches),
30356 changedTargetTouches = [],
30357 target = this.target; // get target touches from touches
30358
30359 targetTouches = allTouches.filter(function (touch) {
30360 return hasParent(touch.target, target);
30361 }); // collect touches
30362
30363 if (type === INPUT_START) {
30364 i = 0;
30365
30366 while (i < targetTouches.length) {
30367 targetIds[targetTouches[i].identifier] = true;
30368 i++;
30369 }
30370 } // filter changed touches to only contain touches that exist in the collected target ids
30371
30372
30373 i = 0;
30374
30375 while (i < changedTouches.length) {
30376 if (targetIds[changedTouches[i].identifier]) {
30377 changedTargetTouches.push(changedTouches[i]);
30378 } // cleanup removed touches
30379
30380
30381 if (type & (INPUT_END | INPUT_CANCEL)) {
30382 delete targetIds[changedTouches[i].identifier];
30383 }
30384
30385 i++;
30386 }
30387
30388 if (!changedTargetTouches.length) {
30389 return;
30390 }
30391
30392 return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
30393 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
30394 }
30395 /**
30396 * Combined touch and mouse input
30397 *
30398 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
30399 * This because touch devices also emit mouse events while doing a touch.
30400 *
30401 * @constructor
30402 * @extends Input
30403 */
30404
30405
30406 var DEDUP_TIMEOUT = 2500;
30407 var DEDUP_DISTANCE = 25;
30408
30409 function TouchMouseInput() {
30410 Input.apply(this, arguments);
30411 var handler = bindFn(this.handler, this);
30412 this.touch = new TouchInput(this.manager, handler);
30413 this.mouse = new MouseInput(this.manager, handler);
30414 this.primaryTouch = null;
30415 this.lastTouches = [];
30416 }
30417
30418 inherit(TouchMouseInput, Input, {
30419 /**
30420 * handle mouse and touch events
30421 * @param {Hammer} manager
30422 * @param {String} inputEvent
30423 * @param {Object} inputData
30424 */
30425 handler: function TMEhandler(manager, inputEvent, inputData) {
30426 var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,
30427 isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;
30428
30429 if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
30430 return;
30431 } // when we're in a touch event, record touches to de-dupe synthetic mouse event
30432
30433
30434 if (isTouch) {
30435 recordTouches.call(this, inputEvent, inputData);
30436 } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
30437 return;
30438 }
30439
30440 this.callback(manager, inputEvent, inputData);
30441 },
30442
30443 /**
30444 * remove the event listeners
30445 */
30446 destroy: function destroy() {
30447 this.touch.destroy();
30448 this.mouse.destroy();
30449 }
30450 });
30451
30452 function recordTouches(eventType, eventData) {
30453 if (eventType & INPUT_START) {
30454 this.primaryTouch = eventData.changedPointers[0].identifier;
30455 setLastTouch.call(this, eventData);
30456 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
30457 setLastTouch.call(this, eventData);
30458 }
30459 }
30460
30461 function setLastTouch(eventData) {
30462 var touch = eventData.changedPointers[0];
30463
30464 if (touch.identifier === this.primaryTouch) {
30465 var lastTouch = {
30466 x: touch.clientX,
30467 y: touch.clientY
30468 };
30469 this.lastTouches.push(lastTouch);
30470 var lts = this.lastTouches;
30471
30472 var removeLastTouch = function () {
30473 var i = lts.indexOf(lastTouch);
30474
30475 if (i > -1) {
30476 lts.splice(i, 1);
30477 }
30478 };
30479
30480 setTimeout(removeLastTouch, DEDUP_TIMEOUT);
30481 }
30482 }
30483
30484 function isSyntheticEvent(eventData) {
30485 var x = eventData.srcEvent.clientX,
30486 y = eventData.srcEvent.clientY;
30487
30488 for (var i = 0; i < this.lastTouches.length; i++) {
30489 var t = this.lastTouches[i];
30490 var dx = Math.abs(x - t.x),
30491 dy = Math.abs(y - t.y);
30492
30493 if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
30494 return true;
30495 }
30496 }
30497
30498 return false;
30499 }
30500
30501 var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
30502 var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined$1; // magical touchAction value
30503
30504 var TOUCH_ACTION_COMPUTE = 'compute';
30505 var TOUCH_ACTION_AUTO = 'auto';
30506 var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
30507
30508 var TOUCH_ACTION_NONE = 'none';
30509 var TOUCH_ACTION_PAN_X = 'pan-x';
30510 var TOUCH_ACTION_PAN_Y = 'pan-y';
30511 var TOUCH_ACTION_MAP = getTouchActionProps();
30512 /**
30513 * Touch Action
30514 * sets the touchAction property or uses the js alternative
30515 * @param {Manager} manager
30516 * @param {String} value
30517 * @constructor
30518 */
30519
30520 function TouchAction(manager, value) {
30521 this.manager = manager;
30522 this.set(value);
30523 }
30524
30525 TouchAction.prototype = {
30526 /**
30527 * set the touchAction value on the element or enable the polyfill
30528 * @param {String} value
30529 */
30530 set: function (value) {
30531 // find out the touch-action by the event handlers
30532 if (value == TOUCH_ACTION_COMPUTE) {
30533 value = this.compute();
30534 }
30535
30536 if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
30537 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
30538 }
30539
30540 this.actions = value.toLowerCase().trim();
30541 },
30542
30543 /**
30544 * just re-set the touchAction value
30545 */
30546 update: function () {
30547 this.set(this.manager.options.touchAction);
30548 },
30549
30550 /**
30551 * compute the value for the touchAction property based on the recognizer's settings
30552 * @returns {String} value
30553 */
30554 compute: function () {
30555 var actions = [];
30556 each(this.manager.recognizers, function (recognizer) {
30557 if (boolOrFn(recognizer.options.enable, [recognizer])) {
30558 actions = actions.concat(recognizer.getTouchAction());
30559 }
30560 });
30561 return cleanTouchActions(actions.join(' '));
30562 },
30563
30564 /**
30565 * this method is called on each input cycle and provides the preventing of the browser behavior
30566 * @param {Object} input
30567 */
30568 preventDefaults: function (input) {
30569 var srcEvent = input.srcEvent;
30570 var direction = input.offsetDirection; // if the touch action did prevented once this session
30571
30572 if (this.manager.session.prevented) {
30573 srcEvent.preventDefault();
30574 return;
30575 }
30576
30577 var actions = this.actions;
30578 var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
30579 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
30580 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
30581
30582 if (hasNone) {
30583 //do not prevent defaults if this is a tap gesture
30584 var isTapPointer = input.pointers.length === 1;
30585 var isTapMovement = input.distance < 2;
30586 var isTapTouchTime = input.deltaTime < 250;
30587
30588 if (isTapPointer && isTapMovement && isTapTouchTime) {
30589 return;
30590 }
30591 }
30592
30593 if (hasPanX && hasPanY) {
30594 // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
30595 return;
30596 }
30597
30598 if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
30599 return this.preventSrc(srcEvent);
30600 }
30601 },
30602
30603 /**
30604 * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
30605 * @param {Object} srcEvent
30606 */
30607 preventSrc: function (srcEvent) {
30608 this.manager.session.prevented = true;
30609 srcEvent.preventDefault();
30610 }
30611 };
30612 /**
30613 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
30614 * @param {String} actions
30615 * @returns {*}
30616 */
30617
30618 function cleanTouchActions(actions) {
30619 // none
30620 if (inStr(actions, TOUCH_ACTION_NONE)) {
30621 return TOUCH_ACTION_NONE;
30622 }
30623
30624 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
30625 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers
30626 // for different directions, e.g. horizontal pan but vertical swipe?)
30627 // we need none (as otherwise with pan-x pan-y combined none of these
30628 // recognizers will work, since the browser would handle all panning
30629
30630 if (hasPanX && hasPanY) {
30631 return TOUCH_ACTION_NONE;
30632 } // pan-x OR pan-y
30633
30634
30635 if (hasPanX || hasPanY) {
30636 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
30637 } // manipulation
30638
30639
30640 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
30641 return TOUCH_ACTION_MANIPULATION;
30642 }
30643
30644 return TOUCH_ACTION_AUTO;
30645 }
30646
30647 function getTouchActionProps() {
30648 if (!NATIVE_TOUCH_ACTION) {
30649 return false;
30650 }
30651
30652 var touchMap = {};
30653 var cssSupports = window.CSS && window.CSS.supports;
30654 ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
30655 // If css.supports is not supported but there is native touch-action assume it supports
30656 // all values. This is the case for IE 10 and 11.
30657 touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
30658 });
30659 return touchMap;
30660 }
30661 /**
30662 * Recognizer flow explained; *
30663 * All recognizers have the initial state of POSSIBLE when a input session starts.
30664 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
30665 * Example session for mouse-input: mousedown -> mousemove -> mouseup
30666 *
30667 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
30668 * which determines with state it should be.
30669 *
30670 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
30671 * POSSIBLE to give it another change on the next cycle.
30672 *
30673 * Possible
30674 * |
30675 * +-----+---------------+
30676 * | |
30677 * +-----+-----+ |
30678 * | | |
30679 * Failed Cancelled |
30680 * +-------+------+
30681 * | |
30682 * Recognized Began
30683 * |
30684 * Changed
30685 * |
30686 * Ended/Recognized
30687 */
30688
30689
30690 var STATE_POSSIBLE = 1;
30691 var STATE_BEGAN = 2;
30692 var STATE_CHANGED = 4;
30693 var STATE_ENDED = 8;
30694 var STATE_RECOGNIZED = STATE_ENDED;
30695 var STATE_CANCELLED = 16;
30696 var STATE_FAILED = 32;
30697 /**
30698 * Recognizer
30699 * Every recognizer needs to extend from this class.
30700 * @constructor
30701 * @param {Object} options
30702 */
30703
30704 function Recognizer(options) {
30705 this.options = assign({}, this.defaults, options || {});
30706 this.id = uniqueId();
30707 this.manager = null; // default is enable true
30708
30709 this.options.enable = ifUndefined(this.options.enable, true);
30710 this.state = STATE_POSSIBLE;
30711 this.simultaneous = {};
30712 this.requireFail = [];
30713 }
30714
30715 Recognizer.prototype = {
30716 /**
30717 * @virtual
30718 * @type {Object}
30719 */
30720 defaults: {},
30721
30722 /**
30723 * set options
30724 * @param {Object} options
30725 * @return {Recognizer}
30726 */
30727 set: function (options) {
30728 assign(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state
30729
30730 this.manager && this.manager.touchAction.update();
30731 return this;
30732 },
30733
30734 /**
30735 * recognize simultaneous with an other recognizer.
30736 * @param {Recognizer} otherRecognizer
30737 * @returns {Recognizer} this
30738 */
30739 recognizeWith: function (otherRecognizer) {
30740 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
30741 return this;
30742 }
30743
30744 var simultaneous = this.simultaneous;
30745 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
30746
30747 if (!simultaneous[otherRecognizer.id]) {
30748 simultaneous[otherRecognizer.id] = otherRecognizer;
30749 otherRecognizer.recognizeWith(this);
30750 }
30751
30752 return this;
30753 },
30754
30755 /**
30756 * drop the simultaneous link. it doesnt remove the link on the other recognizer.
30757 * @param {Recognizer} otherRecognizer
30758 * @returns {Recognizer} this
30759 */
30760 dropRecognizeWith: function (otherRecognizer) {
30761 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
30762 return this;
30763 }
30764
30765 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
30766 delete this.simultaneous[otherRecognizer.id];
30767 return this;
30768 },
30769
30770 /**
30771 * recognizer can only run when an other is failing
30772 * @param {Recognizer} otherRecognizer
30773 * @returns {Recognizer} this
30774 */
30775 requireFailure: function (otherRecognizer) {
30776 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
30777 return this;
30778 }
30779
30780 var requireFail = this.requireFail;
30781 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
30782
30783 if (inArray(requireFail, otherRecognizer) === -1) {
30784 requireFail.push(otherRecognizer);
30785 otherRecognizer.requireFailure(this);
30786 }
30787
30788 return this;
30789 },
30790
30791 /**
30792 * drop the requireFailure link. it does not remove the link on the other recognizer.
30793 * @param {Recognizer} otherRecognizer
30794 * @returns {Recognizer} this
30795 */
30796 dropRequireFailure: function (otherRecognizer) {
30797 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
30798 return this;
30799 }
30800
30801 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
30802 var index = inArray(this.requireFail, otherRecognizer);
30803
30804 if (index > -1) {
30805 this.requireFail.splice(index, 1);
30806 }
30807
30808 return this;
30809 },
30810
30811 /**
30812 * has require failures boolean
30813 * @returns {boolean}
30814 */
30815 hasRequireFailures: function () {
30816 return this.requireFail.length > 0;
30817 },
30818
30819 /**
30820 * if the recognizer can recognize simultaneous with an other recognizer
30821 * @param {Recognizer} otherRecognizer
30822 * @returns {Boolean}
30823 */
30824 canRecognizeWith: function (otherRecognizer) {
30825 return !!this.simultaneous[otherRecognizer.id];
30826 },
30827
30828 /**
30829 * You should use `tryEmit` instead of `emit` directly to check
30830 * that all the needed recognizers has failed before emitting.
30831 * @param {Object} input
30832 */
30833 emit: function (input) {
30834 var self = this;
30835 var state = this.state;
30836
30837 function emit(event) {
30838 self.manager.emit(event, input);
30839 } // 'panstart' and 'panmove'
30840
30841
30842 if (state < STATE_ENDED) {
30843 emit(self.options.event + stateStr(state));
30844 }
30845
30846 emit(self.options.event); // simple 'eventName' events
30847
30848 if (input.additionalEvent) {
30849 // additional event(panleft, panright, pinchin, pinchout...)
30850 emit(input.additionalEvent);
30851 } // panend and pancancel
30852
30853
30854 if (state >= STATE_ENDED) {
30855 emit(self.options.event + stateStr(state));
30856 }
30857 },
30858
30859 /**
30860 * Check that all the require failure recognizers has failed,
30861 * if true, it emits a gesture event,
30862 * otherwise, setup the state to FAILED.
30863 * @param {Object} input
30864 */
30865 tryEmit: function (input) {
30866 if (this.canEmit()) {
30867 return this.emit(input);
30868 } // it's failing anyway
30869
30870
30871 this.state = STATE_FAILED;
30872 },
30873
30874 /**
30875 * can we emit?
30876 * @returns {boolean}
30877 */
30878 canEmit: function () {
30879 var i = 0;
30880
30881 while (i < this.requireFail.length) {
30882 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
30883 return false;
30884 }
30885
30886 i++;
30887 }
30888
30889 return true;
30890 },
30891
30892 /**
30893 * update the recognizer
30894 * @param {Object} inputData
30895 */
30896 recognize: function (inputData) {
30897 // make a new copy of the inputData
30898 // so we can change the inputData without messing up the other recognizers
30899 var inputDataClone = assign({}, inputData); // is is enabled and allow recognizing?
30900
30901 if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
30902 this.reset();
30903 this.state = STATE_FAILED;
30904 return;
30905 } // reset when we've reached the end
30906
30907
30908 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
30909 this.state = STATE_POSSIBLE;
30910 }
30911
30912 this.state = this.process(inputDataClone); // the recognizer has recognized a gesture
30913 // so trigger an event
30914
30915 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
30916 this.tryEmit(inputDataClone);
30917 }
30918 },
30919
30920 /**
30921 * return the state of the recognizer
30922 * the actual recognizing happens in this method
30923 * @virtual
30924 * @param {Object} inputData
30925 * @returns {Const} STATE
30926 */
30927 process: function (inputData) {},
30928 // jshint ignore:line
30929
30930 /**
30931 * return the preferred touch-action
30932 * @virtual
30933 * @returns {Array}
30934 */
30935 getTouchAction: function () {},
30936
30937 /**
30938 * called when the gesture isn't allowed to recognize
30939 * like when another is being recognized or it is disabled
30940 * @virtual
30941 */
30942 reset: function () {}
30943 };
30944 /**
30945 * get a usable string, used as event postfix
30946 * @param {Const} state
30947 * @returns {String} state
30948 */
30949
30950 function stateStr(state) {
30951 if (state & STATE_CANCELLED) {
30952 return 'cancel';
30953 } else if (state & STATE_ENDED) {
30954 return 'end';
30955 } else if (state & STATE_CHANGED) {
30956 return 'move';
30957 } else if (state & STATE_BEGAN) {
30958 return 'start';
30959 }
30960
30961 return '';
30962 }
30963 /**
30964 * direction cons to string
30965 * @param {Const} direction
30966 * @returns {String}
30967 */
30968
30969
30970 function directionStr(direction) {
30971 if (direction == DIRECTION_DOWN) {
30972 return 'down';
30973 } else if (direction == DIRECTION_UP) {
30974 return 'up';
30975 } else if (direction == DIRECTION_LEFT) {
30976 return 'left';
30977 } else if (direction == DIRECTION_RIGHT) {
30978 return 'right';
30979 }
30980
30981 return '';
30982 }
30983 /**
30984 * get a recognizer by name if it is bound to a manager
30985 * @param {Recognizer|String} otherRecognizer
30986 * @param {Recognizer} recognizer
30987 * @returns {Recognizer}
30988 */
30989
30990
30991 function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
30992 var manager = recognizer.manager;
30993
30994 if (manager) {
30995 return manager.get(otherRecognizer);
30996 }
30997
30998 return otherRecognizer;
30999 }
31000 /**
31001 * This recognizer is just used as a base for the simple attribute recognizers.
31002 * @constructor
31003 * @extends Recognizer
31004 */
31005
31006
31007 function AttrRecognizer() {
31008 Recognizer.apply(this, arguments);
31009 }
31010
31011 inherit(AttrRecognizer, Recognizer, {
31012 /**
31013 * @namespace
31014 * @memberof AttrRecognizer
31015 */
31016 defaults: {
31017 /**
31018 * @type {Number}
31019 * @default 1
31020 */
31021 pointers: 1
31022 },
31023
31024 /**
31025 * Used to check if it the recognizer receives valid input, like input.distance > 10.
31026 * @memberof AttrRecognizer
31027 * @param {Object} input
31028 * @returns {Boolean} recognized
31029 */
31030 attrTest: function (input) {
31031 var optionPointers = this.options.pointers;
31032 return optionPointers === 0 || input.pointers.length === optionPointers;
31033 },
31034
31035 /**
31036 * Process the input and return the state for the recognizer
31037 * @memberof AttrRecognizer
31038 * @param {Object} input
31039 * @returns {*} State
31040 */
31041 process: function (input) {
31042 var state = this.state;
31043 var eventType = input.eventType;
31044 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
31045 var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED
31046
31047 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
31048 return state | STATE_CANCELLED;
31049 } else if (isRecognized || isValid) {
31050 if (eventType & INPUT_END) {
31051 return state | STATE_ENDED;
31052 } else if (!(state & STATE_BEGAN)) {
31053 return STATE_BEGAN;
31054 }
31055
31056 return state | STATE_CHANGED;
31057 }
31058
31059 return STATE_FAILED;
31060 }
31061 });
31062 /**
31063 * Pan
31064 * Recognized when the pointer is down and moved in the allowed direction.
31065 * @constructor
31066 * @extends AttrRecognizer
31067 */
31068
31069 function PanRecognizer() {
31070 AttrRecognizer.apply(this, arguments);
31071 this.pX = null;
31072 this.pY = null;
31073 }
31074
31075 inherit(PanRecognizer, AttrRecognizer, {
31076 /**
31077 * @namespace
31078 * @memberof PanRecognizer
31079 */
31080 defaults: {
31081 event: 'pan',
31082 threshold: 10,
31083 pointers: 1,
31084 direction: DIRECTION_ALL
31085 },
31086 getTouchAction: function () {
31087 var direction = this.options.direction;
31088 var actions = [];
31089
31090 if (direction & DIRECTION_HORIZONTAL) {
31091 actions.push(TOUCH_ACTION_PAN_Y);
31092 }
31093
31094 if (direction & DIRECTION_VERTICAL) {
31095 actions.push(TOUCH_ACTION_PAN_X);
31096 }
31097
31098 return actions;
31099 },
31100 directionTest: function (input) {
31101 var options = this.options;
31102 var hasMoved = true;
31103 var distance = input.distance;
31104 var direction = input.direction;
31105 var x = input.deltaX;
31106 var y = input.deltaY; // lock to axis?
31107
31108 if (!(direction & options.direction)) {
31109 if (options.direction & DIRECTION_HORIZONTAL) {
31110 direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
31111 hasMoved = x != this.pX;
31112 distance = Math.abs(input.deltaX);
31113 } else {
31114 direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
31115 hasMoved = y != this.pY;
31116 distance = Math.abs(input.deltaY);
31117 }
31118 }
31119
31120 input.direction = direction;
31121 return hasMoved && distance > options.threshold && direction & options.direction;
31122 },
31123 attrTest: function (input) {
31124 return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
31125 },
31126 emit: function (input) {
31127 this.pX = input.deltaX;
31128 this.pY = input.deltaY;
31129 var direction = directionStr(input.direction);
31130
31131 if (direction) {
31132 input.additionalEvent = this.options.event + direction;
31133 }
31134
31135 this._super.emit.call(this, input);
31136 }
31137 });
31138 /**
31139 * Pinch
31140 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
31141 * @constructor
31142 * @extends AttrRecognizer
31143 */
31144
31145 function PinchRecognizer() {
31146 AttrRecognizer.apply(this, arguments);
31147 }
31148
31149 inherit(PinchRecognizer, AttrRecognizer, {
31150 /**
31151 * @namespace
31152 * @memberof PinchRecognizer
31153 */
31154 defaults: {
31155 event: 'pinch',
31156 threshold: 0,
31157 pointers: 2
31158 },
31159 getTouchAction: function () {
31160 return [TOUCH_ACTION_NONE];
31161 },
31162 attrTest: function (input) {
31163 return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
31164 },
31165 emit: function (input) {
31166 if (input.scale !== 1) {
31167 var inOut = input.scale < 1 ? 'in' : 'out';
31168 input.additionalEvent = this.options.event + inOut;
31169 }
31170
31171 this._super.emit.call(this, input);
31172 }
31173 });
31174 /**
31175 * Press
31176 * Recognized when the pointer is down for x ms without any movement.
31177 * @constructor
31178 * @extends Recognizer
31179 */
31180
31181 function PressRecognizer() {
31182 Recognizer.apply(this, arguments);
31183 this._timer = null;
31184 this._input = null;
31185 }
31186
31187 inherit(PressRecognizer, Recognizer, {
31188 /**
31189 * @namespace
31190 * @memberof PressRecognizer
31191 */
31192 defaults: {
31193 event: 'press',
31194 pointers: 1,
31195 time: 251,
31196 // minimal time of the pointer to be pressed
31197 threshold: 9 // a minimal movement is ok, but keep it low
31198
31199 },
31200 getTouchAction: function () {
31201 return [TOUCH_ACTION_AUTO];
31202 },
31203 process: function (input) {
31204 var options = this.options;
31205 var validPointers = input.pointers.length === options.pointers;
31206 var validMovement = input.distance < options.threshold;
31207 var validTime = input.deltaTime > options.time;
31208 this._input = input; // we only allow little movement
31209 // and we've reached an end event, so a tap is possible
31210
31211 if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
31212 this.reset();
31213 } else if (input.eventType & INPUT_START) {
31214 this.reset();
31215 this._timer = setTimeoutContext(function () {
31216 this.state = STATE_RECOGNIZED;
31217 this.tryEmit();
31218 }, options.time, this);
31219 } else if (input.eventType & INPUT_END) {
31220 return STATE_RECOGNIZED;
31221 }
31222
31223 return STATE_FAILED;
31224 },
31225 reset: function () {
31226 clearTimeout(this._timer);
31227 },
31228 emit: function (input) {
31229 if (this.state !== STATE_RECOGNIZED) {
31230 return;
31231 }
31232
31233 if (input && input.eventType & INPUT_END) {
31234 this.manager.emit(this.options.event + 'up', input);
31235 } else {
31236 this._input.timeStamp = now();
31237 this.manager.emit(this.options.event, this._input);
31238 }
31239 }
31240 });
31241 /**
31242 * Rotate
31243 * Recognized when two or more pointer are moving in a circular motion.
31244 * @constructor
31245 * @extends AttrRecognizer
31246 */
31247
31248 function RotateRecognizer() {
31249 AttrRecognizer.apply(this, arguments);
31250 }
31251
31252 inherit(RotateRecognizer, AttrRecognizer, {
31253 /**
31254 * @namespace
31255 * @memberof RotateRecognizer
31256 */
31257 defaults: {
31258 event: 'rotate',
31259 threshold: 0,
31260 pointers: 2
31261 },
31262 getTouchAction: function () {
31263 return [TOUCH_ACTION_NONE];
31264 },
31265 attrTest: function (input) {
31266 return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
31267 }
31268 });
31269 /**
31270 * Swipe
31271 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
31272 * @constructor
31273 * @extends AttrRecognizer
31274 */
31275
31276 function SwipeRecognizer() {
31277 AttrRecognizer.apply(this, arguments);
31278 }
31279
31280 inherit(SwipeRecognizer, AttrRecognizer, {
31281 /**
31282 * @namespace
31283 * @memberof SwipeRecognizer
31284 */
31285 defaults: {
31286 event: 'swipe',
31287 threshold: 10,
31288 velocity: 0.3,
31289 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
31290 pointers: 1
31291 },
31292 getTouchAction: function () {
31293 return PanRecognizer.prototype.getTouchAction.call(this);
31294 },
31295 attrTest: function (input) {
31296 var direction = this.options.direction;
31297 var velocity;
31298
31299 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
31300 velocity = input.overallVelocity;
31301 } else if (direction & DIRECTION_HORIZONTAL) {
31302 velocity = input.overallVelocityX;
31303 } else if (direction & DIRECTION_VERTICAL) {
31304 velocity = input.overallVelocityY;
31305 }
31306
31307 return this._super.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;
31308 },
31309 emit: function (input) {
31310 var direction = directionStr(input.offsetDirection);
31311
31312 if (direction) {
31313 this.manager.emit(this.options.event + direction, input);
31314 }
31315
31316 this.manager.emit(this.options.event, input);
31317 }
31318 });
31319 /**
31320 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
31321 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
31322 * a single tap.
31323 *
31324 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
31325 * multi-taps being recognized.
31326 * @constructor
31327 * @extends Recognizer
31328 */
31329
31330 function TapRecognizer() {
31331 Recognizer.apply(this, arguments); // previous time and center,
31332 // used for tap counting
31333
31334 this.pTime = false;
31335 this.pCenter = false;
31336 this._timer = null;
31337 this._input = null;
31338 this.count = 0;
31339 }
31340
31341 inherit(TapRecognizer, Recognizer, {
31342 /**
31343 * @namespace
31344 * @memberof PinchRecognizer
31345 */
31346 defaults: {
31347 event: 'tap',
31348 pointers: 1,
31349 taps: 1,
31350 interval: 300,
31351 // max time between the multi-tap taps
31352 time: 250,
31353 // max time of the pointer to be down (like finger on the screen)
31354 threshold: 9,
31355 // a minimal movement is ok, but keep it low
31356 posThreshold: 10 // a multi-tap can be a bit off the initial position
31357
31358 },
31359 getTouchAction: function () {
31360 return [TOUCH_ACTION_MANIPULATION];
31361 },
31362 process: function (input) {
31363 var options = this.options;
31364 var validPointers = input.pointers.length === options.pointers;
31365 var validMovement = input.distance < options.threshold;
31366 var validTouchTime = input.deltaTime < options.time;
31367 this.reset();
31368
31369 if (input.eventType & INPUT_START && this.count === 0) {
31370 return this.failTimeout();
31371 } // we only allow little movement
31372 // and we've reached an end event, so a tap is possible
31373
31374
31375 if (validMovement && validTouchTime && validPointers) {
31376 if (input.eventType != INPUT_END) {
31377 return this.failTimeout();
31378 }
31379
31380 var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
31381 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
31382 this.pTime = input.timeStamp;
31383 this.pCenter = input.center;
31384
31385 if (!validMultiTap || !validInterval) {
31386 this.count = 1;
31387 } else {
31388 this.count += 1;
31389 }
31390
31391 this._input = input; // if tap count matches we have recognized it,
31392 // else it has began recognizing...
31393
31394 var tapCount = this.count % options.taps;
31395
31396 if (tapCount === 0) {
31397 // no failing requirements, immediately trigger the tap event
31398 // or wait as long as the multitap interval to trigger
31399 if (!this.hasRequireFailures()) {
31400 return STATE_RECOGNIZED;
31401 } else {
31402 this._timer = setTimeoutContext(function () {
31403 this.state = STATE_RECOGNIZED;
31404 this.tryEmit();
31405 }, options.interval, this);
31406 return STATE_BEGAN;
31407 }
31408 }
31409 }
31410
31411 return STATE_FAILED;
31412 },
31413 failTimeout: function () {
31414 this._timer = setTimeoutContext(function () {
31415 this.state = STATE_FAILED;
31416 }, this.options.interval, this);
31417 return STATE_FAILED;
31418 },
31419 reset: function () {
31420 clearTimeout(this._timer);
31421 },
31422 emit: function () {
31423 if (this.state == STATE_RECOGNIZED) {
31424 this._input.tapCount = this.count;
31425 this.manager.emit(this.options.event, this._input);
31426 }
31427 }
31428 });
31429 /**
31430 * Simple way to create a manager with a default set of recognizers.
31431 * @param {HTMLElement} element
31432 * @param {Object} [options]
31433 * @constructor
31434 */
31435
31436 function Hammer(element, options) {
31437 options = options || {};
31438 options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
31439 return new Manager(element, options);
31440 }
31441 /**
31442 * @const {string}
31443 */
31444
31445
31446 Hammer.VERSION = '2.0.7';
31447 /**
31448 * default settings
31449 * @namespace
31450 */
31451
31452 Hammer.defaults = {
31453 /**
31454 * set if DOM events are being triggered.
31455 * But this is slower and unused by simple implementations, so disabled by default.
31456 * @type {Boolean}
31457 * @default false
31458 */
31459 domEvents: false,
31460
31461 /**
31462 * The value for the touchAction property/fallback.
31463 * When set to `compute` it will magically set the correct value based on the added recognizers.
31464 * @type {String}
31465 * @default compute
31466 */
31467 touchAction: TOUCH_ACTION_COMPUTE,
31468
31469 /**
31470 * @type {Boolean}
31471 * @default true
31472 */
31473 enable: true,
31474
31475 /**
31476 * EXPERIMENTAL FEATURE -- can be removed/changed
31477 * Change the parent input target element.
31478 * If Null, then it is being set the to main element.
31479 * @type {Null|EventTarget}
31480 * @default null
31481 */
31482 inputTarget: null,
31483
31484 /**
31485 * force an input class
31486 * @type {Null|Function}
31487 * @default null
31488 */
31489 inputClass: null,
31490
31491 /**
31492 * Default recognizer setup when calling `Hammer()`
31493 * When creating a new Manager these will be skipped.
31494 * @type {Array}
31495 */
31496 preset: [// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
31497 [RotateRecognizer, {
31498 enable: false
31499 }], [PinchRecognizer, {
31500 enable: false
31501 }, ['rotate']], [SwipeRecognizer, {
31502 direction: DIRECTION_HORIZONTAL
31503 }], [PanRecognizer, {
31504 direction: DIRECTION_HORIZONTAL
31505 }, ['swipe']], [TapRecognizer], [TapRecognizer, {
31506 event: 'doubletap',
31507 taps: 2
31508 }, ['tap']], [PressRecognizer]],
31509
31510 /**
31511 * Some CSS properties can be used to improve the working of Hammer.
31512 * Add them to this method and they will be set when creating a new Manager.
31513 * @namespace
31514 */
31515 cssProps: {
31516 /**
31517 * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
31518 * @type {String}
31519 * @default 'none'
31520 */
31521 userSelect: 'none',
31522
31523 /**
31524 * Disable the Windows Phone grippers when pressing an element.
31525 * @type {String}
31526 * @default 'none'
31527 */
31528 touchSelect: 'none',
31529
31530 /**
31531 * Disables the default callout shown when you touch and hold a touch target.
31532 * On iOS, when you touch and hold a touch target such as a link, Safari displays
31533 * a callout containing information about the link. This property allows you to disable that callout.
31534 * @type {String}
31535 * @default 'none'
31536 */
31537 touchCallout: 'none',
31538
31539 /**
31540 * Specifies whether zooming is enabled. Used by IE10>
31541 * @type {String}
31542 * @default 'none'
31543 */
31544 contentZooming: 'none',
31545
31546 /**
31547 * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
31548 * @type {String}
31549 * @default 'none'
31550 */
31551 userDrag: 'none',
31552
31553 /**
31554 * Overrides the highlight color shown when the user taps a link or a JavaScript
31555 * clickable element in iOS. This property obeys the alpha value, if specified.
31556 * @type {String}
31557 * @default 'rgba(0,0,0,0)'
31558 */
31559 tapHighlightColor: 'rgba(0,0,0,0)'
31560 }
31561 };
31562 var STOP = 1;
31563 var FORCED_STOP = 2;
31564 /**
31565 * Manager
31566 * @param {HTMLElement} element
31567 * @param {Object} [options]
31568 * @constructor
31569 */
31570
31571 function Manager(element, options) {
31572 this.options = assign({}, Hammer.defaults, options || {});
31573 this.options.inputTarget = this.options.inputTarget || element;
31574 this.handlers = {};
31575 this.session = {};
31576 this.recognizers = [];
31577 this.oldCssProps = {};
31578 this.element = element;
31579 this.input = createInputInstance(this);
31580 this.touchAction = new TouchAction(this, this.options.touchAction);
31581 toggleCssProps(this, true);
31582 each(this.options.recognizers, function (item) {
31583 var recognizer = this.add(new item[0](item[1]));
31584 item[2] && recognizer.recognizeWith(item[2]);
31585 item[3] && recognizer.requireFailure(item[3]);
31586 }, this);
31587 }
31588
31589 Manager.prototype = {
31590 /**
31591 * set options
31592 * @param {Object} options
31593 * @returns {Manager}
31594 */
31595 set: function (options) {
31596 assign(this.options, options); // Options that need a little more setup
31597
31598 if (options.touchAction) {
31599 this.touchAction.update();
31600 }
31601
31602 if (options.inputTarget) {
31603 // Clean up existing event listeners and reinitialize
31604 this.input.destroy();
31605 this.input.target = options.inputTarget;
31606 this.input.init();
31607 }
31608
31609 return this;
31610 },
31611
31612 /**
31613 * stop recognizing for this session.
31614 * This session will be discarded, when a new [input]start event is fired.
31615 * When forced, the recognizer cycle is stopped immediately.
31616 * @param {Boolean} [force]
31617 */
31618 stop: function (force) {
31619 this.session.stopped = force ? FORCED_STOP : STOP;
31620 },
31621
31622 /**
31623 * run the recognizers!
31624 * called by the inputHandler function on every movement of the pointers (touches)
31625 * it walks through all the recognizers and tries to detect the gesture that is being made
31626 * @param {Object} inputData
31627 */
31628 recognize: function (inputData) {
31629 var session = this.session;
31630
31631 if (session.stopped) {
31632 return;
31633 } // run the touch-action polyfill
31634
31635
31636 this.touchAction.preventDefaults(inputData);
31637 var recognizer;
31638 var recognizers = this.recognizers; // this holds the recognizer that is being recognized.
31639 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
31640 // if no recognizer is detecting a thing, it is set to `null`
31641
31642 var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized
31643 // or when we're in a new session
31644
31645 if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
31646 curRecognizer = session.curRecognizer = null;
31647 }
31648
31649 var i = 0;
31650
31651 while (i < recognizers.length) {
31652 recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.
31653 // 1. allow if the session is NOT forced stopped (see the .stop() method)
31654 // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
31655 // that is being recognized.
31656 // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
31657 // this can be setup with the `recognizeWith()` method on the recognizer.
31658
31659 if (session.stopped !== FORCED_STOP && ( // 1
31660 !curRecognizer || recognizer == curRecognizer || // 2
31661 recognizer.canRecognizeWith(curRecognizer))) {
31662 // 3
31663 recognizer.recognize(inputData);
31664 } else {
31665 recognizer.reset();
31666 } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
31667 // current active recognizer. but only if we don't already have an active recognizer
31668
31669
31670 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
31671 curRecognizer = session.curRecognizer = recognizer;
31672 }
31673
31674 i++;
31675 }
31676 },
31677
31678 /**
31679 * get a recognizer by its event name.
31680 * @param {Recognizer|String} recognizer
31681 * @returns {Recognizer|Null}
31682 */
31683 get: function (recognizer) {
31684 if (recognizer instanceof Recognizer) {
31685 return recognizer;
31686 }
31687
31688 var recognizers = this.recognizers;
31689
31690 for (var i = 0; i < recognizers.length; i++) {
31691 if (recognizers[i].options.event == recognizer) {
31692 return recognizers[i];
31693 }
31694 }
31695
31696 return null;
31697 },
31698
31699 /**
31700 * add a recognizer to the manager
31701 * existing recognizers with the same event name will be removed
31702 * @param {Recognizer} recognizer
31703 * @returns {Recognizer|Manager}
31704 */
31705 add: function (recognizer) {
31706 if (invokeArrayArg(recognizer, 'add', this)) {
31707 return this;
31708 } // remove existing
31709
31710
31711 var existing = this.get(recognizer.options.event);
31712
31713 if (existing) {
31714 this.remove(existing);
31715 }
31716
31717 this.recognizers.push(recognizer);
31718 recognizer.manager = this;
31719 this.touchAction.update();
31720 return recognizer;
31721 },
31722
31723 /**
31724 * remove a recognizer by name or instance
31725 * @param {Recognizer|String} recognizer
31726 * @returns {Manager}
31727 */
31728 remove: function (recognizer) {
31729 if (invokeArrayArg(recognizer, 'remove', this)) {
31730 return this;
31731 }
31732
31733 recognizer = this.get(recognizer); // let's make sure this recognizer exists
31734
31735 if (recognizer) {
31736 var recognizers = this.recognizers;
31737 var index = inArray(recognizers, recognizer);
31738
31739 if (index !== -1) {
31740 recognizers.splice(index, 1);
31741 this.touchAction.update();
31742 }
31743 }
31744
31745 return this;
31746 },
31747
31748 /**
31749 * bind event
31750 * @param {String} events
31751 * @param {Function} handler
31752 * @returns {EventEmitter} this
31753 */
31754 on: function (events, handler) {
31755 if (events === undefined$1) {
31756 return;
31757 }
31758
31759 if (handler === undefined$1) {
31760 return;
31761 }
31762
31763 var handlers = this.handlers;
31764 each(splitStr(events), function (event) {
31765 handlers[event] = handlers[event] || [];
31766 handlers[event].push(handler);
31767 });
31768 return this;
31769 },
31770
31771 /**
31772 * unbind event, leave emit blank to remove all handlers
31773 * @param {String} events
31774 * @param {Function} [handler]
31775 * @returns {EventEmitter} this
31776 */
31777 off: function (events, handler) {
31778 if (events === undefined$1) {
31779 return;
31780 }
31781
31782 var handlers = this.handlers;
31783 each(splitStr(events), function (event) {
31784 if (!handler) {
31785 delete handlers[event];
31786 } else {
31787 handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
31788 }
31789 });
31790 return this;
31791 },
31792
31793 /**
31794 * emit event to the listeners
31795 * @param {String} event
31796 * @param {Object} data
31797 */
31798 emit: function (event, data) {
31799 // we also want to trigger dom events
31800 if (this.options.domEvents) {
31801 triggerDomEvent(event, data);
31802 } // no handlers, so skip it all
31803
31804
31805 var handlers = this.handlers[event] && this.handlers[event].slice();
31806
31807 if (!handlers || !handlers.length) {
31808 return;
31809 }
31810
31811 data.type = event;
31812
31813 data.preventDefault = function () {
31814 data.srcEvent.preventDefault();
31815 };
31816
31817 var i = 0;
31818
31819 while (i < handlers.length) {
31820 handlers[i](data);
31821 i++;
31822 }
31823 },
31824
31825 /**
31826 * destroy the manager and unbinds all events
31827 * it doesn't unbind dom events, that is the user own responsibility
31828 */
31829 destroy: function () {
31830 this.element && toggleCssProps(this, false);
31831 this.handlers = {};
31832 this.session = {};
31833 this.input.destroy();
31834 this.element = null;
31835 }
31836 };
31837 /**
31838 * add/remove the css properties as defined in manager.options.cssProps
31839 * @param {Manager} manager
31840 * @param {Boolean} add
31841 */
31842
31843 function toggleCssProps(manager, add) {
31844 var element = manager.element;
31845
31846 if (!element.style) {
31847 return;
31848 }
31849
31850 var prop;
31851 each(manager.options.cssProps, function (value, name) {
31852 prop = prefixed(element.style, name);
31853
31854 if (add) {
31855 manager.oldCssProps[prop] = element.style[prop];
31856 element.style[prop] = value;
31857 } else {
31858 element.style[prop] = manager.oldCssProps[prop] || '';
31859 }
31860 });
31861
31862 if (!add) {
31863 manager.oldCssProps = {};
31864 }
31865 }
31866 /**
31867 * trigger dom event
31868 * @param {String} event
31869 * @param {Object} data
31870 */
31871
31872
31873 function triggerDomEvent(event, data) {
31874 var gestureEvent = document.createEvent('Event');
31875 gestureEvent.initEvent(event, true, true);
31876 gestureEvent.gesture = data;
31877 data.target.dispatchEvent(gestureEvent);
31878 }
31879
31880 assign(Hammer, {
31881 INPUT_START: INPUT_START,
31882 INPUT_MOVE: INPUT_MOVE,
31883 INPUT_END: INPUT_END,
31884 INPUT_CANCEL: INPUT_CANCEL,
31885 STATE_POSSIBLE: STATE_POSSIBLE,
31886 STATE_BEGAN: STATE_BEGAN,
31887 STATE_CHANGED: STATE_CHANGED,
31888 STATE_ENDED: STATE_ENDED,
31889 STATE_RECOGNIZED: STATE_RECOGNIZED,
31890 STATE_CANCELLED: STATE_CANCELLED,
31891 STATE_FAILED: STATE_FAILED,
31892 DIRECTION_NONE: DIRECTION_NONE,
31893 DIRECTION_LEFT: DIRECTION_LEFT,
31894 DIRECTION_RIGHT: DIRECTION_RIGHT,
31895 DIRECTION_UP: DIRECTION_UP,
31896 DIRECTION_DOWN: DIRECTION_DOWN,
31897 DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
31898 DIRECTION_VERTICAL: DIRECTION_VERTICAL,
31899 DIRECTION_ALL: DIRECTION_ALL,
31900 Manager: Manager,
31901 Input: Input,
31902 TouchAction: TouchAction,
31903 TouchInput: TouchInput,
31904 MouseInput: MouseInput,
31905 PointerEventInput: PointerEventInput,
31906 TouchMouseInput: TouchMouseInput,
31907 SingleTouchInput: SingleTouchInput,
31908 Recognizer: Recognizer,
31909 AttrRecognizer: AttrRecognizer,
31910 Tap: TapRecognizer,
31911 Pan: PanRecognizer,
31912 Swipe: SwipeRecognizer,
31913 Pinch: PinchRecognizer,
31914 Rotate: RotateRecognizer,
31915 Press: PressRecognizer,
31916 on: addEventListeners,
31917 off: removeEventListeners,
31918 each: each,
31919 merge: merge,
31920 extend: extend,
31921 assign: assign,
31922 inherit: inherit,
31923 bindFn: bindFn,
31924 prefixed: prefixed
31925 }); // this prevents errors when Hammer is loaded in the presence of an AMD
31926 // style loader but by script tag, not by the loader.
31927
31928 var freeGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; // jshint ignore:line
31929
31930 freeGlobal.Hammer = Hammer;
31931
31932 if (typeof undefined$1 === 'function' && undefined$1.amd) {
31933 undefined$1(function () {
31934 return Hammer;
31935 });
31936 } else if ( module.exports) {
31937 module.exports = Hammer;
31938 } else {
31939 window[exportName] = Hammer;
31940 }
31941 })(window, document, 'Hammer');
31942});
31943
31944var hammer$1 = createCommonjsModule$1(function (module) {
31945 /**
31946 * Setup a mock hammer.js object, for unit testing.
31947 *
31948 * Inspiration: https://github.com/uber/deck.gl/pull/658
31949 *
31950 * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}}
31951 */
31952 function hammerMock() {
31953 var noop = function noop() {};
31954
31955 return {
31956 on: noop,
31957 off: noop,
31958 destroy: noop,
31959 emit: noop,
31960 get: function get(m) {
31961 //eslint-disable-line no-unused-vars
31962 return {
31963 set: noop
31964 };
31965 }
31966 };
31967 }
31968
31969 if (typeof window !== 'undefined') {
31970 var propagating$1 = propagating;
31971 var Hammer = window['Hammer'] || hammer;
31972 module.exports = propagating$1(Hammer, {
31973 preventDefault: 'mouse'
31974 });
31975 } else {
31976 module.exports = function () {
31977 // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object.
31978 return hammerMock();
31979 };
31980 }
31981});
31982
31983var keycharm = createCommonjsModule$1(function (module, exports) {
31984 /**
31985 * Created by Alex on 11/6/2014.
31986 */
31987 // https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
31988 // if the module has no dependencies, the above pattern can be simplified to
31989
31990 (function (root, factory) {
31991 {
31992 // Node. Does not work with strict CommonJS, but
31993 // only CommonJS-like environments that support module.exports,
31994 // like Node.
31995 module.exports = factory();
31996 }
31997 })(commonjsGlobal$1, function () {
31998 function keycharm(options) {
31999 var preventDefault = options && options.preventDefault || false;
32000 var container = options && options.container || window;
32001 var _exportFunctions = {};
32002 var _bound = {
32003 keydown: {},
32004 keyup: {}
32005 };
32006 var _keys = {};
32007 var i; // a - z
32008
32009 for (i = 97; i <= 122; i++) {
32010 _keys[String.fromCharCode(i)] = {
32011 code: 65 + (i - 97),
32012 shift: false
32013 };
32014 } // A - Z
32015
32016
32017 for (i = 65; i <= 90; i++) {
32018 _keys[String.fromCharCode(i)] = {
32019 code: i,
32020 shift: true
32021 };
32022 } // 0 - 9
32023
32024
32025 for (i = 0; i <= 9; i++) {
32026 _keys['' + i] = {
32027 code: 48 + i,
32028 shift: false
32029 };
32030 } // F1 - F12
32031
32032
32033 for (i = 1; i <= 12; i++) {
32034 _keys['F' + i] = {
32035 code: 111 + i,
32036 shift: false
32037 };
32038 } // num0 - num9
32039
32040
32041 for (i = 0; i <= 9; i++) {
32042 _keys['num' + i] = {
32043 code: 96 + i,
32044 shift: false
32045 };
32046 } // numpad misc
32047
32048
32049 _keys['num*'] = {
32050 code: 106,
32051 shift: false
32052 };
32053 _keys['num+'] = {
32054 code: 107,
32055 shift: false
32056 };
32057 _keys['num-'] = {
32058 code: 109,
32059 shift: false
32060 };
32061 _keys['num/'] = {
32062 code: 111,
32063 shift: false
32064 };
32065 _keys['num.'] = {
32066 code: 110,
32067 shift: false
32068 }; // arrows
32069
32070 _keys['left'] = {
32071 code: 37,
32072 shift: false
32073 };
32074 _keys['up'] = {
32075 code: 38,
32076 shift: false
32077 };
32078 _keys['right'] = {
32079 code: 39,
32080 shift: false
32081 };
32082 _keys['down'] = {
32083 code: 40,
32084 shift: false
32085 }; // extra keys
32086
32087 _keys['space'] = {
32088 code: 32,
32089 shift: false
32090 };
32091 _keys['enter'] = {
32092 code: 13,
32093 shift: false
32094 };
32095 _keys['shift'] = {
32096 code: 16,
32097 shift: undefined
32098 };
32099 _keys['esc'] = {
32100 code: 27,
32101 shift: false
32102 };
32103 _keys['backspace'] = {
32104 code: 8,
32105 shift: false
32106 };
32107 _keys['tab'] = {
32108 code: 9,
32109 shift: false
32110 };
32111 _keys['ctrl'] = {
32112 code: 17,
32113 shift: false
32114 };
32115 _keys['alt'] = {
32116 code: 18,
32117 shift: false
32118 };
32119 _keys['delete'] = {
32120 code: 46,
32121 shift: false
32122 };
32123 _keys['pageup'] = {
32124 code: 33,
32125 shift: false
32126 };
32127 _keys['pagedown'] = {
32128 code: 34,
32129 shift: false
32130 }; // symbols
32131
32132 _keys['='] = {
32133 code: 187,
32134 shift: false
32135 };
32136 _keys['-'] = {
32137 code: 189,
32138 shift: false
32139 };
32140 _keys[']'] = {
32141 code: 221,
32142 shift: false
32143 };
32144 _keys['['] = {
32145 code: 219,
32146 shift: false
32147 };
32148
32149 var down = function (event) {
32150 handleEvent(event, 'keydown');
32151 };
32152
32153 var up = function (event) {
32154 handleEvent(event, 'keyup');
32155 }; // handle the actualy bound key with the event
32156
32157
32158 var handleEvent = function (event, type) {
32159 if (_bound[type][event.keyCode] !== undefined) {
32160 var bound = _bound[type][event.keyCode];
32161
32162 for (var i = 0; i < bound.length; i++) {
32163 if (bound[i].shift === undefined) {
32164 bound[i].fn(event);
32165 } else if (bound[i].shift == true && event.shiftKey == true) {
32166 bound[i].fn(event);
32167 } else if (bound[i].shift == false && event.shiftKey == false) {
32168 bound[i].fn(event);
32169 }
32170 }
32171
32172 if (preventDefault == true) {
32173 event.preventDefault();
32174 }
32175 }
32176 }; // bind a key to a callback
32177
32178
32179 _exportFunctions.bind = function (key, callback, type) {
32180 if (type === undefined) {
32181 type = 'keydown';
32182 }
32183
32184 if (_keys[key] === undefined) {
32185 throw new Error("unsupported key: " + key);
32186 }
32187
32188 if (_bound[type][_keys[key].code] === undefined) {
32189 _bound[type][_keys[key].code] = [];
32190 }
32191
32192 _bound[type][_keys[key].code].push({
32193 fn: callback,
32194 shift: _keys[key].shift
32195 });
32196 }; // bind all keys to a call back (demo purposes)
32197
32198
32199 _exportFunctions.bindAll = function (callback, type) {
32200 if (type === undefined) {
32201 type = 'keydown';
32202 }
32203
32204 for (var key in _keys) {
32205 if (_keys.hasOwnProperty(key)) {
32206 _exportFunctions.bind(key, callback, type);
32207 }
32208 }
32209 }; // get the key label from an event
32210
32211
32212 _exportFunctions.getKey = function (event) {
32213 for (var key in _keys) {
32214 if (_keys.hasOwnProperty(key)) {
32215 if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
32216 return key;
32217 } else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
32218 return key;
32219 } else if (event.keyCode == _keys[key].code && key == 'shift') {
32220 return key;
32221 }
32222 }
32223 }
32224
32225 return "unknown key, currently not supported";
32226 }; // unbind either a specific callback from a key or all of them (by leaving callback undefined)
32227
32228
32229 _exportFunctions.unbind = function (key, callback, type) {
32230 if (type === undefined) {
32231 type = 'keydown';
32232 }
32233
32234 if (_keys[key] === undefined) {
32235 throw new Error("unsupported key: " + key);
32236 }
32237
32238 if (callback !== undefined) {
32239 var newBindings = [];
32240 var bound = _bound[type][_keys[key].code];
32241
32242 if (bound !== undefined) {
32243 for (var i = 0; i < bound.length; i++) {
32244 if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
32245 newBindings.push(_bound[type][_keys[key].code][i]);
32246 }
32247 }
32248 }
32249
32250 _bound[type][_keys[key].code] = newBindings;
32251 } else {
32252 _bound[type][_keys[key].code] = [];
32253 }
32254 }; // reset all bound variables.
32255
32256
32257 _exportFunctions.reset = function () {
32258 _bound = {
32259 keydown: {},
32260 keyup: {}
32261 };
32262 }; // unbind all listeners and reset all variables.
32263
32264
32265 _exportFunctions.destroy = function () {
32266 _bound = {
32267 keydown: {},
32268 keyup: {}
32269 };
32270 container.removeEventListener('keydown', down, true);
32271 container.removeEventListener('keyup', up, true);
32272 }; // create listeners.
32273
32274
32275 container.addEventListener('keydown', down, true);
32276 container.addEventListener('keyup', up, true); // return the public functions.
32277
32278 return _exportFunctions;
32279 }
32280
32281 return keycharm;
32282 });
32283});
32284
32285var util_1 = util;
32286var DOMutil$1 = DOMutil; // data
32287
32288var DataSet$2 = index.DataSet,
32289 DataView$3 = index.DataView,
32290 Queue$1 = index.Queue;
32291var DataSet_1 = DataSet$2;
32292var DataView_1 = DataView$3;
32293var Queue_1 = Queue$1; // Graph3d
32294
32295var Graph3d$1 = Graph3d_1;
32296var graph3d = {
32297 Camera: Camera_1,
32298 Filter: Filter_1,
32299 Point2d: Point2d_1,
32300 Point3d: Point3d_1,
32301 Slider: Slider_1,
32302 StepNumber: StepNumber_1
32303}; // bundled external libraries
32304
32305var moment$3 = moment$2;
32306var Hammer = hammer$1;
32307var keycharm$1 = keycharm;
32308var repo = {
32309 util: util_1,
32310 DOMutil: DOMutil$1,
32311 DataSet: DataSet_1,
32312 DataView: DataView_1,
32313 Queue: Queue_1,
32314 Graph3d: Graph3d$1,
32315 graph3d: graph3d,
32316 moment: moment$3,
32317 Hammer: Hammer,
32318 keycharm: keycharm$1
32319};
32320
32321export default repo;
32322export { DOMutil$1 as DOMutil, DataSet_1 as DataSet, DataView_1 as DataView, Graph3d$1 as Graph3d, Hammer, Queue_1 as Queue, graph3d, keycharm$1 as keycharm, moment$3 as moment, util_1 as util };