1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | var ceil = Math.ceil;
|
28 | var floor$1 = Math.floor;
|
29 |
|
30 |
|
31 | var toInteger = function (argument) {
|
32 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
|
33 | };
|
34 |
|
35 | var path = {};
|
36 |
|
37 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
38 |
|
39 | function unwrapExports (x) {
|
40 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
41 | }
|
42 |
|
43 | function createCommonjsModule(fn, module) {
|
44 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
45 | }
|
46 |
|
47 | var check = function (it) {
|
48 | return it && it.Math == Math && it;
|
49 | };
|
50 |
|
51 |
|
52 | var global_1 =
|
53 | check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
|
54 | check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
55 | function () {
|
56 | return this;
|
57 | }() || Function('return this')();
|
58 |
|
59 | var aFunction$1 = function (variable) {
|
60 | return typeof variable == 'function' ? variable : undefined;
|
61 | };
|
62 |
|
63 | var getBuiltIn = function (namespace, method) {
|
64 | 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];
|
65 | };
|
66 |
|
67 | var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
68 |
|
69 | var process = global_1.process;
|
70 | var Deno = global_1.Deno;
|
71 | var versions = process && process.versions || Deno && Deno.version;
|
72 | var v8 = versions && versions.v8;
|
73 | var match, version;
|
74 |
|
75 | if (v8) {
|
76 | match = v8.split('.');
|
77 | version = match[0] < 4 ? 1 : match[0] + match[1];
|
78 | } else if (engineUserAgent) {
|
79 | match = engineUserAgent.match(/Edge\/(\d+)/);
|
80 |
|
81 | if (!match || match[1] >= 74) {
|
82 | match = engineUserAgent.match(/Chrome\/(\d+)/);
|
83 | if (match) version = match[1];
|
84 | }
|
85 | }
|
86 |
|
87 | var engineV8Version = version && +version;
|
88 |
|
89 | var fails = function (exec) {
|
90 | try {
|
91 | return !!exec();
|
92 | } catch (error) {
|
93 | return true;
|
94 | }
|
95 | };
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
101 | var symbol = Symbol();
|
102 |
|
103 |
|
104 | return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
105 | !Symbol.sham && engineV8Version && engineV8Version < 41;
|
106 | });
|
107 |
|
108 |
|
109 |
|
110 | var useSymbolAsUid = nativeSymbol && !Symbol.sham && typeof Symbol.iterator == 'symbol';
|
111 |
|
112 | var isSymbol = useSymbolAsUid ? function (it) {
|
113 | return typeof it == 'symbol';
|
114 | } : function (it) {
|
115 | var $Symbol = getBuiltIn('Symbol');
|
116 | return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
|
117 | };
|
118 |
|
119 | var toString_1 = function (argument) {
|
120 | if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string');
|
121 | return String(argument);
|
122 | };
|
123 |
|
124 |
|
125 |
|
126 | var requireObjectCoercible = function (it) {
|
127 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
128 | return it;
|
129 | };
|
130 |
|
131 | var createMethod$5 = function (CONVERT_TO_STRING) {
|
132 | return function ($this, pos) {
|
133 | var S = toString_1(requireObjectCoercible($this));
|
134 | var position = toInteger(pos);
|
135 | var size = S.length;
|
136 | var first, second;
|
137 | if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
138 | first = S.charCodeAt(position);
|
139 | 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;
|
140 | };
|
141 | };
|
142 |
|
143 | var stringMultibyte = {
|
144 |
|
145 |
|
146 | codeAt: createMethod$5(false),
|
147 |
|
148 |
|
149 | charAt: createMethod$5(true)
|
150 | };
|
151 |
|
152 | var setGlobal = function (key, value) {
|
153 | try {
|
154 |
|
155 | Object.defineProperty(global_1, key, {
|
156 | value: value,
|
157 | configurable: true,
|
158 | writable: true
|
159 | });
|
160 | } catch (error) {
|
161 | global_1[key] = value;
|
162 | }
|
163 |
|
164 | return value;
|
165 | };
|
166 |
|
167 | var SHARED = '__core-js_shared__';
|
168 | var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
|
169 | var sharedStore = store$1;
|
170 |
|
171 | var functionToString = Function.toString;
|
172 |
|
173 | if (typeof sharedStore.inspectSource != 'function') {
|
174 | sharedStore.inspectSource = function (it) {
|
175 | return functionToString.call(it);
|
176 | };
|
177 | }
|
178 |
|
179 | var inspectSource = sharedStore.inspectSource;
|
180 |
|
181 | var WeakMap$1 = global_1.WeakMap;
|
182 | var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
|
183 |
|
184 | var isObject$1 = function (it) {
|
185 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
186 | };
|
187 |
|
188 | var descriptors = !fails(function () {
|
189 |
|
190 | return Object.defineProperty({}, 1, {
|
191 | get: function () {
|
192 | return 7;
|
193 | }
|
194 | })[1] != 7;
|
195 | });
|
196 |
|
197 | var document$1 = global_1.document;
|
198 |
|
199 | var EXISTS = isObject$1(document$1) && isObject$1(document$1.createElement);
|
200 |
|
201 | var documentCreateElement = function (it) {
|
202 | return EXISTS ? document$1.createElement(it) : {};
|
203 | };
|
204 |
|
205 | var ie8DomDefine = !descriptors && !fails(function () {
|
206 |
|
207 | return Object.defineProperty(documentCreateElement('div'), 'a', {
|
208 | get: function () {
|
209 | return 7;
|
210 | }
|
211 | }).a != 7;
|
212 | });
|
213 |
|
214 | var anObject = function (it) {
|
215 | if (!isObject$1(it)) {
|
216 | throw TypeError(String(it) + ' is not an object');
|
217 | }
|
218 |
|
219 | return it;
|
220 | };
|
221 |
|
222 |
|
223 |
|
224 | var ordinaryToPrimitive = function (input, pref) {
|
225 | var fn, val;
|
226 | if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val;
|
227 | if (typeof (fn = input.valueOf) == 'function' && !isObject$1(val = fn.call(input))) return val;
|
228 | if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val;
|
229 | throw TypeError("Can't convert object to primitive value");
|
230 | };
|
231 |
|
232 | var shared = createCommonjsModule(function (module) {
|
233 | (module.exports = function (key, value) {
|
234 | return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
235 | })('versions', []).push({
|
236 | version: '3.16.1',
|
237 | mode: 'pure' ,
|
238 | copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
239 | });
|
240 | });
|
241 |
|
242 |
|
243 |
|
244 | var toObject = function (argument) {
|
245 | return Object(requireObjectCoercible(argument));
|
246 | };
|
247 |
|
248 | var hasOwnProperty = {}.hasOwnProperty;
|
249 |
|
250 | var has$1 = Object.hasOwn || function hasOwn(it, key) {
|
251 | return hasOwnProperty.call(toObject(it), key);
|
252 | };
|
253 |
|
254 | var id = 0;
|
255 | var postfix = Math.random();
|
256 |
|
257 | var uid = function (key) {
|
258 | return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
259 | };
|
260 |
|
261 | var WellKnownSymbolsStore$1 = shared('wks');
|
262 | var Symbol$1 = global_1.Symbol;
|
263 | var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
264 |
|
265 | var wellKnownSymbol = function (name) {
|
266 | if (!has$1(WellKnownSymbolsStore$1, name) || !(nativeSymbol || typeof WellKnownSymbolsStore$1[name] == 'string')) {
|
267 | if (nativeSymbol && has$1(Symbol$1, name)) {
|
268 | WellKnownSymbolsStore$1[name] = Symbol$1[name];
|
269 | } else {
|
270 | WellKnownSymbolsStore$1[name] = createWellKnownSymbol('Symbol.' + name);
|
271 | }
|
272 | }
|
273 |
|
274 | return WellKnownSymbolsStore$1[name];
|
275 | };
|
276 |
|
277 | var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive');
|
278 |
|
279 |
|
280 | var toPrimitive = function (input, pref) {
|
281 | if (!isObject$1(input) || isSymbol(input)) return input;
|
282 | var exoticToPrim = input[TO_PRIMITIVE$1];
|
283 | var result;
|
284 |
|
285 | if (exoticToPrim !== undefined) {
|
286 | if (pref === undefined) pref = 'default';
|
287 | result = exoticToPrim.call(input, pref);
|
288 | if (!isObject$1(result) || isSymbol(result)) return result;
|
289 | throw TypeError("Can't convert object to primitive value");
|
290 | }
|
291 |
|
292 | if (pref === undefined) pref = 'number';
|
293 | return ordinaryToPrimitive(input, pref);
|
294 | };
|
295 |
|
296 |
|
297 |
|
298 | var toPropertyKey = function (argument) {
|
299 | var key = toPrimitive(argument, 'string');
|
300 | return isSymbol(key) ? key : String(key);
|
301 | };
|
302 |
|
303 | var $defineProperty$1 = Object.defineProperty;
|
304 |
|
305 |
|
306 | var f$6 = descriptors ? $defineProperty$1 : function defineProperty(O, P, Attributes) {
|
307 | anObject(O);
|
308 | P = toPropertyKey(P);
|
309 | anObject(Attributes);
|
310 | if (ie8DomDefine) try {
|
311 | return $defineProperty$1(O, P, Attributes);
|
312 | } catch (error) {
|
313 |
|
314 | }
|
315 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
316 | if ('value' in Attributes) O[P] = Attributes.value;
|
317 | return O;
|
318 | };
|
319 | var objectDefineProperty = {
|
320 | f: f$6
|
321 | };
|
322 |
|
323 | var createPropertyDescriptor = function (bitmap, value) {
|
324 | return {
|
325 | enumerable: !(bitmap & 1),
|
326 | configurable: !(bitmap & 2),
|
327 | writable: !(bitmap & 4),
|
328 | value: value
|
329 | };
|
330 | };
|
331 |
|
332 | var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
333 | return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
334 | } : function (object, key, value) {
|
335 | object[key] = value;
|
336 | return object;
|
337 | };
|
338 |
|
339 | var keys$6 = shared('keys');
|
340 |
|
341 | var sharedKey = function (key) {
|
342 | return keys$6[key] || (keys$6[key] = uid(key));
|
343 | };
|
344 |
|
345 | var hiddenKeys$1 = {};
|
346 |
|
347 | var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
348 | var WeakMap = global_1.WeakMap;
|
349 | var set$3, get, has;
|
350 |
|
351 | var enforce = function (it) {
|
352 | return has(it) ? get(it) : set$3(it, {});
|
353 | };
|
354 |
|
355 | var getterFor = function (TYPE) {
|
356 | return function (it) {
|
357 | var state;
|
358 |
|
359 | if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
|
360 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
361 | }
|
362 |
|
363 | return state;
|
364 | };
|
365 | };
|
366 |
|
367 | if (nativeWeakMap || sharedStore.state) {
|
368 | var store = sharedStore.state || (sharedStore.state = new WeakMap());
|
369 | var wmget = store.get;
|
370 | var wmhas = store.has;
|
371 | var wmset = store.set;
|
372 |
|
373 | set$3 = function (it, metadata) {
|
374 | if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
375 | metadata.facade = it;
|
376 | wmset.call(store, it, metadata);
|
377 | return metadata;
|
378 | };
|
379 |
|
380 | get = function (it) {
|
381 | return wmget.call(store, it) || {};
|
382 | };
|
383 |
|
384 | has = function (it) {
|
385 | return wmhas.call(store, it);
|
386 | };
|
387 | } else {
|
388 | var STATE = sharedKey('state');
|
389 | hiddenKeys$1[STATE] = true;
|
390 |
|
391 | set$3 = function (it, metadata) {
|
392 | if (has$1(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
393 | metadata.facade = it;
|
394 | createNonEnumerableProperty(it, STATE, metadata);
|
395 | return metadata;
|
396 | };
|
397 |
|
398 | get = function (it) {
|
399 | return has$1(it, STATE) ? it[STATE] : {};
|
400 | };
|
401 |
|
402 | has = function (it) {
|
403 | return has$1(it, STATE);
|
404 | };
|
405 | }
|
406 |
|
407 | var internalState = {
|
408 | set: set$3,
|
409 | get: get,
|
410 | has: has,
|
411 | enforce: enforce,
|
412 | getterFor: getterFor
|
413 | };
|
414 |
|
415 | var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
|
416 |
|
417 | var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor;
|
418 |
|
419 | var NASHORN_BUG = getOwnPropertyDescriptor$3 && !$propertyIsEnumerable$1.call({
|
420 | 1: 2
|
421 | }, 1);
|
422 |
|
423 |
|
424 | var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
425 | var descriptor = getOwnPropertyDescriptor$3(this, V);
|
426 | return !!descriptor && descriptor.enumerable;
|
427 | } : $propertyIsEnumerable$1;
|
428 | var objectPropertyIsEnumerable = {
|
429 | f: f$5
|
430 | };
|
431 |
|
432 | var toString$1 = {}.toString;
|
433 |
|
434 | var classofRaw = function (it) {
|
435 | return toString$1.call(it).slice(8, -1);
|
436 | };
|
437 |
|
438 | var split = ''.split;
|
439 |
|
440 | var indexedObject = fails(function () {
|
441 |
|
442 |
|
443 | return !Object('z').propertyIsEnumerable(0);
|
444 | }) ? function (it) {
|
445 | return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
446 | } : Object;
|
447 |
|
448 | var toIndexedObject = function (it) {
|
449 | return indexedObject(requireObjectCoercible(it));
|
450 | };
|
451 |
|
452 | var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
453 |
|
454 |
|
455 | var f$4 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
456 | O = toIndexedObject(O);
|
457 | P = toPropertyKey(P);
|
458 | if (ie8DomDefine) try {
|
459 | return $getOwnPropertyDescriptor$1(O, P);
|
460 | } catch (error) {
|
461 |
|
462 | }
|
463 | if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
464 | };
|
465 | var objectGetOwnPropertyDescriptor = {
|
466 | f: f$4
|
467 | };
|
468 |
|
469 | var replacement = /#|\.prototype\./;
|
470 |
|
471 | var isForced = function (feature, detection) {
|
472 | var value = data[normalize(feature)];
|
473 | return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
|
474 | };
|
475 |
|
476 | var normalize = isForced.normalize = function (string) {
|
477 | return String(string).replace(replacement, '.').toLowerCase();
|
478 | };
|
479 |
|
480 | var data = isForced.data = {};
|
481 | var NATIVE = isForced.NATIVE = 'N';
|
482 | var POLYFILL = isForced.POLYFILL = 'P';
|
483 | var isForced_1 = isForced;
|
484 |
|
485 | var aFunction = function (it) {
|
486 | if (typeof it != 'function') {
|
487 | throw TypeError(String(it) + ' is not a function');
|
488 | }
|
489 |
|
490 | return it;
|
491 | };
|
492 |
|
493 | var functionBindContext = function (fn, that, length) {
|
494 | aFunction(fn);
|
495 | if (that === undefined) return fn;
|
496 |
|
497 | switch (length) {
|
498 | case 0:
|
499 | return function () {
|
500 | return fn.call(that);
|
501 | };
|
502 |
|
503 | case 1:
|
504 | return function (a) {
|
505 | return fn.call(that, a);
|
506 | };
|
507 |
|
508 | case 2:
|
509 | return function (a, b) {
|
510 | return fn.call(that, a, b);
|
511 | };
|
512 |
|
513 | case 3:
|
514 | return function (a, b, c) {
|
515 | return fn.call(that, a, b, c);
|
516 | };
|
517 | }
|
518 |
|
519 | return function () {
|
520 | return fn.apply(that, arguments);
|
521 | };
|
522 | };
|
523 |
|
524 | var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
525 |
|
526 | var wrapConstructor = function (NativeConstructor) {
|
527 | var Wrapper = function (a, b, c) {
|
528 | if (this instanceof NativeConstructor) {
|
529 | switch (arguments.length) {
|
530 | case 0:
|
531 | return new NativeConstructor();
|
532 |
|
533 | case 1:
|
534 | return new NativeConstructor(a);
|
535 |
|
536 | case 2:
|
537 | return new NativeConstructor(a, b);
|
538 | }
|
539 |
|
540 | return new NativeConstructor(a, b, c);
|
541 | }
|
542 |
|
543 | return NativeConstructor.apply(this, arguments);
|
544 | };
|
545 |
|
546 | Wrapper.prototype = NativeConstructor.prototype;
|
547 | return Wrapper;
|
548 | };
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 | var _export = function (options, source) {
|
566 | var TARGET = options.target;
|
567 | var GLOBAL = options.global;
|
568 | var STATIC = options.stat;
|
569 | var PROTO = options.proto;
|
570 | var nativeSource = GLOBAL ? global_1 : STATIC ? global_1[TARGET] : (global_1[TARGET] || {}).prototype;
|
571 | var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
|
572 | var targetPrototype = target.prototype;
|
573 | var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
|
574 | var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
|
575 |
|
576 | for (key in source) {
|
577 | FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
578 |
|
579 | USE_NATIVE = !FORCED && nativeSource && has$1(nativeSource, key);
|
580 | targetProperty = target[key];
|
581 | if (USE_NATIVE) if (options.noTargetGet) {
|
582 | descriptor = getOwnPropertyDescriptor$2(nativeSource, key);
|
583 | nativeProperty = descriptor && descriptor.value;
|
584 | } else nativeProperty = nativeSource[key];
|
585 |
|
586 | sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
|
587 | if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue;
|
588 |
|
589 | if (options.bind && USE_NATIVE) resultProperty = functionBindContext(sourceProperty, global_1);
|
590 | else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
|
591 | else if (PROTO && typeof sourceProperty == 'function') resultProperty = functionBindContext(Function.call, sourceProperty);
|
592 | else resultProperty = sourceProperty;
|
593 |
|
594 | if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
|
595 | createNonEnumerableProperty(resultProperty, 'sham', true);
|
596 | }
|
597 |
|
598 | target[key] = resultProperty;
|
599 |
|
600 | if (PROTO) {
|
601 | VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
|
602 |
|
603 | if (!has$1(path, VIRTUAL_PROTOTYPE)) {
|
604 | createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
|
605 | }
|
606 |
|
607 |
|
608 | path[VIRTUAL_PROTOTYPE][key] = sourceProperty;
|
609 |
|
610 | if (options.real && targetPrototype && !targetPrototype[key]) {
|
611 | createNonEnumerableProperty(targetPrototype, key, sourceProperty);
|
612 | }
|
613 | }
|
614 | }
|
615 | };
|
616 |
|
617 | var correctPrototypeGetter = !fails(function () {
|
618 | function F() {
|
619 |
|
620 | }
|
621 |
|
622 | F.prototype.constructor = null;
|
623 |
|
624 | return Object.getPrototypeOf(new F()) !== F.prototype;
|
625 | });
|
626 |
|
627 | var IE_PROTO$1 = sharedKey('IE_PROTO');
|
628 | var ObjectPrototype$1 = Object.prototype;
|
629 |
|
630 |
|
631 |
|
632 | var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
|
633 | O = toObject(O);
|
634 | if (has$1(O, IE_PROTO$1)) return O[IE_PROTO$1];
|
635 |
|
636 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
637 | return O.constructor.prototype;
|
638 | }
|
639 |
|
640 | return O instanceof Object ? ObjectPrototype$1 : null;
|
641 | };
|
642 |
|
643 | var ITERATOR$4 = wellKnownSymbol('iterator');
|
644 | var BUGGY_SAFARI_ITERATORS$1 = false;
|
645 |
|
646 | var returnThis$2 = function () {
|
647 | return this;
|
648 | };
|
649 |
|
650 |
|
651 |
|
652 | var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
653 |
|
654 |
|
655 | if ([].keys) {
|
656 | arrayIterator = [].keys();
|
657 |
|
658 | if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;else {
|
659 | PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
|
660 | if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
|
661 | }
|
662 | }
|
663 |
|
664 | var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
|
665 | var test = {};
|
666 |
|
667 | return IteratorPrototype$2[ITERATOR$4].call(test) !== test;
|
668 | });
|
669 | if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
|
670 |
|
671 |
|
672 | if ((NEW_ITERATOR_PROTOTYPE) && !has$1(IteratorPrototype$2, ITERATOR$4)) {
|
673 | createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$4, returnThis$2);
|
674 | }
|
675 |
|
676 | var iteratorsCore = {
|
677 | IteratorPrototype: IteratorPrototype$2,
|
678 | BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
|
679 | };
|
680 |
|
681 | var min$2 = Math.min;
|
682 |
|
683 |
|
684 | var toLength = function (argument) {
|
685 | return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
686 | };
|
687 |
|
688 | var max$2 = Math.max;
|
689 | var min$1 = Math.min;
|
690 |
|
691 |
|
692 |
|
693 | var toAbsoluteIndex = function (index, length) {
|
694 | var integer = toInteger(index);
|
695 | return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
|
696 | };
|
697 |
|
698 | var createMethod$4 = function (IS_INCLUDES) {
|
699 | return function ($this, el, fromIndex) {
|
700 | var O = toIndexedObject($this);
|
701 | var length = toLength(O.length);
|
702 | var index = toAbsoluteIndex(fromIndex, length);
|
703 | var value;
|
704 |
|
705 |
|
706 | if (IS_INCLUDES && el != el) while (length > index) {
|
707 | value = O[index++];
|
708 |
|
709 | if (value != value) return true;
|
710 | } else for (; length > index; index++) {
|
711 | if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
712 | }
|
713 | return !IS_INCLUDES && -1;
|
714 | };
|
715 | };
|
716 |
|
717 | var arrayIncludes = {
|
718 |
|
719 |
|
720 | includes: createMethod$4(true),
|
721 |
|
722 |
|
723 | indexOf: createMethod$4(false)
|
724 | };
|
725 |
|
726 | var indexOf$3 = arrayIncludes.indexOf;
|
727 |
|
728 | var objectKeysInternal = function (object, names) {
|
729 | var O = toIndexedObject(object);
|
730 | var i = 0;
|
731 | var result = [];
|
732 | var key;
|
733 |
|
734 | for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
|
735 |
|
736 |
|
737 | while (names.length > i) if (has$1(O, key = names[i++])) {
|
738 | ~indexOf$3(result, key) || result.push(key);
|
739 | }
|
740 |
|
741 | return result;
|
742 | };
|
743 |
|
744 |
|
745 | var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
|
746 |
|
747 |
|
748 |
|
749 |
|
750 | var objectKeys = Object.keys || function keys(O) {
|
751 | return objectKeysInternal(O, enumBugKeys);
|
752 | };
|
753 |
|
754 |
|
755 |
|
756 |
|
757 | var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
758 | anObject(O);
|
759 | var keys = objectKeys(Properties);
|
760 | var length = keys.length;
|
761 | var index = 0;
|
762 | var key;
|
763 |
|
764 | while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
|
765 |
|
766 | return O;
|
767 | };
|
768 |
|
769 | var html = getBuiltIn('document', 'documentElement');
|
770 |
|
771 |
|
772 |
|
773 | var GT = '>';
|
774 | var LT = '<';
|
775 | var PROTOTYPE$1 = 'prototype';
|
776 | var SCRIPT = 'script';
|
777 | var IE_PROTO = sharedKey('IE_PROTO');
|
778 |
|
779 | var EmptyConstructor = function () {
|
780 |
|
781 | };
|
782 |
|
783 | var scriptTag = function (content) {
|
784 | return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
785 | };
|
786 |
|
787 |
|
788 | var NullProtoObjectViaActiveX = function (activeXDocument) {
|
789 | activeXDocument.write(scriptTag(''));
|
790 | activeXDocument.close();
|
791 | var temp = activeXDocument.parentWindow.Object;
|
792 | activeXDocument = null;
|
793 |
|
794 | return temp;
|
795 | };
|
796 |
|
797 |
|
798 | var NullProtoObjectViaIFrame = function () {
|
799 |
|
800 | var iframe = documentCreateElement('iframe');
|
801 | var JS = 'java' + SCRIPT + ':';
|
802 | var iframeDocument;
|
803 |
|
804 | if (iframe.style) {
|
805 | iframe.style.display = 'none';
|
806 | html.appendChild(iframe);
|
807 |
|
808 | iframe.src = String(JS);
|
809 | iframeDocument = iframe.contentWindow.document;
|
810 | iframeDocument.open();
|
811 | iframeDocument.write(scriptTag('document.F=Object'));
|
812 | iframeDocument.close();
|
813 | return iframeDocument.F;
|
814 | }
|
815 | };
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 | var activeXDocument;
|
823 |
|
824 | var NullProtoObject = function () {
|
825 | try {
|
826 | activeXDocument = new ActiveXObject('htmlfile');
|
827 | } catch (error) {
|
828 |
|
829 | }
|
830 |
|
831 | NullProtoObject = document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) :
|
832 | NullProtoObjectViaIFrame() || NullProtoObjectViaActiveX(activeXDocument);
|
833 |
|
834 | var length = enumBugKeys.length;
|
835 |
|
836 | while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys[length]];
|
837 |
|
838 | return NullProtoObject();
|
839 | };
|
840 |
|
841 | hiddenKeys$1[IE_PROTO] = true;
|
842 |
|
843 |
|
844 | var objectCreate = Object.create || function create(O, Properties) {
|
845 | var result;
|
846 |
|
847 | if (O !== null) {
|
848 | EmptyConstructor[PROTOTYPE$1] = anObject(O);
|
849 | result = new EmptyConstructor();
|
850 | EmptyConstructor[PROTOTYPE$1] = null;
|
851 |
|
852 | result[IE_PROTO] = O;
|
853 | } else result = NullProtoObject();
|
854 |
|
855 | return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
856 | };
|
857 |
|
858 | var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
|
859 | var test$2 = {};
|
860 | test$2[TO_STRING_TAG$3] = 'z';
|
861 | var toStringTagSupport = String(test$2) === '[object z]';
|
862 |
|
863 | var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
864 |
|
865 | var CORRECT_ARGUMENTS = classofRaw(function () {
|
866 | return arguments;
|
867 | }()) == 'Arguments';
|
868 |
|
869 | var tryGet = function (it, key) {
|
870 | try {
|
871 | return it[key];
|
872 | } catch (error) {
|
873 |
|
874 | }
|
875 | };
|
876 |
|
877 |
|
878 | var classof = toStringTagSupport ? classofRaw : function (it) {
|
879 | var O, tag, result;
|
880 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
881 | : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
|
882 | : CORRECT_ARGUMENTS ? classofRaw(O)
|
883 | : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
884 | };
|
885 |
|
886 |
|
887 |
|
888 |
|
889 | var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
890 | return '[object ' + classof(this) + ']';
|
891 | };
|
892 |
|
893 | var defineProperty$9 = objectDefineProperty.f;
|
894 | var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
895 |
|
896 | var setToStringTag = function (it, TAG, STATIC, SET_METHOD) {
|
897 | if (it) {
|
898 | var target = STATIC ? it : it.prototype;
|
899 |
|
900 | if (!has$1(target, TO_STRING_TAG$1)) {
|
901 | defineProperty$9(target, TO_STRING_TAG$1, {
|
902 | configurable: true,
|
903 | value: TAG
|
904 | });
|
905 | }
|
906 |
|
907 | if (SET_METHOD && !toStringTagSupport) {
|
908 | createNonEnumerableProperty(target, 'toString', objectToString);
|
909 | }
|
910 | }
|
911 | };
|
912 |
|
913 | var iterators = {};
|
914 |
|
915 | var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
916 |
|
917 | var returnThis$1 = function () {
|
918 | return this;
|
919 | };
|
920 |
|
921 | var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
|
922 | var TO_STRING_TAG = NAME + ' Iterator';
|
923 | IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
|
924 | next: createPropertyDescriptor(1, next)
|
925 | });
|
926 | setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
927 | iterators[TO_STRING_TAG] = returnThis$1;
|
928 | return IteratorConstructor;
|
929 | };
|
930 |
|
931 | var aPossiblePrototype = function (it) {
|
932 | if (!isObject$1(it) && it !== null) {
|
933 | throw TypeError("Can't set " + String(it) + ' as a prototype');
|
934 | }
|
935 |
|
936 | return it;
|
937 | };
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 | var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
946 | var CORRECT_SETTER = false;
|
947 | var test = {};
|
948 | var setter;
|
949 |
|
950 | try {
|
951 |
|
952 | setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
953 | setter.call(test, []);
|
954 | CORRECT_SETTER = test instanceof Array;
|
955 | } catch (error) {
|
956 |
|
957 | }
|
958 |
|
959 | return function setPrototypeOf(O, proto) {
|
960 | anObject(O);
|
961 | aPossiblePrototype(proto);
|
962 | if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
|
963 | return O;
|
964 | };
|
965 | }() : undefined);
|
966 |
|
967 | var redefine = function (target, key, value, options) {
|
968 | if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty(target, key, value);
|
969 | };
|
970 |
|
971 | var IteratorPrototype = iteratorsCore.IteratorPrototype;
|
972 | var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
|
973 | var ITERATOR$3 = wellKnownSymbol('iterator');
|
974 | var KEYS = 'keys';
|
975 | var VALUES = 'values';
|
976 | var ENTRIES = 'entries';
|
977 |
|
978 | var returnThis = function () {
|
979 | return this;
|
980 | };
|
981 |
|
982 | var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
983 | createIteratorConstructor(IteratorConstructor, NAME, next);
|
984 |
|
985 | var getIterationMethod = function (KIND) {
|
986 | if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
987 | if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
988 |
|
989 | switch (KIND) {
|
990 | case KEYS:
|
991 | return function keys() {
|
992 | return new IteratorConstructor(this, KIND);
|
993 | };
|
994 |
|
995 | case VALUES:
|
996 | return function values() {
|
997 | return new IteratorConstructor(this, KIND);
|
998 | };
|
999 |
|
1000 | case ENTRIES:
|
1001 | return function entries() {
|
1002 | return new IteratorConstructor(this, KIND);
|
1003 | };
|
1004 | }
|
1005 |
|
1006 | return function () {
|
1007 | return new IteratorConstructor(this);
|
1008 | };
|
1009 | };
|
1010 |
|
1011 | var TO_STRING_TAG = NAME + ' Iterator';
|
1012 | var INCORRECT_VALUES_NAME = false;
|
1013 | var IterablePrototype = Iterable.prototype;
|
1014 | var nativeIterator = IterablePrototype[ITERATOR$3] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
|
1015 | var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
1016 | var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
1017 | var CurrentIteratorPrototype, methods, KEY;
|
1018 |
|
1019 | if (anyNativeIterator) {
|
1020 | CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
|
1021 |
|
1022 | if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
1023 |
|
1024 |
|
1025 | setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
1026 | iterators[TO_STRING_TAG] = returnThis;
|
1027 | }
|
1028 | }
|
1029 |
|
1030 |
|
1031 | if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
1032 | INCORRECT_VALUES_NAME = true;
|
1033 |
|
1034 | defaultIterator = function values() {
|
1035 | return nativeIterator.call(this);
|
1036 | };
|
1037 | }
|
1038 |
|
1039 |
|
1040 | if ((FORCED) && IterablePrototype[ITERATOR$3] !== defaultIterator) {
|
1041 | createNonEnumerableProperty(IterablePrototype, ITERATOR$3, defaultIterator);
|
1042 | }
|
1043 |
|
1044 | iterators[NAME] = defaultIterator;
|
1045 |
|
1046 | if (DEFAULT) {
|
1047 | methods = {
|
1048 | values: getIterationMethod(VALUES),
|
1049 | keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
1050 | entries: getIterationMethod(ENTRIES)
|
1051 | };
|
1052 | if (FORCED) for (KEY in methods) {
|
1053 | if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
1054 | redefine(IterablePrototype, KEY, methods[KEY]);
|
1055 | }
|
1056 | } else _export({
|
1057 | target: NAME,
|
1058 | proto: true,
|
1059 | forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
|
1060 | }, methods);
|
1061 | }
|
1062 |
|
1063 | return methods;
|
1064 | };
|
1065 |
|
1066 | var charAt = stringMultibyte.charAt;
|
1067 | var STRING_ITERATOR = 'String Iterator';
|
1068 | var setInternalState$4 = internalState.set;
|
1069 | var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
|
1070 |
|
1071 |
|
1072 | defineIterator(String, 'String', function (iterated) {
|
1073 | setInternalState$4(this, {
|
1074 | type: STRING_ITERATOR,
|
1075 | string: toString_1(iterated),
|
1076 | index: 0
|
1077 | });
|
1078 |
|
1079 | }, function next() {
|
1080 | var state = getInternalState$2(this);
|
1081 | var string = state.string;
|
1082 | var index = state.index;
|
1083 | var point;
|
1084 | if (index >= string.length) return {
|
1085 | value: undefined,
|
1086 | done: true
|
1087 | };
|
1088 | point = charAt(string, index);
|
1089 | state.index += point.length;
|
1090 | return {
|
1091 | value: point,
|
1092 | done: false
|
1093 | };
|
1094 | });
|
1095 |
|
1096 | var iteratorClose = function (iterator) {
|
1097 | var returnMethod = iterator['return'];
|
1098 |
|
1099 | if (returnMethod !== undefined) {
|
1100 | return anObject(returnMethod.call(iterator)).value;
|
1101 | }
|
1102 | };
|
1103 |
|
1104 | var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
|
1105 | try {
|
1106 | return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
1107 | } catch (error) {
|
1108 | iteratorClose(iterator);
|
1109 | throw error;
|
1110 | }
|
1111 | };
|
1112 |
|
1113 | var ITERATOR$2 = wellKnownSymbol('iterator');
|
1114 | var ArrayPrototype$h = Array.prototype;
|
1115 |
|
1116 | var isArrayIteratorMethod = function (it) {
|
1117 | return it !== undefined && (iterators.Array === it || ArrayPrototype$h[ITERATOR$2] === it);
|
1118 | };
|
1119 |
|
1120 | var createProperty = function (object, key, value) {
|
1121 | var propertyKey = toPropertyKey(key);
|
1122 | if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
|
1123 | };
|
1124 |
|
1125 | var ITERATOR$1 = wellKnownSymbol('iterator');
|
1126 |
|
1127 | var getIteratorMethod$3 = function (it) {
|
1128 | if (it != undefined) return it[ITERATOR$1] || it['@@iterator'] || iterators[classof(it)];
|
1129 | };
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 | var arrayFrom = function from(arrayLike
|
1135 | /* , mapfn = undefined, thisArg = undefined */
|
1136 | ) {
|
1137 | var O = toObject(arrayLike);
|
1138 | var C = typeof this == 'function' ? this : Array;
|
1139 | var argumentsLength = arguments.length;
|
1140 | var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
1141 | var mapping = mapfn !== undefined;
|
1142 | var iteratorMethod = getIteratorMethod$3(O);
|
1143 | var index = 0;
|
1144 | var length, result, step, iterator, next, value;
|
1145 | if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
|
1146 |
|
1147 | if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
|
1148 | iterator = iteratorMethod.call(O);
|
1149 | next = iterator.next;
|
1150 | result = new C();
|
1151 |
|
1152 | for (; !(step = next.call(iterator)).done; index++) {
|
1153 | value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
1154 | createProperty(result, index, value);
|
1155 | }
|
1156 | } else {
|
1157 | length = toLength(O.length);
|
1158 | result = new C(length);
|
1159 |
|
1160 | for (; length > index; index++) {
|
1161 | value = mapping ? mapfn(O[index], index) : O[index];
|
1162 | createProperty(result, index, value);
|
1163 | }
|
1164 | }
|
1165 |
|
1166 | result.length = index;
|
1167 | return result;
|
1168 | };
|
1169 |
|
1170 | var ITERATOR = wellKnownSymbol('iterator');
|
1171 | var SAFE_CLOSING = false;
|
1172 |
|
1173 | try {
|
1174 | var called = 0;
|
1175 | var iteratorWithReturn = {
|
1176 | next: function () {
|
1177 | return {
|
1178 | done: !!called++
|
1179 | };
|
1180 | },
|
1181 | 'return': function () {
|
1182 | SAFE_CLOSING = true;
|
1183 | }
|
1184 | };
|
1185 |
|
1186 | iteratorWithReturn[ITERATOR] = function () {
|
1187 | return this;
|
1188 | };
|
1189 |
|
1190 |
|
1191 | Array.from(iteratorWithReturn, function () {
|
1192 | throw 2;
|
1193 | });
|
1194 | } catch (error) {
|
1195 |
|
1196 | }
|
1197 |
|
1198 | var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
1199 | if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
1200 | var ITERATION_SUPPORT = false;
|
1201 |
|
1202 | try {
|
1203 | var object = {};
|
1204 |
|
1205 | object[ITERATOR] = function () {
|
1206 | return {
|
1207 | next: function () {
|
1208 | return {
|
1209 | done: ITERATION_SUPPORT = true
|
1210 | };
|
1211 | }
|
1212 | };
|
1213 | };
|
1214 |
|
1215 | exec(object);
|
1216 | } catch (error) {
|
1217 |
|
1218 | }
|
1219 |
|
1220 | return ITERATION_SUPPORT;
|
1221 | };
|
1222 |
|
1223 | var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
1224 |
|
1225 | Array.from(iterable);
|
1226 | });
|
1227 |
|
1228 |
|
1229 | _export({
|
1230 | target: 'Array',
|
1231 | stat: true,
|
1232 | forced: INCORRECT_ITERATION
|
1233 | }, {
|
1234 | from: arrayFrom
|
1235 | });
|
1236 |
|
1237 | var from_1$4 = path.Array.from;
|
1238 |
|
1239 | var from_1$3 = from_1$4;
|
1240 |
|
1241 | var from_1$2 = from_1$3;
|
1242 |
|
1243 | var ARRAY_ITERATOR = 'Array Iterator';
|
1244 | var setInternalState$3 = internalState.set;
|
1245 | var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 | defineIterator(Array, 'Array', function (iterated, kind) {
|
1257 | setInternalState$3(this, {
|
1258 | type: ARRAY_ITERATOR,
|
1259 | target: toIndexedObject(iterated),
|
1260 |
|
1261 | index: 0,
|
1262 |
|
1263 | kind: kind
|
1264 |
|
1265 | });
|
1266 |
|
1267 | }, function () {
|
1268 | var state = getInternalState$1(this);
|
1269 | var target = state.target;
|
1270 | var kind = state.kind;
|
1271 | var index = state.index++;
|
1272 |
|
1273 | if (!target || index >= target.length) {
|
1274 | state.target = undefined;
|
1275 | return {
|
1276 | value: undefined,
|
1277 | done: true
|
1278 | };
|
1279 | }
|
1280 |
|
1281 | if (kind == 'keys') return {
|
1282 | value: index,
|
1283 | done: false
|
1284 | };
|
1285 | if (kind == 'values') return {
|
1286 | value: target[index],
|
1287 | done: false
|
1288 | };
|
1289 | return {
|
1290 | value: [index, target[index]],
|
1291 | done: false
|
1292 | };
|
1293 | }, 'values');
|
1294 |
|
1295 |
|
1296 |
|
1297 | iterators.Arguments = iterators.Array;
|
1298 |
|
1299 | var getIteratorMethod_1 = getIteratorMethod$3;
|
1300 |
|
1301 |
|
1302 |
|
1303 | var domIterables = {
|
1304 | CSSRuleList: 0,
|
1305 | CSSStyleDeclaration: 0,
|
1306 | CSSValueList: 0,
|
1307 | ClientRectList: 0,
|
1308 | DOMRectList: 0,
|
1309 | DOMStringList: 0,
|
1310 | DOMTokenList: 1,
|
1311 | DataTransferItemList: 0,
|
1312 | FileList: 0,
|
1313 | HTMLAllCollection: 0,
|
1314 | HTMLCollection: 0,
|
1315 | HTMLFormElement: 0,
|
1316 | HTMLSelectElement: 0,
|
1317 | MediaList: 0,
|
1318 | MimeTypeArray: 0,
|
1319 | NamedNodeMap: 0,
|
1320 | NodeList: 1,
|
1321 | PaintRequestList: 0,
|
1322 | Plugin: 0,
|
1323 | PluginArray: 0,
|
1324 | SVGLengthList: 0,
|
1325 | SVGNumberList: 0,
|
1326 | SVGPathSegList: 0,
|
1327 | SVGPointList: 0,
|
1328 | SVGStringList: 0,
|
1329 | SVGTransformList: 0,
|
1330 | SourceBufferList: 0,
|
1331 | StyleSheetList: 0,
|
1332 | TextTrackCueList: 0,
|
1333 | TextTrackList: 0,
|
1334 | TouchList: 0
|
1335 | };
|
1336 |
|
1337 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
1338 |
|
1339 | for (var COLLECTION_NAME in domIterables) {
|
1340 | var Collection = global_1[COLLECTION_NAME];
|
1341 | var CollectionPrototype = Collection && Collection.prototype;
|
1342 |
|
1343 | if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
|
1344 | createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
1345 | }
|
1346 |
|
1347 | iterators[COLLECTION_NAME] = iterators.Array;
|
1348 | }
|
1349 |
|
1350 | var getIteratorMethod$2 = getIteratorMethod_1;
|
1351 |
|
1352 | var getIteratorMethod$1 = getIteratorMethod$2;
|
1353 |
|
1354 | var getIteratorMethod = getIteratorMethod$1;
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | var isArray$5 = Array.isArray || function isArray(arg) {
|
1360 | return classofRaw(arg) == 'Array';
|
1361 | };
|
1362 |
|
1363 | var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
1364 |
|
1365 |
|
1366 |
|
1367 | var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
1368 | return objectKeysInternal(O, hiddenKeys);
|
1369 | };
|
1370 |
|
1371 | var objectGetOwnPropertyNames = {
|
1372 | f: f$3
|
1373 | };
|
1374 |
|
1375 |
|
1376 |
|
1377 | var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
|
1378 | var toString = {}.toString;
|
1379 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
1380 |
|
1381 | var getWindowNames = function (it) {
|
1382 | try {
|
1383 | return $getOwnPropertyNames$1(it);
|
1384 | } catch (error) {
|
1385 | return windowNames.slice();
|
1386 | }
|
1387 | };
|
1388 |
|
1389 |
|
1390 | var f$2 = function getOwnPropertyNames(it) {
|
1391 | return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : $getOwnPropertyNames$1(toIndexedObject(it));
|
1392 | };
|
1393 |
|
1394 | var objectGetOwnPropertyNamesExternal = {
|
1395 | f: f$2
|
1396 | };
|
1397 |
|
1398 |
|
1399 | var f$1 = Object.getOwnPropertySymbols;
|
1400 | var objectGetOwnPropertySymbols = {
|
1401 | f: f$1
|
1402 | };
|
1403 |
|
1404 | var f = wellKnownSymbol;
|
1405 | var wellKnownSymbolWrapped = {
|
1406 | f: f
|
1407 | };
|
1408 |
|
1409 | var defineProperty$8 = objectDefineProperty.f;
|
1410 |
|
1411 | var defineWellKnownSymbol = function (NAME) {
|
1412 | var Symbol = path.Symbol || (path.Symbol = {});
|
1413 | if (!has$1(Symbol, NAME)) defineProperty$8(Symbol, NAME, {
|
1414 | value: wellKnownSymbolWrapped.f(NAME)
|
1415 | });
|
1416 | };
|
1417 |
|
1418 | var SPECIES$3 = wellKnownSymbol('species');
|
1419 |
|
1420 |
|
1421 | var arraySpeciesConstructor = function (originalArray) {
|
1422 | var C;
|
1423 |
|
1424 | if (isArray$5(originalArray)) {
|
1425 | C = originalArray.constructor;
|
1426 |
|
1427 | if (typeof C == 'function' && (C === Array || isArray$5(C.prototype))) C = undefined;else if (isObject$1(C)) {
|
1428 | C = C[SPECIES$3];
|
1429 | if (C === null) C = undefined;
|
1430 | }
|
1431 | }
|
1432 |
|
1433 | return C === undefined ? Array : C;
|
1434 | };
|
1435 |
|
1436 |
|
1437 |
|
1438 | var arraySpeciesCreate = function (originalArray, length) {
|
1439 | return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
1440 | };
|
1441 |
|
1442 | var push = [].push;
|
1443 |
|
1444 | var createMethod$3 = function (TYPE) {
|
1445 | var IS_MAP = TYPE == 1;
|
1446 | var IS_FILTER = TYPE == 2;
|
1447 | var IS_SOME = TYPE == 3;
|
1448 | var IS_EVERY = TYPE == 4;
|
1449 | var IS_FIND_INDEX = TYPE == 6;
|
1450 | var IS_FILTER_REJECT = TYPE == 7;
|
1451 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
1452 | return function ($this, callbackfn, that, specificCreate) {
|
1453 | var O = toObject($this);
|
1454 | var self = indexedObject(O);
|
1455 | var boundFunction = functionBindContext(callbackfn, that, 3);
|
1456 | var length = toLength(self.length);
|
1457 | var index = 0;
|
1458 | var create = specificCreate || arraySpeciesCreate;
|
1459 | var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
1460 | var value, result;
|
1461 |
|
1462 | for (; length > index; index++) if (NO_HOLES || index in self) {
|
1463 | value = self[index];
|
1464 | result = boundFunction(value, index, O);
|
1465 |
|
1466 | if (TYPE) {
|
1467 | if (IS_MAP) target[index] = result;
|
1468 | else if (result) switch (TYPE) {
|
1469 | case 3:
|
1470 | return true;
|
1471 |
|
1472 |
|
1473 | case 5:
|
1474 | return value;
|
1475 |
|
1476 |
|
1477 | case 6:
|
1478 | return index;
|
1479 |
|
1480 |
|
1481 | case 2:
|
1482 | push.call(target, value);
|
1483 |
|
1484 | } else switch (TYPE) {
|
1485 | case 4:
|
1486 | return false;
|
1487 |
|
1488 |
|
1489 | case 7:
|
1490 | push.call(target, value);
|
1491 |
|
1492 | }
|
1493 | }
|
1494 | }
|
1495 |
|
1496 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
1497 | };
|
1498 | };
|
1499 |
|
1500 | var arrayIteration = {
|
1501 |
|
1502 |
|
1503 | forEach: createMethod$3(0),
|
1504 |
|
1505 |
|
1506 | map: createMethod$3(1),
|
1507 |
|
1508 |
|
1509 | filter: createMethod$3(2),
|
1510 |
|
1511 |
|
1512 | some: createMethod$3(3),
|
1513 |
|
1514 |
|
1515 | every: createMethod$3(4),
|
1516 |
|
1517 |
|
1518 | find: createMethod$3(5),
|
1519 |
|
1520 |
|
1521 | findIndex: createMethod$3(6),
|
1522 |
|
1523 |
|
1524 | filterReject: createMethod$3(7)
|
1525 | };
|
1526 |
|
1527 | var $forEach$1 = arrayIteration.forEach;
|
1528 | var HIDDEN = sharedKey('hidden');
|
1529 | var SYMBOL = 'Symbol';
|
1530 | var PROTOTYPE = 'prototype';
|
1531 | var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
1532 | var setInternalState$2 = internalState.set;
|
1533 | var getInternalState = internalState.getterFor(SYMBOL);
|
1534 | var ObjectPrototype = Object[PROTOTYPE];
|
1535 | var $Symbol = global_1.Symbol;
|
1536 | var $stringify$1 = getBuiltIn('JSON', 'stringify');
|
1537 | var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
1538 | var nativeDefineProperty = objectDefineProperty.f;
|
1539 | var nativeGetOwnPropertyNames = objectGetOwnPropertyNamesExternal.f;
|
1540 | var nativePropertyIsEnumerable = objectPropertyIsEnumerable.f;
|
1541 | var AllSymbols = shared('symbols');
|
1542 | var ObjectPrototypeSymbols = shared('op-symbols');
|
1543 | var StringToSymbolRegistry = shared('string-to-symbol-registry');
|
1544 | var SymbolToStringRegistry = shared('symbol-to-string-registry');
|
1545 | var WellKnownSymbolsStore = shared('wks');
|
1546 | var QObject = global_1.QObject;
|
1547 |
|
1548 | var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
|
1549 |
|
1550 | var setSymbolDescriptor = descriptors && fails(function () {
|
1551 | return objectCreate(nativeDefineProperty({}, 'a', {
|
1552 | get: function () {
|
1553 | return nativeDefineProperty(this, 'a', {
|
1554 | value: 7
|
1555 | }).a;
|
1556 | }
|
1557 | })).a != 7;
|
1558 | }) ? function (O, P, Attributes) {
|
1559 | var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
|
1560 | if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
|
1561 | nativeDefineProperty(O, P, Attributes);
|
1562 |
|
1563 | if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
|
1564 | nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
|
1565 | }
|
1566 | } : nativeDefineProperty;
|
1567 |
|
1568 | var wrap$1 = function (tag, description) {
|
1569 | var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE]);
|
1570 | setInternalState$2(symbol, {
|
1571 | type: SYMBOL,
|
1572 | tag: tag,
|
1573 | description: description
|
1574 | });
|
1575 | if (!descriptors) symbol.description = description;
|
1576 | return symbol;
|
1577 | };
|
1578 |
|
1579 | var $defineProperty = function defineProperty(O, P, Attributes) {
|
1580 | if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
|
1581 | anObject(O);
|
1582 | var key = toPropertyKey(P);
|
1583 | anObject(Attributes);
|
1584 |
|
1585 | if (has$1(AllSymbols, key)) {
|
1586 | if (!Attributes.enumerable) {
|
1587 | if (!has$1(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
|
1588 | O[HIDDEN][key] = true;
|
1589 | } else {
|
1590 | if (has$1(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
|
1591 | Attributes = objectCreate(Attributes, {
|
1592 | enumerable: createPropertyDescriptor(0, false)
|
1593 | });
|
1594 | }
|
1595 |
|
1596 | return setSymbolDescriptor(O, key, Attributes);
|
1597 | }
|
1598 |
|
1599 | return nativeDefineProperty(O, key, Attributes);
|
1600 | };
|
1601 |
|
1602 | var $defineProperties = function defineProperties(O, Properties) {
|
1603 | anObject(O);
|
1604 | var properties = toIndexedObject(Properties);
|
1605 | var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
|
1606 | $forEach$1(keys, function (key) {
|
1607 | if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
|
1608 | });
|
1609 | return O;
|
1610 | };
|
1611 |
|
1612 | var $create = function create(O, Properties) {
|
1613 | return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
|
1614 | };
|
1615 |
|
1616 | var $propertyIsEnumerable = function propertyIsEnumerable(V) {
|
1617 | var P = toPropertyKey(V);
|
1618 | var enumerable = nativePropertyIsEnumerable.call(this, P);
|
1619 | if (this === ObjectPrototype && has$1(AllSymbols, P) && !has$1(ObjectPrototypeSymbols, P)) return false;
|
1620 | return enumerable || !has$1(this, P) || !has$1(AllSymbols, P) || has$1(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
|
1621 | };
|
1622 |
|
1623 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
|
1624 | var it = toIndexedObject(O);
|
1625 | var key = toPropertyKey(P);
|
1626 | if (it === ObjectPrototype && has$1(AllSymbols, key) && !has$1(ObjectPrototypeSymbols, key)) return;
|
1627 | var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
|
1628 |
|
1629 | if (descriptor && has$1(AllSymbols, key) && !(has$1(it, HIDDEN) && it[HIDDEN][key])) {
|
1630 | descriptor.enumerable = true;
|
1631 | }
|
1632 |
|
1633 | return descriptor;
|
1634 | };
|
1635 |
|
1636 | var $getOwnPropertyNames = function getOwnPropertyNames(O) {
|
1637 | var names = nativeGetOwnPropertyNames(toIndexedObject(O));
|
1638 | var result = [];
|
1639 | $forEach$1(names, function (key) {
|
1640 | if (!has$1(AllSymbols, key) && !has$1(hiddenKeys$1, key)) result.push(key);
|
1641 | });
|
1642 | return result;
|
1643 | };
|
1644 |
|
1645 | var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
|
1646 | var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
|
1647 | var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
|
1648 | var result = [];
|
1649 | $forEach$1(names, function (key) {
|
1650 | if (has$1(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has$1(ObjectPrototype, key))) {
|
1651 | result.push(AllSymbols[key]);
|
1652 | }
|
1653 | });
|
1654 | return result;
|
1655 | };
|
1656 |
|
1657 |
|
1658 |
|
1659 | if (!nativeSymbol) {
|
1660 | $Symbol = function Symbol() {
|
1661 | if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
|
1662 | var description = !arguments.length || arguments[0] === undefined ? undefined : toString_1(arguments[0]);
|
1663 | var tag = uid(description);
|
1664 |
|
1665 | var setter = function (value) {
|
1666 | if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
|
1667 | if (has$1(this, HIDDEN) && has$1(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
|
1668 | setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
|
1669 | };
|
1670 |
|
1671 | if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {
|
1672 | configurable: true,
|
1673 | set: setter
|
1674 | });
|
1675 | return wrap$1(tag, description);
|
1676 | };
|
1677 |
|
1678 | redefine($Symbol[PROTOTYPE], 'toString', function toString() {
|
1679 | return getInternalState(this).tag;
|
1680 | });
|
1681 | redefine($Symbol, 'withoutSetter', function (description) {
|
1682 | return wrap$1(uid(description), description);
|
1683 | });
|
1684 | objectPropertyIsEnumerable.f = $propertyIsEnumerable;
|
1685 | objectDefineProperty.f = $defineProperty;
|
1686 | objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
|
1687 | objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
|
1688 | objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
|
1689 |
|
1690 | wellKnownSymbolWrapped.f = function (name) {
|
1691 | return wrap$1(wellKnownSymbol(name), name);
|
1692 | };
|
1693 |
|
1694 | if (descriptors) {
|
1695 |
|
1696 | nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
|
1697 | configurable: true,
|
1698 | get: function description() {
|
1699 | return getInternalState(this).description;
|
1700 | }
|
1701 | });
|
1702 | }
|
1703 | }
|
1704 |
|
1705 | _export({
|
1706 | global: true,
|
1707 | wrap: true,
|
1708 | forced: !nativeSymbol,
|
1709 | sham: !nativeSymbol
|
1710 | }, {
|
1711 | Symbol: $Symbol
|
1712 | });
|
1713 | $forEach$1(objectKeys(WellKnownSymbolsStore), function (name) {
|
1714 | defineWellKnownSymbol(name);
|
1715 | });
|
1716 | _export({
|
1717 | target: SYMBOL,
|
1718 | stat: true,
|
1719 | forced: !nativeSymbol
|
1720 | }, {
|
1721 |
|
1722 |
|
1723 | 'for': function (key) {
|
1724 | var string = toString_1(key);
|
1725 | if (has$1(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
|
1726 | var symbol = $Symbol(string);
|
1727 | StringToSymbolRegistry[string] = symbol;
|
1728 | SymbolToStringRegistry[symbol] = string;
|
1729 | return symbol;
|
1730 | },
|
1731 |
|
1732 |
|
1733 | keyFor: function keyFor(sym) {
|
1734 | if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
|
1735 | if (has$1(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
|
1736 | },
|
1737 | useSetter: function () {
|
1738 | USE_SETTER = true;
|
1739 | },
|
1740 | useSimple: function () {
|
1741 | USE_SETTER = false;
|
1742 | }
|
1743 | });
|
1744 | _export({
|
1745 | target: 'Object',
|
1746 | stat: true,
|
1747 | forced: !nativeSymbol,
|
1748 | sham: !descriptors
|
1749 | }, {
|
1750 |
|
1751 |
|
1752 | create: $create,
|
1753 |
|
1754 |
|
1755 | defineProperty: $defineProperty,
|
1756 |
|
1757 |
|
1758 | defineProperties: $defineProperties,
|
1759 |
|
1760 |
|
1761 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor
|
1762 | });
|
1763 | _export({
|
1764 | target: 'Object',
|
1765 | stat: true,
|
1766 | forced: !nativeSymbol
|
1767 | }, {
|
1768 |
|
1769 |
|
1770 | getOwnPropertyNames: $getOwnPropertyNames,
|
1771 |
|
1772 |
|
1773 | getOwnPropertySymbols: $getOwnPropertySymbols
|
1774 | });
|
1775 |
|
1776 |
|
1777 | _export({
|
1778 | target: 'Object',
|
1779 | stat: true,
|
1780 | forced: fails(function () {
|
1781 | objectGetOwnPropertySymbols.f(1);
|
1782 | })
|
1783 | }, {
|
1784 | getOwnPropertySymbols: function getOwnPropertySymbols(it) {
|
1785 | return objectGetOwnPropertySymbols.f(toObject(it));
|
1786 | }
|
1787 | });
|
1788 |
|
1789 |
|
1790 | if ($stringify$1) {
|
1791 | var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
|
1792 | var symbol = $Symbol();
|
1793 |
|
1794 | return $stringify$1([symbol]) != '[null]'
|
1795 | || $stringify$1({
|
1796 | a: symbol
|
1797 | }) != '{}'
|
1798 | || $stringify$1(Object(symbol)) != '{}';
|
1799 | });
|
1800 | _export({
|
1801 | target: 'JSON',
|
1802 | stat: true,
|
1803 | forced: FORCED_JSON_STRINGIFY
|
1804 | }, {
|
1805 |
|
1806 | stringify: function stringify(it, replacer, space) {
|
1807 | var args = [it];
|
1808 | var index = 1;
|
1809 | var $replacer;
|
1810 |
|
1811 | while (arguments.length > index) args.push(arguments[index++]);
|
1812 |
|
1813 | $replacer = replacer;
|
1814 | if (!isObject$1(replacer) && it === undefined || isSymbol(it)) return;
|
1815 |
|
1816 | if (!isArray$5(replacer)) replacer = function (key, value) {
|
1817 | if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
|
1818 | if (!isSymbol(value)) return value;
|
1819 | };
|
1820 | args[1] = replacer;
|
1821 | return $stringify$1.apply(null, args);
|
1822 | }
|
1823 | });
|
1824 | }
|
1825 |
|
1826 |
|
1827 |
|
1828 | if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
|
1829 | createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
1830 | }
|
1831 |
|
1832 |
|
1833 |
|
1834 | setToStringTag($Symbol, SYMBOL);
|
1835 | hiddenKeys$1[HIDDEN] = true;
|
1836 |
|
1837 | var getOwnPropertySymbols$2 = path.Object.getOwnPropertySymbols;
|
1838 |
|
1839 | var getOwnPropertySymbols$1 = getOwnPropertySymbols$2;
|
1840 |
|
1841 | var getOwnPropertySymbols = getOwnPropertySymbols$1;
|
1842 |
|
1843 | var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
1844 | var FAILS_ON_PRIMITIVES$2 = fails(function () {
|
1845 | nativeGetOwnPropertyDescriptor(1);
|
1846 | });
|
1847 | var FORCED$6 = !descriptors || FAILS_ON_PRIMITIVES$2;
|
1848 |
|
1849 |
|
1850 | _export({
|
1851 | target: 'Object',
|
1852 | stat: true,
|
1853 | forced: FORCED$6,
|
1854 | sham: !descriptors
|
1855 | }, {
|
1856 | getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
|
1857 | return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
|
1858 | }
|
1859 | });
|
1860 |
|
1861 | var getOwnPropertyDescriptor_1 = createCommonjsModule(function (module) {
|
1862 | var Object = path.Object;
|
1863 |
|
1864 | var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
|
1865 | return Object.getOwnPropertyDescriptor(it, key);
|
1866 | };
|
1867 |
|
1868 | if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
|
1869 | });
|
1870 |
|
1871 | var getOwnPropertyDescriptor$1 = getOwnPropertyDescriptor_1;
|
1872 |
|
1873 | var getOwnPropertyDescriptor = getOwnPropertyDescriptor$1;
|
1874 |
|
1875 | var ownKeys$5 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
1876 | var keys = objectGetOwnPropertyNames.f(anObject(it));
|
1877 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
1878 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
1879 | };
|
1880 |
|
1881 |
|
1882 |
|
1883 | _export({
|
1884 | target: 'Object',
|
1885 | stat: true,
|
1886 | sham: !descriptors
|
1887 | }, {
|
1888 | getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
|
1889 | var O = toIndexedObject(object);
|
1890 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
1891 | var keys = ownKeys$5(O);
|
1892 | var result = {};
|
1893 | var index = 0;
|
1894 | var key, descriptor;
|
1895 |
|
1896 | while (keys.length > index) {
|
1897 | descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
|
1898 | if (descriptor !== undefined) createProperty(result, key, descriptor);
|
1899 | }
|
1900 |
|
1901 | return result;
|
1902 | }
|
1903 | });
|
1904 |
|
1905 | var getOwnPropertyDescriptors$2 = path.Object.getOwnPropertyDescriptors;
|
1906 |
|
1907 | var getOwnPropertyDescriptors$1 = getOwnPropertyDescriptors$2;
|
1908 |
|
1909 | var getOwnPropertyDescriptors = getOwnPropertyDescriptors$1;
|
1910 |
|
1911 |
|
1912 |
|
1913 | _export({
|
1914 | target: 'Object',
|
1915 | stat: true,
|
1916 | forced: !descriptors,
|
1917 | sham: !descriptors
|
1918 | }, {
|
1919 | defineProperties: objectDefineProperties
|
1920 | });
|
1921 |
|
1922 | var defineProperties_1 = createCommonjsModule(function (module) {
|
1923 | var Object = path.Object;
|
1924 |
|
1925 | var defineProperties = module.exports = function defineProperties(T, D) {
|
1926 | return Object.defineProperties(T, D);
|
1927 | };
|
1928 |
|
1929 | if (Object.defineProperties.sham) defineProperties.sham = true;
|
1930 | });
|
1931 |
|
1932 | var defineProperties$1 = defineProperties_1;
|
1933 |
|
1934 | var defineProperties = defineProperties$1;
|
1935 |
|
1936 |
|
1937 |
|
1938 | _export({
|
1939 | target: 'Object',
|
1940 | stat: true,
|
1941 | forced: !descriptors,
|
1942 | sham: !descriptors
|
1943 | }, {
|
1944 | defineProperty: objectDefineProperty.f
|
1945 | });
|
1946 |
|
1947 | var defineProperty_1 = createCommonjsModule(function (module) {
|
1948 | var Object = path.Object;
|
1949 |
|
1950 | var defineProperty = module.exports = function defineProperty(it, key, desc) {
|
1951 | return Object.defineProperty(it, key, desc);
|
1952 | };
|
1953 |
|
1954 | if (Object.defineProperty.sham) defineProperty.sham = true;
|
1955 | });
|
1956 |
|
1957 | var defineProperty$7 = defineProperty_1;
|
1958 |
|
1959 | var defineProperty$6 = defineProperty$7;
|
1960 |
|
1961 | var classCallCheck = createCommonjsModule(function (module) {
|
1962 | function _classCallCheck(instance, Constructor) {
|
1963 | if (!(instance instanceof Constructor)) {
|
1964 | throw new TypeError("Cannot call a class as a function");
|
1965 | }
|
1966 | }
|
1967 |
|
1968 | module.exports = _classCallCheck;
|
1969 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
1970 | });
|
1971 | var _classCallCheck = unwrapExports(classCallCheck);
|
1972 |
|
1973 | var defineProperty$5 = defineProperty$7;
|
1974 |
|
1975 | var defineProperty$4 = defineProperty$5;
|
1976 |
|
1977 | var createClass = createCommonjsModule(function (module) {
|
1978 | function _defineProperties(target, props) {
|
1979 | for (var i = 0; i < props.length; i++) {
|
1980 | var descriptor = props[i];
|
1981 | descriptor.enumerable = descriptor.enumerable || false;
|
1982 | descriptor.configurable = true;
|
1983 | if ("value" in descriptor) descriptor.writable = true;
|
1984 |
|
1985 | defineProperty$4(target, descriptor.key, descriptor);
|
1986 | }
|
1987 | }
|
1988 |
|
1989 | function _createClass(Constructor, protoProps, staticProps) {
|
1990 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
1991 | if (staticProps) _defineProperties(Constructor, staticProps);
|
1992 | return Constructor;
|
1993 | }
|
1994 |
|
1995 | module.exports = _createClass;
|
1996 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
1997 | });
|
1998 | var _createClass = unwrapExports(createClass);
|
1999 |
|
2000 | var defineProperty$3 = createCommonjsModule(function (module) {
|
2001 | function _defineProperty(obj, key, value) {
|
2002 | if (key in obj) {
|
2003 | defineProperty$4(obj, key, {
|
2004 | value: value,
|
2005 | enumerable: true,
|
2006 | configurable: true,
|
2007 | writable: true
|
2008 | });
|
2009 | } else {
|
2010 | obj[key] = value;
|
2011 | }
|
2012 |
|
2013 | return obj;
|
2014 | }
|
2015 |
|
2016 | module.exports = _defineProperty;
|
2017 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2018 | });
|
2019 | var _defineProperty = unwrapExports(defineProperty$3);
|
2020 |
|
2021 |
|
2022 |
|
2023 | _export({
|
2024 | target: 'Array',
|
2025 | stat: true
|
2026 | }, {
|
2027 | isArray: isArray$5
|
2028 | });
|
2029 |
|
2030 | var isArray$4 = path.Array.isArray;
|
2031 |
|
2032 | var isArray$3 = isArray$4;
|
2033 |
|
2034 | var isArray$2 = isArray$3;
|
2035 |
|
2036 | var isArray$1 = isArray$2;
|
2037 |
|
2038 | var arrayWithHoles = createCommonjsModule(function (module) {
|
2039 | function _arrayWithHoles(arr) {
|
2040 | if (isArray$1(arr)) return arr;
|
2041 | }
|
2042 |
|
2043 | module.exports = _arrayWithHoles;
|
2044 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2045 | });
|
2046 | unwrapExports(arrayWithHoles);
|
2047 |
|
2048 | var SPECIES$2 = wellKnownSymbol('species');
|
2049 |
|
2050 | var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
2051 |
|
2052 |
|
2053 |
|
2054 | return engineV8Version >= 51 || !fails(function () {
|
2055 | var array = [];
|
2056 | var constructor = array.constructor = {};
|
2057 |
|
2058 | constructor[SPECIES$2] = function () {
|
2059 | return {
|
2060 | foo: 1
|
2061 | };
|
2062 | };
|
2063 |
|
2064 | return array[METHOD_NAME](Boolean).foo !== 1;
|
2065 | });
|
2066 | };
|
2067 |
|
2068 | var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
2069 | var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
|
2070 | var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
2071 |
|
2072 |
|
2073 |
|
2074 | var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
2075 | var array = [];
|
2076 | array[IS_CONCAT_SPREADABLE] = false;
|
2077 | return array.concat()[0] !== array;
|
2078 | });
|
2079 | var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
2080 |
|
2081 | var isConcatSpreadable = function (O) {
|
2082 | if (!isObject$1(O)) return false;
|
2083 | var spreadable = O[IS_CONCAT_SPREADABLE];
|
2084 | return spreadable !== undefined ? !!spreadable : isArray$5(O);
|
2085 | };
|
2086 |
|
2087 | var FORCED$5 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
2088 |
|
2089 |
|
2090 |
|
2091 | _export({
|
2092 | target: 'Array',
|
2093 | proto: true,
|
2094 | forced: FORCED$5
|
2095 | }, {
|
2096 |
|
2097 | concat: function concat(arg) {
|
2098 | var O = toObject(this);
|
2099 | var A = arraySpeciesCreate(O, 0);
|
2100 | var n = 0;
|
2101 | var i, k, length, len, E;
|
2102 |
|
2103 | for (i = -1, length = arguments.length; i < length; i++) {
|
2104 | E = i === -1 ? O : arguments[i];
|
2105 |
|
2106 | if (isConcatSpreadable(E)) {
|
2107 | len = toLength(E.length);
|
2108 | if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
2109 |
|
2110 | for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
2111 | } else {
|
2112 | if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
2113 | createProperty(A, n++, E);
|
2114 | }
|
2115 | }
|
2116 |
|
2117 | A.length = n;
|
2118 | return A;
|
2119 | }
|
2120 | });
|
2121 |
|
2122 |
|
2123 |
|
2124 | defineWellKnownSymbol('asyncIterator');
|
2125 |
|
2126 |
|
2127 |
|
2128 | defineWellKnownSymbol('hasInstance');
|
2129 |
|
2130 |
|
2131 |
|
2132 | defineWellKnownSymbol('isConcatSpreadable');
|
2133 |
|
2134 |
|
2135 |
|
2136 | defineWellKnownSymbol('iterator');
|
2137 |
|
2138 |
|
2139 |
|
2140 | defineWellKnownSymbol('match');
|
2141 |
|
2142 |
|
2143 |
|
2144 | defineWellKnownSymbol('matchAll');
|
2145 |
|
2146 |
|
2147 |
|
2148 | defineWellKnownSymbol('replace');
|
2149 |
|
2150 |
|
2151 |
|
2152 | defineWellKnownSymbol('search');
|
2153 |
|
2154 |
|
2155 |
|
2156 | defineWellKnownSymbol('species');
|
2157 |
|
2158 |
|
2159 |
|
2160 | defineWellKnownSymbol('split');
|
2161 |
|
2162 |
|
2163 |
|
2164 | defineWellKnownSymbol('toPrimitive');
|
2165 |
|
2166 |
|
2167 |
|
2168 | defineWellKnownSymbol('toStringTag');
|
2169 |
|
2170 |
|
2171 |
|
2172 | defineWellKnownSymbol('unscopables');
|
2173 |
|
2174 |
|
2175 |
|
2176 | setToStringTag(global_1.JSON, 'JSON', true);
|
2177 |
|
2178 | var symbol$4 = path.Symbol;
|
2179 |
|
2180 | var symbol$3 = symbol$4;
|
2181 |
|
2182 |
|
2183 |
|
2184 | defineWellKnownSymbol('asyncDispose');
|
2185 |
|
2186 |
|
2187 |
|
2188 | defineWellKnownSymbol('dispose');
|
2189 |
|
2190 |
|
2191 |
|
2192 | defineWellKnownSymbol('matcher');
|
2193 |
|
2194 |
|
2195 |
|
2196 | defineWellKnownSymbol('metadata');
|
2197 |
|
2198 |
|
2199 |
|
2200 | defineWellKnownSymbol('observable');
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 | defineWellKnownSymbol('patternMatch');
|
2206 |
|
2207 | defineWellKnownSymbol('replaceAll');
|
2208 |
|
2209 |
|
2210 |
|
2211 | var symbol$2 = symbol$3;
|
2212 |
|
2213 | var symbol$1 = symbol$2;
|
2214 |
|
2215 | var iterableToArrayLimit = createCommonjsModule(function (module) {
|
2216 | function _iterableToArrayLimit(arr, i) {
|
2217 | var _i = arr == null ? null : typeof symbol$1 !== "undefined" && getIteratorMethod(arr) || arr["@@iterator"];
|
2218 |
|
2219 | if (_i == null) return;
|
2220 | var _arr = [];
|
2221 | var _n = true;
|
2222 | var _d = false;
|
2223 |
|
2224 | var _s, _e;
|
2225 |
|
2226 | try {
|
2227 | for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
2228 | _arr.push(_s.value);
|
2229 |
|
2230 | if (i && _arr.length === i) break;
|
2231 | }
|
2232 | } catch (err) {
|
2233 | _d = true;
|
2234 | _e = err;
|
2235 | } finally {
|
2236 | try {
|
2237 | if (!_n && _i["return"] != null) _i["return"]();
|
2238 | } finally {
|
2239 | if (_d) throw _e;
|
2240 | }
|
2241 | }
|
2242 |
|
2243 | return _arr;
|
2244 | }
|
2245 |
|
2246 | module.exports = _iterableToArrayLimit;
|
2247 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2248 | });
|
2249 | unwrapExports(iterableToArrayLimit);
|
2250 |
|
2251 | var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('slice');
|
2252 | var SPECIES$1 = wellKnownSymbol('species');
|
2253 | var nativeSlice = [].slice;
|
2254 | var max$1 = Math.max;
|
2255 |
|
2256 |
|
2257 |
|
2258 | _export({
|
2259 | target: 'Array',
|
2260 | proto: true,
|
2261 | forced: !HAS_SPECIES_SUPPORT$3
|
2262 | }, {
|
2263 | slice: function slice(start, end) {
|
2264 | var O = toIndexedObject(this);
|
2265 | var length = toLength(O.length);
|
2266 | var k = toAbsoluteIndex(start, length);
|
2267 | var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
2268 |
|
2269 | var Constructor, result, n;
|
2270 |
|
2271 | if (isArray$5(O)) {
|
2272 | Constructor = O.constructor;
|
2273 |
|
2274 | if (typeof Constructor == 'function' && (Constructor === Array || isArray$5(Constructor.prototype))) {
|
2275 | Constructor = undefined;
|
2276 | } else if (isObject$1(Constructor)) {
|
2277 | Constructor = Constructor[SPECIES$1];
|
2278 | if (Constructor === null) Constructor = undefined;
|
2279 | }
|
2280 |
|
2281 | if (Constructor === Array || Constructor === undefined) {
|
2282 | return nativeSlice.call(O, k, fin);
|
2283 | }
|
2284 | }
|
2285 |
|
2286 | result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
|
2287 |
|
2288 | for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
2289 |
|
2290 | result.length = n;
|
2291 | return result;
|
2292 | }
|
2293 | });
|
2294 |
|
2295 | var entryVirtual = function (CONSTRUCTOR) {
|
2296 | return path[CONSTRUCTOR + 'Prototype'];
|
2297 | };
|
2298 |
|
2299 | var slice$6 = entryVirtual('Array').slice;
|
2300 |
|
2301 | var ArrayPrototype$g = Array.prototype;
|
2302 |
|
2303 | var slice_1 = function (it) {
|
2304 | var own = it.slice;
|
2305 | return it === ArrayPrototype$g || it instanceof Array && own === ArrayPrototype$g.slice ? slice$6 : own;
|
2306 | };
|
2307 |
|
2308 | var slice$5 = slice_1;
|
2309 |
|
2310 | var slice$4 = slice$5;
|
2311 |
|
2312 | var slice$3 = slice$4;
|
2313 |
|
2314 | var from_1$1 = from_1$3;
|
2315 |
|
2316 | var from_1 = from_1$1;
|
2317 |
|
2318 | var arrayLikeToArray = createCommonjsModule(function (module) {
|
2319 | function _arrayLikeToArray(arr, len) {
|
2320 | if (len == null || len > arr.length) len = arr.length;
|
2321 |
|
2322 | for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
2323 | arr2[i] = arr[i];
|
2324 | }
|
2325 |
|
2326 | return arr2;
|
2327 | }
|
2328 |
|
2329 | module.exports = _arrayLikeToArray;
|
2330 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2331 | });
|
2332 | unwrapExports(arrayLikeToArray);
|
2333 |
|
2334 | var unsupportedIterableToArray = createCommonjsModule(function (module) {
|
2335 | function _unsupportedIterableToArray(o, minLen) {
|
2336 | var _context;
|
2337 |
|
2338 | if (!o) return;
|
2339 | if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
2340 |
|
2341 | var n = slice$3(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
|
2342 |
|
2343 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
2344 | if (n === "Map" || n === "Set") return from_1(o);
|
2345 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
2346 | }
|
2347 |
|
2348 | module.exports = _unsupportedIterableToArray;
|
2349 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2350 | });
|
2351 | unwrapExports(unsupportedIterableToArray);
|
2352 |
|
2353 | var nonIterableRest = createCommonjsModule(function (module) {
|
2354 | function _nonIterableRest() {
|
2355 | throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
2356 | }
|
2357 |
|
2358 | module.exports = _nonIterableRest;
|
2359 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2360 | });
|
2361 | unwrapExports(nonIterableRest);
|
2362 |
|
2363 | var slicedToArray = createCommonjsModule(function (module) {
|
2364 | function _slicedToArray(arr, i) {
|
2365 | return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
|
2366 | }
|
2367 |
|
2368 | module.exports = _slicedToArray;
|
2369 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2370 | });
|
2371 | var _slicedToArray = unwrapExports(slicedToArray);
|
2372 |
|
2373 | var iterator$4 = wellKnownSymbolWrapped.f('iterator');
|
2374 |
|
2375 | var iterator$3 = iterator$4;
|
2376 |
|
2377 | var iterator$2 = iterator$3;
|
2378 |
|
2379 | var iterator$1 = iterator$2;
|
2380 |
|
2381 | var _typeof_1 = createCommonjsModule(function (module) {
|
2382 | function _typeof(obj) {
|
2383 | "@babel/helpers - typeof";
|
2384 |
|
2385 | if (typeof symbol$1 === "function" && typeof iterator$1 === "symbol") {
|
2386 | module.exports = _typeof = function _typeof(obj) {
|
2387 | return typeof obj;
|
2388 | };
|
2389 |
|
2390 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2391 | } else {
|
2392 | module.exports = _typeof = function _typeof(obj) {
|
2393 | return obj && typeof symbol$1 === "function" && obj.constructor === symbol$1 && obj !== symbol$1.prototype ? "symbol" : typeof obj;
|
2394 | };
|
2395 |
|
2396 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2397 | }
|
2398 |
|
2399 | return _typeof(obj);
|
2400 | }
|
2401 |
|
2402 | module.exports = _typeof;
|
2403 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2404 | });
|
2405 |
|
2406 | var _typeof = unwrapExports(_typeof_1);
|
2407 |
|
2408 | var arrayWithoutHoles = createCommonjsModule(function (module) {
|
2409 | function _arrayWithoutHoles(arr) {
|
2410 | if (isArray$1(arr)) return arrayLikeToArray(arr);
|
2411 | }
|
2412 |
|
2413 | module.exports = _arrayWithoutHoles;
|
2414 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2415 | });
|
2416 | unwrapExports(arrayWithoutHoles);
|
2417 |
|
2418 | var iterableToArray = createCommonjsModule(function (module) {
|
2419 | function _iterableToArray(iter) {
|
2420 | if (typeof symbol$1 !== "undefined" && getIteratorMethod(iter) != null || iter["@@iterator"] != null) return from_1(iter);
|
2421 | }
|
2422 |
|
2423 | module.exports = _iterableToArray;
|
2424 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2425 | });
|
2426 | unwrapExports(iterableToArray);
|
2427 |
|
2428 | var nonIterableSpread = createCommonjsModule(function (module) {
|
2429 | function _nonIterableSpread() {
|
2430 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
2431 | }
|
2432 |
|
2433 | module.exports = _nonIterableSpread;
|
2434 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2435 | });
|
2436 | unwrapExports(nonIterableSpread);
|
2437 |
|
2438 | var toConsumableArray = createCommonjsModule(function (module) {
|
2439 | function _toConsumableArray(arr) {
|
2440 | return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
|
2441 | }
|
2442 |
|
2443 | module.exports = _toConsumableArray;
|
2444 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
2445 | });
|
2446 | var _toConsumableArray = unwrapExports(toConsumableArray);
|
2447 |
|
2448 | var symbol = symbol$3;
|
2449 |
|
2450 | var concat$2 = entryVirtual('Array').concat;
|
2451 |
|
2452 | var ArrayPrototype$f = Array.prototype;
|
2453 |
|
2454 | var concat_1 = function (it) {
|
2455 | var own = it.concat;
|
2456 | return it === ArrayPrototype$f || it instanceof Array && own === ArrayPrototype$f.concat ? concat$2 : own;
|
2457 | };
|
2458 |
|
2459 | var concat$1 = concat_1;
|
2460 |
|
2461 | var concat = concat$1;
|
2462 |
|
2463 | var slice$2 = slice$5;
|
2464 |
|
2465 |
|
2466 |
|
2467 | _export({
|
2468 | target: 'Reflect',
|
2469 | stat: true
|
2470 | }, {
|
2471 | ownKeys: ownKeys$5
|
2472 | });
|
2473 |
|
2474 | var ownKeys$4 = path.Reflect.ownKeys;
|
2475 |
|
2476 | var ownKeys$3 = ownKeys$4;
|
2477 |
|
2478 | var ownKeys$2 = ownKeys$3;
|
2479 |
|
2480 | var isArray = isArray$3;
|
2481 |
|
2482 | var $map = arrayIteration.map;
|
2483 | var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
|
2484 |
|
2485 |
|
2486 |
|
2487 | _export({
|
2488 | target: 'Array',
|
2489 | proto: true,
|
2490 | forced: !HAS_SPECIES_SUPPORT$2
|
2491 | }, {
|
2492 | map: function map(callbackfn
|
2493 | /* , thisArg */
|
2494 | ) {
|
2495 | return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
2496 | }
|
2497 | });
|
2498 |
|
2499 | var map$5 = entryVirtual('Array').map;
|
2500 |
|
2501 | var ArrayPrototype$e = Array.prototype;
|
2502 |
|
2503 | var map_1 = function (it) {
|
2504 | var own = it.map;
|
2505 | return it === ArrayPrototype$e || it instanceof Array && own === ArrayPrototype$e.map ? map$5 : own;
|
2506 | };
|
2507 |
|
2508 | var map$4 = map_1;
|
2509 |
|
2510 | var map$3 = map$4;
|
2511 |
|
2512 | var FAILS_ON_PRIMITIVES$1 = fails(function () {
|
2513 | objectKeys(1);
|
2514 | });
|
2515 |
|
2516 |
|
2517 | _export({
|
2518 | target: 'Object',
|
2519 | stat: true,
|
2520 | forced: FAILS_ON_PRIMITIVES$1
|
2521 | }, {
|
2522 | keys: function keys(it) {
|
2523 | return objectKeys(toObject(it));
|
2524 | }
|
2525 | });
|
2526 |
|
2527 | var keys$5 = path.Object.keys;
|
2528 |
|
2529 | var keys$4 = keys$5;
|
2530 |
|
2531 | var keys$3 = keys$4;
|
2532 |
|
2533 |
|
2534 |
|
2535 | _export({
|
2536 | target: 'Date',
|
2537 | stat: true
|
2538 | }, {
|
2539 | now: function now() {
|
2540 | return new Date().getTime();
|
2541 | }
|
2542 | });
|
2543 |
|
2544 | var now$3 = path.Date.now;
|
2545 |
|
2546 | var now$2 = now$3;
|
2547 |
|
2548 | var now$1 = now$2;
|
2549 |
|
2550 | var slice$1 = [].slice;
|
2551 | var factories = {};
|
2552 |
|
2553 | var construct$3 = function (C, argsLength, args) {
|
2554 | if (!(argsLength in factories)) {
|
2555 | for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
|
2556 |
|
2557 |
|
2558 | factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
|
2559 | }
|
2560 |
|
2561 | return factories[argsLength](C, args);
|
2562 | };
|
2563 |
|
2564 |
|
2565 |
|
2566 | var functionBind = Function.bind || function bind(that
|
2567 | /* , ...args */
|
2568 | ) {
|
2569 | var fn = aFunction(this);
|
2570 | var partArgs = slice$1.call(arguments, 1);
|
2571 |
|
2572 | var boundFunction = function bound() {
|
2573 | var args = partArgs.concat(slice$1.call(arguments));
|
2574 | return this instanceof boundFunction ? construct$3(fn, args.length, args) : fn.apply(that, args);
|
2575 | };
|
2576 |
|
2577 | if (isObject$1(fn.prototype)) boundFunction.prototype = fn.prototype;
|
2578 | return boundFunction;
|
2579 | };
|
2580 |
|
2581 |
|
2582 |
|
2583 | _export({
|
2584 | target: 'Function',
|
2585 | proto: true
|
2586 | }, {
|
2587 | bind: functionBind
|
2588 | });
|
2589 |
|
2590 | var bind$2 = entryVirtual('Function').bind;
|
2591 |
|
2592 | var FunctionPrototype = Function.prototype;
|
2593 |
|
2594 | var bind_1 = function (it) {
|
2595 | var own = it.bind;
|
2596 | return it === FunctionPrototype || it instanceof Function && own === FunctionPrototype.bind ? bind$2 : own;
|
2597 | };
|
2598 |
|
2599 | var bind$1 = bind_1;
|
2600 |
|
2601 | var bind = bind$1;
|
2602 |
|
2603 | var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
2604 | var method = [][METHOD_NAME];
|
2605 | return !!method && fails(function () {
|
2606 |
|
2607 | method.call(null, argument || function () {
|
2608 | throw 1;
|
2609 | }, 1);
|
2610 | });
|
2611 | };
|
2612 |
|
2613 | var $forEach = arrayIteration.forEach;
|
2614 | var STRICT_METHOD$4 = arrayMethodIsStrict('forEach');
|
2615 |
|
2616 |
|
2617 | var arrayForEach = !STRICT_METHOD$4 ? function forEach(callbackfn
|
2618 | /* , thisArg */
|
2619 | ) {
|
2620 | return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
2621 | } : [].forEach;
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 | _export({
|
2628 | target: 'Array',
|
2629 | proto: true,
|
2630 | forced: [].forEach != arrayForEach
|
2631 | }, {
|
2632 | forEach: arrayForEach
|
2633 | });
|
2634 |
|
2635 | var forEach$4 = entryVirtual('Array').forEach;
|
2636 |
|
2637 | var forEach$3 = forEach$4;
|
2638 |
|
2639 | var ArrayPrototype$d = Array.prototype;
|
2640 | var DOMIterables$3 = {
|
2641 | DOMTokenList: true,
|
2642 | NodeList: true
|
2643 | };
|
2644 |
|
2645 | var forEach_1 = function (it) {
|
2646 | var own = it.forEach;
|
2647 | return it === ArrayPrototype$d || it instanceof Array && own === ArrayPrototype$d.forEach
|
2648 | || DOMIterables$3.hasOwnProperty(classof(it)) ? forEach$3 : own;
|
2649 | };
|
2650 |
|
2651 | var forEach$2 = forEach_1;
|
2652 |
|
2653 | var nativeReverse = [].reverse;
|
2654 | var test$1 = [1, 2];
|
2655 |
|
2656 |
|
2657 |
|
2658 |
|
2659 | _export({
|
2660 | target: 'Array',
|
2661 | proto: true,
|
2662 | forced: String(test$1) === String(test$1.reverse())
|
2663 | }, {
|
2664 | reverse: function reverse() {
|
2665 |
|
2666 | if (isArray$5(this)) this.length = this.length;
|
2667 | return nativeReverse.call(this);
|
2668 | }
|
2669 | });
|
2670 |
|
2671 | var reverse$2 = entryVirtual('Array').reverse;
|
2672 |
|
2673 | var ArrayPrototype$c = Array.prototype;
|
2674 |
|
2675 | var reverse_1 = function (it) {
|
2676 | var own = it.reverse;
|
2677 | return it === ArrayPrototype$c || it instanceof Array && own === ArrayPrototype$c.reverse ? reverse$2 : own;
|
2678 | };
|
2679 |
|
2680 | var reverse$1 = reverse_1;
|
2681 |
|
2682 | var reverse = reverse$1;
|
2683 |
|
2684 | var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('splice');
|
2685 | var max = Math.max;
|
2686 | var min = Math.min;
|
2687 | var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
2688 | var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
2689 |
|
2690 |
|
2691 |
|
2692 | _export({
|
2693 | target: 'Array',
|
2694 | proto: true,
|
2695 | forced: !HAS_SPECIES_SUPPORT$1
|
2696 | }, {
|
2697 | splice: function splice(start, deleteCount
|
2698 | /* , ...items */
|
2699 | ) {
|
2700 | var O = toObject(this);
|
2701 | var len = toLength(O.length);
|
2702 | var actualStart = toAbsoluteIndex(start, len);
|
2703 | var argumentsLength = arguments.length;
|
2704 | var insertCount, actualDeleteCount, A, k, from, to;
|
2705 |
|
2706 | if (argumentsLength === 0) {
|
2707 | insertCount = actualDeleteCount = 0;
|
2708 | } else if (argumentsLength === 1) {
|
2709 | insertCount = 0;
|
2710 | actualDeleteCount = len - actualStart;
|
2711 | } else {
|
2712 | insertCount = argumentsLength - 2;
|
2713 | actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
|
2714 | }
|
2715 |
|
2716 | if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
|
2717 | throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
2718 | }
|
2719 |
|
2720 | A = arraySpeciesCreate(O, actualDeleteCount);
|
2721 |
|
2722 | for (k = 0; k < actualDeleteCount; k++) {
|
2723 | from = actualStart + k;
|
2724 | if (from in O) createProperty(A, k, O[from]);
|
2725 | }
|
2726 |
|
2727 | A.length = actualDeleteCount;
|
2728 |
|
2729 | if (insertCount < actualDeleteCount) {
|
2730 | for (k = actualStart; k < len - actualDeleteCount; k++) {
|
2731 | from = k + actualDeleteCount;
|
2732 | to = k + insertCount;
|
2733 | if (from in O) O[to] = O[from];else delete O[to];
|
2734 | }
|
2735 |
|
2736 | for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
2737 | } else if (insertCount > actualDeleteCount) {
|
2738 | for (k = len - actualDeleteCount; k > actualStart; k--) {
|
2739 | from = k + actualDeleteCount - 1;
|
2740 | to = k + insertCount - 1;
|
2741 | if (from in O) O[to] = O[from];else delete O[to];
|
2742 | }
|
2743 | }
|
2744 |
|
2745 | for (k = 0; k < insertCount; k++) {
|
2746 | O[k + actualStart] = arguments[k + 2];
|
2747 | }
|
2748 |
|
2749 | O.length = len - actualDeleteCount + insertCount;
|
2750 | return A;
|
2751 | }
|
2752 | });
|
2753 |
|
2754 | var splice$2 = entryVirtual('Array').splice;
|
2755 |
|
2756 | var ArrayPrototype$b = Array.prototype;
|
2757 |
|
2758 | var splice_1 = function (it) {
|
2759 | var own = it.splice;
|
2760 | return it === ArrayPrototype$b || it instanceof Array && own === ArrayPrototype$b.splice ? splice$2 : own;
|
2761 | };
|
2762 |
|
2763 | var splice$1 = splice_1;
|
2764 |
|
2765 | var splice = splice$1;
|
2766 |
|
2767 | var $assign = Object.assign;
|
2768 |
|
2769 | var defineProperty$2 = Object.defineProperty;
|
2770 |
|
2771 |
|
2772 | var objectAssign = !$assign || fails(function () {
|
2773 |
|
2774 | if (descriptors && $assign({
|
2775 | b: 1
|
2776 | }, $assign(defineProperty$2({}, 'a', {
|
2777 | enumerable: true,
|
2778 | get: function () {
|
2779 | defineProperty$2(this, 'b', {
|
2780 | value: 3,
|
2781 | enumerable: false
|
2782 | });
|
2783 | }
|
2784 | }), {
|
2785 | b: 2
|
2786 | })).b !== 1) return true;
|
2787 |
|
2788 | var A = {};
|
2789 | var B = {};
|
2790 |
|
2791 | var symbol = Symbol();
|
2792 | var alphabet = 'abcdefghijklmnopqrst';
|
2793 | A[symbol] = 7;
|
2794 | alphabet.split('').forEach(function (chr) {
|
2795 | B[chr] = chr;
|
2796 | });
|
2797 | return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
|
2798 | }) ? function assign(target, source) {
|
2799 |
|
2800 | var T = toObject(target);
|
2801 | var argumentsLength = arguments.length;
|
2802 | var index = 1;
|
2803 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
2804 | var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
2805 |
|
2806 | while (argumentsLength > index) {
|
2807 | var S = indexedObject(arguments[index++]);
|
2808 | var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
|
2809 | var length = keys.length;
|
2810 | var j = 0;
|
2811 | var key;
|
2812 |
|
2813 | while (length > j) {
|
2814 | key = keys[j++];
|
2815 | if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
2816 | }
|
2817 | }
|
2818 |
|
2819 | return T;
|
2820 | } : $assign;
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 | _export({
|
2826 | target: 'Object',
|
2827 | stat: true,
|
2828 | forced: Object.assign !== objectAssign
|
2829 | }, {
|
2830 | assign: objectAssign
|
2831 | });
|
2832 |
|
2833 | var assign$4 = path.Object.assign;
|
2834 |
|
2835 | var assign$3 = assign$4;
|
2836 |
|
2837 | var assign$2 = assign$3;
|
2838 |
|
2839 | var $includes = arrayIncludes.includes;
|
2840 |
|
2841 |
|
2842 | _export({
|
2843 | target: 'Array',
|
2844 | proto: true
|
2845 | }, {
|
2846 | includes: function includes(el
|
2847 | /* , fromIndex = 0 */
|
2848 | ) {
|
2849 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
2850 | }
|
2851 | });
|
2852 |
|
2853 | var includes$4 = entryVirtual('Array').includes;
|
2854 |
|
2855 | var MATCH$1 = wellKnownSymbol('match');
|
2856 |
|
2857 |
|
2858 | var isRegexp = function (it) {
|
2859 | var isRegExp;
|
2860 | return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
2861 | };
|
2862 |
|
2863 | var notARegexp = function (it) {
|
2864 | if (isRegexp(it)) {
|
2865 | throw TypeError("The method doesn't accept regular expressions");
|
2866 | }
|
2867 |
|
2868 | return it;
|
2869 | };
|
2870 |
|
2871 | var MATCH = wellKnownSymbol('match');
|
2872 |
|
2873 | var correctIsRegexpLogic = function (METHOD_NAME) {
|
2874 | var regexp = /./;
|
2875 |
|
2876 | try {
|
2877 | '/./'[METHOD_NAME](regexp);
|
2878 | } catch (error1) {
|
2879 | try {
|
2880 | regexp[MATCH] = false;
|
2881 | return '/./'[METHOD_NAME](regexp);
|
2882 | } catch (error2) {
|
2883 |
|
2884 | }
|
2885 | }
|
2886 |
|
2887 | return false;
|
2888 | };
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 | _export({
|
2894 | target: 'String',
|
2895 | proto: true,
|
2896 | forced: !correctIsRegexpLogic('includes')
|
2897 | }, {
|
2898 | includes: function includes(searchString
|
2899 | /* , position = 0 */
|
2900 | ) {
|
2901 | return !!~toString_1(requireObjectCoercible(this)).indexOf(toString_1(notARegexp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
|
2902 | }
|
2903 | });
|
2904 |
|
2905 | var includes$3 = entryVirtual('String').includes;
|
2906 |
|
2907 | var ArrayPrototype$a = Array.prototype;
|
2908 | var StringPrototype$1 = String.prototype;
|
2909 |
|
2910 | var includes$2 = function (it) {
|
2911 | var own = it.includes;
|
2912 | if (it === ArrayPrototype$a || it instanceof Array && own === ArrayPrototype$a.includes) return includes$4;
|
2913 |
|
2914 | if (typeof it === 'string' || it === StringPrototype$1 || it instanceof String && own === StringPrototype$1.includes) {
|
2915 | return includes$3;
|
2916 | }
|
2917 |
|
2918 | return own;
|
2919 | };
|
2920 |
|
2921 | var includes$1 = includes$2;
|
2922 |
|
2923 | var includes = includes$1;
|
2924 |
|
2925 | var FAILS_ON_PRIMITIVES = fails(function () {
|
2926 | objectGetPrototypeOf(1);
|
2927 | });
|
2928 |
|
2929 |
|
2930 | _export({
|
2931 | target: 'Object',
|
2932 | stat: true,
|
2933 | forced: FAILS_ON_PRIMITIVES,
|
2934 | sham: !correctPrototypeGetter
|
2935 | }, {
|
2936 | getPrototypeOf: function getPrototypeOf(it) {
|
2937 | return objectGetPrototypeOf(toObject(it));
|
2938 | }
|
2939 | });
|
2940 |
|
2941 | var getPrototypeOf$5 = path.Object.getPrototypeOf;
|
2942 |
|
2943 | var getPrototypeOf$4 = getPrototypeOf$5;
|
2944 |
|
2945 | var getPrototypeOf$3 = getPrototypeOf$4;
|
2946 |
|
2947 | var $filter = arrayIteration.filter;
|
2948 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
|
2949 |
|
2950 |
|
2951 |
|
2952 | _export({
|
2953 | target: 'Array',
|
2954 | proto: true,
|
2955 | forced: !HAS_SPECIES_SUPPORT
|
2956 | }, {
|
2957 | filter: function filter(callbackfn
|
2958 | /* , thisArg */
|
2959 | ) {
|
2960 | return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
2961 | }
|
2962 | });
|
2963 |
|
2964 | var filter$2 = entryVirtual('Array').filter;
|
2965 |
|
2966 | var ArrayPrototype$9 = Array.prototype;
|
2967 |
|
2968 | var filter_1 = function (it) {
|
2969 | var own = it.filter;
|
2970 | return it === ArrayPrototype$9 || it instanceof Array && own === ArrayPrototype$9.filter ? filter$2 : own;
|
2971 | };
|
2972 |
|
2973 | var filter$1 = filter_1;
|
2974 |
|
2975 | var filter = filter$1;
|
2976 |
|
2977 | var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
2978 |
|
2979 | var createMethod$2 = function (TO_ENTRIES) {
|
2980 | return function (it) {
|
2981 | var O = toIndexedObject(it);
|
2982 | var keys = objectKeys(O);
|
2983 | var length = keys.length;
|
2984 | var i = 0;
|
2985 | var result = [];
|
2986 | var key;
|
2987 |
|
2988 | while (length > i) {
|
2989 | key = keys[i++];
|
2990 |
|
2991 | if (!descriptors || propertyIsEnumerable.call(O, key)) {
|
2992 | result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
|
2993 | }
|
2994 | }
|
2995 |
|
2996 | return result;
|
2997 | };
|
2998 | };
|
2999 |
|
3000 | var objectToArray = {
|
3001 |
|
3002 |
|
3003 | entries: createMethod$2(true),
|
3004 |
|
3005 |
|
3006 | values: createMethod$2(false)
|
3007 | };
|
3008 |
|
3009 | var $values = objectToArray.values;
|
3010 |
|
3011 |
|
3012 | _export({
|
3013 | target: 'Object',
|
3014 | stat: true
|
3015 | }, {
|
3016 | values: function values(O) {
|
3017 | return $values(O);
|
3018 | }
|
3019 | });
|
3020 |
|
3021 | var values$5 = path.Object.values;
|
3022 |
|
3023 | var values$4 = values$5;
|
3024 |
|
3025 | var values$3 = values$4;
|
3026 |
|
3027 |
|
3028 | var 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';
|
3029 |
|
3030 | var whitespace = '[' + whitespaces + ']';
|
3031 | var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
3032 | var rtrim = RegExp(whitespace + whitespace + '*$');
|
3033 |
|
3034 | var createMethod$1 = function (TYPE) {
|
3035 | return function ($this) {
|
3036 | var string = toString_1(requireObjectCoercible($this));
|
3037 | if (TYPE & 1) string = string.replace(ltrim, '');
|
3038 | if (TYPE & 2) string = string.replace(rtrim, '');
|
3039 | return string;
|
3040 | };
|
3041 | };
|
3042 |
|
3043 | var stringTrim = {
|
3044 |
|
3045 |
|
3046 | start: createMethod$1(1),
|
3047 |
|
3048 |
|
3049 | end: createMethod$1(2),
|
3050 |
|
3051 |
|
3052 | trim: createMethod$1(3)
|
3053 | };
|
3054 |
|
3055 | var trim$4 = stringTrim.trim;
|
3056 | var $parseInt = global_1.parseInt;
|
3057 | var hex = /^[+-]?0[Xx]/;
|
3058 | var FORCED$4 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22;
|
3059 |
|
3060 |
|
3061 | var numberParseInt = FORCED$4 ? function parseInt(string, radix) {
|
3062 | var S = trim$4(toString_1(string));
|
3063 | return $parseInt(S, radix >>> 0 || (hex.test(S) ? 16 : 10));
|
3064 | } : $parseInt;
|
3065 |
|
3066 |
|
3067 |
|
3068 | _export({
|
3069 | global: true,
|
3070 | forced: parseInt != numberParseInt
|
3071 | }, {
|
3072 | parseInt: numberParseInt
|
3073 | });
|
3074 |
|
3075 | var _parseInt$2 = path.parseInt;
|
3076 |
|
3077 | var _parseInt$1 = _parseInt$2;
|
3078 |
|
3079 | var _parseInt = _parseInt$1;
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 | var $indexOf = arrayIncludes.indexOf;
|
3085 | var nativeIndexOf = [].indexOf;
|
3086 | var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
|
3087 | var STRICT_METHOD$3 = arrayMethodIsStrict('indexOf');
|
3088 |
|
3089 |
|
3090 | _export({
|
3091 | target: 'Array',
|
3092 | proto: true,
|
3093 | forced: NEGATIVE_ZERO || !STRICT_METHOD$3
|
3094 | }, {
|
3095 | indexOf: function indexOf(searchElement
|
3096 | /* , fromIndex = 0 */
|
3097 | ) {
|
3098 | return NEGATIVE_ZERO
|
3099 | ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
3100 | }
|
3101 | });
|
3102 |
|
3103 | var indexOf$2 = entryVirtual('Array').indexOf;
|
3104 |
|
3105 | var ArrayPrototype$8 = Array.prototype;
|
3106 |
|
3107 | var indexOf_1 = function (it) {
|
3108 | var own = it.indexOf;
|
3109 | return it === ArrayPrototype$8 || it instanceof Array && own === ArrayPrototype$8.indexOf ? indexOf$2 : own;
|
3110 | };
|
3111 |
|
3112 | var indexOf$1 = indexOf_1;
|
3113 |
|
3114 | var indexOf = indexOf$1;
|
3115 |
|
3116 | var non = '\u200B\u0085\u180E';
|
3117 |
|
3118 |
|
3119 | var stringTrimForced = function (METHOD_NAME) {
|
3120 | return fails(function () {
|
3121 | return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
|
3122 | });
|
3123 | };
|
3124 |
|
3125 | var $trim = stringTrim.trim;
|
3126 |
|
3127 |
|
3128 | _export({
|
3129 | target: 'String',
|
3130 | proto: true,
|
3131 | forced: stringTrimForced('trim')
|
3132 | }, {
|
3133 | trim: function trim() {
|
3134 | return $trim(this);
|
3135 | }
|
3136 | });
|
3137 |
|
3138 | var trim$3 = entryVirtual('String').trim;
|
3139 |
|
3140 | var StringPrototype = String.prototype;
|
3141 |
|
3142 | var trim_1 = function (it) {
|
3143 | var own = it.trim;
|
3144 | return typeof it === 'string' || it === StringPrototype || it instanceof String && own === StringPrototype.trim ? trim$3 : own;
|
3145 | };
|
3146 |
|
3147 | var trim$2 = trim_1;
|
3148 |
|
3149 | var trim$1 = trim$2;
|
3150 |
|
3151 |
|
3152 |
|
3153 | _export({
|
3154 | target: 'Object',
|
3155 | stat: true,
|
3156 | sham: !descriptors
|
3157 | }, {
|
3158 | create: objectCreate
|
3159 | });
|
3160 |
|
3161 | var Object$1 = path.Object;
|
3162 |
|
3163 | var create$4 = function create(P, D) {
|
3164 | return Object$1.create(P, D);
|
3165 | };
|
3166 |
|
3167 | var create$3 = create$4;
|
3168 |
|
3169 | var create$2 = create$3;
|
3170 |
|
3171 | var $stringify = getBuiltIn('JSON', 'stringify');
|
3172 | var re = /[\uD800-\uDFFF]/g;
|
3173 | var low = /^[\uD800-\uDBFF]$/;
|
3174 | var hi = /^[\uDC00-\uDFFF]$/;
|
3175 |
|
3176 | var fix = function (match, offset, string) {
|
3177 | var prev = string.charAt(offset - 1);
|
3178 | var next = string.charAt(offset + 1);
|
3179 |
|
3180 | if (low.test(match) && !hi.test(next) || hi.test(match) && !low.test(prev)) {
|
3181 | return '\\u' + match.charCodeAt(0).toString(16);
|
3182 | }
|
3183 |
|
3184 | return match;
|
3185 | };
|
3186 |
|
3187 | var FORCED$3 = fails(function () {
|
3188 | return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"';
|
3189 | });
|
3190 |
|
3191 | if ($stringify) {
|
3192 |
|
3193 |
|
3194 |
|
3195 | _export({
|
3196 | target: 'JSON',
|
3197 | stat: true,
|
3198 | forced: FORCED$3
|
3199 | }, {
|
3200 |
|
3201 | stringify: function stringify(it, replacer, space) {
|
3202 | var result = $stringify.apply(null, arguments);
|
3203 | return typeof result == 'string' ? result.replace(re, fix) : result;
|
3204 | }
|
3205 | });
|
3206 | }
|
3207 |
|
3208 | if (!path.JSON) path.JSON = {
|
3209 | stringify: JSON.stringify
|
3210 | };
|
3211 |
|
3212 | var stringify$3 = function stringify(it, replacer, space) {
|
3213 | return path.JSON.stringify.apply(null, arguments);
|
3214 | };
|
3215 |
|
3216 | var stringify$2 = stringify$3;
|
3217 |
|
3218 | var stringify$1 = stringify$2;
|
3219 |
|
3220 | var slice = [].slice;
|
3221 | var MSIE = /MSIE .\./.test(engineUserAgent);
|
3222 |
|
3223 | var wrap = function (scheduler) {
|
3224 | return function (handler, timeout
|
3225 | /* , ...arguments */
|
3226 | ) {
|
3227 | var boundArgs = arguments.length > 2;
|
3228 | var args = boundArgs ? slice.call(arguments, 2) : undefined;
|
3229 | return scheduler(boundArgs ? function () {
|
3230 |
|
3231 | (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
|
3232 | } : handler, timeout);
|
3233 | };
|
3234 | };
|
3235 |
|
3236 |
|
3237 |
|
3238 | _export({
|
3239 | global: true,
|
3240 | bind: true,
|
3241 | forced: MSIE
|
3242 | }, {
|
3243 |
|
3244 |
|
3245 | setTimeout: wrap(global_1.setTimeout),
|
3246 |
|
3247 |
|
3248 | setInterval: wrap(global_1.setInterval)
|
3249 | });
|
3250 |
|
3251 | var setTimeout$2 = path.setTimeout;
|
3252 |
|
3253 | var setTimeout$1 = setTimeout$2;
|
3254 |
|
3255 |
|
3256 |
|
3257 |
|
3258 | var arrayFill = function fill(value
|
3259 | /* , start = 0, end = @length */
|
3260 | ) {
|
3261 | var O = toObject(this);
|
3262 | var length = toLength(O.length);
|
3263 | var argumentsLength = arguments.length;
|
3264 | var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
3265 | var end = argumentsLength > 2 ? arguments[2] : undefined;
|
3266 | var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
3267 |
|
3268 | while (endPos > index) O[index++] = value;
|
3269 |
|
3270 | return O;
|
3271 | };
|
3272 |
|
3273 |
|
3274 |
|
3275 | _export({
|
3276 | target: 'Array',
|
3277 | proto: true
|
3278 | }, {
|
3279 | fill: arrayFill
|
3280 | });
|
3281 |
|
3282 | var fill$2 = entryVirtual('Array').fill;
|
3283 |
|
3284 | var ArrayPrototype$7 = Array.prototype;
|
3285 |
|
3286 | var fill_1 = function (it) {
|
3287 | var own = it.fill;
|
3288 | return it === ArrayPrototype$7 || it instanceof Array && own === ArrayPrototype$7.fill ? fill$2 : own;
|
3289 | };
|
3290 |
|
3291 | var fill$1 = fill_1;
|
3292 |
|
3293 | var fill = fill$1;
|
3294 |
|
3295 | var componentEmitter = createCommonjsModule(function (module) {
|
3296 | |
3297 |
|
3298 |
|
3299 | {
|
3300 | module.exports = Emitter;
|
3301 | }
|
3302 | |
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 | function Emitter(obj) {
|
3310 | if (obj) return mixin(obj);
|
3311 | }
|
3312 | |
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 |
|
3320 | function mixin(obj) {
|
3321 | for (var key in Emitter.prototype) {
|
3322 | obj[key] = Emitter.prototype[key];
|
3323 | }
|
3324 |
|
3325 | return obj;
|
3326 | }
|
3327 | |
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 | Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
|
3338 | this._callbacks = this._callbacks || {};
|
3339 | (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
|
3340 | return this;
|
3341 | };
|
3342 | |
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 | Emitter.prototype.once = function (event, fn) {
|
3354 | function on() {
|
3355 | this.off(event, on);
|
3356 | fn.apply(this, arguments);
|
3357 | }
|
3358 |
|
3359 | on.fn = fn;
|
3360 | this.on(event, on);
|
3361 | return this;
|
3362 | };
|
3363 | |
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 | Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
|
3375 | this._callbacks = this._callbacks || {};
|
3376 |
|
3377 | if (0 == arguments.length) {
|
3378 | this._callbacks = {};
|
3379 | return this;
|
3380 | }
|
3381 |
|
3382 |
|
3383 | var callbacks = this._callbacks['$' + event];
|
3384 | if (!callbacks) return this;
|
3385 |
|
3386 | if (1 == arguments.length) {
|
3387 | delete this._callbacks['$' + event];
|
3388 | return this;
|
3389 | }
|
3390 |
|
3391 |
|
3392 | var cb;
|
3393 |
|
3394 | for (var i = 0; i < callbacks.length; i++) {
|
3395 | cb = callbacks[i];
|
3396 |
|
3397 | if (cb === fn || cb.fn === fn) {
|
3398 | callbacks.splice(i, 1);
|
3399 | break;
|
3400 | }
|
3401 | }
|
3402 |
|
3403 |
|
3404 |
|
3405 | if (callbacks.length === 0) {
|
3406 | delete this._callbacks['$' + event];
|
3407 | }
|
3408 |
|
3409 | return this;
|
3410 | };
|
3411 | |
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 | Emitter.prototype.emit = function (event) {
|
3421 | this._callbacks = this._callbacks || {};
|
3422 | var args = new Array(arguments.length - 1),
|
3423 | callbacks = this._callbacks['$' + event];
|
3424 |
|
3425 | for (var i = 1; i < arguments.length; i++) {
|
3426 | args[i - 1] = arguments[i];
|
3427 | }
|
3428 |
|
3429 | if (callbacks) {
|
3430 | callbacks = callbacks.slice(0);
|
3431 |
|
3432 | for (var i = 0, len = callbacks.length; i < len; ++i) {
|
3433 | callbacks[i].apply(this, args);
|
3434 | }
|
3435 | }
|
3436 |
|
3437 | return this;
|
3438 | };
|
3439 | |
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 | Emitter.prototype.listeners = function (event) {
|
3449 | this._callbacks = this._callbacks || {};
|
3450 | return this._callbacks['$' + event] || [];
|
3451 | };
|
3452 | |
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 | Emitter.prototype.hasListeners = function (event) {
|
3462 | return !!this.listeners(event).length;
|
3463 | };
|
3464 | });
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 | function _extends() {
|
3473 | _extends = Object.assign || function (target) {
|
3474 | for (var i = 1; i < arguments.length; i++) {
|
3475 | var source = arguments[i];
|
3476 |
|
3477 | for (var key in source) {
|
3478 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
3479 | target[key] = source[key];
|
3480 | }
|
3481 | }
|
3482 | }
|
3483 |
|
3484 | return target;
|
3485 | };
|
3486 |
|
3487 | return _extends.apply(this, arguments);
|
3488 | }
|
3489 |
|
3490 | function _inheritsLoose(subClass, superClass) {
|
3491 | subClass.prototype = Object.create(superClass.prototype);
|
3492 | subClass.prototype.constructor = subClass;
|
3493 | subClass.__proto__ = superClass;
|
3494 | }
|
3495 |
|
3496 | function _assertThisInitialized$1(self) {
|
3497 | if (self === void 0) {
|
3498 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
3499 | }
|
3500 |
|
3501 | return self;
|
3502 | }
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 | var assign;
|
3514 |
|
3515 | if (typeof Object.assign !== 'function') {
|
3516 | assign = function assign(target) {
|
3517 | if (target === undefined || target === null) {
|
3518 | throw new TypeError('Cannot convert undefined or null to object');
|
3519 | }
|
3520 |
|
3521 | var output = Object(target);
|
3522 |
|
3523 | for (var index = 1; index < arguments.length; index++) {
|
3524 | var source = arguments[index];
|
3525 |
|
3526 | if (source !== undefined && source !== null) {
|
3527 | for (var nextKey in source) {
|
3528 | if (source.hasOwnProperty(nextKey)) {
|
3529 | output[nextKey] = source[nextKey];
|
3530 | }
|
3531 | }
|
3532 | }
|
3533 | }
|
3534 |
|
3535 | return output;
|
3536 | };
|
3537 | } else {
|
3538 | assign = Object.assign;
|
3539 | }
|
3540 |
|
3541 | var assign$1 = assign;
|
3542 | var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
3543 | var TEST_ELEMENT = typeof document === "undefined" ? {
|
3544 | style: {}
|
3545 | } : document.createElement('div');
|
3546 | var TYPE_FUNCTION = 'function';
|
3547 | var round = Math.round,
|
3548 | abs = Math.abs;
|
3549 | var now = Date.now;
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 | function prefixed(obj, property) {
|
3559 | var prefix;
|
3560 | var prop;
|
3561 | var camelProp = property[0].toUpperCase() + property.slice(1);
|
3562 | var i = 0;
|
3563 |
|
3564 | while (i < VENDOR_PREFIXES.length) {
|
3565 | prefix = VENDOR_PREFIXES[i];
|
3566 | prop = prefix ? prefix + camelProp : property;
|
3567 |
|
3568 | if (prop in obj) {
|
3569 | return prop;
|
3570 | }
|
3571 |
|
3572 | i++;
|
3573 | }
|
3574 |
|
3575 | return undefined;
|
3576 | }
|
3577 |
|
3578 |
|
3579 |
|
3580 | var win;
|
3581 |
|
3582 | if (typeof window === "undefined") {
|
3583 |
|
3584 | win = {};
|
3585 | } else {
|
3586 | win = window;
|
3587 | }
|
3588 |
|
3589 | var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
|
3590 | var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
|
3591 |
|
3592 | function getTouchActionProps() {
|
3593 | if (!NATIVE_TOUCH_ACTION) {
|
3594 | return false;
|
3595 | }
|
3596 |
|
3597 | var touchMap = {};
|
3598 | var cssSupports = win.CSS && win.CSS.supports;
|
3599 | ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
|
3600 |
|
3601 |
|
3602 | return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;
|
3603 | });
|
3604 | return touchMap;
|
3605 | }
|
3606 |
|
3607 | var TOUCH_ACTION_COMPUTE = 'compute';
|
3608 | var TOUCH_ACTION_AUTO = 'auto';
|
3609 | var TOUCH_ACTION_MANIPULATION = 'manipulation';
|
3610 |
|
3611 | var TOUCH_ACTION_NONE = 'none';
|
3612 | var TOUCH_ACTION_PAN_X = 'pan-x';
|
3613 | var TOUCH_ACTION_PAN_Y = 'pan-y';
|
3614 | var TOUCH_ACTION_MAP = getTouchActionProps();
|
3615 | var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
3616 | var SUPPORT_TOUCH = ('ontouchstart' in win);
|
3617 | var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;
|
3618 | var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
|
3619 | var INPUT_TYPE_TOUCH = 'touch';
|
3620 | var INPUT_TYPE_PEN = 'pen';
|
3621 | var INPUT_TYPE_MOUSE = 'mouse';
|
3622 | var INPUT_TYPE_KINECT = 'kinect';
|
3623 | var COMPUTE_INTERVAL = 25;
|
3624 | var INPUT_START = 1;
|
3625 | var INPUT_MOVE = 2;
|
3626 | var INPUT_END = 4;
|
3627 | var INPUT_CANCEL = 8;
|
3628 | var DIRECTION_NONE = 1;
|
3629 | var DIRECTION_LEFT = 2;
|
3630 | var DIRECTION_RIGHT = 4;
|
3631 | var DIRECTION_UP = 8;
|
3632 | var DIRECTION_DOWN = 16;
|
3633 | var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
|
3634 | var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
|
3635 | var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
|
3636 | var PROPS_XY = ['x', 'y'];
|
3637 | var PROPS_CLIENT_XY = ['clientX', 'clientY'];
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 | function each(obj, iterator, context) {
|
3647 | var i;
|
3648 |
|
3649 | if (!obj) {
|
3650 | return;
|
3651 | }
|
3652 |
|
3653 | if (obj.forEach) {
|
3654 | obj.forEach(iterator, context);
|
3655 | } else if (obj.length !== undefined) {
|
3656 | i = 0;
|
3657 |
|
3658 | while (i < obj.length) {
|
3659 | iterator.call(context, obj[i], i, obj);
|
3660 | i++;
|
3661 | }
|
3662 | } else {
|
3663 | for (i in obj) {
|
3664 | obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
|
3665 | }
|
3666 | }
|
3667 | }
|
3668 |
|
3669 |
|
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 | function boolOrFn(val, args) {
|
3679 | if (typeof val === TYPE_FUNCTION) {
|
3680 | return val.apply(args ? args[0] || undefined : undefined, args);
|
3681 | }
|
3682 |
|
3683 | return val;
|
3684 | }
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 | function inStr(str, find) {
|
3695 | return str.indexOf(find) > -1;
|
3696 | }
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 | function cleanTouchActions(actions) {
|
3706 |
|
3707 | if (inStr(actions, TOUCH_ACTION_NONE)) {
|
3708 | return TOUCH_ACTION_NONE;
|
3709 | }
|
3710 |
|
3711 | var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
3712 | var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
3713 |
|
3714 |
|
3715 |
|
3716 |
|
3717 | if (hasPanX && hasPanY) {
|
3718 | return TOUCH_ACTION_NONE;
|
3719 | }
|
3720 |
|
3721 |
|
3722 | if (hasPanX || hasPanY) {
|
3723 | return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
|
3724 | }
|
3725 |
|
3726 |
|
3727 | if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
|
3728 | return TOUCH_ACTION_MANIPULATION;
|
3729 | }
|
3730 |
|
3731 | return TOUCH_ACTION_AUTO;
|
3732 | }
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 | var TouchAction = function () {
|
3744 | function TouchAction(manager, value) {
|
3745 | this.manager = manager;
|
3746 | this.set(value);
|
3747 | }
|
3748 | |
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 | var _proto = TouchAction.prototype;
|
3756 |
|
3757 | _proto.set = function set(value) {
|
3758 |
|
3759 | if (value === TOUCH_ACTION_COMPUTE) {
|
3760 | value = this.compute();
|
3761 | }
|
3762 |
|
3763 | if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
|
3764 | this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
3765 | }
|
3766 |
|
3767 | this.actions = value.toLowerCase().trim();
|
3768 | };
|
3769 | |
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 | _proto.update = function update() {
|
3776 | this.set(this.manager.options.touchAction);
|
3777 | };
|
3778 | |
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 |
|
3784 |
|
3785 | _proto.compute = function compute() {
|
3786 | var actions = [];
|
3787 | each(this.manager.recognizers, function (recognizer) {
|
3788 | if (boolOrFn(recognizer.options.enable, [recognizer])) {
|
3789 | actions = actions.concat(recognizer.getTouchAction());
|
3790 | }
|
3791 | });
|
3792 | return cleanTouchActions(actions.join(' '));
|
3793 | };
|
3794 | |
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 | _proto.preventDefaults = function preventDefaults(input) {
|
3802 | var srcEvent = input.srcEvent;
|
3803 | var direction = input.offsetDirection;
|
3804 |
|
3805 | if (this.manager.session.prevented) {
|
3806 | srcEvent.preventDefault();
|
3807 | return;
|
3808 | }
|
3809 |
|
3810 | var actions = this.actions;
|
3811 | var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
|
3812 | var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
|
3813 | var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
|
3814 |
|
3815 | if (hasNone) {
|
3816 |
|
3817 | var isTapPointer = input.pointers.length === 1;
|
3818 | var isTapMovement = input.distance < 2;
|
3819 | var isTapTouchTime = input.deltaTime < 250;
|
3820 |
|
3821 | if (isTapPointer && isTapMovement && isTapTouchTime) {
|
3822 | return;
|
3823 | }
|
3824 | }
|
3825 |
|
3826 | if (hasPanX && hasPanY) {
|
3827 |
|
3828 | return;
|
3829 | }
|
3830 |
|
3831 | if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
|
3832 | return this.preventSrc(srcEvent);
|
3833 | }
|
3834 | };
|
3835 | |
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 | _proto.preventSrc = function preventSrc(srcEvent) {
|
3843 | this.manager.session.prevented = true;
|
3844 | srcEvent.preventDefault();
|
3845 | };
|
3846 |
|
3847 | return TouchAction;
|
3848 | }();
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 | function hasParent$1(node, parent) {
|
3860 | while (node) {
|
3861 | if (node === parent) {
|
3862 | return true;
|
3863 | }
|
3864 |
|
3865 | node = node.parentNode;
|
3866 | }
|
3867 |
|
3868 | return false;
|
3869 | }
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 | function getCenter(pointers) {
|
3879 | var pointersLength = pointers.length;
|
3880 |
|
3881 | if (pointersLength === 1) {
|
3882 | return {
|
3883 | x: round(pointers[0].clientX),
|
3884 | y: round(pointers[0].clientY)
|
3885 | };
|
3886 | }
|
3887 |
|
3888 | var x = 0;
|
3889 | var y = 0;
|
3890 | var i = 0;
|
3891 |
|
3892 | while (i < pointersLength) {
|
3893 | x += pointers[i].clientX;
|
3894 | y += pointers[i].clientY;
|
3895 | i++;
|
3896 | }
|
3897 |
|
3898 | return {
|
3899 | x: round(x / pointersLength),
|
3900 | y: round(y / pointersLength)
|
3901 | };
|
3902 | }
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 | function simpleCloneInputData(input) {
|
3912 |
|
3913 |
|
3914 | var pointers = [];
|
3915 | var i = 0;
|
3916 |
|
3917 | while (i < input.pointers.length) {
|
3918 | pointers[i] = {
|
3919 | clientX: round(input.pointers[i].clientX),
|
3920 | clientY: round(input.pointers[i].clientY)
|
3921 | };
|
3922 | i++;
|
3923 | }
|
3924 |
|
3925 | return {
|
3926 | timeStamp: now(),
|
3927 | pointers: pointers,
|
3928 | center: getCenter(pointers),
|
3929 | deltaX: input.deltaX,
|
3930 | deltaY: input.deltaY
|
3931 | };
|
3932 | }
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 | function getDistance(p1, p2, props) {
|
3944 | if (!props) {
|
3945 | props = PROPS_XY;
|
3946 | }
|
3947 |
|
3948 | var x = p2[props[0]] - p1[props[0]];
|
3949 | var y = p2[props[1]] - p1[props[1]];
|
3950 | return Math.sqrt(x * x + y * y);
|
3951 | }
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 | function getAngle(p1, p2, props) {
|
3963 | if (!props) {
|
3964 | props = PROPS_XY;
|
3965 | }
|
3966 |
|
3967 | var x = p2[props[0]] - p1[props[0]];
|
3968 | var y = p2[props[1]] - p1[props[1]];
|
3969 | return Math.atan2(y, x) * 180 / Math.PI;
|
3970 | }
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 | function getDirection(x, y) {
|
3981 | if (x === y) {
|
3982 | return DIRECTION_NONE;
|
3983 | }
|
3984 |
|
3985 | if (abs(x) >= abs(y)) {
|
3986 | return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
3987 | }
|
3988 |
|
3989 | return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
3990 | }
|
3991 |
|
3992 | function computeDeltaXY(session, input) {
|
3993 | var center = input.center;
|
3994 |
|
3995 |
|
3996 | var offset = session.offsetDelta || {};
|
3997 | var prevDelta = session.prevDelta || {};
|
3998 | var prevInput = session.prevInput || {};
|
3999 |
|
4000 | if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
|
4001 | prevDelta = session.prevDelta = {
|
4002 | x: prevInput.deltaX || 0,
|
4003 | y: prevInput.deltaY || 0
|
4004 | };
|
4005 | offset = session.offsetDelta = {
|
4006 | x: center.x,
|
4007 | y: center.y
|
4008 | };
|
4009 | }
|
4010 |
|
4011 | input.deltaX = prevDelta.x + (center.x - offset.x);
|
4012 | input.deltaY = prevDelta.y + (center.y - offset.y);
|
4013 | }
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 | function getVelocity(deltaTime, x, y) {
|
4025 | return {
|
4026 | x: x / deltaTime || 0,
|
4027 | y: y / deltaTime || 0
|
4028 | };
|
4029 | }
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 | function getScale(start, end) {
|
4041 | return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
|
4042 | }
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 | function getRotation(start, end) {
|
4053 | return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
4054 | }
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 | function computeIntervalInputData(session, input) {
|
4064 | var last = session.lastInterval || input;
|
4065 | var deltaTime = input.timeStamp - last.timeStamp;
|
4066 | var velocity;
|
4067 | var velocityX;
|
4068 | var velocityY;
|
4069 | var direction;
|
4070 |
|
4071 | if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
4072 | var deltaX = input.deltaX - last.deltaX;
|
4073 | var deltaY = input.deltaY - last.deltaY;
|
4074 | var v = getVelocity(deltaTime, deltaX, deltaY);
|
4075 | velocityX = v.x;
|
4076 | velocityY = v.y;
|
4077 | velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
|
4078 | direction = getDirection(deltaX, deltaY);
|
4079 | session.lastInterval = input;
|
4080 | } else {
|
4081 |
|
4082 | velocity = last.velocity;
|
4083 | velocityX = last.velocityX;
|
4084 | velocityY = last.velocityY;
|
4085 | direction = last.direction;
|
4086 | }
|
4087 |
|
4088 | input.velocity = velocity;
|
4089 | input.velocityX = velocityX;
|
4090 | input.velocityY = velocityY;
|
4091 | input.direction = direction;
|
4092 | }
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 | function computeInputData(manager, input) {
|
4102 | var session = manager.session;
|
4103 | var pointers = input.pointers;
|
4104 | var pointersLength = pointers.length;
|
4105 |
|
4106 | if (!session.firstInput) {
|
4107 | session.firstInput = simpleCloneInputData(input);
|
4108 | }
|
4109 |
|
4110 |
|
4111 | if (pointersLength > 1 && !session.firstMultiple) {
|
4112 | session.firstMultiple = simpleCloneInputData(input);
|
4113 | } else if (pointersLength === 1) {
|
4114 | session.firstMultiple = false;
|
4115 | }
|
4116 |
|
4117 | var firstInput = session.firstInput,
|
4118 | firstMultiple = session.firstMultiple;
|
4119 | var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
|
4120 | var center = input.center = getCenter(pointers);
|
4121 | input.timeStamp = now();
|
4122 | input.deltaTime = input.timeStamp - firstInput.timeStamp;
|
4123 | input.angle = getAngle(offsetCenter, center);
|
4124 | input.distance = getDistance(offsetCenter, center);
|
4125 | computeDeltaXY(session, input);
|
4126 | input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
4127 | var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
|
4128 | input.overallVelocityX = overallVelocity.x;
|
4129 | input.overallVelocityY = overallVelocity.y;
|
4130 | input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
|
4131 | input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
4132 | input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
4133 | input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
|
4134 | computeIntervalInputData(session, input);
|
4135 |
|
4136 | var target = manager.element;
|
4137 | var srcEvent = input.srcEvent;
|
4138 | var srcEventTarget;
|
4139 |
|
4140 | if (srcEvent.composedPath) {
|
4141 | srcEventTarget = srcEvent.composedPath()[0];
|
4142 | } else if (srcEvent.path) {
|
4143 | srcEventTarget = srcEvent.path[0];
|
4144 | } else {
|
4145 | srcEventTarget = srcEvent.target;
|
4146 | }
|
4147 |
|
4148 | if (hasParent$1(srcEventTarget, target)) {
|
4149 | target = srcEventTarget;
|
4150 | }
|
4151 |
|
4152 | input.target = target;
|
4153 | }
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 | function inputHandler(manager, eventType, input) {
|
4164 | var pointersLen = input.pointers.length;
|
4165 | var changedPointersLen = input.changedPointers.length;
|
4166 | var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
|
4167 | var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
|
4168 | input.isFirst = !!isFirst;
|
4169 | input.isFinal = !!isFinal;
|
4170 |
|
4171 | if (isFirst) {
|
4172 | manager.session = {};
|
4173 | }
|
4174 |
|
4175 |
|
4176 |
|
4177 | input.eventType = eventType;
|
4178 |
|
4179 | computeInputData(manager, input);
|
4180 |
|
4181 | manager.emit('hammer.input', input);
|
4182 | manager.recognize(input);
|
4183 | manager.session.prevInput = input;
|
4184 | }
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 | function splitStr(str) {
|
4194 | return str.trim().split(/\s+/g);
|
4195 | }
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 | function addEventListeners(target, types, handler) {
|
4206 | each(splitStr(types), function (type) {
|
4207 | target.addEventListener(type, handler, false);
|
4208 | });
|
4209 | }
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 | function removeEventListeners(target, types, handler) {
|
4220 | each(splitStr(types), function (type) {
|
4221 | target.removeEventListener(type, handler, false);
|
4222 | });
|
4223 | }
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 | function getWindowForElement(element) {
|
4233 | var doc = element.ownerDocument || element;
|
4234 | return doc.defaultView || doc.parentWindow || window;
|
4235 | }
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 | var Input = function () {
|
4247 | function Input(manager, callback) {
|
4248 | var self = this;
|
4249 | this.manager = manager;
|
4250 | this.callback = callback;
|
4251 | this.element = manager.element;
|
4252 | this.target = manager.options.inputTarget;
|
4253 |
|
4254 |
|
4255 | this.domHandler = function (ev) {
|
4256 | if (boolOrFn(manager.options.enable, [manager])) {
|
4257 | self.handler(ev);
|
4258 | }
|
4259 | };
|
4260 |
|
4261 | this.init();
|
4262 | }
|
4263 | |
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 | var _proto = Input.prototype;
|
4271 |
|
4272 | _proto.handler = function handler() {};
|
4273 | |
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 |
|
4279 | _proto.init = function init() {
|
4280 | this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
|
4281 | this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
|
4282 | this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
4283 | };
|
4284 | |
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 | _proto.destroy = function destroy() {
|
4291 | this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
|
4292 | this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
|
4293 | this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
4294 | };
|
4295 |
|
4296 | return Input;
|
4297 | }();
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 |
|
4308 | function inArray(src, find, findByKey) {
|
4309 | if (src.indexOf && !findByKey) {
|
4310 | return src.indexOf(find);
|
4311 | } else {
|
4312 | var i = 0;
|
4313 |
|
4314 | while (i < src.length) {
|
4315 | if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
|
4316 |
|
4317 | return i;
|
4318 | }
|
4319 |
|
4320 | i++;
|
4321 | }
|
4322 |
|
4323 | return -1;
|
4324 | }
|
4325 | }
|
4326 |
|
4327 | var POINTER_INPUT_MAP = {
|
4328 | pointerdown: INPUT_START,
|
4329 | pointermove: INPUT_MOVE,
|
4330 | pointerup: INPUT_END,
|
4331 | pointercancel: INPUT_CANCEL,
|
4332 | pointerout: INPUT_CANCEL
|
4333 | };
|
4334 |
|
4335 | var IE10_POINTER_TYPE_ENUM = {
|
4336 | 2: INPUT_TYPE_TOUCH,
|
4337 | 3: INPUT_TYPE_PEN,
|
4338 | 4: INPUT_TYPE_MOUSE,
|
4339 | 5: INPUT_TYPE_KINECT
|
4340 |
|
4341 | };
|
4342 | var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
4343 | var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
4344 |
|
4345 | if (win.MSPointerEvent && !win.PointerEvent) {
|
4346 | POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
4347 | POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
4348 | }
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | var PointerEventInput = function (_Input) {
|
4358 | _inheritsLoose(PointerEventInput, _Input);
|
4359 |
|
4360 | function PointerEventInput() {
|
4361 | var _this;
|
4362 |
|
4363 | var proto = PointerEventInput.prototype;
|
4364 | proto.evEl = POINTER_ELEMENT_EVENTS;
|
4365 | proto.evWin = POINTER_WINDOW_EVENTS;
|
4366 | _this = _Input.apply(this, arguments) || this;
|
4367 | _this.store = _this.manager.session.pointerEvents = [];
|
4368 | return _this;
|
4369 | }
|
4370 | |
4371 |
|
4372 |
|
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 | var _proto = PointerEventInput.prototype;
|
4378 |
|
4379 | _proto.handler = function handler(ev) {
|
4380 | var store = this.store;
|
4381 | var removePointer = false;
|
4382 | var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
|
4383 | var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
|
4384 | var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
|
4385 | var isTouch = pointerType === INPUT_TYPE_TOUCH;
|
4386 |
|
4387 | var storeIndex = inArray(store, ev.pointerId, 'pointerId');
|
4388 |
|
4389 | if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
|
4390 | if (storeIndex < 0) {
|
4391 | store.push(ev);
|
4392 | storeIndex = store.length - 1;
|
4393 | }
|
4394 | } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
4395 | removePointer = true;
|
4396 | }
|
4397 |
|
4398 |
|
4399 | if (storeIndex < 0) {
|
4400 | return;
|
4401 | }
|
4402 |
|
4403 |
|
4404 | store[storeIndex] = ev;
|
4405 | this.callback(this.manager, eventType, {
|
4406 | pointers: store,
|
4407 | changedPointers: [ev],
|
4408 | pointerType: pointerType,
|
4409 | srcEvent: ev
|
4410 | });
|
4411 |
|
4412 | if (removePointer) {
|
4413 |
|
4414 | store.splice(storeIndex, 1);
|
4415 | }
|
4416 | };
|
4417 |
|
4418 | return PointerEventInput;
|
4419 | }(Input);
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 | function toArray$1(obj) {
|
4429 | return Array.prototype.slice.call(obj, 0);
|
4430 | }
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 |
|
4441 | function uniqueArray(src, key, sort) {
|
4442 | var results = [];
|
4443 | var values = [];
|
4444 | var i = 0;
|
4445 |
|
4446 | while (i < src.length) {
|
4447 | var val = key ? src[i][key] : src[i];
|
4448 |
|
4449 | if (inArray(values, val) < 0) {
|
4450 | results.push(src[i]);
|
4451 | }
|
4452 |
|
4453 | values[i] = val;
|
4454 | i++;
|
4455 | }
|
4456 |
|
4457 | if (sort) {
|
4458 | if (!key) {
|
4459 | results = results.sort();
|
4460 | } else {
|
4461 | results = results.sort(function (a, b) {
|
4462 | return a[key] > b[key];
|
4463 | });
|
4464 | }
|
4465 | }
|
4466 |
|
4467 | return results;
|
4468 | }
|
4469 |
|
4470 | var TOUCH_INPUT_MAP = {
|
4471 | touchstart: INPUT_START,
|
4472 | touchmove: INPUT_MOVE,
|
4473 | touchend: INPUT_END,
|
4474 | touchcancel: INPUT_CANCEL
|
4475 | };
|
4476 | var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 | var TouchInput = function (_Input) {
|
4485 | _inheritsLoose(TouchInput, _Input);
|
4486 |
|
4487 | function TouchInput() {
|
4488 | var _this;
|
4489 |
|
4490 | TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;
|
4491 | _this = _Input.apply(this, arguments) || this;
|
4492 | _this.targetIds = {};
|
4493 |
|
4494 | return _this;
|
4495 | }
|
4496 |
|
4497 | var _proto = TouchInput.prototype;
|
4498 |
|
4499 | _proto.handler = function handler(ev) {
|
4500 | var type = TOUCH_INPUT_MAP[ev.type];
|
4501 | var touches = getTouches.call(this, ev, type);
|
4502 |
|
4503 | if (!touches) {
|
4504 | return;
|
4505 | }
|
4506 |
|
4507 | this.callback(this.manager, type, {
|
4508 | pointers: touches[0],
|
4509 | changedPointers: touches[1],
|
4510 | pointerType: INPUT_TYPE_TOUCH,
|
4511 | srcEvent: ev
|
4512 | });
|
4513 | };
|
4514 |
|
4515 | return TouchInput;
|
4516 | }(Input);
|
4517 |
|
4518 | function getTouches(ev, type) {
|
4519 | var allTouches = toArray$1(ev.touches);
|
4520 | var targetIds = this.targetIds;
|
4521 |
|
4522 | if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
|
4523 | targetIds[allTouches[0].identifier] = true;
|
4524 | return [allTouches, allTouches];
|
4525 | }
|
4526 |
|
4527 | var i;
|
4528 | var targetTouches;
|
4529 | var changedTouches = toArray$1(ev.changedTouches);
|
4530 | var changedTargetTouches = [];
|
4531 | var target = this.target;
|
4532 |
|
4533 | targetTouches = allTouches.filter(function (touch) {
|
4534 | return hasParent$1(touch.target, target);
|
4535 | });
|
4536 |
|
4537 | if (type === INPUT_START) {
|
4538 | i = 0;
|
4539 |
|
4540 | while (i < targetTouches.length) {
|
4541 | targetIds[targetTouches[i].identifier] = true;
|
4542 | i++;
|
4543 | }
|
4544 | }
|
4545 |
|
4546 |
|
4547 | i = 0;
|
4548 |
|
4549 | while (i < changedTouches.length) {
|
4550 | if (targetIds[changedTouches[i].identifier]) {
|
4551 | changedTargetTouches.push(changedTouches[i]);
|
4552 | }
|
4553 |
|
4554 |
|
4555 | if (type & (INPUT_END | INPUT_CANCEL)) {
|
4556 | delete targetIds[changedTouches[i].identifier];
|
4557 | }
|
4558 |
|
4559 | i++;
|
4560 | }
|
4561 |
|
4562 | if (!changedTargetTouches.length) {
|
4563 | return;
|
4564 | }
|
4565 |
|
4566 | return [
|
4567 | uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
|
4568 | }
|
4569 |
|
4570 | var MOUSE_INPUT_MAP = {
|
4571 | mousedown: INPUT_START,
|
4572 | mousemove: INPUT_MOVE,
|
4573 | mouseup: INPUT_END
|
4574 | };
|
4575 | var MOUSE_ELEMENT_EVENTS = 'mousedown';
|
4576 | var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 | var MouseInput = function (_Input) {
|
4585 | _inheritsLoose(MouseInput, _Input);
|
4586 |
|
4587 | function MouseInput() {
|
4588 | var _this;
|
4589 |
|
4590 | var proto = MouseInput.prototype;
|
4591 | proto.evEl = MOUSE_ELEMENT_EVENTS;
|
4592 | proto.evWin = MOUSE_WINDOW_EVENTS;
|
4593 | _this = _Input.apply(this, arguments) || this;
|
4594 | _this.pressed = false;
|
4595 |
|
4596 | return _this;
|
4597 | }
|
4598 | |
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 |
|
4605 | var _proto = MouseInput.prototype;
|
4606 |
|
4607 | _proto.handler = function handler(ev) {
|
4608 | var eventType = MOUSE_INPUT_MAP[ev.type];
|
4609 |
|
4610 | if (eventType & INPUT_START && ev.button === 0) {
|
4611 | this.pressed = true;
|
4612 | }
|
4613 |
|
4614 | if (eventType & INPUT_MOVE && ev.which !== 1) {
|
4615 | eventType = INPUT_END;
|
4616 | }
|
4617 |
|
4618 |
|
4619 | if (!this.pressed) {
|
4620 | return;
|
4621 | }
|
4622 |
|
4623 | if (eventType & INPUT_END) {
|
4624 | this.pressed = false;
|
4625 | }
|
4626 |
|
4627 | this.callback(this.manager, eventType, {
|
4628 | pointers: [ev],
|
4629 | changedPointers: [ev],
|
4630 | pointerType: INPUT_TYPE_MOUSE,
|
4631 | srcEvent: ev
|
4632 | });
|
4633 | };
|
4634 |
|
4635 | return MouseInput;
|
4636 | }(Input);
|
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 |
|
4649 | var DEDUP_TIMEOUT = 2500;
|
4650 | var DEDUP_DISTANCE = 25;
|
4651 |
|
4652 | function setLastTouch(eventData) {
|
4653 | var _eventData$changedPoi = eventData.changedPointers,
|
4654 | touch = _eventData$changedPoi[0];
|
4655 |
|
4656 | if (touch.identifier === this.primaryTouch) {
|
4657 | var lastTouch = {
|
4658 | x: touch.clientX,
|
4659 | y: touch.clientY
|
4660 | };
|
4661 | var lts = this.lastTouches;
|
4662 | this.lastTouches.push(lastTouch);
|
4663 |
|
4664 | var removeLastTouch = function removeLastTouch() {
|
4665 | var i = lts.indexOf(lastTouch);
|
4666 |
|
4667 | if (i > -1) {
|
4668 | lts.splice(i, 1);
|
4669 | }
|
4670 | };
|
4671 |
|
4672 | setTimeout(removeLastTouch, DEDUP_TIMEOUT);
|
4673 | }
|
4674 | }
|
4675 |
|
4676 | function recordTouches(eventType, eventData) {
|
4677 | if (eventType & INPUT_START) {
|
4678 | this.primaryTouch = eventData.changedPointers[0].identifier;
|
4679 | setLastTouch.call(this, eventData);
|
4680 | } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
4681 | setLastTouch.call(this, eventData);
|
4682 | }
|
4683 | }
|
4684 |
|
4685 | function isSyntheticEvent(eventData) {
|
4686 | var x = eventData.srcEvent.clientX;
|
4687 | var y = eventData.srcEvent.clientY;
|
4688 |
|
4689 | for (var i = 0; i < this.lastTouches.length; i++) {
|
4690 | var t = this.lastTouches[i];
|
4691 | var dx = Math.abs(x - t.x);
|
4692 | var dy = Math.abs(y - t.y);
|
4693 |
|
4694 | if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
|
4695 | return true;
|
4696 | }
|
4697 | }
|
4698 |
|
4699 | return false;
|
4700 | }
|
4701 |
|
4702 | var TouchMouseInput = function () {
|
4703 | var TouchMouseInput = function (_Input) {
|
4704 | _inheritsLoose(TouchMouseInput, _Input);
|
4705 |
|
4706 | function TouchMouseInput(_manager, callback) {
|
4707 | var _this;
|
4708 |
|
4709 | _this = _Input.call(this, _manager, callback) || this;
|
4710 |
|
4711 | _this.handler = function (manager, inputEvent, inputData) {
|
4712 | var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;
|
4713 | var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;
|
4714 |
|
4715 | if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
|
4716 | return;
|
4717 | }
|
4718 |
|
4719 |
|
4720 | if (isTouch) {
|
4721 | recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData);
|
4722 | } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) {
|
4723 | return;
|
4724 | }
|
4725 |
|
4726 | _this.callback(manager, inputEvent, inputData);
|
4727 | };
|
4728 |
|
4729 | _this.touch = new TouchInput(_this.manager, _this.handler);
|
4730 | _this.mouse = new MouseInput(_this.manager, _this.handler);
|
4731 | _this.primaryTouch = null;
|
4732 | _this.lastTouches = [];
|
4733 | return _this;
|
4734 | }
|
4735 | |
4736 |
|
4737 |
|
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 | var _proto = TouchMouseInput.prototype;
|
4745 | |
4746 |
|
4747 |
|
4748 |
|
4749 |
|
4750 | _proto.destroy = function destroy() {
|
4751 | this.touch.destroy();
|
4752 | this.mouse.destroy();
|
4753 | };
|
4754 |
|
4755 | return TouchMouseInput;
|
4756 | }(Input);
|
4757 |
|
4758 | return TouchMouseInput;
|
4759 | }();
|
4760 |
|
4761 |
|
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 | function createInputInstance(manager) {
|
4770 | var Type;
|
4771 |
|
4772 | var inputClass = manager.options.inputClass;
|
4773 |
|
4774 | if (inputClass) {
|
4775 | Type = inputClass;
|
4776 | } else if (SUPPORT_POINTER_EVENTS) {
|
4777 | Type = PointerEventInput;
|
4778 | } else if (SUPPORT_ONLY_TOUCH) {
|
4779 | Type = TouchInput;
|
4780 | } else if (!SUPPORT_TOUCH) {
|
4781 | Type = MouseInput;
|
4782 | } else {
|
4783 | Type = TouchMouseInput;
|
4784 | }
|
4785 |
|
4786 | return new Type(manager, inputHandler);
|
4787 | }
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 |
|
4797 |
|
4798 |
|
4799 |
|
4800 | function invokeArrayArg(arg, fn, context) {
|
4801 | if (Array.isArray(arg)) {
|
4802 | each(arg, context[fn], context);
|
4803 | return true;
|
4804 | }
|
4805 |
|
4806 | return false;
|
4807 | }
|
4808 |
|
4809 | var STATE_POSSIBLE = 1;
|
4810 | var STATE_BEGAN = 2;
|
4811 | var STATE_CHANGED = 4;
|
4812 | var STATE_ENDED = 8;
|
4813 | var STATE_RECOGNIZED = STATE_ENDED;
|
4814 | var STATE_CANCELLED = 16;
|
4815 | var STATE_FAILED = 32;
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 | var _uniqueId = 1;
|
4823 |
|
4824 | function uniqueId() {
|
4825 | return _uniqueId++;
|
4826 | }
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 | function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
|
4837 | var manager = recognizer.manager;
|
4838 |
|
4839 | if (manager) {
|
4840 | return manager.get(otherRecognizer);
|
4841 | }
|
4842 |
|
4843 | return otherRecognizer;
|
4844 | }
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 |
|
4852 |
|
4853 | function stateStr(state) {
|
4854 | if (state & STATE_CANCELLED) {
|
4855 | return 'cancel';
|
4856 | } else if (state & STATE_ENDED) {
|
4857 | return 'end';
|
4858 | } else if (state & STATE_CHANGED) {
|
4859 | return 'move';
|
4860 | } else if (state & STATE_BEGAN) {
|
4861 | return 'start';
|
4862 | }
|
4863 |
|
4864 | return '';
|
4865 | }
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 |
|
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 | var Recognizer = function () {
|
4905 | function Recognizer(options) {
|
4906 | if (options === void 0) {
|
4907 | options = {};
|
4908 | }
|
4909 |
|
4910 | this.options = _extends({
|
4911 | enable: true
|
4912 | }, options);
|
4913 | this.id = uniqueId();
|
4914 | this.manager = null;
|
4915 |
|
4916 | this.state = STATE_POSSIBLE;
|
4917 | this.simultaneous = {};
|
4918 | this.requireFail = [];
|
4919 | }
|
4920 | |
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 | var _proto = Recognizer.prototype;
|
4929 |
|
4930 | _proto.set = function set(options) {
|
4931 | assign$1(this.options, options);
|
4932 |
|
4933 | this.manager && this.manager.touchAction.update();
|
4934 | return this;
|
4935 | };
|
4936 | |
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 | _proto.recognizeWith = function recognizeWith(otherRecognizer) {
|
4945 | if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
|
4946 | return this;
|
4947 | }
|
4948 |
|
4949 | var simultaneous = this.simultaneous;
|
4950 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
4951 |
|
4952 | if (!simultaneous[otherRecognizer.id]) {
|
4953 | simultaneous[otherRecognizer.id] = otherRecognizer;
|
4954 | otherRecognizer.recognizeWith(this);
|
4955 | }
|
4956 |
|
4957 | return this;
|
4958 | };
|
4959 | |
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 | _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {
|
4968 | if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
|
4969 | return this;
|
4970 | }
|
4971 |
|
4972 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
4973 | delete this.simultaneous[otherRecognizer.id];
|
4974 | return this;
|
4975 | };
|
4976 | |
4977 |
|
4978 |
|
4979 |
|
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 | _proto.requireFailure = function requireFailure(otherRecognizer) {
|
4985 | if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
|
4986 | return this;
|
4987 | }
|
4988 |
|
4989 | var requireFail = this.requireFail;
|
4990 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
4991 |
|
4992 | if (inArray(requireFail, otherRecognizer) === -1) {
|
4993 | requireFail.push(otherRecognizer);
|
4994 | otherRecognizer.requireFailure(this);
|
4995 | }
|
4996 |
|
4997 | return this;
|
4998 | };
|
4999 | |
5000 |
|
5001 |
|
5002 |
|
5003 |
|
5004 |
|
5005 |
|
5006 |
|
5007 | _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {
|
5008 | if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
|
5009 | return this;
|
5010 | }
|
5011 |
|
5012 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
5013 | var index = inArray(this.requireFail, otherRecognizer);
|
5014 |
|
5015 | if (index > -1) {
|
5016 | this.requireFail.splice(index, 1);
|
5017 | }
|
5018 |
|
5019 | return this;
|
5020 | };
|
5021 | |
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 | _proto.hasRequireFailures = function hasRequireFailures() {
|
5029 | return this.requireFail.length > 0;
|
5030 | };
|
5031 | |
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 | _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {
|
5040 | return !!this.simultaneous[otherRecognizer.id];
|
5041 | };
|
5042 | |
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 | _proto.emit = function emit(input) {
|
5051 | var self = this;
|
5052 | var state = this.state;
|
5053 |
|
5054 | function emit(event) {
|
5055 | self.manager.emit(event, input);
|
5056 | }
|
5057 |
|
5058 |
|
5059 | if (state < STATE_ENDED) {
|
5060 | emit(self.options.event + stateStr(state));
|
5061 | }
|
5062 |
|
5063 | emit(self.options.event);
|
5064 |
|
5065 | if (input.additionalEvent) {
|
5066 |
|
5067 | emit(input.additionalEvent);
|
5068 | }
|
5069 |
|
5070 |
|
5071 | if (state >= STATE_ENDED) {
|
5072 | emit(self.options.event + stateStr(state));
|
5073 | }
|
5074 | };
|
5075 | |
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 |
|
5082 |
|
5083 |
|
5084 | _proto.tryEmit = function tryEmit(input) {
|
5085 | if (this.canEmit()) {
|
5086 | return this.emit(input);
|
5087 | }
|
5088 |
|
5089 |
|
5090 | this.state = STATE_FAILED;
|
5091 | };
|
5092 | |
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 |
|
5099 | _proto.canEmit = function canEmit() {
|
5100 | var i = 0;
|
5101 |
|
5102 | while (i < this.requireFail.length) {
|
5103 | if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
|
5104 | return false;
|
5105 | }
|
5106 |
|
5107 | i++;
|
5108 | }
|
5109 |
|
5110 | return true;
|
5111 | };
|
5112 | |
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 | _proto.recognize = function recognize(inputData) {
|
5120 |
|
5121 |
|
5122 | var inputDataClone = assign$1({}, inputData);
|
5123 |
|
5124 | if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
5125 | this.reset();
|
5126 | this.state = STATE_FAILED;
|
5127 | return;
|
5128 | }
|
5129 |
|
5130 |
|
5131 | if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
|
5132 | this.state = STATE_POSSIBLE;
|
5133 | }
|
5134 |
|
5135 | this.state = this.process(inputDataClone);
|
5136 |
|
5137 |
|
5138 | if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
|
5139 | this.tryEmit(inputDataClone);
|
5140 | }
|
5141 | };
|
5142 | |
5143 |
|
5144 |
|
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 | _proto.process = function process(inputData) {};
|
5155 |
|
5156 |
|
5157 | |
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 | _proto.getTouchAction = function getTouchAction() {};
|
5166 | |
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 | _proto.reset = function reset() {};
|
5175 |
|
5176 | return Recognizer;
|
5177 | }();
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 | var TapRecognizer = function (_Recognizer) {
|
5192 | _inheritsLoose(TapRecognizer, _Recognizer);
|
5193 |
|
5194 | function TapRecognizer(options) {
|
5195 | var _this;
|
5196 |
|
5197 | if (options === void 0) {
|
5198 | options = {};
|
5199 | }
|
5200 |
|
5201 | _this = _Recognizer.call(this, _extends({
|
5202 | event: 'tap',
|
5203 | pointers: 1,
|
5204 | taps: 1,
|
5205 | interval: 300,
|
5206 |
|
5207 | time: 250,
|
5208 |
|
5209 | threshold: 9,
|
5210 |
|
5211 | posThreshold: 10
|
5212 | }, options)) || this;
|
5213 |
|
5214 |
|
5215 | _this.pTime = false;
|
5216 | _this.pCenter = false;
|
5217 | _this._timer = null;
|
5218 | _this._input = null;
|
5219 | _this.count = 0;
|
5220 | return _this;
|
5221 | }
|
5222 |
|
5223 | var _proto = TapRecognizer.prototype;
|
5224 |
|
5225 | _proto.getTouchAction = function getTouchAction() {
|
5226 | return [TOUCH_ACTION_MANIPULATION];
|
5227 | };
|
5228 |
|
5229 | _proto.process = function process(input) {
|
5230 | var _this2 = this;
|
5231 |
|
5232 | var options = this.options;
|
5233 | var validPointers = input.pointers.length === options.pointers;
|
5234 | var validMovement = input.distance < options.threshold;
|
5235 | var validTouchTime = input.deltaTime < options.time;
|
5236 | this.reset();
|
5237 |
|
5238 | if (input.eventType & INPUT_START && this.count === 0) {
|
5239 | return this.failTimeout();
|
5240 | }
|
5241 |
|
5242 |
|
5243 |
|
5244 | if (validMovement && validTouchTime && validPointers) {
|
5245 | if (input.eventType !== INPUT_END) {
|
5246 | return this.failTimeout();
|
5247 | }
|
5248 |
|
5249 | var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
|
5250 | var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
|
5251 | this.pTime = input.timeStamp;
|
5252 | this.pCenter = input.center;
|
5253 |
|
5254 | if (!validMultiTap || !validInterval) {
|
5255 | this.count = 1;
|
5256 | } else {
|
5257 | this.count += 1;
|
5258 | }
|
5259 |
|
5260 | this._input = input;
|
5261 |
|
5262 |
|
5263 | var tapCount = this.count % options.taps;
|
5264 |
|
5265 | if (tapCount === 0) {
|
5266 |
|
5267 |
|
5268 | if (!this.hasRequireFailures()) {
|
5269 | return STATE_RECOGNIZED;
|
5270 | } else {
|
5271 | this._timer = setTimeout(function () {
|
5272 | _this2.state = STATE_RECOGNIZED;
|
5273 |
|
5274 | _this2.tryEmit();
|
5275 | }, options.interval);
|
5276 | return STATE_BEGAN;
|
5277 | }
|
5278 | }
|
5279 | }
|
5280 |
|
5281 | return STATE_FAILED;
|
5282 | };
|
5283 |
|
5284 | _proto.failTimeout = function failTimeout() {
|
5285 | var _this3 = this;
|
5286 |
|
5287 | this._timer = setTimeout(function () {
|
5288 | _this3.state = STATE_FAILED;
|
5289 | }, this.options.interval);
|
5290 | return STATE_FAILED;
|
5291 | };
|
5292 |
|
5293 | _proto.reset = function reset() {
|
5294 | clearTimeout(this._timer);
|
5295 | };
|
5296 |
|
5297 | _proto.emit = function emit() {
|
5298 | if (this.state === STATE_RECOGNIZED) {
|
5299 | this._input.tapCount = this.count;
|
5300 | this.manager.emit(this.options.event, this._input);
|
5301 | }
|
5302 | };
|
5303 |
|
5304 | return TapRecognizer;
|
5305 | }(Recognizer);
|
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 |
|
5313 |
|
5314 | var AttrRecognizer = function (_Recognizer) {
|
5315 | _inheritsLoose(AttrRecognizer, _Recognizer);
|
5316 |
|
5317 | function AttrRecognizer(options) {
|
5318 | if (options === void 0) {
|
5319 | options = {};
|
5320 | }
|
5321 |
|
5322 | return _Recognizer.call(this, _extends({
|
5323 | pointers: 1
|
5324 | }, options)) || this;
|
5325 | }
|
5326 | |
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 |
|
5335 | var _proto = AttrRecognizer.prototype;
|
5336 |
|
5337 | _proto.attrTest = function attrTest(input) {
|
5338 | var optionPointers = this.options.pointers;
|
5339 | return optionPointers === 0 || input.pointers.length === optionPointers;
|
5340 | };
|
5341 | |
5342 |
|
5343 |
|
5344 |
|
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 | _proto.process = function process(input) {
|
5351 | var state = this.state;
|
5352 | var eventType = input.eventType;
|
5353 | var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
|
5354 | var isValid = this.attrTest(input);
|
5355 |
|
5356 | if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
|
5357 | return state | STATE_CANCELLED;
|
5358 | } else if (isRecognized || isValid) {
|
5359 | if (eventType & INPUT_END) {
|
5360 | return state | STATE_ENDED;
|
5361 | } else if (!(state & STATE_BEGAN)) {
|
5362 | return STATE_BEGAN;
|
5363 | }
|
5364 |
|
5365 | return state | STATE_CHANGED;
|
5366 | }
|
5367 |
|
5368 | return STATE_FAILED;
|
5369 | };
|
5370 |
|
5371 | return AttrRecognizer;
|
5372 | }(Recognizer);
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 | function directionStr(direction) {
|
5382 | if (direction === DIRECTION_DOWN) {
|
5383 | return 'down';
|
5384 | } else if (direction === DIRECTION_UP) {
|
5385 | return 'up';
|
5386 | } else if (direction === DIRECTION_LEFT) {
|
5387 | return 'left';
|
5388 | } else if (direction === DIRECTION_RIGHT) {
|
5389 | return 'right';
|
5390 | }
|
5391 |
|
5392 | return '';
|
5393 | }
|
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 | var PanRecognizer = function (_AttrRecognizer) {
|
5404 | _inheritsLoose(PanRecognizer, _AttrRecognizer);
|
5405 |
|
5406 | function PanRecognizer(options) {
|
5407 | var _this;
|
5408 |
|
5409 | if (options === void 0) {
|
5410 | options = {};
|
5411 | }
|
5412 |
|
5413 | _this = _AttrRecognizer.call(this, _extends({
|
5414 | event: 'pan',
|
5415 | threshold: 10,
|
5416 | pointers: 1,
|
5417 | direction: DIRECTION_ALL
|
5418 | }, options)) || this;
|
5419 | _this.pX = null;
|
5420 | _this.pY = null;
|
5421 | return _this;
|
5422 | }
|
5423 |
|
5424 | var _proto = PanRecognizer.prototype;
|
5425 |
|
5426 | _proto.getTouchAction = function getTouchAction() {
|
5427 | var direction = this.options.direction;
|
5428 | var actions = [];
|
5429 |
|
5430 | if (direction & DIRECTION_HORIZONTAL) {
|
5431 | actions.push(TOUCH_ACTION_PAN_Y);
|
5432 | }
|
5433 |
|
5434 | if (direction & DIRECTION_VERTICAL) {
|
5435 | actions.push(TOUCH_ACTION_PAN_X);
|
5436 | }
|
5437 |
|
5438 | return actions;
|
5439 | };
|
5440 |
|
5441 | _proto.directionTest = function directionTest(input) {
|
5442 | var options = this.options;
|
5443 | var hasMoved = true;
|
5444 | var distance = input.distance;
|
5445 | var direction = input.direction;
|
5446 | var x = input.deltaX;
|
5447 | var y = input.deltaY;
|
5448 |
|
5449 | if (!(direction & options.direction)) {
|
5450 | if (options.direction & DIRECTION_HORIZONTAL) {
|
5451 | direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
5452 | hasMoved = x !== this.pX;
|
5453 | distance = Math.abs(input.deltaX);
|
5454 | } else {
|
5455 | direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
5456 | hasMoved = y !== this.pY;
|
5457 | distance = Math.abs(input.deltaY);
|
5458 | }
|
5459 | }
|
5460 |
|
5461 | input.direction = direction;
|
5462 | return hasMoved && distance > options.threshold && direction & options.direction;
|
5463 | };
|
5464 |
|
5465 | _proto.attrTest = function attrTest(input) {
|
5466 | return AttrRecognizer.prototype.attrTest.call(this, input) && (
|
5467 | this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
|
5468 | };
|
5469 |
|
5470 | _proto.emit = function emit(input) {
|
5471 | this.pX = input.deltaX;
|
5472 | this.pY = input.deltaY;
|
5473 | var direction = directionStr(input.direction);
|
5474 |
|
5475 | if (direction) {
|
5476 | input.additionalEvent = this.options.event + direction;
|
5477 | }
|
5478 |
|
5479 | _AttrRecognizer.prototype.emit.call(this, input);
|
5480 | };
|
5481 |
|
5482 | return PanRecognizer;
|
5483 | }(AttrRecognizer);
|
5484 |
|
5485 |
|
5486 |
|
5487 |
|
5488 |
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 | var SwipeRecognizer = function (_AttrRecognizer) {
|
5494 | _inheritsLoose(SwipeRecognizer, _AttrRecognizer);
|
5495 |
|
5496 | function SwipeRecognizer(options) {
|
5497 | if (options === void 0) {
|
5498 | options = {};
|
5499 | }
|
5500 |
|
5501 | return _AttrRecognizer.call(this, _extends({
|
5502 | event: 'swipe',
|
5503 | threshold: 10,
|
5504 | velocity: 0.3,
|
5505 | direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
5506 | pointers: 1
|
5507 | }, options)) || this;
|
5508 | }
|
5509 |
|
5510 | var _proto = SwipeRecognizer.prototype;
|
5511 |
|
5512 | _proto.getTouchAction = function getTouchAction() {
|
5513 | return PanRecognizer.prototype.getTouchAction.call(this);
|
5514 | };
|
5515 |
|
5516 | _proto.attrTest = function attrTest(input) {
|
5517 | var direction = this.options.direction;
|
5518 | var velocity;
|
5519 |
|
5520 | if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
5521 | velocity = input.overallVelocity;
|
5522 | } else if (direction & DIRECTION_HORIZONTAL) {
|
5523 | velocity = input.overallVelocityX;
|
5524 | } else if (direction & DIRECTION_VERTICAL) {
|
5525 | velocity = input.overallVelocityY;
|
5526 | }
|
5527 |
|
5528 | return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
5529 | };
|
5530 |
|
5531 | _proto.emit = function emit(input) {
|
5532 | var direction = directionStr(input.offsetDirection);
|
5533 |
|
5534 | if (direction) {
|
5535 | this.manager.emit(this.options.event + direction, input);
|
5536 | }
|
5537 |
|
5538 | this.manager.emit(this.options.event, input);
|
5539 | };
|
5540 |
|
5541 | return SwipeRecognizer;
|
5542 | }(AttrRecognizer);
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 |
|
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 | var PinchRecognizer = function (_AttrRecognizer) {
|
5553 | _inheritsLoose(PinchRecognizer, _AttrRecognizer);
|
5554 |
|
5555 | function PinchRecognizer(options) {
|
5556 | if (options === void 0) {
|
5557 | options = {};
|
5558 | }
|
5559 |
|
5560 | return _AttrRecognizer.call(this, _extends({
|
5561 | event: 'pinch',
|
5562 | threshold: 0,
|
5563 | pointers: 2
|
5564 | }, options)) || this;
|
5565 | }
|
5566 |
|
5567 | var _proto = PinchRecognizer.prototype;
|
5568 |
|
5569 | _proto.getTouchAction = function getTouchAction() {
|
5570 | return [TOUCH_ACTION_NONE];
|
5571 | };
|
5572 |
|
5573 | _proto.attrTest = function attrTest(input) {
|
5574 | return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
|
5575 | };
|
5576 |
|
5577 | _proto.emit = function emit(input) {
|
5578 | if (input.scale !== 1) {
|
5579 | var inOut = input.scale < 1 ? 'in' : 'out';
|
5580 | input.additionalEvent = this.options.event + inOut;
|
5581 | }
|
5582 |
|
5583 | _AttrRecognizer.prototype.emit.call(this, input);
|
5584 | };
|
5585 |
|
5586 | return PinchRecognizer;
|
5587 | }(AttrRecognizer);
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 | var RotateRecognizer = function (_AttrRecognizer) {
|
5598 | _inheritsLoose(RotateRecognizer, _AttrRecognizer);
|
5599 |
|
5600 | function RotateRecognizer(options) {
|
5601 | if (options === void 0) {
|
5602 | options = {};
|
5603 | }
|
5604 |
|
5605 | return _AttrRecognizer.call(this, _extends({
|
5606 | event: 'rotate',
|
5607 | threshold: 0,
|
5608 | pointers: 2
|
5609 | }, options)) || this;
|
5610 | }
|
5611 |
|
5612 | var _proto = RotateRecognizer.prototype;
|
5613 |
|
5614 | _proto.getTouchAction = function getTouchAction() {
|
5615 | return [TOUCH_ACTION_NONE];
|
5616 | };
|
5617 |
|
5618 | _proto.attrTest = function attrTest(input) {
|
5619 | return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
|
5620 | };
|
5621 |
|
5622 | return RotateRecognizer;
|
5623 | }(AttrRecognizer);
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 | var PressRecognizer = function (_Recognizer) {
|
5634 | _inheritsLoose(PressRecognizer, _Recognizer);
|
5635 |
|
5636 | function PressRecognizer(options) {
|
5637 | var _this;
|
5638 |
|
5639 | if (options === void 0) {
|
5640 | options = {};
|
5641 | }
|
5642 |
|
5643 | _this = _Recognizer.call(this, _extends({
|
5644 | event: 'press',
|
5645 | pointers: 1,
|
5646 | time: 251,
|
5647 |
|
5648 | threshold: 9
|
5649 | }, options)) || this;
|
5650 | _this._timer = null;
|
5651 | _this._input = null;
|
5652 | return _this;
|
5653 | }
|
5654 |
|
5655 | var _proto = PressRecognizer.prototype;
|
5656 |
|
5657 | _proto.getTouchAction = function getTouchAction() {
|
5658 | return [TOUCH_ACTION_AUTO];
|
5659 | };
|
5660 |
|
5661 | _proto.process = function process(input) {
|
5662 | var _this2 = this;
|
5663 |
|
5664 | var options = this.options;
|
5665 | var validPointers = input.pointers.length === options.pointers;
|
5666 | var validMovement = input.distance < options.threshold;
|
5667 | var validTime = input.deltaTime > options.time;
|
5668 | this._input = input;
|
5669 |
|
5670 |
|
5671 | if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
|
5672 | this.reset();
|
5673 | } else if (input.eventType & INPUT_START) {
|
5674 | this.reset();
|
5675 | this._timer = setTimeout(function () {
|
5676 | _this2.state = STATE_RECOGNIZED;
|
5677 |
|
5678 | _this2.tryEmit();
|
5679 | }, options.time);
|
5680 | } else if (input.eventType & INPUT_END) {
|
5681 | return STATE_RECOGNIZED;
|
5682 | }
|
5683 |
|
5684 | return STATE_FAILED;
|
5685 | };
|
5686 |
|
5687 | _proto.reset = function reset() {
|
5688 | clearTimeout(this._timer);
|
5689 | };
|
5690 |
|
5691 | _proto.emit = function emit(input) {
|
5692 | if (this.state !== STATE_RECOGNIZED) {
|
5693 | return;
|
5694 | }
|
5695 |
|
5696 | if (input && input.eventType & INPUT_END) {
|
5697 | this.manager.emit(this.options.event + "up", input);
|
5698 | } else {
|
5699 | this._input.timeStamp = now();
|
5700 | this.manager.emit(this.options.event, this._input);
|
5701 | }
|
5702 | };
|
5703 |
|
5704 | return PressRecognizer;
|
5705 | }(Recognizer);
|
5706 |
|
5707 | var defaults = {
|
5708 | |
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 | domEvents: false,
|
5716 |
|
5717 | |
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 | touchAction: TOUCH_ACTION_COMPUTE,
|
5725 |
|
5726 | |
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 | enable: true,
|
5732 |
|
5733 | |
5734 |
|
5735 |
|
5736 |
|
5737 |
|
5738 |
|
5739 |
|
5740 |
|
5741 | inputTarget: null,
|
5742 |
|
5743 | |
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 | inputClass: null,
|
5750 |
|
5751 | |
5752 |
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 | cssProps: {
|
5758 | |
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 | userSelect: "none",
|
5765 |
|
5766 | |
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 | touchSelect: "none",
|
5773 |
|
5774 | |
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 | touchCallout: "none",
|
5783 |
|
5784 | |
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 | contentZooming: "none",
|
5791 |
|
5792 | |
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 | userDrag: "none",
|
5799 |
|
5800 | |
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 | tapHighlightColor: "rgba(0,0,0,0)"
|
5808 | }
|
5809 | };
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 | var preset = [[RotateRecognizer, {
|
5819 | enable: false
|
5820 | }], [PinchRecognizer, {
|
5821 | enable: false
|
5822 | }, ['rotate']], [SwipeRecognizer, {
|
5823 | direction: DIRECTION_HORIZONTAL
|
5824 | }], [PanRecognizer, {
|
5825 | direction: DIRECTION_HORIZONTAL
|
5826 | }, ['swipe']], [TapRecognizer], [TapRecognizer, {
|
5827 | event: 'doubletap',
|
5828 | taps: 2
|
5829 | }, ['tap']], [PressRecognizer]];
|
5830 | var STOP = 1;
|
5831 | var FORCED_STOP = 2;
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 | function toggleCssProps(manager, add) {
|
5840 | var element = manager.element;
|
5841 |
|
5842 | if (!element.style) {
|
5843 | return;
|
5844 | }
|
5845 |
|
5846 | var prop;
|
5847 | each(manager.options.cssProps, function (value, name) {
|
5848 | prop = prefixed(element.style, name);
|
5849 |
|
5850 | if (add) {
|
5851 | manager.oldCssProps[prop] = element.style[prop];
|
5852 | element.style[prop] = value;
|
5853 | } else {
|
5854 | element.style[prop] = manager.oldCssProps[prop] || "";
|
5855 | }
|
5856 | });
|
5857 |
|
5858 | if (!add) {
|
5859 | manager.oldCssProps = {};
|
5860 | }
|
5861 | }
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 |
|
5869 |
|
5870 | function triggerDomEvent(event, data) {
|
5871 | var gestureEvent = document.createEvent("Event");
|
5872 | gestureEvent.initEvent(event, true, true);
|
5873 | gestureEvent.gesture = data;
|
5874 | data.target.dispatchEvent(gestureEvent);
|
5875 | }
|
5876 |
|
5877 |
|
5878 |
|
5879 |
|
5880 |
|
5881 |
|
5882 |
|
5883 |
|
5884 |
|
5885 | var Manager = function () {
|
5886 | function Manager(element, options) {
|
5887 | var _this = this;
|
5888 |
|
5889 | this.options = assign$1({}, defaults, options || {});
|
5890 | this.options.inputTarget = this.options.inputTarget || element;
|
5891 | this.handlers = {};
|
5892 | this.session = {};
|
5893 | this.recognizers = [];
|
5894 | this.oldCssProps = {};
|
5895 | this.element = element;
|
5896 | this.input = createInputInstance(this);
|
5897 | this.touchAction = new TouchAction(this, this.options.touchAction);
|
5898 | toggleCssProps(this, true);
|
5899 | each(this.options.recognizers, function (item) {
|
5900 | var recognizer = _this.add(new item[0](item[1]));
|
5901 |
|
5902 | item[2] && recognizer.recognizeWith(item[2]);
|
5903 | item[3] && recognizer.requireFailure(item[3]);
|
5904 | }, this);
|
5905 | }
|
5906 | |
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 | var _proto = Manager.prototype;
|
5915 |
|
5916 | _proto.set = function set(options) {
|
5917 | assign$1(this.options, options);
|
5918 |
|
5919 | if (options.touchAction) {
|
5920 | this.touchAction.update();
|
5921 | }
|
5922 |
|
5923 | if (options.inputTarget) {
|
5924 |
|
5925 | this.input.destroy();
|
5926 | this.input.target = options.inputTarget;
|
5927 | this.input.init();
|
5928 | }
|
5929 |
|
5930 | return this;
|
5931 | };
|
5932 | |
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 | _proto.stop = function stop(force) {
|
5942 | this.session.stopped = force ? FORCED_STOP : STOP;
|
5943 | };
|
5944 | |
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 |
|
5953 | _proto.recognize = function recognize(inputData) {
|
5954 | var session = this.session;
|
5955 |
|
5956 | if (session.stopped) {
|
5957 | return;
|
5958 | }
|
5959 |
|
5960 |
|
5961 | this.touchAction.preventDefaults(inputData);
|
5962 | var recognizer;
|
5963 | var recognizers = this.recognizers;
|
5964 |
|
5965 |
|
5966 |
|
5967 | var curRecognizer = session.curRecognizer;
|
5968 |
|
5969 |
|
5970 | if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
|
5971 | session.curRecognizer = null;
|
5972 | curRecognizer = null;
|
5973 | }
|
5974 |
|
5975 | var i = 0;
|
5976 |
|
5977 | while (i < recognizers.length) {
|
5978 | recognizer = recognizers[i];
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 | if (session.stopped !== FORCED_STOP && (
|
5986 | !curRecognizer || recognizer === curRecognizer ||
|
5987 | recognizer.canRecognizeWith(curRecognizer))) {
|
5988 |
|
5989 | recognizer.recognize(inputData);
|
5990 | } else {
|
5991 | recognizer.reset();
|
5992 | }
|
5993 |
|
5994 |
|
5995 |
|
5996 | if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
|
5997 | session.curRecognizer = recognizer;
|
5998 | curRecognizer = recognizer;
|
5999 | }
|
6000 |
|
6001 | i++;
|
6002 | }
|
6003 | };
|
6004 | |
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 | _proto.get = function get(recognizer) {
|
6013 | if (recognizer instanceof Recognizer) {
|
6014 | return recognizer;
|
6015 | }
|
6016 |
|
6017 | var recognizers = this.recognizers;
|
6018 |
|
6019 | for (var i = 0; i < recognizers.length; i++) {
|
6020 | if (recognizers[i].options.event === recognizer) {
|
6021 | return recognizers[i];
|
6022 | }
|
6023 | }
|
6024 |
|
6025 | return null;
|
6026 | };
|
6027 | |
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 | _proto.add = function add(recognizer) {
|
6036 | if (invokeArrayArg(recognizer, "add", this)) {
|
6037 | return this;
|
6038 | }
|
6039 |
|
6040 |
|
6041 | var existing = this.get(recognizer.options.event);
|
6042 |
|
6043 | if (existing) {
|
6044 | this.remove(existing);
|
6045 | }
|
6046 |
|
6047 | this.recognizers.push(recognizer);
|
6048 | recognizer.manager = this;
|
6049 | this.touchAction.update();
|
6050 | return recognizer;
|
6051 | };
|
6052 | |
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 | _proto.remove = function remove(recognizer) {
|
6061 | if (invokeArrayArg(recognizer, "remove", this)) {
|
6062 | return this;
|
6063 | }
|
6064 |
|
6065 | var targetRecognizer = this.get(recognizer);
|
6066 |
|
6067 | if (recognizer) {
|
6068 | var recognizers = this.recognizers;
|
6069 | var index = inArray(recognizers, targetRecognizer);
|
6070 |
|
6071 | if (index !== -1) {
|
6072 | recognizers.splice(index, 1);
|
6073 | this.touchAction.update();
|
6074 | }
|
6075 | }
|
6076 |
|
6077 | return this;
|
6078 | };
|
6079 | |
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 | _proto.on = function on(events, handler) {
|
6089 | if (events === undefined || handler === undefined) {
|
6090 | return this;
|
6091 | }
|
6092 |
|
6093 | var handlers = this.handlers;
|
6094 | each(splitStr(events), function (event) {
|
6095 | handlers[event] = handlers[event] || [];
|
6096 | handlers[event].push(handler);
|
6097 | });
|
6098 | return this;
|
6099 | };
|
6100 | |
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 | _proto.off = function off(events, handler) {
|
6109 | if (events === undefined) {
|
6110 | return this;
|
6111 | }
|
6112 |
|
6113 | var handlers = this.handlers;
|
6114 | each(splitStr(events), function (event) {
|
6115 | if (!handler) {
|
6116 | delete handlers[event];
|
6117 | } else {
|
6118 | handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
6119 | }
|
6120 | });
|
6121 | return this;
|
6122 | };
|
6123 | |
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 | _proto.emit = function emit(event, data) {
|
6131 |
|
6132 | if (this.options.domEvents) {
|
6133 | triggerDomEvent(event, data);
|
6134 | }
|
6135 |
|
6136 |
|
6137 | var handlers = this.handlers[event] && this.handlers[event].slice();
|
6138 |
|
6139 | if (!handlers || !handlers.length) {
|
6140 | return;
|
6141 | }
|
6142 |
|
6143 | data.type = event;
|
6144 |
|
6145 | data.preventDefault = function () {
|
6146 | data.srcEvent.preventDefault();
|
6147 | };
|
6148 |
|
6149 | var i = 0;
|
6150 |
|
6151 | while (i < handlers.length) {
|
6152 | handlers[i](data);
|
6153 | i++;
|
6154 | }
|
6155 | };
|
6156 | |
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 | _proto.destroy = function destroy() {
|
6164 | this.element && toggleCssProps(this, false);
|
6165 | this.handlers = {};
|
6166 | this.session = {};
|
6167 | this.input.destroy();
|
6168 | this.element = null;
|
6169 | };
|
6170 |
|
6171 | return Manager;
|
6172 | }();
|
6173 |
|
6174 | var SINGLE_TOUCH_INPUT_MAP = {
|
6175 | touchstart: INPUT_START,
|
6176 | touchmove: INPUT_MOVE,
|
6177 | touchend: INPUT_END,
|
6178 | touchcancel: INPUT_CANCEL
|
6179 | };
|
6180 | var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
|
6181 | var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
|
6182 |
|
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 |
|
6189 | var SingleTouchInput = function (_Input) {
|
6190 | _inheritsLoose(SingleTouchInput, _Input);
|
6191 |
|
6192 | function SingleTouchInput() {
|
6193 | var _this;
|
6194 |
|
6195 | var proto = SingleTouchInput.prototype;
|
6196 | proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
|
6197 | proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
|
6198 | _this = _Input.apply(this, arguments) || this;
|
6199 | _this.started = false;
|
6200 | return _this;
|
6201 | }
|
6202 |
|
6203 | var _proto = SingleTouchInput.prototype;
|
6204 |
|
6205 | _proto.handler = function handler(ev) {
|
6206 | var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
|
6207 |
|
6208 | if (type === INPUT_START) {
|
6209 | this.started = true;
|
6210 | }
|
6211 |
|
6212 | if (!this.started) {
|
6213 | return;
|
6214 | }
|
6215 |
|
6216 | var touches = normalizeSingleTouches.call(this, ev, type);
|
6217 |
|
6218 | if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
|
6219 | this.started = false;
|
6220 | }
|
6221 |
|
6222 | this.callback(this.manager, type, {
|
6223 | pointers: touches[0],
|
6224 | changedPointers: touches[1],
|
6225 | pointerType: INPUT_TYPE_TOUCH,
|
6226 | srcEvent: ev
|
6227 | });
|
6228 | };
|
6229 |
|
6230 | return SingleTouchInput;
|
6231 | }(Input);
|
6232 |
|
6233 | function normalizeSingleTouches(ev, type) {
|
6234 | var all = toArray$1(ev.touches);
|
6235 | var changed = toArray$1(ev.changedTouches);
|
6236 |
|
6237 | if (type & (INPUT_END | INPUT_CANCEL)) {
|
6238 | all = uniqueArray(all.concat(changed), 'identifier', true);
|
6239 | }
|
6240 |
|
6241 | return [all, changed];
|
6242 | }
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 | function deprecate(method, name, message) {
|
6254 | var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
|
6255 | return function () {
|
6256 | var e = new Error('get-stack-trace');
|
6257 | var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
|
6258 | var log = window.console && (window.console.warn || window.console.log);
|
6259 |
|
6260 | if (log) {
|
6261 | log.call(window.console, deprecationMessage, stack);
|
6262 | }
|
6263 |
|
6264 | return method.apply(this, arguments);
|
6265 | };
|
6266 | }
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 | var extend$1 = deprecate(function (dest, src, merge) {
|
6279 | var keys = Object.keys(src);
|
6280 | var i = 0;
|
6281 |
|
6282 | while (i < keys.length) {
|
6283 | if (!merge || merge && dest[keys[i]] === undefined) {
|
6284 | dest[keys[i]] = src[keys[i]];
|
6285 | }
|
6286 |
|
6287 | i++;
|
6288 | }
|
6289 |
|
6290 | return dest;
|
6291 | }, 'extend', 'Use `assign`.');
|
6292 |
|
6293 |
|
6294 |
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 | var merge$1 = deprecate(function (dest, src) {
|
6302 | return extend$1(dest, src, true);
|
6303 | }, 'merge', 'Use `assign`.');
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 | function inherit(child, base, properties) {
|
6313 | var baseP = base.prototype;
|
6314 | var childP;
|
6315 | childP = child.prototype = Object.create(baseP);
|
6316 | childP.constructor = child;
|
6317 | childP._super = baseP;
|
6318 |
|
6319 | if (properties) {
|
6320 | assign$1(childP, properties);
|
6321 | }
|
6322 | }
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 | function bindFn(fn, context) {
|
6333 | return function boundFn() {
|
6334 | return fn.apply(context, arguments);
|
6335 | };
|
6336 | }
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 | var Hammer$2 = function () {
|
6347 | var Hammer =
|
6348 | |
6349 |
|
6350 |
|
6351 |
|
6352 | function Hammer(element, options) {
|
6353 | if (options === void 0) {
|
6354 | options = {};
|
6355 | }
|
6356 |
|
6357 | return new Manager(element, _extends({
|
6358 | recognizers: preset.concat()
|
6359 | }, options));
|
6360 | };
|
6361 |
|
6362 | Hammer.VERSION = "2.0.17-rc";
|
6363 | Hammer.DIRECTION_ALL = DIRECTION_ALL;
|
6364 | Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
|
6365 | Hammer.DIRECTION_LEFT = DIRECTION_LEFT;
|
6366 | Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;
|
6367 | Hammer.DIRECTION_UP = DIRECTION_UP;
|
6368 | Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;
|
6369 | Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;
|
6370 | Hammer.DIRECTION_NONE = DIRECTION_NONE;
|
6371 | Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
|
6372 | Hammer.INPUT_START = INPUT_START;
|
6373 | Hammer.INPUT_MOVE = INPUT_MOVE;
|
6374 | Hammer.INPUT_END = INPUT_END;
|
6375 | Hammer.INPUT_CANCEL = INPUT_CANCEL;
|
6376 | Hammer.STATE_POSSIBLE = STATE_POSSIBLE;
|
6377 | Hammer.STATE_BEGAN = STATE_BEGAN;
|
6378 | Hammer.STATE_CHANGED = STATE_CHANGED;
|
6379 | Hammer.STATE_ENDED = STATE_ENDED;
|
6380 | Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;
|
6381 | Hammer.STATE_CANCELLED = STATE_CANCELLED;
|
6382 | Hammer.STATE_FAILED = STATE_FAILED;
|
6383 | Hammer.Manager = Manager;
|
6384 | Hammer.Input = Input;
|
6385 | Hammer.TouchAction = TouchAction;
|
6386 | Hammer.TouchInput = TouchInput;
|
6387 | Hammer.MouseInput = MouseInput;
|
6388 | Hammer.PointerEventInput = PointerEventInput;
|
6389 | Hammer.TouchMouseInput = TouchMouseInput;
|
6390 | Hammer.SingleTouchInput = SingleTouchInput;
|
6391 | Hammer.Recognizer = Recognizer;
|
6392 | Hammer.AttrRecognizer = AttrRecognizer;
|
6393 | Hammer.Tap = TapRecognizer;
|
6394 | Hammer.Pan = PanRecognizer;
|
6395 | Hammer.Swipe = SwipeRecognizer;
|
6396 | Hammer.Pinch = PinchRecognizer;
|
6397 | Hammer.Rotate = RotateRecognizer;
|
6398 | Hammer.Press = PressRecognizer;
|
6399 | Hammer.on = addEventListeners;
|
6400 | Hammer.off = removeEventListeners;
|
6401 | Hammer.each = each;
|
6402 | Hammer.merge = merge$1;
|
6403 | Hammer.extend = extend$1;
|
6404 | Hammer.bindFn = bindFn;
|
6405 | Hammer.assign = assign$1;
|
6406 | Hammer.inherit = inherit;
|
6407 | Hammer.bindFn = bindFn;
|
6408 | Hammer.prefixed = prefixed;
|
6409 | Hammer.toArray = toArray$1;
|
6410 | Hammer.inArray = inArray;
|
6411 | Hammer.uniqueArray = uniqueArray;
|
6412 | Hammer.splitStr = splitStr;
|
6413 | Hammer.boolOrFn = boolOrFn;
|
6414 | Hammer.hasParent = hasParent$1;
|
6415 | Hammer.addEventListeners = addEventListeners;
|
6416 | Hammer.removeEventListeners = removeEventListeners;
|
6417 | Hammer.defaults = assign$1({}, defaults, {
|
6418 | preset: preset
|
6419 | });
|
6420 | return Hammer;
|
6421 | }();
|
6422 | var RealHammer = Hammer$2;
|
6423 |
|
6424 | function ownKeys$1(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols) { var symbols = getOwnPropertySymbols(object); if (enumerableOnly) { symbols = filter(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
6425 |
|
6426 | function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context22; forEach$2(_context22 = ownKeys$1(Object(source), true)).call(_context22, function (key) { _defineProperty(target, key, source[key]); }); } else if (getOwnPropertyDescriptors) { defineProperties(target, getOwnPropertyDescriptors(source)); } else { var _context23; forEach$2(_context23 = ownKeys$1(Object(source))).call(_context23, function (key) { defineProperty$6(target, key, getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6427 |
|
6428 | function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof symbol !== "undefined" && getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
6429 |
|
6430 | function _unsupportedIterableToArray$1(o, minLen) { var _context21; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = slice$2(_context21 = Object.prototype.toString.call(o)).call(_context21, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from_1$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
6431 |
|
6432 | function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
6433 |
|
6434 |
|
6435 |
|
6436 |
|
6437 | var DELETE = symbol("DELETE");
|
6438 |
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 | function pureDeepObjectAssign(base) {
|
6449 | var _context;
|
6450 |
|
6451 | for (var _len = arguments.length, updates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
6452 | updates[_key - 1] = arguments[_key];
|
6453 | }
|
6454 |
|
6455 | return deepObjectAssign.apply(void 0, concat(_context = [{}, base]).call(_context, updates));
|
6456 | }
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 |
|
6464 |
|
6465 |
|
6466 | function deepObjectAssign() {
|
6467 | var merged = deepObjectAssignNonentry.apply(void 0, arguments);
|
6468 | stripDelete(merged);
|
6469 | return merged;
|
6470 | }
|
6471 |
|
6472 |
|
6473 |
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 | function deepObjectAssignNonentry() {
|
6484 | for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
6485 | values[_key2] = arguments[_key2];
|
6486 | }
|
6487 |
|
6488 | if (values.length < 2) {
|
6489 | return values[0];
|
6490 | } else if (values.length > 2) {
|
6491 | var _context2;
|
6492 |
|
6493 | return deepObjectAssignNonentry.apply(void 0, concat(_context2 = [deepObjectAssign(values[0], values[1])]).call(_context2, _toConsumableArray(slice$2(values).call(values, 2))));
|
6494 | }
|
6495 |
|
6496 | var a = values[0];
|
6497 | var b = values[1];
|
6498 |
|
6499 | var _iterator = _createForOfIteratorHelper$1(ownKeys$2(b)),
|
6500 | _step;
|
6501 |
|
6502 | try {
|
6503 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
6504 | var prop = _step.value;
|
6505 | if (!Object.prototype.propertyIsEnumerable.call(b, prop)) ;else if (b[prop] === DELETE) {
|
6506 | delete a[prop];
|
6507 | } else if (a[prop] !== null && b[prop] !== null && _typeof(a[prop]) === "object" && _typeof(b[prop]) === "object" && !isArray(a[prop]) && !isArray(b[prop])) {
|
6508 | a[prop] = deepObjectAssignNonentry(a[prop], b[prop]);
|
6509 | } else {
|
6510 | a[prop] = clone(b[prop]);
|
6511 | }
|
6512 | }
|
6513 | } catch (err) {
|
6514 | _iterator.e(err);
|
6515 | } finally {
|
6516 | _iterator.f();
|
6517 | }
|
6518 |
|
6519 | return a;
|
6520 | }
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 | function clone(a) {
|
6531 | if (isArray(a)) {
|
6532 | return map$3(a).call(a, function (value) {
|
6533 | return clone(value);
|
6534 | });
|
6535 | } else if (_typeof(a) === "object" && a !== null) {
|
6536 | return deepObjectAssignNonentry({}, a);
|
6537 | } else {
|
6538 | return a;
|
6539 | }
|
6540 | }
|
6541 |
|
6542 |
|
6543 |
|
6544 |
|
6545 |
|
6546 |
|
6547 |
|
6548 | function stripDelete(a) {
|
6549 | for (var _i = 0, _Object$keys = keys$3(a); _i < _Object$keys.length; _i++) {
|
6550 | var prop = _Object$keys[_i];
|
6551 |
|
6552 | if (a[prop] === DELETE) {
|
6553 | delete a[prop];
|
6554 | } else if (_typeof(a[prop]) === "object" && a[prop] !== null) {
|
6555 | stripDelete(a[prop]);
|
6556 | }
|
6557 | }
|
6558 | }
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 |
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 |
|
6577 |
|
6578 | function Alea() {
|
6579 | for (var _len3 = arguments.length, seed = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
6580 | seed[_key3] = arguments[_key3];
|
6581 | }
|
6582 |
|
6583 | return AleaImplementation(seed.length ? seed : [now$1()]);
|
6584 | }
|
6585 |
|
6586 |
|
6587 |
|
6588 |
|
6589 |
|
6590 |
|
6591 |
|
6592 |
|
6593 |
|
6594 | function AleaImplementation(seed) {
|
6595 | var _mashSeed = mashSeed(seed),
|
6596 | _mashSeed2 = _slicedToArray(_mashSeed, 3),
|
6597 | s0 = _mashSeed2[0],
|
6598 | s1 = _mashSeed2[1],
|
6599 | s2 = _mashSeed2[2];
|
6600 |
|
6601 | var c = 1;
|
6602 |
|
6603 | var random = function random() {
|
6604 | var t = 2091639 * s0 + c * 2.3283064365386963e-10;
|
6605 |
|
6606 | s0 = s1;
|
6607 | s1 = s2;
|
6608 | return s2 = t - (c = t | 0);
|
6609 | };
|
6610 |
|
6611 | random.uint32 = function () {
|
6612 | return random() * 0x100000000;
|
6613 | };
|
6614 |
|
6615 |
|
6616 | random.fract53 = function () {
|
6617 | return random() + (random() * 0x200000 | 0) * 1.1102230246251565e-16;
|
6618 | };
|
6619 |
|
6620 |
|
6621 | random.algorithm = "Alea";
|
6622 | random.seed = seed;
|
6623 | random.version = "0.9";
|
6624 | return random;
|
6625 | }
|
6626 |
|
6627 |
|
6628 |
|
6629 |
|
6630 |
|
6631 |
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 | function mashSeed() {
|
6637 | var mash = Mash();
|
6638 | var s0 = mash(" ");
|
6639 | var s1 = mash(" ");
|
6640 | var s2 = mash(" ");
|
6641 |
|
6642 | for (var i = 0; i < arguments.length; i++) {
|
6643 | s0 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
6644 |
|
6645 | if (s0 < 0) {
|
6646 | s0 += 1;
|
6647 | }
|
6648 |
|
6649 | s1 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
6650 |
|
6651 | if (s1 < 0) {
|
6652 | s1 += 1;
|
6653 | }
|
6654 |
|
6655 | s2 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
6656 |
|
6657 | if (s2 < 0) {
|
6658 | s2 += 1;
|
6659 | }
|
6660 | }
|
6661 |
|
6662 | return [s0, s1, s2];
|
6663 | }
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 |
|
6672 | function Mash() {
|
6673 | var n = 0xefc8249d;
|
6674 | return function (data) {
|
6675 | var string = data.toString();
|
6676 |
|
6677 | for (var i = 0; i < string.length; i++) {
|
6678 | n += string.charCodeAt(i);
|
6679 | var h = 0.02519603282416938 * n;
|
6680 | n = h >>> 0;
|
6681 | h -= n;
|
6682 | h *= n;
|
6683 | n = h >>> 0;
|
6684 | h -= n;
|
6685 | n += h * 0x100000000;
|
6686 | }
|
6687 |
|
6688 | return (n >>> 0) * 2.3283064365386963e-10;
|
6689 | };
|
6690 | }
|
6691 |
|
6692 |
|
6693 |
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 | function hammerMock() {
|
6701 | var noop = function noop() {};
|
6702 |
|
6703 | return {
|
6704 | on: noop,
|
6705 | off: noop,
|
6706 | destroy: noop,
|
6707 | emit: noop,
|
6708 | get: function get() {
|
6709 | return {
|
6710 | set: noop
|
6711 | };
|
6712 | }
|
6713 | };
|
6714 | }
|
6715 |
|
6716 | var Hammer$1 = typeof window !== "undefined" ? window.Hammer || RealHammer : function () {
|
6717 |
|
6718 | return hammerMock();
|
6719 | };
|
6720 |
|
6721 |
|
6722 |
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 |
|
6729 |
|
6730 |
|
6731 |
|
6732 | function Activator(container) {
|
6733 | var _this = this,
|
6734 | _context3;
|
6735 |
|
6736 | this._cleanupQueue = [];
|
6737 | this.active = false;
|
6738 | this._dom = {
|
6739 | container: container,
|
6740 | overlay: document.createElement("div")
|
6741 | };
|
6742 |
|
6743 | this._dom.overlay.classList.add("vis-overlay");
|
6744 |
|
6745 | this._dom.container.appendChild(this._dom.overlay);
|
6746 |
|
6747 | this._cleanupQueue.push(function () {
|
6748 | _this._dom.overlay.parentNode.removeChild(_this._dom.overlay);
|
6749 | });
|
6750 |
|
6751 | var hammer = Hammer$1(this._dom.overlay);
|
6752 | hammer.on("tap", bind(_context3 = this._onTapOverlay).call(_context3, this));
|
6753 |
|
6754 | this._cleanupQueue.push(function () {
|
6755 | hammer.destroy();
|
6756 |
|
6757 | });
|
6758 |
|
6759 |
|
6760 | var events = ["tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend"];
|
6761 |
|
6762 | forEach$2(events).call(events, function (event) {
|
6763 | hammer.on(event, function (event) {
|
6764 | event.srcEvent.stopPropagation();
|
6765 | });
|
6766 | });
|
6767 |
|
6768 |
|
6769 | if (document && document.body) {
|
6770 | this._onClick = function (event) {
|
6771 | if (!_hasParent(event.target, container)) {
|
6772 | _this.deactivate();
|
6773 | }
|
6774 | };
|
6775 |
|
6776 | document.body.addEventListener("click", this._onClick);
|
6777 |
|
6778 | this._cleanupQueue.push(function () {
|
6779 | document.body.removeEventListener("click", _this._onClick);
|
6780 | });
|
6781 | }
|
6782 |
|
6783 |
|
6784 | this._escListener = function (event) {
|
6785 | if ("key" in event ? event.key === "Escape" : event.keyCode === 27
|
6786 |
|
6787 | ) {
|
6788 | _this.deactivate();
|
6789 | }
|
6790 | };
|
6791 | }
|
6792 |
|
6793 |
|
6794 | componentEmitter(Activator.prototype);
|
6795 |
|
6796 | Activator.current = null;
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 | Activator.prototype.destroy = function () {
|
6802 | var _context4, _context5;
|
6803 |
|
6804 | this.deactivate();
|
6805 |
|
6806 | var _iterator2 = _createForOfIteratorHelper$1(reverse(_context4 = splice(_context5 = this._cleanupQueue).call(_context5, 0)).call(_context4)),
|
6807 | _step2;
|
6808 |
|
6809 | try {
|
6810 | for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
6811 | var callback = _step2.value;
|
6812 | callback();
|
6813 | }
|
6814 | } catch (err) {
|
6815 | _iterator2.e(err);
|
6816 | } finally {
|
6817 | _iterator2.f();
|
6818 | }
|
6819 | };
|
6820 |
|
6821 |
|
6822 |
|
6823 |
|
6824 |
|
6825 |
|
6826 | Activator.prototype.activate = function () {
|
6827 |
|
6828 | if (Activator.current) {
|
6829 | Activator.current.deactivate();
|
6830 | }
|
6831 |
|
6832 | Activator.current = this;
|
6833 | this.active = true;
|
6834 | this._dom.overlay.style.display = "none";
|
6835 |
|
6836 | this._dom.container.classList.add("vis-active");
|
6837 |
|
6838 | this.emit("change");
|
6839 | this.emit("activate");
|
6840 |
|
6841 |
|
6842 | document.body.addEventListener("keydown", this._escListener);
|
6843 | };
|
6844 |
|
6845 |
|
6846 |
|
6847 |
|
6848 |
|
6849 |
|
6850 | Activator.prototype.deactivate = function () {
|
6851 | this.active = false;
|
6852 | this._dom.overlay.style.display = "block";
|
6853 |
|
6854 | this._dom.container.classList.remove("vis-active");
|
6855 |
|
6856 | document.body.removeEventListener("keydown", this._escListener);
|
6857 | this.emit("change");
|
6858 | this.emit("deactivate");
|
6859 | };
|
6860 |
|
6861 |
|
6862 |
|
6863 |
|
6864 |
|
6865 |
|
6866 |
|
6867 |
|
6868 | Activator.prototype._onTapOverlay = function (event) {
|
6869 |
|
6870 | this.activate();
|
6871 | event.srcEvent.stopPropagation();
|
6872 | };
|
6873 |
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 |
|
6881 |
|
6882 |
|
6883 |
|
6884 |
|
6885 | function _hasParent(element, parent) {
|
6886 | while (element) {
|
6887 | if (element === parent) {
|
6888 | return true;
|
6889 | }
|
6890 |
|
6891 | element = element.parentNode;
|
6892 | }
|
6893 |
|
6894 | return false;
|
6895 | }
|
6896 |
|
6897 |
|
6898 |
|
6899 |
|
6900 |
|
6901 | var ASPDateRegex = /^\/?Date\((-?\d+)/i;
|
6902 |
|
6903 | var fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
|
6904 | var shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
6905 | var 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;
|
6906 | var 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;
|
6907 |
|
6908 |
|
6909 |
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 |
|
6915 | function isNumber(value) {
|
6916 | return value instanceof Number || typeof value === "number";
|
6917 | }
|
6918 |
|
6919 |
|
6920 |
|
6921 |
|
6922 |
|
6923 |
|
6924 |
|
6925 | function recursiveDOMDelete(DOMobject) {
|
6926 | if (DOMobject) {
|
6927 | while (DOMobject.hasChildNodes() === true) {
|
6928 | var child = DOMobject.firstChild;
|
6929 |
|
6930 | if (child) {
|
6931 | recursiveDOMDelete(child);
|
6932 | DOMobject.removeChild(child);
|
6933 | }
|
6934 | }
|
6935 | }
|
6936 | }
|
6937 |
|
6938 |
|
6939 |
|
6940 |
|
6941 |
|
6942 |
|
6943 |
|
6944 |
|
6945 |
|
6946 | function isString(value) {
|
6947 | return value instanceof String || typeof value === "string";
|
6948 | }
|
6949 |
|
6950 |
|
6951 |
|
6952 |
|
6953 |
|
6954 |
|
6955 |
|
6956 |
|
6957 |
|
6958 | function isObject(value) {
|
6959 | return _typeof(value) === "object" && value !== null;
|
6960 | }
|
6961 |
|
6962 |
|
6963 |
|
6964 |
|
6965 |
|
6966 |
|
6967 |
|
6968 |
|
6969 |
|
6970 | function isDate(value) {
|
6971 | if (value instanceof Date) {
|
6972 | return true;
|
6973 | } else if (isString(value)) {
|
6974 |
|
6975 | var match = ASPDateRegex.exec(value);
|
6976 |
|
6977 | if (match) {
|
6978 | return true;
|
6979 | } else if (!isNaN(Date.parse(value))) {
|
6980 | return true;
|
6981 | }
|
6982 | }
|
6983 |
|
6984 | return false;
|
6985 | }
|
6986 |
|
6987 |
|
6988 |
|
6989 |
|
6990 |
|
6991 |
|
6992 |
|
6993 |
|
6994 |
|
6995 |
|
6996 |
|
6997 |
|
6998 |
|
6999 | function copyOrDelete(a, b, prop, allowDeletion) {
|
7000 | var doDeletion = false;
|
7001 |
|
7002 | if (allowDeletion === true) {
|
7003 | doDeletion = b[prop] === null && a[prop] !== undefined;
|
7004 | }
|
7005 |
|
7006 | if (doDeletion) {
|
7007 | delete a[prop];
|
7008 | } else {
|
7009 | a[prop] = b[prop];
|
7010 | }
|
7011 | }
|
7012 |
|
7013 |
|
7014 |
|
7015 |
|
7016 |
|
7017 |
|
7018 |
|
7019 |
|
7020 |
|
7021 |
|
7022 |
|
7023 |
|
7024 | function fillIfDefined(a, b) {
|
7025 | var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7026 |
|
7027 |
|
7028 |
|
7029 | for (var prop in a) {
|
7030 | if (b[prop] !== undefined) {
|
7031 | if (b[prop] === null || _typeof(b[prop]) !== "object") {
|
7032 |
|
7033 | copyOrDelete(a, b, prop, allowDeletion);
|
7034 | } else {
|
7035 | var aProp = a[prop];
|
7036 | var bProp = b[prop];
|
7037 |
|
7038 | if (isObject(aProp) && isObject(bProp)) {
|
7039 | fillIfDefined(aProp, bProp, allowDeletion);
|
7040 | }
|
7041 | }
|
7042 | }
|
7043 | }
|
7044 | }
|
7045 |
|
7046 |
|
7047 |
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 |
|
7054 |
|
7055 |
|
7056 | var extend = assign$2;
|
7057 |
|
7058 |
|
7059 |
|
7060 |
|
7061 |
|
7062 |
|
7063 |
|
7064 |
|
7065 |
|
7066 |
|
7067 |
|
7068 |
|
7069 |
|
7070 | function selectiveExtend(props, a) {
|
7071 | if (!isArray(props)) {
|
7072 | throw new Error("Array with property names expected as first argument");
|
7073 | }
|
7074 |
|
7075 | for (var _len4 = arguments.length, others = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
7076 | others[_key4 - 2] = arguments[_key4];
|
7077 | }
|
7078 |
|
7079 | for (var _i2 = 0, _others = others; _i2 < _others.length; _i2++) {
|
7080 | var other = _others[_i2];
|
7081 |
|
7082 | for (var p = 0; p < props.length; p++) {
|
7083 | var prop = props[p];
|
7084 |
|
7085 | if (other && Object.prototype.hasOwnProperty.call(other, prop)) {
|
7086 | a[prop] = other[prop];
|
7087 | }
|
7088 | }
|
7089 | }
|
7090 |
|
7091 | return a;
|
7092 | }
|
7093 |
|
7094 |
|
7095 |
|
7096 |
|
7097 |
|
7098 |
|
7099 |
|
7100 |
|
7101 |
|
7102 |
|
7103 |
|
7104 |
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 |
|
7110 |
|
7111 | function selectiveDeepExtend(props, a, b) {
|
7112 | var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7113 |
|
7114 |
|
7115 | if (isArray(b)) {
|
7116 | throw new TypeError("Arrays are not supported by deepExtend");
|
7117 | }
|
7118 |
|
7119 | for (var p = 0; p < props.length; p++) {
|
7120 | var prop = props[p];
|
7121 |
|
7122 | if (Object.prototype.hasOwnProperty.call(b, prop)) {
|
7123 | if (b[prop] && b[prop].constructor === Object) {
|
7124 | if (a[prop] === undefined) {
|
7125 | a[prop] = {};
|
7126 | }
|
7127 |
|
7128 | if (a[prop].constructor === Object) {
|
7129 | deepExtend(a[prop], b[prop], false, allowDeletion);
|
7130 | } else {
|
7131 | copyOrDelete(a, b, prop, allowDeletion);
|
7132 | }
|
7133 | } else if (isArray(b[prop])) {
|
7134 | throw new TypeError("Arrays are not supported by deepExtend");
|
7135 | } else {
|
7136 | copyOrDelete(a, b, prop, allowDeletion);
|
7137 | }
|
7138 | }
|
7139 | }
|
7140 |
|
7141 | return a;
|
7142 | }
|
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 |
|
7148 |
|
7149 |
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 |
|
7161 |
|
7162 | function selectiveNotDeepExtend(propsToExclude, a, b) {
|
7163 | var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7164 |
|
7165 |
|
7166 |
|
7167 | if (isArray(b)) {
|
7168 | throw new TypeError("Arrays are not supported by deepExtend");
|
7169 | }
|
7170 |
|
7171 | for (var prop in b) {
|
7172 | if (!Object.prototype.hasOwnProperty.call(b, prop)) {
|
7173 | continue;
|
7174 | }
|
7175 |
|
7176 |
|
7177 | if (includes(propsToExclude).call(propsToExclude, prop)) {
|
7178 | continue;
|
7179 | }
|
7180 |
|
7181 |
|
7182 | if (b[prop] && b[prop].constructor === Object) {
|
7183 | if (a[prop] === undefined) {
|
7184 | a[prop] = {};
|
7185 | }
|
7186 |
|
7187 | if (a[prop].constructor === Object) {
|
7188 | deepExtend(a[prop], b[prop]);
|
7189 | } else {
|
7190 | copyOrDelete(a, b, prop, allowDeletion);
|
7191 | }
|
7192 | } else if (isArray(b[prop])) {
|
7193 | a[prop] = [];
|
7194 |
|
7195 | for (var i = 0; i < b[prop].length; i++) {
|
7196 | a[prop].push(b[prop][i]);
|
7197 | }
|
7198 | } else {
|
7199 | copyOrDelete(a, b, prop, allowDeletion);
|
7200 | }
|
7201 | }
|
7202 |
|
7203 | return a;
|
7204 | }
|
7205 |
|
7206 |
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 |
|
7217 |
|
7218 |
|
7219 | function deepExtend(a, b) {
|
7220 | var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7221 | var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7222 |
|
7223 | for (var prop in b) {
|
7224 | if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
|
7225 | if (_typeof(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$3(b[prop]) === Object.prototype) {
|
7226 | if (a[prop] === undefined) {
|
7227 | a[prop] = deepExtend({}, b[prop], protoExtend);
|
7228 | } else if (_typeof(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$3(a[prop]) === Object.prototype) {
|
7229 | deepExtend(a[prop], b[prop], protoExtend);
|
7230 | } else {
|
7231 | copyOrDelete(a, b, prop, allowDeletion);
|
7232 | }
|
7233 | } else if (isArray(b[prop])) {
|
7234 | var _context6;
|
7235 |
|
7236 | a[prop] = slice$2(_context6 = b[prop]).call(_context6);
|
7237 | } else {
|
7238 | copyOrDelete(a, b, prop, allowDeletion);
|
7239 | }
|
7240 | }
|
7241 | }
|
7242 |
|
7243 | return a;
|
7244 | }
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 | function equalArray(a, b) {
|
7256 | if (a.length !== b.length) {
|
7257 | return false;
|
7258 | }
|
7259 |
|
7260 | for (var i = 0, len = a.length; i < len; i++) {
|
7261 | if (a[i] != b[i]) {
|
7262 | return false;
|
7263 | }
|
7264 | }
|
7265 |
|
7266 | return true;
|
7267 | }
|
7268 |
|
7269 |
|
7270 |
|
7271 |
|
7272 |
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 | function getType(object) {
|
7278 | var type = _typeof(object);
|
7279 |
|
7280 | if (type === "object") {
|
7281 | if (object === null) {
|
7282 | return "null";
|
7283 | }
|
7284 |
|
7285 | if (object instanceof Boolean) {
|
7286 | return "Boolean";
|
7287 | }
|
7288 |
|
7289 | if (object instanceof Number) {
|
7290 | return "Number";
|
7291 | }
|
7292 |
|
7293 | if (object instanceof String) {
|
7294 | return "String";
|
7295 | }
|
7296 |
|
7297 | if (isArray(object)) {
|
7298 | return "Array";
|
7299 | }
|
7300 |
|
7301 | if (object instanceof Date) {
|
7302 | return "Date";
|
7303 | }
|
7304 |
|
7305 | return "Object";
|
7306 | }
|
7307 |
|
7308 | if (type === "number") {
|
7309 | return "Number";
|
7310 | }
|
7311 |
|
7312 | if (type === "boolean") {
|
7313 | return "Boolean";
|
7314 | }
|
7315 |
|
7316 | if (type === "string") {
|
7317 | return "String";
|
7318 | }
|
7319 |
|
7320 | if (type === undefined) {
|
7321 | return "undefined";
|
7322 | }
|
7323 |
|
7324 | return type;
|
7325 | }
|
7326 |
|
7327 |
|
7328 |
|
7329 |
|
7330 |
|
7331 |
|
7332 |
|
7333 |
|
7334 |
|
7335 |
|
7336 | function copyAndExtendArray(arr, newValue) {
|
7337 | var _context7;
|
7338 |
|
7339 | return concat(_context7 = []).call(_context7, _toConsumableArray(arr), [newValue]);
|
7340 | }
|
7341 |
|
7342 |
|
7343 |
|
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 |
|
7349 |
|
7350 | function copyArray(arr) {
|
7351 | return slice$2(arr).call(arr);
|
7352 | }
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 |
|
7362 | function getAbsoluteLeft(elem) {
|
7363 | return elem.getBoundingClientRect().left;
|
7364 | }
|
7365 |
|
7366 |
|
7367 |
|
7368 |
|
7369 |
|
7370 |
|
7371 |
|
7372 |
|
7373 |
|
7374 | function getAbsoluteRight(elem) {
|
7375 | return elem.getBoundingClientRect().right;
|
7376 | }
|
7377 |
|
7378 |
|
7379 |
|
7380 |
|
7381 |
|
7382 |
|
7383 |
|
7384 |
|
7385 |
|
7386 | function getAbsoluteTop(elem) {
|
7387 | return elem.getBoundingClientRect().top;
|
7388 | }
|
7389 |
|
7390 |
|
7391 |
|
7392 |
|
7393 |
|
7394 |
|
7395 |
|
7396 |
|
7397 | function addClassName(elem, classNames) {
|
7398 | var classes = elem.className.split(" ");
|
7399 | var newClasses = classNames.split(" ");
|
7400 | classes = concat(classes).call(classes, filter(newClasses).call(newClasses, function (className) {
|
7401 | return !includes(classes).call(classes, className);
|
7402 | }));
|
7403 | elem.className = classes.join(" ");
|
7404 | }
|
7405 |
|
7406 |
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 |
|
7413 | function removeClassName(elem, classNames) {
|
7414 | var classes = elem.className.split(" ");
|
7415 | var oldClasses = classNames.split(" ");
|
7416 | classes = filter(classes).call(classes, function (className) {
|
7417 | return !includes(oldClasses).call(oldClasses, className);
|
7418 | });
|
7419 | elem.className = classes.join(" ");
|
7420 | }
|
7421 |
|
7422 |
|
7423 |
|
7424 |
|
7425 |
|
7426 |
|
7427 |
|
7428 |
|
7429 |
|
7430 |
|
7431 | function forEach$1(object, callback) {
|
7432 | if (isArray(object)) {
|
7433 |
|
7434 | var len = object.length;
|
7435 |
|
7436 | for (var i = 0; i < len; i++) {
|
7437 | callback(object[i], i, object);
|
7438 | }
|
7439 | } else {
|
7440 |
|
7441 | for (var key in object) {
|
7442 | if (Object.prototype.hasOwnProperty.call(object, key)) {
|
7443 | callback(object[key], key, object);
|
7444 | }
|
7445 | }
|
7446 | }
|
7447 | }
|
7448 |
|
7449 |
|
7450 |
|
7451 |
|
7452 |
|
7453 |
|
7454 |
|
7455 |
|
7456 |
|
7457 | var toArray = values$3;
|
7458 |
|
7459 |
|
7460 |
|
7461 |
|
7462 |
|
7463 |
|
7464 |
|
7465 |
|
7466 |
|
7467 |
|
7468 | function updateProperty(object, key, value) {
|
7469 | if (object[key] !== value) {
|
7470 | object[key] = value;
|
7471 | return true;
|
7472 | } else {
|
7473 | return false;
|
7474 | }
|
7475 | }
|
7476 |
|
7477 |
|
7478 |
|
7479 |
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 |
|
7485 | function throttle(fn) {
|
7486 | var scheduled = false;
|
7487 | return function () {
|
7488 | if (!scheduled) {
|
7489 | scheduled = true;
|
7490 | requestAnimationFrame(function () {
|
7491 | scheduled = false;
|
7492 | fn();
|
7493 | });
|
7494 | }
|
7495 | };
|
7496 | }
|
7497 |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 |
|
7503 |
|
7504 |
|
7505 |
|
7506 |
|
7507 | function addEventListener(element, action, listener, useCapture) {
|
7508 | if (element.addEventListener) {
|
7509 | var _context8;
|
7510 |
|
7511 | if (useCapture === undefined) {
|
7512 | useCapture = false;
|
7513 | }
|
7514 |
|
7515 | if (action === "mousewheel" && includes(_context8 = navigator.userAgent).call(_context8, "Firefox")) {
|
7516 | action = "DOMMouseScroll";
|
7517 | }
|
7518 |
|
7519 | element.addEventListener(action, listener, useCapture);
|
7520 | } else {
|
7521 |
|
7522 | element.attachEvent("on" + action, listener);
|
7523 | }
|
7524 | }
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 |
|
7533 |
|
7534 |
|
7535 | function removeEventListener(element, action, listener, useCapture) {
|
7536 | if (element.removeEventListener) {
|
7537 | var _context9;
|
7538 |
|
7539 |
|
7540 | if (useCapture === undefined) {
|
7541 | useCapture = false;
|
7542 | }
|
7543 |
|
7544 | if (action === "mousewheel" && includes(_context9 = navigator.userAgent).call(_context9, "Firefox")) {
|
7545 | action = "DOMMouseScroll";
|
7546 | }
|
7547 |
|
7548 | element.removeEventListener(action, listener, useCapture);
|
7549 | } else {
|
7550 |
|
7551 | element.detachEvent("on" + action, listener);
|
7552 | }
|
7553 | }
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 | function preventDefault(event) {
|
7562 | if (!event) {
|
7563 | event = window.event;
|
7564 | }
|
7565 |
|
7566 | if (!event) ;else if (event.preventDefault) {
|
7567 | event.preventDefault();
|
7568 | } else {
|
7569 |
|
7570 | event.returnValue = false;
|
7571 | }
|
7572 | }
|
7573 |
|
7574 |
|
7575 |
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 | function getTarget() {
|
7583 | var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
|
7584 |
|
7585 |
|
7586 | var target = null;
|
7587 | if (!event) ;else if (event.target) {
|
7588 | target = event.target;
|
7589 | } else if (event.srcElement) {
|
7590 | target = event.srcElement;
|
7591 | }
|
7592 |
|
7593 | if (!(target instanceof Element)) {
|
7594 | return null;
|
7595 | }
|
7596 |
|
7597 | if (target.nodeType != null && target.nodeType == 3) {
|
7598 |
|
7599 | target = target.parentNode;
|
7600 |
|
7601 | if (!(target instanceof Element)) {
|
7602 | return null;
|
7603 | }
|
7604 | }
|
7605 |
|
7606 | return target;
|
7607 | }
|
7608 |
|
7609 |
|
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 |
|
7615 |
|
7616 |
|
7617 |
|
7618 | function hasParent(element, parent) {
|
7619 | var elem = element;
|
7620 |
|
7621 | while (elem) {
|
7622 | if (elem === parent) {
|
7623 | return true;
|
7624 | } else if (elem.parentNode) {
|
7625 | elem = elem.parentNode;
|
7626 | } else {
|
7627 | return false;
|
7628 | }
|
7629 | }
|
7630 |
|
7631 | return false;
|
7632 | }
|
7633 |
|
7634 | var option = {
|
7635 | |
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 | asBoolean: function asBoolean(value, defaultValue) {
|
7644 | if (typeof value == "function") {
|
7645 | value = value();
|
7646 | }
|
7647 |
|
7648 | if (value != null) {
|
7649 | return value != false;
|
7650 | }
|
7651 |
|
7652 | return defaultValue || null;
|
7653 | },
|
7654 |
|
7655 | |
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 | asNumber: function asNumber(value, defaultValue) {
|
7664 | if (typeof value == "function") {
|
7665 | value = value();
|
7666 | }
|
7667 |
|
7668 | if (value != null) {
|
7669 | return Number(value) || defaultValue || null;
|
7670 | }
|
7671 |
|
7672 | return defaultValue || null;
|
7673 | },
|
7674 |
|
7675 | |
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 |
|
7682 |
|
7683 | asString: function asString(value, defaultValue) {
|
7684 | if (typeof value == "function") {
|
7685 | value = value();
|
7686 | }
|
7687 |
|
7688 | if (value != null) {
|
7689 | return String(value);
|
7690 | }
|
7691 |
|
7692 | return defaultValue || null;
|
7693 | },
|
7694 |
|
7695 | |
7696 |
|
7697 |
|
7698 |
|
7699 |
|
7700 |
|
7701 |
|
7702 |
|
7703 | asSize: function asSize(value, defaultValue) {
|
7704 | if (typeof value == "function") {
|
7705 | value = value();
|
7706 | }
|
7707 |
|
7708 | if (isString(value)) {
|
7709 | return value;
|
7710 | } else if (isNumber(value)) {
|
7711 | return value + "px";
|
7712 | } else {
|
7713 | return defaultValue || null;
|
7714 | }
|
7715 | },
|
7716 |
|
7717 | |
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 |
|
7724 |
|
7725 | asElement: function asElement(value, defaultValue) {
|
7726 | if (typeof value == "function") {
|
7727 | value = value();
|
7728 | }
|
7729 |
|
7730 | return value || defaultValue || null;
|
7731 | }
|
7732 | };
|
7733 |
|
7734 |
|
7735 |
|
7736 |
|
7737 |
|
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 | function hexToRGB(hex) {
|
7745 | var result;
|
7746 |
|
7747 | switch (hex.length) {
|
7748 | case 3:
|
7749 | case 4:
|
7750 | result = shortHexRE.exec(hex);
|
7751 | return result ? {
|
7752 | r: _parseInt(result[1] + result[1], 16),
|
7753 | g: _parseInt(result[2] + result[2], 16),
|
7754 | b: _parseInt(result[3] + result[3], 16)
|
7755 | } : null;
|
7756 |
|
7757 | case 6:
|
7758 | case 7:
|
7759 | result = fullHexRE.exec(hex);
|
7760 | return result ? {
|
7761 | r: _parseInt(result[1], 16),
|
7762 | g: _parseInt(result[2], 16),
|
7763 | b: _parseInt(result[3], 16)
|
7764 | } : null;
|
7765 |
|
7766 | default:
|
7767 | return null;
|
7768 | }
|
7769 | }
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 | function overrideOpacity(color, opacity) {
|
7781 | if (includes(color).call(color, "rgba")) {
|
7782 | return color;
|
7783 | } else if (includes(color).call(color, "rgb")) {
|
7784 | var rgb = color.substr(indexOf(color).call(color, "(") + 1).replace(")", "").split(",");
|
7785 | return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")";
|
7786 | } else {
|
7787 | var _rgb = hexToRGB(color);
|
7788 |
|
7789 | if (_rgb == null) {
|
7790 | return color;
|
7791 | } else {
|
7792 | return "rgba(" + _rgb.r + "," + _rgb.g + "," + _rgb.b + "," + opacity + ")";
|
7793 | }
|
7794 | }
|
7795 | }
|
7796 |
|
7797 |
|
7798 |
|
7799 |
|
7800 |
|
7801 |
|
7802 |
|
7803 |
|
7804 |
|
7805 |
|
7806 |
|
7807 | function RGBToHex(red, green, blue) {
|
7808 | var _context10;
|
7809 |
|
7810 | return "#" + slice$2(_context10 = ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16)).call(_context10, 1);
|
7811 | }
|
7812 |
|
7813 |
|
7814 |
|
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 |
|
7821 |
|
7822 | function parseColor(inputColor, defaultColor) {
|
7823 | if (isString(inputColor)) {
|
7824 | var colorStr = inputColor;
|
7825 |
|
7826 | if (isValidRGB(colorStr)) {
|
7827 | var _context11;
|
7828 |
|
7829 | var rgb = map$3(_context11 = colorStr.substr(4).substr(0, colorStr.length - 5).split(",")).call(_context11, function (value) {
|
7830 | return _parseInt(value);
|
7831 | });
|
7832 |
|
7833 | colorStr = RGBToHex(rgb[0], rgb[1], rgb[2]);
|
7834 | }
|
7835 |
|
7836 | if (isValidHex(colorStr) === true) {
|
7837 | var hsv = hexToHSV(colorStr);
|
7838 | var lighterColorHSV = {
|
7839 | h: hsv.h,
|
7840 | s: hsv.s * 0.8,
|
7841 | v: Math.min(1, hsv.v * 1.02)
|
7842 | };
|
7843 | var darkerColorHSV = {
|
7844 | h: hsv.h,
|
7845 | s: Math.min(1, hsv.s * 1.25),
|
7846 | v: hsv.v * 0.8
|
7847 | };
|
7848 | var darkerColorHex = HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v);
|
7849 | var lighterColorHex = HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v);
|
7850 | return {
|
7851 | background: colorStr,
|
7852 | border: darkerColorHex,
|
7853 | highlight: {
|
7854 | background: lighterColorHex,
|
7855 | border: darkerColorHex
|
7856 | },
|
7857 | hover: {
|
7858 | background: lighterColorHex,
|
7859 | border: darkerColorHex
|
7860 | }
|
7861 | };
|
7862 | } else {
|
7863 | return {
|
7864 | background: colorStr,
|
7865 | border: colorStr,
|
7866 | highlight: {
|
7867 | background: colorStr,
|
7868 | border: colorStr
|
7869 | },
|
7870 | hover: {
|
7871 | background: colorStr,
|
7872 | border: colorStr
|
7873 | }
|
7874 | };
|
7875 | }
|
7876 | } else {
|
7877 | if (defaultColor) {
|
7878 | var color = {
|
7879 | background: inputColor.background || defaultColor.background,
|
7880 | border: inputColor.border || defaultColor.border,
|
7881 | highlight: isString(inputColor.highlight) ? {
|
7882 | border: inputColor.highlight,
|
7883 | background: inputColor.highlight
|
7884 | } : {
|
7885 | background: inputColor.highlight && inputColor.highlight.background || defaultColor.highlight.background,
|
7886 | border: inputColor.highlight && inputColor.highlight.border || defaultColor.highlight.border
|
7887 | },
|
7888 | hover: isString(inputColor.hover) ? {
|
7889 | border: inputColor.hover,
|
7890 | background: inputColor.hover
|
7891 | } : {
|
7892 | border: inputColor.hover && inputColor.hover.border || defaultColor.hover.border,
|
7893 | background: inputColor.hover && inputColor.hover.background || defaultColor.hover.background
|
7894 | }
|
7895 | };
|
7896 | return color;
|
7897 | } else {
|
7898 | var _color = {
|
7899 | background: inputColor.background || undefined,
|
7900 | border: inputColor.border || undefined,
|
7901 | highlight: isString(inputColor.highlight) ? {
|
7902 | border: inputColor.highlight,
|
7903 | background: inputColor.highlight
|
7904 | } : {
|
7905 | background: inputColor.highlight && inputColor.highlight.background || undefined,
|
7906 | border: inputColor.highlight && inputColor.highlight.border || undefined
|
7907 | },
|
7908 | hover: isString(inputColor.hover) ? {
|
7909 | border: inputColor.hover,
|
7910 | background: inputColor.hover
|
7911 | } : {
|
7912 | border: inputColor.hover && inputColor.hover.border || undefined,
|
7913 | background: inputColor.hover && inputColor.hover.background || undefined
|
7914 | }
|
7915 | };
|
7916 | return _color;
|
7917 | }
|
7918 | }
|
7919 | }
|
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 | function RGBToHSV(red, green, blue) {
|
7935 | red = red / 255;
|
7936 | green = green / 255;
|
7937 | blue = blue / 255;
|
7938 | var minRGB = Math.min(red, Math.min(green, blue));
|
7939 | var maxRGB = Math.max(red, Math.max(green, blue));
|
7940 |
|
7941 | if (minRGB === maxRGB) {
|
7942 | return {
|
7943 | h: 0,
|
7944 | s: 0,
|
7945 | v: minRGB
|
7946 | };
|
7947 | }
|
7948 |
|
7949 |
|
7950 | var d = red === minRGB ? green - blue : blue === minRGB ? red - green : blue - red;
|
7951 | var h = red === minRGB ? 3 : blue === minRGB ? 1 : 5;
|
7952 | var hue = 60 * (h - d / (maxRGB - minRGB)) / 360;
|
7953 | var saturation = (maxRGB - minRGB) / maxRGB;
|
7954 | var value = maxRGB;
|
7955 | return {
|
7956 | h: hue,
|
7957 | s: saturation,
|
7958 | v: value
|
7959 | };
|
7960 | }
|
7961 |
|
7962 | var cssUtil = {
|
7963 |
|
7964 | split: function split(cssText) {
|
7965 | var _context12;
|
7966 |
|
7967 | var styles = {};
|
7968 |
|
7969 | forEach$2(_context12 = cssText.split(";")).call(_context12, function (style) {
|
7970 | if (trim$1(style).call(style) != "") {
|
7971 | var _context13, _context14;
|
7972 |
|
7973 | var parts = style.split(":");
|
7974 |
|
7975 | var key = trim$1(_context13 = parts[0]).call(_context13);
|
7976 |
|
7977 | var value = trim$1(_context14 = parts[1]).call(_context14);
|
7978 |
|
7979 | styles[key] = value;
|
7980 | }
|
7981 | });
|
7982 |
|
7983 | return styles;
|
7984 | },
|
7985 |
|
7986 | join: function join(styles) {
|
7987 | var _context15;
|
7988 |
|
7989 | return map$3(_context15 = keys$3(styles)).call(_context15, function (key) {
|
7990 | return key + ": " + styles[key];
|
7991 | }).join("; ");
|
7992 | }
|
7993 | };
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 |
|
7999 |
|
8000 |
|
8001 | function addCssText(element, cssText) {
|
8002 | var currentStyles = cssUtil.split(element.style.cssText);
|
8003 | var newStyles = cssUtil.split(cssText);
|
8004 |
|
8005 | var styles = _objectSpread$1(_objectSpread$1({}, currentStyles), newStyles);
|
8006 |
|
8007 | element.style.cssText = cssUtil.join(styles);
|
8008 | }
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 | function removeCssText(element, cssText) {
|
8018 | var styles = cssUtil.split(element.style.cssText);
|
8019 | var removeStyles = cssUtil.split(cssText);
|
8020 |
|
8021 | for (var key in removeStyles) {
|
8022 | if (Object.prototype.hasOwnProperty.call(removeStyles, key)) {
|
8023 | delete styles[key];
|
8024 | }
|
8025 | }
|
8026 |
|
8027 | element.style.cssText = cssUtil.join(styles);
|
8028 | }
|
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 | function HSVToRGB(h, s, v) {
|
8044 | var r;
|
8045 | var g;
|
8046 | var b;
|
8047 | var i = Math.floor(h * 6);
|
8048 | var f = h * 6 - i;
|
8049 | var p = v * (1 - s);
|
8050 | var q = v * (1 - f * s);
|
8051 | var t = v * (1 - (1 - f) * s);
|
8052 |
|
8053 | switch (i % 6) {
|
8054 | case 0:
|
8055 | r = v, g = t, b = p;
|
8056 | break;
|
8057 |
|
8058 | case 1:
|
8059 | r = q, g = v, b = p;
|
8060 | break;
|
8061 |
|
8062 | case 2:
|
8063 | r = p, g = v, b = t;
|
8064 | break;
|
8065 |
|
8066 | case 3:
|
8067 | r = p, g = q, b = v;
|
8068 | break;
|
8069 |
|
8070 | case 4:
|
8071 | r = t, g = p, b = v;
|
8072 | break;
|
8073 |
|
8074 | case 5:
|
8075 | r = v, g = p, b = q;
|
8076 | break;
|
8077 | }
|
8078 |
|
8079 | return {
|
8080 | r: Math.floor(r * 255),
|
8081 | g: Math.floor(g * 255),
|
8082 | b: Math.floor(b * 255)
|
8083 | };
|
8084 | }
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 |
|
8095 |
|
8096 | function HSVToHex(h, s, v) {
|
8097 | var rgb = HSVToRGB(h, s, v);
|
8098 | return RGBToHex(rgb.r, rgb.g, rgb.b);
|
8099 | }
|
8100 |
|
8101 |
|
8102 |
|
8103 |
|
8104 |
|
8105 |
|
8106 |
|
8107 |
|
8108 |
|
8109 | function hexToHSV(hex) {
|
8110 | var rgb = hexToRGB(hex);
|
8111 |
|
8112 | if (!rgb) {
|
8113 | throw new TypeError("'".concat(hex, "' is not a valid color."));
|
8114 | }
|
8115 |
|
8116 | return RGBToHSV(rgb.r, rgb.g, rgb.b);
|
8117 | }
|
8118 |
|
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 | function isValidHex(hex) {
|
8128 | var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
|
8129 | return isOk;
|
8130 | }
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 | function isValidRGB(rgb) {
|
8141 | return rgbRE.test(rgb);
|
8142 | }
|
8143 |
|
8144 |
|
8145 |
|
8146 |
|
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 | function isValidRGBA(rgba) {
|
8153 | return rgbaRE.test(rgba);
|
8154 | }
|
8155 |
|
8156 |
|
8157 |
|
8158 |
|
8159 |
|
8160 |
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 | function selectiveBridgeObject(fields, referenceObject) {
|
8167 | if (referenceObject !== null && _typeof(referenceObject) === "object") {
|
8168 |
|
8169 | var objectTo = create$2(referenceObject);
|
8170 |
|
8171 | for (var i = 0; i < fields.length; i++) {
|
8172 | if (Object.prototype.hasOwnProperty.call(referenceObject, fields[i])) {
|
8173 | if (_typeof(referenceObject[fields[i]]) == "object") {
|
8174 | objectTo[fields[i]] = bridgeObject(referenceObject[fields[i]]);
|
8175 | }
|
8176 | }
|
8177 | }
|
8178 |
|
8179 | return objectTo;
|
8180 | } else {
|
8181 | return null;
|
8182 | }
|
8183 | }
|
8184 |
|
8185 |
|
8186 |
|
8187 |
|
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 |
|
8193 |
|
8194 | function bridgeObject(referenceObject) {
|
8195 | if (referenceObject === null || _typeof(referenceObject) !== "object") {
|
8196 | return null;
|
8197 | }
|
8198 |
|
8199 | if (referenceObject instanceof Element) {
|
8200 |
|
8201 | return referenceObject;
|
8202 | }
|
8203 |
|
8204 | var objectTo = create$2(referenceObject);
|
8205 |
|
8206 | for (var i in referenceObject) {
|
8207 | if (Object.prototype.hasOwnProperty.call(referenceObject, i)) {
|
8208 | if (_typeof(referenceObject[i]) == "object") {
|
8209 | objectTo[i] = bridgeObject(referenceObject[i]);
|
8210 | }
|
8211 | }
|
8212 | }
|
8213 |
|
8214 | return objectTo;
|
8215 | }
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 |
|
8225 |
|
8226 | function insertSort(a, compare) {
|
8227 | for (var i = 0; i < a.length; i++) {
|
8228 | var k = a[i];
|
8229 | var j = void 0;
|
8230 |
|
8231 | for (j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) {
|
8232 | a[j] = a[j - 1];
|
8233 | }
|
8234 |
|
8235 | a[j] = k;
|
8236 | }
|
8237 |
|
8238 | return a;
|
8239 | }
|
8240 |
|
8241 |
|
8242 |
|
8243 |
|
8244 |
|
8245 |
|
8246 |
|
8247 |
|
8248 |
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 | function mergeOptions(mergeTarget, options, option) {
|
8256 | var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
8257 |
|
8258 |
|
8259 | var isPresent = function isPresent(obj) {
|
8260 | return obj !== null && obj !== undefined;
|
8261 | };
|
8262 |
|
8263 | var isObject = function isObject(obj) {
|
8264 | return obj !== null && _typeof(obj) === "object";
|
8265 | };
|
8266 |
|
8267 |
|
8268 | var isEmpty = function isEmpty(obj) {
|
8269 | for (var x in obj) {
|
8270 | if (Object.prototype.hasOwnProperty.call(obj, x)) {
|
8271 | return false;
|
8272 | }
|
8273 | }
|
8274 |
|
8275 | return true;
|
8276 | };
|
8277 |
|
8278 |
|
8279 | if (!isObject(mergeTarget)) {
|
8280 | throw new Error("Parameter mergeTarget must be an object");
|
8281 | }
|
8282 |
|
8283 | if (!isObject(options)) {
|
8284 | throw new Error("Parameter options must be an object");
|
8285 | }
|
8286 |
|
8287 | if (!isPresent(option)) {
|
8288 | throw new Error("Parameter option must have a value");
|
8289 | }
|
8290 |
|
8291 | if (!isObject(globalOptions)) {
|
8292 | throw new Error("Parameter globalOptions must be an object");
|
8293 | }
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 |
|
8299 | var doMerge = function doMerge(target, options, option) {
|
8300 | if (!isObject(target[option])) {
|
8301 | target[option] = {};
|
8302 | }
|
8303 |
|
8304 | var src = options[option];
|
8305 | var dst = target[option];
|
8306 |
|
8307 | for (var prop in src) {
|
8308 | if (Object.prototype.hasOwnProperty.call(src, prop)) {
|
8309 | dst[prop] = src[prop];
|
8310 | }
|
8311 | }
|
8312 | };
|
8313 |
|
8314 |
|
8315 | var srcOption = options[option];
|
8316 | var globalPassed = isObject(globalOptions) && !isEmpty(globalOptions);
|
8317 | var globalOption = globalPassed ? globalOptions[option] : undefined;
|
8318 | var globalEnabled = globalOption ? globalOption.enabled : undefined;
|
8319 |
|
8320 |
|
8321 |
|
8322 | if (srcOption === undefined) {
|
8323 | return;
|
8324 | }
|
8325 |
|
8326 | if (typeof srcOption === "boolean") {
|
8327 | if (!isObject(mergeTarget[option])) {
|
8328 | mergeTarget[option] = {};
|
8329 | }
|
8330 |
|
8331 | mergeTarget[option].enabled = srcOption;
|
8332 | return;
|
8333 | }
|
8334 |
|
8335 | if (srcOption === null && !isObject(mergeTarget[option])) {
|
8336 |
|
8337 | if (isPresent(globalOption)) {
|
8338 | mergeTarget[option] = create$2(globalOption);
|
8339 | } else {
|
8340 | return;
|
8341 | }
|
8342 | }
|
8343 |
|
8344 | if (!isObject(srcOption)) {
|
8345 | return;
|
8346 | }
|
8347 |
|
8348 |
|
8349 |
|
8350 |
|
8351 |
|
8352 | var enabled = true;
|
8353 |
|
8354 | if (srcOption.enabled !== undefined) {
|
8355 | enabled = srcOption.enabled;
|
8356 | } else {
|
8357 |
|
8358 | if (globalEnabled !== undefined) {
|
8359 | enabled = globalOption.enabled;
|
8360 | }
|
8361 | }
|
8362 |
|
8363 | doMerge(mergeTarget, options, option);
|
8364 | mergeTarget[option].enabled = enabled;
|
8365 | }
|
8366 |
|
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 | function binarySearchCustom(orderedItems, comparator, field, field2) {
|
8380 | var maxIterations = 10000;
|
8381 | var iteration = 0;
|
8382 | var low = 0;
|
8383 | var high = orderedItems.length - 1;
|
8384 |
|
8385 | while (low <= high && iteration < maxIterations) {
|
8386 | var middle = Math.floor((low + high) / 2);
|
8387 | var item = orderedItems[middle];
|
8388 | var value = field2 === undefined ? item[field] : item[field][field2];
|
8389 | var searchResult = comparator(value);
|
8390 |
|
8391 | if (searchResult == 0) {
|
8392 |
|
8393 | return middle;
|
8394 | } else if (searchResult == -1) {
|
8395 |
|
8396 | low = middle + 1;
|
8397 | } else {
|
8398 |
|
8399 | high = middle - 1;
|
8400 | }
|
8401 |
|
8402 | iteration++;
|
8403 | }
|
8404 |
|
8405 | return -1;
|
8406 | }
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 |
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 | function binarySearchValue(orderedItems, target, field, sidePreference, comparator) {
|
8424 | var maxIterations = 10000;
|
8425 | var iteration = 0;
|
8426 | var low = 0;
|
8427 | var high = orderedItems.length - 1;
|
8428 | var prevValue;
|
8429 | var value;
|
8430 | var nextValue;
|
8431 | var middle;
|
8432 | comparator = comparator != undefined ? comparator : function (a, b) {
|
8433 | return a == b ? 0 : a < b ? -1 : 1;
|
8434 | };
|
8435 |
|
8436 | while (low <= high && iteration < maxIterations) {
|
8437 |
|
8438 | middle = Math.floor(0.5 * (high + low));
|
8439 | prevValue = orderedItems[Math.max(0, middle - 1)][field];
|
8440 | value = orderedItems[middle][field];
|
8441 | nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field];
|
8442 |
|
8443 | if (comparator(value, target) == 0) {
|
8444 |
|
8445 | return middle;
|
8446 | } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) {
|
8447 |
|
8448 | return sidePreference == "before" ? Math.max(0, middle - 1) : middle;
|
8449 | } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) {
|
8450 |
|
8451 | return sidePreference == "before" ? middle : Math.min(orderedItems.length - 1, middle + 1);
|
8452 | } else {
|
8453 |
|
8454 | if (comparator(value, target) < 0) {
|
8455 |
|
8456 | low = middle + 1;
|
8457 | } else {
|
8458 |
|
8459 | high = middle - 1;
|
8460 | }
|
8461 | }
|
8462 |
|
8463 | iteration++;
|
8464 | }
|
8465 |
|
8466 |
|
8467 | return -1;
|
8468 | }
|
8469 |
|
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 | var easingFunctions = {
|
8479 | |
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 | linear: function linear(t) {
|
8487 | return t;
|
8488 | },
|
8489 |
|
8490 | |
8491 |
|
8492 |
|
8493 |
|
8494 |
|
8495 |
|
8496 |
|
8497 | easeInQuad: function easeInQuad(t) {
|
8498 | return t * t;
|
8499 | },
|
8500 |
|
8501 | |
8502 |
|
8503 |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 | easeOutQuad: function easeOutQuad(t) {
|
8509 | return t * (2 - t);
|
8510 | },
|
8511 |
|
8512 | |
8513 |
|
8514 |
|
8515 |
|
8516 |
|
8517 |
|
8518 |
|
8519 | easeInOutQuad: function easeInOutQuad(t) {
|
8520 | return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
8521 | },
|
8522 |
|
8523 | |
8524 |
|
8525 |
|
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 | easeInCubic: function easeInCubic(t) {
|
8531 | return t * t * t;
|
8532 | },
|
8533 |
|
8534 | |
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 | easeOutCubic: function easeOutCubic(t) {
|
8542 | return --t * t * t + 1;
|
8543 | },
|
8544 |
|
8545 | |
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 | easeInOutCubic: function easeInOutCubic(t) {
|
8553 | return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
8554 | },
|
8555 |
|
8556 | |
8557 |
|
8558 |
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 | easeInQuart: function easeInQuart(t) {
|
8564 | return t * t * t * t;
|
8565 | },
|
8566 |
|
8567 | |
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 | easeOutQuart: function easeOutQuart(t) {
|
8575 | return 1 - --t * t * t * t;
|
8576 | },
|
8577 |
|
8578 | |
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 | easeInOutQuart: function easeInOutQuart(t) {
|
8586 | return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
|
8587 | },
|
8588 |
|
8589 | |
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 |
|
8596 | easeInQuint: function easeInQuint(t) {
|
8597 | return t * t * t * t * t;
|
8598 | },
|
8599 |
|
8600 | |
8601 |
|
8602 |
|
8603 |
|
8604 |
|
8605 |
|
8606 |
|
8607 | easeOutQuint: function easeOutQuint(t) {
|
8608 | return 1 + --t * t * t * t * t;
|
8609 | },
|
8610 |
|
8611 | |
8612 |
|
8613 |
|
8614 |
|
8615 |
|
8616 |
|
8617 |
|
8618 | easeInOutQuint: function easeInOutQuint(t) {
|
8619 | return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
|
8620 | }
|
8621 | };
|
8622 |
|
8623 |
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 | function getScrollBarWidth() {
|
8629 | var inner = document.createElement("p");
|
8630 | inner.style.width = "100%";
|
8631 | inner.style.height = "200px";
|
8632 | var outer = document.createElement("div");
|
8633 | outer.style.position = "absolute";
|
8634 | outer.style.top = "0px";
|
8635 | outer.style.left = "0px";
|
8636 | outer.style.visibility = "hidden";
|
8637 | outer.style.width = "200px";
|
8638 | outer.style.height = "150px";
|
8639 | outer.style.overflow = "hidden";
|
8640 | outer.appendChild(inner);
|
8641 | document.body.appendChild(outer);
|
8642 | var w1 = inner.offsetWidth;
|
8643 | outer.style.overflow = "scroll";
|
8644 | var w2 = inner.offsetWidth;
|
8645 |
|
8646 | if (w1 == w2) {
|
8647 | w2 = outer.clientWidth;
|
8648 | }
|
8649 |
|
8650 | document.body.removeChild(outer);
|
8651 | return w1 - w2;
|
8652 | }
|
8653 |
|
8654 |
|
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 | function topMost(pile, accessors) {
|
8680 | var candidate;
|
8681 |
|
8682 | if (!isArray(accessors)) {
|
8683 | accessors = [accessors];
|
8684 | }
|
8685 |
|
8686 | var _iterator3 = _createForOfIteratorHelper$1(pile),
|
8687 | _step3;
|
8688 |
|
8689 | try {
|
8690 | for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
8691 | var member = _step3.value;
|
8692 |
|
8693 | if (member) {
|
8694 | candidate = member[accessors[0]];
|
8695 |
|
8696 | for (var i = 1; i < accessors.length; i++) {
|
8697 | if (candidate) {
|
8698 | candidate = candidate[accessors[i]];
|
8699 | }
|
8700 | }
|
8701 |
|
8702 | if (typeof candidate !== "undefined") {
|
8703 | break;
|
8704 | }
|
8705 | }
|
8706 | }
|
8707 | } catch (err) {
|
8708 | _iterator3.e(err);
|
8709 | } finally {
|
8710 | _iterator3.f();
|
8711 | }
|
8712 |
|
8713 | return candidate;
|
8714 | }
|
8715 |
|
8716 | var htmlColors = {
|
8717 | black: "#000000",
|
8718 | navy: "#000080",
|
8719 | darkblue: "#00008B",
|
8720 | mediumblue: "#0000CD",
|
8721 | blue: "#0000FF",
|
8722 | darkgreen: "#006400",
|
8723 | green: "#008000",
|
8724 | teal: "#008080",
|
8725 | darkcyan: "#008B8B",
|
8726 | deepskyblue: "#00BFFF",
|
8727 | darkturquoise: "#00CED1",
|
8728 | mediumspringgreen: "#00FA9A",
|
8729 | lime: "#00FF00",
|
8730 | springgreen: "#00FF7F",
|
8731 | aqua: "#00FFFF",
|
8732 | cyan: "#00FFFF",
|
8733 | midnightblue: "#191970",
|
8734 | dodgerblue: "#1E90FF",
|
8735 | lightseagreen: "#20B2AA",
|
8736 | forestgreen: "#228B22",
|
8737 | seagreen: "#2E8B57",
|
8738 | darkslategray: "#2F4F4F",
|
8739 | limegreen: "#32CD32",
|
8740 | mediumseagreen: "#3CB371",
|
8741 | turquoise: "#40E0D0",
|
8742 | royalblue: "#4169E1",
|
8743 | steelblue: "#4682B4",
|
8744 | darkslateblue: "#483D8B",
|
8745 | mediumturquoise: "#48D1CC",
|
8746 | indigo: "#4B0082",
|
8747 | darkolivegreen: "#556B2F",
|
8748 | cadetblue: "#5F9EA0",
|
8749 | cornflowerblue: "#6495ED",
|
8750 | mediumaquamarine: "#66CDAA",
|
8751 | dimgray: "#696969",
|
8752 | slateblue: "#6A5ACD",
|
8753 | olivedrab: "#6B8E23",
|
8754 | slategray: "#708090",
|
8755 | lightslategray: "#778899",
|
8756 | mediumslateblue: "#7B68EE",
|
8757 | lawngreen: "#7CFC00",
|
8758 | chartreuse: "#7FFF00",
|
8759 | aquamarine: "#7FFFD4",
|
8760 | maroon: "#800000",
|
8761 | purple: "#800080",
|
8762 | olive: "#808000",
|
8763 | gray: "#808080",
|
8764 | skyblue: "#87CEEB",
|
8765 | lightskyblue: "#87CEFA",
|
8766 | blueviolet: "#8A2BE2",
|
8767 | darkred: "#8B0000",
|
8768 | darkmagenta: "#8B008B",
|
8769 | saddlebrown: "#8B4513",
|
8770 | darkseagreen: "#8FBC8F",
|
8771 | lightgreen: "#90EE90",
|
8772 | mediumpurple: "#9370D8",
|
8773 | darkviolet: "#9400D3",
|
8774 | palegreen: "#98FB98",
|
8775 | darkorchid: "#9932CC",
|
8776 | yellowgreen: "#9ACD32",
|
8777 | sienna: "#A0522D",
|
8778 | brown: "#A52A2A",
|
8779 | darkgray: "#A9A9A9",
|
8780 | lightblue: "#ADD8E6",
|
8781 | greenyellow: "#ADFF2F",
|
8782 | paleturquoise: "#AFEEEE",
|
8783 | lightsteelblue: "#B0C4DE",
|
8784 | powderblue: "#B0E0E6",
|
8785 | firebrick: "#B22222",
|
8786 | darkgoldenrod: "#B8860B",
|
8787 | mediumorchid: "#BA55D3",
|
8788 | rosybrown: "#BC8F8F",
|
8789 | darkkhaki: "#BDB76B",
|
8790 | silver: "#C0C0C0",
|
8791 | mediumvioletred: "#C71585",
|
8792 | indianred: "#CD5C5C",
|
8793 | peru: "#CD853F",
|
8794 | chocolate: "#D2691E",
|
8795 | tan: "#D2B48C",
|
8796 | lightgrey: "#D3D3D3",
|
8797 | palevioletred: "#D87093",
|
8798 | thistle: "#D8BFD8",
|
8799 | orchid: "#DA70D6",
|
8800 | goldenrod: "#DAA520",
|
8801 | crimson: "#DC143C",
|
8802 | gainsboro: "#DCDCDC",
|
8803 | plum: "#DDA0DD",
|
8804 | burlywood: "#DEB887",
|
8805 | lightcyan: "#E0FFFF",
|
8806 | lavender: "#E6E6FA",
|
8807 | darksalmon: "#E9967A",
|
8808 | violet: "#EE82EE",
|
8809 | palegoldenrod: "#EEE8AA",
|
8810 | lightcoral: "#F08080",
|
8811 | khaki: "#F0E68C",
|
8812 | aliceblue: "#F0F8FF",
|
8813 | honeydew: "#F0FFF0",
|
8814 | azure: "#F0FFFF",
|
8815 | sandybrown: "#F4A460",
|
8816 | wheat: "#F5DEB3",
|
8817 | beige: "#F5F5DC",
|
8818 | whitesmoke: "#F5F5F5",
|
8819 | mintcream: "#F5FFFA",
|
8820 | ghostwhite: "#F8F8FF",
|
8821 | salmon: "#FA8072",
|
8822 | antiquewhite: "#FAEBD7",
|
8823 | linen: "#FAF0E6",
|
8824 | lightgoldenrodyellow: "#FAFAD2",
|
8825 | oldlace: "#FDF5E6",
|
8826 | red: "#FF0000",
|
8827 | fuchsia: "#FF00FF",
|
8828 | magenta: "#FF00FF",
|
8829 | deeppink: "#FF1493",
|
8830 | orangered: "#FF4500",
|
8831 | tomato: "#FF6347",
|
8832 | hotpink: "#FF69B4",
|
8833 | coral: "#FF7F50",
|
8834 | darkorange: "#FF8C00",
|
8835 | lightsalmon: "#FFA07A",
|
8836 | orange: "#FFA500",
|
8837 | lightpink: "#FFB6C1",
|
8838 | pink: "#FFC0CB",
|
8839 | gold: "#FFD700",
|
8840 | peachpuff: "#FFDAB9",
|
8841 | navajowhite: "#FFDEAD",
|
8842 | moccasin: "#FFE4B5",
|
8843 | bisque: "#FFE4C4",
|
8844 | mistyrose: "#FFE4E1",
|
8845 | blanchedalmond: "#FFEBCD",
|
8846 | papayawhip: "#FFEFD5",
|
8847 | lavenderblush: "#FFF0F5",
|
8848 | seashell: "#FFF5EE",
|
8849 | cornsilk: "#FFF8DC",
|
8850 | lemonchiffon: "#FFFACD",
|
8851 | floralwhite: "#FFFAF0",
|
8852 | snow: "#FFFAFA",
|
8853 | yellow: "#FFFF00",
|
8854 | lightyellow: "#FFFFE0",
|
8855 | ivory: "#FFFFF0",
|
8856 | white: "#FFFFFF"
|
8857 | };
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 | var ColorPicker = function () {
|
8863 | |
8864 |
|
8865 |
|
8866 | function ColorPicker() {
|
8867 | var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
8868 |
|
8869 | _classCallCheck(this, ColorPicker);
|
8870 |
|
8871 | this.pixelRatio = pixelRatio;
|
8872 | this.generated = false;
|
8873 | this.centerCoordinates = {
|
8874 | x: 289 / 2,
|
8875 | y: 289 / 2
|
8876 | };
|
8877 | this.r = 289 * 0.49;
|
8878 | this.color = {
|
8879 | r: 255,
|
8880 | g: 255,
|
8881 | b: 255,
|
8882 | a: 1.0
|
8883 | };
|
8884 | this.hueCircle = undefined;
|
8885 | this.initialColor = {
|
8886 | r: 255,
|
8887 | g: 255,
|
8888 | b: 255,
|
8889 | a: 1.0
|
8890 | };
|
8891 | this.previousColor = undefined;
|
8892 | this.applied = false;
|
8893 |
|
8894 | this.updateCallback = function () {};
|
8895 |
|
8896 | this.closeCallback = function () {};
|
8897 |
|
8898 |
|
8899 | this._create();
|
8900 | }
|
8901 | |
8902 |
|
8903 |
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 | _createClass(ColorPicker, [{
|
8909 | key: "insertTo",
|
8910 | value: function insertTo(container) {
|
8911 | if (this.hammer !== undefined) {
|
8912 | this.hammer.destroy();
|
8913 | this.hammer = undefined;
|
8914 | }
|
8915 |
|
8916 | this.container = container;
|
8917 | this.container.appendChild(this.frame);
|
8918 |
|
8919 | this._bindHammer();
|
8920 |
|
8921 | this._setSize();
|
8922 | }
|
8923 | |
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 | }, {
|
8930 | key: "setUpdateCallback",
|
8931 | value: function setUpdateCallback(callback) {
|
8932 | if (typeof callback === "function") {
|
8933 | this.updateCallback = callback;
|
8934 | } else {
|
8935 | throw new Error("Function attempted to set as colorPicker update callback is not a function.");
|
8936 | }
|
8937 | }
|
8938 | |
8939 |
|
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 | }, {
|
8945 | key: "setCloseCallback",
|
8946 | value: function setCloseCallback(callback) {
|
8947 | if (typeof callback === "function") {
|
8948 | this.closeCallback = callback;
|
8949 | } else {
|
8950 | throw new Error("Function attempted to set as colorPicker closing callback is not a function.");
|
8951 | }
|
8952 | }
|
8953 | |
8954 |
|
8955 |
|
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 | }, {
|
8961 | key: "_isColorString",
|
8962 | value: function _isColorString(color) {
|
8963 | if (typeof color === "string") {
|
8964 | return htmlColors[color];
|
8965 | }
|
8966 | }
|
8967 | |
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 | }, {
|
8982 | key: "setColor",
|
8983 | value: function setColor(color) {
|
8984 | var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
8985 |
|
8986 | if (color === "none") {
|
8987 | return;
|
8988 | }
|
8989 |
|
8990 | var rgba;
|
8991 |
|
8992 | var htmlColor = this._isColorString(color);
|
8993 |
|
8994 | if (htmlColor !== undefined) {
|
8995 | color = htmlColor;
|
8996 | }
|
8997 |
|
8998 |
|
8999 | if (isString(color) === true) {
|
9000 | if (isValidRGB(color) === true) {
|
9001 | var rgbaArray = color.substr(4).substr(0, color.length - 5).split(",");
|
9002 | rgba = {
|
9003 | r: rgbaArray[0],
|
9004 | g: rgbaArray[1],
|
9005 | b: rgbaArray[2],
|
9006 | a: 1.0
|
9007 | };
|
9008 | } else if (isValidRGBA(color) === true) {
|
9009 | var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(",");
|
9010 |
|
9011 | rgba = {
|
9012 | r: _rgbaArray[0],
|
9013 | g: _rgbaArray[1],
|
9014 | b: _rgbaArray[2],
|
9015 | a: _rgbaArray[3]
|
9016 | };
|
9017 | } else if (isValidHex(color) === true) {
|
9018 | var rgbObj = hexToRGB(color);
|
9019 | rgba = {
|
9020 | r: rgbObj.r,
|
9021 | g: rgbObj.g,
|
9022 | b: rgbObj.b,
|
9023 | a: 1.0
|
9024 | };
|
9025 | }
|
9026 | } else {
|
9027 | if (color instanceof Object) {
|
9028 | if (color.r !== undefined && color.g !== undefined && color.b !== undefined) {
|
9029 | var alpha = color.a !== undefined ? color.a : "1.0";
|
9030 | rgba = {
|
9031 | r: color.r,
|
9032 | g: color.g,
|
9033 | b: color.b,
|
9034 | a: alpha
|
9035 | };
|
9036 | }
|
9037 | }
|
9038 | }
|
9039 |
|
9040 |
|
9041 | if (rgba === undefined) {
|
9042 | throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + stringify$1(color));
|
9043 | } else {
|
9044 | this._setColor(rgba, setInitial);
|
9045 | }
|
9046 | }
|
9047 | |
9048 |
|
9049 |
|
9050 |
|
9051 |
|
9052 | }, {
|
9053 | key: "show",
|
9054 | value: function show() {
|
9055 | if (this.closeCallback !== undefined) {
|
9056 | this.closeCallback();
|
9057 | this.closeCallback = undefined;
|
9058 | }
|
9059 |
|
9060 | this.applied = false;
|
9061 | this.frame.style.display = "block";
|
9062 |
|
9063 | this._generateHueCircle();
|
9064 | }
|
9065 |
|
9066 | |
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 | }, {
|
9075 | key: "_hide",
|
9076 | value: function _hide() {
|
9077 | var _this2 = this;
|
9078 |
|
9079 | var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
9080 |
|
9081 |
|
9082 | if (storePrevious === true) {
|
9083 | this.previousColor = assign$2({}, this.color);
|
9084 | }
|
9085 |
|
9086 | if (this.applied === true) {
|
9087 | this.updateCallback(this.initialColor);
|
9088 | }
|
9089 |
|
9090 | this.frame.style.display = "none";
|
9091 |
|
9092 |
|
9093 | setTimeout$1(function () {
|
9094 | if (_this2.closeCallback !== undefined) {
|
9095 | _this2.closeCallback();
|
9096 |
|
9097 | _this2.closeCallback = undefined;
|
9098 | }
|
9099 | }, 0);
|
9100 | }
|
9101 | |
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 | }, {
|
9108 | key: "_save",
|
9109 | value: function _save() {
|
9110 | this.updateCallback(this.color);
|
9111 | this.applied = false;
|
9112 |
|
9113 | this._hide();
|
9114 | }
|
9115 | |
9116 |
|
9117 |
|
9118 |
|
9119 |
|
9120 |
|
9121 | }, {
|
9122 | key: "_apply",
|
9123 | value: function _apply() {
|
9124 | this.applied = true;
|
9125 | this.updateCallback(this.color);
|
9126 |
|
9127 | this._updatePicker(this.color);
|
9128 | }
|
9129 | |
9130 |
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 | }, {
|
9136 | key: "_loadLast",
|
9137 | value: function _loadLast() {
|
9138 | if (this.previousColor !== undefined) {
|
9139 | this.setColor(this.previousColor, false);
|
9140 | } else {
|
9141 | alert("There is no last color to load...");
|
9142 | }
|
9143 | }
|
9144 | |
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 | }, {
|
9153 | key: "_setColor",
|
9154 | value: function _setColor(rgba) {
|
9155 | var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
9156 |
|
9157 |
|
9158 | if (setInitial === true) {
|
9159 | this.initialColor = assign$2({}, rgba);
|
9160 | }
|
9161 |
|
9162 | this.color = rgba;
|
9163 | var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b);
|
9164 | var angleConvert = 2 * Math.PI;
|
9165 | var radius = this.r * hsv.s;
|
9166 | var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h);
|
9167 | var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h);
|
9168 | this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + "px";
|
9169 | this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + "px";
|
9170 |
|
9171 | this._updatePicker(rgba);
|
9172 | }
|
9173 | |
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 |
|
9180 | }, {
|
9181 | key: "_setOpacity",
|
9182 | value: function _setOpacity(value) {
|
9183 | this.color.a = value / 100;
|
9184 |
|
9185 | this._updatePicker(this.color);
|
9186 | }
|
9187 | |
9188 |
|
9189 |
|
9190 |
|
9191 |
|
9192 |
|
9193 |
|
9194 | }, {
|
9195 | key: "_setBrightness",
|
9196 | value: function _setBrightness(value) {
|
9197 | var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b);
|
9198 | hsv.v = value / 100;
|
9199 | var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v);
|
9200 | rgba["a"] = this.color.a;
|
9201 | this.color = rgba;
|
9202 |
|
9203 | this._updatePicker();
|
9204 | }
|
9205 | |
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 | }, {
|
9213 | key: "_updatePicker",
|
9214 | value: function _updatePicker() {
|
9215 | var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color;
|
9216 | var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b);
|
9217 | var ctx = this.colorPickerCanvas.getContext("2d");
|
9218 |
|
9219 | if (this.pixelRation === undefined) {
|
9220 | this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
|
9221 | }
|
9222 |
|
9223 | ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
|
9224 |
|
9225 | var w = this.colorPickerCanvas.clientWidth;
|
9226 | var h = this.colorPickerCanvas.clientHeight;
|
9227 | ctx.clearRect(0, 0, w, h);
|
9228 | ctx.putImageData(this.hueCircle, 0, 0);
|
9229 | ctx.fillStyle = "rgba(0,0,0," + (1 - hsv.v) + ")";
|
9230 | ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);
|
9231 |
|
9232 | fill(ctx).call(ctx);
|
9233 |
|
9234 | this.brightnessRange.value = 100 * hsv.v;
|
9235 | this.opacityRange.value = 100 * rgba.a;
|
9236 | this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")";
|
9237 | this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")";
|
9238 | }
|
9239 | |
9240 |
|
9241 |
|
9242 |
|
9243 |
|
9244 |
|
9245 | }, {
|
9246 | key: "_setSize",
|
9247 | value: function _setSize() {
|
9248 | this.colorPickerCanvas.style.width = "100%";
|
9249 | this.colorPickerCanvas.style.height = "100%";
|
9250 | this.colorPickerCanvas.width = 289 * this.pixelRatio;
|
9251 | this.colorPickerCanvas.height = 289 * this.pixelRatio;
|
9252 | }
|
9253 | |
9254 |
|
9255 |
|
9256 |
|
9257 |
|
9258 |
|
9259 |
|
9260 | }, {
|
9261 | key: "_create",
|
9262 | value: function _create() {
|
9263 | var _context16, _context17, _context18, _context19;
|
9264 |
|
9265 | this.frame = document.createElement("div");
|
9266 | this.frame.className = "vis-color-picker";
|
9267 | this.colorPickerDiv = document.createElement("div");
|
9268 | this.colorPickerSelector = document.createElement("div");
|
9269 | this.colorPickerSelector.className = "vis-selector";
|
9270 | this.colorPickerDiv.appendChild(this.colorPickerSelector);
|
9271 | this.colorPickerCanvas = document.createElement("canvas");
|
9272 | this.colorPickerDiv.appendChild(this.colorPickerCanvas);
|
9273 |
|
9274 | if (!this.colorPickerCanvas.getContext) {
|
9275 | var noCanvas = document.createElement("DIV");
|
9276 | noCanvas.style.color = "red";
|
9277 | noCanvas.style.fontWeight = "bold";
|
9278 | noCanvas.style.padding = "10px";
|
9279 | noCanvas.innerText = "Error: your browser does not support HTML canvas";
|
9280 | this.colorPickerCanvas.appendChild(noCanvas);
|
9281 | } else {
|
9282 | var ctx = this.colorPickerCanvas.getContext("2d");
|
9283 | this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
|
9284 | this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
|
9285 | }
|
9286 |
|
9287 | this.colorPickerDiv.className = "vis-color";
|
9288 | this.opacityDiv = document.createElement("div");
|
9289 | this.opacityDiv.className = "vis-opacity";
|
9290 | this.brightnessDiv = document.createElement("div");
|
9291 | this.brightnessDiv.className = "vis-brightness";
|
9292 | this.arrowDiv = document.createElement("div");
|
9293 | this.arrowDiv.className = "vis-arrow";
|
9294 | this.opacityRange = document.createElement("input");
|
9295 |
|
9296 | try {
|
9297 | this.opacityRange.type = "range";
|
9298 |
|
9299 | this.opacityRange.min = "0";
|
9300 | this.opacityRange.max = "100";
|
9301 | } catch (err) {
|
9302 | }
|
9303 |
|
9304 | this.opacityRange.value = "100";
|
9305 | this.opacityRange.className = "vis-range";
|
9306 | this.brightnessRange = document.createElement("input");
|
9307 |
|
9308 | try {
|
9309 | this.brightnessRange.type = "range";
|
9310 |
|
9311 | this.brightnessRange.min = "0";
|
9312 | this.brightnessRange.max = "100";
|
9313 | } catch (err) {
|
9314 | }
|
9315 |
|
9316 | this.brightnessRange.value = "100";
|
9317 | this.brightnessRange.className = "vis-range";
|
9318 | this.opacityDiv.appendChild(this.opacityRange);
|
9319 | this.brightnessDiv.appendChild(this.brightnessRange);
|
9320 | var me = this;
|
9321 |
|
9322 | this.opacityRange.onchange = function () {
|
9323 | me._setOpacity(this.value);
|
9324 | };
|
9325 |
|
9326 | this.opacityRange.oninput = function () {
|
9327 | me._setOpacity(this.value);
|
9328 | };
|
9329 |
|
9330 | this.brightnessRange.onchange = function () {
|
9331 | me._setBrightness(this.value);
|
9332 | };
|
9333 |
|
9334 | this.brightnessRange.oninput = function () {
|
9335 | me._setBrightness(this.value);
|
9336 | };
|
9337 |
|
9338 | this.brightnessLabel = document.createElement("div");
|
9339 | this.brightnessLabel.className = "vis-label vis-brightness";
|
9340 | this.brightnessLabel.innerText = "brightness:";
|
9341 | this.opacityLabel = document.createElement("div");
|
9342 | this.opacityLabel.className = "vis-label vis-opacity";
|
9343 | this.opacityLabel.innerText = "opacity:";
|
9344 | this.newColorDiv = document.createElement("div");
|
9345 | this.newColorDiv.className = "vis-new-color";
|
9346 | this.newColorDiv.innerText = "new";
|
9347 | this.initialColorDiv = document.createElement("div");
|
9348 | this.initialColorDiv.className = "vis-initial-color";
|
9349 | this.initialColorDiv.innerText = "initial";
|
9350 | this.cancelButton = document.createElement("div");
|
9351 | this.cancelButton.className = "vis-button vis-cancel";
|
9352 | this.cancelButton.innerText = "cancel";
|
9353 | this.cancelButton.onclick = bind(_context16 = this._hide).call(_context16, this, false);
|
9354 | this.applyButton = document.createElement("div");
|
9355 | this.applyButton.className = "vis-button vis-apply";
|
9356 | this.applyButton.innerText = "apply";
|
9357 | this.applyButton.onclick = bind(_context17 = this._apply).call(_context17, this);
|
9358 | this.saveButton = document.createElement("div");
|
9359 | this.saveButton.className = "vis-button vis-save";
|
9360 | this.saveButton.innerText = "save";
|
9361 | this.saveButton.onclick = bind(_context18 = this._save).call(_context18, this);
|
9362 | this.loadButton = document.createElement("div");
|
9363 | this.loadButton.className = "vis-button vis-load";
|
9364 | this.loadButton.innerText = "load last";
|
9365 | this.loadButton.onclick = bind(_context19 = this._loadLast).call(_context19, this);
|
9366 | this.frame.appendChild(this.colorPickerDiv);
|
9367 | this.frame.appendChild(this.arrowDiv);
|
9368 | this.frame.appendChild(this.brightnessLabel);
|
9369 | this.frame.appendChild(this.brightnessDiv);
|
9370 | this.frame.appendChild(this.opacityLabel);
|
9371 | this.frame.appendChild(this.opacityDiv);
|
9372 | this.frame.appendChild(this.newColorDiv);
|
9373 | this.frame.appendChild(this.initialColorDiv);
|
9374 | this.frame.appendChild(this.cancelButton);
|
9375 | this.frame.appendChild(this.applyButton);
|
9376 | this.frame.appendChild(this.saveButton);
|
9377 | this.frame.appendChild(this.loadButton);
|
9378 | }
|
9379 | |
9380 |
|
9381 |
|
9382 |
|
9383 |
|
9384 |
|
9385 | }, {
|
9386 | key: "_bindHammer",
|
9387 | value: function _bindHammer() {
|
9388 | var _this3 = this;
|
9389 |
|
9390 | this.drag = {};
|
9391 | this.pinch = {};
|
9392 | this.hammer = new Hammer$1(this.colorPickerCanvas);
|
9393 | this.hammer.get("pinch").set({
|
9394 | enable: true
|
9395 | });
|
9396 | this.hammer.on("hammer.input", function (event) {
|
9397 | if (event.isFirst) {
|
9398 | _this3._moveSelector(event);
|
9399 | }
|
9400 | });
|
9401 | this.hammer.on("tap", function (event) {
|
9402 | _this3._moveSelector(event);
|
9403 | });
|
9404 | this.hammer.on("panstart", function (event) {
|
9405 | _this3._moveSelector(event);
|
9406 | });
|
9407 | this.hammer.on("panmove", function (event) {
|
9408 | _this3._moveSelector(event);
|
9409 | });
|
9410 | this.hammer.on("panend", function (event) {
|
9411 | _this3._moveSelector(event);
|
9412 | });
|
9413 | }
|
9414 | |
9415 |
|
9416 |
|
9417 |
|
9418 |
|
9419 |
|
9420 | }, {
|
9421 | key: "_generateHueCircle",
|
9422 | value: function _generateHueCircle() {
|
9423 | if (this.generated === false) {
|
9424 | var ctx = this.colorPickerCanvas.getContext("2d");
|
9425 |
|
9426 | if (this.pixelRation === undefined) {
|
9427 | this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
|
9428 | }
|
9429 |
|
9430 | ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
|
9431 |
|
9432 | var w = this.colorPickerCanvas.clientWidth;
|
9433 | var h = this.colorPickerCanvas.clientHeight;
|
9434 | ctx.clearRect(0, 0, w, h);
|
9435 |
|
9436 | var x, y, hue, sat;
|
9437 | this.centerCoordinates = {
|
9438 | x: w * 0.5,
|
9439 | y: h * 0.5
|
9440 | };
|
9441 | this.r = 0.49 * w;
|
9442 | var angleConvert = 2 * Math.PI / 360;
|
9443 | var hfac = 1 / 360;
|
9444 | var sfac = 1 / this.r;
|
9445 | var rgb;
|
9446 |
|
9447 | for (hue = 0; hue < 360; hue++) {
|
9448 | for (sat = 0; sat < this.r; sat++) {
|
9449 | x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue);
|
9450 | y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue);
|
9451 | rgb = HSVToRGB(hue * hfac, sat * sfac, 1);
|
9452 | ctx.fillStyle = "rgb(" + rgb.r + "," + rgb.g + "," + rgb.b + ")";
|
9453 | ctx.fillRect(x - 0.5, y - 0.5, 2, 2);
|
9454 | }
|
9455 | }
|
9456 |
|
9457 | ctx.strokeStyle = "rgba(0,0,0,1)";
|
9458 | ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);
|
9459 | ctx.stroke();
|
9460 | this.hueCircle = ctx.getImageData(0, 0, w, h);
|
9461 | }
|
9462 |
|
9463 | this.generated = true;
|
9464 | }
|
9465 | |
9466 |
|
9467 |
|
9468 |
|
9469 |
|
9470 |
|
9471 |
|
9472 | }, {
|
9473 | key: "_moveSelector",
|
9474 | value: function _moveSelector(event) {
|
9475 | var rect = this.colorPickerDiv.getBoundingClientRect();
|
9476 | var left = event.center.x - rect.left;
|
9477 | var top = event.center.y - rect.top;
|
9478 | var centerY = 0.5 * this.colorPickerDiv.clientHeight;
|
9479 | var centerX = 0.5 * this.colorPickerDiv.clientWidth;
|
9480 | var x = left - centerX;
|
9481 | var y = top - centerY;
|
9482 | var angle = Math.atan2(x, y);
|
9483 | var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX);
|
9484 | var newTop = Math.cos(angle) * radius + centerY;
|
9485 | var newLeft = Math.sin(angle) * radius + centerX;
|
9486 | this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + "px";
|
9487 | this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + "px";
|
9488 |
|
9489 | var h = angle / (2 * Math.PI);
|
9490 | h = h < 0 ? h + 1 : h;
|
9491 | var s = radius / this.r;
|
9492 | var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b);
|
9493 | hsv.h = h;
|
9494 | hsv.s = s;
|
9495 | var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v);
|
9496 | rgba["a"] = this.color.a;
|
9497 | this.color = rgba;
|
9498 |
|
9499 | this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")";
|
9500 | this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")";
|
9501 | }
|
9502 | }]);
|
9503 |
|
9504 | return ColorPicker;
|
9505 | }();
|
9506 |
|
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 | function wrapInTag() {
|
9516 | for (var _len5 = arguments.length, rest = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
9517 | rest[_key5] = arguments[_key5];
|
9518 | }
|
9519 |
|
9520 | if (rest.length < 1) {
|
9521 | throw new TypeError("Invalid arguments.");
|
9522 | } else if (rest.length === 1) {
|
9523 | return document.createTextNode(rest[0]);
|
9524 | } else {
|
9525 | var element = document.createElement(rest[0]);
|
9526 | element.appendChild(wrapInTag.apply(void 0, _toConsumableArray(slice$2(rest).call(rest, 1))));
|
9527 | return element;
|
9528 | }
|
9529 | }
|
9530 |
|
9531 |
|
9532 |
|
9533 |
|
9534 |
|
9535 |
|
9536 |
|
9537 |
|
9538 |
|
9539 |
|
9540 |
|
9541 | var Configurator = function () {
|
9542 | |
9543 |
|
9544 |
|
9545 |
|
9546 |
|
9547 |
|
9548 |
|
9549 | function Configurator(parentModule, defaultContainer, configureOptions) {
|
9550 | var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
9551 | var hideOption = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
9552 | return false;
|
9553 | };
|
9554 |
|
9555 | _classCallCheck(this, Configurator);
|
9556 |
|
9557 | this.parent = parentModule;
|
9558 | this.changedOptions = [];
|
9559 | this.container = defaultContainer;
|
9560 | this.allowCreation = false;
|
9561 | this.hideOption = hideOption;
|
9562 | this.options = {};
|
9563 | this.initialized = false;
|
9564 | this.popupCounter = 0;
|
9565 | this.defaultOptions = {
|
9566 | enabled: false,
|
9567 | filter: true,
|
9568 | container: undefined,
|
9569 | showButton: true
|
9570 | };
|
9571 |
|
9572 | assign$2(this.options, this.defaultOptions);
|
9573 |
|
9574 | this.configureOptions = configureOptions;
|
9575 | this.moduleOptions = {};
|
9576 | this.domElements = [];
|
9577 | this.popupDiv = {};
|
9578 | this.popupLimit = 5;
|
9579 | this.popupHistory = {};
|
9580 | this.colorPicker = new ColorPicker(pixelRatio);
|
9581 | this.wrapper = undefined;
|
9582 | }
|
9583 | |
9584 |
|
9585 |
|
9586 |
|
9587 |
|
9588 |
|
9589 |
|
9590 |
|
9591 | _createClass(Configurator, [{
|
9592 | key: "setOptions",
|
9593 | value: function setOptions(options) {
|
9594 | if (options !== undefined) {
|
9595 |
|
9596 | this.popupHistory = {};
|
9597 |
|
9598 | this._removePopup();
|
9599 |
|
9600 | var enabled = true;
|
9601 |
|
9602 | if (typeof options === "string") {
|
9603 | this.options.filter = options;
|
9604 | } else if (isArray(options)) {
|
9605 | this.options.filter = options.join();
|
9606 | } else if (_typeof(options) === "object") {
|
9607 | if (options == null) {
|
9608 | throw new TypeError("options cannot be null");
|
9609 | }
|
9610 |
|
9611 | if (options.container !== undefined) {
|
9612 | this.options.container = options.container;
|
9613 | }
|
9614 |
|
9615 | if (filter(options) !== undefined) {
|
9616 | this.options.filter = filter(options);
|
9617 | }
|
9618 |
|
9619 | if (options.showButton !== undefined) {
|
9620 | this.options.showButton = options.showButton;
|
9621 | }
|
9622 |
|
9623 | if (options.enabled !== undefined) {
|
9624 | enabled = options.enabled;
|
9625 | }
|
9626 | } else if (typeof options === "boolean") {
|
9627 | this.options.filter = true;
|
9628 | enabled = options;
|
9629 | } else if (typeof options === "function") {
|
9630 | this.options.filter = options;
|
9631 | enabled = true;
|
9632 | }
|
9633 |
|
9634 | if (filter(this.options) === false) {
|
9635 | enabled = false;
|
9636 | }
|
9637 |
|
9638 | this.options.enabled = enabled;
|
9639 | }
|
9640 |
|
9641 | this._clean();
|
9642 | }
|
9643 | |
9644 |
|
9645 |
|
9646 |
|
9647 |
|
9648 | }, {
|
9649 | key: "setModuleOptions",
|
9650 | value: function setModuleOptions(moduleOptions) {
|
9651 | this.moduleOptions = moduleOptions;
|
9652 |
|
9653 | if (this.options.enabled === true) {
|
9654 | this._clean();
|
9655 |
|
9656 | if (this.options.container !== undefined) {
|
9657 | this.container = this.options.container;
|
9658 | }
|
9659 |
|
9660 | this._create();
|
9661 | }
|
9662 | }
|
9663 | |
9664 |
|
9665 |
|
9666 |
|
9667 |
|
9668 |
|
9669 | }, {
|
9670 | key: "_create",
|
9671 | value: function _create() {
|
9672 | this._clean();
|
9673 |
|
9674 | this.changedOptions = [];
|
9675 |
|
9676 | var filter$1 = filter(this.options);
|
9677 |
|
9678 | var counter = 0;
|
9679 | var show = false;
|
9680 |
|
9681 | for (var _option in this.configureOptions) {
|
9682 | if (Object.prototype.hasOwnProperty.call(this.configureOptions, _option)) {
|
9683 | this.allowCreation = false;
|
9684 | show = false;
|
9685 |
|
9686 | if (typeof filter$1 === "function") {
|
9687 | show = filter$1(_option, []);
|
9688 | show = show || this._handleObject(this.configureOptions[_option], [_option], true);
|
9689 | } else if (filter$1 === true || indexOf(filter$1).call(filter$1, _option) !== -1) {
|
9690 | show = true;
|
9691 | }
|
9692 |
|
9693 | if (show !== false) {
|
9694 | this.allowCreation = true;
|
9695 |
|
9696 | if (counter > 0) {
|
9697 | this._makeItem([]);
|
9698 | }
|
9699 |
|
9700 |
|
9701 | this._makeHeader(_option);
|
9702 |
|
9703 |
|
9704 | this._handleObject(this.configureOptions[_option], [_option]);
|
9705 | }
|
9706 |
|
9707 | counter++;
|
9708 | }
|
9709 | }
|
9710 |
|
9711 | this._makeButton();
|
9712 |
|
9713 | this._push();
|
9714 |
|
9715 | }
|
9716 | |
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 |
|
9722 | }, {
|
9723 | key: "_push",
|
9724 | value: function _push() {
|
9725 | this.wrapper = document.createElement("div");
|
9726 | this.wrapper.className = "vis-configuration-wrapper";
|
9727 | this.container.appendChild(this.wrapper);
|
9728 |
|
9729 | for (var i = 0; i < this.domElements.length; i++) {
|
9730 | this.wrapper.appendChild(this.domElements[i]);
|
9731 | }
|
9732 |
|
9733 | this._showPopupIfNeeded();
|
9734 | }
|
9735 | |
9736 |
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 | }, {
|
9742 | key: "_clean",
|
9743 | value: function _clean() {
|
9744 | for (var i = 0; i < this.domElements.length; i++) {
|
9745 | this.wrapper.removeChild(this.domElements[i]);
|
9746 | }
|
9747 |
|
9748 | if (this.wrapper !== undefined) {
|
9749 | this.container.removeChild(this.wrapper);
|
9750 | this.wrapper = undefined;
|
9751 | }
|
9752 |
|
9753 | this.domElements = [];
|
9754 |
|
9755 | this._removePopup();
|
9756 | }
|
9757 | |
9758 |
|
9759 |
|
9760 |
|
9761 |
|
9762 |
|
9763 |
|
9764 |
|
9765 | }, {
|
9766 | key: "_getValue",
|
9767 | value: function _getValue(path) {
|
9768 | var base = this.moduleOptions;
|
9769 |
|
9770 | for (var i = 0; i < path.length; i++) {
|
9771 | if (base[path[i]] !== undefined) {
|
9772 | base = base[path[i]];
|
9773 | } else {
|
9774 | base = undefined;
|
9775 | break;
|
9776 | }
|
9777 | }
|
9778 |
|
9779 | return base;
|
9780 | }
|
9781 | |
9782 |
|
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 | }, {
|
9791 | key: "_makeItem",
|
9792 | value: function _makeItem(path) {
|
9793 | if (this.allowCreation === true) {
|
9794 | var item = document.createElement("div");
|
9795 | item.className = "vis-configuration vis-config-item vis-config-s" + path.length;
|
9796 |
|
9797 | for (var _len6 = arguments.length, domElements = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
9798 | domElements[_key6 - 1] = arguments[_key6];
|
9799 | }
|
9800 |
|
9801 | forEach$2(domElements).call(domElements, function (element) {
|
9802 | item.appendChild(element);
|
9803 | });
|
9804 |
|
9805 | this.domElements.push(item);
|
9806 | return this.domElements.length;
|
9807 | }
|
9808 |
|
9809 | return 0;
|
9810 | }
|
9811 | |
9812 |
|
9813 |
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 | }, {
|
9819 | key: "_makeHeader",
|
9820 | value: function _makeHeader(name) {
|
9821 | var div = document.createElement("div");
|
9822 | div.className = "vis-configuration vis-config-header";
|
9823 | div.innerText = name;
|
9824 |
|
9825 | this._makeItem([], div);
|
9826 | }
|
9827 | |
9828 |
|
9829 |
|
9830 |
|
9831 |
|
9832 |
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 | }, {
|
9838 | key: "_makeLabel",
|
9839 | value: function _makeLabel(name, path) {
|
9840 | var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
9841 | var div = document.createElement("div");
|
9842 | div.className = "vis-configuration vis-config-label vis-config-s" + path.length;
|
9843 |
|
9844 | if (objectLabel === true) {
|
9845 | while (div.firstChild) {
|
9846 | div.removeChild(div.firstChild);
|
9847 | }
|
9848 |
|
9849 | div.appendChild(wrapInTag("i", "b", name));
|
9850 | } else {
|
9851 | div.innerText = name + ":";
|
9852 | }
|
9853 |
|
9854 | return div;
|
9855 | }
|
9856 | |
9857 |
|
9858 |
|
9859 |
|
9860 |
|
9861 |
|
9862 |
|
9863 |
|
9864 |
|
9865 | }, {
|
9866 | key: "_makeDropdown",
|
9867 | value: function _makeDropdown(arr, value, path) {
|
9868 | var select = document.createElement("select");
|
9869 | select.className = "vis-configuration vis-config-select";
|
9870 | var selectedValue = 0;
|
9871 |
|
9872 | if (value !== undefined) {
|
9873 | if (indexOf(arr).call(arr, value) !== -1) {
|
9874 | selectedValue = indexOf(arr).call(arr, value);
|
9875 | }
|
9876 | }
|
9877 |
|
9878 | for (var i = 0; i < arr.length; i++) {
|
9879 | var _option2 = document.createElement("option");
|
9880 |
|
9881 | _option2.value = arr[i];
|
9882 |
|
9883 | if (i === selectedValue) {
|
9884 | _option2.selected = "selected";
|
9885 | }
|
9886 |
|
9887 | _option2.innerText = arr[i];
|
9888 | select.appendChild(_option2);
|
9889 | }
|
9890 |
|
9891 | var me = this;
|
9892 |
|
9893 | select.onchange = function () {
|
9894 | me._update(this.value, path);
|
9895 | };
|
9896 |
|
9897 | var label = this._makeLabel(path[path.length - 1], path);
|
9898 |
|
9899 | this._makeItem(path, label, select);
|
9900 | }
|
9901 | |
9902 |
|
9903 |
|
9904 |
|
9905 |
|
9906 |
|
9907 |
|
9908 |
|
9909 |
|
9910 | }, {
|
9911 | key: "_makeRange",
|
9912 | value: function _makeRange(arr, value, path) {
|
9913 | var defaultValue = arr[0];
|
9914 | var min = arr[1];
|
9915 | var max = arr[2];
|
9916 | var step = arr[3];
|
9917 | var range = document.createElement("input");
|
9918 | range.className = "vis-configuration vis-config-range";
|
9919 |
|
9920 | try {
|
9921 | range.type = "range";
|
9922 |
|
9923 | range.min = min;
|
9924 | range.max = max;
|
9925 | } catch (err) {
|
9926 | }
|
9927 |
|
9928 | range.step = step;
|
9929 |
|
9930 | var popupString = "";
|
9931 | var popupValue = 0;
|
9932 |
|
9933 | if (value !== undefined) {
|
9934 | var factor = 1.2;
|
9935 |
|
9936 | if (value < 0 && value * factor < min) {
|
9937 | range.min = Math.ceil(value * factor);
|
9938 | popupValue = range.min;
|
9939 | popupString = "range increased";
|
9940 | } else if (value / factor < min) {
|
9941 | range.min = Math.ceil(value / factor);
|
9942 | popupValue = range.min;
|
9943 | popupString = "range increased";
|
9944 | }
|
9945 |
|
9946 | if (value * factor > max && max !== 1) {
|
9947 | range.max = Math.ceil(value * factor);
|
9948 | popupValue = range.max;
|
9949 | popupString = "range increased";
|
9950 | }
|
9951 |
|
9952 | range.value = value;
|
9953 | } else {
|
9954 | range.value = defaultValue;
|
9955 | }
|
9956 |
|
9957 | var input = document.createElement("input");
|
9958 | input.className = "vis-configuration vis-config-rangeinput";
|
9959 | input.value = range.value;
|
9960 | var me = this;
|
9961 |
|
9962 | range.onchange = function () {
|
9963 | input.value = this.value;
|
9964 |
|
9965 | me._update(Number(this.value), path);
|
9966 | };
|
9967 |
|
9968 | range.oninput = function () {
|
9969 | input.value = this.value;
|
9970 | };
|
9971 |
|
9972 | var label = this._makeLabel(path[path.length - 1], path);
|
9973 |
|
9974 | var itemIndex = this._makeItem(path, label, range, input);
|
9975 |
|
9976 |
|
9977 | if (popupString !== "" && this.popupHistory[itemIndex] !== popupValue) {
|
9978 | this.popupHistory[itemIndex] = popupValue;
|
9979 |
|
9980 | this._setupPopup(popupString, itemIndex);
|
9981 | }
|
9982 | }
|
9983 | |
9984 |
|
9985 |
|
9986 |
|
9987 |
|
9988 |
|
9989 | }, {
|
9990 | key: "_makeButton",
|
9991 | value: function _makeButton() {
|
9992 | var _this4 = this;
|
9993 |
|
9994 | if (this.options.showButton === true) {
|
9995 | var generateButton = document.createElement("div");
|
9996 | generateButton.className = "vis-configuration vis-config-button";
|
9997 | generateButton.innerText = "generate options";
|
9998 |
|
9999 | generateButton.onclick = function () {
|
10000 | _this4._printOptions();
|
10001 | };
|
10002 |
|
10003 | generateButton.onmouseover = function () {
|
10004 | generateButton.className = "vis-configuration vis-config-button hover";
|
10005 | };
|
10006 |
|
10007 | generateButton.onmouseout = function () {
|
10008 | generateButton.className = "vis-configuration vis-config-button";
|
10009 | };
|
10010 |
|
10011 | this.optionsContainer = document.createElement("div");
|
10012 | this.optionsContainer.className = "vis-configuration vis-config-option-container";
|
10013 | this.domElements.push(this.optionsContainer);
|
10014 | this.domElements.push(generateButton);
|
10015 | }
|
10016 | }
|
10017 | |
10018 |
|
10019 |
|
10020 |
|
10021 |
|
10022 |
|
10023 |
|
10024 |
|
10025 | }, {
|
10026 | key: "_setupPopup",
|
10027 | value: function _setupPopup(string, index) {
|
10028 | var _this5 = this;
|
10029 |
|
10030 | if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) {
|
10031 | var div = document.createElement("div");
|
10032 | div.id = "vis-configuration-popup";
|
10033 | div.className = "vis-configuration-popup";
|
10034 | div.innerText = string;
|
10035 |
|
10036 | div.onclick = function () {
|
10037 | _this5._removePopup();
|
10038 | };
|
10039 |
|
10040 | this.popupCounter += 1;
|
10041 | this.popupDiv = {
|
10042 | html: div,
|
10043 | index: index
|
10044 | };
|
10045 | }
|
10046 | }
|
10047 | |
10048 |
|
10049 |
|
10050 |
|
10051 |
|
10052 |
|
10053 | }, {
|
10054 | key: "_removePopup",
|
10055 | value: function _removePopup() {
|
10056 | if (this.popupDiv.html !== undefined) {
|
10057 | this.popupDiv.html.parentNode.removeChild(this.popupDiv.html);
|
10058 | clearTimeout(this.popupDiv.hideTimeout);
|
10059 | clearTimeout(this.popupDiv.deleteTimeout);
|
10060 | this.popupDiv = {};
|
10061 | }
|
10062 | }
|
10063 | |
10064 |
|
10065 |
|
10066 |
|
10067 |
|
10068 |
|
10069 | }, {
|
10070 | key: "_showPopupIfNeeded",
|
10071 | value: function _showPopupIfNeeded() {
|
10072 | var _this6 = this;
|
10073 |
|
10074 | if (this.popupDiv.html !== undefined) {
|
10075 | var correspondingElement = this.domElements[this.popupDiv.index];
|
10076 | var rect = correspondingElement.getBoundingClientRect();
|
10077 | this.popupDiv.html.style.left = rect.left + "px";
|
10078 | this.popupDiv.html.style.top = rect.top - 30 + "px";
|
10079 |
|
10080 | document.body.appendChild(this.popupDiv.html);
|
10081 | this.popupDiv.hideTimeout = setTimeout$1(function () {
|
10082 | _this6.popupDiv.html.style.opacity = 0;
|
10083 | }, 1500);
|
10084 | this.popupDiv.deleteTimeout = setTimeout$1(function () {
|
10085 | _this6._removePopup();
|
10086 | }, 1800);
|
10087 | }
|
10088 | }
|
10089 | |
10090 |
|
10091 |
|
10092 |
|
10093 |
|
10094 |
|
10095 |
|
10096 |
|
10097 |
|
10098 | }, {
|
10099 | key: "_makeCheckbox",
|
10100 | value: function _makeCheckbox(defaultValue, value, path) {
|
10101 | var checkbox = document.createElement("input");
|
10102 | checkbox.type = "checkbox";
|
10103 | checkbox.className = "vis-configuration vis-config-checkbox";
|
10104 | checkbox.checked = defaultValue;
|
10105 |
|
10106 | if (value !== undefined) {
|
10107 | checkbox.checked = value;
|
10108 |
|
10109 | if (value !== defaultValue) {
|
10110 | if (_typeof(defaultValue) === "object") {
|
10111 | if (value !== defaultValue.enabled) {
|
10112 | this.changedOptions.push({
|
10113 | path: path,
|
10114 | value: value
|
10115 | });
|
10116 | }
|
10117 | } else {
|
10118 | this.changedOptions.push({
|
10119 | path: path,
|
10120 | value: value
|
10121 | });
|
10122 | }
|
10123 | }
|
10124 | }
|
10125 |
|
10126 | var me = this;
|
10127 |
|
10128 | checkbox.onchange = function () {
|
10129 | me._update(this.checked, path);
|
10130 | };
|
10131 |
|
10132 | var label = this._makeLabel(path[path.length - 1], path);
|
10133 |
|
10134 | this._makeItem(path, label, checkbox);
|
10135 | }
|
10136 | |
10137 |
|
10138 |
|
10139 |
|
10140 |
|
10141 |
|
10142 |
|
10143 |
|
10144 |
|
10145 | }, {
|
10146 | key: "_makeTextInput",
|
10147 | value: function _makeTextInput(defaultValue, value, path) {
|
10148 | var checkbox = document.createElement("input");
|
10149 | checkbox.type = "text";
|
10150 | checkbox.className = "vis-configuration vis-config-text";
|
10151 | checkbox.value = value;
|
10152 |
|
10153 | if (value !== defaultValue) {
|
10154 | this.changedOptions.push({
|
10155 | path: path,
|
10156 | value: value
|
10157 | });
|
10158 | }
|
10159 |
|
10160 | var me = this;
|
10161 |
|
10162 | checkbox.onchange = function () {
|
10163 | me._update(this.value, path);
|
10164 | };
|
10165 |
|
10166 | var label = this._makeLabel(path[path.length - 1], path);
|
10167 |
|
10168 | this._makeItem(path, label, checkbox);
|
10169 | }
|
10170 | |
10171 |
|
10172 |
|
10173 |
|
10174 |
|
10175 |
|
10176 |
|
10177 |
|
10178 |
|
10179 | }, {
|
10180 | key: "_makeColorField",
|
10181 | value: function _makeColorField(arr, value, path) {
|
10182 | var _this7 = this;
|
10183 |
|
10184 | var defaultColor = arr[1];
|
10185 | var div = document.createElement("div");
|
10186 | value = value === undefined ? defaultColor : value;
|
10187 |
|
10188 | if (value !== "none") {
|
10189 | div.className = "vis-configuration vis-config-colorBlock";
|
10190 | div.style.backgroundColor = value;
|
10191 | } else {
|
10192 | div.className = "vis-configuration vis-config-colorBlock none";
|
10193 | }
|
10194 |
|
10195 | value = value === undefined ? defaultColor : value;
|
10196 |
|
10197 | div.onclick = function () {
|
10198 | _this7._showColorPicker(value, div, path);
|
10199 | };
|
10200 |
|
10201 | var label = this._makeLabel(path[path.length - 1], path);
|
10202 |
|
10203 | this._makeItem(path, label, div);
|
10204 | }
|
10205 | |
10206 |
|
10207 |
|
10208 |
|
10209 |
|
10210 |
|
10211 |
|
10212 |
|
10213 |
|
10214 | }, {
|
10215 | key: "_showColorPicker",
|
10216 | value: function _showColorPicker(value, div, path) {
|
10217 | var _this8 = this;
|
10218 |
|
10219 |
|
10220 | div.onclick = function () {};
|
10221 |
|
10222 | this.colorPicker.insertTo(div);
|
10223 | this.colorPicker.show();
|
10224 | this.colorPicker.setColor(value);
|
10225 | this.colorPicker.setUpdateCallback(function (color) {
|
10226 | var colorString = "rgba(" + color.r + "," + color.g + "," + color.b + "," + color.a + ")";
|
10227 | div.style.backgroundColor = colorString;
|
10228 |
|
10229 | _this8._update(colorString, path);
|
10230 | });
|
10231 |
|
10232 | this.colorPicker.setCloseCallback(function () {
|
10233 | div.onclick = function () {
|
10234 | _this8._showColorPicker(value, div, path);
|
10235 | };
|
10236 | });
|
10237 | }
|
10238 | |
10239 |
|
10240 |
|
10241 |
|
10242 |
|
10243 |
|
10244 |
|
10245 |
|
10246 |
|
10247 |
|
10248 | }, {
|
10249 | key: "_handleObject",
|
10250 | value: function _handleObject(obj) {
|
10251 | var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
10252 | var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
10253 | var show = false;
|
10254 |
|
10255 | var filter$1 = filter(this.options);
|
10256 |
|
10257 | var visibleInSet = false;
|
10258 |
|
10259 | for (var subObj in obj) {
|
10260 | if (Object.prototype.hasOwnProperty.call(obj, subObj)) {
|
10261 | show = true;
|
10262 | var item = obj[subObj];
|
10263 | var newPath = copyAndExtendArray(path, subObj);
|
10264 |
|
10265 | if (typeof filter$1 === "function") {
|
10266 | show = filter$1(subObj, path);
|
10267 |
|
10268 | if (show === false) {
|
10269 | if (!isArray(item) && typeof item !== "string" && typeof item !== "boolean" && item instanceof Object) {
|
10270 | this.allowCreation = false;
|
10271 | show = this._handleObject(item, newPath, true);
|
10272 | this.allowCreation = checkOnly === false;
|
10273 | }
|
10274 | }
|
10275 | }
|
10276 |
|
10277 | if (show !== false) {
|
10278 | visibleInSet = true;
|
10279 |
|
10280 | var value = this._getValue(newPath);
|
10281 |
|
10282 | if (isArray(item)) {
|
10283 | this._handleArray(item, value, newPath);
|
10284 | } else if (typeof item === "string") {
|
10285 | this._makeTextInput(item, value, newPath);
|
10286 | } else if (typeof item === "boolean") {
|
10287 | this._makeCheckbox(item, value, newPath);
|
10288 | } else if (item instanceof Object) {
|
10289 |
|
10290 | if (!this.hideOption(path, subObj, this.moduleOptions)) {
|
10291 |
|
10292 | if (item.enabled !== undefined) {
|
10293 | var enabledPath = copyAndExtendArray(newPath, "enabled");
|
10294 |
|
10295 | var enabledValue = this._getValue(enabledPath);
|
10296 |
|
10297 | if (enabledValue === true) {
|
10298 | var label = this._makeLabel(subObj, newPath, true);
|
10299 |
|
10300 | this._makeItem(newPath, label);
|
10301 |
|
10302 | visibleInSet = this._handleObject(item, newPath) || visibleInSet;
|
10303 | } else {
|
10304 | this._makeCheckbox(item, enabledValue, newPath);
|
10305 | }
|
10306 | } else {
|
10307 | var _label = this._makeLabel(subObj, newPath, true);
|
10308 |
|
10309 | this._makeItem(newPath, _label);
|
10310 |
|
10311 | visibleInSet = this._handleObject(item, newPath) || visibleInSet;
|
10312 | }
|
10313 | }
|
10314 | } else {
|
10315 | console.error("dont know how to handle", item, subObj, newPath);
|
10316 | }
|
10317 | }
|
10318 | }
|
10319 | }
|
10320 |
|
10321 | return visibleInSet;
|
10322 | }
|
10323 | |
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 | }, {
|
10333 | key: "_handleArray",
|
10334 | value: function _handleArray(arr, value, path) {
|
10335 | if (typeof arr[0] === "string" && arr[0] === "color") {
|
10336 | this._makeColorField(arr, value, path);
|
10337 |
|
10338 | if (arr[1] !== value) {
|
10339 | this.changedOptions.push({
|
10340 | path: path,
|
10341 | value: value
|
10342 | });
|
10343 | }
|
10344 | } else if (typeof arr[0] === "string") {
|
10345 | this._makeDropdown(arr, value, path);
|
10346 |
|
10347 | if (arr[0] !== value) {
|
10348 | this.changedOptions.push({
|
10349 | path: path,
|
10350 | value: value
|
10351 | });
|
10352 | }
|
10353 | } else if (typeof arr[0] === "number") {
|
10354 | this._makeRange(arr, value, path);
|
10355 |
|
10356 | if (arr[0] !== value) {
|
10357 | this.changedOptions.push({
|
10358 | path: path,
|
10359 | value: Number(value)
|
10360 | });
|
10361 | }
|
10362 | }
|
10363 | }
|
10364 | |
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 |
|
10372 | }, {
|
10373 | key: "_update",
|
10374 | value: function _update(value, path) {
|
10375 | var options = this._constructOptions(value, path);
|
10376 |
|
10377 | if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) {
|
10378 | this.parent.body.emitter.emit("configChange", options);
|
10379 | }
|
10380 |
|
10381 | this.initialized = true;
|
10382 | this.parent.setOptions(options);
|
10383 | }
|
10384 | |
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 |
|
10392 |
|
10393 | }, {
|
10394 | key: "_constructOptions",
|
10395 | value: function _constructOptions(value, path) {
|
10396 | var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
10397 | var pointer = optionsObj;
|
10398 |
|
10399 | value = value === "true" ? true : value;
|
10400 | value = value === "false" ? false : value;
|
10401 |
|
10402 | for (var i = 0; i < path.length; i++) {
|
10403 | if (path[i] !== "global") {
|
10404 | if (pointer[path[i]] === undefined) {
|
10405 | pointer[path[i]] = {};
|
10406 | }
|
10407 |
|
10408 | if (i !== path.length - 1) {
|
10409 | pointer = pointer[path[i]];
|
10410 | } else {
|
10411 | pointer[path[i]] = value;
|
10412 | }
|
10413 | }
|
10414 | }
|
10415 |
|
10416 | return optionsObj;
|
10417 | }
|
10418 | |
10419 |
|
10420 |
|
10421 |
|
10422 | }, {
|
10423 | key: "_printOptions",
|
10424 | value: function _printOptions() {
|
10425 | var options = this.getOptions();
|
10426 |
|
10427 | while (this.optionsContainer.firstChild) {
|
10428 | this.optionsContainer.removeChild(this.optionsContainer.firstChild);
|
10429 | }
|
10430 |
|
10431 | this.optionsContainer.appendChild(wrapInTag("pre", "const options = " + stringify$1(options, null, 2)));
|
10432 | }
|
10433 | |
10434 |
|
10435 |
|
10436 |
|
10437 |
|
10438 | }, {
|
10439 | key: "getOptions",
|
10440 | value: function getOptions() {
|
10441 | var options = {};
|
10442 |
|
10443 | for (var i = 0; i < this.changedOptions.length; i++) {
|
10444 | this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options);
|
10445 | }
|
10446 |
|
10447 | return options;
|
10448 | }
|
10449 | }]);
|
10450 |
|
10451 | return Configurator;
|
10452 | }();
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 | var Popup = function () {
|
10459 | |
10460 |
|
10461 |
|
10462 |
|
10463 | function Popup(container, overflowMethod) {
|
10464 | _classCallCheck(this, Popup);
|
10465 |
|
10466 | this.container = container;
|
10467 | this.overflowMethod = overflowMethod || "cap";
|
10468 | this.x = 0;
|
10469 | this.y = 0;
|
10470 | this.padding = 5;
|
10471 | this.hidden = false;
|
10472 |
|
10473 | this.frame = document.createElement("div");
|
10474 | this.frame.className = "vis-tooltip";
|
10475 | this.container.appendChild(this.frame);
|
10476 | }
|
10477 | |
10478 |
|
10479 |
|
10480 |
|
10481 |
|
10482 |
|
10483 | _createClass(Popup, [{
|
10484 | key: "setPosition",
|
10485 | value: function setPosition(x, y) {
|
10486 | this.x = _parseInt(x);
|
10487 | this.y = _parseInt(y);
|
10488 | }
|
10489 | |
10490 |
|
10491 |
|
10492 |
|
10493 |
|
10494 |
|
10495 | }, {
|
10496 | key: "setText",
|
10497 | value: function setText(content) {
|
10498 | if (content instanceof Element) {
|
10499 | while (this.frame.firstChild) {
|
10500 | this.frame.removeChild(this.frame.firstChild);
|
10501 | }
|
10502 |
|
10503 | this.frame.appendChild(content);
|
10504 | } else {
|
10505 |
|
10506 |
|
10507 | this.frame.innerText = content;
|
10508 | }
|
10509 | }
|
10510 | |
10511 |
|
10512 |
|
10513 |
|
10514 |
|
10515 |
|
10516 | }, {
|
10517 | key: "show",
|
10518 | value: function show(doShow) {
|
10519 | if (doShow === undefined) {
|
10520 | doShow = true;
|
10521 | }
|
10522 |
|
10523 | if (doShow === true) {
|
10524 | var height = this.frame.clientHeight;
|
10525 | var width = this.frame.clientWidth;
|
10526 | var maxHeight = this.frame.parentNode.clientHeight;
|
10527 | var maxWidth = this.frame.parentNode.clientWidth;
|
10528 | var left = 0,
|
10529 | top = 0;
|
10530 |
|
10531 | if (this.overflowMethod == "flip") {
|
10532 | var isLeft = false,
|
10533 | isTop = true;
|
10534 |
|
10535 | if (this.y - height < this.padding) {
|
10536 | isTop = false;
|
10537 | }
|
10538 |
|
10539 | if (this.x + width > maxWidth - this.padding) {
|
10540 | isLeft = true;
|
10541 | }
|
10542 |
|
10543 | if (isLeft) {
|
10544 | left = this.x - width;
|
10545 | } else {
|
10546 | left = this.x;
|
10547 | }
|
10548 |
|
10549 | if (isTop) {
|
10550 | top = this.y - height;
|
10551 | } else {
|
10552 | top = this.y;
|
10553 | }
|
10554 | } else {
|
10555 | top = this.y - height;
|
10556 |
|
10557 | if (top + height + this.padding > maxHeight) {
|
10558 | top = maxHeight - height - this.padding;
|
10559 | }
|
10560 |
|
10561 | if (top < this.padding) {
|
10562 | top = this.padding;
|
10563 | }
|
10564 |
|
10565 | left = this.x;
|
10566 |
|
10567 | if (left + width + this.padding > maxWidth) {
|
10568 | left = maxWidth - width - this.padding;
|
10569 | }
|
10570 |
|
10571 | if (left < this.padding) {
|
10572 | left = this.padding;
|
10573 | }
|
10574 | }
|
10575 |
|
10576 | this.frame.style.left = left + "px";
|
10577 | this.frame.style.top = top + "px";
|
10578 | this.frame.style.visibility = "visible";
|
10579 | this.hidden = false;
|
10580 | } else {
|
10581 | this.hide();
|
10582 | }
|
10583 | }
|
10584 | |
10585 |
|
10586 |
|
10587 |
|
10588 | }, {
|
10589 | key: "hide",
|
10590 | value: function hide() {
|
10591 | this.hidden = true;
|
10592 | this.frame.style.left = "0";
|
10593 | this.frame.style.top = "0";
|
10594 | this.frame.style.visibility = "hidden";
|
10595 | }
|
10596 | |
10597 |
|
10598 |
|
10599 |
|
10600 | }, {
|
10601 | key: "destroy",
|
10602 | value: function destroy() {
|
10603 | this.frame.parentNode.removeChild(this.frame);
|
10604 | }
|
10605 | }]);
|
10606 |
|
10607 | return Popup;
|
10608 | }();
|
10609 |
|
10610 | var errorFound = false;
|
10611 | var allOptions$1;
|
10612 | var VALIDATOR_PRINT_STYLE = "background: #FFeeee; color: #dd0000";
|
10613 |
|
10614 |
|
10615 |
|
10616 |
|
10617 | var Validator = function () {
|
10618 | function Validator() {
|
10619 | _classCallCheck(this, Validator);
|
10620 | }
|
10621 |
|
10622 | _createClass(Validator, null, [{
|
10623 | key: "validate",
|
10624 | value:
|
10625 | |
10626 |
|
10627 |
|
10628 |
|
10629 |
|
10630 |
|
10631 |
|
10632 |
|
10633 |
|
10634 | function validate(options, referenceOptions, subObject) {
|
10635 | errorFound = false;
|
10636 | allOptions$1 = referenceOptions;
|
10637 | var usedOptions = referenceOptions;
|
10638 |
|
10639 | if (subObject !== undefined) {
|
10640 | usedOptions = referenceOptions[subObject];
|
10641 | }
|
10642 |
|
10643 | Validator.parse(options, usedOptions, []);
|
10644 | return errorFound;
|
10645 | }
|
10646 | |
10647 |
|
10648 |
|
10649 |
|
10650 |
|
10651 |
|
10652 |
|
10653 |
|
10654 |
|
10655 | }, {
|
10656 | key: "parse",
|
10657 | value: function parse(options, referenceOptions, path) {
|
10658 | for (var _option3 in options) {
|
10659 | if (Object.prototype.hasOwnProperty.call(options, _option3)) {
|
10660 | Validator.check(_option3, options, referenceOptions, path);
|
10661 | }
|
10662 | }
|
10663 | }
|
10664 | |
10665 |
|
10666 |
|
10667 |
|
10668 |
|
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 | }, {
|
10675 | key: "check",
|
10676 | value: function check(option, options, referenceOptions, path) {
|
10677 | if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) {
|
10678 | Validator.getSuggestion(option, referenceOptions, path);
|
10679 | return;
|
10680 | }
|
10681 |
|
10682 | var referenceOption = option;
|
10683 | var is_object = true;
|
10684 |
|
10685 | if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
|
10686 |
|
10687 |
|
10688 |
|
10689 |
|
10690 | referenceOption = "__any__";
|
10691 |
|
10692 |
|
10693 | is_object = Validator.getType(options[option]) === "object";
|
10694 | }
|
10695 |
|
10696 | var refOptionObj = referenceOptions[referenceOption];
|
10697 |
|
10698 | if (is_object && refOptionObj.__type__ !== undefined) {
|
10699 | refOptionObj = refOptionObj.__type__;
|
10700 | }
|
10701 |
|
10702 | Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path);
|
10703 | }
|
10704 | |
10705 |
|
10706 |
|
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 |
|
10712 |
|
10713 |
|
10714 |
|
10715 | }, {
|
10716 | key: "checkFields",
|
10717 | value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) {
|
10718 | var log = function log(message) {
|
10719 | console.error("%c" + message + Validator.printLocation(path, option), VALIDATOR_PRINT_STYLE);
|
10720 | };
|
10721 |
|
10722 | var optionType = Validator.getType(options[option]);
|
10723 | var refOptionType = refOptionObj[optionType];
|
10724 |
|
10725 | if (refOptionType !== undefined) {
|
10726 |
|
10727 | if (Validator.getType(refOptionType) === "array" && indexOf(refOptionType).call(refOptionType, options[option]) === -1) {
|
10728 | log('Invalid option detected in "' + option + '".' + " Allowed values are:" + Validator.print(refOptionType) + ' not "' + options[option] + '". ');
|
10729 | errorFound = true;
|
10730 | } else if (optionType === "object" && referenceOption !== "__any__") {
|
10731 | path = copyAndExtendArray(path, option);
|
10732 | Validator.parse(options[option], referenceOptions[referenceOption], path);
|
10733 | }
|
10734 | } else if (refOptionObj["any"] === undefined) {
|
10735 |
|
10736 | log('Invalid type received for "' + option + '". Expected: ' + Validator.print(keys$3(refOptionObj)) + ". Received [" + optionType + '] "' + options[option] + '"');
|
10737 | errorFound = true;
|
10738 | }
|
10739 | }
|
10740 | |
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 | }, {
|
10748 | key: "getType",
|
10749 | value: function getType(object) {
|
10750 | var type = _typeof(object);
|
10751 |
|
10752 | if (type === "object") {
|
10753 | if (object === null) {
|
10754 | return "null";
|
10755 | }
|
10756 |
|
10757 | if (object instanceof Boolean) {
|
10758 | return "boolean";
|
10759 | }
|
10760 |
|
10761 | if (object instanceof Number) {
|
10762 | return "number";
|
10763 | }
|
10764 |
|
10765 | if (object instanceof String) {
|
10766 | return "string";
|
10767 | }
|
10768 |
|
10769 | if (isArray(object)) {
|
10770 | return "array";
|
10771 | }
|
10772 |
|
10773 | if (object instanceof Date) {
|
10774 | return "date";
|
10775 | }
|
10776 |
|
10777 | if (object.nodeType !== undefined) {
|
10778 | return "dom";
|
10779 | }
|
10780 |
|
10781 | if (object._isAMomentObject === true) {
|
10782 | return "moment";
|
10783 | }
|
10784 |
|
10785 | return "object";
|
10786 | } else if (type === "number") {
|
10787 | return "number";
|
10788 | } else if (type === "boolean") {
|
10789 | return "boolean";
|
10790 | } else if (type === "string") {
|
10791 | return "string";
|
10792 | } else if (type === undefined) {
|
10793 | return "undefined";
|
10794 | }
|
10795 |
|
10796 | return type;
|
10797 | }
|
10798 | |
10799 |
|
10800 |
|
10801 |
|
10802 |
|
10803 |
|
10804 |
|
10805 | }, {
|
10806 | key: "getSuggestion",
|
10807 | value: function getSuggestion(option, options, path) {
|
10808 | var localSearch = Validator.findInOptions(option, options, path, false);
|
10809 | var globalSearch = Validator.findInOptions(option, allOptions$1, [], true);
|
10810 | var localSearchThreshold = 8;
|
10811 | var globalSearchThreshold = 4;
|
10812 | var msg;
|
10813 |
|
10814 | if (localSearch.indexMatch !== undefined) {
|
10815 | msg = " in " + Validator.printLocation(localSearch.path, option, "") + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n';
|
10816 | } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) {
|
10817 | msg = " in " + Validator.printLocation(localSearch.path, option, "") + "Perhaps it was misplaced? Matching option found at: " + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, "");
|
10818 | } else if (localSearch.distance <= localSearchThreshold) {
|
10819 | msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option);
|
10820 | } else {
|
10821 | msg = ". Did you mean one of these: " + Validator.print(keys$3(options)) + Validator.printLocation(path, option);
|
10822 | }
|
10823 |
|
10824 | console.error('%cUnknown option detected: "' + option + '"' + msg, VALIDATOR_PRINT_STYLE);
|
10825 | errorFound = true;
|
10826 | }
|
10827 | |
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 |
|
10835 |
|
10836 |
|
10837 |
|
10838 | }, {
|
10839 | key: "findInOptions",
|
10840 | value: function findInOptions(option, options, path) {
|
10841 | var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
10842 | var min = 1e9;
|
10843 | var closestMatch = "";
|
10844 | var closestMatchPath = [];
|
10845 | var lowerCaseOption = option.toLowerCase();
|
10846 | var indexMatch = undefined;
|
10847 |
|
10848 | for (var op in options) {
|
10849 | var distance = void 0;
|
10850 |
|
10851 | if (options[op].__type__ !== undefined && recursive === true) {
|
10852 | var result = Validator.findInOptions(option, options[op], copyAndExtendArray(path, op));
|
10853 |
|
10854 | if (min > result.distance) {
|
10855 | closestMatch = result.closestMatch;
|
10856 | closestMatchPath = result.path;
|
10857 | min = result.distance;
|
10858 | indexMatch = result.indexMatch;
|
10859 | }
|
10860 | } else {
|
10861 | var _context20;
|
10862 |
|
10863 | if (indexOf(_context20 = op.toLowerCase()).call(_context20, lowerCaseOption) !== -1) {
|
10864 | indexMatch = op;
|
10865 | }
|
10866 |
|
10867 | distance = Validator.levenshteinDistance(option, op);
|
10868 |
|
10869 | if (min > distance) {
|
10870 | closestMatch = op;
|
10871 | closestMatchPath = copyArray(path);
|
10872 | min = distance;
|
10873 | }
|
10874 | }
|
10875 | }
|
10876 |
|
10877 | return {
|
10878 | closestMatch: closestMatch,
|
10879 | path: closestMatchPath,
|
10880 | distance: min,
|
10881 | indexMatch: indexMatch
|
10882 | };
|
10883 | }
|
10884 | |
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 |
|
10890 |
|
10891 |
|
10892 | }, {
|
10893 | key: "printLocation",
|
10894 | value: function printLocation(path, option) {
|
10895 | var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Problem value found at: \n";
|
10896 | var str = "\n\n" + prefix + "options = {\n";
|
10897 |
|
10898 | for (var i = 0; i < path.length; i++) {
|
10899 | for (var j = 0; j < i + 1; j++) {
|
10900 | str += " ";
|
10901 | }
|
10902 |
|
10903 | str += path[i] + ": {\n";
|
10904 | }
|
10905 |
|
10906 | for (var _j = 0; _j < path.length + 1; _j++) {
|
10907 | str += " ";
|
10908 | }
|
10909 |
|
10910 | str += option + "\n";
|
10911 |
|
10912 | for (var _i3 = 0; _i3 < path.length + 1; _i3++) {
|
10913 | for (var _j2 = 0; _j2 < path.length - _i3; _j2++) {
|
10914 | str += " ";
|
10915 | }
|
10916 |
|
10917 | str += "}\n";
|
10918 | }
|
10919 |
|
10920 | return str + "\n\n";
|
10921 | }
|
10922 | |
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 | }, {
|
10929 | key: "print",
|
10930 | value: function print(options) {
|
10931 | return stringify$1(options).replace(/(")|(\[)|(\])|(,"__type__")/g, "").replace(/(,)/g, ", ");
|
10932 | }
|
10933 | |
10934 |
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 |
|
10947 |
|
10948 |
|
10949 |
|
10950 |
|
10951 | }, {
|
10952 | key: "levenshteinDistance",
|
10953 | value: function levenshteinDistance(a, b) {
|
10954 | if (a.length === 0) return b.length;
|
10955 | if (b.length === 0) return a.length;
|
10956 | var matrix = [];
|
10957 |
|
10958 | var i;
|
10959 |
|
10960 | for (i = 0; i <= b.length; i++) {
|
10961 | matrix[i] = [i];
|
10962 | }
|
10963 |
|
10964 |
|
10965 | var j;
|
10966 |
|
10967 | for (j = 0; j <= a.length; j++) {
|
10968 | matrix[0][j] = j;
|
10969 | }
|
10970 |
|
10971 |
|
10972 | for (i = 1; i <= b.length; i++) {
|
10973 | for (j = 1; j <= a.length; j++) {
|
10974 | if (b.charAt(i - 1) == a.charAt(j - 1)) {
|
10975 | matrix[i][j] = matrix[i - 1][j - 1];
|
10976 | } else {
|
10977 | matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1,
|
10978 | Math.min(matrix[i][j - 1] + 1,
|
10979 | matrix[i - 1][j] + 1));
|
10980 | }
|
10981 | }
|
10982 | }
|
10983 |
|
10984 | return matrix[b.length][a.length];
|
10985 | }
|
10986 | }]);
|
10987 |
|
10988 | return Validator;
|
10989 | }();
|
10990 |
|
10991 | var Activator$1 = Activator;
|
10992 | var ColorPicker$1 = ColorPicker;
|
10993 | var Configurator$1 = Configurator;
|
10994 | var Hammer$1$1 = Hammer$1;
|
10995 | var Popup$1 = Popup;
|
10996 | var VALIDATOR_PRINT_STYLE$1 = VALIDATOR_PRINT_STYLE;
|
10997 | var Validator$1 = Validator;
|
10998 |
|
10999 | var esnext$1 = Object.freeze({
|
11000 | __proto__: null,
|
11001 | Activator: Activator$1,
|
11002 | Alea: Alea,
|
11003 | ColorPicker: ColorPicker$1,
|
11004 | Configurator: Configurator$1,
|
11005 | DELETE: DELETE,
|
11006 | HSVToHex: HSVToHex,
|
11007 | HSVToRGB: HSVToRGB,
|
11008 | Hammer: Hammer$1$1,
|
11009 | Popup: Popup$1,
|
11010 | RGBToHSV: RGBToHSV,
|
11011 | RGBToHex: RGBToHex,
|
11012 | VALIDATOR_PRINT_STYLE: VALIDATOR_PRINT_STYLE$1,
|
11013 | Validator: Validator$1,
|
11014 | addClassName: addClassName,
|
11015 | addCssText: addCssText,
|
11016 | addEventListener: addEventListener,
|
11017 | binarySearchCustom: binarySearchCustom,
|
11018 | binarySearchValue: binarySearchValue,
|
11019 | bridgeObject: bridgeObject,
|
11020 | copyAndExtendArray: copyAndExtendArray,
|
11021 | copyArray: copyArray,
|
11022 | deepExtend: deepExtend,
|
11023 | deepObjectAssign: deepObjectAssign,
|
11024 | easingFunctions: easingFunctions,
|
11025 | equalArray: equalArray,
|
11026 | extend: extend,
|
11027 | fillIfDefined: fillIfDefined,
|
11028 | forEach: forEach$1,
|
11029 | getAbsoluteLeft: getAbsoluteLeft,
|
11030 | getAbsoluteRight: getAbsoluteRight,
|
11031 | getAbsoluteTop: getAbsoluteTop,
|
11032 | getScrollBarWidth: getScrollBarWidth,
|
11033 | getTarget: getTarget,
|
11034 | getType: getType,
|
11035 | hasParent: hasParent,
|
11036 | hexToHSV: hexToHSV,
|
11037 | hexToRGB: hexToRGB,
|
11038 | insertSort: insertSort,
|
11039 | isDate: isDate,
|
11040 | isNumber: isNumber,
|
11041 | isObject: isObject,
|
11042 | isString: isString,
|
11043 | isValidHex: isValidHex,
|
11044 | isValidRGB: isValidRGB,
|
11045 | isValidRGBA: isValidRGBA,
|
11046 | mergeOptions: mergeOptions,
|
11047 | option: option,
|
11048 | overrideOpacity: overrideOpacity,
|
11049 | parseColor: parseColor,
|
11050 | preventDefault: preventDefault,
|
11051 | pureDeepObjectAssign: pureDeepObjectAssign,
|
11052 | recursiveDOMDelete: recursiveDOMDelete,
|
11053 | removeClassName: removeClassName,
|
11054 | removeCssText: removeCssText,
|
11055 | removeEventListener: removeEventListener,
|
11056 | selectiveBridgeObject: selectiveBridgeObject,
|
11057 | selectiveDeepExtend: selectiveDeepExtend,
|
11058 | selectiveExtend: selectiveExtend,
|
11059 | selectiveNotDeepExtend: selectiveNotDeepExtend,
|
11060 | throttle: throttle,
|
11061 | toArray: toArray,
|
11062 | topMost: topMost,
|
11063 | updateProperty: updateProperty
|
11064 | });
|
11065 |
|
11066 | var DOMutil$1 = createCommonjsModule(function (module, exports) {
|
11067 |
|
11068 |
|
11069 | |
11070 |
|
11071 |
|
11072 |
|
11073 |
|
11074 | exports.prepareElements = function (JSONcontainer) {
|
11075 |
|
11076 | for (var elementType in JSONcontainer) {
|
11077 | if (JSONcontainer.hasOwnProperty(elementType)) {
|
11078 | JSONcontainer[elementType].redundant = JSONcontainer[elementType].used;
|
11079 | JSONcontainer[elementType].used = [];
|
11080 | }
|
11081 | }
|
11082 | };
|
11083 | |
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 | exports.cleanupElements = function (JSONcontainer) {
|
11093 |
|
11094 | for (var elementType in JSONcontainer) {
|
11095 | if (JSONcontainer.hasOwnProperty(elementType)) {
|
11096 | if (JSONcontainer[elementType].redundant) {
|
11097 | for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) {
|
11098 | JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]);
|
11099 | }
|
11100 |
|
11101 | JSONcontainer[elementType].redundant = [];
|
11102 | }
|
11103 | }
|
11104 | }
|
11105 | };
|
11106 | |
11107 |
|
11108 |
|
11109 |
|
11110 |
|
11111 |
|
11112 | exports.resetElements = function (JSONcontainer) {
|
11113 | exports.prepareElements(JSONcontainer);
|
11114 | exports.cleanupElements(JSONcontainer);
|
11115 | exports.prepareElements(JSONcontainer);
|
11116 | };
|
11117 | |
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 |
|
11129 | exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) {
|
11130 | var element;
|
11131 |
|
11132 | if (JSONcontainer.hasOwnProperty(elementType)) {
|
11133 |
|
11134 |
|
11135 | if (JSONcontainer[elementType].redundant.length > 0) {
|
11136 | element = JSONcontainer[elementType].redundant[0];
|
11137 | JSONcontainer[elementType].redundant.shift();
|
11138 | } else {
|
11139 |
|
11140 | element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
|
11141 | svgContainer.appendChild(element);
|
11142 | }
|
11143 | } else {
|
11144 |
|
11145 | element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
|
11146 | JSONcontainer[elementType] = {
|
11147 | used: [],
|
11148 | redundant: []
|
11149 | };
|
11150 | svgContainer.appendChild(element);
|
11151 | }
|
11152 |
|
11153 | JSONcontainer[elementType].used.push(element);
|
11154 | return element;
|
11155 | };
|
11156 | |
11157 |
|
11158 |
|
11159 |
|
11160 |
|
11161 |
|
11162 |
|
11163 |
|
11164 |
|
11165 |
|
11166 |
|
11167 |
|
11168 | exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) {
|
11169 | var element;
|
11170 |
|
11171 | if (JSONcontainer.hasOwnProperty(elementType)) {
|
11172 |
|
11173 |
|
11174 | if (JSONcontainer[elementType].redundant.length > 0) {
|
11175 | element = JSONcontainer[elementType].redundant[0];
|
11176 | JSONcontainer[elementType].redundant.shift();
|
11177 | } else {
|
11178 |
|
11179 | element = document.createElement(elementType);
|
11180 |
|
11181 | if (insertBefore !== undefined) {
|
11182 | DOMContainer.insertBefore(element, insertBefore);
|
11183 | } else {
|
11184 | DOMContainer.appendChild(element);
|
11185 | }
|
11186 | }
|
11187 | } else {
|
11188 |
|
11189 | element = document.createElement(elementType);
|
11190 | JSONcontainer[elementType] = {
|
11191 | used: [],
|
11192 | redundant: []
|
11193 | };
|
11194 |
|
11195 | if (insertBefore !== undefined) {
|
11196 | DOMContainer.insertBefore(element, insertBefore);
|
11197 | } else {
|
11198 | DOMContainer.appendChild(element);
|
11199 | }
|
11200 | }
|
11201 |
|
11202 | JSONcontainer[elementType].used.push(element);
|
11203 | return element;
|
11204 | };
|
11205 | |
11206 |
|
11207 |
|
11208 |
|
11209 |
|
11210 |
|
11211 |
|
11212 |
|
11213 |
|
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 |
|
11219 |
|
11220 | exports.drawPoint = function (x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
|
11221 | var point;
|
11222 |
|
11223 | if (groupTemplate.style == 'circle') {
|
11224 | point = exports.getSVGElement('circle', JSONcontainer, svgContainer);
|
11225 | point.setAttributeNS(null, "cx", x);
|
11226 | point.setAttributeNS(null, "cy", y);
|
11227 | point.setAttributeNS(null, "r", 0.5 * groupTemplate.size);
|
11228 | } else {
|
11229 | point = exports.getSVGElement('rect', JSONcontainer, svgContainer);
|
11230 | point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size);
|
11231 | point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size);
|
11232 | point.setAttributeNS(null, "width", groupTemplate.size);
|
11233 | point.setAttributeNS(null, "height", groupTemplate.size);
|
11234 | }
|
11235 |
|
11236 | if (groupTemplate.styles !== undefined) {
|
11237 | point.setAttributeNS(null, "style", groupTemplate.styles);
|
11238 | }
|
11239 |
|
11240 | point.setAttributeNS(null, "class", groupTemplate.className + " vis-point");
|
11241 |
|
11242 | if (labelObj) {
|
11243 | var label = exports.getSVGElement('text', JSONcontainer, svgContainer);
|
11244 |
|
11245 | if (labelObj.xOffset) {
|
11246 | x = x + labelObj.xOffset;
|
11247 | }
|
11248 |
|
11249 | if (labelObj.yOffset) {
|
11250 | y = y + labelObj.yOffset;
|
11251 | }
|
11252 |
|
11253 | if (labelObj.content) {
|
11254 | label.textContent = labelObj.content;
|
11255 | }
|
11256 |
|
11257 | if (labelObj.className) {
|
11258 | label.setAttributeNS(null, "class", labelObj.className + " vis-label");
|
11259 | }
|
11260 |
|
11261 | label.setAttributeNS(null, "x", x);
|
11262 | label.setAttributeNS(null, "y", y);
|
11263 | }
|
11264 |
|
11265 | return point;
|
11266 | };
|
11267 | |
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 |
|
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 | exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) {
|
11282 | if (height != 0) {
|
11283 | if (height < 0) {
|
11284 | height *= -1;
|
11285 | y -= height;
|
11286 | }
|
11287 |
|
11288 | var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer);
|
11289 | rect.setAttributeNS(null, "x", x - 0.5 * width);
|
11290 | rect.setAttributeNS(null, "y", y);
|
11291 | rect.setAttributeNS(null, "width", width);
|
11292 | rect.setAttributeNS(null, "height", height);
|
11293 | rect.setAttributeNS(null, "class", className);
|
11294 |
|
11295 | if (style) {
|
11296 | rect.setAttributeNS(null, "style", style);
|
11297 | }
|
11298 | }
|
11299 | };
|
11300 | });
|
11301 | DOMutil$1.prepareElements;
|
11302 | DOMutil$1.cleanupElements;
|
11303 | DOMutil$1.resetElements;
|
11304 | DOMutil$1.getSVGElement;
|
11305 | DOMutil$1.getDOMElement;
|
11306 | DOMutil$1.drawPoint;
|
11307 | DOMutil$1.drawBar;
|
11308 |
|
11309 | var nativeConstruct = getBuiltIn('Reflect', 'construct');
|
11310 |
|
11311 |
|
11312 |
|
11313 |
|
11314 | var NEW_TARGET_BUG = fails(function () {
|
11315 | function F() {
|
11316 |
|
11317 | }
|
11318 |
|
11319 | return !(nativeConstruct(function () {
|
11320 |
|
11321 | }, [], F) instanceof F);
|
11322 | });
|
11323 | var ARGS_BUG = !fails(function () {
|
11324 | nativeConstruct(function () {
|
11325 |
|
11326 | });
|
11327 | });
|
11328 | var FORCED$2 = NEW_TARGET_BUG || ARGS_BUG;
|
11329 | _export({
|
11330 | target: 'Reflect',
|
11331 | stat: true,
|
11332 | forced: FORCED$2,
|
11333 | sham: FORCED$2
|
11334 | }, {
|
11335 | construct: function construct(Target, args
|
11336 | /* , newTarget */
|
11337 | ) {
|
11338 | aFunction(Target);
|
11339 | anObject(args);
|
11340 | var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
|
11341 | if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
|
11342 |
|
11343 | if (Target == newTarget) {
|
11344 |
|
11345 | switch (args.length) {
|
11346 | case 0:
|
11347 | return new Target();
|
11348 |
|
11349 | case 1:
|
11350 | return new Target(args[0]);
|
11351 |
|
11352 | case 2:
|
11353 | return new Target(args[0], args[1]);
|
11354 |
|
11355 | case 3:
|
11356 | return new Target(args[0], args[1], args[2]);
|
11357 |
|
11358 | case 4:
|
11359 | return new Target(args[0], args[1], args[2], args[3]);
|
11360 | }
|
11361 |
|
11362 |
|
11363 | var $args = [null];
|
11364 | $args.push.apply($args, args);
|
11365 | return new (functionBind.apply(Target, $args))();
|
11366 | }
|
11367 |
|
11368 |
|
11369 | var proto = newTarget.prototype;
|
11370 | var instance = objectCreate(isObject$1(proto) ? proto : Object.prototype);
|
11371 | var result = Function.apply.call(Target, instance, args);
|
11372 | return isObject$1(result) ? result : instance;
|
11373 | }
|
11374 | });
|
11375 |
|
11376 | var construct$2 = path.Reflect.construct;
|
11377 |
|
11378 | var construct$1 = construct$2;
|
11379 |
|
11380 | var construct = construct$1;
|
11381 |
|
11382 | var assertThisInitialized = createCommonjsModule(function (module) {
|
11383 | function _assertThisInitialized(self) {
|
11384 | if (self === void 0) {
|
11385 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
11386 | }
|
11387 |
|
11388 | return self;
|
11389 | }
|
11390 |
|
11391 | module.exports = _assertThisInitialized;
|
11392 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11393 | });
|
11394 | var _assertThisInitialized = unwrapExports(assertThisInitialized);
|
11395 |
|
11396 | var create$1 = create$3;
|
11397 |
|
11398 | var create = create$1;
|
11399 |
|
11400 |
|
11401 |
|
11402 | _export({
|
11403 | target: 'Object',
|
11404 | stat: true
|
11405 | }, {
|
11406 | setPrototypeOf: objectSetPrototypeOf
|
11407 | });
|
11408 |
|
11409 | var setPrototypeOf$4 = path.Object.setPrototypeOf;
|
11410 |
|
11411 | var setPrototypeOf$3 = setPrototypeOf$4;
|
11412 |
|
11413 | var setPrototypeOf$2 = setPrototypeOf$3;
|
11414 |
|
11415 | var setPrototypeOf$1 = setPrototypeOf$2;
|
11416 |
|
11417 | var setPrototypeOf = createCommonjsModule(function (module) {
|
11418 | function _setPrototypeOf(o, p) {
|
11419 | module.exports = _setPrototypeOf = setPrototypeOf$1 || function _setPrototypeOf(o, p) {
|
11420 | o.__proto__ = p;
|
11421 | return o;
|
11422 | };
|
11423 |
|
11424 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11425 | return _setPrototypeOf(o, p);
|
11426 | }
|
11427 |
|
11428 | module.exports = _setPrototypeOf;
|
11429 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11430 | });
|
11431 | unwrapExports(setPrototypeOf);
|
11432 |
|
11433 | var inherits = createCommonjsModule(function (module) {
|
11434 | function _inherits(subClass, superClass) {
|
11435 | if (typeof superClass !== "function" && superClass !== null) {
|
11436 | throw new TypeError("Super expression must either be null or a function");
|
11437 | }
|
11438 |
|
11439 | subClass.prototype = create(superClass && superClass.prototype, {
|
11440 | constructor: {
|
11441 | value: subClass,
|
11442 | writable: true,
|
11443 | configurable: true
|
11444 | }
|
11445 | });
|
11446 | if (superClass) setPrototypeOf(subClass, superClass);
|
11447 | }
|
11448 |
|
11449 | module.exports = _inherits;
|
11450 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11451 | });
|
11452 | var _inherits = unwrapExports(inherits);
|
11453 |
|
11454 | var possibleConstructorReturn = createCommonjsModule(function (module) {
|
11455 | var _typeof = _typeof_1["default"];
|
11456 |
|
11457 | function _possibleConstructorReturn(self, call) {
|
11458 | if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
11459 | return call;
|
11460 | } else if (call !== void 0) {
|
11461 | throw new TypeError("Derived constructors may only return object or undefined");
|
11462 | }
|
11463 |
|
11464 | return assertThisInitialized(self);
|
11465 | }
|
11466 |
|
11467 | module.exports = _possibleConstructorReturn;
|
11468 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11469 | });
|
11470 | var _possibleConstructorReturn = unwrapExports(possibleConstructorReturn);
|
11471 |
|
11472 | var getPrototypeOf$2 = getPrototypeOf$4;
|
11473 |
|
11474 | var getPrototypeOf$1 = getPrototypeOf$2;
|
11475 |
|
11476 | var getPrototypeOf = createCommonjsModule(function (module) {
|
11477 | function _getPrototypeOf(o) {
|
11478 | module.exports = _getPrototypeOf = setPrototypeOf$1 ? getPrototypeOf$1 : function _getPrototypeOf(o) {
|
11479 | return o.__proto__ || getPrototypeOf$1(o);
|
11480 | };
|
11481 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11482 | return _getPrototypeOf(o);
|
11483 | }
|
11484 |
|
11485 | module.exports = _getPrototypeOf;
|
11486 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
11487 | });
|
11488 | var _getPrototypeOf = unwrapExports(getPrototypeOf);
|
11489 |
|
11490 | var runtime_1 = createCommonjsModule(function (module) {
|
11491 | |
11492 |
|
11493 |
|
11494 |
|
11495 |
|
11496 |
|
11497 | var runtime = function (exports) {
|
11498 |
|
11499 | var Op = Object.prototype;
|
11500 | var hasOwn = Op.hasOwnProperty;
|
11501 | var undefined$1;
|
11502 |
|
11503 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
11504 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
11505 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
11506 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
11507 |
|
11508 | function define(obj, key, value) {
|
11509 | Object.defineProperty(obj, key, {
|
11510 | value: value,
|
11511 | enumerable: true,
|
11512 | configurable: true,
|
11513 | writable: true
|
11514 | });
|
11515 | return obj[key];
|
11516 | }
|
11517 |
|
11518 | try {
|
11519 |
|
11520 | define({}, "");
|
11521 | } catch (err) {
|
11522 | define = function (obj, key, value) {
|
11523 | return obj[key] = value;
|
11524 | };
|
11525 | }
|
11526 |
|
11527 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
11528 |
|
11529 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
11530 | var generator = Object.create(protoGenerator.prototype);
|
11531 | var context = new Context(tryLocsList || []);
|
11532 |
|
11533 |
|
11534 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
11535 | return generator;
|
11536 | }
|
11537 |
|
11538 | exports.wrap = wrap;
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 | function tryCatch(fn, obj, arg) {
|
11550 | try {
|
11551 | return {
|
11552 | type: "normal",
|
11553 | arg: fn.call(obj, arg)
|
11554 | };
|
11555 | } catch (err) {
|
11556 | return {
|
11557 | type: "throw",
|
11558 | arg: err
|
11559 | };
|
11560 | }
|
11561 | }
|
11562 |
|
11563 | var GenStateSuspendedStart = "suspendedStart";
|
11564 | var GenStateSuspendedYield = "suspendedYield";
|
11565 | var GenStateExecuting = "executing";
|
11566 | var GenStateCompleted = "completed";
|
11567 |
|
11568 |
|
11569 | var ContinueSentinel = {};
|
11570 |
|
11571 |
|
11572 |
|
11573 |
|
11574 | function Generator() {}
|
11575 |
|
11576 | function GeneratorFunction() {}
|
11577 |
|
11578 | function GeneratorFunctionPrototype() {}
|
11579 |
|
11580 |
|
11581 |
|
11582 | var IteratorPrototype = {};
|
11583 |
|
11584 | IteratorPrototype[iteratorSymbol] = function () {
|
11585 | return this;
|
11586 | };
|
11587 |
|
11588 | var getProto = Object.getPrototypeOf;
|
11589 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
11590 |
|
11591 | if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
11592 |
|
11593 |
|
11594 | IteratorPrototype = NativeIteratorPrototype;
|
11595 | }
|
11596 |
|
11597 | var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
11598 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
11599 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
11600 | GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
11601 |
|
11602 |
|
11603 | function defineIteratorMethods(prototype) {
|
11604 | ["next", "throw", "return"].forEach(function (method) {
|
11605 | define(prototype, method, function (arg) {
|
11606 | return this._invoke(method, arg);
|
11607 | });
|
11608 | });
|
11609 | }
|
11610 |
|
11611 | exports.isGeneratorFunction = function (genFun) {
|
11612 | var ctor = typeof genFun === "function" && genFun.constructor;
|
11613 | return ctor ? ctor === GeneratorFunction ||
|
11614 |
|
11615 | (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
11616 | };
|
11617 |
|
11618 | exports.mark = function (genFun) {
|
11619 | if (Object.setPrototypeOf) {
|
11620 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
11621 | } else {
|
11622 | genFun.__proto__ = GeneratorFunctionPrototype;
|
11623 | define(genFun, toStringTagSymbol, "GeneratorFunction");
|
11624 | }
|
11625 |
|
11626 | genFun.prototype = Object.create(Gp);
|
11627 | return genFun;
|
11628 | };
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 | exports.awrap = function (arg) {
|
11635 | return {
|
11636 | __await: arg
|
11637 | };
|
11638 | };
|
11639 |
|
11640 | function AsyncIterator(generator, PromiseImpl) {
|
11641 | function invoke(method, arg, resolve, reject) {
|
11642 | var record = tryCatch(generator[method], generator, arg);
|
11643 |
|
11644 | if (record.type === "throw") {
|
11645 | reject(record.arg);
|
11646 | } else {
|
11647 | var result = record.arg;
|
11648 | var value = result.value;
|
11649 |
|
11650 | if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
11651 | return PromiseImpl.resolve(value.__await).then(function (value) {
|
11652 | invoke("next", value, resolve, reject);
|
11653 | }, function (err) {
|
11654 | invoke("throw", err, resolve, reject);
|
11655 | });
|
11656 | }
|
11657 |
|
11658 | return PromiseImpl.resolve(value).then(function (unwrapped) {
|
11659 |
|
11660 |
|
11661 |
|
11662 | result.value = unwrapped;
|
11663 | resolve(result);
|
11664 | }, function (error) {
|
11665 |
|
11666 |
|
11667 | return invoke("throw", error, resolve, reject);
|
11668 | });
|
11669 | }
|
11670 | }
|
11671 |
|
11672 | var previousPromise;
|
11673 |
|
11674 | function enqueue(method, arg) {
|
11675 | function callInvokeWithMethodAndArg() {
|
11676 | return new PromiseImpl(function (resolve, reject) {
|
11677 | invoke(method, arg, resolve, reject);
|
11678 | });
|
11679 | }
|
11680 |
|
11681 | return previousPromise =
|
11682 |
|
11683 |
|
11684 |
|
11685 |
|
11686 |
|
11687 |
|
11688 |
|
11689 |
|
11690 |
|
11691 |
|
11692 |
|
11693 | previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
11694 |
|
11695 | callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
11696 | }
|
11697 |
|
11698 |
|
11699 |
|
11700 | this._invoke = enqueue;
|
11701 | }
|
11702 |
|
11703 | defineIteratorMethods(AsyncIterator.prototype);
|
11704 |
|
11705 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
11706 | return this;
|
11707 | };
|
11708 |
|
11709 | exports.AsyncIterator = AsyncIterator;
|
11710 |
|
11711 |
|
11712 |
|
11713 | exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
11714 | if (PromiseImpl === void 0) PromiseImpl = Promise;
|
11715 | var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
11716 | return exports.isGeneratorFunction(outerFn) ? iter
|
11717 | : iter.next().then(function (result) {
|
11718 | return result.done ? result.value : iter.next();
|
11719 | });
|
11720 | };
|
11721 |
|
11722 | function makeInvokeMethod(innerFn, self, context) {
|
11723 | var state = GenStateSuspendedStart;
|
11724 | return function invoke(method, arg) {
|
11725 | if (state === GenStateExecuting) {
|
11726 | throw new Error("Generator is already running");
|
11727 | }
|
11728 |
|
11729 | if (state === GenStateCompleted) {
|
11730 | if (method === "throw") {
|
11731 | throw arg;
|
11732 | }
|
11733 |
|
11734 |
|
11735 |
|
11736 | return doneResult();
|
11737 | }
|
11738 |
|
11739 | context.method = method;
|
11740 | context.arg = arg;
|
11741 |
|
11742 | while (true) {
|
11743 | var delegate = context.delegate;
|
11744 |
|
11745 | if (delegate) {
|
11746 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
11747 |
|
11748 | if (delegateResult) {
|
11749 | if (delegateResult === ContinueSentinel) continue;
|
11750 | return delegateResult;
|
11751 | }
|
11752 | }
|
11753 |
|
11754 | if (context.method === "next") {
|
11755 |
|
11756 |
|
11757 | context.sent = context._sent = context.arg;
|
11758 | } else if (context.method === "throw") {
|
11759 | if (state === GenStateSuspendedStart) {
|
11760 | state = GenStateCompleted;
|
11761 | throw context.arg;
|
11762 | }
|
11763 |
|
11764 | context.dispatchException(context.arg);
|
11765 | } else if (context.method === "return") {
|
11766 | context.abrupt("return", context.arg);
|
11767 | }
|
11768 |
|
11769 | state = GenStateExecuting;
|
11770 | var record = tryCatch(innerFn, self, context);
|
11771 |
|
11772 | if (record.type === "normal") {
|
11773 |
|
11774 |
|
11775 | state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
11776 |
|
11777 | if (record.arg === ContinueSentinel) {
|
11778 | continue;
|
11779 | }
|
11780 |
|
11781 | return {
|
11782 | value: record.arg,
|
11783 | done: context.done
|
11784 | };
|
11785 | } else if (record.type === "throw") {
|
11786 | state = GenStateCompleted;
|
11787 |
|
11788 |
|
11789 | context.method = "throw";
|
11790 | context.arg = record.arg;
|
11791 | }
|
11792 | }
|
11793 | };
|
11794 | }
|
11795 |
|
11796 |
|
11797 |
|
11798 |
|
11799 |
|
11800 | function maybeInvokeDelegate(delegate, context) {
|
11801 | var method = delegate.iterator[context.method];
|
11802 |
|
11803 | if (method === undefined$1) {
|
11804 |
|
11805 |
|
11806 | context.delegate = null;
|
11807 |
|
11808 | if (context.method === "throw") {
|
11809 |
|
11810 | if (delegate.iterator["return"]) {
|
11811 |
|
11812 |
|
11813 | context.method = "return";
|
11814 | context.arg = undefined$1;
|
11815 | maybeInvokeDelegate(delegate, context);
|
11816 |
|
11817 | if (context.method === "throw") {
|
11818 |
|
11819 |
|
11820 | return ContinueSentinel;
|
11821 | }
|
11822 | }
|
11823 |
|
11824 | context.method = "throw";
|
11825 | context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
11826 | }
|
11827 |
|
11828 | return ContinueSentinel;
|
11829 | }
|
11830 |
|
11831 | var record = tryCatch(method, delegate.iterator, context.arg);
|
11832 |
|
11833 | if (record.type === "throw") {
|
11834 | context.method = "throw";
|
11835 | context.arg = record.arg;
|
11836 | context.delegate = null;
|
11837 | return ContinueSentinel;
|
11838 | }
|
11839 |
|
11840 | var info = record.arg;
|
11841 |
|
11842 | if (!info) {
|
11843 | context.method = "throw";
|
11844 | context.arg = new TypeError("iterator result is not an object");
|
11845 | context.delegate = null;
|
11846 | return ContinueSentinel;
|
11847 | }
|
11848 |
|
11849 | if (info.done) {
|
11850 |
|
11851 |
|
11852 | context[delegate.resultName] = info.value;
|
11853 |
|
11854 | context.next = delegate.nextLoc;
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 | if (context.method !== "return") {
|
11862 | context.method = "next";
|
11863 | context.arg = undefined$1;
|
11864 | }
|
11865 | } else {
|
11866 |
|
11867 | return info;
|
11868 | }
|
11869 |
|
11870 |
|
11871 |
|
11872 | context.delegate = null;
|
11873 | return ContinueSentinel;
|
11874 | }
|
11875 |
|
11876 |
|
11877 |
|
11878 | defineIteratorMethods(Gp);
|
11879 | define(Gp, toStringTagSymbol, "Generator");
|
11880 |
|
11881 |
|
11882 |
|
11883 |
|
11884 |
|
11885 | Gp[iteratorSymbol] = function () {
|
11886 | return this;
|
11887 | };
|
11888 |
|
11889 | Gp.toString = function () {
|
11890 | return "[object Generator]";
|
11891 | };
|
11892 |
|
11893 | function pushTryEntry(locs) {
|
11894 | var entry = {
|
11895 | tryLoc: locs[0]
|
11896 | };
|
11897 |
|
11898 | if (1 in locs) {
|
11899 | entry.catchLoc = locs[1];
|
11900 | }
|
11901 |
|
11902 | if (2 in locs) {
|
11903 | entry.finallyLoc = locs[2];
|
11904 | entry.afterLoc = locs[3];
|
11905 | }
|
11906 |
|
11907 | this.tryEntries.push(entry);
|
11908 | }
|
11909 |
|
11910 | function resetTryEntry(entry) {
|
11911 | var record = entry.completion || {};
|
11912 | record.type = "normal";
|
11913 | delete record.arg;
|
11914 | entry.completion = record;
|
11915 | }
|
11916 |
|
11917 | function Context(tryLocsList) {
|
11918 |
|
11919 |
|
11920 |
|
11921 | this.tryEntries = [{
|
11922 | tryLoc: "root"
|
11923 | }];
|
11924 | tryLocsList.forEach(pushTryEntry, this);
|
11925 | this.reset(true);
|
11926 | }
|
11927 |
|
11928 | exports.keys = function (object) {
|
11929 | var keys = [];
|
11930 |
|
11931 | for (var key in object) {
|
11932 | keys.push(key);
|
11933 | }
|
11934 |
|
11935 | keys.reverse();
|
11936 |
|
11937 |
|
11938 | return function next() {
|
11939 | while (keys.length) {
|
11940 | var key = keys.pop();
|
11941 |
|
11942 | if (key in object) {
|
11943 | next.value = key;
|
11944 | next.done = false;
|
11945 | return next;
|
11946 | }
|
11947 | }
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 | next.done = true;
|
11953 | return next;
|
11954 | };
|
11955 | };
|
11956 |
|
11957 | function values(iterable) {
|
11958 | if (iterable) {
|
11959 | var iteratorMethod = iterable[iteratorSymbol];
|
11960 |
|
11961 | if (iteratorMethod) {
|
11962 | return iteratorMethod.call(iterable);
|
11963 | }
|
11964 |
|
11965 | if (typeof iterable.next === "function") {
|
11966 | return iterable;
|
11967 | }
|
11968 |
|
11969 | if (!isNaN(iterable.length)) {
|
11970 | var i = -1,
|
11971 | next = function next() {
|
11972 | while (++i < iterable.length) {
|
11973 | if (hasOwn.call(iterable, i)) {
|
11974 | next.value = iterable[i];
|
11975 | next.done = false;
|
11976 | return next;
|
11977 | }
|
11978 | }
|
11979 |
|
11980 | next.value = undefined$1;
|
11981 | next.done = true;
|
11982 | return next;
|
11983 | };
|
11984 |
|
11985 | return next.next = next;
|
11986 | }
|
11987 | }
|
11988 |
|
11989 |
|
11990 | return {
|
11991 | next: doneResult
|
11992 | };
|
11993 | }
|
11994 |
|
11995 | exports.values = values;
|
11996 |
|
11997 | function doneResult() {
|
11998 | return {
|
11999 | value: undefined$1,
|
12000 | done: true
|
12001 | };
|
12002 | }
|
12003 |
|
12004 | Context.prototype = {
|
12005 | constructor: Context,
|
12006 | reset: function (skipTempReset) {
|
12007 | this.prev = 0;
|
12008 | this.next = 0;
|
12009 |
|
12010 |
|
12011 | this.sent = this._sent = undefined$1;
|
12012 | this.done = false;
|
12013 | this.delegate = null;
|
12014 | this.method = "next";
|
12015 | this.arg = undefined$1;
|
12016 | this.tryEntries.forEach(resetTryEntry);
|
12017 |
|
12018 | if (!skipTempReset) {
|
12019 | for (var name in this) {
|
12020 |
|
12021 | if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
12022 | this[name] = undefined$1;
|
12023 | }
|
12024 | }
|
12025 | }
|
12026 | },
|
12027 | stop: function () {
|
12028 | this.done = true;
|
12029 | var rootEntry = this.tryEntries[0];
|
12030 | var rootRecord = rootEntry.completion;
|
12031 |
|
12032 | if (rootRecord.type === "throw") {
|
12033 | throw rootRecord.arg;
|
12034 | }
|
12035 |
|
12036 | return this.rval;
|
12037 | },
|
12038 | dispatchException: function (exception) {
|
12039 | if (this.done) {
|
12040 | throw exception;
|
12041 | }
|
12042 |
|
12043 | var context = this;
|
12044 |
|
12045 | function handle(loc, caught) {
|
12046 | record.type = "throw";
|
12047 | record.arg = exception;
|
12048 | context.next = loc;
|
12049 |
|
12050 | if (caught) {
|
12051 |
|
12052 |
|
12053 | context.method = "next";
|
12054 | context.arg = undefined$1;
|
12055 | }
|
12056 |
|
12057 | return !!caught;
|
12058 | }
|
12059 |
|
12060 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
12061 | var entry = this.tryEntries[i];
|
12062 | var record = entry.completion;
|
12063 |
|
12064 | if (entry.tryLoc === "root") {
|
12065 |
|
12066 |
|
12067 |
|
12068 | return handle("end");
|
12069 | }
|
12070 |
|
12071 | if (entry.tryLoc <= this.prev) {
|
12072 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
12073 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
12074 |
|
12075 | if (hasCatch && hasFinally) {
|
12076 | if (this.prev < entry.catchLoc) {
|
12077 | return handle(entry.catchLoc, true);
|
12078 | } else if (this.prev < entry.finallyLoc) {
|
12079 | return handle(entry.finallyLoc);
|
12080 | }
|
12081 | } else if (hasCatch) {
|
12082 | if (this.prev < entry.catchLoc) {
|
12083 | return handle(entry.catchLoc, true);
|
12084 | }
|
12085 | } else if (hasFinally) {
|
12086 | if (this.prev < entry.finallyLoc) {
|
12087 | return handle(entry.finallyLoc);
|
12088 | }
|
12089 | } else {
|
12090 | throw new Error("try statement without catch or finally");
|
12091 | }
|
12092 | }
|
12093 | }
|
12094 | },
|
12095 | abrupt: function (type, arg) {
|
12096 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
12097 | var entry = this.tryEntries[i];
|
12098 |
|
12099 | if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
12100 | var finallyEntry = entry;
|
12101 | break;
|
12102 | }
|
12103 | }
|
12104 |
|
12105 | if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
12106 |
|
12107 |
|
12108 | finallyEntry = null;
|
12109 | }
|
12110 |
|
12111 | var record = finallyEntry ? finallyEntry.completion : {};
|
12112 | record.type = type;
|
12113 | record.arg = arg;
|
12114 |
|
12115 | if (finallyEntry) {
|
12116 | this.method = "next";
|
12117 | this.next = finallyEntry.finallyLoc;
|
12118 | return ContinueSentinel;
|
12119 | }
|
12120 |
|
12121 | return this.complete(record);
|
12122 | },
|
12123 | complete: function (record, afterLoc) {
|
12124 | if (record.type === "throw") {
|
12125 | throw record.arg;
|
12126 | }
|
12127 |
|
12128 | if (record.type === "break" || record.type === "continue") {
|
12129 | this.next = record.arg;
|
12130 | } else if (record.type === "return") {
|
12131 | this.rval = this.arg = record.arg;
|
12132 | this.method = "return";
|
12133 | this.next = "end";
|
12134 | } else if (record.type === "normal" && afterLoc) {
|
12135 | this.next = afterLoc;
|
12136 | }
|
12137 |
|
12138 | return ContinueSentinel;
|
12139 | },
|
12140 | finish: function (finallyLoc) {
|
12141 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
12142 | var entry = this.tryEntries[i];
|
12143 |
|
12144 | if (entry.finallyLoc === finallyLoc) {
|
12145 | this.complete(entry.completion, entry.afterLoc);
|
12146 | resetTryEntry(entry);
|
12147 | return ContinueSentinel;
|
12148 | }
|
12149 | }
|
12150 | },
|
12151 | "catch": function (tryLoc) {
|
12152 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
12153 | var entry = this.tryEntries[i];
|
12154 |
|
12155 | if (entry.tryLoc === tryLoc) {
|
12156 | var record = entry.completion;
|
12157 |
|
12158 | if (record.type === "throw") {
|
12159 | var thrown = record.arg;
|
12160 | resetTryEntry(entry);
|
12161 | }
|
12162 |
|
12163 | return thrown;
|
12164 | }
|
12165 | }
|
12166 |
|
12167 |
|
12168 |
|
12169 | throw new Error("illegal catch attempt");
|
12170 | },
|
12171 | delegateYield: function (iterable, resultName, nextLoc) {
|
12172 | this.delegate = {
|
12173 | iterator: values(iterable),
|
12174 | resultName: resultName,
|
12175 | nextLoc: nextLoc
|
12176 | };
|
12177 |
|
12178 | if (this.method === "next") {
|
12179 |
|
12180 |
|
12181 | this.arg = undefined$1;
|
12182 | }
|
12183 |
|
12184 | return ContinueSentinel;
|
12185 | }
|
12186 | };
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 | return exports;
|
12192 | }(
|
12193 |
|
12194 |
|
12195 |
|
12196 | module.exports );
|
12197 |
|
12198 | try {
|
12199 | regeneratorRuntime = runtime;
|
12200 | } catch (accidentalStrictMode) {
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 | Function("r", "regeneratorRuntime = r")(runtime);
|
12211 | }
|
12212 | });
|
12213 |
|
12214 | var regenerator = runtime_1;
|
12215 |
|
12216 | var createMethod = function (IS_RIGHT) {
|
12217 | return function (that, callbackfn, argumentsLength, memo) {
|
12218 | aFunction(callbackfn);
|
12219 | var O = toObject(that);
|
12220 | var self = indexedObject(O);
|
12221 | var length = toLength(O.length);
|
12222 | var index = IS_RIGHT ? length - 1 : 0;
|
12223 | var i = IS_RIGHT ? -1 : 1;
|
12224 | if (argumentsLength < 2) while (true) {
|
12225 | if (index in self) {
|
12226 | memo = self[index];
|
12227 | index += i;
|
12228 | break;
|
12229 | }
|
12230 |
|
12231 | index += i;
|
12232 |
|
12233 | if (IS_RIGHT ? index < 0 : length <= index) {
|
12234 | throw TypeError('Reduce of empty array with no initial value');
|
12235 | }
|
12236 | }
|
12237 |
|
12238 | for (; IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
12239 | memo = callbackfn(memo, self[index], index, O);
|
12240 | }
|
12241 |
|
12242 | return memo;
|
12243 | };
|
12244 | };
|
12245 |
|
12246 | var arrayReduce = {
|
12247 |
|
12248 |
|
12249 | left: createMethod(false),
|
12250 |
|
12251 |
|
12252 | right: createMethod(true)
|
12253 | };
|
12254 |
|
12255 | var engineIsNode = classofRaw(global_1.process) == 'process';
|
12256 |
|
12257 | var $reduce = arrayReduce.left;
|
12258 | var STRICT_METHOD$2 = arrayMethodIsStrict('reduce');
|
12259 |
|
12260 |
|
12261 | var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83;
|
12262 |
|
12263 |
|
12264 | _export({
|
12265 | target: 'Array',
|
12266 | proto: true,
|
12267 | forced: !STRICT_METHOD$2 || CHROME_BUG
|
12268 | }, {
|
12269 | reduce: function reduce(callbackfn
|
12270 | /* , initialValue */
|
12271 | ) {
|
12272 | return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
12273 | }
|
12274 | });
|
12275 |
|
12276 | var reduce$2 = entryVirtual('Array').reduce;
|
12277 |
|
12278 | var ArrayPrototype$6 = Array.prototype;
|
12279 |
|
12280 | var reduce_1 = function (it) {
|
12281 | var own = it.reduce;
|
12282 | return it === ArrayPrototype$6 || it instanceof Array && own === ArrayPrototype$6.reduce ? reduce$2 : own;
|
12283 | };
|
12284 |
|
12285 | var reduce$1 = reduce_1;
|
12286 |
|
12287 | var reduce = reduce$1;
|
12288 |
|
12289 |
|
12290 |
|
12291 |
|
12292 | var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
|
12293 | var targetIndex = start;
|
12294 | var sourceIndex = 0;
|
12295 | var mapFn = mapper ? functionBindContext(mapper, thisArg, 3) : false;
|
12296 | var element;
|
12297 |
|
12298 | while (sourceIndex < sourceLen) {
|
12299 | if (sourceIndex in source) {
|
12300 | element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
12301 |
|
12302 | if (depth > 0 && isArray$5(element)) {
|
12303 | targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
|
12304 | } else {
|
12305 | if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
|
12306 | target[targetIndex] = element;
|
12307 | }
|
12308 |
|
12309 | targetIndex++;
|
12310 | }
|
12311 |
|
12312 | sourceIndex++;
|
12313 | }
|
12314 |
|
12315 | return targetIndex;
|
12316 | };
|
12317 |
|
12318 | var flattenIntoArray_1 = flattenIntoArray;
|
12319 |
|
12320 |
|
12321 |
|
12322 |
|
12323 | _export({
|
12324 | target: 'Array',
|
12325 | proto: true
|
12326 | }, {
|
12327 | flatMap: function flatMap(callbackfn
|
12328 | /* , thisArg */
|
12329 | ) {
|
12330 | var O = toObject(this);
|
12331 | var sourceLen = toLength(O.length);
|
12332 | var A;
|
12333 | aFunction(callbackfn);
|
12334 | A = arraySpeciesCreate(O, 0);
|
12335 | A.length = flattenIntoArray_1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
12336 | return A;
|
12337 | }
|
12338 | });
|
12339 |
|
12340 | var flatMap$2 = entryVirtual('Array').flatMap;
|
12341 |
|
12342 | var ArrayPrototype$5 = Array.prototype;
|
12343 |
|
12344 | var flatMap_1 = function (it) {
|
12345 | var own = it.flatMap;
|
12346 | return it === ArrayPrototype$5 || it instanceof Array && own === ArrayPrototype$5.flatMap ? flatMap$2 : own;
|
12347 | };
|
12348 |
|
12349 | var flatMap$1 = flatMap_1;
|
12350 |
|
12351 | var flatMap = flatMap$1;
|
12352 |
|
12353 | var freezing = !fails(function () {
|
12354 |
|
12355 | return Object.isExtensible(Object.preventExtensions({}));
|
12356 | });
|
12357 |
|
12358 | var internalMetadata = createCommonjsModule(function (module) {
|
12359 | var defineProperty = objectDefineProperty.f;
|
12360 | var REQUIRED = false;
|
12361 | var METADATA = uid('meta');
|
12362 | var id = 0;
|
12363 |
|
12364 | var isExtensible = Object.isExtensible || function () {
|
12365 | return true;
|
12366 | };
|
12367 |
|
12368 | var setMetadata = function (it) {
|
12369 | defineProperty(it, METADATA, {
|
12370 | value: {
|
12371 | objectID: 'O' + id++,
|
12372 |
|
12373 | weakData: {}
|
12374 |
|
12375 | }
|
12376 | });
|
12377 | };
|
12378 |
|
12379 | var fastKey = function (it, create) {
|
12380 |
|
12381 | if (!isObject$1(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
12382 |
|
12383 | if (!has$1(it, METADATA)) {
|
12384 |
|
12385 | if (!isExtensible(it)) return 'F';
|
12386 |
|
12387 | if (!create) return 'E';
|
12388 |
|
12389 | setMetadata(it);
|
12390 | }
|
12391 |
|
12392 | return it[METADATA].objectID;
|
12393 | };
|
12394 |
|
12395 | var getWeakData = function (it, create) {
|
12396 | if (!has$1(it, METADATA)) {
|
12397 |
|
12398 | if (!isExtensible(it)) return true;
|
12399 |
|
12400 | if (!create) return false;
|
12401 |
|
12402 | setMetadata(it);
|
12403 | }
|
12404 |
|
12405 | return it[METADATA].weakData;
|
12406 | };
|
12407 |
|
12408 |
|
12409 | var onFreeze = function (it) {
|
12410 | if (freezing && REQUIRED && isExtensible(it) && !has$1(it, METADATA)) setMetadata(it);
|
12411 | return it;
|
12412 | };
|
12413 |
|
12414 | var enable = function () {
|
12415 | meta.enable = function () {
|
12416 |
|
12417 | };
|
12418 |
|
12419 | REQUIRED = true;
|
12420 | var getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
12421 | var splice = [].splice;
|
12422 | var test = {};
|
12423 | test[METADATA] = 1;
|
12424 |
|
12425 | if (getOwnPropertyNames(test).length) {
|
12426 | objectGetOwnPropertyNames.f = function (it) {
|
12427 | var result = getOwnPropertyNames(it);
|
12428 |
|
12429 | for (var i = 0, length = result.length; i < length; i++) {
|
12430 | if (result[i] === METADATA) {
|
12431 | splice.call(result, i, 1);
|
12432 | break;
|
12433 | }
|
12434 | }
|
12435 |
|
12436 | return result;
|
12437 | };
|
12438 |
|
12439 | _export({
|
12440 | target: 'Object',
|
12441 | stat: true,
|
12442 | forced: true
|
12443 | }, {
|
12444 | getOwnPropertyNames: objectGetOwnPropertyNamesExternal.f
|
12445 | });
|
12446 | }
|
12447 | };
|
12448 |
|
12449 | var meta = module.exports = {
|
12450 | enable: enable,
|
12451 | fastKey: fastKey,
|
12452 | getWeakData: getWeakData,
|
12453 | onFreeze: onFreeze
|
12454 | };
|
12455 | hiddenKeys$1[METADATA] = true;
|
12456 | });
|
12457 | internalMetadata.enable;
|
12458 | internalMetadata.fastKey;
|
12459 | internalMetadata.getWeakData;
|
12460 | internalMetadata.onFreeze;
|
12461 |
|
12462 | var Result = function (stopped, result) {
|
12463 | this.stopped = stopped;
|
12464 | this.result = result;
|
12465 | };
|
12466 |
|
12467 | var iterate = function (iterable, unboundFunction, options) {
|
12468 | var that = options && options.that;
|
12469 | var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
12470 | var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
12471 | var INTERRUPTED = !!(options && options.INTERRUPTED);
|
12472 | var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
|
12473 | var iterator, iterFn, index, length, result, next, step;
|
12474 |
|
12475 | var stop = function (condition) {
|
12476 | if (iterator) iteratorClose(iterator);
|
12477 | return new Result(true, condition);
|
12478 | };
|
12479 |
|
12480 | var callFn = function (value) {
|
12481 | if (AS_ENTRIES) {
|
12482 | anObject(value);
|
12483 | return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
12484 | }
|
12485 |
|
12486 | return INTERRUPTED ? fn(value, stop) : fn(value);
|
12487 | };
|
12488 |
|
12489 | if (IS_ITERATOR) {
|
12490 | iterator = iterable;
|
12491 | } else {
|
12492 | iterFn = getIteratorMethod$3(iterable);
|
12493 | if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
|
12494 |
|
12495 | if (isArrayIteratorMethod(iterFn)) {
|
12496 | for (index = 0, length = toLength(iterable.length); length > index; index++) {
|
12497 | result = callFn(iterable[index]);
|
12498 | if (result && result instanceof Result) return result;
|
12499 | }
|
12500 |
|
12501 | return new Result(false);
|
12502 | }
|
12503 |
|
12504 | iterator = iterFn.call(iterable);
|
12505 | }
|
12506 |
|
12507 | next = iterator.next;
|
12508 |
|
12509 | while (!(step = next.call(iterator)).done) {
|
12510 | try {
|
12511 | result = callFn(step.value);
|
12512 | } catch (error) {
|
12513 | iteratorClose(iterator);
|
12514 | throw error;
|
12515 | }
|
12516 |
|
12517 | if (typeof result == 'object' && result && result instanceof Result) return result;
|
12518 | }
|
12519 |
|
12520 | return new Result(false);
|
12521 | };
|
12522 |
|
12523 | var anInstance = function (it, Constructor, name) {
|
12524 | if (!(it instanceof Constructor)) {
|
12525 | throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
|
12526 | }
|
12527 |
|
12528 | return it;
|
12529 | };
|
12530 |
|
12531 | var defineProperty$1 = objectDefineProperty.f;
|
12532 | var forEach = arrayIteration.forEach;
|
12533 | var setInternalState$1 = internalState.set;
|
12534 | var internalStateGetterFor$1 = internalState.getterFor;
|
12535 |
|
12536 | var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
|
12537 | var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
12538 | var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
12539 | var ADDER = IS_MAP ? 'set' : 'add';
|
12540 | var NativeConstructor = global_1[CONSTRUCTOR_NAME];
|
12541 | var NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
12542 | var exported = {};
|
12543 | var Constructor;
|
12544 |
|
12545 | if (!descriptors || typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
|
12546 | new NativeConstructor().entries().next();
|
12547 | }))) {
|
12548 |
|
12549 | Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
|
12550 | internalMetadata.enable();
|
12551 | } else {
|
12552 | Constructor = wrapper(function (target, iterable) {
|
12553 | setInternalState$1(anInstance(target, Constructor, CONSTRUCTOR_NAME), {
|
12554 | type: CONSTRUCTOR_NAME,
|
12555 | collection: new NativeConstructor()
|
12556 | });
|
12557 | if (iterable != undefined) iterate(iterable, target[ADDER], {
|
12558 | that: target,
|
12559 | AS_ENTRIES: IS_MAP
|
12560 | });
|
12561 | });
|
12562 | var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
|
12563 | forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
|
12564 | var IS_ADDER = KEY == 'add' || KEY == 'set';
|
12565 |
|
12566 | if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
|
12567 | createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) {
|
12568 | var collection = getInternalState(this).collection;
|
12569 | if (!IS_ADDER && IS_WEAK && !isObject$1(a)) return KEY == 'get' ? undefined : false;
|
12570 | var result = collection[KEY](a === 0 ? 0 : a, b);
|
12571 | return IS_ADDER ? this : result;
|
12572 | });
|
12573 | }
|
12574 | });
|
12575 | IS_WEAK || defineProperty$1(Constructor.prototype, 'size', {
|
12576 | configurable: true,
|
12577 | get: function () {
|
12578 | return getInternalState(this).collection.size;
|
12579 | }
|
12580 | });
|
12581 | }
|
12582 |
|
12583 | setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
|
12584 | exported[CONSTRUCTOR_NAME] = Constructor;
|
12585 | _export({
|
12586 | global: true,
|
12587 | forced: true
|
12588 | }, exported);
|
12589 | if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
|
12590 | return Constructor;
|
12591 | };
|
12592 |
|
12593 | var redefineAll = function (target, src, options) {
|
12594 | for (var key in src) {
|
12595 | if (options && options.unsafe && target[key]) target[key] = src[key];else redefine(target, key, src[key], options);
|
12596 | }
|
12597 |
|
12598 | return target;
|
12599 | };
|
12600 |
|
12601 | var SPECIES = wellKnownSymbol('species');
|
12602 |
|
12603 | var setSpecies = function (CONSTRUCTOR_NAME) {
|
12604 | var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
12605 | var defineProperty = objectDefineProperty.f;
|
12606 |
|
12607 | if (descriptors && Constructor && !Constructor[SPECIES]) {
|
12608 | defineProperty(Constructor, SPECIES, {
|
12609 | configurable: true,
|
12610 | get: function () {
|
12611 | return this;
|
12612 | }
|
12613 | });
|
12614 | }
|
12615 | };
|
12616 |
|
12617 | var defineProperty = objectDefineProperty.f;
|
12618 | var fastKey = internalMetadata.fastKey;
|
12619 | var setInternalState = internalState.set;
|
12620 | var internalStateGetterFor = internalState.getterFor;
|
12621 | var collectionStrong = {
|
12622 | getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
12623 | var C = wrapper(function (that, iterable) {
|
12624 | anInstance(that, C, CONSTRUCTOR_NAME);
|
12625 | setInternalState(that, {
|
12626 | type: CONSTRUCTOR_NAME,
|
12627 | index: objectCreate(null),
|
12628 | first: undefined,
|
12629 | last: undefined,
|
12630 | size: 0
|
12631 | });
|
12632 | if (!descriptors) that.size = 0;
|
12633 | if (iterable != undefined) iterate(iterable, that[ADDER], {
|
12634 | that: that,
|
12635 | AS_ENTRIES: IS_MAP
|
12636 | });
|
12637 | });
|
12638 | var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
12639 |
|
12640 | var define = function (that, key, value) {
|
12641 | var state = getInternalState(that);
|
12642 | var entry = getEntry(that, key);
|
12643 | var previous, index;
|
12644 |
|
12645 | if (entry) {
|
12646 | entry.value = value;
|
12647 | } else {
|
12648 | state.last = entry = {
|
12649 | index: index = fastKey(key, true),
|
12650 | key: key,
|
12651 | value: value,
|
12652 | previous: previous = state.last,
|
12653 | next: undefined,
|
12654 | removed: false
|
12655 | };
|
12656 | if (!state.first) state.first = entry;
|
12657 | if (previous) previous.next = entry;
|
12658 | if (descriptors) state.size++;else that.size++;
|
12659 |
|
12660 | if (index !== 'F') state.index[index] = entry;
|
12661 | }
|
12662 |
|
12663 | return that;
|
12664 | };
|
12665 |
|
12666 | var getEntry = function (that, key) {
|
12667 | var state = getInternalState(that);
|
12668 |
|
12669 | var index = fastKey(key);
|
12670 | var entry;
|
12671 | if (index !== 'F') return state.index[index];
|
12672 |
|
12673 | for (entry = state.first; entry; entry = entry.next) {
|
12674 | if (entry.key == key) return entry;
|
12675 | }
|
12676 | };
|
12677 |
|
12678 | redefineAll(C.prototype, {
|
12679 |
|
12680 |
|
12681 |
|
12682 | clear: function clear() {
|
12683 | var that = this;
|
12684 | var state = getInternalState(that);
|
12685 | var data = state.index;
|
12686 | var entry = state.first;
|
12687 |
|
12688 | while (entry) {
|
12689 | entry.removed = true;
|
12690 | if (entry.previous) entry.previous = entry.previous.next = undefined;
|
12691 | delete data[entry.index];
|
12692 | entry = entry.next;
|
12693 | }
|
12694 |
|
12695 | state.first = state.last = undefined;
|
12696 | if (descriptors) state.size = 0;else that.size = 0;
|
12697 | },
|
12698 |
|
12699 |
|
12700 |
|
12701 | 'delete': function (key) {
|
12702 | var that = this;
|
12703 | var state = getInternalState(that);
|
12704 | var entry = getEntry(that, key);
|
12705 |
|
12706 | if (entry) {
|
12707 | var next = entry.next;
|
12708 | var prev = entry.previous;
|
12709 | delete state.index[entry.index];
|
12710 | entry.removed = true;
|
12711 | if (prev) prev.next = next;
|
12712 | if (next) next.previous = prev;
|
12713 | if (state.first == entry) state.first = next;
|
12714 | if (state.last == entry) state.last = prev;
|
12715 | if (descriptors) state.size--;else that.size--;
|
12716 | }
|
12717 |
|
12718 | return !!entry;
|
12719 | },
|
12720 |
|
12721 |
|
12722 |
|
12723 | forEach: function forEach(callbackfn
|
12724 | /* , that = undefined */
|
12725 | ) {
|
12726 | var state = getInternalState(this);
|
12727 | var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
|
12728 | var entry;
|
12729 |
|
12730 | while (entry = entry ? entry.next : state.first) {
|
12731 | boundFunction(entry.value, entry.key, this);
|
12732 |
|
12733 | while (entry && entry.removed) entry = entry.previous;
|
12734 | }
|
12735 | },
|
12736 |
|
12737 |
|
12738 |
|
12739 | has: function has(key) {
|
12740 | return !!getEntry(this, key);
|
12741 | }
|
12742 | });
|
12743 | redefineAll(C.prototype, IS_MAP ? {
|
12744 |
|
12745 |
|
12746 | get: function get(key) {
|
12747 | var entry = getEntry(this, key);
|
12748 | return entry && entry.value;
|
12749 | },
|
12750 |
|
12751 |
|
12752 | set: function set(key, value) {
|
12753 | return define(this, key === 0 ? 0 : key, value);
|
12754 | }
|
12755 | } : {
|
12756 |
|
12757 |
|
12758 | add: function add(value) {
|
12759 | return define(this, value = value === 0 ? 0 : value, value);
|
12760 | }
|
12761 | });
|
12762 | if (descriptors) defineProperty(C.prototype, 'size', {
|
12763 | get: function () {
|
12764 | return getInternalState(this).size;
|
12765 | }
|
12766 | });
|
12767 | return C;
|
12768 | },
|
12769 | setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
|
12770 | var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
|
12771 | var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
12772 | var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 | defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
|
12783 | setInternalState(this, {
|
12784 | type: ITERATOR_NAME,
|
12785 | target: iterated,
|
12786 | state: getInternalCollectionState(iterated),
|
12787 | kind: kind,
|
12788 | last: undefined
|
12789 | });
|
12790 | }, function () {
|
12791 | var state = getInternalIteratorState(this);
|
12792 | var kind = state.kind;
|
12793 | var entry = state.last;
|
12794 |
|
12795 | while (entry && entry.removed) entry = entry.previous;
|
12796 |
|
12797 |
|
12798 | if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
|
12799 |
|
12800 | state.target = undefined;
|
12801 | return {
|
12802 | value: undefined,
|
12803 | done: true
|
12804 | };
|
12805 | }
|
12806 |
|
12807 |
|
12808 | if (kind == 'keys') return {
|
12809 | value: entry.key,
|
12810 | done: false
|
12811 | };
|
12812 | if (kind == 'values') return {
|
12813 | value: entry.value,
|
12814 | done: false
|
12815 | };
|
12816 | return {
|
12817 | value: [entry.key, entry.value],
|
12818 | done: false
|
12819 | };
|
12820 | }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
|
12821 |
|
12822 |
|
12823 |
|
12824 | setSpecies(CONSTRUCTOR_NAME);
|
12825 | }
|
12826 | };
|
12827 | collectionStrong.getConstructor;
|
12828 | collectionStrong.setStrong;
|
12829 |
|
12830 |
|
12831 |
|
12832 |
|
12833 | collection('Map', function (init) {
|
12834 | return function Map() {
|
12835 | return init(this, arguments.length ? arguments[0] : undefined);
|
12836 | };
|
12837 | }, collectionStrong);
|
12838 |
|
12839 | var map$2 = path.Map;
|
12840 |
|
12841 | var map$1 = map$2;
|
12842 |
|
12843 | var map = map$1;
|
12844 |
|
12845 |
|
12846 |
|
12847 |
|
12848 | collection('Set', function (init) {
|
12849 | return function Set() {
|
12850 | return init(this, arguments.length ? arguments[0] : undefined);
|
12851 | };
|
12852 | }, collectionStrong);
|
12853 |
|
12854 | var set$2 = path.Set;
|
12855 |
|
12856 | var set$1 = set$2;
|
12857 |
|
12858 | var set = set$1;
|
12859 |
|
12860 | var iterator = iterator$3;
|
12861 |
|
12862 | var getIterator$3 = function (it) {
|
12863 | var iteratorMethod = getIteratorMethod$3(it);
|
12864 |
|
12865 | if (typeof iteratorMethod != 'function') {
|
12866 | throw TypeError(String(it) + ' is not iterable');
|
12867 | }
|
12868 |
|
12869 | return anObject(iteratorMethod.call(it));
|
12870 | };
|
12871 |
|
12872 | var getIterator_1 = getIterator$3;
|
12873 |
|
12874 | var getIterator$2 = getIterator_1;
|
12875 |
|
12876 | var getIterator$1 = getIterator$2;
|
12877 |
|
12878 | var getIterator = getIterator$1;
|
12879 |
|
12880 |
|
12881 | var floor = Math.floor;
|
12882 |
|
12883 | var mergeSort = function (array, comparefn) {
|
12884 | var length = array.length;
|
12885 | var middle = floor(length / 2);
|
12886 | return length < 8 ? insertionSort(array, comparefn) : merge(mergeSort(array.slice(0, middle), comparefn), mergeSort(array.slice(middle), comparefn), comparefn);
|
12887 | };
|
12888 |
|
12889 | var insertionSort = function (array, comparefn) {
|
12890 | var length = array.length;
|
12891 | var i = 1;
|
12892 | var element, j;
|
12893 |
|
12894 | while (i < length) {
|
12895 | j = i;
|
12896 | element = array[i];
|
12897 |
|
12898 | while (j && comparefn(array[j - 1], element) > 0) {
|
12899 | array[j] = array[--j];
|
12900 | }
|
12901 |
|
12902 | if (j !== i++) array[j] = element;
|
12903 | }
|
12904 |
|
12905 | return array;
|
12906 | };
|
12907 |
|
12908 | var merge = function (left, right, comparefn) {
|
12909 | var llength = left.length;
|
12910 | var rlength = right.length;
|
12911 | var lindex = 0;
|
12912 | var rindex = 0;
|
12913 | var result = [];
|
12914 |
|
12915 | while (lindex < llength || rindex < rlength) {
|
12916 | if (lindex < llength && rindex < rlength) {
|
12917 | result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
|
12918 | } else {
|
12919 | result.push(lindex < llength ? left[lindex++] : right[rindex++]);
|
12920 | }
|
12921 | }
|
12922 |
|
12923 | return result;
|
12924 | };
|
12925 |
|
12926 | var arraySort = mergeSort;
|
12927 |
|
12928 | var firefox = engineUserAgent.match(/firefox\/(\d+)/i);
|
12929 | var engineFfVersion = !!firefox && +firefox[1];
|
12930 |
|
12931 | var engineIsIeOrEdge = /MSIE|Trident/.test(engineUserAgent);
|
12932 |
|
12933 | var webkit = engineUserAgent.match(/AppleWebKit\/(\d+)\./);
|
12934 | var engineWebkitVersion = !!webkit && +webkit[1];
|
12935 |
|
12936 | var test = [];
|
12937 | var nativeSort = test.sort;
|
12938 |
|
12939 | var FAILS_ON_UNDEFINED = fails(function () {
|
12940 | test.sort(undefined);
|
12941 | });
|
12942 |
|
12943 | var FAILS_ON_NULL = fails(function () {
|
12944 | test.sort(null);
|
12945 | });
|
12946 |
|
12947 | var STRICT_METHOD$1 = arrayMethodIsStrict('sort');
|
12948 | var STABLE_SORT = !fails(function () {
|
12949 |
|
12950 | if (engineV8Version) return engineV8Version < 70;
|
12951 | if (engineFfVersion && engineFfVersion > 3) return;
|
12952 | if (engineIsIeOrEdge) return true;
|
12953 | if (engineWebkitVersion) return engineWebkitVersion < 603;
|
12954 | var result = '';
|
12955 | var code, chr, value, index;
|
12956 |
|
12957 | for (code = 65; code < 76; code++) {
|
12958 | chr = String.fromCharCode(code);
|
12959 |
|
12960 | switch (code) {
|
12961 | case 66:
|
12962 | case 69:
|
12963 | case 70:
|
12964 | case 72:
|
12965 | value = 3;
|
12966 | break;
|
12967 |
|
12968 | case 68:
|
12969 | case 71:
|
12970 | value = 4;
|
12971 | break;
|
12972 |
|
12973 | default:
|
12974 | value = 2;
|
12975 | }
|
12976 |
|
12977 | for (index = 0; index < 47; index++) {
|
12978 | test.push({
|
12979 | k: chr + index,
|
12980 | v: value
|
12981 | });
|
12982 | }
|
12983 | }
|
12984 |
|
12985 | test.sort(function (a, b) {
|
12986 | return b.v - a.v;
|
12987 | });
|
12988 |
|
12989 | for (index = 0; index < test.length; index++) {
|
12990 | chr = test[index].k.charAt(0);
|
12991 | if (result.charAt(result.length - 1) !== chr) result += chr;
|
12992 | }
|
12993 |
|
12994 | return result !== 'DGBEFHACIJK';
|
12995 | });
|
12996 | var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1 || !STABLE_SORT;
|
12997 |
|
12998 | var getSortCompare = function (comparefn) {
|
12999 | return function (x, y) {
|
13000 | if (y === undefined) return -1;
|
13001 | if (x === undefined) return 1;
|
13002 | if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
13003 | return toString_1(x) > toString_1(y) ? 1 : -1;
|
13004 | };
|
13005 | };
|
13006 |
|
13007 |
|
13008 |
|
13009 | _export({
|
13010 | target: 'Array',
|
13011 | proto: true,
|
13012 | forced: FORCED$1
|
13013 | }, {
|
13014 | sort: function sort(comparefn) {
|
13015 | if (comparefn !== undefined) aFunction(comparefn);
|
13016 | var array = toObject(this);
|
13017 | if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
|
13018 | var items = [];
|
13019 | var arrayLength = toLength(array.length);
|
13020 | var itemsLength, index;
|
13021 |
|
13022 | for (index = 0; index < arrayLength; index++) {
|
13023 | if (index in array) items.push(array[index]);
|
13024 | }
|
13025 |
|
13026 | items = arraySort(items, getSortCompare(comparefn));
|
13027 | itemsLength = items.length;
|
13028 | index = 0;
|
13029 |
|
13030 | while (index < itemsLength) array[index] = items[index++];
|
13031 |
|
13032 | while (index < arrayLength) delete array[index++];
|
13033 |
|
13034 | return array;
|
13035 | }
|
13036 | });
|
13037 |
|
13038 | var sort$2 = entryVirtual('Array').sort;
|
13039 |
|
13040 | var ArrayPrototype$4 = Array.prototype;
|
13041 |
|
13042 | var sort_1 = function (it) {
|
13043 | var own = it.sort;
|
13044 | return it === ArrayPrototype$4 || it instanceof Array && own === ArrayPrototype$4.sort ? sort$2 : own;
|
13045 | };
|
13046 |
|
13047 | var sort$1 = sort_1;
|
13048 |
|
13049 | var sort = sort$1;
|
13050 |
|
13051 | var $some = arrayIteration.some;
|
13052 | var STRICT_METHOD = arrayMethodIsStrict('some');
|
13053 |
|
13054 |
|
13055 | _export({
|
13056 | target: 'Array',
|
13057 | proto: true,
|
13058 | forced: !STRICT_METHOD
|
13059 | }, {
|
13060 | some: function some(callbackfn
|
13061 | /* , thisArg */
|
13062 | ) {
|
13063 | return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
13064 | }
|
13065 | });
|
13066 |
|
13067 | var some$2 = entryVirtual('Array').some;
|
13068 |
|
13069 | var ArrayPrototype$3 = Array.prototype;
|
13070 |
|
13071 | var some_1 = function (it) {
|
13072 | var own = it.some;
|
13073 | return it === ArrayPrototype$3 || it instanceof Array && own === ArrayPrototype$3.some ? some$2 : own;
|
13074 | };
|
13075 |
|
13076 | var some$1 = some_1;
|
13077 |
|
13078 | var some = some$1;
|
13079 |
|
13080 | var keys$2 = entryVirtual('Array').keys;
|
13081 |
|
13082 | var keys$1 = keys$2;
|
13083 |
|
13084 | var ArrayPrototype$2 = Array.prototype;
|
13085 | var DOMIterables$2 = {
|
13086 | DOMTokenList: true,
|
13087 | NodeList: true
|
13088 | };
|
13089 |
|
13090 | var keys_1 = function (it) {
|
13091 | var own = it.keys;
|
13092 | return it === ArrayPrototype$2 || it instanceof Array && own === ArrayPrototype$2.keys
|
13093 | || DOMIterables$2.hasOwnProperty(classof(it)) ? keys$1 : own;
|
13094 | };
|
13095 |
|
13096 | var keys = keys_1;
|
13097 |
|
13098 | var values$2 = entryVirtual('Array').values;
|
13099 |
|
13100 | var values$1 = values$2;
|
13101 |
|
13102 | var ArrayPrototype$1 = Array.prototype;
|
13103 | var DOMIterables$1 = {
|
13104 | DOMTokenList: true,
|
13105 | NodeList: true
|
13106 | };
|
13107 |
|
13108 | var values_1 = function (it) {
|
13109 | var own = it.values;
|
13110 | return it === ArrayPrototype$1 || it instanceof Array && own === ArrayPrototype$1.values
|
13111 | || DOMIterables$1.hasOwnProperty(classof(it)) ? values$1 : own;
|
13112 | };
|
13113 |
|
13114 | var values = values_1;
|
13115 |
|
13116 | var entries$2 = entryVirtual('Array').entries;
|
13117 |
|
13118 | var entries$1 = entries$2;
|
13119 |
|
13120 | var ArrayPrototype = Array.prototype;
|
13121 | var DOMIterables = {
|
13122 | DOMTokenList: true,
|
13123 | NodeList: true
|
13124 | };
|
13125 |
|
13126 | var entries_1 = function (it) {
|
13127 | var own = it.entries;
|
13128 | return it === ArrayPrototype || it instanceof Array && own === ArrayPrototype.entries
|
13129 | || DOMIterables.hasOwnProperty(classof(it)) ? entries$1 : own;
|
13130 | };
|
13131 |
|
13132 | var entries = entries_1;
|
13133 |
|
13134 |
|
13135 |
|
13136 |
|
13137 | var getRandomValues;
|
13138 | var rnds8 = new Uint8Array(16);
|
13139 | function rng() {
|
13140 |
|
13141 | if (!getRandomValues) {
|
13142 |
|
13143 |
|
13144 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
13145 |
|
13146 | if (!getRandomValues) {
|
13147 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
13148 | }
|
13149 | }
|
13150 |
|
13151 | return getRandomValues(rnds8);
|
13152 | }
|
13153 |
|
13154 | var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
13155 |
|
13156 | function validate(uuid) {
|
13157 | return typeof uuid === 'string' && REGEX.test(uuid);
|
13158 | }
|
13159 |
|
13160 |
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 | var byteToHex = [];
|
13166 |
|
13167 | for (var i = 0; i < 256; ++i) {
|
13168 | byteToHex.push((i + 0x100).toString(16).substr(1));
|
13169 | }
|
13170 |
|
13171 | function stringify(arr) {
|
13172 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
13173 |
|
13174 |
|
13175 | var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
13176 |
|
13177 |
|
13178 |
|
13179 |
|
13180 |
|
13181 | if (!validate(uuid)) {
|
13182 | throw TypeError('Stringified UUID is invalid');
|
13183 | }
|
13184 |
|
13185 | return uuid;
|
13186 | }
|
13187 |
|
13188 | function v4(options, buf, offset) {
|
13189 | options = options || {};
|
13190 | var rnds = options.random || (options.rng || rng)();
|
13191 |
|
13192 | rnds[6] = rnds[6] & 0x0f | 0x40;
|
13193 | rnds[8] = rnds[8] & 0x3f | 0x80;
|
13194 |
|
13195 | if (buf) {
|
13196 | offset = offset || 0;
|
13197 |
|
13198 | for (var i = 0; i < 16; ++i) {
|
13199 | buf[offset + i] = rnds[i];
|
13200 | }
|
13201 |
|
13202 | return buf;
|
13203 | }
|
13204 |
|
13205 | return stringify(rnds);
|
13206 | }
|
13207 |
|
13208 | function ownKeys(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols) { var symbols = getOwnPropertySymbols(object); if (enumerableOnly) { symbols = filter(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
13209 |
|
13210 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context32; forEach$2(_context32 = ownKeys(Object(source), true)).call(_context32, function (key) { _defineProperty(target, key, source[key]); }); } else if (getOwnPropertyDescriptors) { defineProperties(target, getOwnPropertyDescriptors(source)); } else { var _context33; forEach$2(_context33 = ownKeys(Object(source))).call(_context33, function (key) { defineProperty$6(target, key, getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
13211 |
|
13212 | function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
13213 |
|
13214 | function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct) return false; if (construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
13215 |
|
13216 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof symbol !== "undefined" && getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
13217 |
|
13218 | function _unsupportedIterableToArray(o, minLen) { var _context31; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = slice$2(_context31 = Object.prototype.toString.call(o)).call(_context31, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from_1$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
13219 |
|
13220 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 |
|
13231 |
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 |
|
13246 |
|
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 | function createNewDataPipeFrom(from) {
|
13257 | return new DataPipeUnderConstruction(from);
|
13258 | }
|
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 |
|
13266 |
|
13267 |
|
13268 |
|
13269 |
|
13270 | var SimpleDataPipe = function () {
|
13271 | |
13272 |
|
13273 |
|
13274 |
|
13275 |
|
13276 |
|
13277 |
|
13278 |
|
13279 | function SimpleDataPipe(_source, _transformers, _target) {
|
13280 | var _context, _context2, _context3;
|
13281 |
|
13282 | _classCallCheck(this, SimpleDataPipe);
|
13283 |
|
13284 | this._source = _source;
|
13285 | this._transformers = _transformers;
|
13286 | this._target = _target;
|
13287 | |
13288 |
|
13289 |
|
13290 |
|
13291 | this._listeners = {
|
13292 | add: bind(_context = this._add).call(_context, this),
|
13293 | remove: bind(_context2 = this._remove).call(_context2, this),
|
13294 | update: bind(_context3 = this._update).call(_context3, this)
|
13295 | };
|
13296 | }
|
13297 |
|
13298 |
|
13299 |
|
13300 | _createClass(SimpleDataPipe, [{
|
13301 | key: "all",
|
13302 | value: function all() {
|
13303 | this._target.update(this._transformItems(this._source.get()));
|
13304 |
|
13305 | return this;
|
13306 | }
|
13307 |
|
13308 |
|
13309 | }, {
|
13310 | key: "start",
|
13311 | value: function start() {
|
13312 | this._source.on("add", this._listeners.add);
|
13313 |
|
13314 | this._source.on("remove", this._listeners.remove);
|
13315 |
|
13316 | this._source.on("update", this._listeners.update);
|
13317 |
|
13318 | return this;
|
13319 | }
|
13320 |
|
13321 |
|
13322 | }, {
|
13323 | key: "stop",
|
13324 | value: function stop() {
|
13325 | this._source.off("add", this._listeners.add);
|
13326 |
|
13327 | this._source.off("remove", this._listeners.remove);
|
13328 |
|
13329 | this._source.off("update", this._listeners.update);
|
13330 |
|
13331 | return this;
|
13332 | }
|
13333 | |
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 | }, {
|
13342 | key: "_transformItems",
|
13343 | value: function _transformItems(items) {
|
13344 | var _context4;
|
13345 |
|
13346 | return reduce(_context4 = this._transformers).call(_context4, function (items, transform) {
|
13347 | return transform(items);
|
13348 | }, items);
|
13349 | }
|
13350 | |
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 | }, {
|
13358 | key: "_add",
|
13359 | value: function _add(_name, payload) {
|
13360 | if (payload == null) {
|
13361 | return;
|
13362 | }
|
13363 |
|
13364 | this._target.add(this._transformItems(this._source.get(payload.items)));
|
13365 | }
|
13366 | |
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 | }, {
|
13374 | key: "_update",
|
13375 | value: function _update(_name, payload) {
|
13376 | if (payload == null) {
|
13377 | return;
|
13378 | }
|
13379 |
|
13380 | this._target.update(this._transformItems(this._source.get(payload.items)));
|
13381 | }
|
13382 | |
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 | }, {
|
13390 | key: "_remove",
|
13391 | value: function _remove(_name, payload) {
|
13392 | if (payload == null) {
|
13393 | return;
|
13394 | }
|
13395 |
|
13396 | this._target.remove(this._transformItems(payload.oldData));
|
13397 | }
|
13398 | }]);
|
13399 |
|
13400 | return SimpleDataPipe;
|
13401 | }();
|
13402 |
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 | var DataPipeUnderConstruction = function () {
|
13412 | |
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 | function DataPipeUnderConstruction(_source) {
|
13419 | _classCallCheck(this, DataPipeUnderConstruction);
|
13420 |
|
13421 | this._source = _source;
|
13422 | |
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 | this._transformers = [];
|
13428 | }
|
13429 | |
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 | _createClass(DataPipeUnderConstruction, [{
|
13440 | key: "filter",
|
13441 | value: function filter$1(callback) {
|
13442 | this._transformers.push(function (input) {
|
13443 | return filter(input).call(input, callback);
|
13444 | });
|
13445 |
|
13446 | return this;
|
13447 | }
|
13448 | |
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 | }, {
|
13461 | key: "map",
|
13462 | value: function map(callback) {
|
13463 | this._transformers.push(function (input) {
|
13464 | return map$3(input).call(input, callback);
|
13465 | });
|
13466 |
|
13467 | return this;
|
13468 | }
|
13469 | |
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 | }, {
|
13482 | key: "flatMap",
|
13483 | value: function flatMap$1(callback) {
|
13484 | this._transformers.push(function (input) {
|
13485 | return flatMap(input).call(input, callback);
|
13486 | });
|
13487 |
|
13488 | return this;
|
13489 | }
|
13490 | |
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 | }, {
|
13500 | key: "to",
|
13501 | value: function to(target) {
|
13502 | return new SimpleDataPipe(this._source, this._transformers, target);
|
13503 | }
|
13504 | }]);
|
13505 |
|
13506 | return DataPipeUnderConstruction;
|
13507 | }();
|
13508 |
|
13509 |
|
13510 |
|
13511 |
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 |
|
13517 | function isId(value) {
|
13518 | return typeof value === "string" || typeof value === "number";
|
13519 | }
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 |
|
13526 |
|
13527 | var Queue$1 = function () {
|
13528 | |
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 | function Queue(options) {
|
13534 | _classCallCheck(this, Queue);
|
13535 |
|
13536 | this._queue = [];
|
13537 | this._timeout = null;
|
13538 | this._extended = null;
|
13539 |
|
13540 | this.delay = null;
|
13541 | this.max = Infinity;
|
13542 | this.setOptions(options);
|
13543 | }
|
13544 | |
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 | _createClass(Queue, [{
|
13552 | key: "setOptions",
|
13553 | value: function setOptions(options) {
|
13554 | if (options && typeof options.delay !== "undefined") {
|
13555 | this.delay = options.delay;
|
13556 | }
|
13557 |
|
13558 | if (options && typeof options.max !== "undefined") {
|
13559 | this.max = options.max;
|
13560 | }
|
13561 |
|
13562 | this._flushIfNeeded();
|
13563 | }
|
13564 | |
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 |
|
13570 |
|
13571 |
|
13572 |
|
13573 |
|
13574 | }, {
|
13575 | key: "destroy",
|
13576 | value:
|
13577 | |
13578 |
|
13579 |
|
13580 | function destroy() {
|
13581 | this.flush();
|
13582 |
|
13583 | if (this._extended) {
|
13584 | var object = this._extended.object;
|
13585 | var methods = this._extended.methods;
|
13586 |
|
13587 | for (var i = 0; i < methods.length; i++) {
|
13588 | var method = methods[i];
|
13589 |
|
13590 | if (method.original) {
|
13591 |
|
13592 | object[method.name] = method.original;
|
13593 | } else {
|
13594 |
|
13595 | delete object[method.name];
|
13596 | }
|
13597 | }
|
13598 |
|
13599 | this._extended = null;
|
13600 | }
|
13601 | }
|
13602 | |
13603 |
|
13604 |
|
13605 |
|
13606 |
|
13607 |
|
13608 |
|
13609 | }, {
|
13610 | key: "replace",
|
13611 | value: function replace(object, method) {
|
13612 |
|
13613 | var me = this;
|
13614 | var original = object[method];
|
13615 |
|
13616 | if (!original) {
|
13617 | throw new Error("Method " + method + " undefined");
|
13618 | }
|
13619 |
|
13620 | object[method] = function () {
|
13621 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
13622 | args[_key] = arguments[_key];
|
13623 | }
|
13624 |
|
13625 |
|
13626 | me.queue({
|
13627 | args: args,
|
13628 | fn: original,
|
13629 | context: this
|
13630 | });
|
13631 | };
|
13632 | }
|
13633 | |
13634 |
|
13635 |
|
13636 |
|
13637 |
|
13638 |
|
13639 | }, {
|
13640 | key: "queue",
|
13641 | value: function queue(entry) {
|
13642 | if (typeof entry === "function") {
|
13643 | this._queue.push({
|
13644 | fn: entry
|
13645 | });
|
13646 | } else {
|
13647 | this._queue.push(entry);
|
13648 | }
|
13649 |
|
13650 | this._flushIfNeeded();
|
13651 | }
|
13652 | |
13653 |
|
13654 |
|
13655 |
|
13656 | }, {
|
13657 | key: "_flushIfNeeded",
|
13658 | value: function _flushIfNeeded() {
|
13659 | var _this = this;
|
13660 |
|
13661 |
|
13662 | if (this._queue.length > this.max) {
|
13663 | this.flush();
|
13664 | }
|
13665 |
|
13666 |
|
13667 | if (this._timeout != null) {
|
13668 | clearTimeout(this._timeout);
|
13669 | this._timeout = null;
|
13670 | }
|
13671 |
|
13672 | if (this.queue.length > 0 && typeof this.delay === "number") {
|
13673 | this._timeout = setTimeout$1(function () {
|
13674 | _this.flush();
|
13675 | }, this.delay);
|
13676 | }
|
13677 | }
|
13678 | |
13679 |
|
13680 |
|
13681 |
|
13682 | }, {
|
13683 | key: "flush",
|
13684 | value: function flush() {
|
13685 | var _context5, _context6;
|
13686 |
|
13687 | forEach$2(_context5 = splice(_context6 = this._queue).call(_context6, 0)).call(_context5, function (entry) {
|
13688 | entry.fn.apply(entry.context || entry.fn, entry.args || []);
|
13689 | });
|
13690 | }
|
13691 | }], [{
|
13692 | key: "extend",
|
13693 | value: function extend(object, options) {
|
13694 | var queue = new Queue(options);
|
13695 |
|
13696 | if (object.flush !== undefined) {
|
13697 | throw new Error("Target object already has a property flush");
|
13698 | }
|
13699 |
|
13700 | object.flush = function () {
|
13701 | queue.flush();
|
13702 | };
|
13703 |
|
13704 | var methods = [{
|
13705 | name: "flush",
|
13706 | original: undefined
|
13707 | }];
|
13708 |
|
13709 | if (options && options.replace) {
|
13710 | for (var i = 0; i < options.replace.length; i++) {
|
13711 | var name = options.replace[i];
|
13712 | methods.push({
|
13713 | name: name,
|
13714 |
|
13715 | original: object[name]
|
13716 | });
|
13717 |
|
13718 | queue.replace(object, name);
|
13719 | }
|
13720 | }
|
13721 |
|
13722 | queue._extended = {
|
13723 | object: object,
|
13724 | methods: methods
|
13725 | };
|
13726 | return queue;
|
13727 | }
|
13728 | }]);
|
13729 |
|
13730 | return Queue;
|
13731 | }();
|
13732 |
|
13733 |
|
13734 |
|
13735 |
|
13736 |
|
13737 |
|
13738 |
|
13739 |
|
13740 | var DataSetPart = function () {
|
13741 | function DataSetPart() {
|
13742 | _classCallCheck(this, DataSetPart);
|
13743 |
|
13744 | this._subscribers = {
|
13745 | "*": [],
|
13746 | add: [],
|
13747 | remove: [],
|
13748 | update: []
|
13749 | };
|
13750 | |
13751 |
|
13752 |
|
13753 |
|
13754 | this.subscribe = DataSetPart.prototype.on;
|
13755 | |
13756 |
|
13757 |
|
13758 |
|
13759 | this.unsubscribe = DataSetPart.prototype.off;
|
13760 | }
|
13761 | |
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 | _createClass(DataSetPart, [{
|
13771 | key: "_trigger",
|
13772 | value: function _trigger(event, payload, senderId) {
|
13773 | var _context7, _context8;
|
13774 |
|
13775 | if (event === "*") {
|
13776 | throw new Error("Cannot trigger event *");
|
13777 | }
|
13778 |
|
13779 | forEach$2(_context7 = concat(_context8 = []).call(_context8, _toConsumableArray(this._subscribers[event]), _toConsumableArray(this._subscribers["*"]))).call(_context7, function (subscriber) {
|
13780 | subscriber(event, payload, senderId != null ? senderId : null);
|
13781 | });
|
13782 | }
|
13783 | |
13784 |
|
13785 |
|
13786 |
|
13787 |
|
13788 |
|
13789 |
|
13790 |
|
13791 |
|
13792 | }, {
|
13793 | key: "on",
|
13794 | value: function on(event, callback) {
|
13795 | if (typeof callback === "function") {
|
13796 | this._subscribers[event].push(callback);
|
13797 | }
|
13798 |
|
13799 | }
|
13800 | |
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 | }, {
|
13810 | key: "off",
|
13811 | value: function off(event, callback) {
|
13812 | var _context9;
|
13813 |
|
13814 | this._subscribers[event] = filter(_context9 = this._subscribers[event]).call(_context9, function (subscriber) {
|
13815 | return subscriber !== callback;
|
13816 | });
|
13817 | }
|
13818 | }]);
|
13819 |
|
13820 | return DataSetPart;
|
13821 | }();
|
13822 |
|
13823 |
|
13824 |
|
13825 |
|
13826 |
|
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 | var DataStream = function (_Symbol$iterator) {
|
13835 | |
13836 |
|
13837 |
|
13838 |
|
13839 |
|
13840 | function DataStream(pairs) {
|
13841 | _classCallCheck(this, DataStream);
|
13842 |
|
13843 | this._pairs = pairs;
|
13844 | }
|
13845 | |
13846 |
|
13847 |
|
13848 |
|
13849 |
|
13850 | _createClass(DataStream, [{
|
13851 | key: _Symbol$iterator,
|
13852 | value:
|
13853 |
|
13854 | regenerator.mark(function value() {
|
13855 | var _iterator, _step, _step$value, id, item;
|
13856 |
|
13857 | return regenerator.wrap(function value$(_context10) {
|
13858 | while (1) {
|
13859 | switch (_context10.prev = _context10.next) {
|
13860 | case 0:
|
13861 | _iterator = _createForOfIteratorHelper(this._pairs);
|
13862 | _context10.prev = 1;
|
13863 |
|
13864 | _iterator.s();
|
13865 |
|
13866 | case 3:
|
13867 | if ((_step = _iterator.n()).done) {
|
13868 | _context10.next = 9;
|
13869 | break;
|
13870 | }
|
13871 |
|
13872 | _step$value = _slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1];
|
13873 | _context10.next = 7;
|
13874 | return [id, item];
|
13875 |
|
13876 | case 7:
|
13877 | _context10.next = 3;
|
13878 | break;
|
13879 |
|
13880 | case 9:
|
13881 | _context10.next = 14;
|
13882 | break;
|
13883 |
|
13884 | case 11:
|
13885 | _context10.prev = 11;
|
13886 | _context10.t0 = _context10["catch"](1);
|
13887 |
|
13888 | _iterator.e(_context10.t0);
|
13889 |
|
13890 | case 14:
|
13891 | _context10.prev = 14;
|
13892 |
|
13893 | _iterator.f();
|
13894 |
|
13895 | return _context10.finish(14);
|
13896 |
|
13897 | case 17:
|
13898 | case "end":
|
13899 | return _context10.stop();
|
13900 | }
|
13901 | }
|
13902 | }, value, this, [[1, 11, 14, 17]]);
|
13903 | })
|
13904 | |
13905 |
|
13906 |
|
13907 |
|
13908 | }, {
|
13909 | key: "entries",
|
13910 | value:
|
13911 |
|
13912 | regenerator.mark(function entries() {
|
13913 | var _iterator2, _step2, _step2$value, id, item;
|
13914 |
|
13915 | return regenerator.wrap(function entries$(_context11) {
|
13916 | while (1) {
|
13917 | switch (_context11.prev = _context11.next) {
|
13918 | case 0:
|
13919 | _iterator2 = _createForOfIteratorHelper(this._pairs);
|
13920 | _context11.prev = 1;
|
13921 |
|
13922 | _iterator2.s();
|
13923 |
|
13924 | case 3:
|
13925 | if ((_step2 = _iterator2.n()).done) {
|
13926 | _context11.next = 9;
|
13927 | break;
|
13928 | }
|
13929 |
|
13930 | _step2$value = _slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1];
|
13931 | _context11.next = 7;
|
13932 | return [id, item];
|
13933 |
|
13934 | case 7:
|
13935 | _context11.next = 3;
|
13936 | break;
|
13937 |
|
13938 | case 9:
|
13939 | _context11.next = 14;
|
13940 | break;
|
13941 |
|
13942 | case 11:
|
13943 | _context11.prev = 11;
|
13944 | _context11.t0 = _context11["catch"](1);
|
13945 |
|
13946 | _iterator2.e(_context11.t0);
|
13947 |
|
13948 | case 14:
|
13949 | _context11.prev = 14;
|
13950 |
|
13951 | _iterator2.f();
|
13952 |
|
13953 | return _context11.finish(14);
|
13954 |
|
13955 | case 17:
|
13956 | case "end":
|
13957 | return _context11.stop();
|
13958 | }
|
13959 | }
|
13960 | }, entries, this, [[1, 11, 14, 17]]);
|
13961 | })
|
13962 | |
13963 |
|
13964 |
|
13965 |
|
13966 | }, {
|
13967 | key: "keys",
|
13968 | value:
|
13969 |
|
13970 | regenerator.mark(function keys() {
|
13971 | var _iterator3, _step3, _step3$value, id;
|
13972 |
|
13973 | return regenerator.wrap(function keys$(_context12) {
|
13974 | while (1) {
|
13975 | switch (_context12.prev = _context12.next) {
|
13976 | case 0:
|
13977 | _iterator3 = _createForOfIteratorHelper(this._pairs);
|
13978 | _context12.prev = 1;
|
13979 |
|
13980 | _iterator3.s();
|
13981 |
|
13982 | case 3:
|
13983 | if ((_step3 = _iterator3.n()).done) {
|
13984 | _context12.next = 9;
|
13985 | break;
|
13986 | }
|
13987 |
|
13988 | _step3$value = _slicedToArray(_step3.value, 1), id = _step3$value[0];
|
13989 | _context12.next = 7;
|
13990 | return id;
|
13991 |
|
13992 | case 7:
|
13993 | _context12.next = 3;
|
13994 | break;
|
13995 |
|
13996 | case 9:
|
13997 | _context12.next = 14;
|
13998 | break;
|
13999 |
|
14000 | case 11:
|
14001 | _context12.prev = 11;
|
14002 | _context12.t0 = _context12["catch"](1);
|
14003 |
|
14004 | _iterator3.e(_context12.t0);
|
14005 |
|
14006 | case 14:
|
14007 | _context12.prev = 14;
|
14008 |
|
14009 | _iterator3.f();
|
14010 |
|
14011 | return _context12.finish(14);
|
14012 |
|
14013 | case 17:
|
14014 | case "end":
|
14015 | return _context12.stop();
|
14016 | }
|
14017 | }
|
14018 | }, keys, this, [[1, 11, 14, 17]]);
|
14019 | })
|
14020 | |
14021 |
|
14022 |
|
14023 |
|
14024 | }, {
|
14025 | key: "values",
|
14026 | value:
|
14027 |
|
14028 | regenerator.mark(function values() {
|
14029 | var _iterator4, _step4, _step4$value, item;
|
14030 |
|
14031 | return regenerator.wrap(function values$(_context13) {
|
14032 | while (1) {
|
14033 | switch (_context13.prev = _context13.next) {
|
14034 | case 0:
|
14035 | _iterator4 = _createForOfIteratorHelper(this._pairs);
|
14036 | _context13.prev = 1;
|
14037 |
|
14038 | _iterator4.s();
|
14039 |
|
14040 | case 3:
|
14041 | if ((_step4 = _iterator4.n()).done) {
|
14042 | _context13.next = 9;
|
14043 | break;
|
14044 | }
|
14045 |
|
14046 | _step4$value = _slicedToArray(_step4.value, 2), item = _step4$value[1];
|
14047 | _context13.next = 7;
|
14048 | return item;
|
14049 |
|
14050 | case 7:
|
14051 | _context13.next = 3;
|
14052 | break;
|
14053 |
|
14054 | case 9:
|
14055 | _context13.next = 14;
|
14056 | break;
|
14057 |
|
14058 | case 11:
|
14059 | _context13.prev = 11;
|
14060 | _context13.t0 = _context13["catch"](1);
|
14061 |
|
14062 | _iterator4.e(_context13.t0);
|
14063 |
|
14064 | case 14:
|
14065 | _context13.prev = 14;
|
14066 |
|
14067 | _iterator4.f();
|
14068 |
|
14069 | return _context13.finish(14);
|
14070 |
|
14071 | case 17:
|
14072 | case "end":
|
14073 | return _context13.stop();
|
14074 | }
|
14075 | }
|
14076 | }, values, this, [[1, 11, 14, 17]]);
|
14077 | })
|
14078 | |
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 | }, {
|
14088 | key: "toIdArray",
|
14089 | value: function toIdArray() {
|
14090 | var _context14;
|
14091 |
|
14092 | return map$3(_context14 = _toConsumableArray(this._pairs)).call(_context14, function (pair) {
|
14093 | return pair[0];
|
14094 | });
|
14095 | }
|
14096 | |
14097 |
|
14098 |
|
14099 |
|
14100 |
|
14101 |
|
14102 |
|
14103 |
|
14104 |
|
14105 | }, {
|
14106 | key: "toItemArray",
|
14107 | value: function toItemArray() {
|
14108 | var _context15;
|
14109 |
|
14110 | return map$3(_context15 = _toConsumableArray(this._pairs)).call(_context15, function (pair) {
|
14111 | return pair[1];
|
14112 | });
|
14113 | }
|
14114 | |
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 | }, {
|
14124 | key: "toEntryArray",
|
14125 | value: function toEntryArray() {
|
14126 | return _toConsumableArray(this._pairs);
|
14127 | }
|
14128 | |
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 | }, {
|
14138 | key: "toObjectMap",
|
14139 | value: function toObjectMap() {
|
14140 | var map = create$2(null);
|
14141 |
|
14142 | var _iterator5 = _createForOfIteratorHelper(this._pairs),
|
14143 | _step5;
|
14144 |
|
14145 | try {
|
14146 | for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
14147 | var _step5$value = _slicedToArray(_step5.value, 2),
|
14148 | id = _step5$value[0],
|
14149 | item = _step5$value[1];
|
14150 |
|
14151 | map[id] = item;
|
14152 | }
|
14153 | } catch (err) {
|
14154 | _iterator5.e(err);
|
14155 | } finally {
|
14156 | _iterator5.f();
|
14157 | }
|
14158 |
|
14159 | return map;
|
14160 | }
|
14161 | |
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 | }, {
|
14168 | key: "toMap",
|
14169 | value: function toMap() {
|
14170 | return new map(this._pairs);
|
14171 | }
|
14172 | |
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 | }, {
|
14179 | key: "toIdSet",
|
14180 | value: function toIdSet() {
|
14181 | return new set(this.toIdArray());
|
14182 | }
|
14183 | /**
|
14184 | * Return a set containing all the (unique) items in this stream.
|
14185 | *
|
14186 | * @returns The set of all items from this stream.
|
14187 | */
|
14188 |
|
14189 | }, {
|
14190 | key: "toItemSet",
|
14191 | value: function toItemSet() {
|
14192 | return new set(this.toItemArray());
|
14193 | }
|
14194 | /**
|
14195 | * Cache the items from this stream.
|
14196 | *
|
14197 | * @remarks
|
14198 | * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
|
14199 | * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
|
14200 | *
|
14201 | * ## Example
|
14202 | * ```javascript
|
14203 | * const ds = new DataSet([…])
|
14204 | *
|
14205 | * const cachedStream = ds.stream()
|
14206 | * .filter(…)
|
14207 | * .sort(…)
|
14208 | * .map(…)
|
14209 | * .cached(…) // Data are fetched, processed and cached here.
|
14210 | *
|
14211 | * ds.clear()
|
14212 | * chachedStream // Still has all the items.
|
14213 | * ```
|
14214 | *
|
14215 | * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
|
14216 | */
|
14217 |
|
14218 | }, {
|
14219 | key: "cache",
|
14220 | value: function cache() {
|
14221 | return new DataStream(_toConsumableArray(this._pairs));
|
14222 | }
|
14223 | |
14224 |
|
14225 |
|
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 |
|
14232 |
|
14233 | }, {
|
14234 | key: "distinct",
|
14235 | value: function distinct(callback) {
|
14236 | var set$1 = new set();
|
14237 |
|
14238 | var _iterator6 = _createForOfIteratorHelper(this._pairs),
|
14239 | _step6;
|
14240 |
|
14241 | try {
|
14242 | for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
14243 | var _step6$value = _slicedToArray(_step6.value, 2),
|
14244 | id = _step6$value[0],
|
14245 | item = _step6$value[1];
|
14246 |
|
14247 | set$1.add(callback(item, id));
|
14248 | }
|
14249 | } catch (err) {
|
14250 | _iterator6.e(err);
|
14251 | } finally {
|
14252 | _iterator6.f();
|
14253 | }
|
14254 |
|
14255 | return set$1;
|
14256 | }
|
14257 | /**
|
14258 | * Filter the items of the stream.
|
14259 | *
|
14260 | * @param callback - The function that decides whether an item will be included.
|
14261 | *
|
14262 | * @returns A new data stream with the filtered items.
|
14263 | */
|
14264 |
|
14265 | }, {
|
14266 | key: "filter",
|
14267 | value: function filter(callback) {
|
14268 | var pairs = this._pairs;
|
14269 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee() {
|
14270 | var _iterator7, _step7, _step7$value, id, item;
|
14271 |
|
14272 | return regenerator.wrap(function _callee$(_context16) {
|
14273 | while (1) {
|
14274 | switch (_context16.prev = _context16.next) {
|
14275 | case 0:
|
14276 | _iterator7 = _createForOfIteratorHelper(pairs);
|
14277 | _context16.prev = 1;
|
14278 |
|
14279 | _iterator7.s();
|
14280 |
|
14281 | case 3:
|
14282 | if ((_step7 = _iterator7.n()).done) {
|
14283 | _context16.next = 10;
|
14284 | break;
|
14285 | }
|
14286 |
|
14287 | _step7$value = _slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1];
|
14288 |
|
14289 | if (!callback(item, id)) {
|
14290 | _context16.next = 8;
|
14291 | break;
|
14292 | }
|
14293 |
|
14294 | _context16.next = 8;
|
14295 | return [id, item];
|
14296 |
|
14297 | case 8:
|
14298 | _context16.next = 3;
|
14299 | break;
|
14300 |
|
14301 | case 10:
|
14302 | _context16.next = 15;
|
14303 | break;
|
14304 |
|
14305 | case 12:
|
14306 | _context16.prev = 12;
|
14307 | _context16.t0 = _context16["catch"](1);
|
14308 |
|
14309 | _iterator7.e(_context16.t0);
|
14310 |
|
14311 | case 15:
|
14312 | _context16.prev = 15;
|
14313 |
|
14314 | _iterator7.f();
|
14315 |
|
14316 | return _context16.finish(15);
|
14317 |
|
14318 | case 18:
|
14319 | case "end":
|
14320 | return _context16.stop();
|
14321 | }
|
14322 | }
|
14323 | }, _callee, null, [[1, 12, 15, 18]]);
|
14324 | })));
|
14325 | }
|
14326 | |
14327 |
|
14328 |
|
14329 |
|
14330 |
|
14331 |
|
14332 | }, {
|
14333 | key: "forEach",
|
14334 | value: function forEach(callback) {
|
14335 | var _iterator8 = _createForOfIteratorHelper(this._pairs),
|
14336 | _step8;
|
14337 |
|
14338 | try {
|
14339 | for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
14340 | var _step8$value = _slicedToArray(_step8.value, 2),
|
14341 | id = _step8$value[0],
|
14342 | item = _step8$value[1];
|
14343 |
|
14344 | callback(item, id);
|
14345 | }
|
14346 | } catch (err) {
|
14347 | _iterator8.e(err);
|
14348 | } finally {
|
14349 | _iterator8.f();
|
14350 | }
|
14351 | }
|
14352 | |
14353 |
|
14354 |
|
14355 |
|
14356 |
|
14357 |
|
14358 |
|
14359 |
|
14360 |
|
14361 |
|
14362 | }, {
|
14363 | key: "map",
|
14364 | value: function map(callback) {
|
14365 | var pairs = this._pairs;
|
14366 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee2() {
|
14367 | var _iterator9, _step9, _step9$value, id, item;
|
14368 |
|
14369 | return regenerator.wrap(function _callee2$(_context17) {
|
14370 | while (1) {
|
14371 | switch (_context17.prev = _context17.next) {
|
14372 | case 0:
|
14373 | _iterator9 = _createForOfIteratorHelper(pairs);
|
14374 | _context17.prev = 1;
|
14375 |
|
14376 | _iterator9.s();
|
14377 |
|
14378 | case 3:
|
14379 | if ((_step9 = _iterator9.n()).done) {
|
14380 | _context17.next = 9;
|
14381 | break;
|
14382 | }
|
14383 |
|
14384 | _step9$value = _slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1];
|
14385 | _context17.next = 7;
|
14386 | return [id, callback(item, id)];
|
14387 |
|
14388 | case 7:
|
14389 | _context17.next = 3;
|
14390 | break;
|
14391 |
|
14392 | case 9:
|
14393 | _context17.next = 14;
|
14394 | break;
|
14395 |
|
14396 | case 11:
|
14397 | _context17.prev = 11;
|
14398 | _context17.t0 = _context17["catch"](1);
|
14399 |
|
14400 | _iterator9.e(_context17.t0);
|
14401 |
|
14402 | case 14:
|
14403 | _context17.prev = 14;
|
14404 |
|
14405 | _iterator9.f();
|
14406 |
|
14407 | return _context17.finish(14);
|
14408 |
|
14409 | case 17:
|
14410 | case "end":
|
14411 | return _context17.stop();
|
14412 | }
|
14413 | }
|
14414 | }, _callee2, null, [[1, 11, 14, 17]]);
|
14415 | })));
|
14416 | }
|
14417 | |
14418 |
|
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 | }, {
|
14426 | key: "max",
|
14427 | value: function max(callback) {
|
14428 | var iter = getIterator(this._pairs);
|
14429 |
|
14430 | var curr = iter.next();
|
14431 |
|
14432 | if (curr.done) {
|
14433 | return null;
|
14434 | }
|
14435 |
|
14436 | var maxItem = curr.value[1];
|
14437 | var maxValue = callback(curr.value[1], curr.value[0]);
|
14438 |
|
14439 | while (!(curr = iter.next()).done) {
|
14440 | var _curr$value = _slicedToArray(curr.value, 2),
|
14441 | id = _curr$value[0],
|
14442 | item = _curr$value[1];
|
14443 |
|
14444 | var _value = callback(item, id);
|
14445 |
|
14446 | if (_value > maxValue) {
|
14447 | maxValue = _value;
|
14448 | maxItem = item;
|
14449 | }
|
14450 | }
|
14451 |
|
14452 | return maxItem;
|
14453 | }
|
14454 | |
14455 |
|
14456 |
|
14457 |
|
14458 |
|
14459 |
|
14460 |
|
14461 |
|
14462 | }, {
|
14463 | key: "min",
|
14464 | value: function min(callback) {
|
14465 | var iter = getIterator(this._pairs);
|
14466 |
|
14467 | var curr = iter.next();
|
14468 |
|
14469 | if (curr.done) {
|
14470 | return null;
|
14471 | }
|
14472 |
|
14473 | var minItem = curr.value[1];
|
14474 | var minValue = callback(curr.value[1], curr.value[0]);
|
14475 |
|
14476 | while (!(curr = iter.next()).done) {
|
14477 | var _curr$value2 = _slicedToArray(curr.value, 2),
|
14478 | id = _curr$value2[0],
|
14479 | item = _curr$value2[1];
|
14480 |
|
14481 | var _value2 = callback(item, id);
|
14482 |
|
14483 | if (_value2 < minValue) {
|
14484 | minValue = _value2;
|
14485 | minItem = item;
|
14486 | }
|
14487 | }
|
14488 |
|
14489 | return minItem;
|
14490 | }
|
14491 | |
14492 |
|
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 |
|
14501 |
|
14502 | }, {
|
14503 | key: "reduce",
|
14504 | value: function reduce(callback, accumulator) {
|
14505 | var _iterator10 = _createForOfIteratorHelper(this._pairs),
|
14506 | _step10;
|
14507 |
|
14508 | try {
|
14509 | for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
14510 | var _step10$value = _slicedToArray(_step10.value, 2),
|
14511 | id = _step10$value[0],
|
14512 | item = _step10$value[1];
|
14513 |
|
14514 | accumulator = callback(accumulator, item, id);
|
14515 | }
|
14516 | } catch (err) {
|
14517 | _iterator10.e(err);
|
14518 | } finally {
|
14519 | _iterator10.f();
|
14520 | }
|
14521 |
|
14522 | return accumulator;
|
14523 | }
|
14524 | |
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 |
|
14531 |
|
14532 | }, {
|
14533 | key: "sort",
|
14534 | value: function sort$1(callback) {
|
14535 | var _this2 = this;
|
14536 |
|
14537 | return new DataStream(_defineProperty({}, iterator, function () {
|
14538 | var _context18;
|
14539 |
|
14540 | return getIterator(sort(_context18 = _toConsumableArray(_this2._pairs)).call(_context18, function (_ref, _ref2) {
|
14541 | var _ref3 = _slicedToArray(_ref, 2),
|
14542 | idA = _ref3[0],
|
14543 | itemA = _ref3[1];
|
14544 |
|
14545 | var _ref4 = _slicedToArray(_ref2, 2),
|
14546 | idB = _ref4[0],
|
14547 | itemB = _ref4[1];
|
14548 |
|
14549 | return callback(itemA, itemB, idA, idB);
|
14550 | }));
|
14551 | }));
|
14552 | }
|
14553 | }]);
|
14554 |
|
14555 | return DataStream;
|
14556 | }(iterator);
|
14557 |
|
14558 |
|
14559 |
|
14560 |
|
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 |
|
14566 |
|
14567 |
|
14568 |
|
14569 |
|
14570 |
|
14571 |
|
14572 |
|
14573 | function ensureFullItem(item, idProp) {
|
14574 | if (item[idProp] == null) {
|
14575 |
|
14576 | item[idProp] = v4();
|
14577 | }
|
14578 |
|
14579 | return item;
|
14580 | }
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 |
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 |
|
14594 |
|
14595 |
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 |
|
14611 |
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 |
|
14620 |
|
14621 |
|
14622 |
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 |
|
14641 |
|
14642 | var DataSet$1 = function (_DataSetPart) {
|
14643 | _inherits(DataSet, _DataSetPart);
|
14644 |
|
14645 | var _super = _createSuper(DataSet);
|
14646 |
|
14647 | |
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 | function DataSet(data, options) {
|
14654 | var _this3;
|
14655 |
|
14656 | _classCallCheck(this, DataSet);
|
14657 |
|
14658 | _this3 = _super.call(this);
|
14659 | _this3._queue = null;
|
14660 |
|
14661 | if (data && !isArray(data)) {
|
14662 | options = data;
|
14663 | data = [];
|
14664 | }
|
14665 |
|
14666 | _this3._options = options || {};
|
14667 | _this3._data = new map();
|
14668 |
|
14669 | _this3.length = 0;
|
14670 |
|
14671 | _this3._idProp = _this3._options.fieldId || "id";
|
14672 |
|
14673 |
|
14674 | if (data && data.length) {
|
14675 | _this3.add(data);
|
14676 | }
|
14677 |
|
14678 | _this3.setOptions(options);
|
14679 |
|
14680 | return _this3;
|
14681 | }
|
14682 |
|
14683 |
|
14684 |
|
14685 | _createClass(DataSet, [{
|
14686 | key: "idProp",
|
14687 | get: function get() {
|
14688 | return this._idProp;
|
14689 | }
|
14690 | |
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 | }, {
|
14697 | key: "setOptions",
|
14698 | value: function setOptions(options) {
|
14699 | if (options && options.queue !== undefined) {
|
14700 | if (options.queue === false) {
|
14701 |
|
14702 | if (this._queue) {
|
14703 | this._queue.destroy();
|
14704 |
|
14705 | this._queue = null;
|
14706 | }
|
14707 | } else {
|
14708 |
|
14709 | if (!this._queue) {
|
14710 | this._queue = Queue$1.extend(this, {
|
14711 | replace: ["add", "update", "remove"]
|
14712 | });
|
14713 | }
|
14714 |
|
14715 | if (options.queue && _typeof(options.queue) === "object") {
|
14716 | this._queue.setOptions(options.queue);
|
14717 | }
|
14718 | }
|
14719 | }
|
14720 | }
|
14721 | |
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 | }, {
|
14751 | key: "add",
|
14752 | value: function add(data, senderId) {
|
14753 | var _this4 = this;
|
14754 |
|
14755 | var addedIds = [];
|
14756 | var id;
|
14757 |
|
14758 | if (isArray(data)) {
|
14759 |
|
14760 | var idsToAdd = map$3(data).call(data, function (d) {
|
14761 | return d[_this4._idProp];
|
14762 | });
|
14763 |
|
14764 | if (some(idsToAdd).call(idsToAdd, function (id) {
|
14765 | return _this4._data.has(id);
|
14766 | })) {
|
14767 | throw new Error("A duplicate id was found in the parameter array.");
|
14768 | }
|
14769 |
|
14770 | for (var i = 0, len = data.length; i < len; i++) {
|
14771 | id = this._addItem(data[i]);
|
14772 | addedIds.push(id);
|
14773 | }
|
14774 | } else if (data && _typeof(data) === "object") {
|
14775 |
|
14776 | id = this._addItem(data);
|
14777 | addedIds.push(id);
|
14778 | } else {
|
14779 | throw new Error("Unknown dataType");
|
14780 | }
|
14781 |
|
14782 | if (addedIds.length) {
|
14783 | this._trigger("add", {
|
14784 | items: addedIds
|
14785 | }, senderId);
|
14786 | }
|
14787 |
|
14788 | return addedIds;
|
14789 | }
|
14790 | |
14791 |
|
14792 |
|
14793 |
|
14794 |
|
14795 |
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 |
|
14803 |
|
14804 |
|
14805 |
|
14806 |
|
14807 |
|
14808 |
|
14809 |
|
14810 |
|
14811 |
|
14812 |
|
14813 |
|
14814 |
|
14815 |
|
14816 |
|
14817 |
|
14818 |
|
14819 |
|
14820 |
|
14821 |
|
14822 |
|
14823 |
|
14824 |
|
14825 |
|
14826 |
|
14827 |
|
14828 | }, {
|
14829 | key: "update",
|
14830 | value: function update(data, senderId) {
|
14831 | var _this5 = this;
|
14832 |
|
14833 | var addedIds = [];
|
14834 | var updatedIds = [];
|
14835 | var oldData = [];
|
14836 | var updatedData = [];
|
14837 | var idProp = this._idProp;
|
14838 |
|
14839 | var addOrUpdate = function addOrUpdate(item) {
|
14840 | var origId = item[idProp];
|
14841 |
|
14842 | if (origId != null && _this5._data.has(origId)) {
|
14843 | var fullItem = item;
|
14844 |
|
14845 | var oldItem = assign$2({}, _this5._data.get(origId));
|
14846 |
|
14847 |
|
14848 | var id = _this5._updateItem(fullItem);
|
14849 |
|
14850 | updatedIds.push(id);
|
14851 | updatedData.push(fullItem);
|
14852 | oldData.push(oldItem);
|
14853 | } else {
|
14854 |
|
14855 | var _id = _this5._addItem(item);
|
14856 |
|
14857 | addedIds.push(_id);
|
14858 | }
|
14859 | };
|
14860 |
|
14861 | if (isArray(data)) {
|
14862 |
|
14863 | for (var i = 0, len = data.length; i < len; i++) {
|
14864 | if (data[i] && _typeof(data[i]) === "object") {
|
14865 | addOrUpdate(data[i]);
|
14866 | } else {
|
14867 | console.warn("Ignoring input item, which is not an object at index " + i);
|
14868 | }
|
14869 | }
|
14870 | } else if (data && _typeof(data) === "object") {
|
14871 |
|
14872 | addOrUpdate(data);
|
14873 | } else {
|
14874 | throw new Error("Unknown dataType");
|
14875 | }
|
14876 |
|
14877 | if (addedIds.length) {
|
14878 | this._trigger("add", {
|
14879 | items: addedIds
|
14880 | }, senderId);
|
14881 | }
|
14882 |
|
14883 | if (updatedIds.length) {
|
14884 | var props = {
|
14885 | items: updatedIds,
|
14886 | oldData: oldData,
|
14887 | data: updatedData
|
14888 | };
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 | this._trigger("update", props, senderId);
|
14897 | }
|
14898 |
|
14899 | return concat(addedIds).call(addedIds, updatedIds);
|
14900 | }
|
14901 | |
14902 |
|
14903 |
|
14904 |
|
14905 |
|
14906 |
|
14907 |
|
14908 |
|
14909 |
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 |
|
14915 |
|
14916 |
|
14917 |
|
14918 |
|
14919 |
|
14920 |
|
14921 |
|
14922 |
|
14923 |
|
14924 |
|
14925 |
|
14926 |
|
14927 |
|
14928 |
|
14929 |
|
14930 |
|
14931 |
|
14932 |
|
14933 |
|
14934 |
|
14935 |
|
14936 |
|
14937 |
|
14938 |
|
14939 | }, {
|
14940 | key: "updateOnly",
|
14941 | value: function updateOnly(data, senderId) {
|
14942 | var _context19,
|
14943 | _this6 = this;
|
14944 |
|
14945 | if (!isArray(data)) {
|
14946 | data = [data];
|
14947 | }
|
14948 |
|
14949 | var updateEventData = map$3(_context19 = map$3(data).call(data, function (update) {
|
14950 | var oldData = _this6._data.get(update[_this6._idProp]);
|
14951 |
|
14952 | if (oldData == null) {
|
14953 | throw new Error("Updating non-existent items is not allowed.");
|
14954 | }
|
14955 |
|
14956 | return {
|
14957 | oldData: oldData,
|
14958 | update: update
|
14959 | };
|
14960 | })).call(_context19, function (_ref5) {
|
14961 | var oldData = _ref5.oldData,
|
14962 | update = _ref5.update;
|
14963 | var id = oldData[_this6._idProp];
|
14964 | var updatedData = pureDeepObjectAssign(oldData, update);
|
14965 |
|
14966 | _this6._data.set(id, updatedData);
|
14967 |
|
14968 | return {
|
14969 | id: id,
|
14970 | oldData: oldData,
|
14971 | updatedData: updatedData
|
14972 | };
|
14973 | });
|
14974 |
|
14975 | if (updateEventData.length) {
|
14976 | var props = {
|
14977 | items: map$3(updateEventData).call(updateEventData, function (value) {
|
14978 | return value.id;
|
14979 | }),
|
14980 | oldData: map$3(updateEventData).call(updateEventData, function (value) {
|
14981 | return value.oldData;
|
14982 | }),
|
14983 | data: map$3(updateEventData).call(updateEventData, function (value) {
|
14984 | return value.updatedData;
|
14985 | })
|
14986 | };
|
14987 |
|
14988 |
|
14989 |
|
14990 |
|
14991 |
|
14992 |
|
14993 |
|
14994 | this._trigger("update", props, senderId);
|
14995 |
|
14996 | return props.items;
|
14997 | } else {
|
14998 | return [];
|
14999 | }
|
15000 | }
|
15001 |
|
15002 |
|
15003 | }, {
|
15004 | key: "get",
|
15005 | value: function get(first, second) {
|
15006 |
|
15007 |
|
15008 | var id = undefined;
|
15009 | var ids = undefined;
|
15010 | var options = undefined;
|
15011 |
|
15012 | if (isId(first)) {
|
15013 |
|
15014 | id = first;
|
15015 | options = second;
|
15016 | } else if (isArray(first)) {
|
15017 |
|
15018 | ids = first;
|
15019 | options = second;
|
15020 | } else {
|
15021 |
|
15022 | options = first;
|
15023 | }
|
15024 |
|
15025 |
|
15026 | var returnType = options && options.returnType === "Object" ? "Object" : "Array";
|
15027 |
|
15028 |
|
15029 |
|
15030 |
|
15031 |
|
15032 |
|
15033 |
|
15034 |
|
15035 |
|
15036 |
|
15037 |
|
15038 |
|
15039 | var filter$1 = options && filter(options);
|
15040 |
|
15041 | var items = [];
|
15042 | var item = undefined;
|
15043 | var itemIds = undefined;
|
15044 | var itemId = undefined;
|
15045 |
|
15046 | if (id != null) {
|
15047 |
|
15048 | item = this._data.get(id);
|
15049 |
|
15050 | if (item && filter$1 && !filter$1(item)) {
|
15051 | item = undefined;
|
15052 | }
|
15053 | } else if (ids != null) {
|
15054 |
|
15055 | for (var i = 0, len = ids.length; i < len; i++) {
|
15056 | item = this._data.get(ids[i]);
|
15057 |
|
15058 | if (item != null && (!filter$1 || filter$1(item))) {
|
15059 | items.push(item);
|
15060 | }
|
15061 | }
|
15062 | } else {
|
15063 | var _context20;
|
15064 |
|
15065 |
|
15066 | itemIds = _toConsumableArray(keys(_context20 = this._data).call(_context20));
|
15067 |
|
15068 | for (var _i = 0, _len2 = itemIds.length; _i < _len2; _i++) {
|
15069 | itemId = itemIds[_i];
|
15070 | item = this._data.get(itemId);
|
15071 |
|
15072 | if (item != null && (!filter$1 || filter$1(item))) {
|
15073 | items.push(item);
|
15074 | }
|
15075 | }
|
15076 | }
|
15077 |
|
15078 |
|
15079 | if (options && options.order && id == undefined) {
|
15080 | this._sort(items, options.order);
|
15081 | }
|
15082 |
|
15083 |
|
15084 | if (options && options.fields) {
|
15085 | var fields = options.fields;
|
15086 |
|
15087 | if (id != undefined && item != null) {
|
15088 | item = this._filterFields(item, fields);
|
15089 | } else {
|
15090 | for (var _i2 = 0, _len3 = items.length; _i2 < _len3; _i2++) {
|
15091 | items[_i2] = this._filterFields(items[_i2], fields);
|
15092 | }
|
15093 | }
|
15094 | }
|
15095 |
|
15096 |
|
15097 | if (returnType == "Object") {
|
15098 | var result = {};
|
15099 |
|
15100 | for (var _i3 = 0, _len4 = items.length; _i3 < _len4; _i3++) {
|
15101 | var resultant = items[_i3];
|
15102 |
|
15103 |
|
15104 | var _id2 = resultant[this._idProp];
|
15105 | result[_id2] = resultant;
|
15106 | }
|
15107 |
|
15108 | return result;
|
15109 | } else {
|
15110 | if (id != null) {
|
15111 | var _item;
|
15112 |
|
15113 |
|
15114 | return (_item = item) !== null && _item !== void 0 ? _item : null;
|
15115 | } else {
|
15116 |
|
15117 | return items;
|
15118 | }
|
15119 | }
|
15120 | }
|
15121 |
|
15122 |
|
15123 | }, {
|
15124 | key: "getIds",
|
15125 | value: function getIds(options) {
|
15126 | var data = this._data;
|
15127 |
|
15128 | var filter$1 = options && filter(options);
|
15129 |
|
15130 | var order = options && options.order;
|
15131 |
|
15132 | var itemIds = _toConsumableArray(keys(data).call(data));
|
15133 |
|
15134 | var ids = [];
|
15135 |
|
15136 | if (filter$1) {
|
15137 |
|
15138 | if (order) {
|
15139 |
|
15140 | var items = [];
|
15141 |
|
15142 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
15143 | var id = itemIds[i];
|
15144 |
|
15145 | var item = this._data.get(id);
|
15146 |
|
15147 | if (item != null && filter$1(item)) {
|
15148 | items.push(item);
|
15149 | }
|
15150 | }
|
15151 |
|
15152 | this._sort(items, order);
|
15153 |
|
15154 | for (var _i4 = 0, _len5 = items.length; _i4 < _len5; _i4++) {
|
15155 | ids.push(items[_i4][this._idProp]);
|
15156 | }
|
15157 | } else {
|
15158 |
|
15159 | for (var _i5 = 0, _len6 = itemIds.length; _i5 < _len6; _i5++) {
|
15160 | var _id3 = itemIds[_i5];
|
15161 |
|
15162 | var _item2 = this._data.get(_id3);
|
15163 |
|
15164 | if (_item2 != null && filter$1(_item2)) {
|
15165 | ids.push(_item2[this._idProp]);
|
15166 | }
|
15167 | }
|
15168 | }
|
15169 | } else {
|
15170 |
|
15171 | if (order) {
|
15172 |
|
15173 | var _items = [];
|
15174 |
|
15175 | for (var _i6 = 0, _len7 = itemIds.length; _i6 < _len7; _i6++) {
|
15176 | var _id4 = itemIds[_i6];
|
15177 |
|
15178 | _items.push(data.get(_id4));
|
15179 | }
|
15180 |
|
15181 | this._sort(_items, order);
|
15182 |
|
15183 | for (var _i7 = 0, _len8 = _items.length; _i7 < _len8; _i7++) {
|
15184 | ids.push(_items[_i7][this._idProp]);
|
15185 | }
|
15186 | } else {
|
15187 |
|
15188 | for (var _i8 = 0, _len9 = itemIds.length; _i8 < _len9; _i8++) {
|
15189 | var _id5 = itemIds[_i8];
|
15190 |
|
15191 | var _item3 = data.get(_id5);
|
15192 |
|
15193 | if (_item3 != null) {
|
15194 | ids.push(_item3[this._idProp]);
|
15195 | }
|
15196 | }
|
15197 | }
|
15198 | }
|
15199 |
|
15200 | return ids;
|
15201 | }
|
15202 |
|
15203 |
|
15204 | }, {
|
15205 | key: "getDataSet",
|
15206 | value: function getDataSet() {
|
15207 | return this;
|
15208 | }
|
15209 |
|
15210 |
|
15211 | }, {
|
15212 | key: "forEach",
|
15213 | value: function forEach(callback, options) {
|
15214 | var filter$1 = options && filter(options);
|
15215 |
|
15216 | var data = this._data;
|
15217 |
|
15218 | var itemIds = _toConsumableArray(keys(data).call(data));
|
15219 |
|
15220 | if (options && options.order) {
|
15221 |
|
15222 | var items = this.get(options);
|
15223 |
|
15224 | for (var i = 0, len = items.length; i < len; i++) {
|
15225 | var item = items[i];
|
15226 | var id = item[this._idProp];
|
15227 | callback(item, id);
|
15228 | }
|
15229 | } else {
|
15230 |
|
15231 | for (var _i9 = 0, _len10 = itemIds.length; _i9 < _len10; _i9++) {
|
15232 | var _id6 = itemIds[_i9];
|
15233 |
|
15234 | var _item4 = this._data.get(_id6);
|
15235 |
|
15236 | if (_item4 != null && (!filter$1 || filter$1(_item4))) {
|
15237 | callback(_item4, _id6);
|
15238 | }
|
15239 | }
|
15240 | }
|
15241 | }
|
15242 |
|
15243 |
|
15244 | }, {
|
15245 | key: "map",
|
15246 | value: function map(callback, options) {
|
15247 | var filter$1 = options && filter(options);
|
15248 |
|
15249 | var mappedItems = [];
|
15250 | var data = this._data;
|
15251 |
|
15252 | var itemIds = _toConsumableArray(keys(data).call(data));
|
15253 |
|
15254 |
|
15255 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
15256 | var id = itemIds[i];
|
15257 |
|
15258 | var item = this._data.get(id);
|
15259 |
|
15260 | if (item != null && (!filter$1 || filter$1(item))) {
|
15261 | mappedItems.push(callback(item, id));
|
15262 | }
|
15263 | }
|
15264 |
|
15265 |
|
15266 | if (options && options.order) {
|
15267 | this._sort(mappedItems, options.order);
|
15268 | }
|
15269 |
|
15270 | return mappedItems;
|
15271 | }
|
15272 | |
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 | }, {
|
15284 | key: "_filterFields",
|
15285 | value: function _filterFields(item, fields) {
|
15286 | var _context21;
|
15287 |
|
15288 | if (!item) {
|
15289 |
|
15290 | return item;
|
15291 | }
|
15292 |
|
15293 | return reduce(_context21 = isArray(fields) ?
|
15294 | fields :
|
15295 | keys$3(fields)).call(_context21, function (filteredItem, field) {
|
15296 | filteredItem[field] = item[field];
|
15297 | return filteredItem;
|
15298 | }, {});
|
15299 | }
|
15300 | |
15301 |
|
15302 |
|
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 |
|
15309 | }, {
|
15310 | key: "_sort",
|
15311 | value: function _sort(items, order) {
|
15312 | if (typeof order === "string") {
|
15313 |
|
15314 | var name = order;
|
15315 |
|
15316 | sort(items).call(items, function (a, b) {
|
15317 |
|
15318 | var av = a[name];
|
15319 | var bv = b[name];
|
15320 | return av > bv ? 1 : av < bv ? -1 : 0;
|
15321 | });
|
15322 | } else if (typeof order === "function") {
|
15323 |
|
15324 | sort(items).call(items, order);
|
15325 | } else {
|
15326 |
|
15327 |
|
15328 | throw new TypeError("Order must be a function or a string");
|
15329 | }
|
15330 | }
|
15331 | |
15332 |
|
15333 |
|
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 |
|
15339 |
|
15340 |
|
15341 |
|
15342 |
|
15343 |
|
15344 |
|
15345 |
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 |
|
15352 |
|
15353 |
|
15354 |
|
15355 |
|
15356 |
|
15357 |
|
15358 |
|
15359 | }, {
|
15360 | key: "remove",
|
15361 | value: function remove(id, senderId) {
|
15362 | var removedIds = [];
|
15363 | var removedItems = [];
|
15364 |
|
15365 | var ids = isArray(id) ? id : [id];
|
15366 |
|
15367 | for (var i = 0, len = ids.length; i < len; i++) {
|
15368 | var item = this._remove(ids[i]);
|
15369 |
|
15370 | if (item) {
|
15371 | var itemId = item[this._idProp];
|
15372 |
|
15373 | if (itemId != null) {
|
15374 | removedIds.push(itemId);
|
15375 | removedItems.push(item);
|
15376 | }
|
15377 | }
|
15378 | }
|
15379 |
|
15380 | if (removedIds.length) {
|
15381 | this._trigger("remove", {
|
15382 | items: removedIds,
|
15383 | oldData: removedItems
|
15384 | }, senderId);
|
15385 | }
|
15386 |
|
15387 | return removedIds;
|
15388 | }
|
15389 | |
15390 |
|
15391 |
|
15392 |
|
15393 |
|
15394 |
|
15395 |
|
15396 |
|
15397 | }, {
|
15398 | key: "_remove",
|
15399 | value: function _remove(id) {
|
15400 |
|
15401 |
|
15402 | var ident;
|
15403 |
|
15404 | if (isId(id)) {
|
15405 | ident = id;
|
15406 | } else if (id && _typeof(id) === "object") {
|
15407 | ident = id[this._idProp];
|
15408 | }
|
15409 |
|
15410 |
|
15411 | if (ident != null && this._data.has(ident)) {
|
15412 | var item = this._data.get(ident) || null;
|
15413 |
|
15414 | this._data.delete(ident);
|
15415 |
|
15416 | --this.length;
|
15417 | return item;
|
15418 | }
|
15419 |
|
15420 | return null;
|
15421 | }
|
15422 | |
15423 |
|
15424 |
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 | }, {
|
15433 | key: "clear",
|
15434 | value: function clear(senderId) {
|
15435 | var _context22;
|
15436 |
|
15437 | var ids = _toConsumableArray(keys(_context22 = this._data).call(_context22));
|
15438 |
|
15439 | var items = [];
|
15440 |
|
15441 | for (var i = 0, len = ids.length; i < len; i++) {
|
15442 | items.push(this._data.get(ids[i]));
|
15443 | }
|
15444 |
|
15445 | this._data.clear();
|
15446 |
|
15447 | this.length = 0;
|
15448 |
|
15449 | this._trigger("remove", {
|
15450 | items: ids,
|
15451 | oldData: items
|
15452 | }, senderId);
|
15453 |
|
15454 | return ids;
|
15455 | }
|
15456 | |
15457 |
|
15458 |
|
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 | }, {
|
15465 | key: "max",
|
15466 | value: function max(field) {
|
15467 | var _context23;
|
15468 |
|
15469 | var max = null;
|
15470 | var maxField = null;
|
15471 |
|
15472 | var _iterator11 = _createForOfIteratorHelper(values(_context23 = this._data).call(_context23)),
|
15473 | _step11;
|
15474 |
|
15475 | try {
|
15476 | for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
15477 | var item = _step11.value;
|
15478 | var itemField = item[field];
|
15479 |
|
15480 | if (typeof itemField === "number" && (maxField == null || itemField > maxField)) {
|
15481 | max = item;
|
15482 | maxField = itemField;
|
15483 | }
|
15484 | }
|
15485 | } catch (err) {
|
15486 | _iterator11.e(err);
|
15487 | } finally {
|
15488 | _iterator11.f();
|
15489 | }
|
15490 |
|
15491 | return max || null;
|
15492 | }
|
15493 | |
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 |
|
15501 | }, {
|
15502 | key: "min",
|
15503 | value: function min(field) {
|
15504 | var _context24;
|
15505 |
|
15506 | var min = null;
|
15507 | var minField = null;
|
15508 |
|
15509 | var _iterator12 = _createForOfIteratorHelper(values(_context24 = this._data).call(_context24)),
|
15510 | _step12;
|
15511 |
|
15512 | try {
|
15513 | for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
15514 | var item = _step12.value;
|
15515 | var itemField = item[field];
|
15516 |
|
15517 | if (typeof itemField === "number" && (minField == null || itemField < minField)) {
|
15518 | min = item;
|
15519 | minField = itemField;
|
15520 | }
|
15521 | }
|
15522 | } catch (err) {
|
15523 | _iterator12.e(err);
|
15524 | } finally {
|
15525 | _iterator12.f();
|
15526 | }
|
15527 |
|
15528 | return min || null;
|
15529 | }
|
15530 | |
15531 |
|
15532 |
|
15533 |
|
15534 |
|
15535 |
|
15536 |
|
15537 |
|
15538 | }, {
|
15539 | key: "distinct",
|
15540 | value: function distinct(prop) {
|
15541 | var data = this._data;
|
15542 |
|
15543 | var itemIds = _toConsumableArray(keys(data).call(data));
|
15544 |
|
15545 | var values = [];
|
15546 | var count = 0;
|
15547 |
|
15548 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
15549 | var id = itemIds[i];
|
15550 | var item = data.get(id);
|
15551 | var _value3 = item[prop];
|
15552 | var exists = false;
|
15553 |
|
15554 | for (var j = 0; j < count; j++) {
|
15555 | if (values[j] == _value3) {
|
15556 | exists = true;
|
15557 | break;
|
15558 | }
|
15559 | }
|
15560 |
|
15561 | if (!exists && _value3 !== undefined) {
|
15562 | values[count] = _value3;
|
15563 | count++;
|
15564 | }
|
15565 | }
|
15566 |
|
15567 | return values;
|
15568 | }
|
15569 | |
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 | }, {
|
15578 | key: "_addItem",
|
15579 | value: function _addItem(item) {
|
15580 | var fullItem = ensureFullItem(item, this._idProp);
|
15581 | var id = fullItem[this._idProp];
|
15582 |
|
15583 | if (this._data.has(id)) {
|
15584 |
|
15585 | throw new Error("Cannot add item: item with id " + id + " already exists");
|
15586 | }
|
15587 |
|
15588 | this._data.set(id, fullItem);
|
15589 |
|
15590 | ++this.length;
|
15591 | return id;
|
15592 | }
|
15593 | |
15594 |
|
15595 |
|
15596 |
|
15597 |
|
15598 |
|
15599 |
|
15600 |
|
15601 |
|
15602 | }, {
|
15603 | key: "_updateItem",
|
15604 | value: function _updateItem(update) {
|
15605 | var id = update[this._idProp];
|
15606 |
|
15607 | if (id == null) {
|
15608 | throw new Error("Cannot update item: item has no id (item: " + stringify$1(update) + ")");
|
15609 | }
|
15610 |
|
15611 | var item = this._data.get(id);
|
15612 |
|
15613 | if (!item) {
|
15614 |
|
15615 | throw new Error("Cannot update item: no item with id " + id + " found");
|
15616 | }
|
15617 |
|
15618 | this._data.set(id, _objectSpread(_objectSpread({}, item), update));
|
15619 |
|
15620 | return id;
|
15621 | }
|
15622 |
|
15623 |
|
15624 | }, {
|
15625 | key: "stream",
|
15626 | value: function stream(ids) {
|
15627 | if (ids) {
|
15628 | var data = this._data;
|
15629 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee3() {
|
15630 | var _iterator13, _step13, id, item;
|
15631 |
|
15632 | return regenerator.wrap(function _callee3$(_context25) {
|
15633 | while (1) {
|
15634 | switch (_context25.prev = _context25.next) {
|
15635 | case 0:
|
15636 | _iterator13 = _createForOfIteratorHelper(ids);
|
15637 | _context25.prev = 1;
|
15638 |
|
15639 | _iterator13.s();
|
15640 |
|
15641 | case 3:
|
15642 | if ((_step13 = _iterator13.n()).done) {
|
15643 | _context25.next = 11;
|
15644 | break;
|
15645 | }
|
15646 |
|
15647 | id = _step13.value;
|
15648 | item = data.get(id);
|
15649 |
|
15650 | if (!(item != null)) {
|
15651 | _context25.next = 9;
|
15652 | break;
|
15653 | }
|
15654 |
|
15655 | _context25.next = 9;
|
15656 | return [id, item];
|
15657 |
|
15658 | case 9:
|
15659 | _context25.next = 3;
|
15660 | break;
|
15661 |
|
15662 | case 11:
|
15663 | _context25.next = 16;
|
15664 | break;
|
15665 |
|
15666 | case 13:
|
15667 | _context25.prev = 13;
|
15668 | _context25.t0 = _context25["catch"](1);
|
15669 |
|
15670 | _iterator13.e(_context25.t0);
|
15671 |
|
15672 | case 16:
|
15673 | _context25.prev = 16;
|
15674 |
|
15675 | _iterator13.f();
|
15676 |
|
15677 | return _context25.finish(16);
|
15678 |
|
15679 | case 19:
|
15680 | case "end":
|
15681 | return _context25.stop();
|
15682 | }
|
15683 | }
|
15684 | }, _callee3, null, [[1, 13, 16, 19]]);
|
15685 | })));
|
15686 | } else {
|
15687 | var _context26;
|
15688 |
|
15689 | return new DataStream(_defineProperty({}, iterator, bind(_context26 = entries(this._data)).call(_context26, this._data)));
|
15690 | }
|
15691 | }
|
15692 | }]);
|
15693 |
|
15694 | return DataSet;
|
15695 | }(DataSetPart);
|
15696 |
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 |
|
15702 |
|
15703 |
|
15704 |
|
15705 |
|
15706 |
|
15707 |
|
15708 |
|
15709 |
|
15710 |
|
15711 |
|
15712 |
|
15713 |
|
15714 |
|
15715 |
|
15716 |
|
15717 |
|
15718 |
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 |
|
15725 |
|
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 |
|
15735 |
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 |
|
15741 |
|
15742 |
|
15743 | var DataView$1 = function (_DataSetPart2) {
|
15744 | _inherits(DataView, _DataSetPart2);
|
15745 |
|
15746 | var _super2 = _createSuper(DataView);
|
15747 |
|
15748 | |
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 |
|
15754 | function DataView(data, options) {
|
15755 | var _context27;
|
15756 |
|
15757 | var _this7;
|
15758 |
|
15759 | _classCallCheck(this, DataView);
|
15760 |
|
15761 | _this7 = _super2.call(this);
|
15762 |
|
15763 |
|
15764 | _this7.length = 0;
|
15765 | _this7._ids = new set(); // ids of the items currently in memory (just contains a boolean true)
|
15766 |
|
15767 | _this7._options = options || {};
|
15768 | _this7._listener = bind(_context27 = _this7._onEvent).call(_context27, _assertThisInitialized(_this7));
|
15769 |
|
15770 | _this7.setData(data);
|
15771 |
|
15772 | return _this7;
|
15773 | }
|
15774 |
|
15775 |
|
15776 |
|
15777 | _createClass(DataView, [{
|
15778 | key: "idProp",
|
15779 | get: function get() {
|
15780 | return this.getDataSet().idProp;
|
15781 | }
|
15782 |
|
15783 |
|
15784 | |
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 |
|
15790 |
|
15791 |
|
15792 |
|
15793 |
|
15794 |
|
15795 |
|
15796 | }, {
|
15797 | key: "setData",
|
15798 | value: function setData(data) {
|
15799 | if (this._data) {
|
15800 |
|
15801 | if (this._data.off) {
|
15802 | this._data.off("*", this._listener);
|
15803 | }
|
15804 |
|
15805 |
|
15806 | var ids = this._data.getIds({
|
15807 | filter: filter(this._options)
|
15808 | });
|
15809 |
|
15810 | var items = this._data.get(ids);
|
15811 |
|
15812 | this._ids.clear();
|
15813 |
|
15814 | this.length = 0;
|
15815 |
|
15816 | this._trigger("remove", {
|
15817 | items: ids,
|
15818 | oldData: items
|
15819 | });
|
15820 | }
|
15821 |
|
15822 | if (data != null) {
|
15823 | this._data = data;
|
15824 |
|
15825 | var _ids = this._data.getIds({
|
15826 | filter: filter(this._options)
|
15827 | });
|
15828 |
|
15829 | for (var i = 0, len = _ids.length; i < len; i++) {
|
15830 | var id = _ids[i];
|
15831 |
|
15832 | this._ids.add(id);
|
15833 | }
|
15834 |
|
15835 | this.length = _ids.length;
|
15836 |
|
15837 | this._trigger("add", {
|
15838 | items: _ids
|
15839 | });
|
15840 | } else {
|
15841 | this._data = new DataSet$1();
|
15842 | }
|
15843 |
|
15844 |
|
15845 | if (this._data.on) {
|
15846 | this._data.on("*", this._listener);
|
15847 | }
|
15848 | }
|
15849 | |
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 | }, {
|
15855 | key: "refresh",
|
15856 | value: function refresh() {
|
15857 | var ids = this._data.getIds({
|
15858 | filter: filter(this._options)
|
15859 | });
|
15860 |
|
15861 | var oldIds = _toConsumableArray(this._ids);
|
15862 |
|
15863 | var newIds = {};
|
15864 | var addedIds = [];
|
15865 | var removedIds = [];
|
15866 | var removedItems = [];
|
15867 |
|
15868 | for (var i = 0, len = ids.length; i < len; i++) {
|
15869 | var id = ids[i];
|
15870 | newIds[id] = true;
|
15871 |
|
15872 | if (!this._ids.has(id)) {
|
15873 | addedIds.push(id);
|
15874 |
|
15875 | this._ids.add(id);
|
15876 | }
|
15877 | }
|
15878 |
|
15879 |
|
15880 | for (var _i10 = 0, _len11 = oldIds.length; _i10 < _len11; _i10++) {
|
15881 | var _id7 = oldIds[_i10];
|
15882 |
|
15883 | var item = this._data.get(_id7);
|
15884 |
|
15885 | if (item == null) {
|
15886 |
|
15887 |
|
15888 |
|
15889 |
|
15890 | console.error("If you see this, report it please.");
|
15891 | } else if (!newIds[_id7]) {
|
15892 | removedIds.push(_id7);
|
15893 | removedItems.push(item);
|
15894 |
|
15895 | this._ids.delete(_id7);
|
15896 | }
|
15897 | }
|
15898 |
|
15899 | this.length += addedIds.length - removedIds.length;
|
15900 |
|
15901 | if (addedIds.length) {
|
15902 | this._trigger("add", {
|
15903 | items: addedIds
|
15904 | });
|
15905 | }
|
15906 |
|
15907 | if (removedIds.length) {
|
15908 | this._trigger("remove", {
|
15909 | items: removedIds,
|
15910 | oldData: removedItems
|
15911 | });
|
15912 | }
|
15913 | }
|
15914 |
|
15915 |
|
15916 | }, {
|
15917 | key: "get",
|
15918 | value: function get(first, second) {
|
15919 | if (this._data == null) {
|
15920 | return null;
|
15921 | }
|
15922 |
|
15923 |
|
15924 | var ids = null;
|
15925 | var options;
|
15926 |
|
15927 | if (isId(first) || isArray(first)) {
|
15928 | ids = first;
|
15929 | options = second;
|
15930 | } else {
|
15931 | options = first;
|
15932 | }
|
15933 |
|
15934 |
|
15935 | var viewOptions = assign$2({}, this._options, options);
|
15936 |
|
15937 |
|
15938 | var thisFilter = filter(this._options);
|
15939 |
|
15940 | var optionsFilter = options && filter(options);
|
15941 |
|
15942 | if (thisFilter && optionsFilter) {
|
15943 | viewOptions.filter = function (item) {
|
15944 | return thisFilter(item) && optionsFilter(item);
|
15945 | };
|
15946 | }
|
15947 |
|
15948 | if (ids == null) {
|
15949 | return this._data.get(viewOptions);
|
15950 | } else {
|
15951 | return this._data.get(ids, viewOptions);
|
15952 | }
|
15953 | }
|
15954 |
|
15955 |
|
15956 | }, {
|
15957 | key: "getIds",
|
15958 | value: function getIds(options) {
|
15959 | if (this._data.length) {
|
15960 | var defaultFilter = filter(this._options);
|
15961 |
|
15962 | var optionsFilter = options != null ? filter(options) : null;
|
15963 | var filter$1;
|
15964 |
|
15965 | if (optionsFilter) {
|
15966 | if (defaultFilter) {
|
15967 | filter$1 = function filter(item) {
|
15968 | return defaultFilter(item) && optionsFilter(item);
|
15969 | };
|
15970 | } else {
|
15971 | filter$1 = optionsFilter;
|
15972 | }
|
15973 | } else {
|
15974 | filter$1 = defaultFilter;
|
15975 | }
|
15976 |
|
15977 | return this._data.getIds({
|
15978 | filter: filter$1,
|
15979 | order: options && options.order
|
15980 | });
|
15981 | } else {
|
15982 | return [];
|
15983 | }
|
15984 | }
|
15985 |
|
15986 |
|
15987 | }, {
|
15988 | key: "forEach",
|
15989 | value: function forEach(callback, options) {
|
15990 | if (this._data) {
|
15991 | var _context28;
|
15992 |
|
15993 | var defaultFilter = filter(this._options);
|
15994 |
|
15995 | var optionsFilter = options && filter(options);
|
15996 |
|
15997 | var filter$1;
|
15998 |
|
15999 | if (optionsFilter) {
|
16000 | if (defaultFilter) {
|
16001 | filter$1 = function filter(item) {
|
16002 | return defaultFilter(item) && optionsFilter(item);
|
16003 | };
|
16004 | } else {
|
16005 | filter$1 = optionsFilter;
|
16006 | }
|
16007 | } else {
|
16008 | filter$1 = defaultFilter;
|
16009 | }
|
16010 |
|
16011 | forEach$2(_context28 = this._data).call(_context28, callback, {
|
16012 | filter: filter$1,
|
16013 | order: options && options.order
|
16014 | });
|
16015 | }
|
16016 | }
|
16017 |
|
16018 |
|
16019 | }, {
|
16020 | key: "map",
|
16021 | value: function map(callback, options) {
|
16022 | if (this._data) {
|
16023 | var _context29;
|
16024 |
|
16025 | var defaultFilter = filter(this._options);
|
16026 |
|
16027 | var optionsFilter = options && filter(options);
|
16028 |
|
16029 | var filter$1;
|
16030 |
|
16031 | if (optionsFilter) {
|
16032 | if (defaultFilter) {
|
16033 | filter$1 = function filter(item) {
|
16034 | return defaultFilter(item) && optionsFilter(item);
|
16035 | };
|
16036 | } else {
|
16037 | filter$1 = optionsFilter;
|
16038 | }
|
16039 | } else {
|
16040 | filter$1 = defaultFilter;
|
16041 | }
|
16042 |
|
16043 | return map$3(_context29 = this._data).call(_context29, callback, {
|
16044 | filter: filter$1,
|
16045 | order: options && options.order
|
16046 | });
|
16047 | } else {
|
16048 | return [];
|
16049 | }
|
16050 | }
|
16051 |
|
16052 |
|
16053 | }, {
|
16054 | key: "getDataSet",
|
16055 | value: function getDataSet() {
|
16056 | return this._data.getDataSet();
|
16057 | }
|
16058 |
|
16059 |
|
16060 | }, {
|
16061 | key: "stream",
|
16062 | value: function stream(ids) {
|
16063 | var _context30;
|
16064 |
|
16065 | return this._data.stream(ids || _defineProperty({}, iterator, bind(_context30 = keys(this._ids)).call(_context30, this._ids)));
|
16066 | }
|
16067 | |
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 |
|
16074 |
|
16075 |
|
16076 | }, {
|
16077 | key: "dispose",
|
16078 | value: function dispose() {
|
16079 | var _this$_data;
|
16080 |
|
16081 | if ((_this$_data = this._data) !== null && _this$_data !== void 0 && _this$_data.off) {
|
16082 | this._data.off("*", this._listener);
|
16083 | }
|
16084 |
|
16085 | var message = "This data view has already been disposed of.";
|
16086 | var replacement = {
|
16087 | get: function get() {
|
16088 | throw new Error(message);
|
16089 | },
|
16090 | set: function set() {
|
16091 | throw new Error(message);
|
16092 | },
|
16093 | configurable: false
|
16094 | };
|
16095 |
|
16096 | var _iterator14 = _createForOfIteratorHelper(ownKeys$2(DataView.prototype)),
|
16097 | _step14;
|
16098 |
|
16099 | try {
|
16100 | for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
16101 | var key = _step14.value;
|
16102 |
|
16103 | defineProperty$6(this, key, replacement);
|
16104 | }
|
16105 | } catch (err) {
|
16106 | _iterator14.e(err);
|
16107 | } finally {
|
16108 | _iterator14.f();
|
16109 | }
|
16110 | }
|
16111 | |
16112 |
|
16113 |
|
16114 |
|
16115 |
|
16116 |
|
16117 |
|
16118 |
|
16119 | }, {
|
16120 | key: "_onEvent",
|
16121 | value: function _onEvent(event, params, senderId) {
|
16122 | if (!params || !params.items || !this._data) {
|
16123 | return;
|
16124 | }
|
16125 |
|
16126 | var ids = params.items;
|
16127 | var addedIds = [];
|
16128 | var updatedIds = [];
|
16129 | var removedIds = [];
|
16130 | var oldItems = [];
|
16131 | var updatedItems = [];
|
16132 | var removedItems = [];
|
16133 |
|
16134 | switch (event) {
|
16135 | case "add":
|
16136 |
|
16137 | for (var i = 0, len = ids.length; i < len; i++) {
|
16138 | var id = ids[i];
|
16139 | var item = this.get(id);
|
16140 |
|
16141 | if (item) {
|
16142 | this._ids.add(id);
|
16143 |
|
16144 | addedIds.push(id);
|
16145 | }
|
16146 | }
|
16147 |
|
16148 | break;
|
16149 |
|
16150 | case "update":
|
16151 |
|
16152 |
|
16153 | for (var _i11 = 0, _len12 = ids.length; _i11 < _len12; _i11++) {
|
16154 | var _id8 = ids[_i11];
|
16155 |
|
16156 | var _item5 = this.get(_id8);
|
16157 |
|
16158 | if (_item5) {
|
16159 | if (this._ids.has(_id8)) {
|
16160 | updatedIds.push(_id8);
|
16161 | updatedItems.push(params.data[_i11]);
|
16162 | oldItems.push(params.oldData[_i11]);
|
16163 | } else {
|
16164 | this._ids.add(_id8);
|
16165 |
|
16166 | addedIds.push(_id8);
|
16167 | }
|
16168 | } else {
|
16169 | if (this._ids.has(_id8)) {
|
16170 | this._ids.delete(_id8);
|
16171 |
|
16172 | removedIds.push(_id8);
|
16173 | removedItems.push(params.oldData[_i11]);
|
16174 | }
|
16175 | }
|
16176 | }
|
16177 |
|
16178 | break;
|
16179 |
|
16180 | case "remove":
|
16181 |
|
16182 | for (var _i12 = 0, _len13 = ids.length; _i12 < _len13; _i12++) {
|
16183 | var _id9 = ids[_i12];
|
16184 |
|
16185 | if (this._ids.has(_id9)) {
|
16186 | this._ids.delete(_id9);
|
16187 |
|
16188 | removedIds.push(_id9);
|
16189 | removedItems.push(params.oldData[_i12]);
|
16190 | }
|
16191 | }
|
16192 |
|
16193 | break;
|
16194 | }
|
16195 |
|
16196 | this.length += addedIds.length - removedIds.length;
|
16197 |
|
16198 | if (addedIds.length) {
|
16199 | this._trigger("add", {
|
16200 | items: addedIds
|
16201 | }, senderId);
|
16202 | }
|
16203 |
|
16204 | if (updatedIds.length) {
|
16205 | this._trigger("update", {
|
16206 | items: updatedIds,
|
16207 | oldData: oldItems,
|
16208 | data: updatedItems
|
16209 | }, senderId);
|
16210 | }
|
16211 |
|
16212 | if (removedIds.length) {
|
16213 | this._trigger("remove", {
|
16214 | items: removedIds,
|
16215 | oldData: removedItems
|
16216 | }, senderId);
|
16217 | }
|
16218 | }
|
16219 | }]);
|
16220 |
|
16221 | return DataView;
|
16222 | }(DataSetPart);
|
16223 |
|
16224 |
|
16225 |
|
16226 |
|
16227 |
|
16228 |
|
16229 |
|
16230 |
|
16231 |
|
16232 |
|
16233 | function isDataSetLike(idProp, v) {
|
16234 | return _typeof(v) === "object" && v !== null && idProp === v.idProp && typeof v.add === "function" && typeof v.clear === "function" && typeof v.distinct === "function" && typeof forEach$2(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$3(v) === "function" && typeof v.max === "function" && typeof v.min === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.remove === "function" && typeof v.setOptions === "function" && typeof v.stream === "function" && typeof v.update === "function" && typeof v.updateOnly === "function";
|
16235 | }
|
16236 |
|
16237 |
|
16238 |
|
16239 |
|
16240 |
|
16241 |
|
16242 |
|
16243 |
|
16244 |
|
16245 |
|
16246 | function isDataViewLike(idProp, v) {
|
16247 | return _typeof(v) === "object" && v !== null && idProp === v.idProp && typeof forEach$2(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$3(v) === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.stream === "function" && isDataSetLike(idProp, v.getDataSet());
|
16248 | }
|
16249 |
|
16250 | var esnext = Object.freeze({
|
16251 | __proto__: null,
|
16252 | DELETE: DELETE,
|
16253 | DataSet: DataSet$1,
|
16254 | DataStream: DataStream,
|
16255 | DataView: DataView$1,
|
16256 | Queue: Queue$1,
|
16257 | createNewDataPipeFrom: createNewDataPipeFrom,
|
16258 | isDataSetLike: isDataSetLike,
|
16259 | isDataViewLike: isDataViewLike
|
16260 | });
|
16261 |
|
16262 | var trim = stringTrim.trim;
|
16263 | var $parseFloat = global_1.parseFloat;
|
16264 | var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity;
|
16265 |
|
16266 |
|
16267 | var numberParseFloat = FORCED ? function parseFloat(string) {
|
16268 | var trimmedString = trim(toString_1(string));
|
16269 | var result = $parseFloat(trimmedString);
|
16270 | return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
|
16271 | } : $parseFloat;
|
16272 |
|
16273 |
|
16274 |
|
16275 | _export({
|
16276 | global: true,
|
16277 | forced: parseFloat != numberParseFloat
|
16278 | }, {
|
16279 | parseFloat: numberParseFloat
|
16280 | });
|
16281 |
|
16282 | var _parseFloat$2 = path.parseFloat;
|
16283 |
|
16284 | var _parseFloat$1 = _parseFloat$2;
|
16285 |
|
16286 | var _parseFloat = _parseFloat$1;
|
16287 |
|
16288 |
|
16289 |
|
16290 | _export({
|
16291 | target: 'Number',
|
16292 | stat: true
|
16293 | }, {
|
16294 | isNaN: function isNaN(number) {
|
16295 |
|
16296 | return number != number;
|
16297 | }
|
16298 | });
|
16299 |
|
16300 | var isNan$2 = path.Number.isNaN;
|
16301 |
|
16302 | var isNan$1 = isNan$2;
|
16303 |
|
16304 | var isNan = isNan$1;
|
16305 |
|
16306 |
|
16307 |
|
16308 |
|
16309 |
|
16310 |
|
16311 |
|
16312 | function Point3d(x, y, z) {
|
16313 | this.x = x !== undefined ? x : 0;
|
16314 | this.y = y !== undefined ? y : 0;
|
16315 | this.z = z !== undefined ? z : 0;
|
16316 | }
|
16317 |
|
16318 |
|
16319 |
|
16320 |
|
16321 |
|
16322 |
|
16323 |
|
16324 |
|
16325 | Point3d.subtract = function (a, b) {
|
16326 | var sub = new Point3d();
|
16327 | sub.x = a.x - b.x;
|
16328 | sub.y = a.y - b.y;
|
16329 | sub.z = a.z - b.z;
|
16330 | return sub;
|
16331 | };
|
16332 |
|
16333 |
|
16334 |
|
16335 |
|
16336 |
|
16337 |
|
16338 |
|
16339 |
|
16340 | Point3d.add = function (a, b) {
|
16341 | var sum = new Point3d();
|
16342 | sum.x = a.x + b.x;
|
16343 | sum.y = a.y + b.y;
|
16344 | sum.z = a.z + b.z;
|
16345 | return sum;
|
16346 | };
|
16347 |
|
16348 |
|
16349 |
|
16350 |
|
16351 |
|
16352 |
|
16353 |
|
16354 |
|
16355 | Point3d.avg = function (a, b) {
|
16356 | return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2);
|
16357 | };
|
16358 |
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 |
|
16364 |
|
16365 |
|
16366 | Point3d.scalarProduct = function (p, c) {
|
16367 | return new Point3d(p.x * c, p.y * c, p.z * c);
|
16368 | };
|
16369 |
|
16370 |
|
16371 |
|
16372 |
|
16373 |
|
16374 |
|
16375 |
|
16376 |
|
16377 |
|
16378 | Point3d.dotProduct = function (a, b) {
|
16379 | return a.x * b.x + a.y * b.y + a.z * b.z;
|
16380 | };
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 |
|
16387 |
|
16388 |
|
16389 |
|
16390 | Point3d.crossProduct = function (a, b) {
|
16391 | var crossproduct = new Point3d();
|
16392 | crossproduct.x = a.y * b.z - a.z * b.y;
|
16393 | crossproduct.y = a.z * b.x - a.x * b.z;
|
16394 | crossproduct.z = a.x * b.y - a.y * b.x;
|
16395 | return crossproduct;
|
16396 | };
|
16397 |
|
16398 |
|
16399 |
|
16400 |
|
16401 |
|
16402 |
|
16403 | Point3d.prototype.length = function () {
|
16404 | return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
16405 | };
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 | Point3d.prototype.normalize = function () {
|
16413 | return Point3d.scalarProduct(this, 1 / this.length());
|
16414 | };
|
16415 |
|
16416 | var Point3d_1 = Point3d;
|
16417 |
|
16418 |
|
16419 |
|
16420 |
|
16421 |
|
16422 |
|
16423 | function Point2d(x, y) {
|
16424 | this.x = x !== undefined ? x : 0;
|
16425 | this.y = y !== undefined ? y : 0;
|
16426 | }
|
16427 |
|
16428 | var Point2d_1 = Point2d;
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 | function Slider(container, options) {
|
16441 | if (container === undefined) {
|
16442 | throw new Error('No container element defined');
|
16443 | }
|
16444 |
|
16445 | this.container = container;
|
16446 | this.visible = options && options.visible != undefined ? options.visible : true;
|
16447 |
|
16448 | if (this.visible) {
|
16449 | this.frame = document.createElement('DIV');
|
16450 |
|
16451 | this.frame.style.width = '100%';
|
16452 | this.frame.style.position = 'relative';
|
16453 | this.container.appendChild(this.frame);
|
16454 | this.frame.prev = document.createElement('INPUT');
|
16455 | this.frame.prev.type = 'BUTTON';
|
16456 | this.frame.prev.value = 'Prev';
|
16457 | this.frame.appendChild(this.frame.prev);
|
16458 | this.frame.play = document.createElement('INPUT');
|
16459 | this.frame.play.type = 'BUTTON';
|
16460 | this.frame.play.value = 'Play';
|
16461 | this.frame.appendChild(this.frame.play);
|
16462 | this.frame.next = document.createElement('INPUT');
|
16463 | this.frame.next.type = 'BUTTON';
|
16464 | this.frame.next.value = 'Next';
|
16465 | this.frame.appendChild(this.frame.next);
|
16466 | this.frame.bar = document.createElement('INPUT');
|
16467 | this.frame.bar.type = 'BUTTON';
|
16468 | this.frame.bar.style.position = 'absolute';
|
16469 | this.frame.bar.style.border = '1px solid red';
|
16470 | this.frame.bar.style.width = '100px';
|
16471 | this.frame.bar.style.height = '6px';
|
16472 | this.frame.bar.style.borderRadius = '2px';
|
16473 | this.frame.bar.style.MozBorderRadius = '2px';
|
16474 | this.frame.bar.style.border = '1px solid #7F7F7F';
|
16475 | this.frame.bar.style.backgroundColor = '#E5E5E5';
|
16476 | this.frame.appendChild(this.frame.bar);
|
16477 | this.frame.slide = document.createElement('INPUT');
|
16478 | this.frame.slide.type = 'BUTTON';
|
16479 | this.frame.slide.style.margin = '0px';
|
16480 | this.frame.slide.value = ' ';
|
16481 | this.frame.slide.style.position = 'relative';
|
16482 | this.frame.slide.style.left = '-100px';
|
16483 | this.frame.appendChild(this.frame.slide);
|
16484 |
|
16485 | var me = this;
|
16486 |
|
16487 | this.frame.slide.onmousedown = function (event) {
|
16488 | me._onMouseDown(event);
|
16489 | };
|
16490 |
|
16491 | this.frame.prev.onclick = function (event) {
|
16492 | me.prev(event);
|
16493 | };
|
16494 |
|
16495 | this.frame.play.onclick = function (event) {
|
16496 | me.togglePlay(event);
|
16497 | };
|
16498 |
|
16499 | this.frame.next.onclick = function (event) {
|
16500 | me.next(event);
|
16501 | };
|
16502 | }
|
16503 |
|
16504 | this.onChangeCallback = undefined;
|
16505 | this.values = [];
|
16506 | this.index = undefined;
|
16507 | this.playTimeout = undefined;
|
16508 | this.playInterval = 1000;
|
16509 |
|
16510 | this.playLoop = true;
|
16511 | }
|
16512 |
|
16513 |
|
16514 |
|
16515 |
|
16516 |
|
16517 | Slider.prototype.prev = function () {
|
16518 | var index = this.getIndex();
|
16519 |
|
16520 | if (index > 0) {
|
16521 | index--;
|
16522 | this.setIndex(index);
|
16523 | }
|
16524 | };
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 |
|
16530 | Slider.prototype.next = function () {
|
16531 | var index = this.getIndex();
|
16532 |
|
16533 | if (index < values(this).length - 1) {
|
16534 | index++;
|
16535 | this.setIndex(index);
|
16536 | }
|
16537 | };
|
16538 |
|
16539 |
|
16540 |
|
16541 |
|
16542 |
|
16543 | Slider.prototype.playNext = function () {
|
16544 | var start = new Date();
|
16545 | var index = this.getIndex();
|
16546 |
|
16547 | if (index < values(this).length - 1) {
|
16548 | index++;
|
16549 | this.setIndex(index);
|
16550 | } else if (this.playLoop) {
|
16551 |
|
16552 | index = 0;
|
16553 | this.setIndex(index);
|
16554 | }
|
16555 |
|
16556 | var end = new Date();
|
16557 | var diff = end - start;
|
16558 |
|
16559 |
|
16560 | var interval = Math.max(this.playInterval - diff, 0);
|
16561 |
|
16562 | var me = this;
|
16563 | this.playTimeout = setTimeout$1(function () {
|
16564 | me.playNext();
|
16565 | }, interval);
|
16566 | };
|
16567 |
|
16568 |
|
16569 |
|
16570 |
|
16571 |
|
16572 | Slider.prototype.togglePlay = function () {
|
16573 | if (this.playTimeout === undefined) {
|
16574 | this.play();
|
16575 | } else {
|
16576 | this.stop();
|
16577 | }
|
16578 | };
|
16579 |
|
16580 |
|
16581 |
|
16582 |
|
16583 |
|
16584 | Slider.prototype.play = function () {
|
16585 |
|
16586 | if (this.playTimeout) return;
|
16587 | this.playNext();
|
16588 |
|
16589 | if (this.frame) {
|
16590 | this.frame.play.value = 'Stop';
|
16591 | }
|
16592 | };
|
16593 |
|
16594 |
|
16595 |
|
16596 |
|
16597 |
|
16598 | Slider.prototype.stop = function () {
|
16599 | clearInterval(this.playTimeout);
|
16600 | this.playTimeout = undefined;
|
16601 |
|
16602 | if (this.frame) {
|
16603 | this.frame.play.value = 'Play';
|
16604 | }
|
16605 | };
|
16606 |
|
16607 |
|
16608 |
|
16609 |
|
16610 |
|
16611 |
|
16612 |
|
16613 |
|
16614 | Slider.prototype.setOnChangeCallback = function (callback) {
|
16615 | this.onChangeCallback = callback;
|
16616 | };
|
16617 |
|
16618 |
|
16619 |
|
16620 |
|
16621 |
|
16622 |
|
16623 | Slider.prototype.setPlayInterval = function (interval) {
|
16624 | this.playInterval = interval;
|
16625 | };
|
16626 |
|
16627 |
|
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 | Slider.prototype.getPlayInterval = function () {
|
16633 | return this.playInterval;
|
16634 | };
|
16635 |
|
16636 |
|
16637 |
|
16638 |
|
16639 |
|
16640 |
|
16641 |
|
16642 |
|
16643 |
|
16644 | Slider.prototype.setPlayLoop = function (doLoop) {
|
16645 | this.playLoop = doLoop;
|
16646 | };
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 | Slider.prototype.onChange = function () {
|
16653 | if (this.onChangeCallback !== undefined) {
|
16654 | this.onChangeCallback();
|
16655 | }
|
16656 | };
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 | Slider.prototype.redraw = function () {
|
16663 | if (this.frame) {
|
16664 |
|
16665 | this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px';
|
16666 | this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px';
|
16667 |
|
16668 | var left = this.indexToLeft(this.index);
|
16669 | this.frame.slide.style.left = left + 'px';
|
16670 | }
|
16671 | };
|
16672 |
|
16673 |
|
16674 |
|
16675 |
|
16676 |
|
16677 |
|
16678 | Slider.prototype.setValues = function (values$1) {
|
16679 | this.values = values$1;
|
16680 | if (values(this).length > 0) this.setIndex(0);else this.index = undefined;
|
16681 | };
|
16682 |
|
16683 |
|
16684 |
|
16685 |
|
16686 |
|
16687 |
|
16688 | Slider.prototype.setIndex = function (index) {
|
16689 | if (index < values(this).length) {
|
16690 | this.index = index;
|
16691 | this.redraw();
|
16692 | this.onChange();
|
16693 | } else {
|
16694 | throw new Error('Index out of range');
|
16695 | }
|
16696 | };
|
16697 |
|
16698 |
|
16699 |
|
16700 |
|
16701 |
|
16702 |
|
16703 | Slider.prototype.getIndex = function () {
|
16704 | return this.index;
|
16705 | };
|
16706 |
|
16707 |
|
16708 |
|
16709 |
|
16710 |
|
16711 |
|
16712 | Slider.prototype.get = function () {
|
16713 | return values(this)[this.index];
|
16714 | };
|
16715 |
|
16716 | Slider.prototype._onMouseDown = function (event) {
|
16717 |
|
16718 | var leftButtonDown = event.which ? event.which === 1 : event.button === 1;
|
16719 | if (!leftButtonDown) return;
|
16720 | this.startClientX = event.clientX;
|
16721 | this.startSlideX = _parseFloat(this.frame.slide.style.left);
|
16722 | this.frame.style.cursor = 'move';
|
16723 |
|
16724 |
|
16725 |
|
16726 | var me = this;
|
16727 |
|
16728 | this.onmousemove = function (event) {
|
16729 | me._onMouseMove(event);
|
16730 | };
|
16731 |
|
16732 | this.onmouseup = function (event) {
|
16733 | me._onMouseUp(event);
|
16734 | };
|
16735 |
|
16736 | addEventListener(document, 'mousemove', this.onmousemove);
|
16737 | addEventListener(document, 'mouseup', this.onmouseup);
|
16738 | preventDefault(event);
|
16739 | };
|
16740 |
|
16741 | Slider.prototype.leftToIndex = function (left) {
|
16742 | var width = _parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
|
16743 | var x = left - 3;
|
16744 | var index = Math.round(x / width * (values(this).length - 1));
|
16745 | if (index < 0) index = 0;
|
16746 | if (index > values(this).length - 1) index = values(this).length - 1;
|
16747 | return index;
|
16748 | };
|
16749 |
|
16750 | Slider.prototype.indexToLeft = function (index) {
|
16751 | var width = _parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
|
16752 | var x = index / (values(this).length - 1) * width;
|
16753 | var left = x + 3;
|
16754 | return left;
|
16755 | };
|
16756 |
|
16757 | Slider.prototype._onMouseMove = function (event) {
|
16758 | var diff = event.clientX - this.startClientX;
|
16759 | var x = this.startSlideX + diff;
|
16760 | var index = this.leftToIndex(x);
|
16761 | this.setIndex(index);
|
16762 | preventDefault();
|
16763 | };
|
16764 |
|
16765 | Slider.prototype._onMouseUp = function (event) {
|
16766 |
|
16767 | this.frame.style.cursor = 'auto';
|
16768 |
|
16769 | removeEventListener(document, 'mousemove', this.onmousemove);
|
16770 | removeEventListener(document, 'mouseup', this.onmouseup);
|
16771 | preventDefault();
|
16772 | };
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 |
|
16783 |
|
16784 |
|
16785 |
|
16786 |
|
16787 |
|
16788 |
|
16789 |
|
16790 |
|
16791 |
|
16792 |
|
16793 |
|
16794 |
|
16795 |
|
16796 |
|
16797 |
|
16798 |
|
16799 | function StepNumber(start, end, step, prettyStep) {
|
16800 |
|
16801 | this._start = 0;
|
16802 | this._end = 0;
|
16803 | this._step = 1;
|
16804 | this.prettyStep = true;
|
16805 | this.precision = 5;
|
16806 | this._current = 0;
|
16807 | this.setRange(start, end, step, prettyStep);
|
16808 | }
|
16809 |
|
16810 |
|
16811 |
|
16812 |
|
16813 |
|
16814 |
|
16815 |
|
16816 |
|
16817 |
|
16818 |
|
16819 | StepNumber.prototype.isNumeric = function (n) {
|
16820 | return !isNaN(_parseFloat(n)) && isFinite(n);
|
16821 | };
|
16822 |
|
16823 |
|
16824 |
|
16825 |
|
16826 |
|
16827 |
|
16828 |
|
16829 |
|
16830 |
|
16831 |
|
16832 |
|
16833 | StepNumber.prototype.setRange = function (start, end, step, prettyStep) {
|
16834 | if (!this.isNumeric(start)) {
|
16835 | throw new Error('Parameter \'start\' is not numeric; value: ' + start);
|
16836 | }
|
16837 |
|
16838 | if (!this.isNumeric(end)) {
|
16839 | throw new Error('Parameter \'end\' is not numeric; value: ' + start);
|
16840 | }
|
16841 |
|
16842 | if (!this.isNumeric(step)) {
|
16843 | throw new Error('Parameter \'step\' is not numeric; value: ' + start);
|
16844 | }
|
16845 |
|
16846 | this._start = start ? start : 0;
|
16847 | this._end = end ? end : 0;
|
16848 | this.setStep(step, prettyStep);
|
16849 | };
|
16850 |
|
16851 |
|
16852 |
|
16853 |
|
16854 |
|
16855 |
|
16856 |
|
16857 |
|
16858 | StepNumber.prototype.setStep = function (step, prettyStep) {
|
16859 | if (step === undefined || step <= 0) return;
|
16860 | if (prettyStep !== undefined) this.prettyStep = prettyStep;
|
16861 | if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step;
|
16862 | };
|
16863 |
|
16864 |
|
16865 |
|
16866 |
|
16867 |
|
16868 |
|
16869 |
|
16870 |
|
16871 |
|
16872 | StepNumber.calculatePrettyStep = function (step) {
|
16873 | var log10 = function log10(x) {
|
16874 | return Math.log(x) / Math.LN10;
|
16875 | };
|
16876 |
|
16877 |
|
16878 | var step1 = Math.pow(10, Math.round(log10(step))),
|
16879 | step2 = 2 * Math.pow(10, Math.round(log10(step / 2))),
|
16880 | step5 = 5 * Math.pow(10, Math.round(log10(step / 5)));
|
16881 |
|
16882 | var prettyStep = step1;
|
16883 | if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2;
|
16884 | if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5;
|
16885 |
|
16886 | if (prettyStep <= 0) {
|
16887 | prettyStep = 1;
|
16888 | }
|
16889 |
|
16890 | return prettyStep;
|
16891 | };
|
16892 |
|
16893 |
|
16894 |
|
16895 |
|
16896 |
|
16897 |
|
16898 | StepNumber.prototype.getCurrent = function () {
|
16899 | return _parseFloat(this._current.toPrecision(this.precision));
|
16900 | };
|
16901 |
|
16902 |
|
16903 |
|
16904 |
|
16905 |
|
16906 |
|
16907 | StepNumber.prototype.getStep = function () {
|
16908 | return this._step;
|
16909 | };
|
16910 |
|
16911 |
|
16912 |
|
16913 |
|
16914 |
|
16915 |
|
16916 |
|
16917 |
|
16918 |
|
16919 |
|
16920 |
|
16921 |
|
16922 |
|
16923 | StepNumber.prototype.start = function (checkFirst) {
|
16924 | if (checkFirst === undefined) {
|
16925 | checkFirst = false;
|
16926 | }
|
16927 |
|
16928 | this._current = this._start - this._start % this._step;
|
16929 |
|
16930 | if (checkFirst) {
|
16931 | if (this.getCurrent() < this._start) {
|
16932 | this.next();
|
16933 | }
|
16934 | }
|
16935 | };
|
16936 |
|
16937 |
|
16938 |
|
16939 |
|
16940 |
|
16941 | StepNumber.prototype.next = function () {
|
16942 | this._current += this._step;
|
16943 | };
|
16944 |
|
16945 |
|
16946 |
|
16947 |
|
16948 |
|
16949 |
|
16950 | StepNumber.prototype.end = function () {
|
16951 | return this._current > this._end;
|
16952 | };
|
16953 |
|
16954 | var StepNumber_1 = StepNumber;
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 | var mathSign = Math.sign || function sign(x) {
|
16960 |
|
16961 | return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
|
16962 | };
|
16963 |
|
16964 |
|
16965 |
|
16966 | _export({
|
16967 | target: 'Math',
|
16968 | stat: true
|
16969 | }, {
|
16970 | sign: mathSign
|
16971 | });
|
16972 |
|
16973 | var sign$2 = path.Math.sign;
|
16974 |
|
16975 | var sign$1 = sign$2;
|
16976 |
|
16977 | var sign = sign$1;
|
16978 |
|
16979 |
|
16980 |
|
16981 |
|
16982 |
|
16983 |
|
16984 |
|
16985 |
|
16986 |
|
16987 |
|
16988 |
|
16989 |
|
16990 | function Camera() {
|
16991 | this.armLocation = new Point3d_1();
|
16992 | this.armRotation = {};
|
16993 | this.armRotation.horizontal = 0;
|
16994 | this.armRotation.vertical = 0;
|
16995 | this.armLength = 1.7;
|
16996 | this.cameraOffset = new Point3d_1();
|
16997 | this.offsetMultiplier = 0.6;
|
16998 | this.cameraLocation = new Point3d_1();
|
16999 | this.cameraRotation = new Point3d_1(0.5 * Math.PI, 0, 0);
|
17000 | this.calculateCameraOrientation();
|
17001 | }
|
17002 |
|
17003 |
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 |
|
17009 | Camera.prototype.setOffset = function (x, y) {
|
17010 | var abs = Math.abs,
|
17011 | sign$1 = sign,
|
17012 | mul = this.offsetMultiplier,
|
17013 | border = this.armLength * mul;
|
17014 |
|
17015 | if (abs(x) > border) {
|
17016 | x = sign$1(x) * border;
|
17017 | }
|
17018 |
|
17019 | if (abs(y) > border) {
|
17020 | y = sign$1(y) * border;
|
17021 | }
|
17022 |
|
17023 | this.cameraOffset.x = x;
|
17024 | this.cameraOffset.y = y;
|
17025 | this.calculateCameraOrientation();
|
17026 | };
|
17027 |
|
17028 |
|
17029 |
|
17030 |
|
17031 |
|
17032 |
|
17033 | Camera.prototype.getOffset = function () {
|
17034 | return this.cameraOffset;
|
17035 | };
|
17036 |
|
17037 |
|
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 | Camera.prototype.setArmLocation = function (x, y, z) {
|
17045 | this.armLocation.x = x;
|
17046 | this.armLocation.y = y;
|
17047 | this.armLocation.z = z;
|
17048 | this.calculateCameraOrientation();
|
17049 | };
|
17050 |
|
17051 |
|
17052 |
|
17053 |
|
17054 |
|
17055 |
|
17056 |
|
17057 |
|
17058 |
|
17059 |
|
17060 | Camera.prototype.setArmRotation = function (horizontal, vertical) {
|
17061 | if (horizontal !== undefined) {
|
17062 | this.armRotation.horizontal = horizontal;
|
17063 | }
|
17064 |
|
17065 | if (vertical !== undefined) {
|
17066 | this.armRotation.vertical = vertical;
|
17067 | if (this.armRotation.vertical < 0) this.armRotation.vertical = 0;
|
17068 | if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI;
|
17069 | }
|
17070 |
|
17071 | if (horizontal !== undefined || vertical !== undefined) {
|
17072 | this.calculateCameraOrientation();
|
17073 | }
|
17074 | };
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 | Camera.prototype.getArmRotation = function () {
|
17082 | var rot = {};
|
17083 | rot.horizontal = this.armRotation.horizontal;
|
17084 | rot.vertical = this.armRotation.vertical;
|
17085 | return rot;
|
17086 | };
|
17087 |
|
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 |
|
17093 | Camera.prototype.setArmLength = function (length) {
|
17094 | if (length === undefined) return;
|
17095 | this.armLength = length;
|
17096 |
|
17097 |
|
17098 |
|
17099 | if (this.armLength < 0.71) this.armLength = 0.71;
|
17100 | if (this.armLength > 5.0) this.armLength = 5.0;
|
17101 | this.setOffset(this.cameraOffset.x, this.cameraOffset.y);
|
17102 | this.calculateCameraOrientation();
|
17103 | };
|
17104 |
|
17105 |
|
17106 |
|
17107 |
|
17108 |
|
17109 |
|
17110 | Camera.prototype.getArmLength = function () {
|
17111 | return this.armLength;
|
17112 | };
|
17113 |
|
17114 |
|
17115 |
|
17116 |
|
17117 |
|
17118 |
|
17119 | Camera.prototype.getCameraLocation = function () {
|
17120 | return this.cameraLocation;
|
17121 | };
|
17122 |
|
17123 |
|
17124 |
|
17125 |
|
17126 |
|
17127 |
|
17128 | Camera.prototype.getCameraRotation = function () {
|
17129 | return this.cameraRotation;
|
17130 | };
|
17131 |
|
17132 |
|
17133 |
|
17134 |
|
17135 |
|
17136 |
|
17137 | Camera.prototype.calculateCameraOrientation = function () {
|
17138 |
|
17139 | this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
|
17140 | this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
|
17141 | this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical);
|
17142 |
|
17143 | this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical;
|
17144 | this.cameraRotation.y = 0;
|
17145 | this.cameraRotation.z = -this.armRotation.horizontal;
|
17146 | var xa = this.cameraRotation.x;
|
17147 | var za = this.cameraRotation.z;
|
17148 | var dx = this.cameraOffset.x;
|
17149 | var dy = this.cameraOffset.y;
|
17150 | var sin = Math.sin,
|
17151 | cos = Math.cos;
|
17152 | this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa);
|
17153 | this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa);
|
17154 | this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa);
|
17155 | };
|
17156 |
|
17157 | var STYLE = {
|
17158 | BAR: 0,
|
17159 | BARCOLOR: 1,
|
17160 | BARSIZE: 2,
|
17161 | DOT: 3,
|
17162 | DOTLINE: 4,
|
17163 | DOTCOLOR: 5,
|
17164 | DOTSIZE: 6,
|
17165 | GRID: 7,
|
17166 | LINE: 8,
|
17167 | SURFACE: 9
|
17168 | };
|
17169 |
|
17170 | var STYLENAME = {
|
17171 | 'dot': STYLE.DOT,
|
17172 | 'dot-line': STYLE.DOTLINE,
|
17173 | 'dot-color': STYLE.DOTCOLOR,
|
17174 | 'dot-size': STYLE.DOTSIZE,
|
17175 | 'line': STYLE.LINE,
|
17176 | 'grid': STYLE.GRID,
|
17177 | 'surface': STYLE.SURFACE,
|
17178 | 'bar': STYLE.BAR,
|
17179 | 'bar-color': STYLE.BARCOLOR,
|
17180 | 'bar-size': STYLE.BARSIZE
|
17181 | };
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 | var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showXAxis', 'showYAxis', 'showZAxis', 'showGrayBottom', 'showGrid', 'showPerspective', 'showShadow', 'showSurfaceGrid', 'keepAspectRatio', 'rotateAxisLabels', 'verticalRatio', 'dotSizeRatio', 'dotSizeMinFraction', 'dotSizeMaxFraction', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'axisFontSize', 'axisFontType', 'gridColor', 'xCenter', 'yCenter', 'zoomable', 'tooltipDelay', 'ctrlToZoom'];
|
17190 |
|
17191 |
|
17192 |
|
17193 |
|
17194 |
|
17195 |
|
17196 |
|
17197 | var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep'];
|
17198 |
|
17199 | var DEFAULTS = undefined;
|
17200 |
|
17201 |
|
17202 |
|
17203 |
|
17204 |
|
17205 |
|
17206 |
|
17207 |
|
17208 |
|
17209 | function isEmpty(obj) {
|
17210 | for (var prop in obj) {
|
17211 | if (obj.hasOwnProperty(prop)) return false;
|
17212 | }
|
17213 |
|
17214 | return true;
|
17215 | }
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 |
|
17222 |
|
17223 |
|
17224 |
|
17225 |
|
17226 | function capitalize(str) {
|
17227 | if (str === undefined || str === "" || typeof str != "string") {
|
17228 | return str;
|
17229 | }
|
17230 |
|
17231 | return str.charAt(0).toUpperCase() + slice$2(str).call(str, 1);
|
17232 | }
|
17233 |
|
17234 |
|
17235 |
|
17236 |
|
17237 |
|
17238 |
|
17239 |
|
17240 |
|
17241 |
|
17242 | function prefixFieldName(prefix, fieldName) {
|
17243 | if (prefix === undefined || prefix === "") {
|
17244 | return fieldName;
|
17245 | }
|
17246 |
|
17247 | return prefix + capitalize(fieldName);
|
17248 | }
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 |
|
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 |
|
17267 | function forceCopy(src, dst, fields, prefix) {
|
17268 | var srcKey;
|
17269 | var dstKey;
|
17270 |
|
17271 | for (var i = 0; i < fields.length; ++i) {
|
17272 | srcKey = fields[i];
|
17273 | dstKey = prefixFieldName(prefix, srcKey);
|
17274 | dst[dstKey] = src[srcKey];
|
17275 | }
|
17276 | }
|
17277 |
|
17278 |
|
17279 |
|
17280 |
|
17281 |
|
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 | function safeCopy(src, dst, fields, prefix) {
|
17291 | var srcKey;
|
17292 | var dstKey;
|
17293 |
|
17294 | for (var i = 0; i < fields.length; ++i) {
|
17295 | srcKey = fields[i];
|
17296 | if (src[srcKey] === undefined) continue;
|
17297 | dstKey = prefixFieldName(prefix, srcKey);
|
17298 | dst[dstKey] = src[srcKey];
|
17299 | }
|
17300 | }
|
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 |
|
17307 |
|
17308 |
|
17309 |
|
17310 |
|
17311 |
|
17312 |
|
17313 |
|
17314 | function setDefaults(src, dst) {
|
17315 | if (src === undefined || isEmpty(src)) {
|
17316 | throw new Error('No DEFAULTS passed');
|
17317 | }
|
17318 |
|
17319 | if (dst === undefined) {
|
17320 | throw new Error('No dst passed');
|
17321 | }
|
17322 |
|
17323 |
|
17324 | DEFAULTS = src;
|
17325 |
|
17326 | forceCopy(src, dst, OPTIONKEYS);
|
17327 | forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default');
|
17328 |
|
17329 | setSpecialSettings(src, dst);
|
17330 |
|
17331 | dst.margin = 10;
|
17332 |
|
17333 | dst.showTooltip = false;
|
17334 | dst.onclick_callback = null;
|
17335 | dst.eye = new Point3d_1(0, 0, -1);
|
17336 | }
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 | function setOptions(options, dst) {
|
17345 | if (options === undefined) {
|
17346 | return;
|
17347 | }
|
17348 |
|
17349 | if (dst === undefined) {
|
17350 | throw new Error('No dst passed');
|
17351 | }
|
17352 |
|
17353 | if (DEFAULTS === undefined || isEmpty(DEFAULTS)) {
|
17354 | throw new Error('DEFAULTS not set for module Settings');
|
17355 | }
|
17356 |
|
17357 |
|
17358 | safeCopy(options, dst, OPTIONKEYS);
|
17359 | safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default');
|
17360 |
|
17361 | setSpecialSettings(options, dst);
|
17362 | }
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 |
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 | function setSpecialSettings(src, dst) {
|
17374 | if (src.backgroundColor !== undefined) {
|
17375 | setBackgroundColor(src.backgroundColor, dst);
|
17376 | }
|
17377 |
|
17378 | setDataColor(src.dataColor, dst);
|
17379 | setStyle(src.style, dst);
|
17380 |
|
17381 | if (src.surfaceColors !== undefined) {
|
17382 | console.warn('`options.surfaceColors` is deprecated and may be removed in a future ' + 'version. Please use `options.colormap` instead. Note that the `colormap` ' + 'option uses the inverse array ordering (running from vMin to vMax).');
|
17383 |
|
17384 | if (src.colormap !== undefined) {
|
17385 | throw new Error('The `colormap` and `surfaceColors` options are mutually exclusive.');
|
17386 | }
|
17387 |
|
17388 | if (dst.style !== 'surface') {
|
17389 | console.warn('Ignoring `surfaceColors` in graph style `' + dst.style + '` for ' + 'backward compatibility (only effective in `surface` plots).');
|
17390 | } else {
|
17391 | setSurfaceColor(src.surfaceColors, dst);
|
17392 | }
|
17393 | } else {
|
17394 | setColormap(src.colormap, dst);
|
17395 | }
|
17396 |
|
17397 | setShowLegend(src.showLegend, dst);
|
17398 | setCameraPosition(src.cameraPosition, dst);
|
17399 |
|
17400 |
|
17401 | if (src.tooltip !== undefined) {
|
17402 | dst.showTooltip = src.tooltip;
|
17403 | }
|
17404 |
|
17405 | if (src.onclick != undefined) {
|
17406 | dst.onclick_callback = src.onclick;
|
17407 | console.warn("`options.onclick` is deprecated and may be removed in a future version." + " Please use `Graph3d.on('click', handler)` instead.");
|
17408 | }
|
17409 |
|
17410 | if (src.tooltipStyle !== undefined) {
|
17411 | selectiveDeepExtend(['tooltipStyle'], dst, src);
|
17412 | }
|
17413 | }
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 | function setShowLegend(showLegend, dst) {
|
17426 | if (showLegend === undefined) {
|
17427 |
|
17428 | var isAutoByDefault = DEFAULTS.showLegend === undefined;
|
17429 |
|
17430 | if (isAutoByDefault) {
|
17431 |
|
17432 | var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;
|
17433 | dst.showLegend = isLegendGraphStyle;
|
17434 | }
|
17435 | } else {
|
17436 | dst.showLegend = showLegend;
|
17437 | }
|
17438 | }
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 | function getStyleNumberByName(styleName) {
|
17448 | var number = STYLENAME[styleName];
|
17449 |
|
17450 | if (number === undefined) {
|
17451 | return -1;
|
17452 | }
|
17453 |
|
17454 | return number;
|
17455 | }
|
17456 |
|
17457 |
|
17458 |
|
17459 |
|
17460 |
|
17461 |
|
17462 |
|
17463 |
|
17464 | function checkStyleNumber(style) {
|
17465 | var valid = false;
|
17466 |
|
17467 | for (var n in STYLE) {
|
17468 | if (STYLE[n] === style) {
|
17469 | valid = true;
|
17470 | break;
|
17471 | }
|
17472 | }
|
17473 |
|
17474 | return valid;
|
17475 | }
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 | function setStyle(style, dst) {
|
17484 | if (style === undefined) {
|
17485 | return;
|
17486 | }
|
17487 |
|
17488 | var styleNumber;
|
17489 |
|
17490 | if (typeof style === 'string') {
|
17491 | styleNumber = getStyleNumberByName(style);
|
17492 |
|
17493 | if (styleNumber === -1) {
|
17494 | throw new Error('Style \'' + style + '\' is invalid');
|
17495 | }
|
17496 | } else {
|
17497 |
|
17498 | if (!checkStyleNumber(style)) {
|
17499 | throw new Error('Style \'' + style + '\' is invalid');
|
17500 | }
|
17501 |
|
17502 | styleNumber = style;
|
17503 | }
|
17504 |
|
17505 | dst.style = styleNumber;
|
17506 | }
|
17507 |
|
17508 |
|
17509 |
|
17510 |
|
17511 |
|
17512 |
|
17513 |
|
17514 | function setBackgroundColor(backgroundColor, dst) {
|
17515 | var fill$1 = 'white';
|
17516 | var stroke = 'gray';
|
17517 | var strokeWidth = 1;
|
17518 |
|
17519 | if (typeof backgroundColor === 'string') {
|
17520 | fill$1 = backgroundColor;
|
17521 | stroke = 'none';
|
17522 | strokeWidth = 0;
|
17523 | } else if (_typeof(backgroundColor) === 'object') {
|
17524 | if (fill(backgroundColor) !== undefined) fill$1 = fill(backgroundColor);
|
17525 | if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke;
|
17526 | if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth;
|
17527 | } else {
|
17528 | throw new Error('Unsupported type of backgroundColor');
|
17529 | }
|
17530 |
|
17531 | dst.frame.style.backgroundColor = fill$1;
|
17532 | dst.frame.style.borderColor = stroke;
|
17533 | dst.frame.style.borderWidth = strokeWidth + 'px';
|
17534 | dst.frame.style.borderStyle = 'solid';
|
17535 | }
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 |
|
17541 |
|
17542 |
|
17543 | function setDataColor(dataColor, dst) {
|
17544 | if (dataColor === undefined) {
|
17545 | return;
|
17546 | }
|
17547 |
|
17548 | if (dst.dataColor === undefined) {
|
17549 | dst.dataColor = {};
|
17550 | }
|
17551 |
|
17552 | if (typeof dataColor === 'string') {
|
17553 | dst.dataColor.fill = dataColor;
|
17554 | dst.dataColor.stroke = dataColor;
|
17555 | } else {
|
17556 | if (fill(dataColor)) {
|
17557 | dst.dataColor.fill = fill(dataColor);
|
17558 | }
|
17559 |
|
17560 | if (dataColor.stroke) {
|
17561 | dst.dataColor.stroke = dataColor.stroke;
|
17562 | }
|
17563 |
|
17564 | if (dataColor.strokeWidth !== undefined) {
|
17565 | dst.dataColor.strokeWidth = dataColor.strokeWidth;
|
17566 | }
|
17567 | }
|
17568 | }
|
17569 |
|
17570 |
|
17571 |
|
17572 |
|
17573 |
|
17574 |
|
17575 |
|
17576 | function setSurfaceColor(surfaceColors, dst) {
|
17577 | if (surfaceColors === undefined || surfaceColors === true) {
|
17578 | return;
|
17579 | }
|
17580 |
|
17581 | if (surfaceColors === false) {
|
17582 | dst.surfaceColors = undefined;
|
17583 | return;
|
17584 | }
|
17585 |
|
17586 | if (dst.surfaceColors === undefined) {
|
17587 | dst.surfaceColors = {};
|
17588 | }
|
17589 |
|
17590 | var rgbColors;
|
17591 |
|
17592 | if (isArray(surfaceColors)) {
|
17593 | rgbColors = parseColorArray(surfaceColors);
|
17594 | } else if (_typeof(surfaceColors) === 'object') {
|
17595 | rgbColors = parseColorObject(surfaceColors.hue);
|
17596 | } else {
|
17597 | throw new Error('Unsupported type of surfaceColors');
|
17598 | }
|
17599 |
|
17600 |
|
17601 | reverse(rgbColors).call(rgbColors);
|
17602 |
|
17603 | dst.colormap = rgbColors;
|
17604 | }
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 |
|
17611 |
|
17612 | function setColormap(colormap, dst) {
|
17613 | if (colormap === undefined) {
|
17614 | return;
|
17615 | }
|
17616 |
|
17617 | var rgbColors;
|
17618 |
|
17619 | if (isArray(colormap)) {
|
17620 | rgbColors = parseColorArray(colormap);
|
17621 | } else if (_typeof(colormap) === 'object') {
|
17622 | rgbColors = parseColorObject(colormap.hue);
|
17623 | } else if (typeof colormap === 'function') {
|
17624 | rgbColors = colormap;
|
17625 | } else {
|
17626 | throw new Error('Unsupported type of colormap');
|
17627 | }
|
17628 |
|
17629 | dst.colormap = rgbColors;
|
17630 | }
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 | function parseColorArray(colormap) {
|
17638 | if (colormap.length < 2) {
|
17639 | throw new Error('Colormap array length must be 2 or above.');
|
17640 | }
|
17641 |
|
17642 | return map$3(colormap).call(colormap, function (colorCode) {
|
17643 | if (!isValidHex(colorCode)) {
|
17644 | throw new Error("Invalid hex color code supplied to colormap.");
|
17645 | }
|
17646 |
|
17647 | return hexToRGB(colorCode);
|
17648 | });
|
17649 | }
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 |
|
17656 |
|
17657 |
|
17658 | function parseColorObject(hues) {
|
17659 | if (hues === undefined) {
|
17660 | throw new Error('Unsupported type of colormap');
|
17661 | }
|
17662 |
|
17663 | if (!(hues.saturation >= 0 && hues.saturation <= 100)) {
|
17664 | throw new Error('Saturation is out of bounds. Expected range is 0-100.');
|
17665 | }
|
17666 |
|
17667 | if (!(hues.brightness >= 0 && hues.brightness <= 100)) {
|
17668 | throw new Error('Brightness is out of bounds. Expected range is 0-100.');
|
17669 | }
|
17670 |
|
17671 | if (!(hues.colorStops >= 2)) {
|
17672 | throw new Error('colorStops is out of bounds. Expected 2 or above.');
|
17673 | }
|
17674 |
|
17675 | var hueStep = (hues.end - hues.start) / (hues.colorStops - 1);
|
17676 | var rgbColors = [];
|
17677 |
|
17678 | for (var i = 0; i < hues.colorStops; ++i) {
|
17679 | var hue = (hues.start + hueStep * i) % 360 / 360;
|
17680 | rgbColors.push(HSVToRGB(hue < 0 ? hue + 1 : hue, hues.saturation / 100, hues.brightness / 100));
|
17681 | }
|
17682 |
|
17683 | return rgbColors;
|
17684 | }
|
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 |
|
17692 | function setCameraPosition(cameraPosition, dst) {
|
17693 | var camPos = cameraPosition;
|
17694 |
|
17695 | if (camPos === undefined) {
|
17696 | return;
|
17697 | }
|
17698 |
|
17699 | if (dst.camera === undefined) {
|
17700 | dst.camera = new Camera();
|
17701 | }
|
17702 |
|
17703 | dst.camera.setArmRotation(camPos.horizontal, camPos.vertical);
|
17704 | dst.camera.setArmLength(camPos.distance);
|
17705 | }
|
17706 |
|
17707 |
|
17708 |
|
17709 |
|
17710 |
|
17711 |
|
17712 |
|
17713 |
|
17714 | var string = 'string';
|
17715 | var bool = 'boolean';
|
17716 | var number = 'number';
|
17717 | var object = 'object';
|
17718 |
|
17719 | var array = 'array';
|
17720 |
|
17721 |
|
17722 |
|
17723 | var colorOptions = {
|
17724 | fill: {
|
17725 | string: string
|
17726 | },
|
17727 | stroke: {
|
17728 | string: string
|
17729 | },
|
17730 | strokeWidth: {
|
17731 | number: number
|
17732 | },
|
17733 | __type__: {
|
17734 | string: string,
|
17735 | object: object,
|
17736 | 'undefined': 'undefined'
|
17737 | }
|
17738 | };
|
17739 | var surfaceColorsOptions = {
|
17740 | hue: {
|
17741 | start: {
|
17742 | number: number
|
17743 | },
|
17744 | end: {
|
17745 | number: number
|
17746 | },
|
17747 | saturation: {
|
17748 | number: number
|
17749 | },
|
17750 | brightness: {
|
17751 | number: number
|
17752 | },
|
17753 | colorStops: {
|
17754 | number: number
|
17755 | },
|
17756 | __type__: {
|
17757 | object: object
|
17758 | }
|
17759 | },
|
17760 | __type__: {
|
17761 | boolean: bool,
|
17762 | array: array,
|
17763 | object: object,
|
17764 | 'undefined': 'undefined'
|
17765 | }
|
17766 | };
|
17767 | var colormapOptions = {
|
17768 | hue: {
|
17769 | start: {
|
17770 | number: number
|
17771 | },
|
17772 | end: {
|
17773 | number: number
|
17774 | },
|
17775 | saturation: {
|
17776 | number: number
|
17777 | },
|
17778 | brightness: {
|
17779 | number: number
|
17780 | },
|
17781 | colorStops: {
|
17782 | number: number
|
17783 | },
|
17784 | __type__: {
|
17785 | object: object
|
17786 | }
|
17787 | },
|
17788 | __type__: {
|
17789 | array: array,
|
17790 | object: object,
|
17791 | 'function': 'function',
|
17792 | 'undefined': 'undefined'
|
17793 | }
|
17794 | };
|
17795 |
|
17796 |
|
17797 |
|
17798 |
|
17799 |
|
17800 |
|
17801 |
|
17802 | var allOptions = {
|
17803 | animationAutoStart: {
|
17804 | boolean: bool,
|
17805 | 'undefined': 'undefined'
|
17806 | },
|
17807 | animationInterval: {
|
17808 | number: number
|
17809 | },
|
17810 | animationPreload: {
|
17811 | boolean: bool
|
17812 | },
|
17813 | axisColor: {
|
17814 | string: string
|
17815 | },
|
17816 | axisFontSize: {
|
17817 | number: number
|
17818 | },
|
17819 | axisFontType: {
|
17820 | string: string
|
17821 | },
|
17822 | backgroundColor: colorOptions,
|
17823 | xBarWidth: {
|
17824 | number: number,
|
17825 | 'undefined': 'undefined'
|
17826 | },
|
17827 | yBarWidth: {
|
17828 | number: number,
|
17829 | 'undefined': 'undefined'
|
17830 | },
|
17831 | cameraPosition: {
|
17832 | distance: {
|
17833 | number: number
|
17834 | },
|
17835 | horizontal: {
|
17836 | number: number
|
17837 | },
|
17838 | vertical: {
|
17839 | number: number
|
17840 | },
|
17841 | __type__: {
|
17842 | object: object
|
17843 | }
|
17844 | },
|
17845 | zoomable: {
|
17846 | boolean: bool
|
17847 | },
|
17848 | ctrlToZoom: {
|
17849 | boolean: bool
|
17850 | },
|
17851 | xCenter: {
|
17852 | string: string
|
17853 | },
|
17854 | yCenter: {
|
17855 | string: string
|
17856 | },
|
17857 | colormap: colormapOptions,
|
17858 | dataColor: colorOptions,
|
17859 | dotSizeMinFraction: {
|
17860 | number: number
|
17861 | },
|
17862 | dotSizeMaxFraction: {
|
17863 | number: number
|
17864 | },
|
17865 | dotSizeRatio: {
|
17866 | number: number
|
17867 | },
|
17868 | filterLabel: {
|
17869 | string: string
|
17870 | },
|
17871 | gridColor: {
|
17872 | string: string
|
17873 | },
|
17874 | onclick: {
|
17875 | 'function': 'function'
|
17876 | },
|
17877 | keepAspectRatio: {
|
17878 | boolean: bool
|
17879 | },
|
17880 | xLabel: {
|
17881 | string: string
|
17882 | },
|
17883 | yLabel: {
|
17884 | string: string
|
17885 | },
|
17886 | zLabel: {
|
17887 | string: string
|
17888 | },
|
17889 | legendLabel: {
|
17890 | string: string
|
17891 | },
|
17892 | xMin: {
|
17893 | number: number,
|
17894 | 'undefined': 'undefined'
|
17895 | },
|
17896 | yMin: {
|
17897 | number: number,
|
17898 | 'undefined': 'undefined'
|
17899 | },
|
17900 | zMin: {
|
17901 | number: number,
|
17902 | 'undefined': 'undefined'
|
17903 | },
|
17904 | xMax: {
|
17905 | number: number,
|
17906 | 'undefined': 'undefined'
|
17907 | },
|
17908 | yMax: {
|
17909 | number: number,
|
17910 | 'undefined': 'undefined'
|
17911 | },
|
17912 | zMax: {
|
17913 | number: number,
|
17914 | 'undefined': 'undefined'
|
17915 | },
|
17916 | showAnimationControls: {
|
17917 | boolean: bool,
|
17918 | 'undefined': 'undefined'
|
17919 | },
|
17920 | showGrayBottom: {
|
17921 | boolean: bool
|
17922 | },
|
17923 | showGrid: {
|
17924 | boolean: bool
|
17925 | },
|
17926 | showLegend: {
|
17927 | boolean: bool,
|
17928 | 'undefined': 'undefined'
|
17929 | },
|
17930 | showPerspective: {
|
17931 | boolean: bool
|
17932 | },
|
17933 | showShadow: {
|
17934 | boolean: bool
|
17935 | },
|
17936 | showSurfaceGrid: {
|
17937 | boolean: bool
|
17938 | },
|
17939 | showXAxis: {
|
17940 | boolean: bool
|
17941 | },
|
17942 | showYAxis: {
|
17943 | boolean: bool
|
17944 | },
|
17945 | showZAxis: {
|
17946 | boolean: bool
|
17947 | },
|
17948 | rotateAxisLabels: {
|
17949 | boolean: bool
|
17950 | },
|
17951 | surfaceColors: surfaceColorsOptions,
|
17952 | xStep: {
|
17953 | number: number,
|
17954 | 'undefined': 'undefined'
|
17955 | },
|
17956 | yStep: {
|
17957 | number: number,
|
17958 | 'undefined': 'undefined'
|
17959 | },
|
17960 | zStep: {
|
17961 | number: number,
|
17962 | 'undefined': 'undefined'
|
17963 | },
|
17964 | style: {
|
17965 | number: number,
|
17966 |
|
17967 | string: ['bar', 'bar-color', 'bar-size', 'dot', 'dot-line', 'dot-color', 'dot-size', 'line', 'grid', 'surface']
|
17968 | },
|
17969 | tooltip: {
|
17970 | boolean: bool,
|
17971 | 'function': 'function'
|
17972 | },
|
17973 | tooltipDelay: {
|
17974 | number: number
|
17975 | },
|
17976 | tooltipStyle: {
|
17977 | content: {
|
17978 | color: {
|
17979 | string: string
|
17980 | },
|
17981 | background: {
|
17982 | string: string
|
17983 | },
|
17984 | border: {
|
17985 | string: string
|
17986 | },
|
17987 | borderRadius: {
|
17988 | string: string
|
17989 | },
|
17990 | boxShadow: {
|
17991 | string: string
|
17992 | },
|
17993 | padding: {
|
17994 | string: string
|
17995 | },
|
17996 | __type__: {
|
17997 | object: object
|
17998 | }
|
17999 | },
|
18000 | line: {
|
18001 | borderLeft: {
|
18002 | string: string
|
18003 | },
|
18004 | height: {
|
18005 | string: string
|
18006 | },
|
18007 | width: {
|
18008 | string: string
|
18009 | },
|
18010 | pointerEvents: {
|
18011 | string: string
|
18012 | },
|
18013 | __type__: {
|
18014 | object: object
|
18015 | }
|
18016 | },
|
18017 | dot: {
|
18018 | border: {
|
18019 | string: string
|
18020 | },
|
18021 | borderRadius: {
|
18022 | string: string
|
18023 | },
|
18024 | height: {
|
18025 | string: string
|
18026 | },
|
18027 | width: {
|
18028 | string: string
|
18029 | },
|
18030 | pointerEvents: {
|
18031 | string: string
|
18032 | },
|
18033 | __type__: {
|
18034 | object: object
|
18035 | }
|
18036 | },
|
18037 | __type__: {
|
18038 | object: object
|
18039 | }
|
18040 | },
|
18041 | xValueLabel: {
|
18042 | 'function': 'function'
|
18043 | },
|
18044 | yValueLabel: {
|
18045 | 'function': 'function'
|
18046 | },
|
18047 | zValueLabel: {
|
18048 | 'function': 'function'
|
18049 | },
|
18050 | valueMax: {
|
18051 | number: number,
|
18052 | 'undefined': 'undefined'
|
18053 | },
|
18054 | valueMin: {
|
18055 | number: number,
|
18056 | 'undefined': 'undefined'
|
18057 | },
|
18058 | verticalRatio: {
|
18059 | number: number
|
18060 | },
|
18061 |
|
18062 | height: {
|
18063 | string: string
|
18064 | },
|
18065 | width: {
|
18066 | string: string
|
18067 | },
|
18068 | __type__: {
|
18069 | object: object
|
18070 | }
|
18071 | };
|
18072 |
|
18073 |
|
18074 |
|
18075 |
|
18076 |
|
18077 |
|
18078 |
|
18079 |
|
18080 |
|
18081 |
|
18082 | function Range() {
|
18083 | this.min = undefined;
|
18084 | this.max = undefined;
|
18085 | }
|
18086 |
|
18087 |
|
18088 |
|
18089 |
|
18090 |
|
18091 |
|
18092 |
|
18093 |
|
18094 |
|
18095 |
|
18096 | Range.prototype.adjust = function (value) {
|
18097 | if (value === undefined) return;
|
18098 |
|
18099 | if (this.min === undefined || this.min > value) {
|
18100 | this.min = value;
|
18101 | }
|
18102 |
|
18103 | if (this.max === undefined || this.max < value) {
|
18104 | this.max = value;
|
18105 | }
|
18106 | };
|
18107 |
|
18108 |
|
18109 |
|
18110 |
|
18111 |
|
18112 |
|
18113 |
|
18114 | Range.prototype.combine = function (range) {
|
18115 | this.add(range.min);
|
18116 | this.add(range.max);
|
18117 | };
|
18118 |
|
18119 |
|
18120 |
|
18121 |
|
18122 |
|
18123 |
|
18124 |
|
18125 |
|
18126 |
|
18127 |
|
18128 |
|
18129 |
|
18130 | Range.prototype.expand = function (val) {
|
18131 | if (val === undefined) {
|
18132 | return;
|
18133 | }
|
18134 |
|
18135 | var newMin = this.min - val;
|
18136 | var newMax = this.max + val;
|
18137 |
|
18138 |
|
18139 | if (newMin > newMax) {
|
18140 | throw new Error('Passed expansion value makes range invalid');
|
18141 | }
|
18142 |
|
18143 | this.min = newMin;
|
18144 | this.max = newMax;
|
18145 | };
|
18146 |
|
18147 |
|
18148 |
|
18149 |
|
18150 |
|
18151 |
|
18152 |
|
18153 | Range.prototype.range = function () {
|
18154 | return this.max - this.min;
|
18155 | };
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 |
|
18161 |
|
18162 |
|
18163 | Range.prototype.center = function () {
|
18164 | return (this.min + this.max) / 2;
|
18165 | };
|
18166 |
|
18167 | var Range_1 = Range;
|
18168 |
|
18169 |
|
18170 |
|
18171 |
|
18172 |
|
18173 |
|
18174 |
|
18175 |
|
18176 |
|
18177 | function Filter(dataGroup, column, graph) {
|
18178 | this.dataGroup = dataGroup;
|
18179 | this.column = column;
|
18180 | this.graph = graph;
|
18181 |
|
18182 | this.index = undefined;
|
18183 | this.value = undefined;
|
18184 |
|
18185 | this.values = dataGroup.getDistinctValues(this.column);
|
18186 |
|
18187 | if (values(this).length > 0) {
|
18188 | this.selectValue(0);
|
18189 | }
|
18190 |
|
18191 |
|
18192 | this.dataPoints = [];
|
18193 | this.loaded = false;
|
18194 | this.onLoadCallback = undefined;
|
18195 |
|
18196 | if (graph.animationPreload) {
|
18197 | this.loaded = false;
|
18198 | this.loadInBackground();
|
18199 | } else {
|
18200 | this.loaded = true;
|
18201 | }
|
18202 | }
|
18203 |
|
18204 |
|
18205 |
|
18206 |
|
18207 |
|
18208 |
|
18209 | Filter.prototype.isLoaded = function () {
|
18210 | return this.loaded;
|
18211 | };
|
18212 |
|
18213 |
|
18214 |
|
18215 |
|
18216 |
|
18217 |
|
18218 | Filter.prototype.getLoadedProgress = function () {
|
18219 | var len = values(this).length;
|
18220 |
|
18221 | var i = 0;
|
18222 |
|
18223 | while (this.dataPoints[i]) {
|
18224 | i++;
|
18225 | }
|
18226 |
|
18227 | return Math.round(i / len * 100);
|
18228 | };
|
18229 |
|
18230 |
|
18231 |
|
18232 |
|
18233 |
|
18234 |
|
18235 | Filter.prototype.getLabel = function () {
|
18236 | return this.graph.filterLabel;
|
18237 | };
|
18238 |
|
18239 |
|
18240 |
|
18241 |
|
18242 |
|
18243 |
|
18244 | Filter.prototype.getColumn = function () {
|
18245 | return this.column;
|
18246 | };
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 |
|
18252 |
|
18253 | Filter.prototype.getSelectedValue = function () {
|
18254 | if (this.index === undefined) return undefined;
|
18255 | return values(this)[this.index];
|
18256 | };
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 |
|
18262 |
|
18263 | Filter.prototype.getValues = function () {
|
18264 | return values(this);
|
18265 | };
|
18266 |
|
18267 |
|
18268 |
|
18269 |
|
18270 |
|
18271 |
|
18272 |
|
18273 | Filter.prototype.getValue = function (index) {
|
18274 | if (index >= values(this).length) throw new Error('Index out of range');
|
18275 | return values(this)[index];
|
18276 | };
|
18277 |
|
18278 |
|
18279 |
|
18280 |
|
18281 |
|
18282 |
|
18283 |
|
18284 | Filter.prototype._getDataPoints = function (index) {
|
18285 | if (index === undefined) index = this.index;
|
18286 | if (index === undefined) return [];
|
18287 | var dataPoints;
|
18288 |
|
18289 | if (this.dataPoints[index]) {
|
18290 | dataPoints = this.dataPoints[index];
|
18291 | } else {
|
18292 | var f = {};
|
18293 | f.column = this.column;
|
18294 | f.value = values(this)[index];
|
18295 | var dataView = new DataView$1(this.dataGroup.getDataSet(), {
|
18296 | filter: function filter(item) {
|
18297 | return item[f.column] == f.value;
|
18298 | }
|
18299 | }).get();
|
18300 | dataPoints = this.dataGroup._getDataPoints(dataView);
|
18301 | this.dataPoints[index] = dataPoints;
|
18302 | }
|
18303 |
|
18304 | return dataPoints;
|
18305 | };
|
18306 |
|
18307 |
|
18308 |
|
18309 |
|
18310 |
|
18311 |
|
18312 |
|
18313 | Filter.prototype.setOnLoadCallback = function (callback) {
|
18314 | this.onLoadCallback = callback;
|
18315 | };
|
18316 |
|
18317 |
|
18318 |
|
18319 |
|
18320 |
|
18321 |
|
18322 |
|
18323 | Filter.prototype.selectValue = function (index) {
|
18324 | if (index >= values(this).length) throw new Error('Index out of range');
|
18325 | this.index = index;
|
18326 | this.value = values(this)[index];
|
18327 | };
|
18328 |
|
18329 |
|
18330 |
|
18331 |
|
18332 |
|
18333 |
|
18334 |
|
18335 |
|
18336 | Filter.prototype.loadInBackground = function (index) {
|
18337 | if (index === undefined) index = 0;
|
18338 | var frame = this.graph.frame;
|
18339 |
|
18340 | if (index < values(this).length) {
|
18341 |
|
18342 | if (frame.progress === undefined) {
|
18343 | frame.progress = document.createElement('DIV');
|
18344 | frame.progress.style.position = 'absolute';
|
18345 | frame.progress.style.color = 'gray';
|
18346 | frame.appendChild(frame.progress);
|
18347 | }
|
18348 |
|
18349 | var progress = this.getLoadedProgress();
|
18350 | frame.progress.innerHTML = 'Loading animation... ' + progress + '%';
|
18351 |
|
18352 | frame.progress.style.bottom = 60 + 'px';
|
18353 |
|
18354 | frame.progress.style.left = 10 + 'px';
|
18355 | var me = this;
|
18356 |
|
18357 | setTimeout$1(function () {
|
18358 | me.loadInBackground(index + 1);
|
18359 | }, 10);
|
18360 |
|
18361 | this.loaded = false;
|
18362 | } else {
|
18363 | this.loaded = true;
|
18364 |
|
18365 | if (frame.progress !== undefined) {
|
18366 | frame.removeChild(frame.progress);
|
18367 | frame.progress = undefined;
|
18368 | }
|
18369 |
|
18370 | if (this.onLoadCallback) this.onLoadCallback();
|
18371 | }
|
18372 | };
|
18373 |
|
18374 |
|
18375 |
|
18376 |
|
18377 |
|
18378 |
|
18379 |
|
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 | function DataGroup() {
|
18388 | this.dataTable = null;
|
18389 | }
|
18390 |
|
18391 |
|
18392 |
|
18393 |
|
18394 |
|
18395 |
|
18396 |
|
18397 |
|
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 |
|
18404 |
|
18405 |
|
18406 |
|
18407 | DataGroup.prototype.initializeData = function (graph3d, rawData, style) {
|
18408 | if (rawData === undefined) return;
|
18409 |
|
18410 | if (isArray(rawData)) {
|
18411 | rawData = new DataSet$1(rawData);
|
18412 | }
|
18413 |
|
18414 | var data;
|
18415 |
|
18416 | if (rawData instanceof DataSet$1 || rawData instanceof DataView$1) {
|
18417 | data = rawData.get();
|
18418 | } else {
|
18419 | throw new Error('Array, DataSet, or DataView expected');
|
18420 | }
|
18421 |
|
18422 | if (data.length == 0) return;
|
18423 | this.style = style;
|
18424 |
|
18425 | if (this.dataSet) {
|
18426 | this.dataSet.off('*', this._onChange);
|
18427 | }
|
18428 |
|
18429 | this.dataSet = rawData;
|
18430 | this.dataTable = data;
|
18431 |
|
18432 | var me = this;
|
18433 |
|
18434 | this._onChange = function () {
|
18435 | graph3d.setData(me.dataSet);
|
18436 | };
|
18437 |
|
18438 | this.dataSet.on('*', this._onChange);
|
18439 |
|
18440 | this.colX = 'x';
|
18441 | this.colY = 'y';
|
18442 | this.colZ = 'z';
|
18443 | var withBars = graph3d.hasBars(style);
|
18444 |
|
18445 | if (withBars) {
|
18446 | if (graph3d.defaultXBarWidth !== undefined) {
|
18447 | this.xBarWidth = graph3d.defaultXBarWidth;
|
18448 | } else {
|
18449 | this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1;
|
18450 | }
|
18451 |
|
18452 | if (graph3d.defaultYBarWidth !== undefined) {
|
18453 | this.yBarWidth = graph3d.defaultYBarWidth;
|
18454 | } else {
|
18455 | this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1;
|
18456 | }
|
18457 | }
|
18458 |
|
18459 |
|
18460 | this._initializeRange(data, this.colX, graph3d, withBars);
|
18461 |
|
18462 | this._initializeRange(data, this.colY, graph3d, withBars);
|
18463 |
|
18464 | this._initializeRange(data, this.colZ, graph3d, false);
|
18465 |
|
18466 | if (data[0].hasOwnProperty('style')) {
|
18467 | this.colValue = 'style';
|
18468 | var valueRange = this.getColumnRange(data, this.colValue);
|
18469 |
|
18470 | this._setRangeDefaults(valueRange, graph3d.defaultValueMin, graph3d.defaultValueMax);
|
18471 |
|
18472 | this.valueRange = valueRange;
|
18473 | } else {
|
18474 | this.colValue = 'z';
|
18475 | this.valueRange = this.zRange;
|
18476 | }
|
18477 |
|
18478 |
|
18479 | var table = this.getDataTable();
|
18480 |
|
18481 | if (table[0].hasOwnProperty('filter')) {
|
18482 | if (this.dataFilter === undefined) {
|
18483 | this.dataFilter = new Filter(this, 'filter', graph3d);
|
18484 | this.dataFilter.setOnLoadCallback(function () {
|
18485 | graph3d.redraw();
|
18486 | });
|
18487 | }
|
18488 | }
|
18489 |
|
18490 | var dataPoints;
|
18491 |
|
18492 | if (this.dataFilter) {
|
18493 |
|
18494 | dataPoints = this.dataFilter._getDataPoints();
|
18495 | } else {
|
18496 |
|
18497 | dataPoints = this._getDataPoints(this.getDataTable());
|
18498 | }
|
18499 |
|
18500 | return dataPoints;
|
18501 | };
|
18502 |
|
18503 |
|
18504 |
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 |
|
18510 |
|
18511 |
|
18512 |
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 | DataGroup.prototype._collectRangeSettings = function (column, graph3d) {
|
18520 | var _context;
|
18521 |
|
18522 | var index = indexOf(_context = ['x', 'y', 'z']).call(_context, column);
|
18523 |
|
18524 | if (index == -1) {
|
18525 | throw new Error('Column \'' + column + '\' invalid');
|
18526 | }
|
18527 |
|
18528 | var upper = column.toUpperCase();
|
18529 | return {
|
18530 | barWidth: this[column + 'BarWidth'],
|
18531 | min: graph3d['default' + upper + 'Min'],
|
18532 | max: graph3d['default' + upper + 'Max'],
|
18533 | step: graph3d['default' + upper + 'Step'],
|
18534 | range_label: column + 'Range',
|
18535 |
|
18536 | step_label: column + 'Step'
|
18537 |
|
18538 | };
|
18539 | };
|
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 |
|
18549 |
|
18550 |
|
18551 |
|
18552 |
|
18553 |
|
18554 |
|
18555 | DataGroup.prototype._initializeRange = function (data, column, graph3d, withBars) {
|
18556 | var NUMSTEPS = 5;
|
18557 |
|
18558 | var settings = this._collectRangeSettings(column, graph3d);
|
18559 |
|
18560 | var range = this.getColumnRange(data, column);
|
18561 |
|
18562 | if (withBars && column != 'z') {
|
18563 |
|
18564 | range.expand(settings.barWidth / 2);
|
18565 | }
|
18566 |
|
18567 | this._setRangeDefaults(range, settings.min, settings.max);
|
18568 |
|
18569 | this[settings.range_label] = range;
|
18570 | this[settings.step_label] = settings.step !== undefined ? settings.step : range.range() / NUMSTEPS;
|
18571 | };
|
18572 |
|
18573 |
|
18574 |
|
18575 |
|
18576 |
|
18577 |
|
18578 |
|
18579 |
|
18580 |
|
18581 |
|
18582 |
|
18583 |
|
18584 | DataGroup.prototype.getDistinctValues = function (column, data) {
|
18585 | if (data === undefined) {
|
18586 | data = this.dataTable;
|
18587 | }
|
18588 |
|
18589 | var values = [];
|
18590 |
|
18591 | for (var i = 0; i < data.length; i++) {
|
18592 | var value = data[i][column] || 0;
|
18593 |
|
18594 | if (indexOf(values).call(values, value) === -1) {
|
18595 | values.push(value);
|
18596 | }
|
18597 | }
|
18598 |
|
18599 | return sort(values).call(values, function (a, b) {
|
18600 | return a - b;
|
18601 | });
|
18602 | };
|
18603 |
|
18604 |
|
18605 |
|
18606 |
|
18607 |
|
18608 |
|
18609 |
|
18610 |
|
18611 |
|
18612 |
|
18613 |
|
18614 |
|
18615 | DataGroup.prototype.getSmallestDifference = function (data, column) {
|
18616 | var values = this.getDistinctValues(data, column);
|
18617 |
|
18618 |
|
18619 | var smallest_diff = null;
|
18620 |
|
18621 | for (var i = 1; i < values.length; i++) {
|
18622 | var diff = values[i] - values[i - 1];
|
18623 |
|
18624 | if (smallest_diff == null || smallest_diff > diff) {
|
18625 | smallest_diff = diff;
|
18626 | }
|
18627 | }
|
18628 |
|
18629 | return smallest_diff;
|
18630 | };
|
18631 |
|
18632 |
|
18633 |
|
18634 |
|
18635 |
|
18636 |
|
18637 |
|
18638 |
|
18639 |
|
18640 |
|
18641 | DataGroup.prototype.getColumnRange = function (data, column) {
|
18642 | var range = new Range_1();
|
18643 |
|
18644 | for (var i = 0; i < data.length; i++) {
|
18645 | var item = data[i][column];
|
18646 | range.adjust(item);
|
18647 | }
|
18648 |
|
18649 | return range;
|
18650 | };
|
18651 |
|
18652 |
|
18653 |
|
18654 |
|
18655 |
|
18656 |
|
18657 |
|
18658 | DataGroup.prototype.getNumberOfRows = function () {
|
18659 | return this.dataTable.length;
|
18660 | };
|
18661 |
|
18662 |
|
18663 |
|
18664 |
|
18665 |
|
18666 |
|
18667 |
|
18668 |
|
18669 |
|
18670 |
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 | DataGroup.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) {
|
18678 | if (defaultMin !== undefined) {
|
18679 | range.min = defaultMin;
|
18680 | }
|
18681 |
|
18682 | if (defaultMax !== undefined) {
|
18683 | range.max = defaultMax;
|
18684 | }
|
18685 |
|
18686 |
|
18687 |
|
18688 |
|
18689 | if (range.max <= range.min) range.max = range.min + 1;
|
18690 | };
|
18691 |
|
18692 | DataGroup.prototype.getDataTable = function () {
|
18693 | return this.dataTable;
|
18694 | };
|
18695 |
|
18696 | DataGroup.prototype.getDataSet = function () {
|
18697 | return this.dataSet;
|
18698 | };
|
18699 |
|
18700 |
|
18701 |
|
18702 |
|
18703 |
|
18704 |
|
18705 |
|
18706 | DataGroup.prototype.getDataPoints = function (data) {
|
18707 | var dataPoints = [];
|
18708 |
|
18709 | for (var i = 0; i < data.length; i++) {
|
18710 | var point = new Point3d_1();
|
18711 | point.x = data[i][this.colX] || 0;
|
18712 | point.y = data[i][this.colY] || 0;
|
18713 | point.z = data[i][this.colZ] || 0;
|
18714 | point.data = data[i];
|
18715 | point.value = data[i][this.colValue] || 0;
|
18716 | var obj = {};
|
18717 | obj.point = point;
|
18718 | obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
|
18719 | obj.trans = undefined;
|
18720 | obj.screen = undefined;
|
18721 | dataPoints.push(obj);
|
18722 | }
|
18723 |
|
18724 | return dataPoints;
|
18725 | };
|
18726 |
|
18727 |
|
18728 |
|
18729 |
|
18730 |
|
18731 |
|
18732 |
|
18733 |
|
18734 |
|
18735 |
|
18736 | DataGroup.prototype.initDataAsMatrix = function (data) {
|
18737 |
|
18738 |
|
18739 | var x, y, i, obj;
|
18740 |
|
18741 | var dataX = this.getDistinctValues(this.colX, data);
|
18742 | var dataY = this.getDistinctValues(this.colY, data);
|
18743 | var dataPoints = this.getDataPoints(data);
|
18744 |
|
18745 | var dataMatrix = [];
|
18746 |
|
18747 | for (i = 0; i < dataPoints.length; i++) {
|
18748 | obj = dataPoints[i];
|
18749 |
|
18750 | var xIndex = indexOf(dataX).call(dataX, obj.point.x);
|
18751 |
|
18752 | var yIndex = indexOf(dataY).call(dataY, obj.point.y);
|
18753 |
|
18754 | if (dataMatrix[xIndex] === undefined) {
|
18755 | dataMatrix[xIndex] = [];
|
18756 | }
|
18757 |
|
18758 | dataMatrix[xIndex][yIndex] = obj;
|
18759 | }
|
18760 |
|
18761 |
|
18762 | for (x = 0; x < dataMatrix.length; x++) {
|
18763 | for (y = 0; y < dataMatrix[x].length; y++) {
|
18764 | if (dataMatrix[x][y]) {
|
18765 | dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
|
18766 | dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
|
18767 | dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
|
18768 | }
|
18769 | }
|
18770 | }
|
18771 |
|
18772 | return dataPoints;
|
18773 | };
|
18774 |
|
18775 |
|
18776 |
|
18777 |
|
18778 |
|
18779 |
|
18780 |
|
18781 | DataGroup.prototype.getInfo = function () {
|
18782 | var dataFilter = this.dataFilter;
|
18783 | if (!dataFilter) return undefined;
|
18784 | return dataFilter.getLabel() + ': ' + dataFilter.getSelectedValue();
|
18785 | };
|
18786 |
|
18787 |
|
18788 |
|
18789 |
|
18790 |
|
18791 | DataGroup.prototype.reload = function () {
|
18792 | if (this.dataTable) {
|
18793 | this.setData(this.dataTable);
|
18794 | }
|
18795 | };
|
18796 |
|
18797 |
|
18798 |
|
18799 |
|
18800 |
|
18801 |
|
18802 |
|
18803 |
|
18804 |
|
18805 | DataGroup.prototype._getDataPoints = function (data) {
|
18806 | var dataPoints = [];
|
18807 |
|
18808 | if (this.style === STYLE.GRID || this.style === STYLE.SURFACE) {
|
18809 | dataPoints = this.initDataAsMatrix(data);
|
18810 | } else {
|
18811 |
|
18812 | dataPoints = this.getDataPoints(data);
|
18813 |
|
18814 | if (this.style === STYLE.LINE) {
|
18815 |
|
18816 | for (var i = 0; i < dataPoints.length; i++) {
|
18817 | if (i > 0) {
|
18818 | dataPoints[i - 1].pointNext = dataPoints[i];
|
18819 | }
|
18820 | }
|
18821 | }
|
18822 | }
|
18823 |
|
18824 | return dataPoints;
|
18825 | };
|
18826 |
|
18827 | Graph3d$1.STYLE = STYLE;
|
18828 |
|
18829 |
|
18830 |
|
18831 |
|
18832 |
|
18833 |
|
18834 |
|
18835 |
|
18836 | var autoByDefault = undefined;
|
18837 |
|
18838 |
|
18839 |
|
18840 |
|
18841 |
|
18842 |
|
18843 |
|
18844 |
|
18845 |
|
18846 |
|
18847 | Graph3d$1.DEFAULTS = {
|
18848 | width: '400px',
|
18849 | height: '400px',
|
18850 | filterLabel: 'time',
|
18851 | legendLabel: 'value',
|
18852 | xLabel: 'x',
|
18853 | yLabel: 'y',
|
18854 | zLabel: 'z',
|
18855 | xValueLabel: function xValueLabel(v) {
|
18856 | return v;
|
18857 | },
|
18858 | yValueLabel: function yValueLabel(v) {
|
18859 | return v;
|
18860 | },
|
18861 | zValueLabel: function zValueLabel(v) {
|
18862 | return v;
|
18863 | },
|
18864 | showXAxis: true,
|
18865 | showYAxis: true,
|
18866 | showZAxis: true,
|
18867 | showGrayBottom: false,
|
18868 | showGrid: true,
|
18869 | showPerspective: true,
|
18870 | showShadow: false,
|
18871 | showSurfaceGrid: true,
|
18872 | keepAspectRatio: true,
|
18873 | rotateAxisLabels: true,
|
18874 | verticalRatio: 0.5,
|
18875 |
|
18876 | dotSizeRatio: 0.02,
|
18877 |
|
18878 | dotSizeMinFraction: 0.5,
|
18879 |
|
18880 | dotSizeMaxFraction: 2.5,
|
18881 |
|
18882 | showAnimationControls: autoByDefault,
|
18883 | animationInterval: 1000,
|
18884 |
|
18885 | animationPreload: false,
|
18886 | animationAutoStart: autoByDefault,
|
18887 | axisFontSize: 14,
|
18888 | axisFontType: 'arial',
|
18889 | axisColor: '#4D4D4D',
|
18890 | gridColor: '#D3D3D3',
|
18891 | xCenter: '55%',
|
18892 | yCenter: '50%',
|
18893 | style: Graph3d$1.STYLE.DOT,
|
18894 | tooltip: false,
|
18895 | tooltipDelay: 300,
|
18896 |
|
18897 | tooltipStyle: {
|
18898 | content: {
|
18899 | padding: '10px',
|
18900 | border: '1px solid #4d4d4d',
|
18901 | color: '#1a1a1a',
|
18902 | background: 'rgba(255,255,255,0.7)',
|
18903 | borderRadius: '2px',
|
18904 | boxShadow: '5px 5px 10px rgba(128,128,128,0.5)'
|
18905 | },
|
18906 | line: {
|
18907 | height: '40px',
|
18908 | width: '0',
|
18909 | borderLeft: '1px solid #4d4d4d',
|
18910 | pointerEvents: 'none'
|
18911 | },
|
18912 | dot: {
|
18913 | height: '0',
|
18914 | width: '0',
|
18915 | border: '5px solid #4d4d4d',
|
18916 | borderRadius: '5px',
|
18917 | pointerEvents: 'none'
|
18918 | }
|
18919 | },
|
18920 | dataColor: {
|
18921 | fill: '#7DC1FF',
|
18922 | stroke: '#3267D2',
|
18923 | strokeWidth: 1
|
18924 |
|
18925 | },
|
18926 | surfaceColors: autoByDefault,
|
18927 | colormap: autoByDefault,
|
18928 | cameraPosition: {
|
18929 | horizontal: 1.0,
|
18930 | vertical: 0.5,
|
18931 | distance: 1.7
|
18932 | },
|
18933 | zoomable: true,
|
18934 | ctrlToZoom: false,
|
18935 |
|
18936 | |
18937 |
|
18938 |
|
18939 | showLegend: autoByDefault,
|
18940 |
|
18941 | backgroundColor: autoByDefault,
|
18942 | xBarWidth: autoByDefault,
|
18943 | yBarWidth: autoByDefault,
|
18944 | valueMin: autoByDefault,
|
18945 | valueMax: autoByDefault,
|
18946 | xMin: autoByDefault,
|
18947 | xMax: autoByDefault,
|
18948 | xStep: autoByDefault,
|
18949 | yMin: autoByDefault,
|
18950 | yMax: autoByDefault,
|
18951 | yStep: autoByDefault,
|
18952 | zMin: autoByDefault,
|
18953 | zMax: autoByDefault,
|
18954 | zStep: autoByDefault
|
18955 | };
|
18956 |
|
18957 |
|
18958 |
|
18959 |
|
18960 |
|
18961 |
|
18962 |
|
18963 |
|
18964 |
|
18965 |
|
18966 |
|
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 | function Graph3d$1(container, data, options) {
|
18972 | if (!(this instanceof Graph3d$1)) {
|
18973 | throw new SyntaxError('Constructor must be called with the new operator');
|
18974 | }
|
18975 |
|
18976 |
|
18977 | this.containerElement = container;
|
18978 | this.dataGroup = new DataGroup();
|
18979 | this.dataPoints = null;
|
18980 |
|
18981 |
|
18982 | this.create();
|
18983 | setDefaults(Graph3d$1.DEFAULTS, this);
|
18984 |
|
18985 | this.colX = undefined;
|
18986 | this.colY = undefined;
|
18987 | this.colZ = undefined;
|
18988 | this.colValue = undefined;
|
18989 |
|
18990 |
|
18991 | this.setOptions(options);
|
18992 |
|
18993 | this.setData(data);
|
18994 | }
|
18995 |
|
18996 |
|
18997 | componentEmitter(Graph3d$1.prototype);
|
18998 |
|
18999 |
|
19000 |
|
19001 |
|
19002 | Graph3d$1.prototype._setScale = function () {
|
19003 | this.scale = new Point3d_1(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range());
|
19004 |
|
19005 | if (this.keepAspectRatio) {
|
19006 | if (this.scale.x < this.scale.y) {
|
19007 |
|
19008 | this.scale.y = this.scale.x;
|
19009 | } else {
|
19010 |
|
19011 | this.scale.x = this.scale.y;
|
19012 | }
|
19013 | }
|
19014 |
|
19015 |
|
19016 | this.scale.z *= this.verticalRatio;
|
19017 |
|
19018 |
|
19019 | if (this.valueRange !== undefined) {
|
19020 | this.scale.value = 1 / this.valueRange.range();
|
19021 | }
|
19022 |
|
19023 |
|
19024 | var xCenter = this.xRange.center() * this.scale.x;
|
19025 | var yCenter = this.yRange.center() * this.scale.y;
|
19026 | var zCenter = this.zRange.center() * this.scale.z;
|
19027 | this.camera.setArmLocation(xCenter, yCenter, zCenter);
|
19028 | };
|
19029 |
|
19030 |
|
19031 |
|
19032 |
|
19033 |
|
19034 |
|
19035 |
|
19036 |
|
19037 |
|
19038 | Graph3d$1.prototype._convert3Dto2D = function (point3d) {
|
19039 | var translation = this._convertPointToTranslation(point3d);
|
19040 |
|
19041 | return this._convertTranslationToScreen(translation);
|
19042 | };
|
19043 |
|
19044 |
|
19045 |
|
19046 |
|
19047 |
|
19048 |
|
19049 |
|
19050 |
|
19051 |
|
19052 |
|
19053 |
|
19054 | Graph3d$1.prototype._convertPointToTranslation = function (point3d) {
|
19055 | var cameraLocation = this.camera.getCameraLocation(),
|
19056 | cameraRotation = this.camera.getCameraRotation(),
|
19057 | ax = point3d.x * this.scale.x,
|
19058 | ay = point3d.y * this.scale.y,
|
19059 | az = point3d.z * this.scale.z,
|
19060 | cx = cameraLocation.x,
|
19061 | cy = cameraLocation.y,
|
19062 | cz = cameraLocation.z,
|
19063 |
|
19064 | sinTx = Math.sin(cameraRotation.x),
|
19065 | cosTx = Math.cos(cameraRotation.x),
|
19066 | sinTy = Math.sin(cameraRotation.y),
|
19067 | cosTy = Math.cos(cameraRotation.y),
|
19068 | sinTz = Math.sin(cameraRotation.z),
|
19069 | cosTz = Math.cos(cameraRotation.z),
|
19070 |
|
19071 | dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz),
|
19072 | dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)),
|
19073 | dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx));
|
19074 | return new Point3d_1(dx, dy, dz);
|
19075 | };
|
19076 |
|
19077 |
|
19078 |
|
19079 |
|
19080 |
|
19081 |
|
19082 |
|
19083 |
|
19084 |
|
19085 |
|
19086 | Graph3d$1.prototype._convertTranslationToScreen = function (translation) {
|
19087 | var ex = this.eye.x,
|
19088 | ey = this.eye.y,
|
19089 | ez = this.eye.z,
|
19090 | dx = translation.x,
|
19091 | dy = translation.y,
|
19092 | dz = translation.z;
|
19093 |
|
19094 | var bx;
|
19095 | var by;
|
19096 |
|
19097 | if (this.showPerspective) {
|
19098 | bx = (dx - ex) * (ez / dz);
|
19099 | by = (dy - ey) * (ez / dz);
|
19100 | } else {
|
19101 | bx = dx * -(ez / this.camera.getArmLength());
|
19102 | by = dy * -(ez / this.camera.getArmLength());
|
19103 | }
|
19104 |
|
19105 |
|
19106 |
|
19107 | return new Point2d_1(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth);
|
19108 | };
|
19109 |
|
19110 |
|
19111 |
|
19112 |
|
19113 |
|
19114 |
|
19115 |
|
19116 |
|
19117 | Graph3d$1.prototype._calcTranslations = function (points) {
|
19118 | for (var i = 0; i < points.length; i++) {
|
19119 | var point = points[i];
|
19120 | point.trans = this._convertPointToTranslation(point.point);
|
19121 | point.screen = this._convertTranslationToScreen(point.trans);
|
19122 |
|
19123 | var transBottom = this._convertPointToTranslation(point.bottom);
|
19124 |
|
19125 | point.dist = this.showPerspective ? transBottom.length() : -transBottom.z;
|
19126 | }
|
19127 |
|
19128 |
|
19129 | var sortDepth = function sortDepth(a, b) {
|
19130 | return b.dist - a.dist;
|
19131 | };
|
19132 |
|
19133 | sort(points).call(points, sortDepth);
|
19134 | };
|
19135 |
|
19136 |
|
19137 |
|
19138 |
|
19139 |
|
19140 | Graph3d$1.prototype._initializeRanges = function () {
|
19141 |
|
19142 | var dg = this.dataGroup;
|
19143 | this.xRange = dg.xRange;
|
19144 | this.yRange = dg.yRange;
|
19145 | this.zRange = dg.zRange;
|
19146 | this.valueRange = dg.valueRange;
|
19147 |
|
19148 |
|
19149 | this.xStep = dg.xStep;
|
19150 | this.yStep = dg.yStep;
|
19151 | this.zStep = dg.zStep;
|
19152 | this.xBarWidth = dg.xBarWidth;
|
19153 | this.yBarWidth = dg.yBarWidth;
|
19154 | this.colX = dg.colX;
|
19155 | this.colY = dg.colY;
|
19156 | this.colZ = dg.colZ;
|
19157 | this.colValue = dg.colValue;
|
19158 |
|
19159 | this._setScale();
|
19160 | };
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 |
|
19167 |
|
19168 |
|
19169 | Graph3d$1.prototype.getDataPoints = function (data) {
|
19170 | var dataPoints = [];
|
19171 |
|
19172 | for (var i = 0; i < data.length; i++) {
|
19173 | var point = new Point3d_1();
|
19174 | point.x = data[i][this.colX] || 0;
|
19175 | point.y = data[i][this.colY] || 0;
|
19176 | point.z = data[i][this.colZ] || 0;
|
19177 | point.data = data[i];
|
19178 | point.value = data[i][this.colValue] || 0;
|
19179 | var obj = {};
|
19180 | obj.point = point;
|
19181 | obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
|
19182 | obj.trans = undefined;
|
19183 | obj.screen = undefined;
|
19184 | dataPoints.push(obj);
|
19185 | }
|
19186 |
|
19187 | return dataPoints;
|
19188 | };
|
19189 |
|
19190 |
|
19191 |
|
19192 |
|
19193 |
|
19194 |
|
19195 |
|
19196 |
|
19197 |
|
19198 | Graph3d$1.prototype._getDataPoints = function (data) {
|
19199 |
|
19200 |
|
19201 | var x, y, i, obj;
|
19202 | var dataPoints = [];
|
19203 |
|
19204 | if (this.style === Graph3d$1.STYLE.GRID || this.style === Graph3d$1.STYLE.SURFACE) {
|
19205 |
|
19206 |
|
19207 |
|
19208 | var dataX = this.dataGroup.getDistinctValues(this.colX, data);
|
19209 | var dataY = this.dataGroup.getDistinctValues(this.colY, data);
|
19210 | dataPoints = this.getDataPoints(data);
|
19211 |
|
19212 | var dataMatrix = [];
|
19213 |
|
19214 | for (i = 0; i < dataPoints.length; i++) {
|
19215 | obj = dataPoints[i];
|
19216 |
|
19217 | var xIndex = indexOf(dataX).call(dataX, obj.point.x);
|
19218 |
|
19219 | var yIndex = indexOf(dataY).call(dataY, obj.point.y);
|
19220 |
|
19221 | if (dataMatrix[xIndex] === undefined) {
|
19222 | dataMatrix[xIndex] = [];
|
19223 | }
|
19224 |
|
19225 | dataMatrix[xIndex][yIndex] = obj;
|
19226 | }
|
19227 |
|
19228 |
|
19229 | for (x = 0; x < dataMatrix.length; x++) {
|
19230 | for (y = 0; y < dataMatrix[x].length; y++) {
|
19231 | if (dataMatrix[x][y]) {
|
19232 | dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
|
19233 | dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
|
19234 | dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
|
19235 | }
|
19236 | }
|
19237 | }
|
19238 | } else {
|
19239 |
|
19240 | dataPoints = this.getDataPoints(data);
|
19241 |
|
19242 | if (this.style === Graph3d$1.STYLE.LINE) {
|
19243 |
|
19244 | for (i = 0; i < dataPoints.length; i++) {
|
19245 | if (i > 0) {
|
19246 | dataPoints[i - 1].pointNext = dataPoints[i];
|
19247 | }
|
19248 | }
|
19249 | }
|
19250 | }
|
19251 |
|
19252 | return dataPoints;
|
19253 | };
|
19254 |
|
19255 |
|
19256 |
|
19257 |
|
19258 |
|
19259 |
|
19260 |
|
19261 |
|
19262 |
|
19263 | Graph3d$1.prototype.create = function () {
|
19264 |
|
19265 | while (this.containerElement.hasChildNodes()) {
|
19266 | this.containerElement.removeChild(this.containerElement.firstChild);
|
19267 | }
|
19268 |
|
19269 | this.frame = document.createElement('div');
|
19270 | this.frame.style.position = 'relative';
|
19271 | this.frame.style.overflow = 'hidden';
|
19272 |
|
19273 | this.frame.canvas = document.createElement('canvas');
|
19274 | this.frame.canvas.style.position = 'relative';
|
19275 | this.frame.appendChild(this.frame.canvas);
|
19276 |
|
19277 | {
|
19278 | var noCanvas = document.createElement('DIV');
|
19279 | noCanvas.style.color = 'red';
|
19280 | noCanvas.style.fontWeight = 'bold';
|
19281 | noCanvas.style.padding = '10px';
|
19282 | noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
|
19283 | this.frame.canvas.appendChild(noCanvas);
|
19284 | }
|
19285 | this.frame.filter = document.createElement('div');
|
19286 | filter(this.frame).style.position = 'absolute';
|
19287 | filter(this.frame).style.bottom = '0px';
|
19288 | filter(this.frame).style.left = '0px';
|
19289 | filter(this.frame).style.width = '100%';
|
19290 | this.frame.appendChild(filter(this.frame));
|
19291 |
|
19292 | var me = this;
|
19293 |
|
19294 | var onmousedown = function onmousedown(event) {
|
19295 | me._onMouseDown(event);
|
19296 | };
|
19297 |
|
19298 | var ontouchstart = function ontouchstart(event) {
|
19299 | me._onTouchStart(event);
|
19300 | };
|
19301 |
|
19302 | var onmousewheel = function onmousewheel(event) {
|
19303 | me._onWheel(event);
|
19304 | };
|
19305 |
|
19306 | var ontooltip = function ontooltip(event) {
|
19307 | me._onTooltip(event);
|
19308 | };
|
19309 |
|
19310 | var onclick = function onclick(event) {
|
19311 | me._onClick(event);
|
19312 | };
|
19313 |
|
19314 |
|
19315 | addEventListener(this.frame.canvas, 'mousedown', onmousedown);
|
19316 | addEventListener(this.frame.canvas, 'touchstart', ontouchstart);
|
19317 | addEventListener(this.frame.canvas, 'mousewheel', onmousewheel);
|
19318 | addEventListener(this.frame.canvas, 'mousemove', ontooltip);
|
19319 | addEventListener(this.frame.canvas, 'click', onclick);
|
19320 |
|
19321 | this.containerElement.appendChild(this.frame);
|
19322 | };
|
19323 |
|
19324 |
|
19325 |
|
19326 |
|
19327 |
|
19328 |
|
19329 |
|
19330 |
|
19331 |
|
19332 | Graph3d$1.prototype._setSize = function (width, height) {
|
19333 | this.frame.style.width = width;
|
19334 | this.frame.style.height = height;
|
19335 |
|
19336 | this._resizeCanvas();
|
19337 | };
|
19338 |
|
19339 |
|
19340 |
|
19341 |
|
19342 |
|
19343 | Graph3d$1.prototype._resizeCanvas = function () {
|
19344 | this.frame.canvas.style.width = '100%';
|
19345 | this.frame.canvas.style.height = '100%';
|
19346 | this.frame.canvas.width = this.frame.canvas.clientWidth;
|
19347 | this.frame.canvas.height = this.frame.canvas.clientHeight;
|
19348 |
|
19349 | filter(this.frame).style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px';
|
19350 | };
|
19351 |
|
19352 |
|
19353 |
|
19354 |
|
19355 |
|
19356 |
|
19357 | Graph3d$1.prototype.animationStart = function () {
|
19358 |
|
19359 | if (!this.animationAutoStart || !this.dataGroup.dataFilter) return;
|
19360 | if (!filter(this.frame) || !filter(this.frame).slider) throw new Error('No animation available');
|
19361 |
|
19362 | filter(this.frame).slider.play();
|
19363 | };
|
19364 |
|
19365 |
|
19366 |
|
19367 |
|
19368 |
|
19369 | Graph3d$1.prototype.animationStop = function () {
|
19370 | if (!filter(this.frame) || !filter(this.frame).slider) return;
|
19371 |
|
19372 | filter(this.frame).slider.stop();
|
19373 | };
|
19374 |
|
19375 |
|
19376 |
|
19377 |
|
19378 |
|
19379 |
|
19380 |
|
19381 |
|
19382 | Graph3d$1.prototype._resizeCenter = function () {
|
19383 |
|
19384 | if (this.xCenter.charAt(this.xCenter.length - 1) === '%') {
|
19385 | this.currentXCenter = _parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth;
|
19386 | } else {
|
19387 | this.currentXCenter = _parseFloat(this.xCenter);
|
19388 | }
|
19389 |
|
19390 |
|
19391 | if (this.yCenter.charAt(this.yCenter.length - 1) === '%') {
|
19392 | this.currentYCenter = _parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - filter(this.frame).clientHeight);
|
19393 | } else {
|
19394 | this.currentYCenter = _parseFloat(this.yCenter);
|
19395 | }
|
19396 | };
|
19397 |
|
19398 |
|
19399 |
|
19400 |
|
19401 |
|
19402 |
|
19403 |
|
19404 |
|
19405 | Graph3d$1.prototype.getCameraPosition = function () {
|
19406 | var pos = this.camera.getArmRotation();
|
19407 | pos.distance = this.camera.getArmLength();
|
19408 | return pos;
|
19409 | };
|
19410 |
|
19411 |
|
19412 |
|
19413 |
|
19414 |
|
19415 |
|
19416 |
|
19417 |
|
19418 | Graph3d$1.prototype._readData = function (data) {
|
19419 |
|
19420 | this.dataPoints = this.dataGroup.initializeData(this, data, this.style);
|
19421 |
|
19422 | this._initializeRanges();
|
19423 |
|
19424 | this._redrawFilter();
|
19425 | };
|
19426 |
|
19427 |
|
19428 |
|
19429 |
|
19430 |
|
19431 |
|
19432 |
|
19433 | Graph3d$1.prototype.setData = function (data) {
|
19434 | if (data === undefined || data === null) return;
|
19435 |
|
19436 | this._readData(data);
|
19437 |
|
19438 | this.redraw();
|
19439 | this.animationStart();
|
19440 | };
|
19441 |
|
19442 |
|
19443 |
|
19444 |
|
19445 |
|
19446 |
|
19447 |
|
19448 | Graph3d$1.prototype.setOptions = function (options) {
|
19449 | if (options === undefined) return;
|
19450 | var errorFound = Validator$1.validate(options, allOptions);
|
19451 |
|
19452 | if (errorFound === true) {
|
19453 | console.log("%cErrors have been found in the supplied options object.", VALIDATOR_PRINT_STYLE$1);
|
19454 | }
|
19455 |
|
19456 | this.animationStop();
|
19457 | setOptions(options, this);
|
19458 | this.setPointDrawingMethod();
|
19459 |
|
19460 | this._setSize(this.width, this.height);
|
19461 |
|
19462 | this.setAxisLabelMethod();
|
19463 | this.setData(this.dataGroup.getDataTable());
|
19464 | this.animationStart();
|
19465 | };
|
19466 |
|
19467 |
|
19468 |
|
19469 |
|
19470 |
|
19471 | Graph3d$1.prototype.setPointDrawingMethod = function () {
|
19472 | var method = undefined;
|
19473 |
|
19474 | switch (this.style) {
|
19475 | case Graph3d$1.STYLE.BAR:
|
19476 | method = this._redrawBarGraphPoint;
|
19477 | break;
|
19478 |
|
19479 | case Graph3d$1.STYLE.BARCOLOR:
|
19480 | method = this._redrawBarColorGraphPoint;
|
19481 | break;
|
19482 |
|
19483 | case Graph3d$1.STYLE.BARSIZE:
|
19484 | method = this._redrawBarSizeGraphPoint;
|
19485 | break;
|
19486 |
|
19487 | case Graph3d$1.STYLE.DOT:
|
19488 | method = this._redrawDotGraphPoint;
|
19489 | break;
|
19490 |
|
19491 | case Graph3d$1.STYLE.DOTLINE:
|
19492 | method = this._redrawDotLineGraphPoint;
|
19493 | break;
|
19494 |
|
19495 | case Graph3d$1.STYLE.DOTCOLOR:
|
19496 | method = this._redrawDotColorGraphPoint;
|
19497 | break;
|
19498 |
|
19499 | case Graph3d$1.STYLE.DOTSIZE:
|
19500 | method = this._redrawDotSizeGraphPoint;
|
19501 | break;
|
19502 |
|
19503 | case Graph3d$1.STYLE.SURFACE:
|
19504 | method = this._redrawSurfaceGraphPoint;
|
19505 | break;
|
19506 |
|
19507 | case Graph3d$1.STYLE.GRID:
|
19508 | method = this._redrawGridGraphPoint;
|
19509 | break;
|
19510 |
|
19511 | case Graph3d$1.STYLE.LINE:
|
19512 | method = this._redrawLineGraphPoint;
|
19513 | break;
|
19514 |
|
19515 | default:
|
19516 | throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\'');
|
19517 | }
|
19518 |
|
19519 | this._pointDrawingMethod = method;
|
19520 | };
|
19521 |
|
19522 |
|
19523 |
|
19524 |
|
19525 |
|
19526 | Graph3d$1.prototype.setAxisLabelMethod = function () {
|
19527 | if (this.rotateAxisLabels) {
|
19528 | this._drawAxisLabelX = this.drawAxisLabelXRotate;
|
19529 | this._drawAxisLabelY = this.drawAxisLabelYRotate;
|
19530 | this._drawAxisLabelZ = this.drawAxisLabelZRotate;
|
19531 | } else {
|
19532 | this._drawAxisLabelX = this.drawAxisLabelX;
|
19533 | this._drawAxisLabelY = this.drawAxisLabelY;
|
19534 | this._drawAxisLabelZ = this.drawAxisLabelZ;
|
19535 | }
|
19536 | };
|
19537 |
|
19538 |
|
19539 |
|
19540 |
|
19541 |
|
19542 | Graph3d$1.prototype.redraw = function () {
|
19543 | if (this.dataPoints === undefined) {
|
19544 | throw new Error('Graph data not initialized');
|
19545 | }
|
19546 |
|
19547 | this._resizeCanvas();
|
19548 |
|
19549 | this._resizeCenter();
|
19550 |
|
19551 | this._redrawSlider();
|
19552 |
|
19553 | this._redrawClear();
|
19554 |
|
19555 | this._redrawAxis();
|
19556 |
|
19557 | this._redrawDataGraph();
|
19558 |
|
19559 | this._redrawInfo();
|
19560 |
|
19561 | this._redrawLegend();
|
19562 | };
|
19563 |
|
19564 |
|
19565 |
|
19566 |
|
19567 |
|
19568 |
|
19569 |
|
19570 |
|
19571 | Graph3d$1.prototype._getContext = function () {
|
19572 | var canvas = this.frame.canvas;
|
19573 | var ctx = canvas.getContext('2d');
|
19574 | ctx.lineJoin = 'round';
|
19575 | ctx.lineCap = 'round';
|
19576 | return ctx;
|
19577 | };
|
19578 |
|
19579 |
|
19580 |
|
19581 |
|
19582 |
|
19583 | Graph3d$1.prototype._redrawClear = function () {
|
19584 | var canvas = this.frame.canvas;
|
19585 | var ctx = canvas.getContext('2d');
|
19586 | ctx.clearRect(0, 0, canvas.width, canvas.height);
|
19587 | };
|
19588 |
|
19589 | Graph3d$1.prototype._dotSize = function () {
|
19590 | return this.frame.clientWidth * this.dotSizeRatio;
|
19591 | };
|
19592 |
|
19593 |
|
19594 |
|
19595 |
|
19596 |
|
19597 |
|
19598 |
|
19599 |
|
19600 | Graph3d$1.prototype._getLegendWidth = function () {
|
19601 | var width;
|
19602 |
|
19603 | if (this.style === Graph3d$1.STYLE.DOTSIZE) {
|
19604 | var dotSize = this._dotSize();
|
19605 |
|
19606 |
|
19607 | width = dotSize * this.dotSizeMaxFraction;
|
19608 | } else if (this.style === Graph3d$1.STYLE.BARSIZE) {
|
19609 | width = this.xBarWidth;
|
19610 | } else {
|
19611 | width = 20;
|
19612 | }
|
19613 |
|
19614 | return width;
|
19615 | };
|
19616 |
|
19617 |
|
19618 |
|
19619 |
|
19620 |
|
19621 | Graph3d$1.prototype._redrawLegend = function () {
|
19622 |
|
19623 | if (this.showLegend !== true) {
|
19624 | return;
|
19625 | }
|
19626 |
|
19627 |
|
19628 | if (this.style === Graph3d$1.STYLE.LINE || this.style === Graph3d$1.STYLE.BARSIZE
|
19629 | ) {
|
19630 | return;
|
19631 | }
|
19632 |
|
19633 |
|
19634 | var isSizeLegend = this.style === Graph3d$1.STYLE.BARSIZE || this.style === Graph3d$1.STYLE.DOTSIZE;
|
19635 |
|
19636 | var isValueLegend = this.style === Graph3d$1.STYLE.DOTSIZE || this.style === Graph3d$1.STYLE.DOTCOLOR || this.style === Graph3d$1.STYLE.SURFACE || this.style === Graph3d$1.STYLE.BARCOLOR;
|
19637 | var height = Math.max(this.frame.clientHeight * 0.25, 100);
|
19638 | var top = this.margin;
|
19639 |
|
19640 | var width = this._getLegendWidth();
|
19641 |
|
19642 |
|
19643 | var right = this.frame.clientWidth - this.margin;
|
19644 | var left = right - width;
|
19645 | var bottom = top + height;
|
19646 |
|
19647 | var ctx = this._getContext();
|
19648 |
|
19649 | ctx.lineWidth = 1;
|
19650 | ctx.font = '14px arial';
|
19651 |
|
19652 | if (isSizeLegend === false) {
|
19653 |
|
19654 | var ymin = 0;
|
19655 | var ymax = height;
|
19656 |
|
19657 | var y;
|
19658 |
|
19659 | for (y = ymin; y < ymax; y++) {
|
19660 |
|
19661 | var f = 1 - (y - ymin) / (ymax - ymin);
|
19662 |
|
19663 | var color = this._colormap(f, 1);
|
19664 |
|
19665 | ctx.strokeStyle = color;
|
19666 | ctx.beginPath();
|
19667 | ctx.moveTo(left, top + y);
|
19668 | ctx.lineTo(right, top + y);
|
19669 | ctx.stroke();
|
19670 | }
|
19671 |
|
19672 | ctx.strokeStyle = this.axisColor;
|
19673 | ctx.strokeRect(left, top, width, height);
|
19674 | } else {
|
19675 |
|
19676 | var widthMin;
|
19677 |
|
19678 | if (this.style === Graph3d$1.STYLE.DOTSIZE) {
|
19679 |
|
19680 | widthMin = width * (this.dotSizeMinFraction / this.dotSizeMaxFraction);
|
19681 | } else if (this.style === Graph3d$1.STYLE.BARSIZE) ;
|
19682 |
|
19683 | ctx.strokeStyle = this.axisColor;
|
19684 | ctx.fillStyle = fill(this.dataColor);
|
19685 | ctx.beginPath();
|
19686 | ctx.moveTo(left, top);
|
19687 | ctx.lineTo(right, top);
|
19688 | ctx.lineTo(left + widthMin, bottom);
|
19689 | ctx.lineTo(left, bottom);
|
19690 | ctx.closePath();
|
19691 |
|
19692 | fill(ctx).call(ctx);
|
19693 |
|
19694 | ctx.stroke();
|
19695 | }
|
19696 |
|
19697 |
|
19698 | var gridLineLen = 5;
|
19699 |
|
19700 | var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min;
|
19701 | var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max;
|
19702 | var step = new StepNumber_1(legendMin, legendMax, (legendMax - legendMin) / 5, true);
|
19703 | step.start(true);
|
19704 | var from;
|
19705 | var to;
|
19706 |
|
19707 | while (!step.end()) {
|
19708 | y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height;
|
19709 | from = new Point2d_1(left - gridLineLen, y);
|
19710 | to = new Point2d_1(left, y);
|
19711 |
|
19712 | this._line(ctx, from, to);
|
19713 |
|
19714 | ctx.textAlign = 'right';
|
19715 | ctx.textBaseline = 'middle';
|
19716 | ctx.fillStyle = this.axisColor;
|
19717 | ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y);
|
19718 | step.next();
|
19719 | }
|
19720 |
|
19721 | ctx.textAlign = 'right';
|
19722 | ctx.textBaseline = 'top';
|
19723 | var label = this.legendLabel;
|
19724 | ctx.fillText(label, right, bottom + this.margin);
|
19725 | };
|
19726 |
|
19727 |
|
19728 |
|
19729 |
|
19730 |
|
19731 | Graph3d$1.prototype._redrawFilter = function () {
|
19732 | var dataFilter = this.dataGroup.dataFilter;
|
19733 |
|
19734 | var filter$1 = filter(this.frame);
|
19735 |
|
19736 | filter$1.innerHTML = '';
|
19737 |
|
19738 | if (!dataFilter) {
|
19739 | filter$1.slider = undefined;
|
19740 | return;
|
19741 | }
|
19742 |
|
19743 | var options = {
|
19744 | 'visible': this.showAnimationControls
|
19745 | };
|
19746 | var slider = new Slider(filter$1, options);
|
19747 | filter$1.slider = slider;
|
19748 |
|
19749 | filter$1.style.padding = '10px';
|
19750 |
|
19751 | slider.setValues(values(dataFilter));
|
19752 | slider.setPlayInterval(this.animationInterval);
|
19753 |
|
19754 | var me = this;
|
19755 |
|
19756 | var onchange = function onchange() {
|
19757 | var dataFilter = me.dataGroup.dataFilter;
|
19758 | var index = slider.getIndex();
|
19759 | dataFilter.selectValue(index);
|
19760 | me.dataPoints = dataFilter._getDataPoints();
|
19761 | me.redraw();
|
19762 | };
|
19763 |
|
19764 | slider.setOnChangeCallback(onchange);
|
19765 | };
|
19766 |
|
19767 |
|
19768 |
|
19769 |
|
19770 |
|
19771 | Graph3d$1.prototype._redrawSlider = function () {
|
19772 | if (filter(this.frame).slider !== undefined) {
|
19773 | filter(this.frame).slider.redraw();
|
19774 | }
|
19775 | };
|
19776 |
|
19777 |
|
19778 |
|
19779 |
|
19780 |
|
19781 | Graph3d$1.prototype._redrawInfo = function () {
|
19782 | var info = this.dataGroup.getInfo();
|
19783 | if (info === undefined) return;
|
19784 |
|
19785 | var ctx = this._getContext();
|
19786 |
|
19787 | ctx.font = '14px arial';
|
19788 |
|
19789 | ctx.lineStyle = 'gray';
|
19790 | ctx.fillStyle = 'gray';
|
19791 | ctx.textAlign = 'left';
|
19792 | ctx.textBaseline = 'top';
|
19793 | var x = this.margin;
|
19794 | var y = this.margin;
|
19795 | ctx.fillText(info, x, y);
|
19796 | };
|
19797 |
|
19798 |
|
19799 |
|
19800 |
|
19801 |
|
19802 |
|
19803 |
|
19804 |
|
19805 |
|
19806 |
|
19807 |
|
19808 |
|
19809 |
|
19810 | Graph3d$1.prototype._line = function (ctx, from, to, strokeStyle) {
|
19811 | if (strokeStyle !== undefined) {
|
19812 | ctx.strokeStyle = strokeStyle;
|
19813 | }
|
19814 |
|
19815 | ctx.beginPath();
|
19816 | ctx.moveTo(from.x, from.y);
|
19817 | ctx.lineTo(to.x, to.y);
|
19818 | ctx.stroke();
|
19819 | };
|
19820 |
|
19821 |
|
19822 |
|
19823 |
|
19824 |
|
19825 |
|
19826 |
|
19827 |
|
19828 |
|
19829 |
|
19830 | Graph3d$1.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) {
|
19831 | if (yMargin === undefined) {
|
19832 | yMargin = 0;
|
19833 | }
|
19834 |
|
19835 | var point2d = this._convert3Dto2D(point3d);
|
19836 |
|
19837 | if (Math.cos(armAngle * 2) > 0) {
|
19838 | ctx.textAlign = 'center';
|
19839 | ctx.textBaseline = 'top';
|
19840 | point2d.y += yMargin;
|
19841 | } else if (Math.sin(armAngle * 2) < 0) {
|
19842 | ctx.textAlign = 'right';
|
19843 | ctx.textBaseline = 'middle';
|
19844 | } else {
|
19845 | ctx.textAlign = 'left';
|
19846 | ctx.textBaseline = 'middle';
|
19847 | }
|
19848 |
|
19849 | ctx.fillStyle = this.axisColor;
|
19850 | ctx.fillText(text, point2d.x, point2d.y);
|
19851 | };
|
19852 |
|
19853 |
|
19854 |
|
19855 |
|
19856 |
|
19857 |
|
19858 |
|
19859 |
|
19860 |
|
19861 |
|
19862 | Graph3d$1.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) {
|
19863 | if (yMargin === undefined) {
|
19864 | yMargin = 0;
|
19865 | }
|
19866 |
|
19867 | var point2d = this._convert3Dto2D(point3d);
|
19868 |
|
19869 | if (Math.cos(armAngle * 2) < 0) {
|
19870 | ctx.textAlign = 'center';
|
19871 | ctx.textBaseline = 'top';
|
19872 | point2d.y += yMargin;
|
19873 | } else if (Math.sin(armAngle * 2) > 0) {
|
19874 | ctx.textAlign = 'right';
|
19875 | ctx.textBaseline = 'middle';
|
19876 | } else {
|
19877 | ctx.textAlign = 'left';
|
19878 | ctx.textBaseline = 'middle';
|
19879 | }
|
19880 |
|
19881 | ctx.fillStyle = this.axisColor;
|
19882 | ctx.fillText(text, point2d.x, point2d.y);
|
19883 | };
|
19884 |
|
19885 |
|
19886 |
|
19887 |
|
19888 |
|
19889 |
|
19890 |
|
19891 |
|
19892 |
|
19893 | Graph3d$1.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) {
|
19894 | if (offset === undefined) {
|
19895 | offset = 0;
|
19896 | }
|
19897 |
|
19898 | var point2d = this._convert3Dto2D(point3d);
|
19899 |
|
19900 | ctx.textAlign = 'right';
|
19901 | ctx.textBaseline = 'middle';
|
19902 | ctx.fillStyle = this.axisColor;
|
19903 | ctx.fillText(text, point2d.x - offset, point2d.y);
|
19904 | };
|
19905 |
|
19906 |
|
19907 |
|
19908 |
|
19909 |
|
19910 |
|
19911 |
|
19912 |
|
19913 |
|
19914 |
|
19915 | Graph3d$1.prototype.drawAxisLabelXRotate = function (ctx, point3d, text, armAngle, yMargin) {
|
19916 |
|
19917 | var point2d = this._convert3Dto2D(point3d);
|
19918 |
|
19919 | if (Math.cos(armAngle * 2) > 0) {
|
19920 | ctx.save();
|
19921 | ctx.translate(point2d.x, point2d.y);
|
19922 | ctx.rotate(-Math.PI / 2);
|
19923 | ctx.textAlign = 'right';
|
19924 | ctx.textBaseline = 'middle';
|
19925 | ctx.fillStyle = this.axisColor;
|
19926 | ctx.fillText(text, 0, 0);
|
19927 | ctx.restore();
|
19928 | } else if (Math.sin(armAngle * 2) < 0) {
|
19929 | ctx.textAlign = 'right';
|
19930 | ctx.textBaseline = 'middle';
|
19931 | ctx.fillStyle = this.axisColor;
|
19932 | ctx.fillText(text, point2d.x, point2d.y);
|
19933 | } else {
|
19934 | ctx.textAlign = 'left';
|
19935 | ctx.textBaseline = 'middle';
|
19936 | ctx.fillStyle = this.axisColor;
|
19937 | ctx.fillText(text, point2d.x, point2d.y);
|
19938 | }
|
19939 | };
|
19940 |
|
19941 |
|
19942 |
|
19943 |
|
19944 |
|
19945 |
|
19946 |
|
19947 |
|
19948 |
|
19949 |
|
19950 | Graph3d$1.prototype.drawAxisLabelYRotate = function (ctx, point3d, text, armAngle, yMargin) {
|
19951 |
|
19952 | var point2d = this._convert3Dto2D(point3d);
|
19953 |
|
19954 | if (Math.cos(armAngle * 2) < 0) {
|
19955 | ctx.save();
|
19956 | ctx.translate(point2d.x, point2d.y);
|
19957 | ctx.rotate(-Math.PI / 2);
|
19958 | ctx.textAlign = 'right';
|
19959 | ctx.textBaseline = 'middle';
|
19960 | ctx.fillStyle = this.axisColor;
|
19961 | ctx.fillText(text, 0, 0);
|
19962 | ctx.restore();
|
19963 | } else if (Math.sin(armAngle * 2) > 0) {
|
19964 | ctx.textAlign = 'right';
|
19965 | ctx.textBaseline = 'middle';
|
19966 | ctx.fillStyle = this.axisColor;
|
19967 | ctx.fillText(text, point2d.x, point2d.y);
|
19968 | } else {
|
19969 | ctx.textAlign = 'left';
|
19970 | ctx.textBaseline = 'middle';
|
19971 | ctx.fillStyle = this.axisColor;
|
19972 | ctx.fillText(text, point2d.x, point2d.y);
|
19973 | }
|
19974 | };
|
19975 |
|
19976 |
|
19977 |
|
19978 |
|
19979 |
|
19980 |
|
19981 |
|
19982 |
|
19983 |
|
19984 | Graph3d$1.prototype.drawAxisLabelZRotate = function (ctx, point3d, text, offset) {
|
19985 | if (offset === undefined) {
|
19986 | offset = 0;
|
19987 | }
|
19988 |
|
19989 | var point2d = this._convert3Dto2D(point3d);
|
19990 |
|
19991 | ctx.textAlign = 'right';
|
19992 | ctx.textBaseline = 'middle';
|
19993 | ctx.fillStyle = this.axisColor;
|
19994 | ctx.fillText(text, point2d.x - offset, point2d.y);
|
19995 | };
|
19996 |
|
19997 |
|
19998 |
|
19999 |
|
20000 |
|
20001 |
|
20002 |
|
20003 |
|
20004 |
|
20005 |
|
20006 |
|
20007 |
|
20008 |
|
20009 |
|
20010 |
|
20011 |
|
20012 | Graph3d$1.prototype._line3d = function (ctx, from, to, strokeStyle) {
|
20013 | var from2d = this._convert3Dto2D(from);
|
20014 |
|
20015 | var to2d = this._convert3Dto2D(to);
|
20016 |
|
20017 | this._line(ctx, from2d, to2d, strokeStyle);
|
20018 | };
|
20019 |
|
20020 |
|
20021 |
|
20022 |
|
20023 |
|
20024 | Graph3d$1.prototype._redrawAxis = function () {
|
20025 | var ctx = this._getContext(),
|
20026 | from,
|
20027 | to,
|
20028 | step,
|
20029 | prettyStep,
|
20030 | text,
|
20031 | xText,
|
20032 | yText,
|
20033 | zText,
|
20034 | offset,
|
20035 | xOffset,
|
20036 | yOffset;
|
20037 |
|
20038 |
|
20039 |
|
20040 |
|
20041 | ctx.font = this.axisFontSize / this.camera.getArmLength() + 'px ' + this.axisFontType;
|
20042 |
|
20043 | var gridLenX = 0.025 / this.scale.x;
|
20044 | var gridLenY = 0.025 / this.scale.y;
|
20045 | var textMargin = 5 / this.camera.getArmLength();
|
20046 |
|
20047 | var armAngle = this.camera.getArmRotation().horizontal;
|
20048 | var armVector = new Point2d_1(Math.cos(armAngle), Math.sin(armAngle));
|
20049 | var xRange = this.xRange;
|
20050 | var yRange = this.yRange;
|
20051 | var zRange = this.zRange;
|
20052 | var point3d;
|
20053 |
|
20054 | ctx.lineWidth = 1;
|
20055 | prettyStep = this.defaultXStep === undefined;
|
20056 | step = new StepNumber_1(xRange.min, xRange.max, this.xStep, prettyStep);
|
20057 | step.start(true);
|
20058 |
|
20059 | while (!step.end()) {
|
20060 | var x = step.getCurrent();
|
20061 |
|
20062 | if (this.showGrid) {
|
20063 | from = new Point3d_1(x, yRange.min, zRange.min);
|
20064 | to = new Point3d_1(x, yRange.max, zRange.min);
|
20065 |
|
20066 | this._line3d(ctx, from, to, this.gridColor);
|
20067 | } else if (this.showXAxis) {
|
20068 | from = new Point3d_1(x, yRange.min, zRange.min);
|
20069 | to = new Point3d_1(x, yRange.min + gridLenX, zRange.min);
|
20070 |
|
20071 | this._line3d(ctx, from, to, this.axisColor);
|
20072 |
|
20073 | from = new Point3d_1(x, yRange.max, zRange.min);
|
20074 | to = new Point3d_1(x, yRange.max - gridLenX, zRange.min);
|
20075 |
|
20076 | this._line3d(ctx, from, to, this.axisColor);
|
20077 | }
|
20078 |
|
20079 | if (this.showXAxis) {
|
20080 | yText = armVector.x > 0 ? yRange.min : yRange.max;
|
20081 | point3d = new Point3d_1(x, yText, zRange.min);
|
20082 | var msg = ' ' + this.xValueLabel(x) + ' ';
|
20083 |
|
20084 | this._drawAxisLabelX.call(this, ctx, point3d, msg, armAngle, textMargin);
|
20085 | }
|
20086 |
|
20087 | step.next();
|
20088 | }
|
20089 |
|
20090 |
|
20091 | ctx.lineWidth = 1;
|
20092 | prettyStep = this.defaultYStep === undefined;
|
20093 | step = new StepNumber_1(yRange.min, yRange.max, this.yStep, prettyStep);
|
20094 | step.start(true);
|
20095 |
|
20096 | while (!step.end()) {
|
20097 | var y = step.getCurrent();
|
20098 |
|
20099 | if (this.showGrid) {
|
20100 | from = new Point3d_1(xRange.min, y, zRange.min);
|
20101 | to = new Point3d_1(xRange.max, y, zRange.min);
|
20102 |
|
20103 | this._line3d(ctx, from, to, this.gridColor);
|
20104 | } else if (this.showYAxis) {
|
20105 | from = new Point3d_1(xRange.min, y, zRange.min);
|
20106 | to = new Point3d_1(xRange.min + gridLenY, y, zRange.min);
|
20107 |
|
20108 | this._line3d(ctx, from, to, this.axisColor);
|
20109 |
|
20110 | from = new Point3d_1(xRange.max, y, zRange.min);
|
20111 | to = new Point3d_1(xRange.max - gridLenY, y, zRange.min);
|
20112 |
|
20113 | this._line3d(ctx, from, to, this.axisColor);
|
20114 | }
|
20115 |
|
20116 | if (this.showYAxis) {
|
20117 | xText = armVector.y > 0 ? xRange.min : xRange.max;
|
20118 | point3d = new Point3d_1(xText, y, zRange.min);
|
20119 |
|
20120 | var _msg = ' ' + this.yValueLabel(y) + ' ';
|
20121 |
|
20122 | this._drawAxisLabelY.call(this, ctx, point3d, _msg, armAngle, textMargin);
|
20123 | }
|
20124 |
|
20125 | step.next();
|
20126 | }
|
20127 |
|
20128 |
|
20129 | if (this.showZAxis) {
|
20130 | ctx.lineWidth = 1;
|
20131 | prettyStep = this.defaultZStep === undefined;
|
20132 | step = new StepNumber_1(zRange.min, zRange.max, this.zStep, prettyStep);
|
20133 | step.start(true);
|
20134 | xText = armVector.x > 0 ? xRange.min : xRange.max;
|
20135 | yText = armVector.y < 0 ? yRange.min : yRange.max;
|
20136 |
|
20137 | while (!step.end()) {
|
20138 | var z = step.getCurrent();
|
20139 |
|
20140 | var from3d = new Point3d_1(xText, yText, z);
|
20141 |
|
20142 | var from2d = this._convert3Dto2D(from3d);
|
20143 |
|
20144 | to = new Point2d_1(from2d.x - textMargin, from2d.y);
|
20145 |
|
20146 | this._line(ctx, from2d, to, this.axisColor);
|
20147 |
|
20148 | var _msg2 = this.zValueLabel(z) + ' ';
|
20149 |
|
20150 | this._drawAxisLabelZ.call(this, ctx, from3d, _msg2, 5);
|
20151 |
|
20152 | step.next();
|
20153 | }
|
20154 |
|
20155 | ctx.lineWidth = 1;
|
20156 | from = new Point3d_1(xText, yText, zRange.min);
|
20157 | to = new Point3d_1(xText, yText, zRange.max);
|
20158 |
|
20159 | this._line3d(ctx, from, to, this.axisColor);
|
20160 | }
|
20161 |
|
20162 |
|
20163 | if (this.showXAxis) {
|
20164 | var xMin2d;
|
20165 | var xMax2d;
|
20166 | ctx.lineWidth = 1;
|
20167 |
|
20168 | xMin2d = new Point3d_1(xRange.min, yRange.min, zRange.min);
|
20169 | xMax2d = new Point3d_1(xRange.max, yRange.min, zRange.min);
|
20170 |
|
20171 | this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
|
20172 |
|
20173 |
|
20174 | xMin2d = new Point3d_1(xRange.min, yRange.max, zRange.min);
|
20175 | xMax2d = new Point3d_1(xRange.max, yRange.max, zRange.min);
|
20176 |
|
20177 | this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
|
20178 | }
|
20179 |
|
20180 |
|
20181 | if (this.showYAxis) {
|
20182 | ctx.lineWidth = 1;
|
20183 |
|
20184 | from = new Point3d_1(xRange.min, yRange.min, zRange.min);
|
20185 | to = new Point3d_1(xRange.min, yRange.max, zRange.min);
|
20186 |
|
20187 | this._line3d(ctx, from, to, this.axisColor);
|
20188 |
|
20189 |
|
20190 | from = new Point3d_1(xRange.max, yRange.min, zRange.min);
|
20191 | to = new Point3d_1(xRange.max, yRange.max, zRange.min);
|
20192 |
|
20193 | this._line3d(ctx, from, to, this.axisColor);
|
20194 | }
|
20195 |
|
20196 |
|
20197 | var xLabel = this.xLabel;
|
20198 |
|
20199 | if (xLabel.length > 0 && this.showXAxis) {
|
20200 | yOffset = 0.1 / this.scale.y;
|
20201 | xText = (xRange.max + 3 * xRange.min) / 4;
|
20202 | yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset;
|
20203 | text = new Point3d_1(xText, yText, zRange.min);
|
20204 | this.drawAxisLabelX(ctx, text, xLabel, armAngle);
|
20205 | }
|
20206 |
|
20207 |
|
20208 | var yLabel = this.yLabel;
|
20209 |
|
20210 | if (yLabel.length > 0 && this.showYAxis) {
|
20211 | xOffset = 0.1 / this.scale.x;
|
20212 | xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset;
|
20213 | yText = (yRange.max + 3 * yRange.min) / 4;
|
20214 | text = new Point3d_1(xText, yText, zRange.min);
|
20215 | this.drawAxisLabelY(ctx, text, yLabel, armAngle);
|
20216 | }
|
20217 |
|
20218 |
|
20219 | var zLabel = this.zLabel;
|
20220 |
|
20221 | if (zLabel.length > 0 && this.showZAxis) {
|
20222 | offset = 30;
|
20223 |
|
20224 | xText = armVector.x > 0 ? xRange.min : xRange.max;
|
20225 | yText = armVector.y < 0 ? yRange.min : yRange.max;
|
20226 | zText = (zRange.max + 3 * zRange.min) / 4;
|
20227 | text = new Point3d_1(xText, yText, zText);
|
20228 | this.drawAxisLabelZ(ctx, text, zLabel, offset);
|
20229 | }
|
20230 | };
|
20231 |
|
20232 |
|
20233 |
|
20234 |
|
20235 |
|
20236 |
|
20237 |
|
20238 |
|
20239 | Graph3d$1.prototype._getStrokeWidth = function (point) {
|
20240 | if (point !== undefined) {
|
20241 | if (this.showPerspective) {
|
20242 | return 1 / -point.trans.z * this.dataColor.strokeWidth;
|
20243 | } else {
|
20244 | return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth;
|
20245 | }
|
20246 | }
|
20247 |
|
20248 | return this.dataColor.strokeWidth;
|
20249 | };
|
20250 |
|
20251 |
|
20252 |
|
20253 |
|
20254 |
|
20255 |
|
20256 |
|
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 |
|
20263 |
|
20264 |
|
20265 |
|
20266 | Graph3d$1.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) {
|
20267 | var surface;
|
20268 |
|
20269 | var me = this;
|
20270 | var point3d = point.point;
|
20271 | var zMin = this.zRange.min;
|
20272 | var top = [{
|
20273 | point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, point3d.z)
|
20274 | }, {
|
20275 | point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, point3d.z)
|
20276 | }, {
|
20277 | point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, point3d.z)
|
20278 | }, {
|
20279 | point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, point3d.z)
|
20280 | }];
|
20281 | var bottom = [{
|
20282 | point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, zMin)
|
20283 | }, {
|
20284 | point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, zMin)
|
20285 | }, {
|
20286 | point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, zMin)
|
20287 | }, {
|
20288 | point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, zMin)
|
20289 | }];
|
20290 |
|
20291 | forEach$2(top).call(top, function (obj) {
|
20292 | obj.screen = me._convert3Dto2D(obj.point);
|
20293 | });
|
20294 |
|
20295 | forEach$2(bottom).call(bottom, function (obj) {
|
20296 | obj.screen = me._convert3Dto2D(obj.point);
|
20297 | });
|
20298 |
|
20299 |
|
20300 | var surfaces = [{
|
20301 | corners: top,
|
20302 | center: Point3d_1.avg(bottom[0].point, bottom[2].point)
|
20303 | }, {
|
20304 | corners: [top[0], top[1], bottom[1], bottom[0]],
|
20305 | center: Point3d_1.avg(bottom[1].point, bottom[0].point)
|
20306 | }, {
|
20307 | corners: [top[1], top[2], bottom[2], bottom[1]],
|
20308 | center: Point3d_1.avg(bottom[2].point, bottom[1].point)
|
20309 | }, {
|
20310 | corners: [top[2], top[3], bottom[3], bottom[2]],
|
20311 | center: Point3d_1.avg(bottom[3].point, bottom[2].point)
|
20312 | }, {
|
20313 | corners: [top[3], top[0], bottom[0], bottom[3]],
|
20314 | center: Point3d_1.avg(bottom[0].point, bottom[3].point)
|
20315 | }];
|
20316 | point.surfaces = surfaces;
|
20317 |
|
20318 | for (var j = 0; j < surfaces.length; j++) {
|
20319 | surface = surfaces[j];
|
20320 |
|
20321 | var transCenter = this._convertPointToTranslation(surface.center);
|
20322 |
|
20323 | surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z;
|
20324 |
|
20325 |
|
20326 | }
|
20327 |
|
20328 |
|
20329 | sort(surfaces).call(surfaces, function (a, b) {
|
20330 | var diff = b.dist - a.dist;
|
20331 | if (diff) return diff;
|
20332 |
|
20333 | if (a.corners === top) return 1;
|
20334 | if (b.corners === top) return -1;
|
20335 |
|
20336 | return 0;
|
20337 | });
|
20338 |
|
20339 |
|
20340 | ctx.lineWidth = this._getStrokeWidth(point);
|
20341 | ctx.strokeStyle = borderColor;
|
20342 | ctx.fillStyle = color;
|
20343 |
|
20344 | for (var _j = 2; _j < surfaces.length; _j++) {
|
20345 | surface = surfaces[_j];
|
20346 |
|
20347 | this._polygon(ctx, surface.corners);
|
20348 | }
|
20349 | };
|
20350 |
|
20351 |
|
20352 |
|
20353 |
|
20354 |
|
20355 |
|
20356 |
|
20357 |
|
20358 |
|
20359 |
|
20360 | Graph3d$1.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) {
|
20361 | if (points.length < 2) {
|
20362 | return;
|
20363 | }
|
20364 |
|
20365 | if (fillStyle !== undefined) {
|
20366 | ctx.fillStyle = fillStyle;
|
20367 | }
|
20368 |
|
20369 | if (strokeStyle !== undefined) {
|
20370 | ctx.strokeStyle = strokeStyle;
|
20371 | }
|
20372 |
|
20373 | ctx.beginPath();
|
20374 | ctx.moveTo(points[0].screen.x, points[0].screen.y);
|
20375 |
|
20376 | for (var i = 1; i < points.length; ++i) {
|
20377 | var point = points[i];
|
20378 | ctx.lineTo(point.screen.x, point.screen.y);
|
20379 | }
|
20380 |
|
20381 | ctx.closePath();
|
20382 |
|
20383 | fill(ctx).call(ctx);
|
20384 |
|
20385 | ctx.stroke();
|
20386 | };
|
20387 |
|
20388 |
|
20389 |
|
20390 |
|
20391 |
|
20392 |
|
20393 |
|
20394 |
|
20395 |
|
20396 |
|
20397 | Graph3d$1.prototype._drawCircle = function (ctx, point, color, borderColor, size) {
|
20398 | var radius = this._calcRadius(point, size);
|
20399 |
|
20400 | ctx.lineWidth = this._getStrokeWidth(point);
|
20401 | ctx.strokeStyle = borderColor;
|
20402 | ctx.fillStyle = color;
|
20403 | ctx.beginPath();
|
20404 | ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true);
|
20405 |
|
20406 | fill(ctx).call(ctx);
|
20407 |
|
20408 | ctx.stroke();
|
20409 | };
|
20410 |
|
20411 |
|
20412 |
|
20413 |
|
20414 |
|
20415 |
|
20416 |
|
20417 |
|
20418 |
|
20419 | Graph3d$1.prototype._getColorsRegular = function (point) {
|
20420 | var f = (point.point.value - this.valueRange.min) * this.scale.value;
|
20421 |
|
20422 | var color = this._colormap(f, 1);
|
20423 |
|
20424 | var borderColor = this._colormap(f, 0.8);
|
20425 |
|
20426 | return {
|
20427 | fill: color,
|
20428 | border: borderColor
|
20429 | };
|
20430 | };
|
20431 |
|
20432 |
|
20433 |
|
20434 |
|
20435 |
|
20436 |
|
20437 |
|
20438 |
|
20439 |
|
20440 |
|
20441 |
|
20442 |
|
20443 |
|
20444 |
|
20445 | Graph3d$1.prototype._getColorsColor = function (point) {
|
20446 |
|
20447 | var color, borderColor, pointStyle;
|
20448 |
|
20449 | if (point && point.point && point.point.data && point.point.data.style) {
|
20450 | pointStyle = point.point.data.style;
|
20451 | }
|
20452 |
|
20453 | if (pointStyle && _typeof(pointStyle) === 'object' && fill(pointStyle) && pointStyle.stroke) {
|
20454 | return {
|
20455 | fill: fill(pointStyle),
|
20456 | border: pointStyle.stroke
|
20457 | };
|
20458 | }
|
20459 |
|
20460 | if (typeof point.point.value === "string") {
|
20461 | color = point.point.value;
|
20462 | borderColor = point.point.value;
|
20463 | } else {
|
20464 | var f = (point.point.value - this.valueRange.min) * this.scale.value;
|
20465 | color = this._colormap(f, 1);
|
20466 | borderColor = this._colormap(f, 0.8);
|
20467 | }
|
20468 |
|
20469 | return {
|
20470 | fill: color,
|
20471 | border: borderColor
|
20472 | };
|
20473 | };
|
20474 |
|
20475 |
|
20476 |
|
20477 |
|
20478 |
|
20479 |
|
20480 |
|
20481 |
|
20482 |
|
20483 | Graph3d$1.prototype._getColorsSize = function () {
|
20484 | return {
|
20485 | fill: fill(this.dataColor),
|
20486 | border: this.dataColor.stroke
|
20487 | };
|
20488 | };
|
20489 |
|
20490 |
|
20491 |
|
20492 |
|
20493 |
|
20494 |
|
20495 |
|
20496 |
|
20497 |
|
20498 |
|
20499 | Graph3d$1.prototype._colormap = function (x) {
|
20500 | var v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
20501 | var r, g, b, a;
|
20502 | var colormap = this.colormap;
|
20503 |
|
20504 | if (isArray(colormap)) {
|
20505 | var maxIndex = colormap.length - 1;
|
20506 | var startIndex = Math.max(Math.floor(x * maxIndex), 0);
|
20507 | var endIndex = Math.min(startIndex + 1, maxIndex);
|
20508 | var innerRatio = x * maxIndex - startIndex;
|
20509 | var min = colormap[startIndex];
|
20510 | var max = colormap[endIndex];
|
20511 | r = min.r + innerRatio * (max.r - min.r);
|
20512 | g = min.g + innerRatio * (max.g - min.g);
|
20513 | b = min.b + innerRatio * (max.b - min.b);
|
20514 | } else if (typeof colormap === 'function') {
|
20515 | var _colormap = colormap(x);
|
20516 |
|
20517 | r = _colormap.r;
|
20518 | g = _colormap.g;
|
20519 | b = _colormap.b;
|
20520 | a = _colormap.a;
|
20521 | } else {
|
20522 | var hue = (1 - x) * 240;
|
20523 |
|
20524 | var _util$HSVToRGB = HSVToRGB(hue / 360, 1, 1);
|
20525 |
|
20526 | r = _util$HSVToRGB.r;
|
20527 | g = _util$HSVToRGB.g;
|
20528 | b = _util$HSVToRGB.b;
|
20529 | }
|
20530 |
|
20531 | if (typeof a === 'number' && !isNan(a)) {
|
20532 | var _context, _context2, _context3;
|
20533 |
|
20534 | return concat(_context = concat(_context2 = concat(_context3 = "RGBA(".concat(Math.round(r * v), ", ")).call(_context3, Math.round(g * v), ", ")).call(_context2, Math.round(b * v), ", ")).call(_context, a, ")");
|
20535 | } else {
|
20536 | var _context4, _context5;
|
20537 |
|
20538 | return concat(_context4 = concat(_context5 = "RGB(".concat(Math.round(r * v), ", ")).call(_context5, Math.round(g * v), ", ")).call(_context4, Math.round(b * v), ")");
|
20539 | }
|
20540 | };
|
20541 |
|
20542 |
|
20543 |
|
20544 |
|
20545 |
|
20546 |
|
20547 |
|
20548 |
|
20549 |
|
20550 |
|
20551 |
|
20552 |
|
20553 | Graph3d$1.prototype._calcRadius = function (point, size) {
|
20554 | if (size === undefined) {
|
20555 | size = this._dotSize();
|
20556 | }
|
20557 |
|
20558 | var radius;
|
20559 |
|
20560 | if (this.showPerspective) {
|
20561 | radius = size / -point.trans.z;
|
20562 | } else {
|
20563 | radius = size * -(this.eye.z / this.camera.getArmLength());
|
20564 | }
|
20565 |
|
20566 | if (radius < 0) {
|
20567 | radius = 0;
|
20568 | }
|
20569 |
|
20570 | return radius;
|
20571 | };
|
20572 |
|
20573 |
|
20574 |
|
20575 |
|
20576 |
|
20577 |
|
20578 |
|
20579 |
|
20580 |
|
20581 |
|
20582 |
|
20583 |
|
20584 | Graph3d$1.prototype._redrawBarGraphPoint = function (ctx, point) {
|
20585 | var xWidth = this.xBarWidth / 2;
|
20586 | var yWidth = this.yBarWidth / 2;
|
20587 |
|
20588 | var colors = this._getColorsRegular(point);
|
20589 |
|
20590 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
20591 | };
|
20592 |
|
20593 |
|
20594 |
|
20595 |
|
20596 |
|
20597 |
|
20598 |
|
20599 |
|
20600 |
|
20601 | Graph3d$1.prototype._redrawBarColorGraphPoint = function (ctx, point) {
|
20602 | var xWidth = this.xBarWidth / 2;
|
20603 | var yWidth = this.yBarWidth / 2;
|
20604 |
|
20605 | var colors = this._getColorsColor(point);
|
20606 |
|
20607 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
20608 | };
|
20609 |
|
20610 |
|
20611 |
|
20612 |
|
20613 |
|
20614 |
|
20615 |
|
20616 |
|
20617 |
|
20618 | Graph3d$1.prototype._redrawBarSizeGraphPoint = function (ctx, point) {
|
20619 |
|
20620 | var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
|
20621 | var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2);
|
20622 | var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2);
|
20623 |
|
20624 | var colors = this._getColorsSize();
|
20625 |
|
20626 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
20627 | };
|
20628 |
|
20629 |
|
20630 |
|
20631 |
|
20632 |
|
20633 |
|
20634 |
|
20635 |
|
20636 |
|
20637 | Graph3d$1.prototype._redrawDotGraphPoint = function (ctx, point) {
|
20638 | var colors = this._getColorsRegular(point);
|
20639 |
|
20640 | this._drawCircle(ctx, point, fill(colors), colors.border);
|
20641 | };
|
20642 |
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 | Graph3d$1.prototype._redrawDotLineGraphPoint = function (ctx, point) {
|
20652 |
|
20653 | var from = this._convert3Dto2D(point.bottom);
|
20654 |
|
20655 | ctx.lineWidth = 1;
|
20656 |
|
20657 | this._line(ctx, from, point.screen, this.gridColor);
|
20658 |
|
20659 | this._redrawDotGraphPoint(ctx, point);
|
20660 | };
|
20661 |
|
20662 |
|
20663 |
|
20664 |
|
20665 |
|
20666 |
|
20667 |
|
20668 |
|
20669 |
|
20670 | Graph3d$1.prototype._redrawDotColorGraphPoint = function (ctx, point) {
|
20671 | var colors = this._getColorsColor(point);
|
20672 |
|
20673 | this._drawCircle(ctx, point, fill(colors), colors.border);
|
20674 | };
|
20675 |
|
20676 |
|
20677 |
|
20678 |
|
20679 |
|
20680 |
|
20681 |
|
20682 |
|
20683 |
|
20684 | Graph3d$1.prototype._redrawDotSizeGraphPoint = function (ctx, point) {
|
20685 | var dotSize = this._dotSize();
|
20686 |
|
20687 | var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
|
20688 | var sizeMin = dotSize * this.dotSizeMinFraction;
|
20689 | var sizeRange = dotSize * this.dotSizeMaxFraction - sizeMin;
|
20690 | var size = sizeMin + sizeRange * fraction;
|
20691 |
|
20692 | var colors = this._getColorsSize();
|
20693 |
|
20694 | this._drawCircle(ctx, point, fill(colors), colors.border, size);
|
20695 | };
|
20696 |
|
20697 |
|
20698 |
|
20699 |
|
20700 |
|
20701 |
|
20702 |
|
20703 |
|
20704 |
|
20705 | Graph3d$1.prototype._redrawSurfaceGraphPoint = function (ctx, point) {
|
20706 | var right = point.pointRight;
|
20707 | var top = point.pointTop;
|
20708 | var cross = point.pointCross;
|
20709 |
|
20710 | if (point === undefined || right === undefined || top === undefined || cross === undefined) {
|
20711 | return;
|
20712 | }
|
20713 |
|
20714 | var topSideVisible = true;
|
20715 | var fillStyle;
|
20716 | var strokeStyle;
|
20717 | var cosViewAngle;
|
20718 |
|
20719 | if (this.showGrayBottom || this.showShadow) {
|
20720 |
|
20721 |
|
20722 |
|
20723 |
|
20724 | var aDiff = Point3d_1.subtract(cross.trans, point.trans);
|
20725 | var bDiff = Point3d_1.subtract(top.trans, right.trans);
|
20726 | var surfaceNormal = Point3d_1.crossProduct(aDiff, bDiff);
|
20727 |
|
20728 | if (this.showPerspective) {
|
20729 | var surfacePosition = Point3d_1.avg(Point3d_1.avg(point.trans, cross.trans), Point3d_1.avg(right.trans, top.trans));
|
20730 |
|
20731 |
|
20732 | cosViewAngle = -Point3d_1.dotProduct(surfaceNormal.normalize(), surfacePosition.normalize());
|
20733 | } else {
|
20734 | cosViewAngle = surfaceNormal.z / surfaceNormal.length();
|
20735 | }
|
20736 |
|
20737 | topSideVisible = cosViewAngle > 0;
|
20738 | }
|
20739 |
|
20740 | if (topSideVisible || !this.showGrayBottom) {
|
20741 | var vAvg = (point.point.value + right.point.value + top.point.value + cross.point.value) / 4;
|
20742 | var ratio = (vAvg - this.valueRange.min) * this.scale.value;
|
20743 |
|
20744 | var v = this.showShadow ? (1 + cosViewAngle) / 2 : 1;
|
20745 | fillStyle = this._colormap(ratio, v);
|
20746 | } else {
|
20747 | fillStyle = 'gray';
|
20748 | }
|
20749 |
|
20750 | if (this.showSurfaceGrid) {
|
20751 | strokeStyle = this.axisColor;
|
20752 | } else {
|
20753 | strokeStyle = fillStyle;
|
20754 | }
|
20755 |
|
20756 | ctx.lineWidth = this._getStrokeWidth(point);
|
20757 |
|
20758 | var points = [point, right, cross, top];
|
20759 |
|
20760 | this._polygon(ctx, points, fillStyle, strokeStyle);
|
20761 | };
|
20762 |
|
20763 |
|
20764 |
|
20765 |
|
20766 |
|
20767 |
|
20768 |
|
20769 |
|
20770 |
|
20771 |
|
20772 | Graph3d$1.prototype._drawGridLine = function (ctx, from, to) {
|
20773 | if (from === undefined || to === undefined) {
|
20774 | return;
|
20775 | }
|
20776 |
|
20777 | var vAvg = (from.point.value + to.point.value) / 2;
|
20778 | var f = (vAvg - this.valueRange.min) * this.scale.value;
|
20779 | ctx.lineWidth = this._getStrokeWidth(from) * 2;
|
20780 | ctx.strokeStyle = this._colormap(f, 1);
|
20781 |
|
20782 | this._line(ctx, from.screen, to.screen);
|
20783 | };
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 |
|
20790 |
|
20791 |
|
20792 |
|
20793 | Graph3d$1.prototype._redrawGridGraphPoint = function (ctx, point) {
|
20794 | this._drawGridLine(ctx, point, point.pointRight);
|
20795 |
|
20796 | this._drawGridLine(ctx, point, point.pointTop);
|
20797 | };
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 | Graph3d$1.prototype._redrawLineGraphPoint = function (ctx, point) {
|
20808 | if (point.pointNext === undefined) {
|
20809 | return;
|
20810 | }
|
20811 |
|
20812 | ctx.lineWidth = this._getStrokeWidth(point);
|
20813 | ctx.strokeStyle = this.dataColor.stroke;
|
20814 |
|
20815 | this._line(ctx, point.screen, point.pointNext.screen);
|
20816 | };
|
20817 |
|
20818 |
|
20819 |
|
20820 |
|
20821 |
|
20822 |
|
20823 | Graph3d$1.prototype._redrawDataGraph = function () {
|
20824 | var ctx = this._getContext();
|
20825 |
|
20826 | var i;
|
20827 | if (this.dataPoints === undefined || this.dataPoints.length <= 0) return;
|
20828 |
|
20829 | this._calcTranslations(this.dataPoints);
|
20830 |
|
20831 | for (i = 0; i < this.dataPoints.length; i++) {
|
20832 | var point = this.dataPoints[i];
|
20833 |
|
20834 | this._pointDrawingMethod.call(this, ctx, point);
|
20835 | }
|
20836 | };
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 |
|
20846 |
|
20847 | Graph3d$1.prototype._storeMousePosition = function (event) {
|
20848 |
|
20849 | this.startMouseX = getMouseX(event);
|
20850 | this.startMouseY = getMouseY(event);
|
20851 | this._startCameraOffset = this.camera.getOffset();
|
20852 | };
|
20853 |
|
20854 |
|
20855 |
|
20856 |
|
20857 |
|
20858 |
|
20859 |
|
20860 | Graph3d$1.prototype._onMouseDown = function (event) {
|
20861 | event = event || window.event;
|
20862 |
|
20863 |
|
20864 | if (this.leftButtonDown) {
|
20865 | this._onMouseUp(event);
|
20866 | }
|
20867 |
|
20868 |
|
20869 | this.leftButtonDown = event.which ? event.which === 1 : event.button === 1;
|
20870 | if (!this.leftButtonDown && !this.touchDown) return;
|
20871 |
|
20872 | this._storeMousePosition(event);
|
20873 |
|
20874 | this.startStart = new Date(this.start);
|
20875 | this.startEnd = new Date(this.end);
|
20876 | this.startArmRotation = this.camera.getArmRotation();
|
20877 | this.frame.style.cursor = 'move';
|
20878 |
|
20879 |
|
20880 |
|
20881 | var me = this;
|
20882 |
|
20883 | this.onmousemove = function (event) {
|
20884 | me._onMouseMove(event);
|
20885 | };
|
20886 |
|
20887 | this.onmouseup = function (event) {
|
20888 | me._onMouseUp(event);
|
20889 | };
|
20890 |
|
20891 | addEventListener(document, 'mousemove', me.onmousemove);
|
20892 | addEventListener(document, 'mouseup', me.onmouseup);
|
20893 | preventDefault(event);
|
20894 | };
|
20895 |
|
20896 |
|
20897 |
|
20898 |
|
20899 |
|
20900 |
|
20901 |
|
20902 | Graph3d$1.prototype._onMouseMove = function (event) {
|
20903 | this.moving = true;
|
20904 | event = event || window.event;
|
20905 |
|
20906 | var diffX = _parseFloat(getMouseX(event)) - this.startMouseX;
|
20907 | var diffY = _parseFloat(getMouseY(event)) - this.startMouseY;
|
20908 |
|
20909 | if (event && event.ctrlKey === true) {
|
20910 |
|
20911 | var scaleX = this.frame.clientWidth * 0.5;
|
20912 | var scaleY = this.frame.clientHeight * 0.5;
|
20913 | var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8;
|
20914 | var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8;
|
20915 | this.camera.setOffset(offXNew, offYNew);
|
20916 |
|
20917 | this._storeMousePosition(event);
|
20918 | } else {
|
20919 | var horizontalNew = this.startArmRotation.horizontal + diffX / 200;
|
20920 | var verticalNew = this.startArmRotation.vertical + diffY / 200;
|
20921 | var snapAngle = 4;
|
20922 |
|
20923 | var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI);
|
20924 |
|
20925 |
|
20926 | if (Math.abs(Math.sin(horizontalNew)) < snapValue) {
|
20927 | horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001;
|
20928 | }
|
20929 |
|
20930 | if (Math.abs(Math.cos(horizontalNew)) < snapValue) {
|
20931 | horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001;
|
20932 | }
|
20933 |
|
20934 |
|
20935 | if (Math.abs(Math.sin(verticalNew)) < snapValue) {
|
20936 | verticalNew = Math.round(verticalNew / Math.PI) * Math.PI;
|
20937 | }
|
20938 |
|
20939 | if (Math.abs(Math.cos(verticalNew)) < snapValue) {
|
20940 | verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI;
|
20941 | }
|
20942 |
|
20943 | this.camera.setArmRotation(horizontalNew, verticalNew);
|
20944 | }
|
20945 |
|
20946 | this.redraw();
|
20947 |
|
20948 | var parameters = this.getCameraPosition();
|
20949 | this.emit('cameraPositionChange', parameters);
|
20950 | preventDefault(event);
|
20951 | };
|
20952 |
|
20953 |
|
20954 |
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 | Graph3d$1.prototype._onMouseUp = function (event) {
|
20960 | this.frame.style.cursor = 'auto';
|
20961 | this.leftButtonDown = false;
|
20962 |
|
20963 | removeEventListener(document, 'mousemove', this.onmousemove);
|
20964 | removeEventListener(document, 'mouseup', this.onmouseup);
|
20965 | preventDefault(event);
|
20966 | };
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 |
|
20972 | Graph3d$1.prototype._onClick = function (event) {
|
20973 |
|
20974 | if (!this.onclick_callback && !this.hasListeners('click')) return;
|
20975 |
|
20976 | if (!this.moving) {
|
20977 | var boundingRect = this.frame.getBoundingClientRect();
|
20978 | var mouseX = getMouseX(event) - boundingRect.left;
|
20979 | var mouseY = getMouseY(event) - boundingRect.top;
|
20980 |
|
20981 | var dataPoint = this._dataPointFromXY(mouseX, mouseY);
|
20982 |
|
20983 | if (dataPoint) {
|
20984 | if (this.onclick_callback) this.onclick_callback(dataPoint.point.data);
|
20985 | this.emit('click', dataPoint.point.data);
|
20986 | }
|
20987 | } else {
|
20988 |
|
20989 | this.moving = false;
|
20990 | }
|
20991 |
|
20992 | preventDefault(event);
|
20993 | };
|
20994 |
|
20995 |
|
20996 |
|
20997 |
|
20998 |
|
20999 |
|
21000 | Graph3d$1.prototype._onTooltip = function (event) {
|
21001 | var delay = this.tooltipDelay;
|
21002 |
|
21003 | var boundingRect = this.frame.getBoundingClientRect();
|
21004 | var mouseX = getMouseX(event) - boundingRect.left;
|
21005 | var mouseY = getMouseY(event) - boundingRect.top;
|
21006 |
|
21007 | if (!this.showTooltip) {
|
21008 | return;
|
21009 | }
|
21010 |
|
21011 | if (this.tooltipTimeout) {
|
21012 | clearTimeout(this.tooltipTimeout);
|
21013 | }
|
21014 |
|
21015 |
|
21016 | if (this.leftButtonDown) {
|
21017 | this._hideTooltip();
|
21018 |
|
21019 | return;
|
21020 | }
|
21021 |
|
21022 | if (this.tooltip && this.tooltip.dataPoint) {
|
21023 |
|
21024 | var dataPoint = this._dataPointFromXY(mouseX, mouseY);
|
21025 |
|
21026 | if (dataPoint !== this.tooltip.dataPoint) {
|
21027 |
|
21028 | if (dataPoint) {
|
21029 | this._showTooltip(dataPoint);
|
21030 | } else {
|
21031 | this._hideTooltip();
|
21032 | }
|
21033 | }
|
21034 | } else {
|
21035 |
|
21036 | var me = this;
|
21037 | this.tooltipTimeout = setTimeout$1(function () {
|
21038 | me.tooltipTimeout = null;
|
21039 |
|
21040 | var dataPoint = me._dataPointFromXY(mouseX, mouseY);
|
21041 |
|
21042 | if (dataPoint) {
|
21043 | me._showTooltip(dataPoint);
|
21044 | }
|
21045 | }, delay);
|
21046 | }
|
21047 | };
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 | Graph3d$1.prototype._onTouchStart = function (event) {
|
21055 | this.touchDown = true;
|
21056 | var me = this;
|
21057 |
|
21058 | this.ontouchmove = function (event) {
|
21059 | me._onTouchMove(event);
|
21060 | };
|
21061 |
|
21062 | this.ontouchend = function (event) {
|
21063 | me._onTouchEnd(event);
|
21064 | };
|
21065 |
|
21066 | addEventListener(document, 'touchmove', me.ontouchmove);
|
21067 | addEventListener(document, 'touchend', me.ontouchend);
|
21068 |
|
21069 | this._onMouseDown(event);
|
21070 | };
|
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 | Graph3d$1.prototype._onTouchMove = function (event) {
|
21078 | this._onMouseMove(event);
|
21079 | };
|
21080 |
|
21081 |
|
21082 |
|
21083 |
|
21084 |
|
21085 |
|
21086 | Graph3d$1.prototype._onTouchEnd = function (event) {
|
21087 | this.touchDown = false;
|
21088 | removeEventListener(document, 'touchmove', this.ontouchmove);
|
21089 | removeEventListener(document, 'touchend', this.ontouchend);
|
21090 |
|
21091 | this._onMouseUp(event);
|
21092 | };
|
21093 |
|
21094 |
|
21095 |
|
21096 |
|
21097 |
|
21098 |
|
21099 |
|
21100 | Graph3d$1.prototype._onWheel = function (event) {
|
21101 | if (!event)
|
21102 |
|
21103 | event = window.event;
|
21104 |
|
21105 | if (this.zoomable && (!this.ctrlToZoom || event.ctrlKey)) {
|
21106 |
|
21107 | var delta = 0;
|
21108 |
|
21109 | if (event.wheelDelta) {
|
21110 |
|
21111 | delta = event.wheelDelta / 120;
|
21112 | } else if (event.detail) {
|
21113 |
|
21114 |
|
21115 |
|
21116 | delta = -event.detail / 3;
|
21117 | }
|
21118 |
|
21119 |
|
21120 |
|
21121 |
|
21122 | if (delta) {
|
21123 | var oldLength = this.camera.getArmLength();
|
21124 | var newLength = oldLength * (1 - delta / 10);
|
21125 | this.camera.setArmLength(newLength);
|
21126 | this.redraw();
|
21127 |
|
21128 | this._hideTooltip();
|
21129 | }
|
21130 |
|
21131 |
|
21132 | var parameters = this.getCameraPosition();
|
21133 | this.emit('cameraPositionChange', parameters);
|
21134 |
|
21135 |
|
21136 |
|
21137 | preventDefault(event);
|
21138 | }
|
21139 | };
|
21140 |
|
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 | Graph3d$1.prototype._insideTriangle = function (point, triangle) {
|
21152 | var a = triangle[0],
|
21153 | b = triangle[1],
|
21154 | c = triangle[2];
|
21155 | |
21156 |
|
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 | function sign(x) {
|
21162 | return x > 0 ? 1 : x < 0 ? -1 : 0;
|
21163 | }
|
21164 |
|
21165 | var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x));
|
21166 | var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x));
|
21167 | var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x));
|
21168 |
|
21169 | return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs);
|
21170 | };
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 |
|
21179 |
|
21180 |
|
21181 |
|
21182 | Graph3d$1.prototype._dataPointFromXY = function (x, y) {
|
21183 | var i,
|
21184 | distMax = 100,
|
21185 |
|
21186 | dataPoint = null,
|
21187 | closestDataPoint = null,
|
21188 | closestDist = null,
|
21189 | center = new Point2d_1(x, y);
|
21190 |
|
21191 | if (this.style === Graph3d$1.STYLE.BAR || this.style === Graph3d$1.STYLE.BARCOLOR || this.style === Graph3d$1.STYLE.BARSIZE) {
|
21192 |
|
21193 | for (i = this.dataPoints.length - 1; i >= 0; i--) {
|
21194 | dataPoint = this.dataPoints[i];
|
21195 | var surfaces = dataPoint.surfaces;
|
21196 |
|
21197 | if (surfaces) {
|
21198 | for (var s = surfaces.length - 1; s >= 0; s--) {
|
21199 |
|
21200 | var surface = surfaces[s];
|
21201 | var corners = surface.corners;
|
21202 | var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen];
|
21203 | var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen];
|
21204 |
|
21205 | if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) {
|
21206 |
|
21207 | return dataPoint;
|
21208 | }
|
21209 | }
|
21210 | }
|
21211 | }
|
21212 | } else {
|
21213 |
|
21214 | for (i = 0; i < this.dataPoints.length; i++) {
|
21215 | dataPoint = this.dataPoints[i];
|
21216 | var point = dataPoint.screen;
|
21217 |
|
21218 | if (point) {
|
21219 | var distX = Math.abs(x - point.x);
|
21220 | var distY = Math.abs(y - point.y);
|
21221 | var dist = Math.sqrt(distX * distX + distY * distY);
|
21222 |
|
21223 | if ((closestDist === null || dist < closestDist) && dist < distMax) {
|
21224 | closestDist = dist;
|
21225 | closestDataPoint = dataPoint;
|
21226 | }
|
21227 | }
|
21228 | }
|
21229 | }
|
21230 |
|
21231 | return closestDataPoint;
|
21232 | };
|
21233 |
|
21234 |
|
21235 |
|
21236 |
|
21237 |
|
21238 |
|
21239 |
|
21240 |
|
21241 | Graph3d$1.prototype.hasBars = function (style) {
|
21242 | return style == Graph3d$1.STYLE.BAR || style == Graph3d$1.STYLE.BARCOLOR || style == Graph3d$1.STYLE.BARSIZE;
|
21243 | };
|
21244 |
|
21245 |
|
21246 |
|
21247 |
|
21248 |
|
21249 |
|
21250 |
|
21251 | Graph3d$1.prototype._showTooltip = function (dataPoint) {
|
21252 | var content, line, dot;
|
21253 |
|
21254 | if (!this.tooltip) {
|
21255 | content = document.createElement('div');
|
21256 |
|
21257 | assign$2(content.style, {}, this.tooltipStyle.content);
|
21258 |
|
21259 | content.style.position = 'absolute';
|
21260 | line = document.createElement('div');
|
21261 |
|
21262 | assign$2(line.style, {}, this.tooltipStyle.line);
|
21263 |
|
21264 | line.style.position = 'absolute';
|
21265 | dot = document.createElement('div');
|
21266 |
|
21267 | assign$2(dot.style, {}, this.tooltipStyle.dot);
|
21268 |
|
21269 | dot.style.position = 'absolute';
|
21270 | this.tooltip = {
|
21271 | dataPoint: null,
|
21272 | dom: {
|
21273 | content: content,
|
21274 | line: line,
|
21275 | dot: dot
|
21276 | }
|
21277 | };
|
21278 | } else {
|
21279 | content = this.tooltip.dom.content;
|
21280 | line = this.tooltip.dom.line;
|
21281 | dot = this.tooltip.dom.dot;
|
21282 | }
|
21283 |
|
21284 | this._hideTooltip();
|
21285 |
|
21286 | this.tooltip.dataPoint = dataPoint;
|
21287 |
|
21288 | if (typeof this.showTooltip === 'function') {
|
21289 | content.innerHTML = this.showTooltip(dataPoint.point);
|
21290 | } else {
|
21291 | 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>';
|
21292 | }
|
21293 |
|
21294 | content.style.left = '0';
|
21295 | content.style.top = '0';
|
21296 | this.frame.appendChild(content);
|
21297 | this.frame.appendChild(line);
|
21298 | this.frame.appendChild(dot);
|
21299 |
|
21300 | var contentWidth = content.offsetWidth;
|
21301 | var contentHeight = content.offsetHeight;
|
21302 | var lineHeight = line.offsetHeight;
|
21303 | var dotWidth = dot.offsetWidth;
|
21304 | var dotHeight = dot.offsetHeight;
|
21305 | var left = dataPoint.screen.x - contentWidth / 2;
|
21306 | left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth);
|
21307 | line.style.left = dataPoint.screen.x + 'px';
|
21308 | line.style.top = dataPoint.screen.y - lineHeight + 'px';
|
21309 | content.style.left = left + 'px';
|
21310 | content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px';
|
21311 | dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px';
|
21312 | dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px';
|
21313 | };
|
21314 |
|
21315 |
|
21316 |
|
21317 |
|
21318 |
|
21319 |
|
21320 | Graph3d$1.prototype._hideTooltip = function () {
|
21321 | if (this.tooltip) {
|
21322 | this.tooltip.dataPoint = null;
|
21323 |
|
21324 | for (var prop in this.tooltip.dom) {
|
21325 | if (this.tooltip.dom.hasOwnProperty(prop)) {
|
21326 | var elem = this.tooltip.dom[prop];
|
21327 |
|
21328 | if (elem && elem.parentNode) {
|
21329 | elem.parentNode.removeChild(elem);
|
21330 | }
|
21331 | }
|
21332 | }
|
21333 | }
|
21334 | };
|
21335 |
|
21336 |
|
21337 |
|
21338 |
|
21339 |
|
21340 |
|
21341 |
|
21342 |
|
21343 |
|
21344 |
|
21345 | function getMouseX(event) {
|
21346 | if ('clientX' in event) return event.clientX;
|
21347 | return event.targetTouches[0] && event.targetTouches[0].clientX || 0;
|
21348 | }
|
21349 |
|
21350 |
|
21351 |
|
21352 |
|
21353 |
|
21354 |
|
21355 |
|
21356 |
|
21357 | function getMouseY(event) {
|
21358 | if ('clientY' in event) return event.clientY;
|
21359 | return event.targetTouches[0] && event.targetTouches[0].clientY || 0;
|
21360 | }
|
21361 |
|
21362 |
|
21363 |
|
21364 |
|
21365 |
|
21366 |
|
21367 |
|
21368 |
|
21369 |
|
21370 |
|
21371 |
|
21372 |
|
21373 |
|
21374 |
|
21375 |
|
21376 |
|
21377 |
|
21378 |
|
21379 | Graph3d$1.prototype.setCameraPosition = function (pos) {
|
21380 | setCameraPosition(pos, this);
|
21381 | this.redraw();
|
21382 | };
|
21383 |
|
21384 |
|
21385 |
|
21386 |
|
21387 |
|
21388 |
|
21389 |
|
21390 |
|
21391 |
|
21392 |
|
21393 | Graph3d$1.prototype.setSize = function (width, height) {
|
21394 | this._setSize(width, height);
|
21395 |
|
21396 | this.redraw();
|
21397 | };
|
21398 |
|
21399 |
|
21400 |
|
21401 |
|
21402 | function keycharm$1(options) {
|
21403 | var preventDefault = options && options.preventDefault || false;
|
21404 | var container = options && options.container || window;
|
21405 | var _exportFunctions = {};
|
21406 | var _bound = {
|
21407 | keydown: {},
|
21408 | keyup: {}
|
21409 | };
|
21410 | var _keys = {};
|
21411 | var i;
|
21412 |
|
21413 | for (i = 97; i <= 122; i++) {
|
21414 | _keys[String.fromCharCode(i)] = {
|
21415 | code: 65 + (i - 97),
|
21416 | shift: false
|
21417 | };
|
21418 | }
|
21419 |
|
21420 |
|
21421 | for (i = 65; i <= 90; i++) {
|
21422 | _keys[String.fromCharCode(i)] = {
|
21423 | code: i,
|
21424 | shift: true
|
21425 | };
|
21426 | }
|
21427 |
|
21428 |
|
21429 | for (i = 0; i <= 9; i++) {
|
21430 | _keys['' + i] = {
|
21431 | code: 48 + i,
|
21432 | shift: false
|
21433 | };
|
21434 | }
|
21435 |
|
21436 |
|
21437 | for (i = 1; i <= 12; i++) {
|
21438 | _keys['F' + i] = {
|
21439 | code: 111 + i,
|
21440 | shift: false
|
21441 | };
|
21442 | }
|
21443 |
|
21444 |
|
21445 | for (i = 0; i <= 9; i++) {
|
21446 | _keys['num' + i] = {
|
21447 | code: 96 + i,
|
21448 | shift: false
|
21449 | };
|
21450 | }
|
21451 |
|
21452 |
|
21453 | _keys['num*'] = {
|
21454 | code: 106,
|
21455 | shift: false
|
21456 | };
|
21457 | _keys['num+'] = {
|
21458 | code: 107,
|
21459 | shift: false
|
21460 | };
|
21461 | _keys['num-'] = {
|
21462 | code: 109,
|
21463 | shift: false
|
21464 | };
|
21465 | _keys['num/'] = {
|
21466 | code: 111,
|
21467 | shift: false
|
21468 | };
|
21469 | _keys['num.'] = {
|
21470 | code: 110,
|
21471 | shift: false
|
21472 | };
|
21473 |
|
21474 | _keys['left'] = {
|
21475 | code: 37,
|
21476 | shift: false
|
21477 | };
|
21478 | _keys['up'] = {
|
21479 | code: 38,
|
21480 | shift: false
|
21481 | };
|
21482 | _keys['right'] = {
|
21483 | code: 39,
|
21484 | shift: false
|
21485 | };
|
21486 | _keys['down'] = {
|
21487 | code: 40,
|
21488 | shift: false
|
21489 | };
|
21490 |
|
21491 | _keys['space'] = {
|
21492 | code: 32,
|
21493 | shift: false
|
21494 | };
|
21495 | _keys['enter'] = {
|
21496 | code: 13,
|
21497 | shift: false
|
21498 | };
|
21499 | _keys['shift'] = {
|
21500 | code: 16,
|
21501 | shift: undefined
|
21502 | };
|
21503 | _keys['esc'] = {
|
21504 | code: 27,
|
21505 | shift: false
|
21506 | };
|
21507 | _keys['backspace'] = {
|
21508 | code: 8,
|
21509 | shift: false
|
21510 | };
|
21511 | _keys['tab'] = {
|
21512 | code: 9,
|
21513 | shift: false
|
21514 | };
|
21515 | _keys['ctrl'] = {
|
21516 | code: 17,
|
21517 | shift: false
|
21518 | };
|
21519 | _keys['alt'] = {
|
21520 | code: 18,
|
21521 | shift: false
|
21522 | };
|
21523 | _keys['delete'] = {
|
21524 | code: 46,
|
21525 | shift: false
|
21526 | };
|
21527 | _keys['pageup'] = {
|
21528 | code: 33,
|
21529 | shift: false
|
21530 | };
|
21531 | _keys['pagedown'] = {
|
21532 | code: 34,
|
21533 | shift: false
|
21534 | };
|
21535 |
|
21536 | _keys['='] = {
|
21537 | code: 187,
|
21538 | shift: false
|
21539 | };
|
21540 | _keys['-'] = {
|
21541 | code: 189,
|
21542 | shift: false
|
21543 | };
|
21544 | _keys[']'] = {
|
21545 | code: 221,
|
21546 | shift: false
|
21547 | };
|
21548 | _keys['['] = {
|
21549 | code: 219,
|
21550 | shift: false
|
21551 | };
|
21552 |
|
21553 | var down = function (event) {
|
21554 | handleEvent(event, 'keydown');
|
21555 | };
|
21556 |
|
21557 | var up = function (event) {
|
21558 | handleEvent(event, 'keyup');
|
21559 | };
|
21560 |
|
21561 |
|
21562 | var handleEvent = function (event, type) {
|
21563 | if (_bound[type][event.keyCode] !== undefined) {
|
21564 | var bound = _bound[type][event.keyCode];
|
21565 |
|
21566 | for (var i = 0; i < bound.length; i++) {
|
21567 | if (bound[i].shift === undefined) {
|
21568 | bound[i].fn(event);
|
21569 | } else if (bound[i].shift == true && event.shiftKey == true) {
|
21570 | bound[i].fn(event);
|
21571 | } else if (bound[i].shift == false && event.shiftKey == false) {
|
21572 | bound[i].fn(event);
|
21573 | }
|
21574 | }
|
21575 |
|
21576 | if (preventDefault == true) {
|
21577 | event.preventDefault();
|
21578 | }
|
21579 | }
|
21580 | };
|
21581 |
|
21582 |
|
21583 | _exportFunctions.bind = function (key, callback, type) {
|
21584 | if (type === undefined) {
|
21585 | type = 'keydown';
|
21586 | }
|
21587 |
|
21588 | if (_keys[key] === undefined) {
|
21589 | throw new Error("unsupported key: " + key);
|
21590 | }
|
21591 |
|
21592 | if (_bound[type][_keys[key].code] === undefined) {
|
21593 | _bound[type][_keys[key].code] = [];
|
21594 | }
|
21595 |
|
21596 | _bound[type][_keys[key].code].push({
|
21597 | fn: callback,
|
21598 | shift: _keys[key].shift
|
21599 | });
|
21600 | };
|
21601 |
|
21602 |
|
21603 | _exportFunctions.bindAll = function (callback, type) {
|
21604 | if (type === undefined) {
|
21605 | type = 'keydown';
|
21606 | }
|
21607 |
|
21608 | for (var key in _keys) {
|
21609 | if (_keys.hasOwnProperty(key)) {
|
21610 | _exportFunctions.bind(key, callback, type);
|
21611 | }
|
21612 | }
|
21613 | };
|
21614 |
|
21615 |
|
21616 | _exportFunctions.getKey = function (event) {
|
21617 | for (var key in _keys) {
|
21618 | if (_keys.hasOwnProperty(key)) {
|
21619 | if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
|
21620 | return key;
|
21621 | } else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
|
21622 | return key;
|
21623 | } else if (event.keyCode == _keys[key].code && key == 'shift') {
|
21624 | return key;
|
21625 | }
|
21626 | }
|
21627 | }
|
21628 |
|
21629 | return "unknown key, currently not supported";
|
21630 | };
|
21631 |
|
21632 |
|
21633 | _exportFunctions.unbind = function (key, callback, type) {
|
21634 | if (type === undefined) {
|
21635 | type = 'keydown';
|
21636 | }
|
21637 |
|
21638 | if (_keys[key] === undefined) {
|
21639 | throw new Error("unsupported key: " + key);
|
21640 | }
|
21641 |
|
21642 | if (callback !== undefined) {
|
21643 | var newBindings = [];
|
21644 | var bound = _bound[type][_keys[key].code];
|
21645 |
|
21646 | if (bound !== undefined) {
|
21647 | for (var i = 0; i < bound.length; i++) {
|
21648 | if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
|
21649 | newBindings.push(_bound[type][_keys[key].code][i]);
|
21650 | }
|
21651 | }
|
21652 | }
|
21653 |
|
21654 | _bound[type][_keys[key].code] = newBindings;
|
21655 | } else {
|
21656 | _bound[type][_keys[key].code] = [];
|
21657 | }
|
21658 | };
|
21659 |
|
21660 |
|
21661 | _exportFunctions.reset = function () {
|
21662 | _bound = {
|
21663 | keydown: {},
|
21664 | keyup: {}
|
21665 | };
|
21666 | };
|
21667 |
|
21668 |
|
21669 | _exportFunctions.destroy = function () {
|
21670 | _bound = {
|
21671 | keydown: {},
|
21672 | keyup: {}
|
21673 | };
|
21674 | container.removeEventListener('keydown', down, true);
|
21675 | container.removeEventListener('keyup', up, true);
|
21676 | };
|
21677 |
|
21678 |
|
21679 | container.addEventListener('keydown', down, true);
|
21680 | container.addEventListener('keyup', up, true);
|
21681 |
|
21682 | return _exportFunctions;
|
21683 | }
|
21684 |
|
21685 | var util_1 = esnext$1;
|
21686 | var DOMutil = DOMutil$1;
|
21687 |
|
21688 | var DataSet = esnext.DataSet,
|
21689 | DataView = esnext.DataView,
|
21690 | Queue = esnext.Queue;
|
21691 | var DataSet_1 = DataSet;
|
21692 | var DataView_1 = DataView;
|
21693 | var Queue_1 = Queue;
|
21694 |
|
21695 | var Graph3d = Graph3d$1;
|
21696 | var graph3d = {
|
21697 | Camera: Camera,
|
21698 | Filter: Filter,
|
21699 | Point2d: Point2d_1,
|
21700 | Point3d: Point3d_1,
|
21701 | Slider: Slider,
|
21702 | StepNumber: StepNumber_1
|
21703 | };
|
21704 |
|
21705 | var Hammer = esnext$1.Hammer;
|
21706 | var keycharm = keycharm$1;
|
21707 | var repo = {
|
21708 | util: util_1,
|
21709 | DOMutil: DOMutil,
|
21710 | DataSet: DataSet_1,
|
21711 | DataView: DataView_1,
|
21712 | Queue: Queue_1,
|
21713 | Graph3d: Graph3d,
|
21714 | graph3d: graph3d,
|
21715 | Hammer: Hammer,
|
21716 | keycharm: keycharm
|
21717 | };
|
21718 |
|
21719 | export { DOMutil, DataSet_1 as DataSet, DataView_1 as DataView, Graph3d, Hammer, Queue_1 as Queue, repo as default, graph3d, keycharm, util_1 as util };
|
21720 |
|