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