@threadlabs/looma 0.2.20 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-A5MSXQ7Y.js → chunk-RWLYVQY6.js} +2224 -1256
- package/dist/chunk-XDNZIKNI.js +2721 -0
- package/dist/declarative-generated.cjs +93 -79
- package/dist/declarative-generated.d.cts +7 -1
- package/dist/declarative-generated.d.ts +7 -1
- package/dist/declarative-generated.js +91 -78
- package/dist/declarative.cjs +1499 -1702
- package/dist/declarative.d.cts +77 -3
- package/dist/declarative.d.ts +77 -3
- package/dist/declarative.js +5 -3
- package/dist/index.cjs +3730 -3025
- package/dist/index.d.cts +211 -35
- package/dist/index.d.ts +211 -35
- package/dist/index.js +6 -61
- package/dist/loader.cjs +3724 -2963
- package/dist/loader.js +2 -2
- package/editor/{chunk-VAXI7Q6T.js → chunk-U36XNFJN.js} +105 -77
- package/editor/extensions/index.d.ts +272 -27
- package/editor/index.d.ts +1 -1
- package/editor/index.js +1 -1
- package/editor/{table-overlay-DoiLie4h.d.ts → table-overlay-DZFGHQDt.d.ts} +48 -6
- package/editor/ui.d.ts +15 -11
- package/editor/ui.js +1 -1
- package/layout/index.cjs +197 -340
- package/layout/index.d.cts +11 -0
- package/layout/index.d.ts +11 -0
- package/layout/index.js +197 -340
- package/layout.css +31 -134
- package/package.json +24 -11
- package/react/index.d.ts +1276 -0
- package/react/index.js +1526 -0
- package/styles.css +5 -10
- package/svelte/index.d.ts +204 -0
- package/svelte/index.js +1892 -0
- package/theme-dark.css +81 -2
- package/theme-high-contrast.css +14 -0
- package/theme-light.css +30 -1
- package/tokens.css +45 -1
- package/vue/chunk-OX3EACZ7.js +4369 -0
- package/vue/editor/index.d.ts +78 -8
- package/vue/editor/index.js +54 -49
- package/vue/index.d.ts +79 -78
- package/vue/index.js +3 -9
- package/dist/chunk-ECJQ4YGC.js +0 -2925
- package/dist/valibot.cjs +0 -31
- package/dist/valibot.d.cts +0 -10
- package/dist/valibot.d.ts +0 -10
- package/dist/valibot.js +0 -9
- package/dist/validation-bxcou-l-.d.cts +0 -58
- package/dist/validation-bxcou-l-.d.ts +0 -58
- package/vue/chunk-P7BZ2KJZ.js +0 -3559
|
@@ -0,0 +1,2721 @@
|
|
|
1
|
+
// src/declarative/runtime.js
|
|
2
|
+
var HtmlRuntime = (() => {
|
|
3
|
+
var Me = Object.defineProperty;
|
|
4
|
+
var ln = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var un = Object.getOwnPropertyNames;
|
|
6
|
+
var fn = Object.prototype.hasOwnProperty;
|
|
7
|
+
var pn = (e, t) => {
|
|
8
|
+
for (var n in t) Me(e, n, { get: t[n], enumerable: true });
|
|
9
|
+
}, mn = (e, t, n, r) => {
|
|
10
|
+
if (t && typeof t == "object" || typeof t == "function") for (let i of un(t)) !fn.call(e, i) && i !== n && Me(e, i, { get: () => t[i], enumerable: !(r = ln(t, i)) || r.enumerable });
|
|
11
|
+
return e;
|
|
12
|
+
};
|
|
13
|
+
var hn = (e) => mn(Me({}, "__esModule", { value: true }), e);
|
|
14
|
+
var Ur = {};
|
|
15
|
+
pn(Ur, { attachComponent: () => ot, attachRegisteredComponent: () => _r, getComponentHost: () => at, inspectInstance: () => Pr, installComponentGraph: () => lr, lowerDocument: () => Or, manageComponentLifecycle: () => Vr, observeDocument: () => qr, registerComponentDefinitions: () => zr, serializeRenderedForm: () => Dr, setControllerModule: () => dn, updateComponentProps: () => cn });
|
|
16
|
+
var De = class extends Error {
|
|
17
|
+
diagnostic;
|
|
18
|
+
constructor(t) {
|
|
19
|
+
let n = t.source ? `${t.source}: ` : "";
|
|
20
|
+
super(`${n}${t.code}: ${t.message}`), this.name = "HtmlDiagnosticError", this.diagnostic = Object.freeze({ ...t });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function y(e, t, n) {
|
|
24
|
+
throw new De(n === void 0 ? { code: e, message: t } : { code: e, message: t, source: n });
|
|
25
|
+
}
|
|
26
|
+
function Q(e) {
|
|
27
|
+
if (typeof e != "object" || e === null || Object.isFrozen(e)) return e;
|
|
28
|
+
for (let t of Object.values(e)) Q(t);
|
|
29
|
+
return Object.freeze(e);
|
|
30
|
+
}
|
|
31
|
+
function lt(e) {
|
|
32
|
+
let t = "", n = true;
|
|
33
|
+
for (let r of e) r === "-" ? n = true : (t += n ? r.toUpperCase() : r, n = false);
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
function Y(e) {
|
|
37
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
var yn = /* @__PURE__ */ new Set(["string", "boolean", "number", "integer", "null", "absent", "trusted-html", "trusted-script", "function", "unknown"]), ye = class extends SyntaxError {
|
|
40
|
+
constructor(n, r) {
|
|
41
|
+
super(`${n} at character ${r + 1}.`);
|
|
42
|
+
this.position = r;
|
|
43
|
+
this.name = "TypeSyntaxError";
|
|
44
|
+
}
|
|
45
|
+
position;
|
|
46
|
+
}, je = class {
|
|
47
|
+
constructor(t) {
|
|
48
|
+
this.source = t;
|
|
49
|
+
}
|
|
50
|
+
source;
|
|
51
|
+
#e = 0;
|
|
52
|
+
parse() {
|
|
53
|
+
let t = this.#n();
|
|
54
|
+
return this.#d(), this.#e !== this.source.length && this.#l("Unexpected type syntax"), t;
|
|
55
|
+
}
|
|
56
|
+
#n() {
|
|
57
|
+
let t = [this.#t()];
|
|
58
|
+
for (; this.#s("|"); ) t.push(this.#t());
|
|
59
|
+
return t.length === 1 ? t[0] : Le(t);
|
|
60
|
+
}
|
|
61
|
+
#t() {
|
|
62
|
+
let t = this.#i();
|
|
63
|
+
for (; this.#s("?"); ) t = Le([t, { kind: "terminal", name: "null" }, { kind: "terminal", name: "absent" }]);
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
#i() {
|
|
67
|
+
if (this.#s("(")) {
|
|
68
|
+
let r = this.#n();
|
|
69
|
+
return this.#a(")"), r;
|
|
70
|
+
}
|
|
71
|
+
let t = this.#c();
|
|
72
|
+
if (t !== void 0) return { kind: "keyword", value: t };
|
|
73
|
+
let n = this.#r();
|
|
74
|
+
if (n === void 0 && this.#l("Expected a type, keyword, or group"), n === "list" || n === "record") {
|
|
75
|
+
this.#a("(");
|
|
76
|
+
let r = this.#n();
|
|
77
|
+
return this.#a(")"), n === "list" ? { kind: "list", item: r } : { kind: "record", value: r };
|
|
78
|
+
}
|
|
79
|
+
return n === "object" ? this.#o() : yn.has(n) ? { kind: "terminal", name: n } : { kind: "keyword", value: n };
|
|
80
|
+
}
|
|
81
|
+
#o() {
|
|
82
|
+
this.#a("("), this.#a("{");
|
|
83
|
+
let t = [], n = false;
|
|
84
|
+
for (; !this.#s("}"); ) {
|
|
85
|
+
if (this.#d(), this.source.startsWith("...", this.#e)) this.#e += 3, n = true;
|
|
86
|
+
else {
|
|
87
|
+
let r = this.#c() ?? this.#r();
|
|
88
|
+
r === void 0 && this.#l("Expected an object field or `...`");
|
|
89
|
+
let i = this.#s("?");
|
|
90
|
+
this.#a(":");
|
|
91
|
+
let o = this.#n();
|
|
92
|
+
t.some((a) => a.name === r) && this.#l(`Duplicate object field \`${r}\``), t.push({ name: r, type: o, optional: i });
|
|
93
|
+
}
|
|
94
|
+
if (this.#s("}")) break;
|
|
95
|
+
this.#a(","), n && (this.#d(), this.source.startsWith("}", this.#e) || this.#l("The open marker must be last"));
|
|
96
|
+
}
|
|
97
|
+
return this.#a(")"), { kind: "object", fields: t, open: n };
|
|
98
|
+
}
|
|
99
|
+
#r() {
|
|
100
|
+
this.#d();
|
|
101
|
+
let t = /^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.#e));
|
|
102
|
+
if (t !== null) return this.#e += t[0].length, t[0];
|
|
103
|
+
}
|
|
104
|
+
#c() {
|
|
105
|
+
this.#d();
|
|
106
|
+
let t = this.source[this.#e];
|
|
107
|
+
if (t !== '"' && t !== "'") return;
|
|
108
|
+
this.#e += 1;
|
|
109
|
+
let n = "";
|
|
110
|
+
for (; this.#e < this.source.length; ) {
|
|
111
|
+
let r = this.source[this.#e++];
|
|
112
|
+
if (r === t) return n;
|
|
113
|
+
if (r !== "\\") {
|
|
114
|
+
n += r;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
this.#e >= this.source.length && this.#l("Unterminated escape");
|
|
118
|
+
let i = this.source[this.#e++];
|
|
119
|
+
n += { n: `
|
|
120
|
+
`, r: "\r", t: " ", "\\": "\\", '"': '"', "'": "'" }[i] ?? i;
|
|
121
|
+
}
|
|
122
|
+
this.#l("Unterminated quoted keyword");
|
|
123
|
+
}
|
|
124
|
+
#s(t) {
|
|
125
|
+
return this.#d(), this.source.startsWith(t, this.#e) ? (this.#e += t.length, true) : false;
|
|
126
|
+
}
|
|
127
|
+
#a(t) {
|
|
128
|
+
this.#s(t) || this.#l(`Expected \`${t}\``);
|
|
129
|
+
}
|
|
130
|
+
#d() {
|
|
131
|
+
for (; /\s/.test(this.source[this.#e] ?? ""); ) this.#e += 1;
|
|
132
|
+
}
|
|
133
|
+
#l(t) {
|
|
134
|
+
throw new ye(t, this.#e);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function Le(e) {
|
|
138
|
+
let t = e.flatMap((i) => i.kind === "union" ? i.members : [i]), n = new Map(t.map((i) => [W(i), i])), r = Array.from(n.values());
|
|
139
|
+
return r.length === 1 ? r[0] : { kind: "union", members: r };
|
|
140
|
+
}
|
|
141
|
+
function ge(e) {
|
|
142
|
+
if (e.trim() === "") throw new ye("A type expression cannot be empty", 0);
|
|
143
|
+
return Q(new je(e).parse());
|
|
144
|
+
}
|
|
145
|
+
function Oe(e) {
|
|
146
|
+
return typeof e == "object" && e !== null && "kind" in e && ["terminal", "keyword", "union", "list", "record", "object"].includes(String(e.kind));
|
|
147
|
+
}
|
|
148
|
+
function be(e) {
|
|
149
|
+
return Oe(e) ? e : typeof e == "string" ? { kind: "terminal", name: e } : Le(e.enum.map((t) => ({ kind: "keyword", value: t })));
|
|
150
|
+
}
|
|
151
|
+
function W(e) {
|
|
152
|
+
let t = Oe(e) ? e : be(e);
|
|
153
|
+
switch (t.kind) {
|
|
154
|
+
case "terminal":
|
|
155
|
+
return t.name;
|
|
156
|
+
case "keyword":
|
|
157
|
+
return /^[A-Za-z_][A-Za-z0-9_-]*$/.test(t.value) ? t.value : JSON.stringify(t.value);
|
|
158
|
+
case "union":
|
|
159
|
+
return t.members.map((n) => W(n)).join(" | ");
|
|
160
|
+
case "list":
|
|
161
|
+
return `list(${W(t.item)})`;
|
|
162
|
+
case "record":
|
|
163
|
+
return `record(${W(t.value)})`;
|
|
164
|
+
case "object":
|
|
165
|
+
return `object({ ${[...t.fields.map((n) => `${n.name}${n.optional ? "?" : ""}: ${W(n.type)}`), ...t.open ? ["..."] : []].join(", ")} })`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function P(e, t, n) {
|
|
169
|
+
return { ok: false, issues: [{ reason: e, message: t, path: n }] };
|
|
170
|
+
}
|
|
171
|
+
function X(e, t) {
|
|
172
|
+
return typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t) ? `${e}.${t}` : `${e}[${JSON.stringify(t)}]`;
|
|
173
|
+
}
|
|
174
|
+
function ut(e) {
|
|
175
|
+
if (typeof e != "object" || e === null || Array.isArray(e)) return false;
|
|
176
|
+
let t = Object.getPrototypeOf(e);
|
|
177
|
+
return t === Object.prototype || t === null;
|
|
178
|
+
}
|
|
179
|
+
function Pe(e) {
|
|
180
|
+
if (typeof e != "string") return e;
|
|
181
|
+
try {
|
|
182
|
+
return JSON.parse(e);
|
|
183
|
+
} catch {
|
|
184
|
+
return /* @__PURE__ */ Symbol.for("html-next.bad-json");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function gn(e, t) {
|
|
188
|
+
if (typeof e != "object" || e === null) return false;
|
|
189
|
+
if (e.kind === t && "value" in e) return true;
|
|
190
|
+
let n = t === "trusted-html" ? "TrustedHTML" : "TrustedScript";
|
|
191
|
+
return e.constructor?.name === n || Object.prototype.toString.call(e) === `[object ${n}]`;
|
|
192
|
+
}
|
|
193
|
+
function bn(e, t, n) {
|
|
194
|
+
switch (t) {
|
|
195
|
+
case "string":
|
|
196
|
+
return typeof e == "string" ? { ok: true, value: e } : P("typeMismatch", "Must be a string.", n);
|
|
197
|
+
case "boolean":
|
|
198
|
+
return typeof e == "boolean" ? { ok: true, value: e } : e === "" || e === "true" ? { ok: true, value: true } : e === "false" ? { ok: true, value: false } : P("typeMismatch", "Must be true or false.", n);
|
|
199
|
+
case "number":
|
|
200
|
+
case "integer": {
|
|
201
|
+
let r = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : Number.NaN;
|
|
202
|
+
return Number.isFinite(r) ? t === "integer" && !Number.isInteger(r) ? P("typeMismatch", "Must be an integer.", n) : { ok: true, value: r } : P("badInput", `Must be ${t === "integer" ? "an integer" : "a finite number"}.`, n);
|
|
203
|
+
}
|
|
204
|
+
case "null":
|
|
205
|
+
return e === null ? { ok: true, value: null } : P("typeMismatch", "Must be null.", n);
|
|
206
|
+
case "absent":
|
|
207
|
+
return e === void 0 ? { ok: true, value: void 0 } : P("typeMismatch", "Must be absent.", n);
|
|
208
|
+
case "trusted-html":
|
|
209
|
+
case "trusted-script":
|
|
210
|
+
return gn(e, t) ? { ok: true, value: e } : P("untrustedValue", `Must be a ${t === "trusted-html" ? "TrustedHTML" : "TrustedScript"} value.`, n);
|
|
211
|
+
case "function":
|
|
212
|
+
return typeof e == "function" ? { ok: true, value: e } : P("typeMismatch", "Must be a function supplied through a property.", n);
|
|
213
|
+
case "unknown":
|
|
214
|
+
return { ok: true, value: e };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function ee(e, t, n) {
|
|
218
|
+
switch (t.kind) {
|
|
219
|
+
case "terminal":
|
|
220
|
+
return bn(e, t.name, n);
|
|
221
|
+
case "keyword":
|
|
222
|
+
return e === t.value ? { ok: true, value: e } : P("typeMismatch", `Must be ${JSON.stringify(t.value)}.`, n);
|
|
223
|
+
case "union": {
|
|
224
|
+
for (let r of t.members) {
|
|
225
|
+
let i = ee(e, r, n);
|
|
226
|
+
if (i.ok) return i;
|
|
227
|
+
}
|
|
228
|
+
return P("typeMismatch", `Must match ${W(t)}.`, n);
|
|
229
|
+
}
|
|
230
|
+
case "list": {
|
|
231
|
+
let r = Pe(e);
|
|
232
|
+
if (!Array.isArray(r)) return P("typeMismatch", "Must be a list.", n);
|
|
233
|
+
let i = [], o = [];
|
|
234
|
+
return r.forEach((a, s) => {
|
|
235
|
+
let c = ee(a, t.item, X(n, s));
|
|
236
|
+
c.ok ? i.push(c.value) : o.push(...c.issues);
|
|
237
|
+
}), o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
|
|
238
|
+
}
|
|
239
|
+
case "record": {
|
|
240
|
+
let r = Pe(e);
|
|
241
|
+
if (!ut(r)) return P("typeMismatch", "Must be a string-keyed record.", n);
|
|
242
|
+
let i = {}, o = [];
|
|
243
|
+
for (let [a, s] of Object.entries(r)) {
|
|
244
|
+
let c = ee(s, t.value, X(n, a));
|
|
245
|
+
c.ok ? i[a] = c.value : o.push(...c.issues);
|
|
246
|
+
}
|
|
247
|
+
return o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
|
|
248
|
+
}
|
|
249
|
+
case "object": {
|
|
250
|
+
let r = Pe(e);
|
|
251
|
+
if (!ut(r)) return P("typeMismatch", "Must be an object.", n);
|
|
252
|
+
let i = {}, o = [], a = new Map(t.fields.map((s) => [s.name, s]));
|
|
253
|
+
for (let s of t.fields) {
|
|
254
|
+
if (!(s.name in r)) {
|
|
255
|
+
s.optional || o.push({ reason: "typeMismatch", message: "Required field is absent.", path: X(n, s.name) });
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
let c = ee(r[s.name], s.type, X(n, s.name));
|
|
259
|
+
c.ok ? i[s.name] = c.value : o.push(...c.issues);
|
|
260
|
+
}
|
|
261
|
+
for (let [s, c] of Object.entries(r)) a.has(s) || (t.open ? i[s] = c : o.push({ reason: "typeMismatch", message: "Field is not declared by this closed object type.", path: X(n, s) }));
|
|
262
|
+
return o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function B(e, t, n = "$") {
|
|
267
|
+
return ee(e, be(t), n);
|
|
268
|
+
}
|
|
269
|
+
function te(e, t) {
|
|
270
|
+
let n = B(e, t);
|
|
271
|
+
if (!n.ok) throw new TypeError(n.issues.map((i) => `${i.path}: ${i.message}`).join("; "));
|
|
272
|
+
let r = be(t);
|
|
273
|
+
if (r.kind === "terminal" && (r.name === "function" || r.name === "unknown")) throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);
|
|
274
|
+
return r.kind === "list" || r.kind === "record" || r.kind === "object" || r.kind === "union" && typeof n.value == "object" && n.value !== null ? JSON.stringify(n.value) : n.value === null ? "null" : n.value === void 0 ? "" : String(n.value);
|
|
275
|
+
}
|
|
276
|
+
function F(e) {
|
|
277
|
+
let t = be(e);
|
|
278
|
+
return t.kind === "terminal" ? !["function", "unknown", "trusted-html", "trusted-script"].includes(t.name) : t.kind === "keyword" ? true : t.kind === "union" ? t.members.every(F) : t.kind === "list" ? F(t.item) : t.kind === "record" ? F(t.value) : t.fields.every((n) => F(n.type));
|
|
279
|
+
}
|
|
280
|
+
function ft(e) {
|
|
281
|
+
let t;
|
|
282
|
+
try {
|
|
283
|
+
t = ge(e);
|
|
284
|
+
} catch (n) {
|
|
285
|
+
y("HC013", n instanceof Error ? n.message : "Invalid prop type expression.");
|
|
286
|
+
}
|
|
287
|
+
return t.kind === "terminal" && (t.name === "string" || t.name === "boolean" || t.name === "number") ? t.name : t.kind === "keyword" ? { enum: [t.value] } : t.kind === "union" && t.members.every((n) => n.kind === "keyword") ? { enum: t.members.map((n) => n.value) } : t;
|
|
288
|
+
}
|
|
289
|
+
var T = /* @__PURE__ */ Symbol("absent"), re = class extends Error {
|
|
290
|
+
constructor(n) {
|
|
291
|
+
super(`\`${n}\` is not declared in scope.`);
|
|
292
|
+
this.identifier = n;
|
|
293
|
+
this.name = "UndeclaredName";
|
|
294
|
+
}
|
|
295
|
+
identifier;
|
|
296
|
+
}, Ie = /\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y, vn = /\\([\s\S])/g, kn = /%s/g, wn = { or: 1, and: 2, "=": 3, "!=": 3, "^=": 3, "$=": 3, "*=": 3, "<": 4, "<=": 4, ">": 4, ">=": 4, "+": 5, "-": 5, "*": 6, "/": 6, "%": 6 };
|
|
297
|
+
function pt(e) {
|
|
298
|
+
return wn[e] ?? 0;
|
|
299
|
+
}
|
|
300
|
+
function xn(e) {
|
|
301
|
+
return e === "round" || e === "clamp" || e === "min" || e === "max" || e === "abs" || e === "format";
|
|
302
|
+
}
|
|
303
|
+
function En(e) {
|
|
304
|
+
let t = 0, n = 0, r = "";
|
|
305
|
+
function i() {
|
|
306
|
+
Ie.lastIndex = t;
|
|
307
|
+
let l = Ie.exec(e);
|
|
308
|
+
if (l === null) {
|
|
309
|
+
let m = e.slice(t).trimStart()[0];
|
|
310
|
+
throw m === '"' || m === "'" ? new SyntaxError("Unterminated string literal.") : new SyntaxError(`Unexpected character \`${m}\`.`);
|
|
311
|
+
}
|
|
312
|
+
t = Ie.lastIndex, l[1] !== void 0 || l[5] !== void 0 ? (n = 4, r = l[1] ?? l[5]) : l[2] !== void 0 ? (n = 1, r = Number(l[2])) : l[3] !== void 0 ? (n = 2, r = l[3].slice(1, -1).replace(vn, "$1")) : l[4] !== void 0 ? (n = 3, r = l[4]) : (n = 0, r = "");
|
|
313
|
+
}
|
|
314
|
+
function o(l) {
|
|
315
|
+
return r !== l ? false : (i(), true);
|
|
316
|
+
}
|
|
317
|
+
function a(l) {
|
|
318
|
+
if (!o(l)) throw new SyntaxError(`Expected \`${l}\`.`);
|
|
319
|
+
}
|
|
320
|
+
function s(l) {
|
|
321
|
+
let m = c(), f = pt(r);
|
|
322
|
+
for (; f >= l; ) {
|
|
323
|
+
let h = r;
|
|
324
|
+
i(), m = { kind: "binary", op: h, left: m, right: s(f + 1) }, f = pt(r);
|
|
325
|
+
}
|
|
326
|
+
return m;
|
|
327
|
+
}
|
|
328
|
+
function c() {
|
|
329
|
+
if (n === 3 && r === "not") return i(), { kind: "unary", op: "not", operand: c() };
|
|
330
|
+
if (o("-")) return { kind: "unary", op: "-", operand: c() };
|
|
331
|
+
let l = d();
|
|
332
|
+
for (; n === 4; ) if (o(".")) {
|
|
333
|
+
if (n !== 3) throw new SyntaxError("Expected a property name after `.`.");
|
|
334
|
+
let m = r;
|
|
335
|
+
i(), l = { kind: "member", object: l, key: m };
|
|
336
|
+
} else if (o("[")) {
|
|
337
|
+
let m = s(1);
|
|
338
|
+
a("]"), l = { kind: "index", object: l, index: m };
|
|
339
|
+
} else break;
|
|
340
|
+
return l;
|
|
341
|
+
}
|
|
342
|
+
function d() {
|
|
343
|
+
let l = n, m = r;
|
|
344
|
+
if (l === 1 || l === 2) return i(), { kind: "literal", value: m };
|
|
345
|
+
if (l === 4 && m === "(") {
|
|
346
|
+
i();
|
|
347
|
+
let f = s(1);
|
|
348
|
+
return a(")"), f;
|
|
349
|
+
}
|
|
350
|
+
if (l === 4 && m === "{") {
|
|
351
|
+
i();
|
|
352
|
+
let f = [];
|
|
353
|
+
if (!o("}")) {
|
|
354
|
+
do {
|
|
355
|
+
if (r === "}") break;
|
|
356
|
+
if (n !== 3 && n !== 2) throw new SyntaxError("Object keys must be identifiers or strings.");
|
|
357
|
+
let h = r;
|
|
358
|
+
i(), a(":"), f.push({ key: h, value: s(1) });
|
|
359
|
+
} while (o(","));
|
|
360
|
+
a("}");
|
|
361
|
+
}
|
|
362
|
+
return { kind: "object", pairs: f };
|
|
363
|
+
}
|
|
364
|
+
if (l === 4 && m === "[") {
|
|
365
|
+
i();
|
|
366
|
+
let f = [];
|
|
367
|
+
if (!o("]")) {
|
|
368
|
+
do {
|
|
369
|
+
if (r === "]") break;
|
|
370
|
+
f.push(s(1));
|
|
371
|
+
} while (o(","));
|
|
372
|
+
a("]");
|
|
373
|
+
}
|
|
374
|
+
return { kind: "array", items: f };
|
|
375
|
+
}
|
|
376
|
+
if (l === 3) {
|
|
377
|
+
let f = m;
|
|
378
|
+
if (i(), f === "true") return { kind: "literal", value: true };
|
|
379
|
+
if (f === "false") return { kind: "literal", value: false };
|
|
380
|
+
if (f === "null") return { kind: "literal", value: null };
|
|
381
|
+
if (r === "(" && xn(f)) {
|
|
382
|
+
i();
|
|
383
|
+
let h = [];
|
|
384
|
+
if (!o(")")) {
|
|
385
|
+
do
|
|
386
|
+
h.push(s(1));
|
|
387
|
+
while (o(","));
|
|
388
|
+
a(")");
|
|
389
|
+
}
|
|
390
|
+
return { kind: "call", fn: f, args: h };
|
|
391
|
+
}
|
|
392
|
+
return { kind: "id", name: f };
|
|
393
|
+
}
|
|
394
|
+
throw new SyntaxError("Unexpected end of expression.");
|
|
395
|
+
}
|
|
396
|
+
i();
|
|
397
|
+
let u = s(1);
|
|
398
|
+
if (n !== 0) throw new SyntaxError("Unexpected trailing input in expression.");
|
|
399
|
+
return u;
|
|
400
|
+
}
|
|
401
|
+
function ne(e) {
|
|
402
|
+
return e === T || e === null;
|
|
403
|
+
}
|
|
404
|
+
function j(e) {
|
|
405
|
+
if (e === T || e === null || e === false) return false;
|
|
406
|
+
if (e === true) return true;
|
|
407
|
+
if (typeof e == "string") return e.length > 0;
|
|
408
|
+
if (typeof e == "number") return e !== 0 && e === e;
|
|
409
|
+
if (Array.isArray(e)) return e.length > 0;
|
|
410
|
+
for (let t in e) if (Object.hasOwn(e, t)) return true;
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
function ve(e) {
|
|
414
|
+
return typeof e == "number" && e === e ? e : T;
|
|
415
|
+
}
|
|
416
|
+
function A(e, t) {
|
|
417
|
+
switch (e.kind) {
|
|
418
|
+
case "literal":
|
|
419
|
+
return e.value;
|
|
420
|
+
case "id": {
|
|
421
|
+
let n = t.get(e.name);
|
|
422
|
+
if (n === void 0) throw new re(e.name);
|
|
423
|
+
return n;
|
|
424
|
+
}
|
|
425
|
+
case "member": {
|
|
426
|
+
let n = A(e.object, t);
|
|
427
|
+
if (ne(n) || typeof n != "object" || Array.isArray(n)) return T;
|
|
428
|
+
let r = n[e.key];
|
|
429
|
+
return r === void 0 ? T : r;
|
|
430
|
+
}
|
|
431
|
+
case "index": {
|
|
432
|
+
let n = A(e.object, t), r = A(e.index, t);
|
|
433
|
+
if (ne(n) || ne(r)) return T;
|
|
434
|
+
if (Array.isArray(n) && typeof r == "number") {
|
|
435
|
+
let i = n[r];
|
|
436
|
+
return i === void 0 ? T : i;
|
|
437
|
+
}
|
|
438
|
+
if (typeof n == "object" && typeof r == "string") {
|
|
439
|
+
let i = n[r];
|
|
440
|
+
return i === void 0 ? T : i;
|
|
441
|
+
}
|
|
442
|
+
return T;
|
|
443
|
+
}
|
|
444
|
+
case "unary": {
|
|
445
|
+
let n = A(e.operand, t);
|
|
446
|
+
if (e.op === "not") return !j(n);
|
|
447
|
+
let r = ve(n);
|
|
448
|
+
return r === T ? T : -r;
|
|
449
|
+
}
|
|
450
|
+
case "binary":
|
|
451
|
+
return Tn(e, t);
|
|
452
|
+
case "call":
|
|
453
|
+
return Cn(e, t);
|
|
454
|
+
case "object": {
|
|
455
|
+
let n = {};
|
|
456
|
+
for (let r of e.pairs) n[r.key] = A(r.value, t);
|
|
457
|
+
return n;
|
|
458
|
+
}
|
|
459
|
+
case "array": {
|
|
460
|
+
let n = [];
|
|
461
|
+
for (let r of e.items) n.push(A(r, t));
|
|
462
|
+
return n;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function Tn(e, t) {
|
|
467
|
+
let { op: n } = e;
|
|
468
|
+
if (n === "and") return j(A(e.left, t)) && j(A(e.right, t));
|
|
469
|
+
if (n === "or") return j(A(e.left, t)) || j(A(e.right, t));
|
|
470
|
+
let r = A(e.left, t), i = A(e.right, t);
|
|
471
|
+
if (n === "=") return r === i;
|
|
472
|
+
if (n === "!=") return r !== i;
|
|
473
|
+
if (n === "^=" || n === "$=" || n === "*=") return typeof r != "string" || typeof i != "string" ? T : n === "^=" ? r.startsWith(i) : n === "$=" ? r.endsWith(i) : r.includes(i);
|
|
474
|
+
let o = ve(r), a = ve(i);
|
|
475
|
+
if (o === T || a === T) return T;
|
|
476
|
+
switch (n) {
|
|
477
|
+
case "<":
|
|
478
|
+
return o < a;
|
|
479
|
+
case "<=":
|
|
480
|
+
return o <= a;
|
|
481
|
+
case ">":
|
|
482
|
+
return o > a;
|
|
483
|
+
case ">=":
|
|
484
|
+
return o >= a;
|
|
485
|
+
case "+":
|
|
486
|
+
return o + a;
|
|
487
|
+
case "-":
|
|
488
|
+
return o - a;
|
|
489
|
+
case "*":
|
|
490
|
+
return o * a;
|
|
491
|
+
case "/":
|
|
492
|
+
return o / a;
|
|
493
|
+
case "%":
|
|
494
|
+
return o % a;
|
|
495
|
+
default:
|
|
496
|
+
return T;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function Cn(e, t) {
|
|
500
|
+
let { args: n, fn: r } = e, i = [];
|
|
501
|
+
for (let a of n) i.push(A(a, t));
|
|
502
|
+
if (r === "format") {
|
|
503
|
+
let a = i[0];
|
|
504
|
+
if (typeof a != "string") return T;
|
|
505
|
+
let s = 1;
|
|
506
|
+
return a.replace(kn, () => s < i.length ? D(i[s++]) : "%s");
|
|
507
|
+
}
|
|
508
|
+
for (let a = 0; a < i.length; a += 1) {
|
|
509
|
+
let s = ve(i[a]);
|
|
510
|
+
if (s === T) return T;
|
|
511
|
+
i[a] = s;
|
|
512
|
+
}
|
|
513
|
+
let o = i;
|
|
514
|
+
switch (r) {
|
|
515
|
+
case "abs":
|
|
516
|
+
return o.length === 1 ? Math.abs(o[0]) : T;
|
|
517
|
+
case "round":
|
|
518
|
+
return o.length === 1 ? Math.round(o[0]) : T;
|
|
519
|
+
case "min":
|
|
520
|
+
return o.length > 0 ? Math.min(...o) : T;
|
|
521
|
+
case "max":
|
|
522
|
+
return o.length > 0 ? Math.max(...o) : T;
|
|
523
|
+
case "clamp":
|
|
524
|
+
return o.length === 3 ? Math.min(Math.max(o[0], o[1]), o[2]) : T;
|
|
525
|
+
default:
|
|
526
|
+
return T;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
var mt = /* @__PURE__ */ new Map();
|
|
530
|
+
function Ve(e) {
|
|
531
|
+
if (e.kind === "id") return e.name;
|
|
532
|
+
if (e.kind === "member") {
|
|
533
|
+
let t = Ve(e.object);
|
|
534
|
+
return t === void 0 ? void 0 : `${t}.${e.key}`;
|
|
535
|
+
}
|
|
536
|
+
if (e.kind === "index" && e.index.kind === "literal") {
|
|
537
|
+
let t = e.index.value;
|
|
538
|
+
if (typeof t != "string" && typeof t != "number") return;
|
|
539
|
+
let n = Ve(e.object);
|
|
540
|
+
return n === void 0 ? void 0 : `${n}.${t}`;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function I(e, t) {
|
|
544
|
+
let n = Ve(e);
|
|
545
|
+
if (n !== void 0) {
|
|
546
|
+
t.includes(n) || t.push(n);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
switch (e.kind) {
|
|
550
|
+
case "literal":
|
|
551
|
+
return;
|
|
552
|
+
case "id":
|
|
553
|
+
return;
|
|
554
|
+
case "member":
|
|
555
|
+
I(e.object, t);
|
|
556
|
+
return;
|
|
557
|
+
case "index":
|
|
558
|
+
I(e.object, t), I(e.index, t);
|
|
559
|
+
return;
|
|
560
|
+
case "unary":
|
|
561
|
+
I(e.operand, t);
|
|
562
|
+
return;
|
|
563
|
+
case "binary":
|
|
564
|
+
I(e.left, t), I(e.right, t);
|
|
565
|
+
return;
|
|
566
|
+
case "call":
|
|
567
|
+
for (let r of e.args) I(r, t);
|
|
568
|
+
return;
|
|
569
|
+
case "object":
|
|
570
|
+
for (let r of e.pairs) I(r.value, t);
|
|
571
|
+
return;
|
|
572
|
+
case "array":
|
|
573
|
+
for (let r of e.items) I(r, t);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function ze(e, t) {
|
|
577
|
+
if (e.kind === "id") return t.push(e.name), true;
|
|
578
|
+
if (e.kind === "member") return ze(e.object, t) ? (t.push(e.key), true) : false;
|
|
579
|
+
if (e.kind !== "index" || !ze(e.object, t)) return false;
|
|
580
|
+
let n = e.index, r = n.kind === "literal" ? n.value : void 0;
|
|
581
|
+
return t.push(typeof r == "string" || typeof r == "number" ? r : { kind: "index", expression: n }), true;
|
|
582
|
+
}
|
|
583
|
+
function ke(e) {
|
|
584
|
+
let t = mt.get(e);
|
|
585
|
+
if (t !== void 0) return t;
|
|
586
|
+
let n = En(e), r = [];
|
|
587
|
+
return I(n, r), r.sort(), t = { source: e, ast: n, dependencies: r }, mt.set(e, t), t;
|
|
588
|
+
}
|
|
589
|
+
function _e(e, t) {
|
|
590
|
+
let n = [];
|
|
591
|
+
if (!(!ze(ke(e).ast, n) || !t.has(n[0]))) return n;
|
|
592
|
+
}
|
|
593
|
+
function ht(e, t) {
|
|
594
|
+
return A(ke(e).ast, t);
|
|
595
|
+
}
|
|
596
|
+
function V(e, t) {
|
|
597
|
+
return A("ast" in e ? e.ast : e, t);
|
|
598
|
+
}
|
|
599
|
+
function D(e) {
|
|
600
|
+
return ne(e) ? "" : Array.isArray(e) ? e.map(D).join(" ") : typeof e == "object" ? "" : String(e);
|
|
601
|
+
}
|
|
602
|
+
function yt(e) {
|
|
603
|
+
return ne(e) || e === false ? null : e === true ? "" : typeof e == "number" || typeof e == "string" ? String(e) : Array.isArray(e) ? e.map(D).join(" ") : null;
|
|
604
|
+
}
|
|
605
|
+
var Rn = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "poster", "data", "xlink:href"]), Sn = /* @__PURE__ */ new Set(["base", "embed", "iframe", "link", "meta", "object", "script", "style", "template"]), Nn = /* @__PURE__ */ new Set(["srcdoc", "style"]);
|
|
606
|
+
function ie(e) {
|
|
607
|
+
let t = e.replace(/[\u0000-\u0020\u007f]+/g, "");
|
|
608
|
+
return /^(?:data|javascript|vbscript):/i.test(t);
|
|
609
|
+
}
|
|
610
|
+
function oe(e) {
|
|
611
|
+
return Rn.has(e.toLowerCase());
|
|
612
|
+
}
|
|
613
|
+
function qe(e, t, n) {
|
|
614
|
+
let r = t.createElement("template");
|
|
615
|
+
r.innerHTML = e;
|
|
616
|
+
for (let i of Array.from(r.content.querySelectorAll("*"))) {
|
|
617
|
+
if (n?.(i), Sn.has(i.localName)) {
|
|
618
|
+
i.remove();
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
for (let o of Array.from(i.attributes)) {
|
|
622
|
+
let a = o.name.toLowerCase();
|
|
623
|
+
(a.startsWith("on") || Nn.has(a) || oe(a) && ie(o.value)) && i.removeAttribute(o.name);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return r.content;
|
|
627
|
+
}
|
|
628
|
+
var $n = /^(?:if|else-if|else|for|with|value|state|computed|data)$/, An = /^(?:@|v-|#|on:|use:|transition:|animate:)/, Hn = /^(?:innerhtml|outerhtml|srcdoc)$/, Mn = /^(?:base|embed|link|meta|object|script|style)$/;
|
|
629
|
+
function gt(e) {
|
|
630
|
+
return $n.test(e);
|
|
631
|
+
}
|
|
632
|
+
function Ue(e, t) {
|
|
633
|
+
return Mn.test(e.toLowerCase()) && y("HT009", `<${e}> is not permitted in rendered component markup.`, t), e;
|
|
634
|
+
}
|
|
635
|
+
function We(e, t, n = "") {
|
|
636
|
+
let r = e.toLowerCase();
|
|
637
|
+
return (r.startsWith("on") || An.test(r)) && y("HT010", `Literal attribute \`${e}\` uses target-framework directive syntax that is not supported.`, t), r === "srcdoc" && y("HT007", "Literal `srcdoc` is not permitted in a component definition.", t), oe(r) && ie(n) && y("HT007", `Literal \`${e}\` contains an executable URL.`, t), e;
|
|
638
|
+
}
|
|
639
|
+
function bt(e, t) {
|
|
640
|
+
let n = e.toLowerCase();
|
|
641
|
+
return (n.startsWith("on") || Hn.test(n)) && y("HT007", `Dynamic ${e} requires a future trusted-content type.`, t), e;
|
|
642
|
+
}
|
|
643
|
+
function z(e) {
|
|
644
|
+
return "tagName" in e;
|
|
645
|
+
}
|
|
646
|
+
function se(e) {
|
|
647
|
+
return e.nodeName === "#text";
|
|
648
|
+
}
|
|
649
|
+
function S(e) {
|
|
650
|
+
return "localName" in e ? e.localName : e.tagName;
|
|
651
|
+
}
|
|
652
|
+
function we(e) {
|
|
653
|
+
return "attrs" in e ? e.attrs : e.attributes;
|
|
654
|
+
}
|
|
655
|
+
function _(e) {
|
|
656
|
+
return (S(e) === "template" ? e.content : void 0)?.childNodes ?? e.childNodes;
|
|
657
|
+
}
|
|
658
|
+
function ae(e) {
|
|
659
|
+
return "value" in e ? e.value : "nodeValue" in e ? e.nodeValue ?? "" : "";
|
|
660
|
+
}
|
|
661
|
+
function wt(e) {
|
|
662
|
+
let t = [];
|
|
663
|
+
for (let n of e) n.nodeName !== "#comment" && (!se(n) || ae(n).trim() !== "") && t.push(n);
|
|
664
|
+
return t;
|
|
665
|
+
}
|
|
666
|
+
function w(e, t) {
|
|
667
|
+
return "attrs" in e ? e.attrs.find((n) => n.name === t)?.value : e.getAttribute(t) ?? void 0;
|
|
668
|
+
}
|
|
669
|
+
function xt(e) {
|
|
670
|
+
let t = "";
|
|
671
|
+
for (let n of _(e)) se(n) && (t += ae(n));
|
|
672
|
+
return t;
|
|
673
|
+
}
|
|
674
|
+
function Et(e, t) {
|
|
675
|
+
let n = [];
|
|
676
|
+
for (let r of _(e)) z(r) && S(r) === t && n.push(r);
|
|
677
|
+
return n;
|
|
678
|
+
}
|
|
679
|
+
function Tt(e, t) {
|
|
680
|
+
for (let n of _(e)) {
|
|
681
|
+
if (!z(n)) continue;
|
|
682
|
+
let r = S(n);
|
|
683
|
+
r === "link" && y("HL001", "External definition dependencies require the application-owned graph resolver.", t), Ue(r, t);
|
|
684
|
+
for (let i of we(n)) /^on(?!:)/i.test(i.name) && We(i.name, t, i.value);
|
|
685
|
+
Tt(n, t);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
var Dn = /^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/, vt = /^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/, Pn = /^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/, kt = /^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/, Fe = /^[a-z][a-z0-9-]*$/, jn = /^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/, Ke = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;
|
|
689
|
+
function Be(e, ...t) {
|
|
690
|
+
let n = new Set(e.roots);
|
|
691
|
+
for (let r of t) r !== void 0 && n.add(r);
|
|
692
|
+
return { roots: n, writableRoots: e.writableRoots, handlers: e.handlers };
|
|
693
|
+
}
|
|
694
|
+
function R(e, t, n) {
|
|
695
|
+
let r = zn(e, n);
|
|
696
|
+
return Ln(r, t, n), r;
|
|
697
|
+
}
|
|
698
|
+
function Ln(e, t, n) {
|
|
699
|
+
for (let r of e.dependencies) {
|
|
700
|
+
let i = r.split(".", 1)[0];
|
|
701
|
+
t.roots.has(i) || y("HT003", `Expression root \`${i}\` is not declared in this scope.`, n);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function On(e, t, n) {
|
|
705
|
+
let r = /* @__PURE__ */ Object.create(null), i = (a, s) => {
|
|
706
|
+
let c = r[a];
|
|
707
|
+
c !== void 0 && ("attribute" in c ? !("attribute" in s) || c.attribute !== s.attribute : !("property" in s) || c.property !== s.property) && y("HT004", `Prop \`${a}\` is bound to conflicting targets.`, t), r[a] = s;
|
|
708
|
+
}, o = (a) => {
|
|
709
|
+
for (let s of we(a)) if (s.name.startsWith(":")) /^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value) && i(s.value, { attribute: s.name.slice(1).toLowerCase() });
|
|
710
|
+
else if (s.name.startsWith(".")) {
|
|
711
|
+
let c = s.name.slice(1).toLowerCase();
|
|
712
|
+
if (/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)) {
|
|
713
|
+
let d = n.resolveDomProperty(S(a), c) ?? (s.value.toLowerCase() === c ? s.value : c);
|
|
714
|
+
i(s.value, { property: d });
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
for (let s of _(a)) z(s) && S(s) !== "slot" && o(s);
|
|
718
|
+
};
|
|
719
|
+
return o(e), r;
|
|
720
|
+
}
|
|
721
|
+
function In(e, t, n, r = true) {
|
|
722
|
+
let i = /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ Object.create(null);
|
|
723
|
+
if (e === void 0) return i;
|
|
724
|
+
let a = Et(e, "prop");
|
|
725
|
+
a.sort((s, c) => {
|
|
726
|
+
let d = w(s, "name") ?? "", u = w(c, "name") ?? "";
|
|
727
|
+
return d < u ? -1 : d > u ? 1 : 0;
|
|
728
|
+
});
|
|
729
|
+
for (let s of a) {
|
|
730
|
+
let c = w(s, "name");
|
|
731
|
+
(c === void 0 || c === "") && y("HC010", "A <prop> requires a `name` attribute.", n), /^[A-Za-z][A-Za-z0-9_-]*$/.test(c) || y("HC010", `Invalid prop name \`${c}\`.`, n);
|
|
732
|
+
let d = w(s, "type");
|
|
733
|
+
(d === void 0 || d === "") && y("HC013", `Prop \`${c}\` requires a \`type\` attribute.`, n);
|
|
734
|
+
let u = c.toLowerCase(), l = o[u];
|
|
735
|
+
l !== void 0 && y("HC011", `Props \`${l}\` and \`${c}\` collide after lowercase normalization.`, n), o[u] = c;
|
|
736
|
+
let m = t[c];
|
|
737
|
+
m === void 0 && r && y("HC018", `Prop \`${c}\` is declared but never bound in the markup.`, n), m ??= { attribute: c.toLowerCase() };
|
|
738
|
+
let f = ft(d), h = w(s, "required") !== void 0, p = xt(s).trim();
|
|
739
|
+
p === "" && y("HC003", `\`props.${c}.description\` must be a non-empty string.`, n), F(f) || y("HC017", `Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`, n);
|
|
740
|
+
let b = w(s, "default");
|
|
741
|
+
h && b !== void 0 && y("HC019", `Required prop \`${c}\` cannot also declare a default.`, n);
|
|
742
|
+
let x = { type: f, required: h, target: m, description: p };
|
|
743
|
+
if (b !== void 0) {
|
|
744
|
+
let E = B(b, f);
|
|
745
|
+
E.ok || y("HC015", `Default for prop \`${c}\` does not satisfy its type.`, n), x.default = E.value;
|
|
746
|
+
}
|
|
747
|
+
i[c] = x;
|
|
748
|
+
}
|
|
749
|
+
return i;
|
|
750
|
+
}
|
|
751
|
+
function Vn(e, t, n, r, i, o, a) {
|
|
752
|
+
let s = w(e, "component") ?? "";
|
|
753
|
+
s.trim() === "" && y("HC003", "`component` must be a non-empty string.", o), /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s) || y("HC005", "The `component` tag must be lowercase and contain a hyphen.", o);
|
|
754
|
+
let c = w(e, "status") ?? "";
|
|
755
|
+
/^(?:early|experimental|stable|deprecated)$/.test(c) || y("HC007", "Component `status` is not recognized.", o);
|
|
756
|
+
let d = w(e, "summary") ?? "";
|
|
757
|
+
return d.trim() === "" && y("HC003", "`summary` must be a non-empty string.", o), (!/^[a-z][a-z0-9-]*$/.test(n) || r && !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n)) && y("HC008", "`nativeElement` must be a lowercase HTML element or component tag.", o), { version: 1, name: lt(s), tag: s, status: c, summary: d, nativeElement: n, props: In(t, i, o, a) };
|
|
758
|
+
}
|
|
759
|
+
function zn(e, t) {
|
|
760
|
+
try {
|
|
761
|
+
return ke(e);
|
|
762
|
+
} catch {
|
|
763
|
+
y("HT013", `Malformed expression \`${e}\`.`, t);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function _n(e, t, n) {
|
|
767
|
+
let r = [];
|
|
768
|
+
for (let i of wt(_(e))) {
|
|
769
|
+
z(i) || y("HC023", "Handler bodies contain declarative step elements only.", n);
|
|
770
|
+
let o = w(i, "$if"), a = o === void 0 ? void 0 : R(o, t, n);
|
|
771
|
+
if (S(i) === "set") {
|
|
772
|
+
let s = w(i, "name") ?? "", c = w(i, ":value"), d = w(i, "value");
|
|
773
|
+
(s === "" || c === void 0 == (d === void 0)) && y("HC023", "A <set> requires `name` and exactly one of `value` or `:value`.", n), R(s, t, n);
|
|
774
|
+
let u = _e(s, t.writableRoots);
|
|
775
|
+
u === void 0 && y("HT005", `Handler write \`${s}\` is not rooted in declared state.`, n);
|
|
776
|
+
let l = { kind: "set", path: s, writablePath: u, value: R(c ?? JSON.stringify(d), t, n) };
|
|
777
|
+
a !== void 0 && (l.guard = a), r.push(l);
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
if (S(i) === "dispatch") {
|
|
781
|
+
let s = w(i, "event") ?? "";
|
|
782
|
+
Fe.test(s) || y("HC023", "A <dispatch> requires a valid `event` name.", n);
|
|
783
|
+
let c = w(i, ":value"), d = w(i, "value");
|
|
784
|
+
c !== void 0 && d !== void 0 && y("HC023", "A <dispatch> may declare only one of `value` or `:value`.", n);
|
|
785
|
+
let u = c === void 0 && d === void 0 ? void 0 : R(c ?? JSON.stringify(d), t, n), l = { kind: "dispatch", event: s };
|
|
786
|
+
u !== void 0 && (l.value = u), a !== void 0 && (l.guard = a), r.push(l);
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
if (S(i) === "validate" || S(i) === "focus") {
|
|
790
|
+
let s = w(i, "target") ?? w(i, "ref") ?? w(i, "name") ?? "";
|
|
791
|
+
Ke.test(s) || y("HC023", `<${S(i)}> requires a valid target reference.`, n);
|
|
792
|
+
let c = { kind: S(i), target: s };
|
|
793
|
+
a !== void 0 && (c.guard = a), r.push(c);
|
|
794
|
+
continue;
|
|
795
|
+
}
|
|
796
|
+
y("HC023", `<${S(i)}> is not a recognized handler step.`, n);
|
|
797
|
+
}
|
|
798
|
+
return r;
|
|
799
|
+
}
|
|
800
|
+
function qn(e, t, n) {
|
|
801
|
+
let r = [], i = new Set(Object.keys(t.props)), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
802
|
+
if (e === void 0) return { declarations: r, scope: { roots: i, writableRoots: o, handlers: a } };
|
|
803
|
+
let s = [], c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
804
|
+
for (let l of _(e)) {
|
|
805
|
+
if (!z(l)) continue;
|
|
806
|
+
let m = l;
|
|
807
|
+
s.push(m);
|
|
808
|
+
let f = S(m);
|
|
809
|
+
/^(?:prop|state|computed|data|handler|event|method)$/.test(f) || y("HC021", `<${f}> is not a recognized definition declaration.`, n);
|
|
810
|
+
let h = w(m, "name") ?? "";
|
|
811
|
+
if (h === "" && y("HC010", `A <${f}> requires a \`name\` attribute.`, n), f === "event") {
|
|
812
|
+
d.has(h) && y("HC020", `Event \`${h}\` is declared more than once.`, n), d.add(h);
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
c.has(h) && y("HC020", `Declaration \`${h}\` collides in the flat component scope.`, n), c.add(h), i.add(h), f === "state" ? o.add(h) : f === "handler" && a.add(h);
|
|
816
|
+
}
|
|
817
|
+
let u = { roots: i, writableRoots: o, handlers: a };
|
|
818
|
+
for (let l of s) {
|
|
819
|
+
let m = S(l);
|
|
820
|
+
if (m === "prop") continue;
|
|
821
|
+
let f = w(l, "name");
|
|
822
|
+
if (m === "state") {
|
|
823
|
+
let h = w(l, ":value"), p = w(l, "value");
|
|
824
|
+
h !== void 0 && p !== void 0 && y("HC013", `<state name="${f}"> may declare only one of \`value\` or \`:value\`.`, n);
|
|
825
|
+
let b = h === void 0 && p === void 0 ? void 0 : R(h ?? JSON.stringify(p), u, n), x = { kind: m, name: f };
|
|
826
|
+
p !== void 0 && (x.value = p), b !== void 0 && (x.expression = b), r.push(x);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
if (m === "computed") {
|
|
830
|
+
let h = w(l, "from");
|
|
831
|
+
(h === void 0 || h === "") && y("HC013", `<computed name="${f}"> requires a \`from\` expression.`, n), r.push({ kind: m, name: f, expression: R(h, u, n) });
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
if (m === "data") {
|
|
835
|
+
let h = w(l, "src"), p = w(l, "type"), b = w(l, "debounce"), x = w(l, "poll"), E = [], v = /* @__PURE__ */ new Set();
|
|
836
|
+
for (let k of Et(l, "param")) {
|
|
837
|
+
let C = w(k, "name") ?? "", $ = w(k, ":value");
|
|
838
|
+
(!Ke.test(C) || $ === void 0) && y("HC024", "A data <param> requires a valid `name` and a `:value` expression.", n), v.has(C) && y("HC024", `Data source \`${f}\` repeats a parameter name.`, n), v.add(C), E.push({ name: C, expression: R($, u, n) });
|
|
839
|
+
}
|
|
840
|
+
let g = { kind: m, name: f, parameters: E };
|
|
841
|
+
h !== void 0 && (g.source = h), p !== void 0 && (g.type = p), b !== void 0 && (g.debounce = b), x !== void 0 && (g.poll = x), r.push(g);
|
|
842
|
+
continue;
|
|
843
|
+
}
|
|
844
|
+
if (m === "event") {
|
|
845
|
+
r.push({ kind: m, name: f, type: w(l, "type") ?? "object", bubbles: w(l, "bubbles") !== "false", composed: w(l, "composed") !== "false", cancelable: w(l, "cancelable") === "true" });
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
if (m === "method") {
|
|
849
|
+
r.push({ kind: m, name: f, exportName: w(l, "export") ?? f, returns: w(l, "returns") ?? "undefined" });
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
r.push({ kind: "handler", name: f, steps: _n(l, u, n) });
|
|
853
|
+
}
|
|
854
|
+
for (let l of r) if (l.kind === "handler") for (let m of l.steps) m.kind === "dispatch" && !d.has(m.event) && y("HC023", `Handler \`${l.name}\` dispatches undeclared component event \`${m.event}\`.`, n);
|
|
855
|
+
return { declarations: r, scope: u };
|
|
856
|
+
}
|
|
857
|
+
function Un(e, t, n, r, i, o) {
|
|
858
|
+
let a = [];
|
|
859
|
+
for (let s of e) {
|
|
860
|
+
if (s.name.startsWith("bind:")) {
|
|
861
|
+
let c = s.name.slice(5).toLowerCase();
|
|
862
|
+
(c === "" || vt.test(c)) && y("HT007", `Two-way binding cannot target \`${c || s.name}\`.`, i);
|
|
863
|
+
let d = R(s.value, r, i), u = _e(s.value, r.writableRoots);
|
|
864
|
+
u === void 0 && y("HT005", `\`${s.value}\` is not a writable state-rooted path.`, i), a.push({ kind: "attribute", name: c, expression: s.value, expressionPlan: d, twoWay: true, writablePath: u });
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (s.name.startsWith("class:") || s.name.startsWith("style:")) {
|
|
868
|
+
let c = s.name.startsWith("class:") ? "class" : "style", d = s.name.slice(c.length + 1);
|
|
869
|
+
(c === "class" ? d !== "" && !/\s/.test(d) : /^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(d)) || y("HT020", `\`${s.name}\` does not name a valid ${c} binding target.`, i), a.push({ kind: "attribute", name: d, expression: s.value, expressionPlan: R(s.value, r, i), target: c });
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
if (s.name.startsWith("$")) {
|
|
873
|
+
let c = s.name.slice(1).toLowerCase();
|
|
874
|
+
c !== "value" && c !== "html" && y("HT012", `\`$${c}\` is not a known content directive.`, i), a.push({ kind: "directive", name: c, expression: s.value, expressionPlan: R(s.value, r, i) });
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
if (s.name.startsWith(":")) {
|
|
878
|
+
let c = s.name.slice(1).toLowerCase();
|
|
879
|
+
vt.test(c) && y("HT007", `\`:${c}\` cannot bind a raw content sink.`, i);
|
|
880
|
+
let d = R(s.value, r, i), u = n.props[s.value];
|
|
881
|
+
u !== void 0 && (!("attribute" in u.target) || u.target.attribute !== c) && y("HT004", `Binding \`:${c}\` does not match prop \`${s.value}\`'s target.`, i), a.push({ kind: "attribute", name: c, expression: s.value, expressionPlan: d });
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (s.name.startsWith(".")) {
|
|
885
|
+
let c = s.name.slice(1).toLowerCase(), d = R(s.value, r, i), u = n.props[s.value];
|
|
886
|
+
u !== void 0 && (!("property" in u.target) || u.target.property.toLowerCase() !== c) && y("HT004", `Property binding \`.${c}\` does not match prop \`${s.value}\`'s target.`, i);
|
|
887
|
+
let l = o.resolveDomProperty(t, c);
|
|
888
|
+
l === void 0 && y("HP001", `\`${c}\` is not a native property of <${t}>.`, i), bt(l, i), a.push({ kind: "property", key: c, name: l, expression: s.value, expressionPlan: d });
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
We(s.name, i, s.value), a.push({ kind: "literal", name: s.name, value: s.value });
|
|
892
|
+
}
|
|
893
|
+
return a;
|
|
894
|
+
}
|
|
895
|
+
function Wn(e, t, n) {
|
|
896
|
+
if (e === void 0) return;
|
|
897
|
+
let r = [];
|
|
898
|
+
for (let i of e) {
|
|
899
|
+
let [o = "", ...a] = i.name.slice(3).split(".");
|
|
900
|
+
(!Fe.test(o) || a.some((s) => !Fe.test(s))) && y("HT010", `\`${i.name}\` is not a valid declarative event binding.`, n);
|
|
901
|
+
for (let s = 0; s < a.length; s += 1) {
|
|
902
|
+
let c = a[s];
|
|
903
|
+
a.indexOf(c) !== s && y("HT010", `\`${i.name}\` repeats an event modifier.`, n), jn.test(c) || y("HT010", `\`${i.name}\` contains an unsupported event modifier.`, n);
|
|
904
|
+
}
|
|
905
|
+
a.includes("passive") && a.includes("prevent") && y("HT010", `\`${i.name}\` cannot combine passive and prevent.`, n), t.handlers.has(i.value) || y("HT010", `Event binding \`${i.name}\` names undeclared handler \`${i.value}\`.`, n), r.push({ name: o, handler: i.value, modifiers: a });
|
|
906
|
+
}
|
|
907
|
+
return r;
|
|
908
|
+
}
|
|
909
|
+
function Fn(e, t, n) {
|
|
910
|
+
if (e !== void 0) return Ke.test(e) || y("HT019", "`$ref` requires a valid non-empty name.", n), t.has(e) && y("HT019", `Reference \`${e}\` is duplicated.`, n), t.add(e), e;
|
|
911
|
+
}
|
|
912
|
+
function Bn(e, t, n) {
|
|
913
|
+
if (e === void 0) return;
|
|
914
|
+
let r = [], i = [];
|
|
915
|
+
e.$if !== void 0 && r.push("$if"), e.$each !== void 0 && r.push("$each"), e.$with !== void 0 && r.push("$with"), e.$match !== void 0 && r.push("$match"), e.$when !== void 0 && r.push("$when"), e.$else !== void 0 && r.push("$else"), e.$where !== void 0 && i.push("$where"), e.$sort !== void 0 && i.push("$sort"), e.$limit !== void 0 && i.push("$limit"), e.$key !== void 0 && i.push("$key"), r.length > 1 && y("HT014", `An element carries one structural directive; found ${r.join(", ")}.`, n);
|
|
916
|
+
let o = e.$each;
|
|
917
|
+
o === void 0 && i.length > 0 && y("HT014", `${i.join(", ")} may only modify \`$each\`.`, n);
|
|
918
|
+
let a = e.$if;
|
|
919
|
+
if (a !== void 0) {
|
|
920
|
+
let u = a;
|
|
921
|
+
return { kind: "if", test: u, testPlan: R(u, t, n) };
|
|
922
|
+
}
|
|
923
|
+
let s = e.$with;
|
|
924
|
+
if (s !== void 0) {
|
|
925
|
+
let u = kt.exec(s);
|
|
926
|
+
return u === null && y("HT015", "`$with` must be written `expr as name`.", n), { kind: "with", expr: u[1], expressionPlan: R(u[1], t, n), alias: u[2] };
|
|
927
|
+
}
|
|
928
|
+
if (o !== void 0) {
|
|
929
|
+
let u = Pn.exec(o);
|
|
930
|
+
u === null && y("HT016", "`$each` must be written `item of items` (optionally `item, i of items`).", n);
|
|
931
|
+
let l = u[1], m = u[2];
|
|
932
|
+
(t.roots.has(l) || m !== void 0 && t.roots.has(m)) && y("HC020", "Loop locals may not collide with an existing scope name.", n);
|
|
933
|
+
let f = Be(t, l, m, "loop"), h = { kind: "each", item: l, list: u[3], listPlan: R(u[3], t, n) };
|
|
934
|
+
m !== void 0 && (h.index = m);
|
|
935
|
+
let p = e.$where;
|
|
936
|
+
p !== void 0 && (h.where = p, h.wherePlan = R(p, f, n)), e.$sort !== void 0 && (h.sort = e.$sort);
|
|
937
|
+
let b = e.$limit;
|
|
938
|
+
b !== void 0 && (h.limit = b, h.limitPlan = R(b, f, n));
|
|
939
|
+
let x = e.$key;
|
|
940
|
+
return x !== void 0 && (h.key = x, h.keyPlan = R(x, f, n)), h;
|
|
941
|
+
}
|
|
942
|
+
let c = e.$match;
|
|
943
|
+
if (c !== void 0) {
|
|
944
|
+
let u = c.trim();
|
|
945
|
+
if (u === "") return { kind: "match" };
|
|
946
|
+
let l = kt.exec(u);
|
|
947
|
+
return l === null && y("HT017", "`$match` scope must be written `expr as name`.", n), { kind: "match", expr: l[1], expressionPlan: R(l[1], t, n), alias: l[2] };
|
|
948
|
+
}
|
|
949
|
+
let d = e.$when;
|
|
950
|
+
if (d !== void 0) {
|
|
951
|
+
let u = d;
|
|
952
|
+
return { kind: "when", test: u, testPlan: R(u, t, n) };
|
|
953
|
+
}
|
|
954
|
+
if (e.$else !== void 0) return { kind: "else" };
|
|
955
|
+
}
|
|
956
|
+
function Ze(e, t, n, r, i, o) {
|
|
957
|
+
let a = S(e);
|
|
958
|
+
gt(a) && y("HT009", `<${a}> is reserved but not supported by this profile.`, r), Ue(a, r);
|
|
959
|
+
let s, c = [], d, u;
|
|
960
|
+
for (let v of we(e)) Dn.test(v.name) ? (s ??= {})[v.name] = v.value : v.name === "$ref" ? u = v.value : v.name.startsWith("on:") ? (d ??= []).push(v) : v.name !== "as" && c.push(v);
|
|
961
|
+
let l = Bn(s, n, r), m = l?.kind === "each" ? Be(n, l.item, l.index, "loop") : l?.kind === "with" || l?.kind === "match" && l.alias !== void 0 ? Be(n, l.alias) : n, f = Un(c, a, t, m, r, o), h = Wn(d, m, r), p = Fn(u, i.refs, r), b = [], x = _(e);
|
|
962
|
+
for (let v of x) if (v.nodeName !== "#comment") {
|
|
963
|
+
if (se(v)) {
|
|
964
|
+
let g = ae(v);
|
|
965
|
+
g.trim() !== "" && b.push({ kind: "text", value: g });
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
if (z(v)) {
|
|
969
|
+
if (S(v) === "slot") {
|
|
970
|
+
let g = w(v, "name"), k = w(v, ":name");
|
|
971
|
+
g !== void 0 && k !== void 0 && y("HT008", "A slot cannot declare both `name` and `:name`.", r);
|
|
972
|
+
for (let M of we(v)) M.name !== "name" && M.name !== ":name" && y("HT008", "A slot has an unsupported attribute.", r);
|
|
973
|
+
g === void 0 && k === void 0 && (i.defaults += 1, i.defaults > 1 && y("HT008", "A component may declare one default slot.", r)), g !== void 0 && ((g === "" || i.names.has(g)) && y("HT008", `Slot name \`${g}\` is empty or duplicated.`, r), i.names.add(g));
|
|
974
|
+
let C = [];
|
|
975
|
+
for (let M of _(v)) if (M.nodeName !== "#comment") if (se(M)) {
|
|
976
|
+
let he = ae(M);
|
|
977
|
+
he.trim() !== "" && C.push({ kind: "text", value: he });
|
|
978
|
+
} else z(M) && C.push(Ze(M, t, m, r, i, o));
|
|
979
|
+
let O = { dynamic: k !== void 0, required: C.length === 0 };
|
|
980
|
+
if (g !== void 0 && (O.name = g), i.contracts.push(O), g === void 0 && k === void 0 && C.length === 0) b.push({ kind: "slot" });
|
|
981
|
+
else {
|
|
982
|
+
let M = { kind: "slot", fallback: C };
|
|
983
|
+
g !== void 0 && (M.name = g), k !== void 0 && (M.nameExpression = R(k, m, r)), b.push(M);
|
|
984
|
+
}
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
b.push(Ze(v, t, m, r, i, o));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
if (f.some((v) => v.kind === "directive") && b.length > 0 && y("HT006", "A content directive cannot coexist with children.", r), f.some((v) => v.kind === "property" && v.name === "textContent") && b.length > 0 && y("HT006", "A content-replacing property binding cannot coexist with children.", r), l?.kind === "match") {
|
|
991
|
+
let v = 0;
|
|
992
|
+
for (let k of b) k.kind === "element" && (v += 1);
|
|
993
|
+
let g = false;
|
|
994
|
+
for (let k of b) k.kind === "element" && (v -= 1, k.flow?.kind === "when" ? g && y("HT018", "A `$when` arm may not follow `$else`.", r) : k.flow?.kind === "else" ? (g && y("HT018", "A `$match` has at most one `$else`.", r), g = true, v !== 0 && y("HT018", "`$else` must be the last arm.", r)) : y("HT018", "Every direct child of a `$match` must be a `$when` or `$else` arm.", r));
|
|
995
|
+
}
|
|
996
|
+
let E = { kind: "element", name: a, attributes: f, children: b };
|
|
997
|
+
return l !== void 0 && (E.flow = l), h !== void 0 && (E.events = h), p !== void 0 && (E.ref = p), E;
|
|
998
|
+
}
|
|
999
|
+
function Ct(e, t, n) {
|
|
1000
|
+
let r = wt(e);
|
|
1001
|
+
(r.length !== 1 || !z(r[0]) || S(r[0]) !== "template" || w(r[0], "component") === void 0) && y("HS001", "A source must contain exactly one top-level <template component>.", t);
|
|
1002
|
+
let i = r[0], o, a = false, s, c;
|
|
1003
|
+
for (let g of _(i)) {
|
|
1004
|
+
if (g.nodeName === "#comment" || se(g) && ae(g).trim() === "") continue;
|
|
1005
|
+
z(g) || y("HT001", "A component's markup must be exactly one element root.", t);
|
|
1006
|
+
let k = S(g);
|
|
1007
|
+
k === "props" || k === "defs" ? (o !== void 0 && y("HS002", "A component has one optional declaration group, one markup root, and one optional <style>.", t), o = g, a = k === "props", Tt(g, t)) : k === "style" ? (s !== void 0 && y("HS002", "A component has one optional declaration group, one markup root, and one optional <style>.", t), s = g) : c === void 0 ? c = g : y("HT001", "A component's markup must be exactly one element root.", t);
|
|
1008
|
+
}
|
|
1009
|
+
c === void 0 && y("HT001", "A component's markup must be exactly one element root.", t);
|
|
1010
|
+
let d = S(c), u = (w(c, "as") ?? d).split("|");
|
|
1011
|
+
for (let g = u.length - 1; g >= 0; g -= 1) u[g] = u[g].trim(), u[g] === "" && u.splice(g, 1);
|
|
1012
|
+
let l = !n.isNativeElement(d);
|
|
1013
|
+
l && w(c, "as") !== void 0 && y("HT021", "A delegated component root cannot also declare native `as` choices.", t), !l && (u.length === 0 || !u.includes(d) || u.some((g, k) => u.indexOf(g) !== k) || u.some((g) => !n.isNativeElement(g))) && y("HT021", "A polymorphic root must list unique native choices including its markup root.", t);
|
|
1014
|
+
let m = On(c, t, n), f = Vn(i, o, d, l, m, t, a), { declarations: h, scope: p } = qn(a ? void 0 : o, f, t), b = { defaults: 0, names: /* @__PURE__ */ new Set(), contracts: [], refs: /* @__PURE__ */ new Set() }, x = Ze(c, f, p, t, b, n), E = w(i, "controller");
|
|
1015
|
+
E === "" && y("HC022", "A controller specifier cannot be empty.", t);
|
|
1016
|
+
let v = { source: { file: t }, contract: f, template: x, css: s === void 0 ? "" : xt(s).trim(), declarations: h, slots: b.contracts, root: l ? { kind: "component", tag: d } : { kind: "native", element: d, choices: u } };
|
|
1017
|
+
return E !== void 0 && (v.controller = E), Q(v);
|
|
1018
|
+
}
|
|
1019
|
+
var Rt = /* @__PURE__ */ new WeakMap();
|
|
1020
|
+
function Zn(e) {
|
|
1021
|
+
let t = {}, n = {}, r = (i) => {
|
|
1022
|
+
if (i.includes("-")) return false;
|
|
1023
|
+
if (Object.hasOwn(t, i)) return t[i];
|
|
1024
|
+
let o = e.createElement(i), a = e.defaultView?.HTMLUnknownElement, s = a === void 0 ? o.constructor.name !== "HTMLUnknownElement" : !(o instanceof a);
|
|
1025
|
+
return t[i] = s, s;
|
|
1026
|
+
};
|
|
1027
|
+
return { isNativeElement: r, resolveDomProperty(i, o) {
|
|
1028
|
+
if (!r(i)) return;
|
|
1029
|
+
let a = `${i}:${o}`;
|
|
1030
|
+
if (a in n) return n[a] || void 0;
|
|
1031
|
+
let s = e.createElement(i), c = o.toLowerCase();
|
|
1032
|
+
for (; s !== null; ) {
|
|
1033
|
+
for (let d of Object.getOwnPropertyNames(s)) if (d.toLowerCase() === c) return n[a] = d, d;
|
|
1034
|
+
s = Object.getPrototypeOf(s);
|
|
1035
|
+
}
|
|
1036
|
+
n[a] = "";
|
|
1037
|
+
} };
|
|
1038
|
+
}
|
|
1039
|
+
function St(e, t = e.ownerDocument.URL) {
|
|
1040
|
+
(e.localName !== "template" || !e.hasAttribute("component")) && y("HS001", "A browser component carrier must be a <template component>.", t);
|
|
1041
|
+
let n = e.ownerDocument, r = Rt.get(n);
|
|
1042
|
+
return r === void 0 && (r = Zn(n), Rt.set(n, r)), Ct([e], t, r);
|
|
1043
|
+
}
|
|
1044
|
+
function Kn(e, t, n) {
|
|
1045
|
+
let r = /* @__PURE__ */ new Set(), i = e.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g, (a, s) => {
|
|
1046
|
+
r.add(s);
|
|
1047
|
+
let c = n[s];
|
|
1048
|
+
return c == null ? "" : encodeURIComponent(String(c));
|
|
1049
|
+
}), o = new URL(i, t);
|
|
1050
|
+
for (let [a, s] of Object.entries(n)) if (!(r.has(a) || s == null)) if (Array.isArray(s)) for (let c of s) o.searchParams.append(a, String(c));
|
|
1051
|
+
else o.searchParams.set(a, String(s));
|
|
1052
|
+
return o.href;
|
|
1053
|
+
}
|
|
1054
|
+
var xe = class {
|
|
1055
|
+
constructor(t) {
|
|
1056
|
+
this.options = t;
|
|
1057
|
+
this.#e = t.fetch ?? globalThis.fetch.bind(globalThis), this.#n = t.setTimer ?? ((n, r) => setTimeout(n, r)), this.#t = t.clearTimer ?? ((n) => clearTimeout(n));
|
|
1058
|
+
}
|
|
1059
|
+
options;
|
|
1060
|
+
#e;
|
|
1061
|
+
#n;
|
|
1062
|
+
#t;
|
|
1063
|
+
#i = {};
|
|
1064
|
+
#o;
|
|
1065
|
+
#r;
|
|
1066
|
+
#c = 0;
|
|
1067
|
+
#s = false;
|
|
1068
|
+
update(t) {
|
|
1069
|
+
this.#i = { ...t }, this.#s = true, this.#a();
|
|
1070
|
+
let n = ++this.#c, r = () => {
|
|
1071
|
+
this.#l(n);
|
|
1072
|
+
};
|
|
1073
|
+
(this.options.debounce ?? 0) > 0 ? this.#r = this.#n(r, this.options.debounce) : r();
|
|
1074
|
+
}
|
|
1075
|
+
disconnect() {
|
|
1076
|
+
this.#s && (this.#s = false, this.#c += 1, this.#a());
|
|
1077
|
+
}
|
|
1078
|
+
#a() {
|
|
1079
|
+
this.#o?.abort(), this.#o = void 0, this.#r !== void 0 && this.#t(this.#r), this.#r = void 0;
|
|
1080
|
+
}
|
|
1081
|
+
#d(t) {
|
|
1082
|
+
return !this.#s || t !== this.#c;
|
|
1083
|
+
}
|
|
1084
|
+
async #l(t) {
|
|
1085
|
+
if (this.#d(t)) return;
|
|
1086
|
+
let n = new AbortController();
|
|
1087
|
+
this.#o = n;
|
|
1088
|
+
let r = this.options;
|
|
1089
|
+
r.onState({ pending: true, value: null, error: null, ok: false });
|
|
1090
|
+
try {
|
|
1091
|
+
let i = await this.#e(Kn(r.source, r.baseURL, this.#i), { signal: n.signal });
|
|
1092
|
+
if (!i.ok) throw new TypeError(`Request failed with ${i.status}.`);
|
|
1093
|
+
let o = r.type === "text" ? await i.text() : await i.json(), a = r.adapt === void 0 ? o : r.adapt(o);
|
|
1094
|
+
if (this.#d(t)) return;
|
|
1095
|
+
r.onState({ pending: false, value: a, error: null, ok: true });
|
|
1096
|
+
} catch (i) {
|
|
1097
|
+
if (n.signal.aborted || this.#d(t)) return;
|
|
1098
|
+
r.onState({ pending: false, value: null, error: i, ok: false });
|
|
1099
|
+
} finally {
|
|
1100
|
+
this.#o === n && (this.#o = void 0), !this.#d(t) && (r.poll ?? 0) > 0 && (this.#r = this.#n(() => {
|
|
1101
|
+
this.#l(t);
|
|
1102
|
+
}, r.poll));
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
var N, Jn = 0, Nt = 100, Je = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap();
|
|
1107
|
+
function $t(e) {
|
|
1108
|
+
let { dependency: t, previousSubscriber: n, nextSubscriber: r } = e;
|
|
1109
|
+
n === void 0 ? t.first = r : n.nextSubscriber = r, r === void 0 ? t.last = n : r.previousSubscriber = n;
|
|
1110
|
+
}
|
|
1111
|
+
function At(e) {
|
|
1112
|
+
if (e.length > 8) return [];
|
|
1113
|
+
for (; e.length > 0; ) e.pop();
|
|
1114
|
+
return e;
|
|
1115
|
+
}
|
|
1116
|
+
var Ge = class {
|
|
1117
|
+
#e = [];
|
|
1118
|
+
#n = [];
|
|
1119
|
+
#t = false;
|
|
1120
|
+
#i = false;
|
|
1121
|
+
enqueue(t) {
|
|
1122
|
+
t.stopped || t.queued || (t.queued = true, this.#e.push(t), !this.#t && !this.#i && (this.#t = true, queueMicrotask(() => {
|
|
1123
|
+
this.#t = false, this.flush();
|
|
1124
|
+
})));
|
|
1125
|
+
}
|
|
1126
|
+
enqueueDependency(t) {
|
|
1127
|
+
if (this.#i || this.#e.length > 0) return false;
|
|
1128
|
+
for (let n = t.first; n !== void 0; n = n.nextSubscriber) {
|
|
1129
|
+
let r = n.effect;
|
|
1130
|
+
if (r.scheduler !== this) {
|
|
1131
|
+
for (let i of this.#e) i.queued = false;
|
|
1132
|
+
return this.#e = [], false;
|
|
1133
|
+
}
|
|
1134
|
+
r.queued || (r.queued = true, this.#e.push(r));
|
|
1135
|
+
}
|
|
1136
|
+
return this.#t || (this.#t = true, queueMicrotask(() => {
|
|
1137
|
+
this.#t = false, this.flush();
|
|
1138
|
+
})), true;
|
|
1139
|
+
}
|
|
1140
|
+
flush() {
|
|
1141
|
+
this.#i || this.#e.length === 0 || this.#o();
|
|
1142
|
+
}
|
|
1143
|
+
#o() {
|
|
1144
|
+
this.#i = true;
|
|
1145
|
+
let t = 0, n, r = 0;
|
|
1146
|
+
try {
|
|
1147
|
+
for (; this.#e.length > 0; ) {
|
|
1148
|
+
if (t += 1, t > Nt) {
|
|
1149
|
+
for (let i of this.#e) i.queued = false;
|
|
1150
|
+
this.#e = [], y("HR006", "A reactive flush exceeded the propagation-depth limit.");
|
|
1151
|
+
}
|
|
1152
|
+
if (n = this.#e, n.length > 1) {
|
|
1153
|
+
let i = 1, o = n[0];
|
|
1154
|
+
for (; i < n.length; ) {
|
|
1155
|
+
let a = n[i];
|
|
1156
|
+
if (o.priority > a.priority || o.priority === a.priority && o.id > a.id) break;
|
|
1157
|
+
o = a, i += 1;
|
|
1158
|
+
}
|
|
1159
|
+
i < n.length && n.sort((a, s) => a.priority - s.priority || a.id - s.id);
|
|
1160
|
+
}
|
|
1161
|
+
this.#e = this.#n, r = 0;
|
|
1162
|
+
do {
|
|
1163
|
+
let i = n[r];
|
|
1164
|
+
if (i.queued = false, r += 1, i.computed === void 0 ? i.execute() : i.computed.refresh(), this.#e.length === 1 && r === n.length && this.#e[0].computed === void 0) {
|
|
1165
|
+
t += 1, t > Nt && (this.#e[0].queued = false, this.#e = [], y("HR006", "A reactive flush exceeded the propagation-depth limit."));
|
|
1166
|
+
let o = this.#e;
|
|
1167
|
+
this.#e = At(n), n = o, r = 0;
|
|
1168
|
+
} else this.#e.length > 0 && this.#r(n, r);
|
|
1169
|
+
} while (r < n.length);
|
|
1170
|
+
this.#n = At(n), n = void 0;
|
|
1171
|
+
}
|
|
1172
|
+
} finally {
|
|
1173
|
+
if (n !== void 0) {
|
|
1174
|
+
for (; r < n.length; ) n[r++].queued = false;
|
|
1175
|
+
this.#n = [];
|
|
1176
|
+
}
|
|
1177
|
+
if (this.#e.length > 0) {
|
|
1178
|
+
for (let i of this.#e) i.queued = false;
|
|
1179
|
+
this.#e = [];
|
|
1180
|
+
}
|
|
1181
|
+
this.#i = false;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
#r(t, n) {
|
|
1185
|
+
if (this.#e.some((r) => r.computed !== void 0)) for (let r = t.length - 1; r >= n; r -= 1) {
|
|
1186
|
+
let i = t[r];
|
|
1187
|
+
i.computed === void 0 && (t.splice(r, 1), this.#e.push(i));
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}, Te = class {
|
|
1191
|
+
constructor(t, n, r, i) {
|
|
1192
|
+
this.scheduler = t;
|
|
1193
|
+
this.run = n;
|
|
1194
|
+
this.priority = r;
|
|
1195
|
+
this.computed = i;
|
|
1196
|
+
}
|
|
1197
|
+
scheduler;
|
|
1198
|
+
run;
|
|
1199
|
+
priority;
|
|
1200
|
+
computed;
|
|
1201
|
+
id = Jn++;
|
|
1202
|
+
dependencies = void 0;
|
|
1203
|
+
stopped = false;
|
|
1204
|
+
paused = false;
|
|
1205
|
+
queued = false;
|
|
1206
|
+
#e = void 0;
|
|
1207
|
+
#n = void 0;
|
|
1208
|
+
execute() {
|
|
1209
|
+
if (this.stopped || this.paused) return;
|
|
1210
|
+
if (this.#n = void 0, this.#e !== void 0) {
|
|
1211
|
+
let n = this.#e;
|
|
1212
|
+
this.#e = void 0, n();
|
|
1213
|
+
}
|
|
1214
|
+
let t = N;
|
|
1215
|
+
N = this;
|
|
1216
|
+
try {
|
|
1217
|
+
let n = this.run();
|
|
1218
|
+
n !== void 0 && (this.#e = n);
|
|
1219
|
+
} finally {
|
|
1220
|
+
N = t;
|
|
1221
|
+
let n = this.#n, r = n === void 0 ? this.dependencies : n.nextDependency;
|
|
1222
|
+
for (n === void 0 ? this.dependencies = void 0 : n.nextDependency = void 0; r !== void 0; ) {
|
|
1223
|
+
let i = r.nextDependency;
|
|
1224
|
+
$t(r), r = i;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
track(t) {
|
|
1229
|
+
let n = this.#n === void 0 ? this.dependencies : this.#n.nextDependency;
|
|
1230
|
+
if (n?.dependency === t) {
|
|
1231
|
+
this.#n = n;
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
for (let o = this.dependencies; o !== n; o = o?.nextDependency) if (o?.dependency === t) return;
|
|
1235
|
+
let r = { dependency: t, effect: this, nextDependency: n, previousSubscriber: void 0, nextSubscriber: void 0 };
|
|
1236
|
+
this.#n === void 0 ? this.dependencies = r : this.#n.nextDependency = r, this.#n = r;
|
|
1237
|
+
let i = t.first;
|
|
1238
|
+
if (this.computed !== void 0 && i !== void 0) r.nextSubscriber = i, i.previousSubscriber = r, t.first = r;
|
|
1239
|
+
else {
|
|
1240
|
+
let o = t.last;
|
|
1241
|
+
r.previousSubscriber = o, o === void 0 ? t.first = r : o.nextSubscriber = r, t.last = r;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
schedule() {
|
|
1245
|
+
if (this.computed !== void 0) {
|
|
1246
|
+
this.computed.invalidate();
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
this.paused || this.scheduler.enqueue(this);
|
|
1250
|
+
}
|
|
1251
|
+
pause() {
|
|
1252
|
+
this.stopped || this.paused || (this.paused = true, this.#t(), this.#e?.(), this.#e = void 0);
|
|
1253
|
+
}
|
|
1254
|
+
resume() {
|
|
1255
|
+
this.stopped || !this.paused || (this.paused = false, this.execute());
|
|
1256
|
+
}
|
|
1257
|
+
stop() {
|
|
1258
|
+
this.stopped || (this.stopped = true, this.#t(), this.#e?.(), this.#e = void 0);
|
|
1259
|
+
}
|
|
1260
|
+
#t() {
|
|
1261
|
+
let t = this.dependencies;
|
|
1262
|
+
for (; t !== void 0; ) {
|
|
1263
|
+
let n = t.nextDependency;
|
|
1264
|
+
$t(t), t = n;
|
|
1265
|
+
}
|
|
1266
|
+
this.dependencies = void 0, this.#n = void 0;
|
|
1267
|
+
}
|
|
1268
|
+
}, Qe = class {
|
|
1269
|
+
#e = { first: void 0, last: void 0 };
|
|
1270
|
+
#n;
|
|
1271
|
+
constructor(t) {
|
|
1272
|
+
this.#n = t;
|
|
1273
|
+
}
|
|
1274
|
+
get() {
|
|
1275
|
+
return N !== void 0 && N.track(this.#e), this.#n;
|
|
1276
|
+
}
|
|
1277
|
+
set(t) {
|
|
1278
|
+
Object.is(this.#n, t) || (this.#n = t, K(this.#e));
|
|
1279
|
+
}
|
|
1280
|
+
update(t) {
|
|
1281
|
+
this.set(t(this.#n));
|
|
1282
|
+
}
|
|
1283
|
+
}, Ce = class {
|
|
1284
|
+
#e;
|
|
1285
|
+
#n;
|
|
1286
|
+
#t;
|
|
1287
|
+
#i;
|
|
1288
|
+
#o = false;
|
|
1289
|
+
#r = true;
|
|
1290
|
+
#c = false;
|
|
1291
|
+
#s = false;
|
|
1292
|
+
constructor(t, n, r = { first: void 0, last: void 0 }) {
|
|
1293
|
+
this.#e = r, this.#n = n, this.#t = new Te(t, () => this.#l(), 0, this);
|
|
1294
|
+
}
|
|
1295
|
+
get() {
|
|
1296
|
+
return this.#t.paused || this.#t.stopped ? this.#d() : (this.#a(), N !== void 0 && N.track(this.#e), this.#i);
|
|
1297
|
+
}
|
|
1298
|
+
invalidate() {
|
|
1299
|
+
if (!(this.#t.stopped || this.#r)) {
|
|
1300
|
+
this.#r = true;
|
|
1301
|
+
for (let t = this.#e.first; t !== void 0; t = t.nextSubscriber) if (t.effect.computed === void 0) {
|
|
1302
|
+
this.#t.scheduler.enqueue(this.#t);
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
K(this.#e);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
refresh() {
|
|
1309
|
+
this.#a();
|
|
1310
|
+
}
|
|
1311
|
+
pause() {
|
|
1312
|
+
this.#t.stopped || this.#t.paused || (this.#r = true, this.#t.pause());
|
|
1313
|
+
}
|
|
1314
|
+
resume() {
|
|
1315
|
+
this.#t.stopped || !this.#t.paused || (this.#t.paused = false);
|
|
1316
|
+
}
|
|
1317
|
+
stop() {
|
|
1318
|
+
this.#t.stop();
|
|
1319
|
+
}
|
|
1320
|
+
#a() {
|
|
1321
|
+
if (this.#c && y("HR006", "A reactive computed value depends on itself."), !this.#r || this.#t.stopped || this.#t.paused) return;
|
|
1322
|
+
let t = this.#o;
|
|
1323
|
+
this.#t.execute(), t && this.#s && K(this.#e, N?.computed === void 0 ? void 0 : N);
|
|
1324
|
+
}
|
|
1325
|
+
#d() {
|
|
1326
|
+
this.#c && y("HR006", "A reactive computed value depends on itself.");
|
|
1327
|
+
let t = N;
|
|
1328
|
+
this.#c = true, N = void 0;
|
|
1329
|
+
try {
|
|
1330
|
+
return this.#n();
|
|
1331
|
+
} finally {
|
|
1332
|
+
N = t, this.#c = false;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
#l() {
|
|
1336
|
+
this.#c = true, this.#r = false;
|
|
1337
|
+
try {
|
|
1338
|
+
let t = this.#n();
|
|
1339
|
+
this.#s = !this.#o || !Object.is(this.#i, t), this.#i = t, this.#o = true;
|
|
1340
|
+
} catch (t) {
|
|
1341
|
+
throw this.#r = true, t;
|
|
1342
|
+
} finally {
|
|
1343
|
+
this.#c = false;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
function K(e, t) {
|
|
1348
|
+
let n = e?.first;
|
|
1349
|
+
if (n === void 0) return;
|
|
1350
|
+
let r = n !== e.last;
|
|
1351
|
+
if (!r && n.effect.computed !== void 0) {
|
|
1352
|
+
n.effect !== t && n.effect.computed.invalidate();
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
if (n.effect.computed === void 0) {
|
|
1356
|
+
if (t === void 0 && r && n.effect.scheduler.enqueueDependency(e)) return;
|
|
1357
|
+
for (let i = n; i !== void 0; ) {
|
|
1358
|
+
let o = i.nextSubscriber;
|
|
1359
|
+
i.effect !== t && i.effect.schedule(), i = o;
|
|
1360
|
+
}
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
for (let i = n; i !== void 0; ) {
|
|
1364
|
+
let o = i.nextSubscriber;
|
|
1365
|
+
i.effect !== t && i.effect.schedule(), i = o;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function Ht(e) {
|
|
1369
|
+
return new Qe(e);
|
|
1370
|
+
}
|
|
1371
|
+
function Mt(e, t) {
|
|
1372
|
+
return new Ce(e, t);
|
|
1373
|
+
}
|
|
1374
|
+
function ce(e, t, n = 1, r = true) {
|
|
1375
|
+
let i = new Te(e, t, n);
|
|
1376
|
+
return r ? i.execute() : i.paused = true, i;
|
|
1377
|
+
}
|
|
1378
|
+
var Re = class e {
|
|
1379
|
+
constructor(t = [], n = new Ge(), r) {
|
|
1380
|
+
this.scheduler = n;
|
|
1381
|
+
this.parent = r;
|
|
1382
|
+
for (let [i, o] of t) this.set(i, o);
|
|
1383
|
+
}
|
|
1384
|
+
scheduler;
|
|
1385
|
+
parent;
|
|
1386
|
+
#e = /* @__PURE__ */ new Map();
|
|
1387
|
+
#n;
|
|
1388
|
+
#t;
|
|
1389
|
+
has(t) {
|
|
1390
|
+
return this.#i(t) !== void 0 || this.parent?.has(t) === true;
|
|
1391
|
+
}
|
|
1392
|
+
get(t) {
|
|
1393
|
+
let n = this.#i(t);
|
|
1394
|
+
return n === void 0 ? this.parent?.get(t) : (N !== void 0 && N.track(n), n.value);
|
|
1395
|
+
}
|
|
1396
|
+
set(t, n) {
|
|
1397
|
+
let r = this.#r(n), i = this.#i(t);
|
|
1398
|
+
if (i === void 0) {
|
|
1399
|
+
i = { value: r, first: void 0, last: void 0 }, this.#e.set(t, i), this.#t = i;
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
Object.is(i.value, r) || (i.value = r, K(i));
|
|
1403
|
+
}
|
|
1404
|
+
defineComputed(t, n) {
|
|
1405
|
+
let r = this.#i(t);
|
|
1406
|
+
r === void 0 && (r = { value: null, first: void 0, last: void 0 }, this.#e.set(t, r), this.#t = r);
|
|
1407
|
+
let i = new Ce(this.scheduler, () => this.#r(n()), r);
|
|
1408
|
+
return r.computed = i, Object.hasOwn(this, "get") || (this.get = this.#o), i;
|
|
1409
|
+
}
|
|
1410
|
+
fork(t = []) {
|
|
1411
|
+
return new e(t, this.scheduler, this);
|
|
1412
|
+
}
|
|
1413
|
+
#i(t) {
|
|
1414
|
+
return t !== this.#n && (this.#n = t, this.#t = this.#e.get(t)), this.#t;
|
|
1415
|
+
}
|
|
1416
|
+
#o(t) {
|
|
1417
|
+
let n = this.#i(t);
|
|
1418
|
+
return n === void 0 ? this.parent?.get(t) : n.computed !== void 0 ? n.computed.get() : (N !== void 0 && N.track(n), n.value);
|
|
1419
|
+
}
|
|
1420
|
+
#r(t) {
|
|
1421
|
+
if (t === null || typeof t != "object") return t;
|
|
1422
|
+
let n = Je.get(t);
|
|
1423
|
+
if (n !== void 0) return n;
|
|
1424
|
+
let r = new Proxy(t, { get: (i, o, a) => {
|
|
1425
|
+
if (N !== void 0) {
|
|
1426
|
+
let s = Ee.get(i);
|
|
1427
|
+
s === void 0 && (s = /* @__PURE__ */ new Map(), Ee.set(i, s));
|
|
1428
|
+
let c = s.get(o);
|
|
1429
|
+
c === void 0 && (c = { first: void 0, last: void 0 }, s.set(o, c)), N.track(c);
|
|
1430
|
+
}
|
|
1431
|
+
return this.#r(Reflect.get(i, o, a));
|
|
1432
|
+
}, set: (i, o, a, s) => {
|
|
1433
|
+
let c = Reflect.get(i, o, s), d = this.#r(a), u = Reflect.set(i, o, d, s);
|
|
1434
|
+
return Object.is(c, d) || K(Ee.get(i)?.get(o)), u;
|
|
1435
|
+
}, deleteProperty: (i, o) => {
|
|
1436
|
+
let a = Reflect.has(i, o), s = Reflect.deleteProperty(i, o);
|
|
1437
|
+
return a && K(Ee.get(i)?.get(o)), s;
|
|
1438
|
+
} });
|
|
1439
|
+
return Je.set(t, r), Je.set(r, r), r;
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
var Dt = "data-component", G = "data-component-root", J = "data-slotted", Gn = [[":user-invalid", ":is(:user-invalid, [data-user-invalid])"], [":invalid", ":is(:invalid, [data-invalid])"], [":valid", ":is(:valid, [data-valid])"]], Qn = /* @__PURE__ */ new Set(["container", "document", "layer", "media", "scope", "starting-style", "supports"]), Yn = /* @__PURE__ */ new Set(["has", "is", "not", "where"]);
|
|
1443
|
+
function Ye(e) {
|
|
1444
|
+
return e !== void 0 && /[A-Za-z0-9_-]/.test(e);
|
|
1445
|
+
}
|
|
1446
|
+
function q(e, t) {
|
|
1447
|
+
let n = e[t], r = t + 1;
|
|
1448
|
+
for (; r < e.length; ) if (e[r] === "\\") r += 2;
|
|
1449
|
+
else {
|
|
1450
|
+
if (e[r] === n) return r;
|
|
1451
|
+
r += 1;
|
|
1452
|
+
}
|
|
1453
|
+
return e.length - 1;
|
|
1454
|
+
}
|
|
1455
|
+
function Pt(e, t) {
|
|
1456
|
+
let n = 1, r = 0;
|
|
1457
|
+
for (let i = t + 1; i < e.length; i += 1) {
|
|
1458
|
+
let o = e[i];
|
|
1459
|
+
if (o === '"' || o === "'") {
|
|
1460
|
+
i = q(e, i);
|
|
1461
|
+
continue;
|
|
1462
|
+
}
|
|
1463
|
+
if (o === "/" && e[i + 1] === "*") {
|
|
1464
|
+
let a = e.indexOf("*/", i + 2);
|
|
1465
|
+
if (a === -1) return e.length - 1;
|
|
1466
|
+
i = a + 1;
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
if (o === "[") r += 1;
|
|
1470
|
+
else if (o === "]") r = Math.max(0, r - 1);
|
|
1471
|
+
else if (r === 0 && o === "(") n += 1;
|
|
1472
|
+
else if (r === 0 && o === ")" && --n === 0) return i;
|
|
1473
|
+
}
|
|
1474
|
+
return e.length - 1;
|
|
1475
|
+
}
|
|
1476
|
+
function jt(e) {
|
|
1477
|
+
let t = [], n = 0, r = 0, i = 0;
|
|
1478
|
+
for (let o = 0; o < e.length; o += 1) {
|
|
1479
|
+
let a = e[o];
|
|
1480
|
+
if (a === '"' || a === "'") o = q(e, o);
|
|
1481
|
+
else if (a === "/" && e[o + 1] === "*") {
|
|
1482
|
+
let s = e.indexOf("*/", o + 2);
|
|
1483
|
+
if (s === -1) break;
|
|
1484
|
+
o = s + 1;
|
|
1485
|
+
} else a === "[" ? i += 1 : a === "]" ? i = Math.max(0, i - 1) : i === 0 && a === "(" ? r += 1 : i === 0 && a === ")" ? r = Math.max(0, r - 1) : i === 0 && r === 0 && a === "," && (t.push(e.slice(n, o)), n = o + 1);
|
|
1486
|
+
}
|
|
1487
|
+
return t.push(e.slice(n)), t;
|
|
1488
|
+
}
|
|
1489
|
+
function Xn(e) {
|
|
1490
|
+
let t = 0, n = 0, r = 0;
|
|
1491
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
1492
|
+
let o = e[i];
|
|
1493
|
+
if (o === '"' || o === "'") i = q(e, i);
|
|
1494
|
+
else if (o === "/" && e[i + 1] === "*") {
|
|
1495
|
+
let a = e.indexOf("*/", i + 2);
|
|
1496
|
+
if (a === -1) return t;
|
|
1497
|
+
i = a + 1;
|
|
1498
|
+
} else if (o === "[") r += 1;
|
|
1499
|
+
else if (o === "]") r = Math.max(0, r - 1);
|
|
1500
|
+
else if (r === 0 && o === "(") n += 1;
|
|
1501
|
+
else if (r === 0 && o === ")") n = Math.max(0, n - 1);
|
|
1502
|
+
else if (r === 0 && n === 0) {
|
|
1503
|
+
if (o === ">" || o === "+" || o === "~") t = i + 1;
|
|
1504
|
+
else if (/\s/.test(o)) {
|
|
1505
|
+
let a = i;
|
|
1506
|
+
for (; a + 1 < e.length && /\s/.test(e[a + 1]); ) a += 1;
|
|
1507
|
+
e[a + 1] !== void 0 && !/[>+~]/.test(e[a + 1]) && (t = a + 1), i = a;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
for (; t < e.length && /\s/.test(e[t]); ) t += 1;
|
|
1512
|
+
return t;
|
|
1513
|
+
}
|
|
1514
|
+
function er(e) {
|
|
1515
|
+
let t = 0, n = 0;
|
|
1516
|
+
for (let r = 0; r < e.length - 1; r += 1) {
|
|
1517
|
+
let i = e[r];
|
|
1518
|
+
if (i === '"' || i === "'") r = q(e, r);
|
|
1519
|
+
else if (i === "[") n += 1;
|
|
1520
|
+
else if (i === "]") n = Math.max(0, n - 1);
|
|
1521
|
+
else if (n === 0 && i === "(") t += 1;
|
|
1522
|
+
else if (n === 0 && i === ")") t = Math.max(0, t - 1);
|
|
1523
|
+
else if (n === 0 && t === 0 && i === ":" && e[r + 1] === ":") return r;
|
|
1524
|
+
}
|
|
1525
|
+
return e.length;
|
|
1526
|
+
}
|
|
1527
|
+
function tr(e, t) {
|
|
1528
|
+
let n = `:where([${Dt}~="${t}"])`, r = e.search(/\s*$/), i = e.slice(0, r), o = e.slice(r), a = Xn(i), s = i.slice(a);
|
|
1529
|
+
if (s.includes(n)) return e;
|
|
1530
|
+
let c = er(s);
|
|
1531
|
+
return `${i.slice(0, a)}${s.slice(0, c)}${n}${s.slice(c)}${o}`;
|
|
1532
|
+
}
|
|
1533
|
+
function nr(e, t, n, r, i) {
|
|
1534
|
+
let o = "", a = true;
|
|
1535
|
+
for (let s = 0; s < e.length; ) {
|
|
1536
|
+
let c = e[s];
|
|
1537
|
+
if (c === '"' || c === "'") {
|
|
1538
|
+
let d = q(e, s) + 1;
|
|
1539
|
+
o += e.slice(s, d), s = d;
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
if (c === "/" && e[s + 1] === "*") {
|
|
1543
|
+
let d = e.indexOf("*/", s + 2), u = d === -1 ? e.length : d + 2;
|
|
1544
|
+
o += e.slice(s, u), s = u;
|
|
1545
|
+
continue;
|
|
1546
|
+
}
|
|
1547
|
+
if (c === "[") {
|
|
1548
|
+
let d = s + 1;
|
|
1549
|
+
for (; d < e.length; ) {
|
|
1550
|
+
let u = e[d];
|
|
1551
|
+
if (u === '"' || u === "'") {
|
|
1552
|
+
d = q(e, d) + 1;
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
if (d += 1, u === "]") break;
|
|
1556
|
+
}
|
|
1557
|
+
o += e.slice(s, d), s = d, a = false;
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
if (c === ":") {
|
|
1561
|
+
let d = s + 1;
|
|
1562
|
+
for (; Ye(e[d]); ) d += 1;
|
|
1563
|
+
let u = e.slice(s + 1, d).toLowerCase();
|
|
1564
|
+
if (i) {
|
|
1565
|
+
let l = false;
|
|
1566
|
+
for (let [m, f] of Gn) {
|
|
1567
|
+
if (e.startsWith(f, s)) {
|
|
1568
|
+
o += f, s += f.length, a = false, l = true;
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
if (e.startsWith(m, s) && !Ye(e[s + m.length])) {
|
|
1572
|
+
o += f, s += m.length, a = false, l = true;
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
if (l) continue;
|
|
1577
|
+
}
|
|
1578
|
+
if (u === "scope" && t !== void 0 && n === "attribute") {
|
|
1579
|
+
o += `:is(:where([${G}~="${t}"]), ${t})`, s = d, a = false;
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
if (e[d] === "(") {
|
|
1583
|
+
let l = Pt(e, d), m = e.slice(d + 1, l), f = Yn.has(u) ? Lt(m, t, n, r, u === "has" && t !== void 0, i) : m;
|
|
1584
|
+
o += `${e.slice(s, d + 1)}${f})`, s = l + 1;
|
|
1585
|
+
} else o += e.slice(s, d), s = d;
|
|
1586
|
+
a = false;
|
|
1587
|
+
continue;
|
|
1588
|
+
}
|
|
1589
|
+
if (a && /[A-Za-z]/.test(c)) {
|
|
1590
|
+
let d = s + 1;
|
|
1591
|
+
for (; Ye(e[d]); ) d += 1;
|
|
1592
|
+
let u = e.slice(s, d), l = u.includes("-") ? `:is(:where([${G}~="${u.toLowerCase()}"]), ${u})` : u;
|
|
1593
|
+
o += n === "scope" && u.toLowerCase() === r?.toLowerCase() ? `:is(${l}, :where(:scope))` : l, s = d, a = false;
|
|
1594
|
+
continue;
|
|
1595
|
+
}
|
|
1596
|
+
o += c, s += 1, c === "," || c === ">" || c === "+" || c === "~" || /\s/.test(c) ? a = true : c !== "|" && (a = false);
|
|
1597
|
+
}
|
|
1598
|
+
return o;
|
|
1599
|
+
}
|
|
1600
|
+
function Lt(e, t, n, r, i, o = false) {
|
|
1601
|
+
return jt(e).map((a) => {
|
|
1602
|
+
let s = /^\s*/.exec(a)[0], c = /\s*$/.exec(a)[0], d = a.slice(s.length, a.length - c.length);
|
|
1603
|
+
if (d === "") return a;
|
|
1604
|
+
let u = nr(d, t, n, r, o);
|
|
1605
|
+
return `${s}${i && t !== void 0 ? tr(u, t) : u}${c}`;
|
|
1606
|
+
}).join(",");
|
|
1607
|
+
}
|
|
1608
|
+
function Xe(e, t) {
|
|
1609
|
+
let n = 1;
|
|
1610
|
+
for (let r = t + 1; r < e.length; r += 1) {
|
|
1611
|
+
let i = e[r];
|
|
1612
|
+
if (i === '"' || i === "'") r = q(e, r);
|
|
1613
|
+
else if (i === "/" && e[r + 1] === "*") {
|
|
1614
|
+
let o = e.indexOf("*/", r + 2);
|
|
1615
|
+
if (o === -1) return e.length - 1;
|
|
1616
|
+
r = o + 1;
|
|
1617
|
+
} else if (i === "{") n += 1;
|
|
1618
|
+
else if (i === "}" && --n === 0) return r;
|
|
1619
|
+
}
|
|
1620
|
+
return e.length - 1;
|
|
1621
|
+
}
|
|
1622
|
+
function Ot(e, t, n, r, i = false) {
|
|
1623
|
+
let o = "", a = 0, s = 0, c = 0;
|
|
1624
|
+
for (let d = 0; d < e.length; d += 1) {
|
|
1625
|
+
let u = e[d];
|
|
1626
|
+
if (u === '"' || u === "'") d = q(e, d);
|
|
1627
|
+
else if (u === "/" && e[d + 1] === "*") {
|
|
1628
|
+
let l = e.indexOf("*/", d + 2);
|
|
1629
|
+
if (l === -1) break;
|
|
1630
|
+
d = l + 1;
|
|
1631
|
+
} else if (u === "(") s += 1;
|
|
1632
|
+
else if (u === ")") s = Math.max(0, s - 1);
|
|
1633
|
+
else if (u === "[") c += 1;
|
|
1634
|
+
else if (u === "]") c = Math.max(0, c - 1);
|
|
1635
|
+
else if (s === 0 && c === 0 && u === ";") o += e.slice(a, d + 1), a = d + 1;
|
|
1636
|
+
else if (s === 0 && c === 0 && u === "{") {
|
|
1637
|
+
let l = Xe(e, d), m = e.slice(a, d), f = e.slice(d + 1, l), h = /^\s*@([\w-]+)/.exec(m)?.[1]?.toLowerCase(), p = h === void 0 ? Lt(m, t, n, r, t !== void 0 && n === "attribute", i) : m, b = h === void 0 || Qn.has(h) ? Ot(f, t, n, r, i) : f;
|
|
1638
|
+
o += `${p}{${b}}`, d = l, a = l + 1;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return o + e.slice(a);
|
|
1642
|
+
}
|
|
1643
|
+
function rr(e) {
|
|
1644
|
+
let t = "", n = "", r = 0, i = 0, o = 0;
|
|
1645
|
+
for (let a = 0; a < e.length; a += 1) {
|
|
1646
|
+
let s = e[a];
|
|
1647
|
+
if (s === '"' || s === "'") a = q(e, a);
|
|
1648
|
+
else if (s === "/" && e[a + 1] === "*") {
|
|
1649
|
+
let c = e.indexOf("*/", a + 2);
|
|
1650
|
+
if (c === -1) break;
|
|
1651
|
+
a = c + 1;
|
|
1652
|
+
} else if (s === "(") i += 1;
|
|
1653
|
+
else if (s === ")") i = Math.max(0, i - 1);
|
|
1654
|
+
else if (s === "[") o += 1;
|
|
1655
|
+
else if (s === "]") o = Math.max(0, o - 1);
|
|
1656
|
+
else if (i === 0 && o === 0 && s === ";") t += e.slice(r, a + 1), r = a + 1;
|
|
1657
|
+
else if (i === 0 && o === 0 && s === "{") {
|
|
1658
|
+
let c = Xe(e, a), d = e.slice(r, a), u = e.slice(r, c + 1);
|
|
1659
|
+
!/^\s*@/.test(d) && d.includes(":slotted(") ? n += u : t += u, a = c, r = c + 1;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return { normal: t + e.slice(r), slotted: n };
|
|
1663
|
+
}
|
|
1664
|
+
function ir(e, t) {
|
|
1665
|
+
let n = e.trim();
|
|
1666
|
+
if (n.startsWith(">")) {
|
|
1667
|
+
let i = n.slice(1).trim();
|
|
1668
|
+
return i === "" || i === "*" ? `${t} [${J}]` : `${t} [${J}]:is(${i})`;
|
|
1669
|
+
}
|
|
1670
|
+
let r = `:where([${J}], [${J}] *)`;
|
|
1671
|
+
return n === "" || n === "*" ? `${t} ${r}` : `${t} ${r}:is(${n})`;
|
|
1672
|
+
}
|
|
1673
|
+
function or(e, t) {
|
|
1674
|
+
let n = `[${G}~="${t}"]`, r = /^\s*:scope((?:\[[^\]]*\]|:{1,2}[\w-]+(?:\([^)]*\))?|[.#][\w-]+)*)\s+(?=:slotted\()/.exec(e), i = r ? `${n}${r[1]}` : n, o = r ? e.slice(r[0].length) : e, a = "", s = 0;
|
|
1675
|
+
for (; ; ) {
|
|
1676
|
+
let c = o.indexOf(":slotted(", s);
|
|
1677
|
+
if (c === -1) return a += o.slice(s), a;
|
|
1678
|
+
a += o.slice(s, c);
|
|
1679
|
+
let d = c + 8, u = Pt(o, d);
|
|
1680
|
+
a += ir(o.slice(d + 1, u), i), s = u + 1;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
function sr(e, t) {
|
|
1684
|
+
let n = "", r = 0;
|
|
1685
|
+
for (let i = 0; i < e.length; i += 1) if (e[i] === "{") {
|
|
1686
|
+
let o = Xe(e, i), a = e.slice(r, i), s = e.slice(i + 1, o), c = jt(a).map((d) => or(d, t)).join(",");
|
|
1687
|
+
n += `${c}{${s}}`, i = o, r = o + 1;
|
|
1688
|
+
}
|
|
1689
|
+
return n + e.slice(r);
|
|
1690
|
+
}
|
|
1691
|
+
function Se(e, t, n) {
|
|
1692
|
+
if (e === "") return "";
|
|
1693
|
+
let { normal: r, slotted: i } = rr(e), o = Ot(r, t, "scope", n), a = o.trim() === "" ? "" : `@scope ([${G}~="${t}"]) to (:scope [${G}] > *, [${J}]) {
|
|
1694
|
+
${o}
|
|
1695
|
+
}`, s = i.trim() === "" ? "" : sr(i, t);
|
|
1696
|
+
return [a, s].filter((c) => c !== "").join(`
|
|
1697
|
+
`);
|
|
1698
|
+
}
|
|
1699
|
+
function It(e, t, n) {
|
|
1700
|
+
let r = new Set((e.getAttribute(t) ?? "").split(/\s+/).filter(Boolean));
|
|
1701
|
+
r.add(n), e.setAttribute(t, Array.from(r).join(" "));
|
|
1702
|
+
}
|
|
1703
|
+
function de(e, t) {
|
|
1704
|
+
It(e, Dt, t);
|
|
1705
|
+
}
|
|
1706
|
+
function et(e, t) {
|
|
1707
|
+
de(e, t), It(e, G, t);
|
|
1708
|
+
}
|
|
1709
|
+
function le(e) {
|
|
1710
|
+
e.nodeType === 1 && e.setAttribute(J, "");
|
|
1711
|
+
}
|
|
1712
|
+
var Ne = /* @__PURE__ */ new WeakSet(), nt = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap(), ar = /* @__PURE__ */ Symbol.for("@nextwebwg/declarative-components.runtime.v1"), Z = /* @__PURE__ */ Symbol.for("@nextwebwg/declarative-components.lifecycle.v1");
|
|
1713
|
+
function pe(e) {
|
|
1714
|
+
return e[ar] ??= {};
|
|
1715
|
+
}
|
|
1716
|
+
function L(e) {
|
|
1717
|
+
return nt.get(e);
|
|
1718
|
+
}
|
|
1719
|
+
function me(e) {
|
|
1720
|
+
let t = pe(e), n = t.registry;
|
|
1721
|
+
return (n === void 0 || n.root !== e.documentElement) && (n = { root: e.documentElement, definitions: /* @__PURE__ */ new Map(), discoverySelector: void 0 }, t.registry = n), n;
|
|
1722
|
+
}
|
|
1723
|
+
function He(e, t, n) {
|
|
1724
|
+
e.definitions.set(t, n), e.discoverySelector !== void 0 && (e.discoverySelector += `,${t}`);
|
|
1725
|
+
}
|
|
1726
|
+
function cr(e) {
|
|
1727
|
+
return e.discoverySelector ??= ["template[component]", "[data-component-root]", ...Array.from(e.definitions.keys())].join(",");
|
|
1728
|
+
}
|
|
1729
|
+
function dr(e, t) {
|
|
1730
|
+
let n = e.getAttribute("component") ?? "", r = `${e.ownerDocument.URL}#template[component="${n}"][${t + 1}]`;
|
|
1731
|
+
e.hasAttribute("src") && y("HL001", "External definitions require the application-owned graph resolver.", r);
|
|
1732
|
+
let i = St(e, r), o = Array.from(e.content.children).find((a) => a.localName === "style");
|
|
1733
|
+
return { wrapper: e, style: o, definition: i };
|
|
1734
|
+
}
|
|
1735
|
+
function lr(e, t = document) {
|
|
1736
|
+
let n = me(t), r = 0;
|
|
1737
|
+
for (let i of e.nodes.values()) {
|
|
1738
|
+
if (i.shadowedByCustomElement) continue;
|
|
1739
|
+
let o = i.definition.contract.tag;
|
|
1740
|
+
n.definitions.has(o) && y("HR001", `More than one definition declares <${o}>.`);
|
|
1741
|
+
let a = i.definition.css === "" ? void 0 : t.createElement("style");
|
|
1742
|
+
a !== void 0 && (a.textContent = Se(i.definition.css, o, i.definition.template.name), a.dataset.htmlNextComponent = o, t.head.append(a)), He(n, o, { definition: i.definition, style: a }), r += 1;
|
|
1743
|
+
}
|
|
1744
|
+
return r;
|
|
1745
|
+
}
|
|
1746
|
+
function rt(e, t, n = false) {
|
|
1747
|
+
let r = e.type === "boolean" && n && t === "" ? true : t, i = B(r, e.type);
|
|
1748
|
+
if (!i.ok) {
|
|
1749
|
+
let o = i.issues.map((a) => `${a.path}: ${a.message}`).join("; ");
|
|
1750
|
+
y("HR002", `A prop invocation value does not satisfy its declared type. ${o}`);
|
|
1751
|
+
}
|
|
1752
|
+
return i.value;
|
|
1753
|
+
}
|
|
1754
|
+
function Bt(e, t, n) {
|
|
1755
|
+
return n !== void 0 ? rt(t, n) : (t.required && y("HC020", `Required prop \`${e}\` was not provided.`), t.default === void 0 ? T : t.default);
|
|
1756
|
+
}
|
|
1757
|
+
function ur(e, t) {
|
|
1758
|
+
let n = Vt.get(e);
|
|
1759
|
+
if (n === void 0) {
|
|
1760
|
+
let r = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null);
|
|
1761
|
+
for (let o of Object.keys(e.contract.props)) {
|
|
1762
|
+
let a = Y(o);
|
|
1763
|
+
r[a] = o, i[`data-${a}`] = o, a !== o.toLowerCase() && (i[`data-${o.toLowerCase()}`] = o);
|
|
1764
|
+
}
|
|
1765
|
+
n = [r, i], Vt.set(e, n);
|
|
1766
|
+
}
|
|
1767
|
+
return n[t ? 1 : 0];
|
|
1768
|
+
}
|
|
1769
|
+
function fr(e, t, n = false) {
|
|
1770
|
+
let r = t.contract, i = ur(t, n), o = /* @__PURE__ */ Object.create(null), a = [], s;
|
|
1771
|
+
for (let h of Array.from(e.attributes)) {
|
|
1772
|
+
if (h.name.toLowerCase() === "as" && t.root?.kind === "native") {
|
|
1773
|
+
s = h.value.toLowerCase();
|
|
1774
|
+
continue;
|
|
1775
|
+
}
|
|
1776
|
+
let p = i[h.name.toLowerCase()];
|
|
1777
|
+
if (p === void 0) {
|
|
1778
|
+
n || a.push(h);
|
|
1779
|
+
continue;
|
|
1780
|
+
}
|
|
1781
|
+
o[p] = rt(r.props[p], h.value, !n);
|
|
1782
|
+
}
|
|
1783
|
+
let c = t.root?.kind === "native" ? n ? e.localName : s ?? t.root.element : t.template.name;
|
|
1784
|
+
t.root?.kind === "native" && !t.root.choices.includes(c) && y(n ? "HR005" : "HR002", `<${r.tag}> cannot use root <${c}>; expected one of ${t.root.choices.join(", ")}.`);
|
|
1785
|
+
let d = new Set(Object.keys(o).filter((h) => o[h] !== void 0)), u = new Re();
|
|
1786
|
+
for (let [h, p] of Object.entries(r.props)) p.required && o[h] === void 0 && y("HC020", `Required prop \`${h}\` was not provided.`), u.set(h, o[h] !== void 0 ? o[h] : p.default === void 0 ? T : p.default);
|
|
1787
|
+
let l = t.declarations ?? [];
|
|
1788
|
+
for (let h of l) (h.kind === "state" || h.kind === "computed" || h.kind === "data") && u.set(h.name, null);
|
|
1789
|
+
for (let h of l) h.kind === "data" ? u.set(h.name, { pending: true, value: null, error: null, ok: false }) : h.kind === "state" && u.set(h.name, h.expression === void 0 ? null : H(h.expression.source, u));
|
|
1790
|
+
let m = [];
|
|
1791
|
+
for (let h of l) h.kind !== "computed" || h.expression === void 0 || m.push(u.defineComputed(h.name, () => V(h.expression, u)));
|
|
1792
|
+
let f = (() => {
|
|
1793
|
+
try {
|
|
1794
|
+
return new URL(t.source.file, e.ownerDocument.baseURI).href;
|
|
1795
|
+
} catch {
|
|
1796
|
+
return e.ownerDocument.baseURI;
|
|
1797
|
+
}
|
|
1798
|
+
})();
|
|
1799
|
+
for (let h of l) {
|
|
1800
|
+
if (h.kind !== "data" || h.source === void 0) continue;
|
|
1801
|
+
let p = h, b = h.source, x = new xe({ source: b, baseURL: f, ...p.type === void 0 ? {} : { type: p.type }, ...p.debounce === void 0 ? {} : { debounce: Number(p.debounce) }, ...p.poll === void 0 ? {} : { poll: Number(p.poll) }, onState: (E) => u.set(p.name, E) });
|
|
1802
|
+
m.push(ce(u.scheduler, () => {
|
|
1803
|
+
let E = Object.fromEntries(p.parameters.map((v) => [v.name, V(v.expression, u)]));
|
|
1804
|
+
return x.update(E), () => x.disconnect();
|
|
1805
|
+
}, 0));
|
|
1806
|
+
}
|
|
1807
|
+
return { scope: u, passThrough: a, effects: m, rootName: c, explicit: d };
|
|
1808
|
+
}
|
|
1809
|
+
function tt(e, t) {
|
|
1810
|
+
return e.fork(Object.entries(t));
|
|
1811
|
+
}
|
|
1812
|
+
function H(e, t) {
|
|
1813
|
+
try {
|
|
1814
|
+
return ht(e, t);
|
|
1815
|
+
} catch (n) {
|
|
1816
|
+
throw n instanceof re && y("HB001", n.message), n;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
var ue = "http://www.w3.org/2000/svg", zt = /* @__PURE__ */ new Map();
|
|
1820
|
+
function pr(e, t) {
|
|
1821
|
+
if (e.namespaceURI !== ue) return t;
|
|
1822
|
+
let n = zt.get(t);
|
|
1823
|
+
if (n === void 0) {
|
|
1824
|
+
let r = e.ownerDocument.createElement("template");
|
|
1825
|
+
r.innerHTML = `<svg ${t}>`, n = r.content.firstChild.attributes[0]?.name ?? t, zt.set(t, n);
|
|
1826
|
+
}
|
|
1827
|
+
return n;
|
|
1828
|
+
}
|
|
1829
|
+
function Zt(e, t, n) {
|
|
1830
|
+
return t === "svg" || n.namespace === ue ? e.createElementNS(ue, t) : e.createElement(t);
|
|
1831
|
+
}
|
|
1832
|
+
function mr(e, t) {
|
|
1833
|
+
let n = e.namespaceURI === ue && e.localName !== "foreignObject" ? ue : void 0;
|
|
1834
|
+
return n === t.namespace ? t : Object.create(t, { namespace: { value: n, enumerable: true } });
|
|
1835
|
+
}
|
|
1836
|
+
function U(e, t, n, r = 1) {
|
|
1837
|
+
e.effects.push(ce(t.scheduler, n, r));
|
|
1838
|
+
}
|
|
1839
|
+
function Kt(e, t, n) {
|
|
1840
|
+
let [r, ...i] = t;
|
|
1841
|
+
if (typeof r != "string") return;
|
|
1842
|
+
if (i.length === 0) {
|
|
1843
|
+
e.set(r, n);
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
let o = e.get(r);
|
|
1847
|
+
for (let c = 0; c < i.length - 1; c += 1) {
|
|
1848
|
+
let d = i[c], u = typeof d == "object" ? V(d.expression, e) : d;
|
|
1849
|
+
if (typeof u != "string" && typeof u != "number" || o == null) return;
|
|
1850
|
+
o = o[u];
|
|
1851
|
+
}
|
|
1852
|
+
let a = i.at(-1), s = typeof a == "object" ? V(a.expression, e) : a;
|
|
1853
|
+
(typeof s == "string" || typeof s == "number") && o != null && (o[s] = n);
|
|
1854
|
+
}
|
|
1855
|
+
function hr(e) {
|
|
1856
|
+
return e instanceof HTMLInputElement ? e.type === "checkbox" || e.type === "radio" ? e.checked : e.type === "number" || e.type === "range" ? Number.isNaN(e.valueAsNumber) ? null : e.valueAsNumber : e.value : e instanceof HTMLSelectElement ? e.multiple ? Array.from(e.selectedOptions, (t) => t.value) : e.value : e instanceof HTMLTextAreaElement ? e.value : e.value ?? e.getAttribute("value");
|
|
1857
|
+
}
|
|
1858
|
+
function yr(e, t, n) {
|
|
1859
|
+
let r = t.toLowerCase();
|
|
1860
|
+
if (r === "checked" && e instanceof HTMLInputElement) return e.checked = j(n), true;
|
|
1861
|
+
if (r === "value" && e instanceof HTMLSelectElement && e.multiple) {
|
|
1862
|
+
let i = new Set(Array.isArray(n) ? n.map(String) : []);
|
|
1863
|
+
for (let o of Array.from(e.options)) o.selected = i.has(o.value);
|
|
1864
|
+
return true;
|
|
1865
|
+
}
|
|
1866
|
+
return r === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? (e.value = n == null ? "" : String(n), true) : false;
|
|
1867
|
+
}
|
|
1868
|
+
function gr(e, t, n, r) {
|
|
1869
|
+
for (let i of e.steps) if (!(i.guard !== void 0 && !j(V(i.guard, n)))) if (i.kind === "set") Kt(n, i.writablePath, V(i.value, n));
|
|
1870
|
+
else if (i.kind === "dispatch") {
|
|
1871
|
+
let o = Jt(r.definition, i.event), a = i.value === void 0 ? void 0 : V(i.value, n);
|
|
1872
|
+
o !== void 0 && a !== void 0 && (B(a, ge(o.type)).ok || y("HR002", `Event \`${i.event}\` detail does not satisfy its declared type.`)), Gt(r.root ?? t, i.event, a, o);
|
|
1873
|
+
} else {
|
|
1874
|
+
let o = r.refs[i.target];
|
|
1875
|
+
i.kind === "focus" ? o?.focus() : o?.reportValidity?.();
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
function Jt(e, t) {
|
|
1879
|
+
return (e.declarations ?? []).find((n) => n.kind === "event" && n.name === t);
|
|
1880
|
+
}
|
|
1881
|
+
function Gt(e, t, n, r) {
|
|
1882
|
+
return e.dispatchEvent(new CustomEvent(t, { detail: n, bubbles: r?.bubbles ?? true, composed: r?.composed ?? true, cancelable: r?.cancelable ?? false }));
|
|
1883
|
+
}
|
|
1884
|
+
function br(e, t, n) {
|
|
1885
|
+
if (n.includes("self") && e.target !== t) return false;
|
|
1886
|
+
if (e instanceof MouseEvent) {
|
|
1887
|
+
let i = n.filter((a) => ["left", "middle", "right"].includes(a)), o = { left: 0, middle: 1, right: 2 };
|
|
1888
|
+
if (i.length > 0 && !i.some((a) => e.button === o[a])) return false;
|
|
1889
|
+
}
|
|
1890
|
+
let r = ["ctrl", "shift", "alt", "meta"];
|
|
1891
|
+
for (let i of r) if (n.includes(i) && !e[`${i}Key`]) return false;
|
|
1892
|
+
if (n.includes("exact") && r.some((i) => !n.includes(i) && e[`${i}Key`])) return false;
|
|
1893
|
+
if (e instanceof KeyboardEvent) {
|
|
1894
|
+
let i = n.filter((a) => ["enter", "escape", "space", "tab", "up", "down", "left", "right"].includes(a)), o = { enter: "Enter", escape: "Escape", space: " ", tab: "Tab", up: "ArrowUp", down: "ArrowDown", left: "ArrowLeft", right: "ArrowRight" };
|
|
1895
|
+
if (i.length > 0 && !i.some((a) => e.key === o[a])) return false;
|
|
1896
|
+
}
|
|
1897
|
+
return true;
|
|
1898
|
+
}
|
|
1899
|
+
function _t(e, t, n, r) {
|
|
1900
|
+
for (let i of t.events ?? []) {
|
|
1901
|
+
let o = (r.definition.declarations ?? []).find((s) => s.kind === "handler" && s.name === i.handler), a = (s) => {
|
|
1902
|
+
br(s, e, i.modifiers) && (i.modifiers.includes("prevent") && s.preventDefault(), i.modifiers.includes("stop") && s.stopPropagation(), gr(o, e, n, r));
|
|
1903
|
+
};
|
|
1904
|
+
if (i.name === "connect" || i.name === "disconnect") {
|
|
1905
|
+
(i.name === "connect" ? r.connectCallbacks : r.disconnectCallbacks).add(() => a(new Event(i.name)));
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
U(r, n, () => (e.addEventListener(i.name, a, { capture: i.modifiers.includes("capture"), passive: i.modifiers.includes("passive"), once: i.modifiers.includes("once") }), () => e.removeEventListener(i.name, a, { capture: i.modifiers.includes("capture") })), 2);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function vr(e, t, n) {
|
|
1912
|
+
t = pr(e, t), n === null || oe(t) && ie(n) ? e.removeAttribute(t) : e.setAttribute(t, n);
|
|
1913
|
+
}
|
|
1914
|
+
function kr(e, t, n, r) {
|
|
1915
|
+
let i = H(t.expression, n);
|
|
1916
|
+
t.name === "value" ? e.textContent = D(i) : e.replaceChildren(qe(D(i), r, (o) => Ne.add(o)));
|
|
1917
|
+
}
|
|
1918
|
+
function wr(e, t, n) {
|
|
1919
|
+
let r = H(e.expression, t);
|
|
1920
|
+
return e.name === "value" ? n.createTextNode(D(r)) : qe(D(r), n, (i) => Ne.add(i));
|
|
1921
|
+
}
|
|
1922
|
+
function xr(e, t) {
|
|
1923
|
+
return typeof e == "number" && typeof t == "number" ? e - t : D(e).localeCompare(D(t));
|
|
1924
|
+
}
|
|
1925
|
+
function Er(e, t, n) {
|
|
1926
|
+
let r = e.slice();
|
|
1927
|
+
if (t.where !== void 0) {
|
|
1928
|
+
let i = t.where;
|
|
1929
|
+
r = r.filter((o) => j(H(i, tt(n, { [t.item]: o }))));
|
|
1930
|
+
}
|
|
1931
|
+
if (t.sort !== void 0) {
|
|
1932
|
+
let i = t.sort.split(",").map((a) => a.trim()).filter((a) => a !== ""), o = (a, s) => a !== null && typeof a == "object" && !Array.isArray(a) ? H(`${t.item}.${s}`, tt(n, { [t.item]: a })) : a;
|
|
1933
|
+
r.sort((a, s) => {
|
|
1934
|
+
for (let c of i) {
|
|
1935
|
+
let d = c.startsWith("-"), u = d ? c.slice(1).trim() : c, l = xr(o(a, u), o(s, u));
|
|
1936
|
+
if (l !== 0) return d ? -l : l;
|
|
1937
|
+
}
|
|
1938
|
+
return 0;
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
if (t.limit !== void 0) {
|
|
1942
|
+
let i = H(t.limit, n);
|
|
1943
|
+
typeof i == "number" && (r = r.slice(0, Math.max(0, Math.trunc(i))));
|
|
1944
|
+
}
|
|
1945
|
+
return r;
|
|
1946
|
+
}
|
|
1947
|
+
function Qt(e, t) {
|
|
1948
|
+
let n = t.createDocumentFragment();
|
|
1949
|
+
return n.append(...e), Array.from(n.childNodes);
|
|
1950
|
+
}
|
|
1951
|
+
function Tr(e, t) {
|
|
1952
|
+
let n = e.nextSibling;
|
|
1953
|
+
for (; n !== null && n !== t; ) {
|
|
1954
|
+
let r = n.nextSibling;
|
|
1955
|
+
n.remove(), n = r;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
function Cr(e, t, n, r, i) {
|
|
1959
|
+
if (e.flow?.kind === "each") return $r(e, t, n, r, i);
|
|
1960
|
+
let o = n.createComment("html-next:start"), a = n.createComment("html-next:end"), s = n.createDocumentFragment();
|
|
1961
|
+
s.append(o, a);
|
|
1962
|
+
let c = [];
|
|
1963
|
+
return U(i, t, () => {
|
|
1964
|
+
for (let l of c) l.stop();
|
|
1965
|
+
c = [], Tr(o, a);
|
|
1966
|
+
let d = i.effects.length, u = [];
|
|
1967
|
+
if (e.flow?.kind === "if") {
|
|
1968
|
+
if (j(H(e.flow.test, t))) {
|
|
1969
|
+
let { flow: l, ...m } = e;
|
|
1970
|
+
u = fe(m, t, n, r, i);
|
|
1971
|
+
}
|
|
1972
|
+
} else if (e.flow?.kind === "with") {
|
|
1973
|
+
let l = t.fork([[e.flow.alias, H(e.flow.expr, t)]]), { flow: m, ...f } = e;
|
|
1974
|
+
u = fe(f, l, n, r, i);
|
|
1975
|
+
} else e.flow?.kind === "match" && (u = Ar(e, t, n, i));
|
|
1976
|
+
c = i.effects.slice(d), a.before(...Qt(u, n));
|
|
1977
|
+
}), [s];
|
|
1978
|
+
}
|
|
1979
|
+
function Rr(e, t) {
|
|
1980
|
+
if (e.end.nextSibling === t) return;
|
|
1981
|
+
let n = [], r = e.start;
|
|
1982
|
+
for (; r !== null && (n.push(r), r !== e.end); ) r = r.nextSibling;
|
|
1983
|
+
let i = t.parentNode;
|
|
1984
|
+
if (i === null) return;
|
|
1985
|
+
let o = i.moveBefore;
|
|
1986
|
+
for (let a of n) o === void 0 ? i.insertBefore(a, t) : o.call(i, a, t);
|
|
1987
|
+
}
|
|
1988
|
+
function Sr(e) {
|
|
1989
|
+
for (let n of e.effects) n.stop();
|
|
1990
|
+
let t = e.start;
|
|
1991
|
+
for (; t !== null; ) {
|
|
1992
|
+
let n = t.nextSibling;
|
|
1993
|
+
if (t.parentNode?.removeChild(t), t === e.end) break;
|
|
1994
|
+
t = n;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
function Nr(e) {
|
|
1998
|
+
let t = -1, n = true;
|
|
1999
|
+
for (let s of e) s < 0 || (s < t && (n = false), t = s);
|
|
2000
|
+
if (n) return;
|
|
2001
|
+
let r = [], i = new Int32Array(e.length).fill(-1);
|
|
2002
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
2003
|
+
let c = e[s];
|
|
2004
|
+
if (c < 0) continue;
|
|
2005
|
+
let d = 0, u = r.length;
|
|
2006
|
+
for (; d < u; ) {
|
|
2007
|
+
let l = d + u >>> 1;
|
|
2008
|
+
e[r[l]] < c ? d = l + 1 : u = l;
|
|
2009
|
+
}
|
|
2010
|
+
d > 0 && (i[s] = r[d - 1]), r[d] = s;
|
|
2011
|
+
}
|
|
2012
|
+
let o = new Uint8Array(e.length), a = r.at(-1) ?? -1;
|
|
2013
|
+
for (; a >= 0; ) o[a] = 1, a = i[a];
|
|
2014
|
+
return o;
|
|
2015
|
+
}
|
|
2016
|
+
function $r(e, t, n, r, i) {
|
|
2017
|
+
let o = e.flow, a = n.createComment("html-next:each-start"), s = n.createComment("html-next:each-end"), c = n.createDocumentFragment();
|
|
2018
|
+
c.append(a, s);
|
|
2019
|
+
let d = /* @__PURE__ */ new Map();
|
|
2020
|
+
return U(i, t, () => {
|
|
2021
|
+
let u = H(o.list, t), l = Array.isArray(u) ? Er(u, o, t) : [], m = /* @__PURE__ */ new Map(), f = o.key !== void 0, h = f ? [] : void 0, p;
|
|
2022
|
+
if (f) {
|
|
2023
|
+
p = /* @__PURE__ */ new Map();
|
|
2024
|
+
let v = 0;
|
|
2025
|
+
for (let g of d.keys()) p.set(g, v++);
|
|
2026
|
+
}
|
|
2027
|
+
let b = f ? [] : void 0, { flow: x, ...E } = e;
|
|
2028
|
+
for (let v = 0; v < l.length; v += 1) {
|
|
2029
|
+
let g = l[v], k = { [o.item]: g, loop: { index: v, first: v === 0, last: v === l.length - 1, count: l.length } };
|
|
2030
|
+
o.index !== void 0 && (k[o.index] = v);
|
|
2031
|
+
let C, $ = v;
|
|
2032
|
+
o.key !== void 0 && (C = t.fork(Object.entries(k)), $ = H(o.key, C)), m.has($) && y("HR004", `A keyed list produced duplicate key \`${D($)}\`.`);
|
|
2033
|
+
let O = d.get($);
|
|
2034
|
+
if (O === void 0) {
|
|
2035
|
+
C ??= t.fork(Object.entries(k));
|
|
2036
|
+
let M = i.effects.length, he = Qt(fe(E, C, n, r, i), n), ct = n.createComment("html-next:item-start"), dt = n.createComment("html-next:item-end");
|
|
2037
|
+
s.before(ct, ...he, dt), O = { start: ct, end: dt, scope: C, effects: i.effects.slice(M) };
|
|
2038
|
+
} else O.scope.set(o.item, g), o.index !== void 0 && O.scope.set(o.index, v), O.scope.set("loop", k.loop);
|
|
2039
|
+
m.set($, O), h?.push(O), b?.push(p?.get($) ?? -1);
|
|
2040
|
+
}
|
|
2041
|
+
for (let [v, g] of d) m.has(v) || Sr(g);
|
|
2042
|
+
if (h !== void 0 && b !== void 0) {
|
|
2043
|
+
let v = Nr(b), g = s;
|
|
2044
|
+
for (let k = h.length - 1; k >= 0; k -= 1) {
|
|
2045
|
+
let C = h[k];
|
|
2046
|
+
(b[k] < 0 || v !== void 0 && v[k] !== 1) && Rr(C, g), g = C.start;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
d = m;
|
|
2050
|
+
}), [c];
|
|
2051
|
+
}
|
|
2052
|
+
function Yt(e, t, n, r, i, o) {
|
|
2053
|
+
return e.flow?.kind === "if" || e.flow?.kind === "each" || e.flow?.kind === "with" || e.flow?.kind === "match" ? i.committed && i.frameworkOwned && o !== void 0 ? [o] : Cr(e, t, n, r, i) : fe(e, t, n, r, i, o);
|
|
2054
|
+
}
|
|
2055
|
+
function Ar(e, t, n, r) {
|
|
2056
|
+
let i = e.flow, o = i.expr !== void 0 ? tt(t, { [i.alias]: H(i.expr, t) }) : t, a;
|
|
2057
|
+
for (let l of e.children) if (l.kind === "element") {
|
|
2058
|
+
if (l.flow?.kind === "when" && j(H(l.flow.test, o))) {
|
|
2059
|
+
a = l;
|
|
2060
|
+
break;
|
|
2061
|
+
}
|
|
2062
|
+
if (l.flow?.kind === "else") {
|
|
2063
|
+
a = l;
|
|
2064
|
+
break;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
if (a === void 0) return [];
|
|
2068
|
+
let { flow: s, ...c } = a, d = fe(c, o, n, [], r);
|
|
2069
|
+
if (e.name === "template") return d;
|
|
2070
|
+
let u = Zt(n, e.name, r);
|
|
2071
|
+
for (let l of e.attributes) l.kind === "literal" && u.setAttribute(l.name, l.value);
|
|
2072
|
+
return u.append(...d), de(u, r.definition.contract.tag), [u];
|
|
2073
|
+
}
|
|
2074
|
+
function fe(e, t, n, r, i, o) {
|
|
2075
|
+
let a = e.attributes.find((p) => p.kind === "directive");
|
|
2076
|
+
if (e.name === "template") {
|
|
2077
|
+
if (a !== void 0) {
|
|
2078
|
+
let p = n.createTextNode("");
|
|
2079
|
+
return U(i, t, () => {
|
|
2080
|
+
let b = H(a.expression, t);
|
|
2081
|
+
a.name === "value" && (p.data = D(b));
|
|
2082
|
+
}), a.name === "value" ? [p] : [wr(a, t, n)];
|
|
2083
|
+
}
|
|
2084
|
+
return Xt(e.children, t, n, i);
|
|
2085
|
+
}
|
|
2086
|
+
let s = e === i.definition.template ? i.rootName : e.name;
|
|
2087
|
+
if (i.frameworkOwned && o instanceof Element && o.localName !== s && (o.getAttribute("data-component-root") ?? "").split(/\s+/).includes(e.name)) return [o];
|
|
2088
|
+
if (i.hydrationRanges !== void 0 && !i.frameworkOwned && o instanceof Element && o.localName !== s && (o.getAttribute("data-component-root") ?? "").split(/\s+/).includes(e.name)) {
|
|
2089
|
+
let p = it(o, false), b = (g) => g.kind === "element" ? g.attributes.find((k) => k.kind === "literal" && k.name === "slot")?.value ?? "" : "", x = p?.ranges.filter((g) => !g.fallback) ?? [], E = (g, k) => {
|
|
2090
|
+
let C = 0;
|
|
2091
|
+
for (let $ of g) C += $e($, t, n, i, k[C]).length;
|
|
2092
|
+
};
|
|
2093
|
+
for (let g of x) E(e.children.filter((k) => b(k) === g.slot), g.content);
|
|
2094
|
+
let v = new Set(x.map((g) => g.slot));
|
|
2095
|
+
return E(e.children.filter((g) => !v.has(b(g))), p?.carried ?? []), [o];
|
|
2096
|
+
}
|
|
2097
|
+
let c = o instanceof Element && o.localName === s, d = c ? o : Zt(n, s, i);
|
|
2098
|
+
e === i.definition.template && (i.root = d);
|
|
2099
|
+
let u = c ? Array.from(d.childNodes) : [], l = c && (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement || d instanceof HTMLSelectElement) ? { value: d.value, focused: d.ownerDocument.activeElement === d, ...d instanceof HTMLInputElement ? { checked: d.checked } : {}, ...d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement ? { selectionStart: d.selectionStart, selectionEnd: d.selectionEnd } : {} } : void 0;
|
|
2100
|
+
e.ref !== void 0 && (i.refs[e.ref] = d);
|
|
2101
|
+
for (let p of r) d.setAttribute(p.name, p.value);
|
|
2102
|
+
for (let p of e.attributes) if (p.kind === "literal") d.setAttribute(p.name, p.value);
|
|
2103
|
+
else if (p.kind === "attribute") {
|
|
2104
|
+
if (U(i, t, () => {
|
|
2105
|
+
let b = H(p.expression, t);
|
|
2106
|
+
p.target === "class" ? d.classList.toggle(p.name, j(b)) : p.target === "style" ? d.style.setProperty(p.name, D(b)) : p.twoWay === true && yr(d, p.name, b) || vr(d, p.name, yt(b));
|
|
2107
|
+
}), p.twoWay === true && p.writablePath !== void 0) {
|
|
2108
|
+
let b = d instanceof HTMLSelectElement || d instanceof HTMLInputElement && ["checkbox", "radio", "file"].includes(d.type) ? "change" : "input", x = () => {
|
|
2109
|
+
d instanceof HTMLInputElement && d.type === "radio" && !d.checked || Kt(t, p.writablePath, hr(d));
|
|
2110
|
+
};
|
|
2111
|
+
U(i, t, () => (d.addEventListener(b, x), () => d.removeEventListener(b, x)), 2);
|
|
2112
|
+
}
|
|
2113
|
+
} else p.kind === "property" && U(i, t, () => {
|
|
2114
|
+
d[p.name] = H(p.expression, t);
|
|
2115
|
+
});
|
|
2116
|
+
if (de(d, i.definition.contract.tag), a !== void 0) return U(i, t, () => kr(d, a, t, n)), _t(d, e, t, i), [d];
|
|
2117
|
+
let m = [], f = 0, h = mr(d, i);
|
|
2118
|
+
for (let p of e.children) {
|
|
2119
|
+
let b = f;
|
|
2120
|
+
if (i.frameworkOwned && p.kind === "element") {
|
|
2121
|
+
let E = u.findIndex((v, g) => g < f ? false : v instanceof Element && (v.localName === p.name || (v.getAttribute("data-component-root") ?? "").split(/\s+/).includes(p.name)));
|
|
2122
|
+
E < 0 && p.flow !== void 0 && (E = u.findIndex((v, g) => g >= f && v instanceof Comment)), E >= 0 && (b = E);
|
|
2123
|
+
}
|
|
2124
|
+
let x = $e(p, t, n, h, u[b]);
|
|
2125
|
+
m.push(...x), f = b + x.length;
|
|
2126
|
+
}
|
|
2127
|
+
if (c && !i.frameworkOwned) {
|
|
2128
|
+
m = m.flatMap((p) => p.nodeType === 11 ? Array.from(p.childNodes) : [p]);
|
|
2129
|
+
for (let p = 0; p < m.length; p += 1) {
|
|
2130
|
+
let b = m[p];
|
|
2131
|
+
d.childNodes[p] !== b && d.insertBefore(b, d.childNodes[p] ?? null);
|
|
2132
|
+
}
|
|
2133
|
+
for (; d.childNodes.length > m.length; ) d.lastChild.remove();
|
|
2134
|
+
} else c || d.append(...m);
|
|
2135
|
+
return l !== void 0 && (d.value = l.value, d instanceof HTMLInputElement && "checked" in l && (d.checked = l.checked), (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && "selectionStart" in l && typeof l.selectionStart == "number" && typeof l.selectionEnd == "number" && (l.focused && d.focus({ preventScroll: true }), d.setSelectionRange(l.selectionStart, l.selectionEnd))), _t(d, e, t, i), [d];
|
|
2136
|
+
}
|
|
2137
|
+
function Xt(e, t, n, r) {
|
|
2138
|
+
let i = [];
|
|
2139
|
+
for (let o of e) i.push(...$e(o, t, n, r));
|
|
2140
|
+
return i;
|
|
2141
|
+
}
|
|
2142
|
+
function Hr(e, t) {
|
|
2143
|
+
return t.projectedSlotNames.get(e) ?? (e instanceof Element ? e.getAttribute("slot") ?? "" : "");
|
|
2144
|
+
}
|
|
2145
|
+
function Mr(e, t, n, r) {
|
|
2146
|
+
let i = e.nameExpression === void 0 ? e.name ?? "" : D(V(e.nameExpression, t)), o = r.projectedNodes.filter((l) => Hr(l, r) === i), a = r.hydrationRanges?.shift();
|
|
2147
|
+
if (a !== void 0) {
|
|
2148
|
+
if (a.fallback) {
|
|
2149
|
+
let l = [], m = 0;
|
|
2150
|
+
for (let f of e.fallback ?? []) {
|
|
2151
|
+
let h = $e(f, t, n, r, a.content[m]);
|
|
2152
|
+
l.push(...h), m += h.length;
|
|
2153
|
+
}
|
|
2154
|
+
return [a.markers[0], ...l, ...a.markers.slice(1)];
|
|
2155
|
+
}
|
|
2156
|
+
for (let l of a.content) le(l);
|
|
2157
|
+
return a.markers.length === 1 ? [a.markers[0]] : [a.markers[0], ...a.content, a.markers[1]];
|
|
2158
|
+
}
|
|
2159
|
+
let s = (l) => `"${l.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """)}"`, c = (l, m) => en(n) ? n.createProcessingInstruction(l, m) : n.createComment(`?${l}${m === "" ? "" : ` ${m}`}?`), d = (l, m) => {
|
|
2160
|
+
if (l.length === 0) return [c("marker", `slot=${s(i)}`)];
|
|
2161
|
+
let f = `slot=${s(i)}${m ? ' fallback=""' : ""}`;
|
|
2162
|
+
return [c("start", f), ...l, c("end", "")];
|
|
2163
|
+
};
|
|
2164
|
+
if (o.length === 0) return d(Xt(e.fallback ?? [], t, n, r), true);
|
|
2165
|
+
if (r.committed) {
|
|
2166
|
+
for (let l of o) le(l);
|
|
2167
|
+
return d([...o], false);
|
|
2168
|
+
}
|
|
2169
|
+
let u = n.createComment(`html-next:slot:${i}`);
|
|
2170
|
+
return r.slotInsertions.push({ anchor: u, nodes: o }), d([u], false);
|
|
2171
|
+
}
|
|
2172
|
+
function qt(e) {
|
|
2173
|
+
let t = /* @__PURE__ */ new Map(), n = e.trim(), r = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
|
|
2174
|
+
for (; n !== ""; ) {
|
|
2175
|
+
let i = /^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);
|
|
2176
|
+
if (i === null || t.has(i[1])) return /* @__PURE__ */ new Map();
|
|
2177
|
+
let o = (i[2] ?? i[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g, (a, s) => s.startsWith("#x") ? String.fromCodePoint(parseInt(s.slice(2), 16)) : s.startsWith("#") ? String.fromCodePoint(Number(s.slice(1))) : r[s]);
|
|
2178
|
+
t.set(i[1], o), n = n.slice(i[0].length);
|
|
2179
|
+
}
|
|
2180
|
+
return t;
|
|
2181
|
+
}
|
|
2182
|
+
var Ut = /* @__PURE__ */ new WeakMap();
|
|
2183
|
+
function en(e) {
|
|
2184
|
+
let t = Ut.get(e);
|
|
2185
|
+
if (t === void 0) {
|
|
2186
|
+
let n = e.createElement("div");
|
|
2187
|
+
n.innerHTML = '<?probe x="1"?>', t = n.firstChild?.nodeType === 7, Ut.set(e, t);
|
|
2188
|
+
}
|
|
2189
|
+
return t;
|
|
2190
|
+
}
|
|
2191
|
+
function Wt(e) {
|
|
2192
|
+
if (e.nodeType === 7) {
|
|
2193
|
+
let n = e;
|
|
2194
|
+
return { target: n.target, attributes: qt(n.data) };
|
|
2195
|
+
}
|
|
2196
|
+
if (e.nodeType !== 8 || en(e.ownerDocument)) return;
|
|
2197
|
+
let t = /^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(e.data);
|
|
2198
|
+
return t === null ? void 0 : { target: t[1], attributes: qt(t[2] ?? "") };
|
|
2199
|
+
}
|
|
2200
|
+
function it(e, t = true) {
|
|
2201
|
+
let n = [], r = /* @__PURE__ */ new Set(), i = (s, c) => {
|
|
2202
|
+
for (let d = 0; d < s.length; d += 1) {
|
|
2203
|
+
let u = s[d], l = Wt(u);
|
|
2204
|
+
if (l?.target === "marker" && l.attributes.has("slot")) {
|
|
2205
|
+
c.push({ slot: l.attributes.get("slot"), fallback: false, markers: [u], content: [] });
|
|
2206
|
+
continue;
|
|
2207
|
+
}
|
|
2208
|
+
if (l?.target === "start") {
|
|
2209
|
+
let m = 1, f = [], h;
|
|
2210
|
+
for (d += 1; d < s.length; d += 1) {
|
|
2211
|
+
let p = Wt(s[d]);
|
|
2212
|
+
if (p?.target === "start") m += 1;
|
|
2213
|
+
else if (p?.target === "end" && --m === 0) {
|
|
2214
|
+
h = s[d];
|
|
2215
|
+
break;
|
|
2216
|
+
}
|
|
2217
|
+
f.push(s[d]);
|
|
2218
|
+
}
|
|
2219
|
+
if (l.attributes.has("slot")) {
|
|
2220
|
+
c.push({ slot: l.attributes.get("slot"), fallback: l.attributes.has("fallback"), markers: h ? [u, h] : [u], content: f });
|
|
2221
|
+
for (let p of f) r.add(p);
|
|
2222
|
+
} else i(f, c);
|
|
2223
|
+
continue;
|
|
2224
|
+
}
|
|
2225
|
+
if (u instanceof Element) if (u !== e && u.hasAttribute("data-component-root")) {
|
|
2226
|
+
let m = it(u, false);
|
|
2227
|
+
for (let f of m?.ranges ?? []) i(f.content, c);
|
|
2228
|
+
} else i(Array.from(u.childNodes), c);
|
|
2229
|
+
}
|
|
2230
|
+
};
|
|
2231
|
+
i(Array.from(e.childNodes), n);
|
|
2232
|
+
let o = Array.from(e.children).find((s) => s instanceof HTMLTemplateElement && !s.hasAttribute("data-component") && !r.has(s));
|
|
2233
|
+
if (n.length === 0 && o === void 0) return;
|
|
2234
|
+
let a = [];
|
|
2235
|
+
if (o !== void 0 && t) {
|
|
2236
|
+
for (let s of Array.from(o.content.childNodes)) a.push(e.ownerDocument.adoptNode(s));
|
|
2237
|
+
o.remove();
|
|
2238
|
+
} else o !== void 0 && a.push(...Array.from(o.content.childNodes));
|
|
2239
|
+
return { ranges: n, carried: a };
|
|
2240
|
+
}
|
|
2241
|
+
function Dr(e) {
|
|
2242
|
+
let t = e.cloneNode(true), n = [e, ...Array.from(e.querySelectorAll("*"))], r = [t, ...Array.from(t.querySelectorAll("*"))];
|
|
2243
|
+
return n.forEach((i, o) => {
|
|
2244
|
+
let a = L(i)?.projection;
|
|
2245
|
+
if (a === void 0) return;
|
|
2246
|
+
let s = a.nodes.filter((d) => !i.contains(d));
|
|
2247
|
+
if (s.length === 0) return;
|
|
2248
|
+
let c = t.ownerDocument.createElement("template");
|
|
2249
|
+
for (let d of s) c.content.append(d.cloneNode(true));
|
|
2250
|
+
r[o].append(c);
|
|
2251
|
+
}), t.innerHTML;
|
|
2252
|
+
}
|
|
2253
|
+
function Pr(e) {
|
|
2254
|
+
let t = L(e);
|
|
2255
|
+
if (t === void 0) return;
|
|
2256
|
+
let n = {};
|
|
2257
|
+
for (let o of Object.keys(t.definition.contract.props)) n[o] = t.scope.get(o);
|
|
2258
|
+
let r = {};
|
|
2259
|
+
for (let o of t.projection?.nodes ?? []) {
|
|
2260
|
+
let a = t.projection.slotNames.get(o) ?? (o instanceof Element ? o.getAttribute("slot") ?? "" : "");
|
|
2261
|
+
(r[a] ??= []).push(o instanceof Element ? o.outerHTML.replace(/ data-slotted=""/g, "") : o.textContent ?? "");
|
|
2262
|
+
}
|
|
2263
|
+
let i = Object.fromEntries(Object.entries(r).sort(([o], [a]) => o.localeCompare(a)));
|
|
2264
|
+
return { tag: t.definition.contract.tag, explicit: [...t.explicit].sort(), props: n, slots: i };
|
|
2265
|
+
}
|
|
2266
|
+
function $e(e, t, n, r, i) {
|
|
2267
|
+
if (e.kind === "text") {
|
|
2268
|
+
let o = i instanceof Text ? i : n.createTextNode("");
|
|
2269
|
+
return o.data = e.value, [o];
|
|
2270
|
+
}
|
|
2271
|
+
return e.kind === "slot" ? Mr(e, t, n, r) : Yt(e, t, n, [], r, i);
|
|
2272
|
+
}
|
|
2273
|
+
function jr(e, t) {
|
|
2274
|
+
let n = t.definition.contract.props, r = {}, i = {};
|
|
2275
|
+
for (let [u, l] of Object.entries(n)) {
|
|
2276
|
+
let m = `data-${Y(u)}`;
|
|
2277
|
+
r[m] = u;
|
|
2278
|
+
let f = t.definition.template.attributes.some((h) => h.kind === "attribute" && h.name === m);
|
|
2279
|
+
t.effects.push(ce(t.scope.scheduler, () => {
|
|
2280
|
+
let h = t.scope.get(u);
|
|
2281
|
+
if (!f && !t.explicit.has(u)) return;
|
|
2282
|
+
let p = h === void 0 || h === T || h === null ? null : te(h, l.type);
|
|
2283
|
+
i[m] = p, p === null ? e.removeAttribute(m) : e.setAttribute(m, p);
|
|
2284
|
+
}, 2));
|
|
2285
|
+
}
|
|
2286
|
+
let o = e.ownerDocument.defaultView?.MutationObserver, a = Object.keys(r);
|
|
2287
|
+
if (o === void 0 || a.length === 0) return;
|
|
2288
|
+
let s = new o((u) => {
|
|
2289
|
+
for (let l of u) {
|
|
2290
|
+
let m = l.attributeName;
|
|
2291
|
+
if (m === null) continue;
|
|
2292
|
+
let f = r[m];
|
|
2293
|
+
if (f === void 0) continue;
|
|
2294
|
+
let h = e.getAttribute(m);
|
|
2295
|
+
if (m in i && i[m] === h) {
|
|
2296
|
+
delete i[m];
|
|
2297
|
+
continue;
|
|
2298
|
+
}
|
|
2299
|
+
delete i[m];
|
|
2300
|
+
let p = n[f];
|
|
2301
|
+
h === null ? t.explicit.delete(f) : t.explicit.add(f), t.scope.set(f, h === null ? Bt(f, p, void 0) : rt(p, h, true));
|
|
2302
|
+
}
|
|
2303
|
+
}), c = () => s.observe(e, { attributes: true, attributeFilter: a }), d = () => s.disconnect();
|
|
2304
|
+
t.connectCallbacks.add(c), t.disconnectCallbacks.add(d);
|
|
2305
|
+
}
|
|
2306
|
+
function Lr(e, t) {
|
|
2307
|
+
for (let n of t.definition.declarations ?? []) n.kind === "method" && Object.defineProperty(e, n.name, { configurable: true, enumerable: false, value: (...r) => t.controllerModule === void 0 ? Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${t.definition.contract.tag}>.`)) : t.controllerModule.then((i) => {
|
|
2308
|
+
let o = i[n.exportName];
|
|
2309
|
+
return typeof o != "function" && y("HJ003", `Controller does not export method \`${n.exportName}\`.`), Reflect.apply(o, void 0, [at(e), ...r]);
|
|
2310
|
+
}) });
|
|
2311
|
+
}
|
|
2312
|
+
function tn(e, t, n, r, i = /* @__PURE__ */ new WeakMap(), o = false) {
|
|
2313
|
+
let a = n && e.contains(e.ownerDocument.activeElement) ? e.ownerDocument.activeElement : null, s = a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement ? [a.selectionStart, a.selectionEnd] : void 0, { scope: c, passThrough: d, effects: u, rootName: l, explicit: m } = fr(e, t, n), f = r, h;
|
|
2314
|
+
if (n && f === void 0) {
|
|
2315
|
+
let g = it(e);
|
|
2316
|
+
if (g !== void 0) {
|
|
2317
|
+
h = g.ranges;
|
|
2318
|
+
let k = [];
|
|
2319
|
+
for (let C of g.ranges) if (!C.fallback) for (let $ of C.content) i.set($, C.slot), k.push($);
|
|
2320
|
+
k.push(...g.carried), f = k;
|
|
2321
|
+
} else ({ projected: f, projectedSlotNames: i } = an(e, t));
|
|
2322
|
+
}
|
|
2323
|
+
let p = n ? f : Array.from(e.childNodes), b = { definition: t, scope: c, refs: {}, effects: u, connectCallbacks: /* @__PURE__ */ new Set(), disconnectCallbacks: /* @__PURE__ */ new Set(), connected: false, explicit: m, frameworkOwned: o, projection: { nodes: n ? f : Array.from(e.childNodes), slotNames: i } }, x = { definition: t, effects: u, refs: b.refs, connectCallbacks: b.connectCallbacks, disconnectCallbacks: b.disconnectCallbacks, projectedNodes: p, projectedSlotNames: i, slotInsertions: [], rootName: l, frameworkOwned: o, committed: n, hydrationRanges: h }, E = Yt(t.template, c, e.ownerDocument, d, x, n ? e : void 0);
|
|
2324
|
+
x.hydrationRanges = void 0;
|
|
2325
|
+
let v = E[0];
|
|
2326
|
+
return n && v !== e && y("HR005", `Server markup for <${t.contract.tag}> has an incompatible root.`), a instanceof HTMLElement && (a.focus({ preventScroll: true }), s !== void 0 && (a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement) && typeof s[0] == "number" && typeof s[1] == "number" && a.setSelectionRange(s[0], s[1])), et(v, t.contract.tag), b.element = v, { invocation: e, nativeRoot: v, context: x, definition: t, instance: b, replace: !n };
|
|
2327
|
+
}
|
|
2328
|
+
function nn(e, t) {
|
|
2329
|
+
t.sort((n, r) => n.invocation.contains(r.invocation) ? -1 : r.invocation.contains(n.invocation) ? 1 : 0);
|
|
2330
|
+
for (let n of t) {
|
|
2331
|
+
for (let r of n.context.slotInsertions) {
|
|
2332
|
+
for (let i of r.nodes) le(i);
|
|
2333
|
+
r.anchor.replaceWith(...r.nodes);
|
|
2334
|
+
}
|
|
2335
|
+
n.replace && n.invocation.replaceWith(n.nativeRoot), n.context.committed = true, nt.set(n.nativeRoot, n.instance), jr(n.nativeRoot, n.instance), Lr(n.nativeRoot, n.instance), st(n.instance);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
function Ft(e, t, n) {
|
|
2339
|
+
e.nodeType === 1 && e.matches(t) && n.add(e);
|
|
2340
|
+
for (let r of e.querySelectorAll(t)) n.add(r);
|
|
2341
|
+
}
|
|
2342
|
+
function rn(e, t) {
|
|
2343
|
+
let n = e.nodeType === 1 ? e : void 0;
|
|
2344
|
+
if (n?.matches("[data-component-root]") === true && t(n), n?.childElementCount !== 0) for (let r of e.querySelectorAll("[data-component-root]")) t(r);
|
|
2345
|
+
}
|
|
2346
|
+
function on(e, t, n) {
|
|
2347
|
+
let r = me(e), i = /* @__PURE__ */ new Set(), o = cr(r);
|
|
2348
|
+
for (let f of t) Ft(f, o, i);
|
|
2349
|
+
let a = [];
|
|
2350
|
+
for (let f of i) f.localName === "template" && f.hasAttribute("component") && !Ne.has(f) && a.push(dr(f, a.length));
|
|
2351
|
+
let s = /* @__PURE__ */ new Map();
|
|
2352
|
+
for (let f of a) {
|
|
2353
|
+
let h = f.definition.contract.tag;
|
|
2354
|
+
(r.definitions.has(h) || s.has(h)) && y("HR001", `More than one definition declares <${h}>.`), s.set(h, f);
|
|
2355
|
+
}
|
|
2356
|
+
let c = [], d = /* @__PURE__ */ new Set(), u = (f, h, p) => {
|
|
2357
|
+
let { definition: b } = f;
|
|
2358
|
+
return Ne.has(h) || e.defaultView?.customElements.get(b.contract.tag) !== void 0 || n?.(h, b, p) === false ? false : (c.push(tn(h, b, p)), true);
|
|
2359
|
+
}, l = (f, h) => {
|
|
2360
|
+
for (let p of h) {
|
|
2361
|
+
let b = f.get(p.localName);
|
|
2362
|
+
if (b !== void 0 && u(b, p, false), !p.hasAttribute("data-component-root")) continue;
|
|
2363
|
+
let x = L(p);
|
|
2364
|
+
if (x !== void 0) {
|
|
2365
|
+
x.frameworkOwned || d.add(p);
|
|
2366
|
+
continue;
|
|
2367
|
+
}
|
|
2368
|
+
let E = false;
|
|
2369
|
+
for (let v of new Set((p.getAttribute("data-component-root") ?? "").split(/\s+/))) {
|
|
2370
|
+
let g = f.get(v);
|
|
2371
|
+
g !== void 0 && u(g, p, true) && (E = true);
|
|
2372
|
+
}
|
|
2373
|
+
E && d.add(p);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
if (l(r.definitions, i), s.size > 0) {
|
|
2377
|
+
let f = ["[data-component-root]", ...Array.from(s.keys())].join(","), h = /* @__PURE__ */ new Set();
|
|
2378
|
+
Ft(e, f, h), l(s, h);
|
|
2379
|
+
}
|
|
2380
|
+
for (let f of a) He(r, f.definition.contract.tag, f), f.style !== void 0 && (f.style.textContent = Se(f.style.textContent ?? "", f.definition.contract.tag, f.definition.template.name), f.wrapper.ownerDocument.head.append(f.style)), f.wrapper.remove();
|
|
2381
|
+
nn(r, c);
|
|
2382
|
+
let m = c.map((f) => f.nativeRoot);
|
|
2383
|
+
for (let f of m) d.add(f);
|
|
2384
|
+
return { lowered: m, roots: Array.from(d) };
|
|
2385
|
+
}
|
|
2386
|
+
function Or(e = document) {
|
|
2387
|
+
return on(e, [e]).lowered.length;
|
|
2388
|
+
}
|
|
2389
|
+
function sn(e, t) {
|
|
2390
|
+
let n = pe(e), r = n.mutationHub;
|
|
2391
|
+
if (r === void 0) {
|
|
2392
|
+
let o = e.defaultView?.MutationObserver;
|
|
2393
|
+
o === void 0 && y("HR003", "Automatic component management requires a browser MutationObserver.");
|
|
2394
|
+
let a = /* @__PURE__ */ new Set(), s = new o((c) => {
|
|
2395
|
+
for (let d of Array.from(a)) d(c);
|
|
2396
|
+
});
|
|
2397
|
+
r = { observer: s, subscribers: a }, n.mutationHub = r, s.observe(e, { childList: true, subtree: true });
|
|
2398
|
+
}
|
|
2399
|
+
r.subscribers.add(t);
|
|
2400
|
+
let i = true;
|
|
2401
|
+
return () => {
|
|
2402
|
+
i && (i = false, r.subscribers.delete(t), r.subscribers.size === 0 && (r.observer.disconnect(), delete n.mutationHub));
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2405
|
+
function Ir(e) {
|
|
2406
|
+
let t = pe(e), n = t.lifecycle;
|
|
2407
|
+
if (n !== void 0) return n;
|
|
2408
|
+
let r = 0, i = (s) => {
|
|
2409
|
+
let c = s[Z];
|
|
2410
|
+
c !== void 0 && (s.isConnected && c.disconnect === void 0 ? c.disconnect = c.connect(s) : !s.isConnected && c.disconnect !== void 0 && (c.disconnect(), c.disconnect = void 0));
|
|
2411
|
+
}, o = sn(e, (s) => {
|
|
2412
|
+
let c = [], d = (u) => {
|
|
2413
|
+
if (u.nodeType !== 1) return;
|
|
2414
|
+
let l = u;
|
|
2415
|
+
l[Z] !== void 0 && c.push(l), rn(l, (m) => {
|
|
2416
|
+
m[Z] !== void 0 && c.push(m);
|
|
2417
|
+
});
|
|
2418
|
+
};
|
|
2419
|
+
for (let u of s) {
|
|
2420
|
+
for (let l of u.addedNodes) d(l);
|
|
2421
|
+
for (let l of u.removedNodes) d(l);
|
|
2422
|
+
}
|
|
2423
|
+
for (let u of c) i(u);
|
|
2424
|
+
}), a = { add(s, c) {
|
|
2425
|
+
let d = s, u = d[Z];
|
|
2426
|
+
u !== c && (u?.disconnect?.(), u === void 0 && (r += 1), d[Z] = c, i(s));
|
|
2427
|
+
}, remove(s, c) {
|
|
2428
|
+
let d = s;
|
|
2429
|
+
d[Z] === c && (c.disconnect?.(), delete d[Z], r -= 1, r === 0 && (o(), delete t.lifecycle));
|
|
2430
|
+
} };
|
|
2431
|
+
return t.lifecycle = a, a;
|
|
2432
|
+
}
|
|
2433
|
+
function Vr(e, t, n = {}) {
|
|
2434
|
+
let r = Ir(e.ownerDocument), i = { connect: (a) => ot(a, t, n), disconnect: void 0 };
|
|
2435
|
+
r.add(e, i);
|
|
2436
|
+
let o = false;
|
|
2437
|
+
return () => {
|
|
2438
|
+
o || (o = true, r.remove(e, i));
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
function zr(e, t = document) {
|
|
2442
|
+
let n = me(t);
|
|
2443
|
+
for (let r of e) {
|
|
2444
|
+
let i = n.definitions.get(r.contract.tag);
|
|
2445
|
+
if (i !== void 0) {
|
|
2446
|
+
JSON.stringify(i.definition) !== JSON.stringify(r) && y("HR001", `More than one definition declares <${r.contract.tag}>.`);
|
|
2447
|
+
continue;
|
|
2448
|
+
}
|
|
2449
|
+
if (He(n, r.contract.tag, { definition: r, style: void 0 }), r.css !== "") {
|
|
2450
|
+
let o = t.createElement("style");
|
|
2451
|
+
o.dataset.htmlNextPackage = r.contract.tag, o.textContent = Se(r.css, r.contract.tag, r.template.name), t.head.append(o);
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
function an(e, t) {
|
|
2456
|
+
let n = [], r = /* @__PURE__ */ new WeakMap(), i = (o, a) => {
|
|
2457
|
+
let s = a.children.filter((p) => p.kind === "slot"), c = s[0], d = c?.name ?? "", u = s.some((p) => (p.name ?? "") === "") ? "" : d, l = a.children.filter((p) => p.kind === "text").map((p) => p.value), m = 0, f = a.children.filter((p) => p.kind === "element"), h = 0;
|
|
2458
|
+
for (let p of Array.from(o.childNodes)) {
|
|
2459
|
+
if (p instanceof Element) {
|
|
2460
|
+
let b = p.getAttribute("data-component")?.split(/\s+/) ?? [], x = (p.getAttribute("data-component-root") ?? "").split(/\s+/);
|
|
2461
|
+
for (; h < f.length && f[h].name !== p.localName && !x.includes(f[h].name); ) h += 1;
|
|
2462
|
+
let E = f[h], v = E !== void 0 && p.localName !== E.name && x.includes(E.name);
|
|
2463
|
+
!b.includes(t.contract.tag) && !v ? (r.set(p, p.getAttribute("slot") ?? d), le(p), n.push(p)) : (h += 1, E !== void 0 && !v && i(p, E));
|
|
2464
|
+
continue;
|
|
2465
|
+
}
|
|
2466
|
+
if (p instanceof Comment && c !== void 0) {
|
|
2467
|
+
r.set(p, d), n.push(p);
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
if (p instanceof Text && p.data.trim() !== "") {
|
|
2471
|
+
for (; m < l.length && l[m] !== p.data; ) m += 1;
|
|
2472
|
+
m < l.length ? m += 1 : (r.set(p, u), n.push(p));
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
};
|
|
2476
|
+
return i(e, t.template), { projected: n, projectedSlotNames: r };
|
|
2477
|
+
}
|
|
2478
|
+
function ot(e, t, n = {}) {
|
|
2479
|
+
let r = e.ownerDocument, i = me(r), o = i.definitions.get(t.contract.tag);
|
|
2480
|
+
o === void 0 ? He(i, t.contract.tag, { definition: t, style: void 0 }) : JSON.stringify(o.definition) !== JSON.stringify(t) && y("HR001", `More than one definition declares <${t.contract.tag}>.`);
|
|
2481
|
+
let a = L(e);
|
|
2482
|
+
if (a !== void 0 && !a.frameworkOwned && (pe(r).release?.(e), Ae(a), nt.delete(e)), L(e) === void 0) {
|
|
2483
|
+
let { projected: l, projectedSlotNames: m } = an(e, t);
|
|
2484
|
+
de(e, t.contract.tag), et(e, t.contract.tag);
|
|
2485
|
+
for (let [f, h] of Object.entries(t.contract.props)) {
|
|
2486
|
+
let p = n.props?.[f];
|
|
2487
|
+
p != null && e.setAttribute(`data-${Y(f)}`, te(p, h.type));
|
|
2488
|
+
}
|
|
2489
|
+
nn(i, [tn(e, t, true, l, m, true)]);
|
|
2490
|
+
}
|
|
2491
|
+
let c = L(e);
|
|
2492
|
+
c === void 0 && y("HR005", `Could not attach <${t.contract.tag}> to its native root.`), cn(e, n.props ?? {}), st(c);
|
|
2493
|
+
let d, u = false;
|
|
2494
|
+
if (n.controller !== void 0) {
|
|
2495
|
+
let l = Promise.resolve(n.controller);
|
|
2496
|
+
dn(e, l), Promise.resolve(n.controller.default(at(e))).then((m) => {
|
|
2497
|
+
typeof m == "function" && (u ? m() : d = m);
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
return () => {
|
|
2501
|
+
u || (u = true, d?.(), Ae(c));
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
function cn(e, t) {
|
|
2505
|
+
let n = L(e);
|
|
2506
|
+
if (n !== void 0) for (let [r, i] of Object.entries(t)) {
|
|
2507
|
+
let o = n.definition.contract.props[r];
|
|
2508
|
+
if (o === void 0) continue;
|
|
2509
|
+
let a = `data-${Y(r)}`, s = Bt(r, o, i);
|
|
2510
|
+
i == null ? (n.explicit.delete(r), n.definition.template.attributes.some((d) => d.kind === "attribute" && d.name === a) || e.removeAttribute(a)) : (n.explicit.add(r), e.setAttribute(a, te(i, o.type))), Object.is(n.scope.get(r), s) || n.scope.set(r, s);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
function _r(e, t, n = {}) {
|
|
2514
|
+
let r = me(e.ownerDocument).definitions.get(t);
|
|
2515
|
+
return r === void 0 && y("HR005", `No registered definition declares <${t}>.`), ot(e, r.definition, n);
|
|
2516
|
+
}
|
|
2517
|
+
function st(e) {
|
|
2518
|
+
if (!e.connected) {
|
|
2519
|
+
e.connected = true;
|
|
2520
|
+
for (let t of e.effects) t.resume();
|
|
2521
|
+
for (let t of e.connectCallbacks) t();
|
|
2522
|
+
e.element?.dispatchEvent(new Event("connect"));
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
function Ae(e) {
|
|
2526
|
+
if (e.connected) {
|
|
2527
|
+
e.element?.dispatchEvent(new Event("disconnect"));
|
|
2528
|
+
for (let t of e.disconnectCallbacks) t();
|
|
2529
|
+
e.connected = false;
|
|
2530
|
+
for (let t of e.effects) t.pause();
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
function at(e) {
|
|
2534
|
+
let t = L(e);
|
|
2535
|
+
if (t === void 0) return;
|
|
2536
|
+
if (t.host !== void 0) return t.host;
|
|
2537
|
+
let n = new Set((t.definition.declarations ?? []).filter((a) => a.kind === "state").map((a) => a.name)), r = new Proxy({}, { get: (a, s) => {
|
|
2538
|
+
if (typeof s != "string") return;
|
|
2539
|
+
let c = t.scope.get(s);
|
|
2540
|
+
return c === T ? void 0 : c;
|
|
2541
|
+
}, set: (a, s, c) => {
|
|
2542
|
+
if (typeof s != "string" || !n.has(s)) throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);
|
|
2543
|
+
return t.scope.set(s, c), true;
|
|
2544
|
+
}, has: (a, s) => typeof s == "string" && t.scope.has(s) }), i = new Proxy({}, { get: (a, s) => typeof s != "string" ? void 0 : (e instanceof HTMLFormElement ? e : e.querySelector("form"))?.elements.namedItem(s) ?? e.querySelector(`[name="${CSS.escape(s)}"]`) ?? void 0 }), o = { element: e, state: r, refs: t.refs, elements: i, signal(a) {
|
|
2545
|
+
return Ht(a);
|
|
2546
|
+
}, computed(a) {
|
|
2547
|
+
let s = Mt(t.scope.scheduler, a);
|
|
2548
|
+
return t.connected || s.pause(), t.effects.unshift(s), s;
|
|
2549
|
+
}, effect(a) {
|
|
2550
|
+
let s = ce(t.scope.scheduler, a, 2, t.connected);
|
|
2551
|
+
return t.effects.push(s), () => s.stop();
|
|
2552
|
+
}, on(a, s) {
|
|
2553
|
+
if (a === "connect") {
|
|
2554
|
+
let c = s;
|
|
2555
|
+
return t.connectCallbacks.add(c), t.connected && s(), () => t.connectCallbacks.delete(c);
|
|
2556
|
+
}
|
|
2557
|
+
if (a === "disconnect") {
|
|
2558
|
+
let c = s;
|
|
2559
|
+
return t.disconnectCallbacks.add(c), () => t.disconnectCallbacks.delete(c);
|
|
2560
|
+
}
|
|
2561
|
+
return e.addEventListener(a, s), () => e.removeEventListener(a, s);
|
|
2562
|
+
}, dispatch(a, s) {
|
|
2563
|
+
return Gt(e, a, s, Jt(t.definition, a));
|
|
2564
|
+
} };
|
|
2565
|
+
return t.host = Object.freeze(o), t.host;
|
|
2566
|
+
}
|
|
2567
|
+
function dn(e, t) {
|
|
2568
|
+
let n = L(e);
|
|
2569
|
+
n === void 0 && y("HJ003", "A controller can attach only to a lowered component root."), n.controllerModule = t;
|
|
2570
|
+
}
|
|
2571
|
+
function qr(e = document, t = {}) {
|
|
2572
|
+
let n = pe(e);
|
|
2573
|
+
n.observer !== void 0 && y("HR003", "This document is already being observed.");
|
|
2574
|
+
let r = /* @__PURE__ */ new Map(), i = t.onError ?? ((l) => console.error(l)), o = false, a = (l) => {
|
|
2575
|
+
let m = r.get(l);
|
|
2576
|
+
r.delete(l);
|
|
2577
|
+
let f = L(l);
|
|
2578
|
+
f !== void 0 && Ae(f);
|
|
2579
|
+
try {
|
|
2580
|
+
m?.();
|
|
2581
|
+
} catch (h) {
|
|
2582
|
+
i(h);
|
|
2583
|
+
}
|
|
2584
|
+
}, s = (l) => {
|
|
2585
|
+
let m = L(l);
|
|
2586
|
+
if (!(m === void 0 || m.frameworkOwned || r.has(l) || !e.contains(l))) {
|
|
2587
|
+
r.set(l, void 0);
|
|
2588
|
+
try {
|
|
2589
|
+
st(m);
|
|
2590
|
+
let f = t.onConnect?.(l, m.definition);
|
|
2591
|
+
o ? f?.() : r.set(l, f);
|
|
2592
|
+
} catch (f) {
|
|
2593
|
+
i(f);
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
}, c = (l) => {
|
|
2597
|
+
if (o) return;
|
|
2598
|
+
let m = [];
|
|
2599
|
+
if (l === void 0) m.push(e);
|
|
2600
|
+
else {
|
|
2601
|
+
let f = [];
|
|
2602
|
+
for (let h of l) {
|
|
2603
|
+
for (let p of h.removedNodes) p.nodeType === 1 && rn(p, (b) => {
|
|
2604
|
+
r.has(b) && f.push(b);
|
|
2605
|
+
});
|
|
2606
|
+
for (let p of h.addedNodes) p.nodeType === 1 && m.push(p);
|
|
2607
|
+
}
|
|
2608
|
+
for (let h of f) e.contains(h) || a(h);
|
|
2609
|
+
}
|
|
2610
|
+
if (m.length > 0) try {
|
|
2611
|
+
for (let f of on(e, m, t.shouldLower).roots) {
|
|
2612
|
+
if (o) break;
|
|
2613
|
+
s(f);
|
|
2614
|
+
}
|
|
2615
|
+
} catch (f) {
|
|
2616
|
+
i(f);
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
n.release = (l) => {
|
|
2620
|
+
r.has(l) && a(l);
|
|
2621
|
+
};
|
|
2622
|
+
let d = sn(e, c), u = () => {
|
|
2623
|
+
if (!o) {
|
|
2624
|
+
o = true, d(), delete n.observer, delete n.release;
|
|
2625
|
+
for (let l of r.values()) try {
|
|
2626
|
+
l?.();
|
|
2627
|
+
} catch (m) {
|
|
2628
|
+
i(m);
|
|
2629
|
+
}
|
|
2630
|
+
for (let l of r.keys()) {
|
|
2631
|
+
let m = L(l);
|
|
2632
|
+
m !== void 0 && Ae(m);
|
|
2633
|
+
}
|
|
2634
|
+
r.clear();
|
|
2635
|
+
}
|
|
2636
|
+
};
|
|
2637
|
+
return n.observer = u, c(), u;
|
|
2638
|
+
}
|
|
2639
|
+
return hn(Ur);
|
|
2640
|
+
})();
|
|
2641
|
+
var { attachComponent, attachRegisteredComponent, getComponentHost, installComponentGraph, lowerDocument, manageComponentLifecycle, observeDocument, registerComponentDefinitions, serializeRenderedForm, setControllerModule, updateComponentProps } = HtmlRuntime;
|
|
2642
|
+
|
|
2643
|
+
// src/declarative.ts
|
|
2644
|
+
var stateKey = /* @__PURE__ */ Symbol.for("@threadlabs/looma.declarative.v1");
|
|
2645
|
+
var stateTarget = globalThis;
|
|
2646
|
+
var state = stateTarget[stateKey] ??= {
|
|
2647
|
+
runtime: {
|
|
2648
|
+
attachRegisteredComponent,
|
|
2649
|
+
getComponentHost,
|
|
2650
|
+
manageComponentLifecycle,
|
|
2651
|
+
observeDocument,
|
|
2652
|
+
setControllerModule,
|
|
2653
|
+
updateComponentProps
|
|
2654
|
+
},
|
|
2655
|
+
records: /* @__PURE__ */ new Map(),
|
|
2656
|
+
installedPackages: /* @__PURE__ */ new Set(),
|
|
2657
|
+
stopObservation: void 0,
|
|
2658
|
+
observationScheduled: false
|
|
2659
|
+
};
|
|
2660
|
+
function connectController(element, tag) {
|
|
2661
|
+
const controller = state.records.get(tag)?.controller;
|
|
2662
|
+
if (!controller?.default) return;
|
|
2663
|
+
state.runtime.setControllerModule(element, Promise.resolve(controller));
|
|
2664
|
+
return controller.default(state.runtime.getComponentHost(element));
|
|
2665
|
+
}
|
|
2666
|
+
function scheduleObservation() {
|
|
2667
|
+
if (state.observationScheduled || typeof document === "undefined") return;
|
|
2668
|
+
state.observationScheduled = true;
|
|
2669
|
+
queueMicrotask(() => {
|
|
2670
|
+
state.observationScheduled = false;
|
|
2671
|
+
state.stopObservation?.();
|
|
2672
|
+
state.stopObservation = state.runtime.observeDocument(document, {
|
|
2673
|
+
onConnect(element, definition) {
|
|
2674
|
+
return connectController(element, definition.contract.tag);
|
|
2675
|
+
}
|
|
2676
|
+
});
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
function registerLoomaPackage(name, packageRecords, styles) {
|
|
2680
|
+
if (typeof document === "undefined" || state.installedPackages.has(name)) return;
|
|
2681
|
+
state.stopObservation?.();
|
|
2682
|
+
state.stopObservation = void 0;
|
|
2683
|
+
state.installedPackages.add(name);
|
|
2684
|
+
const definitions = document.createElement("div");
|
|
2685
|
+
definitions.hidden = true;
|
|
2686
|
+
definitions.dataset.loomaDefinitions = name;
|
|
2687
|
+
definitions.innerHTML = packageRecords.map(({ source }) => source).join("\n");
|
|
2688
|
+
document.head.append(...Array.from(definitions.children));
|
|
2689
|
+
for (const record of packageRecords) state.records.set(record.tag, record);
|
|
2690
|
+
if (styles !== "") {
|
|
2691
|
+
const style = document.createElement("style");
|
|
2692
|
+
style.dataset.loomaStyles = name;
|
|
2693
|
+
style.textContent = styles;
|
|
2694
|
+
document.head.append(style);
|
|
2695
|
+
}
|
|
2696
|
+
scheduleObservation();
|
|
2697
|
+
}
|
|
2698
|
+
function attachLoomaComponent(element, definition, tag, props) {
|
|
2699
|
+
if (definition.contract.tag !== tag) {
|
|
2700
|
+
throw new TypeError(`Looma definition ${definition.contract.tag} cannot attach as ${tag}.`);
|
|
2701
|
+
}
|
|
2702
|
+
const controller = state.records.get(tag)?.controller;
|
|
2703
|
+
return state.runtime.attachRegisteredComponent(element, tag, { props, controller });
|
|
2704
|
+
}
|
|
2705
|
+
function updateComponentProps2(element, props) {
|
|
2706
|
+
(state.runtime.updateComponentProps ?? updateComponentProps)(element, props);
|
|
2707
|
+
}
|
|
2708
|
+
function controllerFor(tag) {
|
|
2709
|
+
return state.records.get(tag)?.controller;
|
|
2710
|
+
}
|
|
2711
|
+
function manageComponentLifecycle2(...args) {
|
|
2712
|
+
return state.runtime.manageComponentLifecycle(...args);
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
export {
|
|
2716
|
+
registerLoomaPackage,
|
|
2717
|
+
attachLoomaComponent,
|
|
2718
|
+
updateComponentProps2 as updateComponentProps,
|
|
2719
|
+
controllerFor,
|
|
2720
|
+
manageComponentLifecycle2 as manageComponentLifecycle
|
|
2721
|
+
};
|