themelia-react-ui 2.0.3 → 2.0.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 (421) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +65 -28
  3. package/dist/{accordion-Cjb6sx0G.js → accordion-96o0pN62.js} +5 -5
  4. package/dist/{accordion-Cjb6sx0G.js.map → accordion-96o0pN62.js.map} +1 -1
  5. package/dist/action-menu-CHgs8vmj.js +281 -0
  6. package/dist/action-menu-CHgs8vmj.js.map +1 -0
  7. package/dist/{affordance-geometry.generated-tF36bREk.js → affordance-geometry.generated-B8yGOr8-.js} +7 -1
  8. package/dist/affordance-geometry.generated-B8yGOr8-.js.map +1 -0
  9. package/dist/{ai-artifact-DvTwDVyL.js → ai-artifact-BZUGwBq6.js} +277 -276
  10. package/dist/ai-artifact-BZUGwBq6.js.map +1 -0
  11. package/dist/{app-shell-C4FhvCqF.js → app-shell-D63ATkIK.js} +84 -83
  12. package/dist/app-shell-D63ATkIK.js.map +1 -0
  13. package/dist/{attachment-BxDfL2mw.js → attachment-DkoqHPPl.js} +7 -7
  14. package/dist/{attachment-BxDfL2mw.js.map → attachment-DkoqHPPl.js.map} +1 -1
  15. package/dist/{auth-BGua8ouh.js → auth-D2FVZ1MH.js} +10 -10
  16. package/dist/{auth-BGua8ouh.js.map → auth-D2FVZ1MH.js.map} +1 -1
  17. package/dist/{avatar-DAPlDvhJ.js → avatar-DWO_HHhB.js} +5 -5
  18. package/dist/{avatar-DAPlDvhJ.js.map → avatar-DWO_HHhB.js.map} +1 -1
  19. package/dist/{badge-HpFqoqSY.js → badge-DErMA7ul.js} +4 -4
  20. package/dist/{badge-HpFqoqSY.js.map → badge-DErMA7ul.js.map} +1 -1
  21. package/dist/base/accordion.js +1 -1
  22. package/dist/base/action-menu.js +1 -1
  23. package/dist/base/attachment.js +1 -1
  24. package/dist/base/avatar.js +1 -1
  25. package/dist/base/badge.js +1 -1
  26. package/dist/base/batch-action-bar.js +1 -1
  27. package/dist/base/buttons.js +1 -1
  28. package/dist/base/cards.js +2 -2
  29. package/dist/base/carousel.js +3 -3
  30. package/dist/base/cascader.js +13 -13
  31. package/dist/base/chart.js +1 -1
  32. package/dist/base/choice-inputs.js +2 -2
  33. package/dist/base/code-block.js +1 -1
  34. package/dist/base/combobox.js +1 -1
  35. package/dist/base/command.js +1 -1
  36. package/dist/base/copyable.js +1 -1
  37. package/dist/base/date-pickers.js +2 -2
  38. package/dist/base/display.js +6 -6
  39. package/dist/base/feedback.js +3 -3
  40. package/dist/base/forms-numeric.js +1 -1
  41. package/dist/base/forms.js +3 -3
  42. package/dist/base/inline-edit.js +10 -10
  43. package/dist/base/item.js +1 -1
  44. package/dist/base/media-gallery.js +1 -1
  45. package/dist/base/metadata-list.js +1 -1
  46. package/dist/base/navigation.js +6 -6
  47. package/dist/base/popover-menu.js +1 -1
  48. package/dist/base/popover.js +1 -1
  49. package/dist/base/qr-code.js +1 -1
  50. package/dist/base/repeaters.js +9 -9
  51. package/dist/base/sheet.js +1 -1
  52. package/dist/base/sidebar.js +1 -1
  53. package/dist/base/signature-pad.js +6 -6
  54. package/dist/base/skeleton.js +1 -1
  55. package/dist/base/spinner.js +4 -4
  56. package/dist/base/structure.js +1 -1
  57. package/dist/base/table.js +1 -1
  58. package/dist/base/text-inputs.js +2 -2
  59. package/dist/base/toaster.js +3 -3
  60. package/dist/base/tree.js +1 -1
  61. package/dist/base/upload-queue.js +1 -1
  62. package/dist/base/upload.js +3 -3
  63. package/dist/base/value-inputs.js +1 -1
  64. package/dist/{batch-action-bar-DnUJ21NQ.js → batch-action-bar-CdfIkCsV.js} +4 -4
  65. package/dist/{batch-action-bar-DnUJ21NQ.js.map → batch-action-bar-CdfIkCsV.js.map} +1 -1
  66. package/dist/blocks/admin.js +20 -20
  67. package/dist/blocks/admin.js.map +1 -1
  68. package/dist/blocks/ai.js +15 -15
  69. package/dist/blocks/analytics/usage-card.js +1 -1
  70. package/dist/blocks/analytics.js +17 -17
  71. package/dist/blocks/analytics.js.map +1 -1
  72. package/dist/blocks/collaboration.js +1 -1
  73. package/dist/blocks/commerce/receipt.js +1 -1
  74. package/dist/blocks/commerce.js +570 -567
  75. package/dist/blocks/commerce.js.map +1 -1
  76. package/dist/blocks/data-display.js +2 -2
  77. package/dist/blocks/onboarding.js +5 -5
  78. package/dist/blocks/planning.js +11 -11
  79. package/dist/blocks/timelines.js +1 -1
  80. package/dist/{breadcrumbs-C-oqs1sQ.js → breadcrumbs-B-WFKecD.js} +4 -4
  81. package/dist/{breadcrumbs-C-oqs1sQ.js.map → breadcrumbs-B-WFKecD.js.map} +1 -1
  82. package/dist/{button-DVzspB_G.js → button-DkmK-z8E.js} +2 -2
  83. package/dist/{button-DVzspB_G.js.map → button-DkmK-z8E.js.map} +1 -1
  84. package/dist/{buttons-DPZekJFu.js → buttons-BbfzgczK.js} +8 -8
  85. package/dist/{buttons-DPZekJFu.js.map → buttons-BbfzgczK.js.map} +1 -1
  86. package/dist/{cards-BaBZR-AU.js → cards-4JTWqvVe.js} +10 -10
  87. package/dist/cards-4JTWqvVe.js.map +1 -0
  88. package/dist/{chart-ZOYyK2xG.js → chart-C19flDQb.js} +4 -4
  89. package/dist/{chart-ZOYyK2xG.js.map → chart-C19flDQb.js.map} +1 -1
  90. package/dist/{checkbox-AWIhNhmo.js → checkbox-CzYUTPeJ.js} +9 -5
  91. package/dist/checkbox-CzYUTPeJ.js.map +1 -0
  92. package/dist/{choice-inputs-CNHvARCJ.js → choice-inputs-JLtij2y4.js} +182 -176
  93. package/dist/choice-inputs-JLtij2y4.js.map +1 -0
  94. package/dist/{code-block-DeneBJR_.js → code-block-CGNaUtAE.js} +7 -7
  95. package/dist/{code-block-DeneBJR_.js.map → code-block-CGNaUtAE.js.map} +1 -1
  96. package/dist/{collapsible-C-_l4hpy.js → collapsible-Do4G0zcC.js} +3 -3
  97. package/dist/{collapsible-C-_l4hpy.js.map → collapsible-Do4G0zcC.js.map} +1 -1
  98. package/dist/{collection-content-By56pLog.js → collection-content-C0e8SsTm.js} +3 -3
  99. package/dist/{collection-content-By56pLog.js.map → collection-content-C0e8SsTm.js.map} +1 -1
  100. package/dist/{combobox-Dxo2fAYQ.js → combobox-CBJDs6w_.js} +12 -12
  101. package/dist/{combobox-Dxo2fAYQ.js.map → combobox-CBJDs6w_.js.map} +1 -1
  102. package/dist/{combobox-DaHESuiL.js → combobox-hbhSS18O.js} +7 -7
  103. package/dist/{combobox-DaHESuiL.js.map → combobox-hbhSS18O.js.map} +1 -1
  104. package/dist/{command-C25VMRII.js → command-D8NrBj-b.js} +7 -7
  105. package/dist/{command-C25VMRII.js.map → command-D8NrBj-b.js.map} +1 -1
  106. package/dist/{comments-DD0DUPwJ.js → comments-Di4w0H_S.js} +383 -382
  107. package/dist/comments-Di4w0H_S.js.map +1 -0
  108. package/dist/components/base/action-menu/action-menu.d.ts +2 -0
  109. package/dist/components/base/cards/card.recipes.d.ts +12 -5
  110. package/dist/components/base/cards/smart-card.types.d.ts +12 -7
  111. package/dist/components/base/choice-inputs/checkbox.d.ts +7 -2
  112. package/dist/components/base/choice-inputs/switch-card.d.ts +7 -0
  113. package/dist/components/base/choice-inputs/toggle-field.d.ts +7 -0
  114. package/dist/components/base/date-pickers/datepicker.types.d.ts +7 -0
  115. package/dist/components/base/forms/controlled-form-field.d.ts +6 -6
  116. package/dist/components/base/forms/form-field.d.ts +5 -3
  117. package/dist/components/base/forms/index.d.ts +1 -0
  118. package/dist/components/base/forms/server-errors.d.ts +16 -0
  119. package/dist/components/base/forms/workflow.d.ts +5 -2
  120. package/dist/components/base/metadata-list/metadata-list.d.ts +3 -1
  121. package/dist/components/base/navigation/page-header/page-header.d.ts +4 -2
  122. package/dist/components/base/structure/composition.recipes.d.ts +17 -0
  123. package/dist/components/base/text-inputs/hooks/use-form-field-state.d.ts +7 -2
  124. package/dist/components/base/text-inputs/input.d.ts +4 -2
  125. package/dist/components/base/text-inputs/textarea.d.ts +4 -2
  126. package/dist/components/base/value-inputs/date-time-input.d.ts +2 -1
  127. package/dist/components/base/value-inputs/slider.d.ts +5 -1
  128. package/dist/components/base/value-inputs/tags-input.d.ts +5 -1
  129. package/dist/components/typography/text.styles.d.ts +26 -1
  130. package/dist/composition.recipes-COdiFhxB.js +19 -0
  131. package/dist/composition.recipes-COdiFhxB.js.map +1 -0
  132. package/dist/containers-CRmHf7GP.js +104 -0
  133. package/dist/containers-CRmHf7GP.js.map +1 -0
  134. package/dist/{copyable-ClBuk_UK.js → copyable-CnGCZdX4.js} +4 -4
  135. package/dist/{copyable-ClBuk_UK.js.map → copyable-CnGCZdX4.js.map} +1 -1
  136. package/dist/{data-display-DT_khPl_.js → data-display-D4oujtx0.js} +239 -238
  137. package/dist/data-display-D4oujtx0.js.map +1 -0
  138. package/dist/{date-DCrsDTZc.js → date-Q7jnXxpk.js} +5 -5
  139. package/dist/{date-DCrsDTZc.js.map → date-Q7jnXxpk.js.map} +1 -1
  140. package/dist/{date-picker-B2K3ucWn.js → date-picker-zOt1oNss.js} +102 -90
  141. package/dist/date-picker-zOt1oNss.js.map +1 -0
  142. package/dist/date-pickers-cj8IXbDC.js +179 -0
  143. package/dist/date-pickers-cj8IXbDC.js.map +1 -0
  144. package/dist/{display-hAc1HjpI.js → display-BB4BL_-K.js} +8 -8
  145. package/dist/{display-hAc1HjpI.js.map → display-BB4BL_-K.js.map} +1 -1
  146. package/dist/{dropdown-menu-Cl4X7L5S.js → dropdown-menu-CjY8Vt7W.js} +8 -8
  147. package/dist/{dropdown-menu-Cl4X7L5S.js.map → dropdown-menu-CjY8Vt7W.js.map} +1 -1
  148. package/dist/features/activities.js +11 -11
  149. package/dist/features/ai-chat.js +9 -9
  150. package/dist/features/appointment-calendar.js +222 -220
  151. package/dist/features/appointment-calendar.js.map +1 -1
  152. package/dist/features/async-preview.js +8 -8
  153. package/dist/features/combobox.js +1 -1
  154. package/dist/features/comments.js +1 -1
  155. package/dist/features/data-view.js +10 -10
  156. package/dist/features/email-composer.js +275 -274
  157. package/dist/features/email-composer.js.map +1 -1
  158. package/dist/features/event-calendar.js +199 -198
  159. package/dist/features/event-calendar.js.map +1 -1
  160. package/dist/features/filters.js +1 -1
  161. package/dist/features/global-search.js +12 -12
  162. package/dist/features/kanban.js +4 -4
  163. package/dist/features/map.js +7 -7
  164. package/dist/features/media-library.js +623 -622
  165. package/dist/features/media-library.js.map +1 -1
  166. package/dist/features/mentions.js +1 -1
  167. package/dist/features/overlays.js +1 -1
  168. package/dist/features/products.js +973 -969
  169. package/dist/features/products.js.map +1 -1
  170. package/dist/features/questionnaire.js +12 -12
  171. package/dist/features/resource-assignment.js +8 -8
  172. package/dist/features/resource.js +113 -112
  173. package/dist/features/resource.js.map +1 -1
  174. package/dist/features/rich-text-editor.js +2 -2
  175. package/dist/features/schema-form.js +254 -253
  176. package/dist/features/schema-form.js.map +1 -1
  177. package/dist/features/suggestions.js +3 -3
  178. package/dist/features/sync.js +3 -3
  179. package/dist/features/table.js +1 -1
  180. package/dist/features/theme-tweaker.js +19 -19
  181. package/dist/features/theme-tweaker.js.map +1 -1
  182. package/dist/{feedback-BYIhtitP.js → feedback-DZNL5Lg1.js} +9 -9
  183. package/dist/{feedback-BYIhtitP.js.map → feedback-DZNL5Lg1.js.map} +1 -1
  184. package/dist/{field-affordance-recipes-DZhnIL_Y.js → field-affordance-recipes-DjwGx8eM.js} +2 -2
  185. package/dist/{field-affordance-recipes-DZhnIL_Y.js.map → field-affordance-recipes-DjwGx8eM.js.map} +1 -1
  186. package/dist/{filters-DJVAveHA.js → filters-BcT-uoFy.js} +19 -19
  187. package/dist/{filters-DJVAveHA.js.map → filters-BcT-uoFy.js.map} +1 -1
  188. package/dist/{form-field-CwH9y77i.js → form-field-CsgRmdit.js} +14 -8
  189. package/dist/form-field-CsgRmdit.js.map +1 -0
  190. package/dist/{form-sizing-BdP_Mf5p.js → form-sizing-NXgjkmBG.js} +3 -3
  191. package/dist/{form-sizing-BdP_Mf5p.js.map → form-sizing-NXgjkmBG.js.map} +1 -1
  192. package/dist/{forms-B9G_xwzi.js → forms-BV5m5aQF.js} +83 -65
  193. package/dist/forms-BV5m5aQF.js.map +1 -0
  194. package/dist/{forms-numeric-B_jraJaQ.js → forms-numeric-Cd33AKbD.js} +288 -288
  195. package/dist/forms-numeric-Cd33AKbD.js.map +1 -0
  196. package/dist/{header-BSfIEWbI.js → header-BA697l4a.js} +14 -14
  197. package/dist/{header-BSfIEWbI.js.map → header-BA697l4a.js.map} +1 -1
  198. package/dist/hooks/useFormErrors.d.ts +1 -1
  199. package/dist/{hooks-ClH9thn4.js → hooks-BQ-L7Uu2.js} +2 -2
  200. package/dist/{hooks-ClH9thn4.js.map → hooks-BQ-L7Uu2.js.map} +1 -1
  201. package/dist/{icon-badge-DYKIwvOV.js → icon-badge-COWbCCWu.js} +3 -3
  202. package/dist/{icon-badge-DYKIwvOV.js.map → icon-badge-COWbCCWu.js.map} +1 -1
  203. package/dist/index.js +2 -2
  204. package/dist/input-Cdw4k0fb.js +289 -0
  205. package/dist/input-Cdw4k0fb.js.map +1 -0
  206. package/dist/{input-CZw8iU99.js → input-DOPL5_QE.js} +3 -3
  207. package/dist/{input-CZw8iU99.js.map → input-DOPL5_QE.js.map} +1 -1
  208. package/dist/item-BvZ2DR_x.js +277 -0
  209. package/dist/item-BvZ2DR_x.js.map +1 -0
  210. package/dist/layout/app-shell.js +1 -1
  211. package/dist/layout/auth.js +1 -1
  212. package/dist/layout/containers.js +1 -1
  213. package/dist/layout/header.js +1 -1
  214. package/dist/layout/hooks.js +1 -1
  215. package/dist/layout/navigation.js +1 -1
  216. package/dist/layout/page.js +1 -1
  217. package/dist/layout/settings.js +1 -1
  218. package/dist/layout/sidebar.js +2 -2
  219. package/dist/layout/workspace.js +1 -1
  220. package/dist/layout.js +10 -10
  221. package/dist/lib/affordance-geometry.generated.d.ts +6 -0
  222. package/dist/lib/ui-provider/types.d.ts +1 -1
  223. package/dist/lib/utils.js +1 -1
  224. package/dist/{media-gallery-3zIVLMWH.js → media-gallery-CSl5W1Fy.js} +6 -6
  225. package/dist/{media-gallery-3zIVLMWH.js.map → media-gallery-CSl5W1Fy.js.map} +1 -1
  226. package/dist/{mentions-CGlEJ15c.js → mentions-RKOQaaIB.js} +8 -8
  227. package/dist/{mentions-CGlEJ15c.js.map → mentions-RKOQaaIB.js.map} +1 -1
  228. package/dist/{message-DZ_ruyUV.js → message-INU2xsxu.js} +4 -4
  229. package/dist/{message-DZ_ruyUV.js.map → message-INU2xsxu.js.map} +1 -1
  230. package/dist/metadata-list-qVV7AVxa.js +443 -0
  231. package/dist/metadata-list-qVV7AVxa.js.map +1 -0
  232. package/dist/{navigation-BzhHI3lo.js → navigation-BQNcg1jT.js} +8 -8
  233. package/dist/{navigation-BzhHI3lo.js.map → navigation-BQNcg1jT.js.map} +1 -1
  234. package/dist/{navigation-Bnotn4AQ.js → navigation-DLF3E1IC.js} +7 -7
  235. package/dist/{navigation-Bnotn4AQ.js.map → navigation-DLF3E1IC.js.map} +1 -1
  236. package/dist/{navigation-row-recipes-BFLCk_Aq.js → navigation-row-recipes-WZEs-hYo.js} +2 -2
  237. package/dist/{navigation-row-recipes-BFLCk_Aq.js.map → navigation-row-recipes-WZEs-hYo.js.map} +1 -1
  238. package/dist/{number-DbV1Dija.js → number-E_OiIfJz.js} +5 -5
  239. package/dist/{number-DbV1Dija.js.map → number-E_OiIfJz.js.map} +1 -1
  240. package/dist/{overflow-tab-bar-CWY7Nogn.js → overflow-tab-bar-CrbqMteP.js} +107 -105
  241. package/dist/overflow-tab-bar-CrbqMteP.js.map +1 -0
  242. package/dist/{overlays-tMkF-VAN.js → overlays-BlKynmde.js} +228 -227
  243. package/dist/overlays-BlKynmde.js.map +1 -0
  244. package/dist/page-CIwNUtGr.js +227 -0
  245. package/dist/page-CIwNUtGr.js.map +1 -0
  246. package/dist/page-header-commands-DFMlNYzN.js +128 -0
  247. package/dist/page-header-commands-DFMlNYzN.js.map +1 -0
  248. package/dist/{pagination-BL25hu2s.js → pagination-Ch8X_47u.js} +5 -5
  249. package/dist/{pagination-BL25hu2s.js.map → pagination-Ch8X_47u.js.map} +1 -1
  250. package/dist/{popover-menu-Cn9rUkdc.js → popover-menu-BYaCdFhf.js} +6 -6
  251. package/dist/{popover-menu-Cn9rUkdc.js.map → popover-menu-BYaCdFhf.js.map} +1 -1
  252. package/dist/{popover-gnTOhbFM.js → popover-uwzX2vo7.js} +4 -4
  253. package/dist/{popover-gnTOhbFM.js.map → popover-uwzX2vo7.js.map} +1 -1
  254. package/dist/{primitives-BFK08r9M.js → primitives-Du64iDbb.js} +6 -6
  255. package/dist/{primitives-BFK08r9M.js.map → primitives-Du64iDbb.js.map} +1 -1
  256. package/dist/primitives.js +4 -4
  257. package/dist/{progress-B1VnCT0K.js → progress-BvF2oCdV.js} +5 -5
  258. package/dist/{progress-B1VnCT0K.js.map → progress-BvF2oCdV.js.map} +1 -1
  259. package/dist/{receipt-BVSOH3Xo.js → receipt-D789Jwyy.js} +6 -6
  260. package/dist/{receipt-BVSOH3Xo.js.map → receipt-D789Jwyy.js.map} +1 -1
  261. package/dist/{rich-text-GOUyKQ-s.js → rich-text-CLJEf76s.js} +4 -4
  262. package/dist/{rich-text-GOUyKQ-s.js.map → rich-text-CLJEf76s.js.map} +1 -1
  263. package/dist/{rich-text-editor-cRLC-eBK.js → rich-text-editor-Cm1dpUpQ.js} +10 -10
  264. package/dist/{rich-text-editor-cRLC-eBK.js.map → rich-text-editor-Cm1dpUpQ.js.map} +1 -1
  265. package/dist/{rich-text-editor-toolbar-DfXg0-VC.js → rich-text-editor-toolbar-L__e4x47.js} +4 -4
  266. package/dist/{rich-text-editor-toolbar-DfXg0-VC.js.map → rich-text-editor-toolbar-L__e4x47.js.map} +1 -1
  267. package/dist/{scroll-area-DcI-M1UT.js → scroll-area-La5RXsEk.js} +2 -2
  268. package/dist/{scroll-area-DcI-M1UT.js.map → scroll-area-La5RXsEk.js.map} +1 -1
  269. package/dist/{separator-Bom7NsGO.js → separator-DAEV0w65.js} +2 -2
  270. package/dist/{separator-Bom7NsGO.js.map → separator-DAEV0w65.js.map} +1 -1
  271. package/dist/{separator-BDV-Y648.js → separator-GNfPG-90.js} +3 -3
  272. package/dist/{separator-BDV-Y648.js.map → separator-GNfPG-90.js.map} +1 -1
  273. package/dist/services/actions.js +1 -1
  274. package/dist/settings-BA2iboic.js +174 -0
  275. package/dist/settings-BA2iboic.js.map +1 -0
  276. package/dist/{sheet-ijlsjq-n.js → sheet-DoAxTb2J.js} +7 -7
  277. package/dist/{sheet-ijlsjq-n.js.map → sheet-DoAxTb2J.js.map} +1 -1
  278. package/dist/{sidebar-DkTO4VTO.js → sidebar-ByqKR_W5.js} +13 -13
  279. package/dist/{sidebar-DkTO4VTO.js.map → sidebar-ByqKR_W5.js.map} +1 -1
  280. package/dist/{sidebar-Db6gkh3U.js → sidebar-D2iSnGJ7.js} +11 -11
  281. package/dist/{sidebar-Db6gkh3U.js.map → sidebar-D2iSnGJ7.js.map} +1 -1
  282. package/dist/{skeleton-Byjnt7qr.js → skeleton-CUj8O5Bd.js} +3 -3
  283. package/dist/{skeleton-Byjnt7qr.js.map → skeleton-CUj8O5Bd.js.map} +1 -1
  284. package/dist/smart-card-CqkzQsK-.js +614 -0
  285. package/dist/smart-card-CqkzQsK-.js.map +1 -0
  286. package/dist/{structure-BmisBK-3.js → structure-C0V0_Fyf.js} +3 -3
  287. package/dist/{structure-BmisBK-3.js.map → structure-C0V0_Fyf.js.map} +1 -1
  288. package/dist/{structure.recipes-EPz60cU8.js → structure.recipes-BB4-n58V.js} +2 -2
  289. package/dist/{structure.recipes-EPz60cU8.js.map → structure.recipes-BB4-n58V.js.map} +1 -1
  290. package/dist/style.css +1 -1
  291. package/dist/{table-DsfzoUia.js → table-CpvnzJn9.js} +3 -3
  292. package/dist/{table-DsfzoUia.js.map → table-CpvnzJn9.js.map} +1 -1
  293. package/dist/{table-BweFy_P9.js → table-DH7rozUv.js} +19 -19
  294. package/dist/{table-BweFy_P9.js.map → table-DH7rozUv.js.map} +1 -1
  295. package/dist/{tabs-CDocW5D1.js → tabs-eqVsJZWO.js} +7 -7
  296. package/dist/{tabs-CDocW5D1.js.map → tabs-eqVsJZWO.js.map} +1 -1
  297. package/dist/{text-inputs-f9Ia-aCi.js → text-inputs-DXItiR0O.js} +101 -98
  298. package/dist/text-inputs-DXItiR0O.js.map +1 -0
  299. package/dist/{text.styles-g4He6UIW.js → text.styles-B64My8RZ.js} +25 -10
  300. package/dist/text.styles-B64My8RZ.js.map +1 -0
  301. package/dist/theme.css +152 -112
  302. package/dist/{timelines-CwM_9IhD.js → timelines-DmtztAY_.js} +10 -10
  303. package/dist/{timelines-CwM_9IhD.js.map → timelines-DmtztAY_.js.map} +1 -1
  304. package/dist/{tooltip-yiRJUFjp.js → tooltip-B4hjKtoV.js} +3 -3
  305. package/dist/{tooltip-yiRJUFjp.js.map → tooltip-B4hjKtoV.js.map} +1 -1
  306. package/dist/{tree-WnKQzwbq.js → tree-CV11PURP.js} +8 -8
  307. package/dist/{tree-WnKQzwbq.js.map → tree-CV11PURP.js.map} +1 -1
  308. package/dist/typography/rich-text.js +1 -1
  309. package/dist/typography-CSyJrh28.js +117 -0
  310. package/dist/typography-CSyJrh28.js.map +1 -0
  311. package/dist/typography.js +1 -1
  312. package/dist/{ui-provider-C_U0Xma4.js → ui-provider-CQCuCBcy.js} +3 -3
  313. package/dist/ui-provider-CQCuCBcy.js.map +1 -0
  314. package/dist/ui-provider.js +1 -1
  315. package/dist/{upload-CXyxmQBP.js → upload-C9SA0X-8.js} +11 -11
  316. package/dist/{upload-CXyxmQBP.js.map → upload-C9SA0X-8.js.map} +1 -1
  317. package/dist/{upload-queue-Boscubn9.js → upload-queue-DhQJiSRc.js} +9 -9
  318. package/dist/{upload-queue-Boscubn9.js.map → upload-queue-DhQJiSRc.js.map} +1 -1
  319. package/dist/{usage-card-BhO5eqkX.js → usage-card-DVTRDmGz.js} +134 -133
  320. package/dist/usage-card-DVTRDmGz.js.map +1 -0
  321. package/dist/{utils-BRhFDwuU.js → utils-CF3c95Io.js} +68 -5
  322. package/dist/utils-CF3c95Io.js.map +1 -0
  323. package/dist/value-inputs-C0o70p-U.js +980 -0
  324. package/dist/value-inputs-C0o70p-U.js.map +1 -0
  325. package/dist/{value-typography-BP8OG6h5.js → value-typography-ClupF0Gz.js} +2 -2
  326. package/dist/{value-typography-BP8OG6h5.js.map → value-typography-ClupF0Gz.js.map} +1 -1
  327. package/dist/workspace-9EFVXUyk.js +410 -0
  328. package/dist/workspace-9EFVXUyk.js.map +1 -0
  329. package/docs/consumer-skill/SKILL.md +14 -129
  330. package/docs/consumer-skill/examples/app-layout.tsx +22 -12
  331. package/docs/consumer-skill/examples/authentication.tsx +77 -0
  332. package/docs/consumer-skill/examples/edit.tsx +30 -38
  333. package/docs/consumer-skill/examples/manifest.json +51 -1
  334. package/docs/consumer-skill/examples/rhf-bindings.tsx +86 -0
  335. package/docs/consumer-skill/examples/rhf-edit-page.tsx +141 -0
  336. package/docs/consumer-skill/examples/rhf-overlay-form.tsx +92 -0
  337. package/docs/consumer-skill/examples/rhf-transport.tsx +28 -0
  338. package/docs/consumer-skill/references/agents-md.md +17 -7
  339. package/docs/consumer-skill/references/authentication.md +42 -0
  340. package/docs/consumer-skill/references/component-contracts.json +319824 -0
  341. package/docs/consumer-skill/references/composition-mapping.md +92 -0
  342. package/docs/consumer-skill/references/composition.md +43 -19
  343. package/docs/consumer-skill/references/design-contract.md +32 -0
  344. package/docs/consumer-skill/references/discovery.md +84 -7
  345. package/docs/consumer-skill/references/installation.md +40 -36
  346. package/docs/consumer-skill/references/integration.md +6 -2
  347. package/docs/consumer-skill/references/public-api.json +1519 -65
  348. package/docs/consumer-skill/references/review.md +9 -4
  349. package/docs/consumer-skill/references/rhf-workflows.md +86 -0
  350. package/docs/consumer-skill/references/screen-archetypes.md +22 -0
  351. package/docs/consumer-skill/references/theming.md +8 -9
  352. package/docs/consumer-skill/references/tokens.json +12 -3
  353. package/docs/consumer-skill/references/workflows.md +2 -1
  354. package/docs/consumer-skill/scripts/composition-schema.d.mts +2 -0
  355. package/docs/consumer-skill/scripts/composition-schema.mjs +32 -0
  356. package/docs/consumer-skill/scripts/composition.mjs +198 -0
  357. package/docs/consumer-skill/scripts/discovery.mjs +42 -10
  358. package/docs/consumer-skill/scripts/inspect-component.mjs +11 -0
  359. package/docs/consumer-skill/scripts/inspect-tokens.mjs +11 -0
  360. package/docs/consumer-skill/scripts/inspection.mjs +138 -0
  361. package/docs/consumer-skill/scripts/map-composition.mjs +12 -0
  362. package/docs/consumer-skill/scripts/setup-skills.mjs +76 -0
  363. package/docs/consumer-skills/themelia-components/SKILL.md +30 -0
  364. package/docs/consumer-skills/themelia-composition/SKILL.md +35 -0
  365. package/docs/consumer-skills/themelia-forms/SKILL.md +12 -0
  366. package/docs/consumer-skills/themelia-foundation/SKILL.md +14 -0
  367. package/docs/consumer-skills/themelia-tokenization/SKILL.md +35 -0
  368. package/package.json +4 -2
  369. package/templates/README.md +39 -0
  370. package/templates/admin-shell-template.tsx +382 -0
  371. package/templates/analytics-operations-template.tsx +376 -0
  372. package/templates/customers-template.tsx +509 -0
  373. package/templates/index.ts +29 -0
  374. package/templates/orders-template.tsx +1102 -0
  375. package/templates/products-template.tsx +834 -0
  376. package/templates/user-permissions-template.tsx +450 -0
  377. package/dist/action-menu-CllU52Mm.js +0 -280
  378. package/dist/action-menu-CllU52Mm.js.map +0 -1
  379. package/dist/affordance-geometry.generated-tF36bREk.js.map +0 -1
  380. package/dist/ai-artifact-DvTwDVyL.js.map +0 -1
  381. package/dist/app-shell-C4FhvCqF.js.map +0 -1
  382. package/dist/cards-BaBZR-AU.js.map +0 -1
  383. package/dist/checkbox-AWIhNhmo.js.map +0 -1
  384. package/dist/choice-inputs-CNHvARCJ.js.map +0 -1
  385. package/dist/comments-DD0DUPwJ.js.map +0 -1
  386. package/dist/containers-Mu1LMGV1.js +0 -103
  387. package/dist/containers-Mu1LMGV1.js.map +0 -1
  388. package/dist/data-display-DT_khPl_.js.map +0 -1
  389. package/dist/date-picker-B2K3ucWn.js.map +0 -1
  390. package/dist/date-pickers-Ds8gLaoP.js +0 -175
  391. package/dist/date-pickers-Ds8gLaoP.js.map +0 -1
  392. package/dist/form-field-CwH9y77i.js.map +0 -1
  393. package/dist/forms-B9G_xwzi.js.map +0 -1
  394. package/dist/forms-numeric-B_jraJaQ.js.map +0 -1
  395. package/dist/input-DQdEd0YD.js +0 -263
  396. package/dist/input-DQdEd0YD.js.map +0 -1
  397. package/dist/item-K5_ghvze.js +0 -275
  398. package/dist/item-K5_ghvze.js.map +0 -1
  399. package/dist/metadata-list-8N16ZMW_.js +0 -405
  400. package/dist/metadata-list-8N16ZMW_.js.map +0 -1
  401. package/dist/overflow-tab-bar-CWY7Nogn.js.map +0 -1
  402. package/dist/overlays-tMkF-VAN.js.map +0 -1
  403. package/dist/page-CL9YeH_V.js +0 -224
  404. package/dist/page-CL9YeH_V.js.map +0 -1
  405. package/dist/page-header-commands-DOb6WsfD.js +0 -126
  406. package/dist/page-header-commands-DOb6WsfD.js.map +0 -1
  407. package/dist/settings-ybnjVwbd.js +0 -171
  408. package/dist/settings-ybnjVwbd.js.map +0 -1
  409. package/dist/smart-card-DiC5aac3.js +0 -604
  410. package/dist/smart-card-DiC5aac3.js.map +0 -1
  411. package/dist/text-inputs-f9Ia-aCi.js.map +0 -1
  412. package/dist/text.styles-g4He6UIW.js.map +0 -1
  413. package/dist/typography-UTnveOEy.js +0 -117
  414. package/dist/typography-UTnveOEy.js.map +0 -1
  415. package/dist/ui-provider-C_U0Xma4.js.map +0 -1
  416. package/dist/usage-card-BhO5eqkX.js.map +0 -1
  417. package/dist/utils-BRhFDwuU.js.map +0 -1
  418. package/dist/value-inputs-TaX4OjNk.js +0 -963
  419. package/dist/value-inputs-TaX4OjNk.js.map +0 -1
  420. package/dist/workspace-B-OEm3Kf.js +0 -408
  421. package/dist/workspace-B-OEm3Kf.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"choice-inputs-CNHvARCJ.js","names":["Select","SelectPrimitive","isScalar","baseui.SelectContent","baseui.SelectGroup","baseui.SelectItem","baseui.SelectLabel","baseui.SelectSeparator","Select","baseui.Select","baseui.SelectTrigger","baseui.SelectValue","Switch","SwitchPrimitive","Switch","SwitchPrimitive","React","Switch","isSimpleText","Switch","isSimpleText","GRID_COLS","isSimpleText","RadioGroupPrimitive","RadioPrimitive","React","RadioGroupPrimitive","RadioPrimitive","React","useTypographyConfig","useDensityConfig","resolveComponentScale","cn","Label","Text","textSizes","textLineHeights","focusRecipes","anchoredPositionMethod","motionRecipes","Stack","surfaceDividerRecipes","collectionRowClasses","popoverRecipes","collectionRecipes","CollectionLabel","CollectionContent","interactionRecipes","fieldStateRecipes","selectToggleRecipes","formControlSizeClasses","formLabelSizeClasses","formFieldTriggerClasses","formControlIconClasses","resolveFormControlSize","Checkbox","React$1","Select$2","Select","SelectGroup","props","className","SelectValue","SelectTrigger","size","children","ChevronDownIcon","iconClassName","SelectContent","resolvedContainer","useThemePortalContainer","container","alignItemWithTrigger","SelectScrollUpButton","SelectScrollDownButton","SelectLabel","SelectItem","CheckIcon","SelectSeparator","ChevronUpIcon","SELECT_POPUP_BEM","selectPopupItemSizeClasses","isScalar$1","value","SelectPopupContent","SelectPopupGroup","SelectPopupItem","density","defaultTextSize","selectPopupLabelSizeClasses","SelectPopupLabel","SelectPopupSeparator","defaultSelectStrings","CLEAR_VALUE","OPTION_VALUE_PREFIX","toInternalOptionValue","toInternalSelectedValue","toExternalValue","isScalar","typographyNode","DefaultOptionContent","option","Select$1","memo","forwardRef","isControlled","stringsProp","sizeProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","triggerProps","strings","useStrings","defaultScale","resolvedPlaceholder","placeholder","internalOptions","useMemo","mapped","options","allowClear","internalValue","optionsByInternalValue","entry","normalizedValue","normalizedDefaultValue","defaultValue","handleValueChange","useCallback","externalValue","nextValue","onValueChange","serializeValue","invalid","selectedOption","currentValue","renderValue","contentClassName","rendered","renderOption","Switch$2","Switch","Switch$1","rest","resolvedAriaInvalid","resolvedInvalid","checked","choiceCardSizeTokens","choicePillSizeTokens","choiceListSizeTokens","choiceCardStateClasses","choiceControlTrackClasses","choiceCardMarkerClasses","choiceCardMarkerSlotClasses","SwitchCard","Icon","internal","setInternal","useState","labelLineClasses","generatedId","useId","id","name","hasDescription","description","describedById","handleToggle","disabled","newChecked","handleCardClick","label","hint","isSimpleText$3","ToggleField","controlTrackClasses","inputId","labelId","descriptionId","set","next","onRowClick","Control","kind","v","TextBlock","controlPosition","isSimpleText$2","GRID_COLS$1","CardCheckboxGroup","markerTrackClasses","selected","tokens","toggle","o","val","columns","optionLabel","isSelected","isDisabled","shouldIncludeHidden","nameAttr","CircleCheck","isSimpleText$1","GRID_COLS","CardRadioGroupImpl","gridClassName","RadioGroup","Radio","CardRadioGroup","isSimpleText","ListRadioGroup","rowPadding","NEXT_KEYS","PREVIOUS_KEYS","PillRadioGroup","buttonRefs","isEnabled","selectedIndex","tabStopIndex","handleClick","optionValue","enabled","index","current","button","event","rtl","forward","backward","position","fullWidth","node"],"sources":["../src/components/ui/select.tsx","../src/components/base/choice-inputs/select-popup.tsx","../src/components/base/choice-inputs/select.tsx","../src/components/ui/switch.tsx","../src/components/base/choice-inputs/switch.tsx","../src/components/base/choice-inputs/choice-types.ts","../src/components/base/choice-inputs/switch-card.tsx","../src/components/base/choice-inputs/toggle-field.tsx","../src/components/base/choice-inputs/card-checkbox-group.tsx","../src/components/base/choice-inputs/card-radio-group.tsx","../src/components/base/choice-inputs/list-radio-group.tsx","../src/components/base/choice-inputs/pill-radio-group.tsx"],"sourcesContent":["import { anchoredPositionMethod } from '../../lib/anchored-positioning';\nimport { fieldStateRecipes } from '../../lib/field-state-recipes';\nimport { selectToggleRecipes } from '../../lib/field-affordance-recipes';\nimport { motionRecipes } from '../../lib/motion-recipes';\nimport { surfaceDividerRecipes } from '../../lib/surface-recipes';\nimport { useThemePortalContainer, type ThemePortalContainer } from '../../lib/theme-scope';\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\"\nimport { ChevronDownIcon, CheckIcon, ChevronUpIcon } from \"lucide-react\"\nimport * as React from \"react\"\n\nimport { cn } from \"../../lib/utils\"\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn(\"scroll-my-1\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className={cn(\"flex flex-1 text-start\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectTrigger({\n className,\n size = \"default\",\n iconClassName,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & {\n size?: \"sm\" | \"default\"\n /** Chevron size; owners pass the matching control icon size. Defaults to the shared select-toggle glyph for `size`. */\n iconClassName?: string\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n \"box-border flex w-fit items-center justify-between gap-space-sm whitespace-nowrap rounded-inner border border-input bg-transparent px-control py-space-xs font-sans text-sm text-foreground shadow-none outline-none transition-[color,box-shadow]\",\n \"data-[placeholder]:text-muted-foreground data-[size=default]:h-control data-[size=sm]:h-control-sm\",\n fieldStateRecipes.focus,\n fieldStateRecipes.invalid,\n \"disabled:cursor-not-allowed disabled:opacity-50 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n \"*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-space-sm [&_svg:not([class*='size-'])]:size-icon [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={\n <ChevronDownIcon aria-hidden=\"true\" className={cn(\"pointer-events-none shrink-0 text-muted-foreground\", selectToggleRecipes.icon[size === \"sm\" ? \"sm\" : \"md\"], iconClassName)} />\n }\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n container,\n children,\n side = \"bottom\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n alignItemWithTrigger = true,\n positionMethod = anchoredPositionMethod,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"alignItemWithTrigger\" | \"positionMethod\"\n > & { container?: ThemePortalContainer }) {\n const resolvedContainer = useThemePortalContainer(container)\n return (\n <SelectPrimitive.Portal container={resolvedContainer}>\n <SelectPrimitive.Positioner\n positionMethod={positionMethod}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n motionRecipes.popup,\n 'data-[align-trigger=true]:transition-none data-[align-trigger=true]:duration-0 data-[align-trigger=true]:scale-100 data-[align-trigger=true]:translate-none data-[align-trigger=true]:opacity-100',\n \"relative isolate z-50 max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-radius bg-popover text-popover-foreground shadow-md\",\n surfaceDividerRecipes.anchored.shell,\n className\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(\"px-row-x py-row-y-sm text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className=\"flex min-w-0 flex-1 gap-space-sm\">\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none flex shrink-0 items-center justify-center\" />}\n >\n <CheckIcon className=\"pointer-events-none\" />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\"pointer-events-none my-space-xs h-px\", surfaceDividerRecipes.anchored.separator, className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\"bg-popover z-10 flex cursor-default items-center justify-center py-space-xs [&_svg:not([class*='size-'])]:size-icon top-0 w-full\", className)}\n {...props}\n >\n <ChevronUpIcon\n />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\"bg-popover z-10 flex cursor-default items-center justify-center py-space-xs [&_svg:not([class*='size-'])]:size-icon bottom-0 w-full\", className)}\n {...props}\n >\n <ChevronDownIcon\n />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n}\n","import { CollectionLabel } from '../popover/collection-content';\nimport type { ComponentPropsWithoutRef, ReactNode } from 'react';\n\nimport * as baseui from '../../ui/select';\nimport { Text } from '../../typography';\nimport { textSizes } from '../../typography/text.styles';\nimport { useTypographyConfig, type FormControlSize } from '../../../lib/ui-provider';\nimport { cn } from '../../../lib/utils';\nimport { collectionRecipes, collectionRowClasses, popoverRecipes, type CollectionDensity } from '../popover/popover.recipes';\n\nconst SELECT_POPUP_BEM = {\n\tcontent: 'select-popup--component',\n\tgroup: 'select-popup--group',\n\titem: 'select-popup--item',\n\tlabel: 'select-popup--label',\n\tseparator: 'select-popup--separator',\n} as const;\n\nconst selectPopupItemSizeClasses: Record<FormControlSize, string> = {\n\tsm: \"[&_svg:not([class*='size-'])]:size-icon-sm\",\n\tmd: \"[&_svg:not([class*='size-'])]:size-icon\",\n\tlg: \"[&_svg:not([class*='size-'])]:size-icon-lg\",\n};\n\nfunction isScalar(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\n/**\n * Private presentation layer for every Select-based form popup.\n *\n * It deliberately leaves Root/Trigger/Value state and form semantics with the\n * owning control, while centralizing the collection popup's compact surface inset, row\n * rhythm, option indicator clearance, icon sizing, and group anatomy.\n */\nexport function SelectPopupContent({\n\tclassName,\n\talign = 'start',\n\talignItemWithTrigger = false,\n\t...props\n}: ComponentPropsWithoutRef<typeof baseui.SelectContent>) {\n\treturn (\n\t\t<baseui.SelectContent\n\t\t\talign={align}\n\t\t\talignItemWithTrigger={alignItemWithTrigger}\n\t\t\tclassName={cn(\n\t\t\t\tSELECT_POPUP_BEM.content,\n\t\t\t\tpopoverRecipes.surface,\n\t\t\t\tpopoverRecipes.menu,\n\t\t\t\t'w-max min-w-(--anchor-width) max-w-(--available-width)',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport function SelectPopupGroup({\n\tclassName,\n\t...props\n}: ComponentPropsWithoutRef<typeof baseui.SelectGroup>) {\n\treturn (\n\t\t<baseui.SelectGroup\n\t\t\tclassName={cn(SELECT_POPUP_BEM.group, 'p-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport interface SelectPopupItemProps\n\textends ComponentPropsWithoutRef<typeof baseui.SelectItem> {\n\t/** Match option typography, gap, icon, and indicator clearance to its trigger. */\n\tsize?: FormControlSize;\n\t/** Vertical option rhythm, independent from trigger/icon size. */\n\tdensity?: CollectionDensity;\n}\n\nexport function SelectPopupItem({\n\tchildren,\n\tclassName,\n\tsize = 'md',\n\tdensity = 'default',\n\t...props\n}: SelectPopupItemProps) {\n\tconst { defaultTextSize } = useTypographyConfig();\n\treturn (\n\t\t<baseui.SelectItem\n\t\t\tclassName={cn(\n\t\t\t\tSELECT_POPUP_BEM.item,\n\t\t\t\tcollectionRowClasses(density),\n\t\t\t\tcollectionRecipes.highlighted,\n\t\t\t\tcollectionRecipes.disabled,\n\t\t\t\tselectPopupItemSizeClasses[size],\n\t\t\t\ttextSizes[defaultTextSize ?? 'sm'],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isScalar(children) ? <CollectionLabel>{children}</CollectionLabel> : children}\n\t\t</baseui.SelectItem>\n\t);\n}\n\nexport interface SelectPopupLabelProps\n\textends ComponentPropsWithoutRef<typeof baseui.SelectLabel> {\n\t/**\n\t * Owning control scale. Group captions sit one step below the option text:\n\t * `sm` and `md` use the compact caption size, `lg` the default text size.\n\t * Defaults to `md`.\n\t */\n\tsize?: FormControlSize;\n}\n\nconst selectPopupLabelSizeClasses: Record<FormControlSize, string> = {\n\tsm: 'text-xs',\n\tmd: 'text-xs',\n\tlg: 'text-sm',\n};\n\n/**\n * Group caption. Supporting copy rather than another option, so it uses the\n * secondary medium caption role shared with menu and command group captions.\n */\nexport function SelectPopupLabel({\n\tchildren,\n\tclassName,\n\tsize = 'md',\n\t...props\n}: SelectPopupLabelProps) {\n\treturn (\n\t\t<baseui.SelectLabel\n\t\t\tclassName={cn(\n\t\t\t\tSELECT_POPUP_BEM.label,\n\t\t\t\t'px-row-x py-row-y-sm font-medium text-muted-foreground',\n\t\t\t\tselectPopupLabelSizeClasses[size],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isScalar(children) ? (\n\t\t\t\t<Text tag=\"span\" size=\"inherit\" type=\"inherit\" weight=\"inherit\" lineHeight=\"tight\">\n\t\t\t\t\t{children}\n\t\t\t\t</Text>\n\t\t\t) : children}\n\t\t</baseui.SelectLabel>\n\t);\n}\n\nexport function SelectPopupSeparator({\n\tclassName,\n\t...props\n}: ComponentPropsWithoutRef<typeof baseui.SelectSeparator>) {\n\treturn (\n\t\t<baseui.SelectSeparator\n\t\t\tclassName={cn(\n\t\t\t\tSELECT_POPUP_BEM.separator,\n\t\t\t\tpopoverRecipes.separator,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n","import { CollectionContent } from '../popover/collection-content';\nimport {\n\tforwardRef,\n\tmemo,\n\tuseCallback,\n\tuseMemo,\n\ttype ComponentPropsWithoutRef,\n\ttype FocusEventHandler,\n\ttype ReactNode,\n\ttype Ref,\n} from 'react';\n\nimport * as baseui from '../../ui/select';\nimport { Text } from '../../typography';\nimport { useDensityConfig, type FormControlSize } from '../../../lib/ui-provider';\nimport { useStrings, type StringsProp } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\nimport { selectToggleRecipes } from '../../../lib/field-affordance-recipes';\nimport type { CollectionDensity } from '../popover/popover.recipes';\n\nimport {\n\tformControlIconClasses,\n\tformFieldTriggerClasses,\n\tresolveFormControlSize,\n} from '../forms/form-sizing';\nimport {\n\tSelectPopupContent,\n\tSelectPopupGroup,\n\tSelectPopupItem,\n} from './select-popup';\n\nexport interface SelectStrings {\n\tplaceholder: string;\n}\n\nexport const defaultSelectStrings: SelectStrings = {\n\tplaceholder: 'Select an option',\n};\n\nexport interface SelectOption {\n\tvalue: string;\n\tlabel: string;\n\tdescription?: string;\n\ticon?: ReactNode;\n\tdisabled?: boolean;\n}\n\ntype BaseSelectTriggerProps = ComponentPropsWithoutRef<typeof baseui.SelectTrigger>;\n\ntype SelectTriggerProps = Omit<\n\tBaseSelectTriggerProps,\n\t| 'aria-describedby'\n\t| 'aria-invalid'\n\t| 'aria-label'\n\t| 'aria-labelledby'\n\t| 'children'\n\t| 'className'\n\t| 'defaultValue'\n\t| 'disabled'\n\t| 'form'\n\t| 'id'\n\t| 'name'\n\t| 'onBlur'\n\t| 'onChange'\n\t| 'onFocus'\n\t| 'required'\n\t| 'size'\n\t| 'value'\n>;\n\nexport interface SelectProps extends SelectTriggerProps {\n\t/** Popup option rhythm, independent from the trigger size. Defaults to default. */\n\tdensity?: CollectionDensity;\n\t/** Available options. An empty-string option clears the selection. */\n\toptions: SelectOption[];\n\n\t/** Placeholder text — overrides `strings.placeholder` when provided. */\n\tplaceholder?: string;\n\n\t/** String overrides (e.g. placeholder). */\n\tstrings?: StringsProp<SelectStrings>;\n\n\t/** Add a placeholder option that clears the current selection. */\n\tallowClear?: boolean;\n\n\t/** Error state for styling (passed from FormField). */\n\tinvalid?: boolean;\n\n\t/** Visual size. */\n\tsize?: FormControlSize;\n\n\t/** Additional class names for the trigger. */\n\tclassName?: string;\n\n\t/** Additional class names for the popup surface. */\n\tcontentClassName?: string;\n\n\t/** Canonical value callback. Returns `undefined` when the selection is cleared. */\n\tonValueChange?: (value: string | undefined) => void;\n\n\t/** Current value. Passing `value={undefined}` explicitly keeps the control controlled and clear. */\n\tvalue?: string | null;\n\n\t/** Initial value for an uncontrolled select. */\n\tdefaultValue?: string | null;\n\n\t/** Disabled state. */\n\tdisabled?: boolean;\n\n\t/** Read-only state. */\n\treadOnly?: boolean;\n\n\t/** Field name used by the hidden native input. */\n\tname?: string;\n\n\t/** The owning form id when the select is rendered outside that form. */\n\tform?: string;\n\n\t/** Native autocomplete hint forwarded to the hidden input. */\n\tautoComplete?: string;\n\n\t/** Ref to the hidden native input used for form submission. */\n\tinputRef?: Ref<HTMLInputElement>;\n\n\t/** Root id; Base UI applies it to the trigger/field contract. */\n\tid?: string;\n\n\t/** Required state. */\n\trequired?: boolean;\n\n\t/** Accessible label for externally-labelled or compact trigger contexts. */\n\t'aria-label'?: string;\n\n\t/** Ids of elements that label the trigger. */\n\t'aria-labelledby'?: string;\n\n\t/** Ids of elements that describe the trigger. */\n\t'aria-describedby'?: string;\n\n\t/** Native invalid state forwarded to the trigger. `invalid` takes precedence. */\n\t'aria-invalid'?: BaseSelectTriggerProps['aria-invalid'];\n\n\t/** Native focus callback forwarded to the trigger. */\n\tonFocus?: FocusEventHandler<HTMLButtonElement>;\n\n\t/** Native blur callback forwarded to the trigger. */\n\tonBlur?: FocusEventHandler<HTMLButtonElement>;\n\n\t/** Open state (controlled). */\n\topen?: boolean;\n\n\t/** Default open state. */\n\tdefaultOpen?: boolean;\n\n\t/** Open change handler. */\n\tonOpenChange?: (open: boolean) => void;\n\n\t/** Called after the popup's opening or closing animation completes. */\n\tonOpenChangeComplete?: (open: boolean) => void;\n\n\t/** Whether the open popup should isolate interaction from the rest of the page. */\n\tmodal?: boolean;\n\n\t/** Whether pointer movement should highlight popup options. */\n\thighlightItemOnHover?: boolean;\n\n\t/** Replace the default icon/label/description option presentation. */\n\trenderOption?: (option: SelectOption) => ReactNode;\n\n\t/** Replace the trigger value presentation. Receives `undefined` for the placeholder state. */\n\trenderValue?: (option: SelectOption | undefined) => ReactNode;\n}\n\ninterface InternalSelectOption {\n\tinternalValue: string;\n\toption: SelectOption;\n}\n\n// Base UI reserves the empty string for an empty native form value. Encoding every\n// real option keeps consumer values collision-free, including values that happen to\n// equal this component's clear sentinel.\nconst CLEAR_VALUE = '__admin_ui_select_clear__';\nconst OPTION_VALUE_PREFIX = '__admin_ui_select_option__:';\n\nfunction toInternalOptionValue(value: string): string {\n\treturn value === '' ? CLEAR_VALUE : `${OPTION_VALUE_PREFIX}${value}`;\n}\n\nfunction toInternalSelectedValue(value: string | null | undefined): string | null {\n\tif (value === '' || value === null || value === undefined) return null;\n\treturn `${OPTION_VALUE_PREFIX}${value}`;\n}\n\nfunction toExternalValue(value: string | null): string | undefined {\n\tif (value === null || value === CLEAR_VALUE) return undefined;\n\tif (value.startsWith(OPTION_VALUE_PREFIX)) return value.slice(OPTION_VALUE_PREFIX.length);\n\treturn undefined;\n}\n\nfunction isScalar(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\nfunction typographyNode(value: ReactNode, className?: string): ReactNode {\n\tif (!isScalar(value)) return value;\n\n\treturn (\n\t\t<Text tag=\"span\" size=\"inherit\" lineHeight=\"tight\" className={cn('text-inherit', className)}>\n\t\t\t{value}\n\t\t</Text>\n\t);\n}\n\nfunction DefaultOptionContent({ option, size }: { option: SelectOption; size: FormControlSize }) {\n return <CollectionContent label={option.label} description={option.description} leading={option.icon} leadingDecorative wrap\n className=\"select--option-content\" leadingClassName={cn('select--option-icon',formControlIconClasses[size])}\n bodyClassName=\"select--option-text text-start\" labelClassName=\"select--option-label block\"\n descriptionClassName=\"select--option-description line-clamp-2\"/>;\n}\n\n/**\n * Canonical finite-option form control. `Select` owns the single Base UI state\n * engine used by both standard and descriptive option presentations.\n */\nexport const Select = memo(\n\tforwardRef<HTMLButtonElement, SelectProps>(function Select(props, ref) {\n\t\tconst isControlled = Object.prototype.hasOwnProperty.call(props, 'value');\n\t\tconst {\n\t\t\toptions,\n\t\t\tdensity,\n\t\t\tplaceholder,\n\t\t\tstrings: stringsProp,\n\t\t\tallowClear = false,\n\t\t\tinvalid,\n\t\t\tsize: sizeProp,\n\t\t\tclassName,\n\t\t\tcontentClassName,\n\t\t\tonValueChange,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tdefaultOpen,\n\t\t\topen,\n\t\t\tonOpenChange,\n\t\t\tonOpenChangeComplete,\n\t\t\tmodal,\n\t\t\thighlightItemOnHover,\n\t\t\tname,\n\t\t\tform,\n\t\t\tautoComplete,\n\t\t\tinputRef,\n\t\t\tid,\n\t\t\trequired,\n\t\t\t'aria-label': ariaLabel,\n\t\t\t'aria-labelledby': ariaLabelledBy,\n\t\t\t'aria-describedby': ariaDescribedBy,\n\t\t\t'aria-invalid': ariaInvalid,\n\t\t\tonFocus,\n\t\t\tonBlur,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\trenderOption,\n\t\t\trenderValue,\n\t\t\t...triggerProps\n\t\t} = props;\n\t\tconst strings = useStrings(defaultSelectStrings, stringsProp);\n\t\tconst { defaultScale } = useDensityConfig();\n\t\tconst size = resolveFormControlSize(sizeProp, defaultScale);\n\t\tconst resolvedPlaceholder = placeholder ?? strings.placeholder;\n\n\t\tconst internalOptions = useMemo<InternalSelectOption[]>(() => {\n\t\t\tconst mapped = options.map((option) => ({\n\t\t\t\toption,\n\t\t\t\tinternalValue: toInternalOptionValue(option.value),\n\t\t\t}));\n\n\t\t\tif (allowClear && !mapped.some(({ internalValue }) => internalValue === CLEAR_VALUE)) {\n\t\t\t\tmapped.unshift({\n\t\t\t\t\tinternalValue: CLEAR_VALUE,\n\t\t\t\t\toption: { value: '', label: resolvedPlaceholder },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn mapped;\n\t\t}, [allowClear, options, resolvedPlaceholder]);\n\n\t\tconst optionsByInternalValue = useMemo(\n\t\t\t() => new Map(internalOptions.map((entry) => [entry.internalValue, entry.option])),\n\t\t\t[internalOptions],\n\t\t);\n\t\tconst normalizedValue = toInternalSelectedValue(value);\n\t\tconst normalizedDefaultValue = toInternalSelectedValue(defaultValue);\n\n\t\tconst handleValueChange = useCallback(\n\t\t\t(nextValue: string | null) => {\n\t\t\t\tconst externalValue = toExternalValue(nextValue);\n\t\t\t\tonValueChange?.(externalValue);\n\t\t\t},\n\t\t\t[onValueChange],\n\t\t);\n\n\t\tconst serializeValue = useCallback((internalValue: string) => {\n\t\t\treturn toExternalValue(internalValue) ?? '';\n\t\t}, []);\n\n\t\tconst controlledValueProps = isControlled ? { value: normalizedValue } : {};\n\n\t\treturn (\n\t\t\t<baseui.Select\n\t\t\t\tonValueChange={handleValueChange}\n\t\t\t\tdisabled={disabled}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tdefaultOpen={defaultOpen}\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\tonOpenChangeComplete={onOpenChangeComplete}\n\t\t\t\tmodal={modal}\n\t\t\t\thighlightItemOnHover={highlightItemOnHover}\n\t\t\t\tname={name}\n\t\t\t\tform={form}\n\t\t\t\tautoComplete={autoComplete}\n\t\t\t\tinputRef={inputRef}\n\t\t\t\tid={id}\n\t\t\t\trequired={required}\n\t\t\t\tdefaultValue={normalizedDefaultValue}\n\t\t\t\titemToStringValue={serializeValue}\n\t\t\t\t{...controlledValueProps}\n\t\t\t>\n\t\t\t\t<baseui.SelectTrigger\n\t\t\t\t\tref={ref}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={invalid ? true : ariaInvalid}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\ticonClassName={selectToggleRecipes.icon[size]}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'select--component select--trigger',\n\t\t\t\t\t\tformFieldTriggerClasses(size),\n\t\t\t\t\t\t'data-[placeholder]:text-muted-foreground',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...triggerProps}\n\t\t\t\t>\n\t\t\t\t\t<baseui.SelectValue className=\"select--value min-w-0\">\n\t\t\t\t\t\t{(currentValue: string | null) => {\n\t\t\t\t\t\t\tconst selectedOption = currentValue && currentValue !== CLEAR_VALUE\n\t\t\t\t\t\t\t\t? optionsByInternalValue.get(currentValue)\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\tconst rendered = renderValue\n\t\t\t\t\t\t\t\t? renderValue(selectedOption)\n\t\t\t\t\t\t\t\t: selectedOption?.label ?? resolvedPlaceholder;\n\n\t\t\t\t\t\t\treturn typographyNode(rendered, 'min-w-0 truncate');\n\t\t\t\t\t\t}}\n\t\t\t\t\t</baseui.SelectValue>\n\t\t\t\t</baseui.SelectTrigger>\n\t\t\t\t<SelectPopupContent className={cn('select--content', contentClassName)}>\n\t\t\t\t\t<SelectPopupGroup className=\"select--group\">\n\t\t\t\t\t\t{internalOptions.map(({ internalValue, option }) => {\n\t\t\t\t\t\t\tconst rendered = renderOption?.(option);\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<SelectPopupItem\n\t\t\t\t\t\t\t\t\tkey={internalValue}\n\t\t\t\t\t\t\t\t\tvalue={internalValue}\n\t\t\t\t\t\t\t\t\tlabel={option.label}\n\t\t\t\t\t\t\t\t\taria-label={option.label}\n\t\t\t\t\t\t\t\t\tdisabled={option.disabled}\n\t\t\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t\t\t\tdensity={density}\n\t\t\t\t\t\t\t\t\tclassName=\"select--item\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{renderOption\n\t\t\t\t\t\t\t\t\t\t? typographyNode(rendered, 'select--option-custom')\n\t\t\t\t\t\t\t\t\t\t: <DefaultOptionContent option={option} size={size} />}\n\t\t\t\t\t\t\t\t</SelectPopupItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</SelectPopupGroup>\n\t\t\t\t</SelectPopupContent>\n\t\t\t</baseui.Select>\n\t\t);\n\t}),\n);\n\nSelect.displayName = 'Select';\n","import { Switch as SwitchPrimitive } from \"@base-ui/react/switch\"\n\nimport { cn } from \"../../lib/utils\"\nimport { focusRecipes } from \"../../lib/focus-recipes\"\nimport { fieldStateRecipes } from \"../../lib/field-state-recipes\"\n\n/**\n * Raw switch recipe. The unchecked track is the shared `--input` control\n * boundary; focus is the shared focus frame, and invalid follows the field-state\n * contract (destructive border, destructive halo on focus) like every field.\n */\nfunction Switch({\n className,\n size = \"default\",\n ...props\n}: SwitchPrimitive.Root.Props & {\n size?: \"sm\" | \"default\"\n}) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"peer group/switch relative box-border inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-[background-color,border-color,box-shadow]\",\n \"data-checked:bg-primary data-unchecked:bg-input\",\n \"data-[size=default]:h-5 data-[size=default]:w-9 data-[size=sm]:h-4 data-[size=sm]:w-7\",\n focusRecipes.frame,\n fieldStateRecipes.invalid,\n \"after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className=\"bg-background rounded-full shadow-sm group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[16px] group-data-[size=sm]/switch:data-checked:translate-x-[12px] group-data-[size=default]/switch:data-unchecked:translate-x-0.5 group-data-[size=sm]/switch:data-unchecked:translate-x-0.5 pointer-events-none block ring-0 transition-transform motion-reduce:transition-none\"\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n","/**\n * Switch — canonical boolean switch wrapper around the internal shadcn primitive.\n *\n * `onValueChange` is the package-wide value callback.\n */\nimport { forwardRef, type ComponentProps } from 'react';\n\nimport { Switch as SwitchPrimitive } from '../../ui/switch';\nimport { useDensityConfig, type ComponentScale } from '../../../lib/ui-provider';\nimport { resolveComponentScale } from '../../../lib/ui-provider/scale';\nimport { cn } from '../../../lib/utils';\n\ntype BaseSwitchProps = ComponentProps<typeof SwitchPrimitive>;\ntype SwitchElement = React.ElementRef<typeof SwitchPrimitive>;\n\nexport interface SwitchProps extends Omit<BaseSwitchProps, 'onCheckedChange' | 'size'> {\n\t/** Component scale. Falls back to `UIProvider.density.defaultScale`. */\n\tsize?: ComponentScale;\n\t/** Controlled checked state. */\n\tchecked?: boolean;\n\t/** Initial checked state for uncontrolled usage. */\n\tdefaultChecked?: boolean;\n\t/** Disable interaction and native form participation changes. */\n\tdisabled?: boolean;\n\t/** Prevent changes while retaining the current submitted value. */\n\treadOnly?: boolean;\n\t/** Require the switch to be checked for native form validation. */\n\trequired?: boolean;\n\t/** Hidden input name used during native form submission. */\n\tname?: string;\n\t/** Hidden input value submitted while checked. */\n\tvalue?: string;\n\t/** Optional value submitted while unchecked. */\n\tuncheckedValue?: string;\n\t/** Associate the hidden input with a form by id. */\n\tform?: string;\n\t/** Canonical boolean value callback. */\n\tonValueChange?: (checked: boolean) => void;\n\n\t/** Error state for styling (passed from FormField). */\n\tinvalid?: boolean;\n}\n\n/** Canonical boolean control with native form state and value-first callbacks. */\nexport const Switch = forwardRef<SwitchElement, SwitchProps>(function Switch(\n\t{\n\t\tonValueChange,\n\t\tsize: sizeProp,\n\t\tinvalid,\n\t\tclassName,\n\t\tid,\n\t\tname,\n\t\t'aria-invalid': ariaInvalid,\n\t\t...rest\n\t},\n\tref,\n) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveComponentScale(sizeProp, defaultScale);\n\tconst resolvedAriaInvalid = invalid ? true : ariaInvalid;\n\tconst resolvedInvalid = resolvedAriaInvalid !== undefined && resolvedAriaInvalid !== false && resolvedAriaInvalid !== 'false';\n\n\treturn (\n\t\t<SwitchPrimitive\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t\tid={id}\n\t\t\tname={name}\n\t\t\tonCheckedChange={(checked) => onValueChange?.(checked)}\n\t\t\tsize={size === 'sm' ? 'sm' : 'default'}\n\t\t\taria-invalid={resolvedAriaInvalid}\n\t\t\tclassName={cn(\n\t\t\t\t'switch--component',\n\t\t\t\tsize === 'lg' && 'h-6! w-11! [&_[data-slot=switch-thumb]]:size-5! [&[data-checked]_[data-slot=switch-thumb]]:translate-x-[20px]!',\n\t\t\t\tresolvedInvalid && 'data-unchecked:border-destructive',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t/>\n\t);\n});\n\nSwitch.displayName = 'Switch';\n","/**\n * Shared types for choice-style form fields (CardRadio, CardCheckbox,\n * ListRadio, PillRadio). Each variant exports its own `Option` type that\n * extends `ChoiceOptionBase`, so consumers see one consistent option shape\n * across the family.\n *\n * Sizes follow the package component scale (`sm | md | lg`). CardRadio and\n * CardCheckbox additionally accept `size` to drive padding, icon size, and type\n * scale through shared form/display variables.\n */\nimport type { ComponentType, ReactNode } from 'react';\nimport type { ComponentScale } from '../../../lib/ui-provider';\nimport { focusRecipes } from '../../../lib/focus-recipes';\nimport { interactionRecipes } from '../../../lib/interaction-recipes';\n\nexport type ChoiceSize = ComponentScale;\n\nexport interface ChoiceOptionBase<TValue extends string = string> {\n\tvalue: TValue;\n\tlabel: ReactNode;\n\tdescription?: ReactNode;\n\ticon?: ComponentType<{ className?: string }>;\n\tdisabled?: boolean;\n}\n\nexport interface ChoiceGroupBaseProps {\n\t/** Supporting/error descriptions associated with the group. */\n\t'aria-describedby'?: string;\n\t/** Form field name (also used for hidden inputs and aria grouping). */\n\tname?: string;\n\t/** Disable the entire group. */\n\tdisabled?: boolean;\n\t/** Show error styling. */\n\tinvalid?: boolean;\n\t/** Density / control size. Defaults from `useDensityConfig().defaultScale`. */\n\tsize?: ChoiceSize;\n\tclassName?: string;\n}\n\n/**\n * Padding / icon-size token map shared across CardRadio + CardCheckbox so the\n * two variants line up visually when placed side-by-side.\n */\nexport const choiceCardSizeTokens: Record<\n\tChoiceSize,\n\t{ padding: string; iconBox: string; iconSize: string; gap: string }\n> = {\n\tsm: { padding: 'p-surface-xs', iconBox: 'size-avatar-sm', iconSize: 'size-icon-sm', gap: 'gap-space-sm' },\n\tmd: { padding: 'p-surface', iconBox: 'size-avatar', iconSize: 'size-icon', gap: 'gap-space-md' },\n\tlg: { padding: 'p-surface-lg', iconBox: 'size-avatar-lg', iconSize: 'size-icon-lg', gap: 'gap-space-lg' },\n};\n\n/**\n * Pill height / horizontal padding tokens. Shared across PillRadioGroup\n * and any future toggle-bar variant so they stack cleanly.\n */\nexport const choicePillSizeTokens: Record<ChoiceSize, string> = {\n\tsm: 'h-control-sm px-control-sm text-pxs',\n\tmd: 'h-control px-control text-sm',\n\tlg: 'h-control-lg px-control text-sm',\n};\n\n/**\n * Row padding tokens for ListRadio and any future inline list variant.\n */\nexport const choiceListSizeTokens: Record<ChoiceSize, string> = {\n\tsm: 'px-row-x py-row-y-sm',\n\tmd: 'px-row-x py-row-y',\n\tlg: 'px-row-x py-row-y-lg',\n};\n\n/**\n * Shared option-card states for CardRadioGroup and CardCheckboxGroup: the resting\n * `border-border` divider (declared beside `border` by each owner) steps up to the\n * control boundary on hover, and keyboard focus draws the shared focus frame.\n * Selection and validation are added by each owner as data/aria variants, so they\n * keep their border while focused.\n */\nexport const choiceCardStateClasses = `${interactionRecipes.tileHover} ${focusRecipes.frame}`;\n\n/** Optional option glyph: one neutral tile in every state, so colour stays for meaning. */\nexport const choiceCardIconClasses = 'inline-flex shrink-0 items-center justify-center rounded-inner bg-muted text-muted-foreground';\n\n/**\n * A control track exactly one label line tall. Pair it with the label's own text\n * role (size and leading) and align the row to its start: a checkbox, radio,\n * switch or selection marker then centres on the label's first line at every\n * scale, whether or not the label wraps.\n */\nexport const choiceControlTrackClasses = 'flex h-lh shrink-0 items-center';\n\n/**\n * Shared selected-card marker, derived from action geometry. It sits in a\n * `choiceControlTrackClasses` track beside the option label, inside a slot that\n * keeps its width while unselected so selecting never rewraps the label.\n */\nexport const choiceCardMarkerClasses = 'size-action-sm shrink-0 text-primary-foreground fill-primary stroke-primary-foreground';\nexport const choiceCardMarkerSlotClasses = 'inline-flex size-action-sm shrink-0 items-center justify-center';\n","/**\n * SwitchCard — bordered settings card with an icon, title, optional\n * description, optional hint, and a trailing switch. The whole card is\n * clickable and toggles the switch; clicking inside the actual switch only\n * toggles once. The on state draws the primary border; the switch itself carries the state.\n *\n * Use for top-of-list \"feature\" toggles where the switch needs more visual\n * weight than a `ToggleField`. For dense rows, prefer `ToggleField`.\n */\nimport { type LucideIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { useCallback, useId, useMemo, useState } from 'react';\nimport { Stack } from '../structure';\nimport { Label, Text } from '../../typography';\nimport { cn } from '../../../lib/utils';\nimport { fieldStateRecipes } from '../../../lib/field-state-recipes';\nimport { useDensityConfig } from '../../../lib/ui-provider';\nimport { resolveComponentScale } from '../../../lib/ui-provider/scale';\nimport { formLabelSizeClasses } from '../forms/form-sizing';\n\nimport { choiceCardIconClasses, choiceControlTrackClasses } from './choice-types';\nimport { Switch } from './switch';\n\nexport interface SwitchCardProps {\n\t/** Additional supporting/error descriptions associated with the editable control. */\n\t'aria-describedby'?: string;\n\t/** Card title, also the switch's accessible name. */\n\tlabel: string;\n\t/** Supporting sentence under the label. */\n\tdescription?: string;\n\t/** Short guidance below the description. */\n\thint?: string;\n\t/** Leading glyph. */\n\ticon?: LucideIcon;\n\t/** Form field name, forwarded for native submits. */\n\tname?: string;\n\t/** Whether the switch is on. Controlled. */\n\tvalue?: boolean;\n\t/** Initial switch state for uncontrolled use. */\n\tdefaultValue?: boolean;\n\tonValueChange?: (checked: boolean) => void;\n\t/** Disables the switch and mutes the card. */\n\tdisabled?: boolean;\n\t/** Applies the invalid styling. */\n\tinvalid?: boolean;\n\tclassName?: string;\n}\n\nexport const SwitchCard = React.forwardRef<HTMLDivElement, SwitchCardProps>(function SwitchCard({\n\t'aria-describedby': ariaDescribedBy,\n\tlabel,\n\tdescription,\n\thint,\n\ticon: Icon,\n\tname,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tdisabled = false,\n\tinvalid,\n\tclassName,\n}: SwitchCardProps, ref) {\n\tconst isControlled = value !== undefined;\n\tconst [internal, setInternal] = useState<boolean>(defaultValue ?? false);\n\tconst checked = isControlled ? value ?? false : internal;\n\tconst { defaultScale } = useDensityConfig();\n\t// The switch track is one label line tall, so the switch centres on the title's first line.\n\tconst labelLineClasses = formLabelSizeClasses[resolveComponentScale(undefined, defaultScale)];\n\tconst generatedId = useId();\n\tconst id = useMemo(() => name ?? generatedId, [name, generatedId]);\n\n\tconst hasDescription = typeof description === 'string' && description.trim() !== '';\n\tconst describedById = hasDescription ? `${id}-description` : undefined;\n\n\tconst handleToggle = useCallback(\n\t\t(newChecked: boolean) => {\n\t\t\tif (disabled) return;\n\t\t\tif (!isControlled) setInternal(newChecked);\n\t\t\tonValueChange?.(newChecked);\n\t\t},\n\t\t[disabled, isControlled, onValueChange],\n\t);\n\n\tconst handleCardClick = useCallback(\n\t\t(e: React.MouseEvent) => {\n\t\t\tif ((e.target as HTMLElement).closest('[role=\"switch\"]')) return;\n\t\t\thandleToggle(!checked);\n\t\t},\n\t\t[checked, handleToggle],\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\taria-invalid={invalid || undefined}\n\t\t\tonClick={handleCardClick}\n\t\t\tclassName={cn('switch-card--component', \n\t\t\t\t'group relative flex items-start gap-space-lg rounded-radius border bg-card text-card-foreground p-surface transition-[background,border-color,box-shadow] duration-150',\n\t\t\t\t// Same resting, hover, selected and invalid states as the choice cards.\n\t\t\t\t'border-border',\n\t\t\t\tchecked && 'border-primary',\n\t\t\t\tfieldStateRecipes.invalid,\n\t\t\t\t!disabled && 'cursor-pointer hover:border-input',\n\t\t\t\tdisabled && 'cursor-not-allowed opacity-50',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{!!name && (\n\t\t\t\t<input\n\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={checked ? '1' : '0'}\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{!!Icon && (\n\t\t\t\t<span className={cn('switch-card--icon size-control', choiceCardIconClasses)}>\n\t\t\t\t\t<Icon className=\"size-icon\" />\n\t\t\t\t</span>\n\t\t\t)}\n\n\t\t\t\t<Stack gap=\"dense\" className=\"min-w-0 flex-1\">\n\t\t\t\t<Label\n\t\t\t\t\thtmlFor={id}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'block text-inherit',\n\t\t\t\t\t\tdisabled ? 'cursor-not-allowed' : 'cursor-pointer',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Label>\n\t\t\t\t{!!hasDescription && (\n\t\t\t\t\t<Text id={describedById} size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</Text>\n\t\t\t\t)}\n\t\t\t\t{!!hint && (\n\t\t\t\t\t<Text size=\"xs\" type=\"discrete\">\n\t\t\t\t\t\t{hint}\n\t\t\t\t\t</Text>\n\t\t\t\t)}\n\t\t\t\t</Stack>\n\n\t\t\t<div className={cn('switch-card--control', choiceControlTrackClasses, labelLineClasses)}>\n\t\t\t\t<Switch\n\t\t\t\t\t// The card owns the disabled fade; the switch keeps native disabled behavior.\n\t\t\t\t\tclassName=\"data-disabled:opacity-100\"\n\t\t\t\t\tid={id}\n\t\t\t\t\tchecked={checked}\n\t\t\t\t\tonValueChange={handleToggle}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={invalid}\n\t\t\t\t\taria-label={label}\n\t\t\t\t\taria-describedby={[ariaDescribedBy, describedById].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n});\n\nSwitchCard.displayName = 'SwitchCard';\n","/**\n * ToggleField — inline label-and-control row for switches and checkboxes.\n *\n * Pattern: a left-aligned descriptive label/description block with the\n * control sitting on the trailing edge. Use for settings rows (e.g. \"Email\n * notifications\" + switch) where a full SwitchCard is too heavy and a bare\n * `Switch` + `<label>` is too brittle. The whole row is clickable and\n * keyboard-accessible.\n *\n * Two control kinds: `'switch'` (default) and `'checkbox'`. Both honour\n * controlled `value` / `defaultValue` / `onValueChange`. Strings are passed via\n * standard React props rather than a `strings` object — there are no\n * defaults to override.\n */\nimport type { ReactNode } from 'react';\nimport { forwardRef, useCallback, useId, useState } from 'react';\n\nimport { Stack } from '../structure';\nimport { Label, Text } from '../../typography';\nimport { cn } from '../../../lib/utils';\nimport { useDensityConfig } from '../../../lib/ui-provider';\nimport { resolveComponentScale } from '../../../lib/ui-provider/scale';\nimport { formLabelSizeClasses } from '../forms/form-sizing';\n\nimport { Checkbox } from './checkbox';\nimport { choiceControlTrackClasses } from './choice-types';\nimport { Switch } from './switch';\n\nexport type ToggleFieldKind = 'switch' | 'checkbox';\n\nexport interface ToggleFieldProps {\n\t/** Additional supporting/error descriptions associated with the editable control. */\n\t'aria-describedby'?: string;\n\t/** Control label. */\n\tlabel: ReactNode;\n\t/** Supporting sentence under the label. */\n\tdescription?: ReactNode;\n\t/** Which control renders — a switch or a checkbox. */\n\tkind?: ToggleFieldKind;\n\t/** Whether the control is on. Controlled. */\n\tvalue?: boolean;\n\t/** Initial state for uncontrolled use. */\n\tdefaultValue?: boolean;\n\tonValueChange?: (checked: boolean) => void;\n\t/** Disables the control. */\n\tdisabled?: boolean;\n\t/** Applies the invalid styling. */\n\tinvalid?: boolean;\n\t/** Form field name, forwarded for native submits. */\n\tname?: string;\n\tclassName?: string;\n\t/** Place the control on the leading edge instead of trailing (default). */\n\tcontrolPosition?: 'leading' | 'trailing';\n}\n\nfunction isSimpleText(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\nexport const ToggleField = forwardRef<HTMLDivElement, ToggleFieldProps>(function ToggleField({\n\t'aria-describedby': ariaDescribedBy,\n\tlabel,\n\tdescription,\n\tkind = 'switch',\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tdisabled = false,\n\tinvalid = false,\n\tname,\n\tclassName,\n\tcontrolPosition = 'trailing',\n}: ToggleFieldProps, ref) {\n\tconst isControlled = value !== undefined;\n\tconst [internal, setInternal] = useState<boolean>(defaultValue ?? false);\n\tconst checked = isControlled ? value ?? false : internal;\n\tconst { defaultScale } = useDensityConfig();\n\t// The control track is exactly one label line tall, so a switch or checkbox\n\t// centres on the label's first line at every scale, wrapped or not.\n\tconst controlTrackClasses = cn('toggle-field--control', choiceControlTrackClasses, formLabelSizeClasses[resolveComponentScale(undefined, defaultScale)]);\n\tconst inputId = useId();\n\tconst labelId = `${inputId}-label`;\n\tconst hasDescription = description !== null && description !== undefined && description !== false;\n\tconst descriptionId = hasDescription ? `${inputId}-description` : undefined;\n\n\tconst set = useCallback(\n\t\t(next: boolean) => {\n\t\t\tif (disabled) return;\n\t\t\tif (!isControlled) setInternal(next);\n\t\t\tonValueChange?.(next);\n\t\t},\n\t\t[disabled, isControlled, onValueChange],\n\t);\n\n\tconst onRowClick = (e: React.MouseEvent) => {\n\t\t// Avoid double-toggle when clicking the control itself.\n\t\tconst target = e.target as HTMLElement;\n\t\tif (target.closest('[role=\"switch\"], [role=\"checkbox\"], input[type=\"checkbox\"]')) return;\n\t\tset(!checked);\n\t};\n\n\tconst Control =\n\t\tkind === 'switch' ? (\n\t\t\t<Switch\n\t\t\t\t// The row already expands the hit area; a horizontal switch hit\n\t\t\t\t// extension would overflow when this field sits at a surface edge.\n\t\t\t\tclassName=\"after:inset-x-0\"\n\t\t\t\tid={inputId}\n\t\t\t\tname={name}\n\t\t\t\tchecked={checked}\n\t\t\t\tonValueChange={set}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tinvalid={invalid}\n\t\t\t\taria-labelledby={labelId}\n\t\t\t\taria-describedby={[ariaDescribedBy, descriptionId].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t) : (\n\t\t\t<Checkbox\n\t\t\t\tid={inputId}\n\t\t\t\tname={name}\n\t\t\t\tchecked={checked}\n\t\t\t\tonCheckedChange={(v) => set(v === true)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-invalid={invalid || undefined}\n\t\t\t\taria-labelledby={labelId}\n\t\t\t\taria-describedby={[ariaDescribedBy, descriptionId].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t);\n\n\tconst TextBlock = (\n\t\t<Stack gap=\"dense\" className=\"min-w-0 flex-1\">\n\t\t\t<div id={labelId}>\n\t\t\t\t{isSimpleText(label) ? (\n\t\t\t\t\t<Label\n\t\t\t\t\t\thtmlFor={inputId}\n\t\t\t\t\t\tdata-disabled={disabled || undefined}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t// Leading is left to `Label` so this sits on the same\n\t\t\t\t\t\t\t// baseline rhythm as the switch, checkbox, and switch-card\n\t\t\t\t\t\t\t// labels; `leading-snug` here made it the only inline\n\t\t\t\t\t\t\t// control label in the package at 19.25px.\n\t\t\t\t\t\t\t'block text-inherit data-disabled:opacity-50',\n\t\t\t\t\t\t\tdisabled ? 'cursor-not-allowed' : 'cursor-pointer',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</Label>\n\t\t\t\t) : label}\n\t\t\t</div>\n\t\t\t{hasDescription && (\n\t\t\t\t<div id={descriptionId}>\n\t\t\t\t\t{isSimpleText(description) ? (\n\t\t\t\t\t\t<Text size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) : description}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</Stack>\n\t);\n\n\treturn (\n\t\t<Stack\n\t\t\tref={ref}\n\t\t\tdirection=\"horizontal\"\n\t\t\talign=\"start\"\n\t\t\twrap={false}\n\t\t\tgap=\"md\"\n\t\t\trole=\"group\"\n\t\t\tonClick={onRowClick}\n\t\t\tclassName={cn('toggle-field--component rounded-radius py-row-y',\n\t\t\t\tdisabled && 'pointer-events-none',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{controlPosition === 'leading' && <div className={controlTrackClasses}>{Control}</div>}\n\t\t\t{TextBlock}\n\t\t\t{controlPosition === 'trailing' && <div className={controlTrackClasses}>{Control}</div>}\n\t\t</Stack>\n\t);\n});\n\nToggleField.displayName = 'ToggleField';\n","/**\n * CardCheckboxGroup — multi-select group rendered as a grid of card-shaped\n * options with title, optional description, and optional leading icon.\n * Use for a small set of feature flags / preferences where each option\n * benefits from extra context that a flat checkbox list can't carry.\n *\n * Pairs with `CardRadioGroup` (single-select). Both share spacing tokens\n * from `./choice-types` so they line up when used side-by-side.\n */\nimport { CircleCheck, type LucideIcon } from 'lucide-react';\nimport { forwardRef, useState, useCallback, useMemo, type ReactNode } from 'react';\nimport { Text } from '../../typography';\nimport { Stack } from '../structure';\nimport { cn } from '../../../lib/utils';\nimport { fieldStateRecipes } from '../../../lib/field-state-recipes';\nimport { useDensityConfig, useTypographyConfig } from '../../../lib/ui-provider';\nimport { textLineHeights, textSizes } from '../../typography/text.styles';\nimport { resolveFormControlSize } from '../forms/form-sizing';\nimport {\n\tchoiceCardSizeTokens,\n\tchoiceCardIconClasses,\n\tchoiceCardMarkerClasses,\n\tchoiceCardMarkerSlotClasses,\n\tchoiceCardStateClasses,\n\tchoiceControlTrackClasses,\n\ttype ChoiceGroupBaseProps,\n\ttype ChoiceOptionBase,\n} from './choice-types';\n\nexport interface CardCheckboxOption extends ChoiceOptionBase {\n\t/** Leading glyph. */\n\ticon?: LucideIcon;\n}\n\nexport interface CardCheckboxGroupProps extends ChoiceGroupBaseProps {\n\t/** Choices offered. */\n\toptions: CardCheckboxOption[];\n\t/** Current value. Controlled. */\n\tvalue?: string[];\n\t/** Initial value for uncontrolled use. */\n\tdefaultValue?: string[];\n\tonValueChange?: (values: string[]) => void;\n\t/** How many columns the grid uses. */\n\tcolumns?: 1 | 2 | 3 | 4;\n}\n\nfunction isSimpleText(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\n/*\n * Container widths, not viewport widths — a choice-card group is as likely to\n * sit in a settings rail or a drawer as at page width, and keyed to the screen\n * it laid three cards across a 300px column.\n *\n * 384/576/672 puts every tier clear of the widths this actually renders at: the\n * shipped three-up group is 672px wide, so the three-column step sits 96px\n * below it rather than exactly on it, and 384 keeps the two-column step above\n * every mobile mount (316px).\n */\nconst GRID_COLS: Record<NonNullable<CardCheckboxGroupProps['columns']>, string> = {\n\t1: 'grid grid-cols-1 gap-space-md',\n\t2: 'grid grid-cols-1 gap-space-md @sm/card-checkbox-group:grid-cols-2',\n\t3: 'grid grid-cols-1 gap-space-md @sm/card-checkbox-group:grid-cols-2 @xl/card-checkbox-group:grid-cols-3',\n\t4: 'grid grid-cols-1 gap-space-md @sm/card-checkbox-group:grid-cols-2 @2xl/card-checkbox-group:grid-cols-4',\n};\n\nexport const CardCheckboxGroup = forwardRef<HTMLDivElement, CardCheckboxGroupProps>(function CardCheckboxGroup({\n\t'aria-describedby': ariaDescribedBy,\n\toptions,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n\tcolumns = 3,\n\tinvalid,\n\tdisabled,\n\tsize: sizeProp,\n\tclassName,\n}: CardCheckboxGroupProps, ref) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst { defaultTextSize } = useTypographyConfig();\n\tconst size = resolveFormControlSize(sizeProp, defaultScale);\n\t// The marker track is one line of the option label's own text role tall, so\n\t// the selected check centres on the label's first line.\n\tconst markerTrackClasses = cn('card-checkbox-group--marker', choiceControlTrackClasses, textSizes[defaultTextSize ?? 'sm'], textLineHeights.normal);\n\n\tconst isControlled = value !== undefined;\n\tconst [internal, setInternal] = useState<string[]>(defaultValue ?? []);\n\tconst selected = useMemo(\n\t\t() => (isControlled ? value ?? [] : internal),\n\t\t[internal, isControlled, value],\n\t);\n\tconst tokens = choiceCardSizeTokens[size];\n\n\tconst toggle = useCallback(\n\t\t(val: string) => {\n\t\t\tif (disabled) return;\n\t\t\tif (options.find((o) => o.value === val)?.disabled) return;\n\t\t\tconst exists = selected.includes(val);\n\t\t\tconst next = exists ? selected.filter((v) => v !== val) : [...selected, val];\n\t\t\tif (!isControlled) setInternal(next);\n\t\t\tonValueChange?.(next);\n\t\t},\n\t\t[disabled, options, selected, isControlled, onValueChange],\n\t);\n\n\treturn (\n\t\t/*\n\t\t * The root exists to be the query container: an element cannot match its\n\t\t * own container query, so the grid whose columns react sits inside the\n\t\t * element being measured.\n\t\t */\n\t\t<div ref={ref} className={cn('card-checkbox-group--component @container/card-checkbox-group', className)}>\n\t\t\t<div\n\t\t\t\tclassName={cn('card-checkbox-group--grid', GRID_COLS[columns])}\n\t\t\t\trole=\"group\"\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\taria-invalid={invalid || undefined}\n\t\t\t\taria-disabled={disabled || undefined}\n\t\t\t>\n\t\t\t\t{options.map((option) => {\n\t\t\t\t\tconst Icon = option.icon;\n\t\t\t\t\tconst optionLabel = option.label;\n\t\t\t\t\tconst isSelected = selected.includes(option.value);\n\t\t\t\t\tconst isDisabled = disabled || option.disabled;\n\t\t\t\t\tconst shouldIncludeHidden = Boolean(name) && isSelected;\n\t\t\t\t\tconst nameAttr = name ? `${name}[]` : undefined;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={option.value} className=\"relative\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\t\t\t\tname={nameAttr}\n\t\t\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\t\tdisabled={!shouldIncludeHidden}\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={isSelected}\n\t\t\t\t\t\t\t\taria-invalid={invalid || undefined}\n\t\t\t\t\t\t\t\tonClick={() => toggle(option.value)}\n\t\t\t\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\t\t\t\tdata-selected={isSelected}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'box-border group relative flex w-full flex-col items-start text-start outline-none cursor-pointer',\n\t\t\t\t\t\t\t\t\t'rounded-radius border border-border bg-card text-card-foreground transition-[color,box-shadow,background,border-color] duration-150',\n\t\t\t\t\t\t\t\t\tchoiceCardStateClasses,\n\t\t\t\t\t\t\t\t\t'data-[selected=true]:border-primary',\n\t\t\t\t\t\t\t\t\ttokens.padding,\n\t\t\t\t\t\t\t\t\ttokens.gap,\n\t\t\t\t\t\t\t\t\tfieldStateRecipes.invalid,\n\t\t\t\t\t\t\t\t\t'disabled:cursor-not-allowed disabled:opacity-50',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{!!Icon && (\n\t\t\t\t\t\t\t\t\t<span className={cn(choiceCardIconClasses, tokens.iconBox)}>\n\t\t\t\t\t\t\t\t\t\t<Icon className={tokens.iconSize} />\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<span className={cn('card-checkbox-group--body flex w-full min-w-0 items-start', tokens.gap)}>\n\t\t\t\t\t\t\t\t<Stack gap=\"dense\" className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t\t\t{isSimpleText(optionLabel) ? (\n\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" type=\"inherit\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t{optionLabel}\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t) : optionLabel}\n\t\t\t\t\t\t\t\t\t{!!option.description && (\n\t\t\t\t\t\t\t\t\t\tisSimpleText(option.description) ? (\n\t\t\t\t\t\t\t\t\t\t\t<Text size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t\t{option.description}\n\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t) : option.description\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={markerTrackClasses}>\n\t\t\t\t\t\t\t\t\t<span className={choiceCardMarkerSlotClasses}>\n\t\t\t\t\t\t\t\t\t\t<CircleCheck\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\tchoiceCardMarkerClasses,\n\t\t\t\t\t\t\t\t\t\t\t\t!isSelected && 'hidden',\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t);\n});\n\nCardCheckboxGroup.displayName = 'CardCheckboxGroup';\n","/**\n * CardRadioGroup — single-select radio group rendered as a grid of card-shaped\n * options with title, optional description, and optional leading icon. Built\n * on `@base-ui/react/radio` for accessibility (keyboard navigation, focus\n * management, native form participation).\n *\n * Pairs with `CardCheckboxGroup` (multi-select). Shares spacing tokens from\n * `./choice-types`.\n */\nimport { Radio as RadioPrimitive } from '@base-ui/react/radio';\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';\nimport { CircleCheck, type LucideIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { memo, useMemo, type ReactNode } from 'react';\nimport { Text } from '../../typography';\nimport { Stack } from '../structure';\nimport { cn } from '../../../lib/utils';\nimport { fieldStateRecipes } from '../../../lib/field-state-recipes';\nimport { useDensityConfig, useTypographyConfig } from '../../../lib/ui-provider';\nimport { textLineHeights, textSizes } from '../../typography/text.styles';\nimport { resolveFormControlSize } from '../forms/form-sizing';\nimport {\n\tchoiceCardSizeTokens,\n\tchoiceCardIconClasses,\n\tchoiceCardMarkerClasses,\n\tchoiceCardMarkerSlotClasses,\n\tchoiceCardStateClasses,\n\tchoiceControlTrackClasses,\n\ttype ChoiceGroupBaseProps,\n\ttype ChoiceOptionBase,\n} from './choice-types';\n\nexport interface CardRadioOption extends ChoiceOptionBase {\n\t/** Leading glyph. */\n\ticon?: LucideIcon;\n}\n\nexport interface CardRadioGroupProps extends ChoiceGroupBaseProps {\n\t/** Choices offered. */\n\toptions: CardRadioOption[];\n\t/** Current value. Controlled. */\n\tvalue?: string;\n\t/** Initial value for uncontrolled use. */\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\t/** How many columns the grid uses. */\n\tcolumns?: 1 | 2 | 3 | 4;\n}\n\nfunction isSimpleText(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\n/*\n * Container widths, not viewport widths — a choice-card group is as likely to\n * sit in a settings rail or a drawer as at page width, and keyed to the screen\n * it laid three cards across a 300px column.\n *\n * 384/576/672 puts every tier clear of the widths this actually renders at: the\n * shipped three-up group is 672px wide, so the three-column step sits 96px\n * below it rather than exactly on it, and 384 keeps the two-column step above\n * every mobile mount (316px).\n */\nconst GRID_COLS: Record<NonNullable<CardRadioGroupProps['columns']>, string> = {\n\t1: 'grid grid-cols-1 gap-space-md',\n\t2: 'grid grid-cols-1 gap-space-md @sm/card-radio-group:grid-cols-2',\n\t3: 'grid grid-cols-1 gap-space-md @sm/card-radio-group:grid-cols-2 @xl/card-radio-group:grid-cols-3',\n\t4: 'grid grid-cols-1 gap-space-md @sm/card-radio-group:grid-cols-2 @2xl/card-radio-group:grid-cols-4',\n};\n\nfunction CardRadioGroupImpl({\n\t'aria-describedby': ariaDescribedBy,\n\toptions,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n\tcolumns = 3,\n\tinvalid,\n\tdisabled,\n\tsize: sizeProp,\n\tclassName,\n}: CardRadioGroupProps, ref: React.ForwardedRef<HTMLDivElement>) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst { defaultTextSize } = useTypographyConfig();\n\tconst size = resolveFormControlSize(sizeProp, defaultScale);\n\t// The marker track is one line of the option label's own text role tall, so\n\t// the selected check centres on the label's first line.\n\tconst markerTrackClasses = cn('card-radio-group--marker', choiceControlTrackClasses, textSizes[defaultTextSize ?? 'sm'], textLineHeights.normal);\n\n\tconst tokens = choiceCardSizeTokens[size];\n\tconst gridClassName = useMemo(() => cn('card-radio-group--grid', GRID_COLS[columns]), [columns]);\n\n\treturn (\n\t\t/*\n\t\t * The root exists to be the query container: an element cannot match its\n\t\t * own container query, so the grid whose columns react sits inside the\n\t\t * element being measured.\n\t\t */\n\t\t<div ref={ref} className={cn('card-radio-group--component @container/card-radio-group', className)}>\n\t\t\t<RadioGroupPrimitive\n\t\t\t\tvalue={value}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tonValueChange={(val) => val && onValueChange?.(val)}\n\t\t\t\tname={name}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\taria-invalid={invalid || undefined}\n\t\t\t\tclassName={gridClassName}\n\t\t\t>\n\t\t\t\t{options.map((option) => {\n\t\t\t\t\tconst Icon = option.icon;\n\t\t\t\t\tconst optionLabel = option.label;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<RadioPrimitive.Root\n\t\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\t\tdisabled={disabled || option.disabled}\n\t\t\t\t\t\t\taria-invalid={invalid || undefined}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'box-border relative group flex flex-col text-start outline-none cursor-pointer',\n\t\t\t\t\t\t\t\t'rounded-radius border border-border bg-card text-card-foreground transition-[color,box-shadow,background,border-color] duration-150',\n\t\t\t\t\t\t\t\tchoiceCardStateClasses,\n\t\t\t\t\t\t\t\t'data-[checked]:border-primary',\n\t\t\t\t\t\t\t\ttokens.padding,\n\t\t\t\t\t\t\t\ttokens.gap,\n\t\t\t\t\t\t\t\tfieldStateRecipes.invalid,\n\t\t\t\t\t\t\t\t// The radio root is a span, so state comes from Base UI's attribute.\n\t\t\t\t\t\t\t\t'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{!!Icon && (\n\t\t\t\t\t\t\t\t<span className={cn(choiceCardIconClasses, tokens.iconBox)}>\n\t\t\t\t\t\t\t\t\t<Icon className={tokens.iconSize} />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className={cn('card-radio-group--body flex w-full min-w-0 items-start', tokens.gap)}>\n\t\t\t\t\t\t\t<Stack gap=\"dense\" className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t\t{isSimpleText(optionLabel) ? (\n\t\t\t\t\t\t\t\t\t<Text tag=\"span\" type=\"inherit\" weight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t{optionLabel}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) : optionLabel}\n\t\t\t\t\t\t\t\t{!!option.description && (\n\t\t\t\t\t\t\t\t\tisSimpleText(option.description) ? (\n\t\t\t\t\t\t\t\t\t\t<Text size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t\t\t\t{option.description}\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t) : option.description\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={markerTrackClasses}>\n\t\t\t\t\t\t\t\t<span className={choiceCardMarkerSlotClasses}>\n\t\t\t\t\t\t\t\t\t<RadioPrimitive.Indicator\n\t\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t\t<CircleCheck className={choiceCardMarkerClasses} />\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</RadioPrimitive.Root>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</RadioGroupPrimitive>\n\t\t</div>\n\t);\n}\n\nexport const CardRadioGroup = memo(React.forwardRef<HTMLDivElement, CardRadioGroupProps>(CardRadioGroupImpl));\nCardRadioGroup.displayName = 'CardRadioGroup';\n","/**\n * ListRadioGroup — single-select radio group rendered as a vertical list with\n * dividers between rows. Use when options have descriptive secondary text and\n * read better as a stack than a grid (e.g. plan tiers, role definitions).\n *\n * Pairs with `CardRadioGroup` for grid-style choices and `PillRadioGroup` for\n * inline compact toggles.\n */\nimport { Radio as RadioPrimitive } from '@base-ui/react/radio';\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';\nimport { forwardRef } from 'react';\nimport { Text } from '../../typography';\nimport { textSizes } from '../../typography/text.styles';\nimport { Stack } from '../structure';\nimport { cn } from '../../../lib/utils';\nimport { fieldStateRecipes } from '../../../lib/field-state-recipes';\nimport { useDensityConfig, useTypographyConfig } from '../../../lib/ui-provider';\nimport { resolveFormControlSize } from '../forms/form-sizing';\nimport {\n\tchoiceControlTrackClasses,\n\tchoiceListSizeTokens,\n\ttype ChoiceGroupBaseProps,\n\ttype ChoiceOptionBase,\n} from './choice-types';\nimport { interactionRecipes } from '../../../lib/interaction-recipes';\n\nexport interface ListRadioOption extends ChoiceOptionBase {}\n\nexport interface ListRadioGroupProps extends ChoiceGroupBaseProps {\n\t/** Choices offered. */\n\toptions: ListRadioOption[];\n\t/** Current value. Controlled. */\n\tvalue?: string;\n\t/** Initial value for uncontrolled use. */\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n}\n\nfunction isSimpleText(value: React.ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\nexport const ListRadioGroup = forwardRef<HTMLDivElement, ListRadioGroupProps>(function ListRadioGroup({\n\toptions,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n\tinvalid,\n\tdisabled,\n\tsize: sizeProp,\n\tclassName,\n}: ListRadioGroupProps, ref) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst { defaultTextSize } = useTypographyConfig();\n\tconst size = resolveFormControlSize(sizeProp, defaultScale);\n\n\tconst rowPadding = choiceListSizeTokens[size];\n\t// The radio track is one line of the label's own text role tall, so the\n\t// circle centres on the first line whether or not the label wraps.\n\tconst labelLineClasses = cn(textSizes[defaultTextSize ?? 'sm'], 'leading-tight');\n\treturn (\n\t\t<RadioGroupPrimitive\n\t\t\tref={ref}\n\t\t\tvalue={value}\n\t\t\tdefaultValue={defaultValue}\n\t\t\tonValueChange={(val) => val && onValueChange?.(val)}\n\t\t\tname={name}\n\t\t\tdisabled={disabled}\n\t\t\taria-invalid={invalid || undefined}\n\t\t\tclassName={cn('list-radio-group--component', \n\t\t\t\t'overflow-hidden rounded-radius border border-border [&>[role=radio]~[role=radio]]:border-t [&>[role=radio]~[role=radio]]:border-border',\n\t\t\t\t// Validation marks the group frame once, never each radio; the focused\n\t\t\t\t// row's radio draws the focus frame.\n\t\t\t\tfieldStateRecipes.invalid,\n\t\t\t\t// A disabled group dims once; its rows do not dim again.\n\t\t\t\tdisabled && 'pointer-events-none opacity-50',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{options.map((option) => (\n\t\t\t\t<RadioPrimitive.Root\n\t\t\t\t\tkey={option.value}\n\t\t\t\t\tvalue={option.value}\n\t\t\t\t\tdisabled={disabled || option.disabled}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'box-border group flex w-full items-start gap-space-lg text-start outline-none cursor-pointer',\n\t\t\t\t\t\t`transition-colors ${interactionRecipes.rowHover}`,\n\t\t\t\t\t\t'data-disabled:cursor-not-allowed',\n\t\t\t\t\t\t!disabled && 'data-disabled:opacity-50',\n\t\t\t\t\t\trowPadding,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<span aria-hidden=\"true\" className={cn('list-radio-group--track', choiceControlTrackClasses, labelLineClasses)}>\n\t\t\t\t\t\t{/* Selection reads from the radio itself: the shared control\n\t\t\t\t\t\t boundary, the primary ring and dot when checked, and the shared\n\t\t\t\t\t\t focus frame when the row has keyboard focus. */}\n\t\t\t\t\t\t<span className={cn(\n\t\t\t\t\t\t\t'list-radio-group--radio box-border flex size-4 items-center justify-center rounded-full border border-input transition-[border-color,box-shadow]',\n\t\t\t\t\t\t\t'group-data-[checked]:border-primary group-focus-visible:border-ring group-focus-visible:ring-3 group-focus-visible:ring-ring/50',\n\t\t\t\t\t\t)}>\n\t\t\t\t\t\t\t<RadioPrimitive.Indicator className=\"list-radio-group--dot size-2 rounded-full bg-primary\" />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Stack gap=\"dense\" className=\"flex-1 min-w-0\">\n\t\t\t\t\t\t{isSimpleText(option.label) ? (\n\t\t\t\t\t\t\t<Text tag=\"span\" weight=\"medium\" lineHeight=\"tight\" className=\"block\">\n\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : option.label}\n\t\t\t\t\t\t{!!option.description && (\n\t\t\t\t\t\t\tisSimpleText(option.description) ? (\n\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" className=\"block\">\n\t\t\t\t\t\t\t\t\t{option.description}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) : option.description\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t</RadioPrimitive.Root>\n\t\t\t))}\n\t\t</RadioGroupPrimitive>\n\t);\n});\n\nListRadioGroup.displayName = 'ListRadioGroup';\n","/**\n * PillRadioGroup — compact, inline single-select rendered as connected pill\n * buttons. Best for 2–4 options where a full `<Select>` is too heavy and\n * cards are too tall (e.g. timeframe toggles, view-mode switchers).\n *\n * Custom-styled buttons rather than the shadcn ToggleGroup primitive: the\n * primitive strips inner rounding when spacing=0, which doesn't match this\n * design system's pill connector style.\n *\n * Keyboard follows the native radio-group pattern: the group is one Tab stop\n * (the selected pill, or the first enabled one), the arrow keys move to the\n * previous/next enabled pill and select it, Home/End jump to the ends, and\n * Space/Enter select the focused pill (or clear it when `allowClear` is set).\n */\nimport * as React from 'react';\n\nimport { Text } from '../../typography';\nimport { cn } from '../../../lib/utils';\nimport { fieldStateRecipes } from '../../../lib/field-state-recipes';\nimport { useDensityConfig } from '../../../lib/ui-provider';\nimport { formControlSizeClasses, resolveFormControlSize } from '../forms/form-sizing';\nimport {\n\tchoicePillSizeTokens,\n\ttype ChoiceGroupBaseProps,\n\ttype ChoiceOptionBase,\n} from './choice-types';\nimport { focusRecipes } from '../../../lib/focus-recipes';\n\nexport interface PillRadioGroupOption extends ChoiceOptionBase {}\n\nexport interface PillRadioGroupProps\n\textends Omit<ChoiceGroupBaseProps, 'name'> {\n\t/** Form field name, forwarded for native submits. */\n\tname: string;\n\t/** Current value. Controlled. */\n\tvalue: string | null | undefined;\n\t/** Choices offered. */\n\toptions: PillRadioGroupOption[];\n\tonValueChange: (value: string | null) => void;\n\t/** Allow deselecting (click active pill to clear). Default false. */\n\tallowClear?: boolean;\n\t/** Stretch pills to fill the container. */\n\tfullWidth?: boolean;\n\t/** Accessible name of the group when no visible label is associated with it. */\n\t'aria-label'?: string;\n\t/** Id of a visible label that names the group. */\n\t'aria-labelledby'?: string;\n}\n\nconst NEXT_KEYS = new Set(['ArrowRight', 'ArrowDown']);\nconst PREVIOUS_KEYS = new Set(['ArrowLeft', 'ArrowUp']);\n\nexport const PillRadioGroup = React.forwardRef<HTMLDivElement, PillRadioGroupProps>(function PillRadioGroup({\n\tname,\n\tvalue,\n\toptions,\n\tonValueChange,\n\tallowClear = false,\n\tsize: sizeProp,\n\tfullWidth = false,\n\tdisabled = false,\n\tinvalid = false,\n\tclassName,\n\t'aria-label': ariaLabel,\n\t'aria-labelledby': ariaLabelledBy,\n\t'aria-describedby': ariaDescribedBy,\n}: PillRadioGroupProps, ref) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveFormControlSize(sizeProp, defaultScale);\n\tconst buttonRefs = React.useRef<Array<HTMLButtonElement | null>>([]);\n\n\tconst isEnabled = React.useCallback(\n\t\t(option: PillRadioGroupOption) => !disabled && !option.disabled,\n\t\t[disabled],\n\t);\n\tconst selectedIndex = options.findIndex((option) => option.value === value);\n\t// One Tab stop: the selected enabled pill, otherwise the first enabled one.\n\tconst tabStopIndex = selectedIndex >= 0 && isEnabled(options[selectedIndex])\n\t\t? selectedIndex\n\t\t: options.findIndex(isEnabled);\n\n\tconst handleClick = React.useCallback(\n\t\t(optionValue: string) => {\n\t\t\tif (optionValue === value) {\n\t\t\t\tif (allowClear) onValueChange(null);\n\t\t\t} else {\n\t\t\t\tonValueChange(optionValue);\n\t\t\t}\n\t\t},\n\t\t[allowClear, onValueChange, value],\n\t);\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\tconst enabled = options.map((option, index) => (isEnabled(option) ? index : -1)).filter((index) => index >= 0);\n\t\tif (!enabled.length) return;\n\t\tconst current = buttonRefs.current.findIndex((button) => button === event.target);\n\t\tif (current < 0) return;\n\t\tconst rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n\t\tconst forward = rtl ? new Set(['ArrowLeft', 'ArrowDown']) : NEXT_KEYS;\n\t\tconst backward = rtl ? new Set(['ArrowRight', 'ArrowUp']) : PREVIOUS_KEYS;\n\t\tconst position = enabled.indexOf(current);\n\t\tlet next: number | undefined;\n\t\tif (forward.has(event.key)) next = enabled[(position + 1) % enabled.length];\n\t\telse if (backward.has(event.key)) next = enabled[(position - 1 + enabled.length) % enabled.length];\n\t\telse if (event.key === 'Home') next = enabled[0];\n\t\telse if (event.key === 'End') next = enabled[enabled.length - 1];\n\t\tif (next === undefined) return;\n\t\tevent.preventDefault();\n\t\tbuttonRefs.current[next]?.focus();\n\t\t// Moving within a radio group selects, as native radios do.\n\t\tif (options[next].value !== value) onValueChange(options[next].value);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tdata-name={name}\n\t\t\trole=\"radiogroup\"\n\t\t\taria-label={ariaLabel}\n\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\taria-invalid={invalid || undefined}\n\t\t\taria-disabled={disabled || undefined}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tclassName={cn('pill-radio-group--component',\n\t\t\t\t'border-input inline-flex items-center overflow-hidden rounded-inner border',\n\t\t\t\tformControlSizeClasses[size],\n\t\t\t\tfullWidth ? 'w-full' : 'w-fit self-start',\n\t\t\t\t// The group is the field frame: validation marks it once, and the\n\t\t\t\t// focused pill draws the inset focus recipe inside it.\n\t\t\t\tfieldStateRecipes.invalid,\n\t\t\t\t// A disabled group dims once; its pills do not dim again.\n\t\t\t\tdisabled && 'pointer-events-none opacity-50',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{options.map((option, index) => {\n\t\t\t\tconst isSelected = option.value === value;\n\t\t\t\tconst Icon = option.icon;\n\t\t\t\tconst optionLabel =\n\t\t\t\t\ttypeof option.label === 'string' ? option.label : undefined;\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\tref={(node) => { buttonRefs.current[index] = node; }}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"radio\"\n\t\t\t\t\t\taria-checked={isSelected}\n\t\t\t\t\t\taria-label={optionLabel || option.value}\n\t\t\t\t\t\tdisabled={disabled || option.disabled}\n\t\t\t\t\t\ttabIndex={index === tabStopIndex ? 0 : -1}\n\t\t\t\t\t\tonClick={() => handleClick(option.value)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'box-border inline-flex select-none items-center justify-center border-0 p-0 font-sans font-medium transition-colors',\n\t\t\t\t\t\t\t// Inset, so the frame's clipped rounded corners never cut the ring.\n\t\t\t\t\t\t\t`outline-none focus-visible:z-10 ${focusRecipes.inset}`,\n\t\t\t\t\t\t\t'disabled:pointer-events-none',\n\t\t\t\t\t\t\t!disabled && 'disabled:opacity-50',\n\t\t\t\t\t\t\tchoicePillSizeTokens[size],\n\t\t\t\t\t\t\t'h-full min-h-0',\n\t\t\t\t\t\t\tfullWidth && 'flex-1',\n\t\t\t\t\t\t\tindex > 0 && 'border-input border-s',\n\t\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t\t? 'bg-primary text-primary-foreground focus-visible:inset-ring-primary-foreground focus-visible:ring-primary-foreground/50'\n\t\t\t\t\t\t\t\t: 'bg-background text-foreground hover:bg-muted',\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!!Icon && <Icon className={cn(size === 'sm' ? 'size-icon-sm' : 'size-icon', option.label && 'me-space-sm')} />}\n\t\t\t\t\t\t{typeof option.label === 'string' || typeof option.label === 'number' || typeof option.label === 'bigint' ? (\n\t\t\t\t\t\t\t<Text tag=\"span\" size=\"inherit\" weight=\"medium\" lineHeight=\"tight\" className=\"text-inherit\">\n\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : option.label}\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n});\n\nPillRadioGroup.displayName = 'PillRadioGroup';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,KAASC,EAAgB;AAE/B,SAAS0D,EAAY,EAAE,cAAW,GAAGC,KAAsC;CACzE,OACE,kBAAC3D,EAAgB,OAAjB;EACE,aAAU;EACV,WAAW+B,EAAG,eAAe6B,CAAS;EACtC,GAAID;CACL,CAAA;AAEL;AAEA,SAASE,GAAY,EAAE,cAAW,GAAGF,KAAsC;CACzE,OACE,kBAAC3D,EAAgB,OAAjB;EACE,aAAU;EACV,WAAW+B,EAAG,0BAA0B6B,CAAS;EACjD,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E,EAAO;IAC7B,UAAU4H,MAAUJ,IAAe,IAAI;IACvC,eAAeC,EAAYzH,EAAO,KAAK;IACvC,WAAWrE,EACV,uHAEA,mCAAmCK,EAAa,SAChD,gCACA,CAACqI,KAAY,uBACbpB,GAAqBtF,IACrB,kBACAyK,KAAa,UACbR,IAAQ,KAAK,yBACbzB,IACG,4HACA,8CACJ;IAvBD,UAAA,CAyBE,CAAC,CAAC3C,KAAQ,kBAACA,GAAD,EAAM,WAAW7H,EAAGgC,MAAS,OAAO,iBAAiB,aAAaqC,EAAO,SAAS,aAAa,EAAI,CAAA,GAC7G,OAAOA,EAAO,SAAU,YAAY,OAAOA,EAAO,SAAU,YAAY,OAAOA,EAAO,SAAU,WAChG,kBAACnE,GAAD;KAAM,KAAI;KAAO,MAAK;KAAU,QAAO;KAAS,YAAW;KAAQ,WAAU;KAC3E,UAAAmE,EAAO;IACH,CAAA,IACHA,EAAO,KACJ;GA9BF,GAAAA,EAAO,KA8BL;EAEV,CAAC;CACG,CAAA;AAEP,CAAC;AAED,GAAe,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"comments-DD0DUPwJ.js","names":["ImageIcon","_Fragment","NumberValue","_Fragment","useCommentsUIDefaults","useCommentsConfig","useDatesConfig","cn","Button","TextButton","Text","DisplayLabel","TextLink","TooltipTrigger","TooltipContent","TooltipProvider","Tooltip","Stack","toneRecipes","rowBlockPaddingClasses","useOverlayVisibility","ConfirmDialog","interactionRecipes","sanitizeHtml","contentTypographyClassName","RichText","SecondaryValue","FileSize","Percent","Number$1","RelativeTime","AvatarFallback","Avatar","AvatarImage","Badge","fieldAffordanceRecipes","PopoverTrigger","Popover","EmptyState","RichTextEditor","useMentions","MentionInlineSuggestions","MentionContent","MentionPicker","parseMentionsFromHtml","Fragment$1","defaultCommentsStrings","useResolvedStrings","useStrings","propStrings","useResolvedAccessors","dates","useMemo","propAccessors","useComments","options","composerMode","setComposerMode","useState","isSubmitting","setIsSubmitting","isSubmittingRef","useRef","formErrors","setFormErrors","resetKey","setResetKey","setSubmitting","useCallback","submitting","resetComposer","k","helpers","reportError","error","onError","comment","onUpdate","payload","values","onAfterMutate","onSubmit","onDelete","id","pickIcon","att","Image","FileText","File","Paperclip","CommentAttachmentChip","stringsProp","strings","url","accessors","attachment","name","Icon","isUploading","isFailed","meta","surface","compact","className","iconNode","Loader2","labelRow","onRetry","editable","onRemove","X","defaultAttachmentUploadStrings","useAttachmentUpload","attachments","setAttachmentsState","initialAttachments","inFlightRef","fileCacheRef","attachmentsRef","commitAttachments","list","next","onValueChangeRef","onValueChange","updateAttachment","a","patch","setAttachments","beginUpload","onUpload","controller","uploaded","message","err","addFiles","disabled","files","filesInput","pending","file","maxFiles","maxSize","removeAttachment","entry","retryAttachment","reset","useEffect","inFlight","cache","hasMeaningfulContent","html","CommentComposer","forwardRef","resourcesProp","onResourceSearchProp","attachmentsProp","maxAttachmentsProp","allowAttachmentsProp","resources","onResourceSearch","allowAttachments","maxAttachments","attachmentsConfig","editorRef","body","setBody","initialValues","editingComment","contentError","setContentError","attachmentError","setAttachmentError","mentions","attachmentUpload","handleCancel","onCancel","useImperativeHandle","ref","context","errors","handleSubmit","event","replyingTo","fileInputRef","handleAttachmentClick","handleFiles","hasAttachments","isEditing","isReplying","submitLabel","eyebrow","ComposerEyebrow","makeReplyEyebrow","extraToolbarItems","items","AtSign","canComment","submitButton","cancelButton","attachmentChips","footerSlot","trailingSubmit","inlineSubmit","showFooterRow","kind","parsed","previous","m","byId","merged","p","placeholder","autoFocus","label","onClose","closeLabel","interpolateString","template","CommentEmpty","icon","MessageCircle","CommentContent","props","contentType","richContent","renderRichContent","renderReference","plainContent","decodeQuotedString","rawContent","Fragment","renderRichBlock","block","index","decoded","data","raw","text","stripHtml","level","createElement","sanitizedItems","item","caption","value","trimmed","FALLBACK_INITIAL","defaultGetMediaUrl","defaultGetMediaName","defaultGetStatusLabel","s","CommentItem","memo","allowReactionsProp","allowRepliesProp","allowReactions","allowReplies","resolvedGetMediaUrl","resolvedGetMediaName","resolvedGetStatusLabel","resolvedFormatRelativeTime","authorName","avatarUrl","fallbackInitial","tagList","tag","reactions","isPinned","isEdited","showStatus","statusLabel","canDeleteComment","canModerate","canEditComment","canReply","onReply","canReact","onReact","canPin","onPinToggle","canEdit","onEdit","canDelete","hasActions","attachmentConfirm","pendingAttachmentId","setPendingAttachmentId","requestAttachmentRemoval","attachmentId","Pin","renderAttachment","canRemoveAttachment","onAttachmentRemove","reaction","CornerDownRight","Smile","Pencil","Trash2","CommentTimeline","comments","defaultItem","renderItem","emptySlot","Comments","ui","composerPosition","title","confirmDelete","deleteConfirm","pendingDeleteId","setPendingDeleteId","commentsState","requestDelete","startReply","handleReply","commentId","composer","timeline","composerBlock","inner","ariaLabel"],"sources":["../src/components/features/comments/comments.strings.ts","../src/components/features/comments/comments-provider.tsx","../src/components/features/comments/hooks/use-comments.ts","../src/components/features/comments/partials/comment-attachment-chip.tsx","../src/components/features/comments/hooks/use-attachment-upload.ts","../src/components/features/comments/partials/comment-composer.tsx","../src/components/features/comments/partials/comment-empty.tsx","../src/components/features/comments/partials/comment-content.tsx","../src/components/features/comments/partials/comment-item.tsx","../src/components/features/comments/partials/comment-timeline.tsx","../src/components/features/comments/comments.tsx"],"sourcesContent":["/**\n * Strings for the Comments feature. Consumers override via the `strings`\n * prop on `<Comments>` / sub-components — values are\n * deep-merged over these defaults.\n */\nexport interface CommentsStrings {\n\t/** Card title — usually \"Comments\". Set to \"\" to hide. */\n\ttitle: string;\n\t/** Subtitle under the card title — optional. */\n\tsubtitle: string;\n\t/** Empty-state copy for the timeline. */\n\tempty: string;\n\t/** Empty-state secondary copy. */\n\temptyHint: string;\n\n\t// Composer ---------------------------------------------------------\n\t/** Composer rich-text placeholder. */\n\tcomposerPlaceholder: string;\n\t/** Submit label for new comments. */\n\tcomposerSubmit: string;\n\t/** Submit label while pending. */\n\tcomposerSubmitting: string;\n\t/** Submit label when editing. */\n\tcomposerSave: string;\n\t/** Required-content error. */\n\tinvalidContent: string;\n\t/** Cancel/dismiss draft. */\n\tcomposerCancel: string;\n\t/** \"Edit comment\" eyebrow shown above the composer in edit mode. */\n\tcomposerEditingEyebrow: string;\n\t/** \"Reply to {{name}}\" eyebrow shown above the composer in reply mode. */\n\tcomposerReplyingEyebrow: string;\n\n\t// Toolbar buttons --------------------------------------------------\n\tcomposerAttachmentLabel: string;\n\t/** Control that inserts a mention or link. */\n\tcomposerReferenceLabel: string;\n\t/** Heading of the insert-reference menu. */\n\tcomposerReferenceMenuTitle: string;\n\t/** Placeholder in the reference search field. */\n\tcomposerReferenceSearchPlaceholder: string;\n\t/** Shown when a reference search matches nothing. */\n\tcomposerReferenceEmpty: string;\n\t/** Shown while reference results are loading. */\n\tcomposerReferenceLoading: string;\n\n\t// Item -------------------------------------------------------------\n\tfallbackAuthor: string;\n\t/** Chip marking a pinned comment. */\n\tpinned: string;\n\t/** Suffix marking an edited comment. */\n\tedited: string;\n\t/** Trash button aria-label / tooltip. */\n\tdeleteLabel: string;\n\t/** Edit button label. */\n\teditLabel: string;\n\t/** Reply button label. */\n\treplyLabel: string;\n\t/** Pin/unpin button label. */\n\tpinLabel: string;\n\t/** Action that unpins a comment. */\n\tunpinLabel: string;\n\t/** \"More actions\" trigger aria-label. */\n\tmoreActionsLabel: string;\n\t/** Confirm-delete button label inside the action menu. */\n\tconfirmDeleteLabel: string;\n\t/** Title of the confirmation shown before a comment is deleted. */\n\tconfirmDeleteTitle: string;\n\t/** Title of the confirmation shown before an attachment is removed. */\n\tconfirmRemoveAttachmentTitle: string;\n\t/** Consequence of removing an attachment from a posted comment. */\n\tconfirmRemoveAttachmentDescription: string;\n\t/** Sentence explaining the consequence before the delete is committed. */\n\tconfirmDeleteDescription: string;\n\n\t// Attachments ------------------------------------------------------\n\tattachmentFallback: string;\n\t/** Removes an attachment — staged in the composer, or posted on a comment. */\n\tattachmentRemoveLabel: string;\n\t/** Shown while an attachment uploads. */\n\tattachmentUploadingLabel: string;\n\t/** Shown when an attachment upload fails. */\n\tattachmentFailedLabel: string;\n\t/** Shown when a file exceeds the size limit. */\n\tattachmentTooLargeError: string;\n\t/** Shown when too many files are attached. */\n\tattachmentTooManyError: string;\n\t/** Action that retries a failed upload. */\n\tattachmentRetryLabel: string;\n\t/** Action that downloads an attachment. */\n\tattachmentDownloadLabel: string;\n\n\t// Reactions --------------------------------------------------------\n\taddReactionLabel: string;\n\t/** Reaction button name; interpolates {{emoji}} and {{count}}. Optional for existing complete string objects. */\n\treactionLabel?: string;\n\n\t// Misc -------------------------------------------------------------\n\tshowRepliesLabel: string;\n\t/** Control that collapses a reply thread. */\n\thideRepliesLabel: string;\n}\n\nexport const defaultCommentsStrings: CommentsStrings = {\n\ttitle: 'Comments',\n\tsubtitle: '',\n\tempty: 'No comments yet.',\n\temptyHint: 'Start the conversation — your team will see it instantly.',\n\n\tcomposerPlaceholder: 'Write a comment…',\n\tcomposerSubmit: 'Post comment',\n\tcomposerSubmitting: 'Posting…',\n\tcomposerSave: 'Save changes',\n\tinvalidContent: 'Comment cannot be empty.',\n\tcomposerCancel: 'Cancel',\n\tcomposerEditingEyebrow: 'Editing comment',\n\tcomposerReplyingEyebrow: 'Replying to {{name}}',\n\n\tcomposerAttachmentLabel: 'Attach file',\n\tcomposerReferenceLabel: 'Mention or link',\n\tcomposerReferenceMenuTitle: 'Insert reference',\n\tcomposerReferenceSearchPlaceholder: 'Search…',\n\tcomposerReferenceEmpty: 'No matches.',\n\tcomposerReferenceLoading: 'Searching…',\n\n\tfallbackAuthor: 'Anonymous',\n\tpinned: 'Pinned',\n\tedited: 'edited',\n\tdeleteLabel: 'Delete',\n\teditLabel: 'Edit',\n\treplyLabel: 'Reply',\n\tpinLabel: 'Pin',\n\tunpinLabel: 'Unpin',\n\tmoreActionsLabel: 'More actions',\n\tconfirmDeleteLabel: 'Delete comment',\n\tconfirmDeleteTitle: 'Delete this comment?',\n\tconfirmRemoveAttachmentTitle: 'Remove this attachment?',\n\tconfirmRemoveAttachmentDescription: 'The file is detached from the comment for everyone. This cannot be undone.',\n\tconfirmDeleteDescription: 'The comment and its replies are removed for everyone. This cannot be undone.',\n\n\tattachmentFallback: 'Attachment',\n\tattachmentRemoveLabel: 'Remove attachment',\n\tattachmentUploadingLabel: 'Uploading…',\n\tattachmentFailedLabel: 'Upload failed',\n\tattachmentTooLargeError: 'File is too large.',\n\tattachmentTooManyError: 'Too many attachments.',\n\tattachmentRetryLabel: 'Retry',\n\tattachmentDownloadLabel: 'Download',\n\n\taddReactionLabel: 'Add reaction',\n\treactionLabel: 'Reaction {{emoji}}: {{count}}',\n\n\tshowRepliesLabel: 'Show replies',\n\thideRepliesLabel: 'Hide replies',\n};\n","/**\n * Comments — internal helper hooks for resolving strings and accessors.\n *\n * Rationale: the previous `<CommentsProvider>` is gone. Library-wide\n * Per-mount overrides flow as direct props on `<Comments>` and its partials.\n * Date formatting may still inherit the app-wide dates configuration.\n *\n * Resolution order everywhere:\n *\n * props.strings ← deep-merged over `defaultCommentsStrings`\n * props.accessor.X ← falls back to UIProvider's dates formatter, then\n * to a built-in default at the call site.\n */\nimport { useMemo } from 'react';\n\nimport { useStrings, type StringsProp } from '../../../lib/strings';\nimport { useDatesConfig } from '../../../lib/ui-provider';\n\nimport {\n\tdefaultCommentsStrings,\n\ttype CommentsStrings,\n} from './comments.strings';\nimport type { CommentsAccessors } from './comments.types';\n\n/**\n * Resolve final strings by merging defaults → component prop. Stable\n * identity when the prop reference is unchanged.\n */\nexport function useResolvedStrings(\n\tpropStrings?: StringsProp<CommentsStrings>,\n): CommentsStrings {\n\treturn useStrings(defaultCommentsStrings, propStrings);\n}\n\n/**\n * Resolve accessors. Order:\n * 1. explicit prop accessor\n * 2. the UIProvider date formatter for relative time\n * 3. caller's own fallback when neither is present (handled at call site)\n */\nexport function useResolvedAccessors(\n\tpropAccessors?: CommentsAccessors,\n): CommentsAccessors {\n\tconst dates = useDatesConfig();\n\treturn useMemo<CommentsAccessors>(\n\t\t() => ({\n\t\t\tgetMediaUrl: propAccessors?.getMediaUrl,\n\t\t\tgetMediaName: propAccessors?.getMediaName,\n\t\t\tgetStatusLabel: propAccessors?.getStatusLabel,\n\t\t\tformatRelativeTime:\n\t\t\t\tpropAccessors?.formatRelativeTime ?? dates.formatRelativeTime,\n\t\t}),\n\t\t[propAccessors, dates.formatRelativeTime],\n\t);\n}\n","/**\n * useComments — headless state machine for the Comments feature.\n *\n * Tracks composer mode (idle | replying | editing), submit/delete\n * helpers, error state, and resetKey bumping. The default `<Comments>`\n * component composes this hook; consumers building a fully custom UI\n * can use it directly.\n */\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\nimport type {\n\tCommentData,\n\tCommentFormValues,\n\tCommentSubmitHelpers,\n\tCommentUser,\n\tCommentsConfig,\n} from '../comments.types';\n\nexport type ComposerMode<\n\tTResource extends string = string,\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n> =\n\t| { kind: 'idle' }\n\t| { kind: 'editing'; comment: CommentData<TUser, TMeta, TResource> }\n\t| { kind: 'replying'; commentId: string; authorName?: string };\n\nexport interface UseCommentsOptions<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n> {\n\tonSubmit?: CommentsConfig<TUser, TMeta, TResource>['onSubmit'];\n\tonUpdate?: CommentsConfig<TUser, TMeta, TResource>['onUpdate'];\n\tonDelete?: CommentsConfig<TUser, TMeta, TResource>['onDelete'];\n\tonAfterMutate?: CommentsConfig<TUser, TMeta, TResource>['onAfterMutate'];\n\tonError?: CommentsConfig<TUser, TMeta, TResource>['onError'];\n}\n\nexport interface UseCommentsReturn<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n> {\n\tcomposerMode: ComposerMode<TResource, TUser, TMeta>;\n\tisSubmitting: boolean;\n\tformErrors: Record<string, string>;\n\tresetKey: number;\n\n\tstartReply: (comment: CommentData<TUser, TMeta, TResource>) => void;\n\tstartEdit: (comment: CommentData<TUser, TMeta, TResource>) => void;\n\tcancelComposerMode: () => void;\n\n\tsubmit: (values: CommentFormValues<TResource>) => Promise<void>;\n\tdeleteComment: (id: string) => Promise<void>;\n\n\t/** Imperative reset — bumps `resetKey` so the composer clears itself. */\n\tresetComposer: () => void;\n\t/** Helpers exposed to onSubmit/onUpdate. */\n\thelpers: CommentSubmitHelpers;\n}\n\nexport function useComments<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>(\n\toptions: UseCommentsOptions<TUser, TMeta, TResource> = {},\n): UseCommentsReturn<TUser, TMeta, TResource> {\n\tconst { onSubmit, onUpdate, onDelete, onAfterMutate, onError } = options;\n\n\tconst [composerMode, setComposerMode] = useState<\n\t\tComposerMode<TResource, TUser, TMeta>\n\t>({\n\t\tkind: 'idle',\n\t});\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst isSubmittingRef = useRef(false);\n\tconst [formErrors, setFormErrors] = useState<Record<string, string>>({});\n\tconst [resetKey, setResetKey] = useState(0);\n\n\tconst setSubmitting = useCallback((submitting: boolean) => {\n\t\tisSubmittingRef.current = submitting;\n\t\tsetIsSubmitting(submitting);\n\t}, []);\n\n\tconst resetComposer = useCallback(() => {\n\t\tsetResetKey((k) => k + 1);\n\t\tsetComposerMode({ kind: 'idle' });\n\t\tsetFormErrors({});\n\t\tsetSubmitting(false);\n\t}, [setSubmitting]);\n\n\tconst helpers = useMemo<CommentSubmitHelpers>(\n\t\t() => ({\n\t\t\tsetErrors: setFormErrors,\n\t\t\treset: resetComposer,\n\t\t\tsetSubmitting,\n\t\t}),\n\t\t[resetComposer, setSubmitting],\n\t);\n\n\tconst reportError = useCallback(\n\t\t(error: unknown) => {\n\t\t\ttry {\n\t\t\t\tonError?.(error);\n\t\t\t} catch (callbackError) {\n\t\t\t\tif (import.meta.env?.DEV) {\n\t\t\t\t\tconsole.warn('[Comments] onError callback failed.', callbackError);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[onError],\n\t);\n\n\tconst startReply = useCallback(\n\t\t(comment: CommentData<TUser, TMeta, TResource>) => {\n\t\t\tif (!comment.id) return;\n\t\t\tsetFormErrors({});\n\t\t\tsetComposerMode({\n\t\t\t\tkind: 'replying',\n\t\t\t\tcommentId: comment.id,\n\t\t\t\tauthorName: comment.user?.name,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\n\tconst startEdit = useCallback(\n\t\t(comment: CommentData<TUser, TMeta, TResource>) => {\n\t\t\tif (!comment.id) return;\n\t\t\tsetFormErrors({});\n\t\t\tsetComposerMode({ kind: 'editing', comment });\n\t\t},\n\t\t[],\n\t);\n\n\tconst cancelComposerMode = useCallback(() => {\n\t\tresetComposer();\n\t}, [resetComposer]);\n\n\tconst submit = useCallback(\n\t\tasync (values: CommentFormValues<TResource>) => {\n\t\t\tif (composerMode.kind === 'editing' && composerMode.comment.id) {\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tif (isSubmittingRef.current) return;\n\n\t\t\t\tconst payload = {\n\t\t\t\t\t...values,\n\t\t\t\t\teditingId: composerMode.comment.id,\n\t\t\t\t};\n\t\t\t\tsetSubmitting(true);\n\t\t\t\tsetFormErrors({});\n\t\t\t\ttry {\n\t\t\t\t\tawait onUpdate(composerMode.comment.id, payload, helpers);\n\t\t\t\t\tonAfterMutate?.('update', payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\treportError(error);\n\t\t\t\t} finally {\n\t\t\t\t\tsetSubmitting(false);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!onSubmit) return;\n\t\t\tif (isSubmittingRef.current) return;\n\n\t\t\tconst payload: CommentFormValues<TResource> =\n\t\t\t\tcomposerMode.kind === 'replying'\n\t\t\t\t\t? { ...values, replyToId: composerMode.commentId }\n\t\t\t\t\t: values;\n\n\t\t\tsetSubmitting(true);\n\t\t\tsetFormErrors({});\n\t\t\ttry {\n\t\t\t\tawait onSubmit(payload, helpers);\n\t\t\t\tonAfterMutate?.('create', payload);\n\t\t\t} catch (error) {\n\t\t\t\treportError(error);\n\t\t\t} finally {\n\t\t\t\tsetSubmitting(false);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tcomposerMode,\n\t\t\thelpers,\n\t\t\tonAfterMutate,\n\t\t\tonSubmit,\n\t\t\tonUpdate,\n\t\t\treportError,\n\t\t\tsetSubmitting,\n\t\t],\n\t);\n\n\tconst deleteComment = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onDelete || !id) return;\n\t\t\ttry {\n\t\t\t\tawait onDelete(id);\n\t\t\t\tonAfterMutate?.('delete', { commentId: id });\n\t\t\t} catch (error) {\n\t\t\t\treportError(error);\n\t\t\t}\n\t\t},\n\t\t[onAfterMutate, onDelete, reportError],\n\t);\n\n\treturn {\n\t\tcomposerMode,\n\t\tisSubmitting,\n\t\tformErrors,\n\t\tresetKey,\n\t\tstartReply,\n\t\tstartEdit,\n\t\tcancelComposerMode,\n\t\tsubmit,\n\t\tdeleteComment,\n\t\tresetComposer,\n\t\thelpers,\n\t};\n}\n","/**\n * CommentAttachmentChip — small attachment pill used in the composer draft\n * and the timeline. Single inline row: icon + name · size, with progress /\n * error states overlaid on the same line. Editable mode reveals a remove\n * button; failed uploads expose a retry pill.\n */\nimport { File, FileText, Image as ImageIcon, Loader2, Paperclip, X } from 'lucide-react';\nimport type { FC, ReactNode } from 'react';\n\nimport { TextButton } from '../../../base/buttons';\nimport { FileSize, Percent, SecondaryValue } from '../../../primitives';\nimport { Text, TextLink } from '../../../typography';\nimport { useStrings, type StringsProp } from '../../../../lib/strings';\nimport { cn } from '../../../../lib/utils';\nimport { rowBlockPaddingClasses } from '../../../../lib/row-recipes';\nimport { fieldAffordanceRecipes } from '../../../../lib/field-affordance-recipes';\n\nimport type {\n\t\tCommentAttachment,\n\t\tCommentsAccessors,\n} from '../comments.types';\nimport {\n\t\tdefaultCommentsStrings,\n\t\ttype CommentsStrings,\n} from '../comments.strings';\nimport { interactionRecipes } from '../../../../lib/interaction-recipes';\nimport { toneRecipes } from '../../../../lib/tone-recipes';\n\nexport interface CommentAttachmentChipProps {\n\t\t/** The attachment this chip represents. */\n\t\tattachment: CommentAttachment;\n\t\t/** Editable mode shows a remove button. */\n\t\teditable?: boolean;\n\t\t/** Fired when an entry is removed. */\n\t\tonRemove?: (id: string) => void;\n\t\t/** Fired when the user retries after an entry failure. */\n\t\tonRetry?: (id: string) => void;\n\t\t/** Reads the fields this surface needs off your own shape. */\n\t\taccessors?: CommentsAccessors;\n\t\t/** Overrides this surface's own copy. */\n\t\tstrings?: StringsProp<CommentsStrings>;\n\t\t/** Compact chips have smaller text and tighter padding. */\n\t\tcompact?: boolean;\n\t\t/** Merged onto the outermost node. */\n\t\tclassName?: string;\n}\n\nfunction pickIcon(att: CommentAttachment) {\n\t\tif (att.mimeType?.startsWith('image/')) return ImageIcon;\n\t\tif (att.mimeType === 'application/pdf') return FileText;\n\t\tif (att.mimeType?.startsWith('text/')) return FileText;\n\t\tif (att.mimeType) return File;\n\t\treturn Paperclip;\n}\n\nexport const CommentAttachmentChip: FC<CommentAttachmentChipProps> = ({\n\t\tattachment,\n\t\teditable = false,\n\t\tonRemove,\n\t\tonRetry,\n\t\taccessors,\n\t\tstrings: stringsProp,\n\t\tcompact = false,\n\t\tclassName,\n}) => {\n\t\tconst strings = useStrings(defaultCommentsStrings, stringsProp);\n\n\t\tconst url = accessors?.getMediaUrl?.(attachment) ?? attachment.url;\n\t\tconst name =\n\t\t\t\taccessors?.getMediaName?.(attachment) ??\n\t\t\t\tattachment.name ??\n\t\t\t\tstrings.attachmentFallback;\n\t\tconst Icon = pickIcon(attachment);\n\n\t\tconst isUploading = attachment.status === 'uploading';\n\t\tconst isFailed = attachment.status === 'failed';\n\t\tconst meta: ReactNode = isUploading\n\t\t\t\t? (\n\t\t\t\t\t\t<SecondaryValue size=\"xs\" className=\"shrink-0\">\n\t\t\t\t\t\t\t\t{strings.attachmentUploadingLabel}\n\t\t\t\t\t\t\t\t{typeof attachment.progress === 'number' ? (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t{' '}\n\t\t\t\t\t\t\t\t\t\t\t\t<Percent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={Math.round(attachment.progress)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tscaled\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\talign=\"left\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</SecondaryValue>\n\t\t\t\t)\n\t\t\t\t: isFailed\n\t\t\t\t\t? (\n\t\t\t\t\t\t\t<SecondaryValue size=\"xs\" className=\"shrink-0\">\n\t\t\t\t\t\t\t\t\t{attachment.error ?? strings.attachmentFailedLabel}\n\t\t\t\t\t\t\t</SecondaryValue>\n\t\t\t\t\t)\n\t\t\t\t\t: typeof attachment.size === 'number'\n\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t<FileSize value={attachment.size} size=\"xs\" className=\"shrink-0\" />\n\t\t\t\t\t\t)\n\t\t\t\t\t\t: null;\n\n\t\tconst surface = cn(\n\t\t'comment-attachment-chip--component',\n\t\t\t\t'relative inline-flex min-w-0 max-w-[20rem] items-center gap-space-sm rounded-radius',\n\t\t\t\t'ring-1 ring-inset transition-colors',\n\t\t\t\tcompact ? 'px-control-xs' : 'px-control-sm',\n\t\t\t\trowBlockPaddingClasses.compact,\n\t\t\t\tisFailed\n\t\t\t\t\t\t? `${toneRecipes.destructive.tint} ${toneRecipes.destructive.halo}`\n\t\t\t\t\t\t: `bg-muted ring-border/60 ${interactionRecipes.rowHover}`,\n\t\t\t\tclassName,\n\t\t);\n\n\t\tconst iconNode = isUploading ? (\n\t\t\t\t<Loader2\n\t\t\t\t\t\tclassName={cn('shrink-0 animate-spin text-muted-foreground', 'size-icon-md')}\n\t\t\t\t\t\taria-hidden\n\t\t\t\t/>\n\t\t) : (\n\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'shrink-0',\n\t\t\t\t\t\t\t\t'size-icon-md',\n\t\t\t\t\t\t\t\tisFailed ? 'text-destructive' : 'text-muted-foreground',\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-hidden\n\t\t\t\t/>\n\t\t);\n\n\t\tconst labelRow = (\n\t\t\t\t<span className=\"inline-flex min-w-0 items-baseline gap-space-sm\">\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\tweight=\"medium\"\n\t\t\t\t\t\t\t\tclassName={cn('truncate', isFailed && 'text-destructive')}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{name}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t{meta}\n\t\t\t\t</span>\n\t\t);\n\n\t\tconst isInteractive = !!url && !isUploading && !isFailed;\n\n\t\treturn (\n\t\t\t\t<div className={surface}>\n\t\t\t\t\t\t{iconNode}\n\t\t\t\t\t\t{isInteractive ? (\n\t\t\t\t<TextLink\n\t\t\t\t\thref={url}\n\t\t\t\t\tsize=\"inherit\"\n\t\t\t\t\tunderline={false}\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\tclassName=\"inline-flex min-w-0 flex-1 items-baseline gap-space-sm hover:underline\"\n\t\t\t\t\t\t\t\t\t\taria-label={strings.attachmentDownloadLabel}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{labelRow}\n\t\t\t\t</TextLink>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\tlabelRow\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{isUploading && typeof attachment.progress === 'number' && (\n\t\t\t\t\t\t\t\t<div className={cn(toneRecipes.primary.line, 'absolute bottom-0 left-2 right-2 h-px overflow-hidden rounded-full')}>\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"bg-primary h-full transition-[width]\"\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth: `${Math.min(100, Math.max(0, attachment.progress))}%`,\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{isFailed && onRetry && (\n\t\t\t\t\t\t\t\t<TextButton\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => onRetry(attachment.id)}\n\t\t\t\t\t\t\t\t\t\tclassName=\"shrink-0 text-destructive decoration-destructive/30 hover:decoration-destructive/60\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" weight=\"medium\" className=\"text-inherit\">{strings.attachmentRetryLabel}</Text>\n\t\t\t\t\t\t\t\t</TextButton>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{editable && onRemove && (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => onRemove(attachment.id)}\n\t\t\t\t\t\t\t\t\t\tclassName={cn(fieldAffordanceRecipes.target, fieldAffordanceRecipes.focus, fieldAffordanceRecipes.toggle)}\n\t\t\t\t\t\t\t\t\t\taria-label={strings.attachmentRemoveLabel}\n\t\t\t\t\t\t\t\t\t\ttitle={strings.attachmentRemoveLabel}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<X className={fieldAffordanceRecipes.icon} aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t);\n};\n","/**\n * useAttachmentUpload — manages a list of in-flight + uploaded\n * `CommentAttachment`s for a comment composer.\n *\n * Pass the consumer-supplied `onUpload` callback directly via the\n * `attachments` prop on `<Comments>` (or `<CommentComposer>`). Aborts\n * in-flight uploads when an attachment is removed.\n */\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useStrings, type StringsProp } from '../../../../lib/strings';\nimport { defaultCommentsStrings, type CommentsStrings } from '../comments.strings';\n\nimport type {\n\tCommentAttachment,\n\tCommentsAttachmentsConfig,\n} from '../comments.types';\n\ninterface InFlightEntry {\n\tcontroller: AbortController;\n}\n\nconst defaultAttachmentUploadStrings = {\n\tattachmentTooLargeError: defaultCommentsStrings.attachmentTooLargeError,\n\tattachmentTooManyError: defaultCommentsStrings.attachmentTooManyError,\n\tattachmentFailedLabel: defaultCommentsStrings.attachmentFailedLabel,\n};\n\nexport interface UseAttachmentUploadOptions extends CommentsAttachmentsConfig {\n\t/** Initial attachments — useful when editing an existing comment. */\n\tinitialAttachments?: ReadonlyArray<CommentAttachment>;\n\t/** Fires when the list of uploaded attachments changes. */\n\tonValueChange?: (attachments: ReadonlyArray<CommentAttachment>) => void;\n\t/** Fires when a validation or upload error happens. */\n\tonError?: (error: string) => void;\n\t/** Validation and non-Error upload fallback copy; omitted keys use Comments defaults.\n\t * Error objects retain their caller-supplied message. */\n\tstrings?: StringsProp<Pick<CommentsStrings, 'attachmentTooLargeError' | 'attachmentTooManyError' | 'attachmentFailedLabel'>>;\n}\n\nexport interface UseAttachmentUploadReturn {\n\t/** All attachments — uploading + uploaded + failed. */\n\tattachments: ReadonlyArray<CommentAttachment>;\n\t/** Subset of attachments that finished uploading. Use this in the form payload. */\n\tuploadedAttachments: ReadonlyArray<CommentAttachment>;\n\t/** True while at least one upload is in flight. */\n\tisUploading: boolean;\n\t/** Add files. Validates against `maxSize` / `maxFiles` first. */\n\taddFiles: (files: ReadonlyArray<File> | FileList) => void;\n\t/** Remove an attachment by id (aborts in-flight uploads). */\n\tremoveAttachment: (id: string) => void;\n\t/** Retry a failed upload. */\n\tretryAttachment: (id: string) => void;\n\t/** Replace the list (used when editing or after submit). */\n\tsetAttachments: (attachments: ReadonlyArray<CommentAttachment>) => void;\n\t/** Clear the list and abort everything in flight. */\n\treset: () => void;\n}\n\nexport function useAttachmentUpload(\n\toptions: UseAttachmentUploadOptions = {},\n): UseAttachmentUploadReturn {\n\tconst {\n\t\tonUpload,\n\t\tmaxSize,\n\t\tmaxFiles,\n\t\t// `accept` is consumed by the surrounding `<input type=\"file\"\n\t\t// accept>` element, not here — destructuring is intentional\n\t\t// even though we don't reference it inside the hook.\n\t\tdisabled,\n\t\tinitialAttachments,\n\t\tonValueChange,\n\t\tonError,\n\t\tstrings: stringsProp,\n\t} = options;\n\tconst strings = useStrings(defaultAttachmentUploadStrings, stringsProp);\n\n\tconst [attachments, setAttachmentsState] = useState<CommentAttachment[]>(() =>\n\t\tinitialAttachments ? [...initialAttachments] : [],\n\t);\n\tconst inFlightRef = useRef<Map<string, InFlightEntry>>(new Map());\n\tconst fileCacheRef = useRef<Map<string, File>>(new Map());\n\tconst attachmentsRef = useRef(attachments);\n\t// Keep sequential picks and async updates current without calling consumers\n\t// from a React state updater (which StrictMode may evaluate more than once).\n\tconst commitAttachments = useCallback((next: ReadonlyArray<CommentAttachment>) => {\n\t\tconst list = [...next];\n\t\tattachmentsRef.current = list;\n\t\tsetAttachmentsState(list);\n\t}, []);\n\tconst onValueChangeRef = useRef(onValueChange);\n\tonValueChangeRef.current = onValueChange;\n\n\tconst updateAttachment = useCallback(\n\t\t(id: string, patch: Partial<CommentAttachment>) => {\n\t\t\tcommitAttachments(attachmentsRef.current.map((a) => (a.id === id ? { ...a, ...patch } : a)));\n\t\t},\n\t\t[commitAttachments],\n\t);\n\n\tconst setAttachments = useCallback(\n\t\t(next: ReadonlyArray<CommentAttachment>) => {\n\t\t\tcommitAttachments(next);\n\t\t},\n\t\t[commitAttachments],\n\t);\n\n\tconst beginUpload = useCallback(\n\t\t(id: string, file: File) => {\n\t\t\tif (!onUpload || !fileCacheRef.current.has(id)) return;\n\t\t\tconst controller = new AbortController();\n\t\t\tinFlightRef.current.set(id, { controller });\n\n\t\t\tupdateAttachment(id, {\n\t\t\t\tstatus: 'uploading',\n\t\t\t\tprogress: 0,\n\t\t\t\terror: undefined,\n\t\t\t});\n\n\t\t\tconst onProgress = (progress: number) => {\n\t\t\t\tif (controller.signal.aborted) return;\n\t\t\t\tupdateAttachment(id, { progress });\n\t\t\t};\n\n\t\t\tonUpload({ file, onProgress, signal: controller.signal })\n\t\t\t\t.then((uploaded) => {\n\t\t\t\t\tif (controller.signal.aborted) return;\n\t\t\t\t\tinFlightRef.current.delete(id);\n\t\t\t\t\tupdateAttachment(id, {\n\t\t\t\t\t\t...uploaded,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tstatus: 'uploaded',\n\t\t\t\t\t\tprogress: 100,\n\t\t\t\t\t\terror: undefined,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tinFlightRef.current.delete(id);\n\t\t\t\t\tif (controller.signal.aborted) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst message =\n\t\t\t\t\t\terr instanceof Error ? err.message : strings.attachmentFailedLabel;\n\t\t\t\t\tupdateAttachment(id, {\n\t\t\t\t\t\tstatus: 'failed',\n\t\t\t\t\t\terror: message,\n\t\t\t\t\t});\n\t\t\t\t\tonError?.(message);\n\t\t\t\t});\n\t\t},\n\t\t[onError, onUpload, strings.attachmentFailedLabel, updateAttachment],\n\t);\n\n\tconst addFiles = useCallback(\n\t\t(filesInput: ReadonlyArray<File> | FileList) => {\n\t\t\tif (disabled || !onUpload) return;\n\t\t\tconst files = Array.from(filesInput);\n\t\t\tif (files.length === 0) return;\n\n\t\t\tconst next = [...attachmentsRef.current];\n\t\t\tconst pending: Array<{id: string; file: File}> = [];\n\t\t\tfor (const file of files) {\n\t\t\t\tif (\n\t\t\t\t\ttypeof maxFiles === 'number' &&\n\t\t\t\t\tnext.length >= maxFiles\n\t\t\t\t) {\n\t\t\t\t\tonError?.(strings.attachmentTooManyError);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof maxSize === 'number' &&\n\t\t\t\t\tfile.size > maxSize\n\t\t\t\t) {\n\t\t\t\t\tonError?.(strings.attachmentTooLargeError);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst id =\n\t\t\t\t\ttypeof crypto !== 'undefined' && 'randomUUID' in crypto\n\t\t\t\t\t\t? crypto.randomUUID()\n\t\t\t\t\t\t: `att-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n\n\t\t\t\tfileCacheRef.current.set(id, file);\n\n\t\t\t\tnext.push({\n\t\t\t\t\tid,\n\t\t\t\t\tname: file.name,\n\t\t\t\t\tsize: file.size,\n\t\t\t\t\tmimeType: file.type,\n\t\t\t\t\tstatus: 'uploading',\n\t\t\t\t\tprogress: 0,\n\t\t\t\t});\n\n\t\t\t\tpending.push({id, file});\n\t\t\t}\n\t\t\tcommitAttachments(next);\n\t\t\tfor (const {id, file} of pending) queueMicrotask(() => beginUpload(id, file));\n\t\t},\n\t\t[beginUpload, commitAttachments, disabled, maxFiles, maxSize, onError, onUpload, strings.attachmentTooLargeError, strings.attachmentTooManyError],\n\t);\n\n\tconst removeAttachment = useCallback((id: string) => {\n\t\tconst entry = inFlightRef.current.get(id);\n\t\tif (entry) {\n\t\t\tentry.controller.abort();\n\t\t\tinFlightRef.current.delete(id);\n\t\t}\n\t\tfileCacheRef.current.delete(id);\n\t\tcommitAttachments(attachmentsRef.current.filter((a) => a.id !== id));\n\t}, [commitAttachments]);\n\n\tconst retryAttachment = useCallback(\n\t\t(id: string) => {\n\t\t\tconst file = fileCacheRef.current.get(id);\n\t\t\tif (!file) return;\n\t\t\tbeginUpload(id, file);\n\t\t},\n\t\t[beginUpload],\n\t);\n\n\tconst reset = useCallback(() => {\n\t\tfor (const entry of inFlightRef.current.values()) {\n\t\t\tentry.controller.abort();\n\t\t}\n\t\tinFlightRef.current.clear();\n\t\tfileCacheRef.current.clear();\n\t\tcommitAttachments([]);\n\t}, [commitAttachments]);\n\n\tuseEffect(() => {\n\t\tonValueChangeRef.current?.(attachments);\n\t}, [attachments]);\n\n\tuseEffect(() => {\n\t\tconst inFlight = inFlightRef.current;\n\t\tconst cache = fileCacheRef.current;\n\t\treturn () => {\n\t\t\tfor (const entry of inFlight.values()) {\n\t\t\t\tentry.controller.abort();\n\t\t\t}\n\t\t\tcache.clear();\n\t\t};\n\t}, []);\n\n\tconst uploadedAttachments = useMemo(\n\t\t() => attachments.filter((a) => a.status === 'uploaded' || !a.status),\n\t\t[attachments],\n\t);\n\n\tconst isUploading = useMemo(\n\t\t() => attachments.some((a) => a.status === 'uploading'),\n\t\t[attachments],\n\t);\n\n\treturn {\n\t\tattachments,\n\t\tuploadedAttachments,\n\t\tisUploading,\n\t\taddFiles,\n\t\tremoveAttachment,\n\t\tretryAttachment,\n\t\tsetAttachments,\n\t\treset,\n\t};\n}\n","/**\n * CommentComposer — TipTap-backed rich text editor with inline reference\n * picker and attachment uploader. Default composer for `<Comments>`.\n *\n * Mention/reference handling is delegated to the shared\n * `features/mentions` module: `useMentions` drives picker state +\n * caret-trigger detection, `<MentionPicker>` renders the popover, and\n * `<MentionChip>` renders draft-list chips. The same primitives power\n * inline references in `features/activities`.\n */\nimport { AtSign, Loader2, Paperclip, X } from 'lucide-react';\nimport {\n\t\tforwardRef,\n\t\tuseEffect,\n\t\tuseImperativeHandle,\n\t\tuseMemo,\n\t\tuseRef,\n\t\tuseState,\n} from 'react';\nimport type { ReactNode } from 'react';\nimport type { ReactElement, RefAttributes } from 'react';\n\nimport { Button } from '../../../base/buttons';\nimport { Popover, PopoverTrigger } from '../../../base/popover';\nimport { Stack } from '../../../base/structure';\nimport { DisplayLabel, Text } from '../../../typography';\nimport {\n\t\tRichTextEditor,\n\t\ttype RichTextEditorHandle,\n\t\ttype RichTextEditorToolbarItem,\n} from '../../rich-text-editor/rich-text-editor';\nimport {\n\t\tMentionInlineSuggestions,\n\t\tMentionPicker,\n\t\tparseMentionsFromHtml,\n\t\tuseMentions,\n} from '../../mentions';\nimport { useResolvedStrings } from '../comments-provider';\nimport { interpolateString } from '../../../../lib/strings';\nimport { rowBlockPaddingClasses } from '../../../../lib/row-recipes';\nimport { cn } from '../../../../lib/utils';\nimport { fieldAffordanceRecipes } from '../../../../lib/field-affordance-recipes';\nimport type {\n\t\tCommentComposerProps,\n\t\tCommentFormValues,\n} from '../comments.types';\nimport { CommentAttachmentChip } from './comment-attachment-chip';\nimport { useAttachmentUpload } from '../hooks/use-attachment-upload';\n\nexport interface CommentComposerHandle {\n\t\tfocus(): void;\n\t\tclear(): void;\n\t\t/** Imperatively set the draft body. */\n\t\tsetBody(html: string): void;\n}\n\nfunction hasMeaningfulContent(html: string): boolean {\n\t\tif (!html || typeof html !== 'string') return false;\n\t\tconst text = html.replace(/<[^>]*>/g, '').trim();\n\t\treturn text.length > 0;\n}\n\nconst CommentComposerBase = forwardRef<\n\t\tCommentComposerHandle,\n\t\tCommentComposerProps\n>(function CommentComposer(\n\t\t{\n\t\t\t\tcontext,\n\t\t\t\tcanComment = true,\n\t\t\t\tsubmitting = false,\n\t\t\t\terrors,\n\t\t\t\tresetKey = 0,\n\t\t\t\tonSubmit,\n\t\t\t\tonCancel,\n\t\t\t\teditingComment,\n\t\t\t\treplyingTo,\n\t\t\t\tstrings: stringsProp,\n\t\t\t\tresources: resourcesProp,\n\t\t\t\tonResourceSearch: onResourceSearchProp,\n\t\t\t\tattachments: attachmentsProp,\n\t\t\t\tmaxAttachments: maxAttachmentsProp,\n\t\t\t\tallowAttachments: allowAttachmentsProp,\n\t\t\t\tinitialValues,\n\t\t\t\tautoFocus = false,\n\t\t\t\tinlineSubmit = true,\n\t\t\t\tplaceholder,\n\t\t},\n\t\tref,\n) {\n\t\tconst strings = useResolvedStrings(stringsProp);\n\t\tconst resources = resourcesProp;\n\t\tconst onResourceSearch = onResourceSearchProp;\n\t\tconst allowAttachments = allowAttachmentsProp ?? true;\n\t\tconst maxAttachments =\n\t\t\t\tattachmentsProp?.maxFiles ??\n\t\t\t\tmaxAttachmentsProp ??\n\t\t\t\t5;\n\t\tconst attachmentsConfig = useMemo(\n\t\t\t\t() => ({\n\t\t\t\t\t\t...attachmentsProp,\n\t\t\t\t\t\tmaxFiles: maxAttachments,\n\t\t\t\t\t\tdisabled: attachmentsProp?.disabled === true || !allowAttachments,\n\t\t\t\t}),\n\t\t\t\t[allowAttachments, attachmentsProp, maxAttachments],\n\t\t);\n\n\t\tconst editorRef = useRef<RichTextEditorHandle>(null);\n\t\tconst [body, setBody] = useState<string>(\n\t\t\t\t() => initialValues?.content ?? editingComment?.content ?? '',\n\t\t);\n\t\tconst [contentError, setContentError] = useState<string | null>(null);\n\t\tconst [attachmentError, setAttachmentError] = useState<string | null>(null);\n\n\t\t/**\n\t\t * Mentions state — picker + caret-trigger detection. The hook reads\n\t\t * the editor handle via the ref we pass; on suggestion select it\n\t\t * inserts the chip and replaces the trigger range automatically.\n\t\t */\n\t\tconst mentions = useMentions({\n\t\t\t\tresources,\n\t\t\t\tonResourceSearch,\n\t\t\t\teditorRef,\n\t\t\t\tinitialMentions:\n\t\t\t\t\t\tinitialValues?.references ?? editingComment?.references,\n\t\t});\n\n\t\tconst attachmentUpload = useAttachmentUpload({\n\t\t\t\t...attachmentsConfig,\n\t\t\t\tinitialAttachments: initialValues?.attachments ?? undefined,\n\t\t\t\tstrings,\n\t\t\t\tonError: setAttachmentError,\n\t\t});\n\t\tconst handleCancel = () => {\n\t\t\t\tattachmentUpload.reset();\n\t\t\t\tsetAttachmentError(null);\n\t\t\t\tonCancel?.();\n\t\t};\n\n\t\tuseImperativeHandle(\n\t\t\t\tref,\n\t\t\t\t() => ({\n\t\t\t\t\t\tfocus: () => editorRef.current?.focus(),\n\t\t\t\t\t\tclear: () => {\n\t\t\t\t\t\t\t\teditorRef.current?.clear();\n\t\t\t\t\t\t\t\tmentions.reset();\n\t\t\t\t\t\t\t\tattachmentUpload.reset();\n\t\t\t\t\t\t\t\tsetContentError(null);\n\t\t\t\t\t\t\t\tsetAttachmentError(null);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsetBody: (html) => {\n\t\t\t\t\t\t\t\teditorRef.current?.setHTML(html);\n\t\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\t[attachmentUpload, mentions],\n\t\t);\n\n\t\t// Reset on context change / resetKey bump\n\t\tuseEffect(() => {\n\t\t\t\teditorRef.current?.setHTML(initialValues?.content ?? '');\n\t\t\t\tmentions.setMentions(initialValues?.references ?? []);\n\t\t\t\tattachmentUpload.reset();\n\t\t\t\tattachmentUpload.setAttachments(initialValues?.attachments ?? []);\n\t\t\t\tsetContentError(null);\n\t\t\t\tsetAttachmentError(null);\n\t\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [context.id, context.type, resetKey]);\n\n\t\t// Sync editing comment payload\n\t\tuseEffect(() => {\n\t\t\t\tif (!editingComment) return;\n\t\t\t\teditorRef.current?.setHTML(editingComment.content ?? '');\n\t\t\t\tmentions.setMentions(editingComment.references ?? []);\n\t\t\t\tconst list = (editingComment.attachments ?? []).filter(\n\t\t\t\t\t\t(a): a is NonNullable<typeof a> => !!a,\n\t\t\t\t);\n\t\t\t\tattachmentUpload.reset();\n\t\t\t\tattachmentUpload.setAttachments(list);\n\t\t\t\tsetAttachmentError(null);\n\t\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [editingComment?.id]);\n\n\t\t// Surface server-side errors\n\t\tuseEffect(() => {\n\t\t\t\tif (errors?.content) {\n\t\t\t\t\t\tsetContentError(errors.content);\n\t\t\t\t}\n\t\t}, [errors]);\n\n\t\tconst handleSubmit = (event?: React.FormEvent) => {\n\t\t\t\tevent?.preventDefault();\n\t\t\t\tif (submitting || attachmentUpload.isUploading) return;\n\t\t\t\tconst html = editorRef.current?.getHTML() ?? body;\n\t\t\t\tif (!hasMeaningfulContent(html)) {\n\t\t\t\t\t\tsetContentError(strings.invalidContent);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetContentError(null);\n\n\t\t\t\tconst values: CommentFormValues = {\n\t\t\t\t\t\tcontent: html,\n\t\t\t\t\t\tcommentableId: context.id,\n\t\t\t\t\t\tcommentableType: context.type,\n\t\t\t\t\t\tmoduleKey: context.moduleKey,\n\t\t\t\t\t\tcontentType: 'html',\n\t\t\t\t\t\treferences: mentions.mentions,\n\t\t\t\t\t\tattachments: attachmentUpload.uploadedAttachments,\n\t\t\t\t\t\treplyToId: replyingTo?.commentId ?? initialValues?.replyToId,\n\t\t\t\t\t\teditingId: editingComment?.id,\n\t\t\t\t};\n\n\t\t\t\tonSubmit(values);\n\t\t};\n\n\t\tconst fileInputRef = useRef<HTMLInputElement>(null);\n\t\tconst handleAttachmentClick = () => fileInputRef.current?.click();\n\t\tconst handleFiles = (files: FileList | null) => {\n\t\t\t\tif (!files?.length) return;\n\t\t\t\tsetAttachmentError(null);\n\t\t\t\tattachmentUpload.addFiles(files);\n\t\t};\n\n\t\tconst hasAttachments = attachmentUpload.attachments.length > 0;\n\t\tconst isEditing = !!editingComment;\n\t\tconst isReplying = !isEditing && !!replyingTo;\n\n\t\tconst submitLabel = submitting\n\t\t\t\t? strings.composerSubmitting\n\t\t\t\t: isEditing\n\t\t\t\t\t? strings.composerSave\n\t\t\t\t\t: strings.composerSubmit;\n\n\t\tconst eyebrow: ReactNode = isEditing ? (\n\t\t\t\t<ComposerEyebrow\n\t\t\t\t\t\tlabel={strings.composerEditingEyebrow}\n\t\t\t\t\t\tcloseLabel={strings.composerCancel}\n\t\t\t\t\t\tonClose={onCancel ? handleCancel : undefined}\n\t\t\t\t/>\n\t\t) : isReplying ? (\n\t\t\t\t<ComposerEyebrow\n\t\t\t\t\t\tlabel={makeReplyEyebrow(\n\t\t\t\t\t\t\t\tstrings.composerReplyingEyebrow,\n\t\t\t\t\t\t\t\treplyingTo.authorName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tcloseLabel={strings.composerCancel}\n\t\t\t\t\t\tonClose={onCancel ? handleCancel : undefined}\n\t\t\t\t/>\n\t\t) : null;\n\n\t\tconst extraToolbarItems = useMemo<ReadonlyArray<RichTextEditorToolbarItem>>(() => {\n\t\t\t\tconst items: RichTextEditorToolbarItem[] = [];\n\t\t\t\tif (resources && Object.keys(resources).length > 0) {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\tid: 'reference',\n\t\t\t\t\t\t\t\ticon: AtSign,\n\t\t\t\t\t\t\t\tlabel: strings.composerReferenceLabel,\n\t\t\t\t\t\t\t\tonClick: () => mentions.setPickerOpen(true),\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (attachmentsConfig?.onUpload && !attachmentsConfig.disabled) {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\tid: 'attachment',\n\t\t\t\t\t\t\t\ticon: Paperclip,\n\t\t\t\t\t\t\t\tlabel: strings.composerAttachmentLabel,\n\t\t\t\t\t\t\t\tonClick: handleAttachmentClick,\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn items;\n\t\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [\n\t\t\t\tresources,\n\t\t\t\tattachmentsConfig?.onUpload,\n\t\t\t\tattachmentsConfig?.disabled,\n\t\t\t\tstrings.composerReferenceLabel,\n\t\t\t\tstrings.composerAttachmentLabel,\n\t\t]);\n\n\t\tif (!canComment) return null;\n\n\t\tconst submitButton = (\n\t\t\t\t<Button tone=\"primary\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={() => handleSubmit()}\n\t\t\t\t\t\tdisabled={submitting || attachmentUpload.isUploading}\n\t\t\t\t\t\ticon={submitting ? Loader2 : undefined}\n\t\t\t\t>\n\t\t\t\t\t\t{submitLabel}\n\t\t\t\t</Button>\n\t\t);\n\n\t\tconst cancelButton = (isEditing || isReplying || onCancel) ? (\n\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\tdisabled={submitting}\n\t\t\t\t>\n\t\t\t\t\t\t{strings.composerCancel}\n\t\t\t\t</Button>\n\t\t) : null;\n\n\t\t// Mentions live as inline `<span class=\"rsc-mention\" contenteditable=\"false\">`\n\t\t// chips inside the editor body — they're visible, dismissible (single\n\t\t// backspace deletes the whole span), and the HTML→mentions sync keeps\n\t\t// `mentions.mentions` aligned automatically. Rendering them again as a\n\t\t// chip-list below the editor was redundant and confusing.\n\n\t\tconst attachmentChips = hasAttachments ? (\n\t\t\t\t<Stack direction=\"horizontal\" wrap align=\"center\" gap=\"sm\">\n\t\t\t\t\t\t{attachmentUpload.attachments.map((attachment) => (\n\t\t\t\t\t\t\t\t<CommentAttachmentChip\n\t\t\t\t\t\t\t\t\t\tkey={attachment.id}\n\t\t\t\t\t\t\t\t\t\tattachment={attachment}\n\t\t\t\t\t\t\t\t\t\teditable\n\t\t\t\t\t\t\t\t\t\tonRemove={(id) => { setAttachmentError(null); attachmentUpload.removeAttachment(id); }}\n\t\t\t\t\t\t\t\t\t\tonRetry={(id) => { setAttachmentError(null); attachmentUpload.retryAttachment(id); }}\n\t\t\t\t\t\t\t\t\t\tstrings={stringsProp}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t) : null;\n\n\t\tconst footerSlot = hasAttachments ? attachmentChips : null;\n\n\t\tconst trailingSubmit =\n\t\t\t\tinlineSubmit !== false && !isEditing && !isReplying\n\t\t\t\t\t\t? submitButton\n\t\t\t\t\t\t: null;\n\t\tconst showFooterRow = inlineSubmit === false || isEditing || isReplying;\n\n\t\treturn (\n\t\t<Stack render={<form />} gap=\"md\" onSubmit={handleSubmit} className=\"comment-composer--component\">\n\t\t\t\t\t\t{eyebrow}\n\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tref={fileInputRef}\n\t\t\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\t\taccept={attachmentsConfig?.accept}\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\thandleFiles(e.target.files);\n\t\t\t\t\t\t\t\t\t\te.target.value = '';\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{/* Manual button-click flow: regular popover anchored to the\n\t\t\t\t\t\t\t\thidden trigger. The inline-trigger flow uses the panel\n\t\t\t\t\t\t\t\trendered below — no focus stealing while the user types. */}\n\t\t\t\t\t\t{!mentions.triggerActive && (\n\t\t\t\t\t\t\t\t<Popover open={mentions.pickerOpen} onOpenChange={mentions.setPickerOpen}>\n\t\t\t\t\t\t\t\t\t\t<PopoverTrigger\n\t\t\t\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"sr-only\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{strings.composerReferenceLabel}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t\t\t\t\topen={mentions.pickerOpen}\n\t\t\t\t\t\t\t\t\t\t\t\tactiveKind={mentions.activeKind}\n\t\t\t\t\t\t\t\t\t\t\t\tsetActiveKind={(kind) => { mentions.setActiveKind(kind); mentions.setManualKindOverride(true); }}\n\t\t\t\t\t\t\t\t\t\t\t\tkinds={mentions.kinds}\n\t\t\t\t\t\t\t\t\t\t\t\tresources={resources}\n\t\t\t\t\t\t\t\t\t\t\t\tquery={mentions.query}\n\t\t\t\t\t\t\t\t\t\t\t\tsetQuery={mentions.setQuery}\n\t\t\t\t\t\t\t\t\t\t\t\tsuggestions={mentions.suggestions}\n\t\t\t\t\t\t\t\t\t\t\t\tloading={mentions.isLoading}\n\t\t\t\t\t\t\t\t\t\t\t\tonSelect={mentions.pickSuggestion}\n\t\t\t\t\t\t\t\t\t\t\t\tstrings={{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle: strings.composerReferenceMenuTitle,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsearchPlaceholder: strings.composerReferenceSearchPlaceholder,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tempty: strings.composerReferenceEmpty,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tloading: strings.composerReferenceLoading,\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Popover>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<div className=\"comment-composer--editor relative\">\n\t\t\t\t\t\t\t\t<RichTextEditor\n\t\t\t\t\t\t\t\t\t\tref={editorRef}\n\t\t\t\t\t\t\t\t\t\tvalue={body}\n\t\t\t\t\t\t\t\t\t\tonValueChange={(html) => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetBody(html);\n\t\t\t\t\t\t\t\t\t\t\t\t// Sync the draft's mentions list with what's\n\t\t\t\t\t\t\t\t\t\t\t\t// actually present in the HTML — when the user\n\t\t\t\t\t\t\t\t\t\t\t\t// backspaces a chip span out of the body, the\n\t\t\t\t\t\t\t\t\t\t\t\t// chip-list below shrinks too. We merge with\n\t\t\t\t\t\t\t\t\t\t\t\t// the previously-known list so consumer-supplied\n\t\t\t\t\t\t\t\t\t\t\t\t// `href` / `data` payloads survive parsing.\n\t\t\t\t\t\t\t\t\t\t\t\tconst parsed = parseMentionsFromHtml<string>(html);\n\t\t\t\t\t\t\t\t\t\t\t\tconst previous = mentions.mentions;\n\t\t\t\t\t\t\t\t\t\t\t\tconst previousIds = previous.map((m) => m.id).join('|');\n\t\t\t\t\t\t\t\t\t\t\t\tconst currentIds = parsed.map((m) => m.id).join('|');\n\t\t\t\t\t\t\t\t\t\t\t\tif (previousIds !== currentIds) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst byId = new Map(previous.map((m) => [m.id, m]));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst merged = parsed.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(p) => byId.get(p.id) ?? p,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmentions.setMentions(merged);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tplaceholder={placeholder ?? strings.composerPlaceholder}\n\t\t\t\t\t\t\t\t\t\tstrings={{\n\t\t\t\t\t\t\t\t\t\t\t\teditorLabel: placeholder ?? strings.composerPlaceholder,\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tbodyHeight=\"field\"\n\t\t\t\t\t\t\t\t\t\tautoFocus={autoFocus || isEditing || isReplying}\n\t\t\t\t\t\t\t\t\t\textraToolbarItems={extraToolbarItems}\n\t\t\t\t\t\t\t\t\t\ttoolbarTrailing={trailingSubmit}\n\t\t\t\t\t\t\t\t\t\tfooterSlot={footerSlot}\n\t\t\t\t\t\t\t\t\t\tonCaretChange={mentions.handleCaretChange}\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<MentionInlineSuggestions\n\t\t\t\t\t\t\t\t\t\topen={mentions.triggerActive && mentions.pickerOpen}\n\t\t\t\t\t\t\t\t\t\tactiveKind={mentions.activeKind}\n\t\t\t\t\t\t\t\t\t\tsetActiveKind={(kind) => { mentions.setActiveKind(kind); mentions.setManualKindOverride(true); }}\n\t\t\t\t\t\t\t\t\t\tkinds={mentions.kinds}\n\t\t\t\t\t\t\t\t\t\tresources={resources}\n\t\t\t\t\t\t\t\t\t\tquery={mentions.query}\n\t\t\t\t\t\t\t\t\t\tsuggestions={mentions.suggestions}\n\t\t\t\t\t\t\t\t\t\tsuggestionsByKind={mentions.suggestionsByKind}\n\t\t\t\t\t\t\t\t\t\tloading={mentions.isLoading}\n\t\t\t\t\t\t\t\t\t\tonSelect={mentions.pickSuggestion}\n\t\t\t\t\t\t\t\t\t\tstrings={{\n\t\t\t\t\t\t\t\t\t\t\t\ttitle: strings.composerReferenceMenuTitle,\n\t\t\t\t\t\t\t\t\t\t\t\tempty: strings.composerReferenceEmpty,\n\t\t\t\t\t\t\t\t\t\t\t\tloading: strings.composerReferenceLoading,\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{attachmentError && (\n\t\t\t\t\t\t\t\t<Text role=\"alert\" size=\"xs\" type=\"error\" className=\"comment-composer--attachment-error\">\n\t\t\t\t\t\t\t\t\t\t{attachmentError}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{contentError && (\n\t\t\t\t\t\t\t\t<Text size=\"xs\" type=\"error\">\n\t\t\t\t\t\t\t\t\t\t{contentError}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{showFooterRow && (\n\t\t\t\t\t\t\t\t<Stack direction=\"horizontal\" align=\"center\" justify=\"end\" gap=\"md\" className=\"comment-composer--footer-actions\">\n\t\t\t\t\t\t\t\t\t\t{cancelButton}\n\t\t\t\t\t\t\t\t\t\t{submitButton}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t)}\n\t\t</Stack>\n\t\t);\n});\n\n/** Preserve the consumer's resource-kind union through the forwarded-ref boundary. */\nexport const CommentComposer = CommentComposerBase as <\n\t\tTResource extends string = string,\n>(\n\t\tprops: CommentComposerProps<TResource> & RefAttributes<CommentComposerHandle>,\n) => ReactElement | null;\n\n/* ------------------------------------------------------------------ */\n/* ComposerEyebrow */\n/* ------------------------------------------------------------------ */\n\nfunction ComposerEyebrow({\n\t\tlabel,\n\t\tcloseLabel,\n\t\tonClose,\n}: {\n\t\tlabel: string;\n\t\tcloseLabel: string;\n\t\tonClose?: () => void;\n}) {\n\t\treturn (\n\t\t\t\t<div className={cn('comment-composer--eyebrow bg-muted/30 ring-border/60 flex min-w-0 items-center justify-between gap-space-sm rounded-radius px-row-x ring-1 ring-inset', rowBlockPaddingClasses.compact)}>\n\t\t\t\t\t\t<DisplayLabel>\n\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t</DisplayLabel>\n\t\t\t\t\t\t{onClose ? (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\t\t\t\t\tclassName={cn(fieldAffordanceRecipes.target, fieldAffordanceRecipes.focus, fieldAffordanceRecipes.toggle)}\n\t\t\t\t\t\t\t\t\t\taria-label={closeLabel}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<X className={fieldAffordanceRecipes.icon} aria-hidden=\"true\" />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t);\n}\n\n/** Helper export for templated reply eyebrow. */\nexport function makeReplyEyebrow(template: string, name?: string): string {\n\t\treturn interpolateString(template, { name }, { missing: 'empty' });\n}\n","/**\n * CommentEmpty — default empty state for the timeline. Replaceable via\n * the `emptySlot` prop on `<Comments>` / `<CommentTimeline>`.\n */\nimport { MessageCircle } from 'lucide-react';\nimport type { FC, ReactNode } from 'react';\n\nimport { EmptyState } from '../../../blocks/data-display';\nimport type { StringsProp } from '../../../../lib/strings';\nimport { cn } from '../../../../lib/utils';\n\nimport { useResolvedStrings } from '../comments-provider';\nimport type { CommentsStrings } from '../comments.strings';\n\nexport interface CommentEmptyProps {\n\t/** Overrides this surface's own copy. */\n\tstrings?: StringsProp<CommentsStrings>;\n\t/** Leading glyph. */\n\ticon?: ReactNode;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nexport const CommentEmpty: FC<CommentEmptyProps> = ({\n\tstrings: stringsProp,\n\ticon,\n\tclassName,\n}) => {\n\tconst strings = useResolvedStrings(stringsProp);\n\n\treturn (\n\t\t<EmptyState\n\t\t\ttitle={strings.empty}\n\t\t\tdescription={strings.emptyHint || false}\n\t\t\tmedia={icon ?? <MessageCircle className=\"size-icon\" aria-hidden=\"true\" />}\n\t\t\tmediaVariant=\"icon-soft\"\n\t\t\tpadding=\"md\"\n\t\t\tclassName={cn('comment-empty--component', className)}\n\t\t/>\n\t);\n};\n","import type { ReactNode } from 'react';\nimport { Fragment, createElement } from 'react';\n\nimport { Text } from '../../../typography';\nimport { sanitizeHtml } from '../../../../lib/sanitize-html';\nimport { contentTypographyClassName } from '../../../typography/content-typography';\n\nimport { RichText } from '../../../typography/rich-text';\nimport { MentionContent } from '../../mentions';\n\nimport type {\n\tCommentData,\n\tCommentUser,\n\tCommentsConfig,\n\tCommentsSlots,\n} from '../comments.types';\n\nexport interface CommentContentProps<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n> {\n\t/** The comment to render. */\n\tcomment: CommentData<TUser, TMeta, TResource>;\n\t/** Resource registry — passed through to `<MentionContent>`. */\n\tresources?: CommentsConfig<TUser, TMeta, TResource>['resources'];\n\t/** Replaces the default rendering of an inline reference. */\n\trenderReference?: CommentsSlots<\n\t\tTUser,\n\t\tTMeta,\n\t\tTResource\n\t>['renderReference'];\n\t/** Optional sanitizer override. The package safe allowlist is the default. */\n\tsanitizer?: (html: string) => string;\n}\n\nexport function CommentContent<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>(\n\tprops: CommentContentProps<TUser, TMeta, TResource>,\n): ReactNode {\n\tconst { comment, resources, renderReference, sanitizer } = props;\n\tconst contentType =\n\t\tcomment.contentType ??\n\t\t(comment as Record<string, unknown>).content_type ??\n\t\t'text';\n\n\tif (contentType === 'rich') {\n\t\tconst richContent = renderRichContent(comment.content);\n\t\treturn richContent ? (\n\t\t\t<div className=\"comment-content--component\">{richContent}</div>\n\t\t) : null;\n\t}\n\n\tif (contentType === 'html') {\n\t\treturn (\n\t\t\t<div className=\"comment-content--component\">\n\t\t\t\t<MentionContent<TResource>\n\t\t\t\t\tclassName=\"text-inherit\"\n\t\t\t\t\thtml={comment.content ?? ''}\n\t\t\t\t\tmentions={comment.references}\n\t\t\t\t\tresources={resources}\n\t\t\t\t\trenderMention={renderReference}\n\t\t\t\t\tsanitizer={sanitizer}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst plainContent = decodeQuotedString(comment.content ?? '');\n\n\treturn (\n\t\t<Text type=\"inherit\" className=\"comment-content--component whitespace-pre-line\">\n\t\t\t{plainContent}\n\t\t</Text>\n\t);\n}\n\n/* ------------------------------------------------------------------ */\n/* Rich-block renderer for Editor.js-style structured content */\n/* ------------------------------------------------------------------ */\n\nfunction renderRichContent(rawContent: string | null | undefined): ReactNode {\n\tif (!rawContent) return null;\n\n\ttry {\n\t\tconst parsed = JSON.parse(rawContent) as {\n\t\t\tblocks?: Array<{ id?: string; type: string; data?: Record<string, unknown> }>;\n\t\t};\n\n\t\tif (!parsed || !Array.isArray(parsed.blocks) || parsed.blocks.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<Text tag=\"div\" type=\"inherit\" className={contentTypographyClassName}>\n\t\t\t\t{parsed.blocks.map((block, index) => (\n\t\t\t\t\t<Fragment key={block.id ?? `${block.type}-${index}`}>\n\t\t\t\t\t\t{renderRichBlock(block)}\n\t\t\t\t\t</Fragment>\n\t\t\t\t))}\n\t\t\t</Text>\n\t\t);\n\t} catch {\n\t\tconst decoded = decodeQuotedString(rawContent);\n\t\treturn (\n\t\t\t<Text type=\"inherit\" className=\"whitespace-pre-line\">\n\t\t\t\t{decoded}\n\t\t\t</Text>\n\t\t);\n\t}\n}\n\nfunction renderRichBlock(block: { type: string; data?: Record<string, unknown> }): ReactNode {\n\tconst data = block.data ?? {};\n\n\tswitch (block.type) {\n\t\tcase 'paragraph': {\n\t\t\tconst raw = String(data.text ?? '').trim();\n\t\t\tif (!raw) return null;\n\t\t\tconst html = sanitizeHtml(raw);\n\t\t\treturn html ? <p dangerouslySetInnerHTML={{ __html: html }} /> : null;\n\t\t}\n\t\tcase 'header': {\n\t\t\tconst text = stripHtml(String(data.text ?? ''));\n\t\t\tconst level = Number(data.level ?? 3);\n\t\t\tif (!text) return null;\n\t\t\tconst safeLevel = Math.min(Math.max(level, 1), 6);\n\t\t\treturn createElement(\n\t\t\t\t`h${safeLevel}`,\n\t\t\t\tnull,\n\t\t\t\ttext,\n\t\t\t);\n\t\t}\n\t\tcase 'list': {\n\t\t\tconst items = Array.isArray(data.items) ? data.items : [];\n\t\t\tconst sanitizedItems = items\n\t\t\t\t.map((item) => stripHtml(String(item ?? '')))\n\t\t\t\t.filter((item) => item.length > 0);\n\n\t\t\tif (sanitizedItems.length === 0) return null;\n\n\t\t\tif (data.style === 'ordered') {\n\t\t\t\treturn (\n\t\t\t\t\t<ol>\n\t\t\t\t\t\t{sanitizedItems.map((item, index) => (\n\t\t\t\t\t\t\t<li key={`${item}-${index}`}>\n\t\t\t\t\t\t\t\t<Text tag=\"span\" type=\"inherit\">{item}</Text>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ol>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ul>\n\t\t\t\t\t{sanitizedItems.map((item) => (\n\t\t\t\t\t\t<li key={item}>\n\t\t\t\t\t\t\t<Text tag=\"span\" type=\"inherit\">{item}</Text>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t);\n\t\t}\n\t\tcase 'quote': {\n\t\t\tconst text = String(data.text ?? '').trim();\n\t\t\tif (!text) return null;\n\t\t\tconst caption = stripHtml(String(data.caption ?? ''));\n\t\t\treturn (\n\t\t\t\t<blockquote className=\"italic\">\n\t\t\t\t\t<RichText tag=\"div\" html={text} type=\"secondary\" />\n\t\t\t\t\t{caption.length > 0 && (\n\t\t\t\t\t\t<cite className=\"mt-1 block not-italic\">\n\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\">\n\t\t\t\t\t\t\t\t— {caption}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</cite>\n\t\t\t\t\t)}\n\t\t\t\t</blockquote>\n\t\t\t);\n\t\t}\n\t\tcase 'delimiter':\n\t\t\treturn (\n\t\t\t\t<hr\n\t\t\t\t\tclassName=\"border-dashed\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t/>\n\t\t\t);\n\t\tdefault: {\n\t\t\tconst text = stripHtml(String(data.text ?? ''));\n\t\t\tif (!text) return null;\n\t\t\treturn <p className=\"whitespace-pre-line\">{text}</p>;\n\t\t}\n\t}\n}\n\nfunction stripHtml(value: string): string {\n\treturn value.replace(/<[^>]*>/g, '').trim();\n}\n\nfunction decodeQuotedString(value: string | null | undefined): string {\n\tif (typeof value !== 'string') return '';\n\tconst trimmed = value.trim();\n\tif (trimmed === '') return '';\n\tif (trimmed.startsWith('{') || trimmed.startsWith('[')) return trimmed;\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed);\n\t\tif (typeof parsed === 'string') return parsed;\n\t} catch {\n\t\t// ignore\n\t}\n\tif (trimmed.startsWith('\"') && trimmed.endsWith('\"')) {\n\t\treturn trimmed.slice(1, -1);\n\t}\n\treturn trimmed;\n}\n","import {\n\tCornerDownRight,\n\tPencil,\n\tPin,\n\tSmile,\n\tTrash2,\n} from 'lucide-react';\nimport type { FC } from 'react';\nimport { memo, useCallback, useMemo, useState } from 'react';\n\nimport {\n\tAvatar,\n\tAvatarFallback,\n\tAvatarImage,\n} from '../../../base/avatar';\nimport { Badge } from '../../../base/badge';\nimport { Button } from '../../../base/buttons';\nimport { ConfirmDialog, useOverlayVisibility } from '../../overlays';\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipProvider,\n\tTooltipTrigger,\n} from '../../../base/display/tooltip';\nimport { Number as NumberValue, RelativeTime } from '../../../primitives';\nimport { Text } from '../../../typography';\nimport { Stack } from '../../../base/structure';\nimport { cn } from '../../../../lib/utils';\nimport { fieldAffordanceRecipes } from '../../../../lib/field-affordance-recipes';\nimport { interpolateString } from '../../../../lib/strings';\nimport { defaultCommentsStrings } from '../comments.strings';\n\nimport {\n\tuseResolvedAccessors,\n\tuseResolvedStrings,\n} from '../comments-provider';\nimport type {\n\tCommentAttachment,\n\tCommentItemProps,\n\tCommentUser,\n} from '../comments.types';\nimport { CommentAttachmentChip } from './comment-attachment-chip';\nimport { CommentContent } from './comment-content';\n\nconst FALLBACK_INITIAL = '?';\n\nconst defaultGetMediaUrl = (m: CommentAttachment | null | undefined) => m?.url;\nconst defaultGetMediaName = (m: CommentAttachment | null | undefined) => m?.name;\nconst defaultGetStatusLabel = (s: string) =>\n\ts.charAt(0).toUpperCase() + s.slice(1).replace(/_/g, ' ');\n\nexport const CommentItem = memo(function CommentItem<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>({\n\tcomment,\n\tcanModerate,\n\tonDelete,\n\tonAttachmentRemove,\n\tonEdit,\n\tonPinToggle,\n\tonReact,\n\tonReply,\n\tallowReactions: allowReactionsProp,\n\tallowReplies: allowRepliesProp,\n\tsanitizer,\n\tstrings: stringsProp,\n\tgetMediaUrl,\n\tgetMediaName,\n\tgetStatusLabel,\n\tformatRelativeTime,\n\tresources,\n\trenderAttachment,\n\trenderReference,\n}: CommentItemProps<TUser, TMeta, TResource>) {\n\tconst strings = useResolvedStrings(stringsProp);\n\tconst allowReactions = allowReactionsProp ?? true;\n\tconst allowReplies = allowRepliesProp ?? true;\n\tconst accessors = useResolvedAccessors({\n\t\tgetMediaUrl,\n\t\tgetMediaName,\n\t\tgetStatusLabel,\n\t\tformatRelativeTime,\n\t});\n\n\tconst resolvedGetMediaUrl = accessors.getMediaUrl ?? defaultGetMediaUrl;\n\tconst resolvedGetMediaName = accessors.getMediaName ?? defaultGetMediaName;\n\tconst resolvedGetStatusLabel =\n\t\taccessors.getStatusLabel ?? defaultGetStatusLabel;\n\tconst resolvedFormatRelativeTime = accessors.formatRelativeTime;\n\n\tconst authorName = comment.user?.name ?? strings.fallbackAuthor;\n\tconst avatarUrl = comment.user?.avatar ?? undefined;\n\n\tconst fallbackInitial = useMemo(() => {\n\t\tif (!authorName) return FALLBACK_INITIAL;\n\t\tconst trimmed = authorName.trim();\n\t\treturn trimmed === ''\n\t\t\t? FALLBACK_INITIAL\n\t\t\t: trimmed.charAt(0).toUpperCase();\n\t}, [authorName]);\n\n\tconst tagList = useMemo(() => {\n\t\tif (Array.isArray(comment.tagsArray)) {\n\t\t\treturn comment.tagsArray.filter(\n\t\t\t\t(tag): tag is string => typeof tag === 'string',\n\t\t\t);\n\t\t}\n\t\tif (comment.tagsArray && typeof comment.tagsArray === 'object') {\n\t\t\treturn Object.values(comment.tagsArray).filter(\n\t\t\t\t(value): value is string => typeof value === 'string',\n\t\t\t);\n\t\t}\n\t\treturn [];\n\t}, [comment.tagsArray]);\n\n\tconst attachments = useMemo(() => {\n\t\tconst list = comment.attachments ?? [];\n\t\treturn list.filter(\n\t\t\t(a): a is CommentAttachment => !!a && typeof a === 'object',\n\t\t);\n\t}, [comment.attachments]);\n\n\tconst reactions = allowReactions ? (comment.reactions ?? []) : [];\n\n\tconst isPinned = comment.isPinned === true;\n\tconst isEdited = comment.isEdited === true;\n\tconst showStatus = comment.status && comment.status !== 'active';\n\tconst statusLabel =\n\t\tshowStatus && comment.status ? resolvedGetStatusLabel(comment.status) : null;\n\tconst canDeleteComment =\n\t\tcomment.canDelete === true || canModerate === true;\n\tconst canEditComment = comment.canEdit === true || canModerate === true;\n\tconst canReply = !!allowReplies && !!onReply && !!comment.id;\n\tconst canReact = !!allowReactions && !!onReact && !!comment.id;\n\tconst canPin = !!onPinToggle && !!canModerate;\n\tconst canEdit = !!canEditComment && !!onEdit && !!comment.id;\n\tconst canDelete = !!canDeleteComment && !!onDelete && !!comment.id;\n\tconst hasActions = canReply || canReact || canPin || canEdit || canDelete;\n\n\tconst attachmentConfirm = useOverlayVisibility();\n\tconst [pendingAttachmentId, setPendingAttachmentId] = useState<string | null>(null);\n\tconst requestAttachmentRemoval = useCallback(\n\t\t(attachmentId: string) => {\n\t\t\tsetPendingAttachmentId(attachmentId);\n\t\t\tattachmentConfirm.show();\n\t\t},\n\t\t[attachmentConfirm],\n\t);\n\n\tconst hasAttachments = attachments.length > 0;\n\n\treturn (\n\t\t<article\n\t\t\tclassName={cn(\n\t\t\t\t'comment-item--component group relative overflow-hidden rounded-radius border transition-colors',\n\t\t\t\t'border-border/60 bg-card text-card-foreground px-surface pt-surface',\n\t\t\t\t// A trailing row of ghost icon buttons already carries its own inset\n\t\t\t\t// around each glyph, so it supplies the rest of the bottom edge and the\n\t\t\t\t// card stays optically even instead of gaining an empty band.\n\t\t\t\thasActions ? 'pb-surface-xs' : 'pb-surface',\n\t\t\t)}\n\t\t\tdata-comment-id={comment.id}\n\t\t>\n\t\t\t<Stack direction=\"horizontal\" align=\"start\" gap=\"lg\" className=\"min-w-0\">\n\t\t\t\t<Avatar className=\"size-avatar shrink-0\">\n\t\t\t\t\t{!!avatarUrl && (\n\t\t\t\t\t\t<AvatarImage src={avatarUrl} alt={authorName} />\n\t\t\t\t\t)}\n\t\t\t\t\t<AvatarFallback className=\"bg-muted text-muted-foreground text-xs font-medium\">\n\t\t\t\t\t\t{fallbackInitial}\n\t\t\t\t\t</AvatarFallback>\n\t\t\t\t</Avatar>\n\n\t\t\t\t<div className=\"comment-item--body min-w-0 flex-1\">\n\t\t\t\t\t{/* The byline and its message are one copy unit: the Stack owns their gap. */}\n\t\t\t\t\t<Stack gap=\"xs\" className=\"comment-item--message min-w-0\">\n\t\t\t\t\t\t<Stack direction=\"horizontal\" align=\"baseline\" gap=\"md\" className=\"min-w-0\">\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\ttype=\"inherit\"\n\t\t\t\t\t\t\t\tweight=\"semibold\"\n\t\t\t\t\t\t\t\tclassName=\"truncate\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{authorName}\n\t\t\t\t\t\t\t</Text>\n\n\t\t\t\t\t\t\t{!!isPinned && (\n\t\t\t\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t\t\t<TooltipTrigger render={<span className=\"inline-flex shrink-0 self-center\" />}>\n\t\t\t\t\t\t\t\t\t\t\t<Pin className=\"text-muted-foreground size-icon-sm\" aria-hidden />\n\t\t\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t\t\t<TooltipContent\n\t\t\t\t\t\t\t\t\t\t\tside=\"top\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-xs\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{strings.pinned}\n\t\t\t\t\t\t\t\t\t\t</TooltipContent>\n\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t</TooltipProvider>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t<RelativeTime\n\t\t\t\t\t\t\t\tvalue={comment.createdAt}\n\t\t\t\t\t\t\t\tformatRelativeTime={resolvedFormatRelativeTime}\n\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\tclassName=\"shrink-0 tabular-nums\"\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t{!!isEdited && (\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\ttype=\"secondary\"\n\t\t\t\t\t\t\t\t\tclassName=\"shrink-0\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{strings.edited}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t{!!showStatus && !!statusLabel && (\n\t\t\t\t\t\t\t\t<Badge size=\"sm\" tone=\"secondary\" className=\"self-center\">\n\t\t\t\t\t\t\t\t\t{statusLabel}\n\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t<div className=\"leading-relaxed\">\n\t\t\t\t\t\t\t<CommentContent\n\t\t\t\t\t\t\t\tcomment={comment}\n\t\t\t\t\t\t\t\tresources={resources}\n\t\t\t\t\t\t\t\trenderReference={renderReference}\n\t\t\t\t\t\t\t\tsanitizer={sanitizer}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t{tagList.length > 0 && (\n\t\t\t\t\t\t<div className=\"mt-space-md flex flex-wrap gap-space-sm\">\n\t\t\t\t\t\t\t{tagList.map((tag) => (\n\t\t\t\t\t\t\t\t<Badge key={tag} size=\"sm\" tone=\"secondary\">\n\t\t\t\t\t\t\t\t\t{tag}\n\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{hasAttachments && (\n\t\t\t\t\t\t<div className=\"mt-space-md flex flex-wrap gap-space-sm\">\n\t\t\t\t\t\t\t{attachments.map((attachment) => {\n\t\t\t\t\t\t\t\tif (renderAttachment) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<div key={attachment.id ?? attachment.name}>\n\t\t\t\t\t\t\t\t\t\t\t{renderAttachment(attachment)}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t * Posted attachments were read-only: no control, no\n\t\t\t\t\t\t\t\t * callback, nothing to remove. The control appears only\n\t\t\t\t\t\t\t\t * when the consumer supplies `onAttachmentRemove` and the\n\t\t\t\t\t\t\t\t * viewer may edit the comment, and detaching a published\n\t\t\t\t\t\t\t\t * file is irreversible, so it asks first.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst canRemoveAttachment =\n\t\t\t\t\t\t\t\t\t!!onAttachmentRemove && !!attachment.id && canDeleteComment;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<CommentAttachmentChip\n\t\t\t\t\t\t\t\t\t\tkey={attachment.id ?? attachment.name}\n\t\t\t\t\t\t\t\t\t\tattachment={attachment}\n\t\t\t\t\t\t\t\t\t\teditable={canRemoveAttachment}\n\t\t\t\t\t\t\t\t\t\tonRemove={\n\t\t\t\t\t\t\t\t\t\t\tcanRemoveAttachment\n\t\t\t\t\t\t\t\t\t\t\t\t? () => requestAttachmentRemoval(attachment.id as string)\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taccessors={{\n\t\t\t\t\t\t\t\t\t\t\tgetMediaUrl: resolvedGetMediaUrl,\n\t\t\t\t\t\t\t\t\t\t\tgetMediaName: resolvedGetMediaName,\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tstrings={stringsProp}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{reactions.length > 0 && (\n\t\t\t\t\t\t<Stack direction=\"horizontal\" wrap align=\"center\" gap=\"xs\" className=\"mt-space-md\">\n\t\t\t\t\t\t\t{reactions.map((reaction) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={reaction.emoji}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\taria-label={interpolateString(strings.reactionLabel ?? defaultCommentsStrings.reactionLabel!, { emoji: reaction.emoji, count: reaction.count })}\n\t\t\t\t\t\t\t\t\taria-pressed={reaction.mine ?? false}\n\t\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\t\tonReact && comment.id\n\t\t\t\t\t\t\t\t\t\t\t? onReact(comment.id, reaction.emoji)\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttitle={reaction.users?.join(', ')}\n\t\t\t\t\t\t\t\t\tclassName={cn(fieldAffordanceRecipes.inline, fieldAffordanceRecipes.focus)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\ttone={reaction.mine ? 'info' : 'secondary'}\n\t\t\t\t\t\t\t\t\t\tclassName=\"cursor-pointer transition-colors\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"inherit\"\n\t\t\t\t\t\t\t\t\t\t\tlineHeight=\"none\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-inherit\"\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{reaction.emoji}\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t<NumberValue\n\t\t\t\t\t\t\t\t\t\t\tvalue={reaction.count}\n\t\t\t\t\t\t\t\t\t\t\tsize=\"inherit\"\n\t\t\t\t\t\t\t\t\t\t\talign=\"left\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"tabular-nums text-current\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\n\t\t\t\t{/* Actions own a separate row so they never reserve message width. */}\n\t\t\t\t{hasActions && <div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'comment-item--actions relative mt-space-xs ms-auto w-fit max-w-full flex-wrap opacity-100 transition-opacity',\n\t\t\t\t\t\t'group-hover:opacity-100 focus-within:opacity-100',\n\t\t\t\t\t\t'inline-flex items-center gap-space-2xs',\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{canReply && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tcomment.id && onReply(comment.id)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttitle={strings.replyLabel}\n\t\t\t\t\t\t\taria-label={strings.replyLabel}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CornerDownRight className=\"size-icon-md\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{canReact && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tcomment.id && onReact(comment.id, '👍')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttitle={strings.addReactionLabel}\n\t\t\t\t\t\t\taria-label={strings.addReactionLabel}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Smile className=\"size-icon-md\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{canPin && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\tonClick={() => onPinToggle(comment)}\n\t\t\t\t\t\t\ttitle={isPinned ? strings.unpinLabel : strings.pinLabel}\n\t\t\t\t\t\t\taria-label={isPinned ? strings.unpinLabel : strings.pinLabel}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Pin\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'size-icon-md',\n\t\t\t\t\t\t\t\t\tisPinned && 'text-foreground',\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{canEdit && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\ttitle={strings.editLabel}\n\t\t\t\t\t\t\taria-label={strings.editLabel}\n\t\t\t\t\t\t\tonClick={() => onEdit(comment)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Pencil className=\"size-icon-md\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{canDelete && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tsize=\"sm\" iconOnly\n\t\t\t\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\t\t\t\tbuttonStyle=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"hover:text-destructive\"\n\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\tonDelete(comment.id as string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttitle={strings.deleteLabel}\n\t\t\t\t\t\t\t\taria-label={strings.deleteLabel}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Trash2 className=\"size-icon-md\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t</div>}\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t\t{!!onAttachmentRemove && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\t{...attachmentConfirm.overlayProps}\n\t\t\t\t\tdestructive\n\t\t\t\t\ttitle={strings.confirmRemoveAttachmentTitle}\n\t\t\t\t\tdescription={strings.confirmRemoveAttachmentDescription}\n\t\t\t\t\tstrings={{ confirm: strings.attachmentRemoveLabel }}\n\t\t\t\t\tonConfirm={() => {\n\t\t\t\t\t\tif (pendingAttachmentId && comment.id) {\n\t\t\t\t\t\t\tvoid onAttachmentRemove(comment.id as string, pendingAttachmentId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</article>\n\t);\n}) as <\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>(\n\tprops: CommentItemProps<TUser, TMeta, TResource>,\n) => ReturnType<FC>;\n","import type { FC } from 'react';\n\nimport { Stack } from '../../../base/structure';\nimport type { CommentTimelineProps, CommentUser } from '../comments.types';\nimport { CommentEmpty } from './comment-empty';\nimport { CommentItem } from './comment-item';\n\nexport const CommentTimeline = function CommentTimeline<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>({\n\tcomments,\n\tcanModerate,\n\tonDelete,\n\tonAttachmentRemove,\n\tonEdit,\n\tonPinToggle,\n\tonReact,\n\tonReply,\n\tallowReactions,\n\tallowReplies,\n\tsanitizer,\n\tstrings: stringsProp,\n\tgetMediaUrl,\n\tgetMediaName,\n\tgetStatusLabel,\n\tformatRelativeTime,\n\tresources,\n\trenderItem,\n\trenderAttachment,\n\trenderReference,\n\temptySlot,\n}: CommentTimelineProps<TUser, TMeta, TResource>) {\n\tif (!comments.length) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{emptySlot ?? <CommentEmpty strings={stringsProp} />}\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Stack gap=\"sm\" className=\"comment-timeline--component\">\n\t\t\t{comments.map((comment, index) => {\n\t\t\t\tconst defaultItem = (\n\t\t\t\t\t<CommentItem<TUser, TMeta, TResource>\n\t\t\t\t\t\tcomment={comment}\n\t\t\t\t\t\tcanModerate={canModerate}\n\t\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\t\tonAttachmentRemove={onAttachmentRemove}\n\t\t\t\t\t\tonEdit={onEdit}\n\t\t\t\t\t\tonPinToggle={onPinToggle}\n\t\t\t\t\t\tonReact={onReact}\n\t\t\t\t\t\tonReply={onReply}\n\t\t\t\t\t\tallowReactions={allowReactions}\n\t\t\t\t\t\tallowReplies={allowReplies}\n\t\t\t\t\t\tsanitizer={sanitizer}\n\t\t\t\t\t\tstrings={stringsProp}\n\t\t\t\t\t\tgetMediaUrl={getMediaUrl}\n\t\t\t\t\t\tgetMediaName={getMediaName}\n\t\t\t\t\t\tgetStatusLabel={getStatusLabel}\n\t\t\t\t\t\tformatRelativeTime={formatRelativeTime}\n\t\t\t\t\t\tresources={resources}\n\t\t\t\t\t\trenderAttachment={renderAttachment}\n\t\t\t\t\t\trenderReference={renderReference}\n\t\t\t\t\t/>\n\t\t\t\t);\n\n\t\t\t\tif (renderItem) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={comment.id ?? `comment-${index}`}>\n\t\t\t\t\t\t\t{renderItem({\n\t\t\t\t\t\t\t\tcomment,\n\t\t\t\t\t\t\t\tcanModerate: canModerate ?? false,\n\t\t\t\t\t\t\t\tonDelete,\n\t\t\t\t\t\t\t\tonAttachmentRemove,\n\t\t\t\t\t\t\t\tonEdit,\n\t\t\t\t\t\t\t\tdefaultItem,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<div key={comment.id ?? `comment-${index}`}>\n\t\t\t\t\t\t{defaultItem}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t})}\n\t\t</Stack>\n\t);\n} as <\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>(\n\tprops: CommentTimelineProps<TUser, TMeta, TResource>,\n) => ReturnType<FC>;\n","/**\n * Comments — top-level entry for the Comments feature.\n *\n * Composes the composer + timeline + empty state behind a single API.\n * Generic in `<TUser, TMeta, TResource>` so consumers can type their\n * domain (user shape, custom meta payload, resource-kind union).\n *\n * Per-mount wiring (callbacks, resources, accessors) flows as direct\n * props. Library-wide display defaults (composer position, etc.) come\n * from `<UIProvider>` — see `@/lib/ui-provider`. Slots, render-props,\n * and the headless `useComments()` hook cover the composability\n * spectrum.\n *\n * Wrap the feature in `Card` at the call site when card chrome is desired.\n */\nimport { useCallback, useState } from 'react';\n\nimport { Stack } from '../../base/structure';\nimport { ConfirmDialog, useOverlayVisibility } from '../overlays';\nimport { Text } from '../../typography';\nimport { useCommentsConfig as useCommentsUIDefaults } from '../../../lib/ui-provider';\n\nimport { useResolvedStrings } from './comments-provider';\nimport type { CommentUser, CommentsProps } from './comments.types';\nimport { useComments } from './hooks/use-comments';\nimport { CommentComposer } from './partials/comment-composer';\nimport { CommentEmpty } from './partials/comment-empty';\nimport { CommentTimeline } from './partials/comment-timeline';\n\nimport { cn } from '../../../lib/utils';\nexport function Comments<\n\tTUser extends CommentUser = CommentUser,\n\tTMeta = unknown,\n\tTResource extends string = string,\n>(props: CommentsProps<TUser, TMeta, TResource>) {\n\tconst ui = useCommentsUIDefaults();\n\n\tconst composerPosition =\n\t\tprops.composerPosition ?? ui.composerPosition ?? 'top';\n\tconst maxAttachments = props.maxAttachments ?? 5;\n\tconst allowAttachments = props.allowAttachments ?? true;\n\tconst allowReactions = props.allowReactions ?? true;\n\tconst allowReplies = props.allowReplies ?? true;\n\n\tconst canComment = props.canComment ?? false;\n\tconst canModerate = props.canModerate ?? false;\n\n\tconst onPinToggle = props.onPinToggle;\n\n\tconst resources = props.resources;\n\tconst attachments = props.attachments;\n\n\tconst strings = useResolvedStrings(props.strings);\n\tconst title = props.title === undefined ? strings.title : props.title;\n\n\t/*\n\t * Deleting a comment is irreversible and the trigger is a bare icon button\n\t * next to Edit, so the confirmation is the component's job rather than every\n\t * consumer's. `confirmDelete={false}` opts out for apps that already confirm\n\t * upstream — otherwise they would ask twice.\n\t */\n\tconst confirmDelete = props.confirmDelete ?? true;\n\tconst deleteConfirm = useOverlayVisibility();\n\tconst [pendingDeleteId, setPendingDeleteId] = useState<string | null>(null);\n\n\tconst commentsState = useComments<TUser, TMeta, TResource>({\n\t\tonSubmit: props.onSubmit,\n\t\tonUpdate: props.onUpdate,\n\t\tonDelete: props.onDelete,\n\t\tonAfterMutate: props.onAfterMutate,\n\t\tonError: props.onError,\n\t});\n\n\tconst requestDelete = useCallback(\n\t\t(id: string) => {\n\t\t\tif (!confirmDelete) {\n\t\t\t\tvoid commentsState.deleteComment(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetPendingDeleteId(id);\n\t\t\tdeleteConfirm.show();\n\t\t},\n\t\t[confirmDelete, commentsState, deleteConfirm],\n\t);\n\tconst startReply = commentsState.startReply;\n\tconst comments = props.comments;\n\tconst onReply = props.onReply;\n\n\tconst handleReply = useCallback(\n\t\t(commentId: string) => {\n\t\t\tconst comment = comments.find((item) => item.id === commentId);\n\t\t\tif (comment) startReply(comment);\n\t\t\tonReply?.(commentId);\n\t\t},\n\t\t[comments, onReply, startReply],\n\t);\n\n\tconst editingComment =\n\t\tcommentsState.composerMode.kind === 'editing'\n\t\t\t? commentsState.composerMode.comment\n\t\t\t: undefined;\n\tconst replyingTo =\n\t\tcommentsState.composerMode.kind === 'replying'\n\t\t\t? {\n\t\t\t\t\tcommentId: commentsState.composerMode.commentId,\n\t\t\t\t\tauthorName: commentsState.composerMode.authorName,\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst composer = props.composerSlot ?? (\n\t\tcanComment ? (\n\t\t\t<CommentComposer<TResource>\n\t\t\t\tcontext={props.context}\n\t\t\t\tcanComment={canComment}\n\t\t\t\tsubmitting={commentsState.isSubmitting}\n\t\t\t\terrors={commentsState.formErrors}\n\t\t\t\tresetKey={commentsState.resetKey}\n\t\t\t\teditingComment={editingComment}\n\t\t\t\treplyingTo={replyingTo}\n\t\t\t\tonCancel={\n\t\t\t\t\tcommentsState.composerMode.kind === 'idle'\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: commentsState.cancelComposerMode\n\t\t\t\t}\n\t\t\t\tonSubmit={commentsState.submit}\n\t\t\t\tstrings={props.strings}\n\t\t\t\tresources={resources}\n\t\t\t\tonResourceSearch={props.onResourceSearch}\n\t\t\t\tattachments={attachments}\n\t\t\t\tmaxAttachments={maxAttachments}\n\t\t\t\tallowAttachments={allowAttachments}\n\t\t\t/>\n\t\t) : null\n\t);\n\n\tconst timeline = (\n\t\t<CommentTimeline<TUser, TMeta, TResource>\n\t\t\tcomments={props.comments}\n\t\t\tcanModerate={canModerate}\n\t\t\tonDelete={props.onDelete ? requestDelete : undefined}\n\t\t\tonAttachmentRemove={props.onAttachmentRemove}\n\t\t\tonEdit={\n\t\t\t\tcanComment && props.onUpdate\n\t\t\t\t\t? commentsState.startEdit\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonPinToggle={onPinToggle}\n\t\t\tonReact={props.onReact}\n\t\t\tonReply={canComment && allowReplies ? handleReply : undefined}\n\t\t\tallowReactions={allowReactions}\n\t\t\tallowReplies={allowReplies}\n\t\t\tsanitizer={props.sanitizer}\n\t\t\tstrings={props.strings}\n\t\t\tgetMediaUrl={props.getMediaUrl}\n\t\t\tgetMediaName={props.getMediaName}\n\t\t\tgetStatusLabel={props.getStatusLabel}\n\t\t\tformatRelativeTime={props.formatRelativeTime}\n\t\t\tresources={resources}\n\t\t\trenderItem={props.renderItem}\n\t\t\trenderAttachment={props.renderAttachment}\n\t\t\trenderReference={props.renderReference}\n\t\t\temptySlot={\n\t\t\t\tprops.emptySlot ?? <CommentEmpty strings={props.strings} />\n\t\t\t}\n\t\t/>\n\t);\n\n\tconst composerBlock = composer ? <div>{composer}</div> : null;\n\n\tconst inner = (\n\t\t<Stack gap=\"xl\" className=\"comments--body\">\n\t\t\t{props.headerSlot}\n\t\t\t{composerPosition === 'top' && composerBlock}\n\t\t\t{timeline}\n\t\t\t{composerPosition === 'bottom' && composerBlock}\n\t\t\t{props.footerSlot}\n\t\t</Stack>\n\t);\n\n\tif (props.bare) {\n\t\treturn inner;\n\t}\n\n\tconst ariaLabel = typeof title === 'string' ? title : undefined;\n\n\treturn (\n\t\t<Stack\n\t\t\trender={<section />}\n\t\t\tgap=\"lg\"\n\t\t\tdata-component=\"comments\"\n\t\t\tdata-slot=\"comments\"\n\t\t\tclassName={cn('comments--component', props.className)}\n\t\t\taria-label={ariaLabel}\n\t\t>\n\t\t\t{!!(title !== false && (title || strings.subtitle)) && (\n\t\t\t\t<Stack gap=\"normal\" className=\"comments--header\">\n\t\t\t\t\t{!!title && <Text weight=\"semibold\">{title}</Text>}\n\t\t\t\t\t{!!strings.subtitle && <Text type=\"secondary\">{strings.subtitle}</Text>}\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t\t{inner}\n\t\t\t{!!(confirmDelete && props.onDelete) && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\t{...deleteConfirm.overlayProps}\n\t\t\t\t\tdestructive\n\t\t\t\t\ttitle={strings.confirmDeleteTitle}\n\t\t\t\t\tdescription={strings.confirmDeleteDescription}\n\t\t\t\t\tstrings={{ confirm: strings.confirmDeleteLabel }}\n\t\t\t\t\tonAsyncConfirm={async () => {\n\t\t\t\t\t\tif (pendingDeleteId) await commentsState.deleteComment(pendingDeleteId);\n\t\t\t\t\t}}\n\t\t\t\t\tonError={props.onError}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Stack>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,IAAa8C,IAA0C;CACtD,OAAO;CACP,UAAU;CACV,OAAO;CACP,WAAW;CAEX,qBAAqB;CACrB,gBAAgB;CAChB,oBAAoB;CACpB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,wBAAwB;CACxB,yBAAyB;CAEzB,yBAAyB;CACzB,wBAAwB;CACxB,4BAA4B;CAC5B,oCAAoC;CACpC,wBAAwB;CACxB,0BAA0B;CAE1B,gBAAgB;CAChB,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,kBAAkB;CAClB,oBAAoB;CACpB,oBAAoB;CACpB,8BAA8B;CAC9B,oCAAoC;CACpC,0BAA0B;CAE1B,oBAAoB;CACpB,uBAAuB;CACvB,0BAA0B;CAC1B,uBAAuB;CACvB,yBAAyB;CACzB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