@viji-dev/core 0.8.6 → 0.8.8
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/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +1 -1
- package/dist/artist-global.d.ts +1 -1
- package/dist/assets/{viji.worker-CydIeq-k.js → viji.worker-ChptZ-zo.js} +740 -715
- package/dist/docs-api.js +2 -2
- package/dist/{essentia-wasm.web-CaXce3AA.js → essentia-wasm.web-BqymfxZb.js} +2 -2
- package/dist/{index-BQtrhfjg.js → index-DSMvbzzU.js} +37 -24
- package/dist/index.d.ts +23 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -24,14 +24,14 @@ function Sn(t) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function fi(t) {
|
|
27
|
-
const { r: e, g: n, b: r } = Sn(t), i = e / 255, o = n / 255, c = r / 255, u = Math.max(i, o, c),
|
|
27
|
+
const { r: e, g: n, b: r } = Sn(t), i = e / 255, o = n / 255, c = r / 255, u = Math.max(i, o, c), h = Math.min(i, o, c), f = u - h;
|
|
28
28
|
let m = 0;
|
|
29
|
-
|
|
30
|
-
const g = u === 0 ? 0 :
|
|
29
|
+
f > 0 && (u === i ? m = (o - c) / f % 6 : u === o ? m = (c - i) / f + 2 : m = (i - o) / f + 4, m *= 60, m < 0 && (m += 360));
|
|
30
|
+
const g = u === 0 ? 0 : f / u * 100, v = u * 100;
|
|
31
31
|
return {
|
|
32
32
|
h: Xr(m, 4),
|
|
33
33
|
s: Xr(g, 4),
|
|
34
|
-
b: Xr(
|
|
34
|
+
b: Xr(v, 4)
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function kc(t) {
|
|
@@ -49,14 +49,14 @@ function co(t, e, n) {
|
|
|
49
49
|
throw new Error(`HSB saturation must be 0..100, got: ${e}`);
|
|
50
50
|
if (n < 0 || n > 100)
|
|
51
51
|
throw new Error(`HSB brightness must be 0..100, got: ${n}`);
|
|
52
|
-
const r = (t % 360 + 360) % 360, i = e / 100, o = n / 100, c = o * i, u = r / 60,
|
|
53
|
-
let
|
|
54
|
-
u < 1 ? (
|
|
55
|
-
const
|
|
52
|
+
const r = (t % 360 + 360) % 360, i = e / 100, o = n / 100, c = o * i, u = r / 60, h = c * (1 - Math.abs(u % 2 - 1));
|
|
53
|
+
let f = 0, m = 0, g = 0;
|
|
54
|
+
u < 1 ? (f = c, m = h, g = 0) : u < 2 ? (f = h, m = c, g = 0) : u < 3 ? (f = 0, m = c, g = h) : u < 4 ? (f = 0, m = h, g = c) : u < 5 ? (f = h, m = 0, g = c) : (f = c, m = 0, g = h);
|
|
55
|
+
const v = o - c;
|
|
56
56
|
return cn(
|
|
57
|
-
Math.round((
|
|
58
|
-
Math.round((m +
|
|
59
|
-
Math.round((g +
|
|
57
|
+
Math.round((f + v) * 255),
|
|
58
|
+
Math.round((m + v) * 255),
|
|
59
|
+
Math.round((g + v) * 255)
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
function vc(t) {
|
|
@@ -94,28 +94,28 @@ function Ec(t) {
|
|
|
94
94
|
const e = $n(t);
|
|
95
95
|
if (e.length !== 3)
|
|
96
96
|
throw new Error(`rgb() requires 3 arguments, got ${e.length}: rgb(${t})`);
|
|
97
|
-
const n =
|
|
97
|
+
const n = Ge(e[0], "r"), r = Ge(e[1], "g"), i = Ge(e[2], "b");
|
|
98
98
|
return cn(n, r, i);
|
|
99
99
|
}
|
|
100
100
|
function Tc(t) {
|
|
101
101
|
const e = $n(t);
|
|
102
102
|
if (e.length !== 3)
|
|
103
103
|
throw new Error(`hsl() requires 3 arguments, got ${e.length}: hsl(${t})`);
|
|
104
|
-
const n =
|
|
104
|
+
const n = Ge(e[0], "h"), r = di(e[1], "s"), i = di(e[2], "l");
|
|
105
105
|
return Rc(n, r, i);
|
|
106
106
|
}
|
|
107
107
|
function Sc(t) {
|
|
108
108
|
const e = $n(t);
|
|
109
109
|
if (e.length !== 3)
|
|
110
110
|
throw new Error(`hsb() requires 3 arguments, got ${e.length}: hsb(${t})`);
|
|
111
|
-
const n =
|
|
111
|
+
const n = Ge(e[0], "h"), r = Ge(e[1], "s"), i = Ge(e[2], "b");
|
|
112
112
|
return co(n, r, i);
|
|
113
113
|
}
|
|
114
114
|
function xc(t) {
|
|
115
115
|
const e = $n(t);
|
|
116
116
|
if (e.length !== 3)
|
|
117
117
|
throw new Error(`vec3() requires 3 arguments, got ${e.length}: vec3(${t})`);
|
|
118
|
-
const n =
|
|
118
|
+
const n = Ge(e[0], "r"), r = Ge(e[1], "g"), i = Ge(e[2], "b");
|
|
119
119
|
if (n < 0 || n > 1 || r < 0 || r > 1 || i < 0 || i > 1)
|
|
120
120
|
throw new Error(`vec3() components must be in 0..1, got: vec3(${n}, ${r}, ${i})`);
|
|
121
121
|
return cn(
|
|
@@ -137,20 +137,20 @@ function Rc(t, e, n) {
|
|
|
137
137
|
throw new Error(`HSL saturation must be 0..100%, got: ${e}%`);
|
|
138
138
|
if (n < 0 || n > 100)
|
|
139
139
|
throw new Error(`HSL lightness must be 0..100%, got: ${n}%`);
|
|
140
|
-
const r = (t % 360 + 360) % 360, i = e / 100, o = n / 100, c = (1 - Math.abs(2 * o - 1)) * i, u = r / 60,
|
|
141
|
-
let
|
|
142
|
-
u < 1 ? (
|
|
143
|
-
const
|
|
140
|
+
const r = (t % 360 + 360) % 360, i = e / 100, o = n / 100, c = (1 - Math.abs(2 * o - 1)) * i, u = r / 60, h = c * (1 - Math.abs(u % 2 - 1));
|
|
141
|
+
let f = 0, m = 0, g = 0;
|
|
142
|
+
u < 1 ? (f = c, m = h, g = 0) : u < 2 ? (f = h, m = c, g = 0) : u < 3 ? (f = 0, m = c, g = h) : u < 4 ? (f = 0, m = h, g = c) : u < 5 ? (f = h, m = 0, g = c) : (f = c, m = 0, g = h);
|
|
143
|
+
const v = o - c / 2;
|
|
144
144
|
return cn(
|
|
145
|
-
Math.round((
|
|
146
|
-
Math.round((m +
|
|
147
|
-
Math.round((g +
|
|
145
|
+
Math.round((f + v) * 255),
|
|
146
|
+
Math.round((m + v) * 255),
|
|
147
|
+
Math.round((g + v) * 255)
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
function $n(t) {
|
|
151
151
|
return t.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Ge(t, e) {
|
|
154
154
|
const n = parseFloat(t);
|
|
155
155
|
if (!isFinite(n))
|
|
156
156
|
throw new Error(`Invalid number for '${e}': '${t}'`);
|
|
@@ -159,7 +159,7 @@ function He(t, e) {
|
|
|
159
159
|
function di(t, e) {
|
|
160
160
|
if (!t.endsWith("%"))
|
|
161
161
|
throw new Error(`Field '${e}' must use percent notation (e.g., 50%), got: '${t}'`);
|
|
162
|
-
return
|
|
162
|
+
return Ge(t.slice(0, -1), e);
|
|
163
163
|
}
|
|
164
164
|
function Mt(t, e) {
|
|
165
165
|
if (typeof t != "number" || !isFinite(t))
|
|
@@ -411,8 +411,8 @@ class Cc {
|
|
|
411
411
|
if (r.type === "color")
|
|
412
412
|
try {
|
|
413
413
|
n = as(n);
|
|
414
|
-
} catch (
|
|
415
|
-
return console.error(`Parameter '${e}' invalid color: ${
|
|
414
|
+
} catch (h) {
|
|
415
|
+
return console.error(`Parameter '${e}' invalid color: ${h.message}`), !1;
|
|
416
416
|
}
|
|
417
417
|
if (!this.validateParameterValue(e, n, r))
|
|
418
418
|
return console.warn(`Validation failed for parameter ${e} = ${n}`), !1;
|
|
@@ -422,8 +422,8 @@ class Cc {
|
|
|
422
422
|
this.parameterValues.set(e, n);
|
|
423
423
|
const u = this.parameterObjects.get(e);
|
|
424
424
|
if (u && (u.value = n, r.type === "color")) {
|
|
425
|
-
const
|
|
426
|
-
u.rgb = Object.freeze(Sn(
|
|
425
|
+
const h = n;
|
|
426
|
+
u.rgb = Object.freeze(Sn(h)), u.hsb = Object.freeze(fi(h));
|
|
427
427
|
}
|
|
428
428
|
return !0;
|
|
429
429
|
}
|
|
@@ -515,6 +515,26 @@ class Cc {
|
|
|
515
515
|
markInitialValuesSynced() {
|
|
516
516
|
this.initialValuesSynced = !0;
|
|
517
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Seed host-supplied initial parameter values before the first frame. Called
|
|
520
|
+
* from `setSceneCode` after all parameters are defined (at their defaults) and
|
|
521
|
+
* before the first render. Names the scene did not define are skipped quietly
|
|
522
|
+
* (a removed-parameter stored value is expected, not an error). Known names go
|
|
523
|
+
* through `updateParameterValue`, reusing its validation and value/object
|
|
524
|
+
* dual-write; per-value failures are tolerated so one bad stored value cannot
|
|
525
|
+
* abort the seed. Marks the initial sync, so this is the canonical initial
|
|
526
|
+
* sync (the host's post-paint batch becomes redundant).
|
|
527
|
+
*/
|
|
528
|
+
seedInitialValues(e) {
|
|
529
|
+
for (const [n, r] of Object.entries(e)) {
|
|
530
|
+
if (!this.parameterDefinitions.has(n)) {
|
|
531
|
+
this.debugLog(`Skipping initial value for undefined parameter: ${n}`);
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
this.updateParameterValue(n, r);
|
|
535
|
+
}
|
|
536
|
+
this.markInitialValuesSynced();
|
|
537
|
+
}
|
|
518
538
|
// Get parameter count for performance reporting
|
|
519
539
|
getParameterCount() {
|
|
520
540
|
return this.parameterDefinitions.size;
|
|
@@ -691,12 +711,12 @@ class Lc {
|
|
|
691
711
|
if (!this.isEnabled) return;
|
|
692
712
|
const n = e.touches.map((o) => {
|
|
693
713
|
const c = o.identifier, u = !!o.ended;
|
|
694
|
-
let
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
697
|
-
|
|
698
|
-
const
|
|
699
|
-
|
|
714
|
+
let h = 0, f = 0, m = 0, g = 0;
|
|
715
|
+
const v = this.previousTouchPositions.get(c);
|
|
716
|
+
if (v) {
|
|
717
|
+
h = o.clientX - v.x, f = o.clientY - v.y;
|
|
718
|
+
const w = (e.timestamp - v.timestamp) / 1e3;
|
|
719
|
+
w > 0 && (m = h / w, g = f / w);
|
|
700
720
|
}
|
|
701
721
|
return u ? this.previousTouchPositions.delete(c) : this.previousTouchPositions.set(c, {
|
|
702
722
|
x: o.clientX,
|
|
@@ -713,10 +733,10 @@ class Lc {
|
|
|
713
733
|
rotationAngle: o.rotationAngle,
|
|
714
734
|
force: o.force,
|
|
715
735
|
isInCanvas: o.isInCanvas,
|
|
716
|
-
deltaX:
|
|
717
|
-
deltaY:
|
|
736
|
+
deltaX: h,
|
|
737
|
+
deltaY: f,
|
|
718
738
|
velocity: { x: m, y: g },
|
|
719
|
-
isNew: e.type === "touchstart" && !
|
|
739
|
+
isNew: e.type === "touchstart" && !v,
|
|
720
740
|
isActive: !u,
|
|
721
741
|
isEnding: u
|
|
722
742
|
};
|
|
@@ -2027,16 +2047,16 @@ class Dc {
|
|
|
2027
2047
|
if (!this.cvWorker)
|
|
2028
2048
|
return o(new Error("CV worker not initialized"));
|
|
2029
2049
|
const c = this.nextRequestId++, u = this.cvWorker;
|
|
2030
|
-
let
|
|
2050
|
+
let h = null;
|
|
2031
2051
|
this.pendingRequestIds.add(c);
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
}, m = (
|
|
2035
|
-
const
|
|
2036
|
-
|
|
2052
|
+
const f = () => {
|
|
2053
|
+
h !== null && (clearTimeout(h), h = null), u.removeEventListener("message", m), this.pendingRequestIds.delete(c);
|
|
2054
|
+
}, m = (v) => {
|
|
2055
|
+
const w = v.data;
|
|
2056
|
+
w.type !== "result" || w.requestId !== c || (f(), w.success ? (this.debugLog(`✅ [CV Worker] response for ${e}#${c}`, w.data), i(w.data)) : (this.debugLog(`❌ [CV Worker] error response for ${e}#${c}`, w.error), w.restartRequired && this.handleWorkerFailure(`Worker reported restart required: ${w.error}`), o(new Error(w.error || "CV worker error"))));
|
|
2037
2057
|
};
|
|
2038
|
-
|
|
2039
|
-
this.debugLog(`⏱️ [CV Worker] timeout for ${e}#${c}`),
|
|
2058
|
+
h = setTimeout(() => {
|
|
2059
|
+
this.debugLog(`⏱️ [CV Worker] timeout for ${e}#${c}`), f(), e === "config" && this.handleWorkerFailure(`Timeout for ${e} message`), o(new Error(`CV worker timeout for ${e}`));
|
|
2040
2060
|
}, 5e3), u.addEventListener("message", m);
|
|
2041
2061
|
const g = { type: e, requestId: c, ...n };
|
|
2042
2062
|
this.debugLog(`📤 [CVSystem -> CV Worker] ${e}#${c}`, n), u.postMessage(g, r || []);
|
|
@@ -2245,10 +2265,10 @@ class Dc {
|
|
|
2245
2265
|
features: r
|
|
2246
2266
|
}, [e]), c = new Promise((m, g) => {
|
|
2247
2267
|
n = setTimeout(() => g(new Error("CV processing timeout")), 500);
|
|
2248
|
-
}), u = await Promise.race([o, c]),
|
|
2249
|
-
|
|
2250
|
-
const
|
|
2251
|
-
this.processingTimes.push(
|
|
2268
|
+
}), u = await Promise.race([o, c]), h = u;
|
|
2269
|
+
h.frame instanceof ImageBitmap && this.acceptAnalysedFrame(h.frame), "faces" in u && (this.activeFeatures.has("faceDetection") || this.activeFeatures.has("faceMesh") || this.activeFeatures.has("emotionDetection")) && (this.results.faces = u.faces, this.debugLog(`📥 Received ${u.faces.length} face results`)), "hands" in u && this.activeFeatures.has("handTracking") && (this.results.hands = u.hands, this.debugLog(`📥 Received ${u.hands.length} hand results`)), "pose" in u && this.activeFeatures.has("poseDetection") && (this.results.pose = u.pose, this.debugLog(`📥 Received pose results: ${u.pose ? u.pose.landmarks.length + " landmarks" : "none"}`)), "segmentation" in u && this.activeFeatures.has("bodySegmentation") && (this.results.segmentation = u.segmentation, this.debugLog(`📥 Received segmentation: ${u.segmentation ? u.segmentation.width + "x" + u.segmentation.height : "none"}`));
|
|
2270
|
+
const f = performance.now() - this.processingStartTime;
|
|
2271
|
+
this.processingTimes.push(f), this.processingTimes.length > 30 && this.processingTimes.shift();
|
|
2252
2272
|
for (const m of r) this.firstInferenceDone.add(m);
|
|
2253
2273
|
} catch (r) {
|
|
2254
2274
|
this.debugLog("⚠️ CV processing failed:", r);
|
|
@@ -2465,12 +2485,12 @@ class Dc {
|
|
|
2465
2485
|
* names (emotionDetection -> emotion, bodySegmentation -> segmentation).
|
|
2466
2486
|
*/
|
|
2467
2487
|
getCVActivity() {
|
|
2468
|
-
const e = this.results.faces.length > 0, n = this.results.hands.length > 0, r = this.results.pose !== null, i = this.results.segmentation !== null, o = (
|
|
2488
|
+
const e = this.results.faces.length > 0, n = this.results.hands.length > 0, r = this.results.pose !== null, i = this.results.segmentation !== null, o = (v) => this.activeFeatures.has(v) && this.firstInferenceDone.has(v), c = o("faceDetection"), u = o("faceMesh"), h = o("emotionDetection"), f = o("handTracking"), m = o("poseDetection"), g = o("bodySegmentation");
|
|
2469
2489
|
return {
|
|
2470
2490
|
faceDetection: { active: c, meaningful: c && e },
|
|
2471
2491
|
faceMesh: { active: u, meaningful: u && e },
|
|
2472
|
-
emotion: { active:
|
|
2473
|
-
handTracking: { active:
|
|
2492
|
+
emotion: { active: h, meaningful: h && e },
|
|
2493
|
+
handTracking: { active: f, meaningful: f && n },
|
|
2474
2494
|
poseDetection: { active: m, meaningful: m && r },
|
|
2475
2495
|
segmentation: { active: g, meaningful: g && i }
|
|
2476
2496
|
};
|
|
@@ -2996,9 +3016,9 @@ class Uc {
|
|
|
2996
3016
|
}
|
|
2997
3017
|
tally(e) {
|
|
2998
3018
|
const n = this.counts;
|
|
2999
|
-
|
|
3019
|
+
Ke(n.audio, e.audio), Ke(n.video, e.video), Ke(n.mouse, e.mouse), Ke(n.keyboard, e.keyboard), Ke(n.pointer, e.pointer), Ke(n.touch, e.touch), Ke(n.sensors, e.sensors), Ke(n.devices, e.devices);
|
|
3000
3020
|
for (const r of pi)
|
|
3001
|
-
|
|
3021
|
+
Ke(n.cv[r].active, e.cv[r].active), Ke(n.cv[r].meaningful, e.cv[r].meaningful);
|
|
3002
3022
|
}
|
|
3003
3023
|
emitEdges(e, n, r) {
|
|
3004
3024
|
if (!this.onTransition) return;
|
|
@@ -3012,17 +3032,17 @@ class Uc {
|
|
|
3012
3032
|
["sensors", e.sensors, i ? i.sensors : !1],
|
|
3013
3033
|
["devices", e.devices, i ? i.devices : !1]
|
|
3014
3034
|
];
|
|
3015
|
-
for (const [c, u,
|
|
3016
|
-
u !==
|
|
3035
|
+
for (const [c, u, h] of o)
|
|
3036
|
+
u !== h && this.onTransition({ capability: c, active: u, frameIndex: n, timestamp: r });
|
|
3017
3037
|
for (const c of pi) {
|
|
3018
|
-
const u = e.cv[c].active,
|
|
3019
|
-
u !==
|
|
3020
|
-
const
|
|
3021
|
-
|
|
3038
|
+
const u = e.cv[c].active, h = i ? i.cv[c].active : !1;
|
|
3039
|
+
u !== h && this.onTransition({ capability: "cv", cvType: c, level: "active", active: u, frameIndex: n, timestamp: r });
|
|
3040
|
+
const f = e.cv[c].meaningful, m = i ? i.cv[c].meaningful : !1;
|
|
3041
|
+
f !== m && this.onTransition({ capability: "cv", cvType: c, level: "meaningful", active: f, frameIndex: n, timestamp: r });
|
|
3022
3042
|
}
|
|
3023
3043
|
}
|
|
3024
3044
|
}
|
|
3025
|
-
function
|
|
3045
|
+
function Ke(t, e) {
|
|
3026
3046
|
e ? t.trueCount++ : t.falseCount++;
|
|
3027
3047
|
}
|
|
3028
3048
|
function gi(t, e) {
|
|
@@ -3365,16 +3385,16 @@ class bi {
|
|
|
3365
3385
|
for (const i of r) {
|
|
3366
3386
|
const o = i.trim(), c = o.match(/\/\/\s*@viji-(\w+):(\w+)\s+(.+)/);
|
|
3367
3387
|
if (c) {
|
|
3368
|
-
const [,
|
|
3388
|
+
const [, h, f, m] = c;
|
|
3369
3389
|
try {
|
|
3370
|
-
const g = this.parseKeyValuePairs(m),
|
|
3371
|
-
type:
|
|
3372
|
-
uniformName:
|
|
3373
|
-
label: g.label ||
|
|
3390
|
+
const g = this.parseKeyValuePairs(m), v = {
|
|
3391
|
+
type: h,
|
|
3392
|
+
uniformName: f,
|
|
3393
|
+
label: g.label || f,
|
|
3374
3394
|
default: g.default,
|
|
3375
3395
|
config: g
|
|
3376
3396
|
};
|
|
3377
|
-
this.validateParameter(
|
|
3397
|
+
this.validateParameter(v), n.push(v);
|
|
3378
3398
|
} catch (g) {
|
|
3379
3399
|
console.warn(`Failed to parse shader parameter: ${i}`, g);
|
|
3380
3400
|
}
|
|
@@ -3382,18 +3402,18 @@ class bi {
|
|
|
3382
3402
|
}
|
|
3383
3403
|
const u = o.match(/^\/\/\s*@viji-cv:(\w+)\s*$/);
|
|
3384
3404
|
if (u) {
|
|
3385
|
-
const [,
|
|
3405
|
+
const [, h] = u;
|
|
3386
3406
|
try {
|
|
3387
|
-
const
|
|
3407
|
+
const f = {
|
|
3388
3408
|
type: "cv",
|
|
3389
|
-
uniformName:
|
|
3390
|
-
label:
|
|
3409
|
+
uniformName: h,
|
|
3410
|
+
label: h,
|
|
3391
3411
|
default: void 0,
|
|
3392
3412
|
config: {}
|
|
3393
3413
|
};
|
|
3394
|
-
this.validateParameter(
|
|
3395
|
-
} catch (
|
|
3396
|
-
console.warn(`Failed to parse shader parameter: ${i}`,
|
|
3414
|
+
this.validateParameter(f), n.push(f);
|
|
3415
|
+
} catch (f) {
|
|
3416
|
+
console.warn(`Failed to parse shader parameter: ${i}`, f);
|
|
3397
3417
|
}
|
|
3398
3418
|
}
|
|
3399
3419
|
}
|
|
@@ -3716,27 +3736,27 @@ class De {
|
|
|
3716
3736
|
let n = "", r = e;
|
|
3717
3737
|
const i = e.split(`
|
|
3718
3738
|
`);
|
|
3719
|
-
for (let
|
|
3720
|
-
const D = i[
|
|
3739
|
+
for (let w = 0; w < i.length; w++) {
|
|
3740
|
+
const D = i[w].trim();
|
|
3721
3741
|
if (D.startsWith("#version")) {
|
|
3722
|
-
n = D, i[
|
|
3742
|
+
n = D, i[w] = "", r = i.join(`
|
|
3723
3743
|
`);
|
|
3724
3744
|
break;
|
|
3725
3745
|
}
|
|
3726
3746
|
}
|
|
3727
|
-
const o = this.findInjectionPoint(r), c = this.getBuiltInUniforms(), u = this.parameters.map((
|
|
3728
|
-
`),
|
|
3729
|
-
|
|
3730
|
-
const
|
|
3731
|
-
|
|
3732
|
-
const m =
|
|
3747
|
+
const o = this.findInjectionPoint(r), c = this.getBuiltInUniforms(), u = this.parameters.map((w) => bi.generateUniformDeclaration(w)).join(`
|
|
3748
|
+
`), h = e.includes("fwidth");
|
|
3749
|
+
h && this.glslVersion === "glsl100" && (this.gl.getExtension("OES_standard_derivatives") || console.warn("Shader uses fwidth() but OES_standard_derivatives extension is not supported. Shader may not compile."));
|
|
3750
|
+
const f = [];
|
|
3751
|
+
h && this.glslVersion === "glsl100" && f.push("#extension GL_OES_standard_derivatives : enable"), this.glslVersion === "glsl100" ? (f.push(""), f.push("#ifdef GL_ES"), f.push("precision mediump float;"), f.push("#endif")) : (f.push(""), f.push("precision mediump float;")), f.push(""), f.push("// ===== VIJI AUTO-INJECTED UNIFORMS ====="), f.push("// Built-in uniforms (auto-provided)"), f.push(c), f.push(""), f.push("// Parameter uniforms (from @viji-* declarations)"), f.push(u), f.push(""), f.push("// ===== ARTIST CODE =====");
|
|
3752
|
+
const m = f.join(`
|
|
3733
3753
|
`), g = r.slice(0, o) + `
|
|
3734
3754
|
` + m + `
|
|
3735
|
-
` + r.slice(o),
|
|
3755
|
+
` + r.slice(o), v = n ? n + `
|
|
3736
3756
|
` + g : g;
|
|
3737
|
-
return console.log("=== INJECTED SHADER CODE (first 50 lines) ==="), console.log(
|
|
3757
|
+
return console.log("=== INJECTED SHADER CODE (first 50 lines) ==="), console.log(v.split(`
|
|
3738
3758
|
`).slice(0, 50).join(`
|
|
3739
|
-
`)), console.log("=== END INJECTED CODE ==="),
|
|
3759
|
+
`)), console.log("=== END INJECTED CODE ==="), v;
|
|
3740
3760
|
}
|
|
3741
3761
|
/**
|
|
3742
3762
|
* Find where to inject extensions and uniforms
|
|
@@ -4205,8 +4225,8 @@ ${this.backbufferEnabled ? "uniform sampler2D backbuffer; // Previous frame text
|
|
|
4205
4225
|
if (!u)
|
|
4206
4226
|
throw new Error("Failed to create WebGL program");
|
|
4207
4227
|
if (r.attachShader(u, o), r.attachShader(u, c), r.linkProgram(u), !r.getProgramParameter(u, r.LINK_STATUS)) {
|
|
4208
|
-
const
|
|
4209
|
-
throw new Error(`Shader program link failed: ${
|
|
4228
|
+
const h = r.getProgramInfoLog(u);
|
|
4229
|
+
throw new Error(`Shader program link failed: ${h}`);
|
|
4210
4230
|
}
|
|
4211
4231
|
this.program = u, r.useProgram(u), r.deleteShader(o), r.deleteShader(c);
|
|
4212
4232
|
}
|
|
@@ -4224,17 +4244,17 @@ ${this.backbufferEnabled ? "uniform sampler2D backbuffer; // Previous frame text
|
|
|
4224
4244
|
if (!o)
|
|
4225
4245
|
throw new Error("Failed to create shader");
|
|
4226
4246
|
if (i.shaderSource(o, n), i.compileShader(o), !i.getShaderParameter(o, i.COMPILE_STATUS)) {
|
|
4227
|
-
const c = i.getShaderInfoLog(o), u = e === i.VERTEX_SHADER ? "vertex" : "fragment",
|
|
4247
|
+
const c = i.getShaderInfoLog(o), u = e === i.VERTEX_SHADER ? "vertex" : "fragment", h = new Error(`${u} shader compilation failed:
|
|
4228
4248
|
${c}`);
|
|
4229
4249
|
if (e === i.FRAGMENT_SHADER) {
|
|
4230
|
-
|
|
4231
|
-
const
|
|
4232
|
-
if (
|
|
4233
|
-
const m =
|
|
4234
|
-
m >= 1 && (
|
|
4250
|
+
h.__isShaderCompileError = !0;
|
|
4251
|
+
const f = Nc(c || "");
|
|
4252
|
+
if (f !== null) {
|
|
4253
|
+
const m = f - r;
|
|
4254
|
+
m >= 1 && (h.__sourceLocation = { line: m });
|
|
4235
4255
|
}
|
|
4236
4256
|
}
|
|
4237
|
-
throw
|
|
4257
|
+
throw h;
|
|
4238
4258
|
}
|
|
4239
4259
|
return o;
|
|
4240
4260
|
}
|
|
@@ -4271,8 +4291,8 @@ ${c}`);
|
|
|
4271
4291
|
const e = this.gl, n = e.canvas.width, r = e.canvas.height, i = () => {
|
|
4272
4292
|
const u = e.createTexture();
|
|
4273
4293
|
e.bindTexture(e.TEXTURE_2D, u), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, n, r, 0, e.RGBA, e.UNSIGNED_BYTE, null), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
|
|
4274
|
-
const
|
|
4275
|
-
return e.bindFramebuffer(e.FRAMEBUFFER,
|
|
4294
|
+
const h = e.createFramebuffer();
|
|
4295
|
+
return e.bindFramebuffer(e.FRAMEBUFFER, h), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, u, 0), { framebuffer: h, texture: u };
|
|
4276
4296
|
}, o = i(), c = i();
|
|
4277
4297
|
this.backbufferFramebuffer = o.framebuffer, this.backbufferTexture = o.texture, this.currentFramebuffer = c.framebuffer, this.currentTexture = c.texture, e.bindFramebuffer(e.FRAMEBUFFER, null), e.bindTexture(e.TEXTURE_2D, null);
|
|
4278
4298
|
}
|
|
@@ -4321,14 +4341,14 @@ ${c}`);
|
|
|
4321
4341
|
for (const [o, c] of this.cvDirectives) {
|
|
4322
4342
|
let u;
|
|
4323
4343
|
if (c.toggleable && c.paramName) {
|
|
4324
|
-
const
|
|
4325
|
-
if (!
|
|
4326
|
-
u =
|
|
4344
|
+
const f = n.get(c.paramName);
|
|
4345
|
+
if (!f) continue;
|
|
4346
|
+
u = f.value === !0;
|
|
4327
4347
|
} else
|
|
4328
4348
|
u = !0;
|
|
4329
4349
|
u ? this.visibleFeatures.add(o) : this.visibleFeatures.delete(o);
|
|
4330
|
-
const
|
|
4331
|
-
if (u ===
|
|
4350
|
+
const h = i.includes(o);
|
|
4351
|
+
if (u === h) {
|
|
4332
4352
|
c.lastValue = u;
|
|
4333
4353
|
continue;
|
|
4334
4354
|
}
|
|
@@ -4376,40 +4396,40 @@ ${c}`);
|
|
|
4376
4396
|
const i = e.videoStreams || [], o = Math.min(i.length, De.MAX_VIDEO_STREAMS);
|
|
4377
4397
|
this.setUniform("u_videoStreamCount", "int", o);
|
|
4378
4398
|
for (let y = 0; y < De.MAX_VIDEO_STREAMS; y++) {
|
|
4379
|
-
const b = `u_videoStream${y}Connected`,
|
|
4399
|
+
const b = `u_videoStream${y}Connected`, E = `u_videoStream${y}Resolution`;
|
|
4380
4400
|
y < o && i[y]?.isConnected && i[y]?.currentFrame ? (this.updateVideoStreamTexture(y, i[y].currentFrame), this.setUniform(
|
|
4381
|
-
|
|
4401
|
+
E,
|
|
4382
4402
|
"vec2",
|
|
4383
4403
|
[i[y].frameWidth, i[y].frameHeight]
|
|
4384
|
-
), this.setUniform(b, "bool", !0)) : (this.setUniform(
|
|
4404
|
+
), this.setUniform(b, "bool", !0)) : (this.setUniform(E, "vec2", [0, 0]), this.setUniform(b, "bool", !1));
|
|
4385
4405
|
}
|
|
4386
4406
|
const c = e.devices || [], u = Math.min(c.length, De.MAX_DEVICE_VIDEOS);
|
|
4387
4407
|
this.setUniform("u_deviceCount", "int", u);
|
|
4388
4408
|
for (let y = 0; y < De.MAX_DEVICE_VIDEOS; y++) {
|
|
4389
|
-
const b = `u_device${y}Connected`,
|
|
4409
|
+
const b = `u_device${y}Connected`, E = `u_device${y}Resolution`;
|
|
4390
4410
|
y < u && c[y]?.video?.isConnected && c[y].video.currentFrame ? (this.updateDeviceTexture(y, c[y].video.currentFrame), this.setUniform(
|
|
4391
|
-
|
|
4411
|
+
E,
|
|
4392
4412
|
"vec2",
|
|
4393
4413
|
[c[y].video.frameWidth, c[y].video.frameHeight]
|
|
4394
|
-
), this.setUniform(b, "bool", !0)) : (this.setUniform(
|
|
4414
|
+
), this.setUniform(b, "bool", !0)) : (this.setUniform(E, "vec2", [0, 0]), this.setUniform(b, "bool", !1));
|
|
4395
4415
|
}
|
|
4396
|
-
const
|
|
4397
|
-
this.setUniform("u_audioStreamCount", "int",
|
|
4416
|
+
const h = e.audioStreams || [], f = Math.min(h.length, De.MAX_AUDIO_STREAMS);
|
|
4417
|
+
this.setUniform("u_audioStreamCount", "int", f);
|
|
4398
4418
|
for (let y = 0; y < De.MAX_AUDIO_STREAMS; y++) {
|
|
4399
4419
|
const b = `u_audioStream${y}`;
|
|
4400
|
-
if (y <
|
|
4401
|
-
const
|
|
4402
|
-
this.setUniform(`${b}Connected`, "bool", !0), this.setUniform(`${b}Volume`, "float",
|
|
4420
|
+
if (y < f && h[y]?.isConnected) {
|
|
4421
|
+
const E = h[y];
|
|
4422
|
+
this.setUniform(`${b}Connected`, "bool", !0), this.setUniform(`${b}Volume`, "float", E.volume?.current || 0), this.setUniform(`${b}Low`, "float", E.bands?.low || 0), this.setUniform(`${b}LowMid`, "float", E.bands?.lowMid || 0), this.setUniform(`${b}Mid`, "float", E.bands?.mid || 0), this.setUniform(`${b}HighMid`, "float", E.bands?.highMid || 0), this.setUniform(`${b}High`, "float", E.bands?.high || 0), this.setUniform(`${b}Brightness`, "float", E.spectral?.brightness || 0), this.setUniform(`${b}Flatness`, "float", E.spectral?.flatness || 0);
|
|
4403
4423
|
} else
|
|
4404
4424
|
this.setUniform(`${b}Connected`, "bool", !1), this.setUniform(`${b}Volume`, "float", 0), this.setUniform(`${b}Low`, "float", 0), this.setUniform(`${b}LowMid`, "float", 0), this.setUniform(`${b}Mid`, "float", 0), this.setUniform(`${b}HighMid`, "float", 0), this.setUniform(`${b}High`, "float", 0), this.setUniform(`${b}Brightness`, "float", 0), this.setUniform(`${b}Flatness`, "float", 0);
|
|
4405
4425
|
}
|
|
4406
|
-
const m = r.cv?.faces || [], g = m[0],
|
|
4407
|
-
if (this.setUniform("u_faceCount", "int", this.visibleFeatures.has("faceDetection") ? m.length : 0),
|
|
4408
|
-
const y = g.bounds, b = g.center?.x || 0,
|
|
4409
|
-
this.setUniform("u_face0Bounds", "vec4", [y?.x || 0, 1 - (y?.y || 0) - (y?.height || 0), y?.width || 0, y?.height || 0]), this.setUniform("u_face0Center", "vec2", [b, 1 -
|
|
4426
|
+
const m = r.cv?.faces || [], g = m[0], v = this.visibleFeatures.has("faceDetection") && !!g, w = this.visibleFeatures.has("faceMesh") && !!g, D = this.visibleFeatures.has("emotionDetection") && !!g;
|
|
4427
|
+
if (this.setUniform("u_faceCount", "int", this.visibleFeatures.has("faceDetection") ? m.length : 0), v) {
|
|
4428
|
+
const y = g.bounds, b = g.center?.x || 0, E = g.center?.y || 0;
|
|
4429
|
+
this.setUniform("u_face0Bounds", "vec4", [y?.x || 0, 1 - (y?.y || 0) - (y?.height || 0), y?.width || 0, y?.height || 0]), this.setUniform("u_face0Center", "vec2", [b, 1 - E]), this.setUniform("u_face0Confidence", "float", g.confidence || 0);
|
|
4410
4430
|
} else
|
|
4411
4431
|
this.setUniform("u_face0Bounds", "vec4", [0, 0, 0, 0]), this.setUniform("u_face0Center", "vec2", [0, 0]), this.setUniform("u_face0Confidence", "float", 0);
|
|
4412
|
-
if (
|
|
4432
|
+
if (w) {
|
|
4413
4433
|
const y = g.headPose || {};
|
|
4414
4434
|
this.setUniform("u_face0HeadPose", "vec3", [y.pitch || 0, y.yaw || 0, -(y.roll || 0)]);
|
|
4415
4435
|
} else
|
|
@@ -4423,18 +4443,18 @@ ${c}`);
|
|
|
4423
4443
|
this.setUniform("u_handCount", "int", W ? N.length : 0);
|
|
4424
4444
|
const K = W ? N.find((y) => y.handedness === "left") : void 0, L = W ? N.find((y) => y.handedness === "right") : void 0;
|
|
4425
4445
|
if (K) {
|
|
4426
|
-
const y = K.palm || K.landmarks?.[9], b = K.gestures || {},
|
|
4427
|
-
this.setUniform("u_leftHandPalm", "vec3", [y?.x || 0, 1 - (y?.y || 0), y?.z || 0]), this.setUniform("u_leftHandConfidence", "float", K.confidence || 0), this.setUniform("u_leftHandBounds", "vec4", [
|
|
4446
|
+
const y = K.palm || K.landmarks?.[9], b = K.gestures || {}, E = K.bounds;
|
|
4447
|
+
this.setUniform("u_leftHandPalm", "vec3", [y?.x || 0, 1 - (y?.y || 0), y?.z || 0]), this.setUniform("u_leftHandConfidence", "float", K.confidence || 0), this.setUniform("u_leftHandBounds", "vec4", [E?.x || 0, 1 - (E?.y || 0) - (E?.height || 0), E?.width || 0, E?.height || 0]), this.setUniform("u_leftHandFist", "float", b.fist || 0), this.setUniform("u_leftHandOpen", "float", b.openPalm || 0), this.setUniform("u_leftHandPeace", "float", b.peace || 0), this.setUniform("u_leftHandThumbsUp", "float", b.thumbsUp || 0), this.setUniform("u_leftHandThumbsDown", "float", b.thumbsDown || 0), this.setUniform("u_leftHandPointing", "float", b.pointing || 0), this.setUniform("u_leftHandILoveYou", "float", b.iLoveYou || 0);
|
|
4428
4448
|
} else
|
|
4429
4449
|
this.setUniform("u_leftHandPalm", "vec3", [0, 0, 0]), this.setUniform("u_leftHandConfidence", "float", 0), this.setUniform("u_leftHandBounds", "vec4", [0, 0, 0, 0]), this.setUniform("u_leftHandFist", "float", 0), this.setUniform("u_leftHandOpen", "float", 0), this.setUniform("u_leftHandPeace", "float", 0), this.setUniform("u_leftHandThumbsUp", "float", 0), this.setUniform("u_leftHandThumbsDown", "float", 0), this.setUniform("u_leftHandPointing", "float", 0), this.setUniform("u_leftHandILoveYou", "float", 0);
|
|
4430
4450
|
if (L) {
|
|
4431
|
-
const y = L.palm || L.landmarks?.[9], b = L.gestures || {},
|
|
4432
|
-
this.setUniform("u_rightHandPalm", "vec3", [y?.x || 0, 1 - (y?.y || 0), y?.z || 0]), this.setUniform("u_rightHandConfidence", "float", L.confidence || 0), this.setUniform("u_rightHandBounds", "vec4", [
|
|
4451
|
+
const y = L.palm || L.landmarks?.[9], b = L.gestures || {}, E = L.bounds;
|
|
4452
|
+
this.setUniform("u_rightHandPalm", "vec3", [y?.x || 0, 1 - (y?.y || 0), y?.z || 0]), this.setUniform("u_rightHandConfidence", "float", L.confidence || 0), this.setUniform("u_rightHandBounds", "vec4", [E?.x || 0, 1 - (E?.y || 0) - (E?.height || 0), E?.width || 0, E?.height || 0]), this.setUniform("u_rightHandFist", "float", b.fist || 0), this.setUniform("u_rightHandOpen", "float", b.openPalm || 0), this.setUniform("u_rightHandPeace", "float", b.peace || 0), this.setUniform("u_rightHandThumbsUp", "float", b.thumbsUp || 0), this.setUniform("u_rightHandThumbsDown", "float", b.thumbsDown || 0), this.setUniform("u_rightHandPointing", "float", b.pointing || 0), this.setUniform("u_rightHandILoveYou", "float", b.iLoveYou || 0);
|
|
4433
4453
|
} else
|
|
4434
4454
|
this.setUniform("u_rightHandPalm", "vec3", [0, 0, 0]), this.setUniform("u_rightHandConfidence", "float", 0), this.setUniform("u_rightHandBounds", "vec4", [0, 0, 0, 0]), this.setUniform("u_rightHandFist", "float", 0), this.setUniform("u_rightHandOpen", "float", 0), this.setUniform("u_rightHandPeace", "float", 0), this.setUniform("u_rightHandThumbsUp", "float", 0), this.setUniform("u_rightHandThumbsDown", "float", 0), this.setUniform("u_rightHandPointing", "float", 0), this.setUniform("u_rightHandILoveYou", "float", 0);
|
|
4435
4455
|
const O = this.visibleFeatures.has("poseDetection") ? r.cv?.pose ?? null : null;
|
|
4436
4456
|
if (this.setUniform("u_poseDetected", "bool", O !== null), O && O.landmarks) {
|
|
4437
|
-
const y = O.landmarks, b = (
|
|
4457
|
+
const y = O.landmarks, b = (E) => 1 - (y[E]?.y || 0);
|
|
4438
4458
|
this.setUniform("u_poseConfidence", "float", O.confidence || 0), this.setUniform("u_nosePosition", "vec2", [y[0]?.x || 0, b(0)]), this.setUniform("u_leftShoulderPosition", "vec2", [y[11]?.x || 0, b(11)]), this.setUniform("u_rightShoulderPosition", "vec2", [y[12]?.x || 0, b(12)]), this.setUniform("u_leftElbowPosition", "vec2", [y[13]?.x || 0, b(13)]), this.setUniform("u_rightElbowPosition", "vec2", [y[14]?.x || 0, b(14)]), this.setUniform("u_leftWristPosition", "vec2", [y[15]?.x || 0, b(15)]), this.setUniform("u_rightWristPosition", "vec2", [y[16]?.x || 0, b(16)]), this.setUniform("u_leftHipPosition", "vec2", [y[23]?.x || 0, b(23)]), this.setUniform("u_rightHipPosition", "vec2", [y[24]?.x || 0, b(24)]), this.setUniform("u_leftKneePosition", "vec2", [y[25]?.x || 0, b(25)]), this.setUniform("u_rightKneePosition", "vec2", [y[26]?.x || 0, b(26)]), this.setUniform("u_leftAnklePosition", "vec2", [y[27]?.x || 0, b(27)]), this.setUniform("u_rightAnklePosition", "vec2", [y[28]?.x || 0, b(28)]);
|
|
4439
4459
|
} else
|
|
4440
4460
|
this.setUniform("u_poseConfidence", "float", 0), this.setUniform("u_nosePosition", "vec2", [0, 0]), this.setUniform("u_leftShoulderPosition", "vec2", [0, 0]), this.setUniform("u_rightShoulderPosition", "vec2", [0, 0]), this.setUniform("u_leftElbowPosition", "vec2", [0, 0]), this.setUniform("u_rightElbowPosition", "vec2", [0, 0]), this.setUniform("u_leftWristPosition", "vec2", [0, 0]), this.setUniform("u_rightWristPosition", "vec2", [0, 0]), this.setUniform("u_leftHipPosition", "vec2", [0, 0]), this.setUniform("u_rightHipPosition", "vec2", [0, 0]), this.setUniform("u_leftKneePosition", "vec2", [0, 0]), this.setUniform("u_rightKneePosition", "vec2", [0, 0]), this.setUniform("u_leftAnklePosition", "vec2", [0, 0]), this.setUniform("u_rightAnklePosition", "vec2", [0, 0]);
|
|
@@ -4468,19 +4488,19 @@ ${c}`);
|
|
|
4468
4488
|
this.setUniform("u_externalDeviceCount", "int", me);
|
|
4469
4489
|
for (let y = 0; y < De.MAX_EXTERNAL_DEVICES; y++)
|
|
4470
4490
|
if (y < me) {
|
|
4471
|
-
const b = z[y],
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
]) : this.setUniform(`u_device${y}Acceleration`, "vec3", [0, 0, 0]),
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
]) : this.setUniform(`u_device${y}AccelerationGravity`, "vec3", [0, 0, 0]),
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4491
|
+
const b = z[y], E = b.motion;
|
|
4492
|
+
E?.acceleration ? this.setUniform(`u_device${y}Acceleration`, "vec3", [
|
|
4493
|
+
E.acceleration.x ?? 0,
|
|
4494
|
+
E.acceleration.y ?? 0,
|
|
4495
|
+
E.acceleration.z ?? 0
|
|
4496
|
+
]) : this.setUniform(`u_device${y}Acceleration`, "vec3", [0, 0, 0]), E?.accelerationIncludingGravity ? this.setUniform(`u_device${y}AccelerationGravity`, "vec3", [
|
|
4497
|
+
E.accelerationIncludingGravity.x ?? 0,
|
|
4498
|
+
E.accelerationIncludingGravity.y ?? 0,
|
|
4499
|
+
E.accelerationIncludingGravity.z ?? 0
|
|
4500
|
+
]) : this.setUniform(`u_device${y}AccelerationGravity`, "vec3", [0, 0, 0]), E?.rotationRate ? this.setUniform(`u_device${y}RotationRate`, "vec3", [
|
|
4501
|
+
E.rotationRate.alpha ?? 0,
|
|
4502
|
+
E.rotationRate.beta ?? 0,
|
|
4503
|
+
E.rotationRate.gamma ?? 0
|
|
4484
4504
|
]) : this.setUniform(`u_device${y}RotationRate`, "vec3", [0, 0, 0]);
|
|
4485
4505
|
const V = b.orientation;
|
|
4486
4506
|
V ? this.setUniform(`u_device${y}Orientation`, "vec3", [
|
|
@@ -4505,11 +4525,11 @@ ${c}`);
|
|
|
4505
4525
|
if (typeof o == "number")
|
|
4506
4526
|
c = o;
|
|
4507
4527
|
else {
|
|
4508
|
-
const
|
|
4509
|
-
|
|
4528
|
+
const f = n.get(o);
|
|
4529
|
+
f !== void 0 ? c = f.value ?? 0 : this.scalarUniformCache.has(o) ? c = this.scalarUniformCache.get(o) : (this.accumulatorWarned.has(i.uniformName) || (console.warn(`Accumulator '${i.uniformName}': rate source '${o}' not found, using 0`), this.accumulatorWarned.add(i.uniformName)), c = 0);
|
|
4510
4530
|
}
|
|
4511
|
-
const
|
|
4512
|
-
this.accumulatorValues.set(i.uniformName,
|
|
4531
|
+
const h = (this.accumulatorValues.get(i.uniformName) ?? 0) + c * r;
|
|
4532
|
+
this.accumulatorValues.set(i.uniformName, h), this.setUniform(i.uniformName, "float", h);
|
|
4513
4533
|
}
|
|
4514
4534
|
}
|
|
4515
4535
|
/**
|
|
@@ -4855,8 +4875,8 @@ function St(t, e = "") {
|
|
|
4855
4875
|
function Ct(t, e, n = "") {
|
|
4856
4876
|
const r = uo(t), i = t?.length, o = e !== void 0;
|
|
4857
4877
|
if (!r || o && i !== e) {
|
|
4858
|
-
const c = n && `"${n}" `, u = o ? ` of length ${e}` : "",
|
|
4859
|
-
throw r ? new RangeError(
|
|
4878
|
+
const c = n && `"${n}" `, u = o ? ` of length ${e}` : "", h = r ? `length=${i}` : `type=${typeof t}`, f = c + "expected Uint8Array" + u + ", got " + h;
|
|
4879
|
+
throw r ? new RangeError(f) : new TypeError(f);
|
|
4860
4880
|
}
|
|
4861
4881
|
return t;
|
|
4862
4882
|
}
|
|
@@ -4887,7 +4907,7 @@ function An(...t) {
|
|
|
4887
4907
|
function Yr(t) {
|
|
4888
4908
|
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
4889
4909
|
}
|
|
4890
|
-
function
|
|
4910
|
+
function Ze(t, e) {
|
|
4891
4911
|
return t << 32 - e | t >>> e;
|
|
4892
4912
|
}
|
|
4893
4913
|
const fo = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Oc = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
@@ -4924,8 +4944,8 @@ function mo(t) {
|
|
|
4924
4944
|
for (let i = 0, o = 0; i < n; i++, o += 2) {
|
|
4925
4945
|
const c = yi(t.charCodeAt(o)), u = yi(t.charCodeAt(o + 1));
|
|
4926
4946
|
if (c === void 0 || u === void 0) {
|
|
4927
|
-
const
|
|
4928
|
-
throw new RangeError('hex string expected, got non-hex character "' +
|
|
4947
|
+
const h = t[o] + t[o + 1];
|
|
4948
|
+
throw new RangeError('hex string expected, got non-hex character "' + h + '" at index ' + o);
|
|
4929
4949
|
}
|
|
4930
4950
|
r[i] = c * 16 + u;
|
|
4931
4951
|
}
|
|
@@ -4990,9 +5010,9 @@ class Hc {
|
|
|
4990
5010
|
for (let c = 0; c < o; ) {
|
|
4991
5011
|
const u = Math.min(i - this.pos, o - c);
|
|
4992
5012
|
if (u === i) {
|
|
4993
|
-
const
|
|
5013
|
+
const h = Yr(e);
|
|
4994
5014
|
for (; i <= o - c; c += i)
|
|
4995
|
-
this.process(
|
|
5015
|
+
this.process(h, c);
|
|
4996
5016
|
continue;
|
|
4997
5017
|
}
|
|
4998
5018
|
r.set(e.subarray(c, c + u), this.pos), this.pos += u, c += u, this.pos === i && (this.process(n, 0), this.pos = 0);
|
|
@@ -5007,13 +5027,13 @@ class Hc {
|
|
|
5007
5027
|
for (let g = c; g < i; g++)
|
|
5008
5028
|
n[g] = 0;
|
|
5009
5029
|
r.setBigUint64(i - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
5010
|
-
const u = Yr(e),
|
|
5011
|
-
if (
|
|
5030
|
+
const u = Yr(e), h = this.outputLen;
|
|
5031
|
+
if (h % 4)
|
|
5012
5032
|
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
5013
|
-
const
|
|
5014
|
-
if (
|
|
5033
|
+
const f = h / 4, m = this.get();
|
|
5034
|
+
if (f > m.length)
|
|
5015
5035
|
throw new Error("_sha2: outputLen bigger than state");
|
|
5016
|
-
for (let g = 0; g <
|
|
5036
|
+
for (let g = 0; g < f; g++)
|
|
5017
5037
|
u.setUint32(4 * g, m[g], o);
|
|
5018
5038
|
}
|
|
5019
5039
|
digest() {
|
|
@@ -5111,26 +5131,26 @@ class Xc extends Hc {
|
|
|
5111
5131
|
super(64, e, 8, !1);
|
|
5112
5132
|
}
|
|
5113
5133
|
get() {
|
|
5114
|
-
const { A: e, B: n, C: r, D: i, E: o, F: c, G: u, H:
|
|
5115
|
-
return [e, n, r, i, o, c, u,
|
|
5134
|
+
const { A: e, B: n, C: r, D: i, E: o, F: c, G: u, H: h } = this;
|
|
5135
|
+
return [e, n, r, i, o, c, u, h];
|
|
5116
5136
|
}
|
|
5117
5137
|
// prettier-ignore
|
|
5118
|
-
set(e, n, r, i, o, c, u,
|
|
5119
|
-
this.A = e | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = o | 0, this.F = c | 0, this.G = u | 0, this.H =
|
|
5138
|
+
set(e, n, r, i, o, c, u, h) {
|
|
5139
|
+
this.A = e | 0, this.B = n | 0, this.C = r | 0, this.D = i | 0, this.E = o | 0, this.F = c | 0, this.G = u | 0, this.H = h | 0;
|
|
5120
5140
|
}
|
|
5121
5141
|
process(e, n) {
|
|
5122
5142
|
for (let g = 0; g < 16; g++, n += 4)
|
|
5123
5143
|
ut[g] = e.getUint32(n, !1);
|
|
5124
5144
|
for (let g = 16; g < 64; g++) {
|
|
5125
|
-
const
|
|
5145
|
+
const v = ut[g - 15], w = ut[g - 2], D = Ze(v, 7) ^ Ze(v, 18) ^ v >>> 3, N = Ze(w, 17) ^ Ze(w, 19) ^ w >>> 10;
|
|
5126
5146
|
ut[g] = N + ut[g - 7] + D + ut[g - 16] | 0;
|
|
5127
5147
|
}
|
|
5128
|
-
let { A: r, B: i, C: o, D: c, E: u, F:
|
|
5148
|
+
let { A: r, B: i, C: o, D: c, E: u, F: h, G: f, H: m } = this;
|
|
5129
5149
|
for (let g = 0; g < 64; g++) {
|
|
5130
|
-
const
|
|
5131
|
-
m =
|
|
5150
|
+
const v = Ze(u, 6) ^ Ze(u, 11) ^ Ze(u, 25), w = m + v + qc(u, h, f) + Gc[g] + ut[g] | 0, N = (Ze(r, 2) ^ Ze(r, 13) ^ Ze(r, 22)) + Wc(r, i, o) | 0;
|
|
5151
|
+
m = f, f = h, h = u, u = c + w | 0, c = o, o = i, i = r, r = w + N | 0;
|
|
5132
5152
|
}
|
|
5133
|
-
r = r + this.A | 0, i = i + this.B | 0, o = o + this.C | 0, c = c + this.D | 0, u = u + this.E | 0,
|
|
5153
|
+
r = r + this.A | 0, i = i + this.B | 0, o = o + this.C | 0, c = c + this.D | 0, u = u + this.E | 0, h = h + this.F | 0, f = f + this.G | 0, m = m + this.H | 0, this.set(r, i, o, c, u, h, f, m);
|
|
5134
5154
|
}
|
|
5135
5155
|
roundClean() {
|
|
5136
5156
|
An(ut);
|
|
@@ -5236,28 +5256,28 @@ function Qc(t, e, n) {
|
|
|
5236
5256
|
if (St(t, "hashLen"), St(e, "qByteLen"), typeof n != "function")
|
|
5237
5257
|
throw new TypeError("hmacFn must be a function");
|
|
5238
5258
|
const r = (W) => new Uint8Array(W), i = Uint8Array.of(), o = Uint8Array.of(0), c = Uint8Array.of(1), u = 1e3;
|
|
5239
|
-
let
|
|
5259
|
+
let h = r(t), f = r(t), m = 0;
|
|
5240
5260
|
const g = () => {
|
|
5241
|
-
|
|
5242
|
-
},
|
|
5243
|
-
|
|
5261
|
+
h.fill(1), f.fill(0), m = 0;
|
|
5262
|
+
}, v = (...W) => n(f, ht(h, ...W)), w = (W = i) => {
|
|
5263
|
+
f = v(o, W), h = v(), W.length !== 0 && (f = v(c, W), h = v());
|
|
5244
5264
|
}, D = () => {
|
|
5245
5265
|
if (m++ >= u)
|
|
5246
5266
|
throw new Error("drbg: tried max amount of iterations");
|
|
5247
5267
|
let W = 0;
|
|
5248
5268
|
const K = [];
|
|
5249
5269
|
for (; W < e; ) {
|
|
5250
|
-
|
|
5251
|
-
const L =
|
|
5252
|
-
K.push(L), W +=
|
|
5270
|
+
h = v();
|
|
5271
|
+
const L = h.slice();
|
|
5272
|
+
K.push(L), W += h.length;
|
|
5253
5273
|
}
|
|
5254
5274
|
return ht(...K);
|
|
5255
5275
|
};
|
|
5256
5276
|
return (W, K) => {
|
|
5257
|
-
g(),
|
|
5277
|
+
g(), w(W);
|
|
5258
5278
|
let L;
|
|
5259
5279
|
for (; (L = K(D())) === void 0; )
|
|
5260
|
-
|
|
5280
|
+
w();
|
|
5261
5281
|
return g(), L;
|
|
5262
5282
|
};
|
|
5263
5283
|
}
|
|
@@ -5267,19 +5287,19 @@ function Wn(t, e = {}, n = {}) {
|
|
|
5267
5287
|
function r(o, c, u) {
|
|
5268
5288
|
if (!u && c !== "function" && !Object.hasOwn(t, o))
|
|
5269
5289
|
throw new TypeError(`param "${o}" is invalid: expected own property`);
|
|
5270
|
-
const
|
|
5271
|
-
if (u &&
|
|
5290
|
+
const h = t[o];
|
|
5291
|
+
if (u && h === void 0)
|
|
5272
5292
|
return;
|
|
5273
|
-
const
|
|
5274
|
-
if (
|
|
5275
|
-
throw new TypeError(`param "${o}" is invalid: expected ${c}, got ${
|
|
5293
|
+
const f = typeof h;
|
|
5294
|
+
if (f !== c || h === null)
|
|
5295
|
+
throw new TypeError(`param "${o}" is invalid: expected ${c}, got ${f}`);
|
|
5276
5296
|
}
|
|
5277
|
-
const i = (o, c) => Object.entries(o).forEach(([u,
|
|
5297
|
+
const i = (o, c) => Object.entries(o).forEach(([u, h]) => r(u, h, c));
|
|
5278
5298
|
i(e, !1), i(n, !0);
|
|
5279
5299
|
}
|
|
5280
5300
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5281
5301
|
const Me = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1), vt = /* @__PURE__ */ BigInt(2), Eo = /* @__PURE__ */ BigInt(3), To = /* @__PURE__ */ BigInt(4), So = /* @__PURE__ */ BigInt(5), Jc = /* @__PURE__ */ BigInt(7), xo = /* @__PURE__ */ BigInt(8), e1 = /* @__PURE__ */ BigInt(9), Ao = /* @__PURE__ */ BigInt(16);
|
|
5282
|
-
function
|
|
5302
|
+
function qe(t, e) {
|
|
5283
5303
|
if (e <= Me)
|
|
5284
5304
|
throw new Error("mod: expected positive modulus, got " + e);
|
|
5285
5305
|
const n = t % e;
|
|
@@ -5290,14 +5310,14 @@ function _i(t, e) {
|
|
|
5290
5310
|
throw new Error("invert: expected non-zero number");
|
|
5291
5311
|
if (e <= Me)
|
|
5292
5312
|
throw new Error("invert: expected positive modulus, got " + e);
|
|
5293
|
-
let n =
|
|
5313
|
+
let n = qe(t, e), r = e, i = Me, o = Te;
|
|
5294
5314
|
for (; n !== Me; ) {
|
|
5295
|
-
const u = r / n,
|
|
5296
|
-
r = n, n =
|
|
5315
|
+
const u = r / n, h = r - n * u, f = i - o * u;
|
|
5316
|
+
r = n, n = h, i = o, o = f;
|
|
5297
5317
|
}
|
|
5298
5318
|
if (r !== Te)
|
|
5299
5319
|
throw new Error("invert: does not exist");
|
|
5300
|
-
return
|
|
5320
|
+
return qe(i, e);
|
|
5301
5321
|
}
|
|
5302
5322
|
function Cs(t, e, n) {
|
|
5303
5323
|
const r = t;
|
|
@@ -5309,18 +5329,18 @@ function Io(t, e) {
|
|
|
5309
5329
|
return Cs(n, i, e), i;
|
|
5310
5330
|
}
|
|
5311
5331
|
function t1(t, e) {
|
|
5312
|
-
const n = t, r = (n.ORDER - So) / xo, i = n.mul(e, vt), o = n.pow(i, r), c = n.mul(e, o), u = n.mul(n.mul(c, vt), o),
|
|
5313
|
-
return Cs(n,
|
|
5332
|
+
const n = t, r = (n.ORDER - So) / xo, i = n.mul(e, vt), o = n.pow(i, r), c = n.mul(e, o), u = n.mul(n.mul(c, vt), o), h = n.mul(c, n.sub(u, n.ONE));
|
|
5333
|
+
return Cs(n, h, e), h;
|
|
5314
5334
|
}
|
|
5315
5335
|
function n1(t) {
|
|
5316
5336
|
const e = Ls(t), n = Ro(t), r = n(e, e.neg(e.ONE)), i = n(e, r), o = n(e, e.neg(r)), c = (t + Jc) / Ao;
|
|
5317
|
-
return (u,
|
|
5318
|
-
const
|
|
5319
|
-
let m =
|
|
5320
|
-
const
|
|
5321
|
-
m =
|
|
5322
|
-
const W =
|
|
5323
|
-
return Cs(
|
|
5337
|
+
return (u, h) => {
|
|
5338
|
+
const f = u;
|
|
5339
|
+
let m = f.pow(h, c), g = f.mul(m, r);
|
|
5340
|
+
const v = f.mul(m, i), w = f.mul(m, o), D = f.eql(f.sqr(g), h), N = f.eql(f.sqr(v), h);
|
|
5341
|
+
m = f.cmov(m, g, D), g = f.cmov(w, v, N);
|
|
5342
|
+
const W = f.eql(f.sqr(g), h), K = f.cmov(m, g, W);
|
|
5343
|
+
return Cs(f, K, h), K;
|
|
5324
5344
|
};
|
|
5325
5345
|
}
|
|
5326
5346
|
function Ro(t) {
|
|
@@ -5338,22 +5358,22 @@ function Ro(t) {
|
|
|
5338
5358
|
return Io;
|
|
5339
5359
|
let o = i.pow(r, e);
|
|
5340
5360
|
const c = (e + Te) / vt;
|
|
5341
|
-
return function(
|
|
5342
|
-
const m =
|
|
5343
|
-
if (m.is0(
|
|
5344
|
-
return
|
|
5345
|
-
if (ki(m,
|
|
5361
|
+
return function(h, f) {
|
|
5362
|
+
const m = h;
|
|
5363
|
+
if (m.is0(f))
|
|
5364
|
+
return f;
|
|
5365
|
+
if (ki(m, f) !== 1)
|
|
5346
5366
|
throw new Error("Cannot find square root");
|
|
5347
|
-
let g = n,
|
|
5348
|
-
for (; !m.eql(
|
|
5349
|
-
if (m.is0(
|
|
5367
|
+
let g = n, v = m.mul(m.ONE, o), w = m.pow(f, e), D = m.pow(f, c);
|
|
5368
|
+
for (; !m.eql(w, m.ONE); ) {
|
|
5369
|
+
if (m.is0(w))
|
|
5350
5370
|
return m.ZERO;
|
|
5351
|
-
let N = 1, W = m.sqr(
|
|
5371
|
+
let N = 1, W = m.sqr(w);
|
|
5352
5372
|
for (; !m.eql(W, m.ONE); )
|
|
5353
5373
|
if (N++, W = m.sqr(W), N === g)
|
|
5354
5374
|
throw new Error("Cannot find square root");
|
|
5355
|
-
const K = Te << BigInt(g - N - 1), L = m.pow(
|
|
5356
|
-
g = N,
|
|
5375
|
+
const K = Te << BigInt(g - N - 1), L = m.pow(v, K);
|
|
5376
|
+
g = N, v = m.sqr(L), w = m.mul(w, v), D = m.mul(D, L);
|
|
5357
5377
|
}
|
|
5358
5378
|
return D;
|
|
5359
5379
|
};
|
|
@@ -5406,8 +5426,8 @@ function o1(t, e, n) {
|
|
|
5406
5426
|
return i;
|
|
5407
5427
|
}
|
|
5408
5428
|
function Co(t, e, n = !1) {
|
|
5409
|
-
const r = t, i = new Array(e.length).fill(n ? r.ZERO : void 0), o = e.reduce((u,
|
|
5410
|
-
return e.reduceRight((u,
|
|
5429
|
+
const r = t, i = new Array(e.length).fill(n ? r.ZERO : void 0), o = e.reduce((u, h, f) => r.is0(h) ? u : (i[f] = u, r.mul(u, h)), r.ONE), c = r.inv(o);
|
|
5430
|
+
return e.reduceRight((u, h, f) => r.is0(h) ? u : (i[f] = r.mul(u, i[f]), r.mul(u, h)), c), i;
|
|
5411
5431
|
}
|
|
5412
5432
|
function ki(t, e) {
|
|
5413
5433
|
const n = t, r = (n.ORDER - Te) / vt, i = n.pow(e, r), o = n.eql(i, n.ONE), c = n.eql(i, n.ZERO), u = n.eql(i, n.neg(n.ONE));
|
|
@@ -5447,7 +5467,7 @@ class Lo {
|
|
|
5447
5467
|
this.ORDER = e, this.BITS = i, this.BYTES = o, Object.freeze(this);
|
|
5448
5468
|
}
|
|
5449
5469
|
create(e) {
|
|
5450
|
-
return
|
|
5470
|
+
return qe(e, this.ORDER);
|
|
5451
5471
|
}
|
|
5452
5472
|
isValid(e) {
|
|
5453
5473
|
if (typeof e != "bigint")
|
|
@@ -5465,28 +5485,28 @@ class Lo {
|
|
|
5465
5485
|
return (e & Te) === Te;
|
|
5466
5486
|
}
|
|
5467
5487
|
neg(e) {
|
|
5468
|
-
return
|
|
5488
|
+
return qe(-e, this.ORDER);
|
|
5469
5489
|
}
|
|
5470
5490
|
eql(e, n) {
|
|
5471
5491
|
return e === n;
|
|
5472
5492
|
}
|
|
5473
5493
|
sqr(e) {
|
|
5474
|
-
return
|
|
5494
|
+
return qe(e * e, this.ORDER);
|
|
5475
5495
|
}
|
|
5476
5496
|
add(e, n) {
|
|
5477
|
-
return
|
|
5497
|
+
return qe(e + n, this.ORDER);
|
|
5478
5498
|
}
|
|
5479
5499
|
sub(e, n) {
|
|
5480
|
-
return
|
|
5500
|
+
return qe(e - n, this.ORDER);
|
|
5481
5501
|
}
|
|
5482
5502
|
mul(e, n) {
|
|
5483
|
-
return
|
|
5503
|
+
return qe(e * n, this.ORDER);
|
|
5484
5504
|
}
|
|
5485
5505
|
pow(e, n) {
|
|
5486
5506
|
return o1(this, e, n);
|
|
5487
5507
|
}
|
|
5488
5508
|
div(e, n) {
|
|
5489
|
-
return
|
|
5509
|
+
return qe(e * _i(n, this.ORDER), this.ORDER);
|
|
5490
5510
|
}
|
|
5491
5511
|
// Same as above, but doesn't normalize
|
|
5492
5512
|
sqrN(e) {
|
|
@@ -5517,15 +5537,15 @@ class Lo {
|
|
|
5517
5537
|
if (r) {
|
|
5518
5538
|
if (e.length < 1 || !r.includes(e.length) || e.length > i)
|
|
5519
5539
|
throw new Error("Field.fromBytes: expected " + r + " bytes, got " + e.length);
|
|
5520
|
-
const
|
|
5521
|
-
|
|
5540
|
+
const f = new Uint8Array(i);
|
|
5541
|
+
f.set(e, o ? 0 : f.length - e.length), e = f;
|
|
5522
5542
|
}
|
|
5523
5543
|
if (e.length !== i)
|
|
5524
5544
|
throw new Error("Field.fromBytes: expected " + i + " bytes, got " + e.length);
|
|
5525
|
-
let
|
|
5526
|
-
if (u && (
|
|
5545
|
+
let h = o ? ko(e) : qn(e);
|
|
5546
|
+
if (u && (h = qe(h, c)), !n && !this.isValid(h))
|
|
5527
5547
|
throw new Error("invalid field element: outside of range 0..ORDER");
|
|
5528
|
-
return
|
|
5548
|
+
return h;
|
|
5529
5549
|
}
|
|
5530
5550
|
// TODO: we don't need it here, move out to separate fn
|
|
5531
5551
|
invertBatch(e) {
|
|
@@ -5558,7 +5578,7 @@ function c1(t, e, n = !1) {
|
|
|
5558
5578
|
const r = t.length, i = Fo(e), o = Math.max(Po(e), 16);
|
|
5559
5579
|
if (r < o || r > 1024)
|
|
5560
5580
|
throw new Error("expected " + o + "-1024 bytes of input, got " + r);
|
|
5561
|
-
const c = n ? ko(t) : qn(t), u =
|
|
5581
|
+
const c = n ? ko(t) : qn(t), u = qe(c, e - Te) + Te;
|
|
5562
5582
|
return n ? vo(u, i) : As(u, i);
|
|
5563
5583
|
}
|
|
5564
5584
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -5582,10 +5602,10 @@ function Kr(t, e) {
|
|
|
5582
5602
|
}
|
|
5583
5603
|
function Ei(t, e, n) {
|
|
5584
5604
|
const { windowSize: r, mask: i, maxNumber: o, shiftBy: c } = n;
|
|
5585
|
-
let u = Number(t & i),
|
|
5586
|
-
u > r && (u -= o,
|
|
5587
|
-
const
|
|
5588
|
-
return { nextN:
|
|
5605
|
+
let u = Number(t & i), h = t >> c;
|
|
5606
|
+
u > r && (u -= o, h += wt);
|
|
5607
|
+
const f = e * r, m = f + Math.abs(u) - 1, g = u === 0, v = u < 0, w = e % 2 !== 0;
|
|
5608
|
+
return { nextN: h, offset: m, isZero: g, isNeg: v, isNegF: w, offsetF: f };
|
|
5589
5609
|
}
|
|
5590
5610
|
const Zr = /* @__PURE__ */ new WeakMap(), Uo = /* @__PURE__ */ new WeakMap();
|
|
5591
5611
|
function Qr(t) {
|
|
@@ -5626,9 +5646,9 @@ class u1 {
|
|
|
5626
5646
|
precomputeWindow(e, n) {
|
|
5627
5647
|
const { windows: r, windowSize: i } = Kr(n, this.bits), o = [];
|
|
5628
5648
|
let c = e, u = c;
|
|
5629
|
-
for (let
|
|
5649
|
+
for (let h = 0; h < r; h++) {
|
|
5630
5650
|
u = c, o.push(u);
|
|
5631
|
-
for (let
|
|
5651
|
+
for (let f = 1; f < i; f++)
|
|
5632
5652
|
u = u.add(c), o.push(u);
|
|
5633
5653
|
c = u.double();
|
|
5634
5654
|
}
|
|
@@ -5646,8 +5666,8 @@ class u1 {
|
|
|
5646
5666
|
let i = this.ZERO, o = this.BASE;
|
|
5647
5667
|
const c = Kr(e, this.bits);
|
|
5648
5668
|
for (let u = 0; u < c.windows; u++) {
|
|
5649
|
-
const { nextN:
|
|
5650
|
-
r =
|
|
5669
|
+
const { nextN: h, offset: f, isZero: m, isNeg: g, isNegF: v, offsetF: w } = Ei(r, u, c);
|
|
5670
|
+
r = h, m ? o = o.add(Rn(v, n[w])) : i = i.add(Rn(g, n[f]));
|
|
5651
5671
|
}
|
|
5652
5672
|
return Ti(r), { p: i, f: o };
|
|
5653
5673
|
}
|
|
@@ -5660,9 +5680,9 @@ class u1 {
|
|
|
5660
5680
|
wNAFUnsafe(e, n, r, i = this.ZERO) {
|
|
5661
5681
|
const o = Kr(e, this.bits);
|
|
5662
5682
|
for (let c = 0; c < o.windows && r !== Ot; c++) {
|
|
5663
|
-
const { nextN: u, offset:
|
|
5664
|
-
if (r = u, !
|
|
5665
|
-
const g = n[
|
|
5683
|
+
const { nextN: u, offset: h, isZero: f, isNeg: m } = Ei(r, c, o);
|
|
5684
|
+
if (r = u, !f) {
|
|
5685
|
+
const g = n[h];
|
|
5666
5686
|
i = i.add(m ? g.negate() : g);
|
|
5667
5687
|
}
|
|
5668
5688
|
}
|
|
@@ -5707,15 +5727,15 @@ function Si(t, e, n) {
|
|
|
5707
5727
|
function h1(t, e, n = {}, r) {
|
|
5708
5728
|
if (r === void 0 && (r = t === "edwards"), !e || typeof e != "object")
|
|
5709
5729
|
throw new Error(`expected valid ${t} CURVE object`);
|
|
5710
|
-
for (const
|
|
5711
|
-
const
|
|
5712
|
-
if (!(typeof
|
|
5713
|
-
throw new Error(`CURVE.${
|
|
5730
|
+
for (const h of ["p", "n", "h"]) {
|
|
5731
|
+
const f = e[h];
|
|
5732
|
+
if (!(typeof f == "bigint" && f > Ot))
|
|
5733
|
+
throw new Error(`CURVE.${h} must be positive bigint`);
|
|
5714
5734
|
}
|
|
5715
5735
|
const i = Si(e.p, n.Fp, r), o = Si(e.n, n.Fn, r), u = ["Gx", "Gy", "a", "b"];
|
|
5716
|
-
for (const
|
|
5717
|
-
if (!i.isValid(e[
|
|
5718
|
-
throw new Error(`CURVE.${
|
|
5736
|
+
for (const h of u)
|
|
5737
|
+
if (!i.isValid(e[h]))
|
|
5738
|
+
throw new Error(`CURVE.${h} must be valid field element of CURVE.Fp`);
|
|
5719
5739
|
return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: i, Fn: o };
|
|
5720
5740
|
}
|
|
5721
5741
|
function f1(t, e) {
|
|
@@ -5777,14 +5797,14 @@ const d1 = /* @__PURE__ */ (() => {
|
|
|
5777
5797
|
const Ai = (t, e) => (t + (t >= 0 ? e : -e) / Mo) / e;
|
|
5778
5798
|
function m1(t, e, n) {
|
|
5779
5799
|
wo("scalar", t, Qe, n);
|
|
5780
|
-
const [[r, i], [o, c]] = e, u = Ai(c * t, n),
|
|
5781
|
-
let
|
|
5782
|
-
const g =
|
|
5783
|
-
g && (
|
|
5784
|
-
const
|
|
5785
|
-
if (
|
|
5800
|
+
const [[r, i], [o, c]] = e, u = Ai(c * t, n), h = Ai(-i * t, n);
|
|
5801
|
+
let f = t - u * r - h * o, m = -u * i - h * c;
|
|
5802
|
+
const g = f < Qe, v = m < Qe;
|
|
5803
|
+
g && (f = -f), v && (m = -m);
|
|
5804
|
+
const w = Rs(Math.ceil(Is(n) / 2)) + ft;
|
|
5805
|
+
if (f < Qe || f >= w || m < Qe || m >= w)
|
|
5786
5806
|
throw new Error("splitScalar (endomorphism): failed for k");
|
|
5787
|
-
return { k1neg: g, k1:
|
|
5807
|
+
return { k1neg: g, k1: f, k2neg: v, k2: m };
|
|
5788
5808
|
}
|
|
5789
5809
|
function fs(t) {
|
|
5790
5810
|
if (!["compact", "recovered", "der"].includes(t))
|
|
@@ -5803,13 +5823,13 @@ class p1 extends Error {
|
|
|
5803
5823
|
super(e);
|
|
5804
5824
|
}
|
|
5805
5825
|
}
|
|
5806
|
-
const
|
|
5826
|
+
const We = {
|
|
5807
5827
|
// asn.1 DER encoding utils
|
|
5808
5828
|
Err: p1,
|
|
5809
5829
|
// Basic building block is TLV (Tag-Length-Value)
|
|
5810
5830
|
_tlv: {
|
|
5811
5831
|
encode: (t, e) => {
|
|
5812
|
-
const { Err: n } =
|
|
5832
|
+
const { Err: n } = We;
|
|
5813
5833
|
if (hs(t, "tag"), t < 0 || t > 255)
|
|
5814
5834
|
throw new n("tlv.encode: wrong tag");
|
|
5815
5835
|
if (typeof e != "string")
|
|
@@ -5824,7 +5844,7 @@ const qe = {
|
|
|
5824
5844
|
},
|
|
5825
5845
|
// v - value, l - left bytes (unparsed)
|
|
5826
5846
|
decode(t, e) {
|
|
5827
|
-
const { Err: n } =
|
|
5847
|
+
const { Err: n } = We;
|
|
5828
5848
|
e = Ce(e, void 0, "DER data");
|
|
5829
5849
|
let r = 0;
|
|
5830
5850
|
if (t < 0 || t > 255)
|
|
@@ -5836,19 +5856,19 @@ const qe = {
|
|
|
5836
5856
|
if (!o)
|
|
5837
5857
|
c = i;
|
|
5838
5858
|
else {
|
|
5839
|
-
const
|
|
5840
|
-
if (!
|
|
5859
|
+
const h = i & 127;
|
|
5860
|
+
if (!h)
|
|
5841
5861
|
throw new n("tlv.decode(long): indefinite length not supported");
|
|
5842
|
-
if (
|
|
5862
|
+
if (h > 4)
|
|
5843
5863
|
throw new n("tlv.decode(long): byte length is too big");
|
|
5844
|
-
const
|
|
5845
|
-
if (
|
|
5864
|
+
const f = e.subarray(r, r + h);
|
|
5865
|
+
if (f.length !== h)
|
|
5846
5866
|
throw new n("tlv.decode: length bytes not complete");
|
|
5847
|
-
if (
|
|
5867
|
+
if (f[0] === 0)
|
|
5848
5868
|
throw new n("tlv.decode(long): zero leftmost byte");
|
|
5849
|
-
for (const m of
|
|
5869
|
+
for (const m of f)
|
|
5850
5870
|
c = c << 8 | m;
|
|
5851
|
-
if (r +=
|
|
5871
|
+
if (r += h, c < 128)
|
|
5852
5872
|
throw new n("tlv.decode(long): not minimal encoding");
|
|
5853
5873
|
}
|
|
5854
5874
|
const u = e.subarray(r, r + c);
|
|
@@ -5863,7 +5883,7 @@ const qe = {
|
|
|
5863
5883
|
// - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
|
|
5864
5884
|
_int: {
|
|
5865
5885
|
encode(t) {
|
|
5866
|
-
const { Err: e } =
|
|
5886
|
+
const { Err: e } = We;
|
|
5867
5887
|
if (xs(t), t < Qe)
|
|
5868
5888
|
throw new e("integer: negative integers are not allowed");
|
|
5869
5889
|
let n = gn(t);
|
|
@@ -5872,7 +5892,7 @@ const qe = {
|
|
|
5872
5892
|
return n;
|
|
5873
5893
|
},
|
|
5874
5894
|
decode(t) {
|
|
5875
|
-
const { Err: e } =
|
|
5895
|
+
const { Err: e } = We;
|
|
5876
5896
|
if (t.length < 1)
|
|
5877
5897
|
throw new e("invalid signature integer: empty");
|
|
5878
5898
|
if (t[0] & 128)
|
|
@@ -5883,22 +5903,22 @@ const qe = {
|
|
|
5883
5903
|
}
|
|
5884
5904
|
},
|
|
5885
5905
|
toSig(t) {
|
|
5886
|
-
const { Err: e, _int: n, _tlv: r } =
|
|
5906
|
+
const { Err: e, _int: n, _tlv: r } = We, i = Ce(t, void 0, "signature"), { v: o, l: c } = r.decode(48, i);
|
|
5887
5907
|
if (c.length)
|
|
5888
5908
|
throw new e("invalid signature: left bytes after parsing");
|
|
5889
|
-
const { v: u, l:
|
|
5909
|
+
const { v: u, l: h } = r.decode(2, o), { v: f, l: m } = r.decode(2, h);
|
|
5890
5910
|
if (m.length)
|
|
5891
5911
|
throw new e("invalid signature: left bytes after parsing");
|
|
5892
|
-
return { r: n.decode(u), s: n.decode(
|
|
5912
|
+
return { r: n.decode(u), s: n.decode(f) };
|
|
5893
5913
|
},
|
|
5894
5914
|
hexFromSig(t) {
|
|
5895
|
-
const { _tlv: e, _int: n } =
|
|
5915
|
+
const { _tlv: e, _int: n } = We, r = e.encode(2, n.encode(t.r)), i = e.encode(2, n.encode(t.s)), o = r + i;
|
|
5896
5916
|
return e.encode(48, o);
|
|
5897
5917
|
}
|
|
5898
5918
|
};
|
|
5899
|
-
Object.freeze(
|
|
5900
|
-
Object.freeze(
|
|
5901
|
-
Object.freeze(
|
|
5919
|
+
Object.freeze(We._tlv);
|
|
5920
|
+
Object.freeze(We._int);
|
|
5921
|
+
Object.freeze(We);
|
|
5902
5922
|
const Qe = /* @__PURE__ */ BigInt(0), ft = /* @__PURE__ */ BigInt(1), Mo = /* @__PURE__ */ BigInt(2), bn = /* @__PURE__ */ BigInt(3), g1 = /* @__PURE__ */ BigInt(4);
|
|
5903
5923
|
function b1(t, e = {}) {
|
|
5904
5924
|
const n = h1("weierstrass", t, e), r = n.Fp, i = n.Fn;
|
|
@@ -5912,18 +5932,18 @@ function b1(t, e = {}) {
|
|
|
5912
5932
|
toBytes: "function",
|
|
5913
5933
|
endo: "object"
|
|
5914
5934
|
});
|
|
5915
|
-
const { endo:
|
|
5916
|
-
if (
|
|
5935
|
+
const { endo: h, allowInfinityPoint: f } = e;
|
|
5936
|
+
if (h && (!r.is0(o.a) || typeof h.beta != "bigint" || !Array.isArray(h.basises)))
|
|
5917
5937
|
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
5918
5938
|
const m = Oo(r, i);
|
|
5919
5939
|
function g() {
|
|
5920
5940
|
if (!r.isOdd)
|
|
5921
5941
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
5922
5942
|
}
|
|
5923
|
-
function
|
|
5924
|
-
if (
|
|
5943
|
+
function v(b, E, V) {
|
|
5944
|
+
if (f && E.is0())
|
|
5925
5945
|
return Uint8Array.of(0);
|
|
5926
|
-
const { x: H, y: M } =
|
|
5946
|
+
const { x: H, y: M } = E.toAffine(), R = r.toBytes(H);
|
|
5927
5947
|
if (Zt(V, "isCompressed"), V) {
|
|
5928
5948
|
g();
|
|
5929
5949
|
const U = !r.isOdd(M);
|
|
@@ -5931,12 +5951,12 @@ function b1(t, e = {}) {
|
|
|
5931
5951
|
} else
|
|
5932
5952
|
return ht(Uint8Array.of(4), R, r.toBytes(M));
|
|
5933
5953
|
}
|
|
5934
|
-
function
|
|
5954
|
+
function w(b) {
|
|
5935
5955
|
Ce(b, void 0, "Point");
|
|
5936
|
-
const { publicKey:
|
|
5937
|
-
if (
|
|
5956
|
+
const { publicKey: E, publicKeyUncompressed: V } = m, H = b.length, M = b[0], R = b.subarray(1);
|
|
5957
|
+
if (f && H === 1 && M === 0)
|
|
5938
5958
|
return { x: r.ZERO, y: r.ZERO };
|
|
5939
|
-
if (H ===
|
|
5959
|
+
if (H === E && (M === 2 || M === 3)) {
|
|
5940
5960
|
const U = r.fromBytes(R);
|
|
5941
5961
|
if (!r.isValid(U))
|
|
5942
5962
|
throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -5957,15 +5977,15 @@ function b1(t, e = {}) {
|
|
|
5957
5977
|
throw new Error("bad point: is not on curve");
|
|
5958
5978
|
return { x: P, y: B };
|
|
5959
5979
|
} else
|
|
5960
|
-
throw new Error(`bad point: got length ${H}, expected compressed=${
|
|
5980
|
+
throw new Error(`bad point: got length ${H}, expected compressed=${E} or uncompressed=${V}`);
|
|
5961
5981
|
}
|
|
5962
|
-
const D = e.toBytes === void 0 ?
|
|
5982
|
+
const D = e.toBytes === void 0 ? v : e.toBytes, N = e.fromBytes === void 0 ? w : e.fromBytes;
|
|
5963
5983
|
function W(b) {
|
|
5964
|
-
const
|
|
5984
|
+
const E = r.sqr(b), V = r.mul(E, b);
|
|
5965
5985
|
return r.add(r.add(V, r.mul(b, o.a)), o.b);
|
|
5966
5986
|
}
|
|
5967
|
-
function K(b,
|
|
5968
|
-
const V = r.sqr(
|
|
5987
|
+
function K(b, E) {
|
|
5988
|
+
const V = r.sqr(E), H = W(b);
|
|
5969
5989
|
return r.eql(V, H);
|
|
5970
5990
|
}
|
|
5971
5991
|
if (!K(o.Gx, o.Gy))
|
|
@@ -5973,22 +5993,22 @@ function b1(t, e = {}) {
|
|
|
5973
5993
|
const L = r.mul(r.pow(o.a, bn), g1), j = r.mul(r.sqr(o.b), BigInt(27));
|
|
5974
5994
|
if (r.is0(r.add(L, j)))
|
|
5975
5995
|
throw new Error("bad curve params: a or b");
|
|
5976
|
-
function O(b,
|
|
5977
|
-
if (!r.isValid(
|
|
5996
|
+
function O(b, E, V = !1) {
|
|
5997
|
+
if (!r.isValid(E) || V && r.is0(E))
|
|
5978
5998
|
throw new Error(`bad point coordinate ${b}`);
|
|
5979
|
-
return
|
|
5999
|
+
return E;
|
|
5980
6000
|
}
|
|
5981
6001
|
function J(b) {
|
|
5982
6002
|
if (!(b instanceof z))
|
|
5983
6003
|
throw new Error("Weierstrass Point expected");
|
|
5984
6004
|
}
|
|
5985
6005
|
function ae(b) {
|
|
5986
|
-
if (!
|
|
6006
|
+
if (!h || !h.basises)
|
|
5987
6007
|
throw new Error("no endo");
|
|
5988
|
-
return m1(b,
|
|
6008
|
+
return m1(b, h.basises, i.ORDER);
|
|
5989
6009
|
}
|
|
5990
|
-
function ee(b,
|
|
5991
|
-
return V = new z(r.mul(V.X, b), V.Y, V.Z),
|
|
6010
|
+
function ee(b, E, V, H, M) {
|
|
6011
|
+
return V = new z(r.mul(V.X, b), V.Y, V.Z), E = Rn(H, E), V = Rn(M, V), E.add(V);
|
|
5992
6012
|
}
|
|
5993
6013
|
class z {
|
|
5994
6014
|
// base / generator point
|
|
@@ -6004,27 +6024,27 @@ function b1(t, e = {}) {
|
|
|
6004
6024
|
Y;
|
|
6005
6025
|
Z;
|
|
6006
6026
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
6007
|
-
constructor(
|
|
6008
|
-
this.X = O("x",
|
|
6027
|
+
constructor(E, V, H) {
|
|
6028
|
+
this.X = O("x", E), this.Y = O("y", V, !0), this.Z = O("z", H), Object.freeze(this);
|
|
6009
6029
|
}
|
|
6010
6030
|
static CURVE() {
|
|
6011
6031
|
return o;
|
|
6012
6032
|
}
|
|
6013
6033
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
6014
|
-
static fromAffine(
|
|
6015
|
-
const { x: V, y: H } =
|
|
6016
|
-
if (!
|
|
6034
|
+
static fromAffine(E) {
|
|
6035
|
+
const { x: V, y: H } = E || {};
|
|
6036
|
+
if (!E || !r.isValid(V) || !r.isValid(H))
|
|
6017
6037
|
throw new Error("invalid affine point");
|
|
6018
|
-
if (
|
|
6038
|
+
if (E instanceof z)
|
|
6019
6039
|
throw new Error("projective point not allowed");
|
|
6020
6040
|
return r.is0(V) && r.is0(H) ? z.ZERO : new z(V, H, r.ONE);
|
|
6021
6041
|
}
|
|
6022
|
-
static fromBytes(
|
|
6023
|
-
const V = z.fromAffine(N(Ce(
|
|
6042
|
+
static fromBytes(E) {
|
|
6043
|
+
const V = z.fromAffine(N(Ce(E, void 0, "point")));
|
|
6024
6044
|
return V.assertValidity(), V;
|
|
6025
6045
|
}
|
|
6026
|
-
static fromHex(
|
|
6027
|
-
return z.fromBytes(us(
|
|
6046
|
+
static fromHex(E) {
|
|
6047
|
+
return z.fromBytes(us(E));
|
|
6028
6048
|
}
|
|
6029
6049
|
get x() {
|
|
6030
6050
|
return this.toAffine().x;
|
|
@@ -6038,36 +6058,36 @@ function b1(t, e = {}) {
|
|
|
6038
6058
|
* @param isLazy - true will defer table computation until the first multiplication
|
|
6039
6059
|
* @returns
|
|
6040
6060
|
*/
|
|
6041
|
-
precompute(
|
|
6042
|
-
return y.createCache(this,
|
|
6061
|
+
precompute(E = 8, V = !0) {
|
|
6062
|
+
return y.createCache(this, E), V || this.multiply(bn), this;
|
|
6043
6063
|
}
|
|
6044
6064
|
// TODO: return `this`
|
|
6045
6065
|
/** A point on curve is valid if it conforms to equation. */
|
|
6046
6066
|
assertValidity() {
|
|
6047
|
-
const
|
|
6048
|
-
if (
|
|
6049
|
-
if (e.allowInfinityPoint && r.is0(
|
|
6067
|
+
const E = this;
|
|
6068
|
+
if (E.is0()) {
|
|
6069
|
+
if (e.allowInfinityPoint && r.is0(E.X) && r.eql(E.Y, r.ONE) && r.is0(E.Z))
|
|
6050
6070
|
return;
|
|
6051
6071
|
throw new Error("bad point: ZERO");
|
|
6052
6072
|
}
|
|
6053
|
-
const { x: V, y: H } =
|
|
6073
|
+
const { x: V, y: H } = E.toAffine();
|
|
6054
6074
|
if (!r.isValid(V) || !r.isValid(H))
|
|
6055
6075
|
throw new Error("bad point: x or y not field elements");
|
|
6056
6076
|
if (!K(V, H))
|
|
6057
6077
|
throw new Error("bad point: equation left != right");
|
|
6058
|
-
if (!
|
|
6078
|
+
if (!E.isTorsionFree())
|
|
6059
6079
|
throw new Error("bad point: not in prime-order subgroup");
|
|
6060
6080
|
}
|
|
6061
6081
|
hasEvenY() {
|
|
6062
|
-
const { y:
|
|
6082
|
+
const { y: E } = this.toAffine();
|
|
6063
6083
|
if (!r.isOdd)
|
|
6064
6084
|
throw new Error("Field doesn't support isOdd");
|
|
6065
|
-
return !r.isOdd(
|
|
6085
|
+
return !r.isOdd(E);
|
|
6066
6086
|
}
|
|
6067
6087
|
/** Compare one point to another. */
|
|
6068
|
-
equals(
|
|
6069
|
-
J(
|
|
6070
|
-
const { X: V, Y: H, Z: M } = this, { X: R, Y: U, Z: P } =
|
|
6088
|
+
equals(E) {
|
|
6089
|
+
J(E);
|
|
6090
|
+
const { X: V, Y: H, Z: M } = this, { X: R, Y: U, Z: P } = E, B = r.eql(r.mul(V, P), r.mul(R, M)), $ = r.eql(r.mul(H, P), r.mul(U, M));
|
|
6071
6091
|
return B && $;
|
|
6072
6092
|
}
|
|
6073
6093
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -6079,17 +6099,17 @@ function b1(t, e = {}) {
|
|
|
6079
6099
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
6080
6100
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
6081
6101
|
double() {
|
|
6082
|
-
const { a:
|
|
6102
|
+
const { a: E, b: V } = o, H = r.mul(V, bn), { X: M, Y: R, Z: U } = this;
|
|
6083
6103
|
let P = r.ZERO, B = r.ZERO, $ = r.ZERO, Y = r.mul(M, M), oe = r.mul(R, R), ce = r.mul(U, U), ie = r.mul(M, R);
|
|
6084
|
-
return ie = r.add(ie, ie), $ = r.mul(M, U), $ = r.add($, $), P = r.mul(
|
|
6104
|
+
return ie = r.add(ie, ie), $ = r.mul(M, U), $ = r.add($, $), P = r.mul(E, $), B = r.mul(H, ce), B = r.add(P, B), P = r.sub(oe, B), B = r.add(oe, B), B = r.mul(P, B), P = r.mul(ie, P), $ = r.mul(H, $), ce = r.mul(E, ce), ie = r.sub(Y, ce), ie = r.mul(E, ie), ie = r.add(ie, $), $ = r.add(Y, Y), Y = r.add($, Y), Y = r.add(Y, ce), Y = r.mul(Y, ie), B = r.add(B, Y), ce = r.mul(R, U), ce = r.add(ce, ce), Y = r.mul(ce, ie), P = r.sub(P, Y), $ = r.mul(ce, oe), $ = r.add($, $), $ = r.add($, $), new z(P, B, $);
|
|
6085
6105
|
}
|
|
6086
6106
|
// Renes-Costello-Batina exception-free addition formula.
|
|
6087
6107
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
6088
6108
|
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
6089
6109
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
6090
|
-
add(
|
|
6091
|
-
J(
|
|
6092
|
-
const { X: V, Y: H, Z: M } = this, { X: R, Y: U, Z: P } =
|
|
6110
|
+
add(E) {
|
|
6111
|
+
J(E);
|
|
6112
|
+
const { X: V, Y: H, Z: M } = this, { X: R, Y: U, Z: P } = E;
|
|
6093
6113
|
let B = r.ZERO, $ = r.ZERO, Y = r.ZERO;
|
|
6094
6114
|
const oe = o.a, ce = r.mul(o.b, bn);
|
|
6095
6115
|
let ie = r.mul(V, R), k = r.mul(H, U), x = r.mul(M, P), I = r.add(V, H), A = r.add(R, U);
|
|
@@ -6097,8 +6117,8 @@ function b1(t, e = {}) {
|
|
|
6097
6117
|
let F = r.add(R, P);
|
|
6098
6118
|
return A = r.mul(A, F), F = r.add(ie, x), A = r.sub(A, F), F = r.add(H, M), B = r.add(U, P), F = r.mul(F, B), B = r.add(k, x), F = r.sub(F, B), Y = r.mul(oe, A), B = r.mul(ce, x), Y = r.add(B, Y), B = r.sub(k, Y), Y = r.add(k, Y), $ = r.mul(B, Y), k = r.add(ie, ie), k = r.add(k, ie), x = r.mul(oe, x), A = r.mul(ce, A), k = r.add(k, x), x = r.sub(ie, x), x = r.mul(oe, x), A = r.add(A, x), ie = r.mul(k, A), $ = r.add($, ie), ie = r.mul(F, A), B = r.mul(I, B), B = r.sub(B, ie), ie = r.mul(I, k), Y = r.mul(F, Y), Y = r.add(Y, ie), new z(B, $, Y);
|
|
6099
6119
|
}
|
|
6100
|
-
subtract(
|
|
6101
|
-
return J(
|
|
6120
|
+
subtract(E) {
|
|
6121
|
+
return J(E), this.add(E.negate());
|
|
6102
6122
|
}
|
|
6103
6123
|
is0() {
|
|
6104
6124
|
return this.equals(z.ZERO);
|
|
@@ -6112,17 +6132,17 @@ function b1(t, e = {}) {
|
|
|
6112
6132
|
* @param scalar - by which the point would be multiplied
|
|
6113
6133
|
* @returns New point
|
|
6114
6134
|
*/
|
|
6115
|
-
multiply(
|
|
6135
|
+
multiply(E) {
|
|
6116
6136
|
const { endo: V } = e;
|
|
6117
|
-
if (!i.isValidNot0(
|
|
6137
|
+
if (!i.isValidNot0(E))
|
|
6118
6138
|
throw new RangeError("invalid scalar: out of range");
|
|
6119
6139
|
let H, M;
|
|
6120
6140
|
const R = (U) => y.cached(this, U, (P) => wi(z, P));
|
|
6121
6141
|
if (V) {
|
|
6122
|
-
const { k1neg: U, k1: P, k2neg: B, k2: $ } = ae(
|
|
6142
|
+
const { k1neg: U, k1: P, k2neg: B, k2: $ } = ae(E), { p: Y, f: oe } = R(P), { p: ce, f: ie } = R($);
|
|
6123
6143
|
M = oe.add(ie), H = ee(V.beta, Y, ce, U, B);
|
|
6124
6144
|
} else {
|
|
6125
|
-
const { p: U, f: P } = R(
|
|
6145
|
+
const { p: U, f: P } = R(E);
|
|
6126
6146
|
H = U, M = P;
|
|
6127
6147
|
}
|
|
6128
6148
|
return wi(z, [H, M])[0];
|
|
@@ -6132,8 +6152,8 @@ function b1(t, e = {}) {
|
|
|
6132
6152
|
* It's faster, but should only be used when you don't care about
|
|
6133
6153
|
* an exposed secret key e.g. sig verification, which works over *public* keys.
|
|
6134
6154
|
*/
|
|
6135
|
-
multiplyUnsafe(
|
|
6136
|
-
const { endo: V } = e, H = this, M =
|
|
6155
|
+
multiplyUnsafe(E) {
|
|
6156
|
+
const { endo: V } = e, H = this, M = E;
|
|
6137
6157
|
if (!i.isValid(M))
|
|
6138
6158
|
throw new RangeError("invalid scalar: out of range");
|
|
6139
6159
|
if (M === Qe || H.is0())
|
|
@@ -6153,9 +6173,9 @@ function b1(t, e = {}) {
|
|
|
6153
6173
|
* (X, Y, Z) ∋ (x=X/Z, y=Y/Z).
|
|
6154
6174
|
* @param invertedZ - Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
|
|
6155
6175
|
*/
|
|
6156
|
-
toAffine(
|
|
6176
|
+
toAffine(E) {
|
|
6157
6177
|
const V = this;
|
|
6158
|
-
let H =
|
|
6178
|
+
let H = E;
|
|
6159
6179
|
const { X: M, Y: R, Z: U } = V;
|
|
6160
6180
|
if (r.eql(U, r.ONE))
|
|
6161
6181
|
return { x: M, y: R };
|
|
@@ -6173,21 +6193,21 @@ function b1(t, e = {}) {
|
|
|
6173
6193
|
* Always torsion-free for cofactor=1 curves.
|
|
6174
6194
|
*/
|
|
6175
6195
|
isTorsionFree() {
|
|
6176
|
-
const { isTorsionFree:
|
|
6177
|
-
return c === ft ? !0 :
|
|
6196
|
+
const { isTorsionFree: E } = e;
|
|
6197
|
+
return c === ft ? !0 : E ? E(z, this) : y.unsafe(this, u).is0();
|
|
6178
6198
|
}
|
|
6179
6199
|
clearCofactor() {
|
|
6180
|
-
const { clearCofactor:
|
|
6181
|
-
return c === ft ? this :
|
|
6200
|
+
const { clearCofactor: E } = e;
|
|
6201
|
+
return c === ft ? this : E ? E(z, this) : this.multiplyUnsafe(c);
|
|
6182
6202
|
}
|
|
6183
6203
|
isSmallOrder() {
|
|
6184
6204
|
return c === ft ? this.is0() : this.clearCofactor().is0();
|
|
6185
6205
|
}
|
|
6186
|
-
toBytes(
|
|
6187
|
-
return Zt(
|
|
6206
|
+
toBytes(E = !0) {
|
|
6207
|
+
return Zt(E, "isCompressed"), this.assertValidity(), D(z, this, E);
|
|
6188
6208
|
}
|
|
6189
|
-
toHex(
|
|
6190
|
-
return go(this.toBytes(
|
|
6209
|
+
toHex(E = !0) {
|
|
6210
|
+
return go(this.toBytes(E));
|
|
6191
6211
|
}
|
|
6192
6212
|
toString() {
|
|
6193
6213
|
return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
|
|
@@ -6214,51 +6234,51 @@ function y1(t, e = {}) {
|
|
|
6214
6234
|
const { Fn: n } = t, r = e.randomBytes === void 0 ? yo : e.randomBytes, i = Object.assign(Oo(t.Fp, n), {
|
|
6215
6235
|
seed: Math.max(Po(n.ORDER), 16)
|
|
6216
6236
|
});
|
|
6217
|
-
function o(
|
|
6237
|
+
function o(w) {
|
|
6218
6238
|
try {
|
|
6219
|
-
const D = n.fromBytes(
|
|
6239
|
+
const D = n.fromBytes(w);
|
|
6220
6240
|
return n.isValidNot0(D);
|
|
6221
6241
|
} catch {
|
|
6222
6242
|
return !1;
|
|
6223
6243
|
}
|
|
6224
6244
|
}
|
|
6225
|
-
function c(
|
|
6245
|
+
function c(w, D) {
|
|
6226
6246
|
const { publicKey: N, publicKeyUncompressed: W } = i;
|
|
6227
6247
|
try {
|
|
6228
|
-
const K =
|
|
6229
|
-
return D === !0 && K !== N || D === !1 && K !== W ? !1 : !!t.fromBytes(
|
|
6248
|
+
const K = w.length;
|
|
6249
|
+
return D === !0 && K !== N || D === !1 && K !== W ? !1 : !!t.fromBytes(w);
|
|
6230
6250
|
} catch {
|
|
6231
6251
|
return !1;
|
|
6232
6252
|
}
|
|
6233
6253
|
}
|
|
6234
|
-
function u(
|
|
6235
|
-
return
|
|
6254
|
+
function u(w) {
|
|
6255
|
+
return w = w === void 0 ? r(i.seed) : w, c1(Ce(w, i.seed, "seed"), n.ORDER);
|
|
6236
6256
|
}
|
|
6237
|
-
function
|
|
6238
|
-
return t.BASE.multiply(n.fromBytes(
|
|
6257
|
+
function h(w, D = !0) {
|
|
6258
|
+
return t.BASE.multiply(n.fromBytes(w)).toBytes(D);
|
|
6239
6259
|
}
|
|
6240
|
-
function
|
|
6260
|
+
function f(w) {
|
|
6241
6261
|
const { secretKey: D, publicKey: N, publicKeyUncompressed: W } = i, K = n._lengths;
|
|
6242
|
-
if (!bo(
|
|
6262
|
+
if (!bo(w))
|
|
6243
6263
|
return;
|
|
6244
|
-
const L = Ce(
|
|
6264
|
+
const L = Ce(w, void 0, "key").length, j = L === N || L === W, O = L === D || !!K?.includes(L);
|
|
6245
6265
|
if (!(j && O))
|
|
6246
6266
|
return j;
|
|
6247
6267
|
}
|
|
6248
|
-
function m(
|
|
6249
|
-
if (
|
|
6268
|
+
function m(w, D, N = !0) {
|
|
6269
|
+
if (f(w) === !0)
|
|
6250
6270
|
throw new Error("first arg must be private key");
|
|
6251
|
-
if (
|
|
6271
|
+
if (f(D) === !1)
|
|
6252
6272
|
throw new Error("second arg must be public key");
|
|
6253
|
-
const W = n.fromBytes(
|
|
6273
|
+
const W = n.fromBytes(w);
|
|
6254
6274
|
return t.fromBytes(D).multiply(W).toBytes(N);
|
|
6255
6275
|
}
|
|
6256
6276
|
const g = {
|
|
6257
6277
|
isValidSecretKey: o,
|
|
6258
6278
|
isValidPublicKey: c,
|
|
6259
6279
|
randomSecretKey: u
|
|
6260
|
-
},
|
|
6261
|
-
return Object.freeze(g), Object.freeze(i), Object.freeze({ getPublicKey:
|
|
6280
|
+
}, v = f1(u, h);
|
|
6281
|
+
return Object.freeze(g), Object.freeze(i), Object.freeze({ getPublicKey: h, getSharedSecret: m, keygen: v, Point: t, utils: g, lengths: i });
|
|
6262
6282
|
}
|
|
6263
6283
|
function _1(t, e, n = {}) {
|
|
6264
6284
|
const r = e;
|
|
@@ -6269,14 +6289,14 @@ function _1(t, e, n = {}) {
|
|
|
6269
6289
|
bits2int: "function",
|
|
6270
6290
|
bits2int_modN: "function"
|
|
6271
6291
|
}), n = Object.assign({}, n);
|
|
6272
|
-
const i = n.randomBytes === void 0 ? yo : n.randomBytes, o = n.hmac === void 0 ? (M, R) => d1(r, M, R) : n.hmac, { Fp: c, Fn: u } = t, { ORDER:
|
|
6292
|
+
const i = n.randomBytes === void 0 ? yo : n.randomBytes, o = n.hmac === void 0 ? (M, R) => d1(r, M, R) : n.hmac, { Fp: c, Fn: u } = t, { ORDER: h, BITS: f } = u, { keygen: m, getPublicKey: g, getSharedSecret: v, utils: w, lengths: D } = y1(t, n), N = {
|
|
6273
6293
|
prehash: !0,
|
|
6274
6294
|
lowS: typeof n.lowS == "boolean" ? n.lowS : !0,
|
|
6275
6295
|
format: "compact",
|
|
6276
6296
|
extraEntropy: !1
|
|
6277
|
-
}, W =
|
|
6297
|
+
}, W = h * Mo + ft < c.ORDER;
|
|
6278
6298
|
function K(M) {
|
|
6279
|
-
const R =
|
|
6299
|
+
const R = h >> ft;
|
|
6280
6300
|
return M > R;
|
|
6281
6301
|
}
|
|
6282
6302
|
function L(M, R) {
|
|
@@ -6309,7 +6329,7 @@ function _1(t, e, n = {}) {
|
|
|
6309
6329
|
O(R, U);
|
|
6310
6330
|
let P;
|
|
6311
6331
|
if (U === "der") {
|
|
6312
|
-
const { r: oe, s: ce } =
|
|
6332
|
+
const { r: oe, s: ce } = We.toSig(Ce(R));
|
|
6313
6333
|
return new J(oe, ce);
|
|
6314
6334
|
}
|
|
6315
6335
|
U === "recovered" && (P = R[0], U = "compact", R = R.subarray(1));
|
|
@@ -6331,7 +6351,7 @@ function _1(t, e, n = {}) {
|
|
|
6331
6351
|
// Unlike the top-level helper below, this method expects a digest that has
|
|
6332
6352
|
// already been hashed to the curve's message representative.
|
|
6333
6353
|
recoverPublicKey(R) {
|
|
6334
|
-
const { r: U, s: P } = this, B = this.assertRecovery(), $ = B === 2 || B === 3 ? U +
|
|
6354
|
+
const { r: U, s: P } = this, B = this.assertRecovery(), $ = B === 2 || B === 3 ? U + h : U;
|
|
6335
6355
|
if (!c.isValid($))
|
|
6336
6356
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
6337
6357
|
const Y = c.toBytes($), oe = t.fromBytes(ht(No((B & 1) === 0), Y)), ce = u.inv($), ie = ee(Ce(R, void 0, "msgHash")), k = u.create(-ie * ce), x = u.create(P * ce), I = t.BASE.multiplyUnsafe(k).add(oe.multiplyUnsafe(x));
|
|
@@ -6345,7 +6365,7 @@ function _1(t, e, n = {}) {
|
|
|
6345
6365
|
}
|
|
6346
6366
|
toBytes(R = N.format) {
|
|
6347
6367
|
if (fs(R), R === "der")
|
|
6348
|
-
return us(
|
|
6368
|
+
return us(We.hexFromSig(this));
|
|
6349
6369
|
const { r: U, s: P } = this, B = u.toBytes(U), $ = u.toBytes(P);
|
|
6350
6370
|
return R === "recovered" ? (j(), ht(Uint8Array.of(this.assertRecovery()), B, $)) : ht(B, $);
|
|
6351
6371
|
}
|
|
@@ -6357,13 +6377,13 @@ function _1(t, e, n = {}) {
|
|
|
6357
6377
|
const ae = n.bits2int === void 0 ? function(R) {
|
|
6358
6378
|
if (R.length > 8192)
|
|
6359
6379
|
throw new Error("input is too large");
|
|
6360
|
-
const U = qn(R), P = R.length * 8 -
|
|
6380
|
+
const U = qn(R), P = R.length * 8 - f;
|
|
6361
6381
|
return P > 0 ? U >> BigInt(P) : U;
|
|
6362
6382
|
} : n.bits2int, ee = n.bits2int_modN === void 0 ? function(R) {
|
|
6363
6383
|
return u.create(ae(R));
|
|
6364
|
-
} : n.bits2int_modN, z = Rs(
|
|
6384
|
+
} : n.bits2int_modN, z = Rs(f);
|
|
6365
6385
|
function me(M) {
|
|
6366
|
-
return wo("num < 2^" +
|
|
6386
|
+
return wo("num < 2^" + f, M, Qe, z), u.toBytes(M);
|
|
6367
6387
|
}
|
|
6368
6388
|
function y(M, R) {
|
|
6369
6389
|
return Ce(M, void 0, "message"), R ? Ce(r(M), void 0, "prehashed message") : M;
|
|
@@ -6395,7 +6415,7 @@ function _1(t, e, n = {}) {
|
|
|
6395
6415
|
}
|
|
6396
6416
|
return { seed: ie, k2sig: x };
|
|
6397
6417
|
}
|
|
6398
|
-
function
|
|
6418
|
+
function E(M, R, U = {}) {
|
|
6399
6419
|
const { seed: P, k2sig: B } = b(M, R, U);
|
|
6400
6420
|
return Qc(r.outputLen, u.BYTES, o)(P, B).toBytes(U.format);
|
|
6401
6421
|
}
|
|
@@ -6423,11 +6443,11 @@ function _1(t, e, n = {}) {
|
|
|
6423
6443
|
return Object.freeze({
|
|
6424
6444
|
keygen: m,
|
|
6425
6445
|
getPublicKey: g,
|
|
6426
|
-
getSharedSecret:
|
|
6427
|
-
utils:
|
|
6446
|
+
getSharedSecret: v,
|
|
6447
|
+
utils: w,
|
|
6428
6448
|
lengths: D,
|
|
6429
6449
|
Point: t,
|
|
6430
|
-
sign:
|
|
6450
|
+
sign: E,
|
|
6431
6451
|
verify: V,
|
|
6432
6452
|
recoverPublicKey: H,
|
|
6433
6453
|
Signature: J,
|
|
@@ -6584,24 +6604,24 @@ function Di(t, e) {
|
|
|
6584
6604
|
function D1(t, e, n, r) {
|
|
6585
6605
|
const i = e ? Jt : Qt;
|
|
6586
6606
|
if (!i) return;
|
|
6587
|
-
const o = (e ? Us : Ps) * r, c = (e ? Ms : Ds) * r, u = Math.round(e ? (n - o) / 2 : 48 * r),
|
|
6588
|
-
t.save(), t.globalAlpha = 0.85, t.drawImage(i, u,
|
|
6607
|
+
const o = (e ? Us : Ps) * r, c = (e ? Ms : Ds) * r, u = Math.round(e ? (n - o) / 2 : 48 * r), h = Math.round((e ? 52 : 48) * r);
|
|
6608
|
+
t.save(), t.globalAlpha = 0.85, t.drawImage(i, u, h, o, c), t.restore();
|
|
6589
6609
|
}
|
|
6590
6610
|
function U1(t, e, n, r) {
|
|
6591
6611
|
if (P1(t), !Ue || !zt) return;
|
|
6592
6612
|
const i = n ? jo : Vo;
|
|
6593
6613
|
if (!i) return;
|
|
6594
|
-
const o = (n ? Us : Ps) * r, c = (n ? Ms : Ds) * r, u = e.width,
|
|
6614
|
+
const o = (n ? Us : Ps) * r, c = (n ? Ms : Ds) * r, u = e.width, h = e.height, f = Math.round(n ? (u - o) / 2 : 48 * r), m = Math.round((n ? 52 : 48) * r), g = f / u * 2 - 1, v = 1 - (m + c) / h * 2, w = (f + o) / u * 2 - 1, D = 1 - m / h * 2, N = !!(lt && Ln), W = t.getParameter(t.CURRENT_PROGRAM), K = t.getParameter(t.ACTIVE_TEXTURE);
|
|
6595
6615
|
t.activeTexture(t.TEXTURE0);
|
|
6596
|
-
const L = t.getParameter(t.TEXTURE_BINDING_2D), j = t.getParameter(t.ARRAY_BUFFER_BINDING), O = t.getParameter(t.FRAMEBUFFER_BINDING), J = t.getParameter(t.VIEWPORT), ae = t.isEnabled(t.BLEND), ee = t.getParameter(t.BLEND_SRC_RGB), z = t.getParameter(t.BLEND_DST_RGB), me = t.getParameter(t.BLEND_SRC_ALPHA), y = t.getParameter(t.BLEND_DST_ALPHA), b = t.getParameter(t.BLEND_EQUATION_RGB),
|
|
6597
|
-
t.bindFramebuffer(t.FRAMEBUFFER, null), t.viewport(0, 0, u,
|
|
6616
|
+
const L = t.getParameter(t.TEXTURE_BINDING_2D), j = t.getParameter(t.ARRAY_BUFFER_BINDING), O = t.getParameter(t.FRAMEBUFFER_BINDING), J = t.getParameter(t.VIEWPORT), ae = t.isEnabled(t.BLEND), ee = t.getParameter(t.BLEND_SRC_RGB), z = t.getParameter(t.BLEND_DST_RGB), me = t.getParameter(t.BLEND_SRC_ALPHA), y = t.getParameter(t.BLEND_DST_ALPHA), b = t.getParameter(t.BLEND_EQUATION_RGB), E = t.getParameter(t.BLEND_EQUATION_ALPHA), V = t.isEnabled(t.DEPTH_TEST), H = t.isEnabled(t.SCISSOR_TEST), M = t.isEnabled(t.STENCIL_TEST), R = t.isEnabled(t.CULL_FACE), U = t.getParameter(t.COLOR_WRITEMASK), P = t.getParameter(t.UNPACK_FLIP_Y_WEBGL), B = N ? t.getParameter(qo) : null, $ = !N && it >= 0 ? Pi(t, it) : null, Y = !N && ot >= 0 ? Pi(t, ot) : null;
|
|
6617
|
+
t.bindFramebuffer(t.FRAMEBUFFER, null), t.viewport(0, 0, u, h), t.useProgram(Ue), t.enable(t.BLEND), t.blendEquation(t.FUNC_ADD), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), t.disable(t.DEPTH_TEST), t.disable(t.SCISSOR_TEST), t.disable(t.STENCIL_TEST), t.disable(t.CULL_FACE), t.colorMask(!0, !0, !0, !0), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, 0), t.bindTexture(t.TEXTURE_2D, i), t.uniform1i(t.getUniformLocation(Ue, "u_tex"), 0), t.uniform1f(t.getUniformLocation(Ue, "u_alpha"), 0.85);
|
|
6598
6618
|
const oe = new Float32Array([
|
|
6599
6619
|
g,
|
|
6600
|
-
|
|
6620
|
+
v,
|
|
6601
6621
|
0,
|
|
6602
6622
|
0,
|
|
6623
|
+
w,
|
|
6603
6624
|
v,
|
|
6604
|
-
E,
|
|
6605
6625
|
1,
|
|
6606
6626
|
0,
|
|
6607
6627
|
g,
|
|
@@ -6612,16 +6632,16 @@ function U1(t, e, n, r) {
|
|
|
6612
6632
|
D,
|
|
6613
6633
|
0,
|
|
6614
6634
|
1,
|
|
6635
|
+
w,
|
|
6615
6636
|
v,
|
|
6616
|
-
E,
|
|
6617
6637
|
1,
|
|
6618
6638
|
0,
|
|
6619
|
-
|
|
6639
|
+
w,
|
|
6620
6640
|
D,
|
|
6621
6641
|
1,
|
|
6622
6642
|
1
|
|
6623
6643
|
]);
|
|
6624
|
-
N ? (lt.bind(Ln), t.bindBuffer(t.ARRAY_BUFFER, zt), t.bufferData(t.ARRAY_BUFFER, oe, t.DYNAMIC_DRAW)) : (t.bindBuffer(t.ARRAY_BUFFER, zt), t.bufferData(t.ARRAY_BUFFER, oe, t.DYNAMIC_DRAW), it >= 0 && (t.enableVertexAttribArray(it), t.vertexAttribPointer(it, 2, t.FLOAT, !1, 16, 0)), ot >= 0 && (t.enableVertexAttribArray(ot), t.vertexAttribPointer(ot, 2, t.FLOAT, !1, 16, 8))), t.drawArrays(t.TRIANGLES, 0, 6), N ? lt.bind(B) : (Y && Di(t, Y), $ && Di(t, $)), t.bindFramebuffer(t.FRAMEBUFFER, O), t.viewport(J[0], J[1], J[2], J[3]), t.bindBuffer(t.ARRAY_BUFFER, j), t.colorMask(U[0], U[1], U[2], U[3]), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, P ? 1 : 0), H ? t.enable(t.SCISSOR_TEST) : t.disable(t.SCISSOR_TEST), M ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), R ? t.enable(t.CULL_FACE) : t.disable(t.CULL_FACE), V ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST), ae ? t.enable(t.BLEND) : t.disable(t.BLEND), t.blendFuncSeparate(ee, z, me, y), t.blendEquationSeparate(b,
|
|
6644
|
+
N ? (lt.bind(Ln), t.bindBuffer(t.ARRAY_BUFFER, zt), t.bufferData(t.ARRAY_BUFFER, oe, t.DYNAMIC_DRAW)) : (t.bindBuffer(t.ARRAY_BUFFER, zt), t.bufferData(t.ARRAY_BUFFER, oe, t.DYNAMIC_DRAW), it >= 0 && (t.enableVertexAttribArray(it), t.vertexAttribPointer(it, 2, t.FLOAT, !1, 16, 0)), ot >= 0 && (t.enableVertexAttribArray(ot), t.vertexAttribPointer(ot, 2, t.FLOAT, !1, 16, 8))), t.drawArrays(t.TRIANGLES, 0, 6), N ? lt.bind(B) : (Y && Di(t, Y), $ && Di(t, $)), t.bindFramebuffer(t.FRAMEBUFFER, O), t.viewport(J[0], J[1], J[2], J[3]), t.bindBuffer(t.ARRAY_BUFFER, j), t.colorMask(U[0], U[1], U[2], U[3]), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, P ? 1 : 0), H ? t.enable(t.SCISSOR_TEST) : t.disable(t.SCISSOR_TEST), M ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), R ? t.enable(t.CULL_FACE) : t.disable(t.CULL_FACE), V ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST), ae ? t.enable(t.BLEND) : t.disable(t.BLEND), t.blendFuncSeparate(ee, z, me, y), t.blendEquationSeparate(b, E), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, L), t.activeTexture(K), t.useProgram(W);
|
|
6625
6645
|
}
|
|
6626
6646
|
class Fn {
|
|
6627
6647
|
canvas = null;
|
|
@@ -6950,7 +6970,7 @@ class Fn {
|
|
|
6950
6970
|
if (!r) return;
|
|
6951
6971
|
const i = performance.now(), c = this.getContextAndFinish() ? performance.now() - i : this.fence2dCanvas(), u = r.lastTimestamp === null ? 0 : e - r.lastTimestamp;
|
|
6952
6972
|
r.lastTimestamp = e;
|
|
6953
|
-
const
|
|
6973
|
+
const h = this.capabilityMonitor.evaluate(
|
|
6954
6974
|
this.gatherCapabilityInput(e, n, u)
|
|
6955
6975
|
);
|
|
6956
6976
|
r.samples.push({
|
|
@@ -6959,7 +6979,7 @@ class Fn {
|
|
|
6959
6979
|
cpuMs: n,
|
|
6960
6980
|
gpuMs: c,
|
|
6961
6981
|
frameIntervalMs: u,
|
|
6962
|
-
capabilities:
|
|
6982
|
+
capabilities: h
|
|
6963
6983
|
}), r.remaining--, r.remaining <= 0 && (this.postMessage("run-fenced-benchmark-result", { id: r.id, frames: r.samples }), this.benchmark = null);
|
|
6964
6984
|
}
|
|
6965
6985
|
/**
|
|
@@ -7094,6 +7114,10 @@ class Fn {
|
|
|
7094
7114
|
sendAllParametersToHost() {
|
|
7095
7115
|
this.parameterSystem.sendAllParametersToHost();
|
|
7096
7116
|
}
|
|
7117
|
+
// Seed host-supplied initial parameter values before the first frame.
|
|
7118
|
+
seedInitialValues(e) {
|
|
7119
|
+
this.parameterSystem.seedInitialValues(e);
|
|
7120
|
+
}
|
|
7097
7121
|
setupMessageHandling() {
|
|
7098
7122
|
self.onmessage = (e) => {
|
|
7099
7123
|
this.dispatchMessage(e.data);
|
|
@@ -7407,8 +7431,8 @@ class Fn {
|
|
|
7407
7431
|
case "device":
|
|
7408
7432
|
if (i) {
|
|
7409
7433
|
this.deviceVideoMap.set(i, o);
|
|
7410
|
-
const
|
|
7411
|
-
|
|
7434
|
+
const h = this.viji.devices.find((f) => f.id === i);
|
|
7435
|
+
h && (h.video ? Object.assign(h.video, c.getVideoAPI()) : h.video = c.getVideoAPI());
|
|
7412
7436
|
}
|
|
7413
7437
|
break;
|
|
7414
7438
|
}
|
|
@@ -7498,9 +7522,9 @@ class Fn {
|
|
|
7498
7522
|
const j = e.data.resolution > 0 ? e.data.resolution : 1;
|
|
7499
7523
|
c = Math.max(1, Math.floor(i * j)), u = Math.max(1, Math.floor(o * j));
|
|
7500
7524
|
} else e.data.resolution && typeof e.data.resolution == "object" && (c = Math.max(1, Math.floor(e.data.resolution.width)), u = Math.max(1, Math.floor(e.data.resolution.height)));
|
|
7501
|
-
const
|
|
7502
|
-
let m = 0, g = 0,
|
|
7503
|
-
Math.abs(
|
|
7525
|
+
const h = i / o, f = c / u;
|
|
7526
|
+
let m = 0, g = 0, v = i, w = o;
|
|
7527
|
+
Math.abs(h - f) > 1e-6 && (f > h ? (w = Math.floor(i / f), g = Math.floor((o - w) / 2)) : (v = Math.floor(o * f), m = Math.floor((i - v) / 2)));
|
|
7504
7528
|
let D;
|
|
7505
7529
|
const N = this.getContextAndFinish();
|
|
7506
7530
|
if (N) {
|
|
@@ -7520,7 +7544,7 @@ class Fn {
|
|
|
7520
7544
|
D = this.canvas, this.debugLog("Captured frame from 2D canvas (post-render)");
|
|
7521
7545
|
const W = new OffscreenCanvas(c, u), K = W.getContext("2d");
|
|
7522
7546
|
if (!K) throw new Error("Failed to get 2D context");
|
|
7523
|
-
K.drawImage(D, m, g,
|
|
7547
|
+
K.drawImage(D, m, g, v, w, 0, 0, c, u);
|
|
7524
7548
|
const L = await W.convertToBlob({ type: r });
|
|
7525
7549
|
this.postMessage("capture-frame-result", { id: e.id, blob: L });
|
|
7526
7550
|
} catch (n) {
|
|
@@ -7532,7 +7556,7 @@ class Fn {
|
|
|
7532
7556
|
}
|
|
7533
7557
|
}
|
|
7534
7558
|
handleSetSceneCode(e) {
|
|
7535
|
-
e.data && e.data.sceneCode && self.setSceneCode(e.data.sceneCode);
|
|
7559
|
+
e.data && e.data.sceneCode && self.setSceneCode(e.data.sceneCode, e.data.initialParameters);
|
|
7536
7560
|
}
|
|
7537
7561
|
startRenderLoop() {
|
|
7538
7562
|
this.isRunning = !0, this.startTime = performance.now(), this.lastTime = this.startTime, this.renderFrame();
|
|
@@ -7562,15 +7586,15 @@ class Fn {
|
|
|
7562
7586
|
}
|
|
7563
7587
|
c = !0;
|
|
7564
7588
|
} catch (u) {
|
|
7565
|
-
const
|
|
7566
|
-
console.error("Render error:",
|
|
7567
|
-
message:
|
|
7568
|
-
...
|
|
7589
|
+
const h = u;
|
|
7590
|
+
console.error("Render error:", h), this.sceneErrorReporter ? this.sceneErrorReporter.reportSceneError({
|
|
7591
|
+
message: h.message,
|
|
7592
|
+
...h.stack !== void 0 && { stack: h.stack },
|
|
7569
7593
|
code: "RENDER_ERROR"
|
|
7570
7594
|
}) : this.postMessage("error", {
|
|
7571
|
-
message:
|
|
7595
|
+
message: h.message,
|
|
7572
7596
|
code: "RENDER_ERROR",
|
|
7573
|
-
stack:
|
|
7597
|
+
stack: h.stack
|
|
7574
7598
|
});
|
|
7575
7599
|
}
|
|
7576
7600
|
if (c && this.sceneErrorReporter && this.sceneErrorReporter.markFirstFrameProduced(), this.benchmark) {
|
|
@@ -7583,23 +7607,23 @@ class Fn {
|
|
|
7583
7607
|
if (this.parameterSystem.resetButtonParameters(), this.pendingCaptures.length > 0) {
|
|
7584
7608
|
const u = [...this.pendingCaptures];
|
|
7585
7609
|
this.pendingCaptures = [];
|
|
7586
|
-
for (const
|
|
7587
|
-
this.executeCaptureFrame(
|
|
7588
|
-
console.error("Capture execution error:",
|
|
7610
|
+
for (const h of u)
|
|
7611
|
+
this.executeCaptureFrame(h).catch((f) => {
|
|
7612
|
+
console.error("Capture execution error:", f);
|
|
7589
7613
|
});
|
|
7590
7614
|
}
|
|
7591
7615
|
if (this.autoCaptureEnabled && this.canvas)
|
|
7592
7616
|
try {
|
|
7593
7617
|
if (this.canvas.getContext("2d") || this.canvas.getContext("webgl2") || this.canvas.getContext("webgl")) {
|
|
7594
|
-
const
|
|
7595
|
-
createImageBitmap(this.canvas,
|
|
7618
|
+
const h = this.autoCaptureFormat.flipY ? { imageOrientation: "flipY" } : {};
|
|
7619
|
+
createImageBitmap(this.canvas, h).then((f) => {
|
|
7596
7620
|
this.postMessage(
|
|
7597
7621
|
"auto-capture-result",
|
|
7598
|
-
{ bitmap:
|
|
7599
|
-
[
|
|
7622
|
+
{ bitmap: f, timestamp: performance.now() },
|
|
7623
|
+
[f]
|
|
7600
7624
|
);
|
|
7601
|
-
}).catch((
|
|
7602
|
-
console.warn("[AutoCapture] ImageBitmap creation failed:",
|
|
7625
|
+
}).catch((f) => {
|
|
7626
|
+
console.warn("[AutoCapture] ImageBitmap creation failed:", f);
|
|
7603
7627
|
});
|
|
7604
7628
|
} else
|
|
7605
7629
|
this.debugMode && this.frameCount % 60 === 0 && this.debugLog("[AutoCapture] No context yet, skipping capture");
|
|
@@ -7670,18 +7694,18 @@ class Fn {
|
|
|
7670
7694
|
handleDeviceStateUpdate(e) {
|
|
7671
7695
|
this.deviceState = e.data, this.viji.device = this.deviceState.device;
|
|
7672
7696
|
const n = this.deviceState.devices.map((r) => {
|
|
7673
|
-
const i = this.viji.devices.find((m) => m.id === r.id), o = this.deviceVideoMap.get(r.id), c = o !== void 0 ? this.videoSystems[o] : void 0, u = this.deviceAudioMap.get(r.id),
|
|
7674
|
-
isConnected:
|
|
7675
|
-
volume:
|
|
7676
|
-
bands:
|
|
7677
|
-
spectral:
|
|
7678
|
-
getFrequencyData: () =>
|
|
7679
|
-
getWaveform: () =>
|
|
7697
|
+
const i = this.viji.devices.find((m) => m.id === r.id), o = this.deviceVideoMap.get(r.id), c = o !== void 0 ? this.videoSystems[o] : void 0, u = this.deviceAudioMap.get(r.id), h = u !== void 0 ? this.audioStreamStates.get(u) : void 0, f = h ? {
|
|
7698
|
+
isConnected: h.isConnected,
|
|
7699
|
+
volume: h.volume,
|
|
7700
|
+
bands: h.bands,
|
|
7701
|
+
spectral: h.spectral,
|
|
7702
|
+
getFrequencyData: () => h.frequencyData,
|
|
7703
|
+
getWaveform: () => h.waveformData
|
|
7680
7704
|
} : null;
|
|
7681
|
-
return i ? (i.name = r.name, i.motion = r.motion, i.orientation = r.orientation,
|
|
7705
|
+
return i ? (i.name = r.name, i.motion = r.motion, i.orientation = r.orientation, f && (i.audio = f), i) : {
|
|
7682
7706
|
...r,
|
|
7683
7707
|
video: c ? c.getVideoAPI() : null,
|
|
7684
|
-
audio:
|
|
7708
|
+
audio: f
|
|
7685
7709
|
};
|
|
7686
7710
|
});
|
|
7687
7711
|
this.viji.devices = n;
|
|
@@ -7884,12 +7908,12 @@ function j1(t, e, n) {
|
|
|
7884
7908
|
const i = n - 1;
|
|
7885
7909
|
let o = 0, c = r.length - 1, u = -1;
|
|
7886
7910
|
for (; o <= c; ) {
|
|
7887
|
-
const
|
|
7888
|
-
r[
|
|
7911
|
+
const f = o + c >>> 1;
|
|
7912
|
+
r[f].generatedColumn <= i ? (u = f, o = f + 1) : c = f - 1;
|
|
7889
7913
|
}
|
|
7890
7914
|
if (u < 0) return null;
|
|
7891
|
-
const
|
|
7892
|
-
return
|
|
7915
|
+
const h = r[u];
|
|
7916
|
+
return h.sourceLine === void 0 || h.sourceColumn === void 0 ? null : { line: h.sourceLine + 1, column: h.sourceColumn + 1 };
|
|
7893
7917
|
}
|
|
7894
7918
|
const $1 = {
|
|
7895
7919
|
errorCoalescingWindowMs: 1e3,
|
|
@@ -8027,16 +8051,16 @@ class q1 {
|
|
|
8027
8051
|
}
|
|
8028
8052
|
this.rateCapSignaturesInWindow++;
|
|
8029
8053
|
}
|
|
8030
|
-
const
|
|
8054
|
+
const h = this.resolveCallSiteLocation(), f = {
|
|
8031
8055
|
level: e,
|
|
8032
8056
|
args: i,
|
|
8033
8057
|
signatureHash: o,
|
|
8034
8058
|
count: 1,
|
|
8035
8059
|
firstSeenAt: 0,
|
|
8036
8060
|
lastSeenAt: 0,
|
|
8037
|
-
...
|
|
8061
|
+
...h !== void 0 && { sourceLocation: h }
|
|
8038
8062
|
};
|
|
8039
|
-
this.consoleChannel.emit(o,
|
|
8063
|
+
this.consoleChannel.emit(o, f);
|
|
8040
8064
|
}
|
|
8041
8065
|
emitSuppressionNotice() {
|
|
8042
8066
|
const n = {
|
|
@@ -8099,8 +8123,8 @@ class q1 {
|
|
|
8099
8123
|
for (const c of o) {
|
|
8100
8124
|
const u = c.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);
|
|
8101
8125
|
if (!u) continue;
|
|
8102
|
-
const
|
|
8103
|
-
this.functionBodyLineOffset =
|
|
8126
|
+
const h = parseInt(u[2], 10);
|
|
8127
|
+
this.functionBodyLineOffset = h - 1, this.functionBodySourceId = u[1];
|
|
8104
8128
|
return;
|
|
8105
8129
|
}
|
|
8106
8130
|
}
|
|
@@ -8207,19 +8231,19 @@ var d;
|
|
|
8207
8231
|
t[t._asserts = c] = "_asserts";
|
|
8208
8232
|
const u = c + 1;
|
|
8209
8233
|
t[t._async = u] = "_async";
|
|
8210
|
-
const
|
|
8211
|
-
t[t._await =
|
|
8212
|
-
const
|
|
8213
|
-
t[t._checks =
|
|
8214
|
-
const m =
|
|
8234
|
+
const h = u + 1;
|
|
8235
|
+
t[t._await = h] = "_await";
|
|
8236
|
+
const f = h + 1;
|
|
8237
|
+
t[t._checks = f] = "_checks";
|
|
8238
|
+
const m = f + 1;
|
|
8215
8239
|
t[t._constructor = m] = "_constructor";
|
|
8216
8240
|
const g = m + 1;
|
|
8217
8241
|
t[t._declare = g] = "_declare";
|
|
8218
|
-
const
|
|
8219
|
-
t[t._enum =
|
|
8220
|
-
const
|
|
8221
|
-
t[t._exports =
|
|
8222
|
-
const D =
|
|
8242
|
+
const v = g + 1;
|
|
8243
|
+
t[t._enum = v] = "_enum";
|
|
8244
|
+
const w = v + 1;
|
|
8245
|
+
t[t._exports = w] = "_exports";
|
|
8246
|
+
const D = w + 1;
|
|
8223
8247
|
t[t._from = D] = "_from";
|
|
8224
8248
|
const N = D + 1;
|
|
8225
8249
|
t[t._get = N] = "_get";
|
|
@@ -8247,9 +8271,9 @@ var d;
|
|
|
8247
8271
|
t[t._opaque = y] = "_opaque";
|
|
8248
8272
|
const b = y + 1;
|
|
8249
8273
|
t[t._out = b] = "_out";
|
|
8250
|
-
const
|
|
8251
|
-
t[t._override =
|
|
8252
|
-
const V =
|
|
8274
|
+
const E = b + 1;
|
|
8275
|
+
t[t._override = E] = "_override";
|
|
8276
|
+
const V = E + 1;
|
|
8253
8277
|
t[t._private = V] = "_private";
|
|
8254
8278
|
const H = V + 1;
|
|
8255
8279
|
t[t._protected = H] = "_protected";
|
|
@@ -8291,18 +8315,18 @@ var s;
|
|
|
8291
8315
|
t[t.IS_POSTFIX = c] = "IS_POSTFIX";
|
|
8292
8316
|
const u = 512;
|
|
8293
8317
|
t[t.IS_EXPRESSION_START = u] = "IS_EXPRESSION_START";
|
|
8294
|
-
const
|
|
8295
|
-
t[t.num =
|
|
8296
|
-
const
|
|
8297
|
-
t[t.bigint =
|
|
8318
|
+
const h = 512;
|
|
8319
|
+
t[t.num = h] = "num";
|
|
8320
|
+
const f = 1536;
|
|
8321
|
+
t[t.bigint = f] = "bigint";
|
|
8298
8322
|
const m = 2560;
|
|
8299
8323
|
t[t.decimal = m] = "decimal";
|
|
8300
8324
|
const g = 3584;
|
|
8301
8325
|
t[t.regexp = g] = "regexp";
|
|
8302
|
-
const
|
|
8303
|
-
t[t.string =
|
|
8304
|
-
const
|
|
8305
|
-
t[t.name =
|
|
8326
|
+
const v = 4608;
|
|
8327
|
+
t[t.string = v] = "string";
|
|
8328
|
+
const w = 5632;
|
|
8329
|
+
t[t.name = w] = "name";
|
|
8306
8330
|
const D = 6144;
|
|
8307
8331
|
t[t.eof = D] = "eof";
|
|
8308
8332
|
const N = 7680;
|
|
@@ -8331,8 +8355,8 @@ var s;
|
|
|
8331
8355
|
t[t.doubleColon = y] = "doubleColon";
|
|
8332
8356
|
const b = 19456;
|
|
8333
8357
|
t[t.dot = b] = "dot";
|
|
8334
|
-
const
|
|
8335
|
-
t[t.question =
|
|
8358
|
+
const E = 20480;
|
|
8359
|
+
t[t.question = E] = "question";
|
|
8336
8360
|
const V = 21504;
|
|
8337
8361
|
t[t.questionDot = V] = "questionDot";
|
|
8338
8362
|
const H = 22528;
|
|
@@ -8756,8 +8780,8 @@ class nt {
|
|
|
8756
8780
|
}
|
|
8757
8781
|
}
|
|
8758
8782
|
class X1 {
|
|
8759
|
-
constructor(e, n, r, i, o, c, u,
|
|
8760
|
-
this.potentialArrowAt = e, this.noAnonFunctionType = n, this.inDisallowConditionalTypesContext = r, this.tokensLength = i, this.scopesLength = o, this.pos = c, this.type = u, this.contextualKeyword =
|
|
8783
|
+
constructor(e, n, r, i, o, c, u, h, f, m, g, v, w) {
|
|
8784
|
+
this.potentialArrowAt = e, this.noAnonFunctionType = n, this.inDisallowConditionalTypesContext = r, this.tokensLength = i, this.scopesLength = o, this.pos = c, this.type = u, this.contextualKeyword = h, this.start = f, this.end = m, this.isType = g, this.scopeDepth = v, this.error = w;
|
|
8761
8785
|
}
|
|
8762
8786
|
}
|
|
8763
8787
|
class Le {
|
|
@@ -8854,18 +8878,18 @@ var p;
|
|
|
8854
8878
|
t[t.space = c] = "space";
|
|
8855
8879
|
const u = 33;
|
|
8856
8880
|
t[t.exclamationMark = u] = "exclamationMark";
|
|
8857
|
-
const
|
|
8858
|
-
t[t.quotationMark =
|
|
8859
|
-
const
|
|
8860
|
-
t[t.numberSign =
|
|
8881
|
+
const h = 34;
|
|
8882
|
+
t[t.quotationMark = h] = "quotationMark";
|
|
8883
|
+
const f = 35;
|
|
8884
|
+
t[t.numberSign = f] = "numberSign";
|
|
8861
8885
|
const m = 36;
|
|
8862
8886
|
t[t.dollarSign = m] = "dollarSign";
|
|
8863
8887
|
const g = 37;
|
|
8864
8888
|
t[t.percentSign = g] = "percentSign";
|
|
8865
|
-
const
|
|
8866
|
-
t[t.ampersand =
|
|
8867
|
-
const
|
|
8868
|
-
t[t.apostrophe =
|
|
8889
|
+
const v = 38;
|
|
8890
|
+
t[t.ampersand = v] = "ampersand";
|
|
8891
|
+
const w = 39;
|
|
8892
|
+
t[t.apostrophe = w] = "apostrophe";
|
|
8869
8893
|
const D = 40;
|
|
8870
8894
|
t[t.leftParenthesis = D] = "leftParenthesis";
|
|
8871
8895
|
const N = 41;
|
|
@@ -8894,8 +8918,8 @@ var p;
|
|
|
8894
8918
|
t[t.digit4 = y] = "digit4";
|
|
8895
8919
|
const b = 53;
|
|
8896
8920
|
t[t.digit5 = b] = "digit5";
|
|
8897
|
-
const
|
|
8898
|
-
t[t.digit6 =
|
|
8921
|
+
const E = 54;
|
|
8922
|
+
t[t.digit6 = E] = "digit6";
|
|
8899
8923
|
const V = 55;
|
|
8900
8924
|
t[t.digit7 = V] = "digit7";
|
|
8901
8925
|
const H = 56;
|
|
@@ -9173,16 +9197,16 @@ function Q1(t) {
|
|
|
9173
9197
|
if (t < 128) return !1;
|
|
9174
9198
|
throw new Error("Should not be called with non-ASCII char code.");
|
|
9175
9199
|
}
|
|
9176
|
-
const
|
|
9200
|
+
const Xe = new Uint8Array(65536);
|
|
9177
9201
|
for (let t = 0; t < 128; t++)
|
|
9178
|
-
|
|
9202
|
+
Xe[t] = Q1(t) ? 1 : 0;
|
|
9179
9203
|
for (let t = 128; t < 65536; t++)
|
|
9180
|
-
|
|
9204
|
+
Xe[t] = 1;
|
|
9181
9205
|
for (const t of Go)
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
const un =
|
|
9206
|
+
Xe[t] = 0;
|
|
9207
|
+
Xe[8232] = 0;
|
|
9208
|
+
Xe[8233] = 0;
|
|
9209
|
+
const un = Xe.slice();
|
|
9186
9210
|
for (let t = p.digit0; t <= p.digit9; t++)
|
|
9187
9211
|
un[t] = 0;
|
|
9188
9212
|
const Oi = new Int32Array([
|
|
@@ -18492,13 +18516,13 @@ function J1() {
|
|
|
18492
18516
|
t = i, n++;
|
|
18493
18517
|
}
|
|
18494
18518
|
const r = Oi[t];
|
|
18495
|
-
if (r > -1 && !
|
|
18519
|
+
if (r > -1 && !Xe[e]) {
|
|
18496
18520
|
a.pos = n, r & 1 ? te(r >>> 1) : te(s.name, r >>> 1);
|
|
18497
18521
|
return;
|
|
18498
18522
|
}
|
|
18499
18523
|
for (; n < C.length; ) {
|
|
18500
18524
|
const i = C.charCodeAt(n);
|
|
18501
|
-
if (
|
|
18525
|
+
if (Xe[i])
|
|
18502
18526
|
n++;
|
|
18503
18527
|
else if (i === p.backslash) {
|
|
18504
18528
|
if (n += 2, C.charCodeAt(n) === p.leftCurlyBrace) {
|
|
@@ -18528,18 +18552,18 @@ var X;
|
|
|
18528
18552
|
t[t.ObjectShorthandTopLevelDeclaration = c] = "ObjectShorthandTopLevelDeclaration";
|
|
18529
18553
|
const u = c + 1;
|
|
18530
18554
|
t[t.ObjectShorthandFunctionScopedDeclaration = u] = "ObjectShorthandFunctionScopedDeclaration";
|
|
18531
|
-
const
|
|
18532
|
-
t[t.ObjectShorthandBlockScopedDeclaration =
|
|
18533
|
-
const
|
|
18534
|
-
t[t.ObjectShorthand =
|
|
18535
|
-
const m =
|
|
18555
|
+
const h = u + 1;
|
|
18556
|
+
t[t.ObjectShorthandBlockScopedDeclaration = h] = "ObjectShorthandBlockScopedDeclaration";
|
|
18557
|
+
const f = h + 1;
|
|
18558
|
+
t[t.ObjectShorthand = f] = "ObjectShorthand";
|
|
18559
|
+
const m = f + 1;
|
|
18536
18560
|
t[t.ImportDeclaration = m] = "ImportDeclaration";
|
|
18537
18561
|
const g = m + 1;
|
|
18538
18562
|
t[t.ObjectKey = g] = "ObjectKey";
|
|
18539
|
-
const
|
|
18540
|
-
t[t.ImportAccess =
|
|
18563
|
+
const v = g + 1;
|
|
18564
|
+
t[t.ImportAccess = v] = "ImportAccess";
|
|
18541
18565
|
})(X || (X = {}));
|
|
18542
|
-
var
|
|
18566
|
+
var He;
|
|
18543
18567
|
(function(t) {
|
|
18544
18568
|
t[t.NoChildren = 0] = "NoChildren";
|
|
18545
18569
|
const n = 1;
|
|
@@ -18548,7 +18572,7 @@ var We;
|
|
|
18548
18572
|
t[t.StaticChildren = r] = "StaticChildren";
|
|
18549
18573
|
const i = r + 1;
|
|
18550
18574
|
t[t.KeyAfterPropSpread = i] = "KeyAfterPropSpread";
|
|
18551
|
-
})(
|
|
18575
|
+
})(He || (He = {}));
|
|
18552
18576
|
function zo(t) {
|
|
18553
18577
|
const e = t.identifierRole;
|
|
18554
18578
|
return e === X.TopLevelDeclaration || e === X.FunctionScopedDeclaration || e === X.BlockScopedDeclaration || e === X.ObjectShorthandTopLevelDeclaration || e === X.ObjectShorthandFunctionScopedDeclaration || e === X.ObjectShorthandBlockScopedDeclaration;
|
|
@@ -19002,7 +19026,7 @@ function ku() {
|
|
|
19002
19026
|
function vu() {
|
|
19003
19027
|
for (; a.pos < C.length; ) {
|
|
19004
19028
|
const t = C.charCodeAt(a.pos);
|
|
19005
|
-
if (
|
|
19029
|
+
if (Xe[t])
|
|
19006
19030
|
a.pos++;
|
|
19007
19031
|
else if (t === p.backslash) {
|
|
19008
19032
|
if (a.pos += 2, C.charCodeAt(a.pos) === p.leftCurlyBrace) {
|
|
@@ -19315,7 +19339,7 @@ function Bi(t) {
|
|
|
19315
19339
|
let e = t.indexOf(".");
|
|
19316
19340
|
return e === -1 && (e = t.length), [t.slice(0, e), t.slice(e)];
|
|
19317
19341
|
}
|
|
19318
|
-
class
|
|
19342
|
+
class ze {
|
|
19319
19343
|
// Return true if anything was processed, false otherwise.
|
|
19320
19344
|
getPrefixCode() {
|
|
19321
19345
|
return "";
|
|
@@ -19327,7 +19351,7 @@ class Xe {
|
|
|
19327
19351
|
return "";
|
|
19328
19352
|
}
|
|
19329
19353
|
}
|
|
19330
|
-
class _t extends
|
|
19354
|
+
class _t extends ze {
|
|
19331
19355
|
// State for calculating the line number of each JSX tag in development.
|
|
19332
19356
|
__init() {
|
|
19333
19357
|
this.lastLineNumber = 1;
|
|
@@ -19374,7 +19398,7 @@ class _t extends Xe {
|
|
|
19374
19398
|
}
|
|
19375
19399
|
processJSXTag() {
|
|
19376
19400
|
const { jsxRole: e, start: n } = this.tokens.currentToken(), r = this.options.production ? null : this.getElementLocationCode(n);
|
|
19377
|
-
this.isAutomaticRuntime && e !==
|
|
19401
|
+
this.isAutomaticRuntime && e !== He.KeyAfterPropSpread ? this.transformTagToJSXFunc(r, e) : this.transformTagToCreateElement(r);
|
|
19378
19402
|
}
|
|
19379
19403
|
getElementLocationCode(e) {
|
|
19380
19404
|
return `lineNumber: ${this.getLineNumberForIndex(e)}`;
|
|
@@ -19400,7 +19424,7 @@ class _t extends Xe {
|
|
|
19400
19424
|
* jsxs('div', {a: 1, children: ["Hello", x]}, 2)
|
|
19401
19425
|
*/
|
|
19402
19426
|
transformTagToJSXFunc(e, n) {
|
|
19403
|
-
const r = n ===
|
|
19427
|
+
const r = n === He.StaticChildren;
|
|
19404
19428
|
this.tokens.replaceToken(this.getJSXFuncInvocationCode(r));
|
|
19405
19429
|
let i = null;
|
|
19406
19430
|
if (this.tokens.matches1(s.jsxTagEnd))
|
|
@@ -19580,7 +19604,7 @@ class _t extends Xe {
|
|
|
19580
19604
|
* prop for the children and close the object literal.
|
|
19581
19605
|
*/
|
|
19582
19606
|
processAutomaticChildrenAndEndProps(e) {
|
|
19583
|
-
e ===
|
|
19607
|
+
e === He.StaticChildren ? (this.tokens.appendCode(" children: ["), this.processChildren(!1), this.tokens.appendCode("]}")) : (e === He.OneChild && this.tokens.appendCode(" children: "), this.processChildren(!1), this.tokens.appendCode("}"));
|
|
19584
19608
|
}
|
|
19585
19609
|
/**
|
|
19586
19610
|
* Transform children into a comma-separated list, which will be either
|
|
@@ -19635,8 +19659,8 @@ function Eu(t) {
|
|
|
19635
19659
|
n = "", r = !0;
|
|
19636
19660
|
else {
|
|
19637
19661
|
if (i && r && (e += " "), e += n, n = "", c === "&") {
|
|
19638
|
-
const { entity: u, newI:
|
|
19639
|
-
o =
|
|
19662
|
+
const { entity: u, newI: h } = ca(t, o + 1);
|
|
19663
|
+
o = h - 1, e += u;
|
|
19640
19664
|
} else
|
|
19641
19665
|
e += c;
|
|
19642
19666
|
i = !0, r = !1;
|
|
@@ -19685,8 +19709,8 @@ function ca(t, e) {
|
|
|
19685
19709
|
for (u = o; o < t.length && Su(t.charCodeAt(o)); )
|
|
19686
19710
|
o++;
|
|
19687
19711
|
if (t[o] === ";") {
|
|
19688
|
-
const
|
|
19689
|
-
|
|
19712
|
+
const h = t.slice(u, o);
|
|
19713
|
+
h && (o++, i = String.fromCodePoint(parseInt(h, c)));
|
|
19690
19714
|
}
|
|
19691
19715
|
} else
|
|
19692
19716
|
for (; o < t.length && r++ < 10; ) {
|
|
@@ -19767,39 +19791,39 @@ class kt {
|
|
|
19767
19791
|
namedImports: o,
|
|
19768
19792
|
namedExports: c,
|
|
19769
19793
|
exportStarNames: u,
|
|
19770
|
-
hasStarExport:
|
|
19794
|
+
hasStarExport: h
|
|
19771
19795
|
} = n;
|
|
19772
|
-
if (r.length === 0 && i.length === 0 && o.length === 0 && c.length === 0 && u.length === 0 && !
|
|
19796
|
+
if (r.length === 0 && i.length === 0 && o.length === 0 && c.length === 0 && u.length === 0 && !h) {
|
|
19773
19797
|
this.importsToReplace.set(e, `require('${e}');`);
|
|
19774
19798
|
continue;
|
|
19775
19799
|
}
|
|
19776
|
-
const
|
|
19800
|
+
const f = this.getFreeIdentifierForPath(e);
|
|
19777
19801
|
let m;
|
|
19778
|
-
this.enableLegacyTypeScriptModuleInterop ? m =
|
|
19779
|
-
let g = `var ${
|
|
19802
|
+
this.enableLegacyTypeScriptModuleInterop ? m = f : m = i.length > 0 ? i[0] : this.getFreeIdentifierForPath(e);
|
|
19803
|
+
let g = `var ${f} = require('${e}');`;
|
|
19780
19804
|
if (i.length > 0)
|
|
19781
|
-
for (const
|
|
19782
|
-
const
|
|
19783
|
-
g += ` var ${
|
|
19805
|
+
for (const v of i) {
|
|
19806
|
+
const w = this.enableLegacyTypeScriptModuleInterop ? f : `${this.helperManager.getHelperName("interopRequireWildcard")}(${f})`;
|
|
19807
|
+
g += ` var ${v} = ${w};`;
|
|
19784
19808
|
}
|
|
19785
|
-
else u.length > 0 && m !==
|
|
19809
|
+
else u.length > 0 && m !== f ? g += ` var ${m} = ${this.helperManager.getHelperName(
|
|
19786
19810
|
"interopRequireWildcard"
|
|
19787
|
-
)}(${
|
|
19811
|
+
)}(${f});` : r.length > 0 && m !== f && (g += ` var ${m} = ${this.helperManager.getHelperName(
|
|
19788
19812
|
"interopRequireDefault"
|
|
19789
|
-
)}(${
|
|
19790
|
-
for (const { importedName:
|
|
19813
|
+
)}(${f});`);
|
|
19814
|
+
for (const { importedName: v, localName: w } of c)
|
|
19791
19815
|
g += ` ${this.helperManager.getHelperName(
|
|
19792
19816
|
"createNamedExportFrom"
|
|
19793
|
-
)}(${
|
|
19794
|
-
for (const
|
|
19795
|
-
g += ` exports.${
|
|
19796
|
-
|
|
19817
|
+
)}(${f}, '${w}', '${v}');`;
|
|
19818
|
+
for (const v of u)
|
|
19819
|
+
g += ` exports.${v} = ${m};`;
|
|
19820
|
+
h && (g += ` ${this.helperManager.getHelperName(
|
|
19797
19821
|
"createStarExport"
|
|
19798
|
-
)}(${
|
|
19799
|
-
for (const
|
|
19800
|
-
this.identifierReplacements.set(
|
|
19801
|
-
for (const { importedName:
|
|
19802
|
-
this.identifierReplacements.set(
|
|
19822
|
+
)}(${f});`), this.importsToReplace.set(e, g);
|
|
19823
|
+
for (const v of r)
|
|
19824
|
+
this.identifierReplacements.set(v, `${m}.default`);
|
|
19825
|
+
for (const { importedName: v, localName: w } of o)
|
|
19826
|
+
this.identifierReplacements.set(w, `${f}.${v}`);
|
|
19803
19827
|
}
|
|
19804
19828
|
}
|
|
19805
19829
|
getFreeIdentifierForPath(e) {
|
|
@@ -19813,8 +19837,8 @@ class kt {
|
|
|
19813
19837
|
if (this.tokens.matches1AtIndex(e, s.name) && (n.push(this.tokens.identifierNameAtIndex(e)), e++, this.tokens.matches1AtIndex(e, s.comma) && e++), this.tokens.matches1AtIndex(e, s.star) && (e += 2, r.push(this.tokens.identifierNameAtIndex(e)), e++), this.tokens.matches1AtIndex(e, s.braceL)) {
|
|
19814
19838
|
const u = this.getNamedImports(e + 1);
|
|
19815
19839
|
e = u.newIndex;
|
|
19816
|
-
for (const
|
|
19817
|
-
|
|
19840
|
+
for (const h of u.namedImports)
|
|
19841
|
+
h.importedName === "default" ? n.push(h.localName) : i.push(h);
|
|
19818
19842
|
}
|
|
19819
19843
|
if (this.tokens.matchesContextualAtIndex(e, d._from) && e++, !this.tokens.matches1AtIndex(e, s.string))
|
|
19820
19844
|
throw new Error("Expected string token at the end of import statement.");
|
|
@@ -20002,10 +20026,10 @@ function Lu(t) {
|
|
|
20002
20026
|
for (let c = 0; c < t.length; c++) {
|
|
20003
20027
|
const u = t[c];
|
|
20004
20028
|
if (c > 0 && e.write(Iu), u.length === 0) continue;
|
|
20005
|
-
let
|
|
20006
|
-
for (let
|
|
20007
|
-
const m = u[
|
|
20008
|
-
|
|
20029
|
+
let h = 0;
|
|
20030
|
+
for (let f = 0; f < u.length; f++) {
|
|
20031
|
+
const m = u[f];
|
|
20032
|
+
f > 0 && e.write(Au), h = Ht(e, m[0], h), m.length !== 1 && (n = Ht(e, m[1], n), r = Ht(e, m[2], r), i = Ht(e, m[3], i), m.length !== 4 && (o = Ht(e, m[4], o)));
|
|
20009
20033
|
}
|
|
20010
20034
|
}
|
|
20011
20035
|
return e.flush();
|
|
@@ -20025,21 +20049,21 @@ var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
20025
20049
|
function u(L) {
|
|
20026
20050
|
return L.startsWith("/");
|
|
20027
20051
|
}
|
|
20028
|
-
function
|
|
20052
|
+
function h(L) {
|
|
20029
20053
|
return L.startsWith("file:");
|
|
20030
20054
|
}
|
|
20031
|
-
function
|
|
20055
|
+
function f(L) {
|
|
20032
20056
|
return /^[.?#]/.test(L);
|
|
20033
20057
|
}
|
|
20034
20058
|
function m(L) {
|
|
20035
20059
|
const j = r.exec(L);
|
|
20036
|
-
return
|
|
20060
|
+
return v(j[1], j[2] || "", j[3], j[4] || "", j[5] || "/", j[6] || "", j[7] || "");
|
|
20037
20061
|
}
|
|
20038
20062
|
function g(L) {
|
|
20039
20063
|
const j = i.exec(L), O = j[2];
|
|
20040
|
-
return
|
|
20064
|
+
return v("file:", "", j[1] || "", "", u(O) ? O : "/" + O, j[3] || "", j[4] || "");
|
|
20041
20065
|
}
|
|
20042
|
-
function
|
|
20066
|
+
function v(L, j, O, J, ae, ee, z) {
|
|
20043
20067
|
return {
|
|
20044
20068
|
scheme: L,
|
|
20045
20069
|
user: j,
|
|
@@ -20051,7 +20075,7 @@ var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
20051
20075
|
type: 7
|
|
20052
20076
|
};
|
|
20053
20077
|
}
|
|
20054
|
-
function
|
|
20078
|
+
function w(L) {
|
|
20055
20079
|
if (c(L)) {
|
|
20056
20080
|
const O = m("http:" + L);
|
|
20057
20081
|
return O.scheme = "", O.type = 6, O;
|
|
@@ -20060,7 +20084,7 @@ var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
20060
20084
|
const O = m("http://foo.com" + L);
|
|
20061
20085
|
return O.scheme = "", O.host = "", O.type = 5, O;
|
|
20062
20086
|
}
|
|
20063
|
-
if (
|
|
20087
|
+
if (h(L))
|
|
20064
20088
|
return g(L);
|
|
20065
20089
|
if (o(L))
|
|
20066
20090
|
return m(L);
|
|
@@ -20101,10 +20125,10 @@ var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
20101
20125
|
function K(L, j) {
|
|
20102
20126
|
if (!L && !j)
|
|
20103
20127
|
return "";
|
|
20104
|
-
const O =
|
|
20128
|
+
const O = w(L);
|
|
20105
20129
|
let J = O.type;
|
|
20106
20130
|
if (j && J !== 7) {
|
|
20107
|
-
const ee =
|
|
20131
|
+
const ee = w(j), z = ee.type;
|
|
20108
20132
|
switch (J) {
|
|
20109
20133
|
case 1:
|
|
20110
20134
|
O.hash = ee.hash;
|
|
@@ -20128,7 +20152,7 @@ var xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
20128
20152
|
return ae;
|
|
20129
20153
|
case 4: {
|
|
20130
20154
|
const ee = O.path.slice(1);
|
|
20131
|
-
return ee ?
|
|
20155
|
+
return ee ? f(j || L) && !f(ee) ? "./" + ee + ae : ee + ae : ae || ".";
|
|
20132
20156
|
}
|
|
20133
20157
|
case 5:
|
|
20134
20158
|
return O.path + ae;
|
|
@@ -20198,20 +20222,20 @@ function $u(t) {
|
|
|
20198
20222
|
mappings: Lu(e.mappings)
|
|
20199
20223
|
});
|
|
20200
20224
|
}
|
|
20201
|
-
function qu(t, e, n, r, i, o, c, u,
|
|
20225
|
+
function qu(t, e, n, r, i, o, c, u, h) {
|
|
20202
20226
|
const {
|
|
20203
|
-
_mappings:
|
|
20227
|
+
_mappings: f,
|
|
20204
20228
|
_sources: m,
|
|
20205
20229
|
_sourcesContent: g,
|
|
20206
|
-
_names:
|
|
20230
|
+
_names: v
|
|
20207
20231
|
// _originalScopes: originalScopes,
|
|
20208
|
-
} = e,
|
|
20232
|
+
} = e, w = Wu(f, n), D = Hu(w, r);
|
|
20209
20233
|
if (!i)
|
|
20210
|
-
return Xu(
|
|
20234
|
+
return Xu(w, D) ? void 0 : Wi(w, D, [r]);
|
|
20211
20235
|
const N = Du(m, i), W = ha;
|
|
20212
|
-
if (N === g.length && (g[N] = null), !zu(
|
|
20236
|
+
if (N === g.length && (g[N] = null), !zu(w, D, N, o, c, W))
|
|
20213
20237
|
return Wi(
|
|
20214
|
-
|
|
20238
|
+
w,
|
|
20215
20239
|
D,
|
|
20216
20240
|
[r, N, o, c]
|
|
20217
20241
|
);
|
|
@@ -20251,20 +20275,20 @@ function zu(t, e, n, r, i, o) {
|
|
|
20251
20275
|
}
|
|
20252
20276
|
function Yu({ code: t, mappings: e }, n, r, i, o) {
|
|
20253
20277
|
const c = Ku(i, o), u = new Vu({ file: r.compiledFilename });
|
|
20254
|
-
let
|
|
20255
|
-
for (;
|
|
20256
|
-
|
|
20278
|
+
let h = 0, f = e[0];
|
|
20279
|
+
for (; f === void 0 && h < e.length - 1; )
|
|
20280
|
+
h++, f = e[h];
|
|
20257
20281
|
let m = 0, g = 0;
|
|
20258
|
-
|
|
20282
|
+
f !== g && rs(u, m, 0, n, m, 0);
|
|
20259
20283
|
for (let N = 0; N < t.length; N++) {
|
|
20260
|
-
if (N ===
|
|
20261
|
-
const W =
|
|
20262
|
-
for (rs(u, m, W, n, m, K); (
|
|
20263
|
-
|
|
20284
|
+
if (N === f) {
|
|
20285
|
+
const W = f - g, K = c[h];
|
|
20286
|
+
for (rs(u, m, W, n, m, K); (f === N || f === void 0) && h < e.length - 1; )
|
|
20287
|
+
h++, f = e[h];
|
|
20264
20288
|
}
|
|
20265
|
-
t.charCodeAt(N) === p.lineFeed && (m++, g = N + 1,
|
|
20289
|
+
t.charCodeAt(N) === p.lineFeed && (m++, g = N + 1, f !== g && rs(u, m, 0, n, m, 0));
|
|
20266
20290
|
}
|
|
20267
|
-
const { sourceRoot:
|
|
20291
|
+
const { sourceRoot: v, sourcesContent: w, ...D } = $u(u);
|
|
20268
20292
|
return D;
|
|
20269
20293
|
}
|
|
20270
20294
|
function Ku(t, e) {
|
|
@@ -20452,12 +20476,12 @@ function Ju(t, e, n) {
|
|
|
20452
20476
|
if (tu(c))
|
|
20453
20477
|
Gi(r[r.length - 1], t, u);
|
|
20454
20478
|
else if (nu(c)) {
|
|
20455
|
-
let
|
|
20456
|
-
for (;
|
|
20457
|
-
|
|
20458
|
-
if (
|
|
20479
|
+
let h = r.length - 1;
|
|
20480
|
+
for (; h > 0 && !r[h].isFunctionScope; )
|
|
20481
|
+
h--;
|
|
20482
|
+
if (h < 0)
|
|
20459
20483
|
throw new Error("Did not find parent function scope.");
|
|
20460
|
-
Gi(r[
|
|
20484
|
+
Gi(r[h], t, u);
|
|
20461
20485
|
}
|
|
20462
20486
|
}
|
|
20463
20487
|
}
|
|
@@ -20554,8 +20578,8 @@ var da = (
|
|
|
20554
20578
|
return new rl();
|
|
20555
20579
|
}, t.prototype.resolveUnion = function(e) {
|
|
20556
20580
|
for (var n, r, i = e, o = null, c = 0, u = i.contexts; c < u.length; c++) {
|
|
20557
|
-
var
|
|
20558
|
-
(!o ||
|
|
20581
|
+
var h = u[c];
|
|
20582
|
+
(!o || h._score >= o._score) && (o = h);
|
|
20559
20583
|
}
|
|
20560
20584
|
o && o._score > 0 && ((n = this._propNames).push.apply(n, o._propNames), (r = this._messages).push.apply(r, o._messages));
|
|
20561
20585
|
}, t.prototype.getError = function(e) {
|
|
@@ -20649,11 +20673,11 @@ var rl = (
|
|
|
20649
20673
|
}(r)
|
|
20650
20674
|
);
|
|
20651
20675
|
t.TName = u;
|
|
20652
|
-
function
|
|
20653
|
-
return new
|
|
20676
|
+
function h(k) {
|
|
20677
|
+
return new f(k);
|
|
20654
20678
|
}
|
|
20655
|
-
t.lit =
|
|
20656
|
-
var
|
|
20679
|
+
t.lit = h;
|
|
20680
|
+
var f = (
|
|
20657
20681
|
/** @class */
|
|
20658
20682
|
function(k) {
|
|
20659
20683
|
e(x, k);
|
|
@@ -20669,7 +20693,7 @@ var rl = (
|
|
|
20669
20693
|
}, x;
|
|
20670
20694
|
}(r)
|
|
20671
20695
|
);
|
|
20672
|
-
t.TLiteral =
|
|
20696
|
+
t.TLiteral = f;
|
|
20673
20697
|
function m(k) {
|
|
20674
20698
|
return new g(i(k));
|
|
20675
20699
|
}
|
|
@@ -20698,15 +20722,15 @@ var rl = (
|
|
|
20698
20722
|
}(r)
|
|
20699
20723
|
);
|
|
20700
20724
|
t.TArray = g;
|
|
20701
|
-
function
|
|
20725
|
+
function v() {
|
|
20702
20726
|
for (var k = [], x = 0; x < arguments.length; x++)
|
|
20703
20727
|
k[x] = arguments[x];
|
|
20704
|
-
return new
|
|
20728
|
+
return new w(k.map(function(I) {
|
|
20705
20729
|
return i(I);
|
|
20706
20730
|
}));
|
|
20707
20731
|
}
|
|
20708
|
-
t.tuple =
|
|
20709
|
-
var
|
|
20732
|
+
t.tuple = v;
|
|
20733
|
+
var w = (
|
|
20710
20734
|
/** @class */
|
|
20711
20735
|
function(k) {
|
|
20712
20736
|
e(x, k);
|
|
@@ -20733,7 +20757,7 @@ var rl = (
|
|
|
20733
20757
|
}, x;
|
|
20734
20758
|
}(r)
|
|
20735
20759
|
);
|
|
20736
|
-
t.TTuple =
|
|
20760
|
+
t.TTuple = w;
|
|
20737
20761
|
function D() {
|
|
20738
20762
|
for (var k = [], x = 0; x < arguments.length; x++)
|
|
20739
20763
|
k[x] = arguments[x];
|
|
@@ -20750,7 +20774,7 @@ var rl = (
|
|
|
20750
20774
|
var A = k.call(this) || this;
|
|
20751
20775
|
A.ttypes = I;
|
|
20752
20776
|
var F = I.map(function(Z) {
|
|
20753
|
-
return Z instanceof u || Z instanceof
|
|
20777
|
+
return Z instanceof u || Z instanceof f ? Z.name : null;
|
|
20754
20778
|
}).filter(function(Z) {
|
|
20755
20779
|
return Z;
|
|
20756
20780
|
}), G = I.length - F.length;
|
|
@@ -20857,7 +20881,7 @@ var rl = (
|
|
|
20857
20881
|
});
|
|
20858
20882
|
}
|
|
20859
20883
|
function ee(k, x) {
|
|
20860
|
-
return x instanceof b ? new
|
|
20884
|
+
return x instanceof b ? new E(k, x.ttype, !0) : new E(k, i(x), !1);
|
|
20861
20885
|
}
|
|
20862
20886
|
function z(k, x) {
|
|
20863
20887
|
return new me(k, ae(x));
|
|
@@ -20937,7 +20961,7 @@ var rl = (
|
|
|
20937
20961
|
}(r)
|
|
20938
20962
|
);
|
|
20939
20963
|
t.TOptional = b;
|
|
20940
|
-
var
|
|
20964
|
+
var E = (
|
|
20941
20965
|
/** @class */
|
|
20942
20966
|
/* @__PURE__ */ function() {
|
|
20943
20967
|
function k(x, I, A) {
|
|
@@ -20946,7 +20970,7 @@ var rl = (
|
|
|
20946
20970
|
return k;
|
|
20947
20971
|
}()
|
|
20948
20972
|
);
|
|
20949
|
-
t.TProp =
|
|
20973
|
+
t.TProp = E;
|
|
20950
20974
|
function V(k) {
|
|
20951
20975
|
for (var x = [], I = 1; I < arguments.length; I++)
|
|
20952
20976
|
x[I - 1] = arguments[I];
|
|
@@ -21100,10 +21124,10 @@ var rl = (
|
|
|
21100
21124
|
})(ms);
|
|
21101
21125
|
(function(t) {
|
|
21102
21126
|
var e = xt && xt.__spreadArrays || function() {
|
|
21103
|
-
for (var
|
|
21104
|
-
for (var g = Array(
|
|
21105
|
-
for (var
|
|
21106
|
-
g[
|
|
21127
|
+
for (var h = 0, f = 0, m = arguments.length; f < m; f++) h += arguments[f].length;
|
|
21128
|
+
for (var g = Array(h), v = 0, f = 0; f < m; f++)
|
|
21129
|
+
for (var w = arguments[f], D = 0, N = w.length; D < N; D++, v++)
|
|
21130
|
+
g[v] = w[D];
|
|
21107
21131
|
return g;
|
|
21108
21132
|
};
|
|
21109
21133
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.Checker = t.createCheckers = void 0;
|
|
@@ -21170,10 +21194,10 @@ var rl = (
|
|
|
21170
21194
|
return o.VError;
|
|
21171
21195
|
} });
|
|
21172
21196
|
function c() {
|
|
21173
|
-
for (var
|
|
21174
|
-
f
|
|
21175
|
-
for (var m = Object.assign.apply(Object, e([{}, n.basicTypes],
|
|
21176
|
-
for (var D = v
|
|
21197
|
+
for (var h = [], f = 0; f < arguments.length; f++)
|
|
21198
|
+
h[f] = arguments[f];
|
|
21199
|
+
for (var m = Object.assign.apply(Object, e([{}, n.basicTypes], h)), g = {}, v = 0, w = h; v < w.length; v++)
|
|
21200
|
+
for (var D = w[v], N = 0, W = Object.keys(D); N < W.length; N++) {
|
|
21177
21201
|
var K = W[N];
|
|
21178
21202
|
g[K] = new u(m, D[K]);
|
|
21179
21203
|
}
|
|
@@ -21183,69 +21207,69 @@ var rl = (
|
|
|
21183
21207
|
var u = (
|
|
21184
21208
|
/** @class */
|
|
21185
21209
|
function() {
|
|
21186
|
-
function f
|
|
21187
|
-
if (g === void 0 && (g = "value"), this.suite =
|
|
21188
|
-
for (var
|
|
21189
|
-
var D = v
|
|
21210
|
+
function h(f, m, g) {
|
|
21211
|
+
if (g === void 0 && (g = "value"), this.suite = f, this.ttype = m, this._path = g, this.props = /* @__PURE__ */ new Map(), m instanceof n.TIface)
|
|
21212
|
+
for (var v = 0, w = m.props; v < w.length; v++) {
|
|
21213
|
+
var D = w[v];
|
|
21190
21214
|
this.props.set(D.name, D.ttype);
|
|
21191
21215
|
}
|
|
21192
|
-
this.checkerPlain = this.ttype.getChecker(
|
|
21216
|
+
this.checkerPlain = this.ttype.getChecker(f, !1), this.checkerStrict = this.ttype.getChecker(f, !0);
|
|
21193
21217
|
}
|
|
21194
|
-
return
|
|
21195
|
-
this._path =
|
|
21196
|
-
},
|
|
21197
|
-
return this._doCheck(this.checkerPlain,
|
|
21198
|
-
},
|
|
21199
|
-
return this.checkerPlain(
|
|
21200
|
-
},
|
|
21201
|
-
return this._doValidate(this.checkerPlain,
|
|
21202
|
-
},
|
|
21203
|
-
return this._doCheck(this.checkerStrict,
|
|
21204
|
-
},
|
|
21205
|
-
return this.checkerStrict(
|
|
21206
|
-
},
|
|
21207
|
-
return this._doValidate(this.checkerStrict,
|
|
21208
|
-
},
|
|
21209
|
-
var m = this.props.get(
|
|
21218
|
+
return h.prototype.setReportedPath = function(f) {
|
|
21219
|
+
this._path = f;
|
|
21220
|
+
}, h.prototype.check = function(f) {
|
|
21221
|
+
return this._doCheck(this.checkerPlain, f);
|
|
21222
|
+
}, h.prototype.test = function(f) {
|
|
21223
|
+
return this.checkerPlain(f, new r.NoopContext());
|
|
21224
|
+
}, h.prototype.validate = function(f) {
|
|
21225
|
+
return this._doValidate(this.checkerPlain, f);
|
|
21226
|
+
}, h.prototype.strictCheck = function(f) {
|
|
21227
|
+
return this._doCheck(this.checkerStrict, f);
|
|
21228
|
+
}, h.prototype.strictTest = function(f) {
|
|
21229
|
+
return this.checkerStrict(f, new r.NoopContext());
|
|
21230
|
+
}, h.prototype.strictValidate = function(f) {
|
|
21231
|
+
return this._doValidate(this.checkerStrict, f);
|
|
21232
|
+
}, h.prototype.getProp = function(f) {
|
|
21233
|
+
var m = this.props.get(f);
|
|
21210
21234
|
if (!m)
|
|
21211
|
-
throw new Error("Type has no property " +
|
|
21212
|
-
return new
|
|
21213
|
-
},
|
|
21214
|
-
var m = this._getMethod(
|
|
21215
|
-
return new
|
|
21216
|
-
},
|
|
21217
|
-
var m = this._getMethod(
|
|
21218
|
-
return new
|
|
21219
|
-
},
|
|
21235
|
+
throw new Error("Type has no property " + f);
|
|
21236
|
+
return new h(this.suite, m, this._path + "." + f);
|
|
21237
|
+
}, h.prototype.methodArgs = function(f) {
|
|
21238
|
+
var m = this._getMethod(f);
|
|
21239
|
+
return new h(this.suite, m.paramList);
|
|
21240
|
+
}, h.prototype.methodResult = function(f) {
|
|
21241
|
+
var m = this._getMethod(f);
|
|
21242
|
+
return new h(this.suite, m.result);
|
|
21243
|
+
}, h.prototype.getArgs = function() {
|
|
21220
21244
|
if (!(this.ttype instanceof n.TFunc))
|
|
21221
21245
|
throw new Error("getArgs() applied to non-function");
|
|
21222
|
-
return new
|
|
21223
|
-
},
|
|
21246
|
+
return new h(this.suite, this.ttype.paramList);
|
|
21247
|
+
}, h.prototype.getResult = function() {
|
|
21224
21248
|
if (!(this.ttype instanceof n.TFunc))
|
|
21225
21249
|
throw new Error("getResult() applied to non-function");
|
|
21226
|
-
return new
|
|
21227
|
-
},
|
|
21250
|
+
return new h(this.suite, this.ttype.result);
|
|
21251
|
+
}, h.prototype.getType = function() {
|
|
21228
21252
|
return this.ttype;
|
|
21229
|
-
},
|
|
21253
|
+
}, h.prototype._doCheck = function(f, m) {
|
|
21230
21254
|
var g = new r.NoopContext();
|
|
21231
|
-
if (!
|
|
21232
|
-
var
|
|
21233
|
-
throw
|
|
21255
|
+
if (!f(m, g)) {
|
|
21256
|
+
var v = new r.DetailContext();
|
|
21257
|
+
throw f(m, v), v.getError(this._path);
|
|
21234
21258
|
}
|
|
21235
|
-
},
|
|
21259
|
+
}, h.prototype._doValidate = function(f, m) {
|
|
21236
21260
|
var g = new r.NoopContext();
|
|
21237
|
-
if (
|
|
21261
|
+
if (f(m, g))
|
|
21238
21262
|
return null;
|
|
21239
|
-
var
|
|
21240
|
-
return
|
|
21241
|
-
},
|
|
21242
|
-
var m = this.props.get(
|
|
21263
|
+
var v = new r.DetailContext();
|
|
21264
|
+
return f(m, v), v.getErrorDetail(this._path);
|
|
21265
|
+
}, h.prototype._getMethod = function(f) {
|
|
21266
|
+
var m = this.props.get(f);
|
|
21243
21267
|
if (!m)
|
|
21244
|
-
throw new Error("Type has no property " +
|
|
21268
|
+
throw new Error("Type has no property " + f);
|
|
21245
21269
|
if (!(m instanceof n.TFunc))
|
|
21246
|
-
throw new Error("Property " +
|
|
21270
|
+
throw new Error("Property " + f + " is not a method");
|
|
21247
21271
|
return m;
|
|
21248
|
-
},
|
|
21272
|
+
}, h;
|
|
21249
21273
|
}()
|
|
21250
21274
|
);
|
|
21251
21275
|
t.Checker = u;
|
|
@@ -22132,7 +22156,7 @@ function wh() {
|
|
|
22132
22156
|
return;
|
|
22133
22157
|
}
|
|
22134
22158
|
t = C.charCodeAt(++a.pos);
|
|
22135
|
-
} while (
|
|
22159
|
+
} while (Xe[t] || t === p.dash);
|
|
22136
22160
|
te(s.jsxName);
|
|
22137
22161
|
}
|
|
22138
22162
|
function _s() {
|
|
@@ -22184,7 +22208,7 @@ function Sh(t) {
|
|
|
22184
22208
|
e = !0, T(s.ellipsis), Ae(), je();
|
|
22185
22209
|
continue;
|
|
22186
22210
|
}
|
|
22187
|
-
e && a.end - a.start === 3 && C.charCodeAt(a.start) === p.lowercaseK && C.charCodeAt(a.start + 1) === p.lowercaseE && C.charCodeAt(a.start + 2) === p.lowercaseY && (a.tokens[t].jsxRole =
|
|
22211
|
+
e && a.end - a.start === 3 && C.charCodeAt(a.start) === p.lowercaseK && C.charCodeAt(a.start + 1) === p.lowercaseE && C.charCodeAt(a.start + 2) === p.lowercaseY && (a.tokens[t].jsxRole = He.KeyAfterPropSpread), Sa(X.ObjectKey), l(s.eq) && (je(), Eh());
|
|
22188
22212
|
}
|
|
22189
22213
|
const n = l(s.slash);
|
|
22190
22214
|
return n && je(), n;
|
|
@@ -22194,14 +22218,14 @@ function xh() {
|
|
|
22194
22218
|
}
|
|
22195
22219
|
function Aa() {
|
|
22196
22220
|
const t = a.tokens.length - 1;
|
|
22197
|
-
a.tokens[t].jsxRole =
|
|
22221
|
+
a.tokens[t].jsxRole = He.NoChildren;
|
|
22198
22222
|
let e = 0;
|
|
22199
22223
|
if (!Sh(t))
|
|
22200
22224
|
for (Ut(); ; )
|
|
22201
22225
|
switch (a.type) {
|
|
22202
22226
|
case s.jsxTagStart:
|
|
22203
22227
|
if (je(), l(s.slash)) {
|
|
22204
|
-
je(), xh(), a.tokens[t].jsxRole !==
|
|
22228
|
+
je(), xh(), a.tokens[t].jsxRole !== He.KeyAfterPropSpread && (e === 1 ? a.tokens[t].jsxRole = He.OneChild : e > 1 && (a.tokens[t].jsxRole = He.StaticChildren));
|
|
22205
22229
|
return;
|
|
22206
22230
|
}
|
|
22207
22231
|
e++, Aa(), Ut();
|
|
@@ -22626,7 +22650,7 @@ function zh() {
|
|
|
22626
22650
|
);
|
|
22627
22651
|
}
|
|
22628
22652
|
function Yh() {
|
|
22629
|
-
S(), Q(), l(s.lessThan) &&
|
|
22653
|
+
S(), Q(), l(s.lessThan) && Ye(), T(s.parenL), Es(), T(s.parenR), ei(), be();
|
|
22630
22654
|
}
|
|
22631
22655
|
function ws() {
|
|
22632
22656
|
l(s._class) ? zh() : l(s._function) ? Yh() : l(s._var) ? Kh() : Ee(d._module) ? _(s.dot) ? Jh() : Zh() : q(d._type) ? ef() : q(d._opaque) ? tf() : q(d._interface) ? nf() : l(s._export) ? Qh() : ne();
|
|
@@ -22662,7 +22686,7 @@ function nf() {
|
|
|
22662
22686
|
S(), ti();
|
|
22663
22687
|
}
|
|
22664
22688
|
function ti(t = !1) {
|
|
22665
|
-
if (Zn(), l(s.lessThan) &&
|
|
22689
|
+
if (Zn(), l(s.lessThan) && Ye(), _(s._extends))
|
|
22666
22690
|
do
|
|
22667
22691
|
wn();
|
|
22668
22692
|
while (!t && _(s.comma));
|
|
@@ -22690,15 +22714,15 @@ function Zn() {
|
|
|
22690
22714
|
Q();
|
|
22691
22715
|
}
|
|
22692
22716
|
function ri() {
|
|
22693
|
-
Zn(), l(s.lessThan) &&
|
|
22717
|
+
Zn(), l(s.lessThan) && Ye(), rt(s.eq), be();
|
|
22694
22718
|
}
|
|
22695
22719
|
function si(t) {
|
|
22696
|
-
ve(d._type), Zn(), l(s.lessThan) &&
|
|
22720
|
+
ve(d._type), Zn(), l(s.lessThan) && Ye(), l(s.colon) && rt(s.colon), t || rt(s.eq), be();
|
|
22697
22721
|
}
|
|
22698
22722
|
function rf() {
|
|
22699
22723
|
ai(), Va(), _(s.eq) && Ne();
|
|
22700
22724
|
}
|
|
22701
|
-
function
|
|
22725
|
+
function Ye() {
|
|
22702
22726
|
const t = se(0);
|
|
22703
22727
|
l(s.lessThan) || l(s.typeParameterStart) ? S() : ne();
|
|
22704
22728
|
do
|
|
@@ -22729,7 +22753,7 @@ function af() {
|
|
|
22729
22753
|
ii(), T(s.bracketR), T(s.bracketR), l(s.lessThan) || l(s.parenL) ? oi() : (_(s.question), rt());
|
|
22730
22754
|
}
|
|
22731
22755
|
function oi() {
|
|
22732
|
-
for (l(s.lessThan) &&
|
|
22756
|
+
for (l(s.lessThan) && Ye(), T(s.parenL); !l(s.parenR) && !l(s.ellipsis) && !a.error; )
|
|
22733
22757
|
Bn(), l(s.parenR) || T(s.comma);
|
|
22734
22758
|
_(s.ellipsis) && Bn(), T(s.parenR), rt();
|
|
22735
22759
|
}
|
|
@@ -22819,7 +22843,7 @@ function Oa() {
|
|
|
22819
22843
|
df();
|
|
22820
22844
|
return;
|
|
22821
22845
|
case s.lessThan:
|
|
22822
|
-
|
|
22846
|
+
Ye(), T(s.parenL), Es(), T(s.parenR), T(s.arrow), Ne();
|
|
22823
22847
|
return;
|
|
22824
22848
|
case s.parenL:
|
|
22825
22849
|
if (S(), !l(s.parenR) && !l(s.ellipsis))
|
|
@@ -22987,7 +23011,7 @@ function Af(t) {
|
|
|
22987
23011
|
}
|
|
22988
23012
|
}
|
|
22989
23013
|
function If() {
|
|
22990
|
-
l(s.lessThan) && (
|
|
23014
|
+
l(s.lessThan) && (Ye(), l(s.parenL) || ne());
|
|
22991
23015
|
}
|
|
22992
23016
|
function Rf() {
|
|
22993
23017
|
const t = se(0);
|
|
@@ -23006,7 +23030,7 @@ function Lf() {
|
|
|
23006
23030
|
function Ff() {
|
|
23007
23031
|
if (l(s.lessThan)) {
|
|
23008
23032
|
const t = se(0);
|
|
23009
|
-
|
|
23033
|
+
Ye(), re(t);
|
|
23010
23034
|
}
|
|
23011
23035
|
}
|
|
23012
23036
|
function Pf() {
|
|
@@ -23027,7 +23051,7 @@ function Uf(t, e) {
|
|
|
23027
23051
|
else
|
|
23028
23052
|
return r;
|
|
23029
23053
|
const i = se(0);
|
|
23030
|
-
if (
|
|
23054
|
+
if (Ye(), re(i), r = tt(t, e), r)
|
|
23031
23055
|
return !0;
|
|
23032
23056
|
ne();
|
|
23033
23057
|
}
|
|
@@ -23422,7 +23446,7 @@ function hd(t, e, n) {
|
|
|
23422
23446
|
)) : i.contextualKeyword === d._accessor && !Je() ? (Gt(n), Tn()) : Je() ? Tn() : ne();
|
|
23423
23447
|
}
|
|
23424
23448
|
function Xt(t, e) {
|
|
23425
|
-
le ? Lt() : he && l(s.lessThan) &&
|
|
23449
|
+
le ? Lt() : he && l(s.lessThan) && Ye(), vs(t, e);
|
|
23426
23450
|
}
|
|
23427
23451
|
function Gt(t) {
|
|
23428
23452
|
rn(t);
|
|
@@ -23441,7 +23465,7 @@ function Tn() {
|
|
|
23441
23465
|
be();
|
|
23442
23466
|
}
|
|
23443
23467
|
function fd(t, e = !1) {
|
|
23444
|
-
le && (!t || e) && q(d._implements) || (l(s.name) && bt(!0), le ? Lt() : he && l(s.lessThan) &&
|
|
23468
|
+
le && (!t || e) && q(d._implements) || (l(s.name) && bt(!0), le ? Lt() : he && l(s.lessThan) && Ye());
|
|
23445
23469
|
}
|
|
23446
23470
|
function dd() {
|
|
23447
23471
|
let t = !1;
|
|
@@ -23815,38 +23839,38 @@ class Yt {
|
|
|
23815
23839
|
function Ld(t, e, n, r) {
|
|
23816
23840
|
const i = e.snapshot(), o = Fd(e);
|
|
23817
23841
|
let c = [];
|
|
23818
|
-
const u = [],
|
|
23819
|
-
let
|
|
23820
|
-
const m = [], g = [],
|
|
23821
|
-
if (
|
|
23842
|
+
const u = [], h = [];
|
|
23843
|
+
let f = null;
|
|
23844
|
+
const m = [], g = [], v = e.currentToken().contextId;
|
|
23845
|
+
if (v == null)
|
|
23822
23846
|
throw new Error("Expected non-null class context ID on class open-brace.");
|
|
23823
|
-
for (e.nextToken(); !e.matchesContextIdAndLabel(s.braceR,
|
|
23847
|
+
for (e.nextToken(); !e.matchesContextIdAndLabel(s.braceR, v); )
|
|
23824
23848
|
if (e.matchesContextual(d._constructor) && !e.currentToken().isType)
|
|
23825
|
-
({ constructorInitializerStatements: c, constructorInsertPos:
|
|
23849
|
+
({ constructorInitializerStatements: c, constructorInsertPos: f } = so(e));
|
|
23826
23850
|
else if (e.matches1(s.semi))
|
|
23827
23851
|
r || g.push({ start: e.currentIndex(), end: e.currentIndex() + 1 }), e.nextToken();
|
|
23828
23852
|
else if (e.currentToken().isType)
|
|
23829
23853
|
e.nextToken();
|
|
23830
23854
|
else {
|
|
23831
|
-
const
|
|
23855
|
+
const w = e.currentIndex();
|
|
23832
23856
|
let D = !1, N = !1, W = !1;
|
|
23833
23857
|
for (; Vn(e.currentToken()); )
|
|
23834
23858
|
e.matches1(s._static) && (D = !0), e.matches1(s.hash) && (N = !0), (e.matches1(s._declare) || e.matches1(s._abstract)) && (W = !0), e.nextToken();
|
|
23835
23859
|
if (D && e.matches1(s.braceL)) {
|
|
23836
|
-
os(e,
|
|
23860
|
+
os(e, v);
|
|
23837
23861
|
continue;
|
|
23838
23862
|
}
|
|
23839
23863
|
if (N) {
|
|
23840
|
-
os(e,
|
|
23864
|
+
os(e, v);
|
|
23841
23865
|
continue;
|
|
23842
23866
|
}
|
|
23843
23867
|
if (e.matchesContextual(d._constructor) && !e.currentToken().isType) {
|
|
23844
|
-
({ constructorInitializerStatements: c, constructorInsertPos:
|
|
23868
|
+
({ constructorInitializerStatements: c, constructorInsertPos: f } = so(e));
|
|
23845
23869
|
continue;
|
|
23846
23870
|
}
|
|
23847
23871
|
const K = e.currentIndex();
|
|
23848
23872
|
if (Pd(e), e.matches1(s.lessThan) || e.matches1(s.parenL)) {
|
|
23849
|
-
os(e,
|
|
23873
|
+
os(e, v);
|
|
23850
23874
|
continue;
|
|
23851
23875
|
}
|
|
23852
23876
|
for (; e.currentToken().isType; )
|
|
@@ -23858,28 +23882,28 @@ function Ld(t, e, n, r) {
|
|
|
23858
23882
|
for (e.nextToken(); e.currentIndex() < j; )
|
|
23859
23883
|
t.processToken();
|
|
23860
23884
|
let O;
|
|
23861
|
-
D ? (O = n.claimFreeName("__initStatic"),
|
|
23885
|
+
D ? (O = n.claimFreeName("__initStatic"), h.push(O)) : (O = n.claimFreeName("__init"), u.push(O)), m.push({
|
|
23862
23886
|
initializerName: O,
|
|
23863
23887
|
equalsIndex: L,
|
|
23864
23888
|
start: K,
|
|
23865
23889
|
end: e.currentIndex()
|
|
23866
23890
|
});
|
|
23867
|
-
} else (!r || W) && g.push({ start:
|
|
23891
|
+
} else (!r || W) && g.push({ start: w, end: e.currentIndex() });
|
|
23868
23892
|
}
|
|
23869
23893
|
return e.restoreToSnapshot(i), r ? {
|
|
23870
23894
|
headerInfo: o,
|
|
23871
23895
|
constructorInitializerStatements: c,
|
|
23872
23896
|
instanceInitializerNames: [],
|
|
23873
23897
|
staticInitializerNames: [],
|
|
23874
|
-
constructorInsertPos:
|
|
23898
|
+
constructorInsertPos: f,
|
|
23875
23899
|
fields: [],
|
|
23876
23900
|
rangesToRemove: g
|
|
23877
23901
|
} : {
|
|
23878
23902
|
headerInfo: o,
|
|
23879
23903
|
constructorInitializerStatements: c,
|
|
23880
23904
|
instanceInitializerNames: u,
|
|
23881
|
-
staticInitializerNames:
|
|
23882
|
-
constructorInsertPos:
|
|
23905
|
+
staticInitializerNames: h,
|
|
23906
|
+
constructorInsertPos: f,
|
|
23883
23907
|
fields: m,
|
|
23884
23908
|
rangesToRemove: g
|
|
23885
23909
|
};
|
|
@@ -24011,7 +24035,7 @@ function nc(t, e, n, r) {
|
|
|
24011
24035
|
const u = n.identifierNameForToken(c);
|
|
24012
24036
|
return r.typeDeclarations.has(u) && !r.valueDeclarations.has(u);
|
|
24013
24037
|
}
|
|
24014
|
-
class Kt extends
|
|
24038
|
+
class Kt extends ze {
|
|
24015
24039
|
__init() {
|
|
24016
24040
|
this.hadExport = !1;
|
|
24017
24041
|
}
|
|
@@ -24021,8 +24045,8 @@ class Kt extends Xe {
|
|
|
24021
24045
|
__init3() {
|
|
24022
24046
|
this.hadDefaultExport = !1;
|
|
24023
24047
|
}
|
|
24024
|
-
constructor(e, n, r, i, o, c, u,
|
|
24025
|
-
super(), this.rootTransformer = e, this.tokens = n, this.importProcessor = r, this.nameManager = i, this.helperManager = o, this.reactHotLoaderTransformer = c, this.enableLegacyBabel5ModuleInterop = u, this.enableLegacyTypeScriptModuleInterop =
|
|
24048
|
+
constructor(e, n, r, i, o, c, u, h, f, m, g, v) {
|
|
24049
|
+
super(), this.rootTransformer = e, this.tokens = n, this.importProcessor = r, this.nameManager = i, this.helperManager = o, this.reactHotLoaderTransformer = c, this.enableLegacyBabel5ModuleInterop = u, this.enableLegacyTypeScriptModuleInterop = h, this.isTypeScriptTransformEnabled = f, this.isFlowTransformEnabled = m, this.preserveDynamicImport = g, this.keepUnusedImports = v, Kt.prototype.__init.call(this), Kt.prototype.__init2.call(this), Kt.prototype.__init3.call(this), this.declarationInfo = f ? ec(n) : Ja;
|
|
24026
24050
|
}
|
|
24027
24051
|
getPrefixCode() {
|
|
24028
24052
|
let e = "";
|
|
@@ -24438,9 +24462,9 @@ module.exports = exports.default;
|
|
|
24438
24462
|
return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && !this.declarationInfo.valueDeclarations.has(e);
|
|
24439
24463
|
}
|
|
24440
24464
|
}
|
|
24441
|
-
class Dd extends
|
|
24442
|
-
constructor(e, n, r, i, o, c, u,
|
|
24443
|
-
super(), this.tokens = e, this.nameManager = n, this.helperManager = r, this.reactHotLoaderTransformer = i, this.isTypeScriptTransformEnabled = o, this.isFlowTransformEnabled = c, this.keepUnusedImports = u, this.nonTypeIdentifiers = o && !u ? ua(e,
|
|
24465
|
+
class Dd extends ze {
|
|
24466
|
+
constructor(e, n, r, i, o, c, u, h) {
|
|
24467
|
+
super(), this.tokens = e, this.nameManager = n, this.helperManager = r, this.reactHotLoaderTransformer = i, this.isTypeScriptTransformEnabled = o, this.isFlowTransformEnabled = c, this.keepUnusedImports = u, this.nonTypeIdentifiers = o && !u ? ua(e, h) : /* @__PURE__ */ new Set(), this.declarationInfo = o && !u ? ec(e) : Ja, this.injectCreateRequireForImportRequire = !!h.injectCreateRequireForImportRequire;
|
|
24444
24468
|
}
|
|
24445
24469
|
process() {
|
|
24446
24470
|
if (this.tokens.matches3(s._import, s.name, s.eq))
|
|
@@ -24584,7 +24608,7 @@ class Dd extends Xe {
|
|
|
24584
24608
|
return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && this.declarationInfo.typeDeclarations.has(e) && !this.declarationInfo.valueDeclarations.has(e);
|
|
24585
24609
|
}
|
|
24586
24610
|
}
|
|
24587
|
-
class Ud extends
|
|
24611
|
+
class Ud extends ze {
|
|
24588
24612
|
constructor(e, n, r) {
|
|
24589
24613
|
super(), this.rootTransformer = e, this.tokens = n, this.isImportsTransformEnabled = r;
|
|
24590
24614
|
}
|
|
@@ -24703,7 +24727,7 @@ function Md(t) {
|
|
|
24703
24727
|
return n;
|
|
24704
24728
|
}
|
|
24705
24729
|
const _n = "jest", Nd = ["mock", "unmock", "enableAutomock", "disableAutomock"];
|
|
24706
|
-
class li extends
|
|
24730
|
+
class li extends ze {
|
|
24707
24731
|
__init() {
|
|
24708
24732
|
this.hoistedFunctionNames = [];
|
|
24709
24733
|
}
|
|
@@ -24738,7 +24762,7 @@ class li extends Xe {
|
|
|
24738
24762
|
return !0;
|
|
24739
24763
|
}
|
|
24740
24764
|
}
|
|
24741
|
-
class Od extends
|
|
24765
|
+
class Od extends ze {
|
|
24742
24766
|
constructor(e) {
|
|
24743
24767
|
super(), this.tokens = e;
|
|
24744
24768
|
}
|
|
@@ -24751,7 +24775,7 @@ class Od extends Xe {
|
|
|
24751
24775
|
return !1;
|
|
24752
24776
|
}
|
|
24753
24777
|
}
|
|
24754
|
-
class Bd extends
|
|
24778
|
+
class Bd extends ze {
|
|
24755
24779
|
constructor(e, n) {
|
|
24756
24780
|
super(), this.tokens = e, this.nameManager = n;
|
|
24757
24781
|
}
|
|
@@ -24759,7 +24783,7 @@ class Bd extends Xe {
|
|
|
24759
24783
|
return this.tokens.matches2(s._catch, s.braceL) ? (this.tokens.copyToken(), this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`), !0) : !1;
|
|
24760
24784
|
}
|
|
24761
24785
|
}
|
|
24762
|
-
class Vd extends
|
|
24786
|
+
class Vd extends ze {
|
|
24763
24787
|
constructor(e, n) {
|
|
24764
24788
|
super(), this.tokens = e, this.nameManager = n;
|
|
24765
24789
|
}
|
|
@@ -24836,7 +24860,7 @@ class Vd extends Xe {
|
|
|
24836
24860
|
}
|
|
24837
24861
|
}
|
|
24838
24862
|
}
|
|
24839
|
-
class jd extends
|
|
24863
|
+
class jd extends ze {
|
|
24840
24864
|
constructor(e, n, r, i) {
|
|
24841
24865
|
super(), this.rootTransformer = e, this.tokens = n, this.importProcessor = r, this.options = i;
|
|
24842
24866
|
}
|
|
@@ -24892,7 +24916,7 @@ class jd extends Xe {
|
|
|
24892
24916
|
return this.tokens.matches1AtIndex(e, s.parenR) || this.tokens.matches2AtIndex(e, s.comma, s.parenR);
|
|
24893
24917
|
}
|
|
24894
24918
|
}
|
|
24895
|
-
class hi extends
|
|
24919
|
+
class hi extends ze {
|
|
24896
24920
|
__init() {
|
|
24897
24921
|
this.extractedDefaultExportName = null;
|
|
24898
24922
|
}
|
|
@@ -24995,11 +25019,11 @@ function io(t) {
|
|
|
24995
25019
|
if (t.length === 0 || !un[t.charCodeAt(0)])
|
|
24996
25020
|
return !1;
|
|
24997
25021
|
for (let e = 1; e < t.length; e++)
|
|
24998
|
-
if (!
|
|
25022
|
+
if (!Xe[t.charCodeAt(e)])
|
|
24999
25023
|
return !1;
|
|
25000
25024
|
return !$d.has(t);
|
|
25001
25025
|
}
|
|
25002
|
-
class qd extends
|
|
25026
|
+
class qd extends ze {
|
|
25003
25027
|
constructor(e, n, r) {
|
|
25004
25028
|
super(), this.rootTransformer = e, this.tokens = n, this.isImportsTransformEnabled = r;
|
|
25005
25029
|
}
|
|
@@ -25309,18 +25333,18 @@ class jn {
|
|
|
25309
25333
|
constructorInitializerStatements: o,
|
|
25310
25334
|
fields: c,
|
|
25311
25335
|
instanceInitializerNames: u,
|
|
25312
|
-
rangesToRemove:
|
|
25336
|
+
rangesToRemove: h
|
|
25313
25337
|
} = e;
|
|
25314
|
-
let
|
|
25338
|
+
let f = 0, m = 0;
|
|
25315
25339
|
const g = this.tokens.currentToken().contextId;
|
|
25316
25340
|
if (g == null)
|
|
25317
25341
|
throw new Error("Expected non-null context ID on class.");
|
|
25318
25342
|
this.tokens.copyExpectedToken(s.braceL), this.isReactHotLoaderTransformEnabled && this.tokens.appendCode(
|
|
25319
25343
|
"__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}"
|
|
25320
25344
|
);
|
|
25321
|
-
const
|
|
25322
|
-
if (i === null &&
|
|
25323
|
-
const
|
|
25345
|
+
const v = o.length + u.length > 0;
|
|
25346
|
+
if (i === null && v) {
|
|
25347
|
+
const w = this.makeConstructorInitCode(
|
|
25324
25348
|
o,
|
|
25325
25349
|
u,
|
|
25326
25350
|
n
|
|
@@ -25328,22 +25352,22 @@ class jn {
|
|
|
25328
25352
|
if (r.hasSuperclass) {
|
|
25329
25353
|
const D = this.nameManager.claimFreeName("args");
|
|
25330
25354
|
this.tokens.appendCode(
|
|
25331
|
-
`constructor(...${D}) { super(...${D}); ${
|
|
25355
|
+
`constructor(...${D}) { super(...${D}); ${w}; }`
|
|
25332
25356
|
);
|
|
25333
25357
|
} else
|
|
25334
|
-
this.tokens.appendCode(`constructor() { ${
|
|
25358
|
+
this.tokens.appendCode(`constructor() { ${w}; }`);
|
|
25335
25359
|
}
|
|
25336
25360
|
for (; !this.tokens.matchesContextIdAndLabel(s.braceR, g); )
|
|
25337
|
-
if (
|
|
25338
|
-
let
|
|
25339
|
-
for (this.tokens.matches1(s.bracketL) ? this.tokens.copyTokenWithPrefix(`${c[
|
|
25340
|
-
|
|
25341
|
-
this.tokens.appendCode("}"),
|
|
25342
|
-
} else if (m <
|
|
25343
|
-
for (this.tokens.currentIndex() <
|
|
25361
|
+
if (f < c.length && this.tokens.currentIndex() === c[f].start) {
|
|
25362
|
+
let w = !1;
|
|
25363
|
+
for (this.tokens.matches1(s.bracketL) ? this.tokens.copyTokenWithPrefix(`${c[f].initializerName}() {this`) : this.tokens.matches1(s.string) || this.tokens.matches1(s.num) ? (this.tokens.copyTokenWithPrefix(`${c[f].initializerName}() {this[`), w = !0) : this.tokens.copyTokenWithPrefix(`${c[f].initializerName}() {this.`); this.tokens.currentIndex() < c[f].end; )
|
|
25364
|
+
w && this.tokens.currentIndex() === c[f].equalsIndex && this.tokens.appendCode("]"), this.processToken();
|
|
25365
|
+
this.tokens.appendCode("}"), f++;
|
|
25366
|
+
} else if (m < h.length && this.tokens.currentIndex() >= h[m].start) {
|
|
25367
|
+
for (this.tokens.currentIndex() < h[m].end && this.tokens.removeInitialToken(); this.tokens.currentIndex() < h[m].end; )
|
|
25344
25368
|
this.tokens.removeToken();
|
|
25345
25369
|
m++;
|
|
25346
|
-
} else this.tokens.currentIndex() === i ? (this.tokens.copyToken(),
|
|
25370
|
+
} else this.tokens.currentIndex() === i ? (this.tokens.copyToken(), v && this.tokens.appendCode(
|
|
25347
25371
|
`;${this.makeConstructorInitCode(
|
|
25348
25372
|
o,
|
|
25349
25373
|
u,
|
|
@@ -25448,8 +25472,8 @@ var Wd = {};
|
|
|
25448
25472
|
return null;
|
|
25449
25473
|
for (var c = 0, u = this.offsets; u[c + 1] <= o; )
|
|
25450
25474
|
c++;
|
|
25451
|
-
var
|
|
25452
|
-
return { line: c, column:
|
|
25475
|
+
var h = o - u[c];
|
|
25476
|
+
return { line: c, column: h };
|
|
25453
25477
|
}, i.prototype.indexForLocation = function(o) {
|
|
25454
25478
|
var c = o.line, u = o.column;
|
|
25455
25479
|
return c < 0 || c >= this.offsets.length || u < 0 || u > this.lengthOfLine(c) ? null : this.offsets[c] + u;
|
|
@@ -25515,23 +25539,23 @@ function zd(t, e) {
|
|
|
25515
25539
|
}
|
|
25516
25540
|
}
|
|
25517
25541
|
function Yd(t, e) {
|
|
25518
|
-
const n = e.transforms.includes("jsx"), r = e.transforms.includes("typescript"), i = e.transforms.includes("flow"), o = e.disableESTransforms === !0, c = Rd(t, n, r, i), u = c.tokens,
|
|
25542
|
+
const n = e.transforms.includes("jsx"), r = e.transforms.includes("typescript"), i = e.transforms.includes("flow"), o = e.disableESTransforms === !0, c = Rd(t, n, r, i), u = c.tokens, h = c.scopes, f = new Vs(t, u), m = new Pn(f), g = new Yt(
|
|
25519
25543
|
t,
|
|
25520
25544
|
u,
|
|
25521
25545
|
i,
|
|
25522
25546
|
o,
|
|
25523
25547
|
m
|
|
25524
|
-
),
|
|
25525
|
-
let
|
|
25526
|
-
return e.transforms.includes("imports") ? (
|
|
25527
|
-
|
|
25548
|
+
), v = !!e.enableLegacyTypeScriptModuleInterop;
|
|
25549
|
+
let w = null;
|
|
25550
|
+
return e.transforms.includes("imports") ? (w = new kt(
|
|
25551
|
+
f,
|
|
25528
25552
|
g,
|
|
25529
|
-
|
|
25553
|
+
v,
|
|
25530
25554
|
e,
|
|
25531
25555
|
e.transforms.includes("typescript"),
|
|
25532
25556
|
!!e.keepUnusedImports,
|
|
25533
25557
|
m
|
|
25534
|
-
),
|
|
25558
|
+
), w.preprocessTokens(), Hi(g, h, w.getGlobalNames()), e.transforms.includes("typescript") && !e.keepUnusedImports && w.pruneTypeOnlyImports()) : e.transforms.includes("typescript") && !e.keepUnusedImports && Hi(g, h, Hd(g)), { tokenProcessor: g, scopes: h, nameManager: f, importProcessor: w, helperManager: m };
|
|
25535
25559
|
}
|
|
25536
25560
|
function rc(t) {
|
|
25537
25561
|
self.postMessage({
|
|
@@ -25566,9 +25590,9 @@ self.addEventListener("unhandledrejection", (t) => {
|
|
|
25566
25590
|
...n !== void 0 && { stack: n }
|
|
25567
25591
|
}), t.preventDefault();
|
|
25568
25592
|
});
|
|
25569
|
-
const
|
|
25593
|
+
const $e = new Fn(), Ve = new q1((t) => self.postMessage(t));
|
|
25570
25594
|
an.current = Ve;
|
|
25571
|
-
|
|
25595
|
+
$e.setSceneErrorReporter(Ve);
|
|
25572
25596
|
let oo = null;
|
|
25573
25597
|
function ao(t) {
|
|
25574
25598
|
const e = zd(t, {
|
|
@@ -25582,34 +25606,34 @@ function ao(t) {
|
|
|
25582
25606
|
mappings: e.sourceMap?.mappings ?? null
|
|
25583
25607
|
};
|
|
25584
25608
|
}
|
|
25585
|
-
async function Kd(t) {
|
|
25609
|
+
async function Kd(t, e) {
|
|
25586
25610
|
Ve.resetForSceneReload();
|
|
25587
25611
|
try {
|
|
25588
|
-
|
|
25589
|
-
const
|
|
25590
|
-
if (
|
|
25612
|
+
$e.resetParameterState();
|
|
25613
|
+
const n = es.detectRendererType(t);
|
|
25614
|
+
if ($e.setCapabilityUsageMask(es.detectUsage(t, n)), n === "shader") {
|
|
25591
25615
|
Ve.setCurrentSourceMap(null);
|
|
25592
25616
|
try {
|
|
25593
|
-
await
|
|
25594
|
-
} catch (
|
|
25595
|
-
const
|
|
25596
|
-
if (
|
|
25597
|
-
throw
|
|
25617
|
+
await $e.initShaderMode(t);
|
|
25618
|
+
} catch (r) {
|
|
25619
|
+
const i = r;
|
|
25620
|
+
if (i.__isShaderCompileError)
|
|
25621
|
+
throw i;
|
|
25598
25622
|
Ve.reportSceneError({
|
|
25599
|
-
message: `Scene code error: ${
|
|
25600
|
-
...
|
|
25623
|
+
message: `Scene code error: ${i.message}`,
|
|
25624
|
+
...i.stack !== void 0 && { stack: i.stack },
|
|
25601
25625
|
code: "SCENE_CODE_ERROR",
|
|
25602
25626
|
sourceOverride: "scene"
|
|
25603
25627
|
});
|
|
25604
25628
|
return;
|
|
25605
25629
|
}
|
|
25606
|
-
|
|
25607
|
-
} else if (
|
|
25608
|
-
const
|
|
25609
|
-
Ve.setCurrentSourceMap(
|
|
25610
|
-
const
|
|
25611
|
-
return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`,
|
|
25612
|
-
if (!
|
|
25630
|
+
$e.sendAllParametersToHost();
|
|
25631
|
+
} else if (n === "p5") {
|
|
25632
|
+
const r = es.detectP5CanvasMode(t), { code: i, mappings: o } = ao(t);
|
|
25633
|
+
Ve.setCurrentSourceMap(o);
|
|
25634
|
+
const c = i + `
|
|
25635
|
+
return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`, u = new Function("viji", "p5", "console", c), h = Ve.makeArtistConsole(globalThis.console), { setup: f, render: m } = u($e.viji, null, h);
|
|
25636
|
+
if (!m) {
|
|
25613
25637
|
Ve.reportSceneError({
|
|
25614
25638
|
message: "P5 mode requires a render(viji, p5) function",
|
|
25615
25639
|
code: "P5_INIT_ERROR",
|
|
@@ -25618,43 +25642,44 @@ return { setup: typeof setup !== "undefined" ? setup : null, render: typeof
|
|
|
25618
25642
|
return;
|
|
25619
25643
|
}
|
|
25620
25644
|
try {
|
|
25621
|
-
await
|
|
25622
|
-
} catch (
|
|
25623
|
-
const
|
|
25645
|
+
await $e.initP5Mode(f, m, { canvasMode: r });
|
|
25646
|
+
} catch (g) {
|
|
25647
|
+
const v = g;
|
|
25624
25648
|
Ve.reportSceneError({
|
|
25625
|
-
message: `P5 init error: ${
|
|
25626
|
-
...
|
|
25649
|
+
message: `P5 init error: ${v.message}`,
|
|
25650
|
+
...v.stack !== void 0 && { stack: v.stack },
|
|
25627
25651
|
code: "P5_INIT_ERROR",
|
|
25628
25652
|
sourceOverride: "scene"
|
|
25629
25653
|
});
|
|
25630
25654
|
return;
|
|
25631
25655
|
}
|
|
25632
|
-
|
|
25656
|
+
$e.sendAllParametersToHost();
|
|
25633
25657
|
} else {
|
|
25634
|
-
const { code:
|
|
25635
|
-
Ve.setCurrentSourceMap(
|
|
25636
|
-
const
|
|
25658
|
+
const { code: r, mappings: i } = ao(t);
|
|
25659
|
+
Ve.setCurrentSourceMap(i);
|
|
25660
|
+
const o = r + `
|
|
25637
25661
|
if (typeof render === "function") {
|
|
25638
25662
|
return render;
|
|
25639
25663
|
}
|
|
25640
|
-
throw new Error("Scene code must define a render function");`,
|
|
25641
|
-
}).constructor,
|
|
25642
|
-
oo = await
|
|
25664
|
+
throw new Error("Scene code must define a render function");`, c = Object.getPrototypeOf(async function() {
|
|
25665
|
+
}).constructor, u = new c("viji", "console", o), h = Ve.makeArtistConsole(globalThis.console);
|
|
25666
|
+
oo = await u($e.viji, h), self.renderFunction = oo, $e.sendAllParametersToHost();
|
|
25643
25667
|
}
|
|
25644
|
-
|
|
25645
|
-
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25668
|
+
e && $e.seedInitialValues(e);
|
|
25669
|
+
} catch (n) {
|
|
25670
|
+
const r = n;
|
|
25671
|
+
console.error("Failed to load scene code:", r), Ve.reportSceneError({
|
|
25672
|
+
message: `Scene code error: ${r.message}`,
|
|
25673
|
+
...r.stack !== void 0 && { stack: r.stack },
|
|
25649
25674
|
// Shader compile errors are tagged by the adapter; everything else here
|
|
25650
25675
|
// is generic init failure attributed to the scene.
|
|
25651
|
-
code:
|
|
25676
|
+
code: r.__isShaderCompileError ? "SHADER_COMPILE_ERROR" : "SCENE_CODE_ERROR",
|
|
25652
25677
|
sourceOverride: "scene",
|
|
25653
|
-
...
|
|
25654
|
-
sourceLocationOverride:
|
|
25678
|
+
...r.__sourceLocation && {
|
|
25679
|
+
sourceLocationOverride: r.__sourceLocation
|
|
25655
25680
|
}
|
|
25656
25681
|
});
|
|
25657
25682
|
}
|
|
25658
25683
|
}
|
|
25659
25684
|
self.setSceneCode = Kd;
|
|
25660
|
-
//# sourceMappingURL=viji.worker-
|
|
25685
|
+
//# sourceMappingURL=viji.worker-ChptZ-zo.js.map
|