@elabs-ai/components-ui 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/index.d.ts +4497 -0
- package/dist/index.js +15192 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +10 -0
- package/dist/lib/cn.js +20 -0
- package/dist/lib/cn.js.map +1 -0
- package/package.json +106 -0
- package/src/blocks/sidebar-02/app-sidebar.tsx +160 -0
- package/src/blocks/sidebar-02/logo.tsx +18 -0
- package/src/blocks/sidebar-02/nav-main.tsx +13 -0
- package/src/blocks/sidebar-02/nav-notifications.tsx +7 -0
- package/src/blocks/sidebar-02/sidebar-02.stories.tsx +23 -0
- package/src/blocks/sidebar-02/team-switcher.tsx +7 -0
- package/src/blocks/sidebar-04/app-sidebar.tsx +236 -0
- package/src/blocks/sidebar-04/mail-context.tsx +29 -0
- package/src/blocks/sidebar-04/nav-user.tsx +6 -0
- package/src/blocks/sidebar-04/sidebar-04.stories.tsx +150 -0
- package/src/blocks/sidebar-05/app-sidebar.tsx +375 -0
- package/src/blocks/sidebar-05/sidebar-05.stories.tsx +18 -0
- package/src/blocks/sidebar-05/team-switcher.tsx +6 -0
- package/src/blocks-comparison-table.stories.tsx +165 -0
- package/src/components/accordion/accordion.stories.tsx +71 -0
- package/src/components/accordion/accordion.test.tsx +18 -0
- package/src/components/accordion/accordion.tsx +49 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/advanced-group/advanced-group.stories.tsx +143 -0
- package/src/components/advanced-group/advanced-group.test.tsx +81 -0
- package/src/components/advanced-group/advanced-group.tsx +111 -0
- package/src/components/advanced-group/index.ts +2 -0
- package/src/components/alert/alert.stories.tsx +156 -0
- package/src/components/alert/alert.test.tsx +57 -0
- package/src/components/alert/alert.tsx +91 -0
- package/src/components/alert/index.ts +8 -0
- package/src/components/alert-dialog/alert-dialog.stories.tsx +73 -0
- package/src/components/alert-dialog/alert-dialog.tsx +104 -0
- package/src/components/alert-dialog/index.ts +12 -0
- package/src/components/app-shell/app-shell.stories.tsx +61 -0
- package/src/components/app-shell/app-shell.tsx +31 -0
- package/src/components/app-shell/index.ts +1 -0
- package/src/components/app-sidebar/app-sidebar.stories.tsx +121 -0
- package/src/components/app-sidebar/app-sidebar.test.tsx +55 -0
- package/src/components/app-sidebar/app-sidebar.tsx +53 -0
- package/src/components/app-sidebar/index.ts +1 -0
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +46 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +3 -0
- package/src/components/aspect-ratio/index.ts +1 -0
- package/src/components/attribution-panel/attribution-panel.stories.tsx +83 -0
- package/src/components/attribution-panel/attribution-panel.test.tsx +123 -0
- package/src/components/attribution-panel/attribution-panel.tsx +191 -0
- package/src/components/attribution-panel/attribution-types.ts +44 -0
- package/src/components/attribution-panel/attributions.generated.ts +1422 -0
- package/src/components/attribution-panel/index.ts +3 -0
- package/src/components/avatar/avatar.stories.tsx +45 -0
- package/src/components/avatar/avatar.test.tsx +13 -0
- package/src/components/avatar/avatar.tsx +46 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/badge/badge.stories.tsx +44 -0
- package/src/components/badge/badge.test.tsx +10 -0
- package/src/components/badge/badge.tsx +28 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/bento-grid/bento-grid.stories.tsx +165 -0
- package/src/components/bento-grid/bento-grid.test.tsx +119 -0
- package/src/components/bento-grid/bento-grid.tsx +339 -0
- package/src/components/bento-grid/index.ts +9 -0
- package/src/components/bounded-number/bounded-number.stories.tsx +118 -0
- package/src/components/bounded-number/bounded-number.test.tsx +73 -0
- package/src/components/bounded-number/bounded-number.tsx +110 -0
- package/src/components/bounded-number/index.ts +1 -0
- package/src/components/breadcrumb/breadcrumb.stories.tsx +47 -0
- package/src/components/breadcrumb/breadcrumb.test.tsx +17 -0
- package/src/components/breadcrumb/breadcrumb.tsx +86 -0
- package/src/components/breadcrumb/index.ts +9 -0
- package/src/components/button/button.stories.tsx +70 -0
- package/src/components/button/button.test.tsx +50 -0
- package/src/components/button/button.tsx +63 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button-group/button-group.stories.tsx +45 -0
- package/src/components/button-group/button-group.tsx +70 -0
- package/src/components/button-group/index.ts +6 -0
- package/src/components/calendar/calendar.stories.tsx +95 -0
- package/src/components/calendar/calendar.test.tsx +140 -0
- package/src/components/calendar/calendar.tsx +70 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/card/card.stories.tsx +438 -0
- package/src/components/card/card.test.tsx +153 -0
- package/src/components/card/card.tsx +332 -0
- package/src/components/card/index.ts +13 -0
- package/src/components/carousel/carousel.stories.tsx +102 -0
- package/src/components/carousel/carousel.tsx +225 -0
- package/src/components/carousel/index.ts +8 -0
- package/src/components/change-review/change-review.stories.tsx +288 -0
- package/src/components/change-review/change-review.test.tsx +261 -0
- package/src/components/change-review/change-review.tsx +637 -0
- package/src/components/change-review/index.ts +23 -0
- package/src/components/checkbox/checkbox.stories.tsx +119 -0
- package/src/components/checkbox/checkbox.test.tsx +40 -0
- package/src/components/checkbox/checkbox.tsx +34 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapsible/collapsible.stories.tsx +62 -0
- package/src/components/collapsible/collapsible.tsx +22 -0
- package/src/components/collapsible/index.ts +1 -0
- package/src/components/collapsible-panel/index.ts +8 -0
- package/src/components/collapsible-panel/use-collapsible-panel.test.tsx +93 -0
- package/src/components/collapsible-panel/use-collapsible-panel.ts +159 -0
- package/src/components/color-picker/color-picker.stories.tsx +93 -0
- package/src/components/color-picker/color-picker.test.tsx +79 -0
- package/src/components/color-picker/color-picker.tsx +341 -0
- package/src/components/color-picker/index.ts +1 -0
- package/src/components/combobox/combobox.stories.tsx +154 -0
- package/src/components/combobox/combobox.test.tsx +246 -0
- package/src/components/combobox/combobox.tsx +210 -0
- package/src/components/combobox/index.ts +1 -0
- package/src/components/command/command.stories.tsx +371 -0
- package/src/components/command/command.test.tsx +280 -0
- package/src/components/command/command.tsx +301 -0
- package/src/components/command/index.ts +13 -0
- package/src/components/confirm-dialog/confirm-dialog.stories.tsx +183 -0
- package/src/components/confirm-dialog/confirm-dialog.test.tsx +147 -0
- package/src/components/confirm-dialog/confirm-dialog.tsx +146 -0
- package/src/components/confirm-dialog/index.ts +2 -0
- package/src/components/context-menu/context-menu.stories.tsx +70 -0
- package/src/components/context-menu/context-menu.tsx +172 -0
- package/src/components/context-menu/index.ts +16 -0
- package/src/components/copyable-value/copyable-value.stories.tsx +80 -0
- package/src/components/copyable-value/copyable-value.test.tsx +128 -0
- package/src/components/copyable-value/copyable-value.tsx +101 -0
- package/src/components/copyable-value/index.ts +1 -0
- package/src/components/date-picker/date-picker.stories.tsx +42 -0
- package/src/components/date-picker/date-picker.tsx +49 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-range-picker/date-range-picker.stories.tsx +151 -0
- package/src/components/date-range-picker/date-range-picker.test.tsx +62 -0
- package/src/components/date-range-picker/date-range-picker.tsx +126 -0
- package/src/components/date-range-picker/index.ts +6 -0
- package/src/components/descriptions/descriptions.stories.tsx +43 -0
- package/src/components/descriptions/descriptions.test.tsx +41 -0
- package/src/components/descriptions/descriptions.tsx +95 -0
- package/src/components/descriptions/index.ts +6 -0
- package/src/components/dialog/dialog.stories.tsx +728 -0
- package/src/components/dialog/dialog.test.tsx +285 -0
- package/src/components/dialog/dialog.tsx +340 -0
- package/src/components/dialog/index.ts +18 -0
- package/src/components/dialog/use-dialog-dismiss-guard.test.tsx +80 -0
- package/src/components/dialog/use-dialog-dismiss-guard.ts +109 -0
- package/src/components/drawer/drawer.stories.tsx +76 -0
- package/src/components/drawer/drawer.tsx +85 -0
- package/src/components/drawer/index.ts +11 -0
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +176 -0
- package/src/components/dropdown-menu/dropdown-menu.test.tsx +109 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +179 -0
- package/src/components/dropdown-menu/index.ts +17 -0
- package/src/components/empty-state/empty-state.stories.tsx +54 -0
- package/src/components/empty-state/empty-state.test.tsx +11 -0
- package/src/components/empty-state/empty-state.tsx +30 -0
- package/src/components/empty-state/index.ts +1 -0
- package/src/components/error-state/error-state.stories.tsx +51 -0
- package/src/components/error-state/error-state.tsx +27 -0
- package/src/components/error-state/index.ts +1 -0
- package/src/components/expand-dialog/expand-dialog.stories.tsx +246 -0
- package/src/components/expand-dialog/expand-dialog.test.tsx +185 -0
- package/src/components/expand-dialog/expand-dialog.tsx +387 -0
- package/src/components/expand-dialog/index.ts +11 -0
- package/src/components/field-row/field-row.stories.tsx +114 -0
- package/src/components/field-row/field-row.test.tsx +188 -0
- package/src/components/field-row/field-row.tsx +115 -0
- package/src/components/field-row/index.ts +1 -0
- package/src/components/file-upload/file-upload.stories.tsx +183 -0
- package/src/components/file-upload/file-upload.test.tsx +169 -0
- package/src/components/file-upload/file-upload.tsx +459 -0
- package/src/components/file-upload/index.ts +13 -0
- package/src/components/form/form.stories.tsx +71 -0
- package/src/components/form/form.tsx +141 -0
- package/src/components/form/index.ts +10 -0
- package/src/components/hover-card/hover-card.stories.tsx +57 -0
- package/src/components/hover-card/hover-card.tsx +25 -0
- package/src/components/hover-card/index.ts +1 -0
- package/src/components/icon-button/icon-button.stories.tsx +108 -0
- package/src/components/icon-button/icon-button.test.tsx +93 -0
- package/src/components/icon-button/icon-button.tsx +139 -0
- package/src/components/icon-button/index.ts +1 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.stories.tsx +44 -0
- package/src/components/input/input.test.tsx +19 -0
- package/src/components/input/input.tsx +26 -0
- package/src/components/input-group/index.ts +11 -0
- package/src/components/input-group/input-group.stories.tsx +87 -0
- package/src/components/input-group/input-group.test.tsx +48 -0
- package/src/components/input-group/input-group.tsx +170 -0
- package/src/components/input-otp/index.ts +1 -0
- package/src/components/input-otp/input-otp.stories.tsx +66 -0
- package/src/components/input-otp/input-otp.tsx +68 -0
- package/src/components/kbd/index.ts +1 -0
- package/src/components/kbd/kbd.stories.tsx +45 -0
- package/src/components/kbd/kbd.tsx +20 -0
- package/src/components/key-value-editor/index.ts +1 -0
- package/src/components/key-value-editor/key-value-editor.stories.tsx +130 -0
- package/src/components/key-value-editor/key-value-editor.test.tsx +231 -0
- package/src/components/key-value-editor/key-value-editor.tsx +263 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/label/label.stories.tsx +35 -0
- package/src/components/label/label.tsx +19 -0
- package/src/components/link-preview/index.ts +2 -0
- package/src/components/link-preview/link-preview.stories.tsx +178 -0
- package/src/components/link-preview/link-preview.test.tsx +123 -0
- package/src/components/link-preview/link-preview.tsx +194 -0
- package/src/components/list-editor/index.ts +1 -0
- package/src/components/list-editor/list-editor.stories.tsx +119 -0
- package/src/components/list-editor/list-editor.test.tsx +96 -0
- package/src/components/list-editor/list-editor.tsx +192 -0
- package/src/components/loading-state/index.ts +1 -0
- package/src/components/loading-state/loading-state.stories.tsx +38 -0
- package/src/components/loading-state/loading-state.tsx +26 -0
- package/src/components/locale-provider/index.ts +8 -0
- package/src/components/locale-provider/locale-provider.stories.tsx +83 -0
- package/src/components/locale-provider/locale-provider.test.tsx +238 -0
- package/src/components/locale-provider/locale-provider.tsx +187 -0
- package/src/components/locale-provider/messages.ts +300 -0
- package/src/components/match-highlight/index.ts +7 -0
- package/src/components/match-highlight/match-highlight.stories.tsx +146 -0
- package/src/components/match-highlight/match-highlight.test.tsx +202 -0
- package/src/components/match-highlight/match-highlight.tsx +145 -0
- package/src/components/mention-input/index.ts +28 -0
- package/src/components/mention-input/mention-input-mirror.stories.tsx +171 -0
- package/src/components/mention-input/mention-input.stories.tsx +463 -0
- package/src/components/mention-input/mention-input.test.tsx +617 -0
- package/src/components/mention-input/mention-input.tsx +1102 -0
- package/src/components/mention-input/mention-value.test.ts +253 -0
- package/src/components/mention-input/mention-value.ts +193 -0
- package/src/components/menubar/index.ts +17 -0
- package/src/components/menubar/menubar.stories.tsx +67 -0
- package/src/components/menubar/menubar.tsx +198 -0
- package/src/components/metric-card/index.ts +1 -0
- package/src/components/metric-card/metric-card.stories.tsx +224 -0
- package/src/components/metric-card/metric-card.test.tsx +198 -0
- package/src/components/metric-card/metric-card.tsx +229 -0
- package/src/components/model-picker/index.ts +11 -0
- package/src/components/model-picker/model-picker-state.ts +85 -0
- package/src/components/model-picker/model-picker.stories.tsx +128 -0
- package/src/components/model-picker/model-picker.test.tsx +241 -0
- package/src/components/model-picker/model-picker.tsx +270 -0
- package/src/components/nav-main/index.ts +1 -0
- package/src/components/nav-main/nav-main.tsx +147 -0
- package/src/components/nav-notifications/index.ts +5 -0
- package/src/components/nav-notifications/nav-notifications.test.tsx +15 -0
- package/src/components/nav-notifications/nav-notifications.tsx +70 -0
- package/src/components/nav-user/index.ts +1 -0
- package/src/components/nav-user/nav-user.test.tsx +29 -0
- package/src/components/nav-user/nav-user.tsx +114 -0
- package/src/components/navigation-menu/index.ts +10 -0
- package/src/components/navigation-menu/navigation-menu.stories.tsx +92 -0
- package/src/components/navigation-menu/navigation-menu.tsx +99 -0
- package/src/components/number-input/index.ts +1 -0
- package/src/components/number-input/number-input.stories.tsx +120 -0
- package/src/components/number-input/number-input.test.tsx +96 -0
- package/src/components/number-input/number-input.tsx +219 -0
- package/src/components/page-shell/index.ts +1 -0
- package/src/components/page-shell/page-shell.stories.tsx +105 -0
- package/src/components/page-shell/page-shell.test.tsx +57 -0
- package/src/components/page-shell/page-shell.tsx +62 -0
- package/src/components/pagination/index.ts +9 -0
- package/src/components/pagination/pagination.stories.tsx +57 -0
- package/src/components/pagination/pagination.tsx +77 -0
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover.stories.tsx +28 -0
- package/src/components/popover/popover.test.tsx +16 -0
- package/src/components/popover/popover.tsx +29 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.stories.tsx +80 -0
- package/src/components/progress/progress.test.tsx +35 -0
- package/src/components/progress/progress.tsx +50 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.stories.tsx +75 -0
- package/src/components/radio-group/radio-group.test.tsx +16 -0
- package/src/components/radio-group/radio-group.tsx +33 -0
- package/src/components/rating/index.ts +1 -0
- package/src/components/rating/rating.stories.tsx +111 -0
- package/src/components/rating/rating.test.tsx +41 -0
- package/src/components/rating/rating.tsx +226 -0
- package/src/components/resizable/index.ts +1 -0
- package/src/components/resizable/resizable.stories.tsx +25 -0
- package/src/components/resizable/resizable.tsx +40 -0
- package/src/components/reveal/index.ts +7 -0
- package/src/components/reveal/reveal.stories.tsx +90 -0
- package/src/components/reveal/reveal.test.tsx +43 -0
- package/src/components/reveal/reveal.tsx +95 -0
- package/src/components/revision-timeline/index.ts +10 -0
- package/src/components/revision-timeline/revision-timeline.stories.tsx +785 -0
- package/src/components/revision-timeline/revision-timeline.test.tsx +509 -0
- package/src/components/revision-timeline/revision-timeline.tsx +1107 -0
- package/src/components/scroll-area/index.ts +1 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +45 -0
- package/src/components/scroll-area/scroll-area.tsx +43 -0
- package/src/components/section-header/index.ts +1 -0
- package/src/components/section-header/section-header.stories.tsx +20 -0
- package/src/components/section-header/section-header.tsx +36 -0
- package/src/components/segmented-field/index.ts +5 -0
- package/src/components/segmented-field/segmented-field.stories.tsx +121 -0
- package/src/components/segmented-field/segmented-field.test.tsx +163 -0
- package/src/components/segmented-field/segmented-field.tsx +235 -0
- package/src/components/select/index.ts +10 -0
- package/src/components/select/select.stories.tsx +106 -0
- package/src/components/select/select.test.tsx +98 -0
- package/src/components/select/select.tsx +230 -0
- package/src/components/separator/index.ts +2 -0
- package/src/components/separator/separator.stories.tsx +87 -0
- package/src/components/separator/separator.tsx +51 -0
- package/src/components/sheet/index.ts +12 -0
- package/src/components/sheet/sheet.stories.tsx +65 -0
- package/src/components/sheet/sheet.tsx +109 -0
- package/src/components/sidebar/index.ts +27 -0
- package/src/components/sidebar/sidebar.stories.tsx +69 -0
- package/src/components/sidebar/sidebar.test.tsx +43 -0
- package/src/components/sidebar/sidebar.tsx +688 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.stories.tsx +28 -0
- package/src/components/skeleton/skeleton.tsx +15 -0
- package/src/components/slider/index.ts +1 -0
- package/src/components/slider/slider.stories.tsx +211 -0
- package/src/components/slider/slider.test.tsx +168 -0
- package/src/components/slider/slider.tsx +136 -0
- package/src/components/slider-number/index.ts +1 -0
- package/src/components/slider-number/slider-number.stories.tsx +123 -0
- package/src/components/slider-number/slider-number.test.tsx +165 -0
- package/src/components/slider-number/slider-number.tsx +191 -0
- package/src/components/sonner/index.ts +1 -0
- package/src/components/sonner/sonner.stories.tsx +124 -0
- package/src/components/sonner/sonner.test.tsx +76 -0
- package/src/components/sonner/sonner.tsx +101 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.stories.tsx +27 -0
- package/src/components/spinner/spinner.tsx +19 -0
- package/src/components/split-panel/index.ts +1 -0
- package/src/components/split-panel/split-panel.stories.tsx +60 -0
- package/src/components/split-panel/split-panel.test.tsx +38 -0
- package/src/components/split-panel/split-panel.tsx +95 -0
- package/src/components/state-panel/index.ts +1 -0
- package/src/components/state-panel/state-panel.stories.tsx +80 -0
- package/src/components/state-panel/state-panel.test.tsx +64 -0
- package/src/components/state-panel/state-panel.tsx +167 -0
- package/src/components/status-badge/index.ts +18 -0
- package/src/components/status-badge/status-badge.stories.tsx +132 -0
- package/src/components/status-badge/status-badge.test.tsx +189 -0
- package/src/components/status-badge/status-badge.tsx +330 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.stories.tsx +58 -0
- package/src/components/switch/switch.test.tsx +12 -0
- package/src/components/switch/switch.tsx +29 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table.stories.tsx +53 -0
- package/src/components/table/table.test.tsx +17 -0
- package/src/components/table/table.tsx +106 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/tabs.stories.tsx +267 -0
- package/src/components/tabs/tabs.test.tsx +94 -0
- package/src/components/tabs/tabs.tsx +170 -0
- package/src/components/tag-input/index.ts +1 -0
- package/src/components/tag-input/tag-input.stories.tsx +120 -0
- package/src/components/tag-input/tag-input.test.tsx +97 -0
- package/src/components/tag-input/tag-input.tsx +253 -0
- package/src/components/team-switcher/index.ts +1 -0
- package/src/components/team-switcher/team-switcher.test.tsx +39 -0
- package/src/components/team-switcher/team-switcher.tsx +100 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/textarea.stories.tsx +42 -0
- package/src/components/textarea/textarea.tsx +24 -0
- package/src/components/theme-switcher/index.ts +2 -0
- package/src/components/theme-switcher/theme-switcher.stories.tsx +146 -0
- package/src/components/theme-switcher/theme-switcher.test.tsx +253 -0
- package/src/components/theme-switcher/theme-switcher.tsx +280 -0
- package/src/components/theme-switcher/use-theme-transition.ts +62 -0
- package/src/components/timeline/index.ts +13 -0
- package/src/components/timeline/timeline.stories.tsx +99 -0
- package/src/components/timeline/timeline.test.tsx +196 -0
- package/src/components/timeline/timeline.tsx +188 -0
- package/src/components/toggle/index.ts +1 -0
- package/src/components/toggle/toggle.stories.tsx +116 -0
- package/src/components/toggle/toggle.test.tsx +119 -0
- package/src/components/toggle/toggle.tsx +64 -0
- package/src/components/toggle-group/index.ts +1 -0
- package/src/components/toggle-group/toggle-group.stories.tsx +110 -0
- package/src/components/toggle-group/toggle-group.tsx +59 -0
- package/src/components/toolbar/index.ts +14 -0
- package/src/components/toolbar/toolbar.stories.tsx +126 -0
- package/src/components/toolbar/toolbar.test.tsx +73 -0
- package/src/components/toolbar/toolbar.tsx +177 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/tooltip/tooltip.stories.tsx +67 -0
- package/src/components/tooltip/tooltip.tsx +27 -0
- package/src/components/top-nav/index.ts +1 -0
- package/src/components/top-nav/top-nav.stories.tsx +18 -0
- package/src/components/top-nav/top-nav.tsx +34 -0
- package/src/components/transfer/index.ts +2 -0
- package/src/components/transfer/transfer.stories.tsx +162 -0
- package/src/components/transfer/transfer.test.tsx +177 -0
- package/src/components/transfer/transfer.tsx +481 -0
- package/src/components/tree/index.ts +6 -0
- package/src/components/tree/tree.stories.tsx +618 -0
- package/src/components/tree/tree.test.tsx +699 -0
- package/src/components/tree/tree.tsx +1149 -0
- package/src/components/tree/use-tree-keyboard.ts +314 -0
- package/src/components/tree-select/index.ts +1 -0
- package/src/components/tree-select/tree-select.stories.tsx +127 -0
- package/src/components/tree-select/tree-select.test.tsx +40 -0
- package/src/components/tree-select/tree-select.tsx +137 -0
- package/src/components/typography/index.ts +31 -0
- package/src/components/typography/prose.test.tsx +48 -0
- package/src/components/typography/prose.tsx +194 -0
- package/src/components/typography/typography.stories.tsx +244 -0
- package/src/components/typography/typography.test.tsx +140 -0
- package/src/components/typography/typography.tsx +126 -0
- package/src/components/view-toolbar/index.ts +10 -0
- package/src/components/view-toolbar/view-toolbar.stories.tsx +342 -0
- package/src/components/view-toolbar/view-toolbar.test.tsx +262 -0
- package/src/components/view-toolbar/view-toolbar.tsx +320 -0
- package/src/components/virtual-select/index.ts +2 -0
- package/src/components/virtual-select/use-virtual-listbox.ts +132 -0
- package/src/components/virtual-select/virtual-select.stories.tsx +203 -0
- package/src/components/virtual-select/virtual-select.test.tsx +106 -0
- package/src/components/virtual-select/virtual-select.tsx +361 -0
- package/src/components/wizard/index.ts +12 -0
- package/src/components/wizard/wizard.stories.tsx +148 -0
- package/src/components/wizard/wizard.test.tsx +67 -0
- package/src/components/wizard/wizard.tsx +354 -0
- package/src/decoration.stories.tsx +236 -0
- package/src/index.ts +174 -0
- package/src/lib/cn.test.ts +39 -0
- package/src/lib/cn.ts +31 -0
- package/src/lib/compact-number.ts +61 -0
- package/src/lib/document-address.test.ts +75 -0
- package/src/lib/document-address.ts +265 -0
- package/src/lib/download.ts +93 -0
- package/src/lib/file-icon.test.ts +45 -0
- package/src/lib/file-icon.ts +58 -0
- package/src/lib/file-kind.test.ts +98 -0
- package/src/lib/file-kind.ts +303 -0
- package/src/lib/file-source.test.ts +217 -0
- package/src/lib/file-source.ts +269 -0
- package/src/lib/merge-refs.test.ts +37 -0
- package/src/lib/merge-refs.ts +17 -0
- package/src/lib/streamdown-translations.ts +99 -0
- package/src/lib/use-copy-to-clipboard.ts +75 -0
- package/src/lib/use-mobile.ts +16 -0
- package/src/motion.stories.tsx +266 -0
- package/src/taste-profile.test.tsx +252 -0
- package/src/templates-object-detail-hub.stories.tsx +466 -0
- package/src/templates-screen-states.stories.tsx +306 -0
- package/src/templates-settings.stories.tsx +245 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/cn.ts","../src/lib/use-mobile.ts","../src/lib/download.ts","../src/lib/use-copy-to-clipboard.ts","../src/lib/file-kind.ts","../src/lib/file-source.ts","../src/lib/file-icon.ts","../src/lib/document-address.ts","../src/lib/streamdown-translations.ts","../src/components/locale-provider/locale-provider.tsx","../src/components/locale-provider/messages.ts","../src/components/accordion/accordion.tsx","../src/components/advanced-group/advanced-group.tsx","../src/components/badge/badge.tsx","../src/components/collapsible/collapsible.tsx","../src/components/app-sidebar/app-sidebar.tsx","../src/components/sidebar/sidebar.tsx","../src/components/button/button.tsx","../src/components/collapsible-panel/use-collapsible-panel.ts","../src/components/input/input.tsx","../src/components/separator/separator.tsx","../src/components/sheet/sheet.tsx","../src/components/skeleton/skeleton.tsx","../src/components/tooltip/tooltip.tsx","../src/components/alert/alert.tsx","../src/components/alert-dialog/alert-dialog.tsx","../src/components/app-shell/app-shell.tsx","../src/components/aspect-ratio/aspect-ratio.tsx","../src/components/attribution-panel/attribution-panel.tsx","../src/components/scroll-area/scroll-area.tsx","../src/components/attribution-panel/attributions.generated.ts","../src/components/avatar/avatar.tsx","../src/components/bento-grid/bento-grid.tsx","../src/components/card/card.tsx","../src/components/bounded-number/bounded-number.tsx","../src/components/number-input/number-input.tsx","../src/components/input-group/input-group.tsx","../src/components/textarea/textarea.tsx","../src/components/breadcrumb/breadcrumb.tsx","../src/components/button-group/button-group.tsx","../src/components/calendar/calendar.tsx","../src/components/carousel/carousel.tsx","../src/components/change-review/change-review.tsx","../src/components/state-panel/state-panel.tsx","../src/components/checkbox/checkbox.tsx","../src/components/color-picker/color-picker.tsx","../src/components/popover/popover.tsx","../src/components/combobox/combobox.tsx","../src/components/command/command.tsx","../src/lib/merge-refs.ts","../src/components/dialog/dialog.tsx","../src/components/typography/typography.tsx","../src/components/typography/prose.tsx","../src/components/dialog/use-dialog-dismiss-guard.ts","../src/components/confirm-dialog/confirm-dialog.tsx","../src/components/spinner/spinner.tsx","../src/components/context-menu/context-menu.tsx","../src/components/copyable-value/copyable-value.tsx","../src/components/date-picker/date-picker.tsx","../src/components/date-range-picker/date-range-picker.tsx","../src/components/descriptions/descriptions.tsx","../src/components/drawer/drawer.tsx","../src/components/dropdown-menu/dropdown-menu.tsx","../src/components/empty-state/empty-state.tsx","../src/components/error-state/error-state.tsx","../src/components/expand-dialog/expand-dialog.tsx","../src/components/field-row/field-row.tsx","../src/components/label/label.tsx","../src/components/file-upload/file-upload.tsx","../src/components/progress/progress.tsx","../src/components/form/form.tsx","../src/components/hover-card/hover-card.tsx","../src/components/icon-button/icon-button.tsx","../src/components/input-otp/input-otp.tsx","../src/components/kbd/kbd.tsx","../src/components/key-value-editor/key-value-editor.tsx","../src/components/link-preview/link-preview.tsx","../src/components/list-editor/list-editor.tsx","../src/components/loading-state/loading-state.tsx","../src/components/match-highlight/match-highlight.tsx","../src/components/mention-input/mention-input.tsx","../src/components/mention-input/mention-value.ts","../src/components/menubar/menubar.tsx","../src/components/model-picker/model-picker.tsx","../src/components/model-picker/model-picker-state.ts","../src/components/metric-card/metric-card.tsx","../src/lib/compact-number.ts","../src/components/nav-main/nav-main.tsx","../src/components/nav-notifications/nav-notifications.tsx","../src/components/nav-user/nav-user.tsx","../src/components/navigation-menu/navigation-menu.tsx","../src/components/page-shell/page-shell.tsx","../src/components/pagination/pagination.tsx","../src/components/radio-group/radio-group.tsx","../src/components/rating/rating.tsx","../src/components/resizable/resizable.tsx","../src/components/reveal/reveal.tsx","../src/components/section-header/section-header.tsx","../src/components/segmented-field/segmented-field.tsx","../src/components/toggle-group/toggle-group.tsx","../src/components/toggle/toggle.tsx","../src/components/select/select.tsx","../src/components/slider/slider.tsx","../src/components/slider-number/slider-number.tsx","../src/components/sonner/sonner.tsx","../src/components/status-badge/status-badge.tsx","../src/components/split-panel/split-panel.tsx","../src/components/switch/switch.tsx","../src/components/table/table.tsx","../src/components/tabs/tabs.tsx","../src/components/tag-input/tag-input.tsx","../src/components/team-switcher/team-switcher.tsx","../src/components/theme-switcher/theme-switcher.tsx","../src/components/theme-switcher/use-theme-transition.ts","../src/components/revision-timeline/revision-timeline.tsx","../src/components/timeline/timeline.tsx","../src/components/toolbar/toolbar.tsx","../src/components/top-nav/top-nav.tsx","../src/components/transfer/transfer.tsx","../src/components/tree/tree.tsx","../src/components/tree/use-tree-keyboard.ts","../src/components/tree-select/tree-select.tsx","../src/components/view-toolbar/view-toolbar.tsx","../src/components/virtual-select/virtual-select.tsx","../src/components/virtual-select/use-virtual-listbox.ts","../src/components/wizard/wizard.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\n/**\n * The semantic type roles (`--text-<role>` tokens → `text-<role>` utilities, #187).\n * tailwind-merge doesn't know custom theme keys, so without registration it\n * classifies `text-title` as a text COLOR — and `cn(\"text-kpi\", \"text-foreground\")`\n * would silently drop the role. Registering the roles in the `font-size` class\n * group makes role-vs-role and role-vs-raw-size conflicts resolve correctly while\n * keeping role + color independent.\n */\nconst TEXT_ROLES = [\"display\", \"title\", \"subtitle\", \"body\", \"caption\", \"meta\", \"kpi\", \"code\"];\n\nconst twMerge = extendTailwindMerge({\n extend: {\n classGroups: {\n \"font-size\": [{ text: TEXT_ROLES }],\n // `font-display` is the display-face seam (sibling of font-mono, #187).\n \"font-family\": [{ font: [\"display\"] }],\n },\n },\n});\n\n/**\n * Merge class names with conflict resolution. `clsx` handles conditionals;\n * `tailwind-merge` ensures later Tailwind utilities win (e.g. `p-2 p-4` -> `p-4`).\n * Use this in every component that accepts a `className` prop.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { useEffect, useState } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\n/** Returns true when the viewport is below the mobile breakpoint (768px). */\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState<boolean | undefined>(undefined);\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n return !!isMobile;\n}\n","/**\n * Browser file-download helpers — the single home for the\n * `Blob`/URL → hidden `<a download>` → click → revoke dance that was previously\n * copy-pasted across `@elabs-ai/components-ai` (ConversationDownload), `@elabs-ai/components-data`\n * (downloadCsv) and now `@elabs-ai/components-ai` Gallery.\n *\n * Pure DOM mechanics, no React, no other deps — and SSR-guarded\n * (`typeof document === \"undefined\"` → no-op) so it's safe to import from\n * dependency-light modules. The CONTENT (CSV serialization, markdown export,\n * image source) stays with each caller; this only triggers the save.\n */\n\n/** Internal: click a hidden anchor for `url`, optionally suggesting `filename`. */\nfunction clickAnchor(url: string, filename?: string): void {\n const a = document.createElement(\"a\");\n a.href = url;\n // `download` is only honored for same-origin / blob: / data: URLs; harmless otherwise.\n if (filename) a.download = filename;\n a.rel = \"noopener\";\n a.style.display = \"none\";\n document.body.appendChild(a);\n a.click();\n a.remove();\n}\n\n/** Best-effort filename from a URL path; falls back to \"download\". */\nfunction filenameFromUrl(url: string): string {\n try {\n const base = \"http://localhost\";\n const ref = typeof window === \"undefined\" ? base : window.location.href;\n const { pathname } = new URL(url, ref);\n const last = pathname.split(\"/\").filter(Boolean).pop();\n return last && last.length > 0 ? decodeURIComponent(last) : \"download\";\n } catch {\n return \"download\";\n }\n}\n\n/** True for sources `<a download>` can save directly (same-origin, blob:, data:). */\nfunction isDirectlyDownloadable(url: string): boolean {\n if (url.startsWith(\"data:\") || url.startsWith(\"blob:\")) return true;\n if (typeof window === \"undefined\") return true;\n try {\n return new URL(url, window.location.href).origin === window.location.origin;\n } catch {\n // Relative or unparseable → treat as same-origin (the anchor resolves it).\n return true;\n }\n}\n\n/**\n * Trigger a download for an in-memory `Blob`. No-op in non-DOM environments.\n * Revokes the object URL immediately after the click (the browser captures the\n * download synchronously, mirroring the prior call sites).\n */\nexport function downloadBlob(blob: Blob, filename: string): void {\n if (typeof document === \"undefined\") return;\n const url = URL.createObjectURL(blob);\n try {\n clickAnchor(url, filename);\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n\n/**\n * Trigger a download for an existing `url` (an http(s)/relative URL, or a\n * `data:`/`blob:` URI). No-op in non-DOM environments.\n *\n * Same-origin / `blob:` / `data:` → a direct `<a download>` (honors `filename`).\n * Cross-origin → the browser ignores the `download` filename, so we `fetch` the\n * bytes and save via {@link downloadBlob}. This requires the server to allow CORS;\n * on failure (CORS/opaque/offline) we fall back to opening the source in a new\n * tab so the user still gets the asset. Fire-and-forget: `void downloadUrl(...)`.\n */\nexport async function downloadUrl(url: string, filename?: string): Promise<void> {\n if (typeof document === \"undefined\") return;\n\n if (isDirectlyDownloadable(url)) {\n clickAnchor(url, filename);\n return;\n }\n\n try {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Download failed: ${res.status}`);\n const blob = await res.blob();\n downloadBlob(blob, filename ?? filenameFromUrl(url));\n } catch {\n // CORS / opaque / offline: best effort so the user still reaches the asset.\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n }\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\n/** How long the transient \"copied\" state stays true before it resets. */\nexport const COPY_FEEDBACK_MS = 1500;\n\nexport interface UseCopyToClipboardOptions {\n /** ms the `copied` flag stays true. Default: {@link COPY_FEEDBACK_MS}. */\n resetAfterMs?: number;\n}\n\nexport interface CopyToClipboard {\n /** True for `resetAfterMs` after a successful copy. */\n copied: boolean;\n /** Writes `text` to the clipboard. Resolves `false` when it could not. */\n copy: (text: string) => Promise<boolean>;\n}\n\n/**\n * Copy-to-clipboard with a transient confirmation flag.\n *\n * One implementation for the whole library — the copy button in\n * `@elabs-ai/components-editor` and `CopyableValue` share it, so the\n * timing, the unmount cleanup and the \"no clipboard here\" answer are defined\n * once instead of re-derived per component.\n *\n * `navigator.clipboard` is absent under SSR, in jsdom, and in any insecure\n * (non-`https`, non-`localhost`) context. That is reported as `false` rather\n * than thrown: a copy affordance failing is a papercut, not a crash, and the\n * caller decides whether to say anything about it. The deprecated\n * `document.execCommand(\"copy\")` fallback is deliberately not used.\n */\nexport function useCopyToClipboard(options?: UseCopyToClipboardOptions): CopyToClipboard {\n const resetAfterMs = options?.resetAfterMs ?? COPY_FEEDBACK_MS;\n const [copied, setCopied] = useState(false);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // A component that unmounts inside the feedback window must not have its\n // state set afterwards, and a second copy must restart the window, not race\n // the first one's reset.\n useEffect(\n () => () => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n },\n [],\n );\n\n const copy = useCallback(\n async (text: string): Promise<boolean> => {\n if (typeof navigator === \"undefined\" || !navigator.clipboard) {\n return false;\n }\n try {\n await navigator.clipboard.writeText(text);\n } catch {\n return false;\n }\n setCopied(true);\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n setCopied(false);\n }, resetAfterMs);\n return true;\n },\n [resetAfterMs],\n );\n\n return { copied, copy };\n}\n","/**\n * The one file-type resolver for the whole library — extension + MIME → a\n * COARSE, CLOSED category.\n *\n * Before this existed the repo had three competing, package-private ideas of\n * \"what kind of file is this\": `ContextAssetType`\n * (`markdown|code|sql|csv|image`, `@elabs-ai/components-ai`),\n * `AttachmentMediaCategory` (six MIME buckets, same package) and\n * `UploadFile` (no kind at all, `@elabs-ai/components-ui`). None could\n * see the others, so each grew its own icon map and its own gaps.\n *\n * ## Why the category is closed and coarse (ADR 0024 §4)\n *\n * {@link FileCategory} answers \"what SHAPE of thing is this\" — enough to pick an\n * icon, a label, or a fallback surface. It is deliberately NOT the routing key\n * for a renderer. Fine-grained format matching (`.docx` vs `.odt`,\n * `.tsx` vs `.rs`) belongs to the adapter manifests in the package that owns the\n * parsers, so adding a format never means editing this file — and never means a\n * `@elabs-ai/components-ui` release.\n *\n * Pure data + string handling: no React, no DOM, no other deps.\n */\n\n/**\n * Coarse file shape. CLOSED — adding a member is a breaking change for any\n * consumer with an exhaustive `switch`, so extend the adapter manifests instead.\n */\nexport type FileCategory =\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"document\"\n | \"spreadsheet\"\n | \"presentation\"\n | \"code\"\n | \"text\"\n | \"data\"\n | \"archive\"\n | \"unknown\";\n\n/** What {@link resolveFileKind} knows about a file before anything reads it. */\nexport interface FileKind {\n /** Coarse shape, for icons, labels and fallback surfaces. */\n category: FileCategory;\n /**\n * Best-known MIME type. The caller's value wins when it is meaningful;\n * otherwise inferred from the extension, else `\"application/octet-stream\"`.\n */\n mediaType: string;\n /** Lowercased extension WITHOUT the dot (`\"pdf\"`), or `\"\"` when there is none. */\n extension: string;\n}\n\n/**\n * Extension → MIME. Only entries whose MIME we would otherwise have to guess;\n * the browser fills `File.type` correctly for common web formats, but leaves it\n * empty for most source-code and data files.\n */\nconst EXTENSION_MEDIA_TYPES: Readonly<Record<string, string>> = {\n // Media. The browser fills `File.type` for these, but a NAME on its own (a\n // URL, an agent-produced filename, a drag-and-drop path) carries no MIME —\n // and resolving `photo.png` to \"unknown\" is the whole failure this map exists\n // to prevent.\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n avif: \"image/avif\",\n bmp: \"image/bmp\",\n ico: \"image/x-icon\",\n tif: \"image/tiff\",\n tiff: \"image/tiff\",\n heic: \"image/heic\",\n mp4: \"video/mp4\",\n m4v: \"video/mp4\",\n webm: \"video/webm\",\n mov: \"video/quicktime\",\n avi: \"video/x-msvideo\",\n mkv: \"video/x-matroska\",\n mp3: \"audio/mpeg\",\n wav: \"audio/wav\",\n ogg: \"audio/ogg\",\n oga: \"audio/ogg\",\n m4a: \"audio/mp4\",\n flac: \"audio/flac\",\n aac: \"audio/aac\",\n // Documents\n pdf: \"application/pdf\",\n doc: \"application/msword\",\n docx: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n odt: \"application/vnd.oasis.opendocument.text\",\n rtf: \"application/rtf\",\n epub: \"application/epub+zip\",\n // Spreadsheets\n xls: \"application/vnd.ms-excel\",\n xlsx: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n ods: \"application/vnd.oasis.opendocument.spreadsheet\",\n // Presentations\n ppt: \"application/vnd.ms-powerpoint\",\n pptx: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n odp: \"application/vnd.oasis.opendocument.presentation\",\n // Data\n csv: \"text/csv\",\n tsv: \"text/tab-separated-values\",\n json: \"application/json\",\n ndjson: \"application/x-ndjson\",\n jsonl: \"application/x-ndjson\",\n parquet: \"application/vnd.apache.parquet\",\n // Text\n txt: \"text/plain\",\n log: \"text/plain\",\n md: \"text/markdown\",\n markdown: \"text/markdown\",\n rst: \"text/x-rst\",\n // Code & markup\n html: \"text/html\",\n htm: \"text/html\",\n xml: \"application/xml\",\n svg: \"image/svg+xml\",\n css: \"text/css\",\n js: \"text/javascript\",\n mjs: \"text/javascript\",\n cjs: \"text/javascript\",\n jsx: \"text/javascript\",\n ts: \"text/x-typescript\",\n tsx: \"text/x-typescript\",\n py: \"text/x-python\",\n rb: \"text/x-ruby\",\n go: \"text/x-go\",\n rs: \"text/x-rust\",\n java: \"text/x-java\",\n kt: \"text/x-kotlin\",\n swift: \"text/x-swift\",\n c: \"text/x-c\",\n h: \"text/x-c\",\n cpp: \"text/x-c++src\",\n cs: \"text/x-csharp\",\n php: \"text/x-php\",\n sh: \"application/x-sh\",\n bash: \"application/x-sh\",\n zsh: \"application/x-sh\",\n sql: \"application/sql\",\n yaml: \"application/yaml\",\n yml: \"application/yaml\",\n toml: \"application/toml\",\n ini: \"text/plain\",\n // Archives\n zip: \"application/zip\",\n tar: \"application/x-tar\",\n gz: \"application/gzip\",\n tgz: \"application/gzip\",\n bz2: \"application/x-bzip2\",\n \"7z\": \"application/x-7z-compressed\",\n rar: \"application/vnd.rar\",\n};\n\n/** Extensions whose category cannot be read off the MIME type. */\nconst EXTENSION_CATEGORIES: Readonly<Record<string, FileCategory>> = {\n // Code & markup — most carry a `text/*` MIME, which alone would say \"text\".\n html: \"code\",\n htm: \"code\",\n xml: \"code\",\n css: \"code\",\n js: \"code\",\n mjs: \"code\",\n cjs: \"code\",\n jsx: \"code\",\n ts: \"code\",\n tsx: \"code\",\n py: \"code\",\n rb: \"code\",\n go: \"code\",\n rs: \"code\",\n java: \"code\",\n kt: \"code\",\n swift: \"code\",\n c: \"code\",\n h: \"code\",\n cpp: \"code\",\n cs: \"code\",\n php: \"code\",\n sh: \"code\",\n bash: \"code\",\n zsh: \"code\",\n sql: \"code\",\n yaml: \"code\",\n yml: \"code\",\n toml: \"code\",\n ini: \"code\",\n // Data — `text/csv` would otherwise land in \"text\".\n csv: \"data\",\n tsv: \"data\",\n json: \"data\",\n ndjson: \"data\",\n jsonl: \"data\",\n parquet: \"data\",\n // Prose\n txt: \"text\",\n log: \"text\",\n md: \"text\",\n markdown: \"text\",\n rst: \"text\",\n};\n\n/** MIME (exact match) → category, for types no prefix rule covers. */\nconst MEDIA_TYPE_CATEGORIES: Readonly<Record<string, FileCategory>> = {\n \"application/pdf\": \"document\",\n \"application/msword\": \"document\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": \"document\",\n \"application/vnd.oasis.opendocument.text\": \"document\",\n \"application/rtf\": \"document\",\n \"application/epub+zip\": \"document\",\n \"application/vnd.ms-excel\": \"spreadsheet\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"spreadsheet\",\n \"application/vnd.oasis.opendocument.spreadsheet\": \"spreadsheet\",\n \"application/vnd.ms-powerpoint\": \"presentation\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\": \"presentation\",\n \"application/vnd.oasis.opendocument.presentation\": \"presentation\",\n \"application/json\": \"data\",\n \"application/x-ndjson\": \"data\",\n \"application/vnd.apache.parquet\": \"data\",\n \"application/xml\": \"code\",\n \"application/sql\": \"code\",\n \"application/yaml\": \"code\",\n \"application/toml\": \"code\",\n \"application/x-sh\": \"code\",\n \"application/zip\": \"archive\",\n \"application/x-tar\": \"archive\",\n \"application/gzip\": \"archive\",\n \"application/x-bzip2\": \"archive\",\n \"application/x-7z-compressed\": \"archive\",\n \"application/vnd.rar\": \"archive\",\n};\n\n/** The MIME we treat as \"the caller told us nothing\". */\nconst UNKNOWN_MEDIA_TYPE = \"application/octet-stream\";\n\n/**\n * Lowercased extension without the dot. `\"\"` when the name has none, is a\n * dotfile (`.gitignore` — the whole name is the \"extension\" to a human, but it\n * is not a format), or ends in a dot.\n */\nexport function extensionOf(name: string): string {\n // Strip any path and any query/hash a URL-derived name may carry.\n const base = (name.split(/[\\\\/]/).pop() ?? \"\").split(/[?#]/)[0] ?? \"\";\n const dot = base.lastIndexOf(\".\");\n if (dot <= 0 || dot === base.length - 1) return \"\";\n return base.slice(dot + 1).toLowerCase();\n}\n\n/**\n * Best-known MIME for a filename, from its extension alone.\n * `undefined` when the extension is unknown — callers decide the fallback.\n */\nexport function mediaTypeFromName(name: string): string | undefined {\n return EXTENSION_MEDIA_TYPES[extensionOf(name)];\n}\n\n/** Strip parameters and casing: `\"TEXT/CSV; charset=utf-8\"` → `\"text/csv\"`. */\nfunction normalizeMediaType(mediaType: string | undefined): string {\n const bare = (mediaType ?? \"\").split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n // Browsers and servers both use these to mean \"I don't know\".\n if (bare === \"\" || bare === UNKNOWN_MEDIA_TYPE || bare === \"binary/octet-stream\") return \"\";\n return bare;\n}\n\nfunction categoryFor(mediaType: string, extension: string): FileCategory {\n // The extension is more specific than a `text/*` MIME, so it wins for the\n // formats that would otherwise collapse into \"text\" (see EXTENSION_CATEGORIES).\n const byExtension = EXTENSION_CATEGORIES[extension];\n if (byExtension) return byExtension;\n\n const exact = MEDIA_TYPE_CATEGORIES[mediaType];\n if (exact) return exact;\n\n if (mediaType.startsWith(\"image/\")) return \"image\";\n if (mediaType.startsWith(\"video/\")) return \"video\";\n if (mediaType.startsWith(\"audio/\")) return \"audio\";\n if (mediaType.startsWith(\"text/\")) return \"text\";\n\n return \"unknown\";\n}\n\n/**\n * Resolve what a file is from its name and (optionally) the MIME the source\n * reported. Never throws; unknown input resolves to\n * `{ category: \"unknown\", mediaType: \"application/octet-stream\", extension: \"\" }`.\n *\n * A caller-supplied `mediaType` wins over the extension EXCEPT where the\n * extension is strictly more specific — `report.csv` served as `text/plain`\n * still resolves to `\"data\"`, because servers routinely under-specify.\n */\nexport function resolveFileKind(name: string, mediaType?: string): FileKind {\n const extension = extensionOf(name);\n const declared = normalizeMediaType(mediaType);\n const resolved = declared || mediaTypeFromName(name) || UNKNOWN_MEDIA_TYPE;\n return {\n category: categoryFor(resolved, extension),\n mediaType: resolved,\n extension,\n };\n}\n","/**\n * One input model for \"a file\", whatever the app happens to be holding.\n *\n * The library previously had three: a `File` (upload), a `string` of content\n * (chat assets), and a bare URL (attachments) — so every surface that wanted to\n * render a file first had to guess which of the three it had. {@link FileSource}\n * is the union all of them collapse into, and {@link normalizeFileSource} turns\n * any member into one uniform reader.\n *\n * Two things this fixes beyond the merge:\n *\n * - **Authenticated remote files work.** The `url` variant carries\n * `init?: RequestInit`, so headers, credentials and an abort signal reach the\n * fetch. A viewer that can only take a naked URL cannot open anything behind\n * auth, which is most enterprise content.\n * - **Alt text has a home.** Every binary variant takes `alt`, so an image or a\n * rendered page can be described without a parallel prop channel.\n *\n * Pure DOM/platform mechanics: no React, no other deps. SSR-safe to import;\n * only {@link ResolvedFileSource.url} needs a browser, and it says so.\n */\n\nimport { type FileCategory, mediaTypeFromName, resolveFileKind } from \"./file-kind\";\n\n/** Any file the library can be handed. Discriminated on `kind`. */\nexport type FileSource =\n /** A user-picked file. Name and MIME come from the platform. */\n | { kind: \"file\"; file: File; alt?: string }\n /** In-memory bytes that already have a `Blob` wrapper (a generated export, a decoded attachment). */\n | { kind: \"blob\"; blob: Blob; name: string; mediaType?: string; alt?: string }\n /**\n * A remote file. `init` is passed straight to `fetch` — this is how auth\n * headers, `credentials` and an `AbortSignal` reach the request.\n */\n | {\n kind: \"url\";\n url: string;\n name?: string;\n mediaType?: string;\n alt?: string;\n init?: RequestInit;\n }\n /** Raw bytes with no wrapper (a worker result, a WASM output). */\n | { kind: \"buffer\"; buffer: ArrayBuffer; name: string; mediaType: string; alt?: string }\n /** Content the app already has as a string (an agent's markdown, a code snippet). */\n | { kind: \"text\"; text: string; name: string; mediaType?: string };\n\n/**\n * A {@link FileSource} with its identity resolved and its bytes reachable the\n * same way regardless of where they came from.\n *\n * Reads are memoized on success, so `text()` after `bytes()` costs nothing and a\n * remote file is fetched once. A failed read is NOT cached — a retry re-runs it.\n */\nexport interface ResolvedFileSource {\n /** Display name, always non-empty. Derived from the URL path when the caller gave none. */\n readonly name: string;\n /** Best-known MIME, resolved from the declared type then the extension. */\n readonly mediaType: string;\n /** Coarse shape, for icons/labels/fallbacks. Not a renderer routing key. */\n readonly category: FileCategory;\n /** Lowercased extension without the dot, or `\"\"`. */\n readonly extension: string;\n /** Author-supplied description, for images and rendered pages. */\n readonly alt?: string;\n /** Byte length when known up front. `undefined` for `text` and un-fetched `url` sources. */\n readonly size?: number;\n\n /** The full contents as bytes. */\n bytes(signal?: AbortSignal): Promise<ArrayBuffer>;\n /** The full contents decoded as UTF-8. */\n text(signal?: AbortSignal): Promise<string>;\n /**\n * A URL usable as an `<img>`/`<video>`/`<iframe>` src.\n *\n * A public `url` source returns its own URL unchanged, so the browser streams\n * it and no full read happens. Every other source (and any `url` source with\n * an `init`, which the element could not replay) mints an object URL — release\n * it with {@link revoke}. Browser only: rejects where `URL.createObjectURL`\n * does not exist.\n */\n url(signal?: AbortSignal): Promise<string>;\n /** Release any object URL this reader minted. Idempotent; safe to call unconditionally. */\n revoke(): void;\n}\n\n/** Best-effort filename from a URL path. Never empty. */\nfunction nameFromUrl(url: string): string {\n try {\n // A relative URL still needs a base to parse; the base is never used.\n const parsed = new URL(url, \"http://localhost\");\n const last = parsed.pathname.split(\"/\").filter(Boolean).pop();\n return last ? decodeURIComponent(last) : \"file\";\n } catch {\n // Unparseable: strip the query/hash by hand rather than give up. Note this\n // runs ONLY on a parse failure — running it as a fallback for an empty\n // pathname would return the host (\"x.test\" for \"https://x.test/\").\n const stripped = url.split(/[?#]/)[0] ?? \"\";\n const last = stripped.split(\"/\").filter(Boolean).pop();\n return last && last.length > 0 ? last : \"file\";\n }\n}\n\n/**\n * `Blob`/`File` → bytes, feature-detecting `Blob.prototype.arrayBuffer`.\n *\n * jsdom does not implement it (nor `Blob.prototype.text`), and this module is\n * reached from every downstream package's jsdom tests — so per the note in\n * `packages/ui/vitest.setup.ts`, the detection lives HERE rather than in a stub\n * that would only fix this package's own suite. `FileReader` is the fallback:\n * jsdom implements it, and it is the pre-2020 browser path anyway.\n */\nfunction blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer> {\n if (typeof blob.arrayBuffer === \"function\") return blob.arrayBuffer();\n\n if (typeof FileReader !== \"function\") {\n return Promise.reject(\n new Error(\"Cannot read file bytes: no Blob.arrayBuffer and no FileReader.\"),\n );\n }\n return new Promise<ArrayBuffer>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as ArrayBuffer);\n reader.onerror = () => reject(reader.error ?? new Error(\"Could not read the file.\"));\n reader.readAsArrayBuffer(blob);\n });\n}\n\n/** The declared name/MIME for a source, before extension inference. */\nfunction identify(source: FileSource): { name: string; declaredMediaType?: string } {\n switch (source.kind) {\n case \"file\":\n return { name: source.file.name || \"file\", declaredMediaType: source.file.type };\n case \"blob\":\n return { name: source.name, declaredMediaType: source.mediaType ?? source.blob.type };\n case \"buffer\":\n return { name: source.name, declaredMediaType: source.mediaType };\n case \"text\":\n return {\n name: source.name,\n declaredMediaType: source.mediaType ?? mediaTypeFromName(source.name) ?? \"text/plain\",\n };\n case \"url\":\n return { name: source.name ?? nameFromUrl(source.url), declaredMediaType: source.mediaType };\n }\n}\n\n/** Byte length where the platform already knows it, without reading anything. */\nfunction knownSize(source: FileSource): number | undefined {\n switch (source.kind) {\n case \"file\":\n return source.file.size;\n case \"blob\":\n return source.blob.size;\n case \"buffer\":\n return source.buffer.byteLength;\n // `text` would need an encode pass, `url` a fetch — neither is free, so we\n // report \"unknown\" rather than doing work a caller may not want.\n default:\n return undefined;\n }\n}\n\nfunction assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw signal.reason instanceof Error ? signal.reason : new Error(\"Aborted\");\n}\n\n/**\n * Turn any {@link FileSource} into a uniform reader.\n *\n * Cheap and synchronous — it resolves identity only. Nothing is read, fetched or\n * decoded until a `bytes()` / `text()` / `url()` call.\n */\nexport function normalizeFileSource(source: FileSource): ResolvedFileSource {\n const { name, declaredMediaType } = identify(source);\n const kind = resolveFileKind(name, declaredMediaType);\n const alt = \"alt\" in source ? source.alt : undefined;\n\n let bytesPromise: Promise<ArrayBuffer> | undefined;\n let textPromise: Promise<string> | undefined;\n let objectUrl: string | undefined;\n\n async function readBytes(signal?: AbortSignal): Promise<ArrayBuffer> {\n assertNotAborted(signal);\n switch (source.kind) {\n case \"file\":\n return blobToArrayBuffer(source.file);\n case \"blob\":\n return blobToArrayBuffer(source.blob);\n case \"buffer\":\n return source.buffer;\n case \"text\":\n return new TextEncoder().encode(source.text).buffer as ArrayBuffer;\n case \"url\": {\n // The caller's own signal (via `init`) still applies; this one is layered\n // on top so a per-read abort works even when `init` carries none.\n const res = await fetch(source.url, {\n ...source.init,\n signal: signal ?? source.init?.signal,\n });\n if (!res.ok) {\n throw new Error(`Could not read \"${name}\": the server responded ${res.status}.`);\n }\n return res.arrayBuffer();\n }\n }\n }\n\n async function blobOf(signal?: AbortSignal): Promise<Blob> {\n if (source.kind === \"file\") return source.file;\n if (source.kind === \"blob\") return source.blob;\n const buffer = await bytes(signal);\n return new Blob([buffer], { type: kind.mediaType });\n }\n\n function bytes(signal?: AbortSignal): Promise<ArrayBuffer> {\n // Memoize the success only: a rejected read must be retryable.\n bytesPromise ??= readBytes(signal).catch((error: unknown) => {\n bytesPromise = undefined;\n throw error;\n });\n return bytesPromise;\n }\n\n function text(signal?: AbortSignal): Promise<string> {\n if (source.kind === \"text\") return Promise.resolve(source.text);\n textPromise ??= bytes(signal)\n .then((buffer) => new TextDecoder().decode(buffer))\n .catch((error: unknown) => {\n textPromise = undefined;\n throw error;\n });\n return textPromise;\n }\n\n async function url(signal?: AbortSignal): Promise<string> {\n // A public remote file is already a URL an element can stream. One carrying\n // `init` is not: the element cannot replay those headers, so we fetch here.\n if (source.kind === \"url\" && !source.init) return source.url;\n\n if (objectUrl) return objectUrl;\n if (typeof URL === \"undefined\" || typeof URL.createObjectURL !== \"function\") {\n throw new Error(\n `Could not create a URL for \"${name}\": no object-URL support in this environment.`,\n );\n }\n objectUrl = URL.createObjectURL(await blobOf(signal));\n return objectUrl;\n }\n\n function revoke(): void {\n if (!objectUrl) return;\n URL.revokeObjectURL(objectUrl);\n objectUrl = undefined;\n }\n\n return {\n name,\n mediaType: kind.mediaType,\n category: kind.category,\n extension: kind.extension,\n alt,\n size: knownSize(source),\n bytes,\n text,\n url,\n revoke,\n };\n}\n","/**\n * One glyph per {@link FileCategory} — the single icon map for file-shaped UI.\n *\n * Supersedes two package-private maps that could not see each other:\n * `PRODUCED_ASSET_ICONS` (`@elabs-ai/components-ai` file-tree, keyed by\n * the five-member `ContextAssetType`) and `mediaCategoryIcons` (same package,\n * attachments, keyed by six MIME buckets) — so the same `.csv` drew a table glyph\n * in one surface and a generic document glyph in the other.\n *\n * Lucide per `.claude/rules/icons.md`: these are generic UI glyphs, not product\n * vocabulary, so nothing here belongs in\n * `@elabs-ai/components-icons`.\n *\n * Values only — this module holds component REFERENCES, it renders nothing.\n * Icons inherit color from `currentColor`; the category is never carried by hue\n * alone, so a caller must still supply a text label or an `aria-label` on the\n * control (WCAG 1.4.1).\n */\n\nimport {\n File,\n FileArchive,\n FileCode,\n FileDigit,\n FileImage,\n FileMusic,\n FileSpreadsheet,\n FileText,\n FileType,\n FileVideoCamera,\n type LucideIcon,\n Presentation,\n} from \"lucide-react\";\n\nimport { type FileCategory, resolveFileKind } from \"./file-kind\";\n\n/** The glyph for each coarse file shape. Exhaustive over {@link FileCategory}. */\nexport const FILE_CATEGORY_ICONS: Readonly<Record<FileCategory, LucideIcon>> = {\n image: FileImage,\n video: FileVideoCamera,\n audio: FileMusic,\n document: FileText,\n spreadsheet: FileSpreadsheet,\n presentation: Presentation,\n code: FileCode,\n text: FileType,\n data: FileDigit,\n archive: FileArchive,\n unknown: File,\n};\n\n/**\n * The glyph for a file, resolved from its name and (optionally) MIME.\n * Falls back to the generic file glyph rather than throwing.\n */\nexport function fileIconFor(name: string, mediaType?: string): LucideIcon {\n return FILE_CATEGORY_ICONS[resolveFileKind(name, mediaType).category];\n}\n","/**\n * How one part of a document is addressed.\n *\n * A viewer that can only open a file answers \"here is the document\". A viewer\n * that can be pointed at a PART of one answers \"here is the sentence that\n * claim came from\" — the RAG-citation case, and the same machinery behind\n * find-in-document.\n *\n * ## Why this lives in `@elabs-ai/components-ui`\n *\n * The producer of an address (a chat answer's citation, in\n * `@elabs-ai/components-ai`) and its consumer (the file viewer, in\n * `@elabs-ai/components-viewer`) are Layer-2 siblings that may not\n * import each other. `ui` is the only layer both reach, which is exactly why\n * `FileSource` and `MatchRange` already live here. This module is a\n * dependency-free leaf: types plus pure string functions, no React.\n *\n * ## Three kinds, one union\n *\n * Real producers disagree about what they can emit, so the union carries all\n * three rather than forcing everyone through the weakest:\n *\n * - **`quote`** — the snippet text. The only kind that survives crossing a tool\n * boundary: an indexing pipeline's character offsets are computed against ITS\n * extraction of the PDF, never against ours, so its numbers are meaningless\n * here while its text still is. Lossy (a repeated phrase is ambiguous) and the\n * most useful.\n * - **`range`** — exact character offsets, and exact only against the SAME text\n * projection: `AdapterDocument.text` as this build's adapter produced it. Use\n * it when both ends are ours (find-in-document, a second pass over a document\n * already open).\n * - **`rect`** — page-relative boxes, `0..1` fractions of the page. Needs no\n * text at all, which is what makes it the answer for a scanned page, a chart,\n * a photo region, or any layout-analysis model whose output is geometry.\n *\n * ## The rule that lets this union grow\n *\n * A consumer matches only the kinds it declared it honours and reports the rest\n * as unsupported — it never writes an exhaustive `switch` with a `never`\n * fallthrough. That is what lets a fourth kind (a spreadsheet `cell` address,\n * say) be added later without breaking every consumer that predates it.\n */\n\n/** The address kinds, as a value — for capability declarations and iteration. */\nexport const DOCUMENT_ADDRESS_KINDS = [\"quote\", \"range\", \"rect\"] as const;\n\n/** Which way a part of a document is addressed. */\nexport type DocumentAddressKind = (typeof DOCUMENT_ADDRESS_KINDS)[number];\n\n/**\n * A box on a page, as fractions of that page's own box.\n *\n * Fractions, not pixels, because the page is not a fixed size: it rescales with\n * zoom, with the pane's width and with the device's pixel ratio. A consumer\n * multiplies by the page element's live measured size at paint time, so the box\n * stays put through every one of those. Origin is top-left (CSS), so `y` grows\n * downward — matching the DOM rather than the PDF's own bottom-left space.\n */\nexport interface DocumentRect {\n /** Distance from the page's left edge, `0..1`. */\n x: number;\n /** Distance from the page's TOP edge, `0..1`. */\n y: number;\n /** Fraction of the page's width. */\n width: number;\n /** Fraction of the page's height. */\n height: number;\n}\n\n/**\n * Address by the text itself — the interoperable kind.\n *\n * Matching is done on the normalized form of both sides\n * ({@link normalizeQuoteText}), so a quote survives the whitespace, quote-glyph\n * and casing differences that every extractor introduces.\n */\nexport interface QuoteAddress {\n kind: \"quote\";\n /** The passage to find. Whitespace and quote glyphs need not match exactly. */\n text: string;\n /**\n * Which occurrence to take when the passage appears more than once, 1-based.\n * Omitted means the first — or the one nearest {@link QuoteAddress.near},\n * when that is given.\n */\n occurrence?: number;\n /**\n * A hint about where to look. It disambiguates repeats rather than restricting\n * the search: the occurrence closest to it wins, and a passage that turns out\n * to be elsewhere is still found.\n */\n near?: {\n /**\n * 1-based page (or slide) the passage is expected on.\n *\n * Advisory, and deliberately NOT used to navigate: the viewer turns to the\n * page the passage was actually located on, so a stale hint cannot send a\n * reader to a blank page. Only {@link QuoteAddress.near.offset} takes part in\n * tie-breaking today; a renderer may read this off the address if it wants\n * more.\n */\n page?: number;\n /** Approximate character offset the passage is expected near. */\n offset?: number;\n };\n}\n\n/**\n * Address by character offsets into `AdapterDocument.text`, half-open\n * `[start, end)` — the same convention as `MatchRange`.\n *\n * Only meaningful against the text projection THIS build produced. An offset\n * from a foreign pipeline is not this kind; it is a {@link QuoteAddress}.\n */\nexport interface RangeAddress {\n kind: \"range\";\n start: number;\n end: number;\n /**\n * 1-based page hint, when the producer knows it. Advisory only — the viewer\n * derives the page from the offsets against its own index, so a hint that\n * disagrees cannot misdirect the pager.\n */\n page?: number;\n}\n\n/** Address by geometry — one or more boxes on one page. */\nexport interface RectAddress {\n kind: \"rect\";\n /** 1-based page (or slide) number. */\n page: number;\n /**\n * The boxes making up this one addressed part. An array, not a single box,\n * because a real passage wraps: a sentence spanning three lines is three\n * boxes, and a two-column paragraph is more. Painting them as one shape each\n * is what avoids stitching DOM ranges together.\n */\n rects: readonly DocumentRect[];\n}\n\n/** Which part of a document something refers to. */\nexport type DocumentAddress = QuoteAddress | RangeAddress | RectAddress;\n\n/* -------------------------------------------------------------------------- */\n/* Quote normalization */\n/* -------------------------------------------------------------------------- */\n\n/** Straightened 1:1 — every one of these is one code unit in and one out. */\nconst CHARACTER_FOLDS: Readonly<Record<string, string>> = {\n // Curly quotes and primes. A model quoting a PDF re-types these constantly;\n // the file has the other one.\n \"‘\": \"'\",\n \"’\": \"'\",\n \"‚\": \"'\",\n \"‛\": \"'\",\n \"′\": \"'\",\n \"“\": '\"',\n \"”\": '\"',\n \"„\": '\"',\n \"‟\": '\"',\n \"″\": '\"',\n // Dashes. PDF extraction yields the typographic one, prose yields a hyphen.\n \"‐\": \"-\",\n \"‑\": \"-\",\n \"‒\": \"-\",\n \"–\": \"-\",\n \"—\": \"-\",\n \"―\": \"-\",\n \"−\": \"-\",\n};\n\n/**\n * Invisible, and typically present in exactly one of the two strings being\n * compared: soft hyphen (a PDF's line-break artefact), zero-width space, ZWNJ,\n * ZWJ, word joiner. Written as escapes because a literal here is unreviewable —\n * it renders as nothing.\n */\nconst DROPPED = new Set([\"\", \"\", \"\", \"\", \"\"]);\n\n/**\n * Anything that collapses into one space. Plain `\\s` is already the full set in\n * JavaScript — it covers NBSP, the `U+2000`–`U+200A` spaces, the line and\n * paragraph separators, narrow NBSP, ideographic space and the BOM.\n */\nconst WHITESPACE = /\\s/u;\n\n/**\n * The result of normalizing, with the way back.\n *\n * `offsets` has one more entry than `text` has characters: `offsets[i]` is the\n * index in the ORIGINAL string where normalized character `i` came from, and\n * the final entry is one past the last character that survived — NOT the\n * original's length, which would drag trailing whitespace into every range that\n * runs to the end. So a normalized range `[a, b)` maps back to\n * `[offsets[a], offsets[b])` with no arithmetic, which is the whole point of\n * building the map rather than searching twice.\n */\nexport interface NormalizedText {\n text: string;\n offsets: readonly number[];\n}\n\n/**\n * Fold a string to its canonical match key, keeping a map back to the original.\n *\n * Every rule is a collapse, a drop or a 1:1 swap — never an expansion — so the\n * map stays monotone and a range maps back exactly. That constraint is why\n * ligatures (`fi`) and the ellipsis character are deliberately left alone: both\n * would be 1:many, and a fuzzier match is not worth an offset map that can no\n * longer be trusted.\n *\n * What it does: collapses every whitespace run to one space and trims; drops\n * zero-width characters and soft hyphens; straightens curly quotes and dashes;\n * folds case — a citation is matched case-insensitively, and that is a property\n * of the match key rather than a flag every caller has to remember.\n */\nexport function normalizeQuoteTextWithOffsets(input: string): NormalizedText {\n const out: string[] = [];\n const offsets: number[] = [];\n let pendingSpaceAt: number | undefined;\n /** One past the last surviving character — the map's terminal entry. */\n let end = 0;\n\n for (let i = 0; i < input.length; i += 1) {\n const character = input[i] as string;\n\n if (WHITESPACE.test(character)) {\n // Held rather than emitted, so a trailing run never reaches the output\n // and a leading one is dropped by the `out.length` test below.\n pendingSpaceAt ??= i;\n continue;\n }\n if (DROPPED.has(character)) continue;\n\n if (pendingSpaceAt !== undefined) {\n if (out.length > 0) {\n out.push(\" \");\n // The single space stands for the whole run, so it points at where the\n // run began — not at the character that ended it.\n offsets.push(pendingSpaceAt);\n }\n pendingSpaceAt = undefined;\n }\n\n const folded = CHARACTER_FOLDS[character] ?? character;\n const lowered = folded.toLowerCase();\n // Guard the 1:1 invariant: a few code points grow when lowercased\n // (`İ` → `i̇`). Keeping the original is a worse match and a correct map; the\n // reverse trade would silently corrupt every offset after it.\n out.push(lowered.length === folded.length ? lowered : folded);\n offsets.push(i);\n end = i + 1;\n }\n\n offsets.push(end);\n return { text: out.join(\"\"), offsets };\n}\n\n/**\n * The canonical match key for a quote — {@link normalizeQuoteTextWithOffsets}\n * without the map, for comparing or de-duplicating two quotes.\n */\nexport function normalizeQuoteText(input: string): string {\n return normalizeQuoteTextWithOffsets(input).text;\n}\n","\"use client\";\n\n/**\n * Streamdown's own chrome microcopy, resolved through the brand locale seam.\n *\n * Why this lives in `@elabs-ai/components-ui` and not next to the\n * renderer that uses it (#310, ADR 0017): Streamdown draws controls INSIDE the\n * markdown it renders — a code-block copy button, table copy/download menus, a\n * Mermaid toolbar, an external-link interstitial. Those labels live in the\n * dependency, so `pnpm microcopy:check` structurally cannot see them and a\n * `<LocaleProvider>` used to stop dead at the Streamdown boundary. TWO packages\n * now render Streamdown — `@elabs-ai/components-ai` (chat answers,\n * `MarkdownView`) and `@elabs-ai/components-viewer` (a markdown FILE\n * someone opened) — and they may not import each other, so the shared half sits\n * one layer down where both can reach it.\n *\n * Deliberately NO import of `streamdown`, not even a type: this keeps the\n * base package free of a dependency it would otherwise carry for every consumer\n * of every component. The COMPLETENESS of the key list is proved where the\n * dependency actually is — see `packages/ai/src/_streamdown-i18n.ts`, whose\n * compile-time assertion fails the build if a Streamdown upgrade adds a key.\n * That is the right split: the base package owns the wiring, the package that\n * pins the version owns the tripwire.\n *\n * The English defaults in `./components/locale-provider/messages.ts` are\n * byte-identical to Streamdown's own, so this is a no-op for anyone who\n * overrides nothing.\n */\n\nimport { useMemo } from \"react\";\n\nimport { useLocale } from \"../components/locale-provider\";\n\n/**\n * Every key of `StreamdownTranslations` as of streamdown@2.5.0.\n *\n * Kept explicit rather than derived from `defaultTranslations`, so the list is\n * readable data here and checkable against the real type over in `ai`.\n */\nexport const STREAMDOWN_TRANSLATION_KEYS = [\n \"close\",\n \"copied\",\n \"copyCode\",\n \"copyLink\",\n \"copyTable\",\n \"copyTableAsCsv\",\n \"copyTableAsMarkdown\",\n \"copyTableAsTsv\",\n \"downloadDiagram\",\n \"downloadDiagramAsMmd\",\n \"downloadDiagramAsPng\",\n \"downloadDiagramAsSvg\",\n \"downloadFile\",\n \"downloadImage\",\n \"downloadTable\",\n \"downloadTableAsCsv\",\n \"downloadTableAsMarkdown\",\n \"exitFullscreen\",\n \"externalLinkWarning\",\n \"imageNotAvailable\",\n \"mermaidFormatMmd\",\n \"mermaidFormatPng\",\n \"mermaidFormatSvg\",\n \"openExternalLink\",\n \"openLink\",\n \"tableFormatCsv\",\n \"tableFormatMarkdown\",\n \"tableFormatTsv\",\n \"viewFullscreen\",\n] as const;\n\nexport type StreamdownTranslationKey = (typeof STREAMDOWN_TRANSLATION_KEYS)[number];\n\n/** What Streamdown's `translations` prop takes, expressed without importing it. */\nexport type StreamdownTranslationMap = Record<StreamdownTranslationKey, string>;\n\n/**\n * Resolve every Streamdown label through `t()`.\n *\n * Provider-optional, like `useLocale()` itself: with no `<LocaleProvider>` every\n * key resolves to the shipped English default.\n *\n * Memoization matters — Streamdown puts `translations` into a React context, so\n * a fresh object per render would re-render every code block and table in the\n * document. The map is memoized on `t`, which is stable per locale.\n */\nexport function useStreamdownTranslations(): StreamdownTranslationMap {\n const { t } = useLocale();\n return useMemo(() => {\n const resolved = {} as StreamdownTranslationMap;\n for (const key of STREAMDOWN_TRANSLATION_KEYS) {\n // The `ai.streamdown.*` namespace is kept as-is although this now serves\n // two packages: the keys name STREAMDOWN's chrome, not any one package's,\n // and renaming them would silently drop every consumer's overrides.\n resolved[key] = t(`ai.streamdown.${key}`);\n }\n return resolved;\n }, [t]);\n}\n","\"use client\";\n\nimport { createContext, use, useMemo, type ReactNode } from \"react\";\nimport { DirectionProvider } from \"@radix-ui/react-direction\";\nimport { DEFAULT_MESSAGES } from \"./messages\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** A flat map of string keys to their translated values. */\nexport type Messages = Record<string, string>;\n\nexport interface LocaleContextValue {\n /** BCP-47 locale tag, e.g. \"en-US\", \"ar-EG\", \"de-DE\". */\n locale: string;\n /** Layout direction for the locale region. */\n dir: \"ltr\" | \"rtl\";\n /**\n * Translate a key.\n * Falls back to: consumer messages → English default → the key itself.\n * Supports simple `{name}`-style variable interpolation.\n */\n t: (key: string, vars?: Record<string, string | number>) => string;\n /** Format a number using the active locale. Memoized per locale+opts hash. */\n formatNumber: (n: number, opts?: Intl.NumberFormatOptions) => string;\n /** Format a date using the active locale. Memoized per locale+opts hash. */\n formatDate: (d: Date | number, opts?: Intl.DateTimeFormatOptions) => string;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst LocaleContext = createContext<LocaleContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Default (no-provider) value — en-US / ltr\n// ---------------------------------------------------------------------------\n\nfunction interpolate(template: string, vars?: Record<string, string | number>): string {\n if (!vars) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) =>\n key in vars ? String(vars[key]) : `{${key}}`,\n );\n}\n\nfunction makeDefaultValue(): LocaleContextValue {\n const locale = \"en-US\";\n // Simple cache: one Intl object per serialized opts string\n const numberCache = new Map<string, Intl.NumberFormat>();\n const dateCache = new Map<string, Intl.DateTimeFormat>();\n\n return {\n locale,\n dir: \"ltr\",\n t(key, vars) {\n const template = DEFAULT_MESSAGES[key] ?? key;\n return interpolate(template, vars);\n },\n formatNumber(n, opts) {\n const k = JSON.stringify(opts ?? null);\n if (!numberCache.has(k)) numberCache.set(k, new Intl.NumberFormat(locale, opts));\n return numberCache.get(k)!.format(n);\n },\n formatDate(d, opts) {\n const k = JSON.stringify(opts ?? null);\n if (!dateCache.has(k)) dateCache.set(k, new Intl.DateTimeFormat(locale, opts));\n return dateCache.get(k)!.format(d);\n },\n };\n}\n\n// Singleton default — stable across renders when no provider is mounted\nconst DEFAULT_LOCALE_VALUE = makeDefaultValue();\n\n// ---------------------------------------------------------------------------\n// Provider props\n// ---------------------------------------------------------------------------\n\nexport interface LocaleProviderProps {\n /**\n * BCP-47 locale tag. Defaults to \"en-US\".\n * Used by `t`, `formatNumber`, and `formatDate`.\n */\n locale?: string;\n /**\n * Layout direction for the subtree.\n * Defaults to \"ltr\". Set \"rtl\" for Arabic, Hebrew, Farsi, etc.\n */\n dir?: \"ltr\" | \"rtl\";\n /**\n * Additional/overriding message strings merged on top of the shipped English\n * defaults. Only the keys you provide are overridden; the rest fall through\n * to the English bundle.\n */\n messages?: Messages;\n children: ReactNode;\n}\n\n// ---------------------------------------------------------------------------\n// LocaleProvider\n// ---------------------------------------------------------------------------\n\n/**\n * `LocaleProvider` supplies locale, layout direction, component microcopy, and\n * Intl formatting helpers to the component subtree.\n *\n * - Wrap your app (or a regional subtree) with it to localise brand-ui components.\n * - Components call `useLocale()` unconditionally; without a provider they\n * degrade gracefully to \"en-US\" / \"ltr\" / English defaults.\n * - Portalled Radix content (Dialog, Sheet, Popover, DropdownMenu) still honors\n * `dir` because the subtree is wrapped in Radix's `DirectionProvider`, which\n * every Radix primitive reads via context regardless of DOM position (ADR-0014).\n * The `<div dir={dir}>` continues to carry direction for non-Radix content.\n */\nexport function LocaleProvider({\n locale = \"en-US\",\n dir = \"ltr\",\n messages,\n children,\n}: LocaleProviderProps) {\n // Merge consumer messages over the shipped English defaults.\n const merged: Messages = useMemo(\n () => (messages ? { ...DEFAULT_MESSAGES, ...messages } : DEFAULT_MESSAGES),\n // We intentionally deep-compare via JSON only when messages reference changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [messages],\n );\n\n // Memoized Intl formatter caches — keyed by serialised opts\n const numberCache = useMemo(() => new Map<string, Intl.NumberFormat>(), [locale]);\n const dateCache = useMemo(() => new Map<string, Intl.DateTimeFormat>(), [locale]);\n\n const value = useMemo<LocaleContextValue>(\n () => ({\n locale,\n dir,\n t(key, vars) {\n const template = merged[key] ?? key;\n return interpolate(template, vars);\n },\n formatNumber(n, opts) {\n const k = JSON.stringify(opts ?? null);\n if (!numberCache.has(k)) numberCache.set(k, new Intl.NumberFormat(locale, opts));\n return numberCache.get(k)!.format(n);\n },\n formatDate(d, opts) {\n const k = JSON.stringify(opts ?? null);\n if (!dateCache.has(k)) dateCache.set(k, new Intl.DateTimeFormat(locale, opts));\n return dateCache.get(k)!.format(d);\n },\n }),\n [locale, dir, merged, numberCache, dateCache],\n );\n\n return (\n <LocaleContext.Provider value={value}>\n {/*\n * `DirectionProvider` makes `dir` reach portalled Radix overlays (Dialog,\n * Sheet, Popover, DropdownMenu, Select, Tooltip, …) which escape the DOM\n * `dir` ancestor (ADR-0014). The `<div dir={dir}>` still carries direction\n * for non-Radix content.\n */}\n <DirectionProvider dir={dir}>\n <div dir={dir}>{children}</div>\n </DirectionProvider>\n </LocaleContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// useLocale\n// ---------------------------------------------------------------------------\n\n/**\n * Read the active locale, direction, `t`, `formatNumber`, and `formatDate`.\n *\n * Provider-optional: without a `<LocaleProvider>` this returns the en-US\n * defaults so components can call it unconditionally and remain usable in\n * unwrapped contexts.\n */\nexport function useLocale(): LocaleContextValue {\n // React 19 `use()` — can be called conditionally and composes with Suspense.\n const ctx = use(LocaleContext);\n return ctx ?? DEFAULT_LOCALE_VALUE;\n}\n","\"use client\";\n\n/**\n * Shipped English (en-US) default microcopy bundle.\n *\n * Keys are intentionally terse, semantic, and framework-agnostic so they\n * translate cleanly into any target locale. Keep this list small and real —\n * only add a key here when a component actually needs it.\n */\nexport const DEFAULT_MESSAGES: Record<string, string> = {\n // ── Generic (shared across packages — reuse these before minting a new key) ──\n close: \"Close\",\n copy: \"Copy\",\n previous: \"Previous\",\n next: \"Next\",\n previousSlide: \"Previous slide\",\n nextSlide: \"Next slide\",\n noResults: \"No results.\",\n noRows: \"No rows.\",\n loading: \"Loading…\",\n more: \"More\",\n selectAll: \"Select all\",\n\n // ── @elabs-ai/components-ui ───────────────────────────────────────────────────────────────\n \"ui.metricCard.loading\": \"Loading metric…\",\n // CopyableValue. `hint` is APPENDED to the visible (compact) value, so the\n // accessible name contains what the reader sees — WCAG 2.5.3, Label in Name.\n \"ui.copyableValue.hint\": \"Copy exact value\",\n \"ui.copyableValue.copied\": \"Copied\",\n // ExpandDialog. Names the context pane beside the enlarged content, so a\n // screen-reader user can tell the two scrollable regions apart.\n \"ui.expandDialog.detail\": \"Details\",\n // AttributionPanel. `required` labels a notice a licence obliges us to show —\n // it is the WORD, not a colour, so the distinction survives greyscale (1.4.1).\n \"ui.attributionPanel.label\": \"Third-party attributions\",\n \"ui.attributionPanel.required\": \"Required\",\n \"ui.attributionPanel.empty\": \"No attributions match this filter.\",\n // ModelPicker. `refreshFailed` sits ABOVE a list that still works; `loadFailed`\n // replaces the list. The distinction is load-bearing — see modelPickerBody.\n \"ui.modelPicker.label\": \"Choose a target\",\n \"ui.modelPicker.searchPlaceholder\": \"Search…\",\n \"ui.modelPicker.refreshFailed\": \"Couldn't refresh the list\",\n \"ui.modelPicker.loadFailed\": \"Couldn't load the list\",\n \"ui.modelPicker.nothingYet\": \"Nothing to show yet\",\n \"ui.modelPicker.retry\": \"Retry\",\n // ViewToolbar (#331). `removeFilter` deliberately WRAPS the visible chip text\n // so the accessible name contains it (WCAG 2.5.3 Label in Name).\n \"ui.viewToolbar.about\": \"About this view\",\n \"ui.viewToolbar.activeFilters\": \"Active filters\",\n \"ui.viewToolbar.clearAll\": \"Clear all\",\n \"ui.viewToolbar.countOfTotal\": \"{count} of {total}\",\n \"ui.viewToolbar.removeFilter\": \"Remove filter: {label}\",\n // Combobox `allowCustomValue` mode (#359) — `{value}` interpolates the\n // currently typed, non-matching search text.\n \"ui.combobox.useCustomValue\": 'Use \"{value}\"',\n \"ui.combobox.emptyAllowCustom\": \"No matches. Type to add a custom value.\",\n // Form kit (#370–#374).\n \"ui.boundedNumber.emptyLabel\": \"No limit\",\n \"ui.keyValueEditor.addRow\": \"Add row\",\n \"ui.keyValueEditor.keyLabel\": \"Key {n}\",\n \"ui.keyValueEditor.valueLabel\": \"Value {n}\",\n \"ui.keyValueEditor.removeRow\": \"Remove row {n}\",\n \"ui.keyValueEditor.reveal\": \"Reveal value {n}\",\n \"ui.keyValueEditor.hide\": \"Hide value {n}\",\n \"ui.keyValueEditor.empty\": \"No entries yet.\",\n \"ui.listEditor.addItem\": \"Add item\",\n \"ui.listEditor.itemLabel\": \"Item {n}\",\n \"ui.listEditor.removeItem\": \"Remove item {n}\",\n \"ui.listEditor.moveUp\": \"Move item {n} up\",\n \"ui.listEditor.moveDown\": \"Move item {n} down\",\n \"ui.listEditor.empty\": \"No items yet.\",\n \"ui.sliderNumber.reset\": \"Reset\",\n // MentionInput (#368). The listbox lives in a portal with no visible label of\n // its own, so this IS its accessible name. The empty state deliberately\n // reuses the generic `noResults` key rather than minting a near-duplicate.\n \"ui.mentionInput.listLabel\": \"Mention suggestions\",\n // ConfirmDialog's fallback action labels. A real confirmation replaces\n // `confirmLabel` with the CONSEQUENCE (\"Delete skill\"); this generic default\n // exists so the component is never unlabelled.\n \"ui.confirmDialog.confirm\": \"Confirm\",\n \"ui.confirmDialog.cancel\": \"Cancel\",\n \"ui.advancedGroup.title\": \"Advanced\",\n \"ui.advancedGroup.changed\": \"{count} changed\",\n\n // ── @elabs-ai/components-data ─────────────────────────────────────────────────────────────\n // The scroll region's accessible name is rendered ONLY when the table actually\n // overflows its container, so it is never announced for a table that fits.\n \"data.table.scrollRegion\": \"Table contents, scrollable\",\n // Fallback name for a row's activation control when the row's first cell holds\n // no primitive value to name it after (see `rowActionLabel`).\n \"data.table.rowAction\": \"Activate row\",\n\n // ── @elabs-ai/components-charts ───────────────────────────────────────────────────────────\n // Shared caption for any bare chart surface's layout-shaped skeleton\n // (ChartFrame, ChartCard, AutoChart all show the same \"a chart is loading\"\n // concept — one key, reused, rather than three near-duplicate strings).\n \"charts.chart.loading\": \"Loading chart…\",\n \"charts.metricGrid.loading\": \"Loading metrics…\",\n // Chart drill-down (#349). The chart SVG is aria-hidden, so these names are\n // the ONLY thing AT reads for an interactive datapoint — there is no\n // consumer-side workaround if they stay English.\n \"charts.datapointLayer.label\": \"Chart data points\",\n \"charts.datapoint.label\": \"{series}, {category}: {value}\",\n \"charts.datapoint.labelNoSeries\": \"{category}: {value}\",\n // Announced when `copyValueOnActivate` puts a datapoint's exact value on the\n // clipboard — the recovery path for a compact axis label.\n \"charts.datapoint.copied\": \"Exact value copied\",\n\n // ── @elabs-ai/components-ai ───────────────────────────────────────────────────────────────\n // Namespaced `ai.<area>.<key>` so package microcopy can't collide with the\n // generic keys above, or with a future package's. See ADR 0017.\n //\n // The three attachment errors are the only @elabs-ai/components-ai strings a user reads as a\n // SYSTEM MESSAGE rather than a control label — they are the reason this bundle\n // grew beyond the generic set.\n \"ai.promptInput.errorAccept\": \"No files match the accepted types.\",\n \"ai.promptInput.errorMaxFileSize\": \"All files exceed the maximum size.\",\n \"ai.promptInput.errorMaxFiles\": \"Too many files. Some were not added.\",\n \"ai.promptInput.placeholder\": \"What would you like to know?\",\n \"ai.promptInput.uploadFiles\": \"Upload files\",\n \"ai.promptInput.submit\": \"Submit\",\n \"ai.promptInput.stop\": \"Stop\",\n \"ai.codeBlock.generating\": \"Generating…\",\n \"ai.composer.placeholder\": \"Ask me anything…\",\n \"ai.context.usage\": \"Model context usage\",\n \"ai.contextPanel.back\": \"Back to context\",\n \"ai.contextPanel.toggle\": \"Toggle context panel\",\n \"ai.environmentVariables.toggleVisibility\": \"Toggle value visibility\",\n \"ai.gallery.label\": \"Image gallery\",\n \"ai.gallery.expandImage\": \"Expand image\",\n \"ai.gallery.downloadImage\": \"Download image\",\n \"ai.message.actions\": \"Message actions\",\n \"ai.message.editMessage\": \"Edit message\",\n \"ai.message.feedback\": \"Message feedback\",\n \"ai.message.previousBranch\": \"Previous branch\",\n \"ai.message.nextBranch\": \"Next branch\",\n \"ai.persona.idle\": \"Assistant idle\",\n \"ai.persona.listening\": \"Assistant listening\",\n \"ai.persona.thinking\": \"Assistant thinking…\",\n \"ai.persona.speaking\": \"Assistant speaking\",\n \"ai.persona.asleep\": \"Assistant asleep\",\n \"ai.selectionToolbar.label\": \"Selection actions\",\n \"ai.webPreview.urlPlaceholder\": \"Enter URL...\",\n \"ai.micSelector.searchPlaceholder\": \"Search microphones...\",\n \"ai.messageForm.selectPlaceholder\": \"Select…\",\n \"ai.messageForm.label\": \"Form\",\n \"ai.messageTable.label\": \"Data table\",\n \"ai.voiceSelector.playPreview\": \"Play preview\",\n \"ai.voiceSelector.pausePreview\": \"Pause preview\",\n\n // ── Streamdown chrome (third-party rendering surface) ──────────────────────\n // `streamdown` renders its OWN controls inside every streamed-markdown block\n // (code header, table menus, Mermaid toolbar, external-link interstitial) and\n // exposes them through a `translations` prop. Those strings live in the\n // dependency, not in our source, so `pnpm microcopy:check` structurally cannot\n // see them — without this block a `<LocaleProvider>` stops at the boundary and\n // the chrome stays English (#310).\n //\n // Values are BYTE-IDENTICAL to streamdown@2.5.0's `defaultTranslations`, so\n // wiring them through `t()` is a no-op for anyone who overrides nothing\n // (ADR 0017's defaults-unchanged property). Keep them that way on upgrade.\n //\n // Deliberately NOT aliased onto the generic `close` / `ai.gallery.downloadImage`\n // keys: a locale may want different wording inside markdown chrome than in the\n // surrounding app, and a translator needs the Streamdown surface addressable as\n // one block.\n \"ai.streamdown.copyCode\": \"Copy Code\",\n \"ai.streamdown.downloadFile\": \"Download file\",\n \"ai.streamdown.downloadDiagram\": \"Download diagram\",\n \"ai.streamdown.downloadDiagramAsSvg\": \"Download diagram as SVG\",\n \"ai.streamdown.downloadDiagramAsPng\": \"Download diagram as PNG\",\n \"ai.streamdown.downloadDiagramAsMmd\": \"Download diagram as MMD\",\n \"ai.streamdown.viewFullscreen\": \"View fullscreen\",\n \"ai.streamdown.exitFullscreen\": \"Exit fullscreen\",\n \"ai.streamdown.mermaidFormatSvg\": \"SVG\",\n \"ai.streamdown.mermaidFormatPng\": \"PNG\",\n \"ai.streamdown.mermaidFormatMmd\": \"MMD\",\n \"ai.streamdown.copyTable\": \"Copy table\",\n \"ai.streamdown.copyTableAsMarkdown\": \"Copy table as Markdown\",\n \"ai.streamdown.copyTableAsCsv\": \"Copy table as CSV\",\n \"ai.streamdown.copyTableAsTsv\": \"Copy table as TSV\",\n \"ai.streamdown.downloadTable\": \"Download table\",\n \"ai.streamdown.downloadTableAsCsv\": \"Download table as CSV\",\n \"ai.streamdown.downloadTableAsMarkdown\": \"Download table as Markdown\",\n \"ai.streamdown.tableFormatMarkdown\": \"Markdown\",\n \"ai.streamdown.tableFormatCsv\": \"CSV\",\n \"ai.streamdown.tableFormatTsv\": \"TSV\",\n \"ai.streamdown.imageNotAvailable\": \"Image not available\",\n \"ai.streamdown.downloadImage\": \"Download image\",\n \"ai.streamdown.openExternalLink\": \"Open external link?\",\n // Straight apostrophe on purpose — must stay byte-identical to streamdown's\n // default, so the micro-typography curly-quote preference does not apply here.\n \"ai.streamdown.externalLinkWarning\": \"You're about to visit an external website.\",\n \"ai.streamdown.close\": \"Close\",\n \"ai.streamdown.copyLink\": \"Copy link\",\n \"ai.streamdown.copied\": \"Copied\",\n \"ai.streamdown.openLink\": \"Open link\",\n\n // ── @elabs-ai/components-viewer (ADR 0024) ─────────────────────────\n // FileViewer chrome. Every control here is icon-only, so these ARE the\n // accessible names — a non-English screen-reader user has no workaround.\n \"viewer.label\": \"File viewer\",\n // The scrolling content region's accessible name. It is a focusable tab stop\n // (WCAG 2.1.1: a pane that scrolls but holds nothing focusable is unreachable\n // from a keyboard), so it needs a name as well as a role.\n \"viewer.content\": \"File content\",\n \"viewer.download\": \"Download {name}\",\n \"viewer.raw\": \"Show source\",\n \"viewer.rendered\": \"Show rendered\",\n // States. `loading` announces the region once (role=\"status\"); the skeleton\n // itself is aria-hidden, so this is the only thing AT hears.\n \"viewer.loading\": \"Loading {name}…\",\n \"viewer.empty\": \"No file selected\",\n \"viewer.emptyBody\": \"Choose a file to preview it here.\",\n // Failures. Each maps to one ViewerErrorCode, so the code is the contract and\n // the wording can change per locale without touching component logic.\n \"viewer.error.unsupportedFormat\": \"Can't preview this file type\",\n \"viewer.error.unsupportedFormatBody\":\n \"{name} can be downloaded, but there's no preview for it here.\",\n \"viewer.error.parserMissing\": \"Preview unavailable\",\n \"viewer.error.parserMissingBody\": \"Previewing {name} needs {packages} to be installed.\",\n \"viewer.error.readFailed\": \"Couldn't open this file\",\n \"viewer.error.readFailedBody\":\n \"{name} couldn't be read. It may have moved, or you may not have access.\",\n \"viewer.error.parseFailed\": \"Couldn't read this file\",\n \"viewer.error.parseFailedBody\": \"{name} isn't a valid {format} file, or it's damaged.\",\n \"viewer.error.imageFailedTitle\": \"Couldn't show this image\",\n \"viewer.error.imageFailed\": \"{name} could not be displayed.\",\n \"viewer.retry\": \"Try again\",\n // Table view (CSV/TSV). The count is a summary for the whole grid.\n \"viewer.table.caption\": \"{rows} rows, {columns} columns\",\n \"viewer.table.truncated\": \"Showing the first {count} rows.\",\n \"viewer.table.emptyCell\": \"Empty\",\n // Text and JSON views.\n \"viewer.text.truncated\": \"Showing the first {shown} of {total} characters.\",\n \"viewer.json.tree\": \"JSON structure\",\n // Page, scale and rotation chrome (ADR 0026). Format-agnostic: one pager\n // serves PDF pages and PowerPoint slides, so the words are about \"pages\" and\n // the slide-specific wording lives on the slide itself.\n \"viewer.pager.controls\": \"Pages\",\n \"viewer.pager.previous\": \"Previous page\",\n \"viewer.pager.next\": \"Next page\",\n // The field's own accessible name. The visible \"of {total}\" beside it is not\n // a label — a screen reader would read the two as one run without this.\n \"viewer.pager.pageNumber\": \"Page number\",\n \"viewer.pager.of\": \"of {total}\",\n // Live region: a repainted canvas and a changed input value both announce\n // nothing, so this sentence is the only confirmation a page turned.\n \"viewer.pager.status\": \"Page {page} of {total}\",\n \"viewer.zoom.controls\": \"Zoom\",\n \"viewer.zoom.in\": \"Zoom in\",\n \"viewer.zoom.out\": \"Zoom out\",\n \"viewer.zoom.level\": \"Zoom level\",\n \"viewer.zoom.fitWidth\": \"Fit width\",\n \"viewer.zoom.fitPage\": \"Fit page\",\n \"viewer.zoom.status\": \"Zoom {level}\",\n \"viewer.rotate\": \"Rotate clockwise\",\n // PDF view.\n \"viewer.pdf.page\": \"Page {page}\",\n \"viewer.pdf.pages\": \"Document pages\",\n \"viewer.pdf.pageFailed\": \"Page {page} couldn't be drawn.\",\n // Media view (video / audio).\n \"viewer.media.label\": \"{name} player\",\n \"viewer.media.unsupportedTitle\": \"Can't play this file\",\n \"viewer.media.unsupported\": \"This browser can't play {name}.\",\n // Office views. A preview shows a document's STRUCTURE, not Word's or\n // PowerPoint's page layout — the copy never promises a faithful reproduction.\n \"viewer.docx.empty\": \"This document has no text\",\n \"viewer.sheet.tabs\": \"Sheets\",\n \"viewer.pptx.slide\": \"Slide {slide}\",\n \"viewer.pptx.untitled\": \"Untitled slide\",\n \"viewer.pptx.notes\": \"Speaker notes\",\n \"viewer.pptx.empty\": \"This slide has no text\",\n // Code and markdown views. `file.empty` is shared: \"the file opened and there\n // is nothing in it\" is one message whatever the format.\n \"viewer.file.empty\": \"This file is empty\",\n // Find-in-document (ADR 0025). The count is a live region read on every step,\n // so it stays short; `findNone` replaces it rather than sitting beside it, so\n // a fruitless search never reads as \"0 of 0\".\n \"viewer.find.open\": \"Find in document\",\n \"viewer.find.label\": \"Find in document\",\n \"viewer.find.placeholder\": \"Find…\",\n \"viewer.find.close\": \"Close find\",\n \"viewer.find.previous\": \"Previous match\",\n \"viewer.find.next\": \"Next match\",\n \"viewer.find.caseSensitive\": \"Match case\",\n \"viewer.find.count\": \"{index} of {total}\",\n \"viewer.find.none\": \"No matches\",\n \"viewer.find.capped\": \"Showing the first {limit} matches of {total}.\",\n // Citations / passages the app points the viewer at. A miss is a STATE, not a\n // silent no-op — the reader is told the passage could not be located, and\n // \"past the part we previewed\" is different news from \"not in this document\".\n \"viewer.highlight.notFound\": \"Couldn't find that passage in this document.\",\n \"viewer.highlight.notFoundTruncated\":\n \"That passage may be beyond the part of this document we could preview.\",\n \"viewer.highlight.unsupported\": \"This build can't point at part of a {format} file.\",\n \"viewer.highlight.previous\": \"Previous passage\",\n \"viewer.highlight.next\": \"Next passage\",\n \"viewer.highlight.count\": \"Passage {index} of {total}\",\n};\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Accordion = AccordionPrimitive.Root;\n\nexport const AccordionItem = forwardRef<\n ElementRef<typeof AccordionPrimitive.Item>,\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(function AccordionItem({ className, ...props }, ref) {\n return <AccordionPrimitive.Item ref={ref} className={cn(\"border-b\", className)} {...props} />;\n});\n\nexport const AccordionTrigger = forwardRef<\n ElementRef<typeof AccordionPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(function AccordionTrigger({ className, children, ...props }, ref) {\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&[data-state=open]>svg]:rotate-180\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronDown className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-base ease-standard\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n});\n\nexport const AccordionContent = forwardRef<\n ElementRef<typeof AccordionPrimitive.Content>,\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(function AccordionContent({ className, children, ...props }, ref) {\n return (\n <AccordionPrimitive.Content\n ref={ref}\n className=\"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down\"\n {...props}\n >\n <div className={cn(\"pb-4 pt-0 text-muted-foreground\", className)}>{children}</div>\n </AccordionPrimitive.Content>\n );\n});\n","\"use client\";\n\nimport { useCallback, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface AdvancedGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The disclosure's label. Defaults to \"Advanced\". */\n title?: ReactNode;\n /**\n * What is hidden inside, shown ONLY while collapsed — so a reader can tell\n * whether the group holds defaults or edits without opening it.\n */\n summary?: ReactNode;\n /** Shorthand summary: renders \"N changed\" when `summary` is not given. */\n changedCount?: number;\n /** Uncontrolled initial state. Collapsed by default — that is the point. */\n defaultOpen?: boolean;\n /** Controlled open state. */\n open?: boolean;\n /** Fires on every open/close, controlled or not. */\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * A collapsed-by-default group of secondary settings (#341).\n *\n * Long dialogs go wrong in one of two ways: everything is visible (so nothing\n * reads as primary), or the extras are hidden with no hint that they were\n * touched. `AdvancedGroup` takes the third option — hidden, but SUMMARISED:\n * while collapsed it shows what is inside (\"3 changed\"), and the summary\n * disappears once the group is open and the values speak for themselves.\n *\n * A preset over `Collapsible`, not a new disclosure primitive: Radix keeps the\n * trigger/content wiring, `aria-expanded`, and keyboard operation.\n *\n * ```tsx\n * <AdvancedGroup changedCount={3}>\n * <Field … />\n * </AdvancedGroup>\n * ```\n */\nexport function AdvancedGroup({\n className,\n title,\n summary,\n changedCount,\n defaultOpen = false,\n open: openProp,\n onOpenChange,\n children,\n ...props\n}: AdvancedGroupProps) {\n const { t } = useLocale();\n // Mirror the platform: the mode is fixed at mount by whether `open` was\n // passed, and never flips (`.claude/rules/component-api.md`).\n const isControlled = openProp !== undefined;\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = isControlled ? openProp : uncontrolledOpen;\n\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n const summaryContent =\n summary ??\n (changedCount !== undefined && changedCount > 0 ? (\n <Badge variant=\"secondary\">{t(\"ui.advancedGroup.changed\", { count: changedCount })}</Badge>\n ) : null);\n\n return (\n <Collapsible\n data-slot=\"advanced-group\"\n open={open}\n onOpenChange={handleOpenChange}\n className={cn(\"flex flex-col\", className)}\n {...props}\n >\n <CollapsibleTrigger\n data-slot=\"advanced-group-trigger\"\n className=\"group -mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-body font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronDown\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-base ease-standard motion-reduce:transition-none group-data-[state=closed]:-rotate-90\"\n />\n {title ?? t(\"ui.advancedGroup.title\")}\n {/* The summary is a COLLAPSED-state affordance: once the group is open\n the real values are on screen and repeating \"3 changed\" is noise. */}\n {!open && summaryContent ? (\n <span\n data-slot=\"advanced-group-summary\"\n className=\"ms-auto text-caption font-normal text-muted-foreground\"\n >\n {summaryContent}\n </span>\n ) : null}\n </CollapsibleTrigger>\n <CollapsibleContent data-slot=\"advanced-group-content\">\n <div className=\"flex flex-col gap-4 pt-3\">{children}</div>\n </CollapsibleContent>\n </Collapsible>\n );\n}\n","import { type HTMLAttributes } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nexport const badgeVariants = cva(\n \"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-meta font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary text-primary-foreground\",\n secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n outline: \"text-foreground\",\n success: \"border-transparent bg-success text-success-foreground\",\n warning: \"border-transparent bg-warning text-warning-foreground\",\n destructive: \"border-transparent bg-destructive text-destructive-foreground\",\n info: \"border-transparent bg-info text-info-foreground\",\n },\n },\n defaultVariants: { variant: \"default\" },\n },\n);\n\nexport interface BadgeProps\n extends HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {}\n\nexport function Badge({ className, variant, ...props }: BadgeProps) {\n return <span className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Collapsible = CollapsiblePrimitive.Root;\nexport const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nexport const CollapsibleContent = forwardRef<\n ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>\n>(function CollapsibleContent({ className, ...props }, ref) {\n return (\n <CollapsiblePrimitive.CollapsibleContent\n ref={ref}\n className={cn(\n \"overflow-hidden data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up data-[state=open]:[--tw-ease:var(--ease-entrance)] data-[state=closed]:[--tw-ease:var(--ease-exit)]\",\n className,\n )}\n {...props}\n />\n );\n});\n","\"use client\";\n\nimport { forwardRef, type ComponentProps, type ReactNode } from \"react\";\nimport { Sidebar, SidebarContent, SidebarFooter, SidebarHeader } from \"../sidebar\";\n\nexport interface AppSidebarProps extends ComponentProps<typeof Sidebar> {\n /**\n * Content rendered inside `<SidebarHeader>`. Typically a `TeamSwitcher`\n * or a logo + title combination.\n */\n header?: ReactNode;\n /**\n * Content rendered inside `<SidebarFooter>`. Typically a `NavUser` or\n * a `TeamSwitcher` placed at the bottom.\n */\n footer?: ReactNode;\n /**\n * Main navigation content rendered inside `<SidebarContent>`. Pass one or\n * more `<SidebarGroup>` / `<SidebarMenu>` compositions here.\n */\n children?: ReactNode;\n}\n\n/**\n * Parameterized application sidebar shell. Composes `@radix-ui` `Sidebar`\n * primitives with typed `header`, `footer`, and `children` slots.\n *\n * Registry blocks (`sidebar-02`, `sidebar-04`, `sidebar-05`) should import\n * this instead of constructing the `Sidebar` → `SidebarHeader` →\n * `SidebarContent` → `SidebarFooter` skeleton themselves.\n *\n * @example\n * ```tsx\n * <AppSidebar\n * header={<TeamSwitcher teams={teams} />}\n * footer={<NavUser user={currentUser} />}\n * >\n * <SidebarGroup>…</SidebarGroup>\n * </AppSidebar>\n * ```\n */\nexport const AppSidebar = forwardRef<HTMLDivElement, AppSidebarProps>(function AppSidebar(\n { header, footer, children, ...props },\n ref,\n) {\n return (\n <Sidebar ref={ref} {...props}>\n {header != null && <SidebarHeader>{header}</SidebarHeader>}\n <SidebarContent>{children}</SidebarContent>\n {footer != null && <SidebarFooter>{footer}</SidebarFooter>}\n </Sidebar>\n );\n});\n","\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ComponentProps,\n type CSSProperties,\n} from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { PanelLeftIcon } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { useIsMobile } from \"../../lib/use-mobile\";\nimport { Button } from \"../button\";\nimport { useCollapsiblePanel } from \"../collapsible-panel\";\nimport { Input } from \"../input\";\nimport { Separator } from \"../separator\";\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from \"../sheet\";\nimport { Skeleton } from \"../skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../tooltip\";\n\nconst SIDEBAR_COOKIE_NAME = \"sidebar_state\";\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nconst SidebarContext = createContext<SidebarContextProps | null>(null);\n\nexport function useSidebar() {\n const context = useContext(SidebarContext);\n if (!context) throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n return context;\n}\n\nexport const SidebarProvider = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n }\n>(function SidebarProvider(\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n },\n ref,\n) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n const [_open, _setOpen] = useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) setOpenProp(openState);\n else _setOpen(openState);\n if (typeof document !== \"undefined\") {\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n }\n },\n [setOpenProp, open],\n );\n\n const toggleSidebar = useCallback(() => {\n return isMobile ? setOpenMobile((o) => !o) : setOpen((o) => !o);\n }, [isMobile, setOpen]);\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [toggleSidebar]);\n\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = useMemo<SidebarContextProps>(\n () => ({ state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar }),\n [state, open, setOpen, isMobile, openMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n ref={ref}\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as CSSProperties\n }\n className={cn(\n // The wrapper spans the WHOLE app frame — chrome AND content — so its\n // ink is the ordinary page ink, not the chrome's. `Sidebar` (desktop\n // and mobile) sets `text-sidebar-foreground` on itself, so the chrome\n // is covered without painting chrome ink onto the canvas. Putting the\n // chrome ink here was invisible only while a theme happened to give\n // `--sidebar` and `--background` the same polarity: a theme with dark\n // chrome under a light canvas rendered near-white text on the canvas\n // for every element that inherits its colour (outline Buttons, list\n // rows). See the chrome<canvas elevation invariant in\n // .claude/rules/styling-and-tokens.md.\n \"group/sidebar-wrapper flex min-h-svh w-full text-foreground has-data-[variant=inset]:bg-sidebar\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n});\n\nexport const Sidebar = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n }\n>(function Sidebar(\n { side = \"left\", variant = \"sidebar\", collapsible = \"offcanvas\", className, children, ...props },\n ref,\n) {\n const { isMobile, openMobile, setOpenMobile, open, setOpen } = useSidebar();\n\n // The collapse mechanism (gap spacer + fixed slide) is the canonical\n // useCollapsiblePanel hook (#190, research 09 §B.2) — Sidebar passes its\n // literal width/collapse/slide utilities (Tailwind scans THIS file for\n // them) and gets back its original class fragments byte-identically.\n const panel = useCollapsiblePanel({\n side,\n open,\n onOpenChange: setOpen,\n widthClassName: \"w-(--sidebar-width)\",\n spacerCollapsedClassName: \"group-data-[collapsible=offcanvas]:w-0\",\n containerSlideClassNames: {\n left: \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\",\n right: \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n },\n });\n\n if (collapsible === \"none\") {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar\"\n className={cn(\n \"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n side={side}\n className=\"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\n style={{ \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE } as CSSProperties}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"group peer hidden text-sidebar-foreground md:block\"\n data-state={panel.attrs[\"data-state\"]}\n data-collapsible={panel.state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={panel.attrs[\"data-side\"]}\n data-slot=\"sidebar\"\n >\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n panel.spacerClassName,\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n panel.containerClassName,\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n});\n\nexport const SidebarTrigger = forwardRef<HTMLButtonElement, ComponentProps<typeof Button>>(\n function SidebarTrigger({ className, onClick, ...props }, ref) {\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n ref={ref}\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-7\", className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n },\n);\n\nexport const SidebarRail = forwardRef<HTMLButtonElement, ComponentProps<\"button\">>(\n function SidebarRail({ className, ...props }, ref) {\n const { toggleSidebar } = useSidebar();\n return (\n <button\n ref={ref}\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarInset = forwardRef<HTMLDivElement, ComponentProps<\"main\">>(\n function SidebarInset({ className, ...props }, ref) {\n return (\n <main\n ref={ref}\n data-slot=\"sidebar-inset\"\n className={cn(\n \"relative flex w-full flex-1 flex-col bg-background\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarInput = forwardRef<HTMLInputElement, ComponentProps<typeof Input>>(\n function SidebarInput({ className, ...props }, ref) {\n return (\n <Input\n ref={ref}\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn(\"h-8 w-full bg-background shadow-none\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarHeader = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(\n function SidebarHeader({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarFooter = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(\n function SidebarFooter({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarSeparator = forwardRef<HTMLDivElement, ComponentProps<typeof Separator>>(\n function SidebarSeparator({ className, ...props }, ref) {\n return (\n <Separator\n ref={ref}\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn(\"mx-2 w-auto bg-sidebar-border\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarContent = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(\n function SidebarContent({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarGroup = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(function SidebarGroup(\n { className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n {...props}\n />\n );\n});\n\nexport const SidebarGroupLabel = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & { asChild?: boolean }\n>(function SidebarGroupLabel({ className, asChild = false, ...props }, ref) {\n const Comp = asChild ? Slot : \"div\";\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n \"flex h-8 shrink-0 items-center rounded-md px-2 text-meta font-medium text-sidebar-muted-foreground outline-none ring-sidebar-ring transition-[margin,opacity] duration-base ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const SidebarGroupAction = forwardRef<\n HTMLButtonElement,\n ComponentProps<\"button\"> & { asChild?: boolean }\n>(function SidebarGroupAction({ className, asChild = false, ...props }, ref) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n \"absolute end-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const SidebarGroupContent = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(\n function SidebarGroupContent({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-body\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarMenu = forwardRef<HTMLUListElement, ComponentProps<\"ul\">>(function SidebarMenu(\n { className, ...props },\n ref,\n) {\n return (\n <ul\n ref={ref}\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n {...props}\n />\n );\n});\n\nexport const SidebarMenuItem = forwardRef<HTMLLIElement, ComponentProps<\"li\">>(\n function SidebarMenuItem({ className, ...props }, ref) {\n return (\n <li\n ref={ref}\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const sidebarMenuButtonVariants = cva(\n \"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-body text-sidebar-foreground outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[active=true]:[&>svg]:text-sidebar-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n // A 1px outline drawn as the ring layer, not a `border` — the button sits\n // in a fixed-height menu row, so an edge that took layout space would\n // change its metrics. `shadow-hairline` reads --shadow-ring-color, so the\n // sidebar retints it (chrome has its own edge tokens) instead of\n // hand-rolling `shadow-[0_0_0_1px_…]`.\n outline:\n \"bg-background shadow-hairline [--shadow-ring-color:var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:[--shadow-ring-color:var(--sidebar-accent)]\",\n },\n size: {\n default: \"h-8 text-body\",\n sm: \"h-7 text-meta\",\n lg: \"h-12 text-body group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: { variant: \"default\", size: \"default\" },\n },\n);\n\nexport const SidebarMenuButton = forwardRef<\n HTMLButtonElement,\n ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | ComponentProps<typeof TooltipContent>;\n } & VariantProps<typeof sidebarMenuButtonVariants>\n>(function SidebarMenuButton(\n {\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n },\n ref,\n) {\n const Comp = asChild ? Slot : \"button\";\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) return button;\n const tooltipProps = typeof tooltip === \"string\" ? { children: tooltip } : tooltip;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltipProps}\n />\n </Tooltip>\n );\n});\n\nexport const SidebarMenuAction = forwardRef<\n HTMLButtonElement,\n ComponentProps<\"button\"> & { asChild?: boolean; showOnHover?: boolean }\n>(function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }, ref) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n \"absolute end-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const SidebarMenuBadge = forwardRef<HTMLDivElement, ComponentProps<\"div\">>(\n function SidebarMenuBadge({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n \"pointer-events-none absolute end-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-meta font-medium tabular-nums text-sidebar-foreground\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport function SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: ComponentProps<\"div\"> & { showIcon?: boolean }) {\n const width = useMemo(() => `${Math.floor(Math.random() * 40) + 50}%`, []);\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={{ \"--skeleton-width\": width } as CSSProperties}\n />\n </div>\n );\n}\n\nexport const SidebarMenuSub = forwardRef<HTMLUListElement, ComponentProps<\"ul\">>(\n function SidebarMenuSub({ className, ...props }, ref) {\n return (\n <ul\n ref={ref}\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n \"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-s border-sidebar-border px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarMenuSubItem = forwardRef<HTMLLIElement, ComponentProps<\"li\">>(\n function SidebarMenuSubItem({ className, ...props }, ref) {\n return (\n <li\n ref={ref}\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const SidebarMenuSubButton = forwardRef<\n HTMLAnchorElement,\n ComponentProps<\"a\"> & { asChild?: boolean; size?: \"sm\" | \"md\"; isActive?: boolean }\n>(function SidebarMenuSubButton(\n { asChild = false, size = \"md\", isActive = false, className, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : \"a\";\n return (\n <Comp\n ref={ref}\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-meta\",\n size === \"md\" && \"text-body\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\n","import { forwardRef, type ButtonHTMLAttributes } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nexport const buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap touch-manipulation rounded-md text-body font-medium transition-[color,background-color,border-color,box-shadow,scale] duration-fast ease-standard active:scale-[0.98] motion-reduce:active:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100\",\n outline: \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n // The calm \"outlined but quiet\" rung (#194, research 02 §3a). `outline` uses\n // the form-field `border-input` token, `outline-subtle` uses `border-border`.\n // Since the ADR 0010 Amendment (2026-06-20) returned `--input` to the subtle\n // rung, these two are now VISUALLY IDENTICAL by default — both variant names\n // are kept as a SEMANTIC SEAM (a future brand could re-separate `--input` from\n // `--border`) and to avoid churning `outline-subtle` callers (e.g.\n // change-review.tsx). `outline` stays for genuinely form-adjacent controls.\n \"outline-subtle\":\n \"border border-border bg-background hover:bg-accent hover:text-accent-foreground\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n // #399 — a link button is TEXT on the page, so it takes the on-surface\n // `-text` rung; `bg-primary` above keeps the fill rung.\n link: \"text-primary-text underline-offset-4 hover:underline\",\n },\n size: {\n sm: \"h-8 rounded-md px-3 text-meta\",\n default: \"h-9 px-4 py-2\",\n lg: \"h-10 rounded-md px-6\",\n icon: \"size-9\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: { variant: \"default\", size: \"default\" },\n },\n);\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {\n /** Render the child element as the button (Radix Slot) instead of a <button>. */\n asChild?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { className, variant, size, asChild = false, type, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n ref={ref}\n className={cn(buttonVariants({ variant, size }), className)}\n type={asChild ? undefined : (type ?? \"button\")}\n {...props}\n />\n );\n});\n","\"use client\";\n\n/**\n * useCollapsiblePanel — THE canonical collapsing-panel mechanism (#190,\n * research 09 §B.2/§E.1).\n *\n * Extracted from Sidebar's collapse (sidebar.tsx): an always-mounted,\n * two-element width tween — a gap SPACER that reserves/releases the inline\n * width (`transition-[width] duration-base ease-linear`, collapsing to `w-0`)\n * and a fixed CONTAINER that slides off-screen\n * (`transition-[left,right,width] duration-base ease-linear`). `duration-base`\n * is the gated `--t-base` motion token, so reduced-motion is honoured for free\n * (pure CSS — the shared base stays motion-free, research 09 decision 2).\n *\n * The hook owns:\n * - the state machine — controlled + uncontrolled `open` per\n * component-api.md (`isControlled = open !== undefined`, never flips\n * modes) with `setOpen`/`toggle`;\n * - the `data-state`/`data-side` attrs for the group element;\n * - the assembly of the two class fragments in the canonical order.\n *\n * Width / collapse-trigger / slide utilities are passed as LITERAL class\n * strings by the consumer (Tailwind's scanner must see each literal in\n * source — a template-interpolated class is never generated), with\n * state-keyed defaults for a generic panel. Sidebar passes its\n * `--sidebar-width` + `group-data-[collapsible=offcanvas]` literals and gets\n * back its exact original fragments (the byte-identical re-point).\n *\n * Fork-prevention: a second gap-spacer + fixed-slide width tween outside this\n * folder fails `pnpm collapse-fork:check` (scripts/check-collapse-fork.mjs).\n */\nimport { useCallback, useMemo, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type CollapsiblePanelSide = \"left\" | \"right\";\nexport type CollapsiblePanelState = \"expanded\" | \"collapsed\";\n\n/**\n * State-keyed defaults for a generic panel: the consumer wraps the panel in a\n * `group` element carrying `attrs` and sets `--collapsible-panel-width` on it.\n */\nconst DEFAULT_WIDTH_CLASSNAME = \"w-(--collapsible-panel-width)\";\nconst DEFAULT_SPACER_COLLAPSED_CLASSNAME = \"group-data-[state=collapsed]:w-0\";\nconst DEFAULT_CONTAINER_SLIDE_CLASSNAMES: Record<CollapsiblePanelSide, string> = {\n left: \"left-0 group-data-[state=collapsed]:left-[calc(var(--collapsible-panel-width)*-1)]\",\n right: \"right-0 group-data-[state=collapsed]:right-[calc(var(--collapsible-panel-width)*-1)]\",\n};\n\nexport interface UseCollapsiblePanelOptions {\n /** Which edge the panel lives on. Default `\"left\"`. */\n side?: CollapsiblePanelSide;\n /** Controlled open state (`isControlled = open !== undefined`). */\n open?: boolean;\n /** Uncontrolled initial open state. Default `true`. */\n defaultOpen?: boolean;\n /** Called with the next open state on `setOpen`/`toggle`. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Literal expanded-width utility (e.g. `\"w-(--sidebar-width)\"`). Must be a\n * literal in the consumer's source so Tailwind generates it.\n */\n widthClassName?: string;\n /**\n * Literal collapsed-state utility for the gap spacer (e.g.\n * `\"group-data-[collapsible=offcanvas]:w-0\"`).\n */\n spacerCollapsedClassName?: string;\n /**\n * Literal off-screen slide utilities for the fixed container, keyed by side\n * (e.g. `left: \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"`).\n */\n containerSlideClassNames?: Record<CollapsiblePanelSide, string>;\n}\n\n/** Data attributes for the panel's `group` element. */\nexport interface CollapsiblePanelAttrs {\n \"data-state\": CollapsiblePanelState;\n \"data-side\": CollapsiblePanelSide;\n}\n\nexport interface UseCollapsiblePanelReturn {\n /** Resolved open state (controlled prop wins). */\n open: boolean;\n /** `\"expanded\"` when open, `\"collapsed\"` when closed. */\n state: CollapsiblePanelState;\n side: CollapsiblePanelSide;\n /** Set the open state (accepts a value or an updater fn). */\n setOpen: (open: boolean | ((open: boolean) => boolean)) => void;\n toggle: () => void;\n /** `data-state`/`data-side` for the group element wrapping both fragments. */\n attrs: CollapsiblePanelAttrs;\n /** The gap-spacer fragment: reserves/releases the inline width. */\n spacerClassName: string;\n /** The fixed-container fragment: slides the panel off-screen. */\n containerClassName: string;\n}\n\nexport function useCollapsiblePanel({\n side = \"left\",\n open: openProp,\n defaultOpen = true,\n onOpenChange,\n widthClassName = DEFAULT_WIDTH_CLASSNAME,\n spacerCollapsedClassName = DEFAULT_SPACER_COLLAPSED_CLASSNAME,\n containerSlideClassNames = DEFAULT_CONTAINER_SLIDE_CLASSNAMES,\n}: UseCollapsiblePanelOptions = {}): UseCollapsiblePanelReturn {\n // Controlled/uncontrolled per component-api.md: controlled iff the `open`\n // prop is provided; the mode never flips mid-life.\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const isControlled = openProp !== undefined;\n const open = isControlled ? openProp : uncontrolledOpen;\n\n const setOpen = useCallback(\n (value: boolean | ((open: boolean) => boolean)) => {\n const next = typeof value === \"function\" ? value(open) : value;\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange, open],\n );\n\n const toggle = useCallback(() => setOpen((o) => !o), [setOpen]);\n\n const state: CollapsiblePanelState = open ? \"expanded\" : \"collapsed\";\n\n // The two class fragments — the Sidebar collapse mechanism verbatim\n // (research 09 §A.1): assembly order is part of the contract (it is what\n // keeps Sidebar's emitted className strings byte-identical).\n const spacerClassName = useMemo(\n () =>\n cn(\n \"relative\",\n widthClassName,\n \"bg-transparent transition-[width] duration-base ease-linear\",\n spacerCollapsedClassName,\n ),\n [spacerCollapsedClassName, widthClassName],\n );\n const containerClassName = useMemo(\n () =>\n cn(\n \"fixed inset-y-0 z-10 hidden h-svh\",\n widthClassName,\n \"transition-[left,right,width] duration-base ease-linear md:flex\",\n containerSlideClassNames[side],\n ),\n [containerSlideClassNames, side, widthClassName],\n );\n\n const attrs = useMemo<CollapsiblePanelAttrs>(\n () => ({ \"data-state\": state, \"data-side\": side }),\n [side, state],\n );\n\n return useMemo(\n () => ({ open, state, side, setOpen, toggle, attrs, spacerClassName, containerClassName }),\n [open, state, side, setOpen, toggle, attrs, spacerClassName, containerClassName],\n );\n}\n","import { forwardRef, type InputHTMLAttributes } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type InputProps = InputHTMLAttributes<HTMLInputElement>;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, type = \"text\", ...props },\n ref,\n) {\n return (\n <input\n ref={ref}\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-[color,background-color,border-color,box-shadow] duration-fast ease-standard\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n \"disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted disabled:border-border\",\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive\",\n \"file:border-0 file:bg-transparent file:text-sm file:font-medium\",\n className,\n )}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nconst separatorVariants = cva(\"shrink-0\", {\n variants: {\n /**\n * `subtle` (default) — uses `--border` (a decorative/redundant boundary;\n * compliant because the edge is also signalled by surrounding fill, elevation\n * or spacing — WCAG 1.4.11 redundant-boundary exemption).\n *\n * `strong` — uses `--border-strong` (≥3:1 vs `--card`/`--background`).\n * Use when the separator is the ONLY structural cue between two same-surface\n * regions (no fill, elevation or spacing change to fall back on).\n * Decision test: \"If I deleted this line, could a sighted user still tell\n * the two regions apart?\" No → `strong`.\n */\n tone: {\n subtle: \"bg-border\",\n strong: \"bg-border-strong\",\n },\n },\n defaultVariants: {\n tone: \"subtle\",\n },\n});\n\nexport type SeparatorProps = ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root> &\n VariantProps<typeof separatorVariants>;\n\nexport const Separator = forwardRef<ElementRef<typeof SeparatorPrimitive.Root>, SeparatorProps>(\n function Separator(\n { className, orientation = \"horizontal\", decorative = true, tone, ...props },\n ref,\n ) {\n return (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n separatorVariants({ tone }),\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Sheet = SheetPrimitive.Root;\nexport const SheetTrigger = SheetPrimitive.Trigger;\nexport const SheetClose = SheetPrimitive.Close;\nexport const SheetPortal = SheetPrimitive.Portal;\n\nconst SheetOverlay = forwardRef<\n ElementRef<typeof SheetPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(function SheetOverlay({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-foreground/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n );\n});\n\nconst sheetVariants = cva(\n \"fixed z-50 gap-4 overscroll-contain bg-card p-6 text-card-foreground shadow-ring-lg transition duration-slow ease-standard data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:[--tw-ease:var(--ease-entrance)] data-[state=closed]:[--tw-ease:var(--ease-exit)]\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right\",\n },\n },\n defaultVariants: { side: \"right\" },\n },\n);\n\nexport interface SheetContentProps\n extends\n ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {}\n\nexport const SheetContent = forwardRef<\n ElementRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(function SheetContent({ side = \"right\", className, children, ...props }, ref) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...props}\n >\n {children}\n <SheetPrimitive.Close\n className=\"absolute end-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label=\"Close\"\n >\n <X className=\"size-4\" />\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n );\n});\n\nexport function SheetHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"flex flex-col gap-1.5\", className)} {...props} />;\n}\nexport function SheetFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"mt-auto flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n {...props}\n />\n );\n}\nexport const SheetTitle = forwardRef<\n ElementRef<typeof SheetPrimitive.Title>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(function SheetTitle({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Title ref={ref} className={cn(\"text-lg font-semibold\", className)} {...props} />\n );\n});\nexport const SheetDescription = forwardRef<\n ElementRef<typeof SheetPrimitive.Description>,\n ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(function SheetDescription({ className, ...props }, ref) {\n return (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n","import { type HTMLAttributes } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type SkeletonProps = HTMLAttributes<HTMLDivElement>;\n\n/** Loading placeholder. Compose with width/height utilities, e.g. `h-4 w-32`. */\nexport function Skeleton({ className, ...props }: SkeletonProps) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-muted\", className)}\n aria-hidden=\"true\"\n {...props}\n />\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"../../lib/cn\";\n\nexport const TooltipProvider = TooltipPrimitive.Provider;\nexport const Tooltip = TooltipPrimitive.Root;\nexport const TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport const TooltipContent = forwardRef<\n ElementRef<typeof TooltipPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(function TooltipContent({ className, sideOffset = 6, ...props }, ref) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background shadow-md\",\n \"data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nexport const alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg]:text-current [&>svg~*]:ps-7\",\n {\n variants: {\n variant: {\n default: \"bg-card text-card-foreground\",\n info: \"border-info/40 bg-info/10 text-foreground\",\n success: \"border-success/40 bg-success/10 text-foreground\",\n warning: \"border-warning/50 bg-warning/10 text-foreground\",\n destructive:\n \"border-destructive/40 bg-destructive/10 text-destructive [&>svg]:text-destructive\",\n },\n },\n defaultVariants: { variant: \"default\" },\n },\n);\n\nexport const Alert = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(function Alert(\n // `role` is an explicit override seam (default \"alert\"): a PENDING decision\n // containing focusable controls (e.g. @elabs-ai/components-ai ApprovalCard) must be a\n // labelled region (`role=\"group\"` + aria-labelledby), not an assertive live\n // region (research/structural-design/11 §B.3).\n { className, variant, role = \"alert\", ...props },\n ref,\n) {\n return (\n <div ref={ref} role={role} className={cn(alertVariants({ variant }), className)} {...props} />\n );\n});\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n /**\n * Render at a different heading level to fit the surrounding document\n * outline (#329). The visual (`mb-1 font-medium leading-none\n * tracking-tight`) is identical at every level. @default \"h5\"\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\n// Ref type matches the rendered element (`HTMLHeadingElement` for every `as`\n// value) — previously mismatched to `HTMLParagraphElement` (#329).\nexport const AlertTitle = forwardRef<HTMLHeadingElement, AlertTitleProps>(function AlertTitle(\n { className, as: Tag = \"h5\", ...props },\n ref,\n) {\n return (\n <Tag\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n );\n});\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Cap the line length to a readable prose measure (`max-w-prose`, ~65ch)\n * for genuine paragraph content (#339). Off by default — short,\n * label-style descriptions should stay full width.\n */\n measure?: boolean;\n}\n\n// NOTE (#329 AC): checked for the same ref-type mismatch as `AlertTitle` —\n// `AlertDescription` renders a `<div>`, not a heading, so it needs no `as`\n// heading seam. Its own generic (`HTMLParagraphElement` on a rendered `<div>`)\n// is a pre-existing, unrelated mismatch; left as-is (out of scope for #329,\n// which is scoped to heading semantics, and not requested by #339 either) to\n// avoid a ref-type change unrelated to either issue's acceptance criteria.\nexport const AlertDescription = forwardRef<HTMLParagraphElement, AlertDescriptionProps>(\n function AlertDescription({ className, measure, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"text-sm [&_p]:leading-relaxed text-muted-foreground\",\n measure && \"max-w-prose\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport { cn } from \"../../lib/cn\";\nimport { buttonVariants } from \"../button\";\n\nexport const AlertDialog = AlertDialogPrimitive.Root;\nexport const AlertDialogTrigger = AlertDialogPrimitive.Trigger;\nexport const AlertDialogPortal = AlertDialogPrimitive.Portal;\n\nconst AlertDialogOverlay = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(function AlertDialogOverlay({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-foreground/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const AlertDialogContent = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Content>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(function AlertDialogContent({ className, ...props }, ref) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-card p-6 text-card-foreground shadow-ring-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n );\n});\n\nexport function AlertDialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"flex flex-col gap-1.5 text-start\", className)} {...props} />;\n}\nexport function AlertDialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n {...props}\n />\n );\n}\nexport const AlertDialogTitle = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Title>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(function AlertDialogTitle({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold\", className)}\n {...props}\n />\n );\n});\nexport const AlertDialogDescription = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Description>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(function AlertDialogDescription({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\nexport const AlertDialogAction = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Action>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(function AlertDialogAction({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />\n );\n});\nexport const AlertDialogCancel = forwardRef<\n ElementRef<typeof AlertDialogPrimitive.Cancel>,\n ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(function AlertDialogCancel({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(buttonVariants({ variant: \"outline\" }), className)}\n {...props}\n />\n );\n});\n","import { type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface AppShellProps {\n /** Persistent left navigation (often a <Sidebar />). */\n sidebar?: ReactNode;\n /** Top bar (often a <TopNav />). */\n topNav?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Class for the scrolling main content region. */\n mainClassName?: string;\n}\n\n/**\n * App-first layout: fixed-height viewport with an optional sidebar, a top bar,\n * and a scrollable main region. Pure layout — bring your own nav components.\n */\nexport function AppShell({ sidebar, topNav, children, className, mainClassName }: AppShellProps) {\n return (\n <div\n className={cn(\"flex h-dvh w-full overflow-hidden bg-background text-foreground\", className)}\n >\n {sidebar ? <div className=\"hidden md:flex\">{sidebar}</div> : null}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n {topNav}\n <main className={cn(\"min-h-0 flex-1 overflow-y-auto\", mainClassName)}>{children}</main>\n </div>\n </div>\n );\n}\n","import * as AspectRatioPrimitive from \"@radix-ui/react-aspect-ratio\";\n\nexport const AspectRatio = AspectRatioPrimitive.Root;\n","import { forwardRef, useId, useMemo, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { useLocale } from \"../locale-provider\";\nimport { ATTRIBUTIONS } from \"./attributions.generated\";\nimport type { Attribution, AttributionCategory } from \"./attribution-types\";\n\n/**\n * Render order + the heading each group gets. `data` first because those are the\n * notices a licence obliges us to show; `dependency` last because it is the long\n * tail nobody scrolls to but everybody must be able to reach.\n */\nconst CATEGORY_ORDER: readonly AttributionCategory[] = [\"data\", \"source\", \"font\", \"dependency\"];\n\nconst CATEGORY_LABEL: Record<AttributionCategory, string> = {\n data: \"Map data & tiles\",\n source: \"Adapted source\",\n font: \"Fonts\",\n dependency: \"Open-source dependencies\",\n};\n\nexport interface AttributionPanelProps extends HTMLAttributes<HTMLElement> {\n /**\n * The notices to render. Defaults to the GENERATED dataset\n * (`scripts/gen-attributions.mjs`), which is what keeps this panel accurate\n * without anyone maintaining a list — override only to scope or to test.\n */\n attributions?: readonly Attribution[];\n /** Restrict to these categories, in the panel's own order. Default: all. */\n categories?: readonly AttributionCategory[];\n /**\n * Restrict to notices reachable through these packages — e.g. an app that only\n * uses `…-ui` need not credit MapLibre's basemap providers. Matched against\n * each entry's `usedBy`. Default: all.\n */\n packages?: readonly string[];\n /** Show only the notices a licence obliges us to display. */\n requiredOnly?: boolean;\n /**\n * Cap the body height and scroll inside it. Omit to let the panel grow and\n * leave scrolling to the container (a Dialog body, a settings pane).\n */\n maxHeight?: number | string;\n}\n\n/** Filter + group in one pass so the render is a plain map over sections. */\nfunction groupAttributions(\n attributions: readonly Attribution[],\n {\n categories,\n packages,\n requiredOnly,\n }: Pick<AttributionPanelProps, \"categories\" | \"packages\" | \"requiredOnly\">,\n) {\n const order = categories ?? CATEGORY_ORDER;\n const visible = attributions.filter(\n (a) =>\n order.includes(a.category) &&\n (!requiredOnly || a.required) &&\n (!packages || a.usedBy.some((p) => packages.includes(p))),\n );\n return order\n .map((category) => ({ category, items: visible.filter((a) => a.category === category) }))\n .filter((group) => group.items.length > 0);\n}\n\nfunction AttributionItem({ item, requiredLabel }: { item: Attribution; requiredLabel: string }) {\n return (\n <li data-slot=\"attribution-panel-item\" className=\"flex flex-col gap-0.5 py-2\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1\">\n {item.url ? (\n <a\n href={item.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-body font-medium underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-xs\"\n >\n {item.name}\n </a>\n ) : (\n <span className=\"text-body font-medium\">{item.name}</span>\n )}\n {item.version ? (\n <span className=\"text-meta text-muted-foreground tabular-nums\">{item.version}</span>\n ) : null}\n <span className=\"text-meta text-muted-foreground\">{item.license}</span>\n {item.required ? (\n // Not colour-only: the badge carries the word itself (WCAG 1.4.1).\n <Badge variant=\"outline\" className=\"text-meta\">\n {requiredLabel}\n </Badge>\n ) : null}\n </div>\n {item.copyright ? (\n <p className=\"text-meta text-muted-foreground break-words\">{item.copyright}</p>\n ) : null}\n {item.note ? <p className=\"text-meta text-muted-foreground\">{item.note}</p> : null}\n </li>\n );\n}\n\n/**\n * The single surface where brand-ui's third-party notices are displayed —\n * OSS dependencies, adapted source, self-hosted fonts, and the map data/tile\n * credits that a licence actually obliges the product to show.\n *\n * The content is GENERATED from the repo (`pnpm gen:attributions`, gated by\n * `pnpm attributions:check`), so it cannot drift from what is actually shipped\n * the way a hand-kept credits page does.\n *\n * **Why this exists:** `MapCanvas` disables MapLibre's in-map attribution\n * control by default, and the flow canvases hide the React Flow badge. The\n * React Flow badge is an MIT project's request and carries no condition, but the\n * default Carto basemap's OpenStreetMap data is ODbL-licensed and the credit is\n * REQUIRED — mounting this panel somewhere a user can reach (an About dialog, a\n * settings pane, a footer link) is what keeps that obligation met while the map\n * corner stays clean. Ship it, or turn the in-map control back on.\n */\nexport const AttributionPanel = forwardRef<HTMLElement, AttributionPanelProps>(\n function AttributionPanel(\n {\n attributions = ATTRIBUTIONS,\n categories,\n packages,\n requiredOnly,\n maxHeight,\n className,\n ...props\n },\n ref,\n ) {\n const { t } = useLocale();\n // Instance-scoped so two panels on one page (Storybook autodocs renders every\n // story together) can't emit the same heading id — duplicate ids break the\n // aria-labelledby target and fail axe.\n const baseId = useId();\n const groups = useMemo(\n () => groupAttributions(attributions, { categories, packages, requiredOnly }),\n [attributions, categories, packages, requiredOnly],\n );\n\n const body = (\n <div className=\"flex flex-col gap-6\">\n {groups.map(({ category, items }) => (\n <section\n key={category}\n data-slot=\"attribution-panel-section\"\n aria-labelledby={`${baseId}-${category}`}\n >\n <h3 id={`${baseId}-${category}`} className=\"text-subtitle text-foreground mb-1\">\n {CATEGORY_LABEL[category]}\n </h3>\n <ul className=\"divide-y divide-border\">\n {items.map((item) => (\n <AttributionItem\n key={item.id}\n item={item}\n requiredLabel={t(\"ui.attributionPanel.required\")}\n />\n ))}\n </ul>\n </section>\n ))}\n </div>\n );\n\n return (\n <section\n ref={ref}\n data-slot=\"attribution-panel\"\n aria-label={t(\"ui.attributionPanel.label\")}\n className={cn(\"bg-card border border-border rounded-lg p-4\", className)}\n {...props}\n >\n {groups.length === 0 ? (\n <p className=\"text-body text-muted-foreground\">{t(\"ui.attributionPanel.empty\")}</p>\n ) : maxHeight === undefined ? (\n body\n ) : (\n <ScrollArea style={{ maxHeight }} className=\"pe-3\">\n {body}\n </ScrollArea>\n )}\n </section>\n );\n },\n);\n\nexport { ATTRIBUTIONS, CATEGORY_LABEL };\nexport type { Attribution, AttributionCategory };\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"../../lib/cn\";\n\nexport const ScrollArea = forwardRef<\n ElementRef<typeof ScrollAreaPrimitive.Root>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(function ScrollArea({ className, children, ...props }, ref) {\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport className=\"size-full rounded-[inherit]\">\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n});\n\nexport const ScrollBar = forwardRef<\n ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(function ScrollBar({ className, orientation = \"vertical\", ...props }, ref) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" && \"h-full w-2.5 border-s border-s-transparent p-px\",\n orientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent p-px\",\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n});\n","// GENERATED by scripts/gen-attributions.mjs — DO NOT EDIT BY HAND.\n// Run `pnpm gen:attributions` after changing a dependency, a vendored font, or\n// scripts/attributions.sources.json. `pnpm attributions:check` fails on a stale copy.\n//\n// 116 entries (data: 2, source: 16, font: 2, dependency: 96).\n\nimport type { Attribution } from \"./attribution-types\";\n\nexport const ATTRIBUTIONS: readonly Attribution[] = [\n {\n version: null,\n note: \"Default light/dark basemap styles and tiles (positron / dark-matter).\",\n id: \"carto\",\n category: \"data\",\n name: \"CARTO\",\n license: \"CARTO basemap terms\",\n copyright: \"© CARTO\",\n url: \"https://carto.com/about-carto/\",\n usedBy: [\"@elabs-ai/components-maps\"],\n required: true,\n },\n {\n version: null,\n note: \"Map data behind the default Carto basemap. ODbL obliges the credit wherever the tiles are shown.\",\n id: \"openstreetmap\",\n category: \"data\",\n name: \"OpenStreetMap\",\n license: \"ODbL-1.0\",\n copyright: \"© OpenStreetMap contributors\",\n url: \"https://www.openstreetmap.org/copyright\",\n usedBy: [\"@elabs-ai/components-maps\"],\n required: true,\n },\n {\n version: null,\n note: \"Vendored into @elabs-ai/components-ai and rewired onto brand-ui primitives and tokens. Apache-2.0, NOT MIT: §4 obliges us to carry the notice and to state that we modified the files.\",\n id: \"vercel-ai-elements\",\n category: \"source\",\n name: \"AI Elements\",\n license: \"Apache-2.0\",\n copyright: \"Copyright 2023 Vercel, Inc.\",\n url: \"https://github.com/vercel/ai-elements\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: true,\n },\n {\n version: null,\n note: \"The ShimmeringText component, from the ncdai shadcn registry. Its TRADEMARK.md grants no right to the author's name or brand assets — the code is adopted, the branding is not.\",\n id: \"shimmering-text\",\n category: \"source\",\n name: \"@ncdai/shimmering-text\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2026 Chánh Đại\",\n url: \"https://github.com/ncdai/chanhdai.com\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n },\n {\n version: null,\n note: \"The pluggable adapter-registry architecture behind the file viewer (ADR 0024).\",\n id: \"anyview\",\n category: \"source\",\n name: \"anyview\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2026 harshpreet931\",\n url: \"https://github.com/harshpreet931/anyview\",\n usedBy: [\"@elabs-ai/components-viewer\"],\n required: false,\n },\n {\n version: null,\n note: \"The message-part grouping design behind part-groups.ts, re-expressed in this library's idiom.\",\n id: \"assistant-ui\",\n category: \"source\",\n name: \"assistant-ui\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2025 AgentbaseAI Inc.\",\n url: \"https://github.com/assistant-ui/assistant-ui\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n },\n {\n version: null,\n note: \"Sample datasets in the bar / composed / candlestick chart stories. Attributed to bklit-ui (MIT, the charts library) rather than the archived bklit app (CC BY-NC 4.0) — see the note in ATTRIBUTION.md.\",\n id: \"bklit-ui\",\n category: \"source\",\n name: \"Bklit UI\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2026 uixmat\",\n url: \"https://github.com/bklit/bklit-ui\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n },\n {\n version: null,\n note: \"The sidebar-02 / sidebar-04 / sidebar-05 copy-owned blocks, re-tokenized with Tabler icons mapped to Lucide.\",\n id: \"blocks-so\",\n category: \"source\",\n name: \"blocks.so\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2025 Ephraim Duncan\",\n url: \"https://github.com/ephraimduncan/blocks\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n },\n {\n version: null,\n note: \"The view-state seam and chrome-part inversion the viewer adopted (ADR 0026). Its LICENSE.md carries two copyright lines; both are reproduced.\",\n id: \"extend-hq-ui\",\n category: \"source\",\n name: \"extend-hq/ui\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2026 CrowdView Inc, dba Extend; portions Copyright (c) 2023 shadcn\",\n url: \"https://github.com/extend-hq/ui\",\n usedBy: [\"@elabs-ai/components-viewer\"],\n required: false,\n },\n {\n version: null,\n note: \"The live-axis tick-interval picker behind live-y-axis.tsx. Upstream now names that function niceTimeInterval.\",\n id: \"liveline\",\n category: \"source\",\n name: \"Liveline\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2025-2026 Benji Taylor\",\n url: \"https://github.com/benjitaylor/liveline\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n },\n {\n version: null,\n note: \"The MapLibre component set @elabs-ai/components-maps was adapted from (ADR 0015).\",\n id: \"mapcn\",\n category: \"source\",\n name: \"mapcn\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2025 Anmoldeep Singh\",\n url: \"https://github.com/AnmolSaini16/mapcn\",\n usedBy: [\"@elabs-ai/components-maps\"],\n required: false,\n },\n {\n version: null,\n note: \"The @milkdown/react integration is vendored under markdown-editor/milkdown-react/ and adapted; Milkdown itself is also a runtime dependency.\",\n id: \"milkdown\",\n category: \"source\",\n name: \"Milkdown\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2020-present Mirone\",\n url: \"https://github.com/Milkdown/milkdown\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n },\n {\n version: null,\n note: \"Beyond the npm dependency below, the shipped dist of react-scroll-area and react-select is modified in patches/ — disclosed here so the change is not invisible.\",\n id: \"radix-primitives-patched\",\n category: \"source\",\n name: \"Radix UI Primitives (patched)\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2022 WorkOS\",\n url: \"https://github.com/radix-ui/primitives\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n },\n {\n version: null,\n note: \"The owned-source component model and many primitive implementations; the registry is shadcn-compatible (ADR 0001).\",\n id: \"shadcn-ui\",\n category: \"source\",\n name: \"shadcn/ui\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2023 shadcn\",\n url: \"https://github.com/shadcn-ui/ui\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n },\n {\n version: null,\n note: \"The stacked, layered elevation-ramp technique behind the shadow tokens (ADR 0020).\",\n id: \"shadow-plugin\",\n category: \"source\",\n name: \"shadow-plugin\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2026 Florian Kiem\",\n url: \"https://github.com/flornkm/shadow-plugin\",\n usedBy: [\"@elabs-ai/components-tokens\"],\n required: false,\n },\n {\n version: null,\n note: \"world-countries.json, fetched at runtime by the stat-card-choropleth-01 registry block. Its LICENSE names no holder, and upstream traces the file to johan/world.geo.json, which calls its own legal status dubious — the block already carries a TODO to self-host a clean source.\",\n id: \"subyfly-topojson\",\n category: \"source\",\n name: \"subyfly/topojson\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2016\",\n url: \"https://github.com/subyfly/topojson\",\n usedBy: [],\n required: false,\n },\n {\n version: null,\n note: \"The composition-patterns skill behind the component-api rule's compound-component conventions. The repo declares NO licence and ships no LICENSE file — credited by link, with no licence claimed.\",\n id: \"vercel-agent-skills\",\n category: \"source\",\n name: \"vercel-labs/agent-skills\",\n license: \"No licence declared\",\n copyright: null,\n url: \"https://github.com/vercel-labs/agent-skills\",\n usedBy: [],\n required: false,\n },\n {\n version: null,\n note: \"Adopted delta-only into the repo's interaction-guidelines rule. Governance, not shipped code.\",\n id: \"web-interface-guidelines\",\n category: \"source\",\n name: \"Web Interface Guidelines\",\n license: \"MIT\",\n copyright: \"Copyright (c) 2025 Vercel Labs\",\n url: \"https://github.com/vercel-labs/web-interface-guidelines\",\n usedBy: [],\n required: false,\n },\n {\n id: \"font:inter\",\n category: \"font\",\n name: \"Inter\",\n version: null,\n license: \"OFL-1.1\",\n copyright: \"Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)\",\n url: \"https://github.com/rsms/inter\",\n usedBy: [\"@elabs-ai/components-tokens\"],\n required: true,\n note: \"Self-hosted webfont shipped in the tokens package.\",\n },\n {\n id: \"font:source-code-pro\",\n category: \"font\",\n name: \"Source Code Pro\",\n version: null,\n license: \"OFL-1.1\",\n copyright:\n \"Copyright 2010-2020 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved.\",\n url: \"https://github.com/adobe-fonts/source-code-pro\",\n usedBy: [\"@elabs-ai/components-tokens\"],\n required: true,\n note: \"Self-hosted webfont shipped in the tokens package.\",\n },\n {\n id: \"@dagrejs/dagre\",\n category: \"dependency\",\n name: \"@dagrejs/dagre\",\n version: \"3.0.0\",\n license: \"MIT\",\n copyright: \"Chris Pettitt\",\n url: \"https://www.npmjs.com/package/@dagrejs/dagre\",\n usedBy: [\"@elabs-ai/components-flow\"],\n required: false,\n note: null,\n },\n {\n id: \"@hookform/resolvers\",\n category: \"dependency\",\n name: \"@hookform/resolvers\",\n version: \"3.10.0\",\n license: \"MIT\",\n copyright: \"bluebill1049\",\n url: \"https://www.npmjs.com/package/@hookform/resolvers\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@milkdown/kit\",\n category: \"dependency\",\n name: \"@milkdown/kit\",\n version: \"7.21.2\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@milkdown/kit\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"@number-flow/react\",\n category: \"dependency\",\n name: \"@number-flow/react\",\n version: \"0.5.14\",\n license: \"MIT\",\n copyright: \"Maxwell Barvian\",\n url: \"https://www.npmjs.com/package/@number-flow/react\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@prosemirror-adapter/react\",\n category: \"dependency\",\n name: \"@prosemirror-adapter/react\",\n version: \"0.5.3\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@prosemirror-adapter/react\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-accordion\",\n category: \"dependency\",\n name: \"@radix-ui/react-accordion\",\n version: \"1.2.12\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-accordion\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-alert-dialog\",\n category: \"dependency\",\n name: \"@radix-ui/react-alert-dialog\",\n version: \"1.1.15\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-alert-dialog\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-aspect-ratio\",\n category: \"dependency\",\n name: \"@radix-ui/react-aspect-ratio\",\n version: \"1.1.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-aspect-ratio\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-avatar\",\n category: \"dependency\",\n name: \"@radix-ui/react-avatar\",\n version: \"1.1.11\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-avatar\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-checkbox\",\n category: \"dependency\",\n name: \"@radix-ui/react-checkbox\",\n version: \"1.3.3\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-checkbox\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-collapsible\",\n category: \"dependency\",\n name: \"@radix-ui/react-collapsible\",\n version: \"1.1.12\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-collapsible\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-context-menu\",\n category: \"dependency\",\n name: \"@radix-ui/react-context-menu\",\n version: \"2.2.16\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-context-menu\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-dialog\",\n category: \"dependency\",\n name: \"@radix-ui/react-dialog\",\n version: \"1.1.15\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-dialog\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-direction\",\n category: \"dependency\",\n name: \"@radix-ui/react-direction\",\n version: \"1.1.1\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-direction\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-dropdown-menu\",\n category: \"dependency\",\n name: \"@radix-ui/react-dropdown-menu\",\n version: \"2.1.16\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-dropdown-menu\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-hover-card\",\n category: \"dependency\",\n name: \"@radix-ui/react-hover-card\",\n version: \"1.1.15\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-hover-card\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-label\",\n category: \"dependency\",\n name: \"@radix-ui/react-label\",\n version: \"2.1.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-label\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-menubar\",\n category: \"dependency\",\n name: \"@radix-ui/react-menubar\",\n version: \"1.1.16\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-menubar\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-navigation-menu\",\n category: \"dependency\",\n name: \"@radix-ui/react-navigation-menu\",\n version: \"1.2.14\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-navigation-menu\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-popover\",\n category: \"dependency\",\n name: \"@radix-ui/react-popover\",\n version: \"1.1.15\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-popover\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-progress\",\n category: \"dependency\",\n name: \"@radix-ui/react-progress\",\n version: \"1.1.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-progress\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-radio-group\",\n category: \"dependency\",\n name: \"@radix-ui/react-radio-group\",\n version: \"1.3.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-radio-group\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-scroll-area\",\n category: \"dependency\",\n name: \"@radix-ui/react-scroll-area\",\n version: \"1.2.10\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-scroll-area\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-select\",\n category: \"dependency\",\n name: \"@radix-ui/react-select\",\n version: \"2.2.6\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-select\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-separator\",\n category: \"dependency\",\n name: \"@radix-ui/react-separator\",\n version: \"1.1.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-separator\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-slider\",\n category: \"dependency\",\n name: \"@radix-ui/react-slider\",\n version: \"1.3.6\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-slider\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-slot\",\n category: \"dependency\",\n name: \"@radix-ui/react-slot\",\n version: \"1.2.4\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-slot\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-switch\",\n category: \"dependency\",\n name: \"@radix-ui/react-switch\",\n version: \"1.2.6\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-switch\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-tabs\",\n category: \"dependency\",\n name: \"@radix-ui/react-tabs\",\n version: \"1.1.13\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-tabs\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-toggle\",\n category: \"dependency\",\n name: \"@radix-ui/react-toggle\",\n version: \"1.1.10\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-toggle\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-toggle-group\",\n category: \"dependency\",\n name: \"@radix-ui/react-toggle-group\",\n version: \"1.1.11\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-toggle-group\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-toolbar\",\n category: \"dependency\",\n name: \"@radix-ui/react-toolbar\",\n version: \"1.1.19\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-toolbar\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-tooltip\",\n category: \"dependency\",\n name: \"@radix-ui/react-tooltip\",\n version: \"1.2.8\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-tooltip\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"@radix-ui/react-use-controllable-state\",\n category: \"dependency\",\n name: \"@radix-ui/react-use-controllable-state\",\n version: \"1.2.2\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@radix-ui/react-use-controllable-state\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@rive-app/react-webgl2\",\n category: \"dependency\",\n name: \"@rive-app/react-webgl2\",\n version: \"4.28.6\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@rive-app/react-webgl2\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@streamdown/cjk\",\n category: \"dependency\",\n name: \"@streamdown/cjk\",\n version: \"1.0.3\",\n license: \"Apache-2.0\",\n copyright: \"Hayden Bleasel\",\n url: \"https://www.npmjs.com/package/@streamdown/cjk\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@streamdown/code\",\n category: \"dependency\",\n name: \"@streamdown/code\",\n version: \"1.1.1\",\n license: \"Apache-2.0\",\n copyright: \"Hayden Bleasel\",\n url: \"https://www.npmjs.com/package/@streamdown/code\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"@streamdown/math\",\n category: \"dependency\",\n name: \"@streamdown/math\",\n version: \"1.0.2\",\n license: \"Apache-2.0\",\n copyright: \"Hayden Bleasel\",\n url: \"https://www.npmjs.com/package/@streamdown/math\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@streamdown/mermaid\",\n category: \"dependency\",\n name: \"@streamdown/mermaid\",\n version: \"1.0.2\",\n license: \"Apache-2.0\",\n copyright: \"Hayden Bleasel\",\n url: \"https://www.npmjs.com/package/@streamdown/mermaid\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@tanstack/react-table\",\n category: \"dependency\",\n name: \"@tanstack/react-table\",\n version: \"8.21.3\",\n license: \"MIT\",\n copyright: \"Tanner Linsley\",\n url: \"https://www.npmjs.com/package/@tanstack/react-table\",\n usedBy: [\"@elabs-ai/components-data\"],\n required: false,\n note: null,\n },\n {\n id: \"@tanstack/react-virtual\",\n category: \"dependency\",\n name: \"@tanstack/react-virtual\",\n version: \"3.14.2\",\n license: \"MIT\",\n copyright: \"Tanner Linsley\",\n url: \"https://www.npmjs.com/package/@tanstack/react-virtual\",\n usedBy: [\n \"@elabs-ai/components-charts\",\n \"@elabs-ai/components-data\",\n \"@elabs-ai/components-ui\",\n \"@elabs-ai/components-viewer\",\n ],\n required: false,\n note: null,\n },\n {\n id: \"@visx/brush\",\n category: \"dependency\",\n name: \"@visx/brush\",\n version: \"3.12.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/brush\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/curve\",\n category: \"dependency\",\n name: \"@visx/curve\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/curve\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/event\",\n category: \"dependency\",\n name: \"@visx/event\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/event\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/geo\",\n category: \"dependency\",\n name: \"@visx/geo\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@nschnierer\",\n url: \"https://www.npmjs.com/package/@visx/geo\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/gradient\",\n category: \"dependency\",\n name: \"@visx/gradient\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/gradient\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/grid\",\n category: \"dependency\",\n name: \"@visx/grid\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/grid\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/group\",\n category: \"dependency\",\n name: \"@visx/group\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/group\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/pattern\",\n category: \"dependency\",\n name: \"@visx/pattern\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/pattern\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/responsive\",\n category: \"dependency\",\n name: \"@visx/responsive\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/responsive\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/sankey\",\n category: \"dependency\",\n name: \"@visx/sankey\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@jacksonhardaker\",\n url: \"https://www.npmjs.com/package/@visx/sankey\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/scale\",\n category: \"dependency\",\n name: \"@visx/scale\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@visx/scale\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/shape\",\n category: \"dependency\",\n name: \"@visx/shape\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/shape\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@visx/zoom\",\n category: \"dependency\",\n name: \"@visx/zoom\",\n version: \"4.0.1-alpha.0\",\n license: \"MIT\",\n copyright: \"@hshoff\",\n url: \"https://www.npmjs.com/package/@visx/zoom\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"@xterm/addon-fit\",\n category: \"dependency\",\n name: \"@xterm/addon-fit\",\n version: \"0.11.0\",\n license: \"MIT\",\n copyright: \"The xterm.js authors\",\n url: \"https://www.npmjs.com/package/@xterm/addon-fit\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"@xterm/xterm\",\n category: \"dependency\",\n name: \"@xterm/xterm\",\n version: \"6.0.0\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/@xterm/xterm\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"ansi-to-react\",\n category: \"dependency\",\n name: \"ansi-to-react\",\n version: \"6.2.6\",\n license: \"BSD-3-Clause\",\n copyright: \"Kyle Kelley\",\n url: \"https://www.npmjs.com/package/ansi-to-react\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"class-variance-authority\",\n category: \"dependency\",\n name: \"class-variance-authority\",\n version: \"0.7.1\",\n license: \"Apache-2.0\",\n copyright: \"Joe Bell\",\n url: \"https://www.npmjs.com/package/class-variance-authority\",\n usedBy: [\n \"@elabs-ai/components-ai\",\n \"@elabs-ai/components-charts\",\n \"@elabs-ai/components-editor\",\n \"@elabs-ai/components-ui\",\n ],\n required: false,\n note: null,\n },\n {\n id: \"clsx\",\n category: \"dependency\",\n name: \"clsx\",\n version: \"2.1.1\",\n license: \"MIT\",\n copyright: \"Luke Edwards\",\n url: \"https://www.npmjs.com/package/clsx\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"cmdk\",\n category: \"dependency\",\n name: \"cmdk\",\n version: \"1.1.1\",\n license: \"MIT\",\n copyright: \"Paco\",\n url: \"https://www.npmjs.com/package/cmdk\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-array\",\n category: \"dependency\",\n name: \"d3-array\",\n version: \"3.2.4\",\n license: \"ISC\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-array\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-force\",\n category: \"dependency\",\n name: \"d3-force\",\n version: \"3.0.0\",\n license: \"ISC\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-force\",\n usedBy: [\"@elabs-ai/components-flow\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-geo\",\n category: \"dependency\",\n name: \"d3-geo\",\n version: \"3.1.0\",\n license: \"ISC\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-geo\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-sankey\",\n category: \"dependency\",\n name: \"d3-sankey\",\n version: \"0.12.3\",\n license: \"BSD-3-Clause\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-sankey\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-scale\",\n category: \"dependency\",\n name: \"d3-scale\",\n version: \"4.0.2\",\n license: \"ISC\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-scale\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"d3-shape\",\n category: \"dependency\",\n name: \"d3-shape\",\n version: \"3.2.0\",\n license: \"ISC\",\n copyright: \"Mike Bostock\",\n url: \"https://www.npmjs.com/package/d3-shape\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"embla-carousel-react\",\n category: \"dependency\",\n name: \"embla-carousel-react\",\n version: \"8.6.0\",\n license: \"MIT\",\n copyright: \"David Jerleke\",\n url: \"https://www.npmjs.com/package/embla-carousel-react\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"input-otp\",\n category: \"dependency\",\n name: \"input-otp\",\n version: \"1.4.2\",\n license: \"MIT\",\n copyright: \"Guilherme Rodz\",\n url: \"https://www.npmjs.com/package/input-otp\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"js-yaml\",\n category: \"dependency\",\n name: \"js-yaml\",\n version: \"4.2.0\",\n license: \"MIT\",\n copyright: \"Vladimir Zapparov\",\n url: \"https://www.npmjs.com/package/js-yaml\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"katex\",\n category: \"dependency\",\n name: \"katex\",\n version: \"0.16.47\",\n license: \"MIT\",\n copyright: null,\n url: \"https://www.npmjs.com/package/katex\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"lucide-react\",\n category: \"dependency\",\n name: \"lucide-react\",\n version: \"0.577.0\",\n license: \"ISC\",\n copyright: \"Eric Fennis\",\n url: \"https://www.npmjs.com/package/lucide-react\",\n usedBy: [\n \"@elabs-ai/components-ai\",\n \"@elabs-ai/components-charts\",\n \"@elabs-ai/components-data\",\n \"@elabs-ai/components-editor\",\n \"@elabs-ai/components-flow\",\n \"@elabs-ai/components-maps\",\n \"@elabs-ai/components-ui\",\n \"@elabs-ai/components-viewer\",\n ],\n required: false,\n note: null,\n },\n {\n id: \"media-chrome\",\n category: \"dependency\",\n name: \"media-chrome\",\n version: \"4.19.1\",\n license: \"MIT\",\n copyright: \"@muxinc\",\n url: \"https://www.npmjs.com/package/media-chrome\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"mermaid\",\n category: \"dependency\",\n name: \"mermaid\",\n version: \"11.15.0\",\n license: \"MIT\",\n copyright: \"Knut Sveidqvist\",\n url: \"https://www.npmjs.com/package/mermaid\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"motion\",\n category: \"dependency\",\n name: \"motion\",\n version: \"12.40.0\",\n license: \"MIT\",\n copyright: \"Matt Perry\",\n url: \"https://www.npmjs.com/package/motion\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"nanoid\",\n category: \"dependency\",\n name: \"nanoid\",\n version: \"5.1.11\",\n license: \"MIT\",\n copyright: \"Andrey Sitnik\",\n url: \"https://www.npmjs.com/package/nanoid\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"react-day-picker\",\n category: \"dependency\",\n name: \"react-day-picker\",\n version: \"9.14.0\",\n license: \"MIT\",\n copyright: \"Giampaolo Bellavite\",\n url: \"https://www.npmjs.com/package/react-day-picker\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"react-hook-form\",\n category: \"dependency\",\n name: \"react-hook-form\",\n version: \"7.77.0\",\n license: \"MIT\",\n copyright: \"Beier(Bill) Luo\",\n url: \"https://www.npmjs.com/package/react-hook-form\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"react-jsx-parser\",\n category: \"dependency\",\n name: \"react-jsx-parser\",\n version: \"2.4.1\",\n license: \"MIT\",\n copyright: \"Troy Alford\",\n url: \"https://www.npmjs.com/package/react-jsx-parser\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"react-resizable-panels\",\n category: \"dependency\",\n name: \"react-resizable-panels\",\n version: \"2.1.9\",\n license: \"MIT\",\n copyright: \"Brian Vaughn\",\n url: \"https://www.npmjs.com/package/react-resizable-panels\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"react-use-measure\",\n category: \"dependency\",\n name: \"react-use-measure\",\n version: \"2.1.7\",\n license: \"MIT\",\n copyright: \"Paul Henschel\",\n url: \"https://www.npmjs.com/package/react-use-measure\",\n usedBy: [\"@elabs-ai/components-charts\"],\n required: false,\n note: null,\n },\n {\n id: \"remark-directive\",\n category: \"dependency\",\n name: \"remark-directive\",\n version: \"4.0.0\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/remark-directive\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"remark-frontmatter\",\n category: \"dependency\",\n name: \"remark-frontmatter\",\n version: \"5.0.0\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/remark-frontmatter\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"remark-gfm\",\n category: \"dependency\",\n name: \"remark-gfm\",\n version: \"4.0.1\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/remark-gfm\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"remark-math\",\n category: \"dependency\",\n name: \"remark-math\",\n version: \"6.0.0\",\n license: \"MIT\",\n copyright: \"Junyoung Choi\",\n url: \"https://www.npmjs.com/package/remark-math\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"remark-parse\",\n category: \"dependency\",\n name: \"remark-parse\",\n version: \"11.0.0\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/remark-parse\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"shiki\",\n category: \"dependency\",\n name: \"shiki\",\n version: \"3.23.0\",\n license: \"MIT\",\n copyright: \"Pine Wu; Anthony Fu\",\n url: \"https://www.npmjs.com/package/shiki\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"sonner\",\n category: \"dependency\",\n name: \"sonner\",\n version: \"1.7.4\",\n license: \"MIT\",\n copyright: \"Emil Kowalski\",\n url: \"https://www.npmjs.com/package/sonner\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"streamdown\",\n category: \"dependency\",\n name: \"streamdown\",\n version: \"2.5.0\",\n license: \"Apache-2.0\",\n copyright: \"Hayden Bleasel\",\n url: \"https://www.npmjs.com/package/streamdown\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"tailwind-merge\",\n category: \"dependency\",\n name: \"tailwind-merge\",\n version: \"2.6.1\",\n license: \"MIT\",\n copyright: \"Dany Castillo\",\n url: \"https://www.npmjs.com/package/tailwind-merge\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"tokenlens\",\n category: \"dependency\",\n name: \"tokenlens\",\n version: \"1.3.1\",\n license: \"MIT\",\n copyright: \"Nicklas Scharpff\",\n url: \"https://www.npmjs.com/package/tokenlens\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"tw-animate-css\",\n category: \"dependency\",\n name: \"tw-animate-css\",\n version: \"1.4.0\",\n license: \"MIT\",\n copyright: \"Luca Bosin\",\n url: \"https://www.npmjs.com/package/tw-animate-css\",\n usedBy: [\"@elabs-ai/components-tokens\"],\n required: false,\n note: null,\n },\n {\n id: \"unified\",\n category: \"dependency\",\n name: \"unified\",\n version: \"11.0.5\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/unified\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"unist-util-visit\",\n category: \"dependency\",\n name: \"unist-util-visit\",\n version: \"5.1.0\",\n license: \"MIT\",\n copyright: \"Titus Wormer\",\n url: \"https://www.npmjs.com/package/unist-util-visit\",\n usedBy: [\"@elabs-ai/components-editor\"],\n required: false,\n note: null,\n },\n {\n id: \"use-stick-to-bottom\",\n category: \"dependency\",\n name: \"use-stick-to-bottom\",\n version: \"1.1.6\",\n license: \"MIT\",\n copyright: \"Sam Denty\",\n url: \"https://www.npmjs.com/package/use-stick-to-bottom\",\n usedBy: [\"@elabs-ai/components-ai\"],\n required: false,\n note: null,\n },\n {\n id: \"vaul\",\n category: \"dependency\",\n name: \"vaul\",\n version: \"1.1.2\",\n license: \"MIT\",\n copyright: \"Emil Kowalski\",\n url: \"https://www.npmjs.com/package/vaul\",\n usedBy: [\"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n {\n id: \"zod\",\n category: \"dependency\",\n name: \"zod\",\n version: \"3.25.76\",\n license: \"MIT\",\n copyright: \"Colin McDonnell\",\n url: \"https://www.npmjs.com/package/zod\",\n usedBy: [\"@elabs-ai/components-ai\", \"@elabs-ai/components-ui\"],\n required: false,\n note: null,\n },\n] as const;\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Avatar = forwardRef<\n ElementRef<typeof AvatarPrimitive.Root>,\n ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(function Avatar({ className, ...props }, ref) {\n return (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\"relative flex size-9 shrink-0 overflow-hidden rounded-full\", className)}\n {...props}\n />\n );\n});\nexport const AvatarImage = forwardRef<\n ElementRef<typeof AvatarPrimitive.Image>,\n ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(function AvatarImage({ className, ...props }, ref) {\n return (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\n \"aspect-square size-full animate-in fade-in duration-base ease-entrance\",\n className,\n )}\n {...props}\n />\n );\n});\nexport const AvatarFallback = forwardRef<\n ElementRef<typeof AvatarPrimitive.Fallback>,\n ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(function AvatarFallback({ className, ...props }, ref) {\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n \"flex size-full items-center justify-center rounded-full bg-muted text-sm font-medium text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n});\n","\"use client\";\n\n/**\n * BentoGrid + BentoGridItem — a hover-elevation bento layout.\n *\n * A responsive dense CSS-grid container. **The default separation gesture is\n * ELEVATION, not colour:** the grid rests flat (`shadow-none` — border only) and\n * each tile rises ~4px into `shadow-xl` with a brand-tinted edge on hover, so the\n * tile under the pointer clearly separates from the sheet.\n *\n * The cursor-following **spotlight is OPT-IN** (`spotlight`, default `false`) —\n * set it on the `BentoGrid` to enable it for every tile, or per tile to override\n * the grid. Its colour is a DERIVED tint of the `--primary` token\n * (`color-mix(in oklch, var(--primary) 12%, transparent)`), so it stays\n * theme-correct in every theme with no raw colors and no extra token. Under OS\n * reduced-motion the spotlight is suppressed entirely (`motion-reduce:hidden`);\n * tiles still respond to hover/focus with their normal card states.\n *\n * Key design choices:\n * - `BentoGridItem` composes `Card` (inherits card surface/border/radius) and\n * then overrides the resting `shadow-sm` down to `shadow-none`.\n * - Under reduced motion the travel is neutralized and the transition dropped —\n * the shadow and the edge still state the hover (\"reduced != none\").\n * - Spans are inline `grid-column/grid-row` and collapse to one cell on the\n * 1-column mobile grid (the browser caps a span at the available tracks).\n * - The tile is presentational; for a clickable tile, place an interactive inner\n * element (e.g. a stretched `<a className=\"absolute inset-0\">`) and set\n * `interactive` so the tile shows a `focus-within` ring.\n * - The spotlight overlay is `pointer-events-none` + `aria-hidden` (decorative).\n * - Motion is gated via `duration-base` / `ease-standard` (token-backed).\n */\n\nimport {\n createContext,\n forwardRef,\n use,\n useRef,\n useCallback,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { cardVariants } from \"../card/card\";\n\n// ---------------------------------------------------------------------------\n// Context — the grid hands its spotlight default down to every tile so a whole\n// bento can opt in with ONE prop instead of repeating it on every child. A tile's\n// own `spotlight` prop always wins.\n// ---------------------------------------------------------------------------\n\nconst BentoGridContext = createContext<{ spotlight: boolean }>({ spotlight: false });\n\n// ---------------------------------------------------------------------------\n// BentoGrid\n// ---------------------------------------------------------------------------\n\nexport interface BentoGridProps extends HTMLAttributes<HTMLDivElement> {\n /** Additional className merged via cn(). */\n className?: string;\n /**\n * Enable the cursor-following spotlight on every tile in this grid. Individual\n * tiles can still opt out (or in) with their own `spotlight` prop. Disabled\n * entirely under OS `prefers-reduced-motion` regardless of this prop.\n * @default false\n */\n spotlight?: boolean;\n}\n\n/**\n * Responsive CSS-grid container.\n * - 1 column on mobile, 2 on sm, 4 on lg.\n * - `grid-auto-flow: dense` fills in gaps left by spanning tiles.\n * - `auto-rows-[14rem]` gives a baseline row height (14rem ≈ 224px); tiles can\n * span multiple rows via the `size` / `span.row` API.\n * - Carries the grid-wide `spotlight` default for its tiles (opt-in).\n */\nexport const BentoGrid = forwardRef<HTMLDivElement, BentoGridProps>(function BentoGrid(\n { className, spotlight = false, children, ...props },\n ref,\n) {\n return (\n <BentoGridContext value={{ spotlight }}>\n <div\n ref={ref}\n data-slot=\"bento-grid\"\n className={cn(\n \"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4\",\n \"[grid-auto-flow:dense]\",\n \"auto-rows-[14rem]\",\n \"gap-4\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </BentoGridContext>\n );\n});\n\n// ---------------------------------------------------------------------------\n// BentoGridItem — size / span presets\n// ---------------------------------------------------------------------------\n\n/**\n * Size preset → [colSpan, rowSpan].\n *\n * | size | cols | rows | purpose |\n * |-------|------|------|------------------------------------------------------------|\n * | sm | 1 | 1 | Supporting: compact metric or icon tile |\n * | md | 2 | 1 | Supporting: wider but single-row |\n * | lg | 2 | 2 | Featured: 2×2 block |\n * | hero | 2 | 2 | Hero: 2×2 + gradient emphasis wash |\n *\n * On a 1-column layout (mobile) ALL col spans clamp to 1 automatically via\n * CSS `min()` in `gridColumn`. Row spans are always honoured.\n */\nexport type BentoGridSize = \"sm\" | \"md\" | \"lg\" | \"hero\";\n\nconst SIZE_SPANS: Record<BentoGridSize, { col: number; row: number }> = {\n sm: { col: 1, row: 1 },\n md: { col: 2, row: 1 },\n lg: { col: 2, row: 2 },\n hero: { col: 2, row: 2 },\n};\n\n// cva for the item's structural/visual axes (NOT size — span is applied via\n// inline style so it collapses correctly on mobile without media-query gymnastics).\nexport const bentoGridItemVariants = cva(\n [\n // Base: compose Card surface (bg-card border rounded-lg shadow-sm).\n cardVariants({ interactive: false }),\n // Overflow hidden so content + spotlight overlay stay within rounded corners.\n \"relative overflow-hidden\",\n // Flex column layout for slot content.\n \"flex flex-col\",\n // Ensure long unbroken strings can't overflow the tile.\n \"min-w-0 break-words\",\n // ELEVATION IS THE HOVER GESTURE. The grid rests FLAT — `shadow-none` beats\n // the `shadow-sm` inherited from `cardVariants` (tailwind-merge, later wins)\n // so a bento sheet reads as one plane, not a field of lifted chips. On hover\n // the single tile under the pointer rises to `shadow-lg`, a stacked rung of\n // the ONE elevation ramp (never a hand-rolled box-shadow). The rung is\n // `hover:`-prefixed, so pairing it with the card border is the sanctioned\n // \"bordered card, hover lift\" shape, not the flagged double edge.\n \"shadow-none hover:shadow-xl\",\n // Shadow alone is a LIGHT-theme signal: the ramp's ink is black, so on a dark\n // ground even `shadow-xl` is faint (measured on `theme:dark` — the hovered tile\n // was hard to pick out). The hover EDGE carries the lift there. It is\n // `ring/40`, the same tint `Card interactive` uses — NOT `border-strong`, which\n // is a near-charcoal 0.65 L against a 0.88 L resting border and reads as a hard\n // outline snapping on, not as a lift. At 40% the brand hue stays a soft warm\n // edge on white and a clearly brighter one on charcoal.\n \"hover:border-ring/40\",\n // A lift you can SEE: ~4px of travel. Below ~16px a slide is a flicker, but a\n // hover-lift is the exception the motion guidelines size at ≥4px — and the\n // travel, not the duration, is what makes the elevation legible.\n \"hover:-translate-y-1 motion-reduce:hover:translate-y-0\",\n // `ease-entrance` (easeOutQuint) — a near-zero arrival velocity is the #1\n // smoothness lever; `ease-standard` snaps at the end. Duration stays at the\n // 260ms `base` rung: lengthening it does NOT fix abruptness. Under OS\n // reduced-motion the travel is neutralized and the transition is dropped, so\n // the shadow + edge still state the hover without any movement.\n \"transition-[translate,box-shadow,border-color] duration-base ease-entrance motion-reduce:transition-none\",\n ].join(\" \"),\n {\n variants: {\n /** Hero tile gets a subtle gradient wash to distinguish it from supporting tiles. */\n hero: {\n true: \"bg-gradient-to-br from-primary/8 to-card\",\n false: \"\",\n },\n /**\n * Interactive tiles (those holding a clickable inner element, e.g. a\n * stretched link) get a pointer cursor and a `focus-within` ring so keyboard\n * focus on the inner control is visible on the whole tile. The hover lift\n * (elevation + edge) is on the base — every tile lifts, clickable or not.\n */\n interactive: {\n true: \"cursor-pointer focus-within:outline-none focus-within:ring-2 focus-within:ring-ring\",\n false: \"\",\n },\n },\n defaultVariants: { hero: false, interactive: false },\n },\n);\n\nexport type BentoGridItemVariants = VariantProps<typeof bentoGridItemVariants>;\n\nexport interface BentoGridItemProps extends HTMLAttributes<HTMLDivElement>, BentoGridItemVariants {\n /**\n * Size preset. Resolves to a col + row span. Overridden by explicit `span`.\n * @default \"sm\"\n */\n size?: BentoGridSize;\n /**\n * Explicit grid span. Wins over `size`. Spans clamp gracefully on narrow\n * layouts — a `col: 4` on a 2-col grid becomes `span min(4, 2)`.\n */\n span?: { col?: number; row?: number };\n /**\n * Enable the cursor-following spotlight gradient on this tile. Omit to inherit\n * the parent `BentoGrid`'s `spotlight` (itself `false` by default) — so the\n * effect is opt-in, per grid or per tile. Disabled entirely under OS\n * `prefers-reduced-motion` regardless of this prop.\n * @default false (inherited from BentoGrid)\n */\n spotlight?: boolean;\n}\n\n/**\n * A single bento tile. Composes `Card`, rests flat, lifts to `shadow-lg` on\n * hover, and adds the OPT-IN spotlight overlay.\n *\n * Spotlight:\n * - Sets `--bento-x` / `--bento-y` CSS custom properties on `onMouseMove`\n * via a direct style set (no layout reads in render — uses\n * `getBoundingClientRect` in the event handler only, never during paint).\n * - An absolutely-positioned `pointer-events-none aria-hidden` overlay paints\n * `radial-gradient(… at var(--bento-x) var(--bento-y), color-mix(--primary), transparent)`.\n * - Revealed on hover via opacity transition gated by `duration-base ease-standard`.\n * - Suppressed with `motion-reduce:hidden` — cursor-following IS motion.\n */\nexport const BentoGridItem = forwardRef<HTMLDivElement, BentoGridItemProps>(function BentoGridItem(\n { size = \"sm\", span, spotlight, hero, interactive, className, style, children, ...props },\n ref,\n) {\n const tileRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n\n // Own prop wins; otherwise inherit the grid's opt-in (default false).\n const spotlightOn = spotlight ?? use(BentoGridContext).spotlight;\n\n // Resolve spans: explicit span wins over size preset.\n const resolvedCol = span?.col ?? SIZE_SPANS[size].col;\n const resolvedRow = span?.row ?? SIZE_SPANS[size].row;\n\n const isInteractive = interactive ?? false;\n\n // isHero: explicit prop or size === \"hero\".\n const isHero = hero ?? size === \"hero\";\n\n // rAF ref so we only schedule one frame at a time.\n const rafRef = useRef<number>(0);\n\n const handleMouseMove = useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n if (!spotlightOn || !tileRef.current || !overlayRef.current) return;\n // Cancel pending rAF to debounce rapid moves.\n if (rafRef.current) cancelAnimationFrame(rafRef.current);\n rafRef.current = requestAnimationFrame(() => {\n if (!tileRef.current || !overlayRef.current) return;\n const rect = tileRef.current.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n // Direct style mutation — no React render cycle.\n tileRef.current.style.setProperty(\"--bento-x\", `${x}px`);\n tileRef.current.style.setProperty(\"--bento-y\", `${y}px`);\n overlayRef.current.style.opacity = \"1\";\n });\n },\n [spotlightOn],\n );\n\n const handleMouseLeave = useCallback(() => {\n if (!overlayRef.current) return;\n overlayRef.current.style.opacity = \"0\";\n }, []);\n\n // Grid span via inline style. On mobile (grid-cols-1) a col-span of any value\n // is effectively clamped to 1 by the grid itself — a 4-col tile in a 1-col\n // grid still renders in one cell. Row spans are always honoured as-is.\n // We use `gridColumn: \"span N / span N\"` which the browser safely caps at the\n // available track count; no CSS min() with custom-property arithmetic needed.\n const gridStyle: CSSProperties = {\n gridColumn: resolvedCol > 1 ? `span ${resolvedCol} / span ${resolvedCol}` : undefined,\n gridRow: resolvedRow > 1 ? `span ${resolvedRow} / span ${resolvedRow}` : undefined,\n ...style,\n };\n\n // Merge the forwarded ref and the internal tileRef into one callback ref.\n const mergedRef = useCallback(\n (node: HTMLDivElement | null) => {\n (tileRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref],\n );\n\n return (\n <div\n ref={mergedRef as React.Ref<HTMLDivElement>}\n className={cn(\n bentoGridItemVariants({\n hero: isHero,\n interactive: isInteractive,\n }),\n className,\n )}\n style={gridStyle}\n data-slot=\"bento-grid-item\"\n onMouseMove={handleMouseMove}\n onMouseLeave={handleMouseLeave}\n {...props}\n >\n {/* Spotlight overlay — OPT-IN, decorative, pointer-events-none, aria-hidden.\n Hidden in full under reduced-motion (the cursor-following IS the motion).\n Color is a color-mix tint of --primary (token-derived, no raw color). */}\n {spotlightOn && (\n <div\n ref={overlayRef}\n aria-hidden=\"true\"\n data-testid=\"bento-spotlight\"\n className={cn(\n \"pointer-events-none absolute inset-0 z-10\",\n \"opacity-0 transition-opacity duration-base ease-standard\",\n // Suppress entirely under reduced-motion (cursor tracking = motion).\n \"motion-reduce:hidden\",\n )}\n style={{\n // Spotlight color is a DERIVED tint of the --primary token (not a raw\n // literal), so it stays theme-correct in every theme without a new\n // token. `color-mix` keeps it ~12% primary over transparent.\n background:\n \"radial-gradient(400px circle at var(--bento-x, 50%) var(--bento-y, 50%), color-mix(in oklch, var(--primary) 12%, transparent), transparent 70%)\",\n }}\n />\n )}\n {/* Tile content — min-w-0 on inner wrapper prevents flex children from\n overflowing on long unbroken strings (the silent truncation culprit). */}\n <div className=\"relative z-20 flex min-w-0 flex-1 flex-col\">{children}</div>\n </div>\n );\n});\n","\"use client\";\n\nimport {\n forwardRef,\n useRef,\n useState,\n useCallback,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n// `rounded-lg` is the shared \"container radius\" rung (= --radius-lg = var(--radius),\n// 4px). Card, Alert (rounded-lg), and the markdown editor directive chrome all read\n// this one rung so the SAME logical block shows ONE radius across editor↔preview\n// (was rounded-xl = 8px, whose meaning silently changed with the --radius-xl override\n// — see #19). Overlays (Dialog/AlertDialog) deliberately use a larger rung.\nexport const cardVariants = cva(\"rounded-lg border bg-card text-card-foreground shadow-sm\", {\n variants: {\n // Opt-in hover-lift for clickable cards. Gated by --motion-factor via the\n // duration-* utility; the transform is neutralized under OS reduced-motion\n // (the shadow/border still respond — \"reduced != none\").\n interactive: {\n true: \"cursor-pointer transition-[translate,box-shadow,border-color] duration-base ease-standard hover:-translate-y-1 hover:border-ring/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:hover:translate-y-0\",\n false: \"\",\n },\n },\n defaultVariants: { interactive: false },\n});\n\n// Grid container for the OPTIONAL detail panel — applied only when `detail` is set.\n// `fixed` keeps the panel track at its full size; `hover` collapses it to 0 at rest and\n// animates it open on the card's own hover AND keyboard `focus-within`, while the `main`\n// region (overflow-hidden) yields the space so the OUTER card size stays constant.\n// Layout-animation trade-off: prefer `fixed` in very dense grids (animating grid tracks\n// is more expensive than a static layout). Motion is tokened + snaps under reduced-motion.\nconst cardDetailVariants = cva(\"group grid overflow-hidden\", {\n variants: {\n detailPlacement: { side: \"\", bottom: \"\" },\n detailReveal: { fixed: \"\", hover: \"\" },\n },\n compoundVariants: [\n {\n detailPlacement: \"side\",\n detailReveal: \"fixed\",\n class: \"grid-cols-[minmax(0,1fr)_var(--card-detail-size)]\",\n },\n {\n detailPlacement: \"bottom\",\n detailReveal: \"fixed\",\n class: \"grid-rows-[minmax(0,1fr)_var(--card-detail-size)]\",\n },\n {\n detailPlacement: \"side\",\n detailReveal: \"hover\",\n class:\n \"grid-cols-[minmax(0,1fr)_0px] transition-[grid-template-columns] duration-base ease-standard hover:grid-cols-[minmax(0,1fr)_var(--card-detail-size)] focus-within:grid-cols-[minmax(0,1fr)_var(--card-detail-size)] motion-reduce:transition-none\",\n },\n {\n detailPlacement: \"bottom\",\n detailReveal: \"hover\",\n class:\n \"grid-rows-[minmax(0,1fr)_0px] transition-[grid-template-rows] duration-base ease-standard hover:grid-rows-[minmax(0,1fr)_var(--card-detail-size)] focus-within:grid-rows-[minmax(0,1fr)_var(--card-detail-size)] motion-reduce:transition-none\",\n },\n ],\n defaultVariants: { detailPlacement: \"side\", detailReveal: \"fixed\" },\n});\n\nexport interface CardProps\n extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof cardVariants> {\n /**\n * Optional detail-panel content. **Undefined → a plain card** (today's single `<div>` —\n * no grid, no panel, zero behaviour change).\n */\n detail?: ReactNode;\n /** Which edge the detail panel sits on. @default \"side\" */\n detailPlacement?: \"side\" | \"bottom\";\n /**\n * `fixed` (default, accessible) → panel always visible. `hover` → hidden at rest, revealed\n * on hover **and** keyboard `focus-within` at a FIXED outer footprint (the main content\n * yields the space; no surrounding reflow). Use `hover` for **supplementary** detail only —\n * essential content must use `fixed`. @default \"fixed\"\n */\n detailReveal?: \"fixed\" | \"hover\";\n /** Detail track size (any CSS length). @default \"16rem\" (side) / \"auto\" (bottom) */\n detailSize?: string;\n /** Accessible label for the detail region. @default \"Details\" */\n detailLabel?: string;\n}\n\n/**\n * Inner component for `detailReveal=\"hover\"` — needs hooks to track\n * hover/focus-within and drive `aria-hidden` on the detail panel so the\n * collapsed state is correctly hidden from the accessibility tree (WCAG 1.3.1 /\n * 2.4.3). When collapsed, AT cannot reach the detail controls.\n */\nfunction CardWithHoverDetail({\n className,\n interactive,\n detail,\n detailPlacement = \"side\",\n detailReveal: _detailReveal,\n detailSize,\n detailLabel = \"Details\",\n style,\n children,\n ...props\n}: CardProps) {\n const [isRevealed, setIsRevealed] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const reveal = useCallback(() => setIsRevealed(true), []);\n const conceal = useCallback(() => {\n // Only conceal if focus has truly left the card (not moved to detail).\n // Use requestAnimationFrame so the new focusIn event fires first.\n requestAnimationFrame(() => {\n if (containerRef.current && !containerRef.current.contains(document.activeElement)) {\n setIsRevealed(false);\n }\n });\n }, []);\n\n const handleMouseEnter = reveal;\n const handleMouseLeave = useCallback(() => {\n // Conceal on mouse-leave only if focus is not inside the card.\n if (containerRef.current && !containerRef.current.contains(document.activeElement)) {\n setIsRevealed(false);\n }\n }, []);\n\n const handleFocusIn = reveal;\n const handleFocusOut = conceal;\n\n const size = detailSize ?? (detailPlacement === \"side\" ? \"16rem\" : \"auto\");\n const dividerEdge = detailPlacement === \"side\" ? \"border-s\" : \"border-t\";\n const dividerColor = isRevealed\n ? \"border-border transition-colors duration-base ease-standard motion-reduce:transition-none\"\n : \"border-transparent transition-colors duration-base ease-standard motion-reduce:transition-none\";\n\n return (\n <div\n ref={containerRef}\n className={cn(\n cardVariants({ interactive }),\n cardDetailVariants({ detailPlacement, detailReveal: \"hover\" }),\n className,\n )}\n style={{ \"--card-detail-size\": size, ...style } as CSSProperties}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocusIn}\n onBlur={handleFocusOut}\n {...props}\n >\n <div className=\"min-h-0 min-w-0 overflow-hidden\">{children}</div>\n {/* aria-hidden mirrors the visual collapsed state so AT does not reach\n hidden controls. When revealed, it is removed so AT can navigate in. */}\n <div\n role=\"region\"\n aria-label={detailLabel}\n aria-hidden={!isRevealed}\n className={cn(\"overflow-hidden bg-background p-6\", dividerEdge, dividerColor)}\n >\n {detail}\n </div>\n </div>\n );\n}\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n {\n className,\n interactive,\n detail,\n detailPlacement = \"side\",\n detailReveal = \"fixed\",\n detailSize,\n detailLabel = \"Details\",\n style,\n children,\n ...props\n },\n ref,\n) {\n // No detail → today's plain card, byte-for-byte (no grid, no panel, no behaviour change).\n if (detail == null) {\n return (\n <div\n ref={ref}\n className={cn(cardVariants({ interactive }), className)}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n // `hover` mode uses the inner component with JS-tracked reveal state so we can\n // correctly set aria-hidden on the collapsed panel (WCAG 1.3.1 / 2.4.3 fix, #141).\n if (detailReveal === \"hover\") {\n // Note: ref is forwarded to the outer div inside CardWithHoverDetail via a\n // callback approach — consumers rarely need a ref on a hover-detail card, but\n // we still accept the prop and pass it down as a forwarded ref is not directly\n // composable with an inner function component. We use a workaround via the\n // ref prop name to keep the public API consistent.\n return (\n <CardWithHoverDetail\n className={className}\n interactive={interactive}\n detail={detail}\n detailPlacement={detailPlacement}\n detailSize={detailSize}\n detailLabel={detailLabel}\n style={style}\n {...props}\n >\n {children}\n </CardWithHoverDetail>\n );\n }\n\n const size = detailSize ?? (detailPlacement === \"side\" ? \"16rem\" : \"auto\");\n const dividerEdge = detailPlacement === \"side\" ? \"border-s\" : \"border-t\";\n // In `fixed` mode the divider is always the hairline border.\n const dividerColor = \"border-border\";\n\n return (\n <div\n ref={ref}\n className={cn(\n cardVariants({ interactive }),\n cardDetailVariants({ detailPlacement, detailReveal }),\n className,\n )}\n style={{ \"--card-detail-size\": size, ...style } as CSSProperties}\n {...props}\n >\n <div className=\"min-h-0 min-w-0 overflow-hidden\">{children}</div>\n {/* Fixed panel: always visible. Labelled region for landmark navigation (#141 P3). */}\n <div\n role=\"region\"\n aria-label={detailLabel}\n className={cn(\"overflow-hidden bg-background p-6\", dividerEdge, dividerColor)}\n >\n {detail}\n </div>\n </div>\n );\n});\n\nexport const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CardHeader({ className, ...props }, ref) {\n return <div ref={ref} className={cn(\"flex flex-col gap-1.5 p-6\", className)} {...props} />;\n },\n);\n\nexport interface CardTitleProps extends HTMLAttributes<HTMLElement> {\n /**\n * Render as a different element — pick the semantic heading level so a\n * card that titles a real page section contributes to the document outline\n * (#328). The visual (`text-title leading-none`) is identical regardless of\n * tag. @default \"div\"\n */\n as?: \"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n}\n\n// Ref generic is `HTMLDivElement`, not `HTMLElement`: every member of the `as`\n// union (div, h1-h6) carries the same deprecated `align` member, so they are\n// structurally interchangeable — but the bare `HTMLElement` supertype is NOT\n// (it lacks `align`), which is what the polymorphic <Tag ref={ref}> below\n// requires TS to check against for every possible tag.\nexport const CardTitle = forwardRef<HTMLDivElement, CardTitleProps>(function CardTitle(\n { className, as: Tag = \"div\", ...props },\n ref,\n) {\n return <Tag ref={ref} className={cn(\"text-title leading-none\", className)} {...props} />;\n});\n\nexport interface CardDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Cap the line length to a readable prose measure (`max-w-prose`, ~65ch)\n * for genuine paragraph content (#339). Off by default — short,\n * subtitle-style descriptions should stay full width.\n */\n measure?: boolean;\n}\n\nexport const CardDescription = forwardRef<HTMLParagraphElement, CardDescriptionProps>(\n function CardDescription({ className, measure, ...props }, ref) {\n return (\n <p\n ref={ref}\n // `text-balance` sets `text-wrap: balance`. #336's real defect was an\n // invalid, misspelled utility name that emitted zero CSS (NOT a\n // tailwind-merge conflict) — this is the real, registered class.\n className={cn(\n \"text-sm text-balance text-muted-foreground\",\n measure && \"max-w-prose\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const CardAction = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CardAction({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"col-start-2 row-span-2 row-start-1 self-start justify-self-end\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CardContent({ className, ...props }, ref) {\n return <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />;\n },\n);\n\nexport const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CardFooter({ className, ...props }, ref) {\n return <div ref={ref} className={cn(\"flex items-center p-6 pt-0\", className)} {...props} />;\n },\n);\n","\"use client\";\n\nimport { forwardRef, useCallback, useState, type FocusEvent, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { NumberInput, type NumberInputProps } from \"../number-input\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface BoundedNumberProps extends NumberInputProps {\n /**\n * Content shown in place of the value when the field is empty (`null`) and\n * not focused — e.g. \"No limit\" for a capped setting with no cap set.\n * Defaults to \"No limit\".\n */\n emptyLabel?: ReactNode;\n}\n\n/**\n * BoundedNumber — a `NumberInput` preset for a bounded numeric where \"empty\"\n * has a semantic meaning (\"No limit\") instead of reading as a blank box.\n *\n * Written reuse verdict (see #373): this wraps `NumberInput` rather than\n * reimplementing anything. `NumberInput` already does everything the value\n * needs — blur-only clamping (`clamp`, default true) and `null` as a real,\n * distinct empty state (`commit(null)` on empty blur). The only missing\n * behaviour is rendering that empty state as a meaningful label instead of a\n * blank input, which is exactly what this preset adds: an absolutely\n * positioned, `pointer-events-none` overlay shown only while the value is\n * `null` AND the field is not focused, so the underlying input stays fully\n * clickable/typable and still round-trips to `null` on an empty blur.\n */\nexport const BoundedNumber = forwardRef<HTMLDivElement, BoundedNumberProps>(function BoundedNumber(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n emptyLabel,\n onFocus,\n onBlur,\n className,\n ...props\n },\n ref,\n) {\n const { t } = useLocale();\n const resolvedEmptyLabel = emptyLabel ?? t(\"ui.boundedNumber.emptyLabel\");\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<number | null>(\n defaultValue !== undefined ? defaultValue : null,\n );\n const [focused, setFocused] = useState(false);\n const currentValue = isControlled ? valueProp : internalValue;\n\n const handleValueChange = useCallback(\n (next: number | null) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus],\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n setFocused(false);\n onBlur?.(event);\n },\n [onBlur],\n );\n\n const showEmptyLabel = currentValue == null && !focused;\n\n return (\n // `className` lands on the ROOT (the positioning context), not on the\n // inner `NumberInput`: a width utility on the inner control would resolve\n // against a shrink-to-fit wrapper and silently do nothing, so\n // `className=\"w-full\"` could never widen the field. `w-36` here is\n // `NumberInput`'s own default width, re-declared so `cn()` lets the caller\n // override it; the input then simply fills the root.\n <div className={cn(\"relative inline-block w-36\", className)} data-slot=\"bounded-number\">\n <NumberInput\n ref={ref}\n value={currentValue}\n onValueChange={handleValueChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n className=\"w-full\"\n {...props}\n />\n {showEmptyLabel && (\n <span\n aria-hidden=\"true\"\n data-slot=\"bounded-number-empty-label\"\n className={cn(\n \"pointer-events-none absolute inset-0 flex items-center justify-center\",\n \"text-body text-muted-foreground\",\n )}\n >\n {resolvedEmptyLabel}\n </span>\n )}\n </div>\n );\n});\n","// a2ui.exposed: yes\nimport { forwardRef, useCallback, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Minus, Plus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { InputGroup, InputGroupButton, InputGroupInput } from \"../input-group\";\n\nexport interface NumberInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** Controlled value. Pass `null` to represent an empty state. */\n value?: number | null;\n /** Uncontrolled default value. */\n defaultValue?: number | null;\n /** Called when the numeric value changes. */\n onValueChange?: (value: number | null) => void;\n /** Minimum allowed value. */\n min?: number;\n /** Maximum allowed value. */\n max?: number;\n /** Step increment/decrement amount (default 1). */\n step?: number;\n /**\n * When true (default), the value is clamped to [min, max] on blur.\n * Clamping does NOT happen per-keystroke — only on blur.\n */\n clamp?: boolean;\n /** Intl.NumberFormat options used to format the displayed value. */\n formatOptions?: Intl.NumberFormatOptions;\n /** Placeholder text for the underlying input. */\n placeholder?: string;\n /** Whether the input is disabled. */\n disabled?: boolean;\n /** Whether the input is read-only. */\n readOnly?: boolean;\n /** Name attribute forwarded to the underlying <input>. */\n name?: string;\n /** id attribute forwarded to the underlying <input>. */\n id?: string;\n /** aria-label forwarded to the underlying <input>. */\n \"aria-label\"?: string;\n /** aria-labelledby forwarded to the underlying <input>. */\n \"aria-labelledby\"?: string;\n /** aria-describedby forwarded to the underlying <input>. */\n \"aria-describedby\"?: string;\n /** aria-invalid forwarded to the underlying <input>. */\n \"aria-invalid\"?: boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\";\n /** aria-required forwarded to the underlying <input>. */\n \"aria-required\"?: boolean | \"true\" | \"false\";\n}\n\nfunction clampValue(val: number, min?: number, max?: number): number {\n let result = val;\n if (min !== undefined) result = Math.max(min, result);\n if (max !== undefined) result = Math.min(max, result);\n return result;\n}\n\nfunction formatNum(value: number, formatOptions?: Intl.NumberFormatOptions): string {\n if (formatOptions) {\n return new Intl.NumberFormat(undefined, formatOptions).format(value);\n }\n return String(value);\n}\n\n/**\n * NumberInput — a numeric stepper that composes InputGroup + two step buttons.\n *\n * Controlled via `value`/`onValueChange`; uncontrolled via `defaultValue`.\n * Keyboard ↑/↓ = ±step; Shift+↑/↓ = ±step×10. Clamps on blur (not per keystroke).\n */\nexport const NumberInput = forwardRef<HTMLDivElement, NumberInputProps>(function NumberInput(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n min,\n max,\n step = 1,\n clamp = true,\n formatOptions,\n placeholder,\n disabled,\n readOnly,\n name,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n \"aria-describedby\": ariaDescribedby,\n \"aria-invalid\": ariaInvalid,\n \"aria-required\": ariaRequired,\n className,\n ...props\n },\n ref,\n) {\n const isControlled = valueProp !== undefined;\n\n const [internalValue, setInternalValue] = useState<number | null>(\n defaultValue !== undefined ? defaultValue : null,\n );\n const [inputText, setInputText] = useState<string>(() => {\n const initial = isControlled ? valueProp : defaultValue;\n return initial != null ? formatNum(initial, formatOptions) : \"\";\n });\n // Track whether the user is actively editing to avoid overwriting their input\n const isEditing = useRef(false);\n\n const currentValue = isControlled ? valueProp : internalValue;\n\n const commit = useCallback(\n (next: number | null) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const applyStep = useCallback(\n (delta: number) => {\n if (disabled || readOnly) return;\n const base = currentValue ?? 0;\n let next = base + delta;\n if (clamp) next = clampValue(next, min, max);\n setInputText(next != null ? formatNum(next, formatOptions) : \"\");\n commit(next);\n },\n [disabled, readOnly, currentValue, clamp, min, max, formatOptions, commit],\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n const multiplier = e.shiftKey ? 10 : 1;\n const delta = e.key === \"ArrowUp\" ? step * multiplier : -step * multiplier;\n applyStep(delta);\n }\n },\n [applyStep, step],\n );\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n isEditing.current = true;\n setInputText(e.target.value);\n }, []);\n\n const handleBlur = useCallback(() => {\n isEditing.current = false;\n const raw = inputText.trim();\n if (raw === \"\") {\n commit(null);\n return;\n }\n const parsed = parseFloat(raw);\n if (isNaN(parsed)) {\n // Revert to last known good value\n setInputText(currentValue != null ? formatNum(currentValue, formatOptions) : \"\");\n return;\n }\n const clamped = clamp ? clampValue(parsed, min, max) : parsed;\n setInputText(formatNum(clamped, formatOptions));\n commit(clamped);\n }, [inputText, currentValue, clamp, min, max, formatOptions, commit]);\n\n // Keep display text in sync with controlled value changes (only when not editing)\n const prevControlledValue = useRef(valueProp);\n if (isControlled && valueProp !== prevControlledValue.current && !isEditing.current) {\n prevControlledValue.current = valueProp;\n const nextText = valueProp != null ? formatNum(valueProp, formatOptions) : \"\";\n if (nextText !== inputText) setInputText(nextText);\n }\n\n const decrementDisabled =\n disabled || readOnly || (min !== undefined && (currentValue ?? 0) <= min);\n const incrementDisabled =\n disabled || readOnly || (max !== undefined && (currentValue ?? 0) >= max);\n\n return (\n <InputGroup ref={ref} className={cn(\"w-36\", className)} {...props}>\n <InputGroupButton\n aria-label=\"Decrease\"\n tabIndex={-1}\n disabled={decrementDisabled}\n onClick={() => applyStep(-step)}\n className=\"rounded-r-none\"\n >\n <Minus aria-hidden=\"true\" />\n </InputGroupButton>\n <InputGroupInput\n type=\"number\"\n id={id}\n name={name}\n value={inputText}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-invalid={ariaInvalid}\n aria-required={ariaRequired}\n className=\"text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\"\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n />\n <InputGroupButton\n aria-label=\"Increase\"\n tabIndex={-1}\n disabled={incrementDisabled}\n onClick={() => applyStep(step)}\n className=\"rounded-l-none\"\n >\n <Plus aria-hidden=\"true\" />\n </InputGroupButton>\n </InputGroup>\n );\n});\n","import { forwardRef, type ComponentProps } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Input } from \"../input\";\nimport { Textarea } from \"../textarea\";\n\nexport const inputGroupVariants = cva(\n cn(\n \"group/input-group relative flex w-full flex-wrap items-center rounded-md outline-none transition-[color,box-shadow] duration-fast ease-standard\",\n // Grow to fit a textarea even when it's nested (e.g. wrapped in a\n // `display:contents` body like PromptInputBody). `:has(>textarea)`\n // misses through that wrapper, so match any descendant textarea.\n \"h-9 has-[textarea]:h-auto\",\n \"has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-offset-1 has-[[data-slot=input-group-control]:focus-visible]:ring-offset-background\",\n \"has-[[data-slot=input-group-control][aria-invalid=true]]:ring-2 has-[[data-slot=input-group-control][aria-invalid=true]]:ring-destructive\",\n ),\n {\n variants: {\n variant: {\n // The form-field look: the strong `--input` boundary is the field's\n // sole structural cue, so it stays on the strong rung.\n outline: \"border border-input shadow-sm\",\n // The composer look (#194, research 08 §C.1/§D): a soft fill with the\n // focus-within ring carrying focus — NO hard border. Separation comes\n // from the fill (the chat footer already draws its own `border-t`).\n surface: \"bg-surface-muted\",\n // The double-card well (#254): a `bg-card` fill meant to nest inside\n // an ALREADY-tinted outer frame (e.g. `bg-surface-muted`) — the outer\n // tint is the redundant/complementary cue, so the well itself needs no\n // border either. NOT universally \"white\": `--card`'s lightness\n // relative to `--surface-muted` is theme-driven, same trade-off as the\n // `bg-surface-muted`-as-a-well note above — raised (lighter than the\n // outer frame) on light themes, recessed (darker) on dark and\n // a low-chroma palette. The well still reads as a distinct, legible tone in every\n // theme; only the light-themes' \"raised\" framing is theme-specific.\n card: \"bg-card\",\n },\n },\n defaultVariants: { variant: \"outline\" },\n },\n);\n\nexport type InputGroupProps = ComponentProps<\"div\"> & VariantProps<typeof inputGroupVariants>;\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n { className, variant, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"input-group\"\n className={cn(inputGroupVariants({ variant }), className)}\n {...props}\n />\n );\n});\n\nexport const inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\": \"order-first ps-3 has-[>button]:ms-[-0.45rem]\",\n \"inline-end\": \"order-last pe-3 has-[>button]:me-[-0.45rem]\",\n \"block-start\": \"order-first w-full justify-start px-3 pt-2.5\",\n \"block-end\": \"order-last w-full justify-start px-3 pt-0 pb-2.5\",\n },\n },\n defaultVariants: { align: \"inline-start\" },\n },\n);\n\nexport const InputGroupAddon = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>\n>(function InputGroupAddon({ className, align = \"inline-start\", ...props }, ref) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n {...props}\n />\n );\n});\n\nconst inputGroupButtonVariants = cva(\"flex items-center gap-2 text-sm shadow-none\", {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-sm px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5\",\n \"icon-xs\": \"size-6 rounded-sm p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: { size: \"xs\" },\n});\n\nexport const InputGroupButton = forwardRef<\n HTMLButtonElement,\n Omit<ComponentProps<typeof Button>, \"size\"> & {\n size?: \"xs\" | \"sm\" | \"icon-xs\" | \"icon-sm\";\n }\n>(function InputGroupButton(\n { className, type = \"button\", variant = \"ghost\", size = \"xs\", ...props },\n ref,\n) {\n return (\n <Button\n ref={ref}\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n );\n});\n\nexport const InputGroupText = forwardRef<HTMLSpanElement, ComponentProps<\"span\">>(\n function InputGroupText({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n className={cn(\n \"flex items-center gap-2 text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const InputGroupInput = forwardRef<HTMLInputElement, ComponentProps<typeof Input>>(\n function InputGroupInput({ className, ...props }, ref) {\n return (\n <Input\n ref={ref}\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const InputGroupTextarea = forwardRef<HTMLTextAreaElement, ComponentProps<typeof Textarea>>(\n function InputGroupTextarea({ className, ...props }, ref) {\n return (\n <Textarea\n ref={ref}\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-2.5 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import { forwardRef, type TextareaHTMLAttributes } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { className, ...props },\n ref,\n) {\n return (\n <textarea\n ref={ref}\n className={cn(\n \"flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-[color,background-color,border-color,box-shadow] duration-fast ease-standard\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n \"disabled:cursor-not-allowed disabled:opacity-50 disabled:border-border\",\n \"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive\",\n className,\n )}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentProps, type ReactNode } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Breadcrumb = forwardRef<HTMLElement, ComponentProps<\"nav\">>(\n function Breadcrumb(props, ref) {\n return <nav ref={ref} aria-label=\"breadcrumb\" {...props} />;\n },\n);\nexport const BreadcrumbList = forwardRef<HTMLOListElement, ComponentProps<\"ol\">>(\n function BreadcrumbList({ className, ...props }, ref) {\n return (\n <ol\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, ComponentProps<\"li\">>(\n function BreadcrumbItem({ className, ...props }, ref) {\n return (\n <li ref={ref} className={cn(\"inline-flex items-center gap-1.5\", className)} {...props} />\n );\n },\n);\nexport const BreadcrumbLink = forwardRef<\n HTMLAnchorElement,\n ComponentProps<\"a\"> & { asChild?: boolean }\n>(function BreadcrumbLink({ className, asChild, ...props }, ref) {\n const Comp = asChild ? Slot : \"a\";\n return (\n <Comp\n ref={ref}\n className={cn(\"transition-colors duration-fast hover:text-foreground\", className)}\n {...props}\n />\n );\n});\nexport const BreadcrumbPage = forwardRef<HTMLSpanElement, ComponentProps<\"span\">>(\n function BreadcrumbPage({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn(\"font-medium text-foreground\", className)}\n {...props}\n />\n );\n },\n);\nexport function BreadcrumbSeparator({ children, className, ...props }: ComponentProps<\"li\">) {\n return (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:size-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRight />}\n </li>\n );\n}\nexport function BreadcrumbEllipsis({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"size-4\" />\n <span className=\"sr-only\">More</span>\n </span>\n );\n}\nexport function BreadcrumbItems({ children }: { children: ReactNode }) {\n return <>{children}</>;\n}\n","import { forwardRef, type ComponentProps } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { Separator } from \"../separator\";\n\nexport const buttonGroupVariants = cva(\n \"flex w-fit items-stretch [&>*]:relative [&>*]:focus-within:z-10 has-[>[data-slot=button-group]]:gap-2\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-s-none [&>*:not(:first-child)]:border-s-0 [&>*:not(:last-child)]:rounded-e-none\",\n vertical:\n \"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none\",\n },\n },\n defaultVariants: { orientation: \"horizontal\" },\n },\n);\n\nexport const ButtonGroup = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>\n>(function ButtonGroup({ className, orientation = \"horizontal\", ...props }, ref) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n );\n});\n\nexport const ButtonGroupText = forwardRef<\n HTMLDivElement,\n ComponentProps<\"div\"> & { asChild?: boolean }\n>(function ButtonGroupText({ className, asChild = false, ...props }, ref) {\n const Comp = asChild ? Slot : \"div\";\n return (\n <Comp\n ref={ref}\n className={cn(\n \"flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ButtonGroupSeparator = forwardRef<HTMLDivElement, ComponentProps<typeof Separator>>(\n function ButtonGroupSeparator({ className, orientation = \"vertical\", ...props }, ref) {\n return (\n <Separator\n ref={ref}\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"relative !m-0 self-stretch bg-input data-[orientation=vertical]:h-auto\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n","import { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { DayPicker } from \"react-day-picker\";\nimport { cn } from \"../../lib/cn\";\nimport { buttonVariants } from \"../button\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\n/** Date picker calendar (react-day-picker v9), themed with brand tokens. */\nexport function Calendar({\n className,\n classNames,\n showOutsideDays = true,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"p-3\", className)}\n classNames={{\n // `months` is the positioning context for the nav overlay below: in\n // react-day-picker v9 the <nav> is a SIBLING of the month(s), not a child\n // of the caption, so the caption cannot anchor it.\n months: \"relative flex flex-col gap-2 sm:flex-row\",\n month: \"flex flex-col gap-4\",\n // `min-h-7` matches the nav button row so the two align; it can still grow\n // for a taller caption (e.g. `captionLayout=\"dropdown\"`), and `px-8` keeps\n // the label clear of the buttons overlaying either edge.\n month_caption: \"flex min-h-7 items-center justify-center px-8\",\n caption_label: \"text-sm font-medium\",\n // Overlays the caption row and pushes the buttons to either edge; the\n // buttons themselves stay in normal flow inside it.\n nav: \"absolute inset-x-0 top-0 flex h-7 items-center justify-between\",\n button_previous: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-transparent p-0 opacity-50 hover:opacity-100\",\n ),\n button_next: cn(\n buttonVariants({ variant: \"outline\" }),\n \"size-7 bg-transparent p-0 opacity-50 hover:opacity-100\",\n ),\n month_grid: \"w-full border-collapse space-y-1\",\n weekdays: \"flex\",\n weekday: \"w-8 rounded-md text-[0.8rem] font-normal text-muted-foreground\",\n week: \"mt-2 flex w-full\",\n day: \"relative size-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-e-md first:[&:has([aria-selected])]:rounded-s-md last:[&:has([aria-selected])]:rounded-e-md\",\n day_button: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"size-8 p-0 font-normal aria-selected:opacity-100\",\n ),\n range_start: \"day-range-start rounded-s-md\",\n range_end: \"day-range-end rounded-e-md\",\n range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n today: \"bg-accent text-accent-foreground\",\n outside: \"day-outside text-muted-foreground aria-selected:text-muted-foreground\",\n disabled: \"text-muted-foreground opacity-50\",\n hidden: \"invisible\",\n ...classNames,\n }}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight;\n return <Icon className=\"size-4\" data-rtl-flip />;\n },\n }}\n {...props}\n />\n );\n}\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useState,\n type ComponentProps,\n type HTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\nimport useEmblaCarousel, { type UseEmblaCarouselType } from \"embla-carousel-react\";\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype CarouselOptions = NonNullable<Parameters<typeof useEmblaCarousel>[0]>;\ntype CarouselPlugin = NonNullable<Parameters<typeof useEmblaCarousel>[1]>;\n\ninterface CarouselProps {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: \"horizontal\" | \"vertical\";\n setApi?: (api: CarouselApi) => void;\n}\n\ninterface CarouselContextValue extends CarouselProps {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: CarouselApi;\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n}\n\nconst CarouselContext = createContext<CarouselContextValue | null>(null);\n\nfunction useCarousel() {\n const ctx = useContext(CarouselContext);\n if (!ctx) throw new Error(\"useCarousel must be used within <Carousel />\");\n return ctx;\n}\n\n/**\n * Root carousel region. Carries `role=\"region\" aria-roledescription=\"carousel\"`\n * plus an `aria-label` — it defaults to `\"Carousel\"` so the region always has an\n * accessible name (issue #279), but **consumers should pass a specific\n * `aria-label`** (e.g. `\"Product photos\"`) describing what the carousel actually\n * shows, since AT users otherwise can't distinguish multiple carousels on a page.\n */\nexport const Carousel = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & CarouselProps>(\n function Carousel(\n {\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n // A carousel region MUST have an accessible name (WAI-ARIA APG) —\n // aria-roledescription changes the announcement, it does not name the\n // landmark. Default is overridable; pass a specific label (\"Product\n // photos\") when the carousel's purpose isn't generic. Issue #279.\n \"aria-label\": ariaLabel = \"Carousel\",\n ...props\n },\n ref,\n ) {\n const [carouselRef, api] = useEmblaCarousel(\n { ...opts, axis: orientation === \"horizontal\" ? \"x\" : \"y\" },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = useState(false);\n const [canScrollNext, setCanScrollNext] = useState(false);\n\n const onSelect = useCallback((a: CarouselApi) => {\n if (!a) return;\n setCanScrollPrev(a.canScrollPrev());\n setCanScrollNext(a.canScrollNext());\n }, []);\n\n const scrollPrev = useCallback(() => api?.scrollPrev(), [api]);\n const scrollNext = useCallback(() => api?.scrollNext(), [api]);\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n scrollPrev();\n } else if (e.key === \"ArrowRight\") {\n e.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n useEffect(() => {\n if (api && setApi) setApi(api);\n }, [api, setApi]);\n useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n return () => {\n api.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n opts,\n orientation,\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={onKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel}\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\n\nexport const CarouselContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CarouselContent({ className, ...props }, ref) {\n const { carouselRef, orientation } = useCarousel();\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n \"flex\",\n orientation === \"horizontal\" ? \"-ms-4\" : \"-mt-4 flex-col\",\n className,\n )}\n {...props}\n />\n </div>\n );\n },\n);\n\nexport const CarouselItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function CarouselItem({ className, ...props }, ref) {\n const { orientation } = useCarousel();\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"ps-4\" : \"pt-4\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport function CarouselPrevious({ className, ...props }: ComponentProps<typeof Button>) {\n const { scrollPrev, canScrollPrev, orientation } = useCarousel();\n return (\n <Button\n variant=\"outline\"\n size=\"icon\"\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n aria-label=\"Previous slide\"\n className={cn(\n \"absolute size-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"-start-12 top-1/2 -translate-y-1/2\"\n : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n {...props}\n >\n <ArrowLeft className=\"size-4\" data-rtl-flip />\n </Button>\n );\n}\n\nexport function CarouselNext({ className, ...props }: ComponentProps<typeof Button>) {\n const { scrollNext, canScrollNext, orientation } = useCarousel();\n return (\n <Button\n variant=\"outline\"\n size=\"icon\"\n disabled={!canScrollNext}\n onClick={scrollNext}\n aria-label=\"Next slide\"\n className={cn(\n \"absolute size-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"-end-12 top-1/2 -translate-y-1/2\"\n : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n {...props}\n >\n <ArrowRight className=\"size-4\" data-rtl-flip />\n </Button>\n );\n}\n\nexport type { CarouselApi };\n","\"use client\";\n\n/**\n * ChangeReview — AI-edit trust gate.\n *\n * When an agent proposes edits, the human reviews them hunk-by-hunk and accepts\n * or rejects each before they apply. Feeling: calm, scannable, trustworthy —\n * \"I can see exactly what changed, who proposed it, and nothing lands without\n * my say-so.\"\n *\n * Design references: GitHub PR file-review (per-hunk viewed/comment),\n * Cursor/Copilot \"review changes\" panel, Graphite/Linear review UIs.\n *\n * State grid: empty (no hunks → StatePanel), single hunk, mixed, all-approved,\n * all-rejected, very long hunk content. Approval state is signalled with color\n * AND icon/label (colorblind + high-decoration/high-contrast safe).\n *\n * Compound structure (named exports, the Card/CardHeader convention — NOT dot\n * notation). Use the `ChangeReview` root for the default layout, or compose the\n * parts for a custom one:\n * <ChangeReviewProvider> — lifted state (approved set + actions interface)\n * <ChangeReviewHeader> — count summary + Approve all / Reject all\n * <ChangeReviewProvenance> — who/what proposed (quiet attribution)\n * <ChangeReviewList> — the hunk list\n * <ChangeReviewHunk> — per-hunk row (title, rails, before/after, toggle)\n */\n\nimport {\n createContext,\n forwardRef,\n use,\n useCallback,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Check, X, CheckCheck, User, Bot, Clock } from \"lucide-react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button/button\";\nimport { Badge } from \"../badge/badge\";\nimport { StatePanel } from \"../state-panel/state-panel\";\n\n// ─── Public types ─────────────────────────────────────────────────────────────\n\n/** Who / what proposed the change set (presentational only; never fetches). */\nexport interface ChangeProvenance {\n /** Display name of the person or agent author. */\n author?: string;\n /** Model or tool identifier (e.g. \"claude-sonnet-4-6\"). */\n model?: string;\n /** ISO-8601 or human-readable timestamp. */\n timestamp?: string;\n /** Free-form note, e.g. commit hash or run ID. */\n note?: string;\n}\n\n/** Status of a single change hunk. Drives the accent-rail colour and icon. */\nexport type ChangeHunkStatus = \"added\" | \"removed\" | \"modified\";\n\n/** A single proposed change in the review set. */\nexport interface ChangeHunk {\n /** Unique identifier for this hunk (used in the approved set). */\n id: string;\n /** Short title shown in the hunk header (e.g. filename or section label). */\n title?: string;\n /** The content before the proposed edit. */\n before?: ReactNode;\n /** The content after the proposed edit (the proposal). */\n after?: ReactNode;\n /** Change type — drives accent rail + icon. @default \"modified\" */\n status?: ChangeHunkStatus;\n /** Per-hunk provenance override (overrides the review-level provenance). */\n provenance?: ChangeProvenance;\n}\n\n/** State surface exposed by the ChangeReview context. */\nexport interface ChangeReviewState {\n /** Set of currently-approved hunk IDs. */\n approved: ReadonlySet<string>;\n /** Total number of hunks. */\n totalCount: number;\n /** Number of approved hunks. */\n approvedCount: number;\n /** True when every hunk is approved. */\n allApproved: boolean;\n /** True when no hunk is approved. */\n noneApproved: boolean;\n}\n\n/** Actions exposed by the ChangeReview context. */\nexport interface ChangeReviewActions {\n /** Toggle the approval state of a single hunk. */\n toggle: (id: string, next: boolean) => void;\n /** Approve all hunks. */\n approveAll: () => void;\n /** Reject (un-approve) all hunks. */\n rejectAll: () => void;\n}\n\n// ─── Context ──────────────────────────────────────────────────────────────────\n\ninterface ChangeReviewContextValue {\n state: ChangeReviewState;\n actions: ChangeReviewActions;\n hunks: ChangeHunk[];\n headingId: string;\n}\n\nconst ChangeReviewContext = createContext<ChangeReviewContextValue | null>(null);\n\nfunction useChangeReview(): ChangeReviewContextValue {\n const ctx = use(ChangeReviewContext);\n if (!ctx) {\n throw new Error(\"ChangeReview sub-components must be rendered inside ChangeReview.Provider\");\n }\n return ctx;\n}\n\n// ─── Variants ─────────────────────────────────────────────────────────────────\n\n/**\n * Hunk-status accent rail — the separation grammar's accent-rail channel: ONE\n * focal gesture (the status rail) on a neutral card ground (`bg-card` + the\n * subtle, redundant-exempt `border-border` hairline). NO colored wash and NO\n * redundant colored border — the slop the \"AI card\" look is built from. Status\n * reads from the rail + the header icon + the StatusBadge (never color alone).\n * Approval is signalled by the StatusBadge + the filled toggle (no ring wash).\n */\nexport const hunkVariants = cva(\n [\n \"relative rounded-md border border-border bg-card text-card-foreground\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n ],\n {\n variants: {\n status: {\n added: \"border-s-4 border-s-success\",\n removed: \"border-s-4 border-s-destructive\",\n modified: \"border-s-4 border-s-info\",\n },\n },\n defaultVariants: { status: \"modified\" },\n },\n);\n\n// ─── Provider ─────────────────────────────────────────────────────────────────\n\nexport interface ChangeReviewProviderProps {\n hunks: ChangeHunk[];\n /**\n * Controlled approved set. Pass `Set<string>` or a string array.\n * When provided, the component is controlled and `onToggle` / `onApproveAll` /\n * `onRejectAll` are the only way to update the state.\n */\n approved?: Set<string> | string[];\n onToggle?: (id: string, next: boolean) => void;\n onApproveAll?: () => void;\n onRejectAll?: () => void;\n children: ReactNode;\n}\n\n/**\n * Lifts the approval state. Can be controlled (pass `approved`) or uncontrolled.\n * Derive `isControlled = approved !== undefined`.\n */\nexport function ChangeReviewProvider({\n hunks,\n approved: approvedProp,\n onToggle,\n onApproveAll,\n onRejectAll,\n children,\n}: ChangeReviewProviderProps) {\n const headingId = useId();\n\n const isControlled = approvedProp !== undefined;\n\n // Uncontrolled internal state.\n const [internalApproved, setInternalApproved] = useState<Set<string>>(() => new Set());\n\n const resolvedApproved: ReadonlySet<string> = isControlled\n ? approvedProp instanceof Set\n ? approvedProp\n : new Set(approvedProp)\n : internalApproved;\n\n const hunkIds = useMemo(() => hunks.map((h) => h.id), [hunks]);\n\n const toggle = useCallback(\n (id: string, next: boolean) => {\n onToggle?.(id, next);\n if (!isControlled) {\n setInternalApproved((prev) => {\n const next_ = new Set(prev);\n if (next) next_.add(id);\n else next_.delete(id);\n return next_;\n });\n }\n },\n [isControlled, onToggle],\n );\n\n const approveAll = useCallback(() => {\n onApproveAll?.();\n if (!isControlled) {\n setInternalApproved(new Set(hunkIds));\n }\n }, [isControlled, hunkIds, onApproveAll]);\n\n const rejectAll = useCallback(() => {\n onRejectAll?.();\n if (!isControlled) {\n setInternalApproved(new Set());\n }\n }, [isControlled, onRejectAll]);\n\n const approvedCount = hunkIds.filter((id) => resolvedApproved.has(id)).length;\n const totalCount = hunkIds.length;\n\n const state: ChangeReviewState = {\n approved: resolvedApproved,\n totalCount,\n approvedCount,\n allApproved: totalCount > 0 && approvedCount === totalCount,\n noneApproved: approvedCount === 0,\n };\n\n const actions: ChangeReviewActions = { toggle, approveAll, rejectAll };\n\n const value = useMemo(\n () => ({ state, actions, hunks, headingId }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state.approved, state.totalCount, state.approvedCount, hunks, headingId],\n );\n\n return <ChangeReviewContext.Provider value={value}>{children}</ChangeReviewContext.Provider>;\n}\n\n// ─── Header ───────────────────────────────────────────────────────────────────\n\nexport type ChangeReviewHeaderProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * Count summary (\"3 of 5 approved\") + Approve all / Reject all bulk actions.\n * `aria-controls` is intentionally omitted — screen readers reach the list\n * naturally in DOM order.\n */\nexport const ChangeReviewHeader = forwardRef<HTMLDivElement, ChangeReviewHeaderProps>(\n function ChangeReviewHeader({ className, ...props }, ref) {\n const { state, actions, headingId } = useChangeReview();\n const { approvedCount, totalCount, allApproved, noneApproved } = state;\n\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap items-center justify-between gap-3 pb-3\", className)}\n {...props}\n >\n <div className=\"flex items-center gap-2 min-w-0\">\n <span id={headingId} className=\"text-subtitle font-semibold text-foreground truncate\">\n Review changes\n </span>\n <Badge variant={allApproved ? \"success\" : approvedCount > 0 ? \"info\" : \"secondary\"}>\n {approvedCount} of {totalCount} approved\n </Badge>\n </div>\n\n {totalCount > 0 && (\n <div className=\"flex items-center gap-2 shrink-0\">\n <Button\n size=\"sm\"\n variant=\"outline-subtle\"\n disabled={noneApproved}\n onClick={actions.rejectAll}\n aria-label=\"Reject all changes\"\n >\n <X aria-hidden=\"true\" />\n Reject all\n </Button>\n <Button\n size=\"sm\"\n variant={allApproved ? \"secondary\" : \"default\"}\n disabled={allApproved}\n onClick={actions.approveAll}\n aria-label=\"Approve all changes\"\n >\n <CheckCheck aria-hidden=\"true\" />\n Approve all\n </Button>\n </div>\n )}\n </div>\n );\n },\n);\n\n// ─── Provenance ───────────────────────────────────────────────────────────────\n\nexport interface ChangeReviewProvenanceProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Structured provenance object OR any ReactNode for custom rendering.\n * When a `ChangeProvenance` object is passed, a default attribution line\n * is rendered. Pass a ReactNode for full control.\n */\n provenance: ReactNode | ChangeProvenance;\n}\n\nfunction isChangeProvenance(v: unknown): v is ChangeProvenance {\n return (\n typeof v === \"object\" &&\n v !== null &&\n !Array.isArray(v) &&\n (\"author\" in v || \"model\" in v || \"timestamp\" in v || \"note\" in v)\n );\n}\n\n/**\n * Quiet attribution line showing who/what proposed the change set.\n * Uses `text-muted-foreground` and small typography — it should not compete\n * with the hunks themselves.\n */\nexport const ChangeReviewProvenance = forwardRef<HTMLDivElement, ChangeReviewProvenanceProps>(\n function ChangeReviewProvenance({ provenance, className, ...props }, ref) {\n if (isChangeProvenance(provenance)) {\n const { author, model, timestamp, note } = provenance;\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-x-3 gap-y-1 text-caption text-muted-foreground pb-3\",\n className,\n )}\n aria-label=\"Change provenance\"\n {...props}\n >\n {author && (\n <span className=\"flex items-center gap-1\">\n <User aria-hidden=\"true\" className=\"size-3\" />\n <span>{author}</span>\n </span>\n )}\n {model && (\n <span className=\"flex items-center gap-1\">\n <Bot aria-hidden=\"true\" className=\"size-3\" />\n <span translate=\"no\">{model}</span>\n </span>\n )}\n {timestamp && (\n <span className=\"flex items-center gap-1\">\n <Clock aria-hidden=\"true\" className=\"size-3\" />\n <time>{timestamp}</time>\n </span>\n )}\n {note && <span className=\"text-muted-foreground/70\">{note}</span>}\n </div>\n );\n }\n\n // Custom ReactNode provenance\n return (\n <div\n ref={ref}\n className={cn(\"pb-3 text-caption text-muted-foreground\", className)}\n aria-label=\"Change provenance\"\n {...props}\n >\n {provenance as ReactNode}\n </div>\n );\n },\n);\n\n// ─── List ─────────────────────────────────────────────────────────────────────\n\nexport type ChangeReviewListProps = HTMLAttributes<HTMLOListElement>;\n\n/**\n * Ordered list of change hunks. Uses `<ol>` so AT users can navigate by\n * item number (\"item 2 of 5\"). Renders a StatePanel when the list is empty.\n */\nexport const ChangeReviewList = forwardRef<HTMLOListElement, ChangeReviewListProps>(\n function ChangeReviewList({ className, children, ...props }, ref) {\n const { hunks, headingId } = useChangeReview();\n\n if (hunks.length === 0) {\n return (\n <StatePanel\n kind=\"empty\"\n title=\"No changes to review\"\n description=\"When an agent proposes edits, they'll appear here for your approval.\"\n className=\"my-2\"\n />\n );\n }\n\n return (\n <ol\n ref={ref}\n aria-labelledby={headingId}\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n >\n {children}\n </ol>\n );\n },\n);\n\n// ─── Hunk ─────────────────────────────────────────────────────────────────────\n\nconst HUNK_STATUS_ICONS: Record<ChangeHunkStatus, ReactNode> = {\n added: (\n <span className=\"text-success-text font-bold text-meta\" aria-hidden=\"true\">\n +\n </span>\n ),\n removed: (\n <span className=\"text-destructive font-bold text-meta\" aria-hidden=\"true\">\n −\n </span>\n ),\n modified: (\n <span className=\"text-info-text font-bold text-meta\" aria-hidden=\"true\">\n ~\n </span>\n ),\n};\n\nconst HUNK_STATUS_LABELS: Record<ChangeHunkStatus, string> = {\n added: \"added\",\n removed: \"removed\",\n modified: \"modified\",\n};\n\nexport interface ChangeReviewHunkProps\n extends\n Omit<HTMLAttributes<HTMLLIElement>, \"children\">,\n Omit<VariantProps<typeof hunkVariants>, \"approved\"> {\n hunk: ChangeHunk;\n /**\n * Override the default before/after layout. Receives the hunk data and\n * current approval state. Return `null` to suppress the default content area.\n */\n renderHunk?: (hunk: ChangeHunk, state: { approved: boolean }) => ReactNode;\n}\n\n/**\n * A single change hunk row.\n *\n * Approval state is signalled with TWO non-color cues:\n * - icon: Check (approved) vs plain toggle (pending)\n * - label: \"Approved\" badge vs \"Approve\" button text\n * This ensures the state is clear in all three themes including the low-chroma\n * monochrome surfaces (colorblind-safe).\n */\nexport const ChangeReviewHunk = forwardRef<HTMLLIElement, ChangeReviewHunkProps>(\n function ChangeReviewHunk({ hunk, renderHunk, className, ...props }, ref) {\n const { state, actions } = useChangeReview();\n const { id, title, before, after, status = \"modified\", provenance } = hunk;\n const approved = state.approved.has(id);\n\n const statusLabel = HUNK_STATUS_LABELS[status];\n const toggleLabel = approved ? `Reject hunk: ${title ?? id}` : `Approve hunk: ${title ?? id}`;\n\n // Quiet, no-fill diff: before = struck muted text with a \"−\" marker, after =\n // foreground text with a \"+\" marker — separated by space, NOT colored\n // fill+border boxes. The hunk's status rail (added/removed/modified) carries\n // the polarity; the markers + tone are the second, non-color cue.\n const defaultContent = renderHunk\n ? renderHunk(hunk, { approved })\n : (before !== undefined || after !== undefined) && (\n <div className=\"flex flex-col gap-1.5 text-body\">\n {before !== undefined && (\n <div className=\"flex gap-2\">\n <span\n aria-hidden=\"true\"\n className=\"shrink-0 select-none font-mono text-muted-foreground\"\n >\n −\n </span>\n <span className=\"sr-only\">Before: </span>\n <div className=\"min-w-0 break-words text-muted-foreground line-through decoration-muted-foreground/30\">\n {before}\n </div>\n </div>\n )}\n {after !== undefined && (\n <div className=\"flex gap-2\">\n <span aria-hidden=\"true\" className=\"shrink-0 select-none font-mono text-foreground\">\n +\n </span>\n <span className=\"sr-only\">After: </span>\n <div className=\"min-w-0 break-words text-foreground\">{after}</div>\n </div>\n )}\n </div>\n );\n\n return (\n <li\n ref={ref}\n data-hunk-id={id}\n data-approved={approved}\n className={cn(hunkVariants({ status }), \"flex flex-col gap-3 p-4\", className)}\n {...props}\n >\n {/* Hunk header: status icon + title + per-hunk provenance + approve toggle */}\n <div className=\"flex items-start justify-between gap-3 min-w-0\">\n <div className=\"flex items-center gap-2 min-w-0\">\n {/* Status indicator: NON-color cue via symbol + color together */}\n <span\n aria-label={`Change type: ${statusLabel}`}\n className=\"shrink-0 inline-flex items-center justify-center size-5\"\n >\n {HUNK_STATUS_ICONS[status]}\n </span>\n\n <span className=\"text-body font-medium text-foreground truncate\">{title ?? id}</span>\n\n {/* Per-hunk provenance (quiet, only when it differs from review-level) */}\n {provenance?.author && (\n <span className=\"text-caption text-muted-foreground hidden sm:inline truncate\">\n {provenance.author}\n </span>\n )}\n </div>\n\n {/* Approval toggle — must be a real button with accessible name */}\n <Button\n size=\"icon-sm\"\n variant={approved ? \"default\" : \"outline-subtle\"}\n aria-label={toggleLabel}\n aria-pressed={approved}\n onClick={() => actions.toggle(id, !approved)}\n className={cn(\n \"shrink-0 transition-colors duration-fast motion-reduce:transition-none\",\n approved && \"bg-primary text-primary-foreground\",\n )}\n >\n {approved ? (\n <Check aria-hidden=\"true\" className=\"size-4\" />\n ) : (\n <Check aria-hidden=\"true\" className=\"size-4 opacity-40\" />\n )}\n </Button>\n </div>\n\n {/* Visual approved badge — second non-color cue (icon alone is not enough) */}\n {approved && (\n <div className=\"flex items-center gap-1.5\">\n <Badge variant=\"success\" className=\"animate-in fade-in-0 duration-fast ease-entrance\">\n <Check aria-hidden=\"true\" className=\"size-3\" />\n Approved\n </Badge>\n </div>\n )}\n\n {/* Content area: before / after or custom renderHunk */}\n {defaultContent && <div>{defaultContent}</div>}\n </li>\n );\n },\n);\n\n// ─── Root (convenience wrapper) ───────────────────────────────────────────────\n\nexport interface ChangeReviewProps\n // Omit \"children\" and \"onToggle\" from div attrs — \"onToggle\" is a React 19\n // native ToggleEvent handler that conflicts with our review onToggle prop.\n extends Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"onToggle\"> {\n /** The proposed changes to review. */\n hunks: ChangeHunk[];\n /**\n * Controlled approved set. Pass `Set<string>` or a string array.\n * When omitted the component manages approval state internally (uncontrolled).\n */\n approved?: Set<string> | string[];\n /** Called when the user toggles a single hunk's approval state. */\n onToggle?: (id: string, next: boolean) => void;\n /** Called when the user clicks \"Approve all\". */\n onApproveAll?: () => void;\n /** Called when the user clicks \"Reject all\". */\n onRejectAll?: () => void;\n /**\n * Provenance to show above the hunk list. Accepts a `ChangeProvenance`\n * object (renders default attribution) or any ReactNode.\n */\n provenance?: ReactNode | ChangeProvenance;\n /**\n * Override the per-hunk body renderer (passed through to each `ChangeReviewHunk`).\n */\n renderHunk?: ChangeReviewHunkProps[\"renderHunk\"];\n}\n\n/**\n * Convenience composition that wires Provider → Header → Provenance → List → Hunks.\n * For custom layouts compose the parts manually via `ChangeReview.Provider`,\n * `ChangeReview.Header`, etc.\n */\nexport const ChangeReview = forwardRef<HTMLDivElement, ChangeReviewProps>(function ChangeReview(\n {\n hunks,\n approved,\n onToggle,\n onApproveAll,\n onRejectAll,\n provenance,\n renderHunk,\n className,\n ...props\n },\n ref,\n) {\n return (\n <ChangeReviewProvider\n hunks={hunks}\n approved={approved}\n onToggle={onToggle}\n onApproveAll={onApproveAll}\n onRejectAll={onRejectAll}\n >\n <div ref={ref} className={cn(\"flex flex-col w-full\", className)} {...props}>\n <ChangeReviewHeader />\n {provenance != null && <ChangeReviewProvenance provenance={provenance} />}\n <ChangeReviewList>\n {hunks.map((hunk) => (\n <ChangeReviewHunk key={hunk.id} hunk={hunk} renderHunk={renderHunk} />\n ))}\n </ChangeReviewList>\n </div>\n </ChangeReviewProvider>\n );\n});\n","import { type ReactNode } from \"react\";\nimport { CircleAlert } from \"lucide-react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n// ─── Variants ────────────────────────────────────────────────────────────────\n\nexport const statePanelVariants = cva(\n [\n \"flex flex-col items-center justify-center gap-3 rounded-xl px-6 py-12 text-center\",\n \"animate-in fade-in slide-in-from-bottom-2 duration-base ease-entrance\",\n ],\n {\n variants: {\n kind: {\n empty: \"border border-dashed bg-surface\",\n // error: primary cue is color (destructive bg/border); structural cue\n // (border-s-4 + border-border-strong top strip) survives monochrome /\n // a monochrome palette so the panel is distinguishable from empty/loading even\n // without hue. border-border-strong satisfies WCAG 1.4.11 non-text contrast.\n error: \"border border-destructive/30 bg-destructive/5 border-s-4 border-s-border-strong\",\n loading: \"\",\n },\n },\n defaultVariants: { kind: \"empty\" },\n },\n);\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface StatePanelProps extends VariantProps<typeof statePanelVariants> {\n /**\n * The visual/semantic kind of state.\n * - `\"empty\"` — neutral \"nothing here yet\" (dashed border, surface bg).\n * - `\"error\"` — recoverable failure (destructive border/bg, alert role).\n * - `\"loading\"` — in-progress (spinner, status/live-region role).\n */\n kind?: \"empty\" | \"error\" | \"loading\";\n /** Heading text. */\n title?: ReactNode;\n /** Supporting description below the title. */\n description?: ReactNode;\n /**\n * Icon or illustration shown above the title.\n * For `\"error\"` defaults to a built-in warning triangle.\n * For `\"loading\"` defaults to an animated spinner.\n */\n icon?: ReactNode;\n /** Accessible label for the spinner in loading state. @default \"Loading…\" */\n loadingLabel?: string;\n /** Spinner size (loading kind only). @default \"md\" */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Primary / secondary action buttons. */\n actions?: ReactNode;\n className?: string;\n}\n\n// ─── Default icons ────────────────────────────────────────────────────────────\n\nconst sizeMap: Record<string, string> = { sm: \"size-4\", md: \"size-6\", lg: \"size-8\" };\n\nfunction DefaultSpinner({ size = \"md\" }: { size?: \"sm\" | \"md\" | \"lg\" }) {\n return (\n <svg\n className={cn(\"animate-spin text-muted-foreground\", sizeMap[size])}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4Z\" />\n </svg>\n );\n}\n\nfunction DefaultErrorIcon() {\n // Use the Lucide CircleAlert icon (solid ring + exclamation) for the error state.\n // Rendered at size-10 so it reads clearly even at small panel sizes.\n return <CircleAlert className=\"size-10\" aria-hidden=\"true\" />;\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/**\n * Unified state panel covering empty, error, and loading states.\n * Replaces the three separate `EmptyState` / `ErrorState` / `LoadingState` components\n * while keeping those as back-compat thin wrappers.\n */\nexport function StatePanel({\n kind = \"empty\",\n title,\n description,\n icon,\n loadingLabel = \"Loading…\",\n size = \"md\",\n actions,\n className,\n}: StatePanelProps) {\n const isLoading = kind === \"loading\";\n const isError = kind === \"error\";\n\n // Role: loading → status + live region; error → alert; empty → (none needed).\n const roleProps = isLoading\n ? ({ role: \"status\", \"aria-live\": \"polite\" } as const)\n : isError\n ? ({ role: \"alert\" } as const)\n : {};\n\n // Default title / description fallbacks for error state (mirroring old ErrorState).\n const resolvedTitle = title ?? (isError ? \"Something went wrong\" : undefined);\n const resolvedDescription =\n description ?? (isError ? \"An unexpected error occurred. Please try again.\" : undefined);\n\n // Resolve displayed icon.\n let resolvedIcon: ReactNode;\n if (icon !== undefined) {\n resolvedIcon = icon;\n } else if (isLoading) {\n resolvedIcon = <DefaultSpinner size={size} />;\n } else if (isError) {\n resolvedIcon = <DefaultErrorIcon />;\n }\n\n return (\n <div data-kind={kind} className={cn(statePanelVariants({ kind }), className)} {...roleProps}>\n {/* Error eyebrow: \"Error\" label shown above the icon so the panel reads\n as an error structurally even in monochrome themes. The\n eyebrow uses text-destructive which resolves to a drawable\n foreground at high decoration — combined with the thick left border from\n statePanelVariants it gives two non-color structural cues. */}\n {isError && (\n <span className=\"text-xs font-semibold uppercase tracking-widest text-destructive\">\n Error\n </span>\n )}\n\n {resolvedIcon ? (\n // Error icon keeps text-destructive (not muted) so it stays visible even\n // when rendered at low contrast. In monochrome themes the icon shape\n // (CircleAlert) carries the cue; the color is supplemental.\n <div\n className={cn(\"[&_svg]:size-10\", isError ? \"text-destructive\" : \"text-muted-foreground\")}\n >\n {resolvedIcon}\n </div>\n ) : null}\n\n {(resolvedTitle || resolvedDescription) && (\n <div className=\"space-y-1\">\n {resolvedTitle && (\n <h3 className=\"text-sm font-semibold text-foreground\">{resolvedTitle}</h3>\n )}\n {resolvedDescription && (\n <p className=\"mx-auto max-w-sm text-sm text-muted-foreground\">{resolvedDescription}</p>\n )}\n </div>\n )}\n\n {/* Loading label (visually shown as supporting text; also the live-region content). */}\n {isLoading && loadingLabel && (\n <span className=\"text-sm text-muted-foreground\">{loadingLabel}</span>\n )}\n\n {actions ? <div className=\"mt-1 flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Checkbox = forwardRef<\n ElementRef<typeof CheckboxPrimitive.Root>,\n ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(function Checkbox({ className, ...props }, ref) {\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer size-4 shrink-0 rounded-sm border border-input shadow-sm transition-colors duration-fast ease-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground\",\n className,\n )}\n {...props}\n >\n {/*\n * `group` + `data-[state]` (Radix sets `data-state` on the Indicator\n * itself: \"checked\" | \"indeterminate\") swaps the glyph purely via CSS —\n * `Minus` for indeterminate, `Check` for checked — so the two states\n * are visually distinct instead of both drawing a checkmark (#348).\n */}\n <CheckboxPrimitive.Indicator className=\"group flex items-center justify-center text-current animate-in zoom-in-95 fade-in duration-fast ease-entrance\">\n <Check className=\"size-3.5 group-data-[state=indeterminate]:hidden\" />\n <Minus className=\"hidden size-3.5 group-data-[state=indeterminate]:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n});\n","// a2ui.exposed: yes\nimport {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\n// ---------------------------------------------------------------------------\n// Token vocabulary\n// ---------------------------------------------------------------------------\n\n/**\n * The semantic color token names that ColorPicker understands as \"safe\" values.\n * These map 1-to-1 with Tailwind utilities backed by CSS variables so they\n * remain theme-aware at runtime.\n */\nexport type ColorToken =\n | \"primary\"\n | \"secondary\"\n | \"destructive\"\n | \"success\"\n | \"warning\"\n | \"info\"\n | \"chart-1\"\n | \"chart-2\"\n | \"chart-3\"\n | \"chart-4\"\n | \"chart-5\"\n | \"chart-6\"\n | \"chart-7\"\n | \"chart-8\"\n | \"chart-9\"\n | \"chart-10\"\n | \"chart-11\"\n | \"chart-12\";\n\n/** All recognised token names in display order. */\nexport const COLOR_TOKENS: ColorToken[] = [\n \"chart-1\",\n \"chart-2\",\n \"chart-3\",\n \"chart-4\",\n \"chart-5\",\n \"chart-6\",\n \"chart-7\",\n \"chart-8\",\n \"chart-9\",\n \"chart-10\",\n \"chart-11\",\n \"chart-12\",\n \"primary\",\n \"secondary\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n];\n\n/**\n * Map a ColorToken → the Tailwind bg-* utility class that renders it.\n * These classes must be present as complete strings so Tailwind's JIT scanner\n * can detect them statically.\n */\nconst TOKEN_BG: Record<ColorToken, string> = {\n \"chart-1\": \"bg-chart-1\",\n \"chart-2\": \"bg-chart-2\",\n \"chart-3\": \"bg-chart-3\",\n \"chart-4\": \"bg-chart-4\",\n \"chart-5\": \"bg-chart-5\",\n \"chart-6\": \"bg-chart-6\",\n \"chart-7\": \"bg-chart-7\",\n \"chart-8\": \"bg-chart-8\",\n \"chart-9\": \"bg-chart-9\",\n \"chart-10\": \"bg-chart-10\",\n \"chart-11\": \"bg-chart-11\",\n \"chart-12\": \"bg-chart-12\",\n primary: \"bg-primary\",\n secondary: \"bg-secondary\",\n destructive: \"bg-destructive\",\n success: \"bg-success\",\n warning: \"bg-warning\",\n info: \"bg-info\",\n};\n\nfunction isColorToken(v: string): v is ColorToken {\n return Object.prototype.hasOwnProperty.call(TOKEN_BG, v);\n}\n\n// ---------------------------------------------------------------------------\n// Sub-component: individual swatch button\n// ---------------------------------------------------------------------------\n\ninterface SwatchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onSelect\"> {\n token: ColorToken;\n selected: boolean;\n onSelect: (token: ColorToken) => void;\n}\n\nconst Swatch = forwardRef<HTMLButtonElement, SwatchProps>(function Swatch(\n { token, selected, onSelect, className, ...props },\n ref,\n) {\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n aria-label={token}\n onClick={() => onSelect(token)}\n className={cn(\n \"size-7 rounded-md border-2 transition-[border-color,box-shadow] duration-fast\",\n TOKEN_BG[token],\n selected\n ? \"border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background\"\n : \"border-transparent hover:border-foreground/40\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n className,\n )}\n {...props}\n />\n );\n});\n\n// ---------------------------------------------------------------------------\n// Trigger swatch preview\n// ---------------------------------------------------------------------------\n\ninterface TriggerSwatchProps {\n value: string;\n className?: string;\n}\n\nfunction TriggerSwatch({ value, className }: TriggerSwatchProps) {\n const bgClass = isColorToken(value) ? TOKEN_BG[value] : undefined;\n return (\n <span\n className={cn(\"inline-block size-4 rounded-sm border border-border\", bgClass, className)}\n // When a raw hex value is supplied, use inline style — the only safe\n // place for a non-token color (isolated to this preview span).\n style={!bgClass ? { backgroundColor: value } : undefined}\n />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Main component\n// ---------------------------------------------------------------------------\n\nexport interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Controlled value — a `ColorToken` name (preferred, theme-aware) or a raw\n * hex string (only when `allowCustom` is true).\n */\n value?: ColorToken | string;\n /** Uncontrolled default value. */\n defaultValue?: ColorToken | string;\n /** Called when the selected color changes. */\n onValueChange?: (value: ColorToken | string) => void;\n /**\n * Swatches to display. Defaults to all chart + status tokens.\n * Accepts any subset of `ColorToken`.\n */\n swatches?: ColorToken[];\n /**\n * When true, a free-form hex input is shown below the swatches.\n * NOTE: custom hex values are NOT theme-aware — they will not adapt when\n * the active theme changes. Prefer token values for all theme-safe UI.\n */\n allowCustom?: boolean;\n /** aria-label for the trigger button. Defaults to \"Pick color\". */\n \"aria-label\"?: string;\n}\n\n/**\n * ColorPicker — a token-safe swatch picker backed by a Popover.\n *\n * The default value type is a `ColorToken` (a semantic CSS variable name),\n * not a hex string. This ensures the chosen color adapts to the active theme.\n * Raw hex is available opt-in via `allowCustom` — see the prop docs.\n *\n * Swatch group uses `role=\"radiogroup\"` with arrow-key navigation.\n */\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(function ColorPicker(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n swatches = COLOR_TOKENS,\n allowCustom = false,\n \"aria-label\": ariaLabel = \"Pick color\",\n className,\n ...props\n },\n ref,\n) {\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<ColorToken | string>(\n defaultValue ?? \"chart-1\",\n );\n const [customHex, setCustomHex] = useState(\"\");\n const [open, setOpen] = useState(false);\n\n const current = isControlled ? (valueProp ?? \"\") : internalValue;\n\n const commit = useCallback(\n (next: ColorToken | string) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const handleSwatchSelect = useCallback(\n (token: ColorToken) => {\n commit(token);\n setOpen(false);\n },\n [commit],\n );\n\n const handleCustomSubmit = useCallback(() => {\n const hex = customHex.trim();\n if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(hex)) {\n commit(hex);\n setOpen(false);\n }\n }, [customHex, commit]);\n\n // Arrow-key navigation within the radiogroup\n const groupRef = useRef<HTMLDivElement>(null);\n const handleGroupKeyDown = useCallback((e: KeyboardEvent<HTMLDivElement>) => {\n const buttons = groupRef.current\n ? Array.from(groupRef.current.querySelectorAll<HTMLButtonElement>(\"[role=radio]\"))\n : [];\n if (!buttons.length) return;\n const focused = document.activeElement as HTMLButtonElement;\n const idx = buttons.indexOf(focused);\n if (idx === -1) return;\n\n if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n buttons[(idx + 1) % buttons.length]?.focus();\n } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n buttons[(idx - 1 + buttons.length) % buttons.length]?.focus();\n }\n }, []);\n\n return (\n <div ref={ref} className={cn(\"inline-flex\", className)} {...props}>\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={cn(\n \"inline-flex items-center gap-2 rounded-md border border-input bg-background px-3 py-1.5 text-sm shadow-sm\",\n \"transition-[color,box-shadow] duration-fast\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n <TriggerSwatch value={current} />\n <span className=\"text-muted-foreground\">{current || \"None\"}</span>\n </button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-auto p-3\" align=\"start\">\n <div\n ref={groupRef}\n role=\"radiogroup\"\n aria-label=\"Color swatches\"\n className=\"flex flex-wrap gap-1.5\"\n onKeyDown={handleGroupKeyDown}\n >\n {swatches.map((token) => (\n <Swatch\n key={token}\n token={token}\n selected={current === token}\n onSelect={handleSwatchSelect}\n />\n ))}\n </div>\n\n {allowCustom && (\n <div className=\"mt-3 border-t border-border pt-3\">\n {/* Custom hex is NOT theme-aware — it will not adapt to theme changes. */}\n <p className=\"mb-1.5 text-xs text-muted-foreground\">\n Custom hex <span className=\"text-warning\">(not theme-aware)</span>\n </p>\n <div className=\"flex gap-2\">\n <input\n type=\"text\"\n value={customHex}\n placeholder=\"#3b82f6\"\n maxLength={7}\n spellCheck={false}\n aria-label=\"Custom hex color\"\n onChange={(e) => setCustomHex(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleCustomSubmit();\n }\n }}\n className={cn(\n \"h-8 w-28 rounded-md border border-input bg-background px-2 text-sm\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n \"placeholder:text-muted-foreground\",\n )}\n />\n <button\n type=\"button\"\n onClick={handleCustomSubmit}\n className={cn(\n \"h-8 rounded-md border border-input bg-background px-2 text-sm\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n )}\n >\n Apply\n </button>\n </div>\n </div>\n )}\n </PopoverContent>\n </Popover>\n </div>\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Popover = PopoverPrimitive.Root;\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\n\nexport const PopoverContent = forwardRef<\n ElementRef<typeof PopoverPrimitive.Content>,\n ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(function PopoverContent({ className, align = \"center\", sideOffset = 4, ...props }, ref) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md bg-popover p-4 text-popover-foreground shadow-ring-md outline-none\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n});\n","import { forwardRef, useState, type ComponentPropsWithoutRef } from \"react\";\nimport { defaultFilter } from \"cmdk\";\nimport { Check, ChevronsUpDown, Plus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { useLocale } from \"../locale-provider\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../command\";\n\nexport interface ComboboxOption {\n label: string;\n value: string;\n}\n\nexport interface ComboboxProps {\n options: ComboboxOption[];\n value?: string;\n onValueChange?: (value: string) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n /**\n * Message shown when the search yields no results. Defaults to \"No\n * results.\" — or, when `allowCustomValue` is set, a message that also\n * signals a custom value is acceptable.\n */\n emptyText?: string;\n className?: string;\n /** Disables the trigger and prevents the popover from opening. */\n disabled?: boolean;\n /**\n * When `true`, typed text that doesn't match any option becomes a\n * submittable value: a synthetic \"Use…\" suggestion is shown, and pressing\n * Enter with no listed option highlighted accepts the typed text via\n * `onValueChange`. Suggestions still filter as usual. Default `false`\n * (selection-only, unchanged behavior) — #359.\n */\n allowCustomValue?: boolean;\n /** `id` applied to the trigger button. */\n id?: string;\n /**\n * The trigger's accessible name always defaults to the SELECTED VALUE (or\n * the placeholder) — that tells AT what is currently chosen, never what the\n * control is FOR. Pass `aria-label`/`aria-labelledby` to also name the\n * control's purpose (e.g. \"Session switcher\").\n */\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /**\n * Escape hatch spread onto the trigger `Button` (after the named props\n * above, so it wins if both are set) for anything not covered by a named\n * prop — `data-*`, `name`, `data-testid`, etc. `role`/`aria-expanded` stay\n * component-owned and can't be passed here; disabling stays on the\n * top-level `disabled` prop so the popover-open guard below can't drift\n * out of sync with the trigger's actual disabled state.\n */\n triggerProps?: Omit<\n ComponentPropsWithoutRef<typeof Button>,\n \"role\" | \"aria-expanded\" | \"disabled\"\n > & {\n /** Arbitrary `data-*` attributes (test hooks, analytics, …). */\n [key: `data-${string}`]: string | number | boolean | undefined;\n };\n}\n\n/**\n * Sentinel `value` for the synthetic \"Use …\" row (`allowCustomValue`).\n *\n * It must NOT be the search text. cmdk scores every item against the search and\n * re-sorts the list by score, then auto-highlights the top one — so a row whose\n * `value` IS the search text scores a perfect 1 and outranks every real partial\n * match. Typing \"Prod\" against a \"Production\" option then highlighted\n * `Use \"Prod\"`, and Enter emitted the raw string instead of selecting the\n * option — the exact opposite of #359's \"Enter accepts the highlighted\n * suggestion, or the typed value if none is highlighted\".\n */\nconst CUSTOM_VALUE_ITEM = \"__brand-ui-combobox-custom-value__\";\n\n/**\n * Keeps the \"Use …\" row visible (score > 0) but always ranked LAST, behind\n * every real suggestion, so the top match stays highlighted and Enter still\n * selects it. When nothing else matches, the row is the only item and Enter\n * accepts the typed value — which is the behavior #359 asks for.\n */\nconst customValueFilter = (value: string, search: string, keywords?: string[]) =>\n value === CUSTOM_VALUE_ITEM ? Number.MIN_VALUE : defaultFilter(value, search, keywords);\n\n/** Single-select combobox (Popover + Command). Controlled or uncontrolled. */\nexport const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(function Combobox(\n {\n options,\n value,\n onValueChange,\n placeholder = \"Select…\",\n searchPlaceholder = \"Search…\",\n emptyText,\n className,\n disabled = false,\n allowCustomValue = false,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n triggerProps,\n },\n ref,\n) {\n const { t } = useLocale();\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState(\"\");\n const [search, setSearch] = useState(\"\");\n const selected = value ?? internal;\n const setValue = (v: string) => (onValueChange ? onValueChange(v) : setInternal(v));\n const current = options.find((o) => o.value === selected);\n\n const trimmedSearch = search.trim();\n const hasExactMatch = options.some(\n (o) => o.label.trim().toLowerCase() === trimmedSearch.toLowerCase(),\n );\n const showCustomValueItem = allowCustomValue && trimmedSearch.length > 0 && !hasExactMatch;\n const resolvedEmptyText =\n emptyText ?? (allowCustomValue ? t(\"ui.combobox.emptyAllowCustom\") : t(\"noResults\"));\n\n return (\n <Popover\n open={disabled ? false : open}\n onOpenChange={(o) => {\n if (disabled) return;\n setOpen(o);\n // Reset the search text on close, matching the previous (uncontrolled\n // cmdk-internal) behavior where the popover content unmounted and its\n // own internal search state reset with it.\n if (!o) setSearch(\"\");\n }}\n >\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n variant=\"outline\"\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n {...triggerProps}\n role=\"combobox\"\n aria-expanded={open}\n disabled={disabled}\n data-slot=\"combobox\"\n className={cn(\"w-56 justify-between font-normal\", triggerProps?.className, className)}\n >\n {current ? current.label : selected || placeholder}\n <ChevronsUpDown className=\"ms-2 size-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className=\"w-56 p-0\"\n data-slot=\"combobox-content\"\n // Radix Popover.Content renders role=\"dialog\"; without a name axe's\n // aria-dialog-name rule (rightly) flags it. Reuse the trigger's own\n // purpose label when the consumer set one, else fall back to the\n // (already-translatable) search placeholder — no new hardcoded copy.\n aria-label={ariaLabel ?? searchPlaceholder}\n >\n <Command filter={allowCustomValue ? customValueFilter : undefined}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <CommandList>\n <CommandEmpty>{resolvedEmptyText}</CommandEmpty>\n <CommandGroup>\n {options.map((o) => (\n <CommandItem\n key={o.value}\n value={o.label}\n onSelect={() => {\n setValue(o.value === selected ? \"\" : o.value);\n setOpen(false);\n }}\n >\n <Check\n className={cn(\n \"me-2 size-4\",\n selected === o.value ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n {o.label}\n </CommandItem>\n ))}\n {showCustomValueItem ? (\n <CommandItem\n value={CUSTOM_VALUE_ITEM}\n data-slot=\"combobox-custom-value\"\n onSelect={() => {\n setValue(trimmedSearch);\n setOpen(false);\n }}\n >\n <Plus className=\"me-2 size-4 shrink-0 opacity-50\" />\n {t(\"ui.combobox.useCustomValue\", { value: trimmedSearch })}\n </CommandItem>\n ) : null}\n </CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n});\n","import {\n createContext,\n forwardRef,\n use,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { Command as CommandPrimitive, useCommandState } from \"cmdk\";\nimport { Search } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { mergeRefs } from \"../../lib/merge-refs\";\nimport { Dialog, DialogContent } from \"../dialog\";\n\n/** cmdk's own marker attribute on an item row — the scope for the id lookup. */\nconst CMDK_ITEM_SELECTOR = '[cmdk-item=\"\"][aria-selected=\"true\"]';\n\n/** Distinguishes \"no `<Command>` ancestor\" from \"nothing is highlighted\". */\nconst NO_COMMAND_PROVIDER = Symbol(\"no-command-provider\");\n\nconst CommandActiveItemIdContext = createContext<string | undefined | typeof NO_COMMAND_PROVIDER>(\n NO_COMMAND_PROVIDER,\n);\n\n/**\n * Resolves the DOM `id` of the currently highlighted `CommandItem`, publishes\n * it on a context and reports it to `Command`'s `onActiveItemIdChange`.\n *\n * It renders no DOM of its own, and it deliberately does NOT simply forward\n * cmdk's `state.selectedItemId`. cmdk only recomputes that field inside a\n * `schedule(7, …)` callback queued from `setState(\"value\", …)`, and its own\n * `selectFirstItem()` runs INSIDE the layout-effect flush that drains that\n * queue — so the callback executes before React has committed the new\n * `aria-selected` attribute and cmdk's `getSelectedItem()` DOM query finds\n * nothing. The field therefore stays `undefined` for BOTH cases that matter\n * here: the item auto-highlighted on mount, and the item re-highlighted after\n * every filter keystroke. (cmdk's own `Command.Input` inherits the same hole —\n * it renders no `aria-activedescendant` in either state. Verified against\n * cmdk 1.1.1 in jsdom and Chromium.)\n *\n * Reading the committed DOM from a post-commit `useEffect` — the same query\n * cmdk itself uses, just at a point where the attribute exists — closes both\n * gaps. `state.selectedItemId` is kept as a fallback and as one of the change\n * triggers.\n */\nfunction CommandActiveItemProvider({\n rootRef,\n onChange,\n children,\n}: {\n rootRef: RefObject<HTMLDivElement | null>;\n onChange?: (id: string | undefined) => void;\n children: ReactNode;\n}) {\n const value = useCommandState((state) => state.value);\n const selectedItemId = useCommandState((state) => state.selectedItemId);\n const filteredCount = useCommandState((state) => state.filtered.count);\n\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n\n // The callback lives in a ref so an inline arrow prop doesn't re-fire the\n // effect on every render.\n const onChangeRef = useRef(onChange);\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n // `undefined` is a legitimate reported value (\"nothing highlighted\"), so the\n // \"not reported yet\" sentinel has to be something else.\n const lastReportedRef = useRef<string | undefined | typeof NO_COMMAND_PROVIDER>(\n NO_COMMAND_PROVIDER,\n );\n\n useEffect(() => {\n const element = rootRef.current?.querySelector<HTMLElement>(CMDK_ITEM_SELECTOR);\n const next = element?.id ?? selectedItemId ?? undefined;\n\n setActiveId(next);\n if (lastReportedRef.current !== next) {\n lastReportedRef.current = next;\n onChangeRef.current?.(next);\n }\n }, [value, selectedItemId, filteredCount, rootRef]);\n\n return <CommandActiveItemIdContext value={activeId}>{children}</CommandActiveItemIdContext>;\n}\n\nexport interface CommandProps extends ComponentPropsWithoutRef<typeof CommandPrimitive> {\n /**\n * Reports the DOM `id` cmdk assigned to the currently highlighted item, so\n * an input rendered OUTSIDE this `Command` tree (a composer textarea, a\n * combobox trigger) can set `aria-activedescendant` without querying\n * `[role=\"option\"]` positionally. Fires with `undefined` when nothing is\n * highlighted.\n *\n * cmdk owns each item's `id`/`role`/`aria-selected` and applies them AFTER\n * the consumer spread, so a consumer-supplied `id` on `CommandItem` is\n * silently dropped (`CommandItem` warns about this in development) — this\n * callback is the supported way to obtain it. See also the\n * `useCommandActiveItemId` hook for reading the same value from a\n * descendant already inside the `<Command>` tree.\n *\n * It fires for EVERY highlight change, including the item cmdk\n * auto-highlights on mount and the one it re-highlights after each filter\n * keystroke — the two states cmdk's own `state.selectedItemId` misses.\n */\n onActiveItemIdChange?: (id: string | undefined) => void;\n}\n\nexport const Command = forwardRef<ElementRef<typeof CommandPrimitive>, CommandProps>(\n function Command({ className, children, onActiveItemIdChange, ...props }, ref) {\n const innerRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs<HTMLDivElement>(ref, innerRef), [ref]);\n\n return (\n <CommandPrimitive\n ref={mergedRef}\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n >\n <CommandActiveItemProvider rootRef={innerRef} onChange={onActiveItemIdChange}>\n {children}\n </CommandActiveItemProvider>\n </CommandPrimitive>\n );\n },\n);\n\n/**\n * The DOM `id` of the currently highlighted `CommandItem`. Must be called\n * from a component rendered inside a `<Command>` tree; returns `undefined`\n * when nothing is highlighted (or when there is no `<Command>` ancestor).\n * Reports exactly the same value as `Command`'s `onActiveItemIdChange`\n * callback, for a consumer that is already a descendant (rather than an\n * external input above the tree).\n */\nexport function useCommandActiveItemId(): string | undefined {\n const id = use(CommandActiveItemIdContext);\n return id === NO_COMMAND_PROVIDER ? undefined : id;\n}\n\nexport function CommandDialog({\n children,\n filter,\n ...props\n}: ComponentPropsWithoutRef<typeof Dialog> & {\n /** Custom cmdk ranking (e.g. strict substring instead of fuzzy). */\n filter?: ComponentPropsWithoutRef<typeof CommandPrimitive>[\"filter\"];\n}) {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0\">\n <Command\n filter={filter}\n className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3\"\n >\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(function CommandInput({ className, ...props }, ref) {\n return (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"me-2 size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n data-slot=\"command-input\"\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n );\n});\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(function CommandList({ className, ...props }, ref) {\n return (\n <CommandPrimitive.List\n ref={ref}\n data-slot=\"command-list\"\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n );\n});\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>(function CommandEmpty(props, ref) {\n return (\n <CommandPrimitive.Empty\n ref={ref}\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n );\n});\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(function CommandGroup({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Group\n ref={ref}\n data-slot=\"command-group\"\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(function CommandSeparator({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Separator\n ref={ref}\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n );\n});\n\n/**\n * Props cmdk owns and applies AFTER a consumer spread — see the `Command`\n * `onActiveItemIdChange` docblock. Passing any of these is a silent no-op;\n * `CommandItem` warns once per key in development.\n */\nconst CMDK_OVERRIDDEN_ITEM_PROPS = [\"id\", \"role\", \"aria-selected\"] as const;\nconst warnedAboutOverriddenItemProps = new Set<string>();\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(function CommandItem({ className, ...props }, ref) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const key of CMDK_OVERRIDDEN_ITEM_PROPS) {\n if (key in props && !warnedAboutOverriddenItemProps.has(key)) {\n warnedAboutOverriddenItemProps.add(key);\n // oxlint-disable-next-line no-console\n console.warn(\n `CommandItem: \"${key}\" is assigned internally by cmdk, so the value you passed is ` +\n 'ignored. Use <Command onActiveItemIdChange> (or the \"useCommandActiveItemId\" hook) ' +\n \"to read the DOM id of the highlighted item instead — see \" +\n \"packages/ui/src/components/command/command.tsx.\",\n );\n }\n }\n }\n\n return (\n <CommandPrimitive.Item\n ref={ref}\n data-slot=\"command-item\"\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport function CommandShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\"ms-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n","import type { ForwardedRef } from \"react\";\n\n/**\n * Combine a `forwardRef`-forwarded ref with one or more locally-owned refs so\n * both end up pointing at the same DOM node. Returns a stable callback ref\n * wrapper — memoize the result (`useMemo`) keyed on the forwarded ref so it\n * doesn't detach/reattach on every render.\n */\nexport function mergeRefs<T>(...refs: Array<ForwardedRef<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (!ref) continue;\n if (typeof ref === \"function\") ref(node);\n else ref.current = node;\n }\n };\n}\n","import {\n forwardRef,\n useCallback,\n useRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { Heading, Text } from \"../typography\";\n\n/**\n * The first keyboard-reachable control inside a dialog, EXCLUDING the\n * `DialogBody` wrapper itself. Deliberately a pragmatic selector rather than a\n * full tabbability implementation — Radix owns focus trapping; this only\n * reorders the opening target (see `DialogContent`'s `onOpenAutoFocus`).\n */\nconst TABBABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"]):not([data-slot=\"dialog-body\"])',\n].join(\",\");\n\nexport const dialogContentVariants = cva(\n // `grid-cols-[minmax(0,1fr)]` (NOT the implicit `auto` column): grid items\n // default to `min-width:auto`, so a `nowrap`/`truncate` child or a long\n // unbreakable token (a file path, a URL) sets the column's min-content size and\n // pushes the dialog past its `max-w-*`. A `minmax(0,1fr)` column floors that at\n // 0, so inner `truncate`/`w-full` shrink instead of overflowing (#regression).\n //\n // Height/scroll (#341). Two mutually-exclusive regimes, picked by ANATOMY —\n // never by a `scroll` prop (`.claude/rules/component-api.md`: `cva` is for\n // visual axes, behaviour is composition):\n // 1. NO `DialogBody` — the content box itself caps at the viewport\n // (`max-h-…` + `overflow-y-auto`) and scrolls as one column. Before this,\n // a taller-than-viewport dialog overflowed past BOTH viewport edges and\n // its top was unreachable (the `-translate-y-1/2` centring).\n // 2. WITH a `DialogBody` — the `has-[…]` pair turns the content box into a\n // 3-row grid (`auto | minmax(0,1fr) | auto`) and stops it scrolling, so a\n // fixed header and footer sandwich a body that owns the scroll. The pair\n // is INERT for every dialog that has no `DialogBody`.\n // `size=\"full\"`'s own `h-/max-h-/overflow-hidden` still wins — cva emits the\n // base first, so tailwind-merge resolves the later variant utilities over it.\n \"fixed left-1/2 top-1/2 z-50 grid grid-cols-[minmax(0,1fr)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain has-[[data-slot=dialog-body]]:overflow-hidden has-[[data-slot=dialog-body]]:grid-rows-[auto_minmax(0,1fr)_auto] rounded-xl bg-card p-6 text-card-foreground shadow-ring-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n {\n variants: {\n size: {\n sm: \"max-w-sm\",\n lg: \"max-w-lg\",\n xl: \"max-w-3xl\",\n full: \"max-w-[95vw] h-[90vh] max-h-[90vh] overflow-hidden\",\n },\n },\n defaultVariants: { size: \"lg\" },\n },\n);\n\nexport const Dialog = DialogPrimitive.Root;\nexport const DialogTrigger = DialogPrimitive.Trigger;\nexport const DialogPortal = DialogPrimitive.Portal;\nexport const DialogClose = DialogPrimitive.Close;\n\nexport const DialogOverlay = forwardRef<\n ElementRef<typeof DialogPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(function DialogOverlay({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Overlay\n ref={ref}\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 z-50 bg-foreground/50 backdrop-blur-sm\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const DialogContent = forwardRef<\n ElementRef<typeof DialogPrimitive.Content>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Content> &\n VariantProps<typeof dialogContentVariants>\n>(function DialogContent({ className, children, size, onOpenAutoFocus, ...props }, ref) {\n const contentRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n\n /**\n * A `DialogBody` carries `tabIndex={0}` so a keyboard user can scroll it — but\n * being the first tab stop would also make the scroll WRAPPER the dialog's\n * opening focus target, which paints a focus ring around the whole body on\n * open and skips the first field. Skip past it to the first real control\n * INSIDE the body. Inert for dialogs with no `DialogBody`, so nothing that\n * shipped before changes.\n *\n * Two things this deliberately does NOT do, both because getting them wrong\n * strands the keyboard:\n * * It only prevents Radix's default once a candidate has *actually taken*\n * focus. A selector match is not proof of focusability — a `display:none`\n * candidate (the ubiquitous `<input type=\"file\" hidden>`) swallows\n * `.focus()`, so preventing the default for it would leave focus on the\n * TRIGGER, outside the modal.\n * * It gives up when the body holds no focusable control at all. Radix's own\n * fallback then focuses the body — which is the right target for a\n * text-only scroll region, and better than reaching past it to the\n * footer's primary action.\n */\n const handleOpenAutoFocus = useCallback(\n (event: Event) => {\n onOpenAutoFocus?.(event);\n if (event.defaultPrevented) return;\n const body = contentRef.current?.querySelector<HTMLElement>('[data-slot=\"dialog-body\"]');\n if (!body) return;\n for (const candidate of body.querySelectorAll<HTMLElement>(TABBABLE)) {\n candidate.focus({ preventScroll: true });\n if (candidate.ownerDocument.activeElement !== candidate) continue;\n event.preventDefault();\n return;\n }\n },\n [onOpenAutoFocus],\n );\n\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={setRefs}\n data-slot=\"dialog-content\"\n className={cn(dialogContentVariants({ size }), className)}\n onOpenAutoFocus={handleOpenAutoFocus}\n {...props}\n >\n {children}\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute end-4 top-4 rounded-md p-1 text-muted-foreground opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label=\"Close\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n});\n\nexport function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-1.5 text-start\", className)}\n {...props}\n />\n );\n}\n\nexport function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n {...props}\n />\n );\n}\n\nexport const DialogTitle = forwardRef<\n ElementRef<typeof DialogPrimitive.Title>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(function DialogTitle({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Title\n ref={ref}\n data-slot=\"dialog-title\"\n className={cn(\"text-title leading-none\", className)}\n {...props}\n />\n );\n});\n\nexport const DialogDescription = forwardRef<\n ElementRef<typeof DialogPrimitive.Description>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(function DialogDescription({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Description\n ref={ref}\n data-slot=\"dialog-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n\nexport type DialogBodyProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * The dialog's scroll owner (#341).\n *\n * Placing a `DialogBody` between `DialogHeader` and `DialogFooter` switches\n * `DialogContent` into its fixed-header/footer regime (see\n * `dialogContentVariants`): the header and footer stay put and ONLY this region\n * scrolls, so the primary action never scrolls out of view. Without it a dialog\n * behaves exactly as before — the anatomy is the switch, there is no `scroll`\n * prop.\n *\n * `overscroll-contain` stops the scroll chaining to the page underneath\n * (`.claude/rules/interaction-guidelines.md`, Touch & overscroll).\n *\n * **The `p-1`/`-m-1`/`scroll-p-1` trio reserves a focus-ring gutter (#425).**\n * Per CSS Overflow 3, authoring only `overflow-y-auto` still makes this a\n * two-axis scroll container (the `visible` axis computes to `auto` too), and a\n * scroll container clips at its **padding box**. With no padding of its own,\n * that padding box IS the content box, so a full-width child's border box\n * lands exactly on the clip edge — leaving 0px for a focus ring, which is\n * `box-shadow` (ink overflow: never part of the scrollable region, so it is\n * simply cut, not merely scrolled out of reach). `p-1` moves the scrollport\n * 4px outward on every side — enough for the library's widest outward paint\n * (`ring-2 ring-offset-2` = 4px) — and `-m-1` pulls the border box back by the\n * same amount so body content stays flush with `DialogHeader`/`DialogFooter`\n * instead of indenting 4px against them. `scroll-p-1` keeps a keyboard-driven\n * scroll-into-view (Tab landing on a control currently outside the scrollport)\n * from placing that control flush against the scrollport edge again.\n *\n * Two consumer-facing consequences: a larger `className` padding (e.g. `p-6`)\n * still wins through `tailwind-merge`, with the border box remaining 4px\n * outward; but **`className=\"p-0\"` re-opens the bug** — the merge kills `p-1`\n * while `-m-1` survives — so a consumer who genuinely wants no gutter must\n * clear both sides with `className=\"m-0 p-0\"`.\n *\n * Known, accepted residual: at `data-density=\"compact\"`, `--spacing` is\n * `0.222rem` (`density.css:97`), so `p-1` is 3.55px against a 4px ring — a\n * 0.45px shortfall on the outermost edge of a 2px stroke. Do not \"fix\" this\n * with a fixed-px override; that would break the density dial's contract.\n */\nexport const DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(function DialogBody(\n { className, tabIndex, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"dialog-body\"\n // A scroll container must be keyboard-operable (WCAG 2.1.1; axe's\n // `scrollable-region-focusable`). A body holding only text has no focusable\n // child to scroll from, so the region itself takes the tab stop. Pass\n // `tabIndex={-1}` to opt out when the body always contains its own\n // focusable content.\n tabIndex={tabIndex ?? 0}\n className={cn(\n \"-m-1 min-h-0 overflow-y-auto overscroll-contain p-1 scroll-p-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface DialogSectionProps extends Omit<HTMLAttributes<HTMLElement>, \"title\"> {\n /** The section heading. States what the group of fields is for. */\n title: ReactNode;\n /** One line of supporting context under the heading. */\n description?: ReactNode;\n /**\n * Semantic heading level. `DialogTitle` renders an `<h2>`, so a section is an\n * `<h3>` by default and an `<h4>` when nested a rung deeper.\n */\n level?: 3 | 4;\n /** Section-scoped actions, aligned to the inline end of the heading row. */\n actions?: ReactNode;\n}\n\n/**\n * A real section heading inside a dialog (#341).\n *\n * The recurring downstream defect was section labels rendering at the same size\n * as the field labels beneath them, which flattens a long form into one\n * undifferentiated list. The rungs are distinct BY TOKEN, not by eye:\n * `DialogTitle` `text-title` (1.25rem) > `DialogSection` `text-subtitle` (1rem) >\n * `Label` `text-body` (0.875rem).\n *\n * Deliberately NOT `SectionHeader` (`../section-header`): that is the page-level\n * `<h2>` row with an eyebrow, one rung too loud and one level too high inside a\n * dialog whose title already owns the `<h2>`.\n */\nexport const DialogSection = forwardRef<HTMLElement, DialogSectionProps>(function DialogSection(\n { className, title, description, level = 3, actions, children, ...props },\n ref,\n) {\n return (\n <section\n ref={ref}\n data-slot=\"dialog-section\"\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Heading level={level} size=\"subtitle\" data-slot=\"dialog-section-title\">\n {title}\n </Heading>\n {description ? (\n <Text variant=\"caption\" tone=\"muted\" data-slot=\"dialog-section-description\">\n {description}\n </Text>\n ) : null}\n </div>\n {actions ? <div className=\"shrink-0\">{actions}</div> : null}\n </div>\n {children}\n </section>\n );\n});\n","/**\n * Typography primitives — the semantic type-role API (#187/#188, research 07 §B.3).\n *\n * `Text` and `Heading` map intent → a type ROLE. Each `text-<role>` utility is\n * backed by the `--text-<role>` tokens in @elabs-ai/components-tokens and bundles all four\n * dimensions (size + leading + weight + tracking) while staying composable —\n * `leading-*` / `font-*` / `tracking-*` overrides still win. Reach for these\n * primitives (or a `text-<role>` utility) — never a raw size utility (sm/xl/…).\n */\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * The role font sizes in rem — a TS mirror of the `--text-<role>` tokens\n * (packages/tokens/src/themes.css) for consumers that need the numbers at\n * runtime (e.g. @elabs-ai/components-editor's markdown-scale CSS-var seam). Edit the tokens\n * first; typography.test.tsx pins this mirror to themes.css.\n */\nexport const TEXT_ROLE_REM = {\n display: 1.875,\n title: 1.25,\n subtitle: 1,\n body: 0.875,\n caption: 0.8125,\n meta: 0.75,\n kpi: 2,\n code: 0.8125,\n} as const;\n\nexport type TextRole = keyof typeof TEXT_ROLE_REM;\n\nexport const textVariants = cva(\"\", {\n variants: {\n variant: {\n /** A lead paragraph — the subtitle rung at body weight (research 07 §B.3). */\n lead: \"text-subtitle font-normal\",\n body: \"text-body\",\n caption: \"text-caption\",\n meta: \"text-meta\",\n /** KPI values pair with tabular figures (interaction-guidelines). */\n kpi: \"text-kpi tabular-nums\",\n /** Inline/block code pairs with the `--font-mono` seam. */\n code: \"text-code font-mono\",\n },\n tone: {\n default: \"text-foreground\",\n muted: \"text-muted-foreground\",\n /** #399 — the on-surface TEXT rung, not the `--primary` FILL. */\n primary: \"text-primary-text\",\n },\n },\n defaultVariants: { variant: \"body\", tone: \"default\" },\n});\n\nexport type TextVariant = NonNullable<VariantProps<typeof textVariants>[\"variant\"]>;\nexport type TextTone = NonNullable<VariantProps<typeof textVariants>[\"tone\"]>;\n\nexport interface TextProps\n extends HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof textVariants> {\n /** Render as a different element. Defaults to \"p\". */\n as?: \"p\" | \"span\" | \"div\";\n /** Render the child element as the text root (Radix Slot) instead. */\n asChild?: boolean;\n}\n\nexport const Text = forwardRef<HTMLParagraphElement, TextProps>(function Text(\n { className, variant, tone, as: Tag = \"p\", asChild = false, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : Tag;\n return <Comp ref={ref} className={cn(textVariants({ variant, tone }), className)} {...props} />;\n});\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport const headingVariants = cva(\"text-balance text-foreground\", {\n variants: {\n size: {\n /** display + title carry the `--font-display` brand seam (research 07 §E.5). */\n display: \"font-display text-display\",\n title: \"font-display text-title\",\n subtitle: \"text-subtitle\",\n },\n },\n defaultVariants: { size: \"title\" },\n});\n\nexport type HeadingSize = NonNullable<VariantProps<typeof headingVariants>[\"size\"]>;\n\n/** Default visual rung per heading level: 1 → display, 2–3 → title, 4–6 → subtitle. */\nconst LEVEL_SIZE: Record<HeadingLevel, HeadingSize> = {\n 1: \"display\",\n 2: \"title\",\n 3: \"title\",\n 4: \"subtitle\",\n 5: \"subtitle\",\n 6: \"subtitle\",\n};\n\nexport interface HeadingProps\n extends HTMLAttributes<HTMLHeadingElement>, VariantProps<typeof headingVariants> {\n /** Semantic heading level — drives the rendered tag AND the default size. */\n level?: HeadingLevel;\n /** Render the child element as the heading root (Radix Slot) instead. */\n asChild?: boolean;\n}\n\n/**\n * `level` keeps the a11y heading order; `size` overrides the visual rung\n * independently, so a visually-small `<h2>` stays an `<h2>`.\n */\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { className, level = 2, size, asChild = false, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : (`h${level}` as const);\n return (\n <Comp\n ref={ref}\n className={cn(headingVariants({ size: size ?? LEVEL_SIZE[level] }), className)}\n {...props}\n />\n );\n});\n","/**\n * Prose primitives — reading-surface typography, promoted from @elabs-ai/components-editor\n * (#188; ADR-0012 own/re-export model: @elabs-ai/components-ui owns the canonical source,\n * `@elabs-ai/components-editor/markdown` re-exports them under their original names —\n * Heading, Text, Link, List, Blockquote, InlineCode). The markdown preview maps\n * onto them (`#` → ProseHeading, paragraph → ProseText, `[]()` → ProseLink,\n * `-` → ProseList, `>` → ProseBlockquote, `` `code` `` → ProseInlineCode).\n * Generic, composable, theme-safe; usable in any app surface, not just markdown.\n *\n * `Prose*`-prefixed here because this barrel also exports the app `Heading` /\n * `Text` primitives (typography.tsx): the app scale ranks UI chrome against the\n * page; the prose scale ranks rungs WITHIN one reading column, so a document h1\n * deliberately sits BELOW the app `display` rung.\n */\nimport {\n forwardRef,\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n type OlHTMLAttributes,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { TEXT_ROLE_REM } from \"./typography\";\n\nexport type ProseHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Canonical reading-scale heading sizes in rem — the single source the markdown\n * WYSIWYG editor derives its CSS vars from (@elabs-ai/components-editor `markdown-scale`).\n * h2/h4/h5/h6 sit exactly on the title/subtitle/body roles; h1 (1.5rem) and\n * h3 (1.125rem) are intermediate reading rungs with no app role.\n */\nexport const PROSE_HEADING_REM: Record<ProseHeadingLevel, number> = {\n 1: 1.5,\n 2: TEXT_ROLE_REM.title,\n 3: 1.125,\n 4: TEXT_ROLE_REM.subtitle,\n 5: TEXT_ROLE_REM.body,\n 6: TEXT_ROLE_REM.body,\n};\n\n/** Canonical prose heading weight (Tailwind `font-semibold`). */\nexport const PROSE_HEADING_WEIGHT = 600;\n\n/** Canonical prose heading letter-spacing (Tailwind `tracking-tight`). */\nexport const PROSE_HEADING_TRACKING = \"-0.025em\";\n\n/*\n * h1/h3 keep raw Tailwind steps (2xl / lg): the reading scale needs rungs\n * BETWEEN the app roles (see PROSE_HEADING_REM) — baselined in the text-scale\n * ratchet. The base classes' font-semibold / tracking-tight override the role\n * companions, so the role re-points are render-identical to the old raw steps.\n */\nconst HEADING_SIZE: Record<ProseHeadingLevel, string> = {\n 1: \"text-2xl\",\n 2: \"text-title\",\n 3: \"text-lg\",\n 4: \"text-subtitle\",\n 5: \"text-body\",\n 6: \"text-body text-muted-foreground\",\n};\n\nexport interface ProseHeadingProps extends HTMLAttributes<HTMLHeadingElement> {\n level?: ProseHeadingLevel;\n}\n\nexport const ProseHeading = forwardRef<HTMLHeadingElement, ProseHeadingProps>(function ProseHeading(\n { level = 2, className, ...props },\n ref,\n) {\n const Tag = `h${level}` as const;\n return (\n <Tag\n ref={ref}\n className={cn(\n \"scroll-m-20 font-semibold tracking-tight text-foreground\",\n HEADING_SIZE[level],\n className,\n )}\n {...props}\n />\n );\n});\n\nconst TEXT_VARIANT = {\n body: \"text-body leading-relaxed text-foreground\",\n muted: \"text-body leading-relaxed text-muted-foreground\",\n lead: \"text-subtitle font-normal leading-relaxed text-foreground\",\n small: \"text-meta font-normal text-muted-foreground\",\n} as const;\n\nexport interface ProseTextProps extends HTMLAttributes<HTMLParagraphElement> {\n variant?: keyof typeof TEXT_VARIANT;\n /** Render as a different element (e.g. \"span\"). Defaults to \"p\". */\n as?: \"p\" | \"span\" | \"div\";\n}\n\nexport const ProseText = forwardRef<HTMLParagraphElement, ProseTextProps>(function ProseText(\n { variant = \"body\", as: Tag = \"p\", className, ...props },\n ref,\n) {\n return <Tag ref={ref} className={cn(TEXT_VARIANT[variant], className)} {...props} />;\n});\n\nexport interface ProseLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Opens in a new tab with safe rel. Auto-detected for http(s) hrefs when unset. */\n external?: boolean;\n}\n\nexport const ProseLink = forwardRef<HTMLAnchorElement, ProseLinkProps>(function ProseLink(\n { external, href, className, ...props },\n ref,\n) {\n const isExternal = external ?? (typeof href === \"string\" && /^https?:\\/\\//.test(href));\n return (\n <a\n ref={ref}\n href={href}\n className={cn(\n // #399 — `text-primary-text`, not the `text-primary` FILL rung: a prose\n // link is ordinary body text and owes WCAG 1.4.3 AA (4.5:1), which the\n // fill only guarantees at the 1.4.11 mark bar (3:1).\n \"font-medium text-primary-text underline underline-offset-4 hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...(isExternal ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})}\n {...props}\n />\n );\n});\n\nexport interface ProseListProps extends OlHTMLAttributes<HTMLElement> {\n ordered?: boolean;\n}\n\nexport const ProseList = forwardRef<HTMLUListElement & HTMLOListElement, ProseListProps>(\n function ProseList({ ordered = false, className, ...props }, ref) {\n const Tag = ordered ? \"ol\" : \"ul\";\n return (\n <Tag\n ref={ref}\n className={cn(\n \"my-1 space-y-1 ps-6 text-body text-foreground\",\n ordered ? \"list-decimal\" : \"list-disc\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const ProseListItem = forwardRef<HTMLLIElement, HTMLAttributes<HTMLLIElement>>(\n function ProseListItem({ className, ...props }, ref) {\n return (\n <li\n ref={ref}\n className={cn(\"leading-relaxed [&>ul]:mt-1 [&>ol]:mt-1\", className)}\n {...props}\n />\n );\n },\n);\n\nexport const ProseBlockquote = forwardRef<HTMLQuoteElement, HTMLAttributes<HTMLQuoteElement>>(\n function ProseBlockquote({ className, ...props }, ref) {\n return (\n <blockquote\n ref={ref}\n className={cn(\n \"border-s-2 border-border ps-4 text-body italic text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nexport const ProseInlineCode = forwardRef<HTMLElement, HTMLAttributes<HTMLElement>>(\n function ProseInlineCode({ className, ...props }, ref) {\n return (\n <code\n ref={ref}\n // 0.85em (not the fixed `code` role): inline code must scale RELATIVE to\n // whatever text it sits in (body, a heading, …). Baselined in the ratchet.\n className={cn(\n \"rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground\",\n className,\n )}\n {...props}\n />\n );\n },\n);\n","\"use client\";\n\nimport { useCallback, useState } from \"react\";\n\nexport interface UseDialogDismissGuardOptions {\n /**\n * Does the dialog currently hold unsaved changes? **App-owned** — brand-ui is\n * a presentation layer (`docs/DECISIONS.md` §D5) and cannot know what \"dirty\"\n * means for your form. Compute it (a `react-hook-form` `isDirty`, a deep\n * compare, a store flag) and pass it in.\n */\n dirty: boolean;\n /** Close the dialog — the app sets its own `open` state to `false`. */\n onClose: () => void;\n /**\n * Open the dialog. Only needed when a `DialogTrigger` (rather than the app)\n * opens it, because Radix routes that through the same `onOpenChange`.\n */\n onOpen?: () => void;\n}\n\nexport interface DialogDismissGuard {\n /**\n * Spread onto `<Dialog onOpenChange={…}>`. Intercepts EVERY user dismissal —\n * Escape, overlay click, the built-in close ✕ and any `DialogClose` — because\n * Radix funnels all four through `onOpenChange(false)`.\n */\n onOpenChange: (open: boolean) => void;\n /** Controlled `open` for the discard confirmation. */\n confirmOpen: boolean;\n /** Controlled `onOpenChange` for the discard confirmation. */\n onConfirmOpenChange: (open: boolean) => void;\n /** Confirm the discard: closes the confirmation AND calls `onClose()`. */\n confirmDiscard: () => void;\n}\n\n/**\n * Warn before a dialog with unsaved changes is dismissed (#341).\n *\n * `.claude/rules/interaction-guidelines.md` (Forms) requires warning before\n * navigating away from unsaved changes; this is that rule for dialogs, as a HOOK\n * rather than a prop because the component must not own app state — the app owns\n * `open` and decides what `dirty` means (D5).\n *\n * ## The asymmetry is structural, not a flag\n *\n * A **user dismissal** reaches Radix's `onOpenChange`, so the guard sees it and\n * can hold the dialog open. A **programmatic close** (the app setting its own\n * `open` to `false` after a successful save) never touches the guard, so it is\n * unobservable here and closes silently. That is exactly the wanted behaviour,\n * and it falls out of the wiring — there is no \"skip the guard\" option to get\n * wrong.\n *\n * The name is literal: it guards DISMISSALS routed through the returned\n * `onOpenChange`. It is not a navigation blocker and it cannot intercept a tab\n * close, a router navigation, or an `open` prop that the app flips itself.\n *\n * ```tsx\n * const [open, setOpen] = useState(false);\n * const guard = useDialogDismissGuard({\n * dirty,\n * onClose: () => setOpen(false),\n * onOpen: () => setOpen(true),\n * });\n *\n * <Dialog open={open} onOpenChange={guard.onOpenChange}>…</Dialog>\n * <ConfirmDialog\n * open={guard.confirmOpen}\n * onOpenChange={guard.onConfirmOpenChange}\n * onConfirm={guard.confirmDiscard}\n * tone=\"destructive\"\n * title=\"Discard changes?\"\n * description=\"Your edits to this project have not been saved.\"\n * confirmLabel=\"Discard\"\n * />\n * ```\n *\n * The `ConfirmDialog` is a SIBLING of the guarded dialog, not a child of it.\n */\nexport function useDialogDismissGuard({\n dirty,\n onClose,\n onOpen,\n}: UseDialogDismissGuardOptions): DialogDismissGuard {\n const [confirmOpen, setConfirmOpen] = useState(false);\n\n const onOpenChange = useCallback(\n (open: boolean) => {\n // Opening is never guarded; a `DialogTrigger` routes through here too.\n if (open) {\n onOpen?.();\n return;\n }\n if (dirty) {\n setConfirmOpen(true);\n return;\n }\n onClose();\n },\n [dirty, onClose, onOpen],\n );\n\n const confirmDiscard = useCallback(() => {\n setConfirmOpen(false);\n onClose();\n }, [onClose]);\n\n return { onOpenChange, confirmOpen, onConfirmOpenChange: setConfirmOpen, confirmDiscard };\n}\n","\"use client\";\n\nimport { type MouseEvent, type ReactNode } from \"react\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"../alert-dialog\";\nimport { buttonVariants } from \"../button\";\nimport { cn } from \"../../lib/cn\";\nimport { useLocale } from \"../locale-provider\";\nimport { Spinner } from \"../spinner\";\n\nexport interface ConfirmDialogProps {\n /** Controlled open state — the app owns it. */\n open: boolean;\n /** Fires on cancel, Escape, and any other Radix dismissal. */\n onOpenChange: (open: boolean) => void;\n /** What is about to happen, as a question or a statement. */\n title: ReactNode;\n /**\n * The consequence, spelled out. **Required**: `AlertDialogContent` is\n * inaccessible to screen-reader users without a description (Radix warns), and\n * a confirmation whose only text is its title cannot state what is at stake.\n */\n description: ReactNode;\n /**\n * The confirm action's label. States the CONSEQUENCE (\"Delete skill\"), never\n * \"OK\" — a label that names the outcome is the last chance to catch a mistake.\n * Defaults to a generic \"Confirm\", which you should almost always replace.\n */\n confirmLabel?: ReactNode;\n /** The safe action's label. Defaults to \"Cancel\". */\n cancelLabel?: ReactNode;\n /** Runs when the confirm action is activated. */\n onConfirm: () => void;\n /** Runs when the safe action is activated (in addition to `onOpenChange`). */\n onCancel?: () => void;\n /** Visual tone of the CONFIRM action only. The dialog chrome never changes. */\n tone?: \"default\" | \"destructive\";\n /**\n * The confirm request is in flight: the action swaps its label for a spinner\n * and reports `aria-busy`. It deliberately stays ENABLED\n * (`.claude/rules/interaction-guidelines.md`, Forms — a submit is never\n * pre-disabled); repeat activations are ignored while it is set.\n */\n loading?: boolean;\n /** Extra body content between the description and the actions. */\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A destructive/irreversible confirmation (#341).\n *\n * Built on `AlertDialog`, not `Dialog`, and that is the entire point of it\n * existing as a named component rather than a recipe: `AlertDialogContent`\n * prevents its own open-autofocus and focuses the mounted `AlertDialogCancel`\n * instead, so **initial focus lands on the safe action** — but only if a Cancel\n * is actually mounted, which a hand-rolled confirmation routinely forgets (and a\n * plain `Dialog` cannot do at all). `ConfirmDialog` always renders one, so the\n * wrong choice is unrepresentable. It also inherits `AlertDialog`'s refusal to\n * dismiss on an outside click.\n *\n * Cancel is FIRST in the DOM so assistive tech reads the safe action first;\n * `AlertDialogFooter`'s `flex-col-reverse sm:flex-row sm:justify-end` still\n * paints the confirm action bottom-right on every breakpoint.\n *\n * **Confirming does not close the dialog** — `onConfirm` fires and the app sets\n * `open={false}` when it is ready (immediately for a synchronous action, after\n * the request for an async one, which is what makes `loading` coherent).\n * Cancelling closes through `onOpenChange(false)` as usual.\n *\n * ```tsx\n * <ConfirmDialog\n * open={open}\n * onOpenChange={setOpen}\n * tone=\"destructive\"\n * title={`Delete ${skill.name}?`}\n * description={`Removing it also deletes its ${skill.runs} saved runs. This cannot be undone.`}\n * confirmLabel={`Delete ${skill.name}`}\n * onConfirm={() => { deleteSkill(); setOpen(false); }}\n * />\n * ```\n */\nexport function ConfirmDialog({\n open,\n onOpenChange,\n title,\n description,\n confirmLabel,\n cancelLabel,\n onConfirm,\n onCancel,\n tone = \"default\",\n loading = false,\n children,\n className,\n}: ConfirmDialogProps) {\n const { t } = useLocale();\n\n function handleConfirm(event: MouseEvent<HTMLButtonElement>) {\n // Radix's Action is a `Dialog.Close`; preventing the default stops it\n // closing so the app stays in charge of `open` (and an in-flight request\n // keeps its spinner on screen).\n event.preventDefault();\n if (loading) return;\n onConfirm();\n }\n\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent data-slot=\"confirm-dialog\" className={className}>\n <AlertDialogHeader>\n <AlertDialogTitle data-slot=\"confirm-dialog-title\">{title}</AlertDialogTitle>\n <AlertDialogDescription data-slot=\"confirm-dialog-description\">\n {description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n {children}\n <AlertDialogFooter>\n <AlertDialogCancel data-slot=\"confirm-dialog-cancel\" onClick={onCancel}>\n {cancelLabel ?? t(\"ui.confirmDialog.cancel\")}\n </AlertDialogCancel>\n <AlertDialogAction\n data-slot=\"confirm-dialog-confirm\"\n className={cn(tone === \"destructive\" && buttonVariants({ variant: \"destructive\" }))}\n aria-busy={loading || undefined}\n onClick={handleConfirm}\n >\n {/* `text-current` so the spinner inherits the action's foreground\n token instead of `Spinner`'s muted default, which would drop\n below 3:1 on a filled button. */}\n {loading ? <Spinner className=\"text-current\" label={t(\"loading\")} /> : null}\n {confirmLabel ?? t(\"ui.confirmDialog.confirm\")}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n","import { Loader2 } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface SpinnerProps extends React.SVGProps<SVGSVGElement> {\n /** Accessible label; defaults to \"Loading\". */\n label?: string;\n}\n\n/** Indeterminate spinner with an accessible label. */\nexport function Spinner({ className, label = \"Loading\", ...props }: SpinnerProps) {\n return (\n <Loader2\n role=\"status\"\n aria-label={label}\n className={cn(\"size-4 animate-spin text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\nexport const ContextMenuGroup = ContextMenuPrimitive.Group;\nexport const ContextMenuSub = ContextMenuPrimitive.Sub;\nexport const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nexport const ContextMenuSubTrigger = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }\n>(function ContextMenuSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ms-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n );\n});\n\nexport const ContextMenuSubContent = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.SubContent>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(function ContextMenuSubContent({ className, ...props }, ref) {\n return (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ContextMenuContent = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(function ContextMenuContent({ className, ...props }, ref) {\n return (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n );\n});\n\nexport const ContextMenuItem = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & { inset?: boolean }\n>(function ContextMenuItem({ className, inset, ...props }, ref) {\n return (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ContextMenuCheckboxItem = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(function ContextMenuCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n );\n});\n\nexport const ContextMenuRadioItem = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(function ContextMenuRadioItem({ className, children, ...props }, ref) {\n return (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n );\n});\n\nexport const ContextMenuLabel = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.Label>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & { inset?: boolean }\n>(function ContextMenuLabel({ className, inset, ...props }, ref) {\n return (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-xs font-semibold text-muted-foreground\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const ContextMenuSeparator = forwardRef<\n ElementRef<typeof ContextMenuPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(function ContextMenuSeparator({ className, ...props }, ref) {\n return (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n});\n\nexport function ContextMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn(\"ms-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\n/**\n * CopyableValue — shown short, copied exact.\n *\n * Numbers across the library are formatted COMPACT by default (`1.5M`, `$820`),\n * because the surfaces they appear on — a KPI tile, an axis tick, a chart in a\n * chat bubble — have no room for `50012102.632741`. That is only defensible if\n * the exact value stays reachable, so this renders the compact string as a real\n * `<button>` that puts the unrounded one on the clipboard.\n *\n * Why a button and not a tooltip: a chart tooltip is `pointer-events-none` (it\n * must not swallow the `mousemove` that drives the crosshair), so it can carry\n * text but never an interaction. A button is reachable by mouse, by keyboard,\n * and by touch — all three, with no bespoke affordance.\n */\n\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { useCopyToClipboard } from \"../../lib/use-copy-to-clipboard\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface CopyableValueProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\" | \"children\"\n> {\n /**\n * The EXACT text written to the clipboard — the unrounded, un-abbreviated\n * value. Not locale-formatted by this component: a copied number is usually\n * on its way into a spreadsheet or a query.\n */\n value: string;\n /** What the reader sees. Defaults to `value`. */\n children?: ReactNode;\n /**\n * Overrides the screen-reader hint appended to the visible text. The\n * accessible name is always `<visible text> + <hint>`, which keeps WCAG 2.5.3\n * (Label in Name) satisfied — voice-control users can say what they read.\n */\n hint?: string;\n /** ms the \"Copied\" confirmation stays. Default: 1500. */\n resetAfterMs?: number;\n}\n\n/**\n * A value that copies its exact form on click.\n *\n * ```tsx\n * <CopyableValue value=\"50012102.632741\">50M</CopyableValue>\n * ```\n */\nexport const CopyableValue = forwardRef<HTMLButtonElement, CopyableValueProps>(\n function CopyableValue(\n { value, children, hint, resetAfterMs, className, onClick, ...props },\n ref,\n ) {\n const { t } = useLocale();\n const { copied, copy } = useCopyToClipboard(\n resetAfterMs === undefined ? undefined : { resetAfterMs },\n );\n\n return (\n <>\n <button\n data-slot=\"copyable-value\"\n data-copied={copied ? \"\" : undefined}\n ref={ref}\n type=\"button\"\n {...props}\n className={cn(\n // Reads as text, behaves as a control: the dotted underline is the\n // only resting affordance, so a value inside a heading or a KPI\n // still looks like a value, not a link.\n \"inline-flex items-baseline gap-1 rounded-sm underline decoration-dotted decoration-muted-foreground underline-offset-4\",\n \"hover:decoration-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n className,\n )}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n void copy(value);\n }\n }}\n >\n {children ?? value}\n <span className=\"sr-only\">{hint ?? t(\"ui.copyableValue.hint\")}</span>\n </button>\n {/*\n One live region per control, always mounted: an `aria-live` region\n inserted at the same moment its text appears is frequently missed by\n screen readers (ARIA22), so the region exists from first paint and\n only its contents change.\n */}\n <span aria-live=\"polite\" className=\"sr-only\" role=\"status\">\n {copied ? t(\"ui.copyableValue.copied\") : \"\"}\n </span>\n </>\n );\n },\n);\n","import { useState } from \"react\";\nimport { Calendar as CalendarIcon } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Calendar } from \"../calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport interface DatePickerProps {\n value?: Date;\n onValueChange?: (date?: Date) => void;\n placeholder?: string;\n className?: string;\n}\n\n/** Single-date picker (Popover + Calendar). Controlled or uncontrolled. */\nexport function DatePicker({\n value,\n onValueChange,\n placeholder = \"Pick a date\",\n className,\n}: DatePickerProps) {\n const [internal, setInternal] = useState<Date | undefined>(undefined);\n const date = value ?? internal;\n const setDate = (d?: Date) => (onValueChange ? onValueChange(d) : setInternal(d));\n const label = date\n ? new Intl.DateTimeFormat(undefined, { dateStyle: \"medium\" }).format(date)\n : placeholder;\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-56 justify-start gap-2 text-start font-normal\",\n !date && \"text-muted-foreground\",\n className,\n )}\n >\n <CalendarIcon className=\"size-4\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n <Calendar mode=\"single\" selected={date} onSelect={setDate} autoFocus />\n </PopoverContent>\n </Popover>\n );\n}\n","// a2ui.exposed: yes\n\"use client\";\n\nimport { forwardRef, useState } from \"react\";\nimport { Calendar as CalendarIcon } from \"lucide-react\";\nimport type { DateRange } from \"react-day-picker\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Calendar } from \"../calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\n\nexport type { DateRange };\n\nexport interface DateRangePreset {\n label: string;\n getRange: () => DateRange;\n}\n\nexport interface DateRangePickerProps {\n value?: DateRange;\n defaultValue?: DateRange;\n onValueChange?: (range?: DateRange) => void;\n presets?: DateRangePreset[];\n numberOfMonths?: number;\n placeholder?: string;\n className?: string;\n}\n\nconst fmt = (date: Date) =>\n new Intl.DateTimeFormat(undefined, { dateStyle: \"medium\" }).format(date);\n\nfunction formatRange(range: DateRange | undefined, placeholder: string): string {\n if (!range) return placeholder;\n if (range.from && range.to) return `${fmt(range.from)} – ${fmt(range.to)}`;\n if (range.from) return `${fmt(range.from)} – …`;\n return placeholder;\n}\n\n/**\n * Date range picker (Popover + Calendar in range mode).\n * Supports optional preset quick-picks, controlled or uncontrolled.\n */\nexport const DateRangePicker = forwardRef<HTMLButtonElement, DateRangePickerProps>(\n function DateRangePicker(\n {\n value,\n defaultValue,\n onValueChange,\n presets,\n numberOfMonths = 2,\n placeholder = \"Pick a date range\",\n className,\n },\n ref,\n ) {\n const [internal, setInternal] = useState<DateRange | undefined>(defaultValue);\n\n const isControlled = value !== undefined;\n const range = isControlled ? value : internal;\n\n const setRange = (r?: DateRange) => {\n if (!isControlled) {\n setInternal(r);\n }\n // Always fire the callback so uncontrolled consumers can observe changes\n onValueChange?.(r);\n };\n\n const hasRange = Boolean(range?.from);\n const label = formatRange(range, placeholder);\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n variant=\"outline\"\n aria-haspopup=\"dialog\"\n className={cn(\n \"w-72 justify-start gap-2 text-start font-normal\",\n !hasRange && \"text-muted-foreground\",\n className,\n )}\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\" align=\"start\">\n {presets && presets.length > 0 ? (\n <div className=\"flex\">\n <div className=\"flex flex-col gap-1 border-r border-border p-2\">\n {presets.map((preset) => (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className=\"justify-start\"\n onClick={() => setRange(preset.getRange())}\n >\n {preset.label}\n </Button>\n ))}\n </div>\n <Calendar\n mode=\"range\"\n numberOfMonths={numberOfMonths}\n selected={range}\n onSelect={setRange}\n autoFocus\n />\n </div>\n ) : (\n <Calendar\n mode=\"range\"\n numberOfMonths={numberOfMonths}\n selected={range}\n onSelect={setRange}\n autoFocus\n />\n )}\n </PopoverContent>\n </Popover>\n );\n },\n);\n","// a2ui.exposed: yes\nimport { createContext, forwardRef, use, type HTMLAttributes } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nconst descriptionsVariants = cva(\"grid gap-x-6 gap-y-3 text-sm\", {\n variants: {\n columns: {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-1 sm:grid-cols-2\",\n 3: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n },\n },\n defaultVariants: {\n columns: 1,\n },\n});\n\ntype DescriptionsLayout = \"horizontal\" | \"vertical\";\n\ninterface DescriptionsContextValue {\n layout: DescriptionsLayout;\n}\n\nconst DescriptionsContext = createContext<DescriptionsContextValue>({ layout: \"horizontal\" });\n\nexport interface DescriptionsProps\n extends HTMLAttributes<HTMLDListElement>, VariantProps<typeof descriptionsVariants> {\n /**\n * Number of columns at the widest breakpoint. Collapses to a single column\n * on small screens. Default 1.\n */\n columns?: 1 | 2 | 3;\n /**\n * `horizontal` places the label beside the value; `vertical` stacks the\n * label above the value. Default `horizontal`.\n */\n layout?: DescriptionsLayout;\n}\n\n/**\n * Descriptions — a responsive definition list of label↔value pairs.\n *\n * Renders a native `<dl>`; compose with `DescriptionsItem` (`<dt>`/`<dd>`).\n * `columns` controls the grid; `layout` controls label placement per item.\n */\nexport const Descriptions = forwardRef<HTMLDListElement, DescriptionsProps>(function Descriptions(\n { columns = 1, layout = \"horizontal\", className, children, ...props },\n ref,\n) {\n return (\n <DescriptionsContext value={{ layout }}>\n <dl ref={ref} className={cn(descriptionsVariants({ columns }), className)} {...props}>\n {children}\n </dl>\n </DescriptionsContext>\n );\n});\n\nexport interface DescriptionsItemProps extends HTMLAttributes<HTMLDivElement> {\n /** The term / label for this entry. */\n label: React.ReactNode;\n /**\n * When the value is numeric, set this so the value uses `tabular-nums`\n * for aligned digits.\n */\n numeric?: boolean;\n}\n\n/**\n * DescriptionsItem — one label↔value pair (`<dt>` + `<dd>`) inside `Descriptions`.\n */\nexport const DescriptionsItem = forwardRef<HTMLDivElement, DescriptionsItemProps>(\n function DescriptionsItem({ label, numeric, className, children, ...props }, ref) {\n const { layout } = use(DescriptionsContext);\n return (\n <div\n ref={ref}\n className={cn(\n \"min-w-0\",\n layout === \"horizontal\" ? \"flex items-baseline gap-3\" : \"flex flex-col gap-0.5\",\n className,\n )}\n {...props}\n >\n <dt className={cn(\"text-muted-foreground\", layout === \"horizontal\" && \"w-1/3 shrink-0\")}>\n {label}\n </dt>\n <dd className={cn(\"min-w-0 break-words text-foreground\", numeric && \"tabular-nums\")}>\n {children}\n </dd>\n </div>\n );\n },\n);\n","import {\n forwardRef,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\nimport { cn } from \"../../lib/cn\";\n\nexport function Drawer({\n shouldScaleBackground = true,\n ...props\n}: ComponentProps<typeof DrawerPrimitive.Root>) {\n return <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />;\n}\nexport const DrawerTrigger = DrawerPrimitive.Trigger;\nexport const DrawerPortal = DrawerPrimitive.Portal;\nexport const DrawerClose = DrawerPrimitive.Close;\n\nconst DrawerOverlay = forwardRef<\n ElementRef<typeof DrawerPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>\n>(function DrawerOverlay({ className, ...props }, ref) {\n return (\n <DrawerPrimitive.Overlay\n ref={ref}\n className={cn(\"fixed inset-0 z-50 bg-foreground/50\", className)}\n {...props}\n />\n );\n});\n\nexport const DrawerContent = forwardRef<\n ElementRef<typeof DrawerPrimitive.Content>,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(function DrawerContent({ className, children, ...props }, ref) {\n return (\n <DrawerPortal>\n <DrawerOverlay />\n <DrawerPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col overscroll-contain rounded-t-xl border bg-card text-card-foreground\",\n className,\n )}\n {...props}\n >\n <div className=\"mx-auto mt-4 h-1.5 w-12 rounded-full bg-muted\" />\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n );\n});\n\nexport function DrawerHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"grid gap-1.5 p-4 text-center sm:text-start\", className)} {...props} />;\n}\nexport function DrawerFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)} {...props} />;\n}\nexport const DrawerTitle = forwardRef<\n ElementRef<typeof DrawerPrimitive.Title>,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>\n>(function DrawerTitle({ className, ...props }, ref) {\n return (\n <DrawerPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold\", className)}\n {...props}\n />\n );\n});\nexport const DrawerDescription = forwardRef<\n ElementRef<typeof DrawerPrimitive.Description>,\n ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(function DrawerDescription({ className, ...props }, ref) {\n return (\n <DrawerPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const DropdownMenu = DropdownMenuPrimitive.Root;\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub;\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nexport const DropdownMenuSubTrigger = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }\n>(function DropdownMenuSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-body outline-none transition-colors duration-fast focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ms-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\n\nexport const DropdownMenuSubContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(function DropdownMenuSubContent({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\n\nexport const DropdownMenuRadioItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(function DropdownMenuRadioItem({ className, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-body outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n});\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(function DropdownMenuCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-body outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\n\nexport const DropdownMenuContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(function DropdownMenuContent({ className, sideOffset = 6, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[10rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\n\nexport const DropdownMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }\n>(function DropdownMenuItem({ className, inset, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast\",\n \"focus:bg-accent focus:text-accent-foreground\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n \"[&_svg]:size-4 [&_svg]:shrink-0\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Label>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>\n>(function DropdownMenuLabel({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-xs font-semibold text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(function DropdownMenuSeparator({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n});\n\nexport function DropdownMenuShortcut({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn(\"ms-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n","/**\n * @deprecated Use `StatePanel kind=\"empty\"` from `@elabs-ai/components-ui` instead.\n * This wrapper is kept for back-compat and will be removed in a future release.\n */\nimport { type ReactNode } from \"react\";\nimport { StatePanel } from \"../state-panel/state-panel\";\n\nexport interface EmptyStateProps {\n title: ReactNode;\n description?: ReactNode;\n /** Optional icon/illustration shown above the title. */\n icon?: ReactNode;\n /** Primary/secondary actions. */\n actions?: ReactNode;\n className?: string;\n}\n\n/** @deprecated Use `<StatePanel kind=\"empty\" />` instead. */\nexport function EmptyState({ title, description, icon, actions, className }: EmptyStateProps) {\n return (\n <StatePanel\n kind=\"empty\"\n title={title}\n description={description}\n icon={icon}\n actions={actions}\n className={className}\n />\n );\n}\n","/**\n * @deprecated Use `StatePanel kind=\"error\"` from `@elabs-ai/components-ui` instead.\n * This wrapper is kept for back-compat and will be removed in a future release.\n */\nimport { type ReactNode } from \"react\";\nimport { StatePanel } from \"../state-panel/state-panel\";\n\nexport interface ErrorStateProps {\n title?: ReactNode;\n description?: ReactNode;\n /** Optional retry / support actions. */\n actions?: ReactNode;\n className?: string;\n}\n\n/** @deprecated Use `<StatePanel kind=\"error\" />` instead. */\nexport function ErrorState({ title, description, actions, className }: ErrorStateProps) {\n return (\n <StatePanel\n kind=\"error\"\n title={title}\n description={description}\n actions={actions}\n className={className}\n />\n );\n}\n","\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ElementRef,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { DialogBody, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"../dialog\";\nimport { useLocale } from \"../locale-provider\";\n\n/**\n * ExpandDialog — the one \"make this bigger\" modal: enlarged content on the\n * inline-start, its context on the inline-end.\n *\n * The shape was invented inside `@elabs-ai/components-charts`'\n * `ChartFrame` (chart left, data summary right) and then hand-rolled a second\n * and third time — a chat lightbox, an in-place CSS breakout in a consuming\n * app — because it was trapped in a package the other surfaces cannot import.\n * It lives here so every \"expand\" affordance in the system opens the SAME\n * two-pane surface: a chart, a table, an image, a document.\n *\n * It is a LAYOUT, not a viewer. What goes in each pane is the caller's\n * business; this component owns the dialog anatomy, the pane geometry, the\n * scroll ownership and the region labelling.\n */\n\n/**\n * The panes grid.\n *\n * `detailPlacement` picks the axis; `stackBelow` re-runs the same decision at a\n * breakpoint, because a 2.5fr/1fr split on a 375px viewport leaves the detail\n * pane about 107px wide — technically present, practically unreadable. The 2×4\n * compound matrix mirrors `cardDetailVariants` (`card.tsx`) so the two\n * detail-panel surfaces in this package resolve their tracks the same way.\n *\n * Track sizes arrive as CSS custom properties (`--expand-dialog-view-size` /\n * `--expand-dialog-detail-size`) rather than arbitrary-value classes, because a\n * runtime string cannot be a Tailwind class — the same technique `Card` uses\n * for `--card-detail-size`. The one pair of properties drives whichever axis is\n * active: columns when the detail is beside, rows when it is below.\n */\nexport const expandDialogPanesVariants = cva(\"grid min-h-0 gap-3 overflow-hidden\", {\n variants: {\n detailPlacement: { side: \"\", bottom: \"\" },\n /**\n * Below this breakpoint the panes stack, whatever `detailPlacement` says.\n * A no-op (documented, not an impossible state) when the detail is already\n * placed at the bottom.\n */\n stackBelow: { never: \"\", sm: \"\", md: \"\", lg: \"\" },\n },\n compoundVariants: [\n {\n detailPlacement: \"side\",\n stackBelow: \"never\",\n class:\n \"grid-cols-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] grid-rows-[minmax(0,1fr)]\",\n },\n {\n detailPlacement: \"side\",\n stackBelow: \"sm\",\n class:\n \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] sm:grid-cols-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] sm:grid-rows-[minmax(0,1fr)]\",\n },\n {\n detailPlacement: \"side\",\n stackBelow: \"md\",\n class:\n \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] md:grid-cols-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] md:grid-rows-[minmax(0,1fr)]\",\n },\n {\n detailPlacement: \"side\",\n stackBelow: \"lg\",\n class:\n \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] lg:grid-cols-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)] lg:grid-rows-[minmax(0,1fr)]\",\n },\n {\n detailPlacement: \"bottom\",\n stackBelow: \"never\",\n class: \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)]\",\n },\n {\n detailPlacement: \"bottom\",\n stackBelow: \"sm\",\n class: \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)]\",\n },\n {\n detailPlacement: \"bottom\",\n stackBelow: \"md\",\n class: \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)]\",\n },\n {\n detailPlacement: \"bottom\",\n stackBelow: \"lg\",\n class: \"grid-rows-[var(--expand-dialog-view-size)_var(--expand-dialog-detail-size)]\",\n },\n ],\n defaultVariants: { detailPlacement: \"side\", stackBelow: \"never\" },\n});\n\n/**\n * A scrollable pane.\n *\n * `tabIndex ?? 0` follows `DialogBody`'s shipped precedent: a scroll container\n * has to be keyboard-operable (WCAG 2.1.1, axe `scrollable-region-focusable`),\n * and a pane holding only text has no focusable child to scroll from. Pass\n * `tabIndex={-1}` when the pane always contains its own focusable content.\n */\nconst paneClass =\n \"min-h-0 min-w-0 overflow-auto overscroll-contain focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\";\n\nexport interface ExpandDialogPanesProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"children\">,\n VariantProps<typeof expandDialogPanesVariants> {\n /** The enlarged content — the reason the dialog opened. */\n children: ReactNode;\n /**\n * Context for what is in the view pane. Omit for a single-pane dialog: the\n * grid then renders one full-width track and no region wrapper at all.\n */\n detail?: ReactNode;\n /** Accessible name for the detail region. @default `t(\"ui.expandDialog.detail\")` */\n detailLabel?: string;\n /** View track size (any CSS length). @default `\"minmax(0, 2.5fr)\"` */\n viewSize?: string;\n /** Detail track size (any CSS length). @default `\"minmax(0, 1fr)\"` */\n detailSize?: string;\n /** Class on the view pane. */\n viewClassName?: string;\n /** Class on the detail pane. */\n detailClassName?: string;\n /** Tab index for the view pane. Pass `-1` when it owns focusable content. */\n viewTabIndex?: number;\n /** Tab index for the detail pane. Pass `-1` when it owns focusable content. */\n detailTabIndex?: number;\n}\n\n/**\n * The two-pane body. Usable on its own for a headerless surface (an image\n * lightbox), or via `ExpandDialog`, which supplies the dialog around it.\n */\nexport const ExpandDialogPanes = forwardRef<HTMLDivElement, ExpandDialogPanesProps>(\n function ExpandDialogPanes(\n {\n children,\n className,\n detail,\n detailClassName,\n detailLabel,\n detailPlacement = \"side\",\n detailSize = \"minmax(0, 1fr)\",\n detailTabIndex,\n stackBelow = \"never\",\n style,\n viewClassName,\n viewSize = \"minmax(0, 2.5fr)\",\n viewTabIndex,\n ...props\n },\n ref,\n ) {\n const { t } = useLocale();\n\n /*\n * The raised view floats on the recessed dialog field — structure by ground\n * offset plus elevation rather than a border, so it survives a theme swap\n * and the shadowless decoration dial (`shadow-ring-md` bakes the hairline\n * into the shadow's last layer, so nothing gains a second crisp stroke).\n */\n const view = (\n <div\n data-slot=\"expand-dialog-view\"\n tabIndex={viewTabIndex ?? 0}\n className={cn(paneClass, \"rounded-lg bg-card p-4 shadow-ring-md\", viewClassName)}\n >\n {children}\n </div>\n );\n\n // No detail → a single full-width track. Mirrors `Card`'s `detail == null`\n // path: the optional pane costs nothing when it is not asked for.\n if (detail == null) {\n return (\n <div\n ref={ref}\n data-slot=\"expand-dialog-panes\"\n className={cn(\"grid min-h-0 grid-rows-[minmax(0,1fr)] overflow-hidden\", className)}\n style={style}\n {...props}\n >\n {view}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n data-slot=\"expand-dialog-panes\"\n className={cn(expandDialogPanesVariants({ detailPlacement, stackBelow }), className)}\n style={\n {\n \"--expand-dialog-view-size\": viewSize,\n \"--expand-dialog-detail-size\": detailSize,\n ...style,\n } as CSSProperties\n }\n {...props}\n >\n {view}\n <div\n data-slot=\"expand-dialog-detail\"\n role=\"region\"\n aria-label={detailLabel ?? t(\"ui.expandDialog.detail\")}\n tabIndex={detailTabIndex ?? 0}\n className={cn(paneClass, detailClassName)}\n >\n {detail}\n </div>\n </div>\n );\n },\n);\n\nexport interface ExpandDialogHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Names the dialog. Rendered as the `<h2>` Radix labels the dialog by. */\n title: ReactNode;\n /** One line of supporting context under the title. */\n description?: ReactNode;\n /** Controls aligned to the inline end of the title row. */\n actions?: ReactNode;\n}\n\n/**\n * The dialog's title row.\n *\n * `pe-12` is load-bearing: Radix positions the close button absolutely in the\n * top inline-end corner, so without the padding a long title runs underneath\n * it.\n */\n// Not `forwardRef`: it renders `DialogHeader`, which is a plain function\n// component with no ref to forward (the base slot stays `dialog-header`).\nexport function ExpandDialogHeader({\n actions,\n className,\n description,\n title,\n ...props\n}: ExpandDialogHeaderProps) {\n return (\n <DialogHeader className={cn(\"shrink-0 border-b px-6 py-4 pe-12\", className)} {...props}>\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <DialogTitle className=\"truncate\">{title}</DialogTitle>\n {description ? <DialogDescription>{description}</DialogDescription> : null}\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-1\">{actions}</div> : null}\n </div>\n </DialogHeader>\n );\n}\n\nexport type ExpandDialogContentProps = ComponentPropsWithoutRef<typeof DialogContent>;\n\n/**\n * The full-bleed content box every expand surface uses.\n *\n * `size=\"full\"` plus a `DialogBody` child puts `DialogContent` into its\n * fixed-header regime (a 3-row grid, header pinned, body owning the scroll) —\n * the anatomy IS the switch, so nothing here hand-rolls a flex column.\n */\nexport const ExpandDialogContent = forwardRef<\n ElementRef<typeof DialogContent>,\n ExpandDialogContentProps\n>(function ExpandDialogContent({ className, ...props }, ref) {\n return <DialogContent ref={ref} size=\"full\" className={cn(\"p-0\", className)} {...props} />;\n});\n\nexport interface ExpandDialogProps\n extends\n Omit<ExpandDialogContentProps, \"title\" | \"children\">,\n Pick<ExpandDialogHeaderProps, \"title\" | \"description\" | \"actions\">,\n Pick<\n ExpandDialogPanesProps,\n | \"children\"\n | \"detail\"\n | \"detailClassName\"\n | \"detailLabel\"\n | \"detailPlacement\"\n | \"detailSize\"\n | \"detailTabIndex\"\n | \"stackBelow\"\n | \"viewClassName\"\n | \"viewSize\"\n | \"viewTabIndex\"\n > {\n /** Class on the panes grid. */\n panesClassName?: string;\n /** Class on the recessed field the panes sit in. */\n fieldClassName?: string;\n}\n\n/**\n * The batteries-included composition: content box → header → scroll body →\n * panes. Place it inside a `Dialog` you control:\n *\n * ```tsx\n * <Dialog open={open} onOpenChange={setOpen}>\n * <ExpandDialog title={chart.title} detail={<Summary />}>\n * <Chart />\n * </ExpandDialog>\n * </Dialog>\n * ```\n *\n * `Dialog`/`DialogTrigger` are deliberately NOT re-exported under an\n * `ExpandDialog*` name — they would be zero-behaviour aliases, and open state\n * is the consumer's already.\n */\nexport const ExpandDialog = forwardRef<ElementRef<typeof DialogContent>, ExpandDialogProps>(\n function ExpandDialog(\n {\n actions,\n children,\n className,\n description,\n detail,\n detailClassName,\n detailLabel,\n detailPlacement,\n detailSize,\n detailTabIndex,\n fieldClassName,\n panesClassName,\n stackBelow,\n title,\n viewClassName,\n viewSize,\n viewTabIndex,\n ...props\n },\n ref,\n ) {\n return (\n <ExpandDialogContent\n ref={ref}\n className={className}\n /*\n * With no description the dialog is still named by its title, so opt\n * out of `aria-describedby` explicitly rather than let Radix warn about\n * a missing description.\n */\n {...(description ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n <ExpandDialogHeader actions={actions} description={description} title={title} />\n {/* `tabIndex={-1}`: the panes below are the real scroll owners and take\n their own tab stops, so the body must not add a third. */}\n <DialogBody\n tabIndex={-1}\n className={cn(\"overflow-hidden bg-background p-3\", fieldClassName)}\n >\n <ExpandDialogPanes\n className={cn(\"h-full\", panesClassName)}\n detail={detail}\n detailClassName={detailClassName}\n detailLabel={detailLabel}\n detailPlacement={detailPlacement}\n detailSize={detailSize}\n detailTabIndex={detailTabIndex}\n stackBelow={stackBelow}\n viewClassName={viewClassName}\n viewSize={viewSize}\n viewTabIndex={viewTabIndex}\n >\n {children}\n </ExpandDialogPanes>\n </DialogBody>\n </ExpandDialogContent>\n );\n },\n);\n","import {\n cloneElement,\n forwardRef,\n useId,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cn } from \"../../lib/cn\";\nimport { Label } from \"../label\";\n\nexport interface FieldRowProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Field label — rendered as a real `<label>`, click-to-focus associated with the control. */\n label: ReactNode;\n /** Optional help/description text, always visible (not gated by an error). */\n description?: ReactNode;\n /**\n * Validation error text. When present: sets `aria-invalid` on the control,\n * is appended to `aria-describedby`, and is announced via `role=\"alert\"`.\n */\n error?: ReactNode;\n /**\n * The single field control (`Input`, `Textarea`, `Select`, …). Receives\n * `id`/`aria-describedby`/`aria-invalid` via a Radix `Slot` — must be a\n * single element that forwards those props to a real form control.\n */\n children: ReactElement;\n}\n\n/**\n * Label/description/error/`aria-describedby` wiring for a field OUTSIDE a\n * `react-hook-form` tree — the same anatomy as `FormItem`/`FormLabel`/\n * `FormControl`/`FormDescription`/`FormMessage` (`../form`), but driven by\n * plain props (`label`/`description`/`error`) instead of RHF field state, so\n * a single `useState`-controlled field doesn't need a full `<Form>` +\n * `<FormField>` + `Controller` just to get correct label/error association.\n *\n * Reach for `Form`/`FormField`/… instead when the field already lives inside\n * a `react-hook-form` `<FormProvider>` — this component does not replace that\n * family, it covers the gap outside it (#354).\n */\nexport const FieldRow = forwardRef<HTMLDivElement, FieldRowProps>(function FieldRow(\n { label, description, error, children, className, ...props },\n ref,\n) {\n const id = useId();\n const descriptionId = `${id}-description`;\n const errorId = `${id}-error`;\n\n // Radix `Slot` merges CHILD props OVER slot props, so a control that carries\n // its own `id` / `aria-describedby` (a perfectly ordinary `<Input id=\"email\">`)\n // silently wins — the `<Label htmlFor>` would then point at nothing and the\n // description/error would never be announced, defeating the one thing this\n // component exists to guarantee. So compose with the child's own values\n // instead of assuming they are absent, and clone the child with the composed\n // result so \"child wins\" resolves to the composed value either way.\n const control = children as ReactElement<{\n id?: string;\n \"aria-describedby\"?: string;\n }>;\n const childProps = control.props;\n const controlId = childProps.id ?? `${id}-control`;\n\n const describedBy =\n [\n childProps[\"aria-describedby\"] ?? null,\n description ? descriptionId : null,\n error ? errorId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n return (\n <div ref={ref} data-slot=\"field-row\" className={cn(\"space-y-2\", className)} {...props}>\n <Label\n htmlFor={controlId}\n data-slot=\"field-row-label\"\n className={cn(\n \"transition-colors duration-fast ease-standard\",\n error && \"text-destructive-text\",\n )}\n >\n {label}\n </Label>\n <Slot\n id={controlId}\n aria-describedby={describedBy}\n aria-invalid={!!error}\n data-slot=\"field-row-control\"\n >\n {cloneElement(control, { id: controlId, \"aria-describedby\": describedBy })}\n </Slot>\n {description ? (\n <p\n id={descriptionId}\n data-slot=\"field-row-description\"\n className=\"text-body text-muted-foreground\"\n >\n {description}\n </p>\n ) : null}\n {error ? (\n <p\n id={errorId}\n role=\"alert\"\n data-slot=\"field-row-error\"\n className=\"text-body font-medium text-destructive-text\"\n >\n {error}\n </p>\n ) : null}\n </div>\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Label = forwardRef<\n ElementRef<typeof LabelPrimitive.Root>,\n ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(function Label({ className, ...props }, ref) {\n return (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n );\n});\n","\"use client\";\n// a2ui.exposed: no\n\nimport {\n createContext,\n forwardRef,\n use,\n useCallback,\n useId,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { X, Upload, FileIcon, CheckCircle2, AlertCircle } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Progress } from \"../progress\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type FileUploadStatus = \"pending\" | \"uploading\" | \"success\" | \"error\";\n\nexport interface UploadFile {\n /** Unique identifier for this file in the list. */\n id: string;\n /** The underlying File object. */\n file: File;\n /** Upload progress 0–100. */\n progress?: number;\n /** Upload lifecycle status. */\n status?: FileUploadStatus;\n /** Error message shown when status is \"error\". */\n errorMessage?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface FileUploadContextValue {\n files: UploadFile[];\n addFiles: (incoming: File[]) => void;\n removeFile: (id: string) => void;\n isDragging: boolean;\n /** Programmatically open the native file picker. */\n openPicker: () => void;\n accept?: string;\n multiple?: boolean;\n maxSize?: number;\n maxFiles?: number;\n disabled?: boolean;\n inputId: string;\n}\n\nconst FileUploadContext = createContext<FileUploadContextValue | null>(null);\n\nfunction useFileUpload(): FileUploadContextValue {\n const ctx = use(FileUploadContext);\n if (!ctx) throw new Error(\"FileUpload subcomponents must be used inside <FileUpload>.\");\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Provider (FileUpload root)\n// ---------------------------------------------------------------------------\n\nexport interface FileUploadProps extends HTMLAttributes<HTMLDivElement> {\n /** Controlled file list. */\n files?: UploadFile[];\n /** Called when files are added or removed. */\n onFilesChange?: (files: UploadFile[]) => void;\n /** Accepted MIME types / extensions (forwarded to <input accept>). */\n accept?: string;\n /** Allow multiple files at once. */\n multiple?: boolean;\n /** Maximum individual file size in bytes. */\n maxSize?: number;\n /** Maximum number of files in the list at once. */\n maxFiles?: number;\n /** Disable all interactions. */\n disabled?: boolean;\n children?: ReactNode;\n}\n\n/**\n * FileUpload — compound-component root (Provider).\n *\n * Holds the selected-file list + drag state and exposes\n * `{ files, addFiles, removeFile, isDragging }` via context.\n * **Presentational** — the app drives per-item `progress` + `status` on\n * `<FileUploadItem>`. No upload/network logic lives here.\n *\n * Controlled via `files`/`onFilesChange`; uncontrolled by default.\n */\nexport const FileUpload = forwardRef<HTMLDivElement, FileUploadProps>(function FileUpload(\n {\n files: filesProp,\n onFilesChange,\n accept,\n multiple = false,\n maxSize,\n maxFiles,\n disabled = false,\n className,\n children,\n ...props\n },\n ref,\n) {\n const isControlled = filesProp !== undefined;\n const [internalFiles, setInternalFiles] = useState<UploadFile[]>([]);\n const [isDragging, setIsDragging] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const inputId = useId();\n\n const files = useMemo(\n () => (isControlled ? (filesProp ?? []) : internalFiles),\n [isControlled, filesProp, internalFiles],\n );\n\n const commit = useCallback(\n (next: UploadFile[]) => {\n if (!isControlled) setInternalFiles(next);\n onFilesChange?.(next);\n },\n [isControlled, onFilesChange],\n );\n\n const addFiles = useCallback(\n (incoming: File[]) => {\n const toAdd = incoming.filter((f) => {\n if (maxSize && f.size > maxSize) return false;\n return true;\n });\n\n const next = [...files];\n for (const f of toAdd) {\n if (maxFiles && next.length >= maxFiles) break;\n next.push({ id: `${f.name}-${Date.now()}-${Math.random()}`, file: f });\n }\n commit(next);\n },\n [files, maxSize, maxFiles, commit],\n );\n\n const removeFile = useCallback(\n (id: string) => {\n commit(files.filter((f) => f.id !== id));\n },\n [files, commit],\n );\n\n const openPicker = useCallback(() => {\n inputRef.current?.click();\n }, []);\n\n const handleInputChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n addFiles(Array.from(e.target.files));\n // Reset so the same file can be re-selected\n e.target.value = \"\";\n }\n },\n [addFiles],\n );\n\n const ctx = useMemo<FileUploadContextValue>(\n () => ({\n files,\n addFiles,\n removeFile,\n isDragging,\n openPicker,\n accept,\n multiple,\n maxSize,\n maxFiles,\n disabled,\n inputId,\n }),\n [\n files,\n addFiles,\n removeFile,\n isDragging,\n openPicker,\n accept,\n multiple,\n maxSize,\n maxFiles,\n disabled,\n inputId,\n ],\n );\n\n return (\n <FileUploadContext value={ctx}>\n <div\n ref={ref}\n data-slot=\"file-upload\"\n data-disabled={disabled || undefined}\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n >\n {/* Visually hidden real file input — always present for keyboard users */}\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n className=\"sr-only\"\n onChange={handleInputChange}\n />\n {/* Drag state setter lives here so any child drag interaction is captured */}\n <div\n onDragEnter={() => {\n if (!disabled) setIsDragging(true);\n }}\n onDragLeave={(e) => {\n // Only clear dragging when leaving the root container\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) {\n setIsDragging(false);\n }\n }}\n onDragOver={(e: DragEvent) => {\n e.preventDefault();\n }}\n onDrop={(e: DragEvent) => {\n e.preventDefault();\n setIsDragging(false);\n if (!disabled && e.dataTransfer.files.length > 0) {\n addFiles(Array.from(e.dataTransfer.files));\n }\n }}\n className=\"contents\"\n >\n {children}\n </div>\n </div>\n </FileUploadContext>\n );\n});\n\n// ---------------------------------------------------------------------------\n// FileUploadDropzone\n// ---------------------------------------------------------------------------\n\nexport interface FileUploadDropzoneProps extends HTMLAttributes<HTMLElement> {\n /** Label for the visually-hidden file picker link (for SR users). */\n browseLabel?: string;\n}\n\n/**\n * FileUploadDropzone — the drag-and-drop target.\n *\n * Uses a `<label>` wrapping the hidden `<input>` so the ENTIRE zone is ONE hit\n * target — no `<div onClick>`. Keyboard users get the Browse button as a\n * complementary path.\n */\nexport const FileUploadDropzone = forwardRef<HTMLElement, FileUploadDropzoneProps>(\n function FileUploadDropzone(\n { className, children, browseLabel = \"Browse files\", ...props },\n ref,\n ) {\n const { isDragging, disabled, inputId, openPicker } = useFileUpload();\n\n return (\n // label wraps the hidden input — clicking anywhere on the zone opens the picker\n <label\n ref={ref as React.Ref<HTMLLabelElement>}\n htmlFor={inputId}\n data-slot=\"file-upload-dropzone\"\n data-dragging={isDragging || undefined}\n data-disabled={disabled || undefined}\n className={cn(\n \"flex flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed border-border-strong bg-surface-muted px-6 py-10\",\n \"cursor-pointer transition-colors duration-fast\",\n \"hover:border-ring hover:bg-accent/50\",\n \"data-[dragging]:border-primary data-[dragging]:bg-primary/5\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n \"focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background\",\n className,\n )}\n {...props}\n >\n {children ?? (\n <>\n <div className=\"flex h-12 w-12 items-center justify-center rounded-full bg-muted\">\n <Upload className=\"size-5 text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n <div className=\"flex flex-col items-center gap-1 text-center\">\n <p className=\"text-sm font-medium text-foreground\">Drag & drop files here</p>\n <p className=\"text-xs text-muted-foreground\">\n or{\" \"}\n <button\n type=\"button\"\n disabled={disabled}\n onClick={(e) => {\n e.preventDefault();\n openPicker();\n }}\n className={cn(\n // #399 — inline text trigger inside a sentence → `-text` rung.\n \"text-primary-text underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n {browseLabel}\n </button>\n </p>\n </div>\n </>\n )}\n </label>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// FileUploadList\n// ---------------------------------------------------------------------------\n\nexport type FileUploadListProps = HTMLAttributes<HTMLUListElement>;\n\n/**\n * FileUploadList — the `role=\"status\"` region that lists accepted files.\n * Reads from context; children are `<FileUploadItem>` elements.\n */\nexport const FileUploadList = forwardRef<HTMLUListElement, FileUploadListProps>(\n function FileUploadList({ className, children, ...props }, ref) {\n const { files } = useFileUpload();\n if (files.length === 0 && !children) return null;\n\n return (\n <ul\n ref={ref}\n role=\"status\"\n aria-live=\"polite\"\n aria-label=\"Selected files\"\n data-slot=\"file-upload-list\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n >\n {children}\n </ul>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// FileUploadItem\n// ---------------------------------------------------------------------------\n\nexport interface FileUploadItemProps extends HTMLAttributes<HTMLLIElement> {\n /** The UploadFile entry to display. */\n uploadFile: UploadFile;\n /** Upload progress 0–100. Shown only during \"uploading\" status. */\n progress?: number;\n /** Current status of the upload. */\n status?: FileUploadStatus;\n /** Error message (displayed when status=\"error\"). */\n errorMessage?: string;\n}\n\nconst statusIcon: Record<FileUploadStatus, ReactNode> = {\n pending: <FileIcon className=\"size-4 text-muted-foreground\" aria-hidden=\"true\" />,\n uploading: <FileIcon className=\"size-4 text-primary\" aria-hidden=\"true\" />,\n success: <CheckCircle2 className=\"size-4 text-success\" aria-hidden=\"true\" />,\n error: <AlertCircle className=\"size-4 text-destructive\" aria-hidden=\"true\" />,\n};\n\n/**\n * FileUploadItem — a single row in the file list.\n *\n * The app controls `progress` and `status` to drive the upload lifecycle.\n * Per-file errors use `role=\"alert\"`.\n */\nexport const FileUploadItem = forwardRef<HTMLLIElement, FileUploadItemProps>(\n function FileUploadItem(\n { uploadFile, progress, status = \"pending\", errorMessage, className, ...props },\n ref,\n ) {\n const { removeFile, disabled } = useFileUpload();\n const resolvedProgress = progress ?? uploadFile.progress;\n const resolvedStatus = status ?? uploadFile.status ?? \"pending\";\n const resolvedError = errorMessage ?? uploadFile.errorMessage;\n\n const isUploading = resolvedStatus === \"uploading\";\n const isError = resolvedStatus === \"error\";\n\n return (\n <li\n ref={ref}\n data-slot=\"file-upload-item\"\n data-status={resolvedStatus}\n className={cn(\n \"flex flex-col gap-1 rounded-md border border-border bg-card px-3 py-2\",\n className,\n )}\n {...props}\n >\n <div className=\"flex items-center gap-2\">\n {statusIcon[resolvedStatus]}\n <span className=\"flex-1 min-w-0 truncate text-sm text-foreground\">\n {uploadFile.file.name}\n </span>\n <span className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">\n {formatFileSize(uploadFile.file.size)}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={`Remove ${uploadFile.file.name}`}\n disabled={disabled}\n onClick={() => removeFile(uploadFile.id)}\n className=\"shrink-0\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n </div>\n {isUploading && resolvedProgress !== undefined && (\n <Progress value={resolvedProgress} className=\"h-1\" />\n )}\n {isError && resolvedError && (\n <p role=\"alert\" className=\"text-xs text-destructive\">\n {resolvedError}\n </p>\n )}\n </li>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction formatFileSize(bytes: number): string {\n if (bytes < 1024) return `${bytes}\\u00A0B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}\\u00A0KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)}\\u00A0MB`;\n}\n\n// ---------------------------------------------------------------------------\n// useFileUpload export (for advanced consumers outside a subpart)\n// ---------------------------------------------------------------------------\nexport { useFileUpload };\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Tone vocabulary reused from `StatusBadge`/`Alert` (success/warning/destructive\n * on semantic tokens, #358) rather than reinvented. `default` keeps the fill\n * byte-identical (`bg-primary`) when `variant` is unset.\n */\nexport const progressIndicatorVariants = cva(\"size-full flex-1 transition-transform\", {\n variants: {\n variant: {\n default: \"bg-primary\",\n success: \"bg-success\",\n warning: \"bg-warning\",\n destructive: \"bg-destructive\",\n },\n },\n defaultVariants: { variant: \"default\" },\n});\n\nexport interface ProgressProps\n extends\n ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>,\n VariantProps<typeof progressIndicatorVariants> {}\n\n/**\n * Color must not be the only signal a guardrail tripped: set `aria-valuetext`\n * (e.g. `\"Exceeded — 120 of 100\"`) alongside a non-`default` `variant` — it\n * passes straight through to the underlying `role=\"progressbar\"` element via\n * `...props` (Radix's `ProgressPrimitive.Root` already supports it).\n */\nexport const Progress = forwardRef<ElementRef<typeof ProgressPrimitive.Root>, ProgressProps>(\n function Progress({ className, value, variant, ...props }, ref) {\n return (\n <ProgressPrimitive.Root\n ref={ref}\n value={value}\n className={cn(\"relative h-2 w-full overflow-hidden rounded-full bg-muted\", className)}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className={progressIndicatorVariants({ variant })}\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n );\n },\n);\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\nimport { cn } from \"../../lib/cn\";\nimport { Label } from \"../label\";\n\nexport const Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = { name: TName };\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nexport function FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(props: ControllerProps<TFieldValues, TName>) {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\nconst FormItemContext = createContext<{ id: string }>({} as { id: string });\n\nexport function useFormField() {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n const fieldState = getFieldState(fieldContext.name, formState);\n if (!fieldContext) throw new Error(\"useFormField should be used within <FormField>\");\n const { id } = itemContext;\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n}\n\nexport const FormItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function FormItem({ className, ...props }, ref) {\n const id = useId();\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n );\n },\n);\n\nexport const FormLabel = forwardRef<\n ElementRef<typeof Label>,\n ComponentPropsWithoutRef<typeof Label>\n>(function FormLabel({ className, ...props }, ref) {\n const { error, formItemId } = useFormField();\n return (\n <Label\n ref={ref}\n htmlFor={formItemId}\n className={cn(\n \"transition-colors duration-fast ease-standard\",\n error && \"text-destructive\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const FormControl = forwardRef<\n ElementRef<typeof Slot>,\n ComponentPropsWithoutRef<typeof Slot>\n>(function FormControl(props, ref) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}\n aria-invalid={!!error}\n {...props}\n />\n );\n});\n\nexport const FormDescription = forwardRef<\n HTMLParagraphElement,\n HTMLAttributes<HTMLParagraphElement>\n>(function FormDescription({ className, ...props }, ref) {\n const { formDescriptionId } = useFormField();\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n\nexport const FormMessage = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(\n function FormMessage({ className, children, ...props }, ref) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? \"\") : children;\n if (!body) return null;\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\n \"text-sm font-medium text-destructive animate-in fade-in slide-in-from-top-1 ease-entrance\",\n className,\n )}\n {...props}\n >\n {body}\n </p>\n );\n },\n);\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\nimport { cn } from \"../../lib/cn\";\n\nexport const HoverCard = HoverCardPrimitive.Root;\nexport const HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nexport const HoverCardContent = forwardRef<\n ElementRef<typeof HoverCardPrimitive.Content>,\n ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(function HoverCardContent({ className, align = \"center\", sideOffset = 4, ...props }, ref) {\n return (\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-64 rounded-md bg-popover p-4 text-popover-foreground shadow-ring-md outline-none\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n );\n});\n","import {\n forwardRef,\n useId,\n type ButtonHTMLAttributes,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport type { buttonVariants } from \"../button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../tooltip\";\n\n/** The icon-only size axis (a deliberate subset of `buttonVariants`' `size`). */\nexport type IconButtonSize = \"icon\" | \"icon-sm\" | \"icon-lg\";\n\nexport interface IconButtonProps\n extends\n Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"title\" | \"children\" | \"aria-label\" | \"aria-describedby\"\n >,\n Pick<VariantProps<typeof buttonVariants>, \"variant\"> {\n /**\n * Accessible name AND tooltip text — a single source of truth, so the two\n * can never drift out of sync (the failure this component exists to close:\n * `aria-label` and a tooltip's children set independently, most call sites\n * only setting one).\n */\n label: string;\n /** The glyph (typically a `lucide-react` element). */\n icon: ReactNode;\n /** Icon-only size axis. Default `\"icon\"`. */\n size?: IconButtonSize;\n /**\n * Shown appended to the tooltip text, and — independently — exposed via\n * `aria-describedby` through an `sr-only` node that is present whenever this\n * prop is (i.e. it does NOT depend on the tooltip being open, and it is not\n * rendered at all when there is no reason — so it can never be read as stray\n * text), so assistive tech gets the reason even while the button is disabled\n * (a disabled\n * `<button>` still exposes its ARIA attributes; it just isn't\n * focusable/hoverable itself, which is why the tooltip trigger wraps a\n * focusable `<span>` instead — see the render below).\n */\n disabledReason?: string;\n /** Tooltip placement. Default `\"top\"`. */\n side?: ComponentProps<typeof TooltipContent>[\"side\"];\n}\n\n/**\n * A single affordance for an icon-only control: `label` becomes both the\n * `aria-label` and the tooltip text, so they cannot diverge. Composes\n * `Button` + `Tooltip` — it does not reimplement either.\n *\n * Deliberately has **no `asChild`**: accepting one would dissolve the button\n * into a Radix `Slot` and break the tooltip-trigger wrapper below. A\n * link-styled icon button should compose `Button asChild` + `Tooltip`\n * directly instead.\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n {\n label,\n icon,\n variant = \"ghost\",\n size = \"icon\",\n disabled,\n disabledReason,\n side = \"top\",\n className,\n ...props\n },\n ref,\n) {\n const reasonId = useId();\n // The visible tooltip text always LEADS with `label` verbatim (never only\n // the reason), so it can never contradict the accessible name (WCAG 2.5.3\n // Label in Name) — the reason is appended context, not a replacement name.\n const tooltipText = disabledReason ? `${label} — ${disabledReason}` : label;\n\n return (\n // Self-provided so this works anywhere — a consumer shouldn't have to\n // remember to mount a global TooltipProvider for one icon button.\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n {/*\n * A disabled `Button` carries `pointer-events-none`, so hover never\n * reaches it and the tooltip would never open. Wrap the trigger\n * around a plain <span> instead of the <button> itself: it stays\n * hoverable always, and gains `tabIndex={0}` only while the inner\n * control is disabled (and therefore removed from the tab order),\n * so keyboard users can still reach the tooltip without a doubled\n * stop when the button is enabled.\n */}\n <span\n data-slot=\"icon-button\"\n tabIndex={disabled ? 0 : undefined}\n className={cn(\n \"inline-flex rounded-md\",\n // While disabled this span IS the focus target (the button is out\n // of the tab order), so it must carry the system's focus ring —\n // without this it falls back to the UA default outline, which is\n // a hardcoded browser blue identical in all three themes.\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n disabled && \"cursor-not-allowed\",\n )}\n >\n <Button\n ref={ref}\n variant={variant}\n size={size}\n disabled={disabled}\n {...props}\n // Computed AFTER the spread so a stray `aria-label`/`aria-describedby`\n // in `...props` can never win over the derived, single-source-of-truth\n // values (the type above already excludes both, this is defense in\n // depth for untyped/JS callers).\n aria-label={label}\n aria-describedby={disabledReason ? reasonId : undefined}\n data-slot=\"icon-button-control\"\n className={className}\n >\n {icon}\n </Button>\n </span>\n </TooltipTrigger>\n <TooltipContent side={side} data-slot=\"icon-button-tooltip\">\n {tooltipText}\n </TooltipContent>\n </Tooltip>\n {disabledReason ? (\n <span id={reasonId} data-slot=\"icon-button-description\" className=\"sr-only\">\n {disabledReason}\n </span>\n ) : null}\n </TooltipProvider>\n );\n});\n","import { forwardRef, useContext, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport { OTPInput, OTPInputContext } from \"input-otp\";\nimport { Minus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const InputOTP = forwardRef<\n ElementRef<typeof OTPInput>,\n ComponentPropsWithoutRef<typeof OTPInput>\n>(function InputOTP({ className, containerClassName, ...props }, ref) {\n return (\n <OTPInput\n ref={ref}\n containerClassName={cn(\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName,\n )}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n );\n});\n\nexport const InputOTPGroup = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n function InputOTPGroup({ className, ...props }, ref) {\n return <div ref={ref} className={cn(\"flex items-center\", className)} {...props} />;\n },\n);\n\nexport const InputOTPSlot = forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & { index: number }\n>(function InputOTPSlot({ index, className, ...props }, ref) {\n const ctx = useContext(OTPInputContext);\n const slot = ctx.slots[index];\n const { char, hasFakeCaret, isActive } = slot ?? {\n char: null,\n hasFakeCaret: false,\n isActive: false,\n };\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex size-9 items-center justify-center border-y border-e border-input text-sm shadow-sm transition-[color,border-color,box-shadow] duration-fast ease-standard first:rounded-s-md first:border-s last:rounded-e-md\",\n isActive && \"z-10 ring-2 ring-ring\",\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground\" />\n </div>\n )}\n </div>\n );\n});\n\nexport const InputOTPSeparator = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n function InputOTPSeparator(props, ref) {\n return (\n <div ref={ref} role=\"separator\" {...props}>\n <Minus className=\"size-4 text-muted-foreground\" />\n </div>\n );\n },\n);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/** Keyboard key hint, e.g. <Kbd>⌘K</Kbd>. */\nexport const Kbd = forwardRef<HTMLElement, HTMLAttributes<HTMLElement>>(function Kbd(\n { className, ...props },\n ref,\n) {\n return (\n <kbd\n translate=\"no\"\n ref={ref}\n className={cn(\n \"inline-flex h-5 min-w-5 select-none items-center justify-center gap-1 rounded border bg-muted px-1.5 font-mono text-[0.7rem] font-medium text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n});\n","\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Eye, EyeOff, Plus, X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Input } from \"../input\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface KeyValueRow {\n key: string;\n value: string;\n /**\n * Marks this row's value as sensitive: it renders masked (`type=\"password\"`)\n * with a reveal toggle, and is never surfaced in plain text via any\n * `title`/`aria-label`/`aria-valuetext`. Defaults to false (a plain,\n * unmasked key/value pair) — the consumer opts a row in explicitly.\n */\n secret?: boolean;\n}\n\nexport interface KeyValueEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /**\n * Controlled, ORDERED rows. An ordered `{ key, value, secret? }[]` is used\n * instead of `Record<string,string>` because a plain record can't\n * represent an in-progress duplicate key or preserve row order while the\n * user is mid-edit — both happen constantly while typing an env-var map.\n */\n value?: KeyValueRow[];\n /** Uncontrolled initial rows. */\n defaultValue?: KeyValueRow[];\n /** Called when the rows change (add, remove, or edit). */\n onValueChange?: (rows: KeyValueRow[]) => void;\n /** Placeholder for each row's key field. */\n keyPlaceholder?: string;\n /** Placeholder for each row's value field. */\n valuePlaceholder?: string;\n /** Label for the \"add row\" control. */\n addLabel?: ReactNode;\n /** Disables the whole editor. */\n disabled?: boolean;\n}\n\n/**\n * KeyValueEditor — key/value rows with per-row secret masking.\n *\n * Composes the existing `Input` + `Button` (icon vocabulary matches\n * `packages/ai/src/environment-variables.tsx`'s `Eye`/`EyeOff` reveal icons\n * for conceptual consistency, though this component lives in\n * `@elabs-ai/components-ui` — an EDITABLE settings-form primitive\n * is app UI, not the read-only agent tool-output display that\n * `EnvironmentVariables` is).\n *\n * A masked row uses the native `type=\"password\"` input (the correct\n * primitive for an EDITABLE masked field — unlike a read-only display, the\n * value must stay typable, and native masking is what keeps it that way\n * without hand-rolling bullet substitution). The reveal toggle's\n * `aria-label` never contains the secret text itself, and no `title`\n * attribute is ever set from row content.\n *\n * Controlled via `value`/`onValueChange`; uncontrolled via `defaultValue`.\n */\nexport const KeyValueEditor = forwardRef<HTMLDivElement, KeyValueEditorProps>(\n function KeyValueEditor(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n keyPlaceholder,\n valuePlaceholder,\n addLabel,\n disabled,\n className,\n ...props\n },\n ref,\n ) {\n const { t } = useLocale();\n const isControlled = valueProp !== undefined;\n const [internalRows, setInternalRows] = useState<KeyValueRow[]>(defaultValue ?? []);\n const rows = useMemo(\n () => (isControlled ? (valueProp ?? []) : internalRows),\n [isControlled, valueProp, internalRows],\n );\n // Reveal state is keyed by row index AND stamped with the exact value the\n // user chose to reveal. The index alone is NOT safe: the row list can be\n // re-ordered, prepended to, filtered, or left unchanged (a controlled\n // parent that rejects a removal) entirely OUTSIDE this component, and a\n // bare index would then point at a DIFFERENT row — unmasking a secret the\n // user never asked to see. Comparing the stamp against the row's current\n // value makes the check FAIL CLOSED: any row whose value is not exactly\n // the one that was revealed renders masked again.\n const [revealed, setRevealed] = useState<Map<number, string>>(() => new Map());\n\n const isRevealed = useCallback(\n (index: number, row: KeyValueRow) => revealed.get(index) === row.value,\n [revealed],\n );\n\n const commit = useCallback(\n (next: KeyValueRow[]) => {\n if (!isControlled) setInternalRows(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const addRow = useCallback(() => {\n commit([...rows, { key: \"\", value: \"\", secret: false }]);\n }, [rows, commit]);\n\n const updateRow = useCallback(\n (index: number, patch: Partial<KeyValueRow>) => {\n commit(rows.map((row, i) => (i === index ? { ...row, ...patch } : row)));\n // Typing into a row the user deliberately revealed must not re-mask it\n // mid-keystroke — re-stamp the snapshot with the new value, but ONLY\n // when the old stamp still matched (i.e. it really was revealed).\n if (patch.value !== undefined) {\n const nextValue = patch.value;\n setRevealed((prev) => {\n if (prev.get(index) !== rows[index]?.value) return prev;\n const next = new Map(prev);\n next.set(index, nextValue);\n return next;\n });\n }\n },\n [rows, commit],\n );\n\n const removeRow = useCallback(\n (index: number) => {\n commit(rows.filter((_, i) => i !== index));\n // Re-index revealed state so a shifted row never inherits a stale\n // reveal — dropping the removed index and shifting later ones down.\n // The value stamp above is the second line of defence: if the parent\n // rejects or rewrites the removal, the shifted stamps stop matching\n // and every row falls back to masked.\n setRevealed((prev) => {\n const next = new Map<number, string>();\n for (const [i, stamp] of prev) {\n if (i === index) continue;\n next.set(i > index ? i - 1 : i, stamp);\n }\n return next;\n });\n },\n [rows, commit],\n );\n\n const toggleReveal = useCallback((index: number, row: KeyValueRow) => {\n setRevealed((prev) => {\n const next = new Map(prev);\n if (next.get(index) === row.value) next.delete(index);\n else next.set(index, row.value);\n return next;\n });\n }, []);\n\n return (\n <div\n ref={ref}\n data-slot=\"key-value-editor\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n >\n {rows.length === 0 ? (\n <p data-slot=\"key-value-editor-empty\" className=\"text-body text-muted-foreground\">\n {t(\"ui.keyValueEditor.empty\")}\n </p>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {rows.map((row, index) => {\n const isSecret = row.secret === true;\n const rowRevealed = isRevealed(index, row);\n const masked = isSecret && !rowRevealed;\n return (\n <div\n key={index}\n data-slot=\"key-value-editor-row\"\n className=\"flex items-center gap-1\"\n >\n <Input\n data-slot=\"key-value-editor-key\"\n value={row.key}\n placeholder={keyPlaceholder}\n disabled={disabled}\n aria-label={t(\"ui.keyValueEditor.keyLabel\", { n: index + 1 })}\n onChange={(event) => updateRow(index, { key: event.target.value })}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"flex-1\"\n />\n <Input\n data-slot=\"key-value-editor-value\"\n type={masked ? \"password\" : \"text\"}\n value={row.value}\n placeholder={valuePlaceholder}\n disabled={disabled}\n aria-label={t(\"ui.keyValueEditor.valueLabel\", { n: index + 1 })}\n onChange={(event) => updateRow(index, { value: event.target.value })}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"flex-1\"\n />\n {isSecret && (\n <Button\n data-slot=\"key-value-editor-reveal\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={disabled}\n aria-label={t(\n rowRevealed ? \"ui.keyValueEditor.hide\" : \"ui.keyValueEditor.reveal\",\n { n: index + 1 },\n )}\n onClick={() => toggleReveal(index, row)}\n >\n {rowRevealed ? <EyeOff aria-hidden=\"true\" /> : <Eye aria-hidden=\"true\" />}\n </Button>\n )}\n <Button\n data-slot=\"key-value-editor-remove\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={disabled}\n aria-label={t(\"ui.keyValueEditor.removeRow\", { n: index + 1 })}\n onClick={() => removeRow(index)}\n >\n <X aria-hidden=\"true\" />\n </Button>\n </div>\n );\n })}\n </div>\n )}\n <Button\n data-slot=\"key-value-editor-add\"\n type=\"button\"\n variant=\"outline-subtle\"\n size=\"sm\"\n disabled={disabled}\n onClick={addRow}\n className=\"self-start\"\n >\n <Plus aria-hidden=\"true\" />\n {addLabel ?? t(\"ui.keyValueEditor.addRow\")}\n </Button>\n </div>\n );\n },\n);\n","\"use client\";\n\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { GlobeIcon } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Skeleton } from \"../skeleton/skeleton\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface LinkPreviewCardProps extends HTMLAttributes<HTMLDivElement> {\n /** Page title — the primary text, 1–2 lines. */\n title?: string;\n /** Short description / Open-Graph description. Omit for title+domain only. */\n description?: string;\n /**\n * Absolute URL of the thumbnail image (consumer-provided; the library never\n * fetches). Decorative — `alt` is always `\"\"`. Omit to hide the thumbnail\n * area cleanly (no broken-image placeholder).\n */\n image?: string;\n /**\n * Domain label shown with the globe icon, e.g. `\"github.com\"`. Wrapped in\n * `translate=\"no\"` so browsers never auto-translate identifiers.\n */\n domain?: string;\n /**\n * When set, the entire card becomes a keyboard-focusable link (stretched-link\n * pattern). The visible focus ring is placed on the card via `focus-within`.\n * Prefer a full absolute URL so the `<a>` is meaningful.\n */\n href?: string;\n /**\n * Render skeleton placeholders in lieu of real content. Sets `aria-busy=\"true\"`\n * on the card root so assistive technology knows the content is pending.\n */\n loading?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Thumbnail — hidden when `image` is absent (no broken-icon placeholder). */\nfunction Thumbnail({ image }: { image?: string }) {\n if (!image) return null;\n return (\n <div className=\"relative h-full w-28 shrink-0 overflow-hidden rounded-e-lg\">\n {/* explicit width/height prevent CLS; object-cover fills the container */}\n <img\n src={image}\n alt=\"\" // decorative; title carries meaning\n aria-hidden=\"true\"\n width={112}\n height={112}\n loading=\"lazy\"\n className=\"h-full w-full object-cover\"\n />\n </div>\n );\n}\n\n/** Skeleton layout matching the card shape. */\nfunction SkeletonLayout() {\n return (\n <div className=\"flex min-h-[5rem] gap-3 p-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-2 py-0.5\">\n {/* domain row */}\n <Skeleton className=\"h-3 w-24\" />\n {/* title — two lines */}\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n {/* description */}\n <Skeleton className=\"mt-1 h-3 w-full\" />\n <Skeleton className=\"h-3 w-5/6\" />\n </div>\n {/* thumbnail placeholder */}\n <Skeleton className=\"h-20 w-28 shrink-0 rounded-md\" />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// LinkPreviewCard\n// ---------------------------------------------------------------------------\n\n/**\n * A rich, presentational link-preview card (unfurled URL / bookmark block).\n * Renders favicon/domain, title, description, and an optional thumbnail from\n * **consumer-provided** metadata — the library never fetches.\n *\n * States: `loading` (skeleton), loaded (full), no-image, no-description\n * (title + domain only), and empty/error (degrades to a plain placeholder).\n *\n * Pass `href` to make the whole card a keyboard-focusable stretched link.\n * Use `loading` for the skeleton state; set `aria-busy` is applied automatically.\n */\nexport const LinkPreviewCard = forwardRef<HTMLDivElement, LinkPreviewCardProps>(\n function LinkPreviewCard(\n { className, title, description, image, domain, href, loading = false, children, ...props },\n ref,\n ) {\n return (\n <div\n ref={ref}\n aria-busy={loading || undefined}\n className={cn(\n // Base card chrome — rounded border, card surface, subtle shadow\n \"relative overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm\",\n // Stretched-link focus ring: when `href` is present the inner <a>\n // covers the whole card; the ring is painted on the card container via\n // focus-within so the outer border gets the visible ring, not the\n // hidden absolutely-positioned link.\n // When `href` is present: stretched-link focus ring (via focus-within on\n // the container, not the <a>) + hover lift + motion-tokened transition.\n href &&\n \"cursor-pointer transition-[translate,box-shadow,border-color] duration-fast ease-standard focus-within:outline-none focus-within:ring-2 focus-within:ring-ring hover:-translate-y-0.5 hover:border-ring/40 hover:shadow-md motion-reduce:hover:translate-y-0\",\n className,\n )}\n {...props}\n >\n {loading ? (\n <SkeletonLayout />\n ) : (\n <div className=\"flex min-h-[5rem] gap-0\">\n {/* Main content */}\n <div className=\"flex min-w-0 flex-1 flex-col justify-center gap-1.5 p-3\">\n {/* Domain row */}\n {domain && (\n <p className=\"flex items-center gap-1.5 text-meta text-muted-foreground\">\n <GlobeIcon aria-hidden=\"true\" className=\"size-3 shrink-0\" />\n {/* translate=\"no\" so browsers never auto-translate domain identifiers */}\n <span className=\"truncate\" translate=\"no\">\n {domain}\n </span>\n </p>\n )}\n\n {/* Title */}\n {title && (\n <p className=\"line-clamp-2 min-w-0 text-body font-medium leading-snug\">\n {href ? (\n /*\n * Stretched-link pattern: `<a>` is absolutely positioned to\n * cover the entire card (after:absolute after:inset-0). The\n * visible focus ring lives on the card container via\n * focus-within (above). `focus-visible:outline-none` removes\n * the browser's own ring on the link so it doesn't double up.\n */\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"after:absolute after:inset-0 focus-visible:outline-none\"\n >\n {title}\n </a>\n ) : (\n title\n )}\n </p>\n )}\n\n {/* Description */}\n {description && (\n <p className=\"line-clamp-2 min-w-0 text-caption text-muted-foreground\">\n {description}\n </p>\n )}\n\n {children}\n </div>\n\n {/* Thumbnail — conditionally rendered */}\n <Thumbnail image={image} />\n </div>\n )}\n </div>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// LinkPreview alias\n// ---------------------------------------------------------------------------\n\n/**\n * Convenience alias for `LinkPreviewCard`. Identical component — use whichever\n * name reads more naturally at the call site.\n *\n * `LinkPreviewCard` is the canonical export; `LinkPreview` is the alias.\n */\nexport const LinkPreview = LinkPreviewCard;\n","\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { ChevronDown, ChevronUp, Plus, X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { Input } from \"../input\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface ListEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** Controlled list of strings. */\n value?: string[];\n /** Uncontrolled initial list of strings. */\n defaultValue?: string[];\n /** Called when the list changes (add, remove, edit, or reorder). */\n onValueChange?: (value: string[]) => void;\n /**\n * Whether rows can be reordered via move-up/move-down buttons. Default\n * true. Reordering is keyboard-operable (real buttons), never drag-only.\n */\n reorderable?: boolean;\n /** Placeholder shown in each row's text field. */\n placeholder?: string;\n /** Maximum number of rows allowed. */\n max?: number;\n /** Whether the editor is disabled. */\n disabled?: boolean;\n /** Label for the \"add item\" control. */\n addLabel?: ReactNode;\n}\n\n/**\n * ListEditor — one `Input` per row over a `string[]`, with add / remove /\n * keyboard-operable reorder (move-up/move-down buttons, not drag-and-drop —\n * no drag library exists in the monorepo and none should be added for this).\n *\n * Controlled via `value`/`onValueChange`; uncontrolled via `defaultValue`.\n */\nexport const ListEditor = forwardRef<HTMLDivElement, ListEditorProps>(function ListEditor(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n reorderable = true,\n placeholder,\n max,\n disabled,\n addLabel,\n className,\n ...props\n },\n ref,\n) {\n const { t } = useLocale();\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<string[]>(defaultValue ?? []);\n const rows = useMemo(\n () => (isControlled ? (valueProp ?? []) : internalValue),\n [isControlled, valueProp, internalValue],\n );\n\n const commit = useCallback(\n (next: string[]) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const addRow = useCallback(() => {\n if (max !== undefined && rows.length >= max) return;\n commit([...rows, \"\"]);\n }, [rows, max, commit]);\n\n const updateRow = useCallback(\n (index: number, next: string) => {\n commit(rows.map((row, i) => (i === index ? next : row)));\n },\n [rows, commit],\n );\n\n const removeRow = useCallback(\n (index: number) => {\n commit(rows.filter((_, i) => i !== index));\n },\n [rows, commit],\n );\n\n const moveRow = useCallback(\n (index: number, direction: -1 | 1) => {\n const target = index + direction;\n if (target < 0 || target >= rows.length) return;\n const next = [...rows];\n const [moved] = next.splice(index, 1);\n next.splice(target, 0, moved!);\n commit(next);\n },\n [rows, commit],\n );\n\n const atMax = max !== undefined && rows.length >= max;\n\n return (\n <div\n ref={ref}\n data-slot=\"list-editor\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n >\n {rows.length === 0 ? (\n <p data-slot=\"list-editor-empty\" className=\"text-body text-muted-foreground\">\n {t(\"ui.listEditor.empty\")}\n </p>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {rows.map((row, index) => (\n <div key={index} data-slot=\"list-editor-row\" className=\"flex items-center gap-1\">\n <Input\n data-slot=\"list-editor-item\"\n value={row}\n placeholder={placeholder}\n disabled={disabled}\n aria-label={t(\"ui.listEditor.itemLabel\", { n: index + 1 })}\n onChange={(event) => updateRow(index, event.target.value)}\n className=\"flex-1\"\n />\n {reorderable && (\n <>\n <Button\n data-slot=\"list-editor-move-up\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={disabled || index === 0}\n aria-label={t(\"ui.listEditor.moveUp\", { n: index + 1 })}\n onClick={() => moveRow(index, -1)}\n >\n <ChevronUp aria-hidden=\"true\" />\n </Button>\n <Button\n data-slot=\"list-editor-move-down\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={disabled || index === rows.length - 1}\n aria-label={t(\"ui.listEditor.moveDown\", { n: index + 1 })}\n onClick={() => moveRow(index, 1)}\n >\n <ChevronDown aria-hidden=\"true\" />\n </Button>\n </>\n )}\n <Button\n data-slot=\"list-editor-remove\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={disabled}\n aria-label={t(\"ui.listEditor.removeItem\", { n: index + 1 })}\n onClick={() => removeRow(index)}\n >\n <X aria-hidden=\"true\" />\n </Button>\n </div>\n ))}\n </div>\n )}\n <Button\n data-slot=\"list-editor-add\"\n type=\"button\"\n variant=\"outline-subtle\"\n size=\"sm\"\n disabled={disabled || atMax}\n onClick={addRow}\n className=\"self-start\"\n >\n <Plus aria-hidden=\"true\" />\n {addLabel ?? t(\"ui.listEditor.addItem\")}\n </Button>\n </div>\n );\n});\n","/**\n * @deprecated Use `StatePanel kind=\"loading\"` from `@elabs-ai/components-ui` instead.\n * This wrapper is kept for back-compat and will be removed in a future release.\n */\nimport { type ReactNode } from \"react\";\nimport { StatePanel } from \"../state-panel/state-panel\";\n\nexport interface LoadingStateProps {\n /** Accessible status label. Defaults to \"Loading…\". */\n label?: ReactNode;\n /** Visual size of the spinner. */\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n}\n\n/** @deprecated Use `<StatePanel kind=\"loading\" />` instead. */\nexport function LoadingState({ label = \"Loading…\", size = \"md\", className }: LoadingStateProps) {\n return (\n <StatePanel\n kind=\"loading\"\n loadingLabel={typeof label === \"string\" ? label : undefined}\n size={size}\n className={className}\n />\n );\n}\n","import { type HTMLAttributes, type ReactNode, forwardRef, Fragment } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/** A half-open `[start, end)` character range within the text. */\nexport type MatchRange = readonly [number, number];\n\nexport interface MatchHighlightProps extends HTMLAttributes<HTMLSpanElement> {\n /** The full string to render. */\n text: string;\n /**\n * One or more needles to highlight. Case-insensitive by default. Ignored when\n * `ranges` is supplied.\n */\n query?: string | string[];\n /**\n * Precomputed match ranges (e.g. from a fuzzy matcher / MiniSearch). Wins over\n * `query` when supplied. Overlapping and adjacent ranges are merged.\n */\n ranges?: readonly MatchRange[];\n /** Match `query` case-sensitively. @default false */\n caseSensitive?: boolean;\n /**\n * Which mark is the CURRENT one, 0-based among the resolved (merged, sorted)\n * ranges. `-1` or omitted means none is.\n *\n * \"One of twelve\" and \"the one you are on\" are different meanings, so the\n * current mark gets its own token pair rather than an opacity tweak — and,\n * because colour is never the only channel (WCAG 1.4.1), an outline and\n * `aria-current=\"true\"` as well. It also carries `data-active`, which is how\n * a caller finds it to scroll it into view:\n * `root.querySelector('[data-slot=\"match-highlight-mark\"][data-active]')`.\n */\n activeIndex?: number;\n}\n\nconst escapeRegExp = (s: string): string => s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/**\n * Find every occurrence of each needle in `text` and return their `[start, end)`\n * ranges. Uses a per-needle global regex so indices land on the ORIGINAL string\n * (unicode-safe — no `toLowerCase()` length drift), handling multiple needles and\n * case folding. Empty needles are ignored.\n */\nexport function queryToRanges(\n text: string,\n query: string | string[],\n caseSensitive = false,\n): MatchRange[] {\n const needles = (Array.isArray(query) ? query : [query]).filter((q) => q.length > 0);\n if (needles.length === 0 || text.length === 0) return [];\n const flags = caseSensitive ? \"gu\" : \"giu\";\n const out: MatchRange[] = [];\n for (const needle of needles) {\n let re: RegExp;\n try {\n re = new RegExp(escapeRegExp(needle), flags);\n } catch {\n continue; // pathological needle — skip rather than throw\n }\n for (const m of text.matchAll(re)) {\n if (m.index === undefined) continue;\n const end = m.index + m[0].length;\n if (end > m.index) out.push([m.index, end]);\n }\n }\n return out;\n}\n\n/**\n * Clamp ranges to `[0, len)`, drop empty/invalid ones, sort, and merge\n * overlapping AND adjacent ranges (so `[0,2]` + `[2,4]` → a single `[0,4]`).\n */\nexport function normalizeRanges(ranges: readonly MatchRange[], len: number): MatchRange[] {\n const clamped = ranges\n .map(([a, b]): MatchRange => [Math.max(0, Math.min(a, b)), Math.min(len, Math.max(a, b))])\n .filter(([a, b]) => a < b);\n clamped.sort((x, y) => x[0] - y[0] || x[1] - y[1]);\n const merged: [number, number][] = [];\n for (const [a, b] of clamped) {\n const last = merged[merged.length - 1];\n if (last && a <= last[1]) {\n last[1] = Math.max(last[1], b);\n } else {\n merged.push([a, b]);\n }\n }\n return merged;\n}\n\n/**\n * Render `text` with the query matches wrapped in real `<mark>` elements. Purely\n * presentational: pass `query` to let it compute ranges (case-insensitive by\n * default), or `ranges` from your own fuzzy engine. Marks use the semantic\n * `--highlight` token pair (AA-legible ink in every theme). Screen readers read\n * the full string naturally.\n */\nexport const MatchHighlight = forwardRef<HTMLSpanElement, MatchHighlightProps>(\n function MatchHighlight(\n { text, query, ranges, caseSensitive = false, activeIndex = -1, className, ...props },\n ref,\n ) {\n const resolved = normalizeRanges(\n ranges ?? (query != null ? queryToRanges(text, query, caseSensitive) : []),\n text.length,\n );\n\n const segments: ReactNode[] = [];\n let cursor = 0;\n resolved.forEach(([start, end], index) => {\n if (start > cursor) {\n segments.push(<Fragment key={`t${cursor}`}>{text.slice(cursor, start)}</Fragment>);\n }\n const active = index === activeIndex;\n segments.push(\n <mark\n key={`m${start}`}\n data-slot=\"match-highlight-mark\"\n // Present-or-absent, so the current mark is still identifiable in\n // greyscale and to a screen reader — the colour swap below is the\n // enhancement, not the signal (WCAG 1.4.1).\n data-active={active ? \"\" : undefined}\n aria-current={active ? \"true\" : undefined}\n className={cn(\n \"rounded-sm px-0.5 font-medium\",\n active\n ? \"outline-foreground bg-highlight-active text-highlight-active-foreground outline-2 outline-offset-1\"\n : \"bg-highlight text-highlight-foreground\",\n )}\n >\n {text.slice(start, end)}\n </mark>,\n );\n cursor = end;\n });\n if (cursor < text.length) {\n segments.push(<Fragment key={`t${cursor}`}>{text.slice(cursor)}</Fragment>);\n }\n\n return (\n <span ref={ref} data-slot=\"match-highlight\" className={cn(className)} {...props}>\n {segments}\n </span>\n );\n },\n);\n","\"use client\";\n\nimport {\n createContext,\n forwardRef,\n use,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n type TextareaHTMLAttributes,\n} from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cn } from \"../../lib/cn\";\nimport { mergeRefs } from \"../../lib/merge-refs\";\nimport { useLocale } from \"../locale-provider\";\nimport { Popover, PopoverAnchor, PopoverContent } from \"../popover\";\nimport { Textarea } from \"../textarea\";\nimport {\n defaultMentionFilter,\n insertMention,\n mentionAt,\n mentionEnd,\n remapMentions,\n type Mention,\n type MentionOption,\n type MentionValue,\n} from \"./mention-value\";\n\nexport type { Mention, MentionOption, MentionValue };\n\nconst EMPTY_VALUE: MentionValue = { text: \"\", mentions: [] };\n\n// ---------------------------------------------------------------------------\n// Context — state / actions / meta (component-api.md provider-injection shape)\n// ---------------------------------------------------------------------------\n\nexport interface MentionInputContextValue {\n state: {\n value: MentionValue;\n /** The in-progress query WITHOUT the trigger char; `null` when closed. */\n query: string | null;\n open: boolean;\n /** Index into `filtered`; `-1` when nothing is highlighted. */\n activeIndex: number;\n /** DOM id of the highlighted option; `undefined` when nothing is. */\n activeId?: string;\n filtered: MentionOption[];\n };\n actions: {\n insert: (option: MentionOption) => void;\n close: () => void;\n setActiveIndex: (index: number) => void;\n };\n meta: {\n trigger: string;\n listId: string;\n /**\n * The id `MentionInputTextarea` puts on its element. Advisory only — with\n * `asChild`, Radix `Slot` lets a consumer-supplied `id` on the child win\n * (child props are merged OVER slot props), so the component itself never\n * resolves the field through this id; it holds a real ref.\n */\n textareaId: string;\n optionId: (index: number) => string;\n };\n}\n\nconst MentionInputContext = createContext<MentionInputContextValue | null>(null);\n\n/** Read the surrounding `MentionInput`'s state, actions and ids. */\nexport function useMentionInput(): MentionInputContextValue {\n const ctx = use(MentionInputContext);\n if (!ctx) {\n throw new Error(\"useMentionInput must be used inside a <MentionInput>.\");\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Query detection\n// ---------------------------------------------------------------------------\n\n/** A trigger only starts a query at the start of a word — never inside one. */\nfunction isWordBoundary(text: string, index: number): boolean {\n if (index === 0) return true;\n const previous = text[index - 1] ?? \"\";\n return /\\s/.test(previous) || previous === \"(\" || previous === \"[\";\n}\n\n/**\n * Is the caret currently sitting in a `trigger + query` run?\n *\n * Derived from the committed text + caret rather than intercepted at keydown,\n * on purpose: a keydown-driven trigger would have to `preventDefault()` every\n * printable character and re-insert it by hand, which is exactly what destroys\n * IME composition, native undo, spellcheck and paste — the things a real\n * `<textarea>` gives us for free. Deriving instead means the popup opens\n * identically whether the trigger arrived by typing, pasting, an IME commit or\n * a mouse click that moved the caret back into a half-typed query.\n */\nfunction findQuery(\n value: MentionValue,\n caret: number,\n trigger: string,\n): { start: number; query: string } | null {\n const { text } = value;\n if (caret < trigger.length) return null;\n const start = text.lastIndexOf(trigger, caret - trigger.length);\n if (start < 0) return null;\n\n const query = text.slice(start + trigger.length, caret);\n if (/\\s/.test(query)) return null;\n if (!isWordBoundary(text, start)) return null;\n // The trigger char of an ALREADY-inserted mention must not re-open the popup.\n if (mentionAt(value, start, trigger)) return null;\n\n return { start, query };\n}\n\n/** Next enabled index in `list`, wrapping; `-1` when none is selectable. */\nfunction step(list: MentionOption[], from: number, direction: 1 | -1): number {\n const count = list.length;\n if (count === 0) return -1;\n for (let i = 1; i <= count; i++) {\n const index = (((from + direction * i) % count) + count) % count;\n if (!list[index]?.disabled) return index;\n }\n return -1;\n}\n\nfunction firstEnabled(list: MentionOption[]): number {\n const index = list.findIndex((o) => !o.disabled);\n return index;\n}\n\nfunction lastEnabled(list: MentionOption[]): number {\n for (let i = list.length - 1; i >= 0; i--) {\n if (!list[i]?.disabled) return i;\n }\n return -1;\n}\n\n// ---------------------------------------------------------------------------\n// Caret / overlay mirror\n// ---------------------------------------------------------------------------\n\n/**\n * Computed properties the mirror has to copy verbatim for its glyph metrics to\n * land on the same pixels as the textarea's. Anything that changes where a\n * character starts belongs here.\n */\nconst MIRRORED_PROPERTIES = [\n \"boxSizing\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"fontFamily\",\n \"fontSize\",\n \"fontWeight\",\n \"fontStyle\",\n \"fontVariant\",\n \"fontStretch\",\n \"fontFeatureSettings\",\n \"fontVariationSettings\",\n \"letterSpacing\",\n \"lineHeight\",\n \"textTransform\",\n \"textIndent\",\n \"wordSpacing\",\n \"textAlign\",\n \"direction\",\n \"tabSize\",\n // Wrapping, copied rather than assumed: forcing `word-break: break-word` when\n // the field says `normal` breaks long words one line early in the mirror.\n \"whiteSpace\",\n \"overflowWrap\",\n \"wordBreak\",\n] as const satisfies readonly (keyof CSSStyleDeclaration & string)[];\n\nfunction readMirrorStyle(textarea: HTMLTextAreaElement): CSSProperties {\n const computed = getComputedStyle(textarea);\n const style: Record<string, string | number> = {};\n for (const property of MIRRORED_PROPERTIES) {\n style[property] = computed[property] as string;\n }\n\n const borderX =\n Number.parseFloat(computed.borderLeftWidth || \"0\") +\n Number.parseFloat(computed.borderRightWidth || \"0\");\n // Whatever the box is wider than its content area, minus the borders, is the\n // vertical scrollbar. Fold it into the padding or every wrapped line in the\n // mirror breaks a few characters later than it does in the field.\n const scrollbar = Math.max(0, textarea.offsetWidth - textarea.clientWidth - borderX);\n\n return {\n ...(style as CSSProperties),\n position: \"absolute\",\n left: textarea.offsetLeft,\n top: textarea.offsetTop,\n width: textarea.offsetWidth,\n height: textarea.offsetHeight,\n paddingRight: Number.parseFloat(computed.paddingRight || \"0\") + scrollbar,\n borderStyle: \"solid\",\n borderColor: \"transparent\",\n // A textarea already computes `pre-wrap`; the fallback only covers a host\n // that reset it, and an environment (jsdom) that resolves nothing.\n whiteSpace: computed.whiteSpace || \"pre-wrap\",\n overflow: \"hidden\",\n margin: 0,\n };\n}\n\n/** Split the text into plain runs and mention runs, in document order. */\nfunction buildRuns(\n value: MentionValue,\n trigger: string,\n): Array<{ key: string; text: string; mention?: Mention }> {\n const runs: Array<{ key: string; text: string; mention?: Mention }> = [];\n const ordered = [...value.mentions].sort((a, b) => a.start - b.start);\n let cursor = 0;\n for (const mention of ordered) {\n if (mention.start > cursor) {\n runs.push({ key: `t${cursor}`, text: value.text.slice(cursor, mention.start) });\n }\n const end = mentionEnd(mention, trigger);\n runs.push({ key: `m${mention.start}`, text: value.text.slice(mention.start, end), mention });\n cursor = end;\n }\n if (cursor < value.text.length) {\n runs.push({ key: `t${cursor}`, text: value.text.slice(cursor) });\n }\n return runs;\n}\n\n// ---------------------------------------------------------------------------\n// MentionInput (root + provider + Popover)\n// ---------------------------------------------------------------------------\n\nexport interface MentionInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** The roster the popup offers. */\n options: MentionOption[];\n /** Controlled value. */\n value?: MentionValue;\n /** Uncontrolled initial value. */\n defaultValue?: MentionValue;\n /** Called with the whole value whenever text or mentions change. */\n onValueChange?: (value: MentionValue) => void;\n /** Trigger character. Default `\"@\"`. */\n trigger?: string;\n /**\n * Which options survive the current query. Defaults to\n * `defaultMentionFilter`; pass `() => true` when the roster is fetched\n * app-side from `onQueryChange`.\n */\n filter?: (option: MentionOption, query: string) => boolean;\n /** The query changed. `null` means the popup closed. */\n onQueryChange?: (query: string | null) => void;\n /** Controlled popup state. */\n open?: boolean;\n /** Called when the popup wants to open or close. */\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n}\n\n/**\n * MentionInput — an `@`-mention text field built on a real `<textarea>`.\n *\n * The field stays a native textarea (so IME, paste, undo, spellcheck, mobile\n * keyboards and `FormData` all keep working) and mentions are tracked as\n * offsets beside it. The suggestion popup is this component's own listbox\n * driven by `aria-activedescendant`, so **focus never leaves the textarea** —\n * a popup that took focus would take the caret with it.\n */\nexport const MentionInput = forwardRef<HTMLDivElement, MentionInputProps>(function MentionInput(\n {\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n trigger = \"@\",\n filter = defaultMentionFilter,\n onQueryChange,\n open: openProp,\n onOpenChange,\n className,\n children,\n ...props\n },\n ref,\n) {\n const uid = useId();\n const listId = `${uid}-listbox`;\n const textareaId = `${uid}-textarea`;\n const optionId = useCallback((index: number) => `${uid}-option-${index}`, [uid]);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMemo(() => mergeRefs<HTMLDivElement>(ref, rootRef), [ref]);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n // ------------------------------------------------------------------\n // Controlled / uncontrolled value\n // ------------------------------------------------------------------\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<MentionValue>(defaultValue ?? EMPTY_VALUE);\n const value = isControlled ? valueProp : internalValue;\n\n const commit = useCallback(\n (next: MentionValue) => {\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n // ------------------------------------------------------------------\n // Caret\n // ------------------------------------------------------------------\n const [caret, setCaret] = useState(() => (defaultValue?.text ?? \"\").length);\n const pendingCaretRef = useRef<number | null>(null);\n\n const applyCaret = useCallback((position: number) => {\n pendingCaretRef.current = position;\n setCaret(position);\n // Pure caret moves change no value, so React may skip the re-render that\n // would flush `pendingCaretRef` — set it here as well. Value changes still\n // need the post-commit pass below, because React writes the new `value`\n // into the DOM after this point and that resets the selection.\n textareaRef.current?.setSelectionRange(position, position);\n }, []);\n\n useLayoutEffect(() => {\n const position = pendingCaretRef.current;\n if (position === null) return;\n pendingCaretRef.current = null;\n textareaRef.current?.setSelectionRange(position, position);\n });\n\n // ------------------------------------------------------------------\n // Query / open state\n // ------------------------------------------------------------------\n const queryInfo = useMemo(() => findQuery(value, caret, trigger), [value, caret, trigger]);\n\n // Escape (and an outside dismissal) suppress the popup for the run it was\n // dismissed on, without touching the text — the query is still there, the\n // user just said they are done with the roster for now.\n const [dismissedStart, setDismissedStart] = useState<number | null>(null);\n useEffect(() => {\n if (queryInfo === null && dismissedStart !== null) setDismissedStart(null);\n }, [queryInfo, dismissedStart]);\n\n const derivedOpen = queryInfo !== null && dismissedStart !== queryInfo.start;\n const open = openProp ?? derivedOpen;\n const query = open && queryInfo ? queryInfo.query : null;\n\n const setOpen = useCallback(\n (next: boolean) => {\n onOpenChange?.(next);\n if (!next) setDismissedStart(queryInfo?.start ?? null);\n },\n [onOpenChange, queryInfo],\n );\n\n const onQueryChangeRef = useRef(onQueryChange);\n useEffect(() => {\n onQueryChangeRef.current = onQueryChange;\n }, [onQueryChange]);\n useEffect(() => {\n onQueryChangeRef.current?.(query);\n }, [query]);\n\n // ------------------------------------------------------------------\n // Filtering + highlight\n // ------------------------------------------------------------------\n const filtered = useMemo(\n () => (open && query !== null ? options.filter((option) => filter(option, query)) : []),\n [open, query, options, filter],\n );\n\n const [activeIndexState, setActiveIndexState] = useState(0);\n\n /**\n * The highlight is RESOLVED during render, never repaired in an effect.\n *\n * `aria-activedescendant` and the option's `aria-selected` must be written in\n * the same commit, or the attribute names an element that does not exist yet\n * — the generalised form of cmdk's `selectedItemId` hole (see the docblock in\n * `../command/command.tsx`). Clamping here means a stale index from before a\n * filter keystroke can never reach the DOM, not even for one frame.\n */\n const activeIndex = useMemo(() => {\n const candidate = filtered[activeIndexState];\n if (candidate && !candidate.disabled) return activeIndexState;\n return firstEnabled(filtered);\n }, [filtered, activeIndexState]);\n\n // Reset the *stored* index when the query changes so the next arrow press\n // starts from the top. Safe as an effect precisely because the resolved value\n // above is already correct in the intervening commit.\n useEffect(() => {\n setActiveIndexState(0);\n }, [query]);\n\n const activeId = activeIndex >= 0 ? optionId(activeIndex) : undefined;\n\n // ------------------------------------------------------------------\n // Actions\n // ------------------------------------------------------------------\n const insert = useCallback(\n (option: MentionOption) => {\n if (option.disabled || !queryInfo) return;\n const result = insertMention(value, option, trigger, queryInfo.start, caret);\n commit(result.value);\n applyCaret(result.caret);\n },\n [queryInfo, value, trigger, caret, commit, applyCaret],\n );\n\n const close = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const removeMention = useCallback(\n (mention: Mention) => {\n const end = mentionEnd(mention, trigger);\n const nextText = value.text.slice(0, mention.start) + value.text.slice(end);\n commit({ text: nextText, mentions: remapMentions(value, nextText, trigger) });\n applyCaret(mention.start);\n },\n [value, trigger, commit, applyCaret],\n );\n\n // ------------------------------------------------------------------\n // Textarea event handlers (owned here, handed to MentionInputTextarea)\n // ------------------------------------------------------------------\n const syncCaret = useCallback((element: HTMLTextAreaElement) => {\n setCaret(element.selectionStart ?? 0);\n }, []);\n\n const handleChange = useCallback(\n (element: HTMLTextAreaElement) => {\n const nextText = element.value;\n commit({ text: nextText, mentions: remapMentions(value, nextText, trigger) });\n setCaret(element.selectionStart ?? nextText.length);\n },\n [commit, value, trigger],\n );\n\n const handleKeyDownCapture = useCallback(\n (event: ReactKeyboardEvent<HTMLTextAreaElement>) => {\n const element = event.currentTarget;\n const position = element.selectionStart ?? 0;\n const hasRange = element.selectionStart !== element.selectionEnd;\n\n if (open) {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n setActiveIndexState(step(filtered, activeIndex, 1));\n return;\n case \"ArrowUp\":\n event.preventDefault();\n setActiveIndexState(step(filtered, activeIndex < 0 ? 0 : activeIndex, -1));\n return;\n case \"Home\":\n event.preventDefault();\n setActiveIndexState(firstEnabled(filtered));\n return;\n case \"End\":\n event.preventDefault();\n setActiveIndexState(lastEnabled(filtered));\n return;\n case \"Enter\":\n case \"Tab\": {\n const option = activeIndex >= 0 ? filtered[activeIndex] : undefined;\n if (option && !option.disabled) {\n // Capture phase, so `defaultPrevented` is already true when a\n // host handler (PromptInput's Enter→submit) runs in the bubble\n // phase on this same element and this same SyntheticEvent.\n event.preventDefault();\n insert(option);\n }\n return;\n }\n case \"Escape\":\n event.preventDefault();\n close();\n return;\n default:\n break;\n }\n }\n\n // Chip atomicity. A range selection is ordinary text editing — the user\n // asked for exactly those characters, mentions included.\n if (hasRange || event.metaKey || event.ctrlKey || event.altKey) return;\n\n if (event.key === \"Backspace\") {\n const mention = mentionAt(value, position - 1, trigger);\n if (mention) {\n event.preventDefault();\n removeMention(mention);\n }\n return;\n }\n if (event.key === \"Delete\") {\n const mention = mentionAt(value, position, trigger);\n if (mention) {\n event.preventDefault();\n removeMention(mention);\n }\n return;\n }\n if (event.key === \"ArrowLeft\" && !event.shiftKey) {\n const mention = mentionAt(value, position - 1, trigger);\n if (mention && position - 1 > mention.start) {\n event.preventDefault();\n applyCaret(mention.start);\n }\n return;\n }\n if (event.key === \"ArrowRight\" && !event.shiftKey) {\n const mention = mentionAt(value, position, trigger);\n if (mention) {\n event.preventDefault();\n applyCaret(mentionEnd(mention, trigger));\n }\n }\n },\n [open, filtered, activeIndex, insert, close, value, trigger, removeMention, applyCaret],\n );\n\n // ------------------------------------------------------------------\n // Mirror geometry (caret anchor + chip overlay)\n // ------------------------------------------------------------------\n const [mirrorStyle, setMirrorStyle] = useState<CSSProperties | null>(null);\n const [scrollTop, setScrollTop] = useState(0);\n const caretMarkerRef = useRef<HTMLSpanElement>(null);\n const [caretRect, setCaretRect] = useState({ left: 0, top: 0, height: 0 });\n\n /**\n * Re-snapshot the field's metrics whenever anything that MOVES A GLYPH can\n * have changed.\n *\n * A one-shot snapshot is not enough and the failure is visible, not\n * theoretical: the very first layout effect runs before the theme attribute\n * has been applied, so it captures the `:root` fallback font — the chip wash\n * then renders in a different typeface from the text it is supposed to sit\n * behind and runs ~14% wide (measured: 143.3px vs 125.5px for the same\n * string). Exactly the same drift happens at runtime whenever a `ThemeSwitcher`\n * changes `data-theme`, a density dial changes the type scale, or a web font\n * finishes loading. So the snapshot is re-taken on all of them.\n */\n const remeasureMirror = useCallback(() => {\n const element = textareaRef.current;\n if (!element) return;\n const next = readMirrorStyle(element);\n setMirrorStyle((previous) =>\n previous && JSON.stringify(previous) === JSON.stringify(next) ? previous : next,\n );\n }, []);\n\n useLayoutEffect(() => {\n remeasureMirror();\n }, [remeasureMirror, value.text]);\n\n useLayoutEffect(() => {\n const element = textareaRef.current;\n if (!element) return;\n const teardown: Array<() => void> = [];\n\n if (typeof ResizeObserver !== \"undefined\") {\n const observer = new ResizeObserver(remeasureMirror);\n observer.observe(element);\n teardown.push(() => observer.disconnect());\n }\n\n if (typeof MutationObserver !== \"undefined\") {\n // The field's own classes/inline styles.\n const fieldObserver = new MutationObserver(remeasureMirror);\n fieldObserver.observe(element, {\n attributes: true,\n attributeFilter: [\"class\", \"style\"],\n });\n teardown.push(() => fieldObserver.disconnect());\n\n // Theme / density / decoration switches re-resolve the INHERITED font and\n // type scale, and a stale snapshot misaligns every chip on the surface.\n const rootObserver = new MutationObserver(remeasureMirror);\n for (const node of [document.documentElement, document.body]) {\n rootObserver.observe(node, {\n attributes: true,\n attributeFilter: [\"data-theme\", \"data-density\", \"data-decoration\", \"class\", \"style\"],\n });\n }\n teardown.push(() => rootObserver.disconnect());\n }\n\n // A web font landing after first paint changes every advance width. This\n // arm is intentionally kept as unpinned defence-in-depth: five isolation\n // attempts (issue #405) could not construct a scenario where removing it\n // alone turns any test red — it is covered only compositely by the\n // ResizeObserver/MutationObserver arms above. Do not delete it on the\n // strength of \"no test notices\"; see #405 for the full mutation audit and\n // the maintainer's keep decision (ADR 0023 §6).\n let cancelled = false;\n void document.fonts?.ready\n .then(() => {\n if (!cancelled) remeasureMirror();\n })\n .catch(() => undefined);\n teardown.push(() => {\n cancelled = true;\n });\n\n return () => {\n for (const fn of teardown) fn();\n };\n }, [remeasureMirror]);\n\n useLayoutEffect(() => {\n if (!open) return;\n const marker = caretMarkerRef.current;\n const root = rootRef.current;\n if (!marker || !root) return;\n const rect = marker.getClientRects()[0] ?? marker.getBoundingClientRect();\n const rootRect = root.getBoundingClientRect();\n const next = {\n left: rect.left - rootRect.left,\n top: rect.top - rootRect.top,\n height: rect.height,\n };\n setCaretRect((previous) =>\n previous.left === next.left && previous.top === next.top && previous.height === next.height\n ? previous\n : next,\n );\n }, [open, caret, value.text, mirrorStyle, scrollTop]);\n\n const runs = useMemo(() => buildRuns(value, trigger), [value, trigger]);\n\n // ------------------------------------------------------------------\n // Context\n // ------------------------------------------------------------------\n const contextValue = useMemo<MentionInputContextValue>(\n () => ({\n state: { value, query, open, activeIndex, activeId, filtered },\n actions: { insert, close, setActiveIndex: setActiveIndexState },\n meta: { trigger, listId, textareaId, optionId },\n }),\n [\n value,\n query,\n open,\n activeIndex,\n activeId,\n filtered,\n insert,\n close,\n trigger,\n listId,\n textareaId,\n optionId,\n ],\n );\n\n const textareaContextValue = useMemo<TextareaWiring>(\n () => ({\n textareaRef,\n textareaId,\n listId,\n open,\n activeId,\n value: value.text,\n onValueInput: handleChange,\n onCaretSync: syncCaret,\n onKeyDownCapture: handleKeyDownCapture,\n onDismiss: close,\n onScrollSync: setScrollTop,\n }),\n [\n textareaId,\n listId,\n open,\n activeId,\n value.text,\n handleChange,\n syncCaret,\n handleKeyDownCapture,\n close,\n ],\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <MentionInputContext value={contextValue}>\n <TextareaWiringContext value={textareaContextValue}>\n <div\n ref={mergedRootRef}\n data-slot=\"mention-input\"\n className={cn(\"relative\", className)}\n {...props}\n >\n {children}\n\n {/*\n Chip overlay — decorative, painted ON TOP of the field.\n Every run is `text-transparent`; only a mention run paints a\n background, and it is a 10% wash, so the real glyphs in the\n textarea below stay legible and stay the ONLY copy of the text\n (native selection, IME and spellcheck are untouched). It sits on\n top rather than behind because a textarea's own background is\n opaque (`bg-background`), which would hide anything underneath.\n */}\n {mirrorStyle ? (\n <div\n data-slot=\"mention-input-overlay\"\n aria-hidden=\"true\"\n className=\"pointer-events-none select-none text-transparent\"\n style={{ ...mirrorStyle, zIndex: 1 }}\n >\n <div style={{ transform: `translateY(${-scrollTop}px)` }}>\n {runs.map((run) =>\n run.mention ? (\n <span\n key={run.key}\n data-slot=\"mention-input-chip\"\n className=\"box-decoration-clone rounded-sm bg-primary/10\"\n >\n {run.text}\n </span>\n ) : (\n <span key={run.key}>{run.text}</span>\n ),\n )}\n </div>\n </div>\n ) : null}\n\n {/* Caret measurement mirror — laid out, never painted. */}\n {open && mirrorStyle ? (\n <div\n data-slot=\"mention-input-caret-mirror\"\n aria-hidden=\"true\"\n className=\"pointer-events-none select-none\"\n style={{ ...mirrorStyle, visibility: \"hidden\", zIndex: -1 }}\n >\n <div style={{ transform: `translateY(${-scrollTop}px)` }}>\n {value.text.slice(0, caret)}\n <span ref={caretMarkerRef}>{value.text.slice(caret) || \".\"}</span>\n </div>\n </div>\n ) : null}\n\n <PopoverAnchor asChild>\n <span\n data-slot=\"mention-input-anchor\"\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute\"\n style={{\n left: caretRect.left,\n top: caretRect.top,\n width: 0,\n height: caretRect.height,\n }}\n />\n </PopoverAnchor>\n </div>\n </TextareaWiringContext>\n </MentionInputContext>\n </Popover>\n );\n});\n\n// ---------------------------------------------------------------------------\n// MentionInputTextarea\n// ---------------------------------------------------------------------------\n\ninterface TextareaWiring {\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n textareaId: string;\n listId: string;\n open: boolean;\n activeId?: string;\n value: string;\n onValueInput: (element: HTMLTextAreaElement) => void;\n onCaretSync: (element: HTMLTextAreaElement) => void;\n onKeyDownCapture: (event: ReactKeyboardEvent<HTMLTextAreaElement>) => void;\n onDismiss: () => void;\n onScrollSync: (scrollTop: number) => void;\n}\n\nconst TextareaWiringContext = createContext<TextareaWiring | null>(null);\n\nexport interface MentionInputTextareaProps extends Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"value\" | \"defaultValue\"\n> {\n /**\n * Render the consumer's own textarea-rendering component instead of a\n * `Textarea` — e.g. `PromptInputTextarea`. The child must ultimately render a\n * real `<textarea>`; everything this component needs is spread onto it.\n */\n asChild?: boolean;\n}\n\n/**\n * The field itself — a real `<textarea>` carrying the combobox semantics.\n *\n * The mention interception is bound as **`onKeyDownCapture`**, not `onKeyDown`.\n * Under `asChild`, Radix `Slot` merges CHILD handlers over slot handlers and\n * runs the child's **first**. So when the child binds `onKeyDown` directly on\n * the host element, a bubble-phase handler here would fire *after* it — the\n * child's Enter→submit would win and the popup would never see the key. React\n * dispatches an element's capture pass before its bubble pass and shares one\n * `SyntheticEvent` between them, so `preventDefault()` here is already visible\n * as `event.defaultPrevented` when the child's handler runs.\n *\n * **Scope of the hazard, stated precisely** (an earlier version of this comment\n * overclaimed): it applies to a child that binds `onKeyDown` on a *host\n * element*. It does NOT apply to `PromptInputTextarea`, which is a *component*\n * that destructures `onKeyDown` out of its own props, calls it first and bails\n * on `defaultPrevented` (`packages/ai/src/prompt-input.tsx`) — that composition\n * works with either binding. The capture binding is what makes the raw-host\n * case correct too, and that is the case the locking test exercises: see\n * \"T8 Slot handler-order contract\" in `mention-input.test.tsx`, which fails if\n * this is ever moved to `onKeyDown`.\n */\nexport const MentionInputTextarea = forwardRef<HTMLTextAreaElement, MentionInputTextareaProps>(\n function MentionInputTextarea(\n {\n asChild,\n className,\n // The seven handlers this component owns are destructured OUT of `props`\n // so `{...props}` can be spread BEFORE them without clobbering them.\n // Spreading props last (the obvious reading of \"spread ...props onto the\n // root\") silently replaced the component's own wiring: a consumer passing\n // `onChange` used to knock out `wiring.onValueInput`, and since the value\n // is provider-controlled that left the field completely inert. Consumer\n // handlers still run — each one is invoked from inside its counterpart —\n // and every NON-handler prop (`id`, `name`, `aria-*`, `placeholder`, …)\n // still wins, because the spread sits after those defaults.\n onChange,\n onKeyDownCapture,\n onSelect,\n onKeyUp,\n onClick,\n onScroll,\n onBlur,\n ...props\n },\n ref,\n ) {\n const wiring = use(TextareaWiringContext);\n if (!wiring) {\n throw new Error(\"MentionInputTextarea must be used inside a <MentionInput>.\");\n }\n const mergedRef = useMemo(\n () => mergeRefs<HTMLTextAreaElement>(ref, wiring.textareaRef),\n [ref, wiring.textareaRef],\n );\n\n const Comp = asChild ? Slot : Textarea;\n\n return (\n <Comp\n ref={mergedRef}\n id={wiring.textareaId}\n data-slot=\"mention-input-textarea\"\n // Machine-readable open state. It is a `data-` attribute rather than\n // `aria-expanded` because `aria-expanded` is NOT in `textbox`'s\n // supported-property set — see the ARIA note below.\n data-state={wiring.open ? \"open\" : \"closed\"}\n // The field stays an implicit `textbox`. `role=\"combobox\"` on a\n // `<textarea>` is invalid per ARIA in HTML (`<textarea>` allows no role\n // override) and axe's `aria-allowed-role` — enabled by default — flags\n // it on every story; `aria-expanded` on a textbox is worse still\n // (`aria-allowed-attr`, CRITICAL). All four attributes below ARE in\n // `textbox`'s supported set, so this arrangement is both spec-valid and\n // axe-clean while keeping the announcement that matters: with\n // `aria-activedescendant` on a textbox, AT reads the highlighted option\n // as the user arrows through the roster.\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n // Only while the popup is mounted: the listbox lives in a Radix portal\n // that unmounts on close, and an `aria-controls` pointing at a removed\n // node is a dangling reference.\n aria-controls={wiring.open ? wiring.listId : undefined}\n aria-activedescendant={wiring.activeId}\n autoComplete=\"off\"\n value={wiring.value}\n className={cn(\"relative z-0\", className)}\n {...props}\n onChange={(event) => {\n wiring.onValueInput(event.currentTarget);\n onChange?.(event);\n }}\n onKeyDownCapture={(event) => {\n wiring.onKeyDownCapture(event);\n onKeyDownCapture?.(event);\n }}\n onSelect={(event) => {\n wiring.onCaretSync(event.currentTarget);\n onSelect?.(event);\n }}\n onKeyUp={(event) => {\n wiring.onCaretSync(event.currentTarget);\n onKeyUp?.(event);\n }}\n onClick={(event) => {\n wiring.onCaretSync(event.currentTarget);\n onClick?.(event);\n }}\n onScroll={(event) => {\n wiring.onScrollSync(event.currentTarget.scrollTop);\n onScroll?.(event);\n }}\n onBlur={(event) => {\n wiring.onDismiss();\n onBlur?.(event);\n }}\n />\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// MentionInputContent / List / Item / Empty\n// ---------------------------------------------------------------------------\n\nexport type MentionInputContentProps = React.ComponentPropsWithoutRef<typeof PopoverContent>;\n\n/** The floating panel. Never takes focus — the caret has to stay in the field. */\nexport const MentionInputContent = forwardRef<\n React.ElementRef<typeof PopoverContent>,\n MentionInputContentProps\n>(function MentionInputContent({ className, align = \"start\", ...props }, ref) {\n const { meta } = useMentionInput();\n const wiring = use(TextareaWiringContext);\n\n return (\n <PopoverContent\n ref={ref}\n data-slot=\"mention-input-content\"\n align={align}\n // Radix `PopoverContent` defaults to `role=\"dialog\"`, which is wrong here\n // twice over: a combobox popup is not a dialog, and an unnamed dialog is\n // an axe `aria-dialog-name` violation (serious). The panel is a plain\n // container — the `role=\"listbox\"` inside carries all the semantics.\n role=\"presentation\"\n // No border, no ring: PopoverContent already carries `shadow-ring-md`.\n className={cn(\"w-72 p-0\", className)}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onPointerDownOutside={(event) => {\n // Clicking the field itself only moves the caret; it must not count as\n // a dismissal, or the popup would fight the caret it depends on.\n const target = event.detail.originalEvent.target as Node | null;\n if (target && wiring?.textareaRef.current?.contains(target)) event.preventDefault();\n props.onPointerDownOutside?.(event);\n }}\n id={`${meta.listId}-content`}\n {...props}\n />\n );\n});\n\nexport interface MentionInputListProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /**\n * Either static nodes, or a render function called once per filtered option.\n * The function form is the one to reach for — the parent has to hand each\n * option back, which is exactly what `children`-as-a-function is for.\n */\n children?: ReactNode | ((option: MentionOption, index: number) => ReactNode);\n}\n\n/** The listbox. Owns the accessible name and the option mapping. */\nexport const MentionInputList = forwardRef<HTMLDivElement, MentionInputListProps>(\n function MentionInputList({ className, children, ...props }, ref) {\n const { t } = useLocale();\n const { state, meta } = useMentionInput();\n\n return (\n <div\n ref={ref}\n id={meta.listId}\n data-slot=\"mention-input-list\"\n role=\"listbox\"\n aria-label={t(\"ui.mentionInput.listLabel\")}\n className={cn(\"max-h-60 overflow-y-auto p-1\", className)}\n {...props}\n >\n {typeof children === \"function\"\n ? state.filtered.map((option, index) => children(option, index))\n : children}\n </div>\n );\n },\n);\n\nexport interface MentionInputItemProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n option: MentionOption;\n children?: ReactNode;\n}\n\n/**\n * One option row.\n *\n * The row derives its own index from the provider's `filtered` list rather than\n * accepting one, so its `id` and `aria-selected` can never disagree with the\n * `aria-activedescendant` the field is publishing.\n */\nexport const MentionInputItem = forwardRef<HTMLDivElement, MentionInputItemProps>(\n function MentionInputItem({ option, className, children, ...props }, ref) {\n const { state, actions, meta } = useMentionInput();\n const index = state.filtered.findIndex((candidate) => candidate.id === option.id);\n const isActive = index >= 0 && index === state.activeIndex;\n\n return (\n <div\n ref={ref}\n id={index >= 0 ? meta.optionId(index) : undefined}\n data-slot=\"mention-input-item\"\n role=\"option\"\n aria-selected={isActive}\n aria-disabled={option.disabled || undefined}\n data-active={isActive || undefined}\n className={cn(\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5\",\n \"text-body outline-none transition-colors duration-fast motion-reduce:transition-none\",\n \"data-[active=true]:bg-accent data-[active=true]:text-accent-foreground\",\n \"aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:size-4\",\n className,\n )}\n // Keep the caret where it is: a mousedown inside the portal would\n // otherwise blur the textarea before the click ever lands.\n onMouseDown={(event) => {\n event.preventDefault();\n props.onMouseDown?.(event);\n }}\n onClick={(event) => {\n actions.insert(option);\n props.onClick?.(event);\n }}\n onMouseEnter={(event) => {\n if (!option.disabled && index >= 0) actions.setActiveIndex(index);\n props.onMouseEnter?.(event);\n }}\n {...props}\n >\n {children ?? (\n <span className=\"flex min-w-0 flex-col\">\n <span className=\"truncate\">{option.label}</span>\n {option.description ? (\n <span className=\"truncate text-meta text-muted-foreground\">{option.description}</span>\n ) : null}\n </span>\n )}\n </div>\n );\n },\n);\n\nexport type MentionInputEmptyProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * The \"nothing matches\" line. A **sibling** of the listbox, never a child —\n * a `role=\"listbox\"` may only own `option` and `group` children.\n */\nexport const MentionInputEmpty = forwardRef<HTMLDivElement, MentionInputEmptyProps>(\n function MentionInputEmpty({ className, children, ...props }, ref) {\n const { t } = useLocale();\n const { state } = useMentionInput();\n if (state.filtered.length > 0) return null;\n\n return (\n <div\n ref={ref}\n data-slot=\"mention-input-empty\"\n className={cn(\"py-6 text-center text-body text-muted-foreground\", className)}\n {...props}\n >\n {children ?? t(\"noResults\")}\n </div>\n );\n },\n);\n","import type { ReactNode } from \"react\";\n\n/**\n * The pure offset algebra behind `MentionInput`.\n *\n * Chip atomicity in a real `<textarea>` is **selection arithmetic over a token\n * map**, not DOM nodes: the field holds ordinary text, and this module keeps a\n * parallel list of `{ id, label, start }` records honest as that text is edited,\n * pasted over and deleted. Nothing here touches React or the DOM, so every\n * acceptance criterion about backspace atomicity, caret skipping and the\n * `{ text, mentionedIds }` payload reduces to a unit test on these functions.\n */\n\n/** One selectable roster entry. */\nexport interface MentionOption {\n /** Stable id — this is what `serializeMentions` emits. */\n id: string;\n /** Inserted verbatim after the trigger character. */\n label: string;\n /** Optional secondary line shown under the label. */\n description?: string;\n /** Optional leading glyph (avatar, icon). */\n icon?: ReactNode;\n /** Extra match terms, so \"ada\" can find \"Ada Lovelace\". */\n keywords?: string[];\n /** Rendered but not selectable. */\n disabled?: boolean;\n}\n\n/** A resolved mention inside `MentionValue.text`. */\nexport interface Mention {\n /** The option id this run refers to. */\n id: string;\n /** The label WITHOUT the trigger character. */\n label: string;\n /** Offset of the trigger character in `text`. */\n start: number;\n}\n\n/** The component's value: plain text plus the mentions it contains. */\nexport interface MentionValue {\n text: string;\n mentions: Mention[];\n}\n\n/** The result of inserting an option: the new value and where the caret goes. */\nexport interface InsertMentionResult {\n value: MentionValue;\n /** Offset immediately after the inserted token's trailing space. */\n caret: number;\n}\n\n/** Exclusive end offset of a mention's `trigger + label` run. */\nexport function mentionEnd(mention: Mention, trigger = \"@\"): number {\n return mention.start + trigger.length + mention.label.length;\n}\n\n/**\n * The mention whose half-open range `[start, end)` contains `index`, if any.\n *\n * Half-open on purpose: the offset one past the token is *outside* it, so a\n * caret sitting immediately after `@Ada Lovelace` is \"next to\" the mention\n * rather than \"in\" it. Backspace therefore asks about `caret - 1` and Delete\n * about `caret`, and both get an unambiguous answer.\n */\nexport function mentionAt(value: MentionValue, index: number, trigger = \"@\"): Mention | undefined {\n return value.mentions.find((m) => index >= m.start && index < mentionEnd(m, trigger));\n}\n\n/** Length of the longest common prefix of two strings. */\nfunction commonPrefixLength(a: string, b: string): number {\n const max = Math.min(a.length, b.length);\n let i = 0;\n while (i < max && a[i] === b[i]) i++;\n return i;\n}\n\n/**\n * Re-derive the mention list after the text changed underneath it.\n *\n * The edit is treated as ONE contiguous replacement — which is what a\n * keystroke, a paste, a cut and a native undo all are. The common prefix and\n * common suffix bracket it; a mention entirely before the edit keeps its\n * offset, one entirely after it shifts by the length delta, and one the edit\n * reaches into is **dropped** (its text no longer spells the person's name, so\n * the id would be a lie).\n *\n * Every survivor is then **re-validated** against the new text: the run at its\n * offset must still read exactly `trigger + label`. That second pass is what\n * makes a multi-mention paste safe — the arithmetic alone can be fooled by a\n * replacement whose prefix/suffix boundaries land ambiguously, but a run that\n * no longer spells the token can never survive the check.\n */\nexport function remapMentions(prev: MentionValue, nextText: string, trigger = \"@\"): Mention[] {\n if (prev.text === nextText) return prev.mentions;\n\n const prevText = prev.text;\n const p = commonPrefixLength(prevText, nextText);\n\n const maxSuffix = Math.min(prevText.length, nextText.length) - p;\n let s = 0;\n while (s < maxSuffix && prevText[prevText.length - 1 - s] === nextText[nextText.length - 1 - s]) {\n s++;\n }\n\n /** End of the replaced span, in PREVIOUS coordinates. */\n const editEnd = prevText.length - s;\n const delta = nextText.length - prevText.length;\n\n const remapped: Mention[] = [];\n for (const mention of prev.mentions) {\n const end = mentionEnd(mention, trigger);\n if (end <= p) {\n remapped.push(mention);\n } else if (mention.start >= editEnd) {\n remapped.push({ ...mention, start: mention.start + delta });\n }\n // else: the edit reached into the token — drop it.\n }\n\n return remapped.filter(\n (m) => nextText.slice(m.start, mentionEnd(m, trigger)) === trigger + m.label,\n );\n}\n\n/**\n * Replace the in-progress `trigger + query` run with `trigger + label + \" \"`.\n *\n * `queryStart` is the offset of the trigger character; `caret` is where the\n * query ends. The trailing space is deliberate: it terminates the query so the\n * popup closes, and it gives the next word somewhere to start.\n */\nexport function insertMention(\n value: MentionValue,\n option: MentionOption,\n trigger: string,\n queryStart: number,\n caret: number,\n): InsertMentionResult {\n const inserted = `${trigger}${option.label} `;\n const nextText = value.text.slice(0, queryStart) + inserted + value.text.slice(caret);\n const delta = inserted.length - (caret - queryStart);\n\n const mentions: Mention[] = [];\n for (const mention of value.mentions) {\n if (mentionEnd(mention, trigger) <= queryStart) {\n mentions.push(mention);\n } else if (mention.start >= caret) {\n mentions.push({ ...mention, start: mention.start + delta });\n }\n // else: it overlapped the query run being replaced — drop it.\n }\n mentions.push({ id: option.id, label: option.label, start: queryStart });\n mentions.sort((a, b) => a.start - b.start);\n\n return {\n value: {\n text: nextText,\n mentions: mentions.filter(\n (m) => nextText.slice(m.start, mentionEnd(m, trigger)) === trigger + m.label,\n ),\n },\n caret: queryStart + inserted.length,\n };\n}\n\n/**\n * The serialization contract a consumer gets out: the raw text plus the option\n * ids it references, **deduped** and in **document order** (two mentions of the\n * same person yield one id).\n */\nexport function serializeMentions(value: MentionValue): { text: string; mentionedIds: string[] } {\n const ordered = [...value.mentions].sort((a, b) => a.start - b.start);\n const mentionedIds: string[] = [];\n const seen = new Set<string>();\n for (const mention of ordered) {\n if (seen.has(mention.id)) continue;\n seen.add(mention.id);\n mentionedIds.push(mention.id);\n }\n return { text: value.text, mentionedIds };\n}\n\n/**\n * Case-insensitive substring match over `label` and `keywords`. An empty query\n * matches everything, so the full roster shows the moment the trigger is typed.\n */\nexport function defaultMentionFilter(option: MentionOption, query: string): boolean {\n const q = query.trim().toLowerCase();\n if (q.length === 0) return true;\n if (option.label.toLowerCase().includes(q)) return true;\n return (option.keywords ?? []).some((k) => k.toLowerCase().includes(q));\n}\n","import {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from \"react\";\nimport * as MenubarPrimitive from \"@radix-ui/react-menubar\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\n// Pure re-exports (not `const X = Primitive.Y`) so tsc need not emit a portable\n// type name for these — avoids TS2742 against transitive @radix-ui/react-context.\nexport {\n Menu as MenubarMenu,\n Group as MenubarGroup,\n Portal as MenubarPortal,\n Sub as MenubarSub,\n RadioGroup as MenubarRadioGroup,\n} from \"@radix-ui/react-menubar\";\n\nexport const Menubar = forwardRef<\n ElementRef<typeof MenubarPrimitive.Root>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>\n>(function Menubar({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Root\n ref={ref}\n className={cn(\"flex h-9 items-center gap-1 rounded-md bg-card p-1 shadow-ring-sm\", className)}\n {...props}\n />\n );\n});\n\nexport const MenubarTrigger = forwardRef<\n ElementRef<typeof MenubarPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>\n>(function MenubarTrigger({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none transition-colors duration-fast focus:bg-accent data-[state=open]:bg-accent\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const MenubarContent = forwardRef<\n ElementRef<typeof MenubarPrimitive.Content>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>\n>(function MenubarContent(\n { className, align = \"start\", alignOffset = -4, sideOffset = 8, ...props },\n ref,\n) {\n return (\n <MenubarPrimitive.Portal>\n <MenubarPrimitive.Content\n ref={ref}\n align={align}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[12rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n </MenubarPrimitive.Portal>\n );\n});\n\nexport const MenubarItem = forwardRef<\n ElementRef<typeof MenubarPrimitive.Item>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & { inset?: boolean }\n>(function MenubarItem({ className, inset, ...props }, ref) {\n return (\n <MenubarPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const MenubarSubTrigger = forwardRef<\n ElementRef<typeof MenubarPrimitive.SubTrigger>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }\n>(function MenubarSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <MenubarPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-fast focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"ps-8\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ms-auto size-4\" />\n </MenubarPrimitive.SubTrigger>\n );\n});\n\nexport const MenubarSubContent = forwardRef<\n ElementRef<typeof MenubarPrimitive.SubContent>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>\n>(function MenubarSubContent({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-ring-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const MenubarCheckboxItem = forwardRef<\n ElementRef<typeof MenubarPrimitive.CheckboxItem>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>\n>(function MenubarCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <MenubarPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.CheckboxItem>\n );\n});\n\nexport const MenubarRadioItem = forwardRef<\n ElementRef<typeof MenubarPrimitive.RadioItem>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>\n>(function MenubarRadioItem({ className, children, ...props }, ref) {\n return (\n <MenubarPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-none transition-colors duration-fast focus:bg-accent\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute start-2 flex size-3.5 items-center justify-center\">\n <MenubarPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </MenubarPrimitive.ItemIndicator>\n </span>\n {children}\n </MenubarPrimitive.RadioItem>\n );\n});\n\nexport const MenubarSeparator = forwardRef<\n ElementRef<typeof MenubarPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>\n>(function MenubarSeparator({ className, ...props }, ref) {\n return (\n <MenubarPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n});\n\nexport function MenubarShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn(\"ms-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport { forwardRef, useCallback, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Check, ChevronsUpDown } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../command\";\nimport { useLocale } from \"../locale-provider\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { Skeleton } from \"../skeleton\";\nimport {\n countItems,\n modelPickerBody,\n showsInlineError,\n type ModelPickerGroup,\n type ModelPickerItem,\n type ModelPickerStatus,\n} from \"./model-picker-state\";\n\nexport interface ModelPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Grouped rows. Grouping and heading text are the caller's, never derived. */\n groups: readonly ModelPickerGroup[];\n /** The currently pinned row's id. */\n value?: string;\n /** Fires with the chosen row; the popover closes first. */\n onSelect?: (item: ModelPickerItem) => void;\n /** Drives the four bodies — see `modelPickerBody`. Default `\"ready\"`. */\n status?: ModelPickerStatus;\n /** Trigger text — usually the pinned row's label. */\n triggerLabel: ReactNode;\n /** Retry action for the error strip and the empty panel. Omit to hide it. */\n onRetry?: () => void;\n /** Search field placeholder. */\n searchPlaceholder?: string;\n disabled?: boolean;\n /** Extra classes for the popover panel (default width `w-96`). */\n contentClassName?: string;\n /** Accessible name for the trigger — what the control is FOR, not what is chosen. */\n \"aria-label\"?: string;\n /**\n * Controlled popover open state. Omit for the uncontrolled default (internal\n * `useState(false)`, unchanged). `isControlled = open !== undefined` and the\n * mode never flips mid-life — see `component-api.md` \"Controlled/uncontrolled\".\n */\n open?: boolean;\n /** Fires whenever the popover would open/close — a trigger click, or a row select. */\n onOpenChange?: (open: boolean) => void;\n}\n\nfunction Row({\n item,\n picked,\n onChoose,\n}: {\n item: ModelPickerItem;\n picked: boolean;\n onChoose: () => void;\n}) {\n return (\n <CommandItem\n value={item.id}\n // cmdk filters on value + keywords, so a hidden keyword (\"northwind\") finds\n // a row whose visible label never mentions it.\n keywords={item.keywords ?? []}\n disabled={item.disabled}\n onSelect={onChoose}\n data-model-id={item.id}\n // `data-picked`, NOT `data-selected`. cmdk OWNS `data-selected` on a\n // CommandItem — it is the keyboard HIGHLIGHT, set on whichever row the\n // arrow keys are currently on. Writing our own would be silently\n // overwritten, and a test reading it would report the highlighted row as\n // the pinned one.\n data-picked={picked ? \"true\" : \"false\"}\n className=\"gap-2\"\n >\n {item.icon}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate\">{item.label}</span>\n {item.description === undefined ? null : (\n <span className=\"text-meta text-muted-foreground truncate\">{item.description}</span>\n )}\n </span>\n {(item.meta ?? []).map((m) => (\n <span key={m} className=\"text-meta text-muted-foreground shrink-0\">\n {m}\n </span>\n ))}\n {picked ? <Check className=\"size-3.5 shrink-0\" aria-hidden=\"true\" /> : null}\n </CommandItem>\n );\n}\n\n/**\n * A compact pill that opens a grouped, searchable target list anchored under\n * itself — sized to sit in a composer footer.\n *\n * The inline sibling of `@elabs-ai/components-ai`'s `ModelSelector`,\n * which is the same `Command` internals in a modal `Dialog`. Reach for that one\n * for a full command palette; reach for this one for an in-place picker.\n *\n * **`Command` lives inside a `Popover`, never a `DropdownMenu`, and that is not\n * a stylistic choice.** `DropdownMenuContent` owns roving tabindex and its own\n * typeahead, both of which fight a real `<input>` in its subtree: arrow keys move\n * the menu's focus instead of cmdk's highlight, and keystrokes are swallowed\n * before they reach `CommandInput`. `Popover` contributes positioning and\n * dismissal and claims no keyboard, which is why every combobox is built on it.\n * Do not \"simplify\" this back.\n */\nexport const ModelPicker = forwardRef<HTMLDivElement, ModelPickerProps>(function ModelPicker(\n {\n groups,\n value,\n onSelect,\n status = \"ready\",\n triggerLabel,\n onRetry,\n searchPlaceholder,\n disabled,\n contentClassName,\n className,\n open: openProp,\n onOpenChange,\n ...props\n },\n ref,\n) {\n const { t } = useLocale();\n // Controlled/uncontrolled per component-api.md: controlled iff `open` is\n // provided; the mode never flips mid-life. Uncontrolled fallback is\n // byte-identical to the old internal `useState(false)`.\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const isControlled = openProp !== undefined;\n const open = isControlled ? openProp : uncontrolledOpen;\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n const count = countItems(groups);\n const body = modelPickerBody(status, count);\n\n return (\n <div ref={ref} data-slot=\"model-picker\" className={cn(\"inline-flex\", className)} {...props}>\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"sm\"\n role=\"combobox\"\n aria-expanded={open}\n // `role=\"combobox\"` does NOT support name-from-content, so the\n // visible label never becomes the accessible name on its own — the\n // control would ship unnamed. Default to the label (telling AT what\n // is currently CHOSEN, matching `Combobox`); an explicit `aria-label`\n // wins and names what the control is FOR.\n aria-label={\n props[\"aria-label\"] ??\n (typeof triggerLabel === \"string\" ? triggerLabel : t(\"ui.modelPicker.label\"))\n }\n disabled={disabled}\n data-slot=\"model-picker-trigger\"\n className=\"max-w-88 justify-between gap-2\"\n >\n <span className=\"truncate\">{triggerLabel}</span>\n <ChevronsUpDown className=\"size-3.5 shrink-0 opacity-50\" aria-hidden=\"true\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent\n align=\"start\"\n data-slot=\"model-picker-content\"\n // Radix Popover.Content renders role=\"dialog\"; without a name axe flags it.\n aria-label={props[\"aria-label\"] ?? t(\"ui.modelPicker.label\")}\n className={cn(\"w-96 p-0\", contentClassName)}\n >\n <Command>\n <CommandInput\n placeholder={searchPlaceholder ?? t(\"ui.modelPicker.searchPlaceholder\")}\n />\n\n {showsInlineError(status, count) ? (\n // Above the list, never instead of it — the list still works.\n <div\n data-slot=\"model-picker-stale\"\n role=\"status\"\n className=\"border-border flex items-center justify-between gap-2 border-b px-3 py-2\"\n >\n <span className=\"text-meta text-muted-foreground\">\n {t(\"ui.modelPicker.refreshFailed\")}\n </span>\n {onRetry ? (\n <Button variant=\"ghost\" size=\"sm\" onClick={onRetry}>\n {t(\"ui.modelPicker.retry\")}\n </Button>\n ) : null}\n </div>\n ) : null}\n\n <CommandList>\n {body === \"loading\" ? (\n <div className=\"space-y-2 p-3\" data-slot=\"model-picker-loading\">\n <span className=\"sr-only\" role=\"status\">\n {t(\"loading\")}\n </span>\n <Skeleton className=\"h-6 w-full\" />\n <Skeleton className=\"h-6 w-4/5\" />\n <Skeleton className=\"h-6 w-3/5\" />\n </div>\n ) : null}\n\n {body === \"error\" || body === \"empty\" ? (\n <div className=\"space-y-2 p-4 text-center\" data-slot=\"model-picker-state\">\n <p className=\"text-body\">\n {body === \"error\"\n ? t(\"ui.modelPicker.loadFailed\")\n : t(\"ui.modelPicker.nothingYet\")}\n </p>\n {onRetry ? (\n <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n {t(\"ui.modelPicker.retry\")}\n </Button>\n ) : null}\n </div>\n ) : null}\n\n {body === \"list\" ? (\n <>\n <CommandEmpty>{t(\"noResults\")}</CommandEmpty>\n {groups.map((group) => (\n <CommandGroup key={group.key} heading={group.label}>\n {group.items.map((item) => (\n <Row\n key={item.id}\n item={item}\n picked={item.id === value}\n onChoose={() => {\n setOpen(false);\n onSelect?.(item);\n }}\n />\n ))}\n </CommandGroup>\n ))}\n </>\n ) : null}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n </div>\n );\n});\n\nexport {\n countItems,\n modelPickerBody,\n showsInlineError,\n type ModelPickerGroup,\n type ModelPickerItem,\n type ModelPickerStatus,\n};\n","/**\n * `ModelPicker`'s two state decisions, kept OUT of the component on purpose.\n *\n * Both were inline ternaries in the consuming app this component came from, and\n * both survived every mutation thrown at them — because no test could reach an\n * expression buried in JSX. As exported pure functions they are directly\n * testable, which is the whole reason they live in their own module.\n */\n\n/** What the picker knows about the list it was handed. */\nexport type ModelPickerStatus = \"idle\" | \"loading\" | \"ready\" | \"stale\" | \"error\" | \"empty\";\n\n/** Which of the four mutually-exclusive bodies the popover renders. */\nexport type ModelPickerBody = \"loading\" | \"list\" | \"error\" | \"empty\";\n\n/**\n * Pick the body.\n *\n * **A non-empty list always wins.** A failed refresh over usable stale data is an\n * inline strip above a working list (see `showsInlineError`), never a takeover —\n * collapsing \"stale list + error\" into \"error panel\" throws away a list the user\n * could still have picked from.\n */\nexport function modelPickerBody(status: ModelPickerStatus, itemCount: number): ModelPickerBody {\n if (itemCount > 0) return \"list\";\n if (status === \"loading\" || status === \"idle\") return \"loading\";\n if (status === \"error\" || status === \"stale\") return \"error\";\n return \"empty\";\n}\n\n/**\n * Whether to show the error line ABOVE a list that still works — i.e. the\n * refresh failed but there is stale data worth keeping on screen.\n */\nexport function showsInlineError(status: ModelPickerStatus, itemCount: number): boolean {\n return itemCount > 0 && (status === \"stale\" || status === \"error\");\n}\n\n/** One selectable row. */\nexport interface ModelPickerItem {\n id: string;\n label: string;\n /** Muted second line. */\n description?: string;\n /**\n * Extra strings cmdk should MATCH on without displaying — ids, a space or\n * workspace name. This is what lets a search for \"northwind\" find a target\n * whose visible label never says it.\n */\n keywords?: string[];\n /**\n * Leading glyph. A ReactNode, never a URL: a renderer with no remote origins\n * cannot fetch a logo, so the caller supplies a bundled node.\n */\n icon?: React.ReactNode;\n /**\n * Trailing muted badges (\"not provisioned\", \"no modes\").\n *\n * Deliberately a caller-supplied ARRAY rather than derived from flags. A\n * three-valued flag where absent means \"undecided\" renders as \"not enabled\"\n * the moment a component computes the badge from `!flag` — which mislabels\n * every row on a deployment that simply never probed. Keeping this a list the\n * caller builds means the library cannot get that wrong on their behalf.\n */\n meta?: string[];\n /** Disable this row without removing it. */\n disabled?: boolean;\n}\n\n/** A titled group of rows. */\nexport interface ModelPickerGroup {\n key: string;\n /**\n * Rendered verbatim as the group heading. The CALLER derives it (`Apps ·\n * northwind`, `Assistants · personal`) — the library never invents grouping or\n * heading text from the data.\n */\n label: string;\n items: ModelPickerItem[];\n}\n\n/** Total rows across all groups. */\nexport function countItems(groups: readonly ModelPickerGroup[]): number {\n return groups.reduce((n, g) => n + g.items.length, 0);\n}\n","\"use client\";\n\nimport { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Card, CardContent } from \"../card\";\nimport { CopyableValue } from \"../copyable-value\";\nimport { Skeleton } from \"../skeleton\";\nimport { useLocale } from \"../locale-provider\";\nimport { cn } from \"../../lib/cn\";\nimport { type NumberFormatKind, numberFormatOptions } from \"../../lib/compact-number\";\n\n/*\n * `emphasis` — size/weight/space ONLY, no new hue (research 11 §B.5 KPI-1/5):\n * `headline` is the answer-leading rung (`text-kpi`, ~32px); `default` stays\n * calm on the intermediate 1.5rem reading rung (the pre-#188 step between\n * `title` and `kpi` — no app role exists there, same precedent as the prose\n * h1/h3 rungs; baselined in the text-scale ratchet).\n */\nconst metricValueVariants = cva(\"tabular-nums text-foreground\", {\n variants: {\n emphasis: {\n default: \"text-2xl font-semibold tracking-tight\",\n headline: \"text-kpi\",\n },\n },\n defaultVariants: { emphasis: \"default\" },\n});\n\nconst metricContentVariants = cva(\"space-y-2\", {\n variants: {\n emphasis: {\n default: \"p-5\",\n headline: \"p-6\",\n },\n },\n defaultVariants: { emphasis: \"default\" },\n});\n\nexport type MetricCardEmphasis = NonNullable<VariantProps<typeof metricValueVariants>[\"emphasis\"]>;\n\n/**\n * How a NUMERIC `value` is rendered. A function takes over completely.\n *\n * `\"compact\"` is the default because a KPI tile is a small box and\n * `50012102.632741` does not fit in one — the exact figure stays one click\n * away via `CopyableValue`. Anything that is not a `number` (a string, an\n * element) is passed through untouched, so every existing call site is\n * unaffected.\n */\nexport type MetricCardValueFormat = NumberFormatKind | ((value: number) => ReactNode);\n\nexport interface MetricCardProps\n extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof metricValueVariants> {\n label: ReactNode;\n value: ReactNode;\n /**\n * How to render a NUMERIC `value`. Default: `\"compact\"`. Ignored for every\n * other `ReactNode` — a string you already formatted is rendered verbatim.\n */\n valueFormat?: MetricCardValueFormat;\n /** ISO 4217 code for `valueFormat: \"currency\"`. Default: `\"USD\"`. */\n currency?: string;\n /**\n * Offer the exact figure on click when a numeric `value` was shortened.\n * Default: `true`. Turning it off leaves a compacted number with no way back\n * to its digits, so only do that when the tile is decorative.\n */\n copyExactValue?: boolean;\n /** Secondary line under the value — sublabel / context. */\n description?: ReactNode;\n /** Signed change, e.g. \"+12.4%\". Direction colors it. */\n delta?: string;\n deltaDirection?: \"up\" | \"down\" | \"neutral\";\n /** Whether \"up\" is good (green) — flip for metrics where down is good. */\n positiveIsGood?: boolean;\n icon?: ReactNode;\n /** Optional inline visual (e.g. a sparkline) shown under the value/description. */\n visual?: ReactNode;\n /**\n * Optional grounding footer (research 11 §B.5 KPI-3) — connects a cited\n * figure to its source (e.g. an `EvidenceChip` from `@elabs-ai/components-ai`). Rendered\n * subdued (`text-meta text-muted-foreground`) under the tile body.\n */\n evidence?: ReactNode;\n /**\n * Loading vs ready — renders a layout-shaped skeleton (matching the real\n * box height) instead of the value/label/delta text. Default: `false`.\n */\n loading?: boolean;\n /**\n * Whether this tile announces its own `loading` state via a live region.\n * Set to `false` when several tiles are composed inside a container that\n * already announces once for the whole region (e.g. a loading\n * `MetricGrid`) — see loading-states.md §a11y (\"one live region per\n * region, not per box\"). Default: `true`.\n */\n announceLoading?: boolean;\n}\n\n/** Compact KPI tile for dashboards. */\nexport const MetricCard = forwardRef<HTMLDivElement, MetricCardProps>(function MetricCard(\n {\n label,\n value,\n valueFormat = \"compact\",\n currency,\n copyExactValue = true,\n description,\n delta,\n deltaDirection = \"neutral\",\n positiveIsGood = true,\n icon,\n visual,\n evidence,\n emphasis,\n loading = false,\n announceLoading = true,\n className,\n ...props\n },\n ref,\n) {\n const { t, formatNumber } = useLocale();\n\n // Formatting applies to NUMBERS only. Every shipped call site passes a string\n // it formatted itself, so this branch is inert for them — that is what makes\n // a new default safe.\n const isNumeric = typeof value === \"number\";\n const formattedValue: ReactNode = !isNumeric\n ? value\n : typeof valueFormat === \"function\"\n ? valueFormat(value)\n : formatNumber(value, numberFormatOptions(valueFormat, value, currency));\n // Only offer the exact figure when the display actually differs from it —\n // a button around a value that was never shortened is noise.\n const showsExact = isNumeric && String(formattedValue) === String(value);\n const canCopyExact =\n isNumeric && copyExactValue && typeof valueFormat !== \"function\" && !showsExact;\n\n const good =\n deltaDirection === \"up\" ? positiveIsGood : deltaDirection === \"down\" ? !positiveIsGood : null;\n const deltaColor =\n good === null ? \"text-muted-foreground\" : good ? \"text-success-text\" : \"text-destructive-text\";\n // Stable, theme-agnostic polarity hook. High decoration reveals a non-color\n // polarity glyph from this attribute (decoration.css); chromatic themes ignore it\n // and use color. Issue #162.\n const polarity = good === null ? \"neutral\" : good ? \"good\" : \"bad\";\n const arrow = deltaDirection === \"up\" ? \"↑\" : deltaDirection === \"down\" ? \"↓\" : \"\";\n // Direction is conveyed visually by the arrow glyph + color; give AT a single\n // unambiguous name (\"up 12.4%, favorable\") since neither the glyph nor color is a\n // reliable signal (high decoration / high-contrast collapse the hue) — and good/bad\n // polarity is otherwise invisible to AT. See accessibility.md, #162.\n const directionLabel = deltaDirection === \"up\" ? \"up\" : deltaDirection === \"down\" ? \"down\" : \"\";\n const polarityLabel = good === null ? \"\" : good ? \", favorable\" : \", unfavorable\";\n\n return (\n <Card ref={ref} className={cn(\"overflow-hidden\", className)} {...props}>\n <CardContent\n className={metricContentVariants({ emphasis })}\n {...(loading && announceLoading ? { role: \"status\", \"aria-live\": \"polite\" as const } : {})}\n >\n {loading && announceLoading ? (\n <span className=\"sr-only\">{t(\"ui.metricCard.loading\")}</span>\n ) : null}\n <div className=\"flex items-center justify-between\">\n {loading ? (\n <Skeleton className=\"h-4 w-24\" />\n ) : (\n <span className=\"text-body font-medium text-muted-foreground\">{label}</span>\n )}\n {icon ? <span className=\"text-muted-foreground [&_svg]:size-4\">{icon}</span> : null}\n </div>\n <div className=\"flex items-baseline gap-2\">\n {loading ? (\n <Skeleton className={emphasis === \"headline\" ? \"h-9 w-28\" : \"h-8 w-24\"} />\n ) : canCopyExact ? (\n <CopyableValue\n className={metricValueVariants({ emphasis })}\n // Two tiles in one grid can compact to the same display (\"$1.2M\"),\n // and the visible label is a sibling node the button's name does\n // not include — so without this a screen-reader user tabbing the\n // grid hears the identical name twice. A non-string label has no\n // text to borrow; the default hint stands.\n hint={\n typeof label === \"string\" ? `${label}, ${t(\"ui.copyableValue.hint\")}` : undefined\n }\n value={String(value)}\n >\n {formattedValue}\n </CopyableValue>\n ) : (\n <span className={metricValueVariants({ emphasis })}>{formattedValue}</span>\n )}\n {delta ? (\n loading ? (\n <Skeleton className=\"h-4 w-14\" />\n ) : (\n <span\n data-polarity={polarity}\n className={cn(\"text-meta tabular-nums\", deltaColor)}\n aria-label={\n directionLabel ? `${directionLabel} ${delta}${polarityLabel}` : undefined\n }\n >\n {arrow ? <span aria-hidden=\"true\">{arrow} </span> : null}\n {delta}\n </span>\n )\n ) : null}\n </div>\n {description ? (\n loading ? (\n <Skeleton className=\"h-3 w-32\" />\n ) : (\n <p className=\"text-meta font-normal text-muted-foreground\">{description}</p>\n )\n ) : null}\n {visual ? (\n <div className=\"pt-1\">{loading ? <Skeleton className=\"h-8 w-full\" /> : visual}</div>\n ) : null}\n {evidence ? (\n <div className=\"pt-1 text-meta font-normal text-muted-foreground\">\n {loading ? <Skeleton className=\"h-3 w-24\" /> : evidence}\n </div>\n ) : null}\n </CardContent>\n </Card>\n );\n});\n","/**\n * compact-number.ts — the same \"shown short, copied exact\" number rule the\n * charts package applies to axis ticks and tooltips, available to `ui` surfaces\n * that display a figure (today: `MetricCard`).\n *\n * DELIBERATE TWIN of `packages/charts/src/charts/value-format.ts`. Dependencies\n * flow one way — `tokens → ui → charts` — so `ui` cannot import the charts\n * module, and a chart-domain union does not belong in the `ui` public API just\n * to be shared. The duplication is ~20 lines and the two must stay in step:\n * **change one, change the other**, and keep {@link COMPACT_THRESHOLD} equal in\n * both. `metric-card.test.tsx` and `value-format.test.ts` pin the same cases on\n * each side so a drift shows up as a failing test rather than as two surfaces\n * disagreeing about what `1500` looks like.\n */\n\n/** How a numeric value is rendered. Mirrors the charts `ChartValueFormat`. */\nexport type NumberFormatKind = \"number\" | \"compact\" | \"currency\" | \"percent\";\n\n/** Magnitude at or above which `compact`/`currency` switch to compact notation. */\nexport const COMPACT_THRESHOLD = 1000;\n\n/** Used when a caller asks for currency without naming one. */\nexport const DEFAULT_CURRENCY = \"USD\";\n\n/** One decimal keeps `1.5M` readable without implying precision it lacks. */\nexport const DEFAULT_MAX_FRACTION_DIGITS = 1;\n\n/** `Intl.NumberFormatOptions` for `format` at this magnitude. */\nexport function numberFormatOptions(\n format: NumberFormatKind,\n value: number,\n currency: string = DEFAULT_CURRENCY,\n maxFractionDigits?: number,\n): Intl.NumberFormatOptions {\n const compact = Number.isFinite(value) && Math.abs(value) >= COMPACT_THRESHOLD;\n // `\"number\"` is the exact-value escape hatch and keeps `Intl`'s own default\n // (3 digits) unless the caller states one — capping it at the compact rung's\n // single decimal would render 0.0512 as \"0.1\".\n const digits = maxFractionDigits ?? DEFAULT_MAX_FRACTION_DIGITS;\n switch (format) {\n case \"number\":\n return maxFractionDigits === undefined ? {} : { maximumFractionDigits: maxFractionDigits };\n case \"percent\":\n return { style: \"percent\", maximumFractionDigits: digits };\n case \"currency\":\n return compact\n ? {\n style: \"currency\",\n currency,\n notation: \"compact\",\n compactDisplay: \"short\",\n maximumFractionDigits: digits,\n }\n : { style: \"currency\", currency, maximumFractionDigits: digits };\n case \"compact\":\n default:\n return compact\n ? { notation: \"compact\", compactDisplay: \"short\", maximumFractionDigits: digits }\n : { maximumFractionDigits: digits };\n }\n}\n","/**\n * Shared collapsible sidebar navigation primitive (issue #99).\n * Promoted from `packages/ui/src/blocks/sidebar-02/nav-main.tsx`.\n *\n * Renders a `SidebarMenu` of routes; each route with sub-items uses a\n * `Collapsible` expand/collapse affordance. Collapses icon-only when the\n * sidebar is in the `\"collapsed\"` state.\n */\n\"use client\";\n\nimport type React from \"react\";\nimport { useState } from \"react\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible\";\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../sidebar\";\nimport { cn } from \"../../lib/cn\";\n\nexport type NavMainSubItem = {\n title: string;\n link: string;\n icon?: React.ReactNode;\n};\n\nexport type NavMainRoute = {\n id: string;\n title: string;\n icon?: React.ReactNode;\n link: string;\n subs?: NavMainSubItem[];\n};\n\nexport interface NavMainProps {\n routes: NavMainRoute[];\n className?: string;\n}\n\n/**\n * Collapsible primary navigation list for sidebars.\n *\n * - Routes with `subs` render as an expandable group (one open at a time).\n * - Routes without `subs` render as a simple link button.\n * - Collapses to icon-only when the enclosing `Sidebar` is in `\"collapsed\"` state.\n *\n * @example\n * ```tsx\n * <NavMain routes={[\n * { id: \"home\", title: \"Home\", icon: <Home />, link: \"#\" },\n * { id: \"settings\", title: \"Settings\", icon: <Settings />, link: \"#\",\n * subs: [{ title: \"General\", link: \"#\" }] },\n * ]} />\n * ```\n */\nexport function NavMain({ routes, className }: NavMainProps) {\n const { state } = useSidebar();\n const isCollapsed = state === \"collapsed\";\n const [openCollapsible, setOpenCollapsible] = useState<string | null>(null);\n\n return (\n <SidebarMenu className={className}>\n {routes.map((route) => {\n const isOpen = !isCollapsed && openCollapsible === route.id;\n const hasSubRoutes = !!route.subs?.length;\n\n return (\n <SidebarMenuItem key={route.id}>\n {hasSubRoutes ? (\n <Collapsible\n open={isOpen}\n onOpenChange={(open) => setOpenCollapsible(open ? route.id : null)}\n className=\"w-full\"\n >\n <CollapsibleTrigger asChild>\n <SidebarMenuButton\n tooltip={route.title}\n className={cn(\n \"flex w-full items-center rounded-lg px-2 transition-colors\",\n isOpen\n ? \"bg-sidebar-accent text-sidebar-accent-foreground\"\n : \"text-sidebar-muted-foreground\",\n isCollapsed && \"justify-center\",\n )}\n >\n {route.icon}\n {!isCollapsed && (\n <span className=\"ms-2 flex-1 text-sm font-medium\">{route.title}</span>\n )}\n {!isCollapsed && (\n <span className=\"ms-auto\">\n {isOpen ? (\n <ChevronUp className=\"size-4\" />\n ) : (\n <ChevronDown className=\"size-4\" />\n )}\n </span>\n )}\n </SidebarMenuButton>\n </CollapsibleTrigger>\n {!isCollapsed && (\n <CollapsibleContent>\n <SidebarMenuSub className=\"my-1 ms-3.5\">\n {route.subs?.map((subRoute) => (\n <SidebarMenuSubItem\n key={`${route.id}-${subRoute.title}`}\n className=\"h-auto\"\n >\n <SidebarMenuSubButton asChild>\n <a\n href={subRoute.link}\n className=\"flex items-center rounded-md px-4 py-1.5 text-sm font-medium text-sidebar-muted-foreground\"\n >\n {subRoute.title}\n </a>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </CollapsibleContent>\n )}\n </Collapsible>\n ) : (\n <SidebarMenuButton tooltip={route.title} asChild>\n <a\n href={route.link}\n className={cn(\n \"flex items-center rounded-lg px-2 text-sidebar-muted-foreground\",\n isCollapsed && \"justify-center\",\n )}\n >\n {route.icon}\n {!isCollapsed && <span className=\"ms-2 text-sm font-medium\">{route.title}</span>}\n </a>\n </SidebarMenuButton>\n )}\n </SidebarMenuItem>\n );\n })}\n </SidebarMenu>\n );\n}\n","\"use client\";\n\nimport { BellIcon } from \"lucide-react\";\nimport { Avatar, AvatarFallback } from \"../avatar\";\nimport { Button } from \"../button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\n\nexport interface NavNotification {\n id: string;\n /** Two-letter fallback initials for the avatar. */\n fallback: string;\n text: string;\n time: string;\n}\n\nexport interface NavNotificationsProps {\n notifications: NavNotification[];\n /** Label for the \"view all\" footer item. @default \"View all notifications\" */\n viewAllLabel?: string;\n}\n\n/**\n * Sidebar notifications dropdown button. Shared primitive from sidebar-02 (issue #99).\n * Renders a bell-icon ghost button that opens a dropdown listing recent notifications.\n */\nexport function NavNotifications({\n notifications,\n viewAllLabel = \"View all notifications\",\n}: NavNotificationsProps) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"rounded-full\"\n aria-label=\"Open notifications\"\n >\n <BellIcon className=\"size-5\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" className=\"my-6 w-80\">\n <DropdownMenuLabel>Notifications</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {notifications.map(({ id, fallback, text, time }) => (\n <DropdownMenuItem key={id} className=\"flex items-start gap-3\">\n <Avatar className=\"size-8\">\n <AvatarFallback>{fallback}</AvatarFallback>\n </Avatar>\n <div className=\"flex flex-col\">\n <span className=\"text-sm font-medium\">{text}</span>\n <span className=\"text-xs text-muted-foreground\">{time}</span>\n </div>\n </DropdownMenuItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuItem className=\"justify-center text-sm text-muted-foreground\">\n {viewAllLabel}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n","\"use client\";\n\nimport { BadgeCheck, Bell, ChevronsUpDown, CreditCard, LogOut, Sparkles } from \"lucide-react\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"../avatar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nimport { SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar } from \"../sidebar\";\n\nexport interface NavUserUser {\n name: string;\n email: string;\n /** URL for the user's avatar image. */\n avatar?: string;\n}\n\nexport interface NavUserProps {\n user: NavUserUser;\n}\n\n/**\n * Sidebar account / user menu. Shared primitive from sidebar-04 (issue #99).\n * Renders a trigger showing name + email + avatar; the dropdown exposes\n * account, billing, notifications and log-out actions.\n *\n * Wire your own action handlers by composing custom `DropdownMenuItem` children\n * if you need more than the default actions — or extend via className.\n */\nexport function NavUser({ user }: NavUserProps) {\n const { isMobile } = useSidebar();\n const initials = user.name\n .split(\" \")\n .map((n) => n[0])\n .join(\"\")\n .slice(0, 2)\n .toUpperCase();\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground md:h-8 md:p-0\"\n >\n <Avatar className=\"h-8 w-8 rounded-lg\">\n {user.avatar && <AvatarImage src={user.avatar} alt={user.name} />}\n <AvatarFallback className=\"rounded-lg\">{initials}</AvatarFallback>\n </Avatar>\n <div className=\"grid flex-1 text-start text-sm leading-tight\">\n <span className=\"truncate font-medium\">{user.name}</span>\n <span className=\"truncate text-xs\">{user.email}</span>\n </div>\n <ChevronsUpDown className=\"ms-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg\"\n side={isMobile ? \"bottom\" : \"right\"}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenuLabel className=\"p-0 font-normal\">\n <div className=\"flex items-center gap-2 px-1 py-1.5 text-start text-sm\">\n <Avatar className=\"h-8 w-8 rounded-lg\">\n {user.avatar && <AvatarImage src={user.avatar} alt={user.name} />}\n <AvatarFallback className=\"rounded-lg\">{initials}</AvatarFallback>\n </Avatar>\n <div className=\"grid flex-1 text-start text-sm leading-tight\">\n <span className=\"truncate font-medium\">{user.name}</span>\n <span className=\"truncate text-xs\">{user.email}</span>\n </div>\n </div>\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem>\n <Sparkles />\n Upgrade to Pro\n </DropdownMenuItem>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem>\n <BadgeCheck />\n Account\n </DropdownMenuItem>\n <DropdownMenuItem>\n <CreditCard />\n Billing\n </DropdownMenuItem>\n <DropdownMenuItem>\n <Bell />\n Notifications\n </DropdownMenuItem>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuItem>\n <LogOut />\n Log out\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\";\nimport { cva } from \"class-variance-authority\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const NavigationMenu = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Root>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>\n>(function NavigationMenu({ className, children, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Root\n ref={ref}\n className={cn(\"relative z-10 flex max-w-max flex-1 items-center justify-center\", className)}\n {...props}\n >\n {children}\n <NavigationMenuViewport />\n </NavigationMenuPrimitive.Root>\n );\n});\n\nexport const NavigationMenuList = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.List>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>\n>(function NavigationMenuList({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.List\n ref={ref}\n className={cn(\"group flex flex-1 list-none items-center justify-center gap-1\", className)}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuItem = NavigationMenuPrimitive.Item;\n\nexport const navigationMenuTriggerStyle = cva(\n \"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent\",\n);\n\nexport const NavigationMenuTrigger = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>\n>(function NavigationMenuTrigger({ className, children, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Trigger\n ref={ref}\n className={cn(navigationMenuTriggerStyle(), \"group\", className)}\n {...props}\n >\n {children}\n <ChevronDown\n className=\"relative top-px ms-1 size-3 transition-transform duration-base ease-standard group-data-[state=open]:rotate-180\"\n aria-hidden=\"true\"\n />\n </NavigationMenuPrimitive.Trigger>\n );\n});\n\nexport const NavigationMenuContent = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>\n>(function NavigationMenuContent({ className, ...props }, ref) {\n return (\n <NavigationMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"left-0 top-0 w-full p-2 md:absolute md:w-auto\",\n \"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out\",\n \"data-[motion=from-end]:slide-in-from-right-2 data-[motion=from-start]:slide-in-from-left-2 data-[motion=to-end]:slide-out-to-right-2 data-[motion=to-start]:slide-out-to-left-2\",\n \"data-[motion^=from-]:[--tw-ease:var(--ease-entrance)]\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const NavigationMenuLink = NavigationMenuPrimitive.Link;\n\nexport const NavigationMenuViewport = forwardRef<\n ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>\n>(function NavigationMenuViewport({ className, ...props }, ref) {\n return (\n <div className=\"absolute left-0 top-full flex justify-center\">\n <NavigationMenuPrimitive.Viewport\n ref={ref}\n className={cn(\n \"relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow md:w-[var(--radix-navigation-menu-viewport-width)]\",\n \"origin-top transition-[width,height] duration-base ease-standard data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:zoom-in-90 data-[state=closed]:zoom-out-95\",\n className,\n )}\n {...props}\n />\n </div>\n );\n});\n","import { type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface PageShellProps {\n children: ReactNode;\n /** Optional header row (often a <SectionHeader />, or a <ViewToolbar> — see headerVariant). */\n header?: ReactNode;\n /**\n * \"default\" (unset) — `header` renders inline, scrolls with the body.\n * Byte-identical to today.\n *\n * \"toolbar\" — for a `<ViewToolbar>` header (`@elabs-ai/components-ui`,\n * `Docs/View Toolbar Contract`): wraps `header` in a `sticky top-0` container\n * with an opaque/blurred fill and a bottom hairline, so it stays pinned while\n * the body scrolls beneath it. PLACES whatever node `header` is — it does not\n * reimplement ViewToolbar's own info/left-cluster/actions grammar, and it does\n * NOT cap the row's height (a `<ViewToolbar>` wraps at narrow widths; see\n * `Docs/View Toolbar Contract` R7).\n */\n headerVariant?: \"default\" | \"toolbar\";\n /** Constrain content width. Defaults to \"xl\". */\n width?: \"md\" | \"lg\" | \"xl\" | \"full\";\n className?: string;\n contentClassName?: string;\n}\n\nconst widthMap = {\n md: \"max-w-3xl\",\n lg: \"max-w-5xl\",\n xl: \"max-w-7xl\",\n full: \"max-w-none\",\n} as const;\n\n/** Page-level content container with consistent padding and max width. */\nexport function PageShell({\n children,\n header,\n headerVariant = \"default\",\n width = \"xl\",\n className,\n contentClassName,\n}: PageShellProps) {\n return (\n <div className={cn(\"w-full px-4 py-6 sm:px-6 lg:px-8\", className)}>\n <div className={cn(\"mx-auto w-full space-y-6\", widthMap[width], contentClassName)}>\n {header ? (\n headerVariant === \"toolbar\" ? (\n <div\n data-slot=\"page-shell-toolbar-header\"\n className=\"sticky top-0 z-10 border-b border-border bg-background/95 py-3 backdrop-blur\"\n >\n {header}\n </div>\n ) : (\n header\n )\n ) : null}\n {children}\n </div>\n </div>\n );\n}\n","import { forwardRef, type ComponentProps } from \"react\";\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { buttonVariants } from \"../button\";\n\nexport function Pagination({ className, ...props }: ComponentProps<\"nav\">) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n );\n}\nexport const PaginationContent = forwardRef<HTMLUListElement, ComponentProps<\"ul\">>(\n function PaginationContent({ className, ...props }, ref) {\n return (\n <ul ref={ref} className={cn(\"flex flex-row items-center gap-1\", className)} {...props} />\n );\n },\n);\nexport const PaginationItem = forwardRef<HTMLLIElement, ComponentProps<\"li\">>(\n function PaginationItem(props, ref) {\n return <li ref={ref} {...props} />;\n },\n);\ntype PaginationLinkProps = { isActive?: boolean } & ComponentProps<\"a\">;\nexport function PaginationLink({ className, isActive, ...props }: PaginationLinkProps) {\n return (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({ variant: isActive ? \"outline\" : \"ghost\", size: \"icon\" }),\n \"cursor-pointer\",\n className,\n )}\n {...props}\n />\n );\n}\nexport function PaginationPrevious({ className, ...props }: ComponentProps<\"a\">) {\n return (\n <a\n aria-label=\"Go to previous page\"\n className={cn(buttonVariants({ variant: \"ghost\" }), \"gap-1 ps-2.5 cursor-pointer\", className)}\n {...props}\n >\n <ChevronLeft className=\"size-4\" data-rtl-flip />\n <span>Previous</span>\n </a>\n );\n}\nexport function PaginationNext({ className, ...props }: ComponentProps<\"a\">) {\n return (\n <a\n aria-label=\"Go to next page\"\n className={cn(buttonVariants({ variant: \"ghost\" }), \"gap-1 pe-2.5 cursor-pointer\", className)}\n {...props}\n >\n <span>Next</span>\n <ChevronRight className=\"size-4\" data-rtl-flip />\n </a>\n );\n}\nexport function PaginationEllipsis({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n aria-hidden\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"size-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { Circle } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const RadioGroup = forwardRef<\n ElementRef<typeof RadioGroupPrimitive.Root>,\n ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(function RadioGroup({ className, ...props }, ref) {\n return <RadioGroupPrimitive.Root ref={ref} className={cn(\"grid gap-2\", className)} {...props} />;\n});\n\nexport const RadioGroupItem = forwardRef<\n ElementRef<typeof RadioGroupPrimitive.Item>,\n ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\n>(function RadioGroupItem({ className, ...props }, ref) {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"aspect-square size-4 rounded-full border border-input text-primary shadow-sm transition-colors duration-fast ease-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary\",\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center animate-in zoom-in-75 fade-in duration-fast ease-entrance\">\n <Circle className=\"size-2.5 fill-primary text-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n});\n","// a2ui.exposed: yes\nimport {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n type PointerEvent,\n} from \"react\";\nimport { Star } from \"lucide-react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nconst ratingVariants = cva(\"inline-flex items-center\", {\n variants: {\n size: {\n sm: \"gap-0.5\",\n md: \"gap-1\",\n lg: \"gap-1.5\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n});\n\nconst STAR_SIZE: Record<NonNullable<VariantProps<typeof ratingVariants>[\"size\"]>, string> = {\n sm: \"size-4\",\n md: \"size-5\",\n lg: \"size-6\",\n};\n\nexport interface RatingProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\">,\n VariantProps<typeof ratingVariants> {\n /** Controlled value (0..max). */\n value?: number;\n /** Uncontrolled default value (0..max). Default 0. */\n defaultValue?: number;\n /** Called when the rating changes. */\n onValueChange?: (value: number) => void;\n /** Number of stars. Default 5. */\n max?: number;\n /** Allow half-star values (0.5 increments). Default false. */\n allowHalf?: boolean;\n /** Render as a non-interactive display of the value. */\n readOnly?: boolean;\n /** Disable interaction (interactive variant only). */\n disabled?: boolean;\n /** Accessible name for the rating group. Default \"Rating\". */\n \"aria-label\"?: string;\n}\n\nfunction clamp(v: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, v));\n}\n\n/**\n * Rating — a star rating control.\n *\n * Controlled via `value`/`onValueChange`; uncontrolled via `defaultValue`.\n * Interactive mode is a `radiogroup` (keyboard ←/→ adjust by `allowHalf ? 0.5 : 1`,\n * Home clears, End sets max). `readOnly` renders a non-interactive `role=\"img\"`\n * summary. Half-star clicks land on the left/right half of a star when `allowHalf`.\n */\nexport const Rating = forwardRef<HTMLDivElement, RatingProps>(function Rating(\n {\n value: valueProp,\n defaultValue = 0,\n onValueChange,\n max = 5,\n allowHalf = false,\n readOnly = false,\n disabled = false,\n size = \"md\",\n className,\n \"aria-label\": ariaLabel = \"Rating\",\n ...props\n },\n ref,\n) {\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<number>(defaultValue);\n const [hoverValue, setHoverValue] = useState<number | null>(null);\n\n const current = clamp(isControlled ? (valueProp ?? 0) : internalValue, 0, max);\n const interactive = !readOnly && !disabled;\n const display = interactive && hoverValue !== null ? hoverValue : current;\n\n const starRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n const commit = useCallback(\n (next: number) => {\n const clamped = clamp(next, 0, max);\n if (!isControlled) setInternalValue(clamped);\n onValueChange?.(clamped);\n },\n [isControlled, max, onValueChange],\n );\n\n const step = allowHalf ? 0.5 : 1;\n\n const valueFromPointer = useCallback(\n (e: PointerEvent<HTMLButtonElement>, index: number): number => {\n if (!allowHalf) return index;\n const rect = e.currentTarget.getBoundingClientRect();\n const isLeftHalf = e.clientX - rect.left < rect.width / 2;\n return isLeftHalf ? index - 0.5 : index;\n },\n [allowHalf],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (!interactive) return;\n let next = current;\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowUp\":\n next = clamp(current + step, 0, max);\n break;\n case \"ArrowLeft\":\n case \"ArrowDown\":\n next = clamp(current - step, 0, max);\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = max;\n break;\n default:\n return;\n }\n e.preventDefault();\n commit(next);\n // Move focus to the star representing the new value (roving tabindex).\n const focusIndex = Math.max(0, Math.ceil(next) - 1);\n starRefs.current[focusIndex]?.focus();\n },\n [interactive, current, step, max, commit],\n );\n\n // Roving tabindex: the star at the current value (or the first) is the tab stop.\n const tabStopIndex = current > 0 ? Math.ceil(current) - 1 : 0;\n\n // Read-only / disabled: a single non-interactive summary.\n if (!interactive) {\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={`${current} out of ${max}`}\n className={cn(ratingVariants({ size }), disabled && \"opacity-50\", className)}\n {...props}\n >\n {Array.from({ length: max }, (_, i) => (\n <StarGlyph key={i} fill={clamp(display - i, 0, 1)} sizeClass={STAR_SIZE[size ?? \"md\"]} />\n ))}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={ariaLabel}\n className={cn(ratingVariants({ size }), className)}\n onKeyDown={handleKeyDown}\n onPointerLeave={() => setHoverValue(null)}\n {...props}\n >\n {Array.from({ length: max }, (_, i) => {\n const index = i + 1;\n const checked = Math.ceil(current) === index;\n return (\n <button\n key={index}\n ref={(el) => {\n starRefs.current[i] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n aria-label={`${index} ${index === 1 ? \"star\" : \"stars\"}`}\n tabIndex={i === tabStopIndex ? 0 : -1}\n className=\"rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\"\n onClick={(e) =>\n commit(valueFromPointer(e as unknown as PointerEvent<HTMLButtonElement>, index))\n }\n onPointerMove={(e) => setHoverValue(valueFromPointer(e, index))}\n >\n <StarGlyph fill={clamp(display - i, 0, 1)} sizeClass={STAR_SIZE[size ?? \"md\"]} />\n </button>\n );\n })}\n </div>\n );\n});\n\ninterface StarGlyphProps {\n /** Fill fraction 0..1 for this star. */\n fill: number;\n sizeClass: string;\n}\n\n/** A single star rendered with a partial fill overlay (supports half stars). */\nfunction StarGlyph({ fill, sizeClass }: StarGlyphProps) {\n return (\n <span className={cn(\"relative inline-block\", sizeClass)} aria-hidden=\"true\">\n <Star className={cn(sizeClass, \"text-muted-foreground\")} />\n {fill > 0 && (\n <span\n className=\"absolute inset-0 overflow-hidden\"\n // Width is a layout value (the fill fraction), never a color.\n style={{ width: `${fill * 100}%` }}\n >\n <Star className={cn(sizeClass, \"fill-current text-warning\")} />\n </span>\n )}\n </span>\n );\n}\n","import { GripVertical } from \"lucide-react\";\nimport * as ResizablePrimitive from \"react-resizable-panels\";\nimport { cn } from \"../../lib/cn\";\n\nexport function ResizablePanelGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {\n return (\n <ResizablePrimitive.PanelGroup\n className={cn(\"flex size-full data-[panel-group-direction=vertical]:flex-col\", className)}\n {...props}\n />\n );\n}\n\nexport const ResizablePanel = ResizablePrimitive.Panel;\n\nexport function ResizableHandle({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & { withHandle?: boolean }) {\n return (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0\",\n className,\n )}\n {...props}\n >\n {withHandle && (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border\">\n <GripVertical className=\"size-2.5\" />\n </div>\n )}\n </ResizablePrimitive.PanelResizeHandle>\n );\n}\n","import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n type CSSProperties,\n type HTMLAttributes,\n type ReactElement,\n} from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Entrance-animation classes (tw-animate-css), gated by the motion system: the\n * `duration-*` utility feeds `--tw-duration` (= the gated `--t-*`), so the\n * reveal slows to ~0 when motion is reduced/off. `fill-mode-both` holds the\n * start state through any stagger delay so items don't flash in early.\n */\nexport const revealVariants = cva(\"animate-in fill-mode-both\", {\n variants: {\n appear: {\n // Travel ~24px (slide-*-6): below ~16px a slide reads as a flicker/pop, not\n // trackable motion — distance, not duration, is what makes it feel smooth.\n fade: \"fade-in\",\n up: \"fade-in slide-in-from-bottom-6\",\n down: \"fade-in slide-in-from-top-6\",\n left: \"fade-in slide-in-from-right-6\",\n right: \"fade-in slide-in-from-left-6\",\n zoom: \"fade-in zoom-in-95\",\n },\n speed: {\n fast: \"duration-fast ease-entrance\",\n base: \"duration-base ease-entrance\",\n slow: \"duration-slow ease-entrance\",\n },\n },\n defaultVariants: { appear: \"up\", speed: \"slow\" },\n});\n\nexport interface RevealProps\n extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof revealVariants> {\n /** Animation delay in ms (RevealGroup sets this per child to stagger). */\n delayMs?: number;\n}\n\n/**\n * Animates its content in on mount (fade + directional slide/zoom). Gated by the\n * motion system — no animation when motion is reduced/off. For a list/grid, use\n * {@link RevealGroup} to stagger children.\n */\nexport const Reveal = forwardRef<HTMLDivElement, RevealProps>(function Reveal(\n { className, appear, speed, delayMs, style, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(revealVariants({ appear, speed }), className)}\n style={delayMs ? { animationDelay: `${delayMs}ms`, ...style } : style}\n {...props}\n />\n );\n});\n\nexport interface RevealGroupProps\n extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof revealVariants> {\n /** Delay added per successive child, in ms. */\n staggerMs?: number;\n}\n\ntype RevealableChild = ReactElement<{ className?: string; style?: CSSProperties }>;\n\n/**\n * Staggers an entrance across direct children. Clones each child to add the\n * reveal classes + an incremental `animation-delay` — no wrapper elements, so it\n * is safe inside flex/grid layouts. Remount it (e.g. via a changing `key`) to\n * replay. Gated by the motion system.\n */\nexport const RevealGroup = forwardRef<HTMLDivElement, RevealGroupProps>(function RevealGroup(\n { children, className, appear, speed, staggerMs = 60, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={className} {...props}>\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child;\n const el = child as RevealableChild;\n return cloneElement(el, {\n className: cn(revealVariants({ appear, speed }), el.props.className),\n style: { animationDelay: `${index * staggerMs}ms`, ...el.props.style },\n });\n })}\n </div>\n );\n});\n","import { type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface SectionHeaderProps {\n title: ReactNode;\n description?: ReactNode;\n /** Right-aligned actions (buttons, menus). */\n actions?: ReactNode;\n /** Optional element rendered above the title (eyebrow / breadcrumbs). */\n eyebrow?: ReactNode;\n className?: string;\n}\n\n/** A consistent page/section heading row with optional actions. */\nexport function SectionHeader({\n title,\n description,\n actions,\n eyebrow,\n className,\n}: SectionHeaderProps) {\n return (\n <div className={cn(\"flex flex-wrap items-end justify-between gap-4\", className)}>\n <div className=\"space-y-1\">\n {eyebrow ? (\n <div className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {eyebrow}\n </div>\n ) : null}\n <h2 className=\"text-title text-foreground\">{title}</h2>\n {description ? <p className=\"text-sm text-muted-foreground\">{description}</p> : null}\n </div>\n {actions ? <div className=\"flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n","\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useId,\n useRef,\n useState,\n type FocusEvent as ReactFocusEvent,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Label } from \"../label\";\nimport { ToggleGroup, ToggleGroupItem } from \"../toggle-group\";\n\n/** Keys whose focus move must also move the selection (WAI-ARIA radiogroup). */\nconst NAV_KEYS = new Set([\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"]);\n\nexport interface SegmentedFieldOption {\n /** The option's value, reported to `onValueChange`. */\n value: string;\n /** Visible content for the segment. */\n label: ReactNode;\n /** Disables just this segment. */\n disabled?: boolean;\n}\n\nexport interface SegmentedFieldProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** Visible label describing the field. */\n label: ReactNode;\n /**\n * Segment options. Omit and render `ToggleGroupItem` children directly for\n * the compound-component escape hatch (component-api.md) when a plain\n * `{ value, label }` shape isn't expressive enough.\n */\n options?: SegmentedFieldOption[];\n /** Controlled selected value. */\n value?: string;\n /** Uncontrolled initial selected value. */\n defaultValue?: string;\n /**\n * Called when the selected value changes. Never called with `\"\"` —\n * re-clicking the active segment (Radix `ToggleGroup`'s `type=\"single\"`\n * empty-emission on re-click) is swallowed as a no-op instead of clearing\n * the field.\n */\n onValueChange?: (value: string) => void;\n /** Size applied to every segment. Defaults to \"sm\", matching the compact segmented look. */\n size?: \"default\" | \"sm\" | \"lg\";\n /** Disables every segment. */\n disabled?: boolean;\n /** `ToggleGroupItem` children — the compound escape hatch (used instead of `options`). */\n children?: ReactNode;\n}\n\n/**\n * SegmentedField — a labelled segmented control with STICKY selection.\n *\n * Composes the existing `Label` + `ToggleGroup`/`ToggleGroupItem`\n * (`variant=\"segmented\"`) — no new visual style. The whole reason this\n * component exists: Radix's `ToggleGroup` in `type=\"single\"` mode emits `\"\"`\n * when the already-active segment is re-clicked, silently clearing a field\n * that must always hold exactly one value. `SegmentedField` swallows that\n * emission so re-clicking the active segment is a true no-op.\n *\n * Per the WAI-ARIA radiogroup pattern (each segment renders `role=\"radio\"`\n * for `type=\"single\"`), ARROW-KEY navigation also SELECTS the newly focused\n * segment (selection follows focus), matching native radio-button behavior —\n * Radix's roving-tabindex only moves focus, so this component adds that\n * activation on top of it.\n *\n * Selection follows focus ONLY for arrow/Home/End keys, never for arbitrary\n * focus. A bare `onFocus` commit would make three non-navigation paths mutate\n * the field: clicking the `<Label>` (which moves focus into the group),\n * tabbing into a group with nothing selected yet, and any programmatic\n * `.focus()` a consumer performs. The keyboard intent is recorded on the\n * wrapper in the CAPTURE phase (it must land before Radix's own roving-focus\n * keydown handler runs) and is cleared by the focus it explains, by a pointer\n * press, by any non-navigation key, or by focus leaving the field — so it can\n * never leak into a later, unrelated focus.\n */\nexport const SegmentedField = forwardRef<HTMLDivElement, SegmentedFieldProps>(\n function SegmentedField(\n {\n label,\n options,\n value: valueProp,\n defaultValue,\n onValueChange,\n size = \"sm\",\n disabled,\n id,\n className,\n children,\n ...props\n },\n ref,\n ) {\n const generatedId = useId();\n const labelId = `${id ?? generatedId}-label`;\n const groupRef = useRef<HTMLDivElement>(null);\n\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const currentValue = isControlled ? valueProp : internalValue;\n\n // Synced every render (mirrors the ref-during-render idiom in\n // NumberInput) so a same-event double-dispatch (focus-follows-selection\n // AND the click's own onPressedChange) commits at most once.\n const lastCommittedRef = useRef(currentValue);\n lastCommittedRef.current = currentValue;\n\n const commit = useCallback(\n (next: string) => {\n // Radix emits \"\" when the active segment is re-clicked — swallow it.\n if (next === \"\" || next === lastCommittedRef.current) return;\n lastCommittedRef.current = next;\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n // Armed by an arrow/Home/End key, DISARMED by anything else — a pointer\n // press, any other key, or focus leaving the field. It is deliberately not\n // a timer: `@radix-ui/react-roving-focus` moves focus in a\n // `setTimeout(() => focusFirst(...))`, so a microtask/`setTimeout` reset\n // queued from the capture phase would always fire first and the arm would\n // be gone before the focus it exists to classify.\n const keyboardNavRef = useRef(false);\n\n const handleKeyDownCapture = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n keyboardNavRef.current = NAV_KEYS.has(event.key);\n props.onKeyDownCapture?.(event);\n },\n [props],\n );\n\n const handlePointerDownCapture = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n keyboardNavRef.current = false;\n props.onPointerDownCapture?.(event);\n },\n [props],\n );\n\n const handleBlurCapture = useCallback(\n (event: ReactFocusEvent<HTMLDivElement>) => {\n // Focus moving between segments keeps the arm; leaving the field drops\n // it, so a stale arm can never fire on a later tab-in.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n keyboardNavRef.current = false;\n }\n props.onBlurCapture?.(event);\n },\n [props],\n );\n\n const handleItemFocus = useCallback(\n (next: string) => {\n if (!keyboardNavRef.current) return;\n keyboardNavRef.current = false;\n commit(next);\n },\n [commit],\n );\n\n // Match a native `<label>`: move focus into the field without changing it.\n // Focusing the SELECTED segment (not blindly the first) keeps the visible\n // selection and the focus ring in agreement.\n const handleLabelClick = useCallback(() => {\n const group = groupRef.current;\n if (!group) return;\n const selected = group.querySelector<HTMLButtonElement>(\n '[aria-checked=\"true\"]:not(:disabled),[data-state=\"on\"]:not(:disabled)',\n );\n (selected ?? group.querySelector<HTMLButtonElement>(\"button:not(:disabled)\"))?.focus();\n }, []);\n\n return (\n <div\n ref={ref}\n data-slot=\"segmented-field\"\n className={cn(\"flex flex-col items-start gap-1.5\", className)}\n {...props}\n // After the spread: these three are load-bearing (they classify a\n // focus as arrow-navigation or not) and each re-invokes the consumer's\n // handler, so composing beats being silently replaced.\n onKeyDownCapture={handleKeyDownCapture}\n onPointerDownCapture={handlePointerDownCapture}\n onBlurCapture={handleBlurCapture}\n >\n <Label id={labelId} data-slot=\"segmented-field-label\" onClick={handleLabelClick}>\n {label}\n </Label>\n <ToggleGroup\n ref={groupRef}\n type=\"single\"\n variant=\"segmented\"\n size={size}\n // Always a string, never `undefined` — an unselected field would\n // otherwise start UNcontrolled and flip to controlled on the first\n // selection (React/Radix warn, and the mode flip is exactly what\n // component-api.md forbids). `\"\"` is Radix's \"nothing selected\".\n value={currentValue ?? \"\"}\n onValueChange={commit}\n disabled={disabled}\n aria-labelledby={labelId}\n data-slot=\"segmented-field-options\"\n >\n {options\n ? options.map((option) => (\n <ToggleGroupItem\n key={option.value}\n data-slot=\"segmented-field-segment\"\n value={option.value}\n disabled={option.disabled}\n onFocus={() => handleItemFocus(option.value)}\n >\n {option.label}\n </ToggleGroupItem>\n ))\n : children}\n </ToggleGroup>\n </div>\n );\n },\n);\n","import {\n createContext,\n forwardRef,\n useContext,\n type ComponentPropsWithoutRef,\n type ElementRef,\n} from \"react\";\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\";\nimport { type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\nimport { toggleVariants } from \"../toggle\";\n\ntype ToggleVariantProps = VariantProps<typeof toggleVariants>;\nconst ToggleGroupContext = createContext<ToggleVariantProps>({\n size: \"default\",\n variant: \"default\",\n});\n\nexport const ToggleGroup = forwardRef<\n ElementRef<typeof ToggleGroupPrimitive.Root>,\n ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & ToggleVariantProps\n>(function ToggleGroup({ className, variant, size, children, ...props }, ref) {\n return (\n <ToggleGroupPrimitive.Root\n ref={ref}\n className={cn(\n \"flex items-center gap-1\",\n // Segmented groups carry the TabsList track (recessed muted fill);\n // the raised active segment comes from the item variant.\n variant === \"segmented\" && \"gap-0 rounded-lg bg-muted p-1 text-muted-foreground\",\n className,\n )}\n {...props}\n >\n <ToggleGroupContext.Provider value={{ variant, size }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n );\n});\n\nexport const ToggleGroupItem = forwardRef<\n ElementRef<typeof ToggleGroupPrimitive.Item>,\n ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & ToggleVariantProps\n>(function ToggleGroupItem({ className, children, variant, size, ...props }, ref) {\n const ctx = useContext(ToggleGroupContext);\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n className={cn(\n toggleVariants({ variant: ctx.variant ?? variant, size: ctx.size ?? size }),\n className,\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\nexport const toggleVariants = cva(\n // Pressed (data-[state=on]) reads as a clearly-distinct, AA-safe state: an\n // accent fill + bolded label (accent/accent-foreground is a guaranteed AA\n // pair) plus a solid `primary` border as a ≥3:1 non-text boundary cue. We\n // deliberately do NOT use `bg-primary`/`text-primary-foreground`: under the\n // pre-debrand green palette that pair measured only 3.61:1 in `light`, which\n // fails AA for text labels (#148). The retuned palette flipped\n // `--primary-foreground` to near-black on a light primary and clears AA\n // comfortably, so the CONTRAST argument is spent — the shape stands on design\n // grounds instead: a pressed toggle is a secondary state and an accent fill is\n // the right weight for it. The border carries the strength; the focus ring is\n // untouched.\n //\n // Active styles are keyed on BOTH data-[state=on]: AND aria-pressed:/aria-checked:\n // (belt-and-suspenders, mirroring the `segmented` variant). A TooltipTrigger\n // asChild wrapper overwrites data-state=\"on\" with \"closed\" — aria-pressed\n // (Toggle) and aria-checked (ToggleGroupItem) are set by the toggle primitive\n // alone and survive the merge. (#214)\n \"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors duration-fast ease-standard hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:font-semibold aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:font-semibold aria-checked:bg-accent aria-checked:text-accent-foreground aria-checked:font-semibold [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n // `border border-transparent` reserves the 1px so the pressed\n // `border-primary` does not shift layout.\n default:\n \"border border-transparent bg-transparent data-[state=on]:border-primary aria-pressed:border-primary aria-checked:border-primary\",\n outline:\n \"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground data-[state=on]:border-primary aria-pressed:border-primary aria-checked:border-primary\",\n // Segmented mode switch: the SAME elevation grammar as TabsTrigger —\n // raised elevated segment on a recessed `bg-muted` track (the track\n // comes from ToggleGroup `variant=\"segmented\"`). No `border-primary`\n // here: within a group the active boundary is the fill/elevation\n // change (1.4.11 redundant boundary), and no weight shift on press\n // (labels would jiggle the segment widths).\n // Keyed off aria-checked/aria-pressed, NOT data-[state=on]: a\n // TooltipTrigger asChild wrapper overwrites the toggle's data-state\n // with the tooltip's (\"closed\"), silently killing the active style —\n // the aria attributes are set by the toggle primitive alone.\n segmented:\n \"border-0 bg-transparent text-muted-foreground hover:bg-transparent hover:text-foreground aria-checked:bg-surface-elevated aria-checked:text-foreground aria-checked:font-medium aria-checked:shadow-sm aria-pressed:bg-surface-elevated aria-pressed:text-foreground aria-pressed:font-medium aria-pressed:shadow-sm data-[state=on]:bg-surface-elevated data-[state=on]:text-foreground data-[state=on]:font-medium data-[state=on]:shadow-sm\",\n },\n size: { default: \"h-9 px-2.5 min-w-9\", sm: \"h-8 px-2 min-w-8\", lg: \"h-10 px-3 min-w-10\" },\n },\n defaultVariants: { variant: \"default\", size: \"default\" },\n },\n);\n\nexport const Toggle = forwardRef<\n ElementRef<typeof TogglePrimitive.Root>,\n ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>\n>(function Toggle({ className, variant, size, ...props }, ref) {\n return (\n <TogglePrimitive.Root\n ref={ref}\n className={cn(toggleVariants({ variant, size }), className)}\n {...props}\n />\n );\n});\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n} from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { mergeRefs } from \"../../lib/merge-refs\";\n\nexport const Select = SelectPrimitive.Root;\nexport const SelectGroup = SelectPrimitive.Group;\nexport const SelectValue = SelectPrimitive.Value;\n\n/** Sub-pixel layout rounding — an element is only \"clipped\" beyond this. */\nconst CLIP_SLACK_PX = 1;\n\nfunction isClipped(el: Element) {\n return (\n el.scrollWidth > el.clientWidth + CLIP_SLACK_PX ||\n el.scrollHeight > el.clientHeight + CLIP_SLACK_PX\n );\n}\n\n/**\n * The trigger's visible text, ONE SEGMENT PER CHILD NODE joined by a space, so\n * a prefix/badge beside `SelectValue` reads `\"Env: Staging\"` — a bare\n * `textContent` read concatenates the DOM's text nodes with no separator and\n * produces `\"Env:Staging\"`.\n */\nfunction composeTriggerText(node: HTMLElement) {\n return Array.from(node.childNodes)\n .map((child) => child.textContent?.replace(/\\s+/gu, \" \").trim() ?? \"\")\n .filter(Boolean)\n .join(\" \");\n}\n\nexport type SelectTriggerProps = ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n size?: \"sm\" | \"default\";\n /**\n * Auto-set a native `title` from the trigger's rendered text — but ONLY\n * while that text is actually clipped (default `true`).\n *\n * Set `false` when the trigger is a `TooltipTrigger`: the native tooltip and\n * the Radix one would otherwise both appear on hover. A caller-supplied\n * `title` also disables it (an explicit `title` is never overridden).\n */\n autoTitle?: boolean;\n};\n\n/**\n * `[&>span]:line-clamp-1` clips the rendered `SelectValue` — necessary so a\n * long/composed label doesn't blow out the trigger's width. To keep clipped\n * text recoverable, the trigger MEASURES its content and sets a native `title`\n * only while something is genuinely cut off, so it's readable on mouse hover\n * with zero extra code.\n *\n * The measurement is not cosmetic: an unconditional `title` becomes the\n * button's accessible name, which would paper over a real \"this combobox has\n * no name\" a11y failure with the field's own VALUE — a value is not a name.\n * Label the trigger properly (`aria-label`/`aria-labelledby`) regardless.\n *\n * `title` also never reaches keyboard users — for that, wrap the trigger in\n * `Tooltip`/`TooltipTrigger asChild`/`TooltipContent` and pass\n * `autoTitle={false}` (see the `LongComposedLabel` story), which Radix opens\n * on keyboard focus too.\n */\nexport const SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(function SelectTrigger(\n { className, children, size = \"default\", title, autoTitle = true, ...props },\n ref,\n) {\n const innerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMemo(() => mergeRefs(ref, innerRef), [ref]);\n\n useEffect(() => {\n if (!autoTitle) return;\n if (title !== undefined) return; // caller owns `title` — never override it\n const node = innerRef.current;\n if (!node) return;\n\n const sync = () => {\n // The clamp lives on the child spans, but a long unbroken value can also\n // overflow the trigger box itself — check both.\n const clipped = isClipped(node) || Array.from(node.children).some(isClipped);\n const text = clipped ? composeTriggerText(node) : \"\";\n if (text) node.title = text;\n else node.removeAttribute(\"title\");\n };\n sync();\n\n // The selected item's text isn't a React child of this component — Radix\n // portals it into the (child) `SelectValue` node from `SelectContent`\n // asynchronously, on its OWN commit, so a one-shot read here can run\n // before that text lands. Observe the subtree instead of trusting this\n // component's own render cycle. (Attributes are deliberately NOT observed:\n // `sync` writes `title`, which would otherwise re-enter.)\n const observer = new MutationObserver(sync);\n observer.observe(node, { childList: true, subtree: true, characterData: true });\n\n // Clipping is a function of WIDTH, so it has to be re-measured when the\n // trigger resizes, not only when its text changes.\n const resizeObserver =\n typeof ResizeObserver === \"function\" ? new ResizeObserver(sync) : undefined;\n resizeObserver?.observe(node);\n\n return () => {\n observer.disconnect();\n resizeObserver?.disconnect();\n };\n }, [autoTitle, title]);\n\n return (\n <SelectPrimitive.Trigger\n ref={mergedRef}\n data-size={size}\n title={title}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm\",\n size === \"sm\" ? \"h-8\" : \"h-9\",\n \"placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 focus:ring-offset-background\",\n // No `disabled:cursor-*` override — disabled controls keep the arrow\n // automatically (interaction-guidelines.md), matching Combobox's\n // Button-based trigger (`disabled:pointer-events-none`) (#343).\n \"disabled:opacity-50 disabled:border-border [&>span]:line-clamp-1\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n});\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(function SelectContent({ className, children, position = \"popper\", ...props }, ref) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-popover text-popover-foreground shadow-ring-md\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ScrollUpButton className=\"flex cursor-default items-center justify-center py-1\">\n <ChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectPrimitive.ScrollDownButton className=\"flex cursor-default items-center justify-center py-1\">\n <ChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(function SelectLabel({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-xs font-semibold text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n\nexport const SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(function SelectItem({ className, children, ...props }, ref) {\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 ps-2 pe-8 text-sm outline-none transition-colors duration-fast\",\n \"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute end-2 flex size-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n});\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(function SelectSeparator({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n );\n});\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport { cn } from \"../../lib/cn\";\n\n/** Props for a single `SliderPrimitive.Thumb` — see `SliderProps[\"thumbProps\"]`. */\nexport type SliderThumbProps = ComponentPropsWithoutRef<typeof SliderPrimitive.Thumb>;\n\nexport type SliderProps = ComponentPropsWithoutRef<typeof SliderPrimitive.Root> & {\n /**\n * Announced instead of the raw numeric value (e.g. `\"step 3 of 12\"` for a\n * replay scrubber). Forwarded to the thumb alongside `aria-label`/\n * `aria-labelledby` — see the doc comment below for why it has to land\n * there, not on the root.\n */\n \"aria-valuetext\"?: string;\n /**\n * Escape hatch spread onto the thumb LAST — for `data-*`/`style`/etc, or to\n * deliberately override `aria-label`/`aria-labelledby`/`aria-valuetext`\n * (an explicit key here always wins over the matching top-level prop).\n *\n * The six keys that MAKE the element a slider are ignored on purpose:\n * `role`, `aria-valuenow`, `aria-valuemin`, `aria-valuemax`,\n * `aria-orientation` and `tabIndex`. Radix derives every one of them from\n * the slider's live state and spreads consumer props AFTER its own, so\n * passing them here would silently destroy the widget (a wrong\n * `aria-valuenow` mis-announces the value; `role`/`tabIndex` make it\n * unreachable). Change the VALUE (`value`/`min`/`max`/`orientation`/\n * `disabled`) on `Slider` instead; use `aria-valuetext` to change how the\n * value is spoken.\n *\n * Radix renders one thumb per element of `value`/`defaultValue` — pass a\n * single object to apply the same props to every thumb (the historical\n * single-thumb shape, unchanged), or an ARRAY to give each thumb its own\n * props, indexed positionally against `value`/`defaultValue` (#398). A\n * missing array slot falls back to no per-thumb override for that thumb.\n */\n thumbProps?: SliderThumbProps | SliderThumbProps[];\n};\n\n/**\n * Attributes Radix computes for the thumb and then lets consumer props\n * overwrite (`SliderThumbImpl` spreads them before `...thumbProps`). Dropping\n * them here is what keeps the escape hatch from being a foot-gun.\n */\nconst PROTECTED_THUMB_KEYS = [\n \"role\",\n \"aria-valuenow\",\n \"aria-valuemin\",\n \"aria-valuemax\",\n \"aria-orientation\",\n \"tabIndex\",\n] as const;\n\nfunction withoutProtectedKeys(\n thumbProps: SliderThumbProps | undefined,\n): SliderThumbProps | undefined {\n if (!thumbProps) return thumbProps;\n let safe = thumbProps;\n for (const key of PROTECTED_THUMB_KEYS) {\n if (!(key in safe)) continue;\n const { [key]: _dropped, ...rest } = safe;\n safe = rest;\n }\n return safe;\n}\n\n/** `thumbProps` for the thumb at `index` — the shared object for every thumb, or that array slot. */\nfunction getThumbPropsAt(\n thumbProps: SliderProps[\"thumbProps\"],\n index: number,\n): SliderThumbProps | undefined {\n if (!thumbProps) return undefined;\n return Array.isArray(thumbProps) ? thumbProps[index] : thumbProps;\n}\n\n/**\n * Range input — a single-thumb value by default, or a multi-thumb range\n * slider when `value`/`defaultValue` is an array with more than one element\n * (Radix's own range-slider shape; #398). One `Thumb` is rendered per value.\n *\n * `aria-label` / `aria-labelledby` / `aria-valuetext` are routed to the\n * THUMB(S), not the root: Radix puts `role=\"slider\"` on the thumb, so a name\n * (or value text) on the root would never reach the widget. Pass `aria-label`\n * (or `aria-labelledby`, for a visible `<Label>`) — an unnamed slider is an\n * accessibility failure. For a range slider, pass an ARRAY to `thumbProps` so\n * each thumb gets its own name/valuetext (e.g. \"Minimum price\"/\"Maximum\n * price\") — the top-level `aria-label`/`aria-valuetext` apply identically to\n * every thumb, which is rarely what a multi-thumb slider wants.\n */\nexport const Slider = forwardRef<ElementRef<typeof SliderPrimitive.Root>, SliderProps>(\n function Slider(\n {\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n \"aria-valuetext\": ariaValueText,\n thumbProps,\n value,\n defaultValue,\n ...props\n },\n ref,\n ) {\n const values = value ?? defaultValue;\n const thumbCount = Array.isArray(values) ? values.length : 1;\n return (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\"relative flex w-full touch-none select-none items-center\", className)}\n value={value}\n defaultValue={defaultValue}\n {...props}\n >\n <SliderPrimitive.Track className=\"relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted\">\n <SliderPrimitive.Range className=\"absolute h-full bg-primary\" />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }, (_, index) => {\n const safeThumbProps = withoutProtectedKeys(getThumbPropsAt(thumbProps, index));\n return (\n <SliderPrimitive.Thumb\n key={index}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-valuetext={ariaValueText}\n {...safeThumbProps}\n className={cn(\n \"block size-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n safeThumbProps?.className,\n )}\n />\n );\n })}\n </SliderPrimitive.Root>\n );\n },\n);\n","\"use client\";\n\nimport { forwardRef, useCallback, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\nimport { NumberInput } from \"../number-input\";\nimport { Slider } from \"../slider\";\nimport { useLocale } from \"../locale-provider\";\n\nexport interface SliderNumberProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n> {\n /** Controlled value. Pass `null` for \"use the provider default\". */\n value?: number | null;\n /** Uncontrolled initial value. */\n defaultValue?: number | null;\n /** Called when the value changes — always rounded identically on the drag and type paths. */\n onValueChange?: (value: number | null) => void;\n /** Minimum allowed value. Defaults to 0. */\n min?: number;\n /** Maximum allowed value. Defaults to 100. */\n max?: number;\n /** Step increment for both the slider and the number input's arrow keys. Defaults to 1. */\n step?: number;\n /**\n * Number of decimal places to round to. Defaults to the decimal places in\n * `step` (e.g. `step={0.1}` rounds to 1 decimal). Applied identically on\n * BOTH the slider path and the number-input path so drag-then-type never\n * disagrees.\n */\n precision?: number;\n /** Label for the reset-to-provider-default control. Defaults to \"Reset\". */\n resetLabel?: ReactNode;\n /** Disables the whole control. */\n disabled?: boolean;\n id?: string;\n name?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n}\n\nfunction getStepDecimals(step: number): number {\n const str = step.toString();\n const dot = str.indexOf(\".\");\n return dot === -1 ? 0 : str.length - dot - 1;\n}\n\nfunction clampValue(value: number, min?: number, max?: number): number {\n let result = value;\n if (min !== undefined) result = Math.max(min, result);\n if (max !== undefined) result = Math.min(max, result);\n return result;\n}\n\n/** Rounds to a fixed decimal precision — the ONE function both paths call. */\nfunction roundValue(value: number, step: number, precision?: number): number {\n const decimals = precision ?? getStepDecimals(step);\n const factor = 10 ** decimals;\n return Math.round(value * factor) / factor;\n}\n\n/**\n * SliderNumber — a `Slider` and a `NumberInput` bound to one value, clamped\n * and rounded in lockstep so they can never disagree, plus an explicit\n * `null` state meaning \"use the provider default\" with a reset control.\n *\n * The subtle part (#372): both the slider's `onValueChange` and the number\n * input's `onValueChange` are routed through the SAME `commit` function,\n * which rounds to a fixed decimal precision before storing — so dragging to\n * a value and then typing the same value never produces two representations\n * of the same intent (e.g. floating-point drift like `0.30000000000000004`).\n */\nexport const SliderNumber = forwardRef<HTMLDivElement, SliderNumberProps>(function SliderNumber(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n precision,\n resetLabel,\n disabled,\n id,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n className,\n ...props\n },\n ref,\n) {\n const { t } = useLocale();\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = useState<number | null>(\n defaultValue !== undefined ? defaultValue : null,\n );\n const currentValue = isControlled ? valueProp : internalValue;\n\n // Bumped whenever this component normalises a typed value back to the value\n // it ALREADY holds. `NumberInput` only re-derives its display text when the\n // controlled `value` prop CHANGES, so in that one case it would keep showing\n // the raw keystrokes (\"0.44\") while the slider and the committed value read\n // the rounded one (0.4) — the exact \"slider and input disagree\" failure this\n // component exists to prevent. Remounting it re-derives the text from the\n // value that was actually accepted. It only ever fires on blur, when the\n // input is no longer focused, so the remount is invisible.\n const [inputEpoch, setInputEpoch] = useState(0);\n\n const commit = useCallback(\n (next: number | null) => {\n const rounded = next == null ? null : roundValue(clampValue(next, min, max), step, precision);\n if (next != null && rounded !== next && rounded === currentValue) {\n setInputEpoch((n) => n + 1);\n }\n if (!isControlled) setInternalValue(rounded);\n onValueChange?.(rounded);\n },\n [isControlled, onValueChange, min, max, step, precision, currentValue],\n );\n\n const isDefault = currentValue == null;\n const sliderValue = currentValue ?? min;\n\n return (\n <div\n ref={ref}\n data-slot=\"slider-number\"\n // A default FIXED width (matching Slider's own convention — it has no\n // intrinsic width either, and its stories always pass one via\n // className) so the Slider's `flex-1` has real space to grow into.\n // `w-full`/percentage widths are unresolvable inside an ancestor with\n // no definite width (e.g. Storybook's default \"centered\" layout, or a\n // bare inline/flex context), which collapses `flex-1` to near-zero.\n // Callers in a definite-width layout can still override via `className`\n // (e.g. `className=\"w-full\"` inside a form field's own fixed-width row).\n // `max-w-full` keeps the fixed width from OVERFLOWING a container\n // narrower than 20rem (a settings drawer, a 320px mobile column) — it is\n // a preferred width, not a floor.\n className={cn(\"flex w-80 max-w-full items-center gap-3\", className)}\n {...props}\n >\n <Slider\n data-slot=\"slider-number-slider\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n value={[sliderValue]}\n onValueChange={(values) => commit(values[0] ?? null)}\n thumbProps={{\n // Visually distinct \"provider default\" thumb — dimmed + dashed,\n // never confusable with a real value (including 0).\n className: cn(isDefault && \"opacity-50 border-dashed\"),\n }}\n className=\"flex-1\"\n />\n <NumberInput\n key={inputEpoch}\n data-slot=\"slider-number-input\"\n id={id}\n name={name}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n value={currentValue}\n onValueChange={commit}\n // NumberInput's own default is w-36 (144px); shrinking it below\n // ~w-32 leaves too little room for the digits once its own\n // decrease/increase buttons are subtracted, clipping the text.\n className=\"w-32 shrink-0\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n data-slot=\"slider-number-reset\"\n disabled={disabled || isDefault}\n onClick={() => commit(null)}\n >\n {resetLabel ?? t(\"ui.sliderNumber.reset\")}\n </Button>\n </div>\n );\n});\n","import { useEffect, useState } from \"react\";\nimport { Toaster as SonnerToaster, toast } from \"sonner\";\nimport { resolveThemeIsDark } from \"@elabs-ai/components-tokens\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * The library's default token-backed toast class names. Kept as a standalone\n * constant (rather than inline in the JSX) so `Toaster` can merge a\n * consumer's `toastOptions.classNames` INTO these defaults instead of\n * shallow-replacing them (#362) — each key is combined via `cn()` so a\n * consumer's override extends the default class string rather than\n * discarding it.\n */\nconst DEFAULT_TOAST_CLASS_NAMES = {\n toast:\n \"group toast group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:shadow-ring-lg\",\n description: \"group-[.toast]:text-muted-foreground\",\n actionButton: \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n cancelButton: \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n} as const;\n\n/**\n * Reads the active theme's light/dark-ness off the document. Uses\n * `resolveThemeIsDark` — the theme's own `color-scheme` — rather than a registry\n * lookup, so a consumer-authored dark theme gets dark toasts with no\n * registration (ADR 0029).\n */\nfunction useDocumentThemeMode(): \"light\" | \"dark\" {\n const [mode, setMode] = useState<\"light\" | \"dark\">(\"light\");\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const el = document.documentElement;\n const read = () => setMode(resolveThemeIsDark(el) ? \"dark\" : \"light\");\n read();\n const obs = new MutationObserver(read);\n obs.observe(el, { attributes: true, attributeFilter: [\"data-theme\"] });\n return () => obs.disconnect();\n }, []);\n return mode;\n}\n\nexport type ToasterProps = React.ComponentProps<typeof SonnerToaster>;\n\n/**\n * Toast host. Mount once near the app root. Trigger toasts with the exported\n * `toast()`. Theme follows the active brand theme (via `data-theme`), so it\n * works with or without <ThemeProvider>.\n *\n * ## Customizing toast styling\n *\n * The Toaster wrapper renders with the classes `toaster group` by default.\n * These classes are **merged** with any consumer-supplied `className`, not\n * replaced, so that built-in styling (the `.group-[.toaster]:*` selectors\n * on individual toasts) continues to work.\n *\n * To override a built-in toast class, **mirror the variant prefix** when you\n * pass `toastOptions.classNames`. Built-in toast classes are variant-scoped\n * (e.g. `group-[.toaster]:bg-card`), so a bare utility override will be\n * outspecificity'd by the built-in and appear to do nothing. Instead, use:\n *\n * ```tsx\n * <Toaster\n * toastOptions={{\n * classNames: {\n * toast: \"group-[.toaster]:bg-primary\", // ✓ mirrors the prefix\n * }\n * }}\n * />\n * ```\n *\n * ## Theme handling\n *\n * The Toaster's `theme` prop is automatically set from the active theme's own\n * `color-scheme` declaration, so toasts visually track the app's theme by\n * default — including a theme you authored yourself. However, you may pass\n * `theme=\"light\"` or `theme=\"dark\"` directly to override this derivation if needed.\n */\nexport function Toaster({ className, toastOptions, ...rest }: ToasterProps) {\n const mode = useDocumentThemeMode();\n const userClassNames = toastOptions?.classNames;\n // Merge (not replace): every default key is extended with the consumer's\n // override via cn(); any extra keys the consumer passes (e.g. `success`,\n // `closeButton`) pass through untouched.\n const classNames = {\n ...userClassNames,\n toast: cn(DEFAULT_TOAST_CLASS_NAMES.toast, userClassNames?.toast),\n description: cn(DEFAULT_TOAST_CLASS_NAMES.description, userClassNames?.description),\n actionButton: cn(DEFAULT_TOAST_CLASS_NAMES.actionButton, userClassNames?.actionButton),\n cancelButton: cn(DEFAULT_TOAST_CLASS_NAMES.cancelButton, userClassNames?.cancelButton),\n };\n return (\n <SonnerToaster\n theme={mode}\n className={cn(\"toaster group\", className)}\n toastOptions={{ ...toastOptions, classNames }}\n {...rest}\n />\n );\n}\n\nexport { toast };\n","/**\n * StatusBadge — the canonical execution-status vocabulary (#189, research 10 §B.1).\n *\n * One CLOSED 7-state enum unifies the five status idioms across the agent\n * trace components (`@elabs-ai/components-ai` Tool / ChainOfThought / Confirmation /\n * TestResults / Sandbox), so one agent run reads as one author and an agent\n * picks a status by MEANING — it cannot emit a color or a freeform string.\n *\n * Hybrid visual (research 08 \"green deliberate / status sparingly\"): the calm\n * states — including `complete` — render the quiet `bg-<status>/10` alpha-wash\n * or a neutral fill; ONLY the two attention states (`awaiting-approval`,\n * `failed`) get the solid status fill, so a settled transcript stays calm and\n * the states that need a human grab the eye.\n *\n * Builds ON the existing Badge cva (badge.tsx) — same pill geometry and\n * typography; status colors are semantic tokens only.\n *\n * BOUNDED ESCAPE HATCH (#363): a domain that genuinely has a state the 7\n * canonical values don't express (e.g. a run engine's `stopped_guardrail`) can\n * pass a `CustomStatus` object instead of a `Status` string. Three integrity\n * constraints keep it from eroding the anti-hallucination property above:\n *\n * 1. `tone` is reachable ONLY through the object form (which requires a\n * `label`) — it is NOT an independent prop, so a canonical status can\n * never be recolored (`status=\"failed\" tone=\"success\"` is unrepresentable).\n * 2. The hatch is CALM-ONLY: all five tones render the quiet alpha-wash/\n * neutral treatments. The solid attention fill stays exclusive to the\n * canonical `awaiting-approval` and `failed` — no consumer can mint a\n * loud chip, or the loud/calm signal degrades to noise.\n * 3. No raw color, ever: `tone` maps to existing semantic tokens only\n * (secondary / info / success / warning / destructive).\n *\n * Map a custom status ONCE, near your domain — not per call site. `StatusIcon`\n * stays canonical-only (the enum's own icon+color atom); there is no `emphasis`/\n * `loud` option on the hatch; `fromTimelineStatus()` is unchanged.\n */\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport {\n AlertCircle,\n CheckCircle2,\n Circle,\n Clock,\n Loader2,\n MinusCircle,\n XCircle,\n type LucideIcon,\n type LucideProps,\n} from \"lucide-react\";\nimport { badgeVariants } from \"../badge/badge\";\nimport { cn } from \"../../lib/cn\";\n\n/** The canonical, closed 7-state status enum (research 10 §B.1). */\nexport const STATUSES = [\n \"pending\",\n \"running\",\n \"complete\",\n \"awaiting-approval\",\n \"denied\",\n \"failed\",\n \"skipped\",\n] as const;\n\nexport type Status = (typeof STATUSES)[number];\n\n/** Closed tone set for the out-of-vocabulary escape hatch (CALM treatments only). */\nexport const STATUS_TONES = [\"neutral\", \"info\", \"success\", \"warning\", \"destructive\"] as const;\n\nexport type StatusTone = (typeof STATUS_TONES)[number];\n\n/**\n * An out-of-vocabulary status. Prefer the canonical `Status` enum; reach for\n * this only when the domain genuinely has a state the 7 do not express (e.g. a\n * run engine's `stopped_guardrail`). Map it ONCE, near your domain — not per\n * call site.\n */\nexport interface CustomStatus {\n label: string;\n tone: StatusTone;\n /** Optional Lucide glyph. Omitted → label-only (no default glyph). */\n icon?: LucideIcon;\n}\n\n/** Narrows `Status | CustomStatus` — the object form is always the escape hatch. */\nexport function isCustomStatus(status: Status | CustomStatus): status is CustomStatus {\n return typeof status === \"object\" && status !== null;\n}\n\n/**\n * The tone each CANONICAL status maps to, for the informational `data-tone`\n * attribute only — canonical rendering always goes through the untouched\n * `status` cva branch below, never through `tone`.\n */\nconst STATUS_TONE_MAP: Record<Status, StatusTone> = {\n pending: \"neutral\",\n running: \"info\",\n complete: \"success\",\n \"awaiting-approval\": \"warning\",\n denied: \"neutral\",\n failed: \"destructive\",\n skipped: \"neutral\",\n};\n\n/**\n * The canonical semantic ROLE per status — the single source of truth for\n * status colour (#392). Any other status-keyed colour map in the repo\n * (`Timeline`'s `NODE_STYLE`, or a future one) must be TESTED against this,\n * not hand-authored — a second literal copy is exactly how `NODE_STYLE`\n * drifted (`running` rendered `--primary` while this map said `--info`).\n * Do NOT interpolate `bg-${STATUS_ROLE[status]}` into a class map: Tailwind\n * scans source statically, so a template-literal class emits no CSS. Keep\n * consuming maps as literal class strings, verified against this export by a\n * test.\n */\nexport const STATUS_ROLE = {\n pending: \"secondary\",\n running: \"info\",\n complete: \"success\",\n \"awaiting-approval\": \"warning\",\n denied: \"muted\",\n failed: \"destructive\",\n skipped: \"secondary\",\n} as const satisfies Record<Status, string>;\n\n/** Default human-readable label per status (override via `children`). */\nexport const STATUS_LABELS: Record<Status, string> = {\n pending: \"Pending\",\n running: \"Running\",\n complete: \"Complete\",\n \"awaiting-approval\": \"Awaiting approval\",\n denied: \"Denied\",\n failed: \"Failed\",\n skipped: \"Skipped\",\n};\n\nconst STATUS_ICONS: Record<Status, LucideIcon> = {\n pending: Circle,\n running: Loader2,\n complete: CheckCircle2,\n \"awaiting-approval\": Clock,\n denied: XCircle,\n failed: AlertCircle,\n skipped: MinusCircle,\n};\n\n/**\n * Lucide glyph per out-of-vocabulary TONE — the same five-tone escape hatch\n * `CustomStatus` uses (`STATUS_TONES`). A consumer that encodes a bare TONE\n * with no fuller `Status` semantics (e.g. `@elabs-ai/components-flow`'s `FlowNode.tone`,\n * #387) derives its non-colour cue from here instead of inventing a second\n * icon vocabulary — each entry reuses the SAME icon `STATUS_ICONS` already\n * pairs with that tone's one canonical status (`success`→`complete`'s\n * `CheckCircle2`, `warning`→`awaiting-approval`'s `Clock`,\n * `destructive`→`failed`'s `AlertCircle`). `neutral`/`info` have no entry:\n * nothing consumes them yet, and reaching for a glyph on every neutral/\n * default-toned element would be assistive-tech noise on the common case —\n * extend this map, don't fork a new one, the day something needs them.\n */\nexport const STATUS_TONE_ICONS: Partial<Record<StatusTone, LucideIcon>> = {\n success: CheckCircle2,\n warning: Clock,\n destructive: AlertCircle,\n};\n\n/**\n * On-surface icon color per status for the standalone `StatusIcon` atom.\n * (Inside `StatusBadge` the icon inherits the badge foreground instead, so it\n * stays legible on the solid attention fills.)\n */\nconst STATUS_ICON_CLASSES: Record<Status, string> = {\n pending: \"text-muted-foreground\",\n running: \"text-info-text\",\n complete: \"text-success-text\",\n \"awaiting-approval\": \"text-warning-text\",\n denied: \"text-muted-foreground\",\n failed: \"text-destructive-text\",\n skipped: \"text-muted-foreground\",\n};\n\n/** `animate-spin` is a continuous loop (ease-linear is the allowed loop ease). */\nconst RUNNING_SPIN_CLASSES = \"animate-spin motion-reduce:animate-none\";\n\nexport interface StatusIconProps extends Omit<LucideProps, \"ref\"> {\n /** The canonical execution status (closed enum). */\n status: Status;\n}\n\n/**\n * The icon + status-color atom `StatusBadge` itself composes — for tight rows\n * (test-result rows, timeline/rail nodes) where a full badge is too heavy.\n * Decorative by default (`aria-hidden`); the adjacent row text must carry the\n * status name for AT users.\n */\nexport const StatusIcon = forwardRef<SVGSVGElement, StatusIconProps>(function StatusIcon(\n { status, className, ...props },\n ref,\n) {\n const Icon = STATUS_ICONS[status];\n return (\n <Icon\n ref={ref}\n aria-hidden=\"true\"\n data-status={status}\n className={cn(\n \"size-4 shrink-0\",\n STATUS_ICON_CLASSES[status],\n status === \"running\" && RUNNING_SPIN_CLASSES,\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const statusBadgeVariants = cva(\n // Builds on the Badge pill (geometry + typography from badge.tsx). The\n // `outline` variant carries no fill, so each status sets its own\n // border/bg/text — conflicts resolve via cn() (later utilities win).\n cn(badgeVariants({ variant: \"outline\" }), \"[&_svg]:shrink-0\"),\n {\n variants: {\n status: {\n // calm: neutral fill\n pending: \"border-transparent bg-secondary text-secondary-foreground\",\n // calm: status alpha-wash (escapes the decoration drawn-not-filled rule)\n running: \"border-info/40 bg-info/10 text-info-text\",\n complete: \"border-success/40 bg-success/10 text-success-text\",\n // ATTENTION: solid fill — must grab the eye\n \"awaiting-approval\": \"border-transparent bg-warning text-warning-foreground\",\n // calm: de-emphasized neutrals\n denied: \"border-transparent bg-muted text-muted-foreground\",\n // ATTENTION: solid fill — must grab the eye\n failed: \"border-transparent bg-destructive text-destructive-foreground\",\n skipped: \"border-transparent bg-secondary text-muted-foreground\",\n },\n /**\n * The out-of-vocabulary escape hatch (#363) — CALM treatments only (the\n * same alpha-wash/neutral technique as the calm `status` recipes above).\n * There is deliberately no solid/attention recipe here: the loud fill\n * stays exclusive to the canonical `awaiting-approval`/`failed` states\n * (integrity constraint 2, see the file docblock).\n */\n tone: {\n neutral: \"border-transparent bg-secondary text-secondary-foreground\",\n info: \"border-info/40 bg-info/10 text-info-text\",\n success: \"border-success/40 bg-success/10 text-success-text\",\n warning: \"border-warning/40 bg-warning/10 text-warning-text\",\n destructive: \"border-destructive/40 bg-destructive/10 text-destructive-text\",\n },\n /** `md` for inline use; `sm` for rail nodes / dense rows. */\n size: {\n sm: \"px-2 [&_svg]:size-3\",\n md: \"[&_svg]:size-3.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n);\n\nexport interface StatusBadgeProps\n extends\n HTMLAttributes<HTMLSpanElement>,\n Omit<VariantProps<typeof statusBadgeVariants>, \"status\" | \"tone\"> {\n /** The canonical execution status, or a mapped out-of-vocabulary one (#363). */\n status: Status | CustomStatus;\n /** Render label-only (no status icon). */\n hideIcon?: boolean;\n}\n\nexport const StatusBadge = forwardRef<HTMLSpanElement, StatusBadgeProps>(function StatusBadge(\n { status, size, hideIcon = false, className, children, ...props },\n ref,\n) {\n if (isCustomStatus(status)) {\n const { label, tone, icon: Icon } = status;\n return (\n <span\n ref={ref}\n data-slot=\"status-badge\"\n data-status=\"custom\"\n data-tone={tone}\n className={cn(statusBadgeVariants({ tone, size }), className)}\n {...props}\n >\n {hideIcon || !Icon ? null : <Icon aria-hidden=\"true\" />}\n {children ?? label}\n </span>\n );\n }\n\n const Icon = STATUS_ICONS[status];\n return (\n <span\n ref={ref}\n data-slot=\"status-badge\"\n data-status={status}\n data-tone={STATUS_TONE_MAP[status]}\n className={cn(statusBadgeVariants({ status, size }), className)}\n {...props}\n >\n {hideIcon ? null : (\n <Icon\n aria-hidden=\"true\"\n className={status === \"running\" ? RUNNING_SPIN_CLASSES : undefined}\n />\n )}\n {children ?? STATUS_LABELS[status]}\n </span>\n );\n});\n\n/** The editor/markdown `Timeline` 3-state vocabulary (`@elabs-ai/components-editor`). */\nexport type TimelineStatus = \"done\" | \"active\" | \"pending\";\n\nconst TIMELINE_STATUS_MAP: Record<TimelineStatus, Status> = {\n done: \"complete\",\n active: \"running\",\n pending: \"pending\",\n};\n\n/**\n * Map the Timeline `done|active|pending` vocabulary onto the canonical\n * `Status` (research 10 §B.1 mapping b — lossless; the timeline only\n * expresses 3 of the 7 states). The AI-SDK `ToolUIPart` mapper lives in\n * `@elabs-ai/components-ai` (`statusFromToolState`, tool.tsx) so `@elabs-ai/components-ui` stays free of\n * the `ai` dependency (D6).\n */\nexport function fromTimelineStatus(status: TimelineStatus): Status {\n return TIMELINE_STATUS_MAP[status];\n}\n","import { type ReactNode } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Per-pane surface tone — the ground-offset tiering axis (research 08 §H, #193).\n * `plain` keeps the ambient ground (default; non-breaking). `card` RAISES the pane as\n * a white `bg-card` + `shadow-sm` and is robust across all three themes — a card is\n * lighter than the page ground in BOTH light and dark, so it always reads as raised.\n * `muted` (`bg-surface-muted`) reads as a recessed well ONLY in light themes; in dark\n * themes `--surface-muted` is lighter than `--card`, so a `muted` pane reads as a faint\n * raised tint, not a recess (dark-mode layering only goes UP — there is no surface below\n * the page ground). For a guaranteed cross-theme raise/recess contrast, raise the focus\n * pane with `card` and leave the other `plain`.\n */\nconst paneToneVariants = cva(\"min-h-0 min-w-0 overflow-auto\", {\n variants: {\n tone: {\n plain: \"\",\n muted: \"bg-surface-muted\",\n card: \"bg-card shadow-sm\",\n },\n },\n defaultVariants: { tone: \"plain\" },\n});\n\nexport type SplitPanelTone = NonNullable<VariantProps<typeof paneToneVariants>[\"tone\"]>;\n\nexport interface SplitPanelProps {\n start: ReactNode;\n end: ReactNode;\n /** Layout axis. Defaults to \"horizontal\" (side-by-side). */\n direction?: \"horizontal\" | \"vertical\";\n /**\n * Size of the START pane as a CSS grid track (e.g. \"320px\", \"40%\", \"1fr\").\n * The END pane fills the remainder. Defaults to \"1fr\" (equal split).\n */\n startSize?: string;\n /** Show a thin divider between panes. Defaults to true. */\n divider?: boolean;\n /** Surface tone of the START pane (ground-offset tiering). Defaults to \"plain\". */\n startTone?: SplitPanelTone;\n /** Surface tone of the END pane (ground-offset tiering). Defaults to \"plain\". */\n endTone?: SplitPanelTone;\n className?: string;\n startClassName?: string;\n endClassName?: string;\n}\n\n/**\n * Two-pane layout for master/detail, editor/preview and inspector workflows.\n * Static sizing by design (predictable in tests/SSR); for drag-to-resize wrap\n * with a resize hook or compose `react-resizable-panels` at the app level.\n *\n * For a master/detail surface where the detail should read as a raised card on a\n * recessed list, use `startTone=\"muted\" endTone=\"card\"` (ground-offset tiering).\n */\nexport function SplitPanel({\n start,\n end,\n direction = \"horizontal\",\n startSize = \"1fr\",\n divider = true,\n startTone = \"plain\",\n endTone = \"plain\",\n className,\n startClassName,\n endClassName,\n}: SplitPanelProps) {\n const isHorizontal = direction === \"horizontal\";\n const style = isHorizontal\n ? { gridTemplateColumns: `${startSize} minmax(0, 1fr)` }\n : { gridTemplateRows: `${startSize} minmax(0, 1fr)` };\n return (\n <div\n className={cn(\n \"grid h-full w-full\",\n isHorizontal ? \"grid-flow-col\" : \"grid-flow-row\",\n className,\n )}\n style={style}\n >\n <div className={cn(paneToneVariants({ tone: startTone }), startClassName)}>{start}</div>\n <div\n className={cn(\n paneToneVariants({ tone: endTone }),\n divider && (isHorizontal ? \"border-s\" : \"border-t\"),\n endClassName,\n )}\n >\n {end}\n </div>\n </div>\n );\n}\n","import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Switch = forwardRef<\n ElementRef<typeof SwitchPrimitive.Root>,\n ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>\n>(function Switch({ className, ...props }, ref) {\n return (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(\n \"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors duration-fast ease-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary data-[state=unchecked]:bg-input\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block size-4 rounded-full bg-background shadow-xs ring-0 transition-transform duration-fast ease-standard\",\n \"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\",\n )}\n />\n </SwitchPrimitive.Root>\n );\n});\n","import {\n forwardRef,\n type HTMLAttributes,\n type TdHTMLAttributes,\n type ThHTMLAttributes,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport const Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(function Table(\n { className, ...props },\n ref,\n) {\n return (\n <div className=\"relative w-full overflow-auto\">\n <table ref={ref} className={cn(\"w-full caption-bottom text-body\", className)} {...props} />\n </div>\n );\n});\nexport const TableHeader = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableHeader({ className, ...props }, ref) {\n // border-border-strong: the header-row bottom divider is the ONLY structural\n // cue between the header and the first data row on a shared card/background\n // surface (TableHeader itself carries no fill). Decision test: \"If deleted,\n // could a sighted user still tell header from body?\" No → border-strong.\n return (\n <thead\n ref={ref}\n className={cn(\"[&_tr]:border-b [&_tr]:border-border-strong\", className)}\n {...props}\n />\n );\n});\nexport const TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableBody({ className, ...props }, ref) {\n return <tbody ref={ref} className={cn(\"[&_tr:last-child]:border-0\", className)} {...props} />;\n});\nexport const TableFooter = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(function TableFooter({ className, ...props }, ref) {\n // border-t stays on plain `border`: the footer's bg-surface-muted/50 fill is\n // a redundant cue — deleting the border still leaves a visible region change.\n // Decision test: \"If deleted, could a sighted user still tell footer from\n // body?\" Yes (fill differs) → redundant boundary → border.\n return (\n <tfoot\n ref={ref}\n className={cn(\"border-t bg-surface-muted/50 font-medium\", className)}\n {...props}\n />\n );\n});\nexport const TableRow = forwardRef<HTMLTableRowElement, HTMLAttributes<HTMLTableRowElement>>(\n function TableRow({ className, ...props }, ref) {\n return (\n <tr\n ref={ref}\n className={cn(\n // border-border-strong: each row divider is the ONLY structural cue\n // between adjacent rows on a shared card/background surface (no fill\n // alternation on the plain Table primitive). Decision test: \"If\n // deleted, could a sighted user still tell the two rows apart?\" No\n // (no fill change) → load-bearing → border-strong.\n \"border-b border-border-strong transition-colors duration-fast ease-standard hover:bg-surface-muted/50 data-[state=selected]:bg-accent\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nexport const TableHead = forwardRef<HTMLTableCellElement, ThHTMLAttributes<HTMLTableCellElement>>(\n function TableHead({ className, ...props }, ref) {\n return (\n <th\n ref={ref}\n className={cn(\n \"h-10 px-3 text-start align-middle font-medium text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nexport const TableCell = forwardRef<HTMLTableCellElement, TdHTMLAttributes<HTMLTableCellElement>>(\n function TableCell({ className, ...props }, ref) {\n return <td ref={ref} className={cn(\"px-3 py-2 align-middle\", className)} {...props} />;\n },\n);\nexport const TableCaption = forwardRef<\n HTMLTableCaptionElement,\n HTMLAttributes<HTMLTableCaptionElement>\n>(function TableCaption({ className, ...props }, ref) {\n return (\n <caption\n ref={ref}\n className={cn(\"mt-4 text-body text-muted-foreground\", className)}\n {...props}\n />\n );\n});\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n} from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport { useReducedMotion } from \"@elabs-ai/components-tokens\";\nimport { cn } from \"../../lib/cn\";\nimport { mergeRefs } from \"../../lib/merge-refs\";\n\nexport const Tabs = TabsPrimitive.Root;\n\n/**\n * Bring `trigger` inside the visible bounds of ITS OWN tab strip.\n *\n * Deliberately NOT `Element.scrollIntoView()`: that walks every scrollable\n * ancestor up to the document, so a Tabs sitting below the fold yanks the\n * whole PAGE (measured: `window.scrollY` 0 → 900 on a non-overflowing strip\n * under a 3000px spacer). Scrolling the strip itself is the only movement\n * this feature is entitled to make. It is also why nothing here throws under\n * jsdom, where `scrollIntoView` does not exist: the overflow gate below\n * returns first (`scrollWidth === clientWidth === 0`) and the scroll call is\n * feature-detected.\n */\nfunction scrollTriggerIntoStrip(trigger: HTMLElement, behavior: ScrollBehavior) {\n const strip = trigger.closest<HTMLElement>('[role=\"tablist\"]');\n if (!strip) return;\n // A strip that fits has nothing to scroll — keep it byte-for-byte inert.\n if (strip.scrollWidth <= strip.clientWidth) return;\n\n // Keep the strip's own padding as a gutter, so the tab lands inset (with its\n // focus ring / active shadow visible) rather than flush against the edge.\n const { paddingLeft, paddingRight } = getComputedStyle(strip);\n const triggerRect = trigger.getBoundingClientRect();\n const stripRect = strip.getBoundingClientRect();\n const visibleLeft = stripRect.left + (parseFloat(paddingLeft) || 0);\n const visibleRight = stripRect.right - (parseFloat(paddingRight) || 0);\n const delta =\n triggerRect.left < visibleLeft\n ? triggerRect.left - visibleLeft\n : triggerRect.right > visibleRight\n ? triggerRect.right - visibleRight\n : 0;\n // Nothing to do: the tab is already fully visible — typically because the\n // browser's own focus-scroll got there first on a keyboard/pointer\n // activation. That check is what keeps this from fighting the browser.\n if (delta === 0) return;\n\n // An ABSOLUTE target, not `scrollBy(delta)`: a relative scroll issued while\n // an earlier smooth scroll is still in flight accumulates against a moving\n // offset and lands short. `scrollLeft + delta` is read in the same instant\n // as the rects, so it is exact whatever the animation is doing.\n const left = strip.scrollLeft + delta;\n if (typeof strip.scrollTo === \"function\") strip.scrollTo({ left, behavior });\n else strip.scrollLeft = left;\n}\n\n/**\n * `overflow-x-auto` + `max-w-full` turn an overflowing tab strip into a\n * scroll container instead of silently clipping it — a bare `inline-flex`\n * has no bound on this element's own width, so without `max-w-full` it would\n * just grow past its parent instead of scrolling. `justify-center-safe`\n * (not `justify-center`) is required too: plain `justify-center` strands the\n * first tab off the left edge once the set overflows; `safe` falls back to\n * start-alignment on overflow while staying visually identical when the\n * strip fits (see #344).\n */\nexport const TabsList = forwardRef<\n ElementRef<typeof TabsPrimitive.List>,\n ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(function TabsList({ className, ...props }, ref) {\n return (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-9 max-w-full items-center justify-center-safe overflow-x-auto rounded-lg bg-muted p-1 text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const TabsTrigger = forwardRef<\n ElementRef<typeof TabsPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(function TabsTrigger({ className, ...props }, ref) {\n const innerRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMemo(() => mergeRefs(ref, innerRef), [ref]);\n // Honours the in-app tri-state motion preference on `ThemeProvider` as well\n // as the OS setting, and degrades to OS-only outside a provider.\n const reducedMotion = useReducedMotion();\n\n // Keep the tab that BECOMES active inside the strip's visible bounds.\n //\n // Watching the attribute rather than reacting to a render is load-bearing on\n // both counts:\n // - Radix flips `data-state` on the trigger it renders INSIDE this wrapper,\n // and only its own context consumer re-renders — this component does not.\n // A render-driven effect therefore never observes an activation at all\n // (measured: 8 effect runs for 8 triggers at mount, zero on any later\n // activation), so the scroll only ever ran when the CONSUMER's own state\n // changed.\n // - A MutationObserver fires on a genuine inactive → active TRANSITION and\n // never at mount, which is what stops a freshly-mounted Tabs from\n // scrolling anything (#344 shipped a version that scrolled the page 900px\n // on every mount).\n useEffect(() => {\n const node = innerRef.current;\n if (!node) return;\n\n const scrollIfActive = () => {\n if (node.getAttribute(\"data-state\") !== \"active\") return;\n scrollTriggerIntoStrip(node, reducedMotion ? \"auto\" : \"smooth\");\n };\n\n const observer = new MutationObserver(scrollIfActive);\n observer.observe(node, { attributes: true, attributeFilter: [\"data-state\"] });\n\n // A relayout AFTER the scroll invalidates the target it was computed from:\n // a webfont swapping in on a cold load (measured — a mono-everything theme's\n // wider mono face left the last tab 45px outside the strip), or the strip\n // being resized. Re-measure whenever the tab or the strip changes size;\n // the delta check makes every unaffected pass a no-op.\n const resizeObserver =\n typeof ResizeObserver === \"function\" ? new ResizeObserver(scrollIfActive) : undefined;\n resizeObserver?.observe(node);\n const strip = node.closest<HTMLElement>('[role=\"tablist\"]');\n if (strip) resizeObserver?.observe(strip);\n\n return () => {\n observer.disconnect();\n resizeObserver?.disconnect();\n };\n }, [reducedMotion]);\n\n return (\n <TabsPrimitive.Trigger\n ref={mergedRef}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-colors duration-fast\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"data-[state=active]:bg-surface-elevated data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport const TabsContent = forwardRef<\n ElementRef<typeof TabsPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(function TabsContent({ className, ...props }, ref) {\n return (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:slide-in-from-bottom-1 data-[state=active]:[--tw-ease:var(--ease-entrance)]\",\n className,\n )}\n {...props}\n />\n );\n});\n","// a2ui.exposed: yes\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { InputGroup } from \"../input-group\";\n\nexport interface TagInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\" | \"onChange\"\n> {\n /** Controlled tag list. */\n value?: string[];\n /** Uncontrolled initial tag list. */\n defaultValue?: string[];\n /** Called when the tag list changes. */\n onValueChange?: (value: string[]) => void;\n /** Maximum number of tags allowed. */\n max?: number;\n /**\n * Validate a candidate tag before it is added.\n * Return `true` to accept, `false` to silently reject, or a string\n * to reject and show as an inline error message.\n */\n validate?: (tag: string) => boolean | string;\n /**\n * Characters (or strings) that trigger tag creation in addition to Enter.\n * Defaults to `[\",\"]`.\n */\n delimiter?: string[];\n /** Allow duplicate tags (default false). */\n allowDuplicates?: boolean;\n /** Placeholder text for the entry field. */\n placeholder?: string;\n /** Whether the input is disabled. */\n disabled?: boolean;\n /** id for the underlying text input (useful for external <label>). */\n id?: string;\n /** Name forwarded to the underlying input. */\n name?: string;\n /** aria-label for the underlying text input. */\n \"aria-label\"?: string;\n /** aria-labelledby for the underlying text input. */\n \"aria-labelledby\"?: string;\n}\n\n/**\n * TagInput — chip-style multi-value text entry.\n *\n * Controlled via `value`/`onValueChange`; uncontrolled via `defaultValue`.\n * Enter + configurable delimiters (default `[\",\"]`) add a tag.\n * Backspace on an empty field removes the last tag.\n * Inline validation errors render with `role=\"alert\"`.\n */\nexport const TagInput = forwardRef<HTMLDivElement, TagInputProps>(function TagInput(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n max,\n validate,\n delimiter = [\",\"],\n allowDuplicates = false,\n placeholder,\n disabled,\n id,\n name,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n className,\n ...props\n },\n ref,\n) {\n const isControlled = valueProp !== undefined;\n const [internalTags, setInternalTags] = useState<string[]>(defaultValue ?? []);\n const [inputValue, setInputValue] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const tags = useMemo(\n () => (isControlled ? (valueProp ?? []) : internalTags),\n [isControlled, valueProp, internalTags],\n );\n\n const commit = useCallback(\n (next: string[]) => {\n if (!isControlled) setInternalTags(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n const addTag = useCallback(\n (raw: string) => {\n const tag = raw.trim();\n if (!tag) return;\n\n if (max !== undefined && tags.length >= max) {\n setError(`Maximum of ${max} tags reached.`);\n return;\n }\n\n if (!allowDuplicates && tags.includes(tag)) {\n setError(\"Duplicate tag.\");\n return;\n }\n\n if (validate) {\n const result = validate(tag);\n if (result === false) return;\n if (typeof result === \"string\") {\n setError(result);\n return;\n }\n }\n\n setError(null);\n commit([...tags, tag]);\n setInputValue(\"\");\n },\n [tags, max, allowDuplicates, validate, commit],\n );\n\n const removeTag = useCallback(\n (index: number) => {\n const next = tags.filter((_, i) => i !== index);\n setError(null);\n commit(next);\n },\n [tags, commit],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n // Always prevent form submission when used inside a <form>\n e.preventDefault();\n addTag(inputValue);\n return;\n }\n\n if (e.key === \"Backspace\" && inputValue === \"\" && tags.length > 0) {\n e.preventDefault();\n removeTag(tags.length - 1);\n return;\n }\n\n // Check delimiter characters (e.g. comma)\n for (const delim of delimiter) {\n if (delim.length === 1 && e.key === delim) {\n e.preventDefault();\n addTag(inputValue);\n return;\n }\n }\n },\n [inputValue, tags, delimiter, addTag, removeTag],\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const val = e.target.value;\n // Handle paste or typed multi-char delimiters\n const hasDelimiter = delimiter.some((d) => val.includes(d));\n if (hasDelimiter) {\n const parts = val.split(new RegExp(`[${delimiter.map((d) => escapeRegex(d)).join(\"\")}]`));\n const toAdd = parts.slice(0, -1);\n const remaining = parts[parts.length - 1] ?? \"\";\n for (const part of toAdd) {\n addTag(part);\n }\n setInputValue(remaining);\n } else {\n setInputValue(val);\n setError(null);\n }\n },\n [delimiter, addTag],\n );\n\n const atMax = max !== undefined && tags.length >= max;\n\n return (\n <div ref={ref} className={cn(\"flex flex-col gap-1\", className)} {...props}>\n <InputGroup\n className=\"h-auto min-h-9 flex-wrap gap-1 px-2 py-1 cursor-text\"\n onClick={() => inputRef.current?.focus()}\n >\n {tags.map((tag, i) => (\n <Badge key={`${tag}-${i}`} variant=\"secondary\" className=\"gap-1 pe-1 shrink-0\">\n <span className=\"max-w-[12rem] truncate\">{tag}</span>\n <button\n type=\"button\"\n aria-label={`Remove ${tag}`}\n disabled={disabled}\n onClick={(e) => {\n e.stopPropagation();\n removeTag(i);\n }}\n className={cn(\n \"rounded-full p-0.5 transition-colors\",\n \"hover:bg-secondary-foreground/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n )}\n >\n <X className=\"size-3\" aria-hidden=\"true\" />\n </button>\n </Badge>\n ))}\n <input\n ref={inputRef}\n id={id}\n name={name}\n type=\"text\"\n value={inputValue}\n placeholder={atMax ? undefined : placeholder}\n disabled={disabled || atMax}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-invalid={error ? \"true\" : undefined}\n data-slot=\"input-group-control\"\n className={cn(\n \"min-w-[6rem] flex-1 bg-transparent text-sm outline-none\",\n \"placeholder:text-muted-foreground\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n autoComplete=\"off\"\n spellCheck={false}\n />\n </InputGroup>\n {error && (\n <p role=\"alert\" className=\"text-xs text-destructive\">\n {error}\n </p>\n )}\n </div>\n );\n});\n\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronsUpDown, Plus } from \"lucide-react\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nimport { SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar } from \"../sidebar\";\nimport { cn } from \"../../lib/cn\";\n\nexport type TeamSwitcherTeam = {\n name: string;\n logo: React.ElementType;\n plan: string;\n};\n\nexport interface TeamSwitcherProps {\n teams: TeamSwitcherTeam[];\n /**\n * Tailwind class for the active-team logo container background.\n * @default \"bg-sidebar-accent text-sidebar-accent-foreground\"\n */\n logoClassName?: string;\n className?: string;\n}\n\n/**\n * Sidebar team/workspace switcher. Shared primitive reconciled from sidebar-02\n * and sidebar-05 blocks (issue #99). Copy-owned blocks should import this\n * instead of maintaining local duplicates.\n */\nexport function TeamSwitcher({ teams, logoClassName, className }: TeamSwitcherProps) {\n const { isMobile } = useSidebar();\n const [activeTeam, setActiveTeam] = React.useState(teams[0]);\n if (!activeTeam) return null;\n const Logo = activeTeam.logo;\n\n return (\n <SidebarMenu className={className}>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n <div\n className={cn(\n \"flex aspect-square size-8 items-center justify-center rounded-lg\",\n logoClassName ?? \"bg-sidebar-accent text-sidebar-accent-foreground\",\n )}\n >\n <Logo className=\"size-4\" />\n </div>\n <div className=\"grid flex-1 text-start text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{activeTeam.name}</span>\n <span className=\"truncate text-xs\">{activeTeam.plan}</span>\n </div>\n <ChevronsUpDown className=\"ms-auto\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg\"\n align=\"start\"\n side={isMobile ? \"bottom\" : \"right\"}\n sideOffset={4}\n >\n <DropdownMenuLabel className=\"text-xs text-muted-foreground\">Teams</DropdownMenuLabel>\n {teams.map((team, index) => (\n <DropdownMenuItem\n key={team.name}\n onClick={() => setActiveTeam(team)}\n className=\"gap-2 p-2\"\n >\n <div className=\"flex size-6 items-center justify-center rounded-md border\">\n <team.logo className=\"size-4 shrink-0\" />\n </div>\n {team.name}\n <DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut>\n </DropdownMenuItem>\n ))}\n <DropdownMenuSeparator />\n <DropdownMenuItem className=\"gap-2 p-2\">\n <div className=\"flex size-6 items-center justify-center rounded-md border bg-transparent\">\n <Plus className=\"size-4\" />\n </div>\n <div className=\"font-medium text-muted-foreground\">Add team</div>\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","\"use client\";\n\nimport { forwardRef, useCallback, useEffect, useState, type HTMLAttributes } from \"react\";\nimport { Check, Monitor, Moon, Sun } from \"lucide-react\";\nimport { useTheme, type ThemeDefinition, type ThemeName } from \"@elabs-ai/components-tokens\";\n\nimport { Button } from \"../button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../tooltip\";\nimport { useThemeTransition, type ThemeTransitionEffect } from \"./use-theme-transition\";\n\nconst SYSTEM_STORAGE_KEY = \"brand-ui-theme-system\";\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\ntype ButtonSize = \"sm\" | \"default\" | \"lg\";\nconst ICON_SIZE: Record<ButtonSize, \"icon-sm\" | \"icon\" | \"icon-lg\"> = {\n sm: \"icon-sm\",\n default: \"icon\",\n lg: \"icon-lg\",\n};\n\n/** A theme choice, or \"system\" to follow the OS color scheme. */\nexport type ThemePreference = ThemeName | \"system\";\n\nexport interface ThemeSwitcherProps extends Omit<HTMLAttributes<HTMLButtonElement>, \"onChange\"> {\n /**\n * Themes to offer, as names. ≤2 → toggle; >2 → dropdown.\n *\n * Defaults to the PROVIDER's registry (ADR 0029) — so an app that registers\n * its own themes gets a working switcher with no prop at all. Pass this only\n * to offer a subset, or to fix the order; names the provider doesn't know are\n * dropped.\n */\n themes?: ThemeName[];\n /** Force presentation; \"auto\" (default) picks toggle vs dropdown by theme count. */\n mode?: \"auto\" | \"toggle\" | \"dropdown\";\n /** Offer a \"System\" option that follows the OS color scheme. Default true. */\n showSystem?: boolean;\n /** Whole-screen reveal effect for the animated switch. Default \"polygon\". */\n effect?: ThemeTransitionEffect;\n /** Control size. Default \"default\". */\n size?: ButtonSize;\n /**\n * Controlled preference (#366). When set, the switcher derives its \"current\"\n * state — including \"system\" — from this prop instead of its own internal,\n * `localStorage`-backed state, and reports every user pick via\n * `onPreferenceChange` instead of writing its own storage key. Pass this pair\n * when your app's actual source of truth is a different persisted preference\n * (a settings API, a different storage key, a server-synced setting). Omit\n * both for the default, uncontrolled behavior (unchanged).\n */\n preference?: ThemePreference;\n /** Called with the new preference on every user pick, when `preference` is controlled. */\n onPreferenceChange?: (preference: ThemePreference) => void;\n}\n\nfunction prefersDark(): boolean {\n return typeof window !== \"undefined\" && window.matchMedia(DARK_QUERY).matches;\n}\n\n/** First theme in `list` matching `dark`, or the list's own first entry as a last resort. */\nfunction pickByDarkness(list: readonly ThemeDefinition[], dark: boolean): ThemeName | undefined {\n return (list.find((t) => t.dark === dark) ?? list[0])?.value;\n}\n\n/**\n * Adaptive theme control. With ≤2 themes it renders a light/dark/system toggle\n * (a single icon button that cycles); with >2 it auto-upgrades to a dropdown\n * over the offered themes. Every switch animates the whole screen via\n * `useThemeTransition` (respecting reduced motion). Icons follow each theme's\n * `dark` flag, so it works for any theme — including one you authored.\n *\n * Uncontrolled by default (tracks its own \"system\" choice via `localStorage`).\n * Pass `preference`/`onPreferenceChange` to drive it from an external store\n * instead (#366) — see the `Controlled` story.\n *\n * **It renders the PROVIDER's registry** (ADR 0029). Register your themes on\n * `<ThemeProvider themes={…}>` and this switcher offers them with no prop —\n * which is also why `allowedThemes` (#355) is honoured for free: the provider\n * has already narrowed what it exposes. The `themes` prop is now purely an\n * additional, optional narrowing on top; a name the provider does not offer is\n * dropped rather than rendered, so a disallowed or unregistered theme is never\n * reachable via a menu item, the toggle, \"System\", or the OS\n * `prefers-color-scheme` listener.\n *\n * The pre-ADR-0029 hard-coded `[\"light\",\"dark\"]` default is gone. Behaviour for\n * an app on the default provider is unchanged — that registry IS light + dark.\n */\nexport const ThemeSwitcher = forwardRef<HTMLButtonElement, ThemeSwitcherProps>(\n function ThemeSwitcher(\n {\n themes,\n mode = \"auto\",\n showSystem = true,\n effect = \"polygon\",\n size = \"default\",\n preference,\n onPreferenceChange,\n className,\n ...props\n },\n ref,\n ) {\n const { theme, themeDefinitions, setTheme } = useTheme();\n const switchTheme = useThemeTransition(effect);\n const isControlled = preference !== undefined;\n const [uncontrolledIsSystem, setUncontrolledIsSystem] = useState(false);\n const isSystem = isControlled ? preference === \"system\" : uncontrolledIsSystem;\n\n // The provider's registry is the universe; the prop only narrows it, in the\n // prop's own order. A name the provider doesn't offer is DROPPED (it has no\n // CSS block here and no label to render), and an empty intersection falls\n // back to the whole registry rather than to a hard-coded pair — falling back\n // to literals is what could resurrect a theme the provider disallowed.\n const narrowed = themes\n ? themes\n .map((name) => themeDefinitions.find((d) => d.value === name))\n .filter((d): d is ThemeDefinition => d !== undefined)\n : themeDefinitions;\n const offered: readonly ThemeDefinition[] = narrowed.length > 0 ? narrowed : themeDefinitions;\n const safeThemes: ThemeName[] = offered.map((d) => d.value);\n const labelOf = (name: ThemeName) => offered.find((d) => d.value === name)?.label ?? name;\n const isDark = (name: ThemeName) => offered.find((d) => d.value === name)?.dark ?? false;\n\n // `?? theme` (the active theme), never a \"light\"/\"dark\" literal: with an open\n // registry those names may not exist at all in this app.\n const lightTheme: ThemeName = pickByDarkness(offered, false) ?? theme;\n const darkTheme: ThemeName = pickByDarkness(offered, true) ?? theme;\n\n // The concrete theme to DISPLAY as current: the controlled preference when\n // it names one, otherwise the theme actually applied via the provider.\n const resolvedTheme: ThemeName =\n isControlled && preference !== undefined && preference !== \"system\" ? preference : theme;\n\n // Hydrate the \"system\" choice from localStorage and apply it on mount —\n // uncontrolled mode only. Controlled mode's \"system\" state comes from the\n // `preference` prop and never touches this component's own storage key.\n useEffect(() => {\n if (isControlled) return;\n if (typeof window === \"undefined\") return;\n const active = window.localStorage.getItem(SYSTEM_STORAGE_KEY) === \"1\";\n setUncontrolledIsSystem(active);\n if (active) setTheme(prefersDark() ? darkTheme : lightTheme);\n // Mount-once hydration by design (mirrors the pre-#366 behavior); a\n // component must not flip controlled/uncontrolled mid-lifecycle\n // (.claude/rules/component-api.md), so `isControlled` cannot change here.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Keep the applied theme tracking the OS scheme while \"system\" is active —\n // controlled or not. Depends on every value it reads (unlike the effect\n // above) so it never captures a stale `lightTheme`/`darkTheme` once those\n // become provider-derived (the staleness risk #384 flags).\n useEffect(() => {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n const mql = window.matchMedia(DARK_QUERY);\n const onChange = () => {\n const active = isControlled\n ? preference === \"system\"\n : window.localStorage.getItem(SYSTEM_STORAGE_KEY) === \"1\";\n if (active) setTheme(prefersDark() ? darkTheme : lightTheme);\n };\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }, [isControlled, preference, darkTheme, lightTheme, setTheme]);\n\n const pickTheme = useCallback(\n (next: ThemeName) => {\n if (isControlled) {\n onPreferenceChange?.(next);\n } else {\n setUncontrolledIsSystem(false);\n if (typeof window !== \"undefined\") window.localStorage.setItem(SYSTEM_STORAGE_KEY, \"0\");\n }\n switchTheme(next);\n },\n [switchTheme, isControlled, onPreferenceChange],\n );\n\n const pickSystem = useCallback(() => {\n if (isControlled) {\n onPreferenceChange?.(\"system\");\n } else {\n setUncontrolledIsSystem(true);\n if (typeof window !== \"undefined\") window.localStorage.setItem(SYSTEM_STORAGE_KEY, \"1\");\n }\n switchTheme(prefersDark() ? darkTheme : lightTheme);\n }, [switchTheme, darkTheme, lightTheme, isControlled, onPreferenceChange]);\n\n const TriggerIcon = isSystem ? Monitor : isDark(resolvedTheme) ? Moon : Sun;\n const useDropdown = mode === \"dropdown\" || (mode === \"auto\" && safeThemes.length > 2);\n\n // ---- Dropdown mode (>2 themes) ----\n if (useDropdown) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n ref={ref}\n variant=\"outline\"\n size={ICON_SIZE[size]}\n aria-label=\"Theme\"\n className={className}\n {...props}\n >\n <TriggerIcon />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {showSystem ? (\n <DropdownMenuItem onSelect={() => pickSystem()}>\n <Monitor />\n <span>System</span>\n {isSystem ? <Check className=\"ml-auto\" /> : null}\n </DropdownMenuItem>\n ) : null}\n {offered.map((d) => (\n <DropdownMenuItem key={d.value} onSelect={() => pickTheme(d.value)}>\n {d.dark ? <Moon /> : <Sun />}\n <span>{d.label}</span>\n {!isSystem && resolvedTheme === d.value ? <Check className=\"ml-auto\" /> : null}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n }\n\n // ---- Toggle mode (≤2 themes): cycle light → dark → (system) ----\n // These three are ROLES in the cycle, not theme names — `lightTheme` and\n // `darkTheme` resolve each role to whatever this app actually registered.\n const order: Array<\"light\" | \"dark\" | \"system\"> = showSystem\n ? [\"light\", \"dark\", \"system\"]\n : [\"light\", \"dark\"];\n const current: \"light\" | \"dark\" | \"system\" = isSystem\n ? \"system\"\n : resolvedTheme === darkTheme\n ? \"dark\"\n : \"light\";\n const next = order[(order.indexOf(current) + 1) % order.length];\n const apply = () => {\n if (next === \"system\") pickSystem();\n else pickTheme(next === \"dark\" ? darkTheme : lightTheme);\n };\n\n // Announce the THEME'S OWN label, not the role: an app whose themes are\n // \"Daylight\"/\"Midnight\" would otherwise announce \"Theme: light\" — naming a\n // theme that does not exist in that app.\n // `role` is optional only because `order[i]` is an indexed read under\n // `noUncheckedIndexedAccess`; the modulo above makes it always present.\n const roleLabel = (role: \"light\" | \"dark\" | \"system\" | undefined) =>\n role === \"system\" ? \"System\" : labelOf(role === \"dark\" ? darkTheme : lightTheme);\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n ref={ref}\n variant=\"ghost\"\n size={ICON_SIZE[size]}\n aria-label={`Theme: ${roleLabel(current)}. Activate to switch to ${roleLabel(next)}.`}\n onClick={apply}\n className={className}\n {...props}\n >\n <TriggerIcon />\n </Button>\n </TooltipTrigger>\n <TooltipContent>{roleLabel(current)}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n },\n);\n","\"use client\";\n\nimport { useCallback } from \"react\";\nimport { useReducedMotion, useTheme, type ThemeName } from \"@elabs-ai/components-tokens\";\n\n/** Whole-screen reveal effects for the animated theme switch (View Transitions API). */\nexport type ThemeTransitionEffect = \"polygon\" | \"circle\" | \"circle-blur\" | \"triangle\";\n\ntype ViewTransitionDocument = Document & {\n startViewTransition?: (callback: () => void | Promise<void>) => { finished: Promise<void> };\n};\n\n/**\n * Returns a theme setter that animates the whole-screen switch via the View\n * Transitions API (the chanhdai.com \"theme toggle effect\", adapted to brand-ui).\n *\n * - Direction-aware: sets `data-vt=\"to-dark|to-light\"` on `<html>` from the\n * target theme's `dark` flag, so the clip-path wipes the right way for ANY of\n * the three themes (not just light/dark).\n * - `data-vt-effect` selects the reveal shape (default \"polygon\").\n * - Motion-aware: under `useReducedMotion()` (OS or in-app preference) — or when\n * the browser lacks `startViewTransition` — it falls back to an instant,\n * unanimated `setTheme`.\n *\n * The visual is pure CSS on `::view-transition-*` in `@elabs-ai/components-tokens` themes.css;\n * this hook only orchestrates it.\n */\nexport function useThemeTransition(effect: ThemeTransitionEffect = \"polygon\") {\n const { theme, setTheme, themeDefinitions } = useTheme();\n const reduced = useReducedMotion();\n\n return useCallback(\n (next: ThemeName) => {\n if (next === theme) return;\n if (typeof document === \"undefined\") {\n setTheme(next);\n return;\n }\n const doc = document as ViewTransitionDocument;\n if (reduced || typeof doc.startViewTransition !== \"function\") {\n setTheme(next);\n return;\n }\n const root = document.documentElement;\n // The direction of the reveal comes from the provider's REGISTRY entry\n // for the incoming theme (ADR 0029) — a consumer theme animates correctly\n // without registering here. `resolveThemeIsDark` is deliberately NOT used:\n // it reads the CURRENT computed `color-scheme`, and `next` has not been\n // applied yet, so it would report the OUTGOING theme's direction.\n root.dataset.vt = themeDefinitions.find((d) => d.value === next)?.dark\n ? \"to-dark\"\n : \"to-light\";\n root.dataset.vtEffect = effect;\n const transition = doc.startViewTransition(() => setTheme(next));\n transition.finished.finally(() => {\n delete root.dataset.vt;\n delete root.dataset.vtEffect;\n });\n },\n [theme, setTheme, reduced, effect, themeDefinitions],\n );\n}\n","\"use client\";\n\n/**\n * RevisionTimeline — a presentational git-history timeline.\n *\n * Renders revisions (newest-first) with:\n * - Day grouping by calendar day from `timestamp`\n * - An SVG lane gutter for branch-graph lanes and merge joins\n * - Churn indicators (+additions / -deletions)\n * - A selection rail (controlled + uncontrolled)\n *\n * The APP computes the graph layout (lane indices, edges). This component\n * only renders what it receives. Heavy graph-math stays out.\n *\n * GATE NOTES:\n * - No identifier starting with `Timeline` (timeline-fork class 1).\n * - Lanes/connectors drawn with SVG <line> / <path>, NOT `absolute w-px`\n * hairlines (timeline-fork class 2 avoidance).\n */\n\nimport {\n createContext,\n forwardRef,\n use,\n useCallback,\n useMemo,\n useState,\n type HTMLAttributes,\n} from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { ChevronRight, GitBranch, GitCommitHorizontal, GitMerge, Plus, Minus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\n// ─── Public data types ────────────────────────────────────────────────────────\n\n/**\n * A single revision entry. The APP assigns `lane` (0-based column index),\n * computes `additions`/`deletions`, and orders revisions newest-first.\n */\nexport interface Revision {\n /** Unique identifier — used for selection + edge references. */\n id: string;\n /** Commit message (may be long; the component truncates). */\n message: string;\n /** Display name of the commit author. */\n author?: string;\n /** Avatar image URL for the author. */\n authorAvatar?: string;\n /** When the commit was authored. Accepts Date, ISO string, or epoch ms. */\n timestamp: Date | string | number;\n /** Short commit hash (e.g. \"a1b2c3d\"). */\n shortSha?: string;\n /** Lines added (churn indicator). */\n additions?: number;\n /** Lines deleted (churn indicator). */\n deletions?: number;\n /**\n * Column index assigned by the app (0-based). Lane 0 = main branch (leftmost).\n * Used to position the node dot and draw the lane spine in the SVG gutter.\n */\n lane: number;\n /** Branch or tag labels rendered as chips on this revision. */\n refs?: string[];\n /**\n * Branch identity for the collapse/expand mode. Opt-in: only takes effect when\n * a matching `branches` entry is supplied to `RevisionTimeline`. When omitted\n * (or unmatched), the revision renders as a normal, never-collapsible row.\n */\n branchId?: string;\n}\n\n/**\n * A parent link between two revisions, for the lane graph.\n * Used to draw merge joins (curves / angled lines) in the SVG gutter.\n */\nexport interface RevisionEdge {\n /** Id of the child revision (newer, higher in the list). */\n from: string;\n /** Id of the parent revision (older, lower in the list). */\n to: string;\n}\n\n/**\n * A collapsible branch in the history. The APP supplies these (it already\n * computes lanes + edges); listing a branch here makes it collapsible. Nesting\n * via `parentBranchId` lets a parent branch's collapse also fold its descendants\n * (multi-level). Omitting a branch from this list keeps its commits permanently\n * visible (e.g. the trunk).\n */\nexport interface RevisionBranch {\n /** Stable id, referenced by `Revision.branchId` and other branches' `parentBranchId`. */\n id: string;\n /** Human label for the collapsed summary row. Defaults to `id`. */\n name?: string;\n /** Parent branch id — enables multi-level nesting in the collapse hierarchy. */\n parentBranchId?: string;\n}\n\n// ─── Variants ────────────────────────────────────────────────────────────────\n\n/** Visual density variants for the timeline. */\nexport const revisionTimelineVariants = cva(\"flex flex-col\", {\n variants: {\n density: {\n comfortable: \"gap-0\",\n compact: \"gap-0\",\n },\n },\n defaultVariants: { density: \"comfortable\" },\n});\n\nexport type RevisionTimelineDensity = NonNullable<\n VariantProps<typeof revisionTimelineVariants>[\"density\"]\n>;\n\n// ─── Lane geometry helpers ────────────────────────────────────────────────────\n\n/**\n * The number of chart palette colors. Lane index is wrapped modulo this count,\n * so `lane % LANE_PALETTE_SIZE` never exceeds the token range 1-5.\n */\nconst LANE_PALETTE_SIZE = 5;\n\n/** Lane index → CSS token string (`var(--chart-1)` … `var(--chart-5)`). */\nexport function laneColor(lane: number): string {\n return `var(--chart-${(lane % LANE_PALETTE_SIZE) + 1})`;\n}\n\n/** Width of one lane column in the SVG gutter (px). */\nconst LANE_W = 16;\n/** Row height in the SVG gutter — must match the rendered row height. */\nconst ROW_H_COMFORTABLE = 48;\nconst ROW_H_COMPACT = 36;\n/**\n * Fixed height of a day-group header. MUST match the rendered `DayHeader`'s box\n * so the SVG gutter's node dots stay aligned with their list rows once a header\n * inserts vertical space between groups (otherwise the graph desyncs from the\n * rows — the gutter and the list share one coordinate space).\n */\nconst DAY_HEADER_H = 32;\n/** Radius of the node dot. */\nconst NODE_R = 4;\n/**\n * Vertical length (px) the connector runs straight along a lane before turning\n * into the adjacent lane. A FIXED corner length (not a proportion of the row\n * span) makes a cross-lane join read as \"leave the lane → short elbow → arrive\",\n * so a branch clearly leads down into its parent lane instead of meandering\n * across the whole gap with a lazy midpoint S-curve.\n */\nconst EDGE_TURN = 16;\n/**\n * One opacity for BOTH lane spines and cross-lane connectors so a fork/merge join\n * reads as one continuous line — a mismatch here leaves a visible seam exactly\n * where a branch should be leading into the previous level.\n */\nconst LANE_STROKE_OPACITY = 0.75;\n\n/** X centre of a lane column in the SVG. */\nfunction laneX(lane: number): number {\n return lane * LANE_W + LANE_W / 2;\n}\n\n// ─── Branch collapse model ────────────────────────────────────────────────────\n\n/**\n * The minimal node shape the SVG gutter needs (lane position + id). Both real\n * revisions and synthetic collapsed-branch summary nodes satisfy this.\n */\ninterface GutterNode {\n id: string;\n lane: number;\n}\n\n/**\n * A list/gutter render item. Either a real revision row or a single summary row\n * standing in for a collapsed branch (placed at the branch's tip position).\n */\ntype RenderItem =\n | {\n kind: \"revision\";\n revision: Revision;\n /** True iff this row is the tip of an expanded, collapsible branch. */\n canCollapse: boolean;\n branchId?: string;\n }\n | {\n kind: \"summary\";\n branch: RevisionBranch;\n /** Hidden revisions in this branch's subtree (no double counting). */\n count: number;\n /** Lane the summary node sits on (the tip's lane). */\n lane: number;\n /** Synthetic, collision-free id (`summary:<branchId>`). */\n id: string;\n /** Tip timestamp — used for day grouping so the summary lands in the tip's day. */\n tipTimestamp: Date | string | number;\n };\n\ninterface BranchMaps {\n branchById: Map<string, RevisionBranch>;\n parentOf: Map<string, string | undefined>;\n}\n\n/** Index `branches` for O(1) lookup + parent-chain walks. Pure. */\nfunction buildBranchMaps(branches: RevisionBranch[]): BranchMaps {\n const branchById = new Map<string, RevisionBranch>();\n const parentOf = new Map<string, string | undefined>();\n for (const b of branches) {\n branchById.set(b.id, b);\n parentOf.set(b.id, b.parentBranchId);\n }\n return { branchById, parentOf };\n}\n\n/**\n * Returns a memoised lookup: branch id → the TOP-MOST collapsed ancestor on its\n * parent chain (itself included), or `undefined` if nothing in the chain is\n * collapsed. Walking leaf→root and keeping the last collapsed hit yields the\n * highest collapsed ancestor, which is the branch whose summary absorbs the row.\n * Cycle-guarded (defensive against malformed app data).\n */\nfunction makeTopCollapsed(parentOf: Map<string, string | undefined>, collapsedSet: Set<string>) {\n const cache = new Map<string, string | undefined>();\n return function topCollapsed(branchId: string): string | undefined {\n const cached = cache.get(branchId);\n if (cached !== undefined || cache.has(branchId)) return cached;\n let topMost: string | undefined;\n const visited = new Set<string>();\n let cur: string | undefined = branchId;\n while (cur !== undefined && !visited.has(cur)) {\n visited.add(cur);\n if (collapsedSet.has(cur)) topMost = cur;\n cur = parentOf.get(cur);\n }\n cache.set(branchId, topMost);\n return topMost;\n };\n}\n\ninterface ComputeResult {\n items: RenderItem[];\n /** Hidden revision id → the summary item id that absorbed it (for edge remap). */\n summaryOf: Map<string, string>;\n}\n\n/**\n * Single newest-first pass over `revisions` → the visible render-item list.\n *\n * A revision is hidden when its branch (or any ancestor branch) is collapsed; the\n * FIRST hidden revision of a collapsed subtree (the tip, since order is\n * newest-first) is replaced by ONE summary row at its slot, and the rest are\n * dropped. Each hidden revision is counted against its top-most collapsed\n * ancestor only, so nested collapse never double-counts. Light: Map/Set lookups\n * and a shallow parent-chain walk — no graph math.\n */\nfunction computeRenderItems(\n revisions: Revision[],\n collapsedSet: Set<string>,\n maps: BranchMaps,\n): ComputeResult {\n const items: RenderItem[] = [];\n const summaryOf = new Map<string, string>();\n const summaryCount = new Map<string, number>();\n const summaryEmitted = new Set<string>();\n const seenVisibleBranch = new Set<string>();\n const topCollapsed = makeTopCollapsed(maps.parentOf, collapsedSet);\n\n for (const rev of revisions) {\n const bid = rev.branchId;\n // Unknown branch ids (not in `branches`) are never hidden / never collapsible.\n if (bid !== undefined && maps.branchById.has(bid)) {\n const top = topCollapsed(bid);\n if (top !== undefined) {\n const summaryId = `summary:${top}`;\n summaryOf.set(rev.id, summaryId);\n summaryCount.set(top, (summaryCount.get(top) ?? 0) + 1);\n if (!summaryEmitted.has(top)) {\n summaryEmitted.add(top);\n const branch = maps.branchById.get(top) ?? { id: top };\n items.push({\n kind: \"summary\",\n branch,\n count: 0,\n lane: rev.lane,\n id: summaryId,\n tipTimestamp: rev.timestamp,\n });\n }\n continue;\n }\n const canCollapse = !seenVisibleBranch.has(bid);\n seenVisibleBranch.add(bid);\n items.push({ kind: \"revision\", revision: rev, canCollapse, branchId: bid });\n continue;\n }\n\n items.push({ kind: \"revision\", revision: rev, canCollapse: false, branchId: bid });\n }\n\n for (const it of items) {\n if (it.kind === \"summary\") it.count = summaryCount.get(it.branch.id) ?? 0;\n }\n\n return { items, summaryOf };\n}\n\n// ─── Context ─────────────────────────────────────────────────────────────────\n\ninterface RevisionTimelineCtx {\n selectedId: string | undefined;\n onSelect: (id: string) => void;\n}\n\nconst RevisionTimelineContext = createContext<RevisionTimelineCtx | null>(null);\n\nfunction useRevisionTimelineCtx(): RevisionTimelineCtx {\n const ctx = use(RevisionTimelineContext);\n if (!ctx) throw new Error(\"RevisionTimeline sub-parts must be inside <RevisionTimeline>\");\n return ctx;\n}\n\n// ─── SVG lane gutter ─────────────────────────────────────────────────────────\n\ninterface LaneGutterProps {\n revisions: GutterNode[];\n edges: RevisionEdge[];\n /**\n * Map of revision id → vertical centre (px) in the gutter's coordinate space.\n * Computed by the parent so the gutter shares ONE coordinate space with the\n * list — it already accounts for day-header heights, so dots line up with\n * their rows even when `groupBy=\"day\"` inserts headers between groups.\n */\n rowCenterY: Map<string, number>;\n /** Total gutter height (px) — equals the rendered list height. */\n height: number;\n className?: string;\n}\n\n/**\n * Renders the branch-graph SVG gutter. Draws:\n * - A vertical spine per lane (coloured via chart tokens)\n * - A filled circle node at each revision's lane position\n * - Merge-join cubic-bezier curves between a child revision and its parent\n * revision when they are in different lanes (cross-lane edges)\n *\n * All Y positions come from `rowCenterY` (header-aware), NOT `index * ROW_H`,\n * so the graph stays aligned with day-grouped rows. No `absolute w-px`\n * connectors — all drawing is SVG (timeline-fork safe).\n */\nfunction LaneGutter({ revisions, edges, rowCenterY, height, className }: LaneGutterProps) {\n const maxLane = revisions.reduce((m, r) => Math.max(m, r.lane), 0);\n const svgW = (maxLane + 1) * LANE_W;\n\n const idToRev = useMemo(() => {\n const m = new Map<string, GutterNode>();\n for (const r of revisions) m.set(r.id, r);\n return m;\n }, [revisions]);\n\n // Each lane's first + last revision (in list order) bound its spine.\n const laneSpan = useMemo(() => {\n const first = new Map<number, string>();\n const last = new Map<number, string>();\n for (const r of revisions) {\n if (!first.has(r.lane)) first.set(r.lane, r.id);\n last.set(r.lane, r.id);\n }\n return { first, last };\n }, [revisions]);\n\n // Pre-count incoming edges per revision → merge detection.\n const incomingCount = useMemo(() => {\n const m = new Map<string, number>();\n for (const e of edges) m.set(e.to, (m.get(e.to) ?? 0) + 1);\n return m;\n }, [edges]);\n\n if (height === 0 || revisions.length === 0) return null;\n\n return (\n <svg\n aria-hidden=\"true\"\n width={svgW}\n height={height}\n className={cn(\"shrink-0 self-stretch\", className)}\n style={{ minWidth: svgW }}\n >\n {/* Lane spines — one vertical line per lane from first to last revision */}\n {Array.from(laneSpan.last.entries()).map(([lane, lastId]) => {\n const firstId = laneSpan.first.get(lane);\n const y1 = firstId ? rowCenterY.get(firstId) : undefined;\n const y2 = rowCenterY.get(lastId);\n if (y1 === undefined || y2 === undefined) return null;\n const x = laneX(lane);\n return (\n <line\n key={`spine-${lane}`}\n x1={x}\n y1={y1}\n x2={x}\n y2={y2}\n stroke={laneColor(lane)}\n strokeWidth={2}\n strokeLinecap=\"round\"\n opacity={LANE_STROKE_OPACITY}\n />\n );\n })}\n\n {/* Edge connectors — cross-lane merge / fork joins. The line stays in its\n source lane for a fixed length (EDGE_TURN), turns through a short elbow,\n then runs straight into the target lane — so it leads cleanly into the\n previous level instead of drifting across the whole gap. */}\n {edges.map((edge, ei) => {\n const fromRev = idToRev.get(edge.from);\n const toRev = idToRev.get(edge.to);\n if (!fromRev || !toRev) return null;\n if (fromRev.lane === toRev.lane) return null; // covered by the spine\n const y1 = rowCenterY.get(fromRev.id);\n const y2 = rowCenterY.get(toRev.id);\n if (y1 === undefined || y2 === undefined) return null;\n const x1 = laneX(fromRev.lane);\n const x2 = laneX(toRev.lane);\n const dir = y2 >= y1 ? 1 : -1;\n // Tangent the curve to BOTH lanes (vertical at each end) with a fixed\n // corner length, capped so short joins don't overshoot.\n const k = Math.min(Math.abs(y2 - y1) / 2, EDGE_TURN);\n return (\n <path\n key={`edge-${ei}`}\n d={`M ${x1} ${y1} C ${x1} ${y1 + dir * k}, ${x2} ${y2 - dir * k}, ${x2} ${y2}`}\n stroke={laneColor(fromRev.lane)}\n strokeWidth={2}\n fill=\"none\"\n strokeLinecap=\"round\"\n opacity={LANE_STROKE_OPACITY}\n />\n );\n })}\n\n {/* Node dots — one circle per revision */}\n {revisions.map((rev) => {\n const x = laneX(rev.lane);\n const y = rowCenterY.get(rev.id);\n if (y === undefined) return null;\n const isMerge = (incomingCount.get(rev.id) ?? 0) >= 2;\n return (\n <g key={`node-${rev.id}`}>\n {isMerge ? (\n <>\n <circle\n cx={x}\n cy={y}\n r={NODE_R + 2}\n fill=\"var(--background)\"\n stroke={laneColor(rev.lane)}\n strokeWidth={2}\n />\n <circle cx={x} cy={y} r={NODE_R - 1} fill={laneColor(rev.lane)} />\n </>\n ) : (\n <circle cx={x} cy={y} r={NODE_R} fill={laneColor(rev.lane)} />\n )}\n </g>\n );\n })}\n </svg>\n );\n}\n\n// ─── Day group header ─────────────────────────────────────────────────────────\n\ninterface DayHeaderProps {\n label: string;\n}\n\nfunction DayHeader({ label }: DayHeaderProps) {\n // Fixed height (DAY_HEADER_H) so the SVG gutter's coordinate space stays in\n // lockstep with the rendered rows — see LaneGutter / rowCenterY.\n return (\n <div\n role=\"separator\"\n aria-label={label}\n style={{ height: DAY_HEADER_H }}\n className=\"box-border flex items-center gap-3 px-3\"\n >\n <span className=\"text-meta font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </span>\n <div className=\"h-px flex-1 bg-border\" aria-hidden=\"true\" />\n </div>\n );\n}\n\n// ─── Churn indicator ──────────────────────────────────────────────────────────\n\ninterface ChurnProps {\n additions?: number;\n deletions?: number;\n}\n\nfunction Churn({ additions, deletions }: ChurnProps) {\n const hasAdditions = additions !== undefined && additions > 0;\n const hasDeletions = deletions !== undefined && deletions > 0;\n if (!hasAdditions && !hasDeletions) return null;\n\n return (\n <span\n className=\"flex shrink-0 items-center gap-1 tabular-nums text-meta text-muted-foreground\"\n aria-label={`${additions ?? 0} additions, ${deletions ?? 0} deletions`}\n >\n {hasAdditions && (\n <span className=\"flex items-center gap-0.5 text-success-text\" aria-hidden=\"true\">\n <Plus aria-hidden=\"true\" className=\"size-2.5\" />\n {additions}\n </span>\n )}\n {hasDeletions && (\n <span className=\"flex items-center gap-0.5 text-destructive\" aria-hidden=\"true\">\n <Minus aria-hidden=\"true\" className=\"size-2.5\" />\n {deletions}\n </span>\n )}\n </span>\n );\n}\n\n// ─── Ref chip ─────────────────────────────────────────────────────────────────\n\nfunction RefChip({ label }: { label: string }) {\n return (\n <span className=\"inline-flex shrink-0 items-center rounded border border-border bg-muted px-1.5 py-0.5 text-meta text-muted-foreground\">\n {label}\n </span>\n );\n}\n\n// ─── Branch collapse UI ───────────────────────────────────────────────────────\n\n/** A right-chevron that rotates 90° to point down when its branch is expanded. */\nfunction BranchChevron({ expanded }: { expanded: boolean }) {\n return (\n <ChevronRight\n aria-hidden=\"true\"\n className={cn(\n \"size-3.5 shrink-0 text-muted-foreground transition-transform duration-fast ease-standard motion-reduce:transition-none\",\n expanded && \"rotate-90\",\n )}\n />\n );\n}\n\n/**\n * The collapse toggle shown on an expanded branch's tip row. A standalone button\n * (a sibling of the row's select button — never nested inside it) so there are no\n * nested interactive elements.\n */\nfunction BranchToggle({ branchName, onToggle }: { branchName: string; onToggle: () => void }) {\n return (\n <button\n type=\"button\"\n aria-expanded={true}\n aria-label={`Collapse branch ${branchName}`}\n onClick={onToggle}\n className={cn(\n \"flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n )}\n >\n <BranchChevron expanded />\n </button>\n );\n}\n\ninterface CollapsedBranchRowProps {\n branchId: string;\n branchName: string;\n /** Pre-formatted trailing label, e.g. \"3 commits\" (default) or \"3 steps\". */\n summaryLabel: string;\n density: RevisionTimelineDensity;\n /** Left indent (px), proportional to the collapsed branch's lane depth. */\n indent: number;\n onExpand: () => void;\n}\n\n/**\n * The single summary row that stands in for a collapsed branch, placed at the\n * branch's tip position. The whole row IS the expand button (no nested\n * interactives), so it offers exactly one keyboard/AT target.\n */\nfunction CollapsedBranchRow({\n branchId,\n branchName,\n summaryLabel,\n density,\n indent,\n onExpand,\n}: CollapsedBranchRowProps) {\n const ROW_H = density === \"compact\" ? ROW_H_COMPACT : ROW_H_COMFORTABLE;\n\n return (\n <li\n role=\"listitem\"\n data-summary-branch-id={branchId}\n style={{ height: ROW_H, paddingInlineStart: indent }}\n className=\"relative flex items-center\"\n >\n <button\n type=\"button\"\n aria-expanded={false}\n aria-label={`Collapsed branch ${branchName}, ${summaryLabel}, expand`}\n onClick={onExpand}\n className={cn(\n \"flex h-full w-full min-w-0 items-center gap-2 px-2 text-start\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n \"rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"hover:bg-accent hover:text-accent-foreground\",\n )}\n >\n <BranchChevron expanded={false} />\n <GitBranch className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1 truncate text-body text-foreground\" title={branchName}>\n {branchName}\n </span>\n <span className=\"shrink-0 tabular-nums text-meta text-muted-foreground\">\n {summaryLabel}\n </span>\n </button>\n </li>\n );\n}\n\n// ─── Revision row ────────────────────────────────────────────────────────────\n\ninterface RevisionRowProps {\n revision: Revision;\n isMerge: boolean;\n density: RevisionTimelineDensity;\n /**\n * Left indent (px) for this row's content, proportional to its lane depth, so\n * the row text staircases alongside the branch graph instead of all rows\n * starting at the same point.\n */\n indent: number;\n /**\n * When set, this row is the tip of an expanded collapsible branch: render a\n * collapse toggle as a sibling of the select button (never nested).\n */\n collapseToggle?: { branchName: string; onToggle: () => void };\n}\n\nfunction RevisionRow({ revision, isMerge, density, indent, collapseToggle }: RevisionRowProps) {\n const { selectedId, onSelect } = useRevisionTimelineCtx();\n const isSelected = selectedId === revision.id;\n const ROW_H = density === \"compact\" ? ROW_H_COMPACT : ROW_H_COMFORTABLE;\n\n const formattedTimestamp = useMemo(() => {\n const d =\n revision.timestamp instanceof Date ? revision.timestamp : new Date(revision.timestamp);\n return new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(d);\n }, [revision.timestamp]);\n\n const fullTimestamp = useMemo(() => {\n const d =\n revision.timestamp instanceof Date ? revision.timestamp : new Date(revision.timestamp);\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: \"full\",\n timeStyle: \"medium\",\n }).format(d);\n }, [revision.timestamp]);\n\n return (\n <li\n role=\"listitem\"\n data-revision-id={revision.id}\n data-selected={isSelected || undefined}\n style={{ height: ROW_H, paddingInlineStart: indent }}\n className=\"relative flex items-center\"\n >\n {collapseToggle && (\n <BranchToggle branchName={collapseToggle.branchName} onToggle={collapseToggle.onToggle} />\n )}\n <button\n type=\"button\"\n aria-label={`Select revision: ${revision.message}`}\n aria-pressed={isSelected}\n onClick={() => onSelect(revision.id)}\n className={cn(\n collapseToggle\n ? \"flex h-full min-w-0 flex-1 items-center gap-2 px-2 text-start\"\n : \"flex h-full w-full min-w-0 items-center gap-2 px-2 text-start\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n \"rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"hover:bg-accent hover:text-accent-foreground\",\n isSelected && \"border-s-2 border-s-primary bg-accent text-accent-foreground\",\n )}\n >\n {/* Merge icon (non-color visual cue for merge commits) */}\n <span className=\"shrink-0 text-muted-foreground\" aria-hidden=\"true\">\n {isMerge ? (\n <GitMerge className=\"size-3.5\" aria-hidden=\"true\" />\n ) : (\n <GitCommitHorizontal className=\"size-3.5\" aria-hidden=\"true\" />\n )}\n </span>\n\n {/* Commit message — truncates with min-w-0 */}\n <span\n className=\"min-w-0 flex-1 truncate text-body text-foreground\"\n title={revision.message}\n >\n {revision.message}\n </span>\n\n {/* Ref chips (branch / tag labels) */}\n {revision.refs && revision.refs.length > 0 && (\n <span className=\"hidden shrink-0 items-center gap-1 sm:flex\">\n {revision.refs.map((ref) => (\n <RefChip key={ref} label={ref} />\n ))}\n </span>\n )}\n\n {/* Churn indicators */}\n <Churn additions={revision.additions} deletions={revision.deletions} />\n\n {/* Author */}\n {revision.author && (\n <span\n className=\"hidden shrink-0 text-caption text-muted-foreground md:block\"\n title={revision.author}\n >\n {revision.author}\n </span>\n )}\n\n {/* Short SHA */}\n {revision.shortSha && (\n <span\n className=\"hidden shrink-0 font-mono text-meta text-muted-foreground sm:block\"\n title={`Full SHA: ${revision.shortSha}`}\n >\n {revision.shortSha}\n </span>\n )}\n\n {/* Timestamp */}\n <time\n dateTime={\n revision.timestamp instanceof Date\n ? revision.timestamp.toISOString()\n : new Date(revision.timestamp).toISOString()\n }\n className=\"shrink-0 text-meta text-muted-foreground\"\n title={fullTimestamp}\n >\n {formattedTimestamp}\n </time>\n </button>\n </li>\n );\n}\n\n// ─── Collapse state hook ──────────────────────────────────────────────────────\n\n/**\n * Controlled/uncontrolled collapsed-branch state — mirrors the selection pattern.\n * Internally a `Set`; the controlled API stays array-shaped. `toggleBranch`\n * fires `onBranchToggle(id, next)` and only mutates internal state when\n * uncontrolled.\n */\nfunction useBranchCollapse(opts: {\n collapsedBranchIds?: string[];\n defaultCollapsedBranchIds?: string[];\n onBranchToggle?: (branchId: string, collapsed: boolean) => void;\n}) {\n const { collapsedBranchIds, defaultCollapsedBranchIds, onBranchToggle } = opts;\n const isControlled = collapsedBranchIds !== undefined;\n const [internal, setInternal] = useState<Set<string>>(\n () => new Set(defaultCollapsedBranchIds ?? []),\n );\n const collapsedSet = useMemo(\n () => (isControlled ? new Set(collapsedBranchIds) : internal),\n [isControlled, collapsedBranchIds, internal],\n );\n const toggleBranch = useCallback(\n (branchId: string) => {\n const next = !collapsedSet.has(branchId);\n onBranchToggle?.(branchId, next);\n if (!isControlled) {\n setInternal((prev) => {\n const s = new Set(prev);\n if (next) s.add(branchId);\n else s.delete(branchId);\n return s;\n });\n }\n },\n [collapsedSet, isControlled, onBranchToggle],\n );\n return { collapsedSet, toggleBranch };\n}\n\n// ─── Main component ───────────────────────────────────────────────────────────\n\nexport interface RevisionTimelineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\">,\n VariantProps<typeof revisionTimelineVariants> {\n /** Ordered revisions, newest → oldest. */\n revisions: Revision[];\n /**\n * Parent-link edges for drawing the branch graph.\n * Each edge connects a child revision (`from`) to its parent (`to`).\n */\n edges?: RevisionEdge[];\n /**\n * How to group revisions. `\"day\"` inserts day headers; `\"none\"` renders a\n * flat list. @default \"day\"\n */\n groupBy?: \"day\" | \"none\";\n /** Format the day-group header label. Defaults to `Intl.DateTimeFormat` long date. */\n formatDay?: (d: Date) => string;\n /**\n * Controlled selection: the id of the currently-selected revision.\n * Omit to use uncontrolled selection (`defaultSelectedId`).\n */\n selectedId?: string;\n /** Initial selected revision id for uncontrolled usage. */\n defaultSelectedId?: string;\n /** Called when the user selects a revision row. */\n onSelect?: (id: string) => void;\n /**\n * Collapsible branch registry. **Supplying this opts in to the collapse/expand\n * mode.** Each listed branch becomes collapsible; a branch's commits fold into a\n * single summary row at its tip. `parentBranchId` nests branches so collapsing a\n * parent also folds its descendants (multi-level). A revision whose `branchId`\n * is not listed here (e.g. the trunk) stays permanently visible. Omit entirely\n * for the classic, non-collapsible timeline.\n */\n branches?: RevisionBranch[];\n /** Controlled set of collapsed branch ids. */\n collapsedBranchIds?: string[];\n /** Uncontrolled initial set of collapsed branch ids. */\n defaultCollapsedBranchIds?: string[];\n /** Called when a branch is collapsed or expanded. `collapsed` is the NEXT state. */\n onBranchToggle?: (branchId: string, collapsed: boolean) => void;\n /**\n * Trailing summary text on a collapsed branch row. Defaults to\n * `\"<n> commit(s)\"`; override to re-vocabulary the timeline (e.g. `\"<n> steps\"`\n * when modelling a process flow rather than git history).\n */\n formatBranchSummary?: (count: number, branch: RevisionBranch) => string;\n}\n\n/**\n * RevisionTimeline — presentational git-history timeline.\n *\n * Renders revisions in a scrollable list with:\n * - Day grouping (collapsible via `groupBy`)\n * - SVG branch-graph lanes + merge joins in the left gutter\n * - Churn indicators, ref chips, author, SHA, timestamp\n * - Accessible selection (real `<button>` elements in an `<ol>`)\n *\n * Self-contained: no required Provider ancestor. Use `selectedId` +\n * `onSelect` for controlled selection, or `defaultSelectedId` for uncontrolled.\n *\n * Pass `branches` to enable the collapse/expand mode: a branch's commits fold\n * into a single summary row at its tip (multi-level via `parentBranchId`).\n */\nexport const RevisionTimeline = forwardRef<HTMLDivElement, RevisionTimelineProps>(\n function RevisionTimeline(\n {\n revisions,\n edges = [],\n groupBy = \"day\",\n formatDay,\n selectedId: controlledSelectedId,\n defaultSelectedId,\n onSelect,\n branches,\n collapsedBranchIds,\n defaultCollapsedBranchIds,\n onBranchToggle,\n formatBranchSummary,\n density,\n className,\n ...props\n },\n ref,\n ) {\n const resolvedDensity: RevisionTimelineDensity = density ?? \"comfortable\";\n\n // Collapse/expand mode is opt-in: active only when `branches` are supplied.\n const collapseEnabled = !!branches && branches.length > 0;\n const branchMaps = useMemo(() => buildBranchMaps(branches ?? []), [branches]);\n const { collapsedSet, toggleBranch } = useBranchCollapse({\n collapsedBranchIds,\n defaultCollapsedBranchIds,\n onBranchToggle,\n });\n\n // Controlled / uncontrolled selection\n const isControlled = controlledSelectedId !== undefined;\n const [internalSelectedId, setInternalSelectedId] = useState<string | undefined>(\n defaultSelectedId,\n );\n const resolvedSelectedId = isControlled ? controlledSelectedId : internalSelectedId;\n\n const handleSelect = useCallback(\n (id: string) => {\n onSelect?.(id);\n if (!isControlled) {\n setInternalSelectedId(id);\n }\n },\n [isControlled, onSelect],\n );\n\n // Default day formatter\n const defaultFormatDay = useCallback(\n (d: Date) =>\n new Intl.DateTimeFormat(undefined, {\n weekday: \"short\",\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n }).format(d),\n [],\n );\n const resolvedFormatDay = formatDay ?? defaultFormatDay;\n\n // Merge detection: revision is a merge if ≥2 incoming edges target it\n const mergeIds = useMemo(() => {\n const incoming = new Map<string, number>();\n for (const e of edges) {\n incoming.set(e.to, (incoming.get(e.to) ?? 0) + 1);\n }\n return new Set([...incoming.entries()].filter(([, n]) => n >= 2).map(([id]) => id));\n }, [edges]);\n\n // Visible render items (revisions + collapsed-branch summaries). With no\n // `branches`, `branchMaps` is empty → every item is a plain revision and\n // `summaryOf` is empty, so the legacy render path is reproduced exactly.\n const { items: renderItems, summaryOf } = useMemo(\n () => computeRenderItems(revisions, collapsedSet, branchMaps),\n [revisions, collapsedSet, branchMaps],\n );\n\n // Group the VISIBLE render items by day. A summary inherits its tip's\n // timestamp, so it lands in the tip's day; a fully-hidden day drops out.\n const groups = useMemo<Array<{ dayKey: string; dayLabel: string; items: RenderItem[] }>>(() => {\n const itemTime = (it: RenderItem) =>\n it.kind === \"revision\" ? it.revision.timestamp : it.tipTimestamp;\n if (groupBy === \"none\") {\n return [{ dayKey: \"all\", dayLabel: \"\", items: renderItems }];\n }\n const result: Array<{ dayKey: string; dayLabel: string; items: RenderItem[] }> = [];\n for (const it of renderItems) {\n const ts = itemTime(it);\n const d = ts instanceof Date ? ts : new Date(ts);\n // YYYY-MM-DD in local time for grouping key\n const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, \"0\")}-${String(d.getDate()).padStart(2, \"0\")}`;\n const last = result[result.length - 1];\n if (last && last.dayKey === key) {\n last.items.push(it);\n } else {\n result.push({ dayKey: key, dayLabel: resolvedFormatDay(d), items: [it] });\n }\n }\n return result;\n }, [renderItems, groupBy, resolvedFormatDay]);\n\n // Shared gutter↔list coordinate space: a per-row vertical centre keyed by\n // render-item id (revision id OR `summary:<branchId>`), accounting for\n // day-header height, so the SVG dots line up with their rows.\n const ROW_H = resolvedDensity === \"compact\" ? ROW_H_COMPACT : ROW_H_COMFORTABLE;\n const { rowCenterY, gutterHeight } = useMemo(() => {\n const map = new Map<string, number>();\n let y = 0;\n for (const group of groups) {\n if (groupBy === \"day\") y += DAY_HEADER_H;\n for (const it of group.items) {\n const id = it.kind === \"revision\" ? it.revision.id : it.id;\n map.set(id, y + ROW_H / 2);\n y += ROW_H;\n }\n }\n return { rowCenterY: map, gutterHeight: y };\n }, [groups, groupBy, ROW_H]);\n\n // Gutter nodes: one per visible revision + one synthetic node per summary\n // (on the collapsed branch's own lane = its tip's lane).\n const gutterRevisions = useMemo<GutterNode[]>(\n () =>\n renderItems.map((it) =>\n it.kind === \"revision\"\n ? { id: it.revision.id, lane: it.revision.lane }\n : { id: it.id, lane: it.lane },\n ),\n [renderItems],\n );\n\n // Remap edges whose endpoints were hidden onto the summary that absorbed\n // them, so merge/fork curves still connect to the summary node.\n const visibleEdges = useMemo<RevisionEdge[]>(() => {\n if (!collapseEnabled || summaryOf.size === 0) return edges;\n const seen = new Set<string>();\n const out: RevisionEdge[] = [];\n for (const e of edges) {\n const from = summaryOf.get(e.from) ?? e.from;\n const to = summaryOf.get(e.to) ?? e.to;\n if (from === to) continue; // collapsed into a single node\n const key = `${from}\u0000${to}`;\n if (seen.has(key)) continue; // de-dup coincident remaps\n seen.add(key);\n out.push({ from, to });\n }\n return out;\n }, [collapseEnabled, edges, summaryOf]);\n\n const ctx: RevisionTimelineCtx = useMemo(\n () => ({\n selectedId: resolvedSelectedId,\n onSelect: handleSelect,\n }),\n [resolvedSelectedId, handleSelect],\n );\n\n const branchLabel = (branch: RevisionBranch) => branch.name ?? branch.id;\n const summaryText =\n formatBranchSummary ?? ((count: number) => `${count} ${count === 1 ? \"commit\" : \"commits\"}`);\n\n return (\n <RevisionTimelineContext.Provider value={ctx}>\n <div\n ref={ref}\n className={cn(revisionTimelineVariants({ density: resolvedDensity }), className)}\n {...props}\n >\n {/* Lane gutter + list side-by-side */}\n <div className=\"flex min-w-0\">\n {/* SVG branch-graph gutter */}\n <LaneGutter\n revisions={gutterRevisions}\n edges={visibleEdges}\n rowCenterY={rowCenterY}\n height={gutterHeight}\n className=\"mr-1\"\n />\n\n {/* Revision list */}\n <div className=\"min-w-0 flex-1\">\n {groups.map((group) => (\n <div key={group.dayKey}>\n {groupBy === \"day\" && <DayHeader label={group.dayLabel} />}\n <ol role=\"list\" aria-label={groupBy === \"day\" ? group.dayLabel : \"Revisions\"}>\n {group.items.map((it) => {\n if (it.kind === \"summary\") {\n return (\n <CollapsedBranchRow\n key={it.id}\n branchId={it.branch.id}\n branchName={branchLabel(it.branch)}\n summaryLabel={summaryText(it.count, it.branch)}\n density={resolvedDensity}\n indent={it.lane * LANE_W}\n onExpand={() => toggleBranch(it.branch.id)}\n />\n );\n }\n const branch = it.branchId\n ? branchMaps.branchById.get(it.branchId)\n : undefined;\n const collapseToggle =\n it.canCollapse && branch\n ? {\n branchName: branchLabel(branch),\n onToggle: () => toggleBranch(branch.id),\n }\n : undefined;\n return (\n <RevisionRow\n key={it.revision.id}\n revision={it.revision}\n isMerge={mergeIds.has(it.revision.id)}\n density={resolvedDensity}\n indent={it.revision.lane * LANE_W}\n collapseToggle={collapseToggle}\n />\n );\n })}\n </ol>\n </div>\n ))}\n </div>\n </div>\n </div>\n </RevisionTimelineContext.Provider>\n );\n },\n);\n","/**\n * Timeline — THE rail/node/connector spine (#190, research 10 §B.2): an\n * ordered list of steps with a vertical connector and a status-colored node\n * per step. Moved from `@elabs-ai/components-editor` (which re-exports it for back-compat —\n * the ADR-0012 own/re-export model); the branded target for the editor's\n * `:::timeline` markdown directive, and reusable anywhere a process/sequence\n * needs showing. Token-driven, theme-safe, motion-free (animation belongs to\n * composing consumers, e.g. the `@elabs-ai/components-ai` agent grammar).\n *\n * One rail, two front doors:\n * - compound `TimelineRoot` + `TimelineItem` — for composing consumers that\n * interleave rich children per node. The node takes the CANONICAL 7-state\n * `Status` (status-badge, #189) — closed enum, no freeform strings.\n * - array `Timeline items={TimelineEntry[]}` — a thin map over the compound\n * parts. Keeps the editor-facing `done|active|pending` API unchanged by\n * mapping in via `fromTimelineStatus` at the boundary.\n *\n * Fork-prevention: a Timeline re-implementation outside this folder fails\n * `pnpm timeline-fork:check` (scripts/check-timeline-fork.mjs).\n */\nimport { forwardRef, type HTMLAttributes, type LiHTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport {\n fromTimelineStatus,\n STATUS_LABELS,\n type Status,\n type TimelineStatus,\n} from \"../status-badge\";\n\n/**\n * Node visual per canonical status. This is a DUPLICATE of the status→role\n * mapping `status-badge.tsx` owns (`STATUS_ROLE`) — it exists because the rail\n * node is a filled dot, not a badge pill, so it can't share `statusBadgeVariants`\n * directly. A duplicate is only safe when it is TESTED against the source of\n * truth: `timeline.test.tsx` asserts every chromatic status here resolves to\n * the same role as `STATUS_ROLE`/`statusBadgeVariants` (#392 — `running` had\n * silently drifted to `--primary` here while the canonical map said `--info`,\n * because nothing checked the two agreed). Semantic tokens only.\n *\n * Every status ALSO carries a non-colour signature (#387, WCAG 1.4.1) — a\n * 12px dot can't host a legible glyph, so the cue is geometric. It took an\n * empirical (rendered) pass to find a signature that actually PAINTS\n * distinctly, not merely one that differs as a class string:\n * - `denied`/`skipped` (hollow-ish `bg-muted`, `border-border`) get\n * `border-dashed`/`border-dotted` — this WORKS because border and fill\n * are different colours there, so the gaps in the dash/dot pattern show\n * the (lighter) fill through the (darker) border.\n * - `running`/`complete`/`awaiting-approval`/`failed` are all `bg-<status>\n * border-<status>` — the vivid MARK rung, where border and fill are the\n * SAME token. A `border-style` on a same-colour border is invisible (no\n * colour boundary for the dash gaps to reveal), so this quartet is\n * differentiated by `ring-*` WIDTH instead — the ring sits outside the\n * dot, contrasting against the PAGE, not the fill, which is why\n * `running`'s existing halo was legible in the first place. Widths\n * `0 / 1 / 2 / 4` give four unmistakably different silhouettes:\n * `complete` none (calm/settled, matches `StatusBadge`'s quiet\n * treatment for `complete`) → `awaiting-approval` `ring-1` (a nudge) →\n * `running` `ring-2` (active) → `failed` `ring-4` (the widest, most\n * emphatic — the state that most needs to grab the eye).\n * `denied`/`skipped` were byte-identical before this; the ring-width\n * progression replaces an earlier border-style-only attempt that turned out\n * to be visually void on the vivid quartet — verified in `timeline.test.tsx`\n * (structural) and by rendered zoomed + greyscale screenshots (see #387\n * rendered proof) — don't reintroduce border-style there without re-checking\n * a render, it will look correct in code and disappear on screen.\n */\nexport const NODE_STYLE: Record<Status, string> = {\n pending: \"border-border bg-background\",\n running: \"border-info bg-info ring-2 ring-info/25\",\n complete: \"border-success bg-success\",\n \"awaiting-approval\": \"border-warning bg-warning ring-1 ring-warning/40\",\n denied: \"border-border bg-muted border-dashed\",\n failed: \"border-destructive bg-destructive ring-4 ring-destructive/20\",\n skipped: \"border-border bg-muted border-dotted\",\n};\n\n/** Statuses whose title reads de-emphasized (not-yet/never-run steps). */\nconst MUTED_TITLE_STATUSES: ReadonlySet<Status> = new Set([\"pending\", \"skipped\", \"denied\"]);\n\nexport type TimelineRootProps = HTMLAttributes<HTMLOListElement>;\n\n/** The `<ol>` that owns the rail geometry; compose `TimelineItem`s inside. */\nexport const TimelineRoot = forwardRef<HTMLOListElement, TimelineRootProps>(function TimelineRoot(\n { className, ...props },\n ref,\n) {\n return <ol ref={ref} className={cn(\"relative\", className)} {...props} />;\n});\n\nexport interface TimelineItemProps extends LiHTMLAttributes<HTMLLIElement> {\n /** The canonical execution status (closed 7-state enum, status-badge #189). */\n status?: Status;\n /** Right-aligned meta (e.g. a date) on the title row. */\n timestamp?: ReactNode;\n /** Secondary line under the title. */\n description?: ReactNode;\n /**\n * Rich block content under the title/description, indented with the rail —\n * the slot composing consumers (e.g. `@elabs-ai/components-ai`'s `AgentStep`, #192)\n * interleave per node. Block-level, so it must NOT ride the inline title\n * slot (`children`).\n */\n detail?: ReactNode;\n}\n\n/**\n * One `<li>`: status node + connector + the title row; `children` is the\n * title slot. The connector hides itself on the last item via CSS\n * (`group-last`), so streaming/compound consumers never track \"is last\".\n */\nexport const TimelineItem = forwardRef<HTMLLIElement, TimelineItemProps>(function TimelineItem(\n { status = \"pending\", timestamp, description, detail, className, children, ...props },\n ref,\n) {\n return (\n <li\n ref={ref}\n data-status={status}\n className={cn(\"group/timeline-item relative pb-5 ps-7 last:pb-0\", className)}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className=\"absolute start-[5px] top-2.5 h-full w-px bg-border group-last/timeline-item:hidden\"\n />\n <span\n aria-hidden=\"true\"\n className={cn(\"absolute start-0 top-1 size-3 rounded-full border-2\", NODE_STYLE[status])}\n />\n <div className=\"flex items-baseline justify-between gap-3\">\n <span\n className={cn(\n \"text-body font-medium\",\n MUTED_TITLE_STATUSES.has(status) ? \"text-muted-foreground\" : \"text-foreground\",\n )}\n >\n {/* The dot is `aria-hidden` and `data-status` isn't AT-visible (#387) —\n this is the step's only announced status; kept inline so it reads\n naturally as \"<Status>: <title>\" instead of a second live region. */}\n <span className=\"sr-only\">{STATUS_LABELS[status]}: </span>\n {children}\n </span>\n {timestamp ? (\n <span className=\"shrink-0 text-meta text-muted-foreground\">{timestamp}</span>\n ) : null}\n </div>\n {description ? <p className=\"mt-0.5 text-body text-muted-foreground\">{description}</p> : null}\n {detail ? <div className=\"mt-2 space-y-2\">{detail}</div> : null}\n </li>\n );\n});\n\n/**\n * One step of the array-API `Timeline` (the editor's original item shape —\n * re-exported by `@elabs-ai/components-editor` as `TimelineItem` for back-compat).\n */\nexport interface TimelineEntry {\n title: ReactNode;\n description?: ReactNode;\n /** The editor's 3-state vocabulary; mapped in via `fromTimelineStatus`. */\n status?: TimelineStatus;\n timestamp?: ReactNode;\n}\n\nexport interface TimelineProps extends HTMLAttributes<HTMLOListElement> {\n items: TimelineEntry[];\n}\n\n/** Array convenience over the compound parts (data in, list out). */\nexport const Timeline = forwardRef<HTMLOListElement, TimelineProps>(function Timeline(\n { items, className, ...props },\n ref,\n) {\n return (\n <TimelineRoot ref={ref} className={className} {...props}>\n {items.map((item, i) => (\n <TimelineItem\n key={i}\n status={fromTimelineStatus(item.status ?? \"pending\")}\n timestamp={item.timestamp}\n description={item.description}\n >\n {item.title}\n </TimelineItem>\n ))}\n </TimelineRoot>\n );\n});\n","\"use client\";\n\n/**\n * Toolbar — the ONE row that genuinely claims `role=\"toolbar\"`.\n *\n * The role is a promise: a toolbar is a SINGLE tab stop, and the arrow keys move\n * between its controls (WAI-ARIA APG). Four rows in this repo claim the role\n * without implementing that, which is worse than not claiming it — a screen\n * reader tells the user to press the arrow keys and nothing happens. This\n * component delegates the roving tabindex to `@radix-ui/react-toolbar` so the\n * promise is kept, and exists so no one has to hand-roll it again.\n *\n * When NOT to use it. A row of ordinary controls above a list or table is a\n * `ViewToolbar` — that component deliberately does not claim the role, because\n * every control there is an ordinary tab stop and readers expect Tab, not\n * arrows. Reach for `Toolbar` when the row is DENSE and SECONDARY to the content\n * it acts on (a document's page/zoom controls, a formatting bar): collapsing a\n * dozen controls into one tab stop is what makes the content reachable again.\n *\n * Anatomy — a shell plus three composable parts. There is no `actions` prop and\n * no items array: a toolbar's layout is the caller's, so groups are arranged\n * with ordinary flex utilities and `ToolbarSeparator` between them.\n */\n\nimport * as ToolbarPrimitive from \"@radix-ui/react-toolbar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\n\nimport { cn } from \"../../lib/cn\";\nimport { buttonVariants } from \"../button\";\nimport { toggleVariants } from \"../toggle\";\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport const toolbarVariants = cva(\"flex items-center gap-1\", {\n variants: {\n orientation: {\n horizontal: \"flex-row\",\n // Radix already writes `aria-orientation`; this only lays it out.\n vertical: \"h-full flex-col\",\n },\n },\n defaultVariants: { orientation: \"horizontal\" },\n});\n\nexport interface ToolbarProps\n extends\n Omit<ComponentPropsWithoutRef<typeof ToolbarPrimitive.Root>, \"orientation\">,\n VariantProps<typeof toolbarVariants> {\n /**\n * What this toolbar acts on (\"Document\", \"Formatting\"). A toolbar is one tab\n * stop with several controls inside it, so without a name a screen-reader\n * user lands on an anonymous group — hence required, not optional.\n */\n \"aria-label\": string;\n}\n\n/**\n * The row shell. Renders no surface of its own: a toolbar sits ON something\n * (a card header, a document frame) and inherits that surface, so painting a\n * background here would double the fill wherever it is placed.\n */\nexport const Toolbar = forwardRef<ElementRef<typeof ToolbarPrimitive.Root>, ToolbarProps>(\n function Toolbar({ className, orientation, ...props }, ref) {\n return (\n <ToolbarPrimitive.Root\n ref={ref}\n data-slot=\"toolbar\"\n orientation={orientation ?? \"horizontal\"}\n className={cn(toolbarVariants({ orientation }), className)}\n {...props}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------- */\n/* Parts */\n/* -------------------------------------------------------------------------- */\n\nexport interface ToolbarButtonProps\n extends\n ComponentPropsWithoutRef<typeof ToolbarPrimitive.Button>,\n Pick<VariantProps<typeof buttonVariants>, \"variant\" | \"size\"> {}\n\n/**\n * A control inside the toolbar. Styled with `buttonVariants` — the same ink,\n * heights and focus ring as every other button in the system, not a parallel\n * set. Icon-only controls take `size=\"icon-sm\"` and MUST carry an `aria-label`;\n * wrap in a `Tooltip` when the glyph needs a name on screen too.\n */\nexport const ToolbarButton = forwardRef<\n ElementRef<typeof ToolbarPrimitive.Button>,\n ToolbarButtonProps\n>(function ToolbarButton({ className, variant = \"ghost\", size = \"sm\", ...props }, ref) {\n return (\n <ToolbarPrimitive.Button\n ref={ref}\n data-slot=\"toolbar-button\"\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n />\n );\n});\n\nexport type ToolbarSeparatorProps = ComponentPropsWithoutRef<typeof ToolbarPrimitive.Separator>;\n\n/**\n * The divider between two groups of controls. It is the ONLY cue between two\n * same-fill regions of the row, so it takes the strong rung (WCAG 1.4.11,\n * ADR 0010) — `Separator`'s subtle default would be a decorative hairline here.\n */\nexport const ToolbarSeparator = forwardRef<\n ElementRef<typeof ToolbarPrimitive.Separator>,\n ToolbarSeparatorProps\n>(function ToolbarSeparator({ className, ...props }, ref) {\n return (\n <ToolbarPrimitive.Separator\n ref={ref}\n data-slot=\"toolbar-separator\"\n className={cn(\n \"bg-border-strong mx-1 shrink-0\",\n \"data-[orientation=horizontal]:h-5 data-[orientation=horizontal]:w-px\",\n \"data-[orientation=vertical]:h-px data-[orientation=vertical]:w-5\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport type ToolbarToggleGroupProps = ComponentPropsWithoutRef<typeof ToolbarPrimitive.ToggleGroup>;\n\n/** A set of mutually-exclusive or multi-select toggles (a view switcher, bold/italic). */\nexport const ToolbarToggleGroup = forwardRef<\n ElementRef<typeof ToolbarPrimitive.ToggleGroup>,\n ToolbarToggleGroupProps\n>(function ToolbarToggleGroup({ className, ...props }, ref) {\n return (\n <ToolbarPrimitive.ToggleGroup\n ref={ref}\n data-slot=\"toolbar-toggle-group\"\n className={cn(\"flex items-center gap-1\", className)}\n {...props}\n />\n );\n});\n\nexport interface ToolbarToggleItemProps\n extends\n ComponentPropsWithoutRef<typeof ToolbarPrimitive.ToggleItem>,\n Pick<VariantProps<typeof toggleVariants>, \"size\"> {}\n\n/** One toggle. Shares `Toggle`'s pressed styling, so state reads the same everywhere. */\nexport const ToolbarToggleItem = forwardRef<\n ElementRef<typeof ToolbarPrimitive.ToggleItem>,\n ToolbarToggleItemProps\n>(function ToolbarToggleItem({ className, size = \"sm\", ...props }, ref) {\n return (\n <ToolbarPrimitive.ToggleItem\n ref={ref}\n data-slot=\"toolbar-toggle-item\"\n className={cn(toggleVariants({ size }), className)}\n {...props}\n />\n );\n});\n\n/**\n * An escape hatch for anything the parts above do not cover — a `Select`, an\n * input, a `DropdownMenu` trigger. `asChild` hands the roving-tabindex wiring to\n * whatever you render, so the control stays part of the arrow-key sequence\n * instead of becoming a second tab stop inside a single-tab-stop row.\n */\nexport const ToolbarSlot = ToolbarPrimitive.Button;\n","import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TopNavProps extends HTMLAttributes<HTMLElement> {\n /** Left slot (brand on mobile, breadcrumbs, title). */\n start?: ReactNode;\n /** Right slot (search, actions, account menu). */\n end?: ReactNode;\n}\n\n/** Application top bar. Sticky, single row, brand-neutral. */\nexport const TopNav = forwardRef<HTMLElement, TopNavProps>(function TopNav(\n { className, start, end, children, ...props },\n ref,\n) {\n return (\n <header\n ref={ref}\n className={cn(\n \"sticky top-0 z-30 flex h-14 items-center gap-4 border-b bg-surface-elevated/80 px-4 backdrop-blur\",\n className,\n )}\n {...props}\n >\n {start ? <div className=\"flex items-center gap-2\">{start}</div> : null}\n {children ? (\n <div className=\"flex flex-1 items-center\">{children}</div>\n ) : (\n <div className=\"flex-1\" />\n )}\n {end ? <div className=\"flex items-center gap-2\">{end}</div> : null}\n </header>\n );\n});\n","// a2ui.exposed: yes\n\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { Button } from \"../button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"../card\";\nimport { Checkbox } from \"../checkbox\";\nimport { Input } from \"../input\";\nimport { ScrollArea } from \"../scroll-area\";\n\n// ─── Public types ─────────────────────────────────────────────────────────────\n\nexport interface TransferItem {\n value: string;\n label: ReactNode;\n disabled?: boolean;\n}\n\nexport interface TransferProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Full data set. Source = items NOT in target; target = items IN target. */\n dataSource: TransferItem[];\n /** Controlled: values in the RIGHT (target) list. */\n targetKeys?: string[];\n /** Uncontrolled initial target keys. */\n defaultTargetKeys?: string[];\n /** Called whenever the target key-set changes. */\n onChange?: (targetKeys: string[]) => void;\n /** Show per-panel search input. @default false */\n showSearch?: boolean;\n /** Panel titles. @default [\"Source\", \"Target\"] */\n titles?: [ReactNode, ReactNode];\n /** Custom row renderer. @default (item) => item.label */\n renderItem?: (item: TransferItem) => ReactNode;\n className?: string;\n}\n\n// ─── Internal helpers ─────────────────────────────────────────────────────────\n\n/** Determine label as string for search filtering (ReactNode guard). */\nfunction labelAsString(label: ReactNode): string {\n if (typeof label === \"string\") return label;\n if (typeof label === \"number\") return String(label);\n return \"\";\n}\n\n// ─── Panel sub-component ──────────────────────────────────────────────────────\n\ninterface PanelProps {\n title: ReactNode;\n items: TransferItem[];\n checked: Set<string>;\n onCheckItem: (value: string, on: boolean) => void;\n onCheckAll: (on: boolean) => void;\n showSearch: boolean;\n searchQuery: string;\n onSearchChange: (q: string) => void;\n renderItem: (item: TransferItem) => ReactNode;\n searchInputId: string;\n /** id applied to the panel's CardTitle; the panel region is labelled by it. */\n titleId: string;\n /** id prefix for per-row checkbox + label wiring. */\n rowIdBase: string;\n}\n\nfunction TransferPanel({\n title,\n items,\n checked,\n onCheckItem,\n onCheckAll,\n showSearch,\n searchQuery,\n onSearchChange,\n renderItem,\n searchInputId,\n titleId,\n rowIdBase,\n}: PanelProps) {\n // When a search is active, filter visible items; move operations affect VISIBLE enabled items.\n const visibleItems = useMemo(() => {\n if (!searchQuery) return items;\n const q = searchQuery.toLowerCase();\n return items.filter((it) => labelAsString(it.label).toLowerCase().includes(q));\n }, [items, searchQuery]);\n\n const enabledVisible = useMemo(() => visibleItems.filter((it) => !it.disabled), [visibleItems]);\n const checkedCount = checked.size;\n const totalCount = visibleItems.length;\n\n const allChecked =\n enabledVisible.length > 0 && enabledVisible.every((it) => checked.has(it.value));\n const someChecked = !allChecked && enabledVisible.some((it) => checked.has(it.value));\n\n return (\n <Card role=\"region\" aria-labelledby={titleId} className=\"flex flex-1 flex-col overflow-hidden\">\n <CardHeader className=\"flex-row items-center justify-between gap-2 p-3\">\n <div className=\"flex items-center gap-2\">\n <Checkbox\n checked={someChecked ? \"indeterminate\" : allChecked}\n onCheckedChange={(v) => onCheckAll(v === true)}\n aria-label={`Select all in ${typeof title === \"string\" ? title : \"panel\"}`}\n disabled={enabledVisible.length === 0}\n />\n <CardTitle id={titleId} className=\"text-sm\">\n {title}\n </CardTitle>\n </div>\n <Badge variant=\"secondary\" className=\"tabular-nums\">\n {checkedCount > 0 ? `${checkedCount}/${totalCount}` : totalCount}\n </Badge>\n </CardHeader>\n\n {showSearch && (\n <div className=\"px-3 pb-2\">\n <label htmlFor={searchInputId} className=\"sr-only\">\n Search {typeof title === \"string\" ? title : \"items\"}\n </label>\n <Input\n id={searchInputId}\n type=\"search\"\n placeholder=\"Search…\"\n value={searchQuery}\n onChange={(e) => onSearchChange(e.target.value)}\n className=\"h-7 text-xs\"\n />\n </div>\n )}\n\n <CardContent className=\"flex-1 overflow-hidden p-0\">\n <ScrollArea className=\"h-full min-h-[200px]\">\n {visibleItems.length === 0 ? (\n <p className=\"flex h-[200px] items-center justify-center text-sm text-muted-foreground\">\n No items\n </p>\n ) : (\n <ul role=\"list\" className=\"flex flex-col py-1\">\n {visibleItems.map((item) => {\n const isChecked = checked.has(item.value);\n const cbId = `${rowIdBase}-cb-${item.value}`;\n const lblId = `${rowIdBase}-lbl-${item.value}`;\n return (\n // Plain list row: the Checkbox is the interactive control (named via\n // aria-labelledby) and the <label htmlFor> gives a second hit target.\n // No role=\"option\" — an interactive checkbox cannot live inside one.\n <li\n key={item.value}\n className={cn(\n \"flex select-none items-center gap-2 px-3 py-1.5 text-sm\",\n \"hover:bg-accent hover:text-accent-foreground\",\n item.disabled && \"opacity-50 hover:bg-transparent hover:text-foreground\",\n )}\n >\n <Checkbox\n id={cbId}\n checked={isChecked}\n onCheckedChange={(v) => !item.disabled && onCheckItem(item.value, v === true)}\n disabled={item.disabled}\n aria-labelledby={lblId}\n />\n <label\n id={lblId}\n htmlFor={cbId}\n className={cn(\n \"min-w-0 flex-1 truncate\",\n item.disabled ? \"cursor-not-allowed\" : \"cursor-pointer\",\n )}\n >\n {renderItem(item)}\n </label>\n </li>\n );\n })}\n </ul>\n )}\n </ScrollArea>\n </CardContent>\n </Card>\n );\n}\n\n// ─── Transfer (main) ──────────────────────────────────────────────────────────\n\nexport const Transfer = forwardRef<HTMLDivElement, TransferProps>(function Transfer(\n {\n dataSource,\n targetKeys: controlledTargetKeys,\n defaultTargetKeys,\n onChange,\n showSearch = false,\n titles = [\"Source\", \"Target\"],\n renderItem = (item) => item.label,\n className,\n ...props\n },\n ref,\n) {\n const isControlled = controlledTargetKeys !== undefined;\n\n // Uncontrolled internal state\n const [internalTargetKeys, setInternalTargetKeys] = useState<string[]>(\n () => defaultTargetKeys ?? [],\n );\n\n const targetKeys: string[] = isControlled ? controlledTargetKeys : internalTargetKeys;\n\n const targetSet = useMemo(() => new Set(targetKeys), [targetKeys]);\n\n // Per-panel row selection (which items are \"checked for move\")\n const [sourceChecked, setSourceChecked] = useState<Set<string>>(new Set());\n const [targetChecked, setTargetChecked] = useState<Set<string>>(new Set());\n\n // SR-only live announcement for move outcomes.\n const [announcement, setAnnouncement] = useState(\"\");\n\n // Per-panel search\n const [sourceSearch, setSourceSearch] = useState(\"\");\n const [targetSearch, setTargetSearch] = useState(\"\");\n\n // Derive panels from dataSource (preserving order)\n const sourceItems = useMemo(\n () => dataSource.filter((it) => !targetSet.has(it.value)),\n [dataSource, targetSet],\n );\n const targetItems = useMemo(\n () => dataSource.filter((it) => targetSet.has(it.value)),\n [dataSource, targetSet],\n );\n\n // ── Apply a move: compute next targetKeys, update state ──────────────────\n const applyMove = useCallback(\n (nextTargetKeys: string[]) => {\n if (!isControlled) setInternalTargetKeys(nextTargetKeys);\n onChange?.(nextTargetKeys);\n },\n [isControlled, onChange],\n );\n\n // ── Filtered visible items for \"move all visible\" decisions ───────────────\n const visibleSourceEnabled = useMemo(() => {\n const q = sourceSearch.toLowerCase();\n return sourceItems.filter(\n (it) => !it.disabled && (!sourceSearch || labelAsString(it.label).toLowerCase().includes(q)),\n );\n }, [sourceItems, sourceSearch]);\n\n const visibleTargetEnabled = useMemo(() => {\n const q = targetSearch.toLowerCase();\n return targetItems.filter(\n (it) => !it.disabled && (!targetSearch || labelAsString(it.label).toLowerCase().includes(q)),\n );\n }, [targetItems, targetSearch]);\n\n // ── Move handlers ─────────────────────────────────────────────────────────\n\n /** Move source-panel checked items → target */\n const handleMoveCheckedRight = useCallback(() => {\n const toMove = new Set(\n [...sourceChecked].filter((v) => {\n const item = dataSource.find((it) => it.value === v);\n return item && !item.disabled && !targetSet.has(v);\n }),\n );\n if (toMove.size === 0) return;\n applyMove([...targetKeys, ...toMove]);\n setAnnouncement(`${toMove.size} item${toMove.size === 1 ? \"\" : \"s\"} moved to the target list.`);\n setSourceChecked((prev) => {\n const next = new Set(prev);\n toMove.forEach((v) => next.delete(v));\n return next;\n });\n }, [sourceChecked, dataSource, targetKeys, targetSet, applyMove]);\n\n /** Move ALL visible enabled source items → target */\n const handleMoveAllRight = useCallback(() => {\n // When search is active, move visible enabled items; otherwise move all enabled.\n // CHOICE: move currently-VISIBLE enabled items when a search is active so \"move all\"\n // respects the user's current filter view (predictable, WYSIWYG).\n const toAdd = visibleSourceEnabled.map((it) => it.value);\n if (toAdd.length === 0) return;\n const next = [...new Set([...targetKeys, ...toAdd])];\n applyMove(next);\n setAnnouncement(\n `${toAdd.length} item${toAdd.length === 1 ? \"\" : \"s\"} moved to the target list.`,\n );\n setSourceChecked(new Set());\n }, [visibleSourceEnabled, targetKeys, applyMove]);\n\n /** Move target-panel checked items → source */\n const handleMoveCheckedLeft = useCallback(() => {\n const toRemove = new Set(\n [...targetChecked].filter((v) => {\n const item = dataSource.find((it) => it.value === v);\n return item && !item.disabled && targetSet.has(v);\n }),\n );\n if (toRemove.size === 0) return;\n applyMove(targetKeys.filter((k) => !toRemove.has(k)));\n setAnnouncement(\n `${toRemove.size} item${toRemove.size === 1 ? \"\" : \"s\"} moved to the source list.`,\n );\n setTargetChecked((prev) => {\n const next = new Set(prev);\n toRemove.forEach((v) => next.delete(v));\n return next;\n });\n }, [targetChecked, dataSource, targetKeys, targetSet, applyMove]);\n\n /** Move ALL visible enabled target items → source */\n const handleMoveAllLeft = useCallback(() => {\n const toRemove = new Set(visibleTargetEnabled.map((it) => it.value));\n if (toRemove.size === 0) return;\n applyMove(targetKeys.filter((k) => !toRemove.has(k)));\n setAnnouncement(\n `${toRemove.size} item${toRemove.size === 1 ? \"\" : \"s\"} moved to the source list.`,\n );\n setTargetChecked(new Set());\n }, [visibleTargetEnabled, targetKeys, applyMove]);\n\n // ── Per-panel check handlers ──────────────────────────────────────────────\n\n const handleSourceCheckItem = useCallback((value: string, on: boolean) => {\n setSourceChecked((prev) => {\n const next = new Set(prev);\n if (on) next.add(value);\n else next.delete(value);\n return next;\n });\n }, []);\n\n const handleTargetCheckItem = useCallback((value: string, on: boolean) => {\n setTargetChecked((prev) => {\n const next = new Set(prev);\n if (on) next.add(value);\n else next.delete(value);\n return next;\n });\n }, []);\n\n const handleSourceCheckAll = useCallback(\n (on: boolean) => {\n const q = sourceSearch.toLowerCase();\n const visible = sourceItems.filter(\n (it) =>\n !it.disabled && (!sourceSearch || labelAsString(it.label).toLowerCase().includes(q)),\n );\n setSourceChecked(on ? new Set(visible.map((it) => it.value)) : new Set());\n },\n [sourceItems, sourceSearch],\n );\n\n const handleTargetCheckAll = useCallback(\n (on: boolean) => {\n const q = targetSearch.toLowerCase();\n const visible = targetItems.filter(\n (it) =>\n !it.disabled && (!targetSearch || labelAsString(it.label).toLowerCase().includes(q)),\n );\n setTargetChecked(on ? new Set(visible.map((it) => it.value)) : new Set());\n },\n [targetItems, targetSearch],\n );\n\n // ── Button disabled states ────────────────────────────────────────────────\n // Enabled only when a checked item is actually movable (still on this side and\n // not disabled) — a stale checked id (e.g. moved via a controlled targetKeys\n // change) must not light up a button that would then no-op.\n const canMoveCheckedRight = [...sourceChecked].some(\n (v) => !targetSet.has(v) && !dataSource.find((it) => it.value === v)?.disabled,\n );\n const canMoveAllRight = visibleSourceEnabled.length > 0;\n const canMoveCheckedLeft = [...targetChecked].some(\n (v) => targetSet.has(v) && !dataSource.find((it) => it.value === v)?.disabled,\n );\n const canMoveAllLeft = visibleTargetEnabled.length > 0;\n\n // Unique IDs for search inputs, panel-title labelling and row wiring\n const uid = useId();\n const sourceSearchId = `transfer-source-search-${uid}`;\n const targetSearchId = `transfer-target-search-${uid}`;\n const sourceTitleId = `transfer-source-title-${uid}`;\n const targetTitleId = `transfer-target-title-${uid}`;\n const sourceRowBase = `transfer-source-${uid}`;\n const targetRowBase = `transfer-target-${uid}`;\n\n return (\n <div ref={ref} className={cn(\"flex items-stretch gap-2\", className)} {...props}>\n {/* SR-only live region announcing move outcomes */}\n <div role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </div>\n\n {/* ── Source panel ─────────────────────────────── */}\n <TransferPanel\n title={titles[0]}\n items={sourceItems}\n checked={sourceChecked}\n onCheckItem={handleSourceCheckItem}\n onCheckAll={handleSourceCheckAll}\n showSearch={showSearch}\n searchQuery={sourceSearch}\n onSearchChange={setSourceSearch}\n renderItem={renderItem}\n searchInputId={sourceSearchId}\n titleId={sourceTitleId}\n rowIdBase={sourceRowBase}\n />\n\n {/* ── Move controls (center column) ────────────── */}\n <div\n className=\"flex flex-col items-center justify-center gap-1\"\n role=\"group\"\n aria-label=\"Move controls\"\n >\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Move selected right\"\n disabled={!canMoveCheckedRight}\n onClick={handleMoveCheckedRight}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Move all right\"\n disabled={!canMoveAllRight}\n onClick={handleMoveAllRight}\n >\n <ChevronsRight aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Move selected left\"\n disabled={!canMoveCheckedLeft}\n onClick={handleMoveCheckedLeft}\n className=\"mt-2\"\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label=\"Move all left\"\n disabled={!canMoveAllLeft}\n onClick={handleMoveAllLeft}\n >\n <ChevronsLeft aria-hidden=\"true\" />\n </Button>\n </div>\n\n {/* ── Target panel ─────────────────────────────── */}\n <TransferPanel\n title={titles[1]}\n items={targetItems}\n checked={targetChecked}\n onCheckItem={handleTargetCheckItem}\n onCheckAll={handleTargetCheckAll}\n showSearch={showSearch}\n searchQuery={targetSearch}\n onSearchChange={setTargetSearch}\n renderItem={renderItem}\n searchInputId={targetSearchId}\n titleId={targetTitleId}\n rowIdBase={targetRowBase}\n />\n </div>\n );\n});\n","// a2ui.exposed: yes\n\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { ChevronRight, AlertCircle, RotateCcw } from \"lucide-react\";\nimport { useVirtualizer, type Virtualizer } from \"@tanstack/react-virtual\";\nimport { cn } from \"../../lib/cn\";\nimport { Checkbox } from \"../checkbox/checkbox\";\nimport { Skeleton } from \"../skeleton/skeleton\";\nimport { Spinner } from \"../spinner/spinner\";\nimport { useTreeKeyboard } from \"./use-tree-keyboard\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface TreeNode<T = unknown> {\n id: string;\n label: ReactNode;\n children?: TreeNode<T>[];\n /**\n * Marks a node as expandable even when `children` is not yet loaded.\n * A node with `hasChildren: true` and no `children` array will show the\n * expand affordance. Calling `loadChildren` will populate its children.\n */\n hasChildren?: boolean;\n disabled?: boolean;\n icon?: ReactNode;\n /**\n * Optional trailing content rendered after the label — e.g. a size or\n * token-count badge (#369). Rendered as a SIBLING of the label and kept out\n * of the row's accessible name: a string `label` names the row via\n * `aria-label`, a `ReactNode` label names it via `aria-labelledby` pointing\n * at the label span only, so the accessory text never joins either.\n *\n * The slot is isolated from the row: click, keydown and focus are stopped at\n * the accessory, so it never selects/expands the row, never lets the tree's\n * roving-tabindex handler swallow its keys, and never has focus yanked back\n * to the row. Interactive content (a button, a link) therefore works and is\n * independently focusable in normal tab order; the row's own keyboard\n * navigation (arrow keys, Enter/Space) is unaffected while the row is focused.\n */\n accessory?: ReactNode;\n data?: T;\n}\n\nexport interface TreeProps<T = unknown> extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n nodes: TreeNode<T>[];\n /** Controlled expanded ids */\n expandedIds?: string[];\n /** Uncontrolled initial expanded ids */\n defaultExpandedIds?: string[];\n onExpandedChange?: (ids: string[]) => void;\n /** \"single\" | \"multiple\" | \"none\" — default \"single\" */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n /** Controlled selected ids */\n selectedIds?: string[];\n /** Uncontrolled initial selected ids */\n defaultSelectedIds?: string[];\n onSelectionChange?: (ids: string[]) => void;\n /** Show checkboxes for multi-selection affordance — default false */\n checkboxes?: boolean;\n /**\n * The surface on which the tree is rendered.\n * - `\"default\"` (default) — renders selected rows with `bg-accent` (for use on\n * background/card surfaces).\n * - `\"sidebar\"` — renders selected rows with the sidebar's own active-item\n * treatment (`bg-sidebar-accent` + `text-sidebar-accent-foreground` +\n * `font-medium`), so selection reads consistently with `SidebarMenuButton`'s\n * active state on the `--sidebar` surface. (No fill is ≥3:1 on a sidebar;\n * perceivability comes from the foreground/weight shift + `aria-selected`,\n * the same multi-cue approach the Sidebar uses.)\n */\n surface?: \"default\" | \"sidebar\";\n /**\n * Enable windowed rendering for large trees (>50 visible rows).\n * When `true`, only the visible slice of the flattened tree is mounted in\n * the DOM. Requires a bounded scroll container — either via `maxHeight` or\n * by sizing the root element externally with `overflow-auto`.\n * Default: `false` (backward-compatible nested-group DOM).\n */\n virtualize?: boolean;\n /** Estimated row height in px used by the virtualizer. Default 32. */\n estimateRowHeight?: number;\n /** Number of extra rows to render beyond the visible window. Default 8. */\n overscan?: number;\n /**\n * CSS max-height for the scroll viewport when `virtualize` is true.\n * E.g. `\"400px\"` or `\"60vh\"`. When omitted the root div must be sized by\n * the caller (e.g. via `className=\"h-96 overflow-auto\"`).\n */\n maxHeight?: number | string;\n /**\n * Scroll the node with this id into view when the value CHANGES. Reveals a\n * node selected programmatically (via `selectedIds`) that is windowed out of\n * the DOM in `virtualize` mode (or below the fold), so the tree shows \"where\n * I am\", not just structure. Expands the node's (loaded) ancestors and kicks\n * their lazy `loadChildren` as needed, then centers the node. Independent of\n * keyboard focus (keyboard nav's own scroll is unchanged).\n */\n scrollToId?: string;\n /**\n * When `true`, reveal the newly-selected controlled node (the id added to\n * `selectedIds`) into view — the selection-driven equivalent of `scrollToId`.\n * `scrollToId` wins when both are set.\n */\n scrollSelectionIntoView?: boolean;\n /**\n * Async function called when a node with `hasChildren: true` (and no\n * loaded `children`) is expanded for the first time. The returned nodes\n * are merged into the internal tree state and cached so re-expanding the\n * node does not re-fetch.\n */\n loadChildren?: (node: TreeNode<T>) => Promise<TreeNode<T>[]>;\n className?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Internal types for lazy-load state\n// ---------------------------------------------------------------------------\n\ntype LoadState = \"idle\" | \"loading\" | \"error\";\n\ninterface LazyState {\n [nodeId: string]: LoadState;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction useControllableSet(\n controlled: string[] | undefined,\n defaultValue: string[] | undefined,\n onChange: ((ids: string[]) => void) | undefined,\n): [Set<string>, (next: Set<string>) => void] {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = useState<Set<string>>(\n () => new Set(controlled ?? defaultValue ?? []),\n );\n\n const value: Set<string> = isControlled ? new Set(controlled) : internal;\n\n const setValue = useCallback(\n (next: Set<string>) => {\n if (!isControlled) setInternal(next);\n onChange?.(Array.from(next));\n },\n [isControlled, onChange],\n );\n\n return [value, setValue];\n}\n\n/** Merge resolved children into a tree, returning a new tree. */\nfunction mergeChildren<T>(\n nodes: TreeNode<T>[],\n nodeId: string,\n children: TreeNode<T>[],\n): TreeNode<T>[] {\n return nodes.map((n) => {\n if (n.id === nodeId) {\n return { ...n, children, hasChildren: undefined };\n }\n if (n.children?.length) {\n return { ...n, children: mergeChildren(n.children, nodeId, children) };\n }\n return n;\n });\n}\n\n// ---------------------------------------------------------------------------\n// VirtualFlatRow — a single flat row for the virtualized path\n// ---------------------------------------------------------------------------\n\ninterface FlatRow<T> {\n node: TreeNode<T>;\n level: number;\n setSize: number;\n posInSet: number;\n}\n\ninterface VirtualFlatRowProps<T> {\n row: FlatRow<T>;\n isExpanded: boolean;\n isSelected: boolean;\n isActive: boolean;\n lazyState: LoadState;\n expandable: boolean; // has children OR hasChildren flag\n selectionMode: \"single\" | \"multiple\" | \"none\";\n checkboxes: boolean;\n surface: \"default\" | \"sidebar\";\n onToggleExpand: (id: string) => void;\n onSelect: (id: string) => void;\n onRetry: (id: string) => void;\n registerNodeRef: (id: string, el: HTMLElement | null) => void;\n setActiveId: (id: string | null) => void;\n}\n\nfunction VirtualFlatRow<T>({\n row,\n isExpanded,\n isSelected,\n isActive,\n lazyState,\n expandable,\n selectionMode,\n checkboxes,\n surface,\n onToggleExpand,\n onSelect,\n onRetry,\n registerNodeRef,\n setActiveId,\n}: VirtualFlatRowProps<T>) {\n const { node, level, setSize, posInSet } = row;\n const isLoading = lazyState === \"loading\";\n const isError = lazyState === \"error\";\n // A ReactNode label can't name the row via `aria-label`, so without this the\n // name would fall back to the row's CONTENTS — which includes the accessory\n // (#369). Point at the label span instead, so the accessory is excluded for\n // BOTH label shapes.\n const labelId = useId();\n\n const indentStyle = { paddingLeft: `${(level - 1) * 1}rem` };\n\n const handleRowClick = () => {\n if (node.disabled) return;\n setActiveId(node.id);\n onSelect(node.id);\n if (expandable) onToggleExpand(node.id);\n };\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={expandable ? isExpanded : undefined}\n aria-selected={selectionMode !== \"none\" && !checkboxes ? isSelected : undefined}\n aria-checked={checkboxes ? isSelected : undefined}\n aria-label={typeof node.label === \"string\" ? node.label : undefined}\n aria-labelledby={typeof node.label === \"string\" ? undefined : labelId}\n aria-level={level}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n aria-disabled={node.disabled ? true : undefined}\n aria-busy={isLoading ? true : undefined}\n tabIndex={isActive ? 0 : -1}\n data-tree-id={node.id}\n ref={(el) => registerNodeRef(node.id, el)}\n onClick={node.disabled ? undefined : handleRowClick}\n onFocus={() => setActiveId(node.id)}\n className={cn(\n \"flex min-w-0 cursor-pointer select-none items-center gap-1.5 rounded-md px-2 py-1.5 text-body outline-none\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n isSelected &&\n selectionMode !== \"none\" &&\n (surface === \"sidebar\"\n ? \"bg-sidebar-accent text-sidebar-accent-foreground font-medium\"\n : \"bg-accent text-accent-foreground font-medium\"),\n node.disabled && \"cursor-not-allowed opacity-50 pointer-events-none\",\n )}\n style={indentStyle}\n >\n {/* expand/collapse chevron */}\n {expandable ? (\n <span\n aria-hidden=\"true\"\n onClick={(e) => {\n e.stopPropagation();\n onToggleExpand(node.id);\n }}\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded transition-transform duration-fast ease-standard motion-reduce:transition-none\",\n isExpanded && \"rotate-90\",\n )}\n >\n {isLoading ? (\n <Spinner className=\"size-3.5\" label=\"Loading children\" />\n ) : (\n <ChevronRight className=\"size-3.5 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </span>\n ) : (\n <span aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n )}\n\n {/* optional checkbox for multi-select */}\n {checkboxes && selectionMode === \"multiple\" && (\n <Checkbox\n checked={isSelected}\n disabled={node.disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n onClick={(e) => {\n e.stopPropagation();\n onSelect(node.id);\n }}\n className=\"shrink-0\"\n />\n )}\n\n {/* optional node icon */}\n {node.icon && (\n <span aria-hidden=\"true\" className=\"flex size-4 shrink-0 items-center justify-center\">\n {node.icon}\n </span>\n )}\n\n {/* label */}\n {isError ? (\n <span id={labelId} className=\"min-w-0 flex items-center gap-1 text-destructive\">\n <AlertCircle className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"truncate\">Failed to load</span>\n <button\n type=\"button\"\n aria-label=\"Retry loading children\"\n onClick={(e) => {\n e.stopPropagation();\n onRetry(node.id);\n }}\n className={cn(\n \"ms-1 flex items-center gap-0.5 rounded px-1 py-0.5 text-caption\",\n \"text-muted-foreground hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n )}\n >\n <RotateCcw className=\"size-3\" aria-hidden=\"true\" />\n Retry\n </button>\n </span>\n ) : (\n <span id={labelId} className=\"min-w-0 truncate\">\n {node.label}\n </span>\n )}\n\n {/* optional trailing accessory — a sibling of the label, never inside it\n and never part of the row's accessible name (#369); click/keydown/focus\n are stopped so it never selects, expands or steals the row's handling. */}\n {node.accessory ? (\n <span\n data-slot=\"tree-item-accessory\"\n className=\"ms-auto flex shrink-0 items-center gap-1\"\n onClick={(e) => e.stopPropagation()}\n // The tree's keyboard handler lives on the ROOT and preventDefaults\n // Enter/Space/arrows; without this an interactive accessory could\n // never be activated (its native click is cancelled) and the ROW\n // would be selected instead.\n onKeyDown={(e) => e.stopPropagation()}\n // React's onFocus is focusin (it bubbles), and the row's handler\n // calls setActiveId → el.focus(), which would yank focus straight\n // back out of an interactive accessory.\n onFocus={(e) => e.stopPropagation()}\n >\n {node.accessory}\n </span>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Lazy-loading skeleton row (child of a loading node in non-virtual path)\n// ---------------------------------------------------------------------------\n\nfunction LoadingRow({ level }: { level: number }) {\n const indentStyle = { paddingLeft: `${(level - 1) * 1}rem` };\n return (\n <div\n role=\"treeitem\"\n aria-label=\"Loading…\"\n aria-disabled=\"true\"\n tabIndex={-1}\n className=\"flex min-w-0 items-center gap-1.5 px-2 py-1.5\"\n style={indentStyle}\n >\n <span aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <Skeleton className=\"h-4 w-24\" />\n </div>\n );\n}\n\nfunction ErrorRow({ level, onRetry }: { level: number; onRetry: () => void }) {\n const indentStyle = { paddingLeft: `${(level - 1) * 1}rem` };\n return (\n <div\n role=\"treeitem\"\n aria-label=\"Failed to load\"\n aria-disabled=\"true\"\n tabIndex={-1}\n className=\"flex min-w-0 items-center gap-1.5 px-2 py-1.5 text-body text-destructive\"\n style={indentStyle}\n >\n <span aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n <AlertCircle className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span className=\"truncate\">Failed to load</span>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onRetry();\n }}\n className={cn(\n \"ms-1 flex items-center gap-0.5 rounded px-1 py-0.5 text-xs\",\n \"text-muted-foreground hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n )}\n >\n <RotateCcw className=\"size-3\" aria-hidden=\"true\" />\n Retry\n </button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// TreeItemRow — renders a single treeitem row (recursive, non-virtual path)\n// ---------------------------------------------------------------------------\n\ninterface TreeItemProps<T> {\n node: TreeNode<T>;\n level: number;\n setSize: number;\n posInSet: number;\n expandedIds: Set<string>;\n onExpandedChange: (ids: Set<string>) => void;\n selectionMode: \"single\" | \"multiple\" | \"none\";\n selectedIds: Set<string>;\n onSelectionChange: (ids: Set<string>) => void;\n checkboxes: boolean;\n surface: \"default\" | \"sidebar\";\n activeId: string | null;\n setActiveId: (id: string | null) => void;\n registerNodeRef: (id: string, el: HTMLElement | null) => void;\n lazyState: LazyState;\n onExpandLazy: (node: TreeNode<T>) => void;\n}\n\nfunction TreeItem<T>({\n node,\n level,\n setSize,\n posInSet,\n expandedIds,\n onExpandedChange,\n selectionMode,\n selectedIds,\n onSelectionChange,\n checkboxes,\n surface,\n activeId,\n setActiveId,\n registerNodeRef,\n lazyState,\n onExpandLazy,\n}: TreeItemProps<T>) {\n const hasLoadedChildren = !!node.children?.length;\n // A node is expandable if it has loaded children OR the hasChildren flag is set\n const expandable = hasLoadedChildren || !!node.hasChildren;\n const isExpanded = expandable && expandedIds.has(node.id);\n const isSelected = selectedIds.has(node.id);\n const isActive = activeId === node.id;\n const nodeLoadState: LoadState = lazyState[node.id] ?? \"idle\";\n const isLoading = nodeLoadState === \"loading\";\n const isError = nodeLoadState === \"error\";\n // See VirtualFlatRow: a ReactNode label must name the row via `aria-labelledby`\n // so the trailing accessory never joins the accessible name (#369).\n const labelId = useId();\n\n const toggleExpanded = () => {\n if (!expandable) return;\n const next = new Set(expandedIds);\n if (isExpanded) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n // If no loaded children yet, trigger lazy load\n if (!hasLoadedChildren && node.hasChildren) {\n onExpandLazy(node);\n }\n }\n onExpandedChange(next);\n };\n\n const handleSelect = () => {\n if (node.disabled || selectionMode === \"none\") return;\n setActiveId(node.id);\n if (selectionMode === \"single\") {\n onSelectionChange(new Set([node.id]));\n } else {\n const next = new Set(selectedIds);\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n onSelectionChange(next);\n }\n };\n\n const handleRowClick = () => {\n setActiveId(node.id);\n handleSelect();\n if (expandable) toggleExpanded();\n };\n\n const indentStyle = { paddingLeft: `${(level - 1) * 1}rem` };\n\n return (\n <li role=\"none\">\n {/* treeitem row */}\n <div\n role=\"treeitem\"\n aria-expanded={expandable ? isExpanded : undefined}\n aria-selected={selectionMode !== \"none\" && !checkboxes ? isSelected : undefined}\n aria-checked={checkboxes ? isSelected : undefined}\n aria-label={typeof node.label === \"string\" ? node.label : undefined}\n aria-labelledby={typeof node.label === \"string\" ? undefined : labelId}\n aria-level={level}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n aria-disabled={node.disabled ? true : undefined}\n aria-busy={isLoading ? true : undefined}\n tabIndex={isActive ? 0 : -1}\n data-tree-id={node.id}\n ref={(el) => registerNodeRef(node.id, el)}\n onClick={node.disabled ? undefined : handleRowClick}\n onFocus={() => setActiveId(node.id)}\n className={cn(\n \"flex min-w-0 cursor-pointer select-none items-center gap-1.5 rounded-md px-2 py-1.5 text-body outline-none\",\n \"transition-colors duration-fast ease-standard motion-reduce:transition-none\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background\",\n isSelected &&\n selectionMode !== \"none\" &&\n (surface === \"sidebar\"\n ? \"bg-sidebar-accent text-sidebar-accent-foreground font-medium\"\n : \"bg-accent text-accent-foreground font-medium\"),\n node.disabled && \"cursor-not-allowed opacity-50 pointer-events-none\",\n )}\n style={indentStyle}\n >\n {/* expand/collapse chevron */}\n {expandable ? (\n <span\n aria-hidden=\"true\"\n onClick={(e) => {\n e.stopPropagation();\n toggleExpanded();\n }}\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded transition-transform duration-fast ease-standard motion-reduce:transition-none\",\n isExpanded && !isLoading && \"rotate-90\",\n )}\n >\n {isLoading ? (\n <Spinner className=\"size-3.5\" label=\"Loading children\" />\n ) : (\n <ChevronRight className=\"size-3.5 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </span>\n ) : (\n <span aria-hidden=\"true\" className=\"size-4 shrink-0\" />\n )}\n\n {/* optional checkbox for multi-select */}\n {checkboxes && selectionMode === \"multiple\" && (\n <Checkbox\n checked={isSelected}\n disabled={node.disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n onClick={(e) => {\n e.stopPropagation();\n handleSelect();\n }}\n className=\"shrink-0\"\n />\n )}\n\n {/* optional node icon */}\n {node.icon && (\n <span aria-hidden=\"true\" className=\"flex size-4 shrink-0 items-center justify-center\">\n {node.icon}\n </span>\n )}\n\n {/* label */}\n <span id={labelId} className=\"min-w-0 truncate\">\n {node.label}\n </span>\n\n {/* optional trailing accessory — a sibling of the label, never inside\n it and never part of the row's accessible name (#369);\n click/keydown/focus are stopped at the accessory. */}\n {node.accessory ? (\n <span\n data-slot=\"tree-item-accessory\"\n className=\"ms-auto flex shrink-0 items-center gap-1\"\n onClick={(e) => e.stopPropagation()}\n // See VirtualFlatRow: the tree's root keydown handler preventDefaults\n // Enter/Space/arrows, and the row's onFocus (focusin, bubbling) calls\n // setActiveId → el.focus(). Both must stop at the accessory or\n // interactive content in this slot is unusable.\n onKeyDown={(e) => e.stopPropagation()}\n onFocus={(e) => e.stopPropagation()}\n >\n {node.accessory}\n </span>\n ) : null}\n </div>\n\n {/* children group */}\n {isExpanded && (\n <ul role=\"group\" className=\"list-none m-0 p-0\">\n {isLoading ? (\n <li role=\"none\">\n <LoadingRow level={level + 1} />\n </li>\n ) : isError ? (\n <li role=\"none\">\n <ErrorRow level={level + 1} onRetry={() => onExpandLazy(node)} />\n </li>\n ) : (\n node.children?.map((child, i) => (\n <TreeItem\n key={child.id}\n node={child}\n level={level + 1}\n setSize={node.children!.length}\n posInSet={i + 1}\n expandedIds={expandedIds}\n onExpandedChange={onExpandedChange}\n selectionMode={selectionMode}\n selectedIds={selectedIds}\n onSelectionChange={onSelectionChange}\n checkboxes={checkboxes}\n surface={surface}\n activeId={activeId}\n setActiveId={setActiveId}\n registerNodeRef={registerNodeRef}\n lazyState={lazyState}\n onExpandLazy={onExpandLazy}\n />\n ))\n )}\n </ul>\n )}\n </li>\n );\n}\n\n// ---------------------------------------------------------------------------\n// flattenVisibleWithMeta — for the virtual path\n// ---------------------------------------------------------------------------\n\nfunction flattenVisibleWithMeta<T>(\n nodes: TreeNode<T>[],\n expandedIds: Set<string>,\n lazyState: LazyState,\n level = 1,\n parentSetSize?: number,\n): FlatRow<T>[] {\n const result: FlatRow<T>[] = [];\n const setSize = parentSetSize ?? nodes.length;\n nodes.forEach((node, i) => {\n result.push({\n node,\n level,\n setSize,\n posInSet: i + 1,\n });\n const hasLoadedChildren = !!node.children?.length;\n const isExpandable = hasLoadedChildren || !!node.hasChildren;\n if (isExpandable && expandedIds.has(node.id)) {\n const nodeLoad = lazyState[node.id];\n if (nodeLoad === \"loading\" || nodeLoad === \"error\") {\n // placeholder row represented by a synthetic \"loading/error\" node\n // We don't push a row here — the loading/error state is shown via\n // aria-busy on the parent treeitem row (virtual path inline indicators)\n } else if (hasLoadedChildren) {\n const childRows = flattenVisibleWithMeta(\n node.children!,\n expandedIds,\n lazyState,\n level + 1,\n node.children!.length,\n );\n result.push(...childRows);\n }\n }\n });\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Tree — root component\n// ---------------------------------------------------------------------------\n\n/**\n * A fully accessible tree view with roving tabindex keyboard navigation,\n * single/multiple selection, expand/collapse, checkboxes, and type-ahead.\n *\n * Set `virtualize` to window large trees (>50 visible rows). Set `loadChildren`\n * to lazily fetch children on demand when a node has `hasChildren: true`.\n */\n/** Ancestor ids (root → parent) of `id` within the loaded tree, or `null` if absent. */\nfunction findNodePath(nodes: TreeNode[], id: string, trail: string[] = []): string[] | null {\n for (const n of nodes) {\n if (n.id === id) return trail;\n if (n.children?.length) {\n const found = findNodePath(n.children, id, [...trail, n.id]);\n if (found) return found;\n }\n }\n return null;\n}\n\n/** The node with `id` within the loaded tree, or `null`. */\nfunction findNodeById(nodes: TreeNode[], id: string): TreeNode | null {\n for (const n of nodes) {\n if (n.id === id) return n;\n if (n.children?.length) {\n const found = findNodeById(n.children, id);\n if (found) return found;\n }\n }\n return null;\n}\n\nexport const Tree = forwardRef<HTMLDivElement, TreeProps>(function Tree(\n {\n nodes: nodesProp,\n expandedIds: expandedIdsProp,\n defaultExpandedIds,\n onExpandedChange,\n selectionMode = \"single\",\n selectedIds: selectedIdsProp,\n defaultSelectedIds,\n onSelectionChange,\n checkboxes = false,\n virtualize = false,\n estimateRowHeight = 32,\n overscan = 8,\n maxHeight,\n scrollToId,\n scrollSelectionIntoView = false,\n loadChildren,\n surface = \"default\",\n className,\n ...props\n },\n ref,\n) {\n // Internal mutable tree (supports lazy-loaded children merge)\n const [nodes, setNodes] = useState<TreeNode[]>(() => nodesProp as TreeNode[]);\n\n // Keep internal tree in sync with nodesProp if it changes externally\n useEffect(() => {\n setNodes(nodesProp as TreeNode[]);\n }, [nodesProp]);\n\n const [expandedIds, setExpandedIds] = useControllableSet(\n expandedIdsProp,\n defaultExpandedIds,\n onExpandedChange,\n );\n const [selectedIds, setSelectedIds] = useControllableSet(\n selectedIdsProp,\n defaultSelectedIds,\n onSelectionChange,\n );\n\n // Lazy-load state per node id\n const [lazyState, setLazyState] = useState<LazyState>({});\n\n // Scroll container ref for virtualizer\n const scrollRef = useRef<HTMLDivElement>(null);\n\n // Pending focus id — used when the target row isn't yet mounted (virtual path)\n const pendingFocusIdRef = useRef<string | null>(null);\n\n // ---------------------------------------------------------------------------\n // Lazy load handler\n // ---------------------------------------------------------------------------\n\n const handleExpandLazy = useCallback(\n async (node: TreeNode) => {\n if (!loadChildren) return;\n if (lazyState[node.id] === \"loading\") return;\n\n setLazyState((prev) => ({ ...prev, [node.id]: \"loading\" }));\n try {\n const children = await loadChildren(node as TreeNode<unknown>);\n setNodes((prev) => mergeChildren(prev, node.id, children as TreeNode[]));\n setLazyState((prev) => {\n const next = { ...prev };\n delete next[node.id];\n return next;\n });\n } catch {\n setLazyState((prev) => ({ ...prev, [node.id]: \"error\" }));\n }\n },\n [loadChildren, lazyState],\n );\n\n // ---------------------------------------------------------------------------\n // Flattened visible rows (for virtualized path and keyboard hook)\n // ---------------------------------------------------------------------------\n\n const flatRows = flattenVisibleWithMeta(nodes, expandedIds, lazyState);\n const flatNodeIds = flatRows.map((r) => r.node.id);\n\n // ---------------------------------------------------------------------------\n // Keyboard hook\n // ---------------------------------------------------------------------------\n\n // For the virtual path: when navigating to a node whose DOM is not mounted,\n // we need to scroll to it first and then focus when it mounts.\n // We achieve this by passing a scrollToIndex callback to the keyboard hook.\n\n const virtualizerRef = useRef<Virtualizer<HTMLDivElement, Element> | null>(null);\n\n const scrollToVirtualIndex = useCallback((index: number) => {\n virtualizerRef.current?.scrollToIndex(index, { align: \"auto\" });\n }, []);\n\n const { activeId, setActiveId, registerNodeRef, onKeyDown } = useTreeKeyboard({\n nodes,\n expandedIds,\n onExpandedChange: setExpandedIds,\n selectionMode,\n selectedIds,\n onSelectionChange: setSelectedIds,\n // Virtualization-aware extras\n virtualize,\n flatNodeIds,\n pendingFocusIdRef,\n scrollToVirtualIndex,\n });\n\n // ---------------------------------------------------------------------------\n // Handle expand/collapse for virtual path (needs to call lazy loader)\n // ---------------------------------------------------------------------------\n\n const handleToggleExpand = useCallback(\n (nodeId: string) => {\n const flatRow = flatRows.find((r) => r.node.id === nodeId);\n if (!flatRow) return;\n const node = flatRow.node;\n const hasLoadedChildren = !!node.children?.length;\n const next = new Set(expandedIds);\n if (expandedIds.has(nodeId)) {\n next.delete(nodeId);\n } else {\n next.add(nodeId);\n if (!hasLoadedChildren && node.hasChildren && loadChildren) {\n handleExpandLazy(node);\n }\n }\n setExpandedIds(next);\n },\n [expandedIds, flatRows, setExpandedIds, loadChildren, handleExpandLazy],\n );\n\n const handleSelectVirtual = useCallback(\n (nodeId: string) => {\n const flatRow = flatRows.find((r) => r.node.id === nodeId);\n if (!flatRow) return;\n const node = flatRow.node;\n if (node.disabled || selectionMode === \"none\") return;\n if (selectionMode === \"single\") {\n setSelectedIds(new Set([nodeId]));\n } else {\n const next = new Set(selectedIds);\n if (next.has(nodeId)) {\n next.delete(nodeId);\n } else {\n next.add(nodeId);\n }\n setSelectedIds(next);\n }\n },\n [flatRows, selectionMode, selectedIds, setSelectedIds],\n );\n\n // ---------------------------------------------------------------------------\n // Layout effect to flush pending focus once a row mounts (virtual path)\n // ---------------------------------------------------------------------------\n\n // This runs after every render; if pendingFocusIdRef has an id, try to focus it.\n // The registerNodeRef callback will have stored the element if it mounted.\n // We use useLayoutEffect so the DOM is painted before we try to focus.\n const nodeRefsForFlush = useRef<Map<string, HTMLElement>>(new Map());\n\n const registerAndFlush = useCallback(\n (id: string, el: HTMLElement | null) => {\n registerNodeRef(id, el);\n if (el) {\n nodeRefsForFlush.current.set(id, el);\n if (pendingFocusIdRef.current === id) {\n pendingFocusIdRef.current = null;\n el.focus();\n }\n } else {\n nodeRefsForFlush.current.delete(id);\n }\n },\n [registerNodeRef],\n );\n\n // ---------------------------------------------------------------------------\n // Virtualizer (only created in virtual mode)\n // ---------------------------------------------------------------------------\n\n const virtualizer = useVirtualizer({\n count: flatRows.length,\n getScrollElement: () => (virtualize ? scrollRef.current : null),\n estimateSize: () => estimateRowHeight,\n overscan,\n enabled: virtualize,\n });\n\n // Keep ref so keyboard handler can call scrollToIndex\n useEffect(() => {\n if (virtualize) {\n virtualizerRef.current = virtualizer;\n }\n });\n\n // ---------------------------------------------------------------------------\n // Reveal-into-view (scrollToId / scrollSelectionIntoView)\n // ---------------------------------------------------------------------------\n\n // Set while a requested node isn't yet a visible row (its ancestors are still\n // expanding / lazy-loading); the retry effect finishes once the rows change.\n const pendingRevealIdRef = useRef<string | null>(null);\n const prevSelectedRef = useRef<Set<string>>(selectedIds);\n const prevScrollToIdRef = useRef<string | undefined>(undefined);\n\n // Scroll `id` into view if it is currently a visible row. Virtual mode drives\n // the virtualizer (the row may be unmounted); non-virtual uses the mounted DOM\n // node (registered via registerAndFlush in both paths).\n const scrollNodeIntoView = useCallback(\n (id: string): boolean => {\n const index = flatNodeIds.indexOf(id);\n if (index < 0) return false;\n if (virtualize) {\n virtualizerRef.current?.scrollToIndex(index, { align: \"center\" });\n } else {\n // `?.` on scrollIntoView too — jsdom doesn't implement it (browser-only).\n nodeRefsForFlush.current.get(id)?.scrollIntoView?.({ block: \"center\" });\n }\n return true;\n },\n [flatNodeIds, virtualize],\n );\n\n // Reveal `id`: scroll it now if visible, else expand its (loaded) ancestors and\n // kick their lazy loaders so it becomes a row — the retry effect finishes the job.\n const revealNode = useCallback(\n (id: string) => {\n if (scrollNodeIntoView(id)) {\n pendingRevealIdRef.current = null;\n return;\n }\n pendingRevealIdRef.current = id;\n const path = findNodePath(nodes, id);\n if (!path || path.length === 0) return; // unknown / not yet loaded — best effort\n const next = new Set(expandedIds);\n path.forEach((ancestorId) => next.add(ancestorId));\n setExpandedIds(next);\n if (loadChildren) {\n for (const ancestorId of path) {\n const anc = findNodeById(nodes, ancestorId);\n if (anc && anc.hasChildren && !anc.children?.length) void handleExpandLazy(anc);\n }\n }\n },\n [scrollNodeIntoView, nodes, expandedIds, setExpandedIds, loadChildren, handleExpandLazy],\n );\n\n // Latest revealNode so the trigger effect fires on target CHANGE only (without\n // re-running when flatNodeIds / expandedIds churn each render).\n const revealNodeRef = useRef(revealNode);\n revealNodeRef.current = revealNode;\n\n // Trigger: reveal when `scrollToId` changes; else (scrollSelectionIntoView) when\n // the selection gains a node. `scrollToId` wins.\n useEffect(() => {\n const scrollIdChanged = scrollToId !== prevScrollToIdRef.current;\n const selectionChanged = selectedIds !== prevSelectedRef.current;\n const prevSel = prevSelectedRef.current;\n prevScrollToIdRef.current = scrollToId;\n prevSelectedRef.current = selectedIds;\n\n if (scrollToId != null && scrollIdChanged) {\n revealNodeRef.current(scrollToId);\n } else if (scrollToId == null && scrollSelectionIntoView && selectionChanged) {\n const added = [...selectedIds].find((sid) => !prevSel.has(sid));\n const target = added ?? (selectedIds.size > 0 ? [...selectedIds][0] : undefined);\n if (target != null) revealNodeRef.current(target);\n }\n }, [scrollToId, scrollSelectionIntoView, selectedIds]);\n\n // Retry a pending reveal after the rows change (ancestors expanded / lazy data\n // arrived) — scroll once the node materialises, then clear.\n useEffect(() => {\n const id = pendingRevealIdRef.current;\n if (id != null && scrollNodeIntoView(id)) {\n pendingRevealIdRef.current = null;\n }\n }, [scrollNodeIntoView]);\n\n // ---------------------------------------------------------------------------\n // Render: NON-virtual path (backward compatible nested-group DOM)\n // ---------------------------------------------------------------------------\n\n if (!virtualize) {\n return (\n <div\n ref={ref}\n role=\"tree\"\n aria-multiselectable={selectionMode === \"multiple\" ? true : undefined}\n onKeyDown={onKeyDown}\n className={cn(\"w-full select-none\", className)}\n {...props}\n >\n <ul role=\"none\" className=\"m-0 list-none p-0\">\n {nodes.map((node, i) => (\n <TreeItem\n key={node.id}\n node={node}\n level={1}\n setSize={nodes.length}\n posInSet={i + 1}\n expandedIds={expandedIds}\n onExpandedChange={setExpandedIds}\n selectionMode={selectionMode}\n selectedIds={selectedIds}\n onSelectionChange={setSelectedIds}\n checkboxes={checkboxes}\n surface={surface}\n activeId={activeId}\n setActiveId={setActiveId}\n // registerAndFlush (not raw registerNodeRef) so nodeRefsForFlush is\n // populated in the non-virtual path too — lets scrollToId reveal a\n // below-the-fold node. pendingFocusIdRef is virtual-only, so the\n // focus-flush branch never fires here: keyboard behavior is unchanged.\n registerNodeRef={registerAndFlush}\n lazyState={lazyState}\n onExpandLazy={handleExpandLazy}\n />\n ))}\n </ul>\n </div>\n );\n }\n\n // ---------------------------------------------------------------------------\n // Render: VIRTUAL path (flat DOM, windowed rows)\n // ---------------------------------------------------------------------------\n\n const virtualItems = virtualizer.getVirtualItems();\n\n const scrollStyle: React.CSSProperties = maxHeight\n ? { maxHeight, overflowY: \"auto\" }\n : { overflowY: \"auto\" };\n\n return (\n <div\n ref={ref}\n role=\"tree\"\n aria-multiselectable={selectionMode === \"multiple\" ? true : undefined}\n onKeyDown={onKeyDown}\n className={cn(\"w-full select-none\", className)}\n {...props}\n >\n {/* Scroll viewport — role=\"presentation\" so the tree still OWNS the\n treeitems (windowing wrappers are skipped in the a11y tree, keeping\n aria-required-children valid). */}\n <div ref={scrollRef} role=\"presentation\" style={scrollStyle} className=\"outline-none\">\n {/* Total-size spacer — gives the scroll container its full height */}\n <div\n role=\"presentation\"\n style={{ height: virtualizer.getTotalSize(), position: \"relative\" }}\n >\n {virtualItems.map((virtualRow) => {\n const row = flatRows[virtualRow.index];\n if (!row) return null;\n const { node } = row;\n const hasLoadedChildren = !!node.children?.length;\n const expandable = hasLoadedChildren || !!node.hasChildren;\n const isExpanded = expandable && expandedIds.has(node.id);\n const isSelected = selectedIds.has(node.id);\n const isActive = activeId === node.id;\n const nodeLoad: LoadState = lazyState[node.id] ?? \"idle\";\n\n return (\n <div\n key={virtualRow.key}\n role=\"presentation\"\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n >\n <VirtualFlatRow\n row={row}\n isExpanded={isExpanded}\n isSelected={isSelected}\n isActive={isActive}\n lazyState={nodeLoad}\n expandable={expandable}\n selectionMode={selectionMode}\n checkboxes={checkboxes}\n surface={surface}\n onToggleExpand={handleToggleExpand}\n onSelect={handleSelectVirtual}\n onRetry={() => handleExpandLazy(node)}\n registerNodeRef={registerAndFlush}\n setActiveId={setActiveId}\n />\n </div>\n );\n })}\n </div>\n </div>\n </div>\n );\n}) as <T = unknown>(\n props: TreeProps<T> & { ref?: React.Ref<HTMLDivElement> },\n) => React.ReactElement | null;\n","\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { TreeNode } from \"./tree\";\n\n/**\n * Flattens the visible (expanded) tree into an ordered list of node ids.\n * Nodes whose ancestors are collapsed are excluded.\n */\nexport function flattenVisible<T>(nodes: TreeNode<T>[], expandedIds: Set<string>): string[] {\n const result: string[] = [];\n function walk(list: TreeNode<T>[]) {\n for (const node of list) {\n result.push(node.id);\n if ((node.children?.length || node.hasChildren) && expandedIds.has(node.id)) {\n if (node.children?.length) walk(node.children);\n }\n }\n }\n walk(nodes);\n return result;\n}\n\n/**\n * Builds a lookup map: node id → parent id (or null for roots).\n */\nfunction buildParentMap<T>(\n nodes: TreeNode<T>[],\n parentId: string | null = null,\n map: Map<string, string | null> = new Map(),\n): Map<string, string | null> {\n for (const node of nodes) {\n map.set(node.id, parentId);\n if (node.children?.length) {\n buildParentMap(node.children, node.id, map);\n }\n }\n return map;\n}\n\n/**\n * Finds a node by id in the tree (depth-first).\n */\nexport function findNode<T>(nodes: TreeNode<T>[], id: string): TreeNode<T> | undefined {\n for (const node of nodes) {\n if (node.id === id) return node;\n if (node.children?.length) {\n const found = findNode(node.children, id);\n if (found) return found;\n }\n }\n return undefined;\n}\n\nexport interface UseTreeKeyboardOptions<T> {\n nodes: TreeNode<T>[];\n expandedIds: Set<string>;\n onExpandedChange: (ids: Set<string>) => void;\n selectionMode: \"single\" | \"multiple\" | \"none\";\n selectedIds: Set<string>;\n onSelectionChange: (ids: Set<string>) => void;\n /**\n * When `true`, the tree uses windowed rendering. Focus navigation must\n * scroll the virtualizer before focusing an unmounted row.\n */\n virtualize?: boolean;\n /**\n * Ordered list of visible node ids in the virtual flat list. Provided by\n * the Tree when `virtualize` is true so the keyboard hook can map an id to\n * a virtual index without re-flattening.\n */\n flatNodeIds?: string[];\n /**\n * Ref that the keyboard hook writes a node id into when it needs to focus a\n * row that is currently scrolled out of view. The Tree's `registerAndFlush`\n * callback reads this ref on every ref registration and focuses the element\n * once it mounts.\n */\n pendingFocusIdRef?: React.MutableRefObject<string | null>;\n /**\n * Called when the keyboard hook wants to bring an index into view before\n * focusing it. Only called in virtual mode.\n */\n scrollToVirtualIndex?: (index: number) => void;\n}\n\nexport interface UseTreeKeyboardResult {\n activeId: string | null;\n setActiveId: (id: string | null) => void;\n /** ref callback — register each tree item element keyed by node id */\n registerNodeRef: (id: string, el: HTMLElement | null) => void;\n /** onKeyDown handler to attach to the root tree div */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nexport function useTreeKeyboard<T>(options: UseTreeKeyboardOptions<T>): UseTreeKeyboardResult {\n const {\n nodes,\n expandedIds,\n onExpandedChange,\n selectionMode,\n selectedIds,\n onSelectionChange,\n virtualize = false,\n flatNodeIds,\n pendingFocusIdRef,\n scrollToVirtualIndex,\n } = options;\n\n // The currently \"roving\" active item id\n const [activeId, setActiveIdState] = useState<string | null>(() => {\n // default to first visible node\n const visible = flattenVisible(nodes, expandedIds);\n return visible[0] ?? null;\n });\n\n // Map from node id → DOM element reference\n const nodeRefs = useRef<Map<string, HTMLElement>>(new Map());\n\n const registerNodeRef = useCallback((id: string, el: HTMLElement | null) => {\n if (el) {\n nodeRefs.current.set(id, el);\n } else {\n nodeRefs.current.delete(id);\n }\n }, []);\n\n // Typeahead buffer\n const typeaheadBuffer = useRef<string>(\"\");\n const typeaheadTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Clear any pending typeahead timer on unmount.\n useEffect(\n () => () => {\n if (typeaheadTimer.current) clearTimeout(typeaheadTimer.current);\n },\n [],\n );\n\n /**\n * Focus the element for `id`. In virtual mode, if the element isn't\n * mounted yet, record it as pending and scroll the virtualizer so the row\n * enters the render window; the Tree's `registerAndFlush` will focus it\n * once the ref fires.\n */\n const setActiveId = useCallback(\n (id: string | null) => {\n setActiveIdState(id);\n if (!id) return;\n\n const el = nodeRefs.current.get(id);\n if (el) {\n el.focus();\n return;\n }\n\n // Element not mounted — happens when it's scrolled out of the virtual window.\n if (virtualize && scrollToVirtualIndex && pendingFocusIdRef) {\n const ids = flatNodeIds ?? [];\n const index = ids.indexOf(id);\n if (index >= 0) {\n pendingFocusIdRef.current = id;\n scrollToVirtualIndex(index);\n // The Tree's registerAndFlush will call el.focus() once the row mounts.\n }\n }\n },\n [virtualize, flatNodeIds, pendingFocusIdRef, scrollToVirtualIndex],\n );\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n if (!activeId) return;\n\n // In virtual mode use the pre-computed flat list so we don't re-flatten\n const visible = virtualize && flatNodeIds ? flatNodeIds : flattenVisible(nodes, expandedIds);\n const currentIndex = visible.indexOf(activeId);\n const currentNode = findNode(nodes, activeId);\n const parentMap = buildParentMap(nodes);\n\n const moveTo = (id: string) => {\n e.preventDefault();\n setActiveId(id);\n };\n\n const selectNode = (id: string) => {\n if (selectionMode === \"none\") return;\n const node = findNode(nodes, id);\n if (node?.disabled) return;\n if (selectionMode === \"single\") {\n onSelectionChange(new Set([id]));\n } else {\n const next = new Set(selectedIds);\n if (next.has(id)) {\n next.delete(id);\n } else {\n next.add(id);\n }\n onSelectionChange(next);\n }\n };\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n const next = visible[currentIndex + 1];\n if (next) moveTo(next);\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n const prev = visible[currentIndex - 1];\n if (prev) moveTo(prev);\n break;\n }\n case \"ArrowRight\": {\n e.preventDefault();\n if (!currentNode) break;\n const expandable = !!(currentNode.children?.length || currentNode.hasChildren);\n if (expandable && !expandedIds.has(activeId)) {\n // expand\n const next = new Set(expandedIds);\n next.add(activeId);\n onExpandedChange(next);\n } else if (expandable && expandedIds.has(activeId)) {\n // move to first child (only if loaded)\n const firstChild = currentNode.children?.[0];\n if (firstChild) moveTo(firstChild.id);\n }\n // leaf: do nothing\n break;\n }\n case \"ArrowLeft\": {\n e.preventDefault();\n if (!currentNode) break;\n const expandable = !!(currentNode.children?.length || currentNode.hasChildren);\n if (expandable && expandedIds.has(activeId)) {\n // collapse\n const next = new Set(expandedIds);\n next.delete(activeId);\n onExpandedChange(next);\n } else {\n // move to parent\n const parentId = parentMap.get(activeId) ?? null;\n if (parentId) moveTo(parentId);\n }\n break;\n }\n case \"Home\": {\n e.preventDefault();\n const first = visible[0];\n if (first) moveTo(first);\n break;\n }\n case \"End\": {\n e.preventDefault();\n const last = visible[visible.length - 1];\n if (last) moveTo(last);\n break;\n }\n case \"Enter\":\n case \" \": {\n e.preventDefault();\n selectNode(activeId);\n break;\n }\n default: {\n // typeahead — single printable characters\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n const char = e.key.toLowerCase();\n typeaheadBuffer.current += char;\n\n if (typeaheadTimer.current) clearTimeout(typeaheadTimer.current);\n typeaheadTimer.current = setTimeout(() => {\n typeaheadBuffer.current = \"\";\n }, 500);\n\n const prefix = typeaheadBuffer.current;\n // find the next visible node (after current) whose label starts with prefix\n const searchList = [\n ...visible.slice(currentIndex + 1),\n ...visible.slice(0, currentIndex + 1),\n ];\n for (const id of searchList) {\n const node = findNode(nodes, id);\n if (!node) continue;\n // only string labels are searchable\n if (typeof node.label !== \"string\") continue;\n if (node.label.toLowerCase().startsWith(prefix)) {\n moveTo(id);\n break;\n }\n }\n }\n break;\n }\n }\n },\n [\n activeId,\n nodes,\n expandedIds,\n onExpandedChange,\n selectionMode,\n selectedIds,\n onSelectionChange,\n setActiveId,\n virtualize,\n flatNodeIds,\n ],\n );\n\n return { activeId, setActiveId, registerNodeRef, onKeyDown };\n}\n","// a2ui.exposed: yes\n\"use client\";\n\nimport { forwardRef, useId, useState, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { ChevronsUpDown } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { Button } from \"../button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { Tree, type TreeNode } from \"../tree\";\n\nexport interface TreeSelectProps<T = unknown> extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\" | \"onChange\"\n> {\n nodes: TreeNode<T>[];\n /** Controlled value — `string` in single mode, `string[]` in multiple mode. */\n value?: string | string[];\n /** Uncontrolled initial value. */\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[]) => void;\n /** Allow selecting multiple nodes (checkbox tree). Default false. */\n multiple?: boolean;\n placeholder?: string;\n className?: string;\n}\n\nfunction toArray(v: string | string[] | undefined): string[] {\n if (v === undefined) return [];\n if (Array.isArray(v)) return v;\n return v === \"\" ? [] : [v];\n}\n\nfunction findLabel<T>(nodes: TreeNode<T>[], id: string): ReactNode | undefined {\n for (const node of nodes) {\n if (node.id === id) return node.label;\n if (node.children?.length) {\n const found = findLabel(node.children, id);\n if (found !== undefined) return found;\n }\n }\n return undefined;\n}\n\n/**\n * A select whose options are a hierarchical {@link Tree}. Single or multiple\n * selection; composes `Tree` for all keyboard/SR behaviour.\n */\nexport const TreeSelect = forwardRef<HTMLButtonElement, TreeSelectProps>(function TreeSelect(\n {\n nodes,\n value,\n defaultValue,\n onValueChange,\n multiple = false,\n placeholder = \"Select…\",\n className,\n ...props\n },\n ref,\n) {\n const [open, setOpen] = useState(false);\n const treeId = useId();\n const isControlled = value !== undefined;\n const [internal, setInternal] = useState<string[]>(() => toArray(defaultValue));\n const selected = isControlled ? toArray(value) : internal;\n\n const emit = (next: string[]) => {\n if (!isControlled) setInternal(next);\n onValueChange?.(multiple ? next : (next[0] ?? \"\"));\n };\n\n const handleSelectionChange = (ids: string[]) => {\n emit(ids);\n if (!multiple) setOpen(false);\n };\n\n const labels = selected.map((id) => ({ id, label: findLabel(nodes, id) ?? id }));\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-haspopup=\"tree\"\n aria-expanded={open}\n aria-controls={treeId}\n className={cn(\"h-auto min-h-9 w-64 justify-between font-normal\", className)}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1 text-start\">\n {labels.length === 0 ? (\n <span className=\"text-muted-foreground\">{placeholder}</span>\n ) : multiple ? (\n <>\n {labels.slice(0, 2).map((l) => (\n <Badge\n key={l.id}\n variant=\"secondary\"\n className=\"max-w-[10rem] truncate border-border\"\n >\n {l.label}\n </Badge>\n ))}\n {labels.length > 2 ? (\n <Badge variant=\"secondary\" aria-label={`and ${labels.length - 2} more selected`}>\n +{labels.length - 2}\n </Badge>\n ) : null}\n </>\n ) : (\n <span className=\"truncate\">{labels[0]?.label}</span>\n )}\n </span>\n <ChevronsUpDown className=\"ms-2 size-4 shrink-0 opacity-50\" aria-hidden=\"true\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-64 p-1\" align=\"start\">\n <Tree\n id={treeId}\n nodes={nodes}\n selectionMode={multiple ? \"multiple\" : \"single\"}\n checkboxes={multiple}\n selectedIds={selected}\n onSelectionChange={handleSelectionChange}\n defaultExpandedIds={nodes.map((n) => n.id)}\n className=\"max-h-72 overflow-auto\"\n />\n </PopoverContent>\n </Popover>\n );\n}) as <T = unknown>(\n props: TreeSelectProps<T> & { ref?: React.Ref<HTMLButtonElement> },\n) => React.ReactElement | null;\n","\"use client\";\n\n/**\n * ViewToolbar — the GRAMMAR for the one row that sits above every list, table\n * or board view (#331).\n *\n * The failure this fixes was ambiguity, not capability: with no named row\n * contract, ~40 routes of one consuming app grew 6 filter-chip idioms, 5\n * result-count renderings and ~11px of control-height scatter in a single filter\n * row. So the deliverable is a small, closed vocabulary — not a configurable\n * widget:\n *\n * ⓘ info │ ── left cluster: status · filters · count ── │ actions\n *\n * - `ViewToolbar` is the row shell (slots only — it renders no view semantics).\n * - `ViewToolbarFilters` is the ONE home for active-filter chips + \"clear all\".\n * - `FilterChip` is the ONE removable chip (label-in-value, whole chip removes).\n * - `ResultCount` is the ONE count (`tabular-nums`, \"N of M\" when filtered).\n *\n * Deliberate non-decisions, so a reader doesn't mistake them for oversights:\n *\n * - **No `cva`.** None of the four parts has a second visual axis today, and the\n * rules forbid dead variants. A sticky/bounded bar is a caller `className`\n * recipe (documented in `Docs/View Toolbar Contract`), not a variant.\n * - **No `role=\"toolbar\"` on the root.** That role promises roving-tabindex\n * arrow-key navigation, which this row does not implement; claiming it would\n * mislead assistive tech. Every control is an ordinary tab stop instead, and\n * the one region that benefits from a name — the filter set — carries\n * `role=\"group\"` + an accessible name.\n * - **The row wraps; it never scrolls or clips.** A hard fixed height would put\n * the action cluster out of reach at narrow widths (AC), so the row keeps a\n * `min-h-9` floor (== `Button` default height, so single-line rows are\n * consistent) and wraps beyond it. The action cluster wraps INTERNALLY too —\n * a `shrink-0` cluster whose buttons cannot wrap simply overflows the row's\n * box once the row is narrower than the buttons are wide (measured: it\n * escaped by ~8px at a 320px viewport), which is the very thing the AC\n * forbids. It stays right-aligned (`justify-end`) on every line.\n *\n * Relationship to neighbours: `PageShell`'s generic `header` slot is where this\n * row goes on a page (#367's toolbar header variant should PLACE a\n * `<ViewToolbar>`, not invent a second row concept). `@elabs-ai/components-data`'s `FilterBar`\n * stays the DataTable-scoped toolbar render-prop row; it could later be\n * recomposed on this shell, but that is a separate change.\n */\nimport { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Info, X } from \"lucide-react\";\nimport { badgeVariants } from \"../badge/badge\";\nimport { Button } from \"../button\";\nimport { Skeleton } from \"../skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../tooltip\";\nimport { useLocale } from \"../locale-provider\";\nimport { cn } from \"../../lib/cn\";\n\n// ---------------------------------------------------------------------------\n// ViewToolbar (the row shell)\n// ---------------------------------------------------------------------------\n\nexport interface ViewToolbarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * What this view is, as a tooltip on an ⓘ trigger at the start of the row —\n * so a view does not need an in-page `<h1>` + paragraph block just to explain\n * itself. Omit it when the surrounding page already says what the view is.\n *\n * **Pointer/keyboard only.** A Radix tooltip opens on hover and on keyboard\n * focus but deliberately NOT on tap (and Radix suppresses the focus-open when\n * focus arrived from a pointer), so on a touch device this text is\n * unreachable. Treat `info` as progressive enhancement: never put something a\n * phone user cannot do without in it. See `Docs/View Toolbar Contract`.\n */\n info?: ReactNode;\n /** Left cluster — status/context, `ViewToolbarFilters`, `ResultCount`. */\n children?: ReactNode;\n /** Right cluster — the view's actions. Stays reachable at every width. */\n actions?: ReactNode;\n}\n\nexport const ViewToolbar = forwardRef<HTMLDivElement, ViewToolbarProps>(function ViewToolbar(\n { info, children, actions, className, ...props },\n ref,\n) {\n const { t } = useLocale();\n\n return (\n <div\n ref={ref}\n data-slot=\"view-toolbar\"\n className={cn(\"flex min-h-9 w-full flex-wrap items-center gap-x-3 gap-y-2\", className)}\n {...props}\n >\n {info ? (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n data-slot=\"view-toolbar-info\"\n aria-label={t(\"ui.viewToolbar.about\")}\n className=\"shrink-0 text-muted-foreground hover:text-foreground\"\n >\n <Info aria-hidden=\"true\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-xs text-pretty\">{info}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : null}\n\n {/*\n * Always rendered, even when empty: it owns the free space (`flex-1`), so\n * the actions cluster stays anchored to the row's end, and it is a stable\n * `data-slot` seam for consumers/tests.\n *\n * `basis-64` when it HAS content is what makes the narrow-width degrade\n * work: with a 0 basis the left cluster would be squeezed to a few pixels\n * so the actions could stay on line 1, shredding the chips. With a 16rem\n * basis the two clusters stack instead. An EMPTY cluster keeps the 0 basis\n * so it never forces a pointless wrap.\n */}\n <div\n data-slot=\"view-toolbar-content\"\n className={cn(\n \"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2\",\n children ? \"basis-64\" : \"basis-0\",\n )}\n >\n {children}\n </div>\n\n {actions ? (\n <div\n data-slot=\"view-toolbar-actions\"\n className=\"ms-auto flex min-w-0 flex-wrap items-center justify-end gap-2\"\n >\n {actions}\n </div>\n ) : null}\n </div>\n );\n});\n\n// ---------------------------------------------------------------------------\n// ViewToolbarFilters (the active-filter region)\n// ---------------------------------------------------------------------------\n\nexport interface ViewToolbarFiltersProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Clear every active filter. Supplying it renders the \"clear all\" affordance\n * at the end of the chip run; omit it when a view has no bulk reset.\n */\n onClearAll?: () => void;\n}\n\n/**\n * The chip run. Render it ONLY when at least one filter is active — the\n * \"no filters applied\" state is the region's ABSENCE, not an empty box.\n *\n * Runs at chip height (24px) so the whole group reads as one control rung; the\n * `actions` cluster runs at button height. That split is the fix for the\n * control-height scatter #331 measured.\n */\nexport const ViewToolbarFilters = forwardRef<HTMLDivElement, ViewToolbarFiltersProps>(\n function ViewToolbarFilters({ onClearAll, children, className, ...props }, ref) {\n const { t } = useLocale();\n\n return (\n <div\n ref={ref}\n data-slot=\"view-toolbar-filters\"\n role=\"group\"\n aria-label={t(\"ui.viewToolbar.activeFilters\")}\n className={cn(\"flex min-w-0 flex-wrap items-center gap-1.5\", className)}\n {...props}\n >\n {children}\n {onClearAll ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n data-slot=\"view-toolbar-clear-all\"\n className=\"h-6 px-2\"\n onClick={onClearAll}\n >\n {t(\"ui.viewToolbar.clearAll\")}\n </Button>\n ) : null}\n </div>\n );\n },\n);\n\n// ---------------------------------------------------------------------------\n// FilterChip\n// ---------------------------------------------------------------------------\n\nexport interface FilterChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /**\n * Label-in-value text — `\"Status: Failed\"`, never `\"Status = failed\"` and\n * never a bare `\"Failed\"`. The caller composes the string so the chip reads\n * as a sentence fragment out of context (and in a screen reader).\n */\n label: string;\n /** Remove this filter. The WHOLE chip is the remove control — see below. */\n onRemove: () => void;\n}\n\n/**\n * A removable active-filter chip.\n *\n * The whole chip is a single `<button>` whose action is \"remove\", rather than a\n * span with a nested ✕: one tab stop instead of two, a ≥24px target (WCAG 2.5.8)\n * with no dead zone, and Enter/Space for free from the native element. Its\n * accessible name is \"Remove filter: <label>\", which CONTAINS the visible label\n * (WCAG 2.5.3 Label in Name).\n *\n * A chip that must EDIT a filter rather than remove it is a different control —\n * reach for `FacetFilter` (`@elabs-ai/components-data`), not a variant of this.\n */\nexport const FilterChip = forwardRef<HTMLButtonElement, FilterChipProps>(function FilterChip(\n { label, onRemove, className, onClick, ...props },\n ref,\n) {\n const { t } = useLocale();\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"view-toolbar-filter-chip\"\n aria-label={t(\"ui.viewToolbar.removeFilter\", { label })}\n className={cn(\n badgeVariants({ variant: \"secondary\" }),\n \"group min-h-6 max-w-full gap-1 ps-2.5 pe-1.5\",\n \"transition-colors duration-fast ease-standard hover:bg-secondary/70\",\n // Badge's own `focus:` ring is dead weight on a <span> but would fire on\n // every MOUSE click here; neutralise it and keep the focus-visible ring.\n \"focus:ring-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) onRemove();\n }}\n {...props}\n >\n <span className=\"truncate\">{label}</span>\n <X\n aria-hidden=\"true\"\n className=\"size-3 shrink-0 opacity-60 transition-opacity duration-fast ease-standard group-hover:opacity-100\"\n />\n </button>\n );\n});\n\n// ---------------------------------------------------------------------------\n// ResultCount\n// ---------------------------------------------------------------------------\n\nexport interface ResultCountProps extends HTMLAttributes<HTMLSpanElement> {\n /** How many rows/cards the view is showing right now. */\n count: number;\n /**\n * The unfiltered total. Supplying it renders \"N of M\" — the honest reading\n * when a filter is active. Omit it for an unfiltered view's bare count.\n */\n total?: number;\n /**\n * No count yet. Renders a layout-shaped placeholder instead of a `0` that\n * lies while the data is in flight (see `.claude/rules/loading-states.md`).\n */\n loading?: boolean;\n /**\n * Optional trailing noun (\"results\", \"runs\", \"rows\") joined with a\n * non-breaking space, so the number is never announced bare.\n */\n children?: ReactNode;\n}\n\nexport const ResultCount = forwardRef<HTMLSpanElement, ResultCountProps>(function ResultCount(\n { count, total, loading = false, children, className, ...props },\n ref,\n) {\n const { t, formatNumber } = useLocale();\n\n if (loading) {\n return (\n <span\n ref={ref}\n data-slot=\"view-toolbar-result-count\"\n role=\"status\"\n className={cn(\"inline-flex items-center\", className)}\n {...props}\n >\n <span className=\"sr-only\">{t(\"loading\")}</span>\n <Skeleton className=\"h-3 w-16\" />\n </span>\n );\n }\n\n const text =\n total === undefined\n ? formatNumber(count)\n : t(\"ui.viewToolbar.countOfTotal\", {\n count: formatNumber(count),\n total: formatNumber(total),\n });\n\n return (\n <span\n ref={ref}\n data-slot=\"view-toolbar-result-count\"\n className={cn(\"text-caption tabular-nums text-muted-foreground\", className)}\n {...props}\n >\n {text}\n {children ? <> {children}</> : null}\n </span>\n );\n});\n","// a2ui.exposed: yes\n\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n} from \"react\";\nimport { Check, ChevronsUpDown } from \"lucide-react\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport { cn } from \"../../lib/cn\";\nimport { Badge } from \"../badge\";\nimport { Button } from \"../button\";\nimport { Input } from \"../input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { type VirtualSelectOption, useVirtualListbox } from \"./use-virtual-listbox\";\n\nexport type { VirtualSelectOption };\n\nexport interface VirtualSelectProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\" | \"onChange\" | \"defaultValue\"\n> {\n /** The full option list. Only visible items are rendered in the DOM. */\n options: VirtualSelectOption[];\n /** Allow selecting multiple values. Default `false`. */\n multiple?: boolean;\n /** Controlled value — `string` in single mode, `string[]` in multiple mode. */\n value?: string | string[];\n /** Uncontrolled initial value. */\n defaultValue?: string | string[];\n /** Called when the selection changes. Emits `string` (single) or `string[]` (multiple). */\n onValueChange?: (value: string | string[]) => void;\n /** Trigger placeholder when nothing is selected. Default \"Select…\" */\n placeholder?: string;\n /** Search-input placeholder. Default \"Search…\" */\n searchPlaceholder?: string;\n /** Empty-state message when no options match the query. Default \"No results.\" */\n emptyText?: string;\n /**\n * Estimated row height used by the virtualizer (px).\n * Increase for taller rows (e.g. with descriptions). Default 32.\n */\n estimateOptionHeight?: number;\n /**\n * CSS max-height for the scrollable listbox. Default \"18rem\".\n */\n maxListHeight?: string;\n className?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction toArray(v: string | string[] | undefined): string[] {\n if (v === undefined) return [];\n if (Array.isArray(v)) return v;\n return v === \"\" ? [] : [v];\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\n/**\n * VirtualSelect — a combobox that renders only the visible window of options\n * in the DOM, making it suitable for option lists of 10,000+ items.\n *\n * Uses `@tanstack/react-virtual` for windowed rendering and a purpose-built\n * `aria-activedescendant` keyboard model so focus stays on the search input\n * while navigating the listbox.\n */\nexport const VirtualSelect = forwardRef<HTMLButtonElement, VirtualSelectProps>(\n function VirtualSelect(\n {\n options,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n placeholder = \"Select…\",\n searchPlaceholder = \"Search…\",\n emptyText = \"No results.\",\n estimateOptionHeight = 32,\n maxListHeight = \"18rem\",\n className,\n ...props\n },\n ref,\n ) {\n // ------------------------------------------------------------------\n // Controlled / uncontrolled\n // ------------------------------------------------------------------\n const isControlled = value !== undefined;\n const [internal, setInternal] = useState<string[]>(() => toArray(defaultValue));\n const selected: string[] = isControlled ? toArray(value) : internal;\n\n const emit = useCallback(\n (next: string[]) => {\n if (!isControlled) setInternal(next);\n if (multiple) {\n onValueChange?.(next);\n } else {\n onValueChange?.(next[0] ?? \"\");\n }\n },\n [isControlled, multiple, onValueChange],\n );\n\n // ------------------------------------------------------------------\n // Popover state\n // ------------------------------------------------------------------\n const [open, setOpen] = useState(false);\n\n // ------------------------------------------------------------------\n // Search / filter\n // ------------------------------------------------------------------\n const [query, setQuery] = useState(\"\");\n const searchRef = useRef<HTMLInputElement>(null);\n\n // Reset query when popover toggles\n useEffect(() => {\n setQuery(\"\");\n }, [open]);\n\n const filtered = useMemo(\n () => options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())),\n [options, query],\n );\n\n // ------------------------------------------------------------------\n // Virtualizer\n // ------------------------------------------------------------------\n // State-backed scroll element (NOT a ref): the listbox mounts only when the\n // Popover opens, so a plain ref would leave the virtualizer with a null\n // scroll element and render zero options. A state callback ref forces the\n // re-render that lets the virtualizer measure once the element appears.\n const [scrollEl, setScrollEl] = useState<HTMLDivElement | null>(null);\n const virtualizer = useVirtualizer({\n count: filtered.length,\n getScrollElement: () => scrollEl,\n estimateSize: () => estimateOptionHeight,\n overscan: 5,\n });\n\n // ------------------------------------------------------------------\n // Keyboard navigation\n // ------------------------------------------------------------------\n const handleSelect = useCallback(\n (optValue: string) => {\n if (multiple) {\n const next = selected.includes(optValue)\n ? selected.filter((v) => v !== optValue)\n : [...selected, optValue];\n emit(next);\n // Keep open in multi mode\n } else {\n emit(selected[0] === optValue ? [] : [optValue]);\n setOpen(false);\n }\n },\n [multiple, selected, emit],\n );\n\n const { activeIndex, setActiveIndex, onInputKeyDown } = useVirtualListbox({\n count: filtered.length,\n filtered,\n isOpen: open,\n onSelect: handleSelect,\n virtualizer,\n });\n\n // ------------------------------------------------------------------\n // IDs for ARIA wiring\n // ------------------------------------------------------------------\n const uid = useId();\n const listboxId = `${uid}-listbox`;\n const optionId = (index: number) => `${uid}-option-${index}`;\n\n // Focus the search input when the popover opens\n const handleOpenChange = useCallback((next: boolean) => {\n setOpen(next);\n if (next) {\n // Defer one frame so Radix has mounted the portal\n setTimeout(() => searchRef.current?.focus(), 0);\n }\n }, []);\n\n // ------------------------------------------------------------------\n // Trigger label\n // ------------------------------------------------------------------\n const selectedLabels = selected.map((v) => {\n const opt = options.find((o) => o.value === v);\n return { value: v, label: opt?.label ?? v };\n });\n\n const triggerContent =\n selectedLabels.length === 0 ? (\n <span className=\"text-muted-foreground\">{placeholder}</span>\n ) : multiple ? (\n <>\n {selectedLabels.slice(0, 2).map((l) => (\n <Badge\n key={l.value}\n variant=\"secondary\"\n className=\"max-w-[8rem] truncate border-border\"\n >\n {l.label}\n </Badge>\n ))}\n {selectedLabels.length > 2 ? (\n <Badge\n variant=\"secondary\"\n aria-label={`and ${selectedLabels.length - 2} more selected`}\n >\n +{selectedLabels.length - 2}\n </Badge>\n ) : null}\n </>\n ) : (\n <span className=\"truncate\">{selectedLabels[0]?.label}</span>\n );\n\n // ------------------------------------------------------------------\n // Render\n // ------------------------------------------------------------------\n const virtualItems = virtualizer.getVirtualItems();\n // Only reference the active option from aria-activedescendant when it is\n // actually mounted in the virtual window (else the id would dangle).\n const activeMounted = virtualItems.some((v) => v.index === activeIndex);\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-controls={listboxId}\n className={cn(\"h-auto min-h-9 w-64 justify-between font-normal\", className)}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1 text-start\">\n {triggerContent}\n </span>\n <ChevronsUpDown className=\"ms-2 size-4 shrink-0 opacity-50\" aria-hidden=\"true\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent\n className=\"w-64 p-0\"\n align=\"start\"\n // Prevent Radix from stealing focus so it can go to the input\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {/* Search input */}\n <div className=\"border-b p-1.5\">\n <Input\n ref={searchRef}\n type=\"text\"\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => onInputKeyDown(e)}\n aria-label={searchPlaceholder}\n aria-autocomplete=\"list\"\n aria-controls={listboxId}\n aria-activedescendant={\n activeIndex >= 0 && activeMounted ? optionId(activeIndex) : undefined\n }\n className=\"h-8 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n </div>\n\n {/* Listbox — always mounted so aria-controls never dangles (even when empty) */}\n <div\n ref={setScrollEl}\n id={listboxId}\n role=\"listbox\"\n aria-multiselectable={multiple || undefined}\n style={{ maxHeight: maxListHeight }}\n className=\"overflow-auto p-1\"\n >\n {filtered.length > 0 ? (\n // Spacer gives the virtualizer its full scroll height\n <div style={{ height: virtualizer.getTotalSize() }} className=\"relative\">\n {virtualItems.map((virtualRow) => {\n const opt = filtered[virtualRow.index];\n if (!opt) return null;\n const isSelected = selected.includes(opt.value);\n const isActive = activeIndex === virtualRow.index;\n\n return (\n <div\n key={virtualRow.key}\n id={optionId(virtualRow.index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={opt.disabled || undefined}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n className={cn(\n \"flex cursor-pointer select-none items-center rounded-sm px-2 text-sm outline-none\",\n \"transition-colors duration-fast motion-reduce:transition-none\",\n isActive && \"bg-accent text-accent-foreground\",\n !isActive && \"hover:bg-accent hover:text-accent-foreground\",\n opt.disabled && \"pointer-events-none cursor-not-allowed opacity-50\",\n )}\n onClick={() => {\n if (!opt.disabled) handleSelect(opt.value);\n }}\n onMouseEnter={() => {\n if (!opt.disabled) setActiveIndex(virtualRow.index);\n }}\n >\n <Check\n className={cn(\n \"me-2 size-4 shrink-0\",\n isSelected ? \"opacity-100\" : \"opacity-0\",\n )}\n aria-hidden=\"true\"\n />\n <span className=\"truncate\">{opt.label}</span>\n </div>\n );\n })}\n </div>\n ) : null}\n </div>\n {filtered.length === 0 ? (\n <div\n role=\"status\"\n aria-live=\"polite\"\n className=\"px-2 py-6 text-center text-sm text-muted-foreground\"\n >\n {emptyText}\n </div>\n ) : null}\n </PopoverContent>\n </Popover>\n );\n },\n);\n","// a2ui.exposed: yes\n\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport type { Virtualizer } from \"@tanstack/react-virtual\";\n\nexport interface VirtualSelectOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\ninterface UseVirtualListboxOptions {\n count: number;\n filtered: VirtualSelectOption[];\n /** Reserved for future use (e.g. multi-select keyboard shortcuts). */\n multiple?: boolean;\n isOpen: boolean;\n onSelect: (value: string) => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n virtualizer: Virtualizer<any, any> | null;\n}\n\ninterface UseVirtualListboxReturn {\n activeIndex: number;\n setActiveIndex: (index: number) => void;\n onInputKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\n/** First non-disabled option index at or after `from`; -1 if none exists. */\nfunction findNext(filtered: VirtualSelectOption[], from: number): number {\n for (let i = Math.max(0, from); i < filtered.length; i++) {\n if (!filtered[i]?.disabled) return i;\n }\n return -1;\n}\n\n/** Last non-disabled option index at or before `from`; -1 if none exists. */\nfunction findPrev(filtered: VirtualSelectOption[], from: number): number {\n for (let i = Math.min(from, filtered.length - 1); i >= 0; i--) {\n if (!filtered[i]?.disabled) return i;\n }\n return -1;\n}\n\n/**\n * Keyboard navigation logic for the VirtualSelect listbox.\n * Encapsulates ArrowDown/Up/Home/End/Enter/Escape handling.\n * Focus stays on the search input; `aria-activedescendant` tracks the active row.\n */\nexport function useVirtualListbox({\n count,\n filtered,\n isOpen,\n onSelect,\n virtualizer,\n}: UseVirtualListboxOptions): UseVirtualListboxReturn {\n const [activeIndex, setActiveIndexRaw] = useState(0);\n\n // When the filtered list changes, reset to the first enabled option.\n useEffect(() => {\n const first = findNext(filtered, 0);\n setActiveIndexRaw(first >= 0 ? first : 0);\n }, [filtered]);\n\n // When the popover closes, reset to 0.\n useEffect(() => {\n if (!isOpen) setActiveIndexRaw(0);\n }, [isOpen]);\n\n const setActiveIndex = useCallback(\n (index: number) => {\n const clamped = Math.max(0, Math.min(index, count - 1));\n setActiveIndexRaw(clamped);\n virtualizer?.scrollToIndex(clamped, { align: \"auto\" });\n },\n [count, virtualizer],\n );\n\n const onInputKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!isOpen) return;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n if (count === 0) return;\n const next = findNext(filtered, activeIndex + 1);\n if (next >= 0) setActiveIndex(next);\n break;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n if (count === 0) return;\n const prev = findPrev(filtered, activeIndex - 1);\n if (prev >= 0) setActiveIndex(prev);\n break;\n }\n case \"Home\": {\n e.preventDefault();\n if (count === 0) return;\n const first = findNext(filtered, 0);\n setActiveIndex(first >= 0 ? first : 0);\n break;\n }\n case \"End\": {\n e.preventDefault();\n if (count === 0) return;\n const last = findPrev(filtered, filtered.length - 1);\n setActiveIndex(last >= 0 ? last : 0);\n break;\n }\n case \"Enter\": {\n e.preventDefault();\n if (count === 0) return;\n const opt = filtered[activeIndex];\n if (opt && !opt.disabled) {\n onSelect(opt.value);\n }\n break;\n }\n // Escape is handled by Radix Popover (it closes the portal and\n // returns focus to the trigger). No additional handling required here.\n default:\n break;\n }\n },\n [isOpen, count, filtered, activeIndex, setActiveIndex, onSelect],\n );\n\n return { activeIndex, setActiveIndex, onInputKeyDown };\n}\n","\"use client\";\n// a2ui.exposed: no\n\nimport {\n createContext,\n forwardRef,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button\";\n\n// ---------------------------------------------------------------------------\n// Types & context\n// ---------------------------------------------------------------------------\n\nexport interface WizardStepMeta {\n /** Stable id for the step. */\n id: string;\n /** Title shown in the step indicator. */\n title: string;\n /** Optional supporting text shown under the title. */\n description?: string;\n}\n\n/** A step validator — return false (or a rejected/`false` promise) to block advance. */\nexport type WizardValidator = () => boolean | Promise<boolean>;\n\ninterface WizardContextValue {\n baseId: string;\n step: number;\n steps: WizardStepMeta[];\n count: number;\n isFirst: boolean;\n isLast: boolean;\n validating: boolean;\n goTo: (index: number) => void;\n next: () => void;\n prev: () => void;\n setActiveValidator: (validator: WizardValidator | undefined) => void;\n orientation: \"horizontal\" | \"vertical\";\n}\n\nconst WizardContext = createContext<WizardContextValue | null>(null);\n\nfunction useWizard(): WizardContextValue {\n const ctx = use(WizardContext);\n if (!ctx) throw new Error(\"Wizard subcomponents must be used inside <Wizard>.\");\n return ctx;\n}\n\nconst wizardVariants = cva(\"flex gap-6\", {\n variants: {\n orientation: {\n horizontal: \"flex-col\",\n vertical: \"flex-row\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n});\n\n// ---------------------------------------------------------------------------\n// Wizard (Provider / root)\n// ---------------------------------------------------------------------------\n\nexport interface WizardProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\">, VariantProps<typeof wizardVariants> {\n /** The ordered step metadata used to render the indicator. */\n steps: WizardStepMeta[];\n /** Controlled active step index. */\n step?: number;\n /** Uncontrolled initial step index. Default 0. */\n defaultStep?: number;\n /** Called whenever the active step changes. */\n onStepChange?: (step: number) => void;\n children?: ReactNode;\n}\n\n/**\n * Wizard — a multi-step flow with a step indicator, per-step validation gating,\n * and Back/Next/Finish navigation.\n *\n * Controlled via `step`/`onStepChange`; uncontrolled via `defaultStep`. State is\n * lifted into the provider and exposed to `WizardSteps`/`WizardStep`/`WizardNav`\n * via context. `Next` runs the active step's `validate` (sync or async) before\n * advancing and stays enabled until validation runs.\n */\nexport const Wizard = forwardRef<HTMLDivElement, WizardProps>(function Wizard(\n {\n steps,\n step: stepProp,\n defaultStep = 0,\n onStepChange,\n orientation = \"horizontal\",\n className,\n children,\n ...props\n },\n ref,\n) {\n const baseId = useId();\n const isControlled = stepProp !== undefined;\n const [internalStep, setInternalStep] = useState(defaultStep);\n const [validating, setValidating] = useState(false);\n const activeValidator = useRef<WizardValidator | undefined>(undefined);\n\n const count = steps.length;\n const step = Math.min(isControlled ? (stepProp ?? 0) : internalStep, Math.max(0, count - 1));\n\n const commit = useCallback(\n (next: number) => {\n const clamped = Math.min(Math.max(0, next), Math.max(0, count - 1));\n if (!isControlled) setInternalStep(clamped);\n onStepChange?.(clamped);\n },\n [isControlled, onStepChange, count],\n );\n\n const goTo = useCallback(\n (index: number) => {\n // Backward / same navigation never requires validation.\n if (index <= step) {\n commit(index);\n }\n },\n [step, commit],\n );\n\n const next = useCallback(() => {\n const validator = activeValidator.current;\n const advance = () => commit(step + 1);\n if (!validator) {\n advance();\n return;\n }\n const result = validator();\n if (typeof result === \"boolean\") {\n if (result) advance();\n return;\n }\n setValidating(true);\n result\n .then((ok) => {\n if (ok) advance();\n })\n .finally(() => setValidating(false));\n }, [step, commit]);\n\n const prev = useCallback(() => commit(step - 1), [step, commit]);\n\n const setActiveValidator = useCallback((validator: WizardValidator | undefined) => {\n activeValidator.current = validator;\n }, []);\n\n const ctx = useMemo<WizardContextValue>(\n () => ({\n baseId,\n step,\n steps,\n count,\n isFirst: step === 0,\n isLast: step === count - 1,\n validating,\n goTo,\n next,\n prev,\n setActiveValidator,\n orientation: orientation ?? \"horizontal\",\n }),\n [baseId, step, steps, count, validating, goTo, next, prev, setActiveValidator, orientation],\n );\n\n return (\n <WizardContext value={ctx}>\n <div\n ref={ref}\n data-slot=\"wizard\"\n className={cn(wizardVariants({ orientation }), className)}\n {...props}\n >\n {children}\n </div>\n </WizardContext>\n );\n});\n\n// ---------------------------------------------------------------------------\n// WizardSteps (the indicator)\n// ---------------------------------------------------------------------------\n\nexport type WizardStepsProps = HTMLAttributes<HTMLOListElement>;\n\n/** WizardSteps — the ordered step indicator. Reads steps from context. */\nexport const WizardSteps = forwardRef<HTMLOListElement, WizardStepsProps>(function WizardSteps(\n { className, ...props },\n ref,\n) {\n const { baseId, step, steps, orientation, goTo } = useWizard();\n return (\n <ol\n ref={ref}\n className={cn(\n \"flex gap-2\",\n orientation === \"vertical\" ? \"flex-col\" : \"flex-row flex-wrap items-center\",\n className,\n )}\n {...props}\n >\n {steps.map((meta, index) => {\n const isActive = index === step;\n const isComplete = index < step;\n const isClickable = index <= step;\n return (\n <li\n key={meta.id}\n id={`${baseId}-step-${index}`}\n aria-current={isActive ? \"step\" : undefined}\n className={cn(\"flex items-center gap-2\", orientation === \"horizontal\" && \"min-w-0\")}\n >\n <button\n type=\"button\"\n disabled={!isClickable}\n onClick={() => goTo(index)}\n className={cn(\n \"flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium tabular-nums\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n isActive && \"border-primary bg-primary text-primary-foreground\",\n // #399 — the step NUMBER is text on a `/10` wash, not plate ink\n // and not a mark: `-text` rung. The border keeps the fill rung.\n isComplete && \"border-primary bg-primary/10 text-primary-text\",\n !isActive && !isComplete && \"border-border-strong text-muted-foreground\",\n isClickable ? \"cursor-pointer\" : \"cursor-default\",\n )}\n >\n {isComplete ? <Check className=\"size-4\" aria-hidden=\"true\" /> : index + 1}\n </button>\n <span className=\"flex min-w-0 flex-col\">\n <span\n className={cn(\n \"truncate text-sm font-medium\",\n isActive ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {meta.title}\n </span>\n {meta.description && (\n <span className=\"truncate text-xs text-muted-foreground\">{meta.description}</span>\n )}\n </span>\n </li>\n );\n })}\n </ol>\n );\n});\n\n// ---------------------------------------------------------------------------\n// WizardStep (per-step content + validator)\n// ---------------------------------------------------------------------------\n\nexport interface WizardStepProps extends HTMLAttributes<HTMLDivElement> {\n /** This step's index (0-based) — must match its position in `steps`. */\n step: number;\n /** Run before advancing past this step. Return false to block. */\n validate?: WizardValidator;\n}\n\n/**\n * WizardStep — renders its children only when it is the active step, and\n * registers its `validate` with the wizard while active. Receives focus on\n * activation for keyboard users.\n */\nexport const WizardStep = forwardRef<HTMLDivElement, WizardStepProps>(function WizardStep(\n { step, validate, className, children, ...props },\n ref,\n) {\n const { step: activeStep, baseId, setActiveValidator } = useWizard();\n const isActive = step === activeStep;\n const regionRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!isActive) return;\n setActiveValidator(validate);\n // Move focus to the newly-revealed step for keyboard users.\n regionRef.current?.focus();\n return () => setActiveValidator(undefined);\n }, [isActive, validate, setActiveValidator]);\n\n if (!isActive) return null;\n\n return (\n <div\n ref={(node) => {\n regionRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n role=\"group\"\n aria-labelledby={`${baseId}-step-${step}`}\n tabIndex={-1}\n className={cn(\"min-w-0 flex-1 focus-visible:outline-none\", className)}\n {...props}\n >\n {children}\n </div>\n );\n});\n\n// ---------------------------------------------------------------------------\n// WizardNav (Back / Next / Finish)\n// ---------------------------------------------------------------------------\n\nexport interface WizardNavProps extends HTMLAttributes<HTMLDivElement> {\n backLabel?: string;\n nextLabel?: string;\n finishLabel?: string;\n /** Called when Finish is pressed on the last step. */\n onFinish?: () => void;\n}\n\n/** WizardNav — Back / Next (or Finish on the last step) controls. */\nexport const WizardNav = forwardRef<HTMLDivElement, WizardNavProps>(function WizardNav(\n { backLabel = \"Back\", nextLabel = \"Next\", finishLabel = \"Finish\", onFinish, className, ...props },\n ref,\n) {\n const { isFirst, isLast, validating, next, prev } = useWizard();\n return (\n <div ref={ref} className={cn(\"flex items-center justify-between gap-2\", className)} {...props}>\n <Button type=\"button\" variant=\"outline\" onClick={prev} disabled={isFirst}>\n {backLabel}\n </Button>\n {isLast ? (\n <Button type=\"button\" onClick={onFinish}>\n {finishLabel}\n </Button>\n ) : (\n <Button type=\"button\" onClick={next} disabled={validating}>\n {validating ? \"Checking…\" : nextLabel}\n </Button>\n )}\n </div>\n );\n});\n"],"mappings":";;;AAAA,SAAS,YAA6B;AACtC,SAAS,2BAA2B;AAUpC,IAAM,aAAa,C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UAAU,UAAU,kBAAkB,CAAC;AAE3C,MAAI,CAAC,SAAU,QAAO;AAEtB,SACE,gBAAAjB;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,CAAC,SAAS;AACb,kBAAU,UAAU;AACpB,YAAI,OAAO,QAAQ,WAAY,KAAI,IAAI;AAAA,iBAC9B,IAAK,KAAI,UAAU;AAAA,MAC9B;AAAA,MACA,MAAK;AAAA,MACL,mBAAiB,GAAG,MAAM,SAASU,KAAI;AAAA,MACvC,UAAU;AAAA,MACV,WAAW,GAAG,6CAA6C,SAAS;AAAA,MACnE,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AAeM,IAAM,YAAYL,aAA2C,SAASa,WAC3E,EAAE,YAAY,QAAQ,YAAY,QAAQ,cAAc,UAAU,UAAU,WAAW,GAAG,MAAM,GAChG,KACA;AACA,QAAM,EAAE,SAAS,QAAQ,YAAY,MAAM,KAAK,IAAI,UAAU;AAC9D,SACE,gBAAAjB,OAAC,SAAI,KAAU,WAAW,GAAG,2CAA2C,SAAS,GAAI,GAAG,OACtF;AAAA,oBAAAD,OAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,SAAS,MAAM,UAAU,SAC9D,qBACH;AAAA,IACC,SACC,gBAAAA,OAAC,UAAO,MAAK,UAAS,SAAS,UAC5B,uBACH,IAEA,gBAAAA,OAAC,UAAO,MAAK,UAAS,SAAS,MAAM,UAAU,YAC5C,uBAAa,mBAAc,WAC9B;AAAA,KAEJ;AAEJ,CAAC;","names":["useEffect","useState","useMemo","useMemo","jsx","AccordionItem","AccordionTrigger","AccordionContent","useCallback","useState","ChevronDown","jsx","forwardRef","jsx","CollapsibleTrigger","CollapsibleContent","forwardRef","jsx","jsxs","useState","useCallback","CollapsibleTrigger","ChevronDown","CollapsibleContent","forwardRef","createContext","forwardRef","useCallback","useEffect","useMemo","useState","Slot","cva","forwardRef","cva","jsx","cva","forwardRef","Button","useCallback","useMemo","useState","useState","useCallback","useMemo","forwardRef","jsx","forwardRef","Input","forwardRef","cva","jsx","cva","forwardRef","Separator","forwardRef","cva","jsx","jsxs","forwardRef","SheetOverlay","cva","SheetContent","SheetTitle","SheetDescription","jsx","forwardRef","jsx","forwardRef","TooltipContent","jsx","jsxs","createContext","forwardRef","SidebarProvider","useState","useCallback","useEffect","useMemo","Sidebar","SidebarTrigger","SidebarRail","SidebarInset","SidebarInput","SidebarHeader","SidebarFooter","SidebarSeparator","SidebarContent","SidebarGroup","SidebarGroupLabel","Slot","SidebarGroupAction","SidebarGroupContent","SidebarMenu","SidebarMenuItem","cva","SidebarMenuButton","SidebarMenuAction","SidebarMenuBadge","SidebarMenuSub","SidebarMenuSubItem","SidebarMenuSubButton","jsx","jsxs","forwardRef","AppSidebar","forwardRef","cva","jsx","cva","forwardRef","Alert","AlertTitle","AlertDescription","forwardRef","jsx","jsxs","forwardRef","AlertDialogOverlay","AlertDialogContent","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","jsx","jsxs","forwardRef","useMemo","forwardRef","jsx","jsxs","forwardRef","ScrollArea","ScrollBar","jsx","jsxs","forwardRef","AttributionPanel","useMemo","forwardRef","jsx","forwardRef","Avatar","AvatarImage","AvatarFallback","createContext","forwardRef","use","useRef","useCallback","cva","forwardRef","useRef","useState","useCallback","cva","jsx","jsxs","cva","useState","useRef","useCallback","forwardRef","Card","CardHeader","CardTitle","CardDescription","CardAction","CardContent","CardFooter","jsx","jsxs","createContext","forwardRef","BentoGrid","cva","BentoGridItem","useRef","use","useCallback","forwardRef","useCallback","useState","forwardRef","useCallback","useRef","useState","forwardRef","cva","forwardRef","jsx","forwardRef","Textarea","jsx","cva","forwardRef","InputGroup","InputGroupAddon","InputGroupButton","InputGroupText","InputGroupInput","InputGroupTextarea","jsx","jsxs","forwardRef","NumberInput","step","clamp","useState","useRef","useCallback","jsx","jsxs","forwardRef","BoundedNumber","useState","useCallback","forwardRef","Slot","jsx","jsxs","forwardRef","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","Slot","BreadcrumbPage","forwardRef","Slot","cva","jsx","cva","forwardRef","ButtonGroup","ButtonGroupText","Slot","ButtonGroupSeparator","ChevronRight","jsx","Icon","ChevronRight","createContext","forwardRef","useCallback","useContext","useEffect","useState","jsx","createContext","useContext","forwardRef","Carousel","useState","useCallback","useEffect","CarouselContent","CarouselItem","createContext","forwardRef","use","useCallback","useId","useMemo","useState","X","cva","cva","jsx","jsxs","cva","jsx","jsxs","createContext","use","cva","useId","useState","useMemo","useCallback","forwardRef","ChangeReviewHeader","X","ChangeReviewProvenance","ChangeReviewList","ChangeReviewHunk","ChangeReview","forwardRef","Check","Minus","jsx","jsxs","forwardRef","Checkbox","Check","Minus","forwardRef","useCallback","useRef","useState","forwardRef","jsx","forwardRef","PopoverContent","jsx","jsxs","forwardRef","Swatch","ColorPicker","useState","useCallback","useRef","forwardRef","useState","Check","Plus","createContext","forwardRef","use","useEffect","useMemo","useRef","useState","forwardRef","useCallback","useRef","cva","forwardRef","Slot","cva","jsx","cva","forwardRef","Text","Slot","Heading","forwardRef","jsx","forwardRef","ProseHeading","ProseText","ProseLink","ProseList","ProseListItem","ProseBlockquote","ProseInlineCode","jsx","jsxs","cva","forwardRef","DialogOverlay","DialogContent","useRef","useCallback","DialogTitle","DialogDescription","DialogBody","DialogSection","useCallback","useState","jsx","jsxs","createContext","useState","useRef","useEffect","forwardRef","Command","useMemo","use","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","jsx","jsxs","forwardRef","Combobox","useState","Check","Plus","jsx","jsx","jsxs","forwardRef","Check","ChevronRight","jsx","jsxs","forwardRef","ContextMenuSubTrigger","ChevronRight","ContextMenuSubContent","ContextMenuContent","ContextMenuItem","ContextMenuCheckboxItem","Check","ContextMenuRadioItem","ContextMenuLabel","ContextMenuSeparator","forwardRef","Fragment","jsx","jsxs","forwardRef","CopyableValue","useState","jsx","jsxs","useState","forwardRef","useState","CalendarIcon","jsx","jsxs","forwardRef","DateRangePicker","useState","CalendarIcon","createContext","forwardRef","use","cva","jsx","jsxs","cva","createContext","forwardRef","Descriptions","DescriptionsItem","use","forwardRef","jsx","jsxs","forwardRef","DrawerOverlay","DrawerContent","DrawerTitle","DrawerDescription","forwardRef","Check","ChevronRight","Circle","jsx","jsxs","forwardRef","DropdownMenuSubTrigger","ChevronRight","DropdownMenuSubContent","DropdownMenuRadioItem","Circle","DropdownMenuCheckboxItem","Check","DropdownMenuContent","DropdownMenuItem","DropdownMenuLabel","DropdownMenuSeparator","jsx","jsx","cva","forwardRef","jsx","jsxs","cva","forwardRef","ExpandDialogPanes","ExpandDialogContent","ExpandDialog","forwardRef","useId","Slot","forwardRef","jsx","Label","forwardRef","jsx","jsxs","forwardRef","FieldRow","useId","Label","Slot","createContext","forwardRef","use","useCallback","useId","useMemo","useRef","useState","X","forwardRef","cva","jsx","cva","forwardRef","Progress","Fragment","jsx","jsxs","createContext","use","forwardRef","FileUpload","useState","useRef","useId","useMemo","useCallback","FileUploadDropzone","FileUploadList","FileUploadItem","X","createContext","forwardRef","useContext","useId","Slot","jsx","createContext","useContext","forwardRef","FormItem","useId","FormLabel","Label","FormControl","Slot","FormDescription","FormMessage","forwardRef","jsx","forwardRef","HoverCardContent","forwardRef","useId","jsx","jsxs","forwardRef","IconButton","useId","forwardRef","useContext","Minus","jsx","jsxs","forwardRef","InputOTP","InputOTPGroup","InputOTPSlot","useContext","InputOTPSeparator","Minus","forwardRef","jsx","forwardRef","Kbd","forwardRef","useCallback","useMemo","useState","Plus","X","jsx","jsxs","forwardRef","KeyValueEditor","useState","useMemo","useCallback","X","Plus","forwardRef","jsx","jsxs","forwardRef","LinkPreviewCard","forwardRef","useCallback","useMemo","useState","ChevronDown","Plus","X","Fragment","jsx","jsxs","forwardRef","ListEditor","useState","useMemo","useCallback","ChevronDown","X","Plus","jsx","forwardRef","Fragment","jsx","forwardRef","MatchHighlight","Fragment","createContext","forwardRef","use","useCallback","useEffect","useId","useMemo","useRef","useState","Slot","jsx","jsxs","createContext","use","forwardRef","MentionInput","useId","useCallback","useRef","useMemo","useState","useEffect","MentionInputTextarea","Slot","MentionInputContent","MentionInputList","MentionInputItem","MentionInputEmpty","forwardRef","Check","ChevronRight","Circle","Group","Portal","Sub","RadioGroup","jsx","jsxs","forwardRef","Menubar","MenubarTrigger","MenubarContent","MenubarItem","MenubarSubTrigger","ChevronRight","MenubarSubContent","MenubarCheckboxItem","Check","MenubarRadioItem","Circle","MenubarSeparator","forwardRef","useCallback","useState","Check","ChevronsUpDown","Fragment","jsx","jsxs","Check","forwardRef","ModelPicker","useState","useCallback","ChevronsUpDown","forwardRef","cva","jsx","jsxs","cva","forwardRef","MetricCard","useState","ChevronDown","ChevronUp","jsx","jsxs","useState","CollapsibleTrigger","ChevronUp","ChevronDown","CollapsibleContent","jsx","jsxs","ChevronsUpDown","jsx","jsxs","ChevronsUpDown","forwardRef","cva","ChevronDown","jsx","jsxs","forwardRef","NavigationMenu","NavigationMenuList","cva","NavigationMenuTrigger","ChevronDown","NavigationMenuContent","NavigationMenuViewport","jsx","jsxs","forwardRef","ChevronLeft","ChevronRight","MoreHorizontal","jsx","jsxs","forwardRef","PaginationContent","PaginationItem","ChevronLeft","ChevronRight","MoreHorizontal","forwardRef","Circle","jsx","RadioGroup","forwardRef","RadioGroupItem","Circle","forwardRef","useCallback","useRef","useState","cva","jsx","jsxs","cva","forwardRef","Rating","useState","useRef","useCallback","step","jsx","cloneElement","forwardRef","cva","jsx","cva","forwardRef","Reveal","RevealGroup","cloneElement","jsx","jsxs","forwardRef","useCallback","useId","useRef","useState","createContext","forwardRef","useContext","forwardRef","cva","jsx","cva","forwardRef","Toggle","jsx","createContext","forwardRef","ToggleGroup","ToggleGroupItem","useContext","jsx","jsxs","forwardRef","SegmentedField","useId","useRef","useState","useCallback","Label","forwardRef","useEffect","useMemo","useRef","Check","ChevronDown","ChevronUp","jsx","jsxs","forwardRef","SelectTrigger","useRef","useMemo","useEffect","ChevronDown","SelectContent","ChevronUp","SelectLabel","SelectItem","Check","SelectSeparator","forwardRef","jsx","jsxs","forwardRef","Slider","forwardRef","useCallback","useState","jsx","jsxs","step","clampValue","forwardRef","SliderNumber","useState","useCallback","useEffect","useState","jsx","useState","useEffect","forwardRef","cva","AlertCircle","CheckCircle2","Circle","Clock","Loader2","jsx","jsxs","Circle","Loader2","CheckCircle2","Clock","AlertCircle","forwardRef","StatusIcon","Icon","cva","StatusBadge","cva","jsx","jsxs","cva","forwardRef","jsx","forwardRef","Switch","forwardRef","jsx","forwardRef","Table","TableHeader","TableBody","TableFooter","TableRow","TableHead","TableCell","TableCaption","forwardRef","useEffect","useMemo","useRef","jsx","forwardRef","TabsList","TabsTrigger","useRef","useMemo","useEffect","TabsContent","forwardRef","useCallback","useMemo","useRef","useState","X","jsx","jsxs","forwardRef","TagInput","useState","useRef","useMemo","useCallback","X","ChevronsUpDown","Plus","jsx","jsxs","ChevronsUpDown","Plus","forwardRef","useCallback","useEffect","useState","Check","useTheme","useCallback","useReducedMotion","jsx","jsxs","forwardRef","ThemeSwitcher","useTheme","useState","useEffect","useCallback","next","Check","createContext","forwardRef","use","useCallback","useMemo","useState","cva","ChevronRight","Plus","Minus","Fragment","jsx","jsxs","cva","createContext","use","useMemo","Plus","Minus","ChevronRight","useState","useCallback","forwardRef","RevisionTimeline","forwardRef","jsx","jsxs","forwardRef","TimelineRoot","TimelineItem","Timeline","cva","forwardRef","jsx","cva","forwardRef","Toolbar","ToolbarButton","ToolbarSeparator","ToolbarToggleGroup","ToolbarToggleItem","forwardRef","jsx","jsxs","forwardRef","TopNav","forwardRef","useCallback","useId","useMemo","useState","ChevronLeft","ChevronRight","jsx","jsxs","useMemo","forwardRef","Transfer","useState","useCallback","useId","ChevronRight","ChevronLeft","forwardRef","useCallback","useEffect","useId","useRef","useState","ChevronRight","AlertCircle","useCallback","useEffect","useRef","useState","jsx","jsxs","useState","useCallback","useId","ChevronRight","AlertCircle","forwardRef","Tree","useEffect","useRef","forwardRef","useId","useState","ChevronsUpDown","Fragment","jsx","jsxs","forwardRef","TreeSelect","useState","useId","ChevronsUpDown","forwardRef","X","Fragment","jsx","jsxs","forwardRef","ViewToolbar","ViewToolbarFilters","FilterChip","X","ResultCount","forwardRef","useCallback","useEffect","useId","useMemo","useRef","useState","Check","ChevronsUpDown","useVirtualizer","useCallback","useEffect","useState","Fragment","jsx","jsxs","toArray","forwardRef","VirtualSelect","useState","useCallback","useRef","useEffect","useMemo","useVirtualizer","useId","ChevronsUpDown","Check","createContext","forwardRef","use","useCallback","useEffect","useId","useMemo","useRef","useState","cva","Check","jsx","jsxs","createContext","use","cva","forwardRef","Wizard","useId","useState","useRef","step","useCallback","next","useMemo","WizardSteps","Check","WizardStep","useEffect","WizardNav"]}
|