this.me 3.0.33 → 3.1.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/me.es.js CHANGED
@@ -1,61 +1,121 @@
1
- function ve(c) {
2
- return { __ptr: c };
1
+ function ve(l) {
2
+ return { __ptr: l };
3
3
  }
4
- function Yt(c) {
5
- return !!c && typeof c == "object" && typeof c.__ptr == "string" && c.__ptr.length > 0;
4
+ function N(l) {
5
+ return !!l && typeof l == "object" && typeof l.__ptr == "string" && l.__ptr.length > 0;
6
6
  }
7
- function ge(c) {
8
- return { __id: c };
7
+ function be(l) {
8
+ return { __id: l };
9
9
  }
10
- function te(c) {
11
- return !!c && typeof c == "object" && typeof c.__id == "string" && c.__id.length > 0;
10
+ function Lt(l) {
11
+ return !!l && typeof l == "object" && typeof l.__id == "string" && l.__id.length > 0;
12
12
  }
13
- function be(c) {
14
- return !!c && typeof c == "object" && typeof c.path == "string" && typeof c.hash == "string" && typeof c.timestamp == "number";
13
+ function me(l) {
14
+ return !!l && typeof l == "object" && typeof l.path == "string" && typeof l.hash == "string" && typeof l.timestamp == "number";
15
15
  }
16
- function N(c) {
17
- return c.length === 0 ? { scope: [], leaf: null } : { scope: c.slice(0, -1), leaf: c[c.length - 1] };
16
+ function C(l) {
17
+ return l.length === 0 ? { scope: [], leaf: null } : { scope: l.slice(0, -1), leaf: l[l.length - 1] };
18
18
  }
19
- function le(c, r) {
20
- if (r.length > c.length) return !1;
21
- for (let e = 0; e < r.length; e++)
22
- if (c[e] !== r[e]) return !1;
19
+ function Gt(l, n) {
20
+ if (n.length > l.length) return !1;
21
+ for (let e = 0; e < n.length; e++)
22
+ if (l[e] !== n[e]) return !1;
23
23
  return !0;
24
24
  }
25
- function ce(c) {
26
- const r = c.trim().toLowerCase();
27
- if (r.length < 3 || r.length > 63)
28
- throw new Error(`Invalid username length: ${r.length}. Expected 3..63 characters.`);
29
- if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(r))
25
+ function Ht(l) {
26
+ const n = l.trim().toLowerCase();
27
+ if (n.length < 3 || n.length > 63)
28
+ throw new Error(`Invalid username length: ${n.length}. Expected 3..63 characters.`);
29
+ if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(n))
30
30
  throw new Error(
31
- `Invalid username. Use only [a-z0-9-], and start/end with [a-z0-9]. Got: ${c}`
31
+ `Invalid username. Use only [a-z0-9-], and start/end with [a-z0-9]. Got: ${l}`
32
32
  );
33
- if (r.includes("--"))
34
- throw new Error(`Invalid username. "--" is not allowed. Got: ${c}`);
35
- return r;
33
+ if (n.includes("--"))
34
+ throw new Error(`Invalid username. "--" is not allowed. Got: ${l}`);
35
+ return n;
36
36
  }
37
- var Se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
38
- function ke(c) {
39
- return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
37
+ function I(l, n) {
38
+ return l[n]?.kind ?? null;
40
39
  }
41
- var ee = { exports: {} };
42
- /**
43
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
44
- *
45
- * @version 0.9.3
46
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
47
- * @copyright Chen, Yi-Cyuan 2015-2023
48
- * @license MIT
49
- */
50
- var ae;
51
- function me() {
52
- return ae || (ae = 1, (function(c) {
40
+ function ke(l, n) {
41
+ if (l.length !== 1 || l[0] !== "+" || !Array.isArray(n) || n.length < 2) return null;
42
+ const i = String(n[0] ?? "").trim(), r = String(n[1] ?? "").trim();
43
+ return !i || !r || i === "+" ? null : { op: i, kind: r };
44
+ }
45
+ function Se(l, n, e) {
46
+ if (n.length === 0) return null;
47
+ const { scope: i, leaf: r } = C(n);
48
+ return !r || I(l, r) !== "secret" || typeof e != "string" ? null : { scopeKey: i.join(".") };
49
+ }
50
+ function Ae(l, n, e) {
51
+ if (n.length === 0) return null;
52
+ const { scope: i, leaf: r } = C(n);
53
+ return !r || I(l, r) !== "noise" || typeof e != "string" ? null : { scopeKey: i.join(".") };
54
+ }
55
+ function Be(l, n, e) {
56
+ if (n.length === 0) return null;
57
+ const { leaf: i } = C(n);
58
+ if (!i || I(l, i) !== "pointer" || typeof e != "string") return null;
59
+ const r = e.trim().replace(/^\./, "");
60
+ return r ? { targetPath: r } : null;
61
+ }
62
+ function _e(l, n, e) {
63
+ if (n.length === 1 && I(l, n[0]) === "identity")
64
+ return typeof e != "string" ? null : { id: Ht(e), targetPath: [] };
65
+ const { scope: i, leaf: r } = C(n);
66
+ return !r || I(l, r) !== "identity" || typeof e != "string" ? null : { id: Ht(e), targetPath: i };
67
+ }
68
+ function Pe(l, n, e) {
69
+ if (n.length === 0) return null;
70
+ const { scope: i, leaf: r } = C(n);
71
+ if (!r || I(l, r) !== "eval") return null;
72
+ if (typeof e == "function")
73
+ return { mode: "thunk", targetPath: i, thunk: e };
74
+ if (Array.isArray(e) && e.length >= 2) {
75
+ const u = String(e[0] ?? "").trim(), f = String(e[1] ?? "").trim();
76
+ return !u || !f ? null : { mode: "assign", targetPath: i, name: u, expr: f };
77
+ }
78
+ return null;
79
+ }
80
+ function we(l, n, e) {
81
+ if (n.length === 0) return null;
82
+ const { scope: i, leaf: r } = C(n);
83
+ if (!r || I(l, r) !== "query") return null;
84
+ let u = null, f;
85
+ if (Array.isArray(e) && e.length > 0)
86
+ Array.isArray(e[0]) && (e.length === 1 || typeof e[1] == "function") ? (u = e[0], f = typeof e[1] == "function" ? e[1] : void 0) : u = e;
87
+ else
88
+ return null;
89
+ if (!Array.isArray(u) || u.length === 0) return null;
90
+ const p = u.map((s) => String(s)).map((s) => s.trim()).filter((s) => s.length > 0);
91
+ return p.length === 0 ? null : { targetPath: i, paths: p, fn: f };
92
+ }
93
+ function xe(l, n, e) {
94
+ if (n.length === 0) return null;
95
+ const { scope: i, leaf: r } = C(n);
96
+ if (!r || I(l, r) !== "remove") return null;
97
+ if (e == null)
98
+ return { targetPath: i };
99
+ if (typeof e == "string") {
100
+ const u = e.split(".").filter(Boolean);
101
+ return { targetPath: [...i, ...u] };
102
+ }
103
+ return null;
104
+ }
105
+ var Ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
106
+ function Oe(l) {
107
+ return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
108
+ }
109
+ var Yt = { exports: {} };
110
+ var ce;
111
+ function Ee() {
112
+ return ce || (ce = 1, (function(l) {
53
113
  (function() {
54
- var r = "input is invalid type", e = "finalize already called", a = typeof window == "object", i = a ? window : {};
55
- i.JS_SHA3_NO_WINDOW && (a = !1);
56
- var f = !a && typeof self == "object", p = !i.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node;
57
- p ? i = Se : f && (i = self);
58
- for (var b = !i.JS_SHA3_NO_COMMON_JS && !0 && c.exports, y = !i.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", g = "0123456789abcdef".split(""), S = [31, 7936, 2031616, 520093696], O = [4, 1024, 262144, 67108864], W = [1, 256, 65536, 16777216], z = [6, 1536, 393216, 100663296], P = [0, 8, 16, 24], D = [
114
+ var n = "input is invalid type", e = "finalize already called", i = typeof window == "object", r = i ? window : {};
115
+ r.JS_SHA3_NO_WINDOW && (i = !1);
116
+ var u = !i && typeof self == "object", f = !r.JS_SHA3_NO_NODE_JS && typeof process == "object" && process.versions && process.versions.node;
117
+ f ? r = Ce : u && (r = self);
118
+ for (var p = !r.JS_SHA3_NO_COMMON_JS && !0 && l.exports, s = !r.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", h = "0123456789abcdef".split(""), k = [31, 7936, 2031616, 520093696], m = [4, 1024, 262144, 67108864], S = [1, 256, 65536, 16777216], B = [6, 1536, 393216, 100663296], A = [0, 8, 16, 24], x = [
59
119
  1,
60
120
  0,
61
121
  32898,
@@ -104,269 +164,358 @@ function me() {
104
164
  0,
105
165
  2147516424,
106
166
  2147483648
107
- ], E = [224, 256, 384, 512], J = [128, 256], $ = ["hex", "buffer", "arrayBuffer", "array", "digest"], q = {
167
+ ], O = [224, 256, 384, 512], E = [128, 256], M = ["hex", "buffer", "arrayBuffer", "array", "digest"], Xt = {
108
168
  128: 168,
109
169
  256: 136
110
- }, Zt = i.JS_SHA3_NO_NODE_JS || !Array.isArray ? function(t) {
170
+ }, se = r.JS_SHA3_NO_NODE_JS || !Array.isArray ? function(t) {
111
171
  return Object.prototype.toString.call(t) === "[object Array]";
112
- } : Array.isArray, L = y && (i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) ? function(t) {
172
+ } : Array.isArray, de = s && (r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) ? function(t) {
113
173
  return typeof t == "object" && t.buffer && t.buffer.constructor === ArrayBuffer;
114
- } : ArrayBuffer.isView, k = function(t) {
115
- var n = typeof t;
116
- if (n === "string")
174
+ } : ArrayBuffer.isView, Ut = function(t) {
175
+ var o = typeof t;
176
+ if (o === "string")
117
177
  return [t, !0];
118
- if (n !== "object" || t === null)
119
- throw new Error(r);
120
- if (y && t.constructor === ArrayBuffer)
178
+ if (o !== "object" || t === null)
179
+ throw new Error(n);
180
+ if (s && t.constructor === ArrayBuffer)
121
181
  return [new Uint8Array(t), !1];
122
- if (!Zt(t) && !L(t))
123
- throw new Error(r);
182
+ if (!se(t) && !de(t))
183
+ throw new Error(n);
124
184
  return [t, !1];
125
- }, x = function(t) {
126
- return k(t)[0].length === 0;
127
- }, C = function(t) {
128
- for (var n = [], o = 0; o < t.length; ++o)
129
- n[o] = t[o];
130
- return n;
131
- }, w = function(t, n, o) {
132
- return function(l) {
133
- return new B(t, n, t).update(l)[o]();
185
+ }, te = function(t) {
186
+ return Ut(t)[0].length === 0;
187
+ }, Vt = function(t) {
188
+ for (var o = [], c = 0; c < t.length; ++c)
189
+ o[c] = t[c];
190
+ return o;
191
+ }, ee = function(t, o, c) {
192
+ return function(a) {
193
+ return new P(t, o, t).update(a)[c]();
134
194
  };
135
- }, _ = function(t, n, o) {
136
- return function(l, u) {
137
- return new B(t, n, u).update(l)[o]();
195
+ }, ne = function(t, o, c) {
196
+ return function(a, d) {
197
+ return new P(t, o, d).update(a)[c]();
138
198
  };
139
- }, F = function(t, n, o) {
140
- return function(l, u, h, d) {
141
- return M["cshake" + t].update(l, u, h, d)[o]();
199
+ }, re = function(t, o, c) {
200
+ return function(a, d, y, v) {
201
+ return F["cshake" + t].update(a, d, y, v)[c]();
142
202
  };
143
- }, I = function(t, n, o) {
144
- return function(l, u, h, d) {
145
- return M["kmac" + t].update(l, u, h, d)[o]();
203
+ }, ie = function(t, o, c) {
204
+ return function(a, d, y, v) {
205
+ return F["kmac" + t].update(a, d, y, v)[c]();
146
206
  };
147
- }, j = function(t, n, o, l) {
148
- for (var u = 0; u < $.length; ++u) {
149
- var h = $[u];
150
- t[h] = n(o, l, h);
207
+ }, W = function(t, o, c, a) {
208
+ for (var d = 0; d < M.length; ++d) {
209
+ var y = M[d];
210
+ t[y] = o(c, a, y);
151
211
  }
152
212
  return t;
153
- }, K = function(t, n) {
154
- var o = w(t, n, "hex");
155
- return o.create = function() {
156
- return new B(t, n, t);
157
- }, o.update = function(l) {
158
- return o.create().update(l);
159
- }, j(o, w, t, n);
160
- }, de = function(t, n) {
161
- var o = _(t, n, "hex");
162
- return o.create = function(l) {
163
- return new B(t, n, l);
164
- }, o.update = function(l, u) {
165
- return o.create(u).update(l);
166
- }, j(o, _, t, n);
167
- }, pe = function(t, n) {
168
- var o = q[t], l = F(t, n, "hex");
169
- return l.create = function(u, h, d) {
170
- return x(h) && x(d) ? M["shake" + t].create(u) : new B(t, n, u).bytepad([h, d], o);
171
- }, l.update = function(u, h, d, s) {
172
- return l.create(h, d, s).update(u);
173
- }, j(l, F, t, n);
174
- }, ye = function(t, n) {
175
- var o = q[t], l = I(t, n, "hex");
176
- return l.create = function(u, h, d) {
177
- return new Xt(t, n, h).bytepad(["KMAC", d], o).bytepad([u], o);
178
- }, l.update = function(u, h, d, s) {
179
- return l.create(u, d, s).update(h);
180
- }, j(l, I, t, n);
181
- }, ie = [
182
- { name: "keccak", padding: W, bits: E, createMethod: K },
183
- { name: "sha3", padding: z, bits: E, createMethod: K },
184
- { name: "shake", padding: S, bits: J, createMethod: de },
185
- { name: "cshake", padding: O, bits: J, createMethod: pe },
186
- { name: "kmac", padding: O, bits: J, createMethod: ye }
187
- ], M = {}, U = [], T = 0; T < ie.length; ++T)
188
- for (var H = ie[T], Y = H.bits, V = 0; V < Y.length; ++V) {
189
- var Qt = H.name + "_" + Y[V];
190
- if (U.push(Qt), M[Qt] = H.createMethod(Y[V], H.padding), H.name !== "sha3") {
191
- var oe = H.name + Y[V];
192
- U.push(oe), M[oe] = M[Qt];
213
+ }, oe = function(t, o) {
214
+ var c = ee(t, o, "hex");
215
+ return c.create = function() {
216
+ return new P(t, o, t);
217
+ }, c.update = function(a) {
218
+ return c.create().update(a);
219
+ }, W(c, ee, t, o);
220
+ }, pe = function(t, o) {
221
+ var c = ne(t, o, "hex");
222
+ return c.create = function(a) {
223
+ return new P(t, o, a);
224
+ }, c.update = function(a, d) {
225
+ return c.create(d).update(a);
226
+ }, W(c, ne, t, o);
227
+ }, ye = function(t, o) {
228
+ var c = Xt[t], a = re(t, o, "hex");
229
+ return a.create = function(d, y, v) {
230
+ return te(y) && te(v) ? F["shake" + t].create(d) : new P(t, o, d).bytepad([y, v], c);
231
+ }, a.update = function(d, y, v, g) {
232
+ return a.create(y, v, g).update(d);
233
+ }, W(a, re, t, o);
234
+ }, ge = function(t, o) {
235
+ var c = Xt[t], a = ie(t, o, "hex");
236
+ return a.create = function(d, y, v) {
237
+ return new $t(t, o, y).bytepad(["KMAC", v], c).bytepad([d], c);
238
+ }, a.update = function(d, y, v, g) {
239
+ return a.create(d, v, g).update(y);
240
+ }, W(a, ie, t, o);
241
+ }, le = [
242
+ { name: "keccak", padding: S, bits: O, createMethod: oe },
243
+ { name: "sha3", padding: B, bits: O, createMethod: oe },
244
+ { name: "shake", padding: k, bits: E, createMethod: pe },
245
+ { name: "cshake", padding: m, bits: E, createMethod: ye },
246
+ { name: "kmac", padding: m, bits: E, createMethod: ge }
247
+ ], F = {}, T = [], K = 0; K < le.length; ++K)
248
+ for (var j = le[K], J = j.bits, D = 0; D < J.length; ++D) {
249
+ var qt = j.name + "_" + J[D];
250
+ if (T.push(qt), F[qt] = j.createMethod(J[D], j.padding), j.name !== "sha3") {
251
+ var ue = j.name + J[D];
252
+ T.push(ue), F[ue] = F[qt];
193
253
  }
194
254
  }
195
- function B(t, n, o) {
196
- this.blocks = [], this.s = [], this.padding = n, this.outputBits = o, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (t << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = o >> 5, this.extraBytes = (o & 31) >> 3;
197
- for (var l = 0; l < 50; ++l)
198
- this.s[l] = 0;
255
+ function P(t, o, c) {
256
+ this.blocks = [], this.s = [], this.padding = o, this.outputBits = c, this.reset = !0, this.finalized = !1, this.block = 0, this.start = 0, this.blockCount = 1600 - (t << 1) >> 5, this.byteCount = this.blockCount << 2, this.outputBlocks = c >> 5, this.extraBytes = (c & 31) >> 3;
257
+ for (var a = 0; a < 50; ++a)
258
+ this.s[a] = 0;
199
259
  }
200
- B.prototype.update = function(t) {
260
+ P.prototype.update = function(t) {
201
261
  if (this.finalized)
202
262
  throw new Error(e);
203
- var n = k(t);
204
- t = n[0];
205
- for (var o = n[1], l = this.blocks, u = this.byteCount, h = t.length, d = this.blockCount, s = 0, A = this.s, v, m; s < h; ) {
263
+ var o = Ut(t);
264
+ t = o[0];
265
+ for (var c = o[1], a = this.blocks, d = this.byteCount, y = t.length, v = this.blockCount, g = 0, w = this.s, b, _; g < y; ) {
206
266
  if (this.reset)
207
- for (this.reset = !1, l[0] = this.block, v = 1; v < d + 1; ++v)
208
- l[v] = 0;
209
- if (o)
210
- for (v = this.start; s < h && v < u; ++s)
211
- m = t.charCodeAt(s), m < 128 ? l[v >> 2] |= m << P[v++ & 3] : m < 2048 ? (l[v >> 2] |= (192 | m >> 6) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]) : m < 55296 || m >= 57344 ? (l[v >> 2] |= (224 | m >> 12) << P[v++ & 3], l[v >> 2] |= (128 | m >> 6 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]) : (m = 65536 + ((m & 1023) << 10 | t.charCodeAt(++s) & 1023), l[v >> 2] |= (240 | m >> 18) << P[v++ & 3], l[v >> 2] |= (128 | m >> 12 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m >> 6 & 63) << P[v++ & 3], l[v >> 2] |= (128 | m & 63) << P[v++ & 3]);
267
+ for (this.reset = !1, a[0] = this.block, b = 1; b < v + 1; ++b)
268
+ a[b] = 0;
269
+ if (c)
270
+ for (b = this.start; g < y && b < d; ++g)
271
+ _ = t.charCodeAt(g), _ < 128 ? a[b >> 2] |= _ << A[b++ & 3] : _ < 2048 ? (a[b >> 2] |= (192 | _ >> 6) << A[b++ & 3], a[b >> 2] |= (128 | _ & 63) << A[b++ & 3]) : _ < 55296 || _ >= 57344 ? (a[b >> 2] |= (224 | _ >> 12) << A[b++ & 3], a[b >> 2] |= (128 | _ >> 6 & 63) << A[b++ & 3], a[b >> 2] |= (128 | _ & 63) << A[b++ & 3]) : (_ = 65536 + ((_ & 1023) << 10 | t.charCodeAt(++g) & 1023), a[b >> 2] |= (240 | _ >> 18) << A[b++ & 3], a[b >> 2] |= (128 | _ >> 12 & 63) << A[b++ & 3], a[b >> 2] |= (128 | _ >> 6 & 63) << A[b++ & 3], a[b >> 2] |= (128 | _ & 63) << A[b++ & 3]);
212
272
  else
213
- for (v = this.start; s < h && v < u; ++s)
214
- l[v >> 2] |= t[s] << P[v++ & 3];
215
- if (this.lastByteIndex = v, v >= u) {
216
- for (this.start = v - u, this.block = l[d], v = 0; v < d; ++v)
217
- A[v] ^= l[v];
218
- G(A), this.reset = !0;
273
+ for (b = this.start; g < y && b < d; ++g)
274
+ a[b >> 2] |= t[g] << A[b++ & 3];
275
+ if (this.lastByteIndex = b, b >= d) {
276
+ for (this.start = b - d, this.block = a[v], b = 0; b < v; ++b)
277
+ w[b] ^= a[b];
278
+ z(w), this.reset = !0;
219
279
  } else
220
- this.start = v;
280
+ this.start = b;
221
281
  }
222
282
  return this;
223
- }, B.prototype.encode = function(t, n) {
224
- var o = t & 255, l = 1, u = [o];
225
- for (t = t >> 8, o = t & 255; o > 0; )
226
- u.unshift(o), t = t >> 8, o = t & 255, ++l;
227
- return n ? u.push(l) : u.unshift(l), this.update(u), u.length;
228
- }, B.prototype.encodeString = function(t) {
229
- var n = k(t);
230
- t = n[0];
231
- var o = n[1], l = 0, u = t.length;
232
- if (o)
233
- for (var h = 0; h < t.length; ++h) {
234
- var d = t.charCodeAt(h);
235
- d < 128 ? l += 1 : d < 2048 ? l += 2 : d < 55296 || d >= 57344 ? l += 3 : (d = 65536 + ((d & 1023) << 10 | t.charCodeAt(++h) & 1023), l += 4);
283
+ }, P.prototype.encode = function(t, o) {
284
+ var c = t & 255, a = 1, d = [c];
285
+ for (t = t >> 8, c = t & 255; c > 0; )
286
+ d.unshift(c), t = t >> 8, c = t & 255, ++a;
287
+ return o ? d.push(a) : d.unshift(a), this.update(d), d.length;
288
+ }, P.prototype.encodeString = function(t) {
289
+ var o = Ut(t);
290
+ t = o[0];
291
+ var c = o[1], a = 0, d = t.length;
292
+ if (c)
293
+ for (var y = 0; y < t.length; ++y) {
294
+ var v = t.charCodeAt(y);
295
+ v < 128 ? a += 1 : v < 2048 ? a += 2 : v < 55296 || v >= 57344 ? a += 3 : (v = 65536 + ((v & 1023) << 10 | t.charCodeAt(++y) & 1023), a += 4);
236
296
  }
237
297
  else
238
- l = u;
239
- return l += this.encode(l * 8), this.update(t), l;
240
- }, B.prototype.bytepad = function(t, n) {
241
- for (var o = this.encode(n), l = 0; l < t.length; ++l)
242
- o += this.encodeString(t[l]);
243
- var u = (n - o % n) % n, h = [];
244
- return h.length = u, this.update(h), this;
245
- }, B.prototype.finalize = function() {
298
+ a = d;
299
+ return a += this.encode(a * 8), this.update(t), a;
300
+ }, P.prototype.bytepad = function(t, o) {
301
+ for (var c = this.encode(o), a = 0; a < t.length; ++a)
302
+ c += this.encodeString(t[a]);
303
+ var d = (o - c % o) % o, y = [];
304
+ return y.length = d, this.update(y), this;
305
+ }, P.prototype.finalize = function() {
246
306
  if (!this.finalized) {
247
307
  this.finalized = !0;
248
- var t = this.blocks, n = this.lastByteIndex, o = this.blockCount, l = this.s;
249
- if (t[n >> 2] |= this.padding[n & 3], this.lastByteIndex === this.byteCount)
250
- for (t[0] = t[o], n = 1; n < o + 1; ++n)
251
- t[n] = 0;
252
- for (t[o - 1] |= 2147483648, n = 0; n < o; ++n)
253
- l[n] ^= t[n];
254
- G(l);
308
+ var t = this.blocks, o = this.lastByteIndex, c = this.blockCount, a = this.s;
309
+ if (t[o >> 2] |= this.padding[o & 3], this.lastByteIndex === this.byteCount)
310
+ for (t[0] = t[c], o = 1; o < c + 1; ++o)
311
+ t[o] = 0;
312
+ for (t[c - 1] |= 2147483648, o = 0; o < c; ++o)
313
+ a[o] ^= t[o];
314
+ z(a);
255
315
  }
256
- }, B.prototype.toString = B.prototype.hex = function() {
316
+ }, P.prototype.toString = P.prototype.hex = function() {
257
317
  this.finalize();
258
- for (var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = "", s; h < o; ) {
259
- for (u = 0; u < t && h < o; ++u, ++h)
260
- s = n[u], d += g[s >> 4 & 15] + g[s & 15] + g[s >> 12 & 15] + g[s >> 8 & 15] + g[s >> 20 & 15] + g[s >> 16 & 15] + g[s >> 28 & 15] + g[s >> 24 & 15];
261
- h % t === 0 && (n = C(n), G(n), u = 0);
318
+ for (var t = this.blockCount, o = this.s, c = this.outputBlocks, a = this.extraBytes, d = 0, y = 0, v = "", g; y < c; ) {
319
+ for (d = 0; d < t && y < c; ++d, ++y)
320
+ g = o[d], v += h[g >> 4 & 15] + h[g & 15] + h[g >> 12 & 15] + h[g >> 8 & 15] + h[g >> 20 & 15] + h[g >> 16 & 15] + h[g >> 28 & 15] + h[g >> 24 & 15];
321
+ y % t === 0 && (o = Vt(o), z(o), d = 0);
262
322
  }
263
- return l && (s = n[u], d += g[s >> 4 & 15] + g[s & 15], l > 1 && (d += g[s >> 12 & 15] + g[s >> 8 & 15]), l > 2 && (d += g[s >> 20 & 15] + g[s >> 16 & 15])), d;
264
- }, B.prototype.arrayBuffer = function() {
323
+ return a && (g = o[d], v += h[g >> 4 & 15] + h[g & 15], a > 1 && (v += h[g >> 12 & 15] + h[g >> 8 & 15]), a > 2 && (v += h[g >> 20 & 15] + h[g >> 16 & 15])), v;
324
+ }, P.prototype.arrayBuffer = function() {
265
325
  this.finalize();
266
- var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = this.outputBits >> 3, s;
267
- l ? s = new ArrayBuffer(o + 1 << 2) : s = new ArrayBuffer(d);
268
- for (var A = new Uint32Array(s); h < o; ) {
269
- for (u = 0; u < t && h < o; ++u, ++h)
270
- A[h] = n[u];
271
- h % t === 0 && (n = C(n), G(n));
326
+ var t = this.blockCount, o = this.s, c = this.outputBlocks, a = this.extraBytes, d = 0, y = 0, v = this.outputBits >> 3, g;
327
+ a ? g = new ArrayBuffer(c + 1 << 2) : g = new ArrayBuffer(v);
328
+ for (var w = new Uint32Array(g); y < c; ) {
329
+ for (d = 0; d < t && y < c; ++d, ++y)
330
+ w[y] = o[d];
331
+ y % t === 0 && (o = Vt(o), z(o));
272
332
  }
273
- return l && (A[h] = n[u], s = s.slice(0, d)), s;
274
- }, B.prototype.buffer = B.prototype.arrayBuffer, B.prototype.digest = B.prototype.array = function() {
333
+ return a && (w[y] = o[d], g = g.slice(0, v)), g;
334
+ }, P.prototype.buffer = P.prototype.arrayBuffer, P.prototype.digest = P.prototype.array = function() {
275
335
  this.finalize();
276
- for (var t = this.blockCount, n = this.s, o = this.outputBlocks, l = this.extraBytes, u = 0, h = 0, d = [], s, A; h < o; ) {
277
- for (u = 0; u < t && h < o; ++u, ++h)
278
- s = h << 2, A = n[u], d[s] = A & 255, d[s + 1] = A >> 8 & 255, d[s + 2] = A >> 16 & 255, d[s + 3] = A >> 24 & 255;
279
- h % t === 0 && (n = C(n), G(n));
336
+ for (var t = this.blockCount, o = this.s, c = this.outputBlocks, a = this.extraBytes, d = 0, y = 0, v = [], g, w; y < c; ) {
337
+ for (d = 0; d < t && y < c; ++d, ++y)
338
+ g = y << 2, w = o[d], v[g] = w & 255, v[g + 1] = w >> 8 & 255, v[g + 2] = w >> 16 & 255, v[g + 3] = w >> 24 & 255;
339
+ y % t === 0 && (o = Vt(o), z(o));
280
340
  }
281
- return l && (s = h << 2, A = n[u], d[s] = A & 255, l > 1 && (d[s + 1] = A >> 8 & 255), l > 2 && (d[s + 2] = A >> 16 & 255)), d;
341
+ return a && (g = y << 2, w = o[d], v[g] = w & 255, a > 1 && (v[g + 1] = w >> 8 & 255), a > 2 && (v[g + 2] = w >> 16 & 255)), v;
282
342
  };
283
- function Xt(t, n, o) {
284
- B.call(this, t, n, o);
343
+ function $t(t, o, c) {
344
+ P.call(this, t, o, c);
285
345
  }
286
- Xt.prototype = new B(), Xt.prototype.finalize = function() {
287
- return this.encode(this.outputBits, !0), B.prototype.finalize.call(this);
346
+ $t.prototype = new P(), $t.prototype.finalize = function() {
347
+ return this.encode(this.outputBits, !0), P.prototype.finalize.call(this);
288
348
  };
289
- var G = function(t) {
290
- var n, o, l, u, h, d, s, A, v, m, Z, Q, X, tt, et, rt, nt, it, ot, lt, ct, at, ft, ut, ht, st, dt, pt, yt, vt, gt, bt, St, kt, mt, _t, xt, Bt, At, Pt, wt, Ct, Et, Ot, It, Ft, Nt, jt, Kt, Mt, Tt, zt, Dt, Rt, Wt, Jt, Ht, Ut, Vt, Gt, $t, qt, Lt;
291
- for (l = 0; l < 48; l += 2)
292
- u = t[0] ^ t[10] ^ t[20] ^ t[30] ^ t[40], h = t[1] ^ t[11] ^ t[21] ^ t[31] ^ t[41], d = t[2] ^ t[12] ^ t[22] ^ t[32] ^ t[42], s = t[3] ^ t[13] ^ t[23] ^ t[33] ^ t[43], A = t[4] ^ t[14] ^ t[24] ^ t[34] ^ t[44], v = t[5] ^ t[15] ^ t[25] ^ t[35] ^ t[45], m = t[6] ^ t[16] ^ t[26] ^ t[36] ^ t[46], Z = t[7] ^ t[17] ^ t[27] ^ t[37] ^ t[47], Q = t[8] ^ t[18] ^ t[28] ^ t[38] ^ t[48], X = t[9] ^ t[19] ^ t[29] ^ t[39] ^ t[49], n = Q ^ (d << 1 | s >>> 31), o = X ^ (s << 1 | d >>> 31), t[0] ^= n, t[1] ^= o, t[10] ^= n, t[11] ^= o, t[20] ^= n, t[21] ^= o, t[30] ^= n, t[31] ^= o, t[40] ^= n, t[41] ^= o, n = u ^ (A << 1 | v >>> 31), o = h ^ (v << 1 | A >>> 31), t[2] ^= n, t[3] ^= o, t[12] ^= n, t[13] ^= o, t[22] ^= n, t[23] ^= o, t[32] ^= n, t[33] ^= o, t[42] ^= n, t[43] ^= o, n = d ^ (m << 1 | Z >>> 31), o = s ^ (Z << 1 | m >>> 31), t[4] ^= n, t[5] ^= o, t[14] ^= n, t[15] ^= o, t[24] ^= n, t[25] ^= o, t[34] ^= n, t[35] ^= o, t[44] ^= n, t[45] ^= o, n = A ^ (Q << 1 | X >>> 31), o = v ^ (X << 1 | Q >>> 31), t[6] ^= n, t[7] ^= o, t[16] ^= n, t[17] ^= o, t[26] ^= n, t[27] ^= o, t[36] ^= n, t[37] ^= o, t[46] ^= n, t[47] ^= o, n = m ^ (u << 1 | h >>> 31), o = Z ^ (h << 1 | u >>> 31), t[8] ^= n, t[9] ^= o, t[18] ^= n, t[19] ^= o, t[28] ^= n, t[29] ^= o, t[38] ^= n, t[39] ^= o, t[48] ^= n, t[49] ^= o, tt = t[0], et = t[1], Ft = t[11] << 4 | t[10] >>> 28, Nt = t[10] << 4 | t[11] >>> 28, pt = t[20] << 3 | t[21] >>> 29, yt = t[21] << 3 | t[20] >>> 29, Gt = t[31] << 9 | t[30] >>> 23, $t = t[30] << 9 | t[31] >>> 23, Ct = t[40] << 18 | t[41] >>> 14, Et = t[41] << 18 | t[40] >>> 14, kt = t[2] << 1 | t[3] >>> 31, mt = t[3] << 1 | t[2] >>> 31, rt = t[13] << 12 | t[12] >>> 20, nt = t[12] << 12 | t[13] >>> 20, jt = t[22] << 10 | t[23] >>> 22, Kt = t[23] << 10 | t[22] >>> 22, vt = t[33] << 13 | t[32] >>> 19, gt = t[32] << 13 | t[33] >>> 19, qt = t[42] << 2 | t[43] >>> 30, Lt = t[43] << 2 | t[42] >>> 30, Rt = t[5] << 30 | t[4] >>> 2, Wt = t[4] << 30 | t[5] >>> 2, _t = t[14] << 6 | t[15] >>> 26, xt = t[15] << 6 | t[14] >>> 26, it = t[25] << 11 | t[24] >>> 21, ot = t[24] << 11 | t[25] >>> 21, Mt = t[34] << 15 | t[35] >>> 17, Tt = t[35] << 15 | t[34] >>> 17, bt = t[45] << 29 | t[44] >>> 3, St = t[44] << 29 | t[45] >>> 3, ut = t[6] << 28 | t[7] >>> 4, ht = t[7] << 28 | t[6] >>> 4, Jt = t[17] << 23 | t[16] >>> 9, Ht = t[16] << 23 | t[17] >>> 9, Bt = t[26] << 25 | t[27] >>> 7, At = t[27] << 25 | t[26] >>> 7, lt = t[36] << 21 | t[37] >>> 11, ct = t[37] << 21 | t[36] >>> 11, zt = t[47] << 24 | t[46] >>> 8, Dt = t[46] << 24 | t[47] >>> 8, Ot = t[8] << 27 | t[9] >>> 5, It = t[9] << 27 | t[8] >>> 5, st = t[18] << 20 | t[19] >>> 12, dt = t[19] << 20 | t[18] >>> 12, Ut = t[29] << 7 | t[28] >>> 25, Vt = t[28] << 7 | t[29] >>> 25, Pt = t[38] << 8 | t[39] >>> 24, wt = t[39] << 8 | t[38] >>> 24, at = t[48] << 14 | t[49] >>> 18, ft = t[49] << 14 | t[48] >>> 18, t[0] = tt ^ ~rt & it, t[1] = et ^ ~nt & ot, t[10] = ut ^ ~st & pt, t[11] = ht ^ ~dt & yt, t[20] = kt ^ ~_t & Bt, t[21] = mt ^ ~xt & At, t[30] = Ot ^ ~Ft & jt, t[31] = It ^ ~Nt & Kt, t[40] = Rt ^ ~Jt & Ut, t[41] = Wt ^ ~Ht & Vt, t[2] = rt ^ ~it & lt, t[3] = nt ^ ~ot & ct, t[12] = st ^ ~pt & vt, t[13] = dt ^ ~yt & gt, t[22] = _t ^ ~Bt & Pt, t[23] = xt ^ ~At & wt, t[32] = Ft ^ ~jt & Mt, t[33] = Nt ^ ~Kt & Tt, t[42] = Jt ^ ~Ut & Gt, t[43] = Ht ^ ~Vt & $t, t[4] = it ^ ~lt & at, t[5] = ot ^ ~ct & ft, t[14] = pt ^ ~vt & bt, t[15] = yt ^ ~gt & St, t[24] = Bt ^ ~Pt & Ct, t[25] = At ^ ~wt & Et, t[34] = jt ^ ~Mt & zt, t[35] = Kt ^ ~Tt & Dt, t[44] = Ut ^ ~Gt & qt, t[45] = Vt ^ ~$t & Lt, t[6] = lt ^ ~at & tt, t[7] = ct ^ ~ft & et, t[16] = vt ^ ~bt & ut, t[17] = gt ^ ~St & ht, t[26] = Pt ^ ~Ct & kt, t[27] = wt ^ ~Et & mt, t[36] = Mt ^ ~zt & Ot, t[37] = Tt ^ ~Dt & It, t[46] = Gt ^ ~qt & Rt, t[47] = $t ^ ~Lt & Wt, t[8] = at ^ ~tt & rt, t[9] = ft ^ ~et & nt, t[18] = bt ^ ~ut & st, t[19] = St ^ ~ht & dt, t[28] = Ct ^ ~kt & _t, t[29] = Et ^ ~mt & xt, t[38] = zt ^ ~Ot & Ft, t[39] = Dt ^ ~It & Nt, t[48] = qt ^ ~Rt & Jt, t[49] = Lt ^ ~Wt & Ht, t[0] ^= D[l], t[1] ^= D[l + 1];
349
+ var z = function(t) {
350
+ var o, c, a, d, y, v, g, w, b, _, H, U, V, q, $, L, G, Y, Q, Z, X, tt, et, nt, rt, it, ot, lt, ut, ct, at, ft, ht, st, dt, pt, yt, gt, vt, bt, mt, kt, St, At, Bt, _t, Pt, wt, xt, Ct, Ot, Et, Ft, Kt, It, jt, Nt, Mt, Tt, Dt, zt, Rt, Wt;
351
+ for (a = 0; a < 48; a += 2)
352
+ d = t[0] ^ t[10] ^ t[20] ^ t[30] ^ t[40], y = t[1] ^ t[11] ^ t[21] ^ t[31] ^ t[41], v = t[2] ^ t[12] ^ t[22] ^ t[32] ^ t[42], g = t[3] ^ t[13] ^ t[23] ^ t[33] ^ t[43], w = t[4] ^ t[14] ^ t[24] ^ t[34] ^ t[44], b = t[5] ^ t[15] ^ t[25] ^ t[35] ^ t[45], _ = t[6] ^ t[16] ^ t[26] ^ t[36] ^ t[46], H = t[7] ^ t[17] ^ t[27] ^ t[37] ^ t[47], U = t[8] ^ t[18] ^ t[28] ^ t[38] ^ t[48], V = t[9] ^ t[19] ^ t[29] ^ t[39] ^ t[49], o = U ^ (v << 1 | g >>> 31), c = V ^ (g << 1 | v >>> 31), t[0] ^= o, t[1] ^= c, t[10] ^= o, t[11] ^= c, t[20] ^= o, t[21] ^= c, t[30] ^= o, t[31] ^= c, t[40] ^= o, t[41] ^= c, o = d ^ (w << 1 | b >>> 31), c = y ^ (b << 1 | w >>> 31), t[2] ^= o, t[3] ^= c, t[12] ^= o, t[13] ^= c, t[22] ^= o, t[23] ^= c, t[32] ^= o, t[33] ^= c, t[42] ^= o, t[43] ^= c, o = v ^ (_ << 1 | H >>> 31), c = g ^ (H << 1 | _ >>> 31), t[4] ^= o, t[5] ^= c, t[14] ^= o, t[15] ^= c, t[24] ^= o, t[25] ^= c, t[34] ^= o, t[35] ^= c, t[44] ^= o, t[45] ^= c, o = w ^ (U << 1 | V >>> 31), c = b ^ (V << 1 | U >>> 31), t[6] ^= o, t[7] ^= c, t[16] ^= o, t[17] ^= c, t[26] ^= o, t[27] ^= c, t[36] ^= o, t[37] ^= c, t[46] ^= o, t[47] ^= c, o = _ ^ (d << 1 | y >>> 31), c = H ^ (y << 1 | d >>> 31), t[8] ^= o, t[9] ^= c, t[18] ^= o, t[19] ^= c, t[28] ^= o, t[29] ^= c, t[38] ^= o, t[39] ^= c, t[48] ^= o, t[49] ^= c, q = t[0], $ = t[1], _t = t[11] << 4 | t[10] >>> 28, Pt = t[10] << 4 | t[11] >>> 28, lt = t[20] << 3 | t[21] >>> 29, ut = t[21] << 3 | t[20] >>> 29, Dt = t[31] << 9 | t[30] >>> 23, zt = t[30] << 9 | t[31] >>> 23, kt = t[40] << 18 | t[41] >>> 14, St = t[41] << 18 | t[40] >>> 14, st = t[2] << 1 | t[3] >>> 31, dt = t[3] << 1 | t[2] >>> 31, L = t[13] << 12 | t[12] >>> 20, G = t[12] << 12 | t[13] >>> 20, wt = t[22] << 10 | t[23] >>> 22, xt = t[23] << 10 | t[22] >>> 22, ct = t[33] << 13 | t[32] >>> 19, at = t[32] << 13 | t[33] >>> 19, Rt = t[42] << 2 | t[43] >>> 30, Wt = t[43] << 2 | t[42] >>> 30, Kt = t[5] << 30 | t[4] >>> 2, It = t[4] << 30 | t[5] >>> 2, pt = t[14] << 6 | t[15] >>> 26, yt = t[15] << 6 | t[14] >>> 26, Y = t[25] << 11 | t[24] >>> 21, Q = t[24] << 11 | t[25] >>> 21, Ct = t[34] << 15 | t[35] >>> 17, Ot = t[35] << 15 | t[34] >>> 17, ft = t[45] << 29 | t[44] >>> 3, ht = t[44] << 29 | t[45] >>> 3, nt = t[6] << 28 | t[7] >>> 4, rt = t[7] << 28 | t[6] >>> 4, jt = t[17] << 23 | t[16] >>> 9, Nt = t[16] << 23 | t[17] >>> 9, gt = t[26] << 25 | t[27] >>> 7, vt = t[27] << 25 | t[26] >>> 7, Z = t[36] << 21 | t[37] >>> 11, X = t[37] << 21 | t[36] >>> 11, Et = t[47] << 24 | t[46] >>> 8, Ft = t[46] << 24 | t[47] >>> 8, At = t[8] << 27 | t[9] >>> 5, Bt = t[9] << 27 | t[8] >>> 5, it = t[18] << 20 | t[19] >>> 12, ot = t[19] << 20 | t[18] >>> 12, Mt = t[29] << 7 | t[28] >>> 25, Tt = t[28] << 7 | t[29] >>> 25, bt = t[38] << 8 | t[39] >>> 24, mt = t[39] << 8 | t[38] >>> 24, tt = t[48] << 14 | t[49] >>> 18, et = t[49] << 14 | t[48] >>> 18, t[0] = q ^ ~L & Y, t[1] = $ ^ ~G & Q, t[10] = nt ^ ~it & lt, t[11] = rt ^ ~ot & ut, t[20] = st ^ ~pt & gt, t[21] = dt ^ ~yt & vt, t[30] = At ^ ~_t & wt, t[31] = Bt ^ ~Pt & xt, t[40] = Kt ^ ~jt & Mt, t[41] = It ^ ~Nt & Tt, t[2] = L ^ ~Y & Z, t[3] = G ^ ~Q & X, t[12] = it ^ ~lt & ct, t[13] = ot ^ ~ut & at, t[22] = pt ^ ~gt & bt, t[23] = yt ^ ~vt & mt, t[32] = _t ^ ~wt & Ct, t[33] = Pt ^ ~xt & Ot, t[42] = jt ^ ~Mt & Dt, t[43] = Nt ^ ~Tt & zt, t[4] = Y ^ ~Z & tt, t[5] = Q ^ ~X & et, t[14] = lt ^ ~ct & ft, t[15] = ut ^ ~at & ht, t[24] = gt ^ ~bt & kt, t[25] = vt ^ ~mt & St, t[34] = wt ^ ~Ct & Et, t[35] = xt ^ ~Ot & Ft, t[44] = Mt ^ ~Dt & Rt, t[45] = Tt ^ ~zt & Wt, t[6] = Z ^ ~tt & q, t[7] = X ^ ~et & $, t[16] = ct ^ ~ft & nt, t[17] = at ^ ~ht & rt, t[26] = bt ^ ~kt & st, t[27] = mt ^ ~St & dt, t[36] = Ct ^ ~Et & At, t[37] = Ot ^ ~Ft & Bt, t[46] = Dt ^ ~Rt & Kt, t[47] = zt ^ ~Wt & It, t[8] = tt ^ ~q & L, t[9] = et ^ ~$ & G, t[18] = ft ^ ~nt & it, t[19] = ht ^ ~rt & ot, t[28] = kt ^ ~st & pt, t[29] = St ^ ~dt & yt, t[38] = Et ^ ~At & _t, t[39] = Ft ^ ~Bt & Pt, t[48] = Rt ^ ~Kt & jt, t[49] = Wt ^ ~It & Nt, t[0] ^= x[a], t[1] ^= x[a + 1];
293
353
  };
294
- if (b)
295
- c.exports = M;
354
+ if (p)
355
+ l.exports = F;
296
356
  else
297
- for (T = 0; T < U.length; ++T)
298
- i[U[T]] = M[U[T]];
357
+ for (K = 0; K < T.length; ++K)
358
+ r[T[K]] = F[T[K]];
299
359
  })();
300
- })(ee)), ee.exports;
360
+ })(Yt)), Yt.exports;
301
361
  }
302
- var _e = me();
303
- const xe = /* @__PURE__ */ ke(_e), { keccak256: he } = xe;
304
- function ne(c) {
305
- return new TextEncoder().encode(c);
362
+ var Fe = Ee();
363
+ const Ke = /* @__PURE__ */ Oe(Fe), { keccak256: fe } = Ke;
364
+ function Zt(l) {
365
+ return new TextEncoder().encode(l);
306
366
  }
307
- function Be(c) {
308
- const r = c.startsWith("0x") ? c.slice(2) : c, e = new Uint8Array(r.length / 2);
309
- for (let a = 0; a < e.length; a++)
310
- e[a] = parseInt(r.substring(a * 2, a * 2 + 2), 16);
367
+ function Ie(l) {
368
+ const n = l.startsWith("0x") ? l.slice(2) : l, e = new Uint8Array(n.length / 2);
369
+ for (let i = 0; i < e.length; i++)
370
+ e[i] = parseInt(n.substring(i * 2, i * 2 + 2), 16);
311
371
  return e;
312
372
  }
313
- function Ae(c) {
314
- let r = "";
315
- for (let e = 0; e < c.length; e++)
316
- r += c[e].toString(16).padStart(2, "0");
317
- return "0x" + r;
373
+ function je(l) {
374
+ let n = "";
375
+ for (let e = 0; e < l.length; e++)
376
+ n += l[e].toString(16).padStart(2, "0");
377
+ return "0x" + n;
318
378
  }
319
- function fe(c, r, e) {
320
- const a = JSON.stringify(c), i = ne(a), f = he(r + ":" + e.join(".")), p = ne(f), b = new Uint8Array(i.length);
321
- for (let y = 0; y < i.length; y++)
322
- b[y] = i[y] ^ p[y % p.length];
323
- return Ae(b);
379
+ function Qt(l, n, e) {
380
+ const i = JSON.stringify(l), r = Zt(i), u = fe(n + ":" + e.join(".")), f = Zt(u), p = new Uint8Array(r.length);
381
+ for (let s = 0; s < r.length; s++)
382
+ p[s] = r[s] ^ f[s % f.length];
383
+ return je(p);
324
384
  }
325
- function re(c, r, e) {
385
+ function Jt(l, n, e) {
326
386
  try {
327
- const a = Be(c), i = he(r + ":" + e.join(".")), f = ne(i), p = new Uint8Array(a.length);
328
- for (let y = 0; y < a.length; y++)
329
- p[y] = a[y] ^ f[y % f.length];
330
- const b = new TextDecoder().decode(p);
331
- return JSON.parse(b);
387
+ const i = Ie(l), r = fe(n + ":" + e.join(".")), u = Zt(r), f = new Uint8Array(i.length);
388
+ for (let s = 0; s < i.length; s++)
389
+ f[s] = i[s] ^ u[s % u.length];
390
+ const p = new TextDecoder().decode(f);
391
+ return JSON.parse(p);
332
392
  } catch {
333
393
  return null;
334
394
  }
335
395
  }
336
- function Pe(c) {
337
- if (typeof c != "string" || !c.startsWith("0x")) return !1;
338
- const r = c.slice(2);
339
- return r.length < 2 || r.length % 2 !== 0 ? !1 : /^[0-9a-fA-F]+$/.test(r);
396
+ function Ne(l) {
397
+ if (typeof l != "string" || !l.startsWith("0x")) return !1;
398
+ const n = l.slice(2);
399
+ return n.length < 2 || n.length % 2 !== 0 ? !1 : /^[0-9a-fA-F]+$/.test(n);
340
400
  }
341
- function we(c, r, e) {
342
- if (r.length === 0) {
401
+ function Me(l, n, e) {
402
+ if (n.length === 0) {
343
403
  if (e.length === 1 && typeof e[0] == "string") {
344
- const S = e[0].trim(), O = S.startsWith("_") || S.startsWith("~") || S.startsWith("@"), W = S.includes("."), z = /^[a-zA-Z][a-zA-Z0-9_-]*$/.test(S);
345
- if (W || O || z) {
346
- const P = S.split(".").filter(Boolean);
347
- return c.readPath(P);
404
+ const k = e[0].trim(), m = k.startsWith("_") || k.startsWith("~") || k.startsWith("@"), S = k.includes("."), B = /^[a-zA-Z][a-zA-Z0-9_-]*$/.test(k);
405
+ if (S || m || B) {
406
+ const A = k.split(".").filter(Boolean);
407
+ return l.readPath(A);
348
408
  }
349
409
  }
350
410
  if (e.length === 0)
351
- return c.createProxy([]);
352
- const y = c.normalizeArgs(e), g = c.postulate([], y);
353
- return g !== void 0 ? g : c.createProxy([]);
411
+ return l.createProxy([]);
412
+ const s = l.normalizeArgs(e), h = l.postulate([], s);
413
+ return h !== void 0 ? h : l.createProxy([]);
414
+ }
415
+ const i = l.normalizeArgs(e), r = l.postulate(n, i), { scope: u, leaf: f } = l.splitPath(n), p = f ? l.opKind(f) : null;
416
+ if (l.isThought(r)) {
417
+ const s = p ? u : n;
418
+ return l.createProxy(s);
419
+ }
420
+ return r !== void 0 ? r : l.createProxy(n);
421
+ }
422
+ function Te(l, n, e = {}) {
423
+ const { path: i, expression: r } = n, u = ke(i, r);
424
+ if (u)
425
+ return {
426
+ kind: "return",
427
+ value: {
428
+ define: u
429
+ }
430
+ };
431
+ const f = Se(l, i, r);
432
+ if (f)
433
+ return {
434
+ kind: "commit",
435
+ instructions: [{ path: f.scopeKey ? f.scopeKey.split(".").filter(Boolean) : [], op: "secret", value: r }]
436
+ };
437
+ const p = Ae(l, i, r);
438
+ if (p)
439
+ return {
440
+ kind: "commit",
441
+ instructions: [{ path: p.scopeKey ? p.scopeKey.split(".").filter(Boolean) : [], op: "noise", value: r }]
442
+ };
443
+ const s = Be(l, i, r);
444
+ if (s) {
445
+ const { scope: B } = C(i);
446
+ return {
447
+ kind: "commit",
448
+ instructions: [{ path: B, op: "ptr", value: ve(s.targetPath) }]
449
+ };
354
450
  }
355
- const a = c.normalizeArgs(e), i = c.postulate(r, a), { scope: f, leaf: p } = c.splitPath(r), b = p ? c.opKind(p) : null;
356
- if (c.isThought(i)) {
357
- const y = b ? f : r;
358
- return c.createProxy(y);
451
+ const h = _e(l, i, r);
452
+ if (h)
453
+ return {
454
+ kind: "commit",
455
+ instructions: [{ path: h.targetPath, op: "id", value: be(h.id) }]
456
+ };
457
+ const k = xe(l, i, r);
458
+ if (k)
459
+ return {
460
+ kind: "commit",
461
+ instructions: [{ path: k.targetPath, op: "remove", value: "-" }]
462
+ };
463
+ const m = Pe(l, i, r);
464
+ if (m) {
465
+ if (m.mode === "assign")
466
+ return {
467
+ kind: "commit",
468
+ instructions: [
469
+ {
470
+ path: [...m.targetPath, m.name],
471
+ op: "derive",
472
+ value: {
473
+ kind: "expr",
474
+ source: m.expr
475
+ }
476
+ }
477
+ ]
478
+ };
479
+ if (!e.evaluateThunk)
480
+ throw new Error('Non-serializable derivation: "=" thunk requires `evaluateThunk` or serializable DNA.');
481
+ const B = e.evaluateThunk(m.thunk);
482
+ return m.targetPath.length === 0 ? { kind: "return", value: B } : {
483
+ kind: "commit",
484
+ instructions: [{ path: m.targetPath, op: "derive", value: B }]
485
+ };
486
+ }
487
+ const S = we(l, i, r);
488
+ if (S) {
489
+ if (!e.readPath)
490
+ return {
491
+ kind: "commit",
492
+ instructions: [
493
+ {
494
+ path: S.targetPath,
495
+ op: "query",
496
+ value: { paths: S.paths }
497
+ }
498
+ ]
499
+ };
500
+ const B = S.paths.map((x) => e.readPath(x.split(".").filter(Boolean))), A = S.fn ? S.fn(...B) : B;
501
+ return S.targetPath.length === 0 ? { kind: "return", value: A } : {
502
+ kind: "commit",
503
+ instructions: [{ path: S.targetPath, op: "query", value: A }]
504
+ };
359
505
  }
360
- return i !== void 0 ? i : c.createProxy(r);
506
+ return {
507
+ kind: "commit",
508
+ instructions: [{ path: i, op: "set", value: r }]
509
+ };
361
510
  }
362
- const ue = "+";
363
- function R(c) {
364
- let r = 2166136261;
365
- for (let e = 0; e < c.length; e++)
366
- r ^= c.charCodeAt(e), r = Math.imul(r, 16777619);
367
- return ("00000000" + (r >>> 0).toString(16)).slice(-8);
511
+ const ae = "+";
512
+ function R(l) {
513
+ let n = 2166136261;
514
+ for (let e = 0; e < l.length; e++)
515
+ n ^= l.charCodeAt(e), n = Math.imul(n, 16777619);
516
+ return ("00000000" + (n >>> 0).toString(16)).slice(-8);
368
517
  }
369
- class se {
518
+ class he {
370
519
  /**
371
520
  * Constructor base:
372
521
  * me = new ME(expression?)
@@ -374,7 +523,7 @@ class se {
374
523
  * Esto es equivalente a llamar:
375
524
  * me(expression) en la raíz.
376
525
  */
377
- constructor(r) {
526
+ constructor(n) {
378
527
  this.localSecrets = {}, this.localNoises = {}, this.encryptedBranches = {}, this.index = {}, this._shortTermMemory = [], this.operators = {
379
528
  _: { kind: "secret" },
380
529
  "~": { kind: "noise" },
@@ -393,55 +542,55 @@ class se {
393
542
  "=": { kind: "eval" },
394
543
  "?": { kind: "query" },
395
544
  "-": { kind: "remove" }
396
- }, this._shortTermMemory = [], r !== void 0 && this.postulate([], r), this.rebuildIndex();
545
+ }, this._shortTermMemory = [], n !== void 0 && this.postulate([], n), this.rebuildIndex();
397
546
  const e = this.createProxy([]);
398
- return Object.setPrototypeOf(e, se.prototype), Object.assign(e, this), e;
547
+ return Object.setPrototypeOf(e, he.prototype), Object.assign(e, this), e;
399
548
  }
400
549
  // semantic accessor (property-style)
401
550
  get shortTermMemory() {
402
551
  return this._shortTermMemory;
403
552
  }
404
- isRemoveCall(r, e) {
405
- if (r.length === 0) return null;
406
- const { scope: a, leaf: i } = N(r);
407
- if (!i || this.opKind(i) !== "remove") return null;
553
+ isRemoveCall(n, e) {
554
+ if (n.length === 0) return null;
555
+ const { scope: i, leaf: r } = C(n);
556
+ if (!r || this.opKind(r) !== "remove") return null;
408
557
  if (e == null)
409
- return { targetPath: a };
558
+ return { targetPath: i };
410
559
  if (typeof e == "string") {
411
- const f = e.split(".").filter(Boolean);
412
- return { targetPath: [...a, ...f] };
560
+ const u = e.split(".").filter(Boolean);
561
+ return { targetPath: [...i, ...u] };
413
562
  }
414
563
  return null;
415
564
  }
416
565
  // ---------------------------------------------------------
417
566
  // Proxy infinito: me.foo.bar(...triada)
418
567
  // ---------------------------------------------------------
419
- createProxy(r) {
420
- const e = this, a = (...i) => we(
568
+ createProxy(n) {
569
+ const e = this, i = (...r) => Me(
421
570
  {
422
- createProxy: (f) => e.createProxy(f),
423
- normalizeArgs: (f) => e.normalizeArgs(f),
424
- readPath: (f) => e.readPath(f),
425
- postulate: (f, p) => e.postulate(f, p),
426
- opKind: (f) => e.opKind(f),
427
- splitPath: N,
428
- isThought: be
571
+ createProxy: (u) => e.createProxy(u),
572
+ normalizeArgs: (u) => e.normalizeArgs(u),
573
+ readPath: (u) => e.readPath(u),
574
+ postulate: (u, f) => e.postulate(u, f),
575
+ opKind: (u) => e.opKind(u),
576
+ splitPath: C,
577
+ isThought: me
429
578
  },
430
- r,
431
- i
579
+ n,
580
+ r
432
581
  );
433
- return new Proxy(a, {
434
- get(i, f) {
435
- if (typeof f == "symbol") return i[f];
436
- if (f in e) {
437
- const b = e[f];
438
- return typeof b == "function" ? b.bind(e) : b;
582
+ return new Proxy(i, {
583
+ get(r, u) {
584
+ if (typeof u == "symbol") return r[u];
585
+ if (u in e) {
586
+ const p = e[u];
587
+ return typeof p == "function" ? p.bind(e) : p;
439
588
  }
440
- const p = [...r, String(f)];
441
- return e.createProxy(p);
589
+ const f = [...n, String(u)];
590
+ return e.createProxy(f);
442
591
  },
443
- apply(i, f, p) {
444
- return Reflect.apply(i, void 0, p);
592
+ apply(r, u, f) {
593
+ return Reflect.apply(r, void 0, f);
445
594
  }
446
595
  });
447
596
  }
@@ -453,324 +602,363 @@ class se {
453
602
  // me["?"](["a.b"], fn)
454
603
  // For normal writes, keep single-arg semantics.
455
604
  // NOTE: secrets are declared structurally via _("..."), not as args.
456
- normalizeArgs(r) {
457
- if (r.length !== 0)
458
- return r.length === 1 ? r[0] : r;
459
- }
460
- opKind(r) {
461
- return this.operators[r]?.kind ?? null;
462
- }
463
- isSecretScopeCall(r, e) {
464
- if (r.length === 0) return null;
465
- const { scope: a, leaf: i } = N(r);
466
- return !i || this.opKind(i) !== "secret" || typeof e != "string" ? null : { scopeKey: a.join(".") };
467
- }
468
- isNoiseScopeCall(r, e) {
469
- if (r.length === 0) return null;
470
- const { scope: a, leaf: i } = N(r);
471
- return !i || this.opKind(i) !== "noise" || typeof e != "string" ? null : { scopeKey: a.join(".") };
472
- }
473
- isPointerCall(r, e) {
474
- if (r.length === 0) return null;
475
- const { leaf: a } = N(r);
476
- if (!a || this.opKind(a) !== "pointer" || typeof e != "string") return null;
477
- const i = e.trim().replace(/^\./, "");
478
- return i ? { targetPath: i } : null;
479
- }
480
- isIdentityCall(r, e) {
481
- if (r.length === 1 && this.opKind(r[0]) === "identity")
482
- return typeof e != "string" ? null : { id: ce(e), targetPath: [] };
483
- const { scope: a, leaf: i } = N(r);
484
- return !i || this.opKind(i) !== "identity" || typeof e != "string" ? null : { id: ce(e), targetPath: a };
485
- }
486
- isEvalCall(r, e) {
487
- if (r.length === 0) return null;
488
- const { scope: a, leaf: i } = N(r);
489
- if (!i || this.opKind(i) !== "eval") return null;
605
+ normalizeArgs(n) {
606
+ if (n.length !== 0)
607
+ return n.length === 1 ? n[0] : n;
608
+ }
609
+ opKind(n) {
610
+ return this.operators[n]?.kind ?? null;
611
+ }
612
+ isSecretScopeCall(n, e) {
613
+ if (n.length === 0) return null;
614
+ const { scope: i, leaf: r } = C(n);
615
+ return !r || this.opKind(r) !== "secret" || typeof e != "string" ? null : { scopeKey: i.join(".") };
616
+ }
617
+ isNoiseScopeCall(n, e) {
618
+ if (n.length === 0) return null;
619
+ const { scope: i, leaf: r } = C(n);
620
+ return !r || this.opKind(r) !== "noise" || typeof e != "string" ? null : { scopeKey: i.join(".") };
621
+ }
622
+ isPointerCall(n, e) {
623
+ if (n.length === 0) return null;
624
+ const { leaf: i } = C(n);
625
+ if (!i || this.opKind(i) !== "pointer" || typeof e != "string") return null;
626
+ const r = e.trim().replace(/^\./, "");
627
+ return r ? { targetPath: r } : null;
628
+ }
629
+ isIdentityCall(n, e) {
630
+ if (n.length === 1 && this.opKind(n[0]) === "identity")
631
+ return typeof e != "string" ? null : { id: Ht(e), targetPath: [] };
632
+ const { scope: i, leaf: r } = C(n);
633
+ return !r || this.opKind(r) !== "identity" || typeof e != "string" ? null : { id: Ht(e), targetPath: i };
634
+ }
635
+ isEvalCall(n, e) {
636
+ if (n.length === 0) return null;
637
+ const { scope: i, leaf: r } = C(n);
638
+ if (!r || this.opKind(r) !== "eval") return null;
490
639
  if (typeof e == "function")
491
- return { mode: "thunk", targetPath: a, thunk: e };
640
+ return { mode: "thunk", targetPath: i, thunk: e };
492
641
  if (Array.isArray(e) && e.length >= 2) {
493
- const f = String(e[0] ?? "").trim(), p = String(e[1] ?? "").trim();
494
- return !f || !p ? null : { mode: "assign", targetPath: a, name: f, expr: p };
642
+ const u = String(e[0] ?? "").trim(), f = String(e[1] ?? "").trim();
643
+ return !u || !f ? null : { mode: "assign", targetPath: i, name: u, expr: f };
495
644
  }
496
645
  return null;
497
646
  }
498
- isQueryCall(r, e) {
499
- if (r.length === 0) return null;
500
- const { scope: a, leaf: i } = N(r);
501
- if (!i || this.opKind(i) !== "query") return null;
502
- let f = null, p;
647
+ isQueryCall(n, e) {
648
+ if (n.length === 0) return null;
649
+ const { scope: i, leaf: r } = C(n);
650
+ if (!r || this.opKind(r) !== "query") return null;
651
+ let u = null, f;
503
652
  if (Array.isArray(e) && e.length > 0)
504
- Array.isArray(e[0]) && (e.length === 1 || typeof e[1] == "function") ? (f = e[0], p = typeof e[1] == "function" ? e[1] : void 0) : f = e;
653
+ Array.isArray(e[0]) && (e.length === 1 || typeof e[1] == "function") ? (u = e[0], f = typeof e[1] == "function" ? e[1] : void 0) : u = e;
505
654
  else
506
655
  return null;
507
- if (!Array.isArray(f) || f.length === 0) return null;
508
- const b = f.map((y) => String(y)).map((y) => y.trim()).filter((y) => y.length > 0);
509
- return b.length === 0 ? null : { targetPath: a, paths: b, fn: p };
656
+ if (!Array.isArray(u) || u.length === 0) return null;
657
+ const p = u.map((s) => String(s)).map((s) => s.trim()).filter((s) => s.length > 0);
658
+ return p.length === 0 ? null : { targetPath: i, paths: p, fn: f };
659
+ }
660
+ isDefineOpCall(n, e) {
661
+ if (n.length !== 1 || n[0] !== ae || !Array.isArray(e) || e.length < 2) return null;
662
+ const r = String(e[0] ?? "").trim(), u = String(e[1] ?? "").trim();
663
+ return !r || !u || r === ae ? null : { op: r, kind: u };
510
664
  }
511
- isDefineOpCall(r, e) {
512
- if (r.length !== 1 || r[0] !== ue || !Array.isArray(e) || e.length < 2) return null;
513
- const i = String(e[0] ?? "").trim(), f = String(e[1] ?? "").trim();
514
- return !i || !f || i === ue ? null : { op: i, kind: f };
665
+ commitThoughtOnly(n, e, i, r) {
666
+ const u = n.join("."), f = this.computeEffectiveSecret(n), p = JSON.stringify({
667
+ path: u,
668
+ operator: e,
669
+ expression: i,
670
+ value: r,
671
+ effectiveSecret: f
672
+ }), s = R(p), h = Date.now(), k = {
673
+ path: u,
674
+ operator: e,
675
+ expression: i,
676
+ value: r,
677
+ effectiveSecret: f,
678
+ hash: s,
679
+ timestamp: h
680
+ };
681
+ return this._shortTermMemory.push(k), this.rebuildIndex(), k;
682
+ }
683
+ commitValueMapping(n, e, i = null) {
684
+ let r = e;
685
+ const u = n.join("."), f = this.computeEffectiveSecret(n), p = this.resolveBranchScope(n);
686
+ if (p && p.length === 0 && this.localSecrets[""] && this.localSecrets[u], p && p.length > 0) {
687
+ const s = this.computeEffectiveSecret(p), h = n.slice(p.length), k = this.getBranchBlob(p);
688
+ let m = {};
689
+ if (k && s) {
690
+ const S = Jt(k, s, p);
691
+ S && typeof S == "object" && (m = S);
692
+ }
693
+ if (h.length === 0)
694
+ (typeof m != "object" || m === null) && (m = {}), m.expression = e;
695
+ else {
696
+ let S = m;
697
+ for (let B = 0; B < h.length - 1; B++) {
698
+ const A = h[B];
699
+ (!S[A] || typeof S[A] != "object") && (S[A] = {}), S = S[A];
700
+ }
701
+ S[h[h.length - 1]] = e;
702
+ }
703
+ if (s) {
704
+ const S = Qt(m, s, p);
705
+ this.setBranchBlob(p, S);
706
+ }
707
+ r = e;
708
+ } else if (f) {
709
+ const s = i !== "=" && i !== "?";
710
+ N(e) || Lt(e) || !s ? r = e : r = Qt(e, f, n);
711
+ } else
712
+ r = e;
713
+ return this.commitThoughtOnly(n, i, e, r);
714
+ }
715
+ commitMapping(n, e = null) {
716
+ switch (n.op) {
717
+ case "set":
718
+ return this.commitValueMapping(n.path, n.value, e);
719
+ case "ptr":
720
+ return this.commitValueMapping(n.path, n.value, "__");
721
+ case "id":
722
+ return this.commitValueMapping(n.path, n.value, "@");
723
+ case "secret": {
724
+ if (typeof n.value != "string") return;
725
+ const i = n.path.join(".");
726
+ return this.localSecrets[i] = n.value, this.commitThoughtOnly(n.path, "_", "***", "***");
727
+ }
728
+ default:
729
+ return;
730
+ }
515
731
  }
516
732
  // ---------------------------------------------------------
517
733
  // Postulate: semantic write at a given path
518
734
  // ---------------------------------------------------------
519
- postulate(r, e, a = null) {
520
- let i = r, f = e;
521
- const p = this.isDefineOpCall(i, e);
522
- if (p) {
523
- this.operators[p.op] = { kind: p.kind };
735
+ postulate(n, e, i = null) {
736
+ let r = n;
737
+ const u = this.isDefineOpCall(r, e);
738
+ if (u) {
739
+ this.operators[u.op] = { kind: u.kind };
524
740
  return;
525
741
  }
526
- const b = this.isEvalCall(i, e);
527
- if (b) {
528
- if (b.mode === "thunk") {
529
- const x = b.thunk();
530
- return b.targetPath.length === 0 ? x : this.postulate(b.targetPath, x, "=");
742
+ const { leaf: f } = C(r), p = f ? this.opKind(f) : null;
743
+ if (p === null || p === "secret" || p === "pointer" || p === "identity") {
744
+ const B = Te(this.operators, { path: r, expression: e });
745
+ if (B.kind === "commit") {
746
+ const A = /* @__PURE__ */ new Set(["set", "secret", "ptr", "id"]);
747
+ if (B.instructions.every((O) => A.has(O.op))) {
748
+ let O;
749
+ for (const E of B.instructions) {
750
+ const M = this.commitMapping(E, i);
751
+ M && (O = M);
752
+ }
753
+ if (O) return O;
754
+ }
531
755
  }
532
- const k = [...b.targetPath, b.name];
533
- return this.postulate(k, b.expr, "=");
534
756
  }
535
- const y = this.isQueryCall(i, e);
536
- if (y) {
537
- const k = y.paths.map((C) => this.readPath(C.split(".").filter(Boolean))), x = y.fn ? y.fn(...k) : k;
538
- return y.targetPath.length === 0 ? x : this.postulate(y.targetPath, x, "?");
757
+ const h = this.isEvalCall(r, e);
758
+ if (h) {
759
+ if (h.mode === "thunk") {
760
+ const A = h.thunk();
761
+ return h.targetPath.length === 0 ? A : this.postulate(h.targetPath, A, "=");
762
+ }
763
+ const B = [...h.targetPath, h.name];
764
+ return this.postulate(B, h.expr, "=");
765
+ }
766
+ const k = this.isQueryCall(r, e);
767
+ if (k) {
768
+ const B = k.paths.map((x) => this.readPath(x.split(".").filter(Boolean))), A = k.fn ? k.fn(...B) : B;
769
+ return k.targetPath.length === 0 ? A : this.postulate(k.targetPath, A, "?");
539
770
  }
540
- const g = this.isRemoveCall(i, e);
541
- if (g) {
542
- this.removeSubtree(g.targetPath);
771
+ const m = this.isRemoveCall(r, e);
772
+ if (m) {
773
+ this.removeSubtree(m.targetPath);
543
774
  return;
544
775
  }
545
- const S = this.isSecretScopeCall(i, e);
776
+ const S = this.isNoiseScopeCall(r, e);
546
777
  if (S) {
547
- this.localSecrets[S.scopeKey] = e;
548
- const k = S.scopeKey ? S.scopeKey.split(".").filter(Boolean) : [], x = k.join("."), C = this.computeEffectiveSecret(k), w = "***", _ = "***", F = JSON.stringify({
549
- path: x,
550
- operator: "_",
551
- expression: w,
552
- value: _,
553
- effectiveSecret: C
554
- }), I = R(F), j = Date.now(), K = {
555
- path: x,
556
- operator: "_",
557
- expression: w,
558
- value: _,
559
- effectiveSecret: C,
560
- hash: I,
561
- timestamp: j
562
- };
563
- return this._shortTermMemory.push(K), this.rebuildIndex(), K;
564
- }
565
- const O = this.isNoiseScopeCall(i, e);
566
- if (O) {
567
- this.localNoises[O.scopeKey] = e;
568
- const k = O.scopeKey ? O.scopeKey.split(".").filter(Boolean) : [], x = k.join("."), C = this.computeEffectiveSecret(k), w = "***", _ = "***", F = JSON.stringify({
569
- path: x,
570
- operator: "~",
571
- expression: w,
572
- value: _,
573
- effectiveSecret: C
574
- }), I = R(F), j = Date.now(), K = {
575
- path: x,
576
- operator: "~",
577
- expression: w,
578
- value: _,
579
- effectiveSecret: C,
580
- hash: I,
581
- timestamp: j
582
- };
583
- return this._shortTermMemory.push(K), this.rebuildIndex(), K;
584
- }
585
- const W = this.isPointerCall(i, e);
586
- if (W) {
587
- const { scope: k } = N(i);
588
- i = k, e = ve(W.targetPath), f = e, a === null && (a = "__");
778
+ this.localNoises[S.scopeKey] = e;
779
+ const B = S.scopeKey ? S.scopeKey.split(".").filter(Boolean) : [];
780
+ return this.commitThoughtOnly(B, "~", "***", "***");
589
781
  }
590
- const z = this.isIdentityCall(i, e);
591
- z && (i = z.targetPath, e = ge(z.id), f = e, a === null && (a = "@"));
592
- const P = i.join("."), D = this.computeEffectiveSecret(i), E = this.resolveBranchScope(i);
593
- if (E && E.length === 0 && this.localSecrets[""] && this.localSecrets[P], E && E.length > 0) {
594
- const k = this.computeEffectiveSecret(E), x = i.slice(E.length), C = this.getBranchBlob(E);
595
- let w = {};
596
- if (C && k) {
597
- const _ = re(C, k, E);
598
- _ && typeof _ == "object" && (w = _);
599
- }
600
- if (x.length === 0)
601
- (typeof w != "object" || w === null) && (w = {}), w.expression = e;
602
- else {
603
- let _ = w;
604
- for (let F = 0; F < x.length - 1; F++) {
605
- const I = x[F];
606
- (!_[I] || typeof _[I] != "object") && (_[I] = {}), _ = _[I];
607
- }
608
- _[x[x.length - 1]] = e;
609
- }
610
- if (k) {
611
- const _ = fe(w, k, E);
612
- this.setBranchBlob(E, _);
613
- }
614
- f = e;
615
- } else if (D) {
616
- const k = a !== "=" && a !== "?";
617
- Yt(e) || te(e) || !k ? f = e : f = fe(e, D, i);
618
- } else
619
- f = e;
620
- const J = f, $ = JSON.stringify({
621
- path: P,
622
- operator: a,
623
- expression: e,
624
- value: J,
625
- effectiveSecret: D
626
- }), q = R($), Zt = Date.now(), L = {
627
- path: P,
628
- operator: a,
629
- expression: e,
630
- value: J,
631
- effectiveSecret: D,
632
- hash: q,
633
- timestamp: Zt
634
- };
635
- return this._shortTermMemory.push(L), this.rebuildIndex(), L;
782
+ return this.commitValueMapping(r, e, i);
636
783
  }
637
- removeSubtree(r) {
638
- const e = r.join(".");
639
- for (const g of Object.keys(this.localSecrets)) {
784
+ removeSubtree(n) {
785
+ const e = n.join(".");
786
+ for (const h of Object.keys(this.localSecrets)) {
640
787
  if (e === "") {
641
- delete this.localSecrets[g];
788
+ delete this.localSecrets[h];
642
789
  continue;
643
790
  }
644
- (g === e || g.startsWith(e + ".")) && delete this.localSecrets[g];
791
+ (h === e || h.startsWith(e + ".")) && delete this.localSecrets[h];
645
792
  }
646
- for (const g of Object.keys(this.localNoises)) {
793
+ for (const h of Object.keys(this.localNoises)) {
647
794
  if (e === "") {
648
- delete this.localNoises[g];
795
+ delete this.localNoises[h];
649
796
  continue;
650
797
  }
651
- (g === e || g.startsWith(e + ".")) && delete this.localNoises[g];
798
+ (h === e || h.startsWith(e + ".")) && delete this.localNoises[h];
652
799
  }
653
- for (const g of Object.keys(this.encryptedBranches)) {
800
+ for (const h of Object.keys(this.encryptedBranches)) {
654
801
  if (e === "") {
655
- delete this.encryptedBranches[g];
802
+ delete this.encryptedBranches[h];
656
803
  continue;
657
804
  }
658
- (g === e || g.startsWith(e + ".")) && delete this.encryptedBranches[g];
805
+ if (h === e || h.startsWith(e + ".")) {
806
+ delete this.encryptedBranches[h];
807
+ continue;
808
+ }
809
+ const k = h.split(".").filter(Boolean);
810
+ if (!Gt(n, k) || n.length <= k.length) continue;
811
+ const m = this.computeEffectiveSecret(k);
812
+ if (!m) continue;
813
+ const S = this.getBranchBlob(k);
814
+ if (!S) continue;
815
+ const B = Jt(S, m, k);
816
+ if (!B || typeof B != "object") continue;
817
+ const A = n.slice(k.length);
818
+ let x = B;
819
+ for (let O = 0; O < A.length - 1; O++) {
820
+ const E = A[O];
821
+ if (!x || typeof x != "object" || !(E in x)) {
822
+ x = null;
823
+ break;
824
+ }
825
+ x = x[E];
826
+ }
827
+ if (x && typeof x == "object") {
828
+ delete x[A[A.length - 1]];
829
+ const O = Qt(B, m, k);
830
+ this.setBranchBlob(k, O);
831
+ }
659
832
  }
660
- const a = r.join("."), i = Date.now(), f = this.computeEffectiveSecret(r), p = JSON.stringify({ path: a, operator: "-", expression: "-", value: "-", effectiveSecret: f }), b = R(p), y = {
661
- path: a,
833
+ const i = n.join("."), r = Date.now(), u = this.computeEffectiveSecret(n), f = JSON.stringify({ path: i, operator: "-", expression: "-", value: "-", effectiveSecret: u }), p = R(f), s = {
834
+ path: i,
662
835
  operator: "-",
663
836
  expression: "-",
664
837
  value: "-",
665
- effectiveSecret: f,
666
- hash: b,
667
- timestamp: i
838
+ effectiveSecret: u,
839
+ hash: p,
840
+ timestamp: r
668
841
  };
669
- this._shortTermMemory.push(y), this.rebuildIndex();
842
+ this._shortTermMemory.push(s), this.rebuildIndex();
670
843
  }
671
844
  // ---------------------------------------------------------
672
845
  // Fractal secret: combina todos los secrets a lo largo de la ruta, o noise acts as a new root for chaining
673
846
  // ---------------------------------------------------------
674
- computeEffectiveSecret(r) {
675
- let e = null, a = null;
676
- this.localNoises[""] !== void 0 && (e = "", a = this.localNoises[""]);
677
- for (let f = 1; f <= r.length; f++) {
678
- const p = r.slice(0, f).join(".");
679
- this.localNoises[p] !== void 0 && (e = p, a = this.localNoises[p]);
847
+ computeEffectiveSecret(n) {
848
+ let e = null, i = null;
849
+ this.localNoises[""] !== void 0 && (e = "", i = this.localNoises[""]);
850
+ for (let u = 1; u <= n.length; u++) {
851
+ const f = n.slice(0, u).join(".");
852
+ this.localNoises[f] !== void 0 && (e = f, i = this.localNoises[f]);
680
853
  }
681
- let i = "root";
682
- a ? i = R("noise::" + a) : this.localSecrets[""] && (i = R(i + "::" + this.localSecrets[""])), e === null || e === "" || e.split(".").filter(Boolean).length;
683
- for (let f = 1; f <= r.length; f++) {
684
- const p = r.slice(0, f).join(".");
685
- if (this.localSecrets[p]) {
854
+ let r = "root";
855
+ i ? r = R("noise::" + i) : this.localSecrets[""] && (r = R(r + "::" + this.localSecrets[""])), e === null || e === "" || e.split(".").filter(Boolean).length;
856
+ for (let u = 1; u <= n.length; u++) {
857
+ const f = n.slice(0, u).join(".");
858
+ if (this.localSecrets[f]) {
686
859
  if (e !== null && e !== "") {
687
- const b = e + ".";
688
- if (!(p === e || p.startsWith(b))) continue;
860
+ const p = e + ".";
861
+ if (!(f === e || f.startsWith(p))) continue;
689
862
  }
690
- i = R(i + "::" + this.localSecrets[p]);
863
+ r = R(r + "::" + this.localSecrets[f]);
691
864
  }
692
865
  }
693
- return i === "root" ? "" : i;
866
+ return r === "root" ? "" : r;
694
867
  }
695
868
  // ---------------------------------------------------------
696
869
  // Índice derivado
697
870
  // ---------------------------------------------------------
698
871
  rebuildIndex() {
699
- const r = {};
872
+ const n = {};
700
873
  for (const e of this._shortTermMemory) {
701
- const a = e.path, i = a.split(".").filter(Boolean), f = this.resolveBranchScope(i), p = f && f.length > 0 && le(i, f);
874
+ const i = e.path, r = i.split(".").filter(Boolean), u = this.resolveBranchScope(r), f = u && u.length > 0 && Gt(r, u);
702
875
  if (e.operator === "-") {
703
- if (a === "") {
704
- for (const y of Object.keys(r)) delete r[y];
876
+ if (i === "") {
877
+ for (const s of Object.keys(n)) delete n[s];
705
878
  continue;
706
879
  }
707
- const b = a + ".";
708
- for (const y of Object.keys(r))
709
- (y === a || y.startsWith(b)) && delete r[y];
880
+ const p = i + ".";
881
+ for (const s of Object.keys(n))
882
+ (s === i || s.startsWith(p)) && delete n[s];
710
883
  continue;
711
884
  }
712
- p || (r[a] = e.value);
885
+ f || (n[i] = e.value);
713
886
  }
714
- this.index = r;
887
+ this.index = n;
715
888
  }
716
- getIndex(r) {
717
- return this.index[r.join(".")];
889
+ getIndex(n) {
890
+ return this.index[n.join(".")];
718
891
  }
719
- setIndex(r, e) {
720
- this.index[r.join(".")] = e;
892
+ setIndex(n, e) {
893
+ this.index[n.join(".")] = e;
721
894
  }
722
- resolveIndexPointerPath(r, e = 8) {
723
- let a = r;
724
- for (let i = 0; i < e; i++) {
725
- const f = this.getIndex(a);
726
- if (!Yt(f)) return { path: a, raw: f };
727
- a = f.__ptr.split(".").filter(Boolean);
895
+ resolveIndexPointerPath(n, e = 8) {
896
+ let i = n;
897
+ for (let r = 0; r < e; r++) {
898
+ const u = this.getIndex(i);
899
+ if (N(u)) {
900
+ i = u.__ptr.split(".").filter(Boolean);
901
+ continue;
902
+ }
903
+ let f = !1;
904
+ for (let p = i.length - 1; p >= 0; p--) {
905
+ const s = i.slice(0, p), h = this.getIndex(s);
906
+ if (!N(h)) continue;
907
+ const k = h.__ptr.split(".").filter(Boolean), m = i.slice(p);
908
+ i = [...k, ...m], f = !0;
909
+ break;
910
+ }
911
+ if (!f)
912
+ return { path: i, raw: u };
728
913
  }
729
- return { path: a, raw: void 0 };
914
+ return { path: i, raw: void 0 };
730
915
  }
731
- setBranchBlob(r, e) {
732
- const a = r.join(".");
733
- this.encryptedBranches[a] = e;
916
+ setBranchBlob(n, e) {
917
+ const i = n.join(".");
918
+ this.encryptedBranches[i] = e;
734
919
  }
735
- getBranchBlob(r) {
736
- const e = r.join(".");
920
+ getBranchBlob(n) {
921
+ const e = n.join(".");
737
922
  return this.encryptedBranches[e];
738
923
  }
739
- resolveBranchScope(r) {
924
+ resolveBranchScope(n) {
740
925
  let e = null;
741
926
  this.localSecrets[""] && (e = []);
742
- for (let a = 1; a <= r.length; a++) {
743
- const i = r.slice(0, a), f = i.join(".");
744
- this.localSecrets[f] && (e = i);
927
+ for (let i = 1; i <= n.length; i++) {
928
+ const r = n.slice(0, i), u = r.join(".");
929
+ this.localSecrets[u] && (e = r);
745
930
  }
746
931
  return e;
747
932
  }
748
- readPath(r) {
749
- const e = this.resolveBranchScope(r);
750
- if (e && e.length > 0 && le(r, e)) {
751
- if (r.length === e.length) return;
933
+ readPath(n) {
934
+ const e = this.resolveBranchScope(n);
935
+ if (e && e.length > 0 && Gt(n, e)) {
936
+ if (n.length === e.length) return;
752
937
  const p = this.computeEffectiveSecret(e);
753
938
  if (!p) return null;
754
- const b = this.getBranchBlob(e);
755
- if (!b) return;
756
- const y = re(b, p, e);
757
- if (!y || typeof y != "object") return;
758
- const g = r.slice(e.length);
759
- let S = y;
760
- for (const O of g) {
761
- if (!S || typeof S != "object") return;
762
- S = S[O];
939
+ const s = this.getBranchBlob(e);
940
+ if (!s) return;
941
+ const h = Jt(s, p, e);
942
+ if (!h || typeof h != "object") return;
943
+ const k = n.slice(e.length);
944
+ let m = h;
945
+ for (const S of k) {
946
+ if (!m || typeof m != "object") return;
947
+ m = m[S];
763
948
  }
764
- return Yt(S) ? this.readPath(S.__ptr.split(".").filter(Boolean)) : (te(S), S);
949
+ return N(m) ? this.readPath(m.__ptr.split(".").filter(Boolean)) : (Lt(m), m);
765
950
  }
766
- const i = this.resolveIndexPointerPath(r).raw;
767
- if (i === void 0) return;
768
- if (Yt(i)) return this.readPath(i.__ptr.split(".").filter(Boolean));
769
- if (te(i) || !Pe(i)) return i;
770
- const f = this.computeEffectiveSecret(r);
771
- return f ? re(i, f, r) : null;
951
+ const i = this.getIndex(n);
952
+ if (N(i)) return i;
953
+ const r = this.resolveIndexPointerPath(n), u = r.raw;
954
+ if (u === void 0)
955
+ return r.path.length === n.length && r.path.every((s, h) => s === n[h]) ? void 0 : this.readPath(r.path);
956
+ if (N(u)) return this.readPath(u.__ptr.split(".").filter(Boolean));
957
+ if (Lt(u) || !Ne(u)) return u;
958
+ const f = this.computeEffectiveSecret(n);
959
+ return f ? Jt(u, f, n) : null;
772
960
  }
773
961
  }
774
962
  export {
775
- se as default
963
+ he as default
776
964
  };