@jasonshimmy/custom-elements-runtime 0.1.19 → 0.1.21
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 +16 -21
- package/dist/custom-elements-runtime.cjs.js +11 -11
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +768 -748
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +12 -12
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/runtime/component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@ function gt(e, t) {
|
|
|
2
2
|
return te(e ? t : [], "when-block");
|
|
3
3
|
}
|
|
4
4
|
function yt(e, t) {
|
|
5
|
-
return e.map((r,
|
|
6
|
-
const
|
|
7
|
-
return te(t(r,
|
|
5
|
+
return e.map((r, o) => {
|
|
6
|
+
const n = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${o}` : String(r);
|
|
7
|
+
return te(t(r, o), `each-${n}`);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function ze() {
|
|
11
11
|
const e = [];
|
|
12
12
|
return {
|
|
13
13
|
when(t, r) {
|
|
@@ -17,14 +17,14 @@ function Le() {
|
|
|
17
17
|
return e.push([!0, t]), this;
|
|
18
18
|
},
|
|
19
19
|
done() {
|
|
20
|
-
return
|
|
20
|
+
return Be(...e);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Be(...e) {
|
|
25
25
|
for (let t = 0; t < e.length; t++) {
|
|
26
|
-
const [r,
|
|
27
|
-
if (r) return [te(
|
|
26
|
+
const [r, o] = e[t];
|
|
27
|
+
if (r) return [te(o, `whenChain-branch-${t}`)];
|
|
28
28
|
}
|
|
29
29
|
return [te([], "whenChain-empty")];
|
|
30
30
|
}
|
|
@@ -53,10 +53,10 @@ class F extends EventTarget {
|
|
|
53
53
|
* @param data - Optional event payload
|
|
54
54
|
*/
|
|
55
55
|
emit(t, r) {
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
this.eventCounters.set(t, { count: 1, window:
|
|
59
|
-
else if (
|
|
56
|
+
const o = Date.now(), n = this.eventCounters.get(t);
|
|
57
|
+
if (!n || o - n.window > 1e3)
|
|
58
|
+
this.eventCounters.set(t, { count: 1, window: o });
|
|
59
|
+
else if (n.count++, n.count > 50 && (console.error(`Event storm detected for "${t}": ${n.count} events in 1 second. Throttling...`), n.count > 100)) {
|
|
60
60
|
console.warn(`Blocking further "${t}" events to prevent infinite loop`);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
@@ -89,8 +89,8 @@ class F extends EventTarget {
|
|
|
89
89
|
* @param handler - Handler function to remove
|
|
90
90
|
*/
|
|
91
91
|
off(t, r) {
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const o = this.handlers[t];
|
|
93
|
+
o && o.delete(r);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Remove all handlers for a specific event.
|
|
@@ -105,8 +105,8 @@ class F extends EventTarget {
|
|
|
105
105
|
* @param handler - CustomEvent handler
|
|
106
106
|
* @param options - AddEventListener options
|
|
107
107
|
*/
|
|
108
|
-
listen(t, r,
|
|
109
|
-
return this.addEventListener(t, r,
|
|
108
|
+
listen(t, r, o) {
|
|
109
|
+
return this.addEventListener(t, r, o), () => this.removeEventListener(t, r);
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Register a one-time event handler. Returns a promise that resolves with the event data.
|
|
@@ -114,9 +114,9 @@ class F extends EventTarget {
|
|
|
114
114
|
* @param handler - Handler function
|
|
115
115
|
*/
|
|
116
116
|
once(t, r) {
|
|
117
|
-
return new Promise((
|
|
118
|
-
const
|
|
119
|
-
|
|
117
|
+
return new Promise((o) => {
|
|
118
|
+
const n = this.on(t, (s) => {
|
|
119
|
+
n(), r(s), o(s);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
}
|
|
@@ -146,9 +146,9 @@ class F extends EventTarget {
|
|
|
146
146
|
*/
|
|
147
147
|
getEventStats() {
|
|
148
148
|
const t = {};
|
|
149
|
-
for (const [r,
|
|
149
|
+
for (const [r, o] of this.eventCounters.entries())
|
|
150
150
|
t[r] = {
|
|
151
|
-
count:
|
|
151
|
+
count: o.count,
|
|
152
152
|
handlersCount: this.getHandlerCount(r)
|
|
153
153
|
};
|
|
154
154
|
return t;
|
|
@@ -161,25 +161,25 @@ class F extends EventTarget {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
const Z = F.getInstance(), mt = (e, t) => Z.emit(e, t), bt = (e, t) => Z.on(e, t), vt = (e, t) => Z.off(e, t), xt = (e, t) => Z.once(e, t), wt = (e, t, r) => Z.listen(e, t, r);
|
|
164
|
-
function
|
|
164
|
+
function xe(e) {
|
|
165
165
|
let t = { ...e };
|
|
166
166
|
const r = [];
|
|
167
|
-
function
|
|
167
|
+
function o(a) {
|
|
168
168
|
r.push(a), a(t);
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function n() {
|
|
171
171
|
return t;
|
|
172
172
|
}
|
|
173
173
|
function s(a) {
|
|
174
|
-
const
|
|
175
|
-
t = { ...t, ...
|
|
174
|
+
const l = typeof a == "function" ? a(t) : a;
|
|
175
|
+
t = { ...t, ...l }, i();
|
|
176
176
|
}
|
|
177
177
|
function i() {
|
|
178
178
|
r.forEach((a) => a(t));
|
|
179
179
|
}
|
|
180
|
-
return { subscribe:
|
|
180
|
+
return { subscribe: o, getState: n, setState: s };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function me(e) {
|
|
183
183
|
return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
184
184
|
}
|
|
185
185
|
function pe(e) {
|
|
@@ -194,135 +194,135 @@ function pe(e) {
|
|
|
194
194
|
})[t]
|
|
195
195
|
) : e;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Re(e, t, r) {
|
|
198
198
|
if (r)
|
|
199
|
-
for (const [
|
|
199
|
+
for (const [o, n] of Object.entries(r)) {
|
|
200
200
|
let s, i = {};
|
|
201
|
-
if (Array.isArray(
|
|
201
|
+
if (Array.isArray(n) ? (s = n[0], i = n[1] || {}) : s = n, t.set(o, {
|
|
202
202
|
callback: s,
|
|
203
203
|
options: i,
|
|
204
|
-
oldValue: he(e,
|
|
204
|
+
oldValue: he(e, o)
|
|
205
205
|
}), i.immediate)
|
|
206
206
|
try {
|
|
207
|
-
const a = he(e,
|
|
207
|
+
const a = he(e, o);
|
|
208
208
|
s(a, void 0, e);
|
|
209
209
|
} catch (a) {
|
|
210
|
-
console.error(`Error in immediate watcher for "${
|
|
210
|
+
console.error(`Error in immediate watcher for "${o}":`, a);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
function he(e, t) {
|
|
215
|
-
return t.split(".").reduce((r,
|
|
215
|
+
return t.split(".").reduce((r, o) => r?.[o], e);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
const
|
|
217
|
+
function Pe(e, t, r, o) {
|
|
218
|
+
const n = (i, a) => {
|
|
219
219
|
if (i === a) return !0;
|
|
220
220
|
if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
|
|
221
221
|
if (Array.isArray(i) && Array.isArray(a))
|
|
222
|
-
return i.length !== a.length ? !1 : i.every((
|
|
223
|
-
const
|
|
224
|
-
return
|
|
222
|
+
return i.length !== a.length ? !1 : i.every((d, y) => n(d, a[y]));
|
|
223
|
+
const l = Object.keys(i), f = Object.keys(a);
|
|
224
|
+
return l.length !== f.length ? !1 : l.every((d) => n(i[d], a[d]));
|
|
225
225
|
}, s = t.get(r);
|
|
226
|
-
if (s && !o
|
|
226
|
+
if (s && !n(o, s.oldValue))
|
|
227
227
|
try {
|
|
228
|
-
s.callback(
|
|
228
|
+
s.callback(o, s.oldValue, e), s.oldValue = o;
|
|
229
229
|
} catch (i) {
|
|
230
230
|
console.error(`Error in watcher for "${r}":`, i);
|
|
231
231
|
}
|
|
232
232
|
for (const [i, a] of t.entries())
|
|
233
233
|
if (a.options.deep && r.startsWith(i + "."))
|
|
234
234
|
try {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
} catch (
|
|
238
|
-
console.error(`Error in deep watcher for "${i}":`,
|
|
235
|
+
const l = he(e, i);
|
|
236
|
+
n(l, a.oldValue) || (a.callback(l, a.oldValue, e), a.oldValue = l);
|
|
237
|
+
} catch (l) {
|
|
238
|
+
console.error(`Error in deep watcher for "${i}":`, l);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Oe(e, t, r) {
|
|
242
242
|
if (!t.props) return;
|
|
243
|
-
function n
|
|
244
|
-
return s === Boolean ?
|
|
243
|
+
function o(n, s) {
|
|
244
|
+
return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
|
|
245
245
|
}
|
|
246
|
-
Object.entries(t.props).forEach(([
|
|
247
|
-
if (s.type === Function && typeof e[
|
|
248
|
-
r[
|
|
246
|
+
Object.entries(t.props).forEach(([n, s]) => {
|
|
247
|
+
if (s.type === Function && typeof e[n] == "function")
|
|
248
|
+
r[n] = e[n];
|
|
249
249
|
else {
|
|
250
|
-
const i = e.getAttribute(
|
|
251
|
-
i !== null ? r[
|
|
250
|
+
const i = e.getAttribute(me(n));
|
|
251
|
+
i !== null ? r[n] = pe(o(i, s.type)) : "default" in s && s.default !== void 0 && (r[n] = pe(s.default));
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
e.onConnected && !r && (e.onConnected(t),
|
|
255
|
+
function Me(e, t, r, o) {
|
|
256
|
+
e.onConnected && !r && (e.onConnected(t), o(!0));
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
e.onDisconnected && e.onDisconnected(t), r.forEach((
|
|
258
|
+
function We(e, t, r, o, n, s, i, a) {
|
|
259
|
+
e.onDisconnected && e.onDisconnected(t), r.forEach((l) => l()), o(), n(), s(!1), i(null), a(!1);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
e.onAttributeChanged && e.onAttributeChanged(t, r,
|
|
261
|
+
function Ne(e, t, r, o, n) {
|
|
262
|
+
e.onAttributeChanged && e.onAttributeChanged(t, r, o, n);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function q(e, t) {
|
|
265
265
|
if (t && e instanceof HTMLElement) {
|
|
266
266
|
for (const r in t)
|
|
267
267
|
t[r] === e && delete t[r];
|
|
268
268
|
for (const r of Array.from(e.childNodes))
|
|
269
|
-
|
|
269
|
+
q(r, t);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return typeof t == "string" ? t.split(".").reduce((r,
|
|
272
|
+
function H(e, t) {
|
|
273
|
+
return typeof t == "string" ? t.split(".").reduce((r, o) => r?.[o], e) : t;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
278
|
-
const s =
|
|
279
|
-
s[
|
|
275
|
+
function we(e, t, r) {
|
|
276
|
+
const o = t.split("."), n = o.pop();
|
|
277
|
+
if (!n) return;
|
|
278
|
+
const s = o.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
|
|
279
|
+
s[n] = r;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function De(e, t, r, o, n, s, i) {
|
|
282
282
|
if (!s) return;
|
|
283
|
-
const a = t.includes("lazy"),
|
|
284
|
-
const
|
|
285
|
-
return
|
|
286
|
-
},
|
|
287
|
-
let
|
|
288
|
-
const
|
|
289
|
-
if (i instanceof HTMLInputElement ?
|
|
290
|
-
if (Array.isArray(
|
|
291
|
-
const
|
|
283
|
+
const a = t.includes("lazy"), l = t.includes("trim"), f = t.includes("number"), d = () => {
|
|
284
|
+
const h = s._state || s;
|
|
285
|
+
return H(h, e);
|
|
286
|
+
}, y = d();
|
|
287
|
+
let c = "text";
|
|
288
|
+
const w = o?.type;
|
|
289
|
+
if (i instanceof HTMLInputElement ? c = w || i.type || "text" : i instanceof HTMLSelectElement ? c = "select" : i instanceof HTMLTextAreaElement && (c = "textarea"), c === "checkbox")
|
|
290
|
+
if (Array.isArray(y)) {
|
|
291
|
+
const h = i?.getAttribute("value") || o?.value || "", u = y.includes(h);
|
|
292
292
|
i && i.checked !== u && (r.checked = u);
|
|
293
293
|
} else {
|
|
294
|
-
const
|
|
294
|
+
const h = i?.getAttribute("true-value") || !0, u = y === h;
|
|
295
295
|
i && i.checked !== u && (r.checked = u);
|
|
296
296
|
}
|
|
297
|
-
else if (
|
|
298
|
-
const
|
|
297
|
+
else if (c === "radio") {
|
|
298
|
+
const h = o?.value || "", u = y === h;
|
|
299
299
|
i && i.checked !== u && (r.checked = u);
|
|
300
|
-
} else if (
|
|
300
|
+
} else if (c === "select")
|
|
301
301
|
if (i && i.hasAttribute("multiple")) {
|
|
302
|
-
const
|
|
302
|
+
const h = i, u = Array.isArray(y) ? y : [];
|
|
303
303
|
setTimeout(() => {
|
|
304
|
-
Array.from(
|
|
305
|
-
const b = u.includes(
|
|
306
|
-
|
|
304
|
+
Array.from(h.options).forEach((g) => {
|
|
305
|
+
const b = u.includes(g.value);
|
|
306
|
+
g.selected !== b && (g.selected = b);
|
|
307
307
|
});
|
|
308
308
|
}, 0);
|
|
309
309
|
} else
|
|
310
310
|
setTimeout(() => {
|
|
311
|
-
i instanceof HTMLSelectElement && i.value !== String(
|
|
311
|
+
i instanceof HTMLSelectElement && i.value !== String(y) && (i.value = String(y));
|
|
312
312
|
}, 0);
|
|
313
313
|
else {
|
|
314
|
-
const
|
|
315
|
-
(!i || i.value !==
|
|
314
|
+
const h = String(y ?? "");
|
|
315
|
+
(!i || i.value !== h) && (r.value = y);
|
|
316
316
|
}
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
const u =
|
|
317
|
+
const x = a || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", S = (h) => {
|
|
318
|
+
if (h.isComposing || n._isComposing || h.isTrusted === !1) return;
|
|
319
|
+
const u = h.target;
|
|
320
320
|
if (u._modelUpdating) return;
|
|
321
|
-
const
|
|
321
|
+
const g = d();
|
|
322
322
|
let b = u.value;
|
|
323
|
-
if (
|
|
324
|
-
if (Array.isArray(
|
|
325
|
-
const k = u.getAttribute("value") || "", _ = [...
|
|
323
|
+
if (c === "checkbox")
|
|
324
|
+
if (Array.isArray(g)) {
|
|
325
|
+
const k = u.getAttribute("value") || "", _ = [...g];
|
|
326
326
|
if (u.checked)
|
|
327
327
|
_.includes(k) || _.push(k);
|
|
328
328
|
else {
|
|
@@ -334,104 +334,104 @@ function Ne(e, t, r, n, o, s, i) {
|
|
|
334
334
|
const k = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
|
|
335
335
|
b = u.checked ? k : _;
|
|
336
336
|
}
|
|
337
|
-
else if (
|
|
337
|
+
else if (c === "radio")
|
|
338
338
|
b = u.getAttribute("value") || u.value;
|
|
339
|
-
else if (
|
|
339
|
+
else if (c === "select" && u.multiple) {
|
|
340
340
|
const k = u;
|
|
341
341
|
b = Array.from(k.selectedOptions).map(
|
|
342
342
|
(_) => _.value
|
|
343
343
|
);
|
|
344
|
-
} else if (
|
|
344
|
+
} else if (l && (b = b.trim()), f) {
|
|
345
345
|
const k = Number(b);
|
|
346
346
|
isNaN(k) || (b = k);
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const p = s._state || s, v = H(p, e);
|
|
349
349
|
if (Array.isArray(b) && Array.isArray(v) ? JSON.stringify([...b].sort()) !== JSON.stringify([...v].sort()) : b !== v) {
|
|
350
|
-
const k =
|
|
351
|
-
k._modelUpdating = !0,
|
|
350
|
+
const k = h.target;
|
|
351
|
+
k._modelUpdating = !0, we(p, e, b), setTimeout(() => {
|
|
352
352
|
k._modelUpdating = !1;
|
|
353
353
|
}, 0), s._requestRender && s._requestRender();
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
|
-
if (
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
}, u = (
|
|
360
|
-
|
|
361
|
-
const b =
|
|
356
|
+
if (n[x] = S, c === "text" || c === "textarea") {
|
|
357
|
+
const h = () => {
|
|
358
|
+
n._isComposing = !0;
|
|
359
|
+
}, u = (g) => {
|
|
360
|
+
n._isComposing = !1;
|
|
361
|
+
const b = g.target;
|
|
362
362
|
setTimeout(() => {
|
|
363
363
|
if (b) {
|
|
364
|
-
let
|
|
365
|
-
if (
|
|
366
|
-
const _ = Number(
|
|
367
|
-
isNaN(_) || (
|
|
364
|
+
let p = b.value;
|
|
365
|
+
if (l && (p = p.trim()), f) {
|
|
366
|
+
const _ = Number(p);
|
|
367
|
+
isNaN(_) || (p = _);
|
|
368
368
|
}
|
|
369
|
-
const v = s._state || s, m =
|
|
370
|
-
(Array.isArray(
|
|
369
|
+
const v = s._state || s, m = H(v, e);
|
|
370
|
+
(Array.isArray(p) && Array.isArray(m) ? JSON.stringify([...p].sort()) !== JSON.stringify([...m].sort()) : p !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
|
|
371
371
|
b._modelUpdating = !1;
|
|
372
|
-
}, 0)),
|
|
372
|
+
}, 0)), we(v, e, p), s._requestRender && s._requestRender());
|
|
373
373
|
}
|
|
374
374
|
}, 0);
|
|
375
375
|
};
|
|
376
|
-
|
|
376
|
+
n.compositionstart = h, n.compositionend = u;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
if (
|
|
379
|
+
function qe(e, t, r, o) {
|
|
380
|
+
if (o) {
|
|
381
381
|
if (typeof e == "object" && e !== null)
|
|
382
|
-
for (const [
|
|
383
|
-
t[
|
|
382
|
+
for (const [n, s] of Object.entries(e))
|
|
383
|
+
t[n] = s;
|
|
384
384
|
else if (typeof e == "string")
|
|
385
385
|
try {
|
|
386
|
-
const
|
|
387
|
-
if (typeof
|
|
388
|
-
for (const [s, i] of Object.entries(
|
|
386
|
+
const n = JSON.parse(e);
|
|
387
|
+
if (typeof n == "object" && n !== null) {
|
|
388
|
+
for (const [s, i] of Object.entries(n))
|
|
389
389
|
t[s] = i;
|
|
390
390
|
return;
|
|
391
391
|
}
|
|
392
392
|
} catch {
|
|
393
|
-
const
|
|
394
|
-
r[e] =
|
|
393
|
+
const n = H(o, e);
|
|
394
|
+
r[e] = n;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function He(e, t, r) {
|
|
399
399
|
if (!r) return;
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
const i =
|
|
403
|
-
(
|
|
400
|
+
const o = H(r, e), n = t.style || "", s = o ? "" : "none";
|
|
401
|
+
if (n) {
|
|
402
|
+
const i = n.split(";").filter(Boolean), a = i.findIndex(
|
|
403
|
+
(l) => l.trim().startsWith("display:")
|
|
404
404
|
);
|
|
405
405
|
a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
|
|
406
406
|
} else
|
|
407
407
|
t.style = `display: ${s}`;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function Ie(e, t, r) {
|
|
410
410
|
if (!r) return;
|
|
411
|
-
const
|
|
412
|
-
let
|
|
413
|
-
typeof
|
|
414
|
-
const s = t.class || "", i = s ? `${s} ${
|
|
411
|
+
const o = H(r, e);
|
|
412
|
+
let n = [];
|
|
413
|
+
typeof o == "string" ? n = [o] : Array.isArray(o) ? n = o.filter(Boolean) : typeof o == "object" && (n = Object.entries(o).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
|
|
414
|
+
const s = t.class || "", i = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
|
|
415
415
|
i && (t.class = i);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
let
|
|
417
|
+
function Ue(e, t, r) {
|
|
418
|
+
let o;
|
|
419
419
|
if (typeof e == "string") {
|
|
420
420
|
if (!r) return;
|
|
421
|
-
|
|
421
|
+
o = H(r, e);
|
|
422
422
|
} else
|
|
423
|
-
|
|
424
|
-
let
|
|
425
|
-
if (typeof
|
|
426
|
-
|
|
427
|
-
else if (
|
|
423
|
+
o = e;
|
|
424
|
+
let n = "";
|
|
425
|
+
if (typeof o == "string")
|
|
426
|
+
n = o;
|
|
427
|
+
else if (o && typeof o == "object") {
|
|
428
428
|
const i = [];
|
|
429
|
-
for (const [a,
|
|
430
|
-
if (
|
|
429
|
+
for (const [a, l] of Object.entries(o))
|
|
430
|
+
if (l != null && l !== "") {
|
|
431
431
|
const f = a.replace(
|
|
432
432
|
/[A-Z]/g,
|
|
433
|
-
(
|
|
434
|
-
),
|
|
433
|
+
(c) => `-${c.toLowerCase()}`
|
|
434
|
+
), d = [
|
|
435
435
|
"width",
|
|
436
436
|
"height",
|
|
437
437
|
"top",
|
|
@@ -457,24 +457,24 @@ function Ie(e, t, r) {
|
|
|
457
457
|
"min-height",
|
|
458
458
|
"max-height"
|
|
459
459
|
];
|
|
460
|
-
let
|
|
461
|
-
typeof
|
|
460
|
+
let y = String(l);
|
|
461
|
+
typeof l == "number" && d.includes(f) && (y = `${l}px`), i.push(`${f}: ${y}`);
|
|
462
462
|
}
|
|
463
|
-
|
|
463
|
+
n = i.join("; ") + (i.length > 0 ? ";" : "");
|
|
464
464
|
}
|
|
465
465
|
const s = t.style || "";
|
|
466
|
-
t.style = s + (s && !s.endsWith(";") ? "; " : "") +
|
|
466
|
+
t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
const
|
|
470
|
-
for (const [a,
|
|
471
|
-
const { value: f, modifiers:
|
|
468
|
+
function Ae(e, t, r, o) {
|
|
469
|
+
const n = {}, s = { ...o || {} }, i = {};
|
|
470
|
+
for (const [a, l] of Object.entries(e)) {
|
|
471
|
+
const { value: f, modifiers: d } = l;
|
|
472
472
|
switch (a) {
|
|
473
473
|
case "model":
|
|
474
|
-
|
|
474
|
+
De(
|
|
475
475
|
typeof f == "string" ? f : String(f),
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
d,
|
|
477
|
+
n,
|
|
478
478
|
s,
|
|
479
479
|
i,
|
|
480
480
|
t,
|
|
@@ -482,20 +482,20 @@ function Ee(e, t, r, n) {
|
|
|
482
482
|
);
|
|
483
483
|
break;
|
|
484
484
|
case "bind":
|
|
485
|
-
|
|
485
|
+
qe(f, n, s, t);
|
|
486
486
|
break;
|
|
487
487
|
case "show":
|
|
488
|
-
|
|
488
|
+
He(f, s, t);
|
|
489
489
|
break;
|
|
490
490
|
case "class":
|
|
491
|
-
|
|
491
|
+
Ie(f, s, t);
|
|
492
492
|
break;
|
|
493
493
|
case "style":
|
|
494
|
-
|
|
494
|
+
Ue(f, s, t);
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
return { props:
|
|
498
|
+
return { props: n, attrs: s, listeners: i };
|
|
499
499
|
}
|
|
500
500
|
function ge(e, t) {
|
|
501
501
|
if (Array.isArray(e)) {
|
|
@@ -504,25 +504,25 @@ function ge(e, t) {
|
|
|
504
504
|
if (!i || typeof i != "object") return i;
|
|
505
505
|
let a = i.props?.key ?? i.key;
|
|
506
506
|
if (!a) {
|
|
507
|
-
const
|
|
508
|
-
a =
|
|
507
|
+
const y = i.tag || "node", c = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
|
|
508
|
+
a = c ? `${t}:${y}:${c}` : `${t}:${y}`;
|
|
509
509
|
}
|
|
510
|
-
let
|
|
511
|
-
for (; s.has(
|
|
512
|
-
|
|
513
|
-
s.add(
|
|
514
|
-
let
|
|
515
|
-
return Array.isArray(
|
|
510
|
+
let l = a, f = 1;
|
|
511
|
+
for (; s.has(l); )
|
|
512
|
+
l = `${a}#${f++}`;
|
|
513
|
+
s.add(l);
|
|
514
|
+
let d = i.children;
|
|
515
|
+
return Array.isArray(d) && (d = ge(d, l)), { ...i, key: l, children: d };
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
518
|
const r = e;
|
|
519
|
-
let
|
|
520
|
-
return Array.isArray(
|
|
519
|
+
let o = r.props?.key ?? r.key ?? t, n = r.children;
|
|
520
|
+
return Array.isArray(n) && (n = ge(n, o)), { ...r, key: o, children: n };
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
const
|
|
524
|
-
o,
|
|
522
|
+
function Fe(e, t, r, o) {
|
|
523
|
+
const n = r.directives ?? {}, s = Ae(
|
|
525
524
|
n,
|
|
525
|
+
o,
|
|
526
526
|
e,
|
|
527
527
|
r.attrs
|
|
528
528
|
), i = {
|
|
@@ -533,115 +533,115 @@ function Ue(e, t, r, n) {
|
|
|
533
533
|
...t.attrs,
|
|
534
534
|
...r.attrs,
|
|
535
535
|
...s.attrs
|
|
536
|
-
},
|
|
537
|
-
for (const
|
|
538
|
-
const
|
|
539
|
-
|
|
536
|
+
}, l = t.props ?? {}, f = i;
|
|
537
|
+
for (const c in { ...l, ...f }) {
|
|
538
|
+
const w = l[c], x = f[c];
|
|
539
|
+
w !== x && (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== x && (e.value = x ?? "") : c === "checked" && e instanceof HTMLInputElement ? e.checked = !!x : c.startsWith("on") && typeof x == "function" ? (typeof w == "function" && e.removeEventListener(c.slice(2).toLowerCase(), w), e.addEventListener(c.slice(2).toLowerCase(), x)) : x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
|
|
540
540
|
}
|
|
541
|
-
for (const [
|
|
541
|
+
for (const [c, w] of Object.entries(
|
|
542
542
|
s.listeners || {}
|
|
543
543
|
))
|
|
544
|
-
e.addEventListener(
|
|
545
|
-
const
|
|
546
|
-
for (const
|
|
547
|
-
const
|
|
548
|
-
|
|
544
|
+
e.addEventListener(c, w);
|
|
545
|
+
const d = t.attrs ?? {}, y = a;
|
|
546
|
+
for (const c in { ...d, ...y }) {
|
|
547
|
+
const w = d[c], x = y[c];
|
|
548
|
+
w !== x && (x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
function P(e, t, r) {
|
|
552
552
|
if (typeof e == "string")
|
|
553
553
|
return document.createTextNode(e);
|
|
554
554
|
if (e.tag === "#text") {
|
|
555
|
-
const
|
|
555
|
+
const y = document.createTextNode(
|
|
556
556
|
typeof e.children == "string" ? e.children : ""
|
|
557
557
|
);
|
|
558
|
-
return e.key != null && (
|
|
558
|
+
return e.key != null && (y.key = e.key), y;
|
|
559
559
|
}
|
|
560
560
|
if (e.tag === "#anchor") {
|
|
561
|
-
const
|
|
562
|
-
|
|
561
|
+
const y = e, c = Array.isArray(y.children) ? y.children : [], w = document.createTextNode(""), x = document.createTextNode("");
|
|
562
|
+
y.key != null && (w.key = `${y.key}:start`, x.key = `${y.key}:end`), y._startNode = w, y._endNode = x;
|
|
563
563
|
const S = document.createDocumentFragment();
|
|
564
|
-
S.appendChild(
|
|
565
|
-
for (const
|
|
566
|
-
const u = P(
|
|
564
|
+
S.appendChild(w);
|
|
565
|
+
for (const h of c) {
|
|
566
|
+
const u = P(h, t);
|
|
567
567
|
S.appendChild(u);
|
|
568
568
|
}
|
|
569
|
-
return S.appendChild(
|
|
569
|
+
return S.appendChild(x), S;
|
|
570
570
|
}
|
|
571
|
-
const
|
|
572
|
-
e.key != null && (
|
|
573
|
-
const { props:
|
|
574
|
-
...
|
|
571
|
+
const o = document.createElement(e.tag);
|
|
572
|
+
e.key != null && (o.key = e.key);
|
|
573
|
+
const { props: n = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = Ae(i, t, o, s), l = {
|
|
574
|
+
...n,
|
|
575
575
|
...a.props
|
|
576
576
|
}, f = {
|
|
577
577
|
...s,
|
|
578
578
|
...a.attrs
|
|
579
579
|
};
|
|
580
|
-
for (const
|
|
581
|
-
const
|
|
582
|
-
if (typeof
|
|
583
|
-
typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:",
|
|
580
|
+
for (const y in f) {
|
|
581
|
+
const c = f[y];
|
|
582
|
+
if (typeof y != "string" || /\[object Object\]/.test(y)) {
|
|
583
|
+
typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", y, c);
|
|
584
584
|
continue;
|
|
585
585
|
}
|
|
586
|
-
typeof
|
|
586
|
+
typeof c == "boolean" ? c && o.setAttribute(y, "") : c != null && o.setAttribute(y, c);
|
|
587
587
|
}
|
|
588
|
-
for (const
|
|
589
|
-
const
|
|
590
|
-
if (typeof
|
|
591
|
-
typeof window < "u" && window.console && console.warn("Skipping invalid prop key:",
|
|
588
|
+
for (const y in l) {
|
|
589
|
+
const c = l[y];
|
|
590
|
+
if (typeof y != "string" || /\[object Object\]/.test(y)) {
|
|
591
|
+
typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", y, c);
|
|
592
592
|
continue;
|
|
593
593
|
}
|
|
594
|
-
if (
|
|
595
|
-
|
|
596
|
-
else if (
|
|
597
|
-
|
|
598
|
-
else if (
|
|
599
|
-
|
|
594
|
+
if (y === "value" && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement))
|
|
595
|
+
o.value = c ?? "";
|
|
596
|
+
else if (y === "checked" && o instanceof HTMLInputElement)
|
|
597
|
+
o.checked = !!c;
|
|
598
|
+
else if (y.startsWith("on") && typeof c == "function")
|
|
599
|
+
o.addEventListener(y.slice(2).toLowerCase(), c);
|
|
600
600
|
else {
|
|
601
|
-
if (
|
|
601
|
+
if (y.startsWith("on") && c === void 0)
|
|
602
602
|
continue;
|
|
603
|
-
|
|
603
|
+
c == null || c === !1 ? o.removeAttribute(y) : o.setAttribute(y, String(c));
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
for (const [
|
|
606
|
+
for (const [y, c] of Object.entries(
|
|
607
607
|
a.listeners || {}
|
|
608
608
|
))
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
if (typeof e != "string" &&
|
|
612
|
-
for (const
|
|
613
|
-
|
|
614
|
-
else typeof e.children == "string" && (
|
|
615
|
-
return
|
|
609
|
+
o.addEventListener(y, c);
|
|
610
|
+
const d = e.props?.ref ?? (e.props?.props && e.props.props.ref);
|
|
611
|
+
if (typeof e != "string" && d && r && (r[d] = o), Array.isArray(e.children))
|
|
612
|
+
for (const y of e.children)
|
|
613
|
+
o.appendChild(P(y, t, r));
|
|
614
|
+
else typeof e.children == "string" && (o.textContent = e.children);
|
|
615
|
+
return o;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function Ke(e, t, r, o, n) {
|
|
618
618
|
if (typeof r == "string") {
|
|
619
619
|
e.textContent !== r && (e.textContent = r);
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
622
|
if (!Array.isArray(r)) return;
|
|
623
623
|
const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
|
|
624
|
-
for (const
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
for (const
|
|
628
|
-
const
|
|
629
|
-
|
|
624
|
+
for (const w of i)
|
|
625
|
+
w && w.key != null && a.set(w.key, w);
|
|
626
|
+
const l = /* @__PURE__ */ new Map();
|
|
627
|
+
for (const w of s) {
|
|
628
|
+
const x = w.key;
|
|
629
|
+
x != null && l.set(x, w);
|
|
630
630
|
}
|
|
631
631
|
const f = /* @__PURE__ */ new Set();
|
|
632
|
-
let
|
|
633
|
-
function
|
|
634
|
-
let S =
|
|
635
|
-
for (; S && (f.add(S), S !==
|
|
632
|
+
let d = e.firstChild;
|
|
633
|
+
function y(w, x) {
|
|
634
|
+
let S = w;
|
|
635
|
+
for (; S && (f.add(S), S !== x); )
|
|
636
636
|
S = S.nextSibling;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function c(w, x, S, h) {
|
|
639
639
|
const u = [];
|
|
640
|
-
let
|
|
641
|
-
for (;
|
|
642
|
-
u.push(
|
|
640
|
+
let g = w.nextSibling;
|
|
641
|
+
for (; g && g !== x; )
|
|
642
|
+
u.push(g), g = g.nextSibling;
|
|
643
643
|
const b = Array.isArray(S) ? S : [];
|
|
644
|
-
if (
|
|
644
|
+
if (h.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
|
|
645
645
|
const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
646
646
|
for (const C of b)
|
|
647
647
|
C && C.key != null && v.set(C.key, C);
|
|
@@ -650,8 +650,8 @@ function Fe(e, t, r, n, o) {
|
|
|
650
650
|
E != null && m.set(E, C);
|
|
651
651
|
}
|
|
652
652
|
const k = /* @__PURE__ */ new Set();
|
|
653
|
-
let _ =
|
|
654
|
-
for (const C of
|
|
653
|
+
let _ = w.nextSibling;
|
|
654
|
+
for (const C of h) {
|
|
655
655
|
let E;
|
|
656
656
|
if (C.key != null && m.has(C.key)) {
|
|
657
657
|
const j = v.get(C.key);
|
|
@@ -659,10 +659,10 @@ function Fe(e, t, r, n, o) {
|
|
|
659
659
|
m.get(C.key),
|
|
660
660
|
j,
|
|
661
661
|
C,
|
|
662
|
-
|
|
662
|
+
o
|
|
663
663
|
), k.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
|
|
664
664
|
} else
|
|
665
|
-
E = P(C,
|
|
665
|
+
E = P(C, o), e.insertBefore(E, _), k.add(E);
|
|
666
666
|
_ = E.nextSibling;
|
|
667
667
|
}
|
|
668
668
|
for (const C of u)
|
|
@@ -670,57 +670,57 @@ function Fe(e, t, r, n, o) {
|
|
|
670
670
|
} else {
|
|
671
671
|
const v = Math.min(
|
|
672
672
|
b.length,
|
|
673
|
-
|
|
673
|
+
h.length
|
|
674
674
|
);
|
|
675
675
|
for (let m = 0; m < v; m++) {
|
|
676
|
-
const k = b[m], _ =
|
|
676
|
+
const k = b[m], _ = h[m], C = Y(u[m], k, _, o);
|
|
677
677
|
C !== u[m] && (e.insertBefore(C, u[m]), e.removeChild(u[m]));
|
|
678
678
|
}
|
|
679
|
-
for (let m = v; m <
|
|
680
|
-
e.insertBefore(P(
|
|
679
|
+
for (let m = v; m < h.length; m++)
|
|
680
|
+
e.insertBefore(P(h[m], o), x);
|
|
681
681
|
for (let m = v; m < u.length; m++)
|
|
682
682
|
e.removeChild(u[m]);
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
for (const
|
|
686
|
-
let
|
|
687
|
-
if (
|
|
688
|
-
const S =
|
|
689
|
-
let
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
e.insertBefore(
|
|
693
|
-
for (const v of
|
|
694
|
-
e.insertBefore(P(v,
|
|
695
|
-
e.insertBefore(b,
|
|
685
|
+
for (const w of r) {
|
|
686
|
+
let x;
|
|
687
|
+
if (w.tag === "#anchor") {
|
|
688
|
+
const S = w.key, h = `${S}:start`, u = `${S}:end`;
|
|
689
|
+
let g = l.get(h), b = l.get(u);
|
|
690
|
+
const p = Array.isArray(w.children) ? w.children : [];
|
|
691
|
+
if (g || (g = document.createTextNode(""), g.key = h), b || (b = document.createTextNode(""), b.key = u), w._startNode = g, w._endNode = b, !e.contains(g) || !e.contains(b)) {
|
|
692
|
+
e.insertBefore(g, d);
|
|
693
|
+
for (const v of p)
|
|
694
|
+
e.insertBefore(P(v, o), d);
|
|
695
|
+
e.insertBefore(b, d);
|
|
696
696
|
} else
|
|
697
|
-
|
|
698
|
-
|
|
697
|
+
c(
|
|
698
|
+
g,
|
|
699
699
|
b,
|
|
700
700
|
a.get(S)?.children,
|
|
701
|
-
|
|
701
|
+
p
|
|
702
702
|
);
|
|
703
|
-
g
|
|
703
|
+
y(g, b), d = b.nextSibling;
|
|
704
704
|
continue;
|
|
705
705
|
}
|
|
706
|
-
if (
|
|
707
|
-
const S = a.get(
|
|
708
|
-
|
|
709
|
-
|
|
706
|
+
if (w.key != null && l.has(w.key)) {
|
|
707
|
+
const S = a.get(w.key);
|
|
708
|
+
x = Y(
|
|
709
|
+
l.get(w.key),
|
|
710
710
|
S,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
), f.add(
|
|
711
|
+
w,
|
|
712
|
+
o,
|
|
713
|
+
n
|
|
714
|
+
), f.add(x), x !== d && e.contains(x) && (d && !e.contains(d) && (d = null), e.insertBefore(x, d));
|
|
715
715
|
} else
|
|
716
|
-
|
|
717
|
-
|
|
716
|
+
x = P(w, o, n), d && !e.contains(d) && (d = null), e.insertBefore(x, d), f.add(x);
|
|
717
|
+
d = x.nextSibling;
|
|
718
718
|
}
|
|
719
|
-
for (const
|
|
720
|
-
!f.has(
|
|
719
|
+
for (const w of s)
|
|
720
|
+
!f.has(w) && e.contains(w) && (q(w, n), e.removeChild(w));
|
|
721
721
|
}
|
|
722
|
-
function Y(e, t, r,
|
|
723
|
-
if (t && typeof t != "string" && t.props?.ref &&
|
|
722
|
+
function Y(e, t, r, o, n) {
|
|
723
|
+
if (t && typeof t != "string" && t.props?.ref && n && q(e, n), t === r) return e;
|
|
724
724
|
if (typeof r == "string") {
|
|
725
725
|
if (e.nodeType === Node.TEXT_NODE)
|
|
726
726
|
return e.textContent !== r && (e.textContent = r), e;
|
|
@@ -730,78 +730,78 @@ function Y(e, t, r, n, o) {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
if (r && typeof r != "string" && r.tag === "#anchor") {
|
|
733
|
-
const i = r, a = Array.isArray(i.children) ? i.children : [],
|
|
734
|
-
i.key != null && (
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
for (const
|
|
738
|
-
const
|
|
739
|
-
|
|
733
|
+
const i = r, a = Array.isArray(i.children) ? i.children : [], l = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
|
|
734
|
+
i.key != null && (l.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = l, i._endNode = f;
|
|
735
|
+
const d = document.createDocumentFragment();
|
|
736
|
+
d.appendChild(l);
|
|
737
|
+
for (const y of a) {
|
|
738
|
+
const c = P(y, o);
|
|
739
|
+
d.appendChild(c);
|
|
740
740
|
}
|
|
741
|
-
return
|
|
741
|
+
return d.appendChild(f), e.parentNode?.replaceChild(d, e), l;
|
|
742
742
|
}
|
|
743
743
|
if (!r) {
|
|
744
|
-
|
|
744
|
+
q(e, n);
|
|
745
745
|
const i = document.createComment("removed");
|
|
746
746
|
return e.parentNode?.replaceChild(i, e), i;
|
|
747
747
|
}
|
|
748
748
|
if (!t || typeof t == "string") {
|
|
749
|
-
|
|
750
|
-
const i = P(r,
|
|
751
|
-
return typeof r != "string" && r.props?.ref &&
|
|
749
|
+
q(e, n);
|
|
750
|
+
const i = P(r, o, n);
|
|
751
|
+
return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
|
|
752
752
|
}
|
|
753
753
|
if (r.tag === "#anchor") {
|
|
754
|
-
const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""),
|
|
755
|
-
r.key != null && (a.key = `${r.key}:start`,
|
|
754
|
+
const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), l = r._endNode ?? document.createTextNode("");
|
|
755
|
+
r.key != null && (a.key = `${r.key}:start`, l.key = `${r.key}:end`), r._startNode = a, r._endNode = l;
|
|
756
756
|
const f = document.createDocumentFragment();
|
|
757
757
|
f.appendChild(a);
|
|
758
|
-
for (const
|
|
759
|
-
f.appendChild(P(
|
|
760
|
-
return f.appendChild(
|
|
758
|
+
for (const d of i)
|
|
759
|
+
f.appendChild(P(d, o));
|
|
760
|
+
return f.appendChild(l), e.parentNode?.replaceChild(f, e), a;
|
|
761
761
|
}
|
|
762
762
|
if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
|
|
763
763
|
const i = e;
|
|
764
|
-
return
|
|
764
|
+
return Fe(i, t.props || {}, r.props || {}, o), Ke(i, t.children, r.children, o, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), i;
|
|
765
765
|
}
|
|
766
|
-
|
|
767
|
-
const s = P(r,
|
|
768
|
-
return typeof r != "string" && r.props?.ref &&
|
|
766
|
+
q(e, n);
|
|
767
|
+
const s = P(r, o, n);
|
|
768
|
+
return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
let
|
|
772
|
-
Array.isArray(t) ? t.length === 1 ? (
|
|
770
|
+
function Ve(e, t, r, o) {
|
|
771
|
+
let n;
|
|
772
|
+
Array.isArray(t) ? t.length === 1 ? (n = t[0], n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })) : n = { tag: "div", key: "__root__", children: t } : (n = t, n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })), n && typeof n == "object" && n.tag === "#anchor" && (n = {
|
|
773
773
|
tag: "div",
|
|
774
774
|
key: "__anchor_root__",
|
|
775
775
|
props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
|
|
776
|
-
children: [
|
|
777
|
-
}),
|
|
776
|
+
children: [n]
|
|
777
|
+
}), n = ge(n, String(n.key ?? "root"));
|
|
778
778
|
const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
|
|
779
779
|
let a;
|
|
780
|
-
s && i ? typeof s != "string" && typeof
|
|
781
|
-
const
|
|
780
|
+
s && i ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = Y(i, s, n, r, o) : (a = P(n, r, o), e.replaceChild(a, i)) : (a = P(n, r, o), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
|
|
781
|
+
const l = [];
|
|
782
782
|
for (let f = 0; f < e.childNodes.length; f++) {
|
|
783
|
-
const
|
|
784
|
-
|
|
783
|
+
const d = e.childNodes[f];
|
|
784
|
+
d !== a && d.nodeName !== "STYLE" && (q(d, o), l.push(d));
|
|
785
785
|
}
|
|
786
|
-
|
|
786
|
+
l.forEach((f) => e.removeChild(f)), e._prevVNode = n, e._prevDom = a;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Te(e, ...t) {
|
|
789
789
|
let r = "";
|
|
790
|
-
for (let
|
|
791
|
-
r += e[
|
|
790
|
+
for (let o = 0; o < e.length; o++)
|
|
791
|
+
r += e[o], o < t.length && (r += t[o]);
|
|
792
792
|
return r;
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function je(e) {
|
|
795
795
|
return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
|
|
796
796
|
}
|
|
797
797
|
let Q = null;
|
|
798
|
-
function
|
|
799
|
-
return Q || (Q = new CSSStyleSheet(), Q.replaceSync(
|
|
798
|
+
function ke() {
|
|
799
|
+
return Q || (Q = new CSSStyleSheet(), Q.replaceSync(je(Ze))), Q;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Je(e) {
|
|
802
802
|
return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
|
|
803
803
|
}
|
|
804
|
-
const
|
|
804
|
+
const Ze = Te`
|
|
805
805
|
:host, *, ::before, ::after {
|
|
806
806
|
all: isolate;
|
|
807
807
|
box-sizing: border-box;
|
|
@@ -859,7 +859,7 @@ const Je = Ae`
|
|
|
859
859
|
sup { top: -.5em }
|
|
860
860
|
[disabled], [aria-disabled=true] { cursor: not-allowed }
|
|
861
861
|
[hidden] { display: none }
|
|
862
|
-
`,
|
|
862
|
+
`, Qe = {
|
|
863
863
|
gray: {
|
|
864
864
|
50: "var(--color-gray-50, #f9fafb)",
|
|
865
865
|
100: "var(--color-gray-100, #f3f4f6)",
|
|
@@ -1175,7 +1175,7 @@ const Je = Ae`
|
|
|
1175
1175
|
"z-30": "z-index:30;",
|
|
1176
1176
|
"z-40": "z-index:40;",
|
|
1177
1177
|
"z-50": "z-index:50;"
|
|
1178
|
-
},
|
|
1178
|
+
}, Xe = "0.25rem", $e = {
|
|
1179
1179
|
m: ["margin"],
|
|
1180
1180
|
mx: ["margin-inline"],
|
|
1181
1181
|
my: ["margin-block"],
|
|
@@ -1208,19 +1208,19 @@ const Je = Ae`
|
|
|
1208
1208
|
"gap-y": ["row-gap"]
|
|
1209
1209
|
};
|
|
1210
1210
|
function R(e, t) {
|
|
1211
|
-
let r = 0,
|
|
1212
|
-
for (let
|
|
1213
|
-
const s = e[
|
|
1211
|
+
let r = 0, o = 0;
|
|
1212
|
+
for (let n = 0; n < e.length; n++) {
|
|
1213
|
+
const s = e[n];
|
|
1214
1214
|
if (s === "[") r++;
|
|
1215
1215
|
else if (s === "]" && r > 0) r--;
|
|
1216
|
-
else if (s === "(")
|
|
1217
|
-
else if (s === ")" &&
|
|
1218
|
-
else if (r === 0 &&
|
|
1219
|
-
return e.slice(0,
|
|
1216
|
+
else if (s === "(") o++;
|
|
1217
|
+
else if (s === ")" && o > 0) o--;
|
|
1218
|
+
else if (r === 0 && o === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
|
|
1219
|
+
return e.slice(0, n) + t + e.slice(n);
|
|
1220
1220
|
}
|
|
1221
1221
|
return e + t;
|
|
1222
1222
|
}
|
|
1223
|
-
const
|
|
1223
|
+
const Ye = {
|
|
1224
1224
|
before: (e, t) => `${e}::before{${t}}`,
|
|
1225
1225
|
after: (e, t) => `${e}::after{${t}}`,
|
|
1226
1226
|
hover: (e, t) => `${R(e, ":hover")}{${t}}`,
|
|
@@ -1254,21 +1254,21 @@ const Xe = {
|
|
|
1254
1254
|
dark: "(prefers-color-scheme: dark)"
|
|
1255
1255
|
}, le = ["sm", "md", "lg", "xl", "2xl"];
|
|
1256
1256
|
function ce(e) {
|
|
1257
|
-
const t = e.startsWith("-"),
|
|
1258
|
-
if (
|
|
1259
|
-
const
|
|
1260
|
-
if (Number.isNaN(i) ||
|
|
1257
|
+
const t = e.startsWith("-"), o = (t ? e.slice(1) : e).split("-");
|
|
1258
|
+
if (o.length < 2) return null;
|
|
1259
|
+
const n = o.slice(0, -1).join("-"), s = o[o.length - 1], i = parseFloat(s);
|
|
1260
|
+
if (Number.isNaN(i) || !$e[n]) return null;
|
|
1261
1261
|
const a = t ? "-" : "";
|
|
1262
|
-
return
|
|
1262
|
+
return $e[n].map((l) => `${l}:calc(${a}${Xe} * ${i});`).join("");
|
|
1263
1263
|
}
|
|
1264
|
-
function
|
|
1265
|
-
const t = e.replace("#", ""), r = parseInt(t, 16),
|
|
1266
|
-
return `${
|
|
1264
|
+
function Se(e) {
|
|
1265
|
+
const t = e.replace("#", ""), r = parseInt(t, 16), o = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
|
|
1266
|
+
return `${o} ${n} ${s}`;
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function Ge(e) {
|
|
1269
1269
|
const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
|
|
1270
1270
|
if (!t) return null;
|
|
1271
|
-
const [, r,
|
|
1271
|
+
const [, r, o, n = "DEFAULT"] = t, s = Qe[o]?.[n];
|
|
1272
1272
|
return s ? `${{
|
|
1273
1273
|
bg: "background-color",
|
|
1274
1274
|
decoration: "text-decoration-color",
|
|
@@ -1283,33 +1283,33 @@ function Ye(e) {
|
|
|
1283
1283
|
stroke: "stroke-color"
|
|
1284
1284
|
}[r]}:${s};` : null;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function et(e) {
|
|
1287
1287
|
const [t, r] = e.split("/");
|
|
1288
1288
|
if (!r) return { base: t };
|
|
1289
|
-
const
|
|
1290
|
-
return isNaN(
|
|
1289
|
+
const o = parseInt(r, 10);
|
|
1290
|
+
return isNaN(o) || o < 0 || o > 100 ? { base: t } : { base: t, opacity: o / 100 };
|
|
1291
1291
|
}
|
|
1292
1292
|
function fe(e) {
|
|
1293
|
-
const { base: t, opacity: r } =
|
|
1294
|
-
if (
|
|
1293
|
+
const { base: t, opacity: r } = et(e), o = Ge(t);
|
|
1294
|
+
if (o) {
|
|
1295
1295
|
if (r !== void 0) {
|
|
1296
|
-
const s = /#([0-9a-f]{6})/i.exec(
|
|
1296
|
+
const s = /#([0-9a-f]{6})/i.exec(o);
|
|
1297
1297
|
if (s) {
|
|
1298
|
-
const i =
|
|
1299
|
-
return
|
|
1298
|
+
const i = Se(s[0]);
|
|
1299
|
+
return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
return
|
|
1302
|
+
return o;
|
|
1303
1303
|
}
|
|
1304
|
-
const
|
|
1305
|
-
if (
|
|
1306
|
-
const s = /#([0-9a-f]{6})/i.exec(
|
|
1304
|
+
const n = G(t);
|
|
1305
|
+
if (n && r !== void 0) {
|
|
1306
|
+
const s = /#([0-9a-f]{6})/i.exec(n);
|
|
1307
1307
|
if (s) {
|
|
1308
|
-
const i =
|
|
1309
|
-
return
|
|
1308
|
+
const i = Se(s[0]);
|
|
1309
|
+
return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
return
|
|
1312
|
+
return n;
|
|
1313
1313
|
}
|
|
1314
1314
|
function ue(e) {
|
|
1315
1315
|
const t = /^opacity-(\d{1,3})$/.exec(e);
|
|
@@ -1319,19 +1319,19 @@ function ue(e) {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
function G(e) {
|
|
1321
1321
|
if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1324
|
-
const s =
|
|
1325
|
-
let i =
|
|
1322
|
+
const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
|
|
1323
|
+
if (n) {
|
|
1324
|
+
const s = n[1].trim();
|
|
1325
|
+
let i = n[2].trim();
|
|
1326
1326
|
return i = i.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), i = i.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${i};`;
|
|
1327
1327
|
}
|
|
1328
1328
|
return null;
|
|
1329
1329
|
}
|
|
1330
1330
|
const t = e.indexOf("-["), r = e.endsWith("]");
|
|
1331
1331
|
if (t > 0 && r) {
|
|
1332
|
-
const
|
|
1333
|
-
let
|
|
1334
|
-
|
|
1332
|
+
const o = e.slice(0, t);
|
|
1333
|
+
let n = e.slice(t + 2, -1);
|
|
1334
|
+
n = n.replace(/_/g, " ");
|
|
1335
1335
|
const s = {
|
|
1336
1336
|
bg: "background-color",
|
|
1337
1337
|
text: "color",
|
|
@@ -1372,14 +1372,14 @@ function G(e) {
|
|
|
1372
1372
|
leading: "line-height",
|
|
1373
1373
|
z: "z-index"
|
|
1374
1374
|
};
|
|
1375
|
-
if (
|
|
1376
|
-
return `transform:rotate(${
|
|
1377
|
-
const i = s[
|
|
1378
|
-
if (i &&
|
|
1375
|
+
if (o === "rotate")
|
|
1376
|
+
return `transform:rotate(${n});`;
|
|
1377
|
+
const i = s[o] ?? o.replace(/_/g, "-");
|
|
1378
|
+
if (i && n) return `${i}:${n};`;
|
|
1379
1379
|
}
|
|
1380
1380
|
return null;
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1382
|
+
function tt(e) {
|
|
1383
1383
|
if (e.startsWith("[") && e.endsWith("]")) {
|
|
1384
1384
|
const r = e.slice(1, -1);
|
|
1385
1385
|
return r.includes("&") ? r : e;
|
|
@@ -1391,44 +1391,44 @@ function et(e) {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
return null;
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function rt(e) {
|
|
1395
1395
|
return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function nt(e) {
|
|
1398
1398
|
const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
|
|
1399
|
-
let
|
|
1400
|
-
for (;
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1399
|
+
let o;
|
|
1400
|
+
for (; o = t.exec(e); ) {
|
|
1401
|
+
const n = o[2].split(/\s+/).filter(Boolean);
|
|
1402
|
+
n.length && r.push(...n);
|
|
1403
1403
|
}
|
|
1404
1404
|
return r.filter(Boolean);
|
|
1405
1405
|
}
|
|
1406
|
-
const
|
|
1407
|
-
function
|
|
1408
|
-
const t = Date.now(), r =
|
|
1409
|
-
if (r && t - r.timestamp <
|
|
1410
|
-
const
|
|
1411
|
-
function
|
|
1412
|
-
const
|
|
1413
|
-
if (
|
|
1414
|
-
const b =
|
|
1415
|
-
return f[
|
|
1416
|
-
}
|
|
1417
|
-
function
|
|
1418
|
-
const u =
|
|
1419
|
-
return
|
|
1420
|
-
}
|
|
1421
|
-
function
|
|
1406
|
+
const _e = /* @__PURE__ */ new Map(), ot = 16;
|
|
1407
|
+
function it(e) {
|
|
1408
|
+
const t = Date.now(), r = _e.get(e);
|
|
1409
|
+
if (r && t - r.timestamp < ot) return r.css;
|
|
1410
|
+
const o = nt(e), n = new Set(o), s = [], i = [], a = [], l = [], f = {};
|
|
1411
|
+
function d(h, u = !1) {
|
|
1412
|
+
const g = (u ? "dark|" : "") + h;
|
|
1413
|
+
if (g in f) return f[g];
|
|
1414
|
+
const b = x(h, u);
|
|
1415
|
+
return f[g] = b, b;
|
|
1416
|
+
}
|
|
1417
|
+
function y(h) {
|
|
1418
|
+
const u = h.some((b) => le.includes(b)), g = h.includes("dark");
|
|
1419
|
+
return h.length === 0 ? 1 : !u && !g ? 2 : u && !g ? 3 : 4;
|
|
1420
|
+
}
|
|
1421
|
+
function c(h) {
|
|
1422
1422
|
const u = [];
|
|
1423
|
-
let
|
|
1424
|
-
for (let v = 0; v <
|
|
1425
|
-
const m =
|
|
1426
|
-
m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ?
|
|
1423
|
+
let g = "", b = 0, p = 0;
|
|
1424
|
+
for (let v = 0; v < h.length; v++) {
|
|
1425
|
+
const m = h[v];
|
|
1426
|
+
m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? p++ : m === ")" && p > 0 && p--, m === ":" && b === 0 && p === 0 ? (u.push(g), g = "") : g += m;
|
|
1427
1427
|
}
|
|
1428
|
-
return
|
|
1428
|
+
return g && u.push(g), u;
|
|
1429
1429
|
}
|
|
1430
|
-
function
|
|
1431
|
-
switch (
|
|
1430
|
+
function w(h) {
|
|
1431
|
+
switch (h) {
|
|
1432
1432
|
case "hover":
|
|
1433
1433
|
return ":hover";
|
|
1434
1434
|
case "focus":
|
|
@@ -1457,40 +1457,40 @@ function ot(e) {
|
|
|
1457
1457
|
return null;
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
function
|
|
1461
|
-
const
|
|
1462
|
-
(
|
|
1463
|
-
let b = !1,
|
|
1464
|
-
if (!
|
|
1465
|
-
const v =
|
|
1460
|
+
function x(h, u = !1) {
|
|
1461
|
+
const g = c(h);
|
|
1462
|
+
(h.includes("mask-image") || h.includes("sm: hover") || h.includes("sm:hover") || h.includes("mask.svg")) && console.error("DEBUG generateRule:", h, g);
|
|
1463
|
+
let b = !1, p = g.find(($) => ($.startsWith("!") && (b = !0, $ = $.slice(1)), se[$] || ce($) || ue($) || fe($) || G($)));
|
|
1464
|
+
if (!p) return null;
|
|
1465
|
+
const v = p.replace(/^!/, ""), m = se[v] ?? ce(v) ?? ue(v) ?? fe(v) ?? G(v);
|
|
1466
1466
|
if (!m) return null;
|
|
1467
|
-
const k =
|
|
1468
|
-
let _ = k >= 0 ?
|
|
1467
|
+
const k = g.indexOf(p);
|
|
1468
|
+
let _ = k >= 0 ? g.slice(0, k) : [];
|
|
1469
1469
|
u && (_ = _.filter(($) => $ !== "dark"));
|
|
1470
|
-
const C = `.${
|
|
1470
|
+
const C = `.${rt(h)}`, E = "__SUBJECT__", j = b ? m.replace(/;$/, " !important;") : m;
|
|
1471
1471
|
let A = E;
|
|
1472
1472
|
const re = [];
|
|
1473
1473
|
for (const $ of _)
|
|
1474
1474
|
$.startsWith("group-") ? (A = `.group:${$.slice(6)} ${A}`, re.push($)) : $.startsWith("peer-") && (A = A.replace(E, `.peer:${$.slice(5)}~${E}`), re.push($));
|
|
1475
1475
|
_ = _.filter(($) => !re.includes($));
|
|
1476
|
-
const ne = [],
|
|
1476
|
+
const ne = [], be = [];
|
|
1477
1477
|
let N = null;
|
|
1478
1478
|
for (const $ of _) {
|
|
1479
1479
|
if ($ === "dark" || le.includes($)) continue;
|
|
1480
|
-
const M =
|
|
1480
|
+
const M = tt($);
|
|
1481
1481
|
if (M) {
|
|
1482
1482
|
N = M;
|
|
1483
1483
|
continue;
|
|
1484
1484
|
}
|
|
1485
|
-
const L =
|
|
1485
|
+
const L = w($);
|
|
1486
1486
|
if (L) {
|
|
1487
|
-
N ?
|
|
1487
|
+
N ? be.push(L) : ne.push(L);
|
|
1488
1488
|
continue;
|
|
1489
1489
|
}
|
|
1490
|
-
const B =
|
|
1490
|
+
const B = Ye[$];
|
|
1491
1491
|
typeof B == "function" && (A = B(A, j).split("{")[0]);
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Le($, M) {
|
|
1494
1494
|
if (!M) return $;
|
|
1495
1495
|
let L = 0, B = 0;
|
|
1496
1496
|
if ($.length && ($[0] === ">" || $[0] === "+" || $[0] === "~" || $[0] === " ")) {
|
|
@@ -1510,14 +1510,14 @@ function ot(e) {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
return $ + M;
|
|
1512
1512
|
}
|
|
1513
|
-
const oe = ne.join(""), K =
|
|
1513
|
+
const oe = ne.join(""), K = be.join("");
|
|
1514
1514
|
if (N)
|
|
1515
1515
|
if (N.includes("&")) {
|
|
1516
1516
|
const $ = N.indexOf("&"), M = N.slice(0, $), L = N.slice($ + 1), B = E + oe, T = A;
|
|
1517
1517
|
if (ne.length === 0)
|
|
1518
1518
|
A = T.replace(E, M + B + K + L);
|
|
1519
1519
|
else {
|
|
1520
|
-
const z =
|
|
1520
|
+
const z = Le(L, K);
|
|
1521
1521
|
A = T.replace(E, M + B + z);
|
|
1522
1522
|
}
|
|
1523
1523
|
} else
|
|
@@ -1526,102 +1526,114 @@ function ot(e) {
|
|
|
1526
1526
|
A = E + oe + K;
|
|
1527
1527
|
A = A.replace(new RegExp(E, "g"), C);
|
|
1528
1528
|
let O = `${A}{${j}}`;
|
|
1529
|
-
const ie = _.filter(($) => le.includes($)),
|
|
1530
|
-
return u &&
|
|
1529
|
+
const ie = _.filter(($) => le.includes($)), I = ie.length ? ie[ie.length - 1] : null, ve = _.includes("dark");
|
|
1530
|
+
return u && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : u ? O = `@media (prefers-color-scheme: dark){${O}}` : ve && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : ve ? O = `@media (prefers-color-scheme: dark){${O}}` : I && (O = `@media ${ae[I]}{${O}}`), O;
|
|
1531
1531
|
}
|
|
1532
|
-
for (const
|
|
1533
|
-
const u =
|
|
1532
|
+
for (const h of n) {
|
|
1533
|
+
const u = c(h), g = u.find(
|
|
1534
1534
|
(m) => se[m] || ce(m) || ue(m) || fe(m) || G(m)
|
|
1535
1535
|
);
|
|
1536
|
-
if (!
|
|
1537
|
-
const b = u.indexOf(
|
|
1536
|
+
if (!g) continue;
|
|
1537
|
+
const b = u.indexOf(g), p = b >= 0 ? u.slice(0, b) : [], v = y(p);
|
|
1538
1538
|
if (v === 4) {
|
|
1539
|
-
const m =
|
|
1540
|
-
m &&
|
|
1539
|
+
const m = d(h, !0);
|
|
1540
|
+
m && l.push(m);
|
|
1541
1541
|
} else {
|
|
1542
|
-
const m =
|
|
1542
|
+
const m = d(h);
|
|
1543
1543
|
m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
|
-
const S = [...s, ...i, ...a, ...
|
|
1547
|
-
return
|
|
1546
|
+
const S = [...s, ...i, ...a, ...l].join("");
|
|
1547
|
+
return _e.set(e, { css: S, timestamp: t }), S;
|
|
1548
1548
|
}
|
|
1549
1549
|
const J = [];
|
|
1550
|
-
function
|
|
1550
|
+
function st(e, t, r, o, n, s, i, a) {
|
|
1551
1551
|
if (e) {
|
|
1552
1552
|
J.push(r);
|
|
1553
1553
|
try {
|
|
1554
1554
|
if (t.loadingTemplate && r.isLoading) {
|
|
1555
|
-
|
|
1555
|
+
U(e, t.loadingTemplate(r), r, o, n);
|
|
1556
1556
|
return;
|
|
1557
1557
|
}
|
|
1558
1558
|
if (t.errorTemplate && r.hasError) {
|
|
1559
|
-
r.error instanceof Error &&
|
|
1559
|
+
r.error instanceof Error && U(e, t.errorTemplate(r.error, r), r, o, n);
|
|
1560
1560
|
return;
|
|
1561
1561
|
}
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1564
|
-
s(!0),
|
|
1565
|
-
s(!1), i(null),
|
|
1562
|
+
const l = t.render(r);
|
|
1563
|
+
if (l instanceof Promise) {
|
|
1564
|
+
s(!0), l.then((f) => {
|
|
1565
|
+
s(!1), i(null), U(e, f, r, o, n), a(e.innerHTML);
|
|
1566
1566
|
}).catch((f) => {
|
|
1567
|
-
s(!1), i(f), t.errorTemplate &&
|
|
1568
|
-
}), t.loadingTemplate &&
|
|
1567
|
+
s(!1), i(f), t.errorTemplate && U(e, t.errorTemplate(f, r), r, o, n);
|
|
1568
|
+
}), t.loadingTemplate && U(e, t.loadingTemplate(r), r, o, n);
|
|
1569
1569
|
return;
|
|
1570
1570
|
}
|
|
1571
|
-
|
|
1571
|
+
U(e, l, r, o, n), a(e.innerHTML);
|
|
1572
1572
|
} finally {
|
|
1573
1573
|
J.pop();
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1578
|
-
e && (
|
|
1577
|
+
function U(e, t, r, o, n) {
|
|
1578
|
+
e && (Ve(
|
|
1579
1579
|
e,
|
|
1580
1580
|
Array.isArray(t) ? t : [t],
|
|
1581
1581
|
r,
|
|
1582
|
-
|
|
1583
|
-
),
|
|
1582
|
+
o
|
|
1583
|
+
), n(e.innerHTML));
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function at(e, t, r, o, n, s, i) {
|
|
1586
1586
|
if (s !== null && clearTimeout(s), Date.now() - t < 16) {
|
|
1587
|
-
if (
|
|
1587
|
+
if (n(r + 1), r > 10) {
|
|
1588
1588
|
console.warn("Potential infinite render loop detected. Skipping render."), i(null);
|
|
1589
1589
|
return;
|
|
1590
1590
|
}
|
|
1591
1591
|
} else
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1592
|
+
n(0);
|
|
1593
|
+
const l = setTimeout(() => {
|
|
1594
|
+
o(Date.now()), e(), i(null);
|
|
1595
1595
|
}, 0);
|
|
1596
|
-
i(
|
|
1596
|
+
i(l);
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1598
|
+
function lt(e, t, r, o, n, s) {
|
|
1599
1599
|
if (!e) return;
|
|
1600
|
-
const i =
|
|
1600
|
+
const i = it(o);
|
|
1601
1601
|
if (!t.style && (!i || i.trim() === "")) {
|
|
1602
|
-
s(null), e.adoptedStyleSheets = [
|
|
1602
|
+
s(null), e.adoptedStyleSheets = [ke()];
|
|
1603
1603
|
return;
|
|
1604
1604
|
}
|
|
1605
1605
|
let a = "";
|
|
1606
1606
|
t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
|
|
1607
|
-
let
|
|
1607
|
+
let l = Je(`${a}
|
|
1608
1608
|
${i}
|
|
1609
1609
|
`);
|
|
1610
|
-
|
|
1611
|
-
let f =
|
|
1612
|
-
f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !==
|
|
1613
|
-
}
|
|
1614
|
-
const
|
|
1615
|
-
function
|
|
1616
|
-
let
|
|
1617
|
-
|
|
1618
|
-
let
|
|
1619
|
-
typeof t == "function" ?
|
|
1620
|
-
console.error(`[${
|
|
1621
|
-
}),
|
|
1610
|
+
l = je(l);
|
|
1611
|
+
let f = n;
|
|
1612
|
+
f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== l) && f.replaceSync(l), e.adoptedStyleSheets = [ke(), f], s(f);
|
|
1613
|
+
}
|
|
1614
|
+
const ye = /* @__PURE__ */ new Map();
|
|
1615
|
+
function Ce(e, t, r) {
|
|
1616
|
+
let o = me(e);
|
|
1617
|
+
o.includes("-") || (o = `cer-${o}`);
|
|
1618
|
+
let n;
|
|
1619
|
+
if (typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, i) => {
|
|
1620
|
+
console.error(`[${o}] Error:`, s, i);
|
|
1621
|
+
}), ye.set(o, n), typeof window < "u")
|
|
1622
|
+
if (!customElements.get(o))
|
|
1623
|
+
customElements.define(o, ct(o, n));
|
|
1624
|
+
else
|
|
1625
|
+
try {
|
|
1626
|
+
document.querySelectorAll(o).forEach((s) => {
|
|
1627
|
+
try {
|
|
1628
|
+
typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
|
|
1629
|
+
} catch {
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
} catch {
|
|
1633
|
+
}
|
|
1622
1634
|
}
|
|
1623
|
-
function ct(e) {
|
|
1624
|
-
if (!
|
|
1635
|
+
function ct(e, t) {
|
|
1636
|
+
if (!t.render)
|
|
1625
1637
|
throw new Error(
|
|
1626
1638
|
"Component must have a render function"
|
|
1627
1639
|
);
|
|
@@ -1664,63 +1676,65 @@ function ct(e) {
|
|
|
1664
1676
|
_templateLoading = !1;
|
|
1665
1677
|
_templateError = null;
|
|
1666
1678
|
constructor() {
|
|
1667
|
-
super(), this.attachShadow({ mode: "open" }), this._cfg = e;
|
|
1668
|
-
const
|
|
1669
|
-
Object.defineProperty(
|
|
1679
|
+
super(), this.attachShadow({ mode: "open" }), this._cfg = ye.get(e) || t;
|
|
1680
|
+
const r = this._initContext(t);
|
|
1681
|
+
Object.defineProperty(r, "refs", {
|
|
1670
1682
|
value: this._refs,
|
|
1671
1683
|
writable: !1,
|
|
1672
1684
|
enumerable: !1,
|
|
1673
1685
|
configurable: !1
|
|
1674
|
-
}), Object.defineProperty(
|
|
1686
|
+
}), Object.defineProperty(r, "requestRender", {
|
|
1675
1687
|
value: () => this.requestRender(),
|
|
1676
1688
|
writable: !1,
|
|
1677
1689
|
enumerable: !1,
|
|
1678
1690
|
configurable: !1
|
|
1679
|
-
}), this.context =
|
|
1680
|
-
value: (
|
|
1691
|
+
}), this.context = r, this._applyProps(t), Object.defineProperty(this.context, "emit", {
|
|
1692
|
+
value: (n, s, i) => {
|
|
1681
1693
|
this.dispatchEvent(
|
|
1682
|
-
new CustomEvent(
|
|
1683
|
-
detail:
|
|
1694
|
+
new CustomEvent(n, {
|
|
1695
|
+
detail: s,
|
|
1684
1696
|
bubbles: !0,
|
|
1685
1697
|
composed: !0,
|
|
1686
|
-
...
|
|
1698
|
+
...i || {}
|
|
1687
1699
|
})
|
|
1688
1700
|
);
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1701
|
+
const a = `on${n.charAt(0).toUpperCase()}${n.slice(1)}`, l = typeof this[a] == "function" ? this[a] : void 0, f = typeof this.context[a] == "function" ? this.context[a] : void 0, d = typeof t[a] == "function" ? t[a] : void 0;
|
|
1702
|
+
l && l(s, this.context), f && f !== l && f(s, this.context), d && d !== l && d !== f && d(s, this.context);
|
|
1691
1703
|
},
|
|
1692
1704
|
writable: !1,
|
|
1693
1705
|
enumerable: !1,
|
|
1694
1706
|
configurable: !1
|
|
1695
|
-
})
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1707
|
+
});
|
|
1708
|
+
const o = ye.get(e) || t;
|
|
1709
|
+
Object.keys(o).forEach((n) => {
|
|
1710
|
+
const s = o[n];
|
|
1711
|
+
if (typeof s == "function" && !n.startsWith("on"))
|
|
1712
|
+
this.context[n] = (...i) => s(...i, this.context);
|
|
1713
|
+
else if (n.startsWith("on") && n.length > 2 && n[2] === n[2].toUpperCase()) {
|
|
1714
|
+
const i = n.slice(2, 3).toLowerCase() + n.slice(3);
|
|
1715
|
+
this.addEventListener(i, (a) => {
|
|
1716
|
+
const l = typeof this[n] == "function" ? this[n] : this.context[n];
|
|
1717
|
+
typeof l == "function" && l(a.detail, this.context);
|
|
1704
1718
|
});
|
|
1705
1719
|
}
|
|
1706
|
-
}), this._applyComputed(
|
|
1720
|
+
}), this._applyComputed(o), this._initializing = !1, this._initWatchers(o), this._render(o);
|
|
1707
1721
|
}
|
|
1708
1722
|
connectedCallback() {
|
|
1709
|
-
this._runLogicWithinErrorBoundary(
|
|
1710
|
-
|
|
1711
|
-
|
|
1723
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1724
|
+
Me(
|
|
1725
|
+
t,
|
|
1712
1726
|
this.context,
|
|
1713
1727
|
this._mounted,
|
|
1714
|
-
(
|
|
1715
|
-
this._mounted =
|
|
1728
|
+
(r) => {
|
|
1729
|
+
this._mounted = r;
|
|
1716
1730
|
}
|
|
1717
1731
|
);
|
|
1718
1732
|
});
|
|
1719
1733
|
}
|
|
1720
1734
|
disconnectedCallback() {
|
|
1721
|
-
this._runLogicWithinErrorBoundary(
|
|
1722
|
-
|
|
1723
|
-
|
|
1735
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1736
|
+
We(
|
|
1737
|
+
t,
|
|
1724
1738
|
this.context,
|
|
1725
1739
|
this._listeners,
|
|
1726
1740
|
() => {
|
|
@@ -1729,39 +1743,39 @@ function ct(e) {
|
|
|
1729
1743
|
() => {
|
|
1730
1744
|
this._watchers.clear();
|
|
1731
1745
|
},
|
|
1732
|
-
(
|
|
1733
|
-
this._templateLoading =
|
|
1746
|
+
(r) => {
|
|
1747
|
+
this._templateLoading = r;
|
|
1734
1748
|
},
|
|
1735
|
-
(
|
|
1736
|
-
this._templateError =
|
|
1749
|
+
(r) => {
|
|
1750
|
+
this._templateError = r;
|
|
1737
1751
|
},
|
|
1738
|
-
(
|
|
1739
|
-
this._mounted =
|
|
1752
|
+
(r) => {
|
|
1753
|
+
this._mounted = r;
|
|
1740
1754
|
}
|
|
1741
1755
|
);
|
|
1742
1756
|
});
|
|
1743
1757
|
}
|
|
1744
|
-
attributeChangedCallback(
|
|
1745
|
-
this._runLogicWithinErrorBoundary(
|
|
1746
|
-
this._applyProps(
|
|
1747
|
-
e,
|
|
1758
|
+
attributeChangedCallback(r, o, n) {
|
|
1759
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1760
|
+
this._applyProps(t), Ne(
|
|
1748
1761
|
t,
|
|
1749
1762
|
r,
|
|
1763
|
+
o,
|
|
1750
1764
|
n,
|
|
1751
1765
|
this.context
|
|
1752
1766
|
);
|
|
1753
1767
|
});
|
|
1754
1768
|
}
|
|
1755
1769
|
static get observedAttributes() {
|
|
1756
|
-
return
|
|
1770
|
+
return t.props ? Object.keys(t.props).map(me) : [];
|
|
1757
1771
|
}
|
|
1758
|
-
_applyComputed(
|
|
1759
|
-
this._runLogicWithinErrorBoundary(
|
|
1760
|
-
|
|
1761
|
-
Object.defineProperty(this.context,
|
|
1772
|
+
_applyComputed(r) {
|
|
1773
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1774
|
+
r.computed && Object.entries(r.computed).forEach(([o, n]) => {
|
|
1775
|
+
Object.defineProperty(this.context, o, {
|
|
1762
1776
|
get: () => {
|
|
1763
|
-
const
|
|
1764
|
-
return pe(
|
|
1777
|
+
const s = n(this.context);
|
|
1778
|
+
return pe(s);
|
|
1765
1779
|
},
|
|
1766
1780
|
enumerable: !0
|
|
1767
1781
|
});
|
|
@@ -1769,23 +1783,23 @@ function ct(e) {
|
|
|
1769
1783
|
});
|
|
1770
1784
|
}
|
|
1771
1785
|
// --- Render ---
|
|
1772
|
-
_render(
|
|
1773
|
-
this._runLogicWithinErrorBoundary(
|
|
1774
|
-
|
|
1786
|
+
_render(r) {
|
|
1787
|
+
this._runLogicWithinErrorBoundary(r, () => {
|
|
1788
|
+
st(
|
|
1775
1789
|
this.shadowRoot,
|
|
1776
|
-
|
|
1790
|
+
r,
|
|
1777
1791
|
this.context,
|
|
1778
1792
|
this._refs,
|
|
1779
|
-
(
|
|
1780
|
-
this._lastHtmlStringForJitCSS =
|
|
1793
|
+
(o) => {
|
|
1794
|
+
this._lastHtmlStringForJitCSS = o, typeof this.onHtmlStringUpdate == "function" && this.onHtmlStringUpdate(o);
|
|
1781
1795
|
},
|
|
1782
|
-
(
|
|
1783
|
-
this._templateLoading =
|
|
1796
|
+
(o) => {
|
|
1797
|
+
this._templateLoading = o, typeof this.onLoadingStateChange == "function" && this.onLoadingStateChange(o);
|
|
1784
1798
|
},
|
|
1785
|
-
(
|
|
1786
|
-
this._templateError =
|
|
1799
|
+
(o) => {
|
|
1800
|
+
this._templateError = o, typeof this.onErrorStateChange == "function" && this.onErrorStateChange(o);
|
|
1787
1801
|
},
|
|
1788
|
-
(
|
|
1802
|
+
(o) => this._applyStyle(r, o)
|
|
1789
1803
|
);
|
|
1790
1804
|
});
|
|
1791
1805
|
}
|
|
@@ -1794,31 +1808,31 @@ function ct(e) {
|
|
|
1794
1808
|
}
|
|
1795
1809
|
_requestRender() {
|
|
1796
1810
|
this._runLogicWithinErrorBoundary(this._cfg, () => {
|
|
1797
|
-
|
|
1811
|
+
at(
|
|
1798
1812
|
() => this._render(this._cfg),
|
|
1799
1813
|
this._lastRenderTime,
|
|
1800
1814
|
this._renderCount,
|
|
1801
|
-
(
|
|
1802
|
-
this._lastRenderTime =
|
|
1815
|
+
(r) => {
|
|
1816
|
+
this._lastRenderTime = r;
|
|
1803
1817
|
},
|
|
1804
|
-
(
|
|
1805
|
-
this._renderCount =
|
|
1818
|
+
(r) => {
|
|
1819
|
+
this._renderCount = r;
|
|
1806
1820
|
},
|
|
1807
1821
|
this._renderTimeoutId,
|
|
1808
|
-
(
|
|
1809
|
-
this._renderTimeoutId =
|
|
1822
|
+
(r) => {
|
|
1823
|
+
this._renderTimeoutId = r;
|
|
1810
1824
|
}
|
|
1811
1825
|
);
|
|
1812
1826
|
});
|
|
1813
1827
|
}
|
|
1814
1828
|
// --- Style ---
|
|
1815
|
-
_applyStyle(
|
|
1816
|
-
this._runLogicWithinErrorBoundary(
|
|
1817
|
-
|
|
1829
|
+
_applyStyle(r, o) {
|
|
1830
|
+
this._runLogicWithinErrorBoundary(r, () => {
|
|
1831
|
+
lt(
|
|
1818
1832
|
this.shadowRoot,
|
|
1819
|
-
t,
|
|
1820
|
-
this.context,
|
|
1821
1833
|
r,
|
|
1834
|
+
this.context,
|
|
1835
|
+
o,
|
|
1822
1836
|
this._styleSheet,
|
|
1823
1837
|
(n) => {
|
|
1824
1838
|
this._styleSheet = n;
|
|
@@ -1827,25 +1841,25 @@ function ct(e) {
|
|
|
1827
1841
|
});
|
|
1828
1842
|
}
|
|
1829
1843
|
// --- Error Boundary function ---
|
|
1830
|
-
_runLogicWithinErrorBoundary(
|
|
1844
|
+
_runLogicWithinErrorBoundary(r, o) {
|
|
1831
1845
|
this._hasError && (this._hasError = !1);
|
|
1832
1846
|
try {
|
|
1833
|
-
|
|
1847
|
+
o();
|
|
1834
1848
|
} catch (n) {
|
|
1835
|
-
this._hasError = !0,
|
|
1849
|
+
this._hasError = !0, r.onError && r.onError(n, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(
|
|
1836
1850
|
n,
|
|
1837
1851
|
this.context
|
|
1838
1852
|
));
|
|
1839
1853
|
}
|
|
1840
1854
|
}
|
|
1841
1855
|
// --- State, props, computed ---
|
|
1842
|
-
_initContext(
|
|
1856
|
+
_initContext(r) {
|
|
1843
1857
|
try {
|
|
1844
|
-
let
|
|
1845
|
-
return Array.isArray(
|
|
1846
|
-
get(
|
|
1847
|
-
const
|
|
1848
|
-
return typeof
|
|
1858
|
+
let o = function(s, i = "") {
|
|
1859
|
+
return Array.isArray(s) ? new Proxy(s, {
|
|
1860
|
+
get(a, l, f) {
|
|
1861
|
+
const d = Reflect.get(a, l, f);
|
|
1862
|
+
return typeof d == "function" && typeof l == "string" && [
|
|
1849
1863
|
"push",
|
|
1850
1864
|
"pop",
|
|
1851
1865
|
"shift",
|
|
@@ -1853,77 +1867,77 @@ function ct(e) {
|
|
|
1853
1867
|
"splice",
|
|
1854
1868
|
"sort",
|
|
1855
1869
|
"reverse"
|
|
1856
|
-
].includes(
|
|
1857
|
-
const
|
|
1870
|
+
].includes(l) ? function(...c) {
|
|
1871
|
+
const w = d.apply(a, c);
|
|
1858
1872
|
if (!n._initializing) {
|
|
1859
|
-
const x =
|
|
1860
|
-
n._triggerWatchers(x,
|
|
1873
|
+
const x = i || "root";
|
|
1874
|
+
n._triggerWatchers(x, a), n._render(r);
|
|
1861
1875
|
}
|
|
1862
|
-
return
|
|
1863
|
-
} :
|
|
1876
|
+
return w;
|
|
1877
|
+
} : d;
|
|
1864
1878
|
},
|
|
1865
|
-
set(
|
|
1866
|
-
if (
|
|
1867
|
-
const
|
|
1868
|
-
n._triggerWatchers(
|
|
1879
|
+
set(a, l, f) {
|
|
1880
|
+
if (a[l] = f, !n._initializing) {
|
|
1881
|
+
const d = i ? `${i}.${String(l)}` : String(l);
|
|
1882
|
+
n._triggerWatchers(d, f), n._render(r);
|
|
1869
1883
|
}
|
|
1870
1884
|
return !0;
|
|
1871
1885
|
},
|
|
1872
|
-
deleteProperty(
|
|
1873
|
-
if (delete
|
|
1874
|
-
const
|
|
1875
|
-
n._triggerWatchers(
|
|
1886
|
+
deleteProperty(a, l) {
|
|
1887
|
+
if (delete a[l], !n._initializing) {
|
|
1888
|
+
const f = i ? `${i}.${String(l)}` : String(l);
|
|
1889
|
+
n._triggerWatchers(f, void 0), n._render(r);
|
|
1876
1890
|
}
|
|
1877
1891
|
return !0;
|
|
1878
1892
|
}
|
|
1879
|
-
}) :
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1882
|
-
}), new Proxy(
|
|
1883
|
-
set(
|
|
1884
|
-
const
|
|
1885
|
-
return
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
), n._render(
|
|
1893
|
+
}) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
|
|
1894
|
+
const l = i ? `${i}.${a}` : a;
|
|
1895
|
+
s[a] = o(s[a], l);
|
|
1896
|
+
}), new Proxy(s, {
|
|
1897
|
+
set(a, l, f) {
|
|
1898
|
+
const d = i ? `${i}.${String(l)}` : String(l);
|
|
1899
|
+
return a[l] = o(f, d), n._initializing || (n._triggerWatchers(
|
|
1900
|
+
d,
|
|
1901
|
+
a[l]
|
|
1902
|
+
), n._render(r)), !0;
|
|
1889
1903
|
},
|
|
1890
|
-
get(
|
|
1891
|
-
return Reflect.get(
|
|
1904
|
+
get(a, l, f) {
|
|
1905
|
+
return Reflect.get(a, l, f);
|
|
1892
1906
|
}
|
|
1893
|
-
})) :
|
|
1907
|
+
})) : s;
|
|
1894
1908
|
};
|
|
1895
1909
|
const n = this;
|
|
1896
|
-
return
|
|
1910
|
+
return o({ ...r.state });
|
|
1897
1911
|
} catch {
|
|
1898
1912
|
return {};
|
|
1899
1913
|
}
|
|
1900
1914
|
}
|
|
1901
|
-
_initWatchers(
|
|
1902
|
-
this._runLogicWithinErrorBoundary(
|
|
1903
|
-
|
|
1915
|
+
_initWatchers(r) {
|
|
1916
|
+
this._runLogicWithinErrorBoundary(r, () => {
|
|
1917
|
+
Re(
|
|
1904
1918
|
this.context,
|
|
1905
1919
|
this._watchers,
|
|
1906
|
-
|
|
1920
|
+
r.watch || {}
|
|
1907
1921
|
);
|
|
1908
1922
|
});
|
|
1909
1923
|
}
|
|
1910
|
-
_triggerWatchers(
|
|
1911
|
-
|
|
1924
|
+
_triggerWatchers(r, o) {
|
|
1925
|
+
Pe(this.context, this._watchers, r, o);
|
|
1912
1926
|
}
|
|
1913
|
-
_applyProps(
|
|
1914
|
-
this._runLogicWithinErrorBoundary(
|
|
1927
|
+
_applyProps(r) {
|
|
1928
|
+
this._runLogicWithinErrorBoundary(r, () => {
|
|
1915
1929
|
try {
|
|
1916
|
-
|
|
1917
|
-
} catch (
|
|
1918
|
-
this._hasError = !0,
|
|
1930
|
+
Oe(this, r, this.context);
|
|
1931
|
+
} catch (o) {
|
|
1932
|
+
this._hasError = !0, r.onError && r.onError(o, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(o, this.context));
|
|
1919
1933
|
}
|
|
1920
1934
|
});
|
|
1921
1935
|
}
|
|
1922
1936
|
};
|
|
1923
1937
|
}
|
|
1924
|
-
function V(e, t = {}, r,
|
|
1925
|
-
const
|
|
1926
|
-
return { tag: e, key:
|
|
1938
|
+
function V(e, t = {}, r, o) {
|
|
1939
|
+
const n = o ?? t.key;
|
|
1940
|
+
return { tag: e, key: n, props: t, children: r };
|
|
1927
1941
|
}
|
|
1928
1942
|
function ee(e) {
|
|
1929
1943
|
return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
|
|
@@ -1935,88 +1949,88 @@ function ft(e, t) {
|
|
|
1935
1949
|
return e.key != null ? e : { ...e, key: t };
|
|
1936
1950
|
}
|
|
1937
1951
|
function ut(e, t = [], r = {}) {
|
|
1938
|
-
const
|
|
1952
|
+
const o = {}, n = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
|
|
1939
1953
|
let a;
|
|
1940
1954
|
for (; a = i.exec(e); ) {
|
|
1941
|
-
const
|
|
1942
|
-
let
|
|
1943
|
-
|
|
1944
|
-
const
|
|
1945
|
-
if (
|
|
1946
|
-
const [
|
|
1947
|
-
if (
|
|
1948
|
-
const
|
|
1949
|
-
s[
|
|
1950
|
-
value:
|
|
1951
|
-
modifiers:
|
|
1955
|
+
const l = a[1], f = a[2], d = (a[4] || a[6]) ?? "", y = d.match(/^{{(\d+)}}$/);
|
|
1956
|
+
let c = y ? t[Number(y[1])] ?? null : d;
|
|
1957
|
+
y || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
|
|
1958
|
+
const w = ["model", "bind", "show", "class", "style"];
|
|
1959
|
+
if (l === ":") {
|
|
1960
|
+
const [x, ...S] = f.split(".");
|
|
1961
|
+
if (w.includes(x)) {
|
|
1962
|
+
const h = [...S];
|
|
1963
|
+
s[x] = {
|
|
1964
|
+
value: c,
|
|
1965
|
+
modifiers: h
|
|
1952
1966
|
};
|
|
1953
1967
|
} else
|
|
1954
|
-
|
|
1955
|
-
} else if (
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
} else f === "ref" ?
|
|
1968
|
+
n[f] = c;
|
|
1969
|
+
} else if (l === "@") {
|
|
1970
|
+
const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
|
|
1971
|
+
o[x] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
|
|
1972
|
+
} else f === "ref" ? o.ref = c : n[f] = c;
|
|
1959
1973
|
}
|
|
1960
|
-
return { props:
|
|
1974
|
+
return { props: o, attrs: n, directives: s };
|
|
1961
1975
|
}
|
|
1962
1976
|
function dt(e, t, r) {
|
|
1963
|
-
const
|
|
1964
|
-
function s(
|
|
1965
|
-
return V("#text", {},
|
|
1977
|
+
const o = J.length > 0 ? J[J.length - 1] : void 0, n = r ?? o;
|
|
1978
|
+
function s(p, v) {
|
|
1979
|
+
return V("#text", {}, p, v);
|
|
1966
1980
|
}
|
|
1967
1981
|
let i = "";
|
|
1968
|
-
for (let
|
|
1969
|
-
i += e[
|
|
1970
|
-
const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,
|
|
1971
|
-
let f,
|
|
1972
|
-
function p
|
|
1973
|
-
!
|
|
1974
|
-
if (v === "style" &&
|
|
1975
|
-
const m =
|
|
1982
|
+
for (let p = 0; p < e.length; p++)
|
|
1983
|
+
i += e[p], p < t.length && (i += `{{${p}}}`);
|
|
1984
|
+
const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, l = [];
|
|
1985
|
+
let f, d = [], y = null, c = {}, w, x = 0, S = [];
|
|
1986
|
+
function h(p) {
|
|
1987
|
+
!p || typeof p != "object" || ee(p) || (p.props || p.attrs ? (p.props && (c.props || (c.props = {}), Object.assign(c.props, p.props)), p.attrs && (c.attrs || (c.attrs = {}), Object.keys(p.attrs).forEach((v) => {
|
|
1988
|
+
if (v === "style" && c.attrs.style) {
|
|
1989
|
+
const m = c.attrs.style.replace(
|
|
1976
1990
|
/;?\s*$/,
|
|
1977
1991
|
""
|
|
1978
|
-
), k =
|
|
1979
|
-
|
|
1980
|
-
} else if (v === "class" &&
|
|
1981
|
-
const m =
|
|
1992
|
+
), k = p.attrs.style.replace(/^;?\s*/, "");
|
|
1993
|
+
c.attrs.style = m + "; " + k;
|
|
1994
|
+
} else if (v === "class" && c.attrs.class) {
|
|
1995
|
+
const m = c.attrs.class.trim().split(/\s+/).filter(Boolean), k = p.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
|
|
1982
1996
|
.../* @__PURE__ */ new Set([...m, ...k])
|
|
1983
1997
|
];
|
|
1984
|
-
|
|
1998
|
+
c.attrs.class = _.join(" ");
|
|
1985
1999
|
} else
|
|
1986
|
-
|
|
1987
|
-
}))) : (
|
|
1988
|
-
}
|
|
1989
|
-
function u(
|
|
1990
|
-
const m =
|
|
1991
|
-
if (ee(
|
|
1992
|
-
const k =
|
|
1993
|
-
let _ =
|
|
2000
|
+
c.attrs[v] = p.attrs[v];
|
|
2001
|
+
}))) : (c.props || (c.props = {}), Object.assign(c.props, p)));
|
|
2002
|
+
}
|
|
2003
|
+
function u(p, v) {
|
|
2004
|
+
const m = y ? d : S;
|
|
2005
|
+
if (ee(p)) {
|
|
2006
|
+
const k = p.key ?? v;
|
|
2007
|
+
let _ = p.children;
|
|
1994
2008
|
m.push({
|
|
1995
|
-
...
|
|
2009
|
+
...p,
|
|
1996
2010
|
key: k,
|
|
1997
2011
|
children: _
|
|
1998
2012
|
});
|
|
1999
2013
|
return;
|
|
2000
2014
|
}
|
|
2001
|
-
if (X(
|
|
2002
|
-
m.push(ft(
|
|
2015
|
+
if (X(p)) {
|
|
2016
|
+
m.push(ft(p, void 0));
|
|
2003
2017
|
return;
|
|
2004
2018
|
}
|
|
2005
|
-
if (Array.isArray(
|
|
2006
|
-
if (
|
|
2007
|
-
for (let k = 0; k <
|
|
2008
|
-
const _ =
|
|
2009
|
-
ee(_) || X(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ?
|
|
2019
|
+
if (Array.isArray(p)) {
|
|
2020
|
+
if (p.length === 0) return;
|
|
2021
|
+
for (let k = 0; k < p.length; k++) {
|
|
2022
|
+
const _ = p[k];
|
|
2023
|
+
ee(_) || X(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? h(_) : m.push(s(String(_), `${v}-${k}`));
|
|
2010
2024
|
}
|
|
2011
2025
|
return;
|
|
2012
2026
|
}
|
|
2013
|
-
if (
|
|
2014
|
-
p
|
|
2027
|
+
if (p !== null && typeof p == "object") {
|
|
2028
|
+
h(p);
|
|
2015
2029
|
return;
|
|
2016
2030
|
}
|
|
2017
|
-
m.push(s(String(
|
|
2031
|
+
m.push(s(String(p), v));
|
|
2018
2032
|
}
|
|
2019
|
-
const
|
|
2033
|
+
const g = /* @__PURE__ */ new Set([
|
|
2020
2034
|
"area",
|
|
2021
2035
|
"base",
|
|
2022
2036
|
"br",
|
|
@@ -2034,32 +2048,32 @@ function dt(e, t, r) {
|
|
|
2034
2048
|
]);
|
|
2035
2049
|
for (; f = a.exec(i); )
|
|
2036
2050
|
if (f[1]) {
|
|
2037
|
-
const
|
|
2051
|
+
const p = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || g.has(p), {
|
|
2038
2052
|
props: k,
|
|
2039
2053
|
attrs: _,
|
|
2040
2054
|
directives: C
|
|
2041
|
-
} = ut(f[2] || "", t,
|
|
2055
|
+
} = ut(f[2] || "", t, n), E = { props: {}, attrs: {} };
|
|
2042
2056
|
for (const j in k) E.props[j] = k[j];
|
|
2043
2057
|
for (const j in _) E.attrs[j] = _[j];
|
|
2044
2058
|
if (Object.keys(C).length > 0 && (E.directives = { ...C }), v) {
|
|
2045
2059
|
const j = V(
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
), A =
|
|
2051
|
-
A ? (
|
|
2052
|
-
} else m ?
|
|
2053
|
-
tag:
|
|
2054
|
-
props:
|
|
2055
|
-
children:
|
|
2056
|
-
key:
|
|
2057
|
-
}),
|
|
2060
|
+
y,
|
|
2061
|
+
c,
|
|
2062
|
+
d.length === 1 && X(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
|
|
2063
|
+
w
|
|
2064
|
+
), A = l.pop();
|
|
2065
|
+
A ? (y = A.tag, c = A.props, w = A.key, d = A.children, d.push(j)) : (S.push(j), y = null, c = {}, w = void 0, d = []);
|
|
2066
|
+
} else m ? y ? d.push(V(p, E, void 0, void 0)) : S.push(V(p, E, void 0, void 0)) : (y && l.push({
|
|
2067
|
+
tag: y,
|
|
2068
|
+
props: c,
|
|
2069
|
+
children: d,
|
|
2070
|
+
key: w
|
|
2071
|
+
}), y = p, c = E, d = []);
|
|
2058
2072
|
} else if (typeof f[3] < "u") {
|
|
2059
|
-
const
|
|
2073
|
+
const p = Number(f[3]), v = t[p], m = `interp-${p}`;
|
|
2060
2074
|
u(v, m);
|
|
2061
2075
|
} else if (f[4]) {
|
|
2062
|
-
const
|
|
2076
|
+
const p = f[4], v = y ? d : S, m = p.split(/({{\d+}})/);
|
|
2063
2077
|
for (const k of m) {
|
|
2064
2078
|
if (!k) continue;
|
|
2065
2079
|
const _ = k.match(/^{{(\d+)}}$/);
|
|
@@ -2067,25 +2081,25 @@ function dt(e, t, r) {
|
|
|
2067
2081
|
const C = Number(_[1]), E = t[C], j = `interp-${C}`;
|
|
2068
2082
|
u(E, j);
|
|
2069
2083
|
} else {
|
|
2070
|
-
const C = `text-${
|
|
2084
|
+
const C = `text-${x++}`;
|
|
2071
2085
|
v.push(s(k, C));
|
|
2072
2086
|
}
|
|
2073
2087
|
}
|
|
2074
2088
|
}
|
|
2075
|
-
const b = S.filter((
|
|
2089
|
+
const b = S.filter((p) => X(p) && p.tag === "#text" ? typeof p.children == "string" && p.children.trim() !== "" : !0);
|
|
2076
2090
|
return b.length === 1 ? b[0] : b.length > 1 ? b : V("div", {}, "", "fallback-root");
|
|
2077
2091
|
}
|
|
2078
|
-
function
|
|
2079
|
-
const r = t[t.length - 1],
|
|
2080
|
-
return dt(e, t,
|
|
2092
|
+
function D(e, ...t) {
|
|
2093
|
+
const r = t[t.length - 1], o = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
|
|
2094
|
+
return dt(e, t, o);
|
|
2081
2095
|
}
|
|
2082
|
-
const
|
|
2096
|
+
const Ee = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
|
|
2083
2097
|
for (const r of e) {
|
|
2084
|
-
const
|
|
2098
|
+
const o = [], n = r.path.replace(/:[^/]+/g, (a) => (o.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), i = t.match(s);
|
|
2085
2099
|
if (i) {
|
|
2086
2100
|
const a = {};
|
|
2087
|
-
return
|
|
2088
|
-
a[
|
|
2101
|
+
return o.forEach((l, f) => {
|
|
2102
|
+
a[l] = i[f + 1];
|
|
2089
2103
|
}), { route: r, params: a };
|
|
2090
2104
|
}
|
|
2091
2105
|
}
|
|
@@ -2105,99 +2119,99 @@ async function pt(e) {
|
|
|
2105
2119
|
throw new Error(`No component or loader defined for route: ${e.path}`);
|
|
2106
2120
|
}
|
|
2107
2121
|
function ht(e) {
|
|
2108
|
-
const { routes: t, base: r = "", initialUrl:
|
|
2109
|
-
let
|
|
2110
|
-
const
|
|
2111
|
-
const u = t.find((
|
|
2122
|
+
const { routes: t, base: r = "", initialUrl: o } = e;
|
|
2123
|
+
let n, s, i, a, l, f, d;
|
|
2124
|
+
const y = async (S, h) => {
|
|
2125
|
+
const u = t.find((g) => W([g], S.path).route !== null);
|
|
2112
2126
|
if (u?.beforeEnter)
|
|
2113
2127
|
try {
|
|
2114
|
-
const
|
|
2115
|
-
return typeof
|
|
2116
|
-
} catch (
|
|
2117
|
-
return console.error("beforeEnter error",
|
|
2128
|
+
const g = await u.beforeEnter(S, h);
|
|
2129
|
+
return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
|
|
2130
|
+
} catch (g) {
|
|
2131
|
+
return console.error("beforeEnter error", g), !1;
|
|
2118
2132
|
}
|
|
2119
2133
|
return !0;
|
|
2120
|
-
},
|
|
2121
|
-
const u = t.find((
|
|
2134
|
+
}, c = async (S, h) => {
|
|
2135
|
+
const u = t.find((g) => W([g], S.path).route !== null);
|
|
2122
2136
|
if (u?.onEnter)
|
|
2123
2137
|
try {
|
|
2124
|
-
const
|
|
2125
|
-
return typeof
|
|
2126
|
-
} catch (
|
|
2127
|
-
return console.error("onEnter error",
|
|
2138
|
+
const g = await u.onEnter(S, h);
|
|
2139
|
+
return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
|
|
2140
|
+
} catch (g) {
|
|
2141
|
+
return console.error("onEnter error", g), !1;
|
|
2128
2142
|
}
|
|
2129
2143
|
return !0;
|
|
2130
|
-
},
|
|
2131
|
-
const u = t.find((
|
|
2144
|
+
}, w = (S, h) => {
|
|
2145
|
+
const u = t.find((g) => W([g], S.path).route !== null);
|
|
2132
2146
|
if (u?.afterEnter)
|
|
2133
2147
|
try {
|
|
2134
|
-
u.afterEnter(S,
|
|
2135
|
-
} catch (
|
|
2136
|
-
console.error("afterEnter error",
|
|
2148
|
+
u.afterEnter(S, h);
|
|
2149
|
+
} catch (g) {
|
|
2150
|
+
console.error("afterEnter error", g);
|
|
2137
2151
|
}
|
|
2138
|
-
},
|
|
2152
|
+
}, x = async (S, h = !1) => {
|
|
2139
2153
|
try {
|
|
2140
2154
|
const u = {
|
|
2141
2155
|
path: S.replace(r, "") || "/",
|
|
2142
2156
|
query: {}
|
|
2143
|
-
},
|
|
2144
|
-
if (!
|
|
2145
|
-
const b = i.getState(),
|
|
2157
|
+
}, g = W(t, u.path);
|
|
2158
|
+
if (!g) throw new Error(`No route found for ${u.path}`);
|
|
2159
|
+
const b = i.getState(), p = {
|
|
2146
2160
|
path: u.path,
|
|
2147
|
-
params:
|
|
2161
|
+
params: g.params,
|
|
2148
2162
|
query: u.query
|
|
2149
2163
|
};
|
|
2150
|
-
if (!await
|
|
2151
|
-
typeof window < "u" && typeof document < "u" && (
|
|
2164
|
+
if (!await y(p, b) || !await c(p, b)) return;
|
|
2165
|
+
typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + S) : window.history.pushState({}, "", r + S)), i.setState(p), w(p, b);
|
|
2152
2166
|
} catch (u) {
|
|
2153
2167
|
console.error("Navigation error:", u);
|
|
2154
2168
|
}
|
|
2155
2169
|
};
|
|
2156
2170
|
if (typeof window < "u" && typeof document < "u") {
|
|
2157
|
-
|
|
2158
|
-
const
|
|
2159
|
-
return { path: u, query:
|
|
2160
|
-
}, s =
|
|
2171
|
+
n = () => {
|
|
2172
|
+
const h = new URL(window.location.href), u = h.pathname.replace(r, "") || "/", g = Ee(h.search);
|
|
2173
|
+
return { path: u, query: g };
|
|
2174
|
+
}, s = n();
|
|
2161
2175
|
const S = W(t, s.path);
|
|
2162
|
-
i =
|
|
2176
|
+
i = xe({
|
|
2163
2177
|
path: s.path,
|
|
2164
2178
|
params: S.params,
|
|
2165
2179
|
query: s.query
|
|
2166
|
-
}), a = async (
|
|
2167
|
-
const u =
|
|
2168
|
-
await
|
|
2169
|
-
}, window.addEventListener("popstate", () => a(!0)),
|
|
2180
|
+
}), a = async (h = !1) => {
|
|
2181
|
+
const u = n();
|
|
2182
|
+
await x(u.path, h);
|
|
2183
|
+
}, window.addEventListener("popstate", () => a(!0)), l = (h) => x(h, !1), f = (h) => x(h, !0), d = () => window.history.back();
|
|
2170
2184
|
} else {
|
|
2171
|
-
|
|
2172
|
-
const u = new URL(
|
|
2173
|
-
return { path:
|
|
2174
|
-
}, s =
|
|
2185
|
+
n = () => {
|
|
2186
|
+
const u = new URL(o || "/", "http://localhost"), g = u.pathname.replace(r, "") || "/", b = Ee(u.search);
|
|
2187
|
+
return { path: g, query: b };
|
|
2188
|
+
}, s = n();
|
|
2175
2189
|
const S = W(t, s.path);
|
|
2176
|
-
i =
|
|
2190
|
+
i = xe({
|
|
2177
2191
|
path: s.path,
|
|
2178
2192
|
params: S.params,
|
|
2179
2193
|
query: s.query
|
|
2180
2194
|
}), a = async () => {
|
|
2181
|
-
const u =
|
|
2182
|
-
await
|
|
2195
|
+
const u = n();
|
|
2196
|
+
await h(u.path);
|
|
2183
2197
|
};
|
|
2184
|
-
const
|
|
2198
|
+
const h = async (u) => {
|
|
2185
2199
|
try {
|
|
2186
|
-
const
|
|
2200
|
+
const g = {
|
|
2187
2201
|
path: u.replace(r, "") || "/",
|
|
2188
2202
|
query: {}
|
|
2189
|
-
}, b = W(t,
|
|
2190
|
-
if (!b) throw new Error(`No route found for ${
|
|
2191
|
-
const
|
|
2192
|
-
path:
|
|
2203
|
+
}, b = W(t, g.path);
|
|
2204
|
+
if (!b) throw new Error(`No route found for ${g.path}`);
|
|
2205
|
+
const p = i.getState(), v = {
|
|
2206
|
+
path: g.path,
|
|
2193
2207
|
params: b.params,
|
|
2194
|
-
query:
|
|
2208
|
+
query: g.query
|
|
2195
2209
|
}, m = t.find((k) => W([k], v.path).route !== null);
|
|
2196
2210
|
if (m?.beforeEnter)
|
|
2197
2211
|
try {
|
|
2198
|
-
const k = await m.beforeEnter(v,
|
|
2212
|
+
const k = await m.beforeEnter(v, p);
|
|
2199
2213
|
if (typeof k == "string") {
|
|
2200
|
-
await
|
|
2214
|
+
await h(k);
|
|
2201
2215
|
return;
|
|
2202
2216
|
}
|
|
2203
2217
|
if (k === !1) return;
|
|
@@ -2206,9 +2220,9 @@ function ht(e) {
|
|
|
2206
2220
|
}
|
|
2207
2221
|
if (m?.onEnter)
|
|
2208
2222
|
try {
|
|
2209
|
-
const k = await m.onEnter(v,
|
|
2223
|
+
const k = await m.onEnter(v, p);
|
|
2210
2224
|
if (typeof k == "string") {
|
|
2211
|
-
await
|
|
2225
|
+
await h(k);
|
|
2212
2226
|
return;
|
|
2213
2227
|
}
|
|
2214
2228
|
if (k === !1) return;
|
|
@@ -2217,20 +2231,20 @@ function ht(e) {
|
|
|
2217
2231
|
}
|
|
2218
2232
|
if (i.setState(v), m?.afterEnter)
|
|
2219
2233
|
try {
|
|
2220
|
-
m.afterEnter(v,
|
|
2234
|
+
m.afterEnter(v, p);
|
|
2221
2235
|
} catch {
|
|
2222
2236
|
}
|
|
2223
2237
|
} catch {
|
|
2224
2238
|
}
|
|
2225
2239
|
};
|
|
2226
|
-
|
|
2240
|
+
l = async (u) => h(u), f = async (u) => h(u), d = () => {
|
|
2227
2241
|
};
|
|
2228
2242
|
}
|
|
2229
2243
|
return {
|
|
2230
2244
|
store: i,
|
|
2231
|
-
push:
|
|
2245
|
+
push: l,
|
|
2232
2246
|
replace: f,
|
|
2233
|
-
back:
|
|
2247
|
+
back: d,
|
|
2234
2248
|
subscribe: i.subscribe,
|
|
2235
2249
|
matchRoute: (S) => W(t, S),
|
|
2236
2250
|
getCurrent: () => i.getState(),
|
|
@@ -2242,24 +2256,30 @@ function kt(e, t) {
|
|
|
2242
2256
|
}
|
|
2243
2257
|
function $t(e) {
|
|
2244
2258
|
const t = ht(e);
|
|
2245
|
-
return
|
|
2259
|
+
return Ce("router-view", {
|
|
2246
2260
|
async render() {
|
|
2247
|
-
if (!t) return
|
|
2248
|
-
const r = t.getCurrent(), { path:
|
|
2249
|
-
if (!
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2261
|
+
if (!t) return D`<div>Router not initialized.</div>`;
|
|
2262
|
+
const r = t.getCurrent(), { path: o } = r, n = t.matchRoute(o);
|
|
2263
|
+
if (!n.route) return D`<div>Not found</div>`;
|
|
2264
|
+
try {
|
|
2265
|
+
const s = await t.resolveRouteComponent(n.route);
|
|
2266
|
+
if (typeof s == "string")
|
|
2267
|
+
return { tag: s, props: {}, children: [] };
|
|
2268
|
+
if (typeof s == "function") {
|
|
2269
|
+
const i = s(), a = i instanceof Promise ? await i : i;
|
|
2270
|
+
return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
|
|
2271
|
+
}
|
|
2272
|
+
return D`<div>Invalid route component</div>`;
|
|
2273
|
+
} catch {
|
|
2274
|
+
return D`<div>Invalid route component</div>`;
|
|
2254
2275
|
}
|
|
2255
|
-
return typeof s == "string" ? { tag: s, props: {}, children: [] } : U`<div>Invalid route component</div>`;
|
|
2256
2276
|
},
|
|
2257
2277
|
onConnected(r) {
|
|
2258
2278
|
t && typeof t.subscribe == "function" && t.subscribe(() => {
|
|
2259
2279
|
typeof r.requestRender == "function" && r.requestRender();
|
|
2260
2280
|
});
|
|
2261
2281
|
}
|
|
2262
|
-
}),
|
|
2282
|
+
}), Ce("router-link", {
|
|
2263
2283
|
state: {},
|
|
2264
2284
|
props: {
|
|
2265
2285
|
to: { type: String, default: "" },
|
|
@@ -2272,7 +2292,7 @@ function $t(e) {
|
|
|
2272
2292
|
disabled: { type: Boolean, default: !1 },
|
|
2273
2293
|
external: { type: Boolean, default: !1 },
|
|
2274
2294
|
class: { type: String, default: "" },
|
|
2275
|
-
style: { type: String, default:
|
|
2295
|
+
style: { type: String, default: Te`
|
|
2276
2296
|
[aria-disabled="true"] {
|
|
2277
2297
|
pointer-events: none;
|
|
2278
2298
|
opacity: 0.5;
|
|
@@ -2281,64 +2301,64 @@ function $t(e) {
|
|
|
2281
2301
|
},
|
|
2282
2302
|
style: (r) => r.style,
|
|
2283
2303
|
render: (r) => {
|
|
2284
|
-
const
|
|
2285
|
-
for (const v of S)
|
|
2304
|
+
const o = t.getCurrent(), n = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, l = r.ariaCurrentValue, f = r.tag, d = r.disabled, y = r.external, c = o.path === n, w = s ? c : o && typeof o.path == "string" ? o.path.startsWith(n) : !1, x = c ? `aria-current="${l}"` : "", S = (r.class || "").split(/\s+/).filter(Boolean), h = {};
|
|
2305
|
+
for (const v of S) h[v] = !0;
|
|
2286
2306
|
const u = {
|
|
2287
|
-
...
|
|
2307
|
+
...h,
|
|
2288
2308
|
// Also include the configurable names (may duplicate the above)
|
|
2289
|
-
[a]:
|
|
2290
|
-
[i]:
|
|
2291
|
-
},
|
|
2292
|
-
return
|
|
2293
|
-
${
|
|
2309
|
+
[a]: w,
|
|
2310
|
+
[i]: c
|
|
2311
|
+
}, g = f === "button", b = d ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", p = y && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
|
|
2312
|
+
return D`
|
|
2313
|
+
${ze().when(g, D`
|
|
2294
2314
|
<button
|
|
2295
2315
|
part="button"
|
|
2296
2316
|
:class="${u}"
|
|
2297
|
-
${
|
|
2317
|
+
${x}
|
|
2298
2318
|
${b}
|
|
2299
|
-
${
|
|
2319
|
+
${p}
|
|
2300
2320
|
@click="navigate"
|
|
2301
2321
|
><slot></slot></button>
|
|
2302
|
-
`).otherwise(
|
|
2322
|
+
`).otherwise(D`
|
|
2303
2323
|
<a
|
|
2304
2324
|
part="link"
|
|
2305
|
-
href="${
|
|
2325
|
+
href="${n}"
|
|
2306
2326
|
:class="${u}"
|
|
2307
|
-
${
|
|
2327
|
+
${x}
|
|
2308
2328
|
${b}
|
|
2309
|
-
${
|
|
2329
|
+
${p}
|
|
2310
2330
|
@click="navigate"
|
|
2311
2331
|
><slot></slot></a>
|
|
2312
2332
|
`).done()}
|
|
2313
2333
|
`;
|
|
2314
2334
|
},
|
|
2315
|
-
navigate: (r,
|
|
2316
|
-
if (
|
|
2335
|
+
navigate: (r, o) => {
|
|
2336
|
+
if (o.disabled) {
|
|
2317
2337
|
r.preventDefault();
|
|
2318
2338
|
return;
|
|
2319
2339
|
}
|
|
2320
|
-
|
|
2340
|
+
o.external && (o.tag === "a" || !o.tag) || (r.preventDefault(), o.replace ? t.replace(o.to) : t.push(o.to));
|
|
2321
2341
|
}
|
|
2322
2342
|
}), t;
|
|
2323
2343
|
}
|
|
2324
2344
|
export {
|
|
2325
2345
|
F as GlobalEventBus,
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2346
|
+
Ce as component,
|
|
2347
|
+
xe as createStore,
|
|
2348
|
+
Te as css,
|
|
2329
2349
|
yt as each,
|
|
2330
2350
|
mt as emit,
|
|
2331
2351
|
Z as eventBus,
|
|
2332
|
-
|
|
2352
|
+
D as html,
|
|
2333
2353
|
$t as initRouter,
|
|
2334
2354
|
wt as listen,
|
|
2335
|
-
|
|
2355
|
+
ze as match,
|
|
2336
2356
|
W as matchRoute,
|
|
2337
2357
|
kt as matchRouteSSR,
|
|
2338
2358
|
vt as off,
|
|
2339
2359
|
bt as on,
|
|
2340
2360
|
xt as once,
|
|
2341
|
-
|
|
2361
|
+
Ee as parseQuery,
|
|
2342
2362
|
pt as resolveRouteComponent,
|
|
2343
2363
|
ht as useRouter,
|
|
2344
2364
|
gt as when
|