@openc3/js-common 5.21.0-beta0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/services.js DELETED
@@ -1,2747 +0,0 @@
1
- var pt = Object.defineProperty;
2
- var mt = (t, e, n) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var P = (t, e, n) => mt(t, typeof e != "symbol" ? e + "" : e, n);
4
- function $e(t, e) {
5
- return function() {
6
- return t.apply(e, arguments);
7
- };
8
- }
9
- const { toString: gt } = Object.prototype, { getPrototypeOf: be } = Object, Z = /* @__PURE__ */ ((t) => (e) => {
10
- const n = gt.call(e);
11
- return t[n] || (t[n] = n.slice(8, -1).toLowerCase());
12
- })(/* @__PURE__ */ Object.create(null)), C = (t) => (t = t.toLowerCase(), (e) => Z(e) === t), ee = (t) => (e) => typeof e === t, { isArray: U } = Array, H = ee("undefined");
13
- function _t(t) {
14
- return t !== null && !H(t) && t.constructor !== null && !H(t.constructor) && O(t.constructor.isBuffer) && t.constructor.isBuffer(t);
15
- }
16
- const ze = C("ArrayBuffer");
17
- function bt(t) {
18
- let e;
19
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && ze(t.buffer), e;
20
- }
21
- const yt = ee("string"), O = ee("function"), We = ee("number"), te = (t) => t !== null && typeof t == "object", wt = (t) => t === !0 || t === !1, G = (t) => {
22
- if (Z(t) !== "object")
23
- return !1;
24
- const e = be(t);
25
- return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t);
26
- }, St = C("Date"), Et = C("File"), At = C("Blob"), Rt = C("FileList"), xt = (t) => te(t) && O(t.pipe), Tt = (t) => {
27
- let e;
28
- return t && (typeof FormData == "function" && t instanceof FormData || O(t.append) && ((e = Z(t)) === "formdata" || // detect form-data instance
29
- e === "object" && O(t.toString) && t.toString() === "[object FormData]"));
30
- }, Ot = C("URLSearchParams"), [Ct, kt, Nt, Pt] = ["ReadableStream", "Request", "Response", "Headers"].map(C), Dt = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
31
- function $(t, e, { allOwnKeys: n = !1 } = {}) {
32
- if (t === null || typeof t > "u")
33
- return;
34
- let r, s;
35
- if (typeof t != "object" && (t = [t]), U(t))
36
- for (r = 0, s = t.length; r < s; r++)
37
- e.call(null, t[r], r, t);
38
- else {
39
- const i = n ? Object.getOwnPropertyNames(t) : Object.keys(t), o = i.length;
40
- let c;
41
- for (r = 0; r < o; r++)
42
- c = i[r], e.call(null, t[c], c, t);
43
- }
44
- }
45
- function Ve(t, e) {
46
- e = e.toLowerCase();
47
- const n = Object.keys(t);
48
- let r = n.length, s;
49
- for (; r-- > 0; )
50
- if (s = n[r], e === s.toLowerCase())
51
- return s;
52
- return null;
53
- }
54
- const L = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Je = (t) => !H(t) && t !== L;
55
- function le() {
56
- const { caseless: t } = Je(this) && this || {}, e = {}, n = (r, s) => {
57
- const i = t && Ve(e, s) || s;
58
- G(e[i]) && G(r) ? e[i] = le(e[i], r) : G(r) ? e[i] = le({}, r) : U(r) ? e[i] = r.slice() : e[i] = r;
59
- };
60
- for (let r = 0, s = arguments.length; r < s; r++)
61
- arguments[r] && $(arguments[r], n);
62
- return e;
63
- }
64
- const Ft = (t, e, n, { allOwnKeys: r } = {}) => ($(e, (s, i) => {
65
- n && O(s) ? t[i] = $e(s, n) : t[i] = s;
66
- }, { allOwnKeys: r }), t), Lt = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), jt = (t, e, n, r) => {
67
- t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", {
68
- value: e.prototype
69
- }), n && Object.assign(t.prototype, n);
70
- }, Bt = (t, e, n, r) => {
71
- let s, i, o;
72
- const c = {};
73
- if (e = e || {}, t == null) return e;
74
- do {
75
- for (s = Object.getOwnPropertyNames(t), i = s.length; i-- > 0; )
76
- o = s[i], (!r || r(o, t, e)) && !c[o] && (e[o] = t[o], c[o] = !0);
77
- t = n !== !1 && be(t);
78
- } while (t && (!n || n(t, e)) && t !== Object.prototype);
79
- return e;
80
- }, Ut = (t, e, n) => {
81
- t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length;
82
- const r = t.indexOf(e, n);
83
- return r !== -1 && r === n;
84
- }, vt = (t) => {
85
- if (!t) return null;
86
- if (U(t)) return t;
87
- let e = t.length;
88
- if (!We(e)) return null;
89
- const n = new Array(e);
90
- for (; e-- > 0; )
91
- n[e] = t[e];
92
- return n;
93
- }, It = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && be(Uint8Array)), qt = (t, e) => {
94
- const r = (t && t[Symbol.iterator]).call(t);
95
- let s;
96
- for (; (s = r.next()) && !s.done; ) {
97
- const i = s.value;
98
- e.call(t, i[0], i[1]);
99
- }
100
- }, Mt = (t, e) => {
101
- let n;
102
- const r = [];
103
- for (; (n = t.exec(e)) !== null; )
104
- r.push(n);
105
- return r;
106
- }, Ht = C("HTMLFormElement"), $t = (t) => t.toLowerCase().replace(
107
- /[-_\s]([a-z\d])(\w*)/g,
108
- function(n, r, s) {
109
- return r.toUpperCase() + s;
110
- }
111
- ), Te = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), zt = C("RegExp"), Ge = (t, e) => {
112
- const n = Object.getOwnPropertyDescriptors(t), r = {};
113
- $(n, (s, i) => {
114
- let o;
115
- (o = e(s, i, t)) !== !1 && (r[i] = o || s);
116
- }), Object.defineProperties(t, r);
117
- }, Wt = (t) => {
118
- Ge(t, (e, n) => {
119
- if (O(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
120
- return !1;
121
- const r = t[n];
122
- if (O(r)) {
123
- if (e.enumerable = !1, "writable" in e) {
124
- e.writable = !1;
125
- return;
126
- }
127
- e.set || (e.set = () => {
128
- throw Error("Can not rewrite read-only method '" + n + "'");
129
- });
130
- }
131
- });
132
- }, Vt = (t, e) => {
133
- const n = {}, r = (s) => {
134
- s.forEach((i) => {
135
- n[i] = !0;
136
- });
137
- };
138
- return U(t) ? r(t) : r(String(t).split(e)), n;
139
- }, Jt = () => {
140
- }, Gt = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, ie = "abcdefghijklmnopqrstuvwxyz", Oe = "0123456789", Ke = {
141
- DIGIT: Oe,
142
- ALPHA: ie,
143
- ALPHA_DIGIT: ie + ie.toUpperCase() + Oe
144
- }, Kt = (t = 16, e = Ke.ALPHA_DIGIT) => {
145
- let n = "";
146
- const { length: r } = e;
147
- for (; t--; )
148
- n += e[Math.random() * r | 0];
149
- return n;
150
- };
151
- function Xt(t) {
152
- return !!(t && O(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]);
153
- }
154
- const Qt = (t) => {
155
- const e = new Array(10), n = (r, s) => {
156
- if (te(r)) {
157
- if (e.indexOf(r) >= 0)
158
- return;
159
- if (!("toJSON" in r)) {
160
- e[s] = r;
161
- const i = U(r) ? [] : {};
162
- return $(r, (o, c) => {
163
- const f = n(o, s + 1);
164
- !H(f) && (i[c] = f);
165
- }), e[s] = void 0, i;
166
- }
167
- }
168
- return r;
169
- };
170
- return n(t, 0);
171
- }, Yt = C("AsyncFunction"), Zt = (t) => t && (te(t) || O(t)) && O(t.then) && O(t.catch), Xe = ((t, e) => t ? setImmediate : e ? ((n, r) => (L.addEventListener("message", ({ source: s, data: i }) => {
172
- s === L && i === n && r.length && r.shift()();
173
- }, !1), (s) => {
174
- r.push(s), L.postMessage(n, "*");
175
- }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
176
- typeof setImmediate == "function",
177
- O(L.postMessage)
178
- ), en = typeof queueMicrotask < "u" ? queueMicrotask.bind(L) : typeof process < "u" && process.nextTick || Xe, a = {
179
- isArray: U,
180
- isArrayBuffer: ze,
181
- isBuffer: _t,
182
- isFormData: Tt,
183
- isArrayBufferView: bt,
184
- isString: yt,
185
- isNumber: We,
186
- isBoolean: wt,
187
- isObject: te,
188
- isPlainObject: G,
189
- isReadableStream: Ct,
190
- isRequest: kt,
191
- isResponse: Nt,
192
- isHeaders: Pt,
193
- isUndefined: H,
194
- isDate: St,
195
- isFile: Et,
196
- isBlob: At,
197
- isRegExp: zt,
198
- isFunction: O,
199
- isStream: xt,
200
- isURLSearchParams: Ot,
201
- isTypedArray: It,
202
- isFileList: Rt,
203
- forEach: $,
204
- merge: le,
205
- extend: Ft,
206
- trim: Dt,
207
- stripBOM: Lt,
208
- inherits: jt,
209
- toFlatObject: Bt,
210
- kindOf: Z,
211
- kindOfTest: C,
212
- endsWith: Ut,
213
- toArray: vt,
214
- forEachEntry: qt,
215
- matchAll: Mt,
216
- isHTMLForm: Ht,
217
- hasOwnProperty: Te,
218
- hasOwnProp: Te,
219
- // an alias to avoid ESLint no-prototype-builtins detection
220
- reduceDescriptors: Ge,
221
- freezeMethods: Wt,
222
- toObjectSet: Vt,
223
- toCamelCase: $t,
224
- noop: Jt,
225
- toFiniteNumber: Gt,
226
- findKey: Ve,
227
- global: L,
228
- isContextDefined: Je,
229
- ALPHABET: Ke,
230
- generateString: Kt,
231
- isSpecCompliantForm: Xt,
232
- toJSONObject: Qt,
233
- isAsyncFn: Yt,
234
- isThenable: Zt,
235
- setImmediate: Xe,
236
- asap: en
237
- };
238
- function g(t, e, n, r, s) {
239
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
240
- }
241
- a.inherits(g, Error, {
242
- toJSON: function() {
243
- return {
244
- // Standard
245
- message: this.message,
246
- name: this.name,
247
- // Microsoft
248
- description: this.description,
249
- number: this.number,
250
- // Mozilla
251
- fileName: this.fileName,
252
- lineNumber: this.lineNumber,
253
- columnNumber: this.columnNumber,
254
- stack: this.stack,
255
- // Axios
256
- config: a.toJSONObject(this.config),
257
- code: this.code,
258
- status: this.status
259
- };
260
- }
261
- });
262
- const Qe = g.prototype, Ye = {};
263
- [
264
- "ERR_BAD_OPTION_VALUE",
265
- "ERR_BAD_OPTION",
266
- "ECONNABORTED",
267
- "ETIMEDOUT",
268
- "ERR_NETWORK",
269
- "ERR_FR_TOO_MANY_REDIRECTS",
270
- "ERR_DEPRECATED",
271
- "ERR_BAD_RESPONSE",
272
- "ERR_BAD_REQUEST",
273
- "ERR_CANCELED",
274
- "ERR_NOT_SUPPORT",
275
- "ERR_INVALID_URL"
276
- // eslint-disable-next-line func-names
277
- ].forEach((t) => {
278
- Ye[t] = { value: t };
279
- });
280
- Object.defineProperties(g, Ye);
281
- Object.defineProperty(Qe, "isAxiosError", { value: !0 });
282
- g.from = (t, e, n, r, s, i) => {
283
- const o = Object.create(Qe);
284
- return a.toFlatObject(t, o, function(f) {
285
- return f !== Error.prototype;
286
- }, (c) => c !== "isAxiosError"), g.call(o, t.message, e, n, r, s), o.cause = t, o.name = t.name, i && Object.assign(o, i), o;
287
- };
288
- const tn = null;
289
- function ue(t) {
290
- return a.isPlainObject(t) || a.isArray(t);
291
- }
292
- function Ze(t) {
293
- return a.endsWith(t, "[]") ? t.slice(0, -2) : t;
294
- }
295
- function Ce(t, e, n) {
296
- return t ? t.concat(e).map(function(s, i) {
297
- return s = Ze(s), !n && i ? "[" + s + "]" : s;
298
- }).join(n ? "." : "") : e;
299
- }
300
- function nn(t) {
301
- return a.isArray(t) && !t.some(ue);
302
- }
303
- const rn = a.toFlatObject(a, {}, null, function(e) {
304
- return /^is[A-Z]/.test(e);
305
- });
306
- function ne(t, e, n) {
307
- if (!a.isObject(t))
308
- throw new TypeError("target must be an object");
309
- e = e || new FormData(), n = a.toFlatObject(n, {
310
- metaTokens: !0,
311
- dots: !1,
312
- indexes: !1
313
- }, !1, function(m, p) {
314
- return !a.isUndefined(p[m]);
315
- });
316
- const r = n.metaTokens, s = n.visitor || l, i = n.dots, o = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(e);
317
- if (!a.isFunction(s))
318
- throw new TypeError("visitor must be a function");
319
- function u(d) {
320
- if (d === null) return "";
321
- if (a.isDate(d))
322
- return d.toISOString();
323
- if (!f && a.isBlob(d))
324
- throw new g("Blob is not supported. Use a Buffer instead.");
325
- return a.isArrayBuffer(d) || a.isTypedArray(d) ? f && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
326
- }
327
- function l(d, m, p) {
328
- let b = d;
329
- if (d && !p && typeof d == "object") {
330
- if (a.endsWith(m, "{}"))
331
- m = r ? m : m.slice(0, -2), d = JSON.stringify(d);
332
- else if (a.isArray(d) && nn(d) || (a.isFileList(d) || a.endsWith(m, "[]")) && (b = a.toArray(d)))
333
- return m = Ze(m), b.forEach(function(A, k) {
334
- !(a.isUndefined(A) || A === null) && e.append(
335
- // eslint-disable-next-line no-nested-ternary
336
- o === !0 ? Ce([m], k, i) : o === null ? m : m + "[]",
337
- u(A)
338
- );
339
- }), !1;
340
- }
341
- return ue(d) ? !0 : (e.append(Ce(p, m, i), u(d)), !1);
342
- }
343
- const h = [], _ = Object.assign(rn, {
344
- defaultVisitor: l,
345
- convertValue: u,
346
- isVisitable: ue
347
- });
348
- function y(d, m) {
349
- if (!a.isUndefined(d)) {
350
- if (h.indexOf(d) !== -1)
351
- throw Error("Circular reference detected in " + m.join("."));
352
- h.push(d), a.forEach(d, function(b, w) {
353
- (!(a.isUndefined(b) || b === null) && s.call(
354
- e,
355
- b,
356
- a.isString(w) ? w.trim() : w,
357
- m,
358
- _
359
- )) === !0 && y(b, m ? m.concat(w) : [w]);
360
- }), h.pop();
361
- }
362
- }
363
- if (!a.isObject(t))
364
- throw new TypeError("data must be an object");
365
- return y(t), e;
366
- }
367
- function ke(t) {
368
- const e = {
369
- "!": "%21",
370
- "'": "%27",
371
- "(": "%28",
372
- ")": "%29",
373
- "~": "%7E",
374
- "%20": "+",
375
- "%00": "\0"
376
- };
377
- return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) {
378
- return e[r];
379
- });
380
- }
381
- function ye(t, e) {
382
- this._pairs = [], t && ne(t, this, e);
383
- }
384
- const et = ye.prototype;
385
- et.append = function(e, n) {
386
- this._pairs.push([e, n]);
387
- };
388
- et.toString = function(e) {
389
- const n = e ? function(r) {
390
- return e.call(this, r, ke);
391
- } : ke;
392
- return this._pairs.map(function(s) {
393
- return n(s[0]) + "=" + n(s[1]);
394
- }, "").join("&");
395
- };
396
- function sn(t) {
397
- return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
398
- }
399
- function tt(t, e, n) {
400
- if (!e)
401
- return t;
402
- const r = n && n.encode || sn, s = n && n.serialize;
403
- let i;
404
- if (s ? i = s(e, n) : i = a.isURLSearchParams(e) ? e.toString() : new ye(e, n).toString(r), i) {
405
- const o = t.indexOf("#");
406
- o !== -1 && (t = t.slice(0, o)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
407
- }
408
- return t;
409
- }
410
- class Ne {
411
- constructor() {
412
- this.handlers = [];
413
- }
414
- /**
415
- * Add a new interceptor to the stack
416
- *
417
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
418
- * @param {Function} rejected The function to handle `reject` for a `Promise`
419
- *
420
- * @return {Number} An ID used to remove interceptor later
421
- */
422
- use(e, n, r) {
423
- return this.handlers.push({
424
- fulfilled: e,
425
- rejected: n,
426
- synchronous: r ? r.synchronous : !1,
427
- runWhen: r ? r.runWhen : null
428
- }), this.handlers.length - 1;
429
- }
430
- /**
431
- * Remove an interceptor from the stack
432
- *
433
- * @param {Number} id The ID that was returned by `use`
434
- *
435
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
436
- */
437
- eject(e) {
438
- this.handlers[e] && (this.handlers[e] = null);
439
- }
440
- /**
441
- * Clear all interceptors from the stack
442
- *
443
- * @returns {void}
444
- */
445
- clear() {
446
- this.handlers && (this.handlers = []);
447
- }
448
- /**
449
- * Iterate over all the registered interceptors
450
- *
451
- * This method is particularly useful for skipping over any
452
- * interceptors that may have become `null` calling `eject`.
453
- *
454
- * @param {Function} fn The function to call for each interceptor
455
- *
456
- * @returns {void}
457
- */
458
- forEach(e) {
459
- a.forEach(this.handlers, function(r) {
460
- r !== null && e(r);
461
- });
462
- }
463
- }
464
- const nt = {
465
- silentJSONParsing: !0,
466
- forcedJSONParsing: !0,
467
- clarifyTimeoutError: !1
468
- }, on = typeof URLSearchParams < "u" ? URLSearchParams : ye, cn = typeof FormData < "u" ? FormData : null, an = typeof Blob < "u" ? Blob : null, ln = {
469
- isBrowser: !0,
470
- classes: {
471
- URLSearchParams: on,
472
- FormData: cn,
473
- Blob: an
474
- },
475
- protocols: ["http", "https", "file", "blob", "url", "data"]
476
- }, we = typeof window < "u" && typeof document < "u", fe = typeof navigator == "object" && navigator || void 0, un = we && (!fe || ["ReactNative", "NativeScript", "NS"].indexOf(fe.product) < 0), fn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
477
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", dn = we && window.location.href || "http://localhost", hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
478
- __proto__: null,
479
- hasBrowserEnv: we,
480
- hasStandardBrowserEnv: un,
481
- hasStandardBrowserWebWorkerEnv: fn,
482
- navigator: fe,
483
- origin: dn
484
- }, Symbol.toStringTag, { value: "Module" })), x = {
485
- ...hn,
486
- ...ln
487
- };
488
- function pn(t, e) {
489
- return ne(t, new x.classes.URLSearchParams(), Object.assign({
490
- visitor: function(n, r, s, i) {
491
- return x.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
492
- }
493
- }, e));
494
- }
495
- function mn(t) {
496
- return a.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
497
- }
498
- function gn(t) {
499
- const e = {}, n = Object.keys(t);
500
- let r;
501
- const s = n.length;
502
- let i;
503
- for (r = 0; r < s; r++)
504
- i = n[r], e[i] = t[i];
505
- return e;
506
- }
507
- function rt(t) {
508
- function e(n, r, s, i) {
509
- let o = n[i++];
510
- if (o === "__proto__") return !0;
511
- const c = Number.isFinite(+o), f = i >= n.length;
512
- return o = !o && a.isArray(s) ? s.length : o, f ? (a.hasOwnProp(s, o) ? s[o] = [s[o], r] : s[o] = r, !c) : ((!s[o] || !a.isObject(s[o])) && (s[o] = []), e(n, r, s[o], i) && a.isArray(s[o]) && (s[o] = gn(s[o])), !c);
513
- }
514
- if (a.isFormData(t) && a.isFunction(t.entries)) {
515
- const n = {};
516
- return a.forEachEntry(t, (r, s) => {
517
- e(mn(r), s, n, 0);
518
- }), n;
519
- }
520
- return null;
521
- }
522
- function _n(t, e, n) {
523
- if (a.isString(t))
524
- try {
525
- return (e || JSON.parse)(t), a.trim(t);
526
- } catch (r) {
527
- if (r.name !== "SyntaxError")
528
- throw r;
529
- }
530
- return (0, JSON.stringify)(t);
531
- }
532
- const z = {
533
- transitional: nt,
534
- adapter: ["xhr", "http", "fetch"],
535
- transformRequest: [function(e, n) {
536
- const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, i = a.isObject(e);
537
- if (i && a.isHTMLForm(e) && (e = new FormData(e)), a.isFormData(e))
538
- return s ? JSON.stringify(rt(e)) : e;
539
- if (a.isArrayBuffer(e) || a.isBuffer(e) || a.isStream(e) || a.isFile(e) || a.isBlob(e) || a.isReadableStream(e))
540
- return e;
541
- if (a.isArrayBufferView(e))
542
- return e.buffer;
543
- if (a.isURLSearchParams(e))
544
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
545
- let c;
546
- if (i) {
547
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
548
- return pn(e, this.formSerializer).toString();
549
- if ((c = a.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
550
- const f = this.env && this.env.FormData;
551
- return ne(
552
- c ? { "files[]": e } : e,
553
- f && new f(),
554
- this.formSerializer
555
- );
556
- }
557
- }
558
- return i || s ? (n.setContentType("application/json", !1), _n(e)) : e;
559
- }],
560
- transformResponse: [function(e) {
561
- const n = this.transitional || z.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
562
- if (a.isResponse(e) || a.isReadableStream(e))
563
- return e;
564
- if (e && a.isString(e) && (r && !this.responseType || s)) {
565
- const o = !(n && n.silentJSONParsing) && s;
566
- try {
567
- return JSON.parse(e);
568
- } catch (c) {
569
- if (o)
570
- throw c.name === "SyntaxError" ? g.from(c, g.ERR_BAD_RESPONSE, this, null, this.response) : c;
571
- }
572
- }
573
- return e;
574
- }],
575
- /**
576
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
577
- * timeout is not created.
578
- */
579
- timeout: 0,
580
- xsrfCookieName: "XSRF-TOKEN",
581
- xsrfHeaderName: "X-XSRF-TOKEN",
582
- maxContentLength: -1,
583
- maxBodyLength: -1,
584
- env: {
585
- FormData: x.classes.FormData,
586
- Blob: x.classes.Blob
587
- },
588
- validateStatus: function(e) {
589
- return e >= 200 && e < 300;
590
- },
591
- headers: {
592
- common: {
593
- Accept: "application/json, text/plain, */*",
594
- "Content-Type": void 0
595
- }
596
- }
597
- };
598
- a.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
599
- z.headers[t] = {};
600
- });
601
- const bn = a.toObjectSet([
602
- "age",
603
- "authorization",
604
- "content-length",
605
- "content-type",
606
- "etag",
607
- "expires",
608
- "from",
609
- "host",
610
- "if-modified-since",
611
- "if-unmodified-since",
612
- "last-modified",
613
- "location",
614
- "max-forwards",
615
- "proxy-authorization",
616
- "referer",
617
- "retry-after",
618
- "user-agent"
619
- ]), yn = (t) => {
620
- const e = {};
621
- let n, r, s;
622
- return t && t.split(`
623
- `).forEach(function(o) {
624
- s = o.indexOf(":"), n = o.substring(0, s).trim().toLowerCase(), r = o.substring(s + 1).trim(), !(!n || e[n] && bn[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r);
625
- }), e;
626
- }, Pe = Symbol("internals");
627
- function I(t) {
628
- return t && String(t).trim().toLowerCase();
629
- }
630
- function K(t) {
631
- return t === !1 || t == null ? t : a.isArray(t) ? t.map(K) : String(t);
632
- }
633
- function wn(t) {
634
- const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
635
- let r;
636
- for (; r = n.exec(t); )
637
- e[r[1]] = r[2];
638
- return e;
639
- }
640
- const Sn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
641
- function oe(t, e, n, r, s) {
642
- if (a.isFunction(r))
643
- return r.call(this, e, n);
644
- if (s && (e = n), !!a.isString(e)) {
645
- if (a.isString(r))
646
- return e.indexOf(r) !== -1;
647
- if (a.isRegExp(r))
648
- return r.test(e);
649
- }
650
- }
651
- function En(t) {
652
- return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r);
653
- }
654
- function An(t, e) {
655
- const n = a.toCamelCase(" " + e);
656
- ["get", "set", "has"].forEach((r) => {
657
- Object.defineProperty(t, r + n, {
658
- value: function(s, i, o) {
659
- return this[r].call(this, e, s, i, o);
660
- },
661
- configurable: !0
662
- });
663
- });
664
- }
665
- class T {
666
- constructor(e) {
667
- e && this.set(e);
668
- }
669
- set(e, n, r) {
670
- const s = this;
671
- function i(c, f, u) {
672
- const l = I(f);
673
- if (!l)
674
- throw new Error("header name must be a non-empty string");
675
- const h = a.findKey(s, l);
676
- (!h || s[h] === void 0 || u === !0 || u === void 0 && s[h] !== !1) && (s[h || f] = K(c));
677
- }
678
- const o = (c, f) => a.forEach(c, (u, l) => i(u, l, f));
679
- if (a.isPlainObject(e) || e instanceof this.constructor)
680
- o(e, n);
681
- else if (a.isString(e) && (e = e.trim()) && !Sn(e))
682
- o(yn(e), n);
683
- else if (a.isHeaders(e))
684
- for (const [c, f] of e.entries())
685
- i(f, c, r);
686
- else
687
- e != null && i(n, e, r);
688
- return this;
689
- }
690
- get(e, n) {
691
- if (e = I(e), e) {
692
- const r = a.findKey(this, e);
693
- if (r) {
694
- const s = this[r];
695
- if (!n)
696
- return s;
697
- if (n === !0)
698
- return wn(s);
699
- if (a.isFunction(n))
700
- return n.call(this, s, r);
701
- if (a.isRegExp(n))
702
- return n.exec(s);
703
- throw new TypeError("parser must be boolean|regexp|function");
704
- }
705
- }
706
- }
707
- has(e, n) {
708
- if (e = I(e), e) {
709
- const r = a.findKey(this, e);
710
- return !!(r && this[r] !== void 0 && (!n || oe(this, this[r], r, n)));
711
- }
712
- return !1;
713
- }
714
- delete(e, n) {
715
- const r = this;
716
- let s = !1;
717
- function i(o) {
718
- if (o = I(o), o) {
719
- const c = a.findKey(r, o);
720
- c && (!n || oe(r, r[c], c, n)) && (delete r[c], s = !0);
721
- }
722
- }
723
- return a.isArray(e) ? e.forEach(i) : i(e), s;
724
- }
725
- clear(e) {
726
- const n = Object.keys(this);
727
- let r = n.length, s = !1;
728
- for (; r--; ) {
729
- const i = n[r];
730
- (!e || oe(this, this[i], i, e, !0)) && (delete this[i], s = !0);
731
- }
732
- return s;
733
- }
734
- normalize(e) {
735
- const n = this, r = {};
736
- return a.forEach(this, (s, i) => {
737
- const o = a.findKey(r, i);
738
- if (o) {
739
- n[o] = K(s), delete n[i];
740
- return;
741
- }
742
- const c = e ? En(i) : String(i).trim();
743
- c !== i && delete n[i], n[c] = K(s), r[c] = !0;
744
- }), this;
745
- }
746
- concat(...e) {
747
- return this.constructor.concat(this, ...e);
748
- }
749
- toJSON(e) {
750
- const n = /* @__PURE__ */ Object.create(null);
751
- return a.forEach(this, (r, s) => {
752
- r != null && r !== !1 && (n[s] = e && a.isArray(r) ? r.join(", ") : r);
753
- }), n;
754
- }
755
- [Symbol.iterator]() {
756
- return Object.entries(this.toJSON())[Symbol.iterator]();
757
- }
758
- toString() {
759
- return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(`
760
- `);
761
- }
762
- get [Symbol.toStringTag]() {
763
- return "AxiosHeaders";
764
- }
765
- static from(e) {
766
- return e instanceof this ? e : new this(e);
767
- }
768
- static concat(e, ...n) {
769
- const r = new this(e);
770
- return n.forEach((s) => r.set(s)), r;
771
- }
772
- static accessor(e) {
773
- const r = (this[Pe] = this[Pe] = {
774
- accessors: {}
775
- }).accessors, s = this.prototype;
776
- function i(o) {
777
- const c = I(o);
778
- r[c] || (An(s, o), r[c] = !0);
779
- }
780
- return a.isArray(e) ? e.forEach(i) : i(e), this;
781
- }
782
- }
783
- T.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
784
- a.reduceDescriptors(T.prototype, ({ value: t }, e) => {
785
- let n = e[0].toUpperCase() + e.slice(1);
786
- return {
787
- get: () => t,
788
- set(r) {
789
- this[n] = r;
790
- }
791
- };
792
- });
793
- a.freezeMethods(T);
794
- function ce(t, e) {
795
- const n = this || z, r = e || n, s = T.from(r.headers);
796
- let i = r.data;
797
- return a.forEach(t, function(c) {
798
- i = c.call(n, i, s.normalize(), e ? e.status : void 0);
799
- }), s.normalize(), i;
800
- }
801
- function st(t) {
802
- return !!(t && t.__CANCEL__);
803
- }
804
- function v(t, e, n) {
805
- g.call(this, t ?? "canceled", g.ERR_CANCELED, e, n), this.name = "CanceledError";
806
- }
807
- a.inherits(v, g, {
808
- __CANCEL__: !0
809
- });
810
- function it(t, e, n) {
811
- const r = n.config.validateStatus;
812
- !n.status || !r || r(n.status) ? t(n) : e(new g(
813
- "Request failed with status code " + n.status,
814
- [g.ERR_BAD_REQUEST, g.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
815
- n.config,
816
- n.request,
817
- n
818
- ));
819
- }
820
- function Rn(t) {
821
- const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
822
- return e && e[1] || "";
823
- }
824
- function xn(t, e) {
825
- t = t || 10;
826
- const n = new Array(t), r = new Array(t);
827
- let s = 0, i = 0, o;
828
- return e = e !== void 0 ? e : 1e3, function(f) {
829
- const u = Date.now(), l = r[i];
830
- o || (o = u), n[s] = f, r[s] = u;
831
- let h = i, _ = 0;
832
- for (; h !== s; )
833
- _ += n[h++], h = h % t;
834
- if (s = (s + 1) % t, s === i && (i = (i + 1) % t), u - o < e)
835
- return;
836
- const y = l && u - l;
837
- return y ? Math.round(_ * 1e3 / y) : void 0;
838
- };
839
- }
840
- function Tn(t, e) {
841
- let n = 0, r = 1e3 / e, s, i;
842
- const o = (u, l = Date.now()) => {
843
- n = l, s = null, i && (clearTimeout(i), i = null), t.apply(null, u);
844
- };
845
- return [(...u) => {
846
- const l = Date.now(), h = l - n;
847
- h >= r ? o(u, l) : (s = u, i || (i = setTimeout(() => {
848
- i = null, o(s);
849
- }, r - h)));
850
- }, () => s && o(s)];
851
- }
852
- const Q = (t, e, n = 3) => {
853
- let r = 0;
854
- const s = xn(50, 250);
855
- return Tn((i) => {
856
- const o = i.loaded, c = i.lengthComputable ? i.total : void 0, f = o - r, u = s(f), l = o <= c;
857
- r = o;
858
- const h = {
859
- loaded: o,
860
- total: c,
861
- progress: c ? o / c : void 0,
862
- bytes: f,
863
- rate: u || void 0,
864
- estimated: u && c && l ? (c - o) / u : void 0,
865
- event: i,
866
- lengthComputable: c != null,
867
- [e ? "download" : "upload"]: !0
868
- };
869
- t(h);
870
- }, n);
871
- }, De = (t, e) => {
872
- const n = t != null;
873
- return [(r) => e[0]({
874
- lengthComputable: n,
875
- total: t,
876
- loaded: r
877
- }), e[1]];
878
- }, Fe = (t) => (...e) => a.asap(() => t(...e)), On = x.hasStandardBrowserEnv ? (
879
- // Standard browser envs have full support of the APIs needed to test
880
- // whether the request URL is of the same origin as current location.
881
- function() {
882
- const e = x.navigator && /(msie|trident)/i.test(x.navigator.userAgent), n = document.createElement("a");
883
- let r;
884
- function s(i) {
885
- let o = i;
886
- return e && (n.setAttribute("href", o), o = n.href), n.setAttribute("href", o), {
887
- href: n.href,
888
- protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
889
- host: n.host,
890
- search: n.search ? n.search.replace(/^\?/, "") : "",
891
- hash: n.hash ? n.hash.replace(/^#/, "") : "",
892
- hostname: n.hostname,
893
- port: n.port,
894
- pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
895
- };
896
- }
897
- return r = s(window.location.href), function(o) {
898
- const c = a.isString(o) ? s(o) : o;
899
- return c.protocol === r.protocol && c.host === r.host;
900
- };
901
- }()
902
- ) : (
903
- // Non standard browser envs (web workers, react-native) lack needed support.
904
- /* @__PURE__ */ function() {
905
- return function() {
906
- return !0;
907
- };
908
- }()
909
- ), Cn = x.hasStandardBrowserEnv ? (
910
- // Standard browser envs support document.cookie
911
- {
912
- write(t, e, n, r, s, i) {
913
- const o = [t + "=" + encodeURIComponent(e)];
914
- a.isNumber(n) && o.push("expires=" + new Date(n).toGMTString()), a.isString(r) && o.push("path=" + r), a.isString(s) && o.push("domain=" + s), i === !0 && o.push("secure"), document.cookie = o.join("; ");
915
- },
916
- read(t) {
917
- const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
918
- return e ? decodeURIComponent(e[3]) : null;
919
- },
920
- remove(t) {
921
- this.write(t, "", Date.now() - 864e5);
922
- }
923
- }
924
- ) : (
925
- // Non-standard browser env (web workers, react-native) lack needed support.
926
- {
927
- write() {
928
- },
929
- read() {
930
- return null;
931
- },
932
- remove() {
933
- }
934
- }
935
- );
936
- function kn(t) {
937
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
938
- }
939
- function Nn(t, e) {
940
- return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
941
- }
942
- function ot(t, e) {
943
- return t && !kn(e) ? Nn(t, e) : e;
944
- }
945
- const Le = (t) => t instanceof T ? { ...t } : t;
946
- function B(t, e) {
947
- e = e || {};
948
- const n = {};
949
- function r(u, l, h) {
950
- return a.isPlainObject(u) && a.isPlainObject(l) ? a.merge.call({ caseless: h }, u, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
951
- }
952
- function s(u, l, h) {
953
- if (a.isUndefined(l)) {
954
- if (!a.isUndefined(u))
955
- return r(void 0, u, h);
956
- } else return r(u, l, h);
957
- }
958
- function i(u, l) {
959
- if (!a.isUndefined(l))
960
- return r(void 0, l);
961
- }
962
- function o(u, l) {
963
- if (a.isUndefined(l)) {
964
- if (!a.isUndefined(u))
965
- return r(void 0, u);
966
- } else return r(void 0, l);
967
- }
968
- function c(u, l, h) {
969
- if (h in e)
970
- return r(u, l);
971
- if (h in t)
972
- return r(void 0, u);
973
- }
974
- const f = {
975
- url: i,
976
- method: i,
977
- data: i,
978
- baseURL: o,
979
- transformRequest: o,
980
- transformResponse: o,
981
- paramsSerializer: o,
982
- timeout: o,
983
- timeoutMessage: o,
984
- withCredentials: o,
985
- withXSRFToken: o,
986
- adapter: o,
987
- responseType: o,
988
- xsrfCookieName: o,
989
- xsrfHeaderName: o,
990
- onUploadProgress: o,
991
- onDownloadProgress: o,
992
- decompress: o,
993
- maxContentLength: o,
994
- maxBodyLength: o,
995
- beforeRedirect: o,
996
- transport: o,
997
- httpAgent: o,
998
- httpsAgent: o,
999
- cancelToken: o,
1000
- socketPath: o,
1001
- responseEncoding: o,
1002
- validateStatus: c,
1003
- headers: (u, l) => s(Le(u), Le(l), !0)
1004
- };
1005
- return a.forEach(Object.keys(Object.assign({}, t, e)), function(l) {
1006
- const h = f[l] || s, _ = h(t[l], e[l], l);
1007
- a.isUndefined(_) && h !== c || (n[l] = _);
1008
- }), n;
1009
- }
1010
- const ct = (t) => {
1011
- const e = B({}, t);
1012
- let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: i, headers: o, auth: c } = e;
1013
- e.headers = o = T.from(o), e.url = tt(ot(e.baseURL, e.url), t.params, t.paramsSerializer), c && o.set(
1014
- "Authorization",
1015
- "Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
1016
- );
1017
- let f;
1018
- if (a.isFormData(n)) {
1019
- if (x.hasStandardBrowserEnv || x.hasStandardBrowserWebWorkerEnv)
1020
- o.setContentType(void 0);
1021
- else if ((f = o.getContentType()) !== !1) {
1022
- const [u, ...l] = f ? f.split(";").map((h) => h.trim()).filter(Boolean) : [];
1023
- o.setContentType([u || "multipart/form-data", ...l].join("; "));
1024
- }
1025
- }
1026
- if (x.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(e)), r || r !== !1 && On(e.url))) {
1027
- const u = s && i && Cn.read(i);
1028
- u && o.set(s, u);
1029
- }
1030
- return e;
1031
- }, Pn = typeof XMLHttpRequest < "u", Dn = Pn && function(t) {
1032
- return new Promise(function(n, r) {
1033
- const s = ct(t);
1034
- let i = s.data;
1035
- const o = T.from(s.headers).normalize();
1036
- let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = s, l, h, _, y, d;
1037
- function m() {
1038
- y && y(), d && d(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1039
- }
1040
- let p = new XMLHttpRequest();
1041
- p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
1042
- function b() {
1043
- if (!p)
1044
- return;
1045
- const A = T.from(
1046
- "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1047
- ), R = {
1048
- data: !c || c === "text" || c === "json" ? p.responseText : p.response,
1049
- status: p.status,
1050
- statusText: p.statusText,
1051
- headers: A,
1052
- config: t,
1053
- request: p
1054
- };
1055
- it(function(F) {
1056
- n(F), m();
1057
- }, function(F) {
1058
- r(F), m();
1059
- }, R), p = null;
1060
- }
1061
- "onloadend" in p ? p.onloadend = b : p.onreadystatechange = function() {
1062
- !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(b);
1063
- }, p.onabort = function() {
1064
- p && (r(new g("Request aborted", g.ECONNABORTED, t, p)), p = null);
1065
- }, p.onerror = function() {
1066
- r(new g("Network Error", g.ERR_NETWORK, t, p)), p = null;
1067
- }, p.ontimeout = function() {
1068
- let k = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1069
- const R = s.transitional || nt;
1070
- s.timeoutErrorMessage && (k = s.timeoutErrorMessage), r(new g(
1071
- k,
1072
- R.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
1073
- t,
1074
- p
1075
- )), p = null;
1076
- }, i === void 0 && o.setContentType(null), "setRequestHeader" in p && a.forEach(o.toJSON(), function(k, R) {
1077
- p.setRequestHeader(R, k);
1078
- }), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), u && ([_, d] = Q(u, !0), p.addEventListener("progress", _)), f && p.upload && ([h, y] = Q(f), p.upload.addEventListener("progress", h), p.upload.addEventListener("loadend", y)), (s.cancelToken || s.signal) && (l = (A) => {
1079
- p && (r(!A || A.type ? new v(null, t, p) : A), p.abort(), p = null);
1080
- }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1081
- const w = Rn(s.url);
1082
- if (w && x.protocols.indexOf(w) === -1) {
1083
- r(new g("Unsupported protocol " + w + ":", g.ERR_BAD_REQUEST, t));
1084
- return;
1085
- }
1086
- p.send(i || null);
1087
- });
1088
- }, Fn = (t, e) => {
1089
- const { length: n } = t = t ? t.filter(Boolean) : [];
1090
- if (e || n) {
1091
- let r = new AbortController(), s;
1092
- const i = function(u) {
1093
- if (!s) {
1094
- s = !0, c();
1095
- const l = u instanceof Error ? u : this.reason;
1096
- r.abort(l instanceof g ? l : new v(l instanceof Error ? l.message : l));
1097
- }
1098
- };
1099
- let o = e && setTimeout(() => {
1100
- o = null, i(new g(`timeout ${e} of ms exceeded`, g.ETIMEDOUT));
1101
- }, e);
1102
- const c = () => {
1103
- t && (o && clearTimeout(o), o = null, t.forEach((u) => {
1104
- u.unsubscribe ? u.unsubscribe(i) : u.removeEventListener("abort", i);
1105
- }), t = null);
1106
- };
1107
- t.forEach((u) => u.addEventListener("abort", i));
1108
- const { signal: f } = r;
1109
- return f.unsubscribe = () => a.asap(c), f;
1110
- }
1111
- }, Ln = function* (t, e) {
1112
- let n = t.byteLength;
1113
- if (n < e) {
1114
- yield t;
1115
- return;
1116
- }
1117
- let r = 0, s;
1118
- for (; r < n; )
1119
- s = r + e, yield t.slice(r, s), r = s;
1120
- }, jn = async function* (t, e) {
1121
- for await (const n of Bn(t))
1122
- yield* Ln(n, e);
1123
- }, Bn = async function* (t) {
1124
- if (t[Symbol.asyncIterator]) {
1125
- yield* t;
1126
- return;
1127
- }
1128
- const e = t.getReader();
1129
- try {
1130
- for (; ; ) {
1131
- const { done: n, value: r } = await e.read();
1132
- if (n)
1133
- break;
1134
- yield r;
1135
- }
1136
- } finally {
1137
- await e.cancel();
1138
- }
1139
- }, je = (t, e, n, r) => {
1140
- const s = jn(t, e);
1141
- let i = 0, o, c = (f) => {
1142
- o || (o = !0, r && r(f));
1143
- };
1144
- return new ReadableStream({
1145
- async pull(f) {
1146
- try {
1147
- const { done: u, value: l } = await s.next();
1148
- if (u) {
1149
- c(), f.close();
1150
- return;
1151
- }
1152
- let h = l.byteLength;
1153
- if (n) {
1154
- let _ = i += h;
1155
- n(_);
1156
- }
1157
- f.enqueue(new Uint8Array(l));
1158
- } catch (u) {
1159
- throw c(u), u;
1160
- }
1161
- },
1162
- cancel(f) {
1163
- return c(f), s.return();
1164
- }
1165
- }, {
1166
- highWaterMark: 2
1167
- });
1168
- }, re = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", at = re && typeof ReadableStream == "function", Un = re && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), lt = (t, ...e) => {
1169
- try {
1170
- return !!t(...e);
1171
- } catch {
1172
- return !1;
1173
- }
1174
- }, vn = at && lt(() => {
1175
- let t = !1;
1176
- const e = new Request(x.origin, {
1177
- body: new ReadableStream(),
1178
- method: "POST",
1179
- get duplex() {
1180
- return t = !0, "half";
1181
- }
1182
- }).headers.has("Content-Type");
1183
- return t && !e;
1184
- }), Be = 64 * 1024, de = at && lt(() => a.isReadableStream(new Response("").body)), Y = {
1185
- stream: de && ((t) => t.body)
1186
- };
1187
- re && ((t) => {
1188
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
1189
- !Y[e] && (Y[e] = a.isFunction(t[e]) ? (n) => n[e]() : (n, r) => {
1190
- throw new g(`Response type '${e}' is not supported`, g.ERR_NOT_SUPPORT, r);
1191
- });
1192
- });
1193
- })(new Response());
1194
- const In = async (t) => {
1195
- if (t == null)
1196
- return 0;
1197
- if (a.isBlob(t))
1198
- return t.size;
1199
- if (a.isSpecCompliantForm(t))
1200
- return (await new Request(x.origin, {
1201
- method: "POST",
1202
- body: t
1203
- }).arrayBuffer()).byteLength;
1204
- if (a.isArrayBufferView(t) || a.isArrayBuffer(t))
1205
- return t.byteLength;
1206
- if (a.isURLSearchParams(t) && (t = t + ""), a.isString(t))
1207
- return (await Un(t)).byteLength;
1208
- }, qn = async (t, e) => {
1209
- const n = a.toFiniteNumber(t.getContentLength());
1210
- return n ?? In(e);
1211
- }, Mn = re && (async (t) => {
1212
- let {
1213
- url: e,
1214
- method: n,
1215
- data: r,
1216
- signal: s,
1217
- cancelToken: i,
1218
- timeout: o,
1219
- onDownloadProgress: c,
1220
- onUploadProgress: f,
1221
- responseType: u,
1222
- headers: l,
1223
- withCredentials: h = "same-origin",
1224
- fetchOptions: _
1225
- } = ct(t);
1226
- u = u ? (u + "").toLowerCase() : "text";
1227
- let y = Fn([s, i && i.toAbortSignal()], o), d;
1228
- const m = y && y.unsubscribe && (() => {
1229
- y.unsubscribe();
1230
- });
1231
- let p;
1232
- try {
1233
- if (f && vn && n !== "get" && n !== "head" && (p = await qn(l, r)) !== 0) {
1234
- let R = new Request(e, {
1235
- method: "POST",
1236
- body: r,
1237
- duplex: "half"
1238
- }), N;
1239
- if (a.isFormData(r) && (N = R.headers.get("content-type")) && l.setContentType(N), R.body) {
1240
- const [F, W] = De(
1241
- p,
1242
- Q(Fe(f))
1243
- );
1244
- r = je(R.body, Be, F, W);
1245
- }
1246
- }
1247
- a.isString(h) || (h = h ? "include" : "omit");
1248
- const b = "credentials" in Request.prototype;
1249
- d = new Request(e, {
1250
- ..._,
1251
- signal: y,
1252
- method: n.toUpperCase(),
1253
- headers: l.normalize().toJSON(),
1254
- body: r,
1255
- duplex: "half",
1256
- credentials: b ? h : void 0
1257
- });
1258
- let w = await fetch(d);
1259
- const A = de && (u === "stream" || u === "response");
1260
- if (de && (c || A && m)) {
1261
- const R = {};
1262
- ["status", "statusText", "headers"].forEach((xe) => {
1263
- R[xe] = w[xe];
1264
- });
1265
- const N = a.toFiniteNumber(w.headers.get("content-length")), [F, W] = c && De(
1266
- N,
1267
- Q(Fe(c), !0)
1268
- ) || [];
1269
- w = new Response(
1270
- je(w.body, Be, F, () => {
1271
- W && W(), m && m();
1272
- }),
1273
- R
1274
- );
1275
- }
1276
- u = u || "text";
1277
- let k = await Y[a.findKey(Y, u) || "text"](w, t);
1278
- return !A && m && m(), await new Promise((R, N) => {
1279
- it(R, N, {
1280
- data: k,
1281
- headers: T.from(w.headers),
1282
- status: w.status,
1283
- statusText: w.statusText,
1284
- config: t,
1285
- request: d
1286
- });
1287
- });
1288
- } catch (b) {
1289
- throw m && m(), b && b.name === "TypeError" && /fetch/i.test(b.message) ? Object.assign(
1290
- new g("Network Error", g.ERR_NETWORK, t, d),
1291
- {
1292
- cause: b.cause || b
1293
- }
1294
- ) : g.from(b, b && b.code, t, d);
1295
- }
1296
- }), he = {
1297
- http: tn,
1298
- xhr: Dn,
1299
- fetch: Mn
1300
- };
1301
- a.forEach(he, (t, e) => {
1302
- if (t) {
1303
- try {
1304
- Object.defineProperty(t, "name", { value: e });
1305
- } catch {
1306
- }
1307
- Object.defineProperty(t, "adapterName", { value: e });
1308
- }
1309
- });
1310
- const Ue = (t) => `- ${t}`, Hn = (t) => a.isFunction(t) || t === null || t === !1, ut = {
1311
- getAdapter: (t) => {
1312
- t = a.isArray(t) ? t : [t];
1313
- const { length: e } = t;
1314
- let n, r;
1315
- const s = {};
1316
- for (let i = 0; i < e; i++) {
1317
- n = t[i];
1318
- let o;
1319
- if (r = n, !Hn(n) && (r = he[(o = String(n)).toLowerCase()], r === void 0))
1320
- throw new g(`Unknown adapter '${o}'`);
1321
- if (r)
1322
- break;
1323
- s[o || "#" + i] = r;
1324
- }
1325
- if (!r) {
1326
- const i = Object.entries(s).map(
1327
- ([c, f]) => `adapter ${c} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
1328
- );
1329
- let o = e ? i.length > 1 ? `since :
1330
- ` + i.map(Ue).join(`
1331
- `) : " " + Ue(i[0]) : "as no adapter specified";
1332
- throw new g(
1333
- "There is no suitable adapter to dispatch the request " + o,
1334
- "ERR_NOT_SUPPORT"
1335
- );
1336
- }
1337
- return r;
1338
- },
1339
- adapters: he
1340
- };
1341
- function ae(t) {
1342
- if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1343
- throw new v(null, t);
1344
- }
1345
- function ve(t) {
1346
- return ae(t), t.headers = T.from(t.headers), t.data = ce.call(
1347
- t,
1348
- t.transformRequest
1349
- ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), ut.getAdapter(t.adapter || z.adapter)(t).then(function(r) {
1350
- return ae(t), r.data = ce.call(
1351
- t,
1352
- t.transformResponse,
1353
- r
1354
- ), r.headers = T.from(r.headers), r;
1355
- }, function(r) {
1356
- return st(r) || (ae(t), r && r.response && (r.response.data = ce.call(
1357
- t,
1358
- t.transformResponse,
1359
- r.response
1360
- ), r.response.headers = T.from(r.response.headers))), Promise.reject(r);
1361
- });
1362
- }
1363
- const ft = "1.7.7", Se = {};
1364
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1365
- Se[t] = function(r) {
1366
- return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
1367
- };
1368
- });
1369
- const Ie = {};
1370
- Se.transitional = function(e, n, r) {
1371
- function s(i, o) {
1372
- return "[Axios v" + ft + "] Transitional option '" + i + "'" + o + (r ? ". " + r : "");
1373
- }
1374
- return (i, o, c) => {
1375
- if (e === !1)
1376
- throw new g(
1377
- s(o, " has been removed" + (n ? " in " + n : "")),
1378
- g.ERR_DEPRECATED
1379
- );
1380
- return n && !Ie[o] && (Ie[o] = !0, console.warn(
1381
- s(
1382
- o,
1383
- " has been deprecated since v" + n + " and will be removed in the near future"
1384
- )
1385
- )), e ? e(i, o, c) : !0;
1386
- };
1387
- };
1388
- function $n(t, e, n) {
1389
- if (typeof t != "object")
1390
- throw new g("options must be an object", g.ERR_BAD_OPTION_VALUE);
1391
- const r = Object.keys(t);
1392
- let s = r.length;
1393
- for (; s-- > 0; ) {
1394
- const i = r[s], o = e[i];
1395
- if (o) {
1396
- const c = t[i], f = c === void 0 || o(c, i, t);
1397
- if (f !== !0)
1398
- throw new g("option " + i + " must be " + f, g.ERR_BAD_OPTION_VALUE);
1399
- continue;
1400
- }
1401
- if (n !== !0)
1402
- throw new g("Unknown option " + i, g.ERR_BAD_OPTION);
1403
- }
1404
- }
1405
- const pe = {
1406
- assertOptions: $n,
1407
- validators: Se
1408
- }, D = pe.validators;
1409
- class j {
1410
- constructor(e) {
1411
- this.defaults = e, this.interceptors = {
1412
- request: new Ne(),
1413
- response: new Ne()
1414
- };
1415
- }
1416
- /**
1417
- * Dispatch a request
1418
- *
1419
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1420
- * @param {?Object} config
1421
- *
1422
- * @returns {Promise} The Promise to be fulfilled
1423
- */
1424
- async request(e, n) {
1425
- try {
1426
- return await this._request(e, n);
1427
- } catch (r) {
1428
- if (r instanceof Error) {
1429
- let s;
1430
- Error.captureStackTrace ? Error.captureStackTrace(s = {}) : s = new Error();
1431
- const i = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1432
- try {
1433
- r.stack ? i && !String(r.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (r.stack += `
1434
- ` + i) : r.stack = i;
1435
- } catch {
1436
- }
1437
- }
1438
- throw r;
1439
- }
1440
- }
1441
- _request(e, n) {
1442
- typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = B(this.defaults, n);
1443
- const { transitional: r, paramsSerializer: s, headers: i } = n;
1444
- r !== void 0 && pe.assertOptions(r, {
1445
- silentJSONParsing: D.transitional(D.boolean),
1446
- forcedJSONParsing: D.transitional(D.boolean),
1447
- clarifyTimeoutError: D.transitional(D.boolean)
1448
- }, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
1449
- serialize: s
1450
- } : pe.assertOptions(s, {
1451
- encode: D.function,
1452
- serialize: D.function
1453
- }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1454
- let o = i && a.merge(
1455
- i.common,
1456
- i[n.method]
1457
- );
1458
- i && a.forEach(
1459
- ["delete", "get", "head", "post", "put", "patch", "common"],
1460
- (d) => {
1461
- delete i[d];
1462
- }
1463
- ), n.headers = T.concat(o, i);
1464
- const c = [];
1465
- let f = !0;
1466
- this.interceptors.request.forEach(function(m) {
1467
- typeof m.runWhen == "function" && m.runWhen(n) === !1 || (f = f && m.synchronous, c.unshift(m.fulfilled, m.rejected));
1468
- });
1469
- const u = [];
1470
- this.interceptors.response.forEach(function(m) {
1471
- u.push(m.fulfilled, m.rejected);
1472
- });
1473
- let l, h = 0, _;
1474
- if (!f) {
1475
- const d = [ve.bind(this), void 0];
1476
- for (d.unshift.apply(d, c), d.push.apply(d, u), _ = d.length, l = Promise.resolve(n); h < _; )
1477
- l = l.then(d[h++], d[h++]);
1478
- return l;
1479
- }
1480
- _ = c.length;
1481
- let y = n;
1482
- for (h = 0; h < _; ) {
1483
- const d = c[h++], m = c[h++];
1484
- try {
1485
- y = d(y);
1486
- } catch (p) {
1487
- m.call(this, p);
1488
- break;
1489
- }
1490
- }
1491
- try {
1492
- l = ve.call(this, y);
1493
- } catch (d) {
1494
- return Promise.reject(d);
1495
- }
1496
- for (h = 0, _ = u.length; h < _; )
1497
- l = l.then(u[h++], u[h++]);
1498
- return l;
1499
- }
1500
- getUri(e) {
1501
- e = B(this.defaults, e);
1502
- const n = ot(e.baseURL, e.url);
1503
- return tt(n, e.params, e.paramsSerializer);
1504
- }
1505
- }
1506
- a.forEach(["delete", "get", "head", "options"], function(e) {
1507
- j.prototype[e] = function(n, r) {
1508
- return this.request(B(r || {}, {
1509
- method: e,
1510
- url: n,
1511
- data: (r || {}).data
1512
- }));
1513
- };
1514
- });
1515
- a.forEach(["post", "put", "patch"], function(e) {
1516
- function n(r) {
1517
- return function(i, o, c) {
1518
- return this.request(B(c || {}, {
1519
- method: e,
1520
- headers: r ? {
1521
- "Content-Type": "multipart/form-data"
1522
- } : {},
1523
- url: i,
1524
- data: o
1525
- }));
1526
- };
1527
- }
1528
- j.prototype[e] = n(), j.prototype[e + "Form"] = n(!0);
1529
- });
1530
- class Ee {
1531
- constructor(e) {
1532
- if (typeof e != "function")
1533
- throw new TypeError("executor must be a function.");
1534
- let n;
1535
- this.promise = new Promise(function(i) {
1536
- n = i;
1537
- });
1538
- const r = this;
1539
- this.promise.then((s) => {
1540
- if (!r._listeners) return;
1541
- let i = r._listeners.length;
1542
- for (; i-- > 0; )
1543
- r._listeners[i](s);
1544
- r._listeners = null;
1545
- }), this.promise.then = (s) => {
1546
- let i;
1547
- const o = new Promise((c) => {
1548
- r.subscribe(c), i = c;
1549
- }).then(s);
1550
- return o.cancel = function() {
1551
- r.unsubscribe(i);
1552
- }, o;
1553
- }, e(function(i, o, c) {
1554
- r.reason || (r.reason = new v(i, o, c), n(r.reason));
1555
- });
1556
- }
1557
- /**
1558
- * Throws a `CanceledError` if cancellation has been requested.
1559
- */
1560
- throwIfRequested() {
1561
- if (this.reason)
1562
- throw this.reason;
1563
- }
1564
- /**
1565
- * Subscribe to the cancel signal
1566
- */
1567
- subscribe(e) {
1568
- if (this.reason) {
1569
- e(this.reason);
1570
- return;
1571
- }
1572
- this._listeners ? this._listeners.push(e) : this._listeners = [e];
1573
- }
1574
- /**
1575
- * Unsubscribe from the cancel signal
1576
- */
1577
- unsubscribe(e) {
1578
- if (!this._listeners)
1579
- return;
1580
- const n = this._listeners.indexOf(e);
1581
- n !== -1 && this._listeners.splice(n, 1);
1582
- }
1583
- toAbortSignal() {
1584
- const e = new AbortController(), n = (r) => {
1585
- e.abort(r);
1586
- };
1587
- return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal;
1588
- }
1589
- /**
1590
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1591
- * cancels the `CancelToken`.
1592
- */
1593
- static source() {
1594
- let e;
1595
- return {
1596
- token: new Ee(function(s) {
1597
- e = s;
1598
- }),
1599
- cancel: e
1600
- };
1601
- }
1602
- }
1603
- function zn(t) {
1604
- return function(n) {
1605
- return t.apply(null, n);
1606
- };
1607
- }
1608
- function Wn(t) {
1609
- return a.isObject(t) && t.isAxiosError === !0;
1610
- }
1611
- const me = {
1612
- Continue: 100,
1613
- SwitchingProtocols: 101,
1614
- Processing: 102,
1615
- EarlyHints: 103,
1616
- Ok: 200,
1617
- Created: 201,
1618
- Accepted: 202,
1619
- NonAuthoritativeInformation: 203,
1620
- NoContent: 204,
1621
- ResetContent: 205,
1622
- PartialContent: 206,
1623
- MultiStatus: 207,
1624
- AlreadyReported: 208,
1625
- ImUsed: 226,
1626
- MultipleChoices: 300,
1627
- MovedPermanently: 301,
1628
- Found: 302,
1629
- SeeOther: 303,
1630
- NotModified: 304,
1631
- UseProxy: 305,
1632
- Unused: 306,
1633
- TemporaryRedirect: 307,
1634
- PermanentRedirect: 308,
1635
- BadRequest: 400,
1636
- Unauthorized: 401,
1637
- PaymentRequired: 402,
1638
- Forbidden: 403,
1639
- NotFound: 404,
1640
- MethodNotAllowed: 405,
1641
- NotAcceptable: 406,
1642
- ProxyAuthenticationRequired: 407,
1643
- RequestTimeout: 408,
1644
- Conflict: 409,
1645
- Gone: 410,
1646
- LengthRequired: 411,
1647
- PreconditionFailed: 412,
1648
- PayloadTooLarge: 413,
1649
- UriTooLong: 414,
1650
- UnsupportedMediaType: 415,
1651
- RangeNotSatisfiable: 416,
1652
- ExpectationFailed: 417,
1653
- ImATeapot: 418,
1654
- MisdirectedRequest: 421,
1655
- UnprocessableEntity: 422,
1656
- Locked: 423,
1657
- FailedDependency: 424,
1658
- TooEarly: 425,
1659
- UpgradeRequired: 426,
1660
- PreconditionRequired: 428,
1661
- TooManyRequests: 429,
1662
- RequestHeaderFieldsTooLarge: 431,
1663
- UnavailableForLegalReasons: 451,
1664
- InternalServerError: 500,
1665
- NotImplemented: 501,
1666
- BadGateway: 502,
1667
- ServiceUnavailable: 503,
1668
- GatewayTimeout: 504,
1669
- HttpVersionNotSupported: 505,
1670
- VariantAlsoNegotiates: 506,
1671
- InsufficientStorage: 507,
1672
- LoopDetected: 508,
1673
- NotExtended: 510,
1674
- NetworkAuthenticationRequired: 511
1675
- };
1676
- Object.entries(me).forEach(([t, e]) => {
1677
- me[e] = t;
1678
- });
1679
- function dt(t) {
1680
- const e = new j(t), n = $e(j.prototype.request, e);
1681
- return a.extend(n, j.prototype, e, { allOwnKeys: !0 }), a.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(s) {
1682
- return dt(B(t, s));
1683
- }, n;
1684
- }
1685
- const E = dt(z);
1686
- E.Axios = j;
1687
- E.CanceledError = v;
1688
- E.CancelToken = Ee;
1689
- E.isCancel = st;
1690
- E.VERSION = ft;
1691
- E.toFormData = ne;
1692
- E.AxiosError = g;
1693
- E.Cancel = E.CanceledError;
1694
- E.all = function(e) {
1695
- return Promise.all(e);
1696
- };
1697
- E.spread = zn;
1698
- E.isAxiosError = Wn;
1699
- E.mergeConfig = B;
1700
- E.AxiosHeaders = T;
1701
- E.formToJSON = (t) => rt(a.isHTMLForm(t) ? new FormData(t) : t);
1702
- E.getAdapter = ut.getAdapter;
1703
- E.HttpStatusCode = me;
1704
- E.default = E;
1705
- const Ae = E.create({
1706
- baseURL: location.origin,
1707
- timeout: 6e4,
1708
- params: {}
1709
- });
1710
- Ae.interceptors.response.use(
1711
- (t) => t,
1712
- (t) => {
1713
- var e, n, r, s, i, o, c, f, u, l, h;
1714
- if (t.response) {
1715
- if (t.response.status === 401 && OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity, !0).then(
1716
- function(d) {
1717
- d && OpenC3Auth.setTokens();
1718
- }
1719
- ), t.response.config.headers["Ignore-Errors"] && t.response.config.headers["Ignore-Errors"].includes(
1720
- t.response.status.toString()
1721
- ))
1722
- return Promise.reject(t);
1723
- let _ = `HTTP ${t.response.status} - `;
1724
- (e = t.response) != null && e.statusText && (_ += `${t.response.statusText} `), (r = (n = t.response) == null ? void 0 : n.config) != null && r.data && (_ += `${t.response.config.data} `), (i = (s = t.response) == null ? void 0 : s.data) != null && i.message ? _ += `${t.response.data.message}` : (c = (o = t.response) == null ? void 0 : o.data) != null && c.exception ? _ += `${t.response.data.exception}` : (l = (u = (f = t.response) == null ? void 0 : f.data) == null ? void 0 : u.error) != null && l.message ? (t.response.data.error.class && (_ += `${t.response.data.error.class} `), _ += `${t.response.data.error.message}`) : _ += `${(h = t.response) == null ? void 0 : h.data}`;
1725
- const { $cosmosNotify: y } = window;
1726
- throw y && y.serious({
1727
- title: "Network error",
1728
- body: _
1729
- }), t;
1730
- } else
1731
- throw t;
1732
- }
1733
- );
1734
- const V = async function(t, e, {
1735
- data: n,
1736
- params: r = {},
1737
- headers: s,
1738
- noAuth: i = !1,
1739
- noScope: o = !1,
1740
- onUploadProgress: c = !1
1741
- } = {}) {
1742
- if (!i) {
1743
- try {
1744
- await OpenC3Auth.updateToken(
1745
- OpenC3Auth.defaultMinValidity
1746
- ) && OpenC3Auth.setTokens();
1747
- } catch {
1748
- OpenC3Auth.login();
1749
- }
1750
- s.Authorization = localStorage.openc3Token;
1751
- }
1752
- return s.manual = !0, !o && !r.scope && (r.scope = window.openc3Scope), Ae({
1753
- method: t,
1754
- url: e,
1755
- data: n,
1756
- params: r,
1757
- headers: s,
1758
- onUploadProgress: c
1759
- });
1760
- }, ge = {
1761
- Accept: "application/json"
1762
- }, qe = {
1763
- ...ge,
1764
- "Content-Type": "application/json"
1765
- }, nr = {
1766
- get: function(t, {
1767
- params: e,
1768
- headers: n = ge,
1769
- noScope: r,
1770
- noAuth: s,
1771
- onUploadProgress: i
1772
- } = {}) {
1773
- return V("get", t, {
1774
- params: e,
1775
- headers: n,
1776
- noScope: r,
1777
- noAuth: s,
1778
- onUploadProgress: i
1779
- });
1780
- },
1781
- put: function(t, {
1782
- data: e,
1783
- params: n,
1784
- headers: r = qe,
1785
- noScope: s,
1786
- noAuth: i,
1787
- onUploadProgress: o
1788
- } = {}) {
1789
- return V("put", t, {
1790
- data: e,
1791
- params: n,
1792
- headers: r,
1793
- noScope: s,
1794
- noAuth: i,
1795
- onUploadProgress: o
1796
- });
1797
- },
1798
- post: function(t, {
1799
- data: e,
1800
- params: n,
1801
- headers: r = qe,
1802
- noScope: s,
1803
- noAuth: i,
1804
- onUploadProgress: o
1805
- } = {}) {
1806
- return V("post", t, {
1807
- data: e,
1808
- params: n,
1809
- headers: r,
1810
- noScope: s,
1811
- noAuth: i,
1812
- onUploadProgress: o
1813
- });
1814
- },
1815
- delete: function(t, {
1816
- params: e,
1817
- headers: n = ge,
1818
- noScope: r,
1819
- noAuth: s,
1820
- onUploadProgress: i
1821
- } = {}) {
1822
- return V("delete", t, {
1823
- params: e,
1824
- headers: n,
1825
- noScope: r,
1826
- noAuth: s,
1827
- onUploadProgress: i
1828
- });
1829
- }
1830
- };
1831
- var X = {
1832
- logger: typeof console < "u" ? console : void 0,
1833
- WebSocket: typeof WebSocket < "u" ? WebSocket : void 0
1834
- }, S = {
1835
- log(...t) {
1836
- this.enabled && (t.push(Date.now()), X.logger.log("[ActionCable]", ...t));
1837
- }
1838
- };
1839
- const M = () => (/* @__PURE__ */ new Date()).getTime(), J = (t) => (M() - t) / 1e3;
1840
- class se {
1841
- constructor(e) {
1842
- this.visibilityDidChange = this.visibilityDidChange.bind(this), this.connection = e, this.reconnectAttempts = 0;
1843
- }
1844
- start() {
1845
- this.isRunning() || (this.startedAt = M(), delete this.stoppedAt, this.startPolling(), addEventListener("visibilitychange", this.visibilityDidChange), S.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`));
1846
- }
1847
- stop() {
1848
- this.isRunning() && (this.stoppedAt = M(), this.stopPolling(), removeEventListener("visibilitychange", this.visibilityDidChange), S.log("ConnectionMonitor stopped"));
1849
- }
1850
- isRunning() {
1851
- return this.startedAt && !this.stoppedAt;
1852
- }
1853
- recordPing() {
1854
- this.pingedAt = M();
1855
- }
1856
- recordConnect() {
1857
- this.reconnectAttempts = 0, this.recordPing(), delete this.disconnectedAt, S.log("ConnectionMonitor recorded connect");
1858
- }
1859
- recordDisconnect() {
1860
- this.disconnectedAt = M(), S.log("ConnectionMonitor recorded disconnect");
1861
- }
1862
- startPolling() {
1863
- this.stopPolling(), this.poll();
1864
- }
1865
- stopPolling() {
1866
- clearTimeout(this.pollTimeout);
1867
- }
1868
- poll() {
1869
- this.pollTimeout = setTimeout(() => {
1870
- this.reconnectIfStale(), this.poll();
1871
- }, this.getPollInterval());
1872
- }
1873
- getPollInterval() {
1874
- const { staleThreshold: e, reconnectionBackoffRate: n } = this.constructor, r = Math.pow(1 + n, Math.min(this.reconnectAttempts, 10)), i = (this.reconnectAttempts === 0 ? 1 : n) * Math.random();
1875
- return e * 1e3 * r * (1 + i);
1876
- }
1877
- reconnectIfStale() {
1878
- this.connectionIsStale() && (S.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${J(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`), this.reconnectAttempts++, this.disconnectedRecently() ? S.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${J(this.disconnectedAt)} s`) : (S.log("ConnectionMonitor reopening"), this.connection.reopen()));
1879
- }
1880
- get refreshedAt() {
1881
- return this.pingedAt ? this.pingedAt : this.startedAt;
1882
- }
1883
- connectionIsStale() {
1884
- return J(this.refreshedAt) > this.constructor.staleThreshold;
1885
- }
1886
- disconnectedRecently() {
1887
- return this.disconnectedAt && J(this.disconnectedAt) < this.constructor.staleThreshold;
1888
- }
1889
- visibilityDidChange() {
1890
- document.visibilityState === "visible" && setTimeout(() => {
1891
- (this.connectionIsStale() || !this.connection.isOpen()) && (S.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`), this.connection.reopen());
1892
- }, 200);
1893
- }
1894
- }
1895
- se.staleThreshold = 6;
1896
- se.reconnectionBackoffRate = 0.15;
1897
- var ht = {
1898
- message_types: {
1899
- welcome: "welcome",
1900
- disconnect: "disconnect",
1901
- ping: "ping",
1902
- confirmation: "confirm_subscription",
1903
- rejection: "reject_subscription"
1904
- },
1905
- disconnect_reasons: {
1906
- unauthorized: "unauthorized",
1907
- invalid_request: "invalid_request",
1908
- server_restart: "server_restart",
1909
- remote: "remote"
1910
- },
1911
- default_mount_path: "/cable",
1912
- protocols: ["actioncable-v1-json", "actioncable-unsupported"]
1913
- };
1914
- const { message_types: q, protocols: _e } = ht, Vn = _e.slice(0, _e.length - 1), Me = [].indexOf;
1915
- class Re {
1916
- constructor(e) {
1917
- this.open = this.open.bind(this), this.consumer = e, this.subscriptions = this.consumer.subscriptions, this.monitor = new se(this), this.disconnected = !0;
1918
- }
1919
- send(e) {
1920
- return this.isOpen() ? (this.webSocket.send(JSON.stringify(e)), !0) : !1;
1921
- }
1922
- open() {
1923
- if (this.isActive())
1924
- return S.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`), !1;
1925
- {
1926
- const e = [..._e, ...this.consumer.subprotocols || []];
1927
- return S.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${e}`), this.webSocket && this.uninstallEventHandlers(), this.webSocket = new X.WebSocket(this.consumer.url, e), this.installEventHandlers(), this.monitor.start(), !0;
1928
- }
1929
- }
1930
- close({ allowReconnect: e } = {
1931
- allowReconnect: !0
1932
- }) {
1933
- if (e || this.monitor.stop(), this.isOpen())
1934
- return this.webSocket.close();
1935
- }
1936
- reopen() {
1937
- if (S.log(`Reopening WebSocket, current state is ${this.getState()}`), this.isActive())
1938
- try {
1939
- return this.close();
1940
- } catch (e) {
1941
- S.log("Failed to reopen WebSocket", e);
1942
- } finally {
1943
- S.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`), setTimeout(this.open, this.constructor.reopenDelay);
1944
- }
1945
- else
1946
- return this.open();
1947
- }
1948
- getProtocol() {
1949
- if (this.webSocket)
1950
- return this.webSocket.protocol;
1951
- }
1952
- isOpen() {
1953
- return this.isState("open");
1954
- }
1955
- isActive() {
1956
- return this.isState("open", "connecting");
1957
- }
1958
- triedToReconnect() {
1959
- return this.monitor.reconnectAttempts > 0;
1960
- }
1961
- isProtocolSupported() {
1962
- return Me.call(Vn, this.getProtocol()) >= 0;
1963
- }
1964
- isState(...e) {
1965
- return Me.call(e, this.getState()) >= 0;
1966
- }
1967
- getState() {
1968
- if (this.webSocket) {
1969
- for (let e in X.WebSocket)
1970
- if (X.WebSocket[e] === this.webSocket.readyState)
1971
- return e.toLowerCase();
1972
- }
1973
- return null;
1974
- }
1975
- installEventHandlers() {
1976
- for (let e in this.events) {
1977
- const n = this.events[e].bind(this);
1978
- this.webSocket[`on${e}`] = n;
1979
- }
1980
- }
1981
- uninstallEventHandlers() {
1982
- for (let e in this.events)
1983
- this.webSocket[`on${e}`] = function() {
1984
- };
1985
- }
1986
- }
1987
- Re.reopenDelay = 500;
1988
- Re.prototype.events = {
1989
- message(t) {
1990
- if (!this.isProtocolSupported())
1991
- return;
1992
- const { identifier: e, message: n, reason: r, reconnect: s, type: i } = JSON.parse(t.data);
1993
- switch (i) {
1994
- case q.welcome:
1995
- return this.triedToReconnect() && (this.reconnectAttempted = !0), this.monitor.recordConnect(), this.subscriptions.reload();
1996
- case q.disconnect:
1997
- return S.log(`Disconnecting. Reason: ${r}`), this.close({
1998
- allowReconnect: s
1999
- });
2000
- case q.ping:
2001
- return this.monitor.recordPing();
2002
- case q.confirmation:
2003
- return this.subscriptions.confirmSubscription(e), this.reconnectAttempted ? (this.reconnectAttempted = !1, this.subscriptions.notify(e, "connected", {
2004
- reconnected: !0
2005
- })) : this.subscriptions.notify(e, "connected", {
2006
- reconnected: !1
2007
- });
2008
- case q.rejection:
2009
- return this.subscriptions.reject(e);
2010
- default:
2011
- return this.subscriptions.notify(e, "received", n);
2012
- }
2013
- },
2014
- open() {
2015
- if (S.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`), this.disconnected = !1, !this.isProtocolSupported())
2016
- return S.log("Protocol is unsupported. Stopping monitor and disconnecting."), this.close({
2017
- allowReconnect: !1
2018
- });
2019
- },
2020
- close(t) {
2021
- if (S.log("WebSocket onclose event"), !this.disconnected)
2022
- return this.disconnected = !0, this.monitor.recordDisconnect(), this.subscriptions.notifyAll("disconnected", {
2023
- willAttemptReconnect: this.monitor.isRunning()
2024
- });
2025
- },
2026
- error() {
2027
- S.log("WebSocket onerror event");
2028
- }
2029
- };
2030
- const Jn = function(t, e) {
2031
- if (e != null)
2032
- for (let n in e) {
2033
- const r = e[n];
2034
- t[n] = r;
2035
- }
2036
- return t;
2037
- };
2038
- class Gn {
2039
- constructor(e, n = {}, r) {
2040
- this.consumer = e, this.identifier = JSON.stringify(n), Jn(this, r);
2041
- }
2042
- perform(e, n = {}) {
2043
- return n.action = e, this.send(n);
2044
- }
2045
- send(e) {
2046
- return this.consumer.send({
2047
- command: "message",
2048
- identifier: this.identifier,
2049
- data: JSON.stringify(e)
2050
- });
2051
- }
2052
- unsubscribe() {
2053
- return this.consumer.subscriptions.remove(this);
2054
- }
2055
- }
2056
- class Kn {
2057
- constructor(e) {
2058
- this.subscriptions = e, this.pendingSubscriptions = [];
2059
- }
2060
- guarantee(e) {
2061
- this.pendingSubscriptions.indexOf(e) == -1 ? (S.log(`SubscriptionGuarantor guaranteeing ${e.identifier}`), this.pendingSubscriptions.push(e)) : S.log(`SubscriptionGuarantor already guaranteeing ${e.identifier}`), this.startGuaranteeing();
2062
- }
2063
- forget(e) {
2064
- S.log(`SubscriptionGuarantor forgetting ${e.identifier}`), this.pendingSubscriptions = this.pendingSubscriptions.filter((n) => n !== e);
2065
- }
2066
- startGuaranteeing() {
2067
- this.stopGuaranteeing(), this.retrySubscribing();
2068
- }
2069
- stopGuaranteeing() {
2070
- clearTimeout(this.retryTimeout);
2071
- }
2072
- retrySubscribing() {
2073
- this.retryTimeout = setTimeout(() => {
2074
- this.subscriptions && typeof this.subscriptions.subscribe == "function" && this.pendingSubscriptions.map((e) => {
2075
- S.log(`SubscriptionGuarantor resubscribing ${e.identifier}`), this.subscriptions.subscribe(e);
2076
- });
2077
- }, 500);
2078
- }
2079
- }
2080
- class Xn {
2081
- constructor(e) {
2082
- this.consumer = e, this.guarantor = new Kn(this), this.subscriptions = [];
2083
- }
2084
- create(e, n) {
2085
- const r = e, s = typeof r == "object" ? r : {
2086
- channel: r
2087
- }, i = new Gn(this.consumer, s, n);
2088
- return this.add(i);
2089
- }
2090
- add(e) {
2091
- return this.subscriptions.push(e), this.consumer.ensureActiveConnection(), this.notify(e, "initialized"), this.subscribe(e), e;
2092
- }
2093
- remove(e) {
2094
- return this.forget(e), this.findAll(e.identifier).length || this.sendCommand(e, "unsubscribe"), e;
2095
- }
2096
- reject(e) {
2097
- return this.findAll(e).map((n) => (this.forget(n), this.notify(n, "rejected"), n));
2098
- }
2099
- forget(e) {
2100
- return this.guarantor.forget(e), this.subscriptions = this.subscriptions.filter((n) => n !== e), e;
2101
- }
2102
- findAll(e) {
2103
- return this.subscriptions.filter((n) => n.identifier === e);
2104
- }
2105
- reload() {
2106
- return this.subscriptions.map((e) => this.subscribe(e));
2107
- }
2108
- notifyAll(e, ...n) {
2109
- return this.subscriptions.map((r) => this.notify(r, e, ...n));
2110
- }
2111
- notify(e, n, ...r) {
2112
- let s;
2113
- return typeof e == "string" ? s = this.findAll(e) : s = [e], s.map((i) => typeof i[n] == "function" ? i[n](...r) : void 0);
2114
- }
2115
- subscribe(e) {
2116
- this.sendCommand(e, "subscribe") && this.guarantor.guarantee(e);
2117
- }
2118
- confirmSubscription(e) {
2119
- S.log(`Subscription confirmed ${e}`), this.findAll(e).map((n) => this.guarantor.forget(n));
2120
- }
2121
- sendCommand(e, n) {
2122
- const { identifier: r } = e;
2123
- return this.consumer.send({
2124
- command: n,
2125
- identifier: r
2126
- });
2127
- }
2128
- }
2129
- class Qn {
2130
- constructor(e) {
2131
- this._url = e, this.subscriptions = new Xn(this), this.connection = new Re(this), this.subprotocols = [];
2132
- }
2133
- get url() {
2134
- return Yn(this._url);
2135
- }
2136
- send(e) {
2137
- return this.connection.send(e);
2138
- }
2139
- connect() {
2140
- return this.connection.open();
2141
- }
2142
- disconnect() {
2143
- return this.connection.close({
2144
- allowReconnect: !1
2145
- });
2146
- }
2147
- ensureActiveConnection() {
2148
- if (!this.connection.isActive())
2149
- return this.connection.open();
2150
- }
2151
- addSubProtocol(e) {
2152
- this.subprotocols = [...this.subprotocols, e];
2153
- }
2154
- }
2155
- function Yn(t) {
2156
- if (typeof t == "function" && (t = t()), t && !/^wss?:/i.test(t)) {
2157
- const e = document.createElement("a");
2158
- return e.href = t, e.href = e.href, e.protocol = e.protocol.replace("http", "ws"), e.href;
2159
- } else
2160
- return t;
2161
- }
2162
- function Zn(t = er("url") || ht.default_mount_path) {
2163
- return new Qn(t);
2164
- }
2165
- function er(t) {
2166
- const e = document.head.querySelector(`meta[name='action-cable-${t}']`);
2167
- if (e)
2168
- return e.getAttribute("content");
2169
- }
2170
- se.staleThreshold = 10;
2171
- class rr {
2172
- constructor(e = "/openc3-api/cable") {
2173
- this._cable = null, this._url = e;
2174
- }
2175
- disconnect() {
2176
- this._cable && this._cable.disconnect();
2177
- }
2178
- createSubscription(e, n, r = {}, s = {}) {
2179
- return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(
2180
- (i) => {
2181
- if (i && OpenC3Auth.setTokens(), this._cable == null) {
2182
- let o = this._url + "?scope=" + encodeURIComponent(window.openc3Scope) + "&authorization=" + encodeURIComponent(localStorage.openc3Token);
2183
- this._cable = Zn(o);
2184
- }
2185
- return this._cable.subscriptions.create(
2186
- {
2187
- channel: e,
2188
- ...s
2189
- },
2190
- r
2191
- );
2192
- }
2193
- );
2194
- }
2195
- recordPing() {
2196
- this._cable.connection.monitor.recordPing();
2197
- }
2198
- }
2199
- class He {
2200
- constructor(e, n, r = "", s = "") {
2201
- this.keyword = e.keyword, this.parameters = e.parameters, this.filename = e.filename, this.line = e.line, this.lineNumber = e.lineNumber, this.message = n, this.usage = r, this.url = s;
2202
- }
2203
- }
2204
- class sr {
2205
- constructor() {
2206
- P(this, "keyword", null);
2207
- P(this, "parameters", []);
2208
- P(this, "filename", "");
2209
- P(this, "line", "");
2210
- P(this, "lineNumber", 0);
2211
- P(this, "url", "https://docs.openc3.com/docs/configuration");
2212
- }
2213
- verify_num_parameters(e, n, r = "") {
2214
- for (let s = 1; s <= e; s++)
2215
- if (this.parameters[s - 1] === void 0)
2216
- throw new He(
2217
- this,
2218
- `Not enough parameters for ${this.keyword}.`,
2219
- r,
2220
- this.url
2221
- );
2222
- if (n && this.parameters[n] !== void 0)
2223
- throw new He(
2224
- this,
2225
- `Too many parameters for ${this.keyword}.`,
2226
- r,
2227
- this.url
2228
- );
2229
- }
2230
- remove_quotes(e) {
2231
- if (e.length < 2)
2232
- return e;
2233
- let n = e.charAt(0);
2234
- if (n !== '"' && n !== "'")
2235
- return e;
2236
- let r = e.charAt(e.length - 1);
2237
- return n !== r ? e : e.substring(1, e.length - 1);
2238
- }
2239
- scan_string(e, n) {
2240
- if (!n.global) throw "rx must have 'global' flag set";
2241
- let r = [];
2242
- return e.replace(n, function(s) {
2243
- return r.push(s), s;
2244
- }), r;
2245
- }
2246
- parse_string(e, n, r, s, i) {
2247
- let o = !1;
2248
- this.line = "", this.keyword = null, this.parameters = [], this.filename = n;
2249
- let c = e.split(`
2250
- `), f = c.length;
2251
- for (let u = 0; u < f; u++) {
2252
- this.lineNumber = u + 1;
2253
- let l = c[u].trim();
2254
- if (l.length === 0)
2255
- continue;
2256
- if (o === !0) {
2257
- if (l[0] === "#")
2258
- continue;
2259
- l = l.substring(1, l.length);
2260
- }
2261
- let h = l.charAt(l.length - 1), _ = !1;
2262
- switch (h) {
2263
- case "+":
2264
- _ = !0;
2265
- case "\\":
2266
- let b = l.substring(0, l.length - 1).trim();
2267
- this.line += b.substring(0, b.length - 1), _ && (this.line += `
2268
- `), o = !0;
2269
- continue;
2270
- case "&":
2271
- this.line += l.substring(0, l.length - 1);
2272
- continue;
2273
- default:
2274
- this.line += l;
2275
- }
2276
- o = !1;
2277
- let y = /("([^\\"]|\\.)*")|('([^\\']|\\.)*')|\S+/g, d = this.scan_string(this.line, y), m = "";
2278
- if (d.length > 0 && (m = m + d[0]), m.length === 0 || m.charAt(0) === "#" ? this.keyword = null : this.keyword = m.toUpperCase(), this.parameters = [], this.keyword === null) {
2279
- r && i(this.keyword, this.parameters, this.line, this.lineNumber), this.line = "";
2280
- continue;
2281
- }
2282
- let p = d.length;
2283
- if (p > 1)
2284
- for (let b = 1; b < p; b++) {
2285
- let w = d[b];
2286
- if (w.length > 0 && w.charAt(0) === "#")
2287
- break;
2288
- s ? this.parameters.push(this.remove_quotes(w)) : this.parameters.push(w);
2289
- }
2290
- i(this.keyword, this.parameters, this.line, this.lineNumber), this.line = "";
2291
- }
2292
- }
2293
- // parse_string
2294
- }
2295
- class ir {
2296
- constructor() {
2297
- P(this, "id", 1);
2298
- }
2299
- async exec(e, n, r = {}, s = {}, i = 6e4) {
2300
- try {
2301
- await OpenC3Auth.updateToken(
2302
- OpenC3Auth.defaultMinValidity
2303
- ) && OpenC3Auth.setTokens();
2304
- } catch {
2305
- OpenC3Auth.login();
2306
- }
2307
- this.id = this.id + 1;
2308
- try {
2309
- return r.scope = window.openc3Scope, s.manual = !0, (await Ae.post(
2310
- "/openc3-api/api",
2311
- {
2312
- jsonrpc: "2.0",
2313
- method: e,
2314
- params: n,
2315
- id: this.id,
2316
- keyword_params: r
2317
- },
2318
- {
2319
- headers: {
2320
- Authorization: localStorage.openc3Token,
2321
- "Content-Type": "application/json-rpc",
2322
- ...s
2323
- },
2324
- timeout: i
2325
- }
2326
- )).data.result;
2327
- } catch (o) {
2328
- let c = new Error();
2329
- throw o.response ? (c.name = o.response.data.error.data.class, c.message = o.response.data.error.data.message, c.object = o.response.data.error) : o.request ? (c.name = "Request error", c.message = "Request error, no response received") : c.name = "Unknown error", c;
2330
- }
2331
- }
2332
- decode_openc3_type(e) {
2333
- if (e !== null && typeof e == "object" && e.json_class == "Float" && e.raw) {
2334
- if (e.raw == "NaN")
2335
- return NaN;
2336
- if (e.raw == "Infinity")
2337
- return 1 / 0;
2338
- if (e.raw == "-Infinity")
2339
- return -1 / 0;
2340
- }
2341
- return null;
2342
- }
2343
- encode_openc3_type(e) {
2344
- return Number.isNaN(e) ? { json_class: "Float", raw: "NaN" } : e == Number.POSITIVE_INFINITY ? { json_class: "Float", raw: "Infinity" } : e == Number.NEGATIVE_INFINITY ? { json_class: "Float", raw: "-Infinity" } : null;
2345
- }
2346
- ensure_offline_access() {
2347
- this.offline_access_needed().then((e) => {
2348
- e && (localStorage.openc3OfflineToken ? this.set_offline_access(localStorage.openc3OfflineToken).then(() => {
2349
- delete localStorage.openc3OfflineToken;
2350
- }) : OpenC3Auth.getOfflineAccess());
2351
- });
2352
- }
2353
- // ***********************************************
2354
- // The following APIs are used by the CmdTlmServer
2355
- // ***********************************************
2356
- offline_access_needed() {
2357
- return this.exec("offline_access_needed", []);
2358
- }
2359
- set_offline_access(e) {
2360
- return this.exec("set_offline_access", [e]);
2361
- }
2362
- get_all_interface_info() {
2363
- return this.exec("get_all_interface_info", []);
2364
- }
2365
- map_target_to_interface(e, n) {
2366
- return this.exec("map_target_to_interface", [e, n]);
2367
- }
2368
- connect_interface(e, ...n) {
2369
- return n.length > 0 ? this.exec("connect_interface", [
2370
- e,
2371
- ...n
2372
- ]) : this.exec("connect_interface", [e]);
2373
- }
2374
- disconnect_interface(e) {
2375
- return this.exec("disconnect_interface", [e]);
2376
- }
2377
- interface_cmd(e, n, ...r) {
2378
- return this.exec("interface_cmd", [
2379
- e,
2380
- n,
2381
- ...r
2382
- ]);
2383
- }
2384
- get_all_router_info() {
2385
- return this.exec("get_all_router_info", []);
2386
- }
2387
- connect_router(e) {
2388
- return this.exec("connect_router", [e]);
2389
- }
2390
- disconnect_router(e) {
2391
- return this.exec("disconnect_router", [e]);
2392
- }
2393
- get_target_interfaces() {
2394
- return this.exec("get_target_interfaces", []);
2395
- }
2396
- get_tlm_cnts(e) {
2397
- return this.exec("get_tlm_cnts", [e]);
2398
- }
2399
- get_item(e, n, r) {
2400
- return this.exec("get_item", [e, n, r]);
2401
- }
2402
- get_param(e, n, r) {
2403
- return this.exec("get_param", [e, n, r]);
2404
- }
2405
- // DEPRECATED for get_param
2406
- get_parameter(e, n, r) {
2407
- return this.exec("get_param", [e, n, r]);
2408
- }
2409
- get_limits_sets() {
2410
- return this.exec("get_limits_sets", []);
2411
- }
2412
- get_limits_set() {
2413
- return this.exec("get_limits_set", []);
2414
- }
2415
- set_limits_set(e) {
2416
- return this.exec("set_limits_set", [e]);
2417
- }
2418
- // ***********************************************
2419
- // End CmdTlmServer APIs
2420
- // ***********************************************
2421
- get_target(e) {
2422
- return this.exec("get_target", [e]);
2423
- }
2424
- get_target_names() {
2425
- return this.exec("get_target_names", []);
2426
- }
2427
- // DEPRECATED for get_target_names
2428
- get_target_list() {
2429
- return this.exec("get_target_names", []);
2430
- }
2431
- get_tlm(e, n) {
2432
- return this.exec("get_tlm", [e, n]);
2433
- }
2434
- // DEPRECATED for get_tlm
2435
- get_telemetry(e, n) {
2436
- return this.exec("get_tlm", [e, n]);
2437
- }
2438
- get_all_tlm(e) {
2439
- return this.exec("get_all_tlm", [e]);
2440
- }
2441
- // DEPRECATED for get_all_tlm
2442
- get_all_telemetry(e) {
2443
- return this.exec("get_all_tlm", [e]);
2444
- }
2445
- get_all_tlm_names(e, n = !1) {
2446
- return this.exec("get_all_tlm_names", [e], { hidden: n });
2447
- }
2448
- // DEPRECATED for get_all_tlm_names
2449
- get_all_telemetry_names(e) {
2450
- return this.exec("get_all_tlm_names", [e]);
2451
- }
2452
- async get_tlm_packet(e, n, r, s = 30) {
2453
- const i = await this.exec("get_tlm_packet", [e, n], {
2454
- type: r,
2455
- stale_time: s
2456
- });
2457
- if (i != null) {
2458
- let o = i.length, c = null;
2459
- for (let f = 0; f < o; f++)
2460
- c = this.decode_openc3_type(i[f][1]), c !== null && (i[f][1] = c);
2461
- }
2462
- return i;
2463
- }
2464
- get_packet_derived_items(e, n) {
2465
- return this.exec("get_packet_derived_items", [e, n]);
2466
- }
2467
- get_tlm_buffer(e, n) {
2468
- return this.exec("get_tlm_buffer", [e, n]);
2469
- }
2470
- async get_tlm_values(e, n = 30, r = null) {
2471
- let s = {
2472
- stale_time: n
2473
- };
2474
- r !== null && (s.cache_timeout = r);
2475
- const i = await this.exec(
2476
- "get_tlm_values",
2477
- [e],
2478
- s,
2479
- {},
2480
- 1e4
2481
- // 10s timeout ... should never be this long
2482
- );
2483
- let o = i[0].length, c = null;
2484
- for (let f = 0; f < o; f++)
2485
- c = this.decode_openc3_type(i[0][f]), c !== null && (i[0][f] = c);
2486
- return i;
2487
- }
2488
- get_limits(e, n, r) {
2489
- return this.exec("get_limits", [e, n, r]);
2490
- }
2491
- async tlm(e, n, r, s = "CONVERTED") {
2492
- let i = null;
2493
- if (n === void 0)
2494
- i = await this.exec("tlm", [e]);
2495
- else if (r === void 0)
2496
- if (["RAW", "CONVERTED", "FORMATTED", "WITH_UNITS"].includes(n))
2497
- i = await this.exec("tlm", [e], { type: n });
2498
- else {
2499
- let c = new Error();
2500
- throw c.name = "TypeError", c.message = `Invalid data type ${n}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`, c;
2501
- }
2502
- else
2503
- i = await this.exec("tlm", [e, n, r], {
2504
- type: s
2505
- });
2506
- let o = this.decode_openc3_type(i);
2507
- return o !== null && (i = o), i;
2508
- }
2509
- async inject_tlm(e, n, r = null, s = "CONVERTED") {
2510
- data = await this.exec(
2511
- "inject_tlm",
2512
- [e, n, r],
2513
- {
2514
- type: s
2515
- }
2516
- );
2517
- }
2518
- set_tlm(e, n, r, s) {
2519
- return this.exec("set_tlm", [e, n, r], {
2520
- type: s
2521
- });
2522
- }
2523
- override_tlm(e, n, r, s) {
2524
- return this.exec("override_tlm", [e, n, r], {
2525
- type: s
2526
- });
2527
- }
2528
- get_overrides() {
2529
- return this.exec("get_overrides");
2530
- }
2531
- normalize_tlm(e, n, r, s) {
2532
- return this.exec("normalize_tlm", [e, n, r], {
2533
- type: s
2534
- });
2535
- }
2536
- get_all_cmds(e) {
2537
- return this.exec("get_all_cmds", [e]);
2538
- }
2539
- // DEPRECATED for get_all_cmds
2540
- get_all_commands(e) {
2541
- return this.exec("get_all_cmds", [e]);
2542
- }
2543
- get_all_cmd_names(e, n = !1) {
2544
- return this.exec("get_all_cmd_names", [e], { hidden: n });
2545
- }
2546
- // DEPRECATED for get_all_cmd_names
2547
- get_all_command_names(e) {
2548
- return this.exec("get_all_cmd_names", [e]);
2549
- }
2550
- get_cmd(e, n) {
2551
- return this.exec("get_cmd", [e, n]);
2552
- }
2553
- // DEPRECATED for get_cmd
2554
- get_command(e, n) {
2555
- return this.exec("get_cmd", [e, n]);
2556
- }
2557
- get_cmd_cnts(e) {
2558
- return this.exec("get_cmd_cnts", [e]);
2559
- }
2560
- get_cmd_value(e, n, r, s = "CONVERTED") {
2561
- return this.exec("get_cmd_value", [
2562
- e,
2563
- n,
2564
- r,
2565
- s
2566
- ]);
2567
- }
2568
- get_cmd_buffer(e, n) {
2569
- return this.exec("get_cmd_buffer", [e, n]);
2570
- }
2571
- // Implementation of functionality shared by cmd methods with param_lists.
2572
- _cmd(e, n, r, s, i) {
2573
- let o = null;
2574
- for (let c in s)
2575
- Object.prototype.hasOwnProperty.call(s, c) && (o = this.encode_openc3_type(s[c]), o !== null && (s[c] = o));
2576
- return this.exec(
2577
- e,
2578
- [n, r, s],
2579
- {},
2580
- i
2581
- );
2582
- }
2583
- get_cmd_hazardous(e, n, r, s = {}) {
2584
- return n === void 0 ? this.exec("get_cmd_hazardous", e, {}, s) : this._cmd(
2585
- "get_cmd_hazardous",
2586
- e,
2587
- n,
2588
- r,
2589
- s
2590
- );
2591
- }
2592
- cmd(e, n, r, s = {}) {
2593
- return n === void 0 ? this.exec("cmd", e, {}, s) : this._cmd(
2594
- "cmd",
2595
- e,
2596
- n,
2597
- r,
2598
- s
2599
- );
2600
- }
2601
- cmd_no_range_check(e, n, r, s = {}) {
2602
- return n === void 0 ? this.exec("cmd_no_range_check", e, {}, s) : this._cmd(
2603
- "cmd_no_range_check",
2604
- e,
2605
- n,
2606
- r,
2607
- s
2608
- );
2609
- }
2610
- cmd_raw(e, n, r, s = {}) {
2611
- return n === void 0 ? this.exec("cmd_raw", e, {}, s) : this._cmd(
2612
- "cmd_raw",
2613
- e,
2614
- n,
2615
- r,
2616
- s
2617
- );
2618
- }
2619
- cmd_raw_no_range_check(e, n, r, s = {}) {
2620
- return n === void 0 ? this.exec("cmd_raw_no_range_check", e, {}, s) : this._cmd(
2621
- "cmd_raw_no_range_check",
2622
- e,
2623
- n,
2624
- r,
2625
- s
2626
- );
2627
- }
2628
- cmd_no_hazardous_check(e, n, r, s = {}) {
2629
- return n === void 0 ? this.exec("cmd_no_hazardous_check", e, {}, s) : this._cmd(
2630
- "cmd_no_hazardous_check",
2631
- e,
2632
- n,
2633
- r,
2634
- s
2635
- );
2636
- }
2637
- cmd_no_checks(e, n, r, s = {}) {
2638
- return n === void 0 ? this.exec("cmd_no_checks", e, {}, s) : this._cmd(
2639
- "cmd_no_checks",
2640
- e,
2641
- n,
2642
- r,
2643
- s
2644
- );
2645
- }
2646
- cmd_raw_no_hazardous_check(e, n, r, s = {}) {
2647
- return n === void 0 ? this.exec(
2648
- "cmd_raw_no_hazardous_check",
2649
- e,
2650
- {},
2651
- s
2652
- ) : this._cmd(
2653
- "cmd_raw_no_hazardous_check",
2654
- e,
2655
- n,
2656
- r,
2657
- s
2658
- );
2659
- }
2660
- cmd_raw_no_checks(e, n, r, s = {}) {
2661
- return n === void 0 ? this.exec("cmd_raw_no_checks", e, {}, s) : this._cmd(
2662
- "cmd_raw_no_checks",
2663
- e,
2664
- n,
2665
- r,
2666
- s
2667
- );
2668
- }
2669
- build_cmd(e, n, r) {
2670
- return n === void 0 ? this.exec("build_cmd", e) : this._cmd("build_cmd", e, n, r);
2671
- }
2672
- // DEPRECATED for build_cmd
2673
- build_command(e, n, r) {
2674
- return n === void 0 ? this.exec("build_cmd", e) : this._cmd("build_cmd", e, n, r);
2675
- }
2676
- get_interface_names() {
2677
- return this.exec("get_interface_names", []);
2678
- }
2679
- send_raw(e, n) {
2680
- return this.exec("send_raw", [e, n]);
2681
- }
2682
- list_configs(e) {
2683
- return this.exec("list_configs", [e]);
2684
- }
2685
- load_config(e, n) {
2686
- return this.exec("load_config", [e, n]);
2687
- }
2688
- save_config(e, n, r) {
2689
- return this.exec("save_config", [e, n, r]);
2690
- }
2691
- delete_config(e, n) {
2692
- return this.exec("delete_config", [e, n]);
2693
- }
2694
- enable_limits(e, n, r) {
2695
- return this.exec("enable_limits", [e, n, r]);
2696
- }
2697
- disable_limits(e, n, r) {
2698
- return this.exec("disable_limits", [e, n, r]);
2699
- }
2700
- get_out_of_limits() {
2701
- return this.exec("get_out_of_limits", []);
2702
- }
2703
- get_overall_limits_state(e) {
2704
- return this.exec("get_overall_limits_state", [e]);
2705
- }
2706
- list_settings() {
2707
- return this.exec("list_settings", []);
2708
- }
2709
- get_all_settings() {
2710
- return this.exec("get_all_settings", []);
2711
- }
2712
- get_setting(e) {
2713
- return this.exec("get_setting", [e]);
2714
- }
2715
- get_settings(e) {
2716
- return this.exec("get_settings", e);
2717
- }
2718
- set_setting(e, n) {
2719
- return this.exec("set_setting", [e, n]);
2720
- }
2721
- // DEPRECATED for set_setting
2722
- save_setting(e, n) {
2723
- return this.exec("set_setting", [e, n]);
2724
- }
2725
- get_metrics() {
2726
- return this.exec("get_metrics", []);
2727
- }
2728
- // TODO: Currently unused but seemed like a useful function
2729
- async hashString(e) {
2730
- if (window.isSecureContext) {
2731
- const n = new TextEncoder().encode(e), r = await crypto.subtle.digest(
2732
- "SHA-256",
2733
- n
2734
- ), s = new Uint8Array(r);
2735
- return Array.from(s).map((i) => i.toString(16).padStart(2, "0")).join("");
2736
- }
2737
- }
2738
- }
2739
- export {
2740
- nr as Api,
2741
- rr as Cable,
2742
- He as ConfigParserError,
2743
- sr as ConfigParserService,
2744
- ir as OpenC3Api,
2745
- Ae as axios
2746
- };
2747
- //# sourceMappingURL=services.js.map