@vkontakte/videoplayer-shared 1.0.30 → 1.0.31-dev.0e8d526.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.umd.js ADDED
@@ -0,0 +1,2928 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VKShared = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ const VERSION = '1.0.31-dev.0e8d526.0';
8
+
9
+ class Subscription {
10
+ constructor() {
11
+ this.subscriptions = [];
12
+ }
13
+ unsubscribe() {
14
+ const subscriptions = this.subscriptions;
15
+ this.subscriptions = [];
16
+ subscriptions.forEach((it) => typeof it === 'function' ? it() : it.unsubscribe());
17
+ }
18
+ add(item) {
19
+ this.subscriptions.push(item);
20
+ return this;
21
+ }
22
+ }
23
+
24
+ const assertNever = (x) => {
25
+ throw new Error(`${x} is value of unexpected type`);
26
+ };
27
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
28
+ const checkNever = (_x) => {
29
+ };
30
+
31
+ const noop = () => {
32
+ /* no op */
33
+ };
34
+
35
+ class Observable {
36
+ constructor(subscribe) {
37
+ if (subscribe) {
38
+ this._subscribe = subscribe;
39
+ }
40
+ }
41
+ subscribe(listener, error) {
42
+ var _a;
43
+ let errorEmitter;
44
+ if (!error) {
45
+ errorEmitter = { next: noop, error: noop };
46
+ }
47
+ else if (typeof error === 'function') {
48
+ errorEmitter = { next: error, error: noop };
49
+ }
50
+ else {
51
+ errorEmitter = {
52
+ next: (value) => error.next(value),
53
+ error: (value) => { var _a; return (_a = error.error) === null || _a === void 0 ? void 0 : _a.call(error, value); },
54
+ };
55
+ }
56
+ const emitter = typeof listener === 'function' ? {
57
+ next: (value) => {
58
+ try {
59
+ listener(value);
60
+ }
61
+ catch (e) {
62
+ errorEmitter.next(e);
63
+ }
64
+ },
65
+ error: (value) => errorEmitter.next(value),
66
+ } : {
67
+ next: (value) => listener.next(value),
68
+ error: (value) => listener.error ? listener.error(value) : errorEmitter.next(value),
69
+ };
70
+ let unsubscriber;
71
+ try {
72
+ unsubscriber = this._subscribe(emitter);
73
+ }
74
+ catch (e) {
75
+ (_a = emitter.error) === null || _a === void 0 ? void 0 : _a.call(emitter, e);
76
+ }
77
+ return new Subscription().add(() => {
78
+ emitter.next = noop;
79
+ emitter.error = noop;
80
+ switch (typeof unsubscriber) {
81
+ case 'function':
82
+ unsubscriber();
83
+ return;
84
+ case 'object':
85
+ unsubscriber.unsubscribe();
86
+ return;
87
+ case 'undefined':
88
+ return;
89
+ default:
90
+ return assertNever(unsubscriber);
91
+ }
92
+ });
93
+ }
94
+ pipe(...operators) {
95
+ return operators.reduce((prev, op) => op(prev), this);
96
+ }
97
+ _subscribe(_emitter) {
98
+ /* empty */
99
+ }
100
+ }
101
+
102
+ class Subject extends Observable {
103
+ constructor() {
104
+ super();
105
+ this.keyCounter = 0;
106
+ this.subscribers = new Map();
107
+ }
108
+ next(value) {
109
+ this.subscribers.forEach((it) => it.next(value));
110
+ }
111
+ error(value) {
112
+ this.subscribers.forEach((it) => { var _a; return (_a = it.error) === null || _a === void 0 ? void 0 : _a.call(it, value); });
113
+ }
114
+ _subscribe(emitter) {
115
+ const key = this.keyCounter++;
116
+ this.subscribers.set(key, emitter);
117
+ return new Subscription().add(() => this.subscribers.delete(key));
118
+ }
119
+ }
120
+
121
+ class Logger {
122
+ constructor() {
123
+ this.log$ = new Subject();
124
+ this.logs = [];
125
+ this.log = (inputEntry) => {
126
+ const entry = Object.assign(Object.assign({}, inputEntry), { timestamp: Date.now() });
127
+ this.logs.push(entry);
128
+ this.log$.next(entry);
129
+ };
130
+ this.getAllLogs = () => this.logs;
131
+ }
132
+ createCustomLog(transform) {
133
+ return (...args) => {
134
+ let entry;
135
+ try {
136
+ entry = transform(...args);
137
+ }
138
+ catch (_a) {
139
+ entry = {
140
+ message: 'error in `createCustomLog`',
141
+ component: 'Logger',
142
+ };
143
+ }
144
+ this.log(entry);
145
+ };
146
+ }
147
+ createComponentLog(component) {
148
+ return this.createCustomLog((entry) => (Object.assign({ component }, entry)));
149
+ }
150
+ }
151
+
152
+ function assertNonNullable(value, failMessage = `Assertion "value is not nullable" failed`) {
153
+ if (value === undefined || value === null) {
154
+ throw new Error(failMessage);
155
+ }
156
+ }
157
+ function assertNullable(value, failMessage = `Assertion "value is nullable" failed`) {
158
+ if (value !== undefined && value !== null) {
159
+ throw new Error(failMessage);
160
+ }
161
+ }
162
+ function isNonNullable(value) {
163
+ return typeof value !== 'undefined' && value !== null;
164
+ }
165
+ function isNullable(value) {
166
+ return value === undefined || value === null;
167
+ }
168
+
169
+ function assertNotEmptyArray(value, failMessage) {
170
+ if (!(value === null || value === void 0 ? void 0 : value.length)) {
171
+ throw new Error(failMessage);
172
+ }
173
+ }
174
+ function assertEmptyArray(value, failMessage) {
175
+ if (value === null || value === void 0 ? void 0 : value.length) {
176
+ throw new Error(failMessage);
177
+ }
178
+ }
179
+
180
+ const addScript = (scriptSrc, abortSignal, timeout) => new Promise((resolve, reject) => {
181
+ abortSignal.addEventListener('abort', () => {
182
+ removeListeners();
183
+ script.remove();
184
+ });
185
+ const onLoadFail = () => {
186
+ removeListeners();
187
+ reject();
188
+ };
189
+ const onLoadSuccess = () => {
190
+ removeListeners();
191
+ resolve();
192
+ };
193
+ const removeListeners = () => {
194
+ failTimeout && clearTimeout(failTimeout);
195
+ script.removeEventListener('load', onLoadSuccess);
196
+ script.removeEventListener('error', onLoadFail);
197
+ };
198
+ let failTimeout;
199
+ if (timeout) {
200
+ failTimeout = window.setTimeout(onLoadFail, timeout);
201
+ }
202
+ const script = document.createElement('script');
203
+ script.addEventListener('load', onLoadSuccess);
204
+ script.addEventListener('error', onLoadFail);
205
+ script.src = scriptSrc;
206
+ document.head.appendChild(script);
207
+ });
208
+
209
+ var _a;
210
+ const now = typeof ((_a = window.performance) === null || _a === void 0 ? void 0 : _a.now) === 'function' ?
211
+ () => window.performance.now() :
212
+ () => Date.now();
213
+
214
+ /******************************************************************************
215
+ Copyright (c) Microsoft Corporation.
216
+
217
+ Permission to use, copy, modify, and/or distribute this software for any
218
+ purpose with or without fee is hereby granted.
219
+
220
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
221
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
222
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
223
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
224
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
225
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
226
+ PERFORMANCE OF THIS SOFTWARE.
227
+ ***************************************************************************** */
228
+ /* global Reflect, Promise */
229
+
230
+
231
+ function __awaiter(thisArg, _arguments, P, generator) {
232
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
233
+ return new (P || (P = Promise))(function (resolve, reject) {
234
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
235
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
236
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
237
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
238
+ });
239
+ }
240
+
241
+ // Декоратор оборачивающий async функции в генераторы
242
+ // В этих async функциях await заменяем на yield, он передаёт контроль этой утилите
243
+ // Декоратор проверяет состояние сигнала и если тот не абортнут передаёт контроль внутрь функции обратно
244
+ // Если сигнал абортнут, целевая функция останавливается на точке вызова yield и не продолжает исполнение
245
+ // Таким образом её можно уничтожать не боясь что какой-то асинхронный код выстрелит после уничтожения
246
+ const abortable = (signal, createGenerator) => (...params) => __awaiter(void 0, void 0, void 0, function* () {
247
+ var _a;
248
+ const generator = createGenerator(...params);
249
+ let done = signal.aborted;
250
+ let value = undefined;
251
+ while (!done && !signal.aborted) {
252
+ const result = yield generator.next(value);
253
+ done = (_a = result.done) !== null && _a !== void 0 ? _a : false;
254
+ value = result.value;
255
+ }
256
+ return value;
257
+ });
258
+
259
+ exports.CurrentClientBrowser = void 0;
260
+ (function (CurrentClientBrowser) {
261
+ CurrentClientBrowser["Unknown"] = "Unknown";
262
+ CurrentClientBrowser["Yandex"] = "Yandex";
263
+ CurrentClientBrowser["Chrome"] = "Chrome";
264
+ CurrentClientBrowser["Chromium"] = "Chromium";
265
+ CurrentClientBrowser["Firefox"] = "Firefox";
266
+ CurrentClientBrowser["Safari"] = "Safari";
267
+ CurrentClientBrowser["Opera"] = "Opera";
268
+ CurrentClientBrowser["Edge"] = "Edge";
269
+ CurrentClientBrowser["Rest"] = "Rest";
270
+ })(exports.CurrentClientBrowser || (exports.CurrentClientBrowser = {}));
271
+ exports.CurrentClientDevice = void 0;
272
+ (function (CurrentClientDevice) {
273
+ CurrentClientDevice["Unknown"] = "Unknown";
274
+ CurrentClientDevice["Android"] = "Android";
275
+ CurrentClientDevice["iPhone"] = "iPhone";
276
+ CurrentClientDevice["iPad"] = "iPad";
277
+ CurrentClientDevice["iPod"] = "iPod";
278
+ CurrentClientDevice["RestMobile"] = "RestMobile";
279
+ CurrentClientDevice["Mac"] = "Mac";
280
+ CurrentClientDevice["Desktop"] = "Desktop";
281
+ })(exports.CurrentClientDevice || (exports.CurrentClientDevice = {}));
282
+ const getCurrentBrowser = () => {
283
+ const { userAgent } = window.navigator;
284
+ const isYandex = /yabrowser/i.test(userAgent) ? exports.CurrentClientBrowser.Yandex : undefined;
285
+ const isChrome = /chrome|crios/i.test(userAgent) ? exports.CurrentClientBrowser.Chrome : undefined;
286
+ const isChromium = /chromium/i.test(userAgent) ? exports.CurrentClientBrowser.Chromium : undefined;
287
+ const isFirefox = /firefox|fxios/i.test(userAgent) ? exports.CurrentClientBrowser.Firefox : undefined;
288
+ const isSafari = /webkit|safari|khtml/i.test(userAgent) ? exports.CurrentClientBrowser.Safari : undefined;
289
+ const isOpera = /opr\//i.test(userAgent) ? exports.CurrentClientBrowser.Opera : undefined;
290
+ const isEdge = /edg/i.test(userAgent) ? exports.CurrentClientBrowser.Edge : undefined;
291
+ const isAndroid = /android/i.test(userAgent) ? exports.CurrentClientDevice.Android : undefined;
292
+ const isiPhone = /iphone/i.test(userAgent) ? exports.CurrentClientDevice.iPhone : undefined;
293
+ const isiPad = /ipad/i.test(userAgent) ? exports.CurrentClientDevice.iPad : undefined;
294
+ const isiPod = /ipod/i.test(userAgent) ? exports.CurrentClientDevice.iPod : undefined;
295
+ const isMac = /mac/i.test(userAgent) ? exports.CurrentClientDevice.Mac : undefined;
296
+ const isRestMobile = /webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) ? exports.CurrentClientDevice.RestMobile : undefined;
297
+ // Порядок браузеров важен для определения!
298
+ return {
299
+ browser: isYandex || isFirefox || isOpera || isEdge || isChrome || isChromium || isSafari || exports.CurrentClientBrowser.Rest,
300
+ device: isAndroid || isiPhone || isiPad || isiPod || isRestMobile || isMac || exports.CurrentClientDevice.Desktop,
301
+ };
302
+ };
303
+ // флаг нужен для того, чтобы проверить, включено ли у iOS-устройства полноразмерное открытие сайтов
304
+ const isIOS = (checkForceDesktop = false) => {
305
+ const iosDevices = [exports.CurrentClientDevice.iPhone, exports.CurrentClientDevice.iPad, exports.CurrentClientDevice.iPod];
306
+ const isMobile = iosDevices.includes(getCurrentBrowser().device);
307
+ if (!checkForceDesktop) {
308
+ return isMobile;
309
+ }
310
+ const { userAgent, maxTouchPoints } = window.navigator;
311
+ return Boolean(isMobile || /macintosh/i.test(userAgent) && maxTouchPoints > 0);
312
+ };
313
+ const getIOSVersion = () => {
314
+ const { userAgent } = window.navigator;
315
+ const iosVersionMatch = userAgent.match(/Version\/(\d+(\.\d+)?)/i);
316
+ if (!iosVersionMatch) {
317
+ return null;
318
+ }
319
+ const versionString = iosVersionMatch[1];
320
+ const versionNumber = parseFloat(versionString);
321
+ if (isNaN(versionNumber)) {
322
+ return null;
323
+ }
324
+ return versionNumber;
325
+ };
326
+ const isMacLike = () => [exports.CurrentClientDevice.Mac, exports.CurrentClientDevice.iPhone, exports.CurrentClientDevice.iPad, exports.CurrentClientDevice.iPod].includes(getCurrentBrowser().device);
327
+
328
+ const getExponentialDelay = (errorsCount, { start = 0, factor = 2, max = Infinity, min = start, random = 0 } = {}) => {
329
+ let delay = start;
330
+ delay *= Math.pow(factor, errorsCount);
331
+ delay *= 1 + (Math.random() * random * 2 - random);
332
+ delay = Math.round(delay);
333
+ delay = Math.min(delay, max);
334
+ delay = Math.max(delay, min);
335
+ return delay;
336
+ };
337
+
338
+ var Storage;
339
+ (function (Storage) {
340
+ Storage[Storage["LOCAL_STORAGE"] = 0] = "LOCAL_STORAGE";
341
+ Storage[Storage["SESSION_STORAGE"] = 1] = "SESSION_STORAGE";
342
+ Storage[Storage["RUNTIME"] = 2] = "RUNTIME";
343
+ })(Storage || (Storage = {}));
344
+ let runtimeStorage;
345
+ let availableStorage;
346
+ const key = `vk-videoplayer-dummy-key-${Math.random()}`;
347
+ const getAvailable = () => {
348
+ if (availableStorage !== undefined) {
349
+ return availableStorage;
350
+ }
351
+ try {
352
+ localStorage.setItem(key, 'test');
353
+ localStorage.removeItem(key);
354
+ availableStorage = Storage.LOCAL_STORAGE;
355
+ }
356
+ catch (error) {
357
+ if (error instanceof DOMException || error instanceof TypeError) {
358
+ try {
359
+ sessionStorage.getItem(key);
360
+ availableStorage = Storage.SESSION_STORAGE;
361
+ }
362
+ catch (error) {
363
+ if (error instanceof DOMException || error instanceof TypeError) {
364
+ availableStorage = Storage.RUNTIME;
365
+ }
366
+ else {
367
+ throw error;
368
+ }
369
+ }
370
+ }
371
+ else {
372
+ throw error;
373
+ }
374
+ }
375
+ if (availableStorage === Storage.RUNTIME) {
376
+ runtimeStorage = new Map();
377
+ }
378
+ return availableStorage;
379
+ };
380
+ const isPersistent = () => getAvailable() === Storage.LOCAL_STORAGE;
381
+ const get$1 = (key) => {
382
+ var _a, _b;
383
+ const storage = getAvailable();
384
+ switch (storage) {
385
+ case Storage.LOCAL_STORAGE:
386
+ return (_a = localStorage.getItem(key)) !== null && _a !== void 0 ? _a : undefined;
387
+ case Storage.SESSION_STORAGE:
388
+ return (_b = sessionStorage.getItem(key)) !== null && _b !== void 0 ? _b : undefined;
389
+ case Storage.RUNTIME:
390
+ return runtimeStorage === null || runtimeStorage === void 0 ? void 0 : runtimeStorage.get(key);
391
+ default:
392
+ assertNever(storage);
393
+ }
394
+ };
395
+ const set$1 = (key, value) => {
396
+ const storage = getAvailable();
397
+ switch (storage) {
398
+ case Storage.LOCAL_STORAGE:
399
+ try {
400
+ localStorage.setItem(key, value);
401
+ }
402
+ catch (error) {
403
+ if (error instanceof DOMException) {
404
+ console.error(error); // eslint-disable-line no-console
405
+ }
406
+ else {
407
+ throw error;
408
+ }
409
+ }
410
+ break;
411
+ case Storage.SESSION_STORAGE:
412
+ try {
413
+ sessionStorage.setItem(key, value);
414
+ }
415
+ catch (error) {
416
+ if (error instanceof DOMException) {
417
+ console.error(error); // eslint-disable-line no-console
418
+ }
419
+ else {
420
+ throw error;
421
+ }
422
+ }
423
+ break;
424
+ case Storage.RUNTIME:
425
+ return void (runtimeStorage === null || runtimeStorage === void 0 ? void 0 : runtimeStorage.set(key, value));
426
+ default:
427
+ assertNever(storage);
428
+ }
429
+ };
430
+ const has$1 = (key) => {
431
+ var _a;
432
+ const storage = getAvailable();
433
+ switch (storage) {
434
+ case Storage.LOCAL_STORAGE:
435
+ return key in localStorage;
436
+ case Storage.SESSION_STORAGE:
437
+ return key in sessionStorage;
438
+ case Storage.RUNTIME:
439
+ return (_a = runtimeStorage === null || runtimeStorage === void 0 ? void 0 : runtimeStorage.has(key)) !== null && _a !== void 0 ? _a : false;
440
+ default:
441
+ assertNever(storage);
442
+ return false;
443
+ }
444
+ };
445
+ const remove = (key) => {
446
+ const storage = getAvailable();
447
+ switch (storage) {
448
+ case Storage.LOCAL_STORAGE:
449
+ return localStorage.removeItem(key);
450
+ case Storage.SESSION_STORAGE:
451
+ return sessionStorage.removeItem(key);
452
+ case Storage.RUNTIME:
453
+ return void (runtimeStorage === null || runtimeStorage === void 0 ? void 0 : runtimeStorage.delete(key));
454
+ default:
455
+ assertNever(storage);
456
+ }
457
+ };
458
+ const clear = () => {
459
+ const storage = getAvailable();
460
+ switch (storage) {
461
+ case Storage.LOCAL_STORAGE:
462
+ return localStorage.clear();
463
+ case Storage.SESSION_STORAGE:
464
+ return sessionStorage.clear();
465
+ case Storage.RUNTIME:
466
+ return runtimeStorage === null || runtimeStorage === void 0 ? void 0 : runtimeStorage.clear();
467
+ default:
468
+ assertNever(storage);
469
+ }
470
+ };
471
+
472
+ var iframeSafeStorage = /*#__PURE__*/Object.freeze({
473
+ __proto__: null,
474
+ clear: clear,
475
+ get: get$1,
476
+ has: has$1,
477
+ isPersistent: isPersistent,
478
+ remove: remove,
479
+ set: set$1
480
+ });
481
+
482
+ exports.VideoQuality = void 0;
483
+ (function (VideoQuality) {
484
+ // Служебный тип качества когда оно не известно (не путать с авто)
485
+ VideoQuality["INVARIANT"] = "Invariant quality";
486
+ VideoQuality["Q_144P"] = "144p";
487
+ VideoQuality["Q_240P"] = "240p";
488
+ VideoQuality["Q_360P"] = "360p";
489
+ VideoQuality["Q_480P"] = "480p";
490
+ VideoQuality["Q_720P"] = "720p";
491
+ VideoQuality["Q_1080P"] = "1080p";
492
+ VideoQuality["Q_1440P"] = "1440p";
493
+ VideoQuality["Q_2160P"] = "2160p";
494
+ VideoQuality["Q_4320P"] = "4320p";
495
+ })(exports.VideoQuality || (exports.VideoQuality = {}));
496
+
497
+ const videoQualitiesSizes = {
498
+ [exports.VideoQuality.Q_144P]: { width: 256, height: 144 },
499
+ [exports.VideoQuality.Q_240P]: { width: 428, height: 240 },
500
+ [exports.VideoQuality.Q_360P]: { width: 640, height: 360 },
501
+ [exports.VideoQuality.Q_480P]: { width: 856, height: 480 },
502
+ [exports.VideoQuality.Q_720P]: { width: 1280, height: 720 },
503
+ [exports.VideoQuality.Q_1080P]: { width: 1920, height: 1080 },
504
+ [exports.VideoQuality.Q_1440P]: { width: 2560, height: 1440 },
505
+ [exports.VideoQuality.Q_2160P]: { width: 3840, height: 2160 },
506
+ [exports.VideoQuality.Q_4320P]: { width: 7680, height: 4320 },
507
+ };
508
+ const isHigher = (a, b) => videoQualitiesSizes[a].height > videoQualitiesSizes[b].height;
509
+ const isHigherOrEqual = (a, b) => videoQualitiesSizes[a].height >= videoQualitiesSizes[b].height;
510
+ const isLower = (a, b) => videoQualitiesSizes[a].height < videoQualitiesSizes[b].height;
511
+ const isLowerOrEqual = (a, b) => videoQualitiesSizes[a].height <= videoQualitiesSizes[b].height;
512
+ const getHighestQuality = (qualities) => qualities.sort((a, b) => {
513
+ if (a === b) {
514
+ return 0;
515
+ }
516
+ if (a === exports.VideoQuality.INVARIANT) {
517
+ return 1;
518
+ }
519
+ if (b === exports.VideoQuality.INVARIANT) {
520
+ return -1;
521
+ }
522
+ return isLower(a, b) ? 1 : -1;
523
+ })[0];
524
+ const allExactAscending = Object.keys(videoQualitiesSizes).sort((a, b) => isLower(a, b) ? -1 : 1);
525
+ /**
526
+ * Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
527
+ * @param tolerance позволяет выбрать качество менее заданной высоты на величину погрешности (в процентах)
528
+ */
529
+ const videoHeightToQuality = (height, tolerance = 0.02) => {
530
+ const qualities = [...allExactAscending];
531
+ return qualities.find((quality) => videoQualitiesSizes[quality].height * (1 + tolerance) >= height);
532
+ };
533
+ /**
534
+ * Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
535
+ */
536
+ const videoSizeToQuality = ({ width, height }) => {
537
+ const min = Math.min(width, height);
538
+ const max = Math.max(width, height);
539
+ return allExactAscending.find(testQuality => {
540
+ const testSize = videoQualitiesSizes[testQuality];
541
+ return testSize.width >= max &&
542
+ testSize.height >= min;
543
+ });
544
+ };
545
+ const videoQualityToHeight = (quality) => videoQualitiesSizes[quality].height;
546
+ const isInvariantQuality = (quality) => quality === exports.VideoQuality.INVARIANT;
547
+ const areQualitiesExact = (qualities) => qualities.every(q => !isInvariantQuality(q));
548
+ function assertQualityIsExact(quality) {
549
+ if (isInvariantQuality(quality)) {
550
+ throw new Error('Expected exact quality');
551
+ }
552
+ }
553
+
554
+ const fillWithDefault = (partial, defaultConfig) => {
555
+ const fullConfig = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
556
+ for (const topLevelKey of Object.keys(defaultConfig)) {
557
+ const defaultValue = defaultConfig[topLevelKey];
558
+ const givenValue = partial[topLevelKey];
559
+ if (Array.isArray(defaultValue) && Array.isArray(givenValue)) {
560
+ fullConfig[topLevelKey] = givenValue;
561
+ }
562
+ else if (typeof defaultValue === 'object' && typeof givenValue === 'object') {
563
+ fullConfig[topLevelKey] = fillWithDefault(givenValue, defaultValue);
564
+ }
565
+ else {
566
+ fullConfig[topLevelKey] = topLevelKey in partial ? givenValue : defaultValue;
567
+ }
568
+ }
569
+ return fullConfig;
570
+ };
571
+
572
+ class ValueSubject extends Subject {
573
+ constructor(initialValue) {
574
+ super();
575
+ this.value = initialValue;
576
+ }
577
+ next(value) {
578
+ super.next(this.value = value);
579
+ }
580
+ error(value) {
581
+ super.error(this.value = value);
582
+ }
583
+ getValue() {
584
+ return this.value;
585
+ }
586
+ _subscribe(emitter) {
587
+ const result = super._subscribe(emitter);
588
+ emitter.next(this.value);
589
+ return result;
590
+ }
591
+ }
592
+
593
+ function combine(observables) {
594
+ return new Observable((emitter) => {
595
+ const values = {};
596
+ let missingValuesCount = Object.keys(observables).length;
597
+ const createKeyListener = (key) => (value) => {
598
+ if (!(key in values)) {
599
+ missingValuesCount--;
600
+ }
601
+ values[key] = value;
602
+ if (missingValuesCount === 0) {
603
+ emitter.next(values);
604
+ }
605
+ };
606
+ return Object.entries(observables).reduce((subscription, [key, observable]) => {
607
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
608
+ return subscription.add(observable.subscribe(createKeyListener(key)));
609
+ }, new Subscription());
610
+ });
611
+ }
612
+
613
+ /**
614
+ * Создаёт Observable, в который попадают все события исходных Observable (синхронно в момент возникновения)
615
+ */
616
+ function merge(...observables) {
617
+ return new Observable((emitter) => observables.reduce((subscription, it) => subscription.add(it.subscribe(emitter)), new Subscription()));
618
+ }
619
+
620
+ var timeout = (time) => new Observable((emitter) => {
621
+ const id = window.setTimeout(() => {
622
+ try {
623
+ emitter.next();
624
+ }
625
+ catch (e) {
626
+ if (emitter.error) {
627
+ emitter.error(e);
628
+ }
629
+ else {
630
+ throw e;
631
+ }
632
+ }
633
+ }, time);
634
+ return () => window.clearTimeout(id);
635
+ });
636
+
637
+ var interval = (time) => new Observable((emitter) => {
638
+ const id = window.setInterval(() => emitter.next(), time);
639
+ return () => window.clearInterval(id);
640
+ });
641
+
642
+ var observableFrom = (values) => new Observable((emitter) => {
643
+ values.forEach((it) => emitter.next(it));
644
+ });
645
+
646
+ var fromEvent = (target, eventName) => new Observable((emitter) => {
647
+ const listener = (e) => emitter.next(e); // eslint-disable-line @typescript-eslint/no-explicit-any
648
+ target.addEventListener(eventName, listener);
649
+ return () => target.removeEventListener(eventName, listener);
650
+ });
651
+
652
+ function buffer(size) {
653
+ return (o) => new Observable((emitter) => o.subscribe(new BufferEmitter(emitter, size)));
654
+ }
655
+ class BufferEmitter {
656
+ constructor(destination, size) {
657
+ this.destination = destination;
658
+ this.size = size;
659
+ this.lastValues = [];
660
+ }
661
+ next(value) {
662
+ if (this.lastValues.length === this.size) {
663
+ this.lastValues.shift();
664
+ }
665
+ this.lastValues.push(value);
666
+ this.destination.next(this.lastValues);
667
+ }
668
+ error(e) {
669
+ var _a, _b;
670
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
671
+ }
672
+ }
673
+
674
+ const defaultConfig$1 = {
675
+ leading: false,
676
+ trailing: true,
677
+ };
678
+ function debounce(time, config = defaultConfig$1) {
679
+ return (o) => new Observable((emitter) => o.subscribe(new DebounceEmitter(emitter, time, config)));
680
+ }
681
+ class DebounceEmitter {
682
+ constructor(destination, time, config) {
683
+ this.destination = destination;
684
+ this.time = time;
685
+ this.config = config;
686
+ }
687
+ next(value) {
688
+ this.lastValue = value;
689
+ if (isNonNullable(this.timeout)) {
690
+ window.clearTimeout(this.timeout);
691
+ }
692
+ else if (this.config.leading) {
693
+ this.destination.next(value);
694
+ }
695
+ this.timeout = window.setTimeout(() => {
696
+ if (this.config.trailing) {
697
+ try {
698
+ this.destination.next(this.lastValue); // eslint-disable-line @typescript-eslint/no-non-null-assertion
699
+ }
700
+ catch (e) {
701
+ if (this.destination.error) {
702
+ this.destination.error(e);
703
+ }
704
+ else {
705
+ throw e;
706
+ }
707
+ }
708
+ }
709
+ this.timeout = undefined;
710
+ }, this.time);
711
+ }
712
+ error(e) {
713
+ var _a, _b;
714
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
715
+ }
716
+ }
717
+
718
+ const defaultConfig = {
719
+ leading: true,
720
+ trailing: false,
721
+ };
722
+ function throttle(time, config = defaultConfig) {
723
+ return (o) => new Observable((emitter) => o.subscribe(new ThrottleEmitter(emitter, time, config)));
724
+ }
725
+ class ThrottleEmitter {
726
+ constructor(destination, time, config) {
727
+ this.destination = destination;
728
+ this.time = time;
729
+ this.config = config;
730
+ }
731
+ next(value) {
732
+ this.lastValue = value;
733
+ if (isNullable(this.timeout)) {
734
+ if (this.config.leading) {
735
+ this.destination.next(value);
736
+ }
737
+ this.timeout = window.setTimeout(() => {
738
+ if (this.config.trailing) {
739
+ this.destination.next(this.lastValue); // eslint-disable-line @typescript-eslint/no-non-null-assertion
740
+ }
741
+ this.timeout = undefined;
742
+ }, this.time);
743
+ }
744
+ }
745
+ error(e) {
746
+ var _a, _b;
747
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
748
+ }
749
+ }
750
+
751
+ /**
752
+ * Пропускает только те события, которые удовлетворяют предикату
753
+ */
754
+ function filter(predicate) {
755
+ return (o) => new Observable((emitter) => o.subscribe(new FilterEmitter(emitter, predicate)));
756
+ }
757
+ class FilterEmitter {
758
+ constructor(destination, predicate) {
759
+ this.destination = destination;
760
+ this.predicate = predicate;
761
+ }
762
+ next(value) {
763
+ let suitable;
764
+ try {
765
+ suitable = this.predicate(value);
766
+ }
767
+ catch (e) {
768
+ this.error(e);
769
+ throw e;
770
+ }
771
+ if (suitable) {
772
+ this.destination.next(value);
773
+ }
774
+ }
775
+ error(e) {
776
+ var _a, _b;
777
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
778
+ }
779
+ }
780
+
781
+ /**
782
+ * Пропускает только события, содержащие значения, отличные от предыдущего
783
+ */
784
+ function filterChanged(equal = (a, b) => a === b) {
785
+ return (o) => new Observable((emitter) => o.subscribe(new FilterChangedEmitter(emitter, equal)));
786
+ }
787
+ const NO_VALUE = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
788
+ class FilterChangedEmitter {
789
+ constructor(destination, predicate) {
790
+ this.destination = destination;
791
+ this.predicate = predicate;
792
+ this.lastValue = NO_VALUE;
793
+ }
794
+ next(value) {
795
+ let changed;
796
+ try {
797
+ changed = this.lastValue === NO_VALUE || !this.predicate(this.lastValue, value);
798
+ this.lastValue = value;
799
+ }
800
+ catch (e) {
801
+ this.error(e);
802
+ throw e;
803
+ }
804
+ if (changed) {
805
+ this.destination.next(value);
806
+ }
807
+ }
808
+ error(e) {
809
+ var _a, _b;
810
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
811
+ }
812
+ }
813
+
814
+ function map(mapper) {
815
+ return (o) => new Observable((emitter) => o.subscribe(new MapEmitter$1(emitter, mapper)));
816
+ }
817
+ let MapEmitter$1 = class MapEmitter {
818
+ constructor(destination, mapper) {
819
+ this.destination = destination;
820
+ this.mapper = mapper;
821
+ }
822
+ next(value) {
823
+ let result;
824
+ try {
825
+ result = this.mapper(value);
826
+ }
827
+ catch (e) {
828
+ this.error(e);
829
+ throw e;
830
+ }
831
+ this.destination.next(result);
832
+ }
833
+ error(value) {
834
+ var _a, _b;
835
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, value);
836
+ }
837
+ };
838
+
839
+ function mapTo(value) {
840
+ return map(() => value);
841
+ }
842
+
843
+ /**
844
+ * Отписывается от исходного потока после получения первого события.
845
+ */
846
+ function once() {
847
+ return (o) => new Observable((emitter) => {
848
+ let eventFired = false;
849
+ let subscriptionReady = false;
850
+ const subscription = o.subscribe((event) => {
851
+ if (!eventFired) {
852
+ eventFired = true;
853
+ emitter.next(event);
854
+ }
855
+ if (subscriptionReady) {
856
+ subscription.unsubscribe();
857
+ }
858
+ }, error => {
859
+ var _a;
860
+ eventFired = true;
861
+ (_a = emitter.error) === null || _a === void 0 ? void 0 : _a.call(emitter, error);
862
+ if (subscriptionReady) {
863
+ subscription.unsubscribe();
864
+ }
865
+ });
866
+ subscriptionReady = true;
867
+ if (eventFired) {
868
+ subscription.unsubscribe();
869
+ }
870
+ return subscription;
871
+ });
872
+ }
873
+
874
+ function pairwise() {
875
+ return (o) => new Observable((emitter) => o.subscribe(new PairwiseEmitter(emitter)));
876
+ }
877
+ class PairwiseEmitter {
878
+ constructor(destination) {
879
+ this.destination = destination;
880
+ this.hasLast = false;
881
+ }
882
+ next(value) {
883
+ const last = this.last;
884
+ this.last = value;
885
+ if (!this.hasLast) {
886
+ this.hasLast = true;
887
+ return;
888
+ }
889
+ this.destination.next([last, value]); // eslint-disable-line @typescript-eslint/no-non-null-assertion
890
+ }
891
+ error(value) {
892
+ var _a, _b;
893
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, value);
894
+ }
895
+ }
896
+
897
+ function tap(effect) {
898
+ return (o) => new Observable((emitter) => o.subscribe(new MapEmitter(emitter, effect)));
899
+ }
900
+ class MapEmitter {
901
+ constructor(destination, effect) {
902
+ this.destination = destination;
903
+ this.effect = effect;
904
+ }
905
+ next(value) {
906
+ try {
907
+ this.effect(value);
908
+ }
909
+ catch (e) {
910
+ this.error(e);
911
+ throw e;
912
+ }
913
+ this.destination.next(value);
914
+ }
915
+ error(value) {
916
+ var _a, _b;
917
+ (_b = (_a = this.destination).error) === null || _b === void 0 ? void 0 : _b.call(_a, value);
918
+ }
919
+ }
920
+
921
+ exports.ErrorCategory = void 0;
922
+ (function (ErrorCategory) {
923
+ ErrorCategory["NETWORK"] = "network";
924
+ ErrorCategory["VIDEO_PIPELINE"] = "video_pipeline";
925
+ ErrorCategory["EXTERNAL_API"] = "external_api";
926
+ ErrorCategory["PARSER"] = "parser";
927
+ ErrorCategory["DOM"] = "dom";
928
+ ErrorCategory["WTF"] = "wtf";
929
+ })(exports.ErrorCategory || (exports.ErrorCategory = {}));
930
+
931
+ class Emitter {
932
+ constructor() {
933
+ Object.defineProperty(this, 'listeners', { value: {}, writable: true, configurable: true });
934
+ }
935
+ addEventListener(type, callback, options) {
936
+ if (!(type in this.listeners)) {
937
+ this.listeners[type] = [];
938
+ }
939
+ this.listeners[type].push({ callback, options });
940
+ }
941
+ removeEventListener(type, callback) {
942
+ if (!(type in this.listeners)) {
943
+ return;
944
+ }
945
+ const stack = this.listeners[type];
946
+ for (let i = 0, l = stack.length; i < l; i++) {
947
+ if (stack[i].callback === callback) {
948
+ stack.splice(i, 1);
949
+ return;
950
+ }
951
+ }
952
+ }
953
+ dispatchEvent(event) {
954
+ if (!(event.type in this.listeners)) {
955
+ return;
956
+ }
957
+ const stack = this.listeners[event.type];
958
+ const stackToCall = stack.slice();
959
+ for (let i = 0, l = stackToCall.length; i < l; i++) {
960
+ const listener = stackToCall[i];
961
+ try {
962
+ listener.callback.call(this, event);
963
+ } catch (e) {
964
+ Promise.resolve().then(() => {
965
+ throw e;
966
+ });
967
+ }
968
+ if (listener.options && listener.options.once) {
969
+ this.removeEventListener(event.type, listener.callback);
970
+ }
971
+ }
972
+ return !event.defaultPrevented;
973
+ }
974
+ }
975
+
976
+ class AbortSignal extends Emitter {
977
+ constructor() {
978
+ super();
979
+ // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent
980
+ // constructor has failed to run, then "this.listeners" will still be undefined and then we call
981
+ // the parent constructor directly instead as a workaround. For general details, see babel bug:
982
+ // https://github.com/babel/babel/issues/3041
983
+ // This hack was added as a fix for the issue described here:
984
+ // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042
985
+ if (!this.listeners) {
986
+ Emitter.call(this);
987
+ }
988
+
989
+ // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and
990
+ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl
991
+ Object.defineProperty(this, 'aborted', { value: false, writable: true, configurable: true });
992
+ Object.defineProperty(this, 'onabort', { value: null, writable: true, configurable: true });
993
+ Object.defineProperty(this, 'reason', { value: undefined, writable: true, configurable: true });
994
+ }
995
+ toString() {
996
+ return '[object AbortSignal]';
997
+ }
998
+ dispatchEvent(event) {
999
+ if (event.type === 'abort') {
1000
+ this.aborted = true;
1001
+ if (typeof this.onabort === 'function') {
1002
+ this.onabort.call(this, event);
1003
+ }
1004
+ }
1005
+
1006
+ super.dispatchEvent(event);
1007
+ }
1008
+ }
1009
+
1010
+ class AbortController {
1011
+ constructor() {
1012
+ // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and
1013
+ // we want Object.keys(new AbortController()) to be [] for compat with the native impl
1014
+ Object.defineProperty(this, 'signal', { value: new AbortSignal(), writable: true, configurable: true });
1015
+ }
1016
+ abort(reason) {
1017
+ let event;
1018
+ try {
1019
+ event = new Event('abort');
1020
+ } catch (e) {
1021
+ if (typeof document !== 'undefined') {
1022
+ if (!document.createEvent) {
1023
+ // For Internet Explorer 8:
1024
+ event = document.createEventObject();
1025
+ event.type = 'abort';
1026
+ } else {
1027
+ // For Internet Explorer 11:
1028
+ event = document.createEvent('Event');
1029
+ event.initEvent('abort', false, false);
1030
+ }
1031
+ } else {
1032
+ // Fallback where document isn't available:
1033
+ event = {
1034
+ type: 'abort',
1035
+ bubbles: false,
1036
+ cancelable: false,
1037
+ };
1038
+ }
1039
+ }
1040
+
1041
+ let signalReason = reason;
1042
+ if (signalReason === undefined) {
1043
+ if (typeof document === 'undefined') {
1044
+ signalReason = new Error('This operation was aborted');
1045
+ signalReason.name = 'AbortError';
1046
+ } else {
1047
+ try {
1048
+ signalReason = new DOMException('signal is aborted without reason');
1049
+ } catch (err) {
1050
+ // IE 11 does not support calling the DOMException constructor, use a
1051
+ // regular error object on it instead.
1052
+ signalReason = new Error('This operation was aborted');
1053
+ signalReason.name = 'AbortError';
1054
+ }
1055
+ }
1056
+ }
1057
+ this.signal.reason = signalReason;
1058
+
1059
+ this.signal.dispatchEvent(event);
1060
+ }
1061
+ toString() {
1062
+ return '[object AbortController]';
1063
+ }
1064
+ }
1065
+
1066
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1067
+ // These are necessary to make sure that we get correct output for:
1068
+ // Object.prototype.toString.call(new AbortController())
1069
+ AbortController.prototype[Symbol.toStringTag] = 'AbortController';
1070
+ AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';
1071
+ }
1072
+
1073
+ function polyfillNeeded(self) {
1074
+ if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
1075
+ console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');
1076
+ return true;
1077
+ }
1078
+
1079
+ // Note that the "unfetch" minimal fetch polyfill defines fetch() without
1080
+ // defining window.Request, and this polyfill need to work on top of unfetch
1081
+ // so the below feature detection needs the !self.AbortController part.
1082
+ // The Request.prototype check is also needed because Safari versions 11.1.2
1083
+ // up to and including 12.1.x has a window.AbortController present but still
1084
+ // does NOT correctly implement abortable fetch:
1085
+ // https://bugs.webkit.org/show_bug.cgi?id=174980#c2
1086
+ return (
1087
+ (typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal')) || !self.AbortController
1088
+ );
1089
+ }
1090
+
1091
+ /**
1092
+ * Note: the "fetch.Request" default value is available for fetch imported from
1093
+ * the "node-fetch" package and not in browsers. This is OK since browsers
1094
+ * will be importing umd-polyfill.js from that path "self" is passed the
1095
+ * decorator so the default value will not be used (because browsers that define
1096
+ * fetch also has Request). One quirky setup where self.fetch exists but
1097
+ * self.Request does not is when the "unfetch" minimal fetch polyfill is used
1098
+ * on top of IE11; for this case the browser will try to use the fetch.Request
1099
+ * default value which in turn will be undefined but then then "if (Request)"
1100
+ * will ensure that you get a patched fetch but still no Request (as expected).
1101
+ * @param {fetch, Request = fetch.Request}
1102
+ * @returns {fetch: abortableFetch, Request: AbortableRequest}
1103
+ */
1104
+ function abortableFetchDecorator(patchTargets) {
1105
+ if ('function' === typeof patchTargets) {
1106
+ patchTargets = { fetch: patchTargets };
1107
+ }
1108
+ const {
1109
+ fetch,
1110
+ Request: NativeRequest = fetch.Request,
1111
+ AbortController: NativeAbortController,
1112
+ __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = false,
1113
+ } = patchTargets;
1114
+
1115
+ if (
1116
+ !polyfillNeeded({
1117
+ fetch,
1118
+ Request: NativeRequest,
1119
+ AbortController: NativeAbortController,
1120
+ __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,
1121
+ })
1122
+ ) {
1123
+ return { fetch, Request };
1124
+ }
1125
+
1126
+ let Request = NativeRequest;
1127
+ // Note that the "unfetch" minimal fetch polyfill defines fetch() without
1128
+ // defining window.Request, and this polyfill need to work on top of unfetch
1129
+ // hence we only patch it if it's available. Also we don't patch it if signal
1130
+ // is already available on the Request prototype because in this case support
1131
+ // is present and the patching below can cause a crash since it assigns to
1132
+ // request.signal which is technically a read-only property. This latter error
1133
+ // happens when you run the main5.js node-fetch example in the repo
1134
+ // "abortcontroller-polyfill-examples". The exact error is:
1135
+ // request.signal = init.signal;
1136
+ // ^
1137
+ // TypeError: Cannot set property signal of #<Request> which has only a getter
1138
+ if ((Request && !Request.prototype.hasOwnProperty('signal')) || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
1139
+ Request = function Request(input, init) {
1140
+ let signal;
1141
+ if (init && init.signal) {
1142
+ signal = init.signal;
1143
+ // Never pass init.signal to the native Request implementation when the polyfill has
1144
+ // been installed because if we're running on top of a browser with a
1145
+ // working native AbortController (i.e. the polyfill was installed due to
1146
+ // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our
1147
+ // fake AbortSignal to the native fetch will trigger:
1148
+ // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.
1149
+ delete init.signal;
1150
+ }
1151
+ const request = new NativeRequest(input, init);
1152
+ if (signal) {
1153
+ Object.defineProperty(request, 'signal', {
1154
+ writable: false,
1155
+ enumerable: false,
1156
+ configurable: true,
1157
+ value: signal,
1158
+ });
1159
+ }
1160
+ return request;
1161
+ };
1162
+ Request.prototype = NativeRequest.prototype;
1163
+ }
1164
+
1165
+ const realFetch = fetch;
1166
+ const abortableFetch = (input, init) => {
1167
+ const signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;
1168
+
1169
+ if (signal) {
1170
+ let abortError;
1171
+ try {
1172
+ abortError = new DOMException('Aborted', 'AbortError');
1173
+ } catch (err) {
1174
+ // IE 11 does not support calling the DOMException constructor, use a
1175
+ // regular error object on it instead.
1176
+ abortError = new Error('Aborted');
1177
+ abortError.name = 'AbortError';
1178
+ }
1179
+
1180
+ // Return early if already aborted, thus avoiding making an HTTP request
1181
+ if (signal.aborted) {
1182
+ return Promise.reject(abortError);
1183
+ }
1184
+
1185
+ // Turn an event into a promise, reject it once `abort` is dispatched
1186
+ const cancellation = new Promise((_, reject) => {
1187
+ signal.addEventListener('abort', () => reject(abortError), { once: true });
1188
+ });
1189
+
1190
+ if (init && init.signal) {
1191
+ // Never pass .signal to the native implementation when the polyfill has
1192
+ // been installed because if we're running on top of a browser with a
1193
+ // working native AbortController (i.e. the polyfill was installed due to
1194
+ // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our
1195
+ // fake AbortSignal to the native fetch will trigger:
1196
+ // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.
1197
+ delete init.signal;
1198
+ }
1199
+ // Return the fastest promise (don't need to wait for request to finish)
1200
+ return Promise.race([cancellation, realFetch(input, init)]);
1201
+ }
1202
+
1203
+ return realFetch(input, init);
1204
+ };
1205
+
1206
+ return { fetch: abortableFetch, Request };
1207
+ }
1208
+
1209
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
1210
+ // @ts-expect-error
1211
+ const needed = polyfillNeeded({
1212
+ fetch: window.fetch,
1213
+ Request: window.Request,
1214
+ AbortController: window.AbortController,
1215
+ });
1216
+ const polyfill = needed ? abortableFetchDecorator({
1217
+ fetch: window.fetch,
1218
+ Request: window.Request,
1219
+ AbortController: window.AbortController,
1220
+ }) : undefined;
1221
+ const fetch = needed ? polyfill.fetch : window.fetch;
1222
+ needed ? polyfill.Request : window.Request;
1223
+
1224
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1225
+
1226
+ function getDefaultExportFromCjs (x) {
1227
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1228
+ }
1229
+
1230
+ var fails$9 = function (exec) {
1231
+ try {
1232
+ return !!exec();
1233
+ } catch (error) {
1234
+ return true;
1235
+ }
1236
+ };
1237
+
1238
+ var fails$8 = fails$9;
1239
+
1240
+ var functionBindNative = !fails$8(function () {
1241
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
1242
+ var test = (function () { /* empty */ }).bind();
1243
+ // eslint-disable-next-line no-prototype-builtins -- safe
1244
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
1245
+ });
1246
+
1247
+ var NATIVE_BIND$3 = functionBindNative;
1248
+
1249
+ var FunctionPrototype$2 = Function.prototype;
1250
+ var call$9 = FunctionPrototype$2.call;
1251
+ var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$9, call$9);
1252
+
1253
+ var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) {
1254
+ return function () {
1255
+ return call$9.apply(fn, arguments);
1256
+ };
1257
+ };
1258
+
1259
+ var uncurryThis$8 = functionUncurryThis;
1260
+
1261
+ var toString$2 = uncurryThis$8({}.toString);
1262
+ var stringSlice = uncurryThis$8(''.slice);
1263
+
1264
+ var classofRaw$2 = function (it) {
1265
+ return stringSlice(toString$2(it), 8, -1);
1266
+ };
1267
+
1268
+ var uncurryThis$7 = functionUncurryThis;
1269
+ var fails$7 = fails$9;
1270
+ var classof$4 = classofRaw$2;
1271
+
1272
+ var $Object$4 = Object;
1273
+ var split = uncurryThis$7(''.split);
1274
+
1275
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
1276
+ var indexedObject = fails$7(function () {
1277
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
1278
+ // eslint-disable-next-line no-prototype-builtins -- safe
1279
+ return !$Object$4('z').propertyIsEnumerable(0);
1280
+ }) ? function (it) {
1281
+ return classof$4(it) == 'String' ? split(it, '') : $Object$4(it);
1282
+ } : $Object$4;
1283
+
1284
+ // we can't use just `it == null` since of `document.all` special case
1285
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
1286
+ var isNullOrUndefined$3 = function (it) {
1287
+ return it === null || it === undefined;
1288
+ };
1289
+
1290
+ var isNullOrUndefined$2 = isNullOrUndefined$3;
1291
+
1292
+ var $TypeError$7 = TypeError;
1293
+
1294
+ // `RequireObjectCoercible` abstract operation
1295
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
1296
+ var requireObjectCoercible$2 = function (it) {
1297
+ if (isNullOrUndefined$2(it)) throw $TypeError$7("Can't call method on " + it);
1298
+ return it;
1299
+ };
1300
+
1301
+ // toObject with fallback for non-array-like ES3 strings
1302
+ var IndexedObject = indexedObject;
1303
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
1304
+
1305
+ var toIndexedObject$5 = function (it) {
1306
+ return IndexedObject(requireObjectCoercible$1(it));
1307
+ };
1308
+
1309
+ var iterators = {};
1310
+
1311
+ var check = function (it) {
1312
+ return it && it.Math == Math && it;
1313
+ };
1314
+
1315
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
1316
+ var global$c =
1317
+ // eslint-disable-next-line es/no-global-this -- safe
1318
+ check(typeof globalThis == 'object' && globalThis) ||
1319
+ check(typeof window == 'object' && window) ||
1320
+ // eslint-disable-next-line no-restricted-globals -- safe
1321
+ check(typeof self == 'object' && self) ||
1322
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
1323
+ // eslint-disable-next-line no-new-func -- fallback
1324
+ (function () { return this; })() || commonjsGlobal || Function('return this')();
1325
+
1326
+ var documentAll$2 = typeof document == 'object' && document.all;
1327
+
1328
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
1329
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
1330
+ var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
1331
+
1332
+ var documentAll_1 = {
1333
+ all: documentAll$2,
1334
+ IS_HTMLDDA: IS_HTMLDDA
1335
+ };
1336
+
1337
+ var $documentAll$1 = documentAll_1;
1338
+
1339
+ var documentAll$1 = $documentAll$1.all;
1340
+
1341
+ // `IsCallable` abstract operation
1342
+ // https://tc39.es/ecma262/#sec-iscallable
1343
+ var isCallable$b = $documentAll$1.IS_HTMLDDA ? function (argument) {
1344
+ return typeof argument == 'function' || argument === documentAll$1;
1345
+ } : function (argument) {
1346
+ return typeof argument == 'function';
1347
+ };
1348
+
1349
+ var global$b = global$c;
1350
+ var isCallable$a = isCallable$b;
1351
+
1352
+ var WeakMap$1 = global$b.WeakMap;
1353
+
1354
+ var weakMapBasicDetection = isCallable$a(WeakMap$1) && /native code/.test(String(WeakMap$1));
1355
+
1356
+ var isCallable$9 = isCallable$b;
1357
+ var $documentAll = documentAll_1;
1358
+
1359
+ var documentAll = $documentAll.all;
1360
+
1361
+ var isObject$6 = $documentAll.IS_HTMLDDA ? function (it) {
1362
+ return typeof it == 'object' ? it !== null : isCallable$9(it) || it === documentAll;
1363
+ } : function (it) {
1364
+ return typeof it == 'object' ? it !== null : isCallable$9(it);
1365
+ };
1366
+
1367
+ var fails$6 = fails$9;
1368
+
1369
+ // Detect IE8's incomplete defineProperty implementation
1370
+ var descriptors = !fails$6(function () {
1371
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1372
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
1373
+ });
1374
+
1375
+ var objectDefineProperty = {};
1376
+
1377
+ var global$a = global$c;
1378
+ var isObject$5 = isObject$6;
1379
+
1380
+ var document$1 = global$a.document;
1381
+ // typeof document.createElement is 'object' in old IE
1382
+ var EXISTS$1 = isObject$5(document$1) && isObject$5(document$1.createElement);
1383
+
1384
+ var documentCreateElement$1 = function (it) {
1385
+ return EXISTS$1 ? document$1.createElement(it) : {};
1386
+ };
1387
+
1388
+ var DESCRIPTORS$6 = descriptors;
1389
+ var fails$5 = fails$9;
1390
+ var createElement = documentCreateElement$1;
1391
+
1392
+ // Thanks to IE8 for its funny defineProperty
1393
+ var ie8DomDefine = !DESCRIPTORS$6 && !fails$5(function () {
1394
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1395
+ return Object.defineProperty(createElement('div'), 'a', {
1396
+ get: function () { return 7; }
1397
+ }).a != 7;
1398
+ });
1399
+
1400
+ var DESCRIPTORS$5 = descriptors;
1401
+ var fails$4 = fails$9;
1402
+
1403
+ // V8 ~ Chrome 36-
1404
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
1405
+ var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$4(function () {
1406
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1407
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
1408
+ value: 42,
1409
+ writable: false
1410
+ }).prototype != 42;
1411
+ });
1412
+
1413
+ var isObject$4 = isObject$6;
1414
+
1415
+ var $String$2 = String;
1416
+ var $TypeError$6 = TypeError;
1417
+
1418
+ // `Assert: Type(argument) is Object`
1419
+ var anObject$6 = function (argument) {
1420
+ if (isObject$4(argument)) return argument;
1421
+ throw $TypeError$6($String$2(argument) + ' is not an object');
1422
+ };
1423
+
1424
+ var NATIVE_BIND$2 = functionBindNative;
1425
+
1426
+ var call$8 = Function.prototype.call;
1427
+
1428
+ var functionCall = NATIVE_BIND$2 ? call$8.bind(call$8) : function () {
1429
+ return call$8.apply(call$8, arguments);
1430
+ };
1431
+
1432
+ var path$3 = {};
1433
+
1434
+ var path$2 = path$3;
1435
+ var global$9 = global$c;
1436
+ var isCallable$8 = isCallable$b;
1437
+
1438
+ var aFunction = function (variable) {
1439
+ return isCallable$8(variable) ? variable : undefined;
1440
+ };
1441
+
1442
+ var getBuiltIn$2 = function (namespace, method) {
1443
+ return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(global$9[namespace])
1444
+ : path$2[namespace] && path$2[namespace][method] || global$9[namespace] && global$9[namespace][method];
1445
+ };
1446
+
1447
+ var uncurryThis$6 = functionUncurryThis;
1448
+
1449
+ var objectIsPrototypeOf = uncurryThis$6({}.isPrototypeOf);
1450
+
1451
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
1452
+
1453
+ var global$8 = global$c;
1454
+ var userAgent = engineUserAgent;
1455
+
1456
+ var process = global$8.process;
1457
+ var Deno = global$8.Deno;
1458
+ var versions = process && process.versions || Deno && Deno.version;
1459
+ var v8 = versions && versions.v8;
1460
+ var match, version;
1461
+
1462
+ if (v8) {
1463
+ match = v8.split('.');
1464
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
1465
+ // but their correct versions are not interesting for us
1466
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
1467
+ }
1468
+
1469
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
1470
+ // so check `userAgent` even if `.v8` exists, but 0
1471
+ if (!version && userAgent) {
1472
+ match = userAgent.match(/Edge\/(\d+)/);
1473
+ if (!match || match[1] >= 74) {
1474
+ match = userAgent.match(/Chrome\/(\d+)/);
1475
+ if (match) version = +match[1];
1476
+ }
1477
+ }
1478
+
1479
+ var engineV8Version = version;
1480
+
1481
+ /* eslint-disable es/no-symbol -- required for testing */
1482
+
1483
+ var V8_VERSION = engineV8Version;
1484
+ var fails$3 = fails$9;
1485
+ var global$7 = global$c;
1486
+
1487
+ var $String$1 = global$7.String;
1488
+
1489
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
1490
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$3(function () {
1491
+ var symbol = Symbol();
1492
+ // Chrome 38 Symbol has incorrect toString conversion
1493
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
1494
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
1495
+ // of course, fail.
1496
+ return !$String$1(symbol) || !(Object(symbol) instanceof Symbol) ||
1497
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
1498
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
1499
+ });
1500
+
1501
+ /* eslint-disable es/no-symbol -- required for testing */
1502
+
1503
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
1504
+
1505
+ var useSymbolAsUid = NATIVE_SYMBOL$1
1506
+ && !Symbol.sham
1507
+ && typeof Symbol.iterator == 'symbol';
1508
+
1509
+ var getBuiltIn$1 = getBuiltIn$2;
1510
+ var isCallable$7 = isCallable$b;
1511
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1512
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
1513
+
1514
+ var $Object$3 = Object;
1515
+
1516
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
1517
+ return typeof it == 'symbol';
1518
+ } : function (it) {
1519
+ var $Symbol = getBuiltIn$1('Symbol');
1520
+ return isCallable$7($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$3(it));
1521
+ };
1522
+
1523
+ var $String = String;
1524
+
1525
+ var tryToString$3 = function (argument) {
1526
+ try {
1527
+ return $String(argument);
1528
+ } catch (error) {
1529
+ return 'Object';
1530
+ }
1531
+ };
1532
+
1533
+ var isCallable$6 = isCallable$b;
1534
+ var tryToString$2 = tryToString$3;
1535
+
1536
+ var $TypeError$5 = TypeError;
1537
+
1538
+ // `Assert: IsCallable(argument) is true`
1539
+ var aCallable$3 = function (argument) {
1540
+ if (isCallable$6(argument)) return argument;
1541
+ throw $TypeError$5(tryToString$2(argument) + ' is not a function');
1542
+ };
1543
+
1544
+ var aCallable$2 = aCallable$3;
1545
+ var isNullOrUndefined$1 = isNullOrUndefined$3;
1546
+
1547
+ // `GetMethod` abstract operation
1548
+ // https://tc39.es/ecma262/#sec-getmethod
1549
+ var getMethod$3 = function (V, P) {
1550
+ var func = V[P];
1551
+ return isNullOrUndefined$1(func) ? undefined : aCallable$2(func);
1552
+ };
1553
+
1554
+ var call$7 = functionCall;
1555
+ var isCallable$5 = isCallable$b;
1556
+ var isObject$3 = isObject$6;
1557
+
1558
+ var $TypeError$4 = TypeError;
1559
+
1560
+ // `OrdinaryToPrimitive` abstract operation
1561
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
1562
+ var ordinaryToPrimitive$1 = function (input, pref) {
1563
+ var fn, val;
1564
+ if (pref === 'string' && isCallable$5(fn = input.toString) && !isObject$3(val = call$7(fn, input))) return val;
1565
+ if (isCallable$5(fn = input.valueOf) && !isObject$3(val = call$7(fn, input))) return val;
1566
+ if (pref !== 'string' && isCallable$5(fn = input.toString) && !isObject$3(val = call$7(fn, input))) return val;
1567
+ throw $TypeError$4("Can't convert object to primitive value");
1568
+ };
1569
+
1570
+ var shared$3 = {exports: {}};
1571
+
1572
+ var global$6 = global$c;
1573
+
1574
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1575
+ var defineProperty$1 = Object.defineProperty;
1576
+
1577
+ var defineGlobalProperty$1 = function (key, value) {
1578
+ try {
1579
+ defineProperty$1(global$6, key, { value: value, configurable: true, writable: true });
1580
+ } catch (error) {
1581
+ global$6[key] = value;
1582
+ } return value;
1583
+ };
1584
+
1585
+ var global$5 = global$c;
1586
+ var defineGlobalProperty = defineGlobalProperty$1;
1587
+
1588
+ var SHARED = '__core-js_shared__';
1589
+ var store$2 = global$5[SHARED] || defineGlobalProperty(SHARED, {});
1590
+
1591
+ var sharedStore = store$2;
1592
+
1593
+ var store$1 = sharedStore;
1594
+
1595
+ (shared$3.exports = function (key, value) {
1596
+ return store$1[key] || (store$1[key] = value !== undefined ? value : {});
1597
+ })('versions', []).push({
1598
+ version: '3.31.0',
1599
+ mode: 'pure' ,
1600
+ copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
1601
+ license: 'https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE',
1602
+ source: 'https://github.com/zloirock/core-js'
1603
+ });
1604
+
1605
+ var sharedExports = shared$3.exports;
1606
+
1607
+ var requireObjectCoercible = requireObjectCoercible$2;
1608
+
1609
+ var $Object$2 = Object;
1610
+
1611
+ // `ToObject` abstract operation
1612
+ // https://tc39.es/ecma262/#sec-toobject
1613
+ var toObject$2 = function (argument) {
1614
+ return $Object$2(requireObjectCoercible(argument));
1615
+ };
1616
+
1617
+ var uncurryThis$5 = functionUncurryThis;
1618
+ var toObject$1 = toObject$2;
1619
+
1620
+ var hasOwnProperty = uncurryThis$5({}.hasOwnProperty);
1621
+
1622
+ // `HasOwnProperty` abstract operation
1623
+ // https://tc39.es/ecma262/#sec-hasownproperty
1624
+ // eslint-disable-next-line es/no-object-hasown -- safe
1625
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
1626
+ return hasOwnProperty(toObject$1(it), key);
1627
+ };
1628
+
1629
+ var uncurryThis$4 = functionUncurryThis;
1630
+
1631
+ var id = 0;
1632
+ var postfix = Math.random();
1633
+ var toString$1 = uncurryThis$4(1.0.toString);
1634
+
1635
+ var uid$2 = function (key) {
1636
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
1637
+ };
1638
+
1639
+ var global$4 = global$c;
1640
+ var shared$2 = sharedExports;
1641
+ var hasOwn$7 = hasOwnProperty_1;
1642
+ var uid$1 = uid$2;
1643
+ var NATIVE_SYMBOL = symbolConstructorDetection;
1644
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
1645
+
1646
+ var Symbol$1 = global$4.Symbol;
1647
+ var WellKnownSymbolsStore = shared$2('wks');
1648
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
1649
+
1650
+ var wellKnownSymbol$9 = function (name) {
1651
+ if (!hasOwn$7(WellKnownSymbolsStore, name)) {
1652
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$7(Symbol$1, name)
1653
+ ? Symbol$1[name]
1654
+ : createWellKnownSymbol('Symbol.' + name);
1655
+ } return WellKnownSymbolsStore[name];
1656
+ };
1657
+
1658
+ var call$6 = functionCall;
1659
+ var isObject$2 = isObject$6;
1660
+ var isSymbol$1 = isSymbol$2;
1661
+ var getMethod$2 = getMethod$3;
1662
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
1663
+ var wellKnownSymbol$8 = wellKnownSymbol$9;
1664
+
1665
+ var $TypeError$3 = TypeError;
1666
+ var TO_PRIMITIVE = wellKnownSymbol$8('toPrimitive');
1667
+
1668
+ // `ToPrimitive` abstract operation
1669
+ // https://tc39.es/ecma262/#sec-toprimitive
1670
+ var toPrimitive$1 = function (input, pref) {
1671
+ if (!isObject$2(input) || isSymbol$1(input)) return input;
1672
+ var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
1673
+ var result;
1674
+ if (exoticToPrim) {
1675
+ if (pref === undefined) pref = 'default';
1676
+ result = call$6(exoticToPrim, input, pref);
1677
+ if (!isObject$2(result) || isSymbol$1(result)) return result;
1678
+ throw $TypeError$3("Can't convert object to primitive value");
1679
+ }
1680
+ if (pref === undefined) pref = 'number';
1681
+ return ordinaryToPrimitive(input, pref);
1682
+ };
1683
+
1684
+ var toPrimitive = toPrimitive$1;
1685
+ var isSymbol = isSymbol$2;
1686
+
1687
+ // `ToPropertyKey` abstract operation
1688
+ // https://tc39.es/ecma262/#sec-topropertykey
1689
+ var toPropertyKey$3 = function (argument) {
1690
+ var key = toPrimitive(argument, 'string');
1691
+ return isSymbol(key) ? key : key + '';
1692
+ };
1693
+
1694
+ var DESCRIPTORS$4 = descriptors;
1695
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
1696
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
1697
+ var anObject$5 = anObject$6;
1698
+ var toPropertyKey$2 = toPropertyKey$3;
1699
+
1700
+ var $TypeError$2 = TypeError;
1701
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1702
+ var $defineProperty = Object.defineProperty;
1703
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1704
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
1705
+ var ENUMERABLE = 'enumerable';
1706
+ var CONFIGURABLE$1 = 'configurable';
1707
+ var WRITABLE = 'writable';
1708
+
1709
+ // `Object.defineProperty` method
1710
+ // https://tc39.es/ecma262/#sec-object.defineproperty
1711
+ objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
1712
+ anObject$5(O);
1713
+ P = toPropertyKey$2(P);
1714
+ anObject$5(Attributes);
1715
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
1716
+ var current = $getOwnPropertyDescriptor$1(O, P);
1717
+ if (current && current[WRITABLE]) {
1718
+ O[P] = Attributes.value;
1719
+ Attributes = {
1720
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
1721
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
1722
+ writable: false
1723
+ };
1724
+ }
1725
+ } return $defineProperty(O, P, Attributes);
1726
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
1727
+ anObject$5(O);
1728
+ P = toPropertyKey$2(P);
1729
+ anObject$5(Attributes);
1730
+ if (IE8_DOM_DEFINE$1) try {
1731
+ return $defineProperty(O, P, Attributes);
1732
+ } catch (error) { /* empty */ }
1733
+ if ('get' in Attributes || 'set' in Attributes) throw $TypeError$2('Accessors not supported');
1734
+ if ('value' in Attributes) O[P] = Attributes.value;
1735
+ return O;
1736
+ };
1737
+
1738
+ var createPropertyDescriptor$4 = function (bitmap, value) {
1739
+ return {
1740
+ enumerable: !(bitmap & 1),
1741
+ configurable: !(bitmap & 2),
1742
+ writable: !(bitmap & 4),
1743
+ value: value
1744
+ };
1745
+ };
1746
+
1747
+ var DESCRIPTORS$3 = descriptors;
1748
+ var definePropertyModule$2 = objectDefineProperty;
1749
+ var createPropertyDescriptor$3 = createPropertyDescriptor$4;
1750
+
1751
+ var createNonEnumerableProperty$5 = DESCRIPTORS$3 ? function (object, key, value) {
1752
+ return definePropertyModule$2.f(object, key, createPropertyDescriptor$3(1, value));
1753
+ } : function (object, key, value) {
1754
+ object[key] = value;
1755
+ return object;
1756
+ };
1757
+
1758
+ var shared$1 = sharedExports;
1759
+ var uid = uid$2;
1760
+
1761
+ var keys = shared$1('keys');
1762
+
1763
+ var sharedKey$3 = function (key) {
1764
+ return keys[key] || (keys[key] = uid(key));
1765
+ };
1766
+
1767
+ var hiddenKeys$3 = {};
1768
+
1769
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
1770
+ var global$3 = global$c;
1771
+ var isObject$1 = isObject$6;
1772
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
1773
+ var hasOwn$6 = hasOwnProperty_1;
1774
+ var shared = sharedStore;
1775
+ var sharedKey$2 = sharedKey$3;
1776
+ var hiddenKeys$2 = hiddenKeys$3;
1777
+
1778
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1779
+ var TypeError$1 = global$3.TypeError;
1780
+ var WeakMap = global$3.WeakMap;
1781
+ var set, get, has;
1782
+
1783
+ var enforce = function (it) {
1784
+ return has(it) ? get(it) : set(it, {});
1785
+ };
1786
+
1787
+ var getterFor = function (TYPE) {
1788
+ return function (it) {
1789
+ var state;
1790
+ if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
1791
+ throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
1792
+ } return state;
1793
+ };
1794
+ };
1795
+
1796
+ if (NATIVE_WEAK_MAP || shared.state) {
1797
+ var store = shared.state || (shared.state = new WeakMap());
1798
+ /* eslint-disable no-self-assign -- prototype methods protection */
1799
+ store.get = store.get;
1800
+ store.has = store.has;
1801
+ store.set = store.set;
1802
+ /* eslint-enable no-self-assign -- prototype methods protection */
1803
+ set = function (it, metadata) {
1804
+ if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
1805
+ metadata.facade = it;
1806
+ store.set(it, metadata);
1807
+ return metadata;
1808
+ };
1809
+ get = function (it) {
1810
+ return store.get(it) || {};
1811
+ };
1812
+ has = function (it) {
1813
+ return store.has(it);
1814
+ };
1815
+ } else {
1816
+ var STATE = sharedKey$2('state');
1817
+ hiddenKeys$2[STATE] = true;
1818
+ set = function (it, metadata) {
1819
+ if (hasOwn$6(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
1820
+ metadata.facade = it;
1821
+ createNonEnumerableProperty$4(it, STATE, metadata);
1822
+ return metadata;
1823
+ };
1824
+ get = function (it) {
1825
+ return hasOwn$6(it, STATE) ? it[STATE] : {};
1826
+ };
1827
+ has = function (it) {
1828
+ return hasOwn$6(it, STATE);
1829
+ };
1830
+ }
1831
+
1832
+ var internalState = {
1833
+ set: set,
1834
+ get: get,
1835
+ has: has,
1836
+ enforce: enforce,
1837
+ getterFor: getterFor
1838
+ };
1839
+
1840
+ var NATIVE_BIND$1 = functionBindNative;
1841
+
1842
+ var FunctionPrototype$1 = Function.prototype;
1843
+ var apply$1 = FunctionPrototype$1.apply;
1844
+ var call$5 = FunctionPrototype$1.call;
1845
+
1846
+ // eslint-disable-next-line es/no-reflect -- safe
1847
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$5.bind(apply$1) : function () {
1848
+ return call$5.apply(apply$1, arguments);
1849
+ });
1850
+
1851
+ var classofRaw$1 = classofRaw$2;
1852
+ var uncurryThis$3 = functionUncurryThis;
1853
+
1854
+ var functionUncurryThisClause = function (fn) {
1855
+ // Nashorn bug:
1856
+ // https://github.com/zloirock/core-js/issues/1128
1857
+ // https://github.com/zloirock/core-js/issues/1130
1858
+ if (classofRaw$1(fn) === 'Function') return uncurryThis$3(fn);
1859
+ };
1860
+
1861
+ var objectGetOwnPropertyDescriptor = {};
1862
+
1863
+ var objectPropertyIsEnumerable = {};
1864
+
1865
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
1866
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1867
+ var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
1868
+
1869
+ // Nashorn ~ JDK8 bug
1870
+ var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
1871
+
1872
+ // `Object.prototype.propertyIsEnumerable` method implementation
1873
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
1874
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
1875
+ var descriptor = getOwnPropertyDescriptor$1(this, V);
1876
+ return !!descriptor && descriptor.enumerable;
1877
+ } : $propertyIsEnumerable;
1878
+
1879
+ var DESCRIPTORS$2 = descriptors;
1880
+ var call$4 = functionCall;
1881
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1882
+ var createPropertyDescriptor$2 = createPropertyDescriptor$4;
1883
+ var toIndexedObject$4 = toIndexedObject$5;
1884
+ var toPropertyKey$1 = toPropertyKey$3;
1885
+ var hasOwn$5 = hasOwnProperty_1;
1886
+ var IE8_DOM_DEFINE = ie8DomDefine;
1887
+
1888
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1889
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1890
+
1891
+ // `Object.getOwnPropertyDescriptor` method
1892
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
1893
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$2 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
1894
+ O = toIndexedObject$4(O);
1895
+ P = toPropertyKey$1(P);
1896
+ if (IE8_DOM_DEFINE) try {
1897
+ return $getOwnPropertyDescriptor(O, P);
1898
+ } catch (error) { /* empty */ }
1899
+ if (hasOwn$5(O, P)) return createPropertyDescriptor$2(!call$4(propertyIsEnumerableModule.f, O, P), O[P]);
1900
+ };
1901
+
1902
+ var fails$2 = fails$9;
1903
+ var isCallable$4 = isCallable$b;
1904
+
1905
+ var replacement = /#|\.prototype\./;
1906
+
1907
+ var isForced$1 = function (feature, detection) {
1908
+ var value = data[normalize(feature)];
1909
+ return value == POLYFILL ? true
1910
+ : value == NATIVE ? false
1911
+ : isCallable$4(detection) ? fails$2(detection)
1912
+ : !!detection;
1913
+ };
1914
+
1915
+ var normalize = isForced$1.normalize = function (string) {
1916
+ return String(string).replace(replacement, '.').toLowerCase();
1917
+ };
1918
+
1919
+ var data = isForced$1.data = {};
1920
+ var NATIVE = isForced$1.NATIVE = 'N';
1921
+ var POLYFILL = isForced$1.POLYFILL = 'P';
1922
+
1923
+ var isForced_1 = isForced$1;
1924
+
1925
+ var uncurryThis$2 = functionUncurryThisClause;
1926
+ var aCallable$1 = aCallable$3;
1927
+ var NATIVE_BIND = functionBindNative;
1928
+
1929
+ var bind$2 = uncurryThis$2(uncurryThis$2.bind);
1930
+
1931
+ // optional / simple context binding
1932
+ var functionBindContext = function (fn, that) {
1933
+ aCallable$1(fn);
1934
+ return that === undefined ? fn : NATIVE_BIND ? bind$2(fn, that) : function (/* ...args */) {
1935
+ return fn.apply(that, arguments);
1936
+ };
1937
+ };
1938
+
1939
+ var global$2 = global$c;
1940
+ var apply = functionApply;
1941
+ var uncurryThis$1 = functionUncurryThisClause;
1942
+ var isCallable$3 = isCallable$b;
1943
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1944
+ var isForced = isForced_1;
1945
+ var path$1 = path$3;
1946
+ var bind$1 = functionBindContext;
1947
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
1948
+ var hasOwn$4 = hasOwnProperty_1;
1949
+
1950
+ var wrapConstructor = function (NativeConstructor) {
1951
+ var Wrapper = function (a, b, c) {
1952
+ if (this instanceof Wrapper) {
1953
+ switch (arguments.length) {
1954
+ case 0: return new NativeConstructor();
1955
+ case 1: return new NativeConstructor(a);
1956
+ case 2: return new NativeConstructor(a, b);
1957
+ } return new NativeConstructor(a, b, c);
1958
+ } return apply(NativeConstructor, this, arguments);
1959
+ };
1960
+ Wrapper.prototype = NativeConstructor.prototype;
1961
+ return Wrapper;
1962
+ };
1963
+
1964
+ /*
1965
+ options.target - name of the target object
1966
+ options.global - target is the global object
1967
+ options.stat - export as static methods of target
1968
+ options.proto - export as prototype methods of target
1969
+ options.real - real prototype method for the `pure` version
1970
+ options.forced - export even if the native feature is available
1971
+ options.bind - bind methods to the target, required for the `pure` version
1972
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1973
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1974
+ options.sham - add a flag to not completely full polyfills
1975
+ options.enumerable - export as enumerable property
1976
+ options.dontCallGetSet - prevent calling a getter on target
1977
+ options.name - the .name of the function if it does not match the key
1978
+ */
1979
+ var _export = function (options, source) {
1980
+ var TARGET = options.target;
1981
+ var GLOBAL = options.global;
1982
+ var STATIC = options.stat;
1983
+ var PROTO = options.proto;
1984
+
1985
+ var nativeSource = GLOBAL ? global$2 : STATIC ? global$2[TARGET] : (global$2[TARGET] || {}).prototype;
1986
+
1987
+ var target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty$3(path$1, TARGET, {})[TARGET];
1988
+ var targetPrototype = target.prototype;
1989
+
1990
+ var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
1991
+ var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
1992
+
1993
+ for (key in source) {
1994
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1995
+ // contains in native
1996
+ USE_NATIVE = !FORCED && nativeSource && hasOwn$4(nativeSource, key);
1997
+
1998
+ targetProperty = target[key];
1999
+
2000
+ if (USE_NATIVE) if (options.dontCallGetSet) {
2001
+ descriptor = getOwnPropertyDescriptor(nativeSource, key);
2002
+ nativeProperty = descriptor && descriptor.value;
2003
+ } else nativeProperty = nativeSource[key];
2004
+
2005
+ // export native or implementation
2006
+ sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
2007
+
2008
+ if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
2009
+
2010
+ // bind methods to global for calling from export context
2011
+ if (options.bind && USE_NATIVE) resultProperty = bind$1(sourceProperty, global$2);
2012
+ // wrap global constructors for prevent changes in this version
2013
+ else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
2014
+ // make static versions for prototype methods
2015
+ else if (PROTO && isCallable$3(sourceProperty)) resultProperty = uncurryThis$1(sourceProperty);
2016
+ // default case
2017
+ else resultProperty = sourceProperty;
2018
+
2019
+ // add a flag to not completely full polyfills
2020
+ if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
2021
+ createNonEnumerableProperty$3(resultProperty, 'sham', true);
2022
+ }
2023
+
2024
+ createNonEnumerableProperty$3(target, key, resultProperty);
2025
+
2026
+ if (PROTO) {
2027
+ VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
2028
+ if (!hasOwn$4(path$1, VIRTUAL_PROTOTYPE)) {
2029
+ createNonEnumerableProperty$3(path$1, VIRTUAL_PROTOTYPE, {});
2030
+ }
2031
+ // export virtual prototype methods
2032
+ createNonEnumerableProperty$3(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty);
2033
+ // export real prototype methods
2034
+ if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) {
2035
+ createNonEnumerableProperty$3(targetPrototype, key, sourceProperty);
2036
+ }
2037
+ }
2038
+ }
2039
+ };
2040
+
2041
+ var DESCRIPTORS$1 = descriptors;
2042
+ var hasOwn$3 = hasOwnProperty_1;
2043
+
2044
+ var FunctionPrototype = Function.prototype;
2045
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2046
+ var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
2047
+
2048
+ var EXISTS = hasOwn$3(FunctionPrototype, 'name');
2049
+ // additional protection from minified / mangled / dropped function names
2050
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
2051
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
2052
+
2053
+ var functionName = {
2054
+ EXISTS: EXISTS,
2055
+ PROPER: PROPER,
2056
+ CONFIGURABLE: CONFIGURABLE
2057
+ };
2058
+
2059
+ var objectDefineProperties = {};
2060
+
2061
+ var ceil = Math.ceil;
2062
+ var floor = Math.floor;
2063
+
2064
+ // `Math.trunc` method
2065
+ // https://tc39.es/ecma262/#sec-math.trunc
2066
+ // eslint-disable-next-line es/no-math-trunc -- safe
2067
+ var mathTrunc = Math.trunc || function trunc(x) {
2068
+ var n = +x;
2069
+ return (n > 0 ? floor : ceil)(n);
2070
+ };
2071
+
2072
+ var trunc = mathTrunc;
2073
+
2074
+ // `ToIntegerOrInfinity` abstract operation
2075
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
2076
+ var toIntegerOrInfinity$2 = function (argument) {
2077
+ var number = +argument;
2078
+ // eslint-disable-next-line no-self-compare -- NaN check
2079
+ return number !== number || number === 0 ? 0 : trunc(number);
2080
+ };
2081
+
2082
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
2083
+
2084
+ var max = Math.max;
2085
+ var min$1 = Math.min;
2086
+
2087
+ // Helper for a popular repeating case of the spec:
2088
+ // Let integer be ? ToInteger(index).
2089
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
2090
+ var toAbsoluteIndex$1 = function (index, length) {
2091
+ var integer = toIntegerOrInfinity$1(index);
2092
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
2093
+ };
2094
+
2095
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
2096
+
2097
+ var min = Math.min;
2098
+
2099
+ // `ToLength` abstract operation
2100
+ // https://tc39.es/ecma262/#sec-tolength
2101
+ var toLength$1 = function (argument) {
2102
+ return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
2103
+ };
2104
+
2105
+ var toLength = toLength$1;
2106
+
2107
+ // `LengthOfArrayLike` abstract operation
2108
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
2109
+ var lengthOfArrayLike$2 = function (obj) {
2110
+ return toLength(obj.length);
2111
+ };
2112
+
2113
+ var toIndexedObject$3 = toIndexedObject$5;
2114
+ var toAbsoluteIndex = toAbsoluteIndex$1;
2115
+ var lengthOfArrayLike$1 = lengthOfArrayLike$2;
2116
+
2117
+ // `Array.prototype.{ indexOf, includes }` methods implementation
2118
+ var createMethod = function (IS_INCLUDES) {
2119
+ return function ($this, el, fromIndex) {
2120
+ var O = toIndexedObject$3($this);
2121
+ var length = lengthOfArrayLike$1(O);
2122
+ var index = toAbsoluteIndex(fromIndex, length);
2123
+ var value;
2124
+ // Array#includes uses SameValueZero equality algorithm
2125
+ // eslint-disable-next-line no-self-compare -- NaN check
2126
+ if (IS_INCLUDES && el != el) while (length > index) {
2127
+ value = O[index++];
2128
+ // eslint-disable-next-line no-self-compare -- NaN check
2129
+ if (value != value) return true;
2130
+ // Array#indexOf ignores holes, Array#includes - not
2131
+ } else for (;length > index; index++) {
2132
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
2133
+ } return !IS_INCLUDES && -1;
2134
+ };
2135
+ };
2136
+
2137
+ var arrayIncludes = {
2138
+ // `Array.prototype.includes` method
2139
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2140
+ includes: createMethod(true),
2141
+ // `Array.prototype.indexOf` method
2142
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
2143
+ indexOf: createMethod(false)
2144
+ };
2145
+
2146
+ var uncurryThis = functionUncurryThis;
2147
+ var hasOwn$2 = hasOwnProperty_1;
2148
+ var toIndexedObject$2 = toIndexedObject$5;
2149
+ var indexOf = arrayIncludes.indexOf;
2150
+ var hiddenKeys$1 = hiddenKeys$3;
2151
+
2152
+ var push = uncurryThis([].push);
2153
+
2154
+ var objectKeysInternal = function (object, names) {
2155
+ var O = toIndexedObject$2(object);
2156
+ var i = 0;
2157
+ var result = [];
2158
+ var key;
2159
+ for (key in O) !hasOwn$2(hiddenKeys$1, key) && hasOwn$2(O, key) && push(result, key);
2160
+ // Don't enum bug & hidden keys
2161
+ while (names.length > i) if (hasOwn$2(O, key = names[i++])) {
2162
+ ~indexOf(result, key) || push(result, key);
2163
+ }
2164
+ return result;
2165
+ };
2166
+
2167
+ // IE8- don't enum bug keys
2168
+ var enumBugKeys$2 = [
2169
+ 'constructor',
2170
+ 'hasOwnProperty',
2171
+ 'isPrototypeOf',
2172
+ 'propertyIsEnumerable',
2173
+ 'toLocaleString',
2174
+ 'toString',
2175
+ 'valueOf'
2176
+ ];
2177
+
2178
+ var internalObjectKeys = objectKeysInternal;
2179
+ var enumBugKeys$1 = enumBugKeys$2;
2180
+
2181
+ // `Object.keys` method
2182
+ // https://tc39.es/ecma262/#sec-object.keys
2183
+ // eslint-disable-next-line es/no-object-keys -- safe
2184
+ var objectKeys$1 = Object.keys || function keys(O) {
2185
+ return internalObjectKeys(O, enumBugKeys$1);
2186
+ };
2187
+
2188
+ var DESCRIPTORS = descriptors;
2189
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
2190
+ var definePropertyModule$1 = objectDefineProperty;
2191
+ var anObject$4 = anObject$6;
2192
+ var toIndexedObject$1 = toIndexedObject$5;
2193
+ var objectKeys = objectKeys$1;
2194
+
2195
+ // `Object.defineProperties` method
2196
+ // https://tc39.es/ecma262/#sec-object.defineproperties
2197
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
2198
+ objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
2199
+ anObject$4(O);
2200
+ var props = toIndexedObject$1(Properties);
2201
+ var keys = objectKeys(Properties);
2202
+ var length = keys.length;
2203
+ var index = 0;
2204
+ var key;
2205
+ while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
2206
+ return O;
2207
+ };
2208
+
2209
+ var getBuiltIn = getBuiltIn$2;
2210
+
2211
+ var html$1 = getBuiltIn('document', 'documentElement');
2212
+
2213
+ /* global ActiveXObject -- old IE, WSH */
2214
+
2215
+ var anObject$3 = anObject$6;
2216
+ var definePropertiesModule = objectDefineProperties;
2217
+ var enumBugKeys = enumBugKeys$2;
2218
+ var hiddenKeys = hiddenKeys$3;
2219
+ var html = html$1;
2220
+ var documentCreateElement = documentCreateElement$1;
2221
+ var sharedKey$1 = sharedKey$3;
2222
+
2223
+ var GT = '>';
2224
+ var LT = '<';
2225
+ var PROTOTYPE = 'prototype';
2226
+ var SCRIPT = 'script';
2227
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
2228
+
2229
+ var EmptyConstructor = function () { /* empty */ };
2230
+
2231
+ var scriptTag = function (content) {
2232
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2233
+ };
2234
+
2235
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2236
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
2237
+ activeXDocument.write(scriptTag(''));
2238
+ activeXDocument.close();
2239
+ var temp = activeXDocument.parentWindow.Object;
2240
+ activeXDocument = null; // avoid memory leak
2241
+ return temp;
2242
+ };
2243
+
2244
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
2245
+ var NullProtoObjectViaIFrame = function () {
2246
+ // Thrash, waste and sodomy: IE GC bug
2247
+ var iframe = documentCreateElement('iframe');
2248
+ var JS = 'java' + SCRIPT + ':';
2249
+ var iframeDocument;
2250
+ iframe.style.display = 'none';
2251
+ html.appendChild(iframe);
2252
+ // https://github.com/zloirock/core-js/issues/475
2253
+ iframe.src = String(JS);
2254
+ iframeDocument = iframe.contentWindow.document;
2255
+ iframeDocument.open();
2256
+ iframeDocument.write(scriptTag('document.F=Object'));
2257
+ iframeDocument.close();
2258
+ return iframeDocument.F;
2259
+ };
2260
+
2261
+ // Check for document.domain and active x support
2262
+ // No need to use active x approach when document.domain is not set
2263
+ // see https://github.com/es-shims/es5-shim/issues/150
2264
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2265
+ // avoid IE GC bug
2266
+ var activeXDocument;
2267
+ var NullProtoObject = function () {
2268
+ try {
2269
+ activeXDocument = new ActiveXObject('htmlfile');
2270
+ } catch (error) { /* ignore */ }
2271
+ NullProtoObject = typeof document != 'undefined'
2272
+ ? document.domain && activeXDocument
2273
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2274
+ : NullProtoObjectViaIFrame()
2275
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
2276
+ var length = enumBugKeys.length;
2277
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2278
+ return NullProtoObject();
2279
+ };
2280
+
2281
+ hiddenKeys[IE_PROTO$1] = true;
2282
+
2283
+ // `Object.create` method
2284
+ // https://tc39.es/ecma262/#sec-object.create
2285
+ // eslint-disable-next-line es/no-object-create -- safe
2286
+ var objectCreate = Object.create || function create(O, Properties) {
2287
+ var result;
2288
+ if (O !== null) {
2289
+ EmptyConstructor[PROTOTYPE] = anObject$3(O);
2290
+ result = new EmptyConstructor();
2291
+ EmptyConstructor[PROTOTYPE] = null;
2292
+ // add "__proto__" for Object.getPrototypeOf polyfill
2293
+ result[IE_PROTO$1] = O;
2294
+ } else result = NullProtoObject();
2295
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2296
+ };
2297
+
2298
+ var fails$1 = fails$9;
2299
+
2300
+ var correctPrototypeGetter = !fails$1(function () {
2301
+ function F() { /* empty */ }
2302
+ F.prototype.constructor = null;
2303
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
2304
+ return Object.getPrototypeOf(new F()) !== F.prototype;
2305
+ });
2306
+
2307
+ var hasOwn$1 = hasOwnProperty_1;
2308
+ var isCallable$2 = isCallable$b;
2309
+ var toObject = toObject$2;
2310
+ var sharedKey = sharedKey$3;
2311
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
2312
+
2313
+ var IE_PROTO = sharedKey('IE_PROTO');
2314
+ var $Object$1 = Object;
2315
+ var ObjectPrototype = $Object$1.prototype;
2316
+
2317
+ // `Object.getPrototypeOf` method
2318
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
2319
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
2320
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
2321
+ var object = toObject(O);
2322
+ if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
2323
+ var constructor = object.constructor;
2324
+ if (isCallable$2(constructor) && object instanceof constructor) {
2325
+ return constructor.prototype;
2326
+ } return object instanceof $Object$1 ? ObjectPrototype : null;
2327
+ };
2328
+
2329
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
2330
+
2331
+ var defineBuiltIn$2 = function (target, key, value, options) {
2332
+ if (options && options.enumerable) target[key] = value;
2333
+ else createNonEnumerableProperty$2(target, key, value);
2334
+ return target;
2335
+ };
2336
+
2337
+ var fails = fails$9;
2338
+ var isCallable$1 = isCallable$b;
2339
+ var isObject = isObject$6;
2340
+ var create$1 = objectCreate;
2341
+ var getPrototypeOf$1 = objectGetPrototypeOf;
2342
+ var defineBuiltIn$1 = defineBuiltIn$2;
2343
+ var wellKnownSymbol$7 = wellKnownSymbol$9;
2344
+
2345
+ var ITERATOR$3 = wellKnownSymbol$7('iterator');
2346
+ var BUGGY_SAFARI_ITERATORS$1 = false;
2347
+
2348
+ // `%IteratorPrototype%` object
2349
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
2350
+ var IteratorPrototype$1, PrototypeOfArrayIteratorPrototype, arrayIterator;
2351
+
2352
+ /* eslint-disable es/no-array-prototype-keys -- safe */
2353
+ if ([].keys) {
2354
+ arrayIterator = [].keys();
2355
+ // Safari 8 has buggy iterators w/o `next`
2356
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
2357
+ else {
2358
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
2359
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$1 = PrototypeOfArrayIteratorPrototype;
2360
+ }
2361
+ }
2362
+
2363
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$1) || fails(function () {
2364
+ var test = {};
2365
+ // FF44- legacy iterators case
2366
+ return IteratorPrototype$1[ITERATOR$3].call(test) !== test;
2367
+ });
2368
+
2369
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$1 = {};
2370
+ else IteratorPrototype$1 = create$1(IteratorPrototype$1);
2371
+
2372
+ // `%IteratorPrototype%[@@iterator]()` method
2373
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
2374
+ if (!isCallable$1(IteratorPrototype$1[ITERATOR$3])) {
2375
+ defineBuiltIn$1(IteratorPrototype$1, ITERATOR$3, function () {
2376
+ return this;
2377
+ });
2378
+ }
2379
+
2380
+ var iteratorsCore = {
2381
+ IteratorPrototype: IteratorPrototype$1,
2382
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
2383
+ };
2384
+
2385
+ var wellKnownSymbol$6 = wellKnownSymbol$9;
2386
+
2387
+ var TO_STRING_TAG$3 = wellKnownSymbol$6('toStringTag');
2388
+ var test = {};
2389
+
2390
+ test[TO_STRING_TAG$3] = 'z';
2391
+
2392
+ var toStringTagSupport = String(test) === '[object z]';
2393
+
2394
+ var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport;
2395
+ var isCallable = isCallable$b;
2396
+ var classofRaw = classofRaw$2;
2397
+ var wellKnownSymbol$5 = wellKnownSymbol$9;
2398
+
2399
+ var TO_STRING_TAG$2 = wellKnownSymbol$5('toStringTag');
2400
+ var $Object = Object;
2401
+
2402
+ // ES3 wrong here
2403
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2404
+
2405
+ // fallback for IE11 Script Access Denied error
2406
+ var tryGet = function (it, key) {
2407
+ try {
2408
+ return it[key];
2409
+ } catch (error) { /* empty */ }
2410
+ };
2411
+
2412
+ // getting tag from ES6+ `Object.prototype.toString`
2413
+ var classof$3 = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) {
2414
+ var O, tag, result;
2415
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
2416
+ // @@toStringTag case
2417
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$2)) == 'string' ? tag
2418
+ // builtinTag case
2419
+ : CORRECT_ARGUMENTS ? classofRaw(O)
2420
+ // ES3 arguments fallback
2421
+ : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2422
+ };
2423
+
2424
+ var TO_STRING_TAG_SUPPORT$1 = toStringTagSupport;
2425
+ var classof$2 = classof$3;
2426
+
2427
+ // `Object.prototype.toString` method implementation
2428
+ // https://tc39.es/ecma262/#sec-object.prototype.tostring
2429
+ var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString() {
2430
+ return '[object ' + classof$2(this) + ']';
2431
+ };
2432
+
2433
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
2434
+ var defineProperty = objectDefineProperty.f;
2435
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
2436
+ var hasOwn = hasOwnProperty_1;
2437
+ var toString = objectToString;
2438
+ var wellKnownSymbol$4 = wellKnownSymbol$9;
2439
+
2440
+ var TO_STRING_TAG$1 = wellKnownSymbol$4('toStringTag');
2441
+
2442
+ var setToStringTag$2 = function (it, TAG, STATIC, SET_METHOD) {
2443
+ if (it) {
2444
+ var target = STATIC ? it : it.prototype;
2445
+ if (!hasOwn(target, TO_STRING_TAG$1)) {
2446
+ defineProperty(target, TO_STRING_TAG$1, { configurable: true, value: TAG });
2447
+ }
2448
+ if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2449
+ createNonEnumerableProperty$1(target, 'toString', toString);
2450
+ }
2451
+ }
2452
+ };
2453
+
2454
+ var IteratorPrototype = iteratorsCore.IteratorPrototype;
2455
+ var create = objectCreate;
2456
+ var createPropertyDescriptor$1 = createPropertyDescriptor$4;
2457
+ var setToStringTag$1 = setToStringTag$2;
2458
+ var Iterators$5 = iterators;
2459
+
2460
+ var returnThis$1 = function () { return this; };
2461
+
2462
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
2463
+ var TO_STRING_TAG = NAME + ' Iterator';
2464
+ IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor$1(+!ENUMERABLE_NEXT, next) });
2465
+ setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false, true);
2466
+ Iterators$5[TO_STRING_TAG] = returnThis$1;
2467
+ return IteratorConstructor;
2468
+ };
2469
+
2470
+ var $$1 = _export;
2471
+ var call$3 = functionCall;
2472
+ var FunctionName = functionName;
2473
+ var createIteratorConstructor = iteratorCreateConstructor;
2474
+ var getPrototypeOf = objectGetPrototypeOf;
2475
+ var setToStringTag = setToStringTag$2;
2476
+ var defineBuiltIn = defineBuiltIn$2;
2477
+ var wellKnownSymbol$3 = wellKnownSymbol$9;
2478
+ var Iterators$4 = iterators;
2479
+ var IteratorsCore = iteratorsCore;
2480
+
2481
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
2482
+ FunctionName.CONFIGURABLE;
2483
+ IteratorsCore.IteratorPrototype;
2484
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
2485
+ var ITERATOR$2 = wellKnownSymbol$3('iterator');
2486
+ var KEYS = 'keys';
2487
+ var VALUES = 'values';
2488
+ var ENTRIES = 'entries';
2489
+
2490
+ var returnThis = function () { return this; };
2491
+
2492
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
2493
+ createIteratorConstructor(IteratorConstructor, NAME, next);
2494
+
2495
+ var getIterationMethod = function (KIND) {
2496
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
2497
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
2498
+ switch (KIND) {
2499
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
2500
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
2501
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
2502
+ } return function () { return new IteratorConstructor(this); };
2503
+ };
2504
+
2505
+ var TO_STRING_TAG = NAME + ' Iterator';
2506
+ var INCORRECT_VALUES_NAME = false;
2507
+ var IterablePrototype = Iterable.prototype;
2508
+ var nativeIterator = IterablePrototype[ITERATOR$2]
2509
+ || IterablePrototype['@@iterator']
2510
+ || DEFAULT && IterablePrototype[DEFAULT];
2511
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
2512
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
2513
+ var CurrentIteratorPrototype, methods, KEY;
2514
+
2515
+ // fix native
2516
+ if (anyNativeIterator) {
2517
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
2518
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
2519
+ // Set @@toStringTag to native iterators
2520
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
2521
+ Iterators$4[TO_STRING_TAG] = returnThis;
2522
+ }
2523
+ }
2524
+
2525
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
2526
+ if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
2527
+ {
2528
+ INCORRECT_VALUES_NAME = true;
2529
+ defaultIterator = function values() { return call$3(nativeIterator, this); };
2530
+ }
2531
+ }
2532
+
2533
+ // export additional methods
2534
+ if (DEFAULT) {
2535
+ methods = {
2536
+ values: getIterationMethod(VALUES),
2537
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
2538
+ entries: getIterationMethod(ENTRIES)
2539
+ };
2540
+ if (FORCED) for (KEY in methods) {
2541
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
2542
+ defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
2543
+ }
2544
+ } else $$1({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
2545
+ }
2546
+
2547
+ // define iterator
2548
+ if ((FORCED) && IterablePrototype[ITERATOR$2] !== defaultIterator) {
2549
+ defineBuiltIn(IterablePrototype, ITERATOR$2, defaultIterator, { name: DEFAULT });
2550
+ }
2551
+ Iterators$4[NAME] = defaultIterator;
2552
+
2553
+ return methods;
2554
+ };
2555
+
2556
+ // `CreateIterResultObject` abstract operation
2557
+ // https://tc39.es/ecma262/#sec-createiterresultobject
2558
+ var createIterResultObject$1 = function (value, done) {
2559
+ return { value: value, done: done };
2560
+ };
2561
+
2562
+ var toIndexedObject = toIndexedObject$5;
2563
+ var Iterators$3 = iterators;
2564
+ var InternalStateModule = internalState;
2565
+ objectDefineProperty.f;
2566
+ var defineIterator = iteratorDefine;
2567
+ var createIterResultObject = createIterResultObject$1;
2568
+
2569
+ var ARRAY_ITERATOR = 'Array Iterator';
2570
+ var setInternalState = InternalStateModule.set;
2571
+ var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
2572
+
2573
+ // `Array.prototype.entries` method
2574
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
2575
+ // `Array.prototype.keys` method
2576
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
2577
+ // `Array.prototype.values` method
2578
+ // https://tc39.es/ecma262/#sec-array.prototype.values
2579
+ // `Array.prototype[@@iterator]` method
2580
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
2581
+ // `CreateArrayIterator` internal method
2582
+ // https://tc39.es/ecma262/#sec-createarrayiterator
2583
+ defineIterator(Array, 'Array', function (iterated, kind) {
2584
+ setInternalState(this, {
2585
+ type: ARRAY_ITERATOR,
2586
+ target: toIndexedObject(iterated), // target
2587
+ index: 0, // next index
2588
+ kind: kind // kind
2589
+ });
2590
+ // `%ArrayIteratorPrototype%.next` method
2591
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
2592
+ }, function () {
2593
+ var state = getInternalState(this);
2594
+ var target = state.target;
2595
+ var kind = state.kind;
2596
+ var index = state.index++;
2597
+ if (!target || index >= target.length) {
2598
+ state.target = undefined;
2599
+ return createIterResultObject(undefined, true);
2600
+ }
2601
+ if (kind == 'keys') return createIterResultObject(index, false);
2602
+ if (kind == 'values') return createIterResultObject(target[index], false);
2603
+ return createIterResultObject([index, target[index]], false);
2604
+ }, 'values');
2605
+
2606
+ // argumentsList[@@iterator] is %ArrayProto_values%
2607
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
2608
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
2609
+ Iterators$3.Arguments = Iterators$3.Array;
2610
+
2611
+ var wellKnownSymbol$2 = wellKnownSymbol$9;
2612
+ var Iterators$2 = iterators;
2613
+
2614
+ var ITERATOR$1 = wellKnownSymbol$2('iterator');
2615
+ var ArrayPrototype = Array.prototype;
2616
+
2617
+ // check on default Array iterator
2618
+ var isArrayIteratorMethod$1 = function (it) {
2619
+ return it !== undefined && (Iterators$2.Array === it || ArrayPrototype[ITERATOR$1] === it);
2620
+ };
2621
+
2622
+ var classof$1 = classof$3;
2623
+ var getMethod$1 = getMethod$3;
2624
+ var isNullOrUndefined = isNullOrUndefined$3;
2625
+ var Iterators$1 = iterators;
2626
+ var wellKnownSymbol$1 = wellKnownSymbol$9;
2627
+
2628
+ var ITERATOR = wellKnownSymbol$1('iterator');
2629
+
2630
+ var getIteratorMethod$2 = function (it) {
2631
+ if (!isNullOrUndefined(it)) return getMethod$1(it, ITERATOR)
2632
+ || getMethod$1(it, '@@iterator')
2633
+ || Iterators$1[classof$1(it)];
2634
+ };
2635
+
2636
+ var call$2 = functionCall;
2637
+ var aCallable = aCallable$3;
2638
+ var anObject$2 = anObject$6;
2639
+ var tryToString$1 = tryToString$3;
2640
+ var getIteratorMethod$1 = getIteratorMethod$2;
2641
+
2642
+ var $TypeError$1 = TypeError;
2643
+
2644
+ var getIterator$1 = function (argument, usingIterator) {
2645
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
2646
+ if (aCallable(iteratorMethod)) return anObject$2(call$2(iteratorMethod, argument));
2647
+ throw $TypeError$1(tryToString$1(argument) + ' is not iterable');
2648
+ };
2649
+
2650
+ var call$1 = functionCall;
2651
+ var anObject$1 = anObject$6;
2652
+ var getMethod = getMethod$3;
2653
+
2654
+ var iteratorClose$1 = function (iterator, kind, value) {
2655
+ var innerResult, innerError;
2656
+ anObject$1(iterator);
2657
+ try {
2658
+ innerResult = getMethod(iterator, 'return');
2659
+ if (!innerResult) {
2660
+ if (kind === 'throw') throw value;
2661
+ return value;
2662
+ }
2663
+ innerResult = call$1(innerResult, iterator);
2664
+ } catch (error) {
2665
+ innerError = true;
2666
+ innerResult = error;
2667
+ }
2668
+ if (kind === 'throw') throw value;
2669
+ if (innerError) throw innerResult;
2670
+ anObject$1(innerResult);
2671
+ return value;
2672
+ };
2673
+
2674
+ var bind = functionBindContext;
2675
+ var call = functionCall;
2676
+ var anObject = anObject$6;
2677
+ var tryToString = tryToString$3;
2678
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
2679
+ var lengthOfArrayLike = lengthOfArrayLike$2;
2680
+ var isPrototypeOf = objectIsPrototypeOf;
2681
+ var getIterator = getIterator$1;
2682
+ var getIteratorMethod = getIteratorMethod$2;
2683
+ var iteratorClose = iteratorClose$1;
2684
+
2685
+ var $TypeError = TypeError;
2686
+
2687
+ var Result = function (stopped, result) {
2688
+ this.stopped = stopped;
2689
+ this.result = result;
2690
+ };
2691
+
2692
+ var ResultPrototype = Result.prototype;
2693
+
2694
+ var iterate$1 = function (iterable, unboundFunction, options) {
2695
+ var that = options && options.that;
2696
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2697
+ var IS_RECORD = !!(options && options.IS_RECORD);
2698
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
2699
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
2700
+ var fn = bind(unboundFunction, that);
2701
+ var iterator, iterFn, index, length, result, next, step;
2702
+
2703
+ var stop = function (condition) {
2704
+ if (iterator) iteratorClose(iterator, 'normal', condition);
2705
+ return new Result(true, condition);
2706
+ };
2707
+
2708
+ var callFn = function (value) {
2709
+ if (AS_ENTRIES) {
2710
+ anObject(value);
2711
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2712
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
2713
+ };
2714
+
2715
+ if (IS_RECORD) {
2716
+ iterator = iterable.iterator;
2717
+ } else if (IS_ITERATOR) {
2718
+ iterator = iterable;
2719
+ } else {
2720
+ iterFn = getIteratorMethod(iterable);
2721
+ if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
2722
+ // optimisation for array iterators
2723
+ if (isArrayIteratorMethod(iterFn)) {
2724
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
2725
+ result = callFn(iterable[index]);
2726
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
2727
+ } return new Result(false);
2728
+ }
2729
+ iterator = getIterator(iterable, iterFn);
2730
+ }
2731
+
2732
+ next = IS_RECORD ? iterable.next : iterator.next;
2733
+ while (!(step = call(next, iterator)).done) {
2734
+ try {
2735
+ result = callFn(step.value);
2736
+ } catch (error) {
2737
+ iteratorClose(iterator, 'throw', error);
2738
+ }
2739
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
2740
+ } return new Result(false);
2741
+ };
2742
+
2743
+ var toPropertyKey = toPropertyKey$3;
2744
+ var definePropertyModule = objectDefineProperty;
2745
+ var createPropertyDescriptor = createPropertyDescriptor$4;
2746
+
2747
+ var createProperty$1 = function (object, key, value) {
2748
+ var propertyKey = toPropertyKey(key);
2749
+ if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
2750
+ else object[propertyKey] = value;
2751
+ };
2752
+
2753
+ var $ = _export;
2754
+ var iterate = iterate$1;
2755
+ var createProperty = createProperty$1;
2756
+
2757
+ // `Object.fromEntries` method
2758
+ // https://github.com/tc39/proposal-object-from-entries
2759
+ $({ target: 'Object', stat: true }, {
2760
+ fromEntries: function fromEntries(iterable) {
2761
+ var obj = {};
2762
+ iterate(iterable, function (k, v) {
2763
+ createProperty(obj, k, v);
2764
+ }, { AS_ENTRIES: true });
2765
+ return obj;
2766
+ }
2767
+ });
2768
+
2769
+ var path = path$3;
2770
+
2771
+ var fromEntries$2 = path.Object.fromEntries;
2772
+
2773
+ // iterable DOM collections
2774
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2775
+ var domIterables = {
2776
+ CSSRuleList: 0,
2777
+ CSSStyleDeclaration: 0,
2778
+ CSSValueList: 0,
2779
+ ClientRectList: 0,
2780
+ DOMRectList: 0,
2781
+ DOMStringList: 0,
2782
+ DOMTokenList: 1,
2783
+ DataTransferItemList: 0,
2784
+ FileList: 0,
2785
+ HTMLAllCollection: 0,
2786
+ HTMLCollection: 0,
2787
+ HTMLFormElement: 0,
2788
+ HTMLSelectElement: 0,
2789
+ MediaList: 0,
2790
+ MimeTypeArray: 0,
2791
+ NamedNodeMap: 0,
2792
+ NodeList: 1,
2793
+ PaintRequestList: 0,
2794
+ Plugin: 0,
2795
+ PluginArray: 0,
2796
+ SVGLengthList: 0,
2797
+ SVGNumberList: 0,
2798
+ SVGPathSegList: 0,
2799
+ SVGPointList: 0,
2800
+ SVGStringList: 0,
2801
+ SVGTransformList: 0,
2802
+ SourceBufferList: 0,
2803
+ StyleSheetList: 0,
2804
+ TextTrackCueList: 0,
2805
+ TextTrackList: 0,
2806
+ TouchList: 0
2807
+ };
2808
+
2809
+ var DOMIterables = domIterables;
2810
+ var global$1 = global$c;
2811
+ var classof = classof$3;
2812
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
2813
+ var Iterators = iterators;
2814
+ var wellKnownSymbol = wellKnownSymbol$9;
2815
+
2816
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2817
+
2818
+ for (var COLLECTION_NAME in DOMIterables) {
2819
+ var Collection = global$1[COLLECTION_NAME];
2820
+ var CollectionPrototype = Collection && Collection.prototype;
2821
+ if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
2822
+ createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
2823
+ }
2824
+ Iterators[COLLECTION_NAME] = Iterators.Array;
2825
+ }
2826
+
2827
+ var parent$1 = fromEntries$2;
2828
+
2829
+
2830
+ var fromEntries$1 = parent$1;
2831
+
2832
+ var parent = fromEntries$1;
2833
+
2834
+ var fromEntries = parent;
2835
+
2836
+ var __polyfill_Object_fromEntries_lmk8764ajd87 = /*@__PURE__*/getDefaultExportFromCjs(fromEntries);
2837
+
2838
+ exports.VKNumericLanguage = void 0;
2839
+ (function (VKNumericLanguage) {
2840
+ VKNumericLanguage["Armenian"] = "58";
2841
+ VKNumericLanguage["Azerbaijani"] = "57";
2842
+ VKNumericLanguage["Belarusian"] = "114";
2843
+ VKNumericLanguage["English"] = "3";
2844
+ VKNumericLanguage["Kazakh"] = "97";
2845
+ VKNumericLanguage["Portuguese"] = "73";
2846
+ VKNumericLanguage["Russian"] = "0";
2847
+ VKNumericLanguage["Spanish"] = "4";
2848
+ VKNumericLanguage["Ukrainian"] = "1";
2849
+ VKNumericLanguage["Uzbek"] = "65";
2850
+ VKNumericLanguage["Vietnamese"] = "75";
2851
+ })(exports.VKNumericLanguage || (exports.VKNumericLanguage = {}));
2852
+ const VK_DOMAIN = 'vk.com';
2853
+ const loadVKLangPack = (language, packName, packPrefix) => __awaiter(void 0, void 0, void 0, function* () {
2854
+ const url = new URL(`https://${VK_DOMAIN}/js/lang-pack.js`);
2855
+ url.searchParams.set('format', 'json');
2856
+ url.searchParams.set('name', packName);
2857
+ if (language !== undefined) {
2858
+ url.searchParams.set('lang', language);
2859
+ }
2860
+ const response = yield fetch(url.toString());
2861
+ const data = yield response.json();
2862
+ return mapVKResponse(data, packPrefix);
2863
+ });
2864
+ const mapVKResponse = (data, packPrefix) => __polyfill_Object_fromEntries_lmk8764ajd87(Object.entries(data.keys).map(([key, value]) => [key.substring(`${packPrefix}_`.length), mapToken(value)]));
2865
+ const mapToken = (vkToken) => Array.isArray(vkToken) ? vkToken[0] : vkToken;
2866
+
2867
+ exports.InterfaceLanguage = void 0;
2868
+ (function (InterfaceLanguage) {
2869
+ InterfaceLanguage["RU"] = "ru";
2870
+ InterfaceLanguage["EN"] = "en";
2871
+ })(exports.InterfaceLanguage || (exports.InterfaceLanguage = {}));
2872
+
2873
+ exports.Logger = Logger;
2874
+ exports.Observable = Observable;
2875
+ exports.Subject = Subject;
2876
+ exports.Subscription = Subscription;
2877
+ exports.VERSION = VERSION;
2878
+ exports.ValueSubject = ValueSubject;
2879
+ exports.abortable = abortable;
2880
+ exports.addScript = addScript;
2881
+ exports.areQualitiesExact = areQualitiesExact;
2882
+ exports.assertEmptyArray = assertEmptyArray;
2883
+ exports.assertNever = assertNever;
2884
+ exports.assertNonNullable = assertNonNullable;
2885
+ exports.assertNotEmptyArray = assertNotEmptyArray;
2886
+ exports.assertNullable = assertNullable;
2887
+ exports.assertQualityIsExact = assertQualityIsExact;
2888
+ exports.buffer = buffer;
2889
+ exports.checkNever = checkNever;
2890
+ exports.combine = combine;
2891
+ exports.debounce = debounce;
2892
+ exports.fillWithDefault = fillWithDefault;
2893
+ exports.filter = filter;
2894
+ exports.filterChanged = filterChanged;
2895
+ exports.fromEvent = fromEvent;
2896
+ exports.getCurrentBrowser = getCurrentBrowser;
2897
+ exports.getExponentialDelay = getExponentialDelay;
2898
+ exports.getHighestQuality = getHighestQuality;
2899
+ exports.getIOSVersion = getIOSVersion;
2900
+ exports.interval = interval;
2901
+ exports.isHigher = isHigher;
2902
+ exports.isHigherOrEqual = isHigherOrEqual;
2903
+ exports.isIOS = isIOS;
2904
+ exports.isInvariantQuality = isInvariantQuality;
2905
+ exports.isLower = isLower;
2906
+ exports.isLowerOrEqual = isLowerOrEqual;
2907
+ exports.isMacLike = isMacLike;
2908
+ exports.isNonNullable = isNonNullable;
2909
+ exports.isNullable = isNullable;
2910
+ exports.loadVKLangPack = loadVKLangPack;
2911
+ exports.map = map;
2912
+ exports.mapTo = mapTo;
2913
+ exports.merge = merge;
2914
+ exports.noop = noop;
2915
+ exports.now = now;
2916
+ exports.observableFrom = observableFrom;
2917
+ exports.once = once;
2918
+ exports.pairwise = pairwise;
2919
+ exports.safeStorage = iframeSafeStorage;
2920
+ exports.tap = tap;
2921
+ exports.throttle = throttle;
2922
+ exports.timeout = timeout;
2923
+ exports.videoHeightToQuality = videoHeightToQuality;
2924
+ exports.videoQualityToHeight = videoQualityToHeight;
2925
+ exports.videoSizeToQuality = videoSizeToQuality;
2926
+
2927
+ }));
2928
+ //# sourceMappingURL=es2015.umd.js.map