uxml-preview 0.3.0 → 0.5.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/index.js CHANGED
@@ -1,5 +1,584 @@
1
- import { loadYoga as Me, PositionType as Z, Direction as le, Edge as P, BoxSizing as Re, FlexDirection as V, Wrap as q, Justify as W, Align as L, Display as Ue, Overflow as De } from "yoga-layout/load";
2
- const xe = {
1
+ import { loadYoga as tt, PositionType as ne, Direction as be, Edge as q, BoxSizing as nt, FlexDirection as G, Wrap as Y, Justify as P, Align as W, Display as st, Overflow as rt } from "yoga-layout/load";
2
+ function J(e) {
3
+ const n = (t, s) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? s : String.fromCodePoint(t);
4
+ return e.replace(/&#x([0-9a-f]+);/gi, (t, s) => n(parseInt(s, 16), t)).replace(/&#(\d+);/g, (t, s) => n(Number(s), t)).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
5
+ }
6
+ function ye(e) {
7
+ return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
8
+ }
9
+ function xe(e) {
10
+ return e !== void 0 && /[A-Za-z_]/.test(e);
11
+ }
12
+ function it(e) {
13
+ return e === " " || e === " " || e === `
14
+ ` || e === "\r";
15
+ }
16
+ function Re(e) {
17
+ const n = [];
18
+ let t = 0, s = 0;
19
+ const i = () => s++;
20
+ function r(a, f, l) {
21
+ n.push({
22
+ kind: "malformed",
23
+ message: a,
24
+ at: { in: "uxml", span: { start: f, end: l } }
25
+ });
26
+ }
27
+ function u() {
28
+ for (; it(e[t]); ) t++;
29
+ }
30
+ function c() {
31
+ for (; ; ) {
32
+ const a = e.indexOf("<", t);
33
+ if (a < 0) {
34
+ t = e.length;
35
+ return;
36
+ }
37
+ const f = e[a + 1];
38
+ if (f === "!") {
39
+ if (e.startsWith("<!--", a)) {
40
+ const l = e.indexOf("-->", a + 4);
41
+ t = l < 0 ? e.length : l + 3;
42
+ } else if (e.startsWith("<![CDATA[", a)) {
43
+ const l = e.indexOf("]]>", a + 9);
44
+ t = l < 0 ? e.length : l + 3;
45
+ } else {
46
+ const l = e.indexOf(">", a);
47
+ t = l < 0 ? e.length : l + 1;
48
+ }
49
+ continue;
50
+ }
51
+ if (f === "?") {
52
+ const l = e.indexOf("?>", a + 2);
53
+ t = l < 0 ? e.length : l + 2;
54
+ continue;
55
+ }
56
+ t = a;
57
+ return;
58
+ }
59
+ }
60
+ function v() {
61
+ const a = t;
62
+ for (; ye(e[t]); ) t++;
63
+ const f = e.slice(a, t), l = f.indexOf(":");
64
+ return l < 0 ? { prefix: null, local: f } : { prefix: f.slice(0, l), local: f.slice(l + 1) };
65
+ }
66
+ function d() {
67
+ const a = t;
68
+ for (; ye(e[t]); ) t++;
69
+ if (t === a) return null;
70
+ const f = e.slice(a, t), l = t;
71
+ if (u(), e[t] !== "=")
72
+ return t = l, r(`attribute "${f}" has no value`, a, l), { name: f, value: "", span: { start: a, end: l } };
73
+ t++, u();
74
+ const h = e[t];
75
+ if (h !== '"' && h !== "'")
76
+ return r(`attribute "${f}" has an unquoted value`, a, t), { name: f, value: "", span: { start: a, end: t } };
77
+ t++;
78
+ const g = t, p = e.indexOf(h, t);
79
+ return p < 0 ? (r(`attribute "${f}" has an unterminated value`, a, e.length), t = e.length, { name: f, value: e.slice(g), span: { start: a, end: t } }) : (t = p + 1, { name: f, value: e.slice(g, p), span: { start: a, end: t } });
80
+ }
81
+ function o() {
82
+ const a = t;
83
+ t++;
84
+ const f = v(), l = [];
85
+ let h = !1;
86
+ for (; ; ) {
87
+ u();
88
+ const k = e[t];
89
+ if (k === void 0) {
90
+ r("unterminated open tag", a, e.length);
91
+ break;
92
+ }
93
+ if (k === ">") {
94
+ t++;
95
+ break;
96
+ }
97
+ if (k === "/" && e[t + 1] === ">") {
98
+ t += 2, h = !0;
99
+ break;
100
+ }
101
+ const x = d();
102
+ if (x === null) {
103
+ t++;
104
+ continue;
105
+ }
106
+ l.push(x);
107
+ }
108
+ const g = { start: a, end: t };
109
+ if (h)
110
+ return {
111
+ id: i(),
112
+ name: f,
113
+ attributes: l,
114
+ children: [],
115
+ spans: { openTag: g, inner: { start: t, end: t }, closeTag: null },
116
+ tagDirty: !1,
117
+ childrenDirty: !1
118
+ };
119
+ const p = t, b = [];
120
+ for (; ; ) {
121
+ if (c(), t >= e.length) {
122
+ r(`unterminated element <${Ce(f)}>`, a, e.length);
123
+ break;
124
+ }
125
+ const k = e[t + 1];
126
+ if (k === "/") break;
127
+ if (!xe(k)) {
128
+ t++;
129
+ continue;
130
+ }
131
+ b.push(o());
132
+ }
133
+ const m = t;
134
+ let y = null;
135
+ if (e.startsWith("</", t)) {
136
+ const k = e.indexOf(">", t), x = k < 0 ? e.length : k + 1;
137
+ k < 0 && r("unterminated end tag", t, x), y = { start: t, end: x }, t = x;
138
+ }
139
+ return {
140
+ id: i(),
141
+ name: f,
142
+ attributes: l,
143
+ children: b,
144
+ spans: { openTag: g, inner: { start: p, end: m }, closeTag: y },
145
+ tagDirty: !1,
146
+ childrenDirty: !1
147
+ };
148
+ }
149
+ return c(), t < e.length && xe(e[t + 1]) ? { root: o(), warnings: n } : (r("no root element", 0, 0), {
150
+ root: {
151
+ id: i(),
152
+ name: { prefix: null, local: "" },
153
+ attributes: [],
154
+ children: [],
155
+ spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
156
+ tagDirty: !1,
157
+ childrenDirty: !1
158
+ },
159
+ warnings: n
160
+ });
161
+ }
162
+ function Ce(e) {
163
+ return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
164
+ }
165
+ let Me;
166
+ function ot(e) {
167
+ Me = e;
168
+ }
169
+ const Ue = /* @__PURE__ */ new WeakMap();
170
+ function lt(e, n) {
171
+ Ue.set(e, n);
172
+ }
173
+ function bn(e) {
174
+ return Re(e).root.children.filter((t) => t.name.local === "Template").flatMap((t) => {
175
+ const s = Le(t, "src");
176
+ return s === void 0 || s.length === 0 ? [] : [J(s)];
177
+ });
178
+ }
179
+ const ke = 32;
180
+ function Le(e, n) {
181
+ var t;
182
+ return (t = e.attributes.find((s) => s.name === n)) == null ? void 0 : t.value;
183
+ }
184
+ function U(e, n) {
185
+ const t = Le(e, n);
186
+ return t === void 0 ? void 0 : J(t);
187
+ }
188
+ function We(e) {
189
+ const n = /* @__PURE__ */ new Map();
190
+ for (const t of e.root.children) {
191
+ if (t.name.local !== "Template") continue;
192
+ const s = U(t, "name"), i = U(t, "src");
193
+ s === void 0 || s.length === 0 || i === void 0 || i.length === 0 || n.set(s, { name: s, src: i, node: t });
194
+ }
195
+ return n;
196
+ }
197
+ function ze(e, n) {
198
+ return JSON.stringify([e, n]);
199
+ }
200
+ function at(e) {
201
+ return /(?:^|\/)Packages\//i.test(e) || /PackageCache/i.test(e);
202
+ }
203
+ function j(e, n, t, s, i) {
204
+ e.push({
205
+ kind: n,
206
+ message: t,
207
+ ...s === void 0 ? {} : { node: s.id },
208
+ ...i === void 0 ? {} : { sourceDocument: i }
209
+ });
210
+ }
211
+ function ee(e, n = 0, t = void 0) {
212
+ return {
213
+ ...e,
214
+ span: {
215
+ start: e.span.start + n,
216
+ end: e.span.end + n
217
+ },
218
+ ...t === void 0 ? {} : { sourceDocument: t }
219
+ };
220
+ }
221
+ function _e(e) {
222
+ return { prefix: e.prefix, local: e.local };
223
+ }
224
+ function Se() {
225
+ return { start: 0, end: 0 };
226
+ }
227
+ function se(e, n) {
228
+ return { start: e.start + n, end: e.end + n };
229
+ }
230
+ function ct(e, n, t, s, i) {
231
+ return {
232
+ id: e,
233
+ name: n,
234
+ attributes: t,
235
+ children: s,
236
+ spans: { openTag: Se(), inner: Se(), closeTag: null },
237
+ tagDirty: !1,
238
+ childrenDirty: !1,
239
+ ...i === void 0 ? {} : { derived: { kind: "template-container", instance: i } }
240
+ };
241
+ }
242
+ function ut(e, n, t) {
243
+ const s = e.items.map((i) => i.kind !== "import" || i.resolvedSheet === void 0 ? i.kind === "rule" ? {
244
+ ...i,
245
+ rule: {
246
+ ...i.rule,
247
+ selectors: i.rule.selectors.map((r) => ({
248
+ ...r,
249
+ parts: r.parts.map((u) => ({ ...u, simple: [...u.simple] }))
250
+ })),
251
+ declarations: i.rule.declarations.map((r) => ({ ...r }))
252
+ }
253
+ } : { ...i } : { ...i, resolvedSheet: i.resolvedSheet + n });
254
+ return { ...e, items: s, sourceDocumentFrom: t };
255
+ }
256
+ function dt(e, n) {
257
+ const t = n.sheetOffsets.get(e.document);
258
+ if (t !== void 0) return t;
259
+ const s = n.sheets.length, i = e.document.sheets.map((u, c) => s + c), r = e.document.sheets.map(() => e.url);
260
+ return e.document.sheets.forEach((u, c) => {
261
+ for (const v of u.items)
262
+ v.kind === "import" && v.resolvedSheet !== void 0 && (r[v.resolvedSheet] = u.origin ?? e.url);
263
+ }), n.sheetOffsets.set(e.document, i), e.document.sheets.forEach(
264
+ (u, c) => n.sheets.push(ut(u, s, r[c]))
265
+ ), i;
266
+ }
267
+ function je(e, n) {
268
+ const t = n.sourceOffsets.get(e);
269
+ if (t !== void 0) return t;
270
+ const s = n.sourceLength + 1;
271
+ return n.sourceOffsets.set(e, s), n.sources.push(`
272
+ ${e.source}`), n.sourceLength += e.source.length + 1, s;
273
+ }
274
+ function ft(e, n, t, s, i) {
275
+ for (const r of e.document.styleRoots ?? []) {
276
+ const u = n[r.sheet];
277
+ if (u === void 0) continue;
278
+ const c = t.nodes.get(r.scope) ?? s.id;
279
+ i.styleRoots.push({ sheet: u, scope: c });
280
+ }
281
+ }
282
+ function pt(e) {
283
+ return e.map((n) => {
284
+ const t = U(n, "name"), s = U(n, "slot");
285
+ return `<${n.name.local}${t === void 0 ? "" : ` name="${t}"`}${s === void 0 ? "" : ` slot="${s}"`}>`;
286
+ });
287
+ }
288
+ function Fe(e, n) {
289
+ const t = U(e, "slot-name");
290
+ t !== void 0 && t.length > 0 && n.add(t);
291
+ for (const s of e.children) Fe(s, n);
292
+ }
293
+ function V(e, n, t, s, i) {
294
+ const r = /* @__PURE__ */ new Set();
295
+ t !== null && Fe(t.document.root, r), !(r.size === 0 && n.length === 0) && j(
296
+ i.warnings,
297
+ "template-slot-unsupported",
298
+ `Template slots are unsupported; defined slot names: ${t === null ? "(unavailable)" : r.size === 0 ? "(none)" : [...r].join(", ")}; children not placed: ${n.length === 0 ? "(none)" : pt(n).join(", ")}`,
299
+ e,
300
+ s
301
+ );
302
+ }
303
+ function pe(e, n) {
304
+ if (e.name.local !== "Style" && e.name.local !== "Template" && e.name.local !== "AttributeOverrides") {
305
+ const t = U(e, "name");
306
+ t !== void 0 && t.length > 0 && n.set(t, (n.get(t) ?? 0) + 1);
307
+ }
308
+ for (const t of e.children) pe(t, n);
309
+ }
310
+ function Pe(e, n, t) {
311
+ U(e, "name") === n && t.push(e);
312
+ for (const s of e.children) Pe(s, n, t);
313
+ }
314
+ function ht(e, n, t, s, i) {
315
+ if (n.length === 0) return;
316
+ const r = /* @__PURE__ */ new Map();
317
+ pe(e, r);
318
+ for (const u of n) {
319
+ const c = U(u, "element-name"), v = U(u, "style");
320
+ if (v !== void 0 && j(
321
+ i.warnings,
322
+ "override-style-ignored",
323
+ `AttributeOverrides style for element-name "${c ?? "(missing)"}" was ignored with value "${v}"; Unity ignores style AttributeOverrides, so this matches Unity and is not a preview limitation.`,
324
+ u,
325
+ s ?? void 0
326
+ ), c === void 0 || c.length === 0) continue;
327
+ const d = [];
328
+ if (Pe(e, c, d), d.length === 0) {
329
+ const o = [...r.keys()];
330
+ j(
331
+ i.warnings,
332
+ "override-target-missing",
333
+ `AttributeOverrides target "${c}" matched no element; available names: ${o.length === 0 ? "(none)" : o.join(", ")}`,
334
+ u,
335
+ s ?? void 0
336
+ );
337
+ continue;
338
+ }
339
+ for (const o of d)
340
+ for (const a of u.attributes) {
341
+ if (a.name === "element-name" || a.name === "style") continue;
342
+ const f = o.attributes.find((l) => l.name === a.name);
343
+ f === void 0 ? o.attributes.push(ee(a, t, s)) : (f.value = a.value, f.sourceDocument = s);
344
+ }
345
+ }
346
+ }
347
+ function Be(e) {
348
+ return e.name.local === "Template" || e.name.local === "Instance" ? !0 : e.children.some(Be);
349
+ }
350
+ function mt(e, n) {
351
+ let t = 0;
352
+ const s = (i) => {
353
+ t = Math.max(t, Number(i.id) + 1);
354
+ for (const r of i.children) s(r);
355
+ };
356
+ return s(e.root), {
357
+ resolver: n,
358
+ warnings: [],
359
+ cache: /* @__PURE__ */ new Map(),
360
+ sheetOffsets: /* @__PURE__ */ new WeakMap(),
361
+ reportedWarnings: /* @__PURE__ */ new WeakSet(),
362
+ sourceOffsets: new WeakMap([[e, 0]]),
363
+ sources: [e.source],
364
+ sourceLength: e.source.length,
365
+ sheets: [...e.sheets],
366
+ styleRoots: [...e.styleRoots ?? []],
367
+ nextId: () => t++,
368
+ stack: []
369
+ };
370
+ }
371
+ function gt(e, n, t) {
372
+ var v;
373
+ const s = ze(e.src, n);
374
+ if (t.cache.has(s)) return t.cache.get(s) ?? null;
375
+ const i = ((v = t.resolver) == null ? void 0 : v.call(t, e.src, n)) ?? null;
376
+ if (i === null)
377
+ return t.cache.set(s, null), j(
378
+ t.warnings,
379
+ "template-src-unresolved",
380
+ `Template "${e.name}" src "${e.src}" could not be resolved from ${n === null ? "the entry UXML" : `"${n}"`}; attempted resolveImport("${e.src}", ${n === null ? "null" : `"${n}"`}); internal filesystem search paths: none`,
381
+ e.node,
382
+ n ?? void 0
383
+ ), at(e.src) && j(
384
+ t.warnings,
385
+ "package-path-not-searched",
386
+ `Template src "${e.src}" was unresolved; the resolver returned no source and the core does not independently search Unity Packages/Library/PackageCache paths`,
387
+ e.node,
388
+ n ?? void 0
389
+ ), null;
390
+ const r = Me;
391
+ if (r === void 0)
392
+ throw new Error("template parser is not registered; import parse from src/index before expansion");
393
+ const u = r(
394
+ i,
395
+ t.resolver === void 0 ? void 0 : (d, o) => t.resolver(d, o ?? e.src)
396
+ ), c = {
397
+ url: e.src,
398
+ from: n,
399
+ document: u,
400
+ declarations: We(u)
401
+ };
402
+ return t.cache.set(s, c), c;
403
+ }
404
+ function wt(e, n, t) {
405
+ var s, i;
406
+ if (!t.reportedWarnings.has(e.document)) {
407
+ t.reportedWarnings.add(e.document);
408
+ for (const r of e.document.warnings)
409
+ ((s = r.at) == null ? void 0 : s.in) === "uss" ? t.warnings.push({
410
+ ...r,
411
+ at: { ...r.at, sheet: n[r.at.sheet] ?? r.at.sheet },
412
+ sourceDocument: ((i = e.document.sheets[r.at.sheet]) == null ? void 0 : i.origin) ?? e.url
413
+ }) : t.warnings.push({ ...r, sourceDocument: e.url });
414
+ }
415
+ }
416
+ function te(e, n, t, s, i, r) {
417
+ const u = i ? e.id : n.nextId(), c = s === null ? 0 : n.sourceOffsets.get(s.document) ?? 0, v = c === 0 || s === null ? void 0 : s.url, d = {
418
+ id: u,
419
+ name: _e(e.name),
420
+ attributes: e.attributes.map((o) => ee(o, c, v)),
421
+ children: [],
422
+ spans: {
423
+ openTag: se(e.spans.openTag, c),
424
+ inner: se(e.spans.inner, c),
425
+ closeTag: e.spans.closeTag === null ? null : se(e.spans.closeTag, c)
426
+ },
427
+ tagDirty: e.tagDirty,
428
+ childrenDirty: e.childrenDirty,
429
+ ...c === 0 || s === null ? {} : {
430
+ sourceDocument: s.url,
431
+ sourceDocumentFrom: s.from,
432
+ sourceNode: e.id
433
+ }
434
+ };
435
+ t.nodes.set(e.id, d.id);
436
+ for (const o of e.children)
437
+ if (!(o.name.local === "Template" || o.name.local === "Style")) {
438
+ if (o.name.local === "Instance") {
439
+ d.children.push(he(o, n, s, t, r + 1));
440
+ continue;
441
+ }
442
+ o.name.local !== "AttributeOverrides" && U(o, "slot") === void 0 && d.children.push(te(o, n, t, s, i, r));
443
+ }
444
+ return d;
445
+ }
446
+ function vt(e, n, t, s) {
447
+ je(e.document, t);
448
+ const i = { nodes: /* @__PURE__ */ new Map([[e.document.root.id, n.id]]) };
449
+ for (const r of e.document.root.children)
450
+ if (!(r.name.local === "Template" || r.name.local === "Style")) {
451
+ if (r.name.local === "Instance") {
452
+ n.children.push(he(r, t, e, i, s + 1));
453
+ continue;
454
+ }
455
+ r.name.local !== "AttributeOverrides" && U(r, "slot") === void 0 && n.children.push(te(r, t, i, e, !1, s));
456
+ }
457
+ return i;
458
+ }
459
+ function he(e, n, t, s, i) {
460
+ const r = ct(
461
+ n.nextId(),
462
+ { prefix: e.name.prefix, local: "TemplateContainer" },
463
+ e.attributes.filter((b) => b.name !== "template").map(
464
+ (b) => ee(
465
+ b,
466
+ t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
467
+ t === null || t.url.length === 0 ? null : t.url
468
+ )
469
+ ),
470
+ [],
471
+ e.id
472
+ );
473
+ t !== null && (r.sourceDocument = t.url.length > 0 ? t.url : null, r.sourceDocumentFrom = t.from), s.nodes.set(e.id, r.id);
474
+ const u = U(e, "template"), c = e.children.filter((b) => U(b, "slot") !== void 0), v = t === null || t.url.length === 0 ? void 0 : t.url, d = t == null ? void 0 : t.declarations.get(u ?? "");
475
+ if (d === void 0)
476
+ return V(e, c, null, v, n), j(
477
+ n.warnings,
478
+ "template-not-declared",
479
+ `Instance${u === void 0 ? "" : ` template "${u}"`} has no matching Template declaration`,
480
+ e,
481
+ v
482
+ ), r;
483
+ const o = t === null || t.url.length === 0 ? null : t.url, a = {
484
+ key: JSON.stringify([d.name, d.src, o]),
485
+ label: `${d.name}@${d.src}`
486
+ }, f = n.stack.findIndex((b) => b.key === a.key);
487
+ if (f >= 0) {
488
+ const b = n.cache.get(ze(d.src, o)) ?? null;
489
+ V(e, c, b, v, n);
490
+ const m = [...n.stack.slice(f), a].map((y) => y.label).join(" -> ");
491
+ return j(
492
+ n.warnings,
493
+ "template-cycle",
494
+ `Template cycle detected: ${m}`,
495
+ e,
496
+ v
497
+ ), r;
498
+ }
499
+ if (i >= ke)
500
+ return V(e, c, null, v, n), j(
501
+ n.warnings,
502
+ "template-depth-exceeded",
503
+ `Template expansion exceeded the depth limit ${ke}: ${[
504
+ ...n.stack,
505
+ a
506
+ ].map((b) => b.label).join(" -> ")}`,
507
+ e,
508
+ v
509
+ ), r;
510
+ const l = gt(d, o, n);
511
+ if (l === null)
512
+ return V(e, c, null, v, n), r;
513
+ je(l.document, n), n.stack.push(a);
514
+ const h = vt(l, r, n, i);
515
+ n.stack.pop();
516
+ const g = dt(l, n);
517
+ wt(l, g, n), ft(l, g, h, r, n);
518
+ const p = e.children.filter((b) => b.name.local === "AttributeOverrides");
519
+ V(e, c, l, v, n), ht(
520
+ r,
521
+ p,
522
+ t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
523
+ t === null || t.url.length === 0 ? null : t.url,
524
+ n
525
+ );
526
+ for (const b of e.children)
527
+ b.name.local === "AttributeOverrides" || b.name.local === "Style" || U(b, "slot") !== void 0 || r.children.push(te(b, n, s, t, !1, i));
528
+ return r;
529
+ }
530
+ function bt(e) {
531
+ if (!Be(e.root)) return { document: e, warnings: [] };
532
+ const n = mt(e, Ue.get(e)), t = n.styleRoots.length, s = {
533
+ url: "",
534
+ from: null,
535
+ document: e,
536
+ declarations: We(e)
537
+ }, i = { nodes: /* @__PURE__ */ new Map([[e.root.id, e.root.id]]) }, r = {
538
+ id: e.root.id,
539
+ name: _e(e.root.name),
540
+ attributes: e.root.attributes.map((c) => ee(c)),
541
+ children: [],
542
+ spans: {
543
+ openTag: { ...e.root.spans.openTag },
544
+ inner: { ...e.root.spans.inner },
545
+ closeTag: e.root.spans.closeTag === null ? null : { ...e.root.spans.closeTag }
546
+ },
547
+ tagDirty: e.root.tagDirty,
548
+ childrenDirty: e.root.childrenDirty
549
+ };
550
+ for (const c of e.root.children)
551
+ if (!(c.name.local === "Template" || c.name.local === "Style")) {
552
+ if (c.name.local === "Instance") {
553
+ r.children.push(he(c, n, s, i, 0));
554
+ continue;
555
+ }
556
+ c.name.local !== "AttributeOverrides" && U(c, "slot") === void 0 && r.children.push(te(c, n, i, s, !0, 0));
557
+ }
558
+ for (let c = 0; c < t; c++) {
559
+ const v = n.styleRoots[c], d = i.nodes.get(v.scope);
560
+ d !== void 0 && (n.styleRoots[c] = { ...v, scope: d });
561
+ }
562
+ const u = /* @__PURE__ */ new Map();
563
+ pe(r, u);
564
+ for (const [c, v] of u)
565
+ v > 1 && j(
566
+ n.warnings,
567
+ "duplicate-name-in-tree",
568
+ `name "${c}" occurs ${v} times after template expansion`
569
+ );
570
+ return {
571
+ document: {
572
+ ...e,
573
+ root: r,
574
+ source: n.sources.join(""),
575
+ sheets: n.sheets,
576
+ styleRoots: n.styleRoots
577
+ },
578
+ warnings: n.warnings
579
+ };
580
+ }
581
+ const He = {
3
582
  // VisualElement is the base class and carries no class of its own.
4
583
  VisualElement: { hasText: !1, classes: [], parts: [] },
5
584
  Label: { hasText: !0, classes: ["unity-label"], parts: [] },
@@ -37,24 +616,26 @@ const xe = {
37
616
  { name: "unity-content-container", style: { "flex-shrink": "0" } }
38
617
  ]
39
618
  }
40
- }, ce = { hasText: !1, classes: [], parts: [] }, Le = "UXML", ze = /* @__PURE__ */ new Set(["Style"]);
41
- function _e(e) {
42
- return ze.has(e.name.local);
619
+ }, re = { hasText: !1, classes: [], parts: [] }, yt = "UXML", xt = /* @__PURE__ */ new Set(["Style"]);
620
+ function kt(e) {
621
+ return xt.has(e.name.local);
43
622
  }
44
- function F(e) {
45
- const n = xe[e.name.local];
46
- return n !== void 0 ? { spec: n, fallback: !1 } : je(e) ? { spec: ce, fallback: !1 } : { spec: ce, fallback: !0 };
623
+ function H(e) {
624
+ var t;
625
+ if (((t = e.derived) == null ? void 0 : t.kind) === "template-container") return { spec: re, fallback: !1 };
626
+ const n = He[e.name.local];
627
+ return n !== void 0 ? { spec: n, fallback: !1 } : St(e) ? { spec: re, fallback: !1 } : { spec: re, fallback: !0 };
47
628
  }
48
- function je(e) {
49
- return e.name.local === Le;
629
+ function St(e) {
630
+ return e.name.local === yt;
50
631
  }
51
- function We(e) {
52
- return F(e).spec.classes;
632
+ function $t(e) {
633
+ return H(e).spec.classes;
53
634
  }
54
- function Be() {
55
- return Object.keys(xe);
635
+ function Tt() {
636
+ return Object.keys(He);
56
637
  }
57
- const Y = "6000.0.40f1", ve = `:disabled {
638
+ const Z = "6000.0.40f1", Ve = `:disabled {
58
639
  opacity: 0.5;
59
640
  }
60
641
 
@@ -62,11 +643,11 @@ const Y = "6000.0.40f1", ve = `:disabled {
62
643
  margin: 1px 3px;
63
644
  -unity-text-align: middle-center;
64
645
  }
65
- `, Fe = 13;
66
- function Pe(e) {
67
- return e ? Fe : 0;
646
+ `, Ot = 13;
647
+ function Et(e) {
648
+ return e ? Ot : 0;
68
649
  }
69
- const Ve = /* @__PURE__ */ new Set([
650
+ const Nt = /* @__PURE__ */ new Set([
70
651
  "color",
71
652
  "font-size",
72
653
  "letter-spacing",
@@ -81,23 +662,23 @@ const Ve = /* @__PURE__ */ new Set([
81
662
  "-unity-text-outline-color",
82
663
  "-unity-text-outline-width"
83
664
  ]);
84
- function He(e) {
85
- return e.startsWith("--") || Ve.has(e);
665
+ function Dt(e) {
666
+ return e.startsWith("--") || Nt.has(e);
86
667
  }
87
- function ue(e) {
668
+ function $e(e) {
88
669
  const n = [];
89
- let t = 0, i = -1;
90
- for (let l = 0; l < e.length; l++) {
91
- const s = e[l];
92
- s === "(" ? t++ : s === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(s) ? i >= 0 && (n.push(e.slice(i, l)), i = -1) : i < 0 && (i = l);
670
+ let t = 0, s = -1;
671
+ for (let i = 0; i < e.length; i++) {
672
+ const r = e[i];
673
+ r === "(" ? t++ : r === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(r) ? s >= 0 && (n.push(e.slice(s, i)), s = -1) : s < 0 && (s = i);
93
674
  }
94
- return i >= 0 && n.push(e.slice(i)), n;
675
+ return s >= 0 && n.push(e.slice(s)), n;
95
676
  }
96
- function qe(e) {
97
- const [n, t, i, l] = e;
98
- return n === void 0 ? null : t === void 0 ? [n, n, n, n] : i === void 0 ? [n, t, n, t] : l === void 0 ? [n, t, i, t] : [n, t, i, l];
677
+ function At(e) {
678
+ const [n, t, s, i] = e;
679
+ return n === void 0 ? null : t === void 0 ? [n, n, n, n] : s === void 0 ? [n, t, n, t] : i === void 0 ? [n, t, s, t] : [n, t, s, i];
99
680
  }
100
- const Ge = {
681
+ const It = {
101
682
  margin: ["margin-top", "margin-right", "margin-bottom", "margin-left"],
102
683
  padding: ["padding-top", "padding-right", "padding-bottom", "padding-left"],
103
684
  "border-width": [
@@ -120,21 +701,21 @@ const Ge = {
120
701
  "border-bottom-left-radius"
121
702
  ]
122
703
  };
123
- function de(e) {
704
+ function Te(e) {
124
705
  return /^-?(\d+\.?\d*|\.\d+)$/.test(e);
125
706
  }
126
- function Ye(e) {
127
- const [n, t, i] = e;
128
- return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] : t === void 0 ? de(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : i === void 0 ? de(t) ? [["flex-grow", n], ["flex-shrink", t], ["flex-basis", "0"]] : [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", t]] : [["flex-grow", n], ["flex-shrink", t], ["flex-basis", i]];
707
+ function Rt(e) {
708
+ const [n, t, s] = e;
709
+ return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] : t === void 0 ? Te(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : s === void 0 ? Te(t) ? [["flex-grow", n], ["flex-shrink", t], ["flex-basis", "0"]] : [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", t]] : [["flex-grow", n], ["flex-shrink", t], ["flex-basis", s]];
129
710
  }
130
- function J(e, n) {
131
- if (e === "flex") return Ye(ue(n));
132
- const t = Ge[e];
711
+ function ie(e, n) {
712
+ if (e === "flex") return Rt($e(n));
713
+ const t = It[e];
133
714
  if (t === void 0) return [[e, n]];
134
- const i = qe(ue(n));
135
- return i === null ? [[e, n]] : t.map((l, s) => [l, i[s]]);
715
+ const s = At($e(n));
716
+ return s === null ? [[e, n]] : t.map((i, r) => [i, s[r]]);
136
717
  }
137
- const ee = {
718
+ const ae = {
138
719
  "align-content": "flex-start",
139
720
  "align-items": "stretch",
140
721
  "align-self": "auto",
@@ -170,8 +751,8 @@ const ee = {
170
751
  "padding-right": "0",
171
752
  "padding-top": "0",
172
753
  "font-size": "12px"
173
- }, Xe = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
174
- function X(e) {
754
+ }, Ct = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
755
+ function Q(e) {
175
756
  const n = e.trim();
176
757
  if (n === "") return { length: null, problem: "empty value" };
177
758
  if (n === "auto") return { length: { kind: "auto" } };
@@ -181,245 +762,241 @@ function X(e) {
181
762
  return { length: null, problem: "calc() is not supported in USS" };
182
763
  const t = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i.exec(n);
183
764
  if (t === null) return { length: null, problem: `cannot read "${n}" as a length` };
184
- const i = Number(t[1]), l = t[2].toLowerCase();
185
- return l === "" || l === "px" ? { length: { kind: "px", value: i } } : l === "%" ? { length: { kind: "percent", value: i } } : Xe.includes(l) ? { length: null, problem: `"${l}" is not a USS unit` } : { length: null, problem: `unknown unit "${l}"` };
765
+ const s = Number(t[1]), i = t[2].toLowerCase();
766
+ return i === "" || i === "px" ? { length: { kind: "px", value: s } } : i === "%" ? { length: { kind: "percent", value: s } } : Ct.includes(i) ? { length: null, problem: `"${i}" is not a USS unit` } : { length: null, problem: `unknown unit "${i}"` };
186
767
  }
187
- function fe(e) {
768
+ function Oe(e) {
188
769
  const n = e.trim();
189
770
  return /^-?(\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : null;
190
771
  }
191
- let se = null;
192
- async function Ut() {
193
- se ?? (se = await Me());
194
- }
195
- function Dt() {
196
- return se !== null;
197
- }
198
- let G = 0;
199
- function Lt() {
200
- return G;
201
- }
202
- const K = {
203
- auto: L.Auto,
204
- "flex-start": L.FlexStart,
205
- center: L.Center,
206
- "flex-end": L.FlexEnd,
207
- stretch: L.Stretch,
208
- baseline: L.Baseline,
209
- "space-between": L.SpaceBetween,
210
- "space-around": L.SpaceAround,
211
- "space-evenly": L.SpaceEvenly
212
- }, Ze = {
772
+ let me = null;
773
+ async function yn() {
774
+ me ?? (me = await tt());
775
+ }
776
+ function xn() {
777
+ return me !== null;
778
+ }
779
+ let K = 0;
780
+ function kn() {
781
+ return K;
782
+ }
783
+ const oe = {
784
+ auto: W.Auto,
213
785
  "flex-start": W.FlexStart,
214
786
  center: W.Center,
215
787
  "flex-end": W.FlexEnd,
788
+ stretch: W.Stretch,
789
+ baseline: W.Baseline,
216
790
  "space-between": W.SpaceBetween,
217
791
  "space-around": W.SpaceAround,
218
792
  "space-evenly": W.SpaceEvenly
219
- }, Je = {
220
- column: V.Column,
221
- "column-reverse": V.ColumnReverse,
222
- row: V.Row,
223
- "row-reverse": V.RowReverse
224
- }, Ke = {
225
- nowrap: q.NoWrap,
226
- wrap: q.Wrap,
227
- "wrap-reverse": q.WrapReverse
228
- }, Qe = [
229
- ["left", P.Left],
230
- ["top", P.Top],
231
- ["right", P.Right],
232
- ["bottom", P.Bottom]
793
+ }, Mt = {
794
+ "flex-start": P.FlexStart,
795
+ center: P.Center,
796
+ "flex-end": P.FlexEnd,
797
+ "space-between": P.SpaceBetween,
798
+ "space-around": P.SpaceAround,
799
+ "space-evenly": P.SpaceEvenly
800
+ }, Ut = {
801
+ column: G.Column,
802
+ "column-reverse": G.ColumnReverse,
803
+ row: G.Row,
804
+ "row-reverse": G.RowReverse
805
+ }, Lt = {
806
+ nowrap: Y.NoWrap,
807
+ wrap: Y.Wrap,
808
+ "wrap-reverse": Y.WrapReverse
809
+ }, Wt = [
810
+ ["left", q.Left],
811
+ ["top", q.Top],
812
+ ["right", q.Right],
813
+ ["bottom", q.Bottom]
233
814
  ];
234
- function et(e, n, t, i) {
235
- const l = se;
236
- if (l === null)
815
+ function zt(e, n, t, s) {
816
+ const i = me;
817
+ if (i === null)
237
818
  throw new Error("loadLayoutEngine() must be awaited before rendering");
238
- const s = [], m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), v = [], u = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
239
- let a = 0, d = !1, o = !1;
240
- const f = (p, k) => {
819
+ const r = [], u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), v = [], d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
820
+ let a = 0, f = !1, l = !1;
821
+ const h = (w, S) => {
241
822
  var T;
242
- return ((T = p.get(k)) == null ? void 0 : T.value) ?? ee[k] ?? "";
823
+ return ((T = w.get(S)) == null ? void 0 : T.value) ?? ae[S] ?? "";
243
824
  };
244
- function w(p, k) {
245
- s.push({ kind: "unsupported-property", message: p, node: k.id });
825
+ function g(w, S) {
826
+ r.push({ kind: "unsupported-property", message: w, node: S.id });
246
827
  }
247
- function c(p, k, T) {
248
- const N = f(p, k);
828
+ function p(w, S, T) {
829
+ const N = h(w, S);
249
830
  if (N === "") return null;
250
- const { length: C, problem: A } = X(N);
251
- return A !== void 0 && w(`${k}: ${A}`, T), C;
831
+ const { length: D, problem: A } = Q(N);
832
+ return A !== void 0 && g(`${S}: ${A}`, T), D;
252
833
  }
253
- function S(p) {
254
- if (p !== null)
255
- switch (p.kind) {
834
+ function b(w) {
835
+ if (w !== null)
836
+ switch (w.kind) {
256
837
  case "px":
257
- return p.value;
838
+ return w.value;
258
839
  case "percent":
259
- return `${p.value}%`;
840
+ return `${w.value}%`;
260
841
  case "auto":
261
842
  return "auto";
262
843
  case "none":
263
844
  return;
264
845
  }
265
846
  }
266
- function h(p) {
267
- if (p !== null) {
268
- if (p.kind === "px") return p.value;
269
- if (p.kind === "percent") return `${p.value}%`;
847
+ function m(w) {
848
+ if (w !== null) {
849
+ if (w.kind === "px") return w.value;
850
+ if (w.kind === "percent") return `${w.value}%`;
270
851
  }
271
852
  }
272
- function x(p, k, T) {
273
- p.setBoxSizing(Re.BorderBox), p.setFlexDirection(Je[f(k, "flex-direction")] ?? V.Column), p.setFlexWrap(Ke[f(k, "flex-wrap")] ?? q.NoWrap), p.setJustifyContent(Ze[f(k, "justify-content")] ?? W.FlexStart), p.setAlignItems(K[f(k, "align-items")] ?? L.Stretch), p.setAlignSelf(K[f(k, "align-self")] ?? L.Auto), p.setAlignContent(K[f(k, "align-content")] ?? L.FlexStart), p.setFlexGrow(fe(f(k, "flex-grow")) ?? 0), p.setFlexShrink(fe(f(k, "flex-shrink")) ?? 1), p.setFlexBasis(S(c(k, "flex-basis", T)));
274
- const N = f(k, "position");
275
- (N === "fixed" || N === "sticky") && w(`position: ${N} is not supported in USS; treated as relative`, T), p.setPositionType(
276
- N === "absolute" ? Z.Absolute : Z.Relative
277
- ), f(k, "display") === "none" && p.setDisplay(Ue.None);
278
- const C = f(k, "overflow");
279
- C === "hidden" ? p.setOverflow(De.Hidden) : (C === "auto" || C === "scroll") && w(`overflow: ${C} needs a ScrollView element in USS`, T), p.setWidth(S(c(k, "width", T))), p.setHeight(S(c(k, "height", T))), p.setMinWidth(h(c(k, "min-width", T))), p.setMinHeight(h(c(k, "min-height", T))), p.setMaxWidth(h(c(k, "max-width", T))), p.setMaxHeight(h(c(k, "max-height", T)));
280
- for (const [A, I] of Qe) {
281
- p.setMargin(I, h(c(k, `margin-${A}`, T))), p.setPadding(I, h(c(k, `padding-${A}`, T)));
282
- const _ = h(c(k, `border-${A}-width`, T));
283
- p.setBorder(I, typeof _ == "number" ? _ : void 0), p.setPosition(I, h(c(k, A, T)));
853
+ function y(w, S, T) {
854
+ w.setBoxSizing(nt.BorderBox), w.setFlexDirection(Ut[h(S, "flex-direction")] ?? G.Column), w.setFlexWrap(Lt[h(S, "flex-wrap")] ?? Y.NoWrap), w.setJustifyContent(Mt[h(S, "justify-content")] ?? P.FlexStart), w.setAlignItems(oe[h(S, "align-items")] ?? W.Stretch), w.setAlignSelf(oe[h(S, "align-self")] ?? W.Auto), w.setAlignContent(oe[h(S, "align-content")] ?? W.FlexStart), w.setFlexGrow(Oe(h(S, "flex-grow")) ?? 0), w.setFlexShrink(Oe(h(S, "flex-shrink")) ?? 1), w.setFlexBasis(b(p(S, "flex-basis", T)));
855
+ const N = h(S, "position");
856
+ (N === "fixed" || N === "sticky") && g(`position: ${N} is not supported in USS; treated as relative`, T), w.setPositionType(
857
+ N === "absolute" ? ne.Absolute : ne.Relative
858
+ ), h(S, "display") === "none" && w.setDisplay(st.None);
859
+ const D = h(S, "overflow");
860
+ D === "hidden" ? w.setOverflow(rt.Hidden) : (D === "auto" || D === "scroll") && g(`overflow: ${D} needs a ScrollView element in USS`, T), w.setWidth(b(p(S, "width", T))), w.setHeight(b(p(S, "height", T))), w.setMinWidth(m(p(S, "min-width", T))), w.setMinHeight(m(p(S, "min-height", T))), w.setMaxWidth(m(p(S, "max-width", T))), w.setMaxHeight(m(p(S, "max-height", T)));
861
+ for (const [A, I] of Wt) {
862
+ w.setMargin(I, m(p(S, `margin-${A}`, T))), w.setPadding(I, m(p(S, `padding-${A}`, T)));
863
+ const _ = m(p(S, `border-${A}-width`, T));
864
+ w.setBorder(I, typeof _ == "number" ? _ : void 0), w.setPosition(I, m(p(S, A, T)));
284
865
  }
285
866
  }
286
- function y(p) {
287
- var k;
288
- return (k = p.attributes.find((T) => T.name === "text")) == null ? void 0 : k.value;
867
+ function k(w) {
868
+ var S;
869
+ return (S = w.attributes.find((T) => T.name === "text")) == null ? void 0 : S.value;
289
870
  }
290
- const b = ["text", "label"];
291
- function $(p) {
292
- return b.filter(
293
- (k) => p.attributes.some((T) => T.name === k && T.value.length > 0)
871
+ const x = ["text", "label"];
872
+ function $(w) {
873
+ return x.filter(
874
+ (S) => w.attributes.some((T) => T.name === S && T.value.length > 0)
294
875
  );
295
876
  }
296
- function O(p, k) {
297
- if (_e(p)) return;
298
- const T = n.get(p.id) ?? /* @__PURE__ */ new Map(), N = l.Node.create();
299
- a++, G++, u.set(p, N), v.push(p), x(N, T, p), k !== null && k.insertChild(N, k.getChildCount());
300
- const { spec: C, fallback: A } = F(p), I = y(p), _ = C.hasText && I !== void 0 && I.length > 0;
877
+ function O(w, S) {
878
+ if (kt(w)) return;
879
+ const T = n.get(w.id) ?? /* @__PURE__ */ new Map(), N = i.Node.create();
880
+ a++, K++, d.set(w, N), v.push(w), y(N, T, w), S !== null && S.insertChild(N, S.getChildCount());
881
+ const { spec: D, fallback: A } = H(w), I = k(w), _ = D.hasText && I !== void 0 && I.length > 0;
301
882
  if (A) {
302
- const M = $(p);
303
- s.push({
883
+ const R = $(w);
884
+ r.push({
304
885
  kind: "unsupported-control",
305
- message: `<${p.name.local}> has no renderer in this version and is drawn as a plain VisualElement` + (M.length === 0 ? "" : `; its ${M.join(" and ")} attribute${M.length > 1 ? "s are" : " is"} not drawn, because Unity draws that through a child element`),
306
- node: p.id
886
+ message: `<${w.name.local}> has no renderer in this version and is drawn as a plain VisualElement` + (R.length === 0 ? "" : `; its ${R.join(" and ")} attribute${R.length > 1 ? "s are" : " is"} not drawn, because Unity draws that through a child element`),
887
+ node: w.id
307
888
  });
308
889
  }
309
890
  if (_) {
310
- p.children.length > 0 && w(
311
- `<${p.name.local}> has both a text attribute and children; children are not drawn`,
312
- p
891
+ w.children.length > 0 && g(
892
+ `<${w.name.local}> has both a text attribute and children; children are not drawn`,
893
+ w
313
894
  );
314
- const M = c(T, "font-size", p), z = {
315
- fontSize: M !== null && M.kind === "px" ? M.value : 12,
316
- fontStyle: f(T, "-unity-font-style") || "normal",
317
- whiteSpace: f(T, "white-space") || "normal"
895
+ const R = p(T, "font-size", w), z = {
896
+ fontSize: R !== null && R.kind === "px" ? R.value : 12,
897
+ fontStyle: h(T, "-unity-font-style") || "normal",
898
+ whiteSpace: h(T, "white-space") || "normal"
318
899
  };
319
900
  N.setMeasureFunc(
320
- (U) => i.measureText(
901
+ (M) => s.measureText(
321
902
  I,
322
903
  z,
323
- Number.isFinite(U) ? U : 0
904
+ Number.isFinite(M) ? M : 0
324
905
  )
325
906
  );
326
907
  return;
327
908
  }
328
- let j = N;
329
- if (C.parts.length > 0) {
330
- o || (o = !0, s.push({
909
+ let F = N;
910
+ if (D.parts.length > 0) {
911
+ l || (l = !0, r.push({
331
912
  kind: "version-dependent",
332
- message: `<${p.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Y}. Other versions may differ; see src/controls/theme.ts.`,
333
- node: p.id
913
+ message: `<${w.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Z}. Other versions may differ; see src/controls/theme.ts.`,
914
+ node: w.id
334
915
  }));
335
- const M = [], z = [], U = t.get(p.id);
336
- for (const oe of C.parts) {
337
- const ae = (U == null ? void 0 : U.get(oe.name)) ?? /* @__PURE__ */ new Map(), H = l.Node.create();
338
- a++, G++, x(H, ae, p), j.insertChild(H, j.getChildCount()), j = H, z.push(H), M.push({
339
- name: oe.name,
340
- owner: p.id,
916
+ const R = [], z = [], M = t.get(w.id);
917
+ for (const we of D.parts) {
918
+ const ve = (M == null ? void 0 : M.get(we.name)) ?? /* @__PURE__ */ new Map(), X = i.Node.create();
919
+ a++, K++, y(X, ve, w), F.insertChild(X, F.getChildCount()), F = X, z.push(X), R.push({
920
+ name: we.name,
921
+ owner: w.id,
341
922
  box: { left: 0, top: 0, width: 0, height: 0 },
342
- style: ae
923
+ style: ve
343
924
  });
344
925
  }
345
- g.set(p.id, M), r.set(p.id, z);
926
+ c.set(w.id, R), o.set(w.id, z);
346
927
  }
347
- for (const M of p.children) O(M, j);
928
+ for (const R of w.children) O(R, F);
348
929
  }
349
930
  O(e, null);
350
- const E = u.get(e);
351
- E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(Z.Relative), E.calculateLayout(i.size.width, i.size.height, le.LTR);
352
- const R = /* @__PURE__ */ new Map();
353
- for (let p = 0; p < 3; p++) {
354
- let k = !1;
355
- for (const [T, N] of g) {
356
- const C = r.get(T);
357
- if (C === void 0) continue;
358
- const A = N.findIndex((U) => U.name === "unity-content-viewport"), I = N.findIndex((U) => U.name === "unity-content-container");
931
+ const E = d.get(e);
932
+ E.setWidth(s.size.width), E.setHeight(s.size.height), E.setPositionType(ne.Relative), E.calculateLayout(s.size.width, s.size.height, be.LTR);
933
+ const C = /* @__PURE__ */ new Map();
934
+ for (let w = 0; w < 3; w++) {
935
+ let S = !1;
936
+ for (const [T, N] of c) {
937
+ const D = o.get(T);
938
+ if (D === void 0) continue;
939
+ const A = N.findIndex((M) => M.name === "unity-content-viewport"), I = N.findIndex((M) => M.name === "unity-content-container");
359
940
  if (A === -1 || I === -1) continue;
360
- const _ = C[A].getComputedLayout(), M = C[I].getComputedLayout().height > _.height + 0.01, z = Pe(M);
361
- (R.get(T) ?? 0) !== z && (R.set(T, z), C[A].setMargin(P.Right, z), k = !0);
941
+ const _ = D[A].getComputedLayout(), R = D[I].getComputedLayout().height > _.height + 0.01, z = Et(R);
942
+ (C.get(T) ?? 0) !== z && (C.set(T, z), D[A].setMargin(q.Right, z), S = !0);
362
943
  }
363
- if (!k) break;
364
- E.calculateLayout(i.size.width, i.size.height, le.LTR);
944
+ if (!S) break;
945
+ E.calculateLayout(s.size.width, s.size.height, be.LTR);
365
946
  }
366
- function D(p, k, T) {
367
- const N = u.get(p);
947
+ function L(w, S, T) {
948
+ const N = d.get(w);
368
949
  if (N === void 0) return;
369
- const C = N.getComputedLayout();
370
- let A = k + C.left, I = T + C.top;
371
- m.set(p.id, { left: A, top: I, width: C.width, height: C.height });
372
- const _ = g.get(p.id), j = r.get(p.id);
373
- _ !== void 0 && j !== void 0 && _.forEach((M, z) => {
374
- const U = j[z].getComputedLayout();
375
- A += U.left, I += U.top, M.box = { left: A, top: I, width: U.width, height: U.height };
950
+ const D = N.getComputedLayout();
951
+ let A = S + D.left, I = T + D.top;
952
+ u.set(w.id, { left: A, top: I, width: D.width, height: D.height });
953
+ const _ = c.get(w.id), F = o.get(w.id);
954
+ _ !== void 0 && F !== void 0 && _.forEach((R, z) => {
955
+ const M = F[z].getComputedLayout();
956
+ A += M.left, I += M.top, R.box = { left: A, top: I, width: M.width, height: M.height };
376
957
  });
377
- for (const M of p.children) D(M, A, I);
958
+ for (const R of w.children) L(R, A, I);
378
959
  }
379
- return D(e, 0, 0), {
380
- boxes: m,
381
- parts: g,
960
+ return L(e, 0, 0), {
961
+ boxes: u,
962
+ parts: c,
382
963
  painted: v,
383
- warnings: s,
964
+ warnings: r,
384
965
  dispose() {
385
- d || (d = !0, E.freeRecursive(), G -= a, u.clear(), r.clear());
966
+ f || (f = !0, E.freeRecursive(), K -= a, d.clear(), o.clear());
386
967
  }
387
968
  };
388
969
  }
389
- const tt = 1.2;
390
- function nt(e) {
970
+ const _t = 1.2;
971
+ function jt(e) {
391
972
  var t;
392
973
  let n = null;
393
974
  if (e !== void 0) {
394
- const i = e.createElement("canvas");
395
- n = ((t = i.getContext) == null ? void 0 : t.call(i, "2d")) ?? null;
975
+ const s = e.createElement("canvas");
976
+ n = ((t = s.getContext) == null ? void 0 : t.call(s, "2d")) ?? null;
396
977
  }
397
- return (i, l, s) => {
398
- const m = l.fontSize * tt, g = (o) => {
978
+ return (s, i, r) => {
979
+ const u = i.fontSize * _t, c = (l) => {
399
980
  if (n === null)
400
- return o.length * l.fontSize * 0.5;
401
- const f = l.fontStyle.includes("bold") ? "bold" : "normal", w = l.fontStyle.includes("italic") ? "italic" : "normal";
402
- return n.font = `${w} ${f} ${l.fontSize}px sans-serif`, n.measureText(o).width;
981
+ return l.length * i.fontSize * 0.5;
982
+ const h = i.fontStyle.includes("bold") ? "bold" : "normal", g = i.fontStyle.includes("italic") ? "italic" : "normal";
983
+ return n.font = `${g} ${h} ${i.fontSize}px sans-serif`, n.measureText(l).width;
403
984
  };
404
- if (!(l.whiteSpace !== "nowrap" && l.whiteSpace !== "pre") || s <= 0) {
405
- const o = i.split(`
985
+ if (!(i.whiteSpace !== "nowrap" && i.whiteSpace !== "pre") || r <= 0) {
986
+ const l = s.split(`
406
987
  `);
407
- return { width: o.reduce((w, c) => Math.max(w, g(c)), 0), height: o.length * m };
988
+ return { width: l.reduce((g, p) => Math.max(g, c(p)), 0), height: l.length * u };
408
989
  }
409
- const u = i.split(/\s+/).filter((o) => o.length > 0);
410
- let r = 1, a = 0, d = 0;
411
- for (const o of u) {
412
- const f = g(o), w = a === 0 ? 0 : g(" ");
413
- a > 0 && a + w + f > s ? (d = Math.max(d, a), r++, a = f) : a += w + f;
990
+ const d = s.split(/\s+/).filter((l) => l.length > 0);
991
+ let o = 1, a = 0, f = 0;
992
+ for (const l of d) {
993
+ const h = c(l), g = a === 0 ? 0 : c(" ");
994
+ a > 0 && a + g + h > r ? (f = Math.max(f, a), o++, a = h) : a += g + h;
414
995
  }
415
- return d = Math.max(d, a), { width: d, height: r * m };
996
+ return f = Math.max(f, a), { width: f, height: o * u };
416
997
  };
417
998
  }
418
- function ye(e) {
419
- const n = (t, i) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? i : String.fromCodePoint(t);
420
- return e.replace(/&#x([0-9a-f]+);/gi, (t, i) => n(parseInt(i, 16), t)).replace(/&#(\d+);/g, (t, i) => n(Number(i), t)).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
421
- }
422
- const it = /* @__PURE__ */ new Set([
999
+ const Ft = /* @__PURE__ */ new Set([
423
1000
  "box-shadow",
424
1001
  "filter",
425
1002
  "backdrop-filter",
@@ -435,7 +1012,7 @@ const it = /* @__PURE__ */ new Set([
435
1012
  "float",
436
1013
  "clear",
437
1014
  "border-style"
438
- ]), st = /* @__PURE__ */ new Set([
1015
+ ]), Pt = /* @__PURE__ */ new Set([
439
1016
  "gap",
440
1017
  "row-gap",
441
1018
  "column-gap",
@@ -445,43 +1022,43 @@ const it = /* @__PURE__ */ new Set([
445
1022
  "background-repeat",
446
1023
  "overflow-wrap",
447
1024
  "word-break"
448
- ]), pe = ["top", "right", "bottom", "left"], rt = {
1025
+ ]), Ee = ["top", "right", "bottom", "left"], Bt = {
449
1026
  normal: { weight: "normal", style: "normal" },
450
1027
  bold: { weight: "bold", style: "normal" },
451
1028
  italic: { weight: "normal", style: "italic" },
452
1029
  "bold-and-italic": { weight: "bold", style: "italic" }
453
- }, ot = {
1030
+ }, Ht = {
454
1031
  upper: "flex-start",
455
1032
  middle: "center",
456
1033
  lower: "flex-end"
457
- }, at = {
1034
+ }, Vt = {
458
1035
  left: "flex-start",
459
1036
  center: "center",
460
1037
  right: "flex-end"
461
- }, Q = {
1038
+ }, le = {
462
1039
  "stretch-to-fill": "100% 100%",
463
1040
  "scale-and-crop": "cover",
464
1041
  "scale-to-fit": "contain"
465
- }, he = "stretch-to-fill";
466
- function lt(e) {
467
- const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(e.trim());
1042
+ }, Ne = "stretch-to-fill";
1043
+ function qt(e) {
1044
+ const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(J(e).trim());
468
1045
  return n === null ? null : { form: n[1], path: n[3] };
469
1046
  }
470
- function me(e, n, t = {}) {
471
- var w;
472
- const i = {}, l = [], s = (c) => {
473
- var S;
474
- return (S = e.get(c)) == null ? void 0 : S.value;
475
- }, m = (c, S) => {
476
- l.push({ kind: c, message: S, node: n });
1047
+ function De(e, n, t = {}) {
1048
+ var g;
1049
+ const s = {}, i = [], r = (p) => {
1050
+ var b;
1051
+ return (b = e.get(p)) == null ? void 0 : b.value;
1052
+ }, u = (p, b) => {
1053
+ i.push({ kind: p, message: b, node: n });
477
1054
  };
478
- i["box-sizing"] = "border-box";
479
- for (const [c] of e)
480
- it.has(c) ? m("unsupported-property", `${c} does not exist in USS and is ignored`) : st.has(c) && m(
1055
+ s["box-sizing"] = "border-box";
1056
+ for (const [p] of e)
1057
+ Ft.has(p) ? u("unsupported-property", `${p} does not exist in USS and is ignored`) : Pt.has(p) && u(
481
1058
  "version-dependent",
482
- `${c} depends on the Unity version; verify it in your project`
1059
+ `${p} depends on the Unity version; verify it in your project`
483
1060
  );
484
- const g = [
1061
+ const c = [
485
1062
  "background-color",
486
1063
  "color",
487
1064
  "opacity",
@@ -494,388 +1071,388 @@ function me(e, n, t = {}) {
494
1071
  "font-size",
495
1072
  "transform-origin"
496
1073
  ];
497
- for (const c of g) {
498
- const S = s(c);
499
- S !== void 0 && (i[c] = S);
500
- }
501
- s("display") === "none" && (i.display = "none"), s("overflow") === "hidden" && (i.overflow = "hidden");
502
- for (const c of pe) {
503
- const S = s(`border-${c}-width`);
504
- if (S !== void 0 && S !== "0") {
505
- const { length: y, problem: b } = X(S);
506
- y === null || y.kind !== "px" ? m(
1074
+ for (const p of c) {
1075
+ const b = r(p);
1076
+ b !== void 0 && (s[p] = b);
1077
+ }
1078
+ r("display") === "none" && (s.display = "none"), r("overflow") === "hidden" && (s.overflow = "hidden");
1079
+ for (const p of Ee) {
1080
+ const b = r(`border-${p}-width`);
1081
+ if (b !== void 0 && b !== "0") {
1082
+ const { length: k, problem: x } = Q(b);
1083
+ k === null || k.kind !== "px" ? u(
507
1084
  "unsupported-property",
508
- `border-${c}-width: ${b ?? `"${S}" is not a pixel length`}; ignored`
509
- ) : (i[`border-${c}-width`] = `${y.value}px`, i[`border-${c}-style`] = "solid");
1085
+ `border-${p}-width: ${x ?? `"${b}" is not a pixel length`}; ignored`
1086
+ ) : (s[`border-${p}-width`] = `${k.value}px`, s[`border-${p}-style`] = "solid");
510
1087
  }
511
- const h = s(`border-${c}-color`);
512
- h !== void 0 && (i[`border-${c}-color`] = h);
513
- const x = s(`padding-${c}`);
514
- x !== void 0 && x !== "0" && (i[`padding-${c}`] = x);
1088
+ const m = r(`border-${p}-color`);
1089
+ m !== void 0 && (s[`border-${p}-color`] = m);
1090
+ const y = r(`padding-${p}`);
1091
+ y !== void 0 && y !== "0" && (s[`padding-${p}`] = y);
515
1092
  }
516
- for (const c of [
1093
+ for (const p of [
517
1094
  "top-left",
518
1095
  "top-right",
519
1096
  "bottom-right",
520
1097
  "bottom-left"
521
1098
  ]) {
522
- const S = s(`border-${c}-radius`);
523
- S !== void 0 && (i[`border-${c}-radius`] = S);
1099
+ const b = r(`border-${p}-radius`);
1100
+ b !== void 0 && (s[`border-${p}-radius`] = b);
524
1101
  }
525
- const v = s("-unity-font-style");
1102
+ const v = r("-unity-font-style");
526
1103
  if (v !== void 0) {
527
- const c = rt[v];
528
- c === void 0 ? m("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (i["font-weight"] = c.weight, i["font-style"] = c.style);
529
- }
530
- const u = s("-unity-text-align");
531
- if (u !== void 0) {
532
- const [c, S] = u.split("-"), h = ot[c ?? ""], x = at[S ?? ""];
533
- h === void 0 || x === void 0 ? m("unsupported-property", `-unity-text-align: ${u} is not a USS value`) : (i["align-items"] = h, i["justify-content"] = x);
534
- }
535
- const r = [], a = s("translate");
536
- a !== void 0 && r.push(`translate(${a.replace(/\s+/, ", ")})`);
537
- const d = s("rotate");
538
- d !== void 0 && r.push(`rotate(${d})`);
539
- const o = s("scale");
540
- o !== void 0 && r.push(`scale(${o.replace(/\s+/, ", ")})`), r.length > 0 && (i.transform = r.join(" "));
541
- const f = s("background-image");
542
- if (f !== void 0 && f !== "none") {
543
- const c = lt(f);
544
- if (c === null)
545
- m("asset-unresolved", `background-image: cannot read "${f}" as an asset path`);
1104
+ const p = Bt[v];
1105
+ p === void 0 ? u("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (s["font-weight"] = p.weight, s["font-style"] = p.style);
1106
+ }
1107
+ const d = r("-unity-text-align");
1108
+ if (d !== void 0) {
1109
+ const [p, b] = d.split("-"), m = Ht[p ?? ""], y = Vt[b ?? ""];
1110
+ m === void 0 || y === void 0 ? u("unsupported-property", `-unity-text-align: ${d} is not a USS value`) : (s["align-items"] = m, s["justify-content"] = y);
1111
+ }
1112
+ const o = [], a = r("translate");
1113
+ a !== void 0 && o.push(`translate(${a.replace(/\s+/, ", ")})`);
1114
+ const f = r("rotate");
1115
+ f !== void 0 && o.push(`rotate(${f})`);
1116
+ const l = r("scale");
1117
+ l !== void 0 && o.push(`scale(${l.replace(/\s+/, ", ")})`), o.length > 0 && (s.transform = o.join(" "));
1118
+ const h = r("background-image");
1119
+ if (h !== void 0 && h !== "none") {
1120
+ const p = qt(h);
1121
+ if (p === null)
1122
+ u("asset-unresolved", `background-image: cannot read "${h}" as an asset path`);
546
1123
  else {
547
- const { form: S, path: h } = c, x = ((w = t.resolveAsset) == null ? void 0 : w.call(t, h, S)) ?? null;
548
- if (x === null)
549
- i["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", m("asset-unresolved", `background-image: "${h}" was not resolved`);
1124
+ const { form: b, path: m } = p, y = ((g = t.resolveAsset) == null ? void 0 : g.call(t, m, b)) ?? null;
1125
+ if (y === null)
1126
+ s["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", u("asset-unresolved", `background-image: "${m}" was not resolved`);
550
1127
  else {
551
- i["background-image"] = `url("${x}")`, i["background-repeat"] = s("background-repeat") ?? "no-repeat", i["background-position"] = s("background-position") ?? "center";
552
- const y = s("background-size"), b = s("-unity-background-scale-mode") ?? he, $ = Q[b];
553
- $ === void 0 && m(
1128
+ s["background-image"] = `url("${y}")`, s["background-repeat"] = r("background-repeat") ?? "no-repeat", s["background-position"] = r("background-position") ?? "center";
1129
+ const k = r("background-size"), x = r("-unity-background-scale-mode") ?? Ne, $ = le[x];
1130
+ $ === void 0 && u(
554
1131
  "unsupported-property",
555
- `-unity-background-scale-mode: ${b} is not a USS value; expected one of ${Object.keys(Q).join(", ")}`
556
- ), i["background-size"] = y ?? $ ?? Q[he];
1132
+ `-unity-background-scale-mode: ${x} is not a USS value; expected one of ${Object.keys(le).join(", ")}`
1133
+ ), s["background-size"] = k ?? $ ?? le[Ne];
557
1134
  }
558
1135
  }
559
1136
  }
560
- return s("-unity-background-image-tint-color") !== void 0 && m(
1137
+ return r("-unity-background-image-tint-color") !== void 0 && u(
561
1138
  "unsupported-property",
562
1139
  "-unity-background-image-tint-color has no CSS equivalent and is not drawn"
563
- ), pe.some((c) => s(`-unity-slice-${c}`) !== void 0) && m("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), s("-unity-font-definition") !== void 0 && m(
1140
+ ), Ee.some((p) => r(`-unity-slice-${p}`) !== void 0) && u("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), r("-unity-font-definition") !== void 0 && u(
564
1141
  "unsupported-property",
565
1142
  "-unity-font-definition names a Unity font asset; the browser default is used"
566
- ), { declarations: i, warnings: l };
1143
+ ), { declarations: s, warnings: i };
567
1144
  }
568
- const ct = "data-uxml-node", ut = "data-uxml-part", dt = "data-uxml-part-owner";
569
- function ft(e, n, t, i, l, s) {
570
- const m = [], g = /* @__PURE__ */ new Map();
571
- function v(d) {
572
- const o = i.get(d.id), f = (w) => {
573
- var h;
574
- const c = ((h = o == null ? void 0 : o.get(w)) == null ? void 0 : h.value) ?? ee[w] ?? "0", { length: S } = X(c);
575
- return S !== null && S.kind === "px" ? S.value : 0;
1145
+ const Gt = "data-uxml-node", Jt = "data-uxml-part", Xt = "data-uxml-part-owner";
1146
+ function Yt(e, n, t, s, i, r) {
1147
+ const u = [], c = /* @__PURE__ */ new Map();
1148
+ function v(f) {
1149
+ const l = s.get(f.id), h = (g) => {
1150
+ var m;
1151
+ const p = ((m = l == null ? void 0 : l.get(g)) == null ? void 0 : m.value) ?? ae[g] ?? "0", { length: b } = Q(p);
1152
+ return b !== null && b.kind === "px" ? b.value : 0;
576
1153
  };
577
- return { left: f("border-left-width"), top: f("border-top-width") };
1154
+ return { left: h("border-left-width"), top: h("border-top-width") };
578
1155
  }
579
- function u(d) {
580
- const o = (f) => {
581
- var S;
582
- const w = ((S = d.style.get(f)) == null ? void 0 : S.value) ?? ee[f] ?? "0", { length: c } = X(w);
583
- return c !== null && c.kind === "px" ? c.value : 0;
1156
+ function d(f) {
1157
+ const l = (h) => {
1158
+ var b;
1159
+ const g = ((b = f.style.get(h)) == null ? void 0 : b.value) ?? ae[h] ?? "0", { length: p } = Q(g);
1160
+ return p !== null && p.kind === "px" ? p.value : 0;
584
1161
  };
585
- return { left: o("border-left-width"), top: o("border-top-width") };
1162
+ return { left: l("border-left-width"), top: l("border-top-width") };
586
1163
  }
587
- function r(d, o, f) {
1164
+ function o(f, l, h) {
588
1165
  var E;
589
- const w = n.get(d.id);
590
- if (w === void 0) return null;
591
- const c = s.document.createElement("div");
592
- c.setAttribute(ct, String(d.id));
593
- const S = i.get(d.id) ?? /* @__PURE__ */ new Map(), h = me(S, d.id, s);
594
- m.push(...h.warnings);
595
- const x = o === null ? 0 : w.left - o.left - f.left, y = o === null ? 0 : w.top - o.top - f.top, b = {
1166
+ const g = n.get(f.id);
1167
+ if (g === void 0) return null;
1168
+ const p = r.document.createElement("div");
1169
+ p.setAttribute(Gt, String(f.id));
1170
+ const b = s.get(f.id) ?? /* @__PURE__ */ new Map(), m = De(b, f.id, r);
1171
+ u.push(...m.warnings);
1172
+ const y = l === null ? 0 : g.left - l.left - h.left, k = l === null ? 0 : g.top - l.top - h.top, x = {
596
1173
  position: "absolute",
597
- left: `${x}px`,
598
- top: `${y}px`,
599
- width: `${w.width}px`,
600
- height: `${w.height}px`,
1174
+ left: `${y}px`,
1175
+ top: `${k}px`,
1176
+ width: `${g.width}px`,
1177
+ height: `${g.height}px`,
601
1178
  margin: "0",
602
- ...h.declarations
1179
+ ...m.declarations
603
1180
  };
604
- for (const [R, D] of Object.entries(b))
605
- c.style.setProperty(R, D);
606
- const { spec: $ } = F(d), O = (E = d.attributes.find((R) => R.name === "text")) == null ? void 0 : E.value;
1181
+ for (const [C, L] of Object.entries(x))
1182
+ p.style.setProperty(C, L);
1183
+ const { spec: $ } = H(f), O = (E = f.attributes.find((C) => C.name === "text")) == null ? void 0 : E.value;
607
1184
  if ($.hasText && O !== void 0 && O.length > 0)
608
- c.style.setProperty("display", h.declarations.display ?? "flex"), h.declarations["align-items"] === void 0 && c.style.setProperty("align-items", "flex-start"), h.declarations["justify-content"] === void 0 && c.style.setProperty("justify-content", "flex-start"), c.textContent = ye(O);
1185
+ p.style.setProperty("display", m.declarations.display ?? "flex"), m.declarations["align-items"] === void 0 && p.style.setProperty("align-items", "flex-start"), m.declarations["justify-content"] === void 0 && p.style.setProperty("justify-content", "flex-start"), p.textContent = J(O);
609
1186
  else {
610
- let R = c, D = w, p = v(d);
611
- for (const k of t.get(d.id) ?? []) {
612
- const T = s.document.createElement("div");
613
- T.setAttribute(ut, k.name), T.setAttribute(dt, String(d.id));
614
- const N = me(k.style, d.id, s);
615
- m.push(...N.warnings);
616
- const C = {
1187
+ let C = p, L = g, w = v(f);
1188
+ for (const S of t.get(f.id) ?? []) {
1189
+ const T = r.document.createElement("div");
1190
+ T.setAttribute(Jt, S.name), T.setAttribute(Xt, String(f.id));
1191
+ const N = De(S.style, f.id, r);
1192
+ u.push(...N.warnings);
1193
+ const D = {
617
1194
  position: "absolute",
618
- left: `${k.box.left - D.left - p.left}px`,
619
- top: `${k.box.top - D.top - p.top}px`,
620
- width: `${k.box.width}px`,
621
- height: `${k.box.height}px`,
1195
+ left: `${S.box.left - L.left - w.left}px`,
1196
+ top: `${S.box.top - L.top - w.top}px`,
1197
+ width: `${S.box.width}px`,
1198
+ height: `${S.box.height}px`,
622
1199
  margin: "0",
623
1200
  ...N.declarations
624
1201
  };
625
- for (const [A, I] of Object.entries(C))
1202
+ for (const [A, I] of Object.entries(D))
626
1203
  T.style.setProperty(A, I);
627
- R.appendChild(T), R = T, D = k.box, p = u(k);
1204
+ C.appendChild(T), C = T, L = S.box, w = d(S);
628
1205
  }
629
- for (const k of d.children) {
630
- const T = r(k, D, p);
631
- T !== null && R.appendChild(T);
1206
+ for (const S of f.children) {
1207
+ const T = o(S, L, w);
1208
+ T !== null && C.appendChild(T);
632
1209
  }
633
1210
  }
634
- return g.set(d.id, c), c;
1211
+ return c.set(f.id, p), p;
635
1212
  }
636
- l.replaceChildren();
637
- const a = r(e, null, { left: 0, top: 0 });
638
- return a !== null && (a.style.setProperty("position", "relative"), l.appendChild(a)), { warnings: m, elements: g };
1213
+ i.replaceChildren();
1214
+ const a = o(e, null, { left: 0, top: 0 });
1215
+ return a !== null && (a.style.setProperty("position", "relative"), i.appendChild(a)), { warnings: u, elements: c };
639
1216
  }
640
- const ge = /[A-Za-z0-9_-]/;
1217
+ const Ae = /[A-Za-z0-9_-]/;
641
1218
  function B(e) {
642
1219
  return e === " " || e === " " || e === `
643
1220
  ` || e === "\r" || e === "\f";
644
1221
  }
645
- function te(e, n, t) {
646
- let i = n, l = 0;
647
- for (; i < e.length; ) {
648
- const s = e[i];
649
- if (s === '"' || s === "'") {
650
- const m = e.indexOf(s, i + 1);
651
- i = m < 0 ? e.length : m + 1;
1222
+ function ce(e, n, t) {
1223
+ let s = n, i = 0;
1224
+ for (; s < e.length; ) {
1225
+ const r = e[s];
1226
+ if (r === '"' || r === "'") {
1227
+ const u = e.indexOf(r, s + 1);
1228
+ s = u < 0 ? e.length : u + 1;
652
1229
  continue;
653
1230
  }
654
- if (s === "/" && e[i + 1] === "*") {
655
- const m = e.indexOf("*/", i + 2);
656
- i = m < 0 ? e.length : m + 2;
1231
+ if (r === "/" && e[s + 1] === "*") {
1232
+ const u = e.indexOf("*/", s + 2);
1233
+ s = u < 0 ? e.length : u + 2;
657
1234
  continue;
658
1235
  }
659
- if (s === "(" || s === "[")
660
- l++;
661
- else if (s === ")" || s === "]")
662
- l > 0 && l--;
663
- else if (l === 0 && t.includes(s))
664
- return i;
665
- i++;
1236
+ if (r === "(" || r === "[")
1237
+ i++;
1238
+ else if (r === ")" || r === "]")
1239
+ i > 0 && i--;
1240
+ else if (i === 0 && t.includes(r))
1241
+ return s;
1242
+ s++;
666
1243
  }
667
1244
  return e.length;
668
1245
  }
669
- function ke(e, n, t) {
670
- let i = n, l = t;
671
- for (; i < l && B(e[i]); ) i++;
672
- for (; l > i && B(e[l - 1]); ) l--;
673
- return { start: i, end: l };
674
- }
675
- function Se(e, n, t, i) {
676
- const l = [];
677
- let s = n;
678
- for (; s < t; ) {
679
- for (; s < t && (B(e[s]) || e.startsWith("/*", s)); )
680
- if (e.startsWith("/*", s)) {
681
- const r = e.indexOf("*/", s + 2);
682
- s = r < 0 ? t : r + 2;
1246
+ function qe(e, n, t) {
1247
+ let s = n, i = t;
1248
+ for (; s < i && B(e[s]); ) s++;
1249
+ for (; i > s && B(e[i - 1]); ) i--;
1250
+ return { start: s, end: i };
1251
+ }
1252
+ function Ge(e, n, t, s) {
1253
+ const i = [];
1254
+ let r = n;
1255
+ for (; r < t; ) {
1256
+ for (; r < t && (B(e[r]) || e.startsWith("/*", r)); )
1257
+ if (e.startsWith("/*", r)) {
1258
+ const o = e.indexOf("*/", r + 2);
1259
+ r = o < 0 ? t : o + 2;
683
1260
  } else
684
- s++;
685
- if (s >= t) break;
686
- if (e[s] === ";") {
687
- s++;
1261
+ r++;
1262
+ if (r >= t) break;
1263
+ if (e[r] === ";") {
1264
+ r++;
688
1265
  continue;
689
1266
  }
690
- const m = s, g = te(e, m, ":;}");
691
- if (g >= t || e[g] !== ":") {
692
- const r = Math.min(g, t);
693
- i == null || i("declaration without a value", m, r), s = r + 1;
1267
+ const u = r, c = ce(e, u, ":;}");
1268
+ if (c >= t || e[c] !== ":") {
1269
+ const o = Math.min(c, t);
1270
+ s == null || s("declaration without a value", u, o), r = o + 1;
694
1271
  continue;
695
1272
  }
696
- const v = Math.min(te(e, g + 1, ";}"), t), u = ke(e, g + 1, v);
697
- l.push({
698
- property: e.slice(m, g).trim(),
699
- value: e.slice(u.start, u.end),
700
- span: { start: m, end: u.end },
1273
+ const v = Math.min(ce(e, c + 1, ";}"), t), d = qe(e, c + 1, v);
1274
+ i.push({
1275
+ property: e.slice(u, c).trim(),
1276
+ value: e.slice(d.start, d.end),
1277
+ span: { start: u, end: d.end },
701
1278
  dirty: !1
702
- }), s = v + 1;
1279
+ }), r = v + 1;
703
1280
  }
704
- return l;
1281
+ return i;
705
1282
  }
706
- function pt(e) {
1283
+ function Kt(e) {
707
1284
  const n = e.span.end - 1 - e.value.length;
708
1285
  return n < e.span.start ? null : n;
709
1286
  }
710
- function re(e, n = null, t = 0) {
711
- const i = [], l = [];
712
- let s = 0;
713
- function m(h, x, y) {
714
- i.push({
1287
+ function ge(e, n = null, t = 0) {
1288
+ const s = [], i = [];
1289
+ let r = 0;
1290
+ function u(m, y, k) {
1291
+ s.push({
715
1292
  kind: "malformed",
716
- message: h,
717
- at: { in: "uss", sheet: t, span: { start: x, end: y } }
1293
+ message: m,
1294
+ at: { in: "uss", sheet: t, span: { start: y, end: k } }
718
1295
  });
719
1296
  }
720
- function g() {
1297
+ function c() {
721
1298
  for (; ; ) {
722
- for (; B(e[s]); ) s++;
723
- if (e.startsWith("/*", s)) {
724
- const h = e.indexOf("*/", s + 2);
725
- s = h < 0 ? e.length : h + 2;
1299
+ for (; B(e[r]); ) r++;
1300
+ if (e.startsWith("/*", r)) {
1301
+ const m = e.indexOf("*/", r + 2);
1302
+ r = m < 0 ? e.length : m + 2;
726
1303
  continue;
727
1304
  }
728
1305
  return;
729
1306
  }
730
1307
  }
731
- const v = (h, x) => te(e, h, x), u = (h, x) => ke(e, h, x);
732
- function r(h) {
733
- let x = h + 1, y = 1;
734
- for (; x < e.length; ) {
735
- const b = e[x];
736
- if (b === '"' || b === "'") {
737
- const $ = e.indexOf(b, x + 1);
738
- x = $ < 0 ? e.length : $ + 1;
1308
+ const v = (m, y) => ce(e, m, y), d = (m, y) => qe(e, m, y);
1309
+ function o(m) {
1310
+ let y = m + 1, k = 1;
1311
+ for (; y < e.length; ) {
1312
+ const x = e[y];
1313
+ if (x === '"' || x === "'") {
1314
+ const $ = e.indexOf(x, y + 1);
1315
+ y = $ < 0 ? e.length : $ + 1;
739
1316
  continue;
740
1317
  }
741
- if (b === "/" && e[x + 1] === "*") {
742
- const $ = e.indexOf("*/", x + 2);
743
- x = $ < 0 ? e.length : $ + 2;
1318
+ if (x === "/" && e[y + 1] === "*") {
1319
+ const $ = e.indexOf("*/", y + 2);
1320
+ y = $ < 0 ? e.length : $ + 2;
744
1321
  continue;
745
1322
  }
746
- if (b === "{") y++;
747
- else if (b === "}" && --y === 0) return x + 1;
748
- x++;
1323
+ if (x === "{") k++;
1324
+ else if (x === "}" && --k === 0) return y + 1;
1325
+ y++;
749
1326
  }
750
1327
  return e.length;
751
1328
  }
752
- function a(h) {
753
- let x = h;
754
- for (; x < e.length && ge.test(e[x]); ) x++;
755
- return x;
1329
+ function a(m) {
1330
+ let y = m;
1331
+ for (; y < e.length && Ae.test(e[y]); ) y++;
1332
+ return y;
756
1333
  }
757
- function d(h) {
758
- const x = e[h], y = x === "(" ? ")" : "]";
759
- let b = h + 1, $ = 1;
760
- for (; b < e.length; ) {
761
- const O = e[b];
1334
+ function f(m) {
1335
+ const y = e[m], k = y === "(" ? ")" : "]";
1336
+ let x = m + 1, $ = 1;
1337
+ for (; x < e.length; ) {
1338
+ const O = e[x];
762
1339
  if (O === '"' || O === "'") {
763
- const E = e.indexOf(O, b + 1);
764
- b = E < 0 ? e.length : E + 1;
1340
+ const E = e.indexOf(O, x + 1);
1341
+ x = E < 0 ? e.length : E + 1;
765
1342
  continue;
766
1343
  }
767
- if (O === x) $++;
768
- else if (O === y && --$ === 0) return b + 1;
769
- b++;
1344
+ if (O === y) $++;
1345
+ else if (O === k && --$ === 0) return x + 1;
1346
+ x++;
770
1347
  }
771
1348
  return e.length;
772
1349
  }
773
- function o(h, x) {
774
- const y = [];
775
- let b = h;
776
- for (; b < x; ) {
777
- const $ = e[b];
1350
+ function l(m, y) {
1351
+ const k = [];
1352
+ let x = m;
1353
+ for (; x < y; ) {
1354
+ const $ = e[x];
778
1355
  if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
779
1356
  if ($ === "*")
780
- y.push({ kind: "universal" }), b++;
1357
+ k.push({ kind: "universal" }), x++;
781
1358
  else if ($ === "." || $ === "#") {
782
- const O = a(b + 1);
783
- y.push(
784
- $ === "." ? { kind: "class", name: e.slice(b + 1, O) } : { kind: "name", name: e.slice(b + 1, O) }
785
- ), b = O;
1359
+ const O = a(x + 1);
1360
+ k.push(
1361
+ $ === "." ? { kind: "class", name: e.slice(x + 1, O) } : { kind: "name", name: e.slice(x + 1, O) }
1362
+ ), x = O;
786
1363
  } else if ($ === "[") {
787
- const O = Math.min(d(b), x);
788
- y.push({ kind: "unknown", text: e.slice(b, O) }), b = O;
1364
+ const O = Math.min(f(x), y);
1365
+ k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
789
1366
  } else if ($ === ":")
790
- if (e[b + 1] === ":") {
791
- const O = a(b + 2);
792
- y.push({ kind: "unknown", text: e.slice(b, O) }), b = O;
1367
+ if (e[x + 1] === ":") {
1368
+ const O = a(x + 2);
1369
+ k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
793
1370
  } else {
794
- const O = a(b + 1);
1371
+ const O = a(x + 1);
795
1372
  if (e[O] === "(") {
796
- const E = Math.min(d(O), x);
797
- y.push({ kind: "unknown", text: e.slice(b, E) }), b = E;
1373
+ const E = Math.min(f(O), y);
1374
+ k.push({ kind: "unknown", text: e.slice(x, E) }), x = E;
798
1375
  } else
799
- y.push({ kind: "pseudo", name: e.slice(b + 1, O) }), b = O;
1376
+ k.push({ kind: "pseudo", name: e.slice(x + 1, O) }), x = O;
800
1377
  }
801
- else if (ge.test($)) {
802
- const O = a(b);
803
- y.push({ kind: "type", name: e.slice(b, O) }), b = O;
1378
+ else if (Ae.test($)) {
1379
+ const O = a(x);
1380
+ k.push({ kind: "type", name: e.slice(x, O) }), x = O;
804
1381
  } else
805
- y.push({ kind: "unknown", text: $ }), b++;
1382
+ k.push({ kind: "unknown", text: $ }), x++;
806
1383
  }
807
- return { simple: y, next: b };
808
- }
809
- function f(h, x) {
810
- const y = u(h, x), b = [];
811
- let $ = "descendant", O = null, E = y.start;
812
- for (; E < y.end; ) {
813
- const R = e[E];
814
- if (B(R)) {
1384
+ return { simple: k, next: x };
1385
+ }
1386
+ function h(m, y) {
1387
+ const k = d(m, y), x = [];
1388
+ let $ = "descendant", O = null, E = k.start;
1389
+ for (; E < k.end; ) {
1390
+ const C = e[E];
1391
+ if (B(C)) {
815
1392
  E++;
816
1393
  continue;
817
1394
  }
818
- if (R === ">") {
1395
+ if (C === ">") {
819
1396
  $ = "child", E++;
820
1397
  continue;
821
1398
  }
822
- if (R === "+" || R === "~") {
823
- O = R, E++;
1399
+ if (C === "+" || C === "~") {
1400
+ O = C, E++;
824
1401
  continue;
825
1402
  }
826
- const { simple: D, next: p } = o(E, y.end);
827
- if (p === E) {
1403
+ const { simple: L, next: w } = l(E, k.end);
1404
+ if (w === E) {
828
1405
  E++;
829
1406
  continue;
830
1407
  }
831
- O !== null && (D.unshift({ kind: "unknown", text: O }), O = null), b.push({ combinator: $, simple: D }), $ = "descendant", E = p;
1408
+ O !== null && (L.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: L }), $ = "descendant", E = w;
832
1409
  }
833
- return { parts: b, span: y };
1410
+ return { parts: x, span: k };
834
1411
  }
835
- function w(h, x) {
836
- const y = [];
837
- let b = h;
1412
+ function g(m, y) {
1413
+ const k = [];
1414
+ let x = m;
838
1415
  for (; ; ) {
839
- const $ = Math.min(v(b, ","), x);
840
- if (y.push(f(b, $)), $ >= x) break;
841
- b = $ + 1;
1416
+ const $ = Math.min(v(x, ","), y);
1417
+ if (k.push(h(x, $)), $ >= y) break;
1418
+ x = $ + 1;
842
1419
  }
843
- return y;
1420
+ return k;
844
1421
  }
845
- function c() {
846
- const h = s, x = a(s + 1), y = e.slice(s + 1, x), b = v(x, "{;");
847
- if (b < e.length && e[b] === "{") {
848
- const O = r(b);
849
- return s = O, { kind: "unknown", span: { start: h, end: O } };
1422
+ function p() {
1423
+ const m = r, y = a(r + 1), k = e.slice(r + 1, y), x = v(y, "{;");
1424
+ if (x < e.length && e[x] === "{") {
1425
+ const O = o(x);
1426
+ return r = O, { kind: "unknown", span: { start: m, end: O } };
850
1427
  }
851
- const $ = b < e.length ? b + 1 : e.length;
852
- if (s = $, y === "import") {
853
- const O = e.slice(x, $), E = /["']([^"']*)["']/.exec(O);
854
- return E === null ? (m("@import without a quoted path", h, $), { kind: "unknown", span: { start: h, end: $ } }) : { kind: "import", url: E[1], span: { start: h, end: $ } };
1428
+ const $ = x < e.length ? x + 1 : e.length;
1429
+ if (r = $, k === "import") {
1430
+ const O = e.slice(y, $), E = /["']([^"']*)["']/.exec(O);
1431
+ return E === null ? (u("@import without a quoted path", m, $), { kind: "unknown", span: { start: m, end: $ } }) : { kind: "import", url: E[1], span: { start: m, end: $ } };
855
1432
  }
856
- return { kind: "unknown", span: { start: h, end: $ } };
857
- }
858
- function S() {
859
- const h = s, x = v(h, "{");
860
- if (x >= e.length)
861
- return m("rule without a block", h, e.length), s = e.length, { kind: "unknown", span: { start: h, end: e.length } };
862
- const y = u(h, x), b = r(x);
863
- (b > e.length || e[b - 1] !== "}") && m("unterminated rule block", h, b);
1433
+ return { kind: "unknown", span: { start: m, end: $ } };
1434
+ }
1435
+ function b() {
1436
+ const m = r, y = v(m, "{");
1437
+ if (y >= e.length)
1438
+ return u("rule without a block", m, e.length), r = e.length, { kind: "unknown", span: { start: m, end: e.length } };
1439
+ const k = d(m, y), x = o(y);
1440
+ (x > e.length || e[x - 1] !== "}") && u("unterminated rule block", m, x);
864
1441
  const $ = {
865
- selectors: w(y.start, y.end),
866
- declarations: Se(e, x + 1, b - 1, m),
867
- span: { start: y.start, end: b },
868
- selectorSpan: y,
1442
+ selectors: g(k.start, k.end),
1443
+ declarations: Ge(e, y + 1, x - 1, u),
1444
+ span: { start: k.start, end: x },
1445
+ selectorSpan: k,
869
1446
  selectorDirty: !1,
870
1447
  declarationsDirty: !1
871
1448
  };
872
- return s = b, { kind: "rule", rule: $ };
1449
+ return r = x, { kind: "rule", rule: $ };
873
1450
  }
874
- for (; g(), !(s >= e.length); )
875
- l.push(e[s] === "@" ? c() : S());
876
- return { sheet: { source: e, origin: n, items: l }, warnings: i };
1451
+ for (; c(), !(r >= e.length); )
1452
+ i.push(e[r] === "@" ? p() : b());
1453
+ return { sheet: { source: e, origin: n, items: i }, warnings: s };
877
1454
  }
878
- function ht(e, n, t) {
1455
+ function Zt(e, n, t) {
879
1456
  switch (e.kind) {
880
1457
  case "universal":
881
1458
  return !0;
@@ -891,61 +1468,61 @@ function ht(e, n, t) {
891
1468
  return !1;
892
1469
  }
893
1470
  }
894
- function mt(e, n, t) {
895
- return e.simple.every((i) => ht(i, n, t));
1471
+ function Qt(e, n, t) {
1472
+ return e.simple.every((s) => Zt(s, n, t));
896
1473
  }
897
- function ne(e, n, t, i) {
898
- if (!mt(e[n], t, i)) return !1;
1474
+ function ue(e, n, t, s) {
1475
+ if (!Qt(e[n], t, s)) return !1;
899
1476
  if (n === 0) return !0;
900
- const l = i.parentOf(t);
1477
+ const i = s.parentOf(t);
901
1478
  if (e[n].combinator === "child")
902
- return l !== null && ne(e, n - 1, l, i);
903
- for (let s = l; s !== null; s = i.parentOf(s))
904
- if (ne(e, n - 1, s, i)) return !0;
1479
+ return i !== null && ue(e, n - 1, i, s);
1480
+ for (let r = i; r !== null; r = s.parentOf(r))
1481
+ if (ue(e, n - 1, r, s)) return !0;
905
1482
  return !1;
906
1483
  }
907
- function $e(e, n, t) {
908
- return e.parts.length === 0 ? !1 : ne(e.parts, e.parts.length - 1, n, t);
1484
+ function Je(e, n, t) {
1485
+ return e.parts.length === 0 ? !1 : ue(e.parts, e.parts.length - 1, n, t);
909
1486
  }
910
- function gt(e) {
1487
+ function en(e) {
911
1488
  const n = [];
912
1489
  for (const t of e.parts)
913
- for (const i of t.simple)
914
- i.kind === "pseudo" && i.name !== "root" && !n.includes(i.name) && n.push(i.name);
1490
+ for (const s of t.simple)
1491
+ s.kind === "pseudo" && s.name !== "root" && !n.includes(s.name) && n.push(s.name);
915
1492
  return n;
916
1493
  }
917
- function wt(e) {
1494
+ function tn(e) {
918
1495
  const n = [];
919
1496
  for (const t of e)
920
- for (const i of t.parts)
921
- for (const l of i.simple) {
922
- if (l.kind !== "name" && l.kind !== "class" || !l.name.startsWith("unity-")) continue;
923
- const s = l.kind === "name" ? `#${l.name}` : `.${l.name}`;
924
- n.includes(s) || n.push(s);
1497
+ for (const s of t.parts)
1498
+ for (const i of s.simple) {
1499
+ if (i.kind !== "name" && i.kind !== "class" || !i.name.startsWith("unity-")) continue;
1500
+ const r = i.kind === "name" ? `#${i.name}` : `.${i.name}`;
1501
+ n.includes(r) || n.push(r);
925
1502
  }
926
1503
  return n;
927
1504
  }
928
- function Te(e) {
1505
+ function Xe(e) {
929
1506
  for (const n of e)
930
1507
  for (const t of n.parts)
931
- for (const i of t.simple)
932
- if (i.kind === "unknown") return i.text;
1508
+ for (const s of t.simple)
1509
+ if (s.kind === "unknown") return s.text;
933
1510
  return null;
934
1511
  }
935
- function bt(e) {
1512
+ function nn(e) {
936
1513
  const n = /* @__PURE__ */ new Map([[e, null]]), t = [e];
937
1514
  for (; t.length > 0; ) {
938
- const i = t.pop();
939
- for (const l of i.children)
940
- n.set(l, i), t.push(l);
1515
+ const s = t.pop();
1516
+ for (const i of s.children)
1517
+ n.set(i, s), t.push(i);
941
1518
  }
942
1519
  return n;
943
1520
  }
944
- function xt(e) {
945
- let n = 0, t = 0, i = 0;
946
- for (const l of e.parts)
947
- for (const s of l.simple)
948
- switch (s.kind) {
1521
+ function sn(e) {
1522
+ let n = 0, t = 0, s = 0;
1523
+ for (const i of e.parts)
1524
+ for (const r of i.simple)
1525
+ switch (r.kind) {
949
1526
  case "name":
950
1527
  n++;
951
1528
  break;
@@ -954,78 +1531,93 @@ function xt(e) {
954
1531
  t++;
955
1532
  break;
956
1533
  case "type":
957
- i++;
1534
+ s++;
958
1535
  break;
959
1536
  }
960
- return [n, t, i];
1537
+ return [n, t, s];
961
1538
  }
962
- function Oe(e, n) {
1539
+ function Ye(e, n) {
963
1540
  return e[0] - n[0] || e[1] - n[1] || e[2] - n[2];
964
1541
  }
965
- const vt = [Number.MAX_SAFE_INTEGER, 0, 0], yt = re(ve, null, -1).sheet.items.flatMap(
1542
+ const rn = [Number.MAX_SAFE_INTEGER, 0, 0], on = ge(Ve, null, -1).sheet.items.flatMap(
966
1543
  (e, n) => e.kind === "rule" ? [{ rule: e.rule, sheet: -1, item: n, builtin: !0 }] : []
967
1544
  );
968
- function kt(e) {
969
- return ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
1545
+ function ln(e) {
1546
+ return Ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
970
1547
  }
971
- function St(e, n, t, i) {
972
- const l = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), s = Object.entries((t == null ? void 0 : t.states) ?? {}), m = [];
973
- for (const [r, a] of s) {
974
- const d = re(`${r} {}`, null, -1).sheet.items.find((f) => f.kind === "rule"), o = d === void 0 ? r : Te(d.rule.selectors);
975
- if (d === void 0 || o !== null) {
976
- i.push({
1548
+ function an(e, n, t, s) {
1549
+ const i = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), r = Object.entries((t == null ? void 0 : t.states) ?? {}), u = [];
1550
+ for (const [o, a] of r) {
1551
+ const f = ge(`${o} {}`, null, -1).sheet.items.find((h) => h.kind === "rule"), l = f === void 0 ? o : Xe(f.rule.selectors);
1552
+ if (f === void 0 || l !== null) {
1553
+ s.push({
977
1554
  kind: "unsupported-selector",
978
- message: `states key "${r}" is not a usable USS selector; it is ignored`
1555
+ message: `states key "${o}" is not a usable USS selector; it is ignored`
979
1556
  });
980
1557
  continue;
981
1558
  }
982
- m.push({ selectors: d.rule.selectors, states: a });
983
- }
984
- const g = /* @__PURE__ */ new Map(), v = (r) => r.attributes.some((a) => a.name === "enabled" && a.value === "false"), u = (r, a) => {
985
- const d = a || v(r), o = new Set(l);
986
- d && o.add("disabled");
987
- for (const f of m)
988
- if (f.selectors.some((w) => $e(w, { kind: "element", node: r }, n)))
989
- for (const w of f.states) o.add(w);
990
- g.set(r, o);
991
- for (const f of r.children) u(f, d);
1559
+ u.push({ selectors: f.rule.selectors, states: a });
1560
+ }
1561
+ const c = /* @__PURE__ */ new Map(), v = (o) => o.attributes.some((a) => a.name === "enabled" && a.value === "false"), d = (o, a) => {
1562
+ const f = a || v(o), l = new Set(i);
1563
+ f && l.add("disabled");
1564
+ for (const h of u)
1565
+ if (h.selectors.some((g) => Je(g, { kind: "element", node: o }, n)))
1566
+ for (const g of h.states) l.add(g);
1567
+ c.set(o, l);
1568
+ for (const h of o.children) d(h, f);
992
1569
  };
993
- return u(e.root, !1), g;
1570
+ return d(e.root, !1), c;
994
1571
  }
995
- function $t(e) {
1572
+ function cn(e) {
996
1573
  const n = [], t = /* @__PURE__ */ new Map();
997
- e.sheets.forEach((s, m) => {
998
- s.origin !== null && !t.has(s.origin) && t.set(s.origin, m);
999
- }), n.push(...yt);
1000
- const i = /* @__PURE__ */ new Set(), l = (s) => {
1001
- if (i.has(s)) return;
1002
- i.add(s);
1003
- const m = e.sheets[s];
1004
- m !== void 0 && m.items.forEach((g, v) => {
1005
- if (g.kind === "rule")
1006
- n.push({ rule: g.rule, sheet: s, item: v });
1007
- else if (g.kind === "import") {
1008
- const u = t.get(g.url);
1009
- u !== void 0 && l(u);
1574
+ e.sheets.forEach((u, c) => {
1575
+ u.origin !== null && !t.has(u.origin) && t.set(u.origin, c);
1576
+ }), n.push(...on);
1577
+ const s = /* @__PURE__ */ new Map(), i = (u, c) => {
1578
+ const v = s.get(c) ?? /* @__PURE__ */ new Set();
1579
+ if (v.has(u)) return;
1580
+ v.add(u), s.set(c, v);
1581
+ const d = e.sheets[u];
1582
+ d !== void 0 && d.items.forEach((o, a) => {
1583
+ if (o.kind === "rule")
1584
+ n.push({ rule: o.rule, sheet: u, item: a, scope: c });
1585
+ else if (o.kind === "import") {
1586
+ const f = o.resolvedSheet ?? t.get(o.url);
1587
+ f !== void 0 && i(f, c);
1010
1588
  }
1011
1589
  });
1012
- };
1013
- return l(0), n;
1590
+ }, r = e.styleRoots ?? (e.sheets.length === 0 ? [] : [{ sheet: 0, scope: e.root.id }]);
1591
+ for (const u of r) i(u.sheet, u.scope);
1592
+ return n;
1014
1593
  }
1015
- function Tt(e) {
1594
+ function un(e, n, t) {
1595
+ let s = e;
1596
+ for (; s !== null; ) {
1597
+ if (s.kind === "element" && s.node.id === n) return !0;
1598
+ s = t.parentOf(s);
1599
+ }
1600
+ return !1;
1601
+ }
1602
+ function dn(e) {
1016
1603
  return e.selectors.some(
1017
- (n) => n.parts.some((t) => t.simple.some((i) => i.kind === "pseudo" && i.name === "root"))
1604
+ (n) => n.parts.some((t) => t.simple.some((s) => s.kind === "pseudo" && s.name === "root"))
1018
1605
  );
1019
1606
  }
1020
- function Ee(e, n) {
1021
- const t = bt(e.root), i = [], l = /* @__PURE__ */ new Set(), s = (o) => {
1022
- var w;
1023
- const f = (w = o.attributes.find((c) => c.name === "class")) == null ? void 0 : w.value;
1024
- return f === void 0 ? [] : f.split(/\s+/).filter((c) => c.length > 0);
1025
- }, m = (o, f) => {
1026
- var w;
1027
- return (w = o.attributes.find((c) => c.name === f)) == null ? void 0 : w.value;
1028
- }, g = {
1607
+ function de(e, n) {
1608
+ var s;
1609
+ const t = (s = e.sheets[n]) == null ? void 0 : s.origin;
1610
+ return typeof t == "string" ? { sourceDocument: t } : {};
1611
+ }
1612
+ function Ke(e, n) {
1613
+ const t = nn(e.root), s = [], i = /* @__PURE__ */ new Set(), r = (l) => {
1614
+ var g;
1615
+ const h = (g = l.attributes.find((p) => p.name === "class")) == null ? void 0 : g.value;
1616
+ return h === void 0 ? [] : h.split(/\s+/).filter((p) => p.length > 0);
1617
+ }, u = (l, h) => {
1618
+ var g;
1619
+ return (g = l.attributes.find((p) => p.name === h)) == null ? void 0 : g.value;
1620
+ }, c = {
1029
1621
  /**
1030
1622
  * The rule the measurement forced.
1031
1623
  *
@@ -1036,224 +1628,251 @@ function Ee(e, n) {
1036
1628
  * owner. That is the hierarchy the dumps show, so descendant selectors like
1037
1629
  * `.panel #unity-content-viewport` behave as they do in Unity.
1038
1630
  */
1039
- parentOf: (o) => {
1040
- if (o.kind === "element") {
1041
- const c = t.get(o.node) ?? null;
1042
- return c === null ? null : { kind: "element", node: c };
1631
+ parentOf: (l) => {
1632
+ if (l.kind === "element") {
1633
+ const p = t.get(l.node) ?? null;
1634
+ return p === null ? null : { kind: "element", node: p };
1043
1635
  }
1044
- if (o.depth === 0) return { kind: "element", node: o.owner };
1045
- const w = F(o.owner).spec.parts[o.depth - 1];
1046
- return { kind: "part", owner: o.owner, name: w.name, depth: o.depth - 1 };
1636
+ if (l.depth === 0) return { kind: "element", node: l.owner };
1637
+ const g = H(l.owner).spec.parts[l.depth - 1];
1638
+ return { kind: "part", owner: l.owner, name: g.name, depth: l.depth - 1 };
1047
1639
  },
1048
- isRoot: (o) => o.kind === "element" && o.node === e.root,
1640
+ isRoot: (l) => l.kind === "element" && l.node === e.root,
1049
1641
  // Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
1050
1642
  // Not measured — `part-type-selector` is the case that will settle it.
1051
- typeNameOf: (o) => o.kind === "element" ? o.node.name.local : "VisualElement",
1052
- idOf: (o) => o.kind === "element" ? m(o.node, "name") : o.name,
1643
+ typeNameOf: (l) => l.kind === "element" ? l.node.name.local : "VisualElement",
1644
+ idOf: (l) => l.kind === "element" ? u(l.node, "name") : l.name,
1053
1645
  // Implicit classes are as real as written ones for matching: in Unity the
1054
1646
  // element genuinely carries them, which is why `.unity-button` in author USS
1055
1647
  // hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
1056
1648
  // ones is unmeasured, so none are claimed here.
1057
- classesOf: (o) => o.kind === "element" ? [...s(o.node), ...We(o.node)] : []
1058
- }, v = { ...g, statesOf: () => l }, u = St(e, v, n, i), r = {
1059
- ...g,
1649
+ classesOf: (l) => l.kind === "element" ? [...r(l.node), ...$t(l.node)] : []
1650
+ }, v = { ...c, statesOf: () => i }, d = an(e, v, n, s), o = {
1651
+ ...c,
1060
1652
  // A part inherits its owner's states: `SetEnabled(false)` disables the whole
1061
1653
  // subtree, and a part is inside it.
1062
- statesOf: (o) => u.get(o.kind === "element" ? o.node : o.owner) ?? l
1654
+ statesOf: (l) => d.get(l.kind === "element" ? l.node : l.owner) ?? i
1063
1655
  }, a = [];
1064
- let d = !1;
1065
- for (const o of $t(e)) {
1066
- if (o.builtin === !0) {
1067
- a.push(o);
1656
+ let f = !1;
1657
+ for (const l of cn(e)) {
1658
+ if (l.builtin === !0) {
1659
+ a.push(l);
1068
1660
  continue;
1069
1661
  }
1070
- const f = Te(o.rule.selectors);
1071
- if (f !== null) {
1072
- i.push({
1662
+ const h = Xe(l.rule.selectors);
1663
+ if (h !== null) {
1664
+ s.push({
1073
1665
  kind: "unsupported-selector",
1074
- message: `"${f}" is not supported in USS; the whole rule is ignored`,
1075
- at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan }
1666
+ message: `"${h}" is not supported in USS; the whole rule is ignored`,
1667
+ at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
1668
+ ...de(e, l.sheet)
1076
1669
  });
1077
1670
  continue;
1078
1671
  }
1079
- !d && Tt(o.rule) && (d = !0, i.push({
1672
+ !f && dn(l.rule) && (f = !0, s.push({
1080
1673
  kind: "version-dependent",
1081
- message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. This preview matches it against the <ui:UXML> element; verify against your Unity version.",
1082
- at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan }
1083
- })), a.push(o);
1674
+ message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. Template stylesheets therefore match their generated TemplateContainer.",
1675
+ at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
1676
+ ...de(e, l.sheet)
1677
+ })), a.push(l);
1084
1678
  }
1085
- return { ctx: r, usable: a, warnings: i };
1679
+ return { ctx: o, usable: a, warnings: s };
1086
1680
  }
1087
- function Ot(e, n) {
1088
- const t = n.attributes.find((l) => l.name === "style");
1681
+ function fn(e, n) {
1682
+ const t = n.attributes.find((i) => i.name === "style");
1089
1683
  if (t === void 0) return [];
1090
- const i = pt(t);
1091
- return i === null ? [] : Se(e.source, i, i + t.value.length);
1092
- }
1093
- function Ne(e, n, t, i) {
1094
- const l = [];
1095
- let s = 0;
1096
- const m = (g, v, u, r, a) => {
1097
- l.push({ property: g, value: v, origin: u, rank: r, specificity: a, order: s++, winner: !1 });
1684
+ const s = Kt(t);
1685
+ return s === null ? [] : Ge(e.source, s, s + t.value.length);
1686
+ }
1687
+ function Ze(e, n, t, s) {
1688
+ const i = [];
1689
+ let r = 0;
1690
+ const u = (c, v, d, o, a) => {
1691
+ i.push({ property: c, value: v, origin: d, rank: o, specificity: a, order: r++, winner: !1 });
1098
1692
  };
1099
1693
  if (n.kind === "part") {
1100
- const g = F(n.owner).spec.parts[n.depth];
1101
- for (const [v, u] of Object.entries((g == null ? void 0 : g.style) ?? {}))
1102
- for (const [r, a] of J(v, u))
1103
- m(
1104
- r,
1694
+ const c = H(n.owner).spec.parts[n.depth];
1695
+ for (const [v, d] of Object.entries((c == null ? void 0 : c.style) ?? {}))
1696
+ for (const [o, a] of ie(v, d))
1697
+ u(
1698
+ o,
1105
1699
  a,
1106
1700
  {
1107
1701
  kind: "builtin-theme",
1108
1702
  selector: `#${n.name}`,
1109
- property: r,
1110
- unityVersion: Y
1703
+ property: o,
1704
+ unityVersion: Z
1111
1705
  },
1112
1706
  0,
1113
1707
  [0, 0, 0]
1114
1708
  );
1115
1709
  }
1116
- for (const g of t.usable) {
1117
- let v = null, u = [];
1118
- for (const r of g.rule.selectors) {
1119
- if (!$e(r, n, t.ctx)) continue;
1120
- const a = xt(r);
1121
- (v === null || Oe(a, v) > 0) && (v = a, u = gt(r));
1710
+ for (const c of t.usable) {
1711
+ if (c.scope !== void 0 && !un(n, c.scope, t.ctx)) continue;
1712
+ const v = c.scope === void 0 ? t.ctx : {
1713
+ ...t.ctx,
1714
+ // Unity USS :root names the element this particular stylesheet is
1715
+ // attached to. Template sheets are attached to each generated
1716
+ // TemplateContainer, not to the entry document root.
1717
+ isRoot: (a) => a.kind === "element" && a.node.id === c.scope
1718
+ };
1719
+ let d = null, o = [];
1720
+ for (const a of c.rule.selectors) {
1721
+ if (!Je(a, n, v)) continue;
1722
+ const f = sn(a);
1723
+ (d === null || Ye(f, d) > 0) && (d = f, o = en(a));
1122
1724
  }
1123
- v !== null && (i == null || i.add(g), g.rule.declarations.forEach((r, a) => {
1124
- for (const [d, o] of J(r.property, r.value)) {
1125
- const f = g.builtin === !0 ? {
1725
+ d !== null && (s == null || s.add(c), c.rule.declarations.forEach((a, f) => {
1726
+ var l, h, g;
1727
+ for (const [p, b] of ie(a.property, a.value)) {
1728
+ const m = c.builtin === !0 ? {
1126
1729
  kind: "builtin-theme",
1127
- selector: kt(g.rule),
1128
- property: d,
1129
- unityVersion: Y
1730
+ selector: ln(c.rule),
1731
+ property: p,
1732
+ unityVersion: Z
1130
1733
  } : {
1131
1734
  kind: "rule",
1132
- sheet: g.sheet,
1133
- item: g.item,
1134
- declIndex: a,
1735
+ sheet: c.sheet,
1736
+ item: c.item,
1737
+ declIndex: f,
1738
+ ...((l = e.sheets[c.sheet]) == null ? void 0 : l.origin) === null || ((h = e.sheets[c.sheet]) == null ? void 0 : h.origin) === void 0 ? {} : { sourceDocument: e.sheets[c.sheet].origin },
1739
+ ...((g = e.sheets[c.sheet]) == null ? void 0 : g.sourceDocumentFrom) === void 0 ? {} : { sourceDocumentFrom: e.sheets[c.sheet].sourceDocumentFrom },
1135
1740
  // Omitted rather than set to [] when unconditional, so the
1136
1741
  // common case stays the shape it has always been.
1137
- ...u.length > 0 ? { states: u } : {}
1742
+ ...o.length > 0 ? { states: o } : {}
1138
1743
  };
1139
- m(d, o, f, g.builtin === !0 ? 0 : 1, v);
1744
+ u(p, b, m, c.builtin === !0 ? 0 : 1, d);
1140
1745
  }
1141
1746
  }));
1142
1747
  }
1143
1748
  if (n.kind === "element") {
1144
- const g = n.node;
1145
- Ot(e, g).forEach((v, u) => {
1146
- for (const [r, a] of J(v.property, v.value))
1147
- m(r, a, { kind: "inline", node: g.id, declIndex: u }, 1, vt);
1749
+ const c = n.node;
1750
+ fn(e, c).forEach((v, d) => {
1751
+ var o;
1752
+ for (const [a, f] of ie(v.property, v.value))
1753
+ u(
1754
+ a,
1755
+ f,
1756
+ {
1757
+ kind: "inline",
1758
+ node: ((o = c.derived) == null ? void 0 : o.instance) ?? c.sourceNode ?? c.id,
1759
+ declIndex: d,
1760
+ ...typeof c.sourceDocument == "string" ? { sourceDocument: c.sourceDocument } : {},
1761
+ ...c.sourceDocumentFrom === void 0 ? {} : { sourceDocumentFrom: c.sourceDocumentFrom }
1762
+ },
1763
+ 1,
1764
+ rn
1765
+ );
1148
1766
  });
1149
1767
  }
1150
- return l;
1768
+ return i;
1151
1769
  }
1152
- function Ce(e) {
1770
+ function Qe(e) {
1153
1771
  const n = /* @__PURE__ */ new Map();
1154
1772
  for (const t of e) {
1155
- const i = n.get(t.property);
1156
- if (i === void 0) {
1773
+ const s = n.get(t.property);
1774
+ if (s === void 0) {
1157
1775
  n.set(t.property, t);
1158
1776
  continue;
1159
1777
  }
1160
- if (t.rank !== i.rank) {
1161
- t.rank > i.rank && n.set(t.property, t);
1778
+ if (t.rank !== s.rank) {
1779
+ t.rank > s.rank && n.set(t.property, t);
1162
1780
  continue;
1163
1781
  }
1164
- const l = Oe(t.specificity, i.specificity);
1165
- (l > 0 || l === 0 && t.order > i.order) && n.set(t.property, t);
1782
+ const i = Ye(t.specificity, s.specificity);
1783
+ (i > 0 || i === 0 && t.order > s.order) && n.set(t.property, t);
1166
1784
  }
1167
1785
  for (const t of n.values()) t.winner = !0;
1168
1786
  return n;
1169
1787
  }
1170
- const Et = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
1171
- function ie(e, n, t = /* @__PURE__ */ new Set()) {
1172
- var l;
1173
- let i = e;
1174
- for (let s = 0; s < 32; s++) {
1175
- const m = Et.exec(i);
1176
- if (m === null) return i;
1177
- const g = m[1], v = (l = m[2]) == null ? void 0 : l.trim();
1178
- if (t.has(g)) return null;
1179
- const u = /* @__PURE__ */ new Set([...t, g]), r = n.get(g), a = r !== void 0 ? ie(r, n, u) : v !== void 0 && v.length > 0 ? ie(v, n, u) : null;
1788
+ const pn = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
1789
+ function fe(e, n, t = /* @__PURE__ */ new Set()) {
1790
+ var i;
1791
+ let s = e;
1792
+ for (let r = 0; r < 32; r++) {
1793
+ const u = pn.exec(s);
1794
+ if (u === null) return s;
1795
+ const c = u[1], v = (i = u[2]) == null ? void 0 : i.trim();
1796
+ if (t.has(c)) return null;
1797
+ const d = /* @__PURE__ */ new Set([...t, c]), o = n.get(c), a = o !== void 0 ? fe(o, n, d) : v !== void 0 && v.length > 0 ? fe(v, n, d) : null;
1180
1798
  if (a === null) return null;
1181
- i = i.slice(0, m.index) + a + i.slice(m.index + m[0].length);
1799
+ s = s.slice(0, u.index) + a + s.slice(u.index + u[0].length);
1182
1800
  }
1183
1801
  return null;
1184
1802
  }
1185
- function Nt(e, n) {
1186
- const t = Ee(e, n), i = [...t.warnings], l = /* @__PURE__ */ new Map();
1187
- let s = !1;
1188
- const m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), v = (r, a, d) => {
1189
- const o = Ne(e, r, t, g);
1190
- !s && o.some((h) => h.origin.kind === "builtin-theme") && (s = !0);
1191
- const f = Ce(o), w = /* @__PURE__ */ new Map();
1192
- for (const [h, x] of a)
1193
- h.startsWith("--") && w.set(h, x.value);
1194
- for (const [h, x] of f)
1195
- h.startsWith("--") && w.set(h, x.value);
1196
- const c = /* @__PURE__ */ new Map();
1197
- for (const [h, x] of a) c.set(h, x);
1198
- for (const [h, x] of f) {
1199
- const y = ie(x.value, w);
1200
- if (y === null) {
1201
- i.push({
1803
+ function hn(e, n) {
1804
+ const t = Ke(e, n), s = [...t.warnings], i = /* @__PURE__ */ new Map();
1805
+ let r = !1;
1806
+ const u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), v = (o, a, f) => {
1807
+ const l = Ze(e, o, t, c);
1808
+ !r && l.some((m) => m.origin.kind === "builtin-theme") && (r = !0);
1809
+ const h = Qe(l), g = /* @__PURE__ */ new Map();
1810
+ for (const [m, y] of a)
1811
+ m.startsWith("--") && g.set(m, y.value);
1812
+ for (const [m, y] of h)
1813
+ m.startsWith("--") && g.set(m, y.value);
1814
+ const p = /* @__PURE__ */ new Map();
1815
+ for (const [m, y] of a) p.set(m, y);
1816
+ for (const [m, y] of h) {
1817
+ const k = fe(y.value, g);
1818
+ if (k === null) {
1819
+ s.push({
1202
1820
  kind: "unsupported-property",
1203
- message: `${h}: var() reference could not be resolved; declaration dropped`,
1204
- node: d
1821
+ message: `${m}: var() reference could not be resolved; declaration dropped`,
1822
+ node: f
1205
1823
  });
1206
1824
  continue;
1207
1825
  }
1208
- c.set(h, { value: y, origin: x.origin });
1826
+ p.set(m, { value: k, origin: y.origin });
1209
1827
  }
1210
- const S = /* @__PURE__ */ new Map();
1211
- for (const [h, x] of c)
1212
- He(h) && S.set(h, {
1213
- value: x.value,
1214
- origin: { kind: "inherited", from: d, origin: x.origin }
1828
+ const b = /* @__PURE__ */ new Map();
1829
+ for (const [m, y] of p)
1830
+ Dt(m) && b.set(m, {
1831
+ value: y.value,
1832
+ origin: { kind: "inherited", from: f, origin: y.origin }
1215
1833
  });
1216
- return { computed: c, forChildren: S };
1217
- }, u = (r, a) => {
1218
- const d = v({ kind: "element", node: r }, a, r.id);
1219
- l.set(r.id, d.computed);
1220
- let o = d.forChildren;
1221
- const f = F(r).spec.parts;
1222
- if (f.length > 0) {
1223
- const w = /* @__PURE__ */ new Map();
1224
- f.forEach((c, S) => {
1225
- const h = v(
1226
- { kind: "part", owner: r, name: c.name, depth: S },
1227
- o,
1228
- r.id
1834
+ return { computed: p, forChildren: b };
1835
+ }, d = (o, a) => {
1836
+ const f = v({ kind: "element", node: o }, a, o.id);
1837
+ i.set(o.id, f.computed);
1838
+ let l = f.forChildren;
1839
+ const h = H(o).spec.parts;
1840
+ if (h.length > 0) {
1841
+ const g = /* @__PURE__ */ new Map();
1842
+ h.forEach((p, b) => {
1843
+ const m = v(
1844
+ { kind: "part", owner: o, name: p.name, depth: b },
1845
+ l,
1846
+ o.id
1229
1847
  );
1230
- w.set(c.name, h.computed), o = h.forChildren;
1231
- }), m.set(r.id, w);
1848
+ g.set(p.name, m.computed), l = m.forChildren;
1849
+ }), u.set(o.id, g);
1232
1850
  }
1233
- for (const w of r.children) u(w, o);
1851
+ for (const g of o.children) d(g, l);
1234
1852
  };
1235
- u(e.root, /* @__PURE__ */ new Map()), s && i.push({
1853
+ d(e.root, /* @__PURE__ */ new Map()), r && s.push({
1236
1854
  kind: "version-dependent",
1237
- message: `Unity's control defaults were applied, as measured on ${Y} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
1855
+ message: `Unity's control defaults were applied, as measured on ${Z} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
1238
1856
  });
1239
- for (const r of t.usable) {
1240
- if (r.builtin === !0 || g.has(r)) continue;
1241
- const a = wt(r.rule.selectors);
1242
- a.length !== 0 && i.push({
1857
+ for (const o of t.usable) {
1858
+ if (o.builtin === !0 || c.has(o)) continue;
1859
+ const a = tn(o.rule.selectors);
1860
+ a.length !== 0 && s.push({
1243
1861
  kind: "unsupported-selector",
1244
- message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${Be().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
1245
- at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
1862
+ message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${Tt().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
1863
+ at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan },
1864
+ ...de(e, o.sheet)
1246
1865
  });
1247
1866
  }
1248
- return { styles: l, partStyles: m, warnings: i };
1867
+ return { styles: i, partStyles: u, warnings: s };
1249
1868
  }
1250
- function zt(e, n, t, i) {
1251
- const l = Ee(e, i), s = Ne(e, { kind: "element", node: n }, l).filter(
1252
- (m) => m.property === t
1869
+ function Sn(e, n, t, s) {
1870
+ const i = Ke(e, s), r = Ze(e, { kind: "element", node: n }, i).filter(
1871
+ (u) => u.property === t
1253
1872
  );
1254
- return Ce(s), s;
1873
+ return Qe(r), r;
1255
1874
  }
1256
- const _t = [
1875
+ const $n = [
1257
1876
  {
1258
1877
  id: "text-metrics",
1259
1878
  kind: "unreproducible",
@@ -1273,358 +1892,226 @@ const _t = [
1273
1892
  detail: "The yoga-layout version this package depends on resolves a main-axis percentage against an indefinite parent differently from the Yoga vendored inside Unity 6000.0.40f1. Not configurable: no available setting reproduces Unity's answer without breaking cases that currently match. Fully deterministic and pinned to a case in docs/accuracy.md — this always reproduces the same way, it just cannot be fixed from inside this repository."
1274
1893
  }
1275
1894
  ];
1276
- function we(e) {
1277
- return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
1278
- }
1279
- function be(e) {
1280
- return e !== void 0 && /[A-Za-z_]/.test(e);
1281
- }
1282
- function Ct(e) {
1283
- return e === " " || e === " " || e === `
1284
- ` || e === "\r";
1285
- }
1286
- function At(e) {
1287
- const n = [];
1288
- let t = 0, i = 0;
1289
- const l = () => i++;
1290
- function s(a, d, o) {
1291
- n.push({
1292
- kind: "malformed",
1293
- message: a,
1294
- at: { in: "uxml", span: { start: d, end: o } }
1295
- });
1895
+ function mn(e, n) {
1896
+ const t = (d) => e.slice(d.start, d.end);
1897
+ function s(d) {
1898
+ return d.spans.closeTag !== null ? d.spans.closeTag.end : Math.max(d.spans.openTag.end, d.spans.inner.end);
1296
1899
  }
1297
- function m() {
1298
- for (; Ct(e[t]); ) t++;
1900
+ function i(d) {
1901
+ return d.includes('"') ? d.includes("'") ? `"${d.replace(/"/g, "&quot;")}"` : `'${d}'` : `"${d}"`;
1299
1902
  }
1300
- function g() {
1301
- for (; ; ) {
1302
- const a = e.indexOf("<", t);
1303
- if (a < 0) {
1304
- t = e.length;
1305
- return;
1306
- }
1307
- const d = e[a + 1];
1308
- if (d === "!") {
1309
- if (e.startsWith("<!--", a)) {
1310
- const o = e.indexOf("-->", a + 4);
1311
- t = o < 0 ? e.length : o + 3;
1312
- } else if (e.startsWith("<![CDATA[", a)) {
1313
- const o = e.indexOf("]]>", a + 9);
1314
- t = o < 0 ? e.length : o + 3;
1315
- } else {
1316
- const o = e.indexOf(">", a);
1317
- t = o < 0 ? e.length : o + 1;
1318
- }
1319
- continue;
1320
- }
1321
- if (d === "?") {
1322
- const o = e.indexOf("?>", a + 2);
1323
- t = o < 0 ? e.length : o + 2;
1324
- continue;
1325
- }
1326
- t = a;
1327
- return;
1328
- }
1329
- }
1330
- function v() {
1331
- const a = t;
1332
- for (; we(e[t]); ) t++;
1333
- const d = e.slice(a, t), o = d.indexOf(":");
1334
- return o < 0 ? { prefix: null, local: d } : { prefix: d.slice(0, o), local: d.slice(o + 1) };
1335
- }
1336
- function u() {
1337
- const a = t;
1338
- for (; we(e[t]); ) t++;
1339
- if (t === a) return null;
1340
- const d = e.slice(a, t), o = t;
1341
- if (m(), e[t] !== "=")
1342
- return t = o, s(`attribute "${d}" has no value`, a, o), { name: d, value: "", span: { start: a, end: o } };
1343
- t++, m();
1344
- const f = e[t];
1345
- if (f !== '"' && f !== "'")
1346
- return s(`attribute "${d}" has an unquoted value`, a, t), { name: d, value: "", span: { start: a, end: t } };
1347
- t++;
1348
- const w = t, c = e.indexOf(f, t);
1349
- return c < 0 ? (s(`attribute "${d}" has an unterminated value`, a, e.length), t = e.length, { name: d, value: e.slice(w), span: { start: a, end: t } }) : (t = c + 1, { name: d, value: e.slice(w, c), span: { start: a, end: t } });
1903
+ function r(d) {
1904
+ const o = d.attributes.map((f) => ` ${f.name}=${i(f.value)}`).join(""), a = Ce(d.name);
1905
+ return d.spans.closeTag === null ? `<${a}${o} />` : `<${a}${o}>`;
1350
1906
  }
1351
- function r() {
1352
- const a = t;
1353
- t++;
1354
- const d = v(), o = [];
1355
- let f = !1;
1356
- for (; ; ) {
1357
- m();
1358
- const y = e[t];
1359
- if (y === void 0) {
1360
- s("unterminated open tag", a, e.length);
1361
- break;
1362
- }
1363
- if (y === ">") {
1364
- t++;
1365
- break;
1366
- }
1367
- if (y === "/" && e[t + 1] === ">") {
1368
- t += 2, f = !0;
1369
- break;
1370
- }
1371
- const b = u();
1372
- if (b === null) {
1373
- t++;
1374
- continue;
1375
- }
1376
- o.push(b);
1377
- }
1378
- const w = { start: a, end: t };
1379
- if (f)
1380
- return {
1381
- id: l(),
1382
- name: d,
1383
- attributes: o,
1384
- children: [],
1385
- spans: { openTag: w, inner: { start: t, end: t }, closeTag: null },
1386
- tagDirty: !1,
1387
- childrenDirty: !1
1388
- };
1389
- const c = t, S = [];
1390
- for (; ; ) {
1391
- if (g(), t >= e.length) {
1392
- s(`unterminated element <${Ae(d)}>`, a, e.length);
1393
- break;
1394
- }
1395
- const y = e[t + 1];
1396
- if (y === "/") break;
1397
- if (!be(y)) {
1398
- t++;
1399
- continue;
1400
- }
1401
- S.push(r());
1402
- }
1403
- const h = t;
1404
- let x = null;
1405
- if (e.startsWith("</", t)) {
1406
- const y = e.indexOf(">", t), b = y < 0 ? e.length : y + 1;
1407
- y < 0 && s("unterminated end tag", t, b), x = { start: t, end: b }, t = b;
1907
+ function u(d) {
1908
+ var l, h;
1909
+ const o = t(d.spans.inner), a = ((l = /^[ \t]*\r?\n[ \t]*/.exec(o)) == null ? void 0 : l[0]) ?? "", f = ((h = /\r?\n[ \t]*$/.exec(o)) == null ? void 0 : h[0]) ?? "";
1910
+ return { between: a, before: a, after: f };
1911
+ }
1912
+ function c(d) {
1913
+ const { inner: o } = d.spans;
1914
+ if (d.children.length === 0) return t(o);
1915
+ if (d.childrenDirty) {
1916
+ const { between: l, before: h, after: g } = u(d);
1917
+ return h + d.children.map(v).join(l) + g;
1408
1918
  }
1409
- return {
1410
- id: l(),
1411
- name: d,
1412
- attributes: o,
1413
- children: S,
1414
- spans: { openTag: w, inner: { start: c, end: h }, closeTag: x },
1415
- tagDirty: !1,
1416
- childrenDirty: !1
1417
- };
1919
+ let a = "", f = o.start;
1920
+ for (const l of d.children)
1921
+ a += e.slice(f, l.spans.openTag.start), a += v(l), f = s(l);
1922
+ return a + e.slice(f, o.end);
1418
1923
  }
1419
- return g(), t < e.length && be(e[t + 1]) ? { root: r(), warnings: n } : (s("no root element", 0, 0), {
1420
- root: {
1421
- id: l(),
1422
- name: { prefix: null, local: "" },
1423
- attributes: [],
1424
- children: [],
1425
- spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
1426
- tagDirty: !1,
1427
- childrenDirty: !1
1428
- },
1429
- warnings: n
1430
- });
1431
- }
1432
- function Ae(e) {
1433
- return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
1924
+ function v(d) {
1925
+ const o = d.tagDirty ? r(d) : t(d.spans.openTag), a = d.spans.closeTag === null ? "" : t(d.spans.closeTag);
1926
+ return o + c(d) + a;
1927
+ }
1928
+ return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(s(n));
1434
1929
  }
1435
- function It(e, n) {
1436
- const t = (u) => e.slice(u.start, u.end);
1437
- function i(u) {
1438
- return u.spans.closeTag !== null ? u.spans.closeTag.end : Math.max(u.spans.openTag.end, u.spans.inner.end);
1439
- }
1440
- function l(u) {
1441
- return u.includes('"') ? u.includes("'") ? `"${u.replace(/"/g, "&quot;")}"` : `'${u}'` : `"${u}"`;
1442
- }
1443
- function s(u) {
1444
- const r = u.attributes.map((d) => ` ${d.name}=${l(d.value)}`).join(""), a = Ae(u.name);
1445
- return u.spans.closeTag === null ? `<${a}${r} />` : `<${a}${r}>`;
1446
- }
1447
- function m(u) {
1448
- var o, f;
1449
- const r = t(u.spans.inner), a = ((o = /^[ \t]*\r?\n[ \t]*/.exec(r)) == null ? void 0 : o[0]) ?? "", d = ((f = /\r?\n[ \t]*$/.exec(r)) == null ? void 0 : f[0]) ?? "";
1450
- return { between: a, before: a, after: d };
1451
- }
1452
- function g(u) {
1453
- const { inner: r } = u.spans;
1454
- if (u.children.length === 0) return t(r);
1455
- if (u.childrenDirty) {
1456
- const { between: o, before: f, after: w } = m(u);
1457
- return f + u.children.map(v).join(o) + w;
1458
- }
1459
- let a = "", d = r.start;
1460
- for (const o of u.children)
1461
- a += e.slice(d, o.spans.openTag.start), a += v(o), d = i(o);
1462
- return a + e.slice(d, r.end);
1463
- }
1464
- function v(u) {
1465
- const r = u.tagDirty ? s(u) : t(u.spans.openTag), a = u.spans.closeTag === null ? "" : t(u.spans.closeTag);
1466
- return r + g(u) + a;
1467
- }
1468
- return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(i(n));
1469
- }
1470
- function Mt(e) {
1471
- const n = e.source, t = (r) => n.slice(r.start, r.end);
1472
- function i(r) {
1473
- return r.parts.map((a, d) => {
1474
- const o = d === 0 ? "" : a.combinator === "child" ? " > " : " ", f = a.simple.map((w) => {
1475
- switch (w.kind) {
1930
+ function gn(e) {
1931
+ const n = e.source, t = (o) => n.slice(o.start, o.end);
1932
+ function s(o) {
1933
+ return o.parts.map((a, f) => {
1934
+ const l = f === 0 ? "" : a.combinator === "child" ? " > " : " ", h = a.simple.map((g) => {
1935
+ switch (g.kind) {
1476
1936
  case "universal":
1477
1937
  return "*";
1478
1938
  case "type":
1479
- return w.name;
1939
+ return g.name;
1480
1940
  case "class":
1481
- return `.${w.name}`;
1941
+ return `.${g.name}`;
1482
1942
  case "name":
1483
- return `#${w.name}`;
1943
+ return `#${g.name}`;
1484
1944
  case "pseudo":
1485
- return `:${w.name}`;
1945
+ return `:${g.name}`;
1486
1946
  case "unknown":
1487
- return w.text;
1947
+ return g.text;
1488
1948
  }
1489
1949
  }).join("");
1490
- return o + f;
1950
+ return l + h;
1491
1951
  }).join("");
1492
1952
  }
1493
- function l(r) {
1494
- var c, S;
1495
- const a = r.declarations[0];
1953
+ function i(o) {
1954
+ var p, b;
1955
+ const a = o.declarations[0];
1496
1956
  if (a === void 0) return { between: "", before: "", after: "" };
1497
- const d = n.lastIndexOf(`
1498
- `, a.span.start), o = d < 0 ? "" : n.slice(d, a.span.start), f = n.slice(r.selectorSpan.end, r.span.end), w = ((S = (c = /\r?\n[ \t]*\}$/.exec(f)) == null ? void 0 : c[0]) == null ? void 0 : S.replace(/\}$/, "")) ?? "";
1499
- return { between: `;${o}`, before: o, after: `;${w}` };
1500
- }
1501
- function s(r) {
1502
- const a = r.selectorDirty ? r.selectors.map(i).join(", ") : t(r.selectorSpan);
1503
- if (r.declarations.length === 0)
1504
- return a + n.slice(r.selectorSpan.end, r.span.end);
1505
- const d = n.slice(r.selectorSpan.end, r.declarations[0].span.start);
1506
- if (r.declarationsDirty) {
1507
- const { between: w, before: c, after: S } = l(r), h = d.slice(0, d.indexOf("{") + 1), x = r.declarations.map(m).join(w);
1508
- return `${a}${h}${c}${x}${S}}`;
1957
+ const f = n.lastIndexOf(`
1958
+ `, a.span.start), l = f < 0 ? "" : n.slice(f, a.span.start), h = n.slice(o.selectorSpan.end, o.span.end), g = ((b = (p = /\r?\n[ \t]*\}$/.exec(h)) == null ? void 0 : p[0]) == null ? void 0 : b.replace(/\}$/, "")) ?? "";
1959
+ return { between: `;${l}`, before: l, after: `;${g}` };
1960
+ }
1961
+ function r(o) {
1962
+ const a = o.selectorDirty ? o.selectors.map(s).join(", ") : t(o.selectorSpan);
1963
+ if (o.declarations.length === 0)
1964
+ return a + n.slice(o.selectorSpan.end, o.span.end);
1965
+ const f = n.slice(o.selectorSpan.end, o.declarations[0].span.start);
1966
+ if (o.declarationsDirty) {
1967
+ const { between: g, before: p, after: b } = i(o), m = f.slice(0, f.indexOf("{") + 1), y = o.declarations.map(u).join(g);
1968
+ return `${a}${m}${p}${y}${b}}`;
1509
1969
  }
1510
- let o = a, f = r.selectorSpan.end;
1511
- for (const w of r.declarations)
1512
- o += n.slice(f, w.span.start), o += m(w), f = w.span.end;
1513
- return o + n.slice(f, r.span.end);
1970
+ let l = a, h = o.selectorSpan.end;
1971
+ for (const g of o.declarations)
1972
+ l += n.slice(h, g.span.start), l += u(g), h = g.span.end;
1973
+ return l + n.slice(h, o.span.end);
1514
1974
  }
1515
- function m(r) {
1516
- return r.dirty ? `${r.property}: ${r.value}` : t(r.span);
1975
+ function u(o) {
1976
+ return o.dirty ? `${o.property}: ${o.value}` : t(o.span);
1517
1977
  }
1518
- function g(r) {
1519
- return r.kind === "rule" ? s(r.rule) : t(r.span);
1978
+ function c(o) {
1979
+ return o.kind === "rule" ? r(o.rule) : t(o.span);
1520
1980
  }
1521
- let v = "", u = 0;
1522
- for (const r of e.items) {
1523
- const a = r.kind === "rule" ? r.rule.span : r.span;
1524
- v += n.slice(u, a.start), v += g(r), u = a.end;
1981
+ let v = "", d = 0;
1982
+ for (const o of e.items) {
1983
+ const a = o.kind === "rule" ? o.rule.span : o.span;
1984
+ v += n.slice(d, a.start), v += c(o), d = a.end;
1525
1985
  }
1526
- return v + n.slice(u);
1986
+ return v + n.slice(d);
1527
1987
  }
1528
- function Ie(e, n = []) {
1988
+ ot(
1989
+ (e, n) => n === void 0 ? Ie(e) : Ie(e, void 0, { resolveImport: n })
1990
+ );
1991
+ function et(e, n = []) {
1529
1992
  var t;
1530
- if (e.name.local === "Style") {
1531
- const i = (t = e.attributes.find((l) => l.name === "src")) == null ? void 0 : t.value;
1532
- i !== void 0 && i.length > 0 && n.push(ye(i));
1993
+ for (const s of e.children) {
1994
+ if (s.name.local === "Style") {
1995
+ const i = (t = s.attributes.find((r) => r.name === "src")) == null ? void 0 : t.value;
1996
+ i !== void 0 && i.length > 0 && n.push({ url: J(i), scope: e.id });
1997
+ }
1998
+ et(s, n);
1533
1999
  }
1534
- for (const i of e.children) Ie(i, n);
1535
2000
  return n;
1536
2001
  }
1537
- function jt(e, n, t) {
1538
- var g, v;
1539
- const i = At(e), l = [...i.warnings], s = [], m = [];
1540
- for (const u of Ie(i.root)) {
1541
- const r = ((g = t == null ? void 0 : t.resolveImport) == null ? void 0 : g.call(t, u)) ?? null;
1542
- if (r === null) {
1543
- l.push({
2002
+ function wn(e) {
2003
+ return e.startsWith("project://") || e.startsWith("/");
2004
+ }
2005
+ function Ie(e, n, t) {
2006
+ var d, o;
2007
+ const s = Re(e), i = [...s.warnings], r = [], u = [], c = [];
2008
+ for (const { url: a, scope: f } of et(s.root)) {
2009
+ const l = ((d = t == null ? void 0 : t.resolveImport) == null ? void 0 : d.call(t, a, null)) ?? null;
2010
+ if (l === null) {
2011
+ i.push({
1544
2012
  kind: "import-unresolved",
1545
- message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${u}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${u}"> could not be resolved`,
1546
- node: i.root.id
2013
+ message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${a}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${a}"> could not be resolved`,
2014
+ node: s.root.id
1547
2015
  });
1548
2016
  continue;
1549
2017
  }
1550
- m.push({ text: r, origin: u });
1551
- }
1552
- if (n !== void 0 || m.length > 0) {
1553
- const u = /* @__PURE__ */ new Set(), r = [
1554
- ...m,
1555
- ...n === void 0 ? [] : [{ text: n, origin: null }]
1556
- ];
1557
- for (; r.length > 0; ) {
1558
- const a = r.shift(), d = s.length, o = re(a.text, a.origin, d);
1559
- s.push(o.sheet), l.push(...o.warnings);
1560
- for (const f of o.sheet.items) {
1561
- if (f.kind !== "import" || u.has(f.url)) continue;
1562
- u.add(f.url);
1563
- const w = ((v = t == null ? void 0 : t.resolveImport) == null ? void 0 : v.call(t, f.url)) ?? null;
1564
- if (w === null) {
1565
- l.push({
2018
+ c.push({ text: l, origin: a, scope: f });
2019
+ }
2020
+ if (n !== void 0 || c.length > 0) {
2021
+ const a = /* @__PURE__ */ new Map(), f = [];
2022
+ let l = 0;
2023
+ for (const h of c) {
2024
+ const g = l++;
2025
+ f.push({ text: h.text, origin: h.origin, sheet: g }), u.push({ sheet: g, scope: h.scope });
2026
+ }
2027
+ if (n !== void 0) {
2028
+ const h = l++;
2029
+ f.push({ text: n, origin: null, sheet: h }), u.push({ sheet: h, scope: s.root.id });
2030
+ }
2031
+ for (; f.length > 0; ) {
2032
+ const h = f.shift(), g = h.sheet, p = ge(h.text, h.origin, g);
2033
+ r.push(p.sheet), i.push(...p.warnings);
2034
+ for (const b of p.sheet.items) {
2035
+ if (b.kind !== "import") continue;
2036
+ const m = wn(b.url) ? b.url : JSON.stringify([b.url, h.origin]);
2037
+ if (a.has(m)) {
2038
+ const x = a.get(m);
2039
+ x != null && (b.resolvedSheet = x);
2040
+ continue;
2041
+ }
2042
+ a.set(m, null);
2043
+ const y = ((o = t == null ? void 0 : t.resolveImport) == null ? void 0 : o.call(t, b.url, h.origin)) ?? null;
2044
+ if (y === null) {
2045
+ i.push({
1566
2046
  kind: "import-unresolved",
1567
- message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${f.url}" was not loaded: pass resolveImport to read it` : `@import "${f.url}" could not be resolved`,
1568
- at: { in: "uss", sheet: d, span: f.span }
2047
+ message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${b.url}" was not loaded: pass resolveImport to read it` : `@import "${b.url}" could not be resolved`,
2048
+ at: { in: "uss", sheet: g, span: b.span }
1569
2049
  });
1570
2050
  continue;
1571
2051
  }
1572
- r.push({ text: w, origin: f.url });
2052
+ const k = l++;
2053
+ a.set(m, k), b.resolvedSheet = k, f.push({ text: y, origin: b.url, sheet: k });
1573
2054
  }
1574
2055
  }
1575
2056
  }
1576
- return { source: e, root: i.root, sheets: s, warnings: l };
2057
+ const v = { source: e, root: s.root, sheets: r, styleRoots: u, warnings: i };
2058
+ return lt(v, t == null ? void 0 : t.resolveImport), v;
1577
2059
  }
1578
- function Wt(e) {
2060
+ function Tn(e) {
1579
2061
  const n = e.sheets[0];
1580
2062
  return {
1581
- uxml: It(e.source, e.root),
2063
+ uxml: mn(e.source, e.root),
1582
2064
  // Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
1583
2065
  // are separate files and are not this function's to write.
1584
- uss: n === void 0 ? "" : Mt(n)
2066
+ uss: n === void 0 ? "" : gn(n)
1585
2067
  };
1586
2068
  }
1587
- function Bt(e, n, t) {
1588
- const i = n.ownerDocument, l = (t == null ? void 0 : t.size) ?? {
2069
+ function On(e, n, t) {
2070
+ const s = n.ownerDocument, i = (t == null ? void 0 : t.size) ?? {
1589
2071
  width: n.clientWidth,
1590
2072
  height: n.clientHeight
1591
- }, s = Nt(e, {
2073
+ }, r = bt(e), u = r.document, c = hn(u, {
1592
2074
  ...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
1593
2075
  ...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
1594
- }), m = (t == null ? void 0 : t.measureText) ?? nt(i), g = et(e.root, s.styles, s.partStyles, { size: l, measureText: m });
1595
- let v;
2076
+ }), v = (t == null ? void 0 : t.measureText) ?? jt(s), d = zt(u.root, c.styles, c.partStyles, {
2077
+ size: i,
2078
+ measureText: v
2079
+ });
2080
+ let o;
1596
2081
  try {
1597
- v = ft(e.root, g.boxes, g.parts, s.styles, n, {
1598
- document: i,
2082
+ o = Yt(u.root, d.boxes, d.parts, c.styles, n, {
2083
+ document: s,
1599
2084
  resolveAsset: t == null ? void 0 : t.resolveAsset
1600
2085
  });
1601
- } catch (r) {
1602
- throw g.dispose(), r;
2086
+ } catch (f) {
2087
+ throw d.dispose(), f;
1603
2088
  }
1604
- let u = !1;
2089
+ let a = !1;
1605
2090
  return {
1606
- warnings: [...s.warnings, ...g.warnings, ...v.warnings],
1607
- elements: v.elements,
1608
- boxes: g.boxes,
2091
+ warnings: [...r.warnings, ...c.warnings, ...d.warnings, ...o.warnings],
2092
+ elements: o.elements,
2093
+ boxes: d.boxes,
1609
2094
  dispose() {
1610
- u || (u = !0, g.dispose(), n.replaceChildren());
2095
+ a || (a = !0, d.dispose(), n.replaceChildren());
1611
2096
  }
1612
2097
  };
1613
2098
  }
1614
2099
  export {
1615
- _t as KNOWN_DIVERGENCES,
1616
- ct as NODE_ATTRIBUTE,
1617
- ut as PART_ATTRIBUTE,
1618
- dt as PART_OWNER_ATTRIBUTE,
1619
- nt as createDefaultMeasureText,
1620
- zt as explainProperty,
1621
- He as isInherited,
1622
- Dt as isLayoutEngineReady,
1623
- Lt as liveNodeCount,
1624
- Ut as loadLayoutEngine,
1625
- jt as parse,
1626
- Bt as render,
1627
- Nt as resolveStyles,
1628
- Wt as serialize,
1629
- Be as supportedControlNames
2100
+ $n as KNOWN_DIVERGENCES,
2101
+ Gt as NODE_ATTRIBUTE,
2102
+ Jt as PART_ATTRIBUTE,
2103
+ Xt as PART_OWNER_ATTRIBUTE,
2104
+ bn as collectDependencies,
2105
+ jt as createDefaultMeasureText,
2106
+ bt as expandTemplates,
2107
+ Sn as explainProperty,
2108
+ Dt as isInherited,
2109
+ xn as isLayoutEngineReady,
2110
+ kn as liveNodeCount,
2111
+ yn as loadLayoutEngine,
2112
+ Ie as parse,
2113
+ On as render,
2114
+ hn as resolveStyles,
2115
+ Tn as serialize,
2116
+ Tt as supportedControlNames
1630
2117
  };