@but212/atom-effect-jquery 0.22.1 → 0.23.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/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import c from "jquery";
2
- import { default as qs } from "jquery";
3
- const ut = {
1
+ import h from "jquery";
2
+ import { default as zs } from "jquery";
3
+ const rt = {
4
4
  IDLE: "idle",
5
5
  PENDING: "pending",
6
6
  RESOLVED: "resolved",
7
7
  REJECTED: "rejected"
8
- }, L = {
8
+ }, w = {
9
9
  DISPOSED: 1,
10
10
  EXECUTING: 8
11
- }, fe = {
11
+ }, Qt = {
12
12
  DISPOSED: 1,
13
13
  /** Marker bit: identifies this node as a computed. */
14
14
  IS_COMPUTED: 2,
@@ -19,11 +19,11 @@ const ut = {
19
19
  REJECTED: 128,
20
20
  RECOMPUTING: 256,
21
21
  HAS_ERROR: 512
22
- }, $ = {
22
+ }, M = {
23
23
  DISPOSED: 1,
24
24
  SYNC: 8,
25
25
  NOTIFICATION_SCHEDULED: 16
26
- }, q = {
26
+ }, j = {
27
27
  // Infinite loop protection
28
28
  MAX_EXECUTIONS_PER_SECOND: 1e3,
29
29
  MAX_EXECUTIONS_PER_EFFECT: 100,
@@ -33,84 +33,64 @@ const ut = {
33
33
  MIN_FLUSH_ITERATIONS: 10,
34
34
  // Memory management
35
35
  BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
36
- }, we = {
36
+ }, Ce = {
37
37
  WARN_INFINITE_LOOP: !0
38
- }, te = {
38
+ }, $t = {
39
39
  MAX_ASYNC_RETRIES: 3,
40
40
  MAX_PROMISE_ID: Number.MAX_SAFE_INTEGER - 1
41
- }, It = 1073741823, ke = typeof process < "u" && process.env && !1 || !1, xe = Object.freeze([]);
42
- class tt extends Error {
43
- constructor(t, s = null, n = !0) {
44
- super(t), this.cause = s, this.recoverable = n, this.name = "AtomError";
41
+ }, Y = {
42
+ /** Uninitialized epoch marker. Used as initial value before any flush has occurred. */
43
+ UNINITIALIZED: -1
44
+ }, mt = 1073741823, Te = typeof process < "u" && process.env && !1 || !1, Se = Object.freeze([]);
45
+ function Pt(n, t, e) {
46
+ const s = /* @__PURE__ */ new Map();
47
+ for (let i = 0; i < t.length; i++) {
48
+ const o = t[i];
49
+ o?.unsub && s.set(o.node, o.unsub);
45
50
  }
46
- }
47
- class z extends tt {
48
- constructor(t, s = null) {
49
- super(t, s, !0), this.name = "ComputedError";
51
+ for (let i = 0; i < n.length; i++) {
52
+ const o = n[i];
53
+ if (!o) continue;
54
+ const r = o.node, c = s.get(r);
55
+ c !== void 0 ? (o.unsub = c, s.delete(r)) : o.unsub || (o.unsub = r.subscribe(e));
50
56
  }
57
+ for (const i of s.values())
58
+ i();
51
59
  }
52
- class J extends tt {
53
- constructor(t, s = null) {
54
- super(t, s, !1), this.name = "EffectError";
60
+ class ht {
61
+ constructor(t, e, s = void 0) {
62
+ this.node = t, this.version = e, this.unsub = s;
55
63
  }
56
64
  }
57
- class At extends tt {
58
- constructor(t, s = null) {
59
- super(t, s, !1), this.name = "SchedulerError";
65
+ class Ne {
66
+ constructor(t, e) {
67
+ this.fn = t, this.sub = e;
60
68
  }
61
- }
62
- const Pe = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), Me = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ut = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), yt = {
63
- // Dev mode flag
64
- enabled: ke,
65
- warnInfiniteLoop: we.WARN_INFINITE_LOOP,
66
- warn(e, t) {
67
- },
68
- checkCircular(e, t) {
69
- if (e === t)
70
- throw new z("Direct circular dependency detected");
71
- },
72
- attachDebugInfo(e, t, s) {
73
- },
74
- getDebugName: (e) => e?.[Pe],
75
- getDebugType: (e) => e?.[Me]
76
- };
77
- let $e = 1;
78
- const Fe = () => $e++;
79
- function de(e, t, s) {
80
- if (typeof t == "function") {
81
- const i = t;
82
- if (s.some((r) => r && r.fn === i)) return;
83
- s.push(new Mt(i, void 0));
84
- return;
69
+ notify(t, e) {
70
+ this.fn ? this.fn(t, e) : this.sub && this.sub.execute();
85
71
  }
86
- if ("addDependency" in t) {
87
- t.addDependency(e);
88
- return;
72
+ }
73
+ class W extends Error {
74
+ constructor(t, e = null, s = !0) {
75
+ super(t), this.cause = e, this.recoverable = s, this.name = "AtomError";
89
76
  }
90
- const n = t;
91
- s.some((i) => i && i.sub === n) || s.push(new Mt(void 0, n));
92
77
  }
93
- function ee(e, t, s) {
94
- const n = /* @__PURE__ */ new Map();
95
- t.forEach((i) => {
96
- i?.unsub && n.set(i.node, i.unsub);
97
- }), e.forEach((i) => {
98
- if (!i) return;
99
- const r = i.node, o = n.get(r);
100
- o !== void 0 ? (i.unsub = o, n.delete(r)) : (yt.checkCircular(r, s), i.unsub = r.subscribe(s));
101
- }), n.forEach((i) => i());
78
+ class z extends W {
79
+ constructor(t, e = null) {
80
+ super(t, e, !0), this.name = "ComputedError";
81
+ }
102
82
  }
103
- class Pt {
104
- constructor(t, s, n = void 0) {
105
- this.node = t, this.version = s, this.unsub = n;
83
+ class q extends W {
84
+ constructor(t, e = null) {
85
+ super(t, e, !1), this.name = "EffectError";
106
86
  }
107
87
  }
108
- class Mt {
109
- constructor(t, s) {
110
- this.fn = t, this.sub = s;
88
+ class yt extends W {
89
+ constructor(t, e = null) {
90
+ super(t, e, !1), this.name = "SchedulerError";
111
91
  }
112
92
  }
113
- const y = {
93
+ const b = {
114
94
  // Computed Errors
115
95
  COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
116
96
  COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
@@ -127,82 +107,140 @@ const y = {
127
107
  EFFECT_CLEANUP_FAILED: "Effect cleanup failed",
128
108
  EFFECT_DISPOSED: "Attempted to run disposed effect",
129
109
  // Scheduler Errors
130
- SCHEDULER_FLUSH_OVERFLOW: (e, t) => `Maximum flush iterations (${e}) exceeded. ${t} jobs dropped. Possible infinite loop.`,
110
+ SCHEDULER_FLUSH_OVERFLOW: (n, t) => `Maximum flush iterations (${n}) exceeded. ${t} jobs dropped. Possible infinite loop.`,
131
111
  // System / Debug
132
112
  CALLBACK_ERROR_IN_ERROR_HANDLER: "Exception encountered in onError handler",
133
113
  // Effect frequency
134
114
  EFFECT_FREQUENCY_LIMIT_EXCEEDED: "Effect executed too frequently within 1 second. Suspected infinite loop.",
135
115
  SCHEDULER_CALLBACK_MUST_BE_FUNCTION: "Scheduler callback must be a function",
136
- SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring."
116
+ SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring.",
117
+ BATCH_CALLBACK_MUST_BE_FUNCTION: "Batch callback must be a function"
118
+ }, be = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), Re = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ct = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), Lt = {
119
+ // Dev mode flag
120
+ enabled: Te,
121
+ warnInfiniteLoop: Ce.WARN_INFINITE_LOOP,
122
+ warn(n, t) {
123
+ },
124
+ attachDebugInfo(n, t, e) {
125
+ },
126
+ getDebugName: (n) => n?.[be],
127
+ getDebugType: (n) => n?.[Re]
137
128
  };
138
- function Z(e, t, s) {
139
- if (e instanceof tt)
140
- return e;
141
- const n = e instanceof Error, i = n ? e.message : String(e), r = n ? e : void 0, o = `${n ? e.constructor.name : "Unexpected error"} (${s}): ${i}`;
142
- return new t(o, r);
129
+ let ve = 1;
130
+ const De = () => ve++;
131
+ function Q(n, t, e) {
132
+ if (n instanceof W)
133
+ return n;
134
+ const s = n instanceof Error, i = s ? n.message : String(n), o = s ? n : void 0, r = `${s ? n.constructor.name : "Unexpected error"} (${e}): ${i}`;
135
+ return new t(r, o);
143
136
  }
144
- class _e {
137
+ class Wt {
145
138
  constructor() {
146
- this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id = Fe() & It;
139
+ this.flags = 0, this.version = 0, this._lastSeenEpoch = Y.UNINITIALIZED, this.id = De() & mt;
147
140
  }
148
141
  }
149
- class Ee extends _e {
142
+ class Zt extends Wt {
143
+ constructor() {
144
+ super(...arguments), this._notifying = 0;
145
+ }
150
146
  /**
151
147
  * Adds subscriber.
152
148
  */
153
149
  subscribe(t) {
154
- const s = typeof t == "function";
155
- if (!s && (!t || typeof t.execute != "function"))
156
- throw Z(
150
+ const e = typeof t == "function";
151
+ if (!e && (!t || typeof t.execute != "function"))
152
+ throw Q(
157
153
  new TypeError("Invalid subscriber"),
158
- tt,
159
- y.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
154
+ W,
155
+ b.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
160
156
  );
161
- if (this._subscribers.some((i) => i ? s ? i.fn === t : i.sub === t : !1))
157
+ const s = this._subscribers, i = s.length;
158
+ let o = !1;
159
+ for (let c = 0; c < i; c++) {
160
+ const a = s[c];
161
+ if (a != null && (e ? a.fn === t : a.sub === t)) {
162
+ o = !0;
163
+ break;
164
+ }
165
+ }
166
+ if (o)
162
167
  return () => {
163
168
  };
164
- const n = new Mt(
165
- s ? t : void 0,
166
- s ? void 0 : t
169
+ const r = new Ne(
170
+ e ? t : void 0,
171
+ e ? void 0 : t
167
172
  );
168
- return this._subscribers.push(n), () => this._unsubscribe(n);
173
+ return s.push(r), () => this._unsubscribe(r);
169
174
  }
170
175
  _unsubscribe(t) {
171
- const s = this._subscribers, n = s.indexOf(t);
172
- if (n === -1) return;
173
- const i = s.pop();
174
- n < s.length && i && (s[n] = i);
176
+ const e = this._subscribers;
177
+ let s = -1;
178
+ for (let o = 0; o < e.length; o++)
179
+ if (e[o] === t) {
180
+ s = o;
181
+ break;
182
+ }
183
+ if (s === -1) return;
184
+ if (this._notifying > 0) {
185
+ e[s] = null;
186
+ return;
187
+ }
188
+ const i = e.pop();
189
+ s < e.length && i !== void 0 && (e[s] = i);
175
190
  }
176
191
  subscriberCount() {
177
- return this._subscribers.length;
192
+ let t = 0;
193
+ const e = this._subscribers;
194
+ for (let s = 0; s < e.length; s++)
195
+ e[s] != null && t++;
196
+ return t;
178
197
  }
179
- _notifySubscribers(t, s) {
180
- this._subscribers.length !== 0 && this._subscribers.slice(0).forEach((n) => {
181
- if (n)
182
- try {
183
- n.fn ? n.fn(t, s) : n.sub && n.sub.execute();
184
- } catch (i) {
185
- this._handleNotifyError(i);
198
+ _notifySubscribers(t, e) {
199
+ const s = this._subscribers, i = s.length;
200
+ if (i !== 0) {
201
+ this._notifying++;
202
+ try {
203
+ for (let o = 0; o < i; o++) {
204
+ const r = s[o];
205
+ if (r != null)
206
+ try {
207
+ r.notify(t, e);
208
+ } catch (c) {
209
+ this._handleNotifyError(c);
210
+ }
186
211
  }
187
- });
212
+ } finally {
213
+ this._notifying--, this._notifying === 0 && this._cleanupTombstones();
214
+ }
215
+ }
216
+ }
217
+ _cleanupTombstones() {
218
+ const t = this._subscribers;
219
+ let e = 0;
220
+ for (; e < t.length; )
221
+ if (t[e] === null) {
222
+ const s = t.pop();
223
+ e < t.length && s !== void 0 && (t[e] = s);
224
+ } else
225
+ e++;
188
226
  }
189
227
  _handleNotifyError(t) {
190
- console.error(Z(t, tt, y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
228
+ console.error(Q(t, W, b.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
191
229
  }
192
230
  }
193
- let Lt = 0;
194
- const jt = () => (Lt = Lt + 1 & It || 1, Lt), $t = (e) => e + 1 & It;
195
- let zt = 0, pt = !1, pe = 0;
196
- const me = () => pe;
197
- function se() {
198
- return pt ? !1 : (pt = !0, pe = jt(), zt = 0, !0);
231
+ let Tt = 0;
232
+ const kt = () => (Tt = Tt + 1 & mt || 1, Tt), vt = (n) => n + 1 & mt;
233
+ let At = 0, ut = !1, Jt = 0;
234
+ const te = () => Jt;
235
+ function Mt() {
236
+ return ut ? !1 : (ut = !0, Jt = kt(), At = 0, !0);
199
237
  }
200
- const ne = () => {
201
- pt = !1;
202
- }, Be = () => pt ? ++zt : 0;
203
- class He {
238
+ const Ft = () => {
239
+ ut = !1;
240
+ }, Oe = () => ut ? ++At : 0;
241
+ class Le {
204
242
  constructor() {
205
- this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isBatching = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = q.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
243
+ this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isBatching = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = j.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
206
244
  }
207
245
  get phase() {
208
246
  return this._isProcessing || this._isFlushingSync ? 2 : this._isBatching ? 1 : 0;
@@ -237,28 +275,28 @@ class He {
237
275
  _runLoop() {
238
276
  try {
239
277
  if (this._size === 0) return;
240
- const t = se();
241
- this._drainQueue(), t && ne();
278
+ const t = Mt();
279
+ this._drainQueue(), t && Ft();
242
280
  } finally {
243
281
  this._isProcessing = !1, this._size > 0 && !this._isBatching && this._flush();
244
282
  }
245
283
  }
246
284
  _flushSync() {
247
285
  this._isFlushingSync = !0;
248
- const t = se();
286
+ const t = Mt();
249
287
  try {
250
288
  this._mergeBatchQueue(), this._drainQueue();
251
289
  } finally {
252
- this._isFlushingSync = !1, t && ne();
290
+ this._isFlushingSync = !1, t && Ft();
253
291
  }
254
292
  }
255
293
  _mergeBatchQueue() {
256
294
  if (this._batchQueueSize === 0) return;
257
- const t = ++this._epoch, s = this._batchQueue, n = this._queueBuffer[this._bufferIndex];
295
+ const t = ++this._epoch, e = this._batchQueue, s = this._queueBuffer[this._bufferIndex];
258
296
  let i = this._size;
259
- s.slice(0, this._batchQueueSize).forEach((r) => {
260
- r._nextEpoch !== t && (r._nextEpoch = t, n[i++] = r);
261
- }), this._size = i, this._batchQueueSize = 0, s.length > q.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
297
+ e.slice(0, this._batchQueueSize).forEach((o) => {
298
+ o._nextEpoch !== t && (o._nextEpoch = t, s[i++] = o);
299
+ }), this._size = i, this._batchQueueSize = 0, e.length > j.BATCH_QUEUE_SHRINK_THRESHOLD && (e.length = 0);
262
300
  }
263
301
  _drainQueue() {
264
302
  let t = 0;
@@ -271,21 +309,22 @@ class He {
271
309
  }
272
310
  }
273
311
  _processQueue() {
274
- const t = this._bufferIndex, s = this._queueBuffer[t], n = this._size;
312
+ const t = this._bufferIndex, e = this._queueBuffer[t], s = this._size;
275
313
  this._bufferIndex = t ^ 1, this._size = 0, this._epoch++;
276
- for (let i = 0; i < n; i++)
314
+ for (let i = 0; i < s; i++)
277
315
  try {
278
- s[i]();
279
- } catch (r) {
280
- console.error(new At("Error occurred during scheduler execution", r));
316
+ const o = e[i];
317
+ typeof o == "function" ? o() : o.execute();
318
+ } catch (o) {
319
+ console.error(new yt("Error occurred during scheduler execution", o));
281
320
  }
282
- s.length = 0;
321
+ e.length = 0;
283
322
  }
284
323
  _handleFlushOverflow() {
285
324
  const t = this._size + this._batchQueueSize;
286
325
  if (console.error(
287
- new At(
288
- y.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, t)
326
+ new yt(
327
+ b.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, t)
289
328
  )
290
329
  ), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow)
291
330
  try {
@@ -300,14 +339,14 @@ class He {
300
339
  this._batchDepth !== 0 && --this._batchDepth === 0 && (this._flushSync(), this._isBatching = !1);
301
340
  }
302
341
  setMaxFlushIterations(t) {
303
- if (t < q.MIN_FLUSH_ITERATIONS)
304
- throw new At(
305
- `Max flush iterations must be at least ${q.MIN_FLUSH_ITERATIONS}`
342
+ if (t < j.MIN_FLUSH_ITERATIONS)
343
+ throw new yt(
344
+ `Max flush iterations must be at least ${j.MIN_FLUSH_ITERATIONS}`
306
345
  );
307
346
  this._maxFlushIterations = t;
308
347
  }
309
348
  }
310
- const rt = new He(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ge = /* @__PURE__ */ Symbol.for("atom-effect/computed"), Ge = /* @__PURE__ */ Symbol.for("atom-effect/effect"), k = {
349
+ const ot = new Le(), Ut = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ee = /* @__PURE__ */ Symbol.for("atom-effect/computed"), ke = /* @__PURE__ */ Symbol.for("atom-effect/effect"), Ae = /* @__PURE__ */ Symbol.for("atom-effect/writable"), $ = {
311
350
  /** Active listener. */
312
351
  current: null,
313
352
  /**
@@ -317,79 +356,85 @@ const rt = new He(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ge = /
317
356
  * @param fn - The logic to execute.
318
357
  * @returns The result of `fn`.
319
358
  */
320
- run(e, t) {
321
- const s = this.current;
322
- this.current = e;
359
+ run(n, t) {
360
+ const e = this.current;
361
+ this.current = n;
323
362
  try {
324
363
  return t();
325
364
  } finally {
326
- this.current = s;
365
+ this.current = e;
327
366
  }
328
367
  }
329
368
  };
330
- function H(e) {
331
- const t = k.current;
332
- if (t === null) return e();
333
- k.current = null;
369
+ function P(n) {
370
+ const t = $.current;
371
+ if (t === null) return n();
372
+ $.current = null;
334
373
  try {
335
- return e();
374
+ return n();
336
375
  } finally {
337
- k.current = t;
376
+ $.current = t;
338
377
  }
339
378
  }
340
- var ie;
341
- class je extends Ee {
342
- constructor(t, s) {
343
- super(), this._pendingOldValue = void 0, this._notifyTask = () => this._flushNotifications(), this._subscribers = [], this[ie] = !0, this._value = t, s && (this.flags |= $.SYNC), yt.attachDebugInfo(this, "atom", this.id);
379
+ var Bt, Gt;
380
+ class Ue extends Zt {
381
+ constructor(t, e) {
382
+ super(), this._pendingOldValue = void 0, this._subscribers = [], this[Gt] = !0, this[Bt] = !0, this._value = t, e && (this.flags |= M.SYNC), Lt.attachDebugInfo(this, "atom", this.id);
344
383
  }
345
384
  get value() {
346
- const t = k.current;
347
- return t && de(this, t, this._subscribers), this._value;
385
+ return $.current?.addDependency(this), this._value;
348
386
  }
349
387
  set value(t) {
350
- const s = this._value;
351
- if (Object.is(s, t)) return;
352
- this._value = t, this.version = $t(this.version);
353
- const n = this.flags;
354
- if (!(this._subscribers.length === 0 || n & $.NOTIFICATION_SCHEDULED)) {
355
- if (this._pendingOldValue = s, this.flags = n | $.NOTIFICATION_SCHEDULED, n & $.SYNC && !rt.isBatching) {
388
+ const e = this._value;
389
+ if (Object.is(e, t)) return;
390
+ this._value = t, this.version = vt(this.version);
391
+ const s = this.flags;
392
+ if (!(this._subscribers.length === 0 || s & M.NOTIFICATION_SCHEDULED)) {
393
+ if (this._pendingOldValue = e, this.flags = s | M.NOTIFICATION_SCHEDULED, s & M.SYNC && !ot.isBatching) {
356
394
  this._flushNotifications();
357
395
  return;
358
396
  }
359
- rt.schedule(this._notifyTask);
397
+ ot.schedule(this);
360
398
  }
361
399
  }
400
+ /**
401
+ * Executes scheduled notification.
402
+ * @internal
403
+ */
404
+ execute() {
405
+ this._flushNotifications();
406
+ }
362
407
  /**
363
408
  * Triggers subscribers.
364
409
  */
365
410
  _flushNotifications() {
366
411
  const t = this.flags;
367
- if (!(t & $.NOTIFICATION_SCHEDULED) || t & $.DISPOSED)
412
+ if (!(t & M.NOTIFICATION_SCHEDULED) || t & M.DISPOSED)
368
413
  return;
369
- const s = this._pendingOldValue;
370
- this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, s);
414
+ const e = this._pendingOldValue;
415
+ this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, e);
371
416
  }
372
417
  peek() {
373
418
  return this._value;
374
419
  }
375
420
  dispose() {
376
- this.flags & $.DISPOSED || (this._subscribers.length = 0, this.flags |= $.DISPOSED, this._value = void 0, this._pendingOldValue = void 0);
421
+ this.flags & M.DISPOSED || (this._subscribers.length = 0, this.flags |= M.DISPOSED, this._value = void 0, this._pendingOldValue = void 0);
377
422
  }
378
- [(ie = Vt, Symbol.dispose)]() {
423
+ [(Gt = Ut, Bt = Ae, Symbol.dispose)]() {
379
424
  this.dispose();
380
425
  }
381
426
  }
382
- function Ft(e, t = {}) {
383
- return new je(e, t.sync ?? !1);
427
+ function Dt(n, t = {}) {
428
+ return new Ue(n, t.sync ?? !1);
384
429
  }
385
- class ze {
430
+ class we {
386
431
  /**
387
432
  * @param limit - Max unique arrays to hold (default: 50). Prevents the pool itself from consuming too much memory.
388
433
  * @param capacity - Max length of an array to accept (default: 256).
389
434
  * @param enableStats - Force-enable stats even in production (default: false).
390
435
  */
391
- constructor(t = 50, s = 256, n = !1) {
392
- this.limit = t, this.capacity = s, this.pool = [], this.stats = null, this.stats = n ? {
436
+ constructor(t = 50, e = 256, s = !1) {
437
+ this.limit = t, this.capacity = e, this.pool = [], this.stats = null, this.stats = s ? {
393
438
  acquired: 0,
394
439
  released: 0,
395
440
  rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
@@ -407,8 +452,8 @@ class ze {
407
452
  * @param arr - Array to release.
408
453
  * @param emptyConst - Optional empty constant.
409
454
  */
410
- release(t, s) {
411
- if (!(s && t === s)) {
455
+ release(t, e) {
456
+ if (!(e && t === e)) {
412
457
  if (t.length > this.capacity) {
413
458
  this.stats && this.stats.rejected.tooLarge++;
414
459
  return;
@@ -429,11 +474,11 @@ class ze {
429
474
  */
430
475
  getStats() {
431
476
  if (!this.stats) return null;
432
- const { acquired: t, released: s, rejected: n } = this.stats, i = t - s - (n.frozen + n.tooLarge + n.poolFull);
477
+ const { acquired: t, released: e, rejected: s } = this.stats, i = t - e - (s.frozen + s.tooLarge + s.poolFull);
433
478
  return {
434
479
  acquired: t,
435
- released: s,
436
- rejected: { ...n },
480
+ released: e,
481
+ rejected: { ...s },
437
482
  leaked: i,
438
483
  poolSize: this.pool.length
439
484
  };
@@ -449,58 +494,57 @@ class ze {
449
494
  });
450
495
  }
451
496
  }
452
- const O = Object.freeze(
497
+ const L = Object.freeze(
453
498
  []
454
- ), B = new ze();
455
- function qt(e) {
456
- return e !== null && typeof e == "object" && Vt in e;
457
- }
458
- function Ve(e) {
459
- return e !== null && typeof e == "object" && ge in e;
460
- }
461
- function Ie(e) {
462
- return e !== null && typeof e == "object" && typeof e.then == "function";
463
- }
464
- var re, oe;
465
- const { IDLE: lt, DIRTY: K, PENDING: _t, RESOLVED: V, REJECTED: nt, HAS_ERROR: ft, RECOMPUTING: st, DISPOSED: wt, IS_COMPUTED: qe } = fe;
466
- function Xe(e) {
467
- return e & V ? ut.RESOLVED : e & _t ? ut.PENDING : e & nt ? ut.REJECTED : ut.IDLE;
468
- }
469
- class Qe extends Ee {
470
- constructor(t, s = {}) {
471
- if (typeof t != "function") throw new z(y.COMPUTED_MUST_BE_FUNCTION);
472
- super(), this[oe] = !0, this[re] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = O, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = -1, this._trackEpoch = -1, this._trackLinks = O, this._trackCount = 0, this._value = void 0, this.flags = qe | K | lt, this._equal = s.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in s ? s.defaultValue : Ut, this._onError = s.onError ?? null;
473
- const n = s.maxAsyncRetries;
474
- if (this._maxAsyncRetries = (n ?? te.MAX_ASYNC_RETRIES) & It, yt.attachDebugInfo(this, "computed", this.id), s.lazy === !1)
499
+ ), F = new we();
500
+ function wt(n) {
501
+ return n !== null && typeof n == "object" && Ut in n;
502
+ }
503
+ function xe(n) {
504
+ return n !== null && typeof n == "object" && ee in n;
505
+ }
506
+ function se(n) {
507
+ return n !== null && typeof n == "object" && typeof n.then == "function";
508
+ }
509
+ var Ht, jt;
510
+ const { IDLE: ct, DIRTY: K, PENDING: lt, RESOLVED: H, REJECTED: it, HAS_ERROR: at, RECOMPUTING: tt, DISPOSED: St, IS_COMPUTED: $e } = Qt;
511
+ function Pe(n) {
512
+ return n & H ? rt.RESOLVED : n & lt ? rt.PENDING : n & it ? rt.REJECTED : rt.IDLE;
513
+ }
514
+ class Me extends Zt {
515
+ constructor(t, e = {}) {
516
+ if (typeof t != "function") throw new z(b.COMPUTED_MUST_BE_FUNCTION);
517
+ super(), this[jt] = !0, this[Ht] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = L, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = Y.UNINITIALIZED, this._trackEpoch = Y.UNINITIALIZED, this._trackLinks = L, this._trackCount = 0, this._value = void 0, this.flags = $e | K | ct, this._equal = e.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in e ? e.defaultValue : Ct, this._onError = e.onError ?? null;
518
+ const s = e.maxAsyncRetries;
519
+ if (this._maxAsyncRetries = (s ?? $t.MAX_ASYNC_RETRIES) & mt, Lt.attachDebugInfo(this, "computed", this.id), e.lazy === !1)
475
520
  try {
476
521
  this._recompute();
477
522
  } catch {
478
523
  }
479
524
  }
480
525
  _track() {
481
- const t = k.current;
482
- t && de(this, t, this._subscribers);
526
+ $.current?.addDependency(this);
483
527
  }
484
528
  get value() {
485
529
  this._track();
486
530
  const t = this.flags;
487
- if ((t & (V | K | lt)) === V)
531
+ if ((t & (H | K | ct)) === H)
488
532
  return this._value;
489
- if (t & wt)
490
- throw new z(y.COMPUTED_DISPOSED);
491
- if (t & st) {
492
- if (this._defaultValue !== Ut) return this._defaultValue;
493
- throw new z(y.COMPUTED_CIRCULAR_DEPENDENCY);
533
+ if (t & St)
534
+ throw new z(b.COMPUTED_DISPOSED);
535
+ if (t & tt) {
536
+ if (this._defaultValue !== Ct) return this._defaultValue;
537
+ throw new z(b.COMPUTED_CIRCULAR_DEPENDENCY);
494
538
  }
495
- if (t & (K | lt) && (this._recompute(), this.flags & V))
539
+ if (t & (K | ct) && (this._recompute(), this.flags & H))
496
540
  return this._value;
497
- const s = this._defaultValue, n = s !== Ut;
498
- if (this.flags & _t) {
499
- if (n) return s;
500
- throw new z(y.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
541
+ const e = this._defaultValue, s = e !== Ct;
542
+ if (this.flags & lt) {
543
+ if (s) return e;
544
+ throw new z(b.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
501
545
  }
502
- if (this.flags & nt) {
503
- if (n) return s;
546
+ if (this.flags & it) {
547
+ if (s) return e;
504
548
  throw this._error;
505
549
  }
506
550
  return this._value;
@@ -509,20 +553,20 @@ class Qe extends Ee {
509
553
  return this._value;
510
554
  }
511
555
  get state() {
512
- return this._track(), Xe(this.flags);
556
+ return this._track(), Pe(this.flags);
513
557
  }
514
558
  get hasError() {
515
- return this._track(), this.flags & (nt | ft) ? !0 : this._links.some((t) => t?.node?.flags & ft);
559
+ return this._track(), this.flags & (it | at) ? !0 : this._links.some((t) => t?.node?.flags & at);
516
560
  }
517
561
  get isValid() {
518
562
  return !this.hasError;
519
563
  }
520
564
  get errors() {
521
- if (this._track(), !this.hasError) return xe;
565
+ if (this._track(), !this.hasError) return Se;
522
566
  const t = [];
523
- return this._error && t.push(this._error), this._links.forEach((s) => {
524
- const n = s.node;
525
- n.flags & ft && n.errors.forEach((i) => {
567
+ return this._error && t.push(this._error), this._links.forEach((e) => {
568
+ const s = e.node;
569
+ s.flags & at && s.errors.forEach((i) => {
526
570
  i && !t.includes(i) && t.push(i);
527
571
  });
528
572
  }), Object.freeze(t);
@@ -531,203 +575,257 @@ class Qe extends Ee {
531
575
  return this._track(), this._error;
532
576
  }
533
577
  get isPending() {
534
- return this._track(), (this.flags & _t) !== 0;
578
+ return this._track(), (this.flags & lt) !== 0;
535
579
  }
536
580
  get isResolved() {
537
- return this._track(), (this.flags & V) !== 0;
581
+ return this._track(), (this.flags & H) !== 0;
538
582
  }
539
583
  invalidate() {
540
584
  this._markDirty();
541
585
  }
542
586
  dispose() {
543
- if (this.flags & wt) return;
587
+ if (this.flags & St) return;
544
588
  const t = this._links;
545
- t !== O && (t.forEach((s) => s.unsub?.()), B.release(t), this._links = O), this._subscribers.length = 0, this.flags = wt | K | lt, this._error = null, this._value = void 0;
589
+ t !== L && (t.forEach((e) => e.unsub?.()), F.release(t), this._links = L), this._subscribers.length = 0, this.flags = St | K | ct, this._error = null, this._value = void 0;
546
590
  }
547
- [(oe = Vt, re = ge, Symbol.dispose)]() {
591
+ [(jt = Ut, Ht = ee, Symbol.dispose)]() {
548
592
  this.dispose();
549
593
  }
550
594
  addDependency(t) {
551
595
  if (t._lastSeenEpoch !== this._trackEpoch) {
552
- if (t._lastSeenEpoch = this._trackEpoch, this._trackCount < this._trackLinks.length) {
553
- const s = this._trackLinks[this._trackCount];
554
- s.node = t, s.version = t.version;
555
- } else
556
- this._trackLinks.push(new Pt(t, t.version));
557
- this._trackCount++;
596
+ if (t._lastSeenEpoch = this._trackEpoch, this._trackLinks === this._links && this._trackCount < this._links.length && this._links[this._trackCount].node === t) {
597
+ this._links[this._trackCount].version = t.version, this._trackCount++;
598
+ return;
599
+ }
600
+ if (this._trackLinks === this._links) {
601
+ const e = F.acquire();
602
+ for (let s = 0; s < this._trackCount; s++)
603
+ e[s] = this._links[s];
604
+ this._trackLinks = e;
605
+ }
606
+ this._trackCount < this._trackLinks.length ? this._trackLinks[this._trackCount] = new ht(t, t.version) : this._trackLinks.push(new ht(t, t.version)), this._trackCount++;
558
607
  }
559
608
  }
560
609
  _recompute() {
561
- if (this.flags & st) return;
562
- this.flags |= st;
610
+ if (this.flags & tt) return;
611
+ this.flags |= tt;
563
612
  const t = this._links;
564
- this._trackEpoch = jt(), this._trackLinks = B.acquire(), this._trackCount = 0;
565
- let s = !1;
613
+ this._trackEpoch = kt(), this._trackLinks = t, this._trackCount = 0;
614
+ let e = !1;
566
615
  try {
567
- const n = k.run(this, this._fn);
568
- this._trackLinks.length = this._trackCount, ee(this._trackLinks, t, this), this._links = this._trackLinks, s = !0, Ie(n) ? this._handleAsyncComputation(n) : this._finalizeResolution(n);
569
- } catch (n) {
570
- if (!s)
616
+ const s = $.run(this, this._fn);
617
+ if (this._trackLinks === t)
618
+ if (this._trackCount === t.length)
619
+ e = !0;
620
+ else {
621
+ for (let i = this._trackCount; i < t.length; i++)
622
+ t[i].unsub?.();
623
+ t.length = this._trackCount, e = !0;
624
+ }
625
+ else
626
+ this._trackLinks.length = this._trackCount, Pt(this._trackLinks, t, this), this._links = this._trackLinks, e = !0;
627
+ se(s) ? this._handleAsyncComputation(s) : this._finalizeResolution(s);
628
+ } catch (s) {
629
+ if (!e)
571
630
  try {
572
- this._trackLinks.length = this._trackCount, ee(this._trackLinks, t, this), this._links = this._trackLinks, s = !0;
631
+ if (this._trackLinks === t) {
632
+ for (let i = this._trackCount; i < t.length; i++)
633
+ t[i].unsub?.();
634
+ t.length = this._trackCount, e = !0;
635
+ } else
636
+ this._trackLinks.length = this._trackCount, Pt(this._trackLinks, t, this), this._links = this._trackLinks, e = !0;
573
637
  } catch {
574
638
  }
575
- this._handleError(n, y.COMPUTED_COMPUTATION_FAILED, !0);
639
+ this._handleError(s, b.COMPUTED_COMPUTATION_FAILED, !0);
576
640
  } finally {
577
- s && t !== O ? B.release(t) : s || B.release(this._trackLinks), this._trackEpoch = -1, this._trackLinks = O, this._trackCount = 0, this.flags &= ~st;
641
+ e ? this._links !== t && t !== L && F.release(t) : this._trackLinks !== t && this._trackLinks !== L && F.release(this._trackLinks), this._trackEpoch = Y.UNINITIALIZED, this._trackLinks = L, this._trackCount = 0, this.flags &= ~tt;
578
642
  }
579
643
  }
580
644
  _handleAsyncComputation(t) {
581
- this.flags = (this.flags | _t) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % te.MAX_PROMISE_ID;
582
- const s = this._promiseId;
645
+ this.flags = (this.flags | lt) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % $t.MAX_PROMISE_ID;
646
+ const e = this._promiseId;
583
647
  t.then(
584
- (n) => {
585
- if (s === this._promiseId) {
648
+ (s) => {
649
+ if (e === this._promiseId) {
586
650
  if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
587
- const i = me();
651
+ const i = te();
588
652
  return this._lastDriftEpoch !== i && (this._lastDriftEpoch = i, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(
589
653
  new z(
590
654
  `Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
591
655
  ),
592
- y.COMPUTED_ASYNC_COMPUTATION_FAILED
656
+ b.COMPUTED_ASYNC_COMPUTATION_FAILED
593
657
  );
594
658
  }
595
- this._finalizeResolution(n), this._notifySubscribers(n, void 0);
659
+ this._finalizeResolution(s), this._notifySubscribers(s, void 0);
596
660
  }
597
661
  },
598
- (n) => s === this._promiseId && this._handleError(n, y.COMPUTED_ASYNC_COMPUTATION_FAILED)
662
+ (s) => e === this._promiseId && this._handleError(s, b.COMPUTED_ASYNC_COMPUTATION_FAILED)
599
663
  );
600
664
  }
601
665
  _captureVersionSnapshot() {
602
666
  let t = 0;
603
- const s = this._links;
604
- for (let n = 0, i = s.length; n < i; n++)
605
- t = (t << 5) - t + s[n].node.version | 0;
667
+ const e = this._links;
668
+ for (let s = 0, i = e.length; s < i; s++)
669
+ t = (t << 5) - t + e[s].node.version | 0;
606
670
  return t;
607
671
  }
608
- _handleError(t, s, n = !1) {
609
- const i = Z(t, z, s);
610
- if (!n && !(this.flags & nt) && (this.version = $t(this.version)), this._error = i, this.flags = this.flags & -121 | nt | ft, this._onError)
672
+ _handleError(t, e, s = !1) {
673
+ const i = Q(t, z, e);
674
+ if (!s && !(this.flags & it) && (this.version = vt(this.version)), this._error = i, this.flags = this.flags & -121 | it | at, this._onError)
611
675
  try {
612
676
  this._onError(i);
613
- } catch (r) {
614
- console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, r);
677
+ } catch (o) {
678
+ console.error(b.CALLBACK_ERROR_IN_ERROR_HANDLER, o);
615
679
  }
616
- if (n) throw i;
680
+ if (s) throw i;
617
681
  this._notifySubscribers(void 0, void 0);
618
682
  }
619
683
  _finalizeResolution(t) {
620
- (!(this.flags & V) || !this._equal(this._value, t)) && (this.version = $t(this.version)), this._value = t, this._error = null, this.flags = (this.flags | V) & -697;
684
+ (!(this.flags & H) || !this._equal(this._value, t)) && (this.version = vt(this.version)), this._value = t, this._error = null, this.flags = (this.flags | H) & -697;
621
685
  }
622
686
  execute() {
623
687
  this._markDirty();
624
688
  }
625
689
  /** @internal */
626
690
  _markDirty() {
627
- this.flags & (st | K) || (this.flags |= K, this._notifySubscribers(void 0, void 0));
691
+ this.flags & (tt | K) || (this.flags |= K, this._notifySubscribers(void 0, void 0));
628
692
  }
629
693
  }
630
- function Ct(e, t = {}) {
631
- return new Qe(e, t);
694
+ function gt(n, t = {}) {
695
+ return new Me(n, t);
632
696
  }
633
- var ce;
634
- class Ke extends _e {
635
- constructor(t, s = {}) {
636
- super(), this[ce] = !0, this._cleanup = null, this._links = O, this._nextLinks = null, this._prevLinks = O, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._fn = t, this._onError = s.onError ?? null, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? q.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? q.MAX_EXECUTIONS_PER_EFFECT, this._sync ? (this._executeTask = void 0, this._notifyCallback = () => this.execute()) : (this._executeTask = () => this.execute(), this._notifyCallback = () => rt.schedule(this._executeTask)), yt.attachDebugInfo(this, "effect", this.id);
697
+ var Vt;
698
+ class Fe extends Wt {
699
+ constructor(t, e = {}) {
700
+ super(), this[Vt] = !0, this._cleanup = null, this._links = L, this._nextLinks = null, this._prevLinks = L, this._currentEpoch = Y.UNINITIALIZED, this._lastFlushEpoch = Y.UNINITIALIZED, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._fn = t, this._onError = e.onError ?? null, this._sync = e.sync ?? !1, this._maxExecutions = e.maxExecutionsPerSecond ?? j.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = e.maxExecutionsPerFlush ?? j.MAX_EXECUTIONS_PER_EFFECT, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => ot.schedule(this), Lt.attachDebugInfo(this, "effect", this.id);
637
701
  }
638
702
  run() {
639
- if (this.flags & L.DISPOSED)
640
- throw new J(y.EFFECT_DISPOSED);
703
+ if (this.flags & w.DISPOSED)
704
+ throw new q(b.EFFECT_DISPOSED);
641
705
  this.execute(!0);
642
706
  }
643
707
  dispose() {
644
- this.flags & L.DISPOSED || (this.flags |= L.DISPOSED, this._execCleanup(), this._unsubLinks(this._links), this._links !== O && B.release(this._links), this._links = O, this._prevLinks = O);
708
+ this.flags & w.DISPOSED || (this.flags |= w.DISPOSED, this._execCleanup(), this._unsubLinks(this._links), this._links !== L && F.release(this._links), this._links = L, this._prevLinks = L);
645
709
  }
646
- [(ce = Ge, Symbol.dispose)]() {
710
+ [(Vt = ke, Symbol.dispose)]() {
647
711
  this.dispose();
648
712
  }
649
713
  addDependency(t) {
650
- if (!(this.flags & L.EXECUTING)) return;
651
- const s = this._currentEpoch;
652
- if (t._lastSeenEpoch === s) return;
653
- t._lastSeenEpoch = s;
654
- const n = this._nextLinks, i = this._prevLinks, r = i.findIndex((o) => o && o.node === t && o.unsub);
655
- if (r !== -1) {
656
- const o = i[r];
657
- o.version = t.version, n.push(o), i[r] = null;
714
+ if (!(this.flags & w.EXECUTING)) return;
715
+ const e = this._currentEpoch;
716
+ if (t._lastSeenEpoch === e) return;
717
+ t._lastSeenEpoch = e;
718
+ const s = this._prevLinks;
719
+ if (this._nextLinks === s && this._trackCount < s.length && s[this._trackCount].node === t) {
720
+ s[this._trackCount].version = t.version, this._trackCount++;
658
721
  return;
659
722
  }
660
- try {
661
- const o = t.subscribe(this._notifyCallback);
662
- n.push(new Pt(t, t.version, o));
663
- } catch (o) {
664
- const l = Z(o, J, y.EFFECT_EXECUTION_FAILED);
665
- if (console.error(l), this._onError)
666
- try {
667
- this._onError(l);
668
- } catch {
669
- }
670
- n.push(new Pt(t, t.version, void 0));
723
+ if (this._nextLinks === s) {
724
+ const r = F.acquire();
725
+ for (let c = 0; c < this._trackCount; c++)
726
+ r[c] = s[c];
727
+ this._nextLinks = r;
671
728
  }
729
+ const i = this._nextLinks;
730
+ let o = -1;
731
+ for (let r = this._trackCount; r < s.length; r++) {
732
+ const c = s[r];
733
+ if (c && c.node === t && c.unsub) {
734
+ o = r;
735
+ break;
736
+ }
737
+ }
738
+ if (o !== -1) {
739
+ const r = s[o];
740
+ r.version = t.version, i[this._trackCount] = r, s[o] = null;
741
+ } else
742
+ try {
743
+ const r = t.subscribe(this._notifyCallback);
744
+ i[this._trackCount] = new ht(t, t.version, r);
745
+ } catch (r) {
746
+ const c = Q(r, q, b.EFFECT_EXECUTION_FAILED);
747
+ if (console.error(c), this._onError)
748
+ try {
749
+ this._onError(c);
750
+ } catch {
751
+ }
752
+ i[this._trackCount] = new ht(t, t.version, void 0);
753
+ }
754
+ this._trackCount++;
672
755
  }
673
756
  /**
674
757
  * Executes effect with tracking.
675
758
  */
676
759
  execute(t = !1) {
677
- if (this.flags & (L.DISPOSED | L.EXECUTING) || !t && this._links.length > 0 && !this._isDirty()) return;
678
- this._checkInfiniteLoops(), this.flags |= L.EXECUTING, this._execCleanup(), this._prevLinks = this._links;
679
- const s = B.acquire();
680
- this._nextLinks = s, this._currentEpoch = jt();
681
- let n = !1;
760
+ if (this.flags & (w.DISPOSED | w.EXECUTING) || !t && this._links.length > 0 && !this._isDirty()) return;
761
+ this._checkInfiniteLoops(), this.flags |= w.EXECUTING, this._execCleanup(), this._prevLinks = this._links, this._nextLinks = this._links, this._currentEpoch = kt(), this._trackCount = 0;
762
+ let e = !1;
682
763
  try {
683
- const i = k.run(this, this._fn);
684
- this._links = s, n = !0, Ie(i) ? this._handleAsyncResult(i) : this._cleanup = typeof i == "function" ? i : null;
685
- } catch (i) {
686
- this._links = s, n = !0, this._handleExecutionError(i), this._cleanup = null;
764
+ const s = $.run(this, this._fn);
765
+ if (this._nextLinks === this._prevLinks)
766
+ if (this._trackCount === this._prevLinks.length)
767
+ e = !0;
768
+ else {
769
+ for (let i = this._trackCount; i < this._prevLinks.length; i++)
770
+ this._prevLinks[i]?.unsub?.();
771
+ this._prevLinks.length = this._trackCount, e = !0;
772
+ }
773
+ else
774
+ this._nextLinks.length = this._trackCount, e = !0;
775
+ this._links = this._nextLinks, se(s) ? this._handleAsyncResult(s) : this._cleanup = typeof s == "function" ? s : null;
776
+ } catch (s) {
777
+ if (!e)
778
+ if (this._nextLinks === this._prevLinks) {
779
+ for (let i = this._trackCount; i < this._prevLinks.length; i++)
780
+ this._prevLinks[i]?.unsub?.();
781
+ this._prevLinks.length = this._trackCount, e = !0;
782
+ } else
783
+ this._nextLinks.length = this._trackCount, e = !0;
784
+ this._links = this._nextLinks, this._handleExecutionError(s), this._cleanup = null;
687
785
  } finally {
688
- this._finalizeDependencies(n, this._prevLinks, s), this.flags &= -9;
786
+ this._finalizeDependencies(e, this._prevLinks, this._nextLinks), this.flags &= -9;
689
787
  }
690
788
  }
691
789
  _handleAsyncResult(t) {
692
- const s = ++this._execId;
790
+ const e = ++this._execId;
693
791
  t.then(
694
- (n) => {
695
- if (s !== this._execId || this.flags & L.DISPOSED) {
696
- if (typeof n == "function")
792
+ (s) => {
793
+ if (e !== this._execId || this.flags & w.DISPOSED) {
794
+ if (typeof s == "function")
697
795
  try {
698
- n();
796
+ s();
699
797
  } catch (i) {
700
- this._handleExecutionError(i, y.EFFECT_CLEANUP_FAILED);
798
+ this._handleExecutionError(i, b.EFFECT_CLEANUP_FAILED);
701
799
  }
702
800
  return;
703
801
  }
704
- typeof n == "function" && (this._cleanup = n);
802
+ typeof s == "function" && (this._cleanup = s);
705
803
  },
706
- (n) => s === this._execId && this._handleExecutionError(n)
804
+ (s) => e === this._execId && this._handleExecutionError(s)
707
805
  );
708
806
  }
709
- _finalizeDependencies(t, s, n) {
710
- this._nextLinks = null, this._prevLinks = O, t ? (s.forEach((i) => i?.unsub?.()), s !== O && B.release(s)) : (this._unsubLinks(n), B.release(n));
807
+ _finalizeDependencies(t, e, s) {
808
+ this._nextLinks = null, this._prevLinks = L, t ? s !== e && e !== L && (e.forEach((i) => i?.unsub?.()), F.release(e)) : s !== e && s !== L && s && (this._unsubLinks(s), F.release(s));
711
809
  }
712
810
  _unsubLinks(t) {
713
- t.forEach((s) => s?.unsub?.());
811
+ t.forEach((e) => e?.unsub?.());
714
812
  }
715
813
  _isDirty() {
716
- const t = this._links, s = k.current;
717
- k.current = null;
814
+ const t = this._links, e = $.current;
815
+ $.current = null;
718
816
  try {
719
- return t.some((n) => {
720
- const i = n.node;
721
- if (i.flags & fe.IS_COMPUTED)
817
+ return t.some((s) => {
818
+ const i = s.node;
819
+ if (i.flags & Qt.IS_COMPUTED)
722
820
  try {
723
821
  i.value;
724
822
  } catch {
725
823
  return !0;
726
824
  }
727
- return i.version !== n.version;
825
+ return i.version !== s.version;
728
826
  });
729
827
  } finally {
730
- k.current = s;
828
+ $.current = e;
731
829
  }
732
830
  }
733
831
  _execCleanup() {
@@ -735,57 +833,57 @@ class Ke extends _e {
735
833
  try {
736
834
  this._cleanup();
737
835
  } catch (t) {
738
- this._handleExecutionError(t, y.EFFECT_CLEANUP_FAILED);
836
+ this._handleExecutionError(t, b.EFFECT_CLEANUP_FAILED);
739
837
  }
740
838
  this._cleanup = null;
741
839
  }
742
840
  }
743
841
  _checkInfiniteLoops() {
744
- const t = me();
745
- this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Be() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
842
+ const t = te();
843
+ this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Oe() > j.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
746
844
  }
747
845
  get isDisposed() {
748
- return (this.flags & L.DISPOSED) !== 0;
846
+ return (this.flags & w.DISPOSED) !== 0;
749
847
  }
750
848
  get executionCount() {
751
849
  return this._executionCount;
752
850
  }
753
851
  get isExecuting() {
754
- return (this.flags & L.EXECUTING) !== 0;
852
+ return (this.flags & w.EXECUTING) !== 0;
755
853
  }
756
854
  _throwInfiniteLoopError(t) {
757
- const s = new J(
758
- `Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${zt}`
855
+ const e = new q(
856
+ `Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${At}`
759
857
  );
760
- throw this.dispose(), console.error(s), s;
858
+ throw this.dispose(), console.error(e), e;
761
859
  }
762
- _handleExecutionError(t, s = y.EFFECT_EXECUTION_FAILED) {
763
- const n = Z(t, J, s);
764
- if (console.error(n), this._onError)
860
+ _handleExecutionError(t, e = b.EFFECT_EXECUTION_FAILED) {
861
+ const s = Q(t, q, e);
862
+ if (console.error(s), this._onError)
765
863
  try {
766
- this._onError(n);
864
+ this._onError(s);
767
865
  } catch (i) {
768
- console.error(Z(i, J, y.CALLBACK_ERROR_IN_ERROR_HANDLER));
866
+ console.error(Q(i, q, b.CALLBACK_ERROR_IN_ERROR_HANDLER));
769
867
  }
770
868
  }
771
869
  }
772
- function X(e, t = {}) {
773
- if (typeof e != "function")
774
- throw new J(y.EFFECT_MUST_BE_FUNCTION);
775
- const s = new Ke(e, t);
776
- return s.execute(), s;
870
+ function V(n, t = {}) {
871
+ if (typeof n != "function")
872
+ throw new q(b.EFFECT_MUST_BE_FUNCTION);
873
+ const e = new Fe(n, t);
874
+ return e.execute(), e;
777
875
  }
778
- function ye(e) {
779
- if (typeof e != "function")
780
- throw new TypeError("Batch callback must be a function");
781
- rt.startBatch();
876
+ function ne(n) {
877
+ if (typeof n != "function")
878
+ throw new TypeError(b.BATCH_CALLBACK_MUST_BE_FUNCTION);
879
+ ot.startBatch();
782
880
  try {
783
- return e();
881
+ return n();
784
882
  } finally {
785
- rt.endBatch();
883
+ ot.endBatch();
786
884
  }
787
885
  }
788
- const d = {
886
+ const E = {
789
887
  /** Used by the SPA router ($.route). */
790
888
  ROUTE: "[atom-route]",
791
889
  /** Used by all reactive binding helpers (bindText, bindCss, bindAttr, …). */
@@ -794,268 +892,258 @@ const d = {
794
892
  LIST: "[atom-list]",
795
893
  /** Used by mount/unmount lifecycle helpers. */
796
894
  MOUNT: "[atom-mount]"
797
- }, dt = Object.freeze({
895
+ }, et = Object.freeze({
798
896
  mode: "hash",
799
897
  basePath: "",
800
898
  autoBindLinks: !1,
801
899
  activeClass: "active"
802
- }), Ye = {
900
+ }), Be = {
901
+ /** Default DOM event to trigger synchronization. */
803
902
  EVENT: "input"
804
- }, We = /* @__PURE__ */ new Set(["input", "select", "textarea"]), Je = /* @__PURE__ */ new Set([
805
- "innerHTML",
806
- "outerHTML",
807
- "srcdoc",
808
- "__proto__",
809
- "constructor",
810
- "prototype"
811
- ]), S = {
812
- ROUTE_NOT_FOUND: (e) => `Route "${e}" not found and no notFound route configured`,
813
- TEMPLATE_NOT_FOUND: (e) => `Template "${e}" not found`,
814
- TARGET_NOT_FOUND: (e) => `Target element "${e}" not found`,
815
- MALFORMED_URI: (e) => `Malformed URI component: ${e}`,
816
- /** Emitted when sanitizeHtml modifies the input. Prefixed at call site with LOG_PREFIXES.BINDING or LIST to identify the originating subsystem. */
817
- UNSAFE_CONTENT: () => "Unsafe content neutralized during sanitization.",
818
- /** Emitted by bindCss when a CSS style property value contains a dangerous protocol. */
819
- BLOCKED_DANGEROUS_CSS_VALUE: (e) => `Blocked dangerous value in CSS style property "${e}".`,
820
- BLOCKED_EVENT_HANDLER: (e) => `Blocked setting dangerous event handler attribute "${e}".`,
821
- BLOCKED_PROTOCOL: (e) => `Blocked dangerous protocol in "${e}" attribute.`,
822
- BLOCKED_DANGEROUS_PROP: (e) => `Blocked setting dangerous property "${e}". Use html binding for sanitized HTML.`,
823
- INVALID_INPUT_ELEMENT: (e) => `Val binding used on non-input element <${e}>.`,
824
- MISSING_SOURCE: (e) => `[${e}] source is required when prop/name is a string.`,
825
- MISSING_CONDITION: (e) => `[${e}] condition is required when className is a string.`,
826
- DUPLICATE_KEY: (e, t) => `Duplicate key "${e}" at index ${t}.`,
827
- UPDATER_ERROR: (e) => `Updater threw in binding "${e}"`,
828
- EFFECT_DISPOSE_ERROR: () => "Effect dispose error",
829
- BINDING_CLEANUP_ERROR: () => "Binding cleanup error",
830
- PARSE_ERROR: () => "parse() threw during DOM→Atom sync",
831
- MOUNT_ERROR: () => "Mount error",
832
- MOUNT_CLEANUP_ERROR: () => "Cleanup error"
833
- };
834
- function Ce(e) {
835
- return qt(e);
836
- }
837
- function Xt(e) {
838
- const t = e.tagName.toLowerCase();
839
- if (e.id) return `${t}#${e.id}`;
840
- const s = e.classList, n = s.length;
841
- if (n === 0) return t;
842
- let i = t;
843
- for (let r = 0; r < n; r++)
844
- i += `.${s[r]}`;
845
- return i;
846
- }
847
- const Ze = /* @__PURE__ */ new Set([
848
- "href",
903
+ }, ie = {
904
+ /** Default duration in ms for visual highlighting during DOM updates. */
905
+ HIGHLIGHT_DURATION_MS: 500
906
+ }, Ge = /* @__PURE__ */ new Set(["input", "select", "textarea"]), He = /* @__PURE__ */ new Set([
849
907
  "src",
908
+ "href",
850
909
  "action",
851
910
  "formaction",
852
- "xlink:href",
853
911
  "data",
854
912
  "poster",
855
- "srcset",
856
913
  "background",
857
914
  "cite",
858
915
  "longdesc",
859
916
  "profile",
860
917
  "usemap",
861
918
  "classid",
862
- "codebase"
863
- ]), ts = Object.prototype.hasOwnProperty, es = /^\s*(?:javascript|vbscript)\s*:/i, ss = (
864
- // biome-ignore lint/suspicious/noControlCharactersInRegex: Intentionally matching control characters for XSS sanitization
865
- /(?:expression\s*\(|behavior\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i
866
- ), ns = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, is = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, rs = /<\?[\s\S]*?\?>/g, os = /(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi, cs = /(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi, as = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, hs = /\bon\w+\s*=/gim, us = new RegExp(ss.source, "gim");
867
- function Bt(e) {
868
- let t = String(e ?? "");
869
- t = t.replace(is, ""), t = t.replace(rs, "");
870
- let s;
871
- do
872
- s = t, t = t.replace(os, "");
873
- while (t !== s);
874
- return t = t.replace(cs, "data-unsafe-protocol:"), t = t.replace(as, "data-unsafe-protocol:"), t = t.replace(hs, "data-unsafe-attr="), t = t.replace(us, "data-unsafe-css:"), t;
875
- }
876
- function ls(e, t) {
877
- return Ze.has(e.toLowerCase()) ? es.test(t) : !1;
878
- }
879
- function fs(e) {
880
- return e.toLowerCase().includes("url(") ? ns.test(e) : !1;
881
- }
882
- function ds(e, t) {
883
- if (e === t) return !0;
884
- if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
885
- const s = Object.keys(e), n = Object.keys(t);
886
- if (s.length !== n.length) return !1;
887
- const i = e, r = t;
888
- for (let o = 0; o < s.length; o++) {
889
- const l = s[o];
890
- if (!ts.call(r, l) || i[l] !== r[l])
919
+ "codebase",
920
+ "xlink:href"
921
+ ]), je = /* @__PURE__ */ new Set([
922
+ "innerHTML",
923
+ "outerHTML",
924
+ "srcdoc",
925
+ "__proto__",
926
+ "constructor",
927
+ "prototype"
928
+ ]), S = {
929
+ ROUTE: {
930
+ NOT_FOUND: (n) => `Route "${n}" not found and no notFound route configured`,
931
+ TEMPLATE_NOT_FOUND: (n) => `Template "${n}" not found`,
932
+ TARGET_NOT_FOUND: (n) => `Target element "${n}" not found`,
933
+ MALFORMED_URI: (n) => `Malformed URI component: ${n}`
934
+ },
935
+ SECURITY: {
936
+ /** Emitted when sanitizeHtml modifies the input. */
937
+ UNSAFE_CONTENT: () => "Unsafe content neutralized during sanitization.",
938
+ /** Emitted when a CSS style property value contains a dangerous protocol. */
939
+ BLOCKED_CSS_VALUE: (n) => `Blocked dangerous value in CSS style property "${n}".`,
940
+ BLOCKED_EVENT_HANDLER: (n) => `Blocked setting dangerous event handler attribute/property "${n}".`,
941
+ BLOCKED_PROTOCOL: (n) => `Blocked dangerous protocol in "${n}".`,
942
+ BLOCKED_PROP: (n) => `Blocked setting dangerous property "${n}". Use html binding for sanitized HTML.`
943
+ },
944
+ BINDING: {
945
+ INVALID_INPUT_ELEMENT: (n) => `Val binding used on non-input element <${n}>.`,
946
+ MISSING_SOURCE: (n) => `[${n}] source is required when prop/name is a string.`,
947
+ MISSING_CONDITION: (n) => `[${n}] condition is required when className is a string.`,
948
+ UPDATER_ERROR: (n, t) => `Updater threw in binding "${n}"${t ? " (static)" : ""}`,
949
+ CLEANUP_ERROR: (n) => `Binding cleanup error${n ? `: ${n}` : ""}`,
950
+ PARSE_ERROR: (n) => `parse() threw during DOM→Atom sync${n ? `: ${n}` : ""}`
951
+ },
952
+ LIST: {
953
+ DUPLICATE_KEY: (n, t, e) => `Duplicate key "${n}" at index ${t} in atomList <${e}>.`
954
+ },
955
+ MOUNT: {
956
+ ERROR: (n) => `Mount error${n ? ` in component <${n}>` : ""}`,
957
+ CLEANUP_ERROR: (n) => `Cleanup error${n ? ` in component <${n}>` : ""}`
958
+ },
959
+ CORE: {
960
+ EFFECT_DISPOSE_ERROR: (n) => `Effect dispose error${n ? `: ${n}` : ""}`
961
+ }
962
+ };
963
+ function oe(n) {
964
+ return wt(n);
965
+ }
966
+ function X(n) {
967
+ const t = n.tagName.toLowerCase();
968
+ if (n.id) return `${t}#${n.id}`;
969
+ const e = n.classList, s = e.length;
970
+ if (s === 0) return t;
971
+ let i = t;
972
+ for (let o = 0; o < s; o++)
973
+ i += `.${e[o]}`;
974
+ return i;
975
+ }
976
+ const Z = Object.prototype.hasOwnProperty;
977
+ function Ve(n, t) {
978
+ if (n === t) return !0;
979
+ if (n === null || t === null || typeof n != "object" || typeof t != "object") return !1;
980
+ const e = Object.keys(n), s = Object.keys(t);
981
+ if (e.length !== s.length) return !1;
982
+ const i = n, o = t;
983
+ for (let r = 0; r < e.length; r++) {
984
+ const c = e[r];
985
+ if (!Z.call(o, c) || i[c] !== o[c])
891
986
  return !1;
892
987
  }
893
988
  return !0;
894
989
  }
895
- function _s(e) {
896
- const t = e.length;
990
+ function ze(n) {
991
+ const t = n.length;
897
992
  if (t === 0) return new Int32Array(0);
898
- const s = new Int32Array(t).fill(-1), n = new Int32Array(t);
993
+ const e = new Int32Array(t).fill(-1), s = new Int32Array(t);
899
994
  let i = 0;
900
- for (let o = 0; o < t; o++) {
901
- const l = e[o];
902
- if (l === void 0 || l === -1) continue;
903
- const p = i > 0 ? n[i - 1] : void 0;
904
- if (i === 0 || p !== void 0 && (e[p] ?? -1) < l) {
905
- s[o] = p ?? -1, n[i++] = o;
995
+ for (let r = 0; r < t; r++) {
996
+ const c = n[r];
997
+ if (c === void 0 || c === -1) continue;
998
+ const a = i > 0 ? s[i - 1] : void 0;
999
+ if (i === 0 || a !== void 0 && (n[a] ?? -1) < c) {
1000
+ e[r] = a ?? -1, s[i++] = r;
906
1001
  continue;
907
1002
  }
908
- let C = 0, b = i - 1;
909
- for (; C < b; ) {
910
- const E = C + b >>> 1, m = n[E];
911
- m !== void 0 && (e[m] ?? -1) < l ? C = E + 1 : b = E;
1003
+ let l = 0, u = i - 1;
1004
+ for (; l < u; ) {
1005
+ const y = l + u >>> 1, p = s[y];
1006
+ p !== void 0 && (n[p] ?? -1) < c ? l = y + 1 : u = y;
912
1007
  }
913
- const N = n[C];
914
- N !== void 0 && l < (e[N] ?? Number.MAX_SAFE_INTEGER) && (C > 0 && (s[o] = n[C - 1] ?? -1), n[C] = o);
1008
+ const _ = s[l];
1009
+ _ !== void 0 && c < (n[_] ?? Number.MAX_SAFE_INTEGER) && (l > 0 && (e[r] = s[l - 1] ?? -1), s[l] = r);
915
1010
  }
916
- const r = new Int32Array(i);
1011
+ const o = new Int32Array(i);
917
1012
  if (i > 0) {
918
- let o = n[i - 1];
919
- for (let l = i - 1; l >= 0 && o !== void 0 && o !== -1; l--)
920
- r[l] = o, o = s[o];
1013
+ let r = s[i - 1];
1014
+ for (let c = i - 1; c >= 0 && r !== void 0 && r !== -1; c--)
1015
+ o[c] = r, r = e[r];
921
1016
  }
922
- return r;
1017
+ return o;
923
1018
  }
924
- const Es = {}, be = 600, ps = `${be / 1e3}s`;
925
- function ms() {
1019
+ const Ke = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, qe = `${ie.HIGHLIGHT_DURATION_MS / 1e3}s`;
1020
+ function Xe() {
926
1021
  if (typeof window < "u") {
927
- const e = window.__ATOM_DEBUG__;
928
- if (typeof e == "boolean") return e;
1022
+ const n = window.__ATOM_DEBUG__;
1023
+ if (typeof n == "boolean") return n;
1024
+ }
1025
+ try {
1026
+ if (Ke?.VITE_ATOM_DEBUG === "true") return !0;
1027
+ } catch {
1028
+ }
1029
+ try {
1030
+ if (globalThis.process?.env?.VITE_ATOM_DEBUG === "true")
1031
+ return !0;
1032
+ } catch {
929
1033
  }
930
- return Es?.VITE_ATOM_DEBUG === "true";
1034
+ return !1;
931
1035
  }
932
- let Y = ms();
933
- const f = {
1036
+ let zt = Xe();
1037
+ const d = {
934
1038
  get enabled() {
935
- return Y;
1039
+ if (typeof window < "u") {
1040
+ const n = window.__ATOM_DEBUG__;
1041
+ if (typeof n == "boolean") return n;
1042
+ }
1043
+ return zt;
936
1044
  },
937
- set enabled(e) {
938
- Y = e;
1045
+ set enabled(n) {
1046
+ zt = n;
939
1047
  },
940
1048
  /**
941
1049
  * Logs a message only when debug mode is active.
942
1050
  */
943
- log(e, ...t) {
944
- Y && console.log(`${d.MOUNT} ${e}:`, ...t);
1051
+ log(n, ...t) {
1052
+ this.enabled && console.log(`${n}`, ...t);
945
1053
  },
946
1054
  /**
947
1055
  * Logs an atom value change only when debug mode is active.
948
1056
  */
949
- atomChanged(e, t, s) {
950
- Y && console.log(
951
- `${d.MOUNT} Atom "${e ?? "anonymous"}" changed:`,
952
- t,
953
- "→",
954
- s
955
- );
1057
+ atomChanged(n, t, e, s) {
1058
+ this.enabled && console.log(`${n} Atom "${t ?? "anonymous"}" changed:`, e, "→", s);
956
1059
  },
957
1060
  /**
958
1061
  * Logs a DOM update and triggers a visual highlight flash.
959
- * Only active when debug mode is enabled.
960
- *
961
- * @param target - The element or jQuery wrapper that was updated.
962
- * @param type - The binding type (e.g. 'text', 'checked', 'attr.href').
963
- * @param value - The new value that was applied.
964
1062
  */
965
- domUpdated(e, t, s) {
966
- if (!Y) return;
967
- const n = e instanceof Element ? e : e[0];
968
- n instanceof HTMLElement && (console.log(`${d.MOUNT} DOM updated: ${Xt(n)}.${t} =`, s), ys(n));
1063
+ domUpdated(n, t, e, s) {
1064
+ if (!this.enabled) return;
1065
+ const i = t instanceof Element ? t : t[0];
1066
+ i && (console.log(`${n} DOM updated: ${X(i)}.${e} =`, s), Qe(i));
969
1067
  },
970
1068
  /**
971
1069
  * Logs a cleanup event only when debug mode is active.
972
1070
  */
973
- cleanup(e) {
974
- Y && console.log(`${d.MOUNT} Cleanup: ${e}`);
1071
+ cleanup(n, t) {
1072
+ this.enabled && console.log(`${n} Cleanup: ${t}`);
975
1073
  },
976
1074
  /**
977
- * Unconditional warning for runtime errors and unexpected states.
978
- * Not gated by debugEnabled — these are always surfaced regardless of
979
- * debug mode because they indicate real problems (e.g. dispose failures,
980
- * missing route targets, pushState security errors).
981
- *
982
- * `prefix` is the subsystem tag (e.g. `LOG_PREFIXES.ROUTE`) so that the
983
- * originating subsystem appears in the log rather than the generic MOUNT tag.
984
- * Pass an empty string to emit a prefix-free message.
1075
+ * Unconditional warning for runtime errors.
985
1076
  */
986
- warn(e, t, ...s) {
987
- console.warn(`${e} ${t}`, ...s);
1077
+ warn(n, t, ...e) {
1078
+ console.warn(`${n} ${t}`, ...e);
988
1079
  },
989
1080
  /**
990
1081
  * Unconditional error for binding failures.
991
- * Not gated by debugEnabled — binding errors are always surfaced because
992
- * they indicate a broken updater that silently stopped applying values.
993
1082
  */
994
- error(e, t, s) {
995
- console.error(`${e} ${t}`, s);
996
- }
997
- }, Ht = "atom-debug-highlight", gs = "data-atom-debug";
998
- let ae;
999
- function Is() {
1000
- if (ae?.deref()?.isConnected) return;
1001
- const e = document.createElement("style");
1002
- e.setAttribute(gs, ""), e.textContent = `.${Ht}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${ps} ease-out}`, document.head.appendChild(e), ae = new WeakRef(e);
1003
- }
1004
- const kt = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap();
1005
- function ys(e) {
1006
- if (!e.isConnected) return;
1007
- Is();
1008
- const t = xt.get(e);
1083
+ error(n, t, e) {
1084
+ console.error(`${n} ${t}`, e);
1085
+ }
1086
+ }, Ot = "atom-debug-highlight", Kt = "data-atom-debug";
1087
+ let st;
1088
+ function Ye() {
1089
+ if ((st instanceof HTMLStyleElement ? st : st?.deref())?.isConnected || document.querySelector(`style[${Kt}]`)) return;
1090
+ const t = document.createElement("style");
1091
+ t.setAttribute(Kt, ""), t.textContent = `.${Ot}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${qe} ease-out}`, document.head.appendChild(t), typeof WeakRef < "u" ? st = new WeakRef(t) : st = t;
1092
+ }
1093
+ const Nt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap();
1094
+ function Qe(n) {
1095
+ if (!d.enabled || !n.isConnected) return;
1096
+ Ye();
1097
+ const t = bt.get(n);
1009
1098
  t !== void 0 && cancelAnimationFrame(t);
1010
- const s = kt.get(e);
1011
- s !== void 0 && clearTimeout(s);
1012
- const n = requestAnimationFrame(() => {
1013
- xt.delete(e), e.classList.add(Ht), kt.set(
1014
- e,
1099
+ const e = Nt.get(n);
1100
+ e !== void 0 && clearTimeout(e);
1101
+ const s = requestAnimationFrame(() => {
1102
+ bt.delete(n), n.isConnected && (n.classList.add(Ot), Nt.set(
1103
+ n,
1015
1104
  setTimeout(() => {
1016
- e.classList.remove(Ht), kt.delete(e);
1017
- }, be)
1018
- );
1105
+ n.isConnected && n.classList.remove(Ot), Nt.delete(n);
1106
+ }, ie.HIGHLIGHT_DURATION_MS)
1107
+ ));
1019
1108
  });
1020
- xt.set(e, n);
1109
+ bt.set(n, s);
1021
1110
  }
1022
- function Se(e, t) {
1023
- return Ft(e, t);
1111
+ function re(n, t) {
1112
+ return Dt(n, t);
1024
1113
  }
1025
- Object.defineProperty(Se, "debug", {
1114
+ Object.defineProperty(re, "debug", {
1026
1115
  enumerable: !0,
1027
1116
  // configurable: true allows tests and advanced consumers to redefine or
1028
1117
  // delete the accessor if needed. The default (false) would permanently lock
1029
1118
  // the property on the function object.
1030
1119
  configurable: !0,
1031
1120
  get() {
1032
- return f.enabled;
1121
+ return d.enabled;
1033
1122
  },
1034
- set(e) {
1035
- f.enabled = e;
1123
+ set(n) {
1124
+ d.enabled = n;
1036
1125
  }
1037
1126
  });
1038
- function Cs() {
1039
- return new Promise((e) => setTimeout(e, 0));
1040
- }
1041
- const bs = {
1042
- // `atom` carries a runtime `debug` accessor added via Object.defineProperty.
1043
- // TypeScript cannot see it through the declared function type, so the double
1044
- // cast is unavoidable. The NamespaceExtensions annotation still verifies all
1045
- // other fields; only `atom`'s shape escapes static checking here.
1046
- atom: Se,
1047
- computed: Ct,
1048
- effect: X,
1049
- batch: ye,
1050
- untracked: H,
1051
- isAtom: qt,
1052
- isComputed: Ve,
1053
- isReactive: Ce,
1054
- nextTick: Cs
1127
+ function We() {
1128
+ return new Promise((n) => setTimeout(n, 0));
1129
+ }
1130
+ const Ze = {
1131
+ // Double cast required for the `atom` function due to its runtime `debug`
1132
+ // accessor (see JSDoc for `function atom` above). All other fields are
1133
+ // fully verified by `NamespaceExtensions`.
1134
+ atom: re,
1135
+ computed: gt,
1136
+ effect: V,
1137
+ batch: ne,
1138
+ untracked: P,
1139
+ isAtom: wt,
1140
+ isComputed: xe,
1141
+ isReactive: oe,
1142
+ nextTick: We
1055
1143
  };
1056
- c.extend(bs);
1057
- const W = "_aes-bound";
1058
- class Ss {
1144
+ h.extend(Ze);
1145
+ const G = "_aes-bound";
1146
+ class Je {
1059
1147
  constructor() {
1060
1148
  this.records = /* @__PURE__ */ new WeakMap(), this.preservedNodes = /* @__PURE__ */ new WeakSet(), this.ignoredNodes = /* @__PURE__ */ new WeakSet();
1061
1149
  }
@@ -1078,20 +1166,20 @@ class Ss {
1078
1166
  // Tracking
1079
1167
  // --------------------------------------------------------------------------
1080
1168
  getOrCreateRecord(t) {
1081
- let s = this.records.get(t);
1082
- return s || (s = {}, this.records.set(t, s), t.classList.add(W)), s;
1169
+ let e = this.records.get(t);
1170
+ return e || (e = { effects: void 0, cleanups: void 0, componentCleanup: void 0 }, this.records.set(t, e), t.classList.add(G)), e;
1083
1171
  }
1084
- trackEffect(t, s) {
1085
- const n = this.getOrCreateRecord(t);
1086
- n.effects ??= [], n.effects.push(s);
1172
+ trackEffect(t, e) {
1173
+ const s = this.getOrCreateRecord(t);
1174
+ s.effects ??= [], s.effects.push(e);
1087
1175
  }
1088
- trackCleanup(t, s) {
1089
- const n = this.getOrCreateRecord(t);
1090
- n.cleanups ??= [], n.cleanups.push(s);
1176
+ trackCleanup(t, e) {
1177
+ const s = this.getOrCreateRecord(t);
1178
+ s.cleanups ??= [], s.cleanups.push(e);
1091
1179
  }
1092
- setComponentCleanup(t, s) {
1093
- const n = this.getOrCreateRecord(t);
1094
- n.componentCleanup = s;
1180
+ setComponentCleanup(t, e) {
1181
+ const s = this.getOrCreateRecord(t);
1182
+ s.componentCleanup = e;
1095
1183
  }
1096
1184
  hasBind(t) {
1097
1185
  return this.records.has(t);
@@ -1100,644 +1188,923 @@ class Ss {
1100
1188
  // Cleanup
1101
1189
  // --------------------------------------------------------------------------
1102
1190
  cleanup(t) {
1103
- const s = this.records.get(t);
1104
- if (!s) {
1105
- t.isConnected && t.classList.remove(W), this.preservedNodes.delete(t), this.ignoredNodes.delete(t);
1191
+ const e = this.records.get(t);
1192
+ if (!e) {
1193
+ t.nodeType === 1 && t.classList.remove(G), this.preservedNodes.delete(t), this.ignoredNodes.delete(t);
1106
1194
  return;
1107
1195
  }
1108
- if (this.records.delete(t), this.preservedNodes.delete(t), this.ignoredNodes.delete(t), t.isConnected && t.classList.remove(W), f.enabled && f.cleanup(Xt(t)), s.componentCleanup)
1109
- try {
1110
- s.componentCleanup();
1111
- } catch (n) {
1112
- f.error(d.MOUNT, S.MOUNT_CLEANUP_ERROR(), n);
1113
- }
1114
- s.effects?.forEach((n) => {
1115
- try {
1116
- n.dispose();
1117
- } catch (i) {
1118
- f.error(d.BINDING, S.EFFECT_DISPOSE_ERROR(), i);
1119
- }
1120
- }), s.cleanups?.forEach((n) => {
1196
+ if (this.records.delete(t), this.preservedNodes.delete(t), this.ignoredNodes.delete(t), t.nodeType === 1 && t.classList.remove(G), d.enabled) {
1197
+ const s = t.nodeType === 1 ? X(t) : t.nodeName || "Node";
1198
+ d.cleanup(E.BINDING, s);
1199
+ }
1200
+ if (e.componentCleanup)
1121
1201
  try {
1122
- n();
1123
- } catch (i) {
1124
- f.error(d.BINDING, S.BINDING_CLEANUP_ERROR(), i);
1202
+ e.componentCleanup();
1203
+ } catch (s) {
1204
+ const i = t.nodeType === 1 ? X(t) : "Node";
1205
+ d.error(E.MOUNT, S.MOUNT.CLEANUP_ERROR(i), s);
1125
1206
  }
1126
- });
1207
+ if (e.effects) {
1208
+ const s = e.effects;
1209
+ for (let i = 0, o = s.length; i < o; i++)
1210
+ try {
1211
+ s[i].dispose();
1212
+ } catch (r) {
1213
+ const c = t.nodeType === 1 ? X(t) : "Node";
1214
+ d.error(E.BINDING, S.CORE.EFFECT_DISPOSE_ERROR(c), r);
1215
+ }
1216
+ }
1217
+ if (e.cleanups) {
1218
+ const s = e.cleanups;
1219
+ for (let i = 0, o = s.length; i < o; i++)
1220
+ try {
1221
+ s[i]();
1222
+ } catch (r) {
1223
+ const c = t.nodeType === 1 ? X(t) : "Node";
1224
+ d.error(E.BINDING, S.BINDING.CLEANUP_ERROR(c), r);
1225
+ }
1226
+ }
1127
1227
  }
1128
1228
  cleanupDescendants(t) {
1129
- const s = t.querySelectorAll(`.${W}`);
1130
- for (const n of s)
1131
- this.records.has(n) ? this.cleanup(n) : (n.classList.remove(W), f.warn(
1132
- d.BINDING,
1133
- `${W} class found on unregistered element:`,
1134
- n
1135
- ));
1229
+ const e = "getElementsByClassName" in t && typeof t.getElementsByClassName == "function" ? t.getElementsByClassName(G) : t.querySelectorAll(`.${G}`);
1230
+ for (let s = e.length - 1; s >= 0; s--) {
1231
+ const i = e[s];
1232
+ i && (this.records.has(i) ? this.cleanup(i) : (i.classList.remove(G), d.enabled && d.warn(
1233
+ E.BINDING,
1234
+ `${G} class found on unregistered element:`,
1235
+ i
1236
+ )));
1237
+ }
1136
1238
  }
1137
1239
  cleanupTree(t) {
1138
- this.cleanupDescendants(t), this.cleanup(t);
1240
+ (t.nodeType === 1 || t.nodeType === 11) && this.cleanupDescendants(t), this.cleanup(t);
1139
1241
  }
1140
1242
  }
1141
- const g = new Ss();
1142
- let it = null, Et = null;
1143
- function Rs(e) {
1144
- if (it !== null) {
1145
- Et !== e && f.warn(
1146
- d.BINDING,
1147
- "enableAutoCleanup() called with a different root while already active. Observation was NOT switched — call disableAutoCleanup() first.",
1148
- { current: Et, requested: e }
1149
- );
1243
+ const R = new Je(), ft = /* @__PURE__ */ new Map();
1244
+ function ts(n) {
1245
+ if (ft.has(n))
1150
1246
  return;
1151
- }
1152
- Et = e, it = new MutationObserver((t) => {
1153
- for (const s of t)
1154
- for (const n of s.removedNodes)
1155
- n.nodeType === 1 && (n.isConnected || g.isKept(n) || g.isIgnored(n) || g.cleanupTree(n));
1156
- }), it.observe(e, { childList: !0, subtree: !0 });
1247
+ const t = new MutationObserver((e) => {
1248
+ for (let s = 0, i = e.length; s < i; s++) {
1249
+ const o = e[s].removedNodes;
1250
+ for (let r = 0, c = o.length; r < c; r++) {
1251
+ const a = o[r];
1252
+ a.nodeType === 1 && (a.isConnected || R.isKept(a) || R.isIgnored(a) || R.cleanupTree(a));
1253
+ }
1254
+ }
1255
+ });
1256
+ t.observe(n, { childList: !0, subtree: !0 }), ft.set(n, t);
1157
1257
  }
1158
1258
  function Gs() {
1159
- it?.disconnect(), it = null, Et = null;
1259
+ ft.forEach((n) => n.disconnect()), ft.clear();
1160
1260
  }
1161
- function Q(e, t, s, n) {
1162
- if (Ce(t)) {
1261
+ function B(n, t, e, s) {
1262
+ if (oe(t)) {
1163
1263
  const i = t;
1164
- g.trackEffect(
1165
- e,
1166
- X(() => {
1167
- const r = i.value;
1168
- H(() => {
1169
- try {
1170
- s(r);
1171
- } catch (o) {
1172
- f.error(d.BINDING, `${S.UPDATER_ERROR(n)}:`, o);
1173
- return;
1174
- }
1175
- f.enabled && f.domUpdated(e, n, r);
1176
- });
1177
- })
1264
+ R.trackEffect(
1265
+ n,
1266
+ V(
1267
+ () => {
1268
+ const o = i.value;
1269
+ P(() => {
1270
+ try {
1271
+ e(o);
1272
+ } catch (r) {
1273
+ d.error(E.BINDING, S.BINDING.UPDATER_ERROR(s), r);
1274
+ return;
1275
+ }
1276
+ d.enabled && d.domUpdated(E.BINDING, n, s, o);
1277
+ });
1278
+ },
1279
+ { name: s }
1280
+ )
1178
1281
  );
1179
- } else {
1180
- try {
1181
- s(t);
1182
- } catch (i) {
1183
- f.error(d.BINDING, `${S.UPDATER_ERROR(n)} (static):`, i);
1184
- return;
1185
- }
1186
- f.enabled && f.domUpdated(e, n, t);
1187
- }
1282
+ } else
1283
+ P(() => {
1284
+ try {
1285
+ e(t);
1286
+ } catch (i) {
1287
+ d.error(E.BINDING, S.BINDING.UPDATER_ERROR(s, !0), i);
1288
+ return;
1289
+ }
1290
+ d.enabled && d.domUpdated(E.BINDING, n, s, t);
1291
+ });
1188
1292
  }
1189
- const F = /* @__PURE__ */ Symbol("atom-effect-internal"), mt = /* @__PURE__ */ new WeakMap();
1190
- let w = null;
1191
- const Re = (e) => {
1192
- if (e[F]) return e;
1193
- let t = mt.get(e);
1194
- return t || (t = function(...s) {
1195
- return ye(() => e.apply(this, s));
1196
- }, t[F] = !0, mt.set(e, t)), t;
1293
+ const dt = /* @__PURE__ */ Symbol("atom-effect-internal"), _t = /* @__PURE__ */ new WeakMap();
1294
+ let x = null;
1295
+ const ce = (n) => {
1296
+ if (n[dt]) return n;
1297
+ let t = _t.get(n);
1298
+ return t || (t = function(...e) {
1299
+ return ne(() => n.apply(this, e));
1300
+ }, t[dt] = !0, _t.set(n, t)), t;
1197
1301
  };
1198
- function Ts(e) {
1199
- const t = {};
1200
- return Object.keys(e).forEach((s) => {
1201
- const n = e[s];
1202
- n && (t[s] = Re(n));
1203
- }), t;
1204
- }
1205
- function Os(e) {
1206
- const t = {};
1207
- return Object.keys(e).forEach((s) => {
1208
- const n = e[s];
1209
- t[s] = n ? mt.get(n) ?? n : void 0;
1210
- }), t;
1211
- }
1212
- function Ns() {
1213
- if (w !== null) return;
1214
- w = {
1215
- on: c.fn.on,
1216
- off: c.fn.off,
1217
- remove: c.fn.remove,
1218
- empty: c.fn.empty,
1219
- detach: c.fn.detach
1302
+ function es(n) {
1303
+ const t = {}, e = Object.entries(n);
1304
+ for (let s = 0, i = e.length; s < i; s++) {
1305
+ const o = e[s], r = o[0], c = o[1];
1306
+ c && (t[r] = ce(c));
1307
+ }
1308
+ return t;
1309
+ }
1310
+ function ss(n) {
1311
+ const t = {}, e = Object.entries(n);
1312
+ for (let s = 0, i = e.length; s < i; s++) {
1313
+ const o = e[s], r = o[0], c = o[1];
1314
+ t[r] = c ? _t.get(c) ?? c : void 0;
1315
+ }
1316
+ return t;
1317
+ }
1318
+ function ns() {
1319
+ if (x !== null) return;
1320
+ x = {
1321
+ on: h.fn.on,
1322
+ off: h.fn.off,
1323
+ remove: h.fn.remove,
1324
+ empty: h.fn.empty,
1325
+ detach: h.fn.detach
1220
1326
  };
1221
- const e = w;
1222
- c.fn.remove = function(t) {
1223
- const s = t ? this.filter(t) : this;
1224
- for (let n = 0, i = s.length; n < i; n++) {
1225
- const r = s[n];
1226
- r && (g.markIgnored(r), g.cleanupTree(r));
1327
+ const n = x;
1328
+ h.fn.remove = function(t) {
1329
+ const e = t ? this.filter(t) : this;
1330
+ for (let i = 0, o = e.length; i < o; i++) {
1331
+ const r = e[i];
1332
+ r && (R.markIgnored(r), R.cleanupTree(r));
1227
1333
  }
1228
- return e.remove.call(this, t);
1229
- }, c.fn.empty = function() {
1230
- for (let t = 0, s = this.length; t < s; t++) {
1231
- const n = this[t];
1232
- n && g.cleanupDescendants(n);
1334
+ const s = n.remove.call(this, t);
1335
+ return s !== void 0 ? s : this;
1336
+ }, h.fn.empty = function() {
1337
+ for (let e = 0, s = this.length; e < s; e++) {
1338
+ const i = this[e];
1339
+ i?.hasChildNodes() && R.cleanupDescendants(i);
1233
1340
  }
1234
- return e.empty.call(this);
1235
- }, c.fn.detach = function(t) {
1236
- const s = t ? this.filter(t) : this;
1237
- for (let n = 0, i = s.length; n < i; n++) {
1238
- const r = s[n];
1239
- r && g.keep(r);
1341
+ const t = n.empty.call(this);
1342
+ return t !== void 0 ? t : this;
1343
+ }, h.fn.detach = function(t) {
1344
+ const e = t ? this.filter(t) : this;
1345
+ for (let i = 0, o = e.length; i < o; i++) {
1346
+ const r = e[i];
1347
+ r && R.keep(r);
1240
1348
  }
1241
- return e.detach.call(this, t);
1242
- }, c.fn.on = function(...t) {
1243
- const s = t[0];
1244
- if (s && typeof s == "object")
1245
- t[0] = Ts(s);
1246
- else
1247
- for (let n = t.length - 1; n >= 0; n--)
1248
- if (typeof t[n] == "function") {
1249
- t[n] = Re(t[n]);
1250
- break;
1251
- }
1252
- return e.on.apply(this, t);
1253
- }, c.fn.off = function(...t) {
1254
- const s = t[0];
1255
- if (s && typeof s == "object")
1256
- t[0] = Os(s);
1257
- else
1258
- for (let n = t.length - 1; n >= 0; n--)
1259
- if (typeof t[n] == "function") {
1260
- const i = t[n];
1261
- t[n] = mt.get(i) ?? i;
1262
- break;
1263
- }
1264
- return e.off.apply(this, t);
1349
+ const s = n.detach.call(this, t);
1350
+ return s !== void 0 ? s : this;
1351
+ }, h.fn.on = function(...t) {
1352
+ const e = t[0];
1353
+ if (e && typeof e == "object")
1354
+ t[0] = es(e);
1355
+ else {
1356
+ const i = t.length - 1;
1357
+ i >= 0 && typeof t[i] == "function" && (t[i] = ce(t[i]));
1358
+ }
1359
+ const s = n.on.apply(this, t);
1360
+ return s !== void 0 ? s : this;
1361
+ }, h.fn.off = function(...t) {
1362
+ const e = t[0];
1363
+ if (e && typeof e == "object")
1364
+ t[0] = ss(e);
1365
+ else {
1366
+ const i = t.length - 1;
1367
+ if (i >= 0 && typeof t[i] == "function") {
1368
+ const o = t[i];
1369
+ t[i] = _t.get(o) ?? o;
1370
+ }
1371
+ }
1372
+ const s = n.off.apply(this, t);
1373
+ return s !== void 0 ? s : this;
1265
1374
  };
1266
1375
  }
1267
- function js() {
1268
- w !== null && (c.fn.on = w.on, c.fn.off = w.off, c.fn.remove = w.remove, c.fn.empty = w.empty, c.fn.detach = w.detach, w = null);
1376
+ function Hs() {
1377
+ x !== null && (h.fn.on = x.on, h.fn.off = x.off, h.fn.remove = x.remove, h.fn.empty = x.empty, h.fn.detach = x.detach, x = null);
1378
+ }
1379
+ var O = /* @__PURE__ */ ((n) => (n[n.None = 0] = "None", n[n.Focused = 1] = "Focused", n[n.Composing = 2] = "Composing", n[n.SyncingToAtom = 4] = "SyncingToAtom", n[n.SyncingToDom = 8] = "SyncingToDom", n[n.Busy = 14] = "Busy", n))(O || {});
1380
+ let is = 0;
1381
+ function nt(n) {
1382
+ n[dt] = !0;
1269
1383
  }
1270
- var T = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Focused = 1] = "Focused", e[e.Composing = 2] = "Composing", e[e.SyncingToAtom = 4] = "SyncingToAtom", e[e.SyncingToDom = 8] = "SyncingToDom", e[e.Busy = 14] = "Busy", e))(T || {});
1271
- let vs = 0;
1272
- class Ds {
1273
- constructor(t, s, n) {
1274
- this.flags = 0, this.timeoutId = void 0, this.ns = `.atomBind-${++vs}`, this.handleCompositionStart = () => {
1275
- this.flags |= T.Composing;
1384
+ class os {
1385
+ constructor(t, e, s) {
1386
+ this.flags = 0, this.timeoutId = void 0, this.handleCompositionStart = () => {
1387
+ this.flags |= O.Composing;
1276
1388
  }, this.handleCompositionEnd = () => {
1277
- this.flags &= ~T.Composing, this.handleInput();
1389
+ this.flags &= ~O.Composing, this.handleInput();
1278
1390
  }, this.handleFocus = () => {
1279
- this.flags |= T.Focused;
1391
+ this.flags |= O.Focused;
1280
1392
  }, this.handleBlur = () => {
1281
- this.flags &= ~T.Focused, this.timeoutId !== void 0 && (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom());
1282
- const r = this.options.format(this.atom.peek());
1283
- this.el.value !== r && (this.el.value = r);
1393
+ this.flags &= ~O.Focused;
1394
+ const c = !!(this.flags & O.Composing);
1395
+ this.flags &= ~O.Composing, this.flushPendingDebounce(), c && this.timeoutId === void 0 && this.syncAtomFromDom(), this.normalizeDomValue();
1284
1396
  }, this.syncDomFromAtom = () => {
1285
- const r = this.atom.value;
1286
- H(() => {
1287
- const o = this.options.format(r), l = this.el.value;
1288
- if (l === o) return;
1289
- const p = !!(this.flags & T.Focused);
1290
- if (p)
1397
+ const c = this.atom.value;
1398
+ P(() => {
1399
+ const a = this.format(c);
1400
+ let l;
1401
+ if (this.isMultipleSelect ? l = this.$el.val() || [] : l = this.el.value, this.equal(l, c)) return;
1402
+ const u = !!(this.flags & O.Focused);
1403
+ if (u)
1291
1404
  try {
1292
- if (this.options.equal(this.options.parse(l), r)) return;
1405
+ const _ = this.isMultipleSelect ? l : this.parse(this.el.value);
1406
+ if (this.equal(_, c)) return;
1293
1407
  } catch {
1294
1408
  }
1295
- this.flags |= T.SyncingToDom;
1409
+ this.flags |= O.SyncingToDom;
1296
1410
  try {
1297
- if (p && (this.el instanceof HTMLInputElement || this.el instanceof HTMLTextAreaElement)) {
1298
- const C = this.el.selectionStart, b = this.el.selectionEnd;
1299
- this.el.value = o;
1300
- const N = o.length;
1301
- C !== null && b !== null && this.el.setSelectionRange(Math.min(C, N), Math.min(b, N));
1302
- } else
1303
- this.el.value = o;
1304
- f.domUpdated(this.$el, "val", o);
1411
+ if (this.isMultipleSelect)
1412
+ this.$el.val(c);
1413
+ else if (u && (this.el instanceof HTMLInputElement || this.el instanceof HTMLTextAreaElement))
1414
+ try {
1415
+ const _ = this.el.selectionStart, y = this.el.selectionEnd;
1416
+ this.el.value = a;
1417
+ const p = a.length;
1418
+ _ !== null && y !== null && this.el.setSelectionRange(_ < p ? _ : p, y < p ? y : p);
1419
+ } catch {
1420
+ this.el.value = a;
1421
+ }
1422
+ else
1423
+ this.el.value = a;
1424
+ d.enabled && d.domUpdated(E.BINDING, this.$el, "val", a);
1305
1425
  } finally {
1306
- this.flags &= ~T.SyncingToDom;
1426
+ this.flags &= ~O.SyncingToDom;
1307
1427
  }
1308
1428
  });
1309
1429
  }, this.cleanup = () => {
1310
1430
  this.$el.off(this.ns), clearTimeout(this.timeoutId), this.timeoutId = void 0;
1311
- }, this.$el = t, this.el = t[0], this.atom = s;
1312
- const i = n.debounce ?? 0;
1313
- this.options = {
1314
- debounce: i,
1315
- event: n.event ?? Ye.EVENT,
1316
- parse: n.parse ?? ((r) => r),
1317
- format: n.format ?? ((r) => String(r ?? "")),
1318
- equal: n.equal ?? Object.is
1319
- }, i > 0 ? this.handleInput = () => {
1320
- this.flags & T.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), i));
1431
+ }, this.$el = t, this.el = t[0], this.atom = e, this.isMultipleSelect = this.el.tagName === "SELECT" && this.el.multiple, this.ns = `.atomBind-${++is}`;
1432
+ const i = s.debounce ?? 0, o = s.event ?? Be.EVENT;
1433
+ this.parse = s.parse ?? ((c) => c), this.format = s.format ?? ((c) => this.isMultipleSelect ? (Array.isArray(c) ? c : c ? [String(c)] : []).join(",") : String(c ?? ""));
1434
+ const r = s.equal ?? Object.is;
1435
+ this.equal = (c, a) => r(c, a) ? !0 : Array.isArray(c) && Array.isArray(a) ? c.length === a.length && c.every((l, u) => Object.is(l, a[u])) : !1, i > 0 ? this.handleInput = () => {
1436
+ this.flags & O.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), i));
1321
1437
  } : this.handleInput = () => {
1322
- this.flags & T.Composing || this.syncAtomFromDom();
1323
- }, this.handleFocus[F] = !0, this.handleBlur[F] = !0, this.handleCompositionStart[F] = !0, this.handleCompositionEnd[F] = !0, this.handleInput[F] = !0, this.bindEvents();
1438
+ this.flags & O.Composing || this.syncAtomFromDom();
1439
+ }, nt(this.handleFocus), nt(this.handleBlur), nt(this.handleCompositionStart), nt(this.handleCompositionEnd), nt(this.handleInput), this.bindEvents(o);
1440
+ }
1441
+ // --- Blur helpers ---
1442
+ /**
1443
+ * Flushes any pending debounce timer immediately.
1444
+ * Called on blur so that a value the user finished typing is not lost
1445
+ * when focus moves away before the debounce delay expires.
1446
+ */
1447
+ flushPendingDebounce() {
1448
+ this.timeoutId !== void 0 && (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom());
1449
+ }
1450
+ /**
1451
+ * Re-formats the current atom value into the input element on blur.
1452
+ * Ensures the displayed text matches the canonical format (e.g. trims trailing
1453
+ * spaces, applies number formatting) after the user finishes editing.
1454
+ */
1455
+ normalizeDomValue() {
1456
+ const t = this.format(this.atom.peek());
1457
+ if (this.isMultipleSelect) {
1458
+ const e = this.$el.val() || [], s = Array.isArray(this.atom.peek()) ? this.atom.peek() : [];
1459
+ this.equal(e, s) || this.$el.val(s);
1460
+ } else this.el.value !== t && (this.el.value = t);
1324
1461
  }
1325
1462
  // --- Sync Logic ---
1326
1463
  syncAtomFromDom() {
1327
- if (!(this.flags & T.Busy)) {
1328
- this.flags |= T.SyncingToAtom;
1464
+ if (!(this.flags & O.Busy)) {
1465
+ this.flags |= O.SyncingToAtom;
1329
1466
  try {
1330
- const t = this.options.parse(this.el.value);
1331
- this.options.equal(this.atom.peek(), t) || (this.atom.value = t);
1467
+ let t;
1468
+ this.isMultipleSelect ? t = this.$el.val() || [] : t = this.el.value;
1469
+ const e = this.parse(t);
1470
+ this.equal(this.atom.peek(), e) || (this.atom.value = e);
1332
1471
  } catch (t) {
1333
- f.warn(d.BINDING, `${S.PARSE_ERROR()}:`, t);
1472
+ d.warn(
1473
+ E.BINDING,
1474
+ S.BINDING.PARSE_ERROR(t instanceof Error ? t.message : String(t)),
1475
+ t
1476
+ );
1334
1477
  } finally {
1335
- this.flags &= ~T.SyncingToAtom;
1478
+ this.flags &= ~O.SyncingToAtom;
1336
1479
  }
1337
1480
  }
1338
1481
  }
1339
- bindEvents() {
1340
- this.$el.on(`focus${this.ns}`, this.handleFocus).on(`blur${this.ns}`, this.handleBlur).on(`compositionstart${this.ns}`, this.handleCompositionStart).on(`compositionend${this.ns}`, this.handleCompositionEnd).on(`${this.options.event}${this.ns}`, this.handleInput);
1482
+ bindEvents(t) {
1483
+ const e = this.ns, s = t.trim().split(/\s+/).map((i) => `${i}${e}`).join(" ");
1484
+ this.$el.on(`focus${e}`, this.handleFocus).on(`blur${e}`, this.handleBlur).on(`compositionstart${e}`, this.handleCompositionStart).on(`compositionend${e}`, this.handleCompositionEnd).on(s, this.handleInput);
1341
1485
  }
1342
1486
  }
1343
- function As(e, t, s) {
1344
- const n = new Ds(e, t, s);
1345
- return { fx: X(n.syncDomFromAtom), cleanup: n.cleanup };
1487
+ function rs(n, t, e) {
1488
+ const s = new os(n, t, e);
1489
+ return { fx: V(s.syncDomFromAtom), cleanup: s.cleanup };
1346
1490
  }
1347
- const he = /* @__PURE__ */ new Map();
1348
- function Us(e) {
1349
- let t = he.get(e);
1350
- return t !== void 0 || (t = e.includes("-") ? e.replace(/-./g, (s) => s[1].toUpperCase()) : e, he.set(e, t)), t;
1491
+ const cs = /* @__PURE__ */ new Set([
1492
+ "href",
1493
+ "src",
1494
+ "action",
1495
+ "formaction",
1496
+ "xlink:href",
1497
+ "data",
1498
+ "poster",
1499
+ "background",
1500
+ "cite",
1501
+ "longdesc",
1502
+ "profile",
1503
+ "usemap",
1504
+ "classid",
1505
+ "codebase"
1506
+ ]), as = /^\s*(?:javascript|vbscript)\s*:/i, ls = (
1507
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: Intentionally matching control characters for XSS sanitization
1508
+ /(?:expression\s*\(|behavior\s*:|-moz-binding\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i
1509
+ ), hs = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, us = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, fs = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, ds = {
1510
+ colon: ":",
1511
+ Tab: " ",
1512
+ NewLine: `
1513
+ `
1514
+ }, _s = /&(colon|Tab|NewLine);/g, ps = /<\?[\s\S]*?\?>/g, Es = /(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi, ms = /(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi, gs = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, Is = /\bon\w+\s*=/gim, ys = new RegExp(ls.source, "gim");
1515
+ function pt(n) {
1516
+ let t = String(n ?? "");
1517
+ t = t.replace(us, ""), t = t.replace(
1518
+ fs,
1519
+ (s, i, o) => String.fromCodePoint(i ? parseInt(i, 16) : parseInt(o, 10))
1520
+ ), t = t.replace(_s, (s, i) => ds[i] ?? ""), t = t.replace(ps, "");
1521
+ let e;
1522
+ do
1523
+ e = t, t = t.replace(Es, "");
1524
+ while (t !== e);
1525
+ return t = t.replace(ms, "data-unsafe-protocol:"), t = t.replace(gs, "data-unsafe-protocol:"), t = t.replace(Is, "data-unsafe-attr="), t = t.replace(ys, "data-unsafe-css:"), t;
1526
+ }
1527
+ function ae(n, t) {
1528
+ return cs.has(n.toLowerCase()) ? as.test(t) : !1;
1529
+ }
1530
+ function Cs(n) {
1531
+ return n.toLowerCase().includes("url(") ? hs.test(n) : !1;
1351
1532
  }
1352
- const ue = /* @__PURE__ */ new WeakMap();
1353
- function Ls(e) {
1354
- let t = ue.get(e);
1355
- return t || (t = Ct(() => Bt(e.value)), ue.set(e, t)), t;
1533
+ const qt = /* @__PURE__ */ new Map();
1534
+ function Ts(n) {
1535
+ let t = qt.get(n);
1536
+ return t !== void 0 || (t = n.includes("-") ? n.replace(/-./g, (e) => e[1].toUpperCase()) : n, qt.set(n, t)), t;
1356
1537
  }
1357
- function D(e) {
1538
+ const Xt = /* @__PURE__ */ new WeakMap();
1539
+ function Ss(n) {
1540
+ let t = Xt.get(n);
1541
+ return t || (t = gt(() => pt(n.value)), Xt.set(n, t)), t;
1542
+ }
1543
+ function A(n) {
1358
1544
  return {
1359
- $el: c(e),
1360
- el: e,
1361
- trackCleanup: (t) => g.trackCleanup(e, t)
1545
+ $el: h(n),
1546
+ el: n,
1547
+ trackCleanup: (t) => R.trackCleanup(n, t)
1362
1548
  };
1363
1549
  }
1364
- function Te(e, t, s) {
1365
- const n = e.el;
1366
- Q(
1367
- n,
1550
+ function le(n, t, e) {
1551
+ const s = n.el;
1552
+ B(
1553
+ s,
1368
1554
  t,
1369
1555
  (i) => {
1370
- const r = s ? s(i) : typeof i == "string" ? i : String(i ?? "");
1371
- n.textContent !== r && (n.textContent = r);
1556
+ const o = e ? e(i) : typeof i == "string" ? i : String(i ?? "");
1557
+ s.textContent !== o && (s.textContent = o);
1372
1558
  },
1373
1559
  "text"
1374
1560
  );
1375
1561
  }
1376
- function Oe(e, t) {
1377
- const s = e.el, n = qt(t) ? Ls(t) : t;
1378
- Q(
1562
+ function he(n, t) {
1563
+ const e = n.el, s = wt(t) ? Ss(t) : t;
1564
+ B(
1565
+ e,
1379
1566
  s,
1380
- n,
1381
1567
  (i) => {
1382
- s.innerHTML !== i && (g.cleanupDescendants(s), s.innerHTML = i);
1568
+ e.innerHTML !== i && (R.cleanupDescendants(e), e.innerHTML = i);
1383
1569
  },
1384
1570
  "html"
1385
1571
  );
1386
1572
  }
1387
- function Ne(e, t) {
1388
- Object.entries(t).forEach(([s, n]) => {
1389
- Q(
1390
- e.el,
1391
- n,
1392
- (i) => {
1393
- e.el.classList.toggle(s, !!i);
1394
- },
1395
- `class.${s}`
1396
- );
1397
- });
1573
+ function ue(n, t) {
1574
+ for (const e in t)
1575
+ if (Z.call(t, e)) {
1576
+ const s = t[e], i = e.trim().split(/\s+/).filter(Boolean);
1577
+ i.length > 1 ? B(
1578
+ n.el,
1579
+ s,
1580
+ (o) => {
1581
+ o ? n.el.classList.add(...i) : n.el.classList.remove(...i);
1582
+ },
1583
+ `class.${e}`
1584
+ ) : i.length === 1 && B(
1585
+ n.el,
1586
+ s,
1587
+ (o) => {
1588
+ n.el.classList.toggle(i[0], !!o);
1589
+ },
1590
+ `class.${e}`
1591
+ );
1592
+ }
1398
1593
  }
1399
- function ve(e, t) {
1400
- const s = e.el, n = s.style;
1401
- Object.entries(t).forEach(([i, r]) => {
1402
- const o = Us(i), [l, p] = Array.isArray(r) ? r : [r, ""];
1403
- Q(
1404
- s,
1405
- l,
1406
- (C) => {
1407
- const b = p ? `${C}${p}` : String(C);
1408
- fs(b) || (n[o] = b);
1409
- },
1410
- `css.${i}`
1411
- );
1412
- });
1594
+ function fe(n, t) {
1595
+ const e = n.el, s = e.style;
1596
+ for (const i in t)
1597
+ if (Z.call(t, i)) {
1598
+ const o = t[i], r = Ts(i), [c, a] = Array.isArray(o) ? o : [o, ""];
1599
+ B(
1600
+ e,
1601
+ c,
1602
+ (l) => {
1603
+ const u = a ? String(l) + a : String(l);
1604
+ Cs(u) || (s[r] = u);
1605
+ },
1606
+ `css.${i}`
1607
+ );
1608
+ }
1413
1609
  }
1414
- function De(e, t) {
1415
- const s = e.el;
1416
- Object.keys(t).forEach((n) => {
1417
- n.toLowerCase().startsWith("on") || Q(
1418
- s,
1419
- t[n],
1420
- (i) => {
1421
- if (i == null || i === !1) {
1422
- s.removeAttribute(n);
1423
- return;
1424
- }
1425
- const r = i === !0 ? n : String(i);
1426
- ls(n, r) || s.getAttribute(n) !== r && s.setAttribute(n, r);
1427
- },
1428
- `attr.${n}`
1429
- );
1430
- });
1610
+ function de(n, t) {
1611
+ const e = n.el;
1612
+ for (const s in t)
1613
+ if (Z.call(t, s)) {
1614
+ const i = s.toLowerCase();
1615
+ if (i.startsWith("on")) {
1616
+ console.warn(
1617
+ `${E.BINDING} ${S.SECURITY.BLOCKED_EVENT_HANDLER(s)}`
1618
+ );
1619
+ continue;
1620
+ }
1621
+ const o = i.startsWith("aria-");
1622
+ B(
1623
+ e,
1624
+ t[s],
1625
+ (r) => {
1626
+ if (r == null) {
1627
+ e.removeAttribute(s);
1628
+ return;
1629
+ }
1630
+ if (r === !1 && !o) {
1631
+ e.removeAttribute(s);
1632
+ return;
1633
+ }
1634
+ const c = r === !0 ? o ? "true" : s : String(r);
1635
+ if (ae(s, c)) {
1636
+ console.warn(
1637
+ `${E.BINDING} ${S.SECURITY.BLOCKED_PROTOCOL(s)}`
1638
+ );
1639
+ return;
1640
+ }
1641
+ e.getAttribute(s) !== c && e.setAttribute(s, c);
1642
+ },
1643
+ `attr.${s}`
1644
+ );
1645
+ }
1431
1646
  }
1432
- function Ae(e, t) {
1433
- const s = e.el;
1434
- Object.keys(t).forEach((n) => {
1435
- Je.has(n) || Q(
1436
- e.el,
1437
- t[n],
1438
- (i) => {
1439
- s[n] !== i && (s[n] = i);
1440
- },
1441
- `prop.${n}`
1442
- );
1443
- });
1647
+ function _e(n, t) {
1648
+ const e = n.el;
1649
+ for (const s in t)
1650
+ if (Z.call(t, s)) {
1651
+ const i = s.toLowerCase();
1652
+ if (i.startsWith("on")) {
1653
+ console.warn(
1654
+ `${E.BINDING} ${S.SECURITY.BLOCKED_EVENT_HANDLER(s)}`
1655
+ );
1656
+ continue;
1657
+ }
1658
+ if (je.has(s)) {
1659
+ console.warn(`${E.BINDING} ${S.SECURITY.BLOCKED_PROP(s)}`);
1660
+ continue;
1661
+ }
1662
+ const o = He.has(i);
1663
+ B(
1664
+ n.el,
1665
+ t[s],
1666
+ (r) => {
1667
+ if (o && typeof r == "string" && ae(s, r)) {
1668
+ console.warn(
1669
+ `${E.BINDING} ${S.SECURITY.BLOCKED_PROTOCOL(s)}`
1670
+ );
1671
+ return;
1672
+ }
1673
+ e[s] !== r && (e[s] = r);
1674
+ },
1675
+ `prop.${s}`
1676
+ );
1677
+ }
1444
1678
  }
1445
- function gt(e, t, s) {
1446
- const n = e.el;
1447
- Q(
1448
- n,
1679
+ function Et(n, t, e) {
1680
+ const s = n.el, i = e ? "hide" : "show", o = s.style.display, r = o === "none" ? "" : o;
1681
+ B(
1682
+ s,
1449
1683
  t,
1450
- (r) => {
1451
- const o = s !== !!r;
1452
- n.style.display = o ? "" : "none";
1684
+ (c) => {
1685
+ s.style.display = e !== !!c ? r : "none";
1453
1686
  },
1454
- s ? "hide" : "show"
1687
+ i
1455
1688
  );
1456
1689
  }
1457
- function Gt(e, t, s = {}) {
1458
- const n = e.el.tagName.toLowerCase();
1459
- if (!We.has(n)) {
1460
- console.warn(`${d.BINDING} ${S.INVALID_INPUT_ELEMENT(n)}`);
1690
+ function pe(n, t, e = {}) {
1691
+ const s = n.el.tagName.toLowerCase();
1692
+ if (!Ge.has(s)) {
1693
+ console.warn(
1694
+ `${E.BINDING} ${S.BINDING.INVALID_INPUT_ELEMENT(s)}`
1695
+ );
1461
1696
  return;
1462
1697
  }
1463
- const { fx: i, cleanup: r } = As(e.$el, t, s);
1464
- g.trackEffect(e.el, i), e.trackCleanup(r);
1698
+ const { fx: i, cleanup: o } = rs(n.$el, t, e);
1699
+ R.trackEffect(n.el, i), n.trackCleanup(o);
1465
1700
  }
1466
- function Ue(e, t) {
1467
- const s = e.el, n = e.$el, i = () => {
1468
- const o = s.checked;
1469
- t.value !== o && (t.value = o);
1701
+ function Ee(n, t) {
1702
+ const e = n.el, s = n.$el, i = e.type === "radio", o = () => {
1703
+ const c = e.checked;
1704
+ if (t.value !== c && (t.value = c, i && c && e.name)) {
1705
+ const a = e.name.replace(/"/g, '\\"');
1706
+ (e.form ? h(e.form) : h(document)).find(`input[type="radio"][name="${a}"]`).not(e).trigger("change.atomRadioSync");
1707
+ }
1470
1708
  };
1471
- i[F] = !0, n.on("change", i), e.trackCleanup(() => n.off("change", i));
1472
- const r = X(() => {
1473
- const o = !!t.value;
1474
- H(() => {
1475
- s.checked !== o && (s.checked = o, f.domUpdated(n, "checked", o));
1709
+ o[dt] = !0, s.on("change change.atomRadioSync", o), n.trackCleanup(() => s.off("change change.atomRadioSync", o));
1710
+ const r = V(() => {
1711
+ const c = !!t.value;
1712
+ P(() => {
1713
+ e.checked !== c && (e.checked = c, d.enabled && d.domUpdated(E.BINDING, s, "checked", c));
1476
1714
  });
1477
1715
  });
1478
- g.trackEffect(s, r);
1716
+ R.trackEffect(e, r);
1479
1717
  }
1480
- function ws(e, t) {
1481
- const s = e.$el;
1482
- s.on(t), e.trackCleanup(() => s.off(t));
1718
+ function Ns(n, t) {
1719
+ const e = n.$el;
1720
+ e.on(t), n.trackCleanup(() => e.off(t));
1483
1721
  }
1484
- function ks(e, t, s) {
1485
- const n = e.$el;
1486
- n.on(t, s), e.trackCleanup(() => n.off(t, s));
1722
+ function bs(n, t, e) {
1723
+ const s = n.$el;
1724
+ s.on(t, e), n.trackCleanup(() => s.off(t, e));
1487
1725
  }
1488
- function Le(e) {
1489
- g.cleanupTree(e);
1726
+ function me(n) {
1727
+ R.cleanupTree(n);
1490
1728
  }
1491
- c.fn.atomText = function(e, t) {
1492
- return this.each(function() {
1493
- Te(D(this), e, t);
1494
- });
1729
+ function k(n) {
1730
+ d.enabled && d.log(E.BINDING, `Skipping non-Element node (nodeType=${n})`);
1731
+ }
1732
+ h.fn.atomText = function(n, t) {
1733
+ for (let e = 0, s = this.length; e < s; e++) {
1734
+ const i = this[e];
1735
+ i.nodeType === 1 ? le(A(i), n, t) : k(i.nodeType);
1736
+ }
1737
+ return this;
1495
1738
  };
1496
- c.fn.atomHtml = function(e) {
1497
- return this.each(function() {
1498
- Oe(D(this), e);
1499
- });
1739
+ h.fn.atomHtml = function(n) {
1740
+ for (let t = 0, e = this.length; t < e; t++) {
1741
+ const s = this[t];
1742
+ s.nodeType === 1 ? he(A(s), n) : k(s.nodeType);
1743
+ }
1744
+ return this;
1500
1745
  };
1501
- c.fn.atomClass = function(e, t) {
1502
- if (typeof e == "string" && t === void 0)
1503
- return console.warn(`${d.BINDING} ${S.MISSING_CONDITION("atomClass")}`), this;
1504
- const s = typeof e == "string" ? { [e]: t } : e;
1505
- return this.each(function() {
1506
- Ne(D(this), s);
1507
- });
1746
+ h.fn.atomClass = function(n, t) {
1747
+ if (typeof n == "string" && t === void 0)
1748
+ return console.warn(
1749
+ `${E.BINDING} ${S.BINDING.MISSING_CONDITION("atomClass")}`
1750
+ ), this;
1751
+ const e = typeof n == "string" ? { [n]: t } : n;
1752
+ for (let s = 0, i = this.length; s < i; s++) {
1753
+ const o = this[s];
1754
+ o.nodeType === 1 ? ue(A(o), e) : k(o.nodeType);
1755
+ }
1756
+ return this;
1508
1757
  };
1509
- c.fn.atomCss = function(e, t, s) {
1510
- if (typeof e == "string" && t === void 0)
1511
- return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomCss")}`), this;
1512
- const n = typeof e == "string" ? { [e]: s ? [t, s] : t } : e;
1513
- return this.each(function() {
1514
- ve(D(this), n);
1515
- });
1758
+ h.fn.atomCss = function(n, t, e) {
1759
+ if (typeof n == "string" && t === void 0)
1760
+ return console.warn(`${E.BINDING} ${S.BINDING.MISSING_SOURCE("atomCss")}`), this;
1761
+ const s = typeof n == "string" ? { [n]: e ? [t, e] : t } : n;
1762
+ for (let i = 0, o = this.length; i < o; i++) {
1763
+ const r = this[i];
1764
+ r.nodeType === 1 ? fe(A(r), s) : k(r.nodeType);
1765
+ }
1766
+ return this;
1516
1767
  };
1517
- c.fn.atomAttr = function(e, t) {
1518
- if (typeof e == "string" && t === void 0)
1519
- return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomAttr")}`), this;
1520
- const s = typeof e == "string" ? { [e]: t } : e;
1521
- return this.each(function() {
1522
- De(D(this), s);
1523
- });
1768
+ h.fn.atomAttr = function(n, t) {
1769
+ if (typeof n == "string" && t === void 0)
1770
+ return console.warn(`${E.BINDING} ${S.BINDING.MISSING_SOURCE("atomAttr")}`), this;
1771
+ const e = typeof n == "string" ? { [n]: t } : n;
1772
+ for (let s = 0, i = this.length; s < i; s++) {
1773
+ const o = this[s];
1774
+ o.nodeType === 1 ? de(A(o), e) : k(o.nodeType);
1775
+ }
1776
+ return this;
1524
1777
  };
1525
- c.fn.atomProp = function(e, t) {
1526
- if (typeof e == "string" && t === void 0)
1527
- return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomProp")}`), this;
1528
- const s = typeof e == "string" ? { [e]: t } : e;
1529
- return this.each(function() {
1530
- Ae(D(this), s);
1531
- });
1778
+ h.fn.atomProp = function(n, t) {
1779
+ if (typeof n == "string" && t === void 0)
1780
+ return console.warn(`${E.BINDING} ${S.BINDING.MISSING_SOURCE("atomProp")}`), this;
1781
+ const e = typeof n == "string" ? { [n]: t } : n;
1782
+ for (let s = 0, i = this.length; s < i; s++) {
1783
+ const o = this[s];
1784
+ o.nodeType === 1 ? _e(A(o), e) : k(o.nodeType);
1785
+ }
1786
+ return this;
1532
1787
  };
1533
- c.fn.atomShow = function(e) {
1534
- return this.each(function() {
1535
- gt(D(this), e, !1);
1536
- });
1788
+ h.fn.atomShow = function(n) {
1789
+ for (let t = 0, e = this.length; t < e; t++) {
1790
+ const s = this[t];
1791
+ s.nodeType === 1 ? Et(A(s), n, !1) : k(s.nodeType);
1792
+ }
1793
+ return this;
1537
1794
  };
1538
- c.fn.atomHide = function(e) {
1539
- return this.each(function() {
1540
- gt(D(this), e, !0);
1541
- });
1795
+ h.fn.atomHide = function(n) {
1796
+ for (let t = 0, e = this.length; t < e; t++) {
1797
+ const s = this[t];
1798
+ s.nodeType === 1 ? Et(A(s), n, !0) : k(s.nodeType);
1799
+ }
1800
+ return this;
1542
1801
  };
1543
- c.fn.atomVal = function(e, t = {}) {
1544
- return this.each(function() {
1545
- Gt(D(this), e, t);
1546
- });
1802
+ h.fn.atomVal = function(n, t = {}) {
1803
+ for (let e = 0, s = this.length; e < s; e++) {
1804
+ const i = this[e];
1805
+ i.nodeType === 1 ? pe(
1806
+ A(i),
1807
+ n,
1808
+ t
1809
+ ) : k(i.nodeType);
1810
+ }
1811
+ return this;
1547
1812
  };
1548
- c.fn.atomChecked = function(e) {
1549
- return this.each(function() {
1550
- Ue(D(this), e);
1551
- });
1813
+ h.fn.atomChecked = function(n) {
1814
+ for (let t = 0, e = this.length; t < e; t++) {
1815
+ const s = this[t];
1816
+ s.nodeType === 1 ? Ee(A(s), n) : k(s.nodeType);
1817
+ }
1818
+ return this;
1552
1819
  };
1553
- c.fn.atomOn = function(e, t) {
1554
- return this.each(function() {
1555
- ks(D(this), e, t);
1556
- });
1820
+ h.fn.atomOn = function(n, t) {
1821
+ for (let e = 0, s = this.length; e < s; e++) {
1822
+ const i = this[e];
1823
+ i.nodeType === 1 ? bs(A(i), n, t) : k(i.nodeType);
1824
+ }
1825
+ return this;
1557
1826
  };
1558
- c.fn.atomBind = function(e) {
1559
- return this.each(function() {
1560
- const t = D(this);
1561
- if (e.text !== void 0 && Te(t, e.text), e.html !== void 0 && Oe(t, e.html), e.class !== void 0 && Ne(t, e.class), e.css !== void 0 && ve(t, e.css), e.attr !== void 0 && De(t, e.attr), e.prop !== void 0 && Ae(t, e.prop), e.show !== void 0 && gt(t, e.show, !1), e.hide !== void 0 && gt(t, e.hide, !0), e.val !== void 0)
1562
- if (Array.isArray(e.val)) {
1563
- const [s, n] = e.val;
1564
- Gt(t, s, n);
1565
- } else
1566
- Gt(t, e.val);
1567
- e.checked !== void 0 && Ue(t, e.checked), e.on !== void 0 && ws(t, e.on);
1568
- });
1827
+ h.fn.atomBind = function(n) {
1828
+ const { text: t, html: e, class: s, css: i, attr: o, prop: r, show: c, hide: a, val: l, checked: u, on: _ } = n, y = l === void 0 ? null : Array.isArray(l) ? {
1829
+ atom: l[0],
1830
+ opts: l[1]
1831
+ } : { atom: l, opts: void 0 };
1832
+ for (let p = 0, v = this.length; p < v; p++) {
1833
+ const C = this[p];
1834
+ if (C.nodeType !== 1) {
1835
+ k(C.nodeType);
1836
+ continue;
1837
+ }
1838
+ const T = A(C);
1839
+ t !== void 0 && le(T, t), e !== void 0 && he(T, e), s !== void 0 && ue(T, s), i !== void 0 && fe(T, i), o !== void 0 && de(T, o), r !== void 0 && _e(T, r), c !== void 0 && Et(T, c, !1), a !== void 0 && Et(T, a, !0), y !== null && pe(T, y.atom, y.opts), u !== void 0 && Ee(T, u), _ !== void 0 && Ns(T, _);
1840
+ }
1841
+ return this;
1569
1842
  };
1570
- c.fn.atomUnbind = function() {
1571
- return this.each(function() {
1572
- Le(this);
1573
- });
1843
+ h.fn.atomUnbind = function() {
1844
+ for (let n = 0, t = this.length; n < t; n++) {
1845
+ const e = this[n];
1846
+ e.nodeType === 1 ? me(e) : k(e.nodeType);
1847
+ }
1848
+ return this;
1574
1849
  };
1575
- function xs(e, t, s) {
1576
- t?.isConnected ? e.insertBefore(t) : e.appendTo(s);
1577
- }
1578
- c.fn.atomList = function(e, t) {
1579
- const { key: s, render: n, bind: i, update: r, onAdd: o, onRemove: l, empty: p } = t, C = typeof s == "function" ? s : (b, N) => b[s];
1580
- return this.each(function() {
1581
- const b = c(this), N = Xt(this), E = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
1582
- let P = [], U = null;
1583
- const G = (v, R) => {
1584
- const j = () => {
1585
- bt?.isDisposed || (R.$el.remove(), m.delete(v), f.log("list", `${N} removed item:`, v));
1586
- };
1587
- if (l) {
1588
- const M = l(R.$el);
1589
- M instanceof Promise ? M.then(j, j) : j();
1590
- } else
1591
- j();
1592
- }, Qt = (v, R) => {
1593
- E.delete(v), m.add(v), G(v, R);
1850
+ const Rt = /* @__PURE__ */ new WeakMap();
1851
+ let Rs = 0;
1852
+ function vs(n, t, e) {
1853
+ t?.isConnected ? n.insertBefore(t) : n.appendTo(e);
1854
+ }
1855
+ function Ds(n, t, e, s, i, o) {
1856
+ t.$el[0] && (n === void 0 ? o && o(t.$el, e, s) : i && i(t.$el, e, s));
1857
+ }
1858
+ class Os {
1859
+ constructor(t, e, s) {
1860
+ this.$container = t, this.containerSelector = e, this.onRemove = s, this.itemMap = /* @__PURE__ */ new Map(), this.removingKeys = /* @__PURE__ */ new Set(), this.oldKeys = [], this.$emptyEl = null, this.elToKey = /* @__PURE__ */ new WeakMap(), this.keyToIndex = /* @__PURE__ */ new Map();
1861
+ }
1862
+ scheduleRemoval(t, e) {
1863
+ const s = () => {
1864
+ this.fx?.isDisposed || (e.$el.remove(), this.removingKeys.delete(t), d.log(E.LIST, `${this.containerSelector} removed item:`, t));
1594
1865
  };
1595
- let bt;
1596
- bt = X(() => {
1597
- const v = e.value, R = v.length;
1598
- H(() => {
1599
- if (U && R > 0 && (U.remove(), U = null), R === 0) {
1600
- if (p && !U) {
1601
- const a = typeof p == "string" ? Bt(p) : p;
1602
- U = c(a).appendTo(b);
1603
- }
1604
- E.forEach((a, h) => {
1605
- m.has(h) || Qt(h, a);
1606
- }), P = [];
1607
- return;
1608
- }
1609
- f.log("list", `${N} updating with ${R} items`);
1610
- const j = /* @__PURE__ */ new Map();
1611
- for (let a = 0; a < P.length; a++)
1612
- j.set(P[a], a);
1613
- const M = new Array(R), St = /* @__PURE__ */ new Set(), ot = new Int32Array(R), ct = [], Rt = [], Tt = [];
1614
- for (let a = 0; a < R; a++) {
1615
- const h = v[a], _ = C(h, a);
1616
- if (M[a] = _, St.has(_)) {
1617
- f.warn(d.LIST, S.DUPLICATE_KEY(_, a)), ot[a] = -1;
1618
- continue;
1619
- }
1620
- St.add(_);
1621
- const I = E.get(_);
1622
- if (I) {
1623
- const u = I.item;
1624
- !r && u !== h && !ds(u, h) && (ct.push(_), Rt.push(h), Tt.push(a)), ot[a] = m.has(_) ? -1 : j.get(_) ?? -1;
1625
- } else
1626
- ct.push(_), Rt.push(h), Tt.push(a), ot[a] = -1;
1627
- }
1628
- const Kt = "<!--sep-->", at = ct.length, Yt = new Array(
1629
- at
1630
- ), Ot = [];
1631
- for (let a = 0; a < at; a++) {
1632
- const h = n(Rt[a], Tt[a]);
1633
- Yt[a] = h, typeof h == "string" && Ot.push(h);
1634
- }
1635
- let ht = null;
1636
- if (Ot.length > 0) {
1637
- const a = Ot.join(Kt);
1638
- ht = Bt(a).split(Kt);
1639
- }
1640
- let Wt = 0;
1641
- for (let a = 0; a < at; a++) {
1642
- const h = Yt[a], _ = typeof h == "string" ? c(ht[Wt++]) : c(h), I = ct[a], u = E.get(I);
1643
- if (u) {
1644
- const A = u.$el[0];
1645
- A && g.cleanupTree(A), u.$el.replaceWith(_), u.$el = _, u.state = "replaced";
1646
- } else
1647
- E.set(I, { $el: _, item: null, state: "new" });
1648
- }
1649
- for (const [a, h] of E)
1650
- !St.has(a) && !m.has(a) && Qt(a, h);
1651
- const Jt = _s(ot);
1652
- let Nt = Jt.length - 1, Zt = null;
1653
- const vt = P.length === 0;
1654
- if (vt && ht !== null && Wt === at && !i && !o && !l && m.size === 0) {
1655
- this.innerHTML = ht.join("");
1656
- let a = 0;
1657
- for (let h = 0; h < R; h++) {
1658
- const _ = M[h], I = v[h], u = E.get(_);
1659
- if (!u) continue;
1660
- const A = this.children[a++];
1661
- A && (u.$el = c(A), u.item = I, u.state = void 0, m.delete(_), f.domUpdated(u.$el, "list.add", I));
1662
- }
1663
- } else {
1664
- const a = vt ? document.createDocumentFragment() : null;
1665
- if (vt && a) {
1666
- for (let h = R - 1; h >= 0; h--) {
1667
- const _ = M[h], I = v[h], u = E.get(_);
1668
- if (!u) continue;
1669
- const A = u.state, x = A === "new", et = A === "replaced";
1670
- u.item = I, u.state = void 0, u.$el[0] && (!x && !et && r ? r(u.$el, I, h) : (x || et) && i && i(u.$el, I, h));
1671
- for (let Dt = u.$el.length - 1; Dt >= 0; Dt--)
1672
- a.insertBefore(u.$el[Dt], a.firstChild);
1673
- o && x && o(u.$el), x && (m.delete(_), f.domUpdated(u.$el, "list.add", I));
1674
- }
1675
- this.appendChild(a);
1676
- } else
1677
- for (let h = R - 1; h >= 0; h--) {
1678
- const _ = M[h], I = v[h], u = E.get(_);
1679
- if (!u) continue;
1680
- const A = u.state, x = A === "new", et = A === "replaced";
1681
- u.item = I, u.state = void 0, u.$el[0] && (!x && !et && r ? r(u.$el, I, h) : (x || et) && i && i(u.$el, I, h)), Nt >= 0 && Jt[Nt] === h ? Nt-- : xs(u.$el, Zt, b), o && x && o(u.$el), Zt = u.$el[0] ?? null, x && (m.delete(_), f.domUpdated(u.$el, "list.add", I));
1682
- }
1683
- }
1684
- P = M;
1866
+ if (!this.onRemove) {
1867
+ s();
1868
+ return;
1869
+ }
1870
+ const i = this.onRemove(e.$el);
1871
+ i instanceof Promise ? i.then(s, s) : s();
1872
+ }
1873
+ removeItem(t, e) {
1874
+ for (let s = 0; s < e.$el.length; s++) {
1875
+ const i = e.$el[s];
1876
+ i && this.elToKey.delete(i);
1877
+ }
1878
+ this.itemMap.delete(t), this.removingKeys.add(t), this.scheduleRemoval(t, e);
1879
+ }
1880
+ dispose() {
1881
+ this.itemMap.clear(), this.removingKeys.clear(), this.oldKeys.length = 0, this.keyToIndex.clear(), this.$emptyEl?.remove(), this.$container.off(".atomList");
1882
+ }
1883
+ }
1884
+ function Ls(n, t, e, s) {
1885
+ if (n.$emptyEl && t > 0 && (n.$emptyEl.remove(), n.$emptyEl = null), t !== 0) return;
1886
+ if (s && !n.$emptyEl) {
1887
+ const r = typeof s == "string" ? pt(s) : s;
1888
+ n.$emptyEl = h(r).appendTo(e);
1889
+ }
1890
+ const { oldKeys: i, itemMap: o } = n;
1891
+ for (let r = 0, c = i.length; r < c; r++) {
1892
+ const a = i[r], l = o.get(a);
1893
+ l && n.removeItem(a, l);
1894
+ }
1895
+ i.length = 0;
1896
+ }
1897
+ function ks(n, t, e, s, i) {
1898
+ const { oldKeys: o, itemMap: r, removingKeys: c } = n, a = /* @__PURE__ */ new Map();
1899
+ for (let C = 0, T = o.length; C < T; C++)
1900
+ a.set(o[C], C);
1901
+ const l = new Array(e), u = /* @__PURE__ */ new Set(), _ = new Int32Array(e), y = [], p = [], v = [];
1902
+ for (let C = 0; C < e; C++) {
1903
+ const T = t[C], f = s(T, C);
1904
+ if (l[C] = f, u.has(f)) {
1905
+ d.warn(E.LIST, S.LIST.DUPLICATE_KEY(f, C, n.containerSelector)), _[C] = -1;
1906
+ continue;
1907
+ }
1908
+ u.add(f);
1909
+ const I = r.get(f);
1910
+ if (!I) {
1911
+ y.push(f), p.push(T), v.push(C), _[C] = -1;
1912
+ continue;
1913
+ }
1914
+ const m = I.item;
1915
+ !i && m !== T && !Ve(m, T) && (y.push(f), p.push(T), v.push(C)), _[C] = c.has(f) ? -1 : a.get(f) ?? -1;
1916
+ }
1917
+ return { newKeys: l, newKeySet: u, newIndices: _, trKeys: y, trItems: p, trIdxs: v };
1918
+ }
1919
+ function As(n, t, e, s) {
1920
+ const { trKeys: i, trItems: o, trIdxs: r } = t, c = i.length, a = n.itemMap, l = e.render, u = new Array(c), _ = [];
1921
+ let y = 0;
1922
+ for (let f = 0; f < c; f++) {
1923
+ const I = l(o[f], r[f]);
1924
+ u[f] = I, typeof I == "string" && (_.push(I), y++);
1925
+ }
1926
+ let p = null;
1927
+ const v = _.length;
1928
+ if (v === 1)
1929
+ p = [pt(_[0])];
1930
+ else if (v > 1) {
1931
+ const I = `<template data-atom-sep="${(Rs++).toString(36)}"></template>`;
1932
+ p = pt(_.join(I)).split(I);
1933
+ }
1934
+ if (s && p !== null && y === c && !e.bind && !e.onAdd && !e.onRemove && !e.events)
1935
+ return p;
1936
+ let T = 0;
1937
+ for (let f = 0; f < c; f++) {
1938
+ const I = u[f], m = typeof I == "string" ? h(p[T++]) : h(I), N = i[f], g = a.get(N);
1939
+ if (!g) {
1940
+ a.set(N, { $el: m, item: null, state: "new" });
1941
+ continue;
1942
+ }
1943
+ const D = g.$el[0];
1944
+ D && R.cleanupTree(D), g.$el.replaceWith(m), g.$el = m, g.state = "replaced";
1945
+ }
1946
+ return null;
1947
+ }
1948
+ function Us(n, t) {
1949
+ const { oldKeys: e, itemMap: s } = n;
1950
+ for (let i = 0, o = e.length; i < o; i++) {
1951
+ const r = e[i];
1952
+ if (t.has(r)) continue;
1953
+ const c = s.get(r);
1954
+ c && n.removeItem(r, c);
1955
+ }
1956
+ }
1957
+ function ws(n, t, e, s, i, o, r) {
1958
+ const { bind: c, update: a, onAdd: l } = o, { newKeys: u, newIndices: _ } = e, y = t.length, p = n.oldKeys.length === 0, v = ze(_);
1959
+ let C = v.length - 1;
1960
+ const { itemMap: T, removingKeys: f } = n;
1961
+ if (r !== null) {
1962
+ s.innerHTML = r.join("");
1963
+ let I = 0;
1964
+ for (let m = 0; m < y; m++) {
1965
+ const N = u[m], g = t[m], D = s.children[I++];
1966
+ if (D) {
1967
+ const U = h(D);
1968
+ T.set(N, { $el: U, item: g, state: void 0 }), f.delete(N), d.enabled && d.domUpdated(E.LIST, U, "list.add", g);
1969
+ }
1970
+ }
1971
+ return;
1972
+ }
1973
+ if (p) {
1974
+ const I = document.createDocumentFragment();
1975
+ for (let m = y - 1; m >= 0; m--) {
1976
+ const N = u[m], g = T.get(N);
1977
+ if (!g) continue;
1978
+ const D = g.$el;
1979
+ for (let U = D.length - 1; U >= 0; U--)
1980
+ I.insertBefore(D[U], I.firstChild);
1981
+ }
1982
+ s.appendChild(I);
1983
+ } else {
1984
+ let I = null;
1985
+ for (let m = y - 1; m >= 0; m--) {
1986
+ const N = u[m], g = T.get(N);
1987
+ g && (C >= 0 && v[C] === m ? C-- : vs(g.$el, I, i), I = g.$el[0] ?? null);
1988
+ }
1989
+ }
1990
+ for (let I = 0; I < y; I++) {
1991
+ const m = u[I], N = t[I], g = T.get(m);
1992
+ if (!g) continue;
1993
+ const D = g.state;
1994
+ g.item = N, g.state = void 0, Ds(D, g, N, I, c, a), D === "new" && (l && l(g.$el), f.delete(m), d.enabled && d.domUpdated(E.LIST, g.$el, "list.add", N));
1995
+ }
1996
+ }
1997
+ function xs(n, t) {
1998
+ const { newKeys: e, newKeySet: s } = t, i = e.length, { oldKeys: o, itemMap: r, elToKey: c, keyToIndex: a } = n;
1999
+ for (let l = 0, u = o.length; l < u; l++) {
2000
+ const _ = o[l];
2001
+ s.has(_) || a.delete(_);
2002
+ }
2003
+ for (let l = 0; l < i; l++) {
2004
+ const u = e[l], _ = r.get(u);
2005
+ if (_) {
2006
+ for (let y = 0; y < _.$el.length; y++) {
2007
+ const p = _.$el[y];
2008
+ p && c.set(p, u);
2009
+ }
2010
+ a.set(u, l);
2011
+ }
2012
+ }
2013
+ }
2014
+ h.fn.atomList = function(n, t) {
2015
+ const { key: e, bind: s, update: i, onAdd: o, onRemove: r, empty: c, events: a } = t, l = typeof e == "function" ? e : (_, y) => _[e], u = { bind: s, update: i, onAdd: o, onRemove: r, events: a };
2016
+ for (let _ = 0, y = this.length; _ < y; _++) {
2017
+ const p = this[_], v = h(p);
2018
+ v.off(".atomList");
2019
+ const C = Rt.get(p);
2020
+ C && (C.fx.dispose(), C.ctx.dispose());
2021
+ const T = X(p), f = new Os(v, T, r), I = V(() => {
2022
+ const m = n.value, N = m.length;
2023
+ P(() => {
2024
+ if (Ls(f, N, v, c), N === 0) return;
2025
+ d.log(E.LIST, `${T} updating with ${N} items`);
2026
+ const g = ks(f, m, N, l, i), D = f.oldKeys.length === 0, U = As(f, g, t, D);
2027
+ Us(f, g.newKeySet), ws(f, m, g, p, v, u, U), a && xs(f, g), f.oldKeys = g.newKeys;
1685
2028
  });
1686
- }), g.trackEffect(this, bt), g.trackCleanup(this, () => {
1687
- E.clear(), m.clear(), P = [], U?.remove();
1688
2029
  });
1689
- });
2030
+ if (f.fx = I, a)
2031
+ for (const m in a) {
2032
+ if (!Z.call(a, m)) continue;
2033
+ const N = a[m], g = m.indexOf(" "), D = g === -1 ? m : m.slice(0, g), U = g === -1 ? null : m.slice(g + 1).trim(), ge = U || "> *", Ie = function(ye) {
2034
+ let J = this;
2035
+ for (; J && J !== p; ) {
2036
+ const It = f.elToKey.get(J);
2037
+ if (It !== void 0) {
2038
+ const xt = f.itemMap.get(It);
2039
+ xt && N.call(this, xt.item, f.keyToIndex.get(It) ?? -1, ye);
2040
+ return;
2041
+ }
2042
+ J = J.parentElement;
2043
+ }
2044
+ };
2045
+ v.on(`${D}.atomList`, ge, Ie);
2046
+ }
2047
+ R.trackEffect(p, I), Rt.set(p, { fx: I, ctx: f }), R.trackCleanup(p, () => {
2048
+ f.dispose(), Rt.delete(p);
2049
+ });
2050
+ }
2051
+ return this;
1690
2052
  };
1691
- const Ps = Object.freeze({});
1692
- c.fn.atomMount = function(e, t) {
1693
- const s = t ?? Ps;
1694
- return this.each(function() {
1695
- g.cleanupTree(this);
1696
- const n = c(this);
1697
- let i;
2053
+ const $s = Object.freeze({});
2054
+ h.fn.atomMount = function(n, t) {
2055
+ const e = t ?? $s;
2056
+ for (let s = 0, i = this.length; s < i; s++) {
2057
+ const o = this[s];
2058
+ if (!o) continue;
2059
+ R.cleanupTree(o);
2060
+ const r = h(o);
2061
+ let c;
1698
2062
  try {
1699
- i = H(() => e(n, s));
1700
- } catch (r) {
1701
- f.error(d.MOUNT, S.MOUNT_ERROR(), r);
1702
- return;
2063
+ c = P(() => n(r, e));
2064
+ } catch (a) {
2065
+ d.error(E.MOUNT, S.MOUNT.ERROR(n.name), a);
2066
+ continue;
1703
2067
  }
1704
- typeof i == "function" && g.setComponentCleanup(this, i);
1705
- });
2068
+ typeof c == "function" && R.setComponentCleanup(o, c);
2069
+ }
2070
+ return this;
1706
2071
  };
1707
- c.fn.atomUnmount = function() {
1708
- return this.each(function() {
1709
- Le(this);
1710
- });
2072
+ h.fn.atomUnmount = function() {
2073
+ for (let n = 0, t = this.length; n < t; n++) {
2074
+ const e = this[n];
2075
+ e && me(e);
2076
+ }
2077
+ return this;
1711
2078
  };
1712
- function le(e, t) {
2079
+ function Yt(n, t) {
1713
2080
  try {
1714
- return history.pushState(e, "", t), !0;
1715
- } catch (s) {
1716
- return f.warn(
1717
- d.ROUTE,
2081
+ return history.pushState(n, "", t), !0;
2082
+ } catch (e) {
2083
+ return d.warn(
2084
+ E.ROUTE,
1718
2085
  "PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.",
1719
- s
2086
+ e
1720
2087
  ), !1;
1721
2088
  }
1722
2089
  }
1723
- class Ms {
2090
+ class Ps {
1724
2091
  constructor(t) {
1725
2092
  this.isDestroyed = !1, this.previousRoute = "", this.cleanups = [], this.templateCache = /* @__PURE__ */ new Map(), this.config = {
1726
2093
  ...t,
1727
- mode: t.mode ?? dt.mode,
1728
- basePath: t.basePath ?? dt.basePath,
1729
- autoBindLinks: t.autoBindLinks ?? dt.autoBindLinks,
1730
- activeClass: t.activeClass ?? dt.activeClass
1731
- }, this.isHistoryMode = this.config.mode === "history", this.$target = c(this.config.target), this.normalizedBasePath = this.config.basePath?.replace(/\/$/, "") || "", this.previousUrl = this.isHistoryMode ? window.location.pathname + window.location.search : window.location.hash, this.currentRouteAtom = Ft(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = Ft(this.getQueryParams()), this.queryParams = Ct(() => this.queryParamsAtom.value), this.handleUrlChange = this.handleUrlChange.bind(this), this.destroy = this.destroy.bind(this), this.init();
2094
+ mode: t.mode ?? et.mode,
2095
+ basePath: t.basePath ?? et.basePath,
2096
+ autoBindLinks: t.autoBindLinks ?? et.autoBindLinks,
2097
+ activeClass: t.activeClass ?? et.activeClass
2098
+ }, this.isHistoryMode = this.config.mode === "history", this.$target = h(this.config.target), this.normalizedBasePath = this.config.basePath?.replace(/\/$/, "") || "", this.activeClass = this.config.activeClass ?? et.activeClass, this.previousUrl = this.isHistoryMode ? window.location.pathname + window.location.search : window.location.hash, this.currentRouteAtom = Dt(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = Dt(this.getQueryParams()), this.queryParams = gt(() => this.queryParamsAtom.value), this.handleUrlChange = this.handleUrlChange.bind(this), this.destroy = this.destroy.bind(this), this.init();
1732
2099
  }
1733
2100
  init() {
1734
2101
  const t = this.isHistoryMode ? "popstate" : "hashchange";
1735
2102
  window.addEventListener(t, this.handleUrlChange), this.cleanups.push(() => window.removeEventListener(t, this.handleUrlChange));
1736
- const s = X(() => {
1737
- const n = this.currentRouteAtom.value;
1738
- H(() => this.renderRoute(n));
2103
+ const e = V(() => {
2104
+ const s = this.currentRouteAtom.value;
2105
+ P(() => this.renderRoute(s));
1739
2106
  });
1740
- this.cleanups.push(() => s.dispose()), this.setupAutoBindLinks(), this.$target[0] && g.trackCleanup(this.$target[0], this.destroy);
2107
+ this.cleanups.push(() => e.dispose()), this.setupAutoBindLinks(), this.$target[0] && R.trackCleanup(this.$target[0], this.destroy);
1741
2108
  }
1742
2109
  // --- Mode-abstracted internal methods ---
1743
2110
  /**
@@ -1747,11 +2114,11 @@ class Ms {
1747
2114
  getRouteName() {
1748
2115
  const { default: t } = this.config;
1749
2116
  if (this.isHistoryMode) {
1750
- let r = window.location.pathname;
1751
- return this.normalizedBasePath && r.startsWith(this.normalizedBasePath) && (r = r.substring(this.normalizedBasePath.length)), r.charCodeAt(0) === 47 && (r = r.slice(1)), r || t;
2117
+ let o = window.location.pathname;
2118
+ return this.normalizedBasePath && o.startsWith(this.normalizedBasePath) && (o = o.substring(this.normalizedBasePath.length)), o.charCodeAt(0) === 47 && (o = o.slice(1)), o || t;
1752
2119
  }
1753
- const s = window.location.hash, n = s.indexOf("?");
1754
- return (n === -1 ? s.substring(1) : s.substring(1, n)) || t;
2120
+ const e = window.location.hash, s = e.indexOf("?");
2121
+ return (s === -1 ? e.substring(1) : e.substring(1, s)) || t;
1755
2122
  }
1756
2123
  /**
1757
2124
  * Parses query parameters from the current URL.
@@ -1760,24 +2127,30 @@ class Ms {
1760
2127
  * only (`{ a: '2' }`). This matches `URLSearchParams` → `Object.fromEntries`
1761
2128
  * behaviour. If multi-value keys are needed, access `queryParams` via
1762
2129
  * `new URLSearchParams(window.location.search).getAll('key')` directly.
2130
+ *
2131
+ * Malformed percent-encoding (e.g. `%FF%FE`) is handled silently by
2132
+ * `URLSearchParams` — it replaces undecodable sequences with the replacement
2133
+ * character (U+FFFD) and continues parsing. If malformed encoding is detected,
2134
+ * a warning is emitted via `debug.warn`, but the best-effort parsed result
2135
+ * is still returned.
1763
2136
  */
1764
2137
  getQueryParams() {
1765
2138
  let t;
1766
2139
  if (this.isHistoryMode) {
1767
2140
  if (t = window.location.search.substring(1), !t) return {};
1768
2141
  } else {
1769
- const i = window.location.hash, r = i.indexOf("?");
1770
- if (r === -1) return {};
1771
- t = i.substring(r + 1);
2142
+ const i = window.location.hash, o = i.indexOf("?");
2143
+ if (o === -1) return {};
2144
+ t = i.substring(o + 1);
1772
2145
  }
1773
- const s = new URLSearchParams(t), n = Object.fromEntries(s);
2146
+ const e = new URLSearchParams(t), s = Object.fromEntries(e);
1774
2147
  if (t.includes("%"))
1775
2148
  try {
1776
2149
  decodeURIComponent(t);
1777
2150
  } catch {
1778
- f.warn(d.ROUTE, S.MALFORMED_URI(t));
2151
+ d.warn(E.ROUTE, S.ROUTE.MALFORMED_URI(t));
1779
2152
  }
1780
- return n;
2153
+ return s;
1781
2154
  }
1782
2155
  /**
1783
2156
  * Updates the browser URL to reflect a new route and keeps `previousUrl`
@@ -1785,11 +2158,11 @@ class Ms {
1785
2158
  */
1786
2159
  setUrl(t) {
1787
2160
  if (this.isHistoryMode) {
1788
- const s = `${this.normalizedBasePath}/${t}`;
1789
- le(null, s), this.previousUrl = s;
2161
+ const e = `${this.normalizedBasePath}/${t}`;
2162
+ Yt(null, e), this.previousUrl = e;
1790
2163
  } else {
1791
- const s = `#${t}`;
1792
- window.location.hash = s, this.previousUrl = s;
2164
+ const e = `#${t}`;
2165
+ window.location.hash = e, this.previousUrl = e;
1793
2166
  }
1794
2167
  }
1795
2168
  /**
@@ -1798,7 +2171,7 @@ class Ms {
1798
2171
  * that occur with replaceState during popstate events.
1799
2172
  */
1800
2173
  restoreUrl() {
1801
- this.isHistoryMode ? le(null, this.previousUrl) : window.location.hash = this.previousUrl;
2174
+ this.isHistoryMode ? Yt(null, this.previousUrl) : window.location.hash = this.previousUrl;
1802
2175
  }
1803
2176
  /**
1804
2177
  * Returns the current full URL string for comparison purposes.
@@ -1811,9 +2184,9 @@ class Ms {
1811
2184
  * Resolves route configuration, falling back to notFound route if needed.
1812
2185
  */
1813
2186
  getRouteConfig(t) {
1814
- const { routes: s, notFound: n } = this.config;
1815
- let i = s[t];
1816
- return !i && n && (i = s[n]), i || (f.warn(d.ROUTE, S.ROUTE_NOT_FOUND(t)), null);
2187
+ const { routes: e, notFound: s } = this.config;
2188
+ let i = e[t];
2189
+ return !i && s && (i = e[s]), i || (d.warn(E.ROUTE, S.ROUTE.NOT_FOUND(t)), null);
1817
2190
  }
1818
2191
  /**
1819
2192
  * Appends cloned template content into the target container.
@@ -1821,15 +2194,15 @@ class Ms {
1821
2194
  * before invoking this method if a clean slate is needed.
1822
2195
  */
1823
2196
  renderTemplate(t) {
1824
- let s = this.templateCache.get(t);
1825
- if (!s) {
2197
+ let e = this.templateCache.get(t);
2198
+ if (!e) {
1826
2199
  const i = document.querySelector(t);
1827
2200
  if (!i || !(i instanceof HTMLTemplateElement))
1828
- return f.warn(d.ROUTE, S.TEMPLATE_NOT_FOUND(t)), !1;
1829
- s = i, this.templateCache.set(t, s);
2201
+ return d.warn(E.ROUTE, S.ROUTE.TEMPLATE_NOT_FOUND(t)), !1;
2202
+ e = i, this.templateCache.set(t, e);
1830
2203
  }
1831
- const n = s.content.cloneNode(!0);
1832
- return this.$target.append(n), !0;
2204
+ const s = e.content.cloneNode(!0);
2205
+ return this.$target.append(s), !0;
1833
2206
  }
1834
2207
  /**
1835
2208
  * Renders the specified route, including lifecycle hooks and content.
@@ -1840,27 +2213,33 @@ class Ms {
1840
2213
  * outgoing content are disposed before the nodes are removed — preventing
1841
2214
  * the MutationObserver auto-cleanup path from firing a redundant cleanup.
1842
2215
  *
1843
- * If `beforeTransition` throws, the render is aborted and the outgoing
1844
- * content remains in the DOM. This is intentional — a throwing hook signals
1845
- * that the transition should not proceed.
2216
+ * EXCEPTION BEHAVIOUR:
2217
+ * - `beforeTransition` throws render aborted, outgoing DOM intact,
2218
+ * `previousRoute` unchanged. Intentional: a throwing hook signals that
2219
+ * the transition should not proceed.
2220
+ * - `onEnter` throws → container is already empty (`$target.empty()` ran),
2221
+ * rendering is skipped, and `previousRoute` is NOT updated. The router
2222
+ * is left in an empty-container / stale-previousRoute state. This behavior
2223
+ * is by design to prevent unintended state changes if the `onEnter` hook fails.
2224
+ * If recovery is needed, the hook should catch its own errors internally.
1846
2225
  */
1847
2226
  renderRoute(t) {
1848
2227
  if (this.isDestroyed) return;
1849
- const s = this.$target[0];
1850
- if (!s) {
1851
- f.warn(d.ROUTE, S.TARGET_NOT_FOUND(this.config.target));
2228
+ const e = this.$target[0];
2229
+ if (!e) {
2230
+ d.warn(E.ROUTE, S.ROUTE.TARGET_NOT_FOUND(this.config.target));
1852
2231
  return;
1853
2232
  }
1854
- const n = this.getRouteConfig(t);
1855
- if (!n) return;
1856
- const i = this.getQueryParams(), r = this.previousRoute;
1857
- this.config.beforeTransition && this.config.beforeTransition(r, t), this.$target.empty();
1858
- let o = i;
1859
- if (n.onEnter) {
1860
- const l = n.onEnter(i);
1861
- l !== void 0 && (o = { ...i, ...l });
2233
+ const s = this.getRouteConfig(t);
2234
+ if (!s) return;
2235
+ const i = this.getQueryParams(), o = this.previousRoute;
2236
+ this.config.beforeTransition && this.config.beforeTransition(o, t), this.$target.empty();
2237
+ let r = i;
2238
+ if (s.onEnter) {
2239
+ const c = s.onEnter(i);
2240
+ c !== void 0 && (r = { ...i, ...c });
1862
2241
  }
1863
- n.render ? n.render(s, t, o) : n.template && this.renderTemplate(n.template) && n.onMount && n.onMount(this.$target.children()), this.config.afterTransition && this.config.afterTransition(r, t), this.previousRoute = t;
2242
+ s.render ? s.render(e, t, r) : s.template && this.renderTemplate(s.template) && s.onMount && s.onMount(this.$target.children()), this.config.afterTransition && this.config.afterTransition(o, t), this.previousRoute = t;
1864
2243
  }
1865
2244
  /**
1866
2245
  * Handles browser URL change events (hashchange or popstate).
@@ -1869,18 +2248,18 @@ class Ms {
1869
2248
  if (this.isDestroyed) return;
1870
2249
  const t = this.getCurrentUrl();
1871
2250
  if (t === this.previousUrl) return;
1872
- const s = this.getRouteName(), n = this.currentRouteAtom.peek(), i = this.getQueryParams();
1873
- if (n !== s) {
1874
- const r = this.config.routes[n];
1875
- if (r?.onLeave && r.onLeave() === !1) {
2251
+ const e = this.getRouteName(), s = this.currentRouteAtom.peek(), i = this.getQueryParams();
2252
+ if (s !== e) {
2253
+ const o = this.config.routes[s];
2254
+ if (o?.onLeave && o.onLeave() === !1) {
1876
2255
  this.restoreUrl();
1877
2256
  return;
1878
2257
  }
1879
- this.currentRouteAtom.value = s, this.queryParamsAtom.value = i;
2258
+ this.currentRouteAtom.value = e, this.queryParamsAtom.value = i;
1880
2259
  } else {
1881
2260
  this.queryParamsAtom.value = i;
1882
- const r = this.config.routes[n];
1883
- r?.onParamsChange ? r.onParamsChange(i) : this.renderRoute(s);
2261
+ const o = this.config.routes[s];
2262
+ o?.onParamsChange ? o.onParamsChange(i) : this.renderRoute(e);
1884
2263
  }
1885
2264
  this.previousUrl = t;
1886
2265
  }
@@ -1899,23 +2278,23 @@ class Ms {
1899
2278
  if (!this.config.autoBindLinks) return;
1900
2279
  const t = (i) => {
1901
2280
  i.preventDefault();
1902
- const r = i.currentTarget.dataset.route;
1903
- r != null && this.navigate(r);
2281
+ const o = i.currentTarget.dataset.route;
2282
+ o != null && this.navigate(o);
1904
2283
  };
1905
- c(document).on("click", "[data-route]", t), this.cleanups.push(() => {
1906
- c(document).off("click", "[data-route]", t);
2284
+ h(document).on("click", "[data-route]", t), this.cleanups.push(() => {
2285
+ h(document).off("click", "[data-route]", t);
1907
2286
  });
1908
- const { activeClass: s } = this.config, n = X(() => {
2287
+ const e = this.activeClass, s = V(() => {
1909
2288
  const i = this.currentRouteAtom.value;
1910
- H(() => {
1911
- const r = document.querySelectorAll("[data-route]");
1912
- for (const o of r) {
1913
- const l = o.dataset.route, p = i === l;
1914
- o.classList.toggle(s, p), p ? o.setAttribute("aria-current", "page") : o.removeAttribute("aria-current");
2289
+ P(() => {
2290
+ const o = document.querySelectorAll("[data-route]");
2291
+ for (let r = 0, c = o.length; r < c; r++) {
2292
+ const a = o[r], l = a.dataset.route, u = i === l;
2293
+ a.classList.toggle(e, u), u ? a.setAttribute("aria-current", "page") : a.removeAttribute("aria-current");
1915
2294
  }
1916
2295
  });
1917
2296
  });
1918
- this.cleanups.push(() => n.dispose());
2297
+ this.cleanups.push(() => s.dispose());
1919
2298
  }
1920
2299
  /**
1921
2300
  * Navigates to the specified route programmatically.
@@ -1927,13 +2306,13 @@ class Ms {
1927
2306
  */
1928
2307
  navigate(t) {
1929
2308
  if (this.isDestroyed) return;
1930
- const s = this.currentRouteAtom.peek(), n = this.config.routes[s];
1931
- if (n?.onLeave && n.onLeave() === !1)
2309
+ const e = this.currentRouteAtom.peek(), s = this.config.routes[e];
2310
+ if (s?.onLeave && s.onLeave() === !1)
1932
2311
  return;
1933
2312
  const i = t || this.config.default;
1934
2313
  if (!i) {
1935
- f.warn(
1936
- d.ROUTE,
2314
+ d.warn(
2315
+ E.ROUTE,
1937
2316
  "navigate() called with empty routeName and no default configured."
1938
2317
  );
1939
2318
  return;
@@ -1946,73 +2325,107 @@ class Ms {
1946
2325
  * cleanup does not prevent the remaining ones from running.
1947
2326
  */
1948
2327
  destroy() {
1949
- this.isDestroyed || (this.isDestroyed = !0, this.cleanups.forEach((t) => {
2328
+ if (this.isDestroyed) return;
2329
+ this.isDestroyed = !0;
2330
+ const t = this.cleanups;
2331
+ this.cleanups = [];
2332
+ for (let e = 0, s = t.length; e < s; e++)
1950
2333
  try {
1951
- t();
1952
- } catch (s) {
1953
- f.warn(d.ROUTE, "Cleanup error during destroy:", s);
2334
+ t[e]();
2335
+ } catch (i) {
2336
+ d.warn(E.ROUTE, "Cleanup error during destroy:", i);
1954
2337
  }
1955
- }), this.cleanups.length = 0, this.templateCache.clear());
2338
+ this.templateCache.clear();
1956
2339
  }
1957
2340
  }
1958
- function $s(e) {
1959
- return new Ms(e);
2341
+ function Ms(n) {
2342
+ return new Ps(n);
1960
2343
  }
1961
- c.extend({
1962
- route: $s
1963
- });
1964
- const Fs = new Promise(() => {
2344
+ h.extend({
2345
+ route: Ms
1965
2346
  });
1966
- c.extend({
1967
- atomFetch(e, t) {
1968
- const { defaultValue: s, transform: n, method: i, headers: r, ajaxOptions: o, onError: l, eager: p } = t, C = typeof e == "function" ? e : null, b = typeof e == "string" ? e : void 0, N = {
1969
- ...o,
1970
- ...i !== void 0 && { method: i },
1971
- ...r !== void 0 && { headers: r }
1972
- };
1973
- let E = null;
1974
- return Ct(
1975
- async () => {
1976
- E?.abort(), E = new AbortController();
1977
- const m = E.signal, P = b ? { ...N, url: b } : { ...N, url: C() }, U = c.ajax(P);
1978
- m.onabort = () => U.abort(), m.aborted && U.abort();
2347
+ class Fs {
2348
+ constructor(t, e) {
2349
+ this.abortController = null, this.isStaticUrl = typeof t == "string", this.isStaticUrl ? this.staticUrl = t : this.getUrl = t, typeof e.ajaxOptions == "function" ? (this.ajaxOptionsFn = e.ajaxOptions, this.staticOptions = {}) : this.staticOptions = { ...e.ajaxOptions }, e.method !== void 0 && (this.staticOptions.method = e.method), e.headers !== void 0 && (this.staticOptions.headers = { ...this.staticOptions.headers, ...e.headers }), this.transformFn = e.transform, this.onErrorFn = e.onError, this.execute = this.execute.bind(this);
2350
+ }
2351
+ abort() {
2352
+ this.abortController?.abort();
2353
+ }
2354
+ async execute() {
2355
+ this.abortController?.abort(), this.abortController = new AbortController();
2356
+ const t = this.abortController.signal, e = this.ajaxOptionsFn ? this.ajaxOptionsFn() : {}, s = h.extend(!0, {}, this.staticOptions, e);
2357
+ s.success = void 0, s.error = void 0, s.complete = void 0, s.url = this.isStaticUrl ? this.staticUrl : this.getUrl();
2358
+ const i = h.ajax(s);
2359
+ t.onabort = () => i.abort(), t.aborted && i.abort();
2360
+ let o;
2361
+ try {
2362
+ o = await i;
2363
+ } catch (c) {
2364
+ if (t.aborted) {
2365
+ const u = new Error("AbortError");
2366
+ throw u.name = "AbortError", u;
2367
+ }
2368
+ let a;
2369
+ if (c && typeof c.readyState < "u") {
2370
+ const u = c;
2371
+ a = new Error(`Network Error: ${u.statusText || "Unknown"} (${u.status})`), a.jqXHR = u;
2372
+ } else
2373
+ a = c instanceof Error ? c : new Error(String(c ?? "Unknown network error"));
2374
+ const l = this.onErrorFn;
2375
+ if (l)
1979
2376
  try {
1980
- const G = await U;
1981
- return n ? n(G) : G;
1982
- } catch (G) {
1983
- if (m.aborted)
1984
- return Fs;
2377
+ l(a);
2378
+ } catch {
2379
+ }
2380
+ throw a;
2381
+ } finally {
2382
+ t.onabort = null, this.abortController?.signal === t && (this.abortController = null);
2383
+ }
2384
+ const r = this.transformFn;
2385
+ if (r)
2386
+ try {
2387
+ return r(o);
2388
+ } catch (c) {
2389
+ const a = this.onErrorFn;
2390
+ if (a)
1985
2391
  try {
1986
- l?.(G);
2392
+ a(c);
1987
2393
  } catch {
1988
2394
  }
1989
- throw G;
1990
- } finally {
1991
- m.onabort = null, E.signal === m && (E = null);
1992
- }
1993
- },
1994
- { defaultValue: s, lazy: !(p ?? !0) }
1995
- );
2395
+ throw c;
2396
+ }
2397
+ return o;
2398
+ }
2399
+ }
2400
+ h.extend({
2401
+ atomFetch(n, t) {
2402
+ const e = new Fs(n, t), s = !(t.eager ?? !0), i = gt(e.execute, {
2403
+ defaultValue: t.defaultValue,
2404
+ lazy: s
2405
+ });
2406
+ return Object.assign(i, {
2407
+ abort: () => e.abort()
2408
+ });
1996
2409
  }
1997
2410
  });
1998
- c(() => {
1999
- Ns(), Rs(document.body);
2411
+ h(() => {
2412
+ ns(), ts(document.body);
2000
2413
  });
2001
2414
  export {
2002
- Ft as atom,
2003
- ye as batch,
2004
- Ct as computed,
2005
- qs as default,
2415
+ Dt as atom,
2416
+ ne as batch,
2417
+ gt as computed,
2418
+ zs as default,
2006
2419
  Gs as disableAutoCleanup,
2007
- js as disablejQueryOverrides,
2008
- X as effect,
2009
- Rs as enableAutoCleanup,
2010
- Ns as enablejQueryOverrides,
2011
- qt as isAtom,
2012
- Ve as isComputed,
2013
- Ce as isReactive,
2014
- Cs as nextTick,
2015
- g as registry,
2016
- H as untracked
2420
+ Hs as disablejQueryOverrides,
2421
+ V as effect,
2422
+ ts as enableAutoCleanup,
2423
+ ns as enablejQueryOverrides,
2424
+ wt as isAtom,
2425
+ xe as isComputed,
2426
+ oe as isReactive,
2427
+ We as nextTick,
2428
+ R as registry,
2429
+ P as untracked
2017
2430
  };
2018
2431
  //# sourceMappingURL=index.mjs.map