@synnaxlabs/freighter 0.56.0 → 0.56.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/.turbo/turbo-build.log +4 -4
- package/dist/freighter.cjs +7 -7
- package/dist/freighter.js +300 -283
- package/dist/src/alamos.d.ts.map +1 -1
- package/dist/src/errors.d.ts +3 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/unary.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/alamos.ts +5 -7
- package/src/errors.ts +5 -2
- package/src/http.ts +15 -6
- package/src/unary.ts +5 -4
- package/src/websocket.ts +2 -2
package/dist/freighter.js
CHANGED
|
@@ -144,18 +144,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
144
144
|
} else if (r !== i) return !1;
|
|
145
145
|
}
|
|
146
146
|
return !0;
|
|
147
|
-
}, ie = (e,
|
|
148
|
-
if (t.length === 0) return e;
|
|
149
|
-
let n = t.shift();
|
|
150
|
-
if (_(e) && _(n)) for (let t in n) try {
|
|
151
|
-
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), ie(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
152
|
-
} catch (e) {
|
|
153
|
-
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
|
|
154
|
-
}
|
|
155
|
-
return ie(e, ...t);
|
|
156
|
-
}, ae = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), oe = (e, t) => {
|
|
147
|
+
}, ie = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), ae = (e, t) => {
|
|
157
148
|
let n = Symbol.for(e);
|
|
158
|
-
if (!
|
|
149
|
+
if (!ie(n)) {
|
|
159
150
|
let e = t();
|
|
160
151
|
Object.defineProperty(globalThis, n, { value: e });
|
|
161
152
|
}
|
|
@@ -169,15 +160,16 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
169
160
|
createTyped: () => y,
|
|
170
161
|
decode: () => ge,
|
|
171
162
|
encode: () => he,
|
|
172
|
-
|
|
163
|
+
fromUnknown: () => le,
|
|
164
|
+
isTyped: () => ce,
|
|
173
165
|
payloadZ: () => ve,
|
|
174
166
|
register: () => me
|
|
175
|
-
}),
|
|
176
|
-
static discriminator =
|
|
167
|
+
}), oe = "sy_x_error", se = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, y = (e) => class t extends Error {
|
|
168
|
+
static discriminator = oe;
|
|
177
169
|
discriminator = t.discriminator;
|
|
178
170
|
static TYPE = e;
|
|
179
171
|
type = t.TYPE;
|
|
180
|
-
static matches =
|
|
172
|
+
static matches = se(e);
|
|
181
173
|
matches = t.matches;
|
|
182
174
|
constructor(e, n) {
|
|
183
175
|
super(e, n), this.name = t.TYPE;
|
|
@@ -185,12 +177,21 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
185
177
|
static sub(t) {
|
|
186
178
|
return y(`${e}.${t}`);
|
|
187
179
|
}
|
|
188
|
-
},
|
|
180
|
+
}, ce = (e) => {
|
|
189
181
|
if (typeof e != "object" || !e) return !1;
|
|
190
182
|
let t = e;
|
|
191
|
-
if (t.discriminator !==
|
|
183
|
+
if (t.discriminator !== oe) return !1;
|
|
192
184
|
if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
|
|
193
185
|
return !0;
|
|
186
|
+
}, le = (e) => {
|
|
187
|
+
if (e instanceof Error) return e;
|
|
188
|
+
let t;
|
|
189
|
+
try {
|
|
190
|
+
t = JSON.stringify(e) ?? String(e);
|
|
191
|
+
} catch {
|
|
192
|
+
t = String(e);
|
|
193
|
+
}
|
|
194
|
+
return Error(t, { cause: e });
|
|
194
195
|
}, b = "unknown", ue = (e, t) => ({
|
|
195
196
|
...e,
|
|
196
197
|
name: t.name,
|
|
@@ -205,7 +206,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
205
206
|
type: "nil",
|
|
206
207
|
data: ""
|
|
207
208
|
};
|
|
208
|
-
if (
|
|
209
|
+
if (ce(e)) for (let t of this.providers) {
|
|
209
210
|
let n = t.encode(e);
|
|
210
211
|
if (n != null) return ue(n, e);
|
|
211
212
|
}
|
|
@@ -238,7 +239,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
238
239
|
}
|
|
239
240
|
return de(new _e(e.data), e);
|
|
240
241
|
}
|
|
241
|
-
}, pe =
|
|
242
|
+
}, pe = ae("synnax-error-registry", () => new fe()), me = ({ encode: e, decode: t }) => pe().register({
|
|
242
243
|
encode: e,
|
|
243
244
|
decode: t
|
|
244
245
|
}), he = (e) => pe().encode(e), ge = (e) => e == null ? null : pe().decode(e), _e = class extends y("unknown") {}, ve = t.object({
|
|
@@ -246,14 +247,23 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
246
247
|
data: t.string(),
|
|
247
248
|
name: t.string().optional(),
|
|
248
249
|
stack: t.string().optional()
|
|
249
|
-
}), ye = class extends y("canceled") {}, be = class extends y("not_implemented") {}, xe = (e) => {
|
|
250
|
+
}), ye = class extends y("canceled") {}, be = class extends y("not_implemented") {}, xe = (e, ...t) => {
|
|
251
|
+
if (t.length === 0) return e;
|
|
252
|
+
let n = t.shift();
|
|
253
|
+
if (_(e) && _(n)) for (let t in n) try {
|
|
254
|
+
_(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), xe(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
255
|
+
} catch (e) {
|
|
256
|
+
throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : le(e);
|
|
257
|
+
}
|
|
258
|
+
return xe(e, ...t);
|
|
259
|
+
}, Se = (e) => {
|
|
250
260
|
if (e.length === 0) return "<root>";
|
|
251
261
|
let t = "";
|
|
252
262
|
return e.forEach((e, n) => {
|
|
253
263
|
typeof e == "number" ? t += `[${e}]` : n === 0 ? t += String(e) : t += `.${String(e)}`;
|
|
254
264
|
}), t;
|
|
255
|
-
},
|
|
256
|
-
let n = t.maxStringLength ??
|
|
265
|
+
}, Ce = 200, we = 10, Te = 8, x = (e, t = {}) => {
|
|
266
|
+
let n = t.maxStringLength ?? Ce, r = t.maxArrayLength ?? we, i = t.maxDepth ?? Te, a = (e, t) => {
|
|
257
267
|
if (e === null) return null;
|
|
258
268
|
if (e === void 0) return "[undefined]";
|
|
259
269
|
let o = typeof e;
|
|
@@ -284,7 +294,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
284
294
|
}
|
|
285
295
|
};
|
|
286
296
|
return a(e, 0);
|
|
287
|
-
},
|
|
297
|
+
}, Ee = (e, t = {}) => JSON.stringify(x(e, t), null, 2), S = (e) => typeof e == "object" && !!e && "value" in e, C = class {
|
|
288
298
|
value;
|
|
289
299
|
constructor(e) {
|
|
290
300
|
this.value = e;
|
|
@@ -298,11 +308,11 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
298
308
|
toString() {
|
|
299
309
|
return this.value.toString();
|
|
300
310
|
}
|
|
301
|
-
},
|
|
311
|
+
}, De = (e) => typeof e == "object" && !!e && "toString" in e, Oe = (e) => e == null || typeof e != "object" && typeof e != "function", ke = "value", Ae = "zod.parse", je = "✗", Me = 60, Ne = {
|
|
302
312
|
maxStringLength: 60,
|
|
303
313
|
maxArrayLength: 3,
|
|
304
314
|
maxDepth: 3
|
|
305
|
-
},
|
|
315
|
+
}, Pe = (e) => e.slice(0, -1), Fe = (e) => {
|
|
306
316
|
switch (e.code) {
|
|
307
317
|
case "invalid_type": return `expected ${e.expected}`;
|
|
308
318
|
case "invalid_value": return `expected one of ${JSON.stringify(e.values)}`;
|
|
@@ -320,9 +330,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
320
330
|
case "custom": return e.message || "custom validation failed";
|
|
321
331
|
default: return e.message;
|
|
322
332
|
}
|
|
323
|
-
},
|
|
333
|
+
}, Ie = (e, t, n) => {
|
|
324
334
|
let r = JSON.stringify(x(t, n));
|
|
325
|
-
return `${
|
|
335
|
+
return `${Fe(e)}, received ${r}`;
|
|
326
336
|
}, w = (e) => {
|
|
327
337
|
let t = 0;
|
|
328
338
|
for (let n of e) {
|
|
@@ -363,7 +373,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
363
373
|
});
|
|
364
374
|
}
|
|
365
375
|
return n;
|
|
366
|
-
},
|
|
376
|
+
}, Le = (e) => {
|
|
367
377
|
let t = [];
|
|
368
378
|
for (let n of e) {
|
|
369
379
|
if (n.code === "unrecognized_keys" && "keys" in n && Array.isArray(n.keys)) {
|
|
@@ -376,9 +386,9 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
376
386
|
t.push(n);
|
|
377
387
|
}
|
|
378
388
|
return t;
|
|
379
|
-
},
|
|
380
|
-
let i = `${n} `, a = `${n +
|
|
381
|
-
...
|
|
389
|
+
}, Re = (e, t, n, r) => {
|
|
390
|
+
let i = `${n} `, a = `${n + je} `, o = {
|
|
391
|
+
...Ne,
|
|
382
392
|
...r
|
|
383
393
|
};
|
|
384
394
|
if (Array.isArray(e)) {
|
|
@@ -428,7 +438,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
428
438
|
return u.forEach((e, t) => {
|
|
429
439
|
if (e.mark == null) return;
|
|
430
440
|
let n = +(t < u.length - 1), r = e.content.length + n;
|
|
431
|
-
r > d && r <=
|
|
441
|
+
r > d && r <= Me && (d = r);
|
|
432
442
|
}), u.forEach((e, t) => {
|
|
433
443
|
let n = t < u.length - 1 ? "," : "", r = e.content + n;
|
|
434
444
|
if (e.mark != null) {
|
|
@@ -436,48 +446,48 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
436
446
|
c.push(`${a}${r}${t}× ${e.mark.reason}`);
|
|
437
447
|
} else c.push(`${i}${r}`);
|
|
438
448
|
}), c.push(n + (l ? "]" : "}")), c;
|
|
439
|
-
},
|
|
449
|
+
}, ze = "__root__", Be = (e, t, n) => {
|
|
440
450
|
let r = /* @__PURE__ */ new Map();
|
|
441
451
|
for (let t of e) {
|
|
442
|
-
let e = t.path.length === 0 ?
|
|
452
|
+
let e = t.path.length === 0 ? ze : `::${Se(Pe(t.path))}`, n = r.get(e);
|
|
443
453
|
n == null ? r.set(e, [t]) : n.push(t);
|
|
444
454
|
}
|
|
445
455
|
let i = [];
|
|
446
456
|
for (let [e, a] of r) {
|
|
447
|
-
if (e ===
|
|
448
|
-
i.push(a.map((e) => ` × ${
|
|
457
|
+
if (e === ze) {
|
|
458
|
+
i.push(a.map((e) => ` × ${Ie(e, t, n)}`).join("\n"));
|
|
449
459
|
continue;
|
|
450
460
|
}
|
|
451
|
-
let r =
|
|
461
|
+
let r = Pe(a[0].path), { present: o, value: s } = te(t, r);
|
|
452
462
|
if (!o) {
|
|
453
|
-
i.push(a.map((e) => ` at ${
|
|
463
|
+
i.push(a.map((e) => ` at ${Se(e.path)}\n × ${Ie(e, t, n)}`).join("\n"));
|
|
454
464
|
continue;
|
|
455
465
|
}
|
|
456
466
|
let c = /* @__PURE__ */ new Map();
|
|
457
467
|
for (let e of a) {
|
|
458
468
|
let n = String(e.path[e.path.length - 1]), r = te(t, e.path);
|
|
459
469
|
c.set(n, {
|
|
460
|
-
reason:
|
|
470
|
+
reason: Fe(e),
|
|
461
471
|
missing: !r.present
|
|
462
472
|
});
|
|
463
473
|
}
|
|
464
|
-
let l = r.length === 0, u =
|
|
465
|
-
l ? i.push(u.join("\n")) : i.push([` at ${
|
|
474
|
+
let l = r.length === 0, u = Re(s, c, l ? " " : " ", n);
|
|
475
|
+
l ? i.push(u.join("\n")) : i.push([` at ${Se(r)}`, ...u].join("\n"));
|
|
466
476
|
}
|
|
467
477
|
return i.join("\n\n");
|
|
468
|
-
},
|
|
478
|
+
}, Ve = (e, t) => {
|
|
469
479
|
let n = Object.entries(e);
|
|
470
|
-
return n.every(([, e]) =>
|
|
471
|
-
},
|
|
472
|
-
let a = i ?? {}, o =
|
|
473
|
-
return s.push(
|
|
474
|
-
},
|
|
480
|
+
return n.every(([, e]) => Oe(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : Ee(e, t);
|
|
481
|
+
}, He = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
|
|
482
|
+
let a = i ?? {}, o = Le(T(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
|
|
483
|
+
return s.push(Be(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${Ve(r, a)}`), s.join("\n\n");
|
|
484
|
+
}, Ue = class extends y(Ae) {
|
|
475
485
|
issues;
|
|
476
486
|
input;
|
|
477
487
|
label;
|
|
478
488
|
context;
|
|
479
489
|
constructor({ issues: e, input: t, label: n, context: r, cause: i, formatOptions: a }) {
|
|
480
|
-
super(
|
|
490
|
+
super(He({
|
|
481
491
|
issues: e,
|
|
482
492
|
input: t,
|
|
483
493
|
label: n,
|
|
@@ -499,7 +509,7 @@ var n = Object.defineProperty, r = (e, t) => {
|
|
|
499
509
|
};
|
|
500
510
|
me({
|
|
501
511
|
encode: (e) => {
|
|
502
|
-
if (!
|
|
512
|
+
if (!Ue.matches(e)) return null;
|
|
503
513
|
let t = e, n = {
|
|
504
514
|
label: t.label,
|
|
505
515
|
context: t.context,
|
|
@@ -507,14 +517,14 @@ me({
|
|
|
507
517
|
input: x(t.input)
|
|
508
518
|
};
|
|
509
519
|
return {
|
|
510
|
-
type:
|
|
520
|
+
type: Ae,
|
|
511
521
|
data: JSON.stringify(n)
|
|
512
522
|
};
|
|
513
523
|
},
|
|
514
524
|
decode: (e) => {
|
|
515
|
-
if (e.type !==
|
|
525
|
+
if (e.type !== Ae) return null;
|
|
516
526
|
let t = JSON.parse(e.data);
|
|
517
|
-
return new
|
|
527
|
+
return new Ue({
|
|
518
528
|
issues: t.issues,
|
|
519
529
|
input: t.input,
|
|
520
530
|
label: t.label,
|
|
@@ -522,33 +532,33 @@ me({
|
|
|
522
532
|
});
|
|
523
533
|
}
|
|
524
534
|
});
|
|
525
|
-
var
|
|
535
|
+
var We = (e, t, n = {}) => {
|
|
526
536
|
let r = e.safeParse(t);
|
|
527
537
|
if (r.success) return r.data;
|
|
528
|
-
throw new
|
|
538
|
+
throw new Ue({
|
|
529
539
|
issues: r.error.issues,
|
|
530
540
|
input: t,
|
|
531
|
-
label: n.label ??
|
|
541
|
+
label: n.label ?? ke,
|
|
532
542
|
context: n.context,
|
|
533
543
|
cause: r.error
|
|
534
544
|
});
|
|
535
|
-
},
|
|
545
|
+
}, Ge = 2 ** 12 - 1, Ke = 2 ** 16 - 1, qe = 2 ** 20 - 1, Je = -128, Ye = -(2 ** 15), Xe = 2 ** 15 - 1, Ze = -(2n ** 63n), E = 2n ** 63n - 1n, Qe = -(2 ** 63), $e = 2 ** 63 - 1, et = (e) => (t, n) => {
|
|
536
546
|
if (typeof t == "bigint") {
|
|
537
|
-
if (
|
|
547
|
+
if (tt(n)) return e(t, BigInt(n));
|
|
538
548
|
let r = e(Number(t), Number(n));
|
|
539
549
|
return typeof r == "number" ? BigInt(Math.round(r)) : r;
|
|
540
550
|
}
|
|
541
551
|
return e(Number(t), Number(n));
|
|
542
|
-
}, D =
|
|
552
|
+
}, D = et((e, t) => e - t), O = et((e, t) => e + t), tt = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), k = et((e, t) => e * t), A = et((e, t) => e / t), nt = ["left", "right"], rt = t.enum(nt), it = t.enum(["top", "bottom"]), at = t.enum(["px", "decimal"]), ot = [
|
|
543
553
|
"top",
|
|
544
554
|
"right",
|
|
545
555
|
"bottom",
|
|
546
556
|
"left"
|
|
547
557
|
];
|
|
548
|
-
t.enum(
|
|
549
|
-
var
|
|
558
|
+
t.enum(ot);
|
|
559
|
+
var st = t.enum(["x", "y"]);
|
|
550
560
|
t.enum(["clockwise", "counterclockwise"]);
|
|
551
|
-
var
|
|
561
|
+
var ct = ["center"], lt = t.enum(ct);
|
|
552
562
|
t.enum([
|
|
553
563
|
"top",
|
|
554
564
|
"right",
|
|
@@ -563,19 +573,19 @@ t.enum([
|
|
|
563
573
|
var j = t.object({
|
|
564
574
|
x: t.number(),
|
|
565
575
|
y: t.number()
|
|
566
|
-
}), lt = t.object({
|
|
567
|
-
x: nt,
|
|
568
|
-
y: rt
|
|
569
576
|
}), ut = t.object({
|
|
570
|
-
x:
|
|
577
|
+
x: rt,
|
|
571
578
|
y: it
|
|
572
579
|
}), dt = t.object({
|
|
580
|
+
x: at,
|
|
581
|
+
y: at
|
|
582
|
+
}), ft = t.object({
|
|
573
583
|
width: t.number(),
|
|
574
584
|
height: t.number()
|
|
575
|
-
}),
|
|
585
|
+
}), pt = t.object({
|
|
576
586
|
signedWidth: t.number(),
|
|
577
587
|
signedHeight: t.number()
|
|
578
|
-
}),
|
|
588
|
+
}), mt = t.object({
|
|
579
589
|
clientX: t.number(),
|
|
580
590
|
clientY: t.number()
|
|
581
591
|
});
|
|
@@ -583,12 +593,12 @@ t.object({
|
|
|
583
593
|
zoom: t.number().default(1),
|
|
584
594
|
position: j
|
|
585
595
|
});
|
|
586
|
-
var
|
|
596
|
+
var ht = t.object({
|
|
587
597
|
x: t.number(),
|
|
588
598
|
y: t.number(),
|
|
589
|
-
root:
|
|
590
|
-
units:
|
|
591
|
-
}),
|
|
599
|
+
root: ut.optional(),
|
|
600
|
+
units: dt.optional()
|
|
601
|
+
}), gt = t.tuple([t.number(), t.number()]), M = (e, t, n) => {
|
|
592
602
|
let r = {};
|
|
593
603
|
if (typeof t == "object" && (n = t, t = void 0), n = {
|
|
594
604
|
makeValid: !0,
|
|
@@ -598,7 +608,7 @@ var mt = t.object({
|
|
|
598
608
|
if (e.length !== 2) throw Error("bounds: expected array of length 2");
|
|
599
609
|
[r.lower, r.upper] = e;
|
|
600
610
|
} else r.lower = e.lower, r.upper = e.upper;
|
|
601
|
-
return n?.makeValid ?
|
|
611
|
+
return n?.makeValid ? _t(r) : r;
|
|
602
612
|
};
|
|
603
613
|
Object.freeze({
|
|
604
614
|
lower: 0,
|
|
@@ -613,17 +623,17 @@ Object.freeze({
|
|
|
613
623
|
lower: -1,
|
|
614
624
|
upper: 1
|
|
615
625
|
});
|
|
616
|
-
var
|
|
626
|
+
var _t = (e) => e.lower > e.upper ? {
|
|
617
627
|
lower: e.upper,
|
|
618
628
|
upper: e.lower
|
|
619
|
-
} : e,
|
|
629
|
+
} : e, vt = (e, t) => {
|
|
620
630
|
let n = M(e);
|
|
621
631
|
return t < n.lower ? n.lower : t >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : t;
|
|
622
632
|
};
|
|
623
|
-
t.int().min(
|
|
624
|
-
var
|
|
625
|
-
t.int().min(0).max(
|
|
626
|
-
var
|
|
633
|
+
t.int().min(Je).max(127), t.int().min(Ye).max(Xe), t.int().min(Qe).max($e);
|
|
634
|
+
var yt = t.int().min(0).max(255);
|
|
635
|
+
t.int().min(0).max(Ge), t.int().min(0).max(Ke), t.int().min(0).max(qe);
|
|
636
|
+
var bt = class {
|
|
627
637
|
contentType = "application/json";
|
|
628
638
|
decoder;
|
|
629
639
|
encoder;
|
|
@@ -638,13 +648,13 @@ var yt = class {
|
|
|
638
648
|
}
|
|
639
649
|
decodeString(e, t) {
|
|
640
650
|
let n = f(JSON.parse(e), { schema: t });
|
|
641
|
-
return t == null ? n :
|
|
651
|
+
return t == null ? n : We(t, n);
|
|
642
652
|
}
|
|
643
653
|
encodeString(e, t) {
|
|
644
|
-
let n = p((t == null ? e :
|
|
654
|
+
let n = p((t == null ? e : We(t, e)) ?? {}, { schema: t });
|
|
645
655
|
return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
|
|
646
656
|
}
|
|
647
|
-
},
|
|
657
|
+
}, xt = class {
|
|
648
658
|
contentType = "text/csv";
|
|
649
659
|
encode(e) {
|
|
650
660
|
let t = this.encodeString(e);
|
|
@@ -681,7 +691,7 @@ var yt = class {
|
|
|
681
691
|
let t = Number(e);
|
|
682
692
|
return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
|
|
683
693
|
}
|
|
684
|
-
},
|
|
694
|
+
}, St = class {
|
|
685
695
|
contentType = "text/plain";
|
|
686
696
|
encode(e) {
|
|
687
697
|
if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
|
|
@@ -691,9 +701,9 @@ var yt = class {
|
|
|
691
701
|
let n = new TextDecoder().decode(e);
|
|
692
702
|
return t == null ? n : t.parse(n);
|
|
693
703
|
}
|
|
694
|
-
},
|
|
695
|
-
new
|
|
696
|
-
var
|
|
704
|
+
}, Ct = new bt();
|
|
705
|
+
new xt(), new St();
|
|
706
|
+
var wt = 365, N = 30, Tt = t.union([
|
|
697
707
|
t.tuple([t.int()]),
|
|
698
708
|
t.tuple([t.int(), t.int().min(1).max(12)]),
|
|
699
709
|
t.tuple([
|
|
@@ -701,7 +711,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
701
711
|
t.int().min(1).max(12),
|
|
702
712
|
t.int().min(1).max(31)
|
|
703
713
|
])
|
|
704
|
-
]),
|
|
714
|
+
]), Et = (e, t) => {
|
|
705
715
|
let n = new P(t);
|
|
706
716
|
if (![
|
|
707
717
|
F.DAY,
|
|
@@ -725,7 +735,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
725
735
|
else if (Array.isArray(t)) super(e.parseDate(t));
|
|
726
736
|
else {
|
|
727
737
|
let r = 0n;
|
|
728
|
-
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === $e ?
|
|
738
|
+
t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === $e ? E : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), S(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
|
|
729
739
|
}
|
|
730
740
|
}
|
|
731
741
|
static parseDate([t = 1970, n = 1, r = 1]) {
|
|
@@ -943,7 +953,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
943
953
|
}
|
|
944
954
|
}
|
|
945
955
|
remainder(e) {
|
|
946
|
-
return
|
|
956
|
+
return Et(this, e);
|
|
947
957
|
}
|
|
948
958
|
get isToday() {
|
|
949
959
|
return this.truncate(F.DAY).equals(e.now().truncate(F.DAY));
|
|
@@ -1001,7 +1011,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1001
1011
|
return e.hours(t * 24, n);
|
|
1002
1012
|
}
|
|
1003
1013
|
static DAY = e.days(1);
|
|
1004
|
-
static MAX = new e(
|
|
1014
|
+
static MAX = new e(E);
|
|
1005
1015
|
static MIN = new e(0);
|
|
1006
1016
|
static ZERO = new e(0);
|
|
1007
1017
|
static z = t.union([
|
|
@@ -1012,7 +1022,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1012
1022
|
t.bigint().transform((t) => new e(t)),
|
|
1013
1023
|
t.date().transform((t) => new e(t)),
|
|
1014
1024
|
t.custom((e) => e instanceof F).transform((t) => new e(t)),
|
|
1015
|
-
|
|
1025
|
+
Tt.transform((t) => new e(t))
|
|
1016
1026
|
]);
|
|
1017
1027
|
static sort(e, t) {
|
|
1018
1028
|
return Number(e.valueOf() - t.valueOf());
|
|
@@ -1046,7 +1056,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1046
1056
|
return this.valueOf() >= new e(t).valueOf();
|
|
1047
1057
|
}
|
|
1048
1058
|
remainder(e) {
|
|
1049
|
-
return
|
|
1059
|
+
return Et(this, e);
|
|
1050
1060
|
}
|
|
1051
1061
|
truncate(t) {
|
|
1052
1062
|
return new e(BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf());
|
|
@@ -1060,11 +1070,11 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1060
1070
|
let t = new e(this.valueOf() < 0n ? -this.valueOf() : this.valueOf()), n = this.valueOf() < 0n;
|
|
1061
1071
|
if (t.valueOf() === 0n) return "0s";
|
|
1062
1072
|
if (t.lessThan(e.SECOND)) return "< 1s";
|
|
1063
|
-
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r /
|
|
1073
|
+
let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / wt), c = Math.floor(r / N), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
|
|
1064
1074
|
if (s >= 1) {
|
|
1065
1075
|
let e = `${s}y`;
|
|
1066
1076
|
if (s < 2) {
|
|
1067
|
-
let t = Math.floor(r %
|
|
1077
|
+
let t = Math.floor(r % wt / N);
|
|
1068
1078
|
t > 0 && (e += ` ${t}mo`);
|
|
1069
1079
|
}
|
|
1070
1080
|
return m + e;
|
|
@@ -1178,7 +1188,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1178
1188
|
return e.hours(k(t, 24));
|
|
1179
1189
|
}
|
|
1180
1190
|
static DAY = e.days(1);
|
|
1181
|
-
static MAX = new e(
|
|
1191
|
+
static MAX = new e(E);
|
|
1182
1192
|
static MIN = new e(0);
|
|
1183
1193
|
static ZERO = new e(0);
|
|
1184
1194
|
static z = t.union([
|
|
@@ -1337,7 +1347,7 @@ var Ct = 365, N = 30, wt = t.union([
|
|
|
1337
1347
|
start: P.z,
|
|
1338
1348
|
end: P.z
|
|
1339
1349
|
}).transform((t) => new e(t.start, t.end)), t.instanceof(e)]);
|
|
1340
|
-
static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <=
|
|
1350
|
+
static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= E, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= Ze, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
|
|
1341
1351
|
static sort(e, t) {
|
|
1342
1352
|
return P.sort(e.start, t.start) || P.sort(e.end, t.end);
|
|
1343
1353
|
}
|
|
@@ -1594,13 +1604,13 @@ t.object({
|
|
|
1594
1604
|
t.instanceof(Int32Array),
|
|
1595
1605
|
t.instanceof(BigInt64Array)
|
|
1596
1606
|
]);
|
|
1597
|
-
var
|
|
1607
|
+
var Dt = (e) => {
|
|
1598
1608
|
let t = typeof e;
|
|
1599
1609
|
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof P || e instanceof F || e instanceof Date;
|
|
1600
|
-
},
|
|
1610
|
+
}, Ot = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(BigInt(n.valueOf()) - BigInt(r.valueOf())) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : D(n, r);
|
|
1601
1611
|
R.z, P.z, F.z, I.z, B.z, z.z, R.boundedZ;
|
|
1602
|
-
var
|
|
1603
|
-
let n =
|
|
1612
|
+
var kt = (e, t = !1) => {
|
|
1613
|
+
let n = De(e) ? "stringer" : typeof e, r;
|
|
1604
1614
|
switch (n) {
|
|
1605
1615
|
case "string":
|
|
1606
1616
|
r = (e, t) => e.localeCompare(t);
|
|
@@ -1622,73 +1632,73 @@ var Ot = (e, t = !1) => {
|
|
|
1622
1632
|
break;
|
|
1623
1633
|
default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
|
|
1624
1634
|
}
|
|
1625
|
-
return t ?
|
|
1626
|
-
},
|
|
1635
|
+
return t ? At(r) : r;
|
|
1636
|
+
}, At = (e) => (t, n) => e(n, t), jt = (e, t = 21) => (n = t) => {
|
|
1627
1637
|
let r = "", i = n | 0;
|
|
1628
1638
|
for (; i--;) r += e[Math.random() * e.length | 0];
|
|
1629
1639
|
return r;
|
|
1630
|
-
},
|
|
1640
|
+
}, Mt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Nt = `0123456789${Mt}`, Pt = jt(Mt, 1), Ft = jt(Nt, 10), It = () => `${Pt()}${Ft()}`, Lt = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e;
|
|
1631
1641
|
e.enum([
|
|
1632
1642
|
"x",
|
|
1633
1643
|
"y",
|
|
1634
|
-
...
|
|
1635
|
-
...
|
|
1644
|
+
...ot,
|
|
1645
|
+
...ct
|
|
1636
1646
|
]);
|
|
1637
|
-
var
|
|
1647
|
+
var Rt = ut;
|
|
1638
1648
|
t.union([
|
|
1639
|
-
|
|
1640
|
-
t.enum([...
|
|
1649
|
+
st,
|
|
1650
|
+
t.enum([...ot, ...ct]),
|
|
1641
1651
|
t.instanceof(String)
|
|
1642
1652
|
]), t.object({
|
|
1643
|
-
x:
|
|
1644
|
-
y:
|
|
1653
|
+
x: rt.or(lt),
|
|
1654
|
+
y: it.or(lt)
|
|
1645
1655
|
});
|
|
1646
|
-
var
|
|
1656
|
+
var zt = Object.freeze({
|
|
1647
1657
|
x: "left",
|
|
1648
1658
|
y: "top"
|
|
1649
|
-
}),
|
|
1659
|
+
}), Bt = Object.freeze({
|
|
1650
1660
|
x: "right",
|
|
1651
1661
|
y: "top"
|
|
1652
|
-
}),
|
|
1662
|
+
}), Vt = Object.freeze({
|
|
1653
1663
|
x: "left",
|
|
1654
1664
|
y: "bottom"
|
|
1655
|
-
}),
|
|
1665
|
+
}), Ht = Object.freeze({
|
|
1656
1666
|
x: "right",
|
|
1657
1667
|
y: "bottom"
|
|
1658
|
-
}),
|
|
1668
|
+
}), Ut = Object.freeze({
|
|
1659
1669
|
x: "center",
|
|
1660
1670
|
y: "center"
|
|
1661
|
-
}),
|
|
1671
|
+
}), Wt = Object.freeze({
|
|
1662
1672
|
x: "center",
|
|
1663
1673
|
y: "top"
|
|
1664
|
-
}),
|
|
1674
|
+
}), Gt = Object.freeze({
|
|
1665
1675
|
x: "center",
|
|
1666
1676
|
y: "bottom"
|
|
1667
|
-
}),
|
|
1677
|
+
}), Kt = Object.freeze({
|
|
1668
1678
|
x: "right",
|
|
1669
1679
|
y: "center"
|
|
1670
|
-
}),
|
|
1680
|
+
}), qt = Object.freeze({
|
|
1671
1681
|
x: "left",
|
|
1672
1682
|
y: "center"
|
|
1673
1683
|
});
|
|
1674
1684
|
Object.freeze([
|
|
1685
|
+
qt,
|
|
1675
1686
|
Kt,
|
|
1676
|
-
Gt,
|
|
1677
|
-
Ut,
|
|
1678
1687
|
Wt,
|
|
1679
|
-
|
|
1688
|
+
Gt,
|
|
1680
1689
|
zt,
|
|
1681
1690
|
Bt,
|
|
1682
1691
|
Vt,
|
|
1683
|
-
Ht
|
|
1692
|
+
Ht,
|
|
1693
|
+
Ut
|
|
1684
1694
|
]);
|
|
1685
|
-
var
|
|
1695
|
+
var Jt = (e, t) => e.x === t.x && e.y === t.y, Yt = (e) => [e.x, e.y], Xt = t.union([
|
|
1686
1696
|
t.number(),
|
|
1687
1697
|
j,
|
|
1688
|
-
|
|
1689
|
-
dt,
|
|
1698
|
+
gt,
|
|
1690
1699
|
ft,
|
|
1691
|
-
pt
|
|
1700
|
+
pt,
|
|
1701
|
+
mt
|
|
1692
1702
|
]), V = (e, t) => {
|
|
1693
1703
|
if (typeof e == "string") {
|
|
1694
1704
|
if (t === void 0) throw Error("The y coordinate must be given.");
|
|
@@ -1733,22 +1743,22 @@ Object.freeze({
|
|
|
1733
1743
|
x: NaN,
|
|
1734
1744
|
y: NaN
|
|
1735
1745
|
});
|
|
1736
|
-
var
|
|
1746
|
+
var Zt = (e, t) => {
|
|
1737
1747
|
let n = V(e);
|
|
1738
1748
|
return {
|
|
1739
1749
|
x: n.x + t,
|
|
1740
1750
|
y: n.y
|
|
1741
1751
|
};
|
|
1742
|
-
},
|
|
1752
|
+
}, Qt = (e, t) => {
|
|
1743
1753
|
let n = V(e);
|
|
1744
1754
|
return {
|
|
1745
1755
|
x: n.x,
|
|
1746
1756
|
y: n.y + t
|
|
1747
1757
|
};
|
|
1748
|
-
},
|
|
1758
|
+
}, $t = (e, t, n, ...r) => {
|
|
1749
1759
|
if (typeof t == "string") {
|
|
1750
1760
|
if (typeof n != "number") throw Error("The value must be a number.");
|
|
1751
|
-
return t === "x" ?
|
|
1761
|
+
return t === "x" ? Zt(e, n) : Qt(e, n);
|
|
1752
1762
|
}
|
|
1753
1763
|
if (typeof t == "object" && "x" in t && typeof t.x == "string") {
|
|
1754
1764
|
let r = V(n), i = V(e);
|
|
@@ -1783,13 +1793,13 @@ t.object({
|
|
|
1783
1793
|
}), t.object({
|
|
1784
1794
|
one: j,
|
|
1785
1795
|
two: j,
|
|
1786
|
-
root:
|
|
1796
|
+
root: Rt
|
|
1787
1797
|
});
|
|
1788
1798
|
var W = (e, t, n = 0, r = 0, i) => {
|
|
1789
1799
|
let a = {
|
|
1790
1800
|
one: { ...H },
|
|
1791
1801
|
two: { ...H },
|
|
1792
|
-
root: i ??
|
|
1802
|
+
root: i ?? zt
|
|
1793
1803
|
};
|
|
1794
1804
|
if (typeof e == "number") {
|
|
1795
1805
|
if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
|
|
@@ -1823,64 +1833,64 @@ var W = (e, t, n = 0, r = 0, i) => {
|
|
|
1823
1833
|
x: a.one.x + t.signedWidth,
|
|
1824
1834
|
y: a.one.y + t.signedHeight
|
|
1825
1835
|
} : a.two = t, a));
|
|
1826
|
-
},
|
|
1836
|
+
}, en = (e, t) => {
|
|
1827
1837
|
let n = W(e);
|
|
1828
1838
|
return {
|
|
1829
|
-
x: t.x === "center" ?
|
|
1830
|
-
y: t.y === "center" ?
|
|
1839
|
+
x: t.x === "center" ? on(n).x : tn(n, t.x),
|
|
1840
|
+
y: t.y === "center" ? on(n).y : tn(n, t.y)
|
|
1831
1841
|
};
|
|
1832
|
-
},
|
|
1833
|
-
let n = W(e), r =
|
|
1834
|
-
return
|
|
1835
|
-
},
|
|
1842
|
+
}, tn = (e, t) => {
|
|
1843
|
+
let n = W(e), r = Yt(n.root).includes(t) ? Math.min : Math.max;
|
|
1844
|
+
return nt.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
|
|
1845
|
+
}, nn = (e) => {
|
|
1836
1846
|
let t = W(e);
|
|
1837
1847
|
return t.two.x - t.one.x;
|
|
1838
|
-
},
|
|
1848
|
+
}, rn = (e) => {
|
|
1839
1849
|
let t = W(e);
|
|
1840
1850
|
return t.two.y - t.one.y;
|
|
1841
|
-
},
|
|
1842
|
-
x:
|
|
1843
|
-
y:
|
|
1844
|
-
}),
|
|
1851
|
+
}, an = (e) => en(e, zt), on = (e) => $t(an(e), {
|
|
1852
|
+
x: nn(e) / 2,
|
|
1853
|
+
y: rn(e) / 2
|
|
1854
|
+
}), sn = (e) => {
|
|
1845
1855
|
let t = W(e);
|
|
1846
1856
|
return {
|
|
1847
1857
|
lower: t.one.x,
|
|
1848
1858
|
upper: t.two.x
|
|
1849
1859
|
};
|
|
1850
|
-
},
|
|
1860
|
+
}, cn = (e) => {
|
|
1851
1861
|
let t = W(e);
|
|
1852
1862
|
return {
|
|
1853
1863
|
lower: t.one.y,
|
|
1854
1864
|
upper: t.two.y
|
|
1855
1865
|
};
|
|
1856
|
-
},
|
|
1866
|
+
}, ln = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e;
|
|
1857
1867
|
t.union([
|
|
1858
|
-
dt,
|
|
1859
1868
|
ft,
|
|
1869
|
+
pt,
|
|
1860
1870
|
j,
|
|
1861
|
-
|
|
1871
|
+
gt
|
|
1862
1872
|
]);
|
|
1863
|
-
var
|
|
1873
|
+
var un = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
|
|
1864
1874
|
t.object({
|
|
1865
|
-
offset:
|
|
1866
|
-
scale:
|
|
1875
|
+
offset: Xt,
|
|
1876
|
+
scale: Xt
|
|
1867
1877
|
}), t.object({
|
|
1868
1878
|
offset: t.number(),
|
|
1869
1879
|
scale: t.number()
|
|
1870
1880
|
});
|
|
1871
|
-
var
|
|
1881
|
+
var dn = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], fn = (e) => (t, n, r, i) => [t, i ? r / e : r * e], pn = (e) => (t, n, r) => {
|
|
1872
1882
|
if (t === null) return [e, r];
|
|
1873
1883
|
let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
|
|
1874
1884
|
return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
|
|
1875
|
-
},
|
|
1885
|
+
}, mn = (e) => (t, n, r) => [e, r], hn = () => (e, t, n) => {
|
|
1876
1886
|
if (e === null) throw Error("cannot invert without bounds");
|
|
1877
1887
|
if (t === "dimension") return [e, n];
|
|
1878
1888
|
let { lower: r, upper: i } = e;
|
|
1879
1889
|
return [e, i - (n - r)];
|
|
1880
|
-
},
|
|
1890
|
+
}, gn = (e) => (t, n, r) => {
|
|
1881
1891
|
let { lower: i, upper: a } = e;
|
|
1882
|
-
return r =
|
|
1883
|
-
},
|
|
1892
|
+
return r = un(r, i, a), [t, r];
|
|
1893
|
+
}, _n = class e {
|
|
1884
1894
|
ops = [];
|
|
1885
1895
|
currBounds = null;
|
|
1886
1896
|
currType = null;
|
|
@@ -1898,27 +1908,27 @@ var un = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
1898
1908
|
return new e().scale(t, n);
|
|
1899
1909
|
}
|
|
1900
1910
|
translate(e) {
|
|
1901
|
-
let t = this.new(), n =
|
|
1911
|
+
let t = this.new(), n = dn(e);
|
|
1902
1912
|
return n.type = "translate", t.ops.push(n), t;
|
|
1903
1913
|
}
|
|
1904
1914
|
magnify(e) {
|
|
1905
|
-
let t = this.new(), n =
|
|
1915
|
+
let t = this.new(), n = fn(e);
|
|
1906
1916
|
return n.type = "magnify", t.ops.push(n), t;
|
|
1907
1917
|
}
|
|
1908
1918
|
scale(e, t) {
|
|
1909
|
-
let n = M(e, t), r = this.new(), i =
|
|
1919
|
+
let n = M(e, t), r = this.new(), i = pn(n);
|
|
1910
1920
|
return i.type = "scale", r.ops.push(i), r;
|
|
1911
1921
|
}
|
|
1912
1922
|
clamp(e, t) {
|
|
1913
|
-
let n = M(e, t), r = this.new(), i =
|
|
1923
|
+
let n = M(e, t), r = this.new(), i = gn(n);
|
|
1914
1924
|
return i.type = "clamp", r.ops.push(i), r;
|
|
1915
1925
|
}
|
|
1916
1926
|
reBound(e, t) {
|
|
1917
|
-
let n = M(e, t), r = this.new(), i =
|
|
1927
|
+
let n = M(e, t), r = this.new(), i = mn(n);
|
|
1918
1928
|
return i.type = "re-bound", r.ops.push(i), r;
|
|
1919
1929
|
}
|
|
1920
1930
|
invert() {
|
|
1921
|
-
let e =
|
|
1931
|
+
let e = hn();
|
|
1922
1932
|
e.type = "invert";
|
|
1923
1933
|
let t = this.new();
|
|
1924
1934
|
return t.ops.push(e), t;
|
|
@@ -1961,7 +1971,7 @@ var un = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
1961
1971
|
x;
|
|
1962
1972
|
y;
|
|
1963
1973
|
currRoot;
|
|
1964
|
-
constructor(e = new
|
|
1974
|
+
constructor(e = new _n(), t = new _n(), n = null) {
|
|
1965
1975
|
this.x = e, this.y = t, this.currRoot = n;
|
|
1966
1976
|
}
|
|
1967
1977
|
static translate(t, n) {
|
|
@@ -2003,19 +2013,19 @@ var un = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
2003
2013
|
}
|
|
2004
2014
|
scale(e) {
|
|
2005
2015
|
let t = this.copy();
|
|
2006
|
-
if (
|
|
2016
|
+
if (ln(e)) {
|
|
2007
2017
|
let n = this.currRoot;
|
|
2008
|
-
return t.currRoot = e.root, n != null && !
|
|
2018
|
+
return t.currRoot = e.root, n != null && !Jt(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(sn(e)), t.y = t.y.scale(cn(e)), t;
|
|
2009
2019
|
}
|
|
2010
2020
|
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
2011
2021
|
}
|
|
2012
2022
|
reBound(e) {
|
|
2013
2023
|
let t = this.copy();
|
|
2014
|
-
return t.x = this.x.reBound(
|
|
2024
|
+
return t.x = this.x.reBound(sn(e)), t.y = this.y.reBound(cn(e)), t;
|
|
2015
2025
|
}
|
|
2016
2026
|
clamp(e) {
|
|
2017
2027
|
let t = this.copy();
|
|
2018
|
-
return t.x = this.x.clamp(
|
|
2028
|
+
return t.x = this.x.clamp(sn(e)), t.y = this.y.clamp(cn(e)), t;
|
|
2019
2029
|
}
|
|
2020
2030
|
copy() {
|
|
2021
2031
|
let t = new e();
|
|
@@ -2053,25 +2063,25 @@ var un = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r +
|
|
|
2053
2063
|
};
|
|
2054
2064
|
}
|
|
2055
2065
|
static IDENTITY = new e();
|
|
2056
|
-
}),
|
|
2066
|
+
}), ht.required({
|
|
2057
2067
|
root: !0,
|
|
2058
2068
|
units: !0
|
|
2059
2069
|
});
|
|
2060
|
-
var
|
|
2061
|
-
function
|
|
2062
|
-
return typeof e == "string" &&
|
|
2070
|
+
var vn = t.enum(["static", "dynamic"]), yn = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
2071
|
+
function bn(e) {
|
|
2072
|
+
return typeof e == "string" && yn.test(e);
|
|
2063
2073
|
}
|
|
2064
2074
|
var G = [];
|
|
2065
2075
|
for (let e = 0; e < 256; ++e) G.push((e + 256).toString(16).slice(1));
|
|
2066
|
-
function
|
|
2076
|
+
function xn(e, t = 0) {
|
|
2067
2077
|
return (G[e[t + 0]] + G[e[t + 1]] + G[e[t + 2]] + G[e[t + 3]] + "-" + G[e[t + 4]] + G[e[t + 5]] + "-" + G[e[t + 6]] + G[e[t + 7]] + "-" + G[e[t + 8]] + G[e[t + 9]] + "-" + G[e[t + 10]] + G[e[t + 11]] + G[e[t + 12]] + G[e[t + 13]] + G[e[t + 14]] + G[e[t + 15]]).toLowerCase();
|
|
2068
2078
|
}
|
|
2069
|
-
function
|
|
2070
|
-
let n =
|
|
2071
|
-
if (!
|
|
2079
|
+
function Sn(e, t = 0) {
|
|
2080
|
+
let n = xn(e, t);
|
|
2081
|
+
if (!bn(n)) throw TypeError("Stringified UUID is invalid");
|
|
2072
2082
|
return n;
|
|
2073
2083
|
}
|
|
2074
|
-
var
|
|
2084
|
+
var Cn = (e, t) => Sn(e, t), wn = (e) => {
|
|
2075
2085
|
let t = Math.fround(e);
|
|
2076
2086
|
if (!Number.isFinite(t)) return t.toString();
|
|
2077
2087
|
for (let e = 1; e <= 9; e++) {
|
|
@@ -2079,18 +2089,18 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2079
2089
|
if (Math.fround(n) === t) return n.toString();
|
|
2080
2090
|
}
|
|
2081
2091
|
return t.toString();
|
|
2082
|
-
}, K = -1,
|
|
2083
|
-
[Symbol.iterator]: () =>
|
|
2092
|
+
}, K = -1, Tn = {
|
|
2093
|
+
[Symbol.iterator]: () => Tn,
|
|
2084
2094
|
next: () => ({
|
|
2085
2095
|
done: !0,
|
|
2086
2096
|
value: void 0
|
|
2087
2097
|
})
|
|
2088
|
-
},
|
|
2098
|
+
}, En = t.string().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), Dn = t.union([t.null(), t.undefined()]).transform(() => new Uint8Array().buffer), q = 4, On = (e, t) => {
|
|
2089
2099
|
if (e === "number" && !t.isNumeric) throw Error(`cannot convert series of type ${t.toString()} to number`);
|
|
2090
2100
|
if (e === "bigint" && !t.usesBigInt) throw Error(`cannot convert series of type ${t.toString()} to bigint`);
|
|
2091
|
-
},
|
|
2101
|
+
}, kn = "sy_x_telem_series", An = class e {
|
|
2092
2102
|
key;
|
|
2093
|
-
discriminator =
|
|
2103
|
+
discriminator = kn;
|
|
2094
2104
|
dataType;
|
|
2095
2105
|
sampleOffset;
|
|
2096
2106
|
gl;
|
|
@@ -2109,23 +2119,23 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2109
2119
|
dataType: z.z,
|
|
2110
2120
|
alignment: t.coerce.bigint().optional(),
|
|
2111
2121
|
data: t.union([
|
|
2112
|
-
Tn,
|
|
2113
2122
|
En,
|
|
2123
|
+
Dn,
|
|
2114
2124
|
t.instanceof(ArrayBuffer),
|
|
2115
2125
|
t.instanceof(Uint8Array)
|
|
2116
2126
|
]).default(() => new Uint8Array().buffer),
|
|
2117
|
-
glBufferUsage:
|
|
2127
|
+
glBufferUsage: vn.default("static").optional()
|
|
2118
2128
|
});
|
|
2119
2129
|
static z = e.crudeZ.transform((t) => new e(t));
|
|
2120
2130
|
constructor(e) {
|
|
2121
|
-
|
|
2122
|
-
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s =
|
|
2123
|
-
if (
|
|
2131
|
+
jn(e) && (e = { data: e }), e.data ??= [];
|
|
2132
|
+
let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = It(), data: c } = e;
|
|
2133
|
+
if (Mn(c)) {
|
|
2124
2134
|
let e = c;
|
|
2125
2135
|
this.key = e.key, this.dataType = e.dataType, this.sampleOffset = e.sampleOffset, this.gl = e.gl, this._data = e._data, this.timeRange = e.timeRange, this.alignment = e.alignment, this.alignmentMultiple = e.alignmentMultiple, this.cachedMin = e.cachedMin, this.cachedMax = e.cachedMax, this.writePos = e.writePos, this._refCount = e._refCount, this.cachedLength = e.cachedLength;
|
|
2126
2136
|
return;
|
|
2127
2137
|
}
|
|
2128
|
-
let l =
|
|
2138
|
+
let l = Dt(c), u = Array.isArray(c);
|
|
2129
2139
|
if (t != null) this.dataType = new z(t);
|
|
2130
2140
|
else if (c instanceof ArrayBuffer) throw Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");
|
|
2131
2141
|
else if (u || l) {
|
|
@@ -2153,7 +2163,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2153
2163
|
this._data = r;
|
|
2154
2164
|
} else if (this.dataType.equals(z.JSON)) {
|
|
2155
2165
|
this.cachedLength = e.length;
|
|
2156
|
-
let t = e.map((e) => new TextEncoder().encode(
|
|
2166
|
+
let t = e.map((e) => new TextEncoder().encode(Ct.encodeString(e))), n = t.reduce((e, t) => e + q + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
|
|
2157
2167
|
for (let e of t) i.setUint32(o, e.byteLength, !0), o += q, a.set(e, o), o += e.byteLength;
|
|
2158
2168
|
this._data = r;
|
|
2159
2169
|
} else this.dataType.usesBigInt && typeof t == "number" ? this._data = new this.dataType.Array(e.map((e) => BigInt(Math.round(e)))).buffer : !this.dataType.usesBigInt && typeof t == "bigint" ? this._data = new this.dataType.Array(e.map(Number)).buffer : this._data = new this.dataType.Array(e).buffer;
|
|
@@ -2229,7 +2239,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2229
2239
|
}
|
|
2230
2240
|
parseJSON(e) {
|
|
2231
2241
|
if (!this.dataType.equals(z.JSON)) throw Error("cannot parse non-JSON series as JSON");
|
|
2232
|
-
return this.toStrings().map((t) => e.parse(
|
|
2242
|
+
return this.toStrings().map((t) => e.parse(Ct.decodeString(t)));
|
|
2233
2243
|
}
|
|
2234
2244
|
get byteCapacity() {
|
|
2235
2245
|
return new B(this.underlyingData.byteLength);
|
|
@@ -2255,7 +2265,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2255
2265
|
convert(t, n = 0) {
|
|
2256
2266
|
if (this.dataType.equals(t)) return this;
|
|
2257
2267
|
let r = new t.Array(this.length);
|
|
2258
|
-
for (let e = 0; e < this.length; e++) r[e] =
|
|
2268
|
+
for (let e = 0; e < this.length; e++) r[e] = Ot(this.dataType, t, this.data[e], n);
|
|
2259
2269
|
return new e({
|
|
2260
2270
|
data: r.buffer,
|
|
2261
2271
|
dataType: t,
|
|
@@ -2343,7 +2353,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2343
2353
|
}
|
|
2344
2354
|
atUUID(e, t) {
|
|
2345
2355
|
e < 0 && (e = this.length + e);
|
|
2346
|
-
let n =
|
|
2356
|
+
let n = Cn(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
|
|
2347
2357
|
if (n == null) {
|
|
2348
2358
|
if (t) throw Error(`[series] - no value at index ${e}`);
|
|
2349
2359
|
return;
|
|
@@ -2354,7 +2364,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2354
2364
|
if (this.dataType.isVariable) return this.atVariable(e, t);
|
|
2355
2365
|
if (this.dataType.equals(z.UUID)) return this.atUUID(e, t);
|
|
2356
2366
|
let n = this.at(e, t);
|
|
2357
|
-
if (n != null) return this.dataType.equals(z.FLOAT32) ?
|
|
2367
|
+
if (n != null) return this.dataType.equals(z.FLOAT32) ? wn(n) : String(n);
|
|
2358
2368
|
}
|
|
2359
2369
|
atVariable(e, t) {
|
|
2360
2370
|
let n = 0, r = 0, i = this.buffer, a = new DataView(i);
|
|
@@ -2384,7 +2394,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2384
2394
|
return new TextDecoder().decode(o);
|
|
2385
2395
|
}
|
|
2386
2396
|
binarySearch(e) {
|
|
2387
|
-
let t = 0, n = this.length - 1, r =
|
|
2397
|
+
let t = 0, n = this.length - 1, r = kt(e);
|
|
2388
2398
|
for (; t <= n;) {
|
|
2389
2399
|
let i = Math.floor((t + n) / 2), a = r(this.at(i, !0), e);
|
|
2390
2400
|
if (a === 0) return i;
|
|
@@ -2402,7 +2412,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2402
2412
|
} else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = K;
|
|
2403
2413
|
}
|
|
2404
2414
|
as(e) {
|
|
2405
|
-
return
|
|
2415
|
+
return On(e, this.dataType), this;
|
|
2406
2416
|
}
|
|
2407
2417
|
get digest() {
|
|
2408
2418
|
return {
|
|
@@ -2410,8 +2420,8 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2410
2420
|
dataType: this.dataType.toString(),
|
|
2411
2421
|
sampleOffset: this.sampleOffset,
|
|
2412
2422
|
alignment: {
|
|
2413
|
-
lower:
|
|
2414
|
-
upper:
|
|
2423
|
+
lower: Rn(this.alignmentBounds.lower),
|
|
2424
|
+
upper: Rn(this.alignmentBounds.upper),
|
|
2415
2425
|
multiple: this.alignmentMultiple
|
|
2416
2426
|
},
|
|
2417
2427
|
timeRange: this.timeRange.toString(),
|
|
@@ -2431,10 +2441,10 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2431
2441
|
}
|
|
2432
2442
|
[Symbol.iterator]() {
|
|
2433
2443
|
if (this.dataType.isVariable) {
|
|
2434
|
-
let e = new
|
|
2435
|
-
return this.dataType.equals(z.JSON) ? new
|
|
2444
|
+
let e = new Pn(this);
|
|
2445
|
+
return this.dataType.equals(z.JSON) ? new Fn(e) : e;
|
|
2436
2446
|
}
|
|
2437
|
-
return this.dataType.equals(z.UUID) ? new
|
|
2447
|
+
return this.dataType.equals(z.UUID) ? new In(this) : new Ln(this);
|
|
2438
2448
|
}
|
|
2439
2449
|
slice(e, t) {
|
|
2440
2450
|
return this.sliceSub(!1, e, t);
|
|
@@ -2443,11 +2453,11 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2443
2453
|
return this.sliceSub(!0, e, t);
|
|
2444
2454
|
}
|
|
2445
2455
|
subIterator(e, t) {
|
|
2446
|
-
return new
|
|
2456
|
+
return new Nn(this, e, t ?? this.length);
|
|
2447
2457
|
}
|
|
2448
2458
|
subAlignmentIterator(e, t) {
|
|
2449
2459
|
let n = Math.ceil(Number(e - this.alignment) / Number(this.alignmentMultiple)), r = Math.ceil(Number(t - this.alignment) / Number(this.alignmentMultiple));
|
|
2450
|
-
return new
|
|
2460
|
+
return new Nn(this, n, r);
|
|
2451
2461
|
}
|
|
2452
2462
|
subBytes(t, n) {
|
|
2453
2463
|
return t >= 0 && (n == null || n >= this.byteLength.valueOf()) ? this : new e({
|
|
@@ -2491,14 +2501,14 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2491
2501
|
}
|
|
2492
2502
|
return e += "])", e;
|
|
2493
2503
|
}
|
|
2494
|
-
},
|
|
2504
|
+
}, jn = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof An ? !0 : Dt(e), Mn = Lt(kn, An), Nn = class {
|
|
2495
2505
|
series;
|
|
2496
2506
|
end;
|
|
2497
2507
|
index;
|
|
2498
2508
|
constructor(e, t, n) {
|
|
2499
2509
|
this.series = e;
|
|
2500
2510
|
let r = M(0, e.length + 1);
|
|
2501
|
-
this.end =
|
|
2511
|
+
this.end = vt(r, n), this.index = vt(r, t);
|
|
2502
2512
|
}
|
|
2503
2513
|
next() {
|
|
2504
2514
|
return this.index >= this.end ? {
|
|
@@ -2509,7 +2519,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2509
2519
|
value: this.series.at(this.index++, !0)
|
|
2510
2520
|
};
|
|
2511
2521
|
}
|
|
2512
|
-
},
|
|
2522
|
+
}, Pn = class {
|
|
2513
2523
|
series;
|
|
2514
2524
|
byteOffset;
|
|
2515
2525
|
decoder;
|
|
@@ -2532,7 +2542,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2532
2542
|
value: n
|
|
2533
2543
|
};
|
|
2534
2544
|
}
|
|
2535
|
-
},
|
|
2545
|
+
}, Fn = class e {
|
|
2536
2546
|
wrapped;
|
|
2537
2547
|
static schema = t.record(t.string(), t.unknown());
|
|
2538
2548
|
constructor(e) {
|
|
@@ -2545,10 +2555,10 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2545
2555
|
value: void 0
|
|
2546
2556
|
} : {
|
|
2547
2557
|
done: !1,
|
|
2548
|
-
value:
|
|
2558
|
+
value: Ct.decodeString(t.value, e.schema)
|
|
2549
2559
|
};
|
|
2550
2560
|
}
|
|
2551
|
-
},
|
|
2561
|
+
}, In = class {
|
|
2552
2562
|
series;
|
|
2553
2563
|
index;
|
|
2554
2564
|
data;
|
|
@@ -2562,13 +2572,13 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2562
2572
|
done: !0,
|
|
2563
2573
|
value: void 0
|
|
2564
2574
|
};
|
|
2565
|
-
let e =
|
|
2575
|
+
let e = Cn(this.data, this.index * this.density);
|
|
2566
2576
|
return this.index++, {
|
|
2567
2577
|
done: !1,
|
|
2568
2578
|
value: e
|
|
2569
2579
|
};
|
|
2570
2580
|
}
|
|
2571
|
-
},
|
|
2581
|
+
}, Ln = class {
|
|
2572
2582
|
series;
|
|
2573
2583
|
index;
|
|
2574
2584
|
constructor(e) {
|
|
@@ -2583,7 +2593,7 @@ var Sn = (e, t) => xn(e, t), Cn = (e) => {
|
|
|
2583
2593
|
value: this.series.at(this.index++, !0)
|
|
2584
2594
|
};
|
|
2585
2595
|
}
|
|
2586
|
-
},
|
|
2596
|
+
}, Rn = (e) => ({
|
|
2587
2597
|
domain: e >> 32n,
|
|
2588
2598
|
sample: e & 4294967295n
|
|
2589
2599
|
});
|
|
@@ -2596,10 +2606,10 @@ t.enum([
|
|
|
2596
2606
|
"preciseDate",
|
|
2597
2607
|
"dateTime"
|
|
2598
2608
|
]), t.enum(["local", "UTC"]);
|
|
2599
|
-
var
|
|
2600
|
-
Breaker: () =>
|
|
2601
|
-
breakerConfigZ: () =>
|
|
2602
|
-
}),
|
|
2609
|
+
var zn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(e).milliseconds)), Bn = /* @__PURE__ */ r({
|
|
2610
|
+
Breaker: () => Vn,
|
|
2611
|
+
breakerConfigZ: () => Hn
|
|
2612
|
+
}), Vn = class {
|
|
2603
2613
|
config;
|
|
2604
2614
|
retries;
|
|
2605
2615
|
interval;
|
|
@@ -2608,7 +2618,7 @@ var Rn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(
|
|
|
2608
2618
|
baseInterval: new F(e?.baseInterval ?? F.seconds(1)),
|
|
2609
2619
|
maxRetries: e?.maxRetries ?? 5,
|
|
2610
2620
|
scale: e?.scale ?? 1,
|
|
2611
|
-
sleepFn: e?.sleepFn ??
|
|
2621
|
+
sleepFn: e?.sleepFn ?? zn
|
|
2612
2622
|
}, this.retries = 0, this.interval = new F(this.config.baseInterval);
|
|
2613
2623
|
}
|
|
2614
2624
|
async wait() {
|
|
@@ -2621,38 +2631,38 @@ var Rn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(
|
|
|
2621
2631
|
reset() {
|
|
2622
2632
|
this.retries = 0, this.interval = this.config.baseInterval;
|
|
2623
2633
|
}
|
|
2624
|
-
},
|
|
2634
|
+
}, Hn = t.object({
|
|
2625
2635
|
baseInterval: F.z.optional(),
|
|
2626
2636
|
maxRetries: t.number().optional(),
|
|
2627
2637
|
scale: t.number().optional()
|
|
2628
|
-
}),
|
|
2638
|
+
}), Un = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), J = yt, Wn = t.number().min(0).max(1), Gn = t.tuple([
|
|
2629
2639
|
J,
|
|
2630
2640
|
J,
|
|
2631
2641
|
J,
|
|
2632
|
-
|
|
2633
|
-
]),
|
|
2642
|
+
Wn
|
|
2643
|
+
]), Kn = t.tuple([
|
|
2634
2644
|
J,
|
|
2635
2645
|
J,
|
|
2636
2646
|
J
|
|
2637
|
-
]),
|
|
2647
|
+
]), qn = t.object({ rgba255: Gn }), Jn = t.object({
|
|
2638
2648
|
r: J,
|
|
2639
2649
|
g: J,
|
|
2640
2650
|
b: J,
|
|
2641
|
-
a:
|
|
2642
|
-
}),
|
|
2643
|
-
Jn,
|
|
2651
|
+
a: Wn
|
|
2652
|
+
}), Yn = t.number().min(0).max(360), Xn = t.number().min(0).max(100), Zn = t.number().min(0).max(100), Qn = t.tuple([
|
|
2644
2653
|
Yn,
|
|
2645
2654
|
Xn,
|
|
2646
|
-
Un
|
|
2647
|
-
]), Qn = t.union([
|
|
2648
|
-
Hn,
|
|
2649
|
-
Gn,
|
|
2650
|
-
Wn,
|
|
2651
2655
|
Zn,
|
|
2656
|
+
Wn
|
|
2657
|
+
]), $n = t.union([
|
|
2658
|
+
Un,
|
|
2652
2659
|
Kn,
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2660
|
+
Gn,
|
|
2661
|
+
Qn,
|
|
2662
|
+
qn,
|
|
2663
|
+
Jn
|
|
2664
|
+
]), er = $n.transform((e) => tr(e)), tr = (e, t = 1) => {
|
|
2665
|
+
if (e = $n.parse(e), typeof e == "string") return nr(e, t);
|
|
2656
2666
|
if (Array.isArray(e)) {
|
|
2657
2667
|
if (e.length < 3 || e.length > 4) throw Error(`Invalid color: [${e.join(", ")}]`);
|
|
2658
2668
|
return e.length === 3 ? [...e, t] : e;
|
|
@@ -2663,34 +2673,34 @@ var Rn = async (e) => await new Promise((t) => setTimeout(t, F.fromMilliseconds(
|
|
|
2663
2673
|
e.b,
|
|
2664
2674
|
e.a
|
|
2665
2675
|
] : e.rgba255;
|
|
2666
|
-
},
|
|
2676
|
+
}, nr = (e, t = 1) => (e = Un.parse(e), e = rr(e), [
|
|
2667
2677
|
Y(e, 0),
|
|
2668
2678
|
Y(e, 2),
|
|
2669
2679
|
Y(e, 4),
|
|
2670
2680
|
e.length === 8 ? Y(e, 6) / 255 : t
|
|
2671
|
-
]), Y = (e, t) => parseInt(e.slice(t, t + 2), 16),
|
|
2672
|
-
|
|
2673
|
-
var
|
|
2681
|
+
]), Y = (e, t) => parseInt(e.slice(t, t + 2), 16), rr = (e) => e.startsWith("#") ? e.slice(1) : e;
|
|
2682
|
+
tr("#000000"), tr("#ffffff");
|
|
2683
|
+
var ir = t.object({
|
|
2674
2684
|
key: t.string(),
|
|
2675
|
-
color:
|
|
2685
|
+
color: $n,
|
|
2676
2686
|
position: t.number(),
|
|
2677
2687
|
switched: t.boolean().optional()
|
|
2678
2688
|
});
|
|
2679
|
-
t.array(
|
|
2680
|
-
var
|
|
2689
|
+
t.array(ir);
|
|
2690
|
+
var ar = t.object({
|
|
2681
2691
|
key: t.string(),
|
|
2682
2692
|
name: t.string(),
|
|
2683
|
-
color:
|
|
2693
|
+
color: er
|
|
2684
2694
|
});
|
|
2685
2695
|
t.object({
|
|
2686
2696
|
key: t.string(),
|
|
2687
2697
|
name: t.string(),
|
|
2688
|
-
swatches: t.array(
|
|
2698
|
+
swatches: t.array(ar)
|
|
2689
2699
|
});
|
|
2690
|
-
var
|
|
2700
|
+
var or = /* @__PURE__ */ function(e) {
|
|
2691
2701
|
return e[e.exclusive = 0] = "exclusive", e[e.shared = 1] = "shared", e;
|
|
2692
2702
|
}({});
|
|
2693
|
-
t.enum(
|
|
2703
|
+
t.enum(or), t.object({
|
|
2694
2704
|
key: t.string(),
|
|
2695
2705
|
name: t.string(),
|
|
2696
2706
|
group: t.uint32().optional()
|
|
@@ -2708,39 +2718,39 @@ t.enum(ar), t.object({
|
|
|
2708
2718
|
key: t.string(),
|
|
2709
2719
|
value: t.string()
|
|
2710
2720
|
});
|
|
2711
|
-
var
|
|
2721
|
+
var sr = t.uuid();
|
|
2712
2722
|
t.object({
|
|
2713
|
-
key:
|
|
2723
|
+
key: sr,
|
|
2714
2724
|
name: t.string().min(1),
|
|
2715
|
-
color:
|
|
2725
|
+
color: er
|
|
2716
2726
|
}).partial({ key: !0 }), t.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), t.enum([
|
|
2717
2727
|
"standard",
|
|
2718
2728
|
"scientific",
|
|
2719
2729
|
"engineering"
|
|
2720
2730
|
]);
|
|
2721
|
-
var
|
|
2731
|
+
var cr = t.union([t.string(), t.number()]), lr = () => t.record(cr, t.unknown());
|
|
2722
2732
|
typeof process < "u" && process.versions != null && process.versions.node != null || typeof window > "u" || window.document;
|
|
2723
|
-
var
|
|
2733
|
+
var ur = [
|
|
2724
2734
|
"macOS",
|
|
2725
2735
|
"Windows",
|
|
2726
2736
|
"Linux"
|
|
2727
|
-
],
|
|
2737
|
+
], dr = [
|
|
2728
2738
|
"macos",
|
|
2729
2739
|
"windows",
|
|
2730
2740
|
"linux"
|
|
2731
|
-
],
|
|
2741
|
+
], fr = {
|
|
2732
2742
|
macos: "macOS",
|
|
2733
2743
|
windows: "Windows",
|
|
2734
2744
|
linux: "Linux"
|
|
2735
2745
|
};
|
|
2736
|
-
t.enum(
|
|
2746
|
+
t.enum(ur).or(t.enum(dr).transform((e) => fr[e])), t.object({
|
|
2737
2747
|
message: t.string().optional(),
|
|
2738
2748
|
description: t.string().optional(),
|
|
2739
|
-
details:
|
|
2749
|
+
details: lr().optional()
|
|
2740
2750
|
}), t.object({
|
|
2741
2751
|
stack: t.string(),
|
|
2742
2752
|
error: t.instanceof(Error)
|
|
2743
|
-
}).and(
|
|
2753
|
+
}).and(lr()), t.enum([
|
|
2744
2754
|
"success",
|
|
2745
2755
|
"info",
|
|
2746
2756
|
"warning",
|
|
@@ -2766,13 +2776,13 @@ t.enum(lr).or(t.enum(ur).transform((e) => dr[e])), t.object({
|
|
|
2766
2776
|
lineHeight: t.number(),
|
|
2767
2777
|
textTransform: t.string().optional()
|
|
2768
2778
|
});
|
|
2769
|
-
var
|
|
2779
|
+
var pr = (...e) => e.map(mr).join(""), mr = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), hr = (e) => e.endsWith("/") ? e.slice(0, -1) : e, gr = (e, t = "") => e === null ? "" : `?${Object.entries(e).filter(([, e]) => e == null ? !1 : Array.isArray(e) ? e.length > 0 : !0).map(([e, n]) => `${t}${e}=${n}`).join("&")}`, _r = class e {
|
|
2770
2780
|
protocol;
|
|
2771
2781
|
host;
|
|
2772
2782
|
port;
|
|
2773
2783
|
path;
|
|
2774
2784
|
constructor({ host: e, port: t, protocol: n = "", pathPrefix: r = "" }) {
|
|
2775
|
-
this.protocol = n, this.host = e, this.port = t, this.path =
|
|
2785
|
+
this.protocol = n, this.host = e, this.port = t, this.path = mr(r);
|
|
2776
2786
|
}
|
|
2777
2787
|
replace(t) {
|
|
2778
2788
|
return new e({
|
|
@@ -2785,11 +2795,11 @@ var fr = (...e) => e.map(pr).join(""), pr = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2785
2795
|
child(t) {
|
|
2786
2796
|
return new e({
|
|
2787
2797
|
...this,
|
|
2788
|
-
pathPrefix:
|
|
2798
|
+
pathPrefix: pr(this.path, t)
|
|
2789
2799
|
});
|
|
2790
2800
|
}
|
|
2791
2801
|
toString() {
|
|
2792
|
-
return
|
|
2802
|
+
return hr(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
|
|
2793
2803
|
}
|
|
2794
2804
|
static UNKNOWN = new e({
|
|
2795
2805
|
host: "unknown",
|
|
@@ -2806,8 +2816,8 @@ var fr = (...e) => e.map(pr).join(""), pr = (e) => (e.endsWith("/") || (e += "/"
|
|
|
2806
2816
|
}, $ = class extends X.sub("unreachable") {
|
|
2807
2817
|
url;
|
|
2808
2818
|
constructor(e = {}) {
|
|
2809
|
-
let { message: t = "Unreachable", url: n =
|
|
2810
|
-
super(t), this.url = n;
|
|
2819
|
+
let { message: t = "Unreachable", url: n = _r.UNKNOWN, cause: r } = e;
|
|
2820
|
+
super(t, r === void 0 ? void 0 : { cause: r }), this.url = n;
|
|
2811
2821
|
}
|
|
2812
2822
|
};
|
|
2813
2823
|
v.register({
|
|
@@ -2839,7 +2849,7 @@ v.register({
|
|
|
2839
2849
|
});
|
|
2840
2850
|
//#endregion
|
|
2841
2851
|
//#region src/middleware.ts
|
|
2842
|
-
var
|
|
2852
|
+
var vr = class {
|
|
2843
2853
|
middleware = [];
|
|
2844
2854
|
use(...e) {
|
|
2845
2855
|
this.middleware.push(...e);
|
|
@@ -2852,29 +2862,29 @@ var _r = class {
|
|
|
2852
2862
|
};
|
|
2853
2863
|
return await r(e);
|
|
2854
2864
|
}
|
|
2855
|
-
},
|
|
2865
|
+
}, yr = "Content-Type", br = new Set([
|
|
2856
2866
|
"ECONNREFUSED",
|
|
2857
2867
|
"ECONNRESET",
|
|
2858
2868
|
"ETIMEDOUT",
|
|
2859
2869
|
"EPIPE",
|
|
2860
2870
|
"UND_ERR_CONNECT_TIMEOUT",
|
|
2861
2871
|
"UND_ERR_SOCKET"
|
|
2862
|
-
]),
|
|
2872
|
+
]), xr = (e) => {
|
|
2863
2873
|
let t = e?.cause?.code ?? e?.code ?? e?.errno;
|
|
2864
|
-
if (typeof t == "string" &&
|
|
2874
|
+
if (typeof t == "string" && br.has(t)) return !0;
|
|
2865
2875
|
if (e.name === "TypeError") {
|
|
2866
2876
|
let t = String(e.message || "").toLowerCase();
|
|
2867
2877
|
if (/load failed|failed to fetch|networkerror|network error/.test(t)) return typeof navigator < "u" && navigator.onLine, !0;
|
|
2868
2878
|
}
|
|
2869
2879
|
return e?.name === "AbortError" || e?.code, !1;
|
|
2870
|
-
},
|
|
2880
|
+
}, Sr = 400, Cr = class extends vr {
|
|
2871
2881
|
endpoint;
|
|
2872
2882
|
encoder;
|
|
2873
2883
|
constructor(e, t, n = !1) {
|
|
2874
2884
|
return super(), this.endpoint = e.replace({ protocol: n ? "https" : "http" }), this.encoder = t, new Proxy(this, { get: (e, t, n) => t === "endpoint" ? this.endpoint : Reflect.get(e, t, n) });
|
|
2875
2885
|
}
|
|
2876
2886
|
get headers() {
|
|
2877
|
-
return { [
|
|
2887
|
+
return { [yr]: this.encoder.contentType };
|
|
2878
2888
|
}
|
|
2879
2889
|
async send(e, t, n, r) {
|
|
2880
2890
|
let i = null, a = this.endpoint.child(e), o = {};
|
|
@@ -2896,22 +2906,27 @@ var _r = class {
|
|
|
2896
2906
|
try {
|
|
2897
2907
|
n = await fetch(e.target, o);
|
|
2898
2908
|
} catch (e) {
|
|
2899
|
-
|
|
2909
|
+
let t = v.fromUnknown(e);
|
|
2910
|
+
throw xr(t) ? new $({
|
|
2911
|
+
url: a,
|
|
2912
|
+
cause: t
|
|
2913
|
+
}) : t;
|
|
2900
2914
|
}
|
|
2901
2915
|
let s = await n.arrayBuffer();
|
|
2902
2916
|
if (n?.ok) return r != null && (i = this.encoder.decode(s, r)), t;
|
|
2903
|
-
if (n.status !==
|
|
2917
|
+
if (n.status !== Sr) throw Error(`[freighter] HTTP ${n.status} from ${e.target}: ${n.statusText}`);
|
|
2904
2918
|
let c;
|
|
2905
2919
|
try {
|
|
2906
2920
|
c = v.decode(this.encoder.decode(s, v.payloadZ));
|
|
2907
2921
|
} catch (e) {
|
|
2908
|
-
|
|
2922
|
+
let t = v.fromUnknown(e);
|
|
2923
|
+
throw Error(`[freighter] - failed to decode error: ${n.statusText}: ${t.message}`, { cause: e });
|
|
2909
2924
|
}
|
|
2910
|
-
throw c ?? Error(n.statusText);
|
|
2925
|
+
throw c ?? /* @__PURE__ */ Error(`[freighter] HTTP ${n.status} from ${e.target}: ${n.statusText}`);
|
|
2911
2926
|
}), i == null) throw Error("Response must be defined");
|
|
2912
2927
|
return i;
|
|
2913
2928
|
}
|
|
2914
|
-
},
|
|
2929
|
+
}, wr = (e, t) => {
|
|
2915
2930
|
class n {
|
|
2916
2931
|
wrapped;
|
|
2917
2932
|
constructor(e) {
|
|
@@ -2921,18 +2936,19 @@ var _r = class {
|
|
|
2921
2936
|
this.wrapped.use(...e);
|
|
2922
2937
|
}
|
|
2923
2938
|
async send(e, n, r, i) {
|
|
2924
|
-
let a = new
|
|
2939
|
+
let a = new Bn.Breaker(t);
|
|
2925
2940
|
do
|
|
2926
2941
|
try {
|
|
2927
2942
|
return await this.wrapped.send(e, n, r, i);
|
|
2928
2943
|
} catch (e) {
|
|
2929
|
-
|
|
2944
|
+
let t = v.fromUnknown(e);
|
|
2945
|
+
if (!$.matches(t) || (console.warn(`[freighter] ${a.retryMessage}`, t), !await a.wait())) throw t;
|
|
2930
2946
|
}
|
|
2931
2947
|
while (!0);
|
|
2932
2948
|
}
|
|
2933
2949
|
}
|
|
2934
2950
|
return new n(e);
|
|
2935
|
-
},
|
|
2951
|
+
}, Tr = t.object({
|
|
2936
2952
|
type: t.enum([
|
|
2937
2953
|
"data",
|
|
2938
2954
|
"close",
|
|
@@ -2940,7 +2956,7 @@ var _r = class {
|
|
|
2940
2956
|
]),
|
|
2941
2957
|
payload: t.unknown(),
|
|
2942
2958
|
error: t.optional(v.payloadZ)
|
|
2943
|
-
}),
|
|
2959
|
+
}), Er = class {
|
|
2944
2960
|
codec;
|
|
2945
2961
|
reqSchema;
|
|
2946
2962
|
resSchema;
|
|
@@ -2996,18 +3012,18 @@ var _r = class {
|
|
|
2996
3012
|
this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
|
|
2997
3013
|
}
|
|
2998
3014
|
onMessage(e) {
|
|
2999
|
-
this.addMessage(this.codec.decode(e.data,
|
|
3015
|
+
this.addMessage(this.codec.decode(e.data, Tr));
|
|
3000
3016
|
}
|
|
3001
3017
|
onClose(e) {
|
|
3002
3018
|
this.addMessage({
|
|
3003
3019
|
type: "close",
|
|
3004
3020
|
error: {
|
|
3005
|
-
type: e.code ===
|
|
3021
|
+
type: e.code === Or ? Z.TYPE : Q.TYPE,
|
|
3006
3022
|
data: ""
|
|
3007
3023
|
}
|
|
3008
3024
|
});
|
|
3009
3025
|
}
|
|
3010
|
-
},
|
|
3026
|
+
}, Dr = "freighterctx", Or = 1e3, kr = class e extends vr {
|
|
3011
3027
|
baseUrl;
|
|
3012
3028
|
encoder;
|
|
3013
3029
|
secure;
|
|
@@ -3035,22 +3051,23 @@ var _r = class {
|
|
|
3035
3051
|
}), i;
|
|
3036
3052
|
}
|
|
3037
3053
|
buildURL(e, t) {
|
|
3038
|
-
let n =
|
|
3039
|
-
[
|
|
3054
|
+
let n = gr({
|
|
3055
|
+
[yr]: this.encoder.contentType,
|
|
3040
3056
|
...t.params
|
|
3041
|
-
},
|
|
3057
|
+
}, Dr);
|
|
3042
3058
|
return this.baseUrl.child(e).toString() + n;
|
|
3043
3059
|
}
|
|
3044
3060
|
async wrapSocket(e, t, n) {
|
|
3045
3061
|
return await new Promise((r, i) => {
|
|
3046
3062
|
e.onopen = () => {
|
|
3047
|
-
let a = new
|
|
3048
|
-
a.receiveOpenAck().then(() => r(a)).catch((e) => i(e));
|
|
3063
|
+
let a = new Er(e, this.encoder, t, n);
|
|
3064
|
+
a.receiveOpenAck().then(() => r(a)).catch((e) => i(v.fromUnknown(e)));
|
|
3049
3065
|
}, e.onerror = (e) => {
|
|
3050
|
-
|
|
3066
|
+
let t = e;
|
|
3067
|
+
i(Error(t.message ?? "websocket error", { cause: t.error ?? e }));
|
|
3051
3068
|
};
|
|
3052
3069
|
});
|
|
3053
3070
|
}
|
|
3054
3071
|
};
|
|
3055
3072
|
//#endregion
|
|
3056
|
-
export { Z as EOF,
|
|
3073
|
+
export { Z as EOF, Cr as HTTPClient, Q as StreamClosed, $ as Unreachable, kr as WebSocketClient, wr as unaryWithBreaker };
|