1 | (() => {
|
2 | var __webpack_modules__ = ({
|
3 |
|
4 | 6824:
|
5 | ((module) => {
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | module.exports = (function split(undef) {
|
39 |
|
40 | var nativeSplit = String.prototype.split,
|
41 | compliantExecNpcg = /()??/.exec("")[1] === undef,
|
42 |
|
43 | self;
|
44 |
|
45 | self = function(str, separator, limit) {
|
46 |
|
47 | if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
|
48 | return nativeSplit.call(str, separator, limit);
|
49 | }
|
50 | var output = [],
|
51 | flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") +
|
52 | (separator.sticky ? "y" : ""),
|
53 |
|
54 | lastLastIndex = 0,
|
55 |
|
56 | separator = new RegExp(separator.source, flags + "g"),
|
57 | separator2, match, lastIndex, lastLength;
|
58 | str += "";
|
59 | if (!compliantExecNpcg) {
|
60 |
|
61 | separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
|
62 | }
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | limit = limit === undef ? -1 >>> 0 :
|
71 | limit >>> 0;
|
72 | while (match = separator.exec(str)) {
|
73 |
|
74 | lastIndex = match.index + match[0].length;
|
75 | if (lastIndex > lastLastIndex) {
|
76 | output.push(str.slice(lastLastIndex, match.index));
|
77 |
|
78 |
|
79 | if (!compliantExecNpcg && match.length > 1) {
|
80 | match[0].replace(separator2, function() {
|
81 | for (var i = 1; i < arguments.length - 2; i++) {
|
82 | if (arguments[i] === undef) {
|
83 | match[i] = undef;
|
84 | }
|
85 | }
|
86 | });
|
87 | }
|
88 | if (match.length > 1 && match.index < str.length) {
|
89 | Array.prototype.push.apply(output, match.slice(1));
|
90 | }
|
91 | lastLength = match[0].length;
|
92 | lastLastIndex = lastIndex;
|
93 | if (output.length >= limit) {
|
94 | break;
|
95 | }
|
96 | }
|
97 | if (separator.lastIndex === match.index) {
|
98 | separator.lastIndex++;
|
99 | }
|
100 | }
|
101 | if (lastLastIndex === str.length) {
|
102 | if (lastLength || !separator.test("")) {
|
103 | output.push("");
|
104 | }
|
105 | } else {
|
106 | output.push(str.slice(lastLastIndex));
|
107 | }
|
108 | return output.length > limit ? output.slice(0, limit) : output;
|
109 | };
|
110 |
|
111 | return self;
|
112 | })();
|
113 |
|
114 |
|
115 | }),
|
116 |
|
117 | 1804:
|
118 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
119 |
|
120 | "use strict";
|
121 |
|
122 |
|
123 | var isValue = __webpack_require__(5618)
|
124 | , isPlainFunction = __webpack_require__(7205)
|
125 | , assign = __webpack_require__(7191)
|
126 | , normalizeOpts = __webpack_require__(5516)
|
127 | , contains = __webpack_require__(9981);
|
128 |
|
129 | var d = (module.exports = function (dscr, value/*, options*/) {
|
130 | var c, e, w, options, desc;
|
131 | if (arguments.length < 2 || typeof dscr !== "string") {
|
132 | options = value;
|
133 | value = dscr;
|
134 | dscr = null;
|
135 | } else {
|
136 | options = arguments[2];
|
137 | }
|
138 | if (isValue(dscr)) {
|
139 | c = contains.call(dscr, "c");
|
140 | e = contains.call(dscr, "e");
|
141 | w = contains.call(dscr, "w");
|
142 | } else {
|
143 | c = w = true;
|
144 | e = false;
|
145 | }
|
146 |
|
147 | desc = { value: value, configurable: c, enumerable: e, writable: w };
|
148 | return !options ? desc : assign(normalizeOpts(options), desc);
|
149 | });
|
150 |
|
151 | d.gs = function (dscr, get, set/*, options*/) {
|
152 | var c, e, options, desc;
|
153 | if (typeof dscr !== "string") {
|
154 | options = set;
|
155 | set = get;
|
156 | get = dscr;
|
157 | dscr = null;
|
158 | } else {
|
159 | options = arguments[3];
|
160 | }
|
161 | if (!isValue(get)) {
|
162 | get = undefined;
|
163 | } else if (!isPlainFunction(get)) {
|
164 | options = get;
|
165 | get = set = undefined;
|
166 | } else if (!isValue(set)) {
|
167 | set = undefined;
|
168 | } else if (!isPlainFunction(set)) {
|
169 | options = set;
|
170 | set = undefined;
|
171 | }
|
172 | if (isValue(dscr)) {
|
173 | c = contains.call(dscr, "c");
|
174 | e = contains.call(dscr, "e");
|
175 | } else {
|
176 | c = true;
|
177 | e = false;
|
178 | }
|
179 |
|
180 | desc = { get: get, set: set, configurable: c, enumerable: e };
|
181 | return !options ? desc : assign(normalizeOpts(options), desc);
|
182 | };
|
183 |
|
184 |
|
185 | /***/ }),
|
186 |
|
187 | /***/ 430:
|
188 | /***/ ((module) => {
|
189 |
|
190 | "use strict";
|
191 |
|
192 |
|
193 |
|
194 | module.exports = function () {};
|
195 |
|
196 |
|
197 | }),
|
198 |
|
199 | 7191:
|
200 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
201 |
|
202 | "use strict";
|
203 |
|
204 |
|
205 | module.exports = __webpack_require__(6560)() ? Object.assign : __webpack_require__(7346);
|
206 |
|
207 |
|
208 | }),
|
209 |
|
210 | 6560:
|
211 | ((module) => {
|
212 |
|
213 | "use strict";
|
214 |
|
215 |
|
216 | module.exports = function () {
|
217 | var assign = Object.assign, obj;
|
218 | if (typeof assign !== "function") return false;
|
219 | obj = { foo: "raz" };
|
220 | assign(obj, { bar: "dwa" }, { trzy: "trzy" });
|
221 | return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
|
222 | };
|
223 |
|
224 |
|
225 | }),
|
226 |
|
227 | 7346:
|
228 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
229 |
|
230 | "use strict";
|
231 |
|
232 |
|
233 | var keys = __webpack_require__(5103)
|
234 | , value = __webpack_require__(2745)
|
235 | , max = Math.max;
|
236 |
|
237 | module.exports = function (dest, src/*, …srcn*/) {
|
238 | var error, i, length = max(arguments.length, 2), assign;
|
239 | dest = Object(value(dest));
|
240 | assign = function (key) {
|
241 | try {
|
242 | dest[key] = src[key];
|
243 | } catch (e) {
|
244 | if (!error) error = e;
|
245 | }
|
246 | };
|
247 | for (i = 1; i < length; ++i) {
|
248 | src = arguments[i];
|
249 | keys(src).forEach(assign);
|
250 | }
|
251 | if (error !== undefined) throw error;
|
252 | return dest;
|
253 | };
|
254 |
|
255 |
|
256 | }),
|
257 |
|
258 | 6914:
|
259 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
260 |
|
261 | "use strict";
|
262 |
|
263 |
|
264 | var _undefined = __webpack_require__(430)();
|
265 |
|
266 | module.exports = function (val) { return val !== _undefined && val !== null; };
|
267 |
|
268 |
|
269 | }),
|
270 |
|
271 | 5103:
|
272 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
273 |
|
274 | "use strict";
|
275 |
|
276 |
|
277 | module.exports = __webpack_require__(7446)() ? Object.keys : __webpack_require__(6137);
|
278 |
|
279 |
|
280 | }),
|
281 |
|
282 | 7446:
|
283 | ((module) => {
|
284 |
|
285 | "use strict";
|
286 |
|
287 |
|
288 | module.exports = function () {
|
289 | try {
|
290 | Object.keys("primitive");
|
291 | return true;
|
292 | } catch (e) {
|
293 | return false;
|
294 | }
|
295 | };
|
296 |
|
297 |
|
298 | }),
|
299 |
|
300 | 6137:
|
301 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
302 |
|
303 | "use strict";
|
304 |
|
305 |
|
306 | var isValue = __webpack_require__(6914);
|
307 |
|
308 | var keys = Object.keys;
|
309 |
|
310 | module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); };
|
311 |
|
312 |
|
313 | }),
|
314 |
|
315 | 5516:
|
316 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
317 |
|
318 | "use strict";
|
319 |
|
320 |
|
321 | var isValue = __webpack_require__(6914);
|
322 |
|
323 | var forEach = Array.prototype.forEach, create = Object.create;
|
324 |
|
325 | var process = function (src, obj) {
|
326 | var key;
|
327 | for (key in src) obj[key] = src[key];
|
328 | };
|
329 |
|
330 |
|
331 | module.exports = function (opts1/*, …options*/) {
|
332 | var result = create(null);
|
333 | forEach.call(arguments, function (options) {
|
334 | if (!isValue(options)) return;
|
335 | process(Object(options), result);
|
336 | });
|
337 | return result;
|
338 | };
|
339 |
|
340 |
|
341 | }),
|
342 |
|
343 | 1290:
|
344 | ((module) => {
|
345 |
|
346 | "use strict";
|
347 |
|
348 |
|
349 | module.exports = function (fn) {
|
350 | if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
|
351 | return fn;
|
352 | };
|
353 |
|
354 |
|
355 | }),
|
356 |
|
357 | 2745:
|
358 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
359 |
|
360 | "use strict";
|
361 |
|
362 |
|
363 | var isValue = __webpack_require__(6914);
|
364 |
|
365 | module.exports = function (value) {
|
366 | if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
|
367 | return value;
|
368 | };
|
369 |
|
370 |
|
371 | }),
|
372 |
|
373 | 9981:
|
374 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
375 |
|
376 | "use strict";
|
377 |
|
378 |
|
379 | module.exports = __webpack_require__(3591)() ? String.prototype.contains : __webpack_require__(6042);
|
380 |
|
381 |
|
382 | }),
|
383 |
|
384 | 3591:
|
385 | ((module) => {
|
386 |
|
387 | "use strict";
|
388 |
|
389 |
|
390 | var str = "razdwatrzy";
|
391 |
|
392 | module.exports = function () {
|
393 | if (typeof str.contains !== "function") return false;
|
394 | return str.contains("dwa") === true && str.contains("foo") === false;
|
395 | };
|
396 |
|
397 |
|
398 | }),
|
399 |
|
400 | 6042:
|
401 | ((module) => {
|
402 |
|
403 | "use strict";
|
404 |
|
405 |
|
406 | var indexOf = String.prototype.indexOf;
|
407 |
|
408 | module.exports = function (searchString/*, position*/) {
|
409 | return indexOf.call(this, searchString, arguments[1]) > -1;
|
410 | };
|
411 |
|
412 |
|
413 | }),
|
414 |
|
415 | 8832:
|
416 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
417 |
|
418 | "use strict";
|
419 |
|
420 |
|
421 | var OneVersionConstraint = __webpack_require__(4167);
|
422 |
|
423 | var MY_VERSION = '7';
|
424 | OneVersionConstraint('ev-store', MY_VERSION);
|
425 |
|
426 | var hashKey = '__EV_STORE_KEY@' + MY_VERSION;
|
427 |
|
428 | module.exports = EvStore;
|
429 |
|
430 | function EvStore(elem) {
|
431 | var hash = elem[hashKey];
|
432 |
|
433 | if (!hash) {
|
434 | hash = elem[hashKey] = {};
|
435 | }
|
436 |
|
437 | return hash;
|
438 | }
|
439 |
|
440 |
|
441 | }),
|
442 |
|
443 | 8370:
|
444 | ((module, exports, __webpack_require__) => {
|
445 |
|
446 | "use strict";
|
447 |
|
448 |
|
449 | var d = __webpack_require__(1804)
|
450 | , callable = __webpack_require__(1290)
|
451 |
|
452 | , apply = Function.prototype.apply, call = Function.prototype.call
|
453 | , create = Object.create, defineProperty = Object.defineProperty
|
454 | , defineProperties = Object.defineProperties
|
455 | , hasOwnProperty = Object.prototype.hasOwnProperty
|
456 | , descriptor = { configurable: true, enumerable: false, writable: true }
|
457 |
|
458 | , on, once, off, emit, methods, descriptors, base;
|
459 |
|
460 | on = function (type, listener) {
|
461 | var data;
|
462 |
|
463 | callable(listener);
|
464 |
|
465 | if (!hasOwnProperty.call(this, '__ee__')) {
|
466 | data = descriptor.value = create(null);
|
467 | defineProperty(this, '__ee__', descriptor);
|
468 | descriptor.value = null;
|
469 | } else {
|
470 | data = this.__ee__;
|
471 | }
|
472 | if (!data[type]) data[type] = listener;
|
473 | else if (typeof data[type] === 'object') data[type].push(listener);
|
474 | else data[type] = [data[type], listener];
|
475 |
|
476 | return this;
|
477 | };
|
478 |
|
479 | once = function (type, listener) {
|
480 | var once, self;
|
481 |
|
482 | callable(listener);
|
483 | self = this;
|
484 | on.call(this, type, once = function () {
|
485 | off.call(self, type, once);
|
486 | apply.call(listener, this, arguments);
|
487 | });
|
488 |
|
489 | once.__eeOnceListener__ = listener;
|
490 | return this;
|
491 | };
|
492 |
|
493 | off = function (type, listener) {
|
494 | var data, listeners, candidate, i;
|
495 |
|
496 | callable(listener);
|
497 |
|
498 | if (!hasOwnProperty.call(this, '__ee__')) return this;
|
499 | data = this.__ee__;
|
500 | if (!data[type]) return this;
|
501 | listeners = data[type];
|
502 |
|
503 | if (typeof listeners === 'object') {
|
504 | for (i = 0; (candidate = listeners[i]); ++i) {
|
505 | if ((candidate === listener) ||
|
506 | (candidate.__eeOnceListener__ === listener)) {
|
507 | if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
|
508 | else listeners.splice(i, 1);
|
509 | }
|
510 | }
|
511 | } else {
|
512 | if ((listeners === listener) ||
|
513 | (listeners.__eeOnceListener__ === listener)) {
|
514 | delete data[type];
|
515 | }
|
516 | }
|
517 |
|
518 | return this;
|
519 | };
|
520 |
|
521 | emit = function (type) {
|
522 | var i, l, listener, listeners, args;
|
523 |
|
524 | if (!hasOwnProperty.call(this, '__ee__')) return;
|
525 | listeners = this.__ee__[type];
|
526 | if (!listeners) return;
|
527 |
|
528 | if (typeof listeners === 'object') {
|
529 | l = arguments.length;
|
530 | args = new Array(l - 1);
|
531 | for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
|
532 |
|
533 | listeners = listeners.slice();
|
534 | for (i = 0; (listener = listeners[i]); ++i) {
|
535 | apply.call(listener, this, args);
|
536 | }
|
537 | } else {
|
538 | switch (arguments.length) {
|
539 | case 1:
|
540 | call.call(listeners, this);
|
541 | break;
|
542 | case 2:
|
543 | call.call(listeners, this, arguments[1]);
|
544 | break;
|
545 | case 3:
|
546 | call.call(listeners, this, arguments[1], arguments[2]);
|
547 | break;
|
548 | default:
|
549 | l = arguments.length;
|
550 | args = new Array(l - 1);
|
551 | for (i = 1; i < l; ++i) {
|
552 | args[i - 1] = arguments[i];
|
553 | }
|
554 | apply.call(listeners, this, args);
|
555 | }
|
556 | }
|
557 | };
|
558 |
|
559 | methods = {
|
560 | on: on,
|
561 | once: once,
|
562 | off: off,
|
563 | emit: emit
|
564 | };
|
565 |
|
566 | descriptors = {
|
567 | on: d(on),
|
568 | once: d(once),
|
569 | off: d(off),
|
570 | emit: d(emit)
|
571 | };
|
572 |
|
573 | base = defineProperties({}, descriptors);
|
574 |
|
575 | module.exports = exports = function (o) {
|
576 | return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
|
577 | };
|
578 | exports.methods = methods;
|
579 |
|
580 |
|
581 | }),
|
582 |
|
583 | 6226:
|
584 | ((__unused_webpack_module, exports) => {
|
585 |
|
586 | "use strict";
|
587 |
|
588 |
|
589 | Object.defineProperty(exports, "__esModule", ({
|
590 | value: true
|
591 | }));
|
592 | exports.linear = linear;
|
593 | exports.exponential = exponential;
|
594 | exports.sCurve = sCurve;
|
595 | exports.logarithmic = logarithmic;
|
596 | function linear(length, rotation) {
|
597 | var curve = new Float32Array(length),
|
598 | i,
|
599 | x,
|
600 | scale = length - 1;
|
601 |
|
602 | for (i = 0; i < length; i++) {
|
603 | x = i / scale;
|
604 |
|
605 | if (rotation > 0) {
|
606 | curve[i] = x;
|
607 | } else {
|
608 | curve[i] = 1 - x;
|
609 | }
|
610 | }
|
611 |
|
612 | return curve;
|
613 | }
|
614 |
|
615 | function exponential(length, rotation) {
|
616 | var curve = new Float32Array(length),
|
617 | i,
|
618 | x,
|
619 | scale = length - 1,
|
620 | index;
|
621 |
|
622 | for (i = 0; i < length; i++) {
|
623 | x = i / scale;
|
624 | index = rotation > 0 ? i : length - 1 - i;
|
625 |
|
626 | curve[index] = Math.exp(2 * x - 1) / Math.exp(1);
|
627 | }
|
628 |
|
629 | return curve;
|
630 | }
|
631 |
|
632 |
|
633 | function sCurve(length, rotation) {
|
634 | var curve = new Float32Array(length),
|
635 | i,
|
636 | phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);
|
637 |
|
638 | for (i = 0; i < length; ++i) {
|
639 | curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;
|
640 | }
|
641 | return curve;
|
642 | }
|
643 |
|
644 |
|
645 | function logarithmic(length, base, rotation) {
|
646 | var curve = new Float32Array(length),
|
647 | index,
|
648 | x = 0,
|
649 | i;
|
650 |
|
651 | for (i = 0; i < length; i++) {
|
652 |
|
653 | index = rotation > 0 ? i : length - 1 - i;
|
654 |
|
655 | x = i / length;
|
656 | curve[index] = Math.log(1 + base * x) / Math.log(1 + base);
|
657 | }
|
658 |
|
659 | return curve;
|
660 | }
|
661 |
|
662 |
|
663 | }),
|
664 |
|
665 | 1114:
|
666 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
667 |
|
668 | "use strict";
|
669 | var __webpack_unused_export__;
|
670 |
|
671 |
|
672 | __webpack_unused_export__ = ({
|
673 | value: true
|
674 | });
|
675 | exports.h7 = exports.Y1 = exports.Hp = exports.Jl = exports.t$ = exports._h = undefined;
|
676 | exports.L7 = createFadeIn;
|
677 | exports.Mt = createFadeOut;
|
678 |
|
679 | var _fadeCurves = __webpack_require__(6226);
|
680 |
|
681 | var SCURVE = exports._h = "sCurve";
|
682 | var LINEAR = exports.t$ = "linear";
|
683 | var EXPONENTIAL = exports.Jl = "exponential";
|
684 | var LOGARITHMIC = exports.Hp = "logarithmic";
|
685 |
|
686 | var FADEIN = exports.Y1 = "FadeIn";
|
687 | var FADEOUT = exports.h7 = "FadeOut";
|
688 |
|
689 | function sCurveFadeIn(start, duration) {
|
690 | var curve = (0, _fadeCurves.sCurve)(10000, 1);
|
691 | this.setValueCurveAtTime(curve, start, duration);
|
692 | }
|
693 |
|
694 | function sCurveFadeOut(start, duration) {
|
695 | var curve = (0, _fadeCurves.sCurve)(10000, -1);
|
696 | this.setValueCurveAtTime(curve, start, duration);
|
697 | }
|
698 |
|
699 | function linearFadeIn(start, duration) {
|
700 | this.linearRampToValueAtTime(0, start);
|
701 | this.linearRampToValueAtTime(1, start + duration);
|
702 | }
|
703 |
|
704 | function linearFadeOut(start, duration) {
|
705 | this.linearRampToValueAtTime(1, start);
|
706 | this.linearRampToValueAtTime(0, start + duration);
|
707 | }
|
708 |
|
709 | function exponentialFadeIn(start, duration) {
|
710 | this.exponentialRampToValueAtTime(0.01, start);
|
711 | this.exponentialRampToValueAtTime(1, start + duration);
|
712 | }
|
713 |
|
714 | function exponentialFadeOut(start, duration) {
|
715 | this.exponentialRampToValueAtTime(1, start);
|
716 | this.exponentialRampToValueAtTime(0.01, start + duration);
|
717 | }
|
718 |
|
719 | function logarithmicFadeIn(start, duration) {
|
720 | var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1);
|
721 | this.setValueCurveAtTime(curve, start, duration);
|
722 | }
|
723 |
|
724 | function logarithmicFadeOut(start, duration) {
|
725 | var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1);
|
726 | this.setValueCurveAtTime(curve, start, duration);
|
727 | }
|
728 |
|
729 | function createFadeIn(gain, shape, start, duration) {
|
730 | switch (shape) {
|
731 | case SCURVE:
|
732 | sCurveFadeIn.call(gain, start, duration);
|
733 | break;
|
734 | case LINEAR:
|
735 | linearFadeIn.call(gain, start, duration);
|
736 | break;
|
737 | case EXPONENTIAL:
|
738 | exponentialFadeIn.call(gain, start, duration);
|
739 | break;
|
740 | case LOGARITHMIC:
|
741 | logarithmicFadeIn.call(gain, start, duration);
|
742 | break;
|
743 | default:
|
744 | throw new Error("Unsupported Fade type");
|
745 | }
|
746 | }
|
747 |
|
748 | function createFadeOut(gain, shape, start, duration) {
|
749 | switch (shape) {
|
750 | case SCURVE:
|
751 | sCurveFadeOut.call(gain, start, duration);
|
752 | break;
|
753 | case LINEAR:
|
754 | linearFadeOut.call(gain, start, duration);
|
755 | break;
|
756 | case EXPONENTIAL:
|
757 | exponentialFadeOut.call(gain, start, duration);
|
758 | break;
|
759 | case LOGARITHMIC:
|
760 | logarithmicFadeOut.call(gain, start, duration);
|
761 | break;
|
762 | default:
|
763 | throw new Error("Unsupported Fade type");
|
764 | }
|
765 | }
|
766 |
|
767 |
|
768 | }),
|
769 |
|
770 | 9144:
|
771 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
772 |
|
773 | var topLevel = typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g :
|
774 | typeof window !== 'undefined' ? window : {}
|
775 | var minDoc = __webpack_require__(5893);
|
776 |
|
777 | var doccy;
|
778 |
|
779 | if (typeof document !== 'undefined') {
|
780 | doccy = document;
|
781 | } else {
|
782 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
|
783 |
|
784 | if (!doccy) {
|
785 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
|
786 | }
|
787 | }
|
788 |
|
789 | module.exports = doccy;
|
790 |
|
791 |
|
792 | }),
|
793 |
|
794 | 8070:
|
795 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
796 |
|
797 | "use strict";
|
798 |
|
799 |
|
800 |
|
801 |
|
802 | var root = typeof window !== 'undefined' ?
|
803 | window : typeof __webpack_require__.g !== 'undefined' ?
|
804 | __webpack_require__.g : {};
|
805 |
|
806 | module.exports = Individual;
|
807 |
|
808 | function Individual(key, value) {
|
809 | if (key in root) {
|
810 | return root[key];
|
811 | }
|
812 |
|
813 | root[key] = value;
|
814 |
|
815 | return value;
|
816 | }
|
817 |
|
818 |
|
819 | }),
|
820 |
|
821 | 4167:
|
822 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
823 |
|
824 | "use strict";
|
825 |
|
826 |
|
827 | var Individual = __webpack_require__(8070);
|
828 |
|
829 | module.exports = OneVersion;
|
830 |
|
831 | function OneVersion(moduleName, version, defaultValue) {
|
832 | var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
|
833 | var enforceKey = key + '_ENFORCE_SINGLETON';
|
834 |
|
835 | var versionValue = Individual(enforceKey, version);
|
836 |
|
837 | if (versionValue !== version) {
|
838 | throw new Error('Can only have one copy of ' +
|
839 | moduleName + '.\n' +
|
840 | 'You already have version ' + versionValue +
|
841 | ' installed.\n' +
|
842 | 'This means you cannot install version ' + version);
|
843 | }
|
844 |
|
845 | return Individual(key, defaultValue);
|
846 | }
|
847 |
|
848 |
|
849 | }),
|
850 |
|
851 | 849:
|
852 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
853 |
|
854 | var WORKER_ENABLED = !!(__webpack_require__.g === __webpack_require__.g.window && __webpack_require__.g.URL && __webpack_require__.g.Blob && __webpack_require__.g.Worker);
|
855 |
|
856 | function InlineWorker(func, self) {
|
857 | var _this = this;
|
858 | var functionBody;
|
859 |
|
860 | self = self || {};
|
861 |
|
862 | if (WORKER_ENABLED) {
|
863 | functionBody = func.toString().trim().match(
|
864 | /^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/
|
865 | )[1];
|
866 |
|
867 | return new __webpack_require__.g.Worker(__webpack_require__.g.URL.createObjectURL(
|
868 | new __webpack_require__.g.Blob([ functionBody ], { type: "text/javascript" })
|
869 | ));
|
870 | }
|
871 |
|
872 | function postMessage(data) {
|
873 | setTimeout(function() {
|
874 | _this.onmessage({ data: data });
|
875 | }, 0);
|
876 | }
|
877 |
|
878 | this.self = self;
|
879 | this.self.postMessage = postMessage;
|
880 |
|
881 | setTimeout(func.bind(self, self), 0);
|
882 | }
|
883 |
|
884 | InlineWorker.prototype.postMessage = function postMessage(data) {
|
885 | var _this = this;
|
886 |
|
887 | setTimeout(function() {
|
888 | _this.self.onmessage({ data: data });
|
889 | }, 0);
|
890 | };
|
891 |
|
892 | module.exports = InlineWorker;
|
893 |
|
894 |
|
895 | }),
|
896 |
|
897 | 6240:
|
898 | ((module) => {
|
899 |
|
900 | "use strict";
|
901 |
|
902 |
|
903 | module.exports = function isObject(x) {
|
904 | return typeof x === "object" && x !== null;
|
905 | };
|
906 |
|
907 |
|
908 | }),
|
909 |
|
910 | 1730:
|
911 | ((module) => {
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 | var MAX_SAFE_INTEGER = 9007199254740991;
|
924 |
|
925 |
|
926 | var argsTag = '[object Arguments]',
|
927 | funcTag = '[object Function]',
|
928 | genTag = '[object GeneratorFunction]';
|
929 |
|
930 |
|
931 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 | function apply(func, thisArg, args) {
|
944 | switch (args.length) {
|
945 | case 0: return func.call(thisArg);
|
946 | case 1: return func.call(thisArg, args[0]);
|
947 | case 2: return func.call(thisArg, args[0], args[1]);
|
948 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
949 | }
|
950 | return func.apply(thisArg, args);
|
951 | }
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 | function baseTimes(n, iteratee) {
|
963 | var index = -1,
|
964 | result = Array(n);
|
965 |
|
966 | while (++index < n) {
|
967 | result[index] = iteratee(index);
|
968 | }
|
969 | return result;
|
970 | }
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 | function overArg(func, transform) {
|
981 | return function(arg) {
|
982 | return func(transform(arg));
|
983 | };
|
984 | }
|
985 |
|
986 |
|
987 | var objectProto = Object.prototype;
|
988 |
|
989 |
|
990 | var hasOwnProperty = objectProto.hasOwnProperty;
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 | var objectToString = objectProto.toString;
|
998 |
|
999 |
|
1000 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
1001 |
|
1002 |
|
1003 | var nativeKeys = overArg(Object.keys, Object),
|
1004 | nativeMax = Math.max;
|
1005 |
|
1006 |
|
1007 | var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 | function arrayLikeKeys(value, inherited) {
|
1018 |
|
1019 |
|
1020 | var result = (isArray(value) || isArguments(value))
|
1021 | ? baseTimes(value.length, String)
|
1022 | : [];
|
1023 |
|
1024 | var length = result.length,
|
1025 | skipIndexes = !!length;
|
1026 |
|
1027 | for (var key in value) {
|
1028 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
1029 | !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
1030 | result.push(key);
|
1031 | }
|
1032 | }
|
1033 | return result;
|
1034 | }
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 | function assignValue(object, key, value) {
|
1047 | var objValue = object[key];
|
1048 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
1049 | (value === undefined && !(key in object))) {
|
1050 | object[key] = value;
|
1051 | }
|
1052 | }
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 | function baseKeys(object) {
|
1062 | if (!isPrototype(object)) {
|
1063 | return nativeKeys(object);
|
1064 | }
|
1065 | var result = [];
|
1066 | for (var key in Object(object)) {
|
1067 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
1068 | result.push(key);
|
1069 | }
|
1070 | }
|
1071 | return result;
|
1072 | }
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 | function baseRest(func, start) {
|
1083 | start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
1084 | return function() {
|
1085 | var args = arguments,
|
1086 | index = -1,
|
1087 | length = nativeMax(args.length - start, 0),
|
1088 | array = Array(length);
|
1089 |
|
1090 | while (++index < length) {
|
1091 | array[index] = args[start + index];
|
1092 | }
|
1093 | index = -1;
|
1094 | var otherArgs = Array(start + 1);
|
1095 | while (++index < start) {
|
1096 | otherArgs[index] = args[index];
|
1097 | }
|
1098 | otherArgs[start] = array;
|
1099 | return apply(func, this, otherArgs);
|
1100 | };
|
1101 | }
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 | function copyObject(source, props, object, customizer) {
|
1114 | object || (object = {});
|
1115 |
|
1116 | var index = -1,
|
1117 | length = props.length;
|
1118 |
|
1119 | while (++index < length) {
|
1120 | var key = props[index];
|
1121 |
|
1122 | var newValue = customizer
|
1123 | ? customizer(object[key], source[key], key, object, source)
|
1124 | : undefined;
|
1125 |
|
1126 | assignValue(object, key, newValue === undefined ? source[key] : newValue);
|
1127 | }
|
1128 | return object;
|
1129 | }
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 | function createAssigner(assigner) {
|
1139 | return baseRest(function(object, sources) {
|
1140 | var index = -1,
|
1141 | length = sources.length,
|
1142 | customizer = length > 1 ? sources[length - 1] : undefined,
|
1143 | guard = length > 2 ? sources[2] : undefined;
|
1144 |
|
1145 | customizer = (assigner.length > 3 && typeof customizer == 'function')
|
1146 | ? (length--, customizer)
|
1147 | : undefined;
|
1148 |
|
1149 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
1150 | customizer = length < 3 ? undefined : customizer;
|
1151 | length = 1;
|
1152 | }
|
1153 | object = Object(object);
|
1154 | while (++index < length) {
|
1155 | var source = sources[index];
|
1156 | if (source) {
|
1157 | assigner(object, source, index, customizer);
|
1158 | }
|
1159 | }
|
1160 | return object;
|
1161 | });
|
1162 | }
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 | function isIndex(value, length) {
|
1173 | length = length == null ? MAX_SAFE_INTEGER : length;
|
1174 | return !!length &&
|
1175 | (typeof value == 'number' || reIsUint.test(value)) &&
|
1176 | (value > -1 && value % 1 == 0 && value < length);
|
1177 | }
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 | function isIterateeCall(value, index, object) {
|
1190 | if (!isObject(object)) {
|
1191 | return false;
|
1192 | }
|
1193 | var type = typeof index;
|
1194 | if (type == 'number'
|
1195 | ? (isArrayLike(object) && isIndex(index, object.length))
|
1196 | : (type == 'string' && index in object)
|
1197 | ) {
|
1198 | return eq(object[index], value);
|
1199 | }
|
1200 | return false;
|
1201 | }
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 | function isPrototype(value) {
|
1211 | var Ctor = value && value.constructor,
|
1212 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
1213 |
|
1214 | return value === proto;
|
1215 | }
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 | function eq(value, other) {
|
1250 | return value === other || (value !== value && other !== other);
|
1251 | }
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 | function isArguments(value) {
|
1272 |
|
1273 | return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
1274 | (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
1275 | }
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 | var isArray = Array.isArray;
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 | function isArrayLike(value) {
|
1328 | return value != null && isLength(value.length) && !isFunction(value);
|
1329 | }
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | function isArrayLikeObject(value) {
|
1357 | return isObjectLike(value) && isArrayLike(value);
|
1358 | }
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 | function isFunction(value) {
|
1378 |
|
1379 |
|
1380 | var tag = isObject(value) ? objectToString.call(value) : '';
|
1381 | return tag == funcTag || tag == genTag;
|
1382 | }
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 | function isLength(value) {
|
1411 | return typeof value == 'number' &&
|
1412 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1413 | }
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 | function isObject(value) {
|
1441 | var type = typeof value;
|
1442 | return !!value && (type == 'object' || type == 'function');
|
1443 | }
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 | function isObjectLike(value) {
|
1470 | return !!value && typeof value == 'object';
|
1471 | }
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 | var assign = createAssigner(function(object, source) {
|
1506 | if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
|
1507 | copyObject(source, keys(source), object);
|
1508 | return;
|
1509 | }
|
1510 | for (var key in source) {
|
1511 | if (hasOwnProperty.call(source, key)) {
|
1512 | assignValue(object, key, source[key]);
|
1513 | }
|
1514 | }
|
1515 | });
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 | function keys(object) {
|
1546 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
1547 | }
|
1548 |
|
1549 | module.exports = assign;
|
1550 |
|
1551 |
|
1552 | }),
|
1553 |
|
1554 | 2098:
|
1555 | ((module, exports, __webpack_require__) => {
|
1556 |
|
1557 | module = __webpack_require__.nmd(module);
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 | var LARGE_ARRAY_SIZE = 200;
|
1569 |
|
1570 |
|
1571 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
1572 |
|
1573 |
|
1574 | var HOT_COUNT = 800,
|
1575 | HOT_SPAN = 16;
|
1576 |
|
1577 |
|
1578 | var MAX_SAFE_INTEGER = 9007199254740991;
|
1579 |
|
1580 |
|
1581 | var argsTag = '[object Arguments]',
|
1582 | arrayTag = '[object Array]',
|
1583 | asyncTag = '[object AsyncFunction]',
|
1584 | boolTag = '[object Boolean]',
|
1585 | dateTag = '[object Date]',
|
1586 | errorTag = '[object Error]',
|
1587 | funcTag = '[object Function]',
|
1588 | genTag = '[object GeneratorFunction]',
|
1589 | mapTag = '[object Map]',
|
1590 | numberTag = '[object Number]',
|
1591 | nullTag = '[object Null]',
|
1592 | objectTag = '[object Object]',
|
1593 | proxyTag = '[object Proxy]',
|
1594 | regexpTag = '[object RegExp]',
|
1595 | setTag = '[object Set]',
|
1596 | stringTag = '[object String]',
|
1597 | undefinedTag = '[object Undefined]',
|
1598 | weakMapTag = '[object WeakMap]';
|
1599 |
|
1600 | var arrayBufferTag = '[object ArrayBuffer]',
|
1601 | dataViewTag = '[object DataView]',
|
1602 | float32Tag = '[object Float32Array]',
|
1603 | float64Tag = '[object Float64Array]',
|
1604 | int8Tag = '[object Int8Array]',
|
1605 | int16Tag = '[object Int16Array]',
|
1606 | int32Tag = '[object Int32Array]',
|
1607 | uint8Tag = '[object Uint8Array]',
|
1608 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
1609 | uint16Tag = '[object Uint16Array]',
|
1610 | uint32Tag = '[object Uint32Array]';
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
1617 |
|
1618 |
|
1619 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
1620 |
|
1621 |
|
1622 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
1623 |
|
1624 |
|
1625 | var typedArrayTags = {};
|
1626 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
1627 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
1628 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
1629 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
1630 | typedArrayTags[uint32Tag] = true;
|
1631 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
1632 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
1633 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
1634 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
1635 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
1636 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
1637 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
1638 | typedArrayTags[weakMapTag] = false;
|
1639 |
|
1640 |
|
1641 | var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
|
1642 |
|
1643 |
|
1644 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
1645 |
|
1646 |
|
1647 | var root = freeGlobal || freeSelf || Function('return this')();
|
1648 |
|
1649 |
|
1650 | var freeExports = true && exports && !exports.nodeType && exports;
|
1651 |
|
1652 |
|
1653 | var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
|
1654 |
|
1655 |
|
1656 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1657 |
|
1658 |
|
1659 | var freeProcess = moduleExports && freeGlobal.process;
|
1660 |
|
1661 |
|
1662 | var nodeUtil = (function() {
|
1663 | try {
|
1664 |
|
1665 | var types = freeModule && freeModule.require && freeModule.require('util').types;
|
1666 |
|
1667 | if (types) {
|
1668 | return types;
|
1669 | }
|
1670 |
|
1671 |
|
1672 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
1673 | } catch (e) {}
|
1674 | }());
|
1675 |
|
1676 |
|
1677 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 | function apply(func, thisArg, args) {
|
1690 | switch (args.length) {
|
1691 | case 0: return func.call(thisArg);
|
1692 | case 1: return func.call(thisArg, args[0]);
|
1693 | case 2: return func.call(thisArg, args[0], args[1]);
|
1694 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
1695 | }
|
1696 | return func.apply(thisArg, args);
|
1697 | }
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 | function baseTimes(n, iteratee) {
|
1709 | var index = -1,
|
1710 | result = Array(n);
|
1711 |
|
1712 | while (++index < n) {
|
1713 | result[index] = iteratee(index);
|
1714 | }
|
1715 | return result;
|
1716 | }
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 | function baseUnary(func) {
|
1726 | return function(value) {
|
1727 | return func(value);
|
1728 | };
|
1729 | }
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 | function getValue(object, key) {
|
1740 | return object == null ? undefined : object[key];
|
1741 | }
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 | function overArg(func, transform) {
|
1752 | return function(arg) {
|
1753 | return func(transform(arg));
|
1754 | };
|
1755 | }
|
1756 |
|
1757 |
|
1758 | var arrayProto = Array.prototype,
|
1759 | funcProto = Function.prototype,
|
1760 | objectProto = Object.prototype;
|
1761 |
|
1762 |
|
1763 | var coreJsData = root['__core-js_shared__'];
|
1764 |
|
1765 |
|
1766 | var funcToString = funcProto.toString;
|
1767 |
|
1768 |
|
1769 | var hasOwnProperty = objectProto.hasOwnProperty;
|
1770 |
|
1771 |
|
1772 | var maskSrcKey = (function() {
|
1773 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
1774 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
1775 | }());
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 | var nativeObjectToString = objectProto.toString;
|
1783 |
|
1784 |
|
1785 | var objectCtorString = funcToString.call(Object);
|
1786 |
|
1787 |
|
1788 | var reIsNative = RegExp('^' +
|
1789 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
1790 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
1791 | );
|
1792 |
|
1793 |
|
1794 | var Buffer = moduleExports ? root.Buffer : undefined,
|
1795 | Symbol = root.Symbol,
|
1796 | Uint8Array = root.Uint8Array,
|
1797 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
|
1798 | getPrototype = overArg(Object.getPrototypeOf, Object),
|
1799 | objectCreate = Object.create,
|
1800 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
1801 | splice = arrayProto.splice,
|
1802 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
1803 |
|
1804 | var defineProperty = (function() {
|
1805 | try {
|
1806 | var func = getNative(Object, 'defineProperty');
|
1807 | func({}, '', {});
|
1808 | return func;
|
1809 | } catch (e) {}
|
1810 | }());
|
1811 |
|
1812 |
|
1813 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
1814 | nativeMax = Math.max,
|
1815 | nativeNow = Date.now;
|
1816 |
|
1817 |
|
1818 | var Map = getNative(root, 'Map'),
|
1819 | nativeCreate = getNative(Object, 'create');
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 | var baseCreate = (function() {
|
1830 | function object() {}
|
1831 | return function(proto) {
|
1832 | if (!isObject(proto)) {
|
1833 | return {};
|
1834 | }
|
1835 | if (objectCreate) {
|
1836 | return objectCreate(proto);
|
1837 | }
|
1838 | object.prototype = proto;
|
1839 | var result = new object;
|
1840 | object.prototype = undefined;
|
1841 | return result;
|
1842 | };
|
1843 | }());
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 | function Hash(entries) {
|
1853 | var index = -1,
|
1854 | length = entries == null ? 0 : entries.length;
|
1855 |
|
1856 | this.clear();
|
1857 | while (++index < length) {
|
1858 | var entry = entries[index];
|
1859 | this.set(entry[0], entry[1]);
|
1860 | }
|
1861 | }
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 | function hashClear() {
|
1871 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
1872 | this.size = 0;
|
1873 | }
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 | function hashDelete(key) {
|
1886 | var result = this.has(key) && delete this.__data__[key];
|
1887 | this.size -= result ? 1 : 0;
|
1888 | return result;
|
1889 | }
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 | function hashGet(key) {
|
1901 | var data = this.__data__;
|
1902 | if (nativeCreate) {
|
1903 | var result = data[key];
|
1904 | return result === HASH_UNDEFINED ? undefined : result;
|
1905 | }
|
1906 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
1907 | }
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 | function hashHas(key) {
|
1919 | var data = this.__data__;
|
1920 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
1921 | }
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 | function hashSet(key, value) {
|
1934 | var data = this.__data__;
|
1935 | this.size += this.has(key) ? 0 : 1;
|
1936 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
1937 | return this;
|
1938 | }
|
1939 |
|
1940 |
|
1941 | Hash.prototype.clear = hashClear;
|
1942 | Hash.prototype['delete'] = hashDelete;
|
1943 | Hash.prototype.get = hashGet;
|
1944 | Hash.prototype.has = hashHas;
|
1945 | Hash.prototype.set = hashSet;
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 | function ListCache(entries) {
|
1955 | var index = -1,
|
1956 | length = entries == null ? 0 : entries.length;
|
1957 |
|
1958 | this.clear();
|
1959 | while (++index < length) {
|
1960 | var entry = entries[index];
|
1961 | this.set(entry[0], entry[1]);
|
1962 | }
|
1963 | }
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 | function listCacheClear() {
|
1973 | this.__data__ = [];
|
1974 | this.size = 0;
|
1975 | }
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 | function listCacheDelete(key) {
|
1987 | var data = this.__data__,
|
1988 | index = assocIndexOf(data, key);
|
1989 |
|
1990 | if (index < 0) {
|
1991 | return false;
|
1992 | }
|
1993 | var lastIndex = data.length - 1;
|
1994 | if (index == lastIndex) {
|
1995 | data.pop();
|
1996 | } else {
|
1997 | splice.call(data, index, 1);
|
1998 | }
|
1999 | --this.size;
|
2000 | return true;
|
2001 | }
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 | function listCacheGet(key) {
|
2013 | var data = this.__data__,
|
2014 | index = assocIndexOf(data, key);
|
2015 |
|
2016 | return index < 0 ? undefined : data[index][1];
|
2017 | }
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 | function listCacheHas(key) {
|
2029 | return assocIndexOf(this.__data__, key) > -1;
|
2030 | }
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 | function listCacheSet(key, value) {
|
2043 | var data = this.__data__,
|
2044 | index = assocIndexOf(data, key);
|
2045 |
|
2046 | if (index < 0) {
|
2047 | ++this.size;
|
2048 | data.push([key, value]);
|
2049 | } else {
|
2050 | data[index][1] = value;
|
2051 | }
|
2052 | return this;
|
2053 | }
|
2054 |
|
2055 |
|
2056 | ListCache.prototype.clear = listCacheClear;
|
2057 | ListCache.prototype['delete'] = listCacheDelete;
|
2058 | ListCache.prototype.get = listCacheGet;
|
2059 | ListCache.prototype.has = listCacheHas;
|
2060 | ListCache.prototype.set = listCacheSet;
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 | function MapCache(entries) {
|
2070 | var index = -1,
|
2071 | length = entries == null ? 0 : entries.length;
|
2072 |
|
2073 | this.clear();
|
2074 | while (++index < length) {
|
2075 | var entry = entries[index];
|
2076 | this.set(entry[0], entry[1]);
|
2077 | }
|
2078 | }
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 | function mapCacheClear() {
|
2088 | this.size = 0;
|
2089 | this.__data__ = {
|
2090 | 'hash': new Hash,
|
2091 | 'map': new (Map || ListCache),
|
2092 | 'string': new Hash
|
2093 | };
|
2094 | }
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 | function mapCacheDelete(key) {
|
2106 | var result = getMapData(this, key)['delete'](key);
|
2107 | this.size -= result ? 1 : 0;
|
2108 | return result;
|
2109 | }
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 | function mapCacheGet(key) {
|
2121 | return getMapData(this, key).get(key);
|
2122 | }
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 | function mapCacheHas(key) {
|
2134 | return getMapData(this, key).has(key);
|
2135 | }
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 | function mapCacheSet(key, value) {
|
2148 | var data = getMapData(this, key),
|
2149 | size = data.size;
|
2150 |
|
2151 | data.set(key, value);
|
2152 | this.size += data.size == size ? 0 : 1;
|
2153 | return this;
|
2154 | }
|
2155 |
|
2156 |
|
2157 | MapCache.prototype.clear = mapCacheClear;
|
2158 | MapCache.prototype['delete'] = mapCacheDelete;
|
2159 | MapCache.prototype.get = mapCacheGet;
|
2160 | MapCache.prototype.has = mapCacheHas;
|
2161 | MapCache.prototype.set = mapCacheSet;
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | function Stack(entries) {
|
2171 | var data = this.__data__ = new ListCache(entries);
|
2172 | this.size = data.size;
|
2173 | }
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 | function stackClear() {
|
2183 | this.__data__ = new ListCache;
|
2184 | this.size = 0;
|
2185 | }
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 | function stackDelete(key) {
|
2197 | var data = this.__data__,
|
2198 | result = data['delete'](key);
|
2199 |
|
2200 | this.size = data.size;
|
2201 | return result;
|
2202 | }
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 | function stackGet(key) {
|
2214 | return this.__data__.get(key);
|
2215 | }
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 | function stackHas(key) {
|
2227 | return this.__data__.has(key);
|
2228 | }
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 | function stackSet(key, value) {
|
2241 | var data = this.__data__;
|
2242 | if (data instanceof ListCache) {
|
2243 | var pairs = data.__data__;
|
2244 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
2245 | pairs.push([key, value]);
|
2246 | this.size = ++data.size;
|
2247 | return this;
|
2248 | }
|
2249 | data = this.__data__ = new MapCache(pairs);
|
2250 | }
|
2251 | data.set(key, value);
|
2252 | this.size = data.size;
|
2253 | return this;
|
2254 | }
|
2255 |
|
2256 |
|
2257 | Stack.prototype.clear = stackClear;
|
2258 | Stack.prototype['delete'] = stackDelete;
|
2259 | Stack.prototype.get = stackGet;
|
2260 | Stack.prototype.has = stackHas;
|
2261 | Stack.prototype.set = stackSet;
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 | function arrayLikeKeys(value, inherited) {
|
2272 | var isArr = isArray(value),
|
2273 | isArg = !isArr && isArguments(value),
|
2274 | isBuff = !isArr && !isArg && isBuffer(value),
|
2275 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
2276 | skipIndexes = isArr || isArg || isBuff || isType,
|
2277 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
2278 | length = result.length;
|
2279 |
|
2280 | for (var key in value) {
|
2281 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
2282 | !(skipIndexes && (
|
2283 |
|
2284 | key == 'length' ||
|
2285 |
|
2286 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
2287 |
|
2288 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
2289 |
|
2290 | isIndex(key, length)
|
2291 | ))) {
|
2292 | result.push(key);
|
2293 | }
|
2294 | }
|
2295 | return result;
|
2296 | }
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 | function assignMergeValue(object, key, value) {
|
2308 | if ((value !== undefined && !eq(object[key], value)) ||
|
2309 | (value === undefined && !(key in object))) {
|
2310 | baseAssignValue(object, key, value);
|
2311 | }
|
2312 | }
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 | function assignValue(object, key, value) {
|
2325 | var objValue = object[key];
|
2326 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
2327 | (value === undefined && !(key in object))) {
|
2328 | baseAssignValue(object, key, value);
|
2329 | }
|
2330 | }
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 | function assocIndexOf(array, key) {
|
2341 | var length = array.length;
|
2342 | while (length--) {
|
2343 | if (eq(array[length][0], key)) {
|
2344 | return length;
|
2345 | }
|
2346 | }
|
2347 | return -1;
|
2348 | }
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 | function baseAssignValue(object, key, value) {
|
2360 | if (key == '__proto__' && defineProperty) {
|
2361 | defineProperty(object, key, {
|
2362 | 'configurable': true,
|
2363 | 'enumerable': true,
|
2364 | 'value': value,
|
2365 | 'writable': true
|
2366 | });
|
2367 | } else {
|
2368 | object[key] = value;
|
2369 | }
|
2370 | }
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 | var baseFor = createBaseFor();
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 | function baseGetTag(value) {
|
2393 | if (value == null) {
|
2394 | return value === undefined ? undefinedTag : nullTag;
|
2395 | }
|
2396 | return (symToStringTag && symToStringTag in Object(value))
|
2397 | ? getRawTag(value)
|
2398 | : objectToString(value);
|
2399 | }
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 | function baseIsArguments(value) {
|
2409 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
2410 | }
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 | function baseIsNative(value) {
|
2421 | if (!isObject(value) || isMasked(value)) {
|
2422 | return false;
|
2423 | }
|
2424 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
2425 | return pattern.test(toSource(value));
|
2426 | }
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 | function baseIsTypedArray(value) {
|
2436 | return isObjectLike(value) &&
|
2437 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
2438 | }
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 | function baseKeysIn(object) {
|
2448 | if (!isObject(object)) {
|
2449 | return nativeKeysIn(object);
|
2450 | }
|
2451 | var isProto = isPrototype(object),
|
2452 | result = [];
|
2453 |
|
2454 | for (var key in object) {
|
2455 | if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
2456 | result.push(key);
|
2457 | }
|
2458 | }
|
2459 | return result;
|
2460 | }
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 | function baseMerge(object, source, srcIndex, customizer, stack) {
|
2474 | if (object === source) {
|
2475 | return;
|
2476 | }
|
2477 | baseFor(source, function(srcValue, key) {
|
2478 | stack || (stack = new Stack);
|
2479 | if (isObject(srcValue)) {
|
2480 | baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
2481 | }
|
2482 | else {
|
2483 | var newValue = customizer
|
2484 | ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
2485 | : undefined;
|
2486 |
|
2487 | if (newValue === undefined) {
|
2488 | newValue = srcValue;
|
2489 | }
|
2490 | assignMergeValue(object, key, newValue);
|
2491 | }
|
2492 | }, keysIn);
|
2493 | }
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 | function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
2511 | var objValue = safeGet(object, key),
|
2512 | srcValue = safeGet(source, key),
|
2513 | stacked = stack.get(srcValue);
|
2514 |
|
2515 | if (stacked) {
|
2516 | assignMergeValue(object, key, stacked);
|
2517 | return;
|
2518 | }
|
2519 | var newValue = customizer
|
2520 | ? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
2521 | : undefined;
|
2522 |
|
2523 | var isCommon = newValue === undefined;
|
2524 |
|
2525 | if (isCommon) {
|
2526 | var isArr = isArray(srcValue),
|
2527 | isBuff = !isArr && isBuffer(srcValue),
|
2528 | isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
2529 |
|
2530 | newValue = srcValue;
|
2531 | if (isArr || isBuff || isTyped) {
|
2532 | if (isArray(objValue)) {
|
2533 | newValue = objValue;
|
2534 | }
|
2535 | else if (isArrayLikeObject(objValue)) {
|
2536 | newValue = copyArray(objValue);
|
2537 | }
|
2538 | else if (isBuff) {
|
2539 | isCommon = false;
|
2540 | newValue = cloneBuffer(srcValue, true);
|
2541 | }
|
2542 | else if (isTyped) {
|
2543 | isCommon = false;
|
2544 | newValue = cloneTypedArray(srcValue, true);
|
2545 | }
|
2546 | else {
|
2547 | newValue = [];
|
2548 | }
|
2549 | }
|
2550 | else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
2551 | newValue = objValue;
|
2552 | if (isArguments(objValue)) {
|
2553 | newValue = toPlainObject(objValue);
|
2554 | }
|
2555 | else if (!isObject(objValue) || isFunction(objValue)) {
|
2556 | newValue = initCloneObject(srcValue);
|
2557 | }
|
2558 | }
|
2559 | else {
|
2560 | isCommon = false;
|
2561 | }
|
2562 | }
|
2563 | if (isCommon) {
|
2564 |
|
2565 | stack.set(srcValue, newValue);
|
2566 | mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
2567 | stack['delete'](srcValue);
|
2568 | }
|
2569 | assignMergeValue(object, key, newValue);
|
2570 | }
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 | function baseRest(func, start) {
|
2581 | return setToString(overRest(func, start, identity), func + '');
|
2582 | }
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 | var baseSetToString = !defineProperty ? identity : function(func, string) {
|
2593 | return defineProperty(func, 'toString', {
|
2594 | 'configurable': true,
|
2595 | 'enumerable': false,
|
2596 | 'value': constant(string),
|
2597 | 'writable': true
|
2598 | });
|
2599 | };
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 | function cloneBuffer(buffer, isDeep) {
|
2610 | if (isDeep) {
|
2611 | return buffer.slice();
|
2612 | }
|
2613 | var length = buffer.length,
|
2614 | result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
2615 |
|
2616 | buffer.copy(result);
|
2617 | return result;
|
2618 | }
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 | function cloneArrayBuffer(arrayBuffer) {
|
2628 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
2629 | new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
2630 | return result;
|
2631 | }
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 | function cloneTypedArray(typedArray, isDeep) {
|
2642 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
2643 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
2644 | }
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 | function copyArray(source, array) {
|
2655 | var index = -1,
|
2656 | length = source.length;
|
2657 |
|
2658 | array || (array = Array(length));
|
2659 | while (++index < length) {
|
2660 | array[index] = source[index];
|
2661 | }
|
2662 | return array;
|
2663 | }
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 | function copyObject(source, props, object, customizer) {
|
2676 | var isNew = !object;
|
2677 | object || (object = {});
|
2678 |
|
2679 | var index = -1,
|
2680 | length = props.length;
|
2681 |
|
2682 | while (++index < length) {
|
2683 | var key = props[index];
|
2684 |
|
2685 | var newValue = customizer
|
2686 | ? customizer(object[key], source[key], key, object, source)
|
2687 | : undefined;
|
2688 |
|
2689 | if (newValue === undefined) {
|
2690 | newValue = source[key];
|
2691 | }
|
2692 | if (isNew) {
|
2693 | baseAssignValue(object, key, newValue);
|
2694 | } else {
|
2695 | assignValue(object, key, newValue);
|
2696 | }
|
2697 | }
|
2698 | return object;
|
2699 | }
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 | function createAssigner(assigner) {
|
2709 | return baseRest(function(object, sources) {
|
2710 | var index = -1,
|
2711 | length = sources.length,
|
2712 | customizer = length > 1 ? sources[length - 1] : undefined,
|
2713 | guard = length > 2 ? sources[2] : undefined;
|
2714 |
|
2715 | customizer = (assigner.length > 3 && typeof customizer == 'function')
|
2716 | ? (length--, customizer)
|
2717 | : undefined;
|
2718 |
|
2719 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
2720 | customizer = length < 3 ? undefined : customizer;
|
2721 | length = 1;
|
2722 | }
|
2723 | object = Object(object);
|
2724 | while (++index < length) {
|
2725 | var source = sources[index];
|
2726 | if (source) {
|
2727 | assigner(object, source, index, customizer);
|
2728 | }
|
2729 | }
|
2730 | return object;
|
2731 | });
|
2732 | }
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 | function createBaseFor(fromRight) {
|
2742 | return function(object, iteratee, keysFunc) {
|
2743 | var index = -1,
|
2744 | iterable = Object(object),
|
2745 | props = keysFunc(object),
|
2746 | length = props.length;
|
2747 |
|
2748 | while (length--) {
|
2749 | var key = props[fromRight ? length : ++index];
|
2750 | if (iteratee(iterable[key], key, iterable) === false) {
|
2751 | break;
|
2752 | }
|
2753 | }
|
2754 | return object;
|
2755 | };
|
2756 | }
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 | function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
2773 | if (isObject(objValue) && isObject(srcValue)) {
|
2774 |
|
2775 | stack.set(srcValue, objValue);
|
2776 | baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
2777 | stack['delete'](srcValue);
|
2778 | }
|
2779 | return objValue;
|
2780 | }
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 | function getMapData(map, key) {
|
2791 | var data = map.__data__;
|
2792 | return isKeyable(key)
|
2793 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
2794 | : data.map;
|
2795 | }
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 | function getNative(object, key) {
|
2806 | var value = getValue(object, key);
|
2807 | return baseIsNative(value) ? value : undefined;
|
2808 | }
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 | function getRawTag(value) {
|
2818 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
2819 | tag = value[symToStringTag];
|
2820 |
|
2821 | try {
|
2822 | value[symToStringTag] = undefined;
|
2823 | var unmasked = true;
|
2824 | } catch (e) {}
|
2825 |
|
2826 | var result = nativeObjectToString.call(value);
|
2827 | if (unmasked) {
|
2828 | if (isOwn) {
|
2829 | value[symToStringTag] = tag;
|
2830 | } else {
|
2831 | delete value[symToStringTag];
|
2832 | }
|
2833 | }
|
2834 | return result;
|
2835 | }
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 | function initCloneObject(object) {
|
2845 | return (typeof object.constructor == 'function' && !isPrototype(object))
|
2846 | ? baseCreate(getPrototype(object))
|
2847 | : {};
|
2848 | }
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 | function isIndex(value, length) {
|
2859 | var type = typeof value;
|
2860 | length = length == null ? MAX_SAFE_INTEGER : length;
|
2861 |
|
2862 | return !!length &&
|
2863 | (type == 'number' ||
|
2864 | (type != 'symbol' && reIsUint.test(value))) &&
|
2865 | (value > -1 && value % 1 == 0 && value < length);
|
2866 | }
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 | function isIterateeCall(value, index, object) {
|
2879 | if (!isObject(object)) {
|
2880 | return false;
|
2881 | }
|
2882 | var type = typeof index;
|
2883 | if (type == 'number'
|
2884 | ? (isArrayLike(object) && isIndex(index, object.length))
|
2885 | : (type == 'string' && index in object)
|
2886 | ) {
|
2887 | return eq(object[index], value);
|
2888 | }
|
2889 | return false;
|
2890 | }
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 | function isKeyable(value) {
|
2900 | var type = typeof value;
|
2901 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
2902 | ? (value !== '__proto__')
|
2903 | : (value === null);
|
2904 | }
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 | function isMasked(func) {
|
2914 | return !!maskSrcKey && (maskSrcKey in func);
|
2915 | }
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 | function isPrototype(value) {
|
2925 | var Ctor = value && value.constructor,
|
2926 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
2927 |
|
2928 | return value === proto;
|
2929 | }
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | function nativeKeysIn(object) {
|
2941 | var result = [];
|
2942 | if (object != null) {
|
2943 | for (var key in Object(object)) {
|
2944 | result.push(key);
|
2945 | }
|
2946 | }
|
2947 | return result;
|
2948 | }
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 | function objectToString(value) {
|
2958 | return nativeObjectToString.call(value);
|
2959 | }
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 | function overRest(func, start, transform) {
|
2971 | start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
2972 | return function() {
|
2973 | var args = arguments,
|
2974 | index = -1,
|
2975 | length = nativeMax(args.length - start, 0),
|
2976 | array = Array(length);
|
2977 |
|
2978 | while (++index < length) {
|
2979 | array[index] = args[start + index];
|
2980 | }
|
2981 | index = -1;
|
2982 | var otherArgs = Array(start + 1);
|
2983 | while (++index < start) {
|
2984 | otherArgs[index] = args[index];
|
2985 | }
|
2986 | otherArgs[start] = transform(array);
|
2987 | return apply(func, this, otherArgs);
|
2988 | };
|
2989 | }
|
2990 |
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 | function safeGet(object, key) {
|
3000 | if (key === 'constructor' && typeof object[key] === 'function') {
|
3001 | return;
|
3002 | }
|
3003 |
|
3004 | if (key == '__proto__') {
|
3005 | return;
|
3006 | }
|
3007 |
|
3008 | return object[key];
|
3009 | }
|
3010 |
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 | var setToString = shortOut(baseSetToString);
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 | function shortOut(func) {
|
3031 | var count = 0,
|
3032 | lastCalled = 0;
|
3033 |
|
3034 | return function() {
|
3035 | var stamp = nativeNow(),
|
3036 | remaining = HOT_SPAN - (stamp - lastCalled);
|
3037 |
|
3038 | lastCalled = stamp;
|
3039 | if (remaining > 0) {
|
3040 | if (++count >= HOT_COUNT) {
|
3041 | return arguments[0];
|
3042 | }
|
3043 | } else {
|
3044 | count = 0;
|
3045 | }
|
3046 | return func.apply(undefined, arguments);
|
3047 | };
|
3048 | }
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 | function toSource(func) {
|
3058 | if (func != null) {
|
3059 | try {
|
3060 | return funcToString.call(func);
|
3061 | } catch (e) {}
|
3062 | try {
|
3063 | return (func + '');
|
3064 | } catch (e) {}
|
3065 | }
|
3066 | return '';
|
3067 | }
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 | function eq(value, other) {
|
3102 | return value === other || (value !== value && other !== other);
|
3103 | }
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
3124 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
3125 | !propertyIsEnumerable.call(value, 'callee');
|
3126 | };
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 | var isArray = Array.isArray;
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 | function isArrayLike(value) {
|
3179 | return value != null && isLength(value.length) && !isFunction(value);
|
3180 | }
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 | function isArrayLikeObject(value) {
|
3208 | return isObjectLike(value) && isArrayLike(value);
|
3209 | }
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 | var isBuffer = nativeIsBuffer || stubFalse;
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 | function isFunction(value) {
|
3248 | if (!isObject(value)) {
|
3249 | return false;
|
3250 | }
|
3251 |
|
3252 |
|
3253 | var tag = baseGetTag(value);
|
3254 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
3255 | }
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 | function isLength(value) {
|
3284 | return typeof value == 'number' &&
|
3285 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
3286 | }
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 | function isObject(value) {
|
3314 | var type = typeof value;
|
3315 | return value != null && (type == 'object' || type == 'function');
|
3316 | }
|
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 | function isObjectLike(value) {
|
3343 | return value != null && typeof value == 'object';
|
3344 | }
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 | function isPlainObject(value) {
|
3375 | if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
3376 | return false;
|
3377 | }
|
3378 | var proto = getPrototype(value);
|
3379 | if (proto === null) {
|
3380 | return true;
|
3381 | }
|
3382 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
3383 | return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
3384 | funcToString.call(Ctor) == objectCtorString;
|
3385 | }
|
3386 |
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 | function toPlainObject(value) {
|
3431 | return copyObject(value, keysIn(value));
|
3432 | }
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 | var defaultsDeep = baseRest(function(args) {
|
3454 | args.push(undefined, customDefaultsMerge);
|
3455 | return apply(mergeWith, undefined, args);
|
3456 | });
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 | function keysIn(object) {
|
3482 | return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
3483 | }
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 | var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
3517 | baseMerge(object, source, srcIndex, customizer);
|
3518 | });
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 | function constant(value) {
|
3540 | return function() {
|
3541 | return value;
|
3542 | };
|
3543 | }
|
3544 |
|
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 | function identity(value) {
|
3562 | return value;
|
3563 | }
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 | function stubFalse() {
|
3579 | return false;
|
3580 | }
|
3581 |
|
3582 | module.exports = defaultsDeep;
|
3583 |
|
3584 |
|
3585 | }),
|
3586 |
|
3587 | 3520:
|
3588 | ((module) => {
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 | var MAX_SAFE_INTEGER = 9007199254740991;
|
3601 |
|
3602 |
|
3603 | var argsTag = '[object Arguments]',
|
3604 | funcTag = '[object Function]',
|
3605 | genTag = '[object GeneratorFunction]';
|
3606 |
|
3607 |
|
3608 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 | function baseTimes(n, iteratee) {
|
3620 | var index = -1,
|
3621 | result = Array(n);
|
3622 |
|
3623 | while (++index < n) {
|
3624 | result[index] = iteratee(index);
|
3625 | }
|
3626 | return result;
|
3627 | }
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 | function overArg(func, transform) {
|
3638 | return function(arg) {
|
3639 | return func(transform(arg));
|
3640 | };
|
3641 | }
|
3642 |
|
3643 |
|
3644 | var objectProto = Object.prototype;
|
3645 |
|
3646 |
|
3647 | var hasOwnProperty = objectProto.hasOwnProperty;
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 | var objectToString = objectProto.toString;
|
3655 |
|
3656 |
|
3657 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
3658 |
|
3659 |
|
3660 | var nativeKeys = overArg(Object.keys, Object);
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 |
|
3670 | function arrayLikeKeys(value, inherited) {
|
3671 |
|
3672 |
|
3673 | var result = (isArray(value) || isArguments(value))
|
3674 | ? baseTimes(value.length, String)
|
3675 | : [];
|
3676 |
|
3677 | var length = result.length,
|
3678 | skipIndexes = !!length;
|
3679 |
|
3680 | for (var key in value) {
|
3681 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
3682 | !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
3683 | result.push(key);
|
3684 | }
|
3685 | }
|
3686 | return result;
|
3687 | }
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 | var baseFor = createBaseFor();
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 | function baseForOwn(object, iteratee) {
|
3711 | return object && baseFor(object, iteratee, keys);
|
3712 | }
|
3713 |
|
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 |
|
3719 |
|
3720 |
|
3721 | function baseKeys(object) {
|
3722 | if (!isPrototype(object)) {
|
3723 | return nativeKeys(object);
|
3724 | }
|
3725 | var result = [];
|
3726 | for (var key in Object(object)) {
|
3727 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
3728 | result.push(key);
|
3729 | }
|
3730 | }
|
3731 | return result;
|
3732 | }
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 | function createBaseFor(fromRight) {
|
3742 | return function(object, iteratee, keysFunc) {
|
3743 | var index = -1,
|
3744 | iterable = Object(object),
|
3745 | props = keysFunc(object),
|
3746 | length = props.length;
|
3747 |
|
3748 | while (length--) {
|
3749 | var key = props[fromRight ? length : ++index];
|
3750 | if (iteratee(iterable[key], key, iterable) === false) {
|
3751 | break;
|
3752 | }
|
3753 | }
|
3754 | return object;
|
3755 | };
|
3756 | }
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 | function isIndex(value, length) {
|
3767 | length = length == null ? MAX_SAFE_INTEGER : length;
|
3768 | return !!length &&
|
3769 | (typeof value == 'number' || reIsUint.test(value)) &&
|
3770 | (value > -1 && value % 1 == 0 && value < length);
|
3771 | }
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 | function isPrototype(value) {
|
3781 | var Ctor = value && value.constructor,
|
3782 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
3783 |
|
3784 | return value === proto;
|
3785 | }
|
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 |
|
3805 | function isArguments(value) {
|
3806 |
|
3807 | return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
3808 | (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
3809 | }
|
3810 |
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 | var isArray = Array.isArray;
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 | function isArrayLike(value) {
|
3862 | return value != null && isLength(value.length) && !isFunction(value);
|
3863 | }
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 | function isArrayLikeObject(value) {
|
3891 | return isObjectLike(value) && isArrayLike(value);
|
3892 | }
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 | function isFunction(value) {
|
3912 |
|
3913 |
|
3914 | var tag = isObject(value) ? objectToString.call(value) : '';
|
3915 | return tag == funcTag || tag == genTag;
|
3916 | }
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 | function isLength(value) {
|
3945 | return typeof value == 'number' &&
|
3946 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
3947 | }
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 | function isObject(value) {
|
3975 | var type = typeof value;
|
3976 | return !!value && (type == 'object' || type == 'function');
|
3977 | }
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 | function isObjectLike(value) {
|
4004 | return !!value && typeof value == 'object';
|
4005 | }
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 | function forOwn(object, iteratee) {
|
4036 | return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity);
|
4037 | }
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 | function keys(object) {
|
4068 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
4069 | }
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 | function identity(value) {
|
4088 | return value;
|
4089 | }
|
4090 |
|
4091 | module.exports = forOwn;
|
4092 |
|
4093 |
|
4094 | }),
|
4095 |
|
4096 | 372:
|
4097 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4098 |
|
4099 | "use strict";
|
4100 |
|
4101 |
|
4102 | var isPrototype = __webpack_require__(6060);
|
4103 |
|
4104 | module.exports = function (value) {
|
4105 | if (typeof value !== "function") return false;
|
4106 |
|
4107 | if (!hasOwnProperty.call(value, "length")) return false;
|
4108 |
|
4109 | try {
|
4110 | if (typeof value.length !== "number") return false;
|
4111 | if (typeof value.call !== "function") return false;
|
4112 | if (typeof value.apply !== "function") return false;
|
4113 | } catch (error) {
|
4114 | return false;
|
4115 | }
|
4116 |
|
4117 | return !isPrototype(value);
|
4118 | };
|
4119 |
|
4120 |
|
4121 | }),
|
4122 |
|
4123 | 3940:
|
4124 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4125 |
|
4126 | "use strict";
|
4127 |
|
4128 |
|
4129 | var isValue = __webpack_require__(5618);
|
4130 |
|
4131 |
|
4132 | var possibleTypes = { "object": true, "function": true, "undefined": true };
|
4133 |
|
4134 | module.exports = function (value) {
|
4135 | if (!isValue(value)) return false;
|
4136 | return hasOwnProperty.call(possibleTypes, typeof value);
|
4137 | };
|
4138 |
|
4139 |
|
4140 | }),
|
4141 |
|
4142 | 7205:
|
4143 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4144 |
|
4145 | "use strict";
|
4146 |
|
4147 |
|
4148 | var isFunction = __webpack_require__(372);
|
4149 |
|
4150 | var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString;
|
4151 |
|
4152 | module.exports = function (value) {
|
4153 | if (!isFunction(value)) return false;
|
4154 | if (classRe.test(functionToString.call(value))) return false;
|
4155 | return true;
|
4156 | };
|
4157 |
|
4158 |
|
4159 | }),
|
4160 |
|
4161 | 6060:
|
4162 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4163 |
|
4164 | "use strict";
|
4165 |
|
4166 |
|
4167 | var isObject = __webpack_require__(3940);
|
4168 |
|
4169 | module.exports = function (value) {
|
4170 | if (!isObject(value)) return false;
|
4171 | try {
|
4172 | if (!value.constructor) return false;
|
4173 | return value.constructor.prototype === value;
|
4174 | } catch (error) {
|
4175 | return false;
|
4176 | }
|
4177 | };
|
4178 |
|
4179 |
|
4180 | }),
|
4181 |
|
4182 | 5618:
|
4183 | ((module) => {
|
4184 |
|
4185 | "use strict";
|
4186 |
|
4187 |
|
4188 |
|
4189 | var _undefined = void 0;
|
4190 |
|
4191 | module.exports = function (value) { return value !== _undefined && value !== null; };
|
4192 |
|
4193 |
|
4194 | }),
|
4195 |
|
4196 | 4935:
|
4197 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4198 |
|
4199 | var createElement = __webpack_require__(3513)
|
4200 |
|
4201 | module.exports = createElement
|
4202 |
|
4203 |
|
4204 | }),
|
4205 |
|
4206 | 7921:
|
4207 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4208 |
|
4209 | var diff = __webpack_require__(3072)
|
4210 |
|
4211 | module.exports = diff
|
4212 |
|
4213 |
|
4214 | }),
|
4215 |
|
4216 | 347:
|
4217 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4218 |
|
4219 | var h = __webpack_require__(8744)
|
4220 |
|
4221 | module.exports = h
|
4222 |
|
4223 |
|
4224 | }),
|
4225 |
|
4226 | 9720:
|
4227 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4228 |
|
4229 | var patch = __webpack_require__(6943)
|
4230 |
|
4231 | module.exports = patch
|
4232 |
|
4233 |
|
4234 | }),
|
4235 |
|
4236 | 6672:
|
4237 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4238 |
|
4239 | var isObject = __webpack_require__(6240)
|
4240 | var isHook = __webpack_require__(7265)
|
4241 |
|
4242 | module.exports = applyProperties
|
4243 |
|
4244 | function applyProperties(node, props, previous) {
|
4245 | for (var propName in props) {
|
4246 | var propValue = props[propName]
|
4247 |
|
4248 | if (propValue === undefined) {
|
4249 | removeProperty(node, propName, propValue, previous);
|
4250 | } else if (isHook(propValue)) {
|
4251 | removeProperty(node, propName, propValue, previous)
|
4252 | if (propValue.hook) {
|
4253 | propValue.hook(node,
|
4254 | propName,
|
4255 | previous ? previous[propName] : undefined)
|
4256 | }
|
4257 | } else {
|
4258 | if (isObject(propValue)) {
|
4259 | patchObject(node, props, previous, propName, propValue);
|
4260 | } else {
|
4261 | node[propName] = propValue
|
4262 | }
|
4263 | }
|
4264 | }
|
4265 | }
|
4266 |
|
4267 | function removeProperty(node, propName, propValue, previous) {
|
4268 | if (previous) {
|
4269 | var previousValue = previous[propName]
|
4270 |
|
4271 | if (!isHook(previousValue)) {
|
4272 | if (propName === "attributes") {
|
4273 | for (var attrName in previousValue) {
|
4274 | node.removeAttribute(attrName)
|
4275 | }
|
4276 | } else if (propName === "style") {
|
4277 | for (var i in previousValue) {
|
4278 | node.style[i] = ""
|
4279 | }
|
4280 | } else if (typeof previousValue === "string") {
|
4281 | node[propName] = ""
|
4282 | } else {
|
4283 | node[propName] = null
|
4284 | }
|
4285 | } else if (previousValue.unhook) {
|
4286 | previousValue.unhook(node, propName, propValue)
|
4287 | }
|
4288 | }
|
4289 | }
|
4290 |
|
4291 | function patchObject(node, props, previous, propName, propValue) {
|
4292 | var previousValue = previous ? previous[propName] : undefined
|
4293 |
|
4294 |
|
4295 | if (propName === "attributes") {
|
4296 | for (var attrName in propValue) {
|
4297 | var attrValue = propValue[attrName]
|
4298 |
|
4299 | if (attrValue === undefined) {
|
4300 | node.removeAttribute(attrName)
|
4301 | } else {
|
4302 | node.setAttribute(attrName, attrValue)
|
4303 | }
|
4304 | }
|
4305 |
|
4306 | return
|
4307 | }
|
4308 |
|
4309 | if(previousValue && isObject(previousValue) &&
|
4310 | getPrototype(previousValue) !== getPrototype(propValue)) {
|
4311 | node[propName] = propValue
|
4312 | return
|
4313 | }
|
4314 |
|
4315 | if (!isObject(node[propName])) {
|
4316 | node[propName] = {}
|
4317 | }
|
4318 |
|
4319 | var replacer = propName === "style" ? "" : undefined
|
4320 |
|
4321 | for (var k in propValue) {
|
4322 | var value = propValue[k]
|
4323 | node[propName][k] = (value === undefined) ? replacer : value
|
4324 | }
|
4325 | }
|
4326 |
|
4327 | function getPrototype(value) {
|
4328 | if (Object.getPrototypeOf) {
|
4329 | return Object.getPrototypeOf(value)
|
4330 | } else if (value.__proto__) {
|
4331 | return value.__proto__
|
4332 | } else if (value.constructor) {
|
4333 | return value.constructor.prototype
|
4334 | }
|
4335 | }
|
4336 |
|
4337 |
|
4338 | }),
|
4339 |
|
4340 | 3513:
|
4341 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4342 |
|
4343 | var document = __webpack_require__(9144)
|
4344 |
|
4345 | var applyProperties = __webpack_require__(6672)
|
4346 |
|
4347 | var isVNode = __webpack_require__(5170)
|
4348 | var isVText = __webpack_require__(6221)
|
4349 | var isWidget = __webpack_require__(4097)
|
4350 | var handleThunk = __webpack_require__(6078)
|
4351 |
|
4352 | module.exports = createElement
|
4353 |
|
4354 | function createElement(vnode, opts) {
|
4355 | var doc = opts ? opts.document || document : document
|
4356 | var warn = opts ? opts.warn : null
|
4357 |
|
4358 | vnode = handleThunk(vnode).a
|
4359 |
|
4360 | if (isWidget(vnode)) {
|
4361 | return vnode.init()
|
4362 | } else if (isVText(vnode)) {
|
4363 | return doc.createTextNode(vnode.text)
|
4364 | } else if (!isVNode(vnode)) {
|
4365 | if (warn) {
|
4366 | warn("Item is not a valid virtual dom node", vnode)
|
4367 | }
|
4368 | return null
|
4369 | }
|
4370 |
|
4371 | var node = (vnode.namespace === null) ?
|
4372 | doc.createElement(vnode.tagName) :
|
4373 | doc.createElementNS(vnode.namespace, vnode.tagName)
|
4374 |
|
4375 | var props = vnode.properties
|
4376 | applyProperties(node, props)
|
4377 |
|
4378 | var children = vnode.children
|
4379 |
|
4380 | for (var i = 0; i < children.length; i++) {
|
4381 | var childNode = createElement(children[i], opts)
|
4382 | if (childNode) {
|
4383 | node.appendChild(childNode)
|
4384 | }
|
4385 | }
|
4386 |
|
4387 | return node
|
4388 | }
|
4389 |
|
4390 |
|
4391 | }),
|
4392 |
|
4393 | 8992:
|
4394 | ((module) => {
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 | var noChild = {}
|
4403 |
|
4404 | module.exports = domIndex
|
4405 |
|
4406 | function domIndex(rootNode, tree, indices, nodes) {
|
4407 | if (!indices || indices.length === 0) {
|
4408 | return {}
|
4409 | } else {
|
4410 | indices.sort(ascending)
|
4411 | return recurse(rootNode, tree, indices, nodes, 0)
|
4412 | }
|
4413 | }
|
4414 |
|
4415 | function recurse(rootNode, tree, indices, nodes, rootIndex) {
|
4416 | nodes = nodes || {}
|
4417 |
|
4418 |
|
4419 | if (rootNode) {
|
4420 | if (indexInRange(indices, rootIndex, rootIndex)) {
|
4421 | nodes[rootIndex] = rootNode
|
4422 | }
|
4423 |
|
4424 | var vChildren = tree.children
|
4425 |
|
4426 | if (vChildren) {
|
4427 |
|
4428 | var childNodes = rootNode.childNodes
|
4429 |
|
4430 | for (var i = 0; i < tree.children.length; i++) {
|
4431 | rootIndex += 1
|
4432 |
|
4433 | var vChild = vChildren[i] || noChild
|
4434 | var nextIndex = rootIndex + (vChild.count || 0)
|
4435 |
|
4436 |
|
4437 | if (indexInRange(indices, rootIndex, nextIndex)) {
|
4438 | recurse(childNodes[i], vChild, indices, nodes, rootIndex)
|
4439 | }
|
4440 |
|
4441 | rootIndex = nextIndex
|
4442 | }
|
4443 | }
|
4444 | }
|
4445 |
|
4446 | return nodes
|
4447 | }
|
4448 |
|
4449 |
|
4450 | function indexInRange(indices, left, right) {
|
4451 | if (indices.length === 0) {
|
4452 | return false
|
4453 | }
|
4454 |
|
4455 | var minIndex = 0
|
4456 | var maxIndex = indices.length - 1
|
4457 | var currentIndex
|
4458 | var currentItem
|
4459 |
|
4460 | while (minIndex <= maxIndex) {
|
4461 | currentIndex = ((maxIndex + minIndex) / 2) >> 0
|
4462 | currentItem = indices[currentIndex]
|
4463 |
|
4464 | if (minIndex === maxIndex) {
|
4465 | return currentItem >= left && currentItem <= right
|
4466 | } else if (currentItem < left) {
|
4467 | minIndex = currentIndex + 1
|
4468 | } else if (currentItem > right) {
|
4469 | maxIndex = currentIndex - 1
|
4470 | } else {
|
4471 | return true
|
4472 | }
|
4473 | }
|
4474 |
|
4475 | return false;
|
4476 | }
|
4477 |
|
4478 | function ascending(a, b) {
|
4479 | return a > b ? 1 : -1
|
4480 | }
|
4481 |
|
4482 |
|
4483 | }),
|
4484 |
|
4485 | 9120:
|
4486 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4487 |
|
4488 | var applyProperties = __webpack_require__(6672)
|
4489 |
|
4490 | var isWidget = __webpack_require__(4097)
|
4491 | var VPatch = __webpack_require__(8057)
|
4492 |
|
4493 | var updateWidget = __webpack_require__(6670)
|
4494 |
|
4495 | module.exports = applyPatch
|
4496 |
|
4497 | function applyPatch(vpatch, domNode, renderOptions) {
|
4498 | var type = vpatch.type
|
4499 | var vNode = vpatch.vNode
|
4500 | var patch = vpatch.patch
|
4501 |
|
4502 | switch (type) {
|
4503 | case VPatch.REMOVE:
|
4504 | return removeNode(domNode, vNode)
|
4505 | case VPatch.INSERT:
|
4506 | return insertNode(domNode, patch, renderOptions)
|
4507 | case VPatch.VTEXT:
|
4508 | return stringPatch(domNode, vNode, patch, renderOptions)
|
4509 | case VPatch.WIDGET:
|
4510 | return widgetPatch(domNode, vNode, patch, renderOptions)
|
4511 | case VPatch.VNODE:
|
4512 | return vNodePatch(domNode, vNode, patch, renderOptions)
|
4513 | case VPatch.ORDER:
|
4514 | reorderChildren(domNode, patch)
|
4515 | return domNode
|
4516 | case VPatch.PROPS:
|
4517 | applyProperties(domNode, patch, vNode.properties)
|
4518 | return domNode
|
4519 | case VPatch.THUNK:
|
4520 | return replaceRoot(domNode,
|
4521 | renderOptions.patch(domNode, patch, renderOptions))
|
4522 | default:
|
4523 | return domNode
|
4524 | }
|
4525 | }
|
4526 |
|
4527 | function removeNode(domNode, vNode) {
|
4528 | var parentNode = domNode.parentNode
|
4529 |
|
4530 | if (parentNode) {
|
4531 | parentNode.removeChild(domNode)
|
4532 | }
|
4533 |
|
4534 | destroyWidget(domNode, vNode);
|
4535 |
|
4536 | return null
|
4537 | }
|
4538 |
|
4539 | function insertNode(parentNode, vNode, renderOptions) {
|
4540 | var newNode = renderOptions.render(vNode, renderOptions)
|
4541 |
|
4542 | if (parentNode) {
|
4543 | parentNode.appendChild(newNode)
|
4544 | }
|
4545 |
|
4546 | return parentNode
|
4547 | }
|
4548 |
|
4549 | function stringPatch(domNode, leftVNode, vText, renderOptions) {
|
4550 | var newNode
|
4551 |
|
4552 | if (domNode.nodeType === 3) {
|
4553 | domNode.replaceData(0, domNode.length, vText.text)
|
4554 | newNode = domNode
|
4555 | } else {
|
4556 | var parentNode = domNode.parentNode
|
4557 | newNode = renderOptions.render(vText, renderOptions)
|
4558 |
|
4559 | if (parentNode && newNode !== domNode) {
|
4560 | parentNode.replaceChild(newNode, domNode)
|
4561 | }
|
4562 | }
|
4563 |
|
4564 | return newNode
|
4565 | }
|
4566 |
|
4567 | function widgetPatch(domNode, leftVNode, widget, renderOptions) {
|
4568 | var updating = updateWidget(leftVNode, widget)
|
4569 | var newNode
|
4570 |
|
4571 | if (updating) {
|
4572 | newNode = widget.update(leftVNode, domNode) || domNode
|
4573 | } else {
|
4574 | newNode = renderOptions.render(widget, renderOptions)
|
4575 | }
|
4576 |
|
4577 | var parentNode = domNode.parentNode
|
4578 |
|
4579 | if (parentNode && newNode !== domNode) {
|
4580 | parentNode.replaceChild(newNode, domNode)
|
4581 | }
|
4582 |
|
4583 | if (!updating) {
|
4584 | destroyWidget(domNode, leftVNode)
|
4585 | }
|
4586 |
|
4587 | return newNode
|
4588 | }
|
4589 |
|
4590 | function vNodePatch(domNode, leftVNode, vNode, renderOptions) {
|
4591 | var parentNode = domNode.parentNode
|
4592 | var newNode = renderOptions.render(vNode, renderOptions)
|
4593 |
|
4594 | if (parentNode && newNode !== domNode) {
|
4595 | parentNode.replaceChild(newNode, domNode)
|
4596 | }
|
4597 |
|
4598 | return newNode
|
4599 | }
|
4600 |
|
4601 | function destroyWidget(domNode, w) {
|
4602 | if (typeof w.destroy === "function" && isWidget(w)) {
|
4603 | w.destroy(domNode)
|
4604 | }
|
4605 | }
|
4606 |
|
4607 | function reorderChildren(domNode, moves) {
|
4608 | var childNodes = domNode.childNodes
|
4609 | var keyMap = {}
|
4610 | var node
|
4611 | var remove
|
4612 | var insert
|
4613 |
|
4614 | for (var i = 0; i < moves.removes.length; i++) {
|
4615 | remove = moves.removes[i]
|
4616 | node = childNodes[remove.from]
|
4617 | if (remove.key) {
|
4618 | keyMap[remove.key] = node
|
4619 | }
|
4620 | domNode.removeChild(node)
|
4621 | }
|
4622 |
|
4623 | var length = childNodes.length
|
4624 | for (var j = 0; j < moves.inserts.length; j++) {
|
4625 | insert = moves.inserts[j]
|
4626 | node = keyMap[insert.key]
|
4627 |
|
4628 | domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])
|
4629 | }
|
4630 | }
|
4631 |
|
4632 | function replaceRoot(oldRoot, newRoot) {
|
4633 | if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {
|
4634 | oldRoot.parentNode.replaceChild(newRoot, oldRoot)
|
4635 | }
|
4636 |
|
4637 | return newRoot;
|
4638 | }
|
4639 |
|
4640 |
|
4641 | }),
|
4642 |
|
4643 | 6943:
|
4644 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4645 |
|
4646 | var document = __webpack_require__(9144)
|
4647 | var isArray = __webpack_require__(7362)
|
4648 |
|
4649 | var render = __webpack_require__(3513)
|
4650 | var domIndex = __webpack_require__(8992)
|
4651 | var patchOp = __webpack_require__(9120)
|
4652 | module.exports = patch
|
4653 |
|
4654 | function patch(rootNode, patches, renderOptions) {
|
4655 | renderOptions = renderOptions || {}
|
4656 | renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch
|
4657 | ? renderOptions.patch
|
4658 | : patchRecursive
|
4659 | renderOptions.render = renderOptions.render || render
|
4660 |
|
4661 | return renderOptions.patch(rootNode, patches, renderOptions)
|
4662 | }
|
4663 |
|
4664 | function patchRecursive(rootNode, patches, renderOptions) {
|
4665 | var indices = patchIndices(patches)
|
4666 |
|
4667 | if (indices.length === 0) {
|
4668 | return rootNode
|
4669 | }
|
4670 |
|
4671 | var index = domIndex(rootNode, patches.a, indices)
|
4672 | var ownerDocument = rootNode.ownerDocument
|
4673 |
|
4674 | if (!renderOptions.document && ownerDocument !== document) {
|
4675 | renderOptions.document = ownerDocument
|
4676 | }
|
4677 |
|
4678 | for (var i = 0; i < indices.length; i++) {
|
4679 | var nodeIndex = indices[i]
|
4680 | rootNode = applyPatch(rootNode,
|
4681 | index[nodeIndex],
|
4682 | patches[nodeIndex],
|
4683 | renderOptions)
|
4684 | }
|
4685 |
|
4686 | return rootNode
|
4687 | }
|
4688 |
|
4689 | function applyPatch(rootNode, domNode, patchList, renderOptions) {
|
4690 | if (!domNode) {
|
4691 | return rootNode
|
4692 | }
|
4693 |
|
4694 | var newNode
|
4695 |
|
4696 | if (isArray(patchList)) {
|
4697 | for (var i = 0; i < patchList.length; i++) {
|
4698 | newNode = patchOp(patchList[i], domNode, renderOptions)
|
4699 |
|
4700 | if (domNode === rootNode) {
|
4701 | rootNode = newNode
|
4702 | }
|
4703 | }
|
4704 | } else {
|
4705 | newNode = patchOp(patchList, domNode, renderOptions)
|
4706 |
|
4707 | if (domNode === rootNode) {
|
4708 | rootNode = newNode
|
4709 | }
|
4710 | }
|
4711 |
|
4712 | return rootNode
|
4713 | }
|
4714 |
|
4715 | function patchIndices(patches) {
|
4716 | var indices = []
|
4717 |
|
4718 | for (var key in patches) {
|
4719 | if (key !== "a") {
|
4720 | indices.push(Number(key))
|
4721 | }
|
4722 | }
|
4723 |
|
4724 | return indices
|
4725 | }
|
4726 |
|
4727 |
|
4728 | }),
|
4729 |
|
4730 | 6670:
|
4731 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4732 |
|
4733 | var isWidget = __webpack_require__(4097)
|
4734 |
|
4735 | module.exports = updateWidget
|
4736 |
|
4737 | function updateWidget(a, b) {
|
4738 | if (isWidget(a) && isWidget(b)) {
|
4739 | if ("name" in a && "name" in b) {
|
4740 | return a.id === b.id
|
4741 | } else {
|
4742 | return a.init === b.init
|
4743 | }
|
4744 | }
|
4745 |
|
4746 | return false
|
4747 | }
|
4748 |
|
4749 |
|
4750 | }),
|
4751 |
|
4752 | 6505:
|
4753 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4754 |
|
4755 | "use strict";
|
4756 |
|
4757 |
|
4758 | var EvStore = __webpack_require__(8832);
|
4759 |
|
4760 | module.exports = EvHook;
|
4761 |
|
4762 | function EvHook(value) {
|
4763 | if (!(this instanceof EvHook)) {
|
4764 | return new EvHook(value);
|
4765 | }
|
4766 |
|
4767 | this.value = value;
|
4768 | }
|
4769 |
|
4770 | EvHook.prototype.hook = function (node, propertyName) {
|
4771 | var es = EvStore(node);
|
4772 | var propName = propertyName.substr(3);
|
4773 |
|
4774 | es[propName] = this.value;
|
4775 | };
|
4776 |
|
4777 | EvHook.prototype.unhook = function(node, propertyName) {
|
4778 | var es = EvStore(node);
|
4779 | var propName = propertyName.substr(3);
|
4780 |
|
4781 | es[propName] = undefined;
|
4782 | };
|
4783 |
|
4784 |
|
4785 | }),
|
4786 |
|
4787 | 7199:
|
4788 | ((module) => {
|
4789 |
|
4790 | "use strict";
|
4791 |
|
4792 |
|
4793 | module.exports = SoftSetHook;
|
4794 |
|
4795 | function SoftSetHook(value) {
|
4796 | if (!(this instanceof SoftSetHook)) {
|
4797 | return new SoftSetHook(value);
|
4798 | }
|
4799 |
|
4800 | this.value = value;
|
4801 | }
|
4802 |
|
4803 | SoftSetHook.prototype.hook = function (node, propertyName) {
|
4804 | if (node[propertyName] !== this.value) {
|
4805 | node[propertyName] = this.value;
|
4806 | }
|
4807 | };
|
4808 |
|
4809 |
|
4810 | }),
|
4811 |
|
4812 | 8744:
|
4813 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4814 |
|
4815 | "use strict";
|
4816 |
|
4817 |
|
4818 | var isArray = __webpack_require__(7362);
|
4819 |
|
4820 | var VNode = __webpack_require__(4282);
|
4821 | var VText = __webpack_require__(4268);
|
4822 | var isVNode = __webpack_require__(5170);
|
4823 | var isVText = __webpack_require__(6221);
|
4824 | var isWidget = __webpack_require__(4097);
|
4825 | var isHook = __webpack_require__(7265);
|
4826 | var isVThunk = __webpack_require__(6741);
|
4827 |
|
4828 | var parseTag = __webpack_require__(1948);
|
4829 | var softSetHook = __webpack_require__(7199);
|
4830 | var evHook = __webpack_require__(6505);
|
4831 |
|
4832 | module.exports = h;
|
4833 |
|
4834 | function h(tagName, properties, children) {
|
4835 | var childNodes = [];
|
4836 | var tag, props, key, namespace;
|
4837 |
|
4838 | if (!children && isChildren(properties)) {
|
4839 | children = properties;
|
4840 | props = {};
|
4841 | }
|
4842 |
|
4843 | props = props || properties || {};
|
4844 | tag = parseTag(tagName, props);
|
4845 |
|
4846 |
|
4847 | if (props.hasOwnProperty('key')) {
|
4848 | key = props.key;
|
4849 | props.key = undefined;
|
4850 | }
|
4851 |
|
4852 |
|
4853 | if (props.hasOwnProperty('namespace')) {
|
4854 | namespace = props.namespace;
|
4855 | props.namespace = undefined;
|
4856 | }
|
4857 |
|
4858 |
|
4859 | if (tag === 'INPUT' &&
|
4860 | !namespace &&
|
4861 | props.hasOwnProperty('value') &&
|
4862 | props.value !== undefined &&
|
4863 | !isHook(props.value)
|
4864 | ) {
|
4865 | props.value = softSetHook(props.value);
|
4866 | }
|
4867 |
|
4868 | transformProperties(props);
|
4869 |
|
4870 | if (children !== undefined && children !== null) {
|
4871 | addChild(children, childNodes, tag, props);
|
4872 | }
|
4873 |
|
4874 |
|
4875 | return new VNode(tag, props, childNodes, key, namespace);
|
4876 | }
|
4877 |
|
4878 | function addChild(c, childNodes, tag, props) {
|
4879 | if (typeof c === 'string') {
|
4880 | childNodes.push(new VText(c));
|
4881 | } else if (typeof c === 'number') {
|
4882 | childNodes.push(new VText(String(c)));
|
4883 | } else if (isChild(c)) {
|
4884 | childNodes.push(c);
|
4885 | } else if (isArray(c)) {
|
4886 | for (var i = 0; i < c.length; i++) {
|
4887 | addChild(c[i], childNodes, tag, props);
|
4888 | }
|
4889 | } else if (c === null || c === undefined) {
|
4890 | return;
|
4891 | } else {
|
4892 | throw UnexpectedVirtualElement({
|
4893 | foreignObject: c,
|
4894 | parentVnode: {
|
4895 | tagName: tag,
|
4896 | properties: props
|
4897 | }
|
4898 | });
|
4899 | }
|
4900 | }
|
4901 |
|
4902 | function transformProperties(props) {
|
4903 | for (var propName in props) {
|
4904 | if (props.hasOwnProperty(propName)) {
|
4905 | var value = props[propName];
|
4906 |
|
4907 | if (isHook(value)) {
|
4908 | continue;
|
4909 | }
|
4910 |
|
4911 | if (propName.substr(0, 3) === 'ev-') {
|
4912 |
|
4913 | props[propName] = evHook(value);
|
4914 | }
|
4915 | }
|
4916 | }
|
4917 | }
|
4918 |
|
4919 | function isChild(x) {
|
4920 | return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);
|
4921 | }
|
4922 |
|
4923 | function isChildren(x) {
|
4924 | return typeof x === 'string' || isArray(x) || isChild(x);
|
4925 | }
|
4926 |
|
4927 | function UnexpectedVirtualElement(data) {
|
4928 | var err = new Error();
|
4929 |
|
4930 | err.type = 'virtual-hyperscript.unexpected.virtual-element';
|
4931 | err.message = 'Unexpected virtual child passed to h().\n' +
|
4932 | 'Expected a VNode / Vthunk / VWidget / string but:\n' +
|
4933 | 'got:\n' +
|
4934 | errorString(data.foreignObject) +
|
4935 | '.\n' +
|
4936 | 'The parent vnode is:\n' +
|
4937 | errorString(data.parentVnode)
|
4938 | '\n' +
|
4939 | 'Suggested fix: change your `h(..., [ ... ])` callsite.';
|
4940 | err.foreignObject = data.foreignObject;
|
4941 | err.parentVnode = data.parentVnode;
|
4942 |
|
4943 | return err;
|
4944 | }
|
4945 |
|
4946 | function errorString(obj) {
|
4947 | try {
|
4948 | return JSON.stringify(obj, null, ' ');
|
4949 | } catch (e) {
|
4950 | return String(obj);
|
4951 | }
|
4952 | }
|
4953 |
|
4954 |
|
4955 | }),
|
4956 |
|
4957 | 1948:
|
4958 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4959 |
|
4960 | "use strict";
|
4961 |
|
4962 |
|
4963 | var split = __webpack_require__(6824);
|
4964 |
|
4965 | var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;
|
4966 | var notClassId = /^\.|#/;
|
4967 |
|
4968 | module.exports = parseTag;
|
4969 |
|
4970 | function parseTag(tag, props) {
|
4971 | if (!tag) {
|
4972 | return 'DIV';
|
4973 | }
|
4974 |
|
4975 | var noId = !(props.hasOwnProperty('id'));
|
4976 |
|
4977 | var tagParts = split(tag, classIdSplit);
|
4978 | var tagName = null;
|
4979 |
|
4980 | if (notClassId.test(tagParts[1])) {
|
4981 | tagName = 'DIV';
|
4982 | }
|
4983 |
|
4984 | var classes, part, type, i;
|
4985 |
|
4986 | for (i = 0; i < tagParts.length; i++) {
|
4987 | part = tagParts[i];
|
4988 |
|
4989 | if (!part) {
|
4990 | continue;
|
4991 | }
|
4992 |
|
4993 | type = part.charAt(0);
|
4994 |
|
4995 | if (!tagName) {
|
4996 | tagName = part;
|
4997 | } else if (type === '.') {
|
4998 | classes = classes || [];
|
4999 | classes.push(part.substring(1, part.length));
|
5000 | } else if (type === '#' && noId) {
|
5001 | props.id = part.substring(1, part.length);
|
5002 | }
|
5003 | }
|
5004 |
|
5005 | if (classes) {
|
5006 | if (props.className) {
|
5007 | classes.push(props.className);
|
5008 | }
|
5009 |
|
5010 | props.className = classes.join(' ');
|
5011 | }
|
5012 |
|
5013 | return props.namespace ? tagName : tagName.toUpperCase();
|
5014 | }
|
5015 |
|
5016 |
|
5017 | }),
|
5018 |
|
5019 | 6078:
|
5020 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5021 |
|
5022 | var isVNode = __webpack_require__(5170)
|
5023 | var isVText = __webpack_require__(6221)
|
5024 | var isWidget = __webpack_require__(4097)
|
5025 | var isThunk = __webpack_require__(6741)
|
5026 |
|
5027 | module.exports = handleThunk
|
5028 |
|
5029 | function handleThunk(a, b) {
|
5030 | var renderedA = a
|
5031 | var renderedB = b
|
5032 |
|
5033 | if (isThunk(b)) {
|
5034 | renderedB = renderThunk(b, a)
|
5035 | }
|
5036 |
|
5037 | if (isThunk(a)) {
|
5038 | renderedA = renderThunk(a, null)
|
5039 | }
|
5040 |
|
5041 | return {
|
5042 | a: renderedA,
|
5043 | b: renderedB
|
5044 | }
|
5045 | }
|
5046 |
|
5047 | function renderThunk(thunk, previous) {
|
5048 | var renderedThunk = thunk.vnode
|
5049 |
|
5050 | if (!renderedThunk) {
|
5051 | renderedThunk = thunk.vnode = thunk.render(previous)
|
5052 | }
|
5053 |
|
5054 | if (!(isVNode(renderedThunk) ||
|
5055 | isVText(renderedThunk) ||
|
5056 | isWidget(renderedThunk))) {
|
5057 | throw new Error("thunk did not return a valid node");
|
5058 | }
|
5059 |
|
5060 | return renderedThunk
|
5061 | }
|
5062 |
|
5063 |
|
5064 | }),
|
5065 |
|
5066 | 6741:
|
5067 | ((module) => {
|
5068 |
|
5069 | module.exports = isThunk
|
5070 |
|
5071 | function isThunk(t) {
|
5072 | return t && t.type === "Thunk"
|
5073 | }
|
5074 |
|
5075 |
|
5076 | }),
|
5077 |
|
5078 | 7265:
|
5079 | ((module) => {
|
5080 |
|
5081 | module.exports = isHook
|
5082 |
|
5083 | function isHook(hook) {
|
5084 | return hook &&
|
5085 | (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") ||
|
5086 | typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook"))
|
5087 | }
|
5088 |
|
5089 |
|
5090 | }),
|
5091 |
|
5092 | 5170:
|
5093 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5094 |
|
5095 | var version = __webpack_require__(9962)
|
5096 |
|
5097 | module.exports = isVirtualNode
|
5098 |
|
5099 | function isVirtualNode(x) {
|
5100 | return x && x.type === "VirtualNode" && x.version === version
|
5101 | }
|
5102 |
|
5103 |
|
5104 | }),
|
5105 |
|
5106 | 6221:
|
5107 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5108 |
|
5109 | var version = __webpack_require__(9962)
|
5110 |
|
5111 | module.exports = isVirtualText
|
5112 |
|
5113 | function isVirtualText(x) {
|
5114 | return x && x.type === "VirtualText" && x.version === version
|
5115 | }
|
5116 |
|
5117 |
|
5118 | }),
|
5119 |
|
5120 | 4097:
|
5121 | ((module) => {
|
5122 |
|
5123 | module.exports = isWidget
|
5124 |
|
5125 | function isWidget(w) {
|
5126 | return w && w.type === "Widget"
|
5127 | }
|
5128 |
|
5129 |
|
5130 | }),
|
5131 |
|
5132 | 9962:
|
5133 | ((module) => {
|
5134 |
|
5135 | module.exports = "2"
|
5136 |
|
5137 |
|
5138 | }),
|
5139 |
|
5140 | 4282:
|
5141 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5142 |
|
5143 | var version = __webpack_require__(9962)
|
5144 | var isVNode = __webpack_require__(5170)
|
5145 | var isWidget = __webpack_require__(4097)
|
5146 | var isThunk = __webpack_require__(6741)
|
5147 | var isVHook = __webpack_require__(7265)
|
5148 |
|
5149 | module.exports = VirtualNode
|
5150 |
|
5151 | var noProperties = {}
|
5152 | var noChildren = []
|
5153 |
|
5154 | function VirtualNode(tagName, properties, children, key, namespace) {
|
5155 | this.tagName = tagName
|
5156 | this.properties = properties || noProperties
|
5157 | this.children = children || noChildren
|
5158 | this.key = key != null ? String(key) : undefined
|
5159 | this.namespace = (typeof namespace === "string") ? namespace : null
|
5160 |
|
5161 | var count = (children && children.length) || 0
|
5162 | var descendants = 0
|
5163 | var hasWidgets = false
|
5164 | var hasThunks = false
|
5165 | var descendantHooks = false
|
5166 | var hooks
|
5167 |
|
5168 | for (var propName in properties) {
|
5169 | if (properties.hasOwnProperty(propName)) {
|
5170 | var property = properties[propName]
|
5171 | if (isVHook(property) && property.unhook) {
|
5172 | if (!hooks) {
|
5173 | hooks = {}
|
5174 | }
|
5175 |
|
5176 | hooks[propName] = property
|
5177 | }
|
5178 | }
|
5179 | }
|
5180 |
|
5181 | for (var i = 0; i < count; i++) {
|
5182 | var child = children[i]
|
5183 | if (isVNode(child)) {
|
5184 | descendants += child.count || 0
|
5185 |
|
5186 | if (!hasWidgets && child.hasWidgets) {
|
5187 | hasWidgets = true
|
5188 | }
|
5189 |
|
5190 | if (!hasThunks && child.hasThunks) {
|
5191 | hasThunks = true
|
5192 | }
|
5193 |
|
5194 | if (!descendantHooks && (child.hooks || child.descendantHooks)) {
|
5195 | descendantHooks = true
|
5196 | }
|
5197 | } else if (!hasWidgets && isWidget(child)) {
|
5198 | if (typeof child.destroy === "function") {
|
5199 | hasWidgets = true
|
5200 | }
|
5201 | } else if (!hasThunks && isThunk(child)) {
|
5202 | hasThunks = true;
|
5203 | }
|
5204 | }
|
5205 |
|
5206 | this.count = count + descendants
|
5207 | this.hasWidgets = hasWidgets
|
5208 | this.hasThunks = hasThunks
|
5209 | this.hooks = hooks
|
5210 | this.descendantHooks = descendantHooks
|
5211 | }
|
5212 |
|
5213 | VirtualNode.prototype.version = version
|
5214 | VirtualNode.prototype.type = "VirtualNode"
|
5215 |
|
5216 |
|
5217 | }),
|
5218 |
|
5219 | 8057:
|
5220 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5221 |
|
5222 | var version = __webpack_require__(9962)
|
5223 |
|
5224 | VirtualPatch.NONE = 0
|
5225 | VirtualPatch.VTEXT = 1
|
5226 | VirtualPatch.VNODE = 2
|
5227 | VirtualPatch.WIDGET = 3
|
5228 | VirtualPatch.PROPS = 4
|
5229 | VirtualPatch.ORDER = 5
|
5230 | VirtualPatch.INSERT = 6
|
5231 | VirtualPatch.REMOVE = 7
|
5232 | VirtualPatch.THUNK = 8
|
5233 |
|
5234 | module.exports = VirtualPatch
|
5235 |
|
5236 | function VirtualPatch(type, vNode, patch) {
|
5237 | this.type = Number(type)
|
5238 | this.vNode = vNode
|
5239 | this.patch = patch
|
5240 | }
|
5241 |
|
5242 | VirtualPatch.prototype.version = version
|
5243 | VirtualPatch.prototype.type = "VirtualPatch"
|
5244 |
|
5245 |
|
5246 | }),
|
5247 |
|
5248 | 4268:
|
5249 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5250 |
|
5251 | var version = __webpack_require__(9962)
|
5252 |
|
5253 | module.exports = VirtualText
|
5254 |
|
5255 | function VirtualText(text) {
|
5256 | this.text = String(text)
|
5257 | }
|
5258 |
|
5259 | VirtualText.prototype.version = version
|
5260 | VirtualText.prototype.type = "VirtualText"
|
5261 |
|
5262 |
|
5263 | }),
|
5264 |
|
5265 | 9973:
|
5266 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5267 |
|
5268 | var isObject = __webpack_require__(6240)
|
5269 | var isHook = __webpack_require__(7265)
|
5270 |
|
5271 | module.exports = diffProps
|
5272 |
|
5273 | function diffProps(a, b) {
|
5274 | var diff
|
5275 |
|
5276 | for (var aKey in a) {
|
5277 | if (!(aKey in b)) {
|
5278 | diff = diff || {}
|
5279 | diff[aKey] = undefined
|
5280 | }
|
5281 |
|
5282 | var aValue = a[aKey]
|
5283 | var bValue = b[aKey]
|
5284 |
|
5285 | if (aValue === bValue) {
|
5286 | continue
|
5287 | } else if (isObject(aValue) && isObject(bValue)) {
|
5288 | if (getPrototype(bValue) !== getPrototype(aValue)) {
|
5289 | diff = diff || {}
|
5290 | diff[aKey] = bValue
|
5291 | } else if (isHook(bValue)) {
|
5292 | diff = diff || {}
|
5293 | diff[aKey] = bValue
|
5294 | } else {
|
5295 | var objectDiff = diffProps(aValue, bValue)
|
5296 | if (objectDiff) {
|
5297 | diff = diff || {}
|
5298 | diff[aKey] = objectDiff
|
5299 | }
|
5300 | }
|
5301 | } else {
|
5302 | diff = diff || {}
|
5303 | diff[aKey] = bValue
|
5304 | }
|
5305 | }
|
5306 |
|
5307 | for (var bKey in b) {
|
5308 | if (!(bKey in a)) {
|
5309 | diff = diff || {}
|
5310 | diff[bKey] = b[bKey]
|
5311 | }
|
5312 | }
|
5313 |
|
5314 | return diff
|
5315 | }
|
5316 |
|
5317 | function getPrototype(value) {
|
5318 | if (Object.getPrototypeOf) {
|
5319 | return Object.getPrototypeOf(value)
|
5320 | } else if (value.__proto__) {
|
5321 | return value.__proto__
|
5322 | } else if (value.constructor) {
|
5323 | return value.constructor.prototype
|
5324 | }
|
5325 | }
|
5326 |
|
5327 |
|
5328 | }),
|
5329 |
|
5330 | 3072:
|
5331 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5332 |
|
5333 | var isArray = __webpack_require__(7362)
|
5334 |
|
5335 | var VPatch = __webpack_require__(8057)
|
5336 | var isVNode = __webpack_require__(5170)
|
5337 | var isVText = __webpack_require__(6221)
|
5338 | var isWidget = __webpack_require__(4097)
|
5339 | var isThunk = __webpack_require__(6741)
|
5340 | var handleThunk = __webpack_require__(6078)
|
5341 |
|
5342 | var diffProps = __webpack_require__(9973)
|
5343 |
|
5344 | module.exports = diff
|
5345 |
|
5346 | function diff(a, b) {
|
5347 | var patch = { a: a }
|
5348 | walk(a, b, patch, 0)
|
5349 | return patch
|
5350 | }
|
5351 |
|
5352 | function walk(a, b, patch, index) {
|
5353 | if (a === b) {
|
5354 | return
|
5355 | }
|
5356 |
|
5357 | var apply = patch[index]
|
5358 | var applyClear = false
|
5359 |
|
5360 | if (isThunk(a) || isThunk(b)) {
|
5361 | thunks(a, b, patch, index)
|
5362 | } else if (b == null) {
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 | if (!isWidget(a)) {
|
5368 | clearState(a, patch, index)
|
5369 | apply = patch[index]
|
5370 | }
|
5371 |
|
5372 | apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))
|
5373 | } else if (isVNode(b)) {
|
5374 | if (isVNode(a)) {
|
5375 | if (a.tagName === b.tagName &&
|
5376 | a.namespace === b.namespace &&
|
5377 | a.key === b.key) {
|
5378 | var propsPatch = diffProps(a.properties, b.properties)
|
5379 | if (propsPatch) {
|
5380 | apply = appendPatch(apply,
|
5381 | new VPatch(VPatch.PROPS, a, propsPatch))
|
5382 | }
|
5383 | apply = diffChildren(a, b, patch, apply, index)
|
5384 | } else {
|
5385 | apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
|
5386 | applyClear = true
|
5387 | }
|
5388 | } else {
|
5389 | apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
|
5390 | applyClear = true
|
5391 | }
|
5392 | } else if (isVText(b)) {
|
5393 | if (!isVText(a)) {
|
5394 | apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
|
5395 | applyClear = true
|
5396 | } else if (a.text !== b.text) {
|
5397 | apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
|
5398 | }
|
5399 | } else if (isWidget(b)) {
|
5400 | if (!isWidget(a)) {
|
5401 | applyClear = true
|
5402 | }
|
5403 |
|
5404 | apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))
|
5405 | }
|
5406 |
|
5407 | if (apply) {
|
5408 | patch[index] = apply
|
5409 | }
|
5410 |
|
5411 | if (applyClear) {
|
5412 | clearState(a, patch, index)
|
5413 | }
|
5414 | }
|
5415 |
|
5416 | function diffChildren(a, b, patch, apply, index) {
|
5417 | var aChildren = a.children
|
5418 | var orderedSet = reorder(aChildren, b.children)
|
5419 | var bChildren = orderedSet.children
|
5420 |
|
5421 | var aLen = aChildren.length
|
5422 | var bLen = bChildren.length
|
5423 | var len = aLen > bLen ? aLen : bLen
|
5424 |
|
5425 | for (var i = 0; i < len; i++) {
|
5426 | var leftNode = aChildren[i]
|
5427 | var rightNode = bChildren[i]
|
5428 | index += 1
|
5429 |
|
5430 | if (!leftNode) {
|
5431 | if (rightNode) {
|
5432 |
|
5433 | apply = appendPatch(apply,
|
5434 | new VPatch(VPatch.INSERT, null, rightNode))
|
5435 | }
|
5436 | } else {
|
5437 | walk(leftNode, rightNode, patch, index)
|
5438 | }
|
5439 |
|
5440 | if (isVNode(leftNode) && leftNode.count) {
|
5441 | index += leftNode.count
|
5442 | }
|
5443 | }
|
5444 |
|
5445 | if (orderedSet.moves) {
|
5446 |
|
5447 | apply = appendPatch(apply, new VPatch(
|
5448 | VPatch.ORDER,
|
5449 | a,
|
5450 | orderedSet.moves
|
5451 | ))
|
5452 | }
|
5453 |
|
5454 | return apply
|
5455 | }
|
5456 |
|
5457 | function clearState(vNode, patch, index) {
|
5458 |
|
5459 | unhook(vNode, patch, index)
|
5460 | destroyWidgets(vNode, patch, index)
|
5461 | }
|
5462 |
|
5463 |
|
5464 |
|
5465 | function destroyWidgets(vNode, patch, index) {
|
5466 | if (isWidget(vNode)) {
|
5467 | if (typeof vNode.destroy === "function") {
|
5468 | patch[index] = appendPatch(
|
5469 | patch[index],
|
5470 | new VPatch(VPatch.REMOVE, vNode, null)
|
5471 | )
|
5472 | }
|
5473 | } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {
|
5474 | var children = vNode.children
|
5475 | var len = children.length
|
5476 | for (var i = 0; i < len; i++) {
|
5477 | var child = children[i]
|
5478 | index += 1
|
5479 |
|
5480 | destroyWidgets(child, patch, index)
|
5481 |
|
5482 | if (isVNode(child) && child.count) {
|
5483 | index += child.count
|
5484 | }
|
5485 | }
|
5486 | } else if (isThunk(vNode)) {
|
5487 | thunks(vNode, null, patch, index)
|
5488 | }
|
5489 | }
|
5490 |
|
5491 |
|
5492 | function thunks(a, b, patch, index) {
|
5493 | var nodes = handleThunk(a, b)
|
5494 | var thunkPatch = diff(nodes.a, nodes.b)
|
5495 | if (hasPatches(thunkPatch)) {
|
5496 | patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)
|
5497 | }
|
5498 | }
|
5499 |
|
5500 | function hasPatches(patch) {
|
5501 | for (var index in patch) {
|
5502 | if (index !== "a") {
|
5503 | return true
|
5504 | }
|
5505 | }
|
5506 |
|
5507 | return false
|
5508 | }
|
5509 |
|
5510 |
|
5511 | function unhook(vNode, patch, index) {
|
5512 | if (isVNode(vNode)) {
|
5513 | if (vNode.hooks) {
|
5514 | patch[index] = appendPatch(
|
5515 | patch[index],
|
5516 | new VPatch(
|
5517 | VPatch.PROPS,
|
5518 | vNode,
|
5519 | undefinedKeys(vNode.hooks)
|
5520 | )
|
5521 | )
|
5522 | }
|
5523 |
|
5524 | if (vNode.descendantHooks || vNode.hasThunks) {
|
5525 | var children = vNode.children
|
5526 | var len = children.length
|
5527 | for (var i = 0; i < len; i++) {
|
5528 | var child = children[i]
|
5529 | index += 1
|
5530 |
|
5531 | unhook(child, patch, index)
|
5532 |
|
5533 | if (isVNode(child) && child.count) {
|
5534 | index += child.count
|
5535 | }
|
5536 | }
|
5537 | }
|
5538 | } else if (isThunk(vNode)) {
|
5539 | thunks(vNode, null, patch, index)
|
5540 | }
|
5541 | }
|
5542 |
|
5543 | function undefinedKeys(obj) {
|
5544 | var result = {}
|
5545 |
|
5546 | for (var key in obj) {
|
5547 | result[key] = undefined
|
5548 | }
|
5549 |
|
5550 | return result
|
5551 | }
|
5552 |
|
5553 |
|
5554 | function reorder(aChildren, bChildren) {
|
5555 |
|
5556 | var bChildIndex = keyIndex(bChildren)
|
5557 | var bKeys = bChildIndex.keys
|
5558 | var bFree = bChildIndex.free
|
5559 |
|
5560 | if (bFree.length === bChildren.length) {
|
5561 | return {
|
5562 | children: bChildren,
|
5563 | moves: null
|
5564 | }
|
5565 | }
|
5566 |
|
5567 |
|
5568 | var aChildIndex = keyIndex(aChildren)
|
5569 | var aKeys = aChildIndex.keys
|
5570 | var aFree = aChildIndex.free
|
5571 |
|
5572 | if (aFree.length === aChildren.length) {
|
5573 | return {
|
5574 | children: bChildren,
|
5575 | moves: null
|
5576 | }
|
5577 | }
|
5578 |
|
5579 |
|
5580 | var newChildren = []
|
5581 |
|
5582 | var freeIndex = 0
|
5583 | var freeCount = bFree.length
|
5584 | var deletedItems = 0
|
5585 |
|
5586 |
|
5587 |
|
5588 | for (var i = 0 ; i < aChildren.length; i++) {
|
5589 | var aItem = aChildren[i]
|
5590 | var itemIndex
|
5591 |
|
5592 | if (aItem.key) {
|
5593 | if (bKeys.hasOwnProperty(aItem.key)) {
|
5594 |
|
5595 | itemIndex = bKeys[aItem.key]
|
5596 | newChildren.push(bChildren[itemIndex])
|
5597 |
|
5598 | } else {
|
5599 |
|
5600 | itemIndex = i - deletedItems++
|
5601 | newChildren.push(null)
|
5602 | }
|
5603 | } else {
|
5604 |
|
5605 | if (freeIndex < freeCount) {
|
5606 | itemIndex = bFree[freeIndex++]
|
5607 | newChildren.push(bChildren[itemIndex])
|
5608 | } else {
|
5609 |
|
5610 |
|
5611 |
|
5612 | itemIndex = i - deletedItems++
|
5613 | newChildren.push(null)
|
5614 | }
|
5615 | }
|
5616 | }
|
5617 |
|
5618 | var lastFreeIndex = freeIndex >= bFree.length ?
|
5619 | bChildren.length :
|
5620 | bFree[freeIndex]
|
5621 |
|
5622 |
|
5623 |
|
5624 | for (var j = 0; j < bChildren.length; j++) {
|
5625 | var newItem = bChildren[j]
|
5626 |
|
5627 | if (newItem.key) {
|
5628 | if (!aKeys.hasOwnProperty(newItem.key)) {
|
5629 |
|
5630 |
|
5631 |
|
5632 | newChildren.push(newItem)
|
5633 | }
|
5634 | } else if (j >= lastFreeIndex) {
|
5635 |
|
5636 | newChildren.push(newItem)
|
5637 | }
|
5638 | }
|
5639 |
|
5640 | var simulate = newChildren.slice()
|
5641 | var simulateIndex = 0
|
5642 | var removes = []
|
5643 | var inserts = []
|
5644 | var simulateItem
|
5645 |
|
5646 | for (var k = 0; k < bChildren.length;) {
|
5647 | var wantedItem = bChildren[k]
|
5648 | simulateItem = simulate[simulateIndex]
|
5649 |
|
5650 |
|
5651 | while (simulateItem === null && simulate.length) {
|
5652 | removes.push(remove(simulate, simulateIndex, null))
|
5653 | simulateItem = simulate[simulateIndex]
|
5654 | }
|
5655 |
|
5656 | if (!simulateItem || simulateItem.key !== wantedItem.key) {
|
5657 |
|
5658 | if (wantedItem.key) {
|
5659 | if (simulateItem && simulateItem.key) {
|
5660 |
|
5661 | if (bKeys[simulateItem.key] !== k + 1) {
|
5662 | removes.push(remove(simulate, simulateIndex, simulateItem.key))
|
5663 | simulateItem = simulate[simulateIndex]
|
5664 |
|
5665 | if (!simulateItem || simulateItem.key !== wantedItem.key) {
|
5666 | inserts.push({key: wantedItem.key, to: k})
|
5667 | }
|
5668 |
|
5669 | else {
|
5670 | simulateIndex++
|
5671 | }
|
5672 | }
|
5673 | else {
|
5674 | inserts.push({key: wantedItem.key, to: k})
|
5675 | }
|
5676 | }
|
5677 | else {
|
5678 | inserts.push({key: wantedItem.key, to: k})
|
5679 | }
|
5680 | k++
|
5681 | }
|
5682 |
|
5683 | else if (simulateItem && simulateItem.key) {
|
5684 | removes.push(remove(simulate, simulateIndex, simulateItem.key))
|
5685 | }
|
5686 | }
|
5687 | else {
|
5688 | simulateIndex++
|
5689 | k++
|
5690 | }
|
5691 | }
|
5692 |
|
5693 |
|
5694 | while(simulateIndex < simulate.length) {
|
5695 | simulateItem = simulate[simulateIndex]
|
5696 | removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))
|
5697 | }
|
5698 |
|
5699 |
|
5700 |
|
5701 | if (removes.length === deletedItems && !inserts.length) {
|
5702 | return {
|
5703 | children: newChildren,
|
5704 | moves: null
|
5705 | }
|
5706 | }
|
5707 |
|
5708 | return {
|
5709 | children: newChildren,
|
5710 | moves: {
|
5711 | removes: removes,
|
5712 | inserts: inserts
|
5713 | }
|
5714 | }
|
5715 | }
|
5716 |
|
5717 | function remove(arr, index, key) {
|
5718 | arr.splice(index, 1)
|
5719 |
|
5720 | return {
|
5721 | from: index,
|
5722 | key: key
|
5723 | }
|
5724 | }
|
5725 |
|
5726 | function keyIndex(children) {
|
5727 | var keys = {}
|
5728 | var free = []
|
5729 | var length = children.length
|
5730 |
|
5731 | for (var i = 0; i < length; i++) {
|
5732 | var child = children[i]
|
5733 |
|
5734 | if (child.key) {
|
5735 | keys[child.key] = i
|
5736 | } else {
|
5737 | free.push(i)
|
5738 | }
|
5739 | }
|
5740 |
|
5741 | return {
|
5742 | keys: keys,
|
5743 | free: free
|
5744 | }
|
5745 | }
|
5746 |
|
5747 | function appendPatch(apply, patch) {
|
5748 | if (apply) {
|
5749 | if (isArray(apply)) {
|
5750 | apply.push(patch)
|
5751 | } else {
|
5752 | apply = [apply, patch]
|
5753 | }
|
5754 |
|
5755 | return apply
|
5756 | } else {
|
5757 | return patch
|
5758 | }
|
5759 | }
|
5760 |
|
5761 |
|
5762 | }),
|
5763 |
|
5764 | 4991:
|
5765 | ((module) => {
|
5766 |
|
5767 | "use strict";
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 | function findMinMax(array) {
|
5774 | var min = Infinity;
|
5775 | var max = -Infinity;
|
5776 | var i = 0;
|
5777 | var len = array.length;
|
5778 | var curr;
|
5779 |
|
5780 | for (; i < len; i++) {
|
5781 | curr = array[i];
|
5782 | if (min > curr) {
|
5783 | min = curr;
|
5784 | }
|
5785 | if (max < curr) {
|
5786 | max = curr;
|
5787 | }
|
5788 | }
|
5789 |
|
5790 | return {
|
5791 | min: min,
|
5792 | max: max
|
5793 | };
|
5794 | }
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 | function convert(n, bits) {
|
5801 | var max = Math.pow(2, bits - 1);
|
5802 | var v = n < 0 ? n * max : n * (max - 1);
|
5803 | return Math.max(-max, Math.min(max - 1, v));
|
5804 | }
|
5805 |
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 | function extractPeaks(channel, samplesPerPixel, bits) {
|
5811 | var i;
|
5812 | var chanLength = channel.length;
|
5813 | var numPeaks = Math.ceil(chanLength / samplesPerPixel);
|
5814 | var start;
|
5815 | var end;
|
5816 | var segment;
|
5817 | var max;
|
5818 | var min;
|
5819 | var extrema;
|
5820 |
|
5821 |
|
5822 | var peaks = makeTypedArray(bits, numPeaks * 2);
|
5823 |
|
5824 | for (i = 0; i < numPeaks; i++) {
|
5825 | start = i * samplesPerPixel;
|
5826 | end =
|
5827 | (i + 1) * samplesPerPixel > chanLength
|
5828 | ? chanLength
|
5829 | : (i + 1) * samplesPerPixel;
|
5830 |
|
5831 | segment = channel.subarray(start, end);
|
5832 | extrema = findMinMax(segment);
|
5833 | min = convert(extrema.min, bits);
|
5834 | max = convert(extrema.max, bits);
|
5835 |
|
5836 | peaks[i * 2] = min;
|
5837 | peaks[i * 2 + 1] = max;
|
5838 | }
|
5839 |
|
5840 | return peaks;
|
5841 | }
|
5842 |
|
5843 | function makeTypedArray(bits, length) {
|
5844 | return new (new Function(`return Int${bits}Array`)())(length);
|
5845 | }
|
5846 |
|
5847 | function makeMono(channelPeaks, bits) {
|
5848 | var numChan = channelPeaks.length;
|
5849 | var weight = 1 / numChan;
|
5850 | var numPeaks = channelPeaks[0].length / 2;
|
5851 | var c = 0;
|
5852 | var i = 0;
|
5853 | var min;
|
5854 | var max;
|
5855 | var peaks = makeTypedArray(bits, numPeaks * 2);
|
5856 |
|
5857 | for (i = 0; i < numPeaks; i++) {
|
5858 | min = 0;
|
5859 | max = 0;
|
5860 |
|
5861 | for (c = 0; c < numChan; c++) {
|
5862 | min += weight * channelPeaks[c][i * 2];
|
5863 | max += weight * channelPeaks[c][i * 2 + 1];
|
5864 | }
|
5865 |
|
5866 | peaks[i * 2] = min;
|
5867 | peaks[i * 2 + 1] = max;
|
5868 | }
|
5869 |
|
5870 |
|
5871 | return [peaks];
|
5872 | }
|
5873 |
|
5874 | function defaultNumber(value, defaultNumber) {
|
5875 | if (typeof value === "number") {
|
5876 | return value;
|
5877 | } else {
|
5878 | return defaultNumber;
|
5879 | }
|
5880 | }
|
5881 |
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 | module.exports = function (
|
5891 | source,
|
5892 | samplesPerPixel,
|
5893 | isMono,
|
5894 | cueIn,
|
5895 | cueOut,
|
5896 | bits
|
5897 | ) {
|
5898 | samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
|
5899 | bits = defaultNumber(bits, 16);
|
5900 |
|
5901 | if (isMono === null || isMono === undefined) {
|
5902 | isMono = true;
|
5903 | }
|
5904 |
|
5905 | if ([8, 16, 32].indexOf(bits) < 0) {
|
5906 | throw new Error("Invalid number of bits specified for peaks.");
|
5907 | }
|
5908 |
|
5909 | var numChan = source.numberOfChannels;
|
5910 | var peaks = [];
|
5911 | var c;
|
5912 | var numPeaks;
|
5913 | var channel;
|
5914 | var slice;
|
5915 |
|
5916 | cueIn = defaultNumber(cueIn, 0);
|
5917 | cueOut = defaultNumber(cueOut, source.length);
|
5918 |
|
5919 | if (typeof source.subarray === "undefined") {
|
5920 | for (c = 0; c < numChan; c++) {
|
5921 | channel = source.getChannelData(c);
|
5922 | slice = channel.subarray(cueIn, cueOut);
|
5923 | peaks.push(extractPeaks(slice, samplesPerPixel, bits));
|
5924 | }
|
5925 | } else {
|
5926 | peaks.push(
|
5927 | extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits)
|
5928 | );
|
5929 | }
|
5930 |
|
5931 | if (isMono && peaks.length > 1) {
|
5932 | peaks = makeMono(peaks, bits);
|
5933 | }
|
5934 |
|
5935 | numPeaks = peaks[0].length / 2;
|
5936 |
|
5937 | return {
|
5938 | length: numPeaks,
|
5939 | data: peaks,
|
5940 | bits: bits
|
5941 | };
|
5942 | };
|
5943 |
|
5944 |
|
5945 | }),
|
5946 |
|
5947 | 7362:
|
5948 | ((module) => {
|
5949 |
|
5950 | var nativeIsArray = Array.isArray
|
5951 | var toString = Object.prototype.toString
|
5952 |
|
5953 | module.exports = nativeIsArray || isArray
|
5954 |
|
5955 | function isArray(obj) {
|
5956 | return toString.call(obj) === "[object Array]"
|
5957 | }
|
5958 |
|
5959 |
|
5960 | }),
|
5961 |
|
5962 | 5893:
|
5963 | (() => {
|
5964 |
|
5965 |
|
5966 |
|
5967 | })
|
5968 |
|
5969 | });
|
5970 |
|
5971 |
|
5972 | var __webpack_module_cache__ = {};
|
5973 |
|
5974 |
|
5975 | function __webpack_require__(moduleId) {
|
5976 |
|
5977 | var cachedModule = __webpack_module_cache__[moduleId];
|
5978 | if (cachedModule !== undefined) {
|
5979 | return cachedModule.exports;
|
5980 | }
|
5981 |
|
5982 | var module = __webpack_module_cache__[moduleId] = {
|
5983 | id: moduleId,
|
5984 | loaded: false,
|
5985 | exports: {}
|
5986 | };
|
5987 |
|
5988 |
|
5989 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
5990 |
|
5991 |
|
5992 | module.loaded = true;
|
5993 |
|
5994 |
|
5995 | return module.exports;
|
5996 | }
|
5997 |
|
5998 |
|
5999 |
|
6000 | (() => {
|
6001 |
|
6002 | __webpack_require__.n = (module) => {
|
6003 | var getter = module && module.__esModule ?
|
6004 | () => (module['default']) :
|
6005 | () => (module);
|
6006 | __webpack_require__.d(getter, { a: getter });
|
6007 | return getter;
|
6008 | };
|
6009 | })();
|
6010 |
|
6011 |
|
6012 | (() => {
|
6013 |
|
6014 | __webpack_require__.d = (exports, definition) => {
|
6015 | for(var key in definition) {
|
6016 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
6017 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
6018 | }
|
6019 | }
|
6020 | };
|
6021 | })();
|
6022 |
|
6023 |
|
6024 | (() => {
|
6025 | __webpack_require__.g = (function() {
|
6026 | if (typeof globalThis === 'object') return globalThis;
|
6027 | try {
|
6028 | return this || new Function('return this')();
|
6029 | } catch (e) {
|
6030 | if (typeof window === 'object') return window;
|
6031 | }
|
6032 | })();
|
6033 | })();
|
6034 |
|
6035 |
|
6036 | (() => {
|
6037 | __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
6038 | })();
|
6039 |
|
6040 |
|
6041 | (() => {
|
6042 |
|
6043 | __webpack_require__.r = (exports) => {
|
6044 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
6045 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
6046 | }
|
6047 | Object.defineProperty(exports, '__esModule', { value: true });
|
6048 | };
|
6049 | })();
|
6050 |
|
6051 |
|
6052 | (() => {
|
6053 | __webpack_require__.nmd = (module) => {
|
6054 | module.paths = [];
|
6055 | if (!module.children) module.children = [];
|
6056 | return module;
|
6057 | };
|
6058 | })();
|
6059 |
|
6060 |
|
6061 | var __webpack_exports__ = {};
|
6062 |
|
6063 | (() => {
|
6064 | "use strict";
|
6065 |
|
6066 | __webpack_require__.r(__webpack_exports__);
|
6067 |
|
6068 |
|
6069 | __webpack_require__.d(__webpack_exports__, {
|
6070 | "default": () => ( app),
|
6071 | "init": () => ( init)
|
6072 | });
|
6073 |
|
6074 |
|
6075 | var lodash_defaultsdeep = __webpack_require__(2098);
|
6076 | var lodash_defaultsdeep_default = __webpack_require__.n(lodash_defaultsdeep);
|
6077 |
|
6078 | var create_element = __webpack_require__(4935);
|
6079 | var create_element_default = __webpack_require__.n(create_element);
|
6080 |
|
6081 | var event_emitter = __webpack_require__(8370);
|
6082 | var event_emitter_default = __webpack_require__.n(event_emitter);
|
6083 |
|
6084 | var h = __webpack_require__(347);
|
6085 | var h_default = __webpack_require__.n(h);
|
6086 |
|
6087 | var diff = __webpack_require__(7921);
|
6088 | var diff_default = __webpack_require__.n(diff);
|
6089 |
|
6090 | var patch = __webpack_require__(9720);
|
6091 | var patch_default = __webpack_require__.n(patch);
|
6092 |
|
6093 | var inline_worker = __webpack_require__(849);
|
6094 | var inline_worker_default = __webpack_require__.n(inline_worker);
|
6095 | ;
|
6096 | function samplesToSeconds(samples, sampleRate) {
|
6097 | return samples / sampleRate;
|
6098 | }
|
6099 |
|
6100 | function secondsToSamples(seconds, sampleRate) {
|
6101 | return Math.ceil(seconds * sampleRate);
|
6102 | }
|
6103 |
|
6104 | function samplesToPixels(samples, resolution) {
|
6105 | return Math.floor(samples / resolution);
|
6106 | }
|
6107 |
|
6108 | function pixelsToSamples(pixels, resolution) {
|
6109 | return Math.floor(pixels * resolution);
|
6110 | }
|
6111 |
|
6112 | function pixelsToSeconds(pixels, resolution, sampleRate) {
|
6113 | return (pixels * resolution) / sampleRate;
|
6114 | }
|
6115 |
|
6116 | function secondsToPixels(seconds, resolution, sampleRate) {
|
6117 | return Math.ceil((seconds * sampleRate) / resolution);
|
6118 | }
|
6119 |
|
6120 | ;
|
6121 |
|
6122 |
|
6123 | const STATE_UNINITIALIZED = 0;
|
6124 | const STATE_LOADING = 1;
|
6125 | const STATE_DECODING = 2;
|
6126 | const STATE_FINISHED = 3;
|
6127 |
|
6128 | const Loader = (class {
|
6129 | constructor(src, audioContext, ee = event_emitter_default()()) {
|
6130 | this.src = src;
|
6131 | this.ac = audioContext;
|
6132 | this.audioRequestState = STATE_UNINITIALIZED;
|
6133 | this.ee = ee;
|
6134 | }
|
6135 |
|
6136 | setStateChange(state) {
|
6137 | this.audioRequestState = state;
|
6138 | this.ee.emit("audiorequeststatechange", this.audioRequestState, this.src);
|
6139 | }
|
6140 |
|
6141 | fileProgress(e) {
|
6142 | let percentComplete = 0;
|
6143 |
|
6144 | if (this.audioRequestState === STATE_UNINITIALIZED) {
|
6145 | this.setStateChange(STATE_LOADING);
|
6146 | }
|
6147 |
|
6148 | if (e.lengthComputable) {
|
6149 | percentComplete = (e.loaded / e.total) * 100;
|
6150 | }
|
6151 |
|
6152 | this.ee.emit("loadprogress", percentComplete, this.src);
|
6153 | }
|
6154 |
|
6155 | fileLoad(e) {
|
6156 | const audioData = e.target.response || e.target.result;
|
6157 |
|
6158 | this.setStateChange(STATE_DECODING);
|
6159 |
|
6160 | return new Promise((resolve, reject) => {
|
6161 | this.ac.decodeAudioData(
|
6162 | audioData,
|
6163 | (audioBuffer) => {
|
6164 | this.audioBuffer = audioBuffer;
|
6165 | this.setStateChange(STATE_FINISHED);
|
6166 |
|
6167 | resolve(audioBuffer);
|
6168 | },
|
6169 | (err) => {
|
6170 | if (err === null) {
|
6171 |
|
6172 | reject(Error("MediaDecodeAudioDataUnknownContentType"));
|
6173 | } else {
|
6174 | reject(err);
|
6175 | }
|
6176 | }
|
6177 | );
|
6178 | });
|
6179 | }
|
6180 | });
|
6181 |
|
6182 | ;
|
6183 |
|
6184 |
|
6185 | const BlobLoader = (class extends Loader {
|
6186 | |
6187 |
|
6188 |
|
6189 | load() {
|
6190 | return new Promise((resolve, reject) => {
|
6191 | if (
|
6192 | this.src.type.match(/audio.*/) ||
|
6193 |
|
6194 | this.src.type.match(/video\/ogg/)
|
6195 | ) {
|
6196 | const fr = new FileReader();
|
6197 |
|
6198 | fr.readAsArrayBuffer(this.src);
|
6199 |
|
6200 | fr.addEventListener("progress", (e) => {
|
6201 | super.fileProgress(e);
|
6202 | });
|
6203 |
|
6204 | fr.addEventListener("load", (e) => {
|
6205 | const decoderPromise = super.fileLoad(e);
|
6206 |
|
6207 | decoderPromise
|
6208 | .then((audioBuffer) => {
|
6209 | resolve(audioBuffer);
|
6210 | })
|
6211 | .catch(reject);
|
6212 | });
|
6213 |
|
6214 | fr.addEventListener("error", reject);
|
6215 | } else {
|
6216 | reject(Error(`Unsupported file type ${this.src.type}`));
|
6217 | }
|
6218 | });
|
6219 | }
|
6220 | });
|
6221 |
|
6222 | ;
|
6223 |
|
6224 |
|
6225 | class IdentityLoader extends Loader {
|
6226 | load() {
|
6227 | return Promise.resolve(this.src);
|
6228 | }
|
6229 | }
|
6230 |
|
6231 | ;
|
6232 |
|
6233 |
|
6234 | const XHRLoader = (class extends Loader {
|
6235 | |
6236 |
|
6237 |
|
6238 | load() {
|
6239 | return new Promise((resolve, reject) => {
|
6240 | const xhr = new XMLHttpRequest();
|
6241 |
|
6242 | xhr.open("GET", this.src, true);
|
6243 | xhr.responseType = "arraybuffer";
|
6244 | xhr.send();
|
6245 |
|
6246 | xhr.addEventListener("progress", (e) => {
|
6247 | super.fileProgress(e);
|
6248 | });
|
6249 |
|
6250 | xhr.addEventListener("load", (e) => {
|
6251 | const decoderPromise = super.fileLoad(e);
|
6252 |
|
6253 | decoderPromise
|
6254 | .then((audioBuffer) => {
|
6255 | resolve(audioBuffer);
|
6256 | })
|
6257 | .catch(reject);
|
6258 | });
|
6259 |
|
6260 | xhr.addEventListener("error", () => {
|
6261 | reject(Error(`Track ${this.src} failed to load`));
|
6262 | });
|
6263 | });
|
6264 | }
|
6265 | });
|
6266 |
|
6267 | ;
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 | const LoaderFactory = (class {
|
6273 | static createLoader(src, audioContext, ee) {
|
6274 | if (src instanceof Blob) {
|
6275 | return new BlobLoader(src, audioContext, ee);
|
6276 | } else if (src instanceof AudioBuffer) {
|
6277 | return new IdentityLoader(src, audioContext, ee);
|
6278 | } else if (typeof src === "string") {
|
6279 | return new XHRLoader(src, audioContext, ee);
|
6280 | }
|
6281 |
|
6282 | throw new Error("Unsupported src type");
|
6283 | }
|
6284 | });
|
6285 |
|
6286 | ;
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 | const ScrollHook = (class {
|
6293 | constructor(playlist) {
|
6294 | this.playlist = playlist;
|
6295 | }
|
6296 |
|
6297 | hook(node) {
|
6298 | const playlist = this.playlist;
|
6299 | if (!playlist.isScrolling) {
|
6300 | const el = node;
|
6301 |
|
6302 | if (playlist.isAutomaticScroll) {
|
6303 | const rect = node.getBoundingClientRect();
|
6304 | const controlWidth = playlist.controls.show
|
6305 | ? playlist.controls.width
|
6306 | : 0;
|
6307 | const width = pixelsToSeconds(
|
6308 | rect.width - controlWidth,
|
6309 | playlist.samplesPerPixel,
|
6310 | playlist.sampleRate
|
6311 | );
|
6312 |
|
6313 | const timePoint = playlist.isPlaying()
|
6314 | ? playlist.playbackSeconds
|
6315 | : playlist.getTimeSelection().start;
|
6316 |
|
6317 | if (
|
6318 | timePoint < playlist.scrollLeft ||
|
6319 | timePoint >= playlist.scrollLeft + width
|
6320 | ) {
|
6321 | playlist.scrollLeft = Math.min(timePoint, playlist.duration - width);
|
6322 | }
|
6323 | }
|
6324 |
|
6325 | const left = secondsToPixels(
|
6326 | playlist.scrollLeft,
|
6327 | playlist.samplesPerPixel,
|
6328 | playlist.sampleRate
|
6329 | );
|
6330 |
|
6331 | el.scrollLeft = left;
|
6332 | }
|
6333 | }
|
6334 | });
|
6335 |
|
6336 | ;
|
6337 |
|
6338 |
|
6339 |
|
6340 | const TimeScaleHook = (class {
|
6341 | constructor(tickInfo, offset, samplesPerPixel, duration, colors) {
|
6342 | this.tickInfo = tickInfo;
|
6343 | this.offset = offset;
|
6344 | this.samplesPerPixel = samplesPerPixel;
|
6345 | this.duration = duration;
|
6346 | this.colors = colors;
|
6347 | }
|
6348 |
|
6349 | hook(canvas, prop, prev) {
|
6350 |
|
6351 | if (
|
6352 | prev !== undefined &&
|
6353 | prev.offset === this.offset &&
|
6354 | prev.duration === this.duration &&
|
6355 | prev.samplesPerPixel === this.samplesPerPixel
|
6356 | ) {
|
6357 | return;
|
6358 | }
|
6359 |
|
6360 | const width = canvas.width;
|
6361 | const height = canvas.height;
|
6362 | const ctx = canvas.getContext("2d");
|
6363 |
|
6364 | ctx.clearRect(0, 0, width, height);
|
6365 | ctx.fillStyle = this.colors.timeColor;
|
6366 |
|
6367 | Object.keys(this.tickInfo).forEach((x) => {
|
6368 | const scaleHeight = this.tickInfo[x];
|
6369 | const scaleY = height - scaleHeight;
|
6370 | ctx.fillRect(x, scaleY, 1, scaleHeight);
|
6371 | });
|
6372 | }
|
6373 | });
|
6374 |
|
6375 | ;
|
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 | class TimeScale {
|
6382 | constructor(
|
6383 | duration,
|
6384 | offset,
|
6385 | samplesPerPixel,
|
6386 | sampleRate,
|
6387 | marginLeft = 0,
|
6388 | colors
|
6389 | ) {
|
6390 | this.duration = duration;
|
6391 | this.offset = offset;
|
6392 | this.samplesPerPixel = samplesPerPixel;
|
6393 | this.sampleRate = sampleRate;
|
6394 | this.marginLeft = marginLeft;
|
6395 | this.colors = colors;
|
6396 |
|
6397 | this.timeinfo = {
|
6398 | 20000: {
|
6399 | marker: 30000,
|
6400 | bigStep: 10000,
|
6401 | smallStep: 5000,
|
6402 | secondStep: 5,
|
6403 | },
|
6404 | 12000: {
|
6405 | marker: 15000,
|
6406 | bigStep: 5000,
|
6407 | smallStep: 1000,
|
6408 | secondStep: 1,
|
6409 | },
|
6410 | 10000: {
|
6411 | marker: 10000,
|
6412 | bigStep: 5000,
|
6413 | smallStep: 1000,
|
6414 | secondStep: 1,
|
6415 | },
|
6416 | 5000: {
|
6417 | marker: 5000,
|
6418 | bigStep: 1000,
|
6419 | smallStep: 500,
|
6420 | secondStep: 1 / 2,
|
6421 | },
|
6422 | 2500: {
|
6423 | marker: 2000,
|
6424 | bigStep: 1000,
|
6425 | smallStep: 500,
|
6426 | secondStep: 1 / 2,
|
6427 | },
|
6428 | 1500: {
|
6429 | marker: 2000,
|
6430 | bigStep: 1000,
|
6431 | smallStep: 200,
|
6432 | secondStep: 1 / 5,
|
6433 | },
|
6434 | 700: {
|
6435 | marker: 1000,
|
6436 | bigStep: 500,
|
6437 | smallStep: 100,
|
6438 | secondStep: 1 / 10,
|
6439 | },
|
6440 | };
|
6441 | }
|
6442 |
|
6443 | getScaleInfo(resolution) {
|
6444 | let keys = Object.keys(this.timeinfo).map((item) => parseInt(item, 10));
|
6445 |
|
6446 |
|
6447 | keys = keys.sort((a, b) => a - b);
|
6448 |
|
6449 | for (let i = 0; i < keys.length; i += 1) {
|
6450 | if (resolution <= keys[i]) {
|
6451 | return this.timeinfo[keys[i]];
|
6452 | }
|
6453 | }
|
6454 |
|
6455 | return this.timeinfo[keys[0]];
|
6456 | }
|
6457 |
|
6458 | |
6459 |
|
6460 |
|
6461 | static formatTime(milliseconds) {
|
6462 | const seconds = milliseconds / 1000;
|
6463 | let s = seconds % 60;
|
6464 | const m = (seconds - s) / 60;
|
6465 |
|
6466 | if (s < 10) {
|
6467 | s = `0${s}`;
|
6468 | }
|
6469 |
|
6470 | return `${m}:${s}`;
|
6471 | }
|
6472 |
|
6473 | render() {
|
6474 | const widthX = secondsToPixels(
|
6475 | this.duration,
|
6476 | this.samplesPerPixel,
|
6477 | this.sampleRate
|
6478 | );
|
6479 | const pixPerSec = this.sampleRate / this.samplesPerPixel;
|
6480 | const pixOffset = secondsToPixels(
|
6481 | this.offset,
|
6482 | this.samplesPerPixel,
|
6483 | this.sampleRate
|
6484 | );
|
6485 | const scaleInfo = this.getScaleInfo(this.samplesPerPixel);
|
6486 | const canvasInfo = {};
|
6487 | const timeMarkers = [];
|
6488 | const end = widthX + pixOffset;
|
6489 | let counter = 0;
|
6490 |
|
6491 | for (let i = 0; i < end; i += pixPerSec * scaleInfo.secondStep) {
|
6492 | const pixIndex = Math.floor(i);
|
6493 | const pix = pixIndex - pixOffset;
|
6494 |
|
6495 | if (pixIndex >= pixOffset) {
|
6496 |
|
6497 | if (scaleInfo.marker && counter % scaleInfo.marker === 0) {
|
6498 | timeMarkers.push(
|
6499 | h_default()(
|
6500 | "div.time",
|
6501 | {
|
6502 | attributes: {
|
6503 | style: `position: absolute; left: ${pix}px;`,
|
6504 | },
|
6505 | },
|
6506 | [TimeScale.formatTime(counter)]
|
6507 | )
|
6508 | );
|
6509 |
|
6510 | canvasInfo[pix] = 10;
|
6511 | } else if (scaleInfo.bigStep && counter % scaleInfo.bigStep === 0) {
|
6512 | canvasInfo[pix] = 5;
|
6513 | } else if (scaleInfo.smallStep && counter % scaleInfo.smallStep === 0) {
|
6514 | canvasInfo[pix] = 2;
|
6515 | }
|
6516 | }
|
6517 |
|
6518 | counter += 1000 * scaleInfo.secondStep;
|
6519 | }
|
6520 |
|
6521 | return h_default()(
|
6522 | "div.playlist-time-scale",
|
6523 | {
|
6524 | attributes: {
|
6525 | style: `position: relative; left: 0; right: 0; margin-left: ${this.marginLeft}px;`,
|
6526 | },
|
6527 | },
|
6528 | [
|
6529 | timeMarkers,
|
6530 | h_default()("canvas", {
|
6531 | attributes: {
|
6532 | width: widthX,
|
6533 | height: 30,
|
6534 | style: "position: absolute; left: 0; right: 0; top: 0; bottom: 0;",
|
6535 | },
|
6536 | hook: new TimeScaleHook(
|
6537 | canvasInfo,
|
6538 | this.offset,
|
6539 | this.samplesPerPixel,
|
6540 | this.duration,
|
6541 | this.colors
|
6542 | ),
|
6543 | }),
|
6544 | ]
|
6545 | );
|
6546 | }
|
6547 | }
|
6548 |
|
6549 | const src_TimeScale = (TimeScale);
|
6550 |
|
6551 |
|
6552 | var lodash_assign = __webpack_require__(1730);
|
6553 | var lodash_assign_default = __webpack_require__.n(lodash_assign);
|
6554 |
|
6555 | var lodash_forown = __webpack_require__(3520);
|
6556 | var lodash_forown_default = __webpack_require__.n(lodash_forown);
|
6557 | ;
|
6558 |
|
6559 |
|
6560 |
|
6561 | var getRandomValues;
|
6562 | var rnds8 = new Uint8Array(16);
|
6563 | function rng() {
|
6564 |
|
6565 | if (!getRandomValues) {
|
6566 |
|
6567 |
|
6568 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
6569 |
|
6570 | if (!getRandomValues) {
|
6571 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
6572 | }
|
6573 | }
|
6574 |
|
6575 | return getRandomValues(rnds8);
|
6576 | }
|
6577 | ;
|
6578 | const 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);
|
6579 | ;
|
6580 |
|
6581 |
|
6582 | function validate(uuid) {
|
6583 | return typeof uuid === 'string' && regex.test(uuid);
|
6584 | }
|
6585 |
|
6586 | const esm_browser_validate = (validate);
|
6587 | ;
|
6588 |
|
6589 |
|
6590 |
|
6591 |
|
6592 |
|
6593 |
|
6594 | var byteToHex = [];
|
6595 |
|
6596 | for (var i = 0; i < 256; ++i) {
|
6597 | byteToHex.push((i + 0x100).toString(16).substr(1));
|
6598 | }
|
6599 |
|
6600 | function stringify(arr) {
|
6601 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
6602 |
|
6603 |
|
6604 | 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();
|
6605 |
|
6606 |
|
6607 |
|
6608 |
|
6609 |
|
6610 | if (!esm_browser_validate(uuid)) {
|
6611 | throw TypeError('Stringified UUID is invalid');
|
6612 | }
|
6613 |
|
6614 | return uuid;
|
6615 | }
|
6616 |
|
6617 | const esm_browser_stringify = (stringify);
|
6618 | ;
|
6619 |
|
6620 |
|
6621 |
|
6622 | function v4(options, buf, offset) {
|
6623 | options = options || {};
|
6624 | var rnds = options.random || (options.rng || rng)();
|
6625 |
|
6626 | rnds[6] = rnds[6] & 0x0f | 0x40;
|
6627 | rnds[8] = rnds[8] & 0x3f | 0x80;
|
6628 |
|
6629 | if (buf) {
|
6630 | offset = offset || 0;
|
6631 |
|
6632 | for (var i = 0; i < 16; ++i) {
|
6633 | buf[offset + i] = rnds[i];
|
6634 | }
|
6635 |
|
6636 | return buf;
|
6637 | }
|
6638 |
|
6639 | return esm_browser_stringify(rnds);
|
6640 | }
|
6641 |
|
6642 | const esm_browser_v4 = (v4);
|
6643 |
|
6644 | var webaudio_peaks = __webpack_require__(4991);
|
6645 | var webaudio_peaks_default = __webpack_require__.n(webaudio_peaks);
|
6646 |
|
6647 | var fade_maker = __webpack_require__(1114);
|
6648 | ;
|
6649 |
|
6650 |
|
6651 | const CursorState = (class {
|
6652 | constructor(track) {
|
6653 | this.track = track;
|
6654 | }
|
6655 |
|
6656 | setup(samplesPerPixel, sampleRate) {
|
6657 | this.samplesPerPixel = samplesPerPixel;
|
6658 | this.sampleRate = sampleRate;
|
6659 | }
|
6660 |
|
6661 | click(e) {
|
6662 | e.preventDefault();
|
6663 |
|
6664 | const startX = e.offsetX;
|
6665 | const startTime = pixelsToSeconds(
|
6666 | startX,
|
6667 | this.samplesPerPixel,
|
6668 | this.sampleRate
|
6669 | );
|
6670 |
|
6671 | this.track.ee.emit("select", startTime, startTime, this.track);
|
6672 | }
|
6673 |
|
6674 | static getClass() {
|
6675 | return ".state-cursor";
|
6676 | }
|
6677 |
|
6678 | static getEvents() {
|
6679 | return ["click"];
|
6680 | }
|
6681 | });
|
6682 |
|
6683 | ;
|
6684 |
|
6685 |
|
6686 | const SelectState = (class {
|
6687 | constructor(track) {
|
6688 | this.track = track;
|
6689 | this.active = false;
|
6690 | }
|
6691 |
|
6692 | setup(samplesPerPixel, sampleRate) {
|
6693 | this.samplesPerPixel = samplesPerPixel;
|
6694 | this.sampleRate = sampleRate;
|
6695 | }
|
6696 |
|
6697 | emitSelection(x) {
|
6698 | const minX = Math.min(x, this.startX);
|
6699 | const maxX = Math.max(x, this.startX);
|
6700 | const startTime = pixelsToSeconds(
|
6701 | minX,
|
6702 | this.samplesPerPixel,
|
6703 | this.sampleRate
|
6704 | );
|
6705 | const endTime = pixelsToSeconds(
|
6706 | maxX,
|
6707 | this.samplesPerPixel,
|
6708 | this.sampleRate
|
6709 | );
|
6710 |
|
6711 | this.track.ee.emit("select", startTime, endTime, this.track);
|
6712 | }
|
6713 |
|
6714 | complete(x) {
|
6715 | this.emitSelection(x);
|
6716 | this.active = false;
|
6717 | }
|
6718 |
|
6719 | mousedown(e) {
|
6720 | e.preventDefault();
|
6721 | this.active = true;
|
6722 |
|
6723 | this.startX = e.offsetX;
|
6724 | const startTime = pixelsToSeconds(
|
6725 | this.startX,
|
6726 | this.samplesPerPixel,
|
6727 | this.sampleRate
|
6728 | );
|
6729 |
|
6730 | this.track.ee.emit("select", startTime, startTime, this.track);
|
6731 | }
|
6732 |
|
6733 | mousemove(e) {
|
6734 | if (this.active) {
|
6735 | e.preventDefault();
|
6736 | this.emitSelection(e.offsetX);
|
6737 | }
|
6738 | }
|
6739 |
|
6740 | mouseup(e) {
|
6741 | if (this.active) {
|
6742 | e.preventDefault();
|
6743 | this.complete(e.offsetX);
|
6744 | }
|
6745 | }
|
6746 |
|
6747 | mouseleave(e) {
|
6748 | if (this.active) {
|
6749 | e.preventDefault();
|
6750 | this.complete(e.offsetX);
|
6751 | }
|
6752 | }
|
6753 |
|
6754 | static getClass() {
|
6755 | return ".state-select";
|
6756 | }
|
6757 |
|
6758 | static getEvents() {
|
6759 | return ["mousedown", "mousemove", "mouseup", "mouseleave"];
|
6760 | }
|
6761 | });
|
6762 |
|
6763 | ;
|
6764 |
|
6765 |
|
6766 | const ShiftState = (class {
|
6767 | constructor(track) {
|
6768 | this.track = track;
|
6769 | this.active = false;
|
6770 | }
|
6771 |
|
6772 | setup(samplesPerPixel, sampleRate) {
|
6773 | this.samplesPerPixel = samplesPerPixel;
|
6774 | this.sampleRate = sampleRate;
|
6775 | }
|
6776 |
|
6777 | emitShift(x) {
|
6778 | const deltaX = x - this.prevX;
|
6779 | const deltaTime = pixelsToSeconds(
|
6780 | deltaX,
|
6781 | this.samplesPerPixel,
|
6782 | this.sampleRate
|
6783 | );
|
6784 | this.prevX = x;
|
6785 | this.track.ee.emit("shift", deltaTime, this.track);
|
6786 | }
|
6787 |
|
6788 | complete(x) {
|
6789 | this.emitShift(x);
|
6790 | this.active = false;
|
6791 | }
|
6792 |
|
6793 | mousedown(e) {
|
6794 | e.preventDefault();
|
6795 |
|
6796 | this.active = true;
|
6797 | this.el = e.target;
|
6798 | this.prevX = e.offsetX;
|
6799 | }
|
6800 |
|
6801 | mousemove(e) {
|
6802 | if (this.active) {
|
6803 | e.preventDefault();
|
6804 | this.emitShift(e.offsetX);
|
6805 | }
|
6806 | }
|
6807 |
|
6808 | mouseup(e) {
|
6809 | if (this.active) {
|
6810 | e.preventDefault();
|
6811 | this.complete(e.offsetX);
|
6812 | }
|
6813 | }
|
6814 |
|
6815 | mouseleave(e) {
|
6816 | if (this.active) {
|
6817 | e.preventDefault();
|
6818 | this.complete(e.offsetX);
|
6819 | }
|
6820 | }
|
6821 |
|
6822 | static getClass() {
|
6823 | return ".state-shift";
|
6824 | }
|
6825 |
|
6826 | static getEvents() {
|
6827 | return ["mousedown", "mousemove", "mouseup", "mouseleave"];
|
6828 | }
|
6829 | });
|
6830 |
|
6831 | ;
|
6832 |
|
6833 |
|
6834 | const FadeInState = (class {
|
6835 | constructor(track) {
|
6836 | this.track = track;
|
6837 | }
|
6838 |
|
6839 | setup(samplesPerPixel, sampleRate) {
|
6840 | this.samplesPerPixel = samplesPerPixel;
|
6841 | this.sampleRate = sampleRate;
|
6842 | }
|
6843 |
|
6844 | click(e) {
|
6845 | const startX = e.offsetX;
|
6846 | const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);
|
6847 |
|
6848 | if (time > this.track.getStartTime() && time < this.track.getEndTime()) {
|
6849 | this.track.ee.emit(
|
6850 | "fadein",
|
6851 | time - this.track.getStartTime(),
|
6852 | this.track
|
6853 | );
|
6854 | }
|
6855 | }
|
6856 |
|
6857 | static getClass() {
|
6858 | return ".state-fadein";
|
6859 | }
|
6860 |
|
6861 | static getEvents() {
|
6862 | return ["click"];
|
6863 | }
|
6864 | });
|
6865 |
|
6866 | ;
|
6867 |
|
6868 |
|
6869 | const FadeOutState = (class {
|
6870 | constructor(track) {
|
6871 | this.track = track;
|
6872 | }
|
6873 |
|
6874 | setup(samplesPerPixel, sampleRate) {
|
6875 | this.samplesPerPixel = samplesPerPixel;
|
6876 | this.sampleRate = sampleRate;
|
6877 | }
|
6878 |
|
6879 | click(e) {
|
6880 | const startX = e.offsetX;
|
6881 | const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);
|
6882 |
|
6883 | if (time > this.track.getStartTime() && time < this.track.getEndTime()) {
|
6884 | this.track.ee.emit("fadeout", this.track.getEndTime() - time, this.track);
|
6885 | }
|
6886 | }
|
6887 |
|
6888 | static getClass() {
|
6889 | return ".state-fadeout";
|
6890 | }
|
6891 |
|
6892 | static getEvents() {
|
6893 | return ["click"];
|
6894 | }
|
6895 | });
|
6896 |
|
6897 | ;
|
6898 |
|
6899 |
|
6900 |
|
6901 |
|
6902 |
|
6903 |
|
6904 | const states = ({
|
6905 | cursor: CursorState,
|
6906 | select: SelectState,
|
6907 | shift: ShiftState,
|
6908 | fadein: FadeInState,
|
6909 | fadeout: FadeOutState,
|
6910 | });
|
6911 |
|
6912 | ;
|
6913 |
|
6914 |
|
6915 |
|
6916 | class CanvasHook {
|
6917 | constructor(peaks, offset, bits, color, scale, height, barWidth, barGap) {
|
6918 | this.peaks = peaks;
|
6919 |
|
6920 | this.offset = offset;
|
6921 | this.color = color;
|
6922 | this.bits = bits;
|
6923 | this.scale = scale;
|
6924 | this.height = height;
|
6925 | this.barWidth = barWidth;
|
6926 | this.barGap = barGap;
|
6927 | }
|
6928 |
|
6929 | static drawFrame(cc, h2, x, minPeak, maxPeak, width, gap) {
|
6930 | const min = Math.abs(minPeak * h2);
|
6931 | const max = Math.abs(maxPeak * h2);
|
6932 |
|
6933 |
|
6934 | cc.fillRect(x, 0, width, h2 - max);
|
6935 |
|
6936 | cc.fillRect(x, h2 + min, width, h2 - min);
|
6937 |
|
6938 | if (gap !== 0) {
|
6939 | cc.fillRect(x + width, 0, gap, h2 * 2);
|
6940 | }
|
6941 | }
|
6942 |
|
6943 | hook(canvas, prop, prev) {
|
6944 |
|
6945 | if (
|
6946 | prev !== undefined &&
|
6947 | prev.peaks === this.peaks &&
|
6948 | prev.scale === this.scale &&
|
6949 | prev.height === this.height
|
6950 | ) {
|
6951 | return;
|
6952 | }
|
6953 |
|
6954 | const scale = this.scale;
|
6955 | const len = canvas.width / scale;
|
6956 | const cc = canvas.getContext("2d");
|
6957 | const h2 = canvas.height / scale / 2;
|
6958 | const maxValue = 2 ** (this.bits - 1);
|
6959 | const width = this.barWidth;
|
6960 | const gap = this.barGap;
|
6961 | const barStart = width + gap;
|
6962 |
|
6963 | cc.clearRect(0, 0, canvas.width, canvas.height);
|
6964 |
|
6965 | cc.save();
|
6966 | cc.fillStyle = this.color;
|
6967 | cc.scale(scale, scale);
|
6968 |
|
6969 | for (let pixel = 0; pixel < len; pixel += barStart) {
|
6970 | const minPeak = this.peaks[(pixel + this.offset) * 2] / maxValue;
|
6971 | const maxPeak = this.peaks[(pixel + this.offset) * 2 + 1] / maxValue;
|
6972 | CanvasHook.drawFrame(cc, h2, pixel, minPeak, maxPeak, width, gap);
|
6973 | }
|
6974 |
|
6975 | cc.restore();
|
6976 | }
|
6977 | }
|
6978 |
|
6979 | const render_CanvasHook = (CanvasHook);
|
6980 |
|
6981 |
|
6982 | var fade_curves = __webpack_require__(6226);
|
6983 | ;
|
6984 |
|
6985 |
|
6986 |
|
6987 |
|
6988 |
|
6989 |
|
6990 | class FadeCanvasHook {
|
6991 | constructor(type, shape, duration, samplesPerPixel) {
|
6992 | this.type = type;
|
6993 | this.shape = shape;
|
6994 | this.duration = duration;
|
6995 | this.samplesPerPixel = samplesPerPixel;
|
6996 | }
|
6997 |
|
6998 | static createCurve(shape, type, width) {
|
6999 | let reflection;
|
7000 | let curve;
|
7001 |
|
7002 | switch (type) {
|
7003 | case fade_maker.Y1: {
|
7004 | reflection = 1;
|
7005 | break;
|
7006 | }
|
7007 | case fade_maker.h7: {
|
7008 | reflection = -1;
|
7009 | break;
|
7010 | }
|
7011 | default: {
|
7012 | throw new Error("Unsupported fade type.");
|
7013 | }
|
7014 | }
|
7015 |
|
7016 | switch (shape) {
|
7017 | case fade_maker._h: {
|
7018 | curve = (0,fade_curves.sCurve)(width, reflection);
|
7019 | break;
|
7020 | }
|
7021 | case fade_maker.t$: {
|
7022 | curve = (0,fade_curves.linear)(width, reflection);
|
7023 | break;
|
7024 | }
|
7025 | case fade_maker.Jl: {
|
7026 | curve = (0,fade_curves.exponential)(width, reflection);
|
7027 | break;
|
7028 | }
|
7029 | case fade_maker.Hp: {
|
7030 | curve = (0,fade_curves.logarithmic)(width, 10, reflection);
|
7031 | break;
|
7032 | }
|
7033 | default: {
|
7034 | throw new Error("Unsupported fade shape");
|
7035 | }
|
7036 | }
|
7037 |
|
7038 | return curve;
|
7039 | }
|
7040 |
|
7041 | hook(canvas, prop, prev) {
|
7042 |
|
7043 | if (
|
7044 | prev !== undefined &&
|
7045 | prev.shape === this.shape &&
|
7046 | prev.type === this.type &&
|
7047 | prev.duration === this.duration &&
|
7048 | prev.samplesPerPixel === this.samplesPerPixel
|
7049 | ) {
|
7050 | return;
|
7051 | }
|
7052 |
|
7053 | const ctx = canvas.getContext("2d");
|
7054 | const width = canvas.width;
|
7055 | const height = canvas.height;
|
7056 | const curve = FadeCanvasHook.createCurve(this.shape, this.type, width);
|
7057 | const len = curve.length;
|
7058 | let y = height - curve[0] * height;
|
7059 |
|
7060 | ctx.clearRect(0, 0, canvas.width, canvas.height);
|
7061 | ctx.save();
|
7062 |
|
7063 | ctx.strokeStyle = "black";
|
7064 | ctx.beginPath();
|
7065 | ctx.moveTo(0, y);
|
7066 |
|
7067 | for (let i = 1; i < len; i += 1) {
|
7068 | y = height - curve[i] * height;
|
7069 | ctx.lineTo(i, y);
|
7070 | }
|
7071 | ctx.stroke();
|
7072 | ctx.restore();
|
7073 | }
|
7074 | }
|
7075 |
|
7076 | const render_FadeCanvasHook = (FadeCanvasHook);
|
7077 |
|
7078 | ;
|
7079 |
|
7080 |
|
7081 |
|
7082 |
|
7083 | const VolumeSliderHook = (class {
|
7084 | constructor(gain) {
|
7085 | this.gain = gain;
|
7086 | }
|
7087 |
|
7088 | hook(volumeInput) {
|
7089 | volumeInput.value = this.gain * 100;
|
7090 | volumeInput.title = `${Math.round(this.gain * 100)}% volume`;
|
7091 | }
|
7092 | });
|
7093 |
|
7094 | ;
|
7095 |
|
7096 |
|
7097 |
|
7098 |
|
7099 | const StereoPanSliderHook = (class {
|
7100 | constructor(stereoPan) {
|
7101 | this.stereoPan = stereoPan;
|
7102 | }
|
7103 |
|
7104 | hook(stereoPanInput) {
|
7105 | stereoPanInput.value = this.stereoPan * 100;
|
7106 |
|
7107 | let panOrientation;
|
7108 | if (this.stereoPan === 0) {
|
7109 | panOrientation = "Center";
|
7110 | } else if (this.stereoPan < 0) {
|
7111 | panOrientation = "Left";
|
7112 | } else {
|
7113 | panOrientation = "Right";
|
7114 | }
|
7115 | const percentage = `${Math.abs(Math.round(this.stereoPan * 100))}% `;
|
7116 | stereoPanInput.title = `Pan: ${
|
7117 | this.stereoPan !== 0 ? percentage : ""
|
7118 | }${panOrientation}`;
|
7119 | }
|
7120 | });
|
7121 |
|
7122 | ;
|
7123 |
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 | const MAX_CANVAS_WIDTH = 1000;
|
7141 |
|
7142 | const Track = (class {
|
7143 | constructor() {
|
7144 | this.name = "Untitled";
|
7145 | this.customClass = undefined;
|
7146 | this.waveOutlineColor = undefined;
|
7147 | this.gain = 1;
|
7148 | this.fades = {};
|
7149 | this.peakData = {
|
7150 | type: "WebAudio",
|
7151 | mono: false,
|
7152 | };
|
7153 |
|
7154 | this.cueIn = 0;
|
7155 | this.cueOut = 0;
|
7156 | this.duration = 0;
|
7157 | this.startTime = 0;
|
7158 | this.endTime = 0;
|
7159 | this.stereoPan = 0;
|
7160 | }
|
7161 |
|
7162 | setEventEmitter(ee) {
|
7163 | this.ee = ee;
|
7164 | }
|
7165 |
|
7166 | setName(name) {
|
7167 | this.name = name;
|
7168 | }
|
7169 |
|
7170 | setCustomClass(className) {
|
7171 | this.customClass = className;
|
7172 | }
|
7173 |
|
7174 | setWaveOutlineColor(color) {
|
7175 | this.waveOutlineColor = color;
|
7176 | }
|
7177 |
|
7178 | setCues(cueIn, cueOut) {
|
7179 | if (cueOut < cueIn) {
|
7180 | throw new Error("cue out cannot be less than cue in");
|
7181 | }
|
7182 |
|
7183 | this.cueIn = cueIn;
|
7184 | this.cueOut = cueOut;
|
7185 | this.duration = this.cueOut - this.cueIn;
|
7186 | this.endTime = this.startTime + this.duration;
|
7187 | }
|
7188 |
|
7189 | |
7190 |
|
7191 |
|
7192 | trim(start, end) {
|
7193 | const trackStart = this.getStartTime();
|
7194 | const trackEnd = this.getEndTime();
|
7195 | const offset = this.cueIn - trackStart;
|
7196 |
|
7197 | if (
|
7198 | (trackStart <= start && trackEnd >= start) ||
|
7199 | (trackStart <= end && trackEnd >= end)
|
7200 | ) {
|
7201 | const cueIn = start < trackStart ? trackStart : start;
|
7202 | const cueOut = end > trackEnd ? trackEnd : end;
|
7203 |
|
7204 | this.setCues(cueIn + offset, cueOut + offset);
|
7205 | if (start > trackStart) {
|
7206 | this.setStartTime(start);
|
7207 | }
|
7208 | }
|
7209 | }
|
7210 |
|
7211 | setStartTime(start) {
|
7212 | this.startTime = start;
|
7213 | this.endTime = start + this.duration;
|
7214 | }
|
7215 |
|
7216 | setPlayout(playout) {
|
7217 | this.playout = playout;
|
7218 | }
|
7219 |
|
7220 | setOfflinePlayout(playout) {
|
7221 | this.offlinePlayout = playout;
|
7222 | }
|
7223 |
|
7224 | setEnabledStates(enabledStates = {}) {
|
7225 | const defaultStatesEnabled = {
|
7226 | cursor: true,
|
7227 | fadein: true,
|
7228 | fadeout: true,
|
7229 | select: true,
|
7230 | shift: true,
|
7231 | };
|
7232 |
|
7233 | this.enabledStates = lodash_assign_default()({}, defaultStatesEnabled, enabledStates);
|
7234 | }
|
7235 |
|
7236 | setFadeIn(duration, shape = "logarithmic") {
|
7237 | if (duration > this.duration) {
|
7238 | throw new Error("Invalid Fade In");
|
7239 | }
|
7240 |
|
7241 | const fade = {
|
7242 | shape,
|
7243 | start: 0,
|
7244 | end: duration,
|
7245 | };
|
7246 |
|
7247 | if (this.fadeIn) {
|
7248 | this.removeFade(this.fadeIn);
|
7249 | this.fadeIn = undefined;
|
7250 | }
|
7251 |
|
7252 | this.fadeIn = this.saveFade(fade_maker.Y1, fade.shape, fade.start, fade.end);
|
7253 | }
|
7254 |
|
7255 | setFadeOut(duration, shape = "logarithmic") {
|
7256 | if (duration > this.duration) {
|
7257 | throw new Error("Invalid Fade Out");
|
7258 | }
|
7259 |
|
7260 | const fade = {
|
7261 | shape,
|
7262 | start: this.duration - duration,
|
7263 | end: this.duration,
|
7264 | };
|
7265 |
|
7266 | if (this.fadeOut) {
|
7267 | this.removeFade(this.fadeOut);
|
7268 | this.fadeOut = undefined;
|
7269 | }
|
7270 |
|
7271 | this.fadeOut = this.saveFade(fade_maker.h7, fade.shape, fade.start, fade.end);
|
7272 | }
|
7273 |
|
7274 | saveFade(type, shape, start, end) {
|
7275 | const id = esm_browser_v4();
|
7276 |
|
7277 | this.fades[id] = {
|
7278 | type,
|
7279 | shape,
|
7280 | start,
|
7281 | end,
|
7282 | };
|
7283 |
|
7284 | return id;
|
7285 | }
|
7286 |
|
7287 | removeFade(id) {
|
7288 | delete this.fades[id];
|
7289 | }
|
7290 |
|
7291 | setBuffer(buffer) {
|
7292 | this.buffer = buffer;
|
7293 | }
|
7294 |
|
7295 | setPeakData(data) {
|
7296 | this.peakData = data;
|
7297 | }
|
7298 |
|
7299 | calculatePeaks(samplesPerPixel, sampleRate) {
|
7300 | const cueIn = secondsToSamples(this.cueIn, sampleRate);
|
7301 | const cueOut = secondsToSamples(this.cueOut, sampleRate);
|
7302 |
|
7303 | this.setPeaks(
|
7304 | webaudio_peaks_default()(
|
7305 | this.buffer,
|
7306 | samplesPerPixel,
|
7307 | this.peakData.mono,
|
7308 | cueIn,
|
7309 | cueOut
|
7310 | )
|
7311 | );
|
7312 | }
|
7313 |
|
7314 | setPeaks(peaks) {
|
7315 | this.peaks = peaks;
|
7316 | }
|
7317 |
|
7318 | setState(state) {
|
7319 | this.state = state;
|
7320 |
|
7321 | if (this.state && this.enabledStates[this.state]) {
|
7322 | const StateClass = states[this.state];
|
7323 | this.stateObj = new StateClass(this);
|
7324 | } else {
|
7325 | this.stateObj = undefined;
|
7326 | }
|
7327 | }
|
7328 |
|
7329 | getStartTime() {
|
7330 | return this.startTime;
|
7331 | }
|
7332 |
|
7333 | getEndTime() {
|
7334 | return this.endTime;
|
7335 | }
|
7336 |
|
7337 | getDuration() {
|
7338 | return this.duration;
|
7339 | }
|
7340 |
|
7341 | isPlaying() {
|
7342 | return this.playout.isPlaying();
|
7343 | }
|
7344 |
|
7345 | setShouldPlay(bool) {
|
7346 | this.playout.setShouldPlay(bool);
|
7347 | }
|
7348 |
|
7349 | setGainLevel(level) {
|
7350 | this.gain = level;
|
7351 | this.playout.setVolumeGainLevel(level);
|
7352 | }
|
7353 |
|
7354 | setMasterGainLevel(level) {
|
7355 | this.playout.setMasterGainLevel(level);
|
7356 | }
|
7357 |
|
7358 | setStereoPanValue(value) {
|
7359 | this.stereoPan = value;
|
7360 | this.playout.setStereoPanValue(value);
|
7361 | }
|
7362 |
|
7363 | |
7364 |
|
7365 |
|
7366 |
|
7367 |
|
7368 |
|
7369 |
|
7370 | schedulePlay(now, startTime, endTime, config) {
|
7371 | let start;
|
7372 | let duration;
|
7373 | let when = now;
|
7374 | let segment = endTime ? endTime - startTime : undefined;
|
7375 |
|
7376 | const defaultOptions = {
|
7377 | shouldPlay: true,
|
7378 | masterGain: 1,
|
7379 | isOffline: false,
|
7380 | };
|
7381 |
|
7382 | const options = lodash_assign_default()({}, defaultOptions, config);
|
7383 | const playoutSystem = options.isOffline
|
7384 | ? this.offlinePlayout
|
7385 | : this.playout;
|
7386 |
|
7387 |
|
7388 |
|
7389 | if (
|
7390 | this.endTime <= startTime ||
|
7391 | (segment && startTime + segment < this.startTime)
|
7392 | ) {
|
7393 |
|
7394 | return Promise.resolve();
|
7395 | }
|
7396 |
|
7397 |
|
7398 |
|
7399 |
|
7400 | if (this.startTime >= startTime) {
|
7401 | start = 0;
|
7402 |
|
7403 | when += this.startTime - startTime;
|
7404 |
|
7405 | if (endTime) {
|
7406 | segment -= this.startTime - startTime;
|
7407 | duration = Math.min(segment, this.duration);
|
7408 | } else {
|
7409 | duration = this.duration;
|
7410 | }
|
7411 | } else {
|
7412 | start = startTime - this.startTime;
|
7413 |
|
7414 | if (endTime) {
|
7415 | duration = Math.min(segment, this.duration - start);
|
7416 | } else {
|
7417 | duration = this.duration - start;
|
7418 | }
|
7419 | }
|
7420 |
|
7421 | start += this.cueIn;
|
7422 | const relPos = startTime - this.startTime;
|
7423 | const sourcePromise = playoutSystem.setUpSource();
|
7424 |
|
7425 |
|
7426 |
|
7427 | lodash_forown_default()(this.fades, (fade) => {
|
7428 | let fadeStart;
|
7429 | let fadeDuration;
|
7430 |
|
7431 |
|
7432 | if (relPos < fade.end) {
|
7433 | if (relPos <= fade.start) {
|
7434 | fadeStart = now + (fade.start - relPos);
|
7435 | fadeDuration = fade.end - fade.start;
|
7436 | } else if (relPos > fade.start && relPos < fade.end) {
|
7437 | fadeStart = now - (relPos - fade.start);
|
7438 | fadeDuration = fade.end - fade.start;
|
7439 | }
|
7440 |
|
7441 | switch (fade.type) {
|
7442 | case fade_maker.Y1: {
|
7443 | playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape);
|
7444 | break;
|
7445 | }
|
7446 | case fade_maker.h7: {
|
7447 | playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape);
|
7448 | break;
|
7449 | }
|
7450 | default: {
|
7451 | throw new Error("Invalid fade type saved on track.");
|
7452 | }
|
7453 | }
|
7454 | }
|
7455 | });
|
7456 |
|
7457 | playoutSystem.setVolumeGainLevel(this.gain);
|
7458 | playoutSystem.setShouldPlay(options.shouldPlay);
|
7459 | playoutSystem.setMasterGainLevel(options.masterGain);
|
7460 | playoutSystem.setStereoPanValue(this.stereoPan);
|
7461 | playoutSystem.play(when, start, duration);
|
7462 |
|
7463 | return sourcePromise;
|
7464 | }
|
7465 |
|
7466 | scheduleStop(when = 0) {
|
7467 | this.playout.stop(when);
|
7468 | }
|
7469 |
|
7470 | renderOverlay(data) {
|
7471 | const channelPixels = secondsToPixels(
|
7472 | data.playlistLength,
|
7473 | data.resolution,
|
7474 | data.sampleRate
|
7475 | );
|
7476 |
|
7477 | const config = {
|
7478 | attributes: {
|
7479 | style: `position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ${channelPixels}px; z-index: 9;`,
|
7480 | },
|
7481 | };
|
7482 |
|
7483 | let overlayClass = "";
|
7484 |
|
7485 | if (this.stateObj) {
|
7486 | this.stateObj.setup(data.resolution, data.sampleRate);
|
7487 | const StateClass = states[this.state];
|
7488 | const events = StateClass.getEvents();
|
7489 |
|
7490 | events.forEach((event) => {
|
7491 | config[`on${event}`] = this.stateObj[event].bind(this.stateObj);
|
7492 | });
|
7493 |
|
7494 | overlayClass = StateClass.getClass();
|
7495 | }
|
7496 |
|
7497 | return h_default()(`div.playlist-overlay${overlayClass}`, config);
|
7498 | }
|
7499 |
|
7500 | renderControls(data) {
|
7501 | const muteClass = data.muted ? ".active" : "";
|
7502 | const soloClass = data.soloed ? ".active" : "";
|
7503 | const isCollapsed = data.collapsed;
|
7504 | const numChan = this.peaks.data.length;
|
7505 | const widgets = data.controls.widgets;
|
7506 |
|
7507 | const removeTrack = h_default()(
|
7508 | "button.btn.btn-danger.btn-xs.track-remove",
|
7509 | {
|
7510 | attributes: {
|
7511 | type: "button",
|
7512 | title: "Remove track",
|
7513 | },
|
7514 | onclick: () => {
|
7515 | this.ee.emit("removeTrack", this);
|
7516 | },
|
7517 | },
|
7518 | [h_default()("i.fas.fa-times")]
|
7519 | );
|
7520 |
|
7521 | const trackName = h_default()("span", [this.name]);
|
7522 |
|
7523 | const collapseTrack = h_default()(
|
7524 | "button.btn.btn-info.btn-xs.track-collapse",
|
7525 | {
|
7526 | attributes: {
|
7527 | type: "button",
|
7528 | title: isCollapsed ? "Expand track" : "Collapse track",
|
7529 | },
|
7530 | onclick: () => {
|
7531 | this.ee.emit("changeTrackView", this, {
|
7532 | collapsed: !isCollapsed,
|
7533 | });
|
7534 | },
|
7535 | },
|
7536 | [h_default()(`i.fas.${isCollapsed ? "fa-caret-down" : "fa-caret-up"}`)]
|
7537 | );
|
7538 |
|
7539 | const headerChildren = [];
|
7540 |
|
7541 | if (widgets.remove) {
|
7542 | headerChildren.push(removeTrack);
|
7543 | }
|
7544 | headerChildren.push(trackName);
|
7545 | if (widgets.collapse) {
|
7546 | headerChildren.push(collapseTrack);
|
7547 | }
|
7548 |
|
7549 | const controls = [h_default()("div.track-header", headerChildren)];
|
7550 |
|
7551 | if (!isCollapsed) {
|
7552 | if (widgets.muteOrSolo) {
|
7553 | controls.push(
|
7554 | h_default()("div.btn-group", [
|
7555 | h_default()(
|
7556 | `button.btn.btn-outline-dark.btn-xs.btn-mute${muteClass}`,
|
7557 | {
|
7558 | attributes: {
|
7559 | type: "button",
|
7560 | },
|
7561 | onclick: () => {
|
7562 | this.ee.emit("mute", this);
|
7563 | },
|
7564 | },
|
7565 | ["Mute"]
|
7566 | ),
|
7567 | h_default()(
|
7568 | `button.btn.btn-outline-dark.btn-xs.btn-solo${soloClass}`,
|
7569 | {
|
7570 | onclick: () => {
|
7571 | this.ee.emit("solo", this);
|
7572 | },
|
7573 | },
|
7574 | ["Solo"]
|
7575 | ),
|
7576 | ])
|
7577 | );
|
7578 | }
|
7579 |
|
7580 | if (widgets.volume) {
|
7581 | controls.push(
|
7582 | h_default()("label.volume", [
|
7583 | h_default()("input.volume-slider", {
|
7584 | attributes: {
|
7585 | "aria-label": "Track volume control",
|
7586 | type: "range",
|
7587 | min: 0,
|
7588 | max: 100,
|
7589 | value: 100,
|
7590 | },
|
7591 | hook: new VolumeSliderHook(this.gain),
|
7592 | oninput: (e) => {
|
7593 | this.ee.emit("volumechange", e.target.value, this);
|
7594 | },
|
7595 | }),
|
7596 | ])
|
7597 | );
|
7598 | }
|
7599 |
|
7600 | if (widgets.stereoPan) {
|
7601 | controls.push(
|
7602 | h_default()("label.stereopan", [
|
7603 | h_default()("input.stereopan-slider", {
|
7604 | attributes: {
|
7605 | "aria-label": "Track stereo pan control",
|
7606 | type: "range",
|
7607 | min: -100,
|
7608 | max: 100,
|
7609 | value: 100,
|
7610 | },
|
7611 | hook: new StereoPanSliderHook(this.stereoPan),
|
7612 | oninput: (e) => {
|
7613 | this.ee.emit("stereopan", e.target.value / 100, this);
|
7614 | },
|
7615 | }),
|
7616 | ])
|
7617 | );
|
7618 | }
|
7619 | }
|
7620 |
|
7621 | return h_default()(
|
7622 | "div.controls",
|
7623 | {
|
7624 | attributes: {
|
7625 | style: `height: ${numChan * data.height}px; width: ${
|
7626 | data.controls.width
|
7627 | }px; position: absolute; left: 0; z-index: 10;`,
|
7628 | },
|
7629 | },
|
7630 | controls
|
7631 | );
|
7632 | }
|
7633 |
|
7634 | render(data) {
|
7635 | const width = this.peaks.length;
|
7636 | const playbackX = secondsToPixels(
|
7637 | data.playbackSeconds,
|
7638 | data.resolution,
|
7639 | data.sampleRate
|
7640 | );
|
7641 | const startX = secondsToPixels(
|
7642 | this.startTime,
|
7643 | data.resolution,
|
7644 | data.sampleRate
|
7645 | );
|
7646 | const endX = secondsToPixels(
|
7647 | this.endTime,
|
7648 | data.resolution,
|
7649 | data.sampleRate
|
7650 | );
|
7651 | let progressWidth = 0;
|
7652 | const numChan = this.peaks.data.length;
|
7653 | const scale = Math.floor(window.devicePixelRatio);
|
7654 |
|
7655 | if (playbackX > 0 && playbackX > startX) {
|
7656 | if (playbackX < endX) {
|
7657 | progressWidth = playbackX - startX;
|
7658 | } else {
|
7659 | progressWidth = width;
|
7660 | }
|
7661 | }
|
7662 |
|
7663 | const waveformChildren = [
|
7664 | h_default()("div.cursor", {
|
7665 | attributes: {
|
7666 | style: `position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ${playbackX}px; bottom: 0; z-index: 5;`,
|
7667 | },
|
7668 | }),
|
7669 | ];
|
7670 |
|
7671 | const channels = Object.keys(this.peaks.data).map((channelNum) => {
|
7672 | const channelChildren = [
|
7673 | h_default()("div.channel-progress", {
|
7674 | attributes: {
|
7675 | style: `position: absolute; width: ${progressWidth}px; height: ${data.height}px; z-index: 2;`,
|
7676 | },
|
7677 | }),
|
7678 | ];
|
7679 | let offset = 0;
|
7680 | let totalWidth = width;
|
7681 | const peaks = this.peaks.data[channelNum];
|
7682 |
|
7683 | while (totalWidth > 0) {
|
7684 | const currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH);
|
7685 | const canvasColor = this.waveOutlineColor
|
7686 | ? this.waveOutlineColor
|
7687 | : data.colors.waveOutlineColor;
|
7688 |
|
7689 | channelChildren.push(
|
7690 | h_default()("canvas", {
|
7691 | attributes: {
|
7692 | width: currentWidth * scale,
|
7693 | height: data.height * scale,
|
7694 | style: `float: left; position: relative; margin: 0; padding: 0; z-index: 3; width: ${currentWidth}px; height: ${data.height}px;`,
|
7695 | },
|
7696 | hook: new render_CanvasHook(
|
7697 | peaks,
|
7698 | offset,
|
7699 | this.peaks.bits,
|
7700 | canvasColor,
|
7701 | scale,
|
7702 | data.height,
|
7703 | data.barWidth,
|
7704 | data.barGap
|
7705 | ),
|
7706 | })
|
7707 | );
|
7708 |
|
7709 | totalWidth -= currentWidth;
|
7710 | offset += MAX_CANVAS_WIDTH;
|
7711 | }
|
7712 |
|
7713 |
|
7714 | if (this.fadeIn) {
|
7715 | const fadeIn = this.fades[this.fadeIn];
|
7716 | const fadeWidth = secondsToPixels(
|
7717 | fadeIn.end - fadeIn.start,
|
7718 | data.resolution,
|
7719 | data.sampleRate
|
7720 | );
|
7721 |
|
7722 | channelChildren.push(
|
7723 | h_default()(
|
7724 | "div.wp-fade.wp-fadein",
|
7725 | {
|
7726 | attributes: {
|
7727 | style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; left: 0; z-index: 4;`,
|
7728 | },
|
7729 | },
|
7730 | [
|
7731 | h_default()("canvas", {
|
7732 | attributes: {
|
7733 | width: fadeWidth,
|
7734 | height: data.height,
|
7735 | },
|
7736 | hook: new render_FadeCanvasHook(
|
7737 | fadeIn.type,
|
7738 | fadeIn.shape,
|
7739 | fadeIn.end - fadeIn.start,
|
7740 | data.resolution
|
7741 | ),
|
7742 | }),
|
7743 | ]
|
7744 | )
|
7745 | );
|
7746 | }
|
7747 |
|
7748 | if (this.fadeOut) {
|
7749 | const fadeOut = this.fades[this.fadeOut];
|
7750 | const fadeWidth = secondsToPixels(
|
7751 | fadeOut.end - fadeOut.start,
|
7752 | data.resolution,
|
7753 | data.sampleRate
|
7754 | );
|
7755 |
|
7756 | channelChildren.push(
|
7757 | h_default()(
|
7758 | "div.wp-fade.wp-fadeout",
|
7759 | {
|
7760 | attributes: {
|
7761 | style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; right: 0; z-index: 4;`,
|
7762 | },
|
7763 | },
|
7764 | [
|
7765 | h_default()("canvas", {
|
7766 | attributes: {
|
7767 | width: fadeWidth,
|
7768 | height: data.height,
|
7769 | },
|
7770 | hook: new render_FadeCanvasHook(
|
7771 | fadeOut.type,
|
7772 | fadeOut.shape,
|
7773 | fadeOut.end - fadeOut.start,
|
7774 | data.resolution
|
7775 | ),
|
7776 | }),
|
7777 | ]
|
7778 | )
|
7779 | );
|
7780 | }
|
7781 |
|
7782 | return h_default()(
|
7783 | `div.channel.channel-${channelNum}`,
|
7784 | {
|
7785 | attributes: {
|
7786 | style: `height: ${data.height}px; width: ${width}px; top: ${
|
7787 | channelNum * data.height
|
7788 | }px; left: ${startX}px; position: absolute; margin: 0; padding: 0; z-index: 1;`,
|
7789 | },
|
7790 | },
|
7791 | channelChildren
|
7792 | );
|
7793 | });
|
7794 |
|
7795 | waveformChildren.push(channels);
|
7796 | waveformChildren.push(this.renderOverlay(data));
|
7797 |
|
7798 |
|
7799 | if (data.isActive === true) {
|
7800 | const cStartX = secondsToPixels(
|
7801 | data.timeSelection.start,
|
7802 | data.resolution,
|
7803 | data.sampleRate
|
7804 | );
|
7805 | const cEndX = secondsToPixels(
|
7806 | data.timeSelection.end,
|
7807 | data.resolution,
|
7808 | data.sampleRate
|
7809 | );
|
7810 | const cWidth = cEndX - cStartX + 1;
|
7811 | const cClassName = cWidth > 1 ? ".segment" : ".point";
|
7812 |
|
7813 | waveformChildren.push(
|
7814 | h_default()(`div.selection${cClassName}`, {
|
7815 | attributes: {
|
7816 | style: `position: absolute; width: ${cWidth}px; bottom: 0; top: 0; left: ${cStartX}px; z-index: 4;`,
|
7817 | },
|
7818 | })
|
7819 | );
|
7820 | }
|
7821 |
|
7822 | const waveform = h_default()(
|
7823 | "div.waveform",
|
7824 | {
|
7825 | attributes: {
|
7826 | style: `height: ${numChan * data.height}px; position: relative;`,
|
7827 | },
|
7828 | },
|
7829 | waveformChildren
|
7830 | );
|
7831 |
|
7832 | const channelChildren = [];
|
7833 | let channelMargin = 0;
|
7834 |
|
7835 | if (data.controls.show) {
|
7836 | channelChildren.push(this.renderControls(data));
|
7837 | channelMargin = data.controls.width;
|
7838 | }
|
7839 |
|
7840 | channelChildren.push(waveform);
|
7841 |
|
7842 | const audibleClass = data.shouldPlay ? "" : ".silent";
|
7843 | const customClass =
|
7844 | this.customClass === undefined ? "" : `.${this.customClass}`;
|
7845 |
|
7846 | return h_default()(
|
7847 | `div.channel-wrapper${audibleClass}${customClass}`,
|
7848 | {
|
7849 | attributes: {
|
7850 | style: `margin-left: ${channelMargin}px; height: ${
|
7851 | data.height * numChan
|
7852 | }px;`,
|
7853 | },
|
7854 | },
|
7855 | channelChildren
|
7856 | );
|
7857 | }
|
7858 |
|
7859 | getTrackDetails() {
|
7860 | const info = {
|
7861 | src: this.src,
|
7862 | start: this.startTime,
|
7863 | end: this.endTime,
|
7864 | name: this.name,
|
7865 | customClass: this.customClass,
|
7866 | cuein: this.cueIn,
|
7867 | cueout: this.cueOut,
|
7868 | stereoPan: this.stereoPan,
|
7869 | gain: this.gain,
|
7870 | };
|
7871 |
|
7872 | if (this.fadeIn) {
|
7873 | const fadeIn = this.fades[this.fadeIn];
|
7874 |
|
7875 | info.fadeIn = {
|
7876 | shape: fadeIn.shape,
|
7877 | duration: fadeIn.end - fadeIn.start,
|
7878 | };
|
7879 | }
|
7880 |
|
7881 | if (this.fadeOut) {
|
7882 | const fadeOut = this.fades[this.fadeOut];
|
7883 |
|
7884 | info.fadeOut = {
|
7885 | shape: fadeOut.shape,
|
7886 | duration: fadeOut.end - fadeOut.start,
|
7887 | };
|
7888 | }
|
7889 |
|
7890 | return info;
|
7891 | }
|
7892 | });
|
7893 |
|
7894 | ;
|
7895 |
|
7896 |
|
7897 | const Playout = (class {
|
7898 | constructor(ac, buffer) {
|
7899 | this.ac = ac;
|
7900 | this.gain = 1;
|
7901 | this.buffer = buffer;
|
7902 | this.destination = this.ac.destination;
|
7903 | this.ac.createStereoPanner = ac.createStereoPanner || ac.createPanner;
|
7904 | }
|
7905 |
|
7906 | applyFade(type, start, duration, shape = "logarithmic") {
|
7907 | if (type === fade_maker.Y1) {
|
7908 | (0,fade_maker.L7)(this.fadeGain.gain, shape, start, duration);
|
7909 | } else if (type === fade_maker.h7) {
|
7910 | (0,fade_maker.Mt)(this.fadeGain.gain, shape, start, duration);
|
7911 | } else {
|
7912 | throw new Error("Unsupported fade type");
|
7913 | }
|
7914 | }
|
7915 |
|
7916 | applyFadeIn(start, duration, shape = "logarithmic") {
|
7917 | this.applyFade(fade_maker.Y1, start, duration, shape);
|
7918 | }
|
7919 |
|
7920 | applyFadeOut(start, duration, shape = "logarithmic") {
|
7921 | this.applyFade(fade_maker.h7, start, duration, shape);
|
7922 | }
|
7923 |
|
7924 | isPlaying() {
|
7925 | return this.source !== undefined;
|
7926 | }
|
7927 |
|
7928 | getDuration() {
|
7929 | return this.buffer.duration;
|
7930 | }
|
7931 |
|
7932 | setAudioContext(ac) {
|
7933 | this.ac = ac;
|
7934 | this.ac.createStereoPanner = ac.createStereoPanner || ac.createPanner;
|
7935 | this.destination = this.ac.destination;
|
7936 | }
|
7937 |
|
7938 | setUpSource() {
|
7939 | this.source = this.ac.createBufferSource();
|
7940 | this.source.buffer = this.buffer;
|
7941 |
|
7942 | const sourcePromise = new Promise((resolve) => {
|
7943 |
|
7944 | this.source.onended = () => {
|
7945 | this.source.disconnect();
|
7946 | this.fadeGain.disconnect();
|
7947 | this.volumeGain.disconnect();
|
7948 | this.shouldPlayGain.disconnect();
|
7949 | this.panner.disconnect();
|
7950 | this.masterGain.disconnect();
|
7951 |
|
7952 | this.source = undefined;
|
7953 | this.fadeGain = undefined;
|
7954 | this.volumeGain = undefined;
|
7955 | this.shouldPlayGain = undefined;
|
7956 | this.panner = undefined;
|
7957 | this.masterGain = undefined;
|
7958 |
|
7959 | resolve();
|
7960 | };
|
7961 | });
|
7962 |
|
7963 | this.fadeGain = this.ac.createGain();
|
7964 |
|
7965 | this.volumeGain = this.ac.createGain();
|
7966 |
|
7967 | this.shouldPlayGain = this.ac.createGain();
|
7968 | this.masterGain = this.ac.createGain();
|
7969 |
|
7970 | this.panner = this.ac.createStereoPanner();
|
7971 |
|
7972 | this.source.connect(this.fadeGain);
|
7973 | this.fadeGain.connect(this.volumeGain);
|
7974 | this.volumeGain.connect(this.shouldPlayGain);
|
7975 | this.shouldPlayGain.connect(this.masterGain);
|
7976 | this.masterGain.connect(this.panner);
|
7977 | this.panner.connect(this.destination);
|
7978 |
|
7979 | return sourcePromise;
|
7980 | }
|
7981 |
|
7982 | setVolumeGainLevel(level) {
|
7983 | if (this.volumeGain) {
|
7984 | this.volumeGain.gain.value = level;
|
7985 | }
|
7986 | }
|
7987 |
|
7988 | setShouldPlay(bool) {
|
7989 | if (this.shouldPlayGain) {
|
7990 | this.shouldPlayGain.gain.value = bool ? 1 : 0;
|
7991 | }
|
7992 | }
|
7993 |
|
7994 | setMasterGainLevel(level) {
|
7995 | if (this.masterGain) {
|
7996 | this.masterGain.gain.value = level;
|
7997 | }
|
7998 | }
|
7999 |
|
8000 | setStereoPanValue(value) {
|
8001 | const pan = value === undefined ? 0 : value;
|
8002 |
|
8003 | if (this.panner) {
|
8004 | if (this.panner.pan !== undefined) {
|
8005 | this.panner.pan.value = pan;
|
8006 | } else {
|
8007 | this.panner.panningModel = "equalpower";
|
8008 | this.panner.setPosition(pan, 0, 1 - Math.abs(pan));
|
8009 | }
|
8010 | }
|
8011 | }
|
8012 |
|
8013 | |
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 | play(when, start, duration) {
|
8020 | this.source.start(when, start, duration);
|
8021 | }
|
8022 |
|
8023 | stop(when = 0) {
|
8024 | if (this.source) {
|
8025 | this.source.stop(when);
|
8026 | }
|
8027 | }
|
8028 | });
|
8029 |
|
8030 | ;
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 |
|
8045 | function aeneas(aeneas) {
|
8046 | const annotation = {
|
8047 | id: aeneas.id || esm_browser_v4(),
|
8048 | start: Number(aeneas.begin) || 0,
|
8049 | end: Number(aeneas.end) || 0,
|
8050 | lines: aeneas.lines || [""],
|
8051 | lang: aeneas.language || "en",
|
8052 | };
|
8053 |
|
8054 | return annotation;
|
8055 | }
|
8056 |
|
8057 | ;
|
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 |
|
8069 |
|
8070 | function output_aeneas(annotation) {
|
8071 | return {
|
8072 | begin: String(annotation.start.toFixed(3)),
|
8073 | end: String(annotation.end.toFixed(3)),
|
8074 | id: String(annotation.id),
|
8075 | language: annotation.lang,
|
8076 | lines: annotation.lines,
|
8077 | };
|
8078 | }
|
8079 |
|
8080 | ;
|
8081 |
|
8082 |
|
8083 | const DragInteraction = (class {
|
8084 | constructor(playlist, data = {}) {
|
8085 | this.playlist = playlist;
|
8086 | this.data = data;
|
8087 | this.active = false;
|
8088 |
|
8089 | this.ondragover = (e) => {
|
8090 | if (this.active) {
|
8091 | e.preventDefault();
|
8092 | this.emitDrag(e.clientX);
|
8093 | }
|
8094 | };
|
8095 | }
|
8096 |
|
8097 | emitDrag(x) {
|
8098 | const deltaX = x - this.prevX;
|
8099 |
|
8100 |
|
8101 | if (deltaX) {
|
8102 | const deltaTime = pixelsToSeconds(
|
8103 | deltaX,
|
8104 | this.playlist.samplesPerPixel,
|
8105 | this.playlist.sampleRate
|
8106 | );
|
8107 | this.prevX = x;
|
8108 | this.playlist.ee.emit("dragged", deltaTime, this.data);
|
8109 | }
|
8110 | }
|
8111 |
|
8112 | complete() {
|
8113 | this.active = false;
|
8114 | document.removeEventListener("dragover", this.ondragover);
|
8115 | }
|
8116 |
|
8117 | dragstart(e) {
|
8118 | const ev = e;
|
8119 | this.active = true;
|
8120 | this.prevX = e.clientX;
|
8121 |
|
8122 | ev.dataTransfer.dropEffect = "move";
|
8123 | ev.dataTransfer.effectAllowed = "move";
|
8124 | ev.dataTransfer.setData("text/plain", "");
|
8125 | document.addEventListener("dragover", this.ondragover);
|
8126 | }
|
8127 |
|
8128 | dragend(e) {
|
8129 | if (this.active) {
|
8130 | e.preventDefault();
|
8131 | this.complete();
|
8132 | }
|
8133 | }
|
8134 |
|
8135 | static getClass() {
|
8136 | return ".shift";
|
8137 | }
|
8138 |
|
8139 | static getEvents() {
|
8140 | return ["dragstart", "dragend"];
|
8141 | }
|
8142 | });
|
8143 |
|
8144 | ;
|
8145 |
|
8146 |
|
8147 |
|
8148 | const Hook = function ScrollTopHook() {};
|
8149 | Hook.prototype.hook = function hook(node) {
|
8150 | const el = node.querySelector(".current");
|
8151 | if (el) {
|
8152 | const box = node.getBoundingClientRect();
|
8153 | const row = el.getBoundingClientRect();
|
8154 | const diff = row.top - box.top;
|
8155 | const list = node;
|
8156 | list.scrollTop += diff;
|
8157 | }
|
8158 | };
|
8159 |
|
8160 | const ScrollTopHook = (Hook);
|
8161 |
|
8162 | ;
|
8163 | function timeformat(format) {
|
8164 | function clockFormat(seconds, decimals) {
|
8165 | const hours = parseInt(seconds / 3600, 10) % 24;
|
8166 | const minutes = parseInt(seconds / 60, 10) % 60;
|
8167 | const secs = (seconds % 60).toFixed(decimals);
|
8168 |
|
8169 | const sHours = hours < 10 ? `0${hours}` : hours;
|
8170 | const sMinutes = minutes < 10 ? `0${minutes}` : minutes;
|
8171 | const sSeconds = secs < 10 ? `0${secs}` : secs;
|
8172 |
|
8173 | return `${sHours}:${sMinutes}:${sSeconds}`;
|
8174 | }
|
8175 |
|
8176 | const formats = {
|
8177 | seconds(seconds) {
|
8178 | return seconds.toFixed(0);
|
8179 | },
|
8180 | thousandths(seconds) {
|
8181 | return seconds.toFixed(3);
|
8182 | },
|
8183 | "hh:mm:ss": function hhmmss(seconds) {
|
8184 | return clockFormat(seconds, 0);
|
8185 | },
|
8186 | "hh:mm:ss.u": function hhmmssu(seconds) {
|
8187 | return clockFormat(seconds, 1);
|
8188 | },
|
8189 | "hh:mm:ss.uu": function hhmmssuu(seconds) {
|
8190 | return clockFormat(seconds, 2);
|
8191 | },
|
8192 | "hh:mm:ss.uuu": function hhmmssuuu(seconds) {
|
8193 | return clockFormat(seconds, 3);
|
8194 | },
|
8195 | };
|
8196 |
|
8197 | return formats[format];
|
8198 | }
|
8199 |
|
8200 | ;
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 |
|
8208 |
|
8209 |
|
8210 | class AnnotationList {
|
8211 | constructor(
|
8212 | playlist,
|
8213 | annotations,
|
8214 | controls = [],
|
8215 | editable = false,
|
8216 | linkEndpoints = false,
|
8217 | isContinuousPlay = false,
|
8218 | marginLeft = 0
|
8219 | ) {
|
8220 | this.playlist = playlist;
|
8221 | this.marginLeft = marginLeft;
|
8222 | this.resizeHandlers = [];
|
8223 | this.editable = editable;
|
8224 | this.annotations = annotations.map((a) =>
|
8225 |
|
8226 | aeneas(a)
|
8227 | );
|
8228 | this.setupInteractions();
|
8229 |
|
8230 | this.controls = controls;
|
8231 | this.setupEE(playlist.ee);
|
8232 |
|
8233 |
|
8234 | this.playlist.isContinuousPlay = isContinuousPlay;
|
8235 | this.playlist.linkEndpoints = linkEndpoints;
|
8236 | this.length = this.annotations.length;
|
8237 | }
|
8238 |
|
8239 | setupInteractions() {
|
8240 | this.annotations.forEach((a, i) => {
|
8241 | const leftShift = new DragInteraction(this.playlist, {
|
8242 | direction: "left",
|
8243 | index: i,
|
8244 | });
|
8245 | const rightShift = new DragInteraction(this.playlist, {
|
8246 | direction: "right",
|
8247 | index: i,
|
8248 | });
|
8249 |
|
8250 | this.resizeHandlers.push(leftShift);
|
8251 | this.resizeHandlers.push(rightShift);
|
8252 | });
|
8253 | }
|
8254 |
|
8255 | setupEE(ee) {
|
8256 | ee.on("dragged", (deltaTime, data) => {
|
8257 | const annotationIndex = data.index;
|
8258 | const annotations = this.annotations;
|
8259 | const note = annotations[annotationIndex];
|
8260 |
|
8261 |
|
8262 | if (data.direction === "left") {
|
8263 | const originalVal = note.start;
|
8264 | note.start += deltaTime;
|
8265 |
|
8266 | if (note.start < 0) {
|
8267 | note.start = 0;
|
8268 | }
|
8269 |
|
8270 | if (
|
8271 | annotationIndex &&
|
8272 | annotations[annotationIndex - 1].end > note.start
|
8273 | ) {
|
8274 | annotations[annotationIndex - 1].end = note.start;
|
8275 | }
|
8276 |
|
8277 | if (
|
8278 | this.playlist.linkEndpoints &&
|
8279 | annotationIndex &&
|
8280 | annotations[annotationIndex - 1].end === originalVal
|
8281 | ) {
|
8282 | annotations[annotationIndex - 1].end = note.start;
|
8283 | }
|
8284 | } else {
|
8285 |
|
8286 | const originalVal = note.end;
|
8287 | note.end += deltaTime;
|
8288 |
|
8289 | if (note.end > this.playlist.duration) {
|
8290 | note.end = this.playlist.duration;
|
8291 | }
|
8292 |
|
8293 | if (
|
8294 | annotationIndex < annotations.length - 1 &&
|
8295 | annotations[annotationIndex + 1].start < note.end
|
8296 | ) {
|
8297 | annotations[annotationIndex + 1].start = note.end;
|
8298 | }
|
8299 |
|
8300 | if (
|
8301 | this.playlist.linkEndpoints &&
|
8302 | annotationIndex < annotations.length - 1 &&
|
8303 | annotations[annotationIndex + 1].start === originalVal
|
8304 | ) {
|
8305 | annotations[annotationIndex + 1].start = note.end;
|
8306 | }
|
8307 | }
|
8308 |
|
8309 | this.playlist.drawRequest();
|
8310 | });
|
8311 |
|
8312 | ee.on("continuousplay", (val) => {
|
8313 | this.playlist.isContinuousPlay = val;
|
8314 | });
|
8315 |
|
8316 | ee.on("linkendpoints", (val) => {
|
8317 | this.playlist.linkEndpoints = val;
|
8318 | });
|
8319 |
|
8320 | ee.on("annotationsrequest", () => {
|
8321 | this.export();
|
8322 | });
|
8323 |
|
8324 | return ee;
|
8325 | }
|
8326 |
|
8327 | export() {
|
8328 | const output = this.annotations.map((a) => output_aeneas(a));
|
8329 | const dataStr = `data:text/json;charset=utf-8,${encodeURIComponent(
|
8330 | JSON.stringify(output)
|
8331 | )}`;
|
8332 | const a = document.createElement("a");
|
8333 |
|
8334 | document.body.appendChild(a);
|
8335 | a.href = dataStr;
|
8336 | a.download = "annotations.json";
|
8337 | a.click();
|
8338 | document.body.removeChild(a);
|
8339 | }
|
8340 |
|
8341 | renderResizeLeft(i) {
|
8342 | const events = DragInteraction.getEvents();
|
8343 | const config = {
|
8344 | attributes: {
|
8345 | style:
|
8346 | "position: absolute; height: 30px; width: 10px; top: 0; left: -2px",
|
8347 | draggable: true,
|
8348 | },
|
8349 | };
|
8350 | const handler = this.resizeHandlers[i * 2];
|
8351 |
|
8352 | events.forEach((event) => {
|
8353 | config[`on${event}`] = handler[event].bind(handler);
|
8354 | });
|
8355 |
|
8356 | return h_default()("div.resize-handle.resize-w", config);
|
8357 | }
|
8358 |
|
8359 | renderResizeRight(i) {
|
8360 | const events = DragInteraction.getEvents();
|
8361 | const config = {
|
8362 | attributes: {
|
8363 | style:
|
8364 | "position: absolute; height: 30px; width: 10px; top: 0; right: -2px",
|
8365 | draggable: true,
|
8366 | },
|
8367 | };
|
8368 | const handler = this.resizeHandlers[i * 2 + 1];
|
8369 |
|
8370 | events.forEach((event) => {
|
8371 | config[`on${event}`] = handler[event].bind(handler);
|
8372 | });
|
8373 |
|
8374 | return h_default()("div.resize-handle.resize-e", config);
|
8375 | }
|
8376 |
|
8377 | renderControls(note, i) {
|
8378 |
|
8379 | const that = this;
|
8380 | return this.controls.map((ctrl) =>
|
8381 | h_default()(`i.${ctrl.class}`, {
|
8382 | attributes: {
|
8383 | title: ctrl.title,
|
8384 | },
|
8385 | onclick: () => {
|
8386 | ctrl.action(note, i, that.annotations, {
|
8387 | linkEndpoints: that.playlist.linkEndpoints,
|
8388 | });
|
8389 | this.setupInteractions();
|
8390 | that.playlist.drawRequest();
|
8391 | },
|
8392 | })
|
8393 | );
|
8394 | }
|
8395 |
|
8396 | render() {
|
8397 | const boxes = h_default()(
|
8398 | "div.annotations-boxes",
|
8399 | {
|
8400 | attributes: {
|
8401 | style: `height: 30px; position: relative; margin-left: ${this.marginLeft}px;`,
|
8402 | },
|
8403 | },
|
8404 | this.annotations.map((note, i) => {
|
8405 | const samplesPerPixel = this.playlist.samplesPerPixel;
|
8406 | const sampleRate = this.playlist.sampleRate;
|
8407 | const pixPerSec = sampleRate / samplesPerPixel;
|
8408 | const pixOffset = secondsToPixels(
|
8409 | this.playlist.scrollLeft,
|
8410 | samplesPerPixel,
|
8411 | sampleRate
|
8412 | );
|
8413 | const left = Math.floor(note.start * pixPerSec - pixOffset);
|
8414 | const width = Math.ceil(note.end * pixPerSec - note.start * pixPerSec);
|
8415 |
|
8416 | return h_default()(
|
8417 | "div.annotation-box",
|
8418 | {
|
8419 | attributes: {
|
8420 | style: `position: absolute; height: 30px; width: ${width}px; left: ${left}px`,
|
8421 | "data-id": note.id,
|
8422 | },
|
8423 | },
|
8424 | [
|
8425 | this.renderResizeLeft(i),
|
8426 | h_default()(
|
8427 | "span.id",
|
8428 | {
|
8429 | onclick: () => {
|
8430 | const start = this.annotations[i].start;
|
8431 | const end = this.annotations[i].end;
|
8432 |
|
8433 | if (this.playlist.isContinuousPlay) {
|
8434 | this.playlist.seek(start, start);
|
8435 | this.playlist.ee.emit("play", start);
|
8436 | } else {
|
8437 | this.playlist.seek(start, end);
|
8438 | this.playlist.ee.emit("play", start, end);
|
8439 | }
|
8440 | },
|
8441 | },
|
8442 | [note.id]
|
8443 | ),
|
8444 | this.renderResizeRight(i),
|
8445 | ]
|
8446 | );
|
8447 | })
|
8448 | );
|
8449 |
|
8450 | const boxesWrapper = h_default()(
|
8451 | "div.annotations-boxes-wrapper",
|
8452 | {
|
8453 | attributes: {
|
8454 | style: "overflow: hidden;",
|
8455 | },
|
8456 | },
|
8457 | [boxes]
|
8458 | );
|
8459 |
|
8460 | const text = h_default()(
|
8461 | "div.annotations-text",
|
8462 | {
|
8463 | hook: new ScrollTopHook(),
|
8464 | },
|
8465 | this.annotations.map((note, i) => {
|
8466 | const format = timeformat(this.playlist.durationFormat);
|
8467 | const start = format(note.start);
|
8468 | const end = format(note.end);
|
8469 |
|
8470 | let segmentClass = "";
|
8471 | if (
|
8472 | this.playlist.isPlaying() &&
|
8473 | this.playlist.playbackSeconds >= note.start &&
|
8474 | this.playlist.playbackSeconds <= note.end
|
8475 | ) {
|
8476 | segmentClass = ".current";
|
8477 | }
|
8478 |
|
8479 | const editableConfig = {
|
8480 | attributes: {
|
8481 | contenteditable: true,
|
8482 | },
|
8483 | oninput: (e) => {
|
8484 |
|
8485 |
|
8486 | note.lines = [e.target.innerText];
|
8487 | },
|
8488 | onkeypress: (e) => {
|
8489 | if (e.which === 13 || e.keyCode === 13) {
|
8490 | e.target.blur();
|
8491 | e.preventDefault();
|
8492 | }
|
8493 | },
|
8494 | };
|
8495 |
|
8496 | const linesConfig = this.editable ? editableConfig : {};
|
8497 |
|
8498 | return h_default()(`div.annotation${segmentClass}`, [
|
8499 | h_default()("span.annotation-id", [note.id]),
|
8500 | h_default()("span.annotation-start", [start]),
|
8501 | h_default()("span.annotation-end", [end]),
|
8502 | h_default()("span.annotation-lines", linesConfig, [note.lines]),
|
8503 | h_default()("span.annotation-actions", this.renderControls(note, i)),
|
8504 | ]);
|
8505 | })
|
8506 | );
|
8507 |
|
8508 | return h_default()("div.annotations", [boxesWrapper, text]);
|
8509 | }
|
8510 | }
|
8511 |
|
8512 | const annotation_AnnotationList = (AnnotationList);
|
8513 |
|
8514 | ;
|
8515 | function recorderWorker() {
|
8516 |
|
8517 |
|
8518 | |
8519 |
|
8520 |
|
8521 | function findMinMax(array) {
|
8522 | let min = Infinity;
|
8523 | let max = -Infinity;
|
8524 | let curr;
|
8525 |
|
8526 | for (let i = 0; i < array.length; i += 1) {
|
8527 | curr = array[i];
|
8528 | if (min > curr) {
|
8529 | min = curr;
|
8530 | }
|
8531 | if (max < curr) {
|
8532 | max = curr;
|
8533 | }
|
8534 | }
|
8535 |
|
8536 | return {
|
8537 | min,
|
8538 | max,
|
8539 | };
|
8540 | }
|
8541 |
|
8542 | |
8543 |
|
8544 |
|
8545 |
|
8546 | function convert(n, bits) {
|
8547 | const max = 2 ** (bits - 1);
|
8548 | const v = n < 0 ? n * max : n * max - 1;
|
8549 | return Math.max(-max, Math.min(max - 1, v));
|
8550 | }
|
8551 |
|
8552 | |
8553 |
|
8554 |
|
8555 |
|
8556 | function extractPeaks(channel, samplesPerPixel, bits) {
|
8557 | const chanLength = channel.length;
|
8558 | const numPeaks = Math.ceil(chanLength / samplesPerPixel);
|
8559 | let start;
|
8560 | let end;
|
8561 | let segment;
|
8562 | let max;
|
8563 | let min;
|
8564 | let extrema;
|
8565 |
|
8566 |
|
8567 | const peaks = new self[`Int${bits}Array`](numPeaks * 2);
|
8568 |
|
8569 | for (let i = 0; i < numPeaks; i += 1) {
|
8570 | start = i * samplesPerPixel;
|
8571 | end =
|
8572 | (i + 1) * samplesPerPixel > chanLength
|
8573 | ? chanLength
|
8574 | : (i + 1) * samplesPerPixel;
|
8575 |
|
8576 | segment = channel.subarray(start, end);
|
8577 | extrema = findMinMax(segment);
|
8578 | min = convert(extrema.min, bits);
|
8579 | max = convert(extrema.max, bits);
|
8580 |
|
8581 | peaks[i * 2] = min;
|
8582 | peaks[i * 2 + 1] = max;
|
8583 | }
|
8584 |
|
8585 | return peaks;
|
8586 | }
|
8587 |
|
8588 | |
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 | function audioPeaks(source, samplesPerPixel = 10000, bits = 8) {
|
8595 | if ([8, 16, 32].indexOf(bits) < 0) {
|
8596 | throw new Error("Invalid number of bits specified for peaks.");
|
8597 | }
|
8598 |
|
8599 | const peaks = [];
|
8600 | const start = 0;
|
8601 | const end = source.length;
|
8602 | peaks.push(
|
8603 | extractPeaks(source.subarray(start, end), samplesPerPixel, bits)
|
8604 | );
|
8605 |
|
8606 | const length = peaks[0].length / 2;
|
8607 |
|
8608 | return {
|
8609 | bits,
|
8610 | length,
|
8611 | data: peaks,
|
8612 | };
|
8613 | }
|
8614 |
|
8615 | onmessage = function onmessage(e) {
|
8616 | const peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel);
|
8617 |
|
8618 | postMessage(peaks);
|
8619 | };
|
8620 | }
|
8621 |
|
8622 | ;
|
8623 | function exportWavWorker() {
|
8624 | let recLength = 0;
|
8625 | let recBuffersL = [];
|
8626 | let recBuffersR = [];
|
8627 | let sampleRate;
|
8628 |
|
8629 | function init(config) {
|
8630 | sampleRate = config.sampleRate;
|
8631 | }
|
8632 |
|
8633 | function record(inputBuffer) {
|
8634 | recBuffersL.push(inputBuffer[0]);
|
8635 | recBuffersR.push(inputBuffer[1]);
|
8636 | recLength += inputBuffer[0].length;
|
8637 | }
|
8638 |
|
8639 | function writeString(view, offset, string) {
|
8640 | for (let i = 0; i < string.length; i += 1) {
|
8641 | view.setUint8(offset + i, string.charCodeAt(i));
|
8642 | }
|
8643 | }
|
8644 |
|
8645 | function floatTo16BitPCM(output, offset, input) {
|
8646 | let writeOffset = offset;
|
8647 | for (let i = 0; i < input.length; i += 1, writeOffset += 2) {
|
8648 | const s = Math.max(-1, Math.min(1, input[i]));
|
8649 | output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
8650 | }
|
8651 | }
|
8652 |
|
8653 | function encodeWAV(samples, mono = false) {
|
8654 | const buffer = new ArrayBuffer(44 + samples.length * 2);
|
8655 | const view = new DataView(buffer);
|
8656 |
|
8657 |
|
8658 | writeString(view, 0, "RIFF");
|
8659 |
|
8660 | view.setUint32(4, 32 + samples.length * 2, true);
|
8661 |
|
8662 | writeString(view, 8, "WAVE");
|
8663 |
|
8664 | writeString(view, 12, "fmt ");
|
8665 |
|
8666 | view.setUint32(16, 16, true);
|
8667 |
|
8668 | view.setUint16(20, 1, true);
|
8669 |
|
8670 | view.setUint16(22, mono ? 1 : 2, true);
|
8671 |
|
8672 | view.setUint32(24, sampleRate, true);
|
8673 |
|
8674 | view.setUint32(28, sampleRate * 4, true);
|
8675 |
|
8676 | view.setUint16(32, 4, true);
|
8677 |
|
8678 | view.setUint16(34, 16, true);
|
8679 |
|
8680 | writeString(view, 36, "data");
|
8681 |
|
8682 | view.setUint32(40, samples.length * 2, true);
|
8683 |
|
8684 | floatTo16BitPCM(view, 44, samples);
|
8685 |
|
8686 | return view;
|
8687 | }
|
8688 |
|
8689 | function mergeBuffers(recBuffers, length) {
|
8690 | const result = new Float32Array(length);
|
8691 | let offset = 0;
|
8692 |
|
8693 | for (let i = 0; i < recBuffers.length; i += 1) {
|
8694 | result.set(recBuffers[i], offset);
|
8695 | offset += recBuffers[i].length;
|
8696 | }
|
8697 | return result;
|
8698 | }
|
8699 |
|
8700 | function interleave(inputL, inputR) {
|
8701 | const length = inputL.length + inputR.length;
|
8702 | const result = new Float32Array(length);
|
8703 |
|
8704 | let index = 0;
|
8705 | let inputIndex = 0;
|
8706 |
|
8707 | while (index < length) {
|
8708 | result[(index += 1)] = inputL[inputIndex];
|
8709 | result[(index += 1)] = inputR[inputIndex];
|
8710 | inputIndex += 1;
|
8711 | }
|
8712 |
|
8713 | return result;
|
8714 | }
|
8715 |
|
8716 | function exportWAV(type) {
|
8717 | const bufferL = mergeBuffers(recBuffersL, recLength);
|
8718 | const bufferR = mergeBuffers(recBuffersR, recLength);
|
8719 | const interleaved = interleave(bufferL, bufferR);
|
8720 | const dataview = encodeWAV(interleaved);
|
8721 | const audioBlob = new Blob([dataview], { type });
|
8722 |
|
8723 | postMessage(audioBlob);
|
8724 | }
|
8725 |
|
8726 | function clear() {
|
8727 | recLength = 0;
|
8728 | recBuffersL = [];
|
8729 | recBuffersR = [];
|
8730 | }
|
8731 |
|
8732 | onmessage = function onmessage(e) {
|
8733 | switch (e.data.command) {
|
8734 | case "init": {
|
8735 | init(e.data.config);
|
8736 | break;
|
8737 | }
|
8738 | case "record": {
|
8739 | record(e.data.buffer);
|
8740 | break;
|
8741 | }
|
8742 | case "exportWAV": {
|
8743 | exportWAV(e.data.type);
|
8744 | break;
|
8745 | }
|
8746 | case "clear": {
|
8747 | clear();
|
8748 | break;
|
8749 | }
|
8750 | default: {
|
8751 | throw new Error("Unknown export worker command");
|
8752 | }
|
8753 | }
|
8754 | };
|
8755 | }
|
8756 |
|
8757 | ;
|
8758 |
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 |
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 |
|
8775 |
|
8776 | const Playlist = (class {
|
8777 | constructor() {
|
8778 | this.tracks = [];
|
8779 | this.soloedTracks = [];
|
8780 | this.mutedTracks = [];
|
8781 | this.collapsedTracks = [];
|
8782 | this.playoutPromises = [];
|
8783 |
|
8784 | this.cursor = 0;
|
8785 | this.playbackSeconds = 0;
|
8786 | this.duration = 0;
|
8787 | this.scrollLeft = 0;
|
8788 | this.scrollTimer = undefined;
|
8789 | this.showTimescale = false;
|
8790 |
|
8791 | this.isScrolling = false;
|
8792 |
|
8793 | this.fadeType = "logarithmic";
|
8794 | this.masterGain = 1;
|
8795 | this.annotations = [];
|
8796 | this.durationFormat = "hh:mm:ss.uuu";
|
8797 | this.isAutomaticScroll = false;
|
8798 | this.resetDrawTimer = undefined;
|
8799 | }
|
8800 |
|
8801 |
|
8802 | initExporter() {
|
8803 | this.exportWorker = new (inline_worker_default())(exportWavWorker);
|
8804 | }
|
8805 |
|
8806 |
|
8807 | initRecorder(stream) {
|
8808 | this.mediaRecorder = new MediaRecorder(stream);
|
8809 |
|
8810 | this.mediaRecorder.onstart = () => {
|
8811 | const track = new Track();
|
8812 | track.setName("Recording");
|
8813 | track.setEnabledStates();
|
8814 | track.setEventEmitter(this.ee);
|
8815 |
|
8816 | this.recordingTrack = track;
|
8817 | this.tracks.push(track);
|
8818 |
|
8819 | this.chunks = [];
|
8820 | this.working = false;
|
8821 | };
|
8822 |
|
8823 | this.mediaRecorder.ondataavailable = (e) => {
|
8824 | this.chunks.push(e.data);
|
8825 |
|
8826 |
|
8827 | if (!this.working) {
|
8828 | const recording = new Blob(this.chunks, {
|
8829 | type: "audio/ogg; codecs=opus",
|
8830 | });
|
8831 | const loader = LoaderFactory.createLoader(recording, this.ac);
|
8832 | loader
|
8833 | .load()
|
8834 | .then((audioBuffer) => {
|
8835 |
|
8836 | this.recorderWorker.postMessage({
|
8837 | samples: audioBuffer.getChannelData(0),
|
8838 | samplesPerPixel: this.samplesPerPixel,
|
8839 | });
|
8840 | this.recordingTrack.setCues(0, audioBuffer.duration);
|
8841 | this.recordingTrack.setBuffer(audioBuffer);
|
8842 | this.recordingTrack.setPlayout(new Playout(this.ac, audioBuffer));
|
8843 | this.adjustDuration();
|
8844 | })
|
8845 | .catch(() => {
|
8846 | this.working = false;
|
8847 | });
|
8848 | this.working = true;
|
8849 | }
|
8850 | };
|
8851 |
|
8852 | this.mediaRecorder.onstop = () => {
|
8853 | this.chunks = [];
|
8854 | this.working = false;
|
8855 | };
|
8856 |
|
8857 | this.recorderWorker = new (inline_worker_default())(recorderWorker);
|
8858 |
|
8859 | this.recorderWorker.onmessage = (e) => {
|
8860 | this.recordingTrack.setPeaks(e.data);
|
8861 | this.working = false;
|
8862 | this.drawRequest();
|
8863 | };
|
8864 | }
|
8865 |
|
8866 | setShowTimeScale(show) {
|
8867 | this.showTimescale = show;
|
8868 | }
|
8869 |
|
8870 | setMono(mono) {
|
8871 | this.mono = mono;
|
8872 | }
|
8873 |
|
8874 | setExclSolo(exclSolo) {
|
8875 | this.exclSolo = exclSolo;
|
8876 | }
|
8877 |
|
8878 | setSeekStyle(style) {
|
8879 | this.seekStyle = style;
|
8880 | }
|
8881 |
|
8882 | getSeekStyle() {
|
8883 | return this.seekStyle;
|
8884 | }
|
8885 |
|
8886 | setSampleRate(sampleRate) {
|
8887 | this.sampleRate = sampleRate;
|
8888 | }
|
8889 |
|
8890 | setSamplesPerPixel(samplesPerPixel) {
|
8891 | this.samplesPerPixel = samplesPerPixel;
|
8892 | }
|
8893 |
|
8894 | setAudioContext(ac) {
|
8895 | this.ac = ac;
|
8896 | }
|
8897 |
|
8898 | setControlOptions(controlOptions) {
|
8899 | this.controls = controlOptions;
|
8900 | }
|
8901 |
|
8902 | setWaveHeight(height) {
|
8903 | this.waveHeight = height;
|
8904 | }
|
8905 |
|
8906 | setCollapsedWaveHeight(height) {
|
8907 | this.collapsedWaveHeight = height;
|
8908 | }
|
8909 |
|
8910 | setColors(colors) {
|
8911 | this.colors = colors;
|
8912 | }
|
8913 |
|
8914 | setBarWidth(width) {
|
8915 | this.barWidth = width;
|
8916 | }
|
8917 |
|
8918 | setBarGap(width) {
|
8919 | this.barGap = width;
|
8920 | }
|
8921 |
|
8922 | setAnnotations(config) {
|
8923 | const controlWidth = this.controls.show ? this.controls.width : 0;
|
8924 | this.annotationList = new annotation_AnnotationList(
|
8925 | this,
|
8926 | config.annotations,
|
8927 | config.controls,
|
8928 | config.editable,
|
8929 | config.linkEndpoints,
|
8930 | config.isContinuousPlay,
|
8931 | controlWidth
|
8932 | );
|
8933 | }
|
8934 |
|
8935 | setEventEmitter(ee) {
|
8936 | this.ee = ee;
|
8937 | }
|
8938 |
|
8939 | getEventEmitter() {
|
8940 | return this.ee;
|
8941 | }
|
8942 |
|
8943 | setUpEventEmitter() {
|
8944 | const ee = this.ee;
|
8945 |
|
8946 | ee.on("automaticscroll", (val) => {
|
8947 | this.isAutomaticScroll = val;
|
8948 | });
|
8949 |
|
8950 | ee.on("durationformat", (format) => {
|
8951 | this.durationFormat = format;
|
8952 | this.drawRequest();
|
8953 | });
|
8954 |
|
8955 | ee.on("select", (start, end, track) => {
|
8956 | if (this.isPlaying()) {
|
8957 | this.lastSeeked = start;
|
8958 | this.pausedAt = undefined;
|
8959 | this.restartPlayFrom(start);
|
8960 | } else {
|
8961 |
|
8962 | this.seek(start, end, track);
|
8963 | this.ee.emit("timeupdate", start);
|
8964 | this.drawRequest();
|
8965 | }
|
8966 | });
|
8967 |
|
8968 | ee.on("startaudiorendering", (type) => {
|
8969 | this.startOfflineRender(type);
|
8970 | });
|
8971 |
|
8972 | ee.on("statechange", (state) => {
|
8973 | this.setState(state);
|
8974 | this.drawRequest();
|
8975 | });
|
8976 |
|
8977 | ee.on("shift", (deltaTime, track) => {
|
8978 | track.setStartTime(track.getStartTime() + deltaTime);
|
8979 | this.adjustDuration();
|
8980 | this.drawRequest();
|
8981 | });
|
8982 |
|
8983 | ee.on("record", () => {
|
8984 | this.record();
|
8985 | });
|
8986 |
|
8987 | ee.on("play", (start, end) => {
|
8988 | this.play(start, end);
|
8989 | });
|
8990 |
|
8991 | ee.on("pause", () => {
|
8992 | this.pause();
|
8993 | });
|
8994 |
|
8995 | ee.on("stop", () => {
|
8996 | this.stop();
|
8997 | });
|
8998 |
|
8999 | ee.on("rewind", () => {
|
9000 | this.rewind();
|
9001 | });
|
9002 |
|
9003 | ee.on("fastforward", () => {
|
9004 | this.fastForward();
|
9005 | });
|
9006 |
|
9007 | ee.on("clear", () => {
|
9008 | this.clear().then(() => {
|
9009 | this.drawRequest();
|
9010 | });
|
9011 | });
|
9012 |
|
9013 | ee.on("solo", (track) => {
|
9014 | this.soloTrack(track);
|
9015 | this.adjustTrackPlayout();
|
9016 | this.drawRequest();
|
9017 | });
|
9018 |
|
9019 | ee.on("mute", (track) => {
|
9020 | this.muteTrack(track);
|
9021 | this.adjustTrackPlayout();
|
9022 | this.drawRequest();
|
9023 | });
|
9024 |
|
9025 | ee.on("removeTrack", (track) => {
|
9026 | this.removeTrack(track);
|
9027 | this.adjustTrackPlayout();
|
9028 | this.drawRequest();
|
9029 | });
|
9030 |
|
9031 | ee.on("changeTrackView", (track, opts) => {
|
9032 | this.collapseTrack(track, opts);
|
9033 | this.drawRequest();
|
9034 | });
|
9035 |
|
9036 | ee.on("volumechange", (volume, track) => {
|
9037 | track.setGainLevel(volume / 100);
|
9038 | this.drawRequest();
|
9039 | });
|
9040 |
|
9041 | ee.on("mastervolumechange", (volume) => {
|
9042 | this.masterGain = volume / 100;
|
9043 | this.tracks.forEach((track) => {
|
9044 | track.setMasterGainLevel(this.masterGain);
|
9045 | });
|
9046 | });
|
9047 |
|
9048 | ee.on("fadein", (duration, track) => {
|
9049 | track.setFadeIn(duration, this.fadeType);
|
9050 | this.drawRequest();
|
9051 | });
|
9052 |
|
9053 | ee.on("fadeout", (duration, track) => {
|
9054 | track.setFadeOut(duration, this.fadeType);
|
9055 | this.drawRequest();
|
9056 | });
|
9057 |
|
9058 | ee.on("stereopan", (panvalue, track) => {
|
9059 | track.setStereoPanValue(panvalue);
|
9060 | this.drawRequest();
|
9061 | });
|
9062 |
|
9063 | ee.on("fadetype", (type) => {
|
9064 | this.fadeType = type;
|
9065 | });
|
9066 |
|
9067 | ee.on("newtrack", (file) => {
|
9068 | this.load([
|
9069 | {
|
9070 | src: file,
|
9071 | name: file.name,
|
9072 | },
|
9073 | ]);
|
9074 | });
|
9075 |
|
9076 | ee.on("trim", () => {
|
9077 | const track = this.getActiveTrack();
|
9078 | const timeSelection = this.getTimeSelection();
|
9079 |
|
9080 | track.trim(timeSelection.start, timeSelection.end);
|
9081 | track.calculatePeaks(this.samplesPerPixel, this.sampleRate);
|
9082 |
|
9083 | this.setTimeSelection(0, 0);
|
9084 | this.drawRequest();
|
9085 | });
|
9086 |
|
9087 | ee.on("zoomin", () => {
|
9088 | const zoomIndex = Math.max(0, this.zoomIndex - 1);
|
9089 | const zoom = this.zoomLevels[zoomIndex];
|
9090 |
|
9091 | if (zoom !== this.samplesPerPixel) {
|
9092 | this.setZoom(zoom);
|
9093 | this.drawRequest();
|
9094 | }
|
9095 | });
|
9096 |
|
9097 | ee.on("zoomout", () => {
|
9098 | const zoomIndex = Math.min(
|
9099 | this.zoomLevels.length - 1,
|
9100 | this.zoomIndex + 1
|
9101 | );
|
9102 | const zoom = this.zoomLevels[zoomIndex];
|
9103 |
|
9104 | if (zoom !== this.samplesPerPixel) {
|
9105 | this.setZoom(zoom);
|
9106 | this.drawRequest();
|
9107 | }
|
9108 | });
|
9109 |
|
9110 | ee.on("scroll", () => {
|
9111 | this.isScrolling = true;
|
9112 | this.drawRequest();
|
9113 | clearTimeout(this.scrollTimer);
|
9114 | this.scrollTimer = setTimeout(() => {
|
9115 | this.isScrolling = false;
|
9116 | }, 200);
|
9117 | });
|
9118 | }
|
9119 |
|
9120 | load(trackList) {
|
9121 | const loadPromises = trackList.map((trackInfo) => {
|
9122 | const loader = LoaderFactory.createLoader(
|
9123 | trackInfo.src,
|
9124 | this.ac,
|
9125 | this.ee
|
9126 | );
|
9127 | return loader.load();
|
9128 | });
|
9129 |
|
9130 | return Promise.all(loadPromises)
|
9131 | .then((audioBuffers) => {
|
9132 | this.ee.emit("audiosourcesloaded");
|
9133 |
|
9134 | const tracks = audioBuffers.map((audioBuffer, index) => {
|
9135 | const info = trackList[index];
|
9136 | const name = info.name || "Untitled";
|
9137 | const start = info.start || 0;
|
9138 | const states = info.states || {};
|
9139 | const fadeIn = info.fadeIn;
|
9140 | const fadeOut = info.fadeOut;
|
9141 | const cueIn = info.cuein || 0;
|
9142 | const cueOut = info.cueout || audioBuffer.duration;
|
9143 | const gain = info.gain || 1;
|
9144 | const muted = info.muted || false;
|
9145 | const soloed = info.soloed || false;
|
9146 | const selection = info.selected;
|
9147 | const peaks = info.peaks || { type: "WebAudio", mono: this.mono };
|
9148 | const customClass = info.customClass || undefined;
|
9149 | const waveOutlineColor = info.waveOutlineColor || undefined;
|
9150 | const stereoPan = info.stereoPan || 0;
|
9151 |
|
9152 |
|
9153 | const playout = new Playout(this.ac, audioBuffer);
|
9154 |
|
9155 | const track = new Track();
|
9156 | track.src = info.src;
|
9157 | track.setBuffer(audioBuffer);
|
9158 | track.setName(name);
|
9159 | track.setEventEmitter(this.ee);
|
9160 | track.setEnabledStates(states);
|
9161 | track.setCues(cueIn, cueOut);
|
9162 | track.setCustomClass(customClass);
|
9163 | track.setWaveOutlineColor(waveOutlineColor);
|
9164 |
|
9165 | if (fadeIn !== undefined) {
|
9166 | track.setFadeIn(fadeIn.duration, fadeIn.shape);
|
9167 | }
|
9168 |
|
9169 | if (fadeOut !== undefined) {
|
9170 | track.setFadeOut(fadeOut.duration, fadeOut.shape);
|
9171 | }
|
9172 |
|
9173 | if (selection !== undefined) {
|
9174 | this.setActiveTrack(track);
|
9175 | this.setTimeSelection(selection.start, selection.end);
|
9176 | }
|
9177 |
|
9178 | if (peaks !== undefined) {
|
9179 | track.setPeakData(peaks);
|
9180 | }
|
9181 |
|
9182 | track.setState(this.getState());
|
9183 | track.setStartTime(start);
|
9184 | track.setPlayout(playout);
|
9185 |
|
9186 | track.setGainLevel(gain);
|
9187 | track.setStereoPanValue(stereoPan);
|
9188 |
|
9189 | if (muted) {
|
9190 | this.muteTrack(track);
|
9191 | }
|
9192 |
|
9193 | if (soloed) {
|
9194 | this.soloTrack(track);
|
9195 | }
|
9196 |
|
9197 |
|
9198 | track.calculatePeaks(this.samplesPerPixel, this.sampleRate);
|
9199 |
|
9200 | return track;
|
9201 | });
|
9202 |
|
9203 | this.tracks = this.tracks.concat(tracks);
|
9204 | this.adjustDuration();
|
9205 | this.draw(this.render());
|
9206 |
|
9207 | this.ee.emit("audiosourcesrendered");
|
9208 | })
|
9209 | .catch((e) => {
|
9210 | this.ee.emit("audiosourceserror", e);
|
9211 | });
|
9212 | }
|
9213 |
|
9214 | |
9215 |
|
9216 |
|
9217 | setActiveTrack(track) {
|
9218 | this.activeTrack = track;
|
9219 | }
|
9220 |
|
9221 | getActiveTrack() {
|
9222 | return this.activeTrack;
|
9223 | }
|
9224 |
|
9225 | isSegmentSelection() {
|
9226 | return this.timeSelection.start !== this.timeSelection.end;
|
9227 | }
|
9228 |
|
9229 | |
9230 |
|
9231 |
|
9232 | setTimeSelection(start = 0, end) {
|
9233 | this.timeSelection = {
|
9234 | start,
|
9235 | end: end === undefined ? start : end,
|
9236 | };
|
9237 |
|
9238 | this.cursor = start;
|
9239 | }
|
9240 |
|
9241 | startOfflineRender(type) {
|
9242 | if (this.isRendering) {
|
9243 | return;
|
9244 | }
|
9245 |
|
9246 | this.isRendering = true;
|
9247 | this.offlineAudioContext = new OfflineAudioContext(
|
9248 | 2,
|
9249 | 44100 * this.duration,
|
9250 | 44100
|
9251 | );
|
9252 |
|
9253 | const currentTime = this.offlineAudioContext.currentTime;
|
9254 |
|
9255 | this.tracks.forEach((track) => {
|
9256 | track.setOfflinePlayout(
|
9257 | new Playout(this.offlineAudioContext, track.buffer)
|
9258 | );
|
9259 | track.schedulePlay(currentTime, 0, 0, {
|
9260 | shouldPlay: this.shouldTrackPlay(track),
|
9261 | masterGain: 1,
|
9262 | isOffline: true,
|
9263 | });
|
9264 | });
|
9265 |
|
9266 | |
9267 |
|
9268 |
|
9269 | this.offlineAudioContext
|
9270 | .startRendering()
|
9271 | .then((audioBuffer) => {
|
9272 | if (type === "buffer") {
|
9273 | this.ee.emit("audiorenderingfinished", type, audioBuffer);
|
9274 | this.isRendering = false;
|
9275 | return;
|
9276 | }
|
9277 |
|
9278 | if (type === "wav") {
|
9279 | this.exportWorker.postMessage({
|
9280 | command: "init",
|
9281 | config: {
|
9282 | sampleRate: 44100,
|
9283 | },
|
9284 | });
|
9285 |
|
9286 |
|
9287 | this.exportWorker.onmessage = (e) => {
|
9288 | this.ee.emit("audiorenderingfinished", type, e.data);
|
9289 | this.isRendering = false;
|
9290 |
|
9291 |
|
9292 | this.exportWorker.postMessage({
|
9293 | command: "clear",
|
9294 | });
|
9295 | };
|
9296 |
|
9297 |
|
9298 | this.exportWorker.postMessage({
|
9299 | command: "record",
|
9300 | buffer: [
|
9301 | audioBuffer.getChannelData(0),
|
9302 | audioBuffer.getChannelData(1),
|
9303 | ],
|
9304 | });
|
9305 |
|
9306 |
|
9307 | this.exportWorker.postMessage({
|
9308 | command: "exportWAV",
|
9309 | type: "audio/wav",
|
9310 | });
|
9311 | }
|
9312 | })
|
9313 | .catch((e) => {
|
9314 | throw e;
|
9315 | });
|
9316 | }
|
9317 |
|
9318 | getTimeSelection() {
|
9319 | return this.timeSelection;
|
9320 | }
|
9321 |
|
9322 | setState(state) {
|
9323 | this.state = state;
|
9324 |
|
9325 | this.tracks.forEach((track) => {
|
9326 | track.setState(state);
|
9327 | });
|
9328 | }
|
9329 |
|
9330 | getState() {
|
9331 | return this.state;
|
9332 | }
|
9333 |
|
9334 | setZoomIndex(index) {
|
9335 | this.zoomIndex = index;
|
9336 | }
|
9337 |
|
9338 | setZoomLevels(levels) {
|
9339 | this.zoomLevels = levels;
|
9340 | }
|
9341 |
|
9342 | setZoom(zoom) {
|
9343 | this.samplesPerPixel = zoom;
|
9344 | this.zoomIndex = this.zoomLevels.indexOf(zoom);
|
9345 | this.tracks.forEach((track) => {
|
9346 | track.calculatePeaks(zoom, this.sampleRate);
|
9347 | });
|
9348 | }
|
9349 |
|
9350 | muteTrack(track) {
|
9351 | const index = this.mutedTracks.indexOf(track);
|
9352 |
|
9353 | if (index > -1) {
|
9354 | this.mutedTracks.splice(index, 1);
|
9355 | } else {
|
9356 | this.mutedTracks.push(track);
|
9357 | }
|
9358 | }
|
9359 |
|
9360 | soloTrack(track) {
|
9361 | const index = this.soloedTracks.indexOf(track);
|
9362 |
|
9363 | if (index > -1) {
|
9364 | this.soloedTracks.splice(index, 1);
|
9365 | } else if (this.exclSolo) {
|
9366 | this.soloedTracks = [track];
|
9367 | } else {
|
9368 | this.soloedTracks.push(track);
|
9369 | }
|
9370 | }
|
9371 |
|
9372 | collapseTrack(track, opts) {
|
9373 | if (opts.collapsed) {
|
9374 | this.collapsedTracks.push(track);
|
9375 | } else {
|
9376 | const index = this.collapsedTracks.indexOf(track);
|
9377 |
|
9378 | if (index > -1) {
|
9379 | this.collapsedTracks.splice(index, 1);
|
9380 | }
|
9381 | }
|
9382 | }
|
9383 |
|
9384 | removeTrack(track) {
|
9385 | if (track.isPlaying()) {
|
9386 | track.scheduleStop();
|
9387 | }
|
9388 |
|
9389 | const trackLists = [
|
9390 | this.mutedTracks,
|
9391 | this.soloedTracks,
|
9392 | this.collapsedTracks,
|
9393 | this.tracks,
|
9394 | ];
|
9395 | trackLists.forEach((list) => {
|
9396 | const index = list.indexOf(track);
|
9397 | if (index > -1) {
|
9398 | list.splice(index, 1);
|
9399 | }
|
9400 | });
|
9401 | }
|
9402 |
|
9403 | adjustTrackPlayout() {
|
9404 | this.tracks.forEach((track) => {
|
9405 | track.setShouldPlay(this.shouldTrackPlay(track));
|
9406 | });
|
9407 | }
|
9408 |
|
9409 | adjustDuration() {
|
9410 | this.duration = this.tracks.reduce(
|
9411 | (duration, track) => Math.max(duration, track.getEndTime()),
|
9412 | 0
|
9413 | );
|
9414 | }
|
9415 |
|
9416 | shouldTrackPlay(track) {
|
9417 | let shouldPlay;
|
9418 |
|
9419 | if (this.soloedTracks.length > 0) {
|
9420 | shouldPlay = false;
|
9421 | if (this.soloedTracks.indexOf(track) > -1) {
|
9422 | shouldPlay = true;
|
9423 | }
|
9424 | } else {
|
9425 |
|
9426 | shouldPlay = true;
|
9427 | if (this.mutedTracks.indexOf(track) > -1) {
|
9428 | shouldPlay = false;
|
9429 | }
|
9430 | }
|
9431 |
|
9432 | return shouldPlay;
|
9433 | }
|
9434 |
|
9435 | isPlaying() {
|
9436 | return this.tracks.reduce(
|
9437 | (isPlaying, track) => isPlaying || track.isPlaying(),
|
9438 | false
|
9439 | );
|
9440 | }
|
9441 |
|
9442 | |
9443 |
|
9444 |
|
9445 | getCurrentTime() {
|
9446 | const cursorPos = this.lastSeeked || this.pausedAt || this.cursor;
|
9447 |
|
9448 | return cursorPos + this.getElapsedTime();
|
9449 | }
|
9450 |
|
9451 | getElapsedTime() {
|
9452 | return this.ac.currentTime - this.lastPlay;
|
9453 | }
|
9454 |
|
9455 | setMasterGain(gain) {
|
9456 | this.ee.emit("mastervolumechange", gain);
|
9457 | }
|
9458 |
|
9459 | restartPlayFrom(start, end) {
|
9460 | this.stopAnimation();
|
9461 |
|
9462 | this.tracks.forEach((editor) => {
|
9463 | editor.scheduleStop();
|
9464 | });
|
9465 |
|
9466 | return Promise.all(this.playoutPromises).then(
|
9467 | this.play.bind(this, start, end)
|
9468 | );
|
9469 | }
|
9470 |
|
9471 | play(startTime, endTime) {
|
9472 | clearTimeout(this.resetDrawTimer);
|
9473 |
|
9474 | const currentTime = this.ac.currentTime;
|
9475 | const selected = this.getTimeSelection();
|
9476 | const playoutPromises = [];
|
9477 |
|
9478 | const start = startTime || this.pausedAt || this.cursor;
|
9479 | let end = endTime;
|
9480 |
|
9481 | if (!end && selected.end !== selected.start && selected.end > start) {
|
9482 | end = selected.end;
|
9483 | }
|
9484 |
|
9485 | if (this.isPlaying()) {
|
9486 | return this.restartPlayFrom(start, end);
|
9487 | }
|
9488 |
|
9489 | this.tracks.forEach((track) => {
|
9490 | track.setState("cursor");
|
9491 | playoutPromises.push(
|
9492 | track.schedulePlay(currentTime, start, end, {
|
9493 | shouldPlay: this.shouldTrackPlay(track),
|
9494 | masterGain: this.masterGain,
|
9495 | })
|
9496 | );
|
9497 | });
|
9498 |
|
9499 | this.lastPlay = currentTime;
|
9500 |
|
9501 | this.playoutPromises = playoutPromises;
|
9502 | this.startAnimation(start);
|
9503 |
|
9504 | return Promise.all(this.playoutPromises);
|
9505 | }
|
9506 |
|
9507 | pause() {
|
9508 | if (!this.isPlaying()) {
|
9509 | return Promise.all(this.playoutPromises);
|
9510 | }
|
9511 |
|
9512 | this.pausedAt = this.getCurrentTime();
|
9513 | return this.playbackReset();
|
9514 | }
|
9515 |
|
9516 | stop() {
|
9517 | if (this.mediaRecorder && this.mediaRecorder.state === "recording") {
|
9518 | this.mediaRecorder.stop();
|
9519 | }
|
9520 |
|
9521 | this.pausedAt = undefined;
|
9522 | this.playbackSeconds = 0;
|
9523 | return this.playbackReset();
|
9524 | }
|
9525 |
|
9526 | playbackReset() {
|
9527 | this.lastSeeked = undefined;
|
9528 | this.stopAnimation();
|
9529 |
|
9530 | this.tracks.forEach((track) => {
|
9531 | track.scheduleStop();
|
9532 | track.setState(this.getState());
|
9533 | });
|
9534 |
|
9535 | this.drawRequest();
|
9536 | return Promise.all(this.playoutPromises);
|
9537 | }
|
9538 |
|
9539 | rewind() {
|
9540 | return this.stop().then(() => {
|
9541 | this.scrollLeft = 0;
|
9542 | this.ee.emit("select", 0, 0);
|
9543 | });
|
9544 | }
|
9545 |
|
9546 | fastForward() {
|
9547 | return this.stop().then(() => {
|
9548 | if (this.viewDuration < this.duration) {
|
9549 | this.scrollLeft = this.duration - this.viewDuration;
|
9550 | } else {
|
9551 | this.scrollLeft = 0;
|
9552 | }
|
9553 |
|
9554 | this.ee.emit("select", this.duration, this.duration);
|
9555 | });
|
9556 | }
|
9557 |
|
9558 | clear() {
|
9559 | return this.stop().then(() => {
|
9560 | this.tracks = [];
|
9561 | this.soloedTracks = [];
|
9562 | this.mutedTracks = [];
|
9563 | this.playoutPromises = [];
|
9564 |
|
9565 | this.cursor = 0;
|
9566 | this.playbackSeconds = 0;
|
9567 | this.duration = 0;
|
9568 | this.scrollLeft = 0;
|
9569 |
|
9570 | this.seek(0, 0, undefined);
|
9571 | });
|
9572 | }
|
9573 |
|
9574 | record() {
|
9575 | const playoutPromises = [];
|
9576 | this.mediaRecorder.start(300);
|
9577 |
|
9578 | this.tracks.forEach((track) => {
|
9579 | track.setState("none");
|
9580 | playoutPromises.push(
|
9581 | track.schedulePlay(this.ac.currentTime, 0, undefined, {
|
9582 | shouldPlay: this.shouldTrackPlay(track),
|
9583 | })
|
9584 | );
|
9585 | });
|
9586 |
|
9587 | this.playoutPromises = playoutPromises;
|
9588 | }
|
9589 |
|
9590 | startAnimation(startTime) {
|
9591 | this.lastDraw = this.ac.currentTime;
|
9592 | this.animationRequest = window.requestAnimationFrame(() => {
|
9593 | this.updateEditor(startTime);
|
9594 | });
|
9595 | }
|
9596 |
|
9597 | stopAnimation() {
|
9598 | window.cancelAnimationFrame(this.animationRequest);
|
9599 | this.lastDraw = undefined;
|
9600 | }
|
9601 |
|
9602 | seek(start, end, track) {
|
9603 | if (this.isPlaying()) {
|
9604 | this.lastSeeked = start;
|
9605 | this.pausedAt = undefined;
|
9606 | this.restartPlayFrom(start);
|
9607 | } else {
|
9608 |
|
9609 | this.setActiveTrack(track || this.tracks[0]);
|
9610 | this.pausedAt = start;
|
9611 | this.setTimeSelection(start, end);
|
9612 | if (this.getSeekStyle() === "fill") {
|
9613 | this.playbackSeconds = start;
|
9614 | }
|
9615 | }
|
9616 | }
|
9617 |
|
9618 | |
9619 |
|
9620 |
|
9621 |
|
9622 | updateEditor(cursor) {
|
9623 | const currentTime = this.ac.currentTime;
|
9624 | const selection = this.getTimeSelection();
|
9625 | const cursorPos = cursor || this.cursor;
|
9626 | const elapsed = currentTime - this.lastDraw;
|
9627 |
|
9628 | if (this.isPlaying()) {
|
9629 | const playbackSeconds = cursorPos + elapsed;
|
9630 | this.ee.emit("timeupdate", playbackSeconds);
|
9631 | this.animationRequest = window.requestAnimationFrame(() => {
|
9632 | this.updateEditor(playbackSeconds);
|
9633 | });
|
9634 |
|
9635 | this.playbackSeconds = playbackSeconds;
|
9636 | this.draw(this.render());
|
9637 | this.lastDraw = currentTime;
|
9638 | } else {
|
9639 | if (
|
9640 | cursorPos + elapsed >=
|
9641 | (this.isSegmentSelection() ? selection.end : this.duration)
|
9642 | ) {
|
9643 | this.ee.emit("finished");
|
9644 | }
|
9645 |
|
9646 | this.stopAnimation();
|
9647 |
|
9648 | this.resetDrawTimer = setTimeout(() => {
|
9649 | this.pausedAt = undefined;
|
9650 | this.lastSeeked = undefined;
|
9651 | this.setState(this.getState());
|
9652 |
|
9653 | this.playbackSeconds = 0;
|
9654 | this.draw(this.render());
|
9655 | }, 0);
|
9656 | }
|
9657 | }
|
9658 |
|
9659 | drawRequest() {
|
9660 | window.requestAnimationFrame(() => {
|
9661 | this.draw(this.render());
|
9662 | });
|
9663 | }
|
9664 |
|
9665 | draw(newTree) {
|
9666 | const patches = diff_default()(this.tree, newTree);
|
9667 | this.rootNode = patch_default()(this.rootNode, patches);
|
9668 | this.tree = newTree;
|
9669 |
|
9670 |
|
9671 | this.viewDuration = pixelsToSeconds(
|
9672 | this.rootNode.clientWidth - this.controls.width,
|
9673 | this.samplesPerPixel,
|
9674 | this.sampleRate
|
9675 | );
|
9676 | }
|
9677 |
|
9678 | getTrackRenderData(data = {}) {
|
9679 | const defaults = {
|
9680 | height: this.waveHeight,
|
9681 | resolution: this.samplesPerPixel,
|
9682 | sampleRate: this.sampleRate,
|
9683 | controls: this.controls,
|
9684 | isActive: false,
|
9685 | timeSelection: this.getTimeSelection(),
|
9686 | playlistLength: this.duration,
|
9687 | playbackSeconds: this.playbackSeconds,
|
9688 | colors: this.colors,
|
9689 | barWidth: this.barWidth,
|
9690 | barGap: this.barGap,
|
9691 | };
|
9692 |
|
9693 | return lodash_defaultsdeep_default()({}, data, defaults);
|
9694 | }
|
9695 |
|
9696 | isActiveTrack(track) {
|
9697 | const activeTrack = this.getActiveTrack();
|
9698 |
|
9699 | if (this.isSegmentSelection()) {
|
9700 | return activeTrack === track;
|
9701 | }
|
9702 |
|
9703 | return true;
|
9704 | }
|
9705 |
|
9706 | renderAnnotations() {
|
9707 | return this.annotationList.render();
|
9708 | }
|
9709 |
|
9710 | renderTimeScale() {
|
9711 | const controlWidth = this.controls.show ? this.controls.width : 0;
|
9712 | const timeScale = new src_TimeScale(
|
9713 | this.duration,
|
9714 | this.scrollLeft,
|
9715 | this.samplesPerPixel,
|
9716 | this.sampleRate,
|
9717 | controlWidth,
|
9718 | this.colors
|
9719 | );
|
9720 |
|
9721 | return timeScale.render();
|
9722 | }
|
9723 |
|
9724 | renderTrackSection() {
|
9725 | const trackElements = this.tracks.map((track) => {
|
9726 | const collapsed = this.collapsedTracks.indexOf(track) > -1;
|
9727 | return track.render(
|
9728 | this.getTrackRenderData({
|
9729 | isActive: this.isActiveTrack(track),
|
9730 | shouldPlay: this.shouldTrackPlay(track),
|
9731 | soloed: this.soloedTracks.indexOf(track) > -1,
|
9732 | muted: this.mutedTracks.indexOf(track) > -1,
|
9733 | collapsed,
|
9734 | height: collapsed ? this.collapsedWaveHeight : this.waveHeight,
|
9735 | barGap: this.barGap,
|
9736 | barWidth: this.barWidth,
|
9737 | })
|
9738 | );
|
9739 | });
|
9740 |
|
9741 | return h_default()(
|
9742 | "div.playlist-tracks",
|
9743 | {
|
9744 | attributes: {
|
9745 | style: "overflow: auto;",
|
9746 | },
|
9747 | onscroll: (e) => {
|
9748 | this.scrollLeft = pixelsToSeconds(
|
9749 | e.target.scrollLeft,
|
9750 | this.samplesPerPixel,
|
9751 | this.sampleRate
|
9752 | );
|
9753 |
|
9754 | this.ee.emit("scroll");
|
9755 | },
|
9756 | hook: new ScrollHook(this),
|
9757 | },
|
9758 | trackElements
|
9759 | );
|
9760 | }
|
9761 |
|
9762 | render() {
|
9763 | const containerChildren = [];
|
9764 |
|
9765 | if (this.showTimescale) {
|
9766 | containerChildren.push(this.renderTimeScale());
|
9767 | }
|
9768 |
|
9769 | containerChildren.push(this.renderTrackSection());
|
9770 |
|
9771 | if (this.annotationList.length) {
|
9772 | containerChildren.push(this.renderAnnotations());
|
9773 | }
|
9774 |
|
9775 | return h_default()(
|
9776 | "div.playlist",
|
9777 | {
|
9778 | attributes: {
|
9779 | style: "overflow: hidden; position: relative;",
|
9780 | },
|
9781 | },
|
9782 | containerChildren
|
9783 | );
|
9784 | }
|
9785 |
|
9786 | getInfo() {
|
9787 | const info = [];
|
9788 |
|
9789 | this.tracks.forEach((track) => {
|
9790 | info.push(track.getTrackDetails());
|
9791 | });
|
9792 |
|
9793 | return info;
|
9794 | }
|
9795 | });
|
9796 |
|
9797 | ;
|
9798 |
|
9799 |
|
9800 |
|
9801 |
|
9802 |
|
9803 | function init(options = {}, ee = event_emitter_default()()) {
|
9804 | if (options.container === undefined) {
|
9805 | throw new Error("DOM element container must be given.");
|
9806 | }
|
9807 |
|
9808 | window.OfflineAudioContext =
|
9809 | window.OfflineAudioContext || window.webkitOfflineAudioContext;
|
9810 | window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
9811 |
|
9812 | const audioContext = new window.AudioContext();
|
9813 |
|
9814 | const defaults = {
|
9815 | ac: audioContext,
|
9816 | sampleRate: audioContext.sampleRate,
|
9817 | samplesPerPixel: 4096,
|
9818 | mono: true,
|
9819 | fadeType: "logarithmic",
|
9820 | exclSolo: false,
|
9821 | timescale: false,
|
9822 | controls: {
|
9823 | show: false,
|
9824 | width: 150,
|
9825 | widgets: {
|
9826 | muteOrSolo: true,
|
9827 | volume: true,
|
9828 | stereoPan: true,
|
9829 | collapse: true,
|
9830 | remove: true,
|
9831 | },
|
9832 | },
|
9833 | colors: {
|
9834 | waveOutlineColor: "white",
|
9835 | timeColor: "grey",
|
9836 | fadeColor: "black",
|
9837 | },
|
9838 | seekStyle: "line",
|
9839 | waveHeight: 128,
|
9840 | collapsedWaveHeight: 30,
|
9841 | barWidth: 1,
|
9842 | barGap: 0,
|
9843 | state: "cursor",
|
9844 | zoomLevels: [512, 1024, 2048, 4096],
|
9845 | annotationList: {
|
9846 | annotations: [],
|
9847 | controls: [],
|
9848 | editable: false,
|
9849 | linkEndpoints: false,
|
9850 | isContinuousPlay: false,
|
9851 | },
|
9852 | isAutomaticScroll: false,
|
9853 | };
|
9854 |
|
9855 | const config = lodash_defaultsdeep_default()({}, options, defaults);
|
9856 | const zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel);
|
9857 |
|
9858 | if (zoomIndex === -1) {
|
9859 | throw new Error(
|
9860 | "initial samplesPerPixel must be included in array zoomLevels"
|
9861 | );
|
9862 | }
|
9863 |
|
9864 | const playlist = new Playlist();
|
9865 | playlist.setSampleRate(config.sampleRate);
|
9866 | playlist.setSamplesPerPixel(config.samplesPerPixel);
|
9867 | playlist.setAudioContext(config.ac);
|
9868 | playlist.setEventEmitter(ee);
|
9869 | playlist.setUpEventEmitter();
|
9870 | playlist.setTimeSelection(0, 0);
|
9871 | playlist.setState(config.state);
|
9872 | playlist.setControlOptions(config.controls);
|
9873 | playlist.setWaveHeight(config.waveHeight);
|
9874 | playlist.setCollapsedWaveHeight(config.collapsedWaveHeight);
|
9875 | playlist.setColors(config.colors);
|
9876 | playlist.setZoomLevels(config.zoomLevels);
|
9877 | playlist.setZoomIndex(zoomIndex);
|
9878 | playlist.setMono(config.mono);
|
9879 | playlist.setExclSolo(config.exclSolo);
|
9880 | playlist.setShowTimeScale(config.timescale);
|
9881 | playlist.setSeekStyle(config.seekStyle);
|
9882 | playlist.setAnnotations(config.annotationList);
|
9883 | playlist.setBarGap(config.barGap);
|
9884 | playlist.setBarWidth(config.barWidth);
|
9885 | playlist.isAutomaticScroll = config.isAutomaticScroll;
|
9886 | playlist.isContinuousPlay = config.isContinuousPlay;
|
9887 | playlist.linkedEndpoints = config.linkedEndpoints;
|
9888 |
|
9889 |
|
9890 |
|
9891 | const tree = playlist.render();
|
9892 | const rootNode = create_element_default()(tree);
|
9893 |
|
9894 | config.container.appendChild(rootNode);
|
9895 | playlist.tree = tree;
|
9896 | playlist.rootNode = rootNode;
|
9897 |
|
9898 | return playlist;
|
9899 | }
|
9900 |
|
9901 | function app(options = {}, ee = event_emitter_default()()) {
|
9902 | return init(options, ee);
|
9903 | }
|
9904 |
|
9905 | })();
|
9906 |
|
9907 | module.exports.WaveformPlaylist = __webpack_exports__;
|
9908 | })()
|
9909 | ; |
\ | No newline at end of file |