@brett_lamy/ui 1.1.0 → 3.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/README.md +37 -23
- package/dist/components/adaptive-pane.d.ts.map +1 -1
- package/dist/components/adaptive-pane.js +30 -0
- package/dist/components/animated-height.d.ts.map +1 -1
- package/dist/components/animated-height.js +82 -0
- package/dist/{templates → components}/artifact-chat-container.d.ts +17 -5
- package/dist/components/artifact-chat-container.d.ts.map +1 -0
- package/dist/components/artifact-chat-container.js +200 -0
- package/dist/components/avatar.js +26 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +46 -0
- package/dist/components/card.js +56 -0
- package/dist/components/celebrate.d.ts.map +1 -1
- package/dist/components/celebrate.js +142 -0
- package/dist/components/chat-column.d.ts.map +1 -0
- package/dist/components/chat-column.js +26 -0
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox.js +55 -0
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.d.ts.map +1 -1
- package/dist/components/combobox.js +65 -0
- package/dist/components/command-menu.d.ts +210 -0
- package/dist/components/command-menu.d.ts.map +1 -0
- package/dist/components/command-menu.js +906 -0
- package/dist/components/composer/annotator.d.ts.map +1 -0
- package/dist/components/composer/annotator.js +17 -0
- package/dist/components/composer/composer-files.d.ts.map +1 -0
- package/dist/components/composer/composer-files.js +91 -0
- package/dist/components/{workbench/wb-popover.d.ts → composer/composer-popover.d.ts} +3 -5
- package/dist/components/composer/composer-popover.d.ts.map +1 -0
- package/dist/components/composer/composer-popover.js +29 -0
- package/dist/components/{workbench → composer}/composer.d.ts +11 -11
- package/dist/components/composer/composer.d.ts.map +1 -0
- package/dist/components/composer/composer.js +1633 -0
- package/dist/components/{workbench/chat.d.ts → conversation.d.ts} +3 -3
- package/dist/components/conversation.d.ts.map +1 -0
- package/dist/components/conversation.js +357 -0
- package/dist/components/credenza.d.ts +7 -2
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +294 -0
- package/dist/components/dialog.d.ts +2 -2
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +125 -0
- package/dist/components/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure.js +59 -0
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +114 -0
- package/dist/components/edge-drawer.d.ts +14 -2
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +73 -0
- package/dist/components/edit-bar.d.ts.map +1 -1
- package/dist/components/edit-bar.js +33 -0
- package/dist/components/{chat/floating-chat.d.ts → floating-chat.d.ts} +26 -3
- package/dist/components/floating-chat.d.ts.map +1 -0
- package/dist/components/floating-chat.js +288 -0
- package/dist/components/{chat/floating-sheet.d.ts → floating-sheet.d.ts} +24 -4
- package/dist/components/floating-sheet.d.ts.map +1 -0
- package/dist/components/floating-sheet.js +252 -0
- package/dist/components/form.d.ts.map +1 -1
- package/dist/components/form.js +32 -0
- package/dist/components/icon-button.d.ts +19 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +31 -0
- package/dist/components/icon-swap.d.ts.map +1 -1
- package/dist/components/icon-swap.js +80 -0
- package/dist/components/index-bar.d.ts +14 -1
- package/dist/components/index-bar.d.ts.map +1 -1
- package/dist/components/index-bar.js +249 -0
- package/dist/components/input.d.ts.map +1 -1
- package/dist/components/input.js +30 -0
- package/dist/components/kbd.d.ts.map +1 -1
- package/dist/components/kbd.js +21 -0
- package/dist/components/label.d.ts.map +1 -1
- package/dist/components/label.js +22 -0
- package/dist/components/list-box.d.ts +1 -3
- package/dist/components/list-box.d.ts.map +1 -1
- package/dist/components/list-box.js +104 -0
- package/dist/components/list.d.ts +15 -1
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +491 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +300 -0
- package/dist/components/{workbench/markdown.d.ts → markdown-view.d.ts} +1 -1
- package/dist/components/markdown-view.d.ts.map +1 -0
- package/dist/components/markdown-view.js +129 -0
- package/dist/components/measure-h.d.ts.map +1 -1
- package/dist/components/measure-h.js +20 -0
- package/dist/components/message-scroller.d.ts.map +1 -0
- package/dist/components/message-scroller.js +247 -0
- package/dist/components/morph.d.ts +6 -3
- package/dist/components/morph.d.ts.map +1 -1
- package/dist/components/morph.js +89 -0
- package/dist/components/navigation-stack.d.ts +27 -2
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +506 -0
- package/dist/components/now-playing-bars.js +38 -0
- package/dist/components/number-morph.d.ts.map +1 -1
- package/dist/components/number-morph.js +123 -0
- package/dist/{lib → components}/pencilkit/constants.d.ts +8 -8
- package/dist/components/pencilkit/constants.d.ts.map +1 -0
- package/dist/components/pencilkit/constants.js +63 -0
- package/dist/components/pencilkit/pencil-canvas.d.ts +1 -1
- package/dist/components/pencilkit/pencil-canvas.d.ts.map +1 -1
- package/dist/components/pencilkit/pencil-canvas.js +105 -0
- package/dist/components/pencilkit/pencil-toolbar.d.ts +8 -6
- package/dist/components/pencilkit/pencil-toolbar.d.ts.map +1 -1
- package/dist/components/pencilkit/pencil-toolbar.js +186 -0
- package/dist/components/pencilkit/pencilkit-annotator.d.ts +1 -1
- package/dist/components/pencilkit/pencilkit-annotator.d.ts.map +1 -1
- package/dist/components/pencilkit/pencilkit-annotator.js +44 -0
- package/dist/components/pencilkit/stroke-path.d.ts +1 -1
- package/dist/components/pencilkit/stroke-path.d.ts.map +1 -1
- package/dist/components/pencilkit/stroke-path.js +44 -0
- package/dist/components/pencilkit/use-pencil-history.d.ts +2 -2
- package/dist/components/pencilkit/use-pencil-history.d.ts.map +1 -1
- package/dist/components/pencilkit/use-pencil-history.js +25 -0
- package/dist/components/plain-button.d.ts +10 -0
- package/dist/components/plain-button.d.ts.map +1 -0
- package/dist/components/plain-button.js +23 -0
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/popover.js +36 -0
- package/dist/components/progress-ring.d.ts +34 -15
- package/dist/components/progress-ring.d.ts.map +1 -1
- package/dist/components/progress-ring.js +195 -0
- package/dist/components/progress-stepper.d.ts.map +1 -0
- package/dist/components/progress-stepper.js +62 -0
- package/dist/components/progress.d.ts.map +1 -1
- package/dist/components/progress.js +54 -0
- package/dist/components/qr-svg.d.ts.map +1 -1
- package/dist/components/qr-svg.js +74 -0
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group.js +41 -0
- package/dist/components/replay-preview.d.ts +4 -0
- package/dist/components/replay-preview.d.ts.map +1 -0
- package/dist/components/replay-preview.js +3 -0
- package/dist/components/scroll-area.js +23 -0
- package/dist/components/search-field.d.ts.map +1 -1
- package/dist/components/search-field.js +44 -0
- package/dist/components/segmented.d.ts +2 -2
- package/dist/components/segmented.d.ts.map +1 -1
- package/dist/components/segmented.js +32 -0
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.d.ts.map +1 -1
- package/dist/components/select.js +93 -0
- package/dist/components/separator.d.ts.map +1 -1
- package/dist/components/separator.js +40 -0
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +55 -0
- package/dist/components/side-drawer.d.ts +16 -2
- package/dist/components/side-drawer.d.ts.map +1 -1
- package/dist/components/side-drawer.js +247 -0
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar.js +282 -0
- package/dist/components/skeleton.js +48 -0
- package/dist/components/slider.d.ts +10 -4
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +98 -0
- package/dist/components/snap-sheet.d.ts +13 -0
- package/dist/components/snap-sheet.d.ts.map +1 -0
- package/dist/components/snap-sheet.js +100 -0
- package/dist/components/spinner.js +35 -0
- package/dist/components/split-view.d.ts +34 -5
- package/dist/components/split-view.d.ts.map +1 -1
- package/dist/components/split-view.js +1060 -0
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.d.ts.map +1 -1
- package/dist/components/switch.js +27 -0
- package/dist/components/syntax-highlighting.d.ts.map +1 -1
- package/dist/components/syntax-highlighting.js +293 -0
- package/dist/components/tab-bar.js +28 -0
- package/dist/components/tab-view.d.ts +8 -7
- package/dist/components/tab-view.d.ts.map +1 -1
- package/dist/components/tab-view.js +307 -0
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +86 -0
- package/dist/components/text-field.d.ts.map +1 -1
- package/dist/components/text-field.js +29 -0
- package/dist/components/text-morph.d.ts.map +1 -1
- package/dist/components/text-morph.js +131 -0
- package/dist/components/textarea.d.ts.map +1 -1
- package/dist/components/textarea.js +30 -0
- package/dist/components/toast.d.ts +8 -2
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +302 -0
- package/dist/components/toggle-group.d.ts +1 -1
- package/dist/components/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group.js +48 -0
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/toggle.d.ts.map +1 -1
- package/dist/components/toggle.js +42 -0
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip.js +42 -0
- package/dist/{lib/workbench/theme.d.ts → components/workbench-theme.d.ts} +4 -5
- package/dist/components/workbench-theme.d.ts.map +1 -0
- package/dist/components/workbench-theme.js +34 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +37 -80
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -20192
- package/dist/lib/container.d.ts.map +1 -1
- package/dist/lib/container.js +49 -0
- package/dist/lib/icon-shapes/chat.d.ts +32 -0
- package/dist/lib/icon-shapes/chat.d.ts.map +1 -0
- package/dist/lib/icon-shapes/chat.js +13 -0
- package/dist/lib/icon-shapes/pencilkit.d.ts +49 -0
- package/dist/lib/icon-shapes/pencilkit.d.ts.map +1 -0
- package/dist/lib/icon-shapes/pencilkit.js +20 -0
- package/dist/lib/icon-shapes/workbench.d.ts +199 -0
- package/dist/lib/icon-shapes/workbench.d.ts.map +1 -0
- package/dist/lib/icon-shapes/workbench.js +47 -0
- package/dist/lib/icon.d.ts +352 -1
- package/dist/lib/icon.d.ts.map +1 -1
- package/dist/lib/icon.js +1774 -0
- package/dist/lib/motion.d.ts +16 -0
- package/dist/lib/motion.d.ts.map +1 -1
- package/dist/lib/motion.js +104 -0
- package/dist/lib/{chat/persistent-host.d.ts → persistent-host.d.ts} +1 -1
- package/dist/lib/persistent-host.d.ts.map +1 -0
- package/dist/lib/persistent-host.js +41 -0
- package/dist/lib/primitives.d.ts +1 -1
- package/dist/lib/primitives.d.ts.map +1 -1
- package/dist/lib/primitives.js +8 -0
- package/dist/lib/qr.js +552 -0
- package/dist/lib/row-label.d.ts +9 -0
- package/dist/lib/row-label.d.ts.map +1 -0
- package/dist/lib/row-label.js +10 -0
- package/dist/lib/sheet-drag.d.ts +22 -7
- package/dist/lib/sheet-drag.d.ts.map +1 -1
- package/dist/lib/sheet-drag.js +128 -0
- package/dist/lib/syntax.js +204 -0
- package/dist/lib/theme.d.ts +61 -5
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +138 -0
- package/dist/lib/tokens.generated.d.ts +16 -0
- package/dist/lib/tokens.generated.d.ts.map +1 -0
- package/dist/lib/tokens.generated.js +22 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +18 -0
- package/dist/theme.css +265 -0
- package/package.json +8 -7
- package/dist/components/adaptive-pane.stories.d.ts +0 -7
- package/dist/components/adaptive-pane.stories.d.ts.map +0 -1
- package/dist/components/avatar.stories.d.ts +0 -9
- package/dist/components/avatar.stories.d.ts.map +0 -1
- package/dist/components/badge.stories.d.ts +0 -9
- package/dist/components/badge.stories.d.ts.map +0 -1
- package/dist/components/button.stories.d.ts +0 -9
- package/dist/components/button.stories.d.ts.map +0 -1
- package/dist/components/card.stories.d.ts +0 -9
- package/dist/components/card.stories.d.ts.map +0 -1
- package/dist/components/chat/channel-list.d.ts +0 -35
- package/dist/components/chat/channel-list.d.ts.map +0 -1
- package/dist/components/chat/channel-list.stories.d.ts +0 -13
- package/dist/components/chat/channel-list.stories.d.ts.map +0 -1
- package/dist/components/chat/chat-avatar.d.ts +0 -13
- package/dist/components/chat/chat-avatar.d.ts.map +0 -1
- package/dist/components/chat/chat-avatar.stories.d.ts +0 -9
- package/dist/components/chat/chat-avatar.stories.d.ts.map +0 -1
- package/dist/components/chat/chat-column.d.ts.map +0 -1
- package/dist/components/chat/chat-column.stories.d.ts +0 -7
- package/dist/components/chat/chat-column.stories.d.ts.map +0 -1
- package/dist/components/chat/chat-composer.d.ts +0 -22
- package/dist/components/chat/chat-composer.d.ts.map +0 -1
- package/dist/components/chat/chat-composer.stories.d.ts +0 -16
- package/dist/components/chat/chat-composer.stories.d.ts.map +0 -1
- package/dist/components/chat/chat.fixtures.d.ts +0 -29
- package/dist/components/chat/chat.fixtures.d.ts.map +0 -1
- package/dist/components/chat/floating-chat.d.ts.map +0 -1
- package/dist/components/chat/floating-chat.stories.d.ts +0 -17
- package/dist/components/chat/floating-chat.stories.d.ts.map +0 -1
- package/dist/components/chat/floating-sheet.d.ts.map +0 -1
- package/dist/components/chat/floating-sheet.stories.d.ts +0 -22
- package/dist/components/chat/floating-sheet.stories.d.ts.map +0 -1
- package/dist/components/chat/member-list.d.ts +0 -21
- package/dist/components/chat/member-list.d.ts.map +0 -1
- package/dist/components/chat/message-list.d.ts +0 -34
- package/dist/components/chat/message-list.d.ts.map +0 -1
- package/dist/components/chat/message.d.ts +0 -47
- package/dist/components/chat/message.d.ts.map +0 -1
- package/dist/components/chat/message.stories.d.ts +0 -30
- package/dist/components/chat/message.stories.d.ts.map +0 -1
- package/dist/components/chat/progress-stepper.d.ts.map +0 -1
- package/dist/components/chat/rich-text.d.ts +0 -8
- package/dist/components/chat/rich-text.d.ts.map +0 -1
- package/dist/components/chat/rich-text.stories.d.ts +0 -9
- package/dist/components/chat/rich-text.stories.d.ts.map +0 -1
- package/dist/components/chat/server-header.d.ts +0 -10
- package/dist/components/chat/server-header.d.ts.map +0 -1
- package/dist/components/chat/thread-preview.d.ts +0 -25
- package/dist/components/chat/thread-preview.d.ts.map +0 -1
- package/dist/components/chat/thread-preview.stories.d.ts +0 -18
- package/dist/components/chat/thread-preview.stories.d.ts.map +0 -1
- package/dist/components/chat/user-panel.d.ts +0 -16
- package/dist/components/chat/user-panel.d.ts.map +0 -1
- package/dist/components/chat/workspace-rail.d.ts +0 -56
- package/dist/components/chat/workspace-rail.d.ts.map +0 -1
- package/dist/components/chat/workspace-rail.stories.d.ts +0 -12
- package/dist/components/chat/workspace-rail.stories.d.ts.map +0 -1
- package/dist/components/checkbox.stories.d.ts +0 -11
- package/dist/components/checkbox.stories.d.ts.map +0 -1
- package/dist/components/combobox.stories.d.ts +0 -10
- package/dist/components/combobox.stories.d.ts.map +0 -1
- package/dist/components/credenza.stories.d.ts +0 -8
- package/dist/components/credenza.stories.d.ts.map +0 -1
- package/dist/components/dialog.stories.d.ts +0 -12
- package/dist/components/dialog.stories.d.ts.map +0 -1
- package/dist/components/disclosure.stories.d.ts +0 -10
- package/dist/components/disclosure.stories.d.ts.map +0 -1
- package/dist/components/dropdown-menu.stories.d.ts +0 -11
- package/dist/components/dropdown-menu.stories.d.ts.map +0 -1
- package/dist/components/edge-drawer.stories.d.ts +0 -8
- package/dist/components/edge-drawer.stories.d.ts.map +0 -1
- package/dist/components/edit-bar.stories.d.ts +0 -10
- package/dist/components/edit-bar.stories.d.ts.map +0 -1
- package/dist/components/form.stories.d.ts +0 -9
- package/dist/components/form.stories.d.ts.map +0 -1
- package/dist/components/haptic-indicator.d.ts +0 -11
- package/dist/components/haptic-indicator.d.ts.map +0 -1
- package/dist/components/haptic-indicator.stories.d.ts +0 -8
- package/dist/components/haptic-indicator.stories.d.ts.map +0 -1
- package/dist/components/index-bar.stories.d.ts +0 -12
- package/dist/components/index-bar.stories.d.ts.map +0 -1
- package/dist/components/input.stories.d.ts +0 -10
- package/dist/components/input.stories.d.ts.map +0 -1
- package/dist/components/kbd.stories.d.ts +0 -9
- package/dist/components/kbd.stories.d.ts.map +0 -1
- package/dist/components/label.stories.d.ts +0 -8
- package/dist/components/label.stories.d.ts.map +0 -1
- package/dist/components/list-box.stories.d.ts +0 -9
- package/dist/components/list-box.stories.d.ts.map +0 -1
- package/dist/components/list-row.stories.d.ts +0 -21
- package/dist/components/list-row.stories.d.ts.map +0 -1
- package/dist/components/list.stories.d.ts +0 -27
- package/dist/components/list.stories.d.ts.map +0 -1
- package/dist/components/markdown-editor.stories.d.ts +0 -17
- package/dist/components/markdown-editor.stories.d.ts.map +0 -1
- package/dist/components/morph.stories.d.ts +0 -14
- package/dist/components/morph.stories.d.ts.map +0 -1
- package/dist/components/motion.stories.d.ts +0 -15
- package/dist/components/motion.stories.d.ts.map +0 -1
- package/dist/components/navigation-stack.stories.d.ts +0 -31
- package/dist/components/navigation-stack.stories.d.ts.map +0 -1
- package/dist/components/now-playing-bars.stories.d.ts +0 -12
- package/dist/components/now-playing-bars.stories.d.ts.map +0 -1
- package/dist/components/pencilkit/pencil-canvas.stories.d.ts +0 -18
- package/dist/components/pencilkit/pencil-canvas.stories.d.ts.map +0 -1
- package/dist/components/pencilkit/pencil-toolbar.stories.d.ts +0 -10
- package/dist/components/pencilkit/pencil-toolbar.stories.d.ts.map +0 -1
- package/dist/components/pencilkit/pk-icon.d.ts +0 -8
- package/dist/components/pencilkit/pk-icon.d.ts.map +0 -1
- package/dist/components/pill-button.d.ts +0 -11
- package/dist/components/pill-button.d.ts.map +0 -1
- package/dist/components/pill-button.stories.d.ts +0 -9
- package/dist/components/pill-button.stories.d.ts.map +0 -1
- package/dist/components/popover.stories.d.ts +0 -9
- package/dist/components/popover.stories.d.ts.map +0 -1
- package/dist/components/progress-ring.stories.d.ts +0 -15
- package/dist/components/progress-ring.stories.d.ts.map +0 -1
- package/dist/components/progress.stories.d.ts +0 -10
- package/dist/components/progress.stories.d.ts.map +0 -1
- package/dist/components/qr-svg.stories.d.ts +0 -16
- package/dist/components/qr-svg.stories.d.ts.map +0 -1
- package/dist/components/radio-group.stories.d.ts +0 -10
- package/dist/components/radio-group.stories.d.ts.map +0 -1
- package/dist/components/scroll-area.stories.d.ts +0 -8
- package/dist/components/scroll-area.stories.d.ts.map +0 -1
- package/dist/components/search-field.stories.d.ts +0 -10
- package/dist/components/search-field.stories.d.ts.map +0 -1
- package/dist/components/segmented.stories.d.ts +0 -8
- package/dist/components/segmented.stories.d.ts.map +0 -1
- package/dist/components/select.stories.d.ts +0 -12
- package/dist/components/select.stories.d.ts.map +0 -1
- package/dist/components/separator.stories.d.ts +0 -9
- package/dist/components/separator.stories.d.ts.map +0 -1
- package/dist/components/sheet.stories.d.ts +0 -12
- package/dist/components/sheet.stories.d.ts.map +0 -1
- package/dist/components/side-drawer.stories.d.ts +0 -8
- package/dist/components/side-drawer.stories.d.ts.map +0 -1
- package/dist/components/sidebar.stories.d.ts +0 -10
- package/dist/components/sidebar.stories.d.ts.map +0 -1
- package/dist/components/skeleton.stories.d.ts +0 -11
- package/dist/components/skeleton.stories.d.ts.map +0 -1
- package/dist/components/slider.stories.d.ts +0 -12
- package/dist/components/slider.stories.d.ts.map +0 -1
- package/dist/components/spinner.stories.d.ts +0 -9
- package/dist/components/spinner.stories.d.ts.map +0 -1
- package/dist/components/split-view.stories.d.ts +0 -51
- package/dist/components/split-view.stories.d.ts.map +0 -1
- package/dist/components/switch.stories.d.ts +0 -9
- package/dist/components/switch.stories.d.ts.map +0 -1
- package/dist/components/syntax-highlighting.stories.d.ts +0 -18
- package/dist/components/syntax-highlighting.stories.d.ts.map +0 -1
- package/dist/components/tab-bar.stories.d.ts +0 -8
- package/dist/components/tab-bar.stories.d.ts.map +0 -1
- package/dist/components/tab-view.stories.d.ts +0 -28
- package/dist/components/tab-view.stories.d.ts.map +0 -1
- package/dist/components/tabs.stories.d.ts +0 -9
- package/dist/components/tabs.stories.d.ts.map +0 -1
- package/dist/components/text-field.stories.d.ts +0 -9
- package/dist/components/text-field.stories.d.ts.map +0 -1
- package/dist/components/toast.stories.d.ts +0 -13
- package/dist/components/toast.stories.d.ts.map +0 -1
- package/dist/components/toggle-group.stories.d.ts +0 -10
- package/dist/components/toggle-group.stories.d.ts.map +0 -1
- package/dist/components/toggle.stories.d.ts +0 -9
- package/dist/components/toggle.stories.d.ts.map +0 -1
- package/dist/components/tooltip.stories.d.ts +0 -11
- package/dist/components/tooltip.stories.d.ts.map +0 -1
- package/dist/components/workbench/annotator.d.ts.map +0 -1
- package/dist/components/workbench/chat.d.ts.map +0 -1
- package/dist/components/workbench/chat.stories.d.ts +0 -13
- package/dist/components/workbench/chat.stories.d.ts.map +0 -1
- package/dist/components/workbench/composer-files.d.ts.map +0 -1
- package/dist/components/workbench/composer.d.ts.map +0 -1
- package/dist/components/workbench/composer.stories.d.ts +0 -35
- package/dist/components/workbench/composer.stories.d.ts.map +0 -1
- package/dist/components/workbench/fixtures.d.ts +0 -38
- package/dist/components/workbench/fixtures.d.ts.map +0 -1
- package/dist/components/workbench/markdown.d.ts.map +0 -1
- package/dist/components/workbench/message-scroller.d.ts.map +0 -1
- package/dist/components/workbench/message-scroller.stories.d.ts +0 -9
- package/dist/components/workbench/message-scroller.stories.d.ts.map +0 -1
- package/dist/components/workbench/model-picker.d.ts +0 -29
- package/dist/components/workbench/model-picker.d.ts.map +0 -1
- package/dist/components/workbench/models.d.ts +0 -32
- package/dist/components/workbench/models.d.ts.map +0 -1
- package/dist/components/workbench/snap-sheet.d.ts +0 -12
- package/dist/components/workbench/snap-sheet.d.ts.map +0 -1
- package/dist/components/workbench/snap-sheet.stories.d.ts +0 -8
- package/dist/components/workbench/snap-sheet.stories.d.ts.map +0 -1
- package/dist/components/workbench/surfaces.d.ts +0 -67
- package/dist/components/workbench/surfaces.d.ts.map +0 -1
- package/dist/components/workbench/surfaces.stories.d.ts +0 -15
- package/dist/components/workbench/surfaces.stories.d.ts.map +0 -1
- package/dist/components/workbench/terminal.d.ts +0 -43
- package/dist/components/workbench/terminal.d.ts.map +0 -1
- package/dist/components/workbench/terminal.stories.d.ts +0 -8
- package/dist/components/workbench/terminal.stories.d.ts.map +0 -1
- package/dist/components/workbench/thread-sidebar.d.ts +0 -100
- package/dist/components/workbench/thread-sidebar.d.ts.map +0 -1
- package/dist/components/workbench/thread-sidebar.stories.d.ts +0 -9
- package/dist/components/workbench/thread-sidebar.stories.d.ts.map +0 -1
- package/dist/components/workbench/wb-popover.d.ts.map +0 -1
- package/dist/components/workbench/workbench-composer.d.ts +0 -26
- package/dist/components/workbench/workbench-composer.d.ts.map +0 -1
- package/dist/demos/delivery/delivery-tracking-demo.d.ts +0 -41
- package/dist/demos/delivery/delivery-tracking-demo.d.ts.map +0 -1
- package/dist/demos/delivery/delivery-tracking-demo.stories.d.ts +0 -13
- package/dist/demos/delivery/delivery-tracking-demo.stories.d.ts.map +0 -1
- package/dist/demos/haptics-playground.d.ts +0 -18
- package/dist/demos/haptics-playground.d.ts.map +0 -1
- package/dist/demos/haptics-playground.stories.d.ts +0 -8
- package/dist/demos/haptics-playground.stories.d.ts.map +0 -1
- package/dist/demos/map-chat/geo.d.ts +0 -46
- package/dist/demos/map-chat/geo.d.ts.map +0 -1
- package/dist/demos/map-chat/map-agent.d.ts +0 -48
- package/dist/demos/map-chat/map-agent.d.ts.map +0 -1
- package/dist/demos/map-chat/map-chat-demo.d.ts +0 -19
- package/dist/demos/map-chat/map-chat-demo.d.ts.map +0 -1
- package/dist/demos/map-chat/map-chat-demo.stories.d.ts +0 -16
- package/dist/demos/map-chat/map-chat-demo.stories.d.ts.map +0 -1
- package/dist/demos/map-chat/map-icons.d.ts +0 -44
- package/dist/demos/map-chat/map-icons.d.ts.map +0 -1
- package/dist/demos/map-chat/places.d.ts +0 -29
- package/dist/demos/map-chat/places.d.ts.map +0 -1
- package/dist/demos/map-chat/tile-map.d.ts +0 -72
- package/dist/demos/map-chat/tile-map.d.ts.map +0 -1
- package/dist/demos/pencilkit/demo-strokes.d.ts +0 -4
- package/dist/demos/pencilkit/demo-strokes.d.ts.map +0 -1
- package/dist/demos/pencilkit/pencilkit-demo.d.ts +0 -15
- package/dist/demos/pencilkit/pencilkit-demo.d.ts.map +0 -1
- package/dist/demos/pencilkit/pencilkit-demo.stories.d.ts +0 -11
- package/dist/demos/pencilkit/pencilkit-demo.stories.d.ts.map +0 -1
- package/dist/demos/sidebar-demo.d.ts +0 -9
- package/dist/demos/sidebar-demo.d.ts.map +0 -1
- package/dist/demos/split-view-demos.d.ts +0 -50
- package/dist/demos/split-view-demos.d.ts.map +0 -1
- package/dist/lib/chat/chat-icon.d.ts +0 -24
- package/dist/lib/chat/chat-icon.d.ts.map +0 -1
- package/dist/lib/chat/chat-shell-context.d.ts +0 -19
- package/dist/lib/chat/chat-shell-context.d.ts.map +0 -1
- package/dist/lib/chat/chat-tokens.d.ts +0 -72
- package/dist/lib/chat/chat-tokens.d.ts.map +0 -1
- package/dist/lib/chat/chat-users.d.ts +0 -18
- package/dist/lib/chat/chat-users.d.ts.map +0 -1
- package/dist/lib/chat/kvib.d.ts +0 -3
- package/dist/lib/chat/kvib.d.ts.map +0 -1
- package/dist/lib/chat/persistent-host.d.ts.map +0 -1
- package/dist/lib/chat/title-ref.d.ts +0 -3
- package/dist/lib/chat/title-ref.d.ts.map +0 -1
- package/dist/lib/haptics.d.ts +0 -27
- package/dist/lib/haptics.d.ts.map +0 -1
- package/dist/lib/icon.stories.d.ts +0 -15
- package/dist/lib/icon.stories.d.ts.map +0 -1
- package/dist/lib/pencilkit/constants.d.ts.map +0 -1
- package/dist/lib/workbench/haptics.d.ts +0 -3
- package/dist/lib/workbench/haptics.d.ts.map +0 -1
- package/dist/lib/workbench/icons.d.ts +0 -29
- package/dist/lib/workbench/icons.d.ts.map +0 -1
- package/dist/lib/workbench/motion.d.ts +0 -83
- package/dist/lib/workbench/motion.d.ts.map +0 -1
- package/dist/lib/workbench/press.d.ts +0 -10
- package/dist/lib/workbench/press.d.ts.map +0 -1
- package/dist/lib/workbench/theme.d.ts.map +0 -1
- package/dist/lib/workbench/util.d.ts +0 -6
- package/dist/lib/workbench/util.d.ts.map +0 -1
- package/dist/stories/frame.d.ts +0 -16
- package/dist/stories/frame.d.ts.map +0 -1
- package/dist/stories/primitive-frame.d.ts +0 -20
- package/dist/stories/primitive-frame.d.ts.map +0 -1
- package/dist/templates/artifact-chat-container.d.ts.map +0 -1
- package/dist/templates/artifact-chat-container.stories.d.ts +0 -24
- package/dist/templates/artifact-chat-container.stories.d.ts.map +0 -1
- package/dist/templates/chat-shell.d.ts +0 -86
- package/dist/templates/chat-shell.d.ts.map +0 -1
- package/dist/templates/chat-shell.stories.d.ts +0 -22
- package/dist/templates/chat-shell.stories.d.ts.map +0 -1
- package/dist/templates/workbench-shell.d.ts +0 -177
- package/dist/templates/workbench-shell.d.ts.map +0 -1
- package/dist/templates/workbench-shell.stories.d.ts +0 -17
- package/dist/templates/workbench-shell.stories.d.ts.map +0 -1
- /package/dist/components/{chat/chat-column.d.ts → chat-column.d.ts} +0 -0
- /package/dist/components/{workbench → composer}/annotator.d.ts +0 -0
- /package/dist/components/{workbench → composer}/composer-files.d.ts +0 -0
- /package/dist/components/{workbench/message-scroller.d.ts → message-scroller.d.ts} +0 -0
- /package/dist/components/{chat/progress-stepper.d.ts → progress-stepper.d.ts} +0 -0
|
@@ -0,0 +1,1633 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e, pressable as t } from "../../lib/utils.js";
|
|
3
|
+
import { flipPlay as n, flipSnapshot as r, prefersReducedMotion as i, springs as a } from "../../lib/motion.js";
|
|
4
|
+
import { TextMorph as o } from "../text-morph.js";
|
|
5
|
+
import { Icon as s } from "../../lib/icon.js";
|
|
6
|
+
import { themeScopeProps as c } from "../../lib/theme.js";
|
|
7
|
+
import { useSheetDrag as l } from "../../lib/sheet-drag.js";
|
|
8
|
+
import { insertMarkdown as u, looksLikeMarkdown as d } from "../markdown-editor.js";
|
|
9
|
+
import { PlainButton as f, PlainToggleButton as p } from "../plain-button.js";
|
|
10
|
+
import { WbPopover as m } from "./composer-popover.js";
|
|
11
|
+
import { useComposerAnnotator as h } from "./annotator.js";
|
|
12
|
+
import { useToast as g } from "../toast.js";
|
|
13
|
+
import { acceptsFile as _, attachmentFileName as v, attachmentKind as y, describeAccepted as b, fileExtension as x, formatFileSize as S, readFileAsDataURL as C, textExcerpt as w, videoPoster as T } from "./composer-files.js";
|
|
14
|
+
import { AnimatePresence as E, animate as D, motion as O } from "framer-motion";
|
|
15
|
+
import * as k from "react";
|
|
16
|
+
import { useRef as A, useState as j } from "react";
|
|
17
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
18
|
+
import { Dialog as F, FileTrigger as I, Menu as L, MenuItem as ee, MenuTrigger as R, Modal as z, ModalOverlay as te, VisuallyHidden as ne, composeRenderProps as re, useDrop as ie } from "react-aria-components";
|
|
19
|
+
import { cva as B } from "class-variance-authority";
|
|
20
|
+
import { createPortal as ae } from "react-dom";
|
|
21
|
+
import { GitbookEditor as oe } from "@brett_lamy/docstream-editor/editor";
|
|
22
|
+
import { useButton as V } from "react-aria/useButton";
|
|
23
|
+
import { useClipboard as se } from "react-aria/useClipboard";
|
|
24
|
+
import { useFocusRing as ce } from "react-aria/useFocusRing";
|
|
25
|
+
import { mergeProps as le } from "react-aria/mergeProps";
|
|
26
|
+
import { Extension as H } from "@tiptap/core";
|
|
27
|
+
import { Plugin as ue } from "@tiptap/pm/state";
|
|
28
|
+
//#region src/components/composer/composer.tsx
|
|
29
|
+
var de = k.createContext(null);
|
|
30
|
+
function U() {
|
|
31
|
+
let e = k.useContext(de);
|
|
32
|
+
if (!e) throw Error("useComposer must be used within <Composer>");
|
|
33
|
+
return e;
|
|
34
|
+
}
|
|
35
|
+
var fe = k.createContext(null);
|
|
36
|
+
function W({ parts: e, renderCard: t, className: n, children: r }) {
|
|
37
|
+
let i = k.useMemo(() => ({
|
|
38
|
+
parts: e,
|
|
39
|
+
renderCard: t,
|
|
40
|
+
className: n
|
|
41
|
+
}), [
|
|
42
|
+
e,
|
|
43
|
+
t,
|
|
44
|
+
n
|
|
45
|
+
]);
|
|
46
|
+
return /* @__PURE__ */ N(fe.Provider, {
|
|
47
|
+
value: i,
|
|
48
|
+
children: r
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function G(e, t, n) {
|
|
52
|
+
let [r, i] = j(t), a = e === void 0 ? r : e, o = A(a);
|
|
53
|
+
return o.current = a, [a, k.useCallback((t) => {
|
|
54
|
+
let r = typeof t == "function" ? t(o.current) : t;
|
|
55
|
+
o.current = r, e === void 0 && i(r), n?.(r);
|
|
56
|
+
}, [e === void 0, n])];
|
|
57
|
+
}
|
|
58
|
+
var pe = () => "att-" + Math.random().toString(36).slice(2, 12);
|
|
59
|
+
function me(e) {
|
|
60
|
+
if (e.kind) return e.kind;
|
|
61
|
+
let t = y(e.type, e.name);
|
|
62
|
+
return t === "other" && !e.type && (!e.src || e.src.startsWith("data:image/")) ? "image" : t;
|
|
63
|
+
}
|
|
64
|
+
function he({ value: t, defaultValue: n = "", onValueChange: r, attachments: a, defaultAttachments: o = [], onAttachmentsChange: s, expanded: c, defaultExpanded: l = !1, onExpandedChange: u, streaming: d = !1, onStop: f, onSubmit: p, annotator: m, annotateCanvas: x, acceptedFileTypes: E, maxFileSize: D, maxFiles: O, onDropFiles: M, onFilesRejected: F, collapsed: I, defaultCollapsed: L = "none", onCollapsedChange: ee, collapseOnScroll: R, collapseTo: z = "compact", collapseAnchor: te = "bottom", fabPosition: re = "end", fabIcon: ie, children: B, className: ae, style: oe, ref: V }) {
|
|
65
|
+
let se = k.useContext(fe), ce = h(), le = m === void 0 ? ce : m, [H, ue] = G(t, n, r), [U, W] = G(a, o, s), [he, be] = G(c, l, u), [K, q] = G(I, L, ee), [J, Ce] = j(null), [we, Te] = j(null), [Ee, De] = j(null), Y = A(null), Oe = A(H);
|
|
66
|
+
Oe.current = H;
|
|
67
|
+
let X = A(U);
|
|
68
|
+
X.current = U;
|
|
69
|
+
let ke = !!(H.trim() || U.length), Ae = k.useCallback((e) => W((t) => t.some((t) => t.id === e.id) ? t : [...t, e]), [W]), Z = k.useCallback((e, t) => W((n) => n.map((n) => n.id === e ? {
|
|
70
|
+
...n,
|
|
71
|
+
...t
|
|
72
|
+
} : n)), [W]), je = (e) => {
|
|
73
|
+
J?.commands.removeAttachment(e), W((t) => t.filter((t) => t.id !== e));
|
|
74
|
+
}, Q = A(/* @__PURE__ */ new Map()), Me = A([]), Ne = A(0);
|
|
75
|
+
k.useEffect(() => {
|
|
76
|
+
let e = new Set(U.map((e) => e.id));
|
|
77
|
+
Q.current.forEach((t, n) => {
|
|
78
|
+
e.has(n) || (URL.revokeObjectURL(t), Q.current.delete(n));
|
|
79
|
+
});
|
|
80
|
+
}, [U]), k.useEffect(() => () => {
|
|
81
|
+
Q.current.forEach((e) => URL.revokeObjectURL(e)), Q.current.clear(), Me.current.forEach((e) => URL.revokeObjectURL(e)), Me.current = [];
|
|
82
|
+
}, []);
|
|
83
|
+
let Pe = g(), [Fe, Ie] = j(""), Le = (e) => {
|
|
84
|
+
if (!e.length) return;
|
|
85
|
+
if (F) return F(e);
|
|
86
|
+
let t = (e) => {
|
|
87
|
+
let t = e.map((e) => e.file.name || "a file"), n = t.slice(0, 2).join(t.length === 2 ? " and " : ", ");
|
|
88
|
+
return t.length > 2 ? `${n} and ${t.length - 2} more` : n;
|
|
89
|
+
}, n = (t) => e.filter((e) => e.reason === t), [r, i, a] = [
|
|
90
|
+
n("type"),
|
|
91
|
+
n("size"),
|
|
92
|
+
n("count")
|
|
93
|
+
], o = (e) => e.length > 1 ? "are" : "is", s = [
|
|
94
|
+
r.length && `${t(r)} ${o(r)} not a type this composer takes (${b(E)}).`,
|
|
95
|
+
i.length && `${t(i)} ${o(i)} over the ${S(D)} limit.`,
|
|
96
|
+
a.length && `${t(a)} didn't fit — a draft holds ${O} attachment${O === 1 ? "" : "s"}.`
|
|
97
|
+
].filter(Boolean), c = e.length;
|
|
98
|
+
Pe.warning(c === 1 ? "Couldn't attach a file" : `Couldn't attach ${c} files`, {
|
|
99
|
+
id: "composer-files-rejected",
|
|
100
|
+
description: s.join(" ")
|
|
101
|
+
});
|
|
102
|
+
}, Re = (e, t) => {
|
|
103
|
+
let n = J;
|
|
104
|
+
if (!n || n.isDestroyed || !e.length) return;
|
|
105
|
+
let r = t === void 0 ? void 0 : Math.min(t, n.state.doc.content.size), i = r === void 0 ? n.state.selection.$from : n.state.doc.resolve(r), a = i.parent.isTextblock ? i.parent.textBetween(Math.max(0, i.parentOffset - 1), i.parentOffset, "", "") : "", o = [...a && !/\s/.test(a) ? [{
|
|
106
|
+
type: "text",
|
|
107
|
+
text: " "
|
|
108
|
+
}] : [], ...e.flatMap(({ id: e, name: t }) => [{
|
|
109
|
+
type: "gbAttachment",
|
|
110
|
+
attrs: {
|
|
111
|
+
id: e,
|
|
112
|
+
name: t
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
type: "text",
|
|
116
|
+
text: " "
|
|
117
|
+
}])], s = n.chain().focus();
|
|
118
|
+
(r === void 0 ? s.insertContent(o) : s.insertContentAt(r, o)).run();
|
|
119
|
+
}, ze = (e, { source: t = "api", point: n } = {}) => {
|
|
120
|
+
let r = [], i = e.filter((e) => {
|
|
121
|
+
if (!_(e, E)) r.push({
|
|
122
|
+
file: e,
|
|
123
|
+
reason: "type"
|
|
124
|
+
});
|
|
125
|
+
else if (D != null && e.size > D) r.push({
|
|
126
|
+
file: e,
|
|
127
|
+
reason: "size"
|
|
128
|
+
});
|
|
129
|
+
else return !0;
|
|
130
|
+
return !1;
|
|
131
|
+
});
|
|
132
|
+
if (O != null) {
|
|
133
|
+
let e = Math.max(0, O - X.current.length - Ne.current);
|
|
134
|
+
i.slice(e).forEach((e) => r.push({
|
|
135
|
+
file: e,
|
|
136
|
+
reason: "count"
|
|
137
|
+
})), i = i.slice(0, e);
|
|
138
|
+
}
|
|
139
|
+
if (Le(r), i.length && M) {
|
|
140
|
+
let e = M(i, t);
|
|
141
|
+
e === !1 ? i = [] : Array.isArray(e) && (i = e);
|
|
142
|
+
}
|
|
143
|
+
if (!i.length) return;
|
|
144
|
+
let a = i.map((e) => {
|
|
145
|
+
let t = y(e.type, e.name);
|
|
146
|
+
return {
|
|
147
|
+
file: e,
|
|
148
|
+
kind: t,
|
|
149
|
+
id: pe(),
|
|
150
|
+
name: v(e, t === "image" ? "image.png" : "file")
|
|
151
|
+
};
|
|
152
|
+
}), o = a.filter((e) => e.kind === "image"), s;
|
|
153
|
+
if (n && J && !J.isDestroyed) {
|
|
154
|
+
let e = typeof document < "u" ? document.elementFromPoint(n.x, n.y) : null;
|
|
155
|
+
e && J.view.dom.contains(e) && (s = J.view.posAtCoords({
|
|
156
|
+
left: n.x,
|
|
157
|
+
top: n.y
|
|
158
|
+
})?.pos);
|
|
159
|
+
}
|
|
160
|
+
Re(o, s), Ie(`Attached ${i.length === 1 ? a[0].name : `${i.length} files`}.`);
|
|
161
|
+
for (let { file: e, kind: t, id: n, name: r } of a) {
|
|
162
|
+
let i = {
|
|
163
|
+
id: n,
|
|
164
|
+
name: r,
|
|
165
|
+
size: e.size,
|
|
166
|
+
type: e.type,
|
|
167
|
+
kind: t,
|
|
168
|
+
file: e
|
|
169
|
+
};
|
|
170
|
+
Ne.current++;
|
|
171
|
+
let a = (e) => {
|
|
172
|
+
Ne.current--, Ae(e);
|
|
173
|
+
};
|
|
174
|
+
if (t === "image") {
|
|
175
|
+
C(e).then((e) => a({
|
|
176
|
+
...i,
|
|
177
|
+
src: e
|
|
178
|
+
}), () => a(i));
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
let o = URL.createObjectURL(e);
|
|
182
|
+
Q.current.set(n, o), t === "text" ? w(e).then((e) => a({
|
|
183
|
+
...i,
|
|
184
|
+
src: o,
|
|
185
|
+
excerpt: e
|
|
186
|
+
})) : t === "video" ? T(o, { timeout: 2500 }).then((e) => a({
|
|
187
|
+
...i,
|
|
188
|
+
src: o,
|
|
189
|
+
preview: e
|
|
190
|
+
})) : a({
|
|
191
|
+
...i,
|
|
192
|
+
src: o
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}, Be = () => {
|
|
196
|
+
if (!ke || d) return;
|
|
197
|
+
let e = Oe.current.trim(), t = X.current;
|
|
198
|
+
for (let e of t) {
|
|
199
|
+
let t = Q.current.get(e.id);
|
|
200
|
+
t && (Me.current.push(t), Q.current.delete(e.id));
|
|
201
|
+
}
|
|
202
|
+
W([]), J && J.commands.clearContent(!0), ue(""), p?.(e, t);
|
|
203
|
+
}, Ve = () => {
|
|
204
|
+
f?.();
|
|
205
|
+
}, He = A({
|
|
206
|
+
collapsed: K,
|
|
207
|
+
collapseTo: z,
|
|
208
|
+
streaming: d,
|
|
209
|
+
draft: !1,
|
|
210
|
+
blocked: () => !1,
|
|
211
|
+
set: q
|
|
212
|
+
});
|
|
213
|
+
He.current = {
|
|
214
|
+
collapsed: K,
|
|
215
|
+
collapseTo: z,
|
|
216
|
+
streaming: d,
|
|
217
|
+
draft: !!H.trim(),
|
|
218
|
+
blocked: () => !!we || U.length > 0 || !!(Y.current && typeof document < "u" && Y.current.contains(document.activeElement)),
|
|
219
|
+
set: q
|
|
220
|
+
}, k.useEffect(() => {
|
|
221
|
+
let e = R?.current;
|
|
222
|
+
if (!e) return;
|
|
223
|
+
let t = () => te === "top" ? e.scrollTop : e.scrollHeight - e.scrollTop - e.clientHeight, n = t(), r = 0, i = [{
|
|
224
|
+
t: performance.now(),
|
|
225
|
+
d: n
|
|
226
|
+
}], a = () => {
|
|
227
|
+
let e = performance.now(), a = t(), o = a - n;
|
|
228
|
+
for (n = a; i.length > 1 && e - i[0].t > ve;) i.shift();
|
|
229
|
+
let s = i[0], c = (a - s.d) / Math.max(ve, e - s.t);
|
|
230
|
+
i.push({
|
|
231
|
+
t: e,
|
|
232
|
+
d: a
|
|
233
|
+
});
|
|
234
|
+
let l = He.current;
|
|
235
|
+
if (a < ge) {
|
|
236
|
+
r = 0, l.collapsed !== "none" && l.set("none");
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (o < 0) {
|
|
240
|
+
r = Math.min(0, r) + o, l.collapsed === "fab" && r < -160 && l.set("compact");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (o !== 0) {
|
|
244
|
+
if (l.blocked()) {
|
|
245
|
+
r = 0;
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
r = Math.max(0, r) + o, l.collapseTo === "fab" && !l.streaming && !l.draft && l.collapsed !== "fab" && (c > _e || r > ye) ? l.set("fab") : l.collapsed === "none" && r > 24 && l.set("compact");
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
return e.addEventListener("scroll", a, { passive: !0 }), () => e.removeEventListener("scroll", a);
|
|
252
|
+
}, [R, te]);
|
|
253
|
+
let Ue = `${K}|${he}`, We = A(Ue), Ge = A(null);
|
|
254
|
+
Ue !== We.current && !Ge.current && typeof window < "u" && (Ge.current = xe(Y.current)), k.useLayoutEffect(() => {
|
|
255
|
+
We.current = Ue;
|
|
256
|
+
let e = Ge.current;
|
|
257
|
+
Ge.current = null, e && !i() && Se(Y.current, e);
|
|
258
|
+
}, [Ue]);
|
|
259
|
+
let Ke = () => {
|
|
260
|
+
q("none"), requestAnimationFrame(() => J?.commands.focus("end"));
|
|
261
|
+
}, qe = !!R || I !== void 0 || L === "fab" || z === "fab", Je = A(void 0), Ye = A(null), Xe = {
|
|
262
|
+
value: H,
|
|
263
|
+
setValue: ue,
|
|
264
|
+
attachments: U,
|
|
265
|
+
addAttachment: Ae,
|
|
266
|
+
removeAttachment: je,
|
|
267
|
+
updateAttachment: Z,
|
|
268
|
+
attachFiles: ze,
|
|
269
|
+
acceptedFileTypes: E,
|
|
270
|
+
expanded: he,
|
|
271
|
+
setExpanded: be,
|
|
272
|
+
streaming: d,
|
|
273
|
+
canSend: ke,
|
|
274
|
+
send: Be,
|
|
275
|
+
stop: Ve,
|
|
276
|
+
annotate: (e) => {
|
|
277
|
+
let t = X.current.find((t) => t.id === e);
|
|
278
|
+
if (t && me(t) !== "image") return;
|
|
279
|
+
let n = typeof CSS < "u" ? CSS.escape(e) : e, r = Ye.current;
|
|
280
|
+
Je.current = () => {
|
|
281
|
+
let t = r?.isConnected && r.getAttribute("data-attachment-id") === e ? r : Y.current?.querySelector(`[data-slot="composer-attachment"][data-attachment-id="${n}"]`);
|
|
282
|
+
return t?.querySelector("img") ?? t ?? null;
|
|
283
|
+
}, Te(e);
|
|
284
|
+
},
|
|
285
|
+
canAnnotate: x !== void 0 || !!le,
|
|
286
|
+
editor: J,
|
|
287
|
+
setEditor: Ce,
|
|
288
|
+
rootRef: Y,
|
|
289
|
+
renderCard: se?.renderCard,
|
|
290
|
+
collapsed: K,
|
|
291
|
+
setCollapsed: q,
|
|
292
|
+
optionsOutlet: Ee,
|
|
293
|
+
setOptionsOutlet: De,
|
|
294
|
+
fab: qe ? {
|
|
295
|
+
icon: ie,
|
|
296
|
+
restore: Ke
|
|
297
|
+
} : null
|
|
298
|
+
}, $ = we ? U.find((e) => e.id === we) : void 0;
|
|
299
|
+
return /* @__PURE__ */ N(de.Provider, {
|
|
300
|
+
value: Xe,
|
|
301
|
+
children: /* @__PURE__ */ P(fe.Provider, {
|
|
302
|
+
value: null,
|
|
303
|
+
children: [/* @__PURE__ */ P("div", {
|
|
304
|
+
ref: (e) => {
|
|
305
|
+
Y.current = e, typeof V == "function" ? V(e) : V && (V.current = e);
|
|
306
|
+
},
|
|
307
|
+
"data-slot": "composer",
|
|
308
|
+
"data-streaming": d || void 0,
|
|
309
|
+
"data-expanded": he || void 0,
|
|
310
|
+
"data-collapsed": K,
|
|
311
|
+
"data-fab-position": re,
|
|
312
|
+
onPointerDownCapture: (e) => {
|
|
313
|
+
Ye.current = e.target.closest?.("[data-attachment-id]") ?? null;
|
|
314
|
+
},
|
|
315
|
+
className: e("group/composer relative box-border flex w-full min-w-0 flex-col", se?.className, ae),
|
|
316
|
+
style: oe,
|
|
317
|
+
children: [/* @__PURE__ */ P("div", {
|
|
318
|
+
"data-slot": "composer-stack",
|
|
319
|
+
className: "flex min-w-0 flex-col",
|
|
320
|
+
children: [se?.parts, B]
|
|
321
|
+
}), /* @__PURE__ */ N(ne, { children: /* @__PURE__ */ N("span", {
|
|
322
|
+
"data-slot": "composer-announcer",
|
|
323
|
+
role: "status",
|
|
324
|
+
"aria-live": "polite",
|
|
325
|
+
children: Fe
|
|
326
|
+
}) })]
|
|
327
|
+
}), $?.src ? /* @__PURE__ */ N(ct, {
|
|
328
|
+
src: $.src,
|
|
329
|
+
canvas: x,
|
|
330
|
+
annotator: le,
|
|
331
|
+
origin: Je.current,
|
|
332
|
+
onClose: () => Te(null),
|
|
333
|
+
onSave: (e) => {
|
|
334
|
+
Z($.id, {
|
|
335
|
+
src: e,
|
|
336
|
+
type: "image/png"
|
|
337
|
+
}), Te(null);
|
|
338
|
+
}
|
|
339
|
+
}, $.id) : null]
|
|
340
|
+
})
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
var ge = 72, _e = 2, ve = 100, ye = 420, be = "[data-slot=\"composer-footer\"] > :not([data-slot=\"composer-spacer\"]):not([data-slot=\"composer-options-home\"]), [data-slot=\"composer-options\"] > *, [data-slot=\"composer-expand\"]", K = /* @__PURE__ */ new WeakMap();
|
|
344
|
+
function q(e) {
|
|
345
|
+
return Array.from(e?.querySelectorAll(":scope > [data-slot=\"composer-stack\"] > [data-slot=\"composer-bump\"]") ?? []);
|
|
346
|
+
}
|
|
347
|
+
function xe(e) {
|
|
348
|
+
let t = e?.querySelector("[data-slot=\"composer-card\"]");
|
|
349
|
+
return !e || !t ? null : {
|
|
350
|
+
card: t.getBoundingClientRect(),
|
|
351
|
+
controls: r(e.querySelectorAll(be)),
|
|
352
|
+
bumps: new Map(q(e).map((e) => [e, e.getBoundingClientRect().height]))
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function Se(e, t) {
|
|
356
|
+
let r = e?.querySelector("[data-slot=\"composer-card\"]");
|
|
357
|
+
if (!e || !r) return;
|
|
358
|
+
let i = a.smooth, o = /* @__PURE__ */ new Map();
|
|
359
|
+
t.bumps.forEach((e, t) => {
|
|
360
|
+
t.isConnected && (t.style.height = "", o.set(t, t.getBoundingClientRect().height));
|
|
361
|
+
}), r.style.width = "", r.style.height = "", r.style.transform = "";
|
|
362
|
+
let s = r.getBoundingClientRect(), c = t.card;
|
|
363
|
+
r.style.width = `${c.width}px`, r.style.height = `${c.height}px`, t.bumps.forEach((e, t) => t.isConnected && (t.style.height = `${e}px`));
|
|
364
|
+
let l = r.getBoundingClientRect(), u = (K.get(r) ?? 0) + 1;
|
|
365
|
+
K.set(r, u), D(r, {
|
|
366
|
+
width: [c.width, s.width],
|
|
367
|
+
height: [c.height, s.height],
|
|
368
|
+
x: [c.left - l.left, 0],
|
|
369
|
+
y: [c.top - l.top, 0]
|
|
370
|
+
}, {
|
|
371
|
+
...i,
|
|
372
|
+
onComplete: () => {
|
|
373
|
+
K.get(r) === u && (r.style.width = "", r.style.height = "", r.style.transform = "");
|
|
374
|
+
}
|
|
375
|
+
}), t.bumps.forEach((e, t) => {
|
|
376
|
+
let n = o.get(t);
|
|
377
|
+
if (n != null) {
|
|
378
|
+
if (Math.abs(n - e) < 1) {
|
|
379
|
+
t.style.height = "";
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
K.set(t, u), D(t, { height: [e, n] }, {
|
|
383
|
+
...i,
|
|
384
|
+
onComplete: () => K.get(t) === u && (t.style.height = "")
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
let d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
389
|
+
t.controls.forEach((e, t) => {
|
|
390
|
+
let n = t.parentElement?.getAttribute("data-slot") === "composer-options", i = e.top >= c.top - 1 && e.bottom <= c.bottom + 1, a = r.contains(t);
|
|
391
|
+
(n && i !== a ? f : d).set(t, e);
|
|
392
|
+
}), r.style.width = "", r.style.height = "", n(d, { relativeTo: [c, s] }), n(f, { lift: !0 }), r.style.width = `${c.width}px`, r.style.height = `${c.height}px`;
|
|
393
|
+
}
|
|
394
|
+
var J = B([t, "z-3 grid size-[52px] cursor-pointer place-items-center rounded-[50%] border border-border bg-card p-0 text-foreground shadow-[0_10px_30px_-8px_color-mix(in_srgb,black_45%,transparent),0_2px_8px_color-mix(in_srgb,black_14%,transparent)] outline-none data-focus-visible:ring-2 data-focus-visible:ring-primary/60"]);
|
|
395
|
+
function Ce({ className: t, children: n, "aria-label": r = "Open composer", ...i }) {
|
|
396
|
+
return /* @__PURE__ */ N(f, {
|
|
397
|
+
"data-slot": "composer-fab",
|
|
398
|
+
"aria-label": r,
|
|
399
|
+
className: e(J(), t),
|
|
400
|
+
...i,
|
|
401
|
+
children: n ?? /* @__PURE__ */ N(s, {
|
|
402
|
+
name: "square-pencil",
|
|
403
|
+
size: 21,
|
|
404
|
+
sw: 1.9
|
|
405
|
+
})
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
function we({ children: e }) {
|
|
409
|
+
let { collapsed: t, optionsOutlet: n } = U(), r = A(null), [i] = j(() => {
|
|
410
|
+
if (typeof document > "u") return null;
|
|
411
|
+
let e = document.createElement("span");
|
|
412
|
+
return e.setAttribute("data-slot", "composer-options"), e.style.display = "contents", e;
|
|
413
|
+
});
|
|
414
|
+
return k.useLayoutEffect(() => {
|
|
415
|
+
let e = t === "compact" && n ? n : r.current;
|
|
416
|
+
i && e && i.parentNode !== e && e.appendChild(i);
|
|
417
|
+
}, [
|
|
418
|
+
t,
|
|
419
|
+
n,
|
|
420
|
+
i
|
|
421
|
+
]), k.useEffect(() => () => i?.remove(), [i]), /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("span", {
|
|
422
|
+
ref: r,
|
|
423
|
+
"data-slot": "composer-options-home",
|
|
424
|
+
className: "contents"
|
|
425
|
+
}), i ? ae(e, i) : null] });
|
|
426
|
+
}
|
|
427
|
+
function Te({ className: t }) {
|
|
428
|
+
let { collapsed: n, setOptionsOutlet: r } = U(), i = n === "compact";
|
|
429
|
+
return /* @__PURE__ */ P(M, { children: [i ? /* @__PURE__ */ N(Me, {}) : null, /* @__PURE__ */ N("span", {
|
|
430
|
+
ref: r,
|
|
431
|
+
"data-slot": "composer-options-outlet",
|
|
432
|
+
className: e(i ? "contents" : "hidden", t)
|
|
433
|
+
})] });
|
|
434
|
+
}
|
|
435
|
+
var Ee = B("relative z-1 box-border flex min-w-0 flex-wrap items-center border border-border bg-card", {
|
|
436
|
+
variants: { size: {
|
|
437
|
+
default: "rounded-[15px] shadow-[0_6px_24px_black] shadow-black/8 dark:shadow-black/28",
|
|
438
|
+
lg: "rounded-[22px] shadow-[0_8px_30px_black] shadow-black/8 dark:shadow-black/22"
|
|
439
|
+
} },
|
|
440
|
+
defaultVariants: { size: "default" }
|
|
441
|
+
});
|
|
442
|
+
async function De(e, t = 500) {
|
|
443
|
+
let n = [], r = async (e) => {
|
|
444
|
+
for await (let i of e) {
|
|
445
|
+
if (n.length >= t) return;
|
|
446
|
+
i.kind === "file" ? n.push(await i.getFile()) : i.kind === "directory" && await r(i.getEntries());
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
return await r(e), n;
|
|
450
|
+
}
|
|
451
|
+
var Y = (e) => !!e.dataTransfer && Array.from(e.dataTransfer.types ?? []).includes("Files");
|
|
452
|
+
function Oe(e, t) {
|
|
453
|
+
let { attachFiles: n } = U(), r = A(n);
|
|
454
|
+
r.current = n;
|
|
455
|
+
let i = A(null), a = A([]), o = async (e, t, n) => {
|
|
456
|
+
let i = a.current;
|
|
457
|
+
a.current = [];
|
|
458
|
+
let o = await De(e), s = o.length ? o : i;
|
|
459
|
+
s.length && r.current(s, {
|
|
460
|
+
source: t,
|
|
461
|
+
point: n
|
|
462
|
+
});
|
|
463
|
+
}, { dropProps: s, dropButtonProps: c, isDropTarget: l } = ie({
|
|
464
|
+
ref: i,
|
|
465
|
+
hasDropButton: !0,
|
|
466
|
+
isDisabled: t,
|
|
467
|
+
getDropOperation: () => "copy",
|
|
468
|
+
onDrop: (t) => {
|
|
469
|
+
let n = e.current?.getBoundingClientRect(), r = n && (t.x || t.y) ? {
|
|
470
|
+
x: n.left + t.x,
|
|
471
|
+
y: n.top + t.y
|
|
472
|
+
} : void 0;
|
|
473
|
+
o(t.items, "drop", r);
|
|
474
|
+
}
|
|
475
|
+
}), { buttonProps: u } = V({
|
|
476
|
+
...c,
|
|
477
|
+
isDisabled: t || c?.isDisabled
|
|
478
|
+
}, i), { clipboardProps: d } = se({
|
|
479
|
+
isDisabled: t,
|
|
480
|
+
onPaste: (e) => void o(e, "paste")
|
|
481
|
+
}), { focusProps: f, isFocusVisible: p } = ce(), m = (e) => (t) => {
|
|
482
|
+
Y(t) && e?.(t);
|
|
483
|
+
};
|
|
484
|
+
return {
|
|
485
|
+
dropProps: {
|
|
486
|
+
onDragEnter: m(s.onDragEnter),
|
|
487
|
+
onDragOver: m(s.onDragOver),
|
|
488
|
+
onDragLeave: m(s.onDragLeave),
|
|
489
|
+
onDrop: m((e) => {
|
|
490
|
+
a.current = Array.from(e.dataTransfer.files ?? []), s.onDrop?.(e);
|
|
491
|
+
})
|
|
492
|
+
},
|
|
493
|
+
buttonProps: le(u, d, f),
|
|
494
|
+
buttonRef: i,
|
|
495
|
+
isDropTarget: l,
|
|
496
|
+
isFocusVisible: p
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function X({ state: t, label: n, hint: r }) {
|
|
500
|
+
return /* @__PURE__ */ N(E, { children: t ? /* @__PURE__ */ N(O.div, {
|
|
501
|
+
"data-slot": "composer-drop-overlay",
|
|
502
|
+
"data-state": t,
|
|
503
|
+
"aria-hidden": "true",
|
|
504
|
+
className: e("pointer-events-none absolute -inset-px z-4 flex items-center justify-center overflow-hidden rounded-[inherit] border-2 border-primary", t === "drop" ? "bg-[color-mix(in_srgb,var(--primary)_11%,var(--card))]" : "border-dashed bg-[color-mix(in_srgb,var(--primary)_6%,var(--card))]"),
|
|
505
|
+
initial: {
|
|
506
|
+
opacity: 0,
|
|
507
|
+
scale: .985
|
|
508
|
+
},
|
|
509
|
+
animate: {
|
|
510
|
+
opacity: 1,
|
|
511
|
+
scale: 1
|
|
512
|
+
},
|
|
513
|
+
exit: {
|
|
514
|
+
opacity: 0,
|
|
515
|
+
scale: .985
|
|
516
|
+
},
|
|
517
|
+
transition: a.snappy,
|
|
518
|
+
children: /* @__PURE__ */ P(O.div, {
|
|
519
|
+
className: "flex min-w-0 items-center gap-2.5 px-4",
|
|
520
|
+
initial: {
|
|
521
|
+
y: 8,
|
|
522
|
+
opacity: 0
|
|
523
|
+
},
|
|
524
|
+
animate: {
|
|
525
|
+
y: 0,
|
|
526
|
+
opacity: 1
|
|
527
|
+
},
|
|
528
|
+
exit: {
|
|
529
|
+
y: 8,
|
|
530
|
+
opacity: 0
|
|
531
|
+
},
|
|
532
|
+
transition: a.bouncy,
|
|
533
|
+
children: [/* @__PURE__ */ N(O.span, {
|
|
534
|
+
className: "grid size-8 shrink-0 place-items-center rounded-full bg-primary text-white shadow-[0_4px_14px_-4px_var(--primary)] group-data-[collapsed=compact]/composer:size-6",
|
|
535
|
+
initial: {
|
|
536
|
+
scale: .4,
|
|
537
|
+
rotate: -90
|
|
538
|
+
},
|
|
539
|
+
animate: {
|
|
540
|
+
scale: 1,
|
|
541
|
+
rotate: 0
|
|
542
|
+
},
|
|
543
|
+
exit: {
|
|
544
|
+
scale: .4,
|
|
545
|
+
rotate: -90
|
|
546
|
+
},
|
|
547
|
+
transition: a.bouncy,
|
|
548
|
+
children: /* @__PURE__ */ N(s, {
|
|
549
|
+
name: "plus",
|
|
550
|
+
size: 16,
|
|
551
|
+
sw: 2.6
|
|
552
|
+
})
|
|
553
|
+
}), /* @__PURE__ */ P("span", {
|
|
554
|
+
className: "flex min-w-0 flex-col",
|
|
555
|
+
children: [/* @__PURE__ */ N("span", {
|
|
556
|
+
className: "truncate text-[13.5px] font-semibold text-foreground",
|
|
557
|
+
children: t === "focus" ? "Paste or drop files" : n ?? "Drop to attach"
|
|
558
|
+
}), /* @__PURE__ */ N("span", {
|
|
559
|
+
className: "truncate text-[11.5px] text-muted-foreground group-data-[collapsed=compact]/composer:hidden",
|
|
560
|
+
children: r
|
|
561
|
+
})]
|
|
562
|
+
})]
|
|
563
|
+
})
|
|
564
|
+
}, "drop") : null });
|
|
565
|
+
}
|
|
566
|
+
function ke({ size: n, dropZone: r = !0, dropLabel: i, className: a, ref: o, children: c, ...l }) {
|
|
567
|
+
let { renderCard: u, collapsed: d, fab: p, acceptedFileTypes: m } = U(), h = d === "fab" && !!p, g = A(null), _ = Oe(g, !r || h), v = !r || h ? null : _.isDropTarget ? "drop" : _.isFocusVisible ? "focus" : null, y = /* @__PURE__ */ P("div", {
|
|
568
|
+
ref: (e) => {
|
|
569
|
+
g.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
570
|
+
},
|
|
571
|
+
"data-slot": "composer-card",
|
|
572
|
+
"data-folded": h || void 0,
|
|
573
|
+
"data-drop-zone": r && !h || void 0,
|
|
574
|
+
"data-drop-target": _.isDropTarget || void 0,
|
|
575
|
+
className: e(Ee({ size: n }), a),
|
|
576
|
+
...r ? le(l, _.dropProps) : l,
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ N("div", {
|
|
579
|
+
"data-slot": "composer-card-body",
|
|
580
|
+
className: "contents",
|
|
581
|
+
inert: h || void 0,
|
|
582
|
+
"aria-hidden": h || void 0,
|
|
583
|
+
children: c
|
|
584
|
+
}),
|
|
585
|
+
r ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(X, {
|
|
586
|
+
state: v,
|
|
587
|
+
label: i,
|
|
588
|
+
hint: m?.length ? b(m) : "Images, documents, code — any file"
|
|
589
|
+
}), /* @__PURE__ */ N(ne, { children: /* @__PURE__ */ N("button", {
|
|
590
|
+
ref: _.buttonRef,
|
|
591
|
+
"data-slot": "composer-drop-target",
|
|
592
|
+
"aria-label": "Attach files: drop or paste here",
|
|
593
|
+
..._.buttonProps
|
|
594
|
+
}) })] }) : null,
|
|
595
|
+
p ? /* @__PURE__ */ N(f, {
|
|
596
|
+
"data-slot": "composer-fab",
|
|
597
|
+
"aria-label": "Open composer",
|
|
598
|
+
"aria-hidden": !h || void 0,
|
|
599
|
+
excludeFromTabOrder: !h,
|
|
600
|
+
onPress: p.restore,
|
|
601
|
+
className: e(t, "absolute inset-0 z-3 grid cursor-pointer place-items-center rounded-[inherit] border-0 bg-transparent p-0 text-foreground outline-none data-focus-visible:ring-2 data-focus-visible:ring-primary/60"),
|
|
602
|
+
children: p.icon ?? /* @__PURE__ */ N(s, {
|
|
603
|
+
name: "square-pencil",
|
|
604
|
+
size: 21,
|
|
605
|
+
sw: 1.9
|
|
606
|
+
})
|
|
607
|
+
}) : null
|
|
608
|
+
]
|
|
609
|
+
});
|
|
610
|
+
return /* @__PURE__ */ N(M, { children: u ? u(y) : y });
|
|
611
|
+
}
|
|
612
|
+
var Ae = B("box-border flex min-w-0 items-center gap-[5px]", {
|
|
613
|
+
variants: { align: {
|
|
614
|
+
"block-start": "order-[-2] w-full px-3 pt-2.5",
|
|
615
|
+
"inline-start": "order-[-1] shrink-0 self-start pt-2 pl-2",
|
|
616
|
+
"inline-end": "order-1 shrink-0 self-start pt-2 pr-2",
|
|
617
|
+
"block-end": "order-2 w-full px-2 pt-1 pb-2"
|
|
618
|
+
} },
|
|
619
|
+
defaultVariants: { align: "block-end" }
|
|
620
|
+
});
|
|
621
|
+
function Z({ align: t, className: n, ref: r, ...i }) {
|
|
622
|
+
return /* @__PURE__ */ N("div", {
|
|
623
|
+
ref: r,
|
|
624
|
+
"data-slot": "composer-addon",
|
|
625
|
+
"data-align": t ?? "block-end",
|
|
626
|
+
className: e(Ae({ align: t }), n),
|
|
627
|
+
...i
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function je({ className: t, ...n }) {
|
|
631
|
+
return /* @__PURE__ */ N(Z, {
|
|
632
|
+
"data-slot": "composer-footer",
|
|
633
|
+
align: "block-end",
|
|
634
|
+
className: e("flex-wrap group-data-[collapsed=compact]/composer:order-1 group-data-[collapsed=compact]/composer:[&>[data-slot=composer-spacer]]:hidden group-data-[collapsed=compact]/composer:w-auto group-data-[collapsed=compact]/composer:flex-nowrap group-data-[collapsed=compact]/composer:py-[7px] group-data-[collapsed=compact]/composer:pr-[7px] group-data-[collapsed=compact]/composer:pl-0", t),
|
|
635
|
+
...n
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
function Q({ className: t, ...n }) {
|
|
639
|
+
return /* @__PURE__ */ N("span", {
|
|
640
|
+
"data-slot": "composer-spacer",
|
|
641
|
+
"aria-hidden": "true",
|
|
642
|
+
className: e("flex-1", t),
|
|
643
|
+
...n
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function Me({ className: t, ...n }) {
|
|
647
|
+
return /* @__PURE__ */ N("span", {
|
|
648
|
+
"data-slot": "composer-separator",
|
|
649
|
+
role: "separator",
|
|
650
|
+
"aria-orientation": "vertical",
|
|
651
|
+
className: e("mx-0.5 h-4 w-px shrink-0 bg-border", t),
|
|
652
|
+
...n
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
function Ne({ icon: t, className: n, children: r, ...i }) {
|
|
656
|
+
return /* @__PURE__ */ P("span", {
|
|
657
|
+
"data-slot": "composer-text",
|
|
658
|
+
className: e("flex min-w-0 items-center gap-[7px] text-caption text-muted-foreground", n),
|
|
659
|
+
...i,
|
|
660
|
+
children: [t ? /* @__PURE__ */ N(s, {
|
|
661
|
+
name: t,
|
|
662
|
+
size: 13.5,
|
|
663
|
+
sw: 1.9
|
|
664
|
+
}) : null, r]
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
var Pe = B(e(t, "flex shrink-0 cursor-pointer items-center justify-center border-0 font-sans outline-none data-disabled:cursor-default data-disabled:opacity-35 data-focus-visible:ring-2 data-focus-visible:ring-primary/60"), {
|
|
668
|
+
variants: {
|
|
669
|
+
variant: {
|
|
670
|
+
ghost: "bg-transparent text-muted-foreground hover:bg-secondary!",
|
|
671
|
+
pill: "gap-[5px] rounded-[7px] bg-transparent px-[7px] py-[5px] text-[12.5px] font-semibold text-muted-foreground hover:bg-secondary!",
|
|
672
|
+
primary: "rounded-[50%] bg-primary text-white [transition:opacity_var(--duration-spring-snappy)_var(--ease-spring-snappy)]",
|
|
673
|
+
destructive: "rounded-[50%] bg-destructive text-white"
|
|
674
|
+
},
|
|
675
|
+
size: {
|
|
676
|
+
icon: "size-7 rounded-[7px] p-0",
|
|
677
|
+
round: "size-[30px] rounded-[50%] p-0",
|
|
678
|
+
pill: ""
|
|
679
|
+
},
|
|
680
|
+
tint: {
|
|
681
|
+
true: "text-primary",
|
|
682
|
+
false: ""
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
compoundVariants: [{
|
|
686
|
+
variant: "primary",
|
|
687
|
+
tint: !0,
|
|
688
|
+
className: "text-white"
|
|
689
|
+
}],
|
|
690
|
+
defaultVariants: {
|
|
691
|
+
variant: "ghost",
|
|
692
|
+
size: "icon",
|
|
693
|
+
tint: !1
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
function Fe({ variant: t, size: n, tint: r, className: i, ...a }) {
|
|
697
|
+
return /* @__PURE__ */ N(f, {
|
|
698
|
+
"data-slot": "composer-button",
|
|
699
|
+
className: e(Pe({
|
|
700
|
+
variant: t,
|
|
701
|
+
size: n ?? (t === "pill" ? "pill" : t === "primary" || t === "destructive" ? "round" : "icon"),
|
|
702
|
+
tint: !!r
|
|
703
|
+
}), i),
|
|
704
|
+
...a
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function Ie({ icon: e, children: t }) {
|
|
708
|
+
return /* @__PURE__ */ P(M, { children: [
|
|
709
|
+
typeof e == "string" ? /* @__PURE__ */ N(s, {
|
|
710
|
+
name: e,
|
|
711
|
+
size: 13.5,
|
|
712
|
+
sw: 2
|
|
713
|
+
}) : e,
|
|
714
|
+
N(typeof t == "string" ? o : "span", {
|
|
715
|
+
className: "whitespace-nowrap",
|
|
716
|
+
children: t
|
|
717
|
+
}),
|
|
718
|
+
/* @__PURE__ */ N(s, {
|
|
719
|
+
name: "chevron-down-wide",
|
|
720
|
+
size: 11,
|
|
721
|
+
sw: 2.4,
|
|
722
|
+
className: "opacity-60"
|
|
723
|
+
})
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
726
|
+
var Le = B("relative flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[7px] text-footnote text-foreground outline-none data-focused:bg-secondary data-pressed:bg-secondary-strong data-disabled:cursor-default data-disabled:opacity-40");
|
|
727
|
+
function Re({ className: t, children: n, ...r }) {
|
|
728
|
+
return /* @__PURE__ */ N(ee, {
|
|
729
|
+
"data-slot": "composer-menu-item",
|
|
730
|
+
className: e(Le(), t),
|
|
731
|
+
...r,
|
|
732
|
+
children: re(n, (e, { isSelected: t, selectionMode: n }) => /* @__PURE__ */ P(M, { children: [n === "none" ? null : /* @__PURE__ */ N("span", {
|
|
733
|
+
className: "grid w-3.5 shrink-0 place-items-center text-primary",
|
|
734
|
+
children: /* @__PURE__ */ N(E, {
|
|
735
|
+
initial: !1,
|
|
736
|
+
children: t ? /* @__PURE__ */ N(O.span, {
|
|
737
|
+
className: "grid place-items-center",
|
|
738
|
+
initial: {
|
|
739
|
+
scale: .3,
|
|
740
|
+
opacity: 0
|
|
741
|
+
},
|
|
742
|
+
animate: {
|
|
743
|
+
scale: 1,
|
|
744
|
+
opacity: 1
|
|
745
|
+
},
|
|
746
|
+
exit: {
|
|
747
|
+
scale: .3,
|
|
748
|
+
opacity: 0
|
|
749
|
+
},
|
|
750
|
+
transition: a.bouncy,
|
|
751
|
+
children: /* @__PURE__ */ N(s, {
|
|
752
|
+
name: "checkmark",
|
|
753
|
+
size: 13,
|
|
754
|
+
sw: 2.6
|
|
755
|
+
})
|
|
756
|
+
}, "tick") : null
|
|
757
|
+
})
|
|
758
|
+
}), e] }))
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
function ze({ "aria-label": t, options: n, value: r, defaultValue: i, onChange: a, icon: o, tint: s, className: c, menuClassName: l }) {
|
|
762
|
+
let [u, d] = G(r, i ?? n[0]?.id ?? "", a), f = n.find((e) => e.id === u) ?? n[0];
|
|
763
|
+
return /* @__PURE__ */ P(R, { children: [/* @__PURE__ */ N(Fe, {
|
|
764
|
+
"data-slot": "composer-select",
|
|
765
|
+
variant: "pill",
|
|
766
|
+
tint: s,
|
|
767
|
+
"aria-label": `${t}: ${f?.label ?? ""}`,
|
|
768
|
+
className: c,
|
|
769
|
+
children: /* @__PURE__ */ N(Ie, {
|
|
770
|
+
icon: o,
|
|
771
|
+
children: f?.short ?? f?.label
|
|
772
|
+
})
|
|
773
|
+
}), /* @__PURE__ */ N(m, {
|
|
774
|
+
placement: "top start",
|
|
775
|
+
className: e("min-w-[190px] p-1", l),
|
|
776
|
+
children: /* @__PURE__ */ N(L, {
|
|
777
|
+
"aria-label": t,
|
|
778
|
+
selectionMode: "single",
|
|
779
|
+
selectedKeys: u ? [u] : [],
|
|
780
|
+
disallowEmptySelection: !0,
|
|
781
|
+
onSelectionChange: (e) => {
|
|
782
|
+
let t = [...e][0];
|
|
783
|
+
t != null && d(String(t));
|
|
784
|
+
},
|
|
785
|
+
className: "outline-none",
|
|
786
|
+
children: n.map((e) => /* @__PURE__ */ N(Re, {
|
|
787
|
+
id: e.id,
|
|
788
|
+
textValue: e.label,
|
|
789
|
+
children: /* @__PURE__ */ P("span", {
|
|
790
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
791
|
+
children: [/* @__PURE__ */ N("span", {
|
|
792
|
+
className: "truncate font-medium",
|
|
793
|
+
children: e.label
|
|
794
|
+
}), e.description ? /* @__PURE__ */ N("span", {
|
|
795
|
+
className: "truncate text-[11.5px] text-muted-foreground",
|
|
796
|
+
children: e.description
|
|
797
|
+
}) : null]
|
|
798
|
+
})
|
|
799
|
+
}, e.id))
|
|
800
|
+
})
|
|
801
|
+
})] });
|
|
802
|
+
}
|
|
803
|
+
function Be() {
|
|
804
|
+
return /* @__PURE__ */ P("svg", {
|
|
805
|
+
width: "30",
|
|
806
|
+
height: "30",
|
|
807
|
+
viewBox: "0 0 30 30",
|
|
808
|
+
className: "absolute inset-0 animate-[wbSpin_1s_linear_infinite] motion-reduce:animate-none",
|
|
809
|
+
children: [/* @__PURE__ */ N("circle", {
|
|
810
|
+
cx: "15",
|
|
811
|
+
cy: "15",
|
|
812
|
+
r: "12.5",
|
|
813
|
+
fill: "none",
|
|
814
|
+
stroke: "var(--secondary-strong, var(--accent))",
|
|
815
|
+
strokeWidth: "2.5"
|
|
816
|
+
}), /* @__PURE__ */ N("circle", {
|
|
817
|
+
cx: "15",
|
|
818
|
+
cy: "15",
|
|
819
|
+
r: "12.5",
|
|
820
|
+
fill: "none",
|
|
821
|
+
stroke: "var(--primary)",
|
|
822
|
+
strokeWidth: "2.5",
|
|
823
|
+
strokeDasharray: "24 55",
|
|
824
|
+
strokeLinecap: "round"
|
|
825
|
+
})]
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
function Ve({ id: e, children: t }) {
|
|
829
|
+
return /* @__PURE__ */ N(E, {
|
|
830
|
+
mode: "popLayout",
|
|
831
|
+
initial: !1,
|
|
832
|
+
children: /* @__PURE__ */ N(O.span, {
|
|
833
|
+
className: "relative grid size-full place-items-center",
|
|
834
|
+
initial: {
|
|
835
|
+
opacity: 0,
|
|
836
|
+
scale: .4,
|
|
837
|
+
filter: "blur(3px)"
|
|
838
|
+
},
|
|
839
|
+
animate: {
|
|
840
|
+
opacity: 1,
|
|
841
|
+
scale: 1,
|
|
842
|
+
filter: "blur(0px)"
|
|
843
|
+
},
|
|
844
|
+
exit: {
|
|
845
|
+
opacity: 0,
|
|
846
|
+
scale: .4,
|
|
847
|
+
filter: "blur(3px)"
|
|
848
|
+
},
|
|
849
|
+
transition: a.snappy,
|
|
850
|
+
children: t
|
|
851
|
+
}, e)
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
function He({ variant: n = "ring", forceMount: r, className: i, ...o }) {
|
|
855
|
+
let { streaming: c, stop: l } = U(), u = c || !!r, d = n === "solid" ? /* @__PURE__ */ N(Fe, {
|
|
856
|
+
"data-slot": "composer-stop",
|
|
857
|
+
variant: "destructive",
|
|
858
|
+
"aria-label": "Stop",
|
|
859
|
+
onPress: l,
|
|
860
|
+
className: i,
|
|
861
|
+
...o,
|
|
862
|
+
children: /* @__PURE__ */ N("span", { className: "block size-[9px] rounded-[2px] bg-current" })
|
|
863
|
+
}) : /* @__PURE__ */ P(f, {
|
|
864
|
+
"data-slot": "composer-stop",
|
|
865
|
+
className: e(t, "relative grid size-[30px] cursor-pointer place-items-center border-0 bg-transparent text-foreground", i),
|
|
866
|
+
onPress: l,
|
|
867
|
+
"aria-label": "Stop",
|
|
868
|
+
...o,
|
|
869
|
+
children: [/* @__PURE__ */ N(Be, {}), /* @__PURE__ */ N(s, {
|
|
870
|
+
name: "stop-square",
|
|
871
|
+
size: 12,
|
|
872
|
+
sw: 2.4
|
|
873
|
+
})]
|
|
874
|
+
});
|
|
875
|
+
return /* @__PURE__ */ N(E, {
|
|
876
|
+
initial: !1,
|
|
877
|
+
children: u ? /* @__PURE__ */ N(O.span, {
|
|
878
|
+
"data-slot": "composer-stop-presence",
|
|
879
|
+
className: "flex shrink-0 items-center justify-center overflow-visible",
|
|
880
|
+
initial: {
|
|
881
|
+
width: 0,
|
|
882
|
+
opacity: 0,
|
|
883
|
+
scale: .5
|
|
884
|
+
},
|
|
885
|
+
animate: {
|
|
886
|
+
width: "auto",
|
|
887
|
+
opacity: 1,
|
|
888
|
+
scale: 1
|
|
889
|
+
},
|
|
890
|
+
exit: {
|
|
891
|
+
width: 0,
|
|
892
|
+
opacity: 0,
|
|
893
|
+
scale: .5
|
|
894
|
+
},
|
|
895
|
+
transition: a.snappy,
|
|
896
|
+
children: d
|
|
897
|
+
}, "stop") : null
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
function Ue({ morph: n = !0, stopVariant: r = "ring", className: i, ...a }) {
|
|
901
|
+
let { streaming: o, canSend: c, send: l, stop: u } = U(), d = o && n;
|
|
902
|
+
return /* @__PURE__ */ N(f, {
|
|
903
|
+
"data-slot": d ? "composer-stop" : "composer-send",
|
|
904
|
+
"data-state": d ? "stop" : "send",
|
|
905
|
+
"aria-label": d ? "Stop" : "Send",
|
|
906
|
+
isDisabled: d ? !1 : !c || o,
|
|
907
|
+
onPress: d ? u : l,
|
|
908
|
+
className: e(t, "relative flex size-[30px] shrink-0 cursor-pointer items-center justify-center overflow-visible rounded-[50%] border-0 p-0 font-sans text-white outline-none data-disabled:cursor-default data-focus-visible:ring-2 data-focus-visible:ring-primary/60", "[transition:background-color_var(--duration-spring-snappy)_var(--ease-spring-snappy),opacity_var(--duration-spring-snappy)_var(--ease-spring-snappy),color_var(--duration-spring-snappy)_var(--ease-spring-snappy)]", d ? r === "solid" ? "bg-destructive" : "bg-transparent text-foreground" : "bg-primary data-disabled:opacity-35", i),
|
|
909
|
+
...a,
|
|
910
|
+
children: /* @__PURE__ */ N(Ve, {
|
|
911
|
+
id: d ? `stop-${r}` : "send",
|
|
912
|
+
children: d ? r === "solid" ? /* @__PURE__ */ N("span", { className: "block size-[9px] rounded-[2px] bg-current" }) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Be, {}), /* @__PURE__ */ N(s, {
|
|
913
|
+
name: "stop-square",
|
|
914
|
+
size: 12,
|
|
915
|
+
sw: 2.4
|
|
916
|
+
})] }) : /* @__PURE__ */ N(s, {
|
|
917
|
+
name: "arrow-up-compact",
|
|
918
|
+
size: 16,
|
|
919
|
+
sw: 2.4
|
|
920
|
+
})
|
|
921
|
+
})
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function We({ acceptedFileTypes: e, allowsMultiple: t = !0, acceptDirectory: n, defaultCamera: r, icon: i = "plus", label: a = "Add files", className: o, onPress: c, ...l }) {
|
|
925
|
+
let { attachFiles: u, acceptedFileTypes: d } = U();
|
|
926
|
+
return /* @__PURE__ */ N(I, {
|
|
927
|
+
acceptedFileTypes: e ?? d,
|
|
928
|
+
allowsMultiple: t,
|
|
929
|
+
acceptDirectory: n,
|
|
930
|
+
defaultCamera: r,
|
|
931
|
+
onSelect: (e) => u(Array.from(e ?? []), { source: "picker" }),
|
|
932
|
+
children: /* @__PURE__ */ N(Fe, {
|
|
933
|
+
"data-slot": "composer-add",
|
|
934
|
+
variant: "ghost",
|
|
935
|
+
"aria-label": a,
|
|
936
|
+
title: a,
|
|
937
|
+
onPress: (e) => {
|
|
938
|
+
c?.(e);
|
|
939
|
+
},
|
|
940
|
+
className: o,
|
|
941
|
+
...l,
|
|
942
|
+
children: typeof i == "string" ? /* @__PURE__ */ N(s, {
|
|
943
|
+
name: i,
|
|
944
|
+
size: i === "plus" ? 17 : 15.5,
|
|
945
|
+
sw: 2
|
|
946
|
+
}) : i
|
|
947
|
+
})
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
function Ge({ accept: e, acceptedFileTypes: t, label: n = "Attach files", ...r }) {
|
|
951
|
+
return /* @__PURE__ */ N(We, {
|
|
952
|
+
"data-slot": "composer-attach",
|
|
953
|
+
icon: "paperclip-diagonal",
|
|
954
|
+
label: n,
|
|
955
|
+
acceptedFileTypes: t ?? (e ? e.split(",").map((e) => e.trim()).filter(Boolean) : void 0),
|
|
956
|
+
...r
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function Ke({ className: n }) {
|
|
960
|
+
let { expanded: r, setExpanded: i } = U(), a = r ? "Collapse composer" : "Expand composer";
|
|
961
|
+
return /* @__PURE__ */ N(p, {
|
|
962
|
+
"data-slot": "composer-expand",
|
|
963
|
+
className: e(t, "absolute top-[7px] right-2 z-2 grid size-7 cursor-pointer place-items-center rounded-[7px] border-0 bg-transparent p-0 text-muted-foreground hover:bg-secondary!", "group-data-[collapsed=compact]/composer:pointer-events-none group-data-[collapsed=compact]/composer:scale-75 group-data-[collapsed=compact]/composer:opacity-0 [transition:opacity_var(--duration-spring-snappy)_var(--ease-spring-snappy),scale_var(--duration-spring-snappy)_var(--ease-spring-snappy)] motion-reduce:transition-none", n),
|
|
964
|
+
"aria-label": a,
|
|
965
|
+
isSelected: r,
|
|
966
|
+
onPress: () => {
|
|
967
|
+
i(!r);
|
|
968
|
+
},
|
|
969
|
+
title: a,
|
|
970
|
+
children: /* @__PURE__ */ N(Ve, {
|
|
971
|
+
id: r ? "restore" : "expand",
|
|
972
|
+
children: /* @__PURE__ */ N(s, {
|
|
973
|
+
name: r ? "arrows-collapse" : "arrows-expand",
|
|
974
|
+
size: 14,
|
|
975
|
+
sw: 2
|
|
976
|
+
})
|
|
977
|
+
})
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
var qe = c({
|
|
981
|
+
scope: "terminal",
|
|
982
|
+
appearance: "dark"
|
|
983
|
+
}), Je = c({
|
|
984
|
+
scope: "workbench",
|
|
985
|
+
appearance: "dark"
|
|
986
|
+
}), Ye = {
|
|
987
|
+
image: {
|
|
988
|
+
icon: "photo",
|
|
989
|
+
color: "var(--success, oklch(0.723 0.191 149.6))",
|
|
990
|
+
label: "Image"
|
|
991
|
+
},
|
|
992
|
+
video: {
|
|
993
|
+
icon: "video",
|
|
994
|
+
color: "#AF52DE",
|
|
995
|
+
label: "Video"
|
|
996
|
+
},
|
|
997
|
+
audio: {
|
|
998
|
+
icon: "music-note",
|
|
999
|
+
color: "#FF2D55",
|
|
1000
|
+
label: "Audio"
|
|
1001
|
+
},
|
|
1002
|
+
pdf: {
|
|
1003
|
+
icon: "doc",
|
|
1004
|
+
color: "var(--destructive)",
|
|
1005
|
+
label: "PDF"
|
|
1006
|
+
},
|
|
1007
|
+
text: {
|
|
1008
|
+
icon: "doc",
|
|
1009
|
+
color: "var(--primary)",
|
|
1010
|
+
label: "Text"
|
|
1011
|
+
},
|
|
1012
|
+
archive: {
|
|
1013
|
+
icon: "archivebox",
|
|
1014
|
+
color: "#A2845E",
|
|
1015
|
+
label: "Archive"
|
|
1016
|
+
},
|
|
1017
|
+
other: {
|
|
1018
|
+
icon: "doc",
|
|
1019
|
+
color: "var(--muted-foreground)",
|
|
1020
|
+
label: "File"
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
function Xe(e, t) {
|
|
1024
|
+
let n = x(e.name).toUpperCase();
|
|
1025
|
+
return [n && n.length <= 5 ? n : Ye[t].label, S(e.size)].filter(Boolean).join(" · ");
|
|
1026
|
+
}
|
|
1027
|
+
function $({ children: t, className: n }) {
|
|
1028
|
+
return /* @__PURE__ */ N("span", {
|
|
1029
|
+
className: e("pointer-events-none absolute bottom-1 left-1 grid h-[18px] min-w-[18px] place-items-center rounded-md bg-black/55 px-1 text-[9.5px] leading-none font-bold tracking-[.02em] text-white uppercase", n),
|
|
1030
|
+
children: t
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
function Ze({ a: e, kind: t }) {
|
|
1034
|
+
let n = x(e.name);
|
|
1035
|
+
if (t === "video" && e.preview) return /* @__PURE__ */ P("span", {
|
|
1036
|
+
className: "relative block h-[58px] w-[104px]",
|
|
1037
|
+
children: [
|
|
1038
|
+
/* @__PURE__ */ N(O.img, {
|
|
1039
|
+
src: e.preview,
|
|
1040
|
+
alt: "",
|
|
1041
|
+
className: "block size-full object-cover",
|
|
1042
|
+
initial: {
|
|
1043
|
+
opacity: 0,
|
|
1044
|
+
filter: "blur(6px)"
|
|
1045
|
+
},
|
|
1046
|
+
animate: {
|
|
1047
|
+
opacity: 1,
|
|
1048
|
+
filter: "blur(0px)"
|
|
1049
|
+
},
|
|
1050
|
+
transition: a.smooth
|
|
1051
|
+
}),
|
|
1052
|
+
/* @__PURE__ */ N("span", {
|
|
1053
|
+
className: "absolute top-1/2 left-1/2 grid size-[22px] -translate-1/2 place-items-center rounded-full bg-black/55 pl-px text-white",
|
|
1054
|
+
children: /* @__PURE__ */ N(s, {
|
|
1055
|
+
name: "play",
|
|
1056
|
+
size: 11,
|
|
1057
|
+
sw: 2,
|
|
1058
|
+
className: "[&_path]:fill-current"
|
|
1059
|
+
})
|
|
1060
|
+
}),
|
|
1061
|
+
n ? /* @__PURE__ */ N($, { children: n }) : null
|
|
1062
|
+
]
|
|
1063
|
+
});
|
|
1064
|
+
if (t === "text" && e.excerpt) return /* @__PURE__ */ P("span", {
|
|
1065
|
+
className: "relative block h-[58px] w-[112px] text-left",
|
|
1066
|
+
children: [/* @__PURE__ */ N("span", {
|
|
1067
|
+
className: "block h-full overflow-hidden px-[7px] pt-[6px] font-mono text-[6px] leading-[8px] whitespace-pre text-muted-foreground [mask-image:linear-gradient(to_bottom,#000_45%,transparent_92%)]",
|
|
1068
|
+
children: e.excerpt
|
|
1069
|
+
}), n ? /* @__PURE__ */ N($, { children: n }) : null]
|
|
1070
|
+
});
|
|
1071
|
+
let r = Ye[t];
|
|
1072
|
+
return /* @__PURE__ */ P("span", {
|
|
1073
|
+
className: "flex h-[58px] w-[164px] min-w-0 items-center gap-2.5 px-2.5 text-left",
|
|
1074
|
+
children: [/* @__PURE__ */ N("span", {
|
|
1075
|
+
className: "grid size-9 shrink-0 place-items-center rounded-[9px] bg-[color-mix(in_srgb,var(--face)_15%,transparent)] text-(--face)",
|
|
1076
|
+
style: { "--face": r.color },
|
|
1077
|
+
children: /* @__PURE__ */ N(s, {
|
|
1078
|
+
name: r.icon,
|
|
1079
|
+
size: 20,
|
|
1080
|
+
sw: 1.8
|
|
1081
|
+
})
|
|
1082
|
+
}), /* @__PURE__ */ P("span", {
|
|
1083
|
+
className: "flex min-w-0 flex-col gap-px",
|
|
1084
|
+
children: [/* @__PURE__ */ N("span", {
|
|
1085
|
+
className: "truncate text-[12.5px] leading-[16px] font-medium text-foreground",
|
|
1086
|
+
children: e.name
|
|
1087
|
+
}), /* @__PURE__ */ N("span", {
|
|
1088
|
+
className: "truncate text-caption2 leading-[14px] text-muted-foreground",
|
|
1089
|
+
children: Xe(e, t)
|
|
1090
|
+
})]
|
|
1091
|
+
})]
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
function Qe({ className: t, ...n }) {
|
|
1095
|
+
let { attachments: r, annotate: i, canAnnotate: o, removeAttachment: c, editor: l } = U(), u = A(null), d = (e) => {
|
|
1096
|
+
let t = Array.from(u.current?.querySelectorAll("[data-slot=\"composer-attachment-open\"]") ?? []), n = t.findIndex((t) => t.closest("[data-attachment-id]")?.getAttribute("data-attachment-id") === e), r = t[n + 1] ?? t[n - 1];
|
|
1097
|
+
c(e), r ? r.focus() : l?.commands.focus("end");
|
|
1098
|
+
}, p = (e) => (t) => {
|
|
1099
|
+
(t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), d(e));
|
|
1100
|
+
};
|
|
1101
|
+
return /* @__PURE__ */ N(E, {
|
|
1102
|
+
initial: !1,
|
|
1103
|
+
children: r.length ? /* @__PURE__ */ N(O.div, {
|
|
1104
|
+
"data-slot": "composer-attachments-presence",
|
|
1105
|
+
className: "order-[-2] w-full min-w-0 overflow-hidden group-data-[collapsed=compact]/composer:hidden",
|
|
1106
|
+
initial: {
|
|
1107
|
+
height: 0,
|
|
1108
|
+
opacity: 0
|
|
1109
|
+
},
|
|
1110
|
+
animate: {
|
|
1111
|
+
height: "auto",
|
|
1112
|
+
opacity: 1
|
|
1113
|
+
},
|
|
1114
|
+
exit: {
|
|
1115
|
+
height: 0,
|
|
1116
|
+
opacity: 0
|
|
1117
|
+
},
|
|
1118
|
+
transition: a.smooth,
|
|
1119
|
+
children: /* @__PURE__ */ N(Z, {
|
|
1120
|
+
ref: u,
|
|
1121
|
+
"data-slot": "composer-attachments",
|
|
1122
|
+
align: "block-start",
|
|
1123
|
+
className: e("flex-wrap gap-2", t),
|
|
1124
|
+
...n,
|
|
1125
|
+
children: /* @__PURE__ */ N(E, {
|
|
1126
|
+
mode: "popLayout",
|
|
1127
|
+
initial: !1,
|
|
1128
|
+
children: r.map((t) => {
|
|
1129
|
+
let n = me(t), l = n === "image", u = Xe(t, n);
|
|
1130
|
+
return /* @__PURE__ */ P(O.div, {
|
|
1131
|
+
layout: "position",
|
|
1132
|
+
layoutDependency: r.map((e) => e.id).join(),
|
|
1133
|
+
"data-slot": "composer-attachment",
|
|
1134
|
+
"data-attachment-id": t.id,
|
|
1135
|
+
"data-kind": n,
|
|
1136
|
+
className: "relative",
|
|
1137
|
+
initial: {
|
|
1138
|
+
opacity: 0,
|
|
1139
|
+
scale: .6,
|
|
1140
|
+
filter: "blur(4px)"
|
|
1141
|
+
},
|
|
1142
|
+
animate: {
|
|
1143
|
+
opacity: 1,
|
|
1144
|
+
scale: 1,
|
|
1145
|
+
filter: "blur(0px)"
|
|
1146
|
+
},
|
|
1147
|
+
exit: {
|
|
1148
|
+
opacity: 0,
|
|
1149
|
+
scale: .6,
|
|
1150
|
+
filter: "blur(4px)"
|
|
1151
|
+
},
|
|
1152
|
+
transition: a.snappy,
|
|
1153
|
+
children: [l ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(f, {
|
|
1154
|
+
"data-slot": "composer-attachment-open",
|
|
1155
|
+
onPress: () => {
|
|
1156
|
+
i(t.id);
|
|
1157
|
+
},
|
|
1158
|
+
onKeyDown: p(t.id),
|
|
1159
|
+
title: `${o ? "Annotate" : "Preview"} ${t.name}`,
|
|
1160
|
+
"aria-label": `${o ? "Annotate" : "Preview"} ${t.name}`,
|
|
1161
|
+
"data-theme-scope": qe["data-theme-scope"],
|
|
1162
|
+
className: e(qe.className, "block cursor-pointer overflow-hidden rounded-ctl border border-border bg-background p-0"),
|
|
1163
|
+
children: t.src ? /* @__PURE__ */ N("img", {
|
|
1164
|
+
src: t.src,
|
|
1165
|
+
alt: t.name,
|
|
1166
|
+
className: "block h-[58px] max-w-[130px] object-cover"
|
|
1167
|
+
}) : /* @__PURE__ */ N("span", {
|
|
1168
|
+
className: "grid h-[58px] w-[72px] place-items-center text-tertiary-foreground",
|
|
1169
|
+
children: /* @__PURE__ */ N(s, {
|
|
1170
|
+
name: "doc-corner",
|
|
1171
|
+
size: 18,
|
|
1172
|
+
sw: 1.7
|
|
1173
|
+
})
|
|
1174
|
+
})
|
|
1175
|
+
}), /* @__PURE__ */ N("span", {
|
|
1176
|
+
className: "pointer-events-none absolute bottom-1 left-1 grid size-[18px] place-items-center rounded-md bg-black/55 text-white",
|
|
1177
|
+
children: /* @__PURE__ */ N("svg", {
|
|
1178
|
+
width: "11",
|
|
1179
|
+
height: "11",
|
|
1180
|
+
viewBox: "0 0 24 24",
|
|
1181
|
+
fill: "none",
|
|
1182
|
+
stroke: "currentColor",
|
|
1183
|
+
strokeWidth: "2.2",
|
|
1184
|
+
strokeLinecap: "round",
|
|
1185
|
+
strokeLinejoin: "round",
|
|
1186
|
+
children: /* @__PURE__ */ N("path", { d: "M14 4l6 6-10 10H4v-6z" })
|
|
1187
|
+
})
|
|
1188
|
+
})] }) : /* @__PURE__ */ N(f, {
|
|
1189
|
+
"data-slot": "composer-attachment-open",
|
|
1190
|
+
onPress: () => {
|
|
1191
|
+
t.src && typeof window < "u" && window.open(t.src, "_blank", "noopener");
|
|
1192
|
+
},
|
|
1193
|
+
onKeyDown: p(t.id),
|
|
1194
|
+
title: `${t.name}${u ? ` · ${u}` : ""}`,
|
|
1195
|
+
"aria-label": `Open ${t.name}${u ? `, ${u}` : ""}`,
|
|
1196
|
+
className: "block cursor-pointer overflow-hidden rounded-ctl border border-border bg-secondary p-0 font-sans outline-none data-focus-visible:ring-2 data-focus-visible:ring-primary/60",
|
|
1197
|
+
children: /* @__PURE__ */ N(Ze, {
|
|
1198
|
+
a: t,
|
|
1199
|
+
kind: n
|
|
1200
|
+
})
|
|
1201
|
+
}), /* @__PURE__ */ N(f, {
|
|
1202
|
+
onPress: () => {
|
|
1203
|
+
c(t.id);
|
|
1204
|
+
},
|
|
1205
|
+
"aria-label": `Remove ${t.name}`,
|
|
1206
|
+
className: "absolute -top-1.5 -right-1.5 grid size-[18px] cursor-pointer place-items-center rounded-[50%] border border-border bg-popover p-0 text-[10px] leading-none text-muted-foreground",
|
|
1207
|
+
children: "✕"
|
|
1208
|
+
})]
|
|
1209
|
+
}, t.id);
|
|
1210
|
+
})
|
|
1211
|
+
})
|
|
1212
|
+
})
|
|
1213
|
+
}, "strip") : null
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
function $e(e) {
|
|
1217
|
+
let { $from: t, empty: n } = e.state.selection;
|
|
1218
|
+
return n && t.depth === 1 && t.parent.type.name === "paragraph";
|
|
1219
|
+
}
|
|
1220
|
+
var et = [H.create({
|
|
1221
|
+
name: "composerFileDrop",
|
|
1222
|
+
addProseMirrorPlugins() {
|
|
1223
|
+
return [new ue({ props: { handleDOMEvents: { drop: (e, t) => !!t.dataTransfer && Array.from(t.dataTransfer.types ?? []).includes("Files") && !!e.dom.closest("[data-slot=\"composer-card\"][data-drop-zone]") } } })];
|
|
1224
|
+
}
|
|
1225
|
+
})];
|
|
1226
|
+
function tt({ placeholder: t = "Ask anything — @ files, / commands, paste images", autoFocus: n, imagePaste: r = "chip", slashMenu: i = !0, references: a, className: o }) {
|
|
1227
|
+
let s = U(), { value: c, setValue: l, expanded: f, attachments: p, addAttachment: m, setEditor: h, collapsed: g } = s, _ = A(s);
|
|
1228
|
+
_.current = s;
|
|
1229
|
+
let v = A(null), y = (e) => {
|
|
1230
|
+
let t = v.current;
|
|
1231
|
+
return !t || e.key !== "Enter" ? !1 : e.metaKey || e.ctrlKey ? (_.current.send(), !0) : e.shiftKey ? t.commands.insertContent({ type: "hardBreak" }) : document.querySelector(".slash-menu") || !$e(t) ? !1 : (_.current.send(), !0);
|
|
1232
|
+
}, b = (e) => {
|
|
1233
|
+
let t = e.clipboardData, n = Array.from(t?.files ?? []);
|
|
1234
|
+
if (n.length) return n.every((e) => e.type.startsWith("image/")) && (r === "inline" || t?.getData("text/plain").trim()) ? !1 : (e.preventDefault(), _.current.attachFiles(n, { source: "paste" }), !0);
|
|
1235
|
+
let i = t?.getData("text/plain") ?? "";
|
|
1236
|
+
return !d(i) || !v.current ? !1 : u(v.current, i);
|
|
1237
|
+
}, x = k.useCallback((e) => {
|
|
1238
|
+
v.current = e, h(e);
|
|
1239
|
+
}, [h]), S = k.useCallback((e) => {
|
|
1240
|
+
_.current.annotate(e.id);
|
|
1241
|
+
}, []);
|
|
1242
|
+
return /* @__PURE__ */ N("div", {
|
|
1243
|
+
"data-slot": "composer-input",
|
|
1244
|
+
className: "order-0 min-w-0 flex-1 basis-[60%]",
|
|
1245
|
+
children: /* @__PURE__ */ N(oe, {
|
|
1246
|
+
markdown: c,
|
|
1247
|
+
onChange: l,
|
|
1248
|
+
toolbar: !1,
|
|
1249
|
+
slashMenu: i,
|
|
1250
|
+
references: a,
|
|
1251
|
+
placeholder: t,
|
|
1252
|
+
autofocus: n,
|
|
1253
|
+
className: e("wb-composer-doc", f && g === "none" && "wb-composer-doc-expanded", g === "compact" && "wb-composer-doc-compact", o),
|
|
1254
|
+
onKeyDown: y,
|
|
1255
|
+
onPaste: b,
|
|
1256
|
+
imagePaste: r,
|
|
1257
|
+
attachments: p,
|
|
1258
|
+
onAttachmentAdd: ({ file: e, ...t }) => {
|
|
1259
|
+
m({
|
|
1260
|
+
...t,
|
|
1261
|
+
kind: "image",
|
|
1262
|
+
file: e
|
|
1263
|
+
});
|
|
1264
|
+
},
|
|
1265
|
+
onAttachmentRemove: (e) => e.forEach((e) => _.current.removeAttachment(e)),
|
|
1266
|
+
onAttachmentOpen: S,
|
|
1267
|
+
onEditorReady: x,
|
|
1268
|
+
extensions: et
|
|
1269
|
+
})
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
var nt = B("relative box-border flex min-w-0 flex-col text-caption text-muted-foreground", {
|
|
1273
|
+
variants: {
|
|
1274
|
+
side: {
|
|
1275
|
+
top: "order-[-1]",
|
|
1276
|
+
bottom: "order-1"
|
|
1277
|
+
},
|
|
1278
|
+
variant: {
|
|
1279
|
+
attached: "border border-border bg-popover",
|
|
1280
|
+
detached: "rounded-[9px] bg-secondary",
|
|
1281
|
+
flush: ""
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
compoundVariants: [
|
|
1285
|
+
{
|
|
1286
|
+
side: "top",
|
|
1287
|
+
variant: "attached",
|
|
1288
|
+
className: "mx-(--bump-inset) -mb-3 rounded-t-card border-b-0 pb-3"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
side: "bottom",
|
|
1292
|
+
variant: "attached",
|
|
1293
|
+
className: "mx-(--bump-inset) -mt-3 rounded-b-card border-t-0 pt-3"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
side: "top",
|
|
1297
|
+
variant: "detached",
|
|
1298
|
+
className: "mx-2 mb-1.5"
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
side: "bottom",
|
|
1302
|
+
variant: "detached",
|
|
1303
|
+
className: "mx-2 mt-1.5"
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
side: "top",
|
|
1307
|
+
variant: "flush",
|
|
1308
|
+
className: "mb-1.5"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
side: "bottom",
|
|
1312
|
+
variant: "flush",
|
|
1313
|
+
className: "mt-1.5"
|
|
1314
|
+
}
|
|
1315
|
+
],
|
|
1316
|
+
defaultVariants: {
|
|
1317
|
+
side: "bottom",
|
|
1318
|
+
variant: "attached"
|
|
1319
|
+
}
|
|
1320
|
+
}), rt = k.createContext(null);
|
|
1321
|
+
function it() {
|
|
1322
|
+
let e = k.useContext(rt);
|
|
1323
|
+
if (!e) throw Error("useComposerBump must be used within <ComposerBump>");
|
|
1324
|
+
return e;
|
|
1325
|
+
}
|
|
1326
|
+
function at({ side: t = "bottom", variant: n, inset: r = 12, draggable: i = !1, open: a, defaultOpen: o = !1, onOpenChange: s, peek: c = 0, maxReveal: u = 320, bounds: d, boundsInset: f = 0, minimizable: p = !1, minimized: m, onMinimizedChange: h, onProgressChange: g, closeOnEscape: _ = !0, className: v, style: y, children: b, ref: x, ...S }) {
|
|
1327
|
+
let [C, w] = G(a, o, s), T = A(null), [E, D] = j(null), O = k.useId();
|
|
1328
|
+
k.useLayoutEffect(() => {
|
|
1329
|
+
if (!i || !d) return;
|
|
1330
|
+
let e = () => {
|
|
1331
|
+
let e = d.current, t = T.current;
|
|
1332
|
+
if (!e || !t) return;
|
|
1333
|
+
let n = t.parentElement, r = n && parseFloat(getComputedStyle(n).paddingTop) || 0;
|
|
1334
|
+
D(Math.max(0, Math.round(t.getBoundingClientRect().bottom - e.getBoundingClientRect().top - f - r)));
|
|
1335
|
+
};
|
|
1336
|
+
if (e(), typeof ResizeObserver > "u") return;
|
|
1337
|
+
let t = new ResizeObserver(e);
|
|
1338
|
+
d.current && t.observe(d.current);
|
|
1339
|
+
let n = T.current?.closest("[data-slot=\"composer\"]");
|
|
1340
|
+
return n && t.observe(n), () => t.disconnect();
|
|
1341
|
+
}, [
|
|
1342
|
+
i,
|
|
1343
|
+
d,
|
|
1344
|
+
f
|
|
1345
|
+
]);
|
|
1346
|
+
let M = d ? E ?? u : u, P = Math.max(0, Math.min(c, M * .75)), F = l({
|
|
1347
|
+
open: C,
|
|
1348
|
+
onOpenChange: w,
|
|
1349
|
+
peek: P,
|
|
1350
|
+
maxReveal: M,
|
|
1351
|
+
minimizable: p,
|
|
1352
|
+
minimized: m,
|
|
1353
|
+
onMinimizedChange: h
|
|
1354
|
+
}), I = i ? F.reveal : 0, L = M > P ? Math.max(0, (I - P) / (M - P)) : 0, ee = F.minimize, R = A(g);
|
|
1355
|
+
R.current = g, k.useEffect(() => {
|
|
1356
|
+
R.current?.({
|
|
1357
|
+
progress: L,
|
|
1358
|
+
reveal: I,
|
|
1359
|
+
minimize: ee,
|
|
1360
|
+
dragging: F.dragging,
|
|
1361
|
+
settling: F.settling
|
|
1362
|
+
});
|
|
1363
|
+
}, [
|
|
1364
|
+
L,
|
|
1365
|
+
I,
|
|
1366
|
+
ee,
|
|
1367
|
+
F.dragging,
|
|
1368
|
+
F.settling
|
|
1369
|
+
]);
|
|
1370
|
+
let z = A(() => w(!1));
|
|
1371
|
+
z.current = () => w(!1), k.useEffect(() => {
|
|
1372
|
+
if (!i || !C || !_) return;
|
|
1373
|
+
let e = (e) => {
|
|
1374
|
+
e.key === "Escape" && !e.defaultPrevented && z.current();
|
|
1375
|
+
};
|
|
1376
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1377
|
+
}, [
|
|
1378
|
+
i,
|
|
1379
|
+
C,
|
|
1380
|
+
_
|
|
1381
|
+
]);
|
|
1382
|
+
let te = {
|
|
1383
|
+
side: t,
|
|
1384
|
+
draggable: i,
|
|
1385
|
+
open: C,
|
|
1386
|
+
setOpen: w,
|
|
1387
|
+
reveal: I,
|
|
1388
|
+
progress: L,
|
|
1389
|
+
peek: P,
|
|
1390
|
+
maxReveal: M,
|
|
1391
|
+
dragging: F.dragging,
|
|
1392
|
+
handleProps: i ? F.handlers : null,
|
|
1393
|
+
toggle: F.toggle,
|
|
1394
|
+
windowRef: T,
|
|
1395
|
+
contentId: O
|
|
1396
|
+
};
|
|
1397
|
+
return /* @__PURE__ */ N(rt.Provider, {
|
|
1398
|
+
value: te,
|
|
1399
|
+
children: /* @__PURE__ */ N("div", {
|
|
1400
|
+
ref: x,
|
|
1401
|
+
"data-slot": "composer-bump",
|
|
1402
|
+
"data-side": t,
|
|
1403
|
+
"data-variant": n ?? "attached",
|
|
1404
|
+
"data-draggable": i || void 0,
|
|
1405
|
+
"data-open": i && C || void 0,
|
|
1406
|
+
"data-dragging": F.dragging || void 0,
|
|
1407
|
+
"data-peeking": i && P > 0 && !C || void 0,
|
|
1408
|
+
className: e(nt({
|
|
1409
|
+
side: t,
|
|
1410
|
+
variant: n
|
|
1411
|
+
}), i && "has-[>[data-slot=composer-bump-handle]>[data-bump-grip]]:pt-3", v),
|
|
1412
|
+
style: {
|
|
1413
|
+
"--bump-inset": `${r * (1 - L)}px`,
|
|
1414
|
+
"--bump-reveal": `${I}px`,
|
|
1415
|
+
"--bump-max": `${M}px`,
|
|
1416
|
+
"--bump-progress": L,
|
|
1417
|
+
...y
|
|
1418
|
+
},
|
|
1419
|
+
...S,
|
|
1420
|
+
children: b
|
|
1421
|
+
})
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
function ot({ grip: t = !0, label: n, className: r, children: i, ...a }) {
|
|
1425
|
+
let o = it(), s = (e) => {
|
|
1426
|
+
let t = e.target.closest("button,a,input,[role=button]");
|
|
1427
|
+
t && !t.hasAttribute("data-bump-grip") || o.handleProps?.onPointerDown(e);
|
|
1428
|
+
};
|
|
1429
|
+
if (!o.draggable) return /* @__PURE__ */ N("div", {
|
|
1430
|
+
"data-slot": "composer-bump-handle",
|
|
1431
|
+
className: e("flex min-w-0 items-center gap-[7px] px-[11px] py-1.5", r),
|
|
1432
|
+
...a,
|
|
1433
|
+
children: i
|
|
1434
|
+
});
|
|
1435
|
+
let c = n ?? (o.open ? "Collapse" : "Expand");
|
|
1436
|
+
return /* @__PURE__ */ P("div", {
|
|
1437
|
+
"data-slot": "composer-bump-handle",
|
|
1438
|
+
"data-dragging": o.dragging || void 0,
|
|
1439
|
+
className: e("group/handle flex min-w-0 touch-none flex-col select-none", o.dragging ? "cursor-grabbing" : "cursor-grab", r),
|
|
1440
|
+
...a,
|
|
1441
|
+
onPointerDown: s,
|
|
1442
|
+
onClick: (e) => {
|
|
1443
|
+
let t = e.target.closest("button,a,input,[role=button]");
|
|
1444
|
+
t && !t.hasAttribute("data-bump-grip") || o.toggle();
|
|
1445
|
+
},
|
|
1446
|
+
onPointerMove: o.handleProps?.onPointerMove,
|
|
1447
|
+
onPointerUp: o.handleProps?.onPointerUp,
|
|
1448
|
+
onPointerCancel: o.handleProps?.onPointerCancel,
|
|
1449
|
+
onLostPointerCapture: o.handleProps?.onLostPointerCapture,
|
|
1450
|
+
children: [t ? /* @__PURE__ */ N("button", {
|
|
1451
|
+
type: "button",
|
|
1452
|
+
"data-bump-grip": "",
|
|
1453
|
+
"data-slot": "composer-bump-grip",
|
|
1454
|
+
"aria-label": c,
|
|
1455
|
+
"aria-expanded": o.open,
|
|
1456
|
+
"aria-controls": o.contentId,
|
|
1457
|
+
className: "absolute top-0 left-1/2 z-1 grid h-3 w-16 -translate-x-1/2 touch-none cursor-[inherit] place-items-center border-0 bg-transparent p-0 outline-none focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-primary",
|
|
1458
|
+
children: /* @__PURE__ */ N("span", { className: e("block h-1 rounded-[999px] [transition:width_var(--duration-spring-bouncy)_var(--ease-spring-bouncy),background_var(--duration-spring-snappy)_var(--ease-spring-snappy)] motion-reduce:transition-none", o.open ? "w-10 bg-muted-foreground" : "w-8 bg-handle group-hover/handle:w-10 group-hover/handle:bg-tertiary-foreground") })
|
|
1459
|
+
}) : null, i ? /* @__PURE__ */ N("div", {
|
|
1460
|
+
className: e("flex min-w-0 items-center gap-[7px] px-[11px] pb-1.5", !t && "pt-1.5"),
|
|
1461
|
+
children: i
|
|
1462
|
+
}) : null]
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
function st({ label: t = "Details", className: n, children: r, ...i }) {
|
|
1466
|
+
let a = it(), o = a.reveal > 0;
|
|
1467
|
+
return /* @__PURE__ */ N("div", {
|
|
1468
|
+
ref: a.windowRef,
|
|
1469
|
+
id: a.contentId,
|
|
1470
|
+
role: "region",
|
|
1471
|
+
"aria-label": t,
|
|
1472
|
+
"aria-hidden": !o,
|
|
1473
|
+
inert: !o,
|
|
1474
|
+
"data-slot": "composer-bump-content",
|
|
1475
|
+
"data-peeking": a.peek > 0 && !a.open || void 0,
|
|
1476
|
+
className: e("relative order-first h-(--bump-reveal) w-full shrink-0 overflow-hidden", o ? "visible" : "invisible", "data-peeking:[mask-image:linear-gradient(to_bottom,transparent,#000_34px)]", n),
|
|
1477
|
+
children: /* @__PURE__ */ N("div", {
|
|
1478
|
+
"data-slot": "composer-bump-body",
|
|
1479
|
+
className: "absolute inset-x-0 bottom-0 flex h-(--bump-max) min-w-0 flex-col justify-end overflow-hidden",
|
|
1480
|
+
...i,
|
|
1481
|
+
children: r
|
|
1482
|
+
})
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
function ct({ src: t, onClose: n, onSave: r, canvas: o, annotator: s, origin: c }) {
|
|
1486
|
+
let l = A(null), u = A(null), d = A(null), p = A(null), m = A(null), g = h(), _ = o === void 0 ? s === void 0 ? g : s : null, v = A(!1), y = A(null), b = () => {
|
|
1487
|
+
let e = l.current, t = c?.() ?? null;
|
|
1488
|
+
if (!e || !t) return null;
|
|
1489
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
1490
|
+
if (!n.width || !r.width) return null;
|
|
1491
|
+
let i = Math.max(n.width / r.width, n.height / r.height), a = n.width / i, o = n.height / i, s = (r.width - a) / 2, u = (r.height - o) / 2, d = parseFloat(getComputedStyle(t.closest("button") ?? t).borderRadius) || 10;
|
|
1492
|
+
return {
|
|
1493
|
+
el: t,
|
|
1494
|
+
x: n.left + n.width / 2 - (r.left + r.width / 2),
|
|
1495
|
+
y: n.top + n.height / 2 - (r.top + r.height / 2),
|
|
1496
|
+
scale: i,
|
|
1497
|
+
clip: `inset(${u}px ${s}px ${u}px ${s}px round ${d / i}px)`
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1500
|
+
k.useLayoutEffect(() => {
|
|
1501
|
+
let e = l.current, t = u.current;
|
|
1502
|
+
if (!e || !t) return;
|
|
1503
|
+
let n = i(), r = (e, t = 0) => e && D(e, {
|
|
1504
|
+
opacity: [0, 1],
|
|
1505
|
+
y: [n ? 0 : 10, 0]
|
|
1506
|
+
}, n ? { duration: .15 } : {
|
|
1507
|
+
...a.smooth,
|
|
1508
|
+
delay: t
|
|
1509
|
+
}), o = () => {
|
|
1510
|
+
D(m.current, { opacity: [0, 1] }, { duration: n ? .15 : .28 }), r(d.current, .08), r(p.current, .12);
|
|
1511
|
+
let t = n ? null : b();
|
|
1512
|
+
if (!t) {
|
|
1513
|
+
D(e, {
|
|
1514
|
+
opacity: [0, 1],
|
|
1515
|
+
scale: [n ? 1 : .94, 1]
|
|
1516
|
+
}, n ? { duration: .15 } : a.smooth);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
y.current = t.el, t.el.style.visibility = "hidden", e.style.opacity = "1", D(e, {
|
|
1520
|
+
x: [t.x, 0],
|
|
1521
|
+
y: [t.y, 0],
|
|
1522
|
+
scale: [t.scale, 1],
|
|
1523
|
+
clipPath: [t.clip, "inset(0px 0px 0px 0px round 14px)"]
|
|
1524
|
+
}, a.smooth);
|
|
1525
|
+
};
|
|
1526
|
+
return e.style.opacity = "0", t.complete && t.naturalWidth ? o() : (t.addEventListener("load", o, { once: !0 }), t.addEventListener("error", o, { once: !0 })), () => {
|
|
1527
|
+
y.current && (y.current.style.visibility = "");
|
|
1528
|
+
};
|
|
1529
|
+
}, []);
|
|
1530
|
+
let x = (e) => {
|
|
1531
|
+
if (v.current) return;
|
|
1532
|
+
v.current = !0;
|
|
1533
|
+
let t = l.current, n = i();
|
|
1534
|
+
for (let e of [d.current, p.current]) e && D(e, { opacity: 0 }, { duration: .12 });
|
|
1535
|
+
m.current && D(m.current, { opacity: 0 }, { duration: n ? .12 : .3 }), y.current && (y.current.style.visibility = "");
|
|
1536
|
+
let r = !n && t ? b() : null;
|
|
1537
|
+
y.current && (y.current.style.visibility = "hidden");
|
|
1538
|
+
let o = () => {
|
|
1539
|
+
y.current && (y.current.style.visibility = ""), y.current = null, e();
|
|
1540
|
+
};
|
|
1541
|
+
if (!t) return o();
|
|
1542
|
+
if (!r) {
|
|
1543
|
+
D(t, {
|
|
1544
|
+
opacity: 0,
|
|
1545
|
+
scale: n ? 1 : .96
|
|
1546
|
+
}, { duration: .14 }).then(o);
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
D(t, {
|
|
1550
|
+
x: r.x,
|
|
1551
|
+
y: r.y,
|
|
1552
|
+
scale: r.scale,
|
|
1553
|
+
clipPath: r.clip
|
|
1554
|
+
}, {
|
|
1555
|
+
...a.smooth,
|
|
1556
|
+
restDelta: .5,
|
|
1557
|
+
restSpeed: 20
|
|
1558
|
+
}).then(o);
|
|
1559
|
+
}, S = () => {
|
|
1560
|
+
let e = u.current, t = l.current;
|
|
1561
|
+
if (!e || !t) return x(n);
|
|
1562
|
+
let i = e.clientWidth, a = e.clientHeight, o = Math.max(1, e.naturalWidth / i), s = document.createElement("canvas");
|
|
1563
|
+
s.width = i * o, s.height = a * o;
|
|
1564
|
+
let c = s.getContext("2d");
|
|
1565
|
+
if (!c) return x(n);
|
|
1566
|
+
c.drawImage(e, 0, 0, s.width, s.height);
|
|
1567
|
+
let d = () => {
|
|
1568
|
+
let e = s.toDataURL("image/png");
|
|
1569
|
+
x(() => r(e));
|
|
1570
|
+
}, f = t.querySelector("[data-slot=\"pencil-canvas\"] > svg") ?? t.querySelector("svg");
|
|
1571
|
+
if (!f) return d();
|
|
1572
|
+
let p = f.cloneNode(!0);
|
|
1573
|
+
p.setAttribute("width", String(i)), p.setAttribute("height", String(a)), p.setAttribute("viewBox", "0 0 " + i + " " + a), p.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
1574
|
+
let m = new Image();
|
|
1575
|
+
m.onload = () => {
|
|
1576
|
+
c.drawImage(m, 0, 0, s.width, s.height), d();
|
|
1577
|
+
}, m.onerror = d, m.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(p));
|
|
1578
|
+
}, C = (t, n, r) => /* @__PURE__ */ N(f, {
|
|
1579
|
+
onPress: r,
|
|
1580
|
+
className: e("cursor-pointer rounded-[9px] px-3.5 py-[7px] font-sans text-[12.5px] font-[650] text-white", n ? "border-0 bg-primary" : "border border-white/20 bg-transparent"),
|
|
1581
|
+
children: t
|
|
1582
|
+
}), w = o === void 0 && !_, T = (e) => /* @__PURE__ */ P(M, { children: [
|
|
1583
|
+
/* @__PURE__ */ P("div", {
|
|
1584
|
+
ref: d,
|
|
1585
|
+
className: "flex items-center gap-2",
|
|
1586
|
+
children: [/* @__PURE__ */ N("span", {
|
|
1587
|
+
className: "flex-1 font-sans text-footnote font-[650] text-foreground",
|
|
1588
|
+
children: e ? e.title ?? "Annotate — strokes flatten into the image on save" : "Preview"
|
|
1589
|
+
}), e ? /* @__PURE__ */ P(M, { children: [C("Cancel", !1, () => x(n)), C("Save annotation", !0, S)] }) : C("Close", !0, () => x(n))]
|
|
1590
|
+
}),
|
|
1591
|
+
/* @__PURE__ */ P("div", {
|
|
1592
|
+
ref: l,
|
|
1593
|
+
"data-slot": "annotate-lightbox-image",
|
|
1594
|
+
className: "relative origin-center self-center overflow-hidden rounded-card border border-white/14 bg-code will-change-transform",
|
|
1595
|
+
children: [/* @__PURE__ */ N("img", {
|
|
1596
|
+
ref: u,
|
|
1597
|
+
src: t,
|
|
1598
|
+
alt: "",
|
|
1599
|
+
className: "block h-auto max-h-[68vh] w-auto max-w-[86vw] min-w-[min(340px,86vw)]"
|
|
1600
|
+
}), e?.canvas]
|
|
1601
|
+
}),
|
|
1602
|
+
e?.toolbar ? /* @__PURE__ */ N("div", {
|
|
1603
|
+
ref: p,
|
|
1604
|
+
children: e.toolbar
|
|
1605
|
+
}) : null
|
|
1606
|
+
] });
|
|
1607
|
+
return /* @__PURE__ */ P(te, {
|
|
1608
|
+
"data-slot": "annotate-lightbox",
|
|
1609
|
+
"data-preview": w || void 0,
|
|
1610
|
+
isOpen: !0,
|
|
1611
|
+
isDismissable: !0,
|
|
1612
|
+
onOpenChange: (e) => {
|
|
1613
|
+
e || x(n);
|
|
1614
|
+
},
|
|
1615
|
+
className: "fixed inset-0 z-400 grid place-items-center",
|
|
1616
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1617
|
+
ref: m,
|
|
1618
|
+
"data-slot": "annotate-lightbox-backdrop",
|
|
1619
|
+
"aria-hidden": "true",
|
|
1620
|
+
className: "absolute inset-0 bg-black/74"
|
|
1621
|
+
}), /* @__PURE__ */ N(z, {
|
|
1622
|
+
className: "relative outline-none",
|
|
1623
|
+
children: /* @__PURE__ */ N(F, {
|
|
1624
|
+
"aria-label": w ? "Preview image" : "Annotate image",
|
|
1625
|
+
...Je,
|
|
1626
|
+
className: e(Je.className, "flex max-w-[90vw] flex-col gap-2.5 text-foreground outline-none"),
|
|
1627
|
+
children: _ ? /* @__PURE__ */ N(_, { children: T }) : T(o === void 0 ? null : { canvas: o })
|
|
1628
|
+
})
|
|
1629
|
+
})]
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
//#endregion
|
|
1633
|
+
export { ct as AnnotateLightbox, he as Composer, We as ComposerAdd, Z as ComposerAddon, Ge as ComposerAttach, Qe as ComposerAttachments, at as ComposerBump, st as ComposerBumpContent, ot as ComposerBumpHandle, Fe as ComposerButton, ke as ComposerCard, Ke as ComposerExpand, Ce as ComposerFab, je as ComposerFooter, tt as ComposerInput, Re as ComposerMenuItem, we as ComposerOptions, Te as ComposerOptionsOutlet, W as ComposerOutlet, Ie as ComposerPillLabel, ze as ComposerSelect, Ue as ComposerSend, Me as ComposerSeparator, Q as ComposerSpacer, He as ComposerStop, Ne as ComposerText, Ae as composerAddonVariants, nt as composerBumpVariants, Pe as composerButtonVariants, Ee as composerCardVariants, J as composerFabVariants, Le as composerMenuItemVariants, U as useComposer, it as useComposerBump };
|