@sanity/client 4.0.0-alpha.esm.2 → 4.0.0-alpha.esm.5
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/dist/browser/sanityClient.js +3242 -33
- package/dist/node/sanityClient.js +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,3194 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
19
|
+
|
|
20
|
+
// node_modules/rxjs/internal/util/isFunction.js
|
|
21
|
+
var require_isFunction = __commonJS({
|
|
22
|
+
"node_modules/rxjs/internal/util/isFunction.js"(exports) {
|
|
23
|
+
"use strict";
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
function isFunction(x) {
|
|
26
|
+
return typeof x === "function";
|
|
27
|
+
}
|
|
28
|
+
exports.isFunction = isFunction;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// node_modules/rxjs/internal/config.js
|
|
33
|
+
var require_config = __commonJS({
|
|
34
|
+
"node_modules/rxjs/internal/config.js"(exports) {
|
|
35
|
+
"use strict";
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
var _enable_super_gross_mode_that_will_cause_bad_things = false;
|
|
38
|
+
exports.config = {
|
|
39
|
+
Promise: void 0,
|
|
40
|
+
set useDeprecatedSynchronousErrorHandling(value) {
|
|
41
|
+
if (value) {
|
|
42
|
+
var error = new Error();
|
|
43
|
+
console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n" + error.stack);
|
|
44
|
+
} else if (_enable_super_gross_mode_that_will_cause_bad_things) {
|
|
45
|
+
console.log("RxJS: Back to a better error behavior. Thank you. <3");
|
|
46
|
+
}
|
|
47
|
+
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
48
|
+
},
|
|
49
|
+
get useDeprecatedSynchronousErrorHandling() {
|
|
50
|
+
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// node_modules/rxjs/internal/util/hostReportError.js
|
|
57
|
+
var require_hostReportError = __commonJS({
|
|
58
|
+
"node_modules/rxjs/internal/util/hostReportError.js"(exports) {
|
|
59
|
+
"use strict";
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
function hostReportError(err) {
|
|
62
|
+
setTimeout(function() {
|
|
63
|
+
throw err;
|
|
64
|
+
}, 0);
|
|
65
|
+
}
|
|
66
|
+
exports.hostReportError = hostReportError;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// node_modules/rxjs/internal/Observer.js
|
|
71
|
+
var require_Observer = __commonJS({
|
|
72
|
+
"node_modules/rxjs/internal/Observer.js"(exports) {
|
|
73
|
+
"use strict";
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
+
var config_1 = require_config();
|
|
76
|
+
var hostReportError_1 = require_hostReportError();
|
|
77
|
+
exports.empty = {
|
|
78
|
+
closed: true,
|
|
79
|
+
next: function(value) {
|
|
80
|
+
},
|
|
81
|
+
error: function(err) {
|
|
82
|
+
if (config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
83
|
+
throw err;
|
|
84
|
+
} else {
|
|
85
|
+
hostReportError_1.hostReportError(err);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
complete: function() {
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// node_modules/rxjs/internal/util/isArray.js
|
|
95
|
+
var require_isArray = __commonJS({
|
|
96
|
+
"node_modules/rxjs/internal/util/isArray.js"(exports) {
|
|
97
|
+
"use strict";
|
|
98
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
99
|
+
exports.isArray = function() {
|
|
100
|
+
return Array.isArray || function(x) {
|
|
101
|
+
return x && typeof x.length === "number";
|
|
102
|
+
};
|
|
103
|
+
}();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// node_modules/rxjs/internal/util/isObject.js
|
|
108
|
+
var require_isObject = __commonJS({
|
|
109
|
+
"node_modules/rxjs/internal/util/isObject.js"(exports) {
|
|
110
|
+
"use strict";
|
|
111
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112
|
+
function isObject(x) {
|
|
113
|
+
return x !== null && typeof x === "object";
|
|
114
|
+
}
|
|
115
|
+
exports.isObject = isObject;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// node_modules/rxjs/internal/util/UnsubscriptionError.js
|
|
120
|
+
var require_UnsubscriptionError = __commonJS({
|
|
121
|
+
"node_modules/rxjs/internal/util/UnsubscriptionError.js"(exports) {
|
|
122
|
+
"use strict";
|
|
123
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
124
|
+
var UnsubscriptionErrorImpl = function() {
|
|
125
|
+
function UnsubscriptionErrorImpl2(errors) {
|
|
126
|
+
Error.call(this);
|
|
127
|
+
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
|
|
128
|
+
return i + 1 + ") " + err.toString();
|
|
129
|
+
}).join("\n ") : "";
|
|
130
|
+
this.name = "UnsubscriptionError";
|
|
131
|
+
this.errors = errors;
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
UnsubscriptionErrorImpl2.prototype = Object.create(Error.prototype);
|
|
135
|
+
return UnsubscriptionErrorImpl2;
|
|
136
|
+
}();
|
|
137
|
+
exports.UnsubscriptionError = UnsubscriptionErrorImpl;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// node_modules/rxjs/internal/Subscription.js
|
|
142
|
+
var require_Subscription = __commonJS({
|
|
143
|
+
"node_modules/rxjs/internal/Subscription.js"(exports) {
|
|
144
|
+
"use strict";
|
|
145
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
146
|
+
var isArray_1 = require_isArray();
|
|
147
|
+
var isObject_1 = require_isObject();
|
|
148
|
+
var isFunction_1 = require_isFunction();
|
|
149
|
+
var UnsubscriptionError_1 = require_UnsubscriptionError();
|
|
150
|
+
var Subscription = function() {
|
|
151
|
+
function Subscription2(unsubscribe) {
|
|
152
|
+
this.closed = false;
|
|
153
|
+
this._parentOrParents = null;
|
|
154
|
+
this._subscriptions = null;
|
|
155
|
+
if (unsubscribe) {
|
|
156
|
+
this._ctorUnsubscribe = true;
|
|
157
|
+
this._unsubscribe = unsubscribe;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
Subscription2.prototype.unsubscribe = function() {
|
|
161
|
+
var errors;
|
|
162
|
+
if (this.closed) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
|
|
166
|
+
this.closed = true;
|
|
167
|
+
this._parentOrParents = null;
|
|
168
|
+
this._subscriptions = null;
|
|
169
|
+
if (_parentOrParents instanceof Subscription2) {
|
|
170
|
+
_parentOrParents.remove(this);
|
|
171
|
+
} else if (_parentOrParents !== null) {
|
|
172
|
+
for (var index = 0; index < _parentOrParents.length; ++index) {
|
|
173
|
+
var parent_1 = _parentOrParents[index];
|
|
174
|
+
parent_1.remove(this);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (isFunction_1.isFunction(_unsubscribe)) {
|
|
178
|
+
if (_ctorUnsubscribe) {
|
|
179
|
+
this._unsubscribe = void 0;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
_unsubscribe.call(this);
|
|
183
|
+
} catch (e) {
|
|
184
|
+
errors = e instanceof UnsubscriptionError_1.UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (isArray_1.isArray(_subscriptions)) {
|
|
188
|
+
var index = -1;
|
|
189
|
+
var len = _subscriptions.length;
|
|
190
|
+
while (++index < len) {
|
|
191
|
+
var sub = _subscriptions[index];
|
|
192
|
+
if (isObject_1.isObject(sub)) {
|
|
193
|
+
try {
|
|
194
|
+
sub.unsubscribe();
|
|
195
|
+
} catch (e) {
|
|
196
|
+
errors = errors || [];
|
|
197
|
+
if (e instanceof UnsubscriptionError_1.UnsubscriptionError) {
|
|
198
|
+
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
199
|
+
} else {
|
|
200
|
+
errors.push(e);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (errors) {
|
|
207
|
+
throw new UnsubscriptionError_1.UnsubscriptionError(errors);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
Subscription2.prototype.add = function(teardown) {
|
|
211
|
+
var subscription = teardown;
|
|
212
|
+
if (!teardown) {
|
|
213
|
+
return Subscription2.EMPTY;
|
|
214
|
+
}
|
|
215
|
+
switch (typeof teardown) {
|
|
216
|
+
case "function":
|
|
217
|
+
subscription = new Subscription2(teardown);
|
|
218
|
+
case "object":
|
|
219
|
+
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== "function") {
|
|
220
|
+
return subscription;
|
|
221
|
+
} else if (this.closed) {
|
|
222
|
+
subscription.unsubscribe();
|
|
223
|
+
return subscription;
|
|
224
|
+
} else if (!(subscription instanceof Subscription2)) {
|
|
225
|
+
var tmp = subscription;
|
|
226
|
+
subscription = new Subscription2();
|
|
227
|
+
subscription._subscriptions = [tmp];
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
default: {
|
|
231
|
+
throw new Error("unrecognized teardown " + teardown + " added to Subscription.");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
var _parentOrParents = subscription._parentOrParents;
|
|
235
|
+
if (_parentOrParents === null) {
|
|
236
|
+
subscription._parentOrParents = this;
|
|
237
|
+
} else if (_parentOrParents instanceof Subscription2) {
|
|
238
|
+
if (_parentOrParents === this) {
|
|
239
|
+
return subscription;
|
|
240
|
+
}
|
|
241
|
+
subscription._parentOrParents = [_parentOrParents, this];
|
|
242
|
+
} else if (_parentOrParents.indexOf(this) === -1) {
|
|
243
|
+
_parentOrParents.push(this);
|
|
244
|
+
} else {
|
|
245
|
+
return subscription;
|
|
246
|
+
}
|
|
247
|
+
var subscriptions = this._subscriptions;
|
|
248
|
+
if (subscriptions === null) {
|
|
249
|
+
this._subscriptions = [subscription];
|
|
250
|
+
} else {
|
|
251
|
+
subscriptions.push(subscription);
|
|
252
|
+
}
|
|
253
|
+
return subscription;
|
|
254
|
+
};
|
|
255
|
+
Subscription2.prototype.remove = function(subscription) {
|
|
256
|
+
var subscriptions = this._subscriptions;
|
|
257
|
+
if (subscriptions) {
|
|
258
|
+
var subscriptionIndex = subscriptions.indexOf(subscription);
|
|
259
|
+
if (subscriptionIndex !== -1) {
|
|
260
|
+
subscriptions.splice(subscriptionIndex, 1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
Subscription2.EMPTY = function(empty) {
|
|
265
|
+
empty.closed = true;
|
|
266
|
+
return empty;
|
|
267
|
+
}(new Subscription2());
|
|
268
|
+
return Subscription2;
|
|
269
|
+
}();
|
|
270
|
+
exports.Subscription = Subscription;
|
|
271
|
+
function flattenUnsubscriptionErrors(errors) {
|
|
272
|
+
return errors.reduce(function(errs, err) {
|
|
273
|
+
return errs.concat(err instanceof UnsubscriptionError_1.UnsubscriptionError ? err.errors : err);
|
|
274
|
+
}, []);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// node_modules/rxjs/internal/symbol/rxSubscriber.js
|
|
280
|
+
var require_rxSubscriber = __commonJS({
|
|
281
|
+
"node_modules/rxjs/internal/symbol/rxSubscriber.js"(exports) {
|
|
282
|
+
"use strict";
|
|
283
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
284
|
+
exports.rxSubscriber = function() {
|
|
285
|
+
return typeof Symbol === "function" ? Symbol("rxSubscriber") : "@@rxSubscriber_" + Math.random();
|
|
286
|
+
}();
|
|
287
|
+
exports.$$rxSubscriber = exports.rxSubscriber;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// node_modules/rxjs/internal/Subscriber.js
|
|
292
|
+
var require_Subscriber = __commonJS({
|
|
293
|
+
"node_modules/rxjs/internal/Subscriber.js"(exports) {
|
|
294
|
+
"use strict";
|
|
295
|
+
var __extends = exports && exports.__extends || function() {
|
|
296
|
+
var extendStatics = function(d, b) {
|
|
297
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
298
|
+
d2.__proto__ = b2;
|
|
299
|
+
} || function(d2, b2) {
|
|
300
|
+
for (var p in b2)
|
|
301
|
+
if (b2.hasOwnProperty(p))
|
|
302
|
+
d2[p] = b2[p];
|
|
303
|
+
};
|
|
304
|
+
return extendStatics(d, b);
|
|
305
|
+
};
|
|
306
|
+
return function(d, b) {
|
|
307
|
+
extendStatics(d, b);
|
|
308
|
+
function __() {
|
|
309
|
+
this.constructor = d;
|
|
310
|
+
}
|
|
311
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
312
|
+
};
|
|
313
|
+
}();
|
|
314
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
315
|
+
var isFunction_1 = require_isFunction();
|
|
316
|
+
var Observer_1 = require_Observer();
|
|
317
|
+
var Subscription_1 = require_Subscription();
|
|
318
|
+
var rxSubscriber_1 = require_rxSubscriber();
|
|
319
|
+
var config_1 = require_config();
|
|
320
|
+
var hostReportError_1 = require_hostReportError();
|
|
321
|
+
var Subscriber = function(_super) {
|
|
322
|
+
__extends(Subscriber2, _super);
|
|
323
|
+
function Subscriber2(destinationOrNext, error, complete) {
|
|
324
|
+
var _this = _super.call(this) || this;
|
|
325
|
+
_this.syncErrorValue = null;
|
|
326
|
+
_this.syncErrorThrown = false;
|
|
327
|
+
_this.syncErrorThrowable = false;
|
|
328
|
+
_this.isStopped = false;
|
|
329
|
+
switch (arguments.length) {
|
|
330
|
+
case 0:
|
|
331
|
+
_this.destination = Observer_1.empty;
|
|
332
|
+
break;
|
|
333
|
+
case 1:
|
|
334
|
+
if (!destinationOrNext) {
|
|
335
|
+
_this.destination = Observer_1.empty;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
if (typeof destinationOrNext === "object") {
|
|
339
|
+
if (destinationOrNext instanceof Subscriber2) {
|
|
340
|
+
_this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
|
|
341
|
+
_this.destination = destinationOrNext;
|
|
342
|
+
destinationOrNext.add(_this);
|
|
343
|
+
} else {
|
|
344
|
+
_this.syncErrorThrowable = true;
|
|
345
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext);
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
default:
|
|
350
|
+
_this.syncErrorThrowable = true;
|
|
351
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
return _this;
|
|
355
|
+
}
|
|
356
|
+
Subscriber2.prototype[rxSubscriber_1.rxSubscriber] = function() {
|
|
357
|
+
return this;
|
|
358
|
+
};
|
|
359
|
+
Subscriber2.create = function(next, error, complete) {
|
|
360
|
+
var subscriber = new Subscriber2(next, error, complete);
|
|
361
|
+
subscriber.syncErrorThrowable = false;
|
|
362
|
+
return subscriber;
|
|
363
|
+
};
|
|
364
|
+
Subscriber2.prototype.next = function(value) {
|
|
365
|
+
if (!this.isStopped) {
|
|
366
|
+
this._next(value);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
Subscriber2.prototype.error = function(err) {
|
|
370
|
+
if (!this.isStopped) {
|
|
371
|
+
this.isStopped = true;
|
|
372
|
+
this._error(err);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
Subscriber2.prototype.complete = function() {
|
|
376
|
+
if (!this.isStopped) {
|
|
377
|
+
this.isStopped = true;
|
|
378
|
+
this._complete();
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
Subscriber2.prototype.unsubscribe = function() {
|
|
382
|
+
if (this.closed) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this.isStopped = true;
|
|
386
|
+
_super.prototype.unsubscribe.call(this);
|
|
387
|
+
};
|
|
388
|
+
Subscriber2.prototype._next = function(value) {
|
|
389
|
+
this.destination.next(value);
|
|
390
|
+
};
|
|
391
|
+
Subscriber2.prototype._error = function(err) {
|
|
392
|
+
this.destination.error(err);
|
|
393
|
+
this.unsubscribe();
|
|
394
|
+
};
|
|
395
|
+
Subscriber2.prototype._complete = function() {
|
|
396
|
+
this.destination.complete();
|
|
397
|
+
this.unsubscribe();
|
|
398
|
+
};
|
|
399
|
+
Subscriber2.prototype._unsubscribeAndRecycle = function() {
|
|
400
|
+
var _parentOrParents = this._parentOrParents;
|
|
401
|
+
this._parentOrParents = null;
|
|
402
|
+
this.unsubscribe();
|
|
403
|
+
this.closed = false;
|
|
404
|
+
this.isStopped = false;
|
|
405
|
+
this._parentOrParents = _parentOrParents;
|
|
406
|
+
return this;
|
|
407
|
+
};
|
|
408
|
+
return Subscriber2;
|
|
409
|
+
}(Subscription_1.Subscription);
|
|
410
|
+
exports.Subscriber = Subscriber;
|
|
411
|
+
var SafeSubscriber = function(_super) {
|
|
412
|
+
__extends(SafeSubscriber2, _super);
|
|
413
|
+
function SafeSubscriber2(_parentSubscriber, observerOrNext, error, complete) {
|
|
414
|
+
var _this = _super.call(this) || this;
|
|
415
|
+
_this._parentSubscriber = _parentSubscriber;
|
|
416
|
+
var next;
|
|
417
|
+
var context = _this;
|
|
418
|
+
if (isFunction_1.isFunction(observerOrNext)) {
|
|
419
|
+
next = observerOrNext;
|
|
420
|
+
} else if (observerOrNext) {
|
|
421
|
+
next = observerOrNext.next;
|
|
422
|
+
error = observerOrNext.error;
|
|
423
|
+
complete = observerOrNext.complete;
|
|
424
|
+
if (observerOrNext !== Observer_1.empty) {
|
|
425
|
+
context = Object.create(observerOrNext);
|
|
426
|
+
if (isFunction_1.isFunction(context.unsubscribe)) {
|
|
427
|
+
_this.add(context.unsubscribe.bind(context));
|
|
428
|
+
}
|
|
429
|
+
context.unsubscribe = _this.unsubscribe.bind(_this);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
_this._context = context;
|
|
433
|
+
_this._next = next;
|
|
434
|
+
_this._error = error;
|
|
435
|
+
_this._complete = complete;
|
|
436
|
+
return _this;
|
|
437
|
+
}
|
|
438
|
+
SafeSubscriber2.prototype.next = function(value) {
|
|
439
|
+
if (!this.isStopped && this._next) {
|
|
440
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
441
|
+
if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
442
|
+
this.__tryOrUnsub(this._next, value);
|
|
443
|
+
} else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
|
|
444
|
+
this.unsubscribe();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
SafeSubscriber2.prototype.error = function(err) {
|
|
449
|
+
if (!this.isStopped) {
|
|
450
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
451
|
+
var useDeprecatedSynchronousErrorHandling = config_1.config.useDeprecatedSynchronousErrorHandling;
|
|
452
|
+
if (this._error) {
|
|
453
|
+
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
454
|
+
this.__tryOrUnsub(this._error, err);
|
|
455
|
+
this.unsubscribe();
|
|
456
|
+
} else {
|
|
457
|
+
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
458
|
+
this.unsubscribe();
|
|
459
|
+
}
|
|
460
|
+
} else if (!_parentSubscriber.syncErrorThrowable) {
|
|
461
|
+
this.unsubscribe();
|
|
462
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
463
|
+
throw err;
|
|
464
|
+
}
|
|
465
|
+
hostReportError_1.hostReportError(err);
|
|
466
|
+
} else {
|
|
467
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
468
|
+
_parentSubscriber.syncErrorValue = err;
|
|
469
|
+
_parentSubscriber.syncErrorThrown = true;
|
|
470
|
+
} else {
|
|
471
|
+
hostReportError_1.hostReportError(err);
|
|
472
|
+
}
|
|
473
|
+
this.unsubscribe();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
SafeSubscriber2.prototype.complete = function() {
|
|
478
|
+
var _this = this;
|
|
479
|
+
if (!this.isStopped) {
|
|
480
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
481
|
+
if (this._complete) {
|
|
482
|
+
var wrappedComplete = function() {
|
|
483
|
+
return _this._complete.call(_this._context);
|
|
484
|
+
};
|
|
485
|
+
if (!config_1.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
486
|
+
this.__tryOrUnsub(wrappedComplete);
|
|
487
|
+
this.unsubscribe();
|
|
488
|
+
} else {
|
|
489
|
+
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
490
|
+
this.unsubscribe();
|
|
491
|
+
}
|
|
492
|
+
} else {
|
|
493
|
+
this.unsubscribe();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
SafeSubscriber2.prototype.__tryOrUnsub = function(fn, value) {
|
|
498
|
+
try {
|
|
499
|
+
fn.call(this._context, value);
|
|
500
|
+
} catch (err) {
|
|
501
|
+
this.unsubscribe();
|
|
502
|
+
if (config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
503
|
+
throw err;
|
|
504
|
+
} else {
|
|
505
|
+
hostReportError_1.hostReportError(err);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
SafeSubscriber2.prototype.__tryOrSetError = function(parent, fn, value) {
|
|
510
|
+
if (!config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
511
|
+
throw new Error("bad call");
|
|
512
|
+
}
|
|
513
|
+
try {
|
|
514
|
+
fn.call(this._context, value);
|
|
515
|
+
} catch (err) {
|
|
516
|
+
if (config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
517
|
+
parent.syncErrorValue = err;
|
|
518
|
+
parent.syncErrorThrown = true;
|
|
519
|
+
return true;
|
|
520
|
+
} else {
|
|
521
|
+
hostReportError_1.hostReportError(err);
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return false;
|
|
526
|
+
};
|
|
527
|
+
SafeSubscriber2.prototype._unsubscribe = function() {
|
|
528
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
529
|
+
this._context = null;
|
|
530
|
+
this._parentSubscriber = null;
|
|
531
|
+
_parentSubscriber.unsubscribe();
|
|
532
|
+
};
|
|
533
|
+
return SafeSubscriber2;
|
|
534
|
+
}(Subscriber);
|
|
535
|
+
exports.SafeSubscriber = SafeSubscriber;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// node_modules/rxjs/internal/util/canReportError.js
|
|
540
|
+
var require_canReportError = __commonJS({
|
|
541
|
+
"node_modules/rxjs/internal/util/canReportError.js"(exports) {
|
|
542
|
+
"use strict";
|
|
543
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
544
|
+
var Subscriber_1 = require_Subscriber();
|
|
545
|
+
function canReportError(observer) {
|
|
546
|
+
while (observer) {
|
|
547
|
+
var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
|
|
548
|
+
if (closed_1 || isStopped) {
|
|
549
|
+
return false;
|
|
550
|
+
} else if (destination && destination instanceof Subscriber_1.Subscriber) {
|
|
551
|
+
observer = destination;
|
|
552
|
+
} else {
|
|
553
|
+
observer = null;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
exports.canReportError = canReportError;
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// node_modules/rxjs/internal/util/toSubscriber.js
|
|
563
|
+
var require_toSubscriber = __commonJS({
|
|
564
|
+
"node_modules/rxjs/internal/util/toSubscriber.js"(exports) {
|
|
565
|
+
"use strict";
|
|
566
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
567
|
+
var Subscriber_1 = require_Subscriber();
|
|
568
|
+
var rxSubscriber_1 = require_rxSubscriber();
|
|
569
|
+
var Observer_1 = require_Observer();
|
|
570
|
+
function toSubscriber(nextOrObserver, error, complete) {
|
|
571
|
+
if (nextOrObserver) {
|
|
572
|
+
if (nextOrObserver instanceof Subscriber_1.Subscriber) {
|
|
573
|
+
return nextOrObserver;
|
|
574
|
+
}
|
|
575
|
+
if (nextOrObserver[rxSubscriber_1.rxSubscriber]) {
|
|
576
|
+
return nextOrObserver[rxSubscriber_1.rxSubscriber]();
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (!nextOrObserver && !error && !complete) {
|
|
580
|
+
return new Subscriber_1.Subscriber(Observer_1.empty);
|
|
581
|
+
}
|
|
582
|
+
return new Subscriber_1.Subscriber(nextOrObserver, error, complete);
|
|
583
|
+
}
|
|
584
|
+
exports.toSubscriber = toSubscriber;
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// node_modules/rxjs/internal/symbol/observable.js
|
|
589
|
+
var require_observable = __commonJS({
|
|
590
|
+
"node_modules/rxjs/internal/symbol/observable.js"(exports) {
|
|
591
|
+
"use strict";
|
|
592
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
593
|
+
exports.observable = function() {
|
|
594
|
+
return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
595
|
+
}();
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
// node_modules/rxjs/internal/util/identity.js
|
|
600
|
+
var require_identity = __commonJS({
|
|
601
|
+
"node_modules/rxjs/internal/util/identity.js"(exports) {
|
|
602
|
+
"use strict";
|
|
603
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
604
|
+
function identity(x) {
|
|
605
|
+
return x;
|
|
606
|
+
}
|
|
607
|
+
exports.identity = identity;
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// node_modules/rxjs/internal/util/pipe.js
|
|
612
|
+
var require_pipe = __commonJS({
|
|
613
|
+
"node_modules/rxjs/internal/util/pipe.js"(exports) {
|
|
614
|
+
"use strict";
|
|
615
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
616
|
+
var identity_1 = require_identity();
|
|
617
|
+
function pipe() {
|
|
618
|
+
var fns = [];
|
|
619
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
620
|
+
fns[_i] = arguments[_i];
|
|
621
|
+
}
|
|
622
|
+
return pipeFromArray(fns);
|
|
623
|
+
}
|
|
624
|
+
exports.pipe = pipe;
|
|
625
|
+
function pipeFromArray(fns) {
|
|
626
|
+
if (fns.length === 0) {
|
|
627
|
+
return identity_1.identity;
|
|
628
|
+
}
|
|
629
|
+
if (fns.length === 1) {
|
|
630
|
+
return fns[0];
|
|
631
|
+
}
|
|
632
|
+
return function piped(input) {
|
|
633
|
+
return fns.reduce(function(prev, fn) {
|
|
634
|
+
return fn(prev);
|
|
635
|
+
}, input);
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
exports.pipeFromArray = pipeFromArray;
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
// node_modules/rxjs/internal/Observable.js
|
|
643
|
+
var require_Observable = __commonJS({
|
|
644
|
+
"node_modules/rxjs/internal/Observable.js"(exports) {
|
|
645
|
+
"use strict";
|
|
646
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
647
|
+
var canReportError_1 = require_canReportError();
|
|
648
|
+
var toSubscriber_1 = require_toSubscriber();
|
|
649
|
+
var observable_1 = require_observable();
|
|
650
|
+
var pipe_1 = require_pipe();
|
|
651
|
+
var config_1 = require_config();
|
|
652
|
+
var Observable2 = function() {
|
|
653
|
+
function Observable3(subscribe) {
|
|
654
|
+
this._isScalar = false;
|
|
655
|
+
if (subscribe) {
|
|
656
|
+
this._subscribe = subscribe;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
Observable3.prototype.lift = function(operator) {
|
|
660
|
+
var observable2 = new Observable3();
|
|
661
|
+
observable2.source = this;
|
|
662
|
+
observable2.operator = operator;
|
|
663
|
+
return observable2;
|
|
664
|
+
};
|
|
665
|
+
Observable3.prototype.subscribe = function(observerOrNext, error, complete) {
|
|
666
|
+
var operator = this.operator;
|
|
667
|
+
var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);
|
|
668
|
+
if (operator) {
|
|
669
|
+
sink.add(operator.call(sink, this.source));
|
|
670
|
+
} else {
|
|
671
|
+
sink.add(this.source || config_1.config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink));
|
|
672
|
+
}
|
|
673
|
+
if (config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
674
|
+
if (sink.syncErrorThrowable) {
|
|
675
|
+
sink.syncErrorThrowable = false;
|
|
676
|
+
if (sink.syncErrorThrown) {
|
|
677
|
+
throw sink.syncErrorValue;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return sink;
|
|
682
|
+
};
|
|
683
|
+
Observable3.prototype._trySubscribe = function(sink) {
|
|
684
|
+
try {
|
|
685
|
+
return this._subscribe(sink);
|
|
686
|
+
} catch (err) {
|
|
687
|
+
if (config_1.config.useDeprecatedSynchronousErrorHandling) {
|
|
688
|
+
sink.syncErrorThrown = true;
|
|
689
|
+
sink.syncErrorValue = err;
|
|
690
|
+
}
|
|
691
|
+
if (canReportError_1.canReportError(sink)) {
|
|
692
|
+
sink.error(err);
|
|
693
|
+
} else {
|
|
694
|
+
console.warn(err);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
Observable3.prototype.forEach = function(next, promiseCtor) {
|
|
699
|
+
var _this = this;
|
|
700
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
701
|
+
return new promiseCtor(function(resolve, reject) {
|
|
702
|
+
var subscription;
|
|
703
|
+
subscription = _this.subscribe(function(value) {
|
|
704
|
+
try {
|
|
705
|
+
next(value);
|
|
706
|
+
} catch (err) {
|
|
707
|
+
reject(err);
|
|
708
|
+
if (subscription) {
|
|
709
|
+
subscription.unsubscribe();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}, reject, resolve);
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
Observable3.prototype._subscribe = function(subscriber) {
|
|
716
|
+
var source = this.source;
|
|
717
|
+
return source && source.subscribe(subscriber);
|
|
718
|
+
};
|
|
719
|
+
Observable3.prototype[observable_1.observable] = function() {
|
|
720
|
+
return this;
|
|
721
|
+
};
|
|
722
|
+
Observable3.prototype.pipe = function() {
|
|
723
|
+
var operations = [];
|
|
724
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
725
|
+
operations[_i] = arguments[_i];
|
|
726
|
+
}
|
|
727
|
+
if (operations.length === 0) {
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
return pipe_1.pipeFromArray(operations)(this);
|
|
731
|
+
};
|
|
732
|
+
Observable3.prototype.toPromise = function(promiseCtor) {
|
|
733
|
+
var _this = this;
|
|
734
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
735
|
+
return new promiseCtor(function(resolve, reject) {
|
|
736
|
+
var value;
|
|
737
|
+
_this.subscribe(function(x) {
|
|
738
|
+
return value = x;
|
|
739
|
+
}, function(err) {
|
|
740
|
+
return reject(err);
|
|
741
|
+
}, function() {
|
|
742
|
+
return resolve(value);
|
|
743
|
+
});
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
Observable3.create = function(subscribe) {
|
|
747
|
+
return new Observable3(subscribe);
|
|
748
|
+
};
|
|
749
|
+
return Observable3;
|
|
750
|
+
}();
|
|
751
|
+
exports.Observable = Observable2;
|
|
752
|
+
function getPromiseCtor(promiseCtor) {
|
|
753
|
+
if (!promiseCtor) {
|
|
754
|
+
promiseCtor = config_1.config.Promise || Promise;
|
|
755
|
+
}
|
|
756
|
+
if (!promiseCtor) {
|
|
757
|
+
throw new Error("no Promise impl found");
|
|
758
|
+
}
|
|
759
|
+
return promiseCtor;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
// node_modules/rxjs/internal/operators/filter.js
|
|
765
|
+
var require_filter = __commonJS({
|
|
766
|
+
"node_modules/rxjs/internal/operators/filter.js"(exports) {
|
|
767
|
+
"use strict";
|
|
768
|
+
var __extends = exports && exports.__extends || function() {
|
|
769
|
+
var extendStatics = function(d, b) {
|
|
770
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
771
|
+
d2.__proto__ = b2;
|
|
772
|
+
} || function(d2, b2) {
|
|
773
|
+
for (var p in b2)
|
|
774
|
+
if (b2.hasOwnProperty(p))
|
|
775
|
+
d2[p] = b2[p];
|
|
776
|
+
};
|
|
777
|
+
return extendStatics(d, b);
|
|
778
|
+
};
|
|
779
|
+
return function(d, b) {
|
|
780
|
+
extendStatics(d, b);
|
|
781
|
+
function __() {
|
|
782
|
+
this.constructor = d;
|
|
783
|
+
}
|
|
784
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
785
|
+
};
|
|
786
|
+
}();
|
|
787
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
788
|
+
var Subscriber_1 = require_Subscriber();
|
|
789
|
+
function filter2(predicate, thisArg) {
|
|
790
|
+
return function filterOperatorFunction(source) {
|
|
791
|
+
return source.lift(new FilterOperator(predicate, thisArg));
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
exports.filter = filter2;
|
|
795
|
+
var FilterOperator = function() {
|
|
796
|
+
function FilterOperator2(predicate, thisArg) {
|
|
797
|
+
this.predicate = predicate;
|
|
798
|
+
this.thisArg = thisArg;
|
|
799
|
+
}
|
|
800
|
+
FilterOperator2.prototype.call = function(subscriber, source) {
|
|
801
|
+
return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
|
|
802
|
+
};
|
|
803
|
+
return FilterOperator2;
|
|
804
|
+
}();
|
|
805
|
+
var FilterSubscriber = function(_super) {
|
|
806
|
+
__extends(FilterSubscriber2, _super);
|
|
807
|
+
function FilterSubscriber2(destination, predicate, thisArg) {
|
|
808
|
+
var _this = _super.call(this, destination) || this;
|
|
809
|
+
_this.predicate = predicate;
|
|
810
|
+
_this.thisArg = thisArg;
|
|
811
|
+
_this.count = 0;
|
|
812
|
+
return _this;
|
|
813
|
+
}
|
|
814
|
+
FilterSubscriber2.prototype._next = function(value) {
|
|
815
|
+
var result;
|
|
816
|
+
try {
|
|
817
|
+
result = this.predicate.call(this.thisArg, value, this.count++);
|
|
818
|
+
} catch (err) {
|
|
819
|
+
this.destination.error(err);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (result) {
|
|
823
|
+
this.destination.next(value);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
return FilterSubscriber2;
|
|
827
|
+
}(Subscriber_1.Subscriber);
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
// node_modules/rxjs/internal/operators/map.js
|
|
832
|
+
var require_map = __commonJS({
|
|
833
|
+
"node_modules/rxjs/internal/operators/map.js"(exports) {
|
|
834
|
+
"use strict";
|
|
835
|
+
var __extends = exports && exports.__extends || function() {
|
|
836
|
+
var extendStatics = function(d, b) {
|
|
837
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
838
|
+
d2.__proto__ = b2;
|
|
839
|
+
} || function(d2, b2) {
|
|
840
|
+
for (var p in b2)
|
|
841
|
+
if (b2.hasOwnProperty(p))
|
|
842
|
+
d2[p] = b2[p];
|
|
843
|
+
};
|
|
844
|
+
return extendStatics(d, b);
|
|
845
|
+
};
|
|
846
|
+
return function(d, b) {
|
|
847
|
+
extendStatics(d, b);
|
|
848
|
+
function __() {
|
|
849
|
+
this.constructor = d;
|
|
850
|
+
}
|
|
851
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
852
|
+
};
|
|
853
|
+
}();
|
|
854
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
855
|
+
var Subscriber_1 = require_Subscriber();
|
|
856
|
+
function map2(project, thisArg) {
|
|
857
|
+
return function mapOperation(source) {
|
|
858
|
+
if (typeof project !== "function") {
|
|
859
|
+
throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");
|
|
860
|
+
}
|
|
861
|
+
return source.lift(new MapOperator(project, thisArg));
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
exports.map = map2;
|
|
865
|
+
var MapOperator = function() {
|
|
866
|
+
function MapOperator2(project, thisArg) {
|
|
867
|
+
this.project = project;
|
|
868
|
+
this.thisArg = thisArg;
|
|
869
|
+
}
|
|
870
|
+
MapOperator2.prototype.call = function(subscriber, source) {
|
|
871
|
+
return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
|
|
872
|
+
};
|
|
873
|
+
return MapOperator2;
|
|
874
|
+
}();
|
|
875
|
+
exports.MapOperator = MapOperator;
|
|
876
|
+
var MapSubscriber = function(_super) {
|
|
877
|
+
__extends(MapSubscriber2, _super);
|
|
878
|
+
function MapSubscriber2(destination, project, thisArg) {
|
|
879
|
+
var _this = _super.call(this, destination) || this;
|
|
880
|
+
_this.project = project;
|
|
881
|
+
_this.count = 0;
|
|
882
|
+
_this.thisArg = thisArg || _this;
|
|
883
|
+
return _this;
|
|
884
|
+
}
|
|
885
|
+
MapSubscriber2.prototype._next = function(value) {
|
|
886
|
+
var result;
|
|
887
|
+
try {
|
|
888
|
+
result = this.project.call(this.thisArg, value, this.count++);
|
|
889
|
+
} catch (err) {
|
|
890
|
+
this.destination.error(err);
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
this.destination.next(result);
|
|
894
|
+
};
|
|
895
|
+
return MapSubscriber2;
|
|
896
|
+
}(Subscriber_1.Subscriber);
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
// node_modules/event-source-polyfill/src/eventsource.js
|
|
901
|
+
var require_eventsource = __commonJS({
|
|
902
|
+
"node_modules/event-source-polyfill/src/eventsource.js"(exports, module) {
|
|
903
|
+
(function(global2) {
|
|
904
|
+
"use strict";
|
|
905
|
+
var setTimeout2 = global2.setTimeout;
|
|
906
|
+
var clearTimeout2 = global2.clearTimeout;
|
|
907
|
+
var XMLHttpRequest2 = global2.XMLHttpRequest;
|
|
908
|
+
var XDomainRequest2 = global2.XDomainRequest;
|
|
909
|
+
var ActiveXObject = global2.ActiveXObject;
|
|
910
|
+
var NativeEventSource = global2.EventSource;
|
|
911
|
+
var document = global2.document;
|
|
912
|
+
var Promise2 = global2.Promise;
|
|
913
|
+
var fetch2 = global2.fetch;
|
|
914
|
+
var Response = global2.Response;
|
|
915
|
+
var TextDecoder = global2.TextDecoder;
|
|
916
|
+
var TextEncoder = global2.TextEncoder;
|
|
917
|
+
var AbortController2 = global2.AbortController;
|
|
918
|
+
if (typeof window !== "undefined" && typeof document !== "undefined" && !("readyState" in document) && document.body == null) {
|
|
919
|
+
document.readyState = "loading";
|
|
920
|
+
window.addEventListener("load", function(event) {
|
|
921
|
+
document.readyState = "complete";
|
|
922
|
+
}, false);
|
|
923
|
+
}
|
|
924
|
+
if (XMLHttpRequest2 == null && ActiveXObject != null) {
|
|
925
|
+
XMLHttpRequest2 = function() {
|
|
926
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
if (Object.create == void 0) {
|
|
930
|
+
Object.create = function(C) {
|
|
931
|
+
function F() {
|
|
932
|
+
}
|
|
933
|
+
F.prototype = C;
|
|
934
|
+
return new F();
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
if (!Date.now) {
|
|
938
|
+
Date.now = function now() {
|
|
939
|
+
return new Date().getTime();
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
if (AbortController2 == void 0) {
|
|
943
|
+
var originalFetch2 = fetch2;
|
|
944
|
+
fetch2 = function(url, options) {
|
|
945
|
+
var signal = options.signal;
|
|
946
|
+
return originalFetch2(url, { headers: options.headers, credentials: options.credentials, cache: options.cache }).then(function(response) {
|
|
947
|
+
var reader = response.body.getReader();
|
|
948
|
+
signal._reader = reader;
|
|
949
|
+
if (signal._aborted) {
|
|
950
|
+
signal._reader.cancel();
|
|
951
|
+
}
|
|
952
|
+
return {
|
|
953
|
+
status: response.status,
|
|
954
|
+
statusText: response.statusText,
|
|
955
|
+
headers: response.headers,
|
|
956
|
+
body: {
|
|
957
|
+
getReader: function() {
|
|
958
|
+
return reader;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
});
|
|
963
|
+
};
|
|
964
|
+
AbortController2 = function() {
|
|
965
|
+
this.signal = {
|
|
966
|
+
_reader: null,
|
|
967
|
+
_aborted: false
|
|
968
|
+
};
|
|
969
|
+
this.abort = function() {
|
|
970
|
+
if (this.signal._reader != null) {
|
|
971
|
+
this.signal._reader.cancel();
|
|
972
|
+
}
|
|
973
|
+
this.signal._aborted = true;
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function TextDecoderPolyfill() {
|
|
978
|
+
this.bitsNeeded = 0;
|
|
979
|
+
this.codePoint = 0;
|
|
980
|
+
}
|
|
981
|
+
TextDecoderPolyfill.prototype.decode = function(octets) {
|
|
982
|
+
function valid(codePoint2, shift, octetsCount2) {
|
|
983
|
+
if (octetsCount2 === 1) {
|
|
984
|
+
return codePoint2 >= 128 >> shift && codePoint2 << shift <= 2047;
|
|
985
|
+
}
|
|
986
|
+
if (octetsCount2 === 2) {
|
|
987
|
+
return codePoint2 >= 2048 >> shift && codePoint2 << shift <= 55295 || codePoint2 >= 57344 >> shift && codePoint2 << shift <= 65535;
|
|
988
|
+
}
|
|
989
|
+
if (octetsCount2 === 3) {
|
|
990
|
+
return codePoint2 >= 65536 >> shift && codePoint2 << shift <= 1114111;
|
|
991
|
+
}
|
|
992
|
+
throw new Error();
|
|
993
|
+
}
|
|
994
|
+
function octetsCount(bitsNeeded2, codePoint2) {
|
|
995
|
+
if (bitsNeeded2 === 6 * 1) {
|
|
996
|
+
return codePoint2 >> 6 > 15 ? 3 : codePoint2 > 31 ? 2 : 1;
|
|
997
|
+
}
|
|
998
|
+
if (bitsNeeded2 === 6 * 2) {
|
|
999
|
+
return codePoint2 > 15 ? 3 : 2;
|
|
1000
|
+
}
|
|
1001
|
+
if (bitsNeeded2 === 6 * 3) {
|
|
1002
|
+
return 3;
|
|
1003
|
+
}
|
|
1004
|
+
throw new Error();
|
|
1005
|
+
}
|
|
1006
|
+
var REPLACER = 65533;
|
|
1007
|
+
var string = "";
|
|
1008
|
+
var bitsNeeded = this.bitsNeeded;
|
|
1009
|
+
var codePoint = this.codePoint;
|
|
1010
|
+
for (var i = 0; i < octets.length; i += 1) {
|
|
1011
|
+
var octet = octets[i];
|
|
1012
|
+
if (bitsNeeded !== 0) {
|
|
1013
|
+
if (octet < 128 || octet > 191 || !valid(codePoint << 6 | octet & 63, bitsNeeded - 6, octetsCount(bitsNeeded, codePoint))) {
|
|
1014
|
+
bitsNeeded = 0;
|
|
1015
|
+
codePoint = REPLACER;
|
|
1016
|
+
string += String.fromCharCode(codePoint);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
if (bitsNeeded === 0) {
|
|
1020
|
+
if (octet >= 0 && octet <= 127) {
|
|
1021
|
+
bitsNeeded = 0;
|
|
1022
|
+
codePoint = octet;
|
|
1023
|
+
} else if (octet >= 192 && octet <= 223) {
|
|
1024
|
+
bitsNeeded = 6 * 1;
|
|
1025
|
+
codePoint = octet & 31;
|
|
1026
|
+
} else if (octet >= 224 && octet <= 239) {
|
|
1027
|
+
bitsNeeded = 6 * 2;
|
|
1028
|
+
codePoint = octet & 15;
|
|
1029
|
+
} else if (octet >= 240 && octet <= 247) {
|
|
1030
|
+
bitsNeeded = 6 * 3;
|
|
1031
|
+
codePoint = octet & 7;
|
|
1032
|
+
} else {
|
|
1033
|
+
bitsNeeded = 0;
|
|
1034
|
+
codePoint = REPLACER;
|
|
1035
|
+
}
|
|
1036
|
+
if (bitsNeeded !== 0 && !valid(codePoint, bitsNeeded, octetsCount(bitsNeeded, codePoint))) {
|
|
1037
|
+
bitsNeeded = 0;
|
|
1038
|
+
codePoint = REPLACER;
|
|
1039
|
+
}
|
|
1040
|
+
} else {
|
|
1041
|
+
bitsNeeded -= 6;
|
|
1042
|
+
codePoint = codePoint << 6 | octet & 63;
|
|
1043
|
+
}
|
|
1044
|
+
if (bitsNeeded === 0) {
|
|
1045
|
+
if (codePoint <= 65535) {
|
|
1046
|
+
string += String.fromCharCode(codePoint);
|
|
1047
|
+
} else {
|
|
1048
|
+
string += String.fromCharCode(55296 + (codePoint - 65535 - 1 >> 10));
|
|
1049
|
+
string += String.fromCharCode(56320 + (codePoint - 65535 - 1 & 1023));
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
this.bitsNeeded = bitsNeeded;
|
|
1054
|
+
this.codePoint = codePoint;
|
|
1055
|
+
return string;
|
|
1056
|
+
};
|
|
1057
|
+
var supportsStreamOption = function() {
|
|
1058
|
+
try {
|
|
1059
|
+
return new TextDecoder().decode(new TextEncoder().encode("test"), { stream: true }) === "test";
|
|
1060
|
+
} catch (error) {
|
|
1061
|
+
console.debug("TextDecoder does not support streaming option. Using polyfill instead: " + error);
|
|
1062
|
+
}
|
|
1063
|
+
return false;
|
|
1064
|
+
};
|
|
1065
|
+
if (TextDecoder == void 0 || TextEncoder == void 0 || !supportsStreamOption()) {
|
|
1066
|
+
TextDecoder = TextDecoderPolyfill;
|
|
1067
|
+
}
|
|
1068
|
+
var k = function() {
|
|
1069
|
+
};
|
|
1070
|
+
function XHRWrapper(xhr) {
|
|
1071
|
+
this.withCredentials = false;
|
|
1072
|
+
this.readyState = 0;
|
|
1073
|
+
this.status = 0;
|
|
1074
|
+
this.statusText = "";
|
|
1075
|
+
this.responseText = "";
|
|
1076
|
+
this.onprogress = k;
|
|
1077
|
+
this.onload = k;
|
|
1078
|
+
this.onerror = k;
|
|
1079
|
+
this.onreadystatechange = k;
|
|
1080
|
+
this._contentType = "";
|
|
1081
|
+
this._xhr = xhr;
|
|
1082
|
+
this._sendTimeout = 0;
|
|
1083
|
+
this._abort = k;
|
|
1084
|
+
}
|
|
1085
|
+
XHRWrapper.prototype.open = function(method, url) {
|
|
1086
|
+
this._abort(true);
|
|
1087
|
+
var that = this;
|
|
1088
|
+
var xhr = this._xhr;
|
|
1089
|
+
var state = 1;
|
|
1090
|
+
var timeout = 0;
|
|
1091
|
+
this._abort = function(silent) {
|
|
1092
|
+
if (that._sendTimeout !== 0) {
|
|
1093
|
+
clearTimeout2(that._sendTimeout);
|
|
1094
|
+
that._sendTimeout = 0;
|
|
1095
|
+
}
|
|
1096
|
+
if (state === 1 || state === 2 || state === 3) {
|
|
1097
|
+
state = 4;
|
|
1098
|
+
xhr.onload = k;
|
|
1099
|
+
xhr.onerror = k;
|
|
1100
|
+
xhr.onabort = k;
|
|
1101
|
+
xhr.onprogress = k;
|
|
1102
|
+
xhr.onreadystatechange = k;
|
|
1103
|
+
xhr.abort();
|
|
1104
|
+
if (timeout !== 0) {
|
|
1105
|
+
clearTimeout2(timeout);
|
|
1106
|
+
timeout = 0;
|
|
1107
|
+
}
|
|
1108
|
+
if (!silent) {
|
|
1109
|
+
that.readyState = 4;
|
|
1110
|
+
that.onabort(null);
|
|
1111
|
+
that.onreadystatechange();
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
state = 0;
|
|
1115
|
+
};
|
|
1116
|
+
var onStart = function() {
|
|
1117
|
+
if (state === 1) {
|
|
1118
|
+
var status = 0;
|
|
1119
|
+
var statusText = "";
|
|
1120
|
+
var contentType = void 0;
|
|
1121
|
+
if (!("contentType" in xhr)) {
|
|
1122
|
+
try {
|
|
1123
|
+
status = xhr.status;
|
|
1124
|
+
statusText = xhr.statusText;
|
|
1125
|
+
contentType = xhr.getResponseHeader("Content-Type");
|
|
1126
|
+
} catch (error) {
|
|
1127
|
+
status = 0;
|
|
1128
|
+
statusText = "";
|
|
1129
|
+
contentType = void 0;
|
|
1130
|
+
}
|
|
1131
|
+
} else {
|
|
1132
|
+
status = 200;
|
|
1133
|
+
statusText = "OK";
|
|
1134
|
+
contentType = xhr.contentType;
|
|
1135
|
+
}
|
|
1136
|
+
if (status !== 0) {
|
|
1137
|
+
state = 2;
|
|
1138
|
+
that.readyState = 2;
|
|
1139
|
+
that.status = status;
|
|
1140
|
+
that.statusText = statusText;
|
|
1141
|
+
that._contentType = contentType;
|
|
1142
|
+
that.onreadystatechange();
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
var onProgress = function() {
|
|
1147
|
+
onStart();
|
|
1148
|
+
if (state === 2 || state === 3) {
|
|
1149
|
+
state = 3;
|
|
1150
|
+
var responseText = "";
|
|
1151
|
+
try {
|
|
1152
|
+
responseText = xhr.responseText;
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
}
|
|
1155
|
+
that.readyState = 3;
|
|
1156
|
+
that.responseText = responseText;
|
|
1157
|
+
that.onprogress();
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
var onFinish = function(type, event) {
|
|
1161
|
+
if (event == null || event.preventDefault == null) {
|
|
1162
|
+
event = {
|
|
1163
|
+
preventDefault: k
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
onProgress();
|
|
1167
|
+
if (state === 1 || state === 2 || state === 3) {
|
|
1168
|
+
state = 4;
|
|
1169
|
+
if (timeout !== 0) {
|
|
1170
|
+
clearTimeout2(timeout);
|
|
1171
|
+
timeout = 0;
|
|
1172
|
+
}
|
|
1173
|
+
that.readyState = 4;
|
|
1174
|
+
if (type === "load") {
|
|
1175
|
+
that.onload(event);
|
|
1176
|
+
} else if (type === "error") {
|
|
1177
|
+
that.onerror(event);
|
|
1178
|
+
} else if (type === "abort") {
|
|
1179
|
+
that.onabort(event);
|
|
1180
|
+
} else {
|
|
1181
|
+
throw new TypeError();
|
|
1182
|
+
}
|
|
1183
|
+
that.onreadystatechange();
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
var onReadyStateChange = function(event) {
|
|
1187
|
+
if (xhr != void 0) {
|
|
1188
|
+
if (xhr.readyState === 4) {
|
|
1189
|
+
if (!("onload" in xhr) || !("onerror" in xhr) || !("onabort" in xhr)) {
|
|
1190
|
+
onFinish(xhr.responseText === "" ? "error" : "load", event);
|
|
1191
|
+
}
|
|
1192
|
+
} else if (xhr.readyState === 3) {
|
|
1193
|
+
if (!("onprogress" in xhr)) {
|
|
1194
|
+
onProgress();
|
|
1195
|
+
}
|
|
1196
|
+
} else if (xhr.readyState === 2) {
|
|
1197
|
+
onStart();
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
var onTimeout = function() {
|
|
1202
|
+
timeout = setTimeout2(function() {
|
|
1203
|
+
onTimeout();
|
|
1204
|
+
}, 500);
|
|
1205
|
+
if (xhr.readyState === 3) {
|
|
1206
|
+
onProgress();
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
if ("onload" in xhr) {
|
|
1210
|
+
xhr.onload = function(event) {
|
|
1211
|
+
onFinish("load", event);
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
if ("onerror" in xhr) {
|
|
1215
|
+
xhr.onerror = function(event) {
|
|
1216
|
+
onFinish("error", event);
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
if ("onabort" in xhr) {
|
|
1220
|
+
xhr.onabort = function(event) {
|
|
1221
|
+
onFinish("abort", event);
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
if ("onprogress" in xhr) {
|
|
1225
|
+
xhr.onprogress = onProgress;
|
|
1226
|
+
}
|
|
1227
|
+
if ("onreadystatechange" in xhr) {
|
|
1228
|
+
xhr.onreadystatechange = function(event) {
|
|
1229
|
+
onReadyStateChange(event);
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
if ("contentType" in xhr || !("ontimeout" in XMLHttpRequest2.prototype)) {
|
|
1233
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + "padding=true";
|
|
1234
|
+
}
|
|
1235
|
+
xhr.open(method, url, true);
|
|
1236
|
+
if ("readyState" in xhr) {
|
|
1237
|
+
timeout = setTimeout2(function() {
|
|
1238
|
+
onTimeout();
|
|
1239
|
+
}, 0);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
XHRWrapper.prototype.abort = function() {
|
|
1243
|
+
this._abort(false);
|
|
1244
|
+
};
|
|
1245
|
+
XHRWrapper.prototype.getResponseHeader = function(name) {
|
|
1246
|
+
return this._contentType;
|
|
1247
|
+
};
|
|
1248
|
+
XHRWrapper.prototype.setRequestHeader = function(name, value) {
|
|
1249
|
+
var xhr = this._xhr;
|
|
1250
|
+
if ("setRequestHeader" in xhr) {
|
|
1251
|
+
xhr.setRequestHeader(name, value);
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
XHRWrapper.prototype.getAllResponseHeaders = function() {
|
|
1255
|
+
return this._xhr.getAllResponseHeaders != void 0 ? this._xhr.getAllResponseHeaders() || "" : "";
|
|
1256
|
+
};
|
|
1257
|
+
XHRWrapper.prototype.send = function() {
|
|
1258
|
+
if ((!("ontimeout" in XMLHttpRequest2.prototype) || !("sendAsBinary" in XMLHttpRequest2.prototype) && !("mozAnon" in XMLHttpRequest2.prototype)) && document != void 0 && document.readyState != void 0 && document.readyState !== "complete") {
|
|
1259
|
+
var that = this;
|
|
1260
|
+
that._sendTimeout = setTimeout2(function() {
|
|
1261
|
+
that._sendTimeout = 0;
|
|
1262
|
+
that.send();
|
|
1263
|
+
}, 4);
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
var xhr = this._xhr;
|
|
1267
|
+
if ("withCredentials" in xhr) {
|
|
1268
|
+
xhr.withCredentials = this.withCredentials;
|
|
1269
|
+
}
|
|
1270
|
+
try {
|
|
1271
|
+
xhr.send(void 0);
|
|
1272
|
+
} catch (error1) {
|
|
1273
|
+
throw error1;
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
function toLowerCase(name) {
|
|
1277
|
+
return name.replace(/[A-Z]/g, function(c) {
|
|
1278
|
+
return String.fromCharCode(c.charCodeAt(0) + 32);
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
function HeadersPolyfill(all) {
|
|
1282
|
+
var map2 = /* @__PURE__ */ Object.create(null);
|
|
1283
|
+
var array = all.split("\r\n");
|
|
1284
|
+
for (var i = 0; i < array.length; i += 1) {
|
|
1285
|
+
var line = array[i];
|
|
1286
|
+
var parts = line.split(": ");
|
|
1287
|
+
var name = parts.shift();
|
|
1288
|
+
var value = parts.join(": ");
|
|
1289
|
+
map2[toLowerCase(name)] = value;
|
|
1290
|
+
}
|
|
1291
|
+
this._map = map2;
|
|
1292
|
+
}
|
|
1293
|
+
HeadersPolyfill.prototype.get = function(name) {
|
|
1294
|
+
return this._map[toLowerCase(name)];
|
|
1295
|
+
};
|
|
1296
|
+
if (XMLHttpRequest2 != null && XMLHttpRequest2.HEADERS_RECEIVED == null) {
|
|
1297
|
+
XMLHttpRequest2.HEADERS_RECEIVED = 2;
|
|
1298
|
+
}
|
|
1299
|
+
function XHRTransport() {
|
|
1300
|
+
}
|
|
1301
|
+
XHRTransport.prototype.open = function(xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
|
|
1302
|
+
xhr.open("GET", url);
|
|
1303
|
+
var offset = 0;
|
|
1304
|
+
xhr.onprogress = function() {
|
|
1305
|
+
var responseText = xhr.responseText;
|
|
1306
|
+
var chunk = responseText.slice(offset);
|
|
1307
|
+
offset += chunk.length;
|
|
1308
|
+
onProgressCallback(chunk);
|
|
1309
|
+
};
|
|
1310
|
+
xhr.onerror = function(event) {
|
|
1311
|
+
event.preventDefault();
|
|
1312
|
+
onFinishCallback(new Error("NetworkError"));
|
|
1313
|
+
};
|
|
1314
|
+
xhr.onload = function() {
|
|
1315
|
+
onFinishCallback(null);
|
|
1316
|
+
};
|
|
1317
|
+
xhr.onabort = function() {
|
|
1318
|
+
onFinishCallback(null);
|
|
1319
|
+
};
|
|
1320
|
+
xhr.onreadystatechange = function() {
|
|
1321
|
+
if (xhr.readyState === XMLHttpRequest2.HEADERS_RECEIVED) {
|
|
1322
|
+
var status = xhr.status;
|
|
1323
|
+
var statusText = xhr.statusText;
|
|
1324
|
+
var contentType = xhr.getResponseHeader("Content-Type");
|
|
1325
|
+
var headers2 = xhr.getAllResponseHeaders();
|
|
1326
|
+
onStartCallback(status, statusText, contentType, new HeadersPolyfill(headers2));
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
xhr.withCredentials = withCredentials;
|
|
1330
|
+
for (var name in headers) {
|
|
1331
|
+
if (Object.prototype.hasOwnProperty.call(headers, name)) {
|
|
1332
|
+
xhr.setRequestHeader(name, headers[name]);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
xhr.send();
|
|
1336
|
+
return xhr;
|
|
1337
|
+
};
|
|
1338
|
+
function HeadersWrapper(headers) {
|
|
1339
|
+
this._headers = headers;
|
|
1340
|
+
}
|
|
1341
|
+
HeadersWrapper.prototype.get = function(name) {
|
|
1342
|
+
return this._headers.get(name);
|
|
1343
|
+
};
|
|
1344
|
+
function FetchTransport() {
|
|
1345
|
+
}
|
|
1346
|
+
FetchTransport.prototype.open = function(xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
|
|
1347
|
+
var reader = null;
|
|
1348
|
+
var controller = new AbortController2();
|
|
1349
|
+
var signal = controller.signal;
|
|
1350
|
+
var textDecoder = new TextDecoder();
|
|
1351
|
+
fetch2(url, {
|
|
1352
|
+
headers,
|
|
1353
|
+
credentials: withCredentials ? "include" : "same-origin",
|
|
1354
|
+
signal,
|
|
1355
|
+
cache: "no-store"
|
|
1356
|
+
}).then(function(response) {
|
|
1357
|
+
reader = response.body.getReader();
|
|
1358
|
+
onStartCallback(response.status, response.statusText, response.headers.get("Content-Type"), new HeadersWrapper(response.headers));
|
|
1359
|
+
return new Promise2(function(resolve, reject) {
|
|
1360
|
+
var readNextChunk = function() {
|
|
1361
|
+
reader.read().then(function(result) {
|
|
1362
|
+
if (result.done) {
|
|
1363
|
+
resolve(void 0);
|
|
1364
|
+
} else {
|
|
1365
|
+
var chunk = textDecoder.decode(result.value, { stream: true });
|
|
1366
|
+
onProgressCallback(chunk);
|
|
1367
|
+
readNextChunk();
|
|
1368
|
+
}
|
|
1369
|
+
})["catch"](function(error) {
|
|
1370
|
+
reject(error);
|
|
1371
|
+
});
|
|
1372
|
+
};
|
|
1373
|
+
readNextChunk();
|
|
1374
|
+
});
|
|
1375
|
+
})["catch"](function(error) {
|
|
1376
|
+
if (error.name === "AbortError") {
|
|
1377
|
+
return void 0;
|
|
1378
|
+
} else {
|
|
1379
|
+
return error;
|
|
1380
|
+
}
|
|
1381
|
+
}).then(function(error) {
|
|
1382
|
+
onFinishCallback(error);
|
|
1383
|
+
});
|
|
1384
|
+
return {
|
|
1385
|
+
abort: function() {
|
|
1386
|
+
if (reader != null) {
|
|
1387
|
+
reader.cancel();
|
|
1388
|
+
}
|
|
1389
|
+
controller.abort();
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
function EventTarget() {
|
|
1394
|
+
this._listeners = /* @__PURE__ */ Object.create(null);
|
|
1395
|
+
}
|
|
1396
|
+
function throwError(e) {
|
|
1397
|
+
setTimeout2(function() {
|
|
1398
|
+
throw e;
|
|
1399
|
+
}, 0);
|
|
1400
|
+
}
|
|
1401
|
+
EventTarget.prototype.dispatchEvent = function(event) {
|
|
1402
|
+
event.target = this;
|
|
1403
|
+
var typeListeners = this._listeners[event.type];
|
|
1404
|
+
if (typeListeners != void 0) {
|
|
1405
|
+
var length = typeListeners.length;
|
|
1406
|
+
for (var i = 0; i < length; i += 1) {
|
|
1407
|
+
var listener = typeListeners[i];
|
|
1408
|
+
try {
|
|
1409
|
+
if (typeof listener.handleEvent === "function") {
|
|
1410
|
+
listener.handleEvent(event);
|
|
1411
|
+
} else {
|
|
1412
|
+
listener.call(this, event);
|
|
1413
|
+
}
|
|
1414
|
+
} catch (e) {
|
|
1415
|
+
throwError(e);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
EventTarget.prototype.addEventListener = function(type, listener) {
|
|
1421
|
+
type = String(type);
|
|
1422
|
+
var listeners = this._listeners;
|
|
1423
|
+
var typeListeners = listeners[type];
|
|
1424
|
+
if (typeListeners == void 0) {
|
|
1425
|
+
typeListeners = [];
|
|
1426
|
+
listeners[type] = typeListeners;
|
|
1427
|
+
}
|
|
1428
|
+
var found = false;
|
|
1429
|
+
for (var i = 0; i < typeListeners.length; i += 1) {
|
|
1430
|
+
if (typeListeners[i] === listener) {
|
|
1431
|
+
found = true;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
if (!found) {
|
|
1435
|
+
typeListeners.push(listener);
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
EventTarget.prototype.removeEventListener = function(type, listener) {
|
|
1439
|
+
type = String(type);
|
|
1440
|
+
var listeners = this._listeners;
|
|
1441
|
+
var typeListeners = listeners[type];
|
|
1442
|
+
if (typeListeners != void 0) {
|
|
1443
|
+
var filtered = [];
|
|
1444
|
+
for (var i = 0; i < typeListeners.length; i += 1) {
|
|
1445
|
+
if (typeListeners[i] !== listener) {
|
|
1446
|
+
filtered.push(typeListeners[i]);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (filtered.length === 0) {
|
|
1450
|
+
delete listeners[type];
|
|
1451
|
+
} else {
|
|
1452
|
+
listeners[type] = filtered;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
function Event(type) {
|
|
1457
|
+
this.type = type;
|
|
1458
|
+
this.target = void 0;
|
|
1459
|
+
}
|
|
1460
|
+
function MessageEvent(type, options) {
|
|
1461
|
+
Event.call(this, type);
|
|
1462
|
+
this.data = options.data;
|
|
1463
|
+
this.lastEventId = options.lastEventId;
|
|
1464
|
+
}
|
|
1465
|
+
MessageEvent.prototype = Object.create(Event.prototype);
|
|
1466
|
+
function ConnectionEvent(type, options) {
|
|
1467
|
+
Event.call(this, type);
|
|
1468
|
+
this.status = options.status;
|
|
1469
|
+
this.statusText = options.statusText;
|
|
1470
|
+
this.headers = options.headers;
|
|
1471
|
+
}
|
|
1472
|
+
ConnectionEvent.prototype = Object.create(Event.prototype);
|
|
1473
|
+
function ErrorEvent(type, options) {
|
|
1474
|
+
Event.call(this, type);
|
|
1475
|
+
this.error = options.error;
|
|
1476
|
+
}
|
|
1477
|
+
ErrorEvent.prototype = Object.create(Event.prototype);
|
|
1478
|
+
var WAITING = -1;
|
|
1479
|
+
var CONNECTING = 0;
|
|
1480
|
+
var OPEN = 1;
|
|
1481
|
+
var CLOSED = 2;
|
|
1482
|
+
var AFTER_CR = -1;
|
|
1483
|
+
var FIELD_START = 0;
|
|
1484
|
+
var FIELD = 1;
|
|
1485
|
+
var VALUE_START = 2;
|
|
1486
|
+
var VALUE = 3;
|
|
1487
|
+
var contentTypeRegExp = /^text\/event\-stream(;.*)?$/i;
|
|
1488
|
+
var MINIMUM_DURATION = 1e3;
|
|
1489
|
+
var MAXIMUM_DURATION = 18e6;
|
|
1490
|
+
var parseDuration = function(value, def) {
|
|
1491
|
+
var n = value == null ? def : parseInt(value, 10);
|
|
1492
|
+
if (n !== n) {
|
|
1493
|
+
n = def;
|
|
1494
|
+
}
|
|
1495
|
+
return clampDuration(n);
|
|
1496
|
+
};
|
|
1497
|
+
var clampDuration = function(n) {
|
|
1498
|
+
return Math.min(Math.max(n, MINIMUM_DURATION), MAXIMUM_DURATION);
|
|
1499
|
+
};
|
|
1500
|
+
var fire = function(that, f, event) {
|
|
1501
|
+
try {
|
|
1502
|
+
if (typeof f === "function") {
|
|
1503
|
+
f.call(that, event);
|
|
1504
|
+
}
|
|
1505
|
+
} catch (e) {
|
|
1506
|
+
throwError(e);
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
function EventSourcePolyfill(url, options) {
|
|
1510
|
+
EventTarget.call(this);
|
|
1511
|
+
options = options || {};
|
|
1512
|
+
this.onopen = void 0;
|
|
1513
|
+
this.onmessage = void 0;
|
|
1514
|
+
this.onerror = void 0;
|
|
1515
|
+
this.url = void 0;
|
|
1516
|
+
this.readyState = void 0;
|
|
1517
|
+
this.withCredentials = void 0;
|
|
1518
|
+
this.headers = void 0;
|
|
1519
|
+
this._close = void 0;
|
|
1520
|
+
start(this, url, options);
|
|
1521
|
+
}
|
|
1522
|
+
function getBestXHRTransport() {
|
|
1523
|
+
return XMLHttpRequest2 != void 0 && "withCredentials" in XMLHttpRequest2.prototype || XDomainRequest2 == void 0 ? new XMLHttpRequest2() : new XDomainRequest2();
|
|
1524
|
+
}
|
|
1525
|
+
var isFetchSupported = fetch2 != void 0 && Response != void 0 && "body" in Response.prototype;
|
|
1526
|
+
function start(es, url, options) {
|
|
1527
|
+
url = String(url);
|
|
1528
|
+
var withCredentials = Boolean(options.withCredentials);
|
|
1529
|
+
var lastEventIdQueryParameterName = options.lastEventIdQueryParameterName || "lastEventId";
|
|
1530
|
+
var initialRetry = clampDuration(1e3);
|
|
1531
|
+
var heartbeatTimeout = parseDuration(options.heartbeatTimeout, 45e3);
|
|
1532
|
+
var lastEventId = "";
|
|
1533
|
+
var retry = initialRetry;
|
|
1534
|
+
var wasActivity = false;
|
|
1535
|
+
var textLength = 0;
|
|
1536
|
+
var headers = options.headers || {};
|
|
1537
|
+
var TransportOption = options.Transport;
|
|
1538
|
+
var xhr = isFetchSupported && TransportOption == void 0 ? void 0 : new XHRWrapper(TransportOption != void 0 ? new TransportOption() : getBestXHRTransport());
|
|
1539
|
+
var transport = TransportOption != null && typeof TransportOption !== "string" ? new TransportOption() : xhr == void 0 ? new FetchTransport() : new XHRTransport();
|
|
1540
|
+
var abortController = void 0;
|
|
1541
|
+
var timeout = 0;
|
|
1542
|
+
var currentState = WAITING;
|
|
1543
|
+
var dataBuffer = "";
|
|
1544
|
+
var lastEventIdBuffer = "";
|
|
1545
|
+
var eventTypeBuffer = "";
|
|
1546
|
+
var textBuffer = "";
|
|
1547
|
+
var state = FIELD_START;
|
|
1548
|
+
var fieldStart = 0;
|
|
1549
|
+
var valueStart = 0;
|
|
1550
|
+
var onStart = function(status, statusText, contentType, headers2) {
|
|
1551
|
+
if (currentState === CONNECTING) {
|
|
1552
|
+
if (status === 200 && contentType != void 0 && contentTypeRegExp.test(contentType)) {
|
|
1553
|
+
currentState = OPEN;
|
|
1554
|
+
wasActivity = Date.now();
|
|
1555
|
+
retry = initialRetry;
|
|
1556
|
+
es.readyState = OPEN;
|
|
1557
|
+
var event = new ConnectionEvent("open", {
|
|
1558
|
+
status,
|
|
1559
|
+
statusText,
|
|
1560
|
+
headers: headers2
|
|
1561
|
+
});
|
|
1562
|
+
es.dispatchEvent(event);
|
|
1563
|
+
fire(es, es.onopen, event);
|
|
1564
|
+
} else {
|
|
1565
|
+
var message = "";
|
|
1566
|
+
if (status !== 200) {
|
|
1567
|
+
if (statusText) {
|
|
1568
|
+
statusText = statusText.replace(/\s+/g, " ");
|
|
1569
|
+
}
|
|
1570
|
+
message = "EventSource's response has a status " + status + " " + statusText + " that is not 200. Aborting the connection.";
|
|
1571
|
+
} else {
|
|
1572
|
+
message = "EventSource's response has a Content-Type specifying an unsupported type: " + (contentType == void 0 ? "-" : contentType.replace(/\s+/g, " ")) + ". Aborting the connection.";
|
|
1573
|
+
}
|
|
1574
|
+
close();
|
|
1575
|
+
var event = new ConnectionEvent("error", {
|
|
1576
|
+
status,
|
|
1577
|
+
statusText,
|
|
1578
|
+
headers: headers2
|
|
1579
|
+
});
|
|
1580
|
+
es.dispatchEvent(event);
|
|
1581
|
+
fire(es, es.onerror, event);
|
|
1582
|
+
console.error(message);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
var onProgress = function(textChunk) {
|
|
1587
|
+
if (currentState === OPEN) {
|
|
1588
|
+
var n = -1;
|
|
1589
|
+
for (var i = 0; i < textChunk.length; i += 1) {
|
|
1590
|
+
var c = textChunk.charCodeAt(i);
|
|
1591
|
+
if (c === "\n".charCodeAt(0) || c === "\r".charCodeAt(0)) {
|
|
1592
|
+
n = i;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
var chunk = (n !== -1 ? textBuffer : "") + textChunk.slice(0, n + 1);
|
|
1596
|
+
textBuffer = (n === -1 ? textBuffer : "") + textChunk.slice(n + 1);
|
|
1597
|
+
if (textChunk !== "") {
|
|
1598
|
+
wasActivity = Date.now();
|
|
1599
|
+
textLength += textChunk.length;
|
|
1600
|
+
}
|
|
1601
|
+
for (var position = 0; position < chunk.length; position += 1) {
|
|
1602
|
+
var c = chunk.charCodeAt(position);
|
|
1603
|
+
if (state === AFTER_CR && c === "\n".charCodeAt(0)) {
|
|
1604
|
+
state = FIELD_START;
|
|
1605
|
+
} else {
|
|
1606
|
+
if (state === AFTER_CR) {
|
|
1607
|
+
state = FIELD_START;
|
|
1608
|
+
}
|
|
1609
|
+
if (c === "\r".charCodeAt(0) || c === "\n".charCodeAt(0)) {
|
|
1610
|
+
if (state !== FIELD_START) {
|
|
1611
|
+
if (state === FIELD) {
|
|
1612
|
+
valueStart = position + 1;
|
|
1613
|
+
}
|
|
1614
|
+
var field = chunk.slice(fieldStart, valueStart - 1);
|
|
1615
|
+
var value = chunk.slice(valueStart + (valueStart < position && chunk.charCodeAt(valueStart) === " ".charCodeAt(0) ? 1 : 0), position);
|
|
1616
|
+
if (field === "data") {
|
|
1617
|
+
dataBuffer += "\n";
|
|
1618
|
+
dataBuffer += value;
|
|
1619
|
+
} else if (field === "id") {
|
|
1620
|
+
lastEventIdBuffer = value;
|
|
1621
|
+
} else if (field === "event") {
|
|
1622
|
+
eventTypeBuffer = value;
|
|
1623
|
+
} else if (field === "retry") {
|
|
1624
|
+
initialRetry = parseDuration(value, initialRetry);
|
|
1625
|
+
retry = initialRetry;
|
|
1626
|
+
} else if (field === "heartbeatTimeout") {
|
|
1627
|
+
heartbeatTimeout = parseDuration(value, heartbeatTimeout);
|
|
1628
|
+
if (timeout !== 0) {
|
|
1629
|
+
clearTimeout2(timeout);
|
|
1630
|
+
timeout = setTimeout2(function() {
|
|
1631
|
+
onTimeout();
|
|
1632
|
+
}, heartbeatTimeout);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
if (state === FIELD_START) {
|
|
1637
|
+
if (dataBuffer !== "") {
|
|
1638
|
+
lastEventId = lastEventIdBuffer;
|
|
1639
|
+
if (eventTypeBuffer === "") {
|
|
1640
|
+
eventTypeBuffer = "message";
|
|
1641
|
+
}
|
|
1642
|
+
var event = new MessageEvent(eventTypeBuffer, {
|
|
1643
|
+
data: dataBuffer.slice(1),
|
|
1644
|
+
lastEventId: lastEventIdBuffer
|
|
1645
|
+
});
|
|
1646
|
+
es.dispatchEvent(event);
|
|
1647
|
+
if (eventTypeBuffer === "open") {
|
|
1648
|
+
fire(es, es.onopen, event);
|
|
1649
|
+
} else if (eventTypeBuffer === "message") {
|
|
1650
|
+
fire(es, es.onmessage, event);
|
|
1651
|
+
} else if (eventTypeBuffer === "error") {
|
|
1652
|
+
fire(es, es.onerror, event);
|
|
1653
|
+
}
|
|
1654
|
+
if (currentState === CLOSED) {
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
dataBuffer = "";
|
|
1659
|
+
eventTypeBuffer = "";
|
|
1660
|
+
}
|
|
1661
|
+
state = c === "\r".charCodeAt(0) ? AFTER_CR : FIELD_START;
|
|
1662
|
+
} else {
|
|
1663
|
+
if (state === FIELD_START) {
|
|
1664
|
+
fieldStart = position;
|
|
1665
|
+
state = FIELD;
|
|
1666
|
+
}
|
|
1667
|
+
if (state === FIELD) {
|
|
1668
|
+
if (c === ":".charCodeAt(0)) {
|
|
1669
|
+
valueStart = position + 1;
|
|
1670
|
+
state = VALUE_START;
|
|
1671
|
+
}
|
|
1672
|
+
} else if (state === VALUE_START) {
|
|
1673
|
+
state = VALUE;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
var onFinish = function(error) {
|
|
1681
|
+
if (currentState === OPEN || currentState === CONNECTING) {
|
|
1682
|
+
currentState = WAITING;
|
|
1683
|
+
if (timeout !== 0) {
|
|
1684
|
+
clearTimeout2(timeout);
|
|
1685
|
+
timeout = 0;
|
|
1686
|
+
}
|
|
1687
|
+
timeout = setTimeout2(function() {
|
|
1688
|
+
onTimeout();
|
|
1689
|
+
}, retry);
|
|
1690
|
+
retry = clampDuration(Math.min(initialRetry * 16, retry * 2));
|
|
1691
|
+
es.readyState = CONNECTING;
|
|
1692
|
+
var event = new ErrorEvent("error", { error });
|
|
1693
|
+
es.dispatchEvent(event);
|
|
1694
|
+
fire(es, es.onerror, event);
|
|
1695
|
+
if (error != void 0) {
|
|
1696
|
+
console.error(error);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
var close = function() {
|
|
1701
|
+
currentState = CLOSED;
|
|
1702
|
+
if (abortController != void 0) {
|
|
1703
|
+
abortController.abort();
|
|
1704
|
+
abortController = void 0;
|
|
1705
|
+
}
|
|
1706
|
+
if (timeout !== 0) {
|
|
1707
|
+
clearTimeout2(timeout);
|
|
1708
|
+
timeout = 0;
|
|
1709
|
+
}
|
|
1710
|
+
es.readyState = CLOSED;
|
|
1711
|
+
};
|
|
1712
|
+
var onTimeout = function() {
|
|
1713
|
+
timeout = 0;
|
|
1714
|
+
if (currentState !== WAITING) {
|
|
1715
|
+
if (!wasActivity && abortController != void 0) {
|
|
1716
|
+
onFinish(new Error("No activity within " + heartbeatTimeout + " milliseconds. " + (currentState === CONNECTING ? "No response received." : textLength + " chars received.") + " Reconnecting."));
|
|
1717
|
+
if (abortController != void 0) {
|
|
1718
|
+
abortController.abort();
|
|
1719
|
+
abortController = void 0;
|
|
1720
|
+
}
|
|
1721
|
+
} else {
|
|
1722
|
+
var nextHeartbeat = Math.max((wasActivity || Date.now()) + heartbeatTimeout - Date.now(), 1);
|
|
1723
|
+
wasActivity = false;
|
|
1724
|
+
timeout = setTimeout2(function() {
|
|
1725
|
+
onTimeout();
|
|
1726
|
+
}, nextHeartbeat);
|
|
1727
|
+
}
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
wasActivity = false;
|
|
1731
|
+
textLength = 0;
|
|
1732
|
+
timeout = setTimeout2(function() {
|
|
1733
|
+
onTimeout();
|
|
1734
|
+
}, heartbeatTimeout);
|
|
1735
|
+
currentState = CONNECTING;
|
|
1736
|
+
dataBuffer = "";
|
|
1737
|
+
eventTypeBuffer = "";
|
|
1738
|
+
lastEventIdBuffer = lastEventId;
|
|
1739
|
+
textBuffer = "";
|
|
1740
|
+
fieldStart = 0;
|
|
1741
|
+
valueStart = 0;
|
|
1742
|
+
state = FIELD_START;
|
|
1743
|
+
var requestURL = url;
|
|
1744
|
+
if (url.slice(0, 5) !== "data:" && url.slice(0, 5) !== "blob:") {
|
|
1745
|
+
if (lastEventId !== "") {
|
|
1746
|
+
var i = url.indexOf("?");
|
|
1747
|
+
requestURL = i === -1 ? url : url.slice(0, i + 1) + url.slice(i + 1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g, function(p, paramName) {
|
|
1748
|
+
return paramName === lastEventIdQueryParameterName ? "" : p;
|
|
1749
|
+
});
|
|
1750
|
+
requestURL += (url.indexOf("?") === -1 ? "?" : "&") + lastEventIdQueryParameterName + "=" + encodeURIComponent(lastEventId);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
var withCredentials2 = es.withCredentials;
|
|
1754
|
+
var requestHeaders = {};
|
|
1755
|
+
requestHeaders["Accept"] = "text/event-stream";
|
|
1756
|
+
var headers2 = es.headers;
|
|
1757
|
+
if (headers2 != void 0) {
|
|
1758
|
+
for (var name in headers2) {
|
|
1759
|
+
if (Object.prototype.hasOwnProperty.call(headers2, name)) {
|
|
1760
|
+
requestHeaders[name] = headers2[name];
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
try {
|
|
1765
|
+
abortController = transport.open(xhr, onStart, onProgress, onFinish, requestURL, withCredentials2, requestHeaders);
|
|
1766
|
+
} catch (error) {
|
|
1767
|
+
close();
|
|
1768
|
+
throw error;
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
es.url = url;
|
|
1772
|
+
es.readyState = CONNECTING;
|
|
1773
|
+
es.withCredentials = withCredentials;
|
|
1774
|
+
es.headers = headers;
|
|
1775
|
+
es._close = close;
|
|
1776
|
+
onTimeout();
|
|
1777
|
+
}
|
|
1778
|
+
EventSourcePolyfill.prototype = Object.create(EventTarget.prototype);
|
|
1779
|
+
EventSourcePolyfill.prototype.CONNECTING = CONNECTING;
|
|
1780
|
+
EventSourcePolyfill.prototype.OPEN = OPEN;
|
|
1781
|
+
EventSourcePolyfill.prototype.CLOSED = CLOSED;
|
|
1782
|
+
EventSourcePolyfill.prototype.close = function() {
|
|
1783
|
+
this._close();
|
|
1784
|
+
};
|
|
1785
|
+
EventSourcePolyfill.CONNECTING = CONNECTING;
|
|
1786
|
+
EventSourcePolyfill.OPEN = OPEN;
|
|
1787
|
+
EventSourcePolyfill.CLOSED = CLOSED;
|
|
1788
|
+
EventSourcePolyfill.prototype.withCredentials = void 0;
|
|
1789
|
+
var R = NativeEventSource;
|
|
1790
|
+
if (XMLHttpRequest2 != void 0 && (NativeEventSource == void 0 || !("withCredentials" in NativeEventSource.prototype))) {
|
|
1791
|
+
R = EventSourcePolyfill;
|
|
1792
|
+
}
|
|
1793
|
+
(function(factory) {
|
|
1794
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
1795
|
+
var v = factory(exports);
|
|
1796
|
+
if (v !== void 0)
|
|
1797
|
+
module.exports = v;
|
|
1798
|
+
} else if (typeof define === "function" && define.amd) {
|
|
1799
|
+
define(["exports"], factory);
|
|
1800
|
+
} else {
|
|
1801
|
+
factory(global2);
|
|
1802
|
+
}
|
|
1803
|
+
})(function(exports2) {
|
|
1804
|
+
exports2.EventSourcePolyfill = EventSourcePolyfill;
|
|
1805
|
+
exports2.NativeEventSource = NativeEventSource;
|
|
1806
|
+
exports2.EventSource = R;
|
|
1807
|
+
});
|
|
1808
|
+
})(typeof globalThis === "undefined" ? typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : exports : globalThis);
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
// node_modules/@sanity/eventsource/browser.js
|
|
1813
|
+
var require_browser = __commonJS({
|
|
1814
|
+
"node_modules/@sanity/eventsource/browser.js"(exports, module) {
|
|
1815
|
+
var evs = require_eventsource();
|
|
1816
|
+
module.exports = evs.EventSourcePolyfill;
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
|
|
1820
|
+
// node_modules/nano-pubsub/index.js
|
|
1821
|
+
var require_nano_pubsub = __commonJS({
|
|
1822
|
+
"node_modules/nano-pubsub/index.js"(exports, module) {
|
|
1823
|
+
module.exports = function Pubsub() {
|
|
1824
|
+
var subscribers = [];
|
|
1825
|
+
return {
|
|
1826
|
+
subscribe,
|
|
1827
|
+
publish
|
|
1828
|
+
};
|
|
1829
|
+
function subscribe(subscriber) {
|
|
1830
|
+
subscribers.push(subscriber);
|
|
1831
|
+
return function unsubscribe() {
|
|
1832
|
+
var idx = subscribers.indexOf(subscriber);
|
|
1833
|
+
if (idx > -1) {
|
|
1834
|
+
subscribers.splice(idx, 1);
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
function publish() {
|
|
1839
|
+
for (var i = 0; i < subscribers.length; i++) {
|
|
1840
|
+
subscribers[i].apply(null, arguments);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
|
|
1847
|
+
// node_modules/get-it/lib/util/middlewareReducer.js
|
|
1848
|
+
var require_middlewareReducer = __commonJS({
|
|
1849
|
+
"node_modules/get-it/lib/util/middlewareReducer.js"(exports, module) {
|
|
1850
|
+
"use strict";
|
|
1851
|
+
module.exports = function(middleware3) {
|
|
1852
|
+
var applyMiddleware = function applyMiddleware2(hook, defaultValue) {
|
|
1853
|
+
var bailEarly = hook === "onError";
|
|
1854
|
+
var value = defaultValue;
|
|
1855
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1856
|
+
args[_key - 2] = arguments[_key];
|
|
1857
|
+
}
|
|
1858
|
+
for (var i = 0; i < middleware3[hook].length; i++) {
|
|
1859
|
+
var handler = middleware3[hook][i];
|
|
1860
|
+
value = handler.apply(void 0, [value].concat(args));
|
|
1861
|
+
if (bailEarly && !value) {
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return value;
|
|
1866
|
+
};
|
|
1867
|
+
return applyMiddleware;
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
|
|
1872
|
+
// node_modules/object-assign/index.js
|
|
1873
|
+
var require_object_assign = __commonJS({
|
|
1874
|
+
"node_modules/object-assign/index.js"(exports, module) {
|
|
1875
|
+
"use strict";
|
|
1876
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
1877
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1878
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1879
|
+
function toObject(val) {
|
|
1880
|
+
if (val === null || val === void 0) {
|
|
1881
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
1882
|
+
}
|
|
1883
|
+
return Object(val);
|
|
1884
|
+
}
|
|
1885
|
+
function shouldUseNative() {
|
|
1886
|
+
try {
|
|
1887
|
+
if (!Object.assign) {
|
|
1888
|
+
return false;
|
|
1889
|
+
}
|
|
1890
|
+
var test1 = new String("abc");
|
|
1891
|
+
test1[5] = "de";
|
|
1892
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
1893
|
+
return false;
|
|
1894
|
+
}
|
|
1895
|
+
var test2 = {};
|
|
1896
|
+
for (var i = 0; i < 10; i++) {
|
|
1897
|
+
test2["_" + String.fromCharCode(i)] = i;
|
|
1898
|
+
}
|
|
1899
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
1900
|
+
return test2[n];
|
|
1901
|
+
});
|
|
1902
|
+
if (order2.join("") !== "0123456789") {
|
|
1903
|
+
return false;
|
|
1904
|
+
}
|
|
1905
|
+
var test3 = {};
|
|
1906
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
1907
|
+
test3[letter] = letter;
|
|
1908
|
+
});
|
|
1909
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
1910
|
+
return false;
|
|
1911
|
+
}
|
|
1912
|
+
return true;
|
|
1913
|
+
} catch (err) {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
module.exports = shouldUseNative() ? Object.assign : function(target, source) {
|
|
1918
|
+
var from;
|
|
1919
|
+
var to = toObject(target);
|
|
1920
|
+
var symbols;
|
|
1921
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
1922
|
+
from = Object(arguments[s]);
|
|
1923
|
+
for (var key in from) {
|
|
1924
|
+
if (hasOwnProperty.call(from, key)) {
|
|
1925
|
+
to[key] = from[key];
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
if (getOwnPropertySymbols) {
|
|
1929
|
+
symbols = getOwnPropertySymbols(from);
|
|
1930
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
1931
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
1932
|
+
to[symbols[i]] = from[symbols[i]];
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return to;
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
|
|
1942
|
+
// node_modules/requires-port/index.js
|
|
1943
|
+
var require_requires_port = __commonJS({
|
|
1944
|
+
"node_modules/requires-port/index.js"(exports, module) {
|
|
1945
|
+
"use strict";
|
|
1946
|
+
module.exports = function required(port, protocol) {
|
|
1947
|
+
protocol = protocol.split(":")[0];
|
|
1948
|
+
port = +port;
|
|
1949
|
+
if (!port)
|
|
1950
|
+
return false;
|
|
1951
|
+
switch (protocol) {
|
|
1952
|
+
case "http":
|
|
1953
|
+
case "ws":
|
|
1954
|
+
return port !== 80;
|
|
1955
|
+
case "https":
|
|
1956
|
+
case "wss":
|
|
1957
|
+
return port !== 443;
|
|
1958
|
+
case "ftp":
|
|
1959
|
+
return port !== 21;
|
|
1960
|
+
case "gopher":
|
|
1961
|
+
return port !== 70;
|
|
1962
|
+
case "file":
|
|
1963
|
+
return false;
|
|
1964
|
+
}
|
|
1965
|
+
return port !== 0;
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
|
|
1970
|
+
// node_modules/querystringify/index.js
|
|
1971
|
+
var require_querystringify = __commonJS({
|
|
1972
|
+
"node_modules/querystringify/index.js"(exports) {
|
|
1973
|
+
"use strict";
|
|
1974
|
+
var has = Object.prototype.hasOwnProperty;
|
|
1975
|
+
var undef;
|
|
1976
|
+
function decode(input) {
|
|
1977
|
+
try {
|
|
1978
|
+
return decodeURIComponent(input.replace(/\+/g, " "));
|
|
1979
|
+
} catch (e) {
|
|
1980
|
+
return null;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
function encode(input) {
|
|
1984
|
+
try {
|
|
1985
|
+
return encodeURIComponent(input);
|
|
1986
|
+
} catch (e) {
|
|
1987
|
+
return null;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
function querystring(query) {
|
|
1991
|
+
var parser = /([^=?#&]+)=?([^&]*)/g, result = {}, part;
|
|
1992
|
+
while (part = parser.exec(query)) {
|
|
1993
|
+
var key = decode(part[1]), value = decode(part[2]);
|
|
1994
|
+
if (key === null || value === null || key in result)
|
|
1995
|
+
continue;
|
|
1996
|
+
result[key] = value;
|
|
1997
|
+
}
|
|
1998
|
+
return result;
|
|
1999
|
+
}
|
|
2000
|
+
function querystringify(obj, prefix) {
|
|
2001
|
+
prefix = prefix || "";
|
|
2002
|
+
var pairs = [], value, key;
|
|
2003
|
+
if (typeof prefix !== "string")
|
|
2004
|
+
prefix = "?";
|
|
2005
|
+
for (key in obj) {
|
|
2006
|
+
if (has.call(obj, key)) {
|
|
2007
|
+
value = obj[key];
|
|
2008
|
+
if (!value && (value === null || value === undef || isNaN(value))) {
|
|
2009
|
+
value = "";
|
|
2010
|
+
}
|
|
2011
|
+
key = encode(key);
|
|
2012
|
+
value = encode(value);
|
|
2013
|
+
if (key === null || value === null)
|
|
2014
|
+
continue;
|
|
2015
|
+
pairs.push(key + "=" + value);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
return pairs.length ? prefix + pairs.join("&") : "";
|
|
2019
|
+
}
|
|
2020
|
+
exports.stringify = querystringify;
|
|
2021
|
+
exports.parse = querystring;
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2024
|
+
|
|
2025
|
+
// node_modules/url-parse/index.js
|
|
2026
|
+
var require_url_parse = __commonJS({
|
|
2027
|
+
"node_modules/url-parse/index.js"(exports, module) {
|
|
2028
|
+
"use strict";
|
|
2029
|
+
var required = require_requires_port();
|
|
2030
|
+
var qs = require_querystringify();
|
|
2031
|
+
var controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;
|
|
2032
|
+
var CRHTLF = /[\n\r\t]/g;
|
|
2033
|
+
var slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//;
|
|
2034
|
+
var port = /:\d+$/;
|
|
2035
|
+
var protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i;
|
|
2036
|
+
var windowsDriveLetter = /^[a-zA-Z]:/;
|
|
2037
|
+
function trimLeft(str) {
|
|
2038
|
+
return (str ? str : "").toString().replace(controlOrWhitespace, "");
|
|
2039
|
+
}
|
|
2040
|
+
var rules = [
|
|
2041
|
+
["#", "hash"],
|
|
2042
|
+
["?", "query"],
|
|
2043
|
+
function sanitize(address, url) {
|
|
2044
|
+
return isSpecial(url.protocol) ? address.replace(/\\/g, "/") : address;
|
|
2045
|
+
},
|
|
2046
|
+
["/", "pathname"],
|
|
2047
|
+
["@", "auth", 1],
|
|
2048
|
+
[NaN, "host", void 0, 1, 1],
|
|
2049
|
+
[/:(\d*)$/, "port", void 0, 1],
|
|
2050
|
+
[NaN, "hostname", void 0, 1, 1]
|
|
2051
|
+
];
|
|
2052
|
+
var ignore = { hash: 1, query: 1 };
|
|
2053
|
+
function lolcation(loc) {
|
|
2054
|
+
var globalVar;
|
|
2055
|
+
if (typeof window !== "undefined")
|
|
2056
|
+
globalVar = window;
|
|
2057
|
+
else if (typeof global !== "undefined")
|
|
2058
|
+
globalVar = global;
|
|
2059
|
+
else if (typeof self !== "undefined")
|
|
2060
|
+
globalVar = self;
|
|
2061
|
+
else
|
|
2062
|
+
globalVar = {};
|
|
2063
|
+
var location = globalVar.location || {};
|
|
2064
|
+
loc = loc || location;
|
|
2065
|
+
var finaldestination = {}, type = typeof loc, key;
|
|
2066
|
+
if (loc.protocol === "blob:") {
|
|
2067
|
+
finaldestination = new Url(unescape(loc.pathname), {});
|
|
2068
|
+
} else if (type === "string") {
|
|
2069
|
+
finaldestination = new Url(loc, {});
|
|
2070
|
+
for (key in ignore)
|
|
2071
|
+
delete finaldestination[key];
|
|
2072
|
+
} else if (type === "object") {
|
|
2073
|
+
for (key in loc) {
|
|
2074
|
+
if (key in ignore)
|
|
2075
|
+
continue;
|
|
2076
|
+
finaldestination[key] = loc[key];
|
|
2077
|
+
}
|
|
2078
|
+
if (finaldestination.slashes === void 0) {
|
|
2079
|
+
finaldestination.slashes = slashes.test(loc.href);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
return finaldestination;
|
|
2083
|
+
}
|
|
2084
|
+
function isSpecial(scheme) {
|
|
2085
|
+
return scheme === "file:" || scheme === "ftp:" || scheme === "http:" || scheme === "https:" || scheme === "ws:" || scheme === "wss:";
|
|
2086
|
+
}
|
|
2087
|
+
function extractProtocol(address, location) {
|
|
2088
|
+
address = trimLeft(address);
|
|
2089
|
+
address = address.replace(CRHTLF, "");
|
|
2090
|
+
location = location || {};
|
|
2091
|
+
var match = protocolre.exec(address);
|
|
2092
|
+
var protocol = match[1] ? match[1].toLowerCase() : "";
|
|
2093
|
+
var forwardSlashes = !!match[2];
|
|
2094
|
+
var otherSlashes = !!match[3];
|
|
2095
|
+
var slashesCount = 0;
|
|
2096
|
+
var rest;
|
|
2097
|
+
if (forwardSlashes) {
|
|
2098
|
+
if (otherSlashes) {
|
|
2099
|
+
rest = match[2] + match[3] + match[4];
|
|
2100
|
+
slashesCount = match[2].length + match[3].length;
|
|
2101
|
+
} else {
|
|
2102
|
+
rest = match[2] + match[4];
|
|
2103
|
+
slashesCount = match[2].length;
|
|
2104
|
+
}
|
|
2105
|
+
} else {
|
|
2106
|
+
if (otherSlashes) {
|
|
2107
|
+
rest = match[3] + match[4];
|
|
2108
|
+
slashesCount = match[3].length;
|
|
2109
|
+
} else {
|
|
2110
|
+
rest = match[4];
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
if (protocol === "file:") {
|
|
2114
|
+
if (slashesCount >= 2) {
|
|
2115
|
+
rest = rest.slice(2);
|
|
2116
|
+
}
|
|
2117
|
+
} else if (isSpecial(protocol)) {
|
|
2118
|
+
rest = match[4];
|
|
2119
|
+
} else if (protocol) {
|
|
2120
|
+
if (forwardSlashes) {
|
|
2121
|
+
rest = rest.slice(2);
|
|
2122
|
+
}
|
|
2123
|
+
} else if (slashesCount >= 2 && isSpecial(location.protocol)) {
|
|
2124
|
+
rest = match[4];
|
|
2125
|
+
}
|
|
2126
|
+
return {
|
|
2127
|
+
protocol,
|
|
2128
|
+
slashes: forwardSlashes || isSpecial(protocol),
|
|
2129
|
+
slashesCount,
|
|
2130
|
+
rest
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
function resolve(relative, base) {
|
|
2134
|
+
if (relative === "")
|
|
2135
|
+
return base;
|
|
2136
|
+
var path = (base || "/").split("/").slice(0, -1).concat(relative.split("/")), i = path.length, last = path[i - 1], unshift = false, up = 0;
|
|
2137
|
+
while (i--) {
|
|
2138
|
+
if (path[i] === ".") {
|
|
2139
|
+
path.splice(i, 1);
|
|
2140
|
+
} else if (path[i] === "..") {
|
|
2141
|
+
path.splice(i, 1);
|
|
2142
|
+
up++;
|
|
2143
|
+
} else if (up) {
|
|
2144
|
+
if (i === 0)
|
|
2145
|
+
unshift = true;
|
|
2146
|
+
path.splice(i, 1);
|
|
2147
|
+
up--;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
if (unshift)
|
|
2151
|
+
path.unshift("");
|
|
2152
|
+
if (last === "." || last === "..")
|
|
2153
|
+
path.push("");
|
|
2154
|
+
return path.join("/");
|
|
2155
|
+
}
|
|
2156
|
+
function Url(address, location, parser) {
|
|
2157
|
+
address = trimLeft(address);
|
|
2158
|
+
address = address.replace(CRHTLF, "");
|
|
2159
|
+
if (!(this instanceof Url)) {
|
|
2160
|
+
return new Url(address, location, parser);
|
|
2161
|
+
}
|
|
2162
|
+
var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0;
|
|
2163
|
+
if (type !== "object" && type !== "string") {
|
|
2164
|
+
parser = location;
|
|
2165
|
+
location = null;
|
|
2166
|
+
}
|
|
2167
|
+
if (parser && typeof parser !== "function")
|
|
2168
|
+
parser = qs.parse;
|
|
2169
|
+
location = lolcation(location);
|
|
2170
|
+
extracted = extractProtocol(address || "", location);
|
|
2171
|
+
relative = !extracted.protocol && !extracted.slashes;
|
|
2172
|
+
url.slashes = extracted.slashes || relative && location.slashes;
|
|
2173
|
+
url.protocol = extracted.protocol || location.protocol || "";
|
|
2174
|
+
address = extracted.rest;
|
|
2175
|
+
if (extracted.protocol === "file:" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {
|
|
2176
|
+
instructions[3] = [/(.*)/, "pathname"];
|
|
2177
|
+
}
|
|
2178
|
+
for (; i < instructions.length; i++) {
|
|
2179
|
+
instruction = instructions[i];
|
|
2180
|
+
if (typeof instruction === "function") {
|
|
2181
|
+
address = instruction(address, url);
|
|
2182
|
+
continue;
|
|
2183
|
+
}
|
|
2184
|
+
parse = instruction[0];
|
|
2185
|
+
key = instruction[1];
|
|
2186
|
+
if (parse !== parse) {
|
|
2187
|
+
url[key] = address;
|
|
2188
|
+
} else if (typeof parse === "string") {
|
|
2189
|
+
index = parse === "@" ? address.lastIndexOf(parse) : address.indexOf(parse);
|
|
2190
|
+
if (~index) {
|
|
2191
|
+
if (typeof instruction[2] === "number") {
|
|
2192
|
+
url[key] = address.slice(0, index);
|
|
2193
|
+
address = address.slice(index + instruction[2]);
|
|
2194
|
+
} else {
|
|
2195
|
+
url[key] = address.slice(index);
|
|
2196
|
+
address = address.slice(0, index);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
} else if (index = parse.exec(address)) {
|
|
2200
|
+
url[key] = index[1];
|
|
2201
|
+
address = address.slice(0, index.index);
|
|
2202
|
+
}
|
|
2203
|
+
url[key] = url[key] || (relative && instruction[3] ? location[key] || "" : "");
|
|
2204
|
+
if (instruction[4])
|
|
2205
|
+
url[key] = url[key].toLowerCase();
|
|
2206
|
+
}
|
|
2207
|
+
if (parser)
|
|
2208
|
+
url.query = parser(url.query);
|
|
2209
|
+
if (relative && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) {
|
|
2210
|
+
url.pathname = resolve(url.pathname, location.pathname);
|
|
2211
|
+
}
|
|
2212
|
+
if (url.pathname.charAt(0) !== "/" && isSpecial(url.protocol)) {
|
|
2213
|
+
url.pathname = "/" + url.pathname;
|
|
2214
|
+
}
|
|
2215
|
+
if (!required(url.port, url.protocol)) {
|
|
2216
|
+
url.host = url.hostname;
|
|
2217
|
+
url.port = "";
|
|
2218
|
+
}
|
|
2219
|
+
url.username = url.password = "";
|
|
2220
|
+
if (url.auth) {
|
|
2221
|
+
index = url.auth.indexOf(":");
|
|
2222
|
+
if (~index) {
|
|
2223
|
+
url.username = url.auth.slice(0, index);
|
|
2224
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
2225
|
+
url.password = url.auth.slice(index + 1);
|
|
2226
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
2227
|
+
} else {
|
|
2228
|
+
url.username = encodeURIComponent(decodeURIComponent(url.auth));
|
|
2229
|
+
}
|
|
2230
|
+
url.auth = url.password ? url.username + ":" + url.password : url.username;
|
|
2231
|
+
}
|
|
2232
|
+
url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
|
|
2233
|
+
url.href = url.toString();
|
|
2234
|
+
}
|
|
2235
|
+
function set(part, value, fn) {
|
|
2236
|
+
var url = this;
|
|
2237
|
+
switch (part) {
|
|
2238
|
+
case "query":
|
|
2239
|
+
if (typeof value === "string" && value.length) {
|
|
2240
|
+
value = (fn || qs.parse)(value);
|
|
2241
|
+
}
|
|
2242
|
+
url[part] = value;
|
|
2243
|
+
break;
|
|
2244
|
+
case "port":
|
|
2245
|
+
url[part] = value;
|
|
2246
|
+
if (!required(value, url.protocol)) {
|
|
2247
|
+
url.host = url.hostname;
|
|
2248
|
+
url[part] = "";
|
|
2249
|
+
} else if (value) {
|
|
2250
|
+
url.host = url.hostname + ":" + value;
|
|
2251
|
+
}
|
|
2252
|
+
break;
|
|
2253
|
+
case "hostname":
|
|
2254
|
+
url[part] = value;
|
|
2255
|
+
if (url.port)
|
|
2256
|
+
value += ":" + url.port;
|
|
2257
|
+
url.host = value;
|
|
2258
|
+
break;
|
|
2259
|
+
case "host":
|
|
2260
|
+
url[part] = value;
|
|
2261
|
+
if (port.test(value)) {
|
|
2262
|
+
value = value.split(":");
|
|
2263
|
+
url.port = value.pop();
|
|
2264
|
+
url.hostname = value.join(":");
|
|
2265
|
+
} else {
|
|
2266
|
+
url.hostname = value;
|
|
2267
|
+
url.port = "";
|
|
2268
|
+
}
|
|
2269
|
+
break;
|
|
2270
|
+
case "protocol":
|
|
2271
|
+
url.protocol = value.toLowerCase();
|
|
2272
|
+
url.slashes = !fn;
|
|
2273
|
+
break;
|
|
2274
|
+
case "pathname":
|
|
2275
|
+
case "hash":
|
|
2276
|
+
if (value) {
|
|
2277
|
+
var char = part === "pathname" ? "/" : "#";
|
|
2278
|
+
url[part] = value.charAt(0) !== char ? char + value : value;
|
|
2279
|
+
} else {
|
|
2280
|
+
url[part] = value;
|
|
2281
|
+
}
|
|
2282
|
+
break;
|
|
2283
|
+
case "username":
|
|
2284
|
+
case "password":
|
|
2285
|
+
url[part] = encodeURIComponent(value);
|
|
2286
|
+
break;
|
|
2287
|
+
case "auth":
|
|
2288
|
+
var index = value.indexOf(":");
|
|
2289
|
+
if (~index) {
|
|
2290
|
+
url.username = value.slice(0, index);
|
|
2291
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
2292
|
+
url.password = value.slice(index + 1);
|
|
2293
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
2294
|
+
} else {
|
|
2295
|
+
url.username = encodeURIComponent(decodeURIComponent(value));
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
for (var i = 0; i < rules.length; i++) {
|
|
2299
|
+
var ins = rules[i];
|
|
2300
|
+
if (ins[4])
|
|
2301
|
+
url[ins[1]] = url[ins[1]].toLowerCase();
|
|
2302
|
+
}
|
|
2303
|
+
url.auth = url.password ? url.username + ":" + url.password : url.username;
|
|
2304
|
+
url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
|
|
2305
|
+
url.href = url.toString();
|
|
2306
|
+
return url;
|
|
2307
|
+
}
|
|
2308
|
+
function toString(stringify) {
|
|
2309
|
+
if (!stringify || typeof stringify !== "function")
|
|
2310
|
+
stringify = qs.stringify;
|
|
2311
|
+
var query, url = this, host = url.host, protocol = url.protocol;
|
|
2312
|
+
if (protocol && protocol.charAt(protocol.length - 1) !== ":")
|
|
2313
|
+
protocol += ":";
|
|
2314
|
+
var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? "//" : "");
|
|
2315
|
+
if (url.username) {
|
|
2316
|
+
result += url.username;
|
|
2317
|
+
if (url.password)
|
|
2318
|
+
result += ":" + url.password;
|
|
2319
|
+
result += "@";
|
|
2320
|
+
} else if (url.password) {
|
|
2321
|
+
result += ":" + url.password;
|
|
2322
|
+
result += "@";
|
|
2323
|
+
} else if (url.protocol !== "file:" && isSpecial(url.protocol) && !host && url.pathname !== "/") {
|
|
2324
|
+
result += "@";
|
|
2325
|
+
}
|
|
2326
|
+
if (host[host.length - 1] === ":" || port.test(url.hostname) && !url.port) {
|
|
2327
|
+
host += ":";
|
|
2328
|
+
}
|
|
2329
|
+
result += host + url.pathname;
|
|
2330
|
+
query = typeof url.query === "object" ? stringify(url.query) : url.query;
|
|
2331
|
+
if (query)
|
|
2332
|
+
result += query.charAt(0) !== "?" ? "?" + query : query;
|
|
2333
|
+
if (url.hash)
|
|
2334
|
+
result += url.hash;
|
|
2335
|
+
return result;
|
|
2336
|
+
}
|
|
2337
|
+
Url.prototype = { set, toString };
|
|
2338
|
+
Url.extractProtocol = extractProtocol;
|
|
2339
|
+
Url.location = lolcation;
|
|
2340
|
+
Url.trimLeft = trimLeft;
|
|
2341
|
+
Url.qs = qs;
|
|
2342
|
+
module.exports = Url;
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
|
|
2346
|
+
// node_modules/get-it/lib/middleware/defaultOptionsProcessor.js
|
|
2347
|
+
var require_defaultOptionsProcessor = __commonJS({
|
|
2348
|
+
"node_modules/get-it/lib/middleware/defaultOptionsProcessor.js"(exports, module) {
|
|
2349
|
+
"use strict";
|
|
2350
|
+
var objectAssign = require_object_assign();
|
|
2351
|
+
var urlParse = require_url_parse();
|
|
2352
|
+
var isReactNative = typeof navigator === "undefined" ? false : navigator.product === "ReactNative";
|
|
2353
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2354
|
+
var defaultOptions2 = {
|
|
2355
|
+
timeout: isReactNative ? 6e4 : 12e4
|
|
2356
|
+
};
|
|
2357
|
+
module.exports = function(opts) {
|
|
2358
|
+
var options = typeof opts === "string" ? objectAssign({
|
|
2359
|
+
url: opts
|
|
2360
|
+
}, defaultOptions2) : objectAssign({}, defaultOptions2, opts);
|
|
2361
|
+
var url = urlParse(options.url, {}, true);
|
|
2362
|
+
options.timeout = normalizeTimeout(options.timeout);
|
|
2363
|
+
if (options.query) {
|
|
2364
|
+
url.query = objectAssign({}, url.query, removeUndefined(options.query));
|
|
2365
|
+
}
|
|
2366
|
+
options.method = options.body && !options.method ? "POST" : (options.method || "GET").toUpperCase();
|
|
2367
|
+
options.url = url.toString(stringifyQueryString);
|
|
2368
|
+
return options;
|
|
2369
|
+
};
|
|
2370
|
+
function stringifyQueryString(obj) {
|
|
2371
|
+
var pairs = [];
|
|
2372
|
+
for (var key in obj) {
|
|
2373
|
+
if (has.call(obj, key)) {
|
|
2374
|
+
push(key, obj[key]);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
return pairs.length ? pairs.join("&") : "";
|
|
2378
|
+
function push(key2, val) {
|
|
2379
|
+
if (Array.isArray(val)) {
|
|
2380
|
+
val.forEach(function(item) {
|
|
2381
|
+
return push(key2, item);
|
|
2382
|
+
});
|
|
2383
|
+
} else {
|
|
2384
|
+
pairs.push([key2, val].map(encodeURIComponent).join("="));
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
function normalizeTimeout(time) {
|
|
2389
|
+
if (time === false || time === 0) {
|
|
2390
|
+
return false;
|
|
2391
|
+
}
|
|
2392
|
+
if (time.connect || time.socket) {
|
|
2393
|
+
return time;
|
|
2394
|
+
}
|
|
2395
|
+
var delay = Number(time);
|
|
2396
|
+
if (isNaN(delay)) {
|
|
2397
|
+
return normalizeTimeout(defaultOptions2.timeout);
|
|
2398
|
+
}
|
|
2399
|
+
return {
|
|
2400
|
+
connect: delay,
|
|
2401
|
+
socket: delay
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
function removeUndefined(obj) {
|
|
2405
|
+
var target = {};
|
|
2406
|
+
for (var key in obj) {
|
|
2407
|
+
if (obj[key] !== void 0) {
|
|
2408
|
+
target[key] = obj[key];
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
return target;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
});
|
|
2415
|
+
|
|
2416
|
+
// node_modules/get-it/lib/middleware/defaultOptionsValidator.js
|
|
2417
|
+
var require_defaultOptionsValidator = __commonJS({
|
|
2418
|
+
"node_modules/get-it/lib/middleware/defaultOptionsValidator.js"(exports, module) {
|
|
2419
|
+
"use strict";
|
|
2420
|
+
var validUrl = /^https?:\/\//i;
|
|
2421
|
+
module.exports = function(options) {
|
|
2422
|
+
if (!validUrl.test(options.url)) {
|
|
2423
|
+
throw new Error('"'.concat(options.url, '" is not a valid URL'));
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
|
|
2429
|
+
// node_modules/same-origin/url-parser.js
|
|
2430
|
+
var require_url_parser = __commonJS({
|
|
2431
|
+
"node_modules/same-origin/url-parser.js"(exports, module) {
|
|
2432
|
+
"use strict";
|
|
2433
|
+
var regex = /^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;
|
|
2434
|
+
module.exports = {
|
|
2435
|
+
regex,
|
|
2436
|
+
parse: function(url) {
|
|
2437
|
+
var match = regex.exec(url);
|
|
2438
|
+
if (!match) {
|
|
2439
|
+
return {};
|
|
2440
|
+
}
|
|
2441
|
+
return {
|
|
2442
|
+
protocol: (match[1] || "").toLowerCase() || void 0,
|
|
2443
|
+
hostname: (match[5] || "").toLowerCase() || void 0,
|
|
2444
|
+
port: match[6] || void 0
|
|
2445
|
+
};
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
});
|
|
2450
|
+
|
|
2451
|
+
// node_modules/same-origin/index.js
|
|
2452
|
+
var require_same_origin = __commonJS({
|
|
2453
|
+
"node_modules/same-origin/index.js"(exports, module) {
|
|
2454
|
+
"use strict";
|
|
2455
|
+
var url = require_url_parser();
|
|
2456
|
+
module.exports = function(uri1, uri2, ieMode) {
|
|
2457
|
+
if (uri1 === uri2) {
|
|
2458
|
+
return true;
|
|
2459
|
+
}
|
|
2460
|
+
var url1 = url.parse(uri1, false, true);
|
|
2461
|
+
var url2 = url.parse(uri2, false, true);
|
|
2462
|
+
var url1Port = url1.port | 0 || (url1.protocol === "https" ? 443 : 80);
|
|
2463
|
+
var url2Port = url2.port | 0 || (url2.protocol === "https" ? 443 : 80);
|
|
2464
|
+
var match = {
|
|
2465
|
+
proto: url1.protocol === url2.protocol,
|
|
2466
|
+
hostname: url1.hostname === url2.hostname,
|
|
2467
|
+
port: url1Port === url2Port
|
|
2468
|
+
};
|
|
2469
|
+
return match.proto && match.hostname && (match.port || ieMode);
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
});
|
|
2473
|
+
|
|
2474
|
+
// node_modules/parse-headers/parse-headers.js
|
|
2475
|
+
var require_parse_headers = __commonJS({
|
|
2476
|
+
"node_modules/parse-headers/parse-headers.js"(exports, module) {
|
|
2477
|
+
var trim = function(string) {
|
|
2478
|
+
return string.replace(/^\s+|\s+$/g, "");
|
|
2479
|
+
};
|
|
2480
|
+
var isArray = function(arg) {
|
|
2481
|
+
return Object.prototype.toString.call(arg) === "[object Array]";
|
|
2482
|
+
};
|
|
2483
|
+
module.exports = function(headers) {
|
|
2484
|
+
if (!headers)
|
|
2485
|
+
return {};
|
|
2486
|
+
var result = {};
|
|
2487
|
+
var headersArr = trim(headers).split("\n");
|
|
2488
|
+
for (var i = 0; i < headersArr.length; i++) {
|
|
2489
|
+
var row = headersArr[i];
|
|
2490
|
+
var index = row.indexOf(":"), key = trim(row.slice(0, index)).toLowerCase(), value = trim(row.slice(index + 1));
|
|
2491
|
+
if (typeof result[key] === "undefined") {
|
|
2492
|
+
result[key] = value;
|
|
2493
|
+
} else if (isArray(result[key])) {
|
|
2494
|
+
result[key].push(value);
|
|
2495
|
+
} else {
|
|
2496
|
+
result[key] = [result[key], value];
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
return result;
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
|
|
2504
|
+
// node_modules/get-it/lib/request/browser/fetchXhr.js
|
|
2505
|
+
var require_fetchXhr = __commonJS({
|
|
2506
|
+
"node_modules/get-it/lib/request/browser/fetchXhr.js"(exports, module) {
|
|
2507
|
+
"use strict";
|
|
2508
|
+
function FetchXhr() {
|
|
2509
|
+
this.readyState = 0;
|
|
2510
|
+
}
|
|
2511
|
+
FetchXhr.prototype.open = function(method, url) {
|
|
2512
|
+
this._method = method;
|
|
2513
|
+
this._url = url;
|
|
2514
|
+
this._resHeaders = "";
|
|
2515
|
+
this.readyState = 1;
|
|
2516
|
+
this.onreadystatechange();
|
|
2517
|
+
};
|
|
2518
|
+
FetchXhr.prototype.abort = function() {
|
|
2519
|
+
if (this._controller) {
|
|
2520
|
+
this._controller.abort();
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
FetchXhr.prototype.getAllResponseHeaders = function() {
|
|
2524
|
+
return this._resHeaders;
|
|
2525
|
+
};
|
|
2526
|
+
FetchXhr.prototype.setRequestHeader = function(key, value) {
|
|
2527
|
+
this._headers = this._headers || {};
|
|
2528
|
+
this._headers[key] = value;
|
|
2529
|
+
};
|
|
2530
|
+
FetchXhr.prototype.send = function(body) {
|
|
2531
|
+
var _this = this;
|
|
2532
|
+
var ctrl = this._controller = typeof AbortController === "function" && new AbortController();
|
|
2533
|
+
var textBody = this.responseType !== "arraybuffer";
|
|
2534
|
+
var options = {
|
|
2535
|
+
method: this._method,
|
|
2536
|
+
headers: this._headers,
|
|
2537
|
+
signal: ctrl && ctrl.signal,
|
|
2538
|
+
body
|
|
2539
|
+
};
|
|
2540
|
+
if (typeof window !== "undefined") {
|
|
2541
|
+
options.credentials = this.withCredentials ? "include" : "omit";
|
|
2542
|
+
}
|
|
2543
|
+
fetch(this._url, options).then(function(res) {
|
|
2544
|
+
res.headers.forEach(function(value, key) {
|
|
2545
|
+
_this._resHeaders += "".concat(key, ": ").concat(value, "\r\n");
|
|
2546
|
+
});
|
|
2547
|
+
_this.status = res.status;
|
|
2548
|
+
_this.statusText = res.statusText;
|
|
2549
|
+
_this.readyState = 3;
|
|
2550
|
+
return textBody ? res.text() : res.arrayBuffer();
|
|
2551
|
+
}).then(function(resBody) {
|
|
2552
|
+
if (textBody) {
|
|
2553
|
+
_this.responseText = resBody;
|
|
2554
|
+
} else {
|
|
2555
|
+
_this.response = resBody;
|
|
2556
|
+
}
|
|
2557
|
+
_this.readyState = 4;
|
|
2558
|
+
_this.onreadystatechange();
|
|
2559
|
+
}).catch(function(err) {
|
|
2560
|
+
if (err.name === "AbortError") {
|
|
2561
|
+
_this.onabort();
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
_this.onerror(err);
|
|
2565
|
+
});
|
|
2566
|
+
};
|
|
2567
|
+
module.exports = FetchXhr;
|
|
2568
|
+
}
|
|
2569
|
+
});
|
|
2570
|
+
|
|
2571
|
+
// node_modules/get-it/lib/request/browser-request.js
|
|
2572
|
+
var require_browser_request = __commonJS({
|
|
2573
|
+
"node_modules/get-it/lib/request/browser-request.js"(exports, module) {
|
|
2574
|
+
"use strict";
|
|
2575
|
+
var sameOrigin = require_same_origin();
|
|
2576
|
+
var parseHeaders = require_parse_headers();
|
|
2577
|
+
var FetchXhr = require_fetchXhr();
|
|
2578
|
+
var noop = function noop2() {
|
|
2579
|
+
};
|
|
2580
|
+
var win = typeof window === "undefined" ? void 0 : window;
|
|
2581
|
+
var adapter = win ? "xhr" : "fetch";
|
|
2582
|
+
var XmlHttpRequest = typeof XMLHttpRequest === "function" ? XMLHttpRequest : noop;
|
|
2583
|
+
var hasXhr2 = "withCredentials" in new XmlHttpRequest();
|
|
2584
|
+
var XDR = typeof XDomainRequest === "undefined" ? void 0 : XDomainRequest;
|
|
2585
|
+
var CrossDomainRequest = hasXhr2 ? XmlHttpRequest : XDR;
|
|
2586
|
+
if (!win) {
|
|
2587
|
+
XmlHttpRequest = FetchXhr;
|
|
2588
|
+
CrossDomainRequest = FetchXhr;
|
|
2589
|
+
}
|
|
2590
|
+
module.exports = function(context, callback) {
|
|
2591
|
+
var opts = context.options;
|
|
2592
|
+
var options = context.applyMiddleware("finalizeOptions", opts);
|
|
2593
|
+
var timers = {};
|
|
2594
|
+
var cors = win && win.location && !sameOrigin(win.location.href, options.url);
|
|
2595
|
+
var injectedResponse = context.applyMiddleware("interceptRequest", void 0, {
|
|
2596
|
+
adapter,
|
|
2597
|
+
context
|
|
2598
|
+
});
|
|
2599
|
+
if (injectedResponse) {
|
|
2600
|
+
var cbTimer = setTimeout(callback, 0, null, injectedResponse);
|
|
2601
|
+
var cancel = function cancel2() {
|
|
2602
|
+
return clearTimeout(cbTimer);
|
|
2603
|
+
};
|
|
2604
|
+
return {
|
|
2605
|
+
abort: cancel
|
|
2606
|
+
};
|
|
2607
|
+
}
|
|
2608
|
+
var xhr = cors ? new CrossDomainRequest() : new XmlHttpRequest();
|
|
2609
|
+
var isXdr = win && win.XDomainRequest && xhr instanceof win.XDomainRequest;
|
|
2610
|
+
var headers = options.headers;
|
|
2611
|
+
var delays = options.timeout;
|
|
2612
|
+
var aborted = false;
|
|
2613
|
+
var loaded = false;
|
|
2614
|
+
var timedOut = false;
|
|
2615
|
+
xhr.onerror = onError;
|
|
2616
|
+
xhr.ontimeout = onError;
|
|
2617
|
+
xhr.onabort = function() {
|
|
2618
|
+
stopTimers(true);
|
|
2619
|
+
aborted = true;
|
|
2620
|
+
};
|
|
2621
|
+
xhr.onprogress = function() {
|
|
2622
|
+
};
|
|
2623
|
+
var loadEvent = isXdr ? "onload" : "onreadystatechange";
|
|
2624
|
+
xhr[loadEvent] = function() {
|
|
2625
|
+
resetTimers();
|
|
2626
|
+
if (aborted || xhr.readyState !== 4 && !isXdr) {
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
if (xhr.status === 0) {
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
2632
|
+
onLoad();
|
|
2633
|
+
};
|
|
2634
|
+
xhr.open(options.method, options.url, true);
|
|
2635
|
+
xhr.withCredentials = !!options.withCredentials;
|
|
2636
|
+
if (headers && xhr.setRequestHeader) {
|
|
2637
|
+
for (var key in headers) {
|
|
2638
|
+
if (headers.hasOwnProperty(key)) {
|
|
2639
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
} else if (headers && isXdr) {
|
|
2643
|
+
throw new Error("Headers cannot be set on an XDomainRequest object");
|
|
2644
|
+
}
|
|
2645
|
+
if (options.rawBody) {
|
|
2646
|
+
xhr.responseType = "arraybuffer";
|
|
2647
|
+
}
|
|
2648
|
+
context.applyMiddleware("onRequest", {
|
|
2649
|
+
options,
|
|
2650
|
+
adapter,
|
|
2651
|
+
request: xhr,
|
|
2652
|
+
context
|
|
2653
|
+
});
|
|
2654
|
+
xhr.send(options.body || null);
|
|
2655
|
+
if (delays) {
|
|
2656
|
+
timers.connect = setTimeout(function() {
|
|
2657
|
+
return timeoutRequest("ETIMEDOUT");
|
|
2658
|
+
}, delays.connect);
|
|
2659
|
+
}
|
|
2660
|
+
return {
|
|
2661
|
+
abort
|
|
2662
|
+
};
|
|
2663
|
+
function abort() {
|
|
2664
|
+
aborted = true;
|
|
2665
|
+
if (xhr) {
|
|
2666
|
+
xhr.abort();
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
function timeoutRequest(code) {
|
|
2670
|
+
timedOut = true;
|
|
2671
|
+
xhr.abort();
|
|
2672
|
+
var error = new Error(code === "ESOCKETTIMEDOUT" ? "Socket timed out on request to ".concat(options.url) : "Connection timed out on request to ".concat(options.url));
|
|
2673
|
+
error.code = code;
|
|
2674
|
+
context.channels.error.publish(error);
|
|
2675
|
+
}
|
|
2676
|
+
function resetTimers() {
|
|
2677
|
+
if (!delays) {
|
|
2678
|
+
return;
|
|
2679
|
+
}
|
|
2680
|
+
stopTimers();
|
|
2681
|
+
timers.socket = setTimeout(function() {
|
|
2682
|
+
return timeoutRequest("ESOCKETTIMEDOUT");
|
|
2683
|
+
}, delays.socket);
|
|
2684
|
+
}
|
|
2685
|
+
function stopTimers(force) {
|
|
2686
|
+
if (force || aborted || xhr.readyState >= 2 && timers.connect) {
|
|
2687
|
+
clearTimeout(timers.connect);
|
|
2688
|
+
}
|
|
2689
|
+
if (timers.socket) {
|
|
2690
|
+
clearTimeout(timers.socket);
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
function onError(error) {
|
|
2694
|
+
if (loaded) {
|
|
2695
|
+
return;
|
|
2696
|
+
}
|
|
2697
|
+
stopTimers(true);
|
|
2698
|
+
loaded = true;
|
|
2699
|
+
xhr = null;
|
|
2700
|
+
var err = error || new Error("Network error while attempting to reach ".concat(options.url));
|
|
2701
|
+
err.isNetworkError = true;
|
|
2702
|
+
err.request = options;
|
|
2703
|
+
callback(err);
|
|
2704
|
+
}
|
|
2705
|
+
function reduceResponse() {
|
|
2706
|
+
var statusCode = xhr.status;
|
|
2707
|
+
var statusMessage = xhr.statusText;
|
|
2708
|
+
if (isXdr && statusCode === void 0) {
|
|
2709
|
+
statusCode = 200;
|
|
2710
|
+
} else if (statusCode > 12e3 && statusCode < 12156) {
|
|
2711
|
+
return onError();
|
|
2712
|
+
} else {
|
|
2713
|
+
statusCode = xhr.status === 1223 ? 204 : xhr.status;
|
|
2714
|
+
statusMessage = xhr.status === 1223 ? "No Content" : statusMessage;
|
|
2715
|
+
}
|
|
2716
|
+
return {
|
|
2717
|
+
body: xhr.response || xhr.responseText,
|
|
2718
|
+
url: options.url,
|
|
2719
|
+
method: options.method,
|
|
2720
|
+
headers: isXdr ? {} : parseHeaders(xhr.getAllResponseHeaders()),
|
|
2721
|
+
statusCode,
|
|
2722
|
+
statusMessage
|
|
2723
|
+
};
|
|
2724
|
+
}
|
|
2725
|
+
function onLoad() {
|
|
2726
|
+
if (aborted || loaded || timedOut) {
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
if (xhr.status === 0) {
|
|
2730
|
+
onError(new Error("Unknown XHR error"));
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
stopTimers();
|
|
2734
|
+
loaded = true;
|
|
2735
|
+
callback(null, reduceResponse());
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
|
|
2741
|
+
// node_modules/get-it/lib/request/index.js
|
|
2742
|
+
var require_request = __commonJS({
|
|
2743
|
+
"node_modules/get-it/lib/request/index.js"(exports, module) {
|
|
2744
|
+
"use strict";
|
|
2745
|
+
module.exports = require_browser_request();
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2748
|
+
|
|
2749
|
+
// node_modules/get-it/lib/index.js
|
|
2750
|
+
var require_lib = __commonJS({
|
|
2751
|
+
"node_modules/get-it/lib/index.js"(exports, module) {
|
|
2752
|
+
"use strict";
|
|
2753
|
+
var pubsub = require_nano_pubsub();
|
|
2754
|
+
var middlewareReducer = require_middlewareReducer();
|
|
2755
|
+
var processOptions = require_defaultOptionsProcessor();
|
|
2756
|
+
var validateOptions = require_defaultOptionsValidator();
|
|
2757
|
+
var httpRequester = require_request();
|
|
2758
|
+
var channelNames = ["request", "response", "progress", "error", "abort"];
|
|
2759
|
+
var middlehooks = ["processOptions", "validateOptions", "interceptRequest", "finalizeOptions", "onRequest", "onResponse", "onError", "onReturn", "onHeaders"];
|
|
2760
|
+
module.exports = function createRequester() {
|
|
2761
|
+
var initMiddleware = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
2762
|
+
var httpRequest2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : httpRequester;
|
|
2763
|
+
var loadedMiddleware = [];
|
|
2764
|
+
var middleware3 = middlehooks.reduce(function(ware, name) {
|
|
2765
|
+
ware[name] = ware[name] || [];
|
|
2766
|
+
return ware;
|
|
2767
|
+
}, {
|
|
2768
|
+
processOptions: [processOptions],
|
|
2769
|
+
validateOptions: [validateOptions]
|
|
2770
|
+
});
|
|
2771
|
+
function request2(opts) {
|
|
2772
|
+
var channels = channelNames.reduce(function(target, name) {
|
|
2773
|
+
target[name] = pubsub();
|
|
2774
|
+
return target;
|
|
2775
|
+
}, {});
|
|
2776
|
+
var applyMiddleware = middlewareReducer(middleware3);
|
|
2777
|
+
var options = applyMiddleware("processOptions", opts);
|
|
2778
|
+
applyMiddleware("validateOptions", options);
|
|
2779
|
+
var context = {
|
|
2780
|
+
options,
|
|
2781
|
+
channels,
|
|
2782
|
+
applyMiddleware
|
|
2783
|
+
};
|
|
2784
|
+
var ongoingRequest = null;
|
|
2785
|
+
var unsubscribe = channels.request.subscribe(function(ctx) {
|
|
2786
|
+
ongoingRequest = httpRequest2(ctx, function(err, res) {
|
|
2787
|
+
return onResponse(err, res, ctx);
|
|
2788
|
+
});
|
|
2789
|
+
});
|
|
2790
|
+
channels.abort.subscribe(function() {
|
|
2791
|
+
unsubscribe();
|
|
2792
|
+
if (ongoingRequest) {
|
|
2793
|
+
ongoingRequest.abort();
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
var returnValue = applyMiddleware("onReturn", channels, context);
|
|
2797
|
+
if (returnValue === channels) {
|
|
2798
|
+
channels.request.publish(context);
|
|
2799
|
+
}
|
|
2800
|
+
return returnValue;
|
|
2801
|
+
function onResponse(reqErr, res, ctx) {
|
|
2802
|
+
var error = reqErr;
|
|
2803
|
+
var response = res;
|
|
2804
|
+
if (!error) {
|
|
2805
|
+
try {
|
|
2806
|
+
response = applyMiddleware("onResponse", res, ctx);
|
|
2807
|
+
} catch (err) {
|
|
2808
|
+
response = null;
|
|
2809
|
+
error = err;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
error = error && applyMiddleware("onError", error, ctx);
|
|
2813
|
+
if (error) {
|
|
2814
|
+
channels.error.publish(error);
|
|
2815
|
+
} else if (response) {
|
|
2816
|
+
channels.response.publish(response);
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
request2.use = function use(newMiddleware) {
|
|
2821
|
+
if (!newMiddleware) {
|
|
2822
|
+
throw new Error("Tried to add middleware that resolved to falsey value");
|
|
2823
|
+
}
|
|
2824
|
+
if (typeof newMiddleware === "function") {
|
|
2825
|
+
throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");
|
|
2826
|
+
}
|
|
2827
|
+
if (newMiddleware.onReturn && middleware3.onReturn.length > 0) {
|
|
2828
|
+
throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");
|
|
2829
|
+
}
|
|
2830
|
+
middlehooks.forEach(function(key) {
|
|
2831
|
+
if (newMiddleware[key]) {
|
|
2832
|
+
middleware3[key].push(newMiddleware[key]);
|
|
2833
|
+
}
|
|
2834
|
+
});
|
|
2835
|
+
loadedMiddleware.push(newMiddleware);
|
|
2836
|
+
return request2;
|
|
2837
|
+
};
|
|
2838
|
+
request2.clone = function clone() {
|
|
2839
|
+
return createRequester(loadedMiddleware);
|
|
2840
|
+
};
|
|
2841
|
+
initMiddleware.forEach(request2.use);
|
|
2842
|
+
return request2;
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
|
|
2847
|
+
// node_modules/get-it/index.js
|
|
2848
|
+
var require_get_it = __commonJS({
|
|
2849
|
+
"node_modules/get-it/index.js"(exports, module) {
|
|
2850
|
+
module.exports = require_lib();
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
|
|
2854
|
+
// node_modules/get-it/lib/util/global.js
|
|
2855
|
+
var require_global = __commonJS({
|
|
2856
|
+
"node_modules/get-it/lib/util/global.js"(exports, module) {
|
|
2857
|
+
"use strict";
|
|
2858
|
+
if (typeof globalThis !== "undefined") {
|
|
2859
|
+
module.exports = globalThis;
|
|
2860
|
+
} else if (typeof window !== "undefined") {
|
|
2861
|
+
module.exports = window;
|
|
2862
|
+
} else if (typeof global !== "undefined") {
|
|
2863
|
+
module.exports = global;
|
|
2864
|
+
} else if (typeof self !== "undefined") {
|
|
2865
|
+
module.exports = self;
|
|
2866
|
+
} else {
|
|
2867
|
+
module.exports = {};
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
});
|
|
2871
|
+
|
|
2872
|
+
// node_modules/get-it/lib/middleware/observable.js
|
|
2873
|
+
var require_observable2 = __commonJS({
|
|
2874
|
+
"node_modules/get-it/lib/middleware/observable.js"(exports, module) {
|
|
2875
|
+
"use strict";
|
|
2876
|
+
var global2 = require_global();
|
|
2877
|
+
var objectAssign = require_object_assign();
|
|
2878
|
+
module.exports = function() {
|
|
2879
|
+
var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2880
|
+
var Observable2 = opts.implementation || global2.Observable;
|
|
2881
|
+
if (!Observable2) {
|
|
2882
|
+
throw new Error("`Observable` is not available in global scope, and no implementation was passed");
|
|
2883
|
+
}
|
|
2884
|
+
return {
|
|
2885
|
+
onReturn: function onReturn(channels, context) {
|
|
2886
|
+
return new Observable2(function(observer) {
|
|
2887
|
+
channels.error.subscribe(function(err) {
|
|
2888
|
+
return observer.error(err);
|
|
2889
|
+
});
|
|
2890
|
+
channels.progress.subscribe(function(event) {
|
|
2891
|
+
return observer.next(objectAssign({
|
|
2892
|
+
type: "progress"
|
|
2893
|
+
}, event));
|
|
2894
|
+
});
|
|
2895
|
+
channels.response.subscribe(function(response) {
|
|
2896
|
+
observer.next(objectAssign({
|
|
2897
|
+
type: "response"
|
|
2898
|
+
}, response));
|
|
2899
|
+
observer.complete();
|
|
2900
|
+
});
|
|
2901
|
+
channels.request.publish(context);
|
|
2902
|
+
return function() {
|
|
2903
|
+
return channels.abort.publish();
|
|
2904
|
+
};
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
};
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2911
|
+
|
|
2912
|
+
// node_modules/isobject/index.js
|
|
2913
|
+
var require_isobject = __commonJS({
|
|
2914
|
+
"node_modules/isobject/index.js"(exports, module) {
|
|
2915
|
+
"use strict";
|
|
2916
|
+
module.exports = function isObject(val) {
|
|
2917
|
+
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
});
|
|
2921
|
+
|
|
2922
|
+
// node_modules/is-plain-object/index.js
|
|
2923
|
+
var require_is_plain_object = __commonJS({
|
|
2924
|
+
"node_modules/is-plain-object/index.js"(exports, module) {
|
|
2925
|
+
"use strict";
|
|
2926
|
+
var isObject = require_isobject();
|
|
2927
|
+
function isObjectObject(o) {
|
|
2928
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
2929
|
+
}
|
|
2930
|
+
module.exports = function isPlainObject(o) {
|
|
2931
|
+
var ctor, prot;
|
|
2932
|
+
if (isObjectObject(o) === false)
|
|
2933
|
+
return false;
|
|
2934
|
+
ctor = o.constructor;
|
|
2935
|
+
if (typeof ctor !== "function")
|
|
2936
|
+
return false;
|
|
2937
|
+
prot = ctor.prototype;
|
|
2938
|
+
if (isObjectObject(prot) === false)
|
|
2939
|
+
return false;
|
|
2940
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
2941
|
+
return false;
|
|
2942
|
+
}
|
|
2943
|
+
return true;
|
|
2944
|
+
};
|
|
2945
|
+
}
|
|
2946
|
+
});
|
|
2947
|
+
|
|
2948
|
+
// node_modules/get-it/lib/middleware/jsonRequest.js
|
|
2949
|
+
var require_jsonRequest = __commonJS({
|
|
2950
|
+
"node_modules/get-it/lib/middleware/jsonRequest.js"(exports, module) {
|
|
2951
|
+
"use strict";
|
|
2952
|
+
function _typeof(obj) {
|
|
2953
|
+
"@babel/helpers - typeof";
|
|
2954
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
|
2955
|
+
return typeof obj2;
|
|
2956
|
+
} : function(obj2) {
|
|
2957
|
+
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
2958
|
+
}, _typeof(obj);
|
|
2959
|
+
}
|
|
2960
|
+
var objectAssign = require_object_assign();
|
|
2961
|
+
var isPlainObject = require_is_plain_object();
|
|
2962
|
+
var serializeTypes = ["boolean", "string", "number"];
|
|
2963
|
+
var isBuffer = function isBuffer2(obj) {
|
|
2964
|
+
return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
2965
|
+
};
|
|
2966
|
+
module.exports = function() {
|
|
2967
|
+
return {
|
|
2968
|
+
processOptions: function processOptions(options) {
|
|
2969
|
+
var body = options.body;
|
|
2970
|
+
if (!body) {
|
|
2971
|
+
return options;
|
|
2972
|
+
}
|
|
2973
|
+
var isStream = typeof body.pipe === "function";
|
|
2974
|
+
var shouldSerialize = !isStream && !isBuffer(body) && (serializeTypes.indexOf(_typeof(body)) !== -1 || Array.isArray(body) || isPlainObject(body));
|
|
2975
|
+
if (!shouldSerialize) {
|
|
2976
|
+
return options;
|
|
2977
|
+
}
|
|
2978
|
+
return objectAssign({}, options, {
|
|
2979
|
+
body: JSON.stringify(options.body),
|
|
2980
|
+
headers: objectAssign({}, options.headers, {
|
|
2981
|
+
"Content-Type": "application/json"
|
|
2982
|
+
})
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
};
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
|
|
2990
|
+
// node_modules/get-it/lib/middleware/jsonResponse.js
|
|
2991
|
+
var require_jsonResponse = __commonJS({
|
|
2992
|
+
"node_modules/get-it/lib/middleware/jsonResponse.js"(exports, module) {
|
|
2993
|
+
"use strict";
|
|
2994
|
+
var objectAssign = require_object_assign();
|
|
2995
|
+
module.exports = function(opts) {
|
|
2996
|
+
return {
|
|
2997
|
+
onResponse: function onResponse(response) {
|
|
2998
|
+
var contentType = response.headers["content-type"] || "";
|
|
2999
|
+
var shouldDecode = opts && opts.force || contentType.indexOf("application/json") !== -1;
|
|
3000
|
+
if (!response.body || !contentType || !shouldDecode) {
|
|
3001
|
+
return response;
|
|
3002
|
+
}
|
|
3003
|
+
return objectAssign({}, response, {
|
|
3004
|
+
body: tryParse(response.body)
|
|
3005
|
+
});
|
|
3006
|
+
},
|
|
3007
|
+
processOptions: function processOptions(options) {
|
|
3008
|
+
return objectAssign({}, options, {
|
|
3009
|
+
headers: objectAssign({
|
|
3010
|
+
Accept: "application/json"
|
|
3011
|
+
}, options.headers)
|
|
3012
|
+
});
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
};
|
|
3016
|
+
function tryParse(body) {
|
|
3017
|
+
try {
|
|
3018
|
+
return JSON.parse(body);
|
|
3019
|
+
} catch (err) {
|
|
3020
|
+
err.message = "Failed to parsed response body as JSON: ".concat(err.message);
|
|
3021
|
+
throw err;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
});
|
|
3026
|
+
|
|
3027
|
+
// node_modules/get-it/lib/middleware/progress/browser-progress.js
|
|
3028
|
+
var require_browser_progress = __commonJS({
|
|
3029
|
+
"node_modules/get-it/lib/middleware/progress/browser-progress.js"(exports, module) {
|
|
3030
|
+
"use strict";
|
|
3031
|
+
module.exports = function() {
|
|
3032
|
+
return {
|
|
3033
|
+
onRequest: function onRequest(evt) {
|
|
3034
|
+
if (evt.adapter !== "xhr") {
|
|
3035
|
+
return;
|
|
3036
|
+
}
|
|
3037
|
+
var xhr = evt.request;
|
|
3038
|
+
var context = evt.context;
|
|
3039
|
+
if ("upload" in xhr && "onprogress" in xhr.upload) {
|
|
3040
|
+
xhr.upload.onprogress = handleProgress("upload");
|
|
3041
|
+
}
|
|
3042
|
+
if ("onprogress" in xhr) {
|
|
3043
|
+
xhr.onprogress = handleProgress("download");
|
|
3044
|
+
}
|
|
3045
|
+
function handleProgress(stage) {
|
|
3046
|
+
return function(event) {
|
|
3047
|
+
var percent = event.lengthComputable ? event.loaded / event.total * 100 : -1;
|
|
3048
|
+
context.channels.progress.publish({
|
|
3049
|
+
stage,
|
|
3050
|
+
percent,
|
|
3051
|
+
total: event.total,
|
|
3052
|
+
loaded: event.loaded,
|
|
3053
|
+
lengthComputable: event.lengthComputable
|
|
3054
|
+
});
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3062
|
+
|
|
3063
|
+
// node_modules/get-it/lib/middleware/progress/index.js
|
|
3064
|
+
var require_progress = __commonJS({
|
|
3065
|
+
"node_modules/get-it/lib/middleware/progress/index.js"(exports, module) {
|
|
3066
|
+
"use strict";
|
|
3067
|
+
module.exports = require_browser_progress();
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
3070
|
+
|
|
3071
|
+
// node_modules/make-error/index.js
|
|
3072
|
+
var require_make_error = __commonJS({
|
|
3073
|
+
"node_modules/make-error/index.js"(exports, module) {
|
|
3074
|
+
"use strict";
|
|
3075
|
+
var construct = typeof Reflect !== "undefined" ? Reflect.construct : void 0;
|
|
3076
|
+
var defineProperty = Object.defineProperty;
|
|
3077
|
+
var captureStackTrace = Error.captureStackTrace;
|
|
3078
|
+
if (captureStackTrace === void 0) {
|
|
3079
|
+
captureStackTrace = function captureStackTrace2(error) {
|
|
3080
|
+
var container = new Error();
|
|
3081
|
+
defineProperty(error, "stack", {
|
|
3082
|
+
configurable: true,
|
|
3083
|
+
get: function getStack() {
|
|
3084
|
+
var stack = container.stack;
|
|
3085
|
+
defineProperty(this, "stack", {
|
|
3086
|
+
configurable: true,
|
|
3087
|
+
value: stack,
|
|
3088
|
+
writable: true
|
|
3089
|
+
});
|
|
3090
|
+
return stack;
|
|
3091
|
+
},
|
|
3092
|
+
set: function setStack(stack) {
|
|
3093
|
+
defineProperty(error, "stack", {
|
|
3094
|
+
configurable: true,
|
|
3095
|
+
value: stack,
|
|
3096
|
+
writable: true
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
});
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
function BaseError(message) {
|
|
3103
|
+
if (message !== void 0) {
|
|
3104
|
+
defineProperty(this, "message", {
|
|
3105
|
+
configurable: true,
|
|
3106
|
+
value: message,
|
|
3107
|
+
writable: true
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
var cname = this.constructor.name;
|
|
3111
|
+
if (cname !== void 0 && cname !== this.name) {
|
|
3112
|
+
defineProperty(this, "name", {
|
|
3113
|
+
configurable: true,
|
|
3114
|
+
value: cname,
|
|
3115
|
+
writable: true
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
captureStackTrace(this, this.constructor);
|
|
3119
|
+
}
|
|
3120
|
+
BaseError.prototype = Object.create(Error.prototype, {
|
|
3121
|
+
constructor: {
|
|
3122
|
+
configurable: true,
|
|
3123
|
+
value: BaseError,
|
|
3124
|
+
writable: true
|
|
3125
|
+
}
|
|
3126
|
+
});
|
|
3127
|
+
var setFunctionName = function() {
|
|
3128
|
+
function setFunctionName2(fn, name) {
|
|
3129
|
+
return defineProperty(fn, "name", {
|
|
3130
|
+
configurable: true,
|
|
3131
|
+
value: name
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
try {
|
|
3135
|
+
var f = function() {
|
|
3136
|
+
};
|
|
3137
|
+
setFunctionName2(f, "foo");
|
|
3138
|
+
if (f.name === "foo") {
|
|
3139
|
+
return setFunctionName2;
|
|
3140
|
+
}
|
|
3141
|
+
} catch (_) {
|
|
3142
|
+
}
|
|
3143
|
+
}();
|
|
3144
|
+
function makeError2(constructor, super_) {
|
|
3145
|
+
if (super_ == null || super_ === Error) {
|
|
3146
|
+
super_ = BaseError;
|
|
3147
|
+
} else if (typeof super_ !== "function") {
|
|
3148
|
+
throw new TypeError("super_ should be a function");
|
|
3149
|
+
}
|
|
3150
|
+
var name;
|
|
3151
|
+
if (typeof constructor === "string") {
|
|
3152
|
+
name = constructor;
|
|
3153
|
+
constructor = construct !== void 0 ? function() {
|
|
3154
|
+
return construct(super_, arguments, this.constructor);
|
|
3155
|
+
} : function() {
|
|
3156
|
+
super_.apply(this, arguments);
|
|
3157
|
+
};
|
|
3158
|
+
if (setFunctionName !== void 0) {
|
|
3159
|
+
setFunctionName(constructor, name);
|
|
3160
|
+
name = void 0;
|
|
3161
|
+
}
|
|
3162
|
+
} else if (typeof constructor !== "function") {
|
|
3163
|
+
throw new TypeError("constructor should be either a string or a function");
|
|
3164
|
+
}
|
|
3165
|
+
constructor.super_ = constructor["super"] = super_;
|
|
3166
|
+
var properties = {
|
|
3167
|
+
constructor: {
|
|
3168
|
+
configurable: true,
|
|
3169
|
+
value: constructor,
|
|
3170
|
+
writable: true
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3173
|
+
if (name !== void 0) {
|
|
3174
|
+
properties.name = {
|
|
3175
|
+
configurable: true,
|
|
3176
|
+
value: name,
|
|
3177
|
+
writable: true
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
constructor.prototype = Object.create(super_.prototype, properties);
|
|
3181
|
+
return constructor;
|
|
3182
|
+
}
|
|
3183
|
+
exports = module.exports = makeError2;
|
|
3184
|
+
exports.BaseError = BaseError;
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
|
|
1
3188
|
// src/util/observable.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3189
|
+
var import_Observable = __toESM(require_Observable());
|
|
3190
|
+
var import_filter = __toESM(require_filter());
|
|
3191
|
+
var import_map = __toESM(require_map());
|
|
5
3192
|
|
|
6
3193
|
// src/util/getSelection.js
|
|
7
3194
|
function getSelection(sel) {
|
|
@@ -258,7 +3445,7 @@ var encodeQueryString = ({ query, params = {}, options = {} }) => {
|
|
|
258
3445
|
};
|
|
259
3446
|
|
|
260
3447
|
// src/data/listen.js
|
|
261
|
-
|
|
3448
|
+
var import_eventsource = __toESM(require_browser());
|
|
262
3449
|
|
|
263
3450
|
// src/util/pick.js
|
|
264
3451
|
var pick = (obj, props) => props.reduce((selection, prop) => {
|
|
@@ -277,7 +3464,7 @@ var defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj
|
|
|
277
3464
|
|
|
278
3465
|
// src/data/listen.js
|
|
279
3466
|
var MAX_URL_LENGTH = 16e3 - 1200;
|
|
280
|
-
var EventSource =
|
|
3467
|
+
var EventSource = import_eventsource.default;
|
|
281
3468
|
var possibleOptions = [
|
|
282
3469
|
"includePreviousRevision",
|
|
283
3470
|
"includeResult",
|
|
@@ -296,7 +3483,7 @@ function listen(query, params, opts = {}) {
|
|
|
296
3483
|
const qs = encodeQueryString({ query, params, options: listenOpts, tag });
|
|
297
3484
|
const uri = `${url}${this.getDataUrl("listen", qs)}`;
|
|
298
3485
|
if (uri.length > MAX_URL_LENGTH) {
|
|
299
|
-
return new Observable((observer) => observer.error(new Error("Query too large for listener")));
|
|
3486
|
+
return new import_Observable.Observable((observer) => observer.error(new Error("Query too large for listener")));
|
|
300
3487
|
}
|
|
301
3488
|
const listenFor = options.events ? options.events : ["mutation"];
|
|
302
3489
|
const shouldEmitReconnect = listenFor.indexOf("reconnect") !== -1;
|
|
@@ -309,7 +3496,7 @@ function listen(query, params, opts = {}) {
|
|
|
309
3496
|
Authorization: `Bearer ${token}`
|
|
310
3497
|
};
|
|
311
3498
|
}
|
|
312
|
-
return new Observable((observer) => {
|
|
3499
|
+
return new import_Observable.Observable((observer) => {
|
|
313
3500
|
let es = getEventSource();
|
|
314
3501
|
let reconnectTimer;
|
|
315
3502
|
let stopped = false;
|
|
@@ -428,17 +3615,17 @@ var dataMethods = {
|
|
|
428
3615
|
},
|
|
429
3616
|
fetch(query, params, options = {}) {
|
|
430
3617
|
const mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result;
|
|
431
|
-
const observable2 = this._dataRequest("query", { query, params }, options).pipe(map(mapResponse));
|
|
3618
|
+
const observable2 = this._dataRequest("query", { query, params }, options).pipe((0, import_map.map)(mapResponse));
|
|
432
3619
|
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
433
3620
|
},
|
|
434
3621
|
getDocument(id, opts = {}) {
|
|
435
3622
|
const options = { uri: this.getDataUrl("doc", id), json: true, tag: opts.tag };
|
|
436
|
-
const observable2 = this._requestObservable(options).pipe(filter(isResponse), map((event) => event.body.documents && event.body.documents[0]));
|
|
3623
|
+
const observable2 = this._requestObservable(options).pipe((0, import_filter.filter)(isResponse), (0, import_map.map)((event) => event.body.documents && event.body.documents[0]));
|
|
437
3624
|
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
438
3625
|
},
|
|
439
3626
|
getDocuments(ids, opts = {}) {
|
|
440
3627
|
const options = { uri: this.getDataUrl("doc", ids.join(",")), json: true, tag: opts.tag };
|
|
441
|
-
const observable2 = this._requestObservable(options).pipe(filter(isResponse), map((event) => {
|
|
3628
|
+
const observable2 = this._requestObservable(options).pipe((0, import_filter.filter)(isResponse), (0, import_map.map)((event) => {
|
|
442
3629
|
const indexed = indexBy(event.body.documents || [], (doc) => doc._id);
|
|
443
3630
|
return ids.map((id) => indexed[id] || null);
|
|
444
3631
|
}));
|
|
@@ -495,7 +3682,7 @@ var dataMethods = {
|
|
|
495
3682
|
tag,
|
|
496
3683
|
canUseCdn: isQuery
|
|
497
3684
|
};
|
|
498
|
-
return this._requestObservable(reqOptions).pipe(filter(isResponse), map(getBody), map((res) => {
|
|
3685
|
+
return this._requestObservable(reqOptions).pipe((0, import_filter.filter)(isResponse), (0, import_map.map)(getBody), (0, import_map.map)((res) => {
|
|
499
3686
|
if (!isMutation) {
|
|
500
3687
|
return res;
|
|
501
3688
|
}
|
|
@@ -603,7 +3790,7 @@ var AssetsClient = class {
|
|
|
603
3790
|
query,
|
|
604
3791
|
body
|
|
605
3792
|
});
|
|
606
|
-
return this.client.isPromiseAPI() ? observable2.pipe(filter((event) => event.type === "response"), map((event) => event.body.document)).toPromise() : observable2;
|
|
3793
|
+
return this.client.isPromiseAPI() ? observable2.pipe((0, import_filter.filter)((event) => event.type === "response"), (0, import_map.map)((event) => event.body.document)).toPromise() : observable2;
|
|
607
3794
|
}
|
|
608
3795
|
delete(type, id) {
|
|
609
3796
|
console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");
|
|
@@ -665,14 +3852,14 @@ var AuthClient = class {
|
|
|
665
3852
|
};
|
|
666
3853
|
|
|
667
3854
|
// src/http/request.js
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
3855
|
+
var import_get_it = __toESM(require_get_it());
|
|
3856
|
+
var import_observable4 = __toESM(require_observable2());
|
|
3857
|
+
var import_jsonRequest = __toESM(require_jsonRequest());
|
|
3858
|
+
var import_jsonResponse = __toESM(require_jsonResponse());
|
|
3859
|
+
var import_progress = __toESM(require_progress());
|
|
673
3860
|
|
|
674
3861
|
// src/http/errors.js
|
|
675
|
-
|
|
3862
|
+
var import_make_error = __toESM(require_make_error());
|
|
676
3863
|
function ClientError(res) {
|
|
677
3864
|
const props = extractErrorProps(res);
|
|
678
3865
|
ClientError.super.call(this, props.message);
|
|
@@ -711,8 +3898,8 @@ function stringifyBody(body, res) {
|
|
|
711
3898
|
const isJson = contentType.indexOf("application/json") !== -1;
|
|
712
3899
|
return isJson ? JSON.stringify(body, null, 2) : body;
|
|
713
3900
|
}
|
|
714
|
-
|
|
715
|
-
|
|
3901
|
+
(0, import_make_error.default)(ClientError);
|
|
3902
|
+
(0, import_make_error.default)(ServerError);
|
|
716
3903
|
|
|
717
3904
|
// src/http/browserMiddleware.js
|
|
718
3905
|
var middleware = [];
|
|
@@ -738,13 +3925,13 @@ var printWarnings = {
|
|
|
738
3925
|
};
|
|
739
3926
|
var middleware2 = middleware.concat([
|
|
740
3927
|
printWarnings,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
3928
|
+
(0, import_jsonRequest.default)(),
|
|
3929
|
+
(0, import_jsonResponse.default)(),
|
|
3930
|
+
(0, import_progress.default)(),
|
|
744
3931
|
httpError,
|
|
745
|
-
|
|
3932
|
+
(0, import_observable4.default)({ implementation: import_Observable.Observable })
|
|
746
3933
|
]);
|
|
747
|
-
var request =
|
|
3934
|
+
var request = (0, import_get_it.default)(middleware2);
|
|
748
3935
|
function httpRequest(options, requester = request) {
|
|
749
3936
|
return requester(Object.assign({ maxRedirects: 0 }, options));
|
|
750
3937
|
}
|
|
@@ -774,11 +3961,11 @@ var requestOptions = (config, overrides = {}) => {
|
|
|
774
3961
|
});
|
|
775
3962
|
};
|
|
776
3963
|
|
|
777
|
-
//
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
3964
|
+
// node_modules/@sanity/generate-help-url/dist/generate-help-url.esm.js
|
|
3965
|
+
var BASE_URL = "https://docs.sanity.io/help/";
|
|
3966
|
+
function generateHelpUrl(slug) {
|
|
3967
|
+
return BASE_URL + slug;
|
|
3968
|
+
}
|
|
782
3969
|
|
|
783
3970
|
// src/util/once.js
|
|
784
3971
|
var once = (fn) => {
|
|
@@ -829,7 +4016,7 @@ var initConfig = (config, prevConfig) => {
|
|
|
829
4016
|
const newConfig = Object.assign({}, defaultConfig, specifiedConfig);
|
|
830
4017
|
const projectBased = newConfig.useProjectHostname;
|
|
831
4018
|
if (typeof Promise === "undefined") {
|
|
832
|
-
const helpUrl =
|
|
4019
|
+
const helpUrl = generateHelpUrl("js-client-promise-polyfill");
|
|
833
4020
|
throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`);
|
|
834
4021
|
}
|
|
835
4022
|
if (projectBased && !newConfig.projectId) {
|
|
@@ -929,10 +4116,10 @@ var SanityClient = class {
|
|
|
929
4116
|
const reqOptions = requestOptions(this.clientConfig, Object.assign({}, options, {
|
|
930
4117
|
url: this.getUrl(uri, useCdn)
|
|
931
4118
|
}));
|
|
932
|
-
return new Observable((subscriber) => httpRequest(reqOptions, this.clientConfig.requester).subscribe(subscriber));
|
|
4119
|
+
return new import_Observable.Observable((subscriber) => httpRequest(reqOptions, this.clientConfig.requester).subscribe(subscriber));
|
|
933
4120
|
}
|
|
934
4121
|
request(options) {
|
|
935
|
-
const observable2 = this._requestObservable(options).pipe(filter((event) => event.type === "response"), map((event) => event.body));
|
|
4122
|
+
const observable2 = this._requestObservable(options).pipe((0, import_filter.filter)((event) => event.type === "response"), (0, import_map.map)((event) => event.body));
|
|
936
4123
|
return this.isPromiseAPI() ? toPromise2(observable2) : observable2;
|
|
937
4124
|
}
|
|
938
4125
|
};
|
|
@@ -954,3 +4141,25 @@ export {
|
|
|
954
4141
|
SanityClient,
|
|
955
4142
|
createClient
|
|
956
4143
|
};
|
|
4144
|
+
/*
|
|
4145
|
+
object-assign
|
|
4146
|
+
(c) Sindre Sorhus
|
|
4147
|
+
@license MIT
|
|
4148
|
+
*/
|
|
4149
|
+
/*!
|
|
4150
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4151
|
+
*
|
|
4152
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
4153
|
+
* Released under the MIT License.
|
|
4154
|
+
*/
|
|
4155
|
+
/*!
|
|
4156
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
4157
|
+
*
|
|
4158
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
4159
|
+
* Released under the MIT License.
|
|
4160
|
+
*/
|
|
4161
|
+
/** @license
|
|
4162
|
+
* eventsource.js
|
|
4163
|
+
* Available under MIT License (MIT)
|
|
4164
|
+
* https://github.com/Yaffle/EventSource/
|
|
4165
|
+
*/
|