@openfin/cloud-interop 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -0
- package/README.md +49 -0
- package/dist/api.d.ts +31 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3451 -0
- package/dist/interfaces.d.ts +130 -0
- package/dist/override.d.ts +5 -0
- package/package.json +27 -0
package/dist/index.js
ADDED
@@ -0,0 +1,3451 @@
|
|
1
|
+
function bind(fn, thisArg) {
|
2
|
+
return function wrap() {
|
3
|
+
return fn.apply(thisArg, arguments);
|
4
|
+
};
|
5
|
+
}
|
6
|
+
|
7
|
+
// utils is a library of generic helper functions non-specific to axios
|
8
|
+
|
9
|
+
const {toString} = Object.prototype;
|
10
|
+
const {getPrototypeOf} = Object;
|
11
|
+
|
12
|
+
const kindOf = (cache => thing => {
|
13
|
+
const str = toString.call(thing);
|
14
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
15
|
+
})(Object.create(null));
|
16
|
+
|
17
|
+
const kindOfTest = (type) => {
|
18
|
+
type = type.toLowerCase();
|
19
|
+
return (thing) => kindOf(thing) === type
|
20
|
+
};
|
21
|
+
|
22
|
+
const typeOfTest = type => thing => typeof thing === type;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Determine if a value is an Array
|
26
|
+
*
|
27
|
+
* @param {Object} val The value to test
|
28
|
+
*
|
29
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
30
|
+
*/
|
31
|
+
const {isArray} = Array;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Determine if a value is undefined
|
35
|
+
*
|
36
|
+
* @param {*} val The value to test
|
37
|
+
*
|
38
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
39
|
+
*/
|
40
|
+
const isUndefined = typeOfTest('undefined');
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Determine if a value is a Buffer
|
44
|
+
*
|
45
|
+
* @param {*} val The value to test
|
46
|
+
*
|
47
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
48
|
+
*/
|
49
|
+
function isBuffer(val) {
|
50
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
51
|
+
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Determine if a value is an ArrayBuffer
|
56
|
+
*
|
57
|
+
* @param {*} val The value to test
|
58
|
+
*
|
59
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
60
|
+
*/
|
61
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
62
|
+
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Determine if a value is a view on an ArrayBuffer
|
66
|
+
*
|
67
|
+
* @param {*} val The value to test
|
68
|
+
*
|
69
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
70
|
+
*/
|
71
|
+
function isArrayBufferView(val) {
|
72
|
+
let result;
|
73
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
74
|
+
result = ArrayBuffer.isView(val);
|
75
|
+
} else {
|
76
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
77
|
+
}
|
78
|
+
return result;
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Determine if a value is a String
|
83
|
+
*
|
84
|
+
* @param {*} val The value to test
|
85
|
+
*
|
86
|
+
* @returns {boolean} True if value is a String, otherwise false
|
87
|
+
*/
|
88
|
+
const isString = typeOfTest('string');
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Determine if a value is a Function
|
92
|
+
*
|
93
|
+
* @param {*} val The value to test
|
94
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
95
|
+
*/
|
96
|
+
const isFunction = typeOfTest('function');
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Determine if a value is a Number
|
100
|
+
*
|
101
|
+
* @param {*} val The value to test
|
102
|
+
*
|
103
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
104
|
+
*/
|
105
|
+
const isNumber = typeOfTest('number');
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Determine if a value is an Object
|
109
|
+
*
|
110
|
+
* @param {*} thing The value to test
|
111
|
+
*
|
112
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
113
|
+
*/
|
114
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Determine if a value is a Boolean
|
118
|
+
*
|
119
|
+
* @param {*} thing The value to test
|
120
|
+
* @returns {boolean} True if value is a Boolean, otherwise false
|
121
|
+
*/
|
122
|
+
const isBoolean = thing => thing === true || thing === false;
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Determine if a value is a plain Object
|
126
|
+
*
|
127
|
+
* @param {*} val The value to test
|
128
|
+
*
|
129
|
+
* @returns {boolean} True if value is a plain Object, otherwise false
|
130
|
+
*/
|
131
|
+
const isPlainObject = (val) => {
|
132
|
+
if (kindOf(val) !== 'object') {
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
|
136
|
+
const prototype = getPrototypeOf(val);
|
137
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
138
|
+
};
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Determine if a value is a Date
|
142
|
+
*
|
143
|
+
* @param {*} val The value to test
|
144
|
+
*
|
145
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
146
|
+
*/
|
147
|
+
const isDate = kindOfTest('Date');
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Determine if a value is a File
|
151
|
+
*
|
152
|
+
* @param {*} val The value to test
|
153
|
+
*
|
154
|
+
* @returns {boolean} True if value is a File, otherwise false
|
155
|
+
*/
|
156
|
+
const isFile = kindOfTest('File');
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Determine if a value is a Blob
|
160
|
+
*
|
161
|
+
* @param {*} val The value to test
|
162
|
+
*
|
163
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
164
|
+
*/
|
165
|
+
const isBlob = kindOfTest('Blob');
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Determine if a value is a FileList
|
169
|
+
*
|
170
|
+
* @param {*} val The value to test
|
171
|
+
*
|
172
|
+
* @returns {boolean} True if value is a File, otherwise false
|
173
|
+
*/
|
174
|
+
const isFileList = kindOfTest('FileList');
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Determine if a value is a Stream
|
178
|
+
*
|
179
|
+
* @param {*} val The value to test
|
180
|
+
*
|
181
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
182
|
+
*/
|
183
|
+
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Determine if a value is a FormData
|
187
|
+
*
|
188
|
+
* @param {*} thing The value to test
|
189
|
+
*
|
190
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
191
|
+
*/
|
192
|
+
const isFormData = (thing) => {
|
193
|
+
let kind;
|
194
|
+
return thing && (
|
195
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
196
|
+
isFunction(thing.append) && (
|
197
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
198
|
+
// detect form-data instance
|
199
|
+
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
200
|
+
)
|
201
|
+
)
|
202
|
+
)
|
203
|
+
};
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Determine if a value is a URLSearchParams object
|
207
|
+
*
|
208
|
+
* @param {*} val The value to test
|
209
|
+
*
|
210
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
211
|
+
*/
|
212
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Trim excess whitespace off the beginning and end of a string
|
216
|
+
*
|
217
|
+
* @param {String} str The String to trim
|
218
|
+
*
|
219
|
+
* @returns {String} The String freed of excess whitespace
|
220
|
+
*/
|
221
|
+
const trim = (str) => str.trim ?
|
222
|
+
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
226
|
+
*
|
227
|
+
* If `obj` is an Array callback will be called passing
|
228
|
+
* the value, index, and complete array for each item.
|
229
|
+
*
|
230
|
+
* If 'obj' is an Object callback will be called passing
|
231
|
+
* the value, key, and complete object for each property.
|
232
|
+
*
|
233
|
+
* @param {Object|Array} obj The object to iterate
|
234
|
+
* @param {Function} fn The callback to invoke for each item
|
235
|
+
*
|
236
|
+
* @param {Boolean} [allOwnKeys = false]
|
237
|
+
* @returns {any}
|
238
|
+
*/
|
239
|
+
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
240
|
+
// Don't bother if no value provided
|
241
|
+
if (obj === null || typeof obj === 'undefined') {
|
242
|
+
return;
|
243
|
+
}
|
244
|
+
|
245
|
+
let i;
|
246
|
+
let l;
|
247
|
+
|
248
|
+
// Force an array if not already something iterable
|
249
|
+
if (typeof obj !== 'object') {
|
250
|
+
/*eslint no-param-reassign:0*/
|
251
|
+
obj = [obj];
|
252
|
+
}
|
253
|
+
|
254
|
+
if (isArray(obj)) {
|
255
|
+
// Iterate over array values
|
256
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
257
|
+
fn.call(null, obj[i], i, obj);
|
258
|
+
}
|
259
|
+
} else {
|
260
|
+
// Iterate over object keys
|
261
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
262
|
+
const len = keys.length;
|
263
|
+
let key;
|
264
|
+
|
265
|
+
for (i = 0; i < len; i++) {
|
266
|
+
key = keys[i];
|
267
|
+
fn.call(null, obj[key], key, obj);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
function findKey(obj, key) {
|
273
|
+
key = key.toLowerCase();
|
274
|
+
const keys = Object.keys(obj);
|
275
|
+
let i = keys.length;
|
276
|
+
let _key;
|
277
|
+
while (i-- > 0) {
|
278
|
+
_key = keys[i];
|
279
|
+
if (key === _key.toLowerCase()) {
|
280
|
+
return _key;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
return null;
|
284
|
+
}
|
285
|
+
|
286
|
+
const _global = (() => {
|
287
|
+
/*eslint no-undef:0*/
|
288
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
289
|
+
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
290
|
+
})();
|
291
|
+
|
292
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
293
|
+
|
294
|
+
/**
|
295
|
+
* Accepts varargs expecting each argument to be an object, then
|
296
|
+
* immutably merges the properties of each object and returns result.
|
297
|
+
*
|
298
|
+
* When multiple objects contain the same key the later object in
|
299
|
+
* the arguments list will take precedence.
|
300
|
+
*
|
301
|
+
* Example:
|
302
|
+
*
|
303
|
+
* ```js
|
304
|
+
* var result = merge({foo: 123}, {foo: 456});
|
305
|
+
* console.log(result.foo); // outputs 456
|
306
|
+
* ```
|
307
|
+
*
|
308
|
+
* @param {Object} obj1 Object to merge
|
309
|
+
*
|
310
|
+
* @returns {Object} Result of all merge properties
|
311
|
+
*/
|
312
|
+
function merge(/* obj1, obj2, obj3, ... */) {
|
313
|
+
const {caseless} = isContextDefined(this) && this || {};
|
314
|
+
const result = {};
|
315
|
+
const assignValue = (val, key) => {
|
316
|
+
const targetKey = caseless && findKey(result, key) || key;
|
317
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
318
|
+
result[targetKey] = merge(result[targetKey], val);
|
319
|
+
} else if (isPlainObject(val)) {
|
320
|
+
result[targetKey] = merge({}, val);
|
321
|
+
} else if (isArray(val)) {
|
322
|
+
result[targetKey] = val.slice();
|
323
|
+
} else {
|
324
|
+
result[targetKey] = val;
|
325
|
+
}
|
326
|
+
};
|
327
|
+
|
328
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
329
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
330
|
+
}
|
331
|
+
return result;
|
332
|
+
}
|
333
|
+
|
334
|
+
/**
|
335
|
+
* Extends object a by mutably adding to it the properties of object b.
|
336
|
+
*
|
337
|
+
* @param {Object} a The object to be extended
|
338
|
+
* @param {Object} b The object to copy properties from
|
339
|
+
* @param {Object} thisArg The object to bind function to
|
340
|
+
*
|
341
|
+
* @param {Boolean} [allOwnKeys]
|
342
|
+
* @returns {Object} The resulting value of object a
|
343
|
+
*/
|
344
|
+
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
345
|
+
forEach(b, (val, key) => {
|
346
|
+
if (thisArg && isFunction(val)) {
|
347
|
+
a[key] = bind(val, thisArg);
|
348
|
+
} else {
|
349
|
+
a[key] = val;
|
350
|
+
}
|
351
|
+
}, {allOwnKeys});
|
352
|
+
return a;
|
353
|
+
};
|
354
|
+
|
355
|
+
/**
|
356
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
357
|
+
*
|
358
|
+
* @param {string} content with BOM
|
359
|
+
*
|
360
|
+
* @returns {string} content value without BOM
|
361
|
+
*/
|
362
|
+
const stripBOM = (content) => {
|
363
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
364
|
+
content = content.slice(1);
|
365
|
+
}
|
366
|
+
return content;
|
367
|
+
};
|
368
|
+
|
369
|
+
/**
|
370
|
+
* Inherit the prototype methods from one constructor into another
|
371
|
+
* @param {function} constructor
|
372
|
+
* @param {function} superConstructor
|
373
|
+
* @param {object} [props]
|
374
|
+
* @param {object} [descriptors]
|
375
|
+
*
|
376
|
+
* @returns {void}
|
377
|
+
*/
|
378
|
+
const inherits = (constructor, superConstructor, props, descriptors) => {
|
379
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
380
|
+
constructor.prototype.constructor = constructor;
|
381
|
+
Object.defineProperty(constructor, 'super', {
|
382
|
+
value: superConstructor.prototype
|
383
|
+
});
|
384
|
+
props && Object.assign(constructor.prototype, props);
|
385
|
+
};
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Resolve object with deep prototype chain to a flat object
|
389
|
+
* @param {Object} sourceObj source object
|
390
|
+
* @param {Object} [destObj]
|
391
|
+
* @param {Function|Boolean} [filter]
|
392
|
+
* @param {Function} [propFilter]
|
393
|
+
*
|
394
|
+
* @returns {Object}
|
395
|
+
*/
|
396
|
+
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
397
|
+
let props;
|
398
|
+
let i;
|
399
|
+
let prop;
|
400
|
+
const merged = {};
|
401
|
+
|
402
|
+
destObj = destObj || {};
|
403
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
404
|
+
if (sourceObj == null) return destObj;
|
405
|
+
|
406
|
+
do {
|
407
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
408
|
+
i = props.length;
|
409
|
+
while (i-- > 0) {
|
410
|
+
prop = props[i];
|
411
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
412
|
+
destObj[prop] = sourceObj[prop];
|
413
|
+
merged[prop] = true;
|
414
|
+
}
|
415
|
+
}
|
416
|
+
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
417
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
418
|
+
|
419
|
+
return destObj;
|
420
|
+
};
|
421
|
+
|
422
|
+
/**
|
423
|
+
* Determines whether a string ends with the characters of a specified string
|
424
|
+
*
|
425
|
+
* @param {String} str
|
426
|
+
* @param {String} searchString
|
427
|
+
* @param {Number} [position= 0]
|
428
|
+
*
|
429
|
+
* @returns {boolean}
|
430
|
+
*/
|
431
|
+
const endsWith = (str, searchString, position) => {
|
432
|
+
str = String(str);
|
433
|
+
if (position === undefined || position > str.length) {
|
434
|
+
position = str.length;
|
435
|
+
}
|
436
|
+
position -= searchString.length;
|
437
|
+
const lastIndex = str.indexOf(searchString, position);
|
438
|
+
return lastIndex !== -1 && lastIndex === position;
|
439
|
+
};
|
440
|
+
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Returns new array from array like object or null if failed
|
444
|
+
*
|
445
|
+
* @param {*} [thing]
|
446
|
+
*
|
447
|
+
* @returns {?Array}
|
448
|
+
*/
|
449
|
+
const toArray = (thing) => {
|
450
|
+
if (!thing) return null;
|
451
|
+
if (isArray(thing)) return thing;
|
452
|
+
let i = thing.length;
|
453
|
+
if (!isNumber(i)) return null;
|
454
|
+
const arr = new Array(i);
|
455
|
+
while (i-- > 0) {
|
456
|
+
arr[i] = thing[i];
|
457
|
+
}
|
458
|
+
return arr;
|
459
|
+
};
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
463
|
+
* thing passed in is an instance of Uint8Array
|
464
|
+
*
|
465
|
+
* @param {TypedArray}
|
466
|
+
*
|
467
|
+
* @returns {Array}
|
468
|
+
*/
|
469
|
+
// eslint-disable-next-line func-names
|
470
|
+
const isTypedArray = (TypedArray => {
|
471
|
+
// eslint-disable-next-line func-names
|
472
|
+
return thing => {
|
473
|
+
return TypedArray && thing instanceof TypedArray;
|
474
|
+
};
|
475
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
476
|
+
|
477
|
+
/**
|
478
|
+
* For each entry in the object, call the function with the key and value.
|
479
|
+
*
|
480
|
+
* @param {Object<any, any>} obj - The object to iterate over.
|
481
|
+
* @param {Function} fn - The function to call for each entry.
|
482
|
+
*
|
483
|
+
* @returns {void}
|
484
|
+
*/
|
485
|
+
const forEachEntry = (obj, fn) => {
|
486
|
+
const generator = obj && obj[Symbol.iterator];
|
487
|
+
|
488
|
+
const iterator = generator.call(obj);
|
489
|
+
|
490
|
+
let result;
|
491
|
+
|
492
|
+
while ((result = iterator.next()) && !result.done) {
|
493
|
+
const pair = result.value;
|
494
|
+
fn.call(obj, pair[0], pair[1]);
|
495
|
+
}
|
496
|
+
};
|
497
|
+
|
498
|
+
/**
|
499
|
+
* It takes a regular expression and a string, and returns an array of all the matches
|
500
|
+
*
|
501
|
+
* @param {string} regExp - The regular expression to match against.
|
502
|
+
* @param {string} str - The string to search.
|
503
|
+
*
|
504
|
+
* @returns {Array<boolean>}
|
505
|
+
*/
|
506
|
+
const matchAll = (regExp, str) => {
|
507
|
+
let matches;
|
508
|
+
const arr = [];
|
509
|
+
|
510
|
+
while ((matches = regExp.exec(str)) !== null) {
|
511
|
+
arr.push(matches);
|
512
|
+
}
|
513
|
+
|
514
|
+
return arr;
|
515
|
+
};
|
516
|
+
|
517
|
+
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
518
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
519
|
+
|
520
|
+
const toCamelCase = str => {
|
521
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
522
|
+
function replacer(m, p1, p2) {
|
523
|
+
return p1.toUpperCase() + p2;
|
524
|
+
}
|
525
|
+
);
|
526
|
+
};
|
527
|
+
|
528
|
+
/* Creating a function that will check if an object has a property. */
|
529
|
+
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
530
|
+
|
531
|
+
/**
|
532
|
+
* Determine if a value is a RegExp object
|
533
|
+
*
|
534
|
+
* @param {*} val The value to test
|
535
|
+
*
|
536
|
+
* @returns {boolean} True if value is a RegExp object, otherwise false
|
537
|
+
*/
|
538
|
+
const isRegExp = kindOfTest('RegExp');
|
539
|
+
|
540
|
+
const reduceDescriptors = (obj, reducer) => {
|
541
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
542
|
+
const reducedDescriptors = {};
|
543
|
+
|
544
|
+
forEach(descriptors, (descriptor, name) => {
|
545
|
+
let ret;
|
546
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
547
|
+
reducedDescriptors[name] = ret || descriptor;
|
548
|
+
}
|
549
|
+
});
|
550
|
+
|
551
|
+
Object.defineProperties(obj, reducedDescriptors);
|
552
|
+
};
|
553
|
+
|
554
|
+
/**
|
555
|
+
* Makes all methods read-only
|
556
|
+
* @param {Object} obj
|
557
|
+
*/
|
558
|
+
|
559
|
+
const freezeMethods = (obj) => {
|
560
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
561
|
+
// skip restricted props in strict mode
|
562
|
+
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
563
|
+
return false;
|
564
|
+
}
|
565
|
+
|
566
|
+
const value = obj[name];
|
567
|
+
|
568
|
+
if (!isFunction(value)) return;
|
569
|
+
|
570
|
+
descriptor.enumerable = false;
|
571
|
+
|
572
|
+
if ('writable' in descriptor) {
|
573
|
+
descriptor.writable = false;
|
574
|
+
return;
|
575
|
+
}
|
576
|
+
|
577
|
+
if (!descriptor.set) {
|
578
|
+
descriptor.set = () => {
|
579
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
580
|
+
};
|
581
|
+
}
|
582
|
+
});
|
583
|
+
};
|
584
|
+
|
585
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
586
|
+
const obj = {};
|
587
|
+
|
588
|
+
const define = (arr) => {
|
589
|
+
arr.forEach(value => {
|
590
|
+
obj[value] = true;
|
591
|
+
});
|
592
|
+
};
|
593
|
+
|
594
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
595
|
+
|
596
|
+
return obj;
|
597
|
+
};
|
598
|
+
|
599
|
+
const noop = () => {};
|
600
|
+
|
601
|
+
const toFiniteNumber = (value, defaultValue) => {
|
602
|
+
value = +value;
|
603
|
+
return Number.isFinite(value) ? value : defaultValue;
|
604
|
+
};
|
605
|
+
|
606
|
+
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
607
|
+
|
608
|
+
const DIGIT = '0123456789';
|
609
|
+
|
610
|
+
const ALPHABET = {
|
611
|
+
DIGIT,
|
612
|
+
ALPHA,
|
613
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
614
|
+
};
|
615
|
+
|
616
|
+
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
617
|
+
let str = '';
|
618
|
+
const {length} = alphabet;
|
619
|
+
while (size--) {
|
620
|
+
str += alphabet[Math.random() * length|0];
|
621
|
+
}
|
622
|
+
|
623
|
+
return str;
|
624
|
+
};
|
625
|
+
|
626
|
+
/**
|
627
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
628
|
+
*
|
629
|
+
* @param {unknown} thing - The thing to check.
|
630
|
+
*
|
631
|
+
* @returns {boolean}
|
632
|
+
*/
|
633
|
+
function isSpecCompliantForm(thing) {
|
634
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
635
|
+
}
|
636
|
+
|
637
|
+
const toJSONObject = (obj) => {
|
638
|
+
const stack = new Array(10);
|
639
|
+
|
640
|
+
const visit = (source, i) => {
|
641
|
+
|
642
|
+
if (isObject(source)) {
|
643
|
+
if (stack.indexOf(source) >= 0) {
|
644
|
+
return;
|
645
|
+
}
|
646
|
+
|
647
|
+
if(!('toJSON' in source)) {
|
648
|
+
stack[i] = source;
|
649
|
+
const target = isArray(source) ? [] : {};
|
650
|
+
|
651
|
+
forEach(source, (value, key) => {
|
652
|
+
const reducedValue = visit(value, i + 1);
|
653
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
654
|
+
});
|
655
|
+
|
656
|
+
stack[i] = undefined;
|
657
|
+
|
658
|
+
return target;
|
659
|
+
}
|
660
|
+
}
|
661
|
+
|
662
|
+
return source;
|
663
|
+
};
|
664
|
+
|
665
|
+
return visit(obj, 0);
|
666
|
+
};
|
667
|
+
|
668
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
669
|
+
|
670
|
+
const isThenable = (thing) =>
|
671
|
+
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
672
|
+
|
673
|
+
var utils$1 = {
|
674
|
+
isArray,
|
675
|
+
isArrayBuffer,
|
676
|
+
isBuffer,
|
677
|
+
isFormData,
|
678
|
+
isArrayBufferView,
|
679
|
+
isString,
|
680
|
+
isNumber,
|
681
|
+
isBoolean,
|
682
|
+
isObject,
|
683
|
+
isPlainObject,
|
684
|
+
isUndefined,
|
685
|
+
isDate,
|
686
|
+
isFile,
|
687
|
+
isBlob,
|
688
|
+
isRegExp,
|
689
|
+
isFunction,
|
690
|
+
isStream,
|
691
|
+
isURLSearchParams,
|
692
|
+
isTypedArray,
|
693
|
+
isFileList,
|
694
|
+
forEach,
|
695
|
+
merge,
|
696
|
+
extend,
|
697
|
+
trim,
|
698
|
+
stripBOM,
|
699
|
+
inherits,
|
700
|
+
toFlatObject,
|
701
|
+
kindOf,
|
702
|
+
kindOfTest,
|
703
|
+
endsWith,
|
704
|
+
toArray,
|
705
|
+
forEachEntry,
|
706
|
+
matchAll,
|
707
|
+
isHTMLForm,
|
708
|
+
hasOwnProperty,
|
709
|
+
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
710
|
+
reduceDescriptors,
|
711
|
+
freezeMethods,
|
712
|
+
toObjectSet,
|
713
|
+
toCamelCase,
|
714
|
+
noop,
|
715
|
+
toFiniteNumber,
|
716
|
+
findKey,
|
717
|
+
global: _global,
|
718
|
+
isContextDefined,
|
719
|
+
ALPHABET,
|
720
|
+
generateString,
|
721
|
+
isSpecCompliantForm,
|
722
|
+
toJSONObject,
|
723
|
+
isAsyncFn,
|
724
|
+
isThenable
|
725
|
+
};
|
726
|
+
|
727
|
+
/**
|
728
|
+
* Create an Error with the specified message, config, error code, request and response.
|
729
|
+
*
|
730
|
+
* @param {string} message The error message.
|
731
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
732
|
+
* @param {Object} [config] The config.
|
733
|
+
* @param {Object} [request] The request.
|
734
|
+
* @param {Object} [response] The response.
|
735
|
+
*
|
736
|
+
* @returns {Error} The created error.
|
737
|
+
*/
|
738
|
+
function AxiosError(message, code, config, request, response) {
|
739
|
+
Error.call(this);
|
740
|
+
|
741
|
+
if (Error.captureStackTrace) {
|
742
|
+
Error.captureStackTrace(this, this.constructor);
|
743
|
+
} else {
|
744
|
+
this.stack = (new Error()).stack;
|
745
|
+
}
|
746
|
+
|
747
|
+
this.message = message;
|
748
|
+
this.name = 'AxiosError';
|
749
|
+
code && (this.code = code);
|
750
|
+
config && (this.config = config);
|
751
|
+
request && (this.request = request);
|
752
|
+
response && (this.response = response);
|
753
|
+
}
|
754
|
+
|
755
|
+
utils$1.inherits(AxiosError, Error, {
|
756
|
+
toJSON: function toJSON() {
|
757
|
+
return {
|
758
|
+
// Standard
|
759
|
+
message: this.message,
|
760
|
+
name: this.name,
|
761
|
+
// Microsoft
|
762
|
+
description: this.description,
|
763
|
+
number: this.number,
|
764
|
+
// Mozilla
|
765
|
+
fileName: this.fileName,
|
766
|
+
lineNumber: this.lineNumber,
|
767
|
+
columnNumber: this.columnNumber,
|
768
|
+
stack: this.stack,
|
769
|
+
// Axios
|
770
|
+
config: utils$1.toJSONObject(this.config),
|
771
|
+
code: this.code,
|
772
|
+
status: this.response && this.response.status ? this.response.status : null
|
773
|
+
};
|
774
|
+
}
|
775
|
+
});
|
776
|
+
|
777
|
+
const prototype$1 = AxiosError.prototype;
|
778
|
+
const descriptors = {};
|
779
|
+
|
780
|
+
[
|
781
|
+
'ERR_BAD_OPTION_VALUE',
|
782
|
+
'ERR_BAD_OPTION',
|
783
|
+
'ECONNABORTED',
|
784
|
+
'ETIMEDOUT',
|
785
|
+
'ERR_NETWORK',
|
786
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
787
|
+
'ERR_DEPRECATED',
|
788
|
+
'ERR_BAD_RESPONSE',
|
789
|
+
'ERR_BAD_REQUEST',
|
790
|
+
'ERR_CANCELED',
|
791
|
+
'ERR_NOT_SUPPORT',
|
792
|
+
'ERR_INVALID_URL'
|
793
|
+
// eslint-disable-next-line func-names
|
794
|
+
].forEach(code => {
|
795
|
+
descriptors[code] = {value: code};
|
796
|
+
});
|
797
|
+
|
798
|
+
Object.defineProperties(AxiosError, descriptors);
|
799
|
+
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
800
|
+
|
801
|
+
// eslint-disable-next-line func-names
|
802
|
+
AxiosError.from = (error, code, config, request, response, customProps) => {
|
803
|
+
const axiosError = Object.create(prototype$1);
|
804
|
+
|
805
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
806
|
+
return obj !== Error.prototype;
|
807
|
+
}, prop => {
|
808
|
+
return prop !== 'isAxiosError';
|
809
|
+
});
|
810
|
+
|
811
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
812
|
+
|
813
|
+
axiosError.cause = error;
|
814
|
+
|
815
|
+
axiosError.name = error.name;
|
816
|
+
|
817
|
+
customProps && Object.assign(axiosError, customProps);
|
818
|
+
|
819
|
+
return axiosError;
|
820
|
+
};
|
821
|
+
|
822
|
+
// eslint-disable-next-line strict
|
823
|
+
var httpAdapter = null;
|
824
|
+
|
825
|
+
/**
|
826
|
+
* Determines if the given thing is a array or js object.
|
827
|
+
*
|
828
|
+
* @param {string} thing - The object or array to be visited.
|
829
|
+
*
|
830
|
+
* @returns {boolean}
|
831
|
+
*/
|
832
|
+
function isVisitable(thing) {
|
833
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
834
|
+
}
|
835
|
+
|
836
|
+
/**
|
837
|
+
* It removes the brackets from the end of a string
|
838
|
+
*
|
839
|
+
* @param {string} key - The key of the parameter.
|
840
|
+
*
|
841
|
+
* @returns {string} the key without the brackets.
|
842
|
+
*/
|
843
|
+
function removeBrackets(key) {
|
844
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
845
|
+
}
|
846
|
+
|
847
|
+
/**
|
848
|
+
* It takes a path, a key, and a boolean, and returns a string
|
849
|
+
*
|
850
|
+
* @param {string} path - The path to the current key.
|
851
|
+
* @param {string} key - The key of the current object being iterated over.
|
852
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
853
|
+
*
|
854
|
+
* @returns {string} The path to the current key.
|
855
|
+
*/
|
856
|
+
function renderKey(path, key, dots) {
|
857
|
+
if (!path) return key;
|
858
|
+
return path.concat(key).map(function each(token, i) {
|
859
|
+
// eslint-disable-next-line no-param-reassign
|
860
|
+
token = removeBrackets(token);
|
861
|
+
return !dots && i ? '[' + token + ']' : token;
|
862
|
+
}).join(dots ? '.' : '');
|
863
|
+
}
|
864
|
+
|
865
|
+
/**
|
866
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
867
|
+
*
|
868
|
+
* @param {Array<any>} arr - The array to check
|
869
|
+
*
|
870
|
+
* @returns {boolean}
|
871
|
+
*/
|
872
|
+
function isFlatArray(arr) {
|
873
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
874
|
+
}
|
875
|
+
|
876
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
877
|
+
return /^is[A-Z]/.test(prop);
|
878
|
+
});
|
879
|
+
|
880
|
+
/**
|
881
|
+
* Convert a data object to FormData
|
882
|
+
*
|
883
|
+
* @param {Object} obj
|
884
|
+
* @param {?Object} [formData]
|
885
|
+
* @param {?Object} [options]
|
886
|
+
* @param {Function} [options.visitor]
|
887
|
+
* @param {Boolean} [options.metaTokens = true]
|
888
|
+
* @param {Boolean} [options.dots = false]
|
889
|
+
* @param {?Boolean} [options.indexes = false]
|
890
|
+
*
|
891
|
+
* @returns {Object}
|
892
|
+
**/
|
893
|
+
|
894
|
+
/**
|
895
|
+
* It converts an object into a FormData object
|
896
|
+
*
|
897
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
898
|
+
* @param {string} formData - The FormData object to append to.
|
899
|
+
* @param {Object<string, any>} options
|
900
|
+
*
|
901
|
+
* @returns
|
902
|
+
*/
|
903
|
+
function toFormData(obj, formData, options) {
|
904
|
+
if (!utils$1.isObject(obj)) {
|
905
|
+
throw new TypeError('target must be an object');
|
906
|
+
}
|
907
|
+
|
908
|
+
// eslint-disable-next-line no-param-reassign
|
909
|
+
formData = formData || new (FormData)();
|
910
|
+
|
911
|
+
// eslint-disable-next-line no-param-reassign
|
912
|
+
options = utils$1.toFlatObject(options, {
|
913
|
+
metaTokens: true,
|
914
|
+
dots: false,
|
915
|
+
indexes: false
|
916
|
+
}, false, function defined(option, source) {
|
917
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
918
|
+
return !utils$1.isUndefined(source[option]);
|
919
|
+
});
|
920
|
+
|
921
|
+
const metaTokens = options.metaTokens;
|
922
|
+
// eslint-disable-next-line no-use-before-define
|
923
|
+
const visitor = options.visitor || defaultVisitor;
|
924
|
+
const dots = options.dots;
|
925
|
+
const indexes = options.indexes;
|
926
|
+
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
927
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
928
|
+
|
929
|
+
if (!utils$1.isFunction(visitor)) {
|
930
|
+
throw new TypeError('visitor must be a function');
|
931
|
+
}
|
932
|
+
|
933
|
+
function convertValue(value) {
|
934
|
+
if (value === null) return '';
|
935
|
+
|
936
|
+
if (utils$1.isDate(value)) {
|
937
|
+
return value.toISOString();
|
938
|
+
}
|
939
|
+
|
940
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
941
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
942
|
+
}
|
943
|
+
|
944
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
945
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
946
|
+
}
|
947
|
+
|
948
|
+
return value;
|
949
|
+
}
|
950
|
+
|
951
|
+
/**
|
952
|
+
* Default visitor.
|
953
|
+
*
|
954
|
+
* @param {*} value
|
955
|
+
* @param {String|Number} key
|
956
|
+
* @param {Array<String|Number>} path
|
957
|
+
* @this {FormData}
|
958
|
+
*
|
959
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
960
|
+
*/
|
961
|
+
function defaultVisitor(value, key, path) {
|
962
|
+
let arr = value;
|
963
|
+
|
964
|
+
if (value && !path && typeof value === 'object') {
|
965
|
+
if (utils$1.endsWith(key, '{}')) {
|
966
|
+
// eslint-disable-next-line no-param-reassign
|
967
|
+
key = metaTokens ? key : key.slice(0, -2);
|
968
|
+
// eslint-disable-next-line no-param-reassign
|
969
|
+
value = JSON.stringify(value);
|
970
|
+
} else if (
|
971
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
972
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
973
|
+
)) {
|
974
|
+
// eslint-disable-next-line no-param-reassign
|
975
|
+
key = removeBrackets(key);
|
976
|
+
|
977
|
+
arr.forEach(function each(el, index) {
|
978
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
979
|
+
// eslint-disable-next-line no-nested-ternary
|
980
|
+
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
981
|
+
convertValue(el)
|
982
|
+
);
|
983
|
+
});
|
984
|
+
return false;
|
985
|
+
}
|
986
|
+
}
|
987
|
+
|
988
|
+
if (isVisitable(value)) {
|
989
|
+
return true;
|
990
|
+
}
|
991
|
+
|
992
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
993
|
+
|
994
|
+
return false;
|
995
|
+
}
|
996
|
+
|
997
|
+
const stack = [];
|
998
|
+
|
999
|
+
const exposedHelpers = Object.assign(predicates, {
|
1000
|
+
defaultVisitor,
|
1001
|
+
convertValue,
|
1002
|
+
isVisitable
|
1003
|
+
});
|
1004
|
+
|
1005
|
+
function build(value, path) {
|
1006
|
+
if (utils$1.isUndefined(value)) return;
|
1007
|
+
|
1008
|
+
if (stack.indexOf(value) !== -1) {
|
1009
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
stack.push(value);
|
1013
|
+
|
1014
|
+
utils$1.forEach(value, function each(el, key) {
|
1015
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
1016
|
+
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
1017
|
+
);
|
1018
|
+
|
1019
|
+
if (result === true) {
|
1020
|
+
build(el, path ? path.concat(key) : [key]);
|
1021
|
+
}
|
1022
|
+
});
|
1023
|
+
|
1024
|
+
stack.pop();
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
if (!utils$1.isObject(obj)) {
|
1028
|
+
throw new TypeError('data must be an object');
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
build(obj);
|
1032
|
+
|
1033
|
+
return formData;
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
1038
|
+
* their percent-encoded equivalents
|
1039
|
+
*
|
1040
|
+
* @param {string} str - The string to encode.
|
1041
|
+
*
|
1042
|
+
* @returns {string} The encoded string.
|
1043
|
+
*/
|
1044
|
+
function encode$1(str) {
|
1045
|
+
const charMap = {
|
1046
|
+
'!': '%21',
|
1047
|
+
"'": '%27',
|
1048
|
+
'(': '%28',
|
1049
|
+
')': '%29',
|
1050
|
+
'~': '%7E',
|
1051
|
+
'%20': '+',
|
1052
|
+
'%00': '\x00'
|
1053
|
+
};
|
1054
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
1055
|
+
return charMap[match];
|
1056
|
+
});
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
/**
|
1060
|
+
* It takes a params object and converts it to a FormData object
|
1061
|
+
*
|
1062
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
1063
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
1064
|
+
*
|
1065
|
+
* @returns {void}
|
1066
|
+
*/
|
1067
|
+
function AxiosURLSearchParams(params, options) {
|
1068
|
+
this._pairs = [];
|
1069
|
+
|
1070
|
+
params && toFormData(params, this, options);
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
const prototype = AxiosURLSearchParams.prototype;
|
1074
|
+
|
1075
|
+
prototype.append = function append(name, value) {
|
1076
|
+
this._pairs.push([name, value]);
|
1077
|
+
};
|
1078
|
+
|
1079
|
+
prototype.toString = function toString(encoder) {
|
1080
|
+
const _encode = encoder ? function(value) {
|
1081
|
+
return encoder.call(this, value, encode$1);
|
1082
|
+
} : encode$1;
|
1083
|
+
|
1084
|
+
return this._pairs.map(function each(pair) {
|
1085
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
1086
|
+
}, '').join('&');
|
1087
|
+
};
|
1088
|
+
|
1089
|
+
/**
|
1090
|
+
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
1091
|
+
* URI encoded counterparts
|
1092
|
+
*
|
1093
|
+
* @param {string} val The value to be encoded.
|
1094
|
+
*
|
1095
|
+
* @returns {string} The encoded value.
|
1096
|
+
*/
|
1097
|
+
function encode(val) {
|
1098
|
+
return encodeURIComponent(val).
|
1099
|
+
replace(/%3A/gi, ':').
|
1100
|
+
replace(/%24/g, '$').
|
1101
|
+
replace(/%2C/gi, ',').
|
1102
|
+
replace(/%20/g, '+').
|
1103
|
+
replace(/%5B/gi, '[').
|
1104
|
+
replace(/%5D/gi, ']');
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
/**
|
1108
|
+
* Build a URL by appending params to the end
|
1109
|
+
*
|
1110
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
1111
|
+
* @param {object} [params] The params to be appended
|
1112
|
+
* @param {?object} options
|
1113
|
+
*
|
1114
|
+
* @returns {string} The formatted url
|
1115
|
+
*/
|
1116
|
+
function buildURL(url, params, options) {
|
1117
|
+
/*eslint no-param-reassign:0*/
|
1118
|
+
if (!params) {
|
1119
|
+
return url;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
const _encode = options && options.encode || encode;
|
1123
|
+
|
1124
|
+
const serializeFn = options && options.serialize;
|
1125
|
+
|
1126
|
+
let serializedParams;
|
1127
|
+
|
1128
|
+
if (serializeFn) {
|
1129
|
+
serializedParams = serializeFn(params, options);
|
1130
|
+
} else {
|
1131
|
+
serializedParams = utils$1.isURLSearchParams(params) ?
|
1132
|
+
params.toString() :
|
1133
|
+
new AxiosURLSearchParams(params, options).toString(_encode);
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
if (serializedParams) {
|
1137
|
+
const hashmarkIndex = url.indexOf("#");
|
1138
|
+
|
1139
|
+
if (hashmarkIndex !== -1) {
|
1140
|
+
url = url.slice(0, hashmarkIndex);
|
1141
|
+
}
|
1142
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
return url;
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
class InterceptorManager {
|
1149
|
+
constructor() {
|
1150
|
+
this.handlers = [];
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
/**
|
1154
|
+
* Add a new interceptor to the stack
|
1155
|
+
*
|
1156
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
1157
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
1158
|
+
*
|
1159
|
+
* @return {Number} An ID used to remove interceptor later
|
1160
|
+
*/
|
1161
|
+
use(fulfilled, rejected, options) {
|
1162
|
+
this.handlers.push({
|
1163
|
+
fulfilled,
|
1164
|
+
rejected,
|
1165
|
+
synchronous: options ? options.synchronous : false,
|
1166
|
+
runWhen: options ? options.runWhen : null
|
1167
|
+
});
|
1168
|
+
return this.handlers.length - 1;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
/**
|
1172
|
+
* Remove an interceptor from the stack
|
1173
|
+
*
|
1174
|
+
* @param {Number} id The ID that was returned by `use`
|
1175
|
+
*
|
1176
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
1177
|
+
*/
|
1178
|
+
eject(id) {
|
1179
|
+
if (this.handlers[id]) {
|
1180
|
+
this.handlers[id] = null;
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
|
1184
|
+
/**
|
1185
|
+
* Clear all interceptors from the stack
|
1186
|
+
*
|
1187
|
+
* @returns {void}
|
1188
|
+
*/
|
1189
|
+
clear() {
|
1190
|
+
if (this.handlers) {
|
1191
|
+
this.handlers = [];
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
/**
|
1196
|
+
* Iterate over all the registered interceptors
|
1197
|
+
*
|
1198
|
+
* This method is particularly useful for skipping over any
|
1199
|
+
* interceptors that may have become `null` calling `eject`.
|
1200
|
+
*
|
1201
|
+
* @param {Function} fn The function to call for each interceptor
|
1202
|
+
*
|
1203
|
+
* @returns {void}
|
1204
|
+
*/
|
1205
|
+
forEach(fn) {
|
1206
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
1207
|
+
if (h !== null) {
|
1208
|
+
fn(h);
|
1209
|
+
}
|
1210
|
+
});
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
var transitionalDefaults = {
|
1215
|
+
silentJSONParsing: true,
|
1216
|
+
forcedJSONParsing: true,
|
1217
|
+
clarifyTimeoutError: false
|
1218
|
+
};
|
1219
|
+
|
1220
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
1221
|
+
|
1222
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
1223
|
+
|
1224
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
1225
|
+
|
1226
|
+
var platform$1 = {
|
1227
|
+
isBrowser: true,
|
1228
|
+
classes: {
|
1229
|
+
URLSearchParams: URLSearchParams$1,
|
1230
|
+
FormData: FormData$1,
|
1231
|
+
Blob: Blob$1
|
1232
|
+
},
|
1233
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
1234
|
+
};
|
1235
|
+
|
1236
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
1237
|
+
|
1238
|
+
/**
|
1239
|
+
* Determine if we're running in a standard browser environment
|
1240
|
+
*
|
1241
|
+
* This allows axios to run in a web worker, and react-native.
|
1242
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
1243
|
+
*
|
1244
|
+
* web workers:
|
1245
|
+
* typeof window -> undefined
|
1246
|
+
* typeof document -> undefined
|
1247
|
+
*
|
1248
|
+
* react-native:
|
1249
|
+
* navigator.product -> 'ReactNative'
|
1250
|
+
* nativescript
|
1251
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
1252
|
+
*
|
1253
|
+
* @returns {boolean}
|
1254
|
+
*/
|
1255
|
+
const hasStandardBrowserEnv = (
|
1256
|
+
(product) => {
|
1257
|
+
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
1258
|
+
})(typeof navigator !== 'undefined' && navigator.product);
|
1259
|
+
|
1260
|
+
/**
|
1261
|
+
* Determine if we're running in a standard browser webWorker environment
|
1262
|
+
*
|
1263
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
1264
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
1265
|
+
* filtered out due to its judgment standard
|
1266
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
1267
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
1268
|
+
*/
|
1269
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
1270
|
+
return (
|
1271
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
1272
|
+
// eslint-disable-next-line no-undef
|
1273
|
+
self instanceof WorkerGlobalScope &&
|
1274
|
+
typeof self.importScripts === 'function'
|
1275
|
+
);
|
1276
|
+
})();
|
1277
|
+
|
1278
|
+
var utils = /*#__PURE__*/Object.freeze({
|
1279
|
+
__proto__: null,
|
1280
|
+
hasBrowserEnv: hasBrowserEnv,
|
1281
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
1282
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
|
1283
|
+
});
|
1284
|
+
|
1285
|
+
var platform = {
|
1286
|
+
...utils,
|
1287
|
+
...platform$1
|
1288
|
+
};
|
1289
|
+
|
1290
|
+
function toURLEncodedForm(data, options) {
|
1291
|
+
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
1292
|
+
visitor: function(value, key, path, helpers) {
|
1293
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
1294
|
+
this.append(key, value.toString('base64'));
|
1295
|
+
return false;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
1299
|
+
}
|
1300
|
+
}, options));
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
/**
|
1304
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
1305
|
+
*
|
1306
|
+
* @param {string} name - The name of the property to get.
|
1307
|
+
*
|
1308
|
+
* @returns An array of strings.
|
1309
|
+
*/
|
1310
|
+
function parsePropPath(name) {
|
1311
|
+
// foo[x][y][z]
|
1312
|
+
// foo.x.y.z
|
1313
|
+
// foo-x-y-z
|
1314
|
+
// foo x y z
|
1315
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
1316
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
1317
|
+
});
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
/**
|
1321
|
+
* Convert an array to an object.
|
1322
|
+
*
|
1323
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
1324
|
+
*
|
1325
|
+
* @returns An object with the same keys and values as the array.
|
1326
|
+
*/
|
1327
|
+
function arrayToObject(arr) {
|
1328
|
+
const obj = {};
|
1329
|
+
const keys = Object.keys(arr);
|
1330
|
+
let i;
|
1331
|
+
const len = keys.length;
|
1332
|
+
let key;
|
1333
|
+
for (i = 0; i < len; i++) {
|
1334
|
+
key = keys[i];
|
1335
|
+
obj[key] = arr[key];
|
1336
|
+
}
|
1337
|
+
return obj;
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
/**
|
1341
|
+
* It takes a FormData object and returns a JavaScript object
|
1342
|
+
*
|
1343
|
+
* @param {string} formData The FormData object to convert to JSON.
|
1344
|
+
*
|
1345
|
+
* @returns {Object<string, any> | null} The converted object.
|
1346
|
+
*/
|
1347
|
+
function formDataToJSON(formData) {
|
1348
|
+
function buildPath(path, value, target, index) {
|
1349
|
+
let name = path[index++];
|
1350
|
+
|
1351
|
+
if (name === '__proto__') return true;
|
1352
|
+
|
1353
|
+
const isNumericKey = Number.isFinite(+name);
|
1354
|
+
const isLast = index >= path.length;
|
1355
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
1356
|
+
|
1357
|
+
if (isLast) {
|
1358
|
+
if (utils$1.hasOwnProp(target, name)) {
|
1359
|
+
target[name] = [target[name], value];
|
1360
|
+
} else {
|
1361
|
+
target[name] = value;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
return !isNumericKey;
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
1368
|
+
target[name] = [];
|
1369
|
+
}
|
1370
|
+
|
1371
|
+
const result = buildPath(path, value, target[name], index);
|
1372
|
+
|
1373
|
+
if (result && utils$1.isArray(target[name])) {
|
1374
|
+
target[name] = arrayToObject(target[name]);
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
return !isNumericKey;
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
1381
|
+
const obj = {};
|
1382
|
+
|
1383
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
1384
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
1385
|
+
});
|
1386
|
+
|
1387
|
+
return obj;
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
return null;
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
/**
|
1394
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
1395
|
+
* of the input
|
1396
|
+
*
|
1397
|
+
* @param {any} rawValue - The value to be stringified.
|
1398
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
1399
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
1400
|
+
*
|
1401
|
+
* @returns {string} A stringified version of the rawValue.
|
1402
|
+
*/
|
1403
|
+
function stringifySafely(rawValue, parser, encoder) {
|
1404
|
+
if (utils$1.isString(rawValue)) {
|
1405
|
+
try {
|
1406
|
+
(parser || JSON.parse)(rawValue);
|
1407
|
+
return utils$1.trim(rawValue);
|
1408
|
+
} catch (e) {
|
1409
|
+
if (e.name !== 'SyntaxError') {
|
1410
|
+
throw e;
|
1411
|
+
}
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
|
1415
|
+
return (encoder || JSON.stringify)(rawValue);
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
const defaults = {
|
1419
|
+
|
1420
|
+
transitional: transitionalDefaults,
|
1421
|
+
|
1422
|
+
adapter: ['xhr', 'http'],
|
1423
|
+
|
1424
|
+
transformRequest: [function transformRequest(data, headers) {
|
1425
|
+
const contentType = headers.getContentType() || '';
|
1426
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
1427
|
+
const isObjectPayload = utils$1.isObject(data);
|
1428
|
+
|
1429
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
1430
|
+
data = new FormData(data);
|
1431
|
+
}
|
1432
|
+
|
1433
|
+
const isFormData = utils$1.isFormData(data);
|
1434
|
+
|
1435
|
+
if (isFormData) {
|
1436
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
if (utils$1.isArrayBuffer(data) ||
|
1440
|
+
utils$1.isBuffer(data) ||
|
1441
|
+
utils$1.isStream(data) ||
|
1442
|
+
utils$1.isFile(data) ||
|
1443
|
+
utils$1.isBlob(data)
|
1444
|
+
) {
|
1445
|
+
return data;
|
1446
|
+
}
|
1447
|
+
if (utils$1.isArrayBufferView(data)) {
|
1448
|
+
return data.buffer;
|
1449
|
+
}
|
1450
|
+
if (utils$1.isURLSearchParams(data)) {
|
1451
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
1452
|
+
return data.toString();
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
let isFileList;
|
1456
|
+
|
1457
|
+
if (isObjectPayload) {
|
1458
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
1459
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
1463
|
+
const _FormData = this.env && this.env.FormData;
|
1464
|
+
|
1465
|
+
return toFormData(
|
1466
|
+
isFileList ? {'files[]': data} : data,
|
1467
|
+
_FormData && new _FormData(),
|
1468
|
+
this.formSerializer
|
1469
|
+
);
|
1470
|
+
}
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
if (isObjectPayload || hasJSONContentType ) {
|
1474
|
+
headers.setContentType('application/json', false);
|
1475
|
+
return stringifySafely(data);
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
return data;
|
1479
|
+
}],
|
1480
|
+
|
1481
|
+
transformResponse: [function transformResponse(data) {
|
1482
|
+
const transitional = this.transitional || defaults.transitional;
|
1483
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1484
|
+
const JSONRequested = this.responseType === 'json';
|
1485
|
+
|
1486
|
+
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
1487
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
1488
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
1489
|
+
|
1490
|
+
try {
|
1491
|
+
return JSON.parse(data);
|
1492
|
+
} catch (e) {
|
1493
|
+
if (strictJSONParsing) {
|
1494
|
+
if (e.name === 'SyntaxError') {
|
1495
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
1496
|
+
}
|
1497
|
+
throw e;
|
1498
|
+
}
|
1499
|
+
}
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
return data;
|
1503
|
+
}],
|
1504
|
+
|
1505
|
+
/**
|
1506
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
1507
|
+
* timeout is not created.
|
1508
|
+
*/
|
1509
|
+
timeout: 0,
|
1510
|
+
|
1511
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
1512
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
1513
|
+
|
1514
|
+
maxContentLength: -1,
|
1515
|
+
maxBodyLength: -1,
|
1516
|
+
|
1517
|
+
env: {
|
1518
|
+
FormData: platform.classes.FormData,
|
1519
|
+
Blob: platform.classes.Blob
|
1520
|
+
},
|
1521
|
+
|
1522
|
+
validateStatus: function validateStatus(status) {
|
1523
|
+
return status >= 200 && status < 300;
|
1524
|
+
},
|
1525
|
+
|
1526
|
+
headers: {
|
1527
|
+
common: {
|
1528
|
+
'Accept': 'application/json, text/plain, */*',
|
1529
|
+
'Content-Type': undefined
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
};
|
1533
|
+
|
1534
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
1535
|
+
defaults.headers[method] = {};
|
1536
|
+
});
|
1537
|
+
|
1538
|
+
var defaults$1 = defaults;
|
1539
|
+
|
1540
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
1541
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
1542
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
1543
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
1544
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
1545
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
1546
|
+
'referer', 'retry-after', 'user-agent'
|
1547
|
+
]);
|
1548
|
+
|
1549
|
+
/**
|
1550
|
+
* Parse headers into an object
|
1551
|
+
*
|
1552
|
+
* ```
|
1553
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
1554
|
+
* Content-Type: application/json
|
1555
|
+
* Connection: keep-alive
|
1556
|
+
* Transfer-Encoding: chunked
|
1557
|
+
* ```
|
1558
|
+
*
|
1559
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
1560
|
+
*
|
1561
|
+
* @returns {Object} Headers parsed into an object
|
1562
|
+
*/
|
1563
|
+
var parseHeaders = rawHeaders => {
|
1564
|
+
const parsed = {};
|
1565
|
+
let key;
|
1566
|
+
let val;
|
1567
|
+
let i;
|
1568
|
+
|
1569
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
1570
|
+
i = line.indexOf(':');
|
1571
|
+
key = line.substring(0, i).trim().toLowerCase();
|
1572
|
+
val = line.substring(i + 1).trim();
|
1573
|
+
|
1574
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
1575
|
+
return;
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
if (key === 'set-cookie') {
|
1579
|
+
if (parsed[key]) {
|
1580
|
+
parsed[key].push(val);
|
1581
|
+
} else {
|
1582
|
+
parsed[key] = [val];
|
1583
|
+
}
|
1584
|
+
} else {
|
1585
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
1586
|
+
}
|
1587
|
+
});
|
1588
|
+
|
1589
|
+
return parsed;
|
1590
|
+
};
|
1591
|
+
|
1592
|
+
const $internals = Symbol('internals');
|
1593
|
+
|
1594
|
+
function normalizeHeader(header) {
|
1595
|
+
return header && String(header).trim().toLowerCase();
|
1596
|
+
}
|
1597
|
+
|
1598
|
+
function normalizeValue(value) {
|
1599
|
+
if (value === false || value == null) {
|
1600
|
+
return value;
|
1601
|
+
}
|
1602
|
+
|
1603
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
function parseTokens(str) {
|
1607
|
+
const tokens = Object.create(null);
|
1608
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
1609
|
+
let match;
|
1610
|
+
|
1611
|
+
while ((match = tokensRE.exec(str))) {
|
1612
|
+
tokens[match[1]] = match[2];
|
1613
|
+
}
|
1614
|
+
|
1615
|
+
return tokens;
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
1619
|
+
|
1620
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
1621
|
+
if (utils$1.isFunction(filter)) {
|
1622
|
+
return filter.call(this, value, header);
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
if (isHeaderNameFilter) {
|
1626
|
+
value = header;
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
if (!utils$1.isString(value)) return;
|
1630
|
+
|
1631
|
+
if (utils$1.isString(filter)) {
|
1632
|
+
return value.indexOf(filter) !== -1;
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
if (utils$1.isRegExp(filter)) {
|
1636
|
+
return filter.test(value);
|
1637
|
+
}
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
function formatHeader(header) {
|
1641
|
+
return header.trim()
|
1642
|
+
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
1643
|
+
return char.toUpperCase() + str;
|
1644
|
+
});
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
function buildAccessors(obj, header) {
|
1648
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
1649
|
+
|
1650
|
+
['get', 'set', 'has'].forEach(methodName => {
|
1651
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
1652
|
+
value: function(arg1, arg2, arg3) {
|
1653
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
1654
|
+
},
|
1655
|
+
configurable: true
|
1656
|
+
});
|
1657
|
+
});
|
1658
|
+
}
|
1659
|
+
|
1660
|
+
class AxiosHeaders {
|
1661
|
+
constructor(headers) {
|
1662
|
+
headers && this.set(headers);
|
1663
|
+
}
|
1664
|
+
|
1665
|
+
set(header, valueOrRewrite, rewrite) {
|
1666
|
+
const self = this;
|
1667
|
+
|
1668
|
+
function setHeader(_value, _header, _rewrite) {
|
1669
|
+
const lHeader = normalizeHeader(_header);
|
1670
|
+
|
1671
|
+
if (!lHeader) {
|
1672
|
+
throw new Error('header name must be a non-empty string');
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
const key = utils$1.findKey(self, lHeader);
|
1676
|
+
|
1677
|
+
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
1678
|
+
self[key || _header] = normalizeValue(_value);
|
1679
|
+
}
|
1680
|
+
}
|
1681
|
+
|
1682
|
+
const setHeaders = (headers, _rewrite) =>
|
1683
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
1684
|
+
|
1685
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
1686
|
+
setHeaders(header, valueOrRewrite);
|
1687
|
+
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
1688
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
1689
|
+
} else {
|
1690
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
return this;
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
get(header, parser) {
|
1697
|
+
header = normalizeHeader(header);
|
1698
|
+
|
1699
|
+
if (header) {
|
1700
|
+
const key = utils$1.findKey(this, header);
|
1701
|
+
|
1702
|
+
if (key) {
|
1703
|
+
const value = this[key];
|
1704
|
+
|
1705
|
+
if (!parser) {
|
1706
|
+
return value;
|
1707
|
+
}
|
1708
|
+
|
1709
|
+
if (parser === true) {
|
1710
|
+
return parseTokens(value);
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
if (utils$1.isFunction(parser)) {
|
1714
|
+
return parser.call(this, value, key);
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
if (utils$1.isRegExp(parser)) {
|
1718
|
+
return parser.exec(value);
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
has(header, matcher) {
|
1727
|
+
header = normalizeHeader(header);
|
1728
|
+
|
1729
|
+
if (header) {
|
1730
|
+
const key = utils$1.findKey(this, header);
|
1731
|
+
|
1732
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
return false;
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
delete(header, matcher) {
|
1739
|
+
const self = this;
|
1740
|
+
let deleted = false;
|
1741
|
+
|
1742
|
+
function deleteHeader(_header) {
|
1743
|
+
_header = normalizeHeader(_header);
|
1744
|
+
|
1745
|
+
if (_header) {
|
1746
|
+
const key = utils$1.findKey(self, _header);
|
1747
|
+
|
1748
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
1749
|
+
delete self[key];
|
1750
|
+
|
1751
|
+
deleted = true;
|
1752
|
+
}
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
if (utils$1.isArray(header)) {
|
1757
|
+
header.forEach(deleteHeader);
|
1758
|
+
} else {
|
1759
|
+
deleteHeader(header);
|
1760
|
+
}
|
1761
|
+
|
1762
|
+
return deleted;
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
clear(matcher) {
|
1766
|
+
const keys = Object.keys(this);
|
1767
|
+
let i = keys.length;
|
1768
|
+
let deleted = false;
|
1769
|
+
|
1770
|
+
while (i--) {
|
1771
|
+
const key = keys[i];
|
1772
|
+
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
1773
|
+
delete this[key];
|
1774
|
+
deleted = true;
|
1775
|
+
}
|
1776
|
+
}
|
1777
|
+
|
1778
|
+
return deleted;
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
normalize(format) {
|
1782
|
+
const self = this;
|
1783
|
+
const headers = {};
|
1784
|
+
|
1785
|
+
utils$1.forEach(this, (value, header) => {
|
1786
|
+
const key = utils$1.findKey(headers, header);
|
1787
|
+
|
1788
|
+
if (key) {
|
1789
|
+
self[key] = normalizeValue(value);
|
1790
|
+
delete self[header];
|
1791
|
+
return;
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
1795
|
+
|
1796
|
+
if (normalized !== header) {
|
1797
|
+
delete self[header];
|
1798
|
+
}
|
1799
|
+
|
1800
|
+
self[normalized] = normalizeValue(value);
|
1801
|
+
|
1802
|
+
headers[normalized] = true;
|
1803
|
+
});
|
1804
|
+
|
1805
|
+
return this;
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
concat(...targets) {
|
1809
|
+
return this.constructor.concat(this, ...targets);
|
1810
|
+
}
|
1811
|
+
|
1812
|
+
toJSON(asStrings) {
|
1813
|
+
const obj = Object.create(null);
|
1814
|
+
|
1815
|
+
utils$1.forEach(this, (value, header) => {
|
1816
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
1817
|
+
});
|
1818
|
+
|
1819
|
+
return obj;
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
[Symbol.iterator]() {
|
1823
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
1824
|
+
}
|
1825
|
+
|
1826
|
+
toString() {
|
1827
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
get [Symbol.toStringTag]() {
|
1831
|
+
return 'AxiosHeaders';
|
1832
|
+
}
|
1833
|
+
|
1834
|
+
static from(thing) {
|
1835
|
+
return thing instanceof this ? thing : new this(thing);
|
1836
|
+
}
|
1837
|
+
|
1838
|
+
static concat(first, ...targets) {
|
1839
|
+
const computed = new this(first);
|
1840
|
+
|
1841
|
+
targets.forEach((target) => computed.set(target));
|
1842
|
+
|
1843
|
+
return computed;
|
1844
|
+
}
|
1845
|
+
|
1846
|
+
static accessor(header) {
|
1847
|
+
const internals = this[$internals] = (this[$internals] = {
|
1848
|
+
accessors: {}
|
1849
|
+
});
|
1850
|
+
|
1851
|
+
const accessors = internals.accessors;
|
1852
|
+
const prototype = this.prototype;
|
1853
|
+
|
1854
|
+
function defineAccessor(_header) {
|
1855
|
+
const lHeader = normalizeHeader(_header);
|
1856
|
+
|
1857
|
+
if (!accessors[lHeader]) {
|
1858
|
+
buildAccessors(prototype, _header);
|
1859
|
+
accessors[lHeader] = true;
|
1860
|
+
}
|
1861
|
+
}
|
1862
|
+
|
1863
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
1864
|
+
|
1865
|
+
return this;
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
|
1869
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
1870
|
+
|
1871
|
+
// reserved names hotfix
|
1872
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
1873
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
1874
|
+
return {
|
1875
|
+
get: () => value,
|
1876
|
+
set(headerValue) {
|
1877
|
+
this[mapped] = headerValue;
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
});
|
1881
|
+
|
1882
|
+
utils$1.freezeMethods(AxiosHeaders);
|
1883
|
+
|
1884
|
+
var AxiosHeaders$1 = AxiosHeaders;
|
1885
|
+
|
1886
|
+
/**
|
1887
|
+
* Transform the data for a request or a response
|
1888
|
+
*
|
1889
|
+
* @param {Array|Function} fns A single function or Array of functions
|
1890
|
+
* @param {?Object} response The response object
|
1891
|
+
*
|
1892
|
+
* @returns {*} The resulting transformed data
|
1893
|
+
*/
|
1894
|
+
function transformData(fns, response) {
|
1895
|
+
const config = this || defaults$1;
|
1896
|
+
const context = response || config;
|
1897
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
1898
|
+
let data = context.data;
|
1899
|
+
|
1900
|
+
utils$1.forEach(fns, function transform(fn) {
|
1901
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
1902
|
+
});
|
1903
|
+
|
1904
|
+
headers.normalize();
|
1905
|
+
|
1906
|
+
return data;
|
1907
|
+
}
|
1908
|
+
|
1909
|
+
function isCancel(value) {
|
1910
|
+
return !!(value && value.__CANCEL__);
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
/**
|
1914
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
1915
|
+
*
|
1916
|
+
* @param {string=} message The message.
|
1917
|
+
* @param {Object=} config The config.
|
1918
|
+
* @param {Object=} request The request.
|
1919
|
+
*
|
1920
|
+
* @returns {CanceledError} The created error.
|
1921
|
+
*/
|
1922
|
+
function CanceledError(message, config, request) {
|
1923
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
1924
|
+
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
1925
|
+
this.name = 'CanceledError';
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
1929
|
+
__CANCEL__: true
|
1930
|
+
});
|
1931
|
+
|
1932
|
+
/**
|
1933
|
+
* Resolve or reject a Promise based on response status.
|
1934
|
+
*
|
1935
|
+
* @param {Function} resolve A function that resolves the promise.
|
1936
|
+
* @param {Function} reject A function that rejects the promise.
|
1937
|
+
* @param {object} response The response.
|
1938
|
+
*
|
1939
|
+
* @returns {object} The response.
|
1940
|
+
*/
|
1941
|
+
function settle(resolve, reject, response) {
|
1942
|
+
const validateStatus = response.config.validateStatus;
|
1943
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1944
|
+
resolve(response);
|
1945
|
+
} else {
|
1946
|
+
reject(new AxiosError(
|
1947
|
+
'Request failed with status code ' + response.status,
|
1948
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
1949
|
+
response.config,
|
1950
|
+
response.request,
|
1951
|
+
response
|
1952
|
+
));
|
1953
|
+
}
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
var cookies = platform.hasStandardBrowserEnv ?
|
1957
|
+
|
1958
|
+
// Standard browser envs support document.cookie
|
1959
|
+
{
|
1960
|
+
write(name, value, expires, path, domain, secure) {
|
1961
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
1962
|
+
|
1963
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
1964
|
+
|
1965
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
1966
|
+
|
1967
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
1968
|
+
|
1969
|
+
secure === true && cookie.push('secure');
|
1970
|
+
|
1971
|
+
document.cookie = cookie.join('; ');
|
1972
|
+
},
|
1973
|
+
|
1974
|
+
read(name) {
|
1975
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1976
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1977
|
+
},
|
1978
|
+
|
1979
|
+
remove(name) {
|
1980
|
+
this.write(name, '', Date.now() - 86400000);
|
1981
|
+
}
|
1982
|
+
}
|
1983
|
+
|
1984
|
+
:
|
1985
|
+
|
1986
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
1987
|
+
{
|
1988
|
+
write() {},
|
1989
|
+
read() {
|
1990
|
+
return null;
|
1991
|
+
},
|
1992
|
+
remove() {}
|
1993
|
+
};
|
1994
|
+
|
1995
|
+
/**
|
1996
|
+
* Determines whether the specified URL is absolute
|
1997
|
+
*
|
1998
|
+
* @param {string} url The URL to test
|
1999
|
+
*
|
2000
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
2001
|
+
*/
|
2002
|
+
function isAbsoluteURL(url) {
|
2003
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
2004
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
2005
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
2006
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
/**
|
2010
|
+
* Creates a new URL by combining the specified URLs
|
2011
|
+
*
|
2012
|
+
* @param {string} baseURL The base URL
|
2013
|
+
* @param {string} relativeURL The relative URL
|
2014
|
+
*
|
2015
|
+
* @returns {string} The combined URL
|
2016
|
+
*/
|
2017
|
+
function combineURLs(baseURL, relativeURL) {
|
2018
|
+
return relativeURL
|
2019
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
2020
|
+
: baseURL;
|
2021
|
+
}
|
2022
|
+
|
2023
|
+
/**
|
2024
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
2025
|
+
* only when the requestedURL is not already an absolute URL.
|
2026
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
2027
|
+
*
|
2028
|
+
* @param {string} baseURL The base URL
|
2029
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
2030
|
+
*
|
2031
|
+
* @returns {string} The combined full path
|
2032
|
+
*/
|
2033
|
+
function buildFullPath(baseURL, requestedURL) {
|
2034
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
2035
|
+
return combineURLs(baseURL, requestedURL);
|
2036
|
+
}
|
2037
|
+
return requestedURL;
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
2041
|
+
|
2042
|
+
// Standard browser envs have full support of the APIs needed to test
|
2043
|
+
// whether the request URL is of the same origin as current location.
|
2044
|
+
(function standardBrowserEnv() {
|
2045
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
2046
|
+
const urlParsingNode = document.createElement('a');
|
2047
|
+
let originURL;
|
2048
|
+
|
2049
|
+
/**
|
2050
|
+
* Parse a URL to discover its components
|
2051
|
+
*
|
2052
|
+
* @param {String} url The URL to be parsed
|
2053
|
+
* @returns {Object}
|
2054
|
+
*/
|
2055
|
+
function resolveURL(url) {
|
2056
|
+
let href = url;
|
2057
|
+
|
2058
|
+
if (msie) {
|
2059
|
+
// IE needs attribute set twice to normalize properties
|
2060
|
+
urlParsingNode.setAttribute('href', href);
|
2061
|
+
href = urlParsingNode.href;
|
2062
|
+
}
|
2063
|
+
|
2064
|
+
urlParsingNode.setAttribute('href', href);
|
2065
|
+
|
2066
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
2067
|
+
return {
|
2068
|
+
href: urlParsingNode.href,
|
2069
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
2070
|
+
host: urlParsingNode.host,
|
2071
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
2072
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
2073
|
+
hostname: urlParsingNode.hostname,
|
2074
|
+
port: urlParsingNode.port,
|
2075
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
2076
|
+
urlParsingNode.pathname :
|
2077
|
+
'/' + urlParsingNode.pathname
|
2078
|
+
};
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
originURL = resolveURL(window.location.href);
|
2082
|
+
|
2083
|
+
/**
|
2084
|
+
* Determine if a URL shares the same origin as the current location
|
2085
|
+
*
|
2086
|
+
* @param {String} requestURL The URL to test
|
2087
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
2088
|
+
*/
|
2089
|
+
return function isURLSameOrigin(requestURL) {
|
2090
|
+
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
2091
|
+
return (parsed.protocol === originURL.protocol &&
|
2092
|
+
parsed.host === originURL.host);
|
2093
|
+
};
|
2094
|
+
})() :
|
2095
|
+
|
2096
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
2097
|
+
(function nonStandardBrowserEnv() {
|
2098
|
+
return function isURLSameOrigin() {
|
2099
|
+
return true;
|
2100
|
+
};
|
2101
|
+
})();
|
2102
|
+
|
2103
|
+
function parseProtocol(url) {
|
2104
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
2105
|
+
return match && match[1] || '';
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
/**
|
2109
|
+
* Calculate data maxRate
|
2110
|
+
* @param {Number} [samplesCount= 10]
|
2111
|
+
* @param {Number} [min= 1000]
|
2112
|
+
* @returns {Function}
|
2113
|
+
*/
|
2114
|
+
function speedometer(samplesCount, min) {
|
2115
|
+
samplesCount = samplesCount || 10;
|
2116
|
+
const bytes = new Array(samplesCount);
|
2117
|
+
const timestamps = new Array(samplesCount);
|
2118
|
+
let head = 0;
|
2119
|
+
let tail = 0;
|
2120
|
+
let firstSampleTS;
|
2121
|
+
|
2122
|
+
min = min !== undefined ? min : 1000;
|
2123
|
+
|
2124
|
+
return function push(chunkLength) {
|
2125
|
+
const now = Date.now();
|
2126
|
+
|
2127
|
+
const startedAt = timestamps[tail];
|
2128
|
+
|
2129
|
+
if (!firstSampleTS) {
|
2130
|
+
firstSampleTS = now;
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
bytes[head] = chunkLength;
|
2134
|
+
timestamps[head] = now;
|
2135
|
+
|
2136
|
+
let i = tail;
|
2137
|
+
let bytesCount = 0;
|
2138
|
+
|
2139
|
+
while (i !== head) {
|
2140
|
+
bytesCount += bytes[i++];
|
2141
|
+
i = i % samplesCount;
|
2142
|
+
}
|
2143
|
+
|
2144
|
+
head = (head + 1) % samplesCount;
|
2145
|
+
|
2146
|
+
if (head === tail) {
|
2147
|
+
tail = (tail + 1) % samplesCount;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
if (now - firstSampleTS < min) {
|
2151
|
+
return;
|
2152
|
+
}
|
2153
|
+
|
2154
|
+
const passed = startedAt && now - startedAt;
|
2155
|
+
|
2156
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
2157
|
+
};
|
2158
|
+
}
|
2159
|
+
|
2160
|
+
function progressEventReducer(listener, isDownloadStream) {
|
2161
|
+
let bytesNotified = 0;
|
2162
|
+
const _speedometer = speedometer(50, 250);
|
2163
|
+
|
2164
|
+
return e => {
|
2165
|
+
const loaded = e.loaded;
|
2166
|
+
const total = e.lengthComputable ? e.total : undefined;
|
2167
|
+
const progressBytes = loaded - bytesNotified;
|
2168
|
+
const rate = _speedometer(progressBytes);
|
2169
|
+
const inRange = loaded <= total;
|
2170
|
+
|
2171
|
+
bytesNotified = loaded;
|
2172
|
+
|
2173
|
+
const data = {
|
2174
|
+
loaded,
|
2175
|
+
total,
|
2176
|
+
progress: total ? (loaded / total) : undefined,
|
2177
|
+
bytes: progressBytes,
|
2178
|
+
rate: rate ? rate : undefined,
|
2179
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
2180
|
+
event: e
|
2181
|
+
};
|
2182
|
+
|
2183
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
2184
|
+
|
2185
|
+
listener(data);
|
2186
|
+
};
|
2187
|
+
}
|
2188
|
+
|
2189
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
2190
|
+
|
2191
|
+
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
2192
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
2193
|
+
let requestData = config.data;
|
2194
|
+
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
2195
|
+
let {responseType, withXSRFToken} = config;
|
2196
|
+
let onCanceled;
|
2197
|
+
function done() {
|
2198
|
+
if (config.cancelToken) {
|
2199
|
+
config.cancelToken.unsubscribe(onCanceled);
|
2200
|
+
}
|
2201
|
+
|
2202
|
+
if (config.signal) {
|
2203
|
+
config.signal.removeEventListener('abort', onCanceled);
|
2204
|
+
}
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
let contentType;
|
2208
|
+
|
2209
|
+
if (utils$1.isFormData(requestData)) {
|
2210
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
2211
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
2212
|
+
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
2213
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
2214
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
2215
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
|
2219
|
+
let request = new XMLHttpRequest();
|
2220
|
+
|
2221
|
+
// HTTP basic authentication
|
2222
|
+
if (config.auth) {
|
2223
|
+
const username = config.auth.username || '';
|
2224
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
2225
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
2226
|
+
}
|
2227
|
+
|
2228
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
2229
|
+
|
2230
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
2231
|
+
|
2232
|
+
// Set the request timeout in MS
|
2233
|
+
request.timeout = config.timeout;
|
2234
|
+
|
2235
|
+
function onloadend() {
|
2236
|
+
if (!request) {
|
2237
|
+
return;
|
2238
|
+
}
|
2239
|
+
// Prepare the response
|
2240
|
+
const responseHeaders = AxiosHeaders$1.from(
|
2241
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
2242
|
+
);
|
2243
|
+
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
2244
|
+
request.responseText : request.response;
|
2245
|
+
const response = {
|
2246
|
+
data: responseData,
|
2247
|
+
status: request.status,
|
2248
|
+
statusText: request.statusText,
|
2249
|
+
headers: responseHeaders,
|
2250
|
+
config,
|
2251
|
+
request
|
2252
|
+
};
|
2253
|
+
|
2254
|
+
settle(function _resolve(value) {
|
2255
|
+
resolve(value);
|
2256
|
+
done();
|
2257
|
+
}, function _reject(err) {
|
2258
|
+
reject(err);
|
2259
|
+
done();
|
2260
|
+
}, response);
|
2261
|
+
|
2262
|
+
// Clean up request
|
2263
|
+
request = null;
|
2264
|
+
}
|
2265
|
+
|
2266
|
+
if ('onloadend' in request) {
|
2267
|
+
// Use onloadend if available
|
2268
|
+
request.onloadend = onloadend;
|
2269
|
+
} else {
|
2270
|
+
// Listen for ready state to emulate onloadend
|
2271
|
+
request.onreadystatechange = function handleLoad() {
|
2272
|
+
if (!request || request.readyState !== 4) {
|
2273
|
+
return;
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
// The request errored out and we didn't get a response, this will be
|
2277
|
+
// handled by onerror instead
|
2278
|
+
// With one exception: request that using file: protocol, most browsers
|
2279
|
+
// will return status as 0 even though it's a successful request
|
2280
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
2281
|
+
return;
|
2282
|
+
}
|
2283
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
2284
|
+
// so we should call onloadend on the next 'tick'
|
2285
|
+
setTimeout(onloadend);
|
2286
|
+
};
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
2290
|
+
request.onabort = function handleAbort() {
|
2291
|
+
if (!request) {
|
2292
|
+
return;
|
2293
|
+
}
|
2294
|
+
|
2295
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
2296
|
+
|
2297
|
+
// Clean up request
|
2298
|
+
request = null;
|
2299
|
+
};
|
2300
|
+
|
2301
|
+
// Handle low level network errors
|
2302
|
+
request.onerror = function handleError() {
|
2303
|
+
// Real errors are hidden from us by the browser
|
2304
|
+
// onerror should only fire if it's a network error
|
2305
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
2306
|
+
|
2307
|
+
// Clean up request
|
2308
|
+
request = null;
|
2309
|
+
};
|
2310
|
+
|
2311
|
+
// Handle timeout
|
2312
|
+
request.ontimeout = function handleTimeout() {
|
2313
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
2314
|
+
const transitional = config.transitional || transitionalDefaults;
|
2315
|
+
if (config.timeoutErrorMessage) {
|
2316
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
2317
|
+
}
|
2318
|
+
reject(new AxiosError(
|
2319
|
+
timeoutErrorMessage,
|
2320
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
2321
|
+
config,
|
2322
|
+
request));
|
2323
|
+
|
2324
|
+
// Clean up request
|
2325
|
+
request = null;
|
2326
|
+
};
|
2327
|
+
|
2328
|
+
// Add xsrf header
|
2329
|
+
// This is only done if running in a standard browser environment.
|
2330
|
+
// Specifically not if we're in a web worker, or react-native.
|
2331
|
+
if(platform.hasStandardBrowserEnv) {
|
2332
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
2333
|
+
|
2334
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
2335
|
+
// Add xsrf header
|
2336
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
2337
|
+
|
2338
|
+
if (xsrfValue) {
|
2339
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
2340
|
+
}
|
2341
|
+
}
|
2342
|
+
}
|
2343
|
+
|
2344
|
+
// Remove Content-Type if data is undefined
|
2345
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
2346
|
+
|
2347
|
+
// Add headers to the request
|
2348
|
+
if ('setRequestHeader' in request) {
|
2349
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
2350
|
+
request.setRequestHeader(key, val);
|
2351
|
+
});
|
2352
|
+
}
|
2353
|
+
|
2354
|
+
// Add withCredentials to request if needed
|
2355
|
+
if (!utils$1.isUndefined(config.withCredentials)) {
|
2356
|
+
request.withCredentials = !!config.withCredentials;
|
2357
|
+
}
|
2358
|
+
|
2359
|
+
// Add responseType to request if needed
|
2360
|
+
if (responseType && responseType !== 'json') {
|
2361
|
+
request.responseType = config.responseType;
|
2362
|
+
}
|
2363
|
+
|
2364
|
+
// Handle progress if needed
|
2365
|
+
if (typeof config.onDownloadProgress === 'function') {
|
2366
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
2367
|
+
}
|
2368
|
+
|
2369
|
+
// Not all browsers support upload events
|
2370
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
2371
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
2372
|
+
}
|
2373
|
+
|
2374
|
+
if (config.cancelToken || config.signal) {
|
2375
|
+
// Handle cancellation
|
2376
|
+
// eslint-disable-next-line func-names
|
2377
|
+
onCanceled = cancel => {
|
2378
|
+
if (!request) {
|
2379
|
+
return;
|
2380
|
+
}
|
2381
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
2382
|
+
request.abort();
|
2383
|
+
request = null;
|
2384
|
+
};
|
2385
|
+
|
2386
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
2387
|
+
if (config.signal) {
|
2388
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
2389
|
+
}
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
const protocol = parseProtocol(fullPath);
|
2393
|
+
|
2394
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
2395
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
2396
|
+
return;
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
|
2400
|
+
// Send the request
|
2401
|
+
request.send(requestData || null);
|
2402
|
+
});
|
2403
|
+
};
|
2404
|
+
|
2405
|
+
const knownAdapters = {
|
2406
|
+
http: httpAdapter,
|
2407
|
+
xhr: xhrAdapter
|
2408
|
+
};
|
2409
|
+
|
2410
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
2411
|
+
if (fn) {
|
2412
|
+
try {
|
2413
|
+
Object.defineProperty(fn, 'name', {value});
|
2414
|
+
} catch (e) {
|
2415
|
+
// eslint-disable-next-line no-empty
|
2416
|
+
}
|
2417
|
+
Object.defineProperty(fn, 'adapterName', {value});
|
2418
|
+
}
|
2419
|
+
});
|
2420
|
+
|
2421
|
+
const renderReason = (reason) => `- ${reason}`;
|
2422
|
+
|
2423
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
2424
|
+
|
2425
|
+
var adapters = {
|
2426
|
+
getAdapter: (adapters) => {
|
2427
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
2428
|
+
|
2429
|
+
const {length} = adapters;
|
2430
|
+
let nameOrAdapter;
|
2431
|
+
let adapter;
|
2432
|
+
|
2433
|
+
const rejectedReasons = {};
|
2434
|
+
|
2435
|
+
for (let i = 0; i < length; i++) {
|
2436
|
+
nameOrAdapter = adapters[i];
|
2437
|
+
let id;
|
2438
|
+
|
2439
|
+
adapter = nameOrAdapter;
|
2440
|
+
|
2441
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
2442
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
2443
|
+
|
2444
|
+
if (adapter === undefined) {
|
2445
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
2446
|
+
}
|
2447
|
+
}
|
2448
|
+
|
2449
|
+
if (adapter) {
|
2450
|
+
break;
|
2451
|
+
}
|
2452
|
+
|
2453
|
+
rejectedReasons[id || '#' + i] = adapter;
|
2454
|
+
}
|
2455
|
+
|
2456
|
+
if (!adapter) {
|
2457
|
+
|
2458
|
+
const reasons = Object.entries(rejectedReasons)
|
2459
|
+
.map(([id, state]) => `adapter ${id} ` +
|
2460
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
2461
|
+
);
|
2462
|
+
|
2463
|
+
let s = length ?
|
2464
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
2465
|
+
'as no adapter specified';
|
2466
|
+
|
2467
|
+
throw new AxiosError(
|
2468
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
2469
|
+
'ERR_NOT_SUPPORT'
|
2470
|
+
);
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
return adapter;
|
2474
|
+
},
|
2475
|
+
adapters: knownAdapters
|
2476
|
+
};
|
2477
|
+
|
2478
|
+
/**
|
2479
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
2480
|
+
*
|
2481
|
+
* @param {Object} config The config that is to be used for the request
|
2482
|
+
*
|
2483
|
+
* @returns {void}
|
2484
|
+
*/
|
2485
|
+
function throwIfCancellationRequested(config) {
|
2486
|
+
if (config.cancelToken) {
|
2487
|
+
config.cancelToken.throwIfRequested();
|
2488
|
+
}
|
2489
|
+
|
2490
|
+
if (config.signal && config.signal.aborted) {
|
2491
|
+
throw new CanceledError(null, config);
|
2492
|
+
}
|
2493
|
+
}
|
2494
|
+
|
2495
|
+
/**
|
2496
|
+
* Dispatch a request to the server using the configured adapter.
|
2497
|
+
*
|
2498
|
+
* @param {object} config The config that is to be used for the request
|
2499
|
+
*
|
2500
|
+
* @returns {Promise} The Promise to be fulfilled
|
2501
|
+
*/
|
2502
|
+
function dispatchRequest(config) {
|
2503
|
+
throwIfCancellationRequested(config);
|
2504
|
+
|
2505
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
2506
|
+
|
2507
|
+
// Transform request data
|
2508
|
+
config.data = transformData.call(
|
2509
|
+
config,
|
2510
|
+
config.transformRequest
|
2511
|
+
);
|
2512
|
+
|
2513
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
2514
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
2518
|
+
|
2519
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
2520
|
+
throwIfCancellationRequested(config);
|
2521
|
+
|
2522
|
+
// Transform response data
|
2523
|
+
response.data = transformData.call(
|
2524
|
+
config,
|
2525
|
+
config.transformResponse,
|
2526
|
+
response
|
2527
|
+
);
|
2528
|
+
|
2529
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
2530
|
+
|
2531
|
+
return response;
|
2532
|
+
}, function onAdapterRejection(reason) {
|
2533
|
+
if (!isCancel(reason)) {
|
2534
|
+
throwIfCancellationRequested(config);
|
2535
|
+
|
2536
|
+
// Transform response data
|
2537
|
+
if (reason && reason.response) {
|
2538
|
+
reason.response.data = transformData.call(
|
2539
|
+
config,
|
2540
|
+
config.transformResponse,
|
2541
|
+
reason.response
|
2542
|
+
);
|
2543
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
2544
|
+
}
|
2545
|
+
}
|
2546
|
+
|
2547
|
+
return Promise.reject(reason);
|
2548
|
+
});
|
2549
|
+
}
|
2550
|
+
|
2551
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
2552
|
+
|
2553
|
+
/**
|
2554
|
+
* Config-specific merge-function which creates a new config-object
|
2555
|
+
* by merging two configuration objects together.
|
2556
|
+
*
|
2557
|
+
* @param {Object} config1
|
2558
|
+
* @param {Object} config2
|
2559
|
+
*
|
2560
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
2561
|
+
*/
|
2562
|
+
function mergeConfig(config1, config2) {
|
2563
|
+
// eslint-disable-next-line no-param-reassign
|
2564
|
+
config2 = config2 || {};
|
2565
|
+
const config = {};
|
2566
|
+
|
2567
|
+
function getMergedValue(target, source, caseless) {
|
2568
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
2569
|
+
return utils$1.merge.call({caseless}, target, source);
|
2570
|
+
} else if (utils$1.isPlainObject(source)) {
|
2571
|
+
return utils$1.merge({}, source);
|
2572
|
+
} else if (utils$1.isArray(source)) {
|
2573
|
+
return source.slice();
|
2574
|
+
}
|
2575
|
+
return source;
|
2576
|
+
}
|
2577
|
+
|
2578
|
+
// eslint-disable-next-line consistent-return
|
2579
|
+
function mergeDeepProperties(a, b, caseless) {
|
2580
|
+
if (!utils$1.isUndefined(b)) {
|
2581
|
+
return getMergedValue(a, b, caseless);
|
2582
|
+
} else if (!utils$1.isUndefined(a)) {
|
2583
|
+
return getMergedValue(undefined, a, caseless);
|
2584
|
+
}
|
2585
|
+
}
|
2586
|
+
|
2587
|
+
// eslint-disable-next-line consistent-return
|
2588
|
+
function valueFromConfig2(a, b) {
|
2589
|
+
if (!utils$1.isUndefined(b)) {
|
2590
|
+
return getMergedValue(undefined, b);
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
|
2594
|
+
// eslint-disable-next-line consistent-return
|
2595
|
+
function defaultToConfig2(a, b) {
|
2596
|
+
if (!utils$1.isUndefined(b)) {
|
2597
|
+
return getMergedValue(undefined, b);
|
2598
|
+
} else if (!utils$1.isUndefined(a)) {
|
2599
|
+
return getMergedValue(undefined, a);
|
2600
|
+
}
|
2601
|
+
}
|
2602
|
+
|
2603
|
+
// eslint-disable-next-line consistent-return
|
2604
|
+
function mergeDirectKeys(a, b, prop) {
|
2605
|
+
if (prop in config2) {
|
2606
|
+
return getMergedValue(a, b);
|
2607
|
+
} else if (prop in config1) {
|
2608
|
+
return getMergedValue(undefined, a);
|
2609
|
+
}
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
const mergeMap = {
|
2613
|
+
url: valueFromConfig2,
|
2614
|
+
method: valueFromConfig2,
|
2615
|
+
data: valueFromConfig2,
|
2616
|
+
baseURL: defaultToConfig2,
|
2617
|
+
transformRequest: defaultToConfig2,
|
2618
|
+
transformResponse: defaultToConfig2,
|
2619
|
+
paramsSerializer: defaultToConfig2,
|
2620
|
+
timeout: defaultToConfig2,
|
2621
|
+
timeoutMessage: defaultToConfig2,
|
2622
|
+
withCredentials: defaultToConfig2,
|
2623
|
+
withXSRFToken: defaultToConfig2,
|
2624
|
+
adapter: defaultToConfig2,
|
2625
|
+
responseType: defaultToConfig2,
|
2626
|
+
xsrfCookieName: defaultToConfig2,
|
2627
|
+
xsrfHeaderName: defaultToConfig2,
|
2628
|
+
onUploadProgress: defaultToConfig2,
|
2629
|
+
onDownloadProgress: defaultToConfig2,
|
2630
|
+
decompress: defaultToConfig2,
|
2631
|
+
maxContentLength: defaultToConfig2,
|
2632
|
+
maxBodyLength: defaultToConfig2,
|
2633
|
+
beforeRedirect: defaultToConfig2,
|
2634
|
+
transport: defaultToConfig2,
|
2635
|
+
httpAgent: defaultToConfig2,
|
2636
|
+
httpsAgent: defaultToConfig2,
|
2637
|
+
cancelToken: defaultToConfig2,
|
2638
|
+
socketPath: defaultToConfig2,
|
2639
|
+
responseEncoding: defaultToConfig2,
|
2640
|
+
validateStatus: mergeDirectKeys,
|
2641
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
2642
|
+
};
|
2643
|
+
|
2644
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
2645
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
2646
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
2647
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
2648
|
+
});
|
2649
|
+
|
2650
|
+
return config;
|
2651
|
+
}
|
2652
|
+
|
2653
|
+
const VERSION = "1.6.7";
|
2654
|
+
|
2655
|
+
const validators$1 = {};
|
2656
|
+
|
2657
|
+
// eslint-disable-next-line func-names
|
2658
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
2659
|
+
validators$1[type] = function validator(thing) {
|
2660
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
2661
|
+
};
|
2662
|
+
});
|
2663
|
+
|
2664
|
+
const deprecatedWarnings = {};
|
2665
|
+
|
2666
|
+
/**
|
2667
|
+
* Transitional option validator
|
2668
|
+
*
|
2669
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
2670
|
+
* @param {string?} version - deprecated version / removed since version
|
2671
|
+
* @param {string?} message - some message with additional info
|
2672
|
+
*
|
2673
|
+
* @returns {function}
|
2674
|
+
*/
|
2675
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
2676
|
+
function formatMessage(opt, desc) {
|
2677
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
2678
|
+
}
|
2679
|
+
|
2680
|
+
// eslint-disable-next-line func-names
|
2681
|
+
return (value, opt, opts) => {
|
2682
|
+
if (validator === false) {
|
2683
|
+
throw new AxiosError(
|
2684
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
2685
|
+
AxiosError.ERR_DEPRECATED
|
2686
|
+
);
|
2687
|
+
}
|
2688
|
+
|
2689
|
+
if (version && !deprecatedWarnings[opt]) {
|
2690
|
+
deprecatedWarnings[opt] = true;
|
2691
|
+
// eslint-disable-next-line no-console
|
2692
|
+
console.warn(
|
2693
|
+
formatMessage(
|
2694
|
+
opt,
|
2695
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
2696
|
+
)
|
2697
|
+
);
|
2698
|
+
}
|
2699
|
+
|
2700
|
+
return validator ? validator(value, opt, opts) : true;
|
2701
|
+
};
|
2702
|
+
};
|
2703
|
+
|
2704
|
+
/**
|
2705
|
+
* Assert object's properties type
|
2706
|
+
*
|
2707
|
+
* @param {object} options
|
2708
|
+
* @param {object} schema
|
2709
|
+
* @param {boolean?} allowUnknown
|
2710
|
+
*
|
2711
|
+
* @returns {object}
|
2712
|
+
*/
|
2713
|
+
|
2714
|
+
function assertOptions(options, schema, allowUnknown) {
|
2715
|
+
if (typeof options !== 'object') {
|
2716
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
2717
|
+
}
|
2718
|
+
const keys = Object.keys(options);
|
2719
|
+
let i = keys.length;
|
2720
|
+
while (i-- > 0) {
|
2721
|
+
const opt = keys[i];
|
2722
|
+
const validator = schema[opt];
|
2723
|
+
if (validator) {
|
2724
|
+
const value = options[opt];
|
2725
|
+
const result = value === undefined || validator(value, opt, options);
|
2726
|
+
if (result !== true) {
|
2727
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
2728
|
+
}
|
2729
|
+
continue;
|
2730
|
+
}
|
2731
|
+
if (allowUnknown !== true) {
|
2732
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
2733
|
+
}
|
2734
|
+
}
|
2735
|
+
}
|
2736
|
+
|
2737
|
+
var validator = {
|
2738
|
+
assertOptions,
|
2739
|
+
validators: validators$1
|
2740
|
+
};
|
2741
|
+
|
2742
|
+
const validators = validator.validators;
|
2743
|
+
|
2744
|
+
/**
|
2745
|
+
* Create a new instance of Axios
|
2746
|
+
*
|
2747
|
+
* @param {Object} instanceConfig The default config for the instance
|
2748
|
+
*
|
2749
|
+
* @return {Axios} A new instance of Axios
|
2750
|
+
*/
|
2751
|
+
class Axios {
|
2752
|
+
constructor(instanceConfig) {
|
2753
|
+
this.defaults = instanceConfig;
|
2754
|
+
this.interceptors = {
|
2755
|
+
request: new InterceptorManager(),
|
2756
|
+
response: new InterceptorManager()
|
2757
|
+
};
|
2758
|
+
}
|
2759
|
+
|
2760
|
+
/**
|
2761
|
+
* Dispatch a request
|
2762
|
+
*
|
2763
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
2764
|
+
* @param {?Object} config
|
2765
|
+
*
|
2766
|
+
* @returns {Promise} The Promise to be fulfilled
|
2767
|
+
*/
|
2768
|
+
async request(configOrUrl, config) {
|
2769
|
+
try {
|
2770
|
+
return await this._request(configOrUrl, config);
|
2771
|
+
} catch (err) {
|
2772
|
+
if (err instanceof Error) {
|
2773
|
+
let dummy;
|
2774
|
+
|
2775
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
2776
|
+
|
2777
|
+
// slice off the Error: ... line
|
2778
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
2779
|
+
|
2780
|
+
if (!err.stack) {
|
2781
|
+
err.stack = stack;
|
2782
|
+
// match without the 2 top stack lines
|
2783
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
2784
|
+
err.stack += '\n' + stack;
|
2785
|
+
}
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
throw err;
|
2789
|
+
}
|
2790
|
+
}
|
2791
|
+
|
2792
|
+
_request(configOrUrl, config) {
|
2793
|
+
/*eslint no-param-reassign:0*/
|
2794
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
2795
|
+
if (typeof configOrUrl === 'string') {
|
2796
|
+
config = config || {};
|
2797
|
+
config.url = configOrUrl;
|
2798
|
+
} else {
|
2799
|
+
config = configOrUrl || {};
|
2800
|
+
}
|
2801
|
+
|
2802
|
+
config = mergeConfig(this.defaults, config);
|
2803
|
+
|
2804
|
+
const {transitional, paramsSerializer, headers} = config;
|
2805
|
+
|
2806
|
+
if (transitional !== undefined) {
|
2807
|
+
validator.assertOptions(transitional, {
|
2808
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
2809
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
2810
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
2811
|
+
}, false);
|
2812
|
+
}
|
2813
|
+
|
2814
|
+
if (paramsSerializer != null) {
|
2815
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
2816
|
+
config.paramsSerializer = {
|
2817
|
+
serialize: paramsSerializer
|
2818
|
+
};
|
2819
|
+
} else {
|
2820
|
+
validator.assertOptions(paramsSerializer, {
|
2821
|
+
encode: validators.function,
|
2822
|
+
serialize: validators.function
|
2823
|
+
}, true);
|
2824
|
+
}
|
2825
|
+
}
|
2826
|
+
|
2827
|
+
// Set config.method
|
2828
|
+
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
2829
|
+
|
2830
|
+
// Flatten headers
|
2831
|
+
let contextHeaders = headers && utils$1.merge(
|
2832
|
+
headers.common,
|
2833
|
+
headers[config.method]
|
2834
|
+
);
|
2835
|
+
|
2836
|
+
headers && utils$1.forEach(
|
2837
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
2838
|
+
(method) => {
|
2839
|
+
delete headers[method];
|
2840
|
+
}
|
2841
|
+
);
|
2842
|
+
|
2843
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
2844
|
+
|
2845
|
+
// filter out skipped interceptors
|
2846
|
+
const requestInterceptorChain = [];
|
2847
|
+
let synchronousRequestInterceptors = true;
|
2848
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
2849
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
2850
|
+
return;
|
2851
|
+
}
|
2852
|
+
|
2853
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
2854
|
+
|
2855
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
2856
|
+
});
|
2857
|
+
|
2858
|
+
const responseInterceptorChain = [];
|
2859
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
2860
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
2861
|
+
});
|
2862
|
+
|
2863
|
+
let promise;
|
2864
|
+
let i = 0;
|
2865
|
+
let len;
|
2866
|
+
|
2867
|
+
if (!synchronousRequestInterceptors) {
|
2868
|
+
const chain = [dispatchRequest.bind(this), undefined];
|
2869
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
2870
|
+
chain.push.apply(chain, responseInterceptorChain);
|
2871
|
+
len = chain.length;
|
2872
|
+
|
2873
|
+
promise = Promise.resolve(config);
|
2874
|
+
|
2875
|
+
while (i < len) {
|
2876
|
+
promise = promise.then(chain[i++], chain[i++]);
|
2877
|
+
}
|
2878
|
+
|
2879
|
+
return promise;
|
2880
|
+
}
|
2881
|
+
|
2882
|
+
len = requestInterceptorChain.length;
|
2883
|
+
|
2884
|
+
let newConfig = config;
|
2885
|
+
|
2886
|
+
i = 0;
|
2887
|
+
|
2888
|
+
while (i < len) {
|
2889
|
+
const onFulfilled = requestInterceptorChain[i++];
|
2890
|
+
const onRejected = requestInterceptorChain[i++];
|
2891
|
+
try {
|
2892
|
+
newConfig = onFulfilled(newConfig);
|
2893
|
+
} catch (error) {
|
2894
|
+
onRejected.call(this, error);
|
2895
|
+
break;
|
2896
|
+
}
|
2897
|
+
}
|
2898
|
+
|
2899
|
+
try {
|
2900
|
+
promise = dispatchRequest.call(this, newConfig);
|
2901
|
+
} catch (error) {
|
2902
|
+
return Promise.reject(error);
|
2903
|
+
}
|
2904
|
+
|
2905
|
+
i = 0;
|
2906
|
+
len = responseInterceptorChain.length;
|
2907
|
+
|
2908
|
+
while (i < len) {
|
2909
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
2910
|
+
}
|
2911
|
+
|
2912
|
+
return promise;
|
2913
|
+
}
|
2914
|
+
|
2915
|
+
getUri(config) {
|
2916
|
+
config = mergeConfig(this.defaults, config);
|
2917
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
2918
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
2919
|
+
}
|
2920
|
+
}
|
2921
|
+
|
2922
|
+
// Provide aliases for supported request methods
|
2923
|
+
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
2924
|
+
/*eslint func-names:0*/
|
2925
|
+
Axios.prototype[method] = function(url, config) {
|
2926
|
+
return this.request(mergeConfig(config || {}, {
|
2927
|
+
method,
|
2928
|
+
url,
|
2929
|
+
data: (config || {}).data
|
2930
|
+
}));
|
2931
|
+
};
|
2932
|
+
});
|
2933
|
+
|
2934
|
+
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
2935
|
+
/*eslint func-names:0*/
|
2936
|
+
|
2937
|
+
function generateHTTPMethod(isForm) {
|
2938
|
+
return function httpMethod(url, data, config) {
|
2939
|
+
return this.request(mergeConfig(config || {}, {
|
2940
|
+
method,
|
2941
|
+
headers: isForm ? {
|
2942
|
+
'Content-Type': 'multipart/form-data'
|
2943
|
+
} : {},
|
2944
|
+
url,
|
2945
|
+
data
|
2946
|
+
}));
|
2947
|
+
};
|
2948
|
+
}
|
2949
|
+
|
2950
|
+
Axios.prototype[method] = generateHTTPMethod();
|
2951
|
+
|
2952
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
2953
|
+
});
|
2954
|
+
|
2955
|
+
var Axios$1 = Axios;
|
2956
|
+
|
2957
|
+
/**
|
2958
|
+
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
2959
|
+
*
|
2960
|
+
* @param {Function} executor The executor function.
|
2961
|
+
*
|
2962
|
+
* @returns {CancelToken}
|
2963
|
+
*/
|
2964
|
+
class CancelToken {
|
2965
|
+
constructor(executor) {
|
2966
|
+
if (typeof executor !== 'function') {
|
2967
|
+
throw new TypeError('executor must be a function.');
|
2968
|
+
}
|
2969
|
+
|
2970
|
+
let resolvePromise;
|
2971
|
+
|
2972
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
2973
|
+
resolvePromise = resolve;
|
2974
|
+
});
|
2975
|
+
|
2976
|
+
const token = this;
|
2977
|
+
|
2978
|
+
// eslint-disable-next-line func-names
|
2979
|
+
this.promise.then(cancel => {
|
2980
|
+
if (!token._listeners) return;
|
2981
|
+
|
2982
|
+
let i = token._listeners.length;
|
2983
|
+
|
2984
|
+
while (i-- > 0) {
|
2985
|
+
token._listeners[i](cancel);
|
2986
|
+
}
|
2987
|
+
token._listeners = null;
|
2988
|
+
});
|
2989
|
+
|
2990
|
+
// eslint-disable-next-line func-names
|
2991
|
+
this.promise.then = onfulfilled => {
|
2992
|
+
let _resolve;
|
2993
|
+
// eslint-disable-next-line func-names
|
2994
|
+
const promise = new Promise(resolve => {
|
2995
|
+
token.subscribe(resolve);
|
2996
|
+
_resolve = resolve;
|
2997
|
+
}).then(onfulfilled);
|
2998
|
+
|
2999
|
+
promise.cancel = function reject() {
|
3000
|
+
token.unsubscribe(_resolve);
|
3001
|
+
};
|
3002
|
+
|
3003
|
+
return promise;
|
3004
|
+
};
|
3005
|
+
|
3006
|
+
executor(function cancel(message, config, request) {
|
3007
|
+
if (token.reason) {
|
3008
|
+
// Cancellation has already been requested
|
3009
|
+
return;
|
3010
|
+
}
|
3011
|
+
|
3012
|
+
token.reason = new CanceledError(message, config, request);
|
3013
|
+
resolvePromise(token.reason);
|
3014
|
+
});
|
3015
|
+
}
|
3016
|
+
|
3017
|
+
/**
|
3018
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
3019
|
+
*/
|
3020
|
+
throwIfRequested() {
|
3021
|
+
if (this.reason) {
|
3022
|
+
throw this.reason;
|
3023
|
+
}
|
3024
|
+
}
|
3025
|
+
|
3026
|
+
/**
|
3027
|
+
* Subscribe to the cancel signal
|
3028
|
+
*/
|
3029
|
+
|
3030
|
+
subscribe(listener) {
|
3031
|
+
if (this.reason) {
|
3032
|
+
listener(this.reason);
|
3033
|
+
return;
|
3034
|
+
}
|
3035
|
+
|
3036
|
+
if (this._listeners) {
|
3037
|
+
this._listeners.push(listener);
|
3038
|
+
} else {
|
3039
|
+
this._listeners = [listener];
|
3040
|
+
}
|
3041
|
+
}
|
3042
|
+
|
3043
|
+
/**
|
3044
|
+
* Unsubscribe from the cancel signal
|
3045
|
+
*/
|
3046
|
+
|
3047
|
+
unsubscribe(listener) {
|
3048
|
+
if (!this._listeners) {
|
3049
|
+
return;
|
3050
|
+
}
|
3051
|
+
const index = this._listeners.indexOf(listener);
|
3052
|
+
if (index !== -1) {
|
3053
|
+
this._listeners.splice(index, 1);
|
3054
|
+
}
|
3055
|
+
}
|
3056
|
+
|
3057
|
+
/**
|
3058
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
3059
|
+
* cancels the `CancelToken`.
|
3060
|
+
*/
|
3061
|
+
static source() {
|
3062
|
+
let cancel;
|
3063
|
+
const token = new CancelToken(function executor(c) {
|
3064
|
+
cancel = c;
|
3065
|
+
});
|
3066
|
+
return {
|
3067
|
+
token,
|
3068
|
+
cancel
|
3069
|
+
};
|
3070
|
+
}
|
3071
|
+
}
|
3072
|
+
|
3073
|
+
var CancelToken$1 = CancelToken;
|
3074
|
+
|
3075
|
+
/**
|
3076
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
3077
|
+
*
|
3078
|
+
* Common use case would be to use `Function.prototype.apply`.
|
3079
|
+
*
|
3080
|
+
* ```js
|
3081
|
+
* function f(x, y, z) {}
|
3082
|
+
* var args = [1, 2, 3];
|
3083
|
+
* f.apply(null, args);
|
3084
|
+
* ```
|
3085
|
+
*
|
3086
|
+
* With `spread` this example can be re-written.
|
3087
|
+
*
|
3088
|
+
* ```js
|
3089
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
3090
|
+
* ```
|
3091
|
+
*
|
3092
|
+
* @param {Function} callback
|
3093
|
+
*
|
3094
|
+
* @returns {Function}
|
3095
|
+
*/
|
3096
|
+
function spread(callback) {
|
3097
|
+
return function wrap(arr) {
|
3098
|
+
return callback.apply(null, arr);
|
3099
|
+
};
|
3100
|
+
}
|
3101
|
+
|
3102
|
+
/**
|
3103
|
+
* Determines whether the payload is an error thrown by Axios
|
3104
|
+
*
|
3105
|
+
* @param {*} payload The value to test
|
3106
|
+
*
|
3107
|
+
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
3108
|
+
*/
|
3109
|
+
function isAxiosError(payload) {
|
3110
|
+
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
3111
|
+
}
|
3112
|
+
|
3113
|
+
const HttpStatusCode = {
|
3114
|
+
Continue: 100,
|
3115
|
+
SwitchingProtocols: 101,
|
3116
|
+
Processing: 102,
|
3117
|
+
EarlyHints: 103,
|
3118
|
+
Ok: 200,
|
3119
|
+
Created: 201,
|
3120
|
+
Accepted: 202,
|
3121
|
+
NonAuthoritativeInformation: 203,
|
3122
|
+
NoContent: 204,
|
3123
|
+
ResetContent: 205,
|
3124
|
+
PartialContent: 206,
|
3125
|
+
MultiStatus: 207,
|
3126
|
+
AlreadyReported: 208,
|
3127
|
+
ImUsed: 226,
|
3128
|
+
MultipleChoices: 300,
|
3129
|
+
MovedPermanently: 301,
|
3130
|
+
Found: 302,
|
3131
|
+
SeeOther: 303,
|
3132
|
+
NotModified: 304,
|
3133
|
+
UseProxy: 305,
|
3134
|
+
Unused: 306,
|
3135
|
+
TemporaryRedirect: 307,
|
3136
|
+
PermanentRedirect: 308,
|
3137
|
+
BadRequest: 400,
|
3138
|
+
Unauthorized: 401,
|
3139
|
+
PaymentRequired: 402,
|
3140
|
+
Forbidden: 403,
|
3141
|
+
NotFound: 404,
|
3142
|
+
MethodNotAllowed: 405,
|
3143
|
+
NotAcceptable: 406,
|
3144
|
+
ProxyAuthenticationRequired: 407,
|
3145
|
+
RequestTimeout: 408,
|
3146
|
+
Conflict: 409,
|
3147
|
+
Gone: 410,
|
3148
|
+
LengthRequired: 411,
|
3149
|
+
PreconditionFailed: 412,
|
3150
|
+
PayloadTooLarge: 413,
|
3151
|
+
UriTooLong: 414,
|
3152
|
+
UnsupportedMediaType: 415,
|
3153
|
+
RangeNotSatisfiable: 416,
|
3154
|
+
ExpectationFailed: 417,
|
3155
|
+
ImATeapot: 418,
|
3156
|
+
MisdirectedRequest: 421,
|
3157
|
+
UnprocessableEntity: 422,
|
3158
|
+
Locked: 423,
|
3159
|
+
FailedDependency: 424,
|
3160
|
+
TooEarly: 425,
|
3161
|
+
UpgradeRequired: 426,
|
3162
|
+
PreconditionRequired: 428,
|
3163
|
+
TooManyRequests: 429,
|
3164
|
+
RequestHeaderFieldsTooLarge: 431,
|
3165
|
+
UnavailableForLegalReasons: 451,
|
3166
|
+
InternalServerError: 500,
|
3167
|
+
NotImplemented: 501,
|
3168
|
+
BadGateway: 502,
|
3169
|
+
ServiceUnavailable: 503,
|
3170
|
+
GatewayTimeout: 504,
|
3171
|
+
HttpVersionNotSupported: 505,
|
3172
|
+
VariantAlsoNegotiates: 506,
|
3173
|
+
InsufficientStorage: 507,
|
3174
|
+
LoopDetected: 508,
|
3175
|
+
NotExtended: 510,
|
3176
|
+
NetworkAuthenticationRequired: 511,
|
3177
|
+
};
|
3178
|
+
|
3179
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
3180
|
+
HttpStatusCode[value] = key;
|
3181
|
+
});
|
3182
|
+
|
3183
|
+
var HttpStatusCode$1 = HttpStatusCode;
|
3184
|
+
|
3185
|
+
/**
|
3186
|
+
* Create an instance of Axios
|
3187
|
+
*
|
3188
|
+
* @param {Object} defaultConfig The default config for the instance
|
3189
|
+
*
|
3190
|
+
* @returns {Axios} A new instance of Axios
|
3191
|
+
*/
|
3192
|
+
function createInstance(defaultConfig) {
|
3193
|
+
const context = new Axios$1(defaultConfig);
|
3194
|
+
const instance = bind(Axios$1.prototype.request, context);
|
3195
|
+
|
3196
|
+
// Copy axios.prototype to instance
|
3197
|
+
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
3198
|
+
|
3199
|
+
// Copy context to instance
|
3200
|
+
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
3201
|
+
|
3202
|
+
// Factory for creating new instances
|
3203
|
+
instance.create = function create(instanceConfig) {
|
3204
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
3205
|
+
};
|
3206
|
+
|
3207
|
+
return instance;
|
3208
|
+
}
|
3209
|
+
|
3210
|
+
// Create the default instance to be exported
|
3211
|
+
const axios = createInstance(defaults$1);
|
3212
|
+
|
3213
|
+
// Expose Axios class to allow class inheritance
|
3214
|
+
axios.Axios = Axios$1;
|
3215
|
+
|
3216
|
+
// Expose Cancel & CancelToken
|
3217
|
+
axios.CanceledError = CanceledError;
|
3218
|
+
axios.CancelToken = CancelToken$1;
|
3219
|
+
axios.isCancel = isCancel;
|
3220
|
+
axios.VERSION = VERSION;
|
3221
|
+
axios.toFormData = toFormData;
|
3222
|
+
|
3223
|
+
// Expose AxiosError class
|
3224
|
+
axios.AxiosError = AxiosError;
|
3225
|
+
|
3226
|
+
// alias for CanceledError for backward compatibility
|
3227
|
+
axios.Cancel = axios.CanceledError;
|
3228
|
+
|
3229
|
+
// Expose all/spread
|
3230
|
+
axios.all = function all(promises) {
|
3231
|
+
return Promise.all(promises);
|
3232
|
+
};
|
3233
|
+
|
3234
|
+
axios.spread = spread;
|
3235
|
+
|
3236
|
+
// Expose isAxiosError
|
3237
|
+
axios.isAxiosError = isAxiosError;
|
3238
|
+
|
3239
|
+
// Expose mergeConfig
|
3240
|
+
axios.mergeConfig = mergeConfig;
|
3241
|
+
|
3242
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
3243
|
+
|
3244
|
+
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
3245
|
+
|
3246
|
+
axios.getAdapter = adapters.getAdapter;
|
3247
|
+
|
3248
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
3249
|
+
|
3250
|
+
axios.default = axios;
|
3251
|
+
|
3252
|
+
var hs=Object.defineProperty;var qg=Object.getOwnPropertyDescriptor;var Dg=Object.getOwnPropertyNames;var jg=Object.prototype.hasOwnProperty;var be=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qt=(t,e)=>{for(var r in e)hs(t,r,{get:e[r],enumerable:!0});},Fg=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Dg(e))!jg.call(t,n)&&n!==r&&hs(t,n,{get:()=>e[n],enumerable:!(i=qg(e,n))||i.enumerable});return t};var Z=t=>Fg(hs({},"__esModule",{value:!0}),t);var _=be(()=>{});var B={};Qt(B,{_debugEnd:()=>pu,_debugProcess:()=>du,_events:()=>Pu,_eventsCount:()=>Ou,_exiting:()=>Gl,_fatalExceptions:()=>uu,_getActiveHandles:()=>Xl,_getActiveRequests:()=>Jl,_kill:()=>eu,_linkedBinding:()=>zl,_maxListeners:()=>Bu,_preload_modules:()=>Tu,_rawDebug:()=>Hl,_startProfilerIdleNotifier:()=>gu,_stopProfilerIdleNotifier:()=>yu,_tickCallback:()=>hu,abort:()=>mu,addListener:()=>xu,allowedNodeEnvironmentFlags:()=>ou,arch:()=>Ol,argv:()=>Ml,argv0:()=>Iu,assert:()=>au,binding:()=>Dl,chdir:()=>Wl,config:()=>Ql,cpuUsage:()=>qi,cwd:()=>Fl,debugPort:()=>Au,default:()=>Fu,dlopen:()=>Yl,domain:()=>Kl,emit:()=>Nu,emitWarning:()=>ql,env:()=>kl,execArgv:()=>Ll,execPath:()=>Su,exit:()=>nu,features:()=>lu,hasUncaughtExceptionCaptureCallback:()=>cu,hrtime:()=>Ni,kill:()=>iu,listeners:()=>ju,memoryUsage:()=>ru,moduleLoadList:()=>Vl,nextTick:()=>Cl,off:()=>Mu,on:()=>bt,once:()=>ku,openStdin:()=>su,pid:()=>vu,platform:()=>xl,ppid:()=>Eu,prependListener:()=>qu,prependOnceListener:()=>Du,reallyExit:()=>Zl,release:()=>$l,removeAllListeners:()=>Uu,removeListener:()=>Lu,resourceUsage:()=>tu,setSourceMapsEnabled:()=>Ru,setUncaughtExceptionCaptureCallback:()=>fu,stderr:()=>wu,stdin:()=>_u,stdout:()=>bu,title:()=>Pl,umask:()=>jl,uptime:()=>Cu,version:()=>Ul,versions:()=>Nl});function gs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Wg(){!xr||!Yt||(xr=!1,Yt.length?yt=Yt.concat(yt):Ui=-1,yt.length&&Rl());}function Rl(){if(!xr){var t=setTimeout(Wg,0);xr=!0;for(var e=yt.length;e;){for(Yt=yt,yt=[];++Ui<e;)Yt&&Yt[Ui].run();Ui=-1,e=yt.length;}Yt=null,xr=!1,clearTimeout(t);}}function Cl(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];yt.push(new Bl(t,e)),yt.length===1&&!xr&&setTimeout(Rl,0);}function Bl(t,e){this.fun=t,this.array=e;}function me(){}function zl(t){gs("_linkedBinding");}function Yl(t){gs("dlopen");}function Jl(){return []}function Xl(){return []}function au(t,e){if(!t)throw new Error(e||"assertion error")}function cu(){return !1}function Cu(){return Mt.now()/1e3}function Ni(t){var e=Math.floor((Date.now()-Mt.now())*.001),r=Mt.now()*.001,i=Math.floor(r)+e,n=Math.floor(r%1*1e9);return t&&(i=i-t[0],n=n-t[1],n<0&&(i--,n+=ps)),[i,n]}function bt(){return Fu}function ju(t){return []}var yt,xr,Yt,Ui,Pl,Ol,xl,kl,Ml,Ll,Ul,Nl,ql,Dl,jl,Fl,Wl,$l,Hl,Vl,Kl,Gl,Ql,Zl,eu,qi,tu,ru,iu,nu,su,ou,lu,uu,fu,hu,du,pu,gu,yu,bu,wu,_u,mu,vu,Eu,Su,Au,Iu,Tu,Ru,Mt,ds,ps,Bu,Pu,Ou,xu,ku,Mu,Lu,Uu,Nu,qu,Du,Fu,Wu=be(()=>{_();v();m();yt=[],xr=!1,Ui=-1;Bl.prototype.run=function(){this.fun.apply(null,this.array);};Pl="browser",Ol="x64",xl="browser",kl={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Ml=["/usr/bin/node"],Ll=[],Ul="v16.8.0",Nl={},ql=function(t,e){console.warn((e?e+": ":"")+t);},Dl=function(t){gs("binding");},jl=function(t){return 0},Fl=function(){return "/"},Wl=function(t){},$l={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Hl=me,Vl=[];Kl={},Gl=!1,Ql={};Zl=me,eu=me,qi=function(){return {}},tu=qi,ru=qi,iu=me,nu=me,su=me,ou={};lu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},uu=me,fu=me;hu=me,du=me,pu=me,gu=me,yu=me,bu=void 0,wu=void 0,_u=void 0,mu=me,vu=2,Eu=1,Su="/bin/usr/node",Au=9229,Iu="node",Tu=[],Ru=me,Mt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Mt.now===void 0&&(ds=Date.now(),Mt.timing&&Mt.timing.navigationStart&&(ds=Mt.timing.navigationStart),Mt.now=()=>Date.now()-ds);ps=1e9;Ni.bigint=function(t){var e=Ni(t);return typeof BigInt>"u"?e[0]*ps+e[1]:BigInt(e[0]*ps)+BigInt(e[1])};Bu=10,Pu={},Ou=0;xu=bt,ku=bt,Mu=bt,Lu=bt,Uu=bt,Nu=me,qu=bt,Du=bt;Fu={version:Ul,versions:Nl,arch:Ol,platform:xl,release:$l,_rawDebug:Hl,moduleLoadList:Vl,binding:Dl,_linkedBinding:zl,_events:Pu,_eventsCount:Ou,_maxListeners:Bu,on:bt,addListener:xu,once:ku,off:Mu,removeListener:Lu,removeAllListeners:Uu,emit:Nu,prependListener:qu,prependOnceListener:Du,listeners:ju,domain:Kl,_exiting:Gl,config:Ql,dlopen:Yl,uptime:Cu,_getActiveRequests:Jl,_getActiveHandles:Xl,reallyExit:Zl,_kill:eu,cpuUsage:qi,resourceUsage:tu,memoryUsage:ru,kill:iu,exit:nu,openStdin:su,allowedNodeEnvironmentFlags:ou,assert:au,features:lu,_fatalExceptions:uu,setUncaughtExceptionCaptureCallback:fu,hasUncaughtExceptionCaptureCallback:cu,emitWarning:ql,nextTick:Cl,_tickCallback:hu,_debugProcess:du,_debugEnd:pu,_startProfilerIdleNotifier:gu,_stopProfilerIdleNotifier:yu,stdout:bu,stdin:_u,stderr:wu,abort:mu,umask:jl,chdir:Wl,cwd:Fl,env:kl,title:Pl,argv:Ml,execArgv:Ll,pid:vu,ppid:Eu,execPath:Su,debugPort:Au,hrtime:Ni,argv0:Iu,_preload_modules:Tu,setSourceMapsEnabled:Ru};});var m=be(()=>{Wu();});var ve={};Qt(ve,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>zg,default:()=>Lt,kMaxLength:()=>Kg});function $g(){if($u)return li;$u=!0,li.byteLength=a,li.toByteArray=c,li.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n<o;++n)t[n]=i[n],e[i.charCodeAt(n)]=n;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function s(y){var w=y.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=w);var S=E===w?0:4-E%4;return [E,S]}function a(y){var w=s(y),E=w[0],S=w[1];return (E+S)*3/4-S}function u(y,w,E){return (w+E)*3/4-E}function c(y){var w,E=s(y),S=E[0],I=E[1],C=new r(u(y,S,I)),R=0,U=I>0?S-4:S,N;for(N=0;N<U;N+=4)w=e[y.charCodeAt(N)]<<18|e[y.charCodeAt(N+1)]<<12|e[y.charCodeAt(N+2)]<<6|e[y.charCodeAt(N+3)],C[R++]=w>>16&255,C[R++]=w>>8&255,C[R++]=w&255;return I===2&&(w=e[y.charCodeAt(N)]<<2|e[y.charCodeAt(N+1)]>>4,C[R++]=w&255),I===1&&(w=e[y.charCodeAt(N)]<<10|e[y.charCodeAt(N+1)]<<4|e[y.charCodeAt(N+2)]>>2,C[R++]=w>>8&255,C[R++]=w&255),C}function h(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function d(y,w,E){for(var S,I=[],C=w;C<E;C+=3)S=(y[C]<<16&16711680)+(y[C+1]<<8&65280)+(y[C+2]&255),I.push(h(S));return I.join("")}function g(y){for(var w,E=y.length,S=E%3,I=[],C=16383,R=0,U=E-S;R<U;R+=C)I.push(d(y,R,R+C>U?U:R+C));return S===1?(w=y[E-1],I.push(t[w>>2]+t[w<<4&63]+"==")):S===2&&(w=(y[E-2]<<8)+y[E-1],I.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),I.join("")}return li}function Hg(){if(Hu)return Di;Hu=!0;return Di.read=function(t,e,r,i,n){var o,s,a=n*8-i-1,u=(1<<a)-1,c=u>>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=o*256+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else {if(o===u)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c;}return (y?-1:1)*s*Math.pow(2,o-i)},Di.write=function(t,e,r,i,n,o){var s,a,u,c=o*8-n-1,h=(1<<c)-1,d=h>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+d>=1?e+=g/u:e+=g*Math.pow(2,1-d),e*u>=2&&(s++,u/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*u-1)*Math.pow(2,n),s=s+d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=a&255,y+=w,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;t[r+y]=s&255,y+=w,s/=256,c-=8);t[r+y-w]|=E*128;},Di}function Vg(){if(Vu)return Jt;Vu=!0;let t=$g(),e=Hg(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Jt.Buffer=s,Jt.SlowBuffer=I,Jt.INSPECT_MAX_BYTES=50;let i=2147483647;Jt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{let p=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(p,l),p.foo()===42}catch{return !1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');let l=new Uint8Array(p);return Object.setPrototypeOf(l,s.prototype),l}function s(p,l,f){if(typeof p=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(p)}return a(p,l,f)}s.poolSize=8192;function a(p,l,f){if(typeof p=="string")return d(p,l);if(ArrayBuffer.isView(p))return y(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ye(p,ArrayBuffer)||p&&Ye(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ye(p,SharedArrayBuffer)||p&&Ye(p.buffer,SharedArrayBuffer)))return w(p,l,f);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let b=p.valueOf&&p.valueOf();if(b!=null&&b!==p)return s.from(b,l,f);let A=E(p);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return s.from(p[Symbol.toPrimitive]("string"),l,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}s.from=function(p,l,f){return a(p,l,f)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function c(p,l,f){return u(p),p<=0?o(p):l!==void 0?typeof f=="string"?o(p).fill(l,f):o(p).fill(l):o(p)}s.alloc=function(p,l,f){return c(p,l,f)};function h(p){return u(p),o(p<0?0:S(p)|0)}s.allocUnsafe=function(p){return h(p)},s.allocUnsafeSlow=function(p){return h(p)};function d(p,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);let f=C(p,l)|0,b=o(f),A=b.write(p,l);return A!==f&&(b=b.slice(0,A)),b}function g(p){let l=p.length<0?0:S(p.length)|0,f=o(l);for(let b=0;b<l;b+=1)f[b]=p[b]&255;return f}function y(p){if(Ye(p,Uint8Array)){let l=new Uint8Array(p);return w(l.buffer,l.byteOffset,l.byteLength)}return g(p)}function w(p,l,f){if(l<0||p.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<l+(f||0))throw new RangeError('"length" is outside of buffer bounds');let b;return l===void 0&&f===void 0?b=new Uint8Array(p):f===void 0?b=new Uint8Array(p,l):b=new Uint8Array(p,l,f),Object.setPrototypeOf(b,s.prototype),b}function E(p){if(s.isBuffer(p)){let l=S(p.length)|0,f=o(l);return f.length===0||p.copy(f,0,0,l),f}if(p.length!==void 0)return typeof p.length!="number"||cs(p.length)?o(0):g(p);if(p.type==="Buffer"&&Array.isArray(p.data))return g(p.data)}function S(p){if(p>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function I(p){return +p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,f){if(Ye(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),Ye(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(l)||!s.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===f)return 0;let b=l.length,A=f.length;for(let T=0,P=Math.min(b,A);T<P;++T)if(l[T]!==f[T]){b=l[T],A=f[T];break}return b<A?-1:A<b?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},s.concat=function(l,f){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);let b;if(f===void 0)for(f=0,b=0;b<l.length;++b)f+=l[b].length;let A=s.allocUnsafe(f),T=0;for(b=0;b<l.length;++b){let P=l[b];if(Ye(P,Uint8Array))T+P.length>A.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=P.length;}return A};function C(p,l){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ye(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let f=p.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&f===0)return 0;let A=!1;for(;;)switch(l){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return fs(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return Tl(p).length;default:if(A)return b?-1:fs(p).length;l=(""+l).toLowerCase(),A=!0;}}s.byteLength=C;function R(p,l,f){let b=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,l>>>=0,f<=l))return "";for(p||(p="utf8");;)switch(p){case"hex":return Bg(this,l,f);case"utf8":case"utf-8":return Rr(this,l,f);case"ascii":return ls(this,l,f);case"latin1":case"binary":return Cg(this,l,f);case"base64":return pe(this,l,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pg(this,l,f);default:if(b)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),b=!0;}}s.prototype._isBuffer=!0;function U(p,l,f){let b=p[l];p[l]=p[f],p[f]=b;}s.prototype.swap16=function(){let l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<l;f+=2)U(this,f,f+1);return this},s.prototype.swap32=function(){let l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<l;f+=4)U(this,f,f+3),U(this,f+1,f+2);return this},s.prototype.swap64=function(){let l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<l;f+=8)U(this,f,f+7),U(this,f+1,f+6),U(this,f+2,f+5),U(this,f+3,f+4);return this},s.prototype.toString=function(){let l=this.length;return l===0?"":arguments.length===0?Rr(this,0,l):R.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){let l="",f=Jt.INSPECT_MAX_BYTES;return l=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,f,b,A,T){if(Ye(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(f===void 0&&(f=0),b===void 0&&(b=l?l.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),f<0||b>l.length||A<0||T>this.length)throw new RangeError("out of range index");if(A>=T&&f>=b)return 0;if(A>=T)return -1;if(f>=b)return 1;if(f>>>=0,b>>>=0,A>>>=0,T>>>=0,this===l)return 0;let P=T-A,$=b-f,se=Math.min(P,$),te=this.slice(A,T),oe=l.slice(f,b);for(let J=0;J<se;++J)if(te[J]!==oe[J]){P=te[J],$=oe[J];break}return P<$?-1:$<P?1:0};function N(p,l,f,b,A){if(p.length===0)return -1;if(typeof f=="string"?(b=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,cs(f)&&(f=A?0:p.length-1),f<0&&(f=p.length+f),f>=p.length){if(A)return -1;f=p.length-1;}else if(f<0)if(A)f=0;else return -1;if(typeof l=="string"&&(l=s.from(l,b)),s.isBuffer(l))return l.length===0?-1:W(p,l,f,b,A);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(p,l,f):Uint8Array.prototype.lastIndexOf.call(p,l,f):W(p,[l],f,b,A);throw new TypeError("val must be string, number or Buffer")}function W(p,l,f,b,A){let T=1,P=p.length,$=l.length;if(b!==void 0&&(b=String(b).toLowerCase(),b==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(p.length<2||l.length<2)return -1;T=2,P/=2,$/=2,f/=2;}function se(oe,J){return T===1?oe[J]:oe.readUInt16BE(J*T)}let te;if(A){let oe=-1;for(te=f;te<P;te++)if(se(p,te)===se(l,oe===-1?0:te-oe)){if(oe===-1&&(oe=te),te-oe+1===$)return oe*T}else oe!==-1&&(te-=te-oe),oe=-1;}else for(f+$>P&&(f=P-$),te=f;te>=0;te--){let oe=!0;for(let J=0;J<$;J++)if(se(p,te+J)!==se(l,J)){oe=!1;break}if(oe)return te}return -1}s.prototype.includes=function(l,f,b){return this.indexOf(l,f,b)!==-1},s.prototype.indexOf=function(l,f,b){return N(this,l,f,b,!0)},s.prototype.lastIndexOf=function(l,f,b){return N(this,l,f,b,!1)};function K(p,l,f,b){f=Number(f)||0;let A=p.length-f;b?(b=Number(b),b>A&&(b=A)):b=A;let T=l.length;b>T/2&&(b=T/2);let P;for(P=0;P<b;++P){let $=parseInt(l.substr(P*2,2),16);if(cs($))return P;p[f+P]=$;}return P}function z(p,l,f,b){return Li(fs(l,p.length-f),p,f,b)}function G(p,l,f,b){return Li(Mg(l),p,f,b)}function de(p,l,f,b){return Li(Tl(l),p,f,b)}function Gt(p,l,f,b){return Li(Lg(l,p.length-f),p,f,b)}s.prototype.write=function(l,f,b,A){if(f===void 0)A="utf8",b=this.length,f=0;else if(b===void 0&&typeof f=="string")A=f,b=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(b)?(b=b>>>0,A===void 0&&(A="utf8")):(A=b,b=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-f;if((b===void 0||b>T)&&(b=T),l.length>0&&(b<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let P=!1;for(;;)switch(A){case"hex":return K(this,l,f,b);case"utf8":case"utf-8":return z(this,l,f,b);case"ascii":case"latin1":case"binary":return G(this,l,f,b);case"base64":return de(this,l,f,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gt(this,l,f,b);default:if(P)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),P=!0;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pe(p,l,f){return l===0&&f===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(l,f))}function Rr(p,l,f){f=Math.min(p.length,f);let b=[],A=l;for(;A<f;){let T=p[A],P=null,$=T>239?4:T>223?3:T>191?2:1;if(A+$<=f){let se,te,oe,J;switch($){case 1:T<128&&(P=T);break;case 2:se=p[A+1],(se&192)===128&&(J=(T&31)<<6|se&63,J>127&&(P=J));break;case 3:se=p[A+1],te=p[A+2],(se&192)===128&&(te&192)===128&&(J=(T&15)<<12|(se&63)<<6|te&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:se=p[A+1],te=p[A+2],oe=p[A+3],(se&192)===128&&(te&192)===128&&(oe&192)===128&&(J=(T&15)<<18|(se&63)<<12|(te&63)<<6|oe&63,J>65535&&J<1114112&&(P=J));}}P===null?(P=65533,$=1):P>65535&&(P-=65536,b.push(P>>>10&1023|55296),P=56320|P&1023),b.push(P),A+=$;}return Br(b)}let Cr=4096;function Br(p){let l=p.length;if(l<=Cr)return String.fromCharCode.apply(String,p);let f="",b=0;for(;b<l;)f+=String.fromCharCode.apply(String,p.slice(b,b+=Cr));return f}function ls(p,l,f){let b="";f=Math.min(p.length,f);for(let A=l;A<f;++A)b+=String.fromCharCode(p[A]&127);return b}function Cg(p,l,f){let b="";f=Math.min(p.length,f);for(let A=l;A<f;++A)b+=String.fromCharCode(p[A]);return b}function Bg(p,l,f){let b=p.length;(!l||l<0)&&(l=0),(!f||f<0||f>b)&&(f=b);let A="";for(let T=l;T<f;++T)A+=Ug[p[T]];return A}function Pg(p,l,f){let b=p.slice(l,f),A="";for(let T=0;T<b.length-1;T+=2)A+=String.fromCharCode(b[T]+b[T+1]*256);return A}s.prototype.slice=function(l,f){let b=this.length;l=~~l,f=f===void 0?b:~~f,l<0?(l+=b,l<0&&(l=0)):l>b&&(l=b),f<0?(f+=b,f<0&&(f=0)):f>b&&(f=b),f<l&&(f=l);let A=this.subarray(l,f);return Object.setPrototypeOf(A,s.prototype),A};function ge(p,l,f){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+l>f)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,f,b){l=l>>>0,f=f>>>0,b||ge(l,f,this.length);let A=this[l],T=1,P=0;for(;++P<f&&(T*=256);)A+=this[l+P]*T;return A},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,f,b){l=l>>>0,f=f>>>0,b||ge(l,f,this.length);let A=this[l+--f],T=1;for(;f>0&&(T*=256);)A+=this[l+--f]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(l,f){return l=l>>>0,f||ge(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,f){return l=l>>>0,f||ge(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,f){return l=l>>>0,f||ge(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readBigUInt64LE=kt(function(l){l=l>>>0,Or(l,"offset");let f=this[l],b=this[l+7];(f===void 0||b===void 0)&&ai(l,this.length-8);let A=f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,T=this[++l]+this[++l]*2**8+this[++l]*2**16+b*2**24;return BigInt(A)+(BigInt(T)<<BigInt(32))}),s.prototype.readBigUInt64BE=kt(function(l){l=l>>>0,Or(l,"offset");let f=this[l],b=this[l+7];(f===void 0||b===void 0)&&ai(l,this.length-8);let A=f*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],T=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+b;return (BigInt(A)<<BigInt(32))+BigInt(T)}),s.prototype.readIntLE=function(l,f,b){l=l>>>0,f=f>>>0,b||ge(l,f,this.length);let A=this[l],T=1,P=0;for(;++P<f&&(T*=256);)A+=this[l+P]*T;return T*=128,A>=T&&(A-=Math.pow(2,8*f)),A},s.prototype.readIntBE=function(l,f,b){l=l>>>0,f=f>>>0,b||ge(l,f,this.length);let A=f,T=1,P=this[l+--A];for(;A>0&&(T*=256);)P+=this[l+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*f)),P},s.prototype.readInt8=function(l,f){return l=l>>>0,f||ge(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,f){l=l>>>0,f||ge(l,2,this.length);let b=this[l]|this[l+1]<<8;return b&32768?b|4294901760:b},s.prototype.readInt16BE=function(l,f){l=l>>>0,f||ge(l,2,this.length);let b=this[l+1]|this[l]<<8;return b&32768?b|4294901760:b},s.prototype.readInt32LE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readBigInt64LE=kt(function(l){l=l>>>0,Or(l,"offset");let f=this[l],b=this[l+7];(f===void 0||b===void 0)&&ai(l,this.length-8);let A=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(b<<24);return (BigInt(A)<<BigInt(32))+BigInt(f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),s.prototype.readBigInt64BE=kt(function(l){l=l>>>0,Or(l,"offset");let f=this[l],b=this[l+7];(f===void 0||b===void 0)&&ai(l,this.length-8);let A=(f<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return (BigInt(A)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+b)}),s.prototype.readFloatLE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),e.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,f){return l=l>>>0,f||ge(l,4,this.length),e.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,f){return l=l>>>0,f||ge(l,8,this.length),e.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,f){return l=l>>>0,f||ge(l,8,this.length),e.read(this,l,!1,52,8)};function Ce(p,l,f,b,A,T){if(!s.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>A||l<T)throw new RangeError('"value" argument is out of bounds');if(f+b>p.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,f,b,A){if(l=+l,f=f>>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,l,f,b,$,0);}let T=1,P=0;for(this[f]=l&255;++P<b&&(T*=256);)this[f+P]=l/T&255;return f+b},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,f,b,A){if(l=+l,f=f>>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,l,f,b,$,0);}let T=b-1,P=1;for(this[f+T]=l&255;--T>=0&&(P*=256);)this[f+T]=l/P&255;return f+b},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,1,255,0),this[f]=l&255,f+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,2,65535,0),this[f]=l&255,this[f+1]=l>>>8,f+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,2,65535,0),this[f]=l>>>8,this[f+1]=l&255,f+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,4,4294967295,0),this[f+3]=l>>>24,this[f+2]=l>>>16,this[f+1]=l>>>8,this[f]=l&255,f+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,4,4294967295,0),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4};function _l(p,l,f,b,A){Il(l,b,A,p,f,7);let T=Number(l&BigInt(4294967295));p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T;let P=Number(l>>BigInt(32)&BigInt(4294967295));return p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,f}function ml(p,l,f,b,A){Il(l,b,A,p,f,7);let T=Number(l&BigInt(4294967295));p[f+7]=T,T=T>>8,p[f+6]=T,T=T>>8,p[f+5]=T,T=T>>8,p[f+4]=T;let P=Number(l>>BigInt(32)&BigInt(4294967295));return p[f+3]=P,P=P>>8,p[f+2]=P,P=P>>8,p[f+1]=P,P=P>>8,p[f]=P,f+8}s.prototype.writeBigUInt64LE=kt(function(l,f=0){return _l(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=kt(function(l,f=0){return ml(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(l,f,b,A){if(l=+l,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,l,f,b,se-1,-se);}let T=0,P=1,$=0;for(this[f]=l&255;++T<b&&(P*=256);)l<0&&$===0&&this[f+T-1]!==0&&($=1),this[f+T]=(l/P>>0)-$&255;return f+b},s.prototype.writeIntBE=function(l,f,b,A){if(l=+l,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,l,f,b,se-1,-se);}let T=b-1,P=1,$=0;for(this[f+T]=l&255;--T>=0&&(P*=256);)l<0&&$===0&&this[f+T+1]!==0&&($=1),this[f+T]=(l/P>>0)-$&255;return f+b},s.prototype.writeInt8=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,1,127,-128),l<0&&(l=255+l+1),this[f]=l&255,f+1},s.prototype.writeInt16LE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,2,32767,-32768),this[f]=l&255,this[f+1]=l>>>8,f+2},s.prototype.writeInt16BE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,2,32767,-32768),this[f]=l>>>8,this[f+1]=l&255,f+2},s.prototype.writeInt32LE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,4,2147483647,-2147483648),this[f]=l&255,this[f+1]=l>>>8,this[f+2]=l>>>16,this[f+3]=l>>>24,f+4},s.prototype.writeInt32BE=function(l,f,b){return l=+l,f=f>>>0,b||Ce(this,l,f,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4},s.prototype.writeBigInt64LE=kt(function(l,f=0){return _l(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=kt(function(l,f=0){return ml(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function vl(p,l,f,b,A,T){if(f+b>p.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function El(p,l,f,b,A){return l=+l,f=f>>>0,A||vl(p,l,f,4),e.write(p,l,f,b,23,4),f+4}s.prototype.writeFloatLE=function(l,f,b){return El(this,l,f,!0,b)},s.prototype.writeFloatBE=function(l,f,b){return El(this,l,f,!1,b)};function Sl(p,l,f,b,A){return l=+l,f=f>>>0,A||vl(p,l,f,8),e.write(p,l,f,b,52,8),f+8}s.prototype.writeDoubleLE=function(l,f,b){return Sl(this,l,f,!0,b)},s.prototype.writeDoubleBE=function(l,f,b){return Sl(this,l,f,!1,b)},s.prototype.copy=function(l,f,b,A){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(b||(b=0),!A&&A!==0&&(A=this.length),f>=l.length&&(f=l.length),f||(f=0),A>0&&A<b&&(A=b),A===b||l.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(b<0||b>=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),l.length-f<A-b&&(A=l.length-f+b);let T=A-b;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,b,A):Uint8Array.prototype.set.call(l,this.subarray(b,A),f),T},s.prototype.fill=function(l,f,b,A){if(typeof l=="string"){if(typeof f=="string"?(A=f,f=0,b=this.length):typeof b=="string"&&(A=b,b=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!s.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(l.length===1){let P=l.charCodeAt(0);(A==="utf8"&&P<128||A==="latin1")&&(l=P);}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(f<0||this.length<f||this.length<b)throw new RangeError("Out of range index");if(b<=f)return this;f=f>>>0,b=b===void 0?this.length:b>>>0,l||(l=0);let T;if(typeof l=="number")for(T=f;T<b;++T)this[T]=l;else {let P=s.isBuffer(l)?l:s.from(l,A),$=P.length;if($===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(T=0;T<b-f;++T)this[T+f]=P[T%$];}return this};let Pr={};function us(p,l,f){Pr[p]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:l.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name;}get code(){return p}set code(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0});}toString(){return `${this.name} [${p}]: ${this.message}`}};}us("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),us("ERR_INVALID_ARG_TYPE",function(p,l){return `The "${p}" argument must be of type number. Received type ${typeof l}`},TypeError),us("ERR_OUT_OF_RANGE",function(p,l,f){let b=`The value of "${p}" is out of range.`,A=f;return Number.isInteger(f)&&Math.abs(f)>2**32?A=Al(String(f)):typeof f=="bigint"&&(A=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(A=Al(A)),A+="n"),b+=` It must be ${l}. Received ${A}`,b},RangeError);function Al(p){let l="",f=p.length,b=p[0]==="-"?1:0;for(;f>=b+4;f-=3)l=`_${p.slice(f-3,f)}${l}`;return `${p.slice(0,f)}${l}`}function Og(p,l,f){Or(l,"offset"),(p[l]===void 0||p[l+f]===void 0)&&ai(l,p.length-(f+1));}function Il(p,l,f,b,A,T){if(p>f||p<l){let P=typeof l=="bigint"?"n":"",$;throw T>3?l===0||l===BigInt(0)?$=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:$=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:$=`>= ${l}${P} and <= ${f}${P}`,new Pr.ERR_OUT_OF_RANGE("value",$,p)}Og(b,A,T);}function Or(p,l){if(typeof p!="number")throw new Pr.ERR_INVALID_ARG_TYPE(l,"number",p)}function ai(p,l,f){throw Math.floor(p)!==p?(Or(p,f),new Pr.ERR_OUT_OF_RANGE(f||"offset","an integer",p)):l<0?new Pr.ERR_BUFFER_OUT_OF_BOUNDS:new Pr.ERR_OUT_OF_RANGE(f||"offset",`>= ${f?1:0} and <= ${l}`,p)}let xg=/[^+/0-9A-Za-z-_]/g;function kg(p){if(p=p.split("=")[0],p=p.trim().replace(xg,""),p.length<2)return "";for(;p.length%4!==0;)p=p+"=";return p}function fs(p,l){l=l||1/0;let f,b=p.length,A=null,T=[];for(let P=0;P<b;++P){if(f=p.charCodeAt(P),f>55295&&f<57344){if(!A){if(f>56319){(l-=3)>-1&&T.push(239,191,189);continue}else if(P+1===b){(l-=3)>-1&&T.push(239,191,189);continue}A=f;continue}if(f<56320){(l-=3)>-1&&T.push(239,191,189),A=f;continue}f=(A-55296<<10|f-56320)+65536;}else A&&(l-=3)>-1&&T.push(239,191,189);if(A=null,f<128){if((l-=1)<0)break;T.push(f);}else if(f<2048){if((l-=2)<0)break;T.push(f>>6|192,f&63|128);}else if(f<65536){if((l-=3)<0)break;T.push(f>>12|224,f>>6&63|128,f&63|128);}else if(f<1114112){if((l-=4)<0)break;T.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128);}else throw new Error("Invalid code point")}return T}function Mg(p){let l=[];for(let f=0;f<p.length;++f)l.push(p.charCodeAt(f)&255);return l}function Lg(p,l){let f,b,A,T=[];for(let P=0;P<p.length&&!((l-=2)<0);++P)f=p.charCodeAt(P),b=f>>8,A=f%256,T.push(A),T.push(b);return T}function Tl(p){return t.toByteArray(kg(p))}function Li(p,l,f,b){let A;for(A=0;A<b&&!(A+f>=l.length||A>=p.length);++A)l[A+f]=p[A];return A}function Ye(p,l){return p instanceof l||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===l.name}function cs(p){return p!==p}let Ug=function(){let p="0123456789abcdef",l=new Array(256);for(let f=0;f<16;++f){let b=f*16;for(let A=0;A<16;++A)l[b+A]=p[f]+p[A];}return l}();function kt(p){return typeof BigInt>"u"?Ng:p}function Ng(){throw new Error("BigInt not supported")}return Jt}var li,$u,Di,Hu,Jt,Vu,Lt,x,zg,Kg,we=be(()=>{_();v();m();li={},$u=!1;Di={},Hu=!1;Jt={},Vu=!1;Lt=Vg();Lt.Buffer;Lt.SlowBuffer;Lt.INSPECT_MAX_BYTES;Lt.kMaxLength;x=Lt.Buffer,zg=Lt.INSPECT_MAX_BYTES,Kg=Lt.kMaxLength;});var v=be(()=>{we();});var zu=M(bs=>{_();v();m();Object.defineProperty(bs,"__esModule",{value:!0});var ys=class{constructor(e){this.aliasToTopic={},this.max=e;}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={};}};bs.default=ys;});var ce=M((mA,Ku)=>{_();v();m();Ku.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array};});var Je=M((PA,_s)=>{_();v();m();var Gg=(we(),Z(ve)),Qg=Object.getPrototypeOf(async function(){}).constructor,Gu=globalThis.Blob||Gg.Blob,Yg=typeof Gu<"u"?function(e){return e instanceof Gu}:function(e){return !1},ws=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
3253
|
+
`;super(r),this.name="AggregateError",this.errors=e;}};_s.exports={AggregateError:ws,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r));}},createDeferredPromise:function(){let t,e;return {promise:new Promise((i,n)=>{t=i,e=n;}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n));})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return `\`${t}\``}else return `"${t}"`;return `'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return `${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return "{}"}},types:{isAsyncFunction(t){return t instanceof Qg},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Yg};_s.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom");});var Fi=M((jA,ji)=>{_();v();m();var{AbortController:Qu,AbortSignal:Jg}=typeof self<"u"?self:typeof window<"u"?window:void 0;ji.exports=Qu;ji.exports.AbortSignal=Jg;ji.exports.default=Qu;});var Se=M((YA,Xu)=>{_();v();m();var{format:Xg,inspect:Wi,AggregateError:Zg}=Je(),ey=globalThis.AggregateError||Zg,ty=Symbol("kIsNodeError"),ry=["string","function","number","object","Function","Object","boolean","bigint","symbol"],iy=/^([A-Z][a-z0-9]*)+$/,ny="__node_internal_",$i={};function Xt(t,e){if(!t)throw new $i.ERR_INTERNAL_ASSERTION(e)}function Yu(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return `${t.slice(0,r)}${e}`}function sy(t,e,r){if(typeof e=="function")return Xt(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return Xt(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:Xg(e,...r)}function _e(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(sy(t,e,o));}toString(){return `${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return `${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[ty]=!0,$i[t]=i;}function Ju(t){let e=ny+t.name;return Object.defineProperty(t,"name",{value:e}),t}function oy(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ey([e,t],e.message);return r.code=e.code,r}return t||e}var ms=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new $i.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError";}};_e("ERR_ASSERTION","%s",Error);_e("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Xt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],o=[],s=[];for(let u of e)Xt(typeof u=="string","All expected entries have to be of type string"),ry.includes(u)?n.push(u.toLowerCase()):iy.test(u)?o.push(u):(Xt(u!=="object",'The value "object" should be written as "Object"'),s.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"));}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();i+=`one of type ${n.join(", ")}, or ${u}`;}}(o.length>0||s.length>0)&&(i+=" or ");}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();i+=`an instance of ${o.join(", ")}, or ${u}`;}}s.length>0&&(i+=" or ");}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+="an "),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let u=s.pop();i+=`one of ${s.join(", ")}, or ${u}`;}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else {let u=Wi(r,{depth:-1});i+=`. Received ${u}`;}}else {let u=Wi(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),i+=`. Received type ${typeof r} (${u})`;}return i},TypeError);_e("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Wi(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);_e("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return `Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);_e("ERR_MISSING_ARGS",(...t)=>{Xt(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`;}break}return `${e} must be specified`},TypeError);_e("ERR_OUT_OF_RANGE",(t,e,r)=>{Xt(e,'Missing "range" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Yu(String(r)):typeof r=="bigint"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=Yu(i)),i+="n"):i=Wi(r),`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);_e("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);_e("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);_e("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);_e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);_e("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);_e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);_e("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);_e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);_e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);_e("ERR_STREAM_WRITE_AFTER_END","write after end",Error);_e("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Xu.exports={AbortError:ms,aggregateTwoErrors:Ju(oy),hideStackFrames:Ju,codes:$i};});var ui=M((oI,lf)=>{_();v();m();var{ArrayIsArray:Es,ArrayPrototypeIncludes:rf,ArrayPrototypeJoin:nf,ArrayPrototypeMap:ay,NumberIsInteger:Ss,NumberIsNaN:ly,NumberMAX_SAFE_INTEGER:uy,NumberMIN_SAFE_INTEGER:fy,NumberParseInt:cy,ObjectPrototypeHasOwnProperty:hy,RegExpPrototypeExec:sf,String:dy,StringPrototypeToUpperCase:py,StringPrototypeTrim:gy}=ce(),{hideStackFrames:Ue,codes:{ERR_SOCKET_BAD_PORT:yy,ERR_INVALID_ARG_TYPE:Ae,ERR_INVALID_ARG_VALUE:kr,ERR_OUT_OF_RANGE:Zt,ERR_UNKNOWN_SIGNAL:Zu}}=Se(),{normalizeEncoding:by}=Je(),{isAsyncFunction:wy,isArrayBufferView:_y}=Je().types,ef={};function my(t){return t===(t|0)}function vy(t){return t===t>>>0}var Ey=/^[0-7]+$/,Sy="must be a 32-bit unsigned integer or an octal string";function Ay(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(sf(Ey,t)===null)throw new kr(e,t,Sy);t=cy(t,8);}return of(t,e),t}var Iy=Ue((t,e,r=fy,i=uy)=>{if(typeof t!="number")throw new Ae(e,"number",t);if(!Ss(t))throw new Zt(e,"an integer",t);if(t<r||t>i)throw new Zt(e,`>= ${r} && <= ${i}`,t)}),Ty=Ue((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new Ae(e,"number",t);if(!Ss(t))throw new Zt(e,"an integer",t);if(t<r||t>i)throw new Zt(e,`>= ${r} && <= ${i}`,t)}),of=Ue((t,e,r=!1)=>{if(typeof t!="number")throw new Ae(e,"number",t);if(!Ss(t))throw new Zt(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Zt(e,`>= ${i} && <= ${n}`,t)});function As(t,e){if(typeof t!="string")throw new Ae(e,"string",t)}function Ry(t,e,r=void 0,i){if(typeof t!="number")throw new Ae(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&ly(t))throw new Zt(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Cy=Ue((t,e,r)=>{if(!rf(r,t)){let n="must be one of: "+nf(ay(r,o=>typeof o=="string"?`'${o}'`:dy(o)),", ");throw new kr(e,t,n)}});function af(t,e){if(typeof t!="boolean")throw new Ae(e,"boolean",t)}function vs(t,e,r){return t==null||!hy(t,e)?r:t[e]}var By=Ue((t,e,r=null)=>{let i=vs(r,"allowArray",!1),n=vs(r,"allowFunction",!1);if(!vs(r,"nullable",!1)&&t===null||!i&&Es(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new Ae(e,"Object",t)}),Py=Ue((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Ae(e,"a dictionary",t)}),Is=Ue((t,e,r=0)=>{if(!Es(t))throw new Ae(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new kr(e,t,i)}});function Oy(t,e){Is(t,e);for(let r=0;r<t.length;r++)As(t[r],`${e}[${r}]`);}function xy(t,e){Is(t,e);for(let r=0;r<t.length;r++)af(t[r],`${e}[${r}]`);}function ky(t,e="signal"){if(As(t,e),ef[t]===void 0)throw ef[py(t)]!==void 0?new Zu(t+" (signals must use all capital letters)"):new Zu(t)}var My=Ue((t,e="buffer")=>{if(!_y(t))throw new Ae(e,["Buffer","TypedArray","DataView"],t)});function Ly(t,e){let r=by(e),i=t.length;if(r==="hex"&&i%2!==0)throw new kr("encoding",e,`is invalid for data of length ${i}`)}function Uy(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&gy(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new yy(e,t,r);return t|0}var Ny=Ue((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ae(e,"AbortSignal",t)}),qy=Ue((t,e)=>{if(typeof t!="function")throw new Ae(e,"Function",t)}),Dy=Ue((t,e)=>{if(typeof t!="function"||wy(t))throw new Ae(e,"Function",t)}),jy=Ue((t,e)=>{if(t!==void 0)throw new Ae(e,"undefined",t)});function Fy(t,e,r){if(!rf(r,t))throw new Ae(e,`('${nf(r,"|")}')`,t)}var Wy=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function tf(t,e){if(typeof t>"u"||!sf(Wy,t))throw new kr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function $y(t){if(typeof t=="string")return tf(t,"hints"),t;if(Es(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];tf(n,"hints"),r+=n,i!==e-1&&(r+=", ");}return r}throw new kr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}lf.exports={isInt32:my,isUint32:vy,parseFileMode:Ay,validateArray:Is,validateStringArray:Oy,validateBooleanArray:xy,validateBoolean:af,validateBuffer:My,validateDictionary:Py,validateEncoding:Ly,validateFunction:qy,validateInt32:Ty,validateInteger:Iy,validateNumber:Ry,validateObject:By,validateOneOf:Cy,validatePlainFunction:Dy,validatePort:Uy,validateSignalName:ky,validateString:As,validateUint32:of,validateUndefined:jy,validateUnion:Fy,validateAbortSignal:Ny,validateLinkHeaderValue:$y};});var Ut=M((yI,hf)=>{_();v();m();var ae=hf.exports={},Xe,Ze;function Ts(){throw new Error("setTimeout has not been defined")}function Rs(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Xe=setTimeout:Xe=Ts;}catch{Xe=Ts;}try{typeof clearTimeout=="function"?Ze=clearTimeout:Ze=Rs;}catch{Ze=Rs;}})();function uf(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===Ts||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(t,0);try{return Xe(t,0)}catch{try{return Xe.call(null,t,0)}catch{return Xe.call(this,t,0)}}}function Hy(t){if(Ze===clearTimeout)return clearTimeout(t);if((Ze===Rs||!Ze)&&clearTimeout)return Ze=clearTimeout,clearTimeout(t);try{return Ze(t)}catch{try{return Ze.call(null,t)}catch{return Ze.call(this,t)}}}var wt=[],Mr=!1,er,Hi=-1;function Vy(){!Mr||!er||(Mr=!1,er.length?wt=er.concat(wt):Hi=-1,wt.length&&ff());}function ff(){if(!Mr){var t=uf(Vy);Mr=!0;for(var e=wt.length;e;){for(er=wt,wt=[];++Hi<e;)er&&er[Hi].run();Hi=-1,e=wt.length;}er=null,Mr=!1,Hy(t);}}ae.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];wt.push(new cf(t,e)),wt.length===1&&!Mr&&uf(ff);};function cf(t,e){this.fun=t,this.array=e;}cf.prototype.run=function(){this.fun.apply(null,this.array);};ae.title="browser";ae.browser=!0;ae.env={};ae.argv=[];ae.version="";ae.versions={};function _t(){}ae.on=_t;ae.addListener=_t;ae.once=_t;ae.off=_t;ae.removeListener=_t;ae.removeAllListeners=_t;ae.emit=_t;ae.prependListener=_t;ae.prependOnceListener=_t;ae.listeners=function(t){return []};ae.binding=function(t){throw new Error("process.binding is not supported")};ae.cwd=function(){return "/"};ae.chdir=function(t){throw new Error("process.chdir is not supported")};ae.umask=function(){return 0};});var tt=M((TI,Cf)=>{_();v();m();var{Symbol:Vi,SymbolAsyncIterator:df,SymbolIterator:pf,SymbolFor:gf}=ce(),yf=Vi("kDestroyed"),bf=Vi("kIsErrored"),Cs=Vi("kIsReadable"),wf=Vi("kIsDisturbed"),zy=gf("nodejs.webstream.isClosedPromise"),Ky=gf("nodejs.webstream.controllerErrorFunction");function zi(t,e=!1){var r;return !!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Ki(t){var e;return !!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Gy(t){return !!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function et(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function _f(t){return !!(t&&!et(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function mf(t){return !!(t&&!et(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function vf(t){return !!(t&&!et(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Qy(t){return _f(t)||mf(t)||vf(t)}function Yy(t,e){return t==null?!1:e===!0?typeof t[df]=="function":e===!1?typeof t[pf]=="function":typeof t[df]=="function"||typeof t[pf]=="function"}function Gi(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return !!(t.destroyed||t[yf]||i!=null&&i.destroyed)}function Ef(t){if(!Ki(t))return null;if(t.writableEnded===!0)return !0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Jy(t,e){if(!Ki(t))return null;if(t.writableFinished===!0)return !0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Xy(t){if(!zi(t))return null;if(t.readableEnded===!0)return !0;let e=t._readableState;return !e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Sf(t,e){if(!zi(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Af(t){return t&&t[Cs]!=null?t[Cs]:typeof t?.readable!="boolean"?null:Gi(t)?!1:zi(t)&&t.readable&&!Sf(t)}function If(t){return typeof t?.writable!="boolean"?null:Gi(t)?!1:Ki(t)&&t.writable&&!Ef(t)}function Zy(t,e){return et(t)?Gi(t)?!0:!(e?.readable!==!1&&Af(t)||e?.writable!==!1&&If(t)):null}function eb(t){var e,r;return et(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function tb(t){var e,r;return et(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function rb(t){if(!et(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Tf(t)?t._closed:null}function Tf(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Rf(t){return typeof t._sent100=="boolean"&&Tf(t)}function ib(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function nb(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return !i&&Rf(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function sb(t){var e;return !!(t&&((e=t[wf])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function ob(t){var e,r,i,n,o,s,a,u,c,h;return !!(t&&((e=(r=(i=(n=(o=(s=t[bf])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((h=t._writableState)===null||h===void 0)&&h.errored))}Cf.exports={kDestroyed:yf,isDisturbed:sb,kIsDisturbed:wf,isErrored:ob,kIsErrored:bf,isReadable:Af,kIsReadable:Cs,kIsClosedPromise:zy,kControllerErrorFunction:Ky,isClosed:rb,isDestroyed:Gi,isDuplexNodeStream:Gy,isFinished:Zy,isIterable:Yy,isReadableNodeStream:zi,isReadableStream:_f,isReadableEnded:Xy,isReadableFinished:Sf,isReadableErrored:tb,isNodeStream:et,isWebStream:Qy,isWritable:If,isWritableNodeStream:Ki,isWritableStream:mf,isWritableEnded:Ef,isWritableFinished:Jy,isWritableErrored:eb,isServerRequest:ib,isServerResponse:Rf,willEmitClose:nb,isTransformStream:vf};});var mt=M((UI,ks)=>{_();v();m();var Nt=Ut(),{AbortError:Nf,codes:ab}=Se(),{ERR_INVALID_ARG_TYPE:lb,ERR_STREAM_PREMATURE_CLOSE:Bf}=ab,{kEmptyObject:Ps,once:Os}=Je(),{validateAbortSignal:ub,validateFunction:fb,validateObject:cb,validateBoolean:hb}=ui(),{Promise:db,PromisePrototypeThen:pb}=ce(),{isClosed:gb,isReadable:Pf,isReadableNodeStream:Bs,isReadableStream:yb,isReadableFinished:Of,isReadableErrored:xf,isWritable:kf,isWritableNodeStream:Mf,isWritableStream:bb,isWritableFinished:Lf,isWritableErrored:Uf,isNodeStream:wb,willEmitClose:_b,kIsClosedPromise:mb}=tt();function vb(t){return t.setHeader&&typeof t.abort=="function"}var xs=()=>{};function qf(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ps):e==null?e=Ps:cb(e,"options"),fb(r,"callback"),ub(e.signal,"options.signal"),r=Os(r),yb(t)||bb(t))return Eb(t,e,r);if(!wb(t))throw new lb("stream",["ReadableStream","WritableStream","Stream"],t);let o=(i=e.readable)!==null&&i!==void 0?i:Bs(t),s=(n=e.writable)!==null&&n!==void 0?n:Mf(t),a=t._writableState,u=t._readableState,c=()=>{t.writable||g();},h=_b(t)&&Bs(t)===o&&Mf(t)===s,d=Lf(t,!1),g=()=>{d=!0,t.destroyed&&(h=!1),!(h&&(!t.readable||o))&&(!o||y)&&r.call(t);},y=Of(t,!1),w=()=>{y=!0,t.destroyed&&(h=!1),!(h&&(!t.writable||s))&&(!s||d)&&r.call(t);},E=N=>{r.call(t,N);},S=gb(t),I=()=>{S=!0;let N=Uf(t)||xf(t);if(N&&typeof N!="boolean")return r.call(t,N);if(o&&!y&&Bs(t,!0)&&!Of(t,!1))return r.call(t,new Bf);if(s&&!d&&!Lf(t,!1))return r.call(t,new Bf);r.call(t);},C=()=>{S=!0;let N=Uf(t)||xf(t);if(N&&typeof N!="boolean")return r.call(t,N);r.call(t);},R=()=>{t.req.on("finish",g);};vb(t)?(t.on("complete",g),h||t.on("abort",I),t.req?R():t.on("request",R)):s&&!a&&(t.on("end",c),t.on("close",c)),!h&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",w),t.on("finish",g),e.error!==!1&&t.on("error",E),t.on("close",I),S?Nt.nextTick(I):a!=null&&a.errorEmitted||u!=null&&u.errorEmitted?h||Nt.nextTick(C):(!o&&(!h||Pf(t))&&(d||kf(t)===!1)||!s&&(!h||kf(t))&&(y||Pf(t)===!1)||u&&t.req&&t.aborted)&&Nt.nextTick(C);let U=()=>{r=xs,t.removeListener("aborted",I),t.removeListener("complete",g),t.removeListener("abort",I),t.removeListener("request",R),t.req&&t.req.removeListener("finish",g),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",g),t.removeListener("end",w),t.removeListener("error",E),t.removeListener("close",I);};if(e.signal&&!S){let N=()=>{let W=r;U(),W.call(t,new Nf(void 0,{cause:e.signal.reason}));};if(e.signal.aborted)Nt.nextTick(N);else {let W=r;r=Os((...K)=>{e.signal.removeEventListener("abort",N),W.apply(t,K);}),e.signal.addEventListener("abort",N);}}return U}function Eb(t,e,r){let i=!1,n=xs;if(e.signal)if(n=()=>{i=!0,r.call(t,new Nf(void 0,{cause:e.signal.reason}));},e.signal.aborted)Nt.nextTick(n);else {let s=r;r=Os((...a)=>{e.signal.removeEventListener("abort",n),s.apply(t,a);}),e.signal.addEventListener("abort",n);}let o=(...s)=>{i||Nt.nextTick(()=>r.apply(t,s));};return pb(t[mb].promise,o,o),xs}function Sb(t,e){var r;let i=!1;return e===null&&(e=Ps),(r=e)!==null&&r!==void 0&&r.cleanup&&(hb(e.cleanup,"cleanup"),i=e.cleanup),new db((n,o)=>{let s=qf(t,e,a=>{i&&s(),a?o(a):n();});})}ks.exports=qf;ks.exports.finished=Sb;});var tr=M((zI,zf)=>{_();v();m();var rt=Ut(),{aggregateTwoErrors:Ab,codes:{ERR_MULTIPLE_CALLBACK:Ib},AbortError:Tb}=Se(),{Symbol:Ff}=ce(),{kDestroyed:Rb,isDestroyed:Cb,isFinished:Bb,isServerRequest:Pb}=tt(),Wf=Ff("kDestroy"),Ms=Ff("kConstruct");function $f(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t));}function Ob(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):($f(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Df(this,t,e):this.once(Wf,function(o){Df(this,Ab(o,t),e);}),this)}function Df(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,a=t._writableState;$f(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?rt.nextTick(xb,t,o):rt.nextTick(Hf,t);}try{t._destroy(e||null,n);}catch(o){n(o);}}function xb(t,e){Ls(t,e),Hf(t);}function Hf(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close");}function Ls(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e));}function kb(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1);}function Us(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?rt.nextTick(Ls,t,e):Ls(t,e));}function Mb(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Ms,e),!(t.listenerCount(Ms)>1)&&rt.nextTick(Lb,t);}function Lb(t){let e=!1;function r(i){if(e){Us(t,i??new Ib);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Wf,i):i?Us(t,i,!0):rt.nextTick(Ub,t);}try{t._construct(i=>{rt.nextTick(r,i);});}catch(i){rt.nextTick(r,i);}}function Ub(t){t.emit(Ms);}function jf(t){return t?.setHeader&&typeof t.abort=="function"}function Vf(t){t.emit("close");}function Nb(t,e){t.emit("error",e),rt.nextTick(Vf,t);}function qb(t,e){!t||Cb(t)||(!e&&!Bb(t)&&(e=new Tb),Pb(t)?(t.socket=null,t.destroy(e)):jf(t)?t.abort():jf(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?rt.nextTick(Nb,t,e):rt.nextTick(Vf,t),t.destroyed||(t[Rb]=!0));}zf.exports={construct:Mb,destroyer:qb,destroy:Ob,undestroy:kb,errorOrDestroy:Us};});function Y(){Y.init.call(this);}function Qi(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function rc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Yf(t,e,r,i){var n,o,s,a;if(Qi(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=rc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a);}return t}function Db(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Jf(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Db.bind(i);return n.listener=r,i.wrapFn=n,n}function Xf(t,e,r){var i=t._events;if(i===void 0)return [];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),a=0;a<s.length;++a)s[a]=o[a].listener||o[a];return s}(n):ic(n,n.length)}function Zf(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}function ic(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}var ec,tc,Lr,Kf,Gf,Qf,Be,Ns=be(()=>{_();v();m();Lr=typeof Reflect=="object"?Reflect:null,Kf=Lr&&typeof Lr.apply=="function"?Lr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};tc=Lr&&typeof Lr.ownKeys=="function"?Lr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Gf=Number.isNaN||function(t){return t!=t};ec=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Qf=10;Object.defineProperty(Y,"defaultMaxListeners",{enumerable:!0,get:function(){return Qf},set:function(t){if(typeof t!="number"||t<0||Gf(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Qf=t;}}),Y.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},Y.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Gf(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return rc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i=t==="error",n=this._events;if(n!==void 0)i=i&&n.error===void 0;else if(!i)return !1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[t];if(a===void 0)return !1;if(typeof a=="function")Kf(a,this,e);else {var u=a.length,c=ic(a,u);for(r=0;r<u;++r)Kf(c[r],this,e);}return !0},Y.prototype.addListener=function(t,e){return Yf(this,t,e,!1)},Y.prototype.on=Y.prototype.addListener,Y.prototype.prependListener=function(t,e){return Yf(this,t,e,!0)},Y.prototype.once=function(t,e){return Qi(e),this.on(t,Jf(this,t,e)),this},Y.prototype.prependOnceListener=function(t,e){return Qi(e),this.prependListener(t,Jf(this,t,e)),this},Y.prototype.removeListener=function(t,e){var r,i,n,o,s;if(Qi(e),(i=this._events)===void 0)return this;if((r=i[t])===void 0)return this;if(r===e||r.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if(typeof r!="function"){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(a,u){for(;u+1<a.length;u++)a[u]=a[u+1];a.pop();}(r,n),r.length===1&&(i[t]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",t,s||e);}return this},Y.prototype.off=Y.prototype.removeListener,Y.prototype.removeAllListeners=function(t){var e,r,i;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var n,o=Object.keys(r);for(i=0;i<o.length;++i)(n=o[i])!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=r[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return Xf(this,t,!0)},Y.prototype.rawListeners=function(t){return Xf(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zf.call(t,e)},Y.prototype.listenerCount=Zf,Y.prototype.eventNames=function(){return this._eventsCount>0?tc(this._events):[]};Be=ec;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount;});var rr={};Qt(rr,{EventEmitter:()=>jb,default:()=>Be,defaultMaxListeners:()=>Fb,init:()=>Wb,listenerCount:()=>$b,on:()=>Hb,once:()=>Vb});var jb,Fb,Wb,$b,Hb,Vb,ir=be(()=>{_();v();m();Ns();Ns();Be.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener("error",o),r(s);}let o;e!=="error"&&(o=s=>{t.removeListener(name,n),i(s);},t.once("error",o)),t.once(e,n);})};Be.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let c=r.shift();if(c)return createIterResult(c,!1);if(n){let h=Promise.reject(n);return n=null,h}return o?createIterResult(void 0,!0):new Promise((h,d)=>i.push({resolve:h,reject:d}))},async return(){t.removeListener(e,a),t.removeListener("error",u),o=!0;for(let c of i)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){n=c,t.removeListener(e,a),t.removeListener("error",u);},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",u),s;function a(...c){let h=i.shift();h?h.resolve(createIterResult(c,!1)):r.push(c);}function u(c){o=!0;let h=i.shift();h?h.reject(c):n=c,s.return();}};({EventEmitter:jb,defaultMaxListeners:Fb,init:Wb,listenerCount:$b,on:Hb,once:Vb}=Be);});var Xi=M((ST,sc)=>{_();v();m();var{ArrayIsArray:zb,ObjectSetPrototypeOf:nc}=ce(),{EventEmitter:Yi}=(ir(),Z(rr));function Ji(t){Yi.call(this,t);}nc(Ji.prototype,Yi.prototype);nc(Ji,Yi);Ji.prototype.pipe=function(t,e){let r=this;function i(h){t.writable&&t.write(h)===!1&&r.pause&&r.pause();}r.on("data",i);function n(){r.readable&&r.resume&&r.resume();}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end());}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy());}function u(h){c(),Yi.listenerCount(this,"error")===0&&this.emit("error",h);}qs(r,"error",u),qs(t,"error",u);function c(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c);}return r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t};function qs(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):zb(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]];}sc.exports={Stream:Ji,prependListener:qs};});var fi=M((kT,Zi)=>{_();v();m();var{AbortError:oc,codes:Kb}=Se(),{isNodeStream:ac,isWebStream:Gb,kControllerErrorFunction:Qb}=tt(),Yb=mt(),{ERR_INVALID_ARG_TYPE:lc}=Kb,Jb=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new lc(e,"AbortSignal",t)};Zi.exports.addAbortSignal=function(e,r){if(Jb(e,"signal"),!ac(r)&&!Gb(r))throw new lc("stream",["ReadableStream","WritableStream","Stream"],r);return Zi.exports.addAbortSignalNoValidate(e,r)};Zi.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=ac(e)?()=>{e.destroy(new oc(void 0,{cause:t.reason}));}:()=>{e[Qb](new oc(void 0,{cause:t.reason}));};return t.aborted?r():(t.addEventListener("abort",r),Yb(e,()=>t.removeEventListener("abort",r))),e};});var cc=M((HT,fc)=>{_();v();m();var{StringPrototypeSlice:uc,SymbolIterator:Xb,TypedArrayPrototypeSet:en,Uint8Array:Zb}=ce(),{Buffer:Ds}=(we(),Z(ve)),{inspect:ew}=Je();fc.exports=class{constructor(){this.head=null,this.tail=null,this.length=0;}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length;}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length;}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0;}join(e){if(this.length===0)return "";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Ds.alloc(0);let r=Ds.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)en(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Xb](){for(let e=this.head;e;e=e.next)yield e.data;}_getString(e){let r="",i=this.head,n=0;do{let o=i.data;if(e>o.length)r+=o,e-=o.length;else {e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=uc(o,0,e),this.head=i,i.data=uc(o,e));break}++n;}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Ds.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)en(r,s,i-e),e-=s.length;else {e===s.length?(en(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(en(r,new Zb(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o;}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return ew(this,{...r,depth:0,customInspect:!1})}};});var tn=M((e2,dc)=>{_();v();m();var{MathFloor:tw,NumberIsInteger:rw}=ce(),{ERR_INVALID_ARG_VALUE:iw}=Se().codes;function nw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function hc(t){return t?16:16*1024}function sw(t,e,r,i){let n=nw(e,i,r);if(n!=null){if(!rw(n)||n<0){let o=i?`options.${r}`:"options.highWaterMark";throw new iw(o,n)}return tw(n)}return hc(t.objectMode)}dc.exports={getHighWaterMark:sw,getDefaultHighWaterMark:hc};});function yc(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return r===-1&&(r=e),[r,r===e?0:4-r%4]}function ow(t,e,r){for(var i,n,o=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push($e[(n=i)>>18&63]+$e[n>>12&63]+$e[n>>6&63]+$e[63&n]);return o.join("")}function vt(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,k.prototype),e}function k(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return $s(t)}return Tc(t,e,r)}function Tc(t,e,r){if(typeof t=="string")return function(o,s){if(typeof s=="string"&&s!==""||(s="utf8"),!k.isEncoding(s))throw new TypeError("Unknown encoding: "+s);var a=0|Cc(o,s),u=vt(a),c=u.write(o,s);return c!==a&&(u=u.slice(0,c)),u}(t,e);if(ArrayBuffer.isView(t))return js(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Et(t,ArrayBuffer)||t&&Et(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Et(t,SharedArrayBuffer)||t&&Et(t.buffer,SharedArrayBuffer)))return wc(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return k.from(i,e,r);var n=function(o){if(k.isBuffer(o)){var s=0|zs(o.length),a=vt(s);return a.length===0||o.copy(a,0,0,s),a}if(o.length!==void 0)return typeof o.length!="number"||Ks(o.length)?vt(0):js(o);if(o.type==="Buffer"&&Array.isArray(o.data))return js(o.data)}(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return k.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function Rc(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function $s(t){return Rc(t),vt(t<0?0:0|zs(t))}function js(t){for(var e=t.length<0?0:0|zs(t.length),r=vt(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function wc(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=e===void 0&&r===void 0?new Uint8Array(t):r===void 0?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(i,k.prototype),i}function zs(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|t}function Cc(t,e){if(k.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Et(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Hs(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return xc(t).length;default:if(n)return i?-1:Hs(t).length;e=(""+e).toLowerCase(),n=!0;}}function lw(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(e>>>=0))return "";for(t||(t="utf8");;)switch(t){case"hex":return bw(this,e,r);case"utf8":case"utf-8":return Pc(this,e,r);case"ascii":return gw(this,e,r);case"latin1":case"binary":return yw(this,e,r);case"base64":return pw(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ww(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0;}}function sr(t,e,r){var i=t[e];t[e]=t[r],t[r]=i;}function _c(t,e,r,i,n){if(t.length===0)return -1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Ks(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return -1;r=t.length-1;}else if(r<0){if(!n)return -1;r=0;}if(typeof e=="string"&&(e=k.from(e,i)),k.isBuffer(e))return e.length===0?-1:mc(t,e,r,i,n);if(typeof e=="number")return e&=255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):mc(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function mc(t,e,r,i,n){var o,s=1,a=t.length,u=e.length;if(i!==void 0&&((i=String(i).toLowerCase())==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return -1;s=2,a/=2,u/=2,r/=2;}function c(y,w){return s===1?y[w]:y.readUInt16BE(w*s)}if(n){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,h===-1?0:o-h)){if(h===-1&&(h=o),o-h+1===u)return h*s}else h!==-1&&(o-=o-h),h=-1;}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var d=!0,g=0;g<u;g++)if(c(t,o+g)!==c(e,g)){d=!1;break}if(d)return o}return -1}function uw(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(Ks(a))return s;t[r+s]=a;}return s}function fw(t,e,r,i){return on(Hs(e,t.length-r),t,r,i)}function Bc(t,e,r,i){return on(function(n){for(var o=[],s=0;s<n.length;++s)o.push(255&n.charCodeAt(s));return o}(e),t,r,i)}function cw(t,e,r,i){return Bc(t,e,r,i)}function hw(t,e,r,i){return on(xc(e),t,r,i)}function dw(t,e,r,i){return on(function(n,o){for(var s,a,u,c=[],h=0;h<n.length&&!((o-=2)<0);++h)s=n.charCodeAt(h),a=s>>8,u=s%256,c.push(u),c.push(a);return c}(e,t.length-r),t,r,i)}function pw(t,e,r){return e===0&&r===t.length?Ws.fromByteArray(t):Ws.fromByteArray(t.slice(e,r))}function Pc(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,s,a,u,c=t[n],h=null,d=c>239?4:c>223?3:c>191?2:1;if(n+d<=r)switch(d){case 1:c<128&&(h=c);break;case 2:(192&(o=t[n+1]))==128&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[n+1],s=t[n+2],(192&o)==128&&(192&s)==128&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u);}h===null?(h=65533,d=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=d;}return function(g){var y=g.length;if(y<=4096)return String.fromCharCode.apply(String,g);for(var w="",E=0;E<y;)w+=String.fromCharCode.apply(String,g.slice(E,E+=4096));return w}(i)}function gw(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function yw(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function bw(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=mw[t[o]];return n}function ww(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function ye(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Pe(t,e,r,i,n,o){if(!k.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function Oc(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function vc(t,e,r,i,n){return e=+e,r>>>=0,n||Oc(t,0,r,4),Ur.write(t,e,r,i,23,4),r+4}function Ec(t,e,r,i,n){return e=+e,r>>>=0,n||Oc(t,0,r,8),Ur.write(t,e,r,i,52,8),r+8}function Hs(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s<i;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320);}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r);}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function xc(t){return Ws.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_w,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}(t))}function on(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Et(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ks(t){return t!=t}function Sc(t,e){for(var r in t)e[r]=t[r];}function or(t,e,r){return it(t,e,r)}function ci(t){var e;switch(this.encoding=function(r){var i=function(n){if(!n)return "utf8";for(var o;;)switch(n){case"utf8":case"utf-8":return "utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return "utf16le";case"latin1":case"binary":return "latin1";case"base64":case"ascii":case"hex":return n;default:if(o)return;n=(""+n).toLowerCase(),o=!0;}}(r);if(typeof i!="string"&&(Vs.isEncoding===Ac||!Ac(r)))throw new Error("Unknown encoding: "+r);return i||r}(t),this.encoding){case"utf16le":this.text=Sw,this.end=Aw,e=4;break;case"utf8":this.fillLast=Ew,e=4;break;case"base64":this.text=Iw,this.end=Tw,e=3;break;default:return this.write=Rw,this.end=Cw,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=Vs.allocUnsafe(e);}function Fs(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function Ew(t){var e=this.lastTotal-this.lastNeed,r=function(i,n,o){if((192&n[0])!=128)return i.lastNeed=0,"\uFFFD";if(i.lastNeed>1&&n.length>1){if((192&n[1])!=128)return i.lastNeed=1,"\uFFFD";if(i.lastNeed>2&&n.length>2&&(192&n[2])!=128)return i.lastNeed=2,"\uFFFD"}}(this,t);return r!==void 0?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length,void 0)}function Sw(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Aw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Iw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Tw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Rw(t){return t.toString(this.encoding)}function Cw(t){return t&&t.length?this.write(t):""}var Ic,$e,xe,pc,rn,nr,gc,aw,St,Ws,Ur,bc,_w,mw,nn,sn,it,vw,ar,Vs,Ac,Gs=be(()=>{_();v();m();for(Ic={byteLength:function(t){var e=yc(t),r=e[0],i=e[1];return 3*(r+i)/4-i},toByteArray:function(t){var e,r,i=yc(t),n=i[0],o=i[1],s=new pc(function(c,h,d){return 3*(h+d)/4-d}(0,n,o)),a=0,u=o>0?n-4:n;for(r=0;r<u;r+=4)e=xe[t.charCodeAt(r)]<<18|xe[t.charCodeAt(r+1)]<<12|xe[t.charCodeAt(r+2)]<<6|xe[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=xe[t.charCodeAt(r)]<<2|xe[t.charCodeAt(r+1)]>>4,s[a++]=255&e),o===1&&(e=xe[t.charCodeAt(r)]<<10|xe[t.charCodeAt(r+1)]<<4|xe[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,s=r-i;o<s;o+=16383)n.push(ow(t,o,o+16383>s?s:o+16383));return i===1?(e=t[r-1],n.push($e[e>>2]+$e[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push($e[e>>10]+$e[e>>4&63]+$e[e<<2&63]+"=")),n.join("")}},$e=[],xe=[],pc=typeof Uint8Array<"u"?Uint8Array:Array,rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nr=0,gc=rn.length;nr<gc;++nr)$e[nr]=rn[nr],xe[rn.charCodeAt(nr)]=nr;xe["-".charCodeAt(0)]=62,xe["_".charCodeAt(0)]=63;aw={read:function(t,e,r,i,n){var o,s,a=8*n-i-1,u=(1<<a)-1,c=u>>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=256*o+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else {if(o===u)return s?NaN:1/0*(y?-1:1);s+=Math.pow(2,i),o-=c;}return (y?-1:1)*s*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var s,a,u,c=8*o-n-1,h=(1<<c)-1,d=h>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+d>=1?g/u:g*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*u-1)*Math.pow(2,n),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=255&a,y+=w,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;t[r+y]=255&s,y+=w,s/=256,c-=8);t[r+y-w]|=128*E;}},St={},Ws=Ic,Ur=aw,bc=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;St.Buffer=k,St.SlowBuffer=function(t){return +t!=t&&(t=0),k.alloc(+t)},St.INSPECT_MAX_BYTES=50;St.kMaxLength=2147483647,k.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return !1}}(),k.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(k.prototype,"parent",{enumerable:!0,get:function(){if(k.isBuffer(this))return this.buffer}}),Object.defineProperty(k.prototype,"offset",{enumerable:!0,get:function(){if(k.isBuffer(this))return this.byteOffset}}),k.poolSize=8192,k.from=function(t,e,r){return Tc(t,e,r)},Object.setPrototypeOf(k.prototype,Uint8Array.prototype),Object.setPrototypeOf(k,Uint8Array),k.alloc=function(t,e,r){return function(i,n,o){return Rc(i),i<=0?vt(i):n!==void 0?typeof o=="string"?vt(i).fill(n,o):vt(i).fill(n):vt(i)}(t,e,r)},k.allocUnsafe=function(t){return $s(t)},k.allocUnsafeSlow=function(t){return $s(t)},k.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==k.prototype},k.compare=function(t,e){if(Et(t,Uint8Array)&&(t=k.from(t,t.offset,t.byteLength)),Et(e,Uint8Array)&&(e=k.from(e,e.offset,e.byteLength)),!k.isBuffer(t)||!k.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},k.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},k.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return k.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=k.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(Et(o,Uint8Array)&&(o=k.from(o)),!k.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length;}return i},k.byteLength=Cc,k.prototype._isBuffer=!0,k.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)sr(this,e,e+1);return this},k.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)sr(this,e,e+3),sr(this,e+1,e+2);return this},k.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)sr(this,e,e+7),sr(this,e+1,e+6),sr(this,e+2,e+5),sr(this,e+3,e+4);return this},k.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?Pc(this,0,t):lw.apply(this,arguments)},k.prototype.toLocaleString=k.prototype.toString,k.prototype.equals=function(t){if(!k.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||k.compare(this,t)===0},k.prototype.inspect=function(){var t="",e=St.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},bc&&(k.prototype[bc]=k.prototype.inspect),k.prototype.compare=function(t,e,r,i,n){if(Et(t,Uint8Array)&&(t=k.from(t,t.offset,t.byteLength)),!k.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),n===void 0&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return -1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(i,n),c=t.slice(e,r),h=0;h<a;++h)if(u[h]!==c[h]){o=u[h],s=c[h];break}return o<s?-1:s<o?1:0},k.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},k.prototype.indexOf=function(t,e,r){return _c(this,t,e,r,!0)},k.prototype.lastIndexOf=function(t,e,r){return _c(this,t,e,r,!1)},k.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else {if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,i===void 0&&(i="utf8")):(i=r,r=void 0);}var n=this.length-e;if((r===void 0||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return uw(this,t,e,r);case"utf8":case"utf-8":return fw(this,t,e,r);case"ascii":return Bc(this,t,e,r);case"latin1":case"binary":return cw(this,t,e,r);case"base64":return hw(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dw(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0;}},k.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};k.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i=this.subarray(t,e);return Object.setPrototypeOf(i,k.prototype),i},k.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||ye(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},k.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||ye(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},k.prototype.readUInt8=function(t,e){return t>>>=0,e||ye(t,1,this.length),this[t]},k.prototype.readUInt16LE=function(t,e){return t>>>=0,e||ye(t,2,this.length),this[t]|this[t+1]<<8},k.prototype.readUInt16BE=function(t,e){return t>>>=0,e||ye(t,2,this.length),this[t]<<8|this[t+1]},k.prototype.readUInt32LE=function(t,e){return t>>>=0,e||ye(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},k.prototype.readUInt32BE=function(t,e){return t>>>=0,e||ye(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},k.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||ye(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},k.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||ye(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},k.prototype.readInt8=function(t,e){return t>>>=0,e||ye(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},k.prototype.readInt16LE=function(t,e){t>>>=0,e||ye(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},k.prototype.readInt16BE=function(t,e){t>>>=0,e||ye(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},k.prototype.readInt32LE=function(t,e){return t>>>=0,e||ye(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},k.prototype.readInt32BE=function(t,e){return t>>>=0,e||ye(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},k.prototype.readFloatLE=function(t,e){return t>>>=0,e||ye(t,4,this.length),Ur.read(this,t,!0,23,4)},k.prototype.readFloatBE=function(t,e){return t>>>=0,e||ye(t,4,this.length),Ur.read(this,t,!1,23,4)},k.prototype.readDoubleLE=function(t,e){return t>>>=0,e||ye(t,8,this.length),Ur.read(this,t,!0,52,8)},k.prototype.readDoubleBE=function(t,e){return t>>>=0,e||ye(t,8,this.length),Ur.read(this,t,!1,52,8)},k.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},k.prototype.writeUIntBE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},k.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,255,0),this[e]=255&t,e+1},k.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},k.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},k.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},k.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},k.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n);}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},k.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n);}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},k.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},k.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},k.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},k.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},k.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},k.prototype.writeFloatLE=function(t,e,r){return vc(this,t,e,!0,r)},k.prototype.writeFloatBE=function(t,e,r){return vc(this,t,e,!1,r)},k.prototype.writeDoubleLE=function(t,e,r){return Ec(this,t,e,!0,r)},k.prototype.writeDoubleBE=function(t,e,r){return Ec(this,t,e,!1,r)},k.prototype.copy=function(t,e,r,i){if(!k.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||i===0||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n=i-r;if(this===t&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(e,r,i);else if(this===t&&r<e&&e<i)for(var o=n-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},k.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!k.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var n=t.charCodeAt(0);(i==="utf8"&&n<128||i==="latin1")&&(t=n);}}else typeof t=="number"?t&=255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t=="number")for(o=e;o<r;++o)this[o]=t;else {var s=k.isBuffer(t)?t:k.from(t,i),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a];}return this};_w=/[^+/0-9A-Za-z-_]/g;mw=function(){for(var t=new Array(256),e=0;e<16;++e)for(var r=16*e,i=0;i<16;++i)t[r+i]="0123456789abcdef"[e]+"0123456789abcdef"[i];return t}();St.Buffer;St.INSPECT_MAX_BYTES;St.kMaxLength;nn={},sn=St,it=sn.Buffer;it.from&&it.alloc&&it.allocUnsafe&&it.allocUnsafeSlow?nn=sn:(Sc(sn,nn),nn.Buffer=or),or.prototype=Object.create(it.prototype),Sc(it,or),or.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return it(t,e,r)},or.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=it(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i},or.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return it(t)},or.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sn.SlowBuffer(t)};vw=nn,ar={},Vs=vw.Buffer,Ac=Vs.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return !0;default:return !1}};ar.StringDecoder=ci,ci.prototype.write=function(t){if(t.length===0)return "";var e,r;if(this.lastNeed){if((e=this.fillLast(t))===void 0)return "";r=this.lastNeed,this.lastNeed=0;}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},ci.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e},ci.prototype.text=function(t,e){var r=function(n,o,s){var a=o.length-1;if(a<s)return 0;var u=Fs(o[a]);return u>=0?(u>0&&(n.lastNeed=u-1),u):--a<s||u===-2?0:(u=Fs(o[a]))>=0?(u>0&&(n.lastNeed=u-2),u):--a<s||u===-2?0:(u=Fs(o[a]))>=0?(u>0&&(u===2?u=0:n.lastNeed=u-3),u):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},ci.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length;};ar.StringDecoder;ar.StringDecoder;});var kc={};Qt(kc,{StringDecoder:()=>Bw,default:()=>ar});var Bw,Mc=be(()=>{_();v();m();Gs();Gs();Bw=ar.StringDecoder;});var Qs=M((O2,qc)=>{_();v();m();var Lc=Ut(),{PromisePrototypeThen:Pw,SymbolAsyncIterator:Uc,SymbolIterator:Nc}=ce(),{Buffer:Ow}=(we(),Z(ve)),{ERR_INVALID_ARG_TYPE:xw,ERR_STREAM_NULL_VALUES:kw}=Se().codes;function Mw(t,e,r){let i;if(typeof e=="string"||e instanceof Ow)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null);}});let n;if(e&&e[Uc])n=!0,i=e[Uc]();else if(e&&e[Nc])n=!1,i=e[Nc]();else throw new xw("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,u());},o._destroy=function(c,h){Pw(a(c),()=>Lc.nextTick(h,c),d=>Lc.nextTick(h,d||c));};async function a(c){let h=c!=null,d=typeof i.throw=="function";if(h&&d){let{value:g,done:y}=await i.throw(c);if(await g,y)return}if(typeof i.return=="function"){let{value:g}=await i.return();await g;}}async function u(){for(;;){try{let{value:c,done:h}=n?await i.next():i.next();if(h)o.push(null);else {let d=c&&typeof c.then=="function"?await c:c;if(d===null)throw s=!1,new kw;if(o.push(d))continue;s=!1;}}catch(c){o.destroy(c);}break}}return o}qc.exports=Mw;});var hi=M((F2,Jc)=>{_();v();m();var He=Ut(),{ArrayPrototypeIndexOf:Lw,NumberIsInteger:Uw,NumberIsNaN:Nw,NumberParseInt:qw,ObjectDefineProperties:Fc,ObjectKeys:Dw,ObjectSetPrototypeOf:Wc,Promise:jw,SafeSet:Fw,SymbolAsyncIterator:Ww,Symbol:$w}=ce();Jc.exports=F;F.ReadableState=to;var{EventEmitter:Hw}=(ir(),Z(rr)),{Stream:qt,prependListener:Vw}=Xi(),{Buffer:Ys}=(we(),Z(ve)),{addAbortSignal:zw}=fi(),Kw=mt(),H=Je().debuglog("stream",t=>{H=t;}),Gw=cc(),qr=tr(),{getHighWaterMark:Qw,getDefaultHighWaterMark:Yw}=tn(),{aggregateTwoErrors:Dc,codes:{ERR_INVALID_ARG_TYPE:Jw,ERR_METHOD_NOT_IMPLEMENTED:Xw,ERR_OUT_OF_RANGE:Zw,ERR_STREAM_PUSH_AFTER_EOF:e_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:t_}}=Se(),{validateObject:r_}=ui(),lr=$w("kPaused"),{StringDecoder:$c}=(Mc(),Z(kc)),i_=Qs();Wc(F.prototype,qt.prototype);Wc(F,qt);var Js=()=>{},{errorOrDestroy:Nr}=qr;function to(t,e,r){typeof r!="boolean"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?Qw(this,t,"readableHighWaterMark",r):Yw(!1),this.buffer=new Gw,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[lr]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new $c(t.encoding),this.encoding=t.encoding);}function F(t){if(!(this instanceof F))return new F(t);let e=this instanceof nt();this._readableState=new to(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&zw(t.signal,this)),qt.call(this,t),qr.construct(this,()=>{this._readableState.needReadable&&an(this,this._readableState);});}F.prototype.destroy=qr.destroy;F.prototype._undestroy=qr.undestroy;F.prototype._destroy=function(t,e){e(t);};F.prototype[Hw.captureRejectionSymbol]=function(t){this.destroy(t);};F.prototype.push=function(t,e){return Hc(this,t,e,!1)};F.prototype.unshift=function(t,e){return Hc(this,t,e,!0)};function Hc(t,e,r,i){H("readableAddChunk",e);let n=t._readableState,o;if(n.objectMode||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Ys.from(e,r).toString(n.encoding):(e=Ys.from(e,r),r=""))):e instanceof Ys?r="":qt._isUint8Array(e)?(e=qt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new Jw("chunk",["string","Buffer","Uint8Array"],e))),o)Nr(t,o);else if(e===null)n.reading=!1,o_(t,n);else if(n.objectMode||e&&e.length>0)if(i)if(n.endEmitted)Nr(t,new t_);else {if(n.destroyed||n.errored)return !1;Xs(t,n,e,!0);}else if(n.ended)Nr(t,new e_);else {if(n.destroyed||n.errored)return !1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Xs(t,n,e,!1):an(t,n)):Xs(t,n,e,!1);}else i||(n.reading=!1,an(t,n));return !n.ended&&(n.length<n.highWaterMark||n.length===0)}function Xs(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&ln(t)),an(t,e);}F.prototype.isPaused=function(){let t=this._readableState;return t[lr]===!0||t.flowing===!1};F.prototype.setEncoding=function(t){let e=new $c(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var n_=1073741824;function s_(t){if(t>n_)throw new Zw("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function jc(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:Nw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}F.prototype.read=function(t){H("read",t),t===void 0?t=NaN:Uw(t)||(t=qw(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=s_(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Zs(this):ln(this),null;if(t=jc(t,e),t===0&&e.ended)return e.length===0&&Zs(this),null;let i=e.needReadable;if(H("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,H("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,H("reading, ended or constructing",i);else if(i){H("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0);try{this._read(e.highWaterMark);}catch(o){Nr(this,o);}e.sync=!1,e.reading||(t=jc(r,e));}let n;return t>0?n=Qc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Zs(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function o_(t,e){if(H("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length);}e.ended=!0,e.sync?ln(t):(e.needReadable=!1,e.emittedReadable=!0,Vc(t));}}function ln(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,He.nextTick(Vc,t));}function Vc(t){let e=t._readableState;H("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Kc(t);}function an(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,He.nextTick(a_,t,e));}function a_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(H("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1;}F.prototype._read=function(t){throw new Xw("_read()")};F.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Fw(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),H("pipe count=%d opts=%j",i.pipes.length,e);let o=(!e||e.end!==!1)&&t!==He.stdout&&t!==He.stderr?a:S;i.endEmitted?He.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(I,C){H("onunpipe"),I===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,h());}function a(){H("onend"),t.end();}let u,c=!1;function h(){H("cleanup"),t.removeListener("close",w),t.removeListener("finish",E),u&&t.removeListener("drain",u),t.removeListener("error",y),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",S),r.removeListener("data",g),c=!0,u&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u();}function d(){c||(i.pipes.length===1&&i.pipes[0]===t?(H("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(H("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),u||(u=l_(r,t),t.on("drain",u));}r.on("data",g);function g(I){H("ondata");let C=t.write(I);H("dest.write",C),C===!1&&d();}function y(I){if(H("onerror",I),S(),t.removeListener("error",y),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?Nr(t,I):t.emit("error",I);}}Vw(t,"error",y);function w(){t.removeListener("finish",E),S();}t.once("close",w);function E(){H("onfinish"),t.removeListener("close",w),S();}t.once("finish",E);function S(){H("unpipe"),r.unpipe(t);}return t.emit("pipe",r),t.writableNeedDrain===!0?i.flowing&&d():i.flowing||(H("pipe resume"),r.resume()),t};function l_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume();}}F.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let i=Lw(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};F.prototype.on=function(t,e){let r=qt.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H("on readable",i.length,i.reading),i.length?ln(this):i.reading||He.nextTick(u_,this)),r};F.prototype.addListener=F.prototype.on;F.prototype.removeListener=function(t,e){let r=qt.prototype.removeListener.call(this,t,e);return t==="readable"&&He.nextTick(zc,this),r};F.prototype.off=F.prototype.removeListener;F.prototype.removeAllListeners=function(t){let e=qt.prototype.removeAllListeners.apply(this,arguments);return (t==="readable"||t===void 0)&&He.nextTick(zc,this),e};function zc(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[lr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null);}function u_(t){H("readable nexttick read 0"),t.read(0);}F.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,f_(this,t)),t[lr]=!1,this};function f_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,He.nextTick(c_,t,e));}function c_(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Kc(t),e.flowing&&!e.reading&&t.read(0);}F.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[lr]=!0,this};function Kc(t){let e=t._readableState;for(H("flow",e.flowing);e.flowing&&t.read()!==null;);}F.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause());}),t.on("end",()=>{this.push(null);}),t.on("error",i=>{Nr(this,i);}),t.on("close",()=>{this.destroy();}),t.on("destroy",()=>{this.destroy();}),this._read=()=>{e&&t.resume&&(e=!1,t.resume());};let r=Dw(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t));}return this};F.prototype[Ww]=function(){return Gc(this)};F.prototype.iterator=function(t){return t!==void 0&&r_(t,"options"),Gc(this,t)};function Gc(t,e){typeof t.read!="function"&&(t=F.wrap(t,{objectMode:!0}));let r=h_(t,e);return r.stream=t,r}async function*h_(t,e){let r=Js;function i(s){this===t?(r(),r=Js):r=s;}t.on("readable",i);let n,o=Kw(t,{writable:!1},s=>{n=s?Dc(n,s):null,r(),r=Js;});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else {if(n)throw n;if(n===null)return;await new jw(i);}}}catch(s){throw n=Dc(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?qr.destroyer(t,null):(t.off("readable",i),o());}}Fc(F.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return !!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t);}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return !!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t);}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t);}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Fc(to.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[lr]!==!1},set(t){this[lr]=!!t;}}});F._fromList=Qc;function Qc(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Zs(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,He.nextTick(d_,e,t));}function d_(t,e){if(H("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)He.nextTick(p_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy();}}}function p_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end();}F.from=function(t,e){return i_(F,t,e)};var eo;function Yc(){return eo===void 0&&(eo={}),eo}F.fromWeb=function(t,e){return Yc().newStreamReadableFromReadableStream(t,e)};F.toWeb=function(t,e){return Yc().newReadableStreamFromStreamReadable(t,e)};F.wrap=function(t,e){var r,i;return new F({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){qr.destroyer(t,n),o(n);}}).wrap(t)};});var lo=M((J2,uh)=>{_();v();m();var ur=Ut(),{ArrayPrototypeSlice:eh,Error:g_,FunctionPrototypeSymbolHasInstance:th,ObjectDefineProperty:rh,ObjectDefineProperties:y_,ObjectSetPrototypeOf:ih,StringPrototypeToLowerCase:b_,Symbol:w_,SymbolHasInstance:__}=ce();uh.exports=ie;ie.WritableState=gi;var{EventEmitter:m_}=(ir(),Z(rr)),di=Xi().Stream,{Buffer:un}=(we(),Z(ve)),hn=tr(),{addAbortSignal:v_}=fi(),{getHighWaterMark:E_,getDefaultHighWaterMark:S_}=tn(),{ERR_INVALID_ARG_TYPE:A_,ERR_METHOD_NOT_IMPLEMENTED:I_,ERR_MULTIPLE_CALLBACK:nh,ERR_STREAM_CANNOT_PIPE:T_,ERR_STREAM_DESTROYED:pi,ERR_STREAM_ALREADY_FINISHED:R_,ERR_STREAM_NULL_VALUES:C_,ERR_STREAM_WRITE_AFTER_END:B_,ERR_UNKNOWN_ENCODING:sh}=Se().codes,{errorOrDestroy:Dr}=hn;ih(ie.prototype,di.prototype);ih(ie,di);function no(){}var jr=w_("kOnFinished");function gi(t,e,r){typeof r!="boolean"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?E_(this,t,"writableHighWaterMark",r):S_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=O_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,cn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[jr]=[];}function cn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0;}gi.prototype.getBuffer=function(){return eh(this.buffered,this.bufferedIndex)};rh(gi.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ie(t){let e=this instanceof nt();if(!e&&!th(ie,this))return new ie(t);this._writableState=new gi(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&v_(t.signal,this)),di.call(this,t),hn.construct(this,()=>{let r=this._writableState;r.writing||oo(this,r),ao(this,r);});}rh(ie,__,{__proto__:null,value:function(t){return th(this,t)?!0:this!==ie?!1:t&&t._writableState instanceof gi}});ie.prototype.pipe=function(){Dr(this,new T_);};function oh(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else {if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!un.isEncoding(r))throw new sh(r);typeof i!="function"&&(i=no);}if(e===null)throw new C_;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=un.from(e,r),r="buffer");else if(e instanceof un)r="buffer";else if(di._isUint8Array(e))e=di._uint8ArrayToBuffer(e),r="buffer";else throw new A_("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new B_:n.destroyed&&(o=new pi("write")),o?(ur.nextTick(i,o),Dr(t,o,!0),o):(n.pendingcb++,P_(t,n,e,r,i))}ie.prototype.write=function(t,e,r){return oh(this,t,e,r)===!0};ie.prototype.cork=function(){this._writableState.corked++;};ie.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||oo(this,t));};ie.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=b_(e)),!un.isEncoding(e))throw new sh(e);return this._writableState.defaultEncoding=e,this};function P_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==no&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Xc(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new pi("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1;}function Zc(t,e,r,i){--e.pendingcb,i(r),so(e),Dr(t,r);}function O_(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){Dr(t,new nh);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?ur.nextTick(Zc,t,r,e,n):Zc(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&oo(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},ur.nextTick(x_,r.afterWriteTickInfo)):ah(t,r,1,n));}function x_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,ah(t,e,r,i)}function ah(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&so(e),ao(t,e);}function so(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:s}=t.buffered[n],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new pi("write"));}let r=t[jr].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new pi("end"));}cn(t);}function oo(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,o=r.length-i;if(!o)return;let s=i;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?no:c=>{for(let h=s;h<r.length;++h)r[h].callback(c);},u=e.allNoop&&s===0?r:eh(r,s);u.allBuffers=e.allBuffers,Xc(t,e,!0,e.length,u,"",a),cn(e);}else {do{let{chunk:a,encoding:u,callback:c}=r[s];r[s++]=null;let h=n?1:a.length;Xc(t,e,!1,h,a,u,c);}while(s<r.length&&!e.writing);s===r.length?cn(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s;}e.bufferProcessing=!1;}ie.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new I_("_write()")};ie.prototype._writev=null;ie.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let o=oh(this,t,e);o instanceof g_&&(n=o);}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,ao(this,i,!0),i.ended=!0):i.finished?n=new R_("end"):i.destroyed&&(n=new pi("end"))),typeof r=="function"&&(n||i.finished?ur.nextTick(r,n):i[jr].push(r)),this};function fn(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function k_(t,e){let r=!1;function i(n){if(r){Dr(t,n??nh());return}if(r=!0,e.pendingcb--,n){let o=e[jr].splice(0);for(let s=0;s<o.length;s++)o[s](n);Dr(t,n,e.sync);}else fn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ur.nextTick(io,t,e));}e.sync=!0,e.pendingcb++;try{t._final(i);}catch(n){i(n);}e.sync=!1;}function M_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,k_(t,e)):(e.prefinished=!0,t.emit("prefinish")));}function ao(t,e,r){fn(e)&&(M_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ur.nextTick((i,n)=>{fn(n)?io(i,n):n.pendingcb--;},t,e)):fn(e)&&(e.pendingcb++,io(t,e))));}function io(t,e){e.pendingcb--,e.finished=!0;let r=e[jr].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy();}}y_(ie.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t);}},writable:{__proto__:null,get(){let t=this._writableState;return !!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t);}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return !!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var L_=hn.destroy;ie.prototype.destroy=function(t,e){let r=this._writableState;return !r.destroyed&&(r.bufferedIndex<r.buffered.length||r[jr].length)&&ur.nextTick(so,r),L_.call(this,t,e),this};ie.prototype._undestroy=hn.undestroy;ie.prototype._destroy=function(t,e){e(t);};ie.prototype[m_.captureRejectionSymbol]=function(t){this.destroy(t);};var ro;function lh(){return ro===void 0&&(ro={}),ro}ie.fromWeb=function(t,e){return lh().newStreamWritableFromWritableStream(t,e)};ie.toWeb=function(t){return lh().newWritableStreamFromStreamWritable(t)};});var vh=M((aR,mh)=>{_();v();m();var uo=Ut(),U_=(we(),Z(ve)),{isReadable:N_,isWritable:q_,isIterable:fh,isNodeStream:D_,isReadableNodeStream:ch,isWritableNodeStream:hh,isDuplexNodeStream:j_}=tt(),dh=mt(),{AbortError:_h,codes:{ERR_INVALID_ARG_TYPE:F_,ERR_INVALID_RETURN_VALUE:ph}}=Se(),{destroyer:Fr}=tr(),W_=nt(),$_=hi(),{createDeferredPromise:gh}=Je(),yh=Qs(),bh=globalThis.Blob||U_.Blob,H_=typeof bh<"u"?function(e){return e instanceof bh}:function(e){return !1},V_=globalThis.AbortController||Fi().AbortController,{FunctionPrototypeCall:wh}=ce(),fr=class extends W_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0);}};mh.exports=function t(e,r){if(j_(e))return e;if(ch(e))return dn({readable:e});if(hh(e))return dn({writable:e});if(D_(e))return dn({writable:!1,readable:!1});if(typeof e=="function"){let{value:n,write:o,final:s,destroy:a}=z_(e);if(fh(n))return yh(fr,n,{objectMode:!0,write:o,final:s,destroy:a});let u=n?.then;if(typeof u=="function"){let c,h=wh(u,n,d=>{if(d!=null)throw new ph("nully","body",d)},d=>{Fr(c,d);});return c=new fr({objectMode:!0,readable:!1,write:o,final(d){s(async()=>{try{await h,uo.nextTick(d,null);}catch(g){uo.nextTick(d,g);}});},destroy:a})}throw new ph("Iterable, AsyncIterable or AsyncFunction",r,n)}if(H_(e))return t(e.arrayBuffer());if(fh(e))return yh(fr,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?ch(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?hh(e?.writable)?e?.writable:t(e.writable):void 0;return dn({readable:n,writable:o})}let i=e?.then;if(typeof i=="function"){let n;return wh(i,e,o=>{o!=null&&n.push(o),n.push(null);},o=>{Fr(n,o);}),n=new fr({objectMode:!0,writable:!1,read(){}})}throw new F_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function z_(t){let{promise:e,resolve:r}=gh(),i=new V_,n=i.signal;return {value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:u,cb:c}=await s;if(uo.nextTick(c),u)return;if(n.aborted)throw new _h(void 0,{cause:n.reason});(({promise:e,resolve:r}=gh())),yield a;}}(),{signal:n}),write(s,a,u){let c=r;r=null,c({chunk:s,done:!1,cb:u});},final(s){let a=r;r=null,a({done:!0,cb:s});},destroy(s,a){i.abort(),a(s);}}}function dn(t){let e=t.readable&&typeof t.readable.read!="function"?$_.wrap(t.readable):t.readable,r=t.writable,i=!!N_(e),n=!!q_(r),o,s,a,u,c;function h(d){let g=u;u=null,g?g(d):d&&c.destroy(d);}return c=new fr({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(dh(r,d=>{n=!1,d&&Fr(e,d),h(d);}),c._write=function(d,g,y){r.write(d,g)?y():o=y;},c._final=function(d){r.end(),s=d;},r.on("drain",function(){if(o){let d=o;o=null,d();}}),r.on("finish",function(){if(s){let d=s;s=null,d();}})),i&&(dh(e,d=>{i=!1,d&&Fr(e,d),h(d);}),e.on("readable",function(){if(a){let d=a;a=null,d();}}),e.on("end",function(){c.push(null);}),c._read=function(){for(;;){let d=e.read();if(d===null){a=c._read;return}if(!c.push(d))return}}),c._destroy=function(d,g){!d&&u!==null&&(d=new _h),a=null,o=null,s=null,u===null?g(d):(u=g,Fr(r,d),Fr(e,d));},c}});var nt=M((bR,Ah)=>{_();v();m();var{ObjectDefineProperties:K_,ObjectGetOwnPropertyDescriptor:At,ObjectKeys:G_,ObjectSetPrototypeOf:Eh}=ce();Ah.exports=Ve;var ho=hi(),Ne=lo();Eh(Ve.prototype,ho.prototype);Eh(Ve,ho);{let t=G_(Ne.prototype);for(let e=0;e<t.length;e++){let r=t[e];Ve.prototype[r]||(Ve.prototype[r]=Ne.prototype[r]);}}function Ve(t){if(!(this instanceof Ve))return new Ve(t);ho.call(this,t),Ne.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0;}K_(Ve.prototype,{writable:{__proto__:null,...At(Ne.prototype,"writable")},writableHighWaterMark:{__proto__:null,...At(Ne.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...At(Ne.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...At(Ne.prototype,"writableBuffer")},writableLength:{__proto__:null,...At(Ne.prototype,"writableLength")},writableFinished:{__proto__:null,...At(Ne.prototype,"writableFinished")},writableCorked:{__proto__:null,...At(Ne.prototype,"writableCorked")},writableEnded:{__proto__:null,...At(Ne.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...At(Ne.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t);}}});var fo;function Sh(){return fo===void 0&&(fo={}),fo}Ve.fromWeb=function(t,e){return Sh().newStreamDuplexFromReadableWritablePair(t,e)};Ve.toWeb=function(t){return Sh().newReadableWritablePairFromDuplex(t)};var co;Ve.from=function(t){return co||(co=vh()),co(t,"body")};});var yo=M((RR,Th)=>{_();v();m();var{ObjectSetPrototypeOf:Ih,Symbol:Q_}=ce();Th.exports=It;var{ERR_METHOD_NOT_IMPLEMENTED:Y_}=Se().codes,go=nt(),{getHighWaterMark:J_}=tn();Ih(It.prototype,go.prototype);Ih(It,go);var yi=Q_("kCallback");function It(t){if(!(this instanceof It))return new It(t);let e=t?J_(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),go.call(this,t),this._readableState.sync=!1,this[yi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",X_);}function po(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t();}):(this.push(null),t&&t());}function X_(){this._final!==po&&po.call(this);}It.prototype._final=po;It.prototype._transform=function(t,e,r){throw new Y_("_transform()")};It.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),n.ended||o===i.length||i.length<i.highWaterMark?r():this[yi]=r;});};It.prototype._read=function(){if(this[yi]){let t=this[yi];this[yi]=null,t();}};});var wo=M((NR,Ch)=>{_();v();m();var{ObjectSetPrototypeOf:Rh}=ce();Ch.exports=Wr;var bo=yo();Rh(Wr.prototype,bo.prototype);Rh(Wr,bo);function Wr(t){if(!(this instanceof Wr))return new Wr(t);bo.call(this,t);}Wr.prototype._transform=function(t,e,r){r(null,t);};});var bn=M((KR,kh)=>{_();v();m();var bi=Ut(),{ArrayIsArray:Z_,Promise:e0,SymbolAsyncIterator:t0}=ce(),yn=mt(),{once:r0}=Je(),i0=tr(),Bh=nt(),{aggregateTwoErrors:n0,codes:{ERR_INVALID_ARG_TYPE:To,ERR_INVALID_RETURN_VALUE:_o,ERR_MISSING_ARGS:s0,ERR_STREAM_DESTROYED:o0,ERR_STREAM_PREMATURE_CLOSE:a0},AbortError:l0}=Se(),{validateFunction:u0,validateAbortSignal:f0}=ui(),{isIterable:cr,isReadable:mo,isReadableNodeStream:gn,isNodeStream:Ph,isTransformStream:$r,isWebStream:c0,isReadableStream:vo,isReadableEnded:h0}=tt(),d0=globalThis.AbortController||Fi().AbortController,Eo,So;function Oh(t,e,r){let i=!1;t.on("close",()=>{i=!0;});let n=yn(t,{readable:e,writable:r},o=>{i=!o;});return {destroy:o=>{i||(i=!0,i0.destroyer(t,o||new o0("pipe")));},cleanup:n}}function p0(t){return u0(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Ao(t){if(cr(t))return t;if(gn(t))return g0(t);throw new To("val",["Readable","Iterable","AsyncIterable"],t)}async function*g0(t){So||(So=hi()),yield*So.prototype[t0].call(t);}async function pn(t,e,r,{end:i}){let n,o=null,s=c=>{if(c&&(n=c),o){let h=o;o=null,h();}},a=()=>new e0((c,h)=>{n?h(n):o=()=>{n?h(n):c();};});e.on("drain",s);let u=yn(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();i&&e.end(),await a(),r();}catch(c){r(n!==c?n0(n,c):c);}finally{u(),e.off("drain",s);}}async function Io(t,e,r,{end:i}){$r(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r();}catch(o){try{await n.abort(o),r(o);}catch(s){r(s);}}}function y0(...t){return xh(t,r0(p0(t)))}function xh(t,e,r){if(t.length===1&&Z_(t[0])&&(t=t[0]),t.length<2)throw new s0("streams");let i=new d0,n=i.signal,o=r?.signal,s=[];f0(o,"options.signal");function a(){y(new l0);}o?.addEventListener("abort",a);let u,c,h=[],d=0;function g(C){y(C,--d===0);}function y(C,R){if(C&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=C),!(!u&&!R)){for(;h.length;)h.shift()(u);o?.removeEventListener("abort",a),i.abort(),R&&(u||s.forEach(U=>U()),bi.nextTick(e,u,c));}}let w;for(let C=0;C<t.length;C++){let R=t[C],U=C<t.length-1,N=C>0,W=U||r?.end!==!1,K=C===t.length-1;if(Ph(R)){let z=function(G){G&&G.name!=="AbortError"&&G.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(G);};if(W){let{destroy:G,cleanup:de}=Oh(R,U,N);h.push(G),mo(R)&&K&&s.push(de);}R.on("error",z),mo(R)&&K&&s.push(()=>{R.removeListener("error",z);});}if(C===0)if(typeof R=="function"){if(w=R({signal:n}),!cr(w))throw new _o("Iterable, AsyncIterable or Stream","source",w)}else cr(R)||gn(R)||$r(R)?w=R:w=Bh.from(R);else if(typeof R=="function"){if($r(w)){var E;w=Ao((E=w)===null||E===void 0?void 0:E.readable);}else w=Ao(w);if(w=R(w,{signal:n}),U){if(!cr(w,!0))throw new _o("AsyncIterable",`transform[${C-1}]`,w)}else {var S;Eo||(Eo=wo());let z=new Eo({objectMode:!0}),G=(S=w)===null||S===void 0?void 0:S.then;if(typeof G=="function")d++,G.call(w,pe=>{c=pe,pe!=null&&z.write(pe),W&&z.end(),bi.nextTick(g);},pe=>{z.destroy(pe),bi.nextTick(g,pe);});else if(cr(w,!0))d++,pn(w,z,g,{end:W});else if(vo(w)||$r(w)){let pe=w.readable||w;d++,pn(pe,z,g,{end:W});}else throw new _o("AsyncIterable or Promise","destination",w);w=z;let{destroy:de,cleanup:Gt}=Oh(w,!1,!0);h.push(de),K&&s.push(Gt);}}else if(Ph(R)){if(gn(w)){d+=2;let z=b0(w,R,g,{end:W});mo(R)&&K&&s.push(z);}else if($r(w)||vo(w)){let z=w.readable||w;d++,pn(z,R,g,{end:W});}else if(cr(w))d++,pn(w,R,g,{end:W});else throw new To("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=R;}else if(c0(R)){if(gn(w))d++,Io(Ao(w),R,g,{end:W});else if(vo(w)||cr(w))d++,Io(w,R,g,{end:W});else if($r(w))d++,Io(w.readable,R,g,{end:W});else throw new To("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=R;}else w=Bh.from(R);}return (n!=null&&n.aborted||o!=null&&o.aborted)&&bi.nextTick(a),w}function b0(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new a0);}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end();};h0(t)?bi.nextTick(s):t.once("end",s);}else r();return yn(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s);}),yn(e,{readable:!1,writable:!0},r)}kh.exports={pipelineImpl:xh,pipeline:y0};});var Co=M((iC,Dh)=>{_();v();m();var{pipeline:w0}=bn(),wn=nt(),{destroyer:_0}=tr(),{isNodeStream:_n,isReadable:Mh,isWritable:Lh,isWebStream:Ro,isTransformStream:hr,isWritableStream:Uh,isReadableStream:Nh}=tt(),{AbortError:m0,codes:{ERR_INVALID_ARG_VALUE:qh,ERR_MISSING_ARGS:v0}}=Se(),E0=mt();Dh.exports=function(...e){if(e.length===0)throw new v0("streams");if(e.length===1)return wn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=wn.from(e[0])),typeof e[e.length-1]=="function"){let y=e.length-1;e[y]=wn.from(e[y]);}for(let y=0;y<e.length;++y)if(!(!_n(e[y])&&!Ro(e[y]))){if(y<e.length-1&&!(Mh(e[y])||Nh(e[y])||hr(e[y])))throw new qh(`streams[${y}]`,r[y],"must be readable");if(y>0&&!(Lh(e[y])||Uh(e[y])||hr(e[y])))throw new qh(`streams[${y}]`,r[y],"must be writable")}let i,n,o,s,a;function u(y){let w=s;s=null,w?w(y):y?a.destroy(y):!g&&!d&&a.destroy();}let c=e[0],h=w0(e,u),d=!!(Lh(c)||Uh(c)||hr(c)),g=!!(Mh(h)||Nh(h)||hr(h));if(a=new wn({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:d,readable:g}),d){if(_n(c))a._write=function(w,E,S){c.write(w,E)?S():i=S;},a._final=function(w){c.end(),n=w;},c.on("drain",function(){if(i){let w=i;i=null,w();}});else if(Ro(c)){let E=(hr(c)?c.writable:c).getWriter();a._write=async function(S,I,C){try{await E.ready,E.write(S).catch(()=>{}),C();}catch(R){C(R);}},a._final=async function(S){try{await E.ready,E.close().catch(()=>{}),n=S;}catch(I){S(I);}};}let y=hr(h)?h.readable:h;E0(y,()=>{if(n){let w=n;n=null,w();}});}if(g){if(_n(h))h.on("readable",function(){if(o){let y=o;o=null,y();}}),h.on("end",function(){a.push(null);}),a._read=function(){for(;;){let y=h.read();if(y===null){o=a._read;return}if(!a.push(y))return}};else if(Ro(h)){let w=(hr(h)?h.readable:h).getReader();a._read=async function(){for(;;)try{let{value:E,done:S}=await w.read();if(!a.push(E))return;if(S){a.push(null);return}}catch{return}};}}return a._destroy=function(y,w){!y&&s!==null&&(y=new m0),o=null,i=null,n=null,s===null?w(y):(s=w,_n(h)&&_0(h,y));},a};});var Kh=M((dC,Oo)=>{_();v();m();var $h=globalThis.AbortController||Fi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:S0,ERR_INVALID_ARG_TYPE:wi,ERR_MISSING_ARGS:A0,ERR_OUT_OF_RANGE:I0},AbortError:st}=Se(),{validateAbortSignal:dr,validateInteger:T0,validateObject:pr}=ui(),R0=ce().Symbol("kWeak"),{finished:C0}=mt(),B0=Co(),{addAbortSignalNoValidate:P0}=fi(),{isWritable:O0,isNodeStream:x0}=tt(),{ArrayPrototypePush:k0,MathFloor:M0,Number:L0,NumberIsNaN:U0,Promise:jh,PromiseReject:Fh,PromisePrototypeThen:N0,Symbol:Hh}=ce(),mn=Hh("kEmpty"),Wh=Hh("kEof");function q0(t,e){if(e!=null&&pr(e,"options"),e?.signal!=null&&dr(e.signal,"options.signal"),x0(t)&&!O0(t))throw new S0("stream",t,"must be writable");let r=B0(this,t);return e!=null&&e.signal&&P0(e.signal,r),r}function vn(t,e){if(typeof t!="function")throw new wi("fn",["Function","AsyncFunction"],t);e!=null&&pr(e,"options"),e?.signal!=null&&dr(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=M0(e.concurrency)),T0(r,"concurrency",1),async function*(){var n,o;let s=new $h,a=this,u=[],c=s.signal,h={signal:c},d=()=>s.abort();e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted&&d(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener("abort",d);let g,y,w=!1;function E(){w=!0;}async function S(){try{for await(let R of a){var I;if(w)return;if(c.aborted)throw new st;try{R=t(R,h);}catch(U){R=Fh(U);}R!==mn&&(typeof((I=R)===null||I===void 0?void 0:I.catch)=="function"&&R.catch(E),u.push(R),g&&(g(),g=null),!w&&u.length&&u.length>=r&&await new jh(U=>{y=U;}));}u.push(Wh);}catch(R){let U=Fh(R);N0(U,void 0,E),u.push(U);}finally{var C;w=!0,g&&(g(),g=null),e==null||(C=e.signal)===null||C===void 0||C.removeEventListener("abort",d);}}S();try{for(;;){for(;u.length>0;){let I=await u[0];if(I===Wh)return;if(c.aborted)throw new st;I!==mn&&(yield I),u.shift(),y&&(y(),y=null);}await new jh(I=>{g=I;});}}finally{s.abort(),w=!0,y&&(y(),y=null);}}.call(this)}function D0(t=void 0){return t!=null&&pr(t,"options"),t?.signal!=null&&dr(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new st({cause:t.signal.reason});yield [r++,n];}}.call(this)}async function Vh(t,e=void 0){for await(let r of Po.call(this,t,e))return !0;return !1}async function j0(t,e=void 0){if(typeof t!="function")throw new wi("fn",["Function","AsyncFunction"],t);return !await Vh.call(this,async(...r)=>!await t(...r),e)}async function F0(t,e){for await(let r of Po.call(this,t,e))return r}async function W0(t,e){if(typeof t!="function")throw new wi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),mn}for await(let i of vn.call(this,r,e));}function Po(t,e){if(typeof t!="function")throw new wi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:mn}return vn.call(this,r,e)}var Bo=class extends A0{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value";}};async function $0(t,e,r){var i;if(typeof t!="function")throw new wi("reducer",["Function","AsyncFunction"],t);r!=null&&pr(r,"options"),r?.signal!=null&&dr(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let c=new st(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await C0(this.destroy(c)),c}let o=new $h,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[R0]:this};r.signal.addEventListener("abort",()=>o.abort(),c);}let a=!1;try{for await(let c of this){var u;if(a=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new st;n?e=await t(e,c,{signal:s}):(e=c,n=!0);}if(!a&&!n)throw new Bo}finally{o.abort();}return e}async function H0(t){t!=null&&pr(t,"options"),t?.signal!=null&&dr(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new st(void 0,{cause:t.signal.reason});k0(e,i);}return e}function V0(t,e){let r=vn.call(this,t,e);return async function*(){for await(let n of r)yield*n;}.call(this)}function zh(t){if(t=L0(t),U0(t))return 0;if(t<0)throw new I0("number",">= 0",t);return t}function z0(t,e=void 0){return e!=null&&pr(e,"options"),e?.signal!=null&&dr(e.signal,"options.signal"),t=zh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;t--<=0&&(yield o);}}.call(this)}function K0(t,e=void 0){return e!=null&&pr(e,"options"),e?.signal!=null&&dr(e.signal,"options.signal"),t=zh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;if(t-- >0)yield o;else return}}.call(this)}Oo.exports.streamReturningOperators={asIndexedPairs:D0,drop:z0,filter:Po,flatMap:V0,map:vn,take:K0,compose:q0};Oo.exports.promiseReturningOperators={every:j0,forEach:W0,reduce:$0,toArray:H0,some:Vh,find:F0};});var xo=M((SC,Gh)=>{_();v();m();var{ArrayPrototypePop:G0,Promise:Q0}=ce(),{isIterable:Y0,isNodeStream:J0,isWebStream:X0}=tt(),{pipelineImpl:Z0}=bn(),{finished:em}=mt();ko();function tm(...t){return new Q0((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o=="object"&&!J0(o)&&!Y0(o)&&!X0(o)){let s=G0(t);i=s.signal,n=s.end;}Z0(t,(s,a)=>{s?r(s):e(a);},{signal:i,end:n});})}Gh.exports={finished:em,pipeline:tm};});var ko=M((kC,id)=>{_();v();m();var{Buffer:rm}=(we(),Z(ve)),{ObjectDefineProperty:Tt,ObjectKeys:Jh,ReflectApply:Xh}=ce(),{promisify:{custom:Zh}}=Je(),{streamReturningOperators:Qh,promiseReturningOperators:Yh}=Kh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:ed}}=Se(),im=Co(),{pipeline:td}=bn(),{destroyer:nm}=tr(),rd=mt(),Mo=xo(),Lo=tt(),le=id.exports=Xi().Stream;le.isDisturbed=Lo.isDisturbed;le.isErrored=Lo.isErrored;le.isReadable=Lo.isReadable;le.Readable=hi();for(let t of Jh(Qh)){let r=function(...i){if(new.target)throw ed();return le.Readable.from(Xh(e,this,i))};let e=Qh[t];Tt(r,"name",{__proto__:null,value:e.name}),Tt(r,"length",{__proto__:null,value:e.length}),Tt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0});}for(let t of Jh(Yh)){let r=function(...n){if(new.target)throw ed();return Xh(e,this,n)};let e=Yh[t];Tt(r,"name",{__proto__:null,value:e.name}),Tt(r,"length",{__proto__:null,value:e.length}),Tt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0});}le.Writable=lo();le.Duplex=nt();le.Transform=yo();le.PassThrough=wo();le.pipeline=td;var{addAbortSignal:sm}=fi();le.addAbortSignal=sm;le.finished=rd;le.destroy=nm;le.compose=im;Tt(le,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Mo}});Tt(td,Zh,{__proto__:null,enumerable:!0,get(){return Mo.pipeline}});Tt(rd,Zh,{__proto__:null,enumerable:!0,get(){return Mo.finished}});le.Stream=le;le._isUint8Array=function(e){return e instanceof Uint8Array};le._uint8ArrayToBuffer=function(e){return rm.from(e.buffer,e.byteOffset,e.byteLength)};});var Dt=M(($C,ue)=>{_();v();m();var he=ko(),om=xo(),am=he.Readable.destroy;ue.exports=he.Readable;ue.exports._uint8ArrayToBuffer=he._uint8ArrayToBuffer;ue.exports._isUint8Array=he._isUint8Array;ue.exports.isDisturbed=he.isDisturbed;ue.exports.isErrored=he.isErrored;ue.exports.isReadable=he.isReadable;ue.exports.Readable=he.Readable;ue.exports.Writable=he.Writable;ue.exports.Duplex=he.Duplex;ue.exports.Transform=he.Transform;ue.exports.PassThrough=he.PassThrough;ue.exports.addAbortSignal=he.addAbortSignal;ue.exports.finished=he.finished;ue.exports.destroy=he.destroy;ue.exports.destroy=am;ue.exports.pipeline=he.pipeline;ue.exports.compose=he.compose;Object.defineProperty(he,"promises",{configurable:!0,enumerable:!0,get(){return om}});ue.exports.Stream=he.Stream;ue.exports.default=ue.exports;});var nd=M((ZC,No)=>{_();v();m();typeof Object.create=="function"?No.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}:No.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e;}};});var ad=M((uB,od)=>{_();v();m();var{Buffer:ze}=(we(),Z(ve)),sd=Symbol.for("BufferList");function ee(t){if(!(this instanceof ee))return new ee(t);ee._init.call(this,t);}ee._init=function(e){Object.defineProperty(this,sd,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e);};ee.prototype._new=function(e){return new ee(e)};ee.prototype._offset=function(e){if(e===0)return [0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return [i,e-r];r=n;}};ee.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let i=0;i<e;i++)r+=this._bufs[i].length;return r};ee.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ee.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ee.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||ze.alloc(0);let o=!!e,s=this._offset(i),a=n-i,u=a,c=o&&r||0,h=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:ze.concat(this._bufs,this.length);for(let d=0;d<this._bufs.length;d++)this._bufs[d].copy(e,c),c+=this._bufs[d].length;return e}if(u<=this._bufs[s[0]].length-h)return o?this._bufs[s[0]].copy(e,r,h,h+u):this._bufs[s[0]].slice(h,h+u);o||(e=ze.allocUnsafe(a));for(let d=s[0];d<this._bufs.length;d++){let g=this._bufs[d].length-h;if(u>g)this._bufs[d].copy(e,c,h),c+=g;else {this._bufs[d].copy(e,c,h,h+u),c+=g;break}u-=g,h&&(h=0);}return e.length>c?e.slice(0,c):e};ee.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};ee.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};ee.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else {this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ee.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};ee.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(ze.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(ze.from(e));return this};ee.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length;};ee.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=ze.from([t]):typeof t=="string"?t=ze.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=ze.from(t.buffer,t.byteOffset,t.byteLength):ze.isBuffer(t)||(t=ze.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n<this._bufs.length;n++){let s=this._bufs[n];for(;o<s.length;)if(s.length-o>=t.length){let u=s.indexOf(t,o);if(u!==-1)return this._reverseOffset([n,u]);o=s.length-t.length+1;}else {let u=this._reverseOffset([n,o]);if(this._match(u,t))return u;o++;}o=0;}return -1};ee.prototype._match=function(t,e){if(this.length-t<e.length)return !1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return !1;return !0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?ee.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:ee.prototype[r]=function(i=0){return this.slice(i,i+t[r])[r](0)};})(e);})();ee.prototype._isBufferList=function(e){return e instanceof ee||ee.isBufferList(e)};ee.isBufferList=function(e){return e!=null&&e[sd]};od.exports=ee;});var ld=M((_B,En)=>{_();v();m();var qo=Dt().Duplex,lm=nd(),_i=ad();function Ee(t){if(!(this instanceof Ee))return new Ee(t);if(typeof t=="function"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null);}.bind(this);this.on("pipe",function(i){i.on("error",e);}),this.on("unpipe",function(i){i.removeListener("error",e);}),t=null;}_i._init.call(this,t),qo.call(this);}lm(Ee,qo);Object.assign(Ee.prototype,_i.prototype);Ee.prototype._new=function(e){return new Ee(e)};Ee.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i=="function"&&i();};Ee.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e);};Ee.prototype.end=function(e){qo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null);};Ee.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e);};Ee.prototype._isBufferList=function(e){return e instanceof Ee||e instanceof _i||Ee.isBufferList(e)};Ee.isBufferList=_i.isBufferList;En.exports=Ee;En.exports.BufferListStream=Ee;En.exports.BufferList=_i;});var fd=M((BB,ud)=>{_();v();m();var Do=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null;}};ud.exports=Do;});var jo=M((DB,cd)=>{_();v();m();var L=cd.exports,{Buffer:Oe}=(we(),Z(ve));L.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"};L.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+L.types[t]+" packet";}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t;}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=Oe.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=Oe.from([L.codes.connack<<L.CMD_SHIFT]);L.USERNAME_MASK=128;L.PASSWORD_MASK=64;L.WILL_RETAIN_MASK=32;L.WILL_QOS_MASK=24;L.WILL_QOS_SHIFT=3;L.WILL_FLAG_MASK=4;L.CLEAN_SESSION_MASK=2;L.CONNECT_HEADER=Oe.from([L.codes.connect<<L.CMD_SHIFT]);L.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11};L.propertiesCodes={};for(let t in L.properties){let e=L.properties[t];L.propertiesCodes[e]=t;}L.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function jt(t){return [0,1,2].map(e=>[0,1].map(r=>[0,1].map(i=>{let n=Oe.alloc(1);return n.writeUInt8(L.codes[t]<<L.CMD_SHIFT|(r?L.DUP_MASK:0)|e<<L.QOS_SHIFT|i,0,!0),n})))}L.PUBLISH_HEADER=jt("publish");L.SUBSCRIBE_HEADER=jt("subscribe");L.SUBSCRIBE_OPTIONS_QOS_MASK=3;L.SUBSCRIBE_OPTIONS_NL_MASK=1;L.SUBSCRIBE_OPTIONS_NL_SHIFT=2;L.SUBSCRIBE_OPTIONS_RAP_MASK=1;L.SUBSCRIBE_OPTIONS_RAP_SHIFT=3;L.SUBSCRIBE_OPTIONS_RH_MASK=3;L.SUBSCRIBE_OPTIONS_RH_SHIFT=4;L.SUBSCRIBE_OPTIONS_RH=[0,16,32];L.SUBSCRIBE_OPTIONS_NL=4;L.SUBSCRIBE_OPTIONS_RAP=8;L.SUBSCRIBE_OPTIONS_QOS=[0,1,2];L.UNSUBSCRIBE_HEADER=jt("unsubscribe");L.ACKS={unsuback:jt("unsuback"),puback:jt("puback"),pubcomp:jt("pubcomp"),pubrel:jt("pubrel"),pubrec:jt("pubrec")};L.SUBACK_HEADER=Oe.from([L.codes.suback<<L.CMD_SHIFT]);L.VERSION3=Oe.from([3]);L.VERSION4=Oe.from([4]);L.VERSION5=Oe.from([5]);L.VERSION131=Oe.from([131]);L.VERSION132=Oe.from([132]);L.QOS=[0,1,2].map(t=>Oe.from([t]));L.EMPTY={pingreq:Oe.from([L.codes.pingreq<<4,0]),pingresp:Oe.from([L.codes.pingresp<<4,0]),disconnect:Oe.from([L.codes.disconnect<<4,0])};L.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"};L.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};L.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"};L.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};L.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"};});var dd=M((QB,hd)=>{_();v();m();var Hr=1e3,Vr=Hr*60,zr=Vr*60,gr=zr*24,um=gr*7,fm=gr*365.25;hd.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return cm(t);if(r==="number"&&isFinite(t))return e.long?dm(t):hm(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function cm(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*fm;case"weeks":case"week":case"w":return r*um;case"days":case"day":case"d":return r*gr;case"hours":case"hour":case"hrs":case"hr":case"h":return r*zr;case"minutes":case"minute":case"mins":case"min":case"m":return r*Vr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Hr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function hm(t){var e=Math.abs(t);return e>=gr?Math.round(t/gr)+"d":e>=zr?Math.round(t/zr)+"h":e>=Vr?Math.round(t/Vr)+"m":e>=Hr?Math.round(t/Hr)+"s":t+"ms"}function dm(t){var e=Math.abs(t);return e>=gr?Sn(t,e,gr,"day"):e>=zr?Sn(t,e,zr,"hour"):e>=Vr?Sn(t,e,Vr,"minute"):e>=Hr?Sn(t,e,Hr,"second"):t+" ms"}function Sn(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var gd=M((sP,pd)=>{_();v();m();function pm(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=n,r.enabled=s,r.humanize=dd(),r.destroy=c,Object.keys(t).forEach(h=>{r[h]=t[h];}),r.names=[],r.skips=[],r.formatters={};function e(h){let d=0;for(let g=0;g<h.length;g++)d=(d<<5)-d+h.charCodeAt(g),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(h){let d,g=null,y,w;function E(...S){if(!E.enabled)return;let I=E,C=Number(new Date),R=C-(d||C);I.diff=R,I.prev=d,I.curr=C,d=C,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let U=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(W,K)=>{if(W==="%%")return "%";U++;let z=r.formatters[K];if(typeof z=="function"){let G=S[U];W=z.call(I,G),S.splice(U,1),U--;}return W}),r.formatArgs.call(I,S),(I.log||r.log).apply(I,S);}return E.namespace=h,E.useColors=r.useColors(),E.color=r.selectColor(h),E.extend=i,E.destroy=r.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(y!==r.namespaces&&(y=r.namespaces,w=r.enabled(h)),w),set:S=>{g=S;}}),typeof r.init=="function"&&r.init(E),E}function i(h,d){let g=r(this.namespace+(typeof d>"u"?":":d)+h);return g.log=this.log,g}function n(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let d,g=(typeof h=="string"?h:"").split(/[\s,]+/),y=g.length;for(d=0;d<y;d++)g[d]&&(h=g[d].replace(/\*/g,".*?"),h[0]==="-"?r.skips.push(new RegExp("^"+h.slice(1)+"$")):r.names.push(new RegExp("^"+h+"$")));}function o(){let h=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),h}function s(h){if(h[h.length-1]==="*")return !0;let d,g;for(d=0,g=r.skips.length;d<g;d++)if(r.skips[d].test(h))return !1;for(d=0,g=r.names.length;d<g;d++)if(r.names[d].test(h))return !0;return !1}function a(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function u(h){return h instanceof Error?h.stack||h.message:h}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");}return r.enable(r.load()),r}pd.exports=pm;});var ot=M((ke,An)=>{_();v();m();ke.formatArgs=ym;ke.save=bm;ke.load=wm;ke.useColors=gm;ke.storage=_m();ke.destroy=(()=>{let t=!1;return ()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));}})();ke.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gm(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ym(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+An.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r));}),t.splice(i,0,e);}ke.log=console.debug||console.log||(()=>{});function bm(t){try{t?ke.storage.setItem("debug",t):ke.storage.removeItem("debug");}catch{}}function wm(){let t;try{t=ke.storage.getItem("debug");}catch{}return !t&&typeof B<"u"&&"env"in B&&(t=B.env.DEBUG),t}function _m(){try{return localStorage}catch{}}An.exports=gd()(ke);var{formatters:mm}=An.exports;mm.j=function(t){try{return JSON.stringify(t)}catch(e){return "[UnexpectedJSONParseError]: "+e.message}};});var wd=M((AP,bd)=>{_();v();m();var vm=ld(),{EventEmitter:Em}=(ir(),Z(rr)),yd=fd(),V=jo(),D=ot()("mqtt-packet:parser"),Fo=class t extends Em{constructor(){super(),this.parser=this.constructor.parser;}static parser(e){return this instanceof t?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new t().parser(e)}_resetState(){D("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new yd,this.error=null,this._list=vm(),this._stateCounter=0;}parse(e){for(this.error&&this._resetState(),this._list.append(e),D("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,D("parse: state complete. _stateCounter is now: %d",this._stateCounter),D("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return D("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(e&V.DUP_MASK)!==0,D("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),D("_parseLength %d",e.value),!!e}_parsePayload(){D("_parsePayload: payload %O",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"));}e=!0;}return D("_parsePayload complete result: %s",e),e}_parseConnect(){D("_parseConnect");let e,r,i,n,o={},s=this.packet,a=this._parseString();if(a===null)return this._emitError(new Error("Cannot parse protocolId"));if(a!=="MQTT"&&a!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(s.protocolId=a,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let u=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),c=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=u,s.will.qos=c;else {if(u)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(c)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error("Packet too short"));if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.properties=d);}let h=this._parseString();if(h===null)return this._emitError(new Error("Packet too short"));if(s.clientId=h,D("_parseConnect: packet.clientId: %s",s.clientId),o.will){if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.will.properties=d);}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(s.will.topic=e,D("_parseConnect: packet.will.topic: %s",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error("Cannot parse will payload"));s.will.payload=r,D("_parseConnect: packet.will.paylaod: %s",s.will.payload);}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse username"));s.username=n,D("_parseConnect: packet.username: %s",s.username);}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error("Cannot parse password"));s.password=i;}return this.settings=s,D("_parseConnect: complete"),s}_parseConnack(){D("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else {if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++);}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i);}D("_parseConnack: complete");}_parsePublish(){D("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r);}e.payload=this._list.slice(this._pos,e.length),D("_parsePublish: payload from buffer list: %o",e.payload);}}_parseSubscribe(){D("_parseSubscribe");let e=this.packet,r,i,n,o,s,a,u;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(e.properties=c);}if(e.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<e.length;){if(r=this._parseString(),r===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(i&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(a=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));u={topic:r,qos:n},this.settings.protocolVersion===5?(u.nl=a,u.rap=s,u.rh=o):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),D("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u);}}}_parseSuback(){D("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r);}if(e.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let r=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!V.MQTT5_SUBACK_CODES[r])return this._emitError(new Error("Invalid suback code"))}else if(r>2&&r!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r);}}}_parseUnsubscribe(){D("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r);}if(e.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<e.length;){let r=this._parseString();if(r===null)return this._emitError(new Error("Cannot parse topic"));D("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r);}}}_parseUnsuback(){D("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&e.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(e.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(e.properties=r),e.granted=[];this._pos<this.packet.length;){let i=this._list.readUInt8(this._pos++);if(!V.MQTT5_UNSUBACK_CODES[i])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(i);}}}_parseConfirmation(){D("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(e.length>2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}D("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode);}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r);}}return !0}_parseDisconnect(){let e=this.packet;if(D("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r);}return D("_parseDisconnect result: true"),!0}_parseAuth(){D("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),D("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(D("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString("utf8",this._pos,i);return this._pos+=r,D("_parseString: result: %s",n),n}_parseStringPair(){return D("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,D("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return -1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,D("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return -1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,D("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){D("_parseVarByteNum");let r=4,i=0,n=1,o=0,s=!1,a,u=this._pos?this._pos:0;for(;i<r&&u+i<this._list.length;){if(a=this._list.readUInt8(u+i++),o+=n*(a&V.VARBYTEINT_MASK),n*=128,!(a&V.VARBYTEINT_FIN_MASK)){s=!0;break}if(this._list.length<=i)break}return !s&&i===r&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),u&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,D("_parseVarByteNum: result: %o",s),s}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),D("_parseByte: result: %o",e),e}_parseByType(e){switch(D("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){D("_parseProperties");let e=this._parseVarByteNum(),i=this._pos+e,n={};for(;this._pos<i;){let o=this._parseByte();if(!o)return this._emitError(new Error("Cannot parse property code type")),!1;let s=V.propertiesCodes[o];if(!s)return this._emitError(new Error("Unknown property")),!1;if(s==="userProperties"){n[s]||(n[s]=Object.create(null));let a=this._parseByType(V.propertiesTypes[s]);if(n[s][a.name])if(Array.isArray(n[s][a.name]))n[s][a.name].push(a.value);else {let u=n[s][a.name];n[s][a.name]=[u],n[s][a.name].push(a.value);}else n[s][a.name]=a.value;continue}n[s]?Array.isArray(n[s])?n[s].push(this._parseByType(V.propertiesTypes[s])):(n[s]=[n[s]],n[s].push(this._parseByType(V.propertiesTypes[s]))):n[s]=this._parseByType(V.propertiesTypes[s]);}return n}_newPacket(){return D("_newPacket"),this.packet&&(this._list.consume(this.packet.length),D("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),D("_newPacket: new packet"),this.packet=new yd,this._pos=0,!0}_emitError(e){D("_emitError",e),this.error=e,this.emit("error",e);}};bd.exports=Fo;});var Ed=M((MP,vd)=>{_();v();m();var{Buffer:mi}=(we(),Z(ve)),Sm=65536,_d={},Am=mi.isBuffer(mi.from([1,2]).subarray(0,1));function md(t){let e=mi.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,0+1),e}function Im(){for(let t=0;t<Sm;t++)_d[t]=md(t);}function Tm(t){let r=0,i=0,n=mi.allocUnsafe(4);do r=t%128|0,t=t/128|0,t>0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),Am?n.subarray(0,i):n.slice(0,i)}function Rm(t){let e=mi.allocUnsafe(4);return e.writeUInt32BE(t,0),e}vd.exports={cache:_d,generateCache:Im,generateNumber:md,genBufVariableByteInt:Tm,generate4ByteBuffer:Rm};});var Sd=M((HP,Wo)=>{_();v();m();typeof B>"u"||!B.version||B.version.indexOf("v0.")===0||B.version.indexOf("v1.")===0&&B.version.indexOf("v1.8.")!==0?Wo.exports={nextTick:Cm}:Wo.exports=B;function Cm(t,e,r,i){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return B.nextTick(t);case 2:return B.nextTick(function(){t.call(null,e);});case 3:return B.nextTick(function(){t.call(null,e,r);});case 4:return B.nextTick(function(){t.call(null,e,r,i);});default:for(o=new Array(n-1),s=0;s<o.length;)o[s++]=arguments[s];return B.nextTick(function(){t.apply(null,o);})}}});var Vo=M((eO,Od)=>{_();v();m();var j=jo(),{Buffer:q}=(we(),Z(ve)),Bm=q.allocUnsafe(0),Pm=q.from([0]),vi=Ed(),Om=Sd().nextTick,qe=ot()("mqtt-packet:writeToStream"),In=vi.cache,xm=vi.generateNumber,km=vi.generateCache,$o=vi.genBufVariableByteInt,Mm=vi.generate4ByteBuffer,Ie=Ho,Tn=!0;function Bd(t,e,r){switch(qe("generate called"),e.cork&&(e.cork(),Om(Lm,e)),Tn&&(Tn=!1,km()),qe("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return Um(t,e);case"connack":return Nm(t,e,r);case"publish":return qm(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return Dm(t,e,r);case"subscribe":return jm(t,e,r);case"suback":return Fm(t,e,r);case"unsubscribe":return Wm(t,e,r);case"unsuback":return $m(t,e,r);case"pingreq":case"pingresp":return Hm(t,e);case"disconnect":return Vm(t,e,r);case"auth":return zm(t,e,r);default:return e.destroy(new Error("Unknown command")),!1}}Object.defineProperty(Bd,"cacheNumbers",{get(){return Ie===Ho},set(t){t?((!In||Object.keys(In).length===0)&&(Tn=!0),Ie=Ho):(Tn=!1,Ie=Km);}});function Lm(t){t.uncork();}function Um(t,e,r){let i=t||{},n=i.protocolId||"MQTT",o=i.protocolVersion||4,s=i.will,a=i.clean,u=i.keepalive||0,c=i.clientId||"",h=i.username,d=i.password,g=i.properties;a===void 0&&(a=!0);let y=0;if(!n||typeof n!="string"&&!q.isBuffer(n))return e.destroy(new Error("Invalid protocolId")),!1;if(y+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error("Invalid protocol version")),!1;if(y+=1,(typeof c=="string"||q.isBuffer(c))&&(c||o>=4)&&(c||a))y+=q.byteLength(c)+2;else {if(o<4)return e.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(a*1===0)return e.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof u!="number"||u<0||u>65535||u%1!==0)return e.destroy(new Error("Invalid keepalive")),!1;y+=2,y+=1;let w,E;if(o===5){if(w=Ft(e,g),!w)return !1;y+=w.length;}if(s){if(typeof s!="object")return e.destroy(new Error("Invalid will")),!1;if(!s.topic||typeof s.topic!="string")return e.destroy(new Error("Invalid will topic")),!1;if(y+=q.byteLength(s.topic)+2,y+=2,s.payload)if(s.payload.length>=0)typeof s.payload=="string"?y+=q.byteLength(s.payload):y+=s.payload.length;else return e.destroy(new Error("Invalid will payload")),!1;if(E={},o===5){if(E=Ft(e,s.properties),!E)return !1;y+=E.length;}}let S=!1;if(h!=null)if(Cd(h))S=!0,y+=q.byteLength(h)+2;else return e.destroy(new Error("Invalid username")),!1;if(d!=null){if(!S)return e.destroy(new Error("Username is required to use password")),!1;if(Cd(d))y+=Pd(d)+2;else return e.destroy(new Error("Invalid password")),!1}e.write(j.CONNECT_HEADER),De(e,y),Kr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?j.VERSION131:o===132?j.VERSION132:o===4?j.VERSION4:o===5?j.VERSION5:j.VERSION3);let I=0;return I|=h!=null?j.USERNAME_MASK:0,I|=d!=null?j.PASSWORD_MASK:0,I|=s&&s.retain?j.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<<j.WILL_QOS_SHIFT:0,I|=s?j.WILL_FLAG_MASK:0,I|=a?j.CLEAN_SESSION_MASK:0,e.write(q.from([I])),Ie(e,u),o===5&&w.write(),Kr(e,c),s&&(o===5&&E.write(),yr(e,s.topic),Kr(e,s.payload)),h!=null&&Kr(e,h),d!=null&&Kr(e,d),!0}function Nm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=i===5?n.reasonCode:n.returnCode,s=n.properties,a=2;if(typeof o!="number")return e.destroy(new Error("Invalid return code")),!1;let u=null;if(i===5){if(u=Ft(e,s),!u)return !1;a+=u.length;}return e.write(j.CONNACK_HEADER),De(e,a),e.write(n.sessionPresent?j.SESSIONPRESENT_HEADER:Pm),e.write(q.from([o])),u?.write(),!0}function qm(t,e,r){qe("publish: packet: %o",t);let i=r?r.protocolVersion:4,n=t||{},o=n.qos||0,s=n.retain?j.RETAIN_MASK:0,a=n.topic,u=n.payload||Bm,c=n.messageId,h=n.properties,d=0;if(typeof a=="string")d+=q.byteLength(a)+2;else if(q.isBuffer(a))d+=a.length+2;else return e.destroy(new Error("Invalid topic")),!1;if(q.isBuffer(u)?d+=u.length:d+=q.byteLength(u),o&&typeof c!="number")return e.destroy(new Error("Invalid messageId")),!1;o&&(d+=2);let g=null;if(i===5){if(g=Ft(e,h),!g)return !1;d+=g.length;}return e.write(j.PUBLISH_HEADER[o][n.dup?1:0][s?1:0]),De(e,d),Ie(e,Pd(a)),e.write(a),o>0&&Ie(e,c),g?.write(),qe("publish: payload: %o",u),e.write(u)}function Dm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||"puback",s=n.messageId,a=n.dup&&o==="pubrel"?j.DUP_MASK:0,u=0,c=n.reasonCode,h=n.properties,d=i===5?3:2;if(o==="pubrel"&&(u=1),typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;let g=null;if(i===5&&typeof h=="object"){if(g=Ei(e,h,r,d),!g)return !1;d+=g.length;}return e.write(j.ACKS[o][u][a][0]),d===3&&(d+=c!==0?1:-1),De(e,d),Ie(e,s),i===5&&d!==2&&e.write(q.from([c])),g!==null?g.write():d===4&&e.write(q.from([0])),!0}function jm(t,e,r){qe("subscribe: packet: ");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?j.DUP_MASK:0,s=n.messageId,a=n.subscriptions,u=n.properties,c=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;c+=2;let h=null;if(i===5){if(h=Ft(e,u),!h)return !1;c+=h.length;}if(typeof a=="object"&&a.length)for(let g=0;g<a.length;g+=1){let y=a[g].topic,w=a[g].qos;if(typeof y!="string")return e.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof w!="number")return e.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(i===5){if(typeof(a[g].nl||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(a[g].rap||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let I=a[g].rh||0;if(typeof I!="number"||I>2)return e.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}c+=q.byteLength(y)+2+1;}else return e.destroy(new Error("Invalid subscriptions")),!1;qe("subscribe: writing to stream: %o",j.SUBSCRIBE_HEADER),e.write(j.SUBSCRIBE_HEADER[1][o?1:0][0]),De(e,c),Ie(e,s),h!==null&&h.write();let d=!0;for(let g of a){let y=g.topic,w=g.qos,E=+g.nl,S=+g.rap,I=g.rh,C;yr(e,y),C=j.SUBSCRIBE_OPTIONS_QOS[w],i===5&&(C|=E?j.SUBSCRIBE_OPTIONS_NL:0,C|=S?j.SUBSCRIBE_OPTIONS_RAP:0,C|=I?j.SUBSCRIBE_OPTIONS_RH[I]:0),d=e.write(q.from([C]));}return d}function Fm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,a=n.properties,u=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(u+=2,typeof s=="object"&&s.length)for(let h=0;h<s.length;h+=1){if(typeof s[h]!="number")return e.destroy(new Error("Invalid qos vector")),!1;u+=1;}else return e.destroy(new Error("Invalid qos vector")),!1;let c=null;if(i===5){if(c=Ei(e,a,r,u),!c)return !1;u+=c.length;}return e.write(j.SUBACK_HEADER),De(e,u),Ie(e,o),c!==null&&c.write(),e.write(q.from(s))}function Wm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?j.DUP_MASK:0,a=n.unsubscriptions,u=n.properties,c=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(c+=2,typeof a=="object"&&a.length)for(let g=0;g<a.length;g+=1){if(typeof a[g]!="string")return e.destroy(new Error("Invalid unsubscriptions")),!1;c+=q.byteLength(a[g])+2;}else return e.destroy(new Error("Invalid unsubscriptions")),!1;let h=null;if(i===5){if(h=Ft(e,u),!h)return !1;c+=h.length;}e.write(j.UNSUBSCRIBE_HEADER[1][s?1:0][0]),De(e,c),Ie(e,o),h!==null&&h.write();let d=!0;for(let g=0;g<a.length;g++)d=yr(e,a[g]);return d}function $m(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?j.DUP_MASK:0,a=n.granted,u=n.properties,c=n.cmd,h=0,d=2;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(i===5)if(typeof a=="object"&&a.length)for(let y=0;y<a.length;y+=1){if(typeof a[y]!="number")return e.destroy(new Error("Invalid qos vector")),!1;d+=1;}else return e.destroy(new Error("Invalid qos vector")),!1;let g=null;if(i===5){if(g=Ei(e,u,r,d),!g)return !1;d+=g.length;}return e.write(j.ACKS[c][h][s][0]),De(e,d),Ie(e,o),g!==null&&g.write(),i===5&&e.write(q.from(a)),!0}function Hm(t,e,r){return e.write(j.EMPTY[t.cmd])}function Vm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,a=i===5?1:0,u=null;if(i===5){if(u=Ei(e,s,r,a),!u)return !1;a+=u.length;}return e.write(q.from([j.codes.disconnect<<4])),De(e,a),i===5&&e.write(q.from([o])),u!==null&&u.write(),!0}function zm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,a=i===5?1:0;i!==5&&e.destroy(new Error("Invalid mqtt version for auth packet"));let u=Ei(e,s,r,a);return u?(a+=u.length,e.write(q.from([j.codes.auth<<4])),De(e,a),e.write(q.from([o])),u!==null&&u.write(),!0):!1}var Ad={};function De(t,e){if(e>j.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=Ad[e];return r||(r=$o(e),e<16384&&(Ad[e]=r)),qe("writeVarByteInt: writing to stream: %o",r),t.write(r)}function yr(t,e){let r=q.byteLength(e);return Ie(t,r),qe("writeString: %s",e),t.write(e,"utf8")}function Id(t,e,r){yr(t,e),yr(t,r);}function Ho(t,e){return qe("writeNumberCached: number: %d",e),qe("writeNumberCached: %o",In[e]),t.write(In[e])}function Km(t,e){let r=xm(e);return qe("writeNumberGenerated: %o",r),t.write(r)}function Gm(t,e){let r=Mm(e);return qe("write4ByteNumber: %o",r),t.write(r)}function Kr(t,e){typeof e=="string"?yr(t,e):e?(Ie(t,e.length),t.write(e)):Ie(t,0);}function Ft(t,e){if(typeof e!="object"||e.length!=null)return {length:1,write(){Rd(t,{},0);}};let r=0;function i(o,s){let a=j.propertiesTypes[o],u=0;switch(a){case"byte":{if(typeof s!="boolean")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+1;break}case"int8":{if(typeof s!="number"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+1;break}case"binary":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+q.byteLength(s)+2;break}case"int16":{if(typeof s!="number"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+2;break}case"int32":{if(typeof s!="number"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+4;break}case"var":{if(typeof s!="number"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+q.byteLength($o(s));break}case"string":{if(typeof s!="string")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+2+q.byteLength(s.toString());break}case"pair":{if(typeof s!="object")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=Object.getOwnPropertyNames(s).reduce((c,h)=>{let d=s[h];return Array.isArray(d)?c+=d.reduce((g,y)=>(g+=1+2+q.byteLength(h.toString())+2+q.byteLength(y.toString()),g),0):c+=1+2+q.byteLength(h.toString())+2+q.byteLength(s[h].toString()),c},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return u}if(e)for(let o in e){let s=0,a=0,u=e[o];if(Array.isArray(u))for(let c=0;c<u.length;c++){if(a=i(o,u[c]),!a)return !1;s+=a;}else {if(a=i(o,u),!a)return !1;s=a;}if(!s)return !1;r+=s;}return {length:q.byteLength($o(r))+r,write(){Rd(t,e,r);}}}function Ei(t,e,r,i){let n=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,s=Ft(t,e);if(o)for(;i+s.length>o;){let a=n.shift();if(a&&e[a])delete e[a],s=Ft(t,e);else return !1}return s}function Td(t,e,r){switch(j.propertiesTypes[e]){case"byte":{t.write(q.from([j.properties[e]])),t.write(q.from([+r]));break}case"int8":{t.write(q.from([j.properties[e]])),t.write(q.from([r]));break}case"binary":{t.write(q.from([j.properties[e]])),Kr(t,r);break}case"int16":{t.write(q.from([j.properties[e]])),Ie(t,r);break}case"int32":{t.write(q.from([j.properties[e]])),Gm(t,r);break}case"var":{t.write(q.from([j.properties[e]])),De(t,r);break}case"string":{t.write(q.from([j.properties[e]])),yr(t,r);break}case"pair":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(q.from([j.properties[e]])),Id(t,n.toString(),s.toString());}):(t.write(q.from([j.properties[e]])),Id(t,n.toString(),o.toString()));});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Rd(t,e,r){De(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let o=0;o<n.length;o++)Td(t,i,n[o]);else Td(t,i,n);}}function Pd(t){return t?t instanceof q?t.length:q.byteLength(t):0}function Cd(t){return typeof t=="string"||t instanceof q}Od.exports=Bd;});var Md=M((fO,kd)=>{_();v();m();var Qm=Vo(),{EventEmitter:Ym}=(ir(),Z(rr)),{Buffer:xd}=(we(),Z(ve));function Jm(t,e){let r=new zo;return Qm(t,r,e),r.concat()}var zo=class extends Ym{constructor(){super(),this._array=new Array(20),this._i=0;}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?r[o]=i[o].length:r[o]=xd.byteLength(i[o]),e+=r[o];let s=xd.allocUnsafe(e);for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?(i[o].copy(s,n),n+=r[o]):(s.write(i[o],n),n+=r[o]);return s}destroy(e){e&&this.emit("error",e);}};kd.exports=Jm;});var Ld=M(Rn=>{_();v();m();Rn.parser=wd().parser;Rn.generate=Md();Rn.writeToStream=Vo();});var Qo=M(Go=>{_();v();m();Object.defineProperty(Go,"__esModule",{value:!0});var Ko=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535));}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return !0}deallocate(e){}clear(){}};Go.default=Ko;});var Nd=M((jO,Ud)=>{_();v();m();Ud.exports=Xm;function Gr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function Xm(t){if(t=t||{},t.circles)return Zm(t);return t.proto?i:r;function e(n,o){for(var s=Object.keys(n),a=new Array(s.length),u=0;u<s.length;u++){var c=s[u],h=n[c];typeof h!="object"||h===null?a[c]=h:h instanceof Date?a[c]=new Date(h):ArrayBuffer.isView(h)?a[c]=Gr(h):a[c]=o(h);}return a}function r(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,r);if(n instanceof Map)return new Map(e(Array.from(n),r));if(n instanceof Set)return new Set(e(Array.from(n),r));var o={};for(var s in n)if(Object.hasOwnProperty.call(n,s)!==!1){var a=n[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):a instanceof Map?o[s]=new Map(e(Array.from(a),r)):a instanceof Set?o[s]=new Set(e(Array.from(a),r)):ArrayBuffer.isView(a)?o[s]=Gr(a):o[s]=r(a);}return o}function i(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,i);if(n instanceof Map)return new Map(e(Array.from(n),i));if(n instanceof Set)return new Set(e(Array.from(n),i));var o={};for(var s in n){var a=n[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):a instanceof Map?o[s]=new Map(e(Array.from(a),i)):a instanceof Set?o[s]=new Set(e(Array.from(a),i)):ArrayBuffer.isView(a)?o[s]=Gr(a):o[s]=i(a);}return o}}function Zm(t){var e=[],r=[];return t.proto?o:n;function i(s,a){for(var u=Object.keys(s),c=new Array(u.length),h=0;h<u.length;h++){var d=u[h],g=s[d];if(typeof g!="object"||g===null)c[d]=g;else if(g instanceof Date)c[d]=new Date(g);else if(ArrayBuffer.isView(g))c[d]=Gr(g);else {var y=e.indexOf(g);y!==-1?c[d]=r[y]:c[d]=a(g);}}return c}function n(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,n);if(s instanceof Map)return new Map(i(Array.from(s),n));if(s instanceof Set)return new Set(i(Array.from(s),n));var a={};e.push(s),r.push(a);for(var u in s)if(Object.hasOwnProperty.call(s,u)!==!1){var c=s[u];if(typeof c!="object"||c===null)a[u]=c;else if(c instanceof Date)a[u]=new Date(c);else if(c instanceof Map)a[u]=new Map(i(Array.from(c),n));else if(c instanceof Set)a[u]=new Set(i(Array.from(c),n));else if(ArrayBuffer.isView(c))a[u]=Gr(c);else {var h=e.indexOf(c);h!==-1?a[u]=r[h]:a[u]=n(c);}}return e.pop(),r.pop(),a}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,o);if(s instanceof Map)return new Map(i(Array.from(s),o));if(s instanceof Set)return new Set(i(Array.from(s),o));var a={};e.push(s),r.push(a);for(var u in s){var c=s[u];if(typeof c!="object"||c===null)a[u]=c;else if(c instanceof Date)a[u]=new Date(c);else if(c instanceof Map)a[u]=new Map(i(Array.from(c),o));else if(c instanceof Set)a[u]=new Set(i(Array.from(c),o));else if(ArrayBuffer.isView(c))a[u]=Gr(c);else {var h=e.indexOf(c);h!==-1?a[u]=r[h]:a[u]=o(c);}}return e.pop(),r.pop(),a}}});var Dd=M((YO,qd)=>{_();v();m();qd.exports=Nd()();});var Fd=M(Qr=>{_();v();m();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.validateTopics=Qr.validateTopic=void 0;function jd(t){let e=t.split("/");for(let r=0;r<e.length;r++)if(e[r]!=="+"){if(e[r]==="#")return r===e.length-1;if(e[r].indexOf("+")!==-1||e[r].indexOf("#")!==-1)return !1}return !0}Qr.validateTopic=jd;function e1(t){if(t.length===0)return "empty_topic_list";for(let e=0;e<t.length;e++)if(!jd(t[e]))return t[e];return null}Qr.validateTopics=e1;});var Xo=M(Jo=>{_();v();m();Object.defineProperty(Jo,"__esModule",{value:!0});var t1=Dt(),r1={objectMode:!0},i1={clean:!0},Yo=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},i1),e),this._inflights=new Map;}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new t1.Readable(r1),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o);}),e._read=()=>{!i&&n<r.length?e.push(r[n++]):e.push(null);},e.destroy=o=>{if(!i)return i=!0,setTimeout(()=>{e.emit("close");},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error("missing packet")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e();}};Jo.default=Yo;});var $d=M(Zo=>{_();v();m();Object.defineProperty(Zo,"__esModule",{value:!0});var Wd=[0,16,128,131,135,144,145,151,153],n1=(t,e,r)=>{t.log("handlePublish: packet %o",e),r=typeof r<"u"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:a}=t;if(t.options.protocolVersion===5){let u;if(e.properties&&(u=e.properties.topicAlias),typeof u<"u")if(i.length===0)if(u>0&&u<=65535){let c=t.topicAliasRecv.getTopicByAlias(u);if(c)i=c,t.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",i,u);else {t.log("handlePublish :: unregistered topic alias. alias: %d",u),t.emit("error",new Error("Received unregistered Topic Alias"));return}}else {t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}else if(t.topicAliasRecv.put(i,u))t.log("handlePublish :: registered topic: %s - alias: %d",i,u);else {t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(t.log("handlePublish: qos %d",o),o){case 2:{a.customHandleAcks(i,n,e,(u,c)=>{if(typeof u=="number"&&(c=u,u=null),u)return t.emit("error",u);if(Wd.indexOf(c)===-1)return t.emit("error",new Error("Wrong reason code for pubrec"));c?t._sendPacket({cmd:"pubrec",messageId:s,reasonCode:c},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:"pubrec",messageId:s},r);});});break}case 1:{a.customHandleAcks(i,n,e,(u,c)=>{if(typeof u=="number"&&(c=u,u=null),u)return t.emit("error",u);if(Wd.indexOf(c)===-1)return t.emit("error",new Error("Wrong reason code for puback"));c||t.emit("message",i,n,e),t.handleMessage(e,h=>{if(h)return r&&r(h);t._sendPacket({cmd:"puback",messageId:s,reasonCode:c},r);});});break}case 0:t.emit("message",i,n,e),t.handleMessage(e,r);break;default:t.log("handlePublish: unknown QoS. Doing nothing.");break}};Zo.default=n1;});var Yr=M(Wt=>{_();v();m();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.nextTick=Wt.applyMixin=Wt.ErrorWithReasonCode=void 0;var ea=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode";}};Wt.ErrorWithReasonCode=ea;function s1(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!=="constructor")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null));}Wt.applyMixin=s1;Wt.nextTick=B?B.nextTick:t=>{setTimeout(t,0);};});var Si=M(br=>{_();v();m();Object.defineProperty(br,"__esModule",{value:!0});br.ReasonCodes=void 0;br.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var o1=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s;if(!o){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let a=e.reasonCode;a&&a>0&&a!==16?(s=new Error(`Publish error: ${br.ReasonCodes[a]}`),s.code=a,t._removeOutgoingAndStoreMessage(r,()=>{o(s,e);})):t._removeOutgoingAndStoreMessage(r,o);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let a=e.reasonCode;a&&a>0&&a!==16?(s=new Error(`Publish error: ${br.ReasonCodes[a]}`),s.code=a,t._removeOutgoingAndStoreMessage(r,()=>{o(s,e);})):t._sendPacket(n);break}case"suback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let a=e.granted;for(let u=0;u<a.length;u++)if(a[u]&128){let c=t.messageIdToTopic[r];c&&c.forEach(h=>{delete t._resubscribeTopics[h];});}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(null,e);break}case"unsuback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null);break}default:t.emit("error",new Error("unrecognized packet type"));}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty");};br.default=o1;});var Vd=M(ta=>{_();v();m();Object.defineProperty(ta,"__esModule",{value:!0});var Hd=Yr(),a1=Si(),l1=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new Hd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit("error",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit("error",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else {let a=new Hd.ErrorWithReasonCode(`Connection refused: ${a1.ReasonCodes[n]}`,n);t.emit("error",a);}});};ta.default=l1;});var Yd=M(Bn=>{_();v();m();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.LRUCache=void 0;var Ai=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Kd=new Set,ra=typeof B=="object"&&B?B:{},Gd=(t,e,r,i)=>{typeof ra.emitWarning=="function"?ra.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`);},Cn=globalThis.AbortController,zd=globalThis.AbortSignal;if(typeof Cn>"u"){zd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n);}},Cn=class{constructor(){e();}signal=new zd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i);}}};let t=ra.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Gd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var u1=t=>!Kd.has(t),$t=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Qd=t=>$t(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Jr:null:null,Jr=class extends Array{constructor(e){super(e),this.fill(0);}},ia=class t{heap;length;static#l=!1;static create(e){let r=Qd(e);if(!r)return [];t.#l=!0;let i=new t(e,r);return t.#l=!1,i}constructor(e,r){if(!t.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},na=class t{#l;#c;#p;#g;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#n;#r;#e;#u;#h;#a;#s;#b;#o;#E;#S;#w;#_;#I;#f;static unsafeExposeInternals(e){return {starts:e.#S,ttls:e.#w,sizes:e.#E,keyMap:e.#n,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#x(r,i,n,o),moveToTail:r=>e.#C(r),indexes:r=>e.#m(r),rindexes:r=>e.#v(r),isStale:r=>e.#d(r)}}get max(){return this.#l}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#B}get dispose(){return this.#p}get disposeAfter(){return this.#g}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:u,dispose:c,disposeAfter:h,noDisposeOnSet:d,noUpdateTTL:g,maxSize:y=0,maxEntrySize:w=0,sizeCalculation:E,fetchMethod:S,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:U,ignoreFetchAbort:N}=e;if(r!==0&&!$t(r))throw new TypeError("max option must be a nonnegative integer");let W=r?Qd(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#l=r,this.#c=y,this.maxEntrySize=w||this.#c,this.sizeCalculation=E,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#B=S,this.#I=!!S,this.#n=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new W(r),this.#h=new W(r),this.#a=0,this.#s=0,this.#b=ia.create(r),this.#i=0,this.#y=0,typeof c=="function"&&(this.#p=c),typeof h=="function"?(this.#g=h,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#_=!!this.#p,this.#f=!!this.#g,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#c!==0&&!$t(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!$t(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q();}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=$t(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!$t(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k();}if(this.#l===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#c){let K="LRU_CACHE_UNBOUNDED";u1(K)&&(Kd.add(K),Gd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",K,t));}}getRemainingTTL(e){return this.#n.has(e)?1/0:0}#k(){let e=new Jr(this.#l),r=new Jr(this.#l);this.#w=e,this.#S=r,this.#M=(o,s,a=Ai.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#d(o)&&this.delete(this.#r[o]);},s+1);u.unref&&u.unref();}},this.#T=o=>{r[o]=e[o]!==0?Ai.now():0;},this.#A=(o,s)=>{if(e[s]){let a=e[s],u=r[s];o.ttl=a,o.start=u,o.now=i||n();let c=o.now-u;o.remainingTTL=a-c;}};let i=0,n=()=>{let o=Ai.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref();}return o};this.getRemainingTTL=o=>{let s=this.#n.get(o);if(s===void 0)return 0;let a=e[s],u=r[s];if(a===0||u===0)return 1/0;let c=(i||n())-u;return a-c},this.#d=o=>e[o]!==0&&r[o]!==0&&(i||n())-r[o]>e[o];}#T=()=>{};#A=()=>{};#M=()=>{};#d=()=>!1;#q(){let e=new Jr(this.#l);this.#y=0,this.#E=e,this.#R=r=>{this.#y-=e[r],e[r]=0;},this.#L=(r,i,n,o)=>{if(this.#t(i))return 0;if(!$t(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(i,r),!$t(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#P=(r,i,n)=>{if(e[r]=i,this.#c){let o=this.#c-e[r];for(;this.#y>o;)this.#O(!0);}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y);};}#R=e=>{};#P=(e,r,i)=>{};#L=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#m({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#s;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#a));)r=this.#h[r];}*#v({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#a;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#s));)r=this.#u[r];}#U(e){return e!==void 0&&this.#n.get(this.#r[e])===e}*entries(){for(let e of this.#m())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#r[e],this.#e[e]]);}*rentries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#r[e],this.#e[e]]);}*keys(){for(let e of this.#m()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r);}}*rkeys(){for(let e of this.#v()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r);}}*values(){for(let e of this.#m())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this);}}rforEach(e,r=this){for(let i of this.#v()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this);}}purgeStale(){let e=!1;for(let r of this.#v({allowStale:!0}))this.#d(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#m({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#w&&this.#S){s.ttl=this.#w[r];let a=Ai.now()-this.#S[r];s.start=Math.floor(Date.now()-a);}this.#E&&(s.size=this.#E[r]),e.unshift([i,s]);}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Ai.now()-n;}this.set(r,i.value,i);}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,h=this.#L(e,r,i.size||0,a);if(this.maxEntrySize&&h>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.#i===0?void 0:this.#n.get(e);if(d===void 0)d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#l?this.#O(!1):this.#i,this.#r[d]=e,this.#e[d]=r,this.#n.set(e,d),this.#u[this.#s]=d,this.#h[d]=this.#s,this.#s=d,this.#i++,this.#P(d,h,u),u&&(u.set="add"),c=!1;else {this.#C(d);let g=this.#e[d];if(r!==g){if(this.#I&&this.#t(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=g;y!==void 0&&!s&&(this.#_&&this.#p?.(y,e,"set"),this.#f&&this.#o?.push([y,e,"set"]));}else s||(this.#_&&this.#p?.(g,e,"set"),this.#f&&this.#o?.push([g,e,"set"]));if(this.#R(d),this.#P(d,h,u),this.#e[d]=r,u){u.set="replace";let y=g&&this.#t(g)?g.__staleWhileFetching:g;y!==void 0&&(u.oldValue=y);}}else u&&(u.set="update");}if(n!==0&&!this.#w&&this.#k(),this.#w&&(c||this.#M(d,n,o),u&&this.#A(u,d)),!s&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#g?.(...y);}return this}pop(){try{for(;this.#i;){let e=this.#e[this.#a];if(this.#O(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r);}}}#O(e){let r=this.#a,i=this.#r[r],n=this.#e[r];return this.#I&&this.#t(n)?n.__abortController.abort(new Error("evicted")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,i,"evict"),this.#f&&this.#o?.push([n,i,"evict"])),this.#R(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#b.push(r)),this.#i===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[r],this.#n.delete(i),this.#i--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#n.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return !1;if(this.#d(o))n&&(n.has="stale",this.#A(n,o));else return i&&this.#T(o),n&&(n.has="hit",this.#A(n,o)),!0}else n&&(n.has="miss");return !1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#n.get(e);if(n!==void 0&&(i||!this.#d(n))){let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}}#x(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new Cn,{signal:a}=i;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let u={signal:s.signal,options:i,context:n},c=(E,S=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&E!==void 0;if(i.status&&(I&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!S)return d(s.signal.reason);let R=y;return this.#e[r]===y&&(E===void 0?R.__staleWhileFetching?this.#e[r]=R.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,E,u.options))),E},h=E=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=E),d(E)),d=E=>{let{aborted:S}=s.signal,I=S&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,R=C||i.noDeleteOnFetchRejection,U=y;if(this.#e[r]===y&&(!R||U.__staleWhileFetching===void 0?this.delete(e):I||(this.#e[r]=U.__staleWhileFetching)),C)return i.status&&U.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw E},g=(E,S)=>{let I=this.#B?.(e,o,u);I&&I instanceof Promise&&I.then(C=>E(C===void 0?void 0:C),S),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(E(void 0),i.allowStaleOnFetchAbort&&(E=C=>c(C,!0)));});};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(g).then(c,h),w=Object.assign(y,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,w,{...u.options,status:void 0}),r=this.#n.get(e)):this.#e[r]=w,w}#t(e){if(!this.#I)return !1;let r=e;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Cn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:E,forceRefresh:S=!1,status:I,signal:C}=r;if(!this.#I)return I&&(I.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let R={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:u,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:I,signal:C},U=this.#n.get(e);if(U===void 0){I&&(I.fetch="miss");let N=this.#x(e,U,R,E);return N.__returned=N}else {let N=this.#e[U];if(this.#t(N)){let de=i&&N.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",de&&(I.returnedStale=!0)),de?N.__staleWhileFetching:N.__returned=N}let W=this.#d(U);if(!S&&!W)return I&&(I.fetch="hit"),this.#C(U),n&&this.#T(U),I&&this.#A(I,U),N;let K=this.#x(e,U,R,E),G=K.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=W?"stale":"refresh",G&&W&&(I.returnedStale=!0)),G?K.__staleWhileFetching:K.__returned=K}}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#n.get(e);if(a!==void 0){let u=this.#e[a],c=this.#t(u);return s&&this.#A(s,a),this.#d(a)?(s&&(s.get="stale"),c?(s&&i&&u.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?u.__staleWhileFetching:void 0):(o||this.delete(e),s&&i&&(s.returnedStale=!0),i?u:void 0)):(s&&(s.get="hit"),c?u.__staleWhileFetching:(this.#C(a),n&&this.#T(a),u))}else s&&(s.get="miss");}#N(e,r){this.#h[r]=e,this.#u[e]=r;}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#N(this.#h[e],this.#u[e]),this.#N(this.#s,e),this.#s=e);}delete(e){let r=!1;if(this.#i!==0){let i=this.#n.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.clear();else {this.#R(i);let n=this.#e[i];this.#t(n)?n.__abortController.abort(new Error("deleted")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,e,"delete"),this.#f&&this.#o?.push([n,e,"delete"])),this.#n.delete(e),this.#r[i]=void 0,this.#e[i]=void 0,i===this.#s?this.#s=this.#h[i]:i===this.#a?this.#a=this.#u[i]:(this.#u[this.#h[i]]=this.#u[i],this.#h[this.#u[i]]=this.#h[i]),this.#i--,this.#b.push(i);}}if(this.#f&&this.#o?.length){let i=this.#o,n;for(;n=i?.shift();)this.#g?.(...n);}return r}clear(){for(let e of this.#v({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else {let i=this.#r[e];this.#_&&this.#p?.(r,i,"delete"),this.#f&&this.#o?.push([r,i,"delete"]);}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#w&&this.#S&&(this.#w.fill(0),this.#S.fill(0)),this.#E&&this.#E.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r);}}};Bn.LRUCache=na;});var at=M(Ht=>{_();v();m();Object.defineProperty(Ht,"t",{value:!0});Ht.ContainerIterator=Ht.Container=Ht.Base=void 0;var sa=class{constructor(e=0){this.iteratorType=e;}equals(e){return this.o===e.o}};Ht.ContainerIterator=sa;var Pn=class{constructor(){this.i=0;}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};Ht.Base=Pn;var oa=class extends Pn{};Ht.Container=oa;});var Jd=M(On=>{_();v();m();Object.defineProperty(On,"t",{value:!0});On.default=void 0;var f1=at(),aa=class extends f1.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i);});}clear(){this.i=0,this.S=[];}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},c1=aa;On.default=c1;});var Xd=M(xn=>{_();v();m();Object.defineProperty(xn,"t",{value:!0});xn.default=void 0;var h1=at(),la=class extends h1.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i);});}clear(){this.q=[],this.i=this.j=0;}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n<i;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=e;}else this.q[this.j+this.i]=e;return ++this.i}pop(){if(this.i===0)return;let e=this.q[this.j++];return this.i-=1,e}front(){if(this.i!==0)return this.q[this.j]}},d1=la;xn.default=d1;});var Zd=M(kn=>{_();v();m();Object.defineProperty(kn,"t",{value:!0});kn.default=void 0;var p1=at(),ua=class extends p1.Base{constructor(e=[],r=function(n,o){return n>o?-1:n<o?1:0},i=!0){if(super(),this.v=r,Array.isArray(e))this.C=i?[...e]:e;else {this.C=[];let o=this;e.forEach(function(s){o.C.push(s);});}this.i=this.C.length;let n=this.i>>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n);}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i;}this.C[e]=r;}k(e,r){let i=this.C[e];for(;e<r;){let n=e<<1|1,o=n+1,s=this.C[n];if(o<this.i&&this.v(s,this.C[o])>0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n;}this.C[e]=i;}clear(){this.i=0,this.C.length=0;}push(e){this.C.push(e),this.m(this.i),this.i+=1;}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return [...this.C]}},g1=ua;kn.default=g1;});var Ln=M(Mn=>{_();v();m();Object.defineProperty(Mn,"t",{value:!0});Mn.default=void 0;var y1=at(),fa=class extends y1.Container{},b1=fa;Mn.default=b1;});var lt=M(ca=>{_();v();m();Object.defineProperty(ca,"t",{value:!0});ca.throwIteratorAccessError=w1;function w1(){throw new RangeError("Iterator access denied!")}});var da=M(Nn=>{_();v();m();Object.defineProperty(Nn,"t",{value:!0});Nn.RandomIterator=void 0;var _1=at(),Un=lt(),ha=class extends _1.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0, Un.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0, Un.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0, Un.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0, Un.throwIteratorAccessError)(),this.o-=1,this});}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e);}};Nn.RandomIterator=ha;});var ep=M(qn=>{_();v();m();Object.defineProperty(qn,"t",{value:!0});qn.default=void 0;var m1=E1(Ln()),v1=da();function E1(t){return t&&t.t?t:{default:t}}var wr=class t extends v1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r;}copy(){return new t(this.o,this.container,this.iteratorType)}},pa=class extends m1.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else {this.J=[];let i=this;e.forEach(function(n){i.pushBack(n);});}}clear(){this.i=0,this.J.length=0;}begin(){return new wr(0,this)}end(){return new wr(this.i,this)}rBegin(){return new wr(this.i-1,this,1)}rEnd(){return new wr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;i<this.i;++i)this.J[i]!==e&&(this.J[r++]=this.J[i]);return this.i=this.J.length=r,this.i}eraseElementByIterator(e){let r=e.o;return e=e.next(),this.eraseElementByPos(r),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=r;}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r<this.i;++r)if(this.J[r]===e)return new wr(r,this);return this.end()}reverse(){this.J.reverse();}unique(){let e=1;for(let r=1;r<this.i;++r)this.J[r]!==this.J[r-1]&&(this.J[e++]=this.J[r]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e);}forEach(e){for(let r=0;r<this.i;++r)e(this.J[r],r,this);}[Symbol.iterator](){return function*(){yield*this.J;}.bind(this)()}},S1=pa;qn.default=S1;});var tp=M(Dn=>{_();v();m();Object.defineProperty(Dn,"t",{value:!0});Dn.default=void 0;var A1=T1(Ln()),I1=at(),_r=lt();function T1(t){return t&&t.t?t:{default:t}}var mr=class t extends I1.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0, _r.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0, _r.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0, _r.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0, _r.throwIteratorAccessError)(),this.o=this.o.L,this});}get pointer(){return this.o===this.h&&(0, _r.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0, _r.throwIteratorAccessError)(),this.o.l=e;}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},ga=class extends A1.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i);});}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1;}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1;}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h;}begin(){return new mr(this.p,this.h,this)}end(){return new mr(this.h,this.h,this)}rBegin(){return new mr(this._,this.h,this,1)}rEnd(){return new mr(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0, _r.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r;}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else {let n=this.p;for(let s=1;s<e;++s)n=n.B;let o=n.B;for(this.i+=i;i--;)n.B={l:r,L:n},n.B.L=n,n=n.B;n.B=o,o.L=n;}return this.i}find(e){let r=this.p;for(;r!==this.h;){if(r.l===e)return new mr(r,this.h,this);r=r.B;}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,r=this._,i=0;for(;i<<1<this.i;){let n=e.l;e.l=r.l,r.l=n,e=e.B,r=r.L,i+=1;}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let r=e;for(;r.B!==this.h&&r.l===r.B.l;)r=r.B,this.i-=1;e.B=r.B,e.B.L=e,e=e.B;}return this.i}sort(e){if(this.i<=1)return;let r=[];this.forEach(function(n){r.push(n);}),r.sort(e);let i=this.p;r.forEach(function(n){i.l=n,i=i.B;});}merge(e){let r=this;if(this.i===0)e.forEach(function(i){r.pushBack(i);});else {let i=this.p;e.forEach(function(n){for(;i!==r.h&&i.l<=n;)i=i.B;r.G(n,i.L);});}return this.i}forEach(e){let r=this.p,i=0;for(;r!==this.h;)e(r.l,i++,this),r=r.B;}[Symbol.iterator](){return function*(){if(this.i===0)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B;}.bind(this)()}},R1=ga;Dn.default=R1;});var rp=M(jn=>{_();v();m();Object.defineProperty(jn,"t",{value:!0});jn.default=void 0;var C1=P1(Ln()),B1=da();function P1(t){return t&&t.t?t:{default:t}}var vr=class t extends B1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r;}copy(){return new t(this.o,this.container,this.iteratorType)}},ya=class extends C1.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s<this.P;++s)this.A.push(new Array(this.F));let n=Math.ceil(i/this.F);this.j=this.R=(this.P>>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s);});}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i<r;++i)e[i]=new Array(this.F);for(let i=this.j;i<this.P;++i)e[e.length]=this.A[i];for(let i=0;i<this.R;++i)e[e.length]=this.A[i];e[e.length]=[...this.A[this.R]],this.j=r,this.R=e.length-1;for(let i=0;i<r;++i)e[e.length]=new Array(this.F);this.A=e,this.P=e.length;}O(e){let r=this.D+e+1,i=r%this.F,n=i-1,o=this.j+(r-i)/this.F;return i===0&&(o-=1),o%=this.P,n<0&&(n+=this.F),{curNodeBucketIndex:o,curNodePointerIndex:n}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1;}begin(){return new vr(0,this)}end(){return new vr(this.i,this)}rBegin(){return new vr(this.i-1,this,1)}rEnd(){return new vr(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=e,this.i}popBack(){if(this.i===0)return;let e=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r;}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else {let n=[];for(let o=e;o<this.i;++o)n.push(this.getElementByPos(o));this.cut(e-1);for(let o=0;o<i;++o)this.pushBack(r);for(let o=0;o<n.length;++o)this.pushBack(n[o]);}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.R=r,this.N=i,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else {let r=[];for(let n=e+1;n<this.i;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack();let i=this;r.forEach(function(n){i.pushBack(n);});}return this.i}eraseElementByValue(e){if(this.i===0)return 0;let r=[];for(let n=0;n<this.i;++n){let o=this.getElementByPos(n);o!==e&&r.push(o);}let i=r.length;for(let n=0;n<i;++n)this.setElementByPos(n,r[n]);return this.cut(i-1)}eraseElementByIterator(e){let r=e.o;return this.eraseElementByPos(r),e=e.next(),e}find(e){for(let r=0;r<this.i;++r)if(this.getElementByPos(r)===e)return new vr(r,this);return this.end()}reverse(){let e=0,r=this.i-1;for(;e<r;){let i=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(r)),this.setElementByPos(r,i),e+=1,r-=1;}}unique(){if(this.i<=1)return this.i;let e=1,r=this.getElementByPos(0);for(let i=1;i<this.i;++i){let n=this.getElementByPos(i);n!==r&&(r=n,this.setElementByPos(e++,n));}for(;this.i>e;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i<this.i;++i)r.push(this.getElementByPos(i));r.sort(e);for(let i=0;i<this.i;++i)this.setElementByPos(i,r[i]);}shrinkToFit(){if(this.i===0)return;let e=[];this.forEach(function(r){e.push(r);}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let r=0;r<this.P;++r)this.A.push(new Array(this.F));for(let r=0;r<e.length;++r)this.pushBack(e[r]);}forEach(e){for(let r=0;r<this.i;++r)e(this.getElementByPos(r),r,this);}[Symbol.iterator](){return function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e);}.bind(this)()}},O1=ya;jn.default=O1;});var ip=M(Xr=>{_();v();m();Object.defineProperty(Xr,"t",{value:!0});Xr.TreeNodeEnableIndex=Xr.TreeNode=void 0;var Fn=class{constructor(e,r){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=e,this.l=r;}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else {let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r;}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else {let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};Xr.TreeNode=Fn;var ba=class extends Fn{constructor(){super(...arguments),this.rt=1;}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt);}};Xr.TreeNodeEnableIndex=ba;});var _a=M(Wn=>{_();v();m();Object.defineProperty(Wn,"t",{value:!0});Wn.default=void 0;var np=ip(),x1=at(),sp=lt(),wa=class extends x1.Container{constructor(e=function(i,n){return i<n?-1:i>n?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=np.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let a=s.tt;for(;a!==this.h;)a.rt+=1,a=a.tt;let u=this.he(s);if(u){let{parentNode:c,grandParent:h,curNode:d}=u;c.ie(),h.ie(),d.ie();}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt;}):(this.re=np.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re;}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r);}else {let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r);}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r;}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else {let o=i.tt;o.U===i?o.U=e:o.W=e;}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1;}else {let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else {let o=i.tt;o.U===i?o.U=e:o.W=e;}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1;}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else {let a=this.h.W,u=this.v(a.u,e);if(u===0){a.l=r;return}else if(u<0)a.W=new this.re(e,r),a.W.tt=a,n=a.W,this.h.W=n;else {if(i!==void 0){let c=i.o;if(c!==this.h){let h=this.v(c.u,e);if(h===0){c.l=r;return}else if(h>0){let d=c.L(),g=this.v(d.u,e);if(g===0){d.l=r;return}else g<0&&(n=new this.re(e,r),d.W===void 0?(d.W=n,n.tt=d):(c.U=n,n.tt=c));}}}if(n===void 0)for(n=this.Y;;){let c=this.v(n.u,e);if(c>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U;}else if(c<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W;}else {n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0;}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0, sp.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return !1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return !1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0, sp.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this);}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1;}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},k1=wa;Wn.default=k1;});var va=M(Hn=>{_();v();m();Object.defineProperty(Hn,"t",{value:!0});Hn.default=void 0;var M1=at(),$n=lt(),ma=class extends M1.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0, $n.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0, $n.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0, $n.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0, $n.throwIteratorAccessError)(),this.o=this.o.L(),this});}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n;}return i}},L1=ma;Hn.default=L1;});var ap=M(Vn=>{_();v();m();Object.defineProperty(Vn,"t",{value:!0});Vn.default=void 0;var U1=op(_a()),N1=op(va()),q1=lt();function op(t){return t&&t.t?t:{default:t}}var Ke=class t extends N1.default{constructor(e,r,i,n){super(e,r,n),this.container=i;}get pointer(){return this.o===this.h&&(0, q1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ea=class extends U1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o);});}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W));}begin(){return new Ke(this.h.U||this.h,this.h,this)}end(){return new Ke(this.h,this.h,this)}rBegin(){return new Ke(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ke(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ke(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ke(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ke(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ke(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ke(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i);}),this.i}[Symbol.iterator](){return this.K(this.Y)}},D1=Ea;Vn.default=D1;});var up=M(zn=>{_();v();m();Object.defineProperty(zn,"t",{value:!0});zn.default=void 0;var j1=lp(_a()),F1=lp(va()),W1=lt();function lp(t){return t&&t.t?t:{default:t}}var Ge=class t extends F1.default{constructor(e,r,i,n){super(e,r,n),this.container=i;}get pointer(){this.o===this.h&&(0, W1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Sa=class extends j1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1]);});}*K(e){e!==void 0&&(yield*this.K(e.U),yield [e.u,e.l],yield*this.K(e.W));}begin(){return new Ge(this.h.U||this.h,this.h,this)}end(){return new Ge(this.h,this.h,this)}rBegin(){return new Ge(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ge(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return [e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return [e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new Ge(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ge(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ge(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ge(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new Ge(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1]);}),this.i}[Symbol.iterator](){return this.K(this.Y)}},$1=Sa;zn.default=$1;});var Ia=M(Aa=>{_();v();m();Object.defineProperty(Aa,"t",{value:!0});Aa.default=H1;function H1(t){let e=typeof t;return e==="object"&&t!==null||e==="function"}});var Ba=M(Zr=>{_();v();m();Object.defineProperty(Zr,"t",{value:!0});Zr.HashContainerIterator=Zr.HashContainer=void 0;var fp=at(),Ta=V1(Ia()),Ii=lt();function V1(t){return t&&t.t?t:{default:t}}var Ra=class extends fp.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0, Ii.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0, Ii.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0, Ii.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0, Ii.throwIteratorAccessError)(),this.o=this.o.L,this});}};Zr.HashContainerIterator=Ra;var Ca=class extends fp.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h;}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1;}M(e,r,i){i===void 0&&(i=(0, Ta.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n);}else {let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n;}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0, Ta.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e];}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h;}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0, Ta.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return !1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n];}else {if(i=this.g[e],i===void 0)return !1;delete this.g[e];}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0, Ii.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};Zr.HashContainer=Ca;});var hp=M(Kn=>{_();v();m();Object.defineProperty(Kn,"t",{value:!0});Kn.default=void 0;var cp=Ba(),z1=lt(),Er=class t extends cp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i;}get pointer(){return this.o===this.h&&(0, z1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Pa=class extends cp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i);});}begin(){return new Er(this.p,this.h,this)}end(){return new Er(this.h,this.h,this)}rBegin(){return new Er(this._,this.h,this,1)}rEnd(){return new Er(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new Er(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B;}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B;}.bind(this)()}},K1=Pa;Kn.default=K1;});var pp=M(Gn=>{_();v();m();Object.defineProperty(Gn,"t",{value:!0});Gn.default=void 0;var dp=Ba(),G1=Y1(Ia()),Q1=lt();function Y1(t){return t&&t.t?t:{default:t}}var Sr=class t extends dp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i;}get pointer(){this.o===this.h&&(0, Q1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Oa=class extends dp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1]);});}begin(){return new Sr(this.p,this.h,this)}end(){return new Sr(this.h,this.h,this)}rBegin(){return new Sr(this._,this.h,this,1)}rEnd(){return new Sr(this.h,this.h,this,1)}front(){if(this.i!==0)return [this.p.u,this.p.l]}back(){if(this.i!==0)return [this._.u,this._.l]}setElement(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0, G1.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return [r.u,r.l]}find(e,r){let i=this.I(e,r);return new Sr(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B;}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield [e.u,e.l],e=e.B;}.bind(this)()}},J1=Oa;Gn.default=J1;});var gp=M(je=>{_();v();m();Object.defineProperty(je,"t",{value:!0});Object.defineProperty(je,"Deque",{enumerable:!0,get:function(){return iv.default}});Object.defineProperty(je,"HashMap",{enumerable:!0,get:function(){return av.default}});Object.defineProperty(je,"HashSet",{enumerable:!0,get:function(){return ov.default}});Object.defineProperty(je,"LinkList",{enumerable:!0,get:function(){return rv.default}});Object.defineProperty(je,"OrderedMap",{enumerable:!0,get:function(){return sv.default}});Object.defineProperty(je,"OrderedSet",{enumerable:!0,get:function(){return nv.default}});Object.defineProperty(je,"PriorityQueue",{enumerable:!0,get:function(){return ev.default}});Object.defineProperty(je,"Queue",{enumerable:!0,get:function(){return Z1.default}});Object.defineProperty(je,"Stack",{enumerable:!0,get:function(){return X1.default}});Object.defineProperty(je,"Vector",{enumerable:!0,get:function(){return tv.default}});var X1=ut(Jd()),Z1=ut(Xd()),ev=ut(Zd()),tv=ut(ep()),rv=ut(tp()),iv=ut(rp()),nv=ut(ap()),sv=ut(up()),ov=ut(hp()),av=ut(pp());function ut(t){return t&&t.t?t:{default:t}}});var bp=M((fN,yp)=>{_();v();m();var lv=gp().OrderedSet,ft=ot()("number-allocator:trace"),uv=ot()("number-allocator:error");function Te(t,e){this.low=t,this.high=e;}Te.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Te.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0};function ct(t,e){if(!(this instanceof ct))return new ct(t,e);this.min=t,this.max=e,this.ss=new lv([],(r,i)=>r.compare(i)),ft("Create"),this.clear();}ct.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};ct.prototype.alloc=function(){if(this.ss.size()===0)return ft("alloc():empty"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Te(e+1,r)):this.ss.eraseElementByPos(0),ft("alloc():"+i),i};ct.prototype.use=function(t){let e=new Te(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),ft("use():"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Te(i+1,n)),ft("use():"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Te(i,n-1)),ft("use():"+t),!0):(this.ss.updateKeyByIterator(r,new Te(t+1,n)),this.ss.insert(new Te(i,t-1)),ft("use():"+t),!0)}return ft("use():failed"),!1};ct.prototype.free=function(t){if(t<this.min||t>this.max){uv("free():"+t+" is out of range");return}let e=new Te(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Te(i,t)):this.ss.insert(e);}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Te(t,i));}else this.ss.insert(e);else {let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Te(o,n))):this.ss.updateKeyByIterator(r,new Te(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Te(t,n))):this.ss.insert(e);}ft("free():"+t);};ct.prototype.clear=function(){ft("clear()"),this.ss.clear(),this.ss.insert(new Te(this.min,this.max));};ct.prototype.intervalCount=function(){return this.ss.size()};ct.prototype.dump=function(){console.log("length:"+this.ss.size());for(let t of this.ss)console.log(t);};yp.exports=ct;});var xa=M((mN,wp)=>{_();v();m();var fv=bp();wp.exports.NumberAllocator=fv;});var _p=M(Ma=>{_();v();m();Object.defineProperty(Ma,"__esModule",{value:!0});var cv=Yd(),hv=xa(),ka=class{constructor(e){e>0&&(this.aliasToTopic=new cv.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new hv.NumberAllocator(1,e),this.max=e,this.length=0);}put(e,r){if(r===0||r>this.max)return !1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0;}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};Ma.default=ka;});var mp=M(Ti=>{_();v();m();var dv=Ti&&Ti.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ti,"__esModule",{value:!0});var pv=Si(),gv=dv(_p()),yv=Yr(),bv=(t,e)=>{t.log("_handleConnack");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new gv.default(e.properties.topicAliasMaximum));}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive,t._shiftPingInterval()),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize);}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new yv.ErrorWithReasonCode(`Connection refused: ${pv.ReasonCodes[n]}`,n);t.emit("error",o);}};Ti.default=bv;});var vp=M(La=>{_();v();m();Object.defineProperty(La,"__esModule",{value:!0});var wv=(t,e,r)=>{t.log("handling pubrel packet");let i=typeof r<"u"?r:t.noop,{messageId:n}=e,o={cmd:"pubcomp",messageId:n};t.incomingStore.get(e,(s,a)=>{s?t._sendPacket(o,i):(t.emit("message",a.topic,a.payload,a),t.handleMessage(a,u=>{if(u)return i(u);t.incomingStore.del(a,t.noop),t._sendPacket(o,i);}));});};La.default=wv;});var Ep=M(Ri=>{_();v();m();var Ci=Ri&&Ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ri,"__esModule",{value:!0});var _v=Ci($d()),mv=Ci(Vd()),vv=Ci(mp()),Ev=Ci(Si()),Sv=Ci(vp()),Av=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<e.length)return t.emit("error",new Error(`exceeding packets size ${e.cmd}`)),t.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),t;switch(t.log("_handlePacket :: emitting packetreceive"),t.emit("packetreceive",e),e.cmd){case"publish":(0, _v.default)(t,e,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":(0, Ev.default)(t,e),r();break;case"pubrel":(0, Sv.default)(t,e,r);break;case"connack":(0, vv.default)(t,e),r();break;case"auth":(0, mv.default)(t,e),r();break;case"pingresp":t.pingResp=!0,r();break;case"disconnect":t.emit("disconnect",e),r();break;default:t.log("_handlePacket :: unknown command"),r();break}};Ri.default=Av;});var Sp=M(ei=>{_();v();m();var Iv=ei&&ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ei,"__esModule",{value:!0});ei.TypedEventEmitter=void 0;var Tv=Iv((ir(),Z(rr))),Rv=Yr(),Qn=class{};ei.TypedEventEmitter=Qn;(0, Rv.applyMixin)(Qn,Tv.default);});var Ip=M((Yn,Ap)=>{_();v();m();(function(t,e){typeof Yn=="object"&&typeof Ap<"u"?e(Yn):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.fastUniqueNumbers={}));})(Yn,function(t){var e=function(g){return function(y){var w=g(y);return y.add(w),w}},r=function(g){return function(y,w){return g.set(y,w),w}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,y){return function(w){var E=y.get(w),S=E===void 0?w.size:E<o?E+1:0;if(!w.has(S))return g(w,S);if(w.size<n){for(;w.has(S);)S=Math.floor(Math.random()*o);return g(w,S)}if(w.size>i)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;w.has(S);)S=Math.floor(Math.random()*i);return g(w,S)}},a=new WeakMap,u=r(a),c=s(u,a),h=e(c);t.addUniqueNumber=h,t.generateUniqueNumber=c;});});var Rp=M((Jn,Tp)=>{_();v();m();(function(t,e){typeof Jn=="object"&&typeof Tp<"u"?e(Jn,Ip()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers));})(Jn,function(t,e){var r=function(s){return s.method!==void 0&&s.method==="call"},i=function(s){return s.error===null&&typeof s.id=="number"},n=function(s){var a=new Map([[0,function(){}]]),u=new Map([[0,function(){}]]),c=new Map,h=new Worker(s);h.addEventListener("message",function(E){var S=E.data;if(r(S)){var I=S.params,C=I.timerId,R=I.timerType;if(R==="interval"){var U=a.get(C);if(typeof U=="number"){var N=c.get(U);if(N===void 0||N.timerId!==C||N.timerType!==R)throw new Error("The timer is in an undefined state.")}else if(typeof U<"u")U();else throw new Error("The timer is in an undefined state.")}else if(R==="timeout"){var W=u.get(C);if(typeof W=="number"){var K=c.get(W);if(K===void 0||K.timerId!==C||K.timerType!==R)throw new Error("The timer is in an undefined state.")}else if(typeof W<"u")W(),u.delete(C);else throw new Error("The timer is in an undefined state.")}}else if(i(S)){var z=S.id,G=c.get(z);if(G===void 0)throw new Error("The timer is in an undefined state.");var de=G.timerId,Gt=G.timerType;c.delete(z),Gt==="interval"?a.delete(de):u.delete(de);}else {var pe=S.error.message;throw new Error(pe)}});var d=function(S){var I=e.generateUniqueNumber(c);c.set(I,{timerId:S,timerType:"interval"}),a.set(S,I),h.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"interval"}});},g=function(S){var I=e.generateUniqueNumber(c);c.set(I,{timerId:S,timerType:"timeout"}),u.set(S,I),h.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"timeout"}});},y=function(S,I){var C=e.generateUniqueNumber(a);return a.set(C,function(){S(),typeof a.get(C)=="function"&&h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}});}),h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}}),C},w=function(S,I){var C=e.generateUniqueNumber(u);return u.set(C,S),h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"timeout"}}),C};return {clearInterval:d,clearTimeout:g,setInterval:y,setTimeout:w}};t.load=n;});});var Bp=M((Xn,Cp)=>{_();v();m();(function(t,e){typeof Xn=="object"&&typeof Cp<"u"?e(Xn,Rp()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker));})(Xn,function(t,e){var r=function(h,d){var g=null;return function(){if(g!==null)return g;var y=new Blob([d],{type:"application/javascript; charset=utf-8"}),w=URL.createObjectURL(y);return g=h(w),setTimeout(function(){return URL.revokeObjectURL(w)}),g}},i=`(()=>{var e={67:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error('The given type "'.concat(c,'" is not supported'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error('The given method "'.concat(t.method,'" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error('The given type "'.concat(v,'" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(67)})()})();`,n=r(e.load,i),o=function(h){return n().clearInterval(h)},s=function(h){return n().clearTimeout(h)},a=function(h,d){return n().setInterval(h,d)},u=function(h,d){return n().setTimeout(h,d)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=a,t.setTimeout=u;});});var Zn=M(Bi=>{_();v();m();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.isWebWorker=void 0;var Cv=()=>typeof window<"u"&&typeof window.document<"u",Pp=()=>{var t,e;return !!(typeof self=="object"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes("WorkerGlobalScope")))},Bv=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Pv=Cv()||Pp()||Bv();Bi.isWebWorker=Pp();Bi.default=Pv;});var xp=M(Rt=>{_();v();m();var Ov=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n);}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r];}),xv=Rt&&Rt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e});}:function(t,e){t.default=e;}),kv=Rt&&Rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ov(e,t,r);return xv(e,t),e};Object.defineProperty(Rt,"__esModule",{value:!0});var Op=Bp(),es=kv(Zn()),Ua=class{constructor(e,r){this._setTimeout=es.default&&!es.isWebWorker?Op.setTimeout:(i,n)=>setTimeout(i,n),this._clearTimeout=es.default&&!es.isWebWorker?Op.clearTimeout:i=>clearTimeout(i),this.keepalive=e*1e3,this.checkPing=r,this.reschedule();}clear(){this.timer&&(this._clearTimeout(this.timer),this.timer=null);}reschedule(){this.clear(),this.timer=this._setTimeout(()=>{this.checkPing(),this.timer&&this.reschedule();},this.keepalive);}};Rt.default=Ua;});var rs=M(Qe=>{_();v();m();var Mv=Qe&&Qe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n);}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r];}),Lv=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e});}:function(t,e){t.default=e;}),Uv=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Mv(e,t,r);return Lv(e,t),e},Vt=Qe&&Qe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qe,"__esModule",{value:!0});var Nv=Vt(zu()),Na=Vt(Ld()),qv=Vt(Qo()),Dv=Dt(),kp=Vt(Dd()),Mp=Uv(Fd()),jv=Vt(ot()),ts=Vt(Xo()),Fv=Vt(Ep()),Da=Yr(),Wv=Sp(),$v=Vt(xp()),qa=globalThis.setImmediate||((...t)=>{let e=t.shift();(0, Da.nextTick)(()=>{e(...t);});}),Lp={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0},ja=class t extends Wv.TypedEventEmitter{static defaultId(){return `mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in Lp)typeof this.options[i]>"u"?this.options[i]=Lp[i]:this.options[i]=r[i];this.log=this.options.log||(0, jv.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId=="string"?r.clientId:t.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0);},this.options.writeCache||(Na.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new qv.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new ts.default,this.incomingStore=r.incomingStore||new ts.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new Nv.default(r.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log("deliver :: entry %o",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log("deliver :: call _sendPacket for %o",s);let a=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(a=!1)),a?this._sendPacket(s,u=>{o.cb&&o.cb(u),n();}):(this.log("messageId: %d has already used. The message is skipped and removed.",s.messageId),n());};this.log("connect :: sending queued packets"),n();}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this.log("close :: clearing ping timer"),this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect();}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect());}handleAuth(e,r){r();}handleMessage(e,r){r();}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new Dv.Writable,i=Na.default.parser(this.options),n=null,o=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",h=>{this.log("parser :: on packet push to packets array."),o.push(h);});let s=()=>{this.log("work :: getting next packet in queue");let h=o.shift();if(h)this.log("work :: packet pulled from queue"),(0, Fv.default)(this,h,a);else {this.log("work :: no packets in queue");let d=n;n=null,this.log("work :: done flag is %s",!!d),d&&d();}},a=()=>{if(o.length)(0, Da.nextTick)(s);else {let h=n;n=null,h();}};r._write=(h,d,g)=>{n=g,this.log("writable stream :: parsing buffer"),i.parse(h),s();};let u=h=>{this.log("streamErrorHandler :: error",h.message),h.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",h)):this.noop(h);};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",u),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close");}),this.log("connect: sending packet `connect`");let c={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(c.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(c),i.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let h=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(h);}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this._cleanUp(!0);},this.options.connectTimeout),this}publish(e,r,i,n){this.log("publish :: message `%s` to topic `%s`",r,e);let{options:o}=this;typeof i=="function"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:a,retain:u,dup:c,properties:h,cbStorePut:d}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let y=0;if((a===1||a===2)&&(y=this._nextId(),y===null))return this.log("No messageId left"),!1;let w={cmd:"publish",topic:e,payload:r,qos:a,retain:u,messageId:y,dup:c};switch(o.protocolVersion===5&&(w.properties=h),this.log("publish :: qos",a),a){case 1:case 2:this.outgoing[w.messageId]={volatile:!1,cb:n||this.noop},this.log("MqttClient:publish: packet cmd: %s",w.cmd),this._sendPacket(w,void 0,d);break;default:this.log("MqttClient:publish: packet cmd: %s",w.cmd),this._sendPacket(w,n,d);break}return !0};return (this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,a)=>{s?o(s):n(a);});})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r=="function"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e=="string"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e=="object"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let a=Mp.validateTopics(s);if(a!==null)return qa(i,new Error(`Invalid topic ${a}`)),this;if(this._checkDisconnecting(i))return this.log("subscribe: discconecting true"),this;let u={qos:0};n===5&&(u.nl=!1,u.rap=!1,u.rh=0),r=Object.assign(Object.assign({},u),r);let c=r.properties,h=[],d=(y,w)=>{if(w=w||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,y)||this._resubscribeTopics[y].qos<w.qos||o){let E={topic:y,qos:w.qos};n===5&&(E.nl=w.nl,E.rap=w.rap,E.rh=w.rh,E.properties=c),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",E.topic,E.qos),h.push(E);}};if(Array.isArray(e)?e.forEach(y=>{this.log("subscribe: array topic %s",y),d(y);}):Object.keys(e).forEach(y=>{this.log("subscribe: object topic %s, %o",y,e[y]),d(y,e[y]);}),!h.length)return i(null,[]),this;let g=()=>{let y=this._nextId();if(y===null)return this.log("No messageId left"),!1;let w={cmd:"subscribe",subscriptions:h,messageId:y};if(c&&(w.properties=c),this.options.resubscribe){this.log("subscribe :: resubscribe true");let E=[];h.forEach(S=>{if(this.options.reconnectPeriod>0){let I={qos:S.qos};n===5&&(I.nl=S.nl||!1,I.rap=S.rap||!1,I.rh=S.rh||0,I.properties=S.properties),this._resubscribeTopics[S.topic]=I,E.push(S.topic);}}),this.messageIdToTopic[w.messageId]=E;}return this.outgoing[w.messageId]={volatile:!0,cb(E,S){if(!E){let{granted:I}=S;for(let C=0;C<I.length;C+=1)h[C].qos=I[C];}i(E,h);}},this.log("subscribe :: call _sendPacket"),this._sendPacket(w),!0};return (this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s);});})}unsubscribe(e,r,i){typeof e=="string"&&(e=[e]),typeof r=="function"&&(i=r),i=i||this.noop;let n=Mp.validateTopics(e);if(n!==null)return qa(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log("No messageId left"),!1;let a={cmd:"unsubscribe",messageId:s,unsubscriptions:[]};return typeof e=="string"?a.unsubscriptions=[e]:Array.isArray(e)&&(a.unsubscriptions=e),this.options.resubscribe&&a.unsubscriptions.forEach(u=>{delete this._resubscribeTopics[u];}),typeof r=="object"&&r.properties&&(a.properties=r.properties),this.outgoing[a.messageId]={volatile:!0,cb:i},this.log("unsubscribe: call _sendPacket"),this._sendPacket(a),!0};return (this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s);});})}end(e,r,i){this.log("end :: (%s)",this.options.clientId),(e==null||typeof e!="boolean")&&(i=i||r,r=e,e=!1),typeof r!="object"&&(i=i||r,r=null),this.log("end :: cb? %s",!!i),(!i||typeof i!="function")&&(i=this.noop);let n=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(a=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),i){let u=s||a;this.log("end :: closeStores: invoking callback with args"),i(u);}});}),this._deferredReconnect&&this._deferredReconnect();},o=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0, Da.nextTick)(n);},r);};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i();});})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error("Message removed"));});}return this}reconnect(e){this.log("client reconnect");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new ts.default,this.outgoingStore=this.options.outgoingStore||new ts.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect();};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e]);}));}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e]);}));}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",r,i),i.length===0){if(typeof r>"u")return new Error("Unregistered Topic Alias");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>"u")return new Error("Unregistered Topic Alias");e.topic=i;}r&&delete e.properties.topicAlias;}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect();}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect());}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect();},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...");}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null);}_cleanUp(e,r,i={}){if(r&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),this.log("_cleanUp :: forced? %s",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else {let n=Object.assign({cmd:"disconnect"},i);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(n,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),qa(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId);});});});}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer&&(this.log("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),r&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r());}_storeAndSend(e,r,i){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n=e,o;if(n.cmd==="publish"&&(n=(0, kp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r);});}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd==="publish"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",i,r),!this.topicAliasSend.put(i,r)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e);}_writePacket(e,r){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this._shiftPingInterval(),this.log("_writePacket :: writing to stream");let i=Na.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",i),!i&&r&&r!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",r)):r&&(this.log("_writePacket :: invoking cb"),r());}_sendPacket(e,r,i,n){this.log("_sendPacket :: (%s) :: start",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd==="auth"){this._writePacket(e,r);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case"publish":break;case"pubrel":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId);}_storePacket(e,r,i){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!r),i=i||this.noop;let n=e;if(n.cmd==="publish"){n=(0, kp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!=="publish"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i();})):r&&r(new Error("No connection to broker"));}_setupPingTimer(){this.log("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive),!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=new $v.default(this.options.keepalive,()=>{this._checkPing();}));}_shiftPingInterval(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule();}_checkPing(){this.log("_checkPing :: checking ping..."),this.pingResp?(this.log("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(this.log("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0));}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let r=0;r<e.length;r++){let i={};i[e[r]]=this._resubscribeTopics[e[r]],i.resubscribe=!0,this.subscribe(i,{properties:i[e[r]].properties});}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1;}_onConnect(e){if(this.disconnected){this.emit("connect",e);return}this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;let r=()=>{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o();},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={};};this.once("close",n),i.on("error",a=>{o(),this._flushStoreProcessingQueue(),this.removeListener("close",n),this.emit("error",a);});let s=()=>{if(!i)return;let a=i.read(1),u;if(!a){i.once("readable",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[a.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(u=this.outgoing[a.messageId]?this.outgoing[a.messageId].cb:null,this.outgoing[a.messageId]={volatile:!1,cb(c,h){u&&u(c,h),s();}},this._packetIdsDuringStoreProcessing[a.messageId]=!0,this.messageIdProvider.register(a.messageId)?this._sendPacket(a,void 0,void 0,!0):this.log("messageId: %d has already used.",a.messageId)):i.destroy&&i.destroy();};i.on("end",()=>{let a=!0;for(let u in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[u]){a=!1;break}this.removeListener("close",n),a?(o(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):r();}),s();};r();}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return !1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0);}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue();});}};Qe.default=ja;});var Up=M(Wa=>{_();v();m();Object.defineProperty(Wa,"__esModule",{value:!0});var Hv=xa(),Fa=class{constructor(){this.numberAllocator=new Hv.NumberAllocator(1,65535);}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e);}clear(){this.numberAllocator.clear();}};Wa.default=Fa;});function Ar(t){throw new RangeError(Gv[t])}function Np(t,e){let r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);let n=function(o,s){let a=[],u=o.length;for(;u--;)a[u]=s(o[u]);return a}((t=t.replace(Kv,".")).split("."),e).join(".");return i+n}function Fp(t){let e=[],r=0,i=t.length;for(;r<i;){let n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){let o=t.charCodeAt(r++);(64512&o)==56320?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--);}else e.push(n);}return e}var Vv,zv,Kv,Gv,ht,$a,qp,Wp,Dp,jp,zt,$p=be(()=>{_();v();m();Vv=/^xn--/,zv=/[^\0-\x7E]/,Kv=/[\x2E\u3002\uFF0E\uFF61]/g,Gv={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ht=Math.floor,$a=String.fromCharCode;qp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Wp=function(t,e,r){let i=0;for(t=r?ht(t/700):t>>1,t+=ht(t/e);t>455;i+=36)t=ht(t/35);return ht(i+36*t/(t+38))},Dp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let u=0;u<s;++u)t.charCodeAt(u)>=128&&Ar("not-basic"),e.push(t.charCodeAt(u));for(let u=s>0?s+1:0;u<r;){let c=i;for(let d=1,g=36;;g+=36){u>=r&&Ar("invalid-input");let y=(a=t.charCodeAt(u++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(y>=36||y>ht((2147483647-i)/d))&&Ar("overflow"),i+=y*d;let w=g<=o?1:g>=o+26?26:g-o;if(y<w)break;let E=36-w;d>ht(2147483647/E)&&Ar("overflow"),d*=E;}let h=e.length+1;o=Wp(i-c,h,c==0),ht(i/h)>2147483647-n&&Ar("overflow"),n+=ht(i/h),i%=h,e.splice(i++,0,n);}var a;return String.fromCodePoint(...e)},jp=function(t){let e=[],r=(t=Fp(t)).length,i=128,n=0,o=72;for(let u of t)u<128&&e.push($a(u));let s=e.length,a=s;for(s&&e.push("-");a<r;){let u=2147483647;for(let h of t)h>=i&&h<u&&(u=h);let c=a+1;u-i>ht((2147483647-n)/c)&&Ar("overflow"),n+=(u-i)*c,i=u;for(let h of t)if(h<i&&++n>2147483647&&Ar("overflow"),h==i){let d=n;for(let g=36;;g+=36){let y=g<=o?1:g>=o+26?26:g-o;if(d<y)break;let w=d-y,E=36-y;e.push($a(qp(y+w%E,0))),d=ht(w/E);}e.push($a(qp(d,0))),o=Wp(n,c,a==s),n=0,++a;}++n,++i;}return e.join("")},zt={version:"2.1.0",ucs2:{decode:Fp,encode:t=>String.fromCodePoint(...t)},decode:Dp,encode:jp,toASCII:function(t){return Np(t,function(e){return zv.test(e)?"xn--"+jp(e):e})},toUnicode:function(t){return Np(t,function(e){return Vv.test(e)?Dp(e.slice(4).toLowerCase()):e})}};zt.decode;zt.encode;zt.toASCII;zt.toUnicode;zt.ucs2;zt.version;});function Qv(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Yv,Pi,Jv,dt,Hp=be(()=>{_();v();m();Yv=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if(typeof t!="string"||t.length===0)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys=="number"&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var u=0;u<a;++u){var c,h,d,g,y=t[u].replace(o,"%20"),w=y.indexOf(r);w>=0?(c=y.substr(0,w),h=y.substr(w+1)):(c=y,h=""),d=decodeURIComponent(c),g=decodeURIComponent(h),Qv(n,d)?Array.isArray(n[d])?n[d].push(g):n[d]=[n[d],g]:n[d]=g;}return n},Pi=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return ""}},Jv=function(t,e,r,i){return e=e||"&",r=r||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(n){var o=encodeURIComponent(Pi(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(Pi(s))}).join(e):o+encodeURIComponent(Pi(t[n]))}).join(e):i?encodeURIComponent(Pi(i))+r+encodeURIComponent(Pi(t)):""},dt={};dt.decode=dt.parse=Yv,dt.encode=dt.stringify=Jv;dt.decode;dt.encode;dt.parse;dt.stringify;});function Ha(){throw new Error("setTimeout has not been defined")}function Va(){throw new Error("clearTimeout has not been defined")}function Kp(t){if(Bt===setTimeout)return setTimeout(t,0);if((Bt===Ha||!Bt)&&setTimeout)return Bt=setTimeout,setTimeout(t,0);try{return Bt(t,0)}catch{try{return Bt.call(null,t,0)}catch{return Bt.call(this||ri,t,0)}}}function Xv(){ti&&Ir&&(ti=!1,Ir.length?Ot=Ir.concat(Ot):is=-1,Ot.length&&Gp());}function Gp(){if(!ti){var t=Kp(Xv);ti=!0;for(var e=Ot.length;e;){for(Ir=Ot,Ot=[];++is<e;)Ir&&Ir[is].run();is=-1,e=Ot.length;}Ir=null,ti=!1,function(r){if(Pt===clearTimeout)return clearTimeout(r);if((Pt===Va||!Pt)&&clearTimeout)return Pt=clearTimeout,clearTimeout(r);try{Pt(r);}catch{try{return Pt.call(null,r)}catch{return Pt.call(this||ri,r)}}}(t);}}function Vp(t,e){(this||ri).fun=t,(this||ri).array=e;}function Ct(){}var zp,Bt,Pt,ri,fe,Ir,Ot,ti,is,ne,Qp=be(()=>{_();v();m();ri=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,fe=zp={};(function(){try{Bt=typeof setTimeout=="function"?setTimeout:Ha;}catch{Bt=Ha;}try{Pt=typeof clearTimeout=="function"?clearTimeout:Va;}catch{Pt=Va;}})();Ot=[],ti=!1,is=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ot.push(new Vp(t,e)),Ot.length!==1||ti||Kp(Gp);},Vp.prototype.run=function(){(this||ri).fun.apply(null,(this||ri).array);},fe.title="browser",fe.browser=!0,fe.env={},fe.argv=[],fe.version="",fe.versions={},fe.on=Ct,fe.addListener=Ct,fe.once=Ct,fe.off=Ct,fe.removeListener=Ct,fe.removeAllListeners=Ct,fe.emit=Ct,fe.prependListener=Ct,fe.prependOnceListener=Ct,fe.listeners=function(t){return []},fe.binding=function(t){throw new Error("process.binding is not supported")},fe.cwd=function(){return "/"},fe.chdir=function(t){throw new Error("process.chdir is not supported")},fe.umask=function(){return 0};ne=zp;ne.addListener;ne.argv;ne.binding;ne.browser;ne.chdir;ne.cwd;ne.emit;ne.env;ne.listeners;ne.nextTick;ne.off;ne.on;ne.once;ne.prependListener;ne.prependOnceListener;ne.removeAllListeners;ne.removeListener;ne.title;ne.umask;ne.version;ne.versions;});function Zv(){if(Yp)return za;Yp=!0;var t=za={},e,r;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i;}catch{e=i;}try{typeof clearTimeout=="function"?r=clearTimeout:r=n;}catch{r=n;}})();function o(E){if(e===setTimeout)return setTimeout(E,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this||ii,E,0)}}}function s(E){if(r===clearTimeout)return clearTimeout(E);if((r===n||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(E);try{return r(E)}catch{try{return r.call(null,E)}catch{return r.call(this||ii,E)}}}var a=[],u=!1,c,h=-1;function d(){!u||!c||(u=!1,c.length?a=c.concat(a):h=-1,a.length&&g());}function g(){if(!u){var E=o(d);u=!0;for(var S=a.length;S;){for(c=a,a=[];++h<S;)c&&c[h].run();h=-1,S=a.length;}c=null,u=!1,s(E);}}t.nextTick=function(E){var S=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)S[I-1]=arguments[I];a.push(new y(E,S)),a.length===1&&!u&&o(g);};function y(E,S){(this||ii).fun=E,(this||ii).array=S;}y.prototype.run=function(){(this||ii).fun.apply(null,(this||ii).array);},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function w(){}return t.on=w,t.addListener=w,t.once=w,t.off=w,t.removeListener=w,t.removeAllListeners=w,t.emit=w,t.prependListener=w,t.prependOnceListener=w,t.listeners=function(E){return []},t.binding=function(E){throw new Error("process.binding is not supported")},t.cwd=function(){return "/"},t.chdir=function(E){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},za}var za,Yp,ii,re,Ka=be(()=>{_();v();m();za={},Yp=!1,ii=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;re=Zv();re.platform="browser";re.addListener;re.argv;re.binding;re.browser;re.chdir;re.cwd;re.emit;re.env;re.listeners;re.nextTick;re.off;re.on;re.once;re.prependListener;re.prependOnceListener;re.removeAllListeners;re.removeListener;re.title;re.umask;re.version;re.versions;});function eE(){if(Jp)return Ga;Jp=!0;var t=re;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",u=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g<o.length)d=o.charCodeAt(g);else {if(d===47)break;d=47;}if(d===47){if(!(c===g-1||h===1))if(c!==g-1&&h===2){if(a.length<2||u!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",u=0):(a=a.slice(0,y),u=a.length-1-a.lastIndexOf("/")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a="",u=0,c=g,h=0;continue}}s&&(a.length>0?a+="/..":a="..",u=2);}else a.length>0?a+="/"+o.slice(c+1,g):a=o.slice(c+1,g),u=g-c-1;c=g,h=0;}else d===46&&h!==-1?++h:h=-1;}return a}function i(o,s){var a=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+u:a+o+u:u}var n={resolve:function(){for(var s="",a=!1,u,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(u===void 0&&(u=t.cwd()),h=u),e(h),h.length!==0&&(s=h+"/"+s,a=h.charCodeAt(0)===47);}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return ".";var a=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&u&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return ".";for(var s,a=0;a<arguments.length;++a){var u=arguments[a];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u);}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return "";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var c=s.length,h=c-u,d=1;d<a.length&&a.charCodeAt(d)===47;++d);for(var g=a.length,y=g-d,w=h<y?h:y,E=-1,S=0;S<=w;++S){if(S===w){if(y>w){if(a.charCodeAt(d+S)===47)return a.slice(d+S+1);if(S===0)return a.slice(d+S)}else h>w&&(s.charCodeAt(u+S)===47?E=S:S===0&&(E=0));break}var I=s.charCodeAt(u+S),C=a.charCodeAt(d+S);if(I!==C)break;I===47&&(E=S);}var R="";for(S=u+E+1;S<=c;++S)(S===c||s.charCodeAt(S)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+a.slice(d+E):(d+=E,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return ".";for(var a=s.charCodeAt(0),u=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?u?"/":".":u&&c===1?"//":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return "";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){u=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y));}return u===c?c=y:c===-1&&(c=s.length),s.slice(u,c)}else {for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){u=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?"":s.slice(u,c)}},extname:function(s){e(s);for(var a=-1,u=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){u=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1);}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===u+1?"":s.slice(a,c)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var u=s.charCodeAt(0),c=u===47,h;c?(a.root="/",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,E=s.length-1,S=0;E>=h;--E){if(u=s.charCodeAt(E),u===47){if(!w){g=E+1;break}continue}y===-1&&(w=!1,y=E+1),u===46?d===-1?d=E:S!==1&&(S=1):d!==-1&&(S=-1);}return d===-1||y===-1||S===0||S===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Ga=n,Ga}var Ga,Jp,Qa,Xp=be(()=>{_();v();m();Ka();Ga={},Jp=!1;Qa=eE();});var og={};Qt(og,{URL:()=>PE,Url:()=>IE,default:()=>X,fileURLToPath:()=>ng,format:()=>TE,parse:()=>BE,pathToFileURL:()=>sg,resolve:()=>RE,resolveObject:()=>CE});function Fe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null;}function Oi(t,e,r){if(t&&pt.isObject(t)&&t instanceof Fe)return t;var i=new Fe;return i.parse(t,e,r),i}function lE(){if(rg)return Xa;rg=!0;var t=ne;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",u=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g<o.length)d=o.charCodeAt(g);else {if(d===47)break;d=47;}if(d===47){if(!(c===g-1||h===1))if(c!==g-1&&h===2){if(a.length<2||u!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",u=0):(a=a.slice(0,y),u=a.length-1-a.lastIndexOf("/")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a="",u=0,c=g,h=0;continue}}s&&(a.length>0?a+="/..":a="..",u=2);}else a.length>0?a+="/"+o.slice(c+1,g):a=o.slice(c+1,g),u=g-c-1;c=g,h=0;}else d===46&&h!==-1?++h:h=-1;}return a}function i(o,s){var a=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+u:a+o+u:u}var n={resolve:function(){for(var s="",a=!1,u,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(u===void 0&&(u=t.cwd()),h=u),e(h),h.length!==0&&(s=h+"/"+s,a=h.charCodeAt(0)===47);}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return ".";var a=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&u&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return ".";for(var s,a=0;a<arguments.length;++a){var u=arguments[a];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u);}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return "";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var c=s.length,h=c-u,d=1;d<a.length&&a.charCodeAt(d)===47;++d);for(var g=a.length,y=g-d,w=h<y?h:y,E=-1,S=0;S<=w;++S){if(S===w){if(y>w){if(a.charCodeAt(d+S)===47)return a.slice(d+S+1);if(S===0)return a.slice(d+S)}else h>w&&(s.charCodeAt(u+S)===47?E=S:S===0&&(E=0));break}var I=s.charCodeAt(u+S),C=a.charCodeAt(d+S);if(I!==C)break;I===47&&(E=S);}var R="";for(S=u+E+1;S<=c;++S)(S===c||s.charCodeAt(S)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+a.slice(d+E):(d+=E,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return ".";for(var a=s.charCodeAt(0),u=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?u?"/":".":u&&c===1?"//":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return "";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){u=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y));}return u===c?c=y:c===-1&&(c=s.length),s.slice(u,c)}else {for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){u=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?"":s.slice(u,c)}},extname:function(s){e(s);for(var a=-1,u=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){u=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1);}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===u+1?"":s.slice(a,c)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var u=s.charCodeAt(0),c=u===47,h;c?(a.root="/",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,E=s.length-1,S=0;E>=h;--E){if(u=s.charCodeAt(E),u===47){if(!w){g=E+1;break}continue}y===-1&&(w=!1,y=E+1),u===46?d===-1?d=E:S!==1&&(S=1):d!==-1&&(S=-1);}return d===-1||y===-1||S===0||S===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Xa=n,Xa}function mE(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return el?vE(t):EE(t)}function vE(t){let e=t.hostname,r=t.pathname;for(let i=0;i<r.length;i++)if(r[i]==="%"){let n=r.codePointAt(i+2)||32;if(r[i+1]==="2"&&n===102||r[i+1]==="5"&&n===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(pE,"\\"),r=decodeURIComponent(r),e!=="")return `\\\\${e}${r}`;{let i=r.codePointAt(1)|32,n=r[2];if(i<hE||i>dE||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function EE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)||32;if(e[r+1]==="2"&&i===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function SE(t){let e=ig.resolve(t),r=t.charCodeAt(t.length-1);(r===cE||el&&r===fE)&&e[e.length-1]!==ig.sep&&(e+="/");let i=new URL("file://");return e.includes("%")&&(e=e.replace(gE,"%25")),!el&&e.includes("\\")&&(e=e.replace(yE,"%5C")),e.includes(`
|
3254
|
+
`)&&(e=e.replace(bE,"%0A")),e.includes("\r")&&(e=e.replace(wE,"%0D")),e.includes(" ")&&(e=e.replace(_E,"%09")),i.pathname=e,i}function ng(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return tl?FE(t):WE(t)}function FE(t){let e=t.hostname,r=t.pathname;for(let i=0;i<r.length;i++)if(r[i]==="%"){let n=r.codePointAt(i+2)||32;if(r[i+1]==="2"&&n===102||r[i+1]==="5"&&n===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(LE,"\\"),r=decodeURIComponent(r),e!=="")return `\\\\${e}${r}`;{let i=r.codePointAt(1)|32,n=r[2];if(i<kE||i>ME||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function WE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)||32;if(e[r+1]==="2"&&i===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function sg(t){let e=Qa.resolve(t),r=t.charCodeAt(t.length-1);(r===xE||tl&&r===OE)&&e[e.length-1]!==Qa.sep&&(e+="/");let i=new URL("file://");return e.includes("%")&&(e=e.replace(UE,"%25")),!tl&&e.includes("\\")&&(e=e.replace(NE,"%5C")),e.includes(`
|
3255
|
+
`)&&(e=e.replace(qE,"%0A")),e.includes("\r")&&(e=e.replace(DE,"%0D")),e.includes(" ")&&(e=e.replace(jE,"%09")),i.pathname=e,i}var X,tE,pt,rE,iE,nE,sE,Za,Zp,eg,tg,oE,aE,Ya,ni,Ja,Xa,rg,ig,uE,fE,cE,hE,dE,el,pE,gE,yE,bE,wE,_E,AE,IE,TE,RE,CE,BE,PE,OE,xE,kE,ME,tl,LE,UE,NE,qE,DE,jE,ag=be(()=>{_();v();m();$p();Hp();Qp();Xp();Ka();X={},tE=zt,pt={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};X.parse=Oi,X.resolve=function(t,e){return Oi(t,!1,!0).resolve(e)},X.resolveObject=function(t,e){return t?Oi(t,!1,!0).resolveObject(e):e},X.format=function(t){return pt.isString(t)&&(t=Oi(t)),t instanceof Fe?t.format():Fe.prototype.format.call(t)},X.Url=Fe;rE=/^([a-z0-9.+-]+:)/i,iE=/:[0-9]*$/,nE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,sE=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
3256
|
+
`," "]),Za=["'"].concat(sE),Zp=["%","/","?",";","#"].concat(Za),eg=["/","?","#"],tg=/^[+a-z0-9A-Z_-]{0,63}$/,oE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,aE={javascript:!0,"javascript:":!0},Ya={javascript:!0,"javascript:":!0},ni={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ja=dt;Fe.prototype.parse=function(t,e,r){if(!pt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=i!==-1&&i<t.indexOf("#")?"?":"#",o=t.split(n);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(n);if(s=s.trim(),!r&&t.split("#").length===1){var a=nE.exec(s);if(a)return this.path=s,this.href=s,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?Ja.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=rE.exec(s);if(u){var c=(u=u[0]).toLowerCase();this.protocol=c,s=s.substr(u.length);}if(r||u||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var h=s.substr(0,2)==="//";!h||u&&Ya[u]||(s=s.substr(2),this.slashes=!0);}if(!Ya[u]&&(h||u&&!ni[u])){for(var d,g,y=-1,w=0;w<eg.length;w++)(E=s.indexOf(eg[w]))!==-1&&(y===-1||E<y)&&(y=E);for((g=y===-1?s.lastIndexOf("@"):s.lastIndexOf("@",y))!==-1&&(d=s.slice(0,g),s=s.slice(g+1),this.auth=decodeURIComponent(d)),y=-1,w=0;w<Zp.length;w++){var E;(E=s.indexOf(Zp[w]))!==-1&&(y===-1||E<y)&&(y=E);}y===-1&&(y=s.length),this.host=s.slice(0,y),s=s.slice(y),this.parseHost(),this.hostname=this.hostname||"";var S=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!S)for(var I=this.hostname.split(/\./),C=(w=0,I.length);w<C;w++){var R=I[w];if(R&&!R.match(tg)){for(var U="",N=0,W=R.length;N<W;N++)R.charCodeAt(N)>127?U+="x":U+=R[N];if(!U.match(tg)){var K=I.slice(0,w),z=I.slice(w+1),G=R.match(oE);G&&(K.push(G[1]),z.unshift(G[2])),z.length&&(s="/"+z.join(".")+s),this.hostname=K.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=tE.toASCII(this.hostname));var de=this.port?":"+this.port:"",Gt=this.hostname||"";this.host=Gt+de,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!=="/"&&(s="/"+s));}if(!aE[c])for(w=0,C=Za.length;w<C;w++){var pe=Za[w];if(s.indexOf(pe)!==-1){var Rr=encodeURIComponent(pe);Rr===pe&&(Rr=escape(pe)),s=s.split(pe).join(Rr);}}var Cr=s.indexOf("#");Cr!==-1&&(this.hash=s.substr(Cr),s=s.slice(0,Cr));var Br=s.indexOf("?");if(Br!==-1?(this.search=s.substr(Br),this.query=s.substr(Br+1),e&&(this.query=Ja.parse(this.query)),s=s.slice(0,Br)):e&&(this.search="",this.query={}),s&&(this.pathname=s),ni[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){de=this.pathname||"";var ls=this.search||"";this.path=de+ls;}return this.href=this.format(),this},Fe.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=!1,o="";this.host?n=t+this.host:this.hostname&&(n=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&pt.isObject(this.query)&&Object.keys(this.query).length&&(o=Ja.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||ni[e])&&n!==!1?(n="//"+(n||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),s&&s.charAt(0)!=="?"&&(s="?"+s),e+n+(r=r.replace(/[?#]/g,function(a){return encodeURIComponent(a)}))+(s=s.replace("#","%23"))+i},Fe.prototype.resolve=function(t){return this.resolveObject(Oi(t,!1,!0)).format()},Fe.prototype.resolveObject=function(t){if(pt.isString(t)){var e=new Fe;e.parse(t,!1,!0),t=e;}for(var r=new Fe,i=Object.keys(this),n=0;n<i.length;n++){var o=i[n];r[o]=this[o];}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];u!=="protocol"&&(r[u]=t[u]);}return ni[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!ni[t.protocol]){for(var c=Object.keys(t),h=0;h<c.length;h++){var d=c[h];r[d]=t[d];}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||Ya[t.protocol])r.pathname=t.pathname;else {for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/");}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var y=r.pathname||"",w=r.search||"";r.path=y+w;}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var E=r.pathname&&r.pathname.charAt(0)==="/",S=t.host||t.pathname&&t.pathname.charAt(0)==="/",I=S||E||r.host&&t.pathname,C=I,R=r.pathname&&r.pathname.split("/")||[],U=(g=t.pathname&&t.pathname.split("/")||[],r.protocol&&!ni[r.protocol]);if(U&&(r.hostname="",r.port=null,r.host&&(R[0]===""?R[0]=r.host:R.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),I=I&&(g[0]===""||R[0]==="")),S)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,R=g;else if(g.length)R||(R=[]),R.pop(),R=R.concat(g),r.search=t.search,r.query=t.query;else if(!pt.isNullOrUndefined(t.search))return U&&(r.hostname=r.host=R.shift(),(G=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=G.shift(),r.host=r.hostname=G.shift())),r.search=t.search,r.query=t.query,pt.isNull(r.pathname)&&pt.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!R.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var N=R.slice(-1)[0],W=(r.host||t.host||R.length>1)&&(N==="."||N==="..")||N==="",K=0,z=R.length;z>=0;z--)(N=R[z])==="."?R.splice(z,1):N===".."?(R.splice(z,1),K++):K&&(R.splice(z,1),K--);if(!I&&!C)for(;K--;K)R.unshift("..");!I||R[0]===""||R[0]&&R[0].charAt(0)==="/"||R.unshift(""),W&&R.join("/").substr(-1)!=="/"&&R.push("");var G,de=R[0]===""||R[0]&&R[0].charAt(0)==="/";return U&&(r.hostname=r.host=de?"":R.length?R.shift():"",(G=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=G.shift(),r.host=r.hostname=G.shift())),(I=I||r.host&&R.length)&&!de&&R.unshift(""),R.length?r.pathname=R.join("/"):(r.pathname=null,r.path=null),pt.isNull(r.pathname)&&pt.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Fe.prototype.parseHost=function(){var t=this.host,e=iE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t);};X.Url;X.format;X.resolve;X.resolveObject;Xa={},rg=!1;ig=lE(),uE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=SE;X.fileURLToPath=mE;X.Url;X.format;X.resolve;X.resolveObject;X.URL;fE=92,cE=47,hE=97,dE=122,el=uE==="win32",pE=/\//g,gE=/%/g,yE=/\\/g,bE=/\n/g,wE=/\r/g,_E=/\t/g;AE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=sg;X.fileURLToPath=ng;IE=X.Url,TE=X.format,RE=X.resolve,CE=X.resolveObject,BE=X.parse,PE=X.URL,OE=92,xE=47,kE=97,ME=122,tl=AE==="win32",LE=/\//g,UE=/%/g,NE=/\\/g,qE=/\n/g,DE=/\r/g,jE=/\t/g;});var rl={};Qt(rl,{Server:()=>Me,Socket:()=>Me,Stream:()=>Me,_createServerHandle:()=>Me,_normalizeArgs:()=>Me,_setSimultaneousAccepts:()=>Me,connect:()=>Me,createConnection:()=>Me,createServer:()=>Me,default:()=>$E,isIP:()=>Me,isIPv4:()=>Me,isIPv6:()=>Me});function Me(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var $E,il=be(()=>{_();v();m();$E={_createServerHandle:Me,_normalizeArgs:Me,_setSimultaneousAccepts:Me,connect:Me,createConnection:Me,createServer:Me,isIP:Me,isIPv4:Me,isIPv6:Me,Server:Me,Socket:Me,Stream:Me};});var nl=M(xi=>{_();v();m();var lg=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,"__esModule",{value:!0});var HE=lg((il(),Z(rl))),VE=lg(ot()),zE=(0, VE.default)("mqttjs:tcp"),KE=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";let{port:r}=e,i=e.hostname;return zE("port %d and host %s",r,i),HE.default.createConnection(r,i)};xi.default=KE;});var ug={};Qt(ug,{default:()=>GE});var GE,fg=be(()=>{_();v();m();GE={};});var ol=M(ki=>{_();v();m();var sl=ki&&ki.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ki,"__esModule",{value:!0});var QE=sl((fg(),Z(ug))),YE=sl((il(),Z(rl))),JE=sl(ot()),XE=(0, JE.default)("mqttjs:tls"),ZE=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",YE.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,XE("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);let r=QE.default.connect(e);r.on("secureConnect",()=>{e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i);});function i(n){e.rejectUnauthorized&&t.emit("error",n),r.end();}return r.on("error",i),r};ki.default=ZE;});var ns=M(si=>{_();v();m();Object.defineProperty(si,"__esModule",{value:!0});si.BufferedDuplex=si.writev=void 0;var eS=Dt();function cg(t,e){let r=new Array(t.length);for(let i=0;i<t.length;i++)typeof t[i].chunk=="string"?r[i]=x.from(t[i].chunk,"utf8"):r[i]=t[i].chunk;this._write(x.concat(r),"binary",e);}si.writev=cg;var al=class extends eS.Duplex{constructor(e,r,i){super({objectMode:!0}),this.proxy=r,this.socket=i,this.writeQueue=[],e.objectMode||(this._writev=cg.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",n=>{this.push(n);});}_read(e){this.proxy.read(e);}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i});}_final(e){this.writeQueue=[],this.proxy.end(e);}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue();}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once("drain",i):i();}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i);}}};si.BufferedDuplex=al;});var fl=M(ul=>{_();v();m();Object.defineProperty(ul,"__esModule",{value:!0});var hg=(we(),Z(ve)),tS=Dt(),rS=ns(),gt,ll,Le;function iS(){let t=new tS.Transform;return t._write=(e,r,i)=>{gt.send({data:e.buffer,success(){i();},fail(n){i(new Error(n));}});},t._flush=e=>{gt.close({success(){e();}});},t}function nS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={});}function sS(t,e){let r=t.protocol==="wxs"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function oS(){gt.onOpen(()=>{Le.socketReady();}),gt.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=hg.Buffer.from(e):e=hg.Buffer.from(e,"utf8"),ll.push(e);}),gt.onClose(()=>{Le.emit("close"),Le.end(),Le.destroy();}),gt.onError(t=>{let e=new Error(t.errMsg);Le.destroy(e);});}var aS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";nS(e);let i=sS(e,t);gt=wx.connectSocket({url:i,protocols:[r]}),ll=iS(),Le=new rS.BufferedDuplex(e,ll,gt),Le._destroy=(o,s)=>{gt.close({success(){s&&s(o);}});};let n=Le.destroy;return Le.destroy=(o,s)=>(Le.destroy=n,setTimeout(()=>{gt.close({fail(){Le._destroy(o,s);}});},0),Le),oS(),Le};ul.default=aS;});var dl=M(hl=>{_();v();m();Object.defineProperty(hl,"__esModule",{value:!0});var cl=(we(),Z(ve)),lS=Dt(),uS=ns(),xt,ss,oi,dg=!1;function fS(){let t=new lS.Transform;return t._write=(e,r,i)=>{xt.sendSocketMessage({data:e.buffer,success(){i();},fail(){i(new Error);}});},t._flush=e=>{xt.closeSocket({success(){e();}});},t}function cS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={});}function hS(t,e){let r=t.protocol==="alis"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function dS(){dg||(dg=!0,xt.onSocketOpen(()=>{oi.socketReady();}),xt.onSocketMessage(t=>{if(typeof t.data=="string"){let e=cl.Buffer.from(t.data,"base64");ss.push(e);}else {let e=new FileReader;e.addEventListener("load",()=>{let r=e.result;r instanceof ArrayBuffer?r=cl.Buffer.from(r):r=cl.Buffer.from(r,"utf8"),ss.push(r);}),e.readAsArrayBuffer(t.data);}}),xt.onSocketClose(()=>{oi.end(),oi.destroy();}),xt.onSocketError(t=>{oi.destroy(t);}));}var pS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";cS(e);let i=hS(e,t);return xt=e.my,xt.connectSocket({url:i,protocols:r}),ss=fS(),oi=new uS.BufferedDuplex(e,ss,xt),dS(),oi};hl.default=pS;});var gg=M((fD,pg)=>{_();v();m();pg.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};});var bl=M(Mi=>{_();v();m();var yl=Mi&&Mi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mi,"__esModule",{value:!0});var pl=(we(),Z(ve)),yg=yl(gg()),gS=yl(ot()),yS=Dt(),bg=yl(Zn()),gl=ns(),Kt=(0, gS.default)("mqttjs:ws"),bS=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function wg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function _g(t){let e=t;return t.hostname||(e.hostname="localhost"),t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!bg.default&&t.protocol==="wss"&&bS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r]);}),e}function wS(t){let e=_g(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port));}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function _S(t,e,r){Kt("createWebSocket"),Kt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";Kt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new yg.default(e,[i],r.wsOptions),n}function mS(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",i=wg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType="arraybuffer",n}var vS=(t,e)=>{Kt("streamBuilder");let r=_g(e),i=wg(r,t),n=_S(t,i,r),o=yg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on("close",()=>{o.destroy();}),o},ES=(t,e)=>{Kt("browserStreamBuilder");let r,n=wS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,a=mS(t,e),u=h(e,E,S);e.objectMode||(u._writev=gl.writev.bind(u)),u.on("close",()=>{a.close();});let c=typeof a.addEventListener<"u";a.readyState===a.OPEN?(r=u,r.socket=a):(r=new gl.BufferedDuplex(e,u,a),c?a.addEventListener("open",d):a.onopen=d),c?(a.addEventListener("close",g),a.addEventListener("error",y),a.addEventListener("message",w)):(a.onclose=g,a.onerror=y,a.onmessage=w);function h(I,C,R){let U=new yS.Transform({objectMode:I.objectMode});return U._write=C,U._flush=R,U}function d(){Kt("WebSocket onOpen"),r instanceof gl.BufferedDuplex&&r.socketReady();}function g(I){Kt("WebSocket onClose",I),r.end(),r.destroy();}function y(I){Kt("WebSocket onError",I);let C=new Error("WebSocket error");C.event=I,r.destroy(C);}function w(I){let{data:C}=I;C instanceof ArrayBuffer?C=pl.Buffer.from(C):C=pl.Buffer.from(C,"utf8"),u.push(C);}function E(I,C,R){if(a.bufferedAmount>n){setTimeout(E,o,I,C,R);return}s&&typeof I=="string"&&(I=pl.Buffer.from(I,"utf8"));try{a.send(I);}catch(U){return R(U)}R();}function S(I){a.close(),I();}return r};Mi.default=bg.default?ES:vS;});var Eg=M(Tr=>{_();v();m();var os=Tr&&Tr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.connectAsync=void 0;var SS=os(ot()),AS=os((ag(),Z(og))),IS=os(rs()),TS=os(Zn()),mg=(0, SS.default)("mqttjs"),Re={};TS.default?(Re.wx=fl().default,Re.wxs=fl().default,Re.ali=dl().default,Re.alis=dl().default):(Re.mqtt=nl().default,Re.tcp=nl().default,Re.ssl=ol().default,Re.tls=Re.ssl,Re.mqtts=ol().default);Re.ws=bl().default;Re.wss=bl().default;function RS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth);}function vg(t,e){if(mg("connecting to an MQTT broker..."),typeof t=="object"&&!e&&(e=t,t=""),e=e||{},t&&typeof t=="string"){let n=AS.default.parse(t,!0);if(n.port!=null&&(n.port=Number(n.port)),e=Object.assign(Object.assign({},n),e),e.protocol===null)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"");}if(RS(e),e.query&&typeof e.query.clientId=="string"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if(["mqtts","wss","wxs","alis"].indexOf(e.protocol)===-1)switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${e.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(!Re[e.protocol]){let n=["mqtts","wss"].indexOf(e.protocol)!==-1;e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((o,s)=>n&&s%2===0?!1:typeof Re[o]=="function")[0];}if(e.clean===!1&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);function r(n){return e.servers&&((!n._reconnectCount||n._reconnectCount===e.servers.length)&&(n._reconnectCount=0),e.host=e.servers[n._reconnectCount].host,e.port=e.servers[n._reconnectCount].port,e.protocol=e.servers[n._reconnectCount].protocol?e.servers[n._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,n._reconnectCount++),mg("calling streambuilder for",e.protocol),Re[e.protocol](n,e)}let i=new IS.default(r,e);return i.on("error",()=>{}),i}function CS(t,e,r=!0){return new Promise((i,n)=>{let o=vg(t,e),s={connect:u=>{a(),i(o);},end:()=>{a(),i(o);},error:u=>{a(),o.end(),n(u);}};r===!1&&(s.close=()=>{s.error(new Error("Couldn't connect to server"));});function a(){Object.keys(s).forEach(u=>{o.off(u,s[u]);});}Object.keys(s).forEach(u=>{o.on(u,s[u]);});})}Tr.connectAsync=CS;Tr.default=vg;});var wl=M(Q=>{_();v();m();var Sg=Q&&Q.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n);}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r];}),BS=Q&&Q.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e});}:function(t,e){t.default=e;}),PS=Q&&Q.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sg(e,t,r);return BS(e,t),e},Ag=Q&&Q.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sg(e,t,r);},as=Q&&Q.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Q,"__esModule",{value:!0});Q.ReasonCodes=Q.UniqueMessageIdProvider=Q.DefaultMessageIdProvider=Q.Store=Q.MqttClient=Q.connectAsync=Q.connect=Q.Client=void 0;var Ig=as(rs());Q.MqttClient=Ig.default;var OS=as(Qo());Q.DefaultMessageIdProvider=OS.default;var xS=as(Up());Q.UniqueMessageIdProvider=xS.default;var kS=as(Xo());Q.Store=kS.default;var Tg=PS(Eg());Q.connect=Tg.default;Object.defineProperty(Q,"connectAsync",{enumerable:!0,get:function(){return Tg.connectAsync}});Q.Client=Ig.default;Ag(rs(),Q);Ag(Yr(),Q);var MS=Si();Object.defineProperty(Q,"ReasonCodes",{enumerable:!0,get:function(){return MS.ReasonCodes}});});var DS=M(We=>{_();v();m();var Rg=We&&We.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n);}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r];}),LS=We&&We.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e});}:function(t,e){t.default=e;}),US=We&&We.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rg(e,t,r);return LS(e,t),e},NS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rg(e,t,r);};Object.defineProperty(We,"__esModule",{value:!0});var qS=US(wl());We.default=qS;NS(wl(),We);});var mqtt = DS();
|
3257
|
+
/*! Bundled license information:
|
3258
|
+
|
3259
|
+
@jspm/core/nodelibs/browser/buffer.js:
|
3260
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
3261
|
+
*/
|
3262
|
+
|
3263
|
+
class CloudInteropAPI {
|
3264
|
+
connectParams;
|
3265
|
+
_sessionDetails;
|
3266
|
+
_mqttClient;
|
3267
|
+
reconnectRetryLimit = 30;
|
3268
|
+
reconnectRetries = 0;
|
3269
|
+
contextListener;
|
3270
|
+
constructor(connectParams) {
|
3271
|
+
this.connectParams = connectParams;
|
3272
|
+
}
|
3273
|
+
get sessionDetails() {
|
3274
|
+
return this._sessionDetails;
|
3275
|
+
}
|
3276
|
+
get mqttClient() {
|
3277
|
+
return this._mqttClient;
|
3278
|
+
}
|
3279
|
+
async connect(params) {
|
3280
|
+
const { userId, sourceId, platformId } = params;
|
3281
|
+
let connectResponse;
|
3282
|
+
try {
|
3283
|
+
connectResponse = await axios.post(`${this.connectParams.url}/sessions`, {
|
3284
|
+
userId,
|
3285
|
+
sourceId,
|
3286
|
+
platformId
|
3287
|
+
});
|
3288
|
+
if (connectResponse.status !== 200) {
|
3289
|
+
console.warn(`Failed to connect to Cloud Interop at ${this.connectParams.url}`);
|
3290
|
+
return;
|
3291
|
+
}
|
3292
|
+
const sessionRootTopic = connectResponse.data.sessionRootTopic;
|
3293
|
+
const lastWillPayload = {
|
3294
|
+
userId,
|
3295
|
+
sourceId,
|
3296
|
+
platformId,
|
3297
|
+
sessionId: connectResponse.data.sessionId,
|
3298
|
+
};
|
3299
|
+
const clientOptions = {
|
3300
|
+
clientId: connectResponse.data.sessionId,
|
3301
|
+
clean: true,
|
3302
|
+
protocolVersion: 5,
|
3303
|
+
will: {
|
3304
|
+
topic: 'interop/lastwill',
|
3305
|
+
payload: Buffer.from(JSON.stringify(lastWillPayload)),
|
3306
|
+
qos: 0,
|
3307
|
+
retain: false
|
3308
|
+
},
|
3309
|
+
};
|
3310
|
+
if (connectResponse.data.mqttToken) {
|
3311
|
+
clientOptions.username = connectResponse.data.mqttToken;
|
3312
|
+
}
|
3313
|
+
this._mqttClient = await mqtt.connectAsync(connectResponse.data.mqttUrl, clientOptions);
|
3314
|
+
this._sessionDetails = connectResponse.data;
|
3315
|
+
console.log(`Cloud Interop successfully connected to ${this.connectParams.url}`);
|
3316
|
+
this._mqttClient.on('error', (error) => {
|
3317
|
+
console.error(`Cloud Interop Error: ${error}`);
|
3318
|
+
});
|
3319
|
+
this._mqttClient.stream.on('error', (error) => {
|
3320
|
+
console.error(`Cloud Interop Connection Error: ${error}`);
|
3321
|
+
});
|
3322
|
+
this._mqttClient.on('reconnect', () => {
|
3323
|
+
console.warn(`Cloud Interop attempting reconnection...`);
|
3324
|
+
// Default reconnectPeriod = 30 seconds
|
3325
|
+
// Attempt reconnection 30 times before ending session
|
3326
|
+
this.reconnectRetries += 1;
|
3327
|
+
if (this.reconnectRetries === this.reconnectRetryLimit) {
|
3328
|
+
console.warn(`Cloud Interop reached max reconnection attempts...`);
|
3329
|
+
this._mqttClient?.end();
|
3330
|
+
this.disconnect();
|
3331
|
+
}
|
3332
|
+
});
|
3333
|
+
// Does not fire on initial connection, only successful reconnection attempts
|
3334
|
+
this._mqttClient.on('connect', () => {
|
3335
|
+
console.log(`Cloud Interop successfully reconnected`);
|
3336
|
+
this.reconnectRetries = 0;
|
3337
|
+
});
|
3338
|
+
this._mqttClient.on('message', (topic, message) => {
|
3339
|
+
this.handleCommand(topic, message, this._sessionDetails);
|
3340
|
+
});
|
3341
|
+
// Subscribe to all context groups
|
3342
|
+
this._mqttClient.subscribe(`${sessionRootTopic}/context-groups/#`);
|
3343
|
+
// Listen out for global commands
|
3344
|
+
this._mqttClient.subscribe(`${sessionRootTopic}/commands`);
|
3345
|
+
}
|
3346
|
+
catch (error) {
|
3347
|
+
console.warn(`Failed to connect to Cloud Interop at ${this.connectParams.url}`, error);
|
3348
|
+
return;
|
3349
|
+
}
|
3350
|
+
}
|
3351
|
+
async disconnect() {
|
3352
|
+
if (!this._sessionDetails) {
|
3353
|
+
return;
|
3354
|
+
}
|
3355
|
+
try {
|
3356
|
+
const disconnectResponse = await axios.delete(`${this.connectParams.url}/sessions/${this._sessionDetails.sessionId}`);
|
3357
|
+
if (disconnectResponse.status !== 200) {
|
3358
|
+
console.warn(`Cloud Interop disconnection failed`, disconnectResponse);
|
3359
|
+
}
|
3360
|
+
}
|
3361
|
+
catch (error) {
|
3362
|
+
console.warn(`Cloud Interop error during disconnection`, error);
|
3363
|
+
}
|
3364
|
+
finally {
|
3365
|
+
this._sessionDetails = undefined;
|
3366
|
+
this._mqttClient = undefined;
|
3367
|
+
this.reconnectRetries = 0;
|
3368
|
+
}
|
3369
|
+
}
|
3370
|
+
async setContext(contextGroup, context) {
|
3371
|
+
if (!this._sessionDetails) {
|
3372
|
+
return;
|
3373
|
+
}
|
3374
|
+
const { userId, sourceId } = this.connectParams;
|
3375
|
+
const payload = {
|
3376
|
+
userId,
|
3377
|
+
sourceId,
|
3378
|
+
context
|
3379
|
+
};
|
3380
|
+
await axios.post(`${this.connectParams.url}/context-groups/${this._sessionDetails.sessionId}/${contextGroup}`, payload);
|
3381
|
+
}
|
3382
|
+
addContextListener(callback) {
|
3383
|
+
this.contextListener = callback;
|
3384
|
+
}
|
3385
|
+
startIntentDiscovery(intentName, context) {
|
3386
|
+
throw new Error('Method not implemented.');
|
3387
|
+
}
|
3388
|
+
endIntentDiscovery(discoveryId) {
|
3389
|
+
throw new Error('Method not implemented.');
|
3390
|
+
}
|
3391
|
+
sendIntentDetail(discoveryId, intentDetail) {
|
3392
|
+
throw new Error('Method not implemented.');
|
3393
|
+
}
|
3394
|
+
raiseIntent(targetSession, intentInstanceId, context) {
|
3395
|
+
throw new Error('Method not implemented.');
|
3396
|
+
}
|
3397
|
+
addIntentDetailListener(callback) {
|
3398
|
+
throw new Error('Method not implemented.');
|
3399
|
+
}
|
3400
|
+
handleCommand(topic, message, sessionDetails) {
|
3401
|
+
if (message.length === 0 || !sessionDetails) {
|
3402
|
+
// Ignore clean up messages
|
3403
|
+
return;
|
3404
|
+
}
|
3405
|
+
const messageEnvelope = JSON.parse(message.toString());
|
3406
|
+
if (topic.startsWith(`${sessionDetails.sessionRootTopic}/context-groups/`)) {
|
3407
|
+
if (messageEnvelope.source.sessionId === sessionDetails.sessionId) {
|
3408
|
+
return;
|
3409
|
+
}
|
3410
|
+
if (this.contextListener) {
|
3411
|
+
const { channelName: contextGroup, payload: context, source } = messageEnvelope;
|
3412
|
+
this.contextListener(contextGroup, context, source);
|
3413
|
+
}
|
3414
|
+
}
|
3415
|
+
}
|
3416
|
+
}
|
3417
|
+
|
3418
|
+
async function cloudInteropOverride(config) {
|
3419
|
+
const client = new CloudInteropAPI(config);
|
3420
|
+
await client.connect(config);
|
3421
|
+
return (Base) => {
|
3422
|
+
return class CloudInteropOverride extends Base {
|
3423
|
+
constructor() {
|
3424
|
+
super();
|
3425
|
+
client.addContextListener((contextGroup, context, source) => {
|
3426
|
+
if (this.getContextGroups().map(({ id }) => id).includes(contextGroup) && client.sessionDetails?.sessionId !== source.sessionId) {
|
3427
|
+
super.setContextForGroup({ context: context }, contextGroup);
|
3428
|
+
}
|
3429
|
+
});
|
3430
|
+
}
|
3431
|
+
async setContextForGroup({ context }, contextGroupId) {
|
3432
|
+
client.setContext(contextGroupId, context);
|
3433
|
+
super.setContextForGroup({ context }, contextGroupId);
|
3434
|
+
}
|
3435
|
+
async cloudReconnect() {
|
3436
|
+
await client.connect(config);
|
3437
|
+
}
|
3438
|
+
get cloudConnectionState() {
|
3439
|
+
if (client.mqttClient?.connected) {
|
3440
|
+
return 'connected';
|
3441
|
+
}
|
3442
|
+
if (client.mqttClient?.reconnecting) {
|
3443
|
+
return 'reconnecting';
|
3444
|
+
}
|
3445
|
+
return 'disconnected';
|
3446
|
+
}
|
3447
|
+
};
|
3448
|
+
};
|
3449
|
+
}
|
3450
|
+
|
3451
|
+
export { cloudInteropOverride };
|