@but212/atom-effect-jquery 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/atom-effect-jquery.min.js +10 -2
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -9
- package/dist/index.mjs +1434 -1276
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,78 +1,118 @@
|
|
|
1
1
|
import e from "jquery";
|
|
2
2
|
//#region ../core/dist/index.mjs
|
|
3
3
|
var t = {
|
|
4
|
+
DISPOSED: 1,
|
|
5
|
+
IS_COMPUTED: 2,
|
|
6
|
+
DIRTY: 256,
|
|
7
|
+
RECOMPUTING: 512,
|
|
8
|
+
HAS_ERROR: 1024,
|
|
9
|
+
FORCE_COMPUTE: 2048,
|
|
10
|
+
IDLE: 65536,
|
|
11
|
+
PENDING: 131072,
|
|
12
|
+
RESOLVED: 262144,
|
|
13
|
+
REJECTED: 524288,
|
|
14
|
+
ATOM_SYNC: 16777216,
|
|
15
|
+
ATOM_NOTIFICATION_SCHEDULED: 33554432,
|
|
16
|
+
EFFECT_EXECUTING: 268435456
|
|
17
|
+
};
|
|
18
|
+
Object.freeze({
|
|
19
|
+
ASYNC_STATE: t.IDLE | t.PENDING | t.RESOLVED | t.REJECTED,
|
|
20
|
+
COMPUTED_DIRTY_MASK: t.DIRTY | t.RECOMPUTING | t.FORCE_COMPUTE
|
|
21
|
+
});
|
|
22
|
+
var n = Object.freeze({
|
|
4
23
|
IDLE: "idle",
|
|
5
24
|
PENDING: "pending",
|
|
6
25
|
RESOLVED: "resolved",
|
|
7
26
|
REJECTED: "rejected"
|
|
8
|
-
},
|
|
9
|
-
DISPOSED:
|
|
10
|
-
EXECUTING:
|
|
11
|
-
},
|
|
12
|
-
DISPOSED:
|
|
13
|
-
IS_COMPUTED:
|
|
14
|
-
DIRTY:
|
|
15
|
-
IDLE:
|
|
16
|
-
PENDING:
|
|
17
|
-
RESOLVED:
|
|
18
|
-
REJECTED:
|
|
19
|
-
RECOMPUTING:
|
|
20
|
-
HAS_ERROR:
|
|
21
|
-
FORCE_COMPUTE:
|
|
22
|
-
},
|
|
23
|
-
DISPOSED:
|
|
24
|
-
SYNC:
|
|
25
|
-
NOTIFICATION_SCHEDULED:
|
|
26
|
-
},
|
|
27
|
+
}), r = Object.freeze({
|
|
28
|
+
DISPOSED: t.DISPOSED,
|
|
29
|
+
EXECUTING: t.EFFECT_EXECUTING
|
|
30
|
+
}), i = Object.freeze({
|
|
31
|
+
DISPOSED: t.DISPOSED,
|
|
32
|
+
IS_COMPUTED: t.IS_COMPUTED,
|
|
33
|
+
DIRTY: t.DIRTY,
|
|
34
|
+
IDLE: t.IDLE,
|
|
35
|
+
PENDING: t.PENDING,
|
|
36
|
+
RESOLVED: t.RESOLVED,
|
|
37
|
+
REJECTED: t.REJECTED,
|
|
38
|
+
RECOMPUTING: t.RECOMPUTING,
|
|
39
|
+
HAS_ERROR: t.HAS_ERROR,
|
|
40
|
+
FORCE_COMPUTE: t.FORCE_COMPUTE
|
|
41
|
+
}), a = Object.freeze({
|
|
42
|
+
DISPOSED: t.DISPOSED,
|
|
43
|
+
SYNC: t.ATOM_SYNC,
|
|
44
|
+
NOTIFICATION_SCHEDULED: t.ATOM_NOTIFICATION_SCHEDULED
|
|
45
|
+
}), o = Object.freeze({
|
|
27
46
|
MAX_EXECUTIONS_PER_SECOND: 1e3,
|
|
28
47
|
MAX_EXECUTIONS_PER_EFFECT: 100,
|
|
29
48
|
MAX_EXECUTIONS_PER_FLUSH: 1e4,
|
|
30
49
|
MAX_FLUSH_ITERATIONS: 1e3,
|
|
31
50
|
MIN_FLUSH_ITERATIONS: 10,
|
|
32
51
|
BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
|
|
33
|
-
},
|
|
52
|
+
}), s = 1073741823, c = Object.freeze({
|
|
34
53
|
WARN_INFINITE_LOOP: !0,
|
|
35
|
-
EFFECT_FREQUENCY_WINDOW: 1e3
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
MAX_PROMISE_ID: 2 ** 53 - 1 - 1
|
|
39
|
-
}, c = {
|
|
54
|
+
EFFECT_FREQUENCY_WINDOW: 1e3,
|
|
55
|
+
LOOP_THRESHOLD: 100
|
|
56
|
+
}), l = Object.freeze({ MAX_PROMISE_ID: s }), u = Object.freeze({
|
|
40
57
|
UNINITIALIZED: -1,
|
|
41
58
|
MIN: 1
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
}), d = !1;
|
|
60
|
+
try {
|
|
61
|
+
d = !!(typeof globalThis < "u" && globalThis.__ATOM_DEBUG__ || typeof sessionStorage < "u" && sessionStorage.getItem("__ATOM_DEBUG__") === "true");
|
|
62
|
+
} catch {}
|
|
63
|
+
var f = (typeof process < "u" && process.env, typeof __DEV__ < "u" && !!__DEV__ || d), p = Object.freeze([]), m = class e extends Error {
|
|
64
|
+
constructor(e, t = null, n = !0, r) {
|
|
65
|
+
super(e), this.cause = t, this.recoverable = n, this.code = r, this.name = "AtomError", Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
66
|
+
}
|
|
67
|
+
getChain() {
|
|
68
|
+
if (this.cause === null || this.cause === void 0) return [this];
|
|
69
|
+
let t = [this], n = /* @__PURE__ */ new Set([this]), r = this.cause;
|
|
70
|
+
for (; r != null;) {
|
|
71
|
+
let i = n.has(r);
|
|
72
|
+
if (t.push(r), i) break;
|
|
73
|
+
if (n.add(r), r instanceof e) r = r.cause;
|
|
74
|
+
else if (r instanceof Error && "cause" in r) r = r.cause;
|
|
75
|
+
else break;
|
|
76
|
+
}
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
toJSON(t = /* @__PURE__ */ new Set()) {
|
|
80
|
+
if (t.has(this)) return {
|
|
81
|
+
name: this.name,
|
|
82
|
+
message: "[Circular Reference]",
|
|
83
|
+
recoverable: this.recoverable,
|
|
84
|
+
code: this.code
|
|
85
|
+
};
|
|
86
|
+
t.add(this);
|
|
87
|
+
let n = this.cause;
|
|
88
|
+
return this.cause instanceof e ? n = this.cause.toJSON(t) : this.cause instanceof Error && (n = {
|
|
89
|
+
name: this.cause.name,
|
|
90
|
+
message: this.cause.message,
|
|
91
|
+
stack: this.cause.stack,
|
|
92
|
+
cause: this.cause.cause
|
|
93
|
+
}), {
|
|
94
|
+
name: this.name,
|
|
95
|
+
message: this.message,
|
|
96
|
+
code: this.code,
|
|
97
|
+
recoverable: this.recoverable,
|
|
98
|
+
stack: this.stack,
|
|
99
|
+
cause: n
|
|
100
|
+
};
|
|
60
101
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
super(e), this.cause = t, this.recoverable = n, this.name = "AtomError";
|
|
102
|
+
static format(e, t, n) {
|
|
103
|
+
return `${e} (${t}): ${n}`;
|
|
64
104
|
}
|
|
65
105
|
}, h = class extends m {
|
|
66
|
-
constructor(e
|
|
67
|
-
super(e
|
|
106
|
+
constructor(...e) {
|
|
107
|
+
super(...e), this.name = "ComputedError";
|
|
68
108
|
}
|
|
69
109
|
}, g = class extends m {
|
|
70
|
-
constructor(e, t = null) {
|
|
71
|
-
super(e, t,
|
|
110
|
+
constructor(e, t = null, n = !1, r) {
|
|
111
|
+
super(e, t, n, r), this.name = "EffectError";
|
|
72
112
|
}
|
|
73
113
|
}, _ = class extends m {
|
|
74
|
-
constructor(e, t = null) {
|
|
75
|
-
super(e, t,
|
|
114
|
+
constructor(e, t = null, n = !1, r) {
|
|
115
|
+
super(e, t, n, r), this.name = "SchedulerError";
|
|
76
116
|
}
|
|
77
117
|
}, v = {
|
|
78
118
|
COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
|
|
@@ -93,216 +133,336 @@ var d = Object.freeze([]), f = class {
|
|
|
93
133
|
SCHEDULER_CALLBACK_MUST_BE_FUNCTION: "Scheduler callback must be a function",
|
|
94
134
|
SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring.",
|
|
95
135
|
BATCH_CALLBACK_MUST_BE_FUNCTION: "Batch callback must be a function"
|
|
96
|
-
}
|
|
136
|
+
};
|
|
137
|
+
function y(e, t, n) {
|
|
138
|
+
if (e instanceof m) return new t(m.format(e.name, n, e.message), e, e.recoverable, e.code);
|
|
139
|
+
if (e instanceof Error) {
|
|
140
|
+
let r = e.name || e.constructor.name || "Error";
|
|
141
|
+
return new t(m.format(r, n, e.message), e);
|
|
142
|
+
}
|
|
143
|
+
return new t(m.format("Unexpected error", n, String(e)), e);
|
|
144
|
+
}
|
|
145
|
+
var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symbol("AtomEffect.Id"), S = /* @__PURE__ */ Symbol("AtomEffect.Type"), C = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), w = "[Atom Effect]", T = f ? new class {
|
|
146
|
+
constructor() {
|
|
147
|
+
this.enabled = !0, this.warnInfiniteLoop = c.WARN_INFINITE_LOOP, this._updateCounts = /* @__PURE__ */ new Map(), this._nodeRegistry = /* @__PURE__ */ new Map(), this._threshold = c.LOOP_THRESHOLD, this._cleanupScheduled = !1, this.warn = (e, t) => {
|
|
148
|
+
this.enabled && e && console.warn(`${w} ${t}`);
|
|
149
|
+
}, this.registerNode = (e) => {
|
|
150
|
+
this._nodeRegistry.set(e.id, new WeakRef(e));
|
|
151
|
+
}, this.attachDebugInfo = (e, t, n, r) => {
|
|
152
|
+
this.enabled && (Object.defineProperties(e, {
|
|
153
|
+
[b]: {
|
|
154
|
+
value: r ?? `${t}_${n}`,
|
|
155
|
+
configurable: !0
|
|
156
|
+
},
|
|
157
|
+
[x]: {
|
|
158
|
+
value: n,
|
|
159
|
+
configurable: !0
|
|
160
|
+
},
|
|
161
|
+
[S]: {
|
|
162
|
+
value: t,
|
|
163
|
+
configurable: !0
|
|
164
|
+
}
|
|
165
|
+
}), this.registerNode(e));
|
|
166
|
+
}, this.trackUpdate = (e, t) => {
|
|
167
|
+
if (!this.enabled || !this.warnInfiniteLoop) return;
|
|
168
|
+
let n = this._updateCounts, r = (n.get(e) ?? 0) + 1;
|
|
169
|
+
r > this._threshold ? this.warn(!0, `Infinite loop detected for ${t ?? `dependency ${e}`}. Over ${this._threshold} updates in a single execution scope.`) : n.set(e, r), this._cleanupScheduled || (this._cleanupScheduled = !0, Promise.resolve().then(() => {
|
|
170
|
+
this._updateCounts.clear(), this._cleanupScheduled = !1;
|
|
171
|
+
}));
|
|
172
|
+
}, this.dumpGraph = () => {
|
|
173
|
+
let e = [];
|
|
174
|
+
for (let [t, n] of this._nodeRegistry) {
|
|
175
|
+
let r = n.deref();
|
|
176
|
+
r ? e.push({
|
|
177
|
+
id: t,
|
|
178
|
+
name: this.getDebugName(r),
|
|
179
|
+
type: this.getDebugType(r),
|
|
180
|
+
updateCount: this._updateCounts.get(t) ?? 0
|
|
181
|
+
}) : (this._nodeRegistry.delete(t), this._updateCounts.delete(t));
|
|
182
|
+
}
|
|
183
|
+
return e;
|
|
184
|
+
}, this.getDebugName = (e) => {
|
|
185
|
+
if (e) return e[b];
|
|
186
|
+
}, this.getDebugType = (e) => {
|
|
187
|
+
if (e) return e[S];
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}() : {
|
|
191
|
+
enabled: !1,
|
|
192
|
+
warnInfiniteLoop: !1,
|
|
193
|
+
warn: () => {},
|
|
194
|
+
registerNode: () => {},
|
|
195
|
+
attachDebugInfo: () => {},
|
|
196
|
+
trackUpdate: () => {},
|
|
197
|
+
dumpGraph: () => [],
|
|
198
|
+
getDebugName: () => {},
|
|
199
|
+
getDebugType: () => {}
|
|
200
|
+
}, ee = 1, te = () => ee++ | 0, ne = class {
|
|
97
201
|
constructor() {
|
|
98
|
-
this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._overflow = null, this._freeIndices = null;
|
|
202
|
+
this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._actualCount = 0, this._overflow = null, this._freeIndices = null;
|
|
203
|
+
}
|
|
204
|
+
_rawWrite(e, t) {
|
|
205
|
+
if (e < 4) e === 0 ? this._s0 = t : e === 1 ? this._s1 = t : e === 2 ? this._s2 = t : this._s3 = t;
|
|
206
|
+
else {
|
|
207
|
+
this._overflow === null && (this._overflow = []);
|
|
208
|
+
let n = this._overflow, r = e - 4;
|
|
209
|
+
n[r] = t;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
_rawAdd(e) {
|
|
213
|
+
if (this._s0 === null) return this._s0 = e, 0;
|
|
214
|
+
if (this._s1 === null) return this._s1 = e, 1;
|
|
215
|
+
if (this._s2 === null) return this._s2 = e, 2;
|
|
216
|
+
if (this._s3 === null) return this._s3 = e, 3;
|
|
217
|
+
this._overflow === null && (this._overflow = []);
|
|
218
|
+
let t = this._overflow, n = this._freeIndices;
|
|
219
|
+
if (n !== null && n.length > 0) {
|
|
220
|
+
let r = n.pop();
|
|
221
|
+
return t[r] = e, r + 4;
|
|
222
|
+
}
|
|
223
|
+
return t.push(e), 4 + t.length - 1;
|
|
224
|
+
}
|
|
225
|
+
_rawSwap(e, t) {
|
|
226
|
+
if (e === t) return;
|
|
227
|
+
let n = this.getAt(e), r = this.getAt(t);
|
|
228
|
+
this._rawWrite(e, r), this._rawWrite(t, n);
|
|
99
229
|
}
|
|
100
230
|
get size() {
|
|
231
|
+
return this._actualCount;
|
|
232
|
+
}
|
|
233
|
+
get physicalSize() {
|
|
101
234
|
return this._count;
|
|
102
235
|
}
|
|
103
236
|
getAt(e) {
|
|
104
|
-
|
|
105
|
-
case 0: return this._s0;
|
|
106
|
-
case 1: return this._s1;
|
|
107
|
-
case 2: return this._s2;
|
|
108
|
-
case 3: return this._s3;
|
|
109
|
-
}
|
|
110
|
-
let t = this._overflow;
|
|
111
|
-
if (t !== null) {
|
|
112
|
-
let n = t[e - 4];
|
|
113
|
-
return n === void 0 ? null : n;
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
237
|
+
return e < 4 ? e === 0 ? this._s0 : e === 1 ? this._s1 : e === 2 ? this._s2 : this._s3 : this._overflow?.[e - 4] ?? null;
|
|
116
238
|
}
|
|
117
239
|
setAt(e, t) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this._s1 = t;
|
|
124
|
-
break;
|
|
125
|
-
case 2:
|
|
126
|
-
this._s2 = t;
|
|
127
|
-
break;
|
|
128
|
-
case 3:
|
|
129
|
-
this._s3 = t;
|
|
130
|
-
break;
|
|
131
|
-
default: this._overflow ??= [], this._overflow[e - 4] = t;
|
|
132
|
-
}
|
|
133
|
-
e >= this._count && (this._count = e + 1);
|
|
240
|
+
let n = this.getAt(e);
|
|
241
|
+
n !== t && (this._rawWrite(e, t), n === null ? this._actualCount++ : t === null && this._actualCount--, t !== null && e >= this._count ? this._count = e + 1 : t === null && this._shrinkPhysicalSizeFrom(e));
|
|
242
|
+
}
|
|
243
|
+
_shrinkPhysicalSizeFrom(e) {
|
|
244
|
+
if (e === this._count - 1) for (this._count--; this._count > 0 && this.getAt(this._count - 1) == null;) this._count--;
|
|
134
245
|
}
|
|
135
246
|
truncateFrom(e) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (e <= 1) {
|
|
144
|
-
let e = this._s1;
|
|
145
|
-
e != null && (this._onItemRemoved(e), this._s1 = null);
|
|
146
|
-
}
|
|
147
|
-
if (e <= 2) {
|
|
148
|
-
let e = this._s2;
|
|
149
|
-
e != null && (this._onItemRemoved(e), this._s2 = null);
|
|
150
|
-
}
|
|
151
|
-
if (e <= 3) {
|
|
152
|
-
let e = this._s3;
|
|
153
|
-
e != null && (this._onItemRemoved(e), this._s3 = null);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
let n = this._overflow;
|
|
157
|
-
if (n !== null && t > 4) {
|
|
158
|
-
let t = e > 4 ? e - 4 : 0, r = n.length;
|
|
159
|
-
for (let e = t; e < r; e++) {
|
|
160
|
-
let t = n[e];
|
|
161
|
-
t != null && (this._onItemRemoved(t), n[e] = null);
|
|
247
|
+
e <= 3 && (e <= 0 && this._s0 !== null && (this._onItemRemoved(this._s0), this._s0 = null, this._actualCount--), e <= 1 && this._s1 !== null && (this._onItemRemoved(this._s1), this._s1 = null, this._actualCount--), e <= 2 && this._s2 !== null && (this._onItemRemoved(this._s2), this._s2 = null, this._actualCount--), e <= 3 && this._s3 !== null && (this._onItemRemoved(this._s3), this._s3 = null, this._actualCount--));
|
|
248
|
+
let t = this._overflow;
|
|
249
|
+
if (t !== null) {
|
|
250
|
+
let n = e > 4 ? e - 4 : 0, r = t.length;
|
|
251
|
+
for (let e = n; e < r; e++) {
|
|
252
|
+
let n = t[e];
|
|
253
|
+
n != null && (this._onItemRemoved(n), t[e] = null, this._actualCount--);
|
|
162
254
|
}
|
|
163
|
-
e <= 4 ?
|
|
255
|
+
e <= 4 ? this._overflow = null : t.length = e - 4;
|
|
164
256
|
}
|
|
165
|
-
this.
|
|
257
|
+
this._count = e, this._actualCount < 0 && (this._actualCount = 0), this._freeIndices = null;
|
|
166
258
|
}
|
|
167
259
|
_onItemRemoved(e) {}
|
|
168
260
|
add(e) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (this._s1 === null) {
|
|
174
|
-
this._s1 = e, this._count++;
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (this._s2 === null) {
|
|
178
|
-
this._s2 = e, this._count++;
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (this._s3 === null) {
|
|
182
|
-
this._s3 = e, this._count++;
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
this._addToOverflow(e);
|
|
186
|
-
}
|
|
187
|
-
_addToOverflow(e) {
|
|
188
|
-
let t = this._overflow;
|
|
189
|
-
if (t === null) this._overflow = [e];
|
|
190
|
-
else {
|
|
191
|
-
let n = this._freeIndices;
|
|
192
|
-
n !== null && n.length > 0 ? t[n.pop()] = e : t.push(e);
|
|
193
|
-
}
|
|
194
|
-
this._count++;
|
|
261
|
+
let t = this._rawAdd(e);
|
|
262
|
+
return t >= this._count && (this._count = t + 1), this._actualCount++, t;
|
|
195
263
|
}
|
|
196
264
|
remove(e) {
|
|
197
|
-
|
|
198
|
-
if (this.
|
|
199
|
-
if (this.
|
|
200
|
-
if (this.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
let e = this._freeIndices;
|
|
206
|
-
return e === null && (e = this._freeIndices = []), e.push(n), !0;
|
|
265
|
+
let t = -1;
|
|
266
|
+
if (this._s0 === e) t = 0;
|
|
267
|
+
else if (this._s1 === e) t = 1;
|
|
268
|
+
else if (this._s2 === e) t = 2;
|
|
269
|
+
else if (this._s3 === e) t = 3;
|
|
270
|
+
else {
|
|
271
|
+
let n = this._overflow;
|
|
272
|
+
n !== null && (t = n.indexOf(e), t !== -1 && (t += 4));
|
|
207
273
|
}
|
|
208
|
-
return !1;
|
|
274
|
+
return t === -1 ? !1 : (this._rawWrite(t, null), this._shrinkPhysicalSizeFrom(t), this._actualCount--, t >= 4 && (this._freeIndices === null && (this._freeIndices = []), this._freeIndices.push(t - 4)), !0);
|
|
209
275
|
}
|
|
210
276
|
has(e) {
|
|
211
|
-
if (this.
|
|
277
|
+
if (this._actualCount === 0) return !1;
|
|
212
278
|
if (this._s0 === e || this._s1 === e || this._s2 === e || this._s3 === e) return !0;
|
|
213
279
|
let t = this._overflow;
|
|
214
|
-
|
|
215
|
-
for (let n = 0, r = t.length; n < r; n++) if (t[n] === e) return !0;
|
|
216
|
-
}
|
|
217
|
-
return !1;
|
|
280
|
+
return t === null ? !1 : t.indexOf(e) !== -1;
|
|
218
281
|
}
|
|
219
282
|
forEach(e) {
|
|
220
|
-
let t = this.
|
|
283
|
+
let t = this._actualCount;
|
|
221
284
|
if (t === 0) return;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
forEachIndexed(e) {
|
|
237
|
-
let t = this._count;
|
|
238
|
-
if (t === 0) return 0;
|
|
239
|
-
let n = 0, r = this._s0;
|
|
240
|
-
if (r != null && (e(r), ++n === t)) return n;
|
|
241
|
-
let i = this._s1;
|
|
242
|
-
if (i != null && (e(i), ++n === t)) return n;
|
|
243
|
-
let a = this._s2;
|
|
244
|
-
if (a != null && (e(a), ++n === t)) return n;
|
|
245
|
-
let o = this._s3;
|
|
246
|
-
if (o != null && (e(o), ++n === t)) return n;
|
|
247
|
-
let s = this._overflow;
|
|
248
|
-
if (s != null) for (let r = 0, i = s.length; r < i; r++) {
|
|
249
|
-
let i = s[r];
|
|
250
|
-
if (i != null && (e(i), ++n === t)) return n;
|
|
251
|
-
}
|
|
252
|
-
return n;
|
|
285
|
+
if (t === this._count) {
|
|
286
|
+
this._s0 != null && e(this._s0), this._s1 != null && e(this._s1), this._s2 != null && e(this._s2), this._s3 != null && e(this._s3);
|
|
287
|
+
let t = this._overflow;
|
|
288
|
+
if (t !== null) for (let n = 0, r = t.length; n < r; n++) {
|
|
289
|
+
let r = t[n];
|
|
290
|
+
r != null && e(r);
|
|
291
|
+
}
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
let n = 0, r = this._count;
|
|
295
|
+
for (let i = 0; i < r; i++) {
|
|
296
|
+
let r = this.getAt(i);
|
|
297
|
+
if (r != null && (e(r), ++n >= t)) break;
|
|
298
|
+
}
|
|
253
299
|
}
|
|
254
300
|
compact() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
let
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
t > n && (e[n] = e.pop(), t--, n++);
|
|
263
|
-
} else n++;
|
|
264
|
-
this._freeIndices = null, t === 0 && (this._overflow = null);
|
|
301
|
+
if (this._actualCount === this._count) return;
|
|
302
|
+
let e = 0, t = this._count;
|
|
303
|
+
for (let n = 0; n < t; n++) {
|
|
304
|
+
let t = this.getAt(n);
|
|
305
|
+
t != null && (n !== e && (this._rawWrite(e, t), this._rawWrite(n, null)), e++);
|
|
306
|
+
}
|
|
307
|
+
this._count = this._actualCount, this._overflow !== null && (e <= 4 ? this._overflow = null : this._overflow.length = e - 4), this._freeIndices = null;
|
|
265
308
|
}
|
|
266
309
|
clear() {
|
|
267
|
-
this._s0 =
|
|
310
|
+
this._s0 = this._s1 = this._s2 = this._s3 = null, this._count = 0, this._actualCount = 0, this._overflow = null, this._freeIndices = null;
|
|
268
311
|
}
|
|
269
312
|
dispose() {
|
|
270
313
|
this.clear();
|
|
271
314
|
}
|
|
272
|
-
},
|
|
315
|
+
}, re = class extends ne {
|
|
316
|
+
constructor(...e) {
|
|
317
|
+
super(...e), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1;
|
|
318
|
+
}
|
|
319
|
+
prepareTracking() {
|
|
320
|
+
this.hasComputeds = !1;
|
|
321
|
+
}
|
|
322
|
+
_onItemRemoved(e) {
|
|
323
|
+
e.unsub?.();
|
|
324
|
+
}
|
|
325
|
+
setAt(e, t) {
|
|
326
|
+
let n = this.getAt(e);
|
|
327
|
+
super.setAt(e, t), this._map !== null && (n?.unsub && this._map.delete(n.node), t?.unsub && this._map.set(t.node, e));
|
|
328
|
+
}
|
|
329
|
+
claimExisting(e, t) {
|
|
330
|
+
let n = this._count;
|
|
331
|
+
if (n <= t) return !1;
|
|
332
|
+
let r = this.getAt(t);
|
|
333
|
+
if (r && r.node === e && r.unsub) return r.version = e.version, !0;
|
|
334
|
+
if (this._map !== null || n - t > this._SCAN_THRESHOLD) return this._claimViaMap(e, t);
|
|
335
|
+
for (let r = t + 1; r < n; r++) {
|
|
336
|
+
let n = this.getAt(r);
|
|
337
|
+
if (n && n.node === e && n.unsub) return n.version = e.version, this._rawSwap(r, t), !0;
|
|
338
|
+
}
|
|
339
|
+
return !1;
|
|
340
|
+
}
|
|
341
|
+
_claimViaMap(e, t) {
|
|
342
|
+
this._map === null && (this._map = this._initMap());
|
|
343
|
+
let n = this._map, r = n.get(e);
|
|
344
|
+
if (r === void 0 || r < t) return !1;
|
|
345
|
+
let i = this.getAt(r);
|
|
346
|
+
if (i == null || !i.unsub) return !1;
|
|
347
|
+
if (i.version = e.version, r !== t) {
|
|
348
|
+
let i = this.getAt(t);
|
|
349
|
+
this._rawSwap(r, t), n.set(e, t), i?.unsub && n.set(i.node, r);
|
|
350
|
+
}
|
|
351
|
+
return !0;
|
|
352
|
+
}
|
|
353
|
+
_initMap() {
|
|
354
|
+
let e = /* @__PURE__ */ new Map();
|
|
355
|
+
for (let t = 0; t < this._count; t++) {
|
|
356
|
+
let n = this.getAt(t);
|
|
357
|
+
n?.unsub && e.set(n.node, t);
|
|
358
|
+
}
|
|
359
|
+
return e;
|
|
360
|
+
}
|
|
361
|
+
insertNew(e, t) {
|
|
362
|
+
let n = this.getAt(e);
|
|
363
|
+
if (n !== null) {
|
|
364
|
+
let e = this._rawAdd(n);
|
|
365
|
+
e >= this._count && (this._count = e + 1), this._map !== null && n.unsub && this._map.set(n.node, e);
|
|
366
|
+
}
|
|
367
|
+
this._rawWrite(e, t), e >= this._count && (this._count = e + 1), this._actualCount++, this._map !== null && t.unsub && this._map.set(t.node, e);
|
|
368
|
+
}
|
|
369
|
+
add(e) {
|
|
370
|
+
let t = super.add(e);
|
|
371
|
+
return this._map !== null && e.unsub && this._map.set(e.node, t), t;
|
|
372
|
+
}
|
|
373
|
+
remove(e) {
|
|
374
|
+
throw Error("remove() prohibited");
|
|
375
|
+
}
|
|
376
|
+
compact() {}
|
|
377
|
+
truncateFrom(e) {
|
|
378
|
+
super.truncateFrom(e), this._map !== null && (this._map = null);
|
|
379
|
+
}
|
|
380
|
+
disposeAll() {
|
|
381
|
+
this.truncateFrom(0), this.hasComputeds = !1;
|
|
382
|
+
}
|
|
383
|
+
}, E = /* @__PURE__ */ Symbol.for("atom-effect/brand"), D = {
|
|
384
|
+
Atom: 1,
|
|
385
|
+
Writable: 2,
|
|
386
|
+
Computed: 4,
|
|
387
|
+
Effect: 8
|
|
388
|
+
};
|
|
389
|
+
function ie(e, t) {
|
|
390
|
+
if (!e) return !1;
|
|
391
|
+
let n = typeof e;
|
|
392
|
+
return (n === "object" || n === "function") && !!((e[E] ?? 0) & t);
|
|
393
|
+
}
|
|
394
|
+
function ae(e) {
|
|
395
|
+
return ie(e, D.Atom);
|
|
396
|
+
}
|
|
397
|
+
function oe(e) {
|
|
398
|
+
return ie(e, D.Computed);
|
|
399
|
+
}
|
|
400
|
+
function se(e) {
|
|
401
|
+
if (e instanceof Promise) return !0;
|
|
402
|
+
if (!e) return !1;
|
|
403
|
+
let t = typeof e;
|
|
404
|
+
return (t === "object" || t === "function") && typeof e.then == "function";
|
|
405
|
+
}
|
|
406
|
+
var ce = class {
|
|
407
|
+
constructor(e, t, n = void 0) {
|
|
408
|
+
this.node = e, this.version = t, this.unsub = n;
|
|
409
|
+
}
|
|
410
|
+
}, le = class {
|
|
411
|
+
constructor(e = void 0, t = void 0) {
|
|
412
|
+
this.fn = e, this.sub = t;
|
|
413
|
+
}
|
|
414
|
+
notify(e, t) {
|
|
415
|
+
k(() => {
|
|
416
|
+
let n = this.fn;
|
|
417
|
+
n !== void 0 && n(e, t);
|
|
418
|
+
let r = this.sub;
|
|
419
|
+
r !== void 0 && r.execute();
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}, O = new class {
|
|
273
423
|
constructor() {
|
|
274
|
-
this.
|
|
424
|
+
this.current = null;
|
|
275
425
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
426
|
+
run(e, t) {
|
|
427
|
+
if (this.current === e) return t();
|
|
428
|
+
let n = this.current;
|
|
429
|
+
this.current = e;
|
|
430
|
+
try {
|
|
431
|
+
let e = t();
|
|
432
|
+
return f && T.warn(se(e), "Detected Promise returned within tracking context. Dependencies accessed after \"await\" will NOT be tracked. Consider using synchronous tracking before the async boundary."), e;
|
|
433
|
+
} finally {
|
|
434
|
+
this.current = n;
|
|
435
|
+
}
|
|
280
436
|
}
|
|
281
|
-
|
|
282
|
-
|
|
437
|
+
}();
|
|
438
|
+
function k(e) {
|
|
439
|
+
let t = O, n = t.current;
|
|
440
|
+
if (n === null) return e();
|
|
441
|
+
t.current = null;
|
|
442
|
+
try {
|
|
443
|
+
return e();
|
|
444
|
+
} finally {
|
|
445
|
+
t.current = n;
|
|
283
446
|
}
|
|
284
|
-
}(), w = 1, T = () => w++ | 0;
|
|
285
|
-
function E(e, t, n) {
|
|
286
|
-
return e instanceof m ? e : e instanceof Error ? new t(`${e.name || e.constructor.name || "Error"} (${n}): ${e.message}`, e) : new t(`Unexpected error (${n}): ${String(e)}`);
|
|
287
447
|
}
|
|
288
|
-
var
|
|
448
|
+
var ue = class {
|
|
289
449
|
constructor() {
|
|
290
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch =
|
|
450
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = u.UNINITIALIZED, this._nextEpoch = void 0, this._notifying = 0, this._hotIndex = -1, this._slots = null, this._deps = null, this.id = te() & s;
|
|
291
451
|
}
|
|
292
452
|
get isDisposed() {
|
|
293
|
-
return (this.flags &
|
|
453
|
+
return (this.flags & i.DISPOSED) !== 0;
|
|
294
454
|
}
|
|
295
455
|
get isComputed() {
|
|
296
|
-
return (this.flags &
|
|
456
|
+
return (this.flags & i.IS_COMPUTED) !== 0;
|
|
297
457
|
}
|
|
298
458
|
get hasError() {
|
|
299
459
|
return !1;
|
|
300
460
|
}
|
|
301
461
|
subscribe(e) {
|
|
302
462
|
let t = typeof e == "function";
|
|
303
|
-
if (!t && (!e || typeof e.execute != "function")) throw
|
|
463
|
+
if (!t && (!e || typeof e.execute != "function")) throw y(/* @__PURE__ */ TypeError("Invalid subscriber"), m, v.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
|
|
304
464
|
let n = this._slots;
|
|
305
|
-
n || (n = new
|
|
465
|
+
n || (n = new ne(), this._slots = n);
|
|
306
466
|
let r = !1;
|
|
307
467
|
if (n._s0 != null && (t ? n._s0.fn === e : n._s0.sub === e)) r = !0;
|
|
308
468
|
else if (n._s1 != null && (t ? n._s1.fn === e : n._s1.sub === e)) r = !0;
|
|
@@ -318,8 +478,8 @@ var ee = class {
|
|
|
318
478
|
}
|
|
319
479
|
}
|
|
320
480
|
}
|
|
321
|
-
if (r) return () => {};
|
|
322
|
-
let i = new
|
|
481
|
+
if (r) return f && console.warn(`[atom-effect] Duplicate subscription ignored on node ${this.id}`), () => {};
|
|
482
|
+
let i = new le(t ? e : void 0, t ? void 0 : e);
|
|
323
483
|
return n.add(i), () => this._unsubscribe(i);
|
|
324
484
|
}
|
|
325
485
|
_unsubscribe(e) {
|
|
@@ -371,7 +531,7 @@ var ee = class {
|
|
|
371
531
|
}
|
|
372
532
|
}
|
|
373
533
|
_logNotifyError(e) {
|
|
374
|
-
console.error(
|
|
534
|
+
console.error(y(e, m, v.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
|
|
375
535
|
}
|
|
376
536
|
_isDirty() {
|
|
377
537
|
let e = this._deps;
|
|
@@ -381,92 +541,96 @@ var ee = class {
|
|
|
381
541
|
let n = e.getAt(t);
|
|
382
542
|
if (n != null && n.node.version !== n.version) return !0;
|
|
383
543
|
}
|
|
384
|
-
return
|
|
544
|
+
return this._deepDirtyCheck();
|
|
385
545
|
}
|
|
386
|
-
},
|
|
387
|
-
function
|
|
388
|
-
let e =
|
|
389
|
-
return
|
|
546
|
+
}, de = 0;
|
|
547
|
+
function fe() {
|
|
548
|
+
let e = de + 1 & s;
|
|
549
|
+
return de = e === 0 ? 1 : e, de;
|
|
390
550
|
}
|
|
391
|
-
function
|
|
392
|
-
let t = e + 1 &
|
|
551
|
+
function pe(e) {
|
|
552
|
+
let t = e + 1 & s;
|
|
393
553
|
return t === 0 ? 1 : t;
|
|
394
554
|
}
|
|
395
|
-
var
|
|
396
|
-
function
|
|
397
|
-
return
|
|
555
|
+
var me = 0, he = !1, ge = 0;
|
|
556
|
+
function _e() {
|
|
557
|
+
return ge;
|
|
398
558
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
559
|
+
function ve() {
|
|
560
|
+
return he ? (f && console.warn("startFlush() called during flush - ignored"), !1) : (he = !0, ge = fe(), me = 0, !0);
|
|
401
561
|
}
|
|
402
|
-
function
|
|
403
|
-
|
|
562
|
+
function ye() {
|
|
563
|
+
he = !1;
|
|
404
564
|
}
|
|
405
|
-
function
|
|
406
|
-
if (!
|
|
407
|
-
let e = ++
|
|
408
|
-
if (e <=
|
|
409
|
-
throw Error(`[atom-effect] Infinite loop detected: flush execution count exceeded ${
|
|
565
|
+
function be() {
|
|
566
|
+
if (!he) return 0;
|
|
567
|
+
let e = ++me;
|
|
568
|
+
if (e <= o.MAX_EXECUTIONS_PER_FLUSH) return e;
|
|
569
|
+
throw Error(`[atom-effect] Infinite loop detected: flush execution count exceeded ${o.MAX_EXECUTIONS_PER_FLUSH}`);
|
|
410
570
|
}
|
|
411
|
-
var
|
|
571
|
+
var A = new class {
|
|
412
572
|
constructor() {
|
|
413
|
-
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations =
|
|
573
|
+
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = o.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
|
|
414
574
|
}
|
|
415
575
|
get queueSize() {
|
|
416
|
-
return this._size;
|
|
576
|
+
return this._size + this._batchQueueSize;
|
|
417
577
|
}
|
|
418
578
|
get isBatching() {
|
|
419
579
|
return this._batchDepth > 0;
|
|
420
580
|
}
|
|
421
581
|
schedule(e) {
|
|
582
|
+
if (f && typeof e != "function" && (!e || typeof e.execute != "function")) throw new _(v.SCHEDULER_CALLBACK_MUST_BE_FUNCTION);
|
|
422
583
|
let t = this._epoch;
|
|
423
584
|
if (e._nextEpoch === t) return;
|
|
424
585
|
if (e._nextEpoch = t, this._batchDepth > 0 || this._isFlushingSync) {
|
|
425
586
|
this._batchQueue[this._batchQueueSize++] = e;
|
|
426
587
|
return;
|
|
427
588
|
}
|
|
428
|
-
let n = this.
|
|
429
|
-
|
|
589
|
+
let n = this._queueBuffer[this._bufferIndex];
|
|
590
|
+
n[this._size++] = e, this._isProcessing || this._flush();
|
|
430
591
|
}
|
|
431
592
|
_flush() {
|
|
432
593
|
this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this._boundRunLoop));
|
|
433
594
|
}
|
|
434
595
|
_runLoop() {
|
|
435
596
|
try {
|
|
436
|
-
if (this._size === 0) return;
|
|
437
|
-
let e =
|
|
438
|
-
this._drainQueue(), e &&
|
|
597
|
+
if (this._size === 0 && this._batchQueueSize === 0) return;
|
|
598
|
+
let e = ve();
|
|
599
|
+
this._drainQueue(), e && ye();
|
|
439
600
|
} finally {
|
|
440
|
-
this._isProcessing = !1
|
|
601
|
+
this._isProcessing = !1;
|
|
441
602
|
}
|
|
442
603
|
}
|
|
443
604
|
_flushSync() {
|
|
605
|
+
if (this._size === 0 && this._batchQueueSize === 0) return;
|
|
606
|
+
let e = this._isFlushingSync;
|
|
444
607
|
this._isFlushingSync = !0;
|
|
445
|
-
let
|
|
608
|
+
let t = ve();
|
|
446
609
|
try {
|
|
447
610
|
this._mergeBatchQueue(), this._drainQueue();
|
|
448
611
|
} finally {
|
|
449
|
-
this._isFlushingSync =
|
|
612
|
+
this._isFlushingSync = e, t && ye();
|
|
450
613
|
}
|
|
451
614
|
}
|
|
452
615
|
_mergeBatchQueue() {
|
|
453
616
|
let e = this._batchQueueSize;
|
|
454
617
|
if (e === 0) return;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
618
|
+
this._epoch = this._epoch + 1 | 0;
|
|
619
|
+
let t = this._epoch, n = this._batchQueue, r = this._queueBuffer[this._bufferIndex], i = this._size;
|
|
620
|
+
for (let a = 0; a < e; a++) {
|
|
621
|
+
let e = n[a];
|
|
622
|
+
e._nextEpoch !== t && (e._nextEpoch = t, r[i++] = e), n[a] = void 0;
|
|
459
623
|
}
|
|
460
|
-
this._size =
|
|
624
|
+
this._size = i, this._batchQueueSize = 0, n.length > o.BATCH_QUEUE_SHRINK_THRESHOLD && (n.length = 0);
|
|
461
625
|
}
|
|
462
626
|
_drainQueue() {
|
|
463
627
|
let e = 0;
|
|
464
|
-
for (; this._size > 0;) {
|
|
628
|
+
for (; this._size > 0 || this._batchQueueSize > 0;) {
|
|
465
629
|
if (++e > this._maxFlushIterations) {
|
|
466
630
|
this._handleFlushOverflow();
|
|
467
631
|
return;
|
|
468
632
|
}
|
|
469
|
-
this.
|
|
633
|
+
this._batchQueueSize > 0 && this._mergeBatchQueue(), this._size > 0 && this._processQueue();
|
|
470
634
|
}
|
|
471
635
|
}
|
|
472
636
|
_processQueue() {
|
|
@@ -474,96 +638,81 @@ var D = new class {
|
|
|
474
638
|
this._bufferIndex = e ^ 1, this._size = 0, this._epoch = this._epoch + 1 | 0;
|
|
475
639
|
for (let e = 0; e < n; e++) {
|
|
476
640
|
let n = t[e];
|
|
641
|
+
t[e] = void 0;
|
|
477
642
|
try {
|
|
478
643
|
typeof n == "function" ? n() : n.execute();
|
|
479
644
|
} catch (e) {
|
|
480
645
|
console.error(new _("Error occurred during scheduler execution", e));
|
|
481
646
|
}
|
|
482
647
|
}
|
|
483
|
-
t.length = 0;
|
|
484
648
|
}
|
|
485
649
|
_handleFlushOverflow() {
|
|
486
|
-
let e = this._size + this._batchQueueSize
|
|
487
|
-
console.error(new _(v.SCHEDULER_FLUSH_OVERFLOW(
|
|
488
|
-
let
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (r) try {
|
|
492
|
-
r(e);
|
|
650
|
+
let e = this._size + this._batchQueueSize;
|
|
651
|
+
console.error(new _(v.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, e))), this._size = 0, this._queueBuffer[0].length = 0, this._queueBuffer[1].length = 0, this._batchQueueSize = 0, this._batchQueue.length = 0;
|
|
652
|
+
let t = this.onOverflow;
|
|
653
|
+
if (t) try {
|
|
654
|
+
t(e);
|
|
493
655
|
} catch {}
|
|
494
656
|
}
|
|
495
657
|
startBatch() {
|
|
496
658
|
this._batchDepth++;
|
|
497
659
|
}
|
|
498
660
|
endBatch() {
|
|
499
|
-
|
|
661
|
+
if (this._batchDepth === 0) {
|
|
662
|
+
f && console.warn(v.SCHEDULER_END_BATCH_WITHOUT_START);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
--this._batchDepth === 0 && (this._isFlushingSync || this._flushSync());
|
|
500
666
|
}
|
|
501
667
|
setMaxFlushIterations(e) {
|
|
502
|
-
if (e <
|
|
668
|
+
if (e < o.MIN_FLUSH_ITERATIONS) throw new _(`Max iterations must be at least ${o.MIN_FLUSH_ITERATIONS}`);
|
|
503
669
|
this._maxFlushIterations = e;
|
|
504
670
|
}
|
|
505
|
-
}(), de = /* @__PURE__ */ Symbol.for("atom-effect/atom"), fe = /* @__PURE__ */ Symbol.for("atom-effect/computed"), pe = /* @__PURE__ */ Symbol.for("atom-effect/effect"), me = /* @__PURE__ */ Symbol.for("atom-effect/writable"), O = new class {
|
|
506
|
-
constructor() {
|
|
507
|
-
this.current = null;
|
|
508
|
-
}
|
|
509
|
-
run(e, t) {
|
|
510
|
-
if (this.current === e) return t();
|
|
511
|
-
let n = this.current;
|
|
512
|
-
this.current = e;
|
|
513
|
-
try {
|
|
514
|
-
return t();
|
|
515
|
-
} finally {
|
|
516
|
-
this.current = n;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
671
|
}();
|
|
520
|
-
function
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
t.current = null;
|
|
672
|
+
function xe(e) {
|
|
673
|
+
if (f && typeof e != "function") throw TypeError(v.BATCH_CALLBACK_MUST_BE_FUNCTION);
|
|
674
|
+
A.startBatch();
|
|
524
675
|
try {
|
|
525
676
|
return e();
|
|
526
677
|
} finally {
|
|
527
|
-
|
|
678
|
+
A.endBatch();
|
|
528
679
|
}
|
|
529
680
|
}
|
|
530
|
-
var
|
|
681
|
+
var Se = class extends ue {
|
|
531
682
|
constructor(e, t) {
|
|
532
|
-
super(), this[
|
|
683
|
+
super(), this[E] = D.Atom | D.Writable, this._value = e, this._equal = t.equal ?? Object.is, t.sync && (this.flags |= a.SYNC), T.attachDebugInfo(this, "atom", this.id, t.name);
|
|
533
684
|
}
|
|
534
685
|
get isNotificationScheduled() {
|
|
535
|
-
return (this.flags &
|
|
686
|
+
return (this.flags & a.NOTIFICATION_SCHEDULED) !== 0;
|
|
536
687
|
}
|
|
537
688
|
get isSync() {
|
|
538
|
-
return (this.flags &
|
|
689
|
+
return (this.flags & a.SYNC) !== 0;
|
|
539
690
|
}
|
|
540
691
|
get value() {
|
|
541
692
|
return O.current?.addDependency(this), this._value;
|
|
542
693
|
}
|
|
543
694
|
set value(e) {
|
|
544
695
|
let t = this._value;
|
|
545
|
-
if (
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if ((n & i.NOTIFICATION_SCHEDULED) !== 0) return;
|
|
549
|
-
let r = this._slots;
|
|
550
|
-
r == null || r.size === 0 || (this._pendingOldValue = t, this.flags = n | i.NOTIFICATION_SCHEDULED, (n & i.SYNC) !== 0 && !D.isBatching ? this._flushNotifications() : D.schedule(this));
|
|
696
|
+
if (this._equal(t, e) || (this._value = e, this.version = pe(this.version), T.trackUpdate(this.id, T.getDebugName(this)), (this.flags & a.NOTIFICATION_SCHEDULED) !== 0)) return;
|
|
697
|
+
let n = this._slots;
|
|
698
|
+
n == null || n.size === 0 || (this._pendingOldValue = t, this.flags |= a.NOTIFICATION_SCHEDULED, (this.flags & a.SYNC) !== 0 && !A.isBatching ? this._notifying === 0 && this._flushNotifications() : A.schedule(this));
|
|
551
699
|
}
|
|
552
700
|
execute() {
|
|
553
701
|
this._flushNotifications();
|
|
554
702
|
}
|
|
555
703
|
_flushNotifications() {
|
|
556
|
-
let e =
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
704
|
+
let e = a.NOTIFICATION_SCHEDULED, t = a.DISPOSED, n = a.SYNC;
|
|
705
|
+
for (; (this.flags & (e | t)) === e;) {
|
|
706
|
+
let t = this._pendingOldValue;
|
|
707
|
+
if (this._pendingOldValue = void 0, this.flags &= ~e, this._equal(this._value, t) || this._notifySubscribers(this._value, t), (this.flags & n) === 0 || A.isBatching) break;
|
|
708
|
+
}
|
|
560
709
|
}
|
|
561
710
|
peek() {
|
|
562
711
|
return this._value;
|
|
563
712
|
}
|
|
564
713
|
dispose() {
|
|
565
714
|
let e = this.flags;
|
|
566
|
-
(e &
|
|
715
|
+
(e & a.DISPOSED) === 0 && (this._slots?.clear(), this.flags = e | a.DISPOSED, this._value = void 0, this._pendingOldValue = void 0, this._equal = Object.is);
|
|
567
716
|
}
|
|
568
717
|
_deepDirtyCheck() {
|
|
569
718
|
return !1;
|
|
@@ -572,189 +721,13 @@ var he = class extends ee {
|
|
|
572
721
|
this.dispose();
|
|
573
722
|
}
|
|
574
723
|
};
|
|
575
|
-
function
|
|
576
|
-
return new
|
|
724
|
+
function Ce(e, t = {}) {
|
|
725
|
+
return new Se(e, t);
|
|
577
726
|
}
|
|
578
|
-
var
|
|
579
|
-
constructor(...e) {
|
|
580
|
-
super(...e), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1, this._depsHash = 0;
|
|
581
|
-
}
|
|
582
|
-
prepareTracking() {
|
|
583
|
-
this.hasComputeds = !1;
|
|
584
|
-
}
|
|
585
|
-
_onItemRemoved(e) {
|
|
586
|
-
let t = e.unsub;
|
|
587
|
-
t && t();
|
|
588
|
-
}
|
|
589
|
-
claimExisting(e, t) {
|
|
590
|
-
let n = this._count;
|
|
591
|
-
if (t >= n) return !1;
|
|
592
|
-
let r = n - t;
|
|
593
|
-
if (this._map !== null || r > this._SCAN_THRESHOLD) return this._claimViaMap(e, t);
|
|
594
|
-
if (t < 4) switch (t) {
|
|
595
|
-
case 0: {
|
|
596
|
-
let t = this._s0;
|
|
597
|
-
if (t && t.node === e && t.unsub) return t.version = e.version, !0;
|
|
598
|
-
}
|
|
599
|
-
case 1: if (n > 1) {
|
|
600
|
-
let n = this._s1;
|
|
601
|
-
if (n && n.node === e && n.unsub) return n.version = e.version, t !== 1 && (this._s1 = this._s0, this._s0 = n), !0;
|
|
602
|
-
}
|
|
603
|
-
case 2: if (n > 2) {
|
|
604
|
-
let n = this._s2;
|
|
605
|
-
if (n && n.node === e && n.unsub) {
|
|
606
|
-
if (n.version = e.version, t !== 2) {
|
|
607
|
-
let e = t === 0 ? this._s0 : this._s1;
|
|
608
|
-
t === 0 ? this._s0 = n : this._s1 = n, this._s2 = e;
|
|
609
|
-
}
|
|
610
|
-
return !0;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
case 3: if (n > 3) {
|
|
614
|
-
let n = this._s3;
|
|
615
|
-
if (n && n.node === e && n.unsub) {
|
|
616
|
-
if (n.version = e.version, t !== 3) {
|
|
617
|
-
let e;
|
|
618
|
-
t === 0 ? (e = this._s0, this._s0 = n) : t === 1 ? (e = this._s1, this._s1 = n) : (e = this._s2, this._s2 = n), this._s3 = e;
|
|
619
|
-
}
|
|
620
|
-
return !0;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
let i = this._overflow;
|
|
625
|
-
if (i) {
|
|
626
|
-
let n = e.version, r = t > 4 ? t : 4, a = i.length;
|
|
627
|
-
for (let o = r - 4; o < a; o++) {
|
|
628
|
-
let r = i[o];
|
|
629
|
-
if (r && r.node === e && r.unsub) return r.version = n, this._swapGeneral(o + 4, t, r), !0;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
return !1;
|
|
633
|
-
}
|
|
634
|
-
_claimViaMap(e, t) {
|
|
635
|
-
let n = this._map;
|
|
636
|
-
if (n === null) {
|
|
637
|
-
n = this._map = /* @__PURE__ */ new Map();
|
|
638
|
-
let e = this._count;
|
|
639
|
-
if (t < 4) {
|
|
640
|
-
let e = this._s0;
|
|
641
|
-
t <= 0 && e?.unsub && n.set(e.node, 0);
|
|
642
|
-
let r = this._s1;
|
|
643
|
-
t <= 1 && r?.unsub && n.set(r.node, 1);
|
|
644
|
-
let i = this._s2;
|
|
645
|
-
t <= 2 && i?.unsub && n.set(i.node, 2);
|
|
646
|
-
let a = this._s3;
|
|
647
|
-
t <= 3 && a?.unsub && n.set(a.node, 3);
|
|
648
|
-
}
|
|
649
|
-
let r = this._overflow;
|
|
650
|
-
if (r && e > 4) {
|
|
651
|
-
let e = t > 4 ? t : 4, i = r.length;
|
|
652
|
-
for (let t = e - 4; t < i; t++) {
|
|
653
|
-
let e = r[t];
|
|
654
|
-
e?.unsub && n.set(e.node, t + 4);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
let r = n.get(e);
|
|
659
|
-
if (r === void 0 || r < t) return !1;
|
|
660
|
-
let i = this.getAt(r);
|
|
661
|
-
if (i == null || !i.unsub) return !1;
|
|
662
|
-
if (i.version = e.version, r !== t) {
|
|
663
|
-
let a;
|
|
664
|
-
a = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, i), this.setAt(r, a), a?.unsub && n.set(a.node, r), n.set(e, t);
|
|
665
|
-
}
|
|
666
|
-
return !0;
|
|
667
|
-
}
|
|
668
|
-
_swapGeneral(e, t, n) {
|
|
669
|
-
if (e === t) return;
|
|
670
|
-
let r;
|
|
671
|
-
if (r = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, n), e === 0) this._s0 = r;
|
|
672
|
-
else if (e === 1) this._s1 = r;
|
|
673
|
-
else if (e === 2) this._s2 = r;
|
|
674
|
-
else if (e === 3) this._s3 = r;
|
|
675
|
-
else {
|
|
676
|
-
let t = this._overflow;
|
|
677
|
-
t[e - 4] = r;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
insertNew(e, t) {
|
|
681
|
-
let n = this._count;
|
|
682
|
-
if (e < n) {
|
|
683
|
-
let t;
|
|
684
|
-
t = e === 0 ? this._s0 : e === 1 ? this._s1 : e === 2 ? this._s2 : e === 3 ? this._s3 : this._overflow[e - 4] ?? null, t != null && (this._addToOverflow(t), this._map !== null && t.unsub && this._map.set(t.node, this._count - 1));
|
|
685
|
-
}
|
|
686
|
-
if (e === 0) this._s0 = t;
|
|
687
|
-
else if (e === 1) this._s1 = t;
|
|
688
|
-
else if (e === 2) this._s2 = t;
|
|
689
|
-
else if (e === 3) this._s3 = t;
|
|
690
|
-
else {
|
|
691
|
-
let n = this._overflow;
|
|
692
|
-
n || (n = [], this._overflow = n), n[e - 4] = t;
|
|
693
|
-
}
|
|
694
|
-
e >= n && (this._count = e + 1);
|
|
695
|
-
}
|
|
696
|
-
truncateFrom(e) {
|
|
697
|
-
e >= this._count || (super.truncateFrom(e), this._map !== null && (this._map.clear(), this._map = null));
|
|
698
|
-
}
|
|
699
|
-
seal() {
|
|
700
|
-
this._depsHash = this._calculateHash(!1);
|
|
701
|
-
}
|
|
702
|
-
isDirtyFast() {
|
|
703
|
-
return this._calculateHash(!0) !== this._depsHash;
|
|
704
|
-
}
|
|
705
|
-
_calculateHash(e) {
|
|
706
|
-
let t = this._count;
|
|
707
|
-
if (t === 0) return 0;
|
|
708
|
-
let n = u.VERSION_BITS, r = 0, i = this._s0;
|
|
709
|
-
if (i != null) {
|
|
710
|
-
let a = i.node, o = e ? a.version : i.version;
|
|
711
|
-
r = r + (o << n) + a.id | 0;
|
|
712
|
-
let s = this._s1;
|
|
713
|
-
if (t > 1 && s != null) {
|
|
714
|
-
let i = s.node, a = e ? i.version : s.version;
|
|
715
|
-
r = r + (a << n) + i.id | 0;
|
|
716
|
-
let o = this._s2;
|
|
717
|
-
if (t > 2 && o != null) {
|
|
718
|
-
let i = o.node, a = e ? i.version : o.version;
|
|
719
|
-
r = r + (a << n) + i.id | 0;
|
|
720
|
-
let s = this._s3;
|
|
721
|
-
if (t > 3 && s != null) {
|
|
722
|
-
let t = s.node, i = e ? t.version : s.version;
|
|
723
|
-
r = r + (i << n) + t.id | 0;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
if (t > 4) {
|
|
729
|
-
let t = this._overflow;
|
|
730
|
-
for (let i = 0, a = t.length; i < a; i++) {
|
|
731
|
-
let a = t[i], o = a.node, s = e ? o.version : a.version;
|
|
732
|
-
r = r + (s << n) + o.id | 0;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
return r;
|
|
736
|
-
}
|
|
737
|
-
disposeAll() {
|
|
738
|
-
this._count > 0 && this.truncateFrom(0), this.hasComputeds = !1;
|
|
739
|
-
}
|
|
740
|
-
remove(e) {
|
|
741
|
-
throw Error("remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.");
|
|
742
|
-
}
|
|
743
|
-
compact() {}
|
|
744
|
-
};
|
|
745
|
-
function _e(e) {
|
|
746
|
-
return typeof e == "object" && !!e && de in e;
|
|
747
|
-
}
|
|
748
|
-
function ve(e) {
|
|
749
|
-
return typeof e == "object" && !!e && fe in e;
|
|
750
|
-
}
|
|
751
|
-
function ye(e) {
|
|
752
|
-
return typeof e == "object" && !!e && typeof e.then == "function";
|
|
753
|
-
}
|
|
754
|
-
var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RECOMPUTING: I, DISPOSED: xe, IS_COMPUTED: Se, FORCE_COMPUTE: Ce } = r, we = class extends ee {
|
|
727
|
+
var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RECOMPUTING: I, DISPOSED: Te, IS_COMPUTED: L, FORCE_COMPUTE: Ee } = i, De = class extends ue {
|
|
755
728
|
constructor(e, t = {}) {
|
|
756
729
|
if (typeof e != "function") throw new h(v.COMPUTED_MUST_BE_FUNCTION);
|
|
757
|
-
if (super(), this[
|
|
730
|
+
if (super(), this[E] = D.Atom | D.Computed, this._error = null, this._promiseId = 0, this._deps = new re(), this._trackEpoch = u.UNINITIALIZED, this._trackCount = 0, this._value = void 0, this.flags = L | M | j, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : C, this._onError = t.onError ?? null, T.attachDebugInfo(this, "computed", this.id, t.name), t.lazy === !1) try {
|
|
758
731
|
this._recompute();
|
|
759
732
|
} catch {}
|
|
760
733
|
}
|
|
@@ -768,7 +741,7 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
768
741
|
return (this.flags & I) !== 0;
|
|
769
742
|
}
|
|
770
743
|
get _hasErrorInternal() {
|
|
771
|
-
return (this.flags &
|
|
744
|
+
return (this.flags & we) !== 0;
|
|
772
745
|
}
|
|
773
746
|
_track() {
|
|
774
747
|
O.current?.addDependency(this);
|
|
@@ -777,17 +750,17 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
777
750
|
O.current?.addDependency(this);
|
|
778
751
|
let e = this.flags;
|
|
779
752
|
if ((e & (P | M | j)) === P) return this._value;
|
|
780
|
-
if ((e &
|
|
753
|
+
if ((e & Te) !== 0) throw new h(v.COMPUTED_DISPOSED);
|
|
781
754
|
if ((e & I) !== 0) {
|
|
782
755
|
let e = this._defaultValue;
|
|
783
|
-
if (e !==
|
|
756
|
+
if (e !== C) return e;
|
|
784
757
|
throw new h(v.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
785
758
|
}
|
|
786
759
|
if ((e & (M | j)) !== 0) {
|
|
787
760
|
let t = this._deps;
|
|
788
|
-
if ((e & j) === 0 && (e &
|
|
761
|
+
if ((e & j) === 0 && (e & Ee) === 0 && t.size > 0 && !this._isDirty() ? e = this.flags &= ~M : (this._recompute(), e = this.flags), (e & P) !== 0) return this._value;
|
|
789
762
|
}
|
|
790
|
-
let t = this._defaultValue, n = t !==
|
|
763
|
+
let t = this._defaultValue, n = t !== C;
|
|
791
764
|
if ((e & N) !== 0) {
|
|
792
765
|
if (n) return t;
|
|
793
766
|
throw new h(v.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
@@ -804,15 +777,16 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
804
777
|
get state() {
|
|
805
778
|
O.current?.addDependency(this);
|
|
806
779
|
let e = this.flags;
|
|
807
|
-
return (e & P) === 0 ? (e & N) === 0 ? (e & F) === 0 ?
|
|
780
|
+
return (e & P) === 0 ? (e & N) === 0 ? (e & F) === 0 ? n.IDLE : n.REJECTED : n.PENDING : n.RESOLVED;
|
|
808
781
|
}
|
|
809
782
|
get hasError() {
|
|
810
|
-
if (O.current?.addDependency(this), (this.flags & (F |
|
|
783
|
+
if (O.current?.addDependency(this), (this.flags & (F | we)) !== 0) return !0;
|
|
811
784
|
let e = this._deps;
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
785
|
+
return e.hasComputeds ? k(() => {
|
|
786
|
+
let t = e.size;
|
|
787
|
+
for (let n = 0; n < t; n++) if (e.getAt(n)?.node.hasError) return !0;
|
|
788
|
+
return !1;
|
|
789
|
+
}) : !1;
|
|
816
790
|
}
|
|
817
791
|
get isValid() {
|
|
818
792
|
return !this.hasError;
|
|
@@ -820,23 +794,25 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
820
794
|
get errors() {
|
|
821
795
|
O.current?.addDependency(this);
|
|
822
796
|
let e = this._error, t = this._deps;
|
|
823
|
-
if (!t.hasComputeds) return e == null ?
|
|
797
|
+
if (!t.hasComputeds) return e == null ? p : Object.freeze([e]);
|
|
824
798
|
let n = [];
|
|
825
|
-
e != null && n.push(e)
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
}
|
|
833
|
-
return n.length === 0 ? d : Object.freeze(n);
|
|
799
|
+
return e != null && n.push(e), k(() => {
|
|
800
|
+
let e = t.size;
|
|
801
|
+
for (let r = 0; r < e; r++) {
|
|
802
|
+
let e = t.getAt(r)?.node;
|
|
803
|
+
e != null && (e.flags & L) !== 0 && this._accumulateErrors(e, n);
|
|
804
|
+
}
|
|
805
|
+
}), n.length === 0 ? p : Object.freeze(n);
|
|
834
806
|
}
|
|
835
|
-
|
|
836
|
-
let n = e.
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
807
|
+
_accumulateErrors(e, t) {
|
|
808
|
+
let n = e._error;
|
|
809
|
+
n != null && !t.includes(n) && t.push(n);
|
|
810
|
+
let r = e._deps;
|
|
811
|
+
if (!r.hasComputeds) return;
|
|
812
|
+
let i = r.size;
|
|
813
|
+
for (let e = 0; e < i; e++) {
|
|
814
|
+
let n = r.getAt(e)?.node;
|
|
815
|
+
n != null && (n.flags & L) !== 0 && this._accumulateErrors(n, t);
|
|
840
816
|
}
|
|
841
817
|
}
|
|
842
818
|
get lastError() {
|
|
@@ -849,10 +825,10 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
849
825
|
return O.current?.addDependency(this), (this.flags & P) !== 0;
|
|
850
826
|
}
|
|
851
827
|
invalidate() {
|
|
852
|
-
this.flags |=
|
|
828
|
+
this.flags |= Ee, this._markDirty();
|
|
853
829
|
}
|
|
854
830
|
dispose() {
|
|
855
|
-
(this.flags &
|
|
831
|
+
(this.flags & Te) === 0 && (this._deps.disposeAll(), this._slots != null && this._slots.clear(), this.flags = Te | M | j, this._error = null, this._value = void 0, this._hotIndex = -1);
|
|
856
832
|
}
|
|
857
833
|
[Symbol.dispose]() {
|
|
858
834
|
this.dispose();
|
|
@@ -864,109 +840,102 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: be, RE
|
|
|
864
840
|
let n = this._trackCount++, r = this._deps, i = r.getAt(n);
|
|
865
841
|
if (i != null && i.node === e) i.version = e.version;
|
|
866
842
|
else if (!r.claimExisting(e, n)) {
|
|
867
|
-
let t = new
|
|
843
|
+
let t = new ce(e, e.version, e.subscribe(this));
|
|
868
844
|
r.insertNew(n, t);
|
|
869
845
|
}
|
|
870
|
-
(e.flags &
|
|
846
|
+
(e.flags & L) !== 0 && (r.hasComputeds = !0);
|
|
871
847
|
}
|
|
872
848
|
_recompute() {
|
|
873
849
|
if (this.isRecomputing) return;
|
|
874
|
-
this.flags = (this.flags | I) & ~
|
|
850
|
+
this.flags = (this.flags | I) & ~Ee, this._trackEpoch = fe(), this._trackCount = 0, this._deps.prepareTracking(), this._hotIndex = -1;
|
|
875
851
|
let e = !1;
|
|
876
852
|
try {
|
|
877
853
|
let t = O.run(this, this._fn);
|
|
878
|
-
this._deps.truncateFrom(this._trackCount),
|
|
854
|
+
this._deps.truncateFrom(this._trackCount), e = !0, se(t) ? this._handleAsyncComputation(t) : this._finalizeResolution(t);
|
|
879
855
|
} catch (t) {
|
|
880
856
|
if (!e) try {
|
|
881
857
|
this._deps.truncateFrom(this._trackCount);
|
|
882
|
-
} catch {
|
|
858
|
+
} catch (e) {
|
|
859
|
+
f && console.warn("[atom-effect] _commitDeps failed during error recovery:", e);
|
|
860
|
+
}
|
|
883
861
|
this._handleError(t, v.COMPUTED_COMPUTATION_FAILED, !0);
|
|
884
862
|
} finally {
|
|
885
|
-
this._trackEpoch =
|
|
863
|
+
this._trackEpoch = u.UNINITIALIZED, this._trackCount = 0, this.flags &= ~I;
|
|
886
864
|
}
|
|
887
865
|
}
|
|
888
866
|
_handleAsyncComputation(e) {
|
|
889
|
-
this.flags = (this.flags | N) & ~(j | M | P | F), this._notifySubscribers(void 0, void 0), this.
|
|
867
|
+
this.flags = (this.flags | N) & ~(j | M | P | F), this._notifySubscribers(void 0, void 0), this._promiseId = (this._promiseId + 1) % l.MAX_PROMISE_ID;
|
|
890
868
|
let t = this._promiseId;
|
|
891
869
|
e.then((e) => {
|
|
892
870
|
if (t === this._promiseId) {
|
|
893
|
-
if (this._isDirty())
|
|
894
|
-
let e = se();
|
|
895
|
-
return this._lastDriftEpoch !== e && (this._lastDriftEpoch = e, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(new h(`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`), v.COMPUTED_ASYNC_COMPUTATION_FAILED);
|
|
896
|
-
}
|
|
871
|
+
if (this._isDirty()) return this._markDirty();
|
|
897
872
|
this._finalizeResolution(e), this._notifySubscribers(e, void 0);
|
|
898
873
|
}
|
|
899
874
|
}, (e) => t === this._promiseId && this._handleError(e, v.COMPUTED_ASYNC_COMPUTATION_FAILED));
|
|
900
875
|
}
|
|
901
876
|
_handleError(e, t, n = !1) {
|
|
902
|
-
let r =
|
|
903
|
-
if (!
|
|
877
|
+
let r = y(e, h, t);
|
|
878
|
+
if ((!this.isRejected || this._error !== r) && (this.version = pe(this.version)), this._error = r, this.flags = this.flags & ~(j | M | N | P) | F | we, this._onError) try {
|
|
904
879
|
this._onError(r);
|
|
905
880
|
} catch (e) {
|
|
906
881
|
console.error(v.CALLBACK_ERROR_IN_ERROR_HANDLER, e);
|
|
907
882
|
}
|
|
908
|
-
if (n) throw r;
|
|
909
|
-
this._notifySubscribers(void 0, void 0);
|
|
883
|
+
if (this._notifySubscribers(void 0, void 0), n) throw r;
|
|
910
884
|
}
|
|
911
885
|
_finalizeResolution(e) {
|
|
912
886
|
let t = this.flags;
|
|
913
|
-
((t & P) === 0 || !this._equal(this._value, e)) && (this.version =
|
|
887
|
+
((t & P) === 0 || !this._equal(this._value, e)) && (this.version = pe(this.version)), this._value = e, this._error = null, this.flags = (t | P) & ~(j | M | N | F | we);
|
|
914
888
|
}
|
|
915
889
|
execute() {
|
|
916
890
|
this._markDirty();
|
|
917
891
|
}
|
|
918
892
|
_markDirty() {
|
|
919
893
|
let e = this.flags;
|
|
920
|
-
(e & (I | M)) === 0 && (this.flags = e | M, this._notifySubscribers(void 0, void 0));
|
|
921
|
-
}
|
|
922
|
-
_isDirty() {
|
|
923
|
-
let e = this._deps;
|
|
924
|
-
return e.hasComputeds ? this._deepDirtyCheck() : e.isDirtyFast();
|
|
894
|
+
(e & (I | M)) === 0 && (this.flags = e | M, T.trackUpdate(this.id, T.getDebugName(this)), this._notifySubscribers(void 0, void 0));
|
|
925
895
|
}
|
|
926
896
|
_deepDirtyCheck() {
|
|
927
|
-
let e = this._deps
|
|
928
|
-
|
|
929
|
-
try {
|
|
897
|
+
let e = this._deps;
|
|
898
|
+
return k(() => {
|
|
930
899
|
let t = e.size;
|
|
931
900
|
for (let n = 0; n < t; n++) {
|
|
932
901
|
let t = e.getAt(n);
|
|
933
902
|
if (t == null) continue;
|
|
934
903
|
let r = t.node;
|
|
935
|
-
if ((r.flags &
|
|
904
|
+
if ((r.flags & L) !== 0) try {
|
|
936
905
|
r.value;
|
|
937
|
-
} catch {
|
|
906
|
+
} catch {
|
|
907
|
+
f && console.warn(`[atom-effect] Dependency #${r.id} threw during dirty check`);
|
|
908
|
+
}
|
|
938
909
|
if (r.version !== t.version) return this._hotIndex = n, !0;
|
|
939
910
|
}
|
|
940
911
|
return this._hotIndex = -1, !1;
|
|
941
|
-
}
|
|
942
|
-
O.current = t;
|
|
943
|
-
}
|
|
912
|
+
});
|
|
944
913
|
}
|
|
945
914
|
};
|
|
946
|
-
function
|
|
947
|
-
return new
|
|
915
|
+
function Oe(e, t = {}) {
|
|
916
|
+
return new De(e, t);
|
|
948
917
|
}
|
|
949
|
-
var
|
|
918
|
+
var ke = class extends ue {
|
|
950
919
|
constructor(e, t = {}) {
|
|
951
|
-
super(), this[
|
|
920
|
+
super(), this[E] = D.Effect, this._cleanup = null, this._deps = new re(), this._currentEpoch = u.UNINITIALIZED, this._lastFlushEpoch = u.UNINITIALIZED, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? o.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? o.MAX_EXECUTIONS_PER_EFFECT, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => A.schedule(this), T.attachDebugInfo(this, "effect", this.id, t.name);
|
|
952
921
|
}
|
|
953
922
|
run() {
|
|
954
923
|
if (this.isDisposed) throw new g(v.EFFECT_DISPOSED);
|
|
955
924
|
this.execute(!0);
|
|
956
925
|
}
|
|
957
926
|
dispose() {
|
|
958
|
-
this.isDisposed || (this.flags |=
|
|
927
|
+
this.isDisposed || (this.flags |= r.DISPOSED, this._execCleanup(), this._deps?.disposeAll());
|
|
959
928
|
}
|
|
960
929
|
[Symbol.dispose]() {
|
|
961
930
|
this.dispose();
|
|
962
931
|
}
|
|
963
932
|
addDependency(e) {
|
|
964
|
-
if ((this.flags &
|
|
933
|
+
if ((this.flags & r.EXECUTING) === 0) return;
|
|
965
934
|
let t = this._currentEpoch;
|
|
966
935
|
if (e._lastSeenEpoch === t) return;
|
|
967
936
|
e._lastSeenEpoch = t;
|
|
968
|
-
let
|
|
969
|
-
switch (
|
|
937
|
+
let n = this._trackCount++, i = this._deps, a;
|
|
938
|
+
switch (n) {
|
|
970
939
|
case 0:
|
|
971
940
|
a = i._s0;
|
|
972
941
|
break;
|
|
@@ -979,47 +948,45 @@ var Te = class extends ee {
|
|
|
979
948
|
case 3:
|
|
980
949
|
a = i._s3;
|
|
981
950
|
break;
|
|
982
|
-
default: a = i.getAt(
|
|
951
|
+
default: a = i.getAt(n);
|
|
983
952
|
}
|
|
984
|
-
a != null && a.node === e ? a.version = e.version : i.claimExisting(e,
|
|
953
|
+
a != null && a.node === e ? a.version = e.version : i.claimExisting(e, n) || this._insertNewDependency(e, n), e.isComputed && (i.hasComputeds = !0);
|
|
985
954
|
}
|
|
986
955
|
_insertNewDependency(e, t) {
|
|
987
956
|
let n;
|
|
988
957
|
try {
|
|
989
958
|
let t = e.subscribe(this._notifyCallback);
|
|
990
|
-
n = new
|
|
959
|
+
n = new ce(e, e.version, t);
|
|
991
960
|
} catch (t) {
|
|
992
|
-
let r =
|
|
961
|
+
let r = y(t, g, v.EFFECT_EXECUTION_FAILED);
|
|
993
962
|
if (console.error(r), this._onError) try {
|
|
994
963
|
this._onError(r);
|
|
995
964
|
} catch {}
|
|
996
|
-
n = new
|
|
965
|
+
n = new ce(e, e.version, void 0);
|
|
997
966
|
}
|
|
998
967
|
this._deps.insertNew(t, n);
|
|
999
968
|
}
|
|
1000
969
|
execute(e = !1) {
|
|
1001
970
|
let t = this.flags;
|
|
1002
|
-
if ((t & (
|
|
1003
|
-
let
|
|
1004
|
-
if (!e &&
|
|
1005
|
-
this._checkInfiniteLoops(), this.flags = t |
|
|
971
|
+
if ((t & (r.DISPOSED | r.EXECUTING)) !== 0) return;
|
|
972
|
+
let n = this._deps;
|
|
973
|
+
if (!e && n.size > 0 && !this._isDirty()) return;
|
|
974
|
+
this._checkInfiniteLoops(), T.trackUpdate(this.id, T.getDebugName(this)), this.flags = t | r.EXECUTING, this._execCleanup(), this._currentEpoch = fe(), this._trackCount = 0, n.prepareTracking(), this._hotIndex = -1;
|
|
1006
975
|
let i = !1;
|
|
1007
976
|
try {
|
|
1008
977
|
let e = O.run(this, this._fn);
|
|
1009
|
-
|
|
978
|
+
n.truncateFrom(this._trackCount), i = !0, se(e) ? this._handleAsyncResult(e) : this._cleanup = typeof e == "function" ? e : null;
|
|
1010
979
|
} catch (e) {
|
|
1011
980
|
if (!i) try {
|
|
1012
|
-
|
|
1013
|
-
} catch {
|
|
981
|
+
n.truncateFrom(this._trackCount);
|
|
982
|
+
} catch (e) {
|
|
983
|
+
f && console.warn("[atom-effect] _commitDeps failed during error recovery:", e);
|
|
984
|
+
}
|
|
1014
985
|
this._handleExecutionError(e), this._cleanup = null;
|
|
1015
986
|
} finally {
|
|
1016
|
-
this.flags &= ~
|
|
987
|
+
this.flags &= ~r.EXECUTING;
|
|
1017
988
|
}
|
|
1018
989
|
}
|
|
1019
|
-
_isDirty() {
|
|
1020
|
-
let e = this._deps;
|
|
1021
|
-
return e.hasComputeds ? this._deepDirtyCheck() : e.isDirtyFast();
|
|
1022
|
-
}
|
|
1023
990
|
_handleAsyncResult(e) {
|
|
1024
991
|
let t = ++this._execId;
|
|
1025
992
|
e.then((e) => {
|
|
@@ -1054,7 +1021,9 @@ var Te = class extends ee {
|
|
|
1054
1021
|
_tryPullComputed(e) {
|
|
1055
1022
|
try {
|
|
1056
1023
|
e.value;
|
|
1057
|
-
} catch {
|
|
1024
|
+
} catch {
|
|
1025
|
+
f && console.warn(`[atom-effect] Dependency #${e.id} threw during dirty check`);
|
|
1026
|
+
}
|
|
1058
1027
|
}
|
|
1059
1028
|
_execCleanup() {
|
|
1060
1029
|
let e = this._cleanup;
|
|
@@ -1068,13 +1037,13 @@ var Te = class extends ee {
|
|
|
1068
1037
|
}
|
|
1069
1038
|
}
|
|
1070
1039
|
_checkInfiniteLoops() {
|
|
1071
|
-
let e =
|
|
1072
|
-
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"),
|
|
1040
|
+
let e = _e();
|
|
1041
|
+
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), be() > o.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, f && this._checkFrequencyLimit();
|
|
1073
1042
|
}
|
|
1074
1043
|
_checkFrequencyLimit() {
|
|
1075
1044
|
if (!Number.isFinite(this._maxExecutions)) return;
|
|
1076
1045
|
let e = Date.now();
|
|
1077
|
-
if (e - this._windowStart >=
|
|
1046
|
+
if (e - this._windowStart >= c.EFFECT_FREQUENCY_WINDOW) {
|
|
1078
1047
|
this._windowStart = e, this._windowCount = 1;
|
|
1079
1048
|
return;
|
|
1080
1049
|
}
|
|
@@ -1087,30 +1056,29 @@ var Te = class extends ee {
|
|
|
1087
1056
|
return this._executionCount;
|
|
1088
1057
|
}
|
|
1089
1058
|
get isExecuting() {
|
|
1090
|
-
return (this.flags &
|
|
1059
|
+
return (this.flags & r.EXECUTING) !== 0;
|
|
1091
1060
|
}
|
|
1092
1061
|
_throwInfiniteLoopError(e) {
|
|
1093
|
-
let t = new g(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
1062
|
+
let t = new g(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${me}`);
|
|
1094
1063
|
throw this.dispose(), console.error(t), t;
|
|
1095
1064
|
}
|
|
1096
1065
|
_handleExecutionError(e, t = v.EFFECT_EXECUTION_FAILED) {
|
|
1097
|
-
let n =
|
|
1066
|
+
let n = y(e, g, t);
|
|
1098
1067
|
if (console.error(n), this._onError) try {
|
|
1099
1068
|
this._onError(n);
|
|
1100
1069
|
} catch (e) {
|
|
1101
|
-
console.error(
|
|
1070
|
+
console.error(y(e, g, v.CALLBACK_ERROR_IN_ERROR_HANDLER));
|
|
1102
1071
|
}
|
|
1103
1072
|
}
|
|
1104
1073
|
};
|
|
1105
1074
|
function R(e, t = {}) {
|
|
1106
1075
|
if (typeof e != "function") throw new g(v.EFFECT_MUST_BE_FUNCTION);
|
|
1107
|
-
let n = new
|
|
1076
|
+
let n = new ke(e, t);
|
|
1108
1077
|
return n.execute(), n;
|
|
1109
1078
|
}
|
|
1110
|
-
|
|
1111
|
-
function Oe(e, t, n, r) {
|
|
1079
|
+
function Ae(e, t, n, r) {
|
|
1112
1080
|
if (n === t.length) return r;
|
|
1113
|
-
let i = t[n], a = typeof e == "object" && e ? e : {}, o = a[i], s =
|
|
1081
|
+
let i = t[n], a = typeof e == "object" && e ? e : {}, o = a[i], s = Ae(o, t, n + 1, r);
|
|
1114
1082
|
if (Object.is(o, s)) return e;
|
|
1115
1083
|
if (Array.isArray(a)) {
|
|
1116
1084
|
let e = a.slice(), t = Number.parseInt(i, 10);
|
|
@@ -1129,7 +1097,7 @@ function z(e, t) {
|
|
|
1129
1097
|
}
|
|
1130
1098
|
return n;
|
|
1131
1099
|
}
|
|
1132
|
-
function
|
|
1100
|
+
function je(e, t) {
|
|
1133
1101
|
let n = t.includes(".") ? t.split(".") : [t], r = /* @__PURE__ */ new Set(), i = () => {
|
|
1134
1102
|
r.forEach((e) => e()), r.clear();
|
|
1135
1103
|
};
|
|
@@ -1138,7 +1106,7 @@ function ke(e, t) {
|
|
|
1138
1106
|
return z(e.value, n);
|
|
1139
1107
|
},
|
|
1140
1108
|
set value(t) {
|
|
1141
|
-
let r = e.peek(), i =
|
|
1109
|
+
let r = e.peek(), i = Ae(r, n, 0, t);
|
|
1142
1110
|
i !== r && (e.value = i);
|
|
1143
1111
|
},
|
|
1144
1112
|
peek: () => z(e.peek(), n),
|
|
@@ -1154,74 +1122,57 @@ function ke(e, t) {
|
|
|
1154
1122
|
subscriberCount: () => r.size,
|
|
1155
1123
|
dispose: i,
|
|
1156
1124
|
[Symbol.dispose]: i,
|
|
1157
|
-
[
|
|
1158
|
-
[De]: !0
|
|
1125
|
+
[E]: D.Atom | D.Writable
|
|
1159
1126
|
};
|
|
1160
1127
|
}
|
|
1161
|
-
var
|
|
1162
|
-
function
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
//#endregion
|
|
1173
|
-
//#region src/utils/index.ts
|
|
1174
|
-
var B = (e) => _e(e), Ne = (e) => typeof e == "object" && !!e && typeof e.then == "function";
|
|
1175
|
-
function Pe(e) {
|
|
1176
|
-
let t = e.localName, n = e.id;
|
|
1177
|
-
if (n) return `${t}#${n}`;
|
|
1178
|
-
let r = e.className;
|
|
1179
|
-
if (typeof r == "string") {
|
|
1180
|
-
let e = r.trim();
|
|
1181
|
-
if (e) return `${t}.${e.replace(/\s+/g, ".")}`;
|
|
1182
|
-
}
|
|
1183
|
-
return t;
|
|
1128
|
+
var Me = (e, t) => je(e, t), Ne = (e) => (t) => je(e, t), Pe = (e) => typeof e == "object" && !!e, Fe = (e) => ae(e), Ie = (e) => (Pe(e) || typeof e == "function") && typeof e.then == "function";
|
|
1129
|
+
function Le(e) {
|
|
1130
|
+
let { localName: t, id: n, className: r } = e, i = t;
|
|
1131
|
+
n && (i += `#${n}`);
|
|
1132
|
+
let a = typeof r == "string" ? r : r.baseVal;
|
|
1133
|
+
if (typeof a == "string") {
|
|
1134
|
+
let e = a.trim();
|
|
1135
|
+
e && (i += `.${e.replace(/\s+/g, ".")}`);
|
|
1136
|
+
}
|
|
1137
|
+
let o = e.type;
|
|
1138
|
+
return o && typeof o == "string" && o !== "text" && (i += `.${o}`), i;
|
|
1184
1139
|
}
|
|
1185
|
-
var
|
|
1186
|
-
function
|
|
1140
|
+
var B = Object.prototype.hasOwnProperty;
|
|
1141
|
+
function Re(e, t) {
|
|
1187
1142
|
if (e === t) return !0;
|
|
1188
|
-
if (
|
|
1189
|
-
let n = e, r = t, i =
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
let a = 0;
|
|
1195
|
-
for (let e in r) V.call(r, e) && a++;
|
|
1196
|
-
return i === a;
|
|
1143
|
+
if (!Pe(e) || !Pe(t)) return !1;
|
|
1144
|
+
let n = e, r = t, i = Object.keys(n), a = Object.keys(r);
|
|
1145
|
+
if (i.length !== a.length) return !1;
|
|
1146
|
+
for (let e of i) if (!B.call(r, e) || !Object.is(n[e], r[e])) return !1;
|
|
1147
|
+
return !0;
|
|
1197
1148
|
}
|
|
1198
1149
|
//#endregion
|
|
1199
1150
|
//#region src/constants.ts
|
|
1200
|
-
var
|
|
1151
|
+
var V = {
|
|
1201
1152
|
ROUTE: "[atom-route]",
|
|
1202
1153
|
BINDING: "[atom-binding]",
|
|
1203
1154
|
LIST: "[atom-list]",
|
|
1204
1155
|
MOUNT: "[atom-mount]"
|
|
1205
|
-
},
|
|
1156
|
+
}, ze = Object.freeze({
|
|
1206
1157
|
mode: "hash",
|
|
1207
1158
|
basePath: "",
|
|
1208
1159
|
autoBindLinks: !1,
|
|
1209
1160
|
activeClass: "active"
|
|
1210
|
-
}),
|
|
1161
|
+
}), Be = Object.freeze({
|
|
1211
1162
|
EVENT: "input",
|
|
1212
1163
|
DEBOUNCE: 0
|
|
1213
|
-
},
|
|
1164
|
+
}), Ve = Object.freeze({ HIGHLIGHT_DURATION_MS: 500 }), He = new Set([
|
|
1214
1165
|
"input",
|
|
1215
1166
|
"select",
|
|
1216
1167
|
"textarea"
|
|
1217
|
-
]),
|
|
1168
|
+
]), Ue = new Set([
|
|
1218
1169
|
"innerHTML",
|
|
1219
1170
|
"outerHTML",
|
|
1220
1171
|
"srcdoc",
|
|
1221
1172
|
"__proto__",
|
|
1222
1173
|
"constructor",
|
|
1223
1174
|
"prototype"
|
|
1224
|
-
]),
|
|
1175
|
+
]), We = "(?: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)", H = {
|
|
1225
1176
|
ROUTE: {
|
|
1226
1177
|
NOT_FOUND: (e) => `Route "${e}" not found and no notFound route configured`,
|
|
1227
1178
|
TEMPLATE_NOT_FOUND: (e) => `Template "${e}" not found`,
|
|
@@ -1249,24 +1200,44 @@ var H = {
|
|
|
1249
1200
|
CLEANUP_ERROR: (e) => `Cleanup error${e ? ` in component <${e}>` : ""}`
|
|
1250
1201
|
},
|
|
1251
1202
|
CORE: { EFFECT_DISPOSE_ERROR: (e) => `Effect dispose error${e ? `: ${e}` : ""}` }
|
|
1252
|
-
},
|
|
1253
|
-
|
|
1203
|
+
}, Ge = "atom-debug-highlight", U = "data-atom-debug", Ke = typeof window < "u", qe = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap(), Ye = !1, Xe = () => `${Ve.HIGHLIGHT_DURATION_MS / 1e3}s`, Ze = () => `
|
|
1204
|
+
[${U}] {
|
|
1205
|
+
transition: outline ${Xe()} ease-out;
|
|
1206
|
+
}
|
|
1207
|
+
.${Ge} {
|
|
1208
|
+
outline: 2px solid rgba(255, 68, 68, 0.8);
|
|
1209
|
+
outline-offset: 1px;
|
|
1210
|
+
}
|
|
1211
|
+
`.replace(/\s+/g, " ");
|
|
1212
|
+
function Qe() {
|
|
1213
|
+
if (Ye || !Ke) return;
|
|
1214
|
+
if (document.querySelector(`style[${U}]`)) {
|
|
1215
|
+
Ye = !0;
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
let e = document.createElement("style");
|
|
1219
|
+
e.setAttribute(U, ""), e.textContent = Ze(), document.head.appendChild(e), Ye = !0;
|
|
1220
|
+
}
|
|
1221
|
+
function $e() {
|
|
1254
1222
|
let e = globalThis;
|
|
1255
|
-
if (
|
|
1223
|
+
if (e.__ATOM_DEBUG__ !== void 0) return !!e.__ATOM_DEBUG__;
|
|
1256
1224
|
try {
|
|
1257
|
-
if (
|
|
1225
|
+
if (typeof sessionStorage < "u" && sessionStorage.getItem("__ATOM_DEBUG__") === "true") return !0;
|
|
1258
1226
|
} catch {}
|
|
1259
|
-
return !1;
|
|
1227
|
+
return e.process?.env?.NODE_ENV !== "production" && e.process?.env?.NODE_ENV !== void 0 ? !0 : e.__DEV__ === void 0 ? !1 : !!e.__DEV__;
|
|
1260
1228
|
}
|
|
1261
|
-
var
|
|
1229
|
+
var et = class {
|
|
1262
1230
|
constructor() {
|
|
1263
|
-
this.
|
|
1231
|
+
this.enabled = !0;
|
|
1264
1232
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1233
|
+
log(e, ...t) {
|
|
1234
|
+
this.enabled && console.log(e, ...t);
|
|
1267
1235
|
}
|
|
1268
|
-
|
|
1269
|
-
this.
|
|
1236
|
+
atomChanged(e, t, n, r) {
|
|
1237
|
+
this.enabled && console.log(`${e} Atom "${t ?? "anonymous"}" changed:`, n, "→", r);
|
|
1238
|
+
}
|
|
1239
|
+
cleanup(e, t) {
|
|
1240
|
+
this.enabled && console.log(`${e} Cleanup: ${t}`);
|
|
1270
1241
|
}
|
|
1271
1242
|
warn(e, t, ...n) {
|
|
1272
1243
|
console.warn(`${e} ${t}`, ...n);
|
|
@@ -1274,64 +1245,62 @@ var G = new class {
|
|
|
1274
1245
|
error(e, t, n) {
|
|
1275
1246
|
console.error(`${e} ${t}`, n);
|
|
1276
1247
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
if (!
|
|
1285
|
-
|
|
1286
|
-
let
|
|
1287
|
-
|
|
1288
|
-
Je.delete(e), e.isConnected && (e.classList.add(
|
|
1289
|
-
e.
|
|
1290
|
-
},
|
|
1248
|
+
domUpdated(e, t, n, r) {
|
|
1249
|
+
if (!this.enabled) return;
|
|
1250
|
+
let i = "jquery" in t ? t[0] : t;
|
|
1251
|
+
i && i.nodeType === 1 && i.isConnected && (console.log(`${e} DOM updated: ${Le(i)}.${n} =`, r), this._triggerVisualHighlight(i));
|
|
1252
|
+
}
|
|
1253
|
+
_triggerVisualHighlight(e) {
|
|
1254
|
+
let t = globalThis, n = t.requestAnimationFrame, r = t.cancelAnimationFrame;
|
|
1255
|
+
if (!Ke || typeof n != "function") return;
|
|
1256
|
+
Qe();
|
|
1257
|
+
let i = Je.get(e), a = qe.get(e);
|
|
1258
|
+
i !== void 0 && typeof r == "function" && r(i), a !== void 0 && (clearTimeout(a), qe.delete(e)), e.hasAttribute(U) || e.setAttribute(U, ""), Je.set(e, n(() => {
|
|
1259
|
+
Je.delete(e), e.isConnected && (e.classList.add(Ge), qe.set(e, setTimeout(() => {
|
|
1260
|
+
e.classList.remove(Ge), qe.delete(e);
|
|
1261
|
+
}, Ve.HIGHLIGHT_DURATION_MS)));
|
|
1291
1262
|
}));
|
|
1292
1263
|
}
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
}
|
|
1303
|
-
var qe = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new WeakMap();
|
|
1264
|
+
}, W = $e() ? new et() : {
|
|
1265
|
+
enabled: !1,
|
|
1266
|
+
log: () => {},
|
|
1267
|
+
atomChanged: () => {},
|
|
1268
|
+
domUpdated: () => {},
|
|
1269
|
+
cleanup: () => {},
|
|
1270
|
+
warn: (e, t, ...n) => console.warn(`${e} ${t}`, ...n),
|
|
1271
|
+
error: (e, t, n) => console.error(`${e} ${t}`, n)
|
|
1272
|
+
};
|
|
1304
1273
|
//#endregion
|
|
1305
1274
|
//#region src/core/namespace.ts
|
|
1306
|
-
function
|
|
1307
|
-
return
|
|
1275
|
+
function tt(e, t) {
|
|
1276
|
+
return Ce(e, t);
|
|
1308
1277
|
}
|
|
1309
|
-
Object.defineProperty(
|
|
1278
|
+
Object.defineProperty(tt, "debug", {
|
|
1310
1279
|
enumerable: !0,
|
|
1311
1280
|
configurable: !0,
|
|
1312
|
-
get: () =>
|
|
1281
|
+
get: () => W.enabled,
|
|
1313
1282
|
set: (e) => {
|
|
1314
|
-
|
|
1283
|
+
W.enabled = e;
|
|
1315
1284
|
}
|
|
1316
1285
|
});
|
|
1317
|
-
var
|
|
1286
|
+
var nt = () => Promise.resolve();
|
|
1318
1287
|
e.extend({
|
|
1319
|
-
atom:
|
|
1320
|
-
computed:
|
|
1288
|
+
atom: tt,
|
|
1289
|
+
computed: Oe,
|
|
1321
1290
|
effect: R,
|
|
1322
|
-
batch:
|
|
1291
|
+
batch: xe,
|
|
1323
1292
|
untracked: k,
|
|
1324
|
-
isAtom:
|
|
1325
|
-
isComputed:
|
|
1326
|
-
isReactive:
|
|
1327
|
-
nextTick:
|
|
1328
|
-
atomLens:
|
|
1329
|
-
composeLens:
|
|
1330
|
-
lensFor:
|
|
1293
|
+
isAtom: ae,
|
|
1294
|
+
isComputed: oe,
|
|
1295
|
+
isReactive: Fe,
|
|
1296
|
+
nextTick: nt,
|
|
1297
|
+
atomLens: je,
|
|
1298
|
+
composeLens: Me,
|
|
1299
|
+
lensFor: Ne
|
|
1331
1300
|
});
|
|
1332
1301
|
//#endregion
|
|
1333
|
-
//#region src/utils/
|
|
1334
|
-
var
|
|
1302
|
+
//#region src/utils/pool.ts
|
|
1303
|
+
var rt = class {
|
|
1335
1304
|
constructor(e = 50, t = 256) {
|
|
1336
1305
|
this.limit = e, this.capacity = t, this.pool = [];
|
|
1337
1306
|
}
|
|
@@ -1339,12 +1308,14 @@ var Ze = class {
|
|
|
1339
1308
|
return this.pool.pop() ?? [];
|
|
1340
1309
|
}
|
|
1341
1310
|
release(e) {
|
|
1342
|
-
|
|
1311
|
+
if (Object.isFrozen(e)) return;
|
|
1312
|
+
let t = e.length;
|
|
1313
|
+
e.length = 0, this.pool.length < this.limit && t <= this.capacity && this.pool.indexOf(e) === -1 && this.pool.push(e);
|
|
1343
1314
|
}
|
|
1344
1315
|
reset() {
|
|
1345
1316
|
this.pool.length = 0;
|
|
1346
1317
|
}
|
|
1347
|
-
},
|
|
1318
|
+
}, it = class {
|
|
1348
1319
|
constructor(e, t, n = 64) {
|
|
1349
1320
|
this.factory = e, this.reset = t, this.limit = n, this.pool = [];
|
|
1350
1321
|
}
|
|
@@ -1352,7 +1323,7 @@ var Ze = class {
|
|
|
1352
1323
|
return this.pool.pop() ?? this.factory();
|
|
1353
1324
|
}
|
|
1354
1325
|
release(e) {
|
|
1355
|
-
this.pool.length < this.limit &&
|
|
1326
|
+
Object.isFrozen(e) || (this.reset(e), this.pool.length < this.limit && this.pool.indexOf(e) === -1 && this.pool.push(e));
|
|
1356
1327
|
}
|
|
1357
1328
|
drain() {
|
|
1358
1329
|
this.pool.length > 0 && (this.pool.length = 0);
|
|
@@ -1360,17 +1331,36 @@ var Ze = class {
|
|
|
1360
1331
|
get size() {
|
|
1361
1332
|
return this.pool.length;
|
|
1362
1333
|
}
|
|
1363
|
-
},
|
|
1334
|
+
}, at = 128, ot = new rt(at), st = new rt(at), ct = new it(() => ({
|
|
1364
1335
|
effects: void 0,
|
|
1365
1336
|
cleanups: void 0,
|
|
1366
1337
|
componentCleanup: void 0
|
|
1367
1338
|
}), (e) => {
|
|
1368
|
-
e.effects
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1339
|
+
if (e.effects) {
|
|
1340
|
+
let t = e.effects.length;
|
|
1341
|
+
for (let n = 0; n < t; n++) try {
|
|
1342
|
+
e.effects[n].dispose();
|
|
1343
|
+
} catch {}
|
|
1344
|
+
ot.release(e.effects), e.effects = void 0;
|
|
1345
|
+
}
|
|
1346
|
+
if (e.cleanups) {
|
|
1347
|
+
let t = e.cleanups.length;
|
|
1348
|
+
for (let n = 0; n < t; n++) try {
|
|
1349
|
+
e.cleanups[n]();
|
|
1350
|
+
} catch {}
|
|
1351
|
+
st.release(e.cleanups), e.cleanups = void 0;
|
|
1352
|
+
}
|
|
1353
|
+
if (e.componentCleanup) {
|
|
1354
|
+
try {
|
|
1355
|
+
e.componentCleanup();
|
|
1356
|
+
} catch {}
|
|
1357
|
+
e.componentCleanup = void 0;
|
|
1358
|
+
}
|
|
1359
|
+
}, at), lt = !1;
|
|
1360
|
+
function ut() {
|
|
1361
|
+
lt || typeof document < "u" && document.body && (lt = !0, dt(document.body));
|
|
1372
1362
|
}
|
|
1373
|
-
var
|
|
1363
|
+
var G = "_aes-bound", K = new class {
|
|
1374
1364
|
constructor() {
|
|
1375
1365
|
this.records = /* @__PURE__ */ new WeakMap(), this.preservedNodes = /* @__PURE__ */ new WeakSet(), this.ignoredNodes = /* @__PURE__ */ new WeakSet();
|
|
1376
1366
|
}
|
|
@@ -1387,17 +1377,17 @@ var K = "_aes-bound", q = new class {
|
|
|
1387
1377
|
return this.ignoredNodes.has(e);
|
|
1388
1378
|
}
|
|
1389
1379
|
getOrCreateRecord(e) {
|
|
1390
|
-
|
|
1380
|
+
ut();
|
|
1391
1381
|
let t = this.records.get(e);
|
|
1392
|
-
return t || (t =
|
|
1382
|
+
return t || (t = ct.acquire(), this.records.set(e, t), e.classList.add(G)), t;
|
|
1393
1383
|
}
|
|
1394
1384
|
trackEffect(e, t) {
|
|
1395
1385
|
let n = this.getOrCreateRecord(e);
|
|
1396
|
-
n.effects ||=
|
|
1386
|
+
n.effects ||= ot.acquire(), n.effects.push(t);
|
|
1397
1387
|
}
|
|
1398
1388
|
trackCleanup(e, t) {
|
|
1399
1389
|
let n = this.getOrCreateRecord(e);
|
|
1400
|
-
n.cleanups ||=
|
|
1390
|
+
n.cleanups ||= st.acquire(), n.cleanups.push(t);
|
|
1401
1391
|
}
|
|
1402
1392
|
setComponentCleanup(e, t) {
|
|
1403
1393
|
this.getOrCreateRecord(e).componentCleanup = t;
|
|
@@ -1406,54 +1396,58 @@ var K = "_aes-bound", q = new class {
|
|
|
1406
1396
|
return this.records.has(e);
|
|
1407
1397
|
}
|
|
1408
1398
|
cleanup(e) {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1399
|
+
if (this.preservedNodes.delete(e), this.ignoredNodes.delete(e), e.nodeType !== 1) return;
|
|
1400
|
+
let t = e, n = this.records.get(t);
|
|
1401
|
+
if (!n) {
|
|
1402
|
+
t.classList.remove(G);
|
|
1412
1403
|
return;
|
|
1413
1404
|
}
|
|
1414
|
-
this.records.delete(
|
|
1415
|
-
let r = t
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1405
|
+
this.records.delete(t), t.classList.remove(G);
|
|
1406
|
+
let r = Le(t);
|
|
1407
|
+
if (W.cleanup(V.BINDING, r), n.componentCleanup) {
|
|
1408
|
+
try {
|
|
1409
|
+
n.componentCleanup();
|
|
1410
|
+
} catch (e) {
|
|
1411
|
+
W.error(V.MOUNT, H.MOUNT.CLEANUP_ERROR(r), e);
|
|
1412
|
+
}
|
|
1413
|
+
n.componentCleanup = void 0;
|
|
1420
1414
|
}
|
|
1421
1415
|
if (n.effects) {
|
|
1422
1416
|
for (let e of n.effects) try {
|
|
1423
1417
|
e.dispose();
|
|
1424
1418
|
} catch (e) {
|
|
1425
|
-
|
|
1419
|
+
W.error(V.BINDING, H.CORE.EFFECT_DISPOSE_ERROR(r), e);
|
|
1426
1420
|
}
|
|
1427
|
-
|
|
1421
|
+
ot.release(n.effects), n.effects = void 0;
|
|
1428
1422
|
}
|
|
1429
1423
|
if (n.cleanups) {
|
|
1430
1424
|
for (let e of n.cleanups) try {
|
|
1431
1425
|
e();
|
|
1432
1426
|
} catch (e) {
|
|
1433
|
-
|
|
1427
|
+
W.error(V.BINDING, H.BINDING.CLEANUP_ERROR(r), e);
|
|
1434
1428
|
}
|
|
1435
|
-
|
|
1429
|
+
st.release(n.cleanups), n.cleanups = void 0;
|
|
1436
1430
|
}
|
|
1437
|
-
|
|
1431
|
+
ct.release(n);
|
|
1438
1432
|
}
|
|
1439
1433
|
cleanupDescendants(e) {
|
|
1440
|
-
let t =
|
|
1434
|
+
let t = "getElementsByClassName" in e ? e.getElementsByClassName(G) : e.querySelectorAll(`.${G}`), n = t.length;
|
|
1441
1435
|
if (n === 0) return;
|
|
1442
1436
|
let r = Array(n);
|
|
1443
1437
|
for (let e = 0; e < n; e++) r[e] = t[e];
|
|
1444
1438
|
for (let e = n - 1; e >= 0; e--) {
|
|
1445
1439
|
let t = r[e];
|
|
1446
|
-
this.records.has(t) ? this.cleanup(t) : t.classList.remove(
|
|
1440
|
+
this.records.has(t) ? this.cleanup(t) : t.classList.remove(G);
|
|
1447
1441
|
}
|
|
1448
1442
|
}
|
|
1449
1443
|
cleanupTree(e) {
|
|
1450
1444
|
(e.nodeType === 1 || e.nodeType === 11) && this.cleanupDescendants(e), this.cleanup(e);
|
|
1451
1445
|
}
|
|
1452
|
-
}(),
|
|
1453
|
-
function
|
|
1454
|
-
if (
|
|
1446
|
+
}(), q = /* @__PURE__ */ new Map();
|
|
1447
|
+
function dt(e) {
|
|
1448
|
+
if (q.has(e)) return;
|
|
1455
1449
|
let t = new MutationObserver((e) => {
|
|
1456
|
-
let t =
|
|
1450
|
+
let t = K;
|
|
1457
1451
|
for (let n = 0, r = e.length; n < r; n++) {
|
|
1458
1452
|
let r = e[n].removedNodes;
|
|
1459
1453
|
for (let e = 0, n = r.length; e < n; e++) {
|
|
@@ -1467,195 +1461,247 @@ function at(e) {
|
|
|
1467
1461
|
t.observe(e, {
|
|
1468
1462
|
childList: !0,
|
|
1469
1463
|
subtree: !0
|
|
1470
|
-
}),
|
|
1464
|
+
}), q.set(e, t);
|
|
1471
1465
|
}
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1466
|
+
function ft() {
|
|
1467
|
+
q.forEach((e) => e.disconnect()), q.clear();
|
|
1468
|
+
}
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/core/dom.ts
|
|
1471
|
+
function pt(e) {
|
|
1472
|
+
return {
|
|
1473
|
+
el: e,
|
|
1474
|
+
trackCleanup: (t) => K.trackCleanup(e, t)
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function J(e, t, n = {}) {
|
|
1478
|
+
for (let r = 0, i = e.length; r < i; r++) {
|
|
1479
|
+
let i = e[r];
|
|
1480
|
+
if (i?.nodeType === 1) {
|
|
1481
|
+
let e = i;
|
|
1482
|
+
t(n.needsCtx ? pt(e) : null, e);
|
|
1483
|
+
} else i && W.log(V.BINDING, `Skipping non-Element node (nodeType=${i.nodeType})`);
|
|
1484
|
+
}
|
|
1485
|
+
return e;
|
|
1486
|
+
}
|
|
1487
|
+
function mt(e) {
|
|
1488
|
+
return Array.isArray(e) && e.length === 2 && (typeof e[0] == "function" || e[0] !== null && typeof e[0] == "object" && ("value" in e[0] || "then" in e[0])) ? e : [e];
|
|
1474
1489
|
}
|
|
1475
1490
|
//#endregion
|
|
1476
1491
|
//#region src/core/jquery-patch.ts
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1492
|
+
var Y = Symbol.for("atom-effect-internal"), ht = Symbol.for("atom-effect-wrapped"), gt = /* @__PURE__ */ new WeakMap(), X = null, _t = (e) => {
|
|
1493
|
+
let t = e;
|
|
1494
|
+
if (t[Y]) return e;
|
|
1495
|
+
let n = t[ht];
|
|
1496
|
+
if (n) return n;
|
|
1497
|
+
if (n = gt.get(e), !n) {
|
|
1498
|
+
n = function(...t) {
|
|
1499
|
+
return xe(() => e.apply(this, t));
|
|
1500
|
+
}, n[Y] = !0, gt.set(e, n);
|
|
1501
|
+
try {
|
|
1502
|
+
t[ht] = n;
|
|
1503
|
+
} catch {}
|
|
1504
|
+
}
|
|
1505
|
+
return n;
|
|
1506
|
+
}, vt = (e) => e[ht] ?? gt.get(e) ?? e;
|
|
1507
|
+
function yt(e) {
|
|
1485
1508
|
let t = {};
|
|
1486
|
-
for (let n in e)
|
|
1509
|
+
for (let n in e) {
|
|
1510
|
+
let r = e[n];
|
|
1511
|
+
typeof r == "function" ? t[n] = _t(r) : r !== void 0 && (t[n] = r);
|
|
1512
|
+
}
|
|
1487
1513
|
return t;
|
|
1488
1514
|
}
|
|
1489
|
-
function
|
|
1515
|
+
function bt(e) {
|
|
1490
1516
|
let t = {};
|
|
1491
1517
|
for (let n in e) {
|
|
1492
1518
|
let r = e[n];
|
|
1493
|
-
t[n] =
|
|
1519
|
+
typeof r == "function" ? t[n] = vt(r) : t[n] = r;
|
|
1494
1520
|
}
|
|
1495
1521
|
return t;
|
|
1496
1522
|
}
|
|
1497
|
-
function
|
|
1498
|
-
|
|
1499
|
-
|
|
1523
|
+
function xt(e, t, n) {
|
|
1524
|
+
let r = e[0];
|
|
1525
|
+
if (r && typeof r == "object") e[0] = t(r);
|
|
1526
|
+
else for (let t = 1; t < e.length; t++) typeof e[t] == "function" && (e[t] = n(e[t]));
|
|
1527
|
+
}
|
|
1528
|
+
function St(e) {
|
|
1529
|
+
return function(...t) {
|
|
1530
|
+
return xt(t, yt, _t), e.apply(this, t) ?? this;
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
function Ct() {
|
|
1534
|
+
if (X !== null) return;
|
|
1535
|
+
X = {
|
|
1500
1536
|
on: e.fn.on,
|
|
1537
|
+
one: e.fn.one,
|
|
1501
1538
|
off: e.fn.off,
|
|
1502
1539
|
remove: e.fn.remove,
|
|
1503
1540
|
empty: e.fn.empty,
|
|
1504
1541
|
detach: e.fn.detach
|
|
1505
1542
|
};
|
|
1506
|
-
let t =
|
|
1543
|
+
let t = X;
|
|
1507
1544
|
e.fn.remove = function(e) {
|
|
1508
1545
|
let n = e ? this.filter(e) : this, r = n.length;
|
|
1509
1546
|
for (let e = 0; e < r; e++) {
|
|
1510
1547
|
let t = n[e];
|
|
1511
|
-
t && (
|
|
1548
|
+
t && (K.markIgnored(t), K.cleanupTree(t));
|
|
1512
1549
|
}
|
|
1513
1550
|
return t.remove.call(this, e) ?? this;
|
|
1514
1551
|
}, e.fn.empty = function() {
|
|
1515
1552
|
let e = this.length;
|
|
1516
1553
|
for (let t = 0; t < e; t++) {
|
|
1517
1554
|
let e = this[t];
|
|
1518
|
-
e?.hasChildNodes() &&
|
|
1555
|
+
e?.hasChildNodes() && K.cleanupDescendants(e);
|
|
1519
1556
|
}
|
|
1520
1557
|
return t.empty.call(this) ?? this;
|
|
1521
1558
|
}, e.fn.detach = function(e) {
|
|
1522
1559
|
let n = e ? this.filter(e) : this, r = n.length;
|
|
1523
1560
|
for (let e = 0; e < r; e++) {
|
|
1524
1561
|
let t = n[e];
|
|
1525
|
-
t &&
|
|
1562
|
+
t && K.keep(t);
|
|
1526
1563
|
}
|
|
1527
1564
|
return t.detach.call(this, e) ?? this;
|
|
1528
|
-
}, e.fn.on = function(...e) {
|
|
1529
|
-
|
|
1530
|
-
if (n && typeof n == "object") e[0] = ut(n);
|
|
1531
|
-
else {
|
|
1532
|
-
let t = e.length - 1;
|
|
1533
|
-
t >= 0 && typeof e[t] == "function" && (e[t] = lt(e[t]));
|
|
1534
|
-
}
|
|
1535
|
-
return t.on.apply(this, e) ?? this;
|
|
1536
|
-
}, e.fn.off = function(...e) {
|
|
1537
|
-
let n = e[0];
|
|
1538
|
-
if (n && typeof n == "object") e[0] = dt(n);
|
|
1539
|
-
else {
|
|
1540
|
-
let t = e.length - 1;
|
|
1541
|
-
if (t >= 0 && typeof e[t] == "function") {
|
|
1542
|
-
let n = e[t];
|
|
1543
|
-
e[t] = ct.get(n) ?? n;
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
return t.off.apply(this, e) ?? this;
|
|
1565
|
+
}, e.fn.on = St(t.on), e.fn.one = St(t.one), e.fn.off = function(...e) {
|
|
1566
|
+
return xt(e, bt, vt), t.off.apply(this, e) ?? this;
|
|
1547
1567
|
};
|
|
1548
1568
|
}
|
|
1549
|
-
function
|
|
1550
|
-
|
|
1569
|
+
function wt() {
|
|
1570
|
+
X !== null && (e.fn.on = X.on, e.fn.one = X.one, e.fn.off = X.off, e.fn.remove = X.remove, e.fn.empty = X.empty, e.fn.detach = X.detach, X = null);
|
|
1551
1571
|
}
|
|
1552
1572
|
//#endregion
|
|
1553
1573
|
//#region src/types.ts
|
|
1554
|
-
var
|
|
1574
|
+
var Z = /* @__PURE__ */ function(e) {
|
|
1555
1575
|
return e[e.None = 0] = "None", e[e.Focused = 1] = "Focused", e[e.Composing = 2] = "Composing", e[e.SyncingToAtom = 4] = "SyncingToAtom", e[e.SyncingToDom = 8] = "SyncingToDom", e[e.Busy = 14] = "Busy", e;
|
|
1556
|
-
}({}),
|
|
1557
|
-
function
|
|
1558
|
-
e[
|
|
1576
|
+
}({}), Tt = 0;
|
|
1577
|
+
function Et(e) {
|
|
1578
|
+
e[Y] = !0;
|
|
1559
1579
|
}
|
|
1560
|
-
var
|
|
1580
|
+
var Dt = class {
|
|
1561
1581
|
constructor(e, t, n) {
|
|
1562
1582
|
this.flags = 0, this.timeoutId = void 0, this.handleCompositionStart = () => {
|
|
1563
|
-
this.flags |=
|
|
1583
|
+
this.flags |= Z.Composing;
|
|
1564
1584
|
}, this.handleCompositionEnd = () => {
|
|
1565
|
-
this.flags &= ~
|
|
1585
|
+
this.flags &= ~Z.Composing, this.handleInput();
|
|
1566
1586
|
}, this.handleFocus = () => {
|
|
1567
|
-
this.flags |=
|
|
1587
|
+
this.flags |= Z.Focused;
|
|
1568
1588
|
}, this.handleBlur = () => {
|
|
1569
|
-
this.flags &= ~
|
|
1570
|
-
let e = !!(this.flags &
|
|
1571
|
-
this.flags &= ~
|
|
1589
|
+
this.flags &= ~Z.Focused;
|
|
1590
|
+
let e = !!(this.flags & Z.Composing);
|
|
1591
|
+
this.flags &= ~Z.Composing;
|
|
1592
|
+
let t = this.flushPendingDebounce();
|
|
1593
|
+
e && !t && this.syncAtomFromDom(), this.normalizeDomValue();
|
|
1572
1594
|
}, this.syncDomFromAtom = () => {
|
|
1573
1595
|
let e = this.atom.value;
|
|
1574
|
-
k(() => {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
} else if (n === t) return;
|
|
1579
|
-
if (this.flags & Y.Focused) try {
|
|
1580
|
-
if (this.equal(this.readDom(), e)) return;
|
|
1581
|
-
} catch {}
|
|
1582
|
-
this.flags |= Y.SyncingToDom;
|
|
1596
|
+
this.flags & Z.Busy || k(() => {
|
|
1597
|
+
if (this.isDomUpToDate(e)) return;
|
|
1598
|
+
let t = this.format(e);
|
|
1599
|
+
this.flags |= Z.SyncingToDom;
|
|
1583
1600
|
try {
|
|
1584
|
-
this.writeDom(e, t),
|
|
1601
|
+
this.writeDom(e, t), W.domUpdated(V.BINDING, this.$el, "val", t);
|
|
1585
1602
|
} finally {
|
|
1586
|
-
this.flags &= ~
|
|
1603
|
+
this.flags &= ~Z.SyncingToDom;
|
|
1587
1604
|
}
|
|
1588
1605
|
});
|
|
1589
1606
|
}, this.cleanup = () => {
|
|
1590
1607
|
this.$el.off(this.ns), clearTimeout(this.timeoutId), this.timeoutId = void 0;
|
|
1591
1608
|
}, this.$el = e, this.el = e[0], this.atom = t;
|
|
1592
|
-
let r = this.el.tagName
|
|
1593
|
-
this.isMultipleSelect =
|
|
1594
|
-
let a = n
|
|
1595
|
-
this.parse =
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
let e = this.el, n = e.selectionStart, r = e.selectionEnd;
|
|
1600
|
-
e.value = t;
|
|
1601
|
-
let i = t.length;
|
|
1602
|
-
n !== null && r !== null && e.setSelectionRange(n < i ? n : i, r < i ? r : i);
|
|
1603
|
-
} catch {
|
|
1604
|
-
this.el.value = t;
|
|
1605
|
-
}
|
|
1606
|
-
else this.el.value = t;
|
|
1607
|
-
} : this.writeDom = (e, t) => {
|
|
1608
|
-
this.el.value = t;
|
|
1609
|
-
});
|
|
1610
|
-
let o = n.equal ?? Object.is;
|
|
1611
|
-
i ? this.equal = (e, t) => {
|
|
1612
|
-
if (o(e, t)) return !0;
|
|
1613
|
-
if (Array.isArray(e) && Array.isArray(t)) {
|
|
1614
|
-
let n = e.length;
|
|
1615
|
-
if (n !== t.length) return !1;
|
|
1616
|
-
for (let r = 0; r < n; r++) if (!Object.is(e[r], t[r])) return !1;
|
|
1617
|
-
return !0;
|
|
1618
|
-
}
|
|
1619
|
-
return !1;
|
|
1620
|
-
} : this.equal = o, a > 0 ? this.handleInput = () => {
|
|
1621
|
-
this.flags & Y.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), a));
|
|
1609
|
+
let r = this.el.tagName;
|
|
1610
|
+
this.isMultipleSelect = r === "SELECT" && this.el.multiple, this.isTextControl = r === "INPUT" || r === "TEXTAREA", this.ns = `.atomBind-${++Tt}`;
|
|
1611
|
+
let { parse: i, format: a, equal: o, readDom: s, getRawDom: c, writeDom: l } = this.initStrategies(n);
|
|
1612
|
+
this.parse = i, this.format = a, this.equal = o, this.readDom = s, this.getRawDom = c, this.writeDom = l;
|
|
1613
|
+
let u = n.debounce ?? 0;
|
|
1614
|
+
u > 0 ? this.handleInput = () => {
|
|
1615
|
+
this.flags & Z.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), u));
|
|
1622
1616
|
} : this.handleInput = () => {
|
|
1623
|
-
this.flags &
|
|
1617
|
+
this.flags & Z.Composing || this.syncAtomFromDom();
|
|
1624
1618
|
}, [
|
|
1625
1619
|
this.handleFocus,
|
|
1626
1620
|
this.handleBlur,
|
|
1627
1621
|
this.handleCompositionStart,
|
|
1628
1622
|
this.handleCompositionEnd,
|
|
1629
1623
|
this.handleInput
|
|
1630
|
-
].forEach(
|
|
1624
|
+
].forEach(Et), this.bindEvents(n.event ?? Be.EVENT);
|
|
1625
|
+
}
|
|
1626
|
+
initStrategies(e) {
|
|
1627
|
+
let t = e.parse ?? ((e) => e), n = e.equal ?? Object.is;
|
|
1628
|
+
return this.isMultipleSelect ? {
|
|
1629
|
+
parse: t,
|
|
1630
|
+
format: e.format ?? ((e) => (Array.isArray(e) ? e : e ? [String(e)] : []).join(",")),
|
|
1631
|
+
getRawDom: () => this.$el.val() || [],
|
|
1632
|
+
readDom: () => this.$el.val() || [],
|
|
1633
|
+
writeDom: (e) => {
|
|
1634
|
+
this.$el.val(e);
|
|
1635
|
+
},
|
|
1636
|
+
equal: (e, t) => {
|
|
1637
|
+
if (n(e, t)) return !0;
|
|
1638
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
1639
|
+
let n = e.length;
|
|
1640
|
+
if (n !== t.length) return !1;
|
|
1641
|
+
for (let r = 0; r < n; r++) if (!Object.is(e[r], t[r])) return !1;
|
|
1642
|
+
return !0;
|
|
1643
|
+
}
|
|
1644
|
+
return !1;
|
|
1645
|
+
}
|
|
1646
|
+
} : {
|
|
1647
|
+
parse: t,
|
|
1648
|
+
format: e.format ?? ((e) => String(e ?? "")),
|
|
1649
|
+
equal: n,
|
|
1650
|
+
readDom: () => t(this.el.value),
|
|
1651
|
+
getRawDom: () => this.el.value,
|
|
1652
|
+
writeDom: this.isTextControl ? (e, t) => this.writeTextValue(t) : (e, t) => {
|
|
1653
|
+
this.el.value = t;
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
writeTextValue(e) {
|
|
1658
|
+
let t = this.el;
|
|
1659
|
+
if (this.flags & Z.Focused) try {
|
|
1660
|
+
let n = t.selectionStart, r = t.selectionEnd;
|
|
1661
|
+
t.value = e;
|
|
1662
|
+
let i = e.length;
|
|
1663
|
+
n !== null && r !== null && t.setSelectionRange(Math.min(n, i), Math.min(r, i));
|
|
1664
|
+
} catch {
|
|
1665
|
+
t.value = e;
|
|
1666
|
+
}
|
|
1667
|
+
else t.value = e;
|
|
1631
1668
|
}
|
|
1632
1669
|
flushPendingDebounce() {
|
|
1633
|
-
this.timeoutId
|
|
1670
|
+
return this.timeoutId === void 0 ? !1 : (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom(), !0);
|
|
1634
1671
|
}
|
|
1635
1672
|
normalizeDomValue() {
|
|
1636
1673
|
let e = this.atom.peek(), t = this.format(e), n = this.getRawDom();
|
|
1637
1674
|
this.isMultipleSelect ? this.equal(n, e) || this.writeDom(e, t) : n !== t && this.writeDom(e, t);
|
|
1638
1675
|
}
|
|
1639
1676
|
syncAtomFromDom() {
|
|
1640
|
-
if (!(this.flags &
|
|
1641
|
-
this.flags |=
|
|
1677
|
+
if (!(this.flags & Z.Busy)) {
|
|
1678
|
+
this.flags |= Z.SyncingToAtom;
|
|
1642
1679
|
try {
|
|
1643
1680
|
let e = this.readDom();
|
|
1644
1681
|
this.equal(this.atom.peek(), e) || (this.atom.value = e);
|
|
1645
1682
|
} catch (e) {
|
|
1646
|
-
|
|
1683
|
+
W.warn(V.BINDING, H.BINDING.PARSE_ERROR(e instanceof Error ? e.message : String(e)), e);
|
|
1647
1684
|
} finally {
|
|
1648
|
-
this.flags &= ~
|
|
1685
|
+
this.flags &= ~Z.SyncingToAtom;
|
|
1649
1686
|
}
|
|
1650
1687
|
}
|
|
1651
1688
|
}
|
|
1689
|
+
isDomUpToDate(e) {
|
|
1690
|
+
let t = this.getRawDom();
|
|
1691
|
+
if (this.isMultipleSelect) return this.equal(t, e);
|
|
1692
|
+
if (t === this.format(e)) return !0;
|
|
1693
|
+
if (this.flags & Z.Focused) try {
|
|
1694
|
+
return this.equal(this.readDom(), e);
|
|
1695
|
+
} catch {}
|
|
1696
|
+
return !1;
|
|
1697
|
+
}
|
|
1652
1698
|
bindEvents(e) {
|
|
1653
1699
|
let t = this.ns, n = e.trim().split(/\s+/).map((e) => `${e}${t}`).join(" ");
|
|
1654
1700
|
this.$el.on(`focus${t}`, this.handleFocus).on(`blur${t}`, this.handleBlur).on(`compositionstart${t}`, this.handleCompositionStart).on(`compositionend${t}`, this.handleCompositionEnd).on(n, this.handleInput);
|
|
1655
1701
|
}
|
|
1656
1702
|
};
|
|
1657
|
-
function
|
|
1658
|
-
let r = new
|
|
1703
|
+
function Ot(e, t, n) {
|
|
1704
|
+
let r = new Dt(e, t, n);
|
|
1659
1705
|
return {
|
|
1660
1706
|
fx: R(r.syncDomFromAtom),
|
|
1661
1707
|
cleanup: () => {
|
|
@@ -1665,88 +1711,114 @@ function _t(e, t, n) {
|
|
|
1665
1711
|
}
|
|
1666
1712
|
//#endregion
|
|
1667
1713
|
//#region src/core/effect-factory.ts
|
|
1668
|
-
function
|
|
1669
|
-
let i =
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1714
|
+
function kt(e, t, n, r) {
|
|
1715
|
+
let i = {
|
|
1716
|
+
latestId: 0,
|
|
1717
|
+
isDisposed: !1
|
|
1718
|
+
};
|
|
1719
|
+
K.trackCleanup(e, () => {
|
|
1720
|
+
i.isDisposed = !0;
|
|
1721
|
+
});
|
|
1722
|
+
let a = (t) => {
|
|
1723
|
+
if (!Ie(t)) {
|
|
1724
|
+
i.latestId++, k(() => {
|
|
1725
|
+
try {
|
|
1726
|
+
n(t), W.domUpdated(V.BINDING, e, r, t);
|
|
1727
|
+
} catch (e) {
|
|
1728
|
+
W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r, !0), e);
|
|
1729
|
+
}
|
|
1730
|
+
});
|
|
1677
1731
|
return;
|
|
1678
1732
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1733
|
+
let a = ++i.latestId;
|
|
1734
|
+
t.then((t) => {
|
|
1735
|
+
a === i.latestId && !i.isDisposed && k(() => {
|
|
1681
1736
|
try {
|
|
1682
|
-
n(
|
|
1737
|
+
n(t), W.domUpdated(V.BINDING, e, `${r} (async)`, t);
|
|
1683
1738
|
} catch (e) {
|
|
1684
|
-
|
|
1739
|
+
W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1685
1740
|
}
|
|
1686
1741
|
});
|
|
1687
1742
|
}).catch((e) => {
|
|
1688
|
-
|
|
1743
|
+
a === i.latestId && !i.isDisposed && W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1689
1744
|
});
|
|
1690
|
-
}, o =
|
|
1691
|
-
o || typeof t == "function" ?
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
}, { name: r })) : k(() => a(t));
|
|
1745
|
+
}, o = Fe(t);
|
|
1746
|
+
o || typeof t == "function" ? K.trackEffect(e, R(() => {
|
|
1747
|
+
a(o ? t.value : t());
|
|
1748
|
+
}, { name: r })) : a(t);
|
|
1695
1749
|
}
|
|
1696
|
-
function
|
|
1750
|
+
function At(e, t, n, r) {
|
|
1697
1751
|
let i = Object.keys(t), a = [], o = [], s = [], c = {};
|
|
1698
1752
|
for (let e = 0, n = i.length; e < n; e++) {
|
|
1699
|
-
let n = i[e], r = t[n], l =
|
|
1753
|
+
let n = i[e], r = t[n], l = Fe(r);
|
|
1700
1754
|
l || typeof r == "function" ? (a.push(n), o.push(r), s.push(l)) : c[n] = r;
|
|
1701
1755
|
}
|
|
1702
|
-
let l =
|
|
1756
|
+
let l = {
|
|
1757
|
+
latestId: 0,
|
|
1758
|
+
isDisposed: !1,
|
|
1759
|
+
cache: {}
|
|
1760
|
+
};
|
|
1761
|
+
K.trackCleanup(e, () => {
|
|
1762
|
+
l.isDisposed = !0;
|
|
1763
|
+
});
|
|
1764
|
+
let u = (t) => {
|
|
1703
1765
|
let a = [], o = {}, s = i.length;
|
|
1704
1766
|
for (let e = 0; e < s; e++) {
|
|
1705
1767
|
let n = i[e], r = t[n];
|
|
1706
|
-
|
|
1768
|
+
if (Ie(r) && B.call(l.cache, n)) {
|
|
1769
|
+
let e = l.cache[n];
|
|
1770
|
+
if (e.p === r) {
|
|
1771
|
+
o[n] = e.v;
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
Ie(r) ? a.push(r.then((e) => (l.cache[n] = {
|
|
1776
|
+
p: r,
|
|
1777
|
+
v: e
|
|
1778
|
+
}, {
|
|
1707
1779
|
key: n,
|
|
1708
1780
|
val: e
|
|
1709
1781
|
}))) : o[n] = r;
|
|
1710
1782
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
let t = ++l;
|
|
1783
|
+
if (a.length > 0) {
|
|
1784
|
+
let t = ++l.latestId;
|
|
1714
1785
|
Promise.all(a).then((i) => {
|
|
1715
|
-
if (t === l) {
|
|
1716
|
-
for (let e = 0; e <
|
|
1786
|
+
if (t === l.latestId && !l.isDisposed) {
|
|
1787
|
+
for (let e = 0, t = i.length; e < t; e++) {
|
|
1717
1788
|
let t = i[e];
|
|
1718
1789
|
o[t.key] = t.val;
|
|
1719
1790
|
}
|
|
1720
1791
|
k(() => {
|
|
1721
1792
|
try {
|
|
1722
|
-
n(o),
|
|
1793
|
+
n(o), W.domUpdated(V.BINDING, e, `${r} (async)`, o);
|
|
1723
1794
|
} catch (e) {
|
|
1724
|
-
|
|
1795
|
+
W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1725
1796
|
}
|
|
1726
1797
|
});
|
|
1727
1798
|
}
|
|
1799
|
+
}, (e) => {
|
|
1800
|
+
t === l.latestId && !l.isDisposed && W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1728
1801
|
});
|
|
1729
|
-
} else {
|
|
1730
|
-
l++;
|
|
1802
|
+
} else l.latestId++, k(() => {
|
|
1731
1803
|
try {
|
|
1732
|
-
n(o),
|
|
1804
|
+
n(o), W.domUpdated(V.BINDING, e, r, o);
|
|
1733
1805
|
} catch (e) {
|
|
1734
|
-
|
|
1806
|
+
W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r, !0), e);
|
|
1735
1807
|
}
|
|
1736
|
-
}
|
|
1808
|
+
});
|
|
1737
1809
|
};
|
|
1738
|
-
a.length > 0 ?
|
|
1810
|
+
a.length > 0 ? K.trackEffect(e, R(() => {
|
|
1739
1811
|
let e = { ...c };
|
|
1740
1812
|
for (let t = 0, n = a.length; t < n; t++) {
|
|
1741
1813
|
let n = o[t];
|
|
1742
1814
|
e[a[t]] = s[t] ? n.value : n();
|
|
1743
1815
|
}
|
|
1744
|
-
|
|
1745
|
-
}, { name: r })) :
|
|
1816
|
+
u(e);
|
|
1817
|
+
}, { name: r })) : u(c);
|
|
1746
1818
|
}
|
|
1747
1819
|
//#endregion
|
|
1748
1820
|
//#region src/utils/sanitize.ts
|
|
1749
|
-
var
|
|
1821
|
+
var jt = new Set([
|
|
1750
1822
|
"href",
|
|
1751
1823
|
"src",
|
|
1752
1824
|
"action",
|
|
@@ -1760,116 +1832,139 @@ var bt = new Set([
|
|
|
1760
1832
|
"profile",
|
|
1761
1833
|
"usemap",
|
|
1762
1834
|
"classid",
|
|
1763
|
-
"codebase"
|
|
1764
|
-
|
|
1835
|
+
"codebase",
|
|
1836
|
+
"fill",
|
|
1837
|
+
"filter",
|
|
1838
|
+
"mask",
|
|
1839
|
+
"marker-start",
|
|
1840
|
+
"marker-mid",
|
|
1841
|
+
"marker-end",
|
|
1842
|
+
"clip-path"
|
|
1843
|
+
]), Mt = {
|
|
1765
1844
|
colon: ":",
|
|
1766
1845
|
Tab: " ",
|
|
1767
1846
|
NewLine: "\n"
|
|
1768
|
-
},
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1847
|
+
}, Nt = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, Pt = /&(colon|Tab|NewLine);/g, Ft = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, It = /[<&\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/, Lt = /<\?[\s\S]*?\?>/g, Rt = /(<(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, zt = /\bon\w+\s*=/gim, Bt = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, Vt = RegExp(`${We}\\s*:`, "gi"), Ht = RegExp(`^\\s*${We}\\s*:`, "i"), Ut = `(?:expression\\s*\\(|behavior\\s*:|-moz-binding\\s*:|(?:\\\\[0-9a-f]{1,6}\\s*|[\\s\\x00-\\x20/'"])*${We}\\s*:(?!image\\/)|data\\s*:\\s*(?!image\\/))`, Wt = new RegExp(Ut, "gim"), Gt = new RegExp(Ut, "im"), Kt = RegExp(`url\\s*\\(\\s*(?:["']?\\s*)?${We}\\s*:`, "i");
|
|
1848
|
+
function qt(e) {
|
|
1849
|
+
return e.replace(Nt, (e, t, n) => {
|
|
1850
|
+
let r = t ? parseInt(t, 16) : parseInt(n, 10);
|
|
1851
|
+
return r >= 0 && r <= 1114111 ? String.fromCodePoint(r) : "";
|
|
1852
|
+
}).replace(Pt, (e, t) => Mt[t] ?? "").replace(Ft, "");
|
|
1853
|
+
}
|
|
1854
|
+
function Jt(e) {
|
|
1855
|
+
return Ht.test(e) || new RegExp(Bt.source, "i").test(e);
|
|
1856
|
+
}
|
|
1857
|
+
function Yt(e) {
|
|
1858
|
+
return e.toLowerCase().includes("url(") && Kt.test(e) || Gt.test(e);
|
|
1859
|
+
}
|
|
1860
|
+
function Xt(e) {
|
|
1861
|
+
if (It.test(e) || e.indexOf(":") !== -1) return !0;
|
|
1862
|
+
let t = e.toLowerCase(), n = t.indexOf("on");
|
|
1863
|
+
for (; n !== -1 && n < e.length - 2;) {
|
|
1864
|
+
let e = t.charCodeAt(n + 2);
|
|
1779
1865
|
if (e >= 97 && e <= 122) return !0;
|
|
1866
|
+
n = t.indexOf("on", n + 1);
|
|
1780
1867
|
}
|
|
1781
1868
|
return !1;
|
|
1782
1869
|
}
|
|
1783
|
-
function
|
|
1870
|
+
function Q(e) {
|
|
1784
1871
|
if (!e) return "";
|
|
1785
1872
|
let t = String(e);
|
|
1786
|
-
if (!
|
|
1787
|
-
let n =
|
|
1873
|
+
if (!Xt(t)) return t;
|
|
1874
|
+
let n = qt(t);
|
|
1788
1875
|
if (n.indexOf("<") !== -1) {
|
|
1789
|
-
n = n.replace(
|
|
1876
|
+
n = n.replace(Lt, "");
|
|
1790
1877
|
let e;
|
|
1791
1878
|
do
|
|
1792
|
-
e = n, n = n.replace(
|
|
1879
|
+
e = n, n = n.replace(Rt, "");
|
|
1793
1880
|
while (n !== e);
|
|
1794
1881
|
}
|
|
1795
|
-
return n.replace(
|
|
1882
|
+
return n.replace(Wt, "data-unsafe-css:").replace(Vt, "data-unsafe-protocol:").replace(Bt, "data-unsafe-protocol:").replace(zt, "data-unsafe-attr=");
|
|
1796
1883
|
}
|
|
1797
|
-
var
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1884
|
+
var Zt = (e, t) => {
|
|
1885
|
+
let n = e.toLowerCase();
|
|
1886
|
+
return jt.has(n) ? Jt(qt(t)) : !1;
|
|
1887
|
+
}, Qt = (e) => Yt(qt(e)), $t = /* @__PURE__ */ new Map();
|
|
1888
|
+
function en(e) {
|
|
1889
|
+
let t = $t.get(e);
|
|
1890
|
+
return t === void 0 ? (t = e.includes("-") ? e.replace(/-./g, (e) => e[1].toUpperCase()) : e, $t.set(e, t), t) : t;
|
|
1801
1891
|
}
|
|
1802
|
-
var
|
|
1803
|
-
function
|
|
1804
|
-
let t =
|
|
1805
|
-
return t || (t =
|
|
1892
|
+
var tn = /* @__PURE__ */ new WeakMap();
|
|
1893
|
+
function nn(e) {
|
|
1894
|
+
let t = tn.get(e);
|
|
1895
|
+
return t || (t = Oe(() => {
|
|
1806
1896
|
let t = e.value;
|
|
1807
|
-
return
|
|
1808
|
-
}),
|
|
1897
|
+
return Ie(t) ? t.then((e) => Q(e)) : Q(t);
|
|
1898
|
+
}), tn.set(e, t)), t;
|
|
1809
1899
|
}
|
|
1810
|
-
function
|
|
1811
|
-
|
|
1812
|
-
el: e,
|
|
1813
|
-
trackCleanup: (t) => q.trackCleanup(e, t)
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
function Vt({ el: e }, t, n) {
|
|
1817
|
-
vt(e, t, (t) => {
|
|
1900
|
+
function rn({ el: e }, t, n) {
|
|
1901
|
+
kt(e, t, (t) => {
|
|
1818
1902
|
let r = n ? n(t) : String(t ?? "");
|
|
1819
1903
|
e.textContent !== r && (e.textContent = r);
|
|
1820
1904
|
}, "text");
|
|
1821
1905
|
}
|
|
1822
|
-
function
|
|
1823
|
-
let n =
|
|
1824
|
-
|
|
1825
|
-
let
|
|
1826
|
-
|
|
1906
|
+
function an({ el: e }, t) {
|
|
1907
|
+
let n = ae(t) ? nn(t) : t, r = null;
|
|
1908
|
+
kt(e, n, (i) => {
|
|
1909
|
+
let a = n === t ? Q(i) : i;
|
|
1910
|
+
r !== a && (K.cleanupDescendants(e), e.innerHTML = a, r = a);
|
|
1827
1911
|
}, "html");
|
|
1828
1912
|
}
|
|
1829
|
-
function
|
|
1830
|
-
let n = {};
|
|
1831
|
-
for (let e in t) if (
|
|
1913
|
+
function on({ el: e }, t) {
|
|
1914
|
+
let n = {}, r = {};
|
|
1915
|
+
for (let e in t) if (B.call(t, e)) {
|
|
1832
1916
|
let t = e.trim();
|
|
1833
|
-
n[e] = t
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
for (let
|
|
1837
|
-
let
|
|
1838
|
-
|
|
1917
|
+
n[e] = /\s/.test(t) ? t.split(/\s+/).filter(Boolean) : [t];
|
|
1918
|
+
}
|
|
1919
|
+
At(e, t, (t) => {
|
|
1920
|
+
for (let i in t) {
|
|
1921
|
+
let a = !!t[i];
|
|
1922
|
+
if (r[i] === a) continue;
|
|
1923
|
+
let o = n[i];
|
|
1924
|
+
if (a) e.classList.add(...o);
|
|
1925
|
+
else for (let r of o) {
|
|
1926
|
+
let a = !1;
|
|
1927
|
+
for (let e in t) if (e !== i && t[e] && n[e].includes(r)) {
|
|
1928
|
+
a = !0;
|
|
1929
|
+
break;
|
|
1930
|
+
}
|
|
1931
|
+
a || e.classList.remove(r);
|
|
1932
|
+
}
|
|
1933
|
+
r[i] = a;
|
|
1839
1934
|
}
|
|
1840
1935
|
}, "class");
|
|
1841
1936
|
}
|
|
1842
|
-
function
|
|
1843
|
-
let n = e.style, r = {}, i = {};
|
|
1844
|
-
for (let e in t) if (
|
|
1937
|
+
function sn({ el: e }, t) {
|
|
1938
|
+
let n = e.style, r = {}, i = {}, a = {};
|
|
1939
|
+
for (let e in t) if (B.call(t, e)) {
|
|
1845
1940
|
let n = t[e], [a, o] = Array.isArray(n) ? n : [n, ""];
|
|
1846
1941
|
r[e] = a, i[e] = {
|
|
1847
|
-
camel:
|
|
1942
|
+
camel: en(e),
|
|
1848
1943
|
unit: o
|
|
1849
1944
|
};
|
|
1850
1945
|
}
|
|
1851
|
-
|
|
1946
|
+
At(e, r, (e) => {
|
|
1852
1947
|
for (let t in e) {
|
|
1853
|
-
let r = i[t],
|
|
1854
|
-
|
|
1948
|
+
let r = i[t], o = e[t], s = r.unit ? `${o}${r.unit}` : String(o), c = r.camel;
|
|
1949
|
+
a[t] !== s && (Qt(s) || (n[c] = s), a[t] = s);
|
|
1855
1950
|
}
|
|
1856
1951
|
}, "css");
|
|
1857
1952
|
}
|
|
1858
|
-
function
|
|
1953
|
+
function cn({ el: e }, t) {
|
|
1859
1954
|
let n = {}, r = {}, i = {};
|
|
1860
1955
|
for (let a in t) {
|
|
1861
|
-
if (!
|
|
1956
|
+
if (!B.call(t, a)) continue;
|
|
1862
1957
|
let o = a.toLowerCase();
|
|
1863
1958
|
if (o.startsWith("on")) {
|
|
1864
|
-
console.warn(`${
|
|
1959
|
+
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_EVENT_HANDLER(a)}`);
|
|
1865
1960
|
continue;
|
|
1866
1961
|
}
|
|
1867
1962
|
n[a] = t[a], r[a] = {
|
|
1868
1963
|
isAria: o.startsWith("aria-"),
|
|
1869
|
-
isUrl:
|
|
1964
|
+
isUrl: jt.has(o)
|
|
1870
1965
|
}, i[a] = e.getAttribute(a);
|
|
1871
1966
|
}
|
|
1872
|
-
|
|
1967
|
+
At(e, n, (t) => {
|
|
1873
1968
|
for (let n in t) {
|
|
1874
1969
|
let a = r[n], o = t[n];
|
|
1875
1970
|
if (o == null || o === !1 && !a.isAria) {
|
|
@@ -1877,256 +1972,275 @@ function Gt({ el: e }, t) {
|
|
|
1877
1972
|
continue;
|
|
1878
1973
|
}
|
|
1879
1974
|
let s = o === !0 ? a.isAria ? "true" : n : String(o);
|
|
1880
|
-
if (
|
|
1881
|
-
console.warn(`${
|
|
1975
|
+
if (Zt(n, s)) {
|
|
1976
|
+
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_PROTOCOL(n)}`);
|
|
1882
1977
|
continue;
|
|
1883
1978
|
}
|
|
1884
1979
|
i[n] !== s && (e.setAttribute(n, s), i[n] = s);
|
|
1885
1980
|
}
|
|
1886
1981
|
}, "attr");
|
|
1887
1982
|
}
|
|
1888
|
-
function
|
|
1889
|
-
let n = e.el, r = {}, i = {};
|
|
1983
|
+
function ln(e, t) {
|
|
1984
|
+
let n = e.el, r = {}, i = {}, a = {};
|
|
1890
1985
|
for (let e in t) {
|
|
1891
|
-
if (!
|
|
1986
|
+
if (!B.call(t, e)) continue;
|
|
1892
1987
|
let n = e.toLowerCase();
|
|
1893
|
-
if (n.startsWith("on") ||
|
|
1894
|
-
console.warn(`${
|
|
1988
|
+
if (n.startsWith("on") || Ue.has(e)) {
|
|
1989
|
+
console.warn(`${V.BINDING} ${n.startsWith("on") ? H.SECURITY.BLOCKED_EVENT_HANDLER(e) : H.SECURITY.BLOCKED_PROP(e)}`);
|
|
1895
1990
|
continue;
|
|
1896
1991
|
}
|
|
1897
|
-
r[e] = t[e], i[e] = { isUrl:
|
|
1992
|
+
r[e] = t[e], i[e] = { isUrl: jt.has(n) };
|
|
1898
1993
|
}
|
|
1899
|
-
|
|
1994
|
+
At(e.el, r, (e) => {
|
|
1900
1995
|
for (let t in e) {
|
|
1901
1996
|
let r = e[t];
|
|
1902
|
-
if (
|
|
1903
|
-
|
|
1904
|
-
|
|
1997
|
+
if (a[t] !== r) {
|
|
1998
|
+
if (typeof r == "string" && Zt(t, r)) {
|
|
1999
|
+
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_PROTOCOL(t)}`);
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
2002
|
+
n[t] = r, a[t] = r;
|
|
1905
2003
|
}
|
|
1906
|
-
n[t] !== r && (n[t] = r);
|
|
1907
2004
|
}
|
|
1908
2005
|
}, "prop");
|
|
1909
2006
|
}
|
|
1910
|
-
function
|
|
2007
|
+
function un({ el: e }, t, n) {
|
|
1911
2008
|
let r = e.style.display === "none" ? "" : e.style.display;
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
e.style.display !== i && (e.style.display = i);
|
|
2009
|
+
kt(e, t, (t) => {
|
|
2010
|
+
n === !!t ? e.style.display !== "none" && (r = e.style.display, e.style.display = "none") : e.style.display === "none" && (e.style.display = r);
|
|
1915
2011
|
}, n ? "hide" : "show");
|
|
1916
2012
|
}
|
|
1917
|
-
function
|
|
2013
|
+
function dn(t, n, r = {}) {
|
|
1918
2014
|
let i = t.el.tagName.toLowerCase();
|
|
1919
|
-
if (!
|
|
1920
|
-
console.warn(`${
|
|
2015
|
+
if (!He.has(i)) {
|
|
2016
|
+
console.warn(`${V.BINDING} ${H.BINDING.INVALID_INPUT_ELEMENT(i)}`);
|
|
1921
2017
|
return;
|
|
1922
2018
|
}
|
|
1923
|
-
let { fx: a, cleanup: o } =
|
|
1924
|
-
|
|
2019
|
+
let { fx: a, cleanup: o } = Ot(e(t.el), n, r);
|
|
2020
|
+
K.trackEffect(t.el, a), t.trackCleanup(o);
|
|
1925
2021
|
}
|
|
1926
|
-
function
|
|
2022
|
+
function fn(t) {
|
|
2023
|
+
t.type === "radio" && t.name && (t.form ? e(t.form) : e(document)).find(`input[type="radio"][name="${e.escapeSelector(t.name)}"]`).not(t).trigger("change.atomRadioSync");
|
|
2024
|
+
}
|
|
2025
|
+
function pn(t, n) {
|
|
1927
2026
|
let r = t.el, i = e(r), a = () => {
|
|
1928
|
-
n.peek() !== r.checked && (n.value = r.checked,
|
|
2027
|
+
n.peek() !== r.checked && (n.value = r.checked, fn(r));
|
|
1929
2028
|
};
|
|
1930
|
-
a[
|
|
2029
|
+
a[Y] = !0, i.on("change change.atomRadioSync", a), t.trackCleanup(() => i.off("change change.atomRadioSync", a)), K.trackEffect(r, R(() => {
|
|
1931
2030
|
let e = !!n.value;
|
|
1932
2031
|
k(() => {
|
|
1933
|
-
r.checked !== e && (r.checked = e,
|
|
2032
|
+
r.checked !== e && (r.checked = e, W.domUpdated(V.BINDING, r, "checked", e), e && fn(r));
|
|
1934
2033
|
});
|
|
1935
2034
|
}));
|
|
1936
2035
|
}
|
|
1937
|
-
function
|
|
2036
|
+
function mn(t, n) {
|
|
1938
2037
|
let r = e(t.el);
|
|
1939
2038
|
r.on(n), t.trackCleanup(() => r.off(n));
|
|
1940
2039
|
}
|
|
1941
|
-
function
|
|
2040
|
+
function hn({ el: t, trackCleanup: n }, r, i) {
|
|
1942
2041
|
let a = e(t);
|
|
1943
2042
|
a.on(r, i), n(() => a.off(r, i));
|
|
1944
2043
|
}
|
|
1945
|
-
function
|
|
1946
|
-
|
|
2044
|
+
function gn(e) {
|
|
2045
|
+
K.cleanupTree(e);
|
|
1947
2046
|
}
|
|
1948
2047
|
//#endregion
|
|
1949
2048
|
//#region src/bindings/form.ts
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2049
|
+
var _n = "input, select, textarea", vn = class {
|
|
2050
|
+
constructor(e, t, n = {}) {
|
|
2051
|
+
this.form = e, this.atom = t, this.options = n, this.fieldMap = /* @__PURE__ */ new Map(), this.fields = [], this.elementNames = /* @__PURE__ */ new WeakMap(), this.isSyncingFromLeaf = !1, this.init();
|
|
2052
|
+
}
|
|
2053
|
+
init() {
|
|
2054
|
+
let e = R(() => {
|
|
2055
|
+
let e = this.atom.value;
|
|
2056
|
+
this.isSyncingFromLeaf || !this.fields.length || xe(() => {
|
|
2057
|
+
k(() => {
|
|
2058
|
+
for (let t = 0; t < this.fields.length; t++) {
|
|
2059
|
+
let n = this.fields[t], r = z(e, n.parts);
|
|
2060
|
+
Object.is(n.atom.peek(), r) || (n.atom.value = r);
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
});
|
|
1958
2064
|
});
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
let
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2065
|
+
K.trackEffect(this.form, e), this.bindElement(this.form), this.setupObserver();
|
|
2066
|
+
}
|
|
2067
|
+
bindElement(e) {
|
|
2068
|
+
let t = e.matches?.(_n) ? [e] : e.querySelectorAll?.(_n) || [];
|
|
2069
|
+
for (let e = 0, n = t.length; e < n; e++) this.bindControl(t[e]);
|
|
2070
|
+
}
|
|
2071
|
+
bindControl(e) {
|
|
2072
|
+
if (!(e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement)) return;
|
|
2073
|
+
let t = e, n = t.name;
|
|
2074
|
+
if (!n) return;
|
|
2075
|
+
let r = this.elementNames.get(t);
|
|
2076
|
+
if (r !== void 0 && r !== n && K.cleanup(t), this.elementNames.has(t) && r === n) return;
|
|
2077
|
+
let i = this.acquireField(n);
|
|
2078
|
+
this.elementNames.set(t, n);
|
|
2079
|
+
let a = pt(t);
|
|
2080
|
+
a.trackCleanup(() => this.releaseField(t, n)), t instanceof HTMLInputElement && (t.type === "radio" || t.type === "checkbox") ? this.bindToggle(a, i.atom, t.value, t.type === "checkbox") : dn(a, i.atom, this.options);
|
|
2081
|
+
}
|
|
2082
|
+
bindToggle(t, n, r, i) {
|
|
2083
|
+
let a = t.el, o = () => {
|
|
2084
|
+
let e = n.peek();
|
|
2085
|
+
if (i && Array.isArray(e)) {
|
|
2086
|
+
let t = new Set(e.map(String));
|
|
2087
|
+
a.checked ? t.add(r) : t.delete(r), n.value = Array.from(t);
|
|
2088
|
+
} else n.value = i ? a.checked : r;
|
|
2089
|
+
};
|
|
2090
|
+
o[Y] = !0, e(a).on("change", o), t.trackCleanup(() => e(a).off("change", o)), K.trackEffect(a, R(() => {
|
|
2091
|
+
let e = n.value, t = i ? Array.isArray(e) ? e.some((e) => String(e) === r) : !!e : String(e) === r;
|
|
2092
|
+
a.checked !== t && (a.checked = t);
|
|
2093
|
+
}));
|
|
2094
|
+
}
|
|
2095
|
+
acquireField(e) {
|
|
2096
|
+
let t = this.fieldMap.get(e);
|
|
2097
|
+
if (t) return t.refCount++, t;
|
|
2098
|
+
let n = e.replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean), r = Ce(z(this.atom.peek(), n));
|
|
2099
|
+
return t = {
|
|
2100
|
+
atom: r,
|
|
2101
|
+
parts: n,
|
|
2102
|
+
name: e,
|
|
2103
|
+
refCount: 1,
|
|
2104
|
+
effect: null
|
|
2105
|
+
}, t.effect = R(() => {
|
|
2106
|
+
let t = r.value;
|
|
2107
|
+
this.options.transform && (t = this.options.transform(e, t));
|
|
2108
|
+
let i = this.atom.peek(), a = Ae(i, n, 0, t);
|
|
2109
|
+
if (a !== i) {
|
|
2110
|
+
this.isSyncingFromLeaf = !0;
|
|
2111
|
+
try {
|
|
2112
|
+
this.atom.value = a, this.options.onChange && k(() => this.options.onChange(e, t));
|
|
2113
|
+
} finally {
|
|
2114
|
+
this.isSyncingFromLeaf = !1;
|
|
1992
2115
|
}
|
|
1993
2116
|
}
|
|
1994
|
-
|
|
2117
|
+
}), this.fieldMap.set(e, t), this.fields.push(t), t;
|
|
2118
|
+
}
|
|
2119
|
+
releaseField(e, t) {
|
|
2120
|
+
let n = this.fieldMap.get(t);
|
|
2121
|
+
if (n && --n.refCount <= 0) {
|
|
2122
|
+
let e = this.fields.indexOf(n);
|
|
2123
|
+
e !== -1 && this.fields.splice(e, 1), n.effect?.dispose(), this.fieldMap.delete(t);
|
|
1995
2124
|
}
|
|
1996
|
-
|
|
1997
|
-
c.observe(e, {
|
|
1998
|
-
childList: !0,
|
|
1999
|
-
subtree: !0,
|
|
2000
|
-
attributes: !0,
|
|
2001
|
-
attributeFilter: ["name"]
|
|
2002
|
-
}), q.trackCleanup(e, () => c.disconnect());
|
|
2003
|
-
}
|
|
2004
|
-
//#endregion
|
|
2005
|
-
//#region src/bindings/chainable.ts
|
|
2006
|
-
function Z(e, t) {
|
|
2007
|
-
let n = e.length;
|
|
2008
|
-
for (let r = 0; r < n; r++) {
|
|
2009
|
-
let n = e[r];
|
|
2010
|
-
if (n?.nodeType === 1) {
|
|
2011
|
-
let e = n;
|
|
2012
|
-
t(Bt(e), e);
|
|
2013
|
-
} else n && G.log(H.BINDING, `Skipping non-Element node (nodeType=${n.nodeType})`);
|
|
2125
|
+
K.cleanup(e);
|
|
2014
2126
|
}
|
|
2015
|
-
|
|
2127
|
+
setupObserver() {
|
|
2128
|
+
let e = new MutationObserver((e) => {
|
|
2129
|
+
for (let t = 0, n = e.length; t < n; t++) {
|
|
2130
|
+
let n = e[t];
|
|
2131
|
+
if (n.type === "childList") for (let e = 0; e < n.addedNodes.length; e++) {
|
|
2132
|
+
let t = n.addedNodes[e];
|
|
2133
|
+
t.nodeType === 1 && this.bindElement(t);
|
|
2134
|
+
}
|
|
2135
|
+
else n.attributeName === "name" && this.bindElement(n.target);
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
e.observe(this.form, {
|
|
2139
|
+
childList: !0,
|
|
2140
|
+
subtree: !0,
|
|
2141
|
+
attributes: !0,
|
|
2142
|
+
attributeFilter: ["name"]
|
|
2143
|
+
}), K.trackCleanup(this.form, () => e.disconnect());
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
function yn(e, t, n = {}) {
|
|
2147
|
+
new vn(e, t, n);
|
|
2016
2148
|
}
|
|
2017
2149
|
e.fn.atomText = function(e, t) {
|
|
2018
|
-
return
|
|
2150
|
+
return J(this, (n) => rn(n, e, t), { needsCtx: !0 });
|
|
2019
2151
|
}, e.fn.atomHtml = function(e) {
|
|
2020
|
-
return
|
|
2152
|
+
return J(this, (t) => an(t, e), { needsCtx: !0 });
|
|
2021
2153
|
}, e.fn.atomClass = function(e, t) {
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
let n = { [e]: t };
|
|
2025
|
-
return Z(this, (e) => Ut(e, n));
|
|
2026
|
-
}
|
|
2027
|
-
return Z(this, (t) => Ut(t, e));
|
|
2154
|
+
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2155
|
+
return n ? J(this, (e) => on(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_CONDITION("atomClass")}`), this);
|
|
2028
2156
|
}, e.fn.atomCss = function(e, t, n) {
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
let r = { [e]: n ? [t, n] : t };
|
|
2032
|
-
return Z(this, (e) => Wt(e, r));
|
|
2033
|
-
}
|
|
2034
|
-
return Z(this, (t) => Wt(t, e));
|
|
2157
|
+
let r = typeof e == "string" ? t === void 0 ? null : { [e]: n ? [t, n] : t } : e;
|
|
2158
|
+
return r ? J(this, (e) => sn(e, r), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomCss")}`), this);
|
|
2035
2159
|
}, e.fn.atomAttr = function(e, t) {
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
let n = { [e]: t };
|
|
2039
|
-
return Z(this, (e) => Gt(e, n));
|
|
2040
|
-
}
|
|
2041
|
-
return Z(this, (t) => Gt(t, e));
|
|
2160
|
+
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2161
|
+
return n ? J(this, (e) => cn(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomAttr")}`), this);
|
|
2042
2162
|
}, e.fn.atomProp = function(e, t) {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
let n = { [e]: t };
|
|
2046
|
-
return Z(this, (e) => Kt(e, n));
|
|
2047
|
-
}
|
|
2048
|
-
return Z(this, (t) => Kt(t, e));
|
|
2163
|
+
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2164
|
+
return n ? J(this, (e) => ln(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomProp")}`), this);
|
|
2049
2165
|
}, e.fn.atomShow = function(e) {
|
|
2050
|
-
return
|
|
2166
|
+
return J(this, (t) => un(t, e, !1), { needsCtx: !0 });
|
|
2051
2167
|
}, e.fn.atomHide = function(e) {
|
|
2052
|
-
return
|
|
2168
|
+
return J(this, (t) => un(t, e, !0), { needsCtx: !0 });
|
|
2053
2169
|
}, e.fn.atomVal = function(e, t = {}) {
|
|
2054
|
-
return
|
|
2170
|
+
return J(this, (n) => dn(n, e, t), { needsCtx: !0 });
|
|
2055
2171
|
}, e.fn.atomChecked = function(e) {
|
|
2056
|
-
return
|
|
2172
|
+
return J(this, (t) => pn(t, e), { needsCtx: !0 });
|
|
2057
2173
|
}, e.fn.atomForm = function(e, t = {}) {
|
|
2058
|
-
return
|
|
2059
|
-
r instanceof HTMLFormElement
|
|
2060
|
-
});
|
|
2174
|
+
return J(this, (n, r) => {
|
|
2175
|
+
r instanceof HTMLFormElement ? yn(r, e, t) : W.log(V.BINDING, "Skipping non-Form element for atomForm");
|
|
2176
|
+
}, { needsCtx: !1 });
|
|
2061
2177
|
}, e.fn.atomOn = function(e, t) {
|
|
2062
|
-
return
|
|
2178
|
+
return J(this, (n) => hn(n, e, t), { needsCtx: !0 });
|
|
2063
2179
|
};
|
|
2064
|
-
var
|
|
2065
|
-
(e, t) =>
|
|
2066
|
-
(e, t) =>
|
|
2067
|
-
(e, t) =>
|
|
2068
|
-
(e, t) =>
|
|
2069
|
-
(e, t) =>
|
|
2070
|
-
(e, t) =>
|
|
2071
|
-
(e, t) =>
|
|
2072
|
-
(e, t) =>
|
|
2073
|
-
(e, t) =>
|
|
2074
|
-
|
|
2075
|
-
Array.isArray(n) ? Jt(e, n[0], n[1]) : Jt(e, n);
|
|
2076
|
-
},
|
|
2077
|
-
(e, t) => Yt(e, t.checked),
|
|
2180
|
+
var bn = [
|
|
2181
|
+
(e, t) => rn(e, ...mt(t.text)),
|
|
2182
|
+
(e, t) => an(e, t.html),
|
|
2183
|
+
(e, t) => on(e, t.class),
|
|
2184
|
+
(e, t) => sn(e, t.css),
|
|
2185
|
+
(e, t) => cn(e, t.attr),
|
|
2186
|
+
(e, t) => ln(e, t.prop),
|
|
2187
|
+
(e, t) => un(e, t.show, !1),
|
|
2188
|
+
(e, t) => un(e, t.hide, !0),
|
|
2189
|
+
(e, t) => dn(e, ...mt(t.val)),
|
|
2190
|
+
(e, t) => pn(e, t.checked),
|
|
2078
2191
|
(e, t) => {
|
|
2079
|
-
e.el instanceof HTMLFormElement &&
|
|
2192
|
+
e.el instanceof HTMLFormElement && yn(e.el, ...mt(t.form));
|
|
2080
2193
|
},
|
|
2081
|
-
(e, t) =>
|
|
2194
|
+
(e, t) => mn(e, t.on)
|
|
2082
2195
|
];
|
|
2083
2196
|
e.fn.atomBind = function(e) {
|
|
2084
2197
|
let t = 0;
|
|
2085
|
-
return e.text !== void 0 && (t |= 1), e.html !== void 0 && (t |= 2), e.class !== void 0 && (t |= 4), e.css !== void 0 && (t |= 8), e.attr !== void 0 && (t |= 16), e.prop !== void 0 && (t |= 32), e.show !== void 0 && (t |= 64), e.hide !== void 0 && (t |= 128), e.val !== void 0 && (t |= 256), e.checked !== void 0 && (t |= 512), e.form !== void 0 && (t |= 1024), e.on !== void 0 && (t |= 2048), t === 0 ? this :
|
|
2198
|
+
return e.text !== void 0 && (t |= 1), e.html !== void 0 && (t |= 2), e.class !== void 0 && (t |= 4), e.css !== void 0 && (t |= 8), e.attr !== void 0 && (t |= 16), e.prop !== void 0 && (t |= 32), e.show !== void 0 && (t |= 64), e.hide !== void 0 && (t |= 128), e.val !== void 0 && (t |= 256), e.checked !== void 0 && (t |= 512), e.form !== void 0 && (t |= 1024), e.on !== void 0 && (t |= 2048), t === 0 ? this : J(this, (n) => {
|
|
2086
2199
|
let r = t;
|
|
2087
2200
|
for (; r > 0;) {
|
|
2088
2201
|
let t = r & -r;
|
|
2089
|
-
|
|
2202
|
+
bn[31 - Math.clz32(t)](n, e), r ^= t;
|
|
2090
2203
|
}
|
|
2091
|
-
});
|
|
2204
|
+
}, { needsCtx: !0 });
|
|
2092
2205
|
}, e.fn.atomUnbind = function() {
|
|
2093
|
-
|
|
2094
|
-
for (let t = 0; t < e; t++) {
|
|
2095
|
-
let e = this[t];
|
|
2096
|
-
e?.nodeType === 1 && Qt(e);
|
|
2097
|
-
}
|
|
2098
|
-
return this;
|
|
2206
|
+
return J(this, (e, t) => gn(t), { needsCtx: !1 });
|
|
2099
2207
|
};
|
|
2100
2208
|
//#endregion
|
|
2101
|
-
//#region src/bindings/list.ts
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2209
|
+
//#region src/bindings/list/utils.ts
|
|
2210
|
+
function xn(t) {
|
|
2211
|
+
return t instanceof Element ? e(t) : t;
|
|
2212
|
+
}
|
|
2213
|
+
function Sn(e, t) {
|
|
2214
|
+
if (e instanceof Element) t === null ? e.removeAttribute("data-atom-key") : e.setAttribute("data-atom-key", t);
|
|
2215
|
+
else if (!e.nodeType) {
|
|
2216
|
+
let n = e;
|
|
2217
|
+
for (let e = 0, r = n.length; e < r; e++) {
|
|
2218
|
+
let r = n[e];
|
|
2219
|
+
r instanceof Element && (t === null ? r.removeAttribute("data-atom-key") : r.setAttribute("data-atom-key", t));
|
|
2220
|
+
}
|
|
2112
2221
|
}
|
|
2113
2222
|
}
|
|
2114
|
-
function
|
|
2115
|
-
|
|
2223
|
+
function Cn(e) {
|
|
2224
|
+
if (e instanceof Element) K.cleanupTree(e);
|
|
2225
|
+
else for (let t = 0, n = e.length; t < n; t++) {
|
|
2226
|
+
let n = e[t];
|
|
2227
|
+
n instanceof Element && K.cleanupTree(n);
|
|
2228
|
+
}
|
|
2116
2229
|
}
|
|
2117
|
-
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region src/bindings/list/context.ts
|
|
2232
|
+
var wn = class {
|
|
2118
2233
|
constructor(e, t, n) {
|
|
2119
2234
|
this.$container = e, this.containerSelector = t, this.onRemove = n, this.oldKeys = [], this.oldItems = [], this.oldNodes = [], this.removingKeys = /* @__PURE__ */ new Set(), this.$emptyEl = null, this.keyToIndex = /* @__PURE__ */ new Map(), this.statesBuffer = new Uint8Array(256), this.indicesBuffer = new Int32Array(256);
|
|
2120
2235
|
}
|
|
2121
2236
|
scheduleRemoval(e, t) {
|
|
2122
2237
|
let n = () => {
|
|
2123
|
-
this.fx?.isDisposed || (t[0]?.isConnected && t.remove(), this.removingKeys.delete(e),
|
|
2238
|
+
this.fx?.isDisposed || t[0] instanceof Element && t[0].hasAttribute("data-atom-key") || (t[0]?.isConnected && t.remove(), this.removingKeys.delete(e), W.log(V.LIST, `${this.containerSelector} removed item:`, e));
|
|
2124
2239
|
}, r = this.onRemove?.(t);
|
|
2125
2240
|
r instanceof Promise ? r.then(n, n) : n();
|
|
2126
2241
|
}
|
|
2127
2242
|
removeItem(e, t) {
|
|
2128
|
-
|
|
2129
|
-
this.removingKeys.add(e), this.scheduleRemoval(e, t);
|
|
2243
|
+
Sn(t, null), this.removingKeys.add(e), this.scheduleRemoval(e, t);
|
|
2130
2244
|
}
|
|
2131
2245
|
dispose() {
|
|
2132
2246
|
this.removingKeys.clear(), this.oldKeys.length = 0, this.oldItems.length = 0, this.oldNodes.length = 0, this.keyToIndex.clear(), this.$emptyEl?.remove(), this.$container.off(".atomList"), this.statesBuffer = new Uint8Array(), this.indicesBuffer = new Int32Array();
|
|
@@ -2135,148 +2249,171 @@ var sn = class {
|
|
|
2135
2249
|
this.statesBuffer.length < e && (this.statesBuffer = new Uint8Array(Math.max(e, this.statesBuffer.length * 2))), this.indicesBuffer.length < e && (this.indicesBuffer = new Int32Array(Math.max(e, this.indicesBuffer.length * 2)));
|
|
2136
2250
|
}
|
|
2137
2251
|
};
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
let
|
|
2153
|
-
for (
|
|
2154
|
-
|
|
2155
|
-
if (o[f] !== n || !h(s[f], e)) break;
|
|
2156
|
-
u.set(n, f++);
|
|
2157
|
-
}
|
|
2158
|
-
for (; p >= f && m >= f;) {
|
|
2159
|
-
let e = t[m], n = r(e, m);
|
|
2160
|
-
if (o[p] !== n || !h(s[p], e)) break;
|
|
2161
|
-
u.set(n, m--), p--;
|
|
2162
|
-
}
|
|
2163
|
-
let g = rn.acquire();
|
|
2164
|
-
for (let e = f; e <= p; e++) g.set(o[e], e);
|
|
2165
|
-
let _ = an.acquire();
|
|
2252
|
+
//#endregion
|
|
2253
|
+
//#region src/bindings/list/diff.ts
|
|
2254
|
+
function Tn(e, t, n, r, i, a, o) {
|
|
2255
|
+
let { oldKeys: s, oldItems: c, oldNodes: l, removingKeys: u, keyToIndex: d } = e, f = s.length, p = 0, m = f - 1, h = n - 1, g = a || Re;
|
|
2256
|
+
for (; p <= m && p <= h;) {
|
|
2257
|
+
let e = t[p], n = r(e, p);
|
|
2258
|
+
if (s[p] !== n || !g(c[p], e) || !l[p]) break;
|
|
2259
|
+
d.set(n, p++);
|
|
2260
|
+
}
|
|
2261
|
+
for (; m >= p && h >= p;) {
|
|
2262
|
+
let e = t[h], n = r(e, h);
|
|
2263
|
+
if (s[m] !== n || !g(c[m], e) || !l[m]) break;
|
|
2264
|
+
d.set(n, h--), m--;
|
|
2265
|
+
}
|
|
2266
|
+
let _ = o.map.acquire();
|
|
2267
|
+
for (let e = p; e <= m; e++) _.set(s[e], e);
|
|
2268
|
+
let v = o.set.acquire();
|
|
2166
2269
|
e.ensureBuffers(n);
|
|
2167
|
-
let
|
|
2168
|
-
v.length = n;
|
|
2169
|
-
let y = Q.acquire();
|
|
2270
|
+
let y = o.array.acquire();
|
|
2170
2271
|
y.length = n;
|
|
2171
|
-
let b =
|
|
2272
|
+
let b = o.array.acquire();
|
|
2172
2273
|
b.length = n;
|
|
2173
|
-
let x =
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
for (let
|
|
2177
|
-
let
|
|
2178
|
-
|
|
2179
|
-
|
|
2274
|
+
let x = o.array.acquire();
|
|
2275
|
+
x.length = n;
|
|
2276
|
+
let S = e.statesBuffer, C = e.indicesBuffer, w = o.array.acquire(), T = o.array.acquire(), ee = o.array.acquire();
|
|
2277
|
+
for (let e = 0; e < p; e++) {
|
|
2278
|
+
let n = s[e];
|
|
2279
|
+
y[e] = n, b[e] = t[e], x[e] = l[e], S[e] = 3, C[e] = e, v.add(n);
|
|
2280
|
+
}
|
|
2281
|
+
for (let e = f - 1, r = n - 1; r > h; r--, e--) {
|
|
2282
|
+
let n = s[e];
|
|
2283
|
+
y[r] = n, b[r] = t[r], x[r] = l[e], S[r] = 3, C[r] = e, v.add(n);
|
|
2284
|
+
}
|
|
2285
|
+
for (let n = p; n <= h; n++) {
|
|
2286
|
+
let o = t[n], s = r(o, n);
|
|
2287
|
+
if (y[n] = s, b[n] = o, d.set(s, n), v.has(s)) {
|
|
2288
|
+
W.warn(V.LIST, H.LIST.DUPLICATE_KEY(s, n, e.containerSelector)), C[n] = -1;
|
|
2180
2289
|
continue;
|
|
2181
2290
|
}
|
|
2182
|
-
|
|
2183
|
-
let f =
|
|
2291
|
+
v.add(s);
|
|
2292
|
+
let f = _.get(s);
|
|
2184
2293
|
if (f === void 0) {
|
|
2185
|
-
|
|
2294
|
+
w.push(s), T.push(o), ee.push(n), C[n] = -1, S[n] = 1;
|
|
2186
2295
|
continue;
|
|
2187
2296
|
}
|
|
2188
|
-
let p =
|
|
2189
|
-
|
|
2190
|
-
}
|
|
2191
|
-
return
|
|
2192
|
-
newKeys:
|
|
2193
|
-
newKeySet:
|
|
2194
|
-
newItems:
|
|
2195
|
-
newNodes:
|
|
2196
|
-
newStates:
|
|
2197
|
-
newIndices:
|
|
2198
|
-
trKeys:
|
|
2199
|
-
trItems:
|
|
2200
|
-
trIdxs:
|
|
2201
|
-
startIndex:
|
|
2202
|
-
oldEndIndex:
|
|
2203
|
-
newEndIndex:
|
|
2297
|
+
let p = c[f];
|
|
2298
|
+
x[n] = l[f], !i && p !== o && !(a ? a(p, o) : Re(p, o)) ? (w.push(s), T.push(o), ee.push(n), S[n] = 2) : S[n] = 0, C[n] = u.has(s) ? -1 : f;
|
|
2299
|
+
}
|
|
2300
|
+
return o.map.release(_), {
|
|
2301
|
+
newKeys: y,
|
|
2302
|
+
newKeySet: v,
|
|
2303
|
+
newItems: b,
|
|
2304
|
+
newNodes: x,
|
|
2305
|
+
newStates: S,
|
|
2306
|
+
newIndices: C,
|
|
2307
|
+
trKeys: w,
|
|
2308
|
+
trItems: T,
|
|
2309
|
+
trIdxs: ee,
|
|
2310
|
+
startIndex: p,
|
|
2311
|
+
oldEndIndex: m,
|
|
2312
|
+
newEndIndex: h
|
|
2204
2313
|
};
|
|
2205
2314
|
}
|
|
2206
|
-
|
|
2315
|
+
//#endregion
|
|
2316
|
+
//#region src/bindings/list/dom.ts
|
|
2317
|
+
var En = 0;
|
|
2318
|
+
function Dn(e, t, n) {
|
|
2319
|
+
if (!e) return;
|
|
2320
|
+
if (e instanceof Element) {
|
|
2321
|
+
n.insertBefore(e, t);
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
let r = e.length;
|
|
2325
|
+
for (let i = 0; i < r; i++) {
|
|
2326
|
+
let r = e[i];
|
|
2327
|
+
r && n.insertBefore(r, t);
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
function On(t, n, r, i, a) {
|
|
2331
|
+
if (t.$emptyEl && n > 0 && (t.$emptyEl.remove(), t.$emptyEl = null), n !== 0) return;
|
|
2332
|
+
let { oldKeys: o, oldNodes: s, onRemove: c } = t;
|
|
2333
|
+
if (c) for (let e = 0, n = o.length; e < n; e++) {
|
|
2334
|
+
let n = o[e];
|
|
2335
|
+
s[e] && t.removeItem(n, xn(s[e]));
|
|
2336
|
+
}
|
|
2337
|
+
else {
|
|
2338
|
+
for (let e = 0, n = o.length; e < n; e++) t.removingKeys.delete(o[e]);
|
|
2339
|
+
r.empty();
|
|
2340
|
+
}
|
|
2341
|
+
i && !t.$emptyEl && (t.$emptyEl = e(typeof i == "string" ? Q(i) : i), t.$emptyEl.appendTo(r)), a.release(t.oldKeys), a.release(t.oldItems), a.release(t.oldNodes), t.oldKeys = [], t.oldItems = [], t.oldNodes = [];
|
|
2342
|
+
}
|
|
2343
|
+
function kn(t, n, r) {
|
|
2207
2344
|
let { trKeys: i, trItems: a, trIdxs: o, newNodes: s, newStates: c } = t, l = i.length, u = Array(l), d = [], f = 0;
|
|
2208
2345
|
for (let e = 0; e < l; e++) {
|
|
2209
2346
|
let t = n.render(a[e], o[e]);
|
|
2210
2347
|
u[e] = t, typeof t == "string" && (d.push(t), f++);
|
|
2211
2348
|
}
|
|
2212
2349
|
let p = null;
|
|
2213
|
-
if (d.length > 0) if (d.length === 1) p = [
|
|
2350
|
+
if (d.length > 0) if (d.length === 1) p = [Q(d[0])];
|
|
2214
2351
|
else {
|
|
2215
|
-
let e = `<template data-atom-sep="${(
|
|
2216
|
-
p =
|
|
2352
|
+
let e = `<template data-atom-sep="${(En++).toString(36)}"></template>`;
|
|
2353
|
+
p = Q(d.join(e)).split(e);
|
|
2217
2354
|
}
|
|
2218
|
-
if (r && p && f === l && !n.bind && !n.onAdd && !n.onRemove && !n.events) return p;
|
|
2355
|
+
if (r && p && f === l && !n.bind && !n.onAdd && !n.onRemove && !n.events && e.parseHTML(p.join("")).length === l) return p;
|
|
2219
2356
|
let m = 0;
|
|
2220
2357
|
for (let t = 0; t < l; t++) {
|
|
2221
|
-
let n = u[t], r = e(typeof n == "string" ? p[m++] : n), a = o[t]
|
|
2222
|
-
|
|
2223
|
-
let t = r[e];
|
|
2224
|
-
t instanceof Element && t.setAttribute("data-atom-key", l);
|
|
2225
|
-
}
|
|
2226
|
-
if (c[a] === 2 && s[a]) {
|
|
2358
|
+
let n = u[t], r = e(typeof n == "string" ? e.parseHTML(p[m++]) : n), a = o[t];
|
|
2359
|
+
if (Sn(r, String(i[t])), c[a] === 2 && s[a]) {
|
|
2227
2360
|
let e = s[a];
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
n instanceof Element && q.cleanupTree(n);
|
|
2232
|
-
}
|
|
2233
|
-
$(e).replaceWith(r);
|
|
2361
|
+
Cn(e);
|
|
2362
|
+
let t = xn(e);
|
|
2363
|
+
t.first().before(r), t.remove();
|
|
2234
2364
|
}
|
|
2235
2365
|
s[a] = r.length === 1 ? r[0] : r;
|
|
2236
2366
|
}
|
|
2237
2367
|
return null;
|
|
2238
2368
|
}
|
|
2239
|
-
function
|
|
2369
|
+
function An(e, t) {
|
|
2240
2370
|
let { startIndex: n, oldEndIndex: r, newKeySet: i } = t;
|
|
2241
2371
|
for (let t = n; t <= r; t++) {
|
|
2242
2372
|
let n = e.oldKeys[t];
|
|
2243
|
-
!i.has(n) && e.oldNodes[t] && e.removeItem(n,
|
|
2373
|
+
!i.has(n) && e.oldNodes[t] && e.removeItem(n, xn(e.oldNodes[t]));
|
|
2244
2374
|
}
|
|
2245
2375
|
}
|
|
2246
|
-
function
|
|
2376
|
+
function jn(t, n, r, i, a) {
|
|
2247
2377
|
let { newKeys: o, newItems: s, newNodes: c, newStates: l, newIndices: u } = n, d = o.length;
|
|
2248
2378
|
if (a !== null) {
|
|
2249
2379
|
r.innerHTML = a.join("");
|
|
2250
2380
|
let n = r.firstElementChild;
|
|
2251
|
-
for (let r = 0; r < d && n; r++) n.setAttribute("data-atom-key", String(o[r])), c[r] = n, l[r] = 0, t.removingKeys.delete(o[r]),
|
|
2381
|
+
for (let r = 0; r < d && n; r++) n.setAttribute("data-atom-key", String(o[r])), c[r] = n, l[r] = 0, t.removingKeys.delete(o[r]), W.domUpdated(V.LIST, e(n), "list.add", s[r]), n = n.nextElementSibling;
|
|
2252
2382
|
return;
|
|
2253
2383
|
}
|
|
2254
|
-
if (t.oldKeys.length === 0) {
|
|
2384
|
+
if (t.oldKeys.length === 0 && t.removingKeys.size === 0) {
|
|
2255
2385
|
let e = document.createDocumentFragment();
|
|
2256
2386
|
for (let t = 0; t < d; t++) {
|
|
2257
2387
|
let n = c[t];
|
|
2258
|
-
if (n instanceof Element) e.appendChild(n);
|
|
2388
|
+
if (n) if (n instanceof Element) e.appendChild(n);
|
|
2259
2389
|
else for (let t = 0; t < n.length; t++) e.appendChild(n[t]);
|
|
2260
2390
|
}
|
|
2261
|
-
r.appendChild(e);
|
|
2391
|
+
r.innerHTML = "", r.appendChild(e);
|
|
2262
2392
|
} else {
|
|
2263
2393
|
let e = null, t = 2147483647;
|
|
2264
2394
|
for (let n = d - 1; n >= 0; n--) {
|
|
2265
|
-
let i = u[n];
|
|
2266
|
-
i !== -1 && i < t ? t = i :
|
|
2267
|
-
let a = c[n];
|
|
2268
|
-
e = a instanceof Element ? a : a[0] ?? null;
|
|
2395
|
+
let i = u[n], a = c[n];
|
|
2396
|
+
a && (i !== -1 && i < t ? t = i : Dn(a, e, r), e = a instanceof Element ? a : a[0] ?? null);
|
|
2269
2397
|
}
|
|
2270
2398
|
}
|
|
2271
2399
|
for (let e = 0; e < d; e++) {
|
|
2272
2400
|
let n = l[e];
|
|
2273
2401
|
if (n !== 3) {
|
|
2274
|
-
let r =
|
|
2275
|
-
|
|
2402
|
+
let r = c[e];
|
|
2403
|
+
if (!r) continue;
|
|
2404
|
+
let a = xn(r), l = s[e];
|
|
2405
|
+
n === 0 ? i.update?.(a, l, e) : i.bind?.(a, l, e), n === 1 && (i.onAdd?.(a), t.removingKeys.delete(o[e]), W.domUpdated(V.LIST, a, "list.add", l));
|
|
2276
2406
|
}
|
|
2277
2407
|
}
|
|
2278
2408
|
}
|
|
2279
|
-
|
|
2409
|
+
//#endregion
|
|
2410
|
+
//#region src/bindings/list/index.ts
|
|
2411
|
+
var Mn = /* @__PURE__ */ new WeakMap(), Nn = new it(() => /* @__PURE__ */ new Map(), (e) => e.clear()), Pn = new it(() => /* @__PURE__ */ new Set(), (e) => e.clear()), $ = new rt(100, 1024), Fn = {
|
|
2412
|
+
map: Nn,
|
|
2413
|
+
set: Pn,
|
|
2414
|
+
array: $
|
|
2415
|
+
};
|
|
2416
|
+
function In(t, n) {
|
|
2280
2417
|
let r = typeof n.key == "function" ? n.key : (e) => e[n.key], i = {
|
|
2281
2418
|
bind: n.bind,
|
|
2282
2419
|
update: n.update,
|
|
@@ -2287,20 +2424,20 @@ e.fn.atomList = function(t, n) {
|
|
|
2287
2424
|
for (let a = 0, o = this.length; a < o; a++) {
|
|
2288
2425
|
let o = this[a], s = e(o);
|
|
2289
2426
|
s.off(".atomList");
|
|
2290
|
-
let c =
|
|
2427
|
+
let c = Mn.get(o);
|
|
2291
2428
|
c && (c.fx.dispose(), c.ctx.dispose());
|
|
2292
|
-
let l = new
|
|
2429
|
+
let l = new wn(s, Le(o), n.onRemove), u = R(() => {
|
|
2293
2430
|
let e = t.value, a = e.length;
|
|
2294
2431
|
k(() => {
|
|
2295
|
-
if (
|
|
2296
|
-
|
|
2297
|
-
let t =
|
|
2298
|
-
if (
|
|
2299
|
-
|
|
2432
|
+
if (On(l, a, s, n.empty, $), a === 0) return;
|
|
2433
|
+
W.log(V.LIST, `${l.containerSelector} updating with ${a} items`);
|
|
2434
|
+
let t = Tn(l, e, a, r, n.update, n.isEqual, Fn), c = kn(t, n, l.oldKeys.length === 0);
|
|
2435
|
+
if (An(l, t), jn(l, t, o, i, c), n.events) for (let e = t.startIndex; e <= t.oldEndIndex; e++) t.newKeySet.has(l.oldKeys[e]) || l.keyToIndex.delete(l.oldKeys[e]);
|
|
2436
|
+
$.release(l.oldKeys), $.release(l.oldItems), $.release(l.oldNodes), l.oldKeys = t.newKeys, l.oldItems = t.newItems, l.oldNodes = t.newNodes, Pn.release(t.newKeySet), $.release(t.trKeys), $.release(t.trItems), $.release(t.trIdxs);
|
|
2300
2437
|
});
|
|
2301
2438
|
});
|
|
2302
2439
|
if (l.fx = u, n.events) for (let e in n.events) {
|
|
2303
|
-
if (!
|
|
2440
|
+
if (!B.call(n.events, e)) continue;
|
|
2304
2441
|
let t = e.indexOf(" "), r = t === -1 ? e : e.slice(0, t), i = t === -1 ? "> *" : e.slice(t + 1).trim(), a = n.events[e];
|
|
2305
2442
|
s.on(`${r}.atomList`, i, function(e) {
|
|
2306
2443
|
let t = e.target.closest?.("[data-atom-key]"), n = t?.getAttribute("data-atom-key");
|
|
@@ -2314,58 +2451,60 @@ e.fn.atomList = function(t, n) {
|
|
|
2314
2451
|
i !== void 0 && a.call(t, l.oldItems[i], i, e);
|
|
2315
2452
|
});
|
|
2316
2453
|
}
|
|
2317
|
-
|
|
2454
|
+
K.trackEffect(o, u), Mn.set(o, {
|
|
2318
2455
|
fx: u,
|
|
2319
2456
|
ctx: l
|
|
2320
|
-
}),
|
|
2321
|
-
l.dispose(),
|
|
2457
|
+
}), K.trackCleanup(o, () => {
|
|
2458
|
+
l.dispose(), Mn.delete(o);
|
|
2322
2459
|
});
|
|
2323
2460
|
}
|
|
2324
2461
|
return this;
|
|
2325
|
-
}
|
|
2462
|
+
}
|
|
2463
|
+
e.fn.atomList = In;
|
|
2326
2464
|
//#endregion
|
|
2327
2465
|
//#region src/bindings/mount.ts
|
|
2328
|
-
var
|
|
2466
|
+
var Ln = Object.freeze({});
|
|
2329
2467
|
e.fn.atomMount = function(t, n) {
|
|
2330
|
-
let r = n ??
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
} catch (e) {
|
|
2339
|
-
G.error(H.MOUNT, W.MOUNT.ERROR(i), e);
|
|
2340
|
-
}
|
|
2468
|
+
let r = n ?? Ln, i = t.name || "Component";
|
|
2469
|
+
return J(this, (n, a) => {
|
|
2470
|
+
K.cleanupTree(a);
|
|
2471
|
+
try {
|
|
2472
|
+
let n = k(() => xe(() => t(e(a), r)));
|
|
2473
|
+
typeof n == "function" && K.setComponentCleanup(a, n);
|
|
2474
|
+
} catch (e) {
|
|
2475
|
+
W.error(V.MOUNT, H.MOUNT.ERROR(i), e);
|
|
2341
2476
|
}
|
|
2342
|
-
}
|
|
2343
|
-
return this;
|
|
2477
|
+
});
|
|
2344
2478
|
}, e.fn.atomUnmount = function() {
|
|
2345
|
-
|
|
2346
|
-
let t = this[e];
|
|
2347
|
-
t && Qt(t);
|
|
2348
|
-
}
|
|
2349
|
-
return this;
|
|
2479
|
+
return J(this, (e, t) => gn(t));
|
|
2350
2480
|
};
|
|
2351
2481
|
//#endregion
|
|
2352
2482
|
//#region src/features/route.ts
|
|
2353
|
-
function
|
|
2483
|
+
function Rn(e, t) {
|
|
2354
2484
|
try {
|
|
2355
2485
|
history.pushState(e, "", t);
|
|
2356
2486
|
} catch (e) {
|
|
2357
|
-
|
|
2487
|
+
W.warn(V.ROUTE, "PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.", e);
|
|
2358
2488
|
}
|
|
2359
2489
|
}
|
|
2360
|
-
var
|
|
2490
|
+
var zn = class {
|
|
2491
|
+
parseQueryParams(e) {
|
|
2492
|
+
let t = {};
|
|
2493
|
+
return e && new URLSearchParams(e).forEach((e, n) => {
|
|
2494
|
+
t[n] = e;
|
|
2495
|
+
}), t;
|
|
2496
|
+
}
|
|
2361
2497
|
constructor(t) {
|
|
2362
2498
|
this.isDestroyed = !1, this.previousRoute = "", this.cleanups = [], this.templateCache = /* @__PURE__ */ new Map(), this.routeCleanups = [], this.lastRawQuery = "", this.cachedParams = {}, this.config = {
|
|
2363
|
-
mode:
|
|
2364
|
-
basePath:
|
|
2365
|
-
autoBindLinks:
|
|
2366
|
-
activeClass:
|
|
2499
|
+
mode: ze.mode,
|
|
2500
|
+
basePath: ze.basePath,
|
|
2501
|
+
autoBindLinks: ze.autoBindLinks,
|
|
2502
|
+
activeClass: ze.activeClass,
|
|
2503
|
+
notFound: t.notFound || "",
|
|
2504
|
+
beforeTransition: t.beforeTransition || (() => {}),
|
|
2505
|
+
afterTransition: t.afterTransition || (() => {}),
|
|
2367
2506
|
...t
|
|
2368
|
-
}, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom =
|
|
2507
|
+
}, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom = Ce(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = Ce(this.getQueryParams()), this.queryParams = Oe(() => this.queryParamsAtom.value), this.init();
|
|
2369
2508
|
}
|
|
2370
2509
|
init() {
|
|
2371
2510
|
let e = this.isHistoryMode ? "popstate" : "hashchange", t = this.handleUrlChange.bind(this);
|
|
@@ -2379,47 +2518,58 @@ var hn = class {
|
|
|
2379
2518
|
this.routeCleanups.length = 0;
|
|
2380
2519
|
}), this.renderRoute(e);
|
|
2381
2520
|
});
|
|
2382
|
-
this.cleanups.push(() => n.dispose()), this.setupAutoBindLinks(), this.$target[0] &&
|
|
2521
|
+
this.cleanups.push(() => n.dispose()), this.setupAutoBindLinks(), this.$target[0] && K.trackCleanup(this.$target[0], () => this.destroy());
|
|
2383
2522
|
}
|
|
2384
2523
|
getRouteName() {
|
|
2385
2524
|
let { default: e } = this.config;
|
|
2386
2525
|
if (this.isHistoryMode) {
|
|
2387
2526
|
let t = this.basePath, n = location.pathname;
|
|
2388
|
-
return t && n.startsWith(t) && (n = n.substring(t.length)), n.replace(
|
|
2527
|
+
return t && (n === t || n.startsWith(`${t}/`)) && (n = n.substring(t.length)), n.replace(/^\/+/, "") || e;
|
|
2389
2528
|
}
|
|
2390
|
-
|
|
2529
|
+
let t = location.hash, { route: n } = this.splitPath(t.startsWith("#") ? t.substring(1) : t);
|
|
2530
|
+
return n || e;
|
|
2391
2531
|
}
|
|
2392
2532
|
getQueryParams() {
|
|
2393
|
-
let e =
|
|
2394
|
-
if (
|
|
2395
|
-
this.lastRawQuery =
|
|
2396
|
-
let
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2533
|
+
let e = this.getCurrentRawQuery();
|
|
2534
|
+
if (e === this.lastRawQuery) return this.cachedParams;
|
|
2535
|
+
this.lastRawQuery = e;
|
|
2536
|
+
let t = this.parseQueryParams(e);
|
|
2537
|
+
return this.areParamsEqual(t, this.cachedParams) ? this.cachedParams : (e.indexOf("%"), this.cachedParams = t, t);
|
|
2538
|
+
}
|
|
2539
|
+
getCurrentRawQuery() {
|
|
2540
|
+
if (this.isHistoryMode) return location.search.substring(1);
|
|
2541
|
+
let e = location.hash, t = e.indexOf("?");
|
|
2542
|
+
return t === -1 ? "" : e.substring(t + 1);
|
|
2543
|
+
}
|
|
2544
|
+
areParamsEqual(e, t) {
|
|
2545
|
+
let n = Object.keys(e);
|
|
2546
|
+
if (n.length !== Object.keys(t).length) return !1;
|
|
2547
|
+
for (let r of n) if (e[r] !== t[r]) return !1;
|
|
2548
|
+
return !0;
|
|
2549
|
+
}
|
|
2550
|
+
splitPath(e) {
|
|
2551
|
+
let t = e.indexOf("?"), n = t === -1 ? e : e.slice(0, t), r = t === -1 ? void 0 : e.slice(t + 1);
|
|
2552
|
+
return {
|
|
2553
|
+
route: n.replace(/^\/+/, ""),
|
|
2554
|
+
query: r
|
|
2555
|
+
};
|
|
2410
2556
|
}
|
|
2411
2557
|
setUrl(e) {
|
|
2412
|
-
let t = this.isHistoryMode ? `${this.basePath}/${
|
|
2413
|
-
this.isHistoryMode ?
|
|
2558
|
+
let { route: t, query: n } = this.splitPath(e), r = n ? `${t}?${n}` : t, i = this.isHistoryMode ? `${this.basePath}/${r}` : `#${r}`;
|
|
2559
|
+
this.isHistoryMode ? Rn(null, i) : location.hash = i, this.previousUrl = this.isHistoryMode ? i : location.hash;
|
|
2414
2560
|
}
|
|
2415
2561
|
restoreUrl() {
|
|
2416
|
-
|
|
2562
|
+
try {
|
|
2563
|
+
this.isHistoryMode ? history.replaceState(null, "", this.previousUrl) : location.hash = this.previousUrl;
|
|
2564
|
+
} catch (e) {
|
|
2565
|
+
W.warn(V.ROUTE, "Restore URL failed", e);
|
|
2566
|
+
}
|
|
2417
2567
|
}
|
|
2418
2568
|
renderRoute(e) {
|
|
2419
2569
|
if (this.isDestroyed || !this.$target[0]) return;
|
|
2420
2570
|
let { routes: t, notFound: n, beforeTransition: r, afterTransition: i } = this.config, a = t[e] ?? (n ? t[n] : void 0);
|
|
2421
2571
|
if (!a) {
|
|
2422
|
-
|
|
2572
|
+
W.warn(V.ROUTE, H.ROUTE.NOT_FOUND(e));
|
|
2423
2573
|
return;
|
|
2424
2574
|
}
|
|
2425
2575
|
let o = this.getQueryParams(), s = this.previousRoute;
|
|
@@ -2440,7 +2590,7 @@ var hn = class {
|
|
|
2440
2590
|
let t = document.querySelector(a.template);
|
|
2441
2591
|
if (t instanceof HTMLTemplateElement) e = t, this.templateCache.set(a.template, e);
|
|
2442
2592
|
else {
|
|
2443
|
-
|
|
2593
|
+
W.warn(V.ROUTE, H.ROUTE.TEMPLATE_NOT_FOUND(a.template));
|
|
2444
2594
|
return;
|
|
2445
2595
|
}
|
|
2446
2596
|
}
|
|
@@ -2473,31 +2623,30 @@ var hn = class {
|
|
|
2473
2623
|
let n = [], r = R(() => {
|
|
2474
2624
|
let e = this.currentRouteAtom.value, t = this.activeClass;
|
|
2475
2625
|
k(() => {
|
|
2476
|
-
let
|
|
2477
|
-
for (let e = 0; e < r; e++) {
|
|
2478
|
-
let r = n[e];
|
|
2479
|
-
r.classList.remove(t), r.removeAttribute("aria-current");
|
|
2480
|
-
}
|
|
2626
|
+
for (let e of n) e.classList.remove(t), e.removeAttribute("aria-current");
|
|
2481
2627
|
try {
|
|
2482
|
-
let r = `[data-route="${e.replace(/"/g, "\\\"")}"]`, i = Array.from(document.querySelectorAll(r))
|
|
2483
|
-
for (let e
|
|
2484
|
-
let n = i[e];
|
|
2485
|
-
n.classList.add(t), n.setAttribute("aria-current", "page");
|
|
2486
|
-
}
|
|
2628
|
+
let r = `[data-route="${e.replace(/"/g, "\\\"")}"]`, i = Array.from(document.querySelectorAll(r));
|
|
2629
|
+
for (let e of i) e.classList.add(t), e.setAttribute("aria-current", "page");
|
|
2487
2630
|
n = i;
|
|
2488
2631
|
} catch {
|
|
2489
2632
|
n = [];
|
|
2490
2633
|
}
|
|
2491
2634
|
});
|
|
2492
2635
|
});
|
|
2493
|
-
this.cleanups.push(() =>
|
|
2636
|
+
this.cleanups.push(() => {
|
|
2637
|
+
r.dispose(), n.length = 0;
|
|
2638
|
+
});
|
|
2494
2639
|
}
|
|
2495
|
-
navigate(
|
|
2640
|
+
navigate(t) {
|
|
2496
2641
|
if (this.isDestroyed) return;
|
|
2497
|
-
let
|
|
2498
|
-
if (this.config.routes[
|
|
2499
|
-
let
|
|
2500
|
-
|
|
2642
|
+
let n = this.currentRouteAtom.peek();
|
|
2643
|
+
if (this.config.routes[n]?.onLeave?.(this) === !1) return;
|
|
2644
|
+
let { route: r, query: i } = this.splitPath(t), a = r || this.config.default || "";
|
|
2645
|
+
a && e.batch(() => {
|
|
2646
|
+
this.setUrl(t);
|
|
2647
|
+
let e = i ? this.parseQueryParams(i) : {};
|
|
2648
|
+
this.areParamsEqual(e, this.queryParamsAtom.peek()) || (this.queryParamsAtom.value = e), this.currentRouteAtom.value = a;
|
|
2649
|
+
});
|
|
2501
2650
|
}
|
|
2502
2651
|
destroy() {
|
|
2503
2652
|
if (!this.isDestroyed) {
|
|
@@ -2505,44 +2654,33 @@ var hn = class {
|
|
|
2505
2654
|
for (let e of this.cleanups) try {
|
|
2506
2655
|
e();
|
|
2507
2656
|
} catch {}
|
|
2508
|
-
this.templateCache.clear();
|
|
2657
|
+
this.cleanups.length = 0, this.templateCache.clear();
|
|
2509
2658
|
}
|
|
2510
2659
|
}
|
|
2511
2660
|
};
|
|
2512
|
-
function
|
|
2513
|
-
return new
|
|
2661
|
+
function Bn(e) {
|
|
2662
|
+
return new zn(e);
|
|
2514
2663
|
}
|
|
2515
|
-
e.extend({ route:
|
|
2664
|
+
e.extend({ route: Bn });
|
|
2516
2665
|
//#endregion
|
|
2517
2666
|
//#region src/features/fetch.ts
|
|
2518
|
-
var
|
|
2667
|
+
var Vn = class {
|
|
2519
2668
|
constructor(t, n) {
|
|
2520
2669
|
this.abortController = null, this.execute = async () => {
|
|
2521
|
-
this.
|
|
2522
|
-
let
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
headers: {
|
|
2526
|
-
...this.staticOptions.headers,
|
|
2527
|
-
...n.headers
|
|
2528
|
-
},
|
|
2529
|
-
url: this.isStaticUrl ? this.staticUrl : this.getUrl(),
|
|
2530
|
-
success: void 0,
|
|
2531
|
-
error: void 0,
|
|
2532
|
-
complete: void 0
|
|
2533
|
-
}, i = e.ajax(r);
|
|
2534
|
-
t.onabort = () => i.abort(), t.aborted && i.abort();
|
|
2670
|
+
this.abort();
|
|
2671
|
+
let t = new AbortController();
|
|
2672
|
+
this.abortController = t;
|
|
2673
|
+
let { signal: n } = t, r;
|
|
2535
2674
|
try {
|
|
2536
|
-
let
|
|
2537
|
-
|
|
2675
|
+
let t = this.prepareSettings(), i = e.ajax(t);
|
|
2676
|
+
r = () => i.abort(), n.addEventListener("abort", r), n.aborted && i.abort();
|
|
2677
|
+
let a = await i;
|
|
2678
|
+
return this.transformFn ? this.transformFn(a) : a;
|
|
2538
2679
|
} catch (e) {
|
|
2539
|
-
if (
|
|
2540
|
-
let e = /* @__PURE__ */ Error("AbortError");
|
|
2541
|
-
throw e.name = "AbortError", e;
|
|
2542
|
-
}
|
|
2680
|
+
if (n.aborted) throw this.createAbortError();
|
|
2543
2681
|
return this.handleError(e);
|
|
2544
2682
|
} finally {
|
|
2545
|
-
|
|
2683
|
+
r && n.removeEventListener("abort", r), this.abortController === t && (this.abortController = null);
|
|
2546
2684
|
}
|
|
2547
2685
|
};
|
|
2548
2686
|
let r = typeof t == "string";
|
|
@@ -2550,12 +2688,11 @@ var _n = class {
|
|
|
2550
2688
|
let i = typeof n.ajaxOptions == "object" ? n.ajaxOptions : {};
|
|
2551
2689
|
this.staticOptions = {
|
|
2552
2690
|
...i,
|
|
2553
|
-
method: n.method,
|
|
2554
2691
|
headers: {
|
|
2555
2692
|
...i?.headers,
|
|
2556
2693
|
...n.headers
|
|
2557
2694
|
}
|
|
2558
|
-
}, this.transformFn = n.transform, this.onErrorFn = n.onError;
|
|
2695
|
+
}, n.method && (this.staticOptions.method = n.method), this.transformFn = n.transform, this.onErrorFn = n.onError;
|
|
2559
2696
|
}
|
|
2560
2697
|
abort() {
|
|
2561
2698
|
this.abortController?.abort();
|
|
@@ -2571,20 +2708,41 @@ var _n = class {
|
|
|
2571
2708
|
} catch {}
|
|
2572
2709
|
throw t;
|
|
2573
2710
|
}
|
|
2711
|
+
prepareSettings() {
|
|
2712
|
+
let e = this.ajaxOptionsFn?.() ?? {};
|
|
2713
|
+
return {
|
|
2714
|
+
...this.staticOptions,
|
|
2715
|
+
...e,
|
|
2716
|
+
headers: {
|
|
2717
|
+
...this.staticOptions.headers,
|
|
2718
|
+
...e.headers
|
|
2719
|
+
},
|
|
2720
|
+
url: this.isStaticUrl ? this.staticUrl : this.getUrl(),
|
|
2721
|
+
success: void 0,
|
|
2722
|
+
error: void 0,
|
|
2723
|
+
complete: void 0
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
createAbortError() {
|
|
2727
|
+
let e = /* @__PURE__ */ Error("AbortError");
|
|
2728
|
+
return e.name = "AbortError", e;
|
|
2729
|
+
}
|
|
2574
2730
|
};
|
|
2575
2731
|
//#endregion
|
|
2576
2732
|
//#region src/index.ts
|
|
2577
2733
|
e.extend({ atomFetch(e, t) {
|
|
2578
|
-
let n = new
|
|
2734
|
+
let n = new Vn(e, t), r = Oe(n.execute, {
|
|
2579
2735
|
defaultValue: t.defaultValue,
|
|
2580
2736
|
lazy: t.eager === !1
|
|
2581
|
-
});
|
|
2582
|
-
return
|
|
2737
|
+
}), i = r.dispose.bind(r);
|
|
2738
|
+
return r.dispose = () => {
|
|
2739
|
+
n.abort(), i();
|
|
2740
|
+
}, Object.assign(r, { abort: () => n.abort() });
|
|
2583
2741
|
} }), e(() => {
|
|
2584
|
-
|
|
2742
|
+
Ct(), document.body && dt(document.body);
|
|
2585
2743
|
});
|
|
2586
|
-
var
|
|
2744
|
+
var Hn = e;
|
|
2587
2745
|
//#endregion
|
|
2588
|
-
export {
|
|
2746
|
+
export { Hn as default, ft as disableAutoCleanup, wt as disablejQueryOverrides, dt as enableAutoCleanup, Ct as enablejQueryOverrides, Fe as isReactive, nt as nextTick, K as registry };
|
|
2589
2747
|
|
|
2590
2748
|
//# sourceMappingURL=index.mjs.map
|