@kbve/droid 0.0.3 → 0.0.4

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/workers/main.js CHANGED
@@ -1,6 +1,6 @@
1
- import { w as b, p as Z, t as tt } from "../comlink-CC72iIUO.js";
2
- import { i as C, u as T, V as d, B as O, f as N, p as et, a as Y, t as it, b as j, c as st, d as nt, e as ot, g as rt, h as at, j as P } from "../reference-Dk_1njEH.js";
3
- import { z as k } from "../index-CsrTWP6J.js";
1
+ import { w as b, p as Z, t as tt } from "../comlink.js";
2
+ import { i as P, u as T, V as d, B as O, f as N, p as et, a as Y, t as it, b as j, c as st, d as ot, e as nt, g as rt, h as at, j as C } from "../reference.js";
3
+ import { z as k } from "../index.js";
4
4
  let F = Symbol("clean"), y = [], lt = (e, t) => {
5
5
  let i = [], s = {
6
6
  get() {
@@ -9,22 +9,22 @@ let F = Symbol("clean"), y = [], lt = (e, t) => {
9
9
  },
10
10
  l: 0,
11
11
  lc: 0,
12
- listen(n, o) {
13
- return s.lc = i.push(n, o || s.l) / 2, () => {
14
- let r = i.indexOf(n);
12
+ listen(o, n) {
13
+ return s.lc = i.push(o, n || s.l) / 2, () => {
14
+ let r = i.indexOf(o);
15
15
  ~r && (i.splice(r, 2), --s.lc || s.off());
16
16
  };
17
17
  },
18
- notify(n) {
19
- let o = !y.length;
18
+ notify(o) {
19
+ let n = !y.length;
20
20
  for (let r = 0; r < i.length; r += 2)
21
21
  y.push(
22
22
  i[r],
23
23
  i[r + 1],
24
24
  s.value,
25
- n
25
+ o
26
26
  );
27
- if (o) {
27
+ if (n) {
28
28
  for (let r = 0; r < y.length; r += 4) {
29
29
  let h;
30
30
  for (let c = r + 1; !h && (c += 4) < y.length; )
@@ -43,12 +43,12 @@ let F = Symbol("clean"), y = [], lt = (e, t) => {
43
43
  },
44
44
  /* It will be called on last listener unsubscribing.
45
45
  We will redefine it in onMount and onStop. */
46
- set(n) {
47
- s.value !== n && (s.value = n, s.notify());
46
+ set(o) {
47
+ s.value !== o && (s.value = o, s.notify());
48
48
  },
49
- subscribe(n, o) {
50
- let r = s.listen(n, o);
51
- return n(s.value), r;
49
+ subscribe(o, n) {
50
+ let r = s.listen(o, n);
51
+ return o(s.value), r;
52
52
  },
53
53
  value: e
54
54
  };
@@ -57,23 +57,23 @@ let F = Symbol("clean"), y = [], lt = (e, t) => {
57
57
  }), s;
58
58
  };
59
59
  const ft = 5, S = 6, V = 10;
60
- let ct = (e, t, i, s) => (e.events = e.events || {}, e.events[i + V] || (e.events[i + V] = s((n) => {
61
- e.events[i].reduceRight((o, r) => (r(o), o), {
60
+ let ct = (e, t, i, s) => (e.events = e.events || {}, e.events[i + V] || (e.events[i + V] = s((o) => {
61
+ e.events[i].reduceRight((n, r) => (r(n), n), {
62
62
  shared: {},
63
- ...n
63
+ ...o
64
64
  });
65
65
  })), e.events[i] = e.events[i] || [], e.events[i].push(t), () => {
66
- let n = e.events[i], o = n.indexOf(t);
67
- n.splice(o, 1), n.length || (delete e.events[i], e.events[i + V](), delete e.events[i + V]);
66
+ let o = e.events[i], n = o.indexOf(t);
67
+ o.splice(n, 1), o.length || (delete e.events[i], e.events[i + V](), delete e.events[i + V]);
68
68
  }), ht = 1e3, dt = (e, t) => ct(e, (s) => {
69
- let n = t(s);
70
- n && e.events[S].push(n);
69
+ let o = t(s);
70
+ o && e.events[S].push(o);
71
71
  }, ft, (s) => {
72
- let n = e.listen;
73
- e.listen = (...r) => (!e.lc && !e.active && (e.active = !0, s()), n(...r));
74
- let o = e.off;
72
+ let o = e.listen;
73
+ e.listen = (...r) => (!e.lc && !e.active && (e.active = !0, s()), o(...r));
74
+ let n = e.off;
75
75
  if (e.events[S] = [], e.off = () => {
76
- o(), setTimeout(() => {
76
+ n(), setTimeout(() => {
77
77
  if (e.active && !e.lc) {
78
78
  e.active = !1;
79
79
  for (let r of e.events[S]) r();
@@ -88,7 +88,7 @@ let ct = (e, t, i, s) => (e.events = e.events || {}, e.events[i + V] || (e.event
88
88
  };
89
89
  }
90
90
  return () => {
91
- e.listen = n, e.off = o;
91
+ e.listen = o, e.off = n;
92
92
  };
93
93
  }), ut = (e = {}) => {
94
94
  let t = lt(e);
@@ -119,51 +119,51 @@ let pt = {
119
119
  };
120
120
  typeof window < "u" && (v = pt);
121
121
  function G(e, t = {}, i = {}) {
122
- let s = i.encode || H, n = i.decode || H, o = ut(), r = o.setKey;
123
- o.setKey = (a, l) => {
124
- typeof l > "u" ? (i.listen !== !1 && v.perKey && v.removeEventListener(e + a, c, u), delete U[e + a]) : (i.listen !== !1 && v.perKey && !(a in o.value) && v.addEventListener(e + a, c, u), U[e + a] = s(l)), r(a, l);
122
+ let s = i.encode || H, o = i.decode || H, n = ut(), r = n.setKey;
123
+ n.setKey = (a, l) => {
124
+ typeof l > "u" ? (i.listen !== !1 && v.perKey && v.removeEventListener(e + a, c, u), delete U[e + a]) : (i.listen !== !1 && v.perKey && !(a in n.value) && v.addEventListener(e + a, c, u), U[e + a] = s(l)), r(a, l);
125
125
  };
126
- let h = o.set;
127
- o.set = function(a) {
126
+ let h = n.set;
127
+ n.set = function(a) {
128
128
  for (let l in a)
129
- o.setKey(l, a[l]);
130
- for (let l in o.value)
131
- l in a || o.setKey(l);
129
+ n.setKey(l, a[l]);
130
+ for (let l in n.value)
131
+ l in a || n.setKey(l);
132
132
  };
133
133
  function c(a) {
134
- a.key ? a.key.startsWith(e) && (a.newValue === null ? r(a.key.slice(e.length), void 0) : r(a.key.slice(e.length), n(a.newValue))) : h({});
134
+ a.key ? a.key.startsWith(e) && (a.newValue === null ? r(a.key.slice(e.length), void 0) : r(a.key.slice(e.length), o(a.newValue))) : h({});
135
135
  }
136
136
  function u() {
137
137
  let a = { ...t };
138
138
  for (let l in U)
139
- l.startsWith(e) && (a[l.slice(e.length)] = n(U[l]));
140
- o.set(a);
139
+ l.startsWith(e) && (a[l.slice(e.length)] = o(U[l]));
140
+ n.set(a);
141
141
  }
142
- return dt(o, () => {
142
+ return dt(n, () => {
143
143
  if (u(), i.listen !== !1)
144
144
  return v.addEventListener(e, c, u), () => {
145
145
  v.removeEventListener(e, c, u);
146
- for (let a in o.value)
146
+ for (let a in n.value)
147
147
  v.removeEventListener(e + a, c, u);
148
148
  };
149
- }), o;
149
+ }), n;
150
150
  }
151
151
  async function kt(e, {
152
152
  version: t,
153
153
  i18nPath: i = "https://discord.sh/i18n/db.json",
154
154
  locale: s = "en",
155
- defaults: n = {
155
+ defaults: o = {
156
156
  welcome: "Welcome to the app!"
157
157
  }
158
158
  }) {
159
159
  console.log("[init-worker] Initializing database...");
160
160
  try {
161
161
  await e.loadI18nFromJSON(i), console.log(`[init-worker] i18n loaded from ${i}`), await e.dbSet("locale", s);
162
- for (const [o, r] of Object.entries(n))
163
- await e.dbSet(o, r);
162
+ for (const [n, r] of Object.entries(o))
163
+ await e.dbSet(n, r);
164
164
  await e.setVersion(t), e.loadServersFromJSON(), console.log(`[init-worker] DB initialized to version ${t}`);
165
- } catch (o) {
166
- console.error("[init-worker] Initialization failed:", o);
165
+ } catch (n) {
166
+ console.error("[init-worker] Initialization failed:", n);
167
167
  }
168
168
  }
169
169
  let W = null;
@@ -182,10 +182,10 @@ async function yt(e) {
182
182
  function s(r) {
183
183
  t[r] && (t[r].worker.terminate(), delete t[r]);
184
184
  }
185
- function n() {
185
+ function o() {
186
186
  return Object.values(t).map((r) => r.meta);
187
187
  }
188
- async function o(r) {
188
+ async function n(r) {
189
189
  const h = t[r];
190
190
  if (!h) throw new Error(`Mod "${r}" not found`);
191
191
  return s(r), i(h.url);
@@ -194,20 +194,20 @@ async function yt(e) {
194
194
  registry: t,
195
195
  load: i,
196
196
  unload: s,
197
- list: n,
198
- reload: o
197
+ list: o,
198
+ reload: n
199
199
  }, W;
200
200
  }
201
201
  var E = /* @__PURE__ */ ((e) => (e[e.PAYLOAD_UNKNOWN = 0] = "PAYLOAD_UNKNOWN", e[e.JSON = 1] = "JSON", e[e.FLEX = 2] = "FLEX", e[e.PROTOBUF = 3] = "PROTOBUF", e[e.FLATBUFFER = 4] = "FLATBUFFER", e))(E || {}), m = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.ADD = 1] = "ADD", e[e.READ = 2] = "READ", e[e.GET = 4] = "GET", e[e.SET = 8] = "SET", e[e.DEL = 16] = "DEL", e[e.STREAM = 32] = "STREAM", e[e.GROUP = 64] = "GROUP", e[e.LIST = 128] = "LIST", e[e.ACTION = 256] = "ACTION", e[e.MESSAGE = 512] = "MESSAGE", e[e.INFO = 1024] = "INFO", e[e.DEBUG = 2048] = "DEBUG", e[e.ERROR = 4096] = "ERROR", e[e.AUTH = 8192] = "AUTH", e[e.HEARTBEAT = 16384] = "HEARTBEAT", e[e.CONFIG_UPDATE = 32768] = "CONFIG_UPDATE", e[e.REDIS = 65536] = "REDIS", e[e.SUPABASE = 131072] = "SUPABASE", e[e.FILESYSTEM = 262144] = "FILESYSTEM", e[e.WEBSOCKET = 524288] = "WEBSOCKET", e[e.HTTP_API = 1048576] = "HTTP_API", e[e.LOCAL_CACHE = 2097152] = "LOCAL_CACHE", e[e.AI = 4194304] = "AI", e))(m || {});
202
202
  class R {
203
- constructor(t, i, s, n = null, o = 0) {
204
- this.builder = t, this.type = i, this.width = s, this.value = n, this.offset = o;
203
+ constructor(t, i, s, o = null, n = 0) {
204
+ this.builder = t, this.type = i, this.width = s, this.value = o, this.offset = n;
205
205
  }
206
206
  elementWidth(t, i) {
207
- if (C(this.type)) return this.width;
207
+ if (P(this.type)) return this.width;
208
208
  for (let s = 0; s < 4; s++) {
209
- const n = 1 << s, r = t + Y(t, n) + i * n - this.offset, h = T(r);
210
- if (1 << h === n)
209
+ const o = 1 << s, r = t + Y(t, o) + i * o - this.offset, h = T(r);
210
+ if (1 << h === o)
211
211
  return h;
212
212
  }
213
213
  throw `Element is unknown. Size: ${t} at index: ${i}. This might be a bug. Please create an issue https://github.com/google/flatbuffers/issues/new`;
@@ -231,18 +231,18 @@ class R {
231
231
  this.offset = i;
232
232
  }
233
233
  storedWidth(t = O.WIDTH8) {
234
- return C(this.type) ? Math.max(t, this.width) : this.width;
234
+ return P(this.type) ? Math.max(t, this.width) : this.width;
235
235
  }
236
236
  storedPackedType(t = O.WIDTH8) {
237
237
  return et(this.type, this.storedWidth(t));
238
238
  }
239
239
  isOffset() {
240
- return !C(this.type);
240
+ return !P(this.type);
241
241
  }
242
242
  }
243
243
  class mt {
244
- constructor(t = 2048, i = !0, s = !0, n = !0) {
245
- this.dedupStrings = i, this.dedupKeys = s, this.dedupKeyVectors = n, this.stack = [], this.stackPointers = [], this.offset = 0, this.finished = !1, this.stringLookup = {}, this.keyLookup = {}, this.keyVectorLookup = {}, this.indirectIntLookup = {}, this.indirectUIntLookup = {}, this.indirectFloatLookup = {}, this.buffer = new ArrayBuffer(t > 0 ? t : 2048), this.view = new DataView(this.buffer);
244
+ constructor(t = 2048, i = !0, s = !0, o = !0) {
245
+ this.dedupStrings = i, this.dedupKeys = s, this.dedupKeyVectors = o, this.stack = [], this.stackPointers = [], this.offset = 0, this.finished = !1, this.stringLookup = {}, this.keyLookup = {}, this.keyVectorLookup = {}, this.indirectIntLookup = {}, this.indirectUIntLookup = {}, this.indirectFloatLookup = {}, this.buffer = new ArrayBuffer(t > 0 ? t : 2048), this.view = new DataView(this.buffer);
246
246
  }
247
247
  align(t) {
248
248
  const i = it(t);
@@ -251,12 +251,12 @@ class mt {
251
251
  computeOffset(t) {
252
252
  const i = this.offset + t;
253
253
  let s = this.buffer.byteLength;
254
- const n = s;
254
+ const o = s;
255
255
  for (; s < i; )
256
256
  s <<= 1;
257
- if (n < s) {
258
- const o = this.buffer;
259
- this.buffer = new ArrayBuffer(s), this.view = new DataView(this.buffer), new Uint8Array(this.buffer).set(new Uint8Array(o), 0);
257
+ if (o < s) {
258
+ const n = this.buffer;
259
+ this.buffer = new ArrayBuffer(s), this.view = new DataView(this.buffer), new Uint8Array(this.buffer).set(new Uint8Array(n), 0);
260
260
  }
261
261
  return i;
262
262
  }
@@ -293,21 +293,21 @@ class mt {
293
293
  this.pushUInt(t, N(i)), this.offset = s;
294
294
  }
295
295
  writeBlob(t) {
296
- const i = t.byteLength, s = T(i), n = this.align(s);
297
- this.writeUInt(i, n);
298
- const o = this.offset, r = this.computeOffset(i);
299
- new Uint8Array(this.buffer).set(new Uint8Array(t), o), this.stack.push(this.offsetStackValue(o, d.BLOB, s)), this.offset = r;
296
+ const i = t.byteLength, s = T(i), o = this.align(s);
297
+ this.writeUInt(i, o);
298
+ const n = this.offset, r = this.computeOffset(i);
299
+ new Uint8Array(this.buffer).set(new Uint8Array(t), n), this.stack.push(this.offsetStackValue(n, d.BLOB, s)), this.offset = r;
300
300
  }
301
301
  writeString(t) {
302
302
  if (this.dedupStrings && Object.prototype.hasOwnProperty.call(this.stringLookup, t)) {
303
303
  this.stack.push(this.stringLookup[t]);
304
304
  return;
305
305
  }
306
- const i = j(t), s = i.length, n = T(s), o = this.align(n);
307
- this.writeUInt(s, o);
306
+ const i = j(t), s = i.length, o = T(s), n = this.align(o);
307
+ this.writeUInt(s, n);
308
308
  const r = this.offset, h = this.computeOffset(s + 1);
309
309
  new Uint8Array(this.buffer).set(i, r);
310
- const c = this.offsetStackValue(r, d.STRING, n);
310
+ const c = this.offsetStackValue(r, d.STRING, o);
311
311
  this.stack.push(c), this.dedupStrings && (this.stringLookup[t] = c), this.offset = h;
312
312
  }
313
313
  writeKey(t) {
@@ -315,17 +315,17 @@ class mt {
315
315
  this.stack.push(this.keyLookup[t]);
316
316
  return;
317
317
  }
318
- const i = j(t), s = i.length, n = this.computeOffset(s + 1);
318
+ const i = j(t), s = i.length, o = this.computeOffset(s + 1);
319
319
  new Uint8Array(this.buffer).set(i, this.offset);
320
- const o = this.offsetStackValue(this.offset, d.KEY, O.WIDTH8);
321
- this.stack.push(o), this.dedupKeys && (this.keyLookup[t] = o), this.offset = n;
320
+ const n = this.offsetStackValue(this.offset, d.KEY, O.WIDTH8);
321
+ this.stack.push(n), this.dedupKeys && (this.keyLookup[t] = n), this.offset = o;
322
322
  }
323
323
  writeStackValue(t, i) {
324
324
  const s = this.computeOffset(i);
325
325
  if (t.isOffset()) {
326
- const n = this.offset - t.offset;
327
- if (i === 8 || BigInt(n) < BigInt(1) << BigInt(i * 8))
328
- this.writeUInt(n, i);
326
+ const o = this.offset - t.offset;
327
+ if (i === 8 || BigInt(o) < BigInt(1) << BigInt(i * 8))
328
+ this.writeUInt(o, i);
329
329
  else
330
330
  throw `Unexpected size ${i}. This might be a bug. Please create an issue https://github.com/google/flatbuffers/issues/new`;
331
331
  } else
@@ -361,12 +361,12 @@ class mt {
361
361
  i += `,${this.stack[r].offset}`;
362
362
  const s = this.stack.length - t.stackPosition >> 1;
363
363
  this.dedupKeyVectors && !Object.prototype.hasOwnProperty.call(this.keyVectorLookup, i) && (this.keyVectorLookup[i] = this.createVector(t.stackPosition, s, 2));
364
- const n = this.dedupKeyVectors ? this.keyVectorLookup[i] : this.createVector(t.stackPosition, s, 2), o = this.createVector(t.stackPosition + 1, s, 2, n);
365
- this.stack.splice(t.stackPosition, s << 1), this.stack.push(o);
364
+ const o = this.dedupKeyVectors ? this.keyVectorLookup[i] : this.createVector(t.stackPosition, s, 2), n = this.createVector(t.stackPosition + 1, s, 2, o);
365
+ this.stack.splice(t.stackPosition, s << 1), this.stack.push(n);
366
366
  }
367
367
  sort(t) {
368
368
  const i = this.view, s = this.stack;
369
- function n(a, l) {
369
+ function o(a, l) {
370
370
  if (a.type !== d.KEY || l.type !== d.KEY)
371
371
  throw `Stack values are not keys ${a} | ${l}. Check if you combined [addKey] with add... method calls properly.`;
372
372
  let f, w, p = 0;
@@ -377,7 +377,7 @@ class mt {
377
377
  } while (f !== 0 && w !== 0);
378
378
  return !1;
379
379
  }
380
- function o(a, l, f) {
380
+ function n(a, l, f) {
381
381
  if (l === f) return;
382
382
  const w = a[l], p = a[l + 1];
383
383
  a[l] = a[f], a[l + 1] = a[f + 1], a[f] = w, a[f + 1] = p;
@@ -386,8 +386,8 @@ class mt {
386
386
  for (let a = t.stackPosition; a < s.length; a += 2) {
387
387
  let l = a;
388
388
  for (let f = a + 2; f < s.length; f += 2)
389
- n(s[l], s[f]) && (l = f);
390
- l !== a && o(s, l, a);
389
+ o(s[l], s[f]) && (l = f);
390
+ l !== a && n(s, l, a);
391
391
  }
392
392
  }
393
393
  function h(a, l) {
@@ -412,14 +412,14 @@ class mt {
412
412
  p += 2;
413
413
  for (; h(w, s[I]); )
414
414
  I -= 2;
415
- p <= I && (o(s, p, I), p += 2, I -= 2);
415
+ p <= I && (n(s, p, I), p += 2, I -= 2);
416
416
  } while (p <= I);
417
417
  c(a, I), c(p, l);
418
418
  }
419
419
  }
420
420
  let u = !0;
421
421
  for (let a = t.stackPosition; a < this.stack.length - 2; a += 2)
422
- if (n(this.stack[a], this.stack[a + 2])) {
422
+ if (o(this.stack[a], this.stack[a + 2])) {
423
423
  u = !1;
424
424
  break;
425
425
  }
@@ -430,32 +430,32 @@ class mt {
430
430
  const t = this.stackPointers.pop();
431
431
  t.isVector ? this.endVector(t) : this.endMap(t);
432
432
  }
433
- createVector(t, i, s, n = null) {
434
- let o = T(i), r = 1;
435
- if (n !== null) {
436
- const f = n.elementWidth(this.offset, 0);
437
- f > o && (o = f), r += 2;
433
+ createVector(t, i, s, o = null) {
434
+ let n = T(i), r = 1;
435
+ if (o !== null) {
436
+ const f = o.elementWidth(this.offset, 0);
437
+ f > n && (n = f), r += 2;
438
438
  }
439
- let h = d.KEY, c = n === null;
439
+ let h = d.KEY, c = o === null;
440
440
  for (let f = t; f < this.stack.length; f += s) {
441
441
  const w = this.stack[f].elementWidth(this.offset, f + r);
442
- w > o && (o = w), f === t ? (h = this.stack[f].type, c = c && st(h)) : h !== this.stack[f].type && (c = !1);
442
+ w > n && (n = w), f === t ? (h = this.stack[f].type, c = c && st(h)) : h !== this.stack[f].type && (c = !1);
443
443
  }
444
- const u = this.align(o), a = c && nt(h) && i >= 2 && i <= 4;
445
- n !== null && (this.writeStackValue(n, u), this.writeUInt(1 << n.width, u)), a || this.writeUInt(i, u);
444
+ const u = this.align(n), a = c && ot(h) && i >= 2 && i <= 4;
445
+ o !== null && (this.writeStackValue(o, u), this.writeUInt(1 << o.width, u)), a || this.writeUInt(i, u);
446
446
  const l = this.offset;
447
447
  for (let f = t; f < this.stack.length; f += s)
448
448
  this.writeStackValue(this.stack[f], u);
449
449
  if (!c)
450
450
  for (let f = t; f < this.stack.length; f += s)
451
451
  this.writeUInt(this.stack[f].storedPackedType(), 1);
452
- if (n !== null)
453
- return this.offsetStackValue(l, d.MAP, o);
452
+ if (o !== null)
453
+ return this.offsetStackValue(l, d.MAP, n);
454
454
  if (c) {
455
- const f = ot(h, a ? i : 0);
456
- return this.offsetStackValue(l, f, o);
455
+ const f = nt(h, a ? i : 0);
456
+ return this.offsetStackValue(l, f, n);
457
457
  }
458
- return this.offsetStackValue(l, d.VECTOR, o);
458
+ return this.offsetStackValue(l, d.VECTOR, n);
459
459
  }
460
460
  nullStackValue() {
461
461
  return new R(this, d.NULL, O.WIDTH8);
@@ -505,8 +505,8 @@ class mt {
505
505
  const i = Object.getOwnPropertyNames(t).sort();
506
506
  this.startMap(!0);
507
507
  for (let s = 0; s < i.length; s++) {
508
- const n = i[s];
509
- this.addKey(n), this.add(t[n]);
508
+ const o = i[s];
509
+ this.addKey(o), this.add(t[o]);
510
510
  }
511
511
  this.end();
512
512
  } else
@@ -532,9 +532,9 @@ class mt {
532
532
  this.stack.push(this.indirectIntLookup[t]);
533
533
  return;
534
534
  }
535
- const n = this.intStackValue(t), o = this.align(n.width), r = this.computeOffset(o), h = this.offset;
536
- n.writeToBuffer(o);
537
- const c = this.offsetStackValue(h, d.INDIRECT_INT, n.width);
535
+ const o = this.intStackValue(t), n = this.align(o.width), r = this.computeOffset(n), h = this.offset;
536
+ o.writeToBuffer(n);
537
+ const c = this.offsetStackValue(h, d.INDIRECT_INT, o.width);
538
538
  this.stack.push(c), this.offset = r, s && (this.indirectIntLookup[t] = c);
539
539
  }
540
540
  addUInt(t, i = !1, s = !1) {
@@ -546,9 +546,9 @@ class mt {
546
546
  this.stack.push(this.indirectUIntLookup[t]);
547
547
  return;
548
548
  }
549
- const n = this.uintStackValue(t), o = this.align(n.width), r = this.computeOffset(o), h = this.offset;
550
- n.writeToBuffer(o);
551
- const c = this.offsetStackValue(h, d.INDIRECT_UINT, n.width);
549
+ const o = this.uintStackValue(t), n = this.align(o.width), r = this.computeOffset(n), h = this.offset;
550
+ o.writeToBuffer(n);
551
+ const c = this.offsetStackValue(h, d.INDIRECT_UINT, o.width);
552
552
  this.stack.push(c), this.offset = r, s && (this.indirectUIntLookup[t] = c);
553
553
  }
554
554
  addFloat(t, i = !1, s = !1) {
@@ -560,9 +560,9 @@ class mt {
560
560
  this.stack.push(this.indirectFloatLookup[t]);
561
561
  return;
562
562
  }
563
- const n = this.floatStackValue(t), o = this.align(n.width), r = this.computeOffset(o), h = this.offset;
564
- n.writeToBuffer(o);
565
- const c = this.offsetStackValue(h, d.INDIRECT_FLOAT, n.width);
563
+ const o = this.floatStackValue(t), n = this.align(o.width), r = this.computeOffset(n), h = this.offset;
564
+ o.writeToBuffer(n);
565
+ const c = this.offsetStackValue(h, d.INDIRECT_FLOAT, o.width);
566
566
  this.stack.push(c), this.offset = r, s && (this.indirectFloatLookup[t] = c);
567
567
  }
568
568
  }
@@ -576,19 +576,19 @@ function gt(e) {
576
576
  t.addKey(i), t.add(s);
577
577
  return t.end(), t.finish();
578
578
  }
579
- function A(e, t, i, s, n = 1) {
580
- let o;
579
+ function A(e, t, i, s, o = 1) {
580
+ let n;
581
581
  if (i === E.FLEX)
582
- o = gt(e);
582
+ n = gt(e);
583
583
  else if (i === E.JSON)
584
- o = new TextEncoder().encode(JSON.stringify(e));
584
+ n = new TextEncoder().encode(JSON.stringify(e));
585
585
  else
586
586
  throw new Error("Unsupported format for wrapEnvelope");
587
587
  const r = B();
588
- return r.startMap(), r.addKey("version"), r.add(n), r.addKey("kind"), r.add(t), r.addKey("format"), r.add(i), r.addKey("payload"), r.add(o), r.addKey("metadata"), r.add(s ?? new Uint8Array()), r.end(), r.finish();
588
+ return r.startMap(), r.addKey("version"), r.add(o), r.addKey("kind"), r.add(t), r.addKey("format"), r.add(i), r.addKey("payload"), r.add(n), r.addKey("metadata"), r.add(s ?? new Uint8Array()), r.end(), r.finish();
589
589
  }
590
590
  function J(e) {
591
- const t = e instanceof Uint8Array ? e : new Uint8Array(e), i = P(t.buffer).toObject();
591
+ const t = e instanceof Uint8Array ? e : new Uint8Array(e), i = C(t.buffer).toObject();
592
592
  if (typeof i.version != "number" || typeof i.kind != "number" || typeof i.format != "number" || !i.payload)
593
593
  throw console.error("[unwrapEnvelope] Bad root:", i), new Error("[unwrapEnvelope] Invalid envelope structure");
594
594
  const s = {
@@ -598,17 +598,17 @@ function J(e) {
598
598
  payload: new Uint8Array(i.payload),
599
599
  metadata: i.metadata ? new Uint8Array(i.metadata) : void 0
600
600
  };
601
- let n;
601
+ let o;
602
602
  if (s.format === E.FLEX)
603
- n = P(s.payload.buffer).toObject();
603
+ o = C(s.payload.buffer).toObject();
604
604
  else if (s.format === E.JSON)
605
- n = JSON.parse(new TextDecoder().decode(s.payload));
605
+ o = JSON.parse(new TextDecoder().decode(s.payload));
606
606
  else
607
607
  throw new Error(`[unwrapEnvelope] Unsupported format: ${s.format}`);
608
- return { envelope: s, payload: n };
608
+ return { envelope: s, payload: o };
609
609
  }
610
610
  function X(e) {
611
- return P(e.buffer).toObject();
611
+ return C(e.buffer).toObject();
612
612
  }
613
613
  function Ot(e) {
614
614
  try {
@@ -661,8 +661,8 @@ function Rt(e, t, i) {
661
661
  for (const { stream: r, id: h } of e)
662
662
  s.startMap(), s.addKey("stream"), s.add(r), s.addKey("id"), s.add(h), s.end();
663
663
  s.end(), t !== void 0 && (s.addKey("count"), s.add(t)), i !== void 0 && (s.addKey("block"), s.add(i)), s.end();
664
- const n = s.finish(), o = B();
665
- return o.startMap(), o.addKey("version"), o.add(1), o.addKey("kind"), o.add(m.READ | m.STREAM | m.REDIS), o.addKey("format"), o.add(E.FLEX), o.addKey("payload"), o.add(n), o.addKey("metadata"), o.add(new Uint8Array()), o.end(), o.finish();
664
+ const o = s.finish(), n = B();
665
+ return n.startMap(), n.addKey("version"), n.add(1), n.addKey("kind"), n.add(m.READ | m.STREAM | m.REDIS), n.addKey("format"), n.add(E.FLEX), n.addKey("payload"), n.add(o), n.addKey("metadata"), n.add(new Uint8Array()), n.end(), n.finish();
666
666
  }
667
667
  const Dt = {
668
668
  wrapEnvelope: A,
@@ -693,8 +693,8 @@ function Q(e) {
693
693
  else if (i === "style" && typeof s == "object")
694
694
  Object.assign(t.style, s);
695
695
  else if (i === "dataset" && typeof s == "object")
696
- for (const [n, o] of Object.entries(s))
697
- t.dataset[n] = String(o);
696
+ for (const [o, n] of Object.entries(s))
697
+ t.dataset[o] = String(n);
698
698
  else
699
699
  try {
700
700
  t.setAttribute(i, String(s));
@@ -748,18 +748,18 @@ class Nt {
748
748
  if (s)
749
749
  try {
750
750
  s.parse(i);
751
- } catch (n) {
752
- console.error(`[DroidEventBus] Invalid payload for ${t}:`, n);
751
+ } catch (o) {
752
+ console.error(`[DroidEventBus] Invalid payload for ${t}:`, o);
753
753
  return;
754
754
  }
755
755
  window.dispatchEvent(new CustomEvent(t, { detail: i }));
756
- for (const n of this.listeners.get(t) ?? [])
757
- n(i);
756
+ for (const o of this.listeners.get(t) ?? [])
757
+ o(i);
758
758
  }
759
759
  wait(t) {
760
760
  return new Promise((i) => {
761
- const s = (n) => {
762
- this.off(t, s), i(n);
761
+ const s = (o) => {
762
+ this.off(t, s), i(o);
763
763
  };
764
764
  this.on(t, s);
765
765
  });
@@ -776,12 +776,12 @@ function xt(e, t) {
776
776
  }
777
777
  return t ?? `/workers/${e}`;
778
778
  }
779
- async function Ct(e) {
779
+ async function Pt(e) {
780
780
  let t = null;
781
781
  try {
782
782
  const i = new SharedWorker(new URL(
783
783
  /* @vite-ignore */
784
- "/assets/ws-worker-FssAQgaD.js",
784
+ "/lib/workers/ws-worker.js",
785
785
  import.meta.url
786
786
  ), {
787
787
  type: "module"
@@ -832,12 +832,12 @@ const g = G(
832
832
  decode: JSON.parse
833
833
  }
834
834
  );
835
- async function Pt(e) {
835
+ async function Ct(e) {
836
836
  try {
837
837
  const t = new Worker(
838
838
  new URL(
839
839
  /* @vite-ignore */
840
- "/assets/canvas-worker-DbsoY2Xv.js",
840
+ "/lib/workers/canvas-worker.js",
841
841
  import.meta.url
842
842
  ),
843
843
  { type: "module" }
@@ -954,10 +954,10 @@ const z = {
954
954
  async hydrateLocale(e = "en") {
955
955
  if (!this.api) return;
956
956
  const i = (await this.api.getAllI18nKeys()).filter(
957
- (n) => n.startsWith(`${e}:`)
957
+ (o) => o.startsWith(`${e}:`)
958
958
  ), s = await this.api.getTranslations(i);
959
- for (const [n, o] of Object.entries(s))
960
- console.log(`[i18n.setKey] ${n} = ${o}`), this.store.setKey(n, o);
959
+ for (const [o, n] of Object.entries(s))
960
+ console.log(`[i18n.setKey] ${o} = ${n}`), this.store.setKey(o, n);
961
961
  }
962
962
  };
963
963
  function K() {
@@ -973,7 +973,7 @@ async function Ft(e) {
973
973
  const s = new SharedWorker(
974
974
  new URL(
975
975
  /* @vite-ignore */
976
- "/assets/db-worker-CjXS52DQ.js",
976
+ "/lib/workers/db-worker.js",
977
977
  import.meta.url
978
978
  ),
979
979
  {
@@ -1018,8 +1018,8 @@ async function Ft(e) {
1018
1018
  function jt(e, t) {
1019
1019
  const i = Z(async (s) => {
1020
1020
  q(() => {
1021
- const n = `ws:${Date.now()}`;
1022
- t.storeWsMessage(n, s);
1021
+ const o = `ws:${Date.now()}`;
1022
+ t.storeWsMessage(o, s);
1023
1023
  });
1024
1024
  });
1025
1025
  e.onMessage(tt(i, [0]));
@@ -1031,7 +1031,7 @@ async function zt(e) {
1031
1031
  )), console.log("[DROID] Main<T> => Worker URLs", e?.workerURLs), !window.kbve?.api || !window.kbve?.i18n || !window.kbve?.uiux)
1032
1032
  try {
1033
1033
  console.log("[DROID] Main<T> => Worker => CanvasComlink");
1034
- const i = await Pt({
1034
+ const i = await Ct({
1035
1035
  workerRef: e?.workerRefs?.canvasWorker,
1036
1036
  workerURL: e?.workerURLs?.canvasWorker
1037
1037
  });
@@ -1041,31 +1041,31 @@ async function zt(e) {
1041
1041
  workerRef: e?.workerRefs?.dbWorker
1042
1042
  });
1043
1043
  console.log("[DROID] Main<T> => Worker => WsComlink");
1044
- const n = await Ct({
1044
+ const o = await Pt({
1045
1045
  workerRef: e?.workerRefs?.wsWorker,
1046
1046
  workerURL: e?.workerURLs?.wsWorker
1047
1047
  });
1048
1048
  console.log("[DROID] Main<T> => Worker => ModManager");
1049
- const o = await yt(
1049
+ const n = await yt(
1050
1050
  (c) => e?.workerURLs?.[c] ?? c
1051
1051
  ), r = Bt;
1052
- for (const c of Object.values(o.registry))
1052
+ for (const c of Object.values(n.registry))
1053
1053
  typeof c.instance.init == "function" && await c.instance.init({
1054
1054
  emitFromWorker: z.emitFromWorker
1055
1055
  }), console.log("[Event] -> Fire Mod Ready"), r.emit("droid-mod-ready", {
1056
1056
  meta: c.meta,
1057
1057
  timestamp: Date.now()
1058
1058
  });
1059
- jt(n, s);
1059
+ jt(o, s);
1060
1060
  const h = Dt;
1061
1061
  L.api = s, L.ready = L.hydrateLocale("en"), window.kbve = {
1062
1062
  ...window.kbve || {},
1063
1063
  api: s,
1064
1064
  i18n: L,
1065
1065
  uiux: { ...z, worker: i },
1066
- ws: n,
1066
+ ws: o,
1067
1067
  data: h,
1068
- mod: o,
1068
+ mod: n,
1069
1069
  events: r
1070
1070
  }, await L.ready, window.kbve.events.emit("droid-ready", {
1071
1071
  timestamp: Date.now()