@bitmovin/api-sdk 1.216.0 → 1.218.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/README.md +1 -1
- package/dist/bitmovin-api-sdk.browser.js +91 -1906
- package/dist/bitmovin-api-sdk.browser.min.js +1 -2
- package/dist/common/RestClient.js +2 -5
- package/dist/models/DashISO8601TimestampFormat.d.ts +9 -0
- package/dist/models/DashISO8601TimestampFormat.js +13 -0
- package/dist/models/DashManifest.d.ts +7 -0
- package/dist/models/DashManifest.js +1 -0
- package/dist/models/H264PerTitleConfiguration.d.ts +1 -1
- package/dist/models/ProgramDateTimePlacement.d.ts +20 -0
- package/dist/models/ProgramDateTimePlacement.js +20 -0
- package/dist/models/ProgramDateTimePlacementMode.d.ts +11 -0
- package/dist/models/ProgramDateTimePlacementMode.js +15 -0
- package/dist/models/ProgramDateTimeSettings.d.ts +6 -0
- package/dist/models/ProgramDateTimeSettings.js +2 -0
- package/dist/models/StreamPerTitleSettings.d.ts +12 -0
- package/dist/models/StreamPerTitleSettings.js +2 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/package.json +1 -4
- package/dist/bitmovin-api-sdk.browser.min.js.LICENSE.txt +0 -7
|
@@ -11,1205 +11,6 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/ "../node_modules/es6-promise/dist/es6-promise.js":
|
|
15
|
-
/*!*******************************************************!*\
|
|
16
|
-
!*** ../node_modules/es6-promise/dist/es6-promise.js ***!
|
|
17
|
-
\*******************************************************/
|
|
18
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
19
|
-
|
|
20
|
-
/*!
|
|
21
|
-
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
22
|
-
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
23
|
-
* @license Licensed under MIT license
|
|
24
|
-
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
25
|
-
* @version v4.2.8+1e68dce6
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
(function (global, factory) {
|
|
29
|
-
true ? module.exports = factory() :
|
|
30
|
-
0;
|
|
31
|
-
}(this, (function () { 'use strict';
|
|
32
|
-
|
|
33
|
-
function objectOrFunction(x) {
|
|
34
|
-
var type = typeof x;
|
|
35
|
-
return x !== null && (type === 'object' || type === 'function');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function isFunction(x) {
|
|
39
|
-
return typeof x === 'function';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _isArray = void 0;
|
|
45
|
-
if (Array.isArray) {
|
|
46
|
-
_isArray = Array.isArray;
|
|
47
|
-
} else {
|
|
48
|
-
_isArray = function (x) {
|
|
49
|
-
return Object.prototype.toString.call(x) === '[object Array]';
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var isArray = _isArray;
|
|
54
|
-
|
|
55
|
-
var len = 0;
|
|
56
|
-
var vertxNext = void 0;
|
|
57
|
-
var customSchedulerFn = void 0;
|
|
58
|
-
|
|
59
|
-
var asap = function asap(callback, arg) {
|
|
60
|
-
queue[len] = callback;
|
|
61
|
-
queue[len + 1] = arg;
|
|
62
|
-
len += 2;
|
|
63
|
-
if (len === 2) {
|
|
64
|
-
// If len is 2, that means that we need to schedule an async flush.
|
|
65
|
-
// If additional callbacks are queued before the queue is flushed, they
|
|
66
|
-
// will be processed by this flush that we are scheduling.
|
|
67
|
-
if (customSchedulerFn) {
|
|
68
|
-
customSchedulerFn(flush);
|
|
69
|
-
} else {
|
|
70
|
-
scheduleFlush();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
function setScheduler(scheduleFn) {
|
|
76
|
-
customSchedulerFn = scheduleFn;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function setAsap(asapFn) {
|
|
80
|
-
asap = asapFn;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var browserWindow = typeof window !== 'undefined' ? window : undefined;
|
|
84
|
-
var browserGlobal = browserWindow || {};
|
|
85
|
-
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
|
86
|
-
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
|
|
87
|
-
|
|
88
|
-
// test for web worker but not in IE10
|
|
89
|
-
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
|
|
90
|
-
|
|
91
|
-
// node
|
|
92
|
-
function useNextTick() {
|
|
93
|
-
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
|
|
94
|
-
// see https://github.com/cujojs/when/issues/410 for details
|
|
95
|
-
return function () {
|
|
96
|
-
return process.nextTick(flush);
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// vertx
|
|
101
|
-
function useVertxTimer() {
|
|
102
|
-
if (typeof vertxNext !== 'undefined') {
|
|
103
|
-
return function () {
|
|
104
|
-
vertxNext(flush);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return useSetTimeout();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function useMutationObserver() {
|
|
112
|
-
var iterations = 0;
|
|
113
|
-
var observer = new BrowserMutationObserver(flush);
|
|
114
|
-
var node = document.createTextNode('');
|
|
115
|
-
observer.observe(node, { characterData: true });
|
|
116
|
-
|
|
117
|
-
return function () {
|
|
118
|
-
node.data = iterations = ++iterations % 2;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// web worker
|
|
123
|
-
function useMessageChannel() {
|
|
124
|
-
var channel = new MessageChannel();
|
|
125
|
-
channel.port1.onmessage = flush;
|
|
126
|
-
return function () {
|
|
127
|
-
return channel.port2.postMessage(0);
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function useSetTimeout() {
|
|
132
|
-
// Store setTimeout reference so es6-promise will be unaffected by
|
|
133
|
-
// other code modifying setTimeout (like sinon.useFakeTimers())
|
|
134
|
-
var globalSetTimeout = setTimeout;
|
|
135
|
-
return function () {
|
|
136
|
-
return globalSetTimeout(flush, 1);
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
var queue = new Array(1000);
|
|
141
|
-
function flush() {
|
|
142
|
-
for (var i = 0; i < len; i += 2) {
|
|
143
|
-
var callback = queue[i];
|
|
144
|
-
var arg = queue[i + 1];
|
|
145
|
-
|
|
146
|
-
callback(arg);
|
|
147
|
-
|
|
148
|
-
queue[i] = undefined;
|
|
149
|
-
queue[i + 1] = undefined;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
len = 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function attemptVertx() {
|
|
156
|
-
try {
|
|
157
|
-
var vertx = Function('return this')().require('vertx');
|
|
158
|
-
vertxNext = vertx.runOnLoop || vertx.runOnContext;
|
|
159
|
-
return useVertxTimer();
|
|
160
|
-
} catch (e) {
|
|
161
|
-
return useSetTimeout();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
var scheduleFlush = void 0;
|
|
166
|
-
// Decide what async method to use to triggering processing of queued callbacks:
|
|
167
|
-
if (isNode) {
|
|
168
|
-
scheduleFlush = useNextTick();
|
|
169
|
-
} else if (BrowserMutationObserver) {
|
|
170
|
-
scheduleFlush = useMutationObserver();
|
|
171
|
-
} else if (isWorker) {
|
|
172
|
-
scheduleFlush = useMessageChannel();
|
|
173
|
-
} else if (browserWindow === undefined && "function" === 'function') {
|
|
174
|
-
scheduleFlush = attemptVertx();
|
|
175
|
-
} else {
|
|
176
|
-
scheduleFlush = useSetTimeout();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function then(onFulfillment, onRejection) {
|
|
180
|
-
var parent = this;
|
|
181
|
-
|
|
182
|
-
var child = new this.constructor(noop);
|
|
183
|
-
|
|
184
|
-
if (child[PROMISE_ID] === undefined) {
|
|
185
|
-
makePromise(child);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
var _state = parent._state;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (_state) {
|
|
192
|
-
var callback = arguments[_state - 1];
|
|
193
|
-
asap(function () {
|
|
194
|
-
return invokeCallback(_state, child, callback, parent._result);
|
|
195
|
-
});
|
|
196
|
-
} else {
|
|
197
|
-
subscribe(parent, child, onFulfillment, onRejection);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return child;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
`Promise.resolve` returns a promise that will become resolved with the
|
|
205
|
-
passed `value`. It is shorthand for the following:
|
|
206
|
-
|
|
207
|
-
```javascript
|
|
208
|
-
let promise = new Promise(function(resolve, reject){
|
|
209
|
-
resolve(1);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
promise.then(function(value){
|
|
213
|
-
// value === 1
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Instead of writing the above, your code now simply becomes the following:
|
|
218
|
-
|
|
219
|
-
```javascript
|
|
220
|
-
let promise = Promise.resolve(1);
|
|
221
|
-
|
|
222
|
-
promise.then(function(value){
|
|
223
|
-
// value === 1
|
|
224
|
-
});
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
@method resolve
|
|
228
|
-
@static
|
|
229
|
-
@param {Any} value value that the returned promise will be resolved with
|
|
230
|
-
Useful for tooling.
|
|
231
|
-
@return {Promise} a promise that will become fulfilled with the given
|
|
232
|
-
`value`
|
|
233
|
-
*/
|
|
234
|
-
function resolve$1(object) {
|
|
235
|
-
/*jshint validthis:true */
|
|
236
|
-
var Constructor = this;
|
|
237
|
-
|
|
238
|
-
if (object && typeof object === 'object' && object.constructor === Constructor) {
|
|
239
|
-
return object;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
var promise = new Constructor(noop);
|
|
243
|
-
resolve(promise, object);
|
|
244
|
-
return promise;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
var PROMISE_ID = Math.random().toString(36).substring(2);
|
|
248
|
-
|
|
249
|
-
function noop() {}
|
|
250
|
-
|
|
251
|
-
var PENDING = void 0;
|
|
252
|
-
var FULFILLED = 1;
|
|
253
|
-
var REJECTED = 2;
|
|
254
|
-
|
|
255
|
-
function selfFulfillment() {
|
|
256
|
-
return new TypeError("You cannot resolve a promise with itself");
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function cannotReturnOwn() {
|
|
260
|
-
return new TypeError('A promises callback cannot return that same promise.');
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
|
|
264
|
-
try {
|
|
265
|
-
then$$1.call(value, fulfillmentHandler, rejectionHandler);
|
|
266
|
-
} catch (e) {
|
|
267
|
-
return e;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function handleForeignThenable(promise, thenable, then$$1) {
|
|
272
|
-
asap(function (promise) {
|
|
273
|
-
var sealed = false;
|
|
274
|
-
var error = tryThen(then$$1, thenable, function (value) {
|
|
275
|
-
if (sealed) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
sealed = true;
|
|
279
|
-
if (thenable !== value) {
|
|
280
|
-
resolve(promise, value);
|
|
281
|
-
} else {
|
|
282
|
-
fulfill(promise, value);
|
|
283
|
-
}
|
|
284
|
-
}, function (reason) {
|
|
285
|
-
if (sealed) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
sealed = true;
|
|
289
|
-
|
|
290
|
-
reject(promise, reason);
|
|
291
|
-
}, 'Settle: ' + (promise._label || ' unknown promise'));
|
|
292
|
-
|
|
293
|
-
if (!sealed && error) {
|
|
294
|
-
sealed = true;
|
|
295
|
-
reject(promise, error);
|
|
296
|
-
}
|
|
297
|
-
}, promise);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function handleOwnThenable(promise, thenable) {
|
|
301
|
-
if (thenable._state === FULFILLED) {
|
|
302
|
-
fulfill(promise, thenable._result);
|
|
303
|
-
} else if (thenable._state === REJECTED) {
|
|
304
|
-
reject(promise, thenable._result);
|
|
305
|
-
} else {
|
|
306
|
-
subscribe(thenable, undefined, function (value) {
|
|
307
|
-
return resolve(promise, value);
|
|
308
|
-
}, function (reason) {
|
|
309
|
-
return reject(promise, reason);
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function handleMaybeThenable(promise, maybeThenable, then$$1) {
|
|
315
|
-
if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
|
|
316
|
-
handleOwnThenable(promise, maybeThenable);
|
|
317
|
-
} else {
|
|
318
|
-
if (then$$1 === undefined) {
|
|
319
|
-
fulfill(promise, maybeThenable);
|
|
320
|
-
} else if (isFunction(then$$1)) {
|
|
321
|
-
handleForeignThenable(promise, maybeThenable, then$$1);
|
|
322
|
-
} else {
|
|
323
|
-
fulfill(promise, maybeThenable);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function resolve(promise, value) {
|
|
329
|
-
if (promise === value) {
|
|
330
|
-
reject(promise, selfFulfillment());
|
|
331
|
-
} else if (objectOrFunction(value)) {
|
|
332
|
-
var then$$1 = void 0;
|
|
333
|
-
try {
|
|
334
|
-
then$$1 = value.then;
|
|
335
|
-
} catch (error) {
|
|
336
|
-
reject(promise, error);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
handleMaybeThenable(promise, value, then$$1);
|
|
340
|
-
} else {
|
|
341
|
-
fulfill(promise, value);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function publishRejection(promise) {
|
|
346
|
-
if (promise._onerror) {
|
|
347
|
-
promise._onerror(promise._result);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
publish(promise);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function fulfill(promise, value) {
|
|
354
|
-
if (promise._state !== PENDING) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
promise._result = value;
|
|
359
|
-
promise._state = FULFILLED;
|
|
360
|
-
|
|
361
|
-
if (promise._subscribers.length !== 0) {
|
|
362
|
-
asap(publish, promise);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
function reject(promise, reason) {
|
|
367
|
-
if (promise._state !== PENDING) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
promise._state = REJECTED;
|
|
371
|
-
promise._result = reason;
|
|
372
|
-
|
|
373
|
-
asap(publishRejection, promise);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function subscribe(parent, child, onFulfillment, onRejection) {
|
|
377
|
-
var _subscribers = parent._subscribers;
|
|
378
|
-
var length = _subscribers.length;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
parent._onerror = null;
|
|
382
|
-
|
|
383
|
-
_subscribers[length] = child;
|
|
384
|
-
_subscribers[length + FULFILLED] = onFulfillment;
|
|
385
|
-
_subscribers[length + REJECTED] = onRejection;
|
|
386
|
-
|
|
387
|
-
if (length === 0 && parent._state) {
|
|
388
|
-
asap(publish, parent);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function publish(promise) {
|
|
393
|
-
var subscribers = promise._subscribers;
|
|
394
|
-
var settled = promise._state;
|
|
395
|
-
|
|
396
|
-
if (subscribers.length === 0) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
var child = void 0,
|
|
401
|
-
callback = void 0,
|
|
402
|
-
detail = promise._result;
|
|
403
|
-
|
|
404
|
-
for (var i = 0; i < subscribers.length; i += 3) {
|
|
405
|
-
child = subscribers[i];
|
|
406
|
-
callback = subscribers[i + settled];
|
|
407
|
-
|
|
408
|
-
if (child) {
|
|
409
|
-
invokeCallback(settled, child, callback, detail);
|
|
410
|
-
} else {
|
|
411
|
-
callback(detail);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
promise._subscribers.length = 0;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function invokeCallback(settled, promise, callback, detail) {
|
|
419
|
-
var hasCallback = isFunction(callback),
|
|
420
|
-
value = void 0,
|
|
421
|
-
error = void 0,
|
|
422
|
-
succeeded = true;
|
|
423
|
-
|
|
424
|
-
if (hasCallback) {
|
|
425
|
-
try {
|
|
426
|
-
value = callback(detail);
|
|
427
|
-
} catch (e) {
|
|
428
|
-
succeeded = false;
|
|
429
|
-
error = e;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (promise === value) {
|
|
433
|
-
reject(promise, cannotReturnOwn());
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
} else {
|
|
437
|
-
value = detail;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if (promise._state !== PENDING) {
|
|
441
|
-
// noop
|
|
442
|
-
} else if (hasCallback && succeeded) {
|
|
443
|
-
resolve(promise, value);
|
|
444
|
-
} else if (succeeded === false) {
|
|
445
|
-
reject(promise, error);
|
|
446
|
-
} else if (settled === FULFILLED) {
|
|
447
|
-
fulfill(promise, value);
|
|
448
|
-
} else if (settled === REJECTED) {
|
|
449
|
-
reject(promise, value);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function initializePromise(promise, resolver) {
|
|
454
|
-
try {
|
|
455
|
-
resolver(function resolvePromise(value) {
|
|
456
|
-
resolve(promise, value);
|
|
457
|
-
}, function rejectPromise(reason) {
|
|
458
|
-
reject(promise, reason);
|
|
459
|
-
});
|
|
460
|
-
} catch (e) {
|
|
461
|
-
reject(promise, e);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
var id = 0;
|
|
466
|
-
function nextId() {
|
|
467
|
-
return id++;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
function makePromise(promise) {
|
|
471
|
-
promise[PROMISE_ID] = id++;
|
|
472
|
-
promise._state = undefined;
|
|
473
|
-
promise._result = undefined;
|
|
474
|
-
promise._subscribers = [];
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function validationError() {
|
|
478
|
-
return new Error('Array Methods must be provided an Array');
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
var Enumerator = function () {
|
|
482
|
-
function Enumerator(Constructor, input) {
|
|
483
|
-
this._instanceConstructor = Constructor;
|
|
484
|
-
this.promise = new Constructor(noop);
|
|
485
|
-
|
|
486
|
-
if (!this.promise[PROMISE_ID]) {
|
|
487
|
-
makePromise(this.promise);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (isArray(input)) {
|
|
491
|
-
this.length = input.length;
|
|
492
|
-
this._remaining = input.length;
|
|
493
|
-
|
|
494
|
-
this._result = new Array(this.length);
|
|
495
|
-
|
|
496
|
-
if (this.length === 0) {
|
|
497
|
-
fulfill(this.promise, this._result);
|
|
498
|
-
} else {
|
|
499
|
-
this.length = this.length || 0;
|
|
500
|
-
this._enumerate(input);
|
|
501
|
-
if (this._remaining === 0) {
|
|
502
|
-
fulfill(this.promise, this._result);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
} else {
|
|
506
|
-
reject(this.promise, validationError());
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
Enumerator.prototype._enumerate = function _enumerate(input) {
|
|
511
|
-
for (var i = 0; this._state === PENDING && i < input.length; i++) {
|
|
512
|
-
this._eachEntry(input[i], i);
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
|
|
517
|
-
var c = this._instanceConstructor;
|
|
518
|
-
var resolve$$1 = c.resolve;
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (resolve$$1 === resolve$1) {
|
|
522
|
-
var _then = void 0;
|
|
523
|
-
var error = void 0;
|
|
524
|
-
var didError = false;
|
|
525
|
-
try {
|
|
526
|
-
_then = entry.then;
|
|
527
|
-
} catch (e) {
|
|
528
|
-
didError = true;
|
|
529
|
-
error = e;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if (_then === then && entry._state !== PENDING) {
|
|
533
|
-
this._settledAt(entry._state, i, entry._result);
|
|
534
|
-
} else if (typeof _then !== 'function') {
|
|
535
|
-
this._remaining--;
|
|
536
|
-
this._result[i] = entry;
|
|
537
|
-
} else if (c === Promise$1) {
|
|
538
|
-
var promise = new c(noop);
|
|
539
|
-
if (didError) {
|
|
540
|
-
reject(promise, error);
|
|
541
|
-
} else {
|
|
542
|
-
handleMaybeThenable(promise, entry, _then);
|
|
543
|
-
}
|
|
544
|
-
this._willSettleAt(promise, i);
|
|
545
|
-
} else {
|
|
546
|
-
this._willSettleAt(new c(function (resolve$$1) {
|
|
547
|
-
return resolve$$1(entry);
|
|
548
|
-
}), i);
|
|
549
|
-
}
|
|
550
|
-
} else {
|
|
551
|
-
this._willSettleAt(resolve$$1(entry), i);
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
|
|
556
|
-
var promise = this.promise;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
if (promise._state === PENDING) {
|
|
560
|
-
this._remaining--;
|
|
561
|
-
|
|
562
|
-
if (state === REJECTED) {
|
|
563
|
-
reject(promise, value);
|
|
564
|
-
} else {
|
|
565
|
-
this._result[i] = value;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (this._remaining === 0) {
|
|
570
|
-
fulfill(promise, this._result);
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
|
|
575
|
-
var enumerator = this;
|
|
576
|
-
|
|
577
|
-
subscribe(promise, undefined, function (value) {
|
|
578
|
-
return enumerator._settledAt(FULFILLED, i, value);
|
|
579
|
-
}, function (reason) {
|
|
580
|
-
return enumerator._settledAt(REJECTED, i, reason);
|
|
581
|
-
});
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
return Enumerator;
|
|
585
|
-
}();
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
`Promise.all` accepts an array of promises, and returns a new promise which
|
|
589
|
-
is fulfilled with an array of fulfillment values for the passed promises, or
|
|
590
|
-
rejected with the reason of the first passed promise to be rejected. It casts all
|
|
591
|
-
elements of the passed iterable to promises as it runs this algorithm.
|
|
592
|
-
|
|
593
|
-
Example:
|
|
594
|
-
|
|
595
|
-
```javascript
|
|
596
|
-
let promise1 = resolve(1);
|
|
597
|
-
let promise2 = resolve(2);
|
|
598
|
-
let promise3 = resolve(3);
|
|
599
|
-
let promises = [ promise1, promise2, promise3 ];
|
|
600
|
-
|
|
601
|
-
Promise.all(promises).then(function(array){
|
|
602
|
-
// The array here would be [ 1, 2, 3 ];
|
|
603
|
-
});
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
If any of the `promises` given to `all` are rejected, the first promise
|
|
607
|
-
that is rejected will be given as an argument to the returned promises's
|
|
608
|
-
rejection handler. For example:
|
|
609
|
-
|
|
610
|
-
Example:
|
|
611
|
-
|
|
612
|
-
```javascript
|
|
613
|
-
let promise1 = resolve(1);
|
|
614
|
-
let promise2 = reject(new Error("2"));
|
|
615
|
-
let promise3 = reject(new Error("3"));
|
|
616
|
-
let promises = [ promise1, promise2, promise3 ];
|
|
617
|
-
|
|
618
|
-
Promise.all(promises).then(function(array){
|
|
619
|
-
// Code here never runs because there are rejected promises!
|
|
620
|
-
}, function(error) {
|
|
621
|
-
// error.message === "2"
|
|
622
|
-
});
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
@method all
|
|
626
|
-
@static
|
|
627
|
-
@param {Array} entries array of promises
|
|
628
|
-
@param {String} label optional string for labeling the promise.
|
|
629
|
-
Useful for tooling.
|
|
630
|
-
@return {Promise} promise that is fulfilled when all `promises` have been
|
|
631
|
-
fulfilled, or rejected if any of them become rejected.
|
|
632
|
-
@static
|
|
633
|
-
*/
|
|
634
|
-
function all(entries) {
|
|
635
|
-
return new Enumerator(this, entries).promise;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
`Promise.race` returns a new promise which is settled in the same way as the
|
|
640
|
-
first passed promise to settle.
|
|
641
|
-
|
|
642
|
-
Example:
|
|
643
|
-
|
|
644
|
-
```javascript
|
|
645
|
-
let promise1 = new Promise(function(resolve, reject){
|
|
646
|
-
setTimeout(function(){
|
|
647
|
-
resolve('promise 1');
|
|
648
|
-
}, 200);
|
|
649
|
-
});
|
|
650
|
-
|
|
651
|
-
let promise2 = new Promise(function(resolve, reject){
|
|
652
|
-
setTimeout(function(){
|
|
653
|
-
resolve('promise 2');
|
|
654
|
-
}, 100);
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
Promise.race([promise1, promise2]).then(function(result){
|
|
658
|
-
// result === 'promise 2' because it was resolved before promise1
|
|
659
|
-
// was resolved.
|
|
660
|
-
});
|
|
661
|
-
```
|
|
662
|
-
|
|
663
|
-
`Promise.race` is deterministic in that only the state of the first
|
|
664
|
-
settled promise matters. For example, even if other promises given to the
|
|
665
|
-
`promises` array argument are resolved, but the first settled promise has
|
|
666
|
-
become rejected before the other promises became fulfilled, the returned
|
|
667
|
-
promise will become rejected:
|
|
668
|
-
|
|
669
|
-
```javascript
|
|
670
|
-
let promise1 = new Promise(function(resolve, reject){
|
|
671
|
-
setTimeout(function(){
|
|
672
|
-
resolve('promise 1');
|
|
673
|
-
}, 200);
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
let promise2 = new Promise(function(resolve, reject){
|
|
677
|
-
setTimeout(function(){
|
|
678
|
-
reject(new Error('promise 2'));
|
|
679
|
-
}, 100);
|
|
680
|
-
});
|
|
681
|
-
|
|
682
|
-
Promise.race([promise1, promise2]).then(function(result){
|
|
683
|
-
// Code here never runs
|
|
684
|
-
}, function(reason){
|
|
685
|
-
// reason.message === 'promise 2' because promise 2 became rejected before
|
|
686
|
-
// promise 1 became fulfilled
|
|
687
|
-
});
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
An example real-world use case is implementing timeouts:
|
|
691
|
-
|
|
692
|
-
```javascript
|
|
693
|
-
Promise.race([ajax('foo.json'), timeout(5000)])
|
|
694
|
-
```
|
|
695
|
-
|
|
696
|
-
@method race
|
|
697
|
-
@static
|
|
698
|
-
@param {Array} promises array of promises to observe
|
|
699
|
-
Useful for tooling.
|
|
700
|
-
@return {Promise} a promise which settles in the same way as the first passed
|
|
701
|
-
promise to settle.
|
|
702
|
-
*/
|
|
703
|
-
function race(entries) {
|
|
704
|
-
/*jshint validthis:true */
|
|
705
|
-
var Constructor = this;
|
|
706
|
-
|
|
707
|
-
if (!isArray(entries)) {
|
|
708
|
-
return new Constructor(function (_, reject) {
|
|
709
|
-
return reject(new TypeError('You must pass an array to race.'));
|
|
710
|
-
});
|
|
711
|
-
} else {
|
|
712
|
-
return new Constructor(function (resolve, reject) {
|
|
713
|
-
var length = entries.length;
|
|
714
|
-
for (var i = 0; i < length; i++) {
|
|
715
|
-
Constructor.resolve(entries[i]).then(resolve, reject);
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
`Promise.reject` returns a promise rejected with the passed `reason`.
|
|
723
|
-
It is shorthand for the following:
|
|
724
|
-
|
|
725
|
-
```javascript
|
|
726
|
-
let promise = new Promise(function(resolve, reject){
|
|
727
|
-
reject(new Error('WHOOPS'));
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
promise.then(function(value){
|
|
731
|
-
// Code here doesn't run because the promise is rejected!
|
|
732
|
-
}, function(reason){
|
|
733
|
-
// reason.message === 'WHOOPS'
|
|
734
|
-
});
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
Instead of writing the above, your code now simply becomes the following:
|
|
738
|
-
|
|
739
|
-
```javascript
|
|
740
|
-
let promise = Promise.reject(new Error('WHOOPS'));
|
|
741
|
-
|
|
742
|
-
promise.then(function(value){
|
|
743
|
-
// Code here doesn't run because the promise is rejected!
|
|
744
|
-
}, function(reason){
|
|
745
|
-
// reason.message === 'WHOOPS'
|
|
746
|
-
});
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
@method reject
|
|
750
|
-
@static
|
|
751
|
-
@param {Any} reason value that the returned promise will be rejected with.
|
|
752
|
-
Useful for tooling.
|
|
753
|
-
@return {Promise} a promise rejected with the given `reason`.
|
|
754
|
-
*/
|
|
755
|
-
function reject$1(reason) {
|
|
756
|
-
/*jshint validthis:true */
|
|
757
|
-
var Constructor = this;
|
|
758
|
-
var promise = new Constructor(noop);
|
|
759
|
-
reject(promise, reason);
|
|
760
|
-
return promise;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
function needsResolver() {
|
|
764
|
-
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
function needsNew() {
|
|
768
|
-
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
Promise objects represent the eventual result of an asynchronous operation. The
|
|
773
|
-
primary way of interacting with a promise is through its `then` method, which
|
|
774
|
-
registers callbacks to receive either a promise's eventual value or the reason
|
|
775
|
-
why the promise cannot be fulfilled.
|
|
776
|
-
|
|
777
|
-
Terminology
|
|
778
|
-
-----------
|
|
779
|
-
|
|
780
|
-
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
|
|
781
|
-
- `thenable` is an object or function that defines a `then` method.
|
|
782
|
-
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
|
|
783
|
-
- `exception` is a value that is thrown using the throw statement.
|
|
784
|
-
- `reason` is a value that indicates why a promise was rejected.
|
|
785
|
-
- `settled` the final resting state of a promise, fulfilled or rejected.
|
|
786
|
-
|
|
787
|
-
A promise can be in one of three states: pending, fulfilled, or rejected.
|
|
788
|
-
|
|
789
|
-
Promises that are fulfilled have a fulfillment value and are in the fulfilled
|
|
790
|
-
state. Promises that are rejected have a rejection reason and are in the
|
|
791
|
-
rejected state. A fulfillment value is never a thenable.
|
|
792
|
-
|
|
793
|
-
Promises can also be said to *resolve* a value. If this value is also a
|
|
794
|
-
promise, then the original promise's settled state will match the value's
|
|
795
|
-
settled state. So a promise that *resolves* a promise that rejects will
|
|
796
|
-
itself reject, and a promise that *resolves* a promise that fulfills will
|
|
797
|
-
itself fulfill.
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
Basic Usage:
|
|
801
|
-
------------
|
|
802
|
-
|
|
803
|
-
```js
|
|
804
|
-
let promise = new Promise(function(resolve, reject) {
|
|
805
|
-
// on success
|
|
806
|
-
resolve(value);
|
|
807
|
-
|
|
808
|
-
// on failure
|
|
809
|
-
reject(reason);
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
promise.then(function(value) {
|
|
813
|
-
// on fulfillment
|
|
814
|
-
}, function(reason) {
|
|
815
|
-
// on rejection
|
|
816
|
-
});
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
Advanced Usage:
|
|
820
|
-
---------------
|
|
821
|
-
|
|
822
|
-
Promises shine when abstracting away asynchronous interactions such as
|
|
823
|
-
`XMLHttpRequest`s.
|
|
824
|
-
|
|
825
|
-
```js
|
|
826
|
-
function getJSON(url) {
|
|
827
|
-
return new Promise(function(resolve, reject){
|
|
828
|
-
let xhr = new XMLHttpRequest();
|
|
829
|
-
|
|
830
|
-
xhr.open('GET', url);
|
|
831
|
-
xhr.onreadystatechange = handler;
|
|
832
|
-
xhr.responseType = 'json';
|
|
833
|
-
xhr.setRequestHeader('Accept', 'application/json');
|
|
834
|
-
xhr.send();
|
|
835
|
-
|
|
836
|
-
function handler() {
|
|
837
|
-
if (this.readyState === this.DONE) {
|
|
838
|
-
if (this.status === 200) {
|
|
839
|
-
resolve(this.response);
|
|
840
|
-
} else {
|
|
841
|
-
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
getJSON('/posts.json').then(function(json) {
|
|
849
|
-
// on fulfillment
|
|
850
|
-
}, function(reason) {
|
|
851
|
-
// on rejection
|
|
852
|
-
});
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
Unlike callbacks, promises are great composable primitives.
|
|
856
|
-
|
|
857
|
-
```js
|
|
858
|
-
Promise.all([
|
|
859
|
-
getJSON('/posts'),
|
|
860
|
-
getJSON('/comments')
|
|
861
|
-
]).then(function(values){
|
|
862
|
-
values[0] // => postsJSON
|
|
863
|
-
values[1] // => commentsJSON
|
|
864
|
-
|
|
865
|
-
return values;
|
|
866
|
-
});
|
|
867
|
-
```
|
|
868
|
-
|
|
869
|
-
@class Promise
|
|
870
|
-
@param {Function} resolver
|
|
871
|
-
Useful for tooling.
|
|
872
|
-
@constructor
|
|
873
|
-
*/
|
|
874
|
-
|
|
875
|
-
var Promise$1 = function () {
|
|
876
|
-
function Promise(resolver) {
|
|
877
|
-
this[PROMISE_ID] = nextId();
|
|
878
|
-
this._result = this._state = undefined;
|
|
879
|
-
this._subscribers = [];
|
|
880
|
-
|
|
881
|
-
if (noop !== resolver) {
|
|
882
|
-
typeof resolver !== 'function' && needsResolver();
|
|
883
|
-
this instanceof Promise ? initializePromise(this, resolver) : needsNew();
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
The primary way of interacting with a promise is through its `then` method,
|
|
889
|
-
which registers callbacks to receive either a promise's eventual value or the
|
|
890
|
-
reason why the promise cannot be fulfilled.
|
|
891
|
-
```js
|
|
892
|
-
findUser().then(function(user){
|
|
893
|
-
// user is available
|
|
894
|
-
}, function(reason){
|
|
895
|
-
// user is unavailable, and you are given the reason why
|
|
896
|
-
});
|
|
897
|
-
```
|
|
898
|
-
Chaining
|
|
899
|
-
--------
|
|
900
|
-
The return value of `then` is itself a promise. This second, 'downstream'
|
|
901
|
-
promise is resolved with the return value of the first promise's fulfillment
|
|
902
|
-
or rejection handler, or rejected if the handler throws an exception.
|
|
903
|
-
```js
|
|
904
|
-
findUser().then(function (user) {
|
|
905
|
-
return user.name;
|
|
906
|
-
}, function (reason) {
|
|
907
|
-
return 'default name';
|
|
908
|
-
}).then(function (userName) {
|
|
909
|
-
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
|
|
910
|
-
// will be `'default name'`
|
|
911
|
-
});
|
|
912
|
-
findUser().then(function (user) {
|
|
913
|
-
throw new Error('Found user, but still unhappy');
|
|
914
|
-
}, function (reason) {
|
|
915
|
-
throw new Error('`findUser` rejected and we're unhappy');
|
|
916
|
-
}).then(function (value) {
|
|
917
|
-
// never reached
|
|
918
|
-
}, function (reason) {
|
|
919
|
-
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
|
|
920
|
-
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
|
|
921
|
-
});
|
|
922
|
-
```
|
|
923
|
-
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
|
|
924
|
-
```js
|
|
925
|
-
findUser().then(function (user) {
|
|
926
|
-
throw new PedagogicalException('Upstream error');
|
|
927
|
-
}).then(function (value) {
|
|
928
|
-
// never reached
|
|
929
|
-
}).then(function (value) {
|
|
930
|
-
// never reached
|
|
931
|
-
}, function (reason) {
|
|
932
|
-
// The `PedgagocialException` is propagated all the way down to here
|
|
933
|
-
});
|
|
934
|
-
```
|
|
935
|
-
Assimilation
|
|
936
|
-
------------
|
|
937
|
-
Sometimes the value you want to propagate to a downstream promise can only be
|
|
938
|
-
retrieved asynchronously. This can be achieved by returning a promise in the
|
|
939
|
-
fulfillment or rejection handler. The downstream promise will then be pending
|
|
940
|
-
until the returned promise is settled. This is called *assimilation*.
|
|
941
|
-
```js
|
|
942
|
-
findUser().then(function (user) {
|
|
943
|
-
return findCommentsByAuthor(user);
|
|
944
|
-
}).then(function (comments) {
|
|
945
|
-
// The user's comments are now available
|
|
946
|
-
});
|
|
947
|
-
```
|
|
948
|
-
If the assimliated promise rejects, then the downstream promise will also reject.
|
|
949
|
-
```js
|
|
950
|
-
findUser().then(function (user) {
|
|
951
|
-
return findCommentsByAuthor(user);
|
|
952
|
-
}).then(function (comments) {
|
|
953
|
-
// If `findCommentsByAuthor` fulfills, we'll have the value here
|
|
954
|
-
}, function (reason) {
|
|
955
|
-
// If `findCommentsByAuthor` rejects, we'll have the reason here
|
|
956
|
-
});
|
|
957
|
-
```
|
|
958
|
-
Simple Example
|
|
959
|
-
--------------
|
|
960
|
-
Synchronous Example
|
|
961
|
-
```javascript
|
|
962
|
-
let result;
|
|
963
|
-
try {
|
|
964
|
-
result = findResult();
|
|
965
|
-
// success
|
|
966
|
-
} catch(reason) {
|
|
967
|
-
// failure
|
|
968
|
-
}
|
|
969
|
-
```
|
|
970
|
-
Errback Example
|
|
971
|
-
```js
|
|
972
|
-
findResult(function(result, err){
|
|
973
|
-
if (err) {
|
|
974
|
-
// failure
|
|
975
|
-
} else {
|
|
976
|
-
// success
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
```
|
|
980
|
-
Promise Example;
|
|
981
|
-
```javascript
|
|
982
|
-
findResult().then(function(result){
|
|
983
|
-
// success
|
|
984
|
-
}, function(reason){
|
|
985
|
-
// failure
|
|
986
|
-
});
|
|
987
|
-
```
|
|
988
|
-
Advanced Example
|
|
989
|
-
--------------
|
|
990
|
-
Synchronous Example
|
|
991
|
-
```javascript
|
|
992
|
-
let author, books;
|
|
993
|
-
try {
|
|
994
|
-
author = findAuthor();
|
|
995
|
-
books = findBooksByAuthor(author);
|
|
996
|
-
// success
|
|
997
|
-
} catch(reason) {
|
|
998
|
-
// failure
|
|
999
|
-
}
|
|
1000
|
-
```
|
|
1001
|
-
Errback Example
|
|
1002
|
-
```js
|
|
1003
|
-
function foundBooks(books) {
|
|
1004
|
-
}
|
|
1005
|
-
function failure(reason) {
|
|
1006
|
-
}
|
|
1007
|
-
findAuthor(function(author, err){
|
|
1008
|
-
if (err) {
|
|
1009
|
-
failure(err);
|
|
1010
|
-
// failure
|
|
1011
|
-
} else {
|
|
1012
|
-
try {
|
|
1013
|
-
findBoooksByAuthor(author, function(books, err) {
|
|
1014
|
-
if (err) {
|
|
1015
|
-
failure(err);
|
|
1016
|
-
} else {
|
|
1017
|
-
try {
|
|
1018
|
-
foundBooks(books);
|
|
1019
|
-
} catch(reason) {
|
|
1020
|
-
failure(reason);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
} catch(error) {
|
|
1025
|
-
failure(err);
|
|
1026
|
-
}
|
|
1027
|
-
// success
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
```
|
|
1031
|
-
Promise Example;
|
|
1032
|
-
```javascript
|
|
1033
|
-
findAuthor().
|
|
1034
|
-
then(findBooksByAuthor).
|
|
1035
|
-
then(function(books){
|
|
1036
|
-
// found books
|
|
1037
|
-
}).catch(function(reason){
|
|
1038
|
-
// something went wrong
|
|
1039
|
-
});
|
|
1040
|
-
```
|
|
1041
|
-
@method then
|
|
1042
|
-
@param {Function} onFulfilled
|
|
1043
|
-
@param {Function} onRejected
|
|
1044
|
-
Useful for tooling.
|
|
1045
|
-
@return {Promise}
|
|
1046
|
-
*/
|
|
1047
|
-
|
|
1048
|
-
/**
|
|
1049
|
-
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
|
1050
|
-
as the catch block of a try/catch statement.
|
|
1051
|
-
```js
|
|
1052
|
-
function findAuthor(){
|
|
1053
|
-
throw new Error('couldn't find that author');
|
|
1054
|
-
}
|
|
1055
|
-
// synchronous
|
|
1056
|
-
try {
|
|
1057
|
-
findAuthor();
|
|
1058
|
-
} catch(reason) {
|
|
1059
|
-
// something went wrong
|
|
1060
|
-
}
|
|
1061
|
-
// async with promises
|
|
1062
|
-
findAuthor().catch(function(reason){
|
|
1063
|
-
// something went wrong
|
|
1064
|
-
});
|
|
1065
|
-
```
|
|
1066
|
-
@method catch
|
|
1067
|
-
@param {Function} onRejection
|
|
1068
|
-
Useful for tooling.
|
|
1069
|
-
@return {Promise}
|
|
1070
|
-
*/
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
Promise.prototype.catch = function _catch(onRejection) {
|
|
1074
|
-
return this.then(null, onRejection);
|
|
1075
|
-
};
|
|
1076
|
-
|
|
1077
|
-
/**
|
|
1078
|
-
`finally` will be invoked regardless of the promise's fate just as native
|
|
1079
|
-
try/catch/finally behaves
|
|
1080
|
-
|
|
1081
|
-
Synchronous example:
|
|
1082
|
-
|
|
1083
|
-
```js
|
|
1084
|
-
findAuthor() {
|
|
1085
|
-
if (Math.random() > 0.5) {
|
|
1086
|
-
throw new Error();
|
|
1087
|
-
}
|
|
1088
|
-
return new Author();
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
try {
|
|
1092
|
-
return findAuthor(); // succeed or fail
|
|
1093
|
-
} catch(error) {
|
|
1094
|
-
return findOtherAuther();
|
|
1095
|
-
} finally {
|
|
1096
|
-
// always runs
|
|
1097
|
-
// doesn't affect the return value
|
|
1098
|
-
}
|
|
1099
|
-
```
|
|
1100
|
-
|
|
1101
|
-
Asynchronous example:
|
|
1102
|
-
|
|
1103
|
-
```js
|
|
1104
|
-
findAuthor().catch(function(reason){
|
|
1105
|
-
return findOtherAuther();
|
|
1106
|
-
}).finally(function(){
|
|
1107
|
-
// author was either found, or not
|
|
1108
|
-
});
|
|
1109
|
-
```
|
|
1110
|
-
|
|
1111
|
-
@method finally
|
|
1112
|
-
@param {Function} callback
|
|
1113
|
-
@return {Promise}
|
|
1114
|
-
*/
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
Promise.prototype.finally = function _finally(callback) {
|
|
1118
|
-
var promise = this;
|
|
1119
|
-
var constructor = promise.constructor;
|
|
1120
|
-
|
|
1121
|
-
if (isFunction(callback)) {
|
|
1122
|
-
return promise.then(function (value) {
|
|
1123
|
-
return constructor.resolve(callback()).then(function () {
|
|
1124
|
-
return value;
|
|
1125
|
-
});
|
|
1126
|
-
}, function (reason) {
|
|
1127
|
-
return constructor.resolve(callback()).then(function () {
|
|
1128
|
-
throw reason;
|
|
1129
|
-
});
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
return promise.then(callback, callback);
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
|
-
return Promise;
|
|
1137
|
-
}();
|
|
1138
|
-
|
|
1139
|
-
Promise$1.prototype.then = then;
|
|
1140
|
-
Promise$1.all = all;
|
|
1141
|
-
Promise$1.race = race;
|
|
1142
|
-
Promise$1.resolve = resolve$1;
|
|
1143
|
-
Promise$1.reject = reject$1;
|
|
1144
|
-
Promise$1._setScheduler = setScheduler;
|
|
1145
|
-
Promise$1._setAsap = setAsap;
|
|
1146
|
-
Promise$1._asap = asap;
|
|
1147
|
-
|
|
1148
|
-
/*global self*/
|
|
1149
|
-
function polyfill() {
|
|
1150
|
-
var local = void 0;
|
|
1151
|
-
|
|
1152
|
-
if (typeof __webpack_require__.g !== 'undefined') {
|
|
1153
|
-
local = __webpack_require__.g;
|
|
1154
|
-
} else if (typeof self !== 'undefined') {
|
|
1155
|
-
local = self;
|
|
1156
|
-
} else {
|
|
1157
|
-
try {
|
|
1158
|
-
local = Function('return this')();
|
|
1159
|
-
} catch (e) {
|
|
1160
|
-
throw new Error('polyfill failed because global object is unavailable in this environment');
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
var P = local.Promise;
|
|
1165
|
-
|
|
1166
|
-
if (P) {
|
|
1167
|
-
var promiseToString = null;
|
|
1168
|
-
try {
|
|
1169
|
-
promiseToString = Object.prototype.toString.call(P.resolve());
|
|
1170
|
-
} catch (e) {
|
|
1171
|
-
// silently ignored
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
if (promiseToString === '[object Promise]' && !P.cast) {
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
local.Promise = Promise$1;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
// Strange compat..
|
|
1183
|
-
Promise$1.polyfill = polyfill;
|
|
1184
|
-
Promise$1.Promise = Promise$1;
|
|
1185
|
-
|
|
1186
|
-
return Promise$1;
|
|
1187
|
-
|
|
1188
|
-
})));
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
//# sourceMappingURL=es6-promise.map
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
/***/ }),
|
|
1196
|
-
|
|
1197
|
-
/***/ "../node_modules/isomorphic-fetch/fetch-npm-browserify.js":
|
|
1198
|
-
/*!****************************************************************!*\
|
|
1199
|
-
!*** ../node_modules/isomorphic-fetch/fetch-npm-browserify.js ***!
|
|
1200
|
-
\****************************************************************/
|
|
1201
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1202
|
-
|
|
1203
|
-
// the whatwg-fetch polyfill installs the fetch() function
|
|
1204
|
-
// on the global object (window or self)
|
|
1205
|
-
//
|
|
1206
|
-
// Return that as the export for use in Webpack, Browserify etc.
|
|
1207
|
-
__webpack_require__(/*! whatwg-fetch */ "../node_modules/whatwg-fetch/fetch.js");
|
|
1208
|
-
module.exports = self.fetch.bind(self);
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
/***/ }),
|
|
1212
|
-
|
|
1213
14
|
/***/ "./BitmovinApi.ts":
|
|
1214
15
|
/*!************************!*\
|
|
1215
16
|
!*** ./BitmovinApi.ts ***!
|
|
@@ -5842,13 +4643,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
5842
4643
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5843
4644
|
exports.RestClient = void 0;
|
|
5844
4645
|
exports.copyAndPrepareBody = copyAndPrepareBody;
|
|
5845
|
-
var e6p = __webpack_require__(/*! es6-promise */ "../node_modules/es6-promise/dist/es6-promise.js");
|
|
5846
4646
|
var urljoin = __webpack_require__(/*! url-join */ "../node_modules/url-join/lib/url-join.js");
|
|
5847
|
-
var isomorphicFetch = __webpack_require__(/*! isomorphic-fetch */ "../node_modules/isomorphic-fetch/fetch-npm-browserify.js");
|
|
5848
4647
|
var BaseAPI_1 = __webpack_require__(/*! ./BaseAPI */ "./common/BaseAPI.ts");
|
|
5849
4648
|
var NullLogger_1 = __webpack_require__(/*! ./NullLogger */ "./common/NullLogger.ts");
|
|
5850
4649
|
var BitmovinErrorBuilder_1 = __webpack_require__(/*! ./BitmovinErrorBuilder */ "./common/BitmovinErrorBuilder.ts");
|
|
5851
|
-
e6p.polyfill();
|
|
5852
4650
|
var BASE_URL = 'https://api.bitmovin.com/v1';
|
|
5853
4651
|
function prepareUrlParameterValue(parameterValue) {
|
|
5854
4652
|
if (parameterValue instanceof Date) {
|
|
@@ -5944,7 +4742,7 @@ var RestClient = /** @class */ (function () {
|
|
|
5944
4742
|
this.apiKey = configuration.apiKey;
|
|
5945
4743
|
this.tenantOrgId = configuration.tenantOrgId;
|
|
5946
4744
|
this.baseUrl = configuration.baseUrl || BASE_URL;
|
|
5947
|
-
this.fetch = configuration.fetch ||
|
|
4745
|
+
this.fetch = configuration.fetch || fetch;
|
|
5948
4746
|
this.logger = configuration.logger || new NullLogger_1.default();
|
|
5949
4747
|
this.headers = configuration.headers;
|
|
5950
4748
|
this.httpHandler = this.buildHttpHandler();
|
|
@@ -6029,7 +4827,7 @@ var HeaderHandler = /** @class */ (function (_super) {
|
|
|
6029
4827
|
var headers = {
|
|
6030
4828
|
'X-Api-Key': apiKey,
|
|
6031
4829
|
'X-Api-Client': 'bitmovin-api-sdk-javascript',
|
|
6032
|
-
'X-Api-Client-Version': '1.
|
|
4830
|
+
'X-Api-Client-Version': '1.218.0',
|
|
6033
4831
|
'Content-Type': 'application/json'
|
|
6034
4832
|
};
|
|
6035
4833
|
if (tenantOrgId) {
|
|
@@ -65572,6 +64370,30 @@ exports.DashFmp4Representation = DashFmp4Representation;
|
|
|
65572
64370
|
exports["default"] = DashFmp4Representation;
|
|
65573
64371
|
|
|
65574
64372
|
|
|
64373
|
+
/***/ }),
|
|
64374
|
+
|
|
64375
|
+
/***/ "./models/DashISO8601TimestampFormat.ts":
|
|
64376
|
+
/*!**********************************************!*\
|
|
64377
|
+
!*** ./models/DashISO8601TimestampFormat.ts ***!
|
|
64378
|
+
\**********************************************/
|
|
64379
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
64380
|
+
|
|
64381
|
+
"use strict";
|
|
64382
|
+
|
|
64383
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
64384
|
+
exports.DashISO8601TimestampFormat = void 0;
|
|
64385
|
+
/**
|
|
64386
|
+
* @export
|
|
64387
|
+
* @enum {string}
|
|
64388
|
+
*/
|
|
64389
|
+
var DashISO8601TimestampFormat;
|
|
64390
|
+
(function (DashISO8601TimestampFormat) {
|
|
64391
|
+
DashISO8601TimestampFormat["LONG"] = "LONG";
|
|
64392
|
+
DashISO8601TimestampFormat["SHORT"] = "SHORT";
|
|
64393
|
+
})(DashISO8601TimestampFormat || (exports.DashISO8601TimestampFormat = DashISO8601TimestampFormat = {}));
|
|
64394
|
+
exports["default"] = DashISO8601TimestampFormat;
|
|
64395
|
+
|
|
64396
|
+
|
|
65575
64397
|
/***/ }),
|
|
65576
64398
|
|
|
65577
64399
|
/***/ "./models/DashImscRepresentation.ts":
|
|
@@ -65675,6 +64497,7 @@ var DashManifest = /** @class */ (function (_super) {
|
|
|
65675
64497
|
_this.namespaces = (0, Mapper_1.mapArray)(obj.namespaces, XmlNamespace_1.default);
|
|
65676
64498
|
_this.utcTimings = (0, Mapper_1.mapArray)(obj.utcTimings, UtcTiming_1.default);
|
|
65677
64499
|
_this.dashEditionCompatibility = (0, Mapper_1.map)(obj.dashEditionCompatibility);
|
|
64500
|
+
_this.iso8601TimestampFormat = (0, Mapper_1.map)(obj.iso8601TimestampFormat);
|
|
65678
64501
|
return _this;
|
|
65679
64502
|
}
|
|
65680
64503
|
return DashManifest;
|
|
@@ -79301,6 +78124,63 @@ var ProfileH265;
|
|
|
79301
78124
|
exports["default"] = ProfileH265;
|
|
79302
78125
|
|
|
79303
78126
|
|
|
78127
|
+
/***/ }),
|
|
78128
|
+
|
|
78129
|
+
/***/ "./models/ProgramDateTimePlacement.ts":
|
|
78130
|
+
/*!********************************************!*\
|
|
78131
|
+
!*** ./models/ProgramDateTimePlacement.ts ***!
|
|
78132
|
+
\********************************************/
|
|
78133
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
78134
|
+
|
|
78135
|
+
"use strict";
|
|
78136
|
+
|
|
78137
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78138
|
+
exports.ProgramDateTimePlacement = void 0;
|
|
78139
|
+
var Mapper_1 = __webpack_require__(/*! ../common/Mapper */ "./common/Mapper.ts");
|
|
78140
|
+
/**
|
|
78141
|
+
* @export
|
|
78142
|
+
* @class ProgramDateTimePlacement
|
|
78143
|
+
*/
|
|
78144
|
+
var ProgramDateTimePlacement = /** @class */ (function () {
|
|
78145
|
+
function ProgramDateTimePlacement(obj) {
|
|
78146
|
+
if (!obj) {
|
|
78147
|
+
return;
|
|
78148
|
+
}
|
|
78149
|
+
this.programDateTimePlacementMode = (0, Mapper_1.map)(obj.programDateTimePlacementMode);
|
|
78150
|
+
this.interval = (0, Mapper_1.map)(obj.interval);
|
|
78151
|
+
}
|
|
78152
|
+
return ProgramDateTimePlacement;
|
|
78153
|
+
}());
|
|
78154
|
+
exports.ProgramDateTimePlacement = ProgramDateTimePlacement;
|
|
78155
|
+
exports["default"] = ProgramDateTimePlacement;
|
|
78156
|
+
|
|
78157
|
+
|
|
78158
|
+
/***/ }),
|
|
78159
|
+
|
|
78160
|
+
/***/ "./models/ProgramDateTimePlacementMode.ts":
|
|
78161
|
+
/*!************************************************!*\
|
|
78162
|
+
!*** ./models/ProgramDateTimePlacementMode.ts ***!
|
|
78163
|
+
\************************************************/
|
|
78164
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
78165
|
+
|
|
78166
|
+
"use strict";
|
|
78167
|
+
|
|
78168
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78169
|
+
exports.ProgramDateTimePlacementMode = void 0;
|
|
78170
|
+
/**
|
|
78171
|
+
* Placement mode of the ProgramDateTime tag.
|
|
78172
|
+
* @export
|
|
78173
|
+
* @enum {string}
|
|
78174
|
+
*/
|
|
78175
|
+
var ProgramDateTimePlacementMode;
|
|
78176
|
+
(function (ProgramDateTimePlacementMode) {
|
|
78177
|
+
ProgramDateTimePlacementMode["ONCE_PER_PLAYLIST"] = "ONCE_PER_PLAYLIST";
|
|
78178
|
+
ProgramDateTimePlacementMode["SEGMENTS_INTERVAL"] = "SEGMENTS_INTERVAL";
|
|
78179
|
+
ProgramDateTimePlacementMode["SECONDS_INTERVAL"] = "SECONDS_INTERVAL";
|
|
78180
|
+
})(ProgramDateTimePlacementMode || (exports.ProgramDateTimePlacementMode = ProgramDateTimePlacementMode = {}));
|
|
78181
|
+
exports["default"] = ProgramDateTimePlacementMode;
|
|
78182
|
+
|
|
78183
|
+
|
|
79304
78184
|
/***/ }),
|
|
79305
78185
|
|
|
79306
78186
|
/***/ "./models/ProgramDateTimeSettings.ts":
|
|
@@ -79314,6 +78194,7 @@ exports["default"] = ProfileH265;
|
|
|
79314
78194
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
79315
78195
|
exports.ProgramDateTimeSettings = void 0;
|
|
79316
78196
|
var Mapper_1 = __webpack_require__(/*! ../common/Mapper */ "./common/Mapper.ts");
|
|
78197
|
+
var ProgramDateTimePlacement_1 = __webpack_require__(/*! ./ProgramDateTimePlacement */ "./models/ProgramDateTimePlacement.ts");
|
|
79317
78198
|
/**
|
|
79318
78199
|
* @export
|
|
79319
78200
|
* @class ProgramDateTimeSettings
|
|
@@ -79324,6 +78205,7 @@ var ProgramDateTimeSettings = /** @class */ (function () {
|
|
|
79324
78205
|
return;
|
|
79325
78206
|
}
|
|
79326
78207
|
this.programDateTimeSource = (0, Mapper_1.map)(obj.programDateTimeSource);
|
|
78208
|
+
this.programDateTimePlacement = (0, Mapper_1.map)(obj.programDateTimePlacement, ProgramDateTimePlacement_1.default);
|
|
79327
78209
|
}
|
|
79328
78210
|
return ProgramDateTimeSettings;
|
|
79329
78211
|
}());
|
|
@@ -85385,6 +84267,8 @@ var StreamPerTitleSettings = /** @class */ (function () {
|
|
|
85385
84267
|
return;
|
|
85386
84268
|
}
|
|
85387
84269
|
this.fixedResolutionAndBitrateSettings = (0, Mapper_1.map)(obj.fixedResolutionAndBitrateSettings, StreamPerTitleFixedResolutionAndBitrateSettings_1.default);
|
|
84270
|
+
this.codecMaxBitrateFactor = (0, Mapper_1.map)(obj.codecMaxBitrateFactor);
|
|
84271
|
+
this.codecBufsizeFactor = (0, Mapper_1.map)(obj.codecBufsizeFactor);
|
|
85388
84272
|
}
|
|
85389
84273
|
return StreamPerTitleSettings;
|
|
85390
84274
|
}());
|
|
@@ -89760,6 +88644,7 @@ __exportStar(__webpack_require__(/*! ./DashCmafRepresentation */ "./models/DashC
|
|
|
89760
88644
|
__exportStar(__webpack_require__(/*! ./DashEditionCompatibility */ "./models/DashEditionCompatibility.ts"), exports);
|
|
89761
88645
|
__exportStar(__webpack_require__(/*! ./DashFmp4DrmRepresentation */ "./models/DashFmp4DrmRepresentation.ts"), exports);
|
|
89762
88646
|
__exportStar(__webpack_require__(/*! ./DashFmp4Representation */ "./models/DashFmp4Representation.ts"), exports);
|
|
88647
|
+
__exportStar(__webpack_require__(/*! ./DashISO8601TimestampFormat */ "./models/DashISO8601TimestampFormat.ts"), exports);
|
|
89763
88648
|
__exportStar(__webpack_require__(/*! ./DashImscRepresentation */ "./models/DashImscRepresentation.ts"), exports);
|
|
89764
88649
|
__exportStar(__webpack_require__(/*! ./DashManifest */ "./models/DashManifest.ts"), exports);
|
|
89765
88650
|
__exportStar(__webpack_require__(/*! ./DashManifestDefault */ "./models/DashManifestDefault.ts"), exports);
|
|
@@ -90114,6 +88999,8 @@ __exportStar(__webpack_require__(/*! ./PrimeTimeDrm */ "./models/PrimeTimeDrm.ts
|
|
|
90114
88999
|
__exportStar(__webpack_require__(/*! ./ProfileH262 */ "./models/ProfileH262.ts"), exports);
|
|
90115
89000
|
__exportStar(__webpack_require__(/*! ./ProfileH264 */ "./models/ProfileH264.ts"), exports);
|
|
90116
89001
|
__exportStar(__webpack_require__(/*! ./ProfileH265 */ "./models/ProfileH265.ts"), exports);
|
|
89002
|
+
__exportStar(__webpack_require__(/*! ./ProgramDateTimePlacement */ "./models/ProgramDateTimePlacement.ts"), exports);
|
|
89003
|
+
__exportStar(__webpack_require__(/*! ./ProgramDateTimePlacementMode */ "./models/ProgramDateTimePlacementMode.ts"), exports);
|
|
90117
89004
|
__exportStar(__webpack_require__(/*! ./ProgramDateTimeSettings */ "./models/ProgramDateTimeSettings.ts"), exports);
|
|
90118
89005
|
__exportStar(__webpack_require__(/*! ./ProgramDateTimeSource */ "./models/ProgramDateTimeSource.ts"), exports);
|
|
90119
89006
|
__exportStar(__webpack_require__(/*! ./ProgressiveMovMuxing */ "./models/ProgressiveMovMuxing.ts"), exports);
|
|
@@ -95171,667 +94058,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (nam
|
|
|
95171
94058
|
});
|
|
95172
94059
|
|
|
95173
94060
|
|
|
95174
|
-
/***/ }),
|
|
95175
|
-
|
|
95176
|
-
/***/ "../node_modules/whatwg-fetch/fetch.js":
|
|
95177
|
-
/*!*********************************************!*\
|
|
95178
|
-
!*** ../node_modules/whatwg-fetch/fetch.js ***!
|
|
95179
|
-
\*********************************************/
|
|
95180
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
95181
|
-
|
|
95182
|
-
"use strict";
|
|
95183
|
-
__webpack_require__.r(__webpack_exports__);
|
|
95184
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
95185
|
-
/* harmony export */ DOMException: () => (/* binding */ DOMException),
|
|
95186
|
-
/* harmony export */ Headers: () => (/* binding */ Headers),
|
|
95187
|
-
/* harmony export */ Request: () => (/* binding */ Request),
|
|
95188
|
-
/* harmony export */ Response: () => (/* binding */ Response),
|
|
95189
|
-
/* harmony export */ fetch: () => (/* binding */ fetch)
|
|
95190
|
-
/* harmony export */ });
|
|
95191
|
-
/* eslint-disable no-prototype-builtins */
|
|
95192
|
-
var g =
|
|
95193
|
-
(typeof globalThis !== 'undefined' && globalThis) ||
|
|
95194
|
-
(typeof self !== 'undefined' && self) ||
|
|
95195
|
-
// eslint-disable-next-line no-undef
|
|
95196
|
-
(typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g) ||
|
|
95197
|
-
{}
|
|
95198
|
-
|
|
95199
|
-
var support = {
|
|
95200
|
-
searchParams: 'URLSearchParams' in g,
|
|
95201
|
-
iterable: 'Symbol' in g && 'iterator' in Symbol,
|
|
95202
|
-
blob:
|
|
95203
|
-
'FileReader' in g &&
|
|
95204
|
-
'Blob' in g &&
|
|
95205
|
-
(function() {
|
|
95206
|
-
try {
|
|
95207
|
-
new Blob()
|
|
95208
|
-
return true
|
|
95209
|
-
} catch (e) {
|
|
95210
|
-
return false
|
|
95211
|
-
}
|
|
95212
|
-
})(),
|
|
95213
|
-
formData: 'FormData' in g,
|
|
95214
|
-
arrayBuffer: 'ArrayBuffer' in g
|
|
95215
|
-
}
|
|
95216
|
-
|
|
95217
|
-
function isDataView(obj) {
|
|
95218
|
-
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
95219
|
-
}
|
|
95220
|
-
|
|
95221
|
-
if (support.arrayBuffer) {
|
|
95222
|
-
var viewClasses = [
|
|
95223
|
-
'[object Int8Array]',
|
|
95224
|
-
'[object Uint8Array]',
|
|
95225
|
-
'[object Uint8ClampedArray]',
|
|
95226
|
-
'[object Int16Array]',
|
|
95227
|
-
'[object Uint16Array]',
|
|
95228
|
-
'[object Int32Array]',
|
|
95229
|
-
'[object Uint32Array]',
|
|
95230
|
-
'[object Float32Array]',
|
|
95231
|
-
'[object Float64Array]'
|
|
95232
|
-
]
|
|
95233
|
-
|
|
95234
|
-
var isArrayBufferView =
|
|
95235
|
-
ArrayBuffer.isView ||
|
|
95236
|
-
function(obj) {
|
|
95237
|
-
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
95238
|
-
}
|
|
95239
|
-
}
|
|
95240
|
-
|
|
95241
|
-
function normalizeName(name) {
|
|
95242
|
-
if (typeof name !== 'string') {
|
|
95243
|
-
name = String(name)
|
|
95244
|
-
}
|
|
95245
|
-
if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {
|
|
95246
|
-
throw new TypeError('Invalid character in header field name: "' + name + '"')
|
|
95247
|
-
}
|
|
95248
|
-
return name.toLowerCase()
|
|
95249
|
-
}
|
|
95250
|
-
|
|
95251
|
-
function normalizeValue(value) {
|
|
95252
|
-
if (typeof value !== 'string') {
|
|
95253
|
-
value = String(value)
|
|
95254
|
-
}
|
|
95255
|
-
return value
|
|
95256
|
-
}
|
|
95257
|
-
|
|
95258
|
-
// Build a destructive iterator for the value list
|
|
95259
|
-
function iteratorFor(items) {
|
|
95260
|
-
var iterator = {
|
|
95261
|
-
next: function() {
|
|
95262
|
-
var value = items.shift()
|
|
95263
|
-
return {done: value === undefined, value: value}
|
|
95264
|
-
}
|
|
95265
|
-
}
|
|
95266
|
-
|
|
95267
|
-
if (support.iterable) {
|
|
95268
|
-
iterator[Symbol.iterator] = function() {
|
|
95269
|
-
return iterator
|
|
95270
|
-
}
|
|
95271
|
-
}
|
|
95272
|
-
|
|
95273
|
-
return iterator
|
|
95274
|
-
}
|
|
95275
|
-
|
|
95276
|
-
function Headers(headers) {
|
|
95277
|
-
this.map = {}
|
|
95278
|
-
|
|
95279
|
-
if (headers instanceof Headers) {
|
|
95280
|
-
headers.forEach(function(value, name) {
|
|
95281
|
-
this.append(name, value)
|
|
95282
|
-
}, this)
|
|
95283
|
-
} else if (Array.isArray(headers)) {
|
|
95284
|
-
headers.forEach(function(header) {
|
|
95285
|
-
if (header.length != 2) {
|
|
95286
|
-
throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
|
|
95287
|
-
}
|
|
95288
|
-
this.append(header[0], header[1])
|
|
95289
|
-
}, this)
|
|
95290
|
-
} else if (headers) {
|
|
95291
|
-
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
95292
|
-
this.append(name, headers[name])
|
|
95293
|
-
}, this)
|
|
95294
|
-
}
|
|
95295
|
-
}
|
|
95296
|
-
|
|
95297
|
-
Headers.prototype.append = function(name, value) {
|
|
95298
|
-
name = normalizeName(name)
|
|
95299
|
-
value = normalizeValue(value)
|
|
95300
|
-
var oldValue = this.map[name]
|
|
95301
|
-
this.map[name] = oldValue ? oldValue + ', ' + value : value
|
|
95302
|
-
}
|
|
95303
|
-
|
|
95304
|
-
Headers.prototype['delete'] = function(name) {
|
|
95305
|
-
delete this.map[normalizeName(name)]
|
|
95306
|
-
}
|
|
95307
|
-
|
|
95308
|
-
Headers.prototype.get = function(name) {
|
|
95309
|
-
name = normalizeName(name)
|
|
95310
|
-
return this.has(name) ? this.map[name] : null
|
|
95311
|
-
}
|
|
95312
|
-
|
|
95313
|
-
Headers.prototype.has = function(name) {
|
|
95314
|
-
return this.map.hasOwnProperty(normalizeName(name))
|
|
95315
|
-
}
|
|
95316
|
-
|
|
95317
|
-
Headers.prototype.set = function(name, value) {
|
|
95318
|
-
this.map[normalizeName(name)] = normalizeValue(value)
|
|
95319
|
-
}
|
|
95320
|
-
|
|
95321
|
-
Headers.prototype.forEach = function(callback, thisArg) {
|
|
95322
|
-
for (var name in this.map) {
|
|
95323
|
-
if (this.map.hasOwnProperty(name)) {
|
|
95324
|
-
callback.call(thisArg, this.map[name], name, this)
|
|
95325
|
-
}
|
|
95326
|
-
}
|
|
95327
|
-
}
|
|
95328
|
-
|
|
95329
|
-
Headers.prototype.keys = function() {
|
|
95330
|
-
var items = []
|
|
95331
|
-
this.forEach(function(value, name) {
|
|
95332
|
-
items.push(name)
|
|
95333
|
-
})
|
|
95334
|
-
return iteratorFor(items)
|
|
95335
|
-
}
|
|
95336
|
-
|
|
95337
|
-
Headers.prototype.values = function() {
|
|
95338
|
-
var items = []
|
|
95339
|
-
this.forEach(function(value) {
|
|
95340
|
-
items.push(value)
|
|
95341
|
-
})
|
|
95342
|
-
return iteratorFor(items)
|
|
95343
|
-
}
|
|
95344
|
-
|
|
95345
|
-
Headers.prototype.entries = function() {
|
|
95346
|
-
var items = []
|
|
95347
|
-
this.forEach(function(value, name) {
|
|
95348
|
-
items.push([name, value])
|
|
95349
|
-
})
|
|
95350
|
-
return iteratorFor(items)
|
|
95351
|
-
}
|
|
95352
|
-
|
|
95353
|
-
if (support.iterable) {
|
|
95354
|
-
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
|
|
95355
|
-
}
|
|
95356
|
-
|
|
95357
|
-
function consumed(body) {
|
|
95358
|
-
if (body._noBody) return
|
|
95359
|
-
if (body.bodyUsed) {
|
|
95360
|
-
return Promise.reject(new TypeError('Already read'))
|
|
95361
|
-
}
|
|
95362
|
-
body.bodyUsed = true
|
|
95363
|
-
}
|
|
95364
|
-
|
|
95365
|
-
function fileReaderReady(reader) {
|
|
95366
|
-
return new Promise(function(resolve, reject) {
|
|
95367
|
-
reader.onload = function() {
|
|
95368
|
-
resolve(reader.result)
|
|
95369
|
-
}
|
|
95370
|
-
reader.onerror = function() {
|
|
95371
|
-
reject(reader.error)
|
|
95372
|
-
}
|
|
95373
|
-
})
|
|
95374
|
-
}
|
|
95375
|
-
|
|
95376
|
-
function readBlobAsArrayBuffer(blob) {
|
|
95377
|
-
var reader = new FileReader()
|
|
95378
|
-
var promise = fileReaderReady(reader)
|
|
95379
|
-
reader.readAsArrayBuffer(blob)
|
|
95380
|
-
return promise
|
|
95381
|
-
}
|
|
95382
|
-
|
|
95383
|
-
function readBlobAsText(blob) {
|
|
95384
|
-
var reader = new FileReader()
|
|
95385
|
-
var promise = fileReaderReady(reader)
|
|
95386
|
-
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type)
|
|
95387
|
-
var encoding = match ? match[1] : 'utf-8'
|
|
95388
|
-
reader.readAsText(blob, encoding)
|
|
95389
|
-
return promise
|
|
95390
|
-
}
|
|
95391
|
-
|
|
95392
|
-
function readArrayBufferAsText(buf) {
|
|
95393
|
-
var view = new Uint8Array(buf)
|
|
95394
|
-
var chars = new Array(view.length)
|
|
95395
|
-
|
|
95396
|
-
for (var i = 0; i < view.length; i++) {
|
|
95397
|
-
chars[i] = String.fromCharCode(view[i])
|
|
95398
|
-
}
|
|
95399
|
-
return chars.join('')
|
|
95400
|
-
}
|
|
95401
|
-
|
|
95402
|
-
function bufferClone(buf) {
|
|
95403
|
-
if (buf.slice) {
|
|
95404
|
-
return buf.slice(0)
|
|
95405
|
-
} else {
|
|
95406
|
-
var view = new Uint8Array(buf.byteLength)
|
|
95407
|
-
view.set(new Uint8Array(buf))
|
|
95408
|
-
return view.buffer
|
|
95409
|
-
}
|
|
95410
|
-
}
|
|
95411
|
-
|
|
95412
|
-
function Body() {
|
|
95413
|
-
this.bodyUsed = false
|
|
95414
|
-
|
|
95415
|
-
this._initBody = function(body) {
|
|
95416
|
-
/*
|
|
95417
|
-
fetch-mock wraps the Response object in an ES6 Proxy to
|
|
95418
|
-
provide useful test harness features such as flush. However, on
|
|
95419
|
-
ES5 browsers without fetch or Proxy support pollyfills must be used;
|
|
95420
|
-
the proxy-pollyfill is unable to proxy an attribute unless it exists
|
|
95421
|
-
on the object before the Proxy is created. This change ensures
|
|
95422
|
-
Response.bodyUsed exists on the instance, while maintaining the
|
|
95423
|
-
semantic of setting Request.bodyUsed in the constructor before
|
|
95424
|
-
_initBody is called.
|
|
95425
|
-
*/
|
|
95426
|
-
// eslint-disable-next-line no-self-assign
|
|
95427
|
-
this.bodyUsed = this.bodyUsed
|
|
95428
|
-
this._bodyInit = body
|
|
95429
|
-
if (!body) {
|
|
95430
|
-
this._noBody = true;
|
|
95431
|
-
this._bodyText = ''
|
|
95432
|
-
} else if (typeof body === 'string') {
|
|
95433
|
-
this._bodyText = body
|
|
95434
|
-
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
95435
|
-
this._bodyBlob = body
|
|
95436
|
-
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
95437
|
-
this._bodyFormData = body
|
|
95438
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
95439
|
-
this._bodyText = body.toString()
|
|
95440
|
-
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
95441
|
-
this._bodyArrayBuffer = bufferClone(body.buffer)
|
|
95442
|
-
// IE 10-11 can't handle a DataView body.
|
|
95443
|
-
this._bodyInit = new Blob([this._bodyArrayBuffer])
|
|
95444
|
-
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
95445
|
-
this._bodyArrayBuffer = bufferClone(body)
|
|
95446
|
-
} else {
|
|
95447
|
-
this._bodyText = body = Object.prototype.toString.call(body)
|
|
95448
|
-
}
|
|
95449
|
-
|
|
95450
|
-
if (!this.headers.get('content-type')) {
|
|
95451
|
-
if (typeof body === 'string') {
|
|
95452
|
-
this.headers.set('content-type', 'text/plain;charset=UTF-8')
|
|
95453
|
-
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
95454
|
-
this.headers.set('content-type', this._bodyBlob.type)
|
|
95455
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
95456
|
-
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
|
|
95457
|
-
}
|
|
95458
|
-
}
|
|
95459
|
-
}
|
|
95460
|
-
|
|
95461
|
-
if (support.blob) {
|
|
95462
|
-
this.blob = function() {
|
|
95463
|
-
var rejected = consumed(this)
|
|
95464
|
-
if (rejected) {
|
|
95465
|
-
return rejected
|
|
95466
|
-
}
|
|
95467
|
-
|
|
95468
|
-
if (this._bodyBlob) {
|
|
95469
|
-
return Promise.resolve(this._bodyBlob)
|
|
95470
|
-
} else if (this._bodyArrayBuffer) {
|
|
95471
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
95472
|
-
} else if (this._bodyFormData) {
|
|
95473
|
-
throw new Error('could not read FormData body as blob')
|
|
95474
|
-
} else {
|
|
95475
|
-
return Promise.resolve(new Blob([this._bodyText]))
|
|
95476
|
-
}
|
|
95477
|
-
}
|
|
95478
|
-
}
|
|
95479
|
-
|
|
95480
|
-
this.arrayBuffer = function() {
|
|
95481
|
-
if (this._bodyArrayBuffer) {
|
|
95482
|
-
var isConsumed = consumed(this)
|
|
95483
|
-
if (isConsumed) {
|
|
95484
|
-
return isConsumed
|
|
95485
|
-
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
|
95486
|
-
return Promise.resolve(
|
|
95487
|
-
this._bodyArrayBuffer.buffer.slice(
|
|
95488
|
-
this._bodyArrayBuffer.byteOffset,
|
|
95489
|
-
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
95490
|
-
)
|
|
95491
|
-
)
|
|
95492
|
-
} else {
|
|
95493
|
-
return Promise.resolve(this._bodyArrayBuffer)
|
|
95494
|
-
}
|
|
95495
|
-
} else if (support.blob) {
|
|
95496
|
-
return this.blob().then(readBlobAsArrayBuffer)
|
|
95497
|
-
} else {
|
|
95498
|
-
throw new Error('could not read as ArrayBuffer')
|
|
95499
|
-
}
|
|
95500
|
-
}
|
|
95501
|
-
|
|
95502
|
-
this.text = function() {
|
|
95503
|
-
var rejected = consumed(this)
|
|
95504
|
-
if (rejected) {
|
|
95505
|
-
return rejected
|
|
95506
|
-
}
|
|
95507
|
-
|
|
95508
|
-
if (this._bodyBlob) {
|
|
95509
|
-
return readBlobAsText(this._bodyBlob)
|
|
95510
|
-
} else if (this._bodyArrayBuffer) {
|
|
95511
|
-
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
95512
|
-
} else if (this._bodyFormData) {
|
|
95513
|
-
throw new Error('could not read FormData body as text')
|
|
95514
|
-
} else {
|
|
95515
|
-
return Promise.resolve(this._bodyText)
|
|
95516
|
-
}
|
|
95517
|
-
}
|
|
95518
|
-
|
|
95519
|
-
if (support.formData) {
|
|
95520
|
-
this.formData = function() {
|
|
95521
|
-
return this.text().then(decode)
|
|
95522
|
-
}
|
|
95523
|
-
}
|
|
95524
|
-
|
|
95525
|
-
this.json = function() {
|
|
95526
|
-
return this.text().then(JSON.parse)
|
|
95527
|
-
}
|
|
95528
|
-
|
|
95529
|
-
return this
|
|
95530
|
-
}
|
|
95531
|
-
|
|
95532
|
-
// HTTP methods whose capitalization should be normalized
|
|
95533
|
-
var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE']
|
|
95534
|
-
|
|
95535
|
-
function normalizeMethod(method) {
|
|
95536
|
-
var upcased = method.toUpperCase()
|
|
95537
|
-
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
95538
|
-
}
|
|
95539
|
-
|
|
95540
|
-
function Request(input, options) {
|
|
95541
|
-
if (!(this instanceof Request)) {
|
|
95542
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
|
95543
|
-
}
|
|
95544
|
-
|
|
95545
|
-
options = options || {}
|
|
95546
|
-
var body = options.body
|
|
95547
|
-
|
|
95548
|
-
if (input instanceof Request) {
|
|
95549
|
-
if (input.bodyUsed) {
|
|
95550
|
-
throw new TypeError('Already read')
|
|
95551
|
-
}
|
|
95552
|
-
this.url = input.url
|
|
95553
|
-
this.credentials = input.credentials
|
|
95554
|
-
if (!options.headers) {
|
|
95555
|
-
this.headers = new Headers(input.headers)
|
|
95556
|
-
}
|
|
95557
|
-
this.method = input.method
|
|
95558
|
-
this.mode = input.mode
|
|
95559
|
-
this.signal = input.signal
|
|
95560
|
-
if (!body && input._bodyInit != null) {
|
|
95561
|
-
body = input._bodyInit
|
|
95562
|
-
input.bodyUsed = true
|
|
95563
|
-
}
|
|
95564
|
-
} else {
|
|
95565
|
-
this.url = String(input)
|
|
95566
|
-
}
|
|
95567
|
-
|
|
95568
|
-
this.credentials = options.credentials || this.credentials || 'same-origin'
|
|
95569
|
-
if (options.headers || !this.headers) {
|
|
95570
|
-
this.headers = new Headers(options.headers)
|
|
95571
|
-
}
|
|
95572
|
-
this.method = normalizeMethod(options.method || this.method || 'GET')
|
|
95573
|
-
this.mode = options.mode || this.mode || null
|
|
95574
|
-
this.signal = options.signal || this.signal || (function () {
|
|
95575
|
-
if ('AbortController' in g) {
|
|
95576
|
-
var ctrl = new AbortController();
|
|
95577
|
-
return ctrl.signal;
|
|
95578
|
-
}
|
|
95579
|
-
}());
|
|
95580
|
-
this.referrer = null
|
|
95581
|
-
|
|
95582
|
-
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
95583
|
-
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
95584
|
-
}
|
|
95585
|
-
this._initBody(body)
|
|
95586
|
-
|
|
95587
|
-
if (this.method === 'GET' || this.method === 'HEAD') {
|
|
95588
|
-
if (options.cache === 'no-store' || options.cache === 'no-cache') {
|
|
95589
|
-
// Search for a '_' parameter in the query string
|
|
95590
|
-
var reParamSearch = /([?&])_=[^&]*/
|
|
95591
|
-
if (reParamSearch.test(this.url)) {
|
|
95592
|
-
// If it already exists then set the value with the current time
|
|
95593
|
-
this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime())
|
|
95594
|
-
} else {
|
|
95595
|
-
// Otherwise add a new '_' parameter to the end with the current time
|
|
95596
|
-
var reQueryString = /\?/
|
|
95597
|
-
this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime()
|
|
95598
|
-
}
|
|
95599
|
-
}
|
|
95600
|
-
}
|
|
95601
|
-
}
|
|
95602
|
-
|
|
95603
|
-
Request.prototype.clone = function() {
|
|
95604
|
-
return new Request(this, {body: this._bodyInit})
|
|
95605
|
-
}
|
|
95606
|
-
|
|
95607
|
-
function decode(body) {
|
|
95608
|
-
var form = new FormData()
|
|
95609
|
-
body
|
|
95610
|
-
.trim()
|
|
95611
|
-
.split('&')
|
|
95612
|
-
.forEach(function(bytes) {
|
|
95613
|
-
if (bytes) {
|
|
95614
|
-
var split = bytes.split('=')
|
|
95615
|
-
var name = split.shift().replace(/\+/g, ' ')
|
|
95616
|
-
var value = split.join('=').replace(/\+/g, ' ')
|
|
95617
|
-
form.append(decodeURIComponent(name), decodeURIComponent(value))
|
|
95618
|
-
}
|
|
95619
|
-
})
|
|
95620
|
-
return form
|
|
95621
|
-
}
|
|
95622
|
-
|
|
95623
|
-
function parseHeaders(rawHeaders) {
|
|
95624
|
-
var headers = new Headers()
|
|
95625
|
-
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
95626
|
-
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
95627
|
-
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ')
|
|
95628
|
-
// Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill
|
|
95629
|
-
// https://github.com/github/fetch/issues/748
|
|
95630
|
-
// https://github.com/zloirock/core-js/issues/751
|
|
95631
|
-
preProcessedHeaders
|
|
95632
|
-
.split('\r')
|
|
95633
|
-
.map(function(header) {
|
|
95634
|
-
return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header
|
|
95635
|
-
})
|
|
95636
|
-
.forEach(function(line) {
|
|
95637
|
-
var parts = line.split(':')
|
|
95638
|
-
var key = parts.shift().trim()
|
|
95639
|
-
if (key) {
|
|
95640
|
-
var value = parts.join(':').trim()
|
|
95641
|
-
try {
|
|
95642
|
-
headers.append(key, value)
|
|
95643
|
-
} catch (error) {
|
|
95644
|
-
console.warn('Response ' + error.message)
|
|
95645
|
-
}
|
|
95646
|
-
}
|
|
95647
|
-
})
|
|
95648
|
-
return headers
|
|
95649
|
-
}
|
|
95650
|
-
|
|
95651
|
-
Body.call(Request.prototype)
|
|
95652
|
-
|
|
95653
|
-
function Response(bodyInit, options) {
|
|
95654
|
-
if (!(this instanceof Response)) {
|
|
95655
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
|
95656
|
-
}
|
|
95657
|
-
if (!options) {
|
|
95658
|
-
options = {}
|
|
95659
|
-
}
|
|
95660
|
-
|
|
95661
|
-
this.type = 'default'
|
|
95662
|
-
this.status = options.status === undefined ? 200 : options.status
|
|
95663
|
-
if (this.status < 200 || this.status > 599) {
|
|
95664
|
-
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
|
|
95665
|
-
}
|
|
95666
|
-
this.ok = this.status >= 200 && this.status < 300
|
|
95667
|
-
this.statusText = options.statusText === undefined ? '' : '' + options.statusText
|
|
95668
|
-
this.headers = new Headers(options.headers)
|
|
95669
|
-
this.url = options.url || ''
|
|
95670
|
-
this._initBody(bodyInit)
|
|
95671
|
-
}
|
|
95672
|
-
|
|
95673
|
-
Body.call(Response.prototype)
|
|
95674
|
-
|
|
95675
|
-
Response.prototype.clone = function() {
|
|
95676
|
-
return new Response(this._bodyInit, {
|
|
95677
|
-
status: this.status,
|
|
95678
|
-
statusText: this.statusText,
|
|
95679
|
-
headers: new Headers(this.headers),
|
|
95680
|
-
url: this.url
|
|
95681
|
-
})
|
|
95682
|
-
}
|
|
95683
|
-
|
|
95684
|
-
Response.error = function() {
|
|
95685
|
-
var response = new Response(null, {status: 200, statusText: ''})
|
|
95686
|
-
response.ok = false
|
|
95687
|
-
response.status = 0
|
|
95688
|
-
response.type = 'error'
|
|
95689
|
-
return response
|
|
95690
|
-
}
|
|
95691
|
-
|
|
95692
|
-
var redirectStatuses = [301, 302, 303, 307, 308]
|
|
95693
|
-
|
|
95694
|
-
Response.redirect = function(url, status) {
|
|
95695
|
-
if (redirectStatuses.indexOf(status) === -1) {
|
|
95696
|
-
throw new RangeError('Invalid status code')
|
|
95697
|
-
}
|
|
95698
|
-
|
|
95699
|
-
return new Response(null, {status: status, headers: {location: url}})
|
|
95700
|
-
}
|
|
95701
|
-
|
|
95702
|
-
var DOMException = g.DOMException
|
|
95703
|
-
try {
|
|
95704
|
-
new DOMException()
|
|
95705
|
-
} catch (err) {
|
|
95706
|
-
DOMException = function(message, name) {
|
|
95707
|
-
this.message = message
|
|
95708
|
-
this.name = name
|
|
95709
|
-
var error = Error(message)
|
|
95710
|
-
this.stack = error.stack
|
|
95711
|
-
}
|
|
95712
|
-
DOMException.prototype = Object.create(Error.prototype)
|
|
95713
|
-
DOMException.prototype.constructor = DOMException
|
|
95714
|
-
}
|
|
95715
|
-
|
|
95716
|
-
function fetch(input, init) {
|
|
95717
|
-
return new Promise(function(resolve, reject) {
|
|
95718
|
-
var request = new Request(input, init)
|
|
95719
|
-
|
|
95720
|
-
if (request.signal && request.signal.aborted) {
|
|
95721
|
-
return reject(new DOMException('Aborted', 'AbortError'))
|
|
95722
|
-
}
|
|
95723
|
-
|
|
95724
|
-
var xhr = new XMLHttpRequest()
|
|
95725
|
-
|
|
95726
|
-
function abortXhr() {
|
|
95727
|
-
xhr.abort()
|
|
95728
|
-
}
|
|
95729
|
-
|
|
95730
|
-
xhr.onload = function() {
|
|
95731
|
-
var options = {
|
|
95732
|
-
statusText: xhr.statusText,
|
|
95733
|
-
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
95734
|
-
}
|
|
95735
|
-
// This check if specifically for when a user fetches a file locally from the file system
|
|
95736
|
-
// Only if the status is out of a normal range
|
|
95737
|
-
if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {
|
|
95738
|
-
options.status = 200;
|
|
95739
|
-
} else {
|
|
95740
|
-
options.status = xhr.status;
|
|
95741
|
-
}
|
|
95742
|
-
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
|
|
95743
|
-
var body = 'response' in xhr ? xhr.response : xhr.responseText
|
|
95744
|
-
setTimeout(function() {
|
|
95745
|
-
resolve(new Response(body, options))
|
|
95746
|
-
}, 0)
|
|
95747
|
-
}
|
|
95748
|
-
|
|
95749
|
-
xhr.onerror = function() {
|
|
95750
|
-
setTimeout(function() {
|
|
95751
|
-
reject(new TypeError('Network request failed'))
|
|
95752
|
-
}, 0)
|
|
95753
|
-
}
|
|
95754
|
-
|
|
95755
|
-
xhr.ontimeout = function() {
|
|
95756
|
-
setTimeout(function() {
|
|
95757
|
-
reject(new TypeError('Network request timed out'))
|
|
95758
|
-
}, 0)
|
|
95759
|
-
}
|
|
95760
|
-
|
|
95761
|
-
xhr.onabort = function() {
|
|
95762
|
-
setTimeout(function() {
|
|
95763
|
-
reject(new DOMException('Aborted', 'AbortError'))
|
|
95764
|
-
}, 0)
|
|
95765
|
-
}
|
|
95766
|
-
|
|
95767
|
-
function fixUrl(url) {
|
|
95768
|
-
try {
|
|
95769
|
-
return url === '' && g.location.href ? g.location.href : url
|
|
95770
|
-
} catch (e) {
|
|
95771
|
-
return url
|
|
95772
|
-
}
|
|
95773
|
-
}
|
|
95774
|
-
|
|
95775
|
-
xhr.open(request.method, fixUrl(request.url), true)
|
|
95776
|
-
|
|
95777
|
-
if (request.credentials === 'include') {
|
|
95778
|
-
xhr.withCredentials = true
|
|
95779
|
-
} else if (request.credentials === 'omit') {
|
|
95780
|
-
xhr.withCredentials = false
|
|
95781
|
-
}
|
|
95782
|
-
|
|
95783
|
-
if ('responseType' in xhr) {
|
|
95784
|
-
if (support.blob) {
|
|
95785
|
-
xhr.responseType = 'blob'
|
|
95786
|
-
} else if (
|
|
95787
|
-
support.arrayBuffer
|
|
95788
|
-
) {
|
|
95789
|
-
xhr.responseType = 'arraybuffer'
|
|
95790
|
-
}
|
|
95791
|
-
}
|
|
95792
|
-
|
|
95793
|
-
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
|
|
95794
|
-
var names = [];
|
|
95795
|
-
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
|
95796
|
-
names.push(normalizeName(name))
|
|
95797
|
-
xhr.setRequestHeader(name, normalizeValue(init.headers[name]))
|
|
95798
|
-
})
|
|
95799
|
-
request.headers.forEach(function(value, name) {
|
|
95800
|
-
if (names.indexOf(name) === -1) {
|
|
95801
|
-
xhr.setRequestHeader(name, value)
|
|
95802
|
-
}
|
|
95803
|
-
})
|
|
95804
|
-
} else {
|
|
95805
|
-
request.headers.forEach(function(value, name) {
|
|
95806
|
-
xhr.setRequestHeader(name, value)
|
|
95807
|
-
})
|
|
95808
|
-
}
|
|
95809
|
-
|
|
95810
|
-
if (request.signal) {
|
|
95811
|
-
request.signal.addEventListener('abort', abortXhr)
|
|
95812
|
-
|
|
95813
|
-
xhr.onreadystatechange = function() {
|
|
95814
|
-
// DONE (success or failure)
|
|
95815
|
-
if (xhr.readyState === 4) {
|
|
95816
|
-
request.signal.removeEventListener('abort', abortXhr)
|
|
95817
|
-
}
|
|
95818
|
-
}
|
|
95819
|
-
}
|
|
95820
|
-
|
|
95821
|
-
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
|
|
95822
|
-
})
|
|
95823
|
-
}
|
|
95824
|
-
|
|
95825
|
-
fetch.polyfill = true
|
|
95826
|
-
|
|
95827
|
-
if (!g.fetch) {
|
|
95828
|
-
g.fetch = fetch
|
|
95829
|
-
g.Headers = Headers
|
|
95830
|
-
g.Request = Request
|
|
95831
|
-
g.Response = Response
|
|
95832
|
-
}
|
|
95833
|
-
|
|
95834
|
-
|
|
95835
94061
|
/***/ })
|
|
95836
94062
|
|
|
95837
94063
|
/******/ });
|
|
@@ -95861,47 +94087,6 @@ if (!g.fetch) {
|
|
|
95861
94087
|
/******/ }
|
|
95862
94088
|
/******/
|
|
95863
94089
|
/************************************************************************/
|
|
95864
|
-
/******/ /* webpack/runtime/define property getters */
|
|
95865
|
-
/******/ (() => {
|
|
95866
|
-
/******/ // define getter functions for harmony exports
|
|
95867
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
95868
|
-
/******/ for(var key in definition) {
|
|
95869
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
95870
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
95871
|
-
/******/ }
|
|
95872
|
-
/******/ }
|
|
95873
|
-
/******/ };
|
|
95874
|
-
/******/ })();
|
|
95875
|
-
/******/
|
|
95876
|
-
/******/ /* webpack/runtime/global */
|
|
95877
|
-
/******/ (() => {
|
|
95878
|
-
/******/ __webpack_require__.g = (function() {
|
|
95879
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
95880
|
-
/******/ try {
|
|
95881
|
-
/******/ return this || new Function('return this')();
|
|
95882
|
-
/******/ } catch (e) {
|
|
95883
|
-
/******/ if (typeof window === 'object') return window;
|
|
95884
|
-
/******/ }
|
|
95885
|
-
/******/ })();
|
|
95886
|
-
/******/ })();
|
|
95887
|
-
/******/
|
|
95888
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
95889
|
-
/******/ (() => {
|
|
95890
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
95891
|
-
/******/ })();
|
|
95892
|
-
/******/
|
|
95893
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
95894
|
-
/******/ (() => {
|
|
95895
|
-
/******/ // define __esModule on exports
|
|
95896
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
95897
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
95898
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
95899
|
-
/******/ }
|
|
95900
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
95901
|
-
/******/ };
|
|
95902
|
-
/******/ })();
|
|
95903
|
-
/******/
|
|
95904
|
-
/************************************************************************/
|
|
95905
94090
|
/******/
|
|
95906
94091
|
/******/ // startup
|
|
95907
94092
|
/******/ // Load entry module and return exports
|