@csszyx/runtime 0.9.10 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { transform as transform$1 } from '@csszyx/compiler/browser';
1
+ import { MAX_SZ_DEPTH, SzDepthError, transform as transform$1, isForbiddenSzKey } from '@csszyx/compiler/browser';
2
2
  export { __szColorVar } from '@csszyx/compiler/color-var';
3
3
 
4
4
  function verifyRecoveryToken(element, manifest) {
@@ -92,6 +92,25 @@ function disableCSRRecovery() {
92
92
  function isCSRRecoveryAllowed() {
93
93
  return state.recoveryAllowed;
94
94
  }
95
+ const MAX_MANGLE_MAP_ENTRIES = 1e5;
96
+ function isValidMangleMap(value) {
97
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
98
+ return false;
99
+ }
100
+ const entries = Object.entries(value);
101
+ if (entries.length > MAX_MANGLE_MAP_ENTRIES) {
102
+ return false;
103
+ }
104
+ for (const [key, val] of entries) {
105
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
106
+ return false;
107
+ }
108
+ if (typeof key !== "string" || typeof val !== "string") {
109
+ return false;
110
+ }
111
+ }
112
+ return true;
113
+ }
95
114
  function loadMangleMapFromDOM() {
96
115
  if (typeof document === "undefined") {
97
116
  return null;
@@ -102,7 +121,14 @@ function loadMangleMapFromDOM() {
102
121
  }
103
122
  try {
104
123
  const content = scriptElement.textContent || "";
105
- return JSON.parse(content);
124
+ const parsed = JSON.parse(content);
125
+ if (!isValidMangleMap(parsed)) {
126
+ console.error(
127
+ "[csszyx] Mangle map failed schema validation (not a plain string\u2192string map); ignoring it."
128
+ );
129
+ return null;
130
+ }
131
+ return parsed;
106
132
  } catch (error) {
107
133
  console.error("Failed to parse mangle map:", error);
108
134
  return null;
@@ -116,6 +142,24 @@ function verifyMangleChecksum(expectedChecksum) {
116
142
  const actualChecksum = htmlElement.getAttribute("data-sz-checksum");
117
143
  return actualChecksum === expectedChecksum;
118
144
  }
145
+ async function computeMangleChecksumAsync(map) {
146
+ const canonical = Object.keys(map).sort().map((key) => `${key}:${map[key]}`).join("|");
147
+ const bytes = new TextEncoder().encode(canonical);
148
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
149
+ let hex = "";
150
+ for (const b of new Uint8Array(digest)) {
151
+ hex += b.toString(16).padStart(2, "0");
152
+ }
153
+ return hex.slice(0, 16);
154
+ }
155
+ async function verifyMangleChecksumAsync(expectedChecksum, map) {
156
+ const target = map ?? loadMangleMapFromDOM();
157
+ if (!target) {
158
+ return false;
159
+ }
160
+ const actual = await computeMangleChecksumAsync(target);
161
+ return actual === expectedChecksum;
162
+ }
119
163
  function verifyMangleMapIntegrity() {
120
164
  if (typeof document === "undefined") {
121
165
  return false;
@@ -132,12 +176,23 @@ function verifyMangleMapIntegrity() {
132
176
  return false;
133
177
  }
134
178
  try {
135
- const mangleMap = JSON.parse(scriptElement.textContent || "{}");
179
+ const parsed = JSON.parse(scriptElement.textContent || "{}");
180
+ if (!isValidMangleMap(parsed)) {
181
+ console.error(
182
+ "[csszyx] Mangle map failed schema validation; treating integrity as invalid."
183
+ );
184
+ return false;
185
+ }
186
+ const mangleMap = parsed;
136
187
  if (typeof window !== "undefined" && "verify_mangle_checksum" in window) {
137
188
  const isValid = window.verify_mangle_checksum(mangleMap, checksum);
138
189
  return isValid;
139
190
  }
140
- console.warn("[csszyx] Rust core not available, using fallback verification");
191
+ if (process.env.NODE_ENV !== "production") {
192
+ console.warn(
193
+ "[csszyx] WASM core not loaded \u2014 mangle map checksum is unverified (schema-validated only). This is detection, not authentication."
194
+ );
195
+ }
141
196
  return true;
142
197
  } catch (error) {
143
198
  console.error("[csszyx] Failed to verify mangle map:", error);
@@ -275,6 +330,12 @@ function transform(szProp) {
275
330
  return res;
276
331
  }
277
332
  function _sz(...classes) {
333
+ return szJoin(classes, 0);
334
+ }
335
+ function szJoin(classes, depth) {
336
+ if (depth >= MAX_SZ_DEPTH) {
337
+ throw new SzDepthError();
338
+ }
278
339
  if (classes.length === 1) {
279
340
  const cls = classes[0];
280
341
  if (typeof cls === "string") {
@@ -284,7 +345,7 @@ function _sz(...classes) {
284
345
  return "";
285
346
  }
286
347
  if (Array.isArray(cls)) {
287
- return _sz(...cls);
348
+ return szJoin(cls, depth + 1);
288
349
  }
289
350
  const res = transform(cls);
290
351
  return typeof res === "string" ? res : res.className;
@@ -297,7 +358,7 @@ function _sz(...classes) {
297
358
  continue;
298
359
  }
299
360
  if (Array.isArray(cls)) {
300
- const str2 = _sz(...cls);
361
+ const str2 = szJoin(cls, depth + 1);
301
362
  if (!str2) {
302
363
  continue;
303
364
  }
@@ -321,50 +382,13 @@ function _sz(...classes) {
321
382
  }
322
383
  return result;
323
384
  }
324
- function _szIf(condition, truthyValue, falsyValue) {
325
- const value = condition ? truthyValue : falsyValue;
326
- if (!value) {
327
- return "";
328
- }
329
- if (typeof value === "string") {
330
- return value;
331
- }
332
- if (Array.isArray(value)) {
333
- return _sz(...value);
334
- }
335
- const res = transform(value);
336
- return typeof res === "string" ? res : res.className;
385
+ function _szMerge(...classes) {
386
+ return szMergeJoin(classes, 0);
337
387
  }
338
- function _szSwitch(conditions, defaultValue = "") {
339
- for (let i = 0; i < conditions.length; i++) {
340
- const [condition, value] = conditions[i];
341
- if (condition) {
342
- if (!value) {
343
- return "";
344
- }
345
- if (typeof value === "string") {
346
- return value;
347
- }
348
- if (Array.isArray(value)) {
349
- return _sz(...value);
350
- }
351
- const res2 = transform(value);
352
- return typeof res2 === "string" ? res2 : res2.className;
353
- }
354
- }
355
- if (!defaultValue) {
356
- return "";
388
+ function szMergeJoin(classes, depth) {
389
+ if (depth >= MAX_SZ_DEPTH) {
390
+ throw new SzDepthError();
357
391
  }
358
- if (typeof defaultValue === "string") {
359
- return defaultValue;
360
- }
361
- if (Array.isArray(defaultValue)) {
362
- return _sz(...defaultValue);
363
- }
364
- const res = transform(defaultValue);
365
- return typeof res === "string" ? res : res.className;
366
- }
367
- function _szMerge(...classes) {
368
392
  const seen = /* @__PURE__ */ new Set();
369
393
  const result = [];
370
394
  for (let i = 0; i < classes.length; i++) {
@@ -373,7 +397,7 @@ function _szMerge(...classes) {
373
397
  continue;
374
398
  }
375
399
  if (Array.isArray(cls)) {
376
- const str2 = _szMerge(...cls);
400
+ const str2 = szMergeJoin(cls, depth + 1);
377
401
  if (!str2) {
378
402
  continue;
379
403
  }
@@ -435,13 +459,891 @@ function _sz3(a, b, c) {
435
459
  return result;
436
460
  }
437
461
 
438
- function deepMerge(target, source) {
462
+ const BOX_ROLE_TOKENS = /* @__PURE__ */ new Map([
463
+ ["absolute", { role: "outer", category: "position" }],
464
+ ["antialiased", { role: "inner", category: "text" }],
465
+ ["block", { role: "inner", category: "display" }],
466
+ ["capitalize", { role: "inner", category: "text" }],
467
+ ["collapse", { role: "outer", category: "visibility" }],
468
+ ["container", { role: "outer", category: "sizing" }],
469
+ ["contents", { role: "inner", category: "display" }],
470
+ ["diagonal-fractions", { role: "inner", category: "text" }],
471
+ ["divide-x-reverse", { role: "outer", category: "divide" }],
472
+ ["divide-y-reverse", { role: "outer", category: "divide" }],
473
+ ["fixed", { role: "outer", category: "position" }],
474
+ ["flex", { role: "inner", category: "display" }],
475
+ ["flow-root", { role: "inner", category: "display" }],
476
+ ["grid", { role: "inner", category: "display" }],
477
+ ["hidden", { role: "inner", category: "display" }],
478
+ ["inline", { role: "inner", category: "display" }],
479
+ ["inline-block", { role: "inner", category: "display" }],
480
+ ["inline-flex", { role: "inner", category: "display" }],
481
+ ["inline-grid", { role: "inner", category: "display" }],
482
+ ["invisible", { role: "outer", category: "visibility" }],
483
+ ["isolate", { role: "outer", category: "position" }],
484
+ ["italic", { role: "inner", category: "text" }],
485
+ ["line-through", { role: "inner", category: "text" }],
486
+ ["lining-nums", { role: "inner", category: "text" }],
487
+ ["list-item", { role: "inner", category: "display" }],
488
+ ["lowercase", { role: "inner", category: "text" }],
489
+ ["no-underline", { role: "inner", category: "text" }],
490
+ ["normal-case", { role: "inner", category: "text" }],
491
+ ["not-italic", { role: "inner", category: "text" }],
492
+ ["not-sr-only", { role: "outer", category: "visibility" }],
493
+ ["oldstyle-nums", { role: "inner", category: "text" }],
494
+ ["ordinal", { role: "inner", category: "text" }],
495
+ ["overline", { role: "inner", category: "text" }],
496
+ ["proportional-nums", { role: "inner", category: "text" }],
497
+ ["prose", { role: "inner", category: "text" }],
498
+ ["prose-invert", { role: "inner", category: "text" }],
499
+ ["relative", { role: "outer", category: "position" }],
500
+ ["slashed-zero", { role: "inner", category: "text" }],
501
+ ["space-x-reverse", { role: "inner", category: "space" }],
502
+ ["space-y-reverse", { role: "inner", category: "space" }],
503
+ ["sr-only", { role: "outer", category: "visibility" }],
504
+ ["stacked-fractions", { role: "inner", category: "text" }],
505
+ ["static", { role: "outer", category: "position" }],
506
+ ["sticky", { role: "outer", category: "position" }],
507
+ ["subpixel-antialiased", { role: "inner", category: "text" }],
508
+ ["table", { role: "inner", category: "display" }],
509
+ ["table-cell", { role: "inner", category: "display" }],
510
+ ["table-row", { role: "inner", category: "display" }],
511
+ ["tabular-nums", { role: "inner", category: "text" }],
512
+ ["truncate", { role: "inner", category: "text" }],
513
+ ["underline", { role: "inner", category: "text" }],
514
+ ["uppercase", { role: "inner", category: "text" }],
515
+ ["visible", { role: "outer", category: "visibility" }]
516
+ ]);
517
+ const BOX_ROLE_PREFIXES = [
518
+ ["backdrop-brightness", { role: "outer", category: "backdrop" }],
519
+ ["backdrop-hue-rotate", { role: "outer", category: "backdrop" }],
520
+ ["forced-color-adjust", { role: "outer", category: "color-scheme" }],
521
+ ["backdrop-grayscale", { role: "outer", category: "backdrop" }],
522
+ ["perspective-origin", { role: "outer", category: "transform" }],
523
+ ["backdrop-contrast", { role: "outer", category: "backdrop" }],
524
+ ["backdrop-saturate", { role: "outer", category: "backdrop" }],
525
+ ["backdrop-opacity", { role: "outer", category: "backdrop" }],
526
+ ["border-spacing-x", { role: "outer", category: "border" }],
527
+ ["border-spacing-y", { role: "outer", category: "border" }],
528
+ ["scrollbar-gutter", { role: "inner", category: "scroll" }],
529
+ ["underline-offset", { role: "inner", category: "text" }],
530
+ ["animation-delay", { role: "outer", category: "transition" }],
531
+ ["backdrop-filter", { role: "outer", category: "backdrop" }],
532
+ ["backdrop-invert", { role: "outer", category: "backdrop" }],
533
+ ["scrollbar-thumb", { role: "inner", category: "scroll" }],
534
+ ["scrollbar-track", { role: "inner", category: "scroll" }],
535
+ ["backdrop-sepia", { role: "outer", category: "backdrop" }],
536
+ ["border-spacing", { role: "outer", category: "border" }],
537
+ ["box-decoration", { role: "outer", category: "fragmentation" }],
538
+ ["font-smoothing", { role: "inner", category: "text" }],
539
+ ["outline-offset", { role: "outer", category: "outline" }],
540
+ ["pointer-events", { role: "inner", category: "interaction" }],
541
+ ["backdrop-blur", { role: "outer", category: "backdrop" }],
542
+ ["font-features", { role: "inner", category: "text" }],
543
+ ["justify-items", { role: "inner", category: "alignment" }],
544
+ ["mask-position", { role: "outer", category: "mask" }],
545
+ ["place-content", { role: "inner", category: "alignment" }],
546
+ ["break-before", { role: "outer", category: "fragmentation" }],
547
+ ["break-inside", { role: "outer", category: "fragmentation" }],
548
+ ["field-sizing", { role: "inner", category: "interaction" }],
549
+ ["font-stretch", { role: "inner", category: "text" }],
550
+ ["inset-shadow", { role: "inner", category: "shadow" }],
551
+ ["justify-self", { role: "inner", category: "alignment" }],
552
+ ["overscroll-x", { role: "inner", category: "overscroll" }],
553
+ ["overscroll-y", { role: "inner", category: "overscroll" }],
554
+ ["break-after", { role: "outer", category: "fragmentation" }],
555
+ ["drop-shadow", { role: "outer", category: "filter" }],
556
+ ["mask-origin", { role: "outer", category: "mask" }],
557
+ ["mask-repeat", { role: "outer", category: "mask" }],
558
+ ["perspective", { role: "outer", category: "transform" }],
559
+ ["place-items", { role: "inner", category: "alignment" }],
560
+ ["ring-offset", { role: "outer", category: "ring" }],
561
+ ["text-shadow", { role: "inner", category: "text" }],
562
+ ["translate-x", { role: "outer", category: "transform" }],
563
+ ["translate-y", { role: "outer", category: "transform" }],
564
+ ["translate-z", { role: "outer", category: "transform" }],
565
+ ["will-change", { role: "inner", category: "interaction" }],
566
+ ["appearance", { role: "inner", category: "interaction" }],
567
+ ["brightness", { role: "outer", category: "filter" }],
568
+ ["decoration", { role: "inner", category: "text" }],
569
+ ["font-style", { role: "inner", category: "text" }],
570
+ ["hue-rotate", { role: "outer", category: "filter" }],
571
+ ["inset-ring", { role: "inner", category: "ring" }],
572
+ ["line-clamp", { role: "inner", category: "text" }],
573
+ ["list-image", { role: "inner", category: "list" }],
574
+ ["max-inline", { role: "outer", category: "sizing" }],
575
+ ["min-inline", { role: "outer", category: "sizing" }],
576
+ ["overflow-x", { role: "inner", category: "overflow" }],
577
+ ["overflow-y", { role: "inner", category: "overflow" }],
578
+ ["overscroll", { role: "inner", category: "overscroll" }],
579
+ ["place-self", { role: "inner", category: "alignment" }],
580
+ ["rounded-bl", { role: "outer", category: "rounded" }],
581
+ ["rounded-br", { role: "outer", category: "rounded" }],
582
+ ["rounded-ee", { role: "outer", category: "rounded" }],
583
+ ["rounded-es", { role: "outer", category: "rounded" }],
584
+ ["rounded-se", { role: "outer", category: "rounded" }],
585
+ ["rounded-ss", { role: "outer", category: "rounded" }],
586
+ ["rounded-tl", { role: "outer", category: "rounded" }],
587
+ ["rounded-tr", { role: "outer", category: "rounded" }],
588
+ ["scroll-mbe", { role: "inner", category: "scroll" }],
589
+ ["scroll-mbs", { role: "inner", category: "scroll" }],
590
+ ["scroll-pbe", { role: "inner", category: "scroll" }],
591
+ ["scroll-pbs", { role: "inner", category: "scroll" }],
592
+ ["transition", { role: "outer", category: "transition" }],
593
+ ["visibility", { role: "outer", category: "visibility" }],
594
+ ["whitespace", { role: "inner", category: "text" }],
595
+ ["auto-cols", { role: "inner", category: "grid" }],
596
+ ["auto-rows", { role: "inner", category: "grid" }],
597
+ ["bg-origin", { role: "outer", category: "bg" }],
598
+ ["border-be", { role: "outer", category: "border" }],
599
+ ["border-bs", { role: "outer", category: "border" }],
600
+ ["col-start", { role: "inner", category: "grid" }],
601
+ ["grayscale", { role: "outer", category: "filter" }],
602
+ ["grid-cols", { role: "inner", category: "grid" }],
603
+ ["grid-flow", { role: "inner", category: "grid" }],
604
+ ["grid-rows", { role: "inner", category: "grid" }],
605
+ ["isolation", { role: "outer", category: "position" }],
606
+ ["mask-clip", { role: "outer", category: "mask" }],
607
+ ["mask-from", { role: "outer", category: "mask" }],
608
+ ["mask-size", { role: "outer", category: "mask" }],
609
+ ["max-block", { role: "outer", category: "sizing" }],
610
+ ["min-block", { role: "outer", category: "sizing" }],
611
+ ["mix-blend", { role: "outer", category: "blend" }],
612
+ ["rounded-b", { role: "outer", category: "rounded" }],
613
+ ["rounded-e", { role: "outer", category: "rounded" }],
614
+ ["rounded-l", { role: "outer", category: "rounded" }],
615
+ ["rounded-r", { role: "outer", category: "rounded" }],
616
+ ["rounded-s", { role: "outer", category: "rounded" }],
617
+ ["rounded-t", { role: "outer", category: "rounded" }],
618
+ ["row-start", { role: "inner", category: "grid" }],
619
+ ["scroll-mb", { role: "inner", category: "scroll" }],
620
+ ["scroll-me", { role: "inner", category: "scroll" }],
621
+ ["scroll-ml", { role: "inner", category: "scroll" }],
622
+ ["scroll-mr", { role: "inner", category: "scroll" }],
623
+ ["scroll-ms", { role: "inner", category: "scroll" }],
624
+ ["scroll-mt", { role: "inner", category: "scroll" }],
625
+ ["scroll-mx", { role: "inner", category: "scroll" }],
626
+ ["scroll-my", { role: "inner", category: "scroll" }],
627
+ ["scroll-pb", { role: "inner", category: "scroll" }],
628
+ ["scroll-pe", { role: "inner", category: "scroll" }],
629
+ ["scroll-pl", { role: "inner", category: "scroll" }],
630
+ ["scroll-pr", { role: "inner", category: "scroll" }],
631
+ ["scroll-ps", { role: "inner", category: "scroll" }],
632
+ ["scroll-pt", { role: "inner", category: "scroll" }],
633
+ ["scroll-px", { role: "inner", category: "scroll" }],
634
+ ["scroll-py", { role: "inner", category: "scroll" }],
635
+ ["scrollbar", { role: "inner", category: "scroll" }],
636
+ ["transform", { role: "outer", category: "transform" }],
637
+ ["translate", { role: "outer", category: "transform" }],
638
+ ["backface", { role: "outer", category: "transform" }],
639
+ ["bg-blend", { role: "outer", category: "bg" }],
640
+ ["border-b", { role: "outer", category: "border" }],
641
+ ["border-e", { role: "outer", category: "border" }],
642
+ ["border-l", { role: "outer", category: "border" }],
643
+ ["border-r", { role: "outer", category: "border" }],
644
+ ["border-s", { role: "outer", category: "border" }],
645
+ ["border-t", { role: "outer", category: "border" }],
646
+ ["border-x", { role: "outer", category: "border" }],
647
+ ["border-y", { role: "outer", category: "border" }],
648
+ ["col-span", { role: "inner", category: "grid" }],
649
+ ["contrast", { role: "outer", category: "filter" }],
650
+ ["divide-x", { role: "outer", category: "divide" }],
651
+ ["divide-y", { role: "outer", category: "divide" }],
652
+ ["duration", { role: "outer", category: "transition" }],
653
+ ["inset-be", { role: "outer", category: "position" }],
654
+ ["inset-bs", { role: "outer", category: "position" }],
655
+ ["mask-via", { role: "outer", category: "mask" }],
656
+ ["overflow", { role: "inner", category: "overflow" }],
657
+ ["position", { role: "outer", category: "position" }],
658
+ ["rotate-x", { role: "outer", category: "transform" }],
659
+ ["rotate-y", { role: "outer", category: "transform" }],
660
+ ["rotate-z", { role: "outer", category: "transform" }],
661
+ ["row-span", { role: "inner", category: "grid" }],
662
+ ["saturate", { role: "outer", category: "filter" }],
663
+ ["scroll-m", { role: "inner", category: "scroll" }],
664
+ ["scroll-p", { role: "inner", category: "scroll" }],
665
+ ["tracking", { role: "inner", category: "text" }],
666
+ ["animate", { role: "outer", category: "transition" }],
667
+ ["bg-clip", { role: "outer", category: "bg" }],
668
+ ["caption", { role: "inner", category: "table" }],
669
+ ["col-end", { role: "inner", category: "grid" }],
670
+ ["columns", { role: "inner", category: "columns" }],
671
+ ["content", { role: "inner", category: "text" }],
672
+ ["display", { role: "inner", category: "display" }],
673
+ ["hyphens", { role: "inner", category: "text" }],
674
+ ["inset-e", { role: "outer", category: "position" }],
675
+ ["inset-s", { role: "outer", category: "position" }],
676
+ ["inset-x", { role: "outer", category: "position" }],
677
+ ["inset-y", { role: "outer", category: "position" }],
678
+ ["justify", { role: "inner", category: "alignment" }],
679
+ ["leading", { role: "inner", category: "text" }],
680
+ ["mask-to", { role: "outer", category: "mask" }],
681
+ ["opacity", { role: "outer", category: "opacity" }],
682
+ ["outline", { role: "outer", category: "outline" }],
683
+ ["rounded", { role: "outer", category: "rounded" }],
684
+ ["row-end", { role: "inner", category: "grid" }],
685
+ ["scale-x", { role: "outer", category: "transform" }],
686
+ ["scale-y", { role: "outer", category: "transform" }],
687
+ ["scale-z", { role: "outer", category: "transform" }],
688
+ ["space-x", { role: "inner", category: "space" }],
689
+ ["space-y", { role: "inner", category: "space" }],
690
+ ["accent", { role: "inner", category: "accent" }],
691
+ ["aspect", { role: "outer", category: "sizing" }],
692
+ ["border", { role: "outer", category: "border" }],
693
+ ["bottom", { role: "outer", category: "position" }],
694
+ ["cursor", { role: "inner", category: "interaction" }],
695
+ ["divide", { role: "outer", category: "divide" }],
696
+ ["filter", { role: "outer", category: "filter" }],
697
+ ["indent", { role: "inner", category: "text" }],
698
+ ["inline", { role: "outer", category: "sizing" }],
699
+ ["invert", { role: "outer", category: "filter" }],
700
+ ["object", { role: "inner", category: "object" }],
701
+ ["origin", { role: "outer", category: "transform" }],
702
+ ["resize", { role: "inner", category: "interaction" }],
703
+ ["rotate", { role: "outer", category: "transform" }],
704
+ ["scheme", { role: "outer", category: "color-scheme" }],
705
+ ["scroll", { role: "inner", category: "scroll" }],
706
+ ["select", { role: "inner", category: "interaction" }],
707
+ ["shadow", { role: "outer", category: "shadow" }],
708
+ ["shrink", { role: "inner", category: "flex" }],
709
+ ["skew-x", { role: "outer", category: "transform" }],
710
+ ["skew-y", { role: "outer", category: "transform" }],
711
+ ["stroke", { role: "inner", category: "svg" }],
712
+ ["align", { role: "inner", category: "text" }],
713
+ ["basis", { role: "inner", category: "flex" }],
714
+ ["block", { role: "outer", category: "sizing" }],
715
+ ["break", { role: "inner", category: "text" }],
716
+ ["caret", { role: "inner", category: "accent" }],
717
+ ["clear", { role: "outer", category: "position" }],
718
+ ["delay", { role: "outer", category: "transition" }],
719
+ ["float", { role: "outer", category: "position" }],
720
+ ["gap-x", { role: "inner", category: "gap" }],
721
+ ["gap-y", { role: "inner", category: "gap" }],
722
+ ["inset", { role: "outer", category: "position" }],
723
+ ["items", { role: "inner", category: "alignment" }],
724
+ ["max-h", { role: "outer", category: "sizing" }],
725
+ ["max-w", { role: "outer", category: "sizing" }],
726
+ ["min-h", { role: "outer", category: "sizing" }],
727
+ ["min-w", { role: "outer", category: "sizing" }],
728
+ ["order", { role: "inner", category: "flex" }],
729
+ ["right", { role: "outer", category: "position" }],
730
+ ["scale", { role: "outer", category: "transform" }],
731
+ ["sepia", { role: "outer", category: "filter" }],
732
+ ["table", { role: "inner", category: "table" }],
733
+ ["touch", { role: "inner", category: "touch" }],
734
+ ["blur", { role: "outer", category: "filter" }],
735
+ ["ease", { role: "outer", category: "transition" }],
736
+ ["fill", { role: "inner", category: "svg" }],
737
+ ["flex", { role: "inner", category: "flex" }],
738
+ ["font", { role: "inner", category: "text" }],
739
+ ["from", { role: "outer", category: "gradient" }],
740
+ ["grow", { role: "inner", category: "flex" }],
741
+ ["left", { role: "outer", category: "position" }],
742
+ ["list", { role: "inner", category: "list" }],
743
+ ["mask", { role: "outer", category: "mask" }],
744
+ ["ring", { role: "outer", category: "ring" }],
745
+ ["self", { role: "inner", category: "alignment" }],
746
+ ["size", { role: "outer", category: "sizing" }],
747
+ ["snap", { role: "inner", category: "snap" }],
748
+ ["text", { role: "inner", category: "text" }],
749
+ ["wrap", { role: "inner", category: "text" }],
750
+ ["zoom", { role: "outer", category: "transform" }],
751
+ ["box", { role: "outer", category: "sizing" }],
752
+ ["col", { role: "inner", category: "grid" }],
753
+ ["gap", { role: "inner", category: "gap" }],
754
+ ["mbe", { role: "outer", category: "margin" }],
755
+ ["mbs", { role: "outer", category: "margin" }],
756
+ ["pbe", { role: "inner", category: "padding" }],
757
+ ["pbs", { role: "inner", category: "padding" }],
758
+ ["row", { role: "inner", category: "grid" }],
759
+ ["tab", { role: "inner", category: "text" }],
760
+ ["top", { role: "outer", category: "position" }],
761
+ ["via", { role: "outer", category: "gradient" }],
762
+ ["bg", { role: "outer", category: "bg" }],
763
+ ["mb", { role: "outer", category: "margin" }],
764
+ ["me", { role: "outer", category: "margin" }],
765
+ ["ml", { role: "outer", category: "margin" }],
766
+ ["mr", { role: "outer", category: "margin" }],
767
+ ["ms", { role: "outer", category: "margin" }],
768
+ ["mt", { role: "outer", category: "margin" }],
769
+ ["mx", { role: "outer", category: "margin" }],
770
+ ["my", { role: "outer", category: "margin" }],
771
+ ["pb", { role: "inner", category: "padding" }],
772
+ ["pe", { role: "inner", category: "padding" }],
773
+ ["pl", { role: "inner", category: "padding" }],
774
+ ["pr", { role: "inner", category: "padding" }],
775
+ ["ps", { role: "inner", category: "padding" }],
776
+ ["pt", { role: "inner", category: "padding" }],
777
+ ["px", { role: "inner", category: "padding" }],
778
+ ["py", { role: "inner", category: "padding" }],
779
+ ["to", { role: "outer", category: "gradient" }],
780
+ ["h", { role: "outer", category: "sizing" }],
781
+ ["m", { role: "outer", category: "margin" }],
782
+ ["p", { role: "inner", category: "padding" }],
783
+ ["w", { role: "outer", category: "sizing" }],
784
+ ["z", { role: "outer", category: "position" }]
785
+ ];
786
+ const BOX_ROLE_BY_KEY = /* @__PURE__ */ new Map([
787
+ ["accent", { role: "inner", category: "accent" }],
788
+ ["align", { role: "inner", category: "text" }],
789
+ ["animate", { role: "outer", category: "transition" }],
790
+ ["animationDelay", { role: "outer", category: "transition" }],
791
+ ["appearance", { role: "inner", category: "interaction" }],
792
+ ["aspect", { role: "outer", category: "sizing" }],
793
+ ["autoCols", { role: "inner", category: "grid" }],
794
+ ["autoRows", { role: "inner", category: "grid" }],
795
+ ["backdropBlur", { role: "outer", category: "backdrop" }],
796
+ ["backdropBrightness", { role: "outer", category: "backdrop" }],
797
+ ["backdropContrast", { role: "outer", category: "backdrop" }],
798
+ ["backdropFilter", { role: "outer", category: "backdrop" }],
799
+ ["backdropGrayscale", { role: "outer", category: "backdrop" }],
800
+ ["backdropHueRotate", { role: "outer", category: "backdrop" }],
801
+ ["backdropInvert", { role: "outer", category: "backdrop" }],
802
+ ["backdropOpacity", { role: "outer", category: "backdrop" }],
803
+ ["backdropSaturate", { role: "outer", category: "backdrop" }],
804
+ ["backdropSepia", { role: "outer", category: "backdrop" }],
805
+ ["backface", { role: "outer", category: "transform" }],
806
+ ["basis", { role: "inner", category: "flex" }],
807
+ ["bg", { role: "outer", category: "bg" }],
808
+ ["bgAttach", { role: "outer", category: "bg" }],
809
+ ["bgBlend", { role: "outer", category: "bg" }],
810
+ ["bgClip", { role: "outer", category: "bg" }],
811
+ ["bgImg", { role: "outer", category: "bg" }],
812
+ ["bgOrigin", { role: "outer", category: "bg" }],
813
+ ["bgPos", { role: "outer", category: "bg" }],
814
+ ["bgRepeat", { role: "outer", category: "bg" }],
815
+ ["bgSize", { role: "outer", category: "bg" }],
816
+ ["blockSize", { role: "outer", category: "sizing" }],
817
+ ["blur", { role: "outer", category: "filter" }],
818
+ ["border", { role: "outer", category: "border" }],
819
+ ["borderB", { role: "outer", category: "border" }],
820
+ ["borderBColor", { role: "outer", category: "border" }],
821
+ ["borderBe", { role: "outer", category: "border" }],
822
+ ["borderBs", { role: "outer", category: "border" }],
823
+ ["borderCollapse", { role: "outer", category: "border" }],
824
+ ["borderColor", { role: "outer", category: "border" }],
825
+ ["borderE", { role: "outer", category: "border" }],
826
+ ["borderL", { role: "outer", category: "border" }],
827
+ ["borderLColor", { role: "outer", category: "border" }],
828
+ ["borderR", { role: "outer", category: "border" }],
829
+ ["borderRColor", { role: "outer", category: "border" }],
830
+ ["borderS", { role: "outer", category: "border" }],
831
+ ["borderSpacing", { role: "outer", category: "border" }],
832
+ ["borderSpacingX", { role: "outer", category: "border" }],
833
+ ["borderSpacingY", { role: "outer", category: "border" }],
834
+ ["borderStyle", { role: "outer", category: "border" }],
835
+ ["borderT", { role: "outer", category: "border" }],
836
+ ["borderTColor", { role: "outer", category: "border" }],
837
+ ["borderX", { role: "outer", category: "border" }],
838
+ ["borderXColor", { role: "outer", category: "border" }],
839
+ ["borderY", { role: "outer", category: "border" }],
840
+ ["borderYColor", { role: "outer", category: "border" }],
841
+ ["bottom", { role: "outer", category: "position" }],
842
+ ["box", { role: "outer", category: "sizing" }],
843
+ ["boxDecoration", { role: "outer", category: "fragmentation" }],
844
+ ["break", { role: "inner", category: "text" }],
845
+ ["breakAfter", { role: "outer", category: "fragmentation" }],
846
+ ["breakBefore", { role: "outer", category: "fragmentation" }],
847
+ ["breakInside", { role: "outer", category: "fragmentation" }],
848
+ ["brightness", { role: "outer", category: "filter" }],
849
+ ["caption", { role: "inner", category: "table" }],
850
+ ["caret", { role: "inner", category: "accent" }],
851
+ ["clear", { role: "outer", category: "position" }],
852
+ ["col", { role: "inner", category: "grid" }],
853
+ ["colEnd", { role: "inner", category: "grid" }],
854
+ ["color", { role: "inner", category: "text" }],
855
+ ["colSpan", { role: "inner", category: "grid" }],
856
+ ["colStart", { role: "inner", category: "grid" }],
857
+ ["columns", { role: "inner", category: "columns" }],
858
+ ["container", { role: "outer", category: "sizing" }],
859
+ ["content", { role: "inner", category: "text" }],
860
+ ["contrast", { role: "outer", category: "filter" }],
861
+ ["cursor", { role: "inner", category: "interaction" }],
862
+ ["decoration", { role: "inner", category: "text" }],
863
+ ["decorationColor", { role: "inner", category: "text" }],
864
+ ["decorationStyle", { role: "inner", category: "text" }],
865
+ ["decorationThickness", { role: "inner", category: "text" }],
866
+ ["delay", { role: "outer", category: "transition" }],
867
+ ["diagonalFractions", { role: "inner", category: "text" }],
868
+ ["display", { role: "inner", category: "display" }],
869
+ ["divideColor", { role: "outer", category: "divide" }],
870
+ ["divideStyle", { role: "outer", category: "divide" }],
871
+ ["divideX", { role: "outer", category: "divide" }],
872
+ ["divideXReverse", { role: "outer", category: "divide" }],
873
+ ["divideY", { role: "outer", category: "divide" }],
874
+ ["divideYReverse", { role: "outer", category: "divide" }],
875
+ ["dropShadow", { role: "outer", category: "filter" }],
876
+ ["dropShadowColor", { role: "outer", category: "filter" }],
877
+ ["duration", { role: "outer", category: "transition" }],
878
+ ["ease", { role: "outer", category: "transition" }],
879
+ ["end", { role: "outer", category: "position" }],
880
+ ["fieldSizing", { role: "inner", category: "interaction" }],
881
+ ["fill", { role: "inner", category: "svg" }],
882
+ ["filter", { role: "outer", category: "filter" }],
883
+ ["flex", { role: "inner", category: "flex" }],
884
+ ["flexDir", { role: "inner", category: "flex" }],
885
+ ["flexWrap", { role: "inner", category: "flex" }],
886
+ ["float", { role: "outer", category: "position" }],
887
+ ["fontFamily", { role: "inner", category: "text" }],
888
+ ["fontFeatures", { role: "inner", category: "text" }],
889
+ ["fontSmoothing", { role: "inner", category: "text" }],
890
+ ["fontStretch", { role: "inner", category: "text" }],
891
+ ["fontStyle", { role: "inner", category: "text" }],
892
+ ["forcedColorAdjust", { role: "outer", category: "color-scheme" }],
893
+ ["from", { role: "outer", category: "gradient" }],
894
+ ["gap", { role: "inner", category: "gap" }],
895
+ ["gapX", { role: "inner", category: "gap" }],
896
+ ["gapY", { role: "inner", category: "gap" }],
897
+ ["grayscale", { role: "outer", category: "filter" }],
898
+ ["gridCols", { role: "inner", category: "grid" }],
899
+ ["gridFlow", { role: "inner", category: "grid" }],
900
+ ["gridRows", { role: "inner", category: "grid" }],
901
+ ["grow", { role: "inner", category: "flex" }],
902
+ ["h", { role: "outer", category: "sizing" }],
903
+ ["hueRotate", { role: "outer", category: "filter" }],
904
+ ["hyphens", { role: "inner", category: "text" }],
905
+ ["indent", { role: "inner", category: "text" }],
906
+ ["inlineSize", { role: "outer", category: "sizing" }],
907
+ ["inset", { role: "outer", category: "position" }],
908
+ ["insetBe", { role: "outer", category: "position" }],
909
+ ["insetBs", { role: "outer", category: "position" }],
910
+ ["insetE", { role: "outer", category: "position" }],
911
+ ["insetRing", { role: "inner", category: "ring" }],
912
+ ["insetRingColor", { role: "inner", category: "ring" }],
913
+ ["insetS", { role: "outer", category: "position" }],
914
+ ["insetShadow", { role: "inner", category: "shadow" }],
915
+ ["insetShadowColor", { role: "inner", category: "shadow" }],
916
+ ["insetX", { role: "outer", category: "position" }],
917
+ ["insetY", { role: "outer", category: "position" }],
918
+ ["invert", { role: "outer", category: "filter" }],
919
+ ["isolation", { role: "outer", category: "position" }],
920
+ ["items", { role: "inner", category: "alignment" }],
921
+ ["justify", { role: "inner", category: "alignment" }],
922
+ ["justifyItems", { role: "inner", category: "alignment" }],
923
+ ["justifySelf", { role: "inner", category: "alignment" }],
924
+ ["leading", { role: "inner", category: "text" }],
925
+ ["left", { role: "outer", category: "position" }],
926
+ ["lineClamp", { role: "inner", category: "text" }],
927
+ ["liningNums", { role: "inner", category: "text" }],
928
+ ["list", { role: "inner", category: "list" }],
929
+ ["listImg", { role: "inner", category: "list" }],
930
+ ["listPos", { role: "inner", category: "list" }],
931
+ ["m", { role: "outer", category: "margin" }],
932
+ ["mask", { role: "outer", category: "mask" }],
933
+ ["maskClip", { role: "outer", category: "mask" }],
934
+ ["maskFrom", { role: "outer", category: "mask" }],
935
+ ["maskOrigin", { role: "outer", category: "mask" }],
936
+ ["maskPos", { role: "outer", category: "mask" }],
937
+ ["maskRepeat", { role: "outer", category: "mask" }],
938
+ ["maskShape", { role: "outer", category: "mask" }],
939
+ ["maskSize", { role: "outer", category: "mask" }],
940
+ ["maskTo", { role: "outer", category: "mask" }],
941
+ ["maskVia", { role: "outer", category: "mask" }],
942
+ ["maxBlockSize", { role: "outer", category: "sizing" }],
943
+ ["maxH", { role: "outer", category: "sizing" }],
944
+ ["maxInlineSize", { role: "outer", category: "sizing" }],
945
+ ["maxW", { role: "outer", category: "sizing" }],
946
+ ["mb", { role: "outer", category: "margin" }],
947
+ ["mbe", { role: "outer", category: "margin" }],
948
+ ["mbs", { role: "outer", category: "margin" }],
949
+ ["me", { role: "outer", category: "margin" }],
950
+ ["minBlockSize", { role: "outer", category: "sizing" }],
951
+ ["minH", { role: "outer", category: "sizing" }],
952
+ ["minInlineSize", { role: "outer", category: "sizing" }],
953
+ ["minW", { role: "outer", category: "sizing" }],
954
+ ["mixBlend", { role: "outer", category: "blend" }],
955
+ ["ml", { role: "outer", category: "margin" }],
956
+ ["mr", { role: "outer", category: "margin" }],
957
+ ["ms", { role: "outer", category: "margin" }],
958
+ ["mt", { role: "outer", category: "margin" }],
959
+ ["mx", { role: "outer", category: "margin" }],
960
+ ["my", { role: "outer", category: "margin" }],
961
+ ["notSrOnly", { role: "outer", category: "visibility" }],
962
+ ["objectFit", { role: "inner", category: "object" }],
963
+ ["objectPos", { role: "inner", category: "object" }],
964
+ ["oldstyleNums", { role: "inner", category: "text" }],
965
+ ["opacity", { role: "outer", category: "opacity" }],
966
+ ["order", { role: "inner", category: "flex" }],
967
+ ["ordinal", { role: "inner", category: "text" }],
968
+ ["origin", { role: "outer", category: "transform" }],
969
+ ["outline", { role: "outer", category: "outline" }],
970
+ ["outlineColor", { role: "outer", category: "outline" }],
971
+ ["outlineOffset", { role: "outer", category: "outline" }],
972
+ ["outlineStyle", { role: "outer", category: "outline" }],
973
+ ["overflow", { role: "inner", category: "overflow" }],
974
+ ["overflowX", { role: "inner", category: "overflow" }],
975
+ ["overflowY", { role: "inner", category: "overflow" }],
976
+ ["overscroll", { role: "inner", category: "overscroll" }],
977
+ ["overscrollX", { role: "inner", category: "overscroll" }],
978
+ ["overscrollY", { role: "inner", category: "overscroll" }],
979
+ ["p", { role: "inner", category: "padding" }],
980
+ ["pb", { role: "inner", category: "padding" }],
981
+ ["pbe", { role: "inner", category: "padding" }],
982
+ ["pbs", { role: "inner", category: "padding" }],
983
+ ["pe", { role: "inner", category: "padding" }],
984
+ ["perspective", { role: "outer", category: "transform" }],
985
+ ["perspectiveOrigin", { role: "outer", category: "transform" }],
986
+ ["pl", { role: "inner", category: "padding" }],
987
+ ["placeContent", { role: "inner", category: "alignment" }],
988
+ ["placeItems", { role: "inner", category: "alignment" }],
989
+ ["placeSelf", { role: "inner", category: "alignment" }],
990
+ ["pointerEvents", { role: "inner", category: "interaction" }],
991
+ ["position", { role: "outer", category: "position" }],
992
+ ["pr", { role: "inner", category: "padding" }],
993
+ ["proportionalNums", { role: "inner", category: "text" }],
994
+ ["prose", { role: "inner", category: "text" }],
995
+ ["proseInvert", { role: "inner", category: "text" }],
996
+ ["ps", { role: "inner", category: "padding" }],
997
+ ["pt", { role: "inner", category: "padding" }],
998
+ ["px", { role: "inner", category: "padding" }],
999
+ ["py", { role: "inner", category: "padding" }],
1000
+ ["resize", { role: "inner", category: "interaction" }],
1001
+ ["right", { role: "outer", category: "position" }],
1002
+ ["ring", { role: "outer", category: "ring" }],
1003
+ ["ringColor", { role: "outer", category: "ring" }],
1004
+ ["ringOffset", { role: "outer", category: "ring" }],
1005
+ ["ringOffsetColor", { role: "outer", category: "ring" }],
1006
+ ["rotate", { role: "outer", category: "transform" }],
1007
+ ["rotateX", { role: "outer", category: "transform" }],
1008
+ ["rotateY", { role: "outer", category: "transform" }],
1009
+ ["rotateZ", { role: "outer", category: "transform" }],
1010
+ ["rounded", { role: "outer", category: "rounded" }],
1011
+ ["roundedB", { role: "outer", category: "rounded" }],
1012
+ ["roundedBl", { role: "outer", category: "rounded" }],
1013
+ ["roundedBr", { role: "outer", category: "rounded" }],
1014
+ ["roundedE", { role: "outer", category: "rounded" }],
1015
+ ["roundedEe", { role: "outer", category: "rounded" }],
1016
+ ["roundedEs", { role: "outer", category: "rounded" }],
1017
+ ["roundedL", { role: "outer", category: "rounded" }],
1018
+ ["roundedR", { role: "outer", category: "rounded" }],
1019
+ ["roundedS", { role: "outer", category: "rounded" }],
1020
+ ["roundedSe", { role: "outer", category: "rounded" }],
1021
+ ["roundedSs", { role: "outer", category: "rounded" }],
1022
+ ["roundedT", { role: "outer", category: "rounded" }],
1023
+ ["roundedTl", { role: "outer", category: "rounded" }],
1024
+ ["roundedTr", { role: "outer", category: "rounded" }],
1025
+ ["row", { role: "inner", category: "grid" }],
1026
+ ["rowEnd", { role: "inner", category: "grid" }],
1027
+ ["rowSpan", { role: "inner", category: "grid" }],
1028
+ ["rowStart", { role: "inner", category: "grid" }],
1029
+ ["saturate", { role: "outer", category: "filter" }],
1030
+ ["scale", { role: "outer", category: "transform" }],
1031
+ ["scaleX", { role: "outer", category: "transform" }],
1032
+ ["scaleY", { role: "outer", category: "transform" }],
1033
+ ["scaleZ", { role: "outer", category: "transform" }],
1034
+ ["scheme", { role: "outer", category: "color-scheme" }],
1035
+ ["scroll", { role: "inner", category: "scroll" }],
1036
+ ["scrollbar", { role: "inner", category: "scroll" }],
1037
+ ["scrollbarGutter", { role: "inner", category: "scroll" }],
1038
+ ["scrollbarThumb", { role: "inner", category: "scroll" }],
1039
+ ["scrollbarTrack", { role: "inner", category: "scroll" }],
1040
+ ["scrollM", { role: "inner", category: "scroll" }],
1041
+ ["scrollMb", { role: "inner", category: "scroll" }],
1042
+ ["scrollMbe", { role: "inner", category: "scroll" }],
1043
+ ["scrollMbs", { role: "inner", category: "scroll" }],
1044
+ ["scrollMe", { role: "inner", category: "scroll" }],
1045
+ ["scrollMl", { role: "inner", category: "scroll" }],
1046
+ ["scrollMr", { role: "inner", category: "scroll" }],
1047
+ ["scrollMs", { role: "inner", category: "scroll" }],
1048
+ ["scrollMt", { role: "inner", category: "scroll" }],
1049
+ ["scrollMx", { role: "inner", category: "scroll" }],
1050
+ ["scrollMy", { role: "inner", category: "scroll" }],
1051
+ ["scrollP", { role: "inner", category: "scroll" }],
1052
+ ["scrollPb", { role: "inner", category: "scroll" }],
1053
+ ["scrollPbe", { role: "inner", category: "scroll" }],
1054
+ ["scrollPbs", { role: "inner", category: "scroll" }],
1055
+ ["scrollPe", { role: "inner", category: "scroll" }],
1056
+ ["scrollPl", { role: "inner", category: "scroll" }],
1057
+ ["scrollPr", { role: "inner", category: "scroll" }],
1058
+ ["scrollPs", { role: "inner", category: "scroll" }],
1059
+ ["scrollPt", { role: "inner", category: "scroll" }],
1060
+ ["scrollPx", { role: "inner", category: "scroll" }],
1061
+ ["scrollPy", { role: "inner", category: "scroll" }],
1062
+ ["select", { role: "inner", category: "interaction" }],
1063
+ ["self", { role: "inner", category: "alignment" }],
1064
+ ["sepia", { role: "outer", category: "filter" }],
1065
+ ["shadow", { role: "outer", category: "shadow" }],
1066
+ ["shadowColor", { role: "outer", category: "shadow" }],
1067
+ ["shrink", { role: "inner", category: "flex" }],
1068
+ ["size", { role: "outer", category: "sizing" }],
1069
+ ["skewX", { role: "outer", category: "transform" }],
1070
+ ["skewY", { role: "outer", category: "transform" }],
1071
+ ["slashedZero", { role: "inner", category: "text" }],
1072
+ ["snapAlign", { role: "inner", category: "snap" }],
1073
+ ["snapStop", { role: "inner", category: "snap" }],
1074
+ ["snapType", { role: "inner", category: "snap" }],
1075
+ ["spaceX", { role: "inner", category: "space" }],
1076
+ ["spaceXReverse", { role: "inner", category: "space" }],
1077
+ ["spaceY", { role: "inner", category: "space" }],
1078
+ ["spaceYReverse", { role: "inner", category: "space" }],
1079
+ ["srOnly", { role: "outer", category: "visibility" }],
1080
+ ["stackedFractions", { role: "inner", category: "text" }],
1081
+ ["start", { role: "outer", category: "position" }],
1082
+ ["stroke", { role: "inner", category: "svg" }],
1083
+ ["strokeWidth", { role: "inner", category: "svg" }],
1084
+ ["tableLayout", { role: "inner", category: "table" }],
1085
+ ["tabSize", { role: "inner", category: "text" }],
1086
+ ["tabularNums", { role: "inner", category: "text" }],
1087
+ ["text", { role: "inner", category: "text" }],
1088
+ ["textAlign", { role: "inner", category: "text" }],
1089
+ ["textOverflow", { role: "inner", category: "text" }],
1090
+ ["textShadow", { role: "inner", category: "text" }],
1091
+ ["textShadowColor", { role: "inner", category: "text" }],
1092
+ ["textTransform", { role: "inner", category: "text" }],
1093
+ ["textWrap", { role: "inner", category: "text" }],
1094
+ ["to", { role: "outer", category: "gradient" }],
1095
+ ["top", { role: "outer", category: "position" }],
1096
+ ["touch", { role: "inner", category: "touch" }],
1097
+ ["tracking", { role: "inner", category: "text" }],
1098
+ ["transform", { role: "outer", category: "transform" }],
1099
+ ["transformStyle", { role: "outer", category: "transform" }],
1100
+ ["transition", { role: "outer", category: "transition" }],
1101
+ ["transitionBehavior", { role: "outer", category: "transition" }],
1102
+ ["translate", { role: "outer", category: "transform" }],
1103
+ ["translateX", { role: "outer", category: "transform" }],
1104
+ ["translateY", { role: "outer", category: "transform" }],
1105
+ ["translateZ", { role: "outer", category: "transform" }],
1106
+ ["truncate", { role: "inner", category: "text" }],
1107
+ ["underlineOffset", { role: "inner", category: "text" }],
1108
+ ["via", { role: "outer", category: "gradient" }],
1109
+ ["visibility", { role: "outer", category: "visibility" }],
1110
+ ["w", { role: "outer", category: "sizing" }],
1111
+ ["weight", { role: "inner", category: "text" }],
1112
+ ["whitespace", { role: "inner", category: "text" }],
1113
+ ["willChange", { role: "inner", category: "interaction" }],
1114
+ ["wrap", { role: "inner", category: "text" }],
1115
+ ["z", { role: "outer", category: "position" }],
1116
+ ["zoom", { role: "outer", category: "transform" }]
1117
+ ]);
1118
+
1119
+ function stripVariant(token) {
1120
+ let depth = 0;
1121
+ for (let i = token.length - 1; i >= 0; i--) {
1122
+ const ch = token[i];
1123
+ if (ch === "]" || ch === ")") depth++;
1124
+ else if (ch === "[" || ch === "(") depth--;
1125
+ else if (ch === ":" && depth === 0) return token.slice(i + 1);
1126
+ }
1127
+ return token;
1128
+ }
1129
+ function normalizeBase(base) {
1130
+ let b = base;
1131
+ if (b.startsWith("!")) b = b.slice(1);
1132
+ if (b.endsWith("!")) b = b.slice(0, -1);
1133
+ if (b.startsWith("-")) b = b.slice(1);
1134
+ return b;
1135
+ }
1136
+ function inspect(token) {
1137
+ const base = normalizeBase(stripVariant(token));
1138
+ if (!base) return void 0;
1139
+ const exact = BOX_ROLE_TOKENS.get(base);
1140
+ if (exact) return { ...exact, base, value: base };
1141
+ for (const [prefix, entry] of BOX_ROLE_PREFIXES) {
1142
+ if (base === prefix) return { ...entry, base, value: "" };
1143
+ if (base.startsWith(`${prefix}-`)) {
1144
+ return { ...entry, base, value: base.slice(prefix.length + 1) };
1145
+ }
1146
+ }
1147
+ return void 0;
1148
+ }
1149
+ function classify(token) {
1150
+ const info = inspect(token);
1151
+ return info ? { role: info.role, category: info.category } : void 0;
1152
+ }
1153
+ function matches(info, selector) {
1154
+ if (!info) return false;
1155
+ if (typeof selector === "object") {
1156
+ return Object.entries(selector).every(
1157
+ ([category, value]) => info.category === category && info.value === value
1158
+ );
1159
+ }
1160
+ if (selector === "outer" || selector === "inner") {
1161
+ return info.role === selector;
1162
+ }
1163
+ if (selector === "content") return info.role === "inner";
1164
+ if (selector === info.category) return true;
1165
+ if (info.base === selector) return true;
1166
+ return info.base.startsWith(`${selector}-`);
1167
+ }
1168
+ function anyMatch(info, selectors) {
1169
+ return selectors.some((s) => matches(info, s));
1170
+ }
1171
+ function tokenize(className) {
1172
+ return className.split(/\s+/).filter(Boolean);
1173
+ }
1174
+ function splitBox(className, options = {}) {
1175
+ const forceInner = options.inner ?? [];
1176
+ const forceOuter = options.outer ?? [];
1177
+ const fallback = options.fallback ?? "outer";
1178
+ const outer = [];
1179
+ const inner = [];
1180
+ for (const token of tokenize(className)) {
1181
+ const info = inspect(token);
1182
+ let role;
1183
+ if (anyMatch(info, forceInner)) role = "inner";
1184
+ else if (anyMatch(info, forceOuter)) role = "outer";
1185
+ else role = info ? info.role : fallback;
1186
+ (role === "outer" ? outer : inner).push(token);
1187
+ }
1188
+ return { outer: outer.join(" "), inner: inner.join(" ") };
1189
+ }
1190
+ function has(classes, selector) {
1191
+ return tokenize(classes).some((t) => matches(inspect(t), selector));
1192
+ }
1193
+ function pick(classes, selector) {
1194
+ return tokenize(classes).filter((t) => matches(inspect(t), selector)).join(" ");
1195
+ }
1196
+ function omit(classes, selector) {
1197
+ return tokenize(classes).filter((t) => !matches(inspect(t), selector)).join(" ");
1198
+ }
1199
+ function classifySzKey(key) {
1200
+ return BOX_ROLE_BY_KEY.get(key);
1201
+ }
1202
+ function isPlainObject(value) {
1203
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1204
+ }
1205
+ function matchesKey(key, entry, selector) {
1206
+ if (typeof selector === "object") {
1207
+ return !!entry && Object.keys(selector).every((category) => entry.category === category);
1208
+ }
1209
+ if (selector === "outer" || selector === "inner") return entry?.role === selector;
1210
+ if (selector === "content") return entry?.role === "inner";
1211
+ if (key === selector) return true;
1212
+ return !!entry && selector === entry.category;
1213
+ }
1214
+ function anyMatchKey(key, entry, selectors) {
1215
+ return selectors.some((s) => matchesKey(key, entry, s));
1216
+ }
1217
+ function mergeSzInto(target, source, depth) {
1218
+ if (depth >= MAX_SZ_DEPTH) throw new SzDepthError();
1219
+ for (const key of Object.keys(source)) {
1220
+ if (isForbiddenSzKey(key)) continue;
1221
+ const sv = source[key];
1222
+ const tv = target[key];
1223
+ target[key] = isPlainObject(sv) && isPlainObject(tv) ? mergeSzInto({ ...tv }, sv, depth + 1) : sv;
1224
+ }
1225
+ return target;
1226
+ }
1227
+ function flattenSz(sz, depth) {
1228
+ if (depth >= MAX_SZ_DEPTH) throw new SzDepthError();
1229
+ if (!sz) return {};
1230
+ if (typeof sz === "string") {
1231
+ if (process.env.NODE_ENV !== "production" && sz.trim()) {
1232
+ throw new TypeError(
1233
+ `splitBoxSz partitions sz objects, not raw class strings \u2014 use splitBox() for ${JSON.stringify(sz)}.`
1234
+ );
1235
+ }
1236
+ return {};
1237
+ }
1238
+ if (Array.isArray(sz)) {
1239
+ const acc = {};
1240
+ for (const part of sz) mergeSzInto(acc, flattenSz(part, depth + 1), depth + 1);
1241
+ return acc;
1242
+ }
1243
+ return sz;
1244
+ }
1245
+ function partitionSz(obj, options, outer, inner, depth) {
1246
+ if (depth >= MAX_SZ_DEPTH) throw new SzDepthError();
1247
+ const forceInner = options.inner ?? [];
1248
+ const forceOuter = options.outer ?? [];
1249
+ const fallback = options.fallback ?? "outer";
1250
+ for (const key of Object.keys(obj)) {
1251
+ if (isForbiddenSzKey(key)) continue;
1252
+ const value = obj[key];
1253
+ const entry = BOX_ROLE_BY_KEY.get(key);
1254
+ if (anyMatchKey(key, entry, forceInner)) {
1255
+ inner[key] = value;
1256
+ } else if (anyMatchKey(key, entry, forceOuter)) {
1257
+ outer[key] = value;
1258
+ } else if (entry) {
1259
+ (entry.role === "inner" ? inner : outer)[key] = value;
1260
+ } else if (isPlainObject(value)) {
1261
+ const subOuter = {};
1262
+ const subInner = {};
1263
+ partitionSz(value, options, subOuter, subInner, depth + 1);
1264
+ if (Object.keys(subOuter).length > 0) outer[key] = subOuter;
1265
+ if (Object.keys(subInner).length > 0) inner[key] = subInner;
1266
+ } else {
1267
+ (fallback === "inner" ? inner : outer)[key] = value;
1268
+ }
1269
+ }
1270
+ }
1271
+ function splitBoxSz(sz, options = {}) {
1272
+ const outer = {};
1273
+ const inner = {};
1274
+ partitionSz(flattenSz(sz, 0), options, outer, inner, 0);
1275
+ return { outer, inner };
1276
+ }
1277
+ function filterSz(obj, selector, keep, depth) {
1278
+ if (depth >= MAX_SZ_DEPTH) throw new SzDepthError();
1279
+ const result = {};
1280
+ for (const key of Object.keys(obj)) {
1281
+ if (isForbiddenSzKey(key)) continue;
1282
+ const value = obj[key];
1283
+ const entry = BOX_ROLE_BY_KEY.get(key);
1284
+ if (entry || !isPlainObject(value)) {
1285
+ if (matchesKey(key, entry, selector) === keep) result[key] = value;
1286
+ } else {
1287
+ const sub = filterSz(value, selector, keep, depth + 1);
1288
+ if (Object.keys(sub).length > 0) result[key] = sub;
1289
+ }
1290
+ }
1291
+ return result;
1292
+ }
1293
+ function hasSz(sz, selector) {
1294
+ const scan = (obj, depth) => {
1295
+ if (depth >= MAX_SZ_DEPTH) throw new SzDepthError();
1296
+ for (const key of Object.keys(obj)) {
1297
+ if (isForbiddenSzKey(key)) continue;
1298
+ const value = obj[key];
1299
+ const entry = BOX_ROLE_BY_KEY.get(key);
1300
+ if (matchesKey(key, entry, selector)) return true;
1301
+ if (!entry && isPlainObject(value) && scan(value, depth + 1)) return true;
1302
+ }
1303
+ return false;
1304
+ };
1305
+ return scan(flattenSz(sz, 0), 0);
1306
+ }
1307
+ function pickSz(sz, selector) {
1308
+ return filterSz(flattenSz(sz, 0), selector, true, 0);
1309
+ }
1310
+ function omitSz(sz, selector) {
1311
+ return filterSz(flattenSz(sz, 0), selector, false, 0);
1312
+ }
1313
+
1314
+ const warned = /* @__PURE__ */ new Set();
1315
+ const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package to `compilePackages`; otherwise check that the bundler is not skipping the file.';
1316
+ function warnRawSz() {
1317
+ if (warned.has(RAW_SZ_WARNING)) return;
1318
+ warned.add(RAW_SZ_WARNING);
1319
+ console.warn(RAW_SZ_WARNING);
1320
+ }
1321
+ function stripSzProps(props) {
1322
+ if (props == null || typeof props !== "object" || !("sz" in props)) {
1323
+ return props;
1324
+ }
1325
+ const { sz, ...rest } = props;
1326
+ if (process.env.NODE_ENV !== "production") {
1327
+ if (sz !== null && typeof sz === "object") {
1328
+ warnRawSz();
1329
+ }
1330
+ }
1331
+ return rest;
1332
+ }
1333
+
1334
+ function deepMerge(target, source, depth = 0) {
1335
+ if (depth >= MAX_SZ_DEPTH) {
1336
+ throw new SzDepthError();
1337
+ }
439
1338
  const result = { ...target };
440
1339
  for (const key of Object.keys(source)) {
1340
+ if (isForbiddenSzKey(key)) {
1341
+ continue;
1342
+ }
441
1343
  const sv = source[key];
442
1344
  const tv = target[key];
443
1345
  if (sv !== null && sv !== void 0 && typeof sv === "object" && !Array.isArray(sv) && tv !== null && tv !== void 0 && typeof tv === "object" && !Array.isArray(tv)) {
444
- result[key] = deepMerge(tv, sv);
1346
+ result[key] = deepMerge(tv, sv, depth + 1);
445
1347
  } else {
446
1348
  result[key] = sv;
447
1349
  }
@@ -454,6 +1356,9 @@ function szv(config) {
454
1356
  const resolved = { ...config.defaultVariants };
455
1357
  if (selection) {
456
1358
  for (const key of Object.keys(selection)) {
1359
+ if (isForbiddenSzKey(key)) {
1360
+ continue;
1361
+ }
457
1362
  const val = selection[key];
458
1363
  if (val !== null && val !== void 0) {
459
1364
  resolved[key] = val;
@@ -515,4 +1420,4 @@ function resetRuntime() {
515
1420
  runtimeState.initialized = false;
516
1421
  }
517
1422
 
518
- export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szIf, _szMerge, _szSwitch, abortHydration, attemptCSRRecovery, clearHydrationErrors, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, hasRecoveryToken, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, resetRuntime, startHydration, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleMapIntegrity, verifyRecoveryToken };
1423
+ export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szMerge, abortHydration, attemptCSRRecovery, classify, classifySzKey, clearHydrationErrors, computeMangleChecksumAsync, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, has, hasRecoveryToken, hasSz, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidMangleMap, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, omit, omitSz, pick, pickSz, resetRuntime, splitBox, splitBoxSz, startHydration, stripSzProps, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleChecksumAsync, verifyMangleMapIntegrity, verifyRecoveryToken };