@fest-lib/object 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/object.js +841 -1036
  2. package/package.json +3 -3
  3. package/dist/index.js +0 -1731
package/dist/index.js DELETED
@@ -1,1731 +0,0 @@
1
- var Ze = /* @__PURE__ */ Symbol.for("@fix"), m = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, E = (e, t) => m(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, ke = (e, t = "value") => (typeof e == "object" || typeof e == "function") && e != null && (t in e || e?.[t] != null), I = (e) => ke(e, "value"), He = (e) => m(e) ? e : I(e) ? e?.value : e, S = (e, t) => e?.[Ze] ?? e ?? t ?? t, at = (e) => {
2
- if (typeof e == "function" || e == null) return e;
3
- const t = function() {
4
- };
5
- return t[Ze] = e, t;
6
- }, Q = /* @__PURE__ */ Symbol.for("@trigger-lock"), ye = (e, t, r = "value") => {
7
- ke(e, r) && (e[Q] = !0);
8
- let n;
9
- try {
10
- n = t?.();
11
- } finally {
12
- ke(e, r) && delete e[Q];
13
- }
14
- return n;
15
- }, ht = (e, t) => e instanceof Promise || typeof e?.then == "function" ? e?.then?.(t) : t?.(e), dt = (e, t) => e instanceof Promise || typeof e?.then == "function" ? e?.then?.(t) : t?.(e), pe = function(e) {
16
- return (t) => {
17
- e[Q] = !0;
18
- let r;
19
- try {
20
- r = t?.();
21
- } finally {
22
- e[Q] = !1;
23
- }
24
- return r;
25
- };
26
- }, vt = (e) => {
27
- switch (typeof e) {
28
- case "number":
29
- return 0;
30
- case "string":
31
- return "";
32
- case "boolean":
33
- return !1;
34
- case "object":
35
- return null;
36
- case "function":
37
- return null;
38
- case "symbol":
39
- return null;
40
- case "bigint":
41
- return 0n;
42
- }
43
- }, j = (e) => typeof e?.[Symbol.iterator] == "function", z = (e) => [
44
- "symbol",
45
- "string",
46
- "number"
47
- ].indexOf(typeof e) >= 0, bt = (e, t, r = null) => {
48
- const n = r != null && (typeof e == "object" || typeof e == "function") ? e?.[r] ?? e : e;
49
- let i = [];
50
- t instanceof Set || t instanceof Map || Array.isArray(t) || j(t) ? i = (n instanceof Set || n instanceof WeakSet ? t?.values?.() : t?.entries?.()) || (Array.isArray(t) || j(t) ? t : []) : (typeof t == "object" || typeof t == "function") && (i = n instanceof Set || n instanceof WeakSet ? Object.values(t) : Object.entries(t));
51
- let s = [];
52
- Array.isArray(n) ? s = n.entries() : n instanceof Map || n instanceof WeakMap ? s = n?.entries?.() : n instanceof Set || n instanceof WeakSet ? s = n?.values?.() : (typeof n == "object" || typeof n == "function") && (s = Object.entries(n));
53
- const u = new Set(Array.from(i).map((o) => o?.[0])), l = new Set(Array.from(s).map((o) => o?.[0])), f = u?.difference?.(l);
54
- if (Array.isArray(n)) {
55
- const o = n.filter((y, a) => !f.has(a));
56
- n.splice(0, n.length), n.push(...o);
57
- } else if (n instanceof Map || n instanceof Set || n instanceof WeakMap || n instanceof WeakSet) for (const o of f) n.delete(o);
58
- else if (typeof n == "function" || typeof n == "object") for (const o of f) delete n[o];
59
- return n;
60
- }, ie = (e, t, r = null, n = !0, i = "id") => {
61
- const s = r != null && (typeof e == "object" || typeof e == "function") ? e?.[r] ?? e : e;
62
- let u = null;
63
- if (n && bt(s, t), t instanceof Set || t instanceof Map || Array.isArray(t) || j(t) ? u = (s instanceof Set || s instanceof WeakSet ? t?.values?.() : t?.entries?.()) || (Array.isArray(t) || j(t) ? t : []) : (typeof t == "object" || typeof t == "function") && (u = s instanceof Set || s instanceof WeakSet ? Object.values(t) : Object.entries(t)), s && u && (typeof u == "object" || typeof u == "function")) {
64
- if (s instanceof Map || s instanceof WeakMap) {
65
- for (const l of u) s.set(...l);
66
- return s;
67
- }
68
- if (s instanceof Set || s instanceof WeakSet) {
69
- for (const l of u) {
70
- const f = l?.[i] ? Array.from(s?.values?.() || []).find((o) => !x?.(o?.[i], l?.[i])) : null;
71
- f != null ? ie(f, l, null, n, i) : s.add(l);
72
- }
73
- return s;
74
- }
75
- if (typeof s == "object" || typeof s == "function") {
76
- if (Array.isArray(s) || j(s)) {
77
- let l = 0;
78
- for (const f of u) l < s.length ? s[l++] = f?.[1] : s?.push?.(f?.[1]);
79
- return s;
80
- }
81
- return Object.assign(s, Object.fromEntries([...u || []].filter((l) => typeof l != "symbol")));
82
- }
83
- }
84
- return r != null ? (Reflect.set(e, r, t), e) : typeof t == "object" || typeof t == "function" ? Object.assign(e, t) : t;
85
- }, St = (e, t) => mt.getOrInsert(e, /* @__PURE__ */ new WeakMap()).getOrInsert(t, t?.bind?.(e)), H = (e, t) => (typeof t == "function" ? St(e, t) : t) ?? t, ae = (e, t, r, n) => {
86
- if (t == Symbol.iterator) return Ce(e, r, n);
87
- if (t == null || typeof t == "symbol" || typeof t == "object" || typeof t == "function") return;
88
- const i = (s, ...u) => {
89
- if (s != null) return r?.(s, ...u);
90
- };
91
- if (e instanceof Map || e instanceof WeakMap) {
92
- if (e.has(t)) return i?.(e.get(t), t, null, "@set");
93
- } else if (e instanceof Set || e instanceof WeakSet) {
94
- if (e.has(t)) return i?.(t, t, null, "@add");
95
- } else if (Array.isArray(e) && typeof t == "string" && [...t?.matchAll?.(/^\d+$/g)].length == 1 && Number.isInteger(typeof t == "string" ? parseInt(t) : t)) {
96
- const s = typeof t == "string" ? parseInt(t) : t;
97
- return i?.(e?.[s], s, null, "@add");
98
- } else if (typeof e == "function" || typeof e == "object") return i?.(e?.[t], t, null, "@set");
99
- }, pt = (e, t = {}) => (Object.entries(t)?.forEach?.(([r, n]) => {
100
- x(n, e[r]) && (e[r] = n);
101
- }), e), Ce = (e, t, r) => {
102
- if (e == null) return;
103
- let n = [];
104
- if (e instanceof Set || e instanceof Map || typeof e?.keys == "function") return [...e?.keys?.() || n].forEach?.((i) => ae(e, i, t, r));
105
- if (Array.isArray(e) || j(e)) return [...e].forEach?.((i, s) => ae(e, s, t, r));
106
- if (typeof e == "object" || typeof e == "function") return [...Object.keys(e) || n].forEach?.((i) => ae(e, i, t, r));
107
- }, x = (e, t) => e == null && t == null ? !1 : e == null || t == null ? !0 : typeof e == "boolean" && typeof t == "boolean" ? e != t : typeof e == "number" && typeof t == "number" ? !(e == t || Math.abs(e - t) < 1e-9) : typeof e == "string" && typeof t == "string" ? e != "" && t != "" && e != t || e !== t : typeof e != typeof t ? e !== t : e && t && e != t || e !== t, Le = /* @__PURE__ */ Symbol.for("object.boundCtx");
108
- globalThis[Le] ??= /* @__PURE__ */ new WeakMap();
109
- var mt = globalThis[Le], le = (e, t) => {
110
- const r = e == null || e < 0 || typeof e != "number" || e == Symbol.iterator || (t != null ? e >= (t?.length || 0) : !1);
111
- return t != null ? Array.isArray(t) && r : !1;
112
- }, $ = /* @__PURE__ */ new WeakMap(), Ke = /* @__PURE__ */ new WeakMap(), P = (e, t) => e instanceof Promise || typeof e?.then == "function" ? $?.has?.(e) ? t($?.get?.(e)) : Promise.try?.(async () => {
113
- const r = await e;
114
- return $?.set?.(e, r), r;
115
- })?.then?.(t) : t(e), gt = class {
116
- #t;
117
- #e;
118
- constructor(e, t) {
119
- this.#t = e, this.#e = t;
120
- }
121
- defineProperty(e, t, r) {
122
- return S(e) instanceof Promise ? Reflect.defineProperty(e, t, r) : P(S(e), (n) => Reflect.defineProperty(n, t, r));
123
- }
124
- deleteProperty(e, t) {
125
- return S(e) instanceof Promise ? Reflect.deleteProperty(e, t) : P(S(e), (r) => Reflect.deleteProperty(r, t));
126
- }
127
- getPrototypeOf(e) {
128
- return S(e) instanceof Promise ? Reflect.getPrototypeOf(e) : P(S(e), (t) => Reflect.getPrototypeOf(t));
129
- }
130
- setPrototypeOf(e, t) {
131
- return S(e) instanceof Promise ? Reflect.setPrototypeOf(e, t) : P(S(e), (r) => Reflect.setPrototypeOf(r, t));
132
- }
133
- isExtensible(e) {
134
- return S(e) instanceof Promise ? Reflect.isExtensible(e) : P(S(e), (t) => Reflect.isExtensible(t));
135
- }
136
- preventExtensions(e) {
137
- return S(e) instanceof Promise ? Reflect.ownKeys(e) : P(S(e), (t) => Reflect.preventExtensions(t));
138
- }
139
- ownKeys(e) {
140
- const t = S(e);
141
- return t instanceof Promise ? Object.keys(t) : P(t, (r) => (typeof r == "object" || typeof r == "function") && r != null ? Object.keys(r) : []) ?? [];
142
- }
143
- getOwnPropertyDescriptor(e, t) {
144
- return S(e) instanceof Promise ? Reflect.getOwnPropertyDescriptor(e, t) : P(S(e), (r) => Reflect.getOwnPropertyDescriptor(r, t));
145
- }
146
- construct(e, t, r) {
147
- return P(S(e), (n) => Reflect.construct(n, t, r));
148
- }
149
- has(e, t) {
150
- return S(e) instanceof Promise ? Reflect.has(e, t) : P(S(e), (r) => Reflect.has(r, t));
151
- }
152
- get(e, t, r) {
153
- if (e = S(e), t == "promise") return e;
154
- if (t == "resolve" && this.#t) return (...i) => {
155
- const s = this.#t?.(...i);
156
- return this.#t = null, s;
157
- };
158
- if (t == "reject" && this.#e) return (...i) => {
159
- const s = this.#e?.(...i);
160
- return this.#e = null, s;
161
- };
162
- if (t == "then" || t == "catch" || t == "finally") {
163
- if (e instanceof Promise) return e?.[t]?.bind?.(e);
164
- {
165
- const i = Promise.try(() => e);
166
- return i?.[t]?.bind?.(i);
167
- }
168
- }
169
- let n;
170
- return $?.has?.(e) && (n = $?.get?.(e))?.[t] != null ? n = $?.get?.(e)?.[t] : n = Ee(P(e, async (i) => {
171
- if (S(i) instanceof Promise) return Reflect.get(i, t, r);
172
- if (m(i)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? i : void 0;
173
- let s;
174
- try {
175
- s = Reflect.get(i, t, r);
176
- } catch {
177
- s = e?.[t];
178
- }
179
- return typeof s == "function" ? s?.bind?.(i) : s;
180
- })), t == Symbol.toStringTag ? m(n) ? String(n ?? "") || "" : n?.[Symbol.toStringTag]?.() || String(n ?? "") || "" : t == Symbol.toPrimitive ? (i) => {
181
- if (m(n)) return E(n, i);
182
- } : n;
183
- }
184
- set(e, t, r) {
185
- return P(S(e), (n) => Reflect.set(n, t, r));
186
- }
187
- apply(e, t, r) {
188
- if (this.#t) {
189
- const n = this.#t?.(...r);
190
- return this.#t = null, n;
191
- }
192
- return P(S(e, this.#t), (n) => {
193
- if (typeof n == "function")
194
- return S(n) instanceof Promise, Reflect.apply(n, t, r);
195
- });
196
- }
197
- };
198
- function Ee(e, t, r) {
199
- return e instanceof Promise || typeof e?.then == "function" ? $?.has?.(e) ? $?.get?.(e) : (Ke?.has?.(e) || e?.then?.((n) => $?.set?.(e, n)), Ke?.getOrInsertComputed?.(e, () => new Proxy(at(e), new gt(t, r)))) : e;
200
- }
201
- Symbol.observable ||= /* @__PURE__ */ Symbol.for("observable");
202
- Symbol.subscribe ||= /* @__PURE__ */ Symbol.for("subscribe");
203
- Symbol.unsubscribe ||= /* @__PURE__ */ Symbol.for("unsubscribe");
204
- var d = /* @__PURE__ */ Symbol.for("@value"), g = /* @__PURE__ */ Symbol.for("@extract"), _ = /* @__PURE__ */ Symbol.for("@origin"), se = /* @__PURE__ */ Symbol.for("@registry"), K = /* @__PURE__ */ Symbol.for("@behavior"), oe = /* @__PURE__ */ Symbol.for("@promise"), me = /* @__PURE__ */ Symbol.for("@trigger-less"), h = /* @__PURE__ */ Symbol.for("@trigger-lock"), At = /* @__PURE__ */ Symbol.for("@trigger-control"), D = /* @__PURE__ */ Symbol.for("@trigger"), ue = /* @__PURE__ */ Symbol.for("@subscribe"), Ot = /* @__PURE__ */ Symbol.for("@isNotEqual"), de = /* @__PURE__ */ Symbol.for("@realProp"), qe = /* @__PURE__ */ new WeakMap(), he = (e) => {
205
- const t = typeof e == "object" || typeof e == "function" ? e?.[g] ?? e : e, r = (n) => he(n);
206
- return Array.isArray(t) ? t?.map?.(r) || Array.from(t || [])?.map?.(r) || [] : t instanceof Map || t instanceof WeakMap ? new Map(Array.from(t?.entries?.() || [])?.map?.(([n, i]) => [n, he(i)])) : t instanceof Set || t instanceof WeakSet ? new Set(Array.from(t?.values?.() || [])?.map?.(r)) : t != null && typeof t == "function" || typeof t == "object" ? Object.fromEntries(Array.from(Object.entries(t || {}) || [])?.filter?.(([n]) => n != g && n != _ && n != se)?.map?.(([n, i]) => [n, he(i)])) : t;
207
- }, xt = (e) => e?.[g] ?? e?.["@target"] ?? e, C = (e, t = !1) => {
208
- const r = e;
209
- if (m(e) || typeof e == "symbol") return e;
210
- if (e != null && (e instanceof WeakRef || "deref" in e && typeof e?.deref == "function") && (e = e?.deref?.()), e != null && (typeof e == "object" || typeof e == "function")) {
211
- e = xt(e);
212
- const n = t && I(e) && e?.value;
213
- if (n != null && (typeof n == "object" || typeof n == "function") && (e = n), r != e) return C(e, t);
214
- }
215
- return e;
216
- }, We = (e) => e != null && typeof e.then == "function", wt = (e, t) => m(e) || typeof e == "function" ? t?.(e) : We(e) ? e.then(t) : e?.promise && We(e.promise) ? e.promise.then(t) : t?.(e), Ue = /* @__PURE__ */ new WeakMap(), Rt = new FinalizationRegistry((e) => {
217
- e?.forEach?.((t) => t?.());
218
- });
219
- function M(e, t, r) {
220
- if (!(!r || typeof r != "function" || typeof e != "object" && typeof e != "function"))
221
- if (t == Symbol.dispose) {
222
- const n = e?.[g] ?? e;
223
- Ue?.getOrInsertComputed?.(n, () => {
224
- const i = /* @__PURE__ */ new Set();
225
- return (typeof n == "object" || typeof n == "function") && (Rt.register(n, i), Ue.set(n, i), n[Symbol.dispose] ??= () => i.forEach((s) => {
226
- s?.();
227
- })), i;
228
- })?.add?.(r);
229
- } else e[t] = function(...n) {
230
- const i = e?.[t];
231
- typeof i == "function" && i.apply(this, n), r.apply(this, n);
232
- };
233
- }
234
- var ee = (e) => {
235
- if (typeof e != "string" || e === "") return !1;
236
- const t = Number(e);
237
- return Number.isInteger(t) && t >= 0 && String(t) === e;
238
- };
239
- function pr(e = [], t = {}) {
240
- let r = /* @__PURE__ */ new Set();
241
- const n = (l, f, o) => {
242
- t.onDuplicate?.({
243
- value: l,
244
- via: f,
245
- index: o
246
- });
247
- };
248
- if (e instanceof Set) r = e;
249
- else for (const l of e) {
250
- if (r.has(l)) {
251
- n(l, "push");
252
- continue;
253
- }
254
- r.add(l);
255
- }
256
- const i = () => Array.from(r), s = (l) => {
257
- r.clear();
258
- for (const f of l) r.add(f);
259
- }, u = {
260
- push: (...l) => {
261
- let f = r.size;
262
- for (const o of l) {
263
- if (r.has(o)) {
264
- n(o, "push");
265
- continue;
266
- }
267
- r.add(o), f++;
268
- }
269
- return f;
270
- },
271
- pop: () => {
272
- const l = i();
273
- if (!l.length) return;
274
- const f = l[l.length - 1];
275
- return r.delete(f), f;
276
- },
277
- shift: () => {
278
- const l = r.values().next();
279
- if (l.done) return;
280
- const f = l.value;
281
- return r.delete(f), f;
282
- },
283
- unshift: (...l) => {
284
- if (!l.length) return r.size;
285
- const f = i(), o = [];
286
- for (const a of l) {
287
- if (f.includes(a) || o.includes(a)) {
288
- n(a, "unshift", 0);
289
- continue;
290
- }
291
- o.push(a);
292
- }
293
- if (!o.length) return f.length;
294
- const y = [...o, ...f];
295
- return s(y), y.length;
296
- },
297
- splice: (l, f, ...o) => {
298
- const y = i(), a = Math.min(Math.max(l, 0), y.length), v = f === void 0 ? y.length - a : Math.max(0, Math.min(f, y.length - a)), A = y.splice(a, v);
299
- let w = a;
300
- for (const O of o) {
301
- if (y.includes(O)) {
302
- n(O, "splice", w);
303
- continue;
304
- }
305
- y.splice(w++, 0, O);
306
- }
307
- return s(y), A;
308
- },
309
- includes: (l) => r.has(l),
310
- indexOf: (l) => i().indexOf(l),
311
- clear: () => {
312
- r.clear();
313
- },
314
- delete: (l) => r.delete(l),
315
- toArray: () => i(),
316
- toSet: () => new Set(r),
317
- [Symbol.iterator]: () => r[Symbol.iterator]()
318
- };
319
- return new Proxy(u, {
320
- get: (l, f) => {
321
- if (f === "length") return r.size;
322
- if (ee(f)) return i()[Number(f)];
323
- const o = u[f];
324
- return o;
325
- },
326
- set: (l, f, o) => {
327
- if (f === "length") {
328
- if (typeof o != "number" || !Number.isFinite(o) || o < 0) throw new RangeError("length must be a finite non-negative number");
329
- const y = Math.floor(o);
330
- if (y >= r.size) return !0;
331
- const a = i().slice(0, y);
332
- return s(a), !0;
333
- }
334
- if (ee(f)) {
335
- const y = i(), a = Number(f);
336
- if (a > y.length) return !0;
337
- const v = o;
338
- if (a < y.length) {
339
- const A = y[a];
340
- if (Object.is(A, v)) return !0;
341
- if (y.some((w, O) => O !== a && Object.is(w, v)))
342
- return n(v, "set", a), !0;
343
- y[a] = v;
344
- } else {
345
- if (y.includes(v))
346
- return n(v, "set", a), !0;
347
- y.push(v);
348
- }
349
- return s(y), !0;
350
- }
351
- return Reflect.set(u, f, o);
352
- },
353
- deleteProperty: (l, f) => {
354
- if (f === "length") return !1;
355
- if (ee(f)) {
356
- const o = i(), y = Number(f);
357
- return y >= o.length || (o.splice(y, 1), s(o)), !0;
358
- }
359
- return Reflect.deleteProperty(u, f);
360
- },
361
- ownKeys: () => {
362
- const l = [];
363
- let f = 0;
364
- for (const o of r) l.push(String(f++));
365
- return l.push("length"), l;
366
- },
367
- getOwnPropertyDescriptor: (l, f) => {
368
- if (f === "length") return {
369
- configurable: !1,
370
- enumerable: !1,
371
- writable: !0,
372
- value: r.size
373
- };
374
- if (ee(f)) {
375
- const o = i(), y = Number(f);
376
- return y >= o.length ? void 0 : {
377
- configurable: !0,
378
- enumerable: !0,
379
- writable: !0,
380
- value: o[y]
381
- };
382
- }
383
- return Reflect.getOwnPropertyDescriptor(u, f);
384
- },
385
- has: (l, f) => {
386
- if (f === "length") return !0;
387
- if (ee(f)) {
388
- const o = Number(f);
389
- return o >= 0 && o < r.size;
390
- }
391
- return f in u;
392
- }
393
- });
394
- }
395
- var Tt = class {
396
- constructor() {
397
- }
398
- deleteProperty(e, t) {
399
- return Reflect.deleteProperty(e, t);
400
- }
401
- construct(e, t, r) {
402
- return Reflect.construct(e, t, r);
403
- }
404
- apply(e, t, r) {
405
- return Reflect.apply(e, t, r);
406
- }
407
- has(e, t) {
408
- return Reflect.has(e, t);
409
- }
410
- set(e, t, r) {
411
- return ie(e, r, t), !0;
412
- }
413
- get(e, t, r) {
414
- return typeof t == "symbol" ? e?.[t] ?? e : Reflect.get(e, t, r);
415
- }
416
- }, mr = (e) => {
417
- if (e?.[_] || qe.has(e)) return e;
418
- const t = new Proxy(e, new Tt());
419
- return qe.set(t, e), t;
420
- }, et = /* @__PURE__ */ Symbol.for("object.ts@withUnsub");
421
- globalThis[et] ??= /* @__PURE__ */ new WeakMap();
422
- var Pt = globalThis[et], Mt = (e, t, r) => Pt.getOrInsert(e, () => {
423
- const n = t?.deref?.();
424
- n?.affected?.(r);
425
- const i = e?.complete?.bind?.(e), s = () => {
426
- const u = i?.();
427
- return n?.unaffected?.(r), u;
428
- };
429
- return e.complete = s, {
430
- unaffected: s,
431
- [Symbol.dispose]: s,
432
- [Symbol.asyncDispose]: s
433
- };
434
- }), tt = /* @__PURE__ */ Symbol.for("object.ts@subscriptRegistry");
435
- globalThis[tt] ??= /* @__PURE__ */ new WeakMap();
436
- var p = globalThis[tt] ??= /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ Symbol.for("object.ts@globalEffectListeners");
437
- globalThis[rt] ??= /* @__PURE__ */ new Map();
438
- var ve = globalThis[rt], je = (e, t = ["*"]) => {
439
- if (e == null || typeof e != "function") return;
440
- const r = ft(t);
441
- return ve.set(e, r.affectTypes), () => ve.delete(e);
442
- }, nt = /* @__PURE__ */ Symbol.for("object.ts@wrapped");
443
- globalThis[nt] ??= /* @__PURE__ */ new WeakMap();
444
- var It = globalThis[nt], kt = (e, t) => {
445
- const r = e?.[g] ?? e;
446
- let n = p.get(r);
447
- return n ? n.bindSource(r) : (n = new Wt(r), p.set(r, n)), t;
448
- }, ce = (e, t) => (e = C(e?.[g] ?? e), typeof e == "symbol" || !(typeof e == "object" || typeof e == "function") || e == null ? e : It.getOrInsertComputed(e, () => new Proxy(e, kt(e, t)))), te = /* @__PURE__ */ Symbol.for("@allProps"), it = /* @__PURE__ */ new Set(["*", "all"]), Ve = /* @__PURE__ */ new Map([
449
- ["set", ["setter", "@set"]],
450
- ["add", ["@add"]],
451
- ["delete", ["@delete"]],
452
- ["invalidate", ["@invalidate"]],
453
- ["manual", ["@manual"]],
454
- ["custom", ["@custom"]],
455
- ["setAll", ["@setAll"]],
456
- ["addAll", ["@addAll"]],
457
- ["deleteAll", ["@deleteAll", "@clear"]]
458
- ]), lt = /* @__PURE__ */ Symbol.for("object.ts@triggerCanonicalNames");
459
- globalThis[lt] ??= new Map(Array.from(Ve.entries()).flatMap(([e, t]) => t.map((r) => [r, e])));
460
- var Et = globalThis[lt], fe = (e = "set") => {
461
- if (e == null) return e;
462
- const t = String(e || "set");
463
- return Et.get(t) ?? t;
464
- }, st = (e) => {
465
- const t = e == null ? "all" : String(fe(e) ?? "all");
466
- return [t, ...Ve.get(t) ?? []];
467
- }, Je = (e = ["*"]) => new Set([...X(e)].flatMap((t) => [t, ...Ve.get(t) ?? []])), X = (e = ["*"]) => {
468
- const t = typeof e == "string" ? [e] : Array.from(e ?? ["*"]), r = new Set(t.map((n) => {
469
- const i = String(n || "*");
470
- return it.has(i) ? i : String(fe(i) ?? i);
471
- }));
472
- return r.size ? r : /* @__PURE__ */ new Set(["*"]);
473
- }, J = (e, t) => {
474
- const r = e instanceof Set ? e : X(e);
475
- return [...it].some((n) => r.has(n)) || st(t).some((n) => r.has(n));
476
- }, ut = (e) => !!e && typeof e == "object" && !Array.isArray(e) && ("affectTypes" in e || "triggers" in e || "triggerImmediately" in e), ge = (e = ["*"]) => {
477
- if (ut(e)) return {
478
- affectTypes: X(e.affectTypes ?? e.triggers ?? ["*"]),
479
- triggerImmediately: e.triggerImmediately !== !1
480
- };
481
- const t = X(e);
482
- return {
483
- affectTypes: t,
484
- triggerImmediately: J(t, "initial")
485
- };
486
- }, ft = (e = ["*"]) => ut(e) ? {
487
- affectTypes: X(e.affectTypes ?? e.triggers ?? ["*"]),
488
- triggerImmediately: e.triggerImmediately === !0
489
- } : {
490
- affectTypes: X(e),
491
- triggerImmediately: !1
492
- }, ot = /* @__PURE__ */ Symbol.for("object.ts@Subscript");
493
- globalThis[ot] ??= class {
494
- compatible;
495
- #t;
496
- #e;
497
- #r = /* @__PURE__ */ new WeakSet();
498
- #f;
499
- #o;
500
- #l = /* @__PURE__ */ new Set();
501
- #n = /* @__PURE__ */ new Set();
502
- #c;
503
- #y = /* @__PURE__ */ new Map();
504
- #i = /* @__PURE__ */ new Map();
505
- #s = !1;
506
- constructor(t) {
507
- this.#t = t, this.#e = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new WeakSet(), this.#c = {
508
- enable: (i = ["*"], s) => s ? this.withTriggers(i, !0, s) : this.setTriggersEnabled(i, !0),
509
- disable: (i = ["*"], s) => s ? this.withTriggers(i, !1, s) : this.setTriggersEnabled(i, !1),
510
- set: (i, s) => this.setTriggersEnabled(i, s),
511
- with: (i, s) => this.withTriggers(i, !0, s),
512
- without: (i, s) => this.withTriggers(i, !1, s),
513
- isEnabled: (i) => this.isTriggerEnabled(i)
514
- }, this.#o = { next: (i) => {
515
- i && (Array.isArray(i) ? this.#u(...i) : this.#u(i));
516
- } };
517
- const r = new WeakRef(this), n = function(i) {
518
- const s = i?.next?.bind?.(i);
519
- return Mt(i, r, s);
520
- };
521
- this.#f = typeof Observable < "u" ? new Observable(n) : null, this.compatible = () => this.#f;
522
- }
523
- bindSource(t) {
524
- return this.#t ??= t, this;
525
- }
526
- $safeExec(t, ...r) {
527
- if (!(!t || this.#r.has(t))) {
528
- this.#r.add(t);
529
- try {
530
- const n = t(...r);
531
- if (n && typeof n.then == "function") {
532
- n.catch(console.warn);
533
- return;
534
- }
535
- return n;
536
- } catch (n) {
537
- console.warn(n);
538
- } finally {
539
- this.#r.delete(t);
540
- }
541
- }
542
- }
543
- #u(t, r = null, n, i = "all", ...s) {
544
- i = fe(i) ?? i;
545
- const u = this.#e;
546
- if (u?.size)
547
- for (const [l, f] of u.entries()) (f.prop === t || f.prop === te || f.prop === null) && J(f.triggers, i) && this.$safeExec(l, r, t, n, i, ...s);
548
- if (ve.size) {
549
- const l = {
550
- source: this.#t,
551
- target: this.#t,
552
- value: r,
553
- prop: t,
554
- name: t,
555
- oldValue: n,
556
- trigger: i,
557
- args: s
558
- };
559
- for (const [f, o] of ve.entries()) J(o, i) && this.$safeExec(f, l);
560
- }
561
- }
562
- wrap(t) {
563
- return Array.isArray(t) ? ce(t, this) : t;
564
- }
565
- get triggerControl() {
566
- return this.#c;
567
- }
568
- isTriggerEnabled(t) {
569
- return !J(this.#n, "all") && !st(t).some((r) => this.#n.has(r));
570
- }
571
- setTriggersEnabled(t = ["*"], r = !0) {
572
- const n = Je(t);
573
- for (const i of n) r ? this.#n.delete(i) : this.#n.add(i);
574
- }
575
- withTriggers(t, r, n) {
576
- const i = [...Je(t)], s = new Map(i.map((l) => [l, this.#n.has(l)])), u = () => {
577
- s.forEach((l, f) => {
578
- l ? this.#n.add(f) : this.#n.delete(f);
579
- });
580
- };
581
- this.setTriggersEnabled(i, r);
582
- try {
583
- const l = n?.();
584
- return l && typeof l.finally == "function" ? l.finally(u) : (u(), l);
585
- } catch (l) {
586
- throw u(), l;
587
- }
588
- }
589
- affected(t, r, n = ["*"]) {
590
- if (t == null || typeof t != "function") return;
591
- const i = ge(n);
592
- return this.#e.set(t, {
593
- prop: r || te,
594
- triggers: i.affectTypes
595
- }), () => this.unaffected(t, r || te);
596
- }
597
- unaffected(t, r) {
598
- if (t != null && typeof t == "function") {
599
- const n = this.#e, i = n?.get(t);
600
- if (i && (i.prop == r || r == null || r == te))
601
- return n.delete(t), () => this.affected(t, r || te, i.triggers);
602
- }
603
- return this.#e.clear();
604
- }
605
- trigger(t, r, n, i = "set", ...s) {
606
- if (typeof t == "symbol" || (i === void 0 && (i = "set"), i = fe(i) ?? i, !this.isTriggerEnabled(i))) return;
607
- const u = `${i ?? "all"}`;
608
- let l = this.#i.get(t);
609
- l || (l = /* @__PURE__ */ new Map(), this.#i.set(t, l)), l.set(u, [
610
- t,
611
- r,
612
- n,
613
- i,
614
- s
615
- ]), !this.#s && (this.#s = !0, queueMicrotask(() => {
616
- this.#s = !1;
617
- const f = this.#i;
618
- this.#i = /* @__PURE__ */ new Map();
619
- for (const [o, y] of f)
620
- if (!(o != null && this.#l.has(o))) {
621
- o != null && this.#l.add(o);
622
- try {
623
- for (const [, a] of y) {
624
- const [v, A, w, O, k] = a;
625
- try {
626
- this.#u(v, A, w, O, ...k ?? []);
627
- } catch (q) {
628
- console.warn(q);
629
- }
630
- }
631
- } finally {
632
- o != null && this.#l.delete(o);
633
- }
634
- }
635
- }));
636
- }
637
- get iterator() {
638
- return this.#o;
639
- }
640
- };
641
- var Wt = globalThis[ot], _t = /* @__PURE__ */ Symbol.for("object.ts@__safeGetGuard"), $t = /* @__PURE__ */ new Set([
642
- Symbol.toStringTag,
643
- Symbol.iterator,
644
- Symbol.asyncIterator,
645
- Symbol.toPrimitive,
646
- "toString",
647
- "valueOf",
648
- "inspect",
649
- "constructor",
650
- "__proto__",
651
- "prototype",
652
- "then",
653
- "catch",
654
- "finally",
655
- "next"
656
- ]), re = (e, t) => {
657
- if (!$t.has(t)) return null;
658
- const r = c(e, t);
659
- return typeof r == "function" ? H(e, r) : r;
660
- }, R = globalThis[_t] ??= /* @__PURE__ */ new WeakMap();
661
- function Ct(e, t) {
662
- let r = !0;
663
- try {
664
- R?.getOrInsert?.(e, /* @__PURE__ */ new Set())?.add?.(t), R?.get?.(e)?.has?.(t) && (r = !0), r = typeof Reflect.getOwnPropertyDescriptor(e, t)?.get == "function";
665
- } catch {
666
- r = !0;
667
- } finally {
668
- R?.get?.(e)?.delete?.(t);
669
- }
670
- return r;
671
- }
672
- var G = (e, t) => {
673
- if (m(e)) return e;
674
- const r = c(e, t);
675
- if (r == null && t != "value") {
676
- const n = c(e, "value");
677
- return n != null && !m(n) ? G(n, t) : r;
678
- } else if (t == "value" && r != null && !m(r) && typeof r != "function") return G(r, t) ?? r ?? e;
679
- return r ?? e;
680
- }, Vt = (e, t, r) => {
681
- if (e == null) return !1;
682
- let n = __safeSetGuard?.getOrInsert?.(e, /* @__PURE__ */ new Set());
683
- return n?.has?.(t) ? !1 : (n?.add?.(t), Reflect.set(e, t, r));
684
- }, c = (e, t, r) => {
685
- let n;
686
- if (e == null) return e;
687
- let i = R?.getOrInsert?.(e, /* @__PURE__ */ new Set());
688
- if (i?.has?.(t)) return null;
689
- if (!Ct(e, t)) n ??= Reflect.get(e, t, r ?? e);
690
- else {
691
- i?.add?.(t);
692
- try {
693
- n = Reflect.get(e, t, r ?? e);
694
- } catch {
695
- n = void 0;
696
- } finally {
697
- i.delete(t), i?.size === 0 && R?.delete?.(e);
698
- }
699
- }
700
- return typeof n == "function" ? H(e, n) : n;
701
- }, W = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Te = (e, t = !1) => !!e && typeof e == "object" && !Array.isArray(e) && (W(e, "key") || W(e, "name") || W(e, "oldValue") || W(e, "old") || W(e, "op") || W(e, "trigger") || t && W(e, "value")), N = (e, t, r) => W(e, t) ? e[t] : t == "oldValue" && W(e, "old") ? e.old : r(), Ae = (e, t = "manual") => fe(e.trigger ?? e.op ?? t), zt = (e) => typeof e == "string" || typeof e == "number" || typeof e == "symbol", be = (e) => {
702
- const t = c(e, de) ?? c(e, "realProp");
703
- return zt(t) ? t : null;
704
- }, Qe = (e, t) => t == "value" ? be(e) ?? t : t, Nt = (e, t) => {
705
- const r = be(e);
706
- return r != null && t == r ? c(e, "value") ?? c(e, d) ?? c(e, t) : t == null ? void 0 : c(e, t);
707
- }, Oe = (e, t) => {
708
- const r = (i, s, u) => (Te(s) || (u ??= s), t(Te(i) ? i : Te(s, !0) ? {
709
- key: i,
710
- trigger: u,
711
- ...s
712
- } : {
713
- key: i,
714
- trigger: u ?? s
715
- })), n = e?.triggerControl;
716
- return n && Object.assign(r, n), r.custom = (i, s, u, l) => r({
717
- key: s,
718
- trigger: i,
719
- value: u,
720
- oldValue: l
721
- }), r;
722
- }, xe = (e, t, r) => {
723
- if (e == null || m(e)) return e;
724
- if (([
725
- "deref",
726
- "bind",
727
- "@target",
728
- _,
729
- g,
730
- se
731
- ].indexOf(t) < 0 ? c(e, t)?.bind?.(e) : null) != null) return null;
732
- if ([g, _].indexOf(t) >= 0) return c(e, t) ?? e;
733
- if (t == d) return c(e, t) ?? c(e, "value");
734
- if (t == se) return r;
735
- if (t == At) return r?.triggerControl;
736
- if (t == Symbol.observable) return r?.compatible;
737
- if (t == Symbol.subscribe) return (n, i, s) => b(i != null ? [e, i] : e, n, s);
738
- if (t == Symbol.iterator || t == Symbol.asyncIterator) return c(e, t);
739
- if (t == Symbol.dispose) return (n) => {
740
- c(e, Symbol.dispose)?.(n), Ie(n != null ? [e, n] : e);
741
- };
742
- if (t == Symbol.asyncDispose) return (n) => {
743
- c(e, Symbol.asyncDispose)?.(n), Ie(n != null ? [e, n] : e);
744
- };
745
- if (t == Symbol.unsubscribe) return (n) => Ie(n != null ? [e, n] : e);
746
- if (typeof t == "symbol" && (t in e || c(e, t) != null)) return c(e, t);
747
- }, we = (e, t, r) => {
748
- if (t == "subscribe") return r?.compatible?.[t] ?? ((n) => {
749
- if (typeof n == "function") return b(e, n);
750
- if ("next" in n && n?.next != null) {
751
- const i = b(e, n?.next), s = n?.complete;
752
- return n.complete = (...u) => (i?.(), s?.(...u)), n.complete;
753
- }
754
- });
755
- }, Dt = class {
756
- #t;
757
- #e;
758
- #r;
759
- constructor(e, t, r) {
760
- this.#t = e, this.#e = t, this.#r = r;
761
- }
762
- get(e, t, r) {
763
- const n = re(e, t);
764
- return n ?? Reflect.get(e, t, r);
765
- }
766
- apply(e, t, r) {
767
- let n = [], i = [], s = [], u = [...this.#e], l = -1;
768
- const f = Reflect.apply(e, t || this.#e, r);
769
- if (this.#r?.[h])
770
- return Array.isArray(f) ? _e(f) : f;
771
- switch (this.#t) {
772
- case "push":
773
- l = u?.length, n = r;
774
- break;
775
- case "unshift":
776
- l = 0, n = r;
777
- break;
778
- case "pop":
779
- l = u?.length - 1, u.length > 0 && (i = [u[l]]);
780
- break;
781
- case "shift":
782
- l = 0, u.length > 0 && (i = [u[l]]);
783
- break;
784
- case "splice":
785
- l = r[0];
786
- for (let y = 0; y < Math.max(u.length, this.#e.length); y++) {
787
- const a = u[y], v = this.#e[y];
788
- v === void 0 && y >= this.#e.length ? i.push(a) : a === void 0 && y >= u.length ? s.push([
789
- y,
790
- v,
791
- void 0,
792
- !1
793
- ]) : x(a, v) && s.push([
794
- y,
795
- v,
796
- a,
797
- !0
798
- ]);
799
- }
800
- break;
801
- case "sort":
802
- case "fill":
803
- case "reverse":
804
- case "copyWithin":
805
- l = 0;
806
- for (let y = 0; y < u.length; y++) x(u[y], this.#e[y]) && s.push([
807
- l + y,
808
- this.#e[y],
809
- u[y],
810
- !0
811
- ]);
812
- break;
813
- case "set":
814
- l = r[1], s.push([
815
- l,
816
- r[0],
817
- u?.[l],
818
- l in u
819
- ]);
820
- break;
821
- }
822
- const o = p.get(this.#e);
823
- return n?.length == 1 ? o?.trigger?.(l, n[0], null, "add") : n?.length > 1 && (o?.trigger?.(l, n, null, "addAll"), n.forEach((y, a) => o?.trigger?.(l + a, y, null, "add"))), s?.length == 1 ? o?.trigger?.(s[0]?.[0] ?? l, s[0]?.[1], s[0]?.[2], s[0]?.[3] === !1 ? "add" : "set") : s?.length > 1 && (o?.trigger?.(l, s, u, "setAll"), s.forEach((y, a) => o?.trigger?.(y?.[0] ?? l + a, y?.[1], y?.[2], y?.[3] === !1 ? "add" : "set"))), i?.length == 1 ? o?.trigger?.(l, null, i[0], "delete") : i?.length > 1 && (o?.trigger?.(l, null, i, "deleteAll"), i.forEach((y, a) => o?.trigger?.(l + a, null, y, "delete"))), f == e ? new Proxy(f, this.#r) : Array.isArray(f) ? _e(f) : f;
824
- }
825
- }, Bt = (e, t, r, n) => {
826
- const i = Number.isInteger(r) && Number.isInteger(n) && n < r ? t.slice(n, r) : [];
827
- if (!e[h] && r !== n) {
828
- const s = p.get(t);
829
- i.length === 1 ? s?.trigger?.(n, null, i[0], "delete") : i.length > 1 && (s?.trigger?.(n, null, i, "deleteAll"), i.forEach((l, f) => s?.trigger?.(n + f, null, l, "delete")));
830
- const u = Number.isInteger(r) && Number.isInteger(n) && n > r ? n - r : 0;
831
- if (u === 1) s?.trigger?.(r, void 0, null, "add");
832
- else if (u > 1) {
833
- const l = Array(u).fill(void 0);
834
- s?.trigger?.(r, l, null, "addAll"), l.forEach((f, o) => s?.trigger?.(r + o, void 0, null, "add"));
835
- }
836
- }
837
- }, Ft = class {
838
- [h];
839
- constructor() {
840
- }
841
- has(e, t) {
842
- return Reflect.has(e, t);
843
- }
844
- get(e, t, r) {
845
- const n = re(e, t);
846
- if (n != null) return n;
847
- if ([
848
- g,
849
- _,
850
- "@target",
851
- "deref"
852
- ].indexOf(t) >= 0 && c(e, t) != null && c(e, t) != e) return typeof c(e, t) == "function" ? c(e, t)?.bind?.(e) : c(e, t);
853
- const i = p?.get?.(e), s = xe(e, t, i);
854
- if (s != null) return s;
855
- const u = we(e, t, i);
856
- if (u != null) return u;
857
- if (t == me) return pe.call(this, this);
858
- if (t == D) return Oe(i, (f) => {
859
- const o = f.key ?? f.name ?? 0, y = N(f, "value", () => c(e, o)), a = N(f, "oldValue", () => {
860
- });
861
- return i?.trigger?.(o, y, a, Ae(f, "manual"));
862
- });
863
- if (t == "@target" || t == g) return e;
864
- if (t == "x") return () => e?.x ?? e?.[0];
865
- if (t == "y") return () => e?.y ?? e?.[1];
866
- if (t == "z") return () => e?.z ?? e?.[2];
867
- if (t == "w") return () => e?.w ?? e?.[3];
868
- if (t == "r") return () => e?.r ?? e?.[0];
869
- if (t == "g") return () => e?.g ?? e?.[1];
870
- if (t == "b") return () => e?.b ?? e?.[2];
871
- if (t == "a") return () => e?.a ?? e?.[3];
872
- const l = c(e, t) ?? (t == "value" ? c(e, d) : null);
873
- return typeof l == "function" ? new Proxy(typeof l == "function" ? l?.bind?.(e) : l, new Dt(t, e, this)) : l;
874
- }
875
- set(e, t, r) {
876
- if (typeof t != "symbol" && Number.isInteger(parseInt(t)) && (t = parseInt(t) ?? t), t == h && r)
877
- return this[h] = !!r, !0;
878
- if (t == h && !r)
879
- return delete this[h], !0;
880
- const n = c(e, t), i = [
881
- "x",
882
- "y",
883
- "z",
884
- "w"
885
- ], s = [
886
- "r",
887
- "g",
888
- "b",
889
- "a"
890
- ], u = i.indexOf(t), l = s.indexOf(t);
891
- let f = !1;
892
- return u >= 0 ? f = Reflect.set(e, u, r) : l >= 0 ? f = Reflect.set(e, l, r) : f = Reflect.set(e, t, r), t == "length" && x(n, r) && Bt(this, e, n, r), !this[h] && typeof t != "symbol" && x(n, r) && p?.get?.(e)?.trigger?.(t, r, n, "set"), f;
893
- }
894
- deleteProperty(e, t) {
895
- if (typeof t != "symbol" && Number.isInteger(parseInt(t)) && (t = parseInt(t) ?? t), t == h)
896
- return delete this[h], !0;
897
- const r = c(e, t), n = Reflect.deleteProperty(e, t);
898
- return !this[h] && t != "length" && t != h && typeof t != "symbol" && r != null && p.get(e)?.trigger?.(t, t, r, "delete"), n;
899
- }
900
- }, Gt = class {
901
- [h];
902
- constructor() {
903
- }
904
- get(e, t, r) {
905
- if ([
906
- g,
907
- _,
908
- "@target",
909
- "deref",
910
- "then",
911
- "catch",
912
- "finally"
913
- ].indexOf(t) >= 0 && c(e, t) != null && c(e, t) != e) return typeof c(e, t) == "function" ? H(e, c(e, t)) : c(e, t);
914
- const n = p.get(e) ?? p.get(c(e, "value") ?? e), i = xe(e, t, n);
915
- if (i != null) return i;
916
- c(e, t) == null && t != "value" && I(e) && c(e, "value") != null && (typeof c(e, "value") == "object" || typeof c(e, "value") == "function") && c(c(e, "value"), t) != null && (e = c(e, "value") ?? e);
917
- const s = we(e, t, n);
918
- return s ?? (t == me ? pe.call(this, this) : t == D ? Oe(n, (u) => {
919
- const l = Qe(e, u.key ?? u.name ?? be(e) ?? "value"), f = N(u, "oldValue", () => l == "value" || l == be(e) ? c(e, d) : void 0), o = N(u, "value", () => Nt(e, l));
920
- return n?.trigger?.(l, o, f, Ae(u, "manual"));
921
- }) : t == Symbol.toPrimitive ? (u) => {
922
- const l = G(e, t);
923
- return c(l, t) ? c(l, t)?.(u) : m(l) ? E(l, u) : m(c(l, "value")) ? E(c(l, "value"), u) : E(c(l, "value") ?? l, u);
924
- } : t == Symbol.toStringTag ? () => {
925
- const u = G(e, t);
926
- return c(u, t) ? c(u, t)?.() : m(u) ? String(u ?? "") || "" : m(c(u, "value")) ? String(c(u, "value") ?? "") || "" : String(c(u, "value") ?? u ?? "") || "";
927
- } : t == "toString" ? () => {
928
- const u = G(e, t);
929
- return c(u, t) ? c(u, t)?.() : c(u, Symbol.toStringTag) ? c(u, Symbol.toStringTag)?.() : m(u) ? String(u ?? "") || "" : m(c(u, "value")) ? String(c(u, "value") ?? "") || "" : String(c(u, "value") ?? u ?? "") || "";
930
- } : t == "valueOf" ? () => {
931
- const u = G(e, t);
932
- return c(u, t) ? c(u, t)?.() : c(u, Symbol.toPrimitive) ? c(u, Symbol.toPrimitive)?.() : m(u) ? u : m(c(u, "value")) ? c(u, "value") : c(u, "value") ?? u;
933
- } : typeof t == "symbol" && (t in e || c(e, t) != null) ? c(e, t) : G(e, t));
934
- }
935
- apply(e, t, r) {
936
- return Reflect.apply(e, t, r);
937
- }
938
- ownKeys(e) {
939
- return Reflect.ownKeys(e);
940
- }
941
- construct(e, t, r) {
942
- return Reflect.construct(e, t, r);
943
- }
944
- isExtensible(e) {
945
- return Reflect.isExtensible(e);
946
- }
947
- getOwnPropertyDescriptor(e, t) {
948
- let r;
949
- try {
950
- R?.getOrInsert?.(e, /* @__PURE__ */ new Set())?.add?.(t), R?.get?.(e)?.has?.(t) && (r = void 0), r = Reflect.getOwnPropertyDescriptor(e, t);
951
- } catch {
952
- r = void 0;
953
- } finally {
954
- R?.get?.(e)?.delete?.(t);
955
- }
956
- return r;
957
- }
958
- has(e, t) {
959
- return t in e;
960
- }
961
- set(e, t, r) {
962
- const n = re(e, t);
963
- return n ?? ht(r, (i) => {
964
- const s = re(i, t);
965
- if (s != null) return s;
966
- if (t == h && r)
967
- return this[h] = !!r, !0;
968
- if (t == h && !r)
969
- return delete this[h], !0;
970
- const u = e;
971
- if (c(e, t) == null && t != "value" && I(e) && c(e, "value") != null && (typeof c(e, "value") == "object" || typeof c(e, "value") == "function") && c(c(e, "value"), t) != null && (e = c(e, "value") ?? e), typeof t == "symbol" && !(c(e, t) != null && t in e)) return;
972
- const l = Qe(e, t), f = t == "value" ? c(e, d) ?? c(e, t) : c(e, t);
973
- e[t] = i;
974
- const o = c(e, t) ?? i;
975
- return !this[h] && typeof t != "symbol" && (c(e, Ot) ?? x)?.(f, o) && (p.get(e) ?? p.get(u))?.trigger?.(l, i, f), !0;
976
- });
977
- }
978
- defineProperty(e, t, r) {
979
- const n = re(e, t);
980
- if (n != null) return n;
981
- if (t == h && r.value)
982
- return this[h] = !!r.value, !0;
983
- if (t == h && !r.value)
984
- return delete this[h], !0;
985
- if (c(e, t) == null && t != "value" && I(e) && c(e, "value") != null && (typeof c(e, "value") == "object" || typeof c(e, "value") == "function") && c(c(e, "value"), t) != null && (e = c(e, "value") ?? e), r.get == null && r.set == null) return Reflect.defineProperty(e, t, r);
986
- const i = c(e, t), s = Reflect.defineProperty(e, t, {
987
- get: r.get,
988
- set: r.set,
989
- enumerable: r.enumerable ?? !0,
990
- configurable: r.configurable ?? !0
991
- });
992
- return Vt(e, t, i), s;
993
- }
994
- deleteProperty(e, t) {
995
- if (t == h)
996
- return delete this[h], !0;
997
- c(e, t) == null && t != "value" && I(e) && c(e, "value") != null && (typeof c(e, "value") == "object" || typeof c(e, "value") == "function") && c(c(e, "value"), t) != null && (e = c(e, "value") ?? e);
998
- const r = c(e, t), n = Reflect.deleteProperty(e, t);
999
- return !this[h] && t != h && typeof t != "symbol" && p.get(e)?.trigger?.(t, null, r, "delete"), n;
1000
- }
1001
- }, Ht = class {
1002
- [h];
1003
- constructor() {
1004
- }
1005
- get(e, t, r) {
1006
- if ([
1007
- g,
1008
- _,
1009
- "@target",
1010
- "deref"
1011
- ].indexOf(t) >= 0 && c(e, t) != null && c(e, t) != e) return typeof c(e, t) == "function" ? H(e, c(e, t)) : c(e, t);
1012
- const n = p.get(e), i = xe(e, t, n);
1013
- if (i != null) return i;
1014
- const s = we(e, t, n);
1015
- if (s != null) return s;
1016
- e = c(e, g) ?? c(e, _) ?? e;
1017
- const u = H(e, c(e, t));
1018
- return typeof t == "symbol" && (t in e || c(e, t) != null) ? u : t == me ? pe.call(this, this) : t == D ? Oe(n, (l) => {
1019
- const f = l.key ?? l.name;
1020
- if (f == null) return;
1021
- const o = N(l, "value", () => e.get(f));
1022
- if (o == null && !W(l, "value")) return;
1023
- const y = N(l, "oldValue", () => {
1024
- });
1025
- return n?.trigger?.(f, o, y, Ae(l, "manual"));
1026
- }) : t == "clear" ? () => {
1027
- const l = Array.from(e?.entries?.() || []), f = u();
1028
- return l.forEach(([o, y]) => {
1029
- this[h] || p.get(e)?.trigger?.(o, null, y, "delete");
1030
- }), f;
1031
- } : t == "delete" ? (l, f = null) => {
1032
- const o = e.has(l), y = e.get(l), a = u(l);
1033
- return !this[h] && o && p.get(e)?.trigger?.(l, null, y, "delete"), a;
1034
- } : t == "set" ? (l, f) => dt(f, (o) => {
1035
- const y = e.has(l), a = e.get(l), v = u(l, o);
1036
- return (!y || x(a, o)) && (this[h] || p.get(e)?.trigger?.(l, o, y ? a : null, y ? "set" : "add")), v;
1037
- }) : u;
1038
- }
1039
- set(e, t, r) {
1040
- return t == h ? (this[h] = !!r, !0) : t == h && !r ? (delete this[h], !0) : Reflect.set(e, t, r);
1041
- }
1042
- has(e, t) {
1043
- return Reflect.has(e, t);
1044
- }
1045
- apply(e, t, r) {
1046
- return Reflect.apply(e, t, r);
1047
- }
1048
- construct(e, t, r) {
1049
- return Reflect.construct(e, t, r);
1050
- }
1051
- ownKeys(e) {
1052
- return Reflect.ownKeys(e);
1053
- }
1054
- isExtensible(e) {
1055
- return Reflect.isExtensible(e);
1056
- }
1057
- getOwnPropertyDescriptor(e, t) {
1058
- let r;
1059
- try {
1060
- R?.getOrInsert?.(e, /* @__PURE__ */ new Set())?.add?.(t), R?.get?.(e)?.has?.(t) && (r = void 0), r = Reflect.getOwnPropertyDescriptor(e, t);
1061
- } catch {
1062
- r = void 0;
1063
- } finally {
1064
- R?.get?.(e)?.delete?.(t);
1065
- }
1066
- return r;
1067
- }
1068
- deleteProperty(e, t) {
1069
- return t == h ? (delete this[h], !0) : Reflect.deleteProperty(e, t);
1070
- }
1071
- }, Kt = class {
1072
- [h] = !1;
1073
- constructor() {
1074
- }
1075
- get(e, t, r) {
1076
- if ([
1077
- g,
1078
- _,
1079
- "@target",
1080
- "deref"
1081
- ].indexOf(t) >= 0 && c(e, t) != null && c(e, t) != e) return typeof c(e, t) == "function" ? H(e, c(e, t)) : c(e, t);
1082
- const n = p.get(e), i = xe(e, t, n);
1083
- if (i != null) return i;
1084
- const s = we(e, t, n);
1085
- if (s != null) return s;
1086
- e = c(e, g) ?? c(e, _) ?? e;
1087
- const u = H(e, c(e, t));
1088
- return typeof t == "symbol" && (t in e || c(e, t) != null) ? u : t == me ? pe.call(this, this) : t == D ? Oe(n, (l) => {
1089
- const f = l.key ?? l.name;
1090
- if (f == null) return;
1091
- const o = N(l, "value", () => e.has(f)), y = N(l, "oldValue", () => {
1092
- });
1093
- return n?.trigger?.(f, o, y, Ae(l, "manual"));
1094
- }) : t == "clear" ? () => {
1095
- const l = Array.from(e?.values?.() || []), f = u();
1096
- return l.forEach((o) => {
1097
- this[h] || p.get(e)?.trigger?.(null, null, o, "delete");
1098
- }), f;
1099
- } : t == "delete" ? (l) => {
1100
- const f = e.has(l), o = f ? l : null, y = u(l);
1101
- return !this[h] && f && p.get(e)?.trigger?.(l, null, o, "delete"), y;
1102
- } : t == "add" ? (l) => {
1103
- const f = e.has(l), o = f ? l : null, y = u(l);
1104
- return f || this[h] || p.get(e)?.trigger?.(l, l, o, "add"), y;
1105
- } : u;
1106
- }
1107
- set(e, t, r) {
1108
- return t == h && r ? (this[h] = !!r, !0) : t == h && !r ? (delete this[h], !0) : Reflect.set(e, t, r);
1109
- }
1110
- has(e, t) {
1111
- return Reflect.has(e, t);
1112
- }
1113
- apply(e, t, r) {
1114
- return Reflect.apply(e, t, r);
1115
- }
1116
- construct(e, t, r) {
1117
- return Reflect.construct(e, t, r);
1118
- }
1119
- ownKeys(e) {
1120
- return Reflect.ownKeys(e);
1121
- }
1122
- isExtensible(e) {
1123
- return Reflect.isExtensible(e);
1124
- }
1125
- getOwnPropertyDescriptor(e, t) {
1126
- let r;
1127
- try {
1128
- R?.getOrInsert?.(e, /* @__PURE__ */ new Set())?.add?.(t), R?.get?.(e)?.has?.(t) && (r = void 0), r = Reflect.getOwnPropertyDescriptor(e, t);
1129
- } catch {
1130
- r = void 0;
1131
- } finally {
1132
- R?.get?.(e)?.delete?.(t);
1133
- }
1134
- return r;
1135
- }
1136
- deleteProperty(e, t) {
1137
- return t == h ? (delete this[h], !0) : Reflect.deleteProperty(e, t);
1138
- }
1139
- }, Y = (e) => !!((typeof e == "object" || typeof e == "function") && e != null && (e?.[g] || e?.[ue])), _e = (e) => Y(e) ? e : ce(e, new Ft()), qt = (e) => Y(e) ? e : ce(e, new Gt()), Ut = (e) => Y(e) ? e : ce(e, new Ht()), jt = (e) => Y(e) ? e : ce(e, new Kt()), Jt = (e, t) => {
1140
- const r = e instanceof Promise || typeof e?.then == "function", n = T({
1141
- [oe]: r ? e : null,
1142
- [d]: r ? 0 : Number(C(e) || 0) || 0,
1143
- [K]: t,
1144
- [Symbol?.toStringTag]() {
1145
- return String(this?.[d] ?? "") || "";
1146
- },
1147
- [Symbol?.toPrimitive](i) {
1148
- return E((typeof this?.[d] != "object" ? this?.[d] : this?.[d]?.value || 0) ?? 0, i);
1149
- },
1150
- set value(i) {
1151
- this[d] = (i != null && !Number.isNaN(i) ? Number(i) : this[d]) || 0;
1152
- },
1153
- get value() {
1154
- return Number(this[d] || 0) || 0;
1155
- }
1156
- });
1157
- return e?.then?.((i) => n.value = i), n;
1158
- }, Qt = (e, t) => {
1159
- const r = e instanceof Promise || typeof e?.then == "function", n = T({
1160
- [oe]: r ? e : null,
1161
- [d]: (r ? "" : String(C(typeof e == "number" ? String(e) : e || ""))) ?? "",
1162
- [K]: t,
1163
- [Symbol?.toStringTag]() {
1164
- return String(this?.[d] ?? "") ?? "";
1165
- },
1166
- [Symbol?.toPrimitive](i) {
1167
- return E(this?.[d] ?? "", i);
1168
- },
1169
- set value(i) {
1170
- this[d] = String(typeof i == "number" ? String(i) : i || "") ?? "";
1171
- },
1172
- get value() {
1173
- return String(this[d] ?? "") ?? "";
1174
- }
1175
- });
1176
- return e?.then?.((i) => n.value = i), n;
1177
- }, Xt = (e, t) => {
1178
- const r = e instanceof Promise || typeof e?.then == "function", n = T({
1179
- [oe]: r ? e : null,
1180
- [d]: (r ? !1 : (C(e) != null ? typeof C(e) == "string" ? !0 : !!C(e) : !1) || !1) || !1,
1181
- [K]: t,
1182
- [Symbol?.toStringTag]() {
1183
- return String(this?.[d] ?? "") || "";
1184
- },
1185
- [Symbol?.toPrimitive](i) {
1186
- return E(!!this?.[d] || !1, i);
1187
- },
1188
- set value(i) {
1189
- this[d] = (i != null ? typeof i == "string" ? !0 : !!i : this[d]) || !1;
1190
- },
1191
- get value() {
1192
- return this[d] || !1;
1193
- }
1194
- });
1195
- return e?.then?.((i) => n.value = i), n;
1196
- }, Xe = (e, t) => {
1197
- const r = e instanceof Promise || typeof e?.then == "function", n = T({
1198
- [oe]: r ? e : null,
1199
- [K]: t,
1200
- [Symbol?.toStringTag]() {
1201
- return String(this.value ?? "") || "";
1202
- },
1203
- [Symbol?.toPrimitive](i) {
1204
- return E(this.value, i);
1205
- },
1206
- value: r ? null : C(e)
1207
- });
1208
- return e?.then?.((i) => n.value = i), b(e, (i) => {
1209
- n?.[D]?.();
1210
- }), n;
1211
- }, Pe = (e, t) => {
1212
- if (e == null || typeof e != "object" && typeof e != "function") return e;
1213
- try {
1214
- Object.defineProperty(e, de, {
1215
- value: t,
1216
- writable: !0,
1217
- configurable: !0
1218
- });
1219
- } catch {
1220
- try {
1221
- e[de] = t;
1222
- } catch {
1223
- }
1224
- }
1225
- try {
1226
- Object.defineProperty(e, "realProp", {
1227
- value: t,
1228
- writable: !0,
1229
- configurable: !0
1230
- });
1231
- } catch {
1232
- try {
1233
- e.realProp = t;
1234
- } catch {
1235
- }
1236
- }
1237
- return e;
1238
- }, Yt = (e, t = "value", r, n) => {
1239
- if (m(e) || !e) return e;
1240
- Array.isArray(e) && e.length == 2 && e[0] != null && (e[0] instanceof Map || e[0] instanceof WeakMap || e[0] instanceof Set || e[0] instanceof WeakSet) ? ((t == null || t === "value") && (t = e[1]), e = e[0]) : Array.isArray(e) && !le(e?.[1], e) && (Array.isArray(e?.[0]) || typeof e?.[0] == "object" || typeof e?.[0] == "function") && (e = e?.[0]);
1241
- const i = e instanceof Map || e instanceof WeakMap, s = e instanceof Set || e instanceof WeakSet;
1242
- if (i || s) {
1243
- if (t == null) return;
1244
- } else if ((t ??= Array.isArray(e) ? null : "value") == null || le(t, e)) return;
1245
- const u = () => i ? e.get(t) : s ? e.has(t) : e?.[t], l = (a) => i ? (e.set(t, a), a) : s ? (a ? e.add(t) : e.delete(t), e.has(t)) : e[t] = a;
1246
- i && r !== void 0 && !e.has(t) ? e.set(t, r) : s && r && !e.has(t) && e.add(t);
1247
- const f = u();
1248
- if (!s && t != null && I(f) && V(f)) return Pe(er(f), t);
1249
- if (!i && !s && t && typeof e?.getProperty == "function" && V(e?.getProperty?.(t))) return Pe(e?.getProperty?.(t), t);
1250
- !i && !s && (e[t] ??= r ?? e[t]);
1251
- const o = T({
1252
- [d]: s ? !!u() : u() ?? r,
1253
- [K]: n,
1254
- [Symbol?.toStringTag]() {
1255
- return String(u() ?? this[d] ?? "") || "";
1256
- },
1257
- [Symbol?.toPrimitive](a) {
1258
- return E(u(), a);
1259
- },
1260
- set value(a) {
1261
- if (o[Q] = !0, s) this[d] = l(a);
1262
- else {
1263
- const v = a ?? vt(u());
1264
- this[d] = l(v);
1265
- }
1266
- o[Q] = !1;
1267
- },
1268
- get value() {
1269
- const a = u();
1270
- return this[d] = s ? !!a : a ?? this[d];
1271
- }
1272
- });
1273
- Pe(o, t);
1274
- const y = b(e, (a, v, A, w) => {
1275
- if (v === t) {
1276
- const O = s ? a != null : a, k = s ? A != null : A;
1277
- o?.[D]?.({
1278
- key: t,
1279
- value: O,
1280
- oldValue: k,
1281
- trigger: w
1282
- });
1283
- }
1284
- });
1285
- return M(o, Symbol.dispose, y), o;
1286
- }, Zt = (e, t) => {
1287
- switch (typeof e) {
1288
- case "boolean":
1289
- return Xt(e, t);
1290
- case "number":
1291
- return Jt(e, t);
1292
- case "string":
1293
- return Qt(e, t);
1294
- case "object":
1295
- if (e != null) return Xe(T(e), t);
1296
- default:
1297
- return Xe(e, t);
1298
- }
1299
- }, Lt = (e, t = "value", r) => {
1300
- const n = V(e) ? e : Zt(e, r);
1301
- return t != null ? Yt(n, t, r) : n;
1302
- }, Ar = (e, t) => Lt(e, t), ze = (e, t, r = 100) => {
1303
- if (e?.value ?? e) return setTimeout(() => {
1304
- e.value && t?.();
1305
- }, r);
1306
- }, Or = (e = 100) => (t, [r], [n]) => {
1307
- let i = ze(r, t, e);
1308
- n?.addEventListener?.("abort", () => {
1309
- i && clearTimeout(i);
1310
- }, { once: !0 });
1311
- }, xr = (e = 100) => (t, [r], [n]) => {
1312
- let i = ze(r, t, e);
1313
- n?.addEventListener?.("abort", () => {
1314
- i && clearTimeout(i);
1315
- }, { once: !0 }), i || t?.();
1316
- };
1317
- function T(e, t) {
1318
- if (e == null || typeof e == "symbol" || !(typeof e == "object" || typeof e == "function") || Y(e) || (e = C?.(e)) == null || e instanceof Promise || e instanceof WeakRef || Y(e)) return e;
1319
- const r = e;
1320
- if (r == null || typeof r == "symbol" || !(typeof r == "object" || typeof r == "function") || r instanceof Promise || r instanceof WeakRef) return r;
1321
- let n = r;
1322
- return Array.isArray(r) ? (n = _e(r), n) : r instanceof Map ? (n = Ut(r), n) : r instanceof Set ? (n = jt(r), n) : ((typeof r == "function" || typeof r == "object") && (n = qt(r)), n);
1323
- }
1324
- var V = (e) => typeof HTMLInputElement < "u" && e instanceof HTMLInputElement ? !0 : !!((typeof e == "object" || typeof e == "function") && e != null && (e?.[g] || e?.[ue] || p?.has?.(e))), er = (e) => V(e) ? T(e) : null, wr = (e) => {
1325
- if (e == null || typeof e != "object" && typeof e != "function" || e?.[Symbol.observable] != null) return e;
1326
- try {
1327
- e[Symbol.observable] = self?.compatible;
1328
- } catch {
1329
- console.warn("Unable to assign <[Symbol.observable]>, object will not observable by other frameworks");
1330
- }
1331
- return e[ue] = (t, r, n) => {
1332
- const i = e?.[Symbol?.observable];
1333
- return i?.()?.affected?.(t, r, n), () => i?.()?.unaffected?.(t, r);
1334
- }, e;
1335
- }, tr = /* @__PURE__ */ Symbol.for("object.ts@specializedSubscribe"), U = globalThis[tr] ??= /* @__PURE__ */ new WeakMap(), Ne = (e) => {
1336
- if (!(typeof e == "symbol" || e == null || !(typeof e == "object" || typeof e == "function")))
1337
- return e;
1338
- }, Se = "initial", De = (e) => {
1339
- const t = e?.[de] ?? e?.realProp;
1340
- return z(t) ? t : null;
1341
- }, Be = (e, t) => {
1342
- const r = De(e);
1343
- return r != null && (t == null || t == "value") ? r : t;
1344
- }, rr = (e, t) => t != null && t == De(e) ? e?.value : e?.[t], $e = (e, t, r, n) => {
1345
- if (t != null && t == De(e)) {
1346
- const i = rr(e, t);
1347
- if (i != null) return r?.(i, t, null, "set");
1348
- }
1349
- return ae(e, t, r, n);
1350
- }, ct = (e, t, r) => {
1351
- const n = ge(t);
1352
- if (r == Se) {
1353
- if (!n.triggerImmediately) return;
1354
- } else if (!J(n.affectTypes, r)) return;
1355
- return (i, s, u, ...l) => e?.(i, s, u, r, ...l);
1356
- }, nr = (e, t, r, n = ["*"]) => {
1357
- if (!e || !Ne(e)) return;
1358
- const i = t != Symbol.iterator ? Be(e, t) : null;
1359
- let s = e?.[se] ?? p.get(e);
1360
- e = e?.[g] ?? e, queueMicrotask(() => {
1361
- const l = ct(r, n, Se);
1362
- l && (i != null && i != Symbol.iterator ? $e(e, i, l, null) : Ce(e, l, null));
1363
- });
1364
- let u = s?.affected?.(r, i, n);
1365
- return e?.[Symbol.dispose] || (M(u, Symbol.dispose, u), M(u, Symbol.asyncDispose, u), M(e, Symbol.dispose, u), M(e, Symbol.asyncDispose, u)), u;
1366
- }, ir = (e, t, r, n = ["*"]) => {
1367
- const i = ge(n).affectTypes, s = {};
1368
- let u = e?.value;
1369
- const l = (f) => {
1370
- const o = f?.target?.value;
1371
- J(i, "set") && r?.(o, "value", u, "set", f), u = o;
1372
- };
1373
- return e?.addEventListener?.("change", l, s), () => e?.removeEventListener?.("change", l, s);
1374
- }, ne = (e) => Array.isArray(e) && e?.length == 2 && Ne(e?.[0]) && (z(e?.[1]) || e?.[1] == Symbol.iterator), lr = (e) => !!e && typeof e == "object" && !Array.isArray(e) && ("affectTypes" in e || "triggers" in e || "triggerImmediately" in e), sr = (e) => e == null ? [] : Array.isArray(e) && !ne(e) && !V(e) ? e : [e], ur = (e) => {
1375
- if (ne(e)) {
1376
- const t = e?.[0];
1377
- return {
1378
- source: e,
1379
- target: t,
1380
- prop: Be(t, e?.[1])
1381
- };
1382
- }
1383
- return {
1384
- source: e,
1385
- target: e,
1386
- prop: null
1387
- };
1388
- }, fr = (e, t, r, n, i, s, u) => ({
1389
- source: e,
1390
- target: t,
1391
- value: r,
1392
- prop: n,
1393
- name: n,
1394
- oldValue: i,
1395
- trigger: s,
1396
- args: u
1397
- }), or = (e, t, r, n = ["*"]) => {
1398
- const i = z(e?.[1]) ? e?.[1] : null;
1399
- return b(e?.[0], i, r, n);
1400
- }, cr = (e, t, r, n = ["*"]) => e?.then?.((i) => b?.(i, t, r, n))?.catch?.((i) => (console.warn(i), null)), b = (e, t, r = () => {
1401
- }, n) => {
1402
- if (typeof t == "function" ? (n = r, r = t, t = null) : t = Be(e, t), (typeof r == "object" || Array.isArray(r)) && (n = r, r = () => {
1403
- }), (m(e) || typeof e == "symbol") && ge(n).triggerImmediately)
1404
- return Ee(globalThis?.Promise?.try?.(() => r?.(e, null, null, null, Se)));
1405
- if (typeof e?.[ue] == "function") return e?.[ue]?.(r, t, n);
1406
- if (Ne(e)) {
1407
- const i = e;
1408
- if (U?.has?.(e = e?.[g] ?? e)) return U?.get?.(e)?.(i, t, r, n);
1409
- if (V(i) || ne(e) && V(e?.[0])) return We(e) ? U?.getOrInsert?.(e, cr)?.(e, t, r, n) : ne(e) ? U?.getOrInsert?.(e, or)?.(e, t, r, n) : typeof HTMLInputElement < "u" && e instanceof HTMLInputElement ? U?.getOrInsert?.(e, ir)?.(e, t, r, n) : U?.getOrInsert?.(e, nr)?.(i, t, r, n);
1410
- {
1411
- const s = ct(r, n, Se);
1412
- return s ? Ee(globalThis?.Promise?.try?.(() => ne(e) ? $e?.(e?.[0], e?.[1], s, null) : t != null && t != Symbol.iterator ? $e?.(e, t, s, null) : Ce?.(e, s, null))) : void 0;
1413
- }
1414
- }
1415
- };
1416
- function yr(e, t, r) {
1417
- if (e == null || typeof e != "function") return;
1418
- if (lr(t) && r === void 0) return je(e, t);
1419
- if (t == null) return je(e, r);
1420
- const n = ft(r), i = {
1421
- affectTypes: n.affectTypes,
1422
- triggerImmediately: n.triggerImmediately
1423
- }, s = sr(t).map((u) => {
1424
- const l = ur(u);
1425
- return b(l.target, l.prop, (f, o, y, a, ...v) => e(fr(l.source, l.target, f, o, y, a ?? null, v)), i);
1426
- }).filter((u) => typeof u == "function");
1427
- return () => s.forEach((u) => u?.());
1428
- }
1429
- function Rr(e, t, r) {
1430
- return yr(t, e, r);
1431
- }
1432
- var Tr = (e) => e instanceof Set ? yt(e) : e instanceof Map ? br(e) : e, ar = class {
1433
- #t = /* @__PURE__ */ new WeakMap();
1434
- #e(e) {
1435
- let t = this.#t.get(e);
1436
- return t || (t = /* @__PURE__ */ new WeakMap(), this.#t.set(e, t)), t;
1437
- }
1438
- #r(e) {
1439
- return !Array.isArray(e) || e.length !== 2 ? [null, null] : e;
1440
- }
1441
- hasL1(e) {
1442
- return this.#t.has(e);
1443
- }
1444
- set(e, t) {
1445
- const [r, n] = this.#r(e);
1446
- return this.#e(r).set(n, t), this;
1447
- }
1448
- get(e) {
1449
- const [t, r] = this.#r(e);
1450
- return this.#t.get(t)?.get(r);
1451
- }
1452
- has(e) {
1453
- const [t, r] = this.#r(e);
1454
- return this.#t.get(t)?.has(r) ?? !1;
1455
- }
1456
- delete(e) {
1457
- const [t, r] = this.#r(e), n = this.#t.get(t);
1458
- return n ? n.delete(r) : !1;
1459
- }
1460
- deleteTop(e) {
1461
- return this.#t.delete(e);
1462
- }
1463
- getOrCreate(e, t) {
1464
- const [r, n] = this.#r(e), i = this.#e(r);
1465
- if (i.has(n)) return i.get(n);
1466
- const s = t();
1467
- return i.set(n, s), s;
1468
- }
1469
- getOrInsert(e, t) {
1470
- const [r, n] = this.#r(e), i = this.#e(r);
1471
- return i.has(n) ? i.get(n) : (i.set(n, t), t);
1472
- }
1473
- getOrInsertComputed(e, t) {
1474
- const [r, n] = this.#r(e), i = this.#e(r);
1475
- if (i.has(n)) return i.get(n);
1476
- const s = t([r, n]);
1477
- return i.set(n, s), s;
1478
- }
1479
- }, Me = new ar();
1480
- function hr(e, t, r = ["*"]) {
1481
- if (!e) return;
1482
- if (Me.has([e, t])) return Me.get([e, t]);
1483
- const n = (i, s, u, l) => {
1484
- if (s == "value") {
1485
- const f = (u?.value ?? u)?.entries?.(), o = e?.value ?? i?.value ?? i;
1486
- if (f) for (const [y, a] of f) {
1487
- const v = a ?? (u?.value ?? u)?.[y] ?? null, A = o?.[y];
1488
- v == null && A != null ? t(A, y, null, "add") : v != null && A == null ? t(null, y, v, "delete") : x(v, A) && t(A, y, v, "set");
1489
- }
1490
- return hr(i ?? e?.value, t, r);
1491
- }
1492
- return s == null ? void 0 : e[s];
1493
- };
1494
- return Me.getOrInsertComputed([e, t], () => e instanceof Set ? b([yt(e), Symbol.iterator], t, r) : e instanceof Map ? b(e, t, r) : I(e) ? b(e, n, r) : Array.isArray(e) && !(e?.length == 2 && z(e?.[1]) && V(e?.[0])) ? b([e, Symbol.iterator], t, r) : b(e, t, r));
1495
- }
1496
- function Ie(e, t) {
1497
- return wt(e, (r) => {
1498
- const n = Array.isArray(r) && r?.length == 2 && ["object", "function"].indexOf(typeof r?.[0]) >= 0 && z(r?.[1]), i = n ? r?.[1] : null;
1499
- r = n && i != null ? r?.[0] ?? r : r;
1500
- const s = typeof r == "object" || typeof r == "function" ? r?.[g] ?? r : r;
1501
- (r?.[se] ?? p.get(s))?.unaffected?.(t, i);
1502
- });
1503
- }
1504
- var dr = (e, t, r) => (b(t, null, (n, i) => {
1505
- ie(e, n, i, !0);
1506
- }), r?.(() => e, (n) => {
1507
- for (const i in n) ie(t, n[i], i, !0);
1508
- }, { deep: !0 }), e), Pr = (e, t, r) => dr(t(he(e)), e, r), Mr = (e, t, r = () => "") => b(t, null, (n, i) => {
1509
- i == r() && ie(e, n, null, !0);
1510
- }), Ir = (e = []) => {
1511
- const t = T({ value: 0 }), r = (l) => typeof l == "function" ? l() : I(l) ? l.value : l, i = Sr([t, "value"], () => e.findIndex((l) => !!r(l)), "value"), s = () => {
1512
- t.value++;
1513
- }, u = [];
1514
- V(e) && u.push(b(e, s, {
1515
- affectTypes: [
1516
- "add",
1517
- "set",
1518
- "delete"
1519
- ],
1520
- triggerImmediately: !1
1521
- }));
1522
- for (const l of e) I(l) && u.push(b([l, "value"], s, {
1523
- affectTypes: ["setter"],
1524
- triggerImmediately: !1
1525
- }));
1526
- return M(i, Symbol.dispose, () => u.forEach((l) => l?.())), i;
1527
- }, vr = (e, t, r, n) => {
1528
- if (m(e)) return e ? t : r;
1529
- const i = () => t, s = () => r, u = (o) => (o != null && (e.value = I(o) ? o?.value : o), (I(e) ? e?.value : e) ? i() : s()), l = T({
1530
- [d]: u(),
1531
- [K]: n,
1532
- [Symbol?.toStringTag]() {
1533
- return String(u() ?? this[d] ?? "") || "";
1534
- },
1535
- [Symbol?.toPrimitive](o) {
1536
- return E(u() ?? this[d], o);
1537
- },
1538
- set value(o) {
1539
- this[d] = u(o);
1540
- },
1541
- get value() {
1542
- return this[d] = u() ?? this[d];
1543
- }
1544
- }), f = b([e, "value"], () => {
1545
- const o = l?.[d], y = u();
1546
- l[d] = y, l?.[D]?.({
1547
- key: "value",
1548
- value: y,
1549
- oldValue: o,
1550
- trigger: "manual"
1551
- });
1552
- });
1553
- return M(l, Symbol.dispose, f), l;
1554
- }, kr = vr, Er = (e, t, r) => {
1555
- r || (r = T({}));
1556
- const n = b(e, (i, s, u) => {
1557
- if (s == null) return;
1558
- const l = t?.(i, s, u);
1559
- typeof l == "object" ? pt(r, l) : x(r[s], l) && (r[s] = l);
1560
- });
1561
- return r && M(r, Symbol.dispose, n), r;
1562
- }, Wr = (...e) => {
1563
- const t = T({});
1564
- return e?.forEach?.((r) => b(r, (n, i, s) => {
1565
- i != null && x(t[i], n) && (t[i] = n);
1566
- })), t;
1567
- }, yt = (e) => {
1568
- const t = T([]);
1569
- return t.push(...Array.from(e?.values?.() || [])), M(t, Symbol.dispose, b(e, (r, n, i) => {
1570
- if (x(r, i)) if (i == null && r != null) t.push(r);
1571
- else if (i != null && r == null) {
1572
- const s = t.indexOf(i);
1573
- s >= 0 && t.splice(s, 1);
1574
- } else {
1575
- const s = t.indexOf(i);
1576
- s >= 0 && x(t[s], r) && (t[s] = r);
1577
- }
1578
- })), t;
1579
- }, br = (e) => {
1580
- const t = T([]), r = Array.from(e.entries());
1581
- return t.push(...r), M(t, Symbol.dispose, b(e, (n, i, s) => {
1582
- if (x(n, s) || s == null && n != null || s != null && n == null) if (s != null && n == null) {
1583
- let u = t.findIndex(([l, f]) => l == i);
1584
- u < 0 && (u = t.findLastIndex(([l, f]) => s === f)), u >= 0 && t.splice(u, 1);
1585
- } else {
1586
- let u = t.findIndex(([l, f]) => l == i);
1587
- u >= 0 && u < t.length ? x(t[u]?.[1], n) && (t[u] = [i, n]) : t.push([i, n]);
1588
- }
1589
- })), t;
1590
- }, F = /* @__PURE__ */ new WeakMap(), Ye = (e, t, r = "value") => {
1591
- const n = typeof e?.[1] == "function" && e?.length == 2, i = typeof t?.[1] == "function" && t?.length == 2, s = i ? t?.[1] : null, u = (z(e?.[1]) || e?.[1] == Symbol.iterator) && e?.length == 2;
1592
- let l = u && !n ? e?.[1] : Array.isArray(e) ? null : r;
1593
- !u && !n && (e = [e, l]), n && (e[1] = l);
1594
- const f = (z(t?.[1]) || t?.[1] == Symbol.iterator) && t?.length == 2;
1595
- let o = f && !i ? t?.[1] : Array.isArray(t) ? null : r;
1596
- if (!f && !i && (t = [t, o]), i && (t[1] = o), l == null || o == null || le(l, e?.[0]) || le(o, t?.[0])) return;
1597
- if (!((typeof t?.[0] == "object" || typeof t?.[0] == "function") && t?.[0] != null) && !Array.isArray(e[0]))
1598
- return ye(t, () => {
1599
- e[0][l] = t?.[0];
1600
- }), () => {
1601
- };
1602
- const y = (q, Z) => {
1603
- const B = A?.deref?.(), L = v?.deref?.();
1604
- if (F?.get?.(B)?.get?.(l)?.bound == L) {
1605
- let Re = null;
1606
- const Fe = F?.get?.(B)?.get?.(l)?.cmpfx;
1607
- ye(L, () => {
1608
- typeof Fe == "function" ? Re = Fe?.(He(L) ?? q, Z, null) : Re = L?.[Z] ?? q;
1609
- });
1610
- const Ge = He(Re);
1611
- x(B[l], Ge) && ye(L, () => {
1612
- B[l] = Ge;
1613
- });
1614
- } else F?.get?.(B)?.get?.(l)?.dispose?.();
1615
- }, a = () => {
1616
- const q = A?.deref?.(), Z = F?.get?.(q), B = Z?.get?.(l);
1617
- Z?.delete?.(l), B?.unsub?.();
1618
- }, v = t?.[0] != null && (typeof t?.[0] == "object" || typeof t?.[0] == "function") && !(t?.[0] instanceof WeakRef || typeof t?.[0]?.deref == "function") ? new WeakRef(t?.[0]) : t?.[0], A = e?.[0] != null && (typeof e?.[0] == "object" || typeof e?.[0] == "function") && !(e?.[0] instanceof WeakRef || typeof e?.[0]?.deref == "function") ? new WeakRef(e?.[0]) : e?.[0];
1619
- let w = {
1620
- compute: y,
1621
- dispose: a,
1622
- cmpfx: s
1623
- };
1624
- const O = A?.deref?.(), k = v?.deref?.();
1625
- return A instanceof WeakRef && (F?.get?.(O)?.get?.(l)?.bound != k && F?.get?.(O)?.delete?.(l), w = F?.getOrInsert?.(O, /* @__PURE__ */ new Map())?.getOrInsertComputed?.(l, () => ({
1626
- bound: k,
1627
- cmpfx: s,
1628
- unsub: null,
1629
- compute: y,
1630
- dispose: a
1631
- })), w.unsub = b(t, y), w.cmpfx = s, M(O, Symbol.dispose, w?.dispose), M(k, Symbol.dispose, w?.dispose)), k && !Array.isArray(k) && ye(O, () => {
1632
- k[o] ??= O?.[l] ?? k[o];
1633
- }), w?.dispose;
1634
- }, _r = (e, t, r = "value") => {
1635
- const n = [Ye(e, t, r), Ye(t, e, r)];
1636
- return () => n?.map?.((i) => i?.());
1637
- }, Sr = (e, t, r, n = "value") => {
1638
- const i = typeof e?.[1] == "function" && e?.length == 2, s = (z(e?.[1]) || e?.[1] == Symbol.iterator) && e?.length == 2;
1639
- let u = s && !i ? e?.[1] : Array.isArray(e) ? null : n;
1640
- if (!s && !i && (e = [s ? e?.[0] : e, u]), i && (e[1] = u), u == null || le(u, e?.[0])) return;
1641
- const l = (a) => {
1642
- let v;
1643
- return a != null && (v = e[0][u], e[0][u] = a), t?.(e?.[0]?.[u], u, v);
1644
- }, f = l(), o = T({
1645
- [oe]: void 0,
1646
- [d]: f,
1647
- [K]: r,
1648
- [Symbol?.toStringTag]() {
1649
- return String(l() ?? this[d] ?? "") || "";
1650
- },
1651
- [Symbol?.toPrimitive](a) {
1652
- return E(l() ?? this[d], a);
1653
- },
1654
- set value(a) {
1655
- this[d] = l(a);
1656
- },
1657
- get value() {
1658
- return this[d] = l() ?? this[d];
1659
- }
1660
- }), y = b([e?.[0] ?? e, u ?? "value"], () => {
1661
- const a = o?.[d], v = l();
1662
- o[d] = v, o?.[D]?.({
1663
- key: "value",
1664
- value: v,
1665
- oldValue: a,
1666
- trigger: "manual"
1667
- });
1668
- });
1669
- return M(o, Symbol.dispose, y), o;
1670
- }, $r = (e, t, r = 100) => {
1671
- let n;
1672
- return b(e, "value", (i) => {
1673
- !i && n ? (clearTimeout(n), n = null) : i && !n && (n = ze(e, t, r) ?? n);
1674
- });
1675
- };
1676
- export {
1677
- ue as $affected,
1678
- Zt as $ref,
1679
- D as $trigger,
1680
- At as $triggerControl,
1681
- me as $triggerLess,
1682
- h as $triggerLock,
1683
- Tt as AssignObjectHandler,
1684
- ar as DoubleWeakMap,
1685
- M as addToCallChain,
1686
- b as affected,
1687
- Ye as assign,
1688
- F as assignMap,
1689
- dr as bindBy,
1690
- Mr as bindByKey,
1691
- Xt as booleanRef,
1692
- Sr as computed,
1693
- kr as conditional,
1694
- Ir as conditionalIndex,
1695
- vr as conditionalRef,
1696
- Or as delayedBehavior,
1697
- xr as delayedOrInstantBehavior,
1698
- $r as delayedSubscribe,
1699
- C as deref,
1700
- Pr as derivate,
1701
- yr as effect,
1702
- Rr as effected,
1703
- V as isObservable,
1704
- hr as iterated,
1705
- _r as link,
1706
- Tr as makeArrayObservable,
1707
- mr as makeObjectAssignable,
1708
- Jt as numberRef,
1709
- br as observableByMap,
1710
- yt as observableBySet,
1711
- T as observe,
1712
- Ar as promised,
1713
- Yt as propRef,
1714
- er as recoverReactive,
1715
- Lt as ref,
1716
- Er as remap,
1717
- he as safe,
1718
- U as specializedSubscribe,
1719
- Qt as stringRef,
1720
- nr as subscribeDirectly,
1721
- ir as subscribeInput,
1722
- or as subscribePaired,
1723
- cr as subscribeThenable,
1724
- ze as triggerWithDelay,
1725
- Ie as unaffected,
1726
- Wr as unified,
1727
- xt as unwrap,
1728
- wr as useObservable,
1729
- Xe as wrapRef,
1730
- pr as wrapSetAsArray
1731
- };