@exponential-at/ui 0.0.0-stage → 0.1.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.
Files changed (251) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +54 -0
  3. package/README.md +360 -2
  4. package/catalog/a11y.json +668 -0
  5. package/catalog/basic-map.json +104 -0
  6. package/catalog/code.json +58 -0
  7. package/catalog/core.catalog.json +4752 -0
  8. package/catalog/core.schema.json +22667 -0
  9. package/catalog/host.json +64 -0
  10. package/catalog/layout.json +20 -0
  11. package/catalog/limits.json +9 -0
  12. package/catalog/locale.json +48 -0
  13. package/catalog/macros.json +3417 -0
  14. package/catalog/recipes.json +61 -0
  15. package/catalog/strings.json +72 -0
  16. package/catalog/style.json +128 -0
  17. package/catalog/theme.schema.json +42543 -0
  18. package/catalog/tokens.json +47 -0
  19. package/conformance/README.md +217 -0
  20. package/conformance/baseline.ts +101 -0
  21. package/conformance/browser-page.ts +146 -0
  22. package/conformance/browser-suites.ts +683 -0
  23. package/conformance/compare.ts +201 -0
  24. package/conformance/dom.ts +96 -0
  25. package/conformance/dump.ts +163 -0
  26. package/conformance/fonts.json +154 -0
  27. package/conformance/manifest.json +224 -0
  28. package/conformance/parity-compare.ts +191 -0
  29. package/conformance/parity-report.schema.json +73 -0
  30. package/conformance/parity.ts +412 -0
  31. package/conformance/pixel.ts +177 -0
  32. package/conformance/primitives-page.ts +49 -0
  33. package/conformance/report.schema.json +66 -0
  34. package/conformance/run.ts +118 -0
  35. package/dist/chunks/index-98npjvsd.js +3940 -0
  36. package/dist/chunks/index-98npjvsd.js.map +27 -0
  37. package/dist/chunks/index-gwkt14w3.js +7314 -0
  38. package/dist/chunks/index-gwkt14w3.js.map +10 -0
  39. package/dist/chunks/index-njt7yzzm.js +134 -0
  40. package/dist/chunks/index-njt7yzzm.js.map +9 -0
  41. package/dist/chunks/index-we7va6v6.js +7984 -0
  42. package/dist/chunks/index-we7va6v6.js.map +15 -0
  43. package/dist/chunks/index-xrm6f7wc.js +2563 -0
  44. package/dist/chunks/index-xrm6f7wc.js.map +10 -0
  45. package/dist/conformance.js +182749 -0
  46. package/dist/conformance.js.map +10 -0
  47. package/dist/entries/prompt.js +251 -0
  48. package/dist/entries/prompt.js.map +11 -0
  49. package/dist/entries/schema.js +1725 -0
  50. package/dist/entries/schema.js.map +11 -0
  51. package/dist/host/index.js +122 -0
  52. package/dist/host/index.js.map +9 -0
  53. package/dist/index.js +3213 -0
  54. package/dist/index.js.map +27 -0
  55. package/dist/types/src/a11y.d.ts +21 -0
  56. package/dist/types/src/animation.d.ts +76 -0
  57. package/dist/types/src/basic-map.d.ts +38 -0
  58. package/dist/types/src/builder.d.ts +50 -0
  59. package/dist/types/src/catalog.d.ts +54 -0
  60. package/dist/types/src/catalog.described.d.ts +33 -0
  61. package/dist/types/src/catalog.generated.d.ts +829 -0
  62. package/dist/types/src/chart.d.ts +46 -0
  63. package/dist/types/src/code.d.ts +44 -0
  64. package/dist/types/src/color.d.ts +20 -0
  65. package/dist/types/src/conformance.d.ts +39 -0
  66. package/dist/types/src/connector/app.d.ts +14 -0
  67. package/dist/types/src/connector/connector.d.ts +77 -0
  68. package/dist/types/src/connector/index.d.ts +4 -0
  69. package/dist/types/src/css.d.ts +29 -0
  70. package/dist/types/src/define.d.ts +66 -0
  71. package/dist/types/src/direction.d.ts +16 -0
  72. package/dist/types/src/dynamic.d.ts +159 -0
  73. package/dist/types/src/entries/prompt.d.ts +11 -0
  74. package/dist/types/src/entries/schema.d.ts +8 -0
  75. package/dist/types/src/expr.d.ts +71 -0
  76. package/dist/types/src/extension.d.ts +4 -0
  77. package/dist/types/src/format.d.ts +112 -0
  78. package/dist/types/src/geometry.d.ts +40 -0
  79. package/dist/types/src/host/contract.d.ts +188 -0
  80. package/dist/types/src/host/decoders.d.ts +61 -0
  81. package/dist/types/src/host/index.d.ts +11 -0
  82. package/dist/types/src/host/package.d.ts +58 -0
  83. package/dist/types/src/host/policy.d.ts +105 -0
  84. package/dist/types/src/host/router.d.ts +34 -0
  85. package/dist/types/src/host/runtime.d.ts +205 -0
  86. package/dist/types/src/host/sources.d.ts +15 -0
  87. package/dist/types/src/host/transports.d.ts +109 -0
  88. package/dist/types/src/index.d.ts +63 -0
  89. package/dist/types/src/layout.d.ts +20 -0
  90. package/dist/types/src/limits.d.ts +21 -0
  91. package/dist/types/src/list.d.ts +133 -0
  92. package/dist/types/src/locale.d.ts +22 -0
  93. package/dist/types/src/macros.d.ts +29 -0
  94. package/dist/types/src/overlay.d.ts +27 -0
  95. package/dist/types/src/prompt.d.ts +44 -0
  96. package/dist/types/src/recipes.d.ts +17 -0
  97. package/dist/types/src/reducer.d.ts +41 -0
  98. package/dist/types/src/resizable.d.ts +38 -0
  99. package/dist/types/src/schema.d.ts +7 -0
  100. package/dist/types/src/strings.d.ts +13 -0
  101. package/dist/types/src/style.d.ts +201 -0
  102. package/dist/types/src/test-preload.d.ts +1 -0
  103. package/dist/types/src/text-shimmer.d.ts +24 -0
  104. package/dist/types/src/theme-types.d.ts +162 -0
  105. package/dist/types/src/theme.d.ts +73 -0
  106. package/dist/types/src/themes.d.ts +22 -0
  107. package/dist/types/src/tree-guides.d.ts +17 -0
  108. package/dist/types/src/types.d.ts +314 -0
  109. package/dist/types/src/validate.d.ts +31 -0
  110. package/dist/types/src/web/base-css.d.ts +1 -0
  111. package/dist/types/src/web/box-css.d.ts +55 -0
  112. package/dist/types/src/web/coerce.d.ts +32 -0
  113. package/dist/types/src/web/data.d.ts +105 -0
  114. package/dist/types/src/web/dates.d.ts +12 -0
  115. package/dist/types/src/web/form.d.ts +44 -0
  116. package/dist/types/src/web/host-types.d.ts +119 -0
  117. package/dist/types/src/web/index.d.ts +28 -0
  118. package/dist/types/src/web/inputs.d.ts +55 -0
  119. package/dist/types/src/web/list.d.ts +13 -0
  120. package/dist/types/src/web/listbox.d.ts +14 -0
  121. package/dist/types/src/web/markdown.d.ts +96 -0
  122. package/dist/types/src/web/media.d.ts +62 -0
  123. package/dist/types/src/web/parts.d.ts +4 -0
  124. package/dist/types/src/web/primitives/alert-dialog.d.ts +10 -0
  125. package/dist/types/src/web/primitives/alert.d.ts +9 -0
  126. package/dist/types/src/web/primitives/avatar-color.d.ts +2 -0
  127. package/dist/types/src/web/primitives/avatar.d.ts +13 -0
  128. package/dist/types/src/web/primitives/badge.d.ts +10 -0
  129. package/dist/types/src/web/primitives/breadcrumb.d.ts +10 -0
  130. package/dist/types/src/web/primitives/button.d.ts +6 -0
  131. package/dist/types/src/web/primitives/calendar.d.ts +43 -0
  132. package/dist/types/src/web/primitives/card.d.ts +9 -0
  133. package/dist/types/src/web/primitives/checkbox.d.ts +5 -0
  134. package/dist/types/src/web/primitives/choice-tiles.d.ts +32 -0
  135. package/dist/types/src/web/primitives/cn.d.ts +3 -0
  136. package/dist/types/src/web/primitives/code-block.d.ts +24 -0
  137. package/dist/types/src/web/primitives/command.d.ts +134 -0
  138. package/dist/types/src/web/primitives/context-ring.d.ts +24 -0
  139. package/dist/types/src/web/primitives/dialog-arms.d.ts +6 -0
  140. package/dist/types/src/web/primitives/dialog.d.ts +24 -0
  141. package/dist/types/src/web/primitives/disclosure-header.d.ts +5 -0
  142. package/dist/types/src/web/primitives/dock.d.ts +42 -0
  143. package/dist/types/src/web/primitives/dropdown-menu.d.ts +14 -0
  144. package/dist/types/src/web/primitives/empty-state.d.ts +15 -0
  145. package/dist/types/src/web/primitives/glass-card.d.ts +4 -0
  146. package/dist/types/src/web/primitives/hover-card.d.ts +7 -0
  147. package/dist/types/src/web/primitives/icon-disc.d.ts +12 -0
  148. package/dist/types/src/web/primitives/index.d.ts +48 -0
  149. package/dist/types/src/web/primitives/input.d.ts +5 -0
  150. package/dist/types/src/web/primitives/kbd.d.ts +4 -0
  151. package/dist/types/src/web/primitives/label.d.ts +3 -0
  152. package/dist/types/src/web/primitives/menu-surface.d.ts +17 -0
  153. package/dist/types/src/web/primitives/meter.d.ts +21 -0
  154. package/dist/types/src/web/primitives/popover.d.ts +3 -0
  155. package/dist/types/src/web/primitives/progress-ring.d.ts +5 -0
  156. package/dist/types/src/web/primitives/progress.d.ts +8 -0
  157. package/dist/types/src/web/primitives/scroll-area.d.ts +49 -0
  158. package/dist/types/src/web/primitives/segmented-control.d.ts +5 -0
  159. package/dist/types/src/web/primitives/select.d.ts +47 -0
  160. package/dist/types/src/web/primitives/separator.d.ts +3 -0
  161. package/dist/types/src/web/primitives/sheet-chrome.d.ts +4 -0
  162. package/dist/types/src/web/primitives/sheet.d.ts +20 -0
  163. package/dist/types/src/web/primitives/skeleton.d.ts +3 -0
  164. package/dist/types/src/web/primitives/spinner.d.ts +3 -0
  165. package/dist/types/src/web/primitives/switch.d.ts +4 -0
  166. package/dist/types/src/web/primitives/table.d.ts +11 -0
  167. package/dist/types/src/web/primitives/tabs.d.ts +13 -0
  168. package/dist/types/src/web/primitives/textarea.d.ts +3 -0
  169. package/dist/types/src/web/primitives/toast.d.ts +163 -0
  170. package/dist/types/src/web/primitives/tooltip.d.ts +3 -0
  171. package/dist/types/src/web/primitives/truncate.d.ts +7 -0
  172. package/dist/types/src/web/primitives/typeahead-portal.d.ts +12 -0
  173. package/dist/types/src/web/share.d.ts +6 -0
  174. package/dist/types/src/web/table.d.ts +20 -0
  175. package/dist/types/src/web/theme-css.d.ts +69 -0
  176. package/dist/types/src/web/urls.d.ts +21 -0
  177. package/dist/web/index.js +2303 -0
  178. package/dist/web/index.js.map +26 -0
  179. package/dist/web/primitives/index.js +1450 -0
  180. package/dist/web/primitives/index.js.map +57 -0
  181. package/docs/components.generated.json +6238 -0
  182. package/docs/round-1-contract.md +679 -0
  183. package/docs/round-2-contract.md +476 -0
  184. package/docs/round-3-contract.md +174 -0
  185. package/docs/themes.generated.json +3503 -0
  186. package/fixtures/animations.json +2890 -0
  187. package/fixtures/bench-list.json +58 -0
  188. package/fixtures/bind-time.json +30664 -0
  189. package/fixtures/catalog-basic-map.json +1692 -0
  190. package/fixtures/catalog-components.json +9323 -0
  191. package/fixtures/catalog-extension.json +620 -0
  192. package/fixtures/catalog-macros.json +36370 -0
  193. package/fixtures/code-tokens.json +1993 -0
  194. package/fixtures/conformance-baseline.json +55544 -0
  195. package/fixtures/conformance-cases.json +49 -0
  196. package/fixtures/conformance-known.json +2123 -0
  197. package/fixtures/control-geometry.json +4200 -0
  198. package/fixtures/dashboard.data.json +74 -0
  199. package/fixtures/dashboard.json +752 -0
  200. package/fixtures/demo-surface.json +47 -0
  201. package/fixtures/format.json +870 -0
  202. package/fixtures/host-policy.json +1067 -0
  203. package/fixtures/host-router.json +1152 -0
  204. package/fixtures/host-transport.json +590 -0
  205. package/fixtures/interactions-round1.json +773 -0
  206. package/fixtures/kitchen-sink.expanded.json +10844 -0
  207. package/fixtures/kitchen-sink.json +3049 -0
  208. package/fixtures/layout-geometry-round1.json +7278 -0
  209. package/fixtures/layout-geometry.json +2072 -0
  210. package/fixtures/overlay-geometry.json +272 -0
  211. package/fixtures/primitive-specimens.json +58 -0
  212. package/fixtures/prompt-budget.json +33 -0
  213. package/fixtures/resizable.json +714 -0
  214. package/fixtures/round4-contract.json +2985 -0
  215. package/fixtures/specimens.json +9832 -0
  216. package/fixtures/style-conditions.json +336 -0
  217. package/fixtures/template-items.json +2215 -0
  218. package/fixtures/text-direction.json +309 -0
  219. package/fixtures/text-shimmer.json +96 -0
  220. package/fixtures/theme-extends.json +573 -0
  221. package/fixtures/theme-invalid.json +1296 -0
  222. package/fixtures/theme-recipes.json +58600 -0
  223. package/fixtures/theme-resolved.json +23949 -0
  224. package/fixtures/toast-stack.json +215 -0
  225. package/fixtures/tree-guides.json +224 -0
  226. package/fixtures/virtual-list.json +733 -0
  227. package/generated/ExponentialUICatalog.generated.kt +67 -0
  228. package/generated/ExponentialUICatalog.generated.swift +67 -0
  229. package/generated/ExponentialUIThemes.generated.kt +23 -0
  230. package/generated/ExponentialUIThemes.generated.swift +23 -0
  231. package/generated/catalog.descriptions.generated.rs +6 -0
  232. package/generated/catalog.generated.rs +80 -0
  233. package/generated/catalog.themes.generated.rs +34 -0
  234. package/generated/core.descriptions.json +2505 -0
  235. package/generated/core.runtime.json +3609 -0
  236. package/package.json +87 -4
  237. package/themes/exponential.recipes.json +49 -0
  238. package/themes/exponential.theme.json +755 -0
  239. package/themes/neutral.theme.json +5676 -0
  240. package/themes/orange.theme.json +43 -0
  241. package/themes/playful.theme.json +219 -0
  242. package/vendor/a2ui/LICENSE.txt +203 -0
  243. package/vendor/a2ui/README.md +27 -0
  244. package/vendor/a2ui/v0_9/basic_catalog.json +1387 -0
  245. package/vendor/a2ui/v0_9/basic_catalog_rules.txt +5 -0
  246. package/vendor/a2ui/v0_9/client_capabilities.json +97 -0
  247. package/vendor/a2ui/v0_9/client_to_server.json +104 -0
  248. package/vendor/a2ui/v0_9/common_types.json +315 -0
  249. package/vendor/a2ui/v0_9/server_to_client.json +132 -0
  250. package/vendor/json-render/LICENSE.txt +201 -0
  251. package/vendor/json-render/README.md +13 -0
@@ -0,0 +1,2303 @@
1
+ // packages/exponential-ui/src/web/theme-css.ts
2
+ import { ANIMATIONS, animatesOpacity, coreCatalog, easingCss, parseTokenRef, shadowCss } from "@exponential-at/ui";
3
+ var LAYERS = `@layer xui-base, xui-recipe, xui-node, xui-part;`;
4
+ var UNITLESS = new Set([`flexGrow`, `flexShrink`, `opacity`, `fontWeight`, `aspectRatio`, `zIndex`]);
5
+ var kebab = (key) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
6
+ function tokenVarName(ref) {
7
+ const parsed = parseTokenRef(ref);
8
+ if (!parsed)
9
+ return null;
10
+ const { group, name } = parsed;
11
+ if (group === `type.family`)
12
+ return `--xui-font-${name}`;
13
+ return `--xui-${group.replace(/\./g, `-`)}-${name}`;
14
+ }
15
+ function tokenVar(ref) {
16
+ const name = tokenVarName(ref);
17
+ return name ? `var(${name})` : null;
18
+ }
19
+ function cssString(text) {
20
+ return `"${text.replace(/\\/g, `\\\\`).replace(/"/g, `\\"`)}"`;
21
+ }
22
+ function fontStack(family, fonts) {
23
+ const fallback = fonts[family]?.fallback;
24
+ return fallback ? `${cssString(family)}, ${fallback}` : cssString(family);
25
+ }
26
+ function cssValue(key, value, fonts = {}) {
27
+ if (value === undefined || value === null || typeof value === `boolean`)
28
+ return null;
29
+ if (typeof value === `string` && value.startsWith(`var(--xd-`))
30
+ return value;
31
+ if (typeof value === `string` && value.startsWith(`$`)) {
32
+ const v = tokenVar(value);
33
+ if (v)
34
+ return v;
35
+ }
36
+ if (key === `boxShadow`)
37
+ return Array.isArray(value) ? shadowCss(value) : String(value);
38
+ if (key === `fontFamily`)
39
+ return fontStack(String(value), fonts);
40
+ if (key === `gridTemplateAreas` && Array.isArray(value))
41
+ return value.map((row) => `"${row}"`).join(` `);
42
+ if (key === `backgroundGradient`)
43
+ return gradientValue(value);
44
+ if (key === `transitionEasing`)
45
+ return Array.isArray(value) ? easingCss(value) : String(value);
46
+ if (key === `transition`)
47
+ return typeof value === `number` ? `${value}ms` : String(value);
48
+ if (typeof value === `object`)
49
+ return null;
50
+ if (typeof value === `number`)
51
+ return UNITLESS.has(key) ? String(value) : `${value}px`;
52
+ if ((key === `overflow` || key === `overflowX` || key === `overflowY`) && value === `hidden`)
53
+ return `clip`;
54
+ return String(value);
55
+ }
56
+ function gradientValue(value) {
57
+ if (typeof value !== `object` || value === null)
58
+ return null;
59
+ const g = value;
60
+ if (!Array.isArray(g.stops) || g.stops.length < 2)
61
+ return null;
62
+ const stops = g.stops.map((s) => {
63
+ const color = typeof s.color === `string` && s.color.startsWith(`$`) ? tokenVar(s.color) ?? s.color : String(s.color);
64
+ return `${color} ${Math.round(Number(s.offset ?? 0) * 1e4) / 100}%`;
65
+ });
66
+ return `linear-gradient(${Number(g.angle ?? 180)}deg, ${stops.join(`, `)})`;
67
+ }
68
+ var SHORTHANDS = {
69
+ paddingHorizontal: [`padding-left`, `padding-right`],
70
+ paddingVertical: [`padding-top`, `padding-bottom`],
71
+ marginHorizontal: [`margin-left`, `margin-right`],
72
+ marginVertical: [`margin-top`, `margin-bottom`],
73
+ backgroundGradient: [`background-image`],
74
+ transition: [`transition-property:all`, `transition-duration`],
75
+ transitionEasing: [`transition-timing-function`]
76
+ };
77
+ var BORDER_WIDTHS = [`borderWidth`, `borderTopWidth`, `borderRightWidth`, `borderBottomWidth`, `borderLeftWidth`];
78
+ function declarations(style, fonts = {}, base) {
79
+ const out = [];
80
+ const animation = `animation` in style ? style.animation : base?.animation;
81
+ const multiply = typeof animation === `string` && animatesOpacity(animation) && ((`animation` in style) || (`opacity` in style));
82
+ for (const [key, value] of Object.entries(style)) {
83
+ if (key === `native` || key.startsWith(`@`) || key.startsWith(`:`))
84
+ continue;
85
+ if (typeof value === `object` && value !== null && !Array.isArray(value) && key !== `backgroundGradient`)
86
+ continue;
87
+ if (key === `backdropBlur`) {
88
+ const v = cssValue(key, value, fonts);
89
+ if (v)
90
+ out.push([`-webkit-backdrop-filter`, `blur(${v})`], [`backdrop-filter`, `blur(${v})`]);
91
+ continue;
92
+ }
93
+ if (key === `animation`) {
94
+ out.push(...animationDeclarations(value, style.animationDuration));
95
+ continue;
96
+ }
97
+ if (key === `animationDuration`) {
98
+ const v = typeof value === `string` ? tokenVar(value) : null;
99
+ if (v && !(`animation` in style))
100
+ out.push([`animation-duration`, `calc(${v} * var(--xui-anim-factor, 1))`]);
101
+ continue;
102
+ }
103
+ const css = cssValue(key, value, fonts);
104
+ if (css === null)
105
+ continue;
106
+ for (const target of SHORTHANDS[key] ?? [kebab(key)]) {
107
+ const fixed = target.indexOf(`:`);
108
+ if (fixed > 0)
109
+ out.push([target.slice(0, fixed), target.slice(fixed + 1)]);
110
+ else
111
+ out.push([target, css]);
112
+ }
113
+ }
114
+ if (multiply) {
115
+ const at = out.findIndex(([p]) => p === `opacity`);
116
+ const ownStyle = `opacity` in style ? style : base && (`opacity` in base) ? base : null;
117
+ const own = at >= 0 ? out[at][1] : ownStyle ? cssValue(`opacity`, ownStyle.opacity, fonts) : null;
118
+ const value = own === null ? `var(--xui-a-opacity, 1)` : `calc(${own} * var(--xui-a-opacity, 1))`;
119
+ if (at >= 0)
120
+ out[at] = [`opacity`, value];
121
+ else
122
+ out.push([`opacity`, value]);
123
+ }
124
+ if (!(`borderStyle` in style) && BORDER_WIDTHS.some((k) => (k in style)))
125
+ out.push([`border-style`, `solid`]);
126
+ return out;
127
+ }
128
+ function animationDeclarations(name, durationToken) {
129
+ const def = typeof name === `string` ? ANIMATIONS[name] : undefined;
130
+ if (!def)
131
+ return [[`animation-name`, `none`]];
132
+ const token = typeof durationToken === `string` && parseTokenRef(durationToken)?.group === `motion` ? durationToken : def.duration;
133
+ const ease = def.easing === `linear` ? `linear` : tokenVar(def.easing) ?? `linear`;
134
+ return [
135
+ [`--xui-anim-factor`, String(def.factor)],
136
+ [`animation-name`, `xui-${name}`],
137
+ [`animation-duration`, `calc(${tokenVar(token) ?? `0ms`} * ${def.factor})`],
138
+ [`animation-timing-function`, ease],
139
+ [`animation-iteration-count`, def.iterations === `infinite` ? `infinite` : String(def.iterations)],
140
+ [`animation-fill-mode`, `both`]
141
+ ];
142
+ }
143
+ function shimmerRule(selector, style) {
144
+ if (style.animation !== `shimmer`)
145
+ return ``;
146
+ const band = ANIMATIONS.shimmer?.band;
147
+ const color = (band && tokenVar(band.color)) ?? `var(--xui-color-background)`;
148
+ const stops = (band?.stops ?? [{ offset: 0, alpha: 0 }, { offset: 0.5, alpha: 0.5 }, { offset: 1, alpha: 0 }]).map((s) => `color-mix(in srgb, ${color} ${Math.round(s.alpha * 100)}%, transparent) calc(var(--xui-band, 1) * 100% + ${Math.round(s.offset * 100)}%)`);
149
+ const sel = selector.split(`,`).map((x) => `${x}::after`).join(`,`);
150
+ return `${sel}{content:"";position:absolute;inset:0;pointer-events:none;border-radius:inherit;background-image:linear-gradient(90deg, ${stops.join(`, `)})}`;
151
+ }
152
+ var rule = (selector, decls) => decls.length === 0 ? `` : `${selector}{${decls.map(([p, v]) => `${p}:${v}`).join(`;`)}}`;
153
+ var STATE_SELECTORS = {
154
+ hover: [`:hover`, `[data-xs~="hover"]`],
155
+ pressed: [`:active`, `[data-xs~="pressed"]`],
156
+ focus: [`:focus-visible`, `[data-xs~="focus"]`],
157
+ disabled: [`:disabled`, `[data-disabled]`, `[aria-disabled="true"]`, `[data-xs~="disabled"]`],
158
+ checked: [`[data-state="checked"]`, `[data-xs~="checked"]`],
159
+ open: [`[data-state="open"]`, `[data-xs~="open"]`],
160
+ selected: [`[data-state="active"]`, `[data-state="on"]`, `[data-highlighted]`, `[data-xs~="selected"]`],
161
+ invalid: [`[aria-invalid="true"]`, `[data-xs~="invalid"]`],
162
+ dragover: [`[data-dragover]`, `[data-xs~="dragover"]`]
163
+ };
164
+ function stateSuffixes(states) {
165
+ let out = [``];
166
+ for (const state of states) {
167
+ const alts = STATE_SELECTORS[state] ?? [`[data-xs~="${state}"]`];
168
+ out = out.flatMap((prefix) => alts.map((alt) => prefix + alt));
169
+ }
170
+ return out;
171
+ }
172
+ var propAttribute = (macro, prop) => `data-${macro ? `m` : `r`}-${kebab(prop)}`;
173
+ function propSelector(when, macro) {
174
+ if (!when)
175
+ return [``];
176
+ let out = [``];
177
+ for (const [key, want] of Object.entries(when)) {
178
+ if (key === `state`)
179
+ continue;
180
+ const values = Array.isArray(want) ? want : [want];
181
+ out = out.flatMap((prefix) => values.map((v) => `${prefix}[${propAttribute(macro, key)}="${String(v)}"]`));
182
+ }
183
+ return out;
184
+ }
185
+ function ruleSelectors(base, rule, macro = false) {
186
+ const states = rule.when?.state === undefined ? [] : Array.isArray(rule.when.state) ? rule.when.state.map(String) : [String(rule.when.state)];
187
+ const props = propSelector(rule.when, macro);
188
+ const suffixes = stateSuffixes(states);
189
+ return props.flatMap((p) => suffixes.map((s) => `${base}${p}${s}`));
190
+ }
191
+ function hash(text) {
192
+ let h = 2166136261;
193
+ for (let i = 0;i < text.length; i++) {
194
+ h ^= text.charCodeAt(i);
195
+ h = Math.imul(h, 16777619);
196
+ }
197
+ return (h >>> 0).toString(36);
198
+ }
199
+ function themeScope(theme) {
200
+ return `xui-t-${theme.id.replace(/[^a-z0-9-]/gi, `-`)}-${hash(JSON.stringify(theme))}`;
201
+ }
202
+ var SHADCN_ALIASES = [
203
+ [`--background`, `background`],
204
+ [`--foreground`, `foreground`],
205
+ [`--card`, `card`],
206
+ [`--card-foreground`, `cardForeground`],
207
+ [`--popover`, `popover`],
208
+ [`--popover-foreground`, `popoverForeground`],
209
+ [`--primary`, `primary`],
210
+ [`--primary-foreground`, `primaryForeground`],
211
+ [`--secondary`, `secondary`],
212
+ [`--secondary-foreground`, `secondaryForeground`],
213
+ [`--muted`, `muted`],
214
+ [`--muted-foreground`, `mutedForeground`],
215
+ [`--accent`, `accent`],
216
+ [`--accent-foreground`, `accentForeground`],
217
+ [`--destructive`, `destructive`],
218
+ [`--destructive-foreground`, `destructiveForeground`],
219
+ [`--success`, `success`],
220
+ [`--success-foreground`, `successForeground`],
221
+ [`--warning`, `warning`],
222
+ [`--warning-foreground`, `warningForeground`],
223
+ [`--info`, `info`],
224
+ [`--info-foreground`, `infoForeground`],
225
+ [`--border`, `border`],
226
+ [`--input`, `input`],
227
+ [`--ring`, `ring`],
228
+ [`--chart-1`, `chart1`],
229
+ [`--chart-2`, `chart2`],
230
+ [`--chart-3`, `chart3`],
231
+ [`--chart-4`, `chart4`],
232
+ [`--chart-5`, `chart5`],
233
+ [`--chart-6`, `chart6`],
234
+ [`--chart-7`, `chart7`],
235
+ [`--chart-8`, `chart8`],
236
+ [`--sidebar`, `background`],
237
+ [`--sidebar-foreground`, `foreground`],
238
+ [`--sidebar-primary`, `primary`],
239
+ [`--sidebar-primary-foreground`, `primaryForeground`],
240
+ [`--sidebar-accent`, `accent`],
241
+ [`--sidebar-accent-foreground`, `accentForeground`],
242
+ [`--sidebar-border`, `border`],
243
+ [`--sidebar-ring`, `ring`],
244
+ [`--glass-fill-section`, `muted`],
245
+ [`--glass-fill-row`, `muted`],
246
+ [`--glass-fill-card`, `card`],
247
+ [`--glass-fill-panel`, `popover`],
248
+ [`--glass-fill-active`, `accent`],
249
+ [`--glass-stroke-row`, `border`],
250
+ [`--glass-stroke-section`, `border`],
251
+ [`--glass-stroke-card`, `border`],
252
+ [`--glass-stroke-strong`, `input`],
253
+ [`--glass-stroke-active`, `ring`],
254
+ [`--glass-background-top`, `background`],
255
+ [`--glass-background-bottom`, `background`]
256
+ ];
257
+ function tokenBlock(theme) {
258
+ const decls = [];
259
+ const tokens = theme.tokens;
260
+ for (const group of [`spacing`, `radius`, `control`, `opacity`, `border`, `motion`]) {
261
+ for (const [name, value] of Object.entries(tokens[group] ?? {})) {
262
+ const unit = group === `opacity` ? `` : group === `motion` ? `ms` : `px`;
263
+ decls.push([`--xui-${group}-${name}`, `${value}${unit}`]);
264
+ }
265
+ }
266
+ for (const [name, px] of Object.entries(theme.tokens.blur ?? {}))
267
+ decls.push([`--xui-blur-${name}`, `${px}px`]);
268
+ for (const [name, value] of Object.entries(theme.tokens.scale ?? {}))
269
+ decls.push([`--xui-scale-${name}`, String(value)]);
270
+ for (const [name, curve] of Object.entries(theme.tokens.ease ?? {}))
271
+ decls.push([`--xui-ease-${name}`, easingCss(curve)]);
272
+ for (const [name, px] of Object.entries(theme.tokens.breakpoint ?? {}))
273
+ decls.push([`--xui-breakpoint-${name}`, `${px}px`]);
274
+ for (const [name, value] of Object.entries(theme.tokens.type.size))
275
+ decls.push([`--xui-type-size-${name}`, `${value}px`]);
276
+ for (const [name, value] of Object.entries(theme.tokens.type.lineHeight))
277
+ decls.push([`--xui-type-lineHeight-${name}`, `${value}px`]);
278
+ for (const [name, value] of Object.entries(theme.tokens.type.weight))
279
+ decls.push([`--xui-type-weight-${name}`, String(value)]);
280
+ for (const [name, family] of Object.entries(theme.tokens.type.family))
281
+ decls.push([`--xui-font-${name}`, fontStack(family, theme.fonts)]);
282
+ decls.push([`--radius`, `var(--xui-radius-lg)`], [`--font-sans`, `var(--xui-font-sans)`], [`--font-mono`, `var(--xui-font-mono)`]);
283
+ decls.push([`--xui-duration-fast`, `var(--xui-motion-fast)`], [`--xui-duration-standard`, `var(--xui-motion-standard)`]);
284
+ return decls.map(([p, v]) => `${p}:${v}`).join(`;`);
285
+ }
286
+ function modeBlock(theme, mode) {
287
+ const decls = [];
288
+ for (const [name, hex] of Object.entries(theme.modes[mode].color))
289
+ decls.push([`--xui-color-${name}`, hex]);
290
+ for (const [name, layers] of Object.entries(theme.modes[mode].shadow))
291
+ decls.push([`--xui-shadow-${name}`, shadowCss(layers)]);
292
+ for (const [alias, token] of SHADCN_ALIASES)
293
+ decls.push([alias, `var(--xui-color-${token})`]);
294
+ decls.push([`color-scheme`, mode]);
295
+ return decls.map(([p, v]) => `${p}:${v}`).join(`;`);
296
+ }
297
+ var MACROS = new Set(Object.entries(coreCatalog.components).filter(([, d]) => d.kind === `macro`).map(([n]) => n));
298
+ function isMacroComponent(component, extensionMacros = new Set) {
299
+ return MACROS.has(component) || extensionMacros.has(component);
300
+ }
301
+ var partClass = (component, part) => `xui-${component}-${part}`;
302
+ function compileTheme(theme, options = {}) {
303
+ const scope = themeScope(theme);
304
+ const root = `.xui-surface.${scope}`;
305
+ const chunks = [LAYERS];
306
+ chunks.push(`${root}{${tokenBlock(theme)}}`);
307
+ chunks.push(`${root}[data-xui-mode="light"]{${modeBlock(theme, `light`)}}`);
308
+ chunks.push(`${root}[data-xui-mode="dark"]{${modeBlock(theme, `dark`)}}`);
309
+ const recipe = [];
310
+ const part = [];
311
+ for (const [component, parts] of Object.entries(theme.recipes)) {
312
+ const macro = isMacroComponent(component, options.extensionMacros);
313
+ const target = macro ? part : recipe;
314
+ for (const [partName, rules] of Object.entries(parts)) {
315
+ const base = `.${scope}.${partClass(component, partName)}`;
316
+ for (const r of rules) {
317
+ const decls = declarations(r.style, theme.fonts);
318
+ if (decls.length === 0)
319
+ continue;
320
+ const selector = ruleSelectors(base, r, macro).join(`,`);
321
+ target.push(rule(selector, decls) + shimmerRule(selector, r.style));
322
+ }
323
+ }
324
+ }
325
+ chunks.push(`@layer xui-recipe{${recipe.join(``)}}`);
326
+ chunks.push(`@layer xui-part{${part.join(``)}}`);
327
+ return { scope, css: chunks.join(`
328
+ `), theme };
329
+ }
330
+ var cache = new WeakMap;
331
+ function compiledTheme(theme, options) {
332
+ if (options?.extensionMacros && options.extensionMacros.size > 0)
333
+ return compileTheme(theme, options);
334
+ let hit = cache.get(theme);
335
+ if (!hit) {
336
+ hit = compileTheme(theme);
337
+ cache.set(theme, hit);
338
+ }
339
+ return hit;
340
+ }
341
+ function globalsCss(theme, options = {}) {
342
+ const block = (mode, shared) => {
343
+ const color = theme.modes[mode].color;
344
+ const decls = [];
345
+ for (const [alias, token] of SHADCN_ALIASES)
346
+ if (color[token] !== undefined)
347
+ decls.push([alias, color[token]]);
348
+ if (shared) {
349
+ const radius = theme.tokens.radius.lg;
350
+ if (radius !== undefined)
351
+ decls.push([`--radius`, `${radius}px`]);
352
+ for (const name of [`sans`, `mono`]) {
353
+ const family = theme.tokens.type.family[name];
354
+ if (family)
355
+ decls.push([`--font-${name}`, fontStack(family, theme.fonts)]);
356
+ }
357
+ }
358
+ return decls.map(([p, v]) => ` ${p}: ${v};`).join(`
359
+ `);
360
+ };
361
+ return `${options.light ?? `:root`} {
362
+ ${block(`light`, true)}
363
+ }
364
+
365
+ ${options.dark ?? `.dark`} {
366
+ ${block(`dark`, false)}
367
+ }
368
+ `;
369
+ }
370
+ // packages/exponential-ui/src/web/box-css.ts
371
+ import { parseMediaCondition, parseTokenRef as parseTokenRef2 } from "@exponential-at/ui";
372
+
373
+ // packages/exponential-ui/src/web/data.ts
374
+ import { CORE_FUNCTIONS, DEFAULT_LOCALE, FORMAT_FUNCTION_NAMES, displayString, formatFunctions, hasRowSlots, intlFormatter, isDataSchema, resolveString, sharedCatalogView, truthy, writePointer } from "@exponential-at/ui";
375
+ function isBinding(value) {
376
+ return typeof value === `object` && value !== null && !Array.isArray(value) && typeof value.path === `string` && Object.keys(value).length === 1;
377
+ }
378
+ function isCall(value) {
379
+ return typeof value === `object` && value !== null && !Array.isArray(value) && typeof value.call === `string`;
380
+ }
381
+ var unescape = (token) => token.replace(/~1/g, `/`).replace(/~0/g, `~`);
382
+ function pointerTokens(pointer) {
383
+ if (pointer === `` || pointer === `/`)
384
+ return [];
385
+ return (pointer.startsWith(`/`) ? pointer.slice(1) : pointer).split(`/`).map(unescape);
386
+ }
387
+ function absolutePath(path, scope = ``) {
388
+ if (path.startsWith(`/`))
389
+ return path;
390
+ if (!scope)
391
+ return `/${path}`;
392
+ return path === `` ? scope : `${scope}/${path}`;
393
+ }
394
+ function getPointer(data, pointer) {
395
+ let cur = data;
396
+ for (const token of pointerTokens(pointer)) {
397
+ if (cur === null || typeof cur !== `object`)
398
+ return;
399
+ if (Array.isArray(cur))
400
+ cur = /^[0-9]+$/.test(token) ? cur[Number(token)] : undefined;
401
+ else
402
+ cur = Object.prototype.hasOwnProperty.call(cur, token) ? cur[token] : undefined;
403
+ }
404
+ return cur;
405
+ }
406
+ function setPointer(data, pointer, value) {
407
+ return writePointer(data, pointer, value).data;
408
+ }
409
+ var LITERAL_ROWS_ROOT = `/$xuiRows`;
410
+ function hostPath(path) {
411
+ return path === undefined || path === LITERAL_ROWS_ROOT || path.startsWith(`${LITERAL_ROWS_ROOT}/`) ? undefined : path;
412
+ }
413
+ var num = (v) => typeof v === `number` ? v : Number(v);
414
+ function interpolate(text, ctx) {
415
+ return text.replace(/\$\{([^}]+)\}/g, (_, expr) => {
416
+ return displayString(getPointer(ctx.data, absolutePath(expr.trim(), ctx.scope)));
417
+ });
418
+ }
419
+ function memoFormatter(base, max = 4096) {
420
+ const hits = new Map;
421
+ const memo = (key, run) => {
422
+ const hit = hits.get(key);
423
+ if (hit !== undefined)
424
+ return hit;
425
+ const out = run();
426
+ if (hits.size >= max)
427
+ hits.clear();
428
+ hits.set(key, out);
429
+ return out;
430
+ };
431
+ const valueKey = (v) => v instanceof Date ? `t${v.getTime()}` : typeof v === `string` ? `s${v}` : `${typeof v}${String(v)}`;
432
+ return {
433
+ locale: base.locale,
434
+ number: (value, o) => memo(`n|${value}|${o?.decimals}|${o?.grouping}`, () => base.number(value, o)),
435
+ currency: (value, currency, o) => memo(`c|${currency}|${value}|${o?.decimals}|${o?.grouping}`, () => base.currency(value, currency, o)),
436
+ percent: (value, o) => memo(`p|${value}|${o?.decimals}`, () => base.percent(value, o)),
437
+ date: (value, o) => memo(`d|${o?.format}|${o?.style}|${o?.time}|${valueKey(value)}`, () => base.date(value, o)),
438
+ relativeTime: (value, now) => base.relativeTime(value, now),
439
+ plural: (value) => memo(`l|${value}`, () => base.plural(value))
440
+ };
441
+ }
442
+ var formatterCache = new Map;
443
+ function formatterOf(ctx) {
444
+ if (ctx.formatter)
445
+ return ctx.formatter;
446
+ const locale = ctx.locale ?? DEFAULT_LOCALE;
447
+ let hit = formatterCache.get(locale);
448
+ if (!hit)
449
+ formatterCache.set(locale, hit = memoFormatter(intlFormatter(locale, `UTC`)));
450
+ return hit;
451
+ }
452
+ var formatTables = new WeakMap;
453
+ function formatCall(name) {
454
+ return (args, ctx) => {
455
+ const formatter = formatterOf(ctx);
456
+ let hit = formatTables.get(formatter);
457
+ if (!hit || hit.now !== ctx.now)
458
+ formatTables.set(formatter, hit = { now: ctx.now, table: formatFunctions(formatter, ctx.now) });
459
+ return hit.table[name](args);
460
+ };
461
+ }
462
+ var FORMAT = Object.fromEntries(FORMAT_FUNCTION_NAMES.map((name) => [name, formatCall(name)]));
463
+ var CORE = Object.fromEntries(Object.entries(CORE_FUNCTIONS).map(([name, fn]) => [name, (args) => fn(args)]));
464
+ var CLIENT_FUNCTIONS = {
465
+ required: ({ value }) => truthy(value) && !(Array.isArray(value) && value.length === 0),
466
+ regex: ({ value, pattern }) => {
467
+ try {
468
+ return new RegExp(String(pattern)).test(String(value ?? ``));
469
+ } catch {
470
+ return false;
471
+ }
472
+ },
473
+ length: ({ value, min, max }) => {
474
+ const n = String(value ?? ``).length;
475
+ return (min === undefined || n >= num(min)) && (max === undefined || n <= num(max));
476
+ },
477
+ numeric: ({ value, min, max }) => {
478
+ const n = num(value);
479
+ return Number.isFinite(n) && (min === undefined || n >= num(min)) && (max === undefined || n <= num(max));
480
+ },
481
+ email: ({ value }) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value ?? ``)),
482
+ formatString: ({ value }, ctx) => interpolate(String(value ?? ``), ctx),
483
+ openUrl: ({ url }, ctx) => {
484
+ if (typeof url === `string`)
485
+ ctx.openUrl?.(url);
486
+ return;
487
+ },
488
+ and: ({ values }) => Array.isArray(values) ? values.every(truthy) : false,
489
+ or: ({ values }) => Array.isArray(values) ? values.some(truthy) : false,
490
+ not: ({ value }) => !truthy(value),
491
+ ...CORE,
492
+ ...FORMAT
493
+ };
494
+ function resolveValue(value, ctx) {
495
+ if (isBinding(value))
496
+ return getPointer(ctx.data, absolutePath(value.path, ctx.scope));
497
+ if (isCall(value)) {
498
+ const fn = ctx.functions?.[value.call] ?? CLIENT_FUNCTIONS[value.call];
499
+ if (!fn)
500
+ return;
501
+ const args = {};
502
+ for (const [k, v] of Object.entries(value.args ?? {}))
503
+ args[k] = resolveValue(v, ctx);
504
+ return fn(args, ctx);
505
+ }
506
+ if (typeof value === `string`)
507
+ return ctx.strings && value.startsWith(`$string.`) ? resolveString(value, ctx.strings) : value;
508
+ if (Array.isArray(value))
509
+ return value.map((item) => resolveValue(item, ctx));
510
+ if (typeof value === `object` && value !== null) {
511
+ const out = {};
512
+ for (const [k, v] of Object.entries(value))
513
+ out[k] = resolveValue(v, ctx);
514
+ return out;
515
+ }
516
+ return value;
517
+ }
518
+ function resolveProps(props, ctx) {
519
+ return resolveValue(props, ctx);
520
+ }
521
+ function viewOf(extensions) {
522
+ return sharedCatalogView(extensions);
523
+ }
524
+ var isPlainObject = (v) => typeof v === `object` && v !== null && !Array.isArray(v);
525
+ function resolveAlong(value, schema, ctx, defs) {
526
+ if (isBinding(value) || isCall(value))
527
+ return resolveValue(value, ctx);
528
+ if (isDataSchema(schema))
529
+ return value;
530
+ if (schema?.type === `array` && schema.items && Array.isArray(value))
531
+ return value.map((item) => resolveAlong(item, schema.items, ctx, defs));
532
+ const shape = schema?.type === `object` && schema.shape ? defs[schema.shape] : undefined;
533
+ if (shape && isPlainObject(value)) {
534
+ const out = {};
535
+ for (const [k, v] of Object.entries(value))
536
+ out[k] = resolveAlong(v, shape.properties[k], ctx, defs);
537
+ return out;
538
+ }
539
+ return resolveValue(value, ctx);
540
+ }
541
+ function resolveNodeProps(component, props, ctx, extensions) {
542
+ const view = viewOf(extensions);
543
+ const def = view.components[component];
544
+ const out = {};
545
+ for (const [k, v] of Object.entries(props)) {
546
+ const r = resolveAlong(v, def?.props[k], ctx, view.defs);
547
+ if (r !== undefined)
548
+ out[k] = r;
549
+ }
550
+ return out;
551
+ }
552
+ function boundPath(props, name, scope = ``) {
553
+ const raw = props[name];
554
+ return isBinding(raw) ? absolutePath(raw.path, scope) : undefined;
555
+ }
556
+ function resolveVisible(visible, ctx) {
557
+ if (visible === undefined)
558
+ return true;
559
+ return truthy(resolveValue(visible, ctx));
560
+ }
561
+ function hasDynamic(value) {
562
+ if (isBinding(value) || isCall(value))
563
+ return true;
564
+ if (Array.isArray(value))
565
+ return value.some(hasDynamic);
566
+ if (typeof value === `object` && value !== null)
567
+ return Object.values(value).some(hasDynamic);
568
+ return false;
569
+ }
570
+ function resolveAccessibility(accessibility, ctx) {
571
+ if (!accessibility || typeof accessibility !== `object`)
572
+ return null;
573
+ const out = {};
574
+ for (const [k, v] of Object.entries(resolveValue(accessibility, ctx)))
575
+ if (v !== undefined)
576
+ out[k] = v;
577
+ return Object.keys(out).length ? out : null;
578
+ }
579
+ function ariaAttributes(a11y) {
580
+ const out = {};
581
+ if (!a11y)
582
+ return out;
583
+ const role = a11y.role;
584
+ if (role === `hidden`)
585
+ out[`aria-hidden`] = `true`;
586
+ else if (typeof role === `string` && role !== `text` && role !== ``)
587
+ out.role = role;
588
+ if (a11y.label !== undefined && a11y.label !== null && a11y.label !== ``)
589
+ out[`aria-label`] = String(a11y.label);
590
+ if (a11y.description !== undefined && a11y.description !== null && a11y.description !== ``)
591
+ out[`aria-description`] = String(a11y.description);
592
+ if (typeof a11y.level === `number` || typeof a11y.level === `string` && a11y.level !== ``)
593
+ out[`aria-level`] = String(a11y.level);
594
+ for (const [key, attr] of [[`expanded`, `aria-expanded`], [`selected`, `aria-selected`], [`pressed`, `aria-pressed`], [`checked`, `aria-checked`]]) {
595
+ const v = a11y[key];
596
+ if (typeof v === `boolean` || v === `mixed`)
597
+ out[attr] = String(v);
598
+ }
599
+ if (a11y.current !== undefined && a11y.current !== null && a11y.current !== false && a11y.current !== ``)
600
+ out[`aria-current`] = a11y.current === true ? `true` : String(a11y.current);
601
+ for (const [key, attr] of [[`valueNow`, `aria-valuenow`], [`valueMin`, `aria-valuemin`], [`valueMax`, `aria-valuemax`]]) {
602
+ const v = a11y[key];
603
+ if (typeof v === `number` && Number.isFinite(v))
604
+ out[attr] = String(v);
605
+ }
606
+ if (a11y.hidden === true)
607
+ out[`aria-hidden`] = `true`;
608
+ if (a11y.autoFocus === true)
609
+ out[`data-xui-autofocus`] = ``;
610
+ return out;
611
+ }
612
+ function bindTree(node, ctx, extensions) {
613
+ if (!resolveVisible(node.visible, ctx))
614
+ return null;
615
+ const out = { id: node.id, component: node.component, props: resolveNodeProps(node.component, node.props, ctx, extensions), children: [] };
616
+ if (node.style)
617
+ out.style = resolveValue(node.style, ctx);
618
+ if (node.on)
619
+ out.on = node.on;
620
+ if (node.accessibility) {
621
+ const a11y = resolveAccessibility(node.accessibility, ctx);
622
+ if (a11y)
623
+ out.accessibility = a11y;
624
+ }
625
+ for (const child of node.children) {
626
+ const bound = bindTree(child, ctx, extensions);
627
+ if (bound)
628
+ out.children.push(bound);
629
+ }
630
+ if (node.slots) {
631
+ if (hasRowSlots(viewOf(extensions).components[node.component]))
632
+ out.slots = node.slots;
633
+ else
634
+ for (const [name, slot] of Object.entries(node.slots)) {
635
+ const bound = bindTree(slot, ctx, extensions);
636
+ if (bound)
637
+ (out.slots ??= {})[name] = bound;
638
+ }
639
+ }
640
+ if (node.template)
641
+ out.template = node.template;
642
+ if (node.recipe)
643
+ out.recipe = { ...node.recipe, props: resolveValue(node.recipe.props, ctx) };
644
+ return out;
645
+ }
646
+
647
+ // packages/exponential-ui/src/web/box-css.ts
648
+ var nodeClass = (id) => `xui-n-${cssEscape(id)}`;
649
+ var surfaceClass = (surfaceId) => `xui-s-${cssEscape(surfaceId)}`;
650
+ function cssEscape(text) {
651
+ return text.replace(/[^a-zA-Z0-9_-]/g, (c) => `_${c.charCodeAt(0).toString(16)}_`);
652
+ }
653
+ function* walkNodes(root) {
654
+ yield root;
655
+ for (const slot of Object.values(root.slots ?? {}))
656
+ yield* walkNodes(slot);
657
+ for (const child of root.children)
658
+ yield* walkNodes(child);
659
+ }
660
+ function dynamicStyleEntries(style) {
661
+ const out = [];
662
+ if (!style)
663
+ return out;
664
+ const visit = (block, s) => {
665
+ for (const [key, value] of Object.entries(s)) {
666
+ if (key.startsWith(`@`) || key.startsWith(`:`))
667
+ continue;
668
+ if (hasDynamic(value))
669
+ out.push({ name: `--xd-${out.length}`, block, key, value });
670
+ }
671
+ };
672
+ visit(``, style);
673
+ for (const [key, value] of Object.entries(style)) {
674
+ if ((key.startsWith(`@`) || key.startsWith(`:`)) && typeof value === `object` && value !== null)
675
+ visit(key, value);
676
+ }
677
+ return out;
678
+ }
679
+ function queryToken(key) {
680
+ return cssEscape(key.replace(/^@media \(|\)$/g, ``).replace(/: /, `-`));
681
+ }
682
+ function resolvedMediaKey(key, theme) {
683
+ const condition = parseMediaCondition(key);
684
+ if (!condition)
685
+ return null;
686
+ if (condition.feature === `orientation` || condition.feature === `hover` || condition.feature === `prefers-reduced-motion`)
687
+ return key;
688
+ const px = breakpointPx(condition.value, theme);
689
+ return px === null ? null : `@media (${condition.feature}: ${px}px)`;
690
+ }
691
+ var isDirection = (v) => v === `ltr` || v === `rtl`;
692
+ function styleDirection(style, theme, matches) {
693
+ if (!style)
694
+ return;
695
+ let out = isDirection(style.direction) ? style.direction : undefined;
696
+ for (const [key, value] of Object.entries(style)) {
697
+ if (!key.startsWith(`@`) || typeof value !== `object` || value === null)
698
+ continue;
699
+ const d = value.direction;
700
+ if (!isDirection(d))
701
+ continue;
702
+ const resolved = resolvedMediaKey(key, theme);
703
+ if (resolved && matches(resolved))
704
+ out = d;
705
+ }
706
+ return out;
707
+ }
708
+ function breakpointPx(value, theme) {
709
+ const ref = parseTokenRef2(value);
710
+ if (ref) {
711
+ if (ref.group !== `breakpoint`)
712
+ return null;
713
+ const px = theme?.tokens.breakpoint?.[ref.name];
714
+ return typeof px === `number` ? px : null;
715
+ }
716
+ const n = parseFloat(value);
717
+ return Number.isFinite(n) ? n : null;
718
+ }
719
+ var chunkCache = new WeakMap;
720
+ function nodeChunk(node, style, scope, theme, fonts) {
721
+ const hit = chunkCache.get(node);
722
+ if (hit && hit.scope === scope && hit.theme === theme && hit.fonts === fonts)
723
+ return hit.chunk;
724
+ const rules = [];
725
+ const queries = new Set;
726
+ const dyn = dynamicStyleEntries(style);
727
+ const withVars = (block, s) => {
728
+ const mine = dyn.filter((d) => d.block === block);
729
+ if (mine.length === 0)
730
+ return s;
731
+ const copy = { ...s };
732
+ for (const d of mine)
733
+ copy[d.key] = `var(${d.name})`;
734
+ return copy;
735
+ };
736
+ const cls = nodeClass(node.id);
737
+ const sel = `${scope} .${cls}`;
738
+ const own = withVars(``, style);
739
+ const base = declarations(own, fonts);
740
+ if (base.length)
741
+ rules.push(rule(sel, base) + shimmerRule(sel, style));
742
+ for (const [key, value] of Object.entries(style)) {
743
+ if (!key.startsWith(`@`) || typeof value !== `object` || value === null)
744
+ continue;
745
+ const block = declarations(withVars(key, value), fonts, own);
746
+ if (block.length === 0)
747
+ continue;
748
+ const condition = parseMediaCondition(key);
749
+ if (!condition)
750
+ continue;
751
+ if (isDirection(value.direction)) {
752
+ const resolved = resolvedMediaKey(key, theme);
753
+ if (resolved)
754
+ queries.add(resolved);
755
+ }
756
+ const band = (selector) => shimmerRule(selector, value);
757
+ switch (condition.feature) {
758
+ case `min-width`:
759
+ case `max-width`: {
760
+ const px = breakpointPx(condition.value, theme);
761
+ if (px === null)
762
+ break;
763
+ const op = condition.feature === `min-width` ? `>=` : `<`;
764
+ rules.push(`@container xui (width ${op} ${px}px){${rule(sel, block)}${band(sel)}}`);
765
+ break;
766
+ }
767
+ case `min-height`:
768
+ case `max-height`: {
769
+ const px = breakpointPx(condition.value, theme);
770
+ if (px === null)
771
+ break;
772
+ const resolved = `@media (${condition.feature}: ${px}px)`;
773
+ queries.add(resolved);
774
+ const q = `${scope}:where([data-xq~="${queryToken(resolved)}"]) .${cls}`;
775
+ rules.push(rule(q, block) + band(q));
776
+ break;
777
+ }
778
+ case `orientation`:
779
+ queries.add(key);
780
+ const q = `${scope}:where([data-xq~="${queryToken(key)}"]) .${cls}`;
781
+ rules.push(rule(q, block) + band(q));
782
+ break;
783
+ case `hover`:
784
+ case `prefers-reduced-motion`:
785
+ rules.push(`@media (${condition.feature}: ${condition.value}){${rule(sel, block)}${band(sel)}}`);
786
+ break;
787
+ }
788
+ }
789
+ const states = [
790
+ [`:hover`, `${sel}:hover,${sel}[data-xs~="hover"]`],
791
+ [`:focus-visible`, `${sel}:focus-visible,${sel}[data-xs~="focus-visible"]`],
792
+ [`:pressed`, `${sel}:active,${sel}[data-xs~="pressed"]`]
793
+ ];
794
+ for (const [key, selector] of states) {
795
+ const value = style[key];
796
+ if (typeof value !== `object` || value === null)
797
+ continue;
798
+ const block = declarations(withVars(key, value), fonts, own);
799
+ if (block.length)
800
+ rules.push(rule(selector, block) + shimmerRule(selector, value));
801
+ }
802
+ const chunk = { css: rules.join(``), queries: [...queries] };
803
+ chunkCache.set(node, { scope, theme, fonts, chunk });
804
+ return chunk;
805
+ }
806
+ function compileNodeSheet(roots, surfaceId, theme, fonts = theme?.fonts ?? {}) {
807
+ const scope = `.${surfaceClass(surfaceId)}`;
808
+ const chunks = new Map;
809
+ const queries = new Set;
810
+ const seen = new Set;
811
+ for (const root of roots) {
812
+ for (const node of walkNodes(root)) {
813
+ const style = node.style;
814
+ if (!style || seen.has(node.id))
815
+ continue;
816
+ seen.add(node.id);
817
+ const chunk = nodeChunk(node, style, scope, theme, fonts);
818
+ if (chunk.css)
819
+ chunks.set(node.id, chunk.css);
820
+ for (const q of chunk.queries)
821
+ queries.add(q);
822
+ }
823
+ }
824
+ return { css: `@layer xui-node{${[...chunks.values()].join(``)}}`, queries: [...queries], chunks };
825
+ }
826
+ var sheetBatch = (chunks) => ({ chunks, css: `@layer xui-node{${[...chunks.values()].join(``)}}` });
827
+ function nodeSheetBatches(prev, chunks) {
828
+ const out = [];
829
+ const placed = new Set;
830
+ for (const b of prev) {
831
+ let dirty = false;
832
+ for (const [id, css] of b.chunks) {
833
+ placed.add(id);
834
+ if (chunks.get(id) !== css)
835
+ dirty = true;
836
+ }
837
+ if (!dirty) {
838
+ out.push(b);
839
+ continue;
840
+ }
841
+ const kept = new Map;
842
+ for (const id of b.chunks.keys()) {
843
+ const css = chunks.get(id);
844
+ if (css !== undefined)
845
+ kept.set(id, css);
846
+ }
847
+ if (kept.size)
848
+ out.push(sheetBatch(kept));
849
+ }
850
+ const fresh = new Map;
851
+ for (const [id, css] of chunks)
852
+ if (!placed.has(id))
853
+ fresh.set(id, css);
854
+ if (fresh.size)
855
+ out.push(sheetBatch(fresh));
856
+ while (out.length > 1 && out[out.length - 1].chunks.size >= out[out.length - 2].chunks.size) {
857
+ const last = out.pop();
858
+ const before = out.pop();
859
+ out.push(sheetBatch(new Map([...before.chunks, ...last.chunks])));
860
+ }
861
+ return out;
862
+ }
863
+ function nodeSheet(root, surfaceId, fontsOrTheme = {}, extra = []) {
864
+ const theme = isTheme(fontsOrTheme) ? fontsOrTheme : undefined;
865
+ const fonts = theme ? theme.fonts : fontsOrTheme;
866
+ return compileNodeSheet([root, ...extra], surfaceId, theme, fonts).css;
867
+ }
868
+ function isTheme(v) {
869
+ return typeof v === `object` && v !== null && `tokens` in v && `modes` in v;
870
+ }
871
+ // packages/exponential-ui/src/web/base-css.ts
872
+ import { ANIMATION_NAMES, ANIMATION_PROPERTIES_CSS, RTL_MIRRORED_ICONS, SEARCH_LIST_FADE, SKELETON_OPACITY_HIGH, SKELETON_OPACITY_LOW, SKELETON_PULSE_MS, SKELETON_REDUCED_OPACITY, TEXT_SHIMMER, keyframesCss } from "@exponential-at/ui";
873
+ var S = TEXT_SHIMMER;
874
+ var SHIMMER_CSS = `@keyframes xui-shimmer{from{background-position:100% 0}to{background-position:0 0}}
875
+ [data-xui-shimmer]{--_spread:${S.spreadPx}px;--_base:currentColor;--_highlight:oklch(from currentColor l c h / calc(alpha * ${S.lightAlphaFactor}));background-image:linear-gradient(calc(90deg + ${S.angleDeg}deg),var(--_base) calc(50% - var(--_spread)),color-mix(in oklab,var(--_highlight),var(--_base) 50%) calc(50% - var(--_spread) * .5),var(--_highlight) 50%,color-mix(in oklab,var(--_highlight),var(--_base) 50%) calc(50% + var(--_spread) * .5),var(--_base) calc(50% + var(--_spread)));background-repeat:no-repeat;background-size:calc(200% + var(--_spread) * 2) 100%;background-position:0 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:xui-shimmer ${S.durationMs}ms linear infinite}
876
+ [data-xui-mode="dark"] [data-xui-shimmer]{--_highlight:oklch(from currentColor min(1, max(${S.highlightLightnessMin}, calc(l + ${S.highlightLightnessBoost}))) c h / min(1, calc(alpha + ${S.highlightAlphaBoost})))}
877
+ [dir="rtl"] [data-xui-shimmer]{animation-direction:reverse}`;
878
+ var REDUCED_EXTRA = `.xui-surface [data-xui-shimmer]{animation:none !important;background-image:none !important;-webkit-text-fill-color:currentColor !important}.xui-surface [data-xui-c="Button"].xui-el:active{scale:none !important}.xui-surface [data-xui-c="Skeleton"].xui-el:not([data-rows]),.xui-surface .xui-Skeleton-dot,.xui-surface .xui-Skeleton-bar{animation:none !important;opacity:${SKELETON_REDUCED_OPACITY} !important}`;
879
+ var ROUND2_CSS = `${ANIMATION_NAMES.map(keyframesCss).join(`
880
+ `)}
881
+ :is(${RTL_MIRRORED_ICONS.map((n) => `svg[data-icon="${n}"]`).join(`,`)}):dir(rtl){scale:-1 1}`;
882
+ var BASE_CSS = `${ANIMATION_PROPERTIES_CSS}
883
+ @layer xui-base{
884
+ ${ROUND2_CSS}
885
+ .xui-surface{display:block;position:relative;font-family:var(--xui-font-sans);color:var(--xui-color-foreground);font-size:var(--xui-type-size-sm);line-height:var(--xui-type-lineHeight-sm);-webkit-font-smoothing:antialiased}
886
+ .xui-surface *{box-sizing:border-box}
887
+ .xui-container{container-type:inline-size;container-name:xui;width:100%;position:relative}
888
+ :where([data-xui-part]){border:0 solid transparent}
889
+ .xui-el{box-sizing:border-box;display:flex;flex-direction:row;position:relative;margin:0;padding:0;border:0 solid transparent;min-width:auto;min-height:auto;font:inherit;color:inherit;background:transparent;text-align:start;text-decoration:none;outline:none;appearance:none;-webkit-appearance:none}
890
+ button:where([data-xui-part],.xui-calendar-nav,.xui-table-sort,.xui-carousel-nav){margin:0;padding:0;border:0 solid transparent;background:transparent;color:inherit;font:inherit;appearance:none;-webkit-appearance:none}
891
+ .xui-el:focus-visible{outline:2px solid var(--xui-color-ring);outline-offset:1px}
892
+ .xui-leaf{flex-direction:column}
893
+ .xui-leaf>.xui-measured{flex-shrink:0}
894
+ [data-xui-c="Text"].xui-el{display:block;white-space:pre-wrap;overflow-wrap:anywhere}
895
+ [data-xui-c="Text"][data-lines="1"].xui-el{white-space:nowrap;overflow:clip;text-overflow:ellipsis;min-width:0}
896
+ [data-xui-c="Text"][data-clamp].xui-el{display:-webkit-box;-webkit-box-orient:vertical;overflow:clip}
897
+ [data-xui-c="Text"][data-xui-align="start"].xui-el{text-align:start}
898
+ [data-xui-c="Text"][data-xui-align="center"].xui-el{text-align:center}
899
+ [data-xui-c="Text"][data-xui-align="end"].xui-el{text-align:end}
900
+ [data-xui-c="Button"].xui-el,[data-xui-c="Toggle"].xui-el,[data-xui-c="Link"].xui-el{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;cursor:pointer;user-select:none;flex-shrink:0;transition:background-color var(--xui-motion-fast) var(--xui-ease-standard,ease),color var(--xui-motion-fast) var(--xui-ease-standard,ease),opacity var(--xui-motion-fast) var(--xui-ease-standard,ease),border-color var(--xui-motion-fast) var(--xui-ease-standard,ease),scale var(--xui-motion-fast) var(--xui-ease-standard,ease)}
901
+ [data-xui-c="Button"].xui-el:disabled,[data-xui-c="Toggle"].xui-el:disabled{cursor:default;pointer-events:none}
902
+ [data-xui-c="Link"].xui-el{text-decoration:underline;text-underline-offset:3px}
903
+ .xui-Button-icon,.xui-Button-spinner,.xui-Toggle-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
904
+ .xui-Button-icon>svg,.xui-Toggle-icon>svg,.xui-Button-spinner>svg,.xui-icon>svg{width:100%;height:100%}
905
+ .xui-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
906
+ [data-xui-c="Icon"].xui-el{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
907
+ [data-xui-c="Icon"].xui-el>svg{width:100%;height:100%}
908
+ [data-xui-c="Image"].xui-el{overflow:clip}
909
+ [data-xui-c="Image"].xui-el>img{display:block;position:absolute;inset:0;width:100%;height:100%}
910
+ .xui-image-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:24px;background:repeating-linear-gradient(45deg,color-mix(in srgb,currentColor 12%,transparent) 0 6px,color-mix(in srgb,currentColor 4%,transparent) 6px 12px);color:var(--xui-color-mutedForeground);font-size:var(--xui-type-size-xs)}
911
+ [data-xui-c="Video"].xui-el{overflow:clip}
912
+ .xui-media-sizer{display:block;max-width:100%;height:0;flex:0 1 auto;visibility:hidden;pointer-events:none}
913
+ [data-xui-c="Video"].xui-el>video{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
914
+ [data-xui-c="AudioPlayer"].xui-el>audio{width:100%;display:block;flex-shrink:0}
915
+ [data-xui-c="Avatar"].xui-el{overflow:clip;flex-shrink:0;align-items:center;justify-content:center}
916
+ .xui-Avatar-image{width:100%;height:100%;object-fit:cover;border-radius:inherit}
917
+ .xui-Avatar-fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:inherit;text-transform:uppercase;user-select:none}
918
+ [data-xui-c="List"].xui-el{flex-direction:column;overflow:auto;min-height:0}
919
+ [data-xui-c="List"][data-r-direction="horizontal"].xui-el{flex-direction:row}
920
+ .xui-List-divider{flex-shrink:0;align-self:stretch;border-style:solid;border-width:0}
921
+ .xui-list-window{position:relative;width:100%;flex-shrink:0}
922
+ .xui-list-window[data-axis="horizontal"]{width:auto;align-self:flex-start}
923
+ .xui-list-item{position:absolute;left:0;right:0}
924
+ .xui-list-window[data-axis="horizontal"]>.xui-list-item{left:auto;right:auto;top:0}
925
+ .xui-list-row{display:flex;flex-direction:column;position:relative}
926
+ .xui-list-row[data-axis="horizontal"]{flex-direction:row}
927
+ .xui-list-gap{position:absolute;display:flex;pointer-events:none}
928
+ .xui-list-gap[data-axis="vertical"]{left:0;right:0;flex-direction:column;transform:translateY(-50%)}
929
+ .xui-list-gap[data-axis="horizontal"]{top:0;bottom:0;flex-direction:row;transform:translateX(-50%)}
930
+ .xui-list-gap[data-axis="horizontal"]:dir(rtl){transform:translateX(50%)}
931
+ .xui-List-section{display:flex;flex-direction:row;align-items:center;flex-shrink:0}
932
+ [data-xui-c="Resizable"].xui-el{flex-direction:row;align-items:stretch;min-width:0;min-height:0}
933
+ [data-xui-c="Resizable"][data-orientation="vertical"].xui-el{flex-direction:column}
934
+ .xui-Resizable-panel{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:clip}
935
+ .xui-Resizable-handle{position:relative;display:flex;align-items:center;justify-content:center;flex:0 0 var(--xui-control-hairline);min-width:0;min-height:0;touch-action:none;user-select:none;outline:none;z-index:1}
936
+ [data-orientation="horizontal"]>.xui-Resizable-handle{cursor:col-resize}
937
+ [data-orientation="vertical"]>.xui-Resizable-handle{cursor:row-resize}
938
+ .xui-Resizable-handle:focus-visible{outline:2px solid var(--xui-color-ring);outline-offset:1px}
939
+ .xui-resize-hit{position:absolute}
940
+ [data-orientation="horizontal"]>.xui-Resizable-handle>.xui-resize-hit{top:0;bottom:0;left:50%;transform:translateX(-50%)}
941
+ [data-orientation="vertical"]>.xui-Resizable-handle>.xui-resize-hit{left:0;right:0;top:50%;transform:translateY(-50%)}
942
+ .xui-Resizable-grip{flex:none;pointer-events:none}
943
+ [data-xui-c="Carousel"].xui-el{flex-direction:column;overflow:clip}
944
+ .xui-carousel-track{display:flex;flex-direction:row;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;gap:var(--xui-spacing-sm)}
945
+ .xui-carousel-track::-webkit-scrollbar{display:none}
946
+ .xui-Carousel-page{flex:0 0 100%;scroll-snap-align:start;display:flex;flex-direction:column}
947
+ .xui-carousel-dots{display:flex;justify-content:center;gap:var(--xui-spacing-xs);padding-top:var(--xui-spacing-sm)}
948
+ .xui-Carousel-indicator{width:6px;height:6px;border-radius:9999px;background:var(--xui-color-border);padding:0;cursor:pointer}
949
+ .xui-Carousel-indicator[data-xs~="selected"]{background:var(--xui-color-primary)}
950
+ [data-xui-c="Tabs"].xui-el{flex-direction:column}
951
+ .xui-Tabs-list{display:flex;flex-direction:row;align-self:flex-start;flex-shrink:0}
952
+ .xui-Tabs-list[data-fill="true"]{align-self:stretch}
953
+ .xui-Tabs-tab{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--xui-spacing-xs);cursor:pointer;white-space:nowrap;flex:0 0 auto;position:relative}
954
+ .xui-Tabs-list[data-fill="true"]>.xui-Tabs-tab{flex:1 1 0}
955
+ .xui-Tabs-tab-body{display:inline-flex;align-items:center;gap:var(--xui-spacing-xs)}
956
+ .xui-Tabs-close,.xui-Tabs-new{display:inline-flex;align-items:center;justify-content:center;align-self:center;flex-shrink:0;cursor:pointer;padding:0;border:0}
957
+ .xui-Tabs-close>svg{width:12px;height:12px}
958
+ .xui-Tabs-new>svg{width:16px;height:16px}
959
+ .xui-Tabs-indicator{position:absolute;left:0;right:0;bottom:0}
960
+ .xui-Tabs-content{display:flex;flex-direction:column;outline:none}
961
+ .xui-Tabs-content[hidden]{display:none}
962
+ [data-xui-c="Segmented"].xui-el{display:inline-flex;align-items:center;align-self:flex-start;flex-wrap:nowrap}
963
+ [data-xui-c="Segmented"][data-r-fill="true"].xui-el,[data-xui-c="Segmented"][data-r-variant="bar"].xui-el{align-self:stretch}
964
+ .xui-Segmented-item{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;white-space:nowrap;flex:0 0 auto;min-width:0}
965
+ [data-xui-c="Segmented"][data-r-fill="true"].xui-el>.xui-Segmented-item,[data-xui-c="Segmented"][data-r-variant="bar"].xui-el>.xui-Segmented-item{flex:1 1 0}
966
+ [data-xui-c="Segmented"][data-r-variant="bar"].xui-el{align-items:stretch;height:var(--xui-control-tabBar);width:100%}
967
+ [data-xui-c="Segmented"][data-r-variant="bar"].xui-el>.xui-Segmented-item{flex-direction:column;gap:var(--xui-spacing-xxs);padding:var(--xui-spacing-xs) 0}
968
+ [data-xui-c="Segmented"][data-r-variant="bar"].xui-el .xui-Segmented-label{font-size:var(--xui-type-size-xs);line-height:var(--xui-type-lineHeight-xs);white-space:nowrap}
969
+ .xui-Segmented-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
970
+ .xui-Segmented-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
971
+ [data-xui-c="Accordion"].xui-el{flex-direction:column}
972
+ .xui-Accordion-item{display:flex;flex-direction:column}
973
+ .xui-Accordion-trigger{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;text-align:start}
974
+ .xui-Accordion-trigger>svg{transition:transform var(--xui-motion-fast) var(--xui-ease-standard,ease)}
975
+ .xui-Accordion-trigger[data-state="open"]>svg{transform:rotate(180deg)}
976
+ .xui-Accordion-content{display:flex;flex-direction:column;overflow:clip}
977
+ .xui-Accordion-content[hidden]{display:none}
978
+ .xui-Dialog-overlay,.xui-Drawer-overlay{position:fixed;inset:0;z-index:50}
979
+ .xui-Dialog-content{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:51;display:flex;flex-direction:column;width:calc(100% - 32px);max-width:480px;max-height:calc(100% - 32px);overflow:auto;outline:none}
980
+ .xui-Drawer-content{position:fixed;z-index:51;display:flex;flex-direction:column;overflow:auto;outline:none}
981
+ .xui-Drawer-content[data-side="bottom"]{left:0;right:0;bottom:0;max-height:85%}
982
+ .xui-Drawer-content[data-side="top"]{left:0;right:0;top:0;max-height:85%}
983
+ .xui-Drawer-content[data-side="left"]{left:0;top:0;bottom:0;width:min(85%,360px)}
984
+ .xui-Drawer-content[data-side="right"]{right:0;top:0;bottom:0;width:min(85%,360px)}
985
+ .xui-Drawer-handle{align-self:center;width:36px;height:4px;border-radius:9999px;background:var(--xui-color-border);flex-shrink:0}
986
+ .xui-overlay-head{display:flex;flex-direction:column;gap:var(--xui-spacing-xxs)}
987
+ .xui-overlay-body{display:flex;flex-direction:column;gap:var(--xui-spacing-md);min-height:0}
988
+ .xui-Dialog-footer,.xui-Drawer-footer{display:flex;flex-direction:row;justify-content:flex-end;flex-wrap:wrap}
989
+ .xui-Dialog-close{position:absolute;top:var(--xui-spacing-sm);inset-inline-end:var(--xui-spacing-sm);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
990
+ .xui-Dialog-close>svg{width:16px;height:16px}
991
+ .xui-Popover-content,.xui-Tooltip-content,.xui-Menu-content,.xui-Select-content,.xui-TimePicker-list{z-index:52;display:flex;flex-direction:column;outline:none;max-height:var(--radix-popper-available-height,320px);overflow:auto}
992
+ .xui-Tooltip-content{max-width:280px}
993
+ .xui-Menu-item,.xui-Select-item,.xui-TimePicker-item{display:flex;align-items:center;cursor:pointer;user-select:none;white-space:nowrap;outline:none}
994
+ .xui-Menu-item[data-disabled],.xui-Select-item[data-disabled],.xui-Select-item[aria-disabled="true"]{pointer-events:none}
995
+ .xui-Menu-item>svg,.xui-Select-item>svg{width:16px;height:16px;flex-shrink:0}
996
+ .xui-Menu-separator{align-self:stretch;flex-shrink:0}
997
+ .xui-Menu-label{display:flex;align-items:center}
998
+ .xui-Menu-trigger{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;flex-shrink:0;cursor:pointer}
999
+ [data-xui-overlay-root].xui-el{flex-direction:row;align-self:auto;align-items:flex-start}
1000
+ [data-xui-overlay-root="stretch"].xui-el{align-items:stretch}
1001
+ [data-xui-overlay-root="none"].xui-el{display:contents}
1002
+ .xui-trigger{display:flex;flex-direction:row;align-items:stretch;flex:1 1 auto;min-width:0}
1003
+ .xui-Tooltip-anchor{display:flex;flex-direction:row;flex:1 1 auto;min-width:0}
1004
+ .xui-field-column{display:flex;flex-direction:column;gap:var(--xui-spacing-xs);min-width:0}
1005
+ .xui-field-row{display:flex;flex-direction:row;align-items:flex-start;gap:var(--xui-spacing-sm);min-width:0}
1006
+ .xui-field-text{display:flex;flex-direction:column;gap:var(--xui-spacing-xxs);min-width:0}
1007
+ [data-xui-c="Input"].xui-el,[data-xui-c="Textarea"].xui-el,[data-xui-c="Select"].xui-el,[data-xui-c="DatePicker"].xui-el,[data-xui-c="DateRangePicker"].xui-el,[data-xui-c="TimePicker"].xui-el,[data-xui-c="NumberField"].xui-el,[data-xui-c="ChipInput"].xui-el,[data-xui-c="FileUpload"].xui-el,[data-xui-c="Slider"].xui-el,[data-xui-c="Radio"].xui-el,[data-xui-c="Composer"].xui-el{flex-direction:column;gap:var(--xui-spacing-xs);min-width:0}
1008
+ [data-xui-c="Checkbox"].xui-el{flex-direction:row;align-items:flex-start;gap:var(--xui-spacing-sm);cursor:pointer}
1009
+ [data-xui-c="Checkbox"].xui-el>.xui-field-text{flex:1 1 0%}
1010
+ .xui-Checkbox-box{margin-top:max(0px,calc((var(--xui-type-lineHeight-sm) - var(--xui-control-checkbox)) / 2))}
1011
+ [data-xui-c="Switch"].xui-el{flex-direction:row;align-items:center;cursor:pointer}
1012
+ .xui-Switch-body{display:flex;flex-direction:column;gap:var(--xui-spacing-xxs);flex:1 1 0%;min-width:0}
1013
+ .xui-Input-field,.xui-Textarea-field{display:block;width:100%;min-width:0;margin:0;outline:none;appearance:none;border:0 solid transparent;background:transparent;color:inherit;font:inherit}
1014
+ .xui-Input-field::placeholder,.xui-Textarea-field::placeholder,.xui-Composer-field::placeholder{color:var(--xui-color-mutedForeground)}
1015
+ .xui-Textarea-field{resize:vertical;line-height:var(--xui-type-lineHeight-sm);padding-top:var(--xui-spacing-sm);padding-bottom:var(--xui-spacing-sm)}
1016
+ .xui-Input-label,.xui-Textarea-label,.xui-Select-label,.xui-DatePicker-label,.xui-DateRangePicker-label,.xui-TimePicker-label,.xui-NumberField-label,.xui-ChipInput-label,.xui-FileUpload-label,.xui-Slider-label,.xui-Radio-label,.xui-Checkbox-label,.xui-Switch-label{display:block;cursor:inherit}
1017
+ .xui-Select-trigger,.xui-DatePicker-trigger,.xui-DateRangePicker-trigger,.xui-TimePicker-trigger{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--xui-spacing-sm);width:100%;min-width:0;cursor:pointer;text-align:start;white-space:nowrap}
1018
+ .xui-Select-trigger>span,.xui-DatePicker-trigger>span,.xui-DateRangePicker-trigger>span,.xui-TimePicker-trigger>span{overflow:clip;text-overflow:ellipsis;min-width:0;flex:1 1 auto}
1019
+ .xui-Select-trigger>svg,.xui-DatePicker-trigger>svg,.xui-DateRangePicker-trigger>svg,.xui-TimePicker-trigger>svg{width:16px;height:16px;flex-shrink:0;opacity:.6}
1020
+ .xui-Select-search{display:flex;width:100%;min-width:0;margin:0 0 var(--xui-spacing-xs);padding:var(--xui-spacing-xs) var(--xui-spacing-sm);outline:none;border:0;border-bottom:1px solid var(--xui-color-border);background:transparent;color:inherit;font:inherit}
1021
+ .xui-Select-check{display:inline-flex;margin-inline-start:auto;flex-shrink:0}
1022
+ .xui-Checkbox-box{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:0;cursor:pointer}
1023
+ .xui-Checkbox-check{display:inline-flex;align-items:center;justify-content:center}
1024
+ .xui-Checkbox-check>svg{width:100%;height:100%}
1025
+ [data-xui-c="Radio"][data-r-orientation="horizontal"].xui-el>.xui-radio-items{flex-direction:row;flex-wrap:wrap}
1026
+ .xui-radio-items{display:flex;flex-direction:column;gap:inherit}
1027
+ .xui-radio-row{display:flex;align-items:center;gap:var(--xui-spacing-sm);cursor:pointer}
1028
+ .xui-Radio-item{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:0;cursor:pointer}
1029
+ .xui-ChoiceTiles-tile{display:flex;flex-direction:column;align-items:stretch;min-width:0;margin:0;font:inherit;color:inherit;text-align:start;appearance:none;-webkit-appearance:none;cursor:pointer;outline:none}
1030
+ .xui-ChoiceTiles-tile:focus-visible{outline:2px solid var(--xui-color-ring);outline-offset:1px}
1031
+ .xui-ChoiceTiles-tile:disabled{cursor:not-allowed}
1032
+ .xui-ChoiceTiles-picture{position:relative;display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1.6;flex-shrink:0;min-width:0;overflow:clip;color:var(--xui-color-mutedForeground)}
1033
+ .xui-ChoiceTiles-picture>img{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
1034
+ .xui-ChoiceTiles-picture>svg{width:var(--xui-control-iconMd);height:var(--xui-control-iconMd);opacity:.6}
1035
+ .xui-ChoiceTiles-label,.xui-ChoiceTiles-description{display:block;min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}
1036
+ .xui-ChoiceTiles-error{grid-column:1/-1;display:flex;flex-direction:column;gap:2px}
1037
+ .xui-Switch-track{display:inline-flex;align-items:center;flex-shrink:0;padding:2px;cursor:pointer;transition:background-color var(--xui-motion-fast) var(--xui-ease-standard,ease)}
1038
+ .xui-Switch-thumb{display:block;transition:transform var(--xui-motion-fast) var(--xui-ease-standard,ease);transform:translateX(0)}
1039
+ .xui-Switch-track[data-state="checked"]>.xui-Switch-thumb{transform:translateX(var(--xui-switch-travel,12px))}
1040
+ .xui-Switch-track[data-state="checked"]>.xui-Switch-thumb:dir(rtl){transform:translateX(calc(-1 * var(--xui-switch-travel,12px)))}
1041
+ .xui-slider-head{display:flex;justify-content:space-between;gap:var(--xui-spacing-sm)}
1042
+ .xui-Slider-track{position:relative;display:flex;align-items:center;width:100%;flex-grow:1;overflow:visible;touch-action:none;user-select:none}
1043
+ .xui-slider-root{display:flex;align-items:center;width:100%;min-height:var(--xui-control-slider);touch-action:none;user-select:none;position:relative}
1044
+ .xui-Slider-range{position:absolute;height:100%;left:0;border-radius:inherit}
1045
+ .xui-Slider-thumb{display:block;cursor:grab;outline:none}
1046
+ .xui-DatePicker-calendar,.xui-DateRangePicker-calendar{display:flex;flex-direction:column;gap:var(--xui-spacing-sm);padding:var(--xui-spacing-sm)}
1047
+ .xui-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:var(--xui-spacing-sm);font-weight:var(--xui-type-weight-medium)}
1048
+ .xui-calendar-nav{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:var(--xui-radius-sm);cursor:pointer;padding:0}
1049
+ .xui-calendar-nav:hover{background:var(--xui-color-accent)}
1050
+ .xui-calendar-nav>svg{width:16px;height:16px}
1051
+ .xui-calendar-grid{display:grid;grid-template-columns:repeat(7,32px);gap:2px}
1052
+ .xui-calendar-weekday{display:flex;align-items:center;justify-content:center;height:24px;font-size:var(--xui-type-size-xs);color:var(--xui-color-mutedForeground)}
1053
+ .xui-DatePicker-day,.xui-DateRangePicker-day{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--xui-radius-sm);cursor:pointer;padding:0;font-size:var(--xui-type-size-sm)}
1054
+ .xui-DatePicker-day:hover,.xui-DateRangePicker-day:hover{background:var(--xui-color-accent)}
1055
+ .xui-DatePicker-day[data-xs~="selected"],.xui-DateRangePicker-day[data-xs~="selected"]{background:var(--xui-color-primary);color:var(--xui-color-primaryForeground)}
1056
+ .xui-DatePicker-day[data-outside],.xui-DateRangePicker-day[data-outside]{opacity:.4}
1057
+ .xui-DatePicker-day:disabled,.xui-DateRangePicker-day:disabled{opacity:.3;cursor:default;pointer-events:none}
1058
+ .xui-Composer-field{display:block;width:100%;min-width:0;margin:0;padding:0;outline:none;border:0;background:transparent;color:inherit;font:inherit;resize:none;max-height:200px}
1059
+ .xui-composer-bar{display:flex;align-items:center;justify-content:flex-end;gap:var(--xui-spacing-xs)}
1060
+ .xui-Composer-attachment{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
1061
+ .xui-Composer-send{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
1062
+ .xui-Composer-send>svg,.xui-Composer-attachment>svg{width:16px;height:16px}
1063
+ .xui-Composer-send:disabled{opacity:.5;pointer-events:none}
1064
+ [data-xui-c="Ring"].xui-el,[data-xui-c="Spinner"].xui-el{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
1065
+ [data-xui-c="Ring"].xui-el>svg,[data-xui-c="Spinner"].xui-el>svg{width:100%;height:100%;display:block}
1066
+ .xui-Ring-label{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}
1067
+ [data-xui-c="Spinner"].xui-el>svg,.xui-Button-spinner>svg{animation:xui-spin 0.8s linear infinite}
1068
+ [data-xui-c="Skeleton"].xui-el:not([data-rows]),.xui-Skeleton-dot,.xui-Skeleton-bar{animation:xui-skeleton ${SKELETON_PULSE_MS}ms ease-in-out infinite;opacity:${SKELETON_OPACITY_LOW};flex-shrink:0}
1069
+ [data-xui-c="Skeleton"][data-rows].xui-el{display:flex;flex-direction:column;align-self:stretch;flex-shrink:0;background:none;border-radius:0}
1070
+ .xui-Skeleton-row{display:flex;flex-direction:row;align-items:center;flex-shrink:0}
1071
+ .xui-Skeleton-row+.xui-Skeleton-row{border-top:var(--xui-border-hairline) solid var(--xui-color-border)}
1072
+ .xui-Skeleton-dot{display:block}
1073
+ .xui-Skeleton-bar{display:block}
1074
+ .xui-Skeleton-bar[data-title]{flex-shrink:1;min-width:0}
1075
+ @keyframes xui-skeleton{0%,100%{opacity:${SKELETON_OPACITY_LOW}}50%{opacity:${SKELETON_OPACITY_HIGH}}}
1076
+ [data-xui-c="SearchList"].xui-el{display:flex;flex-direction:column;overflow:hidden;min-width:0}
1077
+ .xui-SearchList-head,.xui-Menu-head{display:flex;flex-direction:row;align-items:center;flex-shrink:0}
1078
+ .xui-SearchList-search,.xui-Menu-search{display:flex;align-items:center;gap:8px;flex:1 1 auto;min-width:0;align-self:stretch}
1079
+ .xui-SearchList-search>svg,.xui-Menu-search>svg{width:16px;height:16px;opacity:.6;flex-shrink:0}
1080
+ .xui-SearchList-search>input,.xui-Menu-search>input{flex:1 1 auto;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:inherit;font:inherit}
1081
+ .xui-SearchList-count,.xui-Menu-count{flex-shrink:0;font-variant-numeric:tabular-nums}
1082
+ .xui-SearchList-body,.xui-Menu-body{display:flex;flex-direction:column;position:relative;flex-shrink:1;min-height:0}
1083
+ .xui-SearchList-list,.xui-Menu-list{display:flex;flex-direction:column;flex-shrink:1;min-height:0;overflow-y:auto}
1084
+ .xui-SearchList-item{display:flex;flex-direction:row;align-items:center;flex-shrink:0;cursor:pointer;user-select:none;white-space:nowrap}
1085
+ .xui-SearchList-item[aria-disabled="true"]{pointer-events:none}
1086
+ .xui-SearchList-icon,.xui-SearchList-check{display:inline-flex;flex-shrink:0}
1087
+ .xui-SearchList-icon>svg,.xui-SearchList-check>svg{width:100%;height:100%}
1088
+ .xui-SearchList-identifier{flex-shrink:0}
1089
+ .xui-SearchList-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
1090
+ .xui-SearchList-fade,.xui-Menu-fade{position:absolute;left:0;right:0;bottom:0;height:${SEARCH_LIST_FADE}px;pointer-events:none;background:linear-gradient(to bottom,transparent,var(--xui-color-popover)) !important}
1091
+ .xui-menu-search{display:flex;flex-direction:column;min-width:240px}
1092
+ .xui-menu-search .xui-Menu-item{flex-shrink:0}
1093
+ [data-xui-c="Markdown"].xui-el{display:block;min-width:0;overflow-wrap:anywhere}
1094
+ [data-xui-c="Markdown"][data-lines].xui-el{display:-webkit-box;-webkit-box-orient:vertical;overflow:clip}
1095
+ .xui-md>:first-child{margin-top:0}
1096
+ .xui-md>:last-child{margin-bottom:0}
1097
+ .xui-Markdown-paragraph{margin:0 0 var(--xui-spacing-sm)}
1098
+ .xui-Markdown-heading{margin:var(--xui-spacing-md) 0 var(--xui-spacing-xs);font-weight:var(--xui-type-weight-semibold);line-height:1.25}
1099
+ .xui-md ul,.xui-md ol{margin:0 0 var(--xui-spacing-sm);padding-inline-start:1.4em}
1100
+ .xui-md ul{list-style:disc}
1101
+ .xui-md ol{list-style:decimal}
1102
+ .xui-md li>ul,.xui-md li>ol{margin-bottom:0}
1103
+ .xui-Markdown-listItem{margin:0}
1104
+ .xui-Markdown-code{font-family:var(--xui-font-mono);font-size:.925em;padding:0 .3em;border-radius:4px;background:var(--xui-color-muted)}
1105
+ .xui-Markdown-codeBlock{display:block;font-family:var(--xui-font-mono);font-size:var(--xui-type-size-xs);white-space:pre;overflow:auto;padding:var(--xui-spacing-sm);margin:0 0 var(--xui-spacing-sm);border-radius:var(--xui-radius-sm);background:var(--xui-color-muted)}
1106
+ .xui-Markdown-quote{margin:0 0 var(--xui-spacing-sm);padding-inline-start:var(--xui-spacing-md);border-inline-start:2px solid var(--xui-color-border);color:var(--xui-color-mutedForeground)}
1107
+ .xui-Markdown-link{color:var(--xui-color-primary);text-decoration:underline;text-underline-offset:3px}
1108
+ .xui-Markdown-table{border-collapse:collapse;margin:0 0 var(--xui-spacing-sm);width:100%}
1109
+ .xui-Markdown-table th,.xui-Markdown-table td{border:1px solid var(--xui-color-border);padding:var(--xui-spacing-xs) var(--xui-spacing-sm);text-align:start}
1110
+ .xui-Markdown-image{height:160px;margin:0 0 var(--xui-spacing-sm);overflow:hidden}
1111
+ .xui-Markdown-image>img{display:block;width:100%;height:100%;object-fit:contain;object-position:0 0}
1112
+ .xui-Markdown-image>img:dir(rtl){object-position:100% 0}
1113
+ .xui-Markdown-imageAlt{color:var(--xui-color-mutedForeground)}
1114
+ [data-xui-c="Chart"].xui-el{flex-direction:column;gap:var(--xui-spacing-xs);min-width:0}
1115
+ .xui-Chart-legend,.xui-Chart-title{flex-shrink:0}
1116
+ [data-xui-c="Chart"].xui-el>svg{width:100%;display:block}
1117
+ .xui-Chart-legend{display:flex;flex-wrap:wrap;gap:var(--xui-spacing-sm);font-size:var(--xui-type-size-xs);color:var(--xui-color-mutedForeground)}
1118
+ .xui-Chart-legend>span{display:inline-flex;align-items:center;gap:var(--xui-spacing-xxs)}
1119
+ .xui-Chart-legend i{display:inline-block;width:8px;height:8px;border-radius:2px}
1120
+ .xui-Chart-title{font-weight:var(--xui-type-weight-medium)}
1121
+ [data-xui-c="TreeGuides"].xui-el{flex-direction:row;align-self:stretch;flex-shrink:0}
1122
+ [data-xui-c="TreeGuides"].xui-el{overflow:visible}
1123
+ .xui-tree-col{position:relative;align-self:stretch;flex-shrink:0;overflow:visible}
1124
+ .xui-tree-col>.xui-TreeGuides-line{position:absolute;background:currentColor;display:block;padding:0;margin:0;box-sizing:border-box}
1125
+ .xui-tree-col>.xui-TreeGuides-line[data-elbow]{background:none;border-style:solid;border-color:currentColor;border-top-width:0;border-right-width:0}
1126
+ [data-xui-c="Unknown"].xui-el{flex-direction:column;gap:var(--xui-spacing-xxs)}
1127
+ [data-xui-c="Box"][data-pressable="true"].xui-el{cursor:pointer}
1128
+ .xui-layer{position:absolute;top:0;left:0;width:0;height:0;overflow:visible}
1129
+ .xui-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
1130
+
1131
+ .xui-calendar-row{display:contents}
1132
+ .xui-calendar-cell{display:flex;align-items:center;justify-content:center}
1133
+ .xui-calendar-day-label{position:relative}
1134
+ .xui-DatePicker-day[data-today]>.xui-calendar-day-label,.xui-DateRangePicker-day[data-today]>.xui-calendar-day-label{text-decoration:underline;text-underline-offset:3px}
1135
+ .xui-DateRangePicker-day{position:relative}
1136
+ .xui-DateRangePicker-range{position:absolute;inset:0;border-radius:inherit}
1137
+ .xui-DateRangePicker-day[data-range]{background:var(--xui-color-accent)}
1138
+ .xui-calendar-nav{color:inherit}
1139
+ [data-xui-c="Form"].xui-el{flex-direction:column}
1140
+ .xui-form-fields{display:contents;border:0;margin:0;padding:0;min-width:0}
1141
+ .xui-Form-summary{display:flex;flex-direction:column}
1142
+ .xui-form-summary-list{margin:0;padding-inline-start:1.2em}
1143
+ .xui-Input-error,.xui-Textarea-error,.xui-NumberField-error,.xui-ChipInput-error,.xui-FileUpload-error,.xui-Select-error,.xui-Checkbox-error,.xui-Switch-error,.xui-Radio-error,.xui-DatePicker-error,.xui-DateRangePicker-error,.xui-TimePicker-error{display:flex;flex-direction:column;gap:2px}
1144
+ [data-xui-numberfield]{display:flex;flex-direction:row;align-items:center;gap:var(--xui-spacing-xxs);min-width:0}
1145
+ .xui-NumberField-input{flex:1 1 auto;min-width:0;width:100%;border:0;outline:none;background:transparent;color:inherit;font:inherit;padding:0;text-align:start;font-variant-numeric:tabular-nums}
1146
+ .xui-NumberField-decrement,.xui-NumberField-increment,.xui-ChipInput-remove,.xui-FileUpload-remove,.xui-Toast-close,.xui-CodeBlock-copy{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:0;cursor:pointer}
1147
+ .xui-NumberField-decrement>svg,.xui-NumberField-increment>svg,.xui-ChipInput-remove>svg,.xui-FileUpload-remove>svg,.xui-Toast-close>svg,.xui-CodeBlock-copy>svg{width:16px;height:16px}
1148
+ .xui-NumberField-decrement:disabled,.xui-NumberField-increment:disabled{opacity:.4;pointer-events:none}
1149
+ .xui-NumberField-unit{flex-shrink:0}
1150
+ [data-xui-chipfield]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;cursor:text}
1151
+ .xui-chip-list{display:contents;list-style:none;margin:0;padding:0}
1152
+ .xui-ChipInput-chip{display:inline-flex;align-items:center;flex-shrink:0;outline:none}
1153
+ .xui-ChipInput-input{flex:1 1 80px;min-width:80px;border:0;outline:none;background:transparent;color:inherit;font:inherit;padding:0;height:var(--xui-type-lineHeight-sm)}
1154
+ .xui-ChipInput-suggestions{display:flex;flex-direction:column;border:1px solid var(--xui-color-border);border-radius:var(--xui-radius-md);background:var(--xui-color-popover);color:var(--xui-color-popoverForeground);padding:var(--xui-spacing-xs);box-shadow:var(--xui-shadow-md)}
1155
+ .xui-ChipInput-suggestion{display:flex;align-items:center;padding:var(--xui-spacing-xs) var(--xui-spacing-sm);border-radius:var(--xui-radius-sm);cursor:pointer}
1156
+ .xui-ChipInput-suggestion[data-active]{background:var(--xui-color-accent);color:var(--xui-color-accentForeground)}
1157
+ .xui-FileUpload-dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;cursor:pointer;outline:none}
1158
+ .xui-FileUpload-dropzone[aria-disabled="true"]{cursor:default}
1159
+ .xui-FileUpload-icon{display:inline-flex}
1160
+ .xui-FileUpload-icon>svg{width:100%;height:100%}
1161
+ .xui-FileUpload-title{font-weight:var(--xui-type-weight-medium)}
1162
+ .xui-file-list{display:flex;flex-direction:column;gap:var(--xui-spacing-xs);list-style:none;margin:0;padding:0}
1163
+ .xui-FileUpload-file{display:flex;flex-direction:row;align-items:center}
1164
+ .xui-FileUpload-fileIcon{display:inline-flex;flex-shrink:0;opacity:.7}
1165
+ .xui-FileUpload-fileIcon>svg{width:16px;height:16px}
1166
+ .xui-FileUpload-browse{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;flex-shrink:0;height:var(--xui-control-buttonSm)}
1167
+ .xui-FileUpload-fileName{flex:1 1 auto;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap}
1168
+ [data-xui-c="CodeBlock"].xui-el{flex-direction:column;min-width:0;overflow:clip}
1169
+ .xui-CodeBlock-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}
1170
+ .xui-CodeBlock-copy>svg{width:12px;height:12px}
1171
+ .xui-codeblock-scroll{overflow:auto;min-width:0;outline:none}
1172
+ .xui-codeblock-scroll[data-max-lines]{max-height:calc(var(--xui-code-lines) * 1lh)}
1173
+ .xui-codeblock-pre{margin:0;padding:0;font:inherit;white-space:pre;tab-size:2;min-width:max-content}
1174
+ .xui-codeblock-scroll[data-wrap="true"]>.xui-codeblock-pre{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
1175
+ .xui-codeblock-pre>code{font:inherit;display:block}
1176
+ .xui-CodeBlock-line{display:flex;flex-direction:row}
1177
+ .xui-codeblock-text{flex:0 1 auto;min-width:0}
1178
+ .xui-CodeBlock-gutter{display:flex;flex-direction:row;justify-content:flex-end;flex-shrink:0;user-select:none}
1179
+ .xui-CodeBlock-lineNumber{display:block}
1180
+ [data-xui-c="Table"].xui-el{flex-direction:column;min-width:0;overflow:auto}
1181
+ .xui-Table-header{display:flex;flex-direction:column}
1182
+ .xui-Table-header[data-sticky="true"]{position:sticky;top:0;z-index:1}
1183
+ .xui-table-row,.xui-Table-row{display:grid;align-items:stretch;min-width:0}
1184
+ .xui-table-body{display:flex;flex-direction:column;position:relative}
1185
+ .xui-table-check{display:flex;align-items:center;justify-content:center;min-width:0}
1186
+ .xui-Table-headerCell,.xui-Table-cell{display:flex;flex-direction:row;align-items:center;min-width:0;overflow:clip;text-overflow:ellipsis;white-space:nowrap;gap:var(--xui-spacing-xs)}
1187
+ .xui-Table-headerCell[data-r-align="end"],.xui-Table-cell[data-r-align="end"]{justify-content:flex-end;text-align:end}
1188
+ .xui-Table-headerCell[data-r-align="center"],.xui-Table-cell[data-r-align="center"]{justify-content:center;text-align:center}
1189
+ .xui-Table-cell[data-type="number"]{font-variant-numeric:tabular-nums}
1190
+ .xui-Table-cell>svg{width:16px;height:16px}
1191
+ .xui-Table-row{outline:none}
1192
+ .xui-Table-row:focus-visible{box-shadow:inset 0 0 0 2px var(--xui-color-ring)}
1193
+ .xui-Table-row[tabindex]{cursor:pointer}
1194
+ .xui-table-sort{display:inline-flex;align-items:center;gap:var(--xui-spacing-xxs);padding:0;margin:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;min-width:0}
1195
+ .xui-Table-headerCell[data-r-align="end"]>.xui-table-sort{flex-direction:row}
1196
+ .xui-Table-sortIcon{display:inline-flex;flex-shrink:0}
1197
+ .xui-Table-sortIcon>svg{width:100%;height:100%}
1198
+ .xui-Table-empty{display:flex;justify-content:center}
1199
+ .xui-table-badge{display:inline-flex;align-items:center;height:var(--xui-control-badge);padding:0 var(--xui-spacing-sm);border-radius:var(--xui-radius-full);background:var(--xui-color-secondary);color:var(--xui-color-secondaryForeground);font-size:var(--xui-type-size-xs)}
1200
+ .xui-chart-plot{position:relative;width:100%;min-width:0;flex:1 1 0%;min-height:0;overflow:visible}
1201
+ .xui-chart-svg{position:absolute;top:0;left:0;display:block;overflow:visible;outline:none}
1202
+ .xui-chart-svg:focus-visible{outline:2px solid var(--xui-color-ring);outline-offset:2px;border-radius:var(--xui-radius-sm)}
1203
+ .xui-Chart-grid{opacity:.7}
1204
+ .xui-Chart-tooltip{display:flex;flex-direction:column;gap:2px;z-index:2;min-width:120px;white-space:nowrap}
1205
+ .xui-chart-tip-row{display:inline-flex;align-items:center;gap:var(--xui-spacing-xxs)}
1206
+ .xui-chart-tip-row>i{display:inline-block;width:8px;height:8px;border-radius:2px}
1207
+ .xui-Chart-valueLabel{fill:currentColor}
1208
+ [data-xui-c="Chart"][data-kind="sparkline"].xui-el{gap:0}
1209
+ .xui-Image-fallback{display:flex;align-items:center;justify-content:center;position:absolute;inset:0}
1210
+ .xui-Image-fallback>svg{width:var(--xui-control-iconLg);height:var(--xui-control-iconLg)}
1211
+ [data-xui-c="Image"][data-state="loading"].xui-el{background:var(--xui-color-muted)}
1212
+ .xui-carousel-controls{display:flex;align-items:center;justify-content:center}
1213
+ .xui-carousel-controls>.xui-carousel-dots{padding-top:0}
1214
+ .xui-carousel-nav{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:0;cursor:pointer}
1215
+ .xui-carousel-nav:disabled{pointer-events:none}
1216
+ .xui-carousel-nav>svg{width:var(--xui-control-iconSm);height:var(--xui-control-iconSm)}
1217
+ .xui-menu-label{flex:1 1 auto;min-width:0}
1218
+ .xui-Menu-shortcut{margin-inline-start:auto;padding-inline-start:var(--xui-spacing-lg)}
1219
+ .xui-Menu-check{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
1220
+ .xui-Menu-check svg,.xui-Menu-submenuIndicator>svg{width:100%;height:100%}
1221
+ .xui-Menu-submenuIndicator{display:inline-flex;margin-inline-start:auto;flex-shrink:0}
1222
+ .xui-Select-searchbox{display:flex;align-items:center;gap:var(--xui-spacing-xs);padding-inline-start:var(--xui-spacing-sm)}
1223
+ .xui-Select-searchbox>svg{width:16px;height:16px;opacity:.6;flex-shrink:0}
1224
+ .xui-Select-searchbox>.xui-Select-search{margin:0;border-bottom:0;padding-inline-start:0}
1225
+ .xui-Select-listbox,.xui-TimePicker-listbox{display:flex;flex-direction:column;outline:none;overflow:auto;max-height:280px}
1226
+ .xui-Select-empty{display:flex}
1227
+ .xui-TimePicker-list{min-width:var(--radix-popover-trigger-width)}
1228
+ [data-xui-c="Toast"].xui-el{flex-direction:row;align-items:flex-start;width:min(360px,calc(100vw - 32px));pointer-events:auto}
1229
+ .xui-Toast-icon{display:inline-flex;flex-shrink:0}
1230
+ .xui-Toast-icon>svg{width:100%;height:100%}
1231
+ .xui-toast-text{display:flex;flex-direction:column;gap:2px;flex:1 1 auto;min-width:0}
1232
+ .xui-Toast-action{display:inline-flex;align-items:center;flex-shrink:0;cursor:pointer;white-space:nowrap}
1233
+ .xui-toast-layer{position:fixed;bottom:var(--xui-spacing-lg);left:50%;transform:translateX(-50%);z-index:60;display:flex;flex-direction:column;align-items:center;gap:var(--xui-spacing-sm);pointer-events:none;width:max-content;max-width:calc(100vw - 32px)}
1234
+ .xui-toast-layer>:nth-last-child(n+4){display:none}
1235
+ .xui-Popover-content[data-open-on="hover"]{pointer-events:auto}
1236
+ @keyframes xui-fade-out{to{opacity:0}}
1237
+ @keyframes xui-pop-in{from{opacity:0;scale:var(--xui-scale-popoverFrom,.96)}}
1238
+ @keyframes xui-pop-out{to{opacity:0}}
1239
+ @keyframes xui-slide-bottom-in{from{translate:0 100%}}
1240
+ @keyframes xui-slide-bottom-out{to{translate:0 100%}}
1241
+ @keyframes xui-slide-top-in{from{translate:0 -100%}}
1242
+ @keyframes xui-slide-top-out{to{translate:0 -100%}}
1243
+ @keyframes xui-slide-left-in{from{translate:-100% 0}}
1244
+ @keyframes xui-slide-left-out{to{translate:-100% 0}}
1245
+ @keyframes xui-slide-right-in{from{translate:100% 0}}
1246
+ @keyframes xui-slide-right-out{to{translate:100% 0}}
1247
+ @keyframes xui-toast-in{from{opacity:0;translate:0 12px}}
1248
+ @keyframes xui-accordion-open{from{height:0}to{height:var(--radix-accordion-content-height)}}
1249
+ @keyframes xui-accordion-close{from{height:var(--radix-accordion-content-height)}to{height:0}}
1250
+ .xui-Popover-content,.xui-Tooltip-content,.xui-Menu-content,.xui-Select-content,.xui-DatePicker-calendar,.xui-DateRangePicker-calendar,.xui-TimePicker-list{transform-origin:var(--radix-popper-transform-origin)}
1251
+ .xui-Popover-content[data-state="open"],.xui-Tooltip-content[data-state$="open"],.xui-Menu-content[data-state="open"],.xui-Select-content[data-state="open"],.xui-DatePicker-calendar[data-state="open"],.xui-DateRangePicker-calendar[data-state="open"],.xui-TimePicker-list[data-state="open"],.xui-Dialog-content[data-state="open"]{animation:xui-pop-in var(--xui-motion-standard) var(--xui-ease-decelerate,ease-out)}
1252
+ [data-xui-c="Button"].xui-el:active:not(:disabled){scale:var(--xui-scale-press,1)}
1253
+ .xui-Popover-content[data-state="closed"],.xui-Tooltip-content[data-state="closed"],.xui-Menu-content[data-state="closed"],.xui-Select-content[data-state="closed"],.xui-DatePicker-calendar[data-state="closed"],.xui-DateRangePicker-calendar[data-state="closed"],.xui-TimePicker-list[data-state="closed"],.xui-Dialog-content[data-state="closed"]{animation:xui-pop-out var(--xui-motion-fast) var(--xui-ease-accelerate,ease-in) forwards}
1254
+ .xui-Dialog-overlay[data-state="open"],.xui-Drawer-overlay[data-state="open"]{animation:xui-fade-in var(--xui-motion-standard) var(--xui-ease-decelerate,ease-out)}
1255
+ .xui-Dialog-overlay[data-state="closed"],.xui-Drawer-overlay[data-state="closed"]{animation:xui-fade-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1256
+ .xui-Drawer-content[data-side="bottom"][data-state="open"]{animation:xui-slide-bottom-in var(--xui-motion-slow) var(--xui-ease-decelerate,ease-out)}
1257
+ .xui-Drawer-content[data-side="bottom"][data-state="closed"]{animation:xui-slide-bottom-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1258
+ .xui-Drawer-content[data-side="top"][data-state="open"]{animation:xui-slide-top-in var(--xui-motion-slow) var(--xui-ease-decelerate,ease-out)}
1259
+ .xui-Drawer-content[data-side="top"][data-state="closed"]{animation:xui-slide-top-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1260
+ .xui-Drawer-content[data-side="left"][data-state="open"]{animation:xui-slide-left-in var(--xui-motion-slow) var(--xui-ease-decelerate,ease-out)}
1261
+ .xui-Drawer-content[data-side="left"][data-state="closed"]{animation:xui-slide-left-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1262
+ .xui-Drawer-content[data-side="right"][data-state="open"]{animation:xui-slide-right-in var(--xui-motion-slow) var(--xui-ease-decelerate,ease-out)}
1263
+ .xui-Drawer-content[data-side="right"][data-state="closed"]{animation:xui-slide-right-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1264
+ .xui-Accordion-content[data-state="open"]{animation:xui-accordion-open var(--xui-motion-standard) var(--xui-ease-standard,ease)}
1265
+ .xui-Accordion-content[data-state="closed"]{animation:xui-accordion-close var(--xui-motion-standard) var(--xui-ease-standard,ease)}
1266
+ .xui-Tabs-content[data-state="active"]{animation:xui-fade-in var(--xui-motion-fast) var(--xui-ease-decelerate,ease-out)}
1267
+ [data-xui-c="Toast"][data-state="open"].xui-el{animation:xui-toast-in var(--xui-motion-standard) var(--xui-ease-decelerate,ease-out)}
1268
+ [data-xui-c="Toast"][data-state="closed"].xui-el{animation:xui-fade-out var(--xui-motion-standard) var(--xui-ease-accelerate,ease-in) forwards}
1269
+ .xui-accordion-title{display:inline-flex;align-items:baseline;gap:var(--xui-spacing-xs);min-width:0}
1270
+ .xui-Collapsible-chevron.xui-el{transition:transform var(--xui-motion-fast) var(--xui-ease-standard,ease)}
1271
+ ${SHIMMER_CSS}
1272
+ }
1273
+ @media (prefers-reduced-motion: reduce){@layer xui-base{.xui-surface *,.xui-surface *::before,.xui-surface *::after{animation-duration:0ms !important;animation-iteration-count:1 !important;transition-duration:0ms !important;scroll-behavior:auto !important}${REDUCED_EXTRA}}}
1274
+ .xui-surface[data-xui-motion="reduce"] *,.xui-surface[data-xui-motion="reduce"] *::after{animation-duration:0ms !important;animation-iteration-count:1 !important;transition-duration:0ms !important}
1275
+ ${REDUCED_EXTRA.replace(/\.xui-surface /g, `.xui-surface[data-xui-motion="reduce"] `)}`;
1276
+ // packages/exponential-ui/src/web/urls.ts
1277
+ import { DEFAULT_MEDIA_SCHEMES, decideUrl, isPrivateHost, mediaRequest, safeHref } from "@exponential-at/ui";
1278
+ var documentBase = () => typeof document !== `undefined` && document.baseURI ? document.baseURI : undefined;
1279
+ function ownPrivateHosts() {
1280
+ try {
1281
+ const base = documentBase();
1282
+ if (!base)
1283
+ return [];
1284
+ const host = new URL(base).hostname.toLowerCase();
1285
+ return isPrivateHost(host) ? [host] : [];
1286
+ } catch {
1287
+ return [];
1288
+ }
1289
+ }
1290
+ function withOwnOrigin(allow) {
1291
+ const own = ownPrivateHosts();
1292
+ if (!own.length)
1293
+ return allow;
1294
+ return [...allow ?? [], ...own.filter((h) => !(allow ?? []).includes(h))];
1295
+ }
1296
+ function urlPolicyOf(host) {
1297
+ const urls = host.urls ?? {};
1298
+ const withBase = urls.baseUrl ? urls : { ...urls, baseUrl: host.media?.baseUrl ?? documentBase() };
1299
+ return { ...withBase, allowPrivate: withOwnOrigin(withBase.allowPrivate) };
1300
+ }
1301
+ function linkHref(host, href) {
1302
+ return safeHref(urlPolicyOf(host), href);
1303
+ }
1304
+ function mediaRequestOf(host, src) {
1305
+ if (typeof src !== `string` || !src)
1306
+ return null;
1307
+ const rewritten = host.resolveUrl ? host.resolveUrl(src) : src;
1308
+ const req = host.mediaRequest ? host.mediaRequest(rewritten) : mediaRequest(rewritten, { baseUrl: documentBase(), ...host.media, allowPrivate: withOwnOrigin(host.media?.allowPrivate) });
1309
+ if (!req)
1310
+ return null;
1311
+ return mediaUrlAllowed(host, req.url) ? req : null;
1312
+ }
1313
+ function mediaUrlAllowed(host, url) {
1314
+ return decideUrl({ schemes: host.media?.schemes ?? DEFAULT_MEDIA_SCHEMES, hosts: host.media?.hosts, allowPrivate: withOwnOrigin(host.media?.allowPrivate) }, url).allowed;
1315
+ }
1316
+ function openAllowed(host, url) {
1317
+ const href = linkHref(host, url);
1318
+ if (!href)
1319
+ return;
1320
+ if (host.openUrl)
1321
+ host.openUrl(href);
1322
+ else if (typeof window !== `undefined`)
1323
+ window.open(href, `_blank`, `noopener,noreferrer`);
1324
+ }
1325
+ // packages/exponential-ui/src/web/host-types.ts
1326
+ function lookupIcon(icons, name, fallbacks = {}) {
1327
+ if (!icons)
1328
+ return fallbacks[name];
1329
+ const hit = typeof icons === `function` ? icons(name) : icons[name];
1330
+ return hit ?? fallbacks[name];
1331
+ }
1332
+ // packages/exponential-ui/src/web/coerce.ts
1333
+ import { DEFAULT_STRINGS, coreCatalog as coreCatalog2 } from "@exponential-at/ui";
1334
+ var str = (v, fallback = ``) => v === undefined || v === null ? fallback : typeof v === `object` ? JSON.stringify(v) : String(v);
1335
+ var num2 = (v, fallback = 0) => typeof v === `number` && Number.isFinite(v) ? v : typeof v === `string` && v.trim() !== `` && Number.isFinite(Number(v)) ? Number(v) : fallback;
1336
+ var bool = (v) => v === true || v === `true`;
1337
+ var arr = (v) => Array.isArray(v) ? v : [];
1338
+ var objects = (v) => Array.isArray(v) ? v.filter((e) => e !== null && typeof e === `object` && !Array.isArray(e)) : [];
1339
+ function phrase(ctx, id, params, fallback) {
1340
+ return ctx.strings[id] !== undefined ? ctx.t(id, params) : fallback();
1341
+ }
1342
+ var SIZE_UNITS = [`byte`, `kilobyte`, `megabyte`, `gigabyte`];
1343
+ var sizeFormats = new Map;
1344
+ function formatFileSize(bytes, locale) {
1345
+ let fmts = sizeFormats.get(locale);
1346
+ if (!fmts) {
1347
+ fmts = SIZE_UNITS.map((unit) => {
1348
+ try {
1349
+ return new Intl.NumberFormat(locale, { style: `unit`, unit, unitDisplay: `short`, maximumFractionDigits: 1 });
1350
+ } catch {
1351
+ return new Intl.NumberFormat(locale, { maximumFractionDigits: 1 });
1352
+ }
1353
+ });
1354
+ sizeFormats.set(locale, fmts);
1355
+ }
1356
+ let i = 0;
1357
+ let n = Math.max(0, bytes);
1358
+ while (n >= 1024 && i < SIZE_UNITS.length - 1) {
1359
+ n /= 1024;
1360
+ i++;
1361
+ }
1362
+ return fmts[i].format(n);
1363
+ }
1364
+ function acceptsFile(accept, file) {
1365
+ const rules = accept.split(`,`).map((r) => r.trim().toLowerCase()).filter(Boolean);
1366
+ if (rules.length === 0)
1367
+ return true;
1368
+ const name = file.name.toLowerCase();
1369
+ const type = (file.type || ``).toLowerCase();
1370
+ return rules.some((r) => r.startsWith(`.`) ? name.endsWith(r) : r.endsWith(`/*`) ? type.startsWith(r.slice(0, -1)) : type === r);
1371
+ }
1372
+ function failingChecks(checks, fallback = DEFAULT_STRINGS.invalidValue) {
1373
+ const out = [];
1374
+ for (const check of objects(checks)) {
1375
+ if (check && typeof check === `object` && `condition` in check && (check.condition === false || check.condition === null || check.condition === undefined || check.condition === ``))
1376
+ out.push(str(check.message, fallback));
1377
+ }
1378
+ return out;
1379
+ }
1380
+ function failingCheck(checks, fallback) {
1381
+ return failingChecks(checks, fallback)[0] ?? null;
1382
+ }
1383
+ var BUILTIN_ICONS = coreCatalog2.builtinIcons;
1384
+ function builtinIconName(slot) {
1385
+ return BUILTIN_ICONS[slot] ?? `ui-icon-placeholder`;
1386
+ }
1387
+ function joinIds(...ids) {
1388
+ const out = ids.filter(Boolean).join(` `);
1389
+ return out || undefined;
1390
+ }
1391
+ // packages/exponential-ui/src/web/table.ts
1392
+ function sortRows(rows, sort, column, locale) {
1393
+ const order = rows.map((_, i) => i);
1394
+ if (!sort || !column)
1395
+ return order;
1396
+ const collator = new Intl.Collator(locale, { numeric: true, sensitivity: `base` });
1397
+ const dir = sort.direction === `desc` ? -1 : 1;
1398
+ const missing = (v) => v === undefined || v === null || v === ``;
1399
+ return order.sort((a, b) => {
1400
+ const va = rows[a]?.[sort.key];
1401
+ const vb = rows[b]?.[sort.key];
1402
+ if (missing(va) && missing(vb))
1403
+ return a - b;
1404
+ if (missing(va))
1405
+ return 1;
1406
+ if (missing(vb))
1407
+ return -1;
1408
+ let c;
1409
+ if (typeof va === `number` && typeof vb === `number`)
1410
+ c = va - vb;
1411
+ else if (column.type === `number`)
1412
+ c = num2(va) - num2(vb);
1413
+ else if (column.type === `date`)
1414
+ c = new Date(String(va)).getTime() - new Date(String(vb)).getTime();
1415
+ else if (typeof va === `boolean` || typeof vb === `boolean`)
1416
+ c = Number(Boolean(va)) - Number(Boolean(vb));
1417
+ else
1418
+ c = collator.compare(String(va), String(vb));
1419
+ return c === 0 ? a - b : c * dir;
1420
+ });
1421
+ }
1422
+ // packages/exponential-ui/src/web/dates.ts
1423
+ var isoDate = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, `0`)}-${String(d.getDate()).padStart(2, `0`)}`;
1424
+ var parseIsoDate = (s) => {
1425
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(s);
1426
+ return m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : null;
1427
+ };
1428
+ var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
1429
+ var addMonths = (d, n) => {
1430
+ const last = new Date(d.getFullYear(), d.getMonth() + n + 1, 0).getDate();
1431
+ return new Date(d.getFullYear(), d.getMonth() + n, Math.min(d.getDate(), last));
1432
+ };
1433
+ var sameDay = (a, b) => Boolean(a && b && isoDate(a) === isoDate(b));
1434
+ function monthGrid(view, first) {
1435
+ const start = new Date(view.getFullYear(), view.getMonth(), 1);
1436
+ const lead = (start.getDay() - first + 7) % 7;
1437
+ return Array.from({ length: 42 }, (_, i) => new Date(start.getFullYear(), start.getMonth(), 1 - lead + i));
1438
+ }
1439
+ function calendarStop(days, view, focus, disabled) {
1440
+ const inMonth = days.filter((d) => d.getMonth() === view.getMonth() && d.getFullYear() === view.getFullYear() && !disabled(d));
1441
+ if (inMonth.some((d) => sameDay(d, focus)))
1442
+ return focus;
1443
+ let best = null;
1444
+ for (const d of inMonth)
1445
+ if (!best || Math.abs(d.getTime() - focus.getTime()) < Math.abs(best.getTime() - focus.getTime()))
1446
+ best = d;
1447
+ return best;
1448
+ }
1449
+ // packages/exponential-ui/src/web/inputs.ts
1450
+ var DEBOUNCE_MS = 150;
1451
+
1452
+ class HostOwnedController {
1453
+ value;
1454
+ revision = 0;
1455
+ pending = false;
1456
+ focused = false;
1457
+ acked = 0;
1458
+ timer = null;
1459
+ live = true;
1460
+ send;
1461
+ writeLocal;
1462
+ debounceMs;
1463
+ onChange;
1464
+ constructor(options) {
1465
+ this.value = options.initial;
1466
+ this.send = options.send;
1467
+ this.writeLocal = options.writeLocal;
1468
+ this.debounceMs = options.debounceMs ?? DEBOUNCE_MS;
1469
+ this.onChange = options.onChange;
1470
+ }
1471
+ configure(options) {
1472
+ this.send = options.send;
1473
+ this.writeLocal = options.writeLocal;
1474
+ this.debounceMs = options.debounceMs ?? DEBOUNCE_MS;
1475
+ }
1476
+ edit(next) {
1477
+ this.value = next;
1478
+ this.revision += 1;
1479
+ this.pending = true;
1480
+ this.writeLocal?.(next);
1481
+ this.clearTimer();
1482
+ this.timer = setTimeout(() => {
1483
+ this.timer = null;
1484
+ this.dispatch(`change`);
1485
+ }, this.debounceMs);
1486
+ this.notify();
1487
+ }
1488
+ commit() {
1489
+ this.clearTimer();
1490
+ this.dispatch(`commit`);
1491
+ }
1492
+ focus() {
1493
+ this.focused = true;
1494
+ this.notify();
1495
+ }
1496
+ blur() {
1497
+ this.focused = false;
1498
+ this.notify();
1499
+ this.commit();
1500
+ }
1501
+ push(external) {
1502
+ if (this.focused)
1503
+ return false;
1504
+ if (this.revision > this.acked)
1505
+ return false;
1506
+ if (Object.is(external, this.value))
1507
+ return false;
1508
+ this.value = external;
1509
+ this.notify();
1510
+ return true;
1511
+ }
1512
+ attach() {
1513
+ this.live = true;
1514
+ }
1515
+ dispose() {
1516
+ this.live = false;
1517
+ this.clearTimer();
1518
+ }
1519
+ clearTimer() {
1520
+ if (this.timer) {
1521
+ clearTimeout(this.timer);
1522
+ this.timer = null;
1523
+ }
1524
+ }
1525
+ notify() {
1526
+ if (this.live)
1527
+ this.onChange?.();
1528
+ }
1529
+ ack(rev) {
1530
+ if (rev > this.acked)
1531
+ this.acked = rev;
1532
+ if (this.live && this.acked >= this.revision && this.pending) {
1533
+ this.pending = false;
1534
+ this.notify();
1535
+ }
1536
+ }
1537
+ dispatch(kind) {
1538
+ const rev = this.revision;
1539
+ let result;
1540
+ try {
1541
+ result = this.send(this.value, rev, kind);
1542
+ } catch {
1543
+ result = undefined;
1544
+ }
1545
+ if (result && typeof result.then === `function`) {
1546
+ result.then(() => this.ack(rev), () => this.ack(rev));
1547
+ } else
1548
+ this.ack(rev);
1549
+ }
1550
+ }
1551
+ var localeDigits = new Map;
1552
+ function digitMap(locale) {
1553
+ let hit = localeDigits.get(locale);
1554
+ if (!hit) {
1555
+ hit = new Map;
1556
+ const fmt = new Intl.NumberFormat(locale, { useGrouping: false });
1557
+ for (let d = 0;d <= 9; d++) {
1558
+ const glyph = fmt.format(d);
1559
+ if (glyph !== String(d))
1560
+ hit.set(glyph, String(d));
1561
+ }
1562
+ localeDigits.set(locale, hit);
1563
+ }
1564
+ return hit;
1565
+ }
1566
+ function parseLocaleNumber(text, locale) {
1567
+ const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);
1568
+ const group = parts.find((p) => p.type === `group`)?.value ?? `,`;
1569
+ const decimal = parts.find((p) => p.type === `decimal`)?.value ?? `.`;
1570
+ const digits = digitMap(locale);
1571
+ const ascii = digits.size ? Array.from(text, (ch) => digits.get(ch) ?? ch).join(``) : text;
1572
+ const clean = ascii.trim().split(group).join(``).replace(/[\s‎‏؜]/g, ``).replace(decimal, `.`).replace(/[−–]/g, `-`);
1573
+ if (clean === `` || clean === `-`)
1574
+ return null;
1575
+ const n = Number(clean);
1576
+ return Number.isFinite(n) ? n : null;
1577
+ }
1578
+ // packages/exponential-ui/src/web/media.ts
1579
+ import { MEDIA_LIMITS, mediaImageWithinLimits } from "@exponential-at/ui";
1580
+ var MEDIA_CACHE_IDLE_MAX = 64;
1581
+ var blobs = new Map;
1582
+ function mediaCacheKey(url, headers) {
1583
+ return `${url}
1584
+ ${JSON.stringify(headers)}`;
1585
+ }
1586
+ function touch(k, e) {
1587
+ blobs.delete(k);
1588
+ blobs.set(k, e);
1589
+ }
1590
+ function acquireMedia(k, load) {
1591
+ let e = blobs.get(k);
1592
+ if (!e) {
1593
+ const entry = { refs: 0, promise: Promise.resolve(``) };
1594
+ entry.promise = load().then((url) => {
1595
+ entry.url = url;
1596
+ if (blobs.get(k) !== entry)
1597
+ URL.revokeObjectURL(url);
1598
+ return url;
1599
+ });
1600
+ entry.promise.catch(() => {
1601
+ if (blobs.get(k) === entry)
1602
+ blobs.delete(k);
1603
+ });
1604
+ e = entry;
1605
+ }
1606
+ e.refs += 1;
1607
+ touch(k, e);
1608
+ return e;
1609
+ }
1610
+ function releaseMedia(k, e) {
1611
+ e.refs -= 1;
1612
+ if (e.refs > 0 || blobs.get(k) !== e)
1613
+ return;
1614
+ touch(k, e);
1615
+ let idle = 0;
1616
+ for (const v of blobs.values())
1617
+ if (v.refs === 0)
1618
+ idle += 1;
1619
+ for (const [ok, v] of blobs) {
1620
+ if (idle <= MEDIA_CACHE_IDLE_MAX)
1621
+ break;
1622
+ if (v.refs > 0)
1623
+ continue;
1624
+ blobs.delete(ok);
1625
+ if (v.url)
1626
+ URL.revokeObjectURL(v.url);
1627
+ idle -= 1;
1628
+ }
1629
+ }
1630
+ function mediaCacheStats() {
1631
+ let inUse = 0;
1632
+ for (const v of blobs.values())
1633
+ if (v.refs > 0)
1634
+ inUse += 1;
1635
+ return { entries: blobs.size, inUse };
1636
+ }
1637
+ function clearMediaCache() {
1638
+ for (const [k, v] of blobs) {
1639
+ if (v.refs > 0)
1640
+ continue;
1641
+ blobs.delete(k);
1642
+ if (v.url)
1643
+ URL.revokeObjectURL(v.url);
1644
+ }
1645
+ }
1646
+ function openMediaSource(host, src, kind = `image`) {
1647
+ const req = mediaRequestOf(host, src);
1648
+ const headers = req?.headers ?? {};
1649
+ const fetched = req !== null && Object.keys(headers).length > 0;
1650
+ const k = fetched ? `${kind}
1651
+ ${mediaCacheKey(req.url, headers)}` : ``;
1652
+ return {
1653
+ fetched,
1654
+ key: k,
1655
+ direct: req ? req.url : undefined,
1656
+ denied: Boolean(src) && req === null,
1657
+ open: () => {
1658
+ if (!req || !fetched)
1659
+ return { promise: Promise.resolve(req ? req.url : ``), release: () => {} };
1660
+ const hosted = kind === `stream` && host.mediaStreamUrl !== undefined;
1661
+ const entry = hosted ? streamEntry(host, req) : acquireMedia(k, () => (kind === `stream` ? fetchStream(req.url, headers) : fetchLimited(req.url, headers)).then((b) => URL.createObjectURL(b)));
1662
+ return { promise: entry.promise, release: hosted ? () => {} : () => releaseMedia(k, entry) };
1663
+ }
1664
+ };
1665
+ }
1666
+ function streamEntry(host, req) {
1667
+ const promise = Promise.resolve(host.mediaStreamUrl(req)).then((url) => {
1668
+ if (typeof url !== `string` || !mediaUrlAllowed(host, url))
1669
+ throw new Error(`stream url denied by the media policy`);
1670
+ return url;
1671
+ });
1672
+ return { promise, refs: 0 };
1673
+ }
1674
+ function fetchStream(url, headers, limits = MEDIA_LIMITS) {
1675
+ return fetchLimited(url, headers, { ...limits, maxPixels: Infinity }, false);
1676
+ }
1677
+ async function fetchLimited(url, headers, limits = MEDIA_LIMITS, image = true) {
1678
+ const abort = new AbortController;
1679
+ const timer = setTimeout(() => abort.abort(new Error(`media timed out after ${limits.timeoutMs} ms`)), limits.timeoutMs);
1680
+ const over = () => new Error(`media is over ${limits.maxBytes} bytes`);
1681
+ try {
1682
+ const r = await fetch(url, { headers, signal: abort.signal });
1683
+ if (!r.ok)
1684
+ throw new Error(`HTTP ${r.status}`);
1685
+ if (Number(r.headers.get(`content-length`) ?? NaN) > limits.maxBytes)
1686
+ throw over();
1687
+ const chunks = [];
1688
+ let total = 0;
1689
+ if (r.body) {
1690
+ const reader = r.body.getReader();
1691
+ for (;; ) {
1692
+ const { done, value } = await reader.read();
1693
+ if (done)
1694
+ break;
1695
+ total += value.byteLength;
1696
+ if (total > limits.maxBytes) {
1697
+ abort.abort();
1698
+ throw over();
1699
+ }
1700
+ chunks.push(value);
1701
+ }
1702
+ } else {
1703
+ const all = new Uint8Array(await r.arrayBuffer());
1704
+ if (all.byteLength > limits.maxBytes)
1705
+ throw over();
1706
+ chunks.push(all);
1707
+ }
1708
+ if (image) {
1709
+ const refused = mediaImageWithinLimits(chunks.length === 1 ? chunks[0] : concat(chunks), limits);
1710
+ if (refused)
1711
+ throw new Error(refused);
1712
+ }
1713
+ return new Blob(chunks, { type: r.headers.get(`content-type`) ?? `` });
1714
+ } finally {
1715
+ clearTimeout(timer);
1716
+ }
1717
+ }
1718
+ function concat(chunks) {
1719
+ const out = new Uint8Array(chunks.reduce((n, c) => n + c.byteLength, 0));
1720
+ let at = 0;
1721
+ for (const c of chunks) {
1722
+ out.set(c, at);
1723
+ at += c.byteLength;
1724
+ }
1725
+ return out;
1726
+ }
1727
+ // packages/exponential-ui/src/web/markdown.ts
1728
+ var MAX_LINK_NESTING = 32;
1729
+ var MAX_LINK_DEST = 8192;
1730
+ var TITLE = /\s+(?:"[^"]*"|'[^']*')/y;
1731
+
1732
+ class LinkScanner {
1733
+ s;
1734
+ close;
1735
+ balance;
1736
+ nextWs;
1737
+ nextGt;
1738
+ nextLtNl;
1739
+ escaped;
1740
+ constructor(s) {
1741
+ this.s = s;
1742
+ const n = s.length;
1743
+ this.close = new Int32Array(n).fill(-1);
1744
+ this.balance = new Int32Array(n + 1);
1745
+ this.escaped = new Uint8Array(n);
1746
+ const brackets = [];
1747
+ const parens = [];
1748
+ let esc = false;
1749
+ let bal = 0;
1750
+ for (let i = 0;i < n; i++) {
1751
+ this.balance[i] = bal;
1752
+ if (esc) {
1753
+ this.escaped[i] = 1;
1754
+ esc = false;
1755
+ continue;
1756
+ }
1757
+ const c = s[i];
1758
+ if (c === `\\`)
1759
+ esc = true;
1760
+ else if (c === `[`)
1761
+ brackets.push(i);
1762
+ else if (c === `]`) {
1763
+ const o = brackets.pop();
1764
+ if (o !== undefined)
1765
+ this.close[o] = i;
1766
+ } else if (c === `(`) {
1767
+ parens.push(i);
1768
+ bal++;
1769
+ } else if (c === `)`) {
1770
+ const o = parens.pop();
1771
+ if (o !== undefined)
1772
+ this.close[o] = i;
1773
+ bal--;
1774
+ }
1775
+ }
1776
+ this.balance[n] = bal;
1777
+ this.nextWs = new Int32Array(n + 1);
1778
+ this.nextGt = new Int32Array(n + 1);
1779
+ this.nextLtNl = new Int32Array(n + 1);
1780
+ this.nextWs[n] = n;
1781
+ this.nextGt[n] = -1;
1782
+ this.nextLtNl[n] = n;
1783
+ for (let i = n - 1;i >= 0; i--) {
1784
+ const c = s[i];
1785
+ this.nextWs[i] = !this.escaped[i] && /\s/.test(c) ? i : this.nextWs[i + 1];
1786
+ this.nextGt[i] = c === `>` ? i : this.nextGt[i + 1];
1787
+ this.nextLtNl[i] = c === `<` || c === `
1788
+ ` ? i : this.nextLtNl[i + 1];
1789
+ }
1790
+ }
1791
+ at(at) {
1792
+ const s = this.s;
1793
+ if (s[at] !== `[` || this.escaped[at])
1794
+ return null;
1795
+ const i = this.close[at];
1796
+ if (i < 0 || s[i + 1] !== `(`)
1797
+ return null;
1798
+ let j = i + 2;
1799
+ let dest;
1800
+ if (s[j] === `<`) {
1801
+ const close = this.nextGt[j];
1802
+ if (close < 0 || this.nextLtNl[j + 1] < close || close - j - 1 > MAX_LINK_DEST)
1803
+ return null;
1804
+ dest = s.slice(j + 1, close);
1805
+ j = close + 1;
1806
+ } else {
1807
+ const k = this.close[i + 1];
1808
+ const w = this.nextWs[j];
1809
+ let stop;
1810
+ if (k >= 0 && k < w)
1811
+ stop = k;
1812
+ else if (this.balance[w] === this.balance[j])
1813
+ stop = w;
1814
+ else
1815
+ return null;
1816
+ if (stop - j > MAX_LINK_DEST)
1817
+ return null;
1818
+ dest = s.slice(j, stop).replace(/\\([()])/g, `$1`);
1819
+ j = stop;
1820
+ }
1821
+ TITLE.lastIndex = j;
1822
+ if (TITLE.exec(s))
1823
+ j = TITLE.lastIndex;
1824
+ while (s[j] === ` `)
1825
+ j++;
1826
+ if (s[j] !== `)`)
1827
+ return null;
1828
+ return { label: s.slice(at + 1, i), dest, end: j + 1 };
1829
+ }
1830
+ }
1831
+ function linkAt(s, at) {
1832
+ return s[at] === `[` ? new LinkScanner(s).at(at) : null;
1833
+ }
1834
+ function wholeImage(text) {
1835
+ if (text[0] !== `!`)
1836
+ return null;
1837
+ const l = linkAt(text, 1);
1838
+ return l && l.end === text.length ? { alt: l.label, src: l.dest } : null;
1839
+ }
1840
+ var SIMPLE = /(`[^`]+`)|(\*\*([^*]+)\*\*)|(__([^_]+)__)|(\*([^*\s][^*]*)\*)|(_([^_\s][^_]*)_)|(~~([^~]+)~~)/;
1841
+ function parseInline(text, depth = 0) {
1842
+ const out = [];
1843
+ const scan = depth < MAX_LINK_NESTING && text.includes(`[`) ? new LinkScanner(text) : null;
1844
+ const simple = new RegExp(SIMPLE.source, `g`);
1845
+ let pos = 0;
1846
+ let m = null;
1847
+ let searched = false;
1848
+ while (pos < text.length) {
1849
+ if (!searched || m && m.index < pos) {
1850
+ simple.lastIndex = pos;
1851
+ m = simple.exec(text);
1852
+ searched = true;
1853
+ }
1854
+ const limit = m ? m.index : text.length;
1855
+ let link = null;
1856
+ if (scan) {
1857
+ for (let p = text.indexOf(`[`, pos);p >= 0 && p < limit; p = text.indexOf(`[`, p + 1)) {
1858
+ const l = scan.at(p);
1859
+ if (!l)
1860
+ continue;
1861
+ const image = p > pos && text[p - 1] === `!`;
1862
+ link = { at: image ? p - 1 : p, image, ...l };
1863
+ break;
1864
+ }
1865
+ }
1866
+ if (link) {
1867
+ if (link.at > pos)
1868
+ out.push(text.slice(pos, link.at));
1869
+ if (link.image)
1870
+ out.push(link.label);
1871
+ else
1872
+ out.push({ type: `link`, dest: link.dest, children: parseInline(link.label, depth + 1) });
1873
+ pos = link.end;
1874
+ continue;
1875
+ }
1876
+ if (!m) {
1877
+ out.push(text.slice(pos));
1878
+ break;
1879
+ }
1880
+ if (m.index > pos)
1881
+ out.push(text.slice(pos, m.index));
1882
+ if (m[1])
1883
+ out.push({ type: `code`, text: m[1].slice(1, -1) });
1884
+ else if (m[2])
1885
+ out.push({ type: `strong`, children: parseInline(m[3], depth) });
1886
+ else if (m[4])
1887
+ out.push({ type: `strong`, children: parseInline(m[5], depth) });
1888
+ else if (m[6])
1889
+ out.push({ type: `em`, children: parseInline(m[7], depth) });
1890
+ else if (m[8])
1891
+ out.push({ type: `em`, children: parseInline(m[9], depth) });
1892
+ else if (m[10])
1893
+ out.push({ type: `del`, text: m[11] });
1894
+ pos = m.index + m[0].length;
1895
+ }
1896
+ return out;
1897
+ }
1898
+ var LIST_ITEM = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/;
1899
+ function parseList(lines) {
1900
+ const indentOf = (ws) => ws.replace(/\t/g, ` `).length;
1901
+ const first = lines.length ? LIST_ITEM.exec(lines[0]) : null;
1902
+ if (!first)
1903
+ return { indent: 0, ordered: false, items: [] };
1904
+ const root = { indent: indentOf(first[1]), ordered: /\d/.test(first[2]), items: [] };
1905
+ const stack = [root];
1906
+ for (const line of lines) {
1907
+ const m = LIST_ITEM.exec(line);
1908
+ if (!m)
1909
+ continue;
1910
+ const indent = indentOf(m[1]);
1911
+ while (stack.length > 1 && indent < stack[stack.length - 1].indent)
1912
+ stack.pop();
1913
+ let list = stack[stack.length - 1];
1914
+ const parent = list.items[list.items.length - 1];
1915
+ if (parent && indent >= list.indent + 2 && stack.length < MAX_BLOCK_NESTING) {
1916
+ const child = { indent, ordered: /\d/.test(m[2]), items: [] };
1917
+ parent.children.push(child);
1918
+ stack.push(child);
1919
+ list = child;
1920
+ }
1921
+ const task = /^\[([ xX])\]\s+(.*)$/.exec(m[3]);
1922
+ list.items.push(task ? { text: task[2], content: parseInline(task[2]), task: task[1] !== ` `, children: [] } : { text: m[3], content: parseInline(m[3]), children: [] });
1923
+ }
1924
+ return root;
1925
+ }
1926
+ var isTableRow = (line) => /^\s*\|.*\|\s*$/.test(line);
1927
+ var isTableRule = (line) => /^\s*\|(\s*:?-+:?\s*\|)+\s*$/.test(line);
1928
+ var cells = (line) => line.trim().replace(/^\|/, ``).replace(/\|$/, ``).split(/(?<!\\)\|/).map((c) => c.replace(/\\\|/g, `|`).trim());
1929
+ var MAX_BLOCK_NESTING = 32;
1930
+ function parseMarkdown(text) {
1931
+ return parseBlocks(text, 0);
1932
+ }
1933
+ function parseBlocks(text, depth) {
1934
+ const lines = text.replace(/\r\n?/g, `
1935
+ `).split(`
1936
+ `);
1937
+ const blocks = [];
1938
+ let i = 0;
1939
+ const para = [];
1940
+ const flush = () => {
1941
+ if (para.length === 0)
1942
+ return;
1943
+ const text = para.join(` `);
1944
+ const image = wholeImage(text);
1945
+ if (image)
1946
+ blocks.push({ type: `image`, alt: image.alt, src: image.src });
1947
+ else
1948
+ blocks.push({ type: `paragraph`, children: parseInline(text) });
1949
+ para.length = 0;
1950
+ };
1951
+ while (i < lines.length) {
1952
+ const line = lines[i];
1953
+ const fence = /^```(\w*)\s*$/.exec(line);
1954
+ if (fence) {
1955
+ flush();
1956
+ const body = [];
1957
+ i++;
1958
+ while (i < lines.length && !/^```\s*$/.test(lines[i]))
1959
+ body.push(lines[i++]);
1960
+ i++;
1961
+ blocks.push({ type: `codeBlock`, lang: fence[1] || undefined, text: body.join(`
1962
+ `) });
1963
+ continue;
1964
+ }
1965
+ const heading = /^(#{1,6})\s+(.*)$/.exec(line);
1966
+ if (heading) {
1967
+ flush();
1968
+ blocks.push({ type: `heading`, level: heading[1].length, children: parseInline(heading[2]) });
1969
+ i++;
1970
+ continue;
1971
+ }
1972
+ if (depth < MAX_BLOCK_NESTING && /^\s*>/.test(line)) {
1973
+ flush();
1974
+ const body = [];
1975
+ while (i < lines.length && /^\s*>/.test(lines[i]))
1976
+ body.push(lines[i++].replace(/^\s*>\s?/, ``));
1977
+ blocks.push({ type: `quote`, children: parseBlocks(body.join(`
1978
+ `), depth + 1) });
1979
+ continue;
1980
+ }
1981
+ if (LIST_ITEM.test(line)) {
1982
+ flush();
1983
+ const body = [];
1984
+ while (i < lines.length && LIST_ITEM.test(lines[i]))
1985
+ body.push(lines[i++]);
1986
+ blocks.push({ type: `list`, list: parseList(body) });
1987
+ continue;
1988
+ }
1989
+ if (isTableRow(line) && i + 1 < lines.length && isTableRule(lines[i + 1])) {
1990
+ flush();
1991
+ const head = cells(line);
1992
+ const align = cells(lines[i + 1]).map((c) => c.startsWith(`:`) && c.endsWith(`:`) ? `center` : c.endsWith(`:`) ? `end` : c.startsWith(`:`) ? `start` : undefined);
1993
+ i += 2;
1994
+ const rows = [];
1995
+ while (i < lines.length && isTableRow(lines[i]))
1996
+ rows.push(cells(lines[i++]));
1997
+ blocks.push({ type: `table`, align, head: head.map((h) => parseInline(h)), rows: rows.map((r) => r.map((c) => parseInline(c))) });
1998
+ continue;
1999
+ }
2000
+ if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
2001
+ flush();
2002
+ blocks.push({ type: `rule` });
2003
+ i++;
2004
+ continue;
2005
+ }
2006
+ if (line.trim() === ``) {
2007
+ flush();
2008
+ i++;
2009
+ continue;
2010
+ }
2011
+ para.push(line.trim());
2012
+ i++;
2013
+ }
2014
+ flush();
2015
+ return blocks;
2016
+ }
2017
+ // packages/exponential-ui/src/web/form.ts
2018
+ import { coreCatalog as coreCatalog3 } from "@exponential-at/ui";
2019
+ var VALIDATE_ON = Object.fromEntries(Object.entries(coreCatalog3.components).flatMap(([name, def]) => {
2020
+ const d = def.props.validateOn?.default;
2021
+ return d === undefined ? [] : [[name, String(d)]];
2022
+ }));
2023
+ function validateOnDefault(component) {
2024
+ return VALIDATE_ON[component];
2025
+ }
2026
+ function fieldErrorsVisible(state) {
2027
+ return state.submitted || state.attempts > 0 || (state.validateOn === `change` ? state.dirty : state.validateOn === `blur` ? state.touched : false);
2028
+ }
2029
+ function documentOrder(fields) {
2030
+ return [...fields].sort((a, b) => {
2031
+ const ea = a.element();
2032
+ const eb = b.element();
2033
+ if (!ea || !eb)
2034
+ return 0;
2035
+ return ea.compareDocumentPosition(eb) & 4 ? -1 : 1;
2036
+ });
2037
+ }
2038
+
2039
+ class FormRegistry {
2040
+ fields = new Set;
2041
+ register(field) {
2042
+ this.fields.add(field);
2043
+ return () => void this.fields.delete(field);
2044
+ }
2045
+ check() {
2046
+ const list = documentOrder(this.fields);
2047
+ const errors = [];
2048
+ let first = null;
2049
+ for (const f of list) {
2050
+ const errs = f.errors();
2051
+ if (errs.length && !first)
2052
+ first = f;
2053
+ for (const message of errs)
2054
+ errors.push({ name: f.name, message });
2055
+ }
2056
+ if (errors.length)
2057
+ return { ok: false, errors, first };
2058
+ const values = {};
2059
+ for (const f of list)
2060
+ values[f.name] = f.value();
2061
+ return { ok: true, values };
2062
+ }
2063
+ stillFailing(summary) {
2064
+ return summary.filter((e) => [...this.fields].some((f) => f.name === e.name && f.errors().includes(e.message)));
2065
+ }
2066
+ }
2067
+ // packages/exponential-ui/src/web/list.ts
2068
+ function scrollParent(el, axis = `vertical`) {
2069
+ let cur = el?.parentElement ?? null;
2070
+ while (cur && cur !== document.body && cur !== document.documentElement) {
2071
+ const cs = getComputedStyle(cur);
2072
+ const o = axis === `vertical` ? cs.overflowY : cs.overflowX;
2073
+ const scrolls = axis === `vertical` ? cur.scrollHeight > cur.clientHeight + 1 : cur.scrollWidth > cur.clientWidth + 1;
2074
+ if ((o === `auto` || o === `scroll`) && scrolls)
2075
+ return cur;
2076
+ cur = cur.parentElement;
2077
+ }
2078
+ return null;
2079
+ }
2080
+ function listViewport(el, axis, rtl, known) {
2081
+ const scroller = known === undefined ? scrollParent(el, axis) : known;
2082
+ const r = el.getBoundingClientRect();
2083
+ if (axis === `vertical`) {
2084
+ if (scroller) {
2085
+ const s = scroller.getBoundingClientRect();
2086
+ return { scroll: s.top + scroller.clientTop - r.top, viewport: scroller.clientHeight, scroller };
2087
+ }
2088
+ return { scroll: -r.top, viewport: window.innerHeight, scroller };
2089
+ }
2090
+ if (scroller) {
2091
+ const s = scroller.getBoundingClientRect();
2092
+ const scroll = rtl ? r.right - (s.right - scroller.clientLeft) : s.left + scroller.clientLeft - r.left;
2093
+ return { scroll, viewport: scroller.clientWidth, scroller };
2094
+ }
2095
+ return { scroll: rtl ? r.right - window.innerWidth : -r.left, viewport: window.innerWidth, scroller };
2096
+ }
2097
+ // packages/exponential-ui/src/web/listbox.ts
2098
+ var TYPEAHEAD_RESET_MS = 700;
2099
+ function nextEnabledIndex(count, from, delta, isDisabled = () => false) {
2100
+ if (count === 0)
2101
+ return -1;
2102
+ let i = from;
2103
+ for (let n = 0;n < count; n++) {
2104
+ i = ((i + delta) % count + count) % count;
2105
+ if (!isDisabled(i))
2106
+ return i;
2107
+ }
2108
+ return -1;
2109
+ }
2110
+ function typeaheadStep(buffer, key, now, active, count, isDisabled, labelOf) {
2111
+ const next = { text: now - buffer.at > TYPEAHEAD_RESET_MS ? key.toLowerCase() : buffer.text + key.toLowerCase(), at: now };
2112
+ for (let n = 1;n <= count; n++) {
2113
+ const i = (Math.max(0, active) + (next.text.length > 1 ? n - 1 : n)) % count;
2114
+ if (!isDisabled(i) && labelOf(i).toLowerCase().startsWith(next.text))
2115
+ return { buffer: next, index: i };
2116
+ }
2117
+ return { buffer: next, index: -1 };
2118
+ }
2119
+ // packages/exponential-ui/src/web/parts.ts
2120
+ var PLACED = {
2121
+ Switch: [`body`, `label`, `description`, `track`],
2122
+ Input: [`label`, `field`, `description`, `error`],
2123
+ Textarea: [`label`, `field`, `description`, `error`],
2124
+ NumberField: [`label`, `field`, `decrement`, `input`, `unit`, `increment`, `description`, `error`],
2125
+ ChipInput: [`label`, `field`, `input`, `description`, `error`],
2126
+ Select: [`label`, `trigger`],
2127
+ DatePicker: [`label`, `trigger`],
2128
+ DateRangePicker: [`label`, `trigger`],
2129
+ TimePicker: [`label`, `trigger`],
2130
+ Radio: [`label`, `items`],
2131
+ ChoiceTiles: [`error`],
2132
+ Checkbox: [`box`, `label`, `description`],
2133
+ Slider: [`header`, `label`, `value`, `track`],
2134
+ Tabs: [`list`, `content`, `new`],
2135
+ SearchList: [`head`, `search`, `count`, `body`, `list`, `empty`, `fade`],
2136
+ Menu: [`trigger`, `head`, `search`, `count`, `body`, `list`, `empty`, `fade`],
2137
+ Table: [`header`, `body`, `caption`, `empty`],
2138
+ Carousel: [`page`, `indicator`, `controls`, `previous`, `next`],
2139
+ Tooltip: [`anchor`],
2140
+ FileUpload: [`label`, `dropzone`, `icon`, `title`, `hint`, `browse`, `description`],
2141
+ CodeBlock: [`header`, `title`, `copy`, `body`],
2142
+ AudioPlayer: [`track`, `controls`],
2143
+ Video: [`controls`],
2144
+ Image: [`fallback`],
2145
+ Ring: [`label`]
2146
+ };
2147
+ function placedPartId(component, part, domId) {
2148
+ return PLACED[component]?.includes(part) ? `${domId}.${part}` : null;
2149
+ }
2150
+ // packages/exponential-ui/src/web/share.ts
2151
+ var isPlainObject2 = (v) => {
2152
+ const proto = Object.getPrototypeOf(v);
2153
+ return proto === Object.prototype || proto === null;
2154
+ };
2155
+ var idOf = (v) => typeof v === `object` && v !== null && typeof v.id === `string` ? v.id : undefined;
2156
+ function share(prev, next) {
2157
+ if (Object.is(prev, next) || typeof prev !== `object` || typeof next !== `object` || prev === null || next === null)
2158
+ return next;
2159
+ if (Array.isArray(next)) {
2160
+ if (!Array.isArray(prev))
2161
+ return next;
2162
+ const byId = prev.length > 0 && idOf(prev[0]) !== undefined ? new Map(prev.map((p) => [idOf(p), p])) : null;
2163
+ let same = prev.length === next.length;
2164
+ const out = next.map((v, i) => {
2165
+ const id = byId ? idOf(v) : undefined;
2166
+ const s = share(id !== undefined ? byId.get(id) : prev[i], v);
2167
+ if (s !== prev[i])
2168
+ same = false;
2169
+ return s;
2170
+ });
2171
+ return same ? prev : out;
2172
+ }
2173
+ if (Array.isArray(prev) || !isPlainObject2(prev) || !isPlainObject2(next))
2174
+ return next;
2175
+ const p = prev;
2176
+ const keys = Object.keys(next);
2177
+ let same = keys.length === Object.keys(p).length;
2178
+ const out = {};
2179
+ for (const k of keys) {
2180
+ const had = Object.prototype.hasOwnProperty.call(p, k);
2181
+ const s = share(had ? p[k] : undefined, next[k]);
2182
+ out[k] = s;
2183
+ if (!had || s !== p[k])
2184
+ same = false;
2185
+ }
2186
+ return same ? prev : out;
2187
+ }
2188
+ export {
2189
+ BASE_CSS,
2190
+ CLIENT_FUNCTIONS,
2191
+ DEBOUNCE_MS,
2192
+ FormRegistry,
2193
+ HostOwnedController,
2194
+ LAYERS,
2195
+ LIST_ITEM,
2196
+ LITERAL_ROWS_ROOT,
2197
+ MAX_BLOCK_NESTING,
2198
+ MAX_LINK_DEST,
2199
+ MAX_LINK_NESTING,
2200
+ MEDIA_CACHE_IDLE_MAX,
2201
+ PLACED,
2202
+ STATE_SELECTORS,
2203
+ TYPEAHEAD_RESET_MS,
2204
+ absolutePath,
2205
+ acceptsFile,
2206
+ acquireMedia,
2207
+ addDays,
2208
+ addMonths,
2209
+ animationDeclarations,
2210
+ ariaAttributes,
2211
+ arr,
2212
+ bindTree,
2213
+ bool,
2214
+ boundPath,
2215
+ builtinIconName,
2216
+ calendarStop,
2217
+ clearMediaCache,
2218
+ compileNodeSheet,
2219
+ compileTheme,
2220
+ compiledTheme,
2221
+ cssEscape,
2222
+ cssValue,
2223
+ declarations,
2224
+ documentOrder,
2225
+ dynamicStyleEntries,
2226
+ failingCheck,
2227
+ failingChecks,
2228
+ fetchLimited,
2229
+ fetchStream,
2230
+ fieldErrorsVisible,
2231
+ formatFileSize,
2232
+ formatterOf,
2233
+ getPointer,
2234
+ globalsCss,
2235
+ hasDynamic,
2236
+ hostPath,
2237
+ isBinding,
2238
+ isCall,
2239
+ isMacroComponent,
2240
+ isoDate,
2241
+ joinIds,
2242
+ linkAt,
2243
+ linkHref,
2244
+ listViewport,
2245
+ lookupIcon,
2246
+ mediaCacheKey,
2247
+ mediaCacheStats,
2248
+ mediaRequestOf,
2249
+ mediaUrlAllowed,
2250
+ memoFormatter,
2251
+ monthGrid,
2252
+ nextEnabledIndex,
2253
+ nodeClass,
2254
+ nodeSheet,
2255
+ nodeSheetBatches,
2256
+ num2 as num,
2257
+ objects,
2258
+ openAllowed,
2259
+ openMediaSource,
2260
+ ownPrivateHosts,
2261
+ parseInline,
2262
+ parseIsoDate,
2263
+ parseList,
2264
+ parseLocaleNumber,
2265
+ parseMarkdown,
2266
+ partClass,
2267
+ phrase,
2268
+ placedPartId,
2269
+ pointerTokens,
2270
+ propAttribute,
2271
+ queryToken,
2272
+ releaseMedia,
2273
+ resolveAccessibility,
2274
+ resolveNodeProps,
2275
+ resolveProps,
2276
+ resolveValue,
2277
+ resolveVisible,
2278
+ resolvedMediaKey,
2279
+ rule,
2280
+ ruleSelectors,
2281
+ sameDay,
2282
+ scrollParent,
2283
+ setPointer,
2284
+ share,
2285
+ shimmerRule,
2286
+ sortRows,
2287
+ str,
2288
+ streamEntry,
2289
+ styleDirection,
2290
+ surfaceClass,
2291
+ themeScope,
2292
+ tokenVar,
2293
+ tokenVarName,
2294
+ typeaheadStep,
2295
+ urlPolicyOf,
2296
+ validateOnDefault,
2297
+ viewOf,
2298
+ walkNodes,
2299
+ wholeImage
2300
+ };
2301
+
2302
+ //# debugId=F23A7429A2CCC72864756E2164756E21
2303
+ //# sourceMappingURL=index.js.map