@epilot/zenith-react 0.2.0-next.0 → 0.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/components/accordion/accordion.js +57 -48
  2. package/dist/components/accordion/accordion.js.map +1 -1
  3. package/dist/components/alert-dialog/alert-dialog.js +120 -92
  4. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  5. package/dist/components/avatar/avatar-group.js +38 -35
  6. package/dist/components/avatar/avatar-group.js.map +1 -1
  7. package/dist/components/avatar/avatar.js +78 -71
  8. package/dist/components/avatar/avatar.js.map +1 -1
  9. package/dist/components/badge/badge.js +60 -55
  10. package/dist/components/badge/badge.js.map +1 -1
  11. package/dist/components/breadcrumb/breadcrumb.js +99 -54
  12. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  13. package/dist/components/button/button.js +87 -77
  14. package/dist/components/button/button.js.map +1 -1
  15. package/dist/components/button-group/button-group.js +36 -32
  16. package/dist/components/button-group/button-group.js.map +1 -1
  17. package/dist/components/callout/callout.js +105 -98
  18. package/dist/components/callout/callout.js.map +1 -1
  19. package/dist/components/card/card.js +62 -52
  20. package/dist/components/card/card.js.map +1 -1
  21. package/dist/components/checkbox/checkbox.js +22 -19
  22. package/dist/components/checkbox/checkbox.js.map +1 -1
  23. package/dist/components/code-block/code-block.js +135 -123
  24. package/dist/components/code-block/code-block.js.map +1 -1
  25. package/dist/components/code-editor/code-editor.js +276 -260
  26. package/dist/components/code-editor/code-editor.js.map +1 -1
  27. package/dist/components/collapsible-sidebar/collapsible-sidebar.js +62 -56
  28. package/dist/components/collapsible-sidebar/collapsible-sidebar.js.map +1 -1
  29. package/dist/components/command/command.js +116 -105
  30. package/dist/components/command/command.js.map +1 -1
  31. package/dist/components/data-table/data-table-body.js +38 -34
  32. package/dist/components/data-table/data-table-body.js.map +1 -1
  33. package/dist/components/data-table/data-table-column-header.js +30 -26
  34. package/dist/components/data-table/data-table-column-header.js.map +1 -1
  35. package/dist/components/data-table/data-table-column-order.js +79 -73
  36. package/dist/components/data-table/data-table-column-order.js.map +1 -1
  37. package/dist/components/data-table/data-table-column-visibility.js +25 -22
  38. package/dist/components/data-table/data-table-column-visibility.js.map +1 -1
  39. package/dist/components/data-table/data-table-content.js +47 -44
  40. package/dist/components/data-table/data-table-content.js.map +1 -1
  41. package/dist/components/data-table/data-table-error.js +36 -32
  42. package/dist/components/data-table/data-table-error.js.map +1 -1
  43. package/dist/components/data-table/data-table-footer.js +10 -8
  44. package/dist/components/data-table/data-table-footer.js.map +1 -1
  45. package/dist/components/data-table/data-table-header-draggable.js +40 -36
  46. package/dist/components/data-table/data-table-header-draggable.js.map +1 -1
  47. package/dist/components/data-table/data-table-loading.js +21 -18
  48. package/dist/components/data-table/data-table-loading.js.map +1 -1
  49. package/dist/components/data-table/data-table-resize-handle.js +13 -11
  50. package/dist/components/data-table/data-table-resize-handle.js.map +1 -1
  51. package/dist/components/data-table/data-table-row.js +47 -44
  52. package/dist/components/data-table/data-table-row.js.map +1 -1
  53. package/dist/components/data-table/data-table-toolbar.js +9 -7
  54. package/dist/components/data-table/data-table-toolbar.js.map +1 -1
  55. package/dist/components/data-table/data-table.js +48 -46
  56. package/dist/components/data-table/data-table.js.map +1 -1
  57. package/dist/components/date-range-picker/date-range-picker.js +173 -164
  58. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  59. package/dist/components/date-range-picker/range-calendar.js +36 -34
  60. package/dist/components/date-range-picker/range-calendar.js.map +1 -1
  61. package/dist/components/date-time-picker/calendar.js +290 -272
  62. package/dist/components/date-time-picker/calendar.js.map +1 -1
  63. package/dist/components/date-time-picker/date-time-picker-input.js +22 -20
  64. package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
  65. package/dist/components/date-time-picker/date-time-picker-panel.js +126 -120
  66. package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
  67. package/dist/components/date-time-picker/date-time-picker.js +42 -40
  68. package/dist/components/date-time-picker/date-time-picker.js.map +1 -1
  69. package/dist/components/date-time-picker/time-picker.js +95 -87
  70. package/dist/components/date-time-picker/time-picker.js.map +1 -1
  71. package/dist/components/dialog/dialog.js +115 -95
  72. package/dist/components/dialog/dialog.js.map +1 -1
  73. package/dist/components/drawer/drawer.js +144 -109
  74. package/dist/components/drawer/drawer.js.map +1 -1
  75. package/dist/components/dropdown-menu/dropdown-menu.js +141 -112
  76. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  77. package/dist/components/field/field-combobox.js +196 -176
  78. package/dist/components/field/field-combobox.js.map +1 -1
  79. package/dist/components/field/field.js +137 -126
  80. package/dist/components/field/field.js.map +1 -1
  81. package/dist/components/list/list.js +237 -219
  82. package/dist/components/list/list.js.map +1 -1
  83. package/dist/components/option-card/option-card.js +129 -116
  84. package/dist/components/option-card/option-card.js.map +1 -1
  85. package/dist/components/pill/pill.js +55 -51
  86. package/dist/components/pill/pill.js.map +1 -1
  87. package/dist/components/popover/popover.js +53 -36
  88. package/dist/components/popover/popover.js.map +1 -1
  89. package/dist/components/radio/radio.js +38 -34
  90. package/dist/components/radio/radio.js.map +1 -1
  91. package/dist/components/scroll-area/scroll-area.js +38 -35
  92. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  93. package/dist/components/scroll-overflow/scroll-overflow.js +166 -151
  94. package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
  95. package/dist/components/segmented-control/segmented-control.js +93 -85
  96. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  97. package/dist/components/select/select.js +149 -128
  98. package/dist/components/select/select.js.map +1 -1
  99. package/dist/components/separator/separator.js +19 -16
  100. package/dist/components/separator/separator.js.map +1 -1
  101. package/dist/components/skeleton/skeleton.js +34 -30
  102. package/dist/components/skeleton/skeleton.js.map +1 -1
  103. package/dist/components/spinner/spinner.js +22 -17
  104. package/dist/components/spinner/spinner.js.map +1 -1
  105. package/dist/components/surface/surface.js +25 -22
  106. package/dist/components/surface/surface.js.map +1 -1
  107. package/dist/components/switch/switch.js +66 -57
  108. package/dist/components/switch/switch.js.map +1 -1
  109. package/dist/components/table/table-pagination.js +139 -129
  110. package/dist/components/table/table-pagination.js.map +1 -1
  111. package/dist/components/table/table.js +104 -90
  112. package/dist/components/table/table.js.map +1 -1
  113. package/dist/components/tabs/tabs.js +206 -128
  114. package/dist/components/tabs/tabs.js.map +1 -1
  115. package/dist/components/toast/toast.js +112 -100
  116. package/dist/components/toast/toast.js.map +1 -1
  117. package/dist/components/toggle/toggle.js +32 -30
  118. package/dist/components/toggle/toggle.js.map +1 -1
  119. package/dist/components/tooltip/tooltip.js +59 -46
  120. package/dist/components/tooltip/tooltip.js.map +1 -1
  121. package/dist/index.d.ts +12 -0
  122. package/dist/lib/clear-button.js +18 -17
  123. package/dist/lib/clear-button.js.map +1 -1
  124. package/dist/styles/host-reset.js +47 -0
  125. package/dist/styles/host-reset.js.map +1 -0
  126. package/dist/styles/overlay-layer.js +5 -0
  127. package/dist/styles/overlay-layer.js.map +1 -0
  128. package/dist/tokens.json +1 -1
  129. package/package.json +8 -7
  130. package/scripts/migration-diagnostics.mjs +42 -7
  131. package/scripts/migration-sweep.mjs +9 -1
@@ -1,25 +1,27 @@
1
- import { jsxs as g, jsx as o } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { SLOT_ATTR as t, mergeClasses as m, shorthands as l } from "@epilot/zenith-runtime/v1";
4
- import { makeZenithStyles as oe } from "../../styles/make-styles.js";
5
- import { surfaceContainer as T, spacingElement3 as X, spacingElement2 as p, grayA8 as te, grayA2 as j, focusRing as ie, grayA12 as D, leadingXs as R, textXs as $, fontMono as E, spacingElement05 as b, grayA11 as le, fontWeightMedium as ae, surfaceRadiusContainer as ne, borderWidthContainer as Y, surfaceSep as re, spacingElement1 as ce, borderContainer as de } from "../../tokens/index.js";
6
- import { Button as se } from "../button/button.js";
7
- import { highlightCode as pe, splitTokenLines as he } from "../../lib/code-highlight.js";
8
- import { useCodeTokenRenderer as ue } from "../../lib/code-tokens.js";
9
- import { gutterDigits as fe } from "../../lib/code-lines.js";
10
- const me = 2e3, F = "--zenith-code-gutter", be = oe({
1
+ import { jsxs as k, jsx as o } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { SLOT_ATTR as t, mergeClasses as b, shorthands as l } from "@epilot/zenith-runtime/v1";
4
+ import { makeZenithStyles as te } from "../../styles/make-styles.js";
5
+ import { boxModel as a } from "../../styles/host-reset.js";
6
+ import { surfaceContainer as R, spacingElement3 as j, spacingElement2 as h, grayA8 as ie, grayA2 as D, focusRing as le, grayA12 as E, leadingXs as $, textXs as B, fontMono as Y, spacingElement05 as g, grayA11 as ae, fontWeightMedium as ne, surfaceRadiusContainer as re, borderWidthContainer as F, surfaceSep as de, spacingElement1 as ce, borderContainer as se } from "../../tokens/index.js";
7
+ import { Button as pe } from "../button/button.js";
8
+ import { highlightCode as he, splitTokenLines as ue } from "../../lib/code-highlight.js";
9
+ import { useCodeTokenRenderer as fe } from "../../lib/code-tokens.js";
10
+ import { gutterDigits as me } from "../../lib/code-lines.js";
11
+ const be = 2e3, P = "--zenith-code-gutter", ge = te({
11
12
  root: {
13
+ ...a,
12
14
  display: "flex",
13
15
  flexDirection: "column",
14
16
  minWidth: 0,
15
17
  position: "relative",
16
18
  // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's
17
19
  // own border or radius replaces these through `mergeClasses` without a wrapper.
18
- backgroundColor: T,
19
- ...l.borderWidth(Y),
20
+ backgroundColor: R,
21
+ ...l.borderWidth(F),
20
22
  ...l.borderStyle("solid"),
21
- ...l.borderColor(de),
22
- borderRadius: ne,
23
+ ...l.borderColor(se),
24
+ borderRadius: re,
23
25
  overflowX: "hidden",
24
26
  overflowY: "hidden"
25
27
  },
@@ -29,30 +31,33 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
29
31
  "&:focus-within [data-copy-state]": { opacity: 1 }
30
32
  },
31
33
  header: {
34
+ ...a,
32
35
  display: "flex",
33
36
  alignItems: "center",
34
- ...l.gap(p),
37
+ ...l.gap(h),
35
38
  ...l.paddingBlock(ce),
36
- ...l.paddingInline(p),
39
+ ...l.paddingInline(h),
37
40
  // `borderBottom` expands to the three bottom-edge longhands; there is no per-edge width
38
41
  // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand
39
42
  // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.
40
43
  ...l.borderBottom(
41
- Y,
44
+ F,
42
45
  "solid",
43
- re
46
+ de
44
47
  )
45
48
  },
46
49
  // Reserve the overlay button's width when a caption is present.
47
50
  headerWithCopy: {
48
- paddingRight: `calc(1.75rem + ${p} + ${b})`,
49
- minHeight: `calc(1.75rem + ${b} + ${b})`
51
+ ...a,
52
+ paddingRight: `calc(1.75rem + ${h} + ${g})`,
53
+ minHeight: `calc(1.75rem + ${g} + ${g})`
50
54
  },
51
55
  title: {
52
- fontSize: $,
53
- lineHeight: R,
54
- fontWeight: ae,
55
- color: D,
56
+ ...a,
57
+ fontSize: B,
58
+ lineHeight: $,
59
+ fontWeight: ne,
60
+ color: E,
56
61
  minWidth: 0,
57
62
  overflowX: "hidden",
58
63
  overflowY: "hidden",
@@ -60,15 +65,16 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
60
65
  whiteSpace: "nowrap"
61
66
  },
62
67
  language: {
63
- fontSize: $,
64
- lineHeight: R,
65
- color: le,
68
+ fontSize: B,
69
+ lineHeight: $,
70
+ color: ae,
66
71
  // The language label names a machine format, so it stays in the code family rather than
67
72
  // inheriting the surrounding UI face.
68
- fontFamily: E,
73
+ fontFamily: Y,
69
74
  whiteSpace: "nowrap"
70
75
  },
71
76
  headerSpacer: {
77
+ ...a,
72
78
  flexGrow: 1,
73
79
  flexShrink: 1,
74
80
  flexBasis: "0%",
@@ -77,10 +83,10 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
77
83
  // The button stays in the tab order while its paint is hidden.
78
84
  copy: {
79
85
  position: "absolute",
80
- top: b,
81
- right: b,
86
+ top: g,
87
+ right: g,
82
88
  zIndex: 1,
83
- backgroundColor: T,
89
+ backgroundColor: R,
84
90
  opacity: 0,
85
91
  transitionProperty: "opacity",
86
92
  transitionDuration: "120ms",
@@ -96,14 +102,15 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
96
102
  "&:focus-visible": { opacity: 1 }
97
103
  },
98
104
  pre: {
105
+ ...a,
99
106
  ...l.margin(0),
100
- ...l.padding(p),
107
+ ...l.padding(h),
101
108
  overflowX: "auto",
102
109
  overflowY: "auto",
103
- fontFamily: E,
104
- fontSize: $,
105
- lineHeight: R,
106
- color: D,
110
+ fontFamily: Y,
111
+ fontSize: B,
112
+ lineHeight: $,
113
+ color: E,
107
114
  // `tab-size` is what makes a tab-indented source line up at all; 2 matches the indent the
108
115
  // editor inserts by default.
109
116
  tabSize: 2,
@@ -113,11 +120,12 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
113
120
  outlineWidth: "2px",
114
121
  outlineStyle: "solid",
115
122
  outlineOffset: "-2px",
116
- outlineColor: ie
123
+ outlineColor: le
117
124
  }
118
125
  },
119
126
  // Sticky numbers must pin flush to the scrollport.
120
127
  preGutter: {
128
+ ...a,
121
129
  paddingLeft: 0
122
130
  },
123
131
  preNoWrap: {
@@ -136,16 +144,18 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
136
144
  },
137
145
  // Give sticky gutters and row bands the full width of unwrapped code.
138
146
  codeNoWrap: {
147
+ ...a,
139
148
  width: "max-content",
140
149
  minWidth: "100%"
141
150
  },
142
151
  line: {
152
+ ...a,
143
153
  display: "flex",
144
154
  width: "100%",
145
155
  // Avoid sticky touch-hover states; paint both cells because the gutter is opaque.
146
156
  "@media (hover: hover)": {
147
157
  [`&:hover [${t}='code-block-line-number'], &:hover [${t}='code-block-line-content']`]: {
148
- backgroundImage: `linear-gradient(${j}, ${j})`
158
+ backgroundImage: `linear-gradient(${D}, ${D})`
149
159
  }
150
160
  }
151
161
  },
@@ -156,17 +166,18 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
156
166
  textAlign: "right",
157
167
  flexGrow: 0,
158
168
  flexShrink: 0,
159
- color: te,
169
+ color: ie,
160
170
  boxSizing: "border-box",
161
- width: `calc(var(${F}) + ${p} + ${X})`,
162
- paddingLeft: p,
163
- paddingRight: X,
171
+ width: `calc(var(${P}) + ${h} + ${j})`,
172
+ paddingLeft: h,
173
+ paddingRight: j,
164
174
  // Opaque because horizontally scrolled code passes beneath the sticky gutter.
165
175
  position: "sticky",
166
176
  left: 0,
167
- backgroundColor: T
177
+ backgroundColor: R
168
178
  },
169
179
  lineContent: {
180
+ ...a,
170
181
  minWidth: 0,
171
182
  flexGrow: 1,
172
183
  flexShrink: 1,
@@ -176,6 +187,7 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
176
187
  overflowWrap: "break-word"
177
188
  },
178
189
  srOnly: {
190
+ ...a,
179
191
  position: "absolute",
180
192
  width: "1px",
181
193
  height: "1px",
@@ -186,7 +198,7 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
186
198
  clip: "rect(0, 0, 0, 0)",
187
199
  whiteSpace: "nowrap"
188
200
  }
189
- }), ge = (k) => /* @__PURE__ */ g(
201
+ }), ke = (v) => /* @__PURE__ */ k(
190
202
  "svg",
191
203
  {
192
204
  xmlns: "http://www.w3.org/2000/svg",
@@ -198,13 +210,13 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
198
210
  strokeLinejoin: "round",
199
211
  "aria-hidden": "true",
200
212
  focusable: "false",
201
- ...k,
213
+ ...v,
202
214
  children: [
203
215
  /* @__PURE__ */ o("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
204
216
  /* @__PURE__ */ o("path", { d: "M5 15V5a2 2 0 0 1 2-2h10" })
205
217
  ]
206
218
  }
207
- ), ke = (k) => /* @__PURE__ */ o(
219
+ ), ve = (v) => /* @__PURE__ */ o(
208
220
  "svg",
209
221
  {
210
222
  xmlns: "http://www.w3.org/2000/svg",
@@ -216,97 +228,97 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
216
228
  strokeLinejoin: "round",
217
229
  "aria-hidden": "true",
218
230
  focusable: "false",
219
- ...k,
231
+ ...v,
220
232
  children: /* @__PURE__ */ o("path", { d: "m4 12.5 5 5 11-11" })
221
233
  }
222
- ), Re = a.forwardRef(
234
+ ), Be = n.forwardRef(
223
235
  function({
224
- code: r,
236
+ code: d,
225
237
  language: c,
226
- title: S,
227
- wrap: C = !1,
228
- showLineNumbers: v = !1,
229
- copyable: y = !1,
230
- copyLabel: P = "Copy code",
231
- copiedLabel: _ = "Copied",
232
- copyErrorLabel: K = "Copy failed",
233
- onCopy: w,
234
- onCopyError: x,
235
- className: U,
236
- style: B,
237
- ...W
238
- }, V) {
239
- const e = be(), I = `${a.useId()}-title`, [h, L] = a.useState("idle"), d = a.useRef(null);
240
- a.useEffect(
238
+ title: C,
239
+ wrap: W = !1,
240
+ showLineNumbers: y = !1,
241
+ copyable: w = !1,
242
+ copyLabel: _ = "Copy code",
243
+ copiedLabel: K = "Copied",
244
+ copyErrorLabel: U = "Copy failed",
245
+ onCopy: x,
246
+ onCopyError: S,
247
+ className: V,
248
+ style: I,
249
+ ...N
250
+ }, Z) {
251
+ const e = ge(), L = `${n.useId()}-title`, [u, z] = n.useState("idle"), s = n.useRef(null);
252
+ n.useEffect(
241
253
  () => () => {
242
- d.current !== null && clearTimeout(d.current);
254
+ s.current !== null && clearTimeout(s.current);
243
255
  },
244
256
  []
245
257
  );
246
- const Z = a.useCallback(async () => {
247
- let n = null;
258
+ const q = n.useCallback(async () => {
259
+ let r = null;
248
260
  try {
249
261
  const i = typeof navigator > "u" ? void 0 : navigator.clipboard;
250
- typeof (i == null ? void 0 : i.writeText) != "function" ? n = new Error("Clipboard API unavailable") : await i.writeText(r);
262
+ typeof (i == null ? void 0 : i.writeText) != "function" ? r = new Error("Clipboard API unavailable") : await i.writeText(d);
251
263
  } catch (i) {
252
- n = i ?? new Error("Clipboard write rejected");
264
+ r = i ?? new Error("Clipboard write rejected");
253
265
  }
254
- n === null ? w == null || w(r) : x == null || x(n), L(n === null ? "copied" : "error"), d.current !== null && clearTimeout(d.current), d.current = setTimeout(() => {
255
- d.current = null, L("idle");
256
- }, me);
257
- }, [r, w, x]), u = r.endsWith(`
258
- `) ? r.slice(0, -1) : r, z = ue(), f = a.useMemo(
259
- () => pe(u, c),
260
- [u, c]
261
- ), s = a.useMemo(
262
- () => v ? u.split(`
266
+ r === null ? x == null || x(d) : S == null || S(r), z(r === null ? "copied" : "error"), s.current !== null && clearTimeout(s.current), s.current = setTimeout(() => {
267
+ s.current = null, z("idle");
268
+ }, be);
269
+ }, [d, x, S]), f = d.endsWith(`
270
+ `) ? d.slice(0, -1) : d, A = fe(), m = n.useMemo(
271
+ () => he(f, c),
272
+ [f, c]
273
+ ), p = n.useMemo(
274
+ () => y ? f.split(`
263
275
  `) : null,
264
- [u, v]
265
- ), A = a.useMemo(
266
- () => v && f !== null ? he(f) : null,
267
- [f, v]
268
- ), N = S !== void 0 && S !== "", M = c !== void 0 && c !== "", G = W["aria-label"], q = W["aria-labelledby"], H = N ? I : q, J = H !== void 0 || G !== void 0, O = h === "copied" ? _ : h === "error" ? K : P, Q = N || M, ee = s === null ? B : {
269
- [F]: `${fe(s.length)}ch`,
270
- ...B
276
+ [f, y]
277
+ ), M = n.useMemo(
278
+ () => y && m !== null ? ue(m) : null,
279
+ [m, y]
280
+ ), T = C !== void 0 && C !== "", G = c !== void 0 && c !== "", H = N["aria-label"], J = N["aria-labelledby"], O = T ? L : J, Q = O !== void 0 || H !== void 0, X = u === "copied" ? K : u === "error" ? U : _, ee = T || G, oe = p === null ? I : {
281
+ [P]: `${me(p.length)}ch`,
282
+ ...I
271
283
  };
272
- return /* @__PURE__ */ g(
284
+ return /* @__PURE__ */ k(
273
285
  "div",
274
286
  {
275
- ref: V,
287
+ ref: Z,
276
288
  "data-slot": "code-block",
277
289
  [t]: "code-block",
278
290
  "data-language": c,
279
- className: m(
291
+ className: b(
280
292
  e.root,
281
- y ? e.rootCopyReveal : void 0,
282
- U
293
+ w ? e.rootCopyReveal : void 0,
294
+ V
283
295
  ),
284
- style: ee,
285
- ...W,
296
+ style: oe,
297
+ ...N,
286
298
  "aria-label": void 0,
287
299
  "aria-labelledby": void 0,
288
300
  children: [
289
- Q ? /* @__PURE__ */ g(
301
+ ee ? /* @__PURE__ */ k(
290
302
  "div",
291
303
  {
292
304
  "data-slot": "code-block-header",
293
305
  [t]: "code-block-header",
294
- className: m(
306
+ className: b(
295
307
  e.header,
296
- y ? e.headerWithCopy : void 0
308
+ w ? e.headerWithCopy : void 0
297
309
  ),
298
310
  children: [
299
- N ? /* @__PURE__ */ o(
311
+ T ? /* @__PURE__ */ o(
300
312
  "span",
301
313
  {
302
- id: I,
314
+ id: L,
303
315
  "data-slot": "code-block-title",
304
316
  [t]: "code-block-title",
305
317
  className: e.title,
306
- children: S
318
+ children: C
307
319
  }
308
320
  ) : null,
309
- M ? /* @__PURE__ */ o(
321
+ G ? /* @__PURE__ */ o(
310
322
  "span",
311
323
  {
312
324
  "data-slot": "code-block-language",
@@ -319,17 +331,17 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
319
331
  ]
320
332
  }
321
333
  ) : null,
322
- y ? /* @__PURE__ */ o(
323
- se,
334
+ w ? /* @__PURE__ */ o(
335
+ pe,
324
336
  {
325
337
  type: "button",
326
338
  variant: "ghost",
327
339
  size: "icon-sm",
328
- "data-copy-state": h,
329
- "aria-label": O,
340
+ "data-copy-state": u,
341
+ "aria-label": X,
330
342
  className: e.copy,
331
- onClick: Z,
332
- children: h === "copied" ? /* @__PURE__ */ o(ke, {}) : /* @__PURE__ */ o(ge, {})
343
+ onClick: q,
344
+ children: u === "copied" ? /* @__PURE__ */ o(ve, {}) : /* @__PURE__ */ o(ke, {})
333
345
  }
334
346
  ) : null,
335
347
  /* @__PURE__ */ o(
@@ -338,27 +350,27 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
338
350
  "data-slot": "code-block-content",
339
351
  [t]: "code-block-content",
340
352
  tabIndex: 0,
341
- role: J ? "region" : void 0,
342
- "aria-label": G,
343
- "aria-labelledby": H,
344
- className: m(
353
+ role: Q ? "region" : void 0,
354
+ "aria-label": H,
355
+ "aria-labelledby": O,
356
+ className: b(
345
357
  e.pre,
346
- s === null ? void 0 : e.preGutter,
347
- C ? e.preWrap : e.preNoWrap
358
+ p === null ? void 0 : e.preGutter,
359
+ W ? e.preWrap : e.preNoWrap
348
360
  ),
349
361
  children: /* @__PURE__ */ o(
350
362
  "code",
351
363
  {
352
364
  "data-slot": "code-block-code",
353
365
  [t]: "code-block-code",
354
- className: m(
366
+ className: b(
355
367
  e.code,
356
- s !== null && !C ? e.codeNoWrap : void 0
368
+ p !== null && !W ? e.codeNoWrap : void 0
357
369
  ),
358
- children: s === null ? (
370
+ children: p === null ? (
359
371
  // No gutter: one run, highlighted if we have a grammar, otherwise the raw string.
360
- f === null ? u : z(f)
361
- ) : s.map((n, i) => /* @__PURE__ */ g(
372
+ m === null ? f : A(m)
373
+ ) : p.map((r, i) => /* @__PURE__ */ k(
362
374
  "span",
363
375
  {
364
376
  "data-slot": "code-block-line",
@@ -376,17 +388,17 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
376
388
  children: i + 1
377
389
  }
378
390
  ),
379
- /* @__PURE__ */ g(
391
+ /* @__PURE__ */ k(
380
392
  "span",
381
393
  {
382
394
  "data-slot": "code-block-line-content",
383
395
  [t]: "code-block-line-content",
384
- className: m(
396
+ className: b(
385
397
  e.lineContent,
386
- C ? e.lineContentWrap : void 0
398
+ W ? e.lineContentWrap : void 0
387
399
  ),
388
400
  children: [
389
- A === null ? n : z(A[i] ?? []),
401
+ M === null ? r : A(M[i] ?? []),
390
402
  `
391
403
  `
392
404
  ]
@@ -400,7 +412,7 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
400
412
  )
401
413
  }
402
414
  ),
403
- y ? /* @__PURE__ */ o(
415
+ w ? /* @__PURE__ */ o(
404
416
  "span",
405
417
  {
406
418
  role: "status",
@@ -408,7 +420,7 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
408
420
  "data-slot": "code-block-copy-status",
409
421
  [t]: "code-block-copy-status",
410
422
  className: e.srOnly,
411
- children: h === "idle" ? "" : O
423
+ children: u === "idle" ? "" : X
412
424
  }
413
425
  ) : null
414
426
  ]
@@ -417,6 +429,6 @@ const me = 2e3, F = "--zenith-code-gutter", be = oe({
417
429
  }
418
430
  );
419
431
  export {
420
- Re as CodeBlock
432
+ Be as CodeBlock
421
433
  };
422
434
  //# sourceMappingURL=code-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.js","sources":["../../../src/components/code-block/code-block.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport { gutterDigits } from \"../../lib/code-lines\"\n\n/**\n * Read-only highlighted code. Source is rendered as text, and the focusable `<pre>` keeps\n * horizontal overflow keyboard-accessible.\n */\n\nconst COPY_FEEDBACK_MS = 2000\n\n/** Gutter width in monospace glyphs, shared by every numbered row. */\nconst GUTTER = \"--zenith-code-gutter\"\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's\n // own border or radius replaces these through `mergeClasses` without a wrapper.\n backgroundColor: tokens.surfaceContainer,\n ...shorthands.borderWidth(tokens.borderWidthContainer),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderContainer),\n borderRadius: tokens.surfaceRadiusContainer,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n },\n // Griffel ancestor state selectors must be declared on the ancestor.\n rootCopyReveal: {\n \"&:hover [data-copy-state]\": { opacity: 1 },\n \"&:focus-within [data-copy-state]\": { opacity: 1 },\n },\n header: {\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.paddingBlock(tokens.spacingElement1),\n ...shorthands.paddingInline(tokens.spacingElement2),\n // `borderBottom` expands to the three bottom-edge longhands; there is no per-edge width\n // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand\n // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.\n ...shorthands.borderBottom(\n tokens.borderWidthContainer,\n \"solid\",\n tokens.surfaceSep\n ),\n },\n // Reserve the overlay button's width when a caption is present.\n headerWithCopy: {\n paddingRight: `calc(1.75rem + ${tokens.spacingElement2} + ${tokens.spacingElement05})`,\n minHeight: `calc(1.75rem + ${tokens.spacingElement05} + ${tokens.spacingElement05})`,\n },\n title: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n minWidth: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n language: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA11,\n // The language label names a machine format, so it stays in the code family rather than\n // inheriting the surrounding UI face.\n fontFamily: tokens.fontMono,\n whiteSpace: \"nowrap\",\n },\n headerSpacer: {\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n minWidth: 0,\n },\n // The button stays in the tab order while its paint is hidden.\n copy: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceContainer,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // Focus and feedback must override the hidden resting state.\n \"&[data-copy-state='copied']\": { opacity: 1 },\n \"&[data-copy-state='error']\": { opacity: 1 },\n \"&:focus-visible\": { opacity: 1 },\n },\n pre: {\n ...shorthands.margin(0),\n ...shorthands.padding(tokens.spacingElement2),\n overflowX: \"auto\",\n overflowY: \"auto\",\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA12,\n // `tab-size` is what makes a tab-indented source line up at all; 2 matches the indent the\n // editor inserts by default.\n tabSize: 2,\n outlineStyle: \"none\",\n // Declared after the base so the focus ring wins, per the ordering rule in AGENTS.md.\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-2px\",\n outlineColor: tokens.focusRing,\n },\n },\n // Sticky numbers must pin flush to the scrollport.\n preGutter: {\n paddingLeft: 0,\n },\n preNoWrap: {\n whiteSpace: \"pre\",\n },\n preWrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n code: {\n // `<code>` is inline by default, which collapses the numbered-line grid to one row.\n display: \"block\",\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n lineHeight: \"inherit\",\n },\n // Give sticky gutters and row bands the full width of unwrapped code.\n codeNoWrap: {\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n display: \"flex\",\n width: \"100%\",\n // Avoid sticky touch-hover states; paint both cells because the gutter is opaque.\n \"@media (hover: hover)\": {\n [`&:hover [${SLOT_ATTR}='code-block-line-number'], &:hover [${SLOT_ATTR}='code-block-line-content']`]:\n {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n },\n },\n lineNumber: {\n // Not selectable, so dragging a selection across the block copies code and not a column of\n // integers. The copy button never sees these at all — it copies the original `code` string.\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Opaque because horizontally scrolled code passes beneath the sticky gutter.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceContainer,\n },\n lineContent: {\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n srOnly: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst CopyIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V5a2 2 0 0 1 2-2h10\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"m4 12.5 5 5 11-11\" />\n </svg>\n)\n\n/** Idle, or the outcome of the last copy attempt. Drives both the icon and the live region. */\ntype CopyState = \"idle\" | \"copied\" | \"error\"\n\nexport type CodeBlockProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\" | \"title\"\n> & {\n /** The source to display. Rendered as text — never as markup, and never evaluated. */\n code: string\n /** Language grammar used for syntax highlighting, also shown in the header. */\n language?: string\n /**\n * Visible caption, typically a file name. Also names the scrollable code region.\n *\n * This replaces the native `title` attribute, which would have rendered a browser tooltip\n * instead of a caption.\n */\n title?: string\n /** Soft-wrap long lines instead of scrolling horizontally. */\n wrap?: boolean\n /**\n * Render a non-selectable line-number gutter, and give each row a hover band.\n *\n * Off by default. Numbers are wayfinding for prose that refers to a line by number; on a\n * four-line snippet they are a column of noise that also costs horizontal space.\n */\n showLineNumbers?: boolean\n /** Show the copy button. */\n copyable?: boolean\n /** Accessible name of the copy button. */\n copyLabel?: string\n /** Announced, and used as the button's name, after a successful copy. */\n copiedLabel?: string\n /** Announced, and used as the button's name, when the clipboard is unavailable or refuses. */\n copyErrorLabel?: string\n /** Called with the exact string written to the clipboard. */\n onCopy?: (code: string) => void\n /** Called when the clipboard write failed or was unavailable. */\n onCopyError?: (error: unknown) => void\n}\n\nexport const CodeBlock = React.forwardRef<HTMLDivElement, CodeBlockProps>(\n function CodeBlock(\n {\n code,\n language,\n title,\n wrap = false,\n showLineNumbers = false,\n copyable = false,\n copyLabel = \"Copy code\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n onCopy,\n onCopyError,\n className,\n style,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const reactId = React.useId()\n const titleId = `${reactId}-title`\n\n const [copyState, setCopyState] = React.useState<CopyState>(\"idle\")\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n React.useEffect(\n () => () => {\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n },\n []\n )\n\n const handleCopy = React.useCallback(async () => {\n // Read the clipboard off `navigator` at click time, never at import or render time: this is\n // the only browser-only access in the component, and an event handler cannot run on a\n // server. A missing or rejecting clipboard is an ordinary outcome here (insecure origin,\n // denied permission, older browser), not an exception to propagate.\n let failure: unknown = null\n try {\n const clipboard =\n typeof navigator === \"undefined\" ? undefined : navigator.clipboard\n if (typeof clipboard?.writeText !== \"function\") {\n failure = new Error(\"Clipboard API unavailable\")\n } else {\n await clipboard.writeText(code)\n }\n } catch (error) {\n failure = error ?? new Error(\"Clipboard write rejected\")\n }\n\n if (failure === null) onCopy?.(code)\n else onCopyError?.(failure)\n\n setCopyState(failure === null ? \"copied\" : \"error\")\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n resetTimer.current = setTimeout(() => {\n resetTimer.current = null\n setCopyState(\"idle\")\n }, COPY_FEEDBACK_MS)\n }, [code, onCopy, onCopyError])\n\n // One trailing newline is an artefact of how source files end, not a line the reader should\n // see numbered and empty. The clipboard still gets `code` byte for byte.\n const displayed = code.endsWith(\"\\n\") ? code.slice(0, -1) : code\n const renderTokens = useCodeTokenRenderer()\n\n // Tokenized once per (source, language). Synchronous by construction, so the server render and\n // the first client render produce identical markup and hydration has nothing to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(displayed, language),\n [displayed, language]\n )\n\n // Two shapes, because the gutter needs rows: a plain string or a token run when there are no\n // line numbers, and one entry per line when there are.\n const plainLines = React.useMemo(\n () => (showLineNumbers ? displayed.split(\"\\n\") : null),\n [displayed, showLineNumbers]\n )\n const tokenLines = React.useMemo(\n () =>\n showLineNumbers && highlighted !== null\n ? splitTokenLines(highlighted)\n : null,\n [highlighted, showLineNumbers]\n )\n\n // An empty string is not a caption. Normalised once, so the header, the caption element and\n // the region's name can never disagree about whether there is one — labelling the region by an\n // empty caption would name it with nothing, which is worse than leaving it unnamed.\n const hasTitle = title !== undefined && title !== \"\"\n const hasLanguage = language !== undefined && language !== \"\"\n\n const ariaLabel = props[\"aria-label\"]\n const ariaLabelledBy = props[\"aria-labelledby\"]\n // A region needs a name. Prefer the caption the reader can see, then whatever the caller\n // supplied; with none of the three, stay focusable but claim no landmark.\n const labelledBy = hasTitle ? titleId : ariaLabelledBy\n const named = labelledBy !== undefined || ariaLabel !== undefined\n\n const copyStatusLabel =\n copyState === \"copied\"\n ? copiedLabel\n : copyState === \"error\"\n ? copyErrorLabel\n : copyLabel\n\n // A header exists for content. A copy button is an overlay and does not summon one — that is\n // what lets `<CodeBlock code copyable />` reserve no vertical space for chrome at all.\n const showHeader = hasTitle || hasLanguage\n\n const gutterStyle =\n plainLines === null\n ? style\n : ({\n [GUTTER]: `${gutterDigits(plainLines.length)}ch`,\n ...style,\n } as React.CSSProperties)\n\n return (\n <div\n ref={ref}\n data-slot=\"code-block\"\n {...{ [SLOT_ATTR]: \"code-block\" }}\n data-language={language}\n className={mergeClasses(\n styles.root,\n copyable ? styles.rootCopyReveal : undefined,\n className\n )}\n style={gutterStyle}\n {...props}\n aria-label={undefined}\n aria-labelledby={undefined}\n >\n {showHeader ? (\n <div\n data-slot=\"code-block-header\"\n {...{ [SLOT_ATTR]: \"code-block-header\" }}\n className={mergeClasses(\n styles.header,\n copyable ? styles.headerWithCopy : undefined\n )}\n >\n {hasTitle ? (\n <span\n id={titleId}\n data-slot=\"code-block-title\"\n {...{ [SLOT_ATTR]: \"code-block-title\" }}\n className={styles.title}\n >\n {title}\n </span>\n ) : null}\n {hasLanguage ? (\n <span\n data-slot=\"code-block-language\"\n {...{ [SLOT_ATTR]: \"code-block-language\" }}\n className={styles.language}\n >\n {language}\n </span>\n ) : null}\n <span className={styles.headerSpacer} />\n </div>\n ) : null}\n\n {copyable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n // Button keeps its OWN slot markers, the way Callout leaves the ClearButton it\n // composes alone: a Button stays a Button, and a rule written against the button\n // slot must still reach this one. `data-copy-state` is the handle for this\n // button specifically, and it carries the state a caller would want to select on.\n data-copy-state={copyState}\n aria-label={copyStatusLabel}\n className={styles.copy}\n onClick={handleCopy}\n >\n {copyState === \"copied\" ? <CheckIcon /> : <CopyIcon />}\n </Button>\n ) : null}\n\n <pre\n data-slot=\"code-block-content\"\n {...{ [SLOT_ATTR]: \"code-block-content\" }}\n // Always reachable: this is the scroll container, and a pointer must not be the only\n // way to scroll it.\n tabIndex={0}\n role={named ? \"region\" : undefined}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={mergeClasses(\n styles.pre,\n plainLines === null ? undefined : styles.preGutter,\n wrap ? styles.preWrap : styles.preNoWrap\n )}\n >\n <code\n data-slot=\"code-block-code\"\n {...{ [SLOT_ATTR]: \"code-block-code\" }}\n className={mergeClasses(\n styles.code,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? // No gutter: one run, highlighted if we have a grammar, otherwise the raw string.\n highlighted === null\n ? displayed\n : renderTokens(highlighted)\n : plainLines.map((line, index) => (\n <span\n // Lines have no identity beyond their position, and the whole block\n // re-renders when `code` changes, so the index is the key.\n key={index}\n data-slot=\"code-block-line\"\n {...{ [SLOT_ATTR]: \"code-block-line\" }}\n data-line={index + 1}\n className={styles.line}\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"code-block-line-number\"\n {...{ [SLOT_ATTR]: \"code-block-line-number\" }}\n className={styles.lineNumber}\n >\n {index + 1}\n </span>\n <span\n data-slot=\"code-block-line-content\"\n {...{ [SLOT_ATTR]: \"code-block-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* `tokenLines` is the same text as `plainLines`, split by the same\n newlines — `splitTokenLines` round-trips — so the row count matches and\n the index is safe. Falls back to the plain line when there is no\n grammar. */}\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n {/* The newline keeps a dragged selection line-separated, exactly as the\n unnumbered rendering is. */}\n {\"\\n\"}\n </span>\n </span>\n ))}\n </code>\n </pre>\n\n {copyable ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-block-copy-status\"\n {...{ [SLOT_ATTR]: \"code-block-copy-status\" }}\n className={styles.srOnly}\n >\n {copyState === \"idle\" ? \"\" : copyStatusLabel}\n </span>\n ) : null}\n </div>\n )\n }\n)\n"],"names":["COPY_FEEDBACK_MS","GUTTER","useStyles","makeZenithStyles","tokens.surfaceContainer","shorthands","tokens.borderWidthContainer","tokens.borderContainer","tokens.surfaceRadiusContainer","tokens.spacingElement2","tokens.spacingElement1","tokens.surfaceSep","tokens.spacingElement05","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.grayA12","tokens.grayA11","tokens.fontMono","tokens.focusRing","SLOT_ATTR","tokens.grayA2","tokens.grayA8","tokens.spacingElement3","CopyIcon","props","jsxs","jsx","CheckIcon","CodeBlock","React","code","language","title","wrap","showLineNumbers","copyable","copyLabel","copiedLabel","copyErrorLabel","onCopy","onCopyError","className","style","ref","styles","titleId","copyState","setCopyState","resetTimer","handleCopy","failure","clipboard","error","displayed","renderTokens","useCodeTokenRenderer","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","hasTitle","hasLanguage","ariaLabel","ariaLabelledBy","labelledBy","named","copyStatusLabel","showHeader","gutterStyle","gutterDigits","mergeClasses","Button","line","index"],"mappings":";;;;;;;;;AAiBA,MAAMA,KAAmB,KAGnBC,IAAS,wBAETC,KAAYC,GAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,IACV,UAAU;AAAA;AAAA;AAAA,IAGV,iBAAiBC;AAAAA,IACjB,GAAGC,EAAW,YAAYC,CAA2B;AAAA,IACrD,GAAGD,EAAW,YAAY,OAAO;AAAA,IACjC,GAAGA,EAAW,YAAYE,EAAsB;AAAA,IAChD,cAAcC;AAAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAAA;AAAA,EAGb,gBAAgB;AAAA,IACd,6BAA6B,EAAE,SAAS,EAAA;AAAA,IACxC,oCAAoC,EAAE,SAAS,EAAA;AAAA,EAAE;AAAA,EAEnD,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAGH,EAAW,IAAII,CAAsB;AAAA,IACxC,GAAGJ,EAAW,aAAaK,EAAsB;AAAA,IACjD,GAAGL,EAAW,cA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A,cACnB,WAAWyB,EAAO;AAAA,cAEjB,UAAAE,MAAc,SAAS,KAAKqB;AAAA,YAAA;AAAA,UAAA,IAE7B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
1
+ {"version":3,"file":"code-block.js","sources":["../../../src/components/code-block/code-block.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel } from \"../../styles/host-reset\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport { gutterDigits } from \"../../lib/code-lines\"\n\n/**\n * Read-only highlighted code. Source is rendered as text, and the focusable `<pre>` keeps\n * horizontal overflow keyboard-accessible.\n */\n\nconst COPY_FEEDBACK_MS = 2000\n\n/** Gutter width in monospace glyphs, shared by every numbered row. */\nconst GUTTER = \"--zenith-code-gutter\"\n\nconst useStyles = makeZenithStyles({\n root: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n // The same role recipe Surface's `section` uses, and the same property shapes, so a caller's\n // own border or radius replaces these through `mergeClasses` without a wrapper.\n backgroundColor: tokens.surfaceContainer,\n ...shorthands.borderWidth(tokens.borderWidthContainer),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderContainer),\n borderRadius: tokens.surfaceRadiusContainer,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n },\n // Griffel ancestor state selectors must be declared on the ancestor.\n rootCopyReveal: {\n \"&:hover [data-copy-state]\": { opacity: 1 },\n \"&:focus-within [data-copy-state]\": { opacity: 1 },\n },\n header: {\n ...boxModel,\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.paddingBlock(tokens.spacingElement1),\n ...shorthands.paddingInline(tokens.spacingElement2),\n // `borderBottom` expands to the three bottom-edge longhands; there is no per-edge width\n // helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand\n // is exactly the property-shape mismatch AGENTS.md rule 3 warns about.\n ...shorthands.borderBottom(\n tokens.borderWidthContainer,\n \"solid\",\n tokens.surfaceSep\n ),\n },\n // Reserve the overlay button's width when a caption is present.\n headerWithCopy: {\n ...boxModel,\n paddingRight: `calc(1.75rem + ${tokens.spacingElement2} + ${tokens.spacingElement05})`,\n minHeight: `calc(1.75rem + ${tokens.spacingElement05} + ${tokens.spacingElement05})`,\n },\n title: {\n ...boxModel,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n minWidth: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n language: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA11,\n // The language label names a machine format, so it stays in the code family rather than\n // inheriting the surrounding UI face.\n fontFamily: tokens.fontMono,\n whiteSpace: \"nowrap\",\n },\n headerSpacer: {\n ...boxModel,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n minWidth: 0,\n },\n // The button stays in the tab order while its paint is hidden.\n copy: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceContainer,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // Focus and feedback must override the hidden resting state.\n \"&[data-copy-state='copied']\": { opacity: 1 },\n \"&[data-copy-state='error']\": { opacity: 1 },\n \"&:focus-visible\": { opacity: 1 },\n },\n pre: {\n ...boxModel,\n ...shorthands.margin(0),\n ...shorthands.padding(tokens.spacingElement2),\n overflowX: \"auto\",\n overflowY: \"auto\",\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n color: tokens.grayA12,\n // `tab-size` is what makes a tab-indented source line up at all; 2 matches the indent the\n // editor inserts by default.\n tabSize: 2,\n outlineStyle: \"none\",\n // Declared after the base so the focus ring wins, per the ordering rule in AGENTS.md.\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-2px\",\n outlineColor: tokens.focusRing,\n },\n },\n // Sticky numbers must pin flush to the scrollport.\n preGutter: {\n ...boxModel,\n paddingLeft: 0,\n },\n preNoWrap: {\n whiteSpace: \"pre\",\n },\n preWrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n code: {\n // `<code>` is inline by default, which collapses the numbered-line grid to one row.\n display: \"block\",\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n lineHeight: \"inherit\",\n },\n // Give sticky gutters and row bands the full width of unwrapped code.\n codeNoWrap: {\n ...boxModel,\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n ...boxModel,\n display: \"flex\",\n width: \"100%\",\n // Avoid sticky touch-hover states; paint both cells because the gutter is opaque.\n \"@media (hover: hover)\": {\n [`&:hover [${SLOT_ATTR}='code-block-line-number'], &:hover [${SLOT_ATTR}='code-block-line-content']`]:\n {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n },\n },\n lineNumber: {\n // Not selectable, so dragging a selection across the block copies code and not a column of\n // integers. The copy button never sees these at all — it copies the original `code` string.\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Opaque because horizontally scrolled code passes beneath the sticky gutter.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceContainer,\n },\n lineContent: {\n ...boxModel,\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n srOnly: {\n ...boxModel,\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst CopyIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V5a2 2 0 0 1 2-2h10\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"m4 12.5 5 5 11-11\" />\n </svg>\n)\n\n/** Idle, or the outcome of the last copy attempt. Drives both the icon and the live region. */\ntype CopyState = \"idle\" | \"copied\" | \"error\"\n\nexport type CodeBlockProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\" | \"title\"\n> & {\n /** The source to display. Rendered as text — never as markup, and never evaluated. */\n code: string\n /** Language grammar used for syntax highlighting, also shown in the header. */\n language?: string\n /**\n * Visible caption, typically a file name. Also names the scrollable code region.\n *\n * This replaces the native `title` attribute, which would have rendered a browser tooltip\n * instead of a caption.\n */\n title?: string\n /** Soft-wrap long lines instead of scrolling horizontally. */\n wrap?: boolean\n /**\n * Render a non-selectable line-number gutter, and give each row a hover band.\n *\n * Off by default. Numbers are wayfinding for prose that refers to a line by number; on a\n * four-line snippet they are a column of noise that also costs horizontal space.\n */\n showLineNumbers?: boolean\n /** Show the copy button. */\n copyable?: boolean\n /** Accessible name of the copy button. */\n copyLabel?: string\n /** Announced, and used as the button's name, after a successful copy. */\n copiedLabel?: string\n /** Announced, and used as the button's name, when the clipboard is unavailable or refuses. */\n copyErrorLabel?: string\n /** Called with the exact string written to the clipboard. */\n onCopy?: (code: string) => void\n /** Called when the clipboard write failed or was unavailable. */\n onCopyError?: (error: unknown) => void\n}\n\nexport const CodeBlock = React.forwardRef<HTMLDivElement, CodeBlockProps>(\n function CodeBlock(\n {\n code,\n language,\n title,\n wrap = false,\n showLineNumbers = false,\n copyable = false,\n copyLabel = \"Copy code\",\n copiedLabel = \"Copied\",\n copyErrorLabel = \"Copy failed\",\n onCopy,\n onCopyError,\n className,\n style,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const reactId = React.useId()\n const titleId = `${reactId}-title`\n\n const [copyState, setCopyState] = React.useState<CopyState>(\"idle\")\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n React.useEffect(\n () => () => {\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n },\n []\n )\n\n const handleCopy = React.useCallback(async () => {\n // Read the clipboard off `navigator` at click time, never at import or render time: this is\n // the only browser-only access in the component, and an event handler cannot run on a\n // server. A missing or rejecting clipboard is an ordinary outcome here (insecure origin,\n // denied permission, older browser), not an exception to propagate.\n let failure: unknown = null\n try {\n const clipboard =\n typeof navigator === \"undefined\" ? undefined : navigator.clipboard\n if (typeof clipboard?.writeText !== \"function\") {\n failure = new Error(\"Clipboard API unavailable\")\n } else {\n await clipboard.writeText(code)\n }\n } catch (error) {\n failure = error ?? new Error(\"Clipboard write rejected\")\n }\n\n if (failure === null) onCopy?.(code)\n else onCopyError?.(failure)\n\n setCopyState(failure === null ? \"copied\" : \"error\")\n if (resetTimer.current !== null) clearTimeout(resetTimer.current)\n resetTimer.current = setTimeout(() => {\n resetTimer.current = null\n setCopyState(\"idle\")\n }, COPY_FEEDBACK_MS)\n }, [code, onCopy, onCopyError])\n\n // One trailing newline is an artefact of how source files end, not a line the reader should\n // see numbered and empty. The clipboard still gets `code` byte for byte.\n const displayed = code.endsWith(\"\\n\") ? code.slice(0, -1) : code\n const renderTokens = useCodeTokenRenderer()\n\n // Tokenized once per (source, language). Synchronous by construction, so the server render and\n // the first client render produce identical markup and hydration has nothing to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(displayed, language),\n [displayed, language]\n )\n\n // Two shapes, because the gutter needs rows: a plain string or a token run when there are no\n // line numbers, and one entry per line when there are.\n const plainLines = React.useMemo(\n () => (showLineNumbers ? displayed.split(\"\\n\") : null),\n [displayed, showLineNumbers]\n )\n const tokenLines = React.useMemo(\n () =>\n showLineNumbers && highlighted !== null\n ? splitTokenLines(highlighted)\n : null,\n [highlighted, showLineNumbers]\n )\n\n // An empty string is not a caption. Normalised once, so the header, the caption element and\n // the region's name can never disagree about whether there is one — labelling the region by an\n // empty caption would name it with nothing, which is worse than leaving it unnamed.\n const hasTitle = title !== undefined && title !== \"\"\n const hasLanguage = language !== undefined && language !== \"\"\n\n const ariaLabel = props[\"aria-label\"]\n const ariaLabelledBy = props[\"aria-labelledby\"]\n // A region needs a name. Prefer the caption the reader can see, then whatever the caller\n // supplied; with none of the three, stay focusable but claim no landmark.\n const labelledBy = hasTitle ? titleId : ariaLabelledBy\n const named = labelledBy !== undefined || ariaLabel !== undefined\n\n const copyStatusLabel =\n copyState === \"copied\"\n ? copiedLabel\n : copyState === \"error\"\n ? copyErrorLabel\n : copyLabel\n\n // A header exists for content. A copy button is an overlay and does not summon one — that is\n // what lets `<CodeBlock code copyable />` reserve no vertical space for chrome at all.\n const showHeader = hasTitle || hasLanguage\n\n const gutterStyle =\n plainLines === null\n ? style\n : ({\n [GUTTER]: `${gutterDigits(plainLines.length)}ch`,\n ...style,\n } as React.CSSProperties)\n\n return (\n <div\n ref={ref}\n data-slot=\"code-block\"\n {...{ [SLOT_ATTR]: \"code-block\" }}\n data-language={language}\n className={mergeClasses(\n styles.root,\n copyable ? styles.rootCopyReveal : undefined,\n className\n )}\n style={gutterStyle}\n {...props}\n aria-label={undefined}\n aria-labelledby={undefined}\n >\n {showHeader ? (\n <div\n data-slot=\"code-block-header\"\n {...{ [SLOT_ATTR]: \"code-block-header\" }}\n className={mergeClasses(\n styles.header,\n copyable ? styles.headerWithCopy : undefined\n )}\n >\n {hasTitle ? (\n <span\n id={titleId}\n data-slot=\"code-block-title\"\n {...{ [SLOT_ATTR]: \"code-block-title\" }}\n className={styles.title}\n >\n {title}\n </span>\n ) : null}\n {hasLanguage ? (\n <span\n data-slot=\"code-block-language\"\n {...{ [SLOT_ATTR]: \"code-block-language\" }}\n className={styles.language}\n >\n {language}\n </span>\n ) : null}\n <span className={styles.headerSpacer} />\n </div>\n ) : null}\n\n {copyable ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n // Button keeps its OWN slot markers, the way Callout leaves the ClearButton it\n // composes alone: a Button stays a Button, and a rule written against the button\n // slot must still reach this one. `data-copy-state` is the handle for this\n // button specifically, and it carries the state a caller would want to select on.\n data-copy-state={copyState}\n aria-label={copyStatusLabel}\n className={styles.copy}\n onClick={handleCopy}\n >\n {copyState === \"copied\" ? <CheckIcon /> : <CopyIcon />}\n </Button>\n ) : null}\n\n <pre\n data-slot=\"code-block-content\"\n {...{ [SLOT_ATTR]: \"code-block-content\" }}\n // Always reachable: this is the scroll container, and a pointer must not be the only\n // way to scroll it.\n tabIndex={0}\n role={named ? \"region\" : undefined}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={mergeClasses(\n styles.pre,\n plainLines === null ? undefined : styles.preGutter,\n wrap ? styles.preWrap : styles.preNoWrap\n )}\n >\n <code\n data-slot=\"code-block-code\"\n {...{ [SLOT_ATTR]: \"code-block-code\" }}\n className={mergeClasses(\n styles.code,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? // No gutter: one run, highlighted if we have a grammar, otherwise the raw string.\n highlighted === null\n ? displayed\n : renderTokens(highlighted)\n : plainLines.map((line, index) => (\n <span\n // Lines have no identity beyond their position, and the whole block\n // re-renders when `code` changes, so the index is the key.\n key={index}\n data-slot=\"code-block-line\"\n {...{ [SLOT_ATTR]: \"code-block-line\" }}\n data-line={index + 1}\n className={styles.line}\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"code-block-line-number\"\n {...{ [SLOT_ATTR]: \"code-block-line-number\" }}\n className={styles.lineNumber}\n >\n {index + 1}\n </span>\n <span\n data-slot=\"code-block-line-content\"\n {...{ [SLOT_ATTR]: \"code-block-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* `tokenLines` is the same text as `plainLines`, split by the same\n newlines — `splitTokenLines` round-trips — so the row count matches and\n the index is safe. Falls back to the plain line when there is no\n grammar. */}\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n {/* The newline keeps a dragged selection line-separated, exactly as the\n unnumbered rendering is. */}\n {\"\\n\"}\n </span>\n </span>\n ))}\n </code>\n </pre>\n\n {copyable ? (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-block-copy-status\"\n {...{ [SLOT_ATTR]: \"code-block-copy-status\" }}\n className={styles.srOnly}\n >\n {copyState === \"idle\" ? \"\" : copyStatusLabel}\n </span>\n ) : null}\n </div>\n )\n }\n)\n"],"names":["COPY_FEEDBACK_MS","GUTTER","useStyles","makeZenithStyles","boxModel","tokens.surfaceContainer","shorthands","tokens.borderWidthContainer","tokens.borderContainer","tokens.surfaceRadiusContainer","tokens.spacingElement2","tokens.spacingElement1","tokens.surfaceSep","tokens.spacingElement05","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.grayA12","tokens.grayA11","tokens.fontMono","tokens.focusRing","SLOT_ATTR","tokens.grayA2","tokens.grayA8","tokens.spacingElement3","CopyIcon","props","jsxs","jsx","CheckIcon","CodeBlock","React","code","language","title","wrap","showLineNumbers","copyable","copyLabel","copiedLabel","copyErrorLabel","onCopy","onCopyError","className","style","ref","styles","titleId","copyState","setCopyState","resetTimer","handleCopy","failure","clipboard","error","displayed","renderTokens","useCodeTokenRenderer","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","hasTitle","hasLanguage","ariaLabel","ariaLabelledBy","labelledBy","named","copyStatusLabel","showHeader","gutterStyle","gutterDigits","mergeClasses","Button","line","index"],"mappings":";;;;;;;;;;AAkBA,MAAMA,KAAmB,KAGnBC,IAAS,wBAETC,KAAYC,GAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,GAAGC;AAAA,IACH,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,IACV,UAAU;AAAA;AAAA;AAAA,IAGV,iBAAiBC;AAAAA,IACjB,GAAGC,EAAW,YAAYC,CAA2B;AAAA,IACrD,GAAGD,EAAW,YAAY,OAAO;AAAA,IACjC,GAAGA,EAAW,YAAYE,EAAsB;AAAA,IAChD,cAAcC;AAAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAAA;AAAA,EAGb,gBAAgB;AAAA,IACd,6BAA6B,EAAE,SAAS,EAAA;AAAA,IACxC,oCAAoC,EAAE,SAAS,EAAA;AAAA,EAAE;AAAA,EAEnD,QAAQ;AAAA,IACN,GAAGL;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAGE,EAAW,IAAII,CAAsB;AAAA,IACxC,GAAGJ,EAAW,aAAaK,EAAsB;AAAA,IACjD,GAAGL,EAAW,cAAcI,CAAsB;AAAA;AAAA;AAAA;AAAA,IAIlD,GAAGJ,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