@flaxia/node 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/dist/assets/ai-inference.js +83 -183
  3. package/dist/assets/ai-model-registry.js +127 -0
  4. package/dist/assets/cc-extract.js +5166 -0
  5. package/dist/assets/decision.js +142 -0
  6. package/dist/assets/embed-gemma.js +97 -0
  7. package/dist/assets/transformers.web.js +2 -2
  8. package/dist/assets/vector-embed.js +136 -26
  9. package/dist/assets/webgpuProbe.js +83 -66
  10. package/dist/client/SignalingClient.d.ts.map +1 -1
  11. package/dist/client/light-preloader.d.ts +6 -1
  12. package/dist/client/light-preloader.d.ts.map +1 -1
  13. package/dist/consent/notice.d.ts +3 -1
  14. package/dist/consent/notice.d.ts.map +1 -1
  15. package/dist/executor/WorkerPool.d.ts +1 -0
  16. package/dist/executor/WorkerPool.d.ts.map +1 -1
  17. package/dist/index.js +371 -364
  18. package/dist/worker.js +129 -120
  19. package/dist/workloads/__tests__/cc-extract.test.d.ts +2 -0
  20. package/dist/workloads/__tests__/cc-extract.test.d.ts.map +1 -0
  21. package/dist/workloads/__tests__/decision.test.d.ts +2 -0
  22. package/dist/workloads/__tests__/decision.test.d.ts.map +1 -0
  23. package/dist/workloads/__tests__/embed-gemma.test.d.ts +2 -0
  24. package/dist/workloads/__tests__/embed-gemma.test.d.ts.map +1 -0
  25. package/dist/workloads/__tests__/wasm-threads.test.d.ts.map +1 -1
  26. package/dist/workloads/ai-inference.d.ts +21 -2
  27. package/dist/workloads/ai-inference.d.ts.map +1 -1
  28. package/dist/workloads/ai-model-registry.d.ts.map +1 -1
  29. package/dist/workloads/cc-extract.d.ts +11 -0
  30. package/dist/workloads/cc-extract.d.ts.map +1 -0
  31. package/dist/workloads/decision.d.ts +21 -0
  32. package/dist/workloads/decision.d.ts.map +1 -0
  33. package/dist/workloads/embed-gemma.d.ts +8 -0
  34. package/dist/workloads/embed-gemma.d.ts.map +1 -0
  35. package/dist/workloads/vector-embed.d.ts +10 -0
  36. package/dist/workloads/vector-embed.d.ts.map +1 -1
  37. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, S as o, T as s, c, f as l, g as u, i as d, j as f, n as p, o as m, r as h, u as g, v as _, w as v } from "./assets/webgpuProbe.js";
2
- import { t as ee } from "./assets/egress-guard.js";
3
- import { a as y, c as te, i as b, l as ne, n as re, o as ie, r as ae, t as oe } from "./assets/ai-inference.js";
1
+ import { B as e, C as t, E as n, F as r, I as i, K as a, L as o, M as s, P as c, d as l, f as u, h as d, i as f, k as p, m as ee, n as m, o as h, r as g, u as _, w as v } from "./assets/webgpuProbe.js";
2
+ import { t as y } from "./assets/egress-guard.js";
3
+ import { a as te, c as b, i as ne, l as re, n as ie, o as ae, r as oe, t as se } from "./assets/ai-inference.js";
4
4
  //#region src/consent/notice.ts
5
5
  var x = {
6
6
  summary: "同意すると、このブラウザは第三者から依頼された処理をバックグラウンドで実行します。",
@@ -13,34 +13,34 @@ var x = {
13
13
  acceptGateHint: "開示内容を確認できるよう、「同意して開始」はしばらくの間押せません。",
14
14
  acceptLabel: "同意して開始",
15
15
  rejectLabel: "拒否"
16
- }, se = 4320 * 60 * 60 * 1e3, S = "flaxia_consent_record", ce = "flaxia_consent_granted", le = "flaxia_consent_expiry", C = "flaxia_consent_denied", ue = 1, de = 1e4, fe = 2e3, pe = "flaxia-consent-integrity", me = 1, w = "keys", he = "consent-hmac-sha256-v1", ge = (...e) => console.warn("[flaxia-node]", ...e), _e = /* @__PURE__ */ new Map();
17
- function ve(e) {
16
+ }, ce = 4320 * 60 * 60 * 1e3, S = "flaxia_consent_record", le = "flaxia_consent_granted", ue = "flaxia_consent_expiry", C = "flaxia_consent_denied", de = 1, fe = 1e4, pe = 2e3, me = "flaxia-consent-integrity", he = 1, w = "keys", ge = "consent-hmac-sha256-v1", _e = (...e) => console.warn("[flaxia-node]", ...e), ve = /* @__PURE__ */ new Map();
17
+ function ye(e) {
18
18
  try {
19
19
  return localStorage.getItem(e);
20
20
  } catch {
21
- return _e.get(e) ?? null;
21
+ return ve.get(e) ?? null;
22
22
  }
23
23
  }
24
- function ye(e, t) {
24
+ function be(e, t) {
25
25
  try {
26
26
  localStorage.setItem(e, t);
27
27
  } catch {
28
- _e.set(e, t);
28
+ ve.set(e, t);
29
29
  }
30
30
  }
31
31
  function T(e) {
32
32
  try {
33
33
  localStorage.removeItem(e);
34
34
  } catch {
35
- _e.delete(e);
35
+ ve.delete(e);
36
36
  }
37
37
  }
38
- function be(e) {
38
+ function xe(e) {
39
39
  return new Promise((t, n) => {
40
40
  e.onsuccess = () => t(e.result), e.onerror = () => n(e.error ?? /* @__PURE__ */ Error("IndexedDB request failed"));
41
41
  });
42
42
  }
43
- function E() {
43
+ function Se() {
44
44
  return new Promise((e, t) => {
45
45
  let n;
46
46
  try {
@@ -54,7 +54,7 @@ function E() {
54
54
  }
55
55
  let r;
56
56
  try {
57
- r = n.open(pe, me);
57
+ r = n.open(me, he);
58
58
  } catch (e) {
59
59
  t(e);
60
60
  return;
@@ -65,26 +65,26 @@ function E() {
65
65
  }, r.onsuccess = () => e(r.result), r.onerror = () => t(r.error ?? /* @__PURE__ */ Error("IndexedDB open failed")), r.onblocked = () => t(/* @__PURE__ */ Error("IndexedDB open blocked"));
66
66
  });
67
67
  }
68
- function xe(e) {
68
+ function Ce(e) {
69
69
  if (!e || typeof e != "object") return !1;
70
70
  let t = e;
71
71
  return t.type === "secret" && t.algorithm?.name === "HMAC";
72
72
  }
73
- var Se = {
73
+ var we = {
74
74
  async load() {
75
- let e = await E();
75
+ let e = await Se();
76
76
  try {
77
- let t = await be(e.transaction(w, "readonly").objectStore(w).get(he));
78
- return xe(t) ? t : null;
77
+ let t = await xe(e.transaction(w, "readonly").objectStore(w).get(ge));
78
+ return Ce(t) ? t : null;
79
79
  } finally {
80
80
  e.close();
81
81
  }
82
82
  },
83
83
  async save(e) {
84
- let t = await E();
84
+ let t = await Se();
85
85
  try {
86
86
  let n = t.transaction(w, "readwrite");
87
- n.objectStore(w).put(e, he), await new Promise((e, t) => {
87
+ n.objectStore(w).put(e, ge), await new Promise((e, t) => {
88
88
  n.oncomplete = () => e(), n.onerror = () => t(n.error ?? /* @__PURE__ */ Error("IndexedDB write failed")), n.onabort = () => t(n.error ?? /* @__PURE__ */ Error("IndexedDB write aborted"));
89
89
  });
90
90
  } finally {
@@ -92,10 +92,10 @@ var Se = {
92
92
  }
93
93
  },
94
94
  async clear() {
95
- let e = await E();
95
+ let e = await Se();
96
96
  try {
97
97
  let t = e.transaction(w, "readwrite");
98
- t.objectStore(w).delete(he), await new Promise((e, n) => {
98
+ t.objectStore(w).delete(ge), await new Promise((e, n) => {
99
99
  t.oncomplete = () => e(), t.onerror = () => n(t.error ?? /* @__PURE__ */ Error("IndexedDB delete failed")), t.onabort = () => n(t.error ?? /* @__PURE__ */ Error("IndexedDB delete aborted"));
100
100
  });
101
101
  } finally {
@@ -103,7 +103,7 @@ var Se = {
103
103
  }
104
104
  }
105
105
  };
106
- function Ce(e, t, n) {
106
+ function Te(e, t, n) {
107
107
  return new Promise((r) => {
108
108
  let i = !1, a, o = (e) => {
109
109
  i || (i = !0, a !== void 0 && clearTimeout(a), r(e));
@@ -111,26 +111,26 @@ function Ce(e, t, n) {
111
111
  a = setTimeout(() => o(t), n), e.then((e) => o(e), () => o(t));
112
112
  });
113
113
  }
114
- var we = Se, D = null, O = null, k = !1, A = !1, j = null, M = 0, N = 0, P = null, Te = !1;
115
- function Ee() {
114
+ var Ee = we, E = null, D = null, O = !1, k = !1, A = null, j = 0, M = 0, N = null, De = !1;
115
+ function Oe() {
116
116
  try {
117
117
  let e = globalThis.location?.origin;
118
118
  if (typeof e == "string" && e.length > 0) return e;
119
119
  } catch {}
120
120
  return "unknown";
121
121
  }
122
- var De = Ee, Oe = () => De(), ke = {
122
+ var ke = Oe, Ae = () => ke(), je = {
123
123
  name: "HMAC",
124
124
  hash: "SHA-256"
125
125
  };
126
- function F() {
126
+ function P() {
127
127
  try {
128
128
  let e = globalThis.crypto?.subtle;
129
129
  if (e && typeof e.generateKey == "function" && typeof e.sign == "function" && typeof e.verify == "function") return e;
130
130
  } catch {}
131
131
  return null;
132
132
  }
133
- function Ae(e) {
133
+ function Me(e) {
134
134
  let t = new TextEncoder().encode(JSON.stringify([
135
135
  e.v,
136
136
  e.noticeVersion,
@@ -140,12 +140,12 @@ function Ae(e) {
140
140
  ])), n = new Uint8Array(t.byteLength);
141
141
  return n.set(t), n;
142
142
  }
143
- function je(e) {
143
+ function Ne(e) {
144
144
  let t = "";
145
145
  for (let n of e) t += String.fromCharCode(n);
146
146
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
147
147
  }
148
- function Me(e) {
148
+ function Pe(e) {
149
149
  try {
150
150
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
151
151
  for (let e = 0; e < r.length; e += 1) i[e] = r.charCodeAt(e);
@@ -154,40 +154,40 @@ function Me(e) {
154
154
  return null;
155
155
  }
156
156
  }
157
- async function Ne() {
158
- let e = await Ce(we.load(), null, fe);
157
+ async function Fe() {
158
+ let e = await Te(Ee.load(), null, pe);
159
159
  if (e) return e;
160
- let t = F();
160
+ let t = P();
161
161
  if (!t) return null;
162
162
  try {
163
- let e = await t.generateKey(ke, !1, ["sign", "verify"]);
164
- return await Ce(we.save(e), void 0, fe), e;
163
+ let e = await t.generateKey(je, !1, ["sign", "verify"]);
164
+ return await Te(Ee.save(e), void 0, pe), e;
165
165
  } catch {
166
166
  return null;
167
167
  }
168
168
  }
169
- async function Pe(e) {
170
- let t = F();
171
- if (!t || !D) return null;
169
+ async function Ie(e) {
170
+ let t = P();
171
+ if (!t || !E) return null;
172
172
  try {
173
- let n = await t.sign("HMAC", D, Ae(e));
174
- return je(new Uint8Array(n));
173
+ let n = await t.sign("HMAC", E, Me(e));
174
+ return Ne(new Uint8Array(n));
175
175
  } catch {
176
176
  return null;
177
177
  }
178
178
  }
179
- async function Fe(e) {
180
- let t = F();
181
- if (!t || !D || !e.mac) return !1;
182
- let n = Me(e.mac);
179
+ async function Le(e) {
180
+ let t = P();
181
+ if (!t || !E || !e.mac) return !1;
182
+ let n = Pe(e.mac);
183
183
  if (!n) return !1;
184
184
  try {
185
- return await t.verify("HMAC", D, n, Ae(e));
185
+ return await t.verify("HMAC", E, n, Me(e));
186
186
  } catch {
187
187
  return !1;
188
188
  }
189
189
  }
190
- function Ie(e) {
190
+ function Re(e) {
191
191
  if (!e) return null;
192
192
  try {
193
193
  let t = JSON.parse(e);
@@ -205,128 +205,128 @@ function Ie(e) {
205
205
  return null;
206
206
  }
207
207
  }
208
- function Le(e, t) {
208
+ function ze(e, t) {
209
209
  return !(!Number.isFinite(e.grantedAt) || !Number.isFinite(e.expiry) || e.expiry <= t || e.grantedAt > e.expiry || e.expiry - e.grantedAt > 15552e6);
210
210
  }
211
- function I(e) {
212
- return e.v === ue && e.noticeVersion === 2 && e.origin === Oe();
211
+ function F(e) {
212
+ return e.v === de && e.noticeVersion === 3 && e.origin === Ae();
213
213
  }
214
- function Re() {
215
- return Ie(ve(S));
214
+ function I() {
215
+ return Re(ye(S));
216
216
  }
217
- function ze(e) {
218
- ye(S, JSON.stringify(e));
217
+ function Be(e) {
218
+ be(S, JSON.stringify(e));
219
219
  }
220
220
  function L() {
221
221
  T(S);
222
222
  }
223
223
  function R() {
224
- T(ce), T(le);
224
+ T(le), T(ue);
225
225
  }
226
- var Be = () => {
227
- let e = O;
228
- return !e || !k ? !1 : Le(e, Date.now()) && I(e);
229
- }, Ve = () => ve(C) === "true", z = () => Be() ? "granted" : Ve() ? "denied" : "unset", B = () => (j ||= He(), j);
230
- async function He() {
231
- let e = ++M, t = N, n = null;
226
+ var Ve = () => {
227
+ let e = D;
228
+ return !e || !O ? !1 : ze(e, Date.now()) && F(e);
229
+ }, He = () => ye(C) === "true", z = () => Ve() ? "granted" : He() ? "denied" : "unset", B = () => (A ||= Ue(), A);
230
+ async function Ue() {
231
+ let e = ++j, t = M, n = null;
232
232
  try {
233
- n = await Ne();
233
+ n = await Fe();
234
234
  } catch {
235
235
  n = null;
236
236
  }
237
- if (e !== M) return z();
238
- D = n, R();
239
- let r = Re();
240
- return r !== null && await Fe(r) && Le(r, Date.now()) && I(r) && r ? t === N && e === M && (O = r, k = !0) : r && !A && (L(), t === N && e === M && (O = null, k = !1)), z();
237
+ if (e !== j) return z();
238
+ E = n, R();
239
+ let r = I();
240
+ return r !== null && await Le(r) && ze(r, Date.now()) && F(r) && r ? t === M && e === j && (D = r, O = !0) : r && !k && (L(), t === M && e === j && (D = null, O = !1)), z();
241
241
  }
242
- function Ue() {
243
- let e = P;
244
- return P = null, e && Date.now() - e.at <= de ? {
242
+ function We() {
243
+ let e = N;
244
+ return N = null, e && Date.now() - e.at <= fe ? {
245
245
  noticeVersion: e.noticeVersion,
246
246
  source: "user-gesture"
247
- } : Te ? {
248
- noticeVersion: 2,
247
+ } : De ? {
248
+ noticeVersion: 3,
249
249
  source: "host-managed"
250
250
  } : null;
251
251
  }
252
- function We(e) {
253
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? se : Math.min(Math.floor(e), se);
252
+ function Ge(e) {
253
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? ce : Math.min(Math.floor(e), ce);
254
254
  }
255
- function Ge(e, t) {
255
+ function Ke(e, t) {
256
256
  let n = Date.now();
257
257
  return {
258
- v: ue,
258
+ v: de,
259
259
  noticeVersion: e,
260
- origin: Oe(),
260
+ origin: Ae(),
261
261
  grantedAt: n,
262
- expiry: n + We(t),
262
+ expiry: n + Ge(t),
263
263
  mac: ""
264
264
  };
265
265
  }
266
- function Ke(e, t) {
266
+ function qe(e, t) {
267
267
  T(C), R();
268
- let n = Ge(e.noticeVersion, t);
269
- return O = n, k = !0, A = !0, N += 1, ze(n), n;
268
+ let n = Ke(e.noticeVersion, t);
269
+ return D = n, O = !0, k = !0, M += 1, Be(n), n;
270
270
  }
271
- async function qe(e) {
271
+ async function Je(e) {
272
272
  try {
273
- if (await B(), O !== e) return;
274
- let t = await Pe(e);
275
- if (O !== e) return;
273
+ if (await B(), D !== e) return;
274
+ let t = await Ie(e);
275
+ if (D !== e) return;
276
276
  if (!t) {
277
- L(), A = !1;
277
+ L(), k = !1;
278
278
  return;
279
279
  }
280
280
  let n = {
281
281
  ...e,
282
282
  mac: t
283
283
  };
284
- O = n, k = !0, ze(n), A = !1;
284
+ D = n, O = !0, Be(n), k = !1;
285
285
  } catch {
286
- O === e && (L(), A = !1);
286
+ D === e && (L(), k = !1);
287
287
  }
288
288
  }
289
- var Je = () => {
290
- let e = Ue();
289
+ var Ye = () => {
290
+ let e = We();
291
291
  if (!e) {
292
- ge("refusing programmatic consent grant: consent requires the built-in banner to be rendered and accepted by the visitor (see setHostManagedConsentAllowed for host-managed UIs)");
292
+ _e("refusing programmatic consent grant: consent requires the built-in banner to be rendered and accepted by the visitor (see setHostManagedConsentAllowed for host-managed UIs)");
293
293
  return;
294
294
  }
295
- qe(Ke(e));
296
- }, Ye = (e = 2) => {
297
- P = {
295
+ Je(qe(e));
296
+ }, Xe = (e = 3) => {
297
+ N = {
298
298
  noticeVersion: e,
299
299
  at: Date.now()
300
300
  };
301
- }, Xe = (e) => {
302
- Te = e === !0;
303
- }, Ze = () => {
304
- L(), R(), O = null, k = !1, A = !1, N += 1, ye(C, "true");
301
+ }, Ze = (e) => {
302
+ De = e === !0;
305
303
  }, Qe = () => {
306
- L(), R(), T(C), O = null, k = !1, A = !1, P = null, D = null, M += 1, N += 1, j = null, Ce(we.clear(), void 0, fe);
307
- }, $e = ve, et = ye, V = T;
308
- async function tt() {
309
- let e = N, t = Re();
304
+ L(), R(), D = null, O = !1, k = !1, M += 1, be(C, "true");
305
+ }, $e = () => {
306
+ L(), R(), T(C), D = null, O = !1, k = !1, N = null, E = null, j += 1, M += 1, A = null, Te(Ee.clear(), void 0, pe);
307
+ }, et = ye, tt = be, nt = T;
308
+ async function rt() {
309
+ let e = M, t = I();
310
310
  if (!t) {
311
- O = null, k = !1;
311
+ D = null, O = !1;
312
312
  return;
313
313
  }
314
- if (!F()) return;
315
- if (!D) {
316
- j = null, await B();
314
+ if (!P()) return;
315
+ if (!E) {
316
+ A = null, await B();
317
317
  return;
318
318
  }
319
- let n = await Fe(t), r = Re();
320
- if (e !== N || !r || JSON.stringify(r) !== JSON.stringify(t)) return;
321
- let i = n && Le(t, Date.now()) && I(t);
322
- O = i ? t : null, k = i;
319
+ let n = await Le(t), r = I();
320
+ if (e !== M || !r || JSON.stringify(r) !== JSON.stringify(t)) return;
321
+ let i = n && ze(t, Date.now()) && F(t);
322
+ D = i ? t : null, O = i;
323
323
  }
324
324
  try {
325
325
  typeof globalThis.addEventListener == "function" && globalThis.addEventListener("storage", (e) => {
326
- e.key !== null && e.key !== S && e.key !== C || (N += 1, tt());
326
+ e.key !== null && e.key !== S && e.key !== C || (M += 1, rt());
327
327
  });
328
328
  } catch {}
329
- var nt = () => {
329
+ var it = () => {
330
330
  try {
331
331
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
332
332
  } catch {}
@@ -338,35 +338,35 @@ var nt = () => {
338
338
  B();
339
339
  //#endregion
340
340
  //#region src/consent/ConsentUI.ts
341
- var H = "#6366f1", rt = 1500, it = 1500, at = 6e4, ot = 80, st = 40, ct = [
341
+ var V = "#6366f1", at = 1500, ot = 1500, st = 6e4, ct = 80, lt = 40, ut = [
342
342
  "bottom-right",
343
343
  "bottom-left",
344
344
  "top-right",
345
345
  "top-left"
346
- ], lt = /^#[0-9a-f]{3}$/i, ut = /^#[0-9a-f]{6}$/i, dt = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, ft = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, pt = new Map((/* @__PURE__ */ "black.white.red.green.blue.indigo.violet.purple.teal.cyan.orange.pink.brown.gray.grey.slate.navy.maroon.olive.gold.crimson.tomato.salmon.coral.seagreen.steelblue.royalblue.dodgerblue.mediumseagreen.mediumpurple.rebeccapurple".split(".")).map((e) => [e, e]));
347
- function mt(e) {
348
- if (typeof e != "string") return H;
346
+ ], dt = /^#[0-9a-f]{3}$/i, ft = /^#[0-9a-f]{6}$/i, pt = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, mt = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, ht = new Map((/* @__PURE__ */ "black.white.red.green.blue.indigo.violet.purple.teal.cyan.orange.pink.brown.gray.grey.slate.navy.maroon.olive.gold.crimson.tomato.salmon.coral.seagreen.steelblue.royalblue.dodgerblue.mediumseagreen.mediumpurple.rebeccapurple".split(".")).map((e) => [e, e]));
347
+ function gt(e) {
348
+ if (typeof e != "string") return V;
349
349
  let t = e.trim();
350
- if (t.length === 0 || t.length > 64) return H;
351
- if (lt.test(t) || ut.test(t)) return t.toLowerCase();
352
- let n = dt.exec(t);
350
+ if (t.length === 0 || t.length > 64) return V;
351
+ if (dt.test(t) || ft.test(t)) return t.toLowerCase();
352
+ let n = pt.exec(t);
353
353
  if (n) {
354
354
  let [e, t, r] = n.slice(1).map(Number);
355
- return e <= 255 && t <= 255 && r <= 255 ? `rgb(${e}, ${t}, ${r})` : H;
355
+ return e <= 255 && t <= 255 && r <= 255 ? `rgb(${e}, ${t}, ${r})` : V;
356
356
  }
357
- let r = ft.exec(t);
357
+ let r = mt.exec(t);
358
358
  if (r) {
359
359
  let [e, t, n] = r.slice(1, 4).map(Number), i = Number(r[4]);
360
- return e <= 255 && t <= 255 && n <= 255 && i >= 0 && i <= 1 ? `rgba(${e}, ${t}, ${n}, ${i})` : H;
360
+ return e <= 255 && t <= 255 && n <= 255 && i >= 0 && i <= 1 ? `rgba(${e}, ${t}, ${n}, ${i})` : V;
361
361
  }
362
- return pt.get(t.toLowerCase()) ?? H;
362
+ return ht.get(t.toLowerCase()) ?? V;
363
363
  }
364
- function ht(e, t, n) {
364
+ function _t(e, t, n) {
365
365
  if (typeof e != "string") return t;
366
366
  let r = e.replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g, "").replace(/\s+/g, " ").trim();
367
367
  return r.length === 0 ? t : r.length > n ? `${r.slice(0, n)}…` : r;
368
368
  }
369
- function gt(e) {
369
+ function vt(e) {
370
370
  if (typeof e != "string" || e.trim().length === 0) return null;
371
371
  try {
372
372
  let t = new URL(e.trim());
@@ -375,70 +375,70 @@ function gt(e) {
375
375
  return null;
376
376
  }
377
377
  }
378
- function _t(e) {
378
+ function yt(e) {
379
379
  return {
380
- brandName: ht(e?.brandName, "Flaxia Crowd", ot),
381
- position: ct.includes(e?.position) ? e.position : "bottom-right",
382
- accentColor: mt(e?.accentColor),
383
- acceptLabel: ht(e?.acceptLabel, x.acceptLabel, st),
384
- rejectLabel: ht(e?.rejectLabel, x.rejectLabel, st),
385
- privacyPolicyUrl: gt(e?.privacyPolicyUrl),
386
- minVisibleMs: vt(e?.minVisibleMs)
380
+ brandName: _t(e?.brandName, "Flaxia Crowd", ct),
381
+ position: ut.includes(e?.position) ? e.position : "bottom-right",
382
+ accentColor: gt(e?.accentColor),
383
+ acceptLabel: _t(e?.acceptLabel, x.acceptLabel, lt),
384
+ rejectLabel: _t(e?.rejectLabel, x.rejectLabel, lt),
385
+ privacyPolicyUrl: vt(e?.privacyPolicyUrl),
386
+ minVisibleMs: bt(e?.minVisibleMs)
387
387
  };
388
388
  }
389
- function vt(e) {
390
- return typeof e != "number" || !Number.isFinite(e) ? rt : Math.min(Math.max(Math.floor(e), it), at);
389
+ function bt(e) {
390
+ return typeof e != "number" || !Number.isFinite(e) ? at : Math.min(Math.max(Math.floor(e), ot), st);
391
391
  }
392
- function yt(e, t) {
393
- return typeof t.minVisibleMs == "number" && Number.isFinite(t.minVisibleMs) ? Math.min(Math.max(Math.floor(t.minVisibleMs), 0), at) : e;
392
+ function xt(e, t) {
393
+ return typeof t.minVisibleMs == "number" && Number.isFinite(t.minVisibleMs) ? Math.min(Math.max(Math.floor(t.minVisibleMs), 0), st) : e;
394
394
  }
395
- var bt = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n padding: 20px;\n background: #fff;\n color: #1f2937;\n border: 1px solid #ccc;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n z-index: 9999;\n border-radius: 8px;\n max-width: 300px;\n font-family: sans-serif;\n }\n .overlay h3 {\n margin: 0 0 8px;\n color: #111827;\n font-size: 16px;\n }\n .overlay p {\n margin: 0 0 12px;\n color: #4b5563;\n font-size: 14px;\n line-height: 1.4;\n }\n .overlay ul {\n margin: 0 0 12px;\n padding-left: 18px;\n color: #4b5563;\n font-size: 13px;\n line-height: 1.45;\n }\n .overlay li {\n margin-bottom: 6px;\n }\n .overlay .hint {\n margin: 0 0 8px;\n color: #6b7280;\n font-size: 12px;\n }\n .overlay .privacy {\n margin: 0 0 8px;\n font-size: 12px;\n }\n .overlay .privacy a {\n color: __flaxia_accent__;\n }\n button {\n background: __flaxia_accent__;\n color: white;\n border: none;\n padding: 10px 15px;\n border-radius: 4px;\n cursor: pointer;\n margin-top: 10px;\n width: 100%;\n font-size: 14px;\n }\n button:disabled {\n opacity: 0.6;\n cursor: default;\n }\n button.reject {\n background: transparent;\n color: #4b5563;\n border: 1px solid #ccc;\n }\n @media (prefers-color-scheme: dark) {\n .overlay {\n background: #1f2937;\n color: #f9fafb;\n border-color: #374151;\n box-shadow: 0 4px 6px rgba(0,0,0,0.4);\n }\n .overlay h3 {\n color: #f9fafb;\n }\n .overlay p,\n .overlay ul {\n color: #d1d5db;\n }\n .overlay .hint {\n color: #9ca3af;\n }\n button.reject {\n color: #d1d5db;\n border-color: #4b5563;\n }\n }\n", xt = class {
395
+ var St = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n padding: 20px;\n background: #fff;\n color: #1f2937;\n border: 1px solid #ccc;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n z-index: 9999;\n border-radius: 8px;\n max-width: 300px;\n font-family: sans-serif;\n }\n .overlay h3 {\n margin: 0 0 8px;\n color: #111827;\n font-size: 16px;\n }\n .overlay p {\n margin: 0 0 12px;\n color: #4b5563;\n font-size: 14px;\n line-height: 1.4;\n }\n .overlay ul {\n margin: 0 0 12px;\n padding-left: 18px;\n color: #4b5563;\n font-size: 13px;\n line-height: 1.45;\n }\n .overlay li {\n margin-bottom: 6px;\n }\n .overlay .hint {\n margin: 0 0 8px;\n color: #6b7280;\n font-size: 12px;\n }\n .overlay .privacy {\n margin: 0 0 8px;\n font-size: 12px;\n }\n .overlay .privacy a {\n color: __flaxia_accent__;\n }\n button {\n background: __flaxia_accent__;\n color: white;\n border: none;\n padding: 10px 15px;\n border-radius: 4px;\n cursor: pointer;\n margin-top: 10px;\n width: 100%;\n font-size: 14px;\n }\n button:disabled {\n opacity: 0.6;\n cursor: default;\n }\n button.reject {\n background: transparent;\n color: #4b5563;\n border: 1px solid #ccc;\n }\n @media (prefers-color-scheme: dark) {\n .overlay {\n background: #1f2937;\n color: #f9fafb;\n border-color: #374151;\n box-shadow: 0 4px 6px rgba(0,0,0,0.4);\n }\n .overlay h3 {\n color: #f9fafb;\n }\n .overlay p,\n .overlay ul {\n color: #d1d5db;\n }\n .overlay .hint {\n color: #9ca3af;\n }\n button.reject {\n color: #d1d5db;\n border-color: #4b5563;\n }\n }\n", Ct = class {
396
396
  constructor(e, t, n, r, i) {
397
- this.config = _t(t), this.options = i ?? {}, this.root = e.attachShadow({ mode: "closed" }), this.render(n, r);
397
+ this.config = yt(t), this.options = i ?? {}, this.root = e.attachShadow({ mode: "closed" }), this.render(n, r);
398
398
  }
399
399
  shadowRootForTesting() {
400
400
  return this.root;
401
401
  }
402
402
  render(e, t) {
403
403
  let { brandName: n, position: r, accentColor: i, acceptLabel: a, rejectLabel: o, privacyPolicyUrl: s } = this.config, [c, l] = r.split("-"), u = document.createElement("style");
404
- u.textContent = bt.replace(/__flaxia_accent__/g, i).replace("__flaxia_position__", `${c}: 20px; ${l}: 20px`);
404
+ u.textContent = St.replace(/__flaxia_accent__/g, i).replace("__flaxia_position__", `${c}: 20px; ${l}: 20px`);
405
405
  let d = document.createElement("div");
406
406
  d.className = "overlay", d.setAttribute("role", "dialog"), d.setAttribute("aria-labelledby", "flaxia-consent-title");
407
407
  let f = document.createElement("h3");
408
408
  f.id = "flaxia-consent-title", f.textContent = n;
409
409
  let p = document.createElement("p");
410
410
  p.textContent = x.summary;
411
- let m = document.createElement("ul");
411
+ let ee = document.createElement("ul");
412
412
  for (let e of x.items) {
413
413
  let t = document.createElement("li");
414
- t.textContent = e, m.appendChild(t);
414
+ t.textContent = e, ee.appendChild(t);
415
415
  }
416
- if (d.append(f, p, m), s) {
416
+ if (d.append(f, p, ee), s) {
417
417
  let e = document.createElement("p");
418
418
  e.className = "privacy";
419
419
  let t = document.createElement("a");
420
420
  t.href = s, t.target = "_blank", t.rel = "noopener noreferrer", t.textContent = "プライバシーポリシー", e.appendChild(t), d.appendChild(e);
421
421
  }
422
- let h = document.createElement("p");
423
- h.className = "hint", h.textContent = x.acceptGateHint;
422
+ let m = document.createElement("p");
423
+ m.className = "hint", m.textContent = x.acceptGateHint;
424
+ let h = document.createElement("button");
425
+ h.id = "consent-btn", h.type = "button", h.textContent = a;
424
426
  let g = document.createElement("button");
425
- g.id = "consent-btn", g.type = "button", g.textContent = a;
426
- let _ = document.createElement("button");
427
- _.id = "reject-btn", _.type = "button", _.className = "reject", _.textContent = o;
428
- let v = this.options.now ?? (() => Date.now()), ee = this.options.schedule ?? ((e, t) => void setTimeout(e, t)), y = yt(this.config.minVisibleMs, this.options), te = v() + y, b = y <= 0, ne = !1;
429
- b || (g.disabled = !0, g.setAttribute("aria-disabled", "true"), ee(() => {
430
- b = !0, g.disabled = !1, g.removeAttribute("aria-disabled"), h.remove();
427
+ g.id = "reject-btn", g.type = "button", g.className = "reject", g.textContent = o;
428
+ let _ = this.options.now ?? (() => Date.now()), v = this.options.schedule ?? ((e, t) => void setTimeout(e, t)), y = xt(this.config.minVisibleMs, this.options), te = _() + y, b = y <= 0, ne = !1;
429
+ b || (h.disabled = !0, h.setAttribute("aria-disabled", "true"), v(() => {
430
+ b = !0, h.disabled = !1, h.removeAttribute("aria-disabled"), m.remove();
431
431
  }, y));
432
432
  let re = (e) => {
433
433
  ne || (ne = !0, d.remove(), e?.());
434
434
  };
435
- g.addEventListener("click", () => {
436
- !b || v() < te || (Ye(2), re(e));
437
- }), _.addEventListener("click", () => {
435
+ h.addEventListener("click", () => {
436
+ !b || _() < te || (Xe(3), re(e));
437
+ }), g.addEventListener("click", () => {
438
438
  re(t);
439
- }), b || d.appendChild(h), d.append(g, _), this.root.append(u, d);
439
+ }), b || d.appendChild(m), d.append(h, g), this.root.append(u, d);
440
440
  }
441
- }, U = (...e) => console.log("[flaxia-node]", ...e), St = class e {
441
+ }, H = (...e) => console.log("[flaxia-node]", ...e), wt = class e {
442
442
  static {
443
443
  this.MAX_PENDING_CONTROLS = 64;
444
444
  }
@@ -461,73 +461,73 @@ var bt = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n pa
461
461
  return;
462
462
  }
463
463
  let l = () => this.execute(e, t, n, r, i, a, s, c, o);
464
- this.active ? (U(`task queued id=${e} workload=${t} (active task running)`), this.queue.push({
464
+ this.active ? (H(`task queued id=${e} workload=${t} (active task running)`), this.queue.push({
465
465
  id: e,
466
466
  job: l,
467
467
  reject: c
468
468
  })) : l();
469
469
  });
470
470
  }
471
- execute(e, t, n, r, a, s, c, l, u) {
472
- let d = this.worker;
473
- if (!d) {
474
- l(/* @__PURE__ */ Error("Worker not available")), this.dequeue();
471
+ execute(e, t, n, r, i, a, o, c, l) {
472
+ let u = this.worker;
473
+ if (!u) {
474
+ c(/* @__PURE__ */ Error("Worker not available")), this.dequeue();
475
475
  return;
476
476
  }
477
- let f = r ?? this.defaultTimeoutMs, p = !1, m = performance.now();
478
- U(`task start id=${e} workload=${t} timeoutMs=${f}`);
479
- let h = (t) => {
480
- if (p) return;
481
- p = !0;
477
+ let d = r ?? this.defaultTimeoutMs, f = !1, p = performance.now();
478
+ H(`task start id=${e} workload=${t} timeoutMs=${d}`);
479
+ let m = (t) => {
480
+ if (f) return;
481
+ f = !0;
482
482
  let n = this.active;
483
483
  n && (clearTimeout(n.timer), n.removeListener()), this.active = null, this.pendingControls = this.pendingControls.filter((t) => t.taskId !== e), t(), this.dequeue();
484
- }, g = (n) => {
485
- let { id: r, type: s, result: d, error: f, token: p, cpuLoad: g } = n.data;
484
+ }, h = (n) => {
485
+ let { id: r, type: a, result: u, error: d, token: f, cpuLoad: h } = n.data;
486
486
  if (r === e) {
487
- if (i(n.data.modelCache) && (this._modelCacheSnapshot = n.data.modelCache), s === "token") {
488
- a?.(p);
487
+ if (ee(n.data.modelCache) && (this._modelCacheSnapshot = n.data.modelCache), a === "token") {
488
+ i?.(f);
489
489
  return;
490
490
  }
491
- if (s === "heartbeat") {
492
- typeof g == "number" && Number.isFinite(g) && (this._lastCpuLoad = Math.min(1, Math.max(0, g)), this._hasCpuLoadSample = !0);
491
+ if (a === "heartbeat") {
492
+ typeof h == "number" && Number.isFinite(h) && (this._lastCpuLoad = Math.min(1, Math.max(0, h)), this._hasCpuLoadSample = !0);
493
493
  return;
494
494
  }
495
- if (s === "swarm-frame") {
496
- u?.onFrame?.(n.data.frame);
495
+ if (a === "swarm-frame") {
496
+ l?.onFrame?.(n.data.frame);
497
497
  return;
498
498
  }
499
- if (s === "swarm-message") {
500
- u?.onMessage?.(n.data.message);
499
+ if (a === "swarm-message") {
500
+ l?.onMessage?.(n.data.message);
501
501
  return;
502
502
  }
503
- if (s === "done") U(`task done id=${e} workload=${t} durationMs=${Math.round(performance.now() - m)}`), h(() => c(d));
504
- else if (s === "error") {
505
- U(`task failed id=${e} workload=${t} error=${f}`);
506
- let r = typeof n.data.errorCode == "string" ? n.data.errorCode : "TASK_FAILED", i = typeof n.data.errorStatus == "number" ? n.data.errorStatus : 500, a = new o(String(f), r, i);
507
- typeof n.data.detail == "string" && (a.detail = n.data.detail), h(() => l(a));
508
- } else U(`task unknown-message id=${e} type=${String(s)}`), h(() => l(/* @__PURE__ */ Error(`Unknown message type: ${String(s)}`)));
503
+ if (a === "done") H(`task done id=${e} workload=${t} durationMs=${Math.round(performance.now() - p)}`), m(() => o(u));
504
+ else if (a === "error") {
505
+ H(`task failed id=${e} workload=${t} error=${d}`);
506
+ let r = typeof n.data.errorCode == "string" ? n.data.errorCode : "TASK_FAILED", i = typeof n.data.errorStatus == "number" ? n.data.errorStatus : 500, a = new s(String(d), r, i);
507
+ typeof n.data.detail == "string" && (a.detail = n.data.detail), m(() => c(a));
508
+ } else H(`task unknown-message id=${e} type=${String(a)}`), m(() => c(/* @__PURE__ */ Error(`Unknown message type: ${String(a)}`)));
509
509
  }
510
- }, _ = () => d.removeEventListener("message", g), v = setTimeout(() => {
511
- U(`task timeout id=${e} workload=${t} (worker terminated after ${f}ms)`), this.cleanupWorker(), h(() => l(/* @__PURE__ */ Error("TIMEOUT")));
512
- }, f);
510
+ }, g = () => u.removeEventListener("message", h), _ = setTimeout(() => {
511
+ H(`task timeout id=${e} workload=${t} (worker terminated after ${d}ms)`), this.cleanupWorker(), m(() => c(/* @__PURE__ */ Error("TIMEOUT")));
512
+ }, d);
513
513
  this.active = {
514
514
  id: e,
515
- resolve: c,
516
- reject: l,
517
- timer: v,
518
- worker: d,
519
- removeListener: _
520
- }, d.addEventListener("message", g);
515
+ resolve: o,
516
+ reject: c,
517
+ timer: _,
518
+ worker: u,
519
+ removeListener: g
520
+ }, u.addEventListener("message", h);
521
521
  try {
522
- d.postMessage({
522
+ u.postMessage({
523
523
  id: e,
524
524
  workload: t,
525
525
  payload: n,
526
- timeoutMs: f,
527
- config: s
526
+ timeoutMs: d,
527
+ config: a
528
528
  }), this.flushControls();
529
529
  } catch (e) {
530
- h(() => l(e instanceof Error ? e : Error(String(e))));
530
+ m(() => c(e instanceof Error ? e : Error(String(e))));
531
531
  }
532
532
  }
533
533
  flushControls() {
@@ -576,7 +576,7 @@ var bt = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n pa
576
576
  let n = this.queue.findIndex((t) => t.id === e);
577
577
  if (n >= 0) {
578
578
  let [r] = this.queue.splice(n, 1);
579
- return this.pendingControls = this.pendingControls.filter((t) => t.taskId !== e), U(`task aborted before start id=${e} reason=${t}`), r.reject(Error(t)), !0;
579
+ return this.pendingControls = this.pendingControls.filter((t) => t.taskId !== e), H(`task aborted before start id=${e} reason=${t}`), r.reject(Error(t)), !0;
580
580
  }
581
581
  if (this.active?.id !== e || !this.worker) return !1;
582
582
  try {
@@ -584,13 +584,13 @@ var bt = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n pa
584
584
  id: e,
585
585
  type: "abort",
586
586
  reason: t
587
- }), U(`task abort sent id=${e} reason=${t}`), !0;
587
+ }), H(`task abort sent id=${e} reason=${t}`), !0;
588
588
  } catch {
589
589
  return !1;
590
590
  }
591
591
  }
592
592
  handleWorkerError(e) {
593
- U(`worker error error=${e.message}`);
593
+ H(`worker error error=${e.message}`);
594
594
  let t = this.active;
595
595
  this.cleanupWorker(), t && (clearTimeout(t.timer), this.active = null, t.reject(e), this.dequeue());
596
596
  }
@@ -620,8 +620,8 @@ var bt = "\n .overlay {\n position: fixed;\n __flaxia_position__;\n pa
620
620
  let e = this._modelCacheSnapshot;
621
621
  return !e || e.expiresAt <= Date.now() ? null : e;
622
622
  }
623
- }, W = null, Ct = null;
624
- function G(e, t, n, r, i, a) {
623
+ }, U = null, Tt = null;
624
+ function W(e, t, n, r, i, a) {
625
625
  return {
626
626
  value: e,
627
627
  unit: t,
@@ -631,48 +631,48 @@ function G(e, t, n, r, i, a) {
631
631
  sampleCount: a
632
632
  };
633
633
  }
634
- function K(e, t, n) {
635
- return G(null, e, "unknown", t, t + n, 0);
634
+ function G(e, t, n) {
635
+ return W(null, e, "unknown", t, t + n, 0);
636
636
  }
637
- async function wt(e, t) {
638
- return e ? ((!W || W.expiresAt <= t) && (Ct ||= p().then((e) => (W = e, e)).finally(() => {
639
- Ct = null;
640
- }), W = await Ct), W) : null;
637
+ async function Et(e, t) {
638
+ return e ? ((!U || U.expiresAt <= t) && (Tt ||= m().then((e) => (U = e, e)).finally(() => {
639
+ Tt = null;
640
+ }), U = await Tt), U) : null;
641
641
  }
642
- async function Tt(e) {
643
- let t = e.now ?? Date.now(), n = t + _, r = d(), i = r.bytes !== null && r.sampledAt !== null && t - r.sampledAt <= 864e5, a = Number.isFinite(e.deviceMemory) && e.deviceMemory > 0 && e.deviceMemory <= 1024, o = await wt(e.probeGpu === !0, t), s = o?.sampledAt ?? t, c = o?.expiresAt ?? t + 6e5;
642
+ async function Dt(e) {
643
+ let t = e.now ?? Date.now(), r = t + u, i = f(), a = i.bytes !== null && i.sampledAt !== null && t - i.sampledAt <= 864e5, o = Number.isFinite(e.deviceMemory) && e.deviceMemory > 0 && e.deviceMemory <= 1024, s = await Et(e.probeGpu === !0, t), c = s?.sampledAt ?? t, l = s?.expiresAt ?? t + 6e5;
644
644
  return {
645
645
  version: 1,
646
646
  sampledAt: t,
647
- expiresAt: n,
648
- cpuLoad: typeof e.cpuLoad == "number" && Number.isFinite(e.cpuLoad) && e.cpuLoad >= 0 && e.cpuLoad <= 1 ? G(e.cpuLoad, "ratio", "estimated", t, n, 1) : K("ratio", t, _),
649
- wasmMemoryLowerBound: i ? G(r.bytes, "bytes", "measured", r.sampledAt, r.sampledAt + u, 1) : K("bytes", t, u),
650
- deviceMemory: a ? G(e.deviceMemory, "GiB", "estimated", t, t + u, 1) : K("GiB", t, u),
647
+ expiresAt: r,
648
+ cpuLoad: typeof e.cpuLoad == "number" && Number.isFinite(e.cpuLoad) && e.cpuLoad >= 0 && e.cpuLoad <= 1 ? W(e.cpuLoad, "ratio", "estimated", t, r, 1) : G("ratio", t, u),
649
+ wasmMemoryLowerBound: a ? W(i.bytes, "bytes", "measured", i.sampledAt, i.sampledAt + v, 1) : G("bytes", t, v),
650
+ deviceMemory: o ? W(e.deviceMemory, "GiB", "estimated", t, t + v, 1) : G("GiB", t, v),
651
651
  gpu: {
652
- status: o?.status ?? "unknown",
653
- sampledAt: s,
654
- expiresAt: c,
655
- architecture: o?.architecture ? G(o.architecture, "text", "measured", s, c, 1) : K("text", s, l),
656
- maxStorageBufferBindingSize: o?.maxStorageBufferBindingSize !== null && o?.maxStorageBufferBindingSize !== void 0 ? G(o.maxStorageBufferBindingSize, "bytes", "measured", s, c, 1) : K("bytes", s, l),
657
- computeCompletionMs: o?.computeCompletionMs !== null && o?.computeCompletionMs !== void 0 ? G(o.computeCompletionMs, "ms", "measured", s, c, o.sampleCount) : K("ms", s, l),
658
- memoryBytes: K("bytes", s, l)
652
+ status: s?.status ?? "unknown",
653
+ sampledAt: c,
654
+ expiresAt: l,
655
+ architecture: s?.architecture ? W(s.architecture, "text", "measured", c, l, 1) : G("text", c, n),
656
+ maxStorageBufferBindingSize: s?.maxStorageBufferBindingSize !== null && s?.maxStorageBufferBindingSize !== void 0 ? W(s.maxStorageBufferBindingSize, "bytes", "measured", c, l, 1) : G("bytes", c, n),
657
+ computeCompletionMs: s?.computeCompletionMs !== null && s?.computeCompletionMs !== void 0 ? W(s.computeCompletionMs, "ms", "measured", c, l, s.sampleCount) : G("ms", c, n),
658
+ memoryBytes: G("bytes", c, n)
659
659
  }
660
660
  };
661
661
  }
662
662
  //#endregion
663
663
  //#region src/swarm/peer-quality.ts
664
- var Et = 15e3;
665
- function Dt(e) {
664
+ var Ot = 15e3;
665
+ function kt(e) {
666
666
  let t = e.filter((e) => Number.isFinite(e) && e >= 0).slice(-5);
667
667
  if (!t.length) return [];
668
668
  let n = [...t].sort((e, t) => e - t), r = n[Math.floor(n.length / 2)], i = r + Math.max(20, r * 4);
669
669
  return t.filter((e) => e <= i);
670
670
  }
671
- function q(e, t) {
671
+ function K(e, t) {
672
672
  return !Number.isFinite(e) || e < 0 || !Number.isFinite(t) || t <= 0 ? null : e * 8 / t / 1e3;
673
673
  }
674
- function Ot(e, t) {
675
- let n = Dt(e);
674
+ function At(e, t) {
675
+ let n = kt(e);
676
676
  if (!n.length) return {
677
677
  value: null,
678
678
  sampledAt: t,
@@ -685,11 +685,11 @@ function Ot(e, t) {
685
685
  sampleCount: n.length
686
686
  };
687
687
  }
688
- function kt(e, t, n, r, i) {
688
+ function jt(e, t, n, r, i) {
689
689
  let o = (e, n) => {
690
690
  let r = (r) => {
691
691
  let i = n?.[r] ?? t;
692
- return t - i >= 6e4 ? Ot([], t) : Ot(e[r] ?? [], i);
692
+ return t - i >= 6e4 ? At([], t) : At(e[r] ?? [], i);
693
693
  };
694
694
  return {
695
695
  rttMs: r("rttMs"),
@@ -709,8 +709,8 @@ function kt(e, t, n, r, i) {
709
709
  }
710
710
  //#endregion
711
711
  //#region src/swarm/peer-transport.ts
712
- var At = 5e3, J = 16 * 1024, jt = g, Mt = 256 * 1024, Nt = 1129860166, Y = 16, Pt = 2, Ft = 64, It = "flaxia-swarm-v1", Lt = "flaxia-peer-quality-v1", Rt = 128, zt = [{ urls: "stun:stun.cloudflare.com:3478" }];
713
- function Bt() {
712
+ var Mt = 5e3, q = 16 * 1024, Nt = t, Pt = 256 * 1024, Ft = 1129860166, J = 16, It = 2, Lt = 64, Rt = "flaxia-swarm-v1", zt = "flaxia-peer-quality-v1", Bt = 128, Vt = [{ urls: "stun:stun.cloudflare.com:3478" }];
713
+ function Ht() {
714
714
  return {
715
715
  rttMs: [],
716
716
  jitterMs: [],
@@ -718,41 +718,41 @@ function Bt() {
718
718
  receiveMbps: []
719
719
  };
720
720
  }
721
- function Vt(e) {
722
- if (e.byteLength < Y || e.byteLength > 16400) return null;
721
+ function Ut(e) {
722
+ if (e.byteLength < J || e.byteLength > 16400) return null;
723
723
  let t = new DataView(e);
724
- if (t.getUint32(0, !0) !== Nt) return null;
724
+ if (t.getUint32(0, !0) !== Ft) return null;
725
725
  let n = t.getUint32(4, !0), r = t.getUint16(8, !0), i = t.getUint16(10, !0), a = t.getUint32(12, !0);
726
- if (a < 1 || a > jt || i < 1 || i !== Math.ceil(a / 16384) || r >= i) return null;
727
- let o = Math.min(J, a - r * J);
728
- return e.byteLength - Y === o ? {
726
+ if (a < 1 || a > Nt || i < 1 || i !== Math.ceil(a / 16384) || r >= i) return null;
727
+ let o = Math.min(q, a - r * q);
728
+ return e.byteLength - J === o ? {
729
729
  messageId: n,
730
730
  index: r,
731
731
  count: i,
732
732
  totalBytes: a,
733
- payload: new Uint8Array(e, Y)
733
+ payload: new Uint8Array(e, J)
734
734
  } : null;
735
735
  }
736
- function Ht(e, t) {
737
- if (e.byteLength < 1 || e.byteLength > jt) throw Error(`swarm peer frame size is outside 1..${jt} bytes`);
738
- let n = Math.ceil(e.byteLength / J), r = [];
736
+ function Wt(e, t) {
737
+ if (e.byteLength < 1 || e.byteLength > Nt) throw Error(`swarm peer frame size is outside 1..${Nt} bytes`);
738
+ let n = Math.ceil(e.byteLength / q), r = [];
739
739
  for (let i = 0; i < n; i++) {
740
- let a = i * J, o = Math.min(a + J, e.byteLength), s = new Uint8Array(e, a, o - a), c = new ArrayBuffer(Y + s.byteLength), l = new DataView(c);
741
- l.setUint32(0, Nt, !0), l.setUint32(4, t >>> 0, !0), l.setUint16(8, i, !0), l.setUint16(10, n, !0), l.setUint32(12, e.byteLength, !0), new Uint8Array(c, Y).set(s), r.push(c);
740
+ let a = i * q, o = Math.min(a + q, e.byteLength), s = new Uint8Array(e, a, o - a), c = new ArrayBuffer(J + s.byteLength), l = new DataView(c);
741
+ l.setUint32(0, Ft, !0), l.setUint32(4, t >>> 0, !0), l.setUint16(8, i, !0), l.setUint16(10, n, !0), l.setUint32(12, e.byteLength, !0), new Uint8Array(c, J).set(s), r.push(c);
742
742
  }
743
743
  return r;
744
744
  }
745
- var Ut = class {
745
+ var Gt = class {
746
746
  constructor() {
747
747
  this.assemblies = /* @__PURE__ */ new Map();
748
748
  }
749
749
  accept(e, t = Date.now()) {
750
750
  this.expire(t);
751
- let n = Vt(e);
751
+ let n = Ut(e);
752
752
  if (!n) return null;
753
753
  let r = this.assemblies.get(n.messageId);
754
754
  if (!r) {
755
- if (this.assemblies.size >= Pt) return null;
755
+ if (this.assemblies.size >= It) return null;
756
756
  r = {
757
757
  count: n.count,
758
758
  totalBytes: n.totalBytes,
@@ -782,9 +782,9 @@ var Ut = class {
782
782
  expire(e) {
783
783
  for (let [t, n] of this.assemblies) e - n.createdAt > 5e3 * 2 && this.assemblies.delete(t);
784
784
  }
785
- }, Wt = class {
785
+ }, Kt = class {
786
786
  constructor(e) {
787
- this.options = e, this.peers = /* @__PURE__ */ new Map(), this.reassembler = new Ut(), this.nextMessageId = 1, this.mode = "undecided", this.closed = !1, this.failed = !1, this.readyPromise = null, this.readyResolve = null, this.readyTimer = null, this.qualityTimer = null, this.samplingQuality = !1;
787
+ this.options = e, this.peers = /* @__PURE__ */ new Map(), this.reassembler = new Gt(), this.nextMessageId = 1, this.mode = "undecided", this.closed = !1, this.failed = !1, this.readyPromise = null, this.readyResolve = null, this.readyTimer = null, this.qualityTimer = null, this.samplingQuality = !1;
788
788
  }
789
789
  get selectedMode() {
790
790
  return this.mode;
@@ -798,15 +798,15 @@ var Ut = class {
798
798
  let e = [...new Set([this.options.previousNodeId, this.options.nextNodeId])].filter((e) => !!e && e !== this.options.nodeId);
799
799
  try {
800
800
  for (let t of e) {
801
- let e = (this.options.createPeerConnection ?? ((e) => new RTCPeerConnection(e)))({ iceServers: zt }), n = {
801
+ let e = (this.options.createPeerConnection ?? ((e) => new RTCPeerConnection(e)))({ iceServers: Vt }), n = {
802
802
  nodeId: t,
803
803
  connection: e,
804
804
  channel: null,
805
805
  remoteDescriptionSet: !1,
806
806
  pendingCandidates: [],
807
807
  quality: {
808
- webRtc: Bt(),
809
- application: Bt()
808
+ webRtc: Ht(),
809
+ application: Ht()
810
810
  },
811
811
  qualitySampledAt: {
812
812
  webRtc: {},
@@ -836,7 +836,7 @@ var Ut = class {
836
836
  for (let e of this.peers.values()) {
837
837
  let { nodeId: t, connection: n } = e;
838
838
  if (this.options.nodeId.localeCompare(t) < 0) {
839
- this.bindChannel(e, n.createDataChannel(It, { ordered: !0 }));
839
+ this.bindChannel(e, n.createDataChannel(Rt, { ordered: !0 }));
840
840
  let r = await n.createOffer();
841
841
  if (this.closed || this.failed) return;
842
842
  await n.setLocalDescription(r);
@@ -878,7 +878,7 @@ var Ut = class {
878
878
  }
879
879
  } else if (t.candidate !== null) if (n.remoteDescriptionSet) await n.connection.addIceCandidate(t.candidate);
880
880
  else {
881
- if (n.pendingCandidates.length >= Ft) throw Error("too many ICE candidates before remote description");
881
+ if (n.pendingCandidates.length >= Lt) throw Error("too many ICE candidates before remote description");
882
882
  n.pendingCandidates.push(t.candidate);
883
883
  }
884
884
  } catch (e) {
@@ -908,7 +908,7 @@ var Ut = class {
908
908
  }
909
909
  let r = this.nextMessageId++ >>> 0;
910
910
  try {
911
- for (let t of Ht(e, r)) {
911
+ for (let t of Wt(e, r)) {
912
912
  if (await this.waitForBuffer(n), n.readyState !== "open") throw Error("swarm peer data channel closed while sending");
913
913
  n.send(t);
914
914
  }
@@ -929,7 +929,7 @@ var Ut = class {
929
929
  } catch {}
930
930
  return;
931
931
  }
932
- e.channel = t, t.binaryType = "arraybuffer", t.bufferedAmountLowThreshold = Mt / 2, t.onopen = () => this.resolveReadyIfOpen(), t.onmessage = (t) => {
932
+ e.channel = t, t.binaryType = "arraybuffer", t.bufferedAmountLowThreshold = Pt / 2, t.onopen = () => this.resolveReadyIfOpen(), t.onmessage = (t) => {
933
933
  if (typeof t.data == "string") {
934
934
  this.handleQualityProbe(e, t.data);
935
935
  return;
@@ -955,7 +955,7 @@ var Ut = class {
955
955
  }
956
956
  async waitForBuffer(e) {
957
957
  e.bufferedAmount <= 262144 || await new Promise((t, n) => {
958
- let r = setTimeout(() => i(/* @__PURE__ */ Error("swarm peer send buffer stalled")), At), i = (i) => {
958
+ let r = setTimeout(() => i(/* @__PURE__ */ Error("swarm peer send buffer stalled")), Mt), i = (i) => {
959
959
  clearTimeout(r), e.removeEventListener("bufferedamountlow", a), e.removeEventListener("close", o), i ? n(i) : t();
960
960
  }, a = () => i(), o = () => i(/* @__PURE__ */ Error("swarm peer data channel closed while backpressured"));
961
961
  e.addEventListener("bufferedamountlow", a, { once: !0 }), e.addEventListener("close", o, { once: !0 });
@@ -967,7 +967,7 @@ var Ut = class {
967
967
  this.peers.clear();
968
968
  }
969
969
  startQualitySampling() {
970
- this.qualityTimer || !this.options.onQuality || (this.samplePeerQuality(), this.qualityTimer = setInterval(() => void this.samplePeerQuality(), Et));
970
+ this.qualityTimer || !this.options.onQuality || (this.samplePeerQuality(), this.qualityTimer = setInterval(() => void this.samplePeerQuality(), Ot));
971
971
  }
972
972
  stopQualitySampling() {
973
973
  this.qualityTimer && clearInterval(this.qualityTimer), this.qualityTimer = null;
@@ -994,7 +994,7 @@ var Ut = class {
994
994
  };
995
995
  try {
996
996
  t.send(JSON.stringify({
997
- type: Lt,
997
+ type: zt,
998
998
  kind: "ping",
999
999
  id: n
1000
1000
  }));
@@ -1003,7 +1003,7 @@ var Ut = class {
1003
1003
  }
1004
1004
  }
1005
1005
  handleQualityProbe(e, t) {
1006
- if (t.length > Rt) return;
1006
+ if (t.length > Bt) return;
1007
1007
  let n;
1008
1008
  try {
1009
1009
  let e = JSON.parse(t);
@@ -1012,12 +1012,12 @@ var Ut = class {
1012
1012
  } catch {
1013
1013
  return;
1014
1014
  }
1015
- if (n.type !== Lt || !Number.isSafeInteger(n.id) || n.id < 1) return;
1015
+ if (n.type !== zt || !Number.isSafeInteger(n.id) || n.id < 1) return;
1016
1016
  if (n.kind === "ping") {
1017
1017
  if (e.channel?.readyState !== "open" || e.channel.bufferedAmount > 262144) return;
1018
1018
  try {
1019
1019
  e.channel.send(JSON.stringify({
1020
- type: Lt,
1020
+ type: zt,
1021
1021
  kind: "pong",
1022
1022
  id: n.id
1023
1023
  }));
@@ -1040,10 +1040,10 @@ var Ut = class {
1040
1040
  this.sendQualityProbe(n);
1041
1041
  let r = this.monotonicNow();
1042
1042
  if (await this.sampleWebRtc(n, r), n.lastApplicationSampleAt !== void 0) {
1043
- let e = r - n.lastApplicationSampleAt, t = q(n.applicationBytesSent - n.lastApplicationBytesSent, e), i = q(n.applicationBytesReceived - n.lastApplicationBytesReceived, e);
1043
+ let e = r - n.lastApplicationSampleAt, t = K(n.applicationBytesSent - n.lastApplicationBytesSent, e), i = K(n.applicationBytesReceived - n.lastApplicationBytesReceived, e);
1044
1044
  t !== null && this.recordQuality(n, "application", "sendMbps", t), i !== null && this.recordQuality(n, "application", "receiveMbps", i);
1045
1045
  }
1046
- n.lastApplicationSampleAt = r, n.lastApplicationBytesSent = n.applicationBytesSent, n.lastApplicationBytesReceived = n.applicationBytesReceived, t.push(kt(n.nodeId, e, n.quality.webRtc, n.quality.application, n.qualitySampledAt));
1046
+ n.lastApplicationSampleAt = r, n.lastApplicationBytesSent = n.applicationBytesSent, n.lastApplicationBytesReceived = n.applicationBytesReceived, t.push(jt(n.nodeId, e, n.quality.webRtc, n.quality.application, n.qualitySampledAt));
1047
1047
  }
1048
1048
  t.length && this.options.onQuality(t.slice(0, 2));
1049
1049
  } finally {
@@ -1068,11 +1068,11 @@ var Ut = class {
1068
1068
  if (e.lastRtcSampleAt !== void 0) {
1069
1069
  let n = t - e.lastRtcSampleAt;
1070
1070
  if (d !== void 0 && e.lastRtcBytesSent !== void 0 && s === void 0) {
1071
- let t = q(d - e.lastRtcBytesSent, n);
1071
+ let t = K(d - e.lastRtcBytesSent, n);
1072
1072
  t !== null && this.recordQuality(e, "webRtc", "sendMbps", t);
1073
1073
  }
1074
1074
  if (f !== void 0 && e.lastRtcBytesReceived !== void 0 && c === void 0) {
1075
- let t = q(f - e.lastRtcBytesReceived, n);
1075
+ let t = K(f - e.lastRtcBytesReceived, n);
1076
1076
  t !== null && this.recordQuality(e, "webRtc", "receiveMbps", t);
1077
1077
  }
1078
1078
  }
@@ -1080,25 +1080,25 @@ var Ut = class {
1080
1080
  } catch {}
1081
1081
  }
1082
1082
  };
1083
- function Gt(e, t) {
1084
- if (!n(e)) return !1;
1085
- let r = e;
1086
- return r.type === "swarm-peer-signal" && r.taskId === t.taskId && r.sessionId === t.sessionId && r.attemptId === t.attemptId && r.toNodeId === t.nodeId && typeof r.fromNodeId == "string" && t.peers.includes(r.fromNodeId) && typeof r.signal == "object" && r.signal !== null;
1083
+ function qt(e, t) {
1084
+ if (!_(e)) return !1;
1085
+ let n = e;
1086
+ return n.type === "swarm-peer-signal" && n.taskId === t.taskId && n.sessionId === t.sessionId && n.attemptId === t.attemptId && n.toNodeId === t.nodeId && typeof n.fromNodeId == "string" && t.peers.includes(n.fromNodeId) && typeof n.signal == "object" && n.signal !== null;
1087
1087
  }
1088
1088
  //#endregion
1089
1089
  //#region src/client/mobile-lifecycle.ts
1090
- var Kt = .25, qt = .08, Jt = .45;
1091
- function Yt(e, t) {
1092
- let n = e.batteryCharging === !1, r = n && typeof e.batteryLevel == "number" && e.batteryLevel <= Kt, i = n && typeof e.batteryLevel == "number" && e.batteryLevel <= qt, a = e.effectiveType === "slow-2g" || e.effectiveType === "2g", o = r || a || e.saveData === !0;
1090
+ var Jt = .25, Yt = .08, Xt = .45;
1091
+ function Zt(e, t) {
1092
+ let n = e.batteryCharging === !1, r = n && typeof e.batteryLevel == "number" && e.batteryLevel <= Jt, i = n && typeof e.batteryLevel == "number" && e.batteryLevel <= Yt, a = e.effectiveType === "slow-2g" || e.effectiveType === "2g", o = r || a || e.saveData === !0;
1093
1093
  return {
1094
1094
  suspend: e.hidden || e.pageHidden || !e.online || i,
1095
1095
  constrained: o,
1096
- maxCpuLoad: o ? Math.min(t ?? Jt, Jt) : t
1096
+ maxCpuLoad: o ? Math.min(t ?? Xt, Xt) : t
1097
1097
  };
1098
1098
  }
1099
1099
  //#endregion
1100
1100
  //#region src/client/light-preloader.ts
1101
- var Xt = "Xenova/m2m100_418M", Zt = "translation", Qt = "q4f16", $t = "TeamFlaxia/plamo-3-translate-0.8b-onnx", en = "text-generation", tn = "q4f16", nn = class {
1101
+ var Qt = "Xenova/m2m100_418M", $t = "translation", en = "q4f16", tn = "TeamFlaxia/plamo-3-translate-0.8b-onnx", nn = "text-generation", rn = "q4f16", an = class {
1102
1102
  constructor(e, t = {}, n = () => !1, r = async () => {}) {
1103
1103
  this.getConsentState = e, this.options = t, this.isPreloaded = n, this.preload = r, this.timer = null, this.idleHandle = null, this.preloading = !1, this.stopped = !1, this.targets = t.targets ?? [{
1104
1104
  model: t.model ?? "Xenova/m2m100_418M",
@@ -1107,7 +1107,7 @@ var Xt = "Xenova/m2m100_418M", Zt = "translation", Qt = "q4f16", $t = "TeamFlaxi
1107
1107
  }];
1108
1108
  }
1109
1109
  start() {
1110
- if (this.stopped || this.getConsentState() !== "granted" || this.isUnconstrained() === !1 || !this.targets.some((e) => !this.isPreloaded(e.model)) || this.preloading) return;
1110
+ if (this.stopped || this.getConsentState() !== "granted" || this.isUnconstrained() === !1 || !this.targets.some((e) => !this.isPreloaded(e)) || this.preloading) return;
1111
1111
  let e = () => {
1112
1112
  this.idleHandle = null, this.preloadNow();
1113
1113
  };
@@ -1118,7 +1118,7 @@ var Xt = "Xenova/m2m100_418M", Zt = "translation", Qt = "q4f16", $t = "TeamFlaxi
1118
1118
  }
1119
1119
  isUnconstrained() {
1120
1120
  try {
1121
- let e = navigator, t = Yt({
1121
+ let e = navigator, t = Zt({
1122
1122
  hidden: document.hidden,
1123
1123
  pageHidden: document.hidden,
1124
1124
  online: navigator.onLine !== !1,
@@ -1136,7 +1136,7 @@ var Xt = "Xenova/m2m100_418M", Zt = "translation", Qt = "q4f16", $t = "TeamFlaxi
1136
1136
  try {
1137
1137
  for (let e of this.targets) {
1138
1138
  if (this.stopped || this.getConsentState() !== "granted") return;
1139
- if (!this.isPreloaded(e.model)) try {
1139
+ if (!this.isPreloaded(e)) try {
1140
1140
  await this.preload({
1141
1141
  task: e.task,
1142
1142
  model: e.model,
@@ -1149,25 +1149,25 @@ var Xt = "Xenova/m2m100_418M", Zt = "translation", Qt = "q4f16", $t = "TeamFlaxi
1149
1149
  }
1150
1150
  }
1151
1151
  }
1152
- }, X = (...e) => console.log("[flaxia-node]", ...e), Z = (...e) => console.error("[flaxia-node]", ...e);
1153
- function Q(e) {
1152
+ }, Y = (...e) => console.log("[flaxia-node]", ...e), X = (...e) => console.error("[flaxia-node]", ...e);
1153
+ function Z(e) {
1154
1154
  let t = /* @__PURE__ */ new Set();
1155
1155
  if (!Array.isArray(e)) return [];
1156
1156
  for (let n of e.slice(0, 32)) try {
1157
- let e = ee(n);
1157
+ let e = y(n);
1158
1158
  e.origin === n && t.add(e.origin);
1159
1159
  } catch {}
1160
1160
  return [...t];
1161
1161
  }
1162
- var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1162
+ var on = "flaxia_node_id", Q = "flaxia_node_token", sn = class {
1163
1163
  receiveSwarmEnvelope(e) {
1164
- let t = f(e);
1164
+ let t = i(e);
1165
1165
  !t || ![...this.swarmSessions.values()].includes(t.sessionId) || (this.swarmInboundChain = this.swarmInboundChain.then(async () => {
1166
1166
  let e = this.swarmHopKeys.get(t.sessionId);
1167
1167
  if (e && e.chainLength > 1) {
1168
1168
  if (!t.mac || !e.inboundKey) return;
1169
- if (!await v(e.inboundKey, t.sessionId, t.frame, t.mac)) {
1170
- Z(`swarm frame rejected: bad hop MAC sessionId=${t.sessionId}`);
1169
+ if (!await p(e.inboundKey, t.sessionId, t.frame, t.mac)) {
1170
+ X(`swarm frame rejected: bad hop MAC sessionId=${t.sessionId}`);
1171
1171
  return;
1172
1172
  }
1173
1173
  }
@@ -1183,7 +1183,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1183
1183
  attemptId: r,
1184
1184
  peers: o
1185
1185
  });
1186
- let s = new Wt({
1186
+ let s = new Kt({
1187
1187
  sessionId: t,
1188
1188
  taskId: n,
1189
1189
  attemptId: r,
@@ -1220,7 +1220,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1220
1220
  }
1221
1221
  handleSwarmPeerSignal(e) {
1222
1222
  let t = typeof e.sessionId == "string" ? e.sessionId : "", n = this.swarmPeerMetadata.get(t), r = this.swarmPeerTransports.get(t);
1223
- !n || !r || !Gt(e, {
1223
+ !n || !r || !qt(e, {
1224
1224
  ...n,
1225
1225
  sessionId: t,
1226
1226
  nodeId: this.nodeId
@@ -1238,7 +1238,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1238
1238
  this.disconnect();
1239
1239
  return;
1240
1240
  }
1241
- if (X(`connect nodeId=${this.nodeId}`), this.ws) {
1241
+ if (Y(`connect nodeId=${this.nodeId}`), this.ws) {
1242
1242
  let e = this.ws;
1243
1243
  e.onclose = null;
1244
1244
  try {
@@ -1247,24 +1247,24 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1247
1247
  this.ws = null;
1248
1248
  }
1249
1249
  if (this.setupMobileLifecycleHandlers(), this.suspended) return;
1250
- let n = await this.obtainToken();
1250
+ let t = await this.obtainToken();
1251
1251
  if (this.destroyed || this.suspended) return;
1252
1252
  if (z() !== "granted") {
1253
- X("connect cancelled because consent was revoked while obtaining a token");
1253
+ Y("connect cancelled because consent was revoked while obtaining a token");
1254
1254
  return;
1255
1255
  }
1256
- if (!n) {
1257
- Z("token acquisition failed; scheduling reconnect"), this.scheduleReconnect();
1256
+ if (!t) {
1257
+ X("token acquisition failed; scheduling reconnect"), this.scheduleReconnect();
1258
1258
  return;
1259
1259
  }
1260
1260
  this.startLightPreloader();
1261
- let r = t(this.config.orchestratorUrl, "/crowd/signal"), i = new WebSocket(r, e(n.token));
1262
- i.binaryType = "arraybuffer", this.ws = i;
1263
- let a = !1;
1264
- i.onopen = () => {
1265
- a = !0, this.reconnectAttempts = 0, X(`signal connected ${r}`), this.sendHeartbeat(i);
1266
- }, i.onmessage = async (e) => {
1267
- if (this.ws !== i) return;
1261
+ let n = c(this.config.orchestratorUrl, "/crowd/signal"), r = new WebSocket(n, e(t.token));
1262
+ r.binaryType = "arraybuffer", this.ws = r;
1263
+ let i = !1;
1264
+ r.onopen = () => {
1265
+ i = !0, this.reconnectAttempts = 0, Y(`signal connected ${n}`), this.sendHeartbeat(r);
1266
+ }, r.onmessage = async (e) => {
1267
+ if (this.ws !== r) return;
1268
1268
  if (typeof e.data != "string") {
1269
1269
  this.receiveSwarmEnvelope(e.data);
1270
1270
  return;
@@ -1276,22 +1276,22 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1276
1276
  return;
1277
1277
  }
1278
1278
  if (t.type === "ping") {
1279
- this.sendHeartbeat(i);
1279
+ this.sendHeartbeat(r);
1280
1280
  return;
1281
1281
  }
1282
1282
  if (t.type === "task") {
1283
1283
  let e = t;
1284
- X(`task received taskId=${e.taskId} workload=${e.workload} timeoutMs=${e.timeoutMs ?? "default"}`), typeof e.attemptId == "string" && this.attempts.set(e.taskId, e.attemptId);
1284
+ Y(`task received taskId=${e.taskId} workload=${e.workload} timeoutMs=${e.timeoutMs ?? "default"}`), typeof e.attemptId == "string" && this.attempts.set(e.taskId, e.attemptId);
1285
1285
  let n = e.attemptId ?? this.attempts.get(e.taskId);
1286
1286
  try {
1287
1287
  await this.handleTask(e);
1288
1288
  } catch (r) {
1289
1289
  let i = r instanceof Error ? r.message : String(r);
1290
1290
  if (this.abortedTasks.delete(e.taskId)) {
1291
- X(`task stopped on coordinator abort taskId=${e.taskId} error=${i}`);
1291
+ Y(`task stopped on coordinator abort taskId=${e.taskId} error=${i}`);
1292
1292
  return;
1293
1293
  }
1294
- Z(`task failed taskId=${e.taskId} workload=${e.workload} error=${i}`), this.send({
1294
+ X(`task failed taskId=${e.taskId} workload=${e.workload} error=${i}`), this.send({
1295
1295
  type: "error",
1296
1296
  taskId: String(t.taskId ?? ""),
1297
1297
  error: i,
@@ -1346,10 +1346,10 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1346
1346
  this.handleAbort(t);
1347
1347
  return;
1348
1348
  }
1349
- }, i.onerror = () => {
1350
- this.ws === i && Z("signal websocket error");
1351
- }, i.onclose = (e) => {
1352
- i.onclose = null, this.ws === i && (this.ws = null, a || (this.cachedToken = null), !this.destroyed && (X(`signal disconnected code=${e.code} reason=${JSON.stringify(e.reason)} clean=${e.wasClean}; scheduling reconnect attempt=${this.reconnectAttempts + 1}`), this.scheduleReconnect()));
1349
+ }, r.onerror = () => {
1350
+ this.ws === r && X("signal websocket error");
1351
+ }, r.onclose = (e) => {
1352
+ r.onclose = null, this.ws === r && (this.ws = null, i || (this.cachedToken = null), !this.destroyed && (Y(`signal disconnected code=${e.code} reason=${JSON.stringify(e.reason)} clean=${e.wasClean}; scheduling reconnect attempt=${this.reconnectAttempts + 1}`), this.scheduleReconnect()));
1353
1353
  };
1354
1354
  }
1355
1355
  handleAbort(e) {
@@ -1358,11 +1358,11 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1358
1358
  let n = typeof e.error == "string" && e.error ? e.error : "aborted by the coordinator", r = this.swarmSessions.get(t);
1359
1359
  if (r && r !== e.sessionId) return;
1360
1360
  let i = r ?? t;
1361
- r && this.retireSwarmSession(r), this.workerPool.abort(i, n) && this.abortedTasks.add(i), X(`task abort received taskId=${t} error=${n}`);
1361
+ r && this.retireSwarmSession(r), this.workerPool.abort(i, n) && this.abortedTasks.add(i), Y(`task abort received taskId=${t} error=${n}`);
1362
1362
  }
1363
1363
  async sendHeartbeat(e) {
1364
1364
  if (this.ws !== e || e.readyState !== WebSocket.OPEN || z() !== "granted") return;
1365
- let t = (this.config.capabilities ?? ["ai-inference", "image-process"]).includes("swarm-inference") && this.config.allowModelDownload === !0, n = navigator.deviceMemory, r = await Tt({
1365
+ let t = (this.config.capabilities ?? ["ai-inference", "image-process"]).includes("swarm-inference") && this.config.allowModelDownload === !0, n = navigator.deviceMemory, r = await Dt({
1366
1366
  cpuLoad: this.workerPool.hasCpuLoadSample ? this.workerPool.lastCpuLoad : null,
1367
1367
  deviceMemory: n,
1368
1368
  probeGpu: t
@@ -1381,7 +1381,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1381
1381
  }, e);
1382
1382
  }
1383
1383
  disconnect() {
1384
- X(`disconnect nodeId=${this.nodeId}`), this.destroyed = !0, this.suspended = !1, this.stopLightPreloader(), this.removeMobileLifecycleHandlers();
1384
+ Y(`disconnect nodeId=${this.nodeId}`), this.destroyed = !0, this.suspended = !1, this.stopLightPreloader(), this.removeMobileLifecycleHandlers();
1385
1385
  try {
1386
1386
  this.ws?.close();
1387
1387
  } catch {}
@@ -1389,7 +1389,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1389
1389
  for (let e of this.swarmPeerTransports.values()) e.close();
1390
1390
  this.swarmPeerTransports.clear(), this.swarmPeerMetadata.clear();
1391
1391
  try {
1392
- delete window[sn];
1392
+ delete window[cn];
1393
1393
  } catch {}
1394
1394
  try {
1395
1395
  this.workerPool.terminate();
@@ -1397,7 +1397,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1397
1397
  }
1398
1398
  suspend() {
1399
1399
  if (!(this.suspended || this.destroyed)) {
1400
- if (X("suspended (visibility or manual)"), this.suspended = !0, this.stopLightPreloader(), this.ws) {
1400
+ if (Y("suspended (visibility or manual)"), this.suspended = !0, this.stopLightPreloader(), this.ws) {
1401
1401
  let e = this.ws;
1402
1402
  e.onclose = null;
1403
1403
  try {
@@ -1409,18 +1409,18 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1409
1409
  }
1410
1410
  }
1411
1411
  resume() {
1412
- !this.suspended || this.destroyed || (X("resumed"), this.suspended = !1, this.workerPool.resume(), this.connect());
1412
+ !this.suspended || this.destroyed || (Y("resumed"), this.suspended = !1, this.workerPool.resume(), this.connect());
1413
1413
  }
1414
1414
  async obtainToken() {
1415
1415
  let e = () => z() === "granted";
1416
1416
  if (!e()) return null;
1417
1417
  try {
1418
- if (this.cachedToken && this.cachedToken.expiresAt > Date.now() + 6e4) return X(`token cached nodeId=${this.cachedToken.nodeId} expiresIn=${Math.round((this.cachedToken.expiresAt - Date.now()) / 1e3)}s`), this.cachedToken;
1419
- let t = m(), n = t >= h, r = this.config.capabilities ?? ["ai-inference", "image-process"], i = n ? [...r] : [];
1420
- Q(this.config.containerImageOrigins).length === 0 && (i = i.filter((e) => e !== "container"));
1418
+ if (this.cachedToken && this.cachedToken.expiresAt > Date.now() + 6e4) return Y(`token cached nodeId=${this.cachedToken.nodeId} expiresIn=${Math.round((this.cachedToken.expiresAt - Date.now()) / 1e3)}s`), this.cachedToken;
1419
+ let t = h(), n = t >= g, r = this.config.capabilities ?? ["ai-inference", "image-process"], i = [...r];
1420
+ n || (i = i.filter((e) => !d.has(e))), Z(this.config.containerImageOrigins).length === 0 && (i = i.filter((e) => e !== "container")), Z(this.config.ccRangeOrigins).length === 0 && (i = i.filter((e) => e !== "cc-extract"));
1421
1421
  let a;
1422
1422
  if (n && r.includes("swarm-inference") && this.config.allowModelDownload === !0) {
1423
- let t = await Tt({
1423
+ let t = await Dt({
1424
1424
  cpuLoad: this.workerPool.hasCpuLoadSample ? this.workerPool.lastCpuLoad : null,
1425
1425
  deviceMemory: navigator.deviceMemory,
1426
1426
  probeGpu: !0
@@ -1428,7 +1428,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1428
1428
  if (!e()) return null;
1429
1429
  t.gpu.status === "available" ? (a = { webgpu: !0 }, t.gpu.architecture.value && (a.gpuArchitecture = t.gpu.architecture.value), t.gpu.maxStorageBufferBindingSize.value !== null && (a.maxStorageBufferBindingSize = t.gpu.maxStorageBufferBindingSize.value)) : i = i.filter((e) => e !== "swarm-inference");
1430
1430
  } else i = i.filter((e) => e !== "swarm-inference");
1431
- X(`register capability probe capable=${n} wasmMemoryBytes=${t} capabilities=${JSON.stringify(i)} webgpu=${a?.webgpu ?? !1}`);
1431
+ Y(`register capability probe capable=${n} wasmMemoryBytes=${t} capabilities=${JSON.stringify(i)} webgpu=${a?.webgpu ?? !1}`);
1432
1432
  let o = this.config.orchestratorUrl.replace(/\/+$/, "");
1433
1433
  if (!e()) return null;
1434
1434
  let s = await fetch(`${o}/crowd/nodes/register`, {
@@ -1437,18 +1437,18 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1437
1437
  body: JSON.stringify({
1438
1438
  siteId: this.config.siteId,
1439
1439
  capabilities: i,
1440
- fileSources: Q(this.config.fileSourceOrigins).length > 0,
1441
- wasmMemoryBytes: m(),
1440
+ fileSources: Z(this.config.fileSourceOrigins).length > 0,
1441
+ wasmMemoryBytes: h(),
1442
1442
  deviceMemory: typeof navigator.deviceMemory == "number" ? navigator.deviceMemory : null,
1443
1443
  swarm: a
1444
1444
  })
1445
1445
  });
1446
1446
  if (!e()) return null;
1447
- if (!s.ok) return Z(`node register failed HTTP ${s.status} (${o}/crowd/nodes/register)`), null;
1447
+ if (!s.ok) return X(`node register failed HTTP ${s.status} (${o}/crowd/nodes/register)`), null;
1448
1448
  let c = await s.json();
1449
- return e() ? c.token ? (typeof c.nodeId == "string" && c.nodeId && (this.nodeId = c.nodeId), this.cachedToken = c, X(`node registered nodeId=${this.nodeId} expiresIn=${Math.round((c.expiresAt - Date.now()) / 1e3)}s`), c) : (Z("node register returned no token"), null) : null;
1449
+ return e() ? c.token ? (typeof c.nodeId == "string" && c.nodeId && (this.nodeId = c.nodeId), this.cachedToken = c, Y(`node registered nodeId=${this.nodeId} expiresIn=${Math.round((c.expiresAt - Date.now()) / 1e3)}s`), c) : (X("node register returned no token"), null) : null;
1450
1450
  } catch (e) {
1451
- return Z("node register threw", e instanceof Error ? e.message : e), null;
1451
+ return X("node register threw", e instanceof Error ? e.message : e), null;
1452
1452
  }
1453
1453
  }
1454
1454
  send(e) {
@@ -1462,15 +1462,15 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1462
1462
  let n = this.swarmHopKeys.get(e);
1463
1463
  if (n && n.chainLength > 1) {
1464
1464
  if (!n.outboundKey) {
1465
- Z(`swarm frame not sent: no hop key sessionId=${e}`);
1465
+ X(`swarm frame not sent: no hop key sessionId=${e}`);
1466
1466
  return;
1467
1467
  }
1468
- let r = await s(n.outboundKey, e, t), i = this.swarmPeerTransports.get(e);
1469
- (!i || !await i.sendFrame(r)) && this.sendBinary(r);
1468
+ let i = await r(n.outboundKey, e, t), a = this.swarmPeerTransports.get(e);
1469
+ (!a || !await a.sendFrame(i)) && this.sendBinary(i);
1470
1470
  return;
1471
1471
  }
1472
- let r = c(e, t), i = this.swarmPeerTransports.get(e);
1473
- (!i || !await i.sendFrame(r)) && this.sendBinary(r);
1472
+ let i = l(e, t), a = this.swarmPeerTransports.get(e);
1473
+ (!a || !await a.sendFrame(i)) && this.sendBinary(i);
1474
1474
  }).catch((t) => {
1475
1475
  let n = this.swarmPeerMetadata.get(e);
1476
1476
  !n || this.swarmFailureReported.has(e) || (this.swarmFailureReported.add(e), this.send({
@@ -1523,10 +1523,10 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1523
1523
  sessionId: n,
1524
1524
  payload: o,
1525
1525
  attemptId: a
1526
- }), X(`swarm result sent taskId=${e} durationMs=${Math.round(performance.now() - r)}`);
1526
+ }), Y(`swarm result sent taskId=${e} durationMs=${Math.round(performance.now() - r)}`);
1527
1527
  } catch (t) {
1528
1528
  let r = t instanceof Error ? t.message : String(t);
1529
- this.abortedTasks.delete(n) ? X(`swarm stopped on coordinator abort taskId=${e} error=${r}`) : (Z(`swarm failed taskId=${e} error=${r}`), this.send({
1529
+ this.abortedTasks.delete(n) ? Y(`swarm stopped on coordinator abort taskId=${e} error=${r}`) : (X(`swarm failed taskId=${e} error=${r}`), this.send({
1530
1530
  type: "error",
1531
1531
  taskId: e,
1532
1532
  sessionId: n,
@@ -1551,50 +1551,57 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1551
1551
  });
1552
1552
  }, {
1553
1553
  maxCpuLoad: this.effectiveMaxCpuLoad(),
1554
- fileSourceOrigins: Q(this.config.fileSourceOrigins),
1555
- containerImageOrigins: Q(this.config.containerImageOrigins)
1554
+ fileSourceOrigins: Z(this.config.fileSourceOrigins),
1555
+ containerImageOrigins: Z(this.config.containerImageOrigins),
1556
+ ccRangeOrigins: Z(this.config.ccRangeOrigins)
1556
1557
  });
1557
1558
  this.send({
1558
1559
  type: "result",
1559
1560
  taskId: e.taskId,
1560
1561
  payload: i,
1561
1562
  attemptId: n
1562
- }), X(`task result sent taskId=${e.taskId} workload=${e.workload} durationMs=${Math.round(performance.now() - t)}`);
1563
+ }), Y(`task result sent taskId=${e.taskId} workload=${e.workload} durationMs=${Math.round(performance.now() - t)}`);
1563
1564
  } finally {
1564
1565
  this.inflightTasks.delete(e.taskId), this.attempts.delete(e.taskId);
1565
1566
  }
1566
1567
  }
1567
1568
  async runLocalAiInference(e, t) {
1568
- if (!this.workerPool) throw new r("No running Crowd node on this device", "node_not_running");
1569
- if (z() !== "granted") throw new r("Crowd consent is not granted", "consent_not_granted");
1569
+ if (!this.workerPool) throw new o("No running Crowd node on this device", "node_not_running");
1570
+ if (z() !== "granted") throw new o("Crowd consent is not granted", "consent_not_granted");
1570
1571
  let n = `local-${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`}`;
1571
1572
  return await this.workerPool.run(n, "ai-inference", e, 3e5, t, {
1572
1573
  maxCpuLoad: this.effectiveMaxCpuLoad(),
1573
- fileSourceOrigins: Q(this.config.fileSourceOrigins),
1574
- containerImageOrigins: Q(this.config.containerImageOrigins)
1574
+ fileSourceOrigins: Z(this.config.fileSourceOrigins),
1575
+ containerImageOrigins: Z(this.config.containerImageOrigins)
1575
1576
  });
1576
1577
  }
1577
1578
  isAiModelPreloaded(e) {
1578
1579
  let t = this.workerPool.modelCacheSnapshot;
1579
- return t ? t.entries.some((t) => t.modelId === e && t.state === "ready") : !1;
1580
+ if (!t) return !1;
1581
+ if (typeof e == "string") return t.entries.some((t) => t.modelId === e && t.state === "ready");
1582
+ let n = e.dtype ?? "q4f16", r = e.device ?? "wasm";
1583
+ return t.entries.some((t) => t.modelId === e.model && t.dtype === n && t.backend === r && t.state === "ready");
1580
1584
  }
1581
1585
  async preloadAiModel(e) {
1582
1586
  let t = `preload-${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`}`;
1583
1587
  await this.workerPool.run(t, "ai-preload", e, 3e5, void 0, { maxCpuLoad: this.effectiveMaxCpuLoad() });
1584
1588
  }
1585
1589
  startLightPreloader() {
1586
- this.lightPreloader && this.lightPreloader.stop(), this.lightPreloader = new nn(() => z(), {
1590
+ this.lightPreloader && this.lightPreloader.stop(), this.lightPreloader = new an(() => z(), {
1587
1591
  targets: [{
1588
- model: Xt,
1589
- task: Zt,
1590
- dtype: Qt
1592
+ model: Qt,
1593
+ task: $t,
1594
+ dtype: en
1591
1595
  }, {
1592
- model: $t,
1593
- task: en,
1594
- dtype: tn
1596
+ model: tn,
1597
+ task: nn,
1598
+ dtype: rn
1595
1599
  }],
1596
1600
  onPreloaded: () => {}
1597
- }, (e) => this.isAiModelPreloaded(e), (e) => this.preloadAiModel(e)), this.lightPreloader.start();
1601
+ }, (e) => this.isAiModelPreloaded({
1602
+ model: e.model,
1603
+ dtype: e.dtype
1604
+ }), (e) => this.preloadAiModel(e)), this.lightPreloader.start();
1598
1605
  }
1599
1606
  stopLightPreloader() {
1600
1607
  this.lightPreloader && this.lightPreloader.stop(), this.lightPreloader = null;
@@ -1633,7 +1640,7 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1633
1640
  this.batteryState = null, this.networkState = null;
1634
1641
  }
1635
1642
  mobileLifecycleDecision() {
1636
- return Yt({
1643
+ return Zt({
1637
1644
  hidden: document.hidden,
1638
1645
  pageHidden: this.lifecyclePageHidden,
1639
1646
  online: !this.lifecycleOffline && navigator.onLine !== !1,
@@ -1649,27 +1656,27 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1649
1656
  refreshMobileLifecycle() {
1650
1657
  this.mobileLifecycleDecision().suspend ? this.suspend() : this.suspended && this.resume();
1651
1658
  }
1652
- }, $ = "__flaxia_node_signal_client", sn = "__flaxia_node_init_started", cn = "__flaxia_node_controller", ln = (e) => {
1659
+ }, $ = "__flaxia_node_signal_client", cn = "__flaxia_node_init_started", ln = "__flaxia_node_controller", un = (e) => {
1653
1660
  if (z() !== "granted") {
1654
- Z("refusing to start the node without a granted consent record");
1661
+ X("refusing to start the node without a granted consent record");
1655
1662
  return;
1656
1663
  }
1657
1664
  let t = window[$];
1658
- t && t.disconnect(), V(an);
1659
- let n = new URL("./worker.js", "" + import.meta.url).href, r = new St(n), i = $e(rn);
1660
- i || (i = nt(), et(rn, i));
1661
- let a = new on(e, r, i);
1665
+ t && t.disconnect(), nt(Q);
1666
+ let n = new URL("./worker.js", "" + import.meta.url).href, r = new wt(n), i = et(on);
1667
+ i || (i = it(), tt(on, i));
1668
+ let a = new sn(e, r, i);
1662
1669
  window[$] = a, a.connect();
1663
- }, un = class {
1670
+ }, dn = class {
1664
1671
  constructor(e) {
1665
1672
  this.config = e;
1666
1673
  }
1667
1674
  start() {
1668
- this.isRunning() || !Be() || ln(this.config);
1675
+ this.isRunning() || !Ve() || un(this.config);
1669
1676
  }
1670
1677
  stop() {
1671
1678
  let e = window[$];
1672
- e && e.disconnect(), delete window[$], delete window[sn];
1679
+ e && e.disconnect(), delete window[$], delete window[cn];
1673
1680
  }
1674
1681
  isRunning() {
1675
1682
  return !!window[$];
@@ -1678,17 +1685,17 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1678
1685
  return z();
1679
1686
  }
1680
1687
  grant() {
1681
- Je();
1688
+ Ye();
1682
1689
  }
1683
1690
  deny() {
1684
- Ze(), this.stop(), V(an);
1691
+ Qe(), this.stop(), nt(Q);
1685
1692
  }
1686
1693
  clearConsent() {
1687
- Qe(), this.stop(), V(an);
1694
+ $e(), this.stop(), nt(Q);
1688
1695
  }
1689
1696
  async runLocalAiInference(e, t) {
1690
1697
  let n = window[$];
1691
- if (!n || !this.isRunning()) throw new r("No running Crowd node on this device", "node_not_running");
1698
+ if (!n || !this.isRunning()) throw new o("No running Crowd node on this device", "node_not_running");
1692
1699
  return n.runLocalAiInference(e, t);
1693
1700
  }
1694
1701
  isAiModelPreloaded(e) {
@@ -1697,32 +1704,32 @@ var rn = "flaxia_node_id", an = "flaxia_node_token", on = class {
1697
1704
  }
1698
1705
  async preloadAiModel(e) {
1699
1706
  let t = window[$];
1700
- if (!t) throw new r("No running Crowd node on this device", "node_not_running");
1707
+ if (!t) throw new o("No running Crowd node on this device", "node_not_running");
1701
1708
  await t.preloadAiModel(e);
1702
1709
  }
1703
- }, dn = (e) => {
1704
- let t = window[cn];
1710
+ }, fn = (e) => {
1711
+ let t = window[ln];
1705
1712
  if (t) return t;
1706
- let n = new un(e);
1707
- window[cn] = n, window[sn] = !0;
1713
+ let n = new dn(e);
1714
+ window[ln] = n, window[cn] = !0;
1708
1715
  let r = z();
1709
1716
  if (r === "granted") return n.start(), n;
1710
1717
  if (r === "denied") return n;
1711
1718
  if (e.consent.onConsentRequired) return e.consent.onConsentRequired({
1712
1719
  state: r,
1713
1720
  accept: () => {
1714
- Je(), n.start();
1721
+ Ye(), n.start();
1715
1722
  },
1716
1723
  reject: () => {
1717
- Ze();
1724
+ Qe();
1718
1725
  }
1719
1726
  }), n;
1720
1727
  let i = document.createElement("div");
1721
- return i.id = "flaxia-consent-container", document.body.appendChild(i), new xt(i, e.consent, () => {
1722
- Je(), i.remove(), n.start();
1728
+ return i.id = "flaxia-consent-container", document.body.appendChild(i), new Ct(i, e.consent, () => {
1729
+ Ye(), i.remove(), n.start();
1723
1730
  }, () => {
1724
- Ze(), i.remove();
1731
+ Qe(), i.remove();
1725
1732
  }), n;
1726
1733
  };
1727
1734
  //#endregion
1728
- export { tn as LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE, oe as LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE_ID, $t as LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL, re as LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL_ID, en as LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK, ae as LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK_ID, b as LIGHT_INFERENCE_TRANSLATE_DTYPE, Xt as LIGHT_INFERENCE_TRANSLATE_MODEL, y as LIGHT_INFERENCE_TRANSLATE_MODEL_ID, ie as LIGHT_INFERENCE_TRANSLATE_TASK, z as getFlaxiaNodeConsentState, dn as initFlaxiaNode, B as initFlaxiaNodeConsent, te as isAiModelPreloaded, ne as preloadAiModel, Xe as setFlaxiaNodeHostManagedConsent };
1735
+ export { rn as LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE, se as LIGHT_INFERENCE_PLAMO_TRANSLATE_DTYPE_ID, tn as LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL, ie as LIGHT_INFERENCE_PLAMO_TRANSLATE_MODEL_ID, nn as LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK, oe as LIGHT_INFERENCE_PLAMO_TRANSLATE_TASK_ID, ne as LIGHT_INFERENCE_TRANSLATE_DTYPE, Qt as LIGHT_INFERENCE_TRANSLATE_MODEL, te as LIGHT_INFERENCE_TRANSLATE_MODEL_ID, ae as LIGHT_INFERENCE_TRANSLATE_TASK, z as getFlaxiaNodeConsentState, fn as initFlaxiaNode, B as initFlaxiaNodeConsent, b as isAiModelPreloaded, re as preloadAiModel, Ze as setFlaxiaNodeHostManagedConsent };