@ngrok/mantle 0.73.2 → 0.73.4

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 (261) hide show
  1. package/dist/accordion.d.ts +7 -9
  2. package/dist/accordion.js +1 -1
  3. package/dist/accordion.js.map +1 -1
  4. package/dist/agent.json +1 -1
  5. package/dist/alert-dialog.d.ts +33 -38
  6. package/dist/alert-dialog.js +1 -1
  7. package/dist/alert-dialog.js.map +1 -1
  8. package/dist/alert.d.ts +9 -11
  9. package/dist/alert.js +1 -1
  10. package/dist/alert.js.map +1 -1
  11. package/dist/{anchor-2stEauOz.js → anchor-CcTY5SIz.js} +2 -2
  12. package/dist/{anchor-2stEauOz.js.map → anchor-CcTY5SIz.js.map} +1 -1
  13. package/dist/anchor.d.ts +2 -3
  14. package/dist/anchor.js +1 -1
  15. package/dist/{as-child-CpZKMqTE.d.ts → as-child-uN_018tj.d.ts} +1 -1
  16. package/dist/badge.d.ts +3 -4
  17. package/dist/badge.js +1 -1
  18. package/dist/badge.js.map +1 -1
  19. package/dist/{booleanish-CBGdPL3Q.js → booleanish-BfvnW6vy.js} +1 -1
  20. package/dist/{booleanish-CBGdPL3Q.js.map → booleanish-BfvnW6vy.js.map} +1 -1
  21. package/dist/{browser-only-QPyyfLaB.js → browser-only-BSl_hruR.js} +1 -1
  22. package/dist/{browser-only-QPyyfLaB.js.map → browser-only-BSl_hruR.js.map} +1 -1
  23. package/dist/browser-only.js +1 -1
  24. package/dist/{button-POMJ-20y.js → button-BAxneEMu.js} +2 -2
  25. package/dist/{button-POMJ-20y.js.map → button-BAxneEMu.js.map} +1 -1
  26. package/dist/{button-DbHFERMB.d.ts → button-BYZOBUgj.d.ts} +16 -19
  27. package/dist/{button-GokecthL.js → button-uMIZVKit.js} +2 -2
  28. package/dist/{button-GokecthL.js.map → button-uMIZVKit.js.map} +1 -1
  29. package/dist/button.d.ts +4 -4
  30. package/dist/button.js +1 -1
  31. package/dist/calendar.d.ts +1 -2
  32. package/dist/calendar.js +1 -1
  33. package/dist/calendar.js.map +1 -1
  34. package/dist/card.d.ts +6 -7
  35. package/dist/card.js +1 -1
  36. package/dist/card.js.map +1 -1
  37. package/dist/checkbox.d.ts +3 -4
  38. package/dist/checkbox.js +1 -1
  39. package/dist/checkbox.js.map +1 -1
  40. package/dist/code-block.d.ts +17 -19
  41. package/dist/code-block.js +1 -1
  42. package/dist/code-block.js.map +1 -1
  43. package/dist/code-block_highlight-utils.d.ts +1 -1
  44. package/dist/code-block_highlight-utils.js +1 -1
  45. package/dist/code.d.ts +2 -3
  46. package/dist/code.js +1 -1
  47. package/dist/code.js.map +1 -1
  48. package/dist/color.d.ts +2 -2
  49. package/dist/color.js.map +1 -1
  50. package/dist/combobox.d.ts +11 -13
  51. package/dist/combobox.js +1 -1
  52. package/dist/combobox.js.map +1 -1
  53. package/dist/command.d.ts +133 -220
  54. package/dist/command.js +1 -1
  55. package/dist/command.js.map +1 -1
  56. package/dist/{compose-refs-DZ3cPi47.js → compose-refs-Cjf2gfB8.js} +1 -1
  57. package/dist/{compose-refs-DZ3cPi47.js.map → compose-refs-Cjf2gfB8.js.map} +1 -1
  58. package/dist/{copy-to-clipboard-CNMRyck4.js → copy-to-clipboard-Baw30q9O.js} +2 -2
  59. package/dist/{copy-to-clipboard-CNMRyck4.js.map → copy-to-clipboard-Baw30q9O.js.map} +1 -1
  60. package/dist/{cx-D1HYnpvA.js → cx-CBSnSC36.js} +1 -1
  61. package/dist/{cx-D1HYnpvA.js.map → cx-CBSnSC36.js.map} +1 -1
  62. package/dist/cx.js +1 -1
  63. package/dist/data-table.d.ts +13 -15
  64. package/dist/data-table.js +1 -1
  65. package/dist/data-table.js.map +1 -1
  66. package/dist/{deep-non-nullable-Xu7ckQM6.d.ts → deep-non-nullable-BxRoySYR.d.ts} +1 -1
  67. package/dist/description-list.d.ts +5 -6
  68. package/dist/description-list.js +1 -1
  69. package/dist/description-list.js.map +1 -1
  70. package/dist/{dialog-B1KCB7JT.js → dialog-Dn-brQBw.js} +2 -2
  71. package/dist/{dialog-B1KCB7JT.js.map → dialog-Dn-brQBw.js.map} +1 -1
  72. package/dist/dialog.d.ts +14 -17
  73. package/dist/dialog.js +1 -1
  74. package/dist/{direction-D9IZ1wW6.d.ts → direction-CcTY0FmA.d.ts} +2 -2
  75. package/dist/{direction-HqPHXGIs.js → direction-Wa9W2F61.js} +1 -1
  76. package/dist/{direction-HqPHXGIs.js.map → direction-Wa9W2F61.js.map} +1 -1
  77. package/dist/{dropdown-menu-CvOiQUSZ.d.ts → dropdown-menu-BgYk4L8o.d.ts} +22 -24
  78. package/dist/{dropdown-menu-DY4w933w.js → dropdown-menu-C3YZJBkV.js} +2 -2
  79. package/dist/{dropdown-menu-DY4w933w.js.map → dropdown-menu-C3YZJBkV.js.map} +1 -1
  80. package/dist/dropdown-menu.d.ts +1 -1
  81. package/dist/dropdown-menu.js +1 -1
  82. package/dist/empty.d.ts +7 -8
  83. package/dist/empty.js +1 -1
  84. package/dist/empty.js.map +1 -1
  85. package/dist/{field-context-B7Z1cmZW.js → field-context-4k1kI7Bo.js} +2 -2
  86. package/dist/{field-context-B7Z1cmZW.js.map → field-context-4k1kI7Bo.js.map} +1 -1
  87. package/dist/field.d.ts +45 -25
  88. package/dist/field.js +1 -1
  89. package/dist/field.js.map +1 -1
  90. package/dist/flag.d.ts +1 -2
  91. package/dist/flag.js +1 -1
  92. package/dist/flag.js.map +1 -1
  93. package/dist/hooks.d.ts +1 -1
  94. package/dist/hooks.js +1 -1
  95. package/dist/hooks.js.map +1 -1
  96. package/dist/hover-card.d.ts +4 -6
  97. package/dist/hover-card.js +1 -1
  98. package/dist/hover-card.js.map +1 -1
  99. package/dist/{icon-bWc5yC3-.js → icon-C8bYBIHW.js} +2 -2
  100. package/dist/{icon-bWc5yC3-.js.map → icon-C8bYBIHW.js.map} +1 -1
  101. package/dist/{icon-button-ZKN0sRIJ.js → icon-button-C_Ht_g1C.js} +2 -2
  102. package/dist/{icon-button-ZKN0sRIJ.js.map → icon-button-C_Ht_g1C.js.map} +1 -1
  103. package/dist/{icon-button-BDTb-lxs.d.ts → icon-button-ntupABbM.d.ts} +6 -8
  104. package/dist/{icon-BJ7q2RXZ.d.ts → icon-n49kOh4_.d.ts} +3 -4
  105. package/dist/icon.d.ts +3 -3
  106. package/dist/icon.js +1 -1
  107. package/dist/icons.d.ts +9 -10
  108. package/dist/icons.js +1 -1
  109. package/dist/icons.js.map +1 -1
  110. package/dist/{in-view-BUgyu-Tk.d.ts → in-view-BC3wmz-a.d.ts} +1 -1
  111. package/dist/{in-view-CeVqeGbv.js → in-view-C2DpZ6s0.js} +1 -1
  112. package/dist/{in-view-CeVqeGbv.js.map → in-view-C2DpZ6s0.js.map} +1 -1
  113. package/dist/{index-BhlxYL_y.d.ts → index-BL5WVva_.d.ts} +3 -6
  114. package/dist/{index-CWXKBva-.d.ts → index-DBZ3eRsl.d.ts} +5 -7
  115. package/dist/{index-DS_4n2eb.d.ts → index-DorCusfG.d.ts} +1 -1
  116. package/dist/{index-BbZBDzPh.d.ts → index-L3NmbHi5.d.ts} +1 -1
  117. package/dist/input.d.ts +7 -8
  118. package/dist/input.js +1 -1
  119. package/dist/input.js.map +1 -1
  120. package/dist/{is-input-CtUHJGgL.js → is-input-CXmS0OFN.js} +1 -1
  121. package/dist/{is-input-CtUHJGgL.js.map → is-input-CXmS0OFN.js.map} +1 -1
  122. package/dist/{kbd-CbMxDL9E.js → kbd-Bv6tefdB.js} +2 -2
  123. package/dist/{kbd-CbMxDL9E.js.map → kbd-Bv6tefdB.js.map} +1 -1
  124. package/dist/kbd.d.ts +1 -2
  125. package/dist/kbd.js +1 -1
  126. package/dist/{label-x6FcOpxc.js → label-DhIUmTN2.js} +2 -2
  127. package/dist/{label-x6FcOpxc.js.map → label-DhIUmTN2.js.map} +1 -1
  128. package/dist/label.d.ts +2 -4
  129. package/dist/label.js +1 -1
  130. package/dist/llms.txt +1 -1
  131. package/dist/main.d.ts +1 -2
  132. package/dist/main.js +1 -1
  133. package/dist/main.js.map +1 -1
  134. package/dist/media-object.d.ts +4 -5
  135. package/dist/media-object.js +1 -1
  136. package/dist/media-object.js.map +1 -1
  137. package/dist/multi-select.d.ts +16 -18
  138. package/dist/multi-select.js +1 -1
  139. package/dist/multi-select.js.map +1 -1
  140. package/dist/otp-input.d.ts +6 -7
  141. package/dist/otp-input.js +1 -1
  142. package/dist/otp-input.js.map +1 -1
  143. package/dist/pagination.d.ts +7 -9
  144. package/dist/pagination.js +1 -1
  145. package/dist/pagination.js.map +1 -1
  146. package/dist/{popover-CoZxokw_.js → popover-DponNBot.js} +2 -2
  147. package/dist/{popover-CoZxokw_.js.map → popover-DponNBot.js.map} +1 -1
  148. package/dist/popover.d.ts +6 -7
  149. package/dist/popover.js +1 -1
  150. package/dist/primitive-Cn3h4DJg.js +2 -0
  151. package/dist/primitive-Cn3h4DJg.js.map +1 -0
  152. package/dist/{primitive-qkxTYBUY.d.ts → primitive-D_-h74Kt.d.ts} +2 -3
  153. package/dist/progress.d.ts +4 -5
  154. package/dist/progress.js +1 -1
  155. package/dist/progress.js.map +1 -1
  156. package/dist/radio-group.d.ts +18 -20
  157. package/dist/radio-group.js +1 -1
  158. package/dist/radio-group.js.map +1 -1
  159. package/dist/{resolve-pre-rendered-props-BfWe69-w.js → resolve-pre-rendered-props-C-vrNxH1.js} +8 -8
  160. package/dist/resolve-pre-rendered-props-C-vrNxH1.js.map +1 -0
  161. package/dist/{resolve-pre-rendered-props-BONSCwYA.d.ts → resolve-pre-rendered-props-DxJ9-DAl.d.ts} +1 -1
  162. package/dist/sandboxed-on-click.d.ts +3 -4
  163. package/dist/sandboxed-on-click.js +1 -1
  164. package/dist/sandboxed-on-click.js.map +1 -1
  165. package/dist/{select-SZFFzYs0.d.ts → select-C15-XvRT.d.ts} +15 -16
  166. package/dist/select-Cxc9VmP8.js +2 -0
  167. package/dist/select-Cxc9VmP8.js.map +1 -0
  168. package/dist/select.d.ts +1 -1
  169. package/dist/select.js +1 -1
  170. package/dist/separator-Bqjy77rG.js +2 -0
  171. package/dist/separator-Bqjy77rG.js.map +1 -0
  172. package/dist/separator.d.ts +3 -5
  173. package/dist/separator.js +1 -1
  174. package/dist/sheet.d.ts +15 -19
  175. package/dist/sheet.js +1 -1
  176. package/dist/sheet.js.map +1 -1
  177. package/dist/skeleton.d.ts +4 -6
  178. package/dist/skeleton.js +1 -1
  179. package/dist/skeleton.js.map +1 -1
  180. package/dist/skip-to-main-link.d.ts +1 -2
  181. package/dist/skip-to-main-link.js +1 -1
  182. package/dist/skip-to-main-link.js.map +1 -1
  183. package/dist/slider.d.ts +1 -2
  184. package/dist/slider.js +1 -1
  185. package/dist/slider.js.map +1 -1
  186. package/dist/{slot-D_ZUrdEW.js → slot-CV5fmqFr.js} +2 -2
  187. package/dist/{slot-D_ZUrdEW.js.map → slot-CV5fmqFr.js.map} +1 -1
  188. package/dist/slot.d.ts +1 -1
  189. package/dist/slot.js +1 -1
  190. package/dist/{sort-mXo37xN2.js → sort-BPX2Fk9t.js} +2 -2
  191. package/dist/{sort-mXo37xN2.js.map → sort-BPX2Fk9t.js.map} +1 -1
  192. package/dist/split-button.d.ts +10 -12
  193. package/dist/split-button.js +1 -1
  194. package/dist/split-button.js.map +1 -1
  195. package/dist/{svg-only-7gYlsX8f.js → svg-only-Cz1cby8y.js} +2 -2
  196. package/dist/{svg-only-7gYlsX8f.js.map → svg-only-Cz1cby8y.js.map} +1 -1
  197. package/dist/{svg-only-D4uqM1OC.d.ts → svg-only-f6ToFLH0.d.ts} +3 -4
  198. package/dist/switch.d.ts +3 -5
  199. package/dist/switch.js +1 -1
  200. package/dist/switch.js.map +1 -1
  201. package/dist/{table-CjSQkfZe.d.ts → table-BWD9IlIN.d.ts} +10 -12
  202. package/dist/{table-CHd39aT-.js → table-eyoUW2Uv.js} +2 -2
  203. package/dist/{table-CHd39aT-.js.map → table-eyoUW2Uv.js.map} +1 -1
  204. package/dist/table.d.ts +1 -1
  205. package/dist/table.js +1 -1
  206. package/dist/tabs.d.ts +6 -9
  207. package/dist/tabs.js +1 -1
  208. package/dist/tabs.js.map +1 -1
  209. package/dist/text-area.d.ts +2 -3
  210. package/dist/text-area.js +1 -1
  211. package/dist/text-area.js.map +1 -1
  212. package/dist/theme-provider-MMwxHEfw.js +2 -0
  213. package/dist/theme-provider-MMwxHEfw.js.map +1 -0
  214. package/dist/theme.d.ts +9 -10
  215. package/dist/theme.js +1 -1
  216. package/dist/theme.js.map +1 -1
  217. package/dist/{themes-FPux5kIu.d.ts → themes-CYNpplwN.d.ts} +1 -1
  218. package/dist/toast-CR3MVChj.js +2 -0
  219. package/dist/toast-CR3MVChj.js.map +1 -0
  220. package/dist/toast.d.ts +8 -10
  221. package/dist/toast.js +1 -1
  222. package/dist/tooltip.d.ts +4 -6
  223. package/dist/tooltip.js +1 -1
  224. package/dist/tooltip.js.map +1 -1
  225. package/dist/{traffic-policy-file-BwHHdhWJ.js → traffic-policy-file-0g5RXFqu.js} +1 -1
  226. package/dist/{traffic-policy-file-BwHHdhWJ.js.map → traffic-policy-file-0g5RXFqu.js.map} +1 -1
  227. package/dist/{types-QKZ5fvaQ.d.ts → types-BvUzforF.d.ts} +1 -1
  228. package/dist/types-D85fCNV3.js +2 -0
  229. package/dist/{types-884RJJqm.js.map → types-D85fCNV3.js.map} +1 -1
  230. package/dist/types.d.ts +6 -6
  231. package/dist/types.js +1 -1
  232. package/dist/use-copy-to-clipboard-BLpquU9d.js +2 -0
  233. package/dist/{use-copy-to-clipboard-CTgtLjUg.js.map → use-copy-to-clipboard-BLpquU9d.js.map} +1 -1
  234. package/dist/{use-isomorphic-layout-effect-CNSD0lhi.js → use-isomorphic-layout-effect-DdTRtMY-.js} +1 -1
  235. package/dist/{use-isomorphic-layout-effect-CNSD0lhi.js.map → use-isomorphic-layout-effect-DdTRtMY-.js.map} +1 -1
  236. package/dist/{use-matches-media-query-CojcYxlA.js → use-matches-media-query-CMSxHR9n.js} +1 -1
  237. package/dist/{use-matches-media-query-CojcYxlA.js.map → use-matches-media-query-CMSxHR9n.js.map} +1 -1
  238. package/dist/{use-prefers-reduced-motion-Bpx8G3UT.js → use-prefers-reduced-motion-CWIoFA6W.js} +2 -2
  239. package/dist/{use-prefers-reduced-motion-Bpx8G3UT.js.map → use-prefers-reduced-motion-CWIoFA6W.js.map} +1 -1
  240. package/dist/utils.d.ts +2 -2
  241. package/dist/utils.js +1 -1
  242. package/dist/utils.js.map +1 -1
  243. package/dist/{validation-BYME8rWN.js → validation-DCyx-ceH.js} +1 -1
  244. package/dist/{validation-BYME8rWN.js.map → validation-DCyx-ceH.js.map} +1 -1
  245. package/dist/{validation-CBSOmooP.d.ts → validation-xyX_6kph.d.ts} +1 -1
  246. package/dist/{variant-props-BZbM__kQ.d.ts → variant-props-CVymuSfa.d.ts} +2 -2
  247. package/dist/{with-style-props-xzZLnIrF.d.ts → with-style-props-CyImx7vd.d.ts} +1 -1
  248. package/package.json +6 -6
  249. package/dist/primitive-tXm_8n_t.js +0 -2
  250. package/dist/primitive-tXm_8n_t.js.map +0 -1
  251. package/dist/resolve-pre-rendered-props-BfWe69-w.js.map +0 -1
  252. package/dist/select-B7orOUPj.js +0 -2
  253. package/dist/select-B7orOUPj.js.map +0 -1
  254. package/dist/separator-awchG4LI.js +0 -2
  255. package/dist/separator-awchG4LI.js.map +0 -1
  256. package/dist/theme-provider-BFcnjeME.js +0 -2
  257. package/dist/theme-provider-BFcnjeME.js.map +0 -1
  258. package/dist/toast-CGnquSKO.js +0 -2
  259. package/dist/toast-CGnquSKO.js.map +0 -1
  260. package/dist/types-884RJJqm.js +0 -2
  261. package/dist/use-copy-to-clipboard-CTgtLjUg.js +0 -2
@@ -1,9 +1,7 @@
1
- import { t as SvgAttributes } from "./types-QKZ5fvaQ.js";
2
- import { t as WithAsChild } from "./as-child-CpZKMqTE.js";
3
- import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./resolve-pre-rendered-props-BONSCwYA.js";
4
- import * as _$react from "react";
1
+ import { t as SvgAttributes } from "./types-BvUzforF.js";
2
+ import { t as WithAsChild } from "./as-child-uN_018tj.js";
3
+ import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./resolve-pre-rendered-props-DxJ9-DAl.js";
5
4
  import { ComponentProps, HTMLAttributes, ReactNode } from "react";
6
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
5
  import { Content, List, Trigger } from "@radix-ui/react-tabs";
8
6
 
9
7
  //#region src/components/code-block/code-block.d.ts
@@ -80,7 +78,7 @@ declare function CodeBlockIconComponent({
80
78
  preset,
81
79
  svg: _svgProp,
82
80
  ...props
83
- }: CodeBlockIconProps): _$react_jsx_runtime0.JSX.Element;
81
+ }: CodeBlockIconProps): import("react/jsx-runtime").JSX.Element;
84
82
  declare namespace CodeBlockIconComponent {
85
83
  var displayName: string;
86
84
  }
@@ -169,7 +167,7 @@ declare const CodeBlock: {
169
167
  * </CodeBlock.Root>
170
168
  * ```
171
169
  */
172
- readonly Root: _$react.ForwardRefExoticComponent<Omit<CodeBlockRootProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
170
+ readonly Root: import("react").ForwardRefExoticComponent<Omit<CodeBlockRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
173
171
  /**
174
172
  * The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.
175
173
  *
@@ -188,7 +186,7 @@ declare const CodeBlock: {
188
186
  * </CodeBlock.Root>
189
187
  * ```
190
188
  */
191
- readonly Body: _$react.ForwardRefExoticComponent<Omit<_$react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
189
+ readonly Body: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
192
190
  /**
193
191
  * The code content. Renders pre-highlighted Shiki HTML when the Vite plugin is active.
194
192
  *
@@ -207,7 +205,7 @@ declare const CodeBlock: {
207
205
  * </CodeBlock.Root>
208
206
  * ```
209
207
  */
210
- readonly Code: _$react.ForwardRefExoticComponent<Omit<CodeBlockCodeProps, "ref"> & _$react.RefAttributes<HTMLPreElement>>;
208
+ readonly Code: import("react").ForwardRefExoticComponent<Omit<CodeBlockCodeProps, "ref"> & import("react").RefAttributes<HTMLPreElement>>;
211
209
  /**
212
210
  * The optional copy button.
213
211
  *
@@ -226,7 +224,7 @@ declare const CodeBlock: {
226
224
  * </CodeBlock.Root>
227
225
  * ```
228
226
  */
229
- readonly CopyButton: _$react.ForwardRefExoticComponent<(Omit<Omit<_$react.DetailedHTMLProps<_$react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type"> & {
227
+ readonly CopyButton: import("react").ForwardRefExoticComponent<(Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type"> & {
230
228
  asChild: true;
231
229
  children: ReactNode;
232
230
  } & {
@@ -244,7 +242,7 @@ declare const CodeBlock: {
244
242
  * Callback fired when an error occurs during copying.
245
243
  */
246
244
  onCopyError?: (error: unknown) => void;
247
- }, "ref"> | Omit<Omit<_$react.DetailedHTMLProps<_$react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type"> & {
245
+ }, "ref"> | Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type"> & {
248
246
  asChild?: false | undefined;
249
247
  children?: undefined;
250
248
  } & {
@@ -262,7 +260,7 @@ declare const CodeBlock: {
262
260
  * Callback fired when an error occurs during copying.
263
261
  */
264
262
  onCopyError?: (error: unknown) => void;
265
- }, "ref">) & _$react.RefAttributes<HTMLButtonElement>>;
263
+ }, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
266
264
  /**
267
265
  * The optional expander button for collapsible code blocks.
268
266
  *
@@ -281,7 +279,7 @@ declare const CodeBlock: {
281
279
  * </CodeBlock.Root>
282
280
  * ```
283
281
  */
284
- readonly ExpanderButton: _$react.ForwardRefExoticComponent<Omit<CodeBlockExpanderButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
282
+ readonly ExpanderButton: import("react").ForwardRefExoticComponent<Omit<CodeBlockExpanderButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
285
283
  /**
286
284
  * The optional header slot for icon and title.
287
285
  *
@@ -300,7 +298,7 @@ declare const CodeBlock: {
300
298
  * </CodeBlock.Root>
301
299
  * ```
302
300
  */
303
- readonly Header: _$react.ForwardRefExoticComponent<Omit<_$react.ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
301
+ readonly Header: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
304
302
  /**
305
303
  * A small icon for the code block header. Use `preset` or `svg`.
306
304
  *
@@ -344,7 +342,7 @@ declare const CodeBlock: {
344
342
  * </CodeBlock.Root>
345
343
  * ```
346
344
  */
347
- readonly TabContent: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabContentProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
345
+ readonly TabContent: import("react").ForwardRefExoticComponent<Omit<CodeBlockTabContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
348
346
  /**
349
347
  * A tab list for the code block header. Renders pill-styled tabs for switching code.
350
348
  *
@@ -369,7 +367,7 @@ declare const CodeBlock: {
369
367
  * </CodeBlock.Root>
370
368
  * ```
371
369
  */
372
- readonly TabList: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabListProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
370
+ readonly TabList: import("react").ForwardRefExoticComponent<Omit<CodeBlockTabListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
373
371
  /**
374
372
  * A pill-styled tab trigger for the code block header. Must be inside `TabList`.
375
373
  *
@@ -394,7 +392,7 @@ declare const CodeBlock: {
394
392
  * </CodeBlock.Root>
395
393
  * ```
396
394
  */
397
- readonly TabTrigger: _$react.ForwardRefExoticComponent<Omit<CodeBlockTabTriggerProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
395
+ readonly TabTrigger: import("react").ForwardRefExoticComponent<Omit<CodeBlockTabTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
398
396
  /**
399
397
  * The optional title rendered in the header.
400
398
  *
@@ -413,9 +411,9 @@ declare const CodeBlock: {
413
411
  * </CodeBlock.Root>
414
412
  * ```
415
413
  */
416
- readonly Title: _$react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
414
+ readonly Title: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & {
417
415
  asChild?: boolean;
418
- } & _$react.RefAttributes<HTMLHeadingElement>>;
416
+ } & import("react").RefAttributes<HTMLHeadingElement>>;
419
417
  };
420
418
  //#endregion
421
419
  //#region src/components/code-block/escape-html.d.ts
@@ -1,3 +1,3 @@
1
- import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./icon-bWc5yC3-.js";import{t as n}from"./slot-D_ZUrdEW.js";import{t as r}from"./icon-button-ZKN0sRIJ.js";import{t as i}from"./compose-refs-DZ3cPi47.js";import{t as a}from"./use-copy-to-clipboard-CTgtLjUg.js";import{t as o}from"./traffic-policy-file-BwHHdhWJ.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,y as D}from"./resolve-pre-rendered-props-BfWe69-w.js";import{CaretDownIcon as O}from"@phosphor-icons/react/CaretDown";import{createContext as k,forwardRef as A,useCallback as j,useContext as ee,useEffect as M,useId as te,useLayoutEffect as ne,useMemo as N,useRef as P,useState as F}from"react";import I from"tiny-invariant";import{jsx as L,jsxs as re}from"react/jsx-runtime";import{CheckIcon as ie}from"@phosphor-icons/react/Check";import{CopyIcon as ae}from"@phosphor-icons/react/Copy";import{FileTextIcon as oe}from"@phosphor-icons/react/FileText";import{TerminalIcon as se}from"@phosphor-icons/react/Terminal";import{Content as ce,List as le,Root as ue,Trigger as de}from"@radix-ui/react-tabs";function R(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const z=new WeakMap;function B(e){let t=new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function fe(e){let t=z.get(e);if(t!=null&&he(t))return t;let n=new Map,r=new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=B(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return z.set(e,a),a}function pe(e){z.delete(e)}function me(e){pe(e),e.removeAttribute(`data-folded-regions`)}function he(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function ge(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function _e(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=B(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=fe(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&ge(e,r,t)}return!0}function ve(e){let t=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&_e(n)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}const ye=k(null);function V(){let e=ee(ye);return I(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const H=A(({asChild:t=!1,className:r,defaultTab:i,activeTab:a,onActiveTabChange:o,...s},c)=>{let l=P(``),[u,d]=F(!1),[f,p]=F(!1),[m,h]=F(void 0),g=j(e=>{h(t=>(I(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=j(e=>{h(t=>{I(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=N(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!=null||a!=null,b=L(t?n:`div`,{"data-slot":`code-block`,className:e(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-card font-mono`,`[&_svg]:shrink-0`,r),ref:c,...s});return L(ye.Provider,{value:v,children:y?L(ue,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})});H.displayName=`CodeBlock`;const U=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`div`,{"data-slot":`code-block-body`,className:e(`relative`,r),ref:a,...i}));U.displayName=`CodeBlockBody`;const be=/SHIKI_VAL_(\d+)/g;function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const W=new Map;function Se(e){if(e==null||e.length===0)return be;let t=W.get(e);return t??(W.size>=500&&W.clear(),t=RegExp(`${xe(e)}(\\d+)__`,`g`),W.set(e,t)),t}function G(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(Se(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function Ce(e,t,n){return G(e,t,n,e=>R(String(e)))}function we(e,t,n){return G(e,t,n,e=>String(e))}const K=A(({className:t,style:n,value:r,...a},o)=>{let s=te(),c=P(null),{copyTextRef:l,hasCodeExpander:u,isCodeExpanded:d,registerCodeId:f,unregisterCodeId:p}=V(),{language:m,code:h,"~preValToken":g,"~preVals":_,"~highlightLines":v,"~lineNumberStart":y,"~preHtml":b,"~showLineNumbers":x}=r,S=v,C=y??1,w=x??!1,T=N(()=>_!=null&&_.length>0?we(h,_,g):h,[g,_,h]);ne(()=>{l.current=T},[l,T]),M(()=>(f(s),()=>{p(s)}),[s,f,p]);let E=N(()=>{if(b!=null)return _!=null&&_.length>0?Ce(b,_,g):b},[b,g,_]);M(()=>{let e=c.current;if(e==null)return;let t=e.querySelector(`code`);return t!=null&&me(t),ve(e)},[E]);let D=E!=null,O=E??R(T),k=N(()=>({__html:O}),[O]);return L(`pre`,{"data-slot":`code-block-code`,"aria-expanded":u?d:void 0,className:e(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!D&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`aria-collapsed:max-h-[13.6rem]`,t),"data-highlighted":D?`true`:`false`,"data-lang":m,"data-mantle-highlight-lines":D&&S!=null&&S.length>0?S.join(`,`):void 0,"data-mantle-line-number-start":D&&w?String(C):`1`,"data-mantle-line-numbers":D&&w?`true`:`false`,id:s,ref:i(c,o),style:{...n,"--mantle-line-number-start":String(C),tabSize:2,MozTabSize:2},...a,children:L(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:k})})});K.displayName=`CodeBlockCode`;const q=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`div`,{"data-slot":`code-block-header`,className:e(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,r),ref:a,...i}));q.displayName=`CodeBlockHeader`;const J=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`h3`,{"data-slot":`code-block-title`,ref:a,className:e(`text-mono m-0 font-mono font-normal`,r),...i}));J.displayName=`CodeBlockTitle`;const Y=A(({className:e,label:t=`Copy code`,onCopy:n,onCopyError:i,onClick:o,...s},c)=>{let{copyTextRef:l}=V(),u=a(),[d,f]=F(!1),p=P(void 0);return M(()=>()=>{p.current!=null&&clearTimeout(p.current)},[]),L(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-card`,children:L(r,{type:`button`,appearance:`ghost`,size:`sm`,label:t,icon:L(d?ie:ae,{}),className:e,ref:c,onClick:async e=>{try{if(o?.(e),e.defaultPrevented){p.current!=null&&clearTimeout(p.current);return}let t=l.current;await u(t),n?.(t),f(!0),p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{f(!1)},2e3)}catch(e){i?.(e)}},...s})})});Y.displayName=`CodeBlockCopyButton`;const X=A(({asChild:r=!1,className:i,onClick:a,...o},s)=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=V();return M(()=>(d(!0),()=>{d(!1)}),[d]),re(r?n:`button`,{...o,"data-slot":`code-block-expander-button`,"aria-controls":c,"aria-expanded":l,className:e(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-card px-4 py-2 font-sans text-gray-700 hover:bg-gray-100`,i),ref:s,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,L(t,{svg:L(O,{weight:`bold`}),className:e(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})});X.displayName=`CodeBlockExpanderButton`;function Z({className:e,preset:n,svg:r,...i}){let a=r;if(n!=null)switch(n){case`file`:a=L(oe,{weight:`fill`});break;case`cli`:a=L(se,{weight:`fill`});break;case`traffic-policy`:a=L(o,{});break}return L(t,{"data-slot":`code-block-icon`,className:e,svg:a,...i})}Z.displayName=`CodeBlockIcon`;const Q=A(({className:t,...n},r)=>L(le,{"data-slot":`code-block-tab-list`,className:e(`flex items-center gap-1`,t),ref:r,...n}));Q.displayName=`CodeBlockTabList`;const Te=A(({className:t,...n},r)=>L(de,{"data-slot":`code-block-tab-trigger`,className:e(`cursor-pointer rounded px-1.5 py-0.5 text-xs font-medium`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,t),ref:r,...n}));Te.displayName=`CodeBlockTabTrigger`;const $=A((e,t)=>L(ce,{"data-slot":`code-block-tab-content`,ref:t,...e}));$.displayName=`CodeBlockTabContent`;const Ee={Root:H,Body:U,Code:K,CopyButton:Y,ExpanderButton:X,Header:q,Icon:Z,TabContent:$,TabList:Q,TabTrigger:Te,Title:J};function De(e,t){let n=1;if(n>t)return!0;for(let r=0;r<e.length;r++)if(e[r]===`
1
+ import{t as e}from"./cx-CBSnSC36.js";import{t}from"./icon-C8bYBIHW.js";import{t as n}from"./slot-CV5fmqFr.js";import{t as r}from"./icon-button-C_Ht_g1C.js";import{t as i}from"./compose-refs-Cjf2gfB8.js";import{t as a}from"./use-copy-to-clipboard-BLpquU9d.js";import{t as o}from"./traffic-policy-file-0g5RXFqu.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,y as D}from"./resolve-pre-rendered-props-C-vrNxH1.js";import{CaretDownIcon as O}from"@phosphor-icons/react/CaretDown";import{createContext as k,forwardRef as A,useCallback as j,useContext as ee,useEffect as M,useId as te,useLayoutEffect as ne,useMemo as N,useRef as P,useState as F}from"react";import I from"tiny-invariant";import{jsx as L,jsxs as re}from"react/jsx-runtime";import{CheckIcon as ie}from"@phosphor-icons/react/Check";import{CopyIcon as ae}from"@phosphor-icons/react/Copy";import{FileTextIcon as oe}from"@phosphor-icons/react/FileText";import{TerminalIcon as se}from"@phosphor-icons/react/Terminal";import{Content as ce,List as le,Root as ue,Trigger as de}from"@radix-ui/react-tabs";function R(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&amp;`;break;case`<`:n+=`&lt;`;break;case`>`:n+=`&gt;`;break;case`"`:n+=`&quot;`;break;case`'`:n+=`&#39;`;break;default:n+=t}}return n}const z=new WeakMap;function B(e){let t=new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function fe(e){let t=z.get(e);if(t!=null&&he(t))return t;let n=new Map,r=new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=B(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return z.set(e,a),a}function pe(e){z.delete(e)}function me(e){pe(e),e.removeAttribute(`data-folded-regions`)}function he(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function ge(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function _e(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=B(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=fe(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&ge(e,r,t)}return!0}function ve(e){let t=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&_e(n)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}const ye=k(null);function V(){let e=ee(ye);return I(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const H=A(({asChild:t=!1,className:r,defaultTab:i,activeTab:a,onActiveTabChange:o,...s},c)=>{let l=P(``),[u,d]=F(!1),[f,p]=F(!1),[m,h]=F(void 0),g=j(e=>{h(t=>(I(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=j(e=>{h(t=>{I(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=N(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!=null||a!=null,b=L(t?n:`div`,{"data-slot":`code-block`,className:e(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-card font-mono`,`[&_svg]:shrink-0`,r),ref:c,...s});return L(ye.Provider,{value:v,children:y?L(ue,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})});H.displayName=`CodeBlock`;const U=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`div`,{"data-slot":`code-block-body`,className:e(`relative`,r),ref:a,...i}));U.displayName=`CodeBlockBody`;const be=/SHIKI_VAL_(\d+)/g;function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const W=new Map;function Se(e){if(e==null||e.length===0)return be;let t=W.get(e);return t??(W.size>=500&&W.clear(),t=RegExp(`${xe(e)}(\\d+)__`,`g`),W.set(e,t)),t}function G(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(Se(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function Ce(e,t,n){return G(e,t,n,e=>R(String(e)))}function we(e,t,n){return G(e,t,n,e=>String(e))}const K=A(({className:t,style:n,value:r,...a},o)=>{let s=te(),c=P(null),{copyTextRef:l,hasCodeExpander:u,isCodeExpanded:d,registerCodeId:f,unregisterCodeId:p}=V(),{language:m,code:h,"~preValToken":g,"~preVals":_,"~highlightLines":v,"~lineNumberStart":y,"~preHtml":b,"~showLineNumbers":x}=r,S=v,C=y??1,w=x??!1,T=N(()=>_!=null&&_.length>0?we(h,_,g):h,[g,_,h]);ne(()=>{l.current=T},[l,T]),M(()=>(f(s),()=>{p(s)}),[s,f,p]);let E=N(()=>{if(b!=null)return _!=null&&_.length>0?Ce(b,_,g):b},[b,g,_]);M(()=>{let e=c.current;if(e==null)return;let t=e.querySelector(`code`);return t!=null&&me(t),ve(e)},[E]);let D=E!=null,O=E??R(T),k=N(()=>({__html:O}),[O]);return L(`pre`,{"data-slot":`code-block-code`,"aria-expanded":u?d:void 0,className:e(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!D&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`aria-collapsed:max-h-[13.6rem]`,t),"data-highlighted":D?`true`:`false`,"data-lang":m,"data-mantle-highlight-lines":D&&S!=null&&S.length>0?S.join(`,`):void 0,"data-mantle-line-number-start":D&&w?String(C):`1`,"data-mantle-line-numbers":D&&w?`true`:`false`,id:s,ref:i(c,o),style:{...n,"--mantle-line-number-start":String(C),tabSize:2,MozTabSize:2},...a,children:L(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:k})})});K.displayName=`CodeBlockCode`;const q=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`div`,{"data-slot":`code-block-header`,className:e(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,r),ref:a,...i}));q.displayName=`CodeBlockHeader`;const J=A(({asChild:t=!1,className:r,...i},a)=>L(t?n:`h3`,{"data-slot":`code-block-title`,ref:a,className:e(`text-mono m-0 font-mono font-normal`,r),...i}));J.displayName=`CodeBlockTitle`;const Y=A(({className:e,label:t=`Copy code`,onCopy:n,onCopyError:i,onClick:o,...s},c)=>{let{copyTextRef:l}=V(),u=a(),[d,f]=F(!1),p=P(void 0);return M(()=>()=>{p.current!=null&&clearTimeout(p.current)},[]),L(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-card`,children:L(r,{type:`button`,appearance:`ghost`,size:`sm`,label:t,icon:L(d?ie:ae,{}),className:e,ref:c,onClick:async e=>{try{if(o?.(e),e.defaultPrevented){p.current!=null&&clearTimeout(p.current);return}let t=l.current;await u(t),n?.(t),f(!0),p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{f(!1)},2e3)}catch(e){i?.(e)}},...s})})});Y.displayName=`CodeBlockCopyButton`;const X=A(({asChild:r=!1,className:i,onClick:a,...o},s)=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=V();return M(()=>(d(!0),()=>{d(!1)}),[d]),re(r?n:`button`,{...o,"data-slot":`code-block-expander-button`,"aria-controls":c,"aria-expanded":l,className:e(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-card px-4 py-2 font-sans text-gray-700 hover:bg-gray-100`,i),ref:s,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,L(t,{svg:L(O,{weight:`bold`}),className:e(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})});X.displayName=`CodeBlockExpanderButton`;function Z({className:e,preset:n,svg:r,...i}){let a=r;if(n!=null)switch(n){case`file`:a=L(oe,{weight:`fill`});break;case`cli`:a=L(se,{weight:`fill`});break;case`traffic-policy`:a=L(o,{});break}return L(t,{"data-slot":`code-block-icon`,className:e,svg:a,...i})}Z.displayName=`CodeBlockIcon`;const Q=A(({className:t,...n},r)=>L(le,{"data-slot":`code-block-tab-list`,className:e(`flex items-center gap-1`,t),ref:r,...n}));Q.displayName=`CodeBlockTabList`;const Te=A(({className:t,...n},r)=>L(de,{"data-slot":`code-block-tab-trigger`,className:e(`cursor-pointer rounded px-1.5 py-0.5 text-xs font-medium`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,t),ref:r,...n}));Te.displayName=`CodeBlockTabTrigger`;const $=A((e,t)=>L(ce,{"data-slot":`code-block-tab-content`,ref:t,...e}));$.displayName=`CodeBlockTabContent`;const Ee={Root:H,Body:U,Code:K,CopyButton:Y,ExpanderButton:X,Header:q,Icon:Z,TabContent:$,TabList:Q,TabTrigger:Te,Title:J};function De(e,t){let n=1;if(n>t)return!0;for(let r=0;r<e.length;r++)if(e[r]===`
2
2
  `&&(n+=1,n>t))return!0;return!1}export{Ee as CodeBlock,h as computeFoldRanges,c as computeJsonFoldRanges,u as createMantleCodeBlockValue,D as decorateHighlightedHtml,w as defaultMeta,R as escapeHtml,E as finalizeFoldRanges,m as foldStrategyFor,De as hasMoreThanNLines,x as inferIndentation,v as isIndentation,_ as isSupportedLanguage,s as mantleCode,p as normalizeIndentation,y as normalizeValue,b as parseCodeBlockHighlightLines,C as parseCodeBlockLineNumberStart,d as parseCodeBlockShowLineNumbers,T as parseLanguage,S as parseMetastring,g as resolvePreRenderedCodeBlockProps,f as supportedLanguages,l as tokenizeMetastring};
3
3
  //# sourceMappingURL=code-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.js","names":["Root","RadixTabsRoot","MantleIcon","RadixTabsList","RadixTabsTrigger","RadixTabsContent"],"sources":["../src/components/code-block/escape-html.ts","../src/components/code-block/fold-runtime.ts","../src/components/code-block/code-block.tsx","../src/components/code-block/has-more-than-n-lines.ts"],"sourcesContent":["/**\n * Escapes special HTML characters in a string to their corresponding\n * HTML entities, preventing issues like unintended HTML rendering or\n * cross-site scripting (XSS) when injecting raw strings into the DOM\n * using `dangerouslySetInnerHTML`.\n *\n * Characters escaped:\n * - \\& => `&amp;`;\n * - \\< => `&lt;`;\n * - \\> => `&gt;`;\n * - \\\" => `&quot;`;\n * - \\' => `&#39;`;\n *\n * @param {string} value The raw string to be escaped.\n *\n * @example\n * escapeHtml('<div>Hello & \"world\"</div>');\n * // Returns: '&lt;div&gt;Hello &amp; &quot;world&quot;&lt;/div&gt;'\n */\nfunction escapeHtml(value: string): string {\n\tlet firstSpecialCharIndex = -1;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tconst character = value[i];\n\t\tif (\n\t\t\tcharacter === \"&\" ||\n\t\t\tcharacter === \"<\" ||\n\t\t\tcharacter === \">\" ||\n\t\t\tcharacter === '\"' ||\n\t\t\tcharacter === \"'\"\n\t\t) {\n\t\t\tfirstSpecialCharIndex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (firstSpecialCharIndex === -1) {\n\t\treturn value;\n\t}\n\n\tlet escaped = value.slice(0, firstSpecialCharIndex);\n\tfor (let i = firstSpecialCharIndex; i < value.length; i++) {\n\t\tconst character = value[i];\n\t\tswitch (character) {\n\t\t\tcase \"&\":\n\t\t\t\tescaped += \"&amp;\";\n\t\t\t\tbreak;\n\t\t\tcase \"<\":\n\t\t\t\tescaped += \"&lt;\";\n\t\t\t\tbreak;\n\t\t\tcase \">\":\n\t\t\t\tescaped += \"&gt;\";\n\t\t\t\tbreak;\n\t\t\tcase '\"':\n\t\t\t\tescaped += \"&quot;\";\n\t\t\t\tbreak;\n\t\t\tcase \"'\":\n\t\t\t\tescaped += \"&#39;\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tescaped += character;\n\t\t}\n\t}\n\treturn escaped;\n}\n\nexport {\n\t//,\n\tescapeHtml,\n};\n","/**\n * Runtime fold/unfold behavior for `CodeBlock.Code` lives in this module so it\n * can be unit-tested independently of React. The implementation deliberately\n * keeps all interaction state in the DOM and uses a single delegated event\n * handler per `<pre>` — no per-line listeners, no React re-renders on toggle.\n *\n * Why event delegation: GitHub's diff-line performance work showed that\n * attaching listeners per line scales poorly past ~1000 rows. A single\n * top-level listener with attribute-based dispatch keeps memory overhead\n * constant and avoids React reconciliation entirely.\n *\n * @see https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/\n */\n\n/**\n * Cached per-`<code>` fold geometry. Built lazily on first interaction and\n * invalidated by `clearRegionLinesCache` whenever the inner HTML is replaced.\n */\ntype FoldGeometry = {\n\t/** Map from fold-region ID → the line elements that belong to that region. */\n\tregionToLines: Map<string, HTMLElement[]>;\n\t/**\n\t * Per-line cache of parent fold-region IDs as a `Set`. Pre-parsed at\n\t * map-build time so toggles can avoid re-splitting `data-fold-regions`\n\t * on every affected line every click — meaningful when 1000+ lines belong\n\t * to the toggled region.\n\t */\n\tlineToRegions: WeakMap<HTMLElement, Set<string>>;\n};\n\nconst FOLD_GEOMETRY_CACHE = new WeakMap<Element, FoldGeometry>();\n\n/**\n * Splits a space-separated string into a `Set`, dropping empty entries. Used\n * to parse `data-fold-regions` and `data-folded-regions` attribute values.\n */\nfunction parseSpaceSeparated(value: string | null | undefined): Set<string> {\n\tconst set = new Set<string>();\n\tif (value == null || value === \"\") {\n\t\treturn set;\n\t}\n\tfor (const part of value.split(\" \")) {\n\t\tif (part !== \"\") {\n\t\t\tset.add(part);\n\t\t}\n\t}\n\treturn set;\n}\n\n/**\n * Builds (and memoizes per `<code>` element) the {@link FoldGeometry} index.\n * Lazy on first interaction so initial render cost stays at zero.\n *\n * If a cached geometry exists but its first cached line element is no longer\n * connected to the DOM, the cache is treated as stale (typically because\n * something replaced the `<code>`'s `innerHTML` without going through the\n * `clearRegionLinesCache` path) and rebuilt from the current children.\n */\nfunction getFoldGeometry(codeElement: Element): FoldGeometry {\n\tconst cached = FOLD_GEOMETRY_CACHE.get(codeElement);\n\tif (cached != null && isGeometryConnected(cached)) {\n\t\treturn cached;\n\t}\n\tconst regionToLines = new Map<string, HTMLElement[]>();\n\tconst lineToRegions = new WeakMap<HTMLElement, Set<string>>();\n\tconst lineElements = codeElement.querySelectorAll(\"[data-fold-regions]\");\n\tfor (let index = 0; index < lineElements.length; index += 1) {\n\t\tconst lineElement = lineElements[index];\n\t\tif (!(lineElement instanceof HTMLElement)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst regions = parseSpaceSeparated(lineElement.dataset.foldRegions);\n\t\tif (regions.size === 0) {\n\t\t\tcontinue;\n\t\t}\n\t\tlineToRegions.set(lineElement, regions);\n\t\tfor (const region of regions) {\n\t\t\tlet lines = regionToLines.get(region);\n\t\t\tif (lines == null) {\n\t\t\t\tlines = [];\n\t\t\t\tregionToLines.set(region, lines);\n\t\t\t}\n\t\t\tlines.push(lineElement);\n\t\t}\n\t}\n\tconst geometry: FoldGeometry = { regionToLines, lineToRegions };\n\tFOLD_GEOMETRY_CACHE.set(codeElement, geometry);\n\treturn geometry;\n}\n\n/** Resets the per-element cache. Called when the code block re-renders new content. */\nfunction clearRegionLinesCache(codeElement: Element): void {\n\tFOLD_GEOMETRY_CACHE.delete(codeElement);\n}\n\n/** Clears per-code-element runtime state after the code element's HTML is replaced. */\nfunction resetFoldState(codeElement: Element): void {\n\tclearRegionLinesCache(codeElement);\n\tcodeElement.removeAttribute(\"data-folded-regions\");\n}\n\n/**\n * Cheap liveness probe: checks whether the first cached line is still\n * attached to the document. If `innerHTML` was replaced under us, the cached\n * line elements get detached and {@link Element.isConnected} flips to false.\n * Inspecting one entry is enough — they all detach together when the parent's\n * `innerHTML` is reset.\n */\nfunction isGeometryConnected(geometry: FoldGeometry): boolean {\n\tfor (const lines of geometry.regionToLines.values()) {\n\t\tif (lines.length === 0) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst sample = lines[0];\n\t\tif (sample == null) {\n\t\t\tcontinue;\n\t\t}\n\t\treturn sample.isConnected;\n\t}\n\t// Empty geometry — treat as still valid; rebuilding wouldn't add anything.\n\treturn true;\n}\n\n/**\n * Reconciles a single line's hidden state with the currently-folded region\n * set. A line is hidden if any of its parent regions are folded.\n */\nfunction syncLineHidden(\n\tline: HTMLElement,\n\tfoldedRegions: Set<string>,\n\tlineRegions: Set<string>,\n): void {\n\tlet isHidden = false;\n\tfor (const region of lineRegions) {\n\t\tif (foldedRegions.has(region)) {\n\t\t\tisHidden = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (isHidden) {\n\t\tline.dataset.foldHidden = \"true\";\n\t} else {\n\t\tdelete line.dataset.foldHidden;\n\t}\n}\n\n/**\n * Toggles the fold region addressed by `button` and synchronizes only the\n * affected lines. The set of folded regions is persisted on the `<code>`\n * element via `data-folded-regions`, keeping the source of truth in the DOM.\n *\n * Returns `true` if a toggle occurred (button was a valid fold toggle), so\n * callers can avoid follow-up work for unrelated clicks.\n */\nfunction toggleFoldFromButton(button: HTMLButtonElement): boolean {\n\tconst regionId = button.dataset.foldLine;\n\tif (regionId == null || regionId === \"\") {\n\t\treturn false;\n\t}\n\tconst codeElement = button.closest(\"[data-slot='code-block-code']\")?.querySelector(\"code\");\n\tif (codeElement == null) {\n\t\treturn false;\n\t}\n\n\tconst foldedRegions = parseSpaceSeparated(codeElement.getAttribute(\"data-folded-regions\"));\n\tconst isCollapsed = foldedRegions.has(regionId);\n\tconst willCollapse = !isCollapsed;\n\n\tif (willCollapse) {\n\t\tfoldedRegions.add(regionId);\n\t} else {\n\t\tfoldedRegions.delete(regionId);\n\t}\n\n\tif (foldedRegions.size === 0) {\n\t\tcodeElement.removeAttribute(\"data-folded-regions\");\n\t} else {\n\t\tcodeElement.setAttribute(\"data-folded-regions\", [...foldedRegions].join(\" \"));\n\t}\n\n\tbutton.setAttribute(\"aria-expanded\", willCollapse ? \"false\" : \"true\");\n\n\tconst { regionToLines, lineToRegions } = getFoldGeometry(codeElement);\n\tconst lines = regionToLines.get(regionId);\n\tif (lines != null) {\n\t\tfor (const line of lines) {\n\t\t\tconst lineRegions = lineToRegions.get(line);\n\t\t\tif (lineRegions != null) {\n\t\t\t\tsyncLineHidden(line, foldedRegions, lineRegions);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Attaches a single delegated `click` listener to the given `<pre>` element.\n * Returns a teardown function suitable for `useEffect` cleanup.\n *\n * The handler is a no-op when the click does not land on a fold toggle, so it\n * is safe to attach unconditionally (e.g. for non-foldable code blocks).\n */\nfunction attachFoldHandler(preElement: HTMLElement): () => void {\n\tconst handleClick = (event: Event) => {\n\t\tconst target = event.target;\n\t\tif (!(target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst button = target.closest(\".mantle-code-fold-toggle\");\n\t\tif (!(button instanceof HTMLButtonElement)) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleFoldFromButton(button);\n\t};\n\n\tpreElement.addEventListener(\"click\", handleClick);\n\treturn () => {\n\t\tpreElement.removeEventListener(\"click\", handleClick);\n\t};\n}\n\nexport {\n\tattachFoldHandler,\n\tclearRegionLinesCache,\n\tgetFoldGeometry,\n\tresetFoldState,\n\ttoggleFoldFromButton,\n};\n","\"use client\";\n\nimport { CaretDownIcon } from \"@phosphor-icons/react/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/Check\";\nimport { CopyIcon } from \"@phosphor-icons/react/Copy\";\nimport { FileTextIcon } from \"@phosphor-icons/react/FileText\";\nimport { TerminalIcon } from \"@phosphor-icons/react/Terminal\";\nimport type {\n\tComponentProps,\n\tComponentRef,\n\tDispatch,\n\tHTMLAttributes,\n\tReactNode,\n\tSetStateAction,\n} from \"react\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport {\n\tContent as RadixTabsContent,\n\tList as RadixTabsList,\n\tRoot as RadixTabsRoot,\n\tTrigger as RadixTabsTrigger,\n} from \"@radix-ui/react-tabs\";\nimport assert from \"tiny-invariant\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard.js\";\nimport type { SelfClosingWithAsChild, WithAsChild } from \"../../types/as-child.js\";\nimport { composeRefs } from \"../../utils/compose-refs/compose-refs.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon as MantleIcon } from \"../icon/icon.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { TrafficPolicyFileIcon } from \"../icons/traffic-policy-file.js\";\nimport { IconButton } from \"../button/icon-button.js\";\nimport { Slot } from \"../slot/index.js\";\nimport { escapeHtml } from \"./escape-html.js\";\nimport { attachFoldHandler, resetFoldState } from \"./fold-runtime.js\";\nimport type { Mode } from \"./resolve-pre-rendered-props.js\";\nimport type { MantleCodeBlockValue } from \"./mantle-code.js\";\n\ntype CodeBlockContextType = {\n\tcodeId: string | undefined;\n\tcopyTextRef: { current: string };\n\thasCodeExpander: boolean;\n\tisCodeExpanded: boolean;\n\tregisterCodeId: (id: string) => void;\n\tsetHasCodeExpander: (value: boolean) => void;\n\tsetIsCodeExpanded: Dispatch<SetStateAction<boolean>>;\n\tunregisterCodeId: (id: string) => void;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType | null>(null);\n\n/** Returns the nearest `CodeBlock` context, throwing if called outside a `CodeBlock.Root`. */\nfunction useCodeBlockContext(): CodeBlockContextType {\n\tconst context = useContext(CodeBlockContext);\n\tassert(context != null, \"CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.\");\n\treturn context;\n}\n\ntype CodeBlockRootProps = Omit<ComponentProps<\"div\">, \"align\"> &\n\tWithAsChild & {\n\t\t/**\n\t\t * The default active tab value (uncontrolled).\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tdefaultTab?: string;\n\t\t/**\n\t\t * The controlled active tab value.\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tactiveTab?: string;\n\t\t/**\n\t\t * Callback fired when the active tab changes.\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tonActiveTabChange?: (value: string) => void;\n\t};\n\n/**\n * Shiki-powered code blocks with build-time syntax highlighting and zero browser bundle.\n * This is the root component for all CodeBlock components.\n *\n * For tabbed code blocks, pass `defaultTab` (uncontrolled) or `activeTab` / `onActiveTabChange`\n * (controlled) to enable tab switching with `CodeBlock.TabList` and `CodeBlock.TabContent`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Root = forwardRef<ComponentRef<\"div\">, CodeBlockRootProps>(\n\t({ asChild = false, className, defaultTab, activeTab, onActiveTabChange, ...props }, ref) => {\n\t\tconst copyTextRef = useRef(\"\");\n\t\tconst [hasCodeExpander, setHasCodeExpander] = useState(false);\n\t\tconst [isCodeExpanded, setIsCodeExpanded] = useState(false);\n\t\tconst [codeId, setCodeId] = useState<string | undefined>(undefined);\n\n\t\tconst registerCodeId = useCallback((id: string) => {\n\t\t\tsetCodeId((old) => {\n\t\t\t\tassert(old == null, \"You can only render a single CodeBlock.Code within a CodeBlock.\");\n\t\t\t\treturn id;\n\t\t\t});\n\t\t}, []);\n\n\t\tconst unregisterCodeId = useCallback((id: string) => {\n\t\t\tsetCodeId((old) => {\n\t\t\t\tassert(old === id, \"You can only render a single CodeBlock.Code within a CodeBlock.\");\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}, []);\n\n\t\tconst context: CodeBlockContextType = useMemo(\n\t\t\t() =>\n\t\t\t\t({\n\t\t\t\t\tcodeId,\n\t\t\t\t\tcopyTextRef,\n\t\t\t\t\thasCodeExpander,\n\t\t\t\t\tisCodeExpanded,\n\t\t\t\t\tregisterCodeId,\n\t\t\t\t\tsetHasCodeExpander,\n\t\t\t\t\tsetIsCodeExpanded,\n\t\t\t\t\tunregisterCodeId,\n\t\t\t\t}) as const,\n\t\t\t[codeId, hasCodeExpander, isCodeExpanded, registerCodeId, unregisterCodeId],\n\t\t);\n\n\t\tconst hasTabs = defaultTab != null || activeTab != null;\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\tconst tree = (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-card font-mono\",\n\t\t\t\t\t\"[&_svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<CodeBlockContext.Provider value={context}>\n\t\t\t\t{hasTabs ? (\n\t\t\t\t\t<RadixTabsRoot\n\t\t\t\t\t\tasChild\n\t\t\t\t\t\tdefaultValue={defaultTab}\n\t\t\t\t\t\tvalue={activeTab}\n\t\t\t\t\t\tonValueChange={onActiveTabChange}\n\t\t\t\t\t>\n\t\t\t\t\t\t{tree}\n\t\t\t\t\t</RadixTabsRoot>\n\t\t\t\t) : (\n\t\t\t\t\ttree\n\t\t\t\t)}\n\t\t\t</CodeBlockContext.Provider>\n\t\t);\n\t},\n);\nRoot.displayName = \"CodeBlock\";\n\n/**\n * The body of the `CodeBlock`. This is where `CodeBlock.Code` and\n * the optional `CodeBlock.CopyButton` are rendered.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Body = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\"> & WithAsChild>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block-body\"\n\t\t\t\tclassName={cx(\"relative\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nBody.displayName = \"CodeBlockBody\";\n\n/**\n * Matches `SHIKI_VAL_<index>` placeholders injected by the Vite plugin for\n * interpolated template expressions. Hoisted to module scope to avoid\n * re-creating the regex on every substitution call.\n */\nconst LEGACY_SHIKI_VAL_PATTERN = /SHIKI_VAL_(\\d+)/g;\n\n/** Escapes special characters in a string for use in a `RegExp` constructor. */\nfunction escapeForRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nconst maxPreValPatternCacheSize = 500;\nconst preValPatternCache = new Map<string, RegExp>();\n\n/**\n * Returns the cached `RegExp` for the given `preValToken`, falling back to the\n * legacy `SHIKI_VAL_<n>` pattern when no token is provided.\n */\nfunction getTemplateValPattern(preValToken: string | undefined): RegExp {\n\tif (preValToken == null || preValToken.length === 0) {\n\t\treturn LEGACY_SHIKI_VAL_PATTERN;\n\t}\n\n\tlet cached = preValPatternCache.get(preValToken);\n\tif (cached == null) {\n\t\tif (preValPatternCache.size >= maxPreValPatternCacheSize) {\n\t\t\tpreValPatternCache.clear();\n\t\t}\n\t\tcached = new RegExp(`${escapeForRegExp(preValToken)}(\\\\d+)__`, \"g\");\n\t\tpreValPatternCache.set(preValToken, cached);\n\t}\n\treturn cached;\n}\n\n/**\n * Replaces placeholder tokens in `input` with values from `vals`, applying\n * `mapValue` to each substituted value. Returns the input unchanged when\n * no placeholders are present.\n */\nfunction substituteTemplateVals(\n\tinput: string,\n\tvals: unknown[],\n\tpreValToken: string | undefined,\n\tmapValue: (value: unknown) => string,\n): string {\n\tif (preValToken == null) {\n\t\tif (!input.includes(\"SHIKI_VAL_\")) {\n\t\t\treturn input;\n\t\t}\n\t} else if (!input.includes(preValToken)) {\n\t\treturn input;\n\t}\n\n\treturn input.replaceAll(getTemplateValPattern(preValToken), (match, indexText: string) => {\n\t\tconst index = Number.parseInt(indexText, 10);\n\t\tif (Number.isNaN(index) || index < 0 || index >= vals.length) {\n\t\t\treturn match;\n\t\t}\n\t\treturn mapValue(vals[index]);\n\t});\n}\n\n/** Substitutes placeholder tokens in pre-rendered HTML, HTML-escaping each interpolated value. */\nfunction substitutePreVals(html: string, vals: unknown[], preValToken: string | undefined): string {\n\treturn substituteTemplateVals(html, vals, preValToken, (value) => escapeHtml(String(value)));\n}\n\n/** Substitutes placeholder tokens in plain text (for the copy button), without HTML escaping. */\nfunction substitutePreValsPlainText(\n\ttext: string,\n\tvals: unknown[],\n\tpreValToken: string | undefined,\n): string {\n\treturn substituteTemplateVals(text, vals, preValToken, (value) => String(value));\n}\n\ntype CodeBlockCodeProps = Omit<ComponentProps<\"pre\">, \"children\"> & {\n\t/**\n\t * The code value produced by `mantleCode(\"lang\")` tagged template.\n\t * Contains pre-rendered Shiki HTML (when the Vite plugin is active) and\n\t * the original code string for the copy button.\n\t */\n\tvalue: MantleCodeBlockValue;\n};\n\n/**\n * The `CodeBlock` content. Renders pre-highlighted code from `mantleCode()`.\n *\n * `value[\"~preHtml\"]` must be provided by Mantle's Vite plugin or server highlighter.\n * Runtime highlighting and runtime line decoration are intentionally unsupported.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Code = forwardRef<ComponentRef<\"pre\">, CodeBlockCodeProps>(\n\t({ className, style, value, ...props }, ref) => {\n\t\tconst id = useId();\n\t\tconst preRef = useRef<HTMLPreElement>(null);\n\t\tconst { copyTextRef, hasCodeExpander, isCodeExpanded, registerCodeId, unregisterCodeId } =\n\t\t\tuseCodeBlockContext();\n\t\tconst {\n\t\t\tlanguage,\n\t\t\tcode,\n\t\t\t\"~preValToken\": __preValToken,\n\t\t\t\"~preVals\": __preVals,\n\t\t\t\"~highlightLines\": __highlightLines,\n\t\t\t\"~lineNumberStart\": __lineNumberStart,\n\t\t\t\"~preHtml\": __preHtml,\n\t\t\t\"~showLineNumbers\": __showLineNumbers,\n\t\t} = value;\n\n\t\tconst effectiveHighlightLines = __highlightLines;\n\t\tconst effectiveLineNumberStart = __lineNumberStart ?? 1;\n\t\tconst effectiveShowLineNumbers = __showLineNumbers ?? false;\n\t\tconst copyText = useMemo(\n\t\t\t() =>\n\t\t\t\t__preVals != null && __preVals.length > 0\n\t\t\t\t\t? substitutePreValsPlainText(code, __preVals, __preValToken)\n\t\t\t\t\t: code,\n\t\t\t[__preValToken, __preVals, code],\n\t\t);\n\n\t\tuseLayoutEffect(() => {\n\t\t\tcopyTextRef.current = copyText;\n\t\t}, [copyTextRef, copyText]);\n\n\t\tuseEffect(() => {\n\t\t\tregisterCodeId(id);\n\n\t\t\treturn () => {\n\t\t\t\tunregisterCodeId(id);\n\t\t\t};\n\t\t}, [id, registerCodeId, unregisterCodeId]);\n\n\t\tconst renderedHtml = useMemo(() => {\n\t\t\tif (__preHtml == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn __preVals != null && __preVals.length > 0\n\t\t\t\t? substitutePreVals(__preHtml, __preVals, __preValToken)\n\t\t\t\t: __preHtml;\n\t\t}, [__preHtml, __preValToken, __preVals]);\n\n\t\t// Attach a single delegated click handler per <pre> so fold toggles do\n\t\t// not pay the cost of N React re-renders or N event handlers — see the\n\t\t// performance rationale in `fold-runtime.ts`. Re-attaches when the\n\t\t// rendered HTML changes since `<code>` gets a new dangerouslySetInnerHTML.\n\t\tuseEffect(() => {\n\t\t\tconst pre = preRef.current;\n\t\t\tif (pre == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst codeElement = pre.querySelector(\"code\");\n\t\t\tif (codeElement != null) {\n\t\t\t\tresetFoldState(codeElement);\n\t\t\t}\n\t\t\treturn attachFoldHandler(pre);\n\t\t}, [renderedHtml]);\n\n\t\tconst isPreRendered = renderedHtml != null;\n\t\tconst displayHtml = renderedHtml ?? escapeHtml(copyText);\n\n\t\t// React diffs `dangerouslySetInnerHTML` by prop reference; a fresh\n\t\t// `{ __html }` literal each render re-applies `innerHTML`, wiping any\n\t\t// runtime-managed DOM state on the children (e.g. fold attributes).\n\t\tconst innerHtmlProp = useMemo(() => ({ __html: displayHtml }), [displayHtml]);\n\n\t\treturn (\n\t\t\t<pre\n\t\t\t\tdata-slot=\"code-block-code\"\n\t\t\t\taria-expanded={hasCodeExpander ? isCodeExpanded : undefined}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"scrollbar overflow-x-auto overflow-y-hidden py-4\",\n\t\t\t\t\t!isPreRendered && \"pr-14\",\n\t\t\t\t\t\"data-[mantle-line-numbers~='false']:pl-4\",\n\t\t\t\t\t\"text-mono m-0 font-mono outline-hidden\",\n\t\t\t\t\t\"aria-collapsed:max-h-[13.6rem]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-highlighted={isPreRendered ? \"true\" : \"false\"}\n\t\t\t\tdata-lang={language}\n\t\t\t\tdata-mantle-highlight-lines={\n\t\t\t\t\tisPreRendered && effectiveHighlightLines != null && effectiveHighlightLines.length > 0\n\t\t\t\t\t\t? effectiveHighlightLines.join(\",\")\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tdata-mantle-line-number-start={\n\t\t\t\t\tisPreRendered && effectiveShowLineNumbers ? String(effectiveLineNumberStart) : \"1\"\n\t\t\t\t}\n\t\t\t\tdata-mantle-line-numbers={isPreRendered && effectiveShowLineNumbers ? \"true\" : \"false\"}\n\t\t\t\tid={id}\n\t\t\t\tref={composeRefs(preRef, ref)}\n\t\t\t\tstyle={\n\t\t\t\t\t{\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\"--mantle-line-number-start\": String(effectiveLineNumberStart),\n\t\t\t\t\t\ttabSize: 2,\n\t\t\t\t\t\tMozTabSize: 2,\n\t\t\t\t\t} as ComponentProps<\"pre\">[\"style\"]\n\t\t\t\t}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<code\n\t\t\t\t\tclassName=\"text-size-inherit block min-w-full w-max\"\n\t\t\t\t\tdangerouslySetInnerHTML={innerHtmlProp}\n\t\t\t\t/>\n\t\t\t</pre>\n\t\t);\n\t},\n);\nCode.displayName = \"CodeBlockCode\";\n\n/**\n * The (optional) header slot of the `CodeBlock`. This is where\n * `CodeBlock.Icon` and `CodeBlock.Title` are rendered.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Header = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\"> & WithAsChild>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block-header\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nHeader.displayName = \"CodeBlockHeader\";\n\n/**\n * The (optional) title of the `CodeBlock`. Renders as `h3` by default;\n * use `asChild` to render a different element.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Title = forwardRef<\n\tHTMLHeadingElement,\n\tHTMLAttributes<HTMLHeadingElement> & { asChild?: boolean }\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"h3\";\n\treturn (\n\t\t<Component\n\t\t\tdata-slot=\"code-block-title\"\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"text-mono m-0 font-mono font-normal\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nTitle.displayName = \"CodeBlockTitle\";\n\ntype CodeBlockCopyButtonProps = Omit<ComponentProps<\"button\">, \"children\" | \"type\"> &\n\tSelfClosingWithAsChild & {\n\t\t/**\n\t\t * The accessible label for the copy button. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.\n\t\t *\n\t\t * @default \"Copy code\"\n\t\t */\n\t\tlabel?: string;\n\t\t/**\n\t\t * Callback fired when the copy button is clicked, passes the copied text as an argument.\n\t\t */\n\t\tonCopy?: (value: string) => void;\n\t\t/**\n\t\t * Callback fired when an error occurs during copying.\n\t\t */\n\t\tonCopyError?: (error: unknown) => void;\n\t};\n\n/**\n * The (optional) copy button of the `CodeBlock`. Copies the code content\n * to the clipboard when clicked.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst CopyButton = forwardRef<ComponentRef<\"button\">, CodeBlockCopyButtonProps>(\n\t({ className, label = \"Copy code\", onCopy, onCopyError, onClick, ...props }, ref) => {\n\t\tconst { copyTextRef } = useCodeBlockContext();\n\t\tconst copyToClipboard = useCopyToClipboard();\n\t\tconst [wasCopied, setWasCopied] = useState(false);\n\t\tconst timeoutHandle = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"code-block-copy-button\"\n\t\t\t\tclassName=\"absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-card\"\n\t\t\t>\n\t\t\t\t<IconButton\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tappearance=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tlabel={label}\n\t\t\t\t\ticon={wasCopied ? <CheckIcon /> : <CopyIcon />}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tonClick={async (event) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonClick?.(event);\n\t\t\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst text = copyTextRef.current;\n\t\t\t\t\t\t\tawait copyToClipboard(text);\n\t\t\t\t\t\t\tonCopy?.(text);\n\t\t\t\t\t\t\tsetWasCopied(true);\n\t\t\t\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttimeoutHandle.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetWasCopied(false);\n\t\t\t\t\t\t\t}, 2000);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tonCopyError?.(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</span>\n\t\t);\n\t},\n);\nCopyButton.displayName = \"CodeBlockCopyButton\";\n\ntype CodeBlockExpanderButtonProps = Omit<\n\tComponentProps<\"button\">,\n\t\"children\" | \"aria-controls\" | \"aria-expanded\"\n> &\n\tWithAsChild;\n\n/**\n * The (optional) expander button of the `CodeBlock`. Toggles the expanded\n * state of the code block. When present, the code block is collapsible.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst ExpanderButton = forwardRef<ComponentRef<\"button\">, CodeBlockExpanderButtonProps>(\n\t({ asChild = false, className, onClick, ...props }, ref) => {\n\t\tconst { codeId, isCodeExpanded, setIsCodeExpanded, setHasCodeExpander } = useCodeBlockContext();\n\n\t\tuseEffect(() => {\n\t\t\tsetHasCodeExpander(true);\n\t\t\treturn () => {\n\t\t\t\tsetHasCodeExpander(false);\n\t\t\t};\n\t\t}, [setHasCodeExpander]);\n\n\t\tconst Component = asChild ? Slot : \"button\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t{...props}\n\t\t\t\tdata-slot=\"code-block-expander-button\"\n\t\t\t\taria-controls={codeId}\n\t\t\t\taria-expanded={isCodeExpanded}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-card px-4 py-2 font-sans text-gray-700 hover:bg-gray-100\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tsetIsCodeExpanded((prev) => !prev);\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isCodeExpanded ? \"Show less\" : \"Show more\"}{\" \"}\n\t\t\t\t<MantleIcon\n\t\t\t\t\tsvg={<CaretDownIcon weight=\"bold\" />}\n\t\t\t\t\tclassName={cx(\"size-4\", isCodeExpanded && \"rotate-180\", \"transition-all duration-150\")}\n\t\t\t\t/>\n\t\t\t</Component>\n\t\t);\n\t},\n);\nExpanderButton.displayName = \"CodeBlockExpanderButton\";\n\ntype CodeBlockIconProps = Omit<SvgAttributes, \"children\"> &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * A custom icon SVG to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tsvg: ReactNode;\n\t\t\t\t/**\n\t\t\t\t * A preset icon to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tpreset?: undefined | never;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * A custom icon SVG to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tsvg?: undefined | never;\n\t\t\t\t/**\n\t\t\t\t * A preset icon to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tpreset: Mode;\n\t\t }\n\t);\n\n/**\n * A small icon for the `CodeBlock` header. Pass either a custom `svg`\n * or a `preset` value (not both).\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nfunction CodeBlockIconComponent({\n\tclassName,\n\tpreset,\n\tsvg: _svgProp,\n\t...props\n}: CodeBlockIconProps) {\n\tlet svg = _svgProp;\n\tif (preset != null) {\n\t\tswitch (preset) {\n\t\t\tcase \"file\":\n\t\t\t\tsvg = <FileTextIcon weight=\"fill\" />;\n\t\t\t\tbreak;\n\t\t\tcase \"cli\":\n\t\t\t\tsvg = <TerminalIcon weight=\"fill\" />;\n\t\t\t\tbreak;\n\t\t\tcase \"traffic-policy\":\n\t\t\t\tsvg = <TrafficPolicyFileIcon />;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn <MantleIcon data-slot=\"code-block-icon\" className={className} svg={svg} {...props} />;\n}\nCodeBlockIconComponent.displayName = \"CodeBlockIcon\";\n\ntype CodeBlockTabListProps = Omit<ComponentProps<typeof RadixTabsList>, \"asChild\" | \"loop\">;\n\n/**\n * A tab list for the `CodeBlock` header. Renders pill-styled tab triggers\n * that switch which code is displayed. Built on Radix Tabs primitives.\n *\n * Place this inside `CodeBlock.Header` and pair with `CodeBlock.TabContent`\n * in `CodeBlock.Body` to conditionally render code based on the active tab.\n * Tab state is managed by `CodeBlock.Root` via `defaultTab` / `activeTab` / `onActiveTabChange`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root defaultTab=\"yml\">\n * <CodeBlock.Header>\n * <CodeBlock.TabList>\n * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n * </CodeBlock.TabList>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.TabContent value=\"yml\">\n * <CodeBlock.Code value={ymlValue} />\n * </CodeBlock.TabContent>\n * <CodeBlock.TabContent value=\"json\">\n * <CodeBlock.Code value={jsonValue} />\n * </CodeBlock.TabContent>\n * </CodeBlock.Body>\n * </CodeBlock.Root>\n * ```\n */\nconst TabList = forwardRef<ComponentRef<typeof RadixTabsList>, CodeBlockTabListProps>(\n\t({ className, ...props }, ref) => (\n\t\t<RadixTabsList\n\t\t\tdata-slot=\"code-block-tab-list\"\n\t\t\tclassName={cx(\"flex items-center gap-1\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTabList.displayName = \"CodeBlockTabList\";\n\ntype CodeBlockTabTriggerProps = Omit<ComponentProps<typeof RadixTabsTrigger>, \"asChild\">;\n\n/**\n * A pill-styled tab trigger for the `CodeBlock` header.\n * Must be rendered within a `CodeBlock.TabList`.\n *\n * @example\n * ```tsx\n * <CodeBlock.TabList>\n * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n * </CodeBlock.TabList>\n * ```\n */\nconst TabTrigger = forwardRef<ComponentRef<typeof RadixTabsTrigger>, CodeBlockTabTriggerProps>(\n\t({ className, ...props }, ref) => (\n\t\t<RadixTabsTrigger\n\t\t\tdata-slot=\"code-block-tab-trigger\"\n\t\t\tclassName={cx(\n\t\t\t\t\"cursor-pointer rounded px-1.5 py-0.5 text-xs font-medium\",\n\t\t\t\t\"text-gray-600 outline-hidden\",\n\t\t\t\t\"hover:text-gray-900\",\n\t\t\t\t\"data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong\",\n\t\t\t\t\"focus-visible:ring-focus-accent focus-visible:ring-4\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTabTrigger.displayName = \"CodeBlockTabTrigger\";\n\ntype CodeBlockTabContentProps = Omit<\n\tComponentProps<typeof RadixTabsContent>,\n\t\"asChild\" | \"forceMount\"\n>;\n\n/**\n * Conditionally renders its children when the associated tab is active.\n * Pair with `CodeBlock.TabList` and `CodeBlock.TabTrigger` in the header,\n * and set `defaultTab` / `activeTab` on `CodeBlock.Root`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.TabContent value=\"yml\">\n * <CodeBlock.Code value={ymlValue} />\n * </CodeBlock.TabContent>\n * <CodeBlock.TabContent value=\"json\">\n * <CodeBlock.Code value={jsonValue} />\n * </CodeBlock.TabContent>\n * </CodeBlock.Body>\n * ```\n */\nconst TabContent = forwardRef<ComponentRef<typeof RadixTabsContent>, CodeBlockTabContentProps>(\n\t(props, ref) => <RadixTabsContent data-slot=\"code-block-tab-content\" ref={ref} {...props} />,\n);\nTabContent.displayName = \"CodeBlockTabContent\";\n\n/**\n * Shiki-powered code blocks with build-time syntax highlighting and zero browser bundle.\n *\n * Use `mantleCodeBlockPlugins()` to enable pre-rendering at build time.\n *\n * @example\n * Composition:\n * ```\n * # Standard\n * CodeBlock.Root\n * ├── CodeBlock.Header\n * │ ├── CodeBlock.Icon\n * │ └── CodeBlock.Title\n * ├── CodeBlock.Body\n * │ ├── CodeBlock.CopyButton\n * │ └── CodeBlock.Code\n * └── CodeBlock.ExpanderButton\n *\n * # Tabbed\n * CodeBlock.Root\n * ├── CodeBlock.Header\n * │ └── CodeBlock.TabList\n * │ └── CodeBlock.TabTrigger\n * ├── CodeBlock.Body\n * │ ├── CodeBlock.CopyButton\n * │ └── CodeBlock.TabContent\n * │ └── CodeBlock.Code\n * └── CodeBlock.ExpanderButton\n * ```\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n *\n * // Server-highlighted HTML fetched via an action route + React Query mutation\n * const highlightMutation = useMutation({\n * mutationFn: async () => {\n * const response = await fetch(\"/api/shiki-highlight\", {\n * method: \"POST\",\n * headers: { \"Content-Type\": \"application/json\" },\n * body: JSON.stringify({ code: source, language: \"typescript\" }),\n * });\n * return response.json();\n * },\n * });\n *\n * const serverValue = createMantleCodeBlockValue({\n * language: \"typescript\",\n * code: source,\n * preHtml: highlightMutation.data?.html,\n * });\n * ```\n */\nconst CodeBlock = {\n\t/**\n\t * The root component of the `CodeBlock`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tBody,\n\t/**\n\t * The code content. Renders pre-highlighted Shiki HTML when the Vite plugin is active.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tCode,\n\t/**\n\t * The optional copy button.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tCopyButton,\n\t/**\n\t * The optional expander button for collapsible code blocks.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tExpanderButton,\n\t/**\n\t * The optional header slot for icon and title.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tHeader,\n\t/**\n\t * A small icon for the code block header. Use `preset` or `svg`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tIcon: CodeBlockIconComponent,\n\t/**\n\t * Conditionally renders children when the associated tab is active.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabContent,\n\t/**\n\t * A tab list for the code block header. Renders pill-styled tabs for switching code.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabList,\n\t/**\n\t * A pill-styled tab trigger for the code block header. Must be inside `TabList`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabTrigger,\n\t/**\n\t * The optional title rendered in the header.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTitle,\n} as const;\n\nexport {\n\t//,\n\tCodeBlock,\n};\n","/**\n * Returns `true` if `value` has more than `maxLines` newline-delimited lines.\n *\n * This is equivalent to `value.split(\"\\\\n\").length > maxLines`, but avoids\n * allocating an intermediate array and can early-return once the threshold is exceeded.\n */\nfunction hasMoreThanNLines(value: string, maxLines: number): boolean {\n\tlet lines = 1;\n\tif (lines > maxLines) {\n\t\treturn true;\n\t}\n\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value[i] === \"\\n\") {\n\t\t\tlines += 1;\n\t\t\tif (lines > maxLines) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nexport {\n\t//,\n\thasMoreThanNLines,\n};\n"],"mappings":"goCAmBA,SAAS,EAAW,EAAuB,CAC1C,IAAI,EAAwB,GAC5B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IAAK,CACtC,IAAM,EAAY,EAAM,GACxB,GACC,IAAc,KACd,IAAc,KACd,IAAc,KACd,IAAc,KACd,IAAc,IACb,CACD,EAAwB,EACxB,OAIF,GAAI,IAA0B,GAC7B,OAAO,EAGR,IAAI,EAAU,EAAM,MAAM,EAAG,EAAsB,CACnD,IAAK,IAAI,EAAI,EAAuB,EAAI,EAAM,OAAQ,IAAK,CAC1D,IAAM,EAAY,EAAM,GACxB,OAAQ,EAAR,CACC,IAAK,IACJ,GAAW,QACX,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zB,EAACC,GAAD,CACC,YAAU,yBACV,UAAW,EACV,2DACA,+BACA,sBACA,wEACA,uDACA,EACA,CACI,MACL,GAAI,EACH,CAAA,CAEH,CACD,GAAW,YAAc,sBAyBzB,MAAM,EAAa,GACjB,EAAO,IAAQ,EAACC,GAAD,CAAkB,YAAU,yBAA8B,MAAK,GAAI,EAAS,CAAA,CAC5F,CACD,EAAW,YAAc,sBAiEzB,MAAM,GAAY,CAmBjB,KAAA,EAmBA,OAmBA,OAmBA,aAmBA,iBAmBA,SAmBA,KAAM,EAyBN,aAyBA,UAyBA,cAmBA,QACA,CC9mCD,SAAS,GAAkB,EAAe,EAA2B,CACpE,IAAI,EAAQ,EACZ,GAAI,EAAQ,EACX,MAAO,GAGR,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IACjC,GAAI,EAAM,KAAO;IAChB,GAAS,EACL,EAAQ,GACX,MAAO,GAIV,MAAO"}
1
+ {"version":3,"file":"code-block.js","names":["Root","RadixTabsRoot","MantleIcon","RadixTabsList","RadixTabsTrigger","RadixTabsContent"],"sources":["../src/components/code-block/escape-html.ts","../src/components/code-block/fold-runtime.ts","../src/components/code-block/code-block.tsx","../src/components/code-block/has-more-than-n-lines.ts"],"sourcesContent":["/**\n * Escapes special HTML characters in a string to their corresponding\n * HTML entities, preventing issues like unintended HTML rendering or\n * cross-site scripting (XSS) when injecting raw strings into the DOM\n * using `dangerouslySetInnerHTML`.\n *\n * Characters escaped:\n * - \\& => `&amp;`;\n * - \\< => `&lt;`;\n * - \\> => `&gt;`;\n * - \\\" => `&quot;`;\n * - \\' => `&#39;`;\n *\n * @param {string} value The raw string to be escaped.\n *\n * @example\n * escapeHtml('<div>Hello & \"world\"</div>');\n * // Returns: '&lt;div&gt;Hello &amp; &quot;world&quot;&lt;/div&gt;'\n */\nfunction escapeHtml(value: string): string {\n\tlet firstSpecialCharIndex = -1;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tconst character = value[i];\n\t\tif (\n\t\t\tcharacter === \"&\" ||\n\t\t\tcharacter === \"<\" ||\n\t\t\tcharacter === \">\" ||\n\t\t\tcharacter === '\"' ||\n\t\t\tcharacter === \"'\"\n\t\t) {\n\t\t\tfirstSpecialCharIndex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (firstSpecialCharIndex === -1) {\n\t\treturn value;\n\t}\n\n\tlet escaped = value.slice(0, firstSpecialCharIndex);\n\tfor (let i = firstSpecialCharIndex; i < value.length; i++) {\n\t\tconst character = value[i];\n\t\tswitch (character) {\n\t\t\tcase \"&\":\n\t\t\t\tescaped += \"&amp;\";\n\t\t\t\tbreak;\n\t\t\tcase \"<\":\n\t\t\t\tescaped += \"&lt;\";\n\t\t\t\tbreak;\n\t\t\tcase \">\":\n\t\t\t\tescaped += \"&gt;\";\n\t\t\t\tbreak;\n\t\t\tcase '\"':\n\t\t\t\tescaped += \"&quot;\";\n\t\t\t\tbreak;\n\t\t\tcase \"'\":\n\t\t\t\tescaped += \"&#39;\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tescaped += character;\n\t\t}\n\t}\n\treturn escaped;\n}\n\nexport {\n\t//,\n\tescapeHtml,\n};\n","/**\n * Runtime fold/unfold behavior for `CodeBlock.Code` lives in this module so it\n * can be unit-tested independently of React. The implementation deliberately\n * keeps all interaction state in the DOM and uses a single delegated event\n * handler per `<pre>` — no per-line listeners, no React re-renders on toggle.\n *\n * Why event delegation: GitHub's diff-line performance work showed that\n * attaching listeners per line scales poorly past ~1000 rows. A single\n * top-level listener with attribute-based dispatch keeps memory overhead\n * constant and avoids React reconciliation entirely.\n *\n * @see https://github.blog/engineering/architecture-optimization/the-uphill-climb-of-making-diff-lines-performant/\n */\n\n/**\n * Cached per-`<code>` fold geometry. Built lazily on first interaction and\n * invalidated by `clearRegionLinesCache` whenever the inner HTML is replaced.\n */\ntype FoldGeometry = {\n\t/** Map from fold-region ID → the line elements that belong to that region. */\n\tregionToLines: Map<string, HTMLElement[]>;\n\t/**\n\t * Per-line cache of parent fold-region IDs as a `Set`. Pre-parsed at\n\t * map-build time so toggles can avoid re-splitting `data-fold-regions`\n\t * on every affected line every click — meaningful when 1000+ lines belong\n\t * to the toggled region.\n\t */\n\tlineToRegions: WeakMap<HTMLElement, Set<string>>;\n};\n\nconst FOLD_GEOMETRY_CACHE = new WeakMap<Element, FoldGeometry>();\n\n/**\n * Splits a space-separated string into a `Set`, dropping empty entries. Used\n * to parse `data-fold-regions` and `data-folded-regions` attribute values.\n */\nfunction parseSpaceSeparated(value: string | null | undefined): Set<string> {\n\tconst set = new Set<string>();\n\tif (value == null || value === \"\") {\n\t\treturn set;\n\t}\n\tfor (const part of value.split(\" \")) {\n\t\tif (part !== \"\") {\n\t\t\tset.add(part);\n\t\t}\n\t}\n\treturn set;\n}\n\n/**\n * Builds (and memoizes per `<code>` element) the {@link FoldGeometry} index.\n * Lazy on first interaction so initial render cost stays at zero.\n *\n * If a cached geometry exists but its first cached line element is no longer\n * connected to the DOM, the cache is treated as stale (typically because\n * something replaced the `<code>`'s `innerHTML` without going through the\n * `clearRegionLinesCache` path) and rebuilt from the current children.\n */\nfunction getFoldGeometry(codeElement: Element): FoldGeometry {\n\tconst cached = FOLD_GEOMETRY_CACHE.get(codeElement);\n\tif (cached != null && isGeometryConnected(cached)) {\n\t\treturn cached;\n\t}\n\tconst regionToLines = new Map<string, HTMLElement[]>();\n\tconst lineToRegions = new WeakMap<HTMLElement, Set<string>>();\n\tconst lineElements = codeElement.querySelectorAll(\"[data-fold-regions]\");\n\tfor (let index = 0; index < lineElements.length; index += 1) {\n\t\tconst lineElement = lineElements[index];\n\t\tif (!(lineElement instanceof HTMLElement)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst regions = parseSpaceSeparated(lineElement.dataset.foldRegions);\n\t\tif (regions.size === 0) {\n\t\t\tcontinue;\n\t\t}\n\t\tlineToRegions.set(lineElement, regions);\n\t\tfor (const region of regions) {\n\t\t\tlet lines = regionToLines.get(region);\n\t\t\tif (lines == null) {\n\t\t\t\tlines = [];\n\t\t\t\tregionToLines.set(region, lines);\n\t\t\t}\n\t\t\tlines.push(lineElement);\n\t\t}\n\t}\n\tconst geometry: FoldGeometry = { regionToLines, lineToRegions };\n\tFOLD_GEOMETRY_CACHE.set(codeElement, geometry);\n\treturn geometry;\n}\n\n/** Resets the per-element cache. Called when the code block re-renders new content. */\nfunction clearRegionLinesCache(codeElement: Element): void {\n\tFOLD_GEOMETRY_CACHE.delete(codeElement);\n}\n\n/** Clears per-code-element runtime state after the code element's HTML is replaced. */\nfunction resetFoldState(codeElement: Element): void {\n\tclearRegionLinesCache(codeElement);\n\tcodeElement.removeAttribute(\"data-folded-regions\");\n}\n\n/**\n * Cheap liveness probe: checks whether the first cached line is still\n * attached to the document. If `innerHTML` was replaced under us, the cached\n * line elements get detached and {@link Element.isConnected} flips to false.\n * Inspecting one entry is enough — they all detach together when the parent's\n * `innerHTML` is reset.\n */\nfunction isGeometryConnected(geometry: FoldGeometry): boolean {\n\tfor (const lines of geometry.regionToLines.values()) {\n\t\tif (lines.length === 0) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst sample = lines[0];\n\t\tif (sample == null) {\n\t\t\tcontinue;\n\t\t}\n\t\treturn sample.isConnected;\n\t}\n\t// Empty geometry — treat as still valid; rebuilding wouldn't add anything.\n\treturn true;\n}\n\n/**\n * Reconciles a single line's hidden state with the currently-folded region\n * set. A line is hidden if any of its parent regions are folded.\n */\nfunction syncLineHidden(\n\tline: HTMLElement,\n\tfoldedRegions: Set<string>,\n\tlineRegions: Set<string>,\n): void {\n\tlet isHidden = false;\n\tfor (const region of lineRegions) {\n\t\tif (foldedRegions.has(region)) {\n\t\t\tisHidden = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (isHidden) {\n\t\tline.dataset.foldHidden = \"true\";\n\t} else {\n\t\tdelete line.dataset.foldHidden;\n\t}\n}\n\n/**\n * Toggles the fold region addressed by `button` and synchronizes only the\n * affected lines. The set of folded regions is persisted on the `<code>`\n * element via `data-folded-regions`, keeping the source of truth in the DOM.\n *\n * Returns `true` if a toggle occurred (button was a valid fold toggle), so\n * callers can avoid follow-up work for unrelated clicks.\n */\nfunction toggleFoldFromButton(button: HTMLButtonElement): boolean {\n\tconst regionId = button.dataset.foldLine;\n\tif (regionId == null || regionId === \"\") {\n\t\treturn false;\n\t}\n\tconst codeElement = button.closest(\"[data-slot='code-block-code']\")?.querySelector(\"code\");\n\tif (codeElement == null) {\n\t\treturn false;\n\t}\n\n\tconst foldedRegions = parseSpaceSeparated(codeElement.getAttribute(\"data-folded-regions\"));\n\tconst isCollapsed = foldedRegions.has(regionId);\n\tconst willCollapse = !isCollapsed;\n\n\tif (willCollapse) {\n\t\tfoldedRegions.add(regionId);\n\t} else {\n\t\tfoldedRegions.delete(regionId);\n\t}\n\n\tif (foldedRegions.size === 0) {\n\t\tcodeElement.removeAttribute(\"data-folded-regions\");\n\t} else {\n\t\tcodeElement.setAttribute(\"data-folded-regions\", [...foldedRegions].join(\" \"));\n\t}\n\n\tbutton.setAttribute(\"aria-expanded\", willCollapse ? \"false\" : \"true\");\n\n\tconst { regionToLines, lineToRegions } = getFoldGeometry(codeElement);\n\tconst lines = regionToLines.get(regionId);\n\tif (lines != null) {\n\t\tfor (const line of lines) {\n\t\t\tconst lineRegions = lineToRegions.get(line);\n\t\t\tif (lineRegions != null) {\n\t\t\t\tsyncLineHidden(line, foldedRegions, lineRegions);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Attaches a single delegated `click` listener to the given `<pre>` element.\n * Returns a teardown function suitable for `useEffect` cleanup.\n *\n * The handler is a no-op when the click does not land on a fold toggle, so it\n * is safe to attach unconditionally (e.g. for non-foldable code blocks).\n */\nfunction attachFoldHandler(preElement: HTMLElement): () => void {\n\tconst handleClick = (event: Event) => {\n\t\tconst target = event.target;\n\t\tif (!(target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst button = target.closest(\".mantle-code-fold-toggle\");\n\t\tif (!(button instanceof HTMLButtonElement)) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleFoldFromButton(button);\n\t};\n\n\tpreElement.addEventListener(\"click\", handleClick);\n\treturn () => {\n\t\tpreElement.removeEventListener(\"click\", handleClick);\n\t};\n}\n\nexport {\n\tattachFoldHandler,\n\tclearRegionLinesCache,\n\tgetFoldGeometry,\n\tresetFoldState,\n\ttoggleFoldFromButton,\n};\n","\"use client\";\n\nimport { CaretDownIcon } from \"@phosphor-icons/react/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/Check\";\nimport { CopyIcon } from \"@phosphor-icons/react/Copy\";\nimport { FileTextIcon } from \"@phosphor-icons/react/FileText\";\nimport { TerminalIcon } from \"@phosphor-icons/react/Terminal\";\nimport type {\n\tComponentProps,\n\tComponentRef,\n\tDispatch,\n\tHTMLAttributes,\n\tReactNode,\n\tSetStateAction,\n} from \"react\";\nimport {\n\tcreateContext,\n\tforwardRef,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport {\n\tContent as RadixTabsContent,\n\tList as RadixTabsList,\n\tRoot as RadixTabsRoot,\n\tTrigger as RadixTabsTrigger,\n} from \"@radix-ui/react-tabs\";\nimport assert from \"tiny-invariant\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard.js\";\nimport type { SelfClosingWithAsChild, WithAsChild } from \"../../types/as-child.js\";\nimport { composeRefs } from \"../../utils/compose-refs/compose-refs.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon as MantleIcon } from \"../icon/icon.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { TrafficPolicyFileIcon } from \"../icons/traffic-policy-file.js\";\nimport { IconButton } from \"../button/icon-button.js\";\nimport { Slot } from \"../slot/index.js\";\nimport { escapeHtml } from \"./escape-html.js\";\nimport { attachFoldHandler, resetFoldState } from \"./fold-runtime.js\";\nimport type { Mode } from \"./resolve-pre-rendered-props.js\";\nimport type { MantleCodeBlockValue } from \"./mantle-code.js\";\n\ntype CodeBlockContextType = {\n\tcodeId: string | undefined;\n\tcopyTextRef: { current: string };\n\thasCodeExpander: boolean;\n\tisCodeExpanded: boolean;\n\tregisterCodeId: (id: string) => void;\n\tsetHasCodeExpander: (value: boolean) => void;\n\tsetIsCodeExpanded: Dispatch<SetStateAction<boolean>>;\n\tunregisterCodeId: (id: string) => void;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType | null>(null);\n\n/** Returns the nearest `CodeBlock` context, throwing if called outside a `CodeBlock.Root`. */\nfunction useCodeBlockContext(): CodeBlockContextType {\n\tconst context = useContext(CodeBlockContext);\n\tassert(context != null, \"CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.\");\n\treturn context;\n}\n\ntype CodeBlockRootProps = Omit<ComponentProps<\"div\">, \"align\"> &\n\tWithAsChild & {\n\t\t/**\n\t\t * The default active tab value (uncontrolled).\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tdefaultTab?: string;\n\t\t/**\n\t\t * The controlled active tab value.\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tactiveTab?: string;\n\t\t/**\n\t\t * Callback fired when the active tab changes.\n\t\t * Only relevant when using `CodeBlock.TabList` / `CodeBlock.TabContent`.\n\t\t */\n\t\tonActiveTabChange?: (value: string) => void;\n\t};\n\n/**\n * Shiki-powered code blocks with build-time syntax highlighting and zero browser bundle.\n * This is the root component for all CodeBlock components.\n *\n * For tabbed code blocks, pass `defaultTab` (uncontrolled) or `activeTab` / `onActiveTabChange`\n * (controlled) to enable tab switching with `CodeBlock.TabList` and `CodeBlock.TabContent`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Root = forwardRef<ComponentRef<\"div\">, CodeBlockRootProps>(\n\t({ asChild = false, className, defaultTab, activeTab, onActiveTabChange, ...props }, ref) => {\n\t\tconst copyTextRef = useRef(\"\");\n\t\tconst [hasCodeExpander, setHasCodeExpander] = useState(false);\n\t\tconst [isCodeExpanded, setIsCodeExpanded] = useState(false);\n\t\tconst [codeId, setCodeId] = useState<string | undefined>(undefined);\n\n\t\tconst registerCodeId = useCallback((id: string) => {\n\t\t\tsetCodeId((old) => {\n\t\t\t\tassert(old == null, \"You can only render a single CodeBlock.Code within a CodeBlock.\");\n\t\t\t\treturn id;\n\t\t\t});\n\t\t}, []);\n\n\t\tconst unregisterCodeId = useCallback((id: string) => {\n\t\t\tsetCodeId((old) => {\n\t\t\t\tassert(old === id, \"You can only render a single CodeBlock.Code within a CodeBlock.\");\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}, []);\n\n\t\tconst context: CodeBlockContextType = useMemo(\n\t\t\t() =>\n\t\t\t\t({\n\t\t\t\t\tcodeId,\n\t\t\t\t\tcopyTextRef,\n\t\t\t\t\thasCodeExpander,\n\t\t\t\t\tisCodeExpanded,\n\t\t\t\t\tregisterCodeId,\n\t\t\t\t\tsetHasCodeExpander,\n\t\t\t\t\tsetIsCodeExpanded,\n\t\t\t\t\tunregisterCodeId,\n\t\t\t\t}) as const,\n\t\t\t[codeId, hasCodeExpander, isCodeExpanded, registerCodeId, unregisterCodeId],\n\t\t);\n\n\t\tconst hasTabs = defaultTab != null || activeTab != null;\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\tconst tree = (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-card font-mono\",\n\t\t\t\t\t\"[&_svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<CodeBlockContext.Provider value={context}>\n\t\t\t\t{hasTabs ? (\n\t\t\t\t\t<RadixTabsRoot\n\t\t\t\t\t\tasChild\n\t\t\t\t\t\tdefaultValue={defaultTab}\n\t\t\t\t\t\tvalue={activeTab}\n\t\t\t\t\t\tonValueChange={onActiveTabChange}\n\t\t\t\t\t>\n\t\t\t\t\t\t{tree}\n\t\t\t\t\t</RadixTabsRoot>\n\t\t\t\t) : (\n\t\t\t\t\ttree\n\t\t\t\t)}\n\t\t\t</CodeBlockContext.Provider>\n\t\t);\n\t},\n);\nRoot.displayName = \"CodeBlock\";\n\n/**\n * The body of the `CodeBlock`. This is where `CodeBlock.Code` and\n * the optional `CodeBlock.CopyButton` are rendered.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Body = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\"> & WithAsChild>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block-body\"\n\t\t\t\tclassName={cx(\"relative\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nBody.displayName = \"CodeBlockBody\";\n\n/**\n * Matches `SHIKI_VAL_<index>` placeholders injected by the Vite plugin for\n * interpolated template expressions. Hoisted to module scope to avoid\n * re-creating the regex on every substitution call.\n */\nconst LEGACY_SHIKI_VAL_PATTERN = /SHIKI_VAL_(\\d+)/g;\n\n/** Escapes special characters in a string for use in a `RegExp` constructor. */\nfunction escapeForRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nconst maxPreValPatternCacheSize = 500;\nconst preValPatternCache = new Map<string, RegExp>();\n\n/**\n * Returns the cached `RegExp` for the given `preValToken`, falling back to the\n * legacy `SHIKI_VAL_<n>` pattern when no token is provided.\n */\nfunction getTemplateValPattern(preValToken: string | undefined): RegExp {\n\tif (preValToken == null || preValToken.length === 0) {\n\t\treturn LEGACY_SHIKI_VAL_PATTERN;\n\t}\n\n\tlet cached = preValPatternCache.get(preValToken);\n\tif (cached == null) {\n\t\tif (preValPatternCache.size >= maxPreValPatternCacheSize) {\n\t\t\tpreValPatternCache.clear();\n\t\t}\n\t\tcached = new RegExp(`${escapeForRegExp(preValToken)}(\\\\d+)__`, \"g\");\n\t\tpreValPatternCache.set(preValToken, cached);\n\t}\n\treturn cached;\n}\n\n/**\n * Replaces placeholder tokens in `input` with values from `vals`, applying\n * `mapValue` to each substituted value. Returns the input unchanged when\n * no placeholders are present.\n */\nfunction substituteTemplateVals(\n\tinput: string,\n\tvals: unknown[],\n\tpreValToken: string | undefined,\n\tmapValue: (value: unknown) => string,\n): string {\n\tif (preValToken == null) {\n\t\tif (!input.includes(\"SHIKI_VAL_\")) {\n\t\t\treturn input;\n\t\t}\n\t} else if (!input.includes(preValToken)) {\n\t\treturn input;\n\t}\n\n\treturn input.replaceAll(getTemplateValPattern(preValToken), (match, indexText: string) => {\n\t\tconst index = Number.parseInt(indexText, 10);\n\t\tif (Number.isNaN(index) || index < 0 || index >= vals.length) {\n\t\t\treturn match;\n\t\t}\n\t\treturn mapValue(vals[index]);\n\t});\n}\n\n/** Substitutes placeholder tokens in pre-rendered HTML, HTML-escaping each interpolated value. */\nfunction substitutePreVals(html: string, vals: unknown[], preValToken: string | undefined): string {\n\treturn substituteTemplateVals(html, vals, preValToken, (value) => escapeHtml(String(value)));\n}\n\n/** Substitutes placeholder tokens in plain text (for the copy button), without HTML escaping. */\nfunction substitutePreValsPlainText(\n\ttext: string,\n\tvals: unknown[],\n\tpreValToken: string | undefined,\n): string {\n\treturn substituteTemplateVals(text, vals, preValToken, (value) => String(value));\n}\n\ntype CodeBlockCodeProps = Omit<ComponentProps<\"pre\">, \"children\"> & {\n\t/**\n\t * The code value produced by `mantleCode(\"lang\")` tagged template.\n\t * Contains pre-rendered Shiki HTML (when the Vite plugin is active) and\n\t * the original code string for the copy button.\n\t */\n\tvalue: MantleCodeBlockValue;\n};\n\n/**\n * The `CodeBlock` content. Renders pre-highlighted code from `mantleCode()`.\n *\n * `value[\"~preHtml\"]` must be provided by Mantle's Vite plugin or server highlighter.\n * Runtime highlighting and runtime line decoration are intentionally unsupported.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Code = forwardRef<ComponentRef<\"pre\">, CodeBlockCodeProps>(\n\t({ className, style, value, ...props }, ref) => {\n\t\tconst id = useId();\n\t\tconst preRef = useRef<HTMLPreElement>(null);\n\t\tconst { copyTextRef, hasCodeExpander, isCodeExpanded, registerCodeId, unregisterCodeId } =\n\t\t\tuseCodeBlockContext();\n\t\tconst {\n\t\t\tlanguage,\n\t\t\tcode,\n\t\t\t\"~preValToken\": __preValToken,\n\t\t\t\"~preVals\": __preVals,\n\t\t\t\"~highlightLines\": __highlightLines,\n\t\t\t\"~lineNumberStart\": __lineNumberStart,\n\t\t\t\"~preHtml\": __preHtml,\n\t\t\t\"~showLineNumbers\": __showLineNumbers,\n\t\t} = value;\n\n\t\tconst effectiveHighlightLines = __highlightLines;\n\t\tconst effectiveLineNumberStart = __lineNumberStart ?? 1;\n\t\tconst effectiveShowLineNumbers = __showLineNumbers ?? false;\n\t\tconst copyText = useMemo(\n\t\t\t() =>\n\t\t\t\t__preVals != null && __preVals.length > 0\n\t\t\t\t\t? substitutePreValsPlainText(code, __preVals, __preValToken)\n\t\t\t\t\t: code,\n\t\t\t[__preValToken, __preVals, code],\n\t\t);\n\n\t\tuseLayoutEffect(() => {\n\t\t\tcopyTextRef.current = copyText;\n\t\t}, [copyTextRef, copyText]);\n\n\t\tuseEffect(() => {\n\t\t\tregisterCodeId(id);\n\n\t\t\treturn () => {\n\t\t\t\tunregisterCodeId(id);\n\t\t\t};\n\t\t}, [id, registerCodeId, unregisterCodeId]);\n\n\t\tconst renderedHtml = useMemo(() => {\n\t\t\tif (__preHtml == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn __preVals != null && __preVals.length > 0\n\t\t\t\t? substitutePreVals(__preHtml, __preVals, __preValToken)\n\t\t\t\t: __preHtml;\n\t\t}, [__preHtml, __preValToken, __preVals]);\n\n\t\t// Attach a single delegated click handler per <pre> so fold toggles do\n\t\t// not pay the cost of N React re-renders or N event handlers — see the\n\t\t// performance rationale in `fold-runtime.ts`. Re-attaches when the\n\t\t// rendered HTML changes since `<code>` gets a new dangerouslySetInnerHTML.\n\t\tuseEffect(() => {\n\t\t\tconst pre = preRef.current;\n\t\t\tif (pre == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst codeElement = pre.querySelector(\"code\");\n\t\t\tif (codeElement != null) {\n\t\t\t\tresetFoldState(codeElement);\n\t\t\t}\n\t\t\treturn attachFoldHandler(pre);\n\t\t}, [renderedHtml]);\n\n\t\tconst isPreRendered = renderedHtml != null;\n\t\tconst displayHtml = renderedHtml ?? escapeHtml(copyText);\n\n\t\t// React diffs `dangerouslySetInnerHTML` by prop reference; a fresh\n\t\t// `{ __html }` literal each render re-applies `innerHTML`, wiping any\n\t\t// runtime-managed DOM state on the children (e.g. fold attributes).\n\t\tconst innerHtmlProp = useMemo(() => ({ __html: displayHtml }), [displayHtml]);\n\n\t\treturn (\n\t\t\t<pre\n\t\t\t\tdata-slot=\"code-block-code\"\n\t\t\t\taria-expanded={hasCodeExpander ? isCodeExpanded : undefined}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"scrollbar overflow-x-auto overflow-y-hidden py-4\",\n\t\t\t\t\t!isPreRendered && \"pr-14\",\n\t\t\t\t\t\"data-[mantle-line-numbers~='false']:pl-4\",\n\t\t\t\t\t\"text-mono m-0 font-mono outline-hidden\",\n\t\t\t\t\t\"aria-collapsed:max-h-[13.6rem]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-highlighted={isPreRendered ? \"true\" : \"false\"}\n\t\t\t\tdata-lang={language}\n\t\t\t\tdata-mantle-highlight-lines={\n\t\t\t\t\tisPreRendered && effectiveHighlightLines != null && effectiveHighlightLines.length > 0\n\t\t\t\t\t\t? effectiveHighlightLines.join(\",\")\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tdata-mantle-line-number-start={\n\t\t\t\t\tisPreRendered && effectiveShowLineNumbers ? String(effectiveLineNumberStart) : \"1\"\n\t\t\t\t}\n\t\t\t\tdata-mantle-line-numbers={isPreRendered && effectiveShowLineNumbers ? \"true\" : \"false\"}\n\t\t\t\tid={id}\n\t\t\t\tref={composeRefs(preRef, ref)}\n\t\t\t\tstyle={\n\t\t\t\t\t{\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\"--mantle-line-number-start\": String(effectiveLineNumberStart),\n\t\t\t\t\t\ttabSize: 2,\n\t\t\t\t\t\tMozTabSize: 2,\n\t\t\t\t\t} as ComponentProps<\"pre\">[\"style\"]\n\t\t\t\t}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<code\n\t\t\t\t\tclassName=\"text-size-inherit block min-w-full w-max\"\n\t\t\t\t\tdangerouslySetInnerHTML={innerHtmlProp}\n\t\t\t\t/>\n\t\t\t</pre>\n\t\t);\n\t},\n);\nCode.displayName = \"CodeBlockCode\";\n\n/**\n * The (optional) header slot of the `CodeBlock`. This is where\n * `CodeBlock.Icon` and `CodeBlock.Title` are rendered.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Header = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\"> & WithAsChild>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tdata-slot=\"code-block-header\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nHeader.displayName = \"CodeBlockHeader\";\n\n/**\n * The (optional) title of the `CodeBlock`. Renders as `h3` by default;\n * use `asChild` to render a different element.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst Title = forwardRef<\n\tHTMLHeadingElement,\n\tHTMLAttributes<HTMLHeadingElement> & { asChild?: boolean }\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"h3\";\n\treturn (\n\t\t<Component\n\t\t\tdata-slot=\"code-block-title\"\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"text-mono m-0 font-mono font-normal\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nTitle.displayName = \"CodeBlockTitle\";\n\ntype CodeBlockCopyButtonProps = Omit<ComponentProps<\"button\">, \"children\" | \"type\"> &\n\tSelfClosingWithAsChild & {\n\t\t/**\n\t\t * The accessible label for the copy button. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.\n\t\t *\n\t\t * @default \"Copy code\"\n\t\t */\n\t\tlabel?: string;\n\t\t/**\n\t\t * Callback fired when the copy button is clicked, passes the copied text as an argument.\n\t\t */\n\t\tonCopy?: (value: string) => void;\n\t\t/**\n\t\t * Callback fired when an error occurs during copying.\n\t\t */\n\t\tonCopyError?: (error: unknown) => void;\n\t};\n\n/**\n * The (optional) copy button of the `CodeBlock`. Copies the code content\n * to the clipboard when clicked.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst CopyButton = forwardRef<ComponentRef<\"button\">, CodeBlockCopyButtonProps>(\n\t({ className, label = \"Copy code\", onCopy, onCopyError, onClick, ...props }, ref) => {\n\t\tconst { copyTextRef } = useCodeBlockContext();\n\t\tconst copyToClipboard = useCopyToClipboard();\n\t\tconst [wasCopied, setWasCopied] = useState(false);\n\t\tconst timeoutHandle = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"code-block-copy-button\"\n\t\t\t\tclassName=\"absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-card\"\n\t\t\t>\n\t\t\t\t<IconButton\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tappearance=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tlabel={label}\n\t\t\t\t\ticon={wasCopied ? <CheckIcon /> : <CopyIcon />}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tonClick={async (event) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonClick?.(event);\n\t\t\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst text = copyTextRef.current;\n\t\t\t\t\t\t\tawait copyToClipboard(text);\n\t\t\t\t\t\t\tonCopy?.(text);\n\t\t\t\t\t\t\tsetWasCopied(true);\n\t\t\t\t\t\t\tif (timeoutHandle.current != null) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutHandle.current);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttimeoutHandle.current = setTimeout(() => {\n\t\t\t\t\t\t\t\tsetWasCopied(false);\n\t\t\t\t\t\t\t}, 2000);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tonCopyError?.(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</span>\n\t\t);\n\t},\n);\nCopyButton.displayName = \"CodeBlockCopyButton\";\n\ntype CodeBlockExpanderButtonProps = Omit<\n\tComponentProps<\"button\">,\n\t\"children\" | \"aria-controls\" | \"aria-expanded\"\n> &\n\tWithAsChild;\n\n/**\n * The (optional) expander button of the `CodeBlock`. Toggles the expanded\n * state of the code block. When present, the code block is collapsible.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nconst ExpanderButton = forwardRef<ComponentRef<\"button\">, CodeBlockExpanderButtonProps>(\n\t({ asChild = false, className, onClick, ...props }, ref) => {\n\t\tconst { codeId, isCodeExpanded, setIsCodeExpanded, setHasCodeExpander } = useCodeBlockContext();\n\n\t\tuseEffect(() => {\n\t\t\tsetHasCodeExpander(true);\n\t\t\treturn () => {\n\t\t\t\tsetHasCodeExpander(false);\n\t\t\t};\n\t\t}, [setHasCodeExpander]);\n\n\t\tconst Component = asChild ? Slot : \"button\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t{...props}\n\t\t\t\tdata-slot=\"code-block-expander-button\"\n\t\t\t\taria-controls={codeId}\n\t\t\t\taria-expanded={isCodeExpanded}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-card px-4 py-2 font-sans text-gray-700 hover:bg-gray-100\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tsetIsCodeExpanded((prev) => !prev);\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isCodeExpanded ? \"Show less\" : \"Show more\"}{\" \"}\n\t\t\t\t<MantleIcon\n\t\t\t\t\tsvg={<CaretDownIcon weight=\"bold\" />}\n\t\t\t\t\tclassName={cx(\"size-4\", isCodeExpanded && \"rotate-180\", \"transition-all duration-150\")}\n\t\t\t\t/>\n\t\t\t</Component>\n\t\t);\n\t},\n);\nExpanderButton.displayName = \"CodeBlockExpanderButton\";\n\ntype CodeBlockIconProps = Omit<SvgAttributes, \"children\"> &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * A custom icon SVG to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tsvg: ReactNode;\n\t\t\t\t/**\n\t\t\t\t * A preset icon to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tpreset?: undefined | never;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * A custom icon SVG to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tsvg?: undefined | never;\n\t\t\t\t/**\n\t\t\t\t * A preset icon to display in the code block header.\n\t\t\t\t * (Pass only one of `svg` or `preset`.)\n\t\t\t\t */\n\t\t\t\tpreset: Mode;\n\t\t }\n\t);\n\n/**\n * A small icon for the `CodeBlock` header. Pass either a custom `svg`\n * or a `preset` value (not both).\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n * ```\n */\nfunction CodeBlockIconComponent({\n\tclassName,\n\tpreset,\n\tsvg: _svgProp,\n\t...props\n}: CodeBlockIconProps) {\n\tlet svg = _svgProp;\n\tif (preset != null) {\n\t\tswitch (preset) {\n\t\t\tcase \"file\":\n\t\t\t\tsvg = <FileTextIcon weight=\"fill\" />;\n\t\t\t\tbreak;\n\t\t\tcase \"cli\":\n\t\t\t\tsvg = <TerminalIcon weight=\"fill\" />;\n\t\t\t\tbreak;\n\t\t\tcase \"traffic-policy\":\n\t\t\t\tsvg = <TrafficPolicyFileIcon />;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn <MantleIcon data-slot=\"code-block-icon\" className={className} svg={svg} {...props} />;\n}\nCodeBlockIconComponent.displayName = \"CodeBlockIcon\";\n\ntype CodeBlockTabListProps = Omit<ComponentProps<typeof RadixTabsList>, \"asChild\" | \"loop\">;\n\n/**\n * A tab list for the `CodeBlock` header. Renders pill-styled tab triggers\n * that switch which code is displayed. Built on Radix Tabs primitives.\n *\n * Place this inside `CodeBlock.Header` and pair with `CodeBlock.TabContent`\n * in `CodeBlock.Body` to conditionally render code based on the active tab.\n * Tab state is managed by `CodeBlock.Root` via `defaultTab` / `activeTab` / `onActiveTabChange`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Root defaultTab=\"yml\">\n * <CodeBlock.Header>\n * <CodeBlock.TabList>\n * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n * </CodeBlock.TabList>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.TabContent value=\"yml\">\n * <CodeBlock.Code value={ymlValue} />\n * </CodeBlock.TabContent>\n * <CodeBlock.TabContent value=\"json\">\n * <CodeBlock.Code value={jsonValue} />\n * </CodeBlock.TabContent>\n * </CodeBlock.Body>\n * </CodeBlock.Root>\n * ```\n */\nconst TabList = forwardRef<ComponentRef<typeof RadixTabsList>, CodeBlockTabListProps>(\n\t({ className, ...props }, ref) => (\n\t\t<RadixTabsList\n\t\t\tdata-slot=\"code-block-tab-list\"\n\t\t\tclassName={cx(\"flex items-center gap-1\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTabList.displayName = \"CodeBlockTabList\";\n\ntype CodeBlockTabTriggerProps = Omit<ComponentProps<typeof RadixTabsTrigger>, \"asChild\">;\n\n/**\n * A pill-styled tab trigger for the `CodeBlock` header.\n * Must be rendered within a `CodeBlock.TabList`.\n *\n * @example\n * ```tsx\n * <CodeBlock.TabList>\n * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n * </CodeBlock.TabList>\n * ```\n */\nconst TabTrigger = forwardRef<ComponentRef<typeof RadixTabsTrigger>, CodeBlockTabTriggerProps>(\n\t({ className, ...props }, ref) => (\n\t\t<RadixTabsTrigger\n\t\t\tdata-slot=\"code-block-tab-trigger\"\n\t\t\tclassName={cx(\n\t\t\t\t\"cursor-pointer rounded px-1.5 py-0.5 text-xs font-medium\",\n\t\t\t\t\"text-gray-600 outline-hidden\",\n\t\t\t\t\"hover:text-gray-900\",\n\t\t\t\t\"data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong\",\n\t\t\t\t\"focus-visible:ring-focus-accent focus-visible:ring-4\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTabTrigger.displayName = \"CodeBlockTabTrigger\";\n\ntype CodeBlockTabContentProps = Omit<\n\tComponentProps<typeof RadixTabsContent>,\n\t\"asChild\" | \"forceMount\"\n>;\n\n/**\n * Conditionally renders its children when the associated tab is active.\n * Pair with `CodeBlock.TabList` and `CodeBlock.TabTrigger` in the header,\n * and set `defaultTab` / `activeTab` on `CodeBlock.Root`.\n *\n * @example\n * ```tsx\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.TabContent value=\"yml\">\n * <CodeBlock.Code value={ymlValue} />\n * </CodeBlock.TabContent>\n * <CodeBlock.TabContent value=\"json\">\n * <CodeBlock.Code value={jsonValue} />\n * </CodeBlock.TabContent>\n * </CodeBlock.Body>\n * ```\n */\nconst TabContent = forwardRef<ComponentRef<typeof RadixTabsContent>, CodeBlockTabContentProps>(\n\t(props, ref) => <RadixTabsContent data-slot=\"code-block-tab-content\" ref={ref} {...props} />,\n);\nTabContent.displayName = \"CodeBlockTabContent\";\n\n/**\n * Shiki-powered code blocks with build-time syntax highlighting and zero browser bundle.\n *\n * Use `mantleCodeBlockPlugins()` to enable pre-rendering at build time.\n *\n * @example\n * Composition:\n * ```\n * # Standard\n * CodeBlock.Root\n * ├── CodeBlock.Header\n * │ ├── CodeBlock.Icon\n * │ └── CodeBlock.Title\n * ├── CodeBlock.Body\n * │ ├── CodeBlock.CopyButton\n * │ └── CodeBlock.Code\n * └── CodeBlock.ExpanderButton\n *\n * # Tabbed\n * CodeBlock.Root\n * ├── CodeBlock.Header\n * │ └── CodeBlock.TabList\n * │ └── CodeBlock.TabTrigger\n * ├── CodeBlock.Body\n * │ ├── CodeBlock.CopyButton\n * │ └── CodeBlock.TabContent\n * │ └── CodeBlock.Code\n * └── CodeBlock.ExpanderButton\n * ```\n *\n * @example\n * ```tsx\n * <CodeBlock.Root>\n * <CodeBlock.Header>\n * <CodeBlock.Icon preset=\"file\" />\n * <CodeBlock.Title>example.ts</CodeBlock.Title>\n * </CodeBlock.Header>\n * <CodeBlock.Body>\n * <CodeBlock.CopyButton />\n * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n * </CodeBlock.Body>\n * <CodeBlock.ExpanderButton />\n * </CodeBlock.Root>\n *\n * // Server-highlighted HTML fetched via an action route + React Query mutation\n * const highlightMutation = useMutation({\n * mutationFn: async () => {\n * const response = await fetch(\"/api/shiki-highlight\", {\n * method: \"POST\",\n * headers: { \"Content-Type\": \"application/json\" },\n * body: JSON.stringify({ code: source, language: \"typescript\" }),\n * });\n * return response.json();\n * },\n * });\n *\n * const serverValue = createMantleCodeBlockValue({\n * language: \"typescript\",\n * code: source,\n * preHtml: highlightMutation.data?.html,\n * });\n * ```\n */\nconst CodeBlock = {\n\t/**\n\t * The root component of the `CodeBlock`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * The body of the `CodeBlock`. Contains `Code` and optional `CopyButton`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tBody,\n\t/**\n\t * The code content. Renders pre-highlighted Shiki HTML when the Vite plugin is active.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tCode,\n\t/**\n\t * The optional copy button.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tCopyButton,\n\t/**\n\t * The optional expander button for collapsible code blocks.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tExpanderButton,\n\t/**\n\t * The optional header slot for icon and title.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tHeader,\n\t/**\n\t * A small icon for the code block header. Use `preset` or `svg`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tIcon: CodeBlockIconComponent,\n\t/**\n\t * Conditionally renders children when the associated tab is active.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabContent,\n\t/**\n\t * A tab list for the code block header. Renders pill-styled tabs for switching code.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabList,\n\t/**\n\t * A pill-styled tab trigger for the code block header. Must be inside `TabList`.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root defaultTab=\"yml\">\n\t * <CodeBlock.Header>\n\t * <CodeBlock.TabList>\n\t * <CodeBlock.TabTrigger value=\"yml\">policy.yml</CodeBlock.TabTrigger>\n\t * <CodeBlock.TabTrigger value=\"json\">policy.json</CodeBlock.TabTrigger>\n\t * </CodeBlock.TabList>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.TabContent value=\"yml\">\n\t * <CodeBlock.Code value={ymlValue} />\n\t * </CodeBlock.TabContent>\n\t * <CodeBlock.TabContent value=\"json\">\n\t * <CodeBlock.Code value={jsonValue} />\n\t * </CodeBlock.TabContent>\n\t * </CodeBlock.Body>\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTabTrigger,\n\t/**\n\t * The optional title rendered in the header.\n\t *\n\t * @example\n\t * ```tsx\n\t * <CodeBlock.Root>\n\t * <CodeBlock.Header>\n\t * <CodeBlock.Icon preset=\"file\" />\n\t * <CodeBlock.Title>example.ts</CodeBlock.Title>\n\t * </CodeBlock.Header>\n\t * <CodeBlock.Body>\n\t * <CodeBlock.CopyButton />\n\t * <CodeBlock.Code value={mantleCode(\"typescript\")`const x = \"hello\";`} />\n\t * </CodeBlock.Body>\n\t * <CodeBlock.ExpanderButton />\n\t * </CodeBlock.Root>\n\t * ```\n\t */\n\tTitle,\n} as const;\n\nexport {\n\t//,\n\tCodeBlock,\n};\n","/**\n * Returns `true` if `value` has more than `maxLines` newline-delimited lines.\n *\n * This is equivalent to `value.split(\"\\\\n\").length > maxLines`, but avoids\n * allocating an intermediate array and can early-return once the threshold is exceeded.\n */\nfunction hasMoreThanNLines(value: string, maxLines: number): boolean {\n\tlet lines = 1;\n\tif (lines > maxLines) {\n\t\treturn true;\n\t}\n\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (value[i] === \"\\n\") {\n\t\t\tlines += 1;\n\t\t\tif (lines > maxLines) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nexport {\n\t//,\n\thasMoreThanNLines,\n};\n"],"mappings":"goCAmBA,SAAS,EAAW,EAAuB,CAC1C,IAAI,EAAwB,GAC5B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IAAK,CACtC,IAAM,EAAY,EAAM,GACxB,GACC,IAAc,KACd,IAAc,KACd,IAAc,KACd,IAAc,KACd,IAAc,IACb,CACD,EAAwB,EACxB,KACD,CACD,CAEA,GAAI,IAA0B,GAC7B,OAAO,EAGR,IAAI,EAAU,EAAM,MAAM,EAAG,CAAqB,EAClD,IAAK,IAAI,EAAI,EAAuB,EAAI,EAAM,OAAQ,IAAK,CAC1D,IAAM,EAAY,EAAM,GACxB,OAAQ,EAAR,CACC,IAAK,IACJ,GAAW,QACX,MACD,IAAK,IACJ,GAAW,OACX,MACD,IAAK,IACJ,GAAW,OACX,MACD,IAAK,IACJ,GAAW,SACX,MACD,IAAK,IACJ,GAAW,QACX,MACD,QACC,GAAW,CACb,CACD,CACA,OAAO,CACR,CCjCA,MAAM,EAAsB,IAAI,QAMhC,SAAS,EAAoB,EAA+C,CAC3E,IAAM,EAAM,IAAI,IAChB,GAAI,GAAS,MAAQ,IAAU,GAC9B,OAAO,EAER,IAAK,IAAM,KAAQ,EAAM,MAAM,GAAG,EAC7B,IAAS,IACZ,EAAI,IAAI,CAAI,EAGd,OAAO,CACR,CAWA,SAAS,GAAgB,E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yBzB,MAAM,EAAa,GACjB,EAAO,IAAQ,EAACC,GAAD,CAAkB,YAAU,yBAA8B,MAAK,GAAI,CAAQ,CAAA,CAC5F,EACA,EAAW,YAAc,sBAiEzB,MAAM,GAAY,CAmBjB,KAAA,EAmBA,OAmBA,OAmBA,aAmBA,iBAmBA,SAmBA,KAAM,EAyBN,aAyBA,UAyBA,cAmBA,OACD,EC9mCA,SAAS,GAAkB,EAAe,EAA2B,CACpE,IAAI,EAAQ,EACZ,GAAI,EAAQ,EACX,MAAO,GAGR,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IACjC,GAAI,EAAM,KAAO;IAChB,GAAS,EACL,EAAQ,GACX,MAAO,GAIV,MAAO,EACR"}
@@ -1,2 +1,2 @@
1
- import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, R as DecorateHighlightedHtmlInput, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, b as defaultShowLineNumbers, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, j as FoldToken, k as FoldScope, m as parseCodeBlockHighlightLines, p as tokenizeMetastring, u as normalizeValue, w as inferIndentation, z as decorateHighlightedHtml } from "./resolve-pre-rendered-props-BONSCwYA.js";
1
+ import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, R as DecorateHighlightedHtmlInput, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, b as defaultShowLineNumbers, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, j as FoldToken, k as FoldScope, m as parseCodeBlockHighlightLines, p as tokenizeMetastring, u as normalizeValue, w as inferIndentation, z as decorateHighlightedHtml } from "./resolve-pre-rendered-props-DxJ9-DAl.js";
2
2
  export { type ComputeFoldRangesInput, type DecorateHighlightedHtmlInput, type FoldExplanation, type FoldLine, type FoldScope, type FoldStrategy, type FoldToken, type FoldableRange, type Indentation, type LineRange, type SupportedLanguage, computeFoldRanges, computeJsonFoldRanges, decorateHighlightedHtml, defaultShowLineNumbers, finalizeFoldRanges, foldStrategyFor, inferIndentation, isIndentation, isSupportedLanguage, normalizeIndentation, normalizeValue, parseCodeBlockHighlightLines, parseCodeBlockLineNumberStart, parseCodeBlockShowLineNumbers, parseLanguage, supportedLanguages, tokenizeMetastring };
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,n as l,o as u,p as d,s as f,u as p,v as m,x as h,y as g}from"./resolve-pre-rendered-props-BfWe69-w.js";export{o as computeFoldRanges,e as computeJsonFoldRanges,g as decorateHighlightedHtml,h as defaultShowLineNumbers,m as finalizeFoldRanges,a as foldStrategyFor,d as inferIndentation,c as isIndentation,s as isSupportedLanguage,i as normalizeIndentation,l as normalizeValue,u as parseCodeBlockHighlightLines,f as parseCodeBlockLineNumberStart,n as parseCodeBlockShowLineNumbers,p as parseLanguage,r as supportedLanguages,t as tokenizeMetastring};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,n as l,o as u,p as d,s as f,u as p,v as m,x as h,y as g}from"./resolve-pre-rendered-props-C-vrNxH1.js";export{o as computeFoldRanges,e as computeJsonFoldRanges,g as decorateHighlightedHtml,h as defaultShowLineNumbers,m as finalizeFoldRanges,a as foldStrategyFor,d as inferIndentation,c as isIndentation,s as isSupportedLanguage,i as normalizeIndentation,l as normalizeValue,u as parseCodeBlockHighlightLines,f as parseCodeBlockLineNumberStart,n as parseCodeBlockShowLineNumbers,p as parseLanguage,r as supportedLanguages,t as tokenizeMetastring};
package/dist/code.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { t as WithAsChild } from "./as-child-CpZKMqTE.js";
2
- import * as _$react from "react";
1
+ import { t as WithAsChild } from "./as-child-uN_018tj.js";
3
2
 
4
3
  //#region src/components/code/code.d.ts
5
4
  /**
@@ -35,7 +34,7 @@ import * as _$react from "react";
35
34
  * </Code>
36
35
  * ```
37
36
  */
38
- declare const Code: _$react.ForwardRefExoticComponent<Omit<_$react.ClassAttributes<HTMLElement> & _$react.HTMLAttributes<HTMLElement> & WithAsChild, "ref"> & _$react.RefAttributes<HTMLElement>>;
37
+ declare const Code: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLElement>>;
39
38
  //#endregion
40
39
  export { Code };
41
40
  //# sourceMappingURL=code.d.ts.map
package/dist/code.js CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./slot-D_ZUrdEW.js";import{forwardRef as n}from"react";import{jsx as r}from"react/jsx-runtime";const i=n(({asChild:n,className:i,...a},o)=>r(n?t:`code`,{ref:o,"data-slot":`code`,className:e(`border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]`,i),...a}));i.displayName=`Code`;export{i as Code};
1
+ import{t as e}from"./cx-CBSnSC36.js";import{t}from"./slot-CV5fmqFr.js";import{forwardRef as n}from"react";import{jsx as r}from"react/jsx-runtime";const i=n(({asChild:n,className:i,...a},o)=>r(n?t:`code`,{ref:o,"data-slot":`code`,className:e(`border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]`,i),...a}));i.displayName=`Code`;export{i as Code};
2
2
  //# sourceMappingURL=code.js.map
package/dist/code.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"code.js","names":[],"sources":["../src/components/code/code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentProps, ComponentRef } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Slot } from \"../slot/index.js\";\n\n/**\n * Marks a short fragment of inline computer code — a function name, a\n * variable, a CLI flag, a key. Renders a native `<code>` element with\n * mantle's monospace styling.\n *\n * **When to use**\n * - Inline within prose to identify code, file paths, env vars, or keys.\n * - Wrap technical terms that should visually stand apart from running text.\n *\n * **When not to use**\n * - For multi-line or syntax-highlighted blocks. Use {@link https://mantle.ngrok.com/components/code-block CodeBlock} instead.\n * - For keyboard shortcuts. Use {@link https://mantle.ngrok.com/components/kbd Kbd}.\n * - For arbitrary monospace text that isn't code (use a plain monospace utility class).\n *\n * **Polymorphism.** Pass `asChild` to render `Code` styling on a different\n * element (e.g. a link wrapping a code-styled label).\n *\n * @see https://mantle.ngrok.com/components/code\n *\n * @example\n * ```tsx\n * import { Code } from \"@ngrok/mantle/code\";\n *\n * <p>\n * Use the <Code>console.log()</Code> function to debug your code.\n * </p>\n *\n * // As a link, preserving Code styling.\n * <Code asChild>\n * <a href=\"/api\">/api/components.json</a>\n * </Code>\n * ```\n */\nconst Code = forwardRef<ComponentRef<\"code\">, ComponentProps<\"code\"> & WithAsChild>(\n\t({ asChild, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"code\";\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tref={ref}\n\t\t\t\tdata-slot=\"code\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nCode.displayName = \"Code\";\n\nexport {\n\t//,\n\tCode,\n};\n"],"mappings":"kJAuCA,MAAM,EAAO,GACX,CAAE,UAAS,YAAW,GAAG,GAAS,IAGjC,EAFY,EAAU,EAAO,OAE7B,CACM,MACL,YAAU,OACV,UAAW,EACV,iFACA,EACA,CACD,GAAI,EACH,CAAA,CAGJ,CACD,EAAK,YAAc"}
1
+ {"version":3,"file":"code.js","names":[],"sources":["../src/components/code/code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentProps, ComponentRef } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Slot } from \"../slot/index.js\";\n\n/**\n * Marks a short fragment of inline computer code — a function name, a\n * variable, a CLI flag, a key. Renders a native `<code>` element with\n * mantle's monospace styling.\n *\n * **When to use**\n * - Inline within prose to identify code, file paths, env vars, or keys.\n * - Wrap technical terms that should visually stand apart from running text.\n *\n * **When not to use**\n * - For multi-line or syntax-highlighted blocks. Use {@link https://mantle.ngrok.com/components/code-block CodeBlock} instead.\n * - For keyboard shortcuts. Use {@link https://mantle.ngrok.com/components/kbd Kbd}.\n * - For arbitrary monospace text that isn't code (use a plain monospace utility class).\n *\n * **Polymorphism.** Pass `asChild` to render `Code` styling on a different\n * element (e.g. a link wrapping a code-styled label).\n *\n * @see https://mantle.ngrok.com/components/code\n *\n * @example\n * ```tsx\n * import { Code } from \"@ngrok/mantle/code\";\n *\n * <p>\n * Use the <Code>console.log()</Code> function to debug your code.\n * </p>\n *\n * // As a link, preserving Code styling.\n * <Code asChild>\n * <a href=\"/api\">/api/components.json</a>\n * </Code>\n * ```\n */\nconst Code = forwardRef<ComponentRef<\"code\">, ComponentProps<\"code\"> & WithAsChild>(\n\t({ asChild, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"code\";\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tref={ref}\n\t\t\t\tdata-slot=\"code\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"border-gray-500/15 rounded-md border bg-gray-500/5 px-1 font-mono text-[0.8em]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nCode.displayName = \"Code\";\n\nexport {\n\t//,\n\tCode,\n};\n"],"mappings":"kJAuCA,MAAM,EAAO,GACX,CAAE,UAAS,YAAW,GAAG,GAAS,IAGjC,EAFY,EAAU,EAAO,OAE7B,CACM,MACL,YAAU,OACV,UAAW,EACV,iFACA,CACD,EACA,GAAI,CACJ,CAAA,CAGJ,EACA,EAAK,YAAc"}
package/dist/color.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as functionalColors, c as isNamedColor, i as colors, l as namedColors, n as FunctionalColor, o as isColor, r as NamedColor, s as isFunctionalColor, t as Color } from "./index-DS_4n2eb.js";
2
- export { Color, FunctionalColor, NamedColor, colors, functionalColors, isColor, isFunctionalColor, isNamedColor, namedColors };
1
+ import { a as functionalColors, c as isNamedColor, i as colors, l as namedColors, n as FunctionalColor, o as isColor, r as NamedColor, s as isFunctionalColor, t as Color } from "./index-DorCusfG.js";
2
+ export { type Color, type FunctionalColor, type NamedColor, colors, functionalColors, isColor, isFunctionalColor, isNamedColor, namedColors };
package/dist/color.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","names":[],"sources":["../src/utils/color/colors.ts"],"sourcesContent":["/**\n * Color palette named colors\n */\nconst namedColors = [\n\t\"amber\",\n\t\"blue\",\n\t\"cyan\",\n\t\"emerald\",\n\t\"fuchsia\",\n\t\"gray\",\n\t\"green\",\n\t\"indigo\",\n\t\"lime\",\n\t\"orange\",\n\t\"pink\",\n\t\"purple\",\n\t\"red\",\n\t\"rose\",\n\t\"sky\",\n\t\"teal\",\n\t\"violet\",\n\t\"yellow\",\n] as const;\n\n/**\n * A named color from the color palette\n */\ntype NamedColor = (typeof namedColors)[number];\n\n/**\n * Check if a value is a color from the color palette\n */\nconst isNamedColor = (value: unknown): value is NamedColor =>\n\ttypeof value === \"string\" && namedColors.includes(value as NamedColor);\n\n/**\n * Functional named colors\n */\nconst functionalColors = [\n\t\"important\",\n\t\"info\",\n\t\"accent\",\n\t\"danger\",\n\t\"neutral\",\n\t\"success\",\n\t\"warning\",\n] as const;\n\n/**\n * A functional color\n */\ntype FunctionalColor = (typeof functionalColors)[number];\n\n/**\n * Check if a value is a color from the functional colors\n */\nconst isFunctionalColor = (value: unknown): value is FunctionalColor =>\n\ttypeof value === \"string\" && functionalColors.includes(value as FunctionalColor);\n\n/**\n * All named mantle colors\n */\nconst colors = [...namedColors, ...functionalColors] as const;\n\n/**\n * A named mantle color\n */\ntype Color = (typeof colors)[number];\n\n/**\n * Check if a value is a named mantle color\n */\nconst isColor = (value: unknown): value is Color =>\n\ttypeof value === \"string\" && colors.includes(value as Color);\n\n// MARK: - Exports\n\nexport { colors, functionalColors, isColor, isFunctionalColor, isNamedColor, namedColors };\n\nexport type { Color, FunctionalColor, NamedColor };\n"],"mappings":"AAGA,MAAM,EAAc,CACnB,QACA,OACA,OACA,UACA,UACA,OACA,QACA,SACA,OACA,SACA,OACA,SACA,MACA,OACA,MACA,OACA,SACA,SACA,CAUK,EAAgB,GACrB,OAAO,GAAU,UAAY,EAAY,SAAS,EAAoB,CAKjE,EAAmB,CACxB,YACA,OACA,SACA,SACA,UACA,UACA,UACA,CAUK,EAAqB,GAC1B,OAAO,GAAU,UAAY,EAAiB,SAAS,EAAyB,CAK3E,EAAS,CAAC,GAAG,EAAa,GAAG,EAAiB,CAU9C,EAAW,GAChB,OAAO,GAAU,UAAY,EAAO,SAAS,EAAe"}
1
+ {"version":3,"file":"color.js","names":[],"sources":["../src/utils/color/colors.ts"],"sourcesContent":["/**\n * Color palette named colors\n */\nconst namedColors = [\n\t\"amber\",\n\t\"blue\",\n\t\"cyan\",\n\t\"emerald\",\n\t\"fuchsia\",\n\t\"gray\",\n\t\"green\",\n\t\"indigo\",\n\t\"lime\",\n\t\"orange\",\n\t\"pink\",\n\t\"purple\",\n\t\"red\",\n\t\"rose\",\n\t\"sky\",\n\t\"teal\",\n\t\"violet\",\n\t\"yellow\",\n] as const;\n\n/**\n * A named color from the color palette\n */\ntype NamedColor = (typeof namedColors)[number];\n\n/**\n * Check if a value is a color from the color palette\n */\nconst isNamedColor = (value: unknown): value is NamedColor =>\n\ttypeof value === \"string\" && namedColors.includes(value as NamedColor);\n\n/**\n * Functional named colors\n */\nconst functionalColors = [\n\t\"important\",\n\t\"info\",\n\t\"accent\",\n\t\"danger\",\n\t\"neutral\",\n\t\"success\",\n\t\"warning\",\n] as const;\n\n/**\n * A functional color\n */\ntype FunctionalColor = (typeof functionalColors)[number];\n\n/**\n * Check if a value is a color from the functional colors\n */\nconst isFunctionalColor = (value: unknown): value is FunctionalColor =>\n\ttypeof value === \"string\" && functionalColors.includes(value as FunctionalColor);\n\n/**\n * All named mantle colors\n */\nconst colors = [...namedColors, ...functionalColors] as const;\n\n/**\n * A named mantle color\n */\ntype Color = (typeof colors)[number];\n\n/**\n * Check if a value is a named mantle color\n */\nconst isColor = (value: unknown): value is Color =>\n\ttypeof value === \"string\" && colors.includes(value as Color);\n\n// MARK: - Exports\n\nexport { colors, functionalColors, isColor, isFunctionalColor, isNamedColor, namedColors };\n\nexport type { Color, FunctionalColor, NamedColor };\n"],"mappings":"AAGA,MAAM,EAAc,CACnB,QACA,OACA,OACA,UACA,UACA,OACA,QACA,SACA,OACA,SACA,OACA,SACA,MACA,OACA,MACA,OACA,SACA,QACD,EAUM,EAAgB,GACrB,OAAO,GAAU,UAAY,EAAY,SAAS,CAAmB,EAKhE,EAAmB,CACxB,YACA,OACA,SACA,SACA,UACA,UACA,SACD,EAUM,EAAqB,GAC1B,OAAO,GAAU,UAAY,EAAiB,SAAS,CAAwB,EAK1E,EAAS,CAAC,GAAG,EAAa,GAAG,CAAgB,EAU7C,EAAW,GAChB,OAAO,GAAU,UAAY,EAAO,SAAS,CAAc"}