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