uxml-preview 0.4.0 → 0.5.1

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