uxml-preview 0.5.1 → 0.6.0

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