@sanity/client 4.0.0-alpha.esm.3 → 4.0.0-alpha.esm.4
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 +1948 -26
- package/dist/node/sanityClient.js +17 -6123
- package/package.json +3 -3
|
@@ -17,6 +17,1806 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
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
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
|
+
|
|
20
1820
|
// node_modules/nano-pubsub/index.js
|
|
21
1821
|
var require_nano_pubsub = __commonJS({
|
|
22
1822
|
"node_modules/nano-pubsub/index.js"(exports, module) {
|
|
@@ -1070,7 +2870,7 @@ var require_global = __commonJS({
|
|
|
1070
2870
|
});
|
|
1071
2871
|
|
|
1072
2872
|
// node_modules/get-it/lib/middleware/observable.js
|
|
1073
|
-
var
|
|
2873
|
+
var require_observable2 = __commonJS({
|
|
1074
2874
|
"node_modules/get-it/lib/middleware/observable.js"(exports, module) {
|
|
1075
2875
|
"use strict";
|
|
1076
2876
|
var global2 = require_global();
|
|
@@ -1268,10 +3068,127 @@ var require_progress = __commonJS({
|
|
|
1268
3068
|
}
|
|
1269
3069
|
});
|
|
1270
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
|
+
|
|
1271
3188
|
// src/util/observable.js
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
3189
|
+
var import_Observable = __toESM(require_Observable());
|
|
3190
|
+
var import_filter = __toESM(require_filter());
|
|
3191
|
+
var import_map = __toESM(require_map());
|
|
1275
3192
|
|
|
1276
3193
|
// src/util/getSelection.js
|
|
1277
3194
|
function getSelection(sel) {
|
|
@@ -1528,7 +3445,7 @@ var encodeQueryString = ({ query, params = {}, options = {} }) => {
|
|
|
1528
3445
|
};
|
|
1529
3446
|
|
|
1530
3447
|
// src/data/listen.js
|
|
1531
|
-
|
|
3448
|
+
var import_eventsource = __toESM(require_browser());
|
|
1532
3449
|
|
|
1533
3450
|
// src/util/pick.js
|
|
1534
3451
|
var pick = (obj, props) => props.reduce((selection, prop) => {
|
|
@@ -1547,7 +3464,7 @@ var defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj
|
|
|
1547
3464
|
|
|
1548
3465
|
// src/data/listen.js
|
|
1549
3466
|
var MAX_URL_LENGTH = 16e3 - 1200;
|
|
1550
|
-
var EventSource =
|
|
3467
|
+
var EventSource = import_eventsource.default;
|
|
1551
3468
|
var possibleOptions = [
|
|
1552
3469
|
"includePreviousRevision",
|
|
1553
3470
|
"includeResult",
|
|
@@ -1566,7 +3483,7 @@ function listen(query, params, opts = {}) {
|
|
|
1566
3483
|
const qs = encodeQueryString({ query, params, options: listenOpts, tag });
|
|
1567
3484
|
const uri = `${url}${this.getDataUrl("listen", qs)}`;
|
|
1568
3485
|
if (uri.length > MAX_URL_LENGTH) {
|
|
1569
|
-
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")));
|
|
1570
3487
|
}
|
|
1571
3488
|
const listenFor = options.events ? options.events : ["mutation"];
|
|
1572
3489
|
const shouldEmitReconnect = listenFor.indexOf("reconnect") !== -1;
|
|
@@ -1579,7 +3496,7 @@ function listen(query, params, opts = {}) {
|
|
|
1579
3496
|
Authorization: `Bearer ${token}`
|
|
1580
3497
|
};
|
|
1581
3498
|
}
|
|
1582
|
-
return new Observable((observer) => {
|
|
3499
|
+
return new import_Observable.Observable((observer) => {
|
|
1583
3500
|
let es = getEventSource();
|
|
1584
3501
|
let reconnectTimer;
|
|
1585
3502
|
let stopped = false;
|
|
@@ -1698,17 +3615,17 @@ var dataMethods = {
|
|
|
1698
3615
|
},
|
|
1699
3616
|
fetch(query, params, options = {}) {
|
|
1700
3617
|
const mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result;
|
|
1701
|
-
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));
|
|
1702
3619
|
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
1703
3620
|
},
|
|
1704
3621
|
getDocument(id, opts = {}) {
|
|
1705
3622
|
const options = { uri: this.getDataUrl("doc", id), json: true, tag: opts.tag };
|
|
1706
|
-
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]));
|
|
1707
3624
|
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
1708
3625
|
},
|
|
1709
3626
|
getDocuments(ids, opts = {}) {
|
|
1710
3627
|
const options = { uri: this.getDataUrl("doc", ids.join(",")), json: true, tag: opts.tag };
|
|
1711
|
-
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) => {
|
|
1712
3629
|
const indexed = indexBy(event.body.documents || [], (doc) => doc._id);
|
|
1713
3630
|
return ids.map((id) => indexed[id] || null);
|
|
1714
3631
|
}));
|
|
@@ -1765,7 +3682,7 @@ var dataMethods = {
|
|
|
1765
3682
|
tag,
|
|
1766
3683
|
canUseCdn: isQuery
|
|
1767
3684
|
};
|
|
1768
|
-
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) => {
|
|
1769
3686
|
if (!isMutation) {
|
|
1770
3687
|
return res;
|
|
1771
3688
|
}
|
|
@@ -1873,7 +3790,7 @@ var AssetsClient = class {
|
|
|
1873
3790
|
query,
|
|
1874
3791
|
body
|
|
1875
3792
|
});
|
|
1876
|
-
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;
|
|
1877
3794
|
}
|
|
1878
3795
|
delete(type, id) {
|
|
1879
3796
|
console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");
|
|
@@ -1936,13 +3853,13 @@ var AuthClient = class {
|
|
|
1936
3853
|
|
|
1937
3854
|
// src/http/request.js
|
|
1938
3855
|
var import_get_it = __toESM(require_get_it());
|
|
1939
|
-
var import_observable4 = __toESM(
|
|
3856
|
+
var import_observable4 = __toESM(require_observable2());
|
|
1940
3857
|
var import_jsonRequest = __toESM(require_jsonRequest());
|
|
1941
3858
|
var import_jsonResponse = __toESM(require_jsonResponse());
|
|
1942
3859
|
var import_progress = __toESM(require_progress());
|
|
1943
3860
|
|
|
1944
3861
|
// src/http/errors.js
|
|
1945
|
-
|
|
3862
|
+
var import_make_error = __toESM(require_make_error());
|
|
1946
3863
|
function ClientError(res) {
|
|
1947
3864
|
const props = extractErrorProps(res);
|
|
1948
3865
|
ClientError.super.call(this, props.message);
|
|
@@ -1981,8 +3898,8 @@ function stringifyBody(body, res) {
|
|
|
1981
3898
|
const isJson = contentType.indexOf("application/json") !== -1;
|
|
1982
3899
|
return isJson ? JSON.stringify(body, null, 2) : body;
|
|
1983
3900
|
}
|
|
1984
|
-
|
|
1985
|
-
|
|
3901
|
+
(0, import_make_error.default)(ClientError);
|
|
3902
|
+
(0, import_make_error.default)(ServerError);
|
|
1986
3903
|
|
|
1987
3904
|
// src/http/browserMiddleware.js
|
|
1988
3905
|
var middleware = [];
|
|
@@ -2012,7 +3929,7 @@ var middleware2 = middleware.concat([
|
|
|
2012
3929
|
(0, import_jsonResponse.default)(),
|
|
2013
3930
|
(0, import_progress.default)(),
|
|
2014
3931
|
httpError,
|
|
2015
|
-
(0, import_observable4.default)({ implementation: Observable })
|
|
3932
|
+
(0, import_observable4.default)({ implementation: import_Observable.Observable })
|
|
2016
3933
|
]);
|
|
2017
3934
|
var request = (0, import_get_it.default)(middleware2);
|
|
2018
3935
|
function httpRequest(options, requester = request) {
|
|
@@ -2044,11 +3961,11 @@ var requestOptions = (config, overrides = {}) => {
|
|
|
2044
3961
|
});
|
|
2045
3962
|
};
|
|
2046
3963
|
|
|
2047
|
-
//
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
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
|
+
}
|
|
2052
3969
|
|
|
2053
3970
|
// src/util/once.js
|
|
2054
3971
|
var once = (fn) => {
|
|
@@ -2099,7 +4016,7 @@ var initConfig = (config, prevConfig) => {
|
|
|
2099
4016
|
const newConfig = Object.assign({}, defaultConfig, specifiedConfig);
|
|
2100
4017
|
const projectBased = newConfig.useProjectHostname;
|
|
2101
4018
|
if (typeof Promise === "undefined") {
|
|
2102
|
-
const helpUrl =
|
|
4019
|
+
const helpUrl = generateHelpUrl("js-client-promise-polyfill");
|
|
2103
4020
|
throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`);
|
|
2104
4021
|
}
|
|
2105
4022
|
if (projectBased && !newConfig.projectId) {
|
|
@@ -2199,10 +4116,10 @@ var SanityClient = class {
|
|
|
2199
4116
|
const reqOptions = requestOptions(this.clientConfig, Object.assign({}, options, {
|
|
2200
4117
|
url: this.getUrl(uri, useCdn)
|
|
2201
4118
|
}));
|
|
2202
|
-
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));
|
|
2203
4120
|
}
|
|
2204
4121
|
request(options) {
|
|
2205
|
-
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));
|
|
2206
4123
|
return this.isPromiseAPI() ? toPromise2(observable2) : observable2;
|
|
2207
4124
|
}
|
|
2208
4125
|
};
|
|
@@ -2241,3 +4158,8 @@ object-assign
|
|
|
2241
4158
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
2242
4159
|
* Released under the MIT License.
|
|
2243
4160
|
*/
|
|
4161
|
+
/** @license
|
|
4162
|
+
* eventsource.js
|
|
4163
|
+
* Available under MIT License (MIT)
|
|
4164
|
+
* https://github.com/Yaffle/EventSource/
|
|
4165
|
+
*/
|