brs-js 3.3.0 → 3.4.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.
package/dist/dist.mjs CHANGED
@@ -2884,20 +2884,20 @@ function Yr(e) {
2884
2884
  for (let t = 0; t < e.length; t++) e[t] = qr(e[t]);
2885
2885
  return e;
2886
2886
  }
2887
- var Xr = Kr ? (e) => e : Yr, Zr = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Qr = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
2888
- function $r(e) {
2889
- if (Rr(e), Zr) return e.toHex();
2887
+ var J = Kr ? (e) => e : Yr, Xr = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Zr = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
2888
+ function Qr(e) {
2889
+ if (Rr(e), Xr) return e.toHex();
2890
2890
  let t = "";
2891
- for (let n = 0; n < e.length; n++) t += Qr[e[n]];
2891
+ for (let n = 0; n < e.length; n++) t += Zr[e[n]];
2892
2892
  return t;
2893
2893
  }
2894
- function ei(e, t = {}) {
2894
+ function $r(e, t = {}) {
2895
2895
  let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
2896
2896
  return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.canXOF = r.canXOF, n.create = (t) => e(t), Object.assign(n, t), Object.freeze(n);
2897
2897
  }
2898
2898
  //#endregion
2899
2899
  //#region node_modules/@noble/hashes/_md.js
2900
- var ti = /* @__PURE__ */ Uint32Array.from([
2900
+ var ei = /* @__PURE__ */ Uint32Array.from([
2901
2901
  1779033703,
2902
2902
  3144134277,
2903
2903
  1013904242,
@@ -2906,19 +2906,19 @@ var ti = /* @__PURE__ */ Uint32Array.from([
2906
2906
  2600822924,
2907
2907
  528734635,
2908
2908
  1541459225
2909
- ]), ni = /* @__PURE__ */ BigInt(2 ** 32 - 1), ri = /* @__PURE__ */ BigInt(32);
2910
- function ii(e, t = !1) {
2909
+ ]), ti = /* @__PURE__ */ BigInt(2 ** 32 - 1), ni = /* @__PURE__ */ BigInt(32);
2910
+ function ri(e, t = !1) {
2911
2911
  return t ? {
2912
- h: Number(e & ni),
2913
- l: Number(e >> ri & ni)
2912
+ h: Number(e & ti),
2913
+ l: Number(e >> ni & ti)
2914
2914
  } : {
2915
- h: Number(e >> ri & ni) | 0,
2916
- l: Number(e & ni) | 0
2915
+ h: Number(e >> ni & ti) | 0,
2916
+ l: Number(e & ti) | 0
2917
2917
  };
2918
2918
  }
2919
2919
  //#endregion
2920
2920
  //#region node_modules/@noble/hashes/_blake.js
2921
- function ai(e, t, n, r, i) {
2921
+ function ii(e, t, n, r, i) {
2922
2922
  return e = e + t + i | 0, r = Gr(r ^ e, 16), n = n + r | 0, t = Gr(t ^ n, 12), {
2923
2923
  a: e,
2924
2924
  b: t,
@@ -2926,7 +2926,7 @@ function ai(e, t, n, r, i) {
2926
2926
  d: r
2927
2927
  };
2928
2928
  }
2929
- function oi(e, t, n, r, i) {
2929
+ function ai(e, t, n, r, i) {
2930
2930
  return e = e + t + i | 0, r = Gr(r ^ e, 8), n = n + r | 0, t = Gr(t ^ n, 7), {
2931
2931
  a: e,
2932
2932
  b: t,
@@ -2936,7 +2936,7 @@ function oi(e, t, n, r, i) {
2936
2936
  }
2937
2937
  //#endregion
2938
2938
  //#region node_modules/@noble/hashes/blake2.js
2939
- var si = class {
2939
+ var oi = class {
2940
2940
  constructor(e, t) {
2941
2941
  l(this, "buffer", void 0), l(this, "buffer32", void 0), l(this, "finished", !1), l(this, "destroyed", !1), l(this, "length", 0), l(this, "pos", 0), l(this, "blockLen", void 0), l(this, "outputLen", void 0), l(this, "canXOF", !1), Lr(e), Lr(t), this.blockLen = e, this.outputLen = t, this.buffer = new Uint8Array(e), this.buffer32 = Ur(this.buffer);
2942
2942
  }
@@ -2944,13 +2944,13 @@ var si = class {
2944
2944
  Br(this), Rr(e);
2945
2945
  let { blockLen: t, buffer: n, buffer32: r } = this, i = e.length, a = e.byteOffset, o = e.buffer;
2946
2946
  for (let s = 0; s < i;) {
2947
- this.pos === t && (Xr(r), this.compress(r, 0, !1), Xr(r), this.pos = 0);
2947
+ this.pos === t && (J(r), this.compress(r, 0, !1), J(r), this.pos = 0);
2948
2948
  let c = Math.min(t - this.pos, i - s), l = a + s;
2949
2949
  if (c === t && !(l % 4) && s + c < i) {
2950
2950
  let e = new Uint32Array(o, l, Math.floor((i - s) / 4));
2951
- Xr(e);
2951
+ J(e);
2952
2952
  for (let n = 0; s + t < i; n += r.length, s += t) this.length += t, this.compress(e, n, !1);
2953
- Xr(e);
2953
+ J(e);
2954
2954
  continue;
2955
2955
  }
2956
2956
  n.set(e.subarray(s, s + c), this.pos), this.pos += c, this.length += c, s += c;
@@ -2960,7 +2960,7 @@ var si = class {
2960
2960
  digestInto(e) {
2961
2961
  Br(this), Vr(e, this);
2962
2962
  let { pos: t, buffer32: n } = this;
2963
- if (this.finished = !0, Wr(this.buffer.subarray(t)), Xr(n), this.compress(n, 0, !0), Xr(n), e.byteOffset & 3) throw RangeError("\"digestInto() output\" expected 4-byte aligned byteOffset, got " + e.byteOffset);
2963
+ if (this.finished = !0, Wr(this.buffer.subarray(t)), J(n), this.compress(n, 0, !0), J(n), e.byteOffset & 3) throw RangeError("\"digestInto() output\" expected 4-byte aligned byteOffset, got " + e.byteOffset);
2964
2964
  let r = this.get(), i = Ur(e), a = Math.floor(this.outputLen / 4);
2965
2965
  for (let e = 0; e < a; e++) i[e] = Jr(r[e]);
2966
2966
  let o = this.outputLen % 4;
@@ -2982,9 +2982,9 @@ var si = class {
2982
2982
  return this._cloneInto();
2983
2983
  }
2984
2984
  };
2985
- function ci(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y) {
2985
+ function si(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y) {
2986
2986
  let b = 0;
2987
- for (let x = 0; x < r; x++) ({a: i, b: c, c: f, d: g} = ai(i, c, f, g, n[t + e[b++]])), {a: i, b: c, c: f, d: g} = oi(i, c, f, g, n[t + e[b++]]), {a: a, b: l, c: p, d: _} = ai(a, l, p, _, n[t + e[b++]]), {a: a, b: l, c: p, d: _} = oi(a, l, p, _, n[t + e[b++]]), {a: o, b: u, c: m, d: v} = ai(o, u, m, v, n[t + e[b++]]), {a: o, b: u, c: m, d: v} = oi(o, u, m, v, n[t + e[b++]]), {a: s, b: d, c: h, d: y} = ai(s, d, h, y, n[t + e[b++]]), {a: s, b: d, c: h, d: y} = oi(s, d, h, y, n[t + e[b++]]), {a: i, b: l, c: m, d: y} = ai(i, l, m, y, n[t + e[b++]]), {a: i, b: l, c: m, d: y} = oi(i, l, m, y, n[t + e[b++]]), {a: a, b: u, c: h, d: g} = ai(a, u, h, g, n[t + e[b++]]), {a: a, b: u, c: h, d: g} = oi(a, u, h, g, n[t + e[b++]]), {a: o, b: d, c: f, d: _} = ai(o, d, f, _, n[t + e[b++]]), {a: o, b: d, c: f, d: _} = oi(o, d, f, _, n[t + e[b++]]), {a: s, b: c, c: p, d: v} = ai(s, c, p, v, n[t + e[b++]]), {a: s, b: c, c: p, d: v} = oi(s, c, p, v, n[t + e[b++]]);
2987
+ for (let x = 0; x < r; x++) ({a: i, b: c, c: f, d: g} = ii(i, c, f, g, n[t + e[b++]])), {a: i, b: c, c: f, d: g} = ai(i, c, f, g, n[t + e[b++]]), {a: a, b: l, c: p, d: _} = ii(a, l, p, _, n[t + e[b++]]), {a: a, b: l, c: p, d: _} = ai(a, l, p, _, n[t + e[b++]]), {a: o, b: u, c: m, d: v} = ii(o, u, m, v, n[t + e[b++]]), {a: o, b: u, c: m, d: v} = ai(o, u, m, v, n[t + e[b++]]), {a: s, b: d, c: h, d: y} = ii(s, d, h, y, n[t + e[b++]]), {a: s, b: d, c: h, d: y} = ai(s, d, h, y, n[t + e[b++]]), {a: i, b: l, c: m, d: y} = ii(i, l, m, y, n[t + e[b++]]), {a: i, b: l, c: m, d: y} = ai(i, l, m, y, n[t + e[b++]]), {a: a, b: u, c: h, d: g} = ii(a, u, h, g, n[t + e[b++]]), {a: a, b: u, c: h, d: g} = ai(a, u, h, g, n[t + e[b++]]), {a: o, b: d, c: f, d: _} = ii(o, d, f, _, n[t + e[b++]]), {a: o, b: d, c: f, d: _} = ai(o, d, f, _, n[t + e[b++]]), {a: s, b: c, c: p, d: v} = ii(s, c, p, v, n[t + e[b++]]), {a: s, b: c, c: p, d: v} = ai(s, c, p, v, n[t + e[b++]]);
2988
2988
  return {
2989
2989
  v0: i,
2990
2990
  v1: a,
@@ -3006,7 +3006,7 @@ function ci(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y) {
3006
3006
  }
3007
3007
  //#endregion
3008
3008
  //#region node_modules/@noble/hashes/blake3.js
3009
- var li = {
3009
+ var ci = {
3010
3010
  CHUNK_START: 1,
3011
3011
  CHUNK_END: 2,
3012
3012
  PARENT: 4,
@@ -3014,7 +3014,7 @@ var li = {
3014
3014
  KEYED_HASH: 16,
3015
3015
  DERIVE_KEY_CONTEXT: 32,
3016
3016
  DERIVE_KEY_MATERIAL: 64
3017
- }, ui = /* @__PURE__ */ ti.slice(), di = /* @__PURE__ */ (() => {
3017
+ }, li = /* @__PURE__ */ ei.slice(), ui = /* @__PURE__ */ (() => {
3018
3018
  let e = Array.from({ length: 16 }, (e, t) => t), t = (e) => [
3019
3019
  2,
3020
3020
  6,
@@ -3035,7 +3035,7 @@ var li = {
3035
3035
  ].map((t) => e[t]), n = [];
3036
3036
  for (let r = 0, i = e; r < 7; r++, i = t(i)) n.push(...i);
3037
3037
  return Uint8Array.from(n);
3038
- })(), fi = class e extends si {
3038
+ })(), di = class e extends oi {
3039
3039
  constructor(t = {}, n = 0) {
3040
3040
  super(64, t.dkLen === void 0 ? 32 : t.dkLen), l(this, "canXOF", !0), l(this, "chunkPos", 0), l(this, "chunksDone", 0), l(this, "flags", 0), l(this, "IV", void 0), l(this, "state", void 0), l(this, "stack", []), l(this, "posOut", 0), l(this, "bufferOut32", /* @__PURE__ */ new Uint32Array(16)), l(this, "bufferOut", void 0), l(this, "chunkOut", 0), l(this, "enableXOF", !0);
3041
3041
  let { key: r, context: i } = t, a = i !== void 0;
@@ -3043,12 +3043,12 @@ var li = {
3043
3043
  if (a) throw Error("Only \"key\" or \"context\" can be specified at same time");
3044
3044
  Rr(r, 32, "key");
3045
3045
  let e = zr(r);
3046
- this.IV = Ur(e), Xr(this.IV), this.flags = n | li.KEYED_HASH;
3046
+ this.IV = Ur(e), J(this.IV), this.flags = n | ci.KEYED_HASH;
3047
3047
  } else if (a) {
3048
3048
  Rr(i, void 0, "context");
3049
- let t = i, r = new e({ dkLen: 32 }, li.DERIVE_KEY_CONTEXT).update(t).digest();
3050
- this.IV = Ur(r), Xr(this.IV), this.flags = n | li.DERIVE_KEY_MATERIAL;
3051
- } else this.IV = ui.slice(), this.flags = n;
3049
+ let t = i, r = new e({ dkLen: 32 }, ci.DERIVE_KEY_CONTEXT).update(t).digest();
3050
+ this.IV = Ur(r), J(this.IV), this.flags = n | ci.DERIVE_KEY_MATERIAL;
3051
+ } else this.IV = li.slice(), this.flags = n;
3052
3052
  this.state = this.IV.slice(), this.bufferOut = Hr(this.bufferOut32);
3053
3053
  }
3054
3054
  get() {
@@ -3056,15 +3056,15 @@ var li = {
3056
3056
  }
3057
3057
  set() {}
3058
3058
  b2Compress(e, t, n, r = 0) {
3059
- let { state: i, pos: a } = this, { h: o, l: s } = ii(BigInt(e), !0), { v0: c, v1: l, v2: u, v3: d, v4: f, v5: p, v6: m, v7: h, v8: g, v9: _, v10: v, v11: y, v12: b, v13: x, v14: S, v15: C } = ci(di, r, n, 7, i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], ui[0], ui[1], ui[2], ui[3], o, s, a, t);
3059
+ let { state: i, pos: a } = this, { h: o, l: s } = ri(BigInt(e), !0), { v0: c, v1: l, v2: u, v3: d, v4: f, v5: p, v6: m, v7: h, v8: g, v9: _, v10: v, v11: y, v12: b, v13: x, v14: S, v15: C } = si(ui, r, n, 7, i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], li[0], li[1], li[2], li[3], o, s, a, t);
3060
3060
  i[0] = c ^ g, i[1] = l ^ _, i[2] = u ^ v, i[3] = d ^ y, i[4] = f ^ b, i[5] = p ^ x, i[6] = m ^ S, i[7] = h ^ C;
3061
3061
  }
3062
3062
  compress(e, t = 0, n = !1) {
3063
3063
  let r = this.flags;
3064
- if (this.chunkPos || (r |= li.CHUNK_START), (this.chunkPos === 15 || n) && (r |= li.CHUNK_END), n || (this.pos = this.blockLen), this.b2Compress(this.chunksDone, r, e, t), this.chunkPos += 1, this.chunkPos === 16 || n) {
3064
+ if (this.chunkPos || (r |= ci.CHUNK_START), (this.chunkPos === 15 || n) && (r |= ci.CHUNK_END), n || (this.pos = this.blockLen), this.b2Compress(this.chunksDone, r, e, t), this.chunkPos += 1, this.chunkPos === 16 || n) {
3065
3065
  let e = this.state;
3066
3066
  this.state = this.IV.slice();
3067
- for (let t, r = this.chunksDone + 1; (n || !(r & 1)) && (t = this.stack.pop()); r >>= 1) this.buffer32.set(t, 0), this.buffer32.set(e, 8), this.pos = this.blockLen, this.b2Compress(0, this.flags | li.PARENT, this.buffer32, 0), e = this.state, this.state = this.IV.slice();
3067
+ for (let t, r = this.chunksDone + 1; (n || !(r & 1)) && (t = this.stack.pop()); r >>= 1) this.buffer32.set(t, 0), this.buffer32.set(e, 8), this.pos = this.blockLen, this.b2Compress(0, this.flags | ci.PARENT, this.buffer32, 0), e = this.state, this.state = this.IV.slice();
3068
3068
  this.chunksDone++, this.chunkPos = 0, this.stack.push(e);
3069
3069
  }
3070
3070
  this.pos = 0;
@@ -3078,16 +3078,16 @@ var li = {
3078
3078
  this.destroyed = !0, Wr(this.state, this.buffer32, this.IV, this.bufferOut32), Wr(...this.stack);
3079
3079
  }
3080
3080
  b2CompressOut() {
3081
- let { state: e, pos: t, flags: n, buffer32: r, bufferOut32: i } = this, { h: a, l: o } = ii(BigInt(this.chunkOut++));
3082
- Xr(r);
3083
- let { v0: s, v1: c, v2: l, v3: u, v4: d, v5: f, v6: p, v7: m, v8: h, v9: g, v10: _, v11: v, v12: y, v13: b, v14: x, v15: S } = ci(di, 0, r, 7, e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], ui[0], ui[1], ui[2], ui[3], o, a, t, n);
3084
- i[0] = s ^ h, i[1] = c ^ g, i[2] = l ^ _, i[3] = u ^ v, i[4] = d ^ y, i[5] = f ^ b, i[6] = p ^ x, i[7] = m ^ S, i[8] = e[0] ^ h, i[9] = e[1] ^ g, i[10] = e[2] ^ _, i[11] = e[3] ^ v, i[12] = e[4] ^ y, i[13] = e[5] ^ b, i[14] = e[6] ^ x, i[15] = e[7] ^ S, Xr(r), Xr(i), this.posOut = 0;
3081
+ let { state: e, pos: t, flags: n, buffer32: r, bufferOut32: i } = this, { h: a, l: o } = ri(BigInt(this.chunkOut++));
3082
+ J(r);
3083
+ let { v0: s, v1: c, v2: l, v3: u, v4: d, v5: f, v6: p, v7: m, v8: h, v9: g, v10: _, v11: v, v12: y, v13: b, v14: x, v15: S } = si(ui, 0, r, 7, e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], li[0], li[1], li[2], li[3], o, a, t, n);
3084
+ i[0] = s ^ h, i[1] = c ^ g, i[2] = l ^ _, i[3] = u ^ v, i[4] = d ^ y, i[5] = f ^ b, i[6] = p ^ x, i[7] = m ^ S, i[8] = e[0] ^ h, i[9] = e[1] ^ g, i[10] = e[2] ^ _, i[11] = e[3] ^ v, i[12] = e[4] ^ y, i[13] = e[5] ^ b, i[14] = e[6] ^ x, i[15] = e[7] ^ S, J(r), J(i), this.posOut = 0;
3085
3085
  }
3086
3086
  finish() {
3087
3087
  if (this.finished) return;
3088
3088
  this.finished = !0, Wr(this.buffer.subarray(this.pos));
3089
- let e = this.flags | li.ROOT;
3090
- this.stack.length ? (e |= li.PARENT, Xr(this.buffer32), this.compress(this.buffer32, 0, !0), Xr(this.buffer32), this.chunksDone = 0, this.pos = this.blockLen) : e |= (this.chunkPos ? 0 : li.CHUNK_START) | li.CHUNK_END, this.flags = e, this.b2CompressOut();
3089
+ let e = this.flags | ci.ROOT;
3090
+ this.stack.length ? (e |= ci.PARENT, J(this.buffer32), this.compress(this.buffer32, 0, !0), J(this.buffer32), this.chunksDone = 0, this.pos = this.blockLen) : e |= (this.chunkPos ? 0 : ci.CHUNK_START) | ci.CHUNK_END, this.flags = e, this.b2CompressOut();
3091
3091
  }
3092
3092
  writeInto(e) {
3093
3093
  Br(this, !1), Rr(e), this.finish();
@@ -3114,7 +3114,7 @@ var li = {
3114
3114
  let e = new Uint8Array(this.outputLen);
3115
3115
  return this.digestInto(e), e;
3116
3116
  }
3117
- }, pi = /* @__PURE__ */ ei((e = {}) => new fi(e)), mi = (e, t) => ((e.Flags[t >> 3] ?? 0) >> (t & 7) & 1) == 1, hi = class {
3117
+ }, fi = /* @__PURE__ */ $r((e = {}) => new di(e)), pi = (e, t) => ((e.Flags[t >> 3] ?? 0) >> (t & 7) & 1) == 1, mi = class {
3118
3118
  constructor() {
3119
3119
  this.bytes = [], this.bits = 0;
3120
3120
  }
@@ -3124,48 +3124,48 @@ var li = {
3124
3124
  toValue() {
3125
3125
  return { Flags: this.bytes };
3126
3126
  }
3127
- }, gi = ArrayBuffer, J = Uint8Array, _i = Uint16Array, vi = Int16Array, yi = Int32Array, bi = function(e, t, n) {
3128
- if (J.prototype.slice) return J.prototype.slice.call(e, t, n);
3127
+ }, hi = ArrayBuffer, Y = Uint8Array, gi = Uint16Array, _i = Int16Array, vi = Int32Array, yi = function(e, t, n) {
3128
+ if (Y.prototype.slice) return Y.prototype.slice.call(e, t, n);
3129
3129
  (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length);
3130
- var r = new J(n - t);
3130
+ var r = new Y(n - t);
3131
3131
  return r.set(e.subarray(t, n)), r;
3132
- }, xi = function(e, t, n, r) {
3133
- if (J.prototype.fill) return J.prototype.fill.call(e, t, n, r);
3132
+ }, bi = function(e, t, n, r) {
3133
+ if (Y.prototype.fill) return Y.prototype.fill.call(e, t, n, r);
3134
3134
  for ((n == null || n < 0) && (n = 0), (r == null || r > e.length) && (r = e.length); n < r; ++n) e[n] = t;
3135
3135
  return e;
3136
- }, Si = function(e, t, n, r) {
3137
- if (J.prototype.copyWithin) return J.prototype.copyWithin.call(e, t, n, r);
3136
+ }, xi = function(e, t, n, r) {
3137
+ if (Y.prototype.copyWithin) return Y.prototype.copyWithin.call(e, t, n, r);
3138
3138
  for ((n == null || n < 0) && (n = 0), (r == null || r > e.length) && (r = e.length); n < r;) e[t++] = e[n++];
3139
- }, Ci = [
3139
+ }, Si = [
3140
3140
  "invalid zstd data",
3141
3141
  "window size too large (>2046MB)",
3142
3142
  "invalid block type",
3143
3143
  "FSE accuracy too high",
3144
3144
  "match distance too far back",
3145
3145
  "unexpected EOF"
3146
- ], Y = function(e, t, n) {
3147
- var r = Error(t || Ci[e]);
3148
- if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, Y), !n) throw r;
3146
+ ], X = function(e, t, n) {
3147
+ var r = Error(t || Si[e]);
3148
+ if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, X), !n) throw r;
3149
3149
  return r;
3150
- }, wi = function(e, t, n) {
3150
+ }, Ci = function(e, t, n) {
3151
3151
  for (var r = 0, i = 0; r < n; ++r) i |= e[t++] << (r << 3);
3152
3152
  return i;
3153
- }, Ti = function(e, t) {
3153
+ }, wi = function(e, t) {
3154
3154
  return (e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24) >>> 0;
3155
- }, Ei = function(e, t) {
3155
+ }, Ti = function(e, t) {
3156
3156
  var n = e[0] | e[1] << 8 | e[2] << 16;
3157
3157
  if (n == 3126568 && e[3] == 253) {
3158
3158
  var r = e[4], i = r >> 5 & 1, a = r >> 2 & 1, o = r & 3, s = r >> 6;
3159
- r & 8 && Y(0);
3160
- var c = 6 - i, l = o == 3 ? 4 : o, u = wi(e, c, l);
3159
+ r & 8 && X(0);
3160
+ var c = 6 - i, l = o == 3 ? 4 : o, u = Ci(e, c, l);
3161
3161
  c += l;
3162
- var d = s ? 1 << s : i, f = wi(e, c, d) + (s == 1 && 256), p = f;
3162
+ var d = s ? 1 << s : i, f = Ci(e, c, d) + (s == 1 && 256), p = f;
3163
3163
  if (!i) {
3164
3164
  var m = 1 << 10 + (e[5] >> 3);
3165
3165
  p = m + (m >> 3) * (e[5] & 7);
3166
3166
  }
3167
- p > 2145386496 && Y(1);
3168
- var h = new J((t == 1 ? f || p : t ? 0 : p) + 12);
3167
+ p > 2145386496 && X(1);
3168
+ var h = new Y((t == 1 ? f || p : t ? 0 : p) + 12);
3169
3169
  return h[0] = 1, h[4] = 4, h[8] = 8, {
3170
3170
  b: c + d,
3171
3171
  y: 0,
@@ -3173,27 +3173,27 @@ var li = {
3173
3173
  d: u,
3174
3174
  w: t && t != 1 ? t : h.subarray(12),
3175
3175
  e: p,
3176
- o: new yi(h.buffer, 0, 3),
3176
+ o: new vi(h.buffer, 0, 3),
3177
3177
  u: f,
3178
3178
  c: a,
3179
3179
  m: Math.min(131072, p)
3180
3180
  };
3181
- } else if ((n >> 4 | e[3] << 20) == 25481893) return Ti(e, 4) + 8;
3182
- Y(0);
3183
- }, Di = function(e) {
3181
+ } else if ((n >> 4 | e[3] << 20) == 25481893) return wi(e, 4) + 8;
3182
+ X(0);
3183
+ }, Ei = function(e) {
3184
3184
  for (var t = 0; 1 << t <= e; ++t);
3185
3185
  return t - 1;
3186
- }, Oi = function(e, t, n) {
3186
+ }, Di = function(e, t, n) {
3187
3187
  var r = (t << 3) + 4, i = (e[t] & 15) + 5;
3188
- i > n && Y(3);
3189
- for (var a = 1 << i, o = a, s = -1, c = -1, l = -1, u = a, d = new gi(512 + (a << 2)), f = new vi(d, 0, 256), p = new _i(d, 0, 256), m = new _i(d, 512, a), h = 512 + (a << 1), g = new J(d, h, a), _ = new J(d, h + a); s < 255 && o > 0;) {
3190
- var v = Di(o + 1), y = r >> 3, b = (1 << v + 1) - 1, x = (e[y] | e[y + 1] << 8 | e[y + 2] << 16) >> (r & 7) & b, S = (1 << v) - 1, C = b - o - 1, w = x & S;
3188
+ i > n && X(3);
3189
+ for (var a = 1 << i, o = a, s = -1, c = -1, l = -1, u = a, d = new hi(512 + (a << 2)), f = new _i(d, 0, 256), p = new gi(d, 0, 256), m = new gi(d, 512, a), h = 512 + (a << 1), g = new Y(d, h, a), _ = new Y(d, h + a); s < 255 && o > 0;) {
3190
+ var v = Ei(o + 1), y = r >> 3, b = (1 << v + 1) - 1, x = (e[y] | e[y + 1] << 8 | e[y + 2] << 16) >> (r & 7) & b, S = (1 << v) - 1, C = b - o - 1, w = x & S;
3191
3191
  if (w < C ? (r += v, x = w) : (r += v + 1, x > S && (x -= C)), f[++s] = --x, x == -1 ? (o += x, g[--u] = s) : o -= x, !x) do {
3192
3192
  var T = r >> 3;
3193
3193
  c = (e[T] | e[T + 1] << 8) >> (r & 7) & 3, r += 2, s += c;
3194
3194
  } while (c == 3);
3195
3195
  }
3196
- (s > 255 || o) && Y(0);
3196
+ (s > 255 || o) && X(0);
3197
3197
  for (var E = 0, D = (a >> 1) + (a >> 3) + 3, O = a - 1, k = 0; k <= s; ++k) {
3198
3198
  var A = f[k];
3199
3199
  if (A < 1) {
@@ -3207,9 +3207,9 @@ var li = {
3207
3207
  while (E >= u);
3208
3208
  }
3209
3209
  }
3210
- for (E && Y(0), l = 0; l < a; ++l) {
3210
+ for (E && X(0), l = 0; l < a; ++l) {
3211
3211
  var j = p[g[l]]++;
3212
- m[l] = (j << (_[l] = i - Di(j))) - a;
3212
+ m[l] = (j << (_[l] = i - Ei(j))) - a;
3213
3213
  }
3214
3214
  return [r + 7 >> 3, {
3215
3215
  b: i,
@@ -3217,19 +3217,19 @@ var li = {
3217
3217
  n: _,
3218
3218
  t: m
3219
3219
  }];
3220
- }, ki = function(e, t) {
3221
- var n = 0, r = -1, i = new J(292), a = e[t], o = i.subarray(0, 256), s = i.subarray(256, 268), c = new _i(i.buffer, 268);
3220
+ }, Oi = function(e, t) {
3221
+ var n = 0, r = -1, i = new Y(292), a = e[t], o = i.subarray(0, 256), s = i.subarray(256, 268), c = new gi(i.buffer, 268);
3222
3222
  if (a < 128) {
3223
- var l = Oi(e, t + 1, 6), u = l[0], d = l[1];
3223
+ var l = Di(e, t + 1, 6), u = l[0], d = l[1];
3224
3224
  t += a;
3225
3225
  var f = u << 3, p = e[t];
3226
- p || Y(0);
3227
- for (var m = 0, h = 0, g = d.b, _ = g, v = (++t << 3) - 8 + Di(p); v -= g, !(v < f);) {
3226
+ p || X(0);
3227
+ for (var m = 0, h = 0, g = d.b, _ = g, v = (++t << 3) - 8 + Ei(p); v -= g, !(v < f);) {
3228
3228
  var y = v >> 3;
3229
3229
  if (m += (e[y] | e[y + 1] << 8) >> (v & 7) & (1 << g) - 1, o[++r] = d.s[m], v -= _, v < f) break;
3230
3230
  y = v >> 3, h += (e[y] | e[y + 1] << 8) >> (v & 7) & (1 << _) - 1, o[++r] = d.s[h], g = d.n[m], m = d.t[m], _ = d.n[h], h = d.t[h];
3231
3231
  }
3232
- ++r > 255 && Y(0);
3232
+ ++r > 255 && X(0);
3233
3233
  } else {
3234
3234
  for (r = a - 127; n < r; n += 2) {
3235
3235
  var b = e[++t];
@@ -3240,23 +3240,23 @@ var li = {
3240
3240
  var x = 0;
3241
3241
  for (n = 0; n < r; ++n) {
3242
3242
  var S = o[n];
3243
- S > 11 && Y(0), x += S && 1 << S - 1;
3243
+ S > 11 && X(0), x += S && 1 << S - 1;
3244
3244
  }
3245
- var C = Di(x) + 1, w = 1 << C, T = w - x;
3246
- for (T & T - 1 && Y(0), o[r++] = Di(T) + 1, n = 0; n < r; ++n) {
3245
+ var C = Ei(x) + 1, w = 1 << C, T = w - x;
3246
+ for (T & T - 1 && X(0), o[r++] = Ei(T) + 1, n = 0; n < r; ++n) {
3247
3247
  var S = o[n];
3248
3248
  ++s[o[n] = S && C + 1 - S];
3249
3249
  }
3250
- var E = new J(w << 1), D = E.subarray(0, w), O = E.subarray(w);
3250
+ var E = new Y(w << 1), D = E.subarray(0, w), O = E.subarray(w);
3251
3251
  for (c[C] = 0, n = C; n > 0; --n) {
3252
3252
  var k = c[n];
3253
- xi(O, n, k, c[n - 1] = k + s[n] * (1 << C - n));
3253
+ bi(O, n, k, c[n - 1] = k + s[n] * (1 << C - n));
3254
3254
  }
3255
- for (c[0] != w && Y(0), n = 0; n < r; ++n) {
3255
+ for (c[0] != w && X(0), n = 0; n < r; ++n) {
3256
3256
  var A = o[n];
3257
3257
  if (A) {
3258
3258
  var j = c[A];
3259
- xi(D, n, j, c[A] = j + (1 << C - A));
3259
+ bi(D, n, j, c[A] = j + (1 << C - A));
3260
3260
  }
3261
3261
  }
3262
3262
  return [t, {
@@ -3264,7 +3264,7 @@ var li = {
3264
3264
  b: C,
3265
3265
  s: D
3266
3266
  }];
3267
- }, Ai = (/*#__PURE__*/ Oi(/*#__PURE__*/ new J([
3267
+ }, ki = (/*#__PURE__*/ Di(/*#__PURE__*/ new Y([
3268
3268
  81,
3269
3269
  16,
3270
3270
  99,
@@ -3284,7 +3284,7 @@ var li = {
3284
3284
  70,
3285
3285
  146,
3286
3286
  4
3287
- ]), 0, 6))[1], ji = (/*#__PURE__*/ Oi(/*#__PURE__*/ new J([
3287
+ ]), 0, 6))[1], Ai = (/*#__PURE__*/ Di(/*#__PURE__*/ new Y([
3288
3288
  33,
3289
3289
  20,
3290
3290
  196,
@@ -3312,7 +3312,7 @@ var li = {
3312
3312
  68,
3313
3313
  36,
3314
3314
  9
3315
- ]), 0, 6))[1], Mi = (/*#__PURE__ */ Oi(/*#__PURE__*/ new J([
3315
+ ]), 0, 6))[1], ji = (/*#__PURE__ */ Di(/*#__PURE__*/ new Y([
3316
3316
  32,
3317
3317
  132,
3318
3318
  16,
@@ -3326,10 +3326,10 @@ var li = {
3326
3326
  36,
3327
3327
  73,
3328
3328
  2
3329
- ]), 0, 5))[1], Ni = function(e, t) {
3330
- for (var n = e.length, r = new yi(n), i = 0; i < n; ++i) r[i] = t, t += 1 << e[i];
3329
+ ]), 0, 5))[1], Mi = function(e, t) {
3330
+ for (var n = e.length, r = new vi(n), i = 0; i < n; ++i) r[i] = t, t += 1 << e[i];
3331
3331
  return r;
3332
- }, Pi = /*#__PURE__ */ new J((/*#__PURE__ */ new yi([
3332
+ }, Ni = /*#__PURE__ */ new Y((/*#__PURE__ */ new vi([
3333
3333
  0,
3334
3334
  0,
3335
3335
  0,
@@ -3339,7 +3339,7 @@ var li = {
3339
3339
  134678020,
3340
3340
  202050057,
3341
3341
  269422093
3342
- ])).buffer, 0, 36), Fi = /*#__PURE__ */ Ni(Pi, 0), Ii = /*#__PURE__ */ new J((/*#__PURE__ */ new yi([
3342
+ ])).buffer, 0, 36), Pi = /*#__PURE__ */ Mi(Ni, 0), Fi = /*#__PURE__ */ new Y((/*#__PURE__ */ new vi([
3343
3343
  0,
3344
3344
  0,
3345
3345
  0,
@@ -3354,51 +3354,51 @@ var li = {
3354
3354
  185207048,
3355
3355
  252579084,
3356
3356
  16
3357
- ])).buffer, 0, 53), Li = /*#__PURE__ */ Ni(Ii, 3), Ri = function(e, t, n) {
3357
+ ])).buffer, 0, 53), Ii = /*#__PURE__ */ Mi(Fi, 3), Li = function(e, t, n) {
3358
3358
  var r = e.length, i = t.length, a = e[r - 1], o = (1 << n.b) - 1, s = -n.b;
3359
- a || Y(0);
3360
- for (var c = 0, l = n.b, u = (r << 3) - 8 + Di(a) - l, d = -1; u > s && d < i;) {
3359
+ a || X(0);
3360
+ for (var c = 0, l = n.b, u = (r << 3) - 8 + Ei(a) - l, d = -1; u > s && d < i;) {
3361
3361
  var f = u >> 3, p = (e[f] | e[f + 1] << 8 | e[f + 2] << 16) >> (u & 7);
3362
3362
  c = (c << l | p) & o, t[++d] = n.s[c], u -= l = n.n[c];
3363
3363
  }
3364
- (u != s || d + 1 != i) && Y(0);
3365
- }, zi = function(e, t, n) {
3364
+ (u != s || d + 1 != i) && X(0);
3365
+ }, Ri = function(e, t, n) {
3366
3366
  var r = 6, i = t.length + 3 >> 2, a = i << 1, o = i + a;
3367
- Ri(e.subarray(r, r += e[0] | e[1] << 8), t.subarray(0, i), n), Ri(e.subarray(r, r += e[2] | e[3] << 8), t.subarray(i, a), n), Ri(e.subarray(r, r += e[4] | e[5] << 8), t.subarray(a, o), n), Ri(e.subarray(r), t.subarray(o), n);
3368
- }, Bi = function(e, t, n) {
3367
+ Li(e.subarray(r, r += e[0] | e[1] << 8), t.subarray(0, i), n), Li(e.subarray(r, r += e[2] | e[3] << 8), t.subarray(i, a), n), Li(e.subarray(r, r += e[4] | e[5] << 8), t.subarray(a, o), n), Li(e.subarray(r), t.subarray(o), n);
3368
+ }, zi = function(e, t, n) {
3369
3369
  var r, i = t.b, a = e[i], o = a >> 1 & 3;
3370
3370
  t.l = a & 1;
3371
3371
  var s = a >> 3 | e[i + 1] << 5 | e[i + 2] << 13, c = (i += 3) + s;
3372
- if (o == 1) return i >= e.length ? void 0 : (t.b = i + 1, n ? (xi(n, e[i], t.y, t.y += s), n) : xi(new J(s), e[i]));
3372
+ if (o == 1) return i >= e.length ? void 0 : (t.b = i + 1, n ? (bi(n, e[i], t.y, t.y += s), n) : bi(new Y(s), e[i]));
3373
3373
  if (!(c > e.length)) {
3374
- if (o == 0) return t.b = c, n ? (n.set(e.subarray(i, c), t.y), t.y += s, n) : bi(e, i, c);
3374
+ if (o == 0) return t.b = c, n ? (n.set(e.subarray(i, c), t.y), t.y += s, n) : yi(e, i, c);
3375
3375
  if (o == 2) {
3376
3376
  var l = e[i], u = l & 3, d = l >> 2 & 3, f = l >> 4, p = 0, m = 0;
3377
3377
  u < 2 ? d & 1 ? f |= e[++i] << 4 | (d & 2 && e[++i] << 12) : f = l >> 3 : (m = d, d < 2 ? (f |= (e[++i] & 63) << 4, p = e[i] >> 6 | e[++i] << 2) : d == 2 ? (f |= e[++i] << 4 | (e[++i] & 3) << 12, p = e[i] >> 2 | e[++i] << 6) : (f |= e[++i] << 4 | (e[++i] & 63) << 12, p = e[i] >> 6 | e[++i] << 2 | e[++i] << 10)), ++i;
3378
- var h = n ? n.subarray(t.y, t.y + t.m) : new J(t.m), g = h.length - f;
3378
+ var h = n ? n.subarray(t.y, t.y + t.m) : new Y(t.m), g = h.length - f;
3379
3379
  if (u == 0) h.set(e.subarray(i, i += f), g);
3380
- else if (u == 1) xi(h, e[i++], g);
3380
+ else if (u == 1) bi(h, e[i++], g);
3381
3381
  else {
3382
3382
  var _ = t.h;
3383
3383
  if (u == 2) {
3384
- var v = ki(e, i);
3384
+ var v = Oi(e, i);
3385
3385
  p += i - (i = v[0]), t.h = _ = v[1];
3386
- } else _ || Y(0);
3387
- (m ? zi : Ri)(e.subarray(i, i += p), h.subarray(g), _);
3386
+ } else _ || X(0);
3387
+ (m ? Ri : Li)(e.subarray(i, i += p), h.subarray(g), _);
3388
3388
  }
3389
3389
  var y = e[i++];
3390
3390
  if (y) {
3391
3391
  y == 255 ? y = (e[i++] | e[i++] << 8) + 32512 : y > 127 && (y = y - 128 << 8 | e[i++]);
3392
3392
  var b = e[i++];
3393
- b & 3 && Y(0);
3393
+ b & 3 && X(0);
3394
3394
  for (var x = [
3395
+ Ai,
3395
3396
  ji,
3396
- Mi,
3397
- Ai
3397
+ ki
3398
3398
  ], S = 2; S > -1; --S) {
3399
3399
  var C = b >> (S << 1) + 2 & 3;
3400
3400
  if (C == 1) {
3401
- var w = new J([
3401
+ var w = new Y([
3402
3402
  0,
3403
3403
  0,
3404
3404
  e[i++]
@@ -3406,14 +3406,14 @@ var li = {
3406
3406
  x[S] = {
3407
3407
  s: w.subarray(2, 3),
3408
3408
  n: w.subarray(0, 1),
3409
- t: new _i(w.buffer, 0, 1),
3409
+ t: new gi(w.buffer, 0, 1),
3410
3410
  b: 0
3411
3411
  };
3412
- } else C == 2 ? (r = Oi(e, i, 9 - (S & 1)), i = r[0], x[S] = r[1]) : C == 3 && (t.t || Y(0), x[S] = t.t[S]);
3412
+ } else C == 2 ? (r = Di(e, i, 9 - (S & 1)), i = r[0], x[S] = r[1]) : C == 3 && (t.t || X(0), x[S] = t.t[S]);
3413
3413
  }
3414
3414
  var T = t.t = x, E = T[0], D = T[1], O = T[2], k = e[c - 1];
3415
- k || Y(0);
3416
- var A = (c << 3) - 8 + Di(k) - O.b, j = A >> 3, M = 0, ee = (e[j] | e[j + 1] << 8) >> (A & 7) & (1 << O.b) - 1;
3415
+ k || X(0);
3416
+ var A = (c << 3) - 8 + Ei(k) - O.b, j = A >> 3, M = 0, ee = (e[j] | e[j + 1] << 8) >> (A & 7) & (1 << O.b) - 1;
3417
3417
  j = (A -= D.b) >> 3;
3418
3418
  var te = (e[j] | e[j + 1] << 8) >> (A & 7) & (1 << D.b) - 1;
3419
3419
  j = (A -= E.b) >> 3;
@@ -3422,10 +3422,10 @@ var li = {
3422
3422
  var N = O.s[ee], re = O.n[ee], ie = E.s[ne], ae = E.n[ne], oe = D.s[te], se = D.n[te];
3423
3423
  j = (A -= oe) >> 3;
3424
3424
  var ce = 1 << oe, le = ce + ((e[j] | e[j + 1] << 8 | e[j + 2] << 16 | e[j + 3] << 24) >>> (A & 7) & ce - 1);
3425
- j = (A -= Ii[ie]) >> 3;
3426
- var ue = Li[ie] + ((e[j] | e[j + 1] << 8 | e[j + 2] << 16) >> (A & 7) & (1 << Ii[ie]) - 1);
3427
- j = (A -= Pi[N]) >> 3;
3428
- var de = Fi[N] + ((e[j] | e[j + 1] << 8 | e[j + 2] << 16) >> (A & 7) & (1 << Pi[N]) - 1);
3425
+ j = (A -= Fi[ie]) >> 3;
3426
+ var ue = Ii[ie] + ((e[j] | e[j + 1] << 8 | e[j + 2] << 16) >> (A & 7) & (1 << Fi[ie]) - 1);
3427
+ j = (A -= Ni[N]) >> 3;
3428
+ var de = Pi[N] + ((e[j] | e[j + 1] << 8 | e[j + 2] << 16) >> (A & 7) & (1 << Ni[N]) - 1);
3429
3429
  if (j = (A -= re) >> 3, ee = O.t[ee] + ((e[j] | e[j + 1] << 8) >> (A & 7) & (1 << re) - 1), j = (A -= ae) >> 3, ne = E.t[ne] + ((e[j] | e[j + 1] << 8) >> (A & 7) & (1 << ae) - 1), j = (A -= se) >> 3, te = D.t[te] + ((e[j] | e[j + 1] << 8) >> (A & 7) & (1 << se) - 1), le > 3) t.o[2] = t.o[1], t.o[1] = t.o[0], t.o[0] = le -= 3;
3430
3430
  else {
3431
3431
  var fe = le - (de != 0);
@@ -3445,39 +3445,39 @@ var li = {
3445
3445
  }
3446
3446
  if (M != g) for (; g < h.length;) h[M++] = h[g++];
3447
3447
  else M = h.length;
3448
- n ? t.y += M : h = bi(h, 0, M);
3448
+ n ? t.y += M : h = yi(h, 0, M);
3449
3449
  } else if (n) {
3450
3450
  if (t.y += f, g) for (var S = 0; S < f; ++S) h[S] = h[g + S];
3451
- } else g && (h = bi(h, g));
3451
+ } else g && (h = yi(h, g));
3452
3452
  return t.b = c, h;
3453
3453
  }
3454
- Y(2);
3454
+ X(2);
3455
3455
  }
3456
- }, Vi = function(e, t) {
3456
+ }, Bi = function(e, t) {
3457
3457
  if (e.length == 1) return e[0];
3458
- for (var n = new J(t), r = 0, i = 0; r < e.length; ++r) {
3458
+ for (var n = new Y(t), r = 0, i = 0; r < e.length; ++r) {
3459
3459
  var a = e[r];
3460
3460
  n.set(a, i), i += a.length;
3461
3461
  }
3462
3462
  return n;
3463
3463
  };
3464
- function Hi(e, t) {
3464
+ function Vi(e, t) {
3465
3465
  for (var n = [], r = +!t, i = 0, a = 0; e.length;) {
3466
- var o = Ei(e, r || t);
3466
+ var o = Ti(e, r || t);
3467
3467
  if (typeof o == "object") {
3468
3468
  for (r ? (t = null, o.w.length == o.u && (n.push(t = o.w), a += o.u)) : (n.push(t), o.e = 0); !o.l;) {
3469
- var s = Bi(e, o, t);
3470
- s || Y(5), t ? o.e = o.y : (n.push(s), a += s.length, Si(o.w, 0, s.length), o.w.set(s, o.w.length - s.length));
3469
+ var s = zi(e, o, t);
3470
+ s || X(5), t ? o.e = o.y : (n.push(s), a += s.length, xi(o.w, 0, s.length), o.w.set(s, o.w.length - s.length));
3471
3471
  }
3472
3472
  i = o.b + o.c * 4;
3473
3473
  } else i = o;
3474
3474
  e = e.subarray(i);
3475
3475
  }
3476
- return Vi(n, a);
3476
+ return Bi(n, a);
3477
3477
  }
3478
3478
  //#endregion
3479
3479
  //#region src/brdb/bytes.ts
3480
- var Ui = class {
3480
+ var Hi = class {
3481
3481
  constructor() {
3482
3482
  this.buf = /* @__PURE__ */ new Uint8Array(256), this.view = new DataView(this.buf.buffer), this.len = 0;
3483
3483
  }
@@ -3552,7 +3552,7 @@ var Ui = class {
3552
3552
  toBytes() {
3553
3553
  return this.buf.slice(0, this.len);
3554
3554
  }
3555
- }, Wi = class {
3555
+ }, Ui = class {
3556
3556
  constructor(e, t = 0) {
3557
3557
  this.data = e, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.offset = t;
3558
3558
  }
@@ -3659,7 +3659,7 @@ var Ui = class {
3659
3659
  };
3660
3660
  //#endregion
3661
3661
  //#region src/brdb/brz.ts
3662
- function Gi(e, t = {}) {
3662
+ function Wi(e, t = {}) {
3663
3663
  let n = e.map(([e, t]) => ({
3664
3664
  parentId: -1,
3665
3665
  name: e,
@@ -3680,7 +3680,7 @@ function Gi(e, t = {}) {
3680
3680
  let e = g.content, n;
3681
3681
  if (e.length === 0) n = -1;
3682
3682
  else {
3683
- let r = pi(e), i = $r(r), a = p.get(i);
3683
+ let r = fi(e), i = Qr(r), a = p.get(i);
3684
3684
  if (a !== void 0) n = a;
3685
3685
  else {
3686
3686
  n = d.length, p.set(i, n), d.push(r), l.push(e.length);
@@ -3691,7 +3691,7 @@ function Gi(e, t = {}) {
3691
3691
  o.push(n);
3692
3692
  }
3693
3693
  }
3694
- let m = new TextEncoder(), h = new Ui();
3694
+ let m = new TextEncoder(), h = new Hi();
3695
3695
  h.i32le(i.length), h.i32le(s.length), h.i32le(d.length);
3696
3696
  for (let e of r) h.i32le(e);
3697
3697
  let g = i.map((e) => m.encode(e));
@@ -3706,23 +3706,23 @@ function Gi(e, t = {}) {
3706
3706
  for (let e of l) h.i32le(e);
3707
3707
  for (let e of u) h.i32le(e);
3708
3708
  for (let e of d) h.bytes(e);
3709
- let v = h.toBytes(), y = new Ui();
3709
+ let v = h.toBytes(), y = new Hi();
3710
3710
  y.bytes([
3711
3711
  66,
3712
3712
  82,
3713
3713
  90
3714
- ]), y.u8(0), y.u8(0), y.i32le(v.length), y.i32le(v.length), y.bytes(pi(v)), y.bytes(v);
3714
+ ]), y.u8(0), y.u8(0), y.i32le(v.length), y.i32le(v.length), y.bytes(fi(v)), y.bytes(v);
3715
3715
  for (let e of f) y.bytes(e);
3716
3716
  return y.toBytes();
3717
3717
  }
3718
- var Ki = class e {
3718
+ var Gi = class e {
3719
3719
  constructor(e, t, n, r, i, a, o) {
3720
3720
  this.folderParentIds = e, this.folderNames = t, this.fileParentIds = n, this.fileContentIds = r, this.fileNames = i, this.blobs = a, this.blobData = o, this.folderLut = /* @__PURE__ */ new Map(), this.fileLut = /* @__PURE__ */ new Map(), this.pathCache = null;
3721
3721
  for (let n = 0; n < t.length; n++) this.folderLut.set(`${e[n]} ${t[n]}`, n);
3722
3722
  for (let e = 0; e < i.length; e++) this.fileLut.set(`${n[e]} ${i[e]}`, e);
3723
3723
  }
3724
3724
  static from(t) {
3725
- let n = new Wi(t), r = n.bytes(3);
3725
+ let n = new Ui(t), r = n.bytes(3);
3726
3726
  if (r[0] !== 66 || r[1] !== 82 || r[2] !== 90) throw Error("brdb: invalid .brz magic");
3727
3727
  let i = n.u8();
3728
3728
  if (i !== 0) throw Error(`brdb: unsupported .brz version ${i}`);
@@ -3732,9 +3732,9 @@ var Ki = class e {
3732
3732
  if (o < 0 || s < 0) throw Error("brdb: negative index size");
3733
3733
  let c = n.bytes(32), l;
3734
3734
  if (a === 0) l = n.bytes(o);
3735
- else if (l = Hi(n.bytes(s), new Uint8Array(o)), l.length !== o) throw Error("brdb: index decompressed to the wrong size");
3736
- if ($r(pi(l)) !== $r(c)) throw Error("brdb: index hash mismatch");
3737
- let u = n.bytes(n.remaining), d = new Wi(l), f = d.i32le(), p = d.i32le(), m = d.i32le();
3735
+ else if (l = Vi(n.bytes(s), new Uint8Array(o)), l.length !== o) throw Error("brdb: index decompressed to the wrong size");
3736
+ if (Qr(fi(l)) !== Qr(c)) throw Error("brdb: index hash mismatch");
3737
+ let u = n.bytes(n.remaining), d = new Ui(l), f = d.i32le(), p = d.i32le(), m = d.i32le();
3738
3738
  if (f < 0 || p < 0 || m < 0) throw Error("brdb: negative index count");
3739
3739
  let h = (e, t) => Array.from({ length: e }, t), g = h(f, () => d.i32le()), _ = h(f, () => d.u16le()), v = new TextDecoder("utf-8", { fatal: !0 }), y = _.map((e) => v.decode(d.bytes(e))), b = h(p, () => d.i32le()), x = h(p, () => d.i32le()), S = h(p, () => d.u16le()).map((e) => v.decode(d.bytes(e))), C = h(m, () => d.u8()), w = h(m, () => d.i32le()), T = h(m, () => d.i32le()), E = h(m, () => d.bytes(32).slice());
3740
3740
  if (d.remaining !== 0) throw Error("brdb: trailing bytes in index");
@@ -3796,10 +3796,10 @@ var Ki = class e {
3796
3796
  if (t.method === 0) r = n;
3797
3797
  else {
3798
3798
  if (n.length !== t.sizeCompressed) throw Error("brdb: blob compressed size mismatch");
3799
- r = Hi(n, new Uint8Array(t.sizeUncompressed));
3799
+ r = Vi(n, new Uint8Array(t.sizeUncompressed));
3800
3800
  }
3801
3801
  if (r.length !== t.sizeUncompressed) throw Error("brdb: blob uncompressed size mismatch");
3802
- if ($r(pi(r)) !== $r(t.hash)) throw Error("brdb: blob hash mismatch");
3802
+ if (Qr(fi(r)) !== Qr(t.hash)) throw Error("brdb: blob hash mismatch");
3803
3803
  return r;
3804
3804
  }
3805
3805
  readFile(e) {
@@ -3839,7 +3839,7 @@ var Ki = class e {
3839
3839
  return r === -1 ? t : `${e[r]}/${t}`;
3840
3840
  }), this.pathCache;
3841
3841
  }
3842
- }, qi = /* @__PURE__ */ "B_1x1_Reroute_Node.B_1x1_Gate_AND.B_1x1_Gate_OR.B_1x1_Gate_XOR.B_1x1_Gate_NAND.B_1x1_Gate_NOR.B_1x1_NOT_Gate.B_1x1_Gate_AND_Bitwise.B_1x1_Gate_OR_Bitwise.B_1x1_Gate_XOR_Bitwise.B_1x1_Gate_NAND_Bitwise.B_1x1_Gate_NOR_Bitwise.B_1x1_Gate_NOT_Bitwise.B_1x1_Gate_ShiftLeft_Bitwise.B_1x1_Gate_ShiftRight_Bitwise.B_1x1_Gate_Add.B_1x1_Gate_Subtract.B_1x1_Gate_Multiply.B_1x1_Gate_ModFloored.B_1x1_Gate_Mod.B_1x1_Gate_Divide.B_1x1_Gate_Equal.B_1x1_Gate_NotEqual.B_1x1_Gate_LessThan.B_1x1_Gate_LessThanEqual.B_1x1_Gate_GreaterThan.B_1x1_Gate_GreaterThanEqual.B_1x1_Gate_Ceiling.B_1x1_Gate_Floor.B_1x1_Gate_Constant.B_1x1_Gate_Blend.B_1x1_Gate_EdgeDetector.B_1x1_Gate_Timer.B_1x1_Gate_Timer_Tick.B_1x1_Microchip.B_1x1_Gate_MicrochipInput.B_1x1_Gate_MicrochipOutput.B_2x2_Overhang.B_1x4_Brick_Side.B_1x2_Overhang.B_1x1_Brick_Side_Lip.B_1x1_Brick_Side.B_Jar.B_Chalice.B_Cauldron.B_Small_Flower.B_Pine_Tree.B_Leaf_Bush.B_Hedge_1x4.B_Hedge_1x2.B_Hedge_1x1_Corner.B_Hedge_1x1.B_Flower.B_Fern.B_Branch.B_2x4_Door_Frame.B_Turkey_Leg.B_Turkey_Body.B_Swirl_Plate.B_Sausage.B_Pumpkin_Carved.B_Pumpkin.B_Ladder.B_Inverted_Cone.B_Handle.B_Gravestone.B_Frog_Small.B_Frog.B_Flame.B_Coffin_Lid.B_Coffin.B_BoneStraight.B_Bone.B_1x1_Coin_Diagonal.B_1x1_Coin.B_Spoon.B_Fork.B_2x2_Corner.B_2x2f_Plate_Center_Inv.B_2x2f_Plate_Center.B_1x2f_Plate_Center_Inv.B_4x4_Round.B_2x2_Round.B_2x2F_Round.B_2x_Octo_T_Inv.B_2x_Octo_T.B_2x2F_Octo_Converter_Inv.B_2x2F_Octo_Converter.B_2x2F_Octo.B_8x8_Lattice_Plate.B_1x2_MetalIngot.B_1x1f_Tile_Corner.B_1x1f_Inverse_Tile_Corner.B_Rook.B_Queen.B_Pawn.B_Knight.B_King.B_Bishop.B_1x2f_Plate_Center.B_2x2_Cone.B_1x1_Round.B_1x1_Cone.B_1x1F_Round.B_2x_Octo_Cone.B_2x_Octo_90Deg_Inv.B_2x_Octo_90Deg.B_2x_Octo.B_1x_Octo_T_Inv.B_1x_Octo_T.B_1x_Octo_90Deg_Inv.B_1x_Octo_90Deg.B_1x_Octo.B_1x1F_Octo.B_2x2_Slipper.B_2x1_Slipper.B_Joint_Wheel_Micro.B_Joint_Wheel.B_Joint_Socket_Micro.B_Joint_Servo_Micro.B_Joint_Servo.B_Joint_Motor_Micro.B_Joint_Motor.B_Joint_Coupler.B_Joint_Bearing_Micro.B_Joint_Bearing.B_1x1_SoundEmitter.B_1x1_Gate_Teleport.B_1x1_Gate_RelativeTeleport.B_1x1_EntityGate_SetVelocity.B_1x1_EntityGate_SetLocationAndRotation.B_1x1_EntityGate_SetLocation.B_1x1_EntityGate_ReadBrickGrid.B_1x1_EntityGate_PlayAudioAt.B_1x1_EntityGate_AddVelocity.B_1x1_EntityGate_AddLocationAndRotation.B_1x1_CharacterGate_SetGravityDirection.B_Vehicle_Engine.B_Switch_Test.B_SpawnPoint.B_Seat.B_GoalPoint.B_DestinationPoint.B_CheckPoint.B_Button_Square.B_Button.B_Bot_Spawn_Point.B_2x2F_Target.B_2x2F_Speaker.B_1x1_Gate_WheelEngineSlim.B_1x1F_Speaker.B_1x1_Gate_AudioReference.B_1x1_Gate_BrickAssetReference.B_1x1_Gate_Clock.B_1x1_Gate_DeltaTime.B_1x1_Gate_EntityTypeReference.B_1x1_Gate_Exec_ArrayVar_Append.B_1x1_Gate_Exec_ArrayVar_Average.B_1x1_Gate_Exec_ArrayVar_Clear.B_1x1_Gate_Exec_ArrayVar_CopyFrom.B_1x1_Gate_Exec_ArrayVar_Fill.B_1x1_Gate_Exec_ArrayVar_Find.B_1x1_Gate_Exec_ArrayVar_Get.B_1x1_Gate_Exec_ArrayVar_GetLength.B_1x1_Gate_Exec_ArrayVar_Insert.B_1x1_Gate_Exec_ArrayVar_Max.B_1x1_Gate_Exec_ArrayVar_Min.B_1x1_Gate_Exec_ArrayVar_Pop.B_1x1_Gate_Exec_ArrayVar_Push.B_1x1_Gate_Exec_ArrayVar_RemoveAtIndex.B_1x1_Gate_Exec_ArrayVar_Resize.B_1x1_Gate_Exec_ArrayVar_Reverse.B_1x1_Gate_Exec_ArrayVar_SetAtIndex.B_1x1_Gate_Exec_ArrayVar_Shuffle.B_1x1_Gate_Exec_ArrayVar_Slice.B_1x1_Gate_Exec_ArrayVar_Sort.B_1x1_Gate_Exec_ArrayVar_Sum.B_1x1_Gate_Exec_ArrayVar_Swap.B_1x1_Gate_Exec_Branch.B_1x1_Gate_Exec_Character_AddInventoryBrick.B_1x1_Gate_Exec_Character_AddInventoryEntity.B_1x1_Gate_Exec_Character_AddInventoryEntry.B_1x1_Gate_Exec_Character_AddInventoryItem.B_1x1_Gate_Exec_Character_AddInventoryItemAdv.B_1x1_Gate_Exec_Character_GetAim.B_1x1_Gate_Exec_Character_GetDamage.B_1x1_Gate_Exec_Character_GetFromController.B_1x1_Gate_Exec_Character_IncDamage.B_1x1_Gate_Exec_Character_SetDamage.B_1x1_Gate_Exec_Character_SetInventoryBrick.B_1x1_Gate_Exec_Character_SetInventoryEntity.B_1x1_Gate_Exec_Character_SetInventoryEntry.B_1x1_Gate_Exec_Character_SetInventoryItem.B_1x1_Gate_Exec_Character_SetInventoryItemAdv.B_1x1_Gate_Exec_Character_SetTempPermission.B_1x1_Gate_Exec_Character_ShowHint.B_1x1_Gate_Exec_ChatCommand.B_1x1_Gate_Exec_Controller_DisplayText.B_1x1_Gate_Exec_Controller_GetDisplayName.B_1x1_Gate_Exec_Controller_GetFromEntity.B_1x1_Gate_Exec_Controller_GetUserId.B_1x1_Gate_Exec_Controller_GetUserName.B_1x1_Gate_Exec_Controller_HasPermission.B_1x1_Gate_Exec_Controller_HasRole.B_1x1_Gate_Exec_Controller_IsTrustedByBrickOwner.B_1x1_Gate_Exec_Controller_SetCanRespawn.B_1x1_Gate_Exec_Controller_ShowChatMessage.B_1x1_Gate_Exec_Controller_ShowMessageBox.B_1x1_Gate_Exec_Controller_ShowStatusMessage.B_1x1_Gate_Exec_Cycle.B_1x1_Gate_Exec_Entity_AddLocationRotation.B_1x1_Gate_Exec_Entity_AddVelocity.B_1x1_Gate_Exec_Entity_GetAngularVelocity.B_1x1_Gate_Exec_Entity_GetLinearVelocity.B_1x1_Gate_Exec_Entity_GetLocation.B_1x1_Gate_Exec_Entity_GetLocationRotation.B_1x1_Gate_Exec_Entity_GetRotation.B_1x1_Gate_Exec_Entity_GetTag.B_1x1_Gate_Exec_Entity_GetVelocity.B_1x1_Gate_Exec_Entity_PlayAudioAt.B_1x1_Gate_Exec_Entity_RelativeTeleport.B_1x1_Gate_Exec_Entity_SetAngularVelocity.B_1x1_Gate_Exec_Entity_SetFrozen.B_1x1_Gate_Exec_Entity_SetGravityDirection.B_1x1_Gate_Exec_Entity_SetLinearVelocity.B_1x1_Gate_Exec_Entity_SetLocation.B_1x1_Gate_Exec_Entity_SetLocationRotation.B_1x1_Gate_Exec_Entity_SetRotation.B_1x1_Gate_Exec_Entity_SetTag.B_1x1_Gate_Exec_Entity_SetVelocity.B_1x1_Gate_Exec_Entity_Teleport.B_1x1_Gate_Exec_Gamemode_BroadcastChatMessage.B_1x1_Gate_Exec_Gamemode_BroadcastStatusMessage.B_1x1_Gate_Exec_Gamemode_FillArrayFromPlayers.B_1x1_Gate_Exec_Gamemode_FillArrayFromTeamMembers.B_1x1_Gate_Exec_Gamemode_GetCurrentRound.B_1x1_Gate_Exec_Gamemode_GetLeaderboardValue.B_1x1_Gate_Exec_Gamemode_GetTeam.B_1x1_Gate_Exec_Gamemode_GetTeamByName.B_1x1_Gate_Exec_Gamemode_GetTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_GetTeamName.B_1x1_Gate_Exec_Gamemode_IncrementLeaderboardValue.B_1x1_Gate_Exec_Gamemode_IncrementTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_PlayerWins.B_1x1_Gate_Exec_Gamemode_SetLeaderboardValue.B_1x1_Gate_Exec_Gamemode_SetTeam.B_1x1_Gate_Exec_Gamemode_SetTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_SetTeamPinned.B_1x1_Gate_Exec_Gamemode_TeamWins.B_1x1_Gate_Exec_PlayGlobalAudio.B_1x1_Gate_Exec_PrefabSpawner.B_1x1_Gate_Exec_PrintToConsole.B_1x1_Gate_Exec_Random.B_1x1_Gate_Exec_Sweep.B_1x1_Gate_Exec_Toggle.B_1x1_Gate_Exec_Union.B_1x1_Gate_Exec_Var_Get.B_1x1_Gate_Exec_Var_Increment.B_1x1_Gate_Exec_Var_Set.B_1x1_Gate_Expr_BitwiseAND.B_1x1_Gate_Expr_BitwiseBitCount.B_1x1_Gate_Expr_BitwiseNAND.B_1x1_Gate_Expr_BitwiseNOR.B_1x1_Gate_Expr_BitwiseNOT.B_1x1_Gate_Expr_BitwiseOR.B_1x1_Gate_Expr_BitwiseShiftLeft.B_1x1_Gate_Expr_BitwiseShiftRight.B_1x1_Gate_Expr_BitwiseXOR.B_1x1_Gate_Expr_Ceil.B_1x1_Gate_Expr_ChangeDetector.B_1x1_Gate_Expr_ChangeDetectorExec.B_1x1_Gate_Expr_ColorBlend.B_1x1_Gate_Expr_ColorConvert.B_1x1_Gate_Expr_ColorToHex.B_1x1_Gate_Expr_CompareEqual.B_1x1_Gate_Expr_CompareGreater.B_1x1_Gate_Expr_CompareGreaterOrEqual.B_1x1_Gate_Expr_CompareLess.B_1x1_Gate_Expr_CompareLessOrEqual.B_1x1_Gate_Expr_CompareNotEqual.B_1x1_Gate_Expr_Convert.B_1x1_Gate_Expr_DirectionToRotation.B_1x1_Gate_Expr_EdgeDetector.B_1x1_Gate_Expr_EdgeDetectorExec.B_1x1_Gate_Expr_Floor.B_1x1_Gate_Expr_InvertRotation.B_1x1_Gate_Expr_LogicalAND.B_1x1_Gate_Expr_LogicalNAND.B_1x1_Gate_Expr_LogicalNOR.B_1x1_Gate_Expr_LogicalNOT.B_1x1_Gate_Expr_LogicalOR.B_1x1_Gate_Expr_LogicalXOR.B_1x1_Gate_Expr_MakeColor.B_1x1_Gate_Expr_MakeColorHex.B_1x1_Gate_Expr_MakeColorSRGB.B_1x1_Gate_Expr_MakeQuaternion.B_1x1_Gate_Expr_MakeRotation.B_1x1_Gate_Expr_MakeVector.B_1x1_Gate_Expr_MathAbs.B_1x1_Gate_Expr_MathAcos.B_1x1_Gate_Expr_MathAcosh.B_1x1_Gate_Expr_MathAdd.B_1x1_Gate_Expr_MathAsin.B_1x1_Gate_Expr_MathAsinh.B_1x1_Gate_Expr_MathAtan.B_1x1_Gate_Expr_MathAtan2.B_1x1_Gate_Expr_MathAtanh.B_1x1_Gate_Expr_MathBlend.B_1x1_Gate_Expr_MathClamp.B_1x1_Gate_Expr_MathCos.B_1x1_Gate_Expr_MathCosh.B_1x1_Gate_Expr_MathDegreesToRadians.B_1x1_Gate_Expr_MathDivide.B_1x1_Gate_Expr_MathEasing.B_1x1_Gate_Expr_MathExp.B_1x1_Gate_Expr_MathLn.B_1x1_Gate_Expr_MathLogBase.B_1x1_Gate_Expr_MathMax.B_1x1_Gate_Expr_MathMin.B_1x1_Gate_Expr_MathModulo.B_1x1_Gate_Expr_MathModuloFloored.B_1x1_Gate_Expr_MathMultiply.B_1x1_Gate_Expr_MathNegate.B_1x1_Gate_Expr_MathPow.B_1x1_Gate_Expr_MathRadiansToDegrees.B_1x1_Gate_Expr_MathSign.B_1x1_Gate_Expr_MathSin.B_1x1_Gate_Expr_MathSinh.B_1x1_Gate_Expr_MathSqrt.B_1x1_Gate_Expr_MathSubtract.B_1x1_Gate_Expr_MathTan.B_1x1_Gate_Expr_MathTanh.B_1x1_Gate_Expr_NearlyEqual.B_1x1_Gate_Expr_QuatAngleBetween.B_1x1_Gate_Expr_QuatBetween.B_1x1_Gate_Expr_QuatDotProduct.B_1x1_Gate_Expr_QuatFromAxisAngle.B_1x1_Gate_Expr_QuatSlerp.B_1x1_Gate_Expr_QuatToAxisAngle.B_1x1_Gate_Expr_RotateVector.B_1x1_Gate_Expr_RotationToDirection.B_1x1_Gate_Expr_Round.B_1x1_Gate_Expr_Select.B_1x1_Gate_Expr_SplitColor.B_1x1_Gate_Expr_SplitColorSRGB.B_1x1_Gate_Expr_SplitQuaternion.B_1x1_Gate_Expr_SplitRotation.B_1x1_Gate_Expr_SplitVector.B_1x1_Gate_Expr_String_Concatenate.B_1x1_Gate_Expr_String_Contains.B_1x1_Gate_Expr_String_EndsWith.B_1x1_Gate_Expr_String_Find.B_1x1_Gate_Expr_String_FormatText.B_1x1_Gate_Expr_String_Length.B_1x1_Gate_Expr_String_ParseInt.B_1x1_Gate_Expr_String_ParseNumber.B_1x1_Gate_Expr_String_Replace.B_1x1_Gate_Expr_String_Split.B_1x1_Gate_Expr_String_StartsWith.B_1x1_Gate_Expr_String_Substring.B_1x1_Gate_Expr_String_ToLower.B_1x1_Gate_Expr_String_ToUpper.B_1x1_Gate_Expr_String_Trim.B_1x1_Gate_Expr_Swap.B_1x1_Gate_Expr_VecCrossProduct.B_1x1_Gate_Expr_VecDistance.B_1x1_Gate_Expr_VecDistanceSquared.B_1x1_Gate_Expr_VecDotProduct.B_1x1_Gate_Expr_VecMagnitude.B_1x1_Gate_Expr_VecMagnitudeSquared.B_1x1_Gate_Expr_VecNormalize.B_1x1_Gate_Expr_VecScale.B_1x1_Gate_Fake_Gamemode_CharacterDamagedEvent.B_1x1_Gate_Fake_Gamemode_CharacterDiedEvent.B_1x1_Gate_Fake_Gamemode_CharacterSpawnedEvent.B_1x1_Gate_Fake_Gamemode_ControllerJoinedEvent.B_1x1_Gate_Fake_Gamemode_ControllerLeftEvent.B_1x1_Gate_Fake_Gamemode_RoundEndEvent.B_1x1_Gate_Fake_Gamemode_RoundStartEvent.B_1x1_Gate_FindPlayer.B_1x1_Gate_FontReference.B_1x1_Gate_Internal_CharacterZoneEvent_Entered.B_1x1_Gate_Internal_CharacterZoneEvent_Left.B_1x1_Gate_Internal_EntityZoneEvent_Entered.B_1x1_Gate_Internal_EntityZoneEvent_Left.B_1x1_Gate_Internal_ProjectileZoneEvent_Entered.B_1x1_Gate_Internal_ProjectileZoneEvent_Left.B_1x1_Gate_Internal_ReadBrickGrid.B_1x1_Gate_Internal_ZoneEvent_BrickChanged.B_1x1_Gate_Internal_ZoneEvent_BrickRemoved.B_1x1_Gate_ItemReference.B_1x1_Gate_OneShotAudioReference.B_1x1_Gate_PickupReference.B_1x1_Gate_ProjectileReference.B_1x1_Gate_Pseudo_BufferSeconds.B_1x1_Gate_Pseudo_BufferTicks.B_1x1_Gate_Pseudo_Dampen.B_1x1_Gate_Pseudo_QueueSeconds.B_1x1_Gate_Pseudo_QueueTicks.B_1x1_Gate_Pseudo_Timer.B_1x1_Gate_Pseudo_Tween.B_1x1_Gate_SeatControlSplitter.B_1x1_Gate_ServerUptime.B_1x1_Gate_Variable.B_1x1_Gate_Variable_Array.B_1x1_Gate_WeightBrick.B_1x1_Gate_WheelEngineAudioReference.B_2x2_Cannon.B_2x2_Thruster.B_Bush.B_Button_Pressed.B_Button_Square_Pressed.B_Gyroscope.B_Joint_RigidBearing.B_Joint_RigidBearing_Micro.B_Joint_Socket.B_Joint_Wheel_Micro_Suspension.B_Joint_Wheel_Suspension.B_Switch_Flipped".split("."), Ji = /* @__PURE__ */ "PB_DefaultBrick.PB_DefaultStudded.PB_DefaultRampInnerCornerInverted.PB_DefaultRampCrestEnd.PB_DefaultRampCrestCorner.PB_DefaultRampCrest.PB_DefaultRamp.PB_PicketFence.BP_LatticeThin.PB_DefaultWedge.PB_DefaultTile.PB_DefaultSmoothTile.PB_DefaultSideWedge.PB_DefaultRampInverted.PB_DefaultRampInnerCorner.PB_DefaultRampCornerInverted.PB_DefaultRampCorner.PB_DefaultPole.PB_DefaultMicroWedgeTriangleCorner.PB_DefaultMicroWedgeOuterCorner.PB_DefaultMicroWedgeInnerCorner.PB_DefaultMicroWedgeHalfOuterCorner.PB_DefaultMicroWedgeHalfInnerCornerInverted.PB_DefaultMicroWedgeHalfInnerCorner.PB_DefaultMicroWedgeCorner.PB_DefaultMicroWedge.PB_DefaultMicroRamp.PB_DefaultMicroBrick.PB_DefaultArch.BP_SquarePlate.BP_SpikePlate.PB_Spike.PB_SliderJoint.PB_ServoSliderJoint.PB_MotorSliderJoint.BP_RoundPlate.PB_RoundedCap.PB_Baguette".split("."), Yi = {
3842
+ }, Ki = /* @__PURE__ */ "B_1x1_Reroute_Node.B_1x1_Gate_AND.B_1x1_Gate_OR.B_1x1_Gate_XOR.B_1x1_Gate_NAND.B_1x1_Gate_NOR.B_1x1_NOT_Gate.B_1x1_Gate_AND_Bitwise.B_1x1_Gate_OR_Bitwise.B_1x1_Gate_XOR_Bitwise.B_1x1_Gate_NAND_Bitwise.B_1x1_Gate_NOR_Bitwise.B_1x1_Gate_NOT_Bitwise.B_1x1_Gate_ShiftLeft_Bitwise.B_1x1_Gate_ShiftRight_Bitwise.B_1x1_Gate_Add.B_1x1_Gate_Subtract.B_1x1_Gate_Multiply.B_1x1_Gate_ModFloored.B_1x1_Gate_Mod.B_1x1_Gate_Divide.B_1x1_Gate_Equal.B_1x1_Gate_NotEqual.B_1x1_Gate_LessThan.B_1x1_Gate_LessThanEqual.B_1x1_Gate_GreaterThan.B_1x1_Gate_GreaterThanEqual.B_1x1_Gate_Ceiling.B_1x1_Gate_Floor.B_1x1_Gate_Constant.B_1x1_Gate_Blend.B_1x1_Gate_EdgeDetector.B_1x1_Gate_Timer.B_1x1_Gate_Timer_Tick.B_1x1_Microchip.B_1x1_Gate_MicrochipInput.B_1x1_Gate_MicrochipOutput.B_2x2_Overhang.B_1x4_Brick_Side.B_1x2_Overhang.B_1x1_Brick_Side_Lip.B_1x1_Brick_Side.B_Jar.B_Chalice.B_Cauldron.B_Small_Flower.B_Pine_Tree.B_Leaf_Bush.B_Hedge_1x4.B_Hedge_1x2.B_Hedge_1x1_Corner.B_Hedge_1x1.B_Flower.B_Fern.B_Branch.B_2x4_Door_Frame.B_Turkey_Leg.B_Turkey_Body.B_Swirl_Plate.B_Sausage.B_Pumpkin_Carved.B_Pumpkin.B_Ladder.B_Inverted_Cone.B_Handle.B_Gravestone.B_Frog_Small.B_Frog.B_Flame.B_Coffin_Lid.B_Coffin.B_BoneStraight.B_Bone.B_1x1_Coin_Diagonal.B_1x1_Coin.B_Spoon.B_Fork.B_2x2_Corner.B_2x2f_Plate_Center_Inv.B_2x2f_Plate_Center.B_1x2f_Plate_Center_Inv.B_4x4_Round.B_2x2_Round.B_2x2F_Round.B_2x_Octo_T_Inv.B_2x_Octo_T.B_2x2F_Octo_Converter_Inv.B_2x2F_Octo_Converter.B_2x2F_Octo.B_8x8_Lattice_Plate.B_1x2_MetalIngot.B_1x1f_Tile_Corner.B_1x1f_Inverse_Tile_Corner.B_Rook.B_Queen.B_Pawn.B_Knight.B_King.B_Bishop.B_1x2f_Plate_Center.B_2x2_Cone.B_1x1_Round.B_1x1_Cone.B_1x1F_Round.B_2x_Octo_Cone.B_2x_Octo_90Deg_Inv.B_2x_Octo_90Deg.B_2x_Octo.B_1x_Octo_T_Inv.B_1x_Octo_T.B_1x_Octo_90Deg_Inv.B_1x_Octo_90Deg.B_1x_Octo.B_1x1F_Octo.B_2x2_Slipper.B_2x1_Slipper.B_Joint_Wheel_Micro.B_Joint_Wheel.B_Joint_Socket_Micro.B_Joint_Servo_Micro.B_Joint_Servo.B_Joint_Motor_Micro.B_Joint_Motor.B_Joint_Coupler.B_Joint_Bearing_Micro.B_Joint_Bearing.B_1x1_SoundEmitter.B_1x1_Gate_Teleport.B_1x1_Gate_RelativeTeleport.B_1x1_EntityGate_SetVelocity.B_1x1_EntityGate_SetLocationAndRotation.B_1x1_EntityGate_SetLocation.B_1x1_EntityGate_ReadBrickGrid.B_1x1_EntityGate_PlayAudioAt.B_1x1_EntityGate_AddVelocity.B_1x1_EntityGate_AddLocationAndRotation.B_1x1_CharacterGate_SetGravityDirection.B_Vehicle_Engine.B_Switch_Test.B_SpawnPoint.B_Seat.B_GoalPoint.B_DestinationPoint.B_CheckPoint.B_Button_Square.B_Button.B_Bot_Spawn_Point.B_2x2F_Target.B_2x2F_Speaker.B_1x1_Gate_WheelEngineSlim.B_1x1F_Speaker.B_1x1_Gate_AudioReference.B_1x1_Gate_BrickAssetReference.B_1x1_Gate_Clock.B_1x1_Gate_DeltaTime.B_1x1_Gate_EntityTypeReference.B_1x1_Gate_Exec_ArrayVar_Append.B_1x1_Gate_Exec_ArrayVar_Average.B_1x1_Gate_Exec_ArrayVar_Clear.B_1x1_Gate_Exec_ArrayVar_CopyFrom.B_1x1_Gate_Exec_ArrayVar_Fill.B_1x1_Gate_Exec_ArrayVar_Find.B_1x1_Gate_Exec_ArrayVar_Get.B_1x1_Gate_Exec_ArrayVar_GetLength.B_1x1_Gate_Exec_ArrayVar_Insert.B_1x1_Gate_Exec_ArrayVar_Max.B_1x1_Gate_Exec_ArrayVar_Min.B_1x1_Gate_Exec_ArrayVar_Pop.B_1x1_Gate_Exec_ArrayVar_Push.B_1x1_Gate_Exec_ArrayVar_RemoveAtIndex.B_1x1_Gate_Exec_ArrayVar_Resize.B_1x1_Gate_Exec_ArrayVar_Reverse.B_1x1_Gate_Exec_ArrayVar_SetAtIndex.B_1x1_Gate_Exec_ArrayVar_Shuffle.B_1x1_Gate_Exec_ArrayVar_Slice.B_1x1_Gate_Exec_ArrayVar_Sort.B_1x1_Gate_Exec_ArrayVar_Sum.B_1x1_Gate_Exec_ArrayVar_Swap.B_1x1_Gate_Exec_Branch.B_1x1_Gate_Exec_Character_AddInventoryBrick.B_1x1_Gate_Exec_Character_AddInventoryEntity.B_1x1_Gate_Exec_Character_AddInventoryEntry.B_1x1_Gate_Exec_Character_AddInventoryItem.B_1x1_Gate_Exec_Character_AddInventoryItemAdv.B_1x1_Gate_Exec_Character_GetAim.B_1x1_Gate_Exec_Character_GetDamage.B_1x1_Gate_Exec_Character_GetFromController.B_1x1_Gate_Exec_Character_IncDamage.B_1x1_Gate_Exec_Character_SetDamage.B_1x1_Gate_Exec_Character_SetInventoryBrick.B_1x1_Gate_Exec_Character_SetInventoryEntity.B_1x1_Gate_Exec_Character_SetInventoryEntry.B_1x1_Gate_Exec_Character_SetInventoryItem.B_1x1_Gate_Exec_Character_SetInventoryItemAdv.B_1x1_Gate_Exec_Character_SetTempPermission.B_1x1_Gate_Exec_Character_ShowHint.B_1x1_Gate_Exec_ChatCommand.B_1x1_Gate_Exec_Controller_DisplayText.B_1x1_Gate_Exec_Controller_GetDisplayName.B_1x1_Gate_Exec_Controller_GetFromEntity.B_1x1_Gate_Exec_Controller_GetUserId.B_1x1_Gate_Exec_Controller_GetUserName.B_1x1_Gate_Exec_Controller_HasPermission.B_1x1_Gate_Exec_Controller_HasRole.B_1x1_Gate_Exec_Controller_IsTrustedByBrickOwner.B_1x1_Gate_Exec_Controller_SetCanRespawn.B_1x1_Gate_Exec_Controller_ShowChatMessage.B_1x1_Gate_Exec_Controller_ShowMessageBox.B_1x1_Gate_Exec_Controller_ShowStatusMessage.B_1x1_Gate_Exec_Cycle.B_1x1_Gate_Exec_Entity_AddLocationRotation.B_1x1_Gate_Exec_Entity_AddVelocity.B_1x1_Gate_Exec_Entity_GetAngularVelocity.B_1x1_Gate_Exec_Entity_GetLinearVelocity.B_1x1_Gate_Exec_Entity_GetLocation.B_1x1_Gate_Exec_Entity_GetLocationRotation.B_1x1_Gate_Exec_Entity_GetRotation.B_1x1_Gate_Exec_Entity_GetTag.B_1x1_Gate_Exec_Entity_GetVelocity.B_1x1_Gate_Exec_Entity_PlayAudioAt.B_1x1_Gate_Exec_Entity_RelativeTeleport.B_1x1_Gate_Exec_Entity_SetAngularVelocity.B_1x1_Gate_Exec_Entity_SetFrozen.B_1x1_Gate_Exec_Entity_SetGravityDirection.B_1x1_Gate_Exec_Entity_SetLinearVelocity.B_1x1_Gate_Exec_Entity_SetLocation.B_1x1_Gate_Exec_Entity_SetLocationRotation.B_1x1_Gate_Exec_Entity_SetRotation.B_1x1_Gate_Exec_Entity_SetTag.B_1x1_Gate_Exec_Entity_SetVelocity.B_1x1_Gate_Exec_Entity_Teleport.B_1x1_Gate_Exec_Gamemode_BroadcastChatMessage.B_1x1_Gate_Exec_Gamemode_BroadcastStatusMessage.B_1x1_Gate_Exec_Gamemode_FillArrayFromPlayers.B_1x1_Gate_Exec_Gamemode_FillArrayFromTeamMembers.B_1x1_Gate_Exec_Gamemode_GetCurrentRound.B_1x1_Gate_Exec_Gamemode_GetLeaderboardValue.B_1x1_Gate_Exec_Gamemode_GetTeam.B_1x1_Gate_Exec_Gamemode_GetTeamByName.B_1x1_Gate_Exec_Gamemode_GetTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_GetTeamName.B_1x1_Gate_Exec_Gamemode_IncrementLeaderboardValue.B_1x1_Gate_Exec_Gamemode_IncrementTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_PlayerWins.B_1x1_Gate_Exec_Gamemode_SetLeaderboardValue.B_1x1_Gate_Exec_Gamemode_SetTeam.B_1x1_Gate_Exec_Gamemode_SetTeamLeaderboardValue.B_1x1_Gate_Exec_Gamemode_SetTeamPinned.B_1x1_Gate_Exec_Gamemode_TeamWins.B_1x1_Gate_Exec_PlayGlobalAudio.B_1x1_Gate_Exec_PrefabSpawner.B_1x1_Gate_Exec_PrintToConsole.B_1x1_Gate_Exec_Random.B_1x1_Gate_Exec_Sweep.B_1x1_Gate_Exec_Toggle.B_1x1_Gate_Exec_Union.B_1x1_Gate_Exec_Var_Get.B_1x1_Gate_Exec_Var_Increment.B_1x1_Gate_Exec_Var_Set.B_1x1_Gate_Expr_BitwiseAND.B_1x1_Gate_Expr_BitwiseBitCount.B_1x1_Gate_Expr_BitwiseNAND.B_1x1_Gate_Expr_BitwiseNOR.B_1x1_Gate_Expr_BitwiseNOT.B_1x1_Gate_Expr_BitwiseOR.B_1x1_Gate_Expr_BitwiseShiftLeft.B_1x1_Gate_Expr_BitwiseShiftRight.B_1x1_Gate_Expr_BitwiseXOR.B_1x1_Gate_Expr_Ceil.B_1x1_Gate_Expr_ChangeDetector.B_1x1_Gate_Expr_ChangeDetectorExec.B_1x1_Gate_Expr_ColorBlend.B_1x1_Gate_Expr_ColorConvert.B_1x1_Gate_Expr_ColorToHex.B_1x1_Gate_Expr_CompareEqual.B_1x1_Gate_Expr_CompareGreater.B_1x1_Gate_Expr_CompareGreaterOrEqual.B_1x1_Gate_Expr_CompareLess.B_1x1_Gate_Expr_CompareLessOrEqual.B_1x1_Gate_Expr_CompareNotEqual.B_1x1_Gate_Expr_Convert.B_1x1_Gate_Expr_DirectionToRotation.B_1x1_Gate_Expr_EdgeDetector.B_1x1_Gate_Expr_EdgeDetectorExec.B_1x1_Gate_Expr_Floor.B_1x1_Gate_Expr_InvertRotation.B_1x1_Gate_Expr_LogicalAND.B_1x1_Gate_Expr_LogicalNAND.B_1x1_Gate_Expr_LogicalNOR.B_1x1_Gate_Expr_LogicalNOT.B_1x1_Gate_Expr_LogicalOR.B_1x1_Gate_Expr_LogicalXOR.B_1x1_Gate_Expr_MakeColor.B_1x1_Gate_Expr_MakeColorHex.B_1x1_Gate_Expr_MakeColorSRGB.B_1x1_Gate_Expr_MakeQuaternion.B_1x1_Gate_Expr_MakeRotation.B_1x1_Gate_Expr_MakeVector.B_1x1_Gate_Expr_MathAbs.B_1x1_Gate_Expr_MathAcos.B_1x1_Gate_Expr_MathAcosh.B_1x1_Gate_Expr_MathAdd.B_1x1_Gate_Expr_MathAsin.B_1x1_Gate_Expr_MathAsinh.B_1x1_Gate_Expr_MathAtan.B_1x1_Gate_Expr_MathAtan2.B_1x1_Gate_Expr_MathAtanh.B_1x1_Gate_Expr_MathBlend.B_1x1_Gate_Expr_MathClamp.B_1x1_Gate_Expr_MathCos.B_1x1_Gate_Expr_MathCosh.B_1x1_Gate_Expr_MathDegreesToRadians.B_1x1_Gate_Expr_MathDivide.B_1x1_Gate_Expr_MathEasing.B_1x1_Gate_Expr_MathExp.B_1x1_Gate_Expr_MathLn.B_1x1_Gate_Expr_MathLogBase.B_1x1_Gate_Expr_MathMax.B_1x1_Gate_Expr_MathMin.B_1x1_Gate_Expr_MathModulo.B_1x1_Gate_Expr_MathModuloFloored.B_1x1_Gate_Expr_MathMultiply.B_1x1_Gate_Expr_MathNegate.B_1x1_Gate_Expr_MathPow.B_1x1_Gate_Expr_MathRadiansToDegrees.B_1x1_Gate_Expr_MathSign.B_1x1_Gate_Expr_MathSin.B_1x1_Gate_Expr_MathSinh.B_1x1_Gate_Expr_MathSqrt.B_1x1_Gate_Expr_MathSubtract.B_1x1_Gate_Expr_MathTan.B_1x1_Gate_Expr_MathTanh.B_1x1_Gate_Expr_NearlyEqual.B_1x1_Gate_Expr_QuatAngleBetween.B_1x1_Gate_Expr_QuatBetween.B_1x1_Gate_Expr_QuatDotProduct.B_1x1_Gate_Expr_QuatFromAxisAngle.B_1x1_Gate_Expr_QuatSlerp.B_1x1_Gate_Expr_QuatToAxisAngle.B_1x1_Gate_Expr_RotateVector.B_1x1_Gate_Expr_RotationToDirection.B_1x1_Gate_Expr_Round.B_1x1_Gate_Expr_Select.B_1x1_Gate_Expr_SplitColor.B_1x1_Gate_Expr_SplitColorSRGB.B_1x1_Gate_Expr_SplitQuaternion.B_1x1_Gate_Expr_SplitRotation.B_1x1_Gate_Expr_SplitVector.B_1x1_Gate_Expr_String_Concatenate.B_1x1_Gate_Expr_String_Contains.B_1x1_Gate_Expr_String_EndsWith.B_1x1_Gate_Expr_String_Find.B_1x1_Gate_Expr_String_FormatText.B_1x1_Gate_Expr_String_Length.B_1x1_Gate_Expr_String_ParseInt.B_1x1_Gate_Expr_String_ParseNumber.B_1x1_Gate_Expr_String_Replace.B_1x1_Gate_Expr_String_Split.B_1x1_Gate_Expr_String_StartsWith.B_1x1_Gate_Expr_String_Substring.B_1x1_Gate_Expr_String_ToLower.B_1x1_Gate_Expr_String_ToUpper.B_1x1_Gate_Expr_String_Trim.B_1x1_Gate_Expr_Swap.B_1x1_Gate_Expr_VecCrossProduct.B_1x1_Gate_Expr_VecDistance.B_1x1_Gate_Expr_VecDistanceSquared.B_1x1_Gate_Expr_VecDotProduct.B_1x1_Gate_Expr_VecMagnitude.B_1x1_Gate_Expr_VecMagnitudeSquared.B_1x1_Gate_Expr_VecNormalize.B_1x1_Gate_Expr_VecScale.B_1x1_Gate_Fake_Gamemode_CharacterDamagedEvent.B_1x1_Gate_Fake_Gamemode_CharacterDiedEvent.B_1x1_Gate_Fake_Gamemode_CharacterSpawnedEvent.B_1x1_Gate_Fake_Gamemode_ControllerJoinedEvent.B_1x1_Gate_Fake_Gamemode_ControllerLeftEvent.B_1x1_Gate_Fake_Gamemode_RoundEndEvent.B_1x1_Gate_Fake_Gamemode_RoundStartEvent.B_1x1_Gate_FindPlayer.B_1x1_Gate_FontReference.B_1x1_Gate_Internal_CharacterZoneEvent_Entered.B_1x1_Gate_Internal_CharacterZoneEvent_Left.B_1x1_Gate_Internal_EntityZoneEvent_Entered.B_1x1_Gate_Internal_EntityZoneEvent_Left.B_1x1_Gate_Internal_ProjectileZoneEvent_Entered.B_1x1_Gate_Internal_ProjectileZoneEvent_Left.B_1x1_Gate_Internal_ReadBrickGrid.B_1x1_Gate_Internal_ZoneEvent_BrickChanged.B_1x1_Gate_Internal_ZoneEvent_BrickRemoved.B_1x1_Gate_ItemReference.B_1x1_Gate_OneShotAudioReference.B_1x1_Gate_PickupReference.B_1x1_Gate_ProjectileReference.B_1x1_Gate_Pseudo_BufferSeconds.B_1x1_Gate_Pseudo_BufferTicks.B_1x1_Gate_Pseudo_Dampen.B_1x1_Gate_Pseudo_QueueSeconds.B_1x1_Gate_Pseudo_QueueTicks.B_1x1_Gate_Pseudo_Timer.B_1x1_Gate_Pseudo_Tween.B_1x1_Gate_SeatControlSplitter.B_1x1_Gate_ServerUptime.B_1x1_Gate_Variable.B_1x1_Gate_Variable_Array.B_1x1_Gate_WeightBrick.B_1x1_Gate_WheelEngineAudioReference.B_2x2_Cannon.B_2x2_Thruster.B_Bush.B_Button_Pressed.B_Button_Square_Pressed.B_Gyroscope.B_Joint_RigidBearing.B_Joint_RigidBearing_Micro.B_Joint_Socket.B_Joint_Wheel_Micro_Suspension.B_Joint_Wheel_Suspension.B_Switch_Flipped".split("."), qi = /* @__PURE__ */ "PB_DefaultBrick.PB_DefaultStudded.PB_DefaultRampInnerCornerInverted.PB_DefaultRampCrestEnd.PB_DefaultRampCrestCorner.PB_DefaultRampCrest.PB_DefaultRamp.PB_PicketFence.BP_LatticeThin.PB_DefaultWedge.PB_DefaultTile.PB_DefaultSmoothTile.PB_DefaultSideWedge.PB_DefaultRampInverted.PB_DefaultRampInnerCorner.PB_DefaultRampCornerInverted.PB_DefaultRampCorner.PB_DefaultPole.PB_DefaultMicroWedgeTriangleCorner.PB_DefaultMicroWedgeOuterCorner.PB_DefaultMicroWedgeInnerCorner.PB_DefaultMicroWedgeHalfOuterCorner.PB_DefaultMicroWedgeHalfInnerCornerInverted.PB_DefaultMicroWedgeHalfInnerCorner.PB_DefaultMicroWedgeCorner.PB_DefaultMicroWedge.PB_DefaultMicroRamp.PB_DefaultMicroBrick.PB_DefaultArch.BP_SquarePlate.BP_SpikePlate.PB_Spike.PB_SliderJoint.PB_ServoSliderJoint.PB_MotorSliderJoint.BP_RoundPlate.PB_RoundedCap.PB_Baguette".split("."), Ji = {
3843
3843
  BP_LatticeThin: "BP_LatticeThin",
3844
3844
  BP_RoundPlate: "BP_RoundPlate",
3845
3845
  BP_SpikePlate: "BP_SpikePlate",
@@ -4297,13 +4297,13 @@ var Ki = class e {
4297
4297
  PB_ServoSliderJoint: "PB_ServoSliderJoint",
4298
4298
  PB_SliderJoint: "PB_SliderJoint",
4299
4299
  PB_Spike: "PB_Spike"
4300
- }, Xi = new Set(qi), Zi = new Set(Ji);
4301
- function Qi(e) {
4302
- return Zi.has(e) ? !0 : Xi.has(e) ? !1 : e.startsWith("PB_") || e.startsWith("BP_");
4300
+ }, Yi = new Set(Ki), Xi = new Set(qi);
4301
+ function Zi(e) {
4302
+ return Xi.has(e) ? !0 : Yi.has(e) ? !1 : e.startsWith("PB_") || e.startsWith("BP_");
4303
4303
  }
4304
4304
  //#endregion
4305
4305
  //#region src/brdb/componentDb.ts
4306
- var $i = /* @__PURE__ */ new Map([
4306
+ var Qi = /* @__PURE__ */ new Map([
4307
4307
  ["BrickComponentType_Internal_CharacterZoneEvent_Entered", "BrickComponentData_Internal_CharacterZoneEvent"],
4308
4308
  ["BrickComponentType_Internal_CharacterZoneEvent_Left", "BrickComponentData_Internal_CharacterZoneEvent"],
4309
4309
  ["BrickComponentType_Internal_EntityZoneEvent_Entered", "BrickComponentData_Internal_EntityZoneEvent"],
@@ -4602,7 +4602,7 @@ var $i = /* @__PURE__ */ new Map([
4602
4602
  ["Component_TextDisplay", "BrickComponentData_TextDisplay"],
4603
4603
  ["Component_Touch", "BrickComponentData_Touch"],
4604
4604
  ["Component_WireGraph_PlayAudioAt", "BrickComponentData_WireGraph_Exec_Entity_PlayAudioAt"]
4605
- ]), ea = new Map(Object.entries({
4605
+ ]), $i = new Map(Object.entries({
4606
4606
  BrickComponentData_AudioEmitter: {
4607
4607
  bEnabled: !0,
4608
4608
  VolumeMultiplier: 1,
@@ -5328,7 +5328,7 @@ var $i = /* @__PURE__ */ new Map([
5328
5328
  BrickComponentData_WireGraph_Expr_VecFloat_Vec: { Scalar: 0 },
5329
5329
  BrickComponentData_WireGraph_Fake_RoundEvent: { RoundNumber: 0 },
5330
5330
  BrickComponentData_WireGraph_FindPlayer: { Query: "" }
5331
- })), ta = /* @__PURE__ */ "A,ActiveDamping,AdditionalIgnoredEntities,AggroRange,Agression,Alpha,Amount,Anchor,Anchor.X,Anchor.Y,AnchorX,AnchorY,Angle,AngularVelocity,AngularVelocity.X,AngularVelocity.Y,AngularVelocity.Z,Arguments,ArrayVarRef,Arrived,AttackDamageMultiplier,AttackMovementAmount,Attacker,AttackerWeapon,AttackerWeaponName,AudioDescriptor,Axis,Axis.X,Axis.Y,Axis.Z,B,Base,BeginTouchSound,Billboard,Blend,BotName,BotWeapon,BrickAsset,BrickGrid,Brightness,CenterOfSteering,Character,CharacterThatJustHit,Color,Color.A,Color.B,Color.G,Color.R,ColorA,ColorA.A,ColorA.B,ColorA.G,ColorA.R,ColorB,ColorB.A,ColorB.B,ColorB.G,ColorB.R,ConsoleTag,Control_DriveAndSteer,Controller,CorpseTimeout,Count,CurrentAngle,CurrentPosition,CustomMass,CustomMassVerticalOffset,Damage,DamageLimit,DamageMultiplier,Damping,DataIn1,DataIn2,DataIn3,DataIn4,DataIn5,DataIn6,DataIn7,DataIn8,DataOut1,DataOut2,DataOut3,DataOut4,DataOut5,DataOut6,DataOut7,DataOut8,Delimiter,DeltaTime,Destination,DestroyAll,Direction,Direction.X,Direction.Y,Direction.Z,DisplayName,Distance,DistanceToTarget,DriveAcceleratingPowerMultiplier,DriveBrakingPowerMultiplier,DriveDampingMultiplier,DriveInterpSpeed,DrivePower,DriveSpeed,Duration,EndTouchSound,Entity,EntityType,Exec,ExecA,ExecB,ExecDown,ExecIn,ExecOut,ExecOutA,ExecOutB,ExecOutDown,ExitOffset,ExitOffset.X,ExitOffset.Y,ExitOffset.Z,Expired,Exponent,Face,FireRate,FireSound,FocusAzimuth,FocusCharacter,Font,FontColor,FontColor.A,FontColor.B,FontColor.G,FontColor.R,Force,ForceLimit,FormatString,From,From.X,From.Y,From.Z,Function,G,GraffitiAngleLimit,GraffitiDepthLimit,GraffitiLayer,GunSkill,HealthMultiplier,Hex,Hit,HitDistance,HitEntity,HitLocation,HitNormal,IgnoreEntity,Index,IndexA,IndexB,InnerConeAngle,InnerRadius,Input,Input.A,Input.B,Input.G,Input.Pitch,Input.R,Input.Roll,Input.W,Input.X,Input.Y,Input.Yaw,Input.Z,InputA,InputA.W,InputA.X,InputA.Y,InputA.Z,InputB,InputB.W,InputB.X,InputB.Y,InputB.Z,InputC,InputD,InputE,InputF,InputForward,InputG,InputRight,Instigator,InteractSound,InterpMode,Item,ItemNameOverride,ItemScale,ItemType,JointDistance,Jumpyness,Kerning,Key,Killer,KillerWeapon,KillerWeaponName,Left,Length,Lifetime,Limit,LimitAngle,LineHeight,LineOffset,LinearVelocity,LinearVelocity.X,LinearVelocity.Y,LinearVelocity.Z,ManualInput_Drive,ManualInput_Steer,Mass,MassOffset,MassOffset.X,MassOffset.Y,MassOffset.Z,MassSize,MassSize.X,MassSize.Y,MassSize.Z,Material,MaterialAlpha,MaterialSlider,Max,MaxDistance,MaxForce,Message,Min,Miss,MoveTarget,MoveTarget.X,MoveTarget.Y,MoveTarget.Z,MovementAmount,MovementGoalDummy,MovementRandomness,Name,NonFocusAzimuth,NonFocusVolumeAttenuation,NumberOfShots,OccupantCount,Offset,Offset.X,Offset.Y,Offset.Z,OnChanged,OnFallingEdge,OnFired,OnRisingEdge,OnTime,Origin,Origin.X,Origin.Y,Origin.Z,OuterConeAngle,Outline,OutlineColor,OutlineColor.A,OutlineColor.B,OutlineColor.G,OutlineColor.R,OutlineSize,OutlineWidth,Output,OutputB,Pause,PickupAnimationAxis,PickupAnimationPhase,PickupBobHeight,PickupBobSpeed,PickupClass,PickupMeshColors,PickupMinigameResetRespawnDelay,PickupOffsetDirection,PickupOffsetDistance,PickupRespawnTime,PickupRotation,PickupRotation.Pitch,PickupRotation.Roll,PickupRotation.Yaw,PickupScale,PickupSpinSpeed,Pitch,PitchMultiplier,Play,Player,PositionX,PositionY,Power,Prefix,PressCount,PressSound,ProceduralSize,ProceduralSize.X,ProceduralSize.Y,ProceduralSize.Z,Projectile,ProjectileClass,ProjectileOverride,PromptCustomLabel,Query,R,RER_Input,RER_Output,Radius,ReactionTime,ReleaseSound,RepeatCount,RepeatDelay,RepeatTime,RepeatVariance,Replacement,RespawnTime,Restart,Resume,Right,Roll,Rotation,Rotation.Pitch,Rotation.Roll,Rotation.W,Rotation.X,Rotation.Y,Rotation.Yaw,Rotation.Z,RoundNumber,RunSpeed,Scalar,ScaleMultiplier,ScaleX,ScaleY,ScuffWidth,Search,SecondsToWait,Separator,Shading,ShadingWidth,SittingCharacter,Size,Skew,Skin,Skin.Parts,Slot,SmoothTime,Source,SourceRef,SpawnLocation,SpawnMargin,SpawnOffset,SpawnOffset.X,SpawnOffset.Y,SpawnOffset.Z,SpawnOffsetRotation,SpawnOffsetRotation.Pitch,SpawnOffsetRotation.Roll,SpawnOffsetRotation.Yaw,SpawnVelocity,SpawnVelocity.X,SpawnVelocity.Y,SpawnVelocity.Z,SpawnedCharacter,SpawnedEntity,Speed,SpeedMultiplier,SpreadConeAngle,Start,Steer,SteerInterpSpeed,SteerLimitDegree,SteerLimitSpeedFalloff,SteerPower,SteerPowerMultiplier,Stop,Strength,Suffix,SuspensionDamping,SuspensionLength,SuspensionOffset,SuspensionStiffness,Tag,TagFilter,TankSteerSpeedMultiplier,Target,TargetAngle,TargetAxis,TargetAxis.X,TargetAxis.Y,TargetAxis.Z,TargetPosition,Team,TeamCollisionChannel,TeamName,Text,TextId,TextIdOut,ThisDestination,Throttle,TicksToWait,Time,Title,To,To.X,To.Y,To.Z,Tolerance,TopSpeed,TouchCount,Transition,Typeface,Uptime,UserId,UserName,Value,VarRef,Vector,Vector.X,Vector.Y,Vector.Z,VolumeMultiplier,W,WaterDriveForce,WaterSteeringForce,Weapon,WeaponName,WeaponNameThatJustHit,WeaponSpeedMultiplier,WeaponThatJustHit,WheelFrictionMultiplier,X,Y,Yaw,Z,ZeroSecondsToWait,ZeroTicksToWait,Zone,ZoneEndDistance,ZoneRef,ZoneStartDistance,bActiveBot,bAlignToWedge,bAllowEngineSteerCorrect,bAllowNearbyInteraction,bAnglesArePercentages,bAutoRight,bBackVision,bCanBrake,bCanJump,bCanRespawn,bCanTargetBots,bCanTargetPlayers,bCaseSensitive,bCastShadows,bCollisionEnabled,bCollisionEnabled_Interaction,bCollisionEnabled_Physics,bCollisionEnabled_Player,bCollisionEnabled_Player1,bCollisionEnabled_Player2,bCollisionEnabled_Player3,bCollisionEnabled_Weapon,bCond,bDeleteBot,bDescending,bDetectBricks,bDetectEntities,bDetectMap,bDetectPhysics,bDetectPlayers,bDetectPlayers1,bDetectPlayers2,bDetectPlayers3,bDetectPlayers4,bDetectProjectiles,bDriveWhenNotAttachedToEngine,bEnable,bEnableManualControl,bEnableRepeat,bEnabled,bFlashIfUnchanged,bFlipShading,bForeground,bFound,bFrozen,bHasPermission,bHasRole,bHeld,bHiddenInteraction,bIgnoreOwningGrid,bInput,bInputA,bInputB,bIsBuildingZone,bIsEmpty,bIsLooseZone,bIsOccupied,bIsShareZone,bIsTrusted,bJustHit,bLimitAngle,bManualInput_Brake,bMatchBrickShape,bOccupied,bOutOfBounds,bOutput,bOverrideColor,bOverrideOutlineColor,bOverridePickupColors,bPermissionEnable,bPickupAnimationAxisLocal,bPickupAnimationEnabled,bPickupAutoDisableOnPickup,bPickupEnabled,bPickupRespawnOnMinigameReset,bPinPlayerToTeam,bPinned,bPositionsArePercentages,bPressedJump,bPulseOnChange,bPulseOnFallingEdge,bPulseOnRisingEdge,bRelative,bRenderTranslucentWhenDisabled,bReversed,bRollCameraInThirdPerson,bRotatePlayerGravityOnSpawn,bSelectB,bSharpCorners,bSharpOutlines,bShowPickupEnabled,bSpatialization,bSpawnEnable,bSpawnLight,bSpreadBiasedTowardsCenter,bSteerEnabled,bStopped,bSuccess,bSuspensionEnabled,bSwap,bTankSteering,bTeamCollision,bTeamCollision1,bTeamCollision2,bTeamCollision3,bTeamWinsInstead,bTouching,bUseBrickColor,bVisibility,bVisionRaycasting,bWelded".split(","), na = /* @__PURE__ */ new Map([["Entity_DynamicBrickGrid", "BrickGridDynamicActor"], ["Entity_MicrochipDynamicBrickGrid", "BP_MicrochipBrickGridDynamicActor_C"]]), ra = new Map(Object.entries({
5331
+ })), ea = /* @__PURE__ */ "A,ActiveDamping,AdditionalIgnoredEntities,AggroRange,Agression,Alpha,Amount,Anchor,Anchor.X,Anchor.Y,AnchorX,AnchorY,Angle,AngularVelocity,AngularVelocity.X,AngularVelocity.Y,AngularVelocity.Z,Arguments,ArrayVarRef,Arrived,AttackDamageMultiplier,AttackMovementAmount,Attacker,AttackerWeapon,AttackerWeaponName,AudioDescriptor,Axis,Axis.X,Axis.Y,Axis.Z,B,Base,BeginTouchSound,Billboard,Blend,BotName,BotWeapon,BrickAsset,BrickGrid,Brightness,CenterOfSteering,Character,CharacterThatJustHit,Color,Color.A,Color.B,Color.G,Color.R,ColorA,ColorA.A,ColorA.B,ColorA.G,ColorA.R,ColorB,ColorB.A,ColorB.B,ColorB.G,ColorB.R,ConsoleTag,Control_DriveAndSteer,Controller,CorpseTimeout,Count,CurrentAngle,CurrentPosition,CustomMass,CustomMassVerticalOffset,Damage,DamageLimit,DamageMultiplier,Damping,DataIn1,DataIn2,DataIn3,DataIn4,DataIn5,DataIn6,DataIn7,DataIn8,DataOut1,DataOut2,DataOut3,DataOut4,DataOut5,DataOut6,DataOut7,DataOut8,Delimiter,DeltaTime,Destination,DestroyAll,Direction,Direction.X,Direction.Y,Direction.Z,DisplayName,Distance,DistanceToTarget,DriveAcceleratingPowerMultiplier,DriveBrakingPowerMultiplier,DriveDampingMultiplier,DriveInterpSpeed,DrivePower,DriveSpeed,Duration,EndTouchSound,Entity,EntityType,Exec,ExecA,ExecB,ExecDown,ExecIn,ExecOut,ExecOutA,ExecOutB,ExecOutDown,ExitOffset,ExitOffset.X,ExitOffset.Y,ExitOffset.Z,Expired,Exponent,Face,FireRate,FireSound,FocusAzimuth,FocusCharacter,Font,FontColor,FontColor.A,FontColor.B,FontColor.G,FontColor.R,Force,ForceLimit,FormatString,From,From.X,From.Y,From.Z,Function,G,GraffitiAngleLimit,GraffitiDepthLimit,GraffitiLayer,GunSkill,HealthMultiplier,Hex,Hit,HitDistance,HitEntity,HitLocation,HitNormal,IgnoreEntity,Index,IndexA,IndexB,InnerConeAngle,InnerRadius,Input,Input.A,Input.B,Input.G,Input.Pitch,Input.R,Input.Roll,Input.W,Input.X,Input.Y,Input.Yaw,Input.Z,InputA,InputA.W,InputA.X,InputA.Y,InputA.Z,InputB,InputB.W,InputB.X,InputB.Y,InputB.Z,InputC,InputD,InputE,InputF,InputForward,InputG,InputRight,Instigator,InteractSound,InterpMode,Item,ItemNameOverride,ItemScale,ItemType,JointDistance,Jumpyness,Kerning,Key,Killer,KillerWeapon,KillerWeaponName,Left,Length,Lifetime,Limit,LimitAngle,LineHeight,LineOffset,LinearVelocity,LinearVelocity.X,LinearVelocity.Y,LinearVelocity.Z,ManualInput_Drive,ManualInput_Steer,Mass,MassOffset,MassOffset.X,MassOffset.Y,MassOffset.Z,MassSize,MassSize.X,MassSize.Y,MassSize.Z,Material,MaterialAlpha,MaterialSlider,Max,MaxDistance,MaxForce,Message,Min,Miss,MoveTarget,MoveTarget.X,MoveTarget.Y,MoveTarget.Z,MovementAmount,MovementGoalDummy,MovementRandomness,Name,NonFocusAzimuth,NonFocusVolumeAttenuation,NumberOfShots,OccupantCount,Offset,Offset.X,Offset.Y,Offset.Z,OnChanged,OnFallingEdge,OnFired,OnRisingEdge,OnTime,Origin,Origin.X,Origin.Y,Origin.Z,OuterConeAngle,Outline,OutlineColor,OutlineColor.A,OutlineColor.B,OutlineColor.G,OutlineColor.R,OutlineSize,OutlineWidth,Output,OutputB,Pause,PickupAnimationAxis,PickupAnimationPhase,PickupBobHeight,PickupBobSpeed,PickupClass,PickupMeshColors,PickupMinigameResetRespawnDelay,PickupOffsetDirection,PickupOffsetDistance,PickupRespawnTime,PickupRotation,PickupRotation.Pitch,PickupRotation.Roll,PickupRotation.Yaw,PickupScale,PickupSpinSpeed,Pitch,PitchMultiplier,Play,Player,PositionX,PositionY,Power,Prefix,PressCount,PressSound,ProceduralSize,ProceduralSize.X,ProceduralSize.Y,ProceduralSize.Z,Projectile,ProjectileClass,ProjectileOverride,PromptCustomLabel,Query,R,RER_Input,RER_Output,Radius,ReactionTime,ReleaseSound,RepeatCount,RepeatDelay,RepeatTime,RepeatVariance,Replacement,RespawnTime,Restart,Resume,Right,Roll,Rotation,Rotation.Pitch,Rotation.Roll,Rotation.W,Rotation.X,Rotation.Y,Rotation.Yaw,Rotation.Z,RoundNumber,RunSpeed,Scalar,ScaleMultiplier,ScaleX,ScaleY,ScuffWidth,Search,SecondsToWait,Separator,Shading,ShadingWidth,SittingCharacter,Size,Skew,Skin,Skin.Parts,Slot,SmoothTime,Source,SourceRef,SpawnLocation,SpawnMargin,SpawnOffset,SpawnOffset.X,SpawnOffset.Y,SpawnOffset.Z,SpawnOffsetRotation,SpawnOffsetRotation.Pitch,SpawnOffsetRotation.Roll,SpawnOffsetRotation.Yaw,SpawnVelocity,SpawnVelocity.X,SpawnVelocity.Y,SpawnVelocity.Z,SpawnedCharacter,SpawnedEntity,Speed,SpeedMultiplier,SpreadConeAngle,Start,Steer,SteerInterpSpeed,SteerLimitDegree,SteerLimitSpeedFalloff,SteerPower,SteerPowerMultiplier,Stop,Strength,Suffix,SuspensionDamping,SuspensionLength,SuspensionOffset,SuspensionStiffness,Tag,TagFilter,TankSteerSpeedMultiplier,Target,TargetAngle,TargetAxis,TargetAxis.X,TargetAxis.Y,TargetAxis.Z,TargetPosition,Team,TeamCollisionChannel,TeamName,Text,TextId,TextIdOut,ThisDestination,Throttle,TicksToWait,Time,Title,To,To.X,To.Y,To.Z,Tolerance,TopSpeed,TouchCount,Transition,Typeface,Uptime,UserId,UserName,Value,VarRef,Vector,Vector.X,Vector.Y,Vector.Z,VolumeMultiplier,W,WaterDriveForce,WaterSteeringForce,Weapon,WeaponName,WeaponNameThatJustHit,WeaponSpeedMultiplier,WeaponThatJustHit,WheelFrictionMultiplier,X,Y,Yaw,Z,ZeroSecondsToWait,ZeroTicksToWait,Zone,ZoneEndDistance,ZoneRef,ZoneStartDistance,bActiveBot,bAlignToWedge,bAllowEngineSteerCorrect,bAllowNearbyInteraction,bAnglesArePercentages,bAutoRight,bBackVision,bCanBrake,bCanJump,bCanRespawn,bCanTargetBots,bCanTargetPlayers,bCaseSensitive,bCastShadows,bCollisionEnabled,bCollisionEnabled_Interaction,bCollisionEnabled_Physics,bCollisionEnabled_Player,bCollisionEnabled_Player1,bCollisionEnabled_Player2,bCollisionEnabled_Player3,bCollisionEnabled_Weapon,bCond,bDeleteBot,bDescending,bDetectBricks,bDetectEntities,bDetectMap,bDetectPhysics,bDetectPlayers,bDetectPlayers1,bDetectPlayers2,bDetectPlayers3,bDetectPlayers4,bDetectProjectiles,bDriveWhenNotAttachedToEngine,bEnable,bEnableManualControl,bEnableRepeat,bEnabled,bFlashIfUnchanged,bFlipShading,bForeground,bFound,bFrozen,bHasPermission,bHasRole,bHeld,bHiddenInteraction,bIgnoreOwningGrid,bInput,bInputA,bInputB,bIsBuildingZone,bIsEmpty,bIsLooseZone,bIsOccupied,bIsShareZone,bIsTrusted,bJustHit,bLimitAngle,bManualInput_Brake,bMatchBrickShape,bOccupied,bOutOfBounds,bOutput,bOverrideColor,bOverrideOutlineColor,bOverridePickupColors,bPermissionEnable,bPickupAnimationAxisLocal,bPickupAnimationEnabled,bPickupAutoDisableOnPickup,bPickupEnabled,bPickupRespawnOnMinigameReset,bPinPlayerToTeam,bPinned,bPositionsArePercentages,bPressedJump,bPulseOnChange,bPulseOnFallingEdge,bPulseOnRisingEdge,bRelative,bRenderTranslucentWhenDisabled,bReversed,bRollCameraInThirdPerson,bRotatePlayerGravityOnSpawn,bSelectB,bSharpCorners,bSharpOutlines,bShowPickupEnabled,bSpatialization,bSpawnEnable,bSpawnLight,bSpreadBiasedTowardsCenter,bSteerEnabled,bStopped,bSuccess,bSuspensionEnabled,bSwap,bTankSteering,bTeamCollision,bTeamCollision1,bTeamCollision2,bTeamCollision3,bTeamWinsInstead,bTouching,bUseBrickColor,bVisibility,bVisionRaycasting,bWelded".split(","), ta = /* @__PURE__ */ new Map([["Entity_DynamicBrickGrid", "BrickGridDynamicActor"], ["Entity_MicrochipDynamicBrickGrid", "BP_MicrochipBrickGridDynamicActor_C"]]), na = new Map(Object.entries({
5332
5332
  BrickComponentType_Internal_CharacterZoneEvent_Entered: {
5333
5333
  bricks: ["B_1x1_Gate_Internal_CharacterZoneEvent_Entered"],
5334
5334
  inputs: [
@@ -8051,7 +8051,7 @@ var $i = /* @__PURE__ */ new Map([
8051
8051
  ],
8052
8052
  outputs: ["ExecOut"]
8053
8053
  }
8054
- })), ia = {
8054
+ })), ra = {
8055
8055
  CharacterZoneEvent_Entered: {
8056
8056
  NAME: "BrickComponentType_Internal_CharacterZoneEvent_Entered",
8057
8057
  BRICK: "B_1x1_Gate_Internal_CharacterZoneEvent_Entered",
@@ -11754,13 +11754,13 @@ var $i = /* @__PURE__ */ new Map([
11754
11754
  ExecOut: "ExecOut"
11755
11755
  }
11756
11756
  }
11757
- }, aa = {
11757
+ }, ia = {
11758
11758
  A: 4294967295,
11759
11759
  B: 4294967295,
11760
11760
  C: 4294967295,
11761
11761
  D: 4294967295
11762
11762
  };
11763
- function oa(e) {
11763
+ function aa(e) {
11764
11764
  let t = $n(e), n = new DataView(t.buffer, t.byteOffset, 16);
11765
11765
  return {
11766
11766
  A: n.getUint32(0, !1),
@@ -11769,124 +11769,144 @@ function oa(e) {
11769
11769
  D: n.getUint32(12, !1)
11770
11770
  };
11771
11771
  }
11772
- function sa(e) {
11772
+ function oa(e) {
11773
11773
  let t = /* @__PURE__ */ new Uint8Array(16), n = new DataView(t.buffer);
11774
11774
  return n.setUint32(0, e.A, !1), n.setUint32(4, e.B, !1), n.setUint32(8, e.C, !1), n.setUint32(12, e.D, !1), Qn(Array.from(t));
11775
11775
  }
11776
11776
  //#endregion
11777
11777
  //#region src/brdb/pending.ts
11778
- var ca = (e) => ({
11778
+ var Z = (e) => ({
11779
11779
  type: "folder",
11780
11780
  children: e
11781
- }), X = (e) => ({
11781
+ }), Q = (e) => ({
11782
11782
  type: "file",
11783
11783
  content: e
11784
- }), la = /* @__PURE__ */ t({
11785
- mpArrayHeader: () => xa,
11786
- mpBinHeader: () => ba,
11787
- mpBool: () => ma,
11788
- mpF32: () => va,
11789
- mpF64: () => ya,
11790
- mpInt: () => _a,
11791
- mpMapHeader: () => Sa,
11792
- mpNil: () => pa,
11793
- mpStr: () => Z,
11794
- mpU8: () => ha,
11795
- mpUint: () => ga,
11796
- rdArrayLen: () => Na,
11797
- rdBinLen: () => Ma,
11798
- rdBool: () => ja,
11799
- rdF32: () => ka,
11800
- rdF64: () => Aa,
11801
- rdInt: () => Da,
11802
- rdMapLen: () => Pa,
11803
- rdNil: () => Fa,
11804
- rdStr: () => Q,
11805
- rdUint: () => Oa
11806
- }), ua = new TextEncoder(), da = new TextDecoder("utf-8", { fatal: !0 }), fa = (e, t) => {
11784
+ }), sa = /* @__PURE__ */ t({
11785
+ mpArrayHeader: () => Ca,
11786
+ mpBinHeader: () => Sa,
11787
+ mpBool: () => ha,
11788
+ mpF32: () => ya,
11789
+ mpF64: () => ba,
11790
+ mpInt: () => va,
11791
+ mpMapHeader: () => wa,
11792
+ mpNil: () => ma,
11793
+ mpStr: () => xa,
11794
+ mpU8: () => ga,
11795
+ mpUint: () => _a,
11796
+ rdArrayLen: () => Ia,
11797
+ rdBinLen: () => Fa,
11798
+ rdBool: () => Na,
11799
+ rdF32: () => ja,
11800
+ rdF64: () => Ma,
11801
+ rdInt: () => ka,
11802
+ rdMapLen: () => La,
11803
+ rdNil: () => Ra,
11804
+ rdStr: () => Pa,
11805
+ rdUint: () => Aa
11806
+ }), ca = new TextEncoder(), la = new TextDecoder("utf-8", { fatal: !0 }), ua = (e, t) => {
11807
11807
  if (!Number.isSafeInteger(e)) throw RangeError(`brdb: ${t} ${e} is not a safe integer`);
11808
- }, pa = (e) => e.u8(192), ma = (e, t) => e.u8(t ? 195 : 194);
11809
- function ha(e, t) {
11808
+ }, da = -(2n ** 63n), fa = 2n ** 63n - 1n, pa = 2n ** 64n - 1n, ma = (e) => e.u8(192), ha = (e, t) => e.u8(t ? 195 : 194);
11809
+ function ga(e, t) {
11810
11810
  if (t < 0 || t > 255 || !Number.isInteger(t)) throw RangeError(`brdb: u8 value out of range: ${t}`);
11811
11811
  t <= 127 || t > 224 || e.u8(208), e.u8(t);
11812
11812
  }
11813
- function ga(e, t) {
11814
- if (fa(t, "uint"), t < 0) throw RangeError(`brdb: uint value negative: ${t}`);
11815
- t <= 127 ? e.u8(t) : t <= 255 ? (e.u8(204), e.u8(t)) : t <= 65535 ? (e.u8(205), e.u16be(t)) : t <= 4294967295 ? (e.u8(206), e.u32be(t)) : (e.u8(207), e.u64be(BigInt(t)));
11816
- }
11817
11813
  function _a(e, t) {
11818
- fa(t, "int"), t >= 0 ? t < 128 ? e.u8(t) : t <= 32767 ? (e.u8(209), e.i16be(t)) : t <= 2147483647 ? (e.u8(210), e.i32be(t)) : (e.u8(211), e.i64be(BigInt(t))) : t > -32 ? e.u8(256 + t) : t >= -128 ? (e.u8(208), e.i8(t)) : t >= -32768 ? (e.u8(209), e.i16be(t)) : t >= -2147483648 ? (e.u8(210), e.i32be(t)) : (e.u8(211), e.i64be(BigInt(t)));
11814
+ if (typeof t == "bigint") {
11815
+ if (t < 0n) throw RangeError(`brdb: uint value negative: ${t}`);
11816
+ if (t > pa) throw RangeError(`brdb: u64 value out of range: ${t}`);
11817
+ if (t > BigInt(2 ** 53 - 1)) {
11818
+ e.u8(207), e.u64be(t);
11819
+ return;
11820
+ }
11821
+ t = Number(t);
11822
+ }
11823
+ if (ua(t, "uint"), t < 0) throw RangeError(`brdb: uint value negative: ${t}`);
11824
+ t <= 127 ? e.u8(t) : t <= 255 ? (e.u8(204), e.u8(t)) : t <= 65535 ? (e.u8(205), e.u16be(t)) : t <= 4294967295 ? (e.u8(206), e.u32be(t)) : (e.u8(207), e.u64be(BigInt(t)));
11819
11825
  }
11820
11826
  function va(e, t) {
11821
- t === Math.round(t) && t < 65535 && t > -32768 ? _a(e, t === 0 ? 0 : t) : (e.u8(202), e.f32be(t));
11827
+ if (typeof t == "bigint") {
11828
+ if (t < da || t > fa) throw RangeError(`brdb: i64 value out of range: ${t}`);
11829
+ if (t > BigInt(2 ** 53 - 1) || t < BigInt(-(2 ** 53 - 1))) {
11830
+ e.u8(211), e.i64be(t);
11831
+ return;
11832
+ }
11833
+ t = Number(t);
11834
+ }
11835
+ ua(t, "int"), t >= 0 ? t < 128 ? e.u8(t) : t <= 32767 ? (e.u8(209), e.i16be(t)) : t <= 2147483647 ? (e.u8(210), e.i32be(t)) : (e.u8(211), e.i64be(BigInt(t))) : t > -32 ? e.u8(256 + t) : t >= -128 ? (e.u8(208), e.i8(t)) : t >= -32768 ? (e.u8(209), e.i16be(t)) : t >= -2147483648 ? (e.u8(210), e.i32be(t)) : (e.u8(211), e.i64be(BigInt(t)));
11822
11836
  }
11823
11837
  function ya(e, t) {
11824
- t === Math.round(t) && t < 4294967295 && t > -2147483648 ? _a(e, t === 0 ? 0 : t) : (e.u8(203), e.f64be(t));
11838
+ t === Math.round(t) && t < 65535 && t > -32768 ? va(e, t === 0 ? 0 : t) : (e.u8(202), e.f32be(t));
11825
11839
  }
11826
- function Z(e, t) {
11827
- let n = ua.encode(t), r = n.length;
11840
+ function ba(e, t) {
11841
+ t === Math.round(t) && t < 4294967295 && t > -2147483648 ? va(e, t === 0 ? 0 : t) : (e.u8(203), e.f64be(t));
11842
+ }
11843
+ function xa(e, t) {
11844
+ let n = ca.encode(t), r = n.length;
11828
11845
  r < 32 ? e.u8(160 | r) : r < 256 ? (e.u8(217), e.u8(r)) : r <= 65535 ? (e.u8(218), e.u16be(r)) : (e.u8(219), e.u32be(r)), e.bytes(n);
11829
11846
  }
11830
- function ba(e, t) {
11847
+ function Sa(e, t) {
11831
11848
  t < 256 ? (e.u8(196), e.u8(t)) : t <= 65535 ? (e.u8(197), e.u16be(t)) : (e.u8(198), e.u32be(t));
11832
11849
  }
11833
- function xa(e, t) {
11850
+ function Ca(e, t) {
11834
11851
  t < 16 ? e.u8(144 | t) : t <= 65535 ? (e.u8(220), e.u16be(t)) : (e.u8(221), e.u32be(t));
11835
11852
  }
11836
- function Sa(e, t) {
11853
+ function wa(e, t) {
11837
11854
  t < 16 ? e.u8(128 | t) : t <= 65535 ? (e.u8(222), e.u16be(t)) : (e.u8(223), e.u32be(t));
11838
11855
  }
11839
- var Ca = (e) => {
11840
- if (e > BigInt(2 ** 53 - 1) || e < BigInt(-(2 ** 53 - 1))) throw RangeError(`brdb: 64-bit value ${e} exceeds JS safe integer range`);
11856
+ var Ta = (e, t) => {
11857
+ if (e > BigInt(2 ** 53 - 1) || e < BigInt(-(2 ** 53 - 1))) {
11858
+ if (t) return e;
11859
+ throw RangeError(`brdb: 64-bit value ${e} exceeds JS safe integer range`);
11860
+ }
11841
11861
  return Number(e);
11842
- }, wa = (e, t) => {
11862
+ }, Ea = (e, t) => {
11843
11863
  throw TypeError(`brdb: unexpected marker 0x${e.toString(16)} for ${t}`);
11844
- }, Ta = (e) => (e & 128) == 0, Ea = (e) => (e & 224) == 224;
11845
- function Da(e) {
11846
- let t = e.u8();
11847
- if (Ta(t)) return t;
11848
- if (Ea(t)) return t - 256;
11849
- switch (t) {
11864
+ }, Da = (e) => (e & 128) == 0, Oa = (e) => (e & 224) == 224;
11865
+ function ka(e, t) {
11866
+ let n = e.u8();
11867
+ if (Da(n)) return n;
11868
+ if (Oa(n)) return n - 256;
11869
+ switch (n) {
11850
11870
  case 204: return e.u8();
11851
11871
  case 205: return e.u16be();
11852
11872
  case 206: return e.u32be();
11853
- case 207: return Ca(e.u64be());
11873
+ case 207: return Ta(e.u64be(), t);
11854
11874
  case 208: return e.i8();
11855
11875
  case 209: return e.i16be();
11856
11876
  case 210: return e.i32be();
11857
- case 211: return Ca(e.i64be());
11858
- default: return wa(t, "integer");
11877
+ case 211: return Ta(e.i64be(), t);
11878
+ default: return Ea(n, "integer");
11859
11879
  }
11860
11880
  }
11861
- function Oa(e) {
11862
- let t = e.u8();
11863
- if (Ta(t) || Ea(t)) return t;
11864
- switch (t) {
11881
+ function Aa(e, t) {
11882
+ let n = e.u8();
11883
+ if (Da(n) || Oa(n)) return n;
11884
+ switch (n) {
11865
11885
  case 204:
11866
11886
  case 208: return e.u8();
11867
11887
  case 205: return e.u16be();
11868
11888
  case 206: return e.u32be();
11869
- case 207: return Ca(e.u64be());
11870
- default: return wa(t, "uint");
11889
+ case 207: return Ta(e.u64be(), t);
11890
+ default: return Ea(n, "uint");
11871
11891
  }
11872
11892
  }
11873
- function ka(e) {
11893
+ function ja(e) {
11874
11894
  let t = e.u8();
11875
- if (Ta(t)) return t;
11876
- if (Ea(t)) return t - 256;
11895
+ if (Da(t)) return t;
11896
+ if (Oa(t)) return t - 256;
11877
11897
  switch (t) {
11878
11898
  case 204: return e.u8();
11879
11899
  case 205: return e.u16be();
11880
11900
  case 208: return e.i8();
11881
11901
  case 209: return e.i16be();
11882
11902
  case 202: return e.f32be();
11883
- default: return wa(t, "float32");
11903
+ default: return Ea(t, "float32");
11884
11904
  }
11885
11905
  }
11886
- function Aa(e) {
11906
+ function Ma(e) {
11887
11907
  let t = e.u8();
11888
- if (Ta(t)) return t;
11889
- if (Ea(t)) return t - 256;
11908
+ if (Da(t)) return t;
11909
+ if (Oa(t)) return t - 256;
11890
11910
  switch (t) {
11891
11911
  case 204: return e.u8();
11892
11912
  case 205: return e.u16be();
@@ -11896,47 +11916,47 @@ function Aa(e) {
11896
11916
  case 210: return e.i32be();
11897
11917
  case 202: return e.f32be();
11898
11918
  case 203: return e.f64be();
11899
- default: return wa(t, "float64");
11919
+ default: return Ea(t, "float64");
11900
11920
  }
11901
11921
  }
11902
- function ja(e) {
11922
+ function Na(e) {
11903
11923
  let t = e.u8();
11904
- return t === 195 ? !0 : t === 194 ? !1 : wa(t, "bool");
11924
+ return t === 195 ? !0 : t === 194 ? !1 : Ea(t, "bool");
11905
11925
  }
11906
- function Q(e) {
11926
+ function Pa(e) {
11907
11927
  let t = e.u8(), n;
11908
11928
  if ((t & 224) == 160) n = t & 31;
11909
11929
  else if (t === 217) n = e.u8();
11910
11930
  else if (t === 218) n = e.u16be();
11911
11931
  else if (t === 219) n = e.u32be();
11912
- else return wa(t, "str");
11913
- return da.decode(e.bytes(n));
11932
+ else return Ea(t, "str");
11933
+ return la.decode(e.bytes(n));
11914
11934
  }
11915
- function Ma(e) {
11935
+ function Fa(e) {
11916
11936
  let t = e.u8();
11917
- return t === 196 ? e.u8() : t === 197 ? e.u16be() : t === 198 ? e.u32be() : wa(t, "bin");
11937
+ return t === 196 ? e.u8() : t === 197 ? e.u16be() : t === 198 ? e.u32be() : Ea(t, "bin");
11918
11938
  }
11919
- function Na(e) {
11939
+ function Ia(e) {
11920
11940
  let t = e.u8();
11921
- return (t & 240) == 144 ? t & 15 : t === 220 ? e.u16be() : t === 221 ? e.u32be() : wa(t, "array");
11941
+ return (t & 240) == 144 ? t & 15 : t === 220 ? e.u16be() : t === 221 ? e.u32be() : Ea(t, "array");
11922
11942
  }
11923
- function Pa(e) {
11943
+ function La(e) {
11924
11944
  let t = e.u8();
11925
- return (t & 240) == 128 ? t & 15 : t === 222 ? e.u16be() : t === 223 ? e.u32be() : wa(t, "map");
11945
+ return (t & 240) == 128 ? t & 15 : t === 222 ? e.u16be() : t === 223 ? e.u32be() : Ea(t, "map");
11926
11946
  }
11927
- function Fa(e) {
11947
+ function Ra(e) {
11928
11948
  let t = e.u8();
11929
- t !== 192 && wa(t, "nil");
11949
+ t !== 192 && Ea(t, "nil");
11930
11950
  }
11931
11951
  //#endregion
11932
11952
  //#region src/brdb/schemaText.ts
11933
- var Ia = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/\/\/[^\n]*/g, " ").replace(/#[^\n]*/g, " "), La = String.raw`[A-Za-z_]\w*(?:::\w+)*`;
11934
- function Ra(e) {
11953
+ var za = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/\/\/[^\n]*/g, " ").replace(/#[^\n]*/g, " "), Ba = String.raw`[A-Za-z_]\w*(?:::\w+)*`;
11954
+ function Va(e) {
11935
11955
  let t = e.replace(/_/g, "");
11936
11956
  return t.startsWith("0b") ? parseInt(t.slice(2), 2) : t.startsWith("0x") ? parseInt(t.slice(2), 16) : parseInt(t, 10);
11937
11957
  }
11938
- function za(e) {
11939
- let t = Ia(e), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /\b(enum|variant|struct)\s+([A-Za-z0-9_]+)\s*\{([^{}]*)\}/g, o = new RegExp(String.raw`^(${La})\s*=\s*(-?\d+(?:_\d+)*|0b[01]+(?:_[01]+)*|0x[0-9a-fA-F]+(?:_[0-9a-fA-F]+)*)$`), s = new RegExp(String.raw`^${La}$`), c = new RegExp(String.raw`^(\w+)\s*:\s*(\w+)\s*(\[\s*(flat)?\s*\])?$`), l = 0, u;
11958
+ function Ha(e) {
11959
+ let t = za(e), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /\b(enum|variant|struct)\s+([A-Za-z0-9_]+)\s*\{([^{}]*)\}/g, o = new RegExp(String.raw`^(${Ba})\s*=\s*(-?\d+(?:_\d+)*|0b[01]+(?:_[01]+)*|0x[0-9a-fA-F]+(?:_[0-9a-fA-F]+)*)$`), s = new RegExp(String.raw`^${Ba}$`), c = new RegExp(String.raw`^(\w+)\s*:\s*(\w+)\s*(\[\s*(flat)?\s*\])?$`), l = 0, u;
11940
11960
  for (; u = a.exec(t);) {
11941
11961
  if (t.slice(l, u.index).trim() !== "") throw Error(`brdb: unexpected schema text before ${u[2]}`);
11942
11962
  l = a.lastIndex;
@@ -11946,7 +11966,7 @@ function za(e) {
11946
11966
  for (let t of p) {
11947
11967
  let n = o.exec(t);
11948
11968
  if (!n) throw Error(`brdb: cannot parse enum entry '${t}' in ${d}`);
11949
- e.set(n[1], Ra(n[2]));
11969
+ e.set(n[1], Va(n[2]));
11950
11970
  }
11951
11971
  n.set(d, e);
11952
11972
  } else if (e === "variant") {
@@ -11982,7 +12002,7 @@ function za(e) {
11982
12002
  }
11983
12003
  //#endregion
11984
12004
  //#region src/brdb/schemas.ts
11985
- var Ba = {
12005
+ var Ua = {
11986
12006
  BRSavedGlobalDataSoA: {
11987
12007
  enums: {},
11988
12008
  variants: {},
@@ -13629,8 +13649,8 @@ var Ba = {
13629
13649
  }
13630
13650
  }
13631
13651
  }
13632
- }, Va;
13633
- function Ha(e, t) {
13652
+ }, Wa;
13653
+ function Ga(e, t) {
13634
13654
  if (typeof e == "string") return {
13635
13655
  kind: "type",
13636
13656
  type: e
@@ -13654,18 +13674,29 @@ function Ha(e, t) {
13654
13674
  };
13655
13675
  throw Error(`brdb: invalid schema prop source at ${t}`);
13656
13676
  }
13657
- var Ua = [
13677
+ var Ka = (e) => typeof e == "object" && e && !Array.isArray(e) && typeof e.$bigint == "string" ? e : null, qa = (e) => typeof e == "bigint" ? { $bigint: e.toString() } : e;
13678
+ function Ja(e, t) {
13679
+ if (typeof e == "number" || typeof e == "bigint") return e;
13680
+ let n = Ka(e);
13681
+ if (n) try {
13682
+ return BigInt(n.$bigint);
13683
+ } catch {
13684
+ throw RangeError(`brdb: invalid $bigint payload '${n.$bigint}' for ${t}`);
13685
+ }
13686
+ throw Error(`brdb: expected an integer value for ${t}`);
13687
+ }
13688
+ var Ya = [
13658
13689
  "f64",
13659
13690
  "i64",
13660
13691
  "bool",
13661
13692
  "weak_object",
13662
13693
  "WireGraphExec"
13663
- ], Wa = ["f64", "i64"];
13664
- function Ga(e, t) {
13694
+ ], Xa = ["f64", "i64"];
13695
+ function Za(e, t) {
13665
13696
  if (typeof e == "object" && e && !Array.isArray(e) && typeof e.$variant == "string") return e;
13666
13697
  throw Error(`brdb: variant ${t} requires a { $variant, value } wrapper`);
13667
13698
  }
13668
- var Ka = {
13699
+ var Qa = {
13669
13700
  u8: 1,
13670
13701
  i8: 1,
13671
13702
  u16: 2,
@@ -13677,21 +13708,21 @@ var Ka = {
13677
13708
  i64: 8,
13678
13709
  f64: 8
13679
13710
  };
13680
- function qa(e) {
13711
+ function $a(e) {
13681
13712
  let t = e.peek();
13682
13713
  if ((t & 224) == 160 || t === 217 || t === 218) return {
13683
13714
  kind: "type",
13684
- type: Q(e)
13715
+ type: Pa(e)
13685
13716
  };
13686
13717
  if ((t & 240) == 144) {
13687
- let t = Na(e);
13718
+ let t = Ia(e);
13688
13719
  if (t === 1) return {
13689
13720
  kind: "array",
13690
- type: Q(e)
13721
+ type: Pa(e)
13691
13722
  };
13692
13723
  if (t === 2) {
13693
- let t = Q(e);
13694
- return Fa(e), {
13724
+ let t = Pa(e);
13725
+ return Ra(e), {
13695
13726
  kind: "flatarray",
13696
13727
  type: t
13697
13728
  };
@@ -13699,47 +13730,47 @@ function qa(e) {
13699
13730
  throw Error(`brdb: unsupported property array length ${t}`);
13700
13731
  }
13701
13732
  if ((t & 240) == 128) {
13702
- let t = Pa(e);
13733
+ let t = La(e);
13703
13734
  if (t !== 1) throw Error(`brdb: unsupported property map length ${t}`);
13704
13735
  return {
13705
13736
  kind: "map",
13706
- key: Q(e),
13707
- value: Q(e)
13737
+ key: Pa(e),
13738
+ value: Pa(e)
13708
13739
  };
13709
13740
  }
13710
13741
  throw Error(`brdb: unsupported property marker 0x${t.toString(16)}`);
13711
13742
  }
13712
- var Ja = class e {
13743
+ var eo = class e {
13713
13744
  constructor(e, t, n) {
13714
13745
  this.enums = e, this.variants = t, this.structs = n;
13715
13746
  }
13716
13747
  static fromText(t) {
13717
- let { enums: n, variants: r, structs: i } = za(t);
13748
+ let { enums: n, variants: r, structs: i } = Ha(t);
13718
13749
  return new e(n, r, i);
13719
13750
  }
13720
13751
  static fromData(t) {
13721
- let n = new Map(Object.entries(t.enums).map(([e, t]) => [e, new Map(Object.entries(t))])), r = new Map(Object.entries(t.variants).map(([e, t]) => [e, [...t]])), i = new Map(Object.entries(t.structs).map(([e, t]) => [e, new Map(Object.entries(t).map(([t, n]) => [t, Ha(n, `${e}.${t}`)]))]));
13752
+ let n = new Map(Object.entries(t.enums).map(([e, t]) => [e, new Map(Object.entries(t))])), r = new Map(Object.entries(t.variants).map(([e, t]) => [e, [...t]])), i = new Map(Object.entries(t.structs).map(([e, t]) => [e, new Map(Object.entries(t).map(([t, n]) => [t, Ga(n, `${e}.${t}`)]))]));
13722
13753
  return new e(n, r, i);
13723
13754
  }
13724
13755
  static fromBinary(t) {
13725
- let n = new Wi(t), r = Na(n);
13756
+ let n = new Ui(t), r = Ia(n);
13726
13757
  if (r !== 2 && r !== 3) throw Error(`brdb: invalid schema header length ${r}`);
13727
13758
  let i = /* @__PURE__ */ new Map();
13728
- for (let e = 0, t = Pa(n); e < t; e++) {
13729
- let e = Q(n), t = /* @__PURE__ */ new Map();
13730
- for (let e = 0, r = Pa(n); e < r; e++) t.set(Q(n), Da(n));
13759
+ for (let e = 0, t = La(n); e < t; e++) {
13760
+ let e = Pa(n), t = /* @__PURE__ */ new Map();
13761
+ for (let e = 0, r = La(n); e < r; e++) t.set(Pa(n), ka(n));
13731
13762
  i.set(e, t);
13732
13763
  }
13733
13764
  let a = /* @__PURE__ */ new Map();
13734
- if (r === 3) for (let e = 0, t = Pa(n); e < t; e++) {
13735
- let e = Q(n), t = [];
13736
- for (let e = 0, r = Na(n); e < r; e++) t.push(Q(n));
13765
+ if (r === 3) for (let e = 0, t = La(n); e < t; e++) {
13766
+ let e = Pa(n), t = [];
13767
+ for (let e = 0, r = Ia(n); e < r; e++) t.push(Pa(n));
13737
13768
  a.set(e, t);
13738
13769
  }
13739
13770
  let o = /* @__PURE__ */ new Map();
13740
- for (let e = 0, t = Pa(n); e < t; e++) {
13741
- let e = Q(n), t = /* @__PURE__ */ new Map();
13742
- for (let e = 0, r = Pa(n); e < r; e++) t.set(Q(n), qa(n));
13771
+ for (let e = 0, t = La(n); e < t; e++) {
13772
+ let e = Pa(n), t = /* @__PURE__ */ new Map();
13773
+ for (let e = 0, r = La(n); e < r; e++) t.set(Pa(n), $a(n));
13743
13774
  o.set(e, t);
13744
13775
  }
13745
13776
  if (n.remaining !== 0) throw Error(`brdb: ${n.remaining} trailing bytes after schema`);
@@ -13846,41 +13877,41 @@ var Ja = class e {
13846
13877
  return t;
13847
13878
  }
13848
13879
  toBinary() {
13849
- let e = new Ui();
13850
- xa(e, 3), Sa(e, this.enums.size);
13880
+ let e = new Hi();
13881
+ Ca(e, 3), wa(e, this.enums.size);
13851
13882
  for (let [t, n] of this.enums) {
13852
- Z(e, t), Sa(e, n.size);
13853
- for (let [t, r] of n) Z(e, t), _a(e, r);
13883
+ xa(e, t), wa(e, n.size);
13884
+ for (let [t, r] of n) xa(e, t), va(e, r);
13854
13885
  }
13855
- Sa(e, this.variants.size);
13886
+ wa(e, this.variants.size);
13856
13887
  for (let [t, n] of this.variants) {
13857
- Z(e, t), xa(e, n.length);
13858
- for (let t of n) Z(e, t);
13888
+ xa(e, t), Ca(e, n.length);
13889
+ for (let t of n) xa(e, t);
13859
13890
  }
13860
13891
  let t = this.topoStructOrder();
13861
- Sa(e, t.length);
13892
+ wa(e, t.length);
13862
13893
  for (let n of t) {
13863
13894
  let t = this.structs.get(n);
13864
- Z(e, n), Sa(e, t.size);
13865
- for (let [n, r] of t) switch (Z(e, n), r.kind) {
13895
+ xa(e, n), wa(e, t.size);
13896
+ for (let [n, r] of t) switch (xa(e, n), r.kind) {
13866
13897
  case "type":
13867
- Z(e, r.type);
13898
+ xa(e, r.type);
13868
13899
  break;
13869
13900
  case "array":
13870
- xa(e, 1), Z(e, r.type);
13901
+ Ca(e, 1), xa(e, r.type);
13871
13902
  break;
13872
13903
  case "flatarray":
13873
- xa(e, 2), Z(e, r.type), pa(e);
13904
+ Ca(e, 2), xa(e, r.type), ma(e);
13874
13905
  break;
13875
13906
  case "map":
13876
- Sa(e, 1), Z(e, r.key), Z(e, r.value);
13907
+ wa(e, 1), xa(e, r.key), xa(e, r.value);
13877
13908
  break;
13878
13909
  }
13879
13910
  }
13880
13911
  return e.toBytes();
13881
13912
  }
13882
13913
  flatTypeSize(e) {
13883
- let t = Ka[e];
13914
+ let t = Qa[e];
13884
13915
  if (t) return t;
13885
13916
  let n = this.structs.get(e);
13886
13917
  if (!n) return 0;
@@ -13890,36 +13921,36 @@ var Ja = class e {
13890
13921
  }
13891
13922
  writeValue(e, t, n) {
13892
13923
  switch (t) {
13893
- case "u8": return ha(e, n);
13924
+ case "u8": return ga(e, n);
13894
13925
  case "u16":
13895
13926
  case "u32":
13896
- case "u64": return ga(e, n);
13927
+ case "u64": return _a(e, Ja(n, t));
13897
13928
  case "i8":
13898
13929
  case "i16":
13899
13930
  case "i32":
13900
- case "i64": return _a(e, n);
13901
- case "f32": return va(e, n);
13902
- case "f64": return ya(e, n);
13931
+ case "i64": return va(e, Ja(n, t));
13932
+ case "f32": return ya(e, n);
13933
+ case "f64": return ba(e, n);
13903
13934
  case "str":
13904
- case "bundle_path_ref": return Z(e, n);
13905
- case "bool": return ma(e, n);
13935
+ case "bundle_path_ref": return xa(e, n);
13936
+ case "bool": return ha(e, n);
13906
13937
  case "class":
13907
13938
  case "object":
13908
- case "weak_object": return n === null ? _a(e, -1) : ga(e, n);
13939
+ case "weak_object": return n === null ? va(e, -1) : _a(e, n);
13909
13940
  case "wire_graph_variant":
13910
13941
  case "wire_graph_prim_math_variant": return this.writeLegacyWireVariant(e, t, n);
13911
13942
  }
13912
13943
  let r = this.variants.get(t);
13913
13944
  if (r) {
13914
- let i = Ga(n, t), a = r.indexOf(i.$variant);
13945
+ let i = Za(n, t), a = r.indexOf(i.$variant);
13915
13946
  if (a === -1) throw Error(`brdb: '${i.$variant}' is not a member of variant ${t}`);
13916
- return ga(e, a), this.writeVariantPayload(e, i.$variant, i.value);
13947
+ return _a(e, a), this.writeVariantPayload(e, i.$variant, i.value);
13917
13948
  }
13918
13949
  let i = this.enums.get(t);
13919
13950
  if (i) {
13920
13951
  let r = n;
13921
13952
  if (r < 0 || r >= i.size) throw RangeError(`brdb: enum ${t} ordinal ${r} out of bounds`);
13922
- return ga(e, r);
13953
+ return _a(e, r);
13923
13954
  }
13924
13955
  let a = this.structs.get(t);
13925
13956
  if (a) {
@@ -13933,17 +13964,17 @@ var Ja = class e {
13933
13964
  throw Error(`brdb: unknown type ${t}`);
13934
13965
  }
13935
13966
  writeVariantPayload(e, t, n) {
13936
- if (t === "weak_object") return _a(e, n === null ? -1 : n);
13967
+ if (t === "weak_object") return va(e, n === null ? -1 : n);
13937
13968
  this.writeValue(e, t, n);
13938
13969
  }
13939
13970
  writeLegacyWireVariant(e, t, n) {
13940
- let r = t === "wire_graph_variant" ? Ua : Wa, i = Ga(n, t), a = r.indexOf(i.$variant);
13971
+ let r = t === "wire_graph_variant" ? Ya : Xa, i = Za(n, t), a = r.indexOf(i.$variant);
13941
13972
  if (a === -1) throw Error(`brdb: '${i.$variant}' is not a member of ${t}`);
13942
- switch (ga(e, a), i.$variant) {
13943
- case "f64": return ya(e, i.value);
13944
- case "i64": return _a(e, i.value);
13945
- case "bool": return ma(e, i.value);
13946
- case "weak_object": return _a(e, i.value === null ? -1 : i.value);
13973
+ switch (_a(e, a), i.$variant) {
13974
+ case "f64": return ba(e, i.value);
13975
+ case "i64": return va(e, Ja(i.value, t));
13976
+ case "bool": return ha(e, i.value);
13977
+ case "weak_object": return va(e, i.value === null ? -1 : i.value);
13947
13978
  case "WireGraphExec": return;
13948
13979
  }
13949
13980
  }
@@ -13952,14 +13983,14 @@ var Ja = class e {
13952
13983
  case "type": return this.writeValue(e, t.type, n);
13953
13984
  case "array": {
13954
13985
  let r = n;
13955
- xa(e, r.length);
13986
+ Ca(e, r.length);
13956
13987
  for (let n of r) this.writeValue(e, t.type, n);
13957
13988
  return;
13958
13989
  }
13959
13990
  case "flatarray": {
13960
13991
  let i = n, a = this.flatTypeSize(t.type);
13961
13992
  if (a === 0) throw Error(`brdb: invalid flat type ${t.type} at ${r}`);
13962
- ba(e, i.length * a);
13993
+ Sa(e, i.length * a);
13963
13994
  for (let n of i) this.writeFlat(e, t.type, n, r);
13964
13995
  return;
13965
13996
  }
@@ -13976,8 +14007,8 @@ var Ja = class e {
13976
14007
  case "i32": return e.i32le(n);
13977
14008
  case "f32": return e.f32le(n);
13978
14009
  case "f64": return e.f64le(n);
13979
- case "u64": return e.u64le(BigInt(n));
13980
- case "i64": return e.i64le(BigInt(n));
14010
+ case "u64": return e.u64le(BigInt(Ja(n, r)));
14011
+ case "i64": return e.i64le(BigInt(Ja(n, r)));
13981
14012
  }
13982
14013
  let i = this.structs.get(t);
13983
14014
  if (!i) throw Error(`brdb: invalid flat type ${t} at ${r}`);
@@ -13993,21 +14024,21 @@ var Ja = class e {
13993
14024
  switch (n) {
13994
14025
  case "u8":
13995
14026
  case "u16":
13996
- case "u32":
13997
- case "u64": return Oa(t);
14027
+ case "u32": return Aa(t);
14028
+ case "u64": return qa(Aa(t, !0));
13998
14029
  case "i8":
13999
14030
  case "i16":
14000
- case "i32":
14001
- case "i64": return Da(t);
14002
- case "f32": return ka(t);
14003
- case "f64": return Aa(t);
14031
+ case "i32": return ka(t);
14032
+ case "i64": return qa(ka(t, !0));
14033
+ case "f32": return ja(t);
14034
+ case "f64": return Ma(t);
14004
14035
  case "str":
14005
- case "bundle_path_ref": return Q(t);
14006
- case "bool": return ja(t);
14036
+ case "bundle_path_ref": return Pa(t);
14037
+ case "bool": return Na(t);
14007
14038
  case "class":
14008
14039
  case "object":
14009
14040
  case "weak_object": {
14010
- let e = Da(t);
14041
+ let e = ka(t);
14011
14042
  return e < 0 ? null : e;
14012
14043
  }
14013
14044
  case "wire_graph_variant":
@@ -14015,7 +14046,7 @@ var Ja = class e {
14015
14046
  }
14016
14047
  let i = this.variants.get(n);
14017
14048
  if (i) {
14018
- let e = Oa(t), a = i[e];
14049
+ let e = Aa(t), a = i[e];
14019
14050
  if (a === void 0) throw Error(`brdb: unknown tag ${e} for variant ${n}`);
14020
14051
  return {
14021
14052
  $variant: a,
@@ -14024,7 +14055,7 @@ var Ja = class e {
14024
14055
  }
14025
14056
  let a = this.enums.get(n);
14026
14057
  if (a) {
14027
- let e = Oa(t);
14058
+ let e = Aa(t);
14028
14059
  if (e >= a.size) throw RangeError(`brdb: enum ${n} ordinal ${e} out of bounds`);
14029
14060
  return e;
14030
14061
  }
@@ -14037,22 +14068,22 @@ var Ja = class e {
14037
14068
  throw Error(`brdb: unknown type ${n}`);
14038
14069
  }
14039
14070
  readLegacyWireVariant(e, t) {
14040
- let n = t === "wire_graph_variant" ? Ua : Wa, r = Oa(e), i = n[r];
14071
+ let n = t === "wire_graph_variant" ? Ya : Xa, r = Aa(e), i = n[r];
14041
14072
  switch (i) {
14042
14073
  case "f64": return {
14043
14074
  $variant: i,
14044
- value: Aa(e)
14075
+ value: Ma(e)
14045
14076
  };
14046
14077
  case "i64": return {
14047
14078
  $variant: i,
14048
- value: Da(e)
14079
+ value: qa(ka(e, !0))
14049
14080
  };
14050
14081
  case "bool": return {
14051
14082
  $variant: i,
14052
- value: ja(e)
14083
+ value: Na(e)
14053
14084
  };
14054
14085
  case "weak_object": {
14055
- let t = Da(e);
14086
+ let t = ka(e);
14056
14087
  return {
14057
14088
  $variant: i,
14058
14089
  value: t < 0 ? null : t
@@ -14069,12 +14100,12 @@ var Ja = class e {
14069
14100
  switch (t.kind) {
14070
14101
  case "type": return this.readValue(e, t.type, r);
14071
14102
  case "array": {
14072
- let n = Na(e), i = [];
14103
+ let n = Ia(e), i = [];
14073
14104
  for (let a = 0; a < n; a++) i.push(this.readValue(e, t.type, r));
14074
14105
  return i;
14075
14106
  }
14076
14107
  case "flatarray": {
14077
- let r = Ma(e), i = this.flatTypeSize(t.type);
14108
+ let r = Fa(e), i = this.flatTypeSize(t.type);
14078
14109
  if (i === 0) throw Error(`brdb: invalid flat type ${t.type} at ${n}`);
14079
14110
  if (r % i !== 0) throw Error(`brdb: flat data length ${r} not divisible by ${i} (${n})`);
14080
14111
  let a = [];
@@ -14097,8 +14128,7 @@ var Ja = class e {
14097
14128
  case "u64":
14098
14129
  case "i64": {
14099
14130
  let n = t === "u64" ? e.u64le() : e.i64le();
14100
- if (n > BigInt(2 ** 53 - 1) || n < BigInt(-(2 ** 53 - 1))) throw RangeError(`brdb: flat 64-bit value ${n} exceeds JS safe range`);
14101
- return Number(n);
14131
+ return n > BigInt(2 ** 53 - 1) || n < BigInt(-(2 ** 53 - 1)) ? { $bigint: n.toString() } : Number(n);
14102
14132
  }
14103
14133
  }
14104
14134
  let r = this.structs.get(t);
@@ -14111,35 +14141,35 @@ var Ja = class e {
14111
14141
  return i;
14112
14142
  }
14113
14143
  encode(e, t) {
14114
- let n = new Ui();
14144
+ let n = new Hi();
14115
14145
  return this.writeValue(n, e, t), n.toBytes();
14116
14146
  }
14117
14147
  decode(e, t) {
14118
- let n = new Wi(e), r = this.readValue(n, t);
14148
+ let n = new Ui(e), r = this.readValue(n, t);
14119
14149
  if (n.remaining !== 0) throw Error(`brdb: ${n.remaining} trailing bytes after ${t}`);
14120
14150
  return r;
14121
14151
  }
14122
14152
  };
14123
- Va = Ja, Va.MAX_DECODE_DEPTH = 64;
14124
- var Ya = /* @__PURE__ */ new Map();
14125
- function Xa(e) {
14126
- let t = Ya.get(e);
14127
- return t || (t = Ja.fromData(Ba[e]), Ya.set(e, t)), t;
14153
+ Wa = eo, Wa.MAX_DECODE_DEPTH = 64;
14154
+ var to = /* @__PURE__ */ new Map();
14155
+ function no(e) {
14156
+ let t = to.get(e);
14157
+ return t || (t = eo.fromData(Ua[e]), to.set(e, t)), t;
14128
14158
  }
14129
14159
  //#endregion
14130
14160
  //#region src/brdb/world.ts
14131
- var Za = 2048, Qa = 1024, $a = (e, t) => Math.floor(e / t), eo = (e, t) => (e % t + t) % t;
14132
- function to(e) {
14161
+ var ro = 2048, io = 1024, ao = (e, t) => Math.floor(e / t), oo = (e, t) => (e % t + t) % t;
14162
+ function so(e) {
14133
14163
  return {
14134
- chunk: e.map((e) => $a(e, Za)),
14135
- rel: e.map((e) => eo(e, Za) - Qa)
14164
+ chunk: e.map((e) => ao(e, ro)),
14165
+ rel: e.map((e) => oo(e, ro) - io)
14136
14166
  };
14137
14167
  }
14138
- function no(e) {
14168
+ function co(e) {
14139
14169
  let t = e.brick_assets ?? ["PB_DefaultBrick"], n = e.materials ?? ["BMC_Plastic"], r = e.brick_owners?.length ?? 0;
14140
14170
  return e.bricks.map((i, a) => {
14141
14171
  let o = `bricks[${a}]`, s = (Array.isArray(i.components) ? i.components : []).map((e, t) => {
14142
- if (!$i.has(e.type)) throw Error(`brdb: ${o}.components[${t}]: unknown component type '${e.type}'`);
14172
+ if (!Qi.has(e.type)) throw Error(`brdb: ${o}.components[${t}]: unknown component type '${e.type}'`);
14143
14173
  return e;
14144
14174
  }), c = t[i.asset_name_index ?? 0];
14145
14175
  if (c === void 0) throw Error(`brdb: ${o}: asset_name_index ${i.asset_name_index} out of range`);
@@ -14149,7 +14179,7 @@ function no(e) {
14149
14179
  if (!Number.isSafeInteger(e)) throw Error(`brdb: ${o}: position must be integers, got ${i.position}`);
14150
14180
  if (!(e >= -32768 * 2048 && e <= 32768 * 2048 - 1)) throw Error(`brdb: ${o}: position ${e} outside the i16 chunk range`);
14151
14181
  return e;
14152
- }), d = Qi(c);
14182
+ }), d = Zi(c);
14153
14183
  if (i.size === void 0 && d) throw Error(`brdb: ${o}: procedural asset ${c} requires a size`);
14154
14184
  let f = (i.size ?? [
14155
14185
  0,
@@ -14219,7 +14249,7 @@ function no(e) {
14219
14249
  };
14220
14250
  });
14221
14251
  }
14222
- var ro = class {
14252
+ var lo = class {
14223
14253
  constructor() {
14224
14254
  this.map = /* @__PURE__ */ new Map();
14225
14255
  }
@@ -14241,9 +14271,9 @@ var ro = class {
14241
14271
  get size() {
14242
14272
  return this.map.size;
14243
14273
  }
14244
- }, io = class {
14274
+ }, uo = class {
14245
14275
  constructor() {
14246
- this.sizeCounters = [], this.sizes = [], this.typeIndices = [], this.ownerIndices = [], this.originalOwnerIndices = [], this.relPositions = [], this.orientations = [], this.colPlayer = new hi(), this.colPlayer1 = new hi(), this.colPlayer2 = new hi(), this.colPlayer3 = new hi(), this.colWeapon = new hi(), this.colInteraction = new hi(), this.colPhysics = new hi(), this.visibility = new hi(), this.materialIndices = [], this.colors = [], this.sizeIndexMap = /* @__PURE__ */ new Map(), this.numBrickSizes = 0, this.numBricks = 0;
14276
+ this.sizeCounters = [], this.sizes = [], this.typeIndices = [], this.ownerIndices = [], this.originalOwnerIndices = [], this.relPositions = [], this.orientations = [], this.colPlayer = new mi(), this.colPlayer1 = new mi(), this.colPlayer2 = new mi(), this.colPlayer3 = new mi(), this.colWeapon = new mi(), this.colInteraction = new mi(), this.colPhysics = new mi(), this.visibility = new mi(), this.materialIndices = [], this.colors = [], this.sizeIndexMap = /* @__PURE__ */ new Map(), this.numBrickSizes = 0, this.numBricks = 0;
14247
14277
  }
14248
14278
  addBrick(e, t, n, r) {
14249
14279
  let i;
@@ -14298,7 +14328,7 @@ var ro = class {
14298
14328
  bColorsAreLinear: !1
14299
14329
  };
14300
14330
  }
14301
- }, ao = class {
14331
+ }, fo = class {
14302
14332
  constructor() {
14303
14333
  this.counters = [], this.brickIndices = [], this.trailing = [], this.microchipBrickIndices = [], this.microchipGridReferences = [], this.numComponents = 0;
14304
14334
  }
@@ -14316,7 +14346,7 @@ var ro = class {
14316
14346
  this.microchipBrickIndices.push(e), this.microchipGridReferences.push(t);
14317
14347
  }
14318
14348
  toBytes(e) {
14319
- let t = new Ui();
14349
+ let t = new Hi();
14320
14350
  e.writeValue(t, "BRSavedComponentChunkSoA", {
14321
14351
  ComponentTypeCounters: this.counters,
14322
14352
  ComponentBrickIndices: this.brickIndices,
@@ -14327,33 +14357,33 @@ var ro = class {
14327
14357
  MicrochipBrickIndices: this.microchipBrickIndices,
14328
14358
  MicrochipBrickGridReferences: this.microchipGridReferences
14329
14359
  });
14330
- for (let n of this.trailing) e.writeValue(t, n.structName, e.fillStruct(n.structName, n.data, ea.get(n.structName)));
14360
+ for (let n of this.trailing) e.writeValue(t, n.structName, e.fillStruct(n.structName, n.data, $i.get(n.structName)));
14331
14361
  return t.toBytes();
14332
14362
  }
14333
14363
  };
14334
- function oo(e) {
14364
+ function po(e) {
14335
14365
  let t = [{
14336
- guid: aa,
14366
+ guid: ia,
14337
14367
  name: "PUBLIC",
14338
14368
  display: "PUBLIC"
14339
14369
  }];
14340
14370
  for (let n of e ?? []) t.push({
14341
- guid: oa(n.id ?? "00000000-0000-0000-0000-000000000000"),
14371
+ guid: aa(n.id ?? "00000000-0000-0000-0000-000000000000"),
14342
14372
  name: n.name ?? "Unknown",
14343
14373
  display: n.display_name ?? n.name ?? "Unknown"
14344
14374
  });
14345
14375
  return t;
14346
14376
  }
14347
- function so(e, t = {}) {
14348
- let n = no(e), r = (e.wires ?? []).filter((e) => "component_type" in e.source);
14349
- return co({
14377
+ function mo(e, t = {}) {
14378
+ let n = co(e), r = (e.wires ?? []).filter((e) => "component_type" in e.source);
14379
+ return ho({
14350
14380
  description: e.description,
14351
14381
  author: e.author?.name ? {
14352
14382
  id: e.author.id,
14353
14383
  name: e.author.name
14354
14384
  } : void 0,
14355
14385
  prefabs: [],
14356
- ownerRows: oo(e.brick_owners),
14386
+ ownerRows: po(e.brick_owners),
14357
14387
  grids: [n],
14358
14388
  gridIds: [1],
14359
14389
  entities: [],
@@ -14375,20 +14405,20 @@ function so(e, t = {}) {
14375
14405
  prefab: null
14376
14406
  }, t);
14377
14407
  }
14378
- function co(e, t = {}) {
14379
- let n = e.grids.flat(), r = new ro(), i = new ro(), o = new ro();
14408
+ function ho(e, t = {}) {
14409
+ let n = e.grids.flat(), r = new lo(), i = new lo(), o = new lo();
14380
14410
  for (let e of n) r.add(e.materialName), (e.procedural ? o : i).add(e.assetName);
14381
14411
  if (r.size > 256) throw Error(`brdb: too many distinct materials (${r.size}); MaterialIndices is u8 (max 256)`);
14382
14412
  let s = {
14383
14413
  materials: r,
14384
14414
  basic: i,
14385
14415
  procedural: o
14386
- }, c = i.size, l = new ro(), u = [];
14416
+ }, c = i.size, l = new lo(), u = [];
14387
14417
  for (let e of n) for (let t of e.components) {
14388
14418
  let e = l.size;
14389
- l.add(t.type) === e && u.push($i.get(t.type));
14419
+ l.add(t.type) === e && u.push(Qi.get(t.type));
14390
14420
  }
14391
- let d = new ro();
14421
+ let d = new lo();
14392
14422
  e.wires.forEach((t, n) => {
14393
14423
  for (let [r, i] of [["source", t.source], ["target", t.target]]) {
14394
14424
  let t = e.grids[i.gridSlot]?.length ?? 0;
@@ -14397,16 +14427,16 @@ function co(e, t = {}) {
14397
14427
  d.add(i.port);
14398
14428
  }
14399
14429
  });
14400
- let f = new ro(), p = [];
14430
+ let f = new lo(), p = [];
14401
14431
  for (let t of e.entities) {
14402
14432
  let e = f.size;
14403
14433
  f.add(t.type) === e && p.push(t.className);
14404
14434
  }
14405
- let m = Ja.fromData(Ba.BRSavedComponentChunkSoA);
14435
+ let m = eo.fromData(Ua.BRSavedComponentChunkSoA);
14406
14436
  if (l.size > 0) {
14407
14437
  let e = [];
14408
14438
  for (let t of u) t !== "None" && !e.includes(t) && e.push(t);
14409
- m.merge(Xa("BRSavedComponentChunkSoA_max").extractStructsTransitive(e));
14439
+ m.merge(no("BRSavedComponentChunkSoA_max").extractStructsTransitive(e));
14410
14440
  }
14411
14441
  let h = e.ownerRows, g = h.map(() => 0), _ = h.map(() => 0), v = h.map(() => 0);
14412
14442
  for (let t of e.entities) v[t.ownerIndex] += 1;
@@ -14420,10 +14450,10 @@ function co(e, t = {}) {
14420
14450
  chunkWireCounts: /* @__PURE__ */ new Map()
14421
14451
  };
14422
14452
  for (let n of e) {
14423
- let { chunk: e, rel: r } = to(n.position), i = e.join("_"), a = t.chunks.get(i);
14453
+ let { chunk: e, rel: r } = so(n.position), i = e.join("_"), a = t.chunks.get(i);
14424
14454
  a || (a = {
14425
14455
  index: e,
14426
- builder: new io()
14456
+ builder: new uo()
14427
14457
  }, t.chunks.set(i, a), t.chunkOrder.push(i));
14428
14458
  let o = a.builder.numBricks;
14429
14459
  if (a.builder.addBrick(n, r, s, c), t.brickLocations.push({
@@ -14433,7 +14463,7 @@ function co(e, t = {}) {
14433
14463
  }), g[n.ownerIndex] += 1, n.components.length > 0) {
14434
14464
  _[n.ownerIndex] += n.components.length;
14435
14465
  let e = t.componentChunks.get(i);
14436
- e || t.componentChunks.set(i, e = new ao());
14466
+ e || t.componentChunks.set(i, e = new fo());
14437
14467
  for (let t of n.components) {
14438
14468
  let n = l.indexOf(t.type);
14439
14469
  e.add(n, o, u[n], t.data ?? {});
@@ -14446,7 +14476,7 @@ function co(e, t = {}) {
14446
14476
  let e = y[t.gridSlot], n = e?.brickLocations[t.brickIndex];
14447
14477
  if (!n) throw Error(`brdb: microchip link brick index ${t.brickIndex} out of range`);
14448
14478
  let r = e.componentChunks.get(n.key);
14449
- r || e.componentChunks.set(n.key, r = new ao()), r.addMicrochipLink(n.localIndex, t.gridReference);
14479
+ r || e.componentChunks.set(n.key, r = new fo()), r.addMicrochipLink(n.localIndex, t.gridReference);
14450
14480
  }
14451
14481
  for (let t of e.wires) {
14452
14482
  let n = y[t.source.gridSlot].brickLocations[t.source.brickIndex], r = y[t.target.gridSlot], i = r.brickLocations[t.target.brickIndex], a = {
@@ -14475,7 +14505,7 @@ function co(e, t = {}) {
14475
14505
  PortIndex: d.indexOf(t.source.port)
14476
14506
  }), o.remoteTargets.push(a));
14477
14507
  }
14478
- let b = Xa("BRSavedGlobalDataSoA"), x = Xa("BRSavedOwnerTableSoA"), S = Xa("BRSavedBrickChunkIndexSoA"), C = Xa("BRSavedBrickChunkSoA"), w = Xa("BRSavedWireChunkSoA"), T = Xa("BRSavedEntityChunkIndexSoA"), E = Xa("BRSavedEntityChunkSoA"), D = b.encode("BRSavedGlobalDataSoA", {
14508
+ let b = no("BRSavedGlobalDataSoA"), x = no("BRSavedOwnerTableSoA"), S = no("BRSavedBrickChunkIndexSoA"), C = no("BRSavedBrickChunkSoA"), w = no("BRSavedWireChunkSoA"), T = no("BRSavedEntityChunkIndexSoA"), E = no("BRSavedEntityChunkSoA"), D = b.encode("BRSavedGlobalDataSoA", {
14479
14509
  EntityTypeNames: f.names,
14480
14510
  EntityDataClassNames: p,
14481
14511
  BasicBrickAssetNames: i.names,
@@ -14509,7 +14539,7 @@ function co(e, t = {}) {
14509
14539
  NumEntities: k ? [k] : []
14510
14540
  }), j = null;
14511
14541
  if (k > 0) {
14512
- let t = [], n = new hi(), r = new hi();
14542
+ let t = [], n = new mi(), r = new mi();
14513
14543
  for (let i of e.entities) {
14514
14544
  let e = f.indexOf(i.type), a = t[t.length - 1];
14515
14545
  a && a.TypeIndex === e ? a.NumEntities += 1 : t.push({
@@ -14517,7 +14547,7 @@ function co(e, t = {}) {
14517
14547
  NumEntities: 1
14518
14548
  }), n.push(i.frozen), r.push(i.sleeping);
14519
14549
  }
14520
- let i = new Ui();
14550
+ let i = new Hi();
14521
14551
  E.writeValue(i, "BRSavedEntityChunkSoA", {
14522
14552
  TypeCounters: t,
14523
14553
  PersistentIndices: e.entities.map((e, t) => 2 + t),
@@ -14559,7 +14589,7 @@ function co(e, t = {}) {
14559
14589
  gameVersion: "CL0",
14560
14590
  ...t.bundle
14561
14591
  }, te = (e, t) => {
14562
- let n = t ? 0 : Qa, r = [["ChunkIndex.mps", X(S.encode("BRSavedBrickChunkIndexSoA", {
14592
+ let n = t ? 0 : io, r = [["ChunkIndex.mps", Q(S.encode("BRSavedBrickChunkIndexSoA", {
14563
14593
  Chunk3DIndices: e.chunkOrder.map((t) => {
14564
14594
  let [n, r, i] = e.chunks.get(t).index;
14565
14595
  return {
@@ -14573,14 +14603,14 @@ function co(e, t = {}) {
14573
14603
  Y: n,
14574
14604
  Z: n
14575
14605
  })),
14576
- ChunkSizes: e.chunkOrder.map(() => Za),
14606
+ ChunkSizes: e.chunkOrder.map(() => ro),
14577
14607
  NumBricks: e.chunkOrder.map((t) => e.chunks.get(t).builder.numBricks),
14578
14608
  NumComponents: e.chunkOrder.map((t) => e.componentChunks.get(t)?.numComponents ?? 0),
14579
14609
  NumWires: e.chunkOrder.map((t) => e.chunkWireCounts.get(t) ?? 0)
14580
14610
  }))]];
14581
- return e.chunkOrder.length > 0 && r.push(["Chunks", ca(e.chunkOrder.map((t) => [`${t}.mps`, X(C.encode("BRSavedBrickChunkSoA", e.chunks.get(t).builder.toValue(c)))]))]), e.componentChunks.size > 0 && r.push(["Components", ca(e.chunkOrder.filter((t) => e.componentChunks.has(t)).map((t) => [`${t}.mps`, X(e.componentChunks.get(t).toBytes(m))]))]), e.wireChunks.size > 0 && r.push(["Wires", ca(e.chunkOrder.filter((t) => e.wireChunks.has(t)).map((t) => {
14611
+ return e.chunkOrder.length > 0 && r.push(["Chunks", Z(e.chunkOrder.map((t) => [`${t}.mps`, Q(C.encode("BRSavedBrickChunkSoA", e.chunks.get(t).builder.toValue(c)))]))]), e.componentChunks.size > 0 && r.push(["Components", Z(e.chunkOrder.filter((t) => e.componentChunks.has(t)).map((t) => [`${t}.mps`, Q(e.componentChunks.get(t).toBytes(m))]))]), e.wireChunks.size > 0 && r.push(["Wires", Z(e.chunkOrder.filter((t) => e.wireChunks.has(t)).map((t) => {
14582
14612
  let n = e.wireChunks.get(t);
14583
- return [`${t}.mps`, X(w.encode("BRSavedWireChunkSoA", {
14613
+ return [`${t}.mps`, Q(w.encode("BRSavedWireChunkSoA", {
14584
14614
  RemoteWireSources: n.remoteSources,
14585
14615
  LocalWireSources: n.localSources,
14586
14616
  RemoteWireTargets: n.remoteTargets,
@@ -14588,40 +14618,40 @@ function co(e, t = {}) {
14588
14618
  PendingPropagationFlags: { Flags: [] }
14589
14619
  }))];
14590
14620
  }))]), r;
14591
- }, ne = [["Bundle.json", X(M.encode(JSON.stringify(ee)))]];
14592
- e.prefab ? (ne.push(["Prefab.json", X(M.encode(mo(e.prefab)))]), t.thumbnail && ne.push(["Thumbnail.png", X(t.thumbnail)])) : (t.thumbnail && ne.push(["Thumbnail.png", X(t.thumbnail)]), ne.push(["World.json", X(M.encode(JSON.stringify({ environment: t.environment ?? "Plate" })))]));
14621
+ }, ne = [["Bundle.json", Q(M.encode(JSON.stringify(ee)))]];
14622
+ e.prefab ? (ne.push(["Prefab.json", Q(M.encode(bo(e.prefab)))]), t.thumbnail && ne.push(["Thumbnail.png", Q(t.thumbnail)])) : (t.thumbnail && ne.push(["Thumbnail.png", Q(t.thumbnail)]), ne.push(["World.json", Q(M.encode(JSON.stringify({ environment: t.environment ?? "Plate" })))]));
14593
14623
  let N = [
14594
- ["ChunkIndex.schema", X(T.toBinary())],
14595
- ["ChunkIndex.mps", X(A)],
14596
- ["ChunksShared.schema", X(E.toBinary())]
14624
+ ["ChunkIndex.schema", Q(T.toBinary())],
14625
+ ["ChunkIndex.mps", Q(A)],
14626
+ ["ChunksShared.schema", Q(E.toBinary())]
14597
14627
  ];
14598
- j && N.push(["Chunks", ca([["0_0_0.mps", X(j)]])]);
14599
- let re = [["Meta", ca(ne)], ["World", ca([["0", ca([
14600
- ["GlobalData.schema", X(b.toBinary())],
14601
- ["GlobalData.mps", X(D)],
14602
- ["Owners.schema", X(x.toBinary())],
14603
- ["Owners.mps", X(O)],
14604
- ["Bricks", ca([
14605
- ["ChunkIndexShared.schema", X(S.toBinary())],
14606
- ["ChunksShared.schema", X(C.toBinary())],
14607
- ["WiresShared.schema", X(w.toBinary())],
14608
- ["ComponentsShared.schema", X(m.toBinary())],
14609
- ["Grids", ca(y.map((t, n) => [String(e.gridIds[n]), ca(te(t, e.gridIds[n] === 1))]))]
14628
+ j && N.push(["Chunks", Z([["0_0_0.mps", Q(j)]])]);
14629
+ let re = [["Meta", Z(ne)], ["World", Z([["0", Z([
14630
+ ["GlobalData.schema", Q(b.toBinary())],
14631
+ ["GlobalData.mps", Q(D)],
14632
+ ["Owners.schema", Q(x.toBinary())],
14633
+ ["Owners.mps", Q(O)],
14634
+ ["Bricks", Z([
14635
+ ["ChunkIndexShared.schema", Q(S.toBinary())],
14636
+ ["ChunksShared.schema", Q(C.toBinary())],
14637
+ ["WiresShared.schema", Q(w.toBinary())],
14638
+ ["ComponentsShared.schema", Q(m.toBinary())],
14639
+ ["Grids", Z(y.map((t, n) => [String(e.gridIds[n]), Z(te(t, e.gridIds[n] === 1))]))]
14610
14640
  ])],
14611
- ["Entities", ca(N)]
14641
+ ["Entities", Z(N)]
14612
14642
  ])]])]];
14613
14643
  if (e.prefabs.length > 0) for (let [t, n] of e.prefabs) {
14614
14644
  let e = t.split("/"), r = re;
14615
14645
  for (let t = 0; t < e.length - 1; t++) {
14616
14646
  let n = r.find(([n, r]) => n === e[t] && r.type === "folder");
14617
- n || (n = [e[t], ca([])], r.push(n)), r = n[1].children;
14647
+ n || (n = [e[t], Z([])], r.push(n)), r = n[1].children;
14618
14648
  }
14619
- r.push([e[e.length - 1], X(n)]);
14649
+ r.push([e[e.length - 1], Q(n)]);
14620
14650
  }
14621
14651
  return re;
14622
14652
  }
14623
- function lo(e, t, n) {
14624
- let r = e.type ?? "Entity_DynamicBrickGrid", i = na.get(r);
14653
+ function go(e, t, n) {
14654
+ let r = e.type ?? "Entity_DynamicBrickGrid", i = ta.get(r);
14625
14655
  if (i === void 0) throw Error(`brdb: entities[${t}]: unknown entity type '${r}'`);
14626
14656
  let a = e.owner_index ?? 0;
14627
14657
  if (!Number.isInteger(a) || a < 0 || a > n) throw Error(`brdb: entities[${t}]: owner_index ${a} out of range (0..${n})`);
@@ -14664,22 +14694,22 @@ function lo(e, t, n) {
14664
14694
  data: e.data ?? {}
14665
14695
  };
14666
14696
  }
14667
- var uo = "@@f64:", fo = class {
14697
+ var _o = "@@f64:", vo = class {
14668
14698
  constructor(e) {
14669
14699
  this.value = e;
14670
14700
  }
14671
14701
  toJSON() {
14672
- return `${uo}${this.value}`;
14702
+ return `${_o}${this.value}`;
14673
14703
  }
14674
- }, po = (e, t, n) => ({
14675
- x: new fo(e),
14676
- y: new fo(t),
14677
- z: new fo(n)
14704
+ }, yo = (e, t, n) => ({
14705
+ x: new vo(e),
14706
+ y: new vo(t),
14707
+ z: new vo(n)
14678
14708
  });
14679
- function mo(e) {
14680
- return JSON.stringify(e).replace(RegExp(`"${uo}(-?[\\d.eE+-]+)"`, "g"), (e, t) => Number.isInteger(Number(t)) ? `${t}.0` : t);
14709
+ function bo(e) {
14710
+ return JSON.stringify(e).replace(RegExp(`"${_o}(-?[\\d.eE+-]+)"`, "g"), (e, t) => Number.isInteger(Number(t)) ? `${t}.0` : t);
14681
14711
  }
14682
- function ho(e, t) {
14712
+ function xo(e, t) {
14683
14713
  let n = [
14684
14714
  0,
14685
14715
  0,
@@ -14705,8 +14735,8 @@ function ho(e, t) {
14705
14735
  }
14706
14736
  });
14707
14737
  let i = {
14708
- center: po((n[0] + r[0]) / 2, (n[1] + r[1]) / 2, (n[2] + r[2]) / 2),
14709
- halfExtent: po((r[0] - n[0]) / 2, (r[1] - n[1]) / 2, (r[2] - n[2]) / 2)
14738
+ center: yo((n[0] + r[0]) / 2, (n[1] + r[1]) / 2, (n[2] + r[2]) / 2),
14739
+ halfExtent: yo((r[0] - n[0]) / 2, (r[1] - n[1]) / 2, (r[2] - n[2]) / 2)
14710
14740
  };
14711
14741
  return {
14712
14742
  pivots: {
@@ -14730,7 +14760,7 @@ function ho(e, t) {
14730
14760
  bIsMicrochipPrefab: t.isMicrochipPrefab ?? !1
14731
14761
  };
14732
14762
  }
14733
- var go = class {
14763
+ var So = class {
14734
14764
  constructor() {
14735
14765
  this.gridBrickInputs = [[]], this.gridEntityOrders = [], this.entityInputs = [], this.wireList = [], this.chipLinks = [], this.ownerList = [], this.prefabOptions = null, this.prefabList = [];
14736
14766
  }
@@ -14810,13 +14840,13 @@ var go = class {
14810
14840
  this.prefabOptions = e;
14811
14841
  }
14812
14842
  addPrefab(e) {
14813
- let t = `Prefabs/Uploads/${$r(pi(e)).toUpperCase()}.brz`;
14843
+ let t = `Prefabs/Uploads/${Qr(fi(e)).toUpperCase()}.brz`;
14814
14844
  return this.prefabList.some(([e]) => e === t) || this.prefabList.push([t, e]), t;
14815
14845
  }
14816
14846
  toPendingFs(e = {}) {
14817
- let t = new ro(), n = new ro();
14847
+ let t = new lo(), n = new lo();
14818
14848
  for (let e of this.gridBrickInputs) for (let r of e) t.add(r.asset ?? "PB_DefaultBrick"), n.add(r.material ?? "BMC_Plastic");
14819
- let r = this.gridBrickInputs.map((e, r) => no({
14849
+ let r = this.gridBrickInputs.map((e, r) => co({
14820
14850
  brick_assets: t.names,
14821
14851
  materials: n.names,
14822
14852
  brick_owners: this.ownerList,
@@ -14829,16 +14859,16 @@ var go = class {
14829
14859
  5,
14830
14860
  6
14831
14861
  ] : void 0),
14832
- position: r === 0 ? e.position : e.position.map((e) => e - Qa),
14862
+ position: r === 0 ? e.position : e.position.map((e) => e - io),
14833
14863
  color: e.color ?? [
14834
14864
  255,
14835
14865
  255,
14836
14866
  255
14837
14867
  ]
14838
14868
  }))
14839
- })), i = this.entityInputs.map((e, t) => lo(e, t, this.ownerList.length)), a = [1, ...this.gridEntityOrders.map((e) => 2 + e)];
14840
- return co({
14841
- ownerRows: oo(this.ownerList),
14869
+ })), i = this.entityInputs.map((e, t) => go(e, t, this.ownerList.length)), a = [1, ...this.gridEntityOrders.map((e) => 2 + e)];
14870
+ return ho({
14871
+ ownerRows: po(this.ownerList),
14842
14872
  grids: r,
14843
14873
  gridIds: a,
14844
14874
  entities: i,
@@ -14861,36 +14891,36 @@ var go = class {
14861
14891
  brickIndex: e.brick.index,
14862
14892
  gridReference: 2 + e.grid.entityOrder
14863
14893
  })),
14864
- prefab: this.prefabOptions ? ho(r[0], this.prefabOptions) : null,
14894
+ prefab: this.prefabOptions ? xo(r[0], this.prefabOptions) : null,
14865
14895
  prefabs: this.prefabList
14866
14896
  }, e);
14867
14897
  }
14868
14898
  toBrz(e = {}) {
14869
- return Gi(this.toPendingFs(e), { compress: e.compress });
14899
+ return Wi(this.toPendingFs(e), { compress: e.compress });
14870
14900
  }
14871
14901
  };
14872
- function _o(e, t = {}) {
14902
+ function Co(e, t = {}) {
14873
14903
  let n = { compress: t.compress };
14874
- return Gi(so(e, t), n);
14904
+ return Wi(mo(e, t), n);
14875
14905
  }
14876
- function vo(e) {
14906
+ function wo(e) {
14877
14907
  let t = e <= 15 ? 15 : 255;
14878
14908
  return Math.trunc((e / 255) ** (1 / 2.2) * t);
14879
14909
  }
14880
- function yo(e) {
14910
+ function To(e) {
14881
14911
  return {
14882
14912
  ...e,
14883
- R: vo(e.R),
14884
- G: vo(e.G),
14885
- B: vo(e.B)
14913
+ R: wo(e.R),
14914
+ G: wo(e.G),
14915
+ B: wo(e.B)
14886
14916
  };
14887
14917
  }
14888
- function bo(e) {
14918
+ function Eo(e) {
14889
14919
  let t = {};
14890
- for (let [n, r] of Object.entries(e)) t[n] = yo(r);
14920
+ for (let [n, r] of Object.entries(e)) t[n] = To(r);
14891
14921
  return t;
14892
14922
  }
14893
- function xo(e, t, n) {
14923
+ function Do(e, t, n) {
14894
14924
  let r = 0;
14895
14925
  for (let t of e.BrickSizeCounters) r += t.NumSizes;
14896
14926
  if (r < 0 || r > e.BrickSizes.length) throw Error("brdb: brick size counters exceed size table");
@@ -14913,25 +14943,25 @@ function xo(e, t, n) {
14913
14943
  r.Z
14914
14944
  ];
14915
14945
  }
14916
- let d = e.RelativePositions[r], f = e.Orientations[r], p = e.ColorsAndAlphas[r], m = o ? yo(p) : p;
14946
+ let d = e.RelativePositions[r], f = e.Orientations[r], p = e.ColorsAndAlphas[r], m = o ? To(p) : p;
14917
14947
  s.push({
14918
14948
  asset_name_index: l,
14919
14949
  size: u,
14920
14950
  position: [
14921
- t.x * Za + Qa + d.X,
14922
- t.y * Za + Qa + d.Y,
14923
- t.z * Za + Qa + d.Z
14951
+ t.x * ro + io + d.X,
14952
+ t.y * ro + io + d.Y,
14953
+ t.z * ro + io + d.Z
14924
14954
  ],
14925
14955
  direction: f >> 2 & 7,
14926
14956
  rotation: f & 3,
14927
14957
  collision: {
14928
- player: mi(e.CollisionFlags_Player, r),
14929
- weapon: mi(e.CollisionFlags_Weapon, r),
14930
- interaction: mi(e.CollisionFlags_Interaction, r),
14958
+ player: pi(e.CollisionFlags_Player, r),
14959
+ weapon: pi(e.CollisionFlags_Weapon, r),
14960
+ interaction: pi(e.CollisionFlags_Interaction, r),
14931
14961
  tool: !0,
14932
- physics: mi(e.CollisionFlags_Physics, r)
14962
+ physics: pi(e.CollisionFlags_Physics, r)
14933
14963
  },
14934
- visibility: mi(e.VisibilityFlags, r),
14964
+ visibility: pi(e.VisibilityFlags, r),
14935
14965
  material_index: e.MaterialIndices[r],
14936
14966
  material_intensity: m.A,
14937
14967
  color: [
@@ -14944,12 +14974,12 @@ function xo(e, t, n) {
14944
14974
  }
14945
14975
  return s;
14946
14976
  }
14947
- var So = class e {
14977
+ var Oo = class e {
14948
14978
  constructor(e, t = 0) {
14949
14979
  this.fs = e, this.worldId = t, this.schemas = /* @__PURE__ */ new Map(), this.values = /* @__PURE__ */ new Map();
14950
14980
  }
14951
14981
  static from(t) {
14952
- return new e(Ki.from(t));
14982
+ return new e(Gi.from(t));
14953
14983
  }
14954
14984
  path(e) {
14955
14985
  return `World/${this.worldId}/${e}`;
@@ -14964,7 +14994,7 @@ var So = class e {
14964
14994
  if (!r) {
14965
14995
  let i = this.fs.findFileByPathAtRevision(e, t);
14966
14996
  if (!i) throw Error(`brdb: file not found: ${e} at ${t}`);
14967
- r = Ja.fromBinary(this.fs.readBlob(i.contentId)), this.schemas.set(n, r);
14997
+ r = eo.fromBinary(this.fs.readBlob(i.contentId)), this.schemas.set(n, r);
14968
14998
  }
14969
14999
  return r;
14970
15000
  }
@@ -15017,7 +15047,7 @@ var So = class e {
15017
15047
  brickOwners() {
15018
15048
  let e = this.owners(), t = [];
15019
15049
  for (let n = 1; n < e.UserNames.length; n++) t.push({
15020
- id: sa(e.UserIds[n]),
15050
+ id: oa(e.UserIds[n]),
15021
15051
  name: e.UserNames[n],
15022
15052
  display_name: e.DisplayNames[n],
15023
15053
  bricks: e.BrickCounts[n]
@@ -15042,9 +15072,9 @@ var So = class e {
15042
15072
  y: r.Y,
15043
15073
  z: r.Z
15044
15074
  } : {
15045
- x: Qa,
15046
- y: Qa,
15047
- z: Qa
15075
+ x: io,
15076
+ y: io,
15077
+ z: io
15048
15078
  },
15049
15079
  size: t.ChunkSizes?.[n] ?? 2048,
15050
15080
  numBricks: t.NumBricks[n],
@@ -15058,7 +15088,7 @@ var So = class e {
15058
15088
  }
15059
15089
  *bricks(e = 1) {
15060
15090
  let t = this.globalData().BasicBrickAssetNames.length;
15061
- for (let n of this.brickChunkIndex(e)) yield* xo(this.brickChunkSoa(e, n.index), n.index, t);
15091
+ for (let n of this.brickChunkIndex(e)) yield* Do(this.brickChunkSoa(e, n.index), n.index, t);
15062
15092
  }
15063
15093
  entityChunkIndex() {
15064
15094
  let e = this.decode(this.path("Entities/ChunkIndex.mps"), this.path("Entities/ChunkIndex.schema"), "BRSavedEntityChunkIndexSoA");
@@ -15077,23 +15107,24 @@ var So = class e {
15077
15107
  componentChunk(e, t) {
15078
15108
  let n = this.path(`Bricks/Grids/${e}/Components/${t.x}_${t.y}_${t.z}.mps`), r = this.fs.findFileByPath(n);
15079
15109
  if (!r) throw Error(`brdb: file not found: ${n}`);
15080
- let i = this.fs.readBlob(r.contentId), a = this.schemaAt(this.path("Bricks/ComponentsShared.schema"), r.createdAt), o = this.globalData(), s = new Wi(i), c = a.readValue(s, "BRSavedComponentChunkSoA"), l = 0;
15110
+ let i = this.fs.readBlob(r.contentId), a = this.schemaAt(this.path("Bricks/ComponentsShared.schema"), r.createdAt), o = this.globalData(), s = new Ui(i), c = a.readValue(s, "BRSavedComponentChunkSoA"), l = 0;
15081
15111
  for (let e of c.ComponentTypeCounters) l += e.NumInstances;
15082
- if (l !== c.ComponentBrickIndices.length) throw Error("brdb: component counters do not match brick index count");
15083
- let u = [], d = 0;
15112
+ let u = c.ComponentBrickIndices;
15113
+ if (l !== u.length && !(u.length > l && u.length % l === 0 && u.every((e, t) => e === u[t % l]))) throw Error("brdb: component counters do not match brick index count");
15114
+ let d = [], f = 0;
15084
15115
  for (let e of c.ComponentTypeCounters) {
15085
15116
  let t = o.ComponentTypeNames[e.TypeIndex] ?? "<invalid>", n = o.ComponentDataStructNames[e.TypeIndex], r = n && n !== "None" ? n : null;
15086
- for (let n = 0; n < e.NumInstances; n++) u.push({
15117
+ for (let n = 0; n < e.NumInstances; n++) d.push({
15087
15118
  typeName: t,
15088
15119
  structName: r,
15089
- brickIndex: c.ComponentBrickIndices[d],
15120
+ brickIndex: c.ComponentBrickIndices[f],
15090
15121
  data: r ? a.readValue(s, r) : null
15091
- }), d += 1;
15122
+ }), f += 1;
15092
15123
  }
15093
15124
  if (s.remaining !== 0) throw Error(`brdb: ${s.remaining} trailing bytes after component chunk`);
15094
15125
  return {
15095
15126
  soa: c,
15096
- components: u
15127
+ components: d
15097
15128
  };
15098
15129
  }
15099
15130
  wireChunk(e, t) {
@@ -15124,10 +15155,10 @@ var So = class e {
15124
15155
  entityChunk(e) {
15125
15156
  let t = this.path(`Entities/Chunks/${e.x}_${e.y}_${e.z}.mps`), n = this.fs.findFileByPath(t);
15126
15157
  if (!n) throw Error(`brdb: file not found: ${t}`);
15127
- let r = this.fs.readBlob(n.contentId), i = this.schemaAt(this.path("Entities/ChunksShared.schema"), n.createdAt), a = this.globalData(), o = new Wi(r), s = i.readValue(o, "BRSavedEntityChunkSoA"), c = 0;
15158
+ let r = this.fs.readBlob(n.contentId), i = this.schemaAt(this.path("Entities/ChunksShared.schema"), n.createdAt), a = this.globalData(), o = new Ui(r), s = i.readValue(o, "BRSavedEntityChunkSoA"), c = 0;
15128
15159
  for (let e of s.TypeCounters) c += e.NumEntities;
15129
15160
  if (c !== s.PersistentIndices.length) throw Error("brdb: entity counters do not match persistent index count");
15130
- let l = a.EntityDataClassNames ?? a.EntityTypeNames.map((e) => na.get(e) ?? "Unknown"), u = s.bColorsAreLinear ?? !0, d = [], f = 0;
15161
+ let l = a.EntityDataClassNames ?? a.EntityTypeNames.map((e) => ta.get(e) ?? "Unknown"), u = s.bColorsAreLinear ?? !0, d = [], f = 0;
15131
15162
  for (let e of s.TypeCounters) {
15132
15163
  let t = a.EntityTypeNames[e.TypeIndex] ?? "<invalid>", n = l[e.TypeIndex], r = n && n !== "None" ? n : null;
15133
15164
  for (let n = 0; n < e.NumEntities; n++) {
@@ -15140,11 +15171,11 @@ var So = class e {
15140
15171
  originalOwnerIndex: s.OriginalOwnerIndices?.[f] ?? s.OwnerIndices[f],
15141
15172
  location: s.Locations[f],
15142
15173
  rotation: s.Rotations[f],
15143
- frozen: mi(s.PhysicsLockedFlags, f),
15144
- sleeping: mi(s.PhysicsSleepingFlags, f),
15174
+ frozen: pi(s.PhysicsLockedFlags, f),
15175
+ sleeping: pi(s.PhysicsSleepingFlags, f),
15145
15176
  linearVelocity: s.LinearVelocities[f],
15146
15177
  angularVelocity: s.AngularVelocities[f],
15147
- colors: u ? bo(e) : e,
15178
+ colors: u ? Eo(e) : e,
15148
15179
  remainingLifeSpan: s.RemainingLifeSpans?.[f] ?? 0,
15149
15180
  data: r ? i.readValue(o, r) : null
15150
15181
  }), f += 1;
@@ -15156,74 +15187,74 @@ var So = class e {
15156
15187
  *entities() {
15157
15188
  for (let e of this.entityChunkIndex().chunks) yield* this.entityChunk(e.index);
15158
15189
  }
15159
- }, Co, $ = "\n ", wo = "\n ", To = `CREATE TABLE blobs (${$}blob_id INTEGER PRIMARY KEY,${$}compression INTEGER,${$}size_uncompressed INTEGER,${$}size_compressed INTEGER,${$}delta_base_id INTEGER REFERENCES blobs(blob_id),${$}hash BLOB,${$}content BLOB${wo});\nCREATE TABLE revisions (${$}revision_id INTEGER PRIMARY KEY,${$}description TEXT,${$}created_at INTEGER${wo});\nCREATE TABLE folders (${$}folder_id INTEGER PRIMARY KEY,${$}parent_id INTEGER REFERENCES folders(folder_id),${$}name TEXT,${$}created_at INTEGER,${$}deleted_at INTEGER${wo});\nCREATE TABLE files (${$}file_id INTEGER PRIMARY KEY,${$}parent_id INTEGER REFERENCES folders(folder_id),${$}name TEXT,${$}content_id INTEGER REFERENCES blobs(blob_id),${$}created_at INTEGER,${$}deleted_at INTEGER${wo});\nCREATE INDEX blobs_size_hash ON blobs(size_uncompressed, hash);
15190
+ }, ko, $ = "\n ", Ao = "\n ", jo = `CREATE TABLE blobs (${$}blob_id INTEGER PRIMARY KEY,${$}compression INTEGER,${$}size_uncompressed INTEGER,${$}size_compressed INTEGER,${$}delta_base_id INTEGER REFERENCES blobs(blob_id),${$}hash BLOB,${$}content BLOB${Ao});\nCREATE TABLE revisions (${$}revision_id INTEGER PRIMARY KEY,${$}description TEXT,${$}created_at INTEGER${Ao});\nCREATE TABLE folders (${$}folder_id INTEGER PRIMARY KEY,${$}parent_id INTEGER REFERENCES folders(folder_id),${$}name TEXT,${$}created_at INTEGER,${$}deleted_at INTEGER${Ao});\nCREATE TABLE files (${$}file_id INTEGER PRIMARY KEY,${$}parent_id INTEGER REFERENCES folders(folder_id),${$}name TEXT,${$}content_id INTEGER REFERENCES blobs(blob_id),${$}created_at INTEGER,${$}deleted_at INTEGER${Ao});\nCREATE INDEX blobs_size_hash ON blobs(size_uncompressed, hash);
15160
15191
  CREATE INDEX folders_parent_name_deleted ON folders(parent_id, name, deleted_at);
15161
- CREATE INDEX files_parent_name_deleted ON files(parent_id, name, deleted_at);`, Eo = [
15192
+ CREATE INDEX files_parent_name_deleted ON files(parent_id, name, deleted_at);`, Mo = [
15162
15193
  "blobs",
15163
15194
  "revisions",
15164
15195
  "folders",
15165
15196
  "files"
15166
- ], Do = () => Math.floor(Date.now() / 1e3), Oo = (e) => typeof Buffer > "u" ? e : Buffer.from(e.buffer, e.byteOffset, e.byteLength), ko = (e) => {
15197
+ ], No = () => Math.floor(Date.now() / 1e3), Po = (e) => typeof Buffer > "u" ? e : Buffer.from(e.buffer, e.byteOffset, e.byteLength), Fo = (e) => {
15167
15198
  try {
15168
15199
  return typeof process < "u" ? process?.getBuiltinModule?.(e) ?? null : null;
15169
15200
  } catch {
15170
15201
  return null;
15171
15202
  }
15172
- }, Ao = null, jo = (e) => (Ao ?? (Ao = Function("specifier", "return import(specifier)")), Ao(e));
15173
- async function Mo() {
15203
+ }, Io = null, Lo = (e) => (Io ?? (Io = Function("specifier", "return import(specifier)")), Io(e));
15204
+ async function Ro() {
15174
15205
  try {
15175
- let e = await (Po.engineLoader ?? (() => jo("better-sqlite3")))();
15206
+ let e = await (Bo.engineLoader ?? (() => Lo("better-sqlite3")))();
15176
15207
  return e.default ?? e;
15177
15208
  } catch {
15178
15209
  throw Error("brdb: the Brdb openers require better-sqlite3 (npm install better-sqlite3), or wrap your own handle with new Brdb(db)");
15179
15210
  }
15180
15211
  }
15181
- function No() {
15182
- let e = ko("node:zlib");
15212
+ function zo() {
15213
+ let e = Fo("node:zlib");
15183
15214
  if (typeof e?.zstdCompressSync != "function") return null;
15184
15215
  let t = e.constants.ZSTD_c_compressionLevel;
15185
15216
  return (n) => new Uint8Array(e.zstdCompressSync(n, { params: { [t]: 14 } }));
15186
15217
  }
15187
- var Po = class e {
15218
+ var Bo = class e {
15188
15219
  constructor(e) {
15189
15220
  this.db = e, this.defaultCompress = null;
15190
- for (let e of Eo) if (!this.db.prepare("SELECT name FROM sqlite_schema WHERE type = 'table' AND name = ?").get(e)) throw Error(`brdb: missing required table '${e}'`);
15221
+ for (let e of Mo) if (!this.db.prepare("SELECT name FROM sqlite_schema WHERE type = 'table' AND name = ?").get(e)) throw Error(`brdb: missing required table '${e}'`);
15191
15222
  }
15192
- static init(t, n = Do()) {
15193
- t.exec(To);
15223
+ static init(t, n = No()) {
15224
+ t.exec(jo);
15194
15225
  let r = new e(t);
15195
15226
  return r.createRevision("Initial Revision", n), r;
15196
15227
  }
15197
15228
  static async wrap(t, n) {
15198
15229
  try {
15199
15230
  let r = n ? e.init(t) : new e(t);
15200
- return r.defaultCompress = No(), r;
15231
+ return r.defaultCompress = zo(), r;
15201
15232
  } catch (e) {
15202
15233
  throw t.close(), e;
15203
15234
  }
15204
15235
  }
15205
15236
  static async open(t) {
15206
- return e.wrap(new (await (Mo()))(t, { fileMustExist: !0 }), !1);
15237
+ return e.wrap(new (await (Ro()))(t, { fileMustExist: !0 }), !1);
15207
15238
  }
15208
15239
  static async openReadonly(t) {
15209
- return e.wrap(new (await (Mo()))(t, {
15240
+ return e.wrap(new (await (Ro()))(t, {
15210
15241
  readonly: !0,
15211
15242
  fileMustExist: !0
15212
15243
  }), !1);
15213
15244
  }
15214
15245
  static async create(t) {
15215
- return e.wrap(new (await (Mo()))(t), !0);
15246
+ return e.wrap(new (await (Ro()))(t), !0);
15216
15247
  }
15217
15248
  static async openOrCreate(t) {
15218
- let n = ko("node:fs");
15249
+ let n = Fo("node:fs");
15219
15250
  if (!n) throw Error("brdb: openOrCreate requires node 22.3 or newer; call open or create explicitly");
15220
15251
  return n.existsSync(t) ? e.open(t) : e.create(t);
15221
15252
  }
15222
15253
  static async memory() {
15223
- return e.wrap(new (await (Mo()))(":memory:"), !0);
15254
+ return e.wrap(new (await (Ro()))(":memory:"), !0);
15224
15255
  }
15225
15256
  static async fromBytes(t) {
15226
- return e.wrap(new (await (Mo()))(Buffer.from(t)), !1);
15257
+ return e.wrap(new (await (Ro()))(Buffer.from(t)), !1);
15227
15258
  }
15228
15259
  toBytes() {
15229
15260
  let e = this.db.serialize;
@@ -15231,15 +15262,15 @@ var Po = class e {
15231
15262
  return new Uint8Array(e.call(this.db));
15232
15263
  }
15233
15264
  save(e, t, n = {}) {
15234
- this.writePending(e, t instanceof go ? t.toPendingFs(n) : so(t, n), n);
15265
+ this.writePending(e, t instanceof So ? t.toPendingFs(n) : mo(t, n), n);
15235
15266
  }
15236
15267
  worldReader() {
15237
- return new So(this);
15268
+ return new Oo(this);
15238
15269
  }
15239
15270
  sqliteSchema() {
15240
15271
  return this.db.prepare("SELECT sql FROM sqlite_schema").all().map((e) => e.sql).join("\n");
15241
15272
  }
15242
- createRevision(e, t = Do()) {
15273
+ createRevision(e, t = No()) {
15243
15274
  return Number(this.db.prepare("INSERT INTO revisions (description, created_at) VALUES (?, ?);").run(e, t).lastInsertRowid);
15244
15275
  }
15245
15276
  revisions() {
@@ -15259,16 +15290,16 @@ var Po = class e {
15259
15290
  let r = this.findBlobByHash(e.length, t);
15260
15291
  if (r) return r.blobId;
15261
15292
  let i = e.length, a = i, o = 0, s = e, c = n ? n(e) : null;
15262
- return c && c.length < i && (a = c.length, o = 1, s = c), Number(this.db.prepare("INSERT INTO blobs (compression, size_uncompressed, size_compressed, delta_base_id, hash, content) VALUES (?, ?, ?, ?, ?, ?);").run(o, i, a, null, Oo(t), Oo(s)).lastInsertRowid);
15293
+ return c && c.length < i && (a = c.length, o = 1, s = c), Number(this.db.prepare("INSERT INTO blobs (compression, size_uncompressed, size_compressed, delta_base_id, hash, content) VALUES (?, ?, ?, ?, ?, ?);").run(o, i, a, null, Po(t), Po(s)).lastInsertRowid);
15263
15294
  }
15264
15295
  findBlobByHash(e, t) {
15265
- let n = this.db.prepare("SELECT blob_id, compression, size_uncompressed, size_compressed, delta_base_id, hash, content FROM blobs WHERE hash = ? AND size_uncompressed = ? LIMIT 1;").get(Oo(t), e);
15266
- return n ? Fo(n) : null;
15296
+ let n = this.db.prepare("SELECT blob_id, compression, size_uncompressed, size_compressed, delta_base_id, hash, content FROM blobs WHERE hash = ? AND size_uncompressed = ? LIMIT 1;").get(Po(t), e);
15297
+ return n ? Vo(n) : null;
15267
15298
  }
15268
15299
  findBlob(e) {
15269
15300
  let t = this.db.prepare("SELECT blob_id, compression, size_uncompressed, size_compressed, delta_base_id, hash, content FROM blobs WHERE blob_id = ?;").get(e);
15270
15301
  if (!t) throw Error(`brdb: blob ${e} not found`);
15271
- return Fo(t);
15302
+ return Vo(t);
15272
15303
  }
15273
15304
  deleteFile(e, t) {
15274
15305
  this.db.prepare("UPDATE files SET deleted_at = ? WHERE file_id = ?;").run(t, e);
@@ -15295,7 +15326,7 @@ var Po = class e {
15295
15326
  }
15296
15327
  findFile(e, t) {
15297
15328
  let n = this.db.prepare(`SELECT content_id, created_at FROM files WHERE parent_id ${e === null ? "IS NULL" : "= ?"} AND name = ? AND deleted_at IS NULL;`).get(...e === null ? [t] : [e, t]);
15298
- return n ? Io(n) : null;
15329
+ return n ? Ho(n) : null;
15299
15330
  }
15300
15331
  findFileAtRevision(e, t, n) {
15301
15332
  let r = this.db.prepare(`SELECT content_id, created_at FROM files WHERE parent_id ${e === null ? "IS NULL" : "= ?"} AND name = ? AND created_at <= ? AND (deleted_at IS NULL OR deleted_at > ?) ORDER BY created_at ASC LIMIT 1;`).get(...e === null ? [
@@ -15308,13 +15339,13 @@ var Po = class e {
15308
15339
  n,
15309
15340
  n
15310
15341
  ]);
15311
- return r ? Io(r) : null;
15342
+ return r ? Ho(r) : null;
15312
15343
  }
15313
15344
  close() {
15314
15345
  this.db.close();
15315
15346
  }
15316
15347
  writePending(e, t, n = {}) {
15317
- let r = n.createdAt ?? Do(), i = n.compress === void 0 ? this.defaultCompress : n.compress;
15348
+ let r = n.createdAt ?? No(), i = n.compress === void 0 ? this.defaultCompress : n.compress;
15318
15349
  this.db.exec("BEGIN");
15319
15350
  try {
15320
15351
  this.createRevision(e, r), this.mergeFolder(null, t, r, i), this.db.exec("COMMIT");
@@ -15355,7 +15386,7 @@ var Po = class e {
15355
15386
  this.insertPending(s, e, c, n, r);
15356
15387
  continue;
15357
15388
  }
15358
- let o = pi(c.content), l = this.findBlobByHash(c.content.length, o);
15389
+ let o = fi(c.content), l = this.findBlobByHash(c.content.length, o);
15359
15390
  if (l && t.contentId === l.blobId) continue;
15360
15391
  this.deleteFile(t.fileId, n);
15361
15392
  let u = this.insertBlob(c.content, o, r);
@@ -15373,7 +15404,7 @@ var Po = class e {
15373
15404
  o.add(e), this.insertPending(e, a, t, r, i);
15374
15405
  }
15375
15406
  } else {
15376
- let a = this.insertBlob(n.content, pi(n.content), i);
15407
+ let a = this.insertBlob(n.content, fi(n.content), i);
15377
15408
  this.insertFile(e, t, a, r);
15378
15409
  }
15379
15410
  }
@@ -15415,7 +15446,7 @@ var Po = class e {
15415
15446
  let t = this.findBlob(e);
15416
15447
  if (t.deltaBaseId !== null) throw Error("brdb: delta blobs are not supported");
15417
15448
  let n = t.content;
15418
- if (t.compression === 1) n = Hi(n, new Uint8Array(t.sizeUncompressed));
15449
+ if (t.compression === 1) n = Vi(n, new Uint8Array(t.sizeUncompressed));
15419
15450
  else if (t.compression !== 0) throw Error(`brdb: unknown blob compression ${t.compression}`);
15420
15451
  if (n.length !== t.sizeUncompressed) throw Error("brdb: blob uncompressed size mismatch");
15421
15452
  return n;
@@ -15441,8 +15472,8 @@ var Po = class e {
15441
15472
  return e(null);
15442
15473
  }
15443
15474
  };
15444
- Co = Po, Co.engineLoader = null;
15445
- var Fo = (e) => ({
15475
+ ko = Bo, ko.engineLoader = null;
15476
+ var Vo = (e) => ({
15446
15477
  blobId: Number(e.blob_id),
15447
15478
  compression: Number(e.compression),
15448
15479
  sizeUncompressed: Number(e.size_uncompressed),
@@ -15450,54 +15481,54 @@ var Fo = (e) => ({
15450
15481
  deltaBaseId: e.delta_base_id === null ? null : Number(e.delta_base_id),
15451
15482
  hash: new Uint8Array(e.hash),
15452
15483
  content: new Uint8Array(e.content)
15453
- }), Io = (e) => ({
15484
+ }), Ho = (e) => ({
15454
15485
  contentId: e.content_id === null ? -1 : Number(e.content_id),
15455
15486
  createdAt: Number(e.created_at)
15456
- }), Lo = /* @__PURE__ */ t({
15457
- BASIC_BRICK_ASSETS: () => qi,
15458
- BRDB_SQLITE_SCHEMA: () => To,
15459
- BRICK_ASSETS: () => Yi,
15460
- BitFlags: () => hi,
15461
- Brdb: () => Po,
15462
- BrdbSchema: () => Ja,
15463
- BrzReader: () => Ki,
15464
- ByteReader: () => Wi,
15465
- ByteWriter: () => Ui,
15466
- CHUNK_HALF: () => Qa,
15467
- CHUNK_SIZE: () => Za,
15468
- COMPONENTS: () => ia,
15469
- COMPONENT_STRUCT_DEFAULTS: () => ea,
15470
- COMPONENT_TYPE_STRUCTS: () => $i,
15471
- COMPONENT_WIRE_PORTS: () => ra,
15472
- ENTITY_TYPE_STRUCTS: () => na,
15487
+ }), Uo = /* @__PURE__ */ t({
15488
+ BASIC_BRICK_ASSETS: () => Ki,
15489
+ BRDB_SQLITE_SCHEMA: () => jo,
15490
+ BRICK_ASSETS: () => Ji,
15491
+ BitFlags: () => mi,
15492
+ Brdb: () => Bo,
15493
+ BrdbSchema: () => eo,
15494
+ BrzReader: () => Gi,
15495
+ ByteReader: () => Ui,
15496
+ ByteWriter: () => Hi,
15497
+ CHUNK_HALF: () => io,
15498
+ CHUNK_SIZE: () => ro,
15499
+ COMPONENTS: () => ra,
15500
+ COMPONENT_STRUCT_DEFAULTS: () => $i,
15501
+ COMPONENT_TYPE_STRUCTS: () => Qi,
15502
+ COMPONENT_WIRE_PORTS: () => na,
15503
+ ENTITY_TYPE_STRUCTS: () => ta,
15473
15504
  MAIN_GRID: () => 1,
15474
- PROCEDURAL_BRICK_ASSETS: () => Ji,
15475
- PUBLIC_GUID: () => aa,
15476
- WIRE_PORT_NAMES: () => ta,
15477
- World: () => go,
15478
- WorldReader: () => So,
15479
- bit: () => mi,
15480
- embeddedSchema: () => Xa,
15481
- file: () => X,
15482
- folder: () => ca,
15483
- guidToUuid: () => sa,
15484
- isProceduralAsset: () => Qi,
15485
- msgpack: () => la,
15486
- saveToPendingFs: () => so,
15487
- toRelative: () => to,
15488
- uuidToGuid: () => oa,
15489
- writeBrzContainer: () => Gi,
15490
- writeBrzLegacy: () => _o
15491
- }), Ro = {
15505
+ PROCEDURAL_BRICK_ASSETS: () => qi,
15506
+ PUBLIC_GUID: () => ia,
15507
+ WIRE_PORT_NAMES: () => ea,
15508
+ World: () => So,
15509
+ WorldReader: () => Oo,
15510
+ bit: () => pi,
15511
+ embeddedSchema: () => no,
15512
+ file: () => Q,
15513
+ folder: () => Z,
15514
+ guidToUuid: () => oa,
15515
+ isProceduralAsset: () => Zi,
15516
+ msgpack: () => sa,
15517
+ saveToPendingFs: () => mo,
15518
+ toRelative: () => so,
15519
+ uuidToGuid: () => aa,
15520
+ writeBrzContainer: () => Wi,
15521
+ writeBrzLegacy: () => Co
15522
+ }), Wo = {
15492
15523
  read: kr,
15493
15524
  write: Mr,
15494
15525
  utils: er,
15495
15526
  constants: n,
15496
15527
  types: Nr,
15497
- brdb: Lo
15528
+ brdb: Uo
15498
15529
  };
15499
- typeof window < "u" && (window.BRS = Ro);
15530
+ typeof window < "u" && (window.BRS = Wo);
15500
15531
  //#endregion
15501
- export { Po as Brdb, Pr as Direction, Fr as Rotation, go as World, So as WorldReader, Lo as brdb, n as constants, Ro as default, kr as read, Nr as types, er as utils, Mr as write, _o as writeBrzLegacy };
15532
+ export { Bo as Brdb, Pr as Direction, Fr as Rotation, So as World, Oo as WorldReader, Uo as brdb, n as constants, Wo as default, kr as read, Nr as types, er as utils, Mr as write, Co as writeBrzLegacy };
15502
15533
 
15503
15534
  //# sourceMappingURL=dist.mjs.map