@but212/atom-effect-jquery 0.18.0 → 0.19.1
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 +12 -1
- package/dist/atom-effect-jquery.min.js +1 -1
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -6
- package/dist/index.mjs +813 -671
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import l from "jquery";
|
|
2
|
-
import { default as
|
|
3
|
-
const
|
|
2
|
+
import { default as Qt } from "jquery";
|
|
3
|
+
const et = {
|
|
4
4
|
ONE_SECOND_MS: 1e3
|
|
5
|
-
},
|
|
5
|
+
}, me = {
|
|
6
6
|
IDLE: "idle",
|
|
7
7
|
PENDING: "pending",
|
|
8
8
|
RESOLVED: "resolved",
|
|
9
9
|
REJECTED: "rejected"
|
|
10
|
-
},
|
|
10
|
+
}, Oe = {
|
|
11
11
|
DISPOSED: 1
|
|
12
12
|
}, P = {
|
|
13
|
-
...
|
|
13
|
+
...Oe,
|
|
14
14
|
EXECUTING: 8
|
|
15
15
|
}, d = {
|
|
16
|
-
...
|
|
16
|
+
...Oe,
|
|
17
|
+
/** Marker bit: identifies this node as a computed. */
|
|
18
|
+
IS_COMPUTED: 2,
|
|
17
19
|
DIRTY: 8,
|
|
18
20
|
IDLE: 16,
|
|
19
21
|
PENDING: 32,
|
|
@@ -21,8 +23,8 @@ const Je = {
|
|
|
21
23
|
REJECTED: 128,
|
|
22
24
|
RECOMPUTING: 256,
|
|
23
25
|
HAS_ERROR: 512
|
|
24
|
-
},
|
|
25
|
-
...
|
|
26
|
+
}, j = {
|
|
27
|
+
...Oe,
|
|
26
28
|
SYNC: 8,
|
|
27
29
|
NOTIFICATION_SCHEDULED: 16
|
|
28
30
|
}, q = {
|
|
@@ -34,75 +36,73 @@ const Je = {
|
|
|
34
36
|
MAX_FLUSH_ITERATIONS: 1e3,
|
|
35
37
|
MIN_FLUSH_ITERATIONS: 10,
|
|
36
38
|
BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
|
|
37
|
-
},
|
|
38
|
-
MAX_DEPENDENCIES: 1e3,
|
|
39
|
+
}, tt = {
|
|
39
40
|
WARN_INFINITE_LOOP: !0
|
|
40
|
-
},
|
|
41
|
-
class
|
|
41
|
+
}, oe = 1073741823, L = typeof process < "u" && process.env && process.env.NODE_ENV !== "production" || typeof __DEV__ < "u" && !!__DEV__, nt = Object.freeze([]);
|
|
42
|
+
class ee extends Error {
|
|
42
43
|
constructor(e, t = null, s = !0) {
|
|
43
44
|
super(e), this.cause = t, this.recoverable = s, this.timestamp = /* @__PURE__ */ new Date(), this.name = "AtomError";
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
class z extends
|
|
47
|
+
class z extends ee {
|
|
47
48
|
constructor(e, t = null) {
|
|
48
49
|
super(e, t, !0), this.name = "ComputedError";
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
class
|
|
52
|
+
class Y extends ee {
|
|
52
53
|
constructor(e, t = null) {
|
|
53
54
|
super(e, t, !1), this.name = "EffectError";
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
class
|
|
57
|
+
class le extends ee {
|
|
57
58
|
constructor(e, t = null) {
|
|
58
59
|
super(e, t, !1), this.name = "SchedulerError";
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const Ae = /* @__PURE__ */ Symbol("AtomEffect.DebugName"),
|
|
62
|
-
function
|
|
62
|
+
const Ae = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), st = /* @__PURE__ */ Symbol("AtomEffect.Id"), Le = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ce = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), it = (n) => "dependencies" in n && Array.isArray(n.dependencies);
|
|
63
|
+
function Ve(n, e, t) {
|
|
63
64
|
if (n === e)
|
|
64
65
|
throw new z(
|
|
65
66
|
"Circular dependency detected: The computation refers to itself explicitly or implicitly."
|
|
66
67
|
);
|
|
67
|
-
if (!t.has(n.id) && (t.add(n.id),
|
|
68
|
+
if (!t.has(n.id) && (t.add(n.id), it(n))) {
|
|
68
69
|
const s = n.dependencies;
|
|
69
70
|
for (let i = 0; i < s.length; i++) {
|
|
70
|
-
const
|
|
71
|
-
|
|
71
|
+
const r = s[i];
|
|
72
|
+
r && Ve(r, e, t);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
+
const W = {
|
|
76
77
|
// Dev mode flag
|
|
77
|
-
enabled:
|
|
78
|
-
|
|
79
|
-
warnInfiniteLoop: Ne.WARN_INFINITE_LOOP,
|
|
78
|
+
enabled: L,
|
|
79
|
+
warnInfiniteLoop: tt.WARN_INFINITE_LOOP,
|
|
80
80
|
warn(n, e) {
|
|
81
|
-
|
|
81
|
+
L && this.enabled && n && console.warn(`[Atom Effect] ${e}`);
|
|
82
82
|
},
|
|
83
83
|
checkCircular(n, e) {
|
|
84
84
|
if (n === e)
|
|
85
85
|
throw new z("Direct circular dependency detected");
|
|
86
|
-
|
|
86
|
+
L && this.enabled && Ve(n, e, /* @__PURE__ */ new Set());
|
|
87
87
|
},
|
|
88
88
|
attachDebugInfo(n, e, t) {
|
|
89
|
-
if (!
|
|
89
|
+
if (!L || !this.enabled) return;
|
|
90
90
|
const s = n;
|
|
91
|
-
s[Ae] = `${e}_${t}`, s[
|
|
91
|
+
s[Ae] = `${e}_${t}`, s[st] = t, s[Le] = e;
|
|
92
92
|
},
|
|
93
93
|
getDebugName: (n) => n?.[Ae],
|
|
94
|
-
getDebugType: (n) => n?.[
|
|
94
|
+
getDebugType: (n) => n?.[Le]
|
|
95
95
|
};
|
|
96
|
-
let
|
|
97
|
-
const
|
|
98
|
-
function
|
|
96
|
+
let rt = 1;
|
|
97
|
+
const ot = () => rt++;
|
|
98
|
+
function He(n, e, t) {
|
|
99
99
|
if (typeof e == "function") {
|
|
100
100
|
const i = e;
|
|
101
|
-
for (let
|
|
102
|
-
const c = t[
|
|
101
|
+
for (let r = 0, o = t.length; r < o; r++) {
|
|
102
|
+
const c = t[r];
|
|
103
103
|
if (c && c.fn === i) return;
|
|
104
104
|
}
|
|
105
|
-
t.push(new
|
|
105
|
+
t.push(new Se(i, void 0));
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
if ("addDependency" in e) {
|
|
@@ -110,42 +110,38 @@ function je(n, e, t) {
|
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
const s = e;
|
|
113
|
-
for (let i = 0,
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
113
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
114
|
+
const o = t[i];
|
|
115
|
+
if (o && o.sub === s) return;
|
|
116
116
|
}
|
|
117
|
-
t.push(new
|
|
117
|
+
t.push(new Se(void 0, s));
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
function ct(n, e, t) {
|
|
120
|
+
const s = /* @__PURE__ */ new Map();
|
|
121
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
122
|
+
const o = e[i];
|
|
123
|
+
o?.unsub && (s.set(o.node, o.unsub), o.unsub = void 0);
|
|
123
124
|
}
|
|
124
|
-
for (let
|
|
125
|
-
const o = n[
|
|
125
|
+
for (let i = 0, r = n.length; i < r; i++) {
|
|
126
|
+
const o = n[i];
|
|
126
127
|
if (!o) continue;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
for (let s = 0, i = e.length; s < i; s++) {
|
|
131
|
-
const o = e[s];
|
|
132
|
-
if (o) {
|
|
133
|
-
const r = o.node;
|
|
134
|
-
r._tempUnsub !== void 0 && (r._tempUnsub(), r._tempUnsub = void 0), o.unsub = void 0;
|
|
135
|
-
}
|
|
128
|
+
const c = o.node, a = s.get(c);
|
|
129
|
+
a !== void 0 ? (o.unsub = a, s.delete(c)) : (W.checkCircular(c, t), o.unsub = c.subscribe(t));
|
|
136
130
|
}
|
|
131
|
+
for (const i of s.values())
|
|
132
|
+
i();
|
|
137
133
|
}
|
|
138
|
-
class
|
|
134
|
+
class de {
|
|
139
135
|
constructor(e, t, s = void 0) {
|
|
140
136
|
this.node = e, this.version = t, this.unsub = s;
|
|
141
137
|
}
|
|
142
138
|
}
|
|
143
|
-
class
|
|
139
|
+
class Se {
|
|
144
140
|
constructor(e, t) {
|
|
145
141
|
this.fn = e, this.sub = t;
|
|
146
142
|
}
|
|
147
143
|
}
|
|
148
|
-
const
|
|
144
|
+
const T = {
|
|
149
145
|
// Computed Errors
|
|
150
146
|
COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
|
|
151
147
|
COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
|
|
@@ -161,42 +157,47 @@ const v = {
|
|
|
161
157
|
EFFECT_EXECUTION_FAILED: "Effect execution failed",
|
|
162
158
|
EFFECT_CLEANUP_FAILED: "Effect cleanup failed",
|
|
163
159
|
EFFECT_DISPOSED: "Attempted to run disposed effect",
|
|
164
|
-
|
|
160
|
+
// Scheduler Errors
|
|
161
|
+
SCHEDULER_FLUSH_OVERFLOW: (n, e) => `Maximum flush iterations (${n}) exceeded. ${e} jobs dropped. Possible infinite loop.`,
|
|
162
|
+
// System / Debug
|
|
163
|
+
CALLBACK_ERROR_IN_ERROR_HANDLER: "Exception encountered in onError handler",
|
|
164
|
+
// Effect frequency
|
|
165
|
+
EFFECT_FREQUENCY_LIMIT_EXCEEDED: "Effect executed too frequently within 1 second. Suspected infinite loop."
|
|
165
166
|
};
|
|
166
|
-
function
|
|
167
|
-
if (n instanceof
|
|
167
|
+
function Z(n, e, t) {
|
|
168
|
+
if (n instanceof ee)
|
|
168
169
|
return n;
|
|
169
|
-
const s = n instanceof Error, i = s ? n.message : String(n),
|
|
170
|
-
let
|
|
171
|
-
n instanceof TypeError ?
|
|
172
|
-
const c = `${
|
|
173
|
-
return new e(c,
|
|
170
|
+
const s = n instanceof Error, i = s ? n.message : String(n), r = s ? n : void 0;
|
|
171
|
+
let o = "Unexpected error";
|
|
172
|
+
n instanceof TypeError ? o = "Type error" : n instanceof ReferenceError && (o = "Reference error");
|
|
173
|
+
const c = `${o} (${t}): ${i}`;
|
|
174
|
+
return new e(c, r);
|
|
174
175
|
}
|
|
175
|
-
class
|
|
176
|
+
class je {
|
|
176
177
|
constructor() {
|
|
177
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this.id =
|
|
178
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this.id = ot() & oe;
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
class
|
|
181
|
+
class ze extends je {
|
|
181
182
|
/**
|
|
182
183
|
* Adds subscriber.
|
|
183
184
|
*/
|
|
184
185
|
subscribe(e) {
|
|
185
186
|
const t = typeof e == "function";
|
|
186
187
|
if (!t && (!e || typeof e.execute != "function"))
|
|
187
|
-
throw
|
|
188
|
+
throw Z(
|
|
188
189
|
new TypeError("Invalid subscriber"),
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
ee,
|
|
191
|
+
T.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
|
|
191
192
|
);
|
|
192
193
|
const s = this._subscribers;
|
|
193
|
-
for (let
|
|
194
|
-
const c = s[
|
|
194
|
+
for (let r = 0, o = s.length; r < o; r++) {
|
|
195
|
+
const c = s[r];
|
|
195
196
|
if (c && (t ? c.fn === e : c.sub === e))
|
|
196
|
-
return
|
|
197
|
+
return L && console.warn("Duplicate subscription ignored."), () => {
|
|
197
198
|
};
|
|
198
199
|
}
|
|
199
|
-
const i = new
|
|
200
|
+
const i = new Se(
|
|
200
201
|
t ? e : void 0,
|
|
201
202
|
t ? void 0 : e
|
|
202
203
|
);
|
|
@@ -213,152 +214,146 @@ class He extends Ve {
|
|
|
213
214
|
}
|
|
214
215
|
_notifySubscribers(e, t) {
|
|
215
216
|
if (this._subscribers.length === 0) return;
|
|
216
|
-
const s =
|
|
217
|
-
for (let
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
217
|
+
const s = this._subscribers.slice(0), i = s.length;
|
|
218
|
+
for (let r = 0; r < i; r++) {
|
|
219
|
+
const o = s[r];
|
|
220
|
+
if (o)
|
|
220
221
|
try {
|
|
221
|
-
|
|
222
|
+
o.fn ? o.fn(e, t) : o.sub && o.sub.execute();
|
|
222
223
|
} catch (c) {
|
|
223
224
|
this._handleNotifyError(c);
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
_handleNotifyError(e) {
|
|
228
|
-
console.error(
|
|
229
|
+
console.error(Z(e, ee, T.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
|
-
let
|
|
232
|
-
const
|
|
233
|
-
let
|
|
234
|
-
function
|
|
235
|
-
return
|
|
232
|
+
let _e = 0;
|
|
233
|
+
const qe = () => (_e = _e + 1 & oe || 1, _e), at = () => _e, De = (n) => n + 1 & oe;
|
|
234
|
+
let Te = 0, we = 0, Ee = !1;
|
|
235
|
+
function xe() {
|
|
236
|
+
return Ee ? (L && console.warn("startFlush() called during flush - ignored"), !1) : (Ee = !0, Te = Te + 1 & oe || 1, we = 0, !0);
|
|
236
237
|
}
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
/** Epoch counter */
|
|
245
|
-
_epoch: 0,
|
|
246
|
-
/** State flags */
|
|
247
|
-
_isProcessing: !1,
|
|
248
|
-
_isBatching: !1,
|
|
249
|
-
_isFlushingSync: !1,
|
|
250
|
-
/** Batching state */
|
|
251
|
-
_batchDepth: 0,
|
|
252
|
-
_batchQueue: [],
|
|
253
|
-
_batchQueueSize: 0,
|
|
254
|
-
/** Config */
|
|
255
|
-
_maxFlushIterations: q.MAX_FLUSH_ITERATIONS,
|
|
238
|
+
const Ue = () => {
|
|
239
|
+
Ee = !1;
|
|
240
|
+
}, ut = () => Ee ? ++we : 0;
|
|
241
|
+
class lt {
|
|
242
|
+
constructor() {
|
|
243
|
+
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isBatching = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = q.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
|
|
244
|
+
}
|
|
256
245
|
get phase() {
|
|
257
246
|
return this._isProcessing || this._isFlushingSync ? 2 : this._isBatching ? 1 : 0;
|
|
258
|
-
}
|
|
247
|
+
}
|
|
259
248
|
get queueSize() {
|
|
260
249
|
return this._size;
|
|
261
|
-
}
|
|
250
|
+
}
|
|
262
251
|
get isBatching() {
|
|
263
252
|
return this._isBatching;
|
|
264
|
-
}
|
|
253
|
+
}
|
|
265
254
|
/**
|
|
266
255
|
* Schedules job.
|
|
267
256
|
*/
|
|
268
|
-
schedule(
|
|
269
|
-
if (
|
|
270
|
-
throw new
|
|
271
|
-
if (
|
|
272
|
-
if (
|
|
273
|
-
this._batchQueue[this._batchQueueSize++] =
|
|
257
|
+
schedule(e) {
|
|
258
|
+
if (L && typeof e != "function")
|
|
259
|
+
throw new le("Scheduler callback must be a function");
|
|
260
|
+
if (e._nextEpoch !== this._epoch) {
|
|
261
|
+
if (e._nextEpoch = this._epoch, this._isBatching || this._isFlushingSync) {
|
|
262
|
+
this._batchQueue[this._batchQueueSize++] = e;
|
|
274
263
|
return;
|
|
275
264
|
}
|
|
276
|
-
this._queueBuffer[this._bufferIndex][this._size++] =
|
|
265
|
+
this._queueBuffer[this._bufferIndex][this._size++] = e, this._isProcessing || this._flush();
|
|
277
266
|
}
|
|
278
|
-
}
|
|
267
|
+
}
|
|
279
268
|
/**
|
|
280
269
|
* Triggers flush.
|
|
281
270
|
*/
|
|
282
271
|
_flush() {
|
|
283
|
-
this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this.
|
|
284
|
-
}
|
|
272
|
+
this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this._boundRunLoop));
|
|
273
|
+
}
|
|
285
274
|
/**
|
|
286
275
|
* Scheduler loop.
|
|
287
276
|
*/
|
|
288
|
-
_runLoop
|
|
277
|
+
_runLoop() {
|
|
289
278
|
try {
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
292
|
-
|
|
279
|
+
if (this._size === 0) return;
|
|
280
|
+
const e = xe();
|
|
281
|
+
this._drainQueue(), e && Ue();
|
|
293
282
|
} finally {
|
|
294
|
-
|
|
283
|
+
this._isProcessing = !1, this._size > 0 && !this._isBatching && this._flush();
|
|
295
284
|
}
|
|
296
|
-
}
|
|
285
|
+
}
|
|
297
286
|
_flushSync() {
|
|
298
287
|
this._isFlushingSync = !0;
|
|
299
|
-
const
|
|
288
|
+
const e = xe();
|
|
300
289
|
try {
|
|
301
290
|
this._mergeBatchQueue(), this._drainQueue();
|
|
302
291
|
} finally {
|
|
303
|
-
this._isFlushingSync = !1,
|
|
292
|
+
this._isFlushingSync = !1, e && Ue();
|
|
304
293
|
}
|
|
305
|
-
}
|
|
294
|
+
}
|
|
306
295
|
_mergeBatchQueue() {
|
|
307
296
|
if (this._batchQueueSize === 0) return;
|
|
308
|
-
const
|
|
309
|
-
let
|
|
310
|
-
for (let
|
|
311
|
-
const o =
|
|
312
|
-
o._nextEpoch !==
|
|
297
|
+
const e = ++this._epoch, t = this._batchQueue, s = this._queueBuffer[this._bufferIndex];
|
|
298
|
+
let i = this._size;
|
|
299
|
+
for (let r = 0; r < this._batchQueueSize; r++) {
|
|
300
|
+
const o = t[r];
|
|
301
|
+
o._nextEpoch !== e && (o._nextEpoch = e, s[i++] = o);
|
|
313
302
|
}
|
|
314
|
-
this._size =
|
|
315
|
-
}
|
|
303
|
+
this._size = i, this._batchQueueSize = 0, t.length > q.BATCH_QUEUE_SHRINK_THRESHOLD && (t.length = 0);
|
|
304
|
+
}
|
|
316
305
|
_drainQueue() {
|
|
317
|
-
let
|
|
306
|
+
let e = 0;
|
|
318
307
|
for (; this._size > 0; ) {
|
|
319
|
-
if (++
|
|
308
|
+
if (++e > this._maxFlushIterations) {
|
|
320
309
|
this._handleFlushOverflow();
|
|
321
310
|
return;
|
|
322
311
|
}
|
|
323
312
|
this._processQueue(), this._mergeBatchQueue();
|
|
324
313
|
}
|
|
325
|
-
}
|
|
314
|
+
}
|
|
326
315
|
_processQueue() {
|
|
327
|
-
const
|
|
328
|
-
this._bufferIndex =
|
|
329
|
-
for (let
|
|
316
|
+
const e = this._bufferIndex, t = this._queueBuffer[e], s = this._size;
|
|
317
|
+
this._bufferIndex = e ^ 1, this._size = 0, this._epoch++;
|
|
318
|
+
for (let i = 0; i < s; i++)
|
|
330
319
|
try {
|
|
331
|
-
|
|
332
|
-
} catch (
|
|
333
|
-
console.error(new
|
|
320
|
+
t[i]();
|
|
321
|
+
} catch (r) {
|
|
322
|
+
console.error(new le("Error occurred during scheduler execution", r));
|
|
334
323
|
}
|
|
335
|
-
|
|
336
|
-
}
|
|
324
|
+
t.length = 0;
|
|
325
|
+
}
|
|
337
326
|
_handleFlushOverflow() {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
327
|
+
const e = this._size + this._batchQueueSize;
|
|
328
|
+
if (console.error(
|
|
329
|
+
new le(
|
|
330
|
+
T.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, e)
|
|
341
331
|
)
|
|
342
|
-
), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0
|
|
343
|
-
|
|
332
|
+
), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow)
|
|
333
|
+
try {
|
|
334
|
+
this.onOverflow(e);
|
|
335
|
+
} catch {
|
|
336
|
+
}
|
|
337
|
+
}
|
|
344
338
|
startBatch() {
|
|
345
339
|
this._batchDepth++, this._isBatching = !0;
|
|
346
|
-
}
|
|
340
|
+
}
|
|
347
341
|
endBatch() {
|
|
348
342
|
if (this._batchDepth === 0) {
|
|
349
|
-
|
|
343
|
+
L && console.warn("endBatch() called without matching startBatch(). Ignoring.");
|
|
350
344
|
return;
|
|
351
345
|
}
|
|
352
346
|
--this._batchDepth === 0 && (this._flushSync(), this._isBatching = !1);
|
|
353
|
-
}
|
|
354
|
-
setMaxFlushIterations(
|
|
355
|
-
if (
|
|
356
|
-
throw new
|
|
347
|
+
}
|
|
348
|
+
setMaxFlushIterations(e) {
|
|
349
|
+
if (e < q.MIN_FLUSH_ITERATIONS)
|
|
350
|
+
throw new le(
|
|
357
351
|
`Max flush iterations must be at least ${q.MIN_FLUSH_ITERATIONS}`
|
|
358
352
|
);
|
|
359
|
-
this._maxFlushIterations =
|
|
353
|
+
this._maxFlushIterations = e;
|
|
360
354
|
}
|
|
361
|
-
}
|
|
355
|
+
}
|
|
356
|
+
const re = new lt(), M = {
|
|
362
357
|
/** Active listener. */
|
|
363
358
|
current: null,
|
|
364
359
|
/**
|
|
@@ -378,7 +373,7 @@ const xe = () => {
|
|
|
378
373
|
}
|
|
379
374
|
}
|
|
380
375
|
};
|
|
381
|
-
function
|
|
376
|
+
function ht(n) {
|
|
382
377
|
const e = M.current;
|
|
383
378
|
if (e === null) return n();
|
|
384
379
|
M.current = null;
|
|
@@ -388,25 +383,25 @@ function ct(n) {
|
|
|
388
383
|
M.current = e;
|
|
389
384
|
}
|
|
390
385
|
}
|
|
391
|
-
class
|
|
386
|
+
class ft extends ze {
|
|
392
387
|
constructor(e, t) {
|
|
393
|
-
super(), this._pendingOldValue = void 0, this._notifyTask = void 0, this._subscribers = [], this._value = e, t && (this.flags |=
|
|
388
|
+
super(), this._pendingOldValue = void 0, this._notifyTask = void 0, this._subscribers = [], this._value = e, t && (this.flags |= j.SYNC), W.attachDebugInfo(this, "atom", this.id);
|
|
394
389
|
}
|
|
395
390
|
get value() {
|
|
396
391
|
const e = M.current;
|
|
397
|
-
return e &&
|
|
392
|
+
return e && He(this, e, this._subscribers), this._value;
|
|
398
393
|
}
|
|
399
394
|
set value(e) {
|
|
400
395
|
const t = this._value;
|
|
401
396
|
if (Object.is(t, e)) return;
|
|
402
|
-
this._value = e, this.version = this.version
|
|
397
|
+
this._value = e, this.version = De(this.version);
|
|
403
398
|
const s = this.flags;
|
|
404
|
-
if (!(this._subscribers.length === 0 || s &
|
|
405
|
-
if (this._pendingOldValue = t, this.flags = s |
|
|
399
|
+
if (!(this._subscribers.length === 0 || s & j.NOTIFICATION_SCHEDULED)) {
|
|
400
|
+
if (this._pendingOldValue = t, this.flags = s | j.NOTIFICATION_SCHEDULED, s & j.SYNC && !re.isBatching) {
|
|
406
401
|
this._flushNotifications();
|
|
407
402
|
return;
|
|
408
403
|
}
|
|
409
|
-
this._notifyTask || (this._notifyTask = () => this._flushNotifications()),
|
|
404
|
+
this._notifyTask || (this._notifyTask = () => this._flushNotifications()), re.schedule(this._notifyTask);
|
|
410
405
|
}
|
|
411
406
|
}
|
|
412
407
|
/**
|
|
@@ -414,7 +409,7 @@ class ut extends He {
|
|
|
414
409
|
*/
|
|
415
410
|
_flushNotifications() {
|
|
416
411
|
const e = this.flags;
|
|
417
|
-
if (!(e &
|
|
412
|
+
if (!(e & j.NOTIFICATION_SCHEDULED) || e & j.DISPOSED)
|
|
418
413
|
return;
|
|
419
414
|
const t = this._pendingOldValue;
|
|
420
415
|
this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, t);
|
|
@@ -423,19 +418,20 @@ class ut extends He {
|
|
|
423
418
|
return this._value;
|
|
424
419
|
}
|
|
425
420
|
dispose() {
|
|
426
|
-
this.flags &
|
|
421
|
+
this.flags & j.DISPOSED || (this._subscribers.length = 0, this.flags |= j.DISPOSED, this._value = void 0, this._pendingOldValue = void 0, this._notifyTask = void 0);
|
|
427
422
|
}
|
|
428
423
|
}
|
|
429
|
-
function
|
|
430
|
-
return new
|
|
424
|
+
function Xe(n, e = {}) {
|
|
425
|
+
return new ft(n, e.sync ?? !1);
|
|
431
426
|
}
|
|
432
|
-
class
|
|
427
|
+
class dt {
|
|
433
428
|
/**
|
|
434
429
|
* @param limit - Max unique arrays to hold (default: 50). Prevents the pool itself from consuming too much memory.
|
|
435
430
|
* @param capacity - Max length of an array to accept (default: 256).
|
|
431
|
+
* @param enableStats - Force-enable stats even in production (default: false).
|
|
436
432
|
*/
|
|
437
|
-
constructor(e = 50, t = 256) {
|
|
438
|
-
this.limit = e, this.capacity = t, this.pool = [], this.stats =
|
|
433
|
+
constructor(e = 50, t = 256, s = !1) {
|
|
434
|
+
this.limit = e, this.capacity = t, this.pool = [], this.stats = null, this.stats = L || s ? {
|
|
439
435
|
acquired: 0,
|
|
440
436
|
released: 0,
|
|
441
437
|
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
@@ -445,7 +441,7 @@ class lt {
|
|
|
445
441
|
* Acquires array.
|
|
446
442
|
*/
|
|
447
443
|
acquire() {
|
|
448
|
-
return
|
|
444
|
+
return this.stats && this.stats.acquired++, this.pool.pop() ?? [];
|
|
449
445
|
}
|
|
450
446
|
/**
|
|
451
447
|
* Releases array.
|
|
@@ -456,25 +452,25 @@ class lt {
|
|
|
456
452
|
release(e, t) {
|
|
457
453
|
if (!(t && e === t)) {
|
|
458
454
|
if (e.length > this.capacity) {
|
|
459
|
-
|
|
455
|
+
this.stats && this.stats.rejected.tooLarge++;
|
|
460
456
|
return;
|
|
461
457
|
}
|
|
462
458
|
if (this.pool.length >= this.limit) {
|
|
463
|
-
|
|
459
|
+
this.stats && this.stats.rejected.poolFull++;
|
|
464
460
|
return;
|
|
465
461
|
}
|
|
466
462
|
if (Object.isFrozen(e)) {
|
|
467
|
-
|
|
463
|
+
this.stats && this.stats.rejected.frozen++;
|
|
468
464
|
return;
|
|
469
465
|
}
|
|
470
|
-
e.length = 0, this.pool.push(e),
|
|
466
|
+
e.length = 0, this.pool.push(e), this.stats && this.stats.released++;
|
|
471
467
|
}
|
|
472
468
|
}
|
|
473
469
|
/**
|
|
474
470
|
* Pool stats.
|
|
475
471
|
*/
|
|
476
472
|
getStats() {
|
|
477
|
-
if (!
|
|
473
|
+
if (!this.stats) return null;
|
|
478
474
|
const { acquired: e, released: t, rejected: s } = this.stats, i = e - t - (s.frozen + s.tooLarge + s.poolFull);
|
|
479
475
|
return {
|
|
480
476
|
acquired: e,
|
|
@@ -488,37 +484,39 @@ class lt {
|
|
|
488
484
|
* Resets pool.
|
|
489
485
|
*/
|
|
490
486
|
reset() {
|
|
491
|
-
this.pool.length = 0,
|
|
487
|
+
this.pool.length = 0, this.stats && (this.stats = {
|
|
492
488
|
acquired: 0,
|
|
493
489
|
released: 0,
|
|
494
490
|
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
495
491
|
});
|
|
496
492
|
}
|
|
497
493
|
}
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
function
|
|
494
|
+
const ce = (n) => Object.freeze(n);
|
|
495
|
+
ce([]);
|
|
496
|
+
ce([]);
|
|
497
|
+
ce([]);
|
|
498
|
+
ce([]);
|
|
499
|
+
const F = ce([]), X = new dt();
|
|
500
|
+
function ve(n) {
|
|
505
501
|
return n !== null && typeof n == "object" && "value" in n && typeof n.subscribe == "function";
|
|
506
502
|
}
|
|
507
|
-
function
|
|
508
|
-
return
|
|
503
|
+
function Pe(n) {
|
|
504
|
+
return ve(n) && typeof n.invalidate == "function";
|
|
509
505
|
}
|
|
510
|
-
function
|
|
506
|
+
function Ge(n) {
|
|
511
507
|
return n !== null && typeof n == "object" && typeof n.then == "function";
|
|
512
508
|
}
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
class
|
|
509
|
+
const Qe = d.RESOLVED | d.PENDING | d.REJECTED, ye = Array(Qe + 1).fill(me.IDLE);
|
|
510
|
+
ye[d.RESOLVED] = me.RESOLVED;
|
|
511
|
+
ye[d.PENDING] = me.PENDING;
|
|
512
|
+
ye[d.REJECTED] = me.REJECTED;
|
|
513
|
+
const _t = 3, Fe = Number.MAX_SAFE_INTEGER - 1, pt = d.REJECTED | d.HAS_ERROR;
|
|
514
|
+
class Ye extends ze {
|
|
519
515
|
constructor(e, t = {}) {
|
|
520
|
-
if (typeof e != "function") throw new z(
|
|
521
|
-
|
|
516
|
+
if (typeof e != "function") throw new z(T.COMPUTED_MUST_BE_FUNCTION);
|
|
517
|
+
super(), this._error = null, this._promiseId = 0, this._subscribers = [], this._links = F, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._errorDepCount = 0, this._trackEpoch = -1, this._trackLinks = F, this._trackCount = 0, this._value = void 0, this.flags = d.IS_COMPUTED | d.DIRTY | d.IDLE, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : Ce, this._onError = t.onError ?? null;
|
|
518
|
+
const s = t.maxAsyncRetries;
|
|
519
|
+
if (this._maxAsyncRetries = s != null && s >= 0 ? s : _t, W.attachDebugInfo(this, "computed", this.id), t.lazy === !1)
|
|
522
520
|
try {
|
|
523
521
|
this._recompute();
|
|
524
522
|
} catch {
|
|
@@ -526,7 +524,7 @@ class Qe extends He {
|
|
|
526
524
|
}
|
|
527
525
|
_track() {
|
|
528
526
|
const e = M.current;
|
|
529
|
-
e &&
|
|
527
|
+
e && He(this, e, this._subscribers);
|
|
530
528
|
}
|
|
531
529
|
get value() {
|
|
532
530
|
this._track();
|
|
@@ -534,17 +532,17 @@ class Qe extends He {
|
|
|
534
532
|
if ((e & (d.RESOLVED | d.DIRTY | d.IDLE)) === d.RESOLVED)
|
|
535
533
|
return this._value;
|
|
536
534
|
if (e & d.DISPOSED)
|
|
537
|
-
throw new z(
|
|
535
|
+
throw new z(T.COMPUTED_DISPOSED);
|
|
538
536
|
if (e & d.RECOMPUTING) {
|
|
539
|
-
if (this._defaultValue !==
|
|
540
|
-
throw new z(
|
|
537
|
+
if (this._defaultValue !== Ce) return this._defaultValue;
|
|
538
|
+
throw new z(T.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
541
539
|
}
|
|
542
540
|
if (e & (d.DIRTY | d.IDLE) && (this._recompute(), this.flags & d.RESOLVED))
|
|
543
541
|
return this._value;
|
|
544
|
-
const t = this._defaultValue, s = t !==
|
|
542
|
+
const t = this._defaultValue, s = t !== Ce;
|
|
545
543
|
if (this.flags & d.PENDING) {
|
|
546
544
|
if (s) return t;
|
|
547
|
-
throw new z(
|
|
545
|
+
throw new z(T.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
548
546
|
}
|
|
549
547
|
if (this.flags & d.REJECTED) {
|
|
550
548
|
if (this._error?.recoverable && s) return t;
|
|
@@ -556,10 +554,10 @@ class Qe extends He {
|
|
|
556
554
|
return this._value;
|
|
557
555
|
}
|
|
558
556
|
get state() {
|
|
559
|
-
return this._track(),
|
|
557
|
+
return this._track(), ye[this.flags & Qe];
|
|
560
558
|
}
|
|
561
559
|
get hasError() {
|
|
562
|
-
if (this._track(), this.flags & (d.REJECTED | d.HAS_ERROR)) return !0;
|
|
560
|
+
if (this._track(), this.flags & (d.REJECTED | d.HAS_ERROR) || this._errorDepCount > 0) return !0;
|
|
563
561
|
const e = this._links;
|
|
564
562
|
for (let t = 0, s = e.length; t < s; t++) {
|
|
565
563
|
const i = e[t]?.node;
|
|
@@ -572,21 +570,21 @@ class Qe extends He {
|
|
|
572
570
|
return !this.hasError;
|
|
573
571
|
}
|
|
574
572
|
get errors() {
|
|
575
|
-
if (this._track(), !this.hasError) return
|
|
576
|
-
const e =
|
|
573
|
+
if (this._track(), !this.hasError) return nt;
|
|
574
|
+
const e = at();
|
|
577
575
|
if (this._errorCacheEpoch === e && this._cachedErrors) return this._cachedErrors;
|
|
578
576
|
const t = [];
|
|
579
577
|
this._error && t.push(this._error);
|
|
580
578
|
const s = this._links;
|
|
581
|
-
for (let
|
|
582
|
-
const c = s[
|
|
579
|
+
for (let r = 0, o = s.length; r < o; r++) {
|
|
580
|
+
const c = s[r].node;
|
|
583
581
|
if (c.flags & d.HAS_ERROR) {
|
|
584
582
|
const a = c;
|
|
585
583
|
if (a.errors) {
|
|
586
|
-
const
|
|
587
|
-
for (let
|
|
588
|
-
const
|
|
589
|
-
|
|
584
|
+
const _ = a.errors;
|
|
585
|
+
for (let g = 0; g < _.length; g++) {
|
|
586
|
+
const v = _[g];
|
|
587
|
+
v && t.indexOf(v) === -1 && t.push(v);
|
|
590
588
|
}
|
|
591
589
|
}
|
|
592
590
|
}
|
|
@@ -609,12 +607,12 @@ class Qe extends He {
|
|
|
609
607
|
dispose() {
|
|
610
608
|
if (this.flags & d.DISPOSED) return;
|
|
611
609
|
const e = this._links;
|
|
612
|
-
if (e !==
|
|
610
|
+
if (e !== F) {
|
|
613
611
|
for (let t = 0, s = e.length; t < s; t++)
|
|
614
612
|
e[t].unsub?.();
|
|
615
|
-
X.release(e), this._links =
|
|
613
|
+
X.release(e), this._links = F;
|
|
616
614
|
}
|
|
617
|
-
this._subscribers.length = 0, this.flags = d.DISPOSED | d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) %
|
|
615
|
+
this._subscribers.length = 0, this.flags = d.DISPOSED | d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % Fe, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
618
616
|
}
|
|
619
617
|
addDependency(e) {
|
|
620
618
|
if (e._lastSeenEpoch !== this._trackEpoch) {
|
|
@@ -622,70 +620,82 @@ class Qe extends He {
|
|
|
622
620
|
const t = this._trackLinks[this._trackCount];
|
|
623
621
|
t.node = e, t.version = e.version;
|
|
624
622
|
} else
|
|
625
|
-
this._trackLinks.push(new
|
|
623
|
+
this._trackLinks.push(new de(e, e.version));
|
|
626
624
|
this._trackCount++;
|
|
627
625
|
}
|
|
628
626
|
}
|
|
629
627
|
_commitDeps(e) {
|
|
630
|
-
this._trackLinks.length = this._trackCount,
|
|
628
|
+
this._trackLinks.length = this._trackCount, ct(this._trackLinks, e, this), this._links = this._trackLinks;
|
|
629
|
+
}
|
|
630
|
+
_updateErrorDepCount() {
|
|
631
|
+
let e = 0;
|
|
632
|
+
const t = this._links;
|
|
633
|
+
for (let s = 0, i = t.length; s < i; s++) {
|
|
634
|
+
const r = t[s]?.node;
|
|
635
|
+
r && r.flags & d.HAS_ERROR && e++;
|
|
636
|
+
}
|
|
637
|
+
this._errorDepCount = e;
|
|
631
638
|
}
|
|
632
639
|
_recompute() {
|
|
633
640
|
if (this.flags & d.RECOMPUTING) return;
|
|
634
641
|
this.flags |= d.RECOMPUTING;
|
|
635
642
|
const e = this._links;
|
|
636
|
-
this._trackEpoch =
|
|
643
|
+
this._trackEpoch = qe(), this._trackLinks = X.acquire(), this._trackCount = 0;
|
|
637
644
|
let t = !1;
|
|
638
645
|
try {
|
|
639
646
|
const s = M.run(this, this._fn);
|
|
640
|
-
this._commitDeps(e), t = !0,
|
|
647
|
+
this._commitDeps(e), t = !0, this._updateErrorDepCount(), Ge(s) ? this._handleAsyncComputation(s) : this._finalizeResolution(s);
|
|
641
648
|
} catch (s) {
|
|
642
649
|
if (!t)
|
|
643
650
|
try {
|
|
644
|
-
this._commitDeps(e), t = !0;
|
|
645
|
-
} catch {
|
|
651
|
+
this._commitDeps(e), t = !0, this._updateErrorDepCount();
|
|
652
|
+
} catch (i) {
|
|
653
|
+
L && console.warn("[atom-effect] _commitDeps failed during error recovery:", i);
|
|
646
654
|
}
|
|
647
|
-
this._handleError(s,
|
|
655
|
+
this._handleError(s, T.COMPUTED_COMPUTATION_FAILED, !0);
|
|
648
656
|
} finally {
|
|
649
|
-
t && e !==
|
|
657
|
+
t && e !== F ? X.release(e) : t || X.release(this._trackLinks), this._trackEpoch = -1, this._trackLinks = F, this._trackCount = 0, this.flags &= -257;
|
|
650
658
|
}
|
|
651
659
|
}
|
|
652
660
|
_handleAsyncComputation(e) {
|
|
653
|
-
this.flags = (this.flags | d.PENDING) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) %
|
|
661
|
+
this.flags = (this.flags | d.PENDING) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % Fe;
|
|
654
662
|
const t = this._promiseId;
|
|
655
663
|
e.then(
|
|
656
664
|
(s) => {
|
|
657
665
|
if (t === this._promiseId) {
|
|
658
666
|
if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion)
|
|
659
|
-
return this._asyncRetryCount++ <
|
|
660
|
-
new z(
|
|
661
|
-
|
|
667
|
+
return this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(
|
|
668
|
+
new z(
|
|
669
|
+
`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
|
|
670
|
+
),
|
|
671
|
+
T.COMPUTED_ASYNC_COMPUTATION_FAILED
|
|
662
672
|
);
|
|
663
673
|
this._finalizeResolution(s), this._notifySubscribers(s, void 0);
|
|
664
674
|
}
|
|
665
675
|
},
|
|
666
|
-
(s) => t === this._promiseId && this._handleError(s,
|
|
676
|
+
(s) => t === this._promiseId && this._handleError(s, T.COMPUTED_ASYNC_COMPUTATION_FAILED)
|
|
667
677
|
);
|
|
668
678
|
}
|
|
669
679
|
_captureVersionSnapshot() {
|
|
670
680
|
let e = 0;
|
|
671
681
|
const t = this._links;
|
|
672
682
|
for (let s = 0, i = t.length; s < i; s++)
|
|
673
|
-
e = ((e << 5) - e | 0) + t[s].node.version &
|
|
683
|
+
e = ((e << 5) - e | 0) + t[s].node.version & oe;
|
|
674
684
|
return e;
|
|
675
685
|
}
|
|
676
686
|
_handleError(e, t, s = !1) {
|
|
677
|
-
const i =
|
|
678
|
-
if (!s && !(this.flags & d.REJECTED) && (this.version = this.version
|
|
687
|
+
const i = Z(e, z, t);
|
|
688
|
+
if (!s && !(this.flags & d.REJECTED) && (this.version = De(this.version)), this._error = i, this.flags = this.flags & -121 | pt, this._onError)
|
|
679
689
|
try {
|
|
680
690
|
this._onError(i);
|
|
681
|
-
} catch (
|
|
682
|
-
console.error(
|
|
691
|
+
} catch (r) {
|
|
692
|
+
console.error(T.CALLBACK_ERROR_IN_ERROR_HANDLER, r);
|
|
683
693
|
}
|
|
684
694
|
if (s) throw i;
|
|
685
695
|
this._notifySubscribers(void 0, void 0);
|
|
686
696
|
}
|
|
687
697
|
_finalizeResolution(e) {
|
|
688
|
-
(!(this.flags & d.RESOLVED) || !this._equal(this._value, e)) && (this.version = this.version
|
|
698
|
+
(!(this.flags & d.RESOLVED) || !this._equal(this._value, e)) && (this.version = De(this.version)), this._value = e, this._error = null, this.flags = (this.flags | d.RESOLVED) & -697, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
689
699
|
}
|
|
690
700
|
execute() {
|
|
691
701
|
this._markDirty();
|
|
@@ -695,40 +705,46 @@ class Qe extends He {
|
|
|
695
705
|
this.flags & (d.RECOMPUTING | d.DIRTY) || (this.flags |= d.DIRTY, this._notifySubscribers(void 0, void 0));
|
|
696
706
|
}
|
|
697
707
|
}
|
|
698
|
-
Object.freeze(
|
|
699
|
-
function
|
|
700
|
-
return new
|
|
708
|
+
Object.freeze(Ye.prototype);
|
|
709
|
+
function Et(n, e = {}) {
|
|
710
|
+
return new Ye(n, e);
|
|
701
711
|
}
|
|
702
|
-
class
|
|
712
|
+
class gt extends je {
|
|
703
713
|
constructor(e, t = {}) {
|
|
704
|
-
super(), this._cleanup = null, this._links =
|
|
714
|
+
super(), this._cleanup = null, this._links = F, this._nextLinks = null, this._parkedUnsubs = null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._executionCount = 0, this._historyPtr = 0, this._execId = 0, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? q.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? q.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1;
|
|
705
715
|
const s = Number.isFinite(this._maxExecutions), i = s ? Math.min(this._maxExecutions + 1, q.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
|
|
706
|
-
this._historyCapacity = i, this._history =
|
|
716
|
+
this._historyCapacity = i, this._history = L && s && i > 0 ? new Array(i).fill(0) : null, W.attachDebugInfo(this, "effect", this.id);
|
|
707
717
|
}
|
|
708
718
|
run() {
|
|
709
719
|
if (this.flags & P.DISPOSED)
|
|
710
|
-
throw new
|
|
720
|
+
throw new Y(T.EFFECT_DISPOSED);
|
|
711
721
|
this.execute(!0);
|
|
712
722
|
}
|
|
713
723
|
dispose() {
|
|
714
|
-
this.flags & P.DISPOSED || (this.flags |= P.DISPOSED, this._execCleanup(), this._releaseLinks(this._links), this._links =
|
|
724
|
+
this.flags & P.DISPOSED || (this.flags |= P.DISPOSED, this._execCleanup(), this._releaseLinks(this._links), this._links = F, this._executeTask = void 0);
|
|
715
725
|
}
|
|
716
726
|
addDependency(e) {
|
|
717
727
|
if (!(this.flags & P.EXECUTING) || e._lastSeenEpoch === this._currentEpoch) return;
|
|
718
728
|
e._lastSeenEpoch = this._currentEpoch;
|
|
719
|
-
const t = this._nextLinks;
|
|
720
|
-
if (
|
|
721
|
-
t.push(new
|
|
729
|
+
const t = this._nextLinks, s = this._parkedUnsubs?.get(e);
|
|
730
|
+
if (s) {
|
|
731
|
+
t.push(new de(e, e.version, s)), this._parkedUnsubs.delete(e);
|
|
722
732
|
return;
|
|
723
733
|
}
|
|
724
734
|
try {
|
|
725
|
-
const
|
|
735
|
+
const i = e.subscribe(() => {
|
|
726
736
|
if (this._trackModifications && this.flags & P.EXECUTING && (e._modifiedAtEpoch = this._currentEpoch), this._sync) return this.execute();
|
|
727
|
-
this._executeTask || (this._executeTask = () => this.execute()),
|
|
737
|
+
this._executeTask || (this._executeTask = () => this.execute()), re.schedule(this._executeTask);
|
|
728
738
|
});
|
|
729
|
-
t.push(new
|
|
730
|
-
} catch (
|
|
731
|
-
|
|
739
|
+
t.push(new de(e, e.version, i));
|
|
740
|
+
} catch (i) {
|
|
741
|
+
const r = Z(i, Y, T.EFFECT_EXECUTION_FAILED);
|
|
742
|
+
if (console.error(r), this._onError)
|
|
743
|
+
try {
|
|
744
|
+
this._onError(r);
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
t.push(new de(e, e.version, void 0));
|
|
732
748
|
}
|
|
733
749
|
}
|
|
734
750
|
/**
|
|
@@ -738,19 +754,22 @@ class ht extends Ve {
|
|
|
738
754
|
if (this.flags & (P.DISPOSED | P.EXECUTING) || !e && this._links.length > 0 && !this._isDirty()) return;
|
|
739
755
|
this._checkInfiniteLoops(), this.flags |= P.EXECUTING, this._execCleanup();
|
|
740
756
|
const t = this._links;
|
|
741
|
-
if (t !==
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
757
|
+
if (t !== F) {
|
|
758
|
+
const r = /* @__PURE__ */ new Map();
|
|
759
|
+
for (let o = 0, c = t.length; o < c; o++) {
|
|
760
|
+
const a = t[o];
|
|
761
|
+
a?.unsub && r.set(a.node, a.unsub);
|
|
745
762
|
}
|
|
763
|
+
this._parkedUnsubs = r;
|
|
764
|
+
}
|
|
746
765
|
const s = X.acquire();
|
|
747
|
-
this._nextLinks = s, this._currentEpoch =
|
|
766
|
+
this._nextLinks = s, this._currentEpoch = qe();
|
|
748
767
|
let i = !1;
|
|
749
768
|
try {
|
|
750
|
-
const
|
|
751
|
-
this._links = s, i = !0, this._checkLoopWarnings(),
|
|
752
|
-
} catch (
|
|
753
|
-
i = !0, this._handleExecutionError(
|
|
769
|
+
const r = M.run(this, this._fn);
|
|
770
|
+
this._links = s, i = !0, this._checkLoopWarnings(), Ge(r) ? this._handleAsyncResult(r) : this._cleanup = typeof r == "function" ? r : null;
|
|
771
|
+
} catch (r) {
|
|
772
|
+
i = !0, this._handleExecutionError(r), this._cleanup = null;
|
|
754
773
|
} finally {
|
|
755
774
|
this._finalizeDependencies(i, t, s), this.flags &= -9;
|
|
756
775
|
}
|
|
@@ -764,7 +783,7 @@ class ht extends Ve {
|
|
|
764
783
|
try {
|
|
765
784
|
s();
|
|
766
785
|
} catch (i) {
|
|
767
|
-
this._handleExecutionError(i,
|
|
786
|
+
this._handleExecutionError(i, T.EFFECT_CLEANUP_FAILED);
|
|
768
787
|
}
|
|
769
788
|
return;
|
|
770
789
|
}
|
|
@@ -775,19 +794,16 @@ class ht extends Ve {
|
|
|
775
794
|
}
|
|
776
795
|
_finalizeDependencies(e, t, s) {
|
|
777
796
|
if (this._nextLinks = null, e) {
|
|
778
|
-
if (
|
|
779
|
-
for (
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
} else if (this._releaseLinks(s), X.release(s), t !== L)
|
|
786
|
-
for (let i = 0, o = t.length; i < o; i++)
|
|
787
|
-
t[i] && (t[i].node._tempUnsub = void 0);
|
|
797
|
+
if (this._parkedUnsubs)
|
|
798
|
+
for (const i of this._parkedUnsubs.values())
|
|
799
|
+
i();
|
|
800
|
+
t !== F && X.release(t);
|
|
801
|
+
} else
|
|
802
|
+
this._releaseLinks(s), X.release(s);
|
|
803
|
+
this._parkedUnsubs = null;
|
|
788
804
|
}
|
|
789
805
|
_releaseLinks(e) {
|
|
790
|
-
if (e !==
|
|
806
|
+
if (e !== F) {
|
|
791
807
|
for (let t = 0, s = e.length; t < s; t++)
|
|
792
808
|
e[t]?.unsub?.();
|
|
793
809
|
X.release(e);
|
|
@@ -798,16 +814,14 @@ class ht extends Ve {
|
|
|
798
814
|
M.current = null;
|
|
799
815
|
try {
|
|
800
816
|
for (let s = 0, i = e.length; s < i; s++) {
|
|
801
|
-
const
|
|
802
|
-
if (
|
|
803
|
-
if ("value" in r) {
|
|
817
|
+
const r = e[s], o = r.node;
|
|
818
|
+
if (o.flags & d.IS_COMPUTED)
|
|
804
819
|
try {
|
|
805
|
-
|
|
820
|
+
o.value;
|
|
806
821
|
} catch {
|
|
807
|
-
return !0;
|
|
822
|
+
return L && console.warn(`[atom-effect] Dependency #${o.id} threw during dirty check`), !0;
|
|
808
823
|
}
|
|
809
|
-
|
|
810
|
-
}
|
|
824
|
+
if (o.version !== r.version) return !0;
|
|
811
825
|
}
|
|
812
826
|
return !1;
|
|
813
827
|
} finally {
|
|
@@ -819,22 +833,20 @@ class ht extends Ve {
|
|
|
819
833
|
try {
|
|
820
834
|
this._cleanup();
|
|
821
835
|
} catch (e) {
|
|
822
|
-
this._handleExecutionError(e,
|
|
836
|
+
this._handleExecutionError(e, T.EFFECT_CLEANUP_FAILED);
|
|
823
837
|
}
|
|
824
838
|
this._cleanup = null;
|
|
825
839
|
}
|
|
826
840
|
}
|
|
827
841
|
_checkInfiniteLoops() {
|
|
828
|
-
const e =
|
|
829
|
-
if (this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"),
|
|
842
|
+
const e = Te;
|
|
843
|
+
if (this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ut() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history) {
|
|
830
844
|
const t = Date.now();
|
|
831
845
|
this._history[this._historyPtr] = t, this._historyPtr = (this._historyPtr + 1) % this._historyCapacity;
|
|
832
846
|
const s = this._history[this._historyPtr] || 0;
|
|
833
|
-
if (s > 0 && t - s <
|
|
834
|
-
const i = new
|
|
835
|
-
|
|
836
|
-
);
|
|
837
|
-
if (this.dispose(), this._handleExecutionError(i), T) throw i;
|
|
847
|
+
if (s > 0 && t - s < et.ONE_SECOND_MS) {
|
|
848
|
+
const i = new Y(T.EFFECT_FREQUENCY_LIMIT_EXCEEDED);
|
|
849
|
+
if (this.dispose(), this._handleExecutionError(i), L) throw i;
|
|
838
850
|
}
|
|
839
851
|
}
|
|
840
852
|
}
|
|
@@ -848,53 +860,53 @@ class ht extends Ve {
|
|
|
848
860
|
return (this.flags & P.EXECUTING) !== 0;
|
|
849
861
|
}
|
|
850
862
|
_throwInfiniteLoopError(e) {
|
|
851
|
-
const t = new
|
|
852
|
-
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
863
|
+
const t = new Y(
|
|
864
|
+
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${we}`
|
|
853
865
|
);
|
|
854
866
|
throw this.dispose(), console.error(t), t;
|
|
855
867
|
}
|
|
856
|
-
_handleExecutionError(e, t =
|
|
857
|
-
const s =
|
|
868
|
+
_handleExecutionError(e, t = T.EFFECT_EXECUTION_FAILED) {
|
|
869
|
+
const s = Z(e, Y, t);
|
|
858
870
|
if (console.error(s), this._onError)
|
|
859
871
|
try {
|
|
860
872
|
this._onError(s);
|
|
861
873
|
} catch (i) {
|
|
862
|
-
console.error(
|
|
874
|
+
console.error(Z(i, Y, T.CALLBACK_ERROR_IN_ERROR_HANDLER));
|
|
863
875
|
}
|
|
864
876
|
}
|
|
865
877
|
_checkLoopWarnings() {
|
|
866
|
-
if (this._trackModifications &&
|
|
878
|
+
if (this._trackModifications && W.enabled) {
|
|
867
879
|
const e = this._currentEpoch, t = this._links;
|
|
868
880
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
869
|
-
const
|
|
870
|
-
|
|
881
|
+
const r = t[s].node;
|
|
882
|
+
r._modifiedAtEpoch === e && W.warn(
|
|
871
883
|
!0,
|
|
872
|
-
`Effect is reading a dependency (${
|
|
884
|
+
`Effect is reading a dependency (${W.getDebugName(r) || "unknown"}) that it just modified. Infinite loop may occur`
|
|
873
885
|
);
|
|
874
886
|
}
|
|
875
887
|
}
|
|
876
888
|
}
|
|
877
889
|
}
|
|
878
|
-
function
|
|
890
|
+
function B(n, e = {}) {
|
|
879
891
|
if (typeof n != "function")
|
|
880
|
-
throw new
|
|
881
|
-
const t = new
|
|
892
|
+
throw new Y(T.EFFECT_MUST_BE_FUNCTION);
|
|
893
|
+
const t = new gt(n, e);
|
|
882
894
|
return t.execute(), t;
|
|
883
895
|
}
|
|
884
|
-
function
|
|
896
|
+
function Re(n) {
|
|
885
897
|
if (typeof n != "function")
|
|
886
898
|
throw new TypeError("Batch callback must be a function");
|
|
887
|
-
|
|
899
|
+
re.startBatch();
|
|
888
900
|
try {
|
|
889
901
|
return n();
|
|
890
902
|
} finally {
|
|
891
|
-
|
|
903
|
+
re.endBatch();
|
|
892
904
|
}
|
|
893
905
|
}
|
|
894
|
-
function
|
|
906
|
+
function mt(n) {
|
|
895
907
|
return n !== null && typeof n == "object" && "value" in n && "subscribe" in n;
|
|
896
908
|
}
|
|
897
|
-
function
|
|
909
|
+
function be(n) {
|
|
898
910
|
if (!n) return "unknown";
|
|
899
911
|
const e = "jquery" in n ? n[0] : n;
|
|
900
912
|
if (!e) return "unknown";
|
|
@@ -902,45 +914,81 @@ function pe(n) {
|
|
|
902
914
|
if (t && typeof t == "string") return `#${t}`;
|
|
903
915
|
const s = e.tagName.toLowerCase(), i = e.classList;
|
|
904
916
|
if (i && i.length > 0) {
|
|
905
|
-
let
|
|
906
|
-
for (let
|
|
907
|
-
const a = i[
|
|
908
|
-
a && (
|
|
917
|
+
let r = s;
|
|
918
|
+
for (let o = 0, c = i.length; o < c; o++) {
|
|
919
|
+
const a = i[o];
|
|
920
|
+
a && (r += `.${a}`);
|
|
909
921
|
}
|
|
910
|
-
return
|
|
922
|
+
return r;
|
|
911
923
|
}
|
|
912
924
|
return s;
|
|
913
925
|
}
|
|
914
|
-
function
|
|
926
|
+
function se(n) {
|
|
927
|
+
let e = String(n ?? "");
|
|
928
|
+
e = e.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, ""), e = e.replace(/<\?[\s\S]*?\?>/g, "");
|
|
929
|
+
const t = /(<(script|iframe|object|embed|base|meta|applet|noscript)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript)\b[^>]*\/?>)/gim;
|
|
930
|
+
let s;
|
|
931
|
+
do
|
|
932
|
+
s = e, e = e.replace(t, "");
|
|
933
|
+
while (e !== s);
|
|
934
|
+
const i = /(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;
|
|
935
|
+
e = e.replace(i, "data-unsafe-protocol:");
|
|
936
|
+
const r = /data\s*:\s*(?:text\/html|application\/javascript|text\/javascript|text\/vbscript|text\/xml|application\/xhtml\+xml)/gim;
|
|
937
|
+
return e = e.replace(r, "data-unsafe-protocol:"), e = e.replace(/\bon\w+\s*=/gim, "data-unsafe-attr="), e = e.replace(/expression\s*\(/gim, "data-unsafe-css(").replace(/behavior\s*:/gim, "data-unsafe-css:"), e;
|
|
938
|
+
}
|
|
939
|
+
const yt = /* @__PURE__ */ new Set([
|
|
940
|
+
"href",
|
|
941
|
+
"src",
|
|
942
|
+
"action",
|
|
943
|
+
"formaction",
|
|
944
|
+
"xlink:href",
|
|
945
|
+
"data",
|
|
946
|
+
"poster",
|
|
947
|
+
"srcset",
|
|
948
|
+
"background",
|
|
949
|
+
"cite",
|
|
950
|
+
"longdesc",
|
|
951
|
+
"profile",
|
|
952
|
+
"usemap",
|
|
953
|
+
"classid",
|
|
954
|
+
"codebase"
|
|
955
|
+
]), bt = /^\s*(?:javascript|vbscript)\s*:/i;
|
|
956
|
+
function We(n, e) {
|
|
957
|
+
return yt.has(n.toLowerCase()) ? bt.test(e) : !1;
|
|
958
|
+
}
|
|
959
|
+
function ke(n) {
|
|
960
|
+
return n.toLowerCase().includes("url(") ? /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i.test(n) : !1;
|
|
961
|
+
}
|
|
962
|
+
function Ct(n) {
|
|
915
963
|
const e = n.length;
|
|
916
964
|
if (e === 0) return new Int32Array(0);
|
|
917
965
|
const t = new Int32Array(e), s = new Int32Array(e);
|
|
918
966
|
let i = 0;
|
|
919
|
-
for (let
|
|
920
|
-
const c = n[
|
|
967
|
+
for (let o = 0; o < e; o++) {
|
|
968
|
+
const c = n[o];
|
|
921
969
|
if (c === void 0 || c === -1) continue;
|
|
922
970
|
const a = i > 0 ? s[i - 1] : void 0;
|
|
923
971
|
if (i === 0 || a !== void 0 && (n[a] ?? -1) < c) {
|
|
924
|
-
t[
|
|
972
|
+
t[o] = a ?? -1, s[i++] = o;
|
|
925
973
|
continue;
|
|
926
974
|
}
|
|
927
|
-
let
|
|
928
|
-
for (;
|
|
929
|
-
const I =
|
|
930
|
-
O !== void 0 && (n[O] ?? -1) < c ?
|
|
975
|
+
let _ = 0, g = i - 1;
|
|
976
|
+
for (; _ < g; ) {
|
|
977
|
+
const I = _ + g >>> 1, O = s[I];
|
|
978
|
+
O !== void 0 && (n[O] ?? -1) < c ? _ = I + 1 : g = I;
|
|
931
979
|
}
|
|
932
|
-
const
|
|
933
|
-
|
|
980
|
+
const v = s[_];
|
|
981
|
+
v !== void 0 && c < (n[v] ?? Number.MAX_SAFE_INTEGER) && (_ > 0 && (t[o] = s[_ - 1] ?? -1), s[_] = o);
|
|
934
982
|
}
|
|
935
|
-
const
|
|
983
|
+
const r = new Int32Array(i);
|
|
936
984
|
if (i > 0) {
|
|
937
|
-
let
|
|
938
|
-
for (let c = i - 1; c >= 0 &&
|
|
939
|
-
|
|
985
|
+
let o = s[i - 1];
|
|
986
|
+
for (let c = i - 1; c >= 0 && o !== void 0 && o !== -1; c--)
|
|
987
|
+
r[c] = o, o = t[o];
|
|
940
988
|
}
|
|
941
|
-
return
|
|
989
|
+
return r;
|
|
942
990
|
}
|
|
943
|
-
function
|
|
991
|
+
function It() {
|
|
944
992
|
if (typeof window < "u") {
|
|
945
993
|
const n = window.__ATOM_DEBUG__;
|
|
946
994
|
if (typeof n == "boolean") return n;
|
|
@@ -951,19 +999,19 @@ function _t() {
|
|
|
951
999
|
}
|
|
952
1000
|
return !1;
|
|
953
1001
|
}
|
|
954
|
-
let
|
|
955
|
-
const
|
|
1002
|
+
let Q = It();
|
|
1003
|
+
const b = {
|
|
956
1004
|
get enabled() {
|
|
957
|
-
return
|
|
1005
|
+
return Q;
|
|
958
1006
|
},
|
|
959
1007
|
set enabled(n) {
|
|
960
|
-
|
|
1008
|
+
Q = n;
|
|
961
1009
|
},
|
|
962
1010
|
log(n, ...e) {
|
|
963
|
-
|
|
1011
|
+
Q && console.log(`[atom-effect-jquery] ${n}:`, ...e);
|
|
964
1012
|
},
|
|
965
1013
|
atomChanged(n, e, t) {
|
|
966
|
-
|
|
1014
|
+
Q && console.log(
|
|
967
1015
|
`[atom-effect-jquery] Atom "${n ?? "anonymous"}" changed:`,
|
|
968
1016
|
e,
|
|
969
1017
|
"→",
|
|
@@ -974,20 +1022,20 @@ const m = {
|
|
|
974
1022
|
* Logs DOM updates and triggers visual highlight.
|
|
975
1023
|
*/
|
|
976
1024
|
domUpdated(n, e, t) {
|
|
977
|
-
|
|
1025
|
+
Q && (console.log(`[atom-effect-jquery] DOM updated: ${be(n)}.${e} =`, t), St(n));
|
|
978
1026
|
},
|
|
979
1027
|
cleanup(n) {
|
|
980
|
-
|
|
1028
|
+
Q && console.log(`[atom-effect-jquery] Cleanup: ${n}`);
|
|
981
1029
|
},
|
|
982
1030
|
warn(...n) {
|
|
983
|
-
|
|
1031
|
+
Q && console.warn("[atom-effect-jquery]", ...n);
|
|
984
1032
|
}
|
|
985
|
-
},
|
|
986
|
-
function
|
|
1033
|
+
}, Ie = /* @__PURE__ */ new WeakMap();
|
|
1034
|
+
function St(n) {
|
|
987
1035
|
const e = "jquery" in n ? n[0] : n;
|
|
988
1036
|
if (!e || !e.isConnected) return;
|
|
989
|
-
let t =
|
|
990
|
-
if (t || (t = {},
|
|
1037
|
+
let t = Ie.get(e);
|
|
1038
|
+
if (t || (t = {}, Ie.set(e, t)), t.timer && clearTimeout(t.timer), t.cleanupTimer && clearTimeout(t.cleanupTimer), !t.orgStyle) {
|
|
991
1039
|
const i = e.style;
|
|
992
1040
|
t.orgStyle = {
|
|
993
1041
|
outline: i.outline,
|
|
@@ -1001,40 +1049,40 @@ function Et(n) {
|
|
|
1001
1049
|
if (!e.isConnected) return;
|
|
1002
1050
|
const i = t?.orgStyle;
|
|
1003
1051
|
i && (s.outline = i.outline, s.outlineOffset = i.outlineOffset), t.cleanupTimer = setTimeout(() => {
|
|
1004
|
-
e.isConnected && t?.orgStyle && (s.transition = t.orgStyle.transition),
|
|
1052
|
+
e.isConnected && t?.orgStyle && (s.transition = t.orgStyle.transition), Ie.delete(e);
|
|
1005
1053
|
}, 500);
|
|
1006
1054
|
}));
|
|
1007
1055
|
}, 100);
|
|
1008
1056
|
}
|
|
1009
|
-
const
|
|
1010
|
-
function
|
|
1011
|
-
const t =
|
|
1012
|
-
return e.name &&
|
|
1057
|
+
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1058
|
+
function Ke(n, e = {}) {
|
|
1059
|
+
const t = Xe(n, e);
|
|
1060
|
+
return e.name && Dt.set(t, { name: e.name }), t;
|
|
1013
1061
|
}
|
|
1014
|
-
Object.defineProperty(
|
|
1062
|
+
Object.defineProperty(Ke, "debug", {
|
|
1015
1063
|
get() {
|
|
1016
|
-
return
|
|
1064
|
+
return b.enabled;
|
|
1017
1065
|
},
|
|
1018
1066
|
set(n) {
|
|
1019
|
-
|
|
1067
|
+
b.enabled = n;
|
|
1020
1068
|
}
|
|
1021
1069
|
});
|
|
1022
|
-
function
|
|
1070
|
+
function Tt() {
|
|
1023
1071
|
return new Promise((n) => setTimeout(n, 0));
|
|
1024
1072
|
}
|
|
1025
1073
|
l.extend({
|
|
1026
|
-
atom:
|
|
1027
|
-
computed:
|
|
1028
|
-
effect:
|
|
1029
|
-
batch:
|
|
1030
|
-
untracked:
|
|
1031
|
-
isAtom:
|
|
1032
|
-
isComputed:
|
|
1033
|
-
isReactive: (n) =>
|
|
1034
|
-
nextTick:
|
|
1074
|
+
atom: Ke,
|
|
1075
|
+
computed: Et,
|
|
1076
|
+
effect: B,
|
|
1077
|
+
batch: Re,
|
|
1078
|
+
untracked: ht,
|
|
1079
|
+
isAtom: ve,
|
|
1080
|
+
isComputed: Pe,
|
|
1081
|
+
isReactive: (n) => ve(n) || Pe(n),
|
|
1082
|
+
nextTick: Tt
|
|
1035
1083
|
});
|
|
1036
|
-
const
|
|
1037
|
-
class
|
|
1084
|
+
const he = "_aes-bound";
|
|
1085
|
+
class vt {
|
|
1038
1086
|
records = /* @__PURE__ */ new WeakMap();
|
|
1039
1087
|
boundElements = /* @__PURE__ */ new WeakSet();
|
|
1040
1088
|
preservedNodes = /* @__PURE__ */ new WeakSet();
|
|
@@ -1054,7 +1102,7 @@ class mt {
|
|
|
1054
1102
|
}
|
|
1055
1103
|
_getOrCreateRecord(e) {
|
|
1056
1104
|
let t = this.records.get(e);
|
|
1057
|
-
return t || (t = {}, this.records.set(e, t), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(
|
|
1105
|
+
return t || (t = {}, this.records.set(e, t), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(he))), t;
|
|
1058
1106
|
}
|
|
1059
1107
|
trackEffect(e, t) {
|
|
1060
1108
|
const s = this._getOrCreateRecord(e);
|
|
@@ -1071,123 +1119,123 @@ class mt {
|
|
|
1071
1119
|
if (!this.boundElements.delete(e)) return;
|
|
1072
1120
|
const t = this.records.get(e);
|
|
1073
1121
|
if (!t) return;
|
|
1074
|
-
this.records.delete(e), this.preservedNodes.delete(e), this.ignoredNodes.delete(e), e.classList.remove(
|
|
1122
|
+
this.records.delete(e), this.preservedNodes.delete(e), this.ignoredNodes.delete(e), e.classList.remove(he), b.enabled && b.cleanup(be(e));
|
|
1075
1123
|
const s = t.effects;
|
|
1076
1124
|
if (s)
|
|
1077
|
-
for (let
|
|
1125
|
+
for (let r = 0, o = s.length; r < o; r++)
|
|
1078
1126
|
try {
|
|
1079
|
-
s[
|
|
1127
|
+
s[r]?.dispose();
|
|
1080
1128
|
} catch (c) {
|
|
1081
|
-
|
|
1129
|
+
b.warn("Effect dispose error:", c);
|
|
1082
1130
|
}
|
|
1083
1131
|
const i = t.cleanups;
|
|
1084
1132
|
if (i)
|
|
1085
|
-
for (let
|
|
1133
|
+
for (let r = 0, o = i.length; r < o; r++)
|
|
1086
1134
|
try {
|
|
1087
|
-
i[
|
|
1135
|
+
i[r]?.();
|
|
1088
1136
|
} catch (c) {
|
|
1089
|
-
|
|
1137
|
+
b.warn("Cleanup error:", c);
|
|
1090
1138
|
}
|
|
1091
1139
|
}
|
|
1092
1140
|
cleanupDescendants(e) {
|
|
1093
|
-
const t = e.querySelectorAll(`.${
|
|
1141
|
+
const t = e.querySelectorAll(`.${he}`);
|
|
1094
1142
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1143
|
+
const r = t[s];
|
|
1144
|
+
r && this.boundElements.has(r) ? this.cleanup(r) : r && r.classList.remove(he);
|
|
1097
1145
|
}
|
|
1098
1146
|
}
|
|
1099
1147
|
cleanupTree(e) {
|
|
1100
1148
|
this.cleanupDescendants(e), this.cleanup(e);
|
|
1101
1149
|
}
|
|
1102
1150
|
}
|
|
1103
|
-
const y = new
|
|
1151
|
+
const y = new vt();
|
|
1104
1152
|
let ie = null;
|
|
1105
|
-
function
|
|
1153
|
+
function kt(n = document.body) {
|
|
1106
1154
|
ie || (ie = new MutationObserver((e) => {
|
|
1107
1155
|
for (let t = 0, s = e.length; t < s; t++) {
|
|
1108
1156
|
const i = e[t]?.removedNodes;
|
|
1109
1157
|
if (!i) continue;
|
|
1110
|
-
const
|
|
1111
|
-
if (
|
|
1112
|
-
for (let
|
|
1113
|
-
const c = i[
|
|
1158
|
+
const r = i.length;
|
|
1159
|
+
if (r !== 0)
|
|
1160
|
+
for (let o = 0; o < r; o++) {
|
|
1161
|
+
const c = i[o];
|
|
1114
1162
|
c.nodeType === 1 && (c.isConnected || y.isKept(c) || y.isIgnored(c) || y.cleanupTree(c));
|
|
1115
1163
|
}
|
|
1116
1164
|
}
|
|
1117
1165
|
}), ie.observe(n, { childList: !0, subtree: !0 }));
|
|
1118
1166
|
}
|
|
1119
|
-
function
|
|
1167
|
+
function zt() {
|
|
1120
1168
|
ie?.disconnect(), ie = null;
|
|
1121
1169
|
}
|
|
1122
1170
|
function k(n, e, t, s) {
|
|
1123
|
-
|
|
1171
|
+
mt(e) ? y.trackEffect(
|
|
1124
1172
|
n,
|
|
1125
|
-
|
|
1173
|
+
B(() => {
|
|
1126
1174
|
const i = e.value;
|
|
1127
|
-
t(i),
|
|
1175
|
+
t(i), b.domUpdated(l(n), s, i);
|
|
1128
1176
|
})
|
|
1129
|
-
) : (t(e),
|
|
1177
|
+
) : (t(e), b.domUpdated(l(n), s, e));
|
|
1130
1178
|
}
|
|
1131
|
-
var
|
|
1132
|
-
function
|
|
1179
|
+
var D = /* @__PURE__ */ ((n) => (n[n.None = 0] = "None", n[n.Focused = 1] = "Focused", n[n.Composing = 2] = "Composing", n[n.SyncingToAtom = 4] = "SyncingToAtom", n[n.SyncingToDom = 8] = "SyncingToDom", n[n.Busy = 14] = "Busy", n))(D || {});
|
|
1180
|
+
function Ne() {
|
|
1133
1181
|
return {
|
|
1134
1182
|
timeoutId: null,
|
|
1135
1183
|
flags: 0
|
|
1136
1184
|
/* None */
|
|
1137
1185
|
};
|
|
1138
1186
|
}
|
|
1139
|
-
function
|
|
1187
|
+
function Je(n, e, t = {}) {
|
|
1140
1188
|
const {
|
|
1141
1189
|
debounce: s,
|
|
1142
1190
|
event: i = "input",
|
|
1143
|
-
parse:
|
|
1144
|
-
format:
|
|
1191
|
+
parse: r = (w) => w,
|
|
1192
|
+
format: o = (w) => String(w ?? ""),
|
|
1145
1193
|
equal: c = Object.is
|
|
1146
|
-
} = t, a =
|
|
1147
|
-
if (!(a.flags &
|
|
1148
|
-
a.flags |=
|
|
1194
|
+
} = t, a = Ne(), _ = n[0], g = () => {
|
|
1195
|
+
if (!(a.flags & D.Busy)) {
|
|
1196
|
+
a.flags |= D.SyncingToAtom;
|
|
1149
1197
|
try {
|
|
1150
|
-
const
|
|
1151
|
-
c(e.value,
|
|
1198
|
+
const w = _.value, R = r(w);
|
|
1199
|
+
c(e.value, R) || (e.value = R);
|
|
1152
1200
|
} finally {
|
|
1153
|
-
a.flags &= ~
|
|
1201
|
+
a.flags &= ~D.SyncingToAtom;
|
|
1154
1202
|
}
|
|
1155
1203
|
}
|
|
1156
|
-
},
|
|
1157
|
-
a.timeoutId && (clearTimeout(a.timeoutId), a.timeoutId = null,
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1204
|
+
}, v = () => {
|
|
1205
|
+
a.timeoutId && (clearTimeout(a.timeoutId), a.timeoutId = null, g()), a.flags &= ~D.Focused;
|
|
1206
|
+
const w = o(e.value);
|
|
1207
|
+
_.value !== w && (_.value = w);
|
|
1160
1208
|
}, I = () => {
|
|
1161
|
-
a.flags &
|
|
1209
|
+
a.flags & D.Busy || (s ? (a.timeoutId && clearTimeout(a.timeoutId), a.timeoutId = setTimeout(g, s)) : g());
|
|
1162
1210
|
}, O = {
|
|
1163
1211
|
compositionstart: () => {
|
|
1164
|
-
a.flags |=
|
|
1212
|
+
a.flags |= D.Composing;
|
|
1165
1213
|
},
|
|
1166
1214
|
compositionend: () => {
|
|
1167
|
-
a.flags &= ~
|
|
1215
|
+
a.flags &= ~D.Composing, g();
|
|
1168
1216
|
},
|
|
1169
1217
|
focus: () => {
|
|
1170
|
-
a.flags |=
|
|
1218
|
+
a.flags |= D.Focused;
|
|
1171
1219
|
},
|
|
1172
|
-
blur:
|
|
1220
|
+
blur: v,
|
|
1173
1221
|
[i]: I,
|
|
1174
1222
|
change: I
|
|
1175
1223
|
};
|
|
1176
1224
|
return n.on(O), { effect: () => {
|
|
1177
|
-
const
|
|
1178
|
-
if (
|
|
1179
|
-
a.flags |=
|
|
1225
|
+
const w = e.value, R = o(w), A = _.value;
|
|
1226
|
+
if (A !== R && !(a.flags & D.Focused && c(r(A), w))) {
|
|
1227
|
+
a.flags |= D.SyncingToDom;
|
|
1180
1228
|
try {
|
|
1181
|
-
if (a.flags &
|
|
1182
|
-
const { selectionStart: x, selectionEnd: K } =
|
|
1183
|
-
|
|
1184
|
-
const U =
|
|
1185
|
-
|
|
1229
|
+
if (a.flags & D.Focused) {
|
|
1230
|
+
const { selectionStart: x, selectionEnd: K } = _;
|
|
1231
|
+
_.value = R;
|
|
1232
|
+
const U = R.length;
|
|
1233
|
+
_.setSelectionRange(Math.min(x ?? U, U), Math.min(K ?? U, U));
|
|
1186
1234
|
} else
|
|
1187
|
-
|
|
1188
|
-
|
|
1235
|
+
_.value = R;
|
|
1236
|
+
b.domUpdated(n, "val", R);
|
|
1189
1237
|
} finally {
|
|
1190
|
-
a.flags &= ~
|
|
1238
|
+
a.flags &= ~D.SyncingToDom;
|
|
1191
1239
|
}
|
|
1192
1240
|
}
|
|
1193
1241
|
}, cleanup: () => {
|
|
@@ -1203,7 +1251,15 @@ l.fn.atomText = function(n, e) {
|
|
|
1203
1251
|
l.fn.atomHtml = function(n) {
|
|
1204
1252
|
return this.each(function() {
|
|
1205
1253
|
const e = l(this);
|
|
1206
|
-
k(
|
|
1254
|
+
k(
|
|
1255
|
+
this,
|
|
1256
|
+
n,
|
|
1257
|
+
(t) => {
|
|
1258
|
+
const s = String(t ?? ""), i = se(s);
|
|
1259
|
+
i !== s && console.warn("[atomHtml] Unsafe content neutralized during sanitization."), e.html(i);
|
|
1260
|
+
},
|
|
1261
|
+
"html"
|
|
1262
|
+
);
|
|
1207
1263
|
});
|
|
1208
1264
|
};
|
|
1209
1265
|
l.fn.atomClass = function(n, e) {
|
|
@@ -1220,11 +1276,18 @@ l.fn.atomClass = function(n, e) {
|
|
|
1220
1276
|
l.fn.atomCss = function(n, e, t) {
|
|
1221
1277
|
return this.each(function() {
|
|
1222
1278
|
const s = l(this);
|
|
1223
|
-
k(this, e,
|
|
1279
|
+
k(this, e, (r) => {
|
|
1280
|
+
const o = t ? `${r}${t}` : r, c = String(o);
|
|
1281
|
+
if (ke(c)) {
|
|
1282
|
+
console.warn(`[atomCss] Blocked dangerous value in "${n}" property.`);
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
s.css(n, o);
|
|
1286
|
+
}, `css.${n}`);
|
|
1224
1287
|
});
|
|
1225
1288
|
};
|
|
1226
1289
|
l.fn.atomAttr = function(n, e) {
|
|
1227
|
-
return this.each(function() {
|
|
1290
|
+
return /^on/i.test(n) ? (console.warn(`[atomAttr] Blocked setting dangerous event handler attribute "${n}".`), this) : this.each(function() {
|
|
1228
1291
|
const t = l(this);
|
|
1229
1292
|
k(
|
|
1230
1293
|
this,
|
|
@@ -1234,16 +1297,23 @@ l.fn.atomAttr = function(n, e) {
|
|
|
1234
1297
|
t.removeAttr(n);
|
|
1235
1298
|
return;
|
|
1236
1299
|
}
|
|
1237
|
-
|
|
1300
|
+
const i = s === !0 ? n : String(s);
|
|
1301
|
+
if (We(n, i)) {
|
|
1302
|
+
console.warn(`[atomAttr] Blocked dangerous protocol in "${n}" attribute.`);
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
t.attr(n, i);
|
|
1238
1306
|
},
|
|
1239
1307
|
`attr.${n}`
|
|
1240
1308
|
);
|
|
1241
1309
|
});
|
|
1242
1310
|
};
|
|
1243
1311
|
l.fn.atomProp = function(n, e) {
|
|
1244
|
-
return
|
|
1245
|
-
|
|
1246
|
-
|
|
1312
|
+
return ["innerHTML", "outerHTML"].includes(n) ? (console.warn(
|
|
1313
|
+
`[atomProp] Blocked setting dangerous property "${n}". Use atomHtml for sanitized HTML binding.`
|
|
1314
|
+
), this) : this.each(function() {
|
|
1315
|
+
const s = l(this);
|
|
1316
|
+
k(this, e, (i) => s.prop(n, i), `prop.${n}`);
|
|
1247
1317
|
});
|
|
1248
1318
|
};
|
|
1249
1319
|
l.fn.atomShow = function(n) {
|
|
@@ -1260,24 +1330,29 @@ l.fn.atomHide = function(n) {
|
|
|
1260
1330
|
};
|
|
1261
1331
|
l.fn.atomVal = function(n, e = {}) {
|
|
1262
1332
|
return this.each(function() {
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1333
|
+
const t = this.tagName.toLowerCase();
|
|
1334
|
+
if (!["input", "select", "textarea"].includes(t)) {
|
|
1335
|
+
console.warn(`[atomVal] Element <${t}> is not a valid input element.`);
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
const { effect: s, cleanup: i } = Je(l(this), n, e);
|
|
1339
|
+
y.trackEffect(this, B(s)), y.trackCleanup(this, i);
|
|
1265
1340
|
});
|
|
1266
1341
|
};
|
|
1267
1342
|
l.fn.atomChecked = function(n) {
|
|
1268
1343
|
return this.each(function() {
|
|
1269
|
-
const e = l(this), t = this, s =
|
|
1270
|
-
if (s.flags &
|
|
1271
|
-
const
|
|
1272
|
-
n.value !==
|
|
1344
|
+
const e = l(this), t = this, s = Ne(), i = () => {
|
|
1345
|
+
if (s.flags & D.Busy) return;
|
|
1346
|
+
const o = t.checked;
|
|
1347
|
+
n.value !== o && (n.value = o);
|
|
1273
1348
|
};
|
|
1274
1349
|
e.on("change", i), y.trackCleanup(this, () => e.off("change", i));
|
|
1275
|
-
const
|
|
1276
|
-
s.flags |=
|
|
1277
|
-
const
|
|
1278
|
-
t.checked !==
|
|
1350
|
+
const r = B(() => {
|
|
1351
|
+
s.flags |= D.SyncingToDom;
|
|
1352
|
+
const o = !!n.value;
|
|
1353
|
+
t.checked !== o && (t.checked = o, b.domUpdated(e, "checked", o)), s.flags &= ~D.SyncingToDom;
|
|
1279
1354
|
});
|
|
1280
|
-
y.trackEffect(this,
|
|
1355
|
+
y.trackEffect(this, r);
|
|
1281
1356
|
});
|
|
1282
1357
|
};
|
|
1283
1358
|
l.fn.atomOn = function(n, e) {
|
|
@@ -1291,12 +1366,12 @@ l.fn.atomUnbind = function() {
|
|
|
1291
1366
|
y.cleanupTree(this);
|
|
1292
1367
|
});
|
|
1293
1368
|
};
|
|
1294
|
-
const
|
|
1295
|
-
function
|
|
1296
|
-
let e =
|
|
1297
|
-
return e || (e = n.includes("-") ? n.replace(/-./g, (t) => t[1].toUpperCase()) : n,
|
|
1369
|
+
const $e = /* @__PURE__ */ Object.create(null);
|
|
1370
|
+
function Ot(n) {
|
|
1371
|
+
let e = $e[n];
|
|
1372
|
+
return e || (e = n.includes("-") ? n.replace(/-./g, (t) => t[1].toUpperCase()) : n, $e[n] = e, e);
|
|
1298
1373
|
}
|
|
1299
|
-
function
|
|
1374
|
+
function wt(n, e) {
|
|
1300
1375
|
const t = n.el;
|
|
1301
1376
|
k(
|
|
1302
1377
|
t,
|
|
@@ -1308,19 +1383,21 @@ function It(n, e) {
|
|
|
1308
1383
|
"text"
|
|
1309
1384
|
);
|
|
1310
1385
|
}
|
|
1311
|
-
function
|
|
1386
|
+
function Rt(n, e) {
|
|
1312
1387
|
const t = n.el;
|
|
1313
1388
|
k(
|
|
1314
1389
|
t,
|
|
1315
1390
|
e,
|
|
1316
1391
|
(s) => {
|
|
1317
|
-
const i = String(s ?? "");
|
|
1318
|
-
|
|
1392
|
+
const i = String(s ?? ""), r = se(i);
|
|
1393
|
+
r !== i && console.warn("[atomBind] Unsafe content neutralized during sanitization.");
|
|
1394
|
+
const o = r;
|
|
1395
|
+
t.innerHTML !== o && (t.innerHTML = o);
|
|
1319
1396
|
},
|
|
1320
1397
|
"html"
|
|
1321
1398
|
);
|
|
1322
1399
|
}
|
|
1323
|
-
function
|
|
1400
|
+
function Nt(n, e) {
|
|
1324
1401
|
for (const t in e)
|
|
1325
1402
|
k(
|
|
1326
1403
|
n.el,
|
|
@@ -1331,32 +1408,46 @@ function St(n, e) {
|
|
|
1331
1408
|
`class.${t}`
|
|
1332
1409
|
);
|
|
1333
1410
|
}
|
|
1334
|
-
function
|
|
1411
|
+
function At(n, e) {
|
|
1335
1412
|
const t = n.el, s = t.style;
|
|
1336
1413
|
for (const i in e) {
|
|
1337
|
-
const
|
|
1338
|
-
if (
|
|
1339
|
-
const
|
|
1340
|
-
Array.isArray(
|
|
1414
|
+
const r = e[i];
|
|
1415
|
+
if (r === void 0) continue;
|
|
1416
|
+
const o = Ot(i);
|
|
1417
|
+
Array.isArray(r) ? k(
|
|
1341
1418
|
t,
|
|
1342
|
-
|
|
1419
|
+
r[0],
|
|
1343
1420
|
(c) => {
|
|
1344
|
-
|
|
1421
|
+
const a = `${c}${r[1]}`;
|
|
1422
|
+
if (ke(a)) {
|
|
1423
|
+
console.warn(`[atomBind] Blocked dangerous value in "${i}" property.`);
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
s[o] = a;
|
|
1345
1427
|
},
|
|
1346
1428
|
`css.${i}`
|
|
1347
1429
|
) : k(
|
|
1348
1430
|
t,
|
|
1349
|
-
|
|
1431
|
+
r,
|
|
1350
1432
|
(c) => {
|
|
1351
|
-
|
|
1433
|
+
const a = String(c);
|
|
1434
|
+
if (ke(a)) {
|
|
1435
|
+
console.warn(`[atomBind] Blocked dangerous value in "${i}" property.`);
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
s[o] = a;
|
|
1352
1439
|
},
|
|
1353
1440
|
`css.${i}`
|
|
1354
1441
|
);
|
|
1355
1442
|
}
|
|
1356
1443
|
}
|
|
1357
|
-
function
|
|
1444
|
+
function Lt(n, e) {
|
|
1358
1445
|
const t = n.el;
|
|
1359
|
-
for (const s in e)
|
|
1446
|
+
for (const s in e) {
|
|
1447
|
+
if (/^on/i.test(s)) {
|
|
1448
|
+
console.warn(`[atomBind] Blocked setting dangerous event handler attribute "${s}".`);
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1360
1451
|
k(
|
|
1361
1452
|
t,
|
|
1362
1453
|
e[s],
|
|
@@ -1365,15 +1456,27 @@ function Tt(n, e) {
|
|
|
1365
1456
|
t.removeAttribute(s);
|
|
1366
1457
|
return;
|
|
1367
1458
|
}
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1459
|
+
const r = i === !0 ? s : String(i);
|
|
1460
|
+
if (We(s, r)) {
|
|
1461
|
+
console.warn(`[atomBind] Blocked dangerous protocol in "${s}" attribute.`);
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
t.getAttribute(s) !== r && t.setAttribute(s, r);
|
|
1370
1465
|
},
|
|
1371
1466
|
`attr.${s}`
|
|
1372
1467
|
);
|
|
1468
|
+
}
|
|
1373
1469
|
}
|
|
1374
|
-
|
|
1470
|
+
const xt = ["innerHTML", "outerHTML"];
|
|
1471
|
+
function Ut(n, e) {
|
|
1375
1472
|
const t = n.el;
|
|
1376
|
-
for (const s in e)
|
|
1473
|
+
for (const s in e) {
|
|
1474
|
+
if (xt.includes(s)) {
|
|
1475
|
+
console.warn(
|
|
1476
|
+
`[atomBind] Blocked setting dangerous property "${s}". Use html binding for sanitized HTML.`
|
|
1477
|
+
);
|
|
1478
|
+
continue;
|
|
1479
|
+
}
|
|
1377
1480
|
k(
|
|
1378
1481
|
n.el,
|
|
1379
1482
|
e[s],
|
|
@@ -1382,60 +1485,66 @@ function vt(n, e) {
|
|
|
1382
1485
|
},
|
|
1383
1486
|
`prop.${s}`
|
|
1384
1487
|
);
|
|
1488
|
+
}
|
|
1385
1489
|
}
|
|
1386
|
-
function
|
|
1490
|
+
function Pt(n, e) {
|
|
1387
1491
|
const t = n.el;
|
|
1388
1492
|
k(
|
|
1389
1493
|
t,
|
|
1390
1494
|
e,
|
|
1391
1495
|
(s) => {
|
|
1392
|
-
t.style.display = s ? "" : "none",
|
|
1496
|
+
t.style.display = s ? "" : "none", b.enabled && b.domUpdated(t, "show", s);
|
|
1393
1497
|
},
|
|
1394
1498
|
"show"
|
|
1395
1499
|
);
|
|
1396
1500
|
}
|
|
1397
|
-
function
|
|
1501
|
+
function Ft(n, e) {
|
|
1398
1502
|
const t = n.el;
|
|
1399
1503
|
k(
|
|
1400
1504
|
t,
|
|
1401
1505
|
e,
|
|
1402
1506
|
(s) => {
|
|
1403
|
-
t.style.display = s ? "none" : "",
|
|
1507
|
+
t.style.display = s ? "none" : "", b.enabled && b.domUpdated(t, "hide", s);
|
|
1404
1508
|
},
|
|
1405
1509
|
"hide"
|
|
1406
1510
|
);
|
|
1407
1511
|
}
|
|
1408
|
-
function
|
|
1409
|
-
const t =
|
|
1512
|
+
function $t(n, e) {
|
|
1513
|
+
const t = n.el.tagName.toLowerCase();
|
|
1514
|
+
if (!["input", "select", "textarea"].includes(t)) {
|
|
1515
|
+
console.warn(`[atomBind] Val binding used on non-input element <${t}>.`);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
const s = Array.isArray(e), { effect: i, cleanup: r } = Je(
|
|
1410
1519
|
n.$el,
|
|
1411
|
-
|
|
1412
|
-
|
|
1520
|
+
s ? e[0] : e,
|
|
1521
|
+
s ? e[1] : {}
|
|
1413
1522
|
);
|
|
1414
|
-
y.trackEffect(n.el,
|
|
1523
|
+
y.trackEffect(n.el, B(i)), n.trackCleanup(r);
|
|
1415
1524
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const t = n.el, s =
|
|
1418
|
-
if (s.flags &
|
|
1419
|
-
const
|
|
1420
|
-
e.value !==
|
|
1525
|
+
function Mt(n, e) {
|
|
1526
|
+
const t = n.el, s = Ne(), i = () => {
|
|
1527
|
+
if (s.flags & D.Busy) return;
|
|
1528
|
+
const o = t.checked;
|
|
1529
|
+
e.value !== o && (e.value = o);
|
|
1421
1530
|
};
|
|
1422
1531
|
t.addEventListener("change", i), n.trackCleanup(() => t.removeEventListener("change", i));
|
|
1423
|
-
const
|
|
1424
|
-
s.flags |=
|
|
1425
|
-
const
|
|
1426
|
-
t.checked !==
|
|
1532
|
+
const r = B(() => {
|
|
1533
|
+
s.flags |= D.SyncingToDom;
|
|
1534
|
+
const o = !!e.value;
|
|
1535
|
+
t.checked !== o && (t.checked = o, b.enabled && b.domUpdated(t, "checked", o)), s.flags &= ~D.SyncingToDom;
|
|
1427
1536
|
});
|
|
1428
|
-
y.trackEffect(t,
|
|
1537
|
+
y.trackEffect(t, r);
|
|
1429
1538
|
}
|
|
1430
|
-
function
|
|
1539
|
+
function Bt(n, e) {
|
|
1431
1540
|
for (const t in e) {
|
|
1432
1541
|
const s = e[t];
|
|
1433
1542
|
if (typeof s != "function") continue;
|
|
1434
|
-
const i = (
|
|
1435
|
-
|
|
1543
|
+
const i = (r) => {
|
|
1544
|
+
Re(
|
|
1436
1545
|
() => s.call(
|
|
1437
1546
|
n.el,
|
|
1438
|
-
l.Event(
|
|
1547
|
+
l.Event(r.type, { originalEvent: r })
|
|
1439
1548
|
)
|
|
1440
1549
|
);
|
|
1441
1550
|
};
|
|
@@ -1453,327 +1562,360 @@ l.fn.atomBind = function(n) {
|
|
|
1453
1562
|
el: e,
|
|
1454
1563
|
trackCleanup: (i) => y.trackCleanup(e, i)
|
|
1455
1564
|
};
|
|
1456
|
-
n.text !== void 0 &&
|
|
1565
|
+
n.text !== void 0 && wt(s, n.text), n.html !== void 0 && Rt(s, n.html), n.class && Nt(s, n.class), n.css && At(s, n.css), n.attr && Lt(s, n.attr), n.prop && Ut(s, n.prop), n.show !== void 0 && Pt(s, n.show), n.hide !== void 0 && Ft(s, n.hide), n.val !== void 0 && $t(s, n.val), n.checked !== void 0 && Mt(s, n.checked), n.on && Bt(s, n.on);
|
|
1457
1566
|
});
|
|
1458
1567
|
};
|
|
1459
1568
|
l.fn.atomList = function(n, e) {
|
|
1460
|
-
const { key: t, render: s, bind: i, update:
|
|
1569
|
+
const { key: t, render: s, bind: i, update: r, onAdd: o, onRemove: c, empty: a } = e, _ = typeof t == "function" ? t : (g, v) => g[t];
|
|
1461
1570
|
return this.each(function() {
|
|
1462
|
-
const
|
|
1463
|
-
let
|
|
1464
|
-
const
|
|
1465
|
-
const
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1571
|
+
const g = l(this), v = be(this), I = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
|
|
1572
|
+
let N = [], $ = null;
|
|
1573
|
+
const w = B(() => {
|
|
1574
|
+
const R = n.value, A = R.length;
|
|
1575
|
+
if (A === 0) {
|
|
1576
|
+
if (a && !$) {
|
|
1577
|
+
const u = typeof a == "string" ? se(a) : a;
|
|
1578
|
+
$ = l(u).appendTo(g);
|
|
1579
|
+
}
|
|
1580
|
+
} else $ && ($.remove(), $ = null);
|
|
1581
|
+
if (A === 0 && I.size === 0) {
|
|
1582
|
+
N = [];
|
|
1468
1583
|
return;
|
|
1469
1584
|
}
|
|
1470
|
-
|
|
1471
|
-
const x = /* @__PURE__ */ new Map(), K =
|
|
1585
|
+
b.log("list", `${v} updating with ${A} items`);
|
|
1586
|
+
const x = /* @__PURE__ */ new Map(), K = N.length;
|
|
1472
1587
|
for (let u = 0; u < K; u++)
|
|
1473
|
-
x.set(
|
|
1474
|
-
const U = new Array(
|
|
1475
|
-
for (let u = 0; u <
|
|
1476
|
-
const E =
|
|
1477
|
-
|
|
1588
|
+
x.set(N[u], u);
|
|
1589
|
+
const U = new Array(A), J = /* @__PURE__ */ new Set(), ae = new Int32Array(A);
|
|
1590
|
+
for (let u = 0; u < A; u++) {
|
|
1591
|
+
const E = R[u], f = _(E, u);
|
|
1592
|
+
J.has(f) && console.warn(`[atomList] Duplicate key "${f}" at index ${u}.`), U[u] = f, J.add(f), ae[u] = x.get(f) ?? -1;
|
|
1478
1593
|
}
|
|
1479
1594
|
if (I.size > 0)
|
|
1480
1595
|
for (const [u, E] of I) {
|
|
1481
1596
|
if (J.has(u) || O.has(u)) continue;
|
|
1482
|
-
const
|
|
1483
|
-
E.$el.remove(), E.$el[0] && y.cleanup(E.$el[0]), O.delete(u),
|
|
1597
|
+
const f = () => {
|
|
1598
|
+
E.$el.remove(), E.$el[0] && y.cleanup(E.$el[0]), O.delete(u), b.log("list", `${v} removed item:`, u);
|
|
1484
1599
|
};
|
|
1485
1600
|
if (I.delete(u), O.add(u), c) {
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1601
|
+
const p = c(E.$el);
|
|
1602
|
+
p instanceof Promise ? p.then(f) : f();
|
|
1488
1603
|
} else
|
|
1489
|
-
|
|
1604
|
+
f();
|
|
1490
1605
|
}
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1606
|
+
if (A === 0) {
|
|
1607
|
+
N = [];
|
|
1493
1608
|
return;
|
|
1494
1609
|
}
|
|
1495
|
-
const
|
|
1496
|
-
let
|
|
1497
|
-
for (let u =
|
|
1498
|
-
const E = U[u],
|
|
1499
|
-
if (
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
const
|
|
1503
|
-
if (!
|
|
1504
|
-
if (
|
|
1505
|
-
|
|
1506
|
-
else if (
|
|
1507
|
-
let
|
|
1508
|
-
if (typeof
|
|
1509
|
-
|
|
1510
|
-
let
|
|
1511
|
-
const
|
|
1512
|
-
for (const
|
|
1513
|
-
if (
|
|
1514
|
-
|
|
1610
|
+
const te = Ct(ae);
|
|
1611
|
+
let ne = te.length - 1, h = null;
|
|
1612
|
+
for (let u = A - 1; u >= 0; u--) {
|
|
1613
|
+
const E = U[u], f = R[u], p = I.get(E);
|
|
1614
|
+
if (p) {
|
|
1615
|
+
const S = p.item;
|
|
1616
|
+
p.item = f;
|
|
1617
|
+
const C = p.$el[0];
|
|
1618
|
+
if (!C) continue;
|
|
1619
|
+
if (r)
|
|
1620
|
+
r(p.$el, f, u), b.domUpdated(p.$el, "list.update", f);
|
|
1621
|
+
else if (S !== f) {
|
|
1622
|
+
let m = !0;
|
|
1623
|
+
if (typeof S == "object" && S !== null && typeof f == "object" && f !== null) {
|
|
1624
|
+
m = !1;
|
|
1625
|
+
let G = 0;
|
|
1626
|
+
const ue = S, V = f;
|
|
1627
|
+
for (const H in ue) {
|
|
1628
|
+
if (ue[H] !== V[H]) {
|
|
1629
|
+
m = !0;
|
|
1515
1630
|
break;
|
|
1516
1631
|
}
|
|
1517
|
-
|
|
1632
|
+
G++;
|
|
1518
1633
|
}
|
|
1519
|
-
if (!
|
|
1520
|
-
let
|
|
1521
|
-
for (const
|
|
1522
|
-
if (
|
|
1523
|
-
|
|
1634
|
+
if (!m) {
|
|
1635
|
+
let H = 0;
|
|
1636
|
+
for (const Ht in V)
|
|
1637
|
+
if (H++, H > G) {
|
|
1638
|
+
m = !0;
|
|
1524
1639
|
break;
|
|
1525
1640
|
}
|
|
1526
|
-
|
|
1641
|
+
G !== H && (m = !0);
|
|
1527
1642
|
}
|
|
1528
1643
|
}
|
|
1529
|
-
if (
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1644
|
+
if (m) {
|
|
1645
|
+
const G = s(f, u), ue = typeof G == "string" ? se(G) : G, V = l(ue), H = h === C;
|
|
1646
|
+
p.$el.replaceWith(V), p.$el = V, i && i(V, f, u), b.domUpdated(V, "list.render", f), H && (h = V[0] || null);
|
|
1532
1647
|
}
|
|
1533
1648
|
}
|
|
1534
|
-
if (
|
|
1535
|
-
|
|
1649
|
+
if (ne >= 0 && te[ne] === u)
|
|
1650
|
+
ne--;
|
|
1536
1651
|
else {
|
|
1537
|
-
const
|
|
1538
|
-
h?.isConnected ? h !==
|
|
1652
|
+
const m = p.$el[0];
|
|
1653
|
+
h?.isConnected ? h !== m && p.$el.insertBefore(h) : p.$el.appendTo(g);
|
|
1539
1654
|
}
|
|
1540
|
-
h =
|
|
1655
|
+
h = p.$el[0] || null;
|
|
1541
1656
|
} else {
|
|
1542
|
-
const
|
|
1543
|
-
I.set(E, { $el:
|
|
1657
|
+
const S = s(f, u), C = typeof S == "string" ? se(S) : S, m = l(C);
|
|
1658
|
+
I.set(E, { $el: m, item: f }), h?.isConnected ? m.insertBefore(h) : m.appendTo(g), i && i(m, f, u), o && o(m), b.domUpdated(m, "list.add", f), h = m[0] || null;
|
|
1544
1659
|
}
|
|
1545
1660
|
}
|
|
1546
|
-
|
|
1661
|
+
N = U;
|
|
1547
1662
|
});
|
|
1548
|
-
y.trackEffect(this,
|
|
1549
|
-
I.clear(), O.clear(),
|
|
1663
|
+
y.trackEffect(this, w), y.trackCleanup(this, () => {
|
|
1664
|
+
I.clear(), O.clear(), N = [], $?.remove();
|
|
1550
1665
|
});
|
|
1551
1666
|
});
|
|
1552
1667
|
};
|
|
1553
|
-
const
|
|
1668
|
+
const pe = /* @__PURE__ */ new WeakMap();
|
|
1554
1669
|
l.fn.atomMount = function(n, e = {}) {
|
|
1555
1670
|
return this.each(function() {
|
|
1556
|
-
const t =
|
|
1557
|
-
i && (t &&
|
|
1558
|
-
let
|
|
1671
|
+
const t = b.enabled, s = t ? be(this) : "", i = pe.get(this);
|
|
1672
|
+
i && (t && b.log("mount", `${s} unmounting existing component`), i()), t && b.log("mount", `${s} mounting component`);
|
|
1673
|
+
let r;
|
|
1559
1674
|
try {
|
|
1560
|
-
|
|
1675
|
+
r = n(l(this), e);
|
|
1561
1676
|
} catch (c) {
|
|
1562
1677
|
console.error("[atom-effect-jquery] Mount error:", c);
|
|
1563
1678
|
return;
|
|
1564
1679
|
}
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1567
|
-
if (t &&
|
|
1680
|
+
const o = () => {
|
|
1681
|
+
if (pe.delete(this)) {
|
|
1682
|
+
if (t && b.log("mount", `${s} full cleanup`), typeof r == "function")
|
|
1568
1683
|
try {
|
|
1569
|
-
|
|
1684
|
+
r();
|
|
1570
1685
|
} catch (c) {
|
|
1571
1686
|
console.error("[atom-effect-jquery] Cleanup error:", c);
|
|
1572
1687
|
}
|
|
1573
1688
|
y.cleanupTree(this);
|
|
1574
1689
|
}
|
|
1575
1690
|
};
|
|
1576
|
-
|
|
1691
|
+
pe.set(this, o), y.trackCleanup(this, o);
|
|
1577
1692
|
});
|
|
1578
1693
|
};
|
|
1579
1694
|
l.fn.atomUnmount = function() {
|
|
1580
1695
|
return this.each(function() {
|
|
1581
|
-
const n =
|
|
1696
|
+
const n = pe.get(this);
|
|
1582
1697
|
n && n();
|
|
1583
1698
|
});
|
|
1584
1699
|
};
|
|
1585
|
-
const
|
|
1586
|
-
function
|
|
1700
|
+
const fe = "[$.route]";
|
|
1701
|
+
function Vt(n) {
|
|
1587
1702
|
const {
|
|
1588
1703
|
target: e,
|
|
1589
1704
|
default: t,
|
|
1590
1705
|
routes: s,
|
|
1591
1706
|
notFound: i,
|
|
1592
|
-
autoBindLinks:
|
|
1593
|
-
activeClass:
|
|
1707
|
+
autoBindLinks: r = !1,
|
|
1708
|
+
activeClass: o = "active",
|
|
1594
1709
|
beforeTransition: c,
|
|
1595
1710
|
afterTransition: a
|
|
1596
1711
|
} = n;
|
|
1597
|
-
let
|
|
1598
|
-
const I = [], O = /* @__PURE__ */ new Set(),
|
|
1712
|
+
let _ = !1, g = null, v = window.location.hash;
|
|
1713
|
+
const I = [], O = /* @__PURE__ */ new Set(), N = l(e), $ = () => {
|
|
1599
1714
|
const h = window.location.hash, u = h.indexOf("?");
|
|
1600
1715
|
return (u === -1 ? h.substring(1) : h.substring(1, u)) || t;
|
|
1601
|
-
},
|
|
1716
|
+
}, w = (h) => {
|
|
1602
1717
|
const u = h.indexOf("?");
|
|
1603
1718
|
if (u === -1) return {};
|
|
1604
|
-
const E = {},
|
|
1605
|
-
let
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
h.substring(b + 1, C)
|
|
1612
|
-
) : E[decodeURIComponent(h.substring(g, C))] = "";
|
|
1719
|
+
const E = {}, f = h.length;
|
|
1720
|
+
let p = u + 1;
|
|
1721
|
+
const S = (C) => {
|
|
1722
|
+
try {
|
|
1723
|
+
return decodeURIComponent(C);
|
|
1724
|
+
} catch {
|
|
1725
|
+
return console.warn(`${fe} Malformed URI component: ${C}`), C;
|
|
1613
1726
|
}
|
|
1614
|
-
|
|
1727
|
+
};
|
|
1728
|
+
for (; p < f; ) {
|
|
1729
|
+
let C = h.indexOf("&", p);
|
|
1730
|
+
if (C === -1 && (C = f), C > p) {
|
|
1731
|
+
const m = h.indexOf("=", p);
|
|
1732
|
+
m !== -1 && m < C ? E[S(h.substring(p, m))] = S(
|
|
1733
|
+
h.substring(m + 1, C)
|
|
1734
|
+
) : E[S(h.substring(p, C))] = "";
|
|
1735
|
+
}
|
|
1736
|
+
p = C + 1;
|
|
1615
1737
|
}
|
|
1616
1738
|
return E;
|
|
1617
|
-
}, A = (h) => {
|
|
1618
|
-
let u = s[h];
|
|
1619
|
-
return !u && i && (u = s[i]), u || (console.warn(`${ye} Route "${h}" not found and no notFound route configured`), null);
|
|
1620
1739
|
}, R = (h) => {
|
|
1740
|
+
let u = s[h];
|
|
1741
|
+
return !u && i && (u = s[i]), u || (console.warn(`${fe} Route "${h}" not found and no notFound route configured`), null);
|
|
1742
|
+
}, A = (h) => {
|
|
1621
1743
|
const u = document.querySelector(h);
|
|
1622
1744
|
if (!u?.content)
|
|
1623
|
-
return console.warn(`${
|
|
1745
|
+
return console.warn(`${fe} Template "${h}" not found`), !1;
|
|
1624
1746
|
const E = u.content.cloneNode(!0);
|
|
1625
|
-
return
|
|
1626
|
-
}, x =
|
|
1627
|
-
if (
|
|
1628
|
-
const u =
|
|
1747
|
+
return N.append(E), !0;
|
|
1748
|
+
}, x = Xe($()), K = (h) => {
|
|
1749
|
+
if (_) return;
|
|
1750
|
+
const u = N[0];
|
|
1629
1751
|
if (!u) {
|
|
1630
|
-
console.warn(`${
|
|
1752
|
+
console.warn(`${fe} Target element "${e}" not found`);
|
|
1631
1753
|
return;
|
|
1632
1754
|
}
|
|
1633
|
-
const E =
|
|
1755
|
+
const E = R(h);
|
|
1634
1756
|
if (!E) return;
|
|
1635
|
-
const
|
|
1636
|
-
c && c(
|
|
1637
|
-
let
|
|
1757
|
+
const f = w(window.location.hash);
|
|
1758
|
+
c && c(g || h, h), N.empty();
|
|
1759
|
+
let p = f;
|
|
1638
1760
|
if (E.onEnter) {
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1761
|
+
const S = E.onEnter(f);
|
|
1762
|
+
S !== void 0 && (p = { ...f, ...S });
|
|
1641
1763
|
}
|
|
1642
|
-
E.render ? E.render(u, h,
|
|
1764
|
+
E.render ? E.render(u, h, p) : E.template && A(E.template), a && a(g || h, h), g = h;
|
|
1643
1765
|
}, U = (h) => {
|
|
1644
|
-
if (
|
|
1766
|
+
if (_) return;
|
|
1645
1767
|
const u = x.value, E = s[u];
|
|
1646
|
-
E?.onLeave && E.onLeave() === !1 || (
|
|
1768
|
+
E?.onLeave && E.onLeave() === !1 || (v = `#${h}`, window.location.hash = v, x.value = h);
|
|
1647
1769
|
}, J = () => {
|
|
1648
|
-
if (
|
|
1770
|
+
if (_) return;
|
|
1649
1771
|
const h = window.location.hash;
|
|
1650
|
-
if (h ===
|
|
1772
|
+
if (h === v) return;
|
|
1651
1773
|
const u = $(), E = x.value;
|
|
1652
1774
|
if (E !== u) {
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1655
|
-
window.location.hash =
|
|
1775
|
+
const f = s[E];
|
|
1776
|
+
if (f?.onLeave && f.onLeave() === !1) {
|
|
1777
|
+
window.location.hash = v;
|
|
1656
1778
|
return;
|
|
1657
1779
|
}
|
|
1658
1780
|
x.value = u;
|
|
1659
1781
|
} else
|
|
1660
1782
|
K(u);
|
|
1661
|
-
|
|
1662
|
-
},
|
|
1663
|
-
if (!
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1783
|
+
v = h;
|
|
1784
|
+
}, ae = () => {
|
|
1785
|
+
if (!r) return;
|
|
1786
|
+
const h = (f) => {
|
|
1787
|
+
f.preventDefault();
|
|
1788
|
+
const p = l(f.currentTarget).data("route");
|
|
1789
|
+
U(p);
|
|
1790
|
+
};
|
|
1791
|
+
l(document).on("click", "[data-route]", h), I.push(() => {
|
|
1792
|
+
l(document).off("click", "[data-route]", h);
|
|
1793
|
+
});
|
|
1794
|
+
const u = (f) => {
|
|
1795
|
+
if (O.has(f)) return;
|
|
1796
|
+
const p = l(f), S = p.data("route");
|
|
1797
|
+
O.add(f);
|
|
1798
|
+
const C = B(() => {
|
|
1799
|
+
const m = x.value === S;
|
|
1800
|
+
p.toggleClass(o, m), m ? p.attr("aria-current", "page") : p.removeAttr("aria-current");
|
|
1672
1801
|
});
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
E.toggleClass(r, b), b ? E.attr("aria-current", "page") : E.removeAttr("aria-current");
|
|
1802
|
+
y.trackEffect(f, C), y.trackCleanup(f, () => {
|
|
1803
|
+
O.delete(f);
|
|
1676
1804
|
});
|
|
1677
|
-
|
|
1805
|
+
};
|
|
1806
|
+
l("[data-route]").each(function() {
|
|
1807
|
+
u(this);
|
|
1808
|
+
});
|
|
1809
|
+
const E = new MutationObserver((f) => {
|
|
1810
|
+
for (const p of f)
|
|
1811
|
+
p.type === "childList" && p.addedNodes.forEach((S) => {
|
|
1812
|
+
if (S.nodeType === 1) {
|
|
1813
|
+
const C = S;
|
|
1814
|
+
C.matches?.("[data-route]") && u(C), C.querySelectorAll && C.querySelectorAll("[data-route]").forEach(
|
|
1815
|
+
(m) => u(m)
|
|
1816
|
+
);
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1678
1819
|
});
|
|
1679
|
-
|
|
1680
|
-
|
|
1820
|
+
E.observe(document.body, { childList: !0, subtree: !0 }), I.push(() => E.disconnect());
|
|
1821
|
+
}, te = () => {
|
|
1822
|
+
_ || (_ = !0, I.forEach((h) => h()), I.length = 0, O.forEach((h) => y.cleanup(h)), O.clear());
|
|
1681
1823
|
};
|
|
1682
1824
|
window.addEventListener("hashchange", J), I.push(() => window.removeEventListener("hashchange", J));
|
|
1683
|
-
const
|
|
1825
|
+
const ne = B(() => {
|
|
1684
1826
|
K(x.value);
|
|
1685
1827
|
});
|
|
1686
|
-
return I.push(() =>
|
|
1828
|
+
return I.push(() => ne.dispose()), ae(), N[0] && y.trackCleanup(N[0], te), {
|
|
1687
1829
|
currentRoute: x,
|
|
1688
1830
|
navigate: U,
|
|
1689
|
-
destroy:
|
|
1831
|
+
destroy: te
|
|
1690
1832
|
};
|
|
1691
1833
|
}
|
|
1692
1834
|
l.extend({
|
|
1693
|
-
route:
|
|
1835
|
+
route: Vt
|
|
1694
1836
|
});
|
|
1695
|
-
const
|
|
1696
|
-
let
|
|
1697
|
-
const
|
|
1698
|
-
let e =
|
|
1837
|
+
const ge = /* @__PURE__ */ new WeakMap();
|
|
1838
|
+
let Me = !1;
|
|
1839
|
+
const Be = (n) => {
|
|
1840
|
+
let e = ge.get(n);
|
|
1699
1841
|
return e || (e = function(...t) {
|
|
1700
|
-
return
|
|
1701
|
-
},
|
|
1842
|
+
return Re(() => n.apply(this, t));
|
|
1843
|
+
}, ge.set(n, e)), e;
|
|
1702
1844
|
};
|
|
1703
|
-
function
|
|
1704
|
-
if (
|
|
1705
|
-
|
|
1845
|
+
function Ze() {
|
|
1846
|
+
if (Me) return;
|
|
1847
|
+
Me = !0;
|
|
1706
1848
|
const n = l.fn.on, e = l.fn.off, t = l.fn.remove, s = l.fn.empty, i = l.fn.detach;
|
|
1707
|
-
l.fn.remove = function(
|
|
1708
|
-
const
|
|
1709
|
-
for (let c = 0, a =
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1849
|
+
l.fn.remove = function(r) {
|
|
1850
|
+
const o = r ? this.filter(r) : this;
|
|
1851
|
+
for (let c = 0, a = o.length; c < a; c++) {
|
|
1852
|
+
const _ = o[c];
|
|
1853
|
+
_ && (y.cleanupTree(_), y.markIgnored(_));
|
|
1712
1854
|
}
|
|
1713
|
-
return t.call(this,
|
|
1855
|
+
return t.call(this, r);
|
|
1714
1856
|
}, l.fn.empty = function() {
|
|
1715
|
-
for (let
|
|
1716
|
-
const c = this[
|
|
1857
|
+
for (let r = 0, o = this.length; r < o; r++) {
|
|
1858
|
+
const c = this[r];
|
|
1717
1859
|
c && y.cleanupDescendants(c);
|
|
1718
1860
|
}
|
|
1719
1861
|
return s.call(this);
|
|
1720
|
-
}, l.fn.detach = function(
|
|
1721
|
-
const
|
|
1722
|
-
for (let c = 0, a =
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1862
|
+
}, l.fn.detach = function(r) {
|
|
1863
|
+
const o = r ? this.filter(r) : this;
|
|
1864
|
+
for (let c = 0, a = o.length; c < a; c++) {
|
|
1865
|
+
const _ = o[c];
|
|
1866
|
+
_ && y.keep(_);
|
|
1725
1867
|
}
|
|
1726
|
-
return i.call(this,
|
|
1727
|
-
}, l.fn.on = function(...
|
|
1728
|
-
const
|
|
1729
|
-
if (
|
|
1730
|
-
const c =
|
|
1731
|
-
for (const
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1868
|
+
return i.call(this, r);
|
|
1869
|
+
}, l.fn.on = function(...r) {
|
|
1870
|
+
const o = r[0];
|
|
1871
|
+
if (o && typeof o == "object") {
|
|
1872
|
+
const c = o, a = {};
|
|
1873
|
+
for (const _ in c) {
|
|
1874
|
+
const g = c[_];
|
|
1875
|
+
g && (a[_] = Be(g));
|
|
1734
1876
|
}
|
|
1735
|
-
|
|
1877
|
+
r[0] = a;
|
|
1736
1878
|
} else
|
|
1737
|
-
for (let c =
|
|
1738
|
-
if (typeof
|
|
1739
|
-
|
|
1879
|
+
for (let c = r.length - 1; c >= 0; c--)
|
|
1880
|
+
if (typeof r[c] == "function") {
|
|
1881
|
+
r[c] = Be(r[c]);
|
|
1740
1882
|
break;
|
|
1741
1883
|
}
|
|
1742
|
-
return n.apply(this,
|
|
1743
|
-
}, l.fn.off = function(...
|
|
1744
|
-
const
|
|
1745
|
-
if (
|
|
1746
|
-
const c =
|
|
1747
|
-
for (const
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1884
|
+
return n.apply(this, r);
|
|
1885
|
+
}, l.fn.off = function(...r) {
|
|
1886
|
+
const o = r[0];
|
|
1887
|
+
if (o && typeof o == "object") {
|
|
1888
|
+
const c = o, a = {};
|
|
1889
|
+
for (const _ in c) {
|
|
1890
|
+
const g = c[_];
|
|
1891
|
+
g && (a[_] = ge.get(g) || g);
|
|
1750
1892
|
}
|
|
1751
|
-
|
|
1893
|
+
r[0] = a;
|
|
1752
1894
|
} else
|
|
1753
|
-
for (let c =
|
|
1754
|
-
if (typeof
|
|
1755
|
-
|
|
1895
|
+
for (let c = r.length - 1; c >= 0; c--)
|
|
1896
|
+
if (typeof r[c] == "function") {
|
|
1897
|
+
r[c] = ge.get(r[c]) || r[c];
|
|
1756
1898
|
break;
|
|
1757
1899
|
}
|
|
1758
|
-
return e.apply(this,
|
|
1900
|
+
return e.apply(this, r);
|
|
1759
1901
|
};
|
|
1760
1902
|
}
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1903
|
+
const qt = Ze;
|
|
1904
|
+
Ze();
|
|
1763
1905
|
l(() => {
|
|
1764
|
-
|
|
1906
|
+
kt(document.body);
|
|
1765
1907
|
});
|
|
1766
1908
|
export {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1909
|
+
Xe as atom,
|
|
1910
|
+
Re as batch,
|
|
1911
|
+
Et as computed,
|
|
1912
|
+
Qt as default,
|
|
1913
|
+
zt as disableAutoCleanup,
|
|
1914
|
+
B as effect,
|
|
1915
|
+
kt as enableAutoCleanup,
|
|
1916
|
+
qt as enablejQueryBatching,
|
|
1917
|
+
Ze as enablejQueryOverrides,
|
|
1776
1918
|
y as registry,
|
|
1777
|
-
|
|
1919
|
+
ht as untracked
|
|
1778
1920
|
};
|
|
1779
1921
|
//# sourceMappingURL=index.mjs.map
|